Skip to content

Commit d86bc21

Browse files
mjunaidcaclaude
andcommitted
fix(cli): ensure history.txt exists before interactive mode
Interactive mode now creates the .taskflow directory and history.txt file proactively using mkdir(parents=True) and touch(exist_ok=True). This prevents FileNotFoundError when the directory doesn't exist. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 35d60fc commit d86bc21

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

packages/cli/src/taskflow/commands/interactive.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,19 @@ def interactive() -> None:
6868
# Set up history file in .taskflow directory
6969
try:
7070
storage = get_storage()
71-
history_file = storage.taskflow_dir / "history.txt"
71+
taskflow_dir = storage.taskflow_dir
7272
except Exception:
7373
# Fallback if storage not initialized - use current directory
7474
from taskflow.config import get_taskflow_dir
7575

7676
taskflow_dir = get_taskflow_dir()
77-
taskflow_dir.mkdir(exist_ok=True)
78-
history_file = taskflow_dir / "history.txt"
77+
78+
# Ensure directory exists and create history file path
79+
taskflow_dir.mkdir(parents=True, exist_ok=True)
80+
history_file = taskflow_dir / "history.txt"
81+
82+
# Touch the history file to ensure it exists
83+
history_file.touch(exist_ok=True)
7984

8085
# Create session with history
8186
session: PromptSession = PromptSession(history=FileHistory(str(history_file)))

0 commit comments

Comments
 (0)