Skip to content

feat: capture user-pasted plans from chat messages#39

Open
chriswritescode-dev wants to merge 3 commits into
mainfrom
feat/paste-plan-capture
Open

feat: capture user-pasted plans from chat messages#39
chriswritescode-dev wants to merge 3 commits into
mainfrom
feat/paste-plan-capture

Conversation

@chriswritescode-dev
Copy link
Copy Markdown
Owner

Summary

Captures user-pasted plans (marked with ---plan-start/---plan-end) from chat messages, persists them server-side, and prompts the architect to ask the user how to execute. Adds a TUI-side plan store so a captured plan survives message compaction.

Changes

Added

  • src/hooks/plan-capture.ts — event hook for user message completion, captures pasted plans and prompts architect
  • src/utils/tui-plan-store.ts — direct SQLite read/write access to persisted plans from TUI
  • inspectLatestPastedPlan — finds marked plans in the newest user message only (not scanning older messages of the same role)

Updated

  • src/utils/marked-plan-parser.ts — refactored inspectLatestMarkedPlan into a generic role-based helper
  • src/utils/plan-from-messages.tsfetchLatestPlanForSession falls back to user-pasted plans when no assistant plan exists
  • src/tui.tsx — prefers persisted captured plan over message parsing in execute-plan flow
  • src/services/plan-capture.ts — added capturePastedPlanForSession

Tests

  • 797-line test expansion in test/plan-capture.test.ts covering pasted plan capture, streaming path, dedup, loop guard, and TUI fallback ordering
  • 3 new tests for user-pasted plan fallback in test/utils/plan-from-messages.test.ts

Breaking changes

None.

Adds server-side capture of user-pasted plans (marked with ---plan-start/---plan-end) from chat messages, persists them to the plans repo, and prompts the architect to ask how to execute.

- inspectLatestPastedPlan finds plans in the newest user message only (not scanning older messages of the same role)
- Handles both streaming (message.part.updated) and completion (message.updated) paths
- Captures are skipped when a loop is active on the session
- TUI-side plan store (tui-plan-store.ts) provides direct SQLite access so captured plans survive message compaction
- TUI prefers persisted plan over message-parsed plan in execute-plan flow
- fetchLatestPlanForSession falls back to user-pasted plans when no assistant plan exists
- Refactored inspectLatestMarkedPlan into a generic role-based helper
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