Skip to content

feat(plan): archive an imported task's file to plan/imported/, stamped with its card - #18

Merged
Its-My-Work merged 1 commit into
mainfrom
feat/plan-archive-on-import
Sep 22, 2026
Merged

Its-My-Work merged 1 commit into
mainfrom
feat/plan-archive-on-import

Conversation

@Its-My-Work

Copy link
Copy Markdown
Owner

Follow-up to #17. A card's status is never written back into its source file (the file is a draft, the board is authoritative once a card exists) — so once a plan task lands a card, its file moves from plan/tasks/ to plan/imported/ instead of sitting there still looking like an open proposal.

Why location, not a status field

During a room turn a bot has no list_tasks tool (only a queued background task gets _ccs_task_manager), so the board is not something it can check from inside a room — the file's location is the only cheap, reliable "already done" signal available there. ROOM_RULES now says so explicitly for every participant.

What

  • plan-lib.js: stampImported (pure) — inserts imported_card/imported_at into a file's front matter.
  • plan-import.js: archivePlanFiles (fs-injectable) — moves each entry plan/tasks/ → plan/imported/, stamped; one file's failure is reported and does not stop the rest.
  • server.js: applyPlanImport (now async) archives only tasks that actually landed a card this run — a skipped task (not selected, or blocked by an unselected dependency) never loses its only copy; a toUpdate whose card was deleted from under us is not archived either. Runs strictly after the board transaction commits; a failed archive is logged and reported (archived/archiveErrors) but never fails or undoes the import itself. Committed via room-git.js the same way a room's own changes are.

Tests

plan-lib 59, plan-import 31 (fake fs, incl. a missing file reported without stopping the rest), plans-api 24 (real server + real files: archived files actually gone from plan/tasks/ and present in plan/imported/ stamped with the real card id; re-import only reviews a task whose file is back; the dependent-skip case now also asserts the skipped files are untouched on disk). Whole npm test suite green. docs/plan-kanban-import.md.

Not verified

A live room run reading plan/imported/ and acting on the new rule.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Y2ZSHUdJHqVsvSNQ5ZeQ3f

…d with its card

A card's status is never written back into its source file (the file is a draft, the board
is authoritative once a card exists) — so once a plan task lands a card, its file moves from
plan/tasks/ to plan/imported/ instead of staying in plan/tasks/ looking like an open proposal.

Why location, not just a status field: during a room turn a bot has no list_tasks tool (only
a queued background task gets _ccs_task_manager), so the board is not something it can check
from inside a room — the file's location is the only cheap, reliable "already done" signal
available there. ROOM_RULES now says so explicitly for every participant.

- plan-lib.js: stampImported (pure) inserts imported_card/imported_at into a file's front
  matter, given a card id and timestamp.
- plan-import.js: archivePlanFiles (fs-injectable) moves each entry from plan/tasks/ to
  plan/imported/, stamped; one file's failure is reported and does not stop the rest.
- server.js: applyPlanImport (now async) archives only tasks that actually landed a card this
  run (toCreate always; a toUpdate whose card was deleted from under us does not) — a SKIPPED
  task (not selected, or blocked by an unselected dependency) never loses its only copy. Runs
  strictly after the board transaction commits; a failed archive is logged and reported
  (archived/archiveErrors) but never fails or undoes the import itself. Committed via
  room-git.js the same way a room's own changes are (ROOM_GIT=off disables it here too).

Tests: plan-lib (59), plan-import (31, fake fs incl. a missing file reported without stopping
the rest), plans-api (24, real server + real files: archived files actually gone from
plan/tasks/ and present in plan/imported/ stamped with the REAL card id; re-import only
reviews a task whose file is back; the dependent-skip case now also asserts the skipped
files are untouched on disk). Whole npm test suite green. docs/plan-kanban-import.md.

Not verified: a live room run reading plan/imported/ and acting on the new rule.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y2ZSHUdJHqVsvSNQ5ZeQ3f
@Its-My-Work
Its-My-Work merged commit 76e7ed2 into main Sep 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant