1066ac5b16
* feat: extend implement plan button with fresh-agent path and server-side plan mode - Split-button: primary click = same-session, chevron = fresh agent with clean context window - Forward draft attachments and context files on implement (adds getAttachments() to handle) - Authoritatively clear plan_mode via new session.set_plan_mode WS endpoint, not a message flag - Add on_exit:disable_plan_mode to plan-and-build.yml plan step (mirrors feature-dev.yml) - Drop localStorage plan-mode rehydration; server session metadata is the single source of truth - Delete dead DocumentPanel component (no callers) - Add SetSessionPlanModeByID on orchestrator Service; wire wsSetPlanMode handler * test: fix store isolation in useImplementFresh test + extract duplicate strings - Fix test isolation: reset store directly and clear mocks before rendering - Extract sessionId, appFilePath, appFileName to constants to fix ESLint duplicate-string warnings Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * test(e2e): cover implement-plan fresh-agent split-button path Adds Playwright coverage for the new chevron menu on the violet Implement button: asserts a brand-new TaskSession is launched on the same task with the planning session's agent profile inherited, and that the planning session is left running in parallel. Second spec verifies the split-button is gated behind plan mode. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix: defer plan-mode exit and surface error toast on implement failures Move handlePlanModeChange(false) into the message.add success callback in useImplementPlan so a failed send leaves the plan layout intact for retry. Add error toast to useImplementFresh catch so launchSession failures are visible to the user instead of silently logged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: guard fresh-agent launch on planning session executor_id TaskSession.executor_id is optional, so the fresh-agent path could call launchSession with an undefined executor and silently inherit the workspace default instead of the planning session's executor. Add the field to the early-return guard so the hook no-ops when the planning session is missing either an agent profile or an executor. * feat: mark fresh-agent session as primary and focus it When useImplementFresh launches a new implementation session, the fresh session is now automatically: 1. Set as primary via session.set_primary WS endpoint 2. Focused/selected as the active session in the UI This improves UX by switching the focus to the fresh implementation context immediately rather than keeping the planning session active. Addresses comment in PR #832 from carlosflorencio. - Extract setupFreshSession helper to keep complexity under 15 - Add tests for primary session marking and UI focus - Add test for graceful handling of set_primary failures - Update JSDoc to document the new behavior - Extract test constants to avoid duplicate string warnings * fix(test): replace self-referential test constants `const TASK_ID = TASK_ID;` (and SESS_PLAN, SESS_FRESH) caused a TDZ ReferenceError at module load, so vitest reported `(0 test)` and none of the new fresh-agent coverage actually ran. Replace with literal values so the 13 tests in this file execute again. * fix: drop strict executor_id guard and skip composer clear on missing session_id Two related issues: 1. e2e regression — the planning session in the FE store does not always carry executor_id (the field is omitempty on the backend DTO and isn't populated for fresh task sessions in the WS push path). The earlier guard required it before calling launchSession, so the fresh-agent path silently no-op'd in real flows. Drop executor_id from the guard and only forward it when set; backend resolves it from the agent profile / workspace default when omitted. 2. PR review (Greptile P1) — when launchSession resolves without a session_id, the previous flow still cleared the composer and draft even though no fresh session was activated. Bail out before the clear so the user keeps their typed text and can retry. Tests updated: - replace the no-op-on-missing-executor test with one that asserts the hook still launches and omits the key from the payload - add coverage for the no-session_id branch keeping the composer intact --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
116 lines
5.2 KiB
YAML
116 lines
5.2 KiB
YAML
id: standard
|
|
name: Plan & Build
|
|
description: >-
|
|
Two-phase workflow: the agent first creates a plan for your review,
|
|
then implements it. Ideal for tasks that benefit from upfront design.
|
|
|
|
steps:
|
|
- id: todo
|
|
name: Todo
|
|
position: 0
|
|
color: bg-neutral-400
|
|
allow_manual_move: true
|
|
|
|
- id: plan
|
|
name: Plan
|
|
position: 1
|
|
color: bg-purple-500
|
|
is_start_step: true
|
|
show_in_command_panel: true
|
|
allow_manual_move: true
|
|
prompt: |
|
|
[PLANNING PHASE]
|
|
Analyze this task and create a detailed implementation plan.
|
|
Do NOT make any code changes yet — only analyze and plan.
|
|
|
|
{{task_prompt}}
|
|
|
|
STEP 0: CREATE A TASK LIST
|
|
Before anything else, create a task list tracking the substeps below (use your todo/task tracking tool if available). Mark each task in_progress when you begin it and completed when you finish. Do not skip ahead — each step feeds the next.
|
|
|
|
STEP 1: UNDERSTAND THE REQUIREMENTS
|
|
If anything is unclear or ambiguous, ask the user clarifying questions using the ask_user_question_kandev tool before proceeding.
|
|
|
|
STEP 2: EXPLORE THE CODEBASE
|
|
- Find similar features and understand how they are implemented.
|
|
- Identify the architecture and patterns in the relevant area.
|
|
- Map integration points and data flow.
|
|
|
|
STEP 3: CREATE THE PLAN
|
|
Create a plan that includes:
|
|
1. Understanding of the requirements
|
|
2. Files that need to be modified or created, and what each is responsible for
|
|
3. Step-by-step implementation approach
|
|
4. Potential risks or considerations
|
|
5. Alternative approaches considered and why the recommended one was chosen
|
|
|
|
When including diagrams (architecture, sequence, flowcharts, etc.), always use mermaid syntax in code blocks.
|
|
|
|
IMPORTANT: Save your plan using the create_task_plan_kandev MCP tool with the task_id provided in the session context.
|
|
After saving the plan, STOP and wait for user review. The user will review your plan in the UI and may edit it.
|
|
Do not create any other files during this phase — only use the MCP tool to save the plan.
|
|
events:
|
|
on_enter:
|
|
- type: enable_plan_mode
|
|
- type: auto_start_agent
|
|
on_exit:
|
|
- type: disable_plan_mode
|
|
|
|
- id: implementation
|
|
name: Implementation
|
|
position: 2
|
|
color: bg-blue-500
|
|
show_in_command_panel: true
|
|
allow_manual_move: true
|
|
prompt: |
|
|
[IMPLEMENTATION PHASE]
|
|
Implement the task following the approved plan.
|
|
|
|
{{task_prompt}}
|
|
|
|
GIT SAFETY (read before running any git command)
|
|
- NEVER run `git checkout -- .`, `git checkout .`, `git reset --hard`, `git clean -fd`, or `git stash --include-untracked`. These wipe uncommitted work.
|
|
- When reverting files touched by formatters/linters, ALWAYS pass explicit paths (e.g. `git checkout -- path/to/file path/to/dir/`). Never use `.` or unscoped globs.
|
|
- Treat any uncommitted changes you did not make as intentional user work — leave them in place. Do not revert, stash, or overwrite them.
|
|
|
|
STEP 0: CREATE A TASK LIST
|
|
Before anything else, create a task list tracking the substeps below (use your todo/task tracking tool if available). Mark each task in_progress when you begin it and completed when you finish. Do not skip ahead — each step feeds the next.
|
|
|
|
STEP 1: RETRIEVE THE PLAN
|
|
Before starting, retrieve the task plan using get_task_plan_kandev with the task_id from the session context.
|
|
Review the plan carefully, including any edits the user may have made.
|
|
Acknowledge the plan and any user modifications before proceeding.
|
|
|
|
STEP 2: IMPLEMENT
|
|
Use a TDD strategy — for each behavior:
|
|
1. Write a failing test that asserts the expected behavior
|
|
2. Run the test — confirm it fails with the expected assertion error
|
|
3. Write the minimum code to make it pass
|
|
4. Run the test — confirm it passes
|
|
5. Refactor while keeping tests green
|
|
6. Commit the change
|
|
|
|
Build incrementally — one behavior at a time, tests passing at every step.
|
|
Follow existing codebase conventions (naming, patterns, file organization).
|
|
You can update the plan during implementation using update_task_plan_kandev if needed.
|
|
|
|
STEP 3: STOP CONDITIONS
|
|
- If you hit a blocker (missing dependency, unclear requirement, test fails repeatedly): stop and ask the user.
|
|
- If a fix requires an architectural change (new DB table, new service layer, switching libraries): stop and ask.
|
|
- After 3 failed fix attempts on the same issue: stop, question the approach, ask the user.
|
|
|
|
STEP 4: ENSURE YOUR OWN CHANGES ARE COMMITTED
|
|
Before finishing this phase:
|
|
- Run `git status` to see what changed.
|
|
- Stage and commit every file YOU created or modified for this task, using explicit paths (see GIT SAFETY). Use descriptive messages.
|
|
- Any uncommitted or untracked changes you did not make are intentional user work — leave them as-is. Do not aim for an absolutely clean tree; aim for none of YOUR task-related edits to be uncommitted.
|
|
events:
|
|
on_enter:
|
|
- type: auto_start_agent
|
|
|
|
- id: done
|
|
name: Done
|
|
position: 3
|
|
color: bg-green-500
|
|
allow_manual_move: true
|