34 lines
1.9 KiB
Markdown
34 lines
1.9 KiB
Markdown
# RESEARCH: move-completed-tasks-to-complete-folder
|
|
|
|
## Objective
|
|
|
|
When `--transition complete` is called, move the task directory from `tasks/<name>/` to `tasks/complete/<name>/`. Keep `--list` and `--audit` showing only active tasks. Allow `--task <name>` to find completed tasks by fallback.
|
|
|
|
## Current Behavior
|
|
|
|
`--transition complete` only writes the `.state` file to `"complete"`. The task directory stays in `tasks/<name>/` alongside active tasks, cluttering the listing and audit.
|
|
|
|
## Design
|
|
|
|
### _task_dir fallback
|
|
|
|
Add a fallback in `_task_dir`: if `tasks/<name>/` doesn't exist, check `tasks/complete/<name>/`. This ensures `--task <name>` and `--transition` still work for completed tasks.
|
|
|
|
### cmd_transition move
|
|
|
|
After `_write_state(task_path, target)`, if `target == "complete"`, compute the tasks root and move `task_path` to `tasks/complete/<name>/`. Create `tasks/complete/` if it doesn't exist. Refuse if a completed task with the same name already exists.
|
|
|
|
### _all_task_dirs unchanged
|
|
|
|
Do NOT scan `tasks/complete/` in `_all_task_dirs`. Completed tasks are out of sight from `--list` and `--audit`. The fallback in `_task_dir` is sufficient for targeted lookups.
|
|
|
|
### cmd_create_task
|
|
|
|
`_task_dir` already returns the completed path via fallback, so `cmd_create_task` will see `task_path.exists()` and refuse with "already exists". No separate check needed.
|
|
|
|
## Risks
|
|
|
|
- **Audit:** `--audit` uses `_all_task_dirs` which doesn't scan `tasks/complete/`, so completed tasks are invisible to audit. This is the desired behavior.
|
|
- **Loop references:** If a loop's `current_task` points to a completed task, the audit at line 954 checks `_task_dir(ltask, args.project).exists()` which will find the completed task via fallback. Correct.
|
|
- **`--transition` on completed tasks:** `_task_dir` finds the completed task, `_require_state` reads `"complete"`, and `LEGAL_TRANSITIONS.get("complete", [])` returns `[]`, so any transition is refused. Correct.
|