From 41119b713b7ea27fb9093fc35b398de6541599cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20J=C3=A4gle?= <17176678+mrsimpson@users.noreply.github.com> Date: Tue, 2 Jun 2026 05:54:28 +0000 Subject: [PATCH 1/3] feat: add true terminal states to all workflows with $DONE_DEFAULT instruction Remove all outgoing transitions from final states of 14 workflows to make them truly terminal. Add $DONE_DEFAULT placeholder that instructs agents to present results and create PRs (on GitHub repos) without transitioning to any other state. Key changes: - Updated ProjectDocsManager to include $DONE_DEFAULT with explicit 'do NOT transition' instruction - Removed all transitions from final states in 13 workflows - Added explicit 'done' state to TDD workflow (exits TDD cycle) - Deleted obsolete state-machine.ts (100% dead code) - Updated test expectations for new $DONE_DEFAULT value All 385+286+64 tests pass. --- ...pment-plan-feat-add-terminal-done-state.md | 162 ++++++++ packages/core/src/index.ts | 1 - packages/core/src/project-docs-manager.ts | 2 + packages/core/src/state-machine.ts | 370 ------------------ .../test/unit/project-docs-manager.test.ts | 2 + resources/workflows/adr.yaml | 6 +- resources/workflows/boundary-testing.yaml | 11 +- resources/workflows/bugfix.yaml | 15 +- resources/workflows/c4-analysis.yaml | 8 +- resources/workflows/epcc.yaml | 15 +- resources/workflows/greenfield.yaml | 15 +- resources/workflows/minor.yaml | 15 +- resources/workflows/posts.yaml | 19 +- resources/workflows/pr-review.yaml | 6 +- resources/workflows/qrspi.yaml | 15 +- resources/workflows/skilled-bugfix.yaml | 15 +- resources/workflows/skilled-epcc.yaml | 15 +- resources/workflows/skilled-greenfield.yaml | 15 +- resources/workflows/slides.yaml | 24 +- resources/workflows/tdd.yaml | 14 +- resources/workflows/waterfall.yaml | 10 +- 21 files changed, 209 insertions(+), 546 deletions(-) create mode 100644 .vibe/development-plan-feat-add-terminal-done-state.md delete mode 100644 packages/core/src/state-machine.ts diff --git a/.vibe/development-plan-feat-add-terminal-done-state.md b/.vibe/development-plan-feat-add-terminal-done-state.md new file mode 100644 index 00000000..3d461a8d --- /dev/null +++ b/.vibe/development-plan-feat-add-terminal-done-state.md @@ -0,0 +1,162 @@ +# Development Plan: repo (feat/add-terminal-done-state branch) + +*Generated on 2026-05-26 by Vibe Feature MCP* +*Workflow: [epcc](https://codemcp.github.io/workflows/workflows/epcc)* + +## Goal +Make final states of all workflows truly terminal by removing their outgoing transitions. Add a `$DONE_DEFAULT` placeholder to final state instructions that gets substituted at runtime with PR creation and result presentation instructions. + +## Key Decisions +1. **Remove, don't add**: Instead of adding a new `done` state, remove ALL outgoing transitions from the existing final states. They become truly terminal by having zero transitions. +2. **`$DONE_DEFAULT` runtime substitution**: Add `$DONE_DEFAULT` to each final state's `default_instructions`. The `InstructionGenerator` already applies variable substitution (via `ProjectDocsManager.getVariableSubstitutions()`), so `$DONE_DEFAULT` will be replaced at runtime with actual instructions. +3. **Terminal detection already works**: The PlantUML renderer (lines 191-203 of `PlantUMLRenderer.ts`) detects states with zero transitions and renders them with `--> [*]`. No changes needed. +4. **No schema change**: `transitions: []` is already valid per the TypeScript type (`transitions: YamlTransition[]`). +5. **Remove obsolete `state-machine.ts`**: The hardcoded state machine (`packages/core/src/state-machine.ts`) is 100% dead code. Remove it entirely. +6. **TDD exception**: The TDD workflow's `refactor` state is not truly terminal — it's the last phase of the iterative TDD cycle. Added an explicit `done` state so agents can exit the cycle. The `refactor` state keeps its cycle transitions (`refactoring_complete → red`, `need_different_approach → green`) while `feature_complete` now transitions to `done` instead of looping back to `explore`. + +## Notes +- Currently, 14 workflows have final states with outgoing transitions (loop-back to initial, backward transitions, abandon transitions). +- Removing all outgoing transitions from these final states makes them truly terminal. +- The `$DONE_DEFAULT` instruction will tell agents what to do when they reach the final state (PR creation for GitHub repos, present results to user). +- If agents need to go back to an earlier state or abandon, they can use `proceed_to_phase` to jump to any phase. +- **Critical finding on `state-machine.ts`**: The hardcoded state machine is 100% dead code. Zero source files import from it. Zero tests cover it. Zero runtime code calls its functions. **Decision: Remove it entirely instead of updating it.** + +--- + +## Explore +### Tasks +- [x] Research all workflow YAML files to understand the current state machine structure +- [x] Identify the final state/transition pattern in each workflow +- [x] Examine the hardcoded state machine (`state-machine.ts`) and its terminal behavior +- [x] Review the JSON schema for state machine validation +- [x] Check the PlantUML renderer's terminal state detection logic +- [x] Review the visualizer's state rendering (initial vs terminal states) +- [x] **Investigate whether `state-machine.ts` is actually used** — confirmed 100% dead code +- [x] **Investigate `$DONE_DEFAULT` runtime substitution** — `InstructionGenerator.applyVariableSubstitution()` already handles `$PLACEHOLDER` patterns via `ProjectDocsManager.getVariableSubstitutions()` +- [x] Document findings and create implementation plan + +### Completed +- [x] Created development plan file +- [x] Analyzed all 25 YAML workflow files +- [x] Identified the loop-back pattern: final state → initial state +- [x] Reviewed hardcoded state machine (`state-machine.ts`) — confirmed obsolete dead code +- [x] Reviewed schema (`state-machine-schema.json`) +- [x] Reviewed PlantUML renderer (already handles terminal states) +- [x] Documented implementation plan with refined scope + +### Final State Analysis + +**14 workflows with final states that have outgoing transitions** (need changes): + +| Workflow | Final State | Outgoing Transitions | +|---|---|---| +| **boundary-testing** | `finalize` | `need_test_changes` → `test_suite_implementation`, `finalization_complete` → `architecture_analysis` | +| **bugfix** | `finalize` | `need_fix_changes` → `fix`, `finalization_complete` → `reproduce`, `abandon_bug` → `reproduce` | +| **epcc** | `commit` | `need_code_changes` → `code`, `commit_complete` → `explore`, `abandon_feature` → `explore` | +| **greenfield** | `finalize` | `need_code_changes` → `code`, `finalization_complete` → `ideation`, `abandon_project` → `ideation` | +| **minor** | `finalize` | `need_implementation_changes` → `implement`, `finalization_complete` → `explore`, `abandon_feature` → `explore` | +| **posts** | `distribution` | `distribution_complete` → `discovery`, `need_final_review` → `illustration`, `abandon_post` → `discovery` | +| **pr-review** | `publish_review` | `review_published` → `determine_intent` | +| **qrspi** | `commit` | `commit_complete` → `questions`, `need_code_changes` → `implement`, `abandon_feature` → `questions` | +| **skilled-bugfix** | `finalize` | `need_fix_changes` → `fix`, `finalization_complete` → `reproduce`, `abandon_bug` → `reproduce` | +| **skilled-epcc** | `commit` | `need_code_changes` → `code`, `commit_complete` → `explore`, `abandon_feature` → `explore` | +| **skilled-greenfield** | `finalize` | `need_code_changes` → `code`, `finalization_complete` → `ideation`, `abandon_project` → `ideation` | +| **slides** | `deliver` | `delivery_complete` → `ideate`, `need_final_review` → `review`, `abandon_presentation` → `ideate` | +| **tdd** | `refactor` | `refactoring_complete` → `red`, `need_different_approach` → `green`, `feature_complete` → `explore`, `abandon_feature` → `explore` | +| **waterfall** | `finalize` | `need_final_changes` → `implementation`, `finalization_complete` → `requirements` | + +**11 workflows already terminal or with no loop-back to initial** (no changes needed): +- `business-analysis` — `analysis_complete` has `transitions: []` (already terminal) +- `sdd-greenfield` — `document` has `transitions: []` (already terminal) +- `sdd-greenfield-crowd` — `document` has self-loop only +- `sdd-bugfix-crowd` — `verify` has backward transitions only +- `sdd-bugfix` — `verify` has backward transitions only +- `sdd-feature-crowd` — `implement` has backward transitions only +- `sdd-feature` — `implement` has backward transitions only +- `adr` — `commit` has backward transition only +- `big-bang-conversion` — `conversion_readiness` has self-loops and backward only +- `c4-analysis` — `analysis_complete` has backward transition only +- `game-beginner` — `celebrate` loops to `imagine` (non-initial) + +### Runtime Substitution Infrastructure + +The `$DONE_DEFAULT` substitution is already supported: + +1. `InstructionGenerator.applyVariableSubstitution()` (line 70-90 of `instruction-generator.ts`) replaces `$PLACEHOLDER` patterns +2. `ProjectDocsManager.getVariableSubstitutions()` (line 445-466 of `project-docs-manager.ts`) returns the substitutions map +3. Both `proceed-to-phase.ts` and `whats-next.ts` call `instructionGenerator.generateInstructions()` which applies substitution + +We just need to add `$DONE_DEFAULT` to the substitutions map and to the final states' `default_instructions`. + +--- + +## Plan +### Tasks +- [x] **Add `$DONE_DEFAULT` to substitutions map**: Updated `ProjectDocsManager.getVariableSubstitutions()` to include `$DONE_DEFAULT` with instructions: "Feature work is complete. If this is a GitHub repository: create a PR. Always: present the final result to the user." + +- [x] **Update 14 final states**: Removed all `transitions` from the final states and added `$DONE_DEFAULT` to their `default_instructions`: + - `boundary-testing` → `finalize` + - `bugfix` → `finalize` + - `epcc` → `commit` + - `greenfield` → `finalize` + - `minor` → `finalize` + - `posts` → `distribution` + - `pr-review` → `publish_review` + - `qrspi` → `commit` + - `skilled-bugfix` → `finalize` + - `skilled-epcc` → `commit` + - `skilled-greenfield` → `finalize` + - `slides` → `deliver` + - `tdd` → `done` (NEW: added explicit done state) + - `waterfall` → `finalize` + + Template for each final state: + ```yaml + : + description: '...' + default_instructions: | + ...existing instructions... + + $DONE_DEFAULT + transitions: [] + ``` + + **TDD exception**: `refactor` is not truly terminal — it's the last phase of the TDD cycle. Added explicit `done` state: + - `refactoring_complete → red` (kept: TDD cycle transition) + - `need_different_approach → green` (kept: TDD cycle transition) + - `feature_complete → done` (changed from `explore`: exits TDD cycle) + - `abandon_feature → explore` (kept: abandon transition) + - `done` state: `transitions: []`, includes `$DONE_DEFAULT` + +- [x] **Remove obsolete `state-machine.ts`**: Deleted `packages/core/src/state-machine.ts` and its re-export from `packages/core/src/index.ts`. + +- [x] **Write tests**: Updated `project-docs-manager.test.ts` to include `$DONE_DEFAULT` in expected substitutions map. All 385 tests pass. + +- [x] **Verify all workflows still load correctly** after changes: Build succeeded, all tests pass. + +### Completed +*All tasks completed during Code phase* + +--- + +## Code +### Tasks +- [x] Add `$DONE_DEFAULT` to `ProjectDocsManager.getVariableSubstitutions()` +- [x] Update 14 final states in YAML workflows (13 with removed transitions + TDD with new `done` state) +- [x] Remove obsolete `state-machine.ts` and its re-export from `index.ts` +- [x] Update existing test for `$DONE_DEFAULT` substitution +- [x] Verify build and all 385 tests pass + +### Completed +*All Code phase tasks completed* + +## Commit +### Tasks +- [ ] *To be implemented during Commit phase* + +### Completed +*None yet* + + +--- +*This plan is maintained by the LLM. Tool responses provide guidance on which section to focus on and what tasks to work on.* diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index cfe56be6..1d149ac0 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -6,7 +6,6 @@ export * from './state-machine-types.js'; export * from './interfaces/index.js'; // State machine and workflow management -export * from './state-machine.js'; export * from './state-machine-loader.js'; export * from './workflow-manager.js'; export * from './transition-engine.js'; diff --git a/packages/core/src/project-docs-manager.ts b/packages/core/src/project-docs-manager.ts index b65a9be2..7d031597 100644 --- a/packages/core/src/project-docs-manager.ts +++ b/packages/core/src/project-docs-manager.ts @@ -462,6 +462,8 @@ export class ProjectDocsManager { $VIBE_DIR: vibeDir, $BRANCH_NAME: branchDirName, $VIBE_ROLE: agentRole, + $DONE_DEFAULT: + 'Feature work is complete. Do NOT transition to any other state — this is a terminal state. If this is a GitHub repository: create a PR. Always: present the final result to the user.', }; } diff --git a/packages/core/src/state-machine.ts b/packages/core/src/state-machine.ts deleted file mode 100644 index b160396e..00000000 --- a/packages/core/src/state-machine.ts +++ /dev/null @@ -1,370 +0,0 @@ -/** - * State Machine Definition for Vibe Feature MCP Server - * - * This module defines the development workflow state machine, including: - * - Development phases (states) - * - Transition triggers and conditions - * - Phase-specific instructions for LLM guidance - * - Transition-specific prompts for contextual guidance - */ - -export type DevelopmentPhase = - | 'idle' - | 'requirements' - | 'design' - | 'implementation' - | 'qa' - | 'testing' - | 'complete'; - -export type TransitionTrigger = - | 'new_feature_request' - | 'refine_requirements' - | 'requirements_complete' - | 'abandon_feature' - | 'refine_design' - | 'requirements_unclear' - | 'design_complete' - | 'refine_implementation' - | 'design_issues' - | 'implementation_complete' - | 'refine_qa' - | 'implementation_issues' - | 'qa_complete' - | 'refine_testing' - | 'qa_issues' - | 'testing_complete' - | 'feature_delivered' - | 'direct_transition'; // For user-initiated direct phase changes - -export interface StateTransition { - from: DevelopmentPhase; - to: DevelopmentPhase; - trigger: TransitionTrigger; - isModeled: boolean; // Whether this transition is shown in the state diagram - instructions: string; - transitionReason: string; -} - -/** - * Complete state transition table - * - * This table defines all possible transitions between development phases. - * - Modeled transitions: Shown in the state diagram, get contextual guidance - * - Direct transitions: Not shown in diagram, get general phase instructions - */ -export const STATE_TRANSITIONS: StateTransition[] = [ - // FROM IDLE - { - from: 'idle', - to: 'requirements', - trigger: 'new_feature_request', - isModeled: true, - instructions: - 'New feature request detected! Start requirements analysis by asking the user clarifying questions about WHAT they need. Focus on understanding their goals, scope, and constraints. Break down their needs into specific, actionable tasks and document them in the plan file. Mark completed requirements tasks as you progress.', - transitionReason: - 'New feature request detected, starting requirements analysis', - }, - - // FROM REQUIREMENTS - { - from: 'requirements', - to: 'requirements', - trigger: 'refine_requirements', - isModeled: true, - instructions: - 'Continue refining requirements. Ask more detailed questions to clarify scope, constraints, and user needs. Add any new requirements to the plan file and mark completed tasks. Ensure you have a complete understanding of WHAT needs to be built before moving to design.', - transitionReason: 'Requirements need further refinement and clarification', - }, - { - from: 'requirements', - to: 'design', - trigger: 'requirements_complete', - isModeled: true, - instructions: - 'Requirements are complete! ✅ Now transition to design phase. Help the user design the technical solution by asking about architecture, technologies, quality goals, and implementation approach. Focus on HOW to build what was defined in requirements. Document design decisions in the plan file and mark completed requirements tasks.', - transitionReason: - 'All requirements tasks completed, moving to technical design', - }, - { - from: 'requirements', - to: 'idle', - trigger: 'abandon_feature', - isModeled: true, - instructions: - 'Feature development abandoned. Clean up any temporary work and return to idle state. The plan file will remain for future reference if the user wants to resume this feature later.', - transitionReason: 'User decided to abandon this feature development', - }, - - // FROM DESIGN - { - from: 'design', - to: 'design', - trigger: 'refine_design', - isModeled: true, - instructions: - 'Continue refining the technical design. Ask about architecture details, technology choices, data models, API design, and quality considerations. Update the plan file with design decisions and mark completed design tasks. Ensure the design is solid before implementation.', - transitionReason: 'Design needs further refinement and detail', - }, - { - from: 'design', - to: 'requirements', - trigger: 'requirements_unclear', - isModeled: true, - instructions: - 'Design phase revealed unclear requirements. Return to requirements analysis to clarify the WHAT before continuing with HOW. Ask specific questions about the unclear aspects and update the plan file with refined requirements.', - transitionReason: - 'Design work revealed gaps or ambiguities in requirements', - }, - { - from: 'design', - to: 'implementation', - trigger: 'design_complete', - isModeled: true, - instructions: - 'Design is complete! ✅ Now transition to implementation. Guide the user through building the solution following the design. Focus on coding best practices, proper structure, error handling, and basic testing. Update the plan file with implementation progress and mark completed design tasks.', - transitionReason: 'Technical design is complete, ready to start building', - }, - { - from: 'design', - to: 'idle', - trigger: 'abandon_feature', - isModeled: true, - instructions: - 'Feature development abandoned during design phase. Clean up any design artifacts and return to idle state. The plan file will remain for future reference.', - transitionReason: 'User decided to abandon feature during design phase', - }, - - // FROM IMPLEMENTATION - { - from: 'implementation', - to: 'implementation', - trigger: 'refine_implementation', - isModeled: true, - instructions: - 'Continue implementation work. Help with coding, debugging, structure improvements, and adding functionality. Follow best practices and ensure code quality. Update the plan file with progress and mark completed implementation tasks.', - transitionReason: - 'Implementation work continues, adding features or improving code', - }, - { - from: 'implementation', - to: 'design', - trigger: 'design_issues', - isModeled: true, - instructions: - "Implementation revealed issues with the design. Return to design phase to address architectural problems or design gaps. Analyze what's not working and revise the technical approach. Update the plan file with design changes.", - transitionReason: - 'Implementation work revealed problems with the current design', - }, - { - from: 'implementation', - to: 'qa', - trigger: 'implementation_complete', - isModeled: true, - instructions: - "Implementation is complete! ✅ Now transition to quality assurance. Take these specific actions:\n\n1. **Syntax Check**: Run syntax checking tools or validate syntax manually\n2. **Build Project**: Build the project to verify it compiles without errors\n3. **Run Linter**: Execute linting tools to ensure code style consistency\n4. **Execute Tests**: Run existing tests to verify functionality\n\nThen conduct a multi-perspective code review:\n- **Security Perspective**: Check for vulnerabilities, input validation, authentication issues\n- **Performance Perspective**: Identify bottlenecks, inefficient algorithms, resource usage\n- **UX Perspective**: Evaluate from the end-user's viewpoint\n- **Maintainability Perspective**: Assess code readability, documentation, future maintenance\n- **Requirement Compliance**: Verify all requirements are properly implemented\n\nUpdate the plan file and mark completed implementation tasks.", - transitionReason: - 'Core implementation is complete, ready for quality review', - }, - { - from: 'implementation', - to: 'idle', - trigger: 'abandon_feature', - isModeled: true, - instructions: - 'Feature development abandoned during implementation. Clean up any incomplete code and return to idle state. The plan file and any completed work will remain for future reference.', - transitionReason: 'User decided to abandon feature during implementation', - }, - - // FROM QA (Quality Assurance) - { - from: 'qa', - to: 'qa', - trigger: 'refine_qa', - isModeled: true, - instructions: - "Continue quality assurance work. Take these specific actions if not already completed:\n\n1. **Syntax Check**: Run syntax checking tools or validate syntax manually\n2. **Build Project**: Build the project to verify it compiles without errors\n3. **Run Linter**: Execute linting tools to ensure code style consistency\n4. **Execute Tests**: Run existing tests to verify functionality\n\nContinue multi-perspective code review:\n- **Security Perspective**: Check for vulnerabilities, input validation, authentication issues\n- **Performance Perspective**: Identify bottlenecks, inefficient algorithms, resource usage\n- **UX Perspective**: Evaluate from the end-user's viewpoint\n- **Maintainability Perspective**: Assess code readability, documentation, future maintenance\n- **Requirement Compliance**: Verify all requirements are properly implemented\n\nUpdate the plan file with QA progress and mark completed tasks.", - transitionReason: - 'Quality assurance work continues, improving code quality', - }, - { - from: 'qa', - to: 'implementation', - trigger: 'implementation_issues', - isModeled: true, - instructions: - 'Quality assurance revealed implementation issues. Return to implementation phase to fix bugs, improve code quality, or add missing functionality. Focus on addressing the specific issues identified during QA review.', - transitionReason: - 'QA review found issues that require implementation changes', - }, - { - from: 'qa', - to: 'testing', - trigger: 'qa_complete', - isModeled: true, - instructions: - 'Quality assurance is complete! ✅ Now transition to testing phase. Create comprehensive test plans, write and execute tests, validate feature completeness, and ensure everything works as expected. Update the plan file and mark completed QA tasks.', - transitionReason: - 'Quality assurance is complete, ready for comprehensive testing', - }, - { - from: 'qa', - to: 'idle', - trigger: 'abandon_feature', - isModeled: true, - instructions: - 'Feature development abandoned during QA phase. Clean up any QA artifacts and return to idle state. The plan file and completed work will remain for future reference.', - transitionReason: - 'User decided to abandon feature during quality assurance', - }, - - // FROM TESTING - { - from: 'testing', - to: 'testing', - trigger: 'refine_testing', - isModeled: true, - instructions: - 'Continue testing work. Create more test cases, improve test coverage, run integration tests, and validate edge cases. Update the plan file with testing progress and mark completed testing tasks.', - transitionReason: - 'Testing work continues, improving coverage and validation', - }, - { - from: 'testing', - to: 'qa', - trigger: 'qa_issues', - isModeled: true, - instructions: - 'Testing revealed quality issues. Return to QA phase to address code quality problems, documentation gaps, or requirement compliance issues identified during testing. Focus on the specific QA issues found.', - transitionReason: - 'Testing found issues that require quality assurance attention', - }, - { - from: 'testing', - to: 'complete', - trigger: 'testing_complete', - isModeled: true, - instructions: - 'Testing is complete! ✅ The feature is fully implemented, tested, and ready for delivery. Transition to complete state. Summarize what was accomplished and prepare final documentation. Mark all testing tasks as complete.', - transitionReason: 'All testing is complete, feature is ready for delivery', - }, - { - from: 'testing', - to: 'idle', - trigger: 'abandon_feature', - isModeled: true, - instructions: - 'Feature development abandoned during testing phase. Clean up any testing artifacts and return to idle state. The plan file and completed work will remain for future reference.', - transitionReason: 'User decided to abandon feature during testing phase', - }, - - // FROM COMPLETE - { - from: 'complete', - to: 'idle', - trigger: 'feature_delivered', - isModeled: true, - instructions: - 'Feature has been delivered successfully! Return to idle state, ready for the next development task. The completed plan file serves as documentation of what was accomplished.', - transitionReason: 'Feature delivery complete, returning to idle state', - }, - { - from: 'complete', - to: 'requirements', - trigger: 'new_feature_request', - isModeled: true, - instructions: - 'New feature request while previous feature is complete. Start fresh requirements analysis for the new feature. Ask clarifying questions about what they need and create a new development plan.', - transitionReason: - 'New feature request received, starting new development cycle', - }, -]; - -/** - * Direct transition instructions for non-modeled transitions - * These are used when users jump directly to any phase using proceed_to_phase - */ -export const DIRECT_PHASE_INSTRUCTIONS: Record = { - idle: 'Returned to idle state. Ready to help with new feature development or other tasks.', - - requirements: - 'Starting requirements analysis. Ask the user clarifying questions about WHAT they need. Focus on understanding their goals, scope, constraints, and success criteria. Break down their needs into specific, actionable tasks and document them in the plan file. Mark completed requirements tasks as you progress.', - - design: - "Starting design phase. Help the user design the technical solution by asking about architecture, technologies, data models, API design, and quality goals. Focus on HOW to implement what's needed. Document design decisions in the plan file and ensure the approach is solid before implementation.", - - implementation: - 'Starting implementation phase. Guide the user through building the solution following best practices. Focus on code structure, error handling, security, and maintainability. Write clean, well-documented code and include basic testing. Update the plan file with implementation progress.', - - qa: "Starting quality assurance phase. Take the following specific actions:\n\n1. **Syntax Check**: Run syntax checking tools or validate syntax manually\n2. **Build Project**: Build the project to verify it compiles without errors\n3. **Run Linter**: Execute linting tools to ensure code style consistency\n4. **Execute Tests**: Run existing tests to verify functionality\n\nThen conduct a multi-perspective code review:\n- **Security Perspective**: Check for vulnerabilities, input validation, authentication issues\n- **Performance Perspective**: Identify bottlenecks, inefficient algorithms, resource usage\n- **UX Perspective**: Evaluate from the end-user's viewpoint\n- **Maintainability Perspective**: Assess code readability, documentation, future maintenance\n- **Requirement Compliance**: Verify all requirements are properly implemented\n\nUpdate the plan file with QA progress and mark completed tasks.", - - testing: - 'Starting testing phase. Create comprehensive test plans, write and execute tests, validate feature completeness, and ensure everything works as expected. Focus on test coverage, edge cases, integration testing, and user acceptance validation.', - - complete: - 'Feature development is complete! All phases have been finished successfully. The feature is implemented, tested, and ready for delivery. Summarize what was accomplished and ensure all documentation is finalized.', -}; - -/** - * Get transition instructions for a specific state change - */ -export function getTransitionInstructions( - fromState: DevelopmentPhase, - toState: DevelopmentPhase, - trigger?: TransitionTrigger -): { instructions: string; transitionReason: string; isModeled: boolean } { - // Look for a modeled transition first - const modeledTransition = STATE_TRANSITIONS.find( - t => - t.from === fromState && - t.to === toState && - (trigger ? t.trigger === trigger : true) - ); - - if (modeledTransition) { - return { - instructions: modeledTransition.instructions, - transitionReason: modeledTransition.transitionReason, - isModeled: true, - }; - } - - // Fall back to direct phase instructions - return { - instructions: DIRECT_PHASE_INSTRUCTIONS[toState], - transitionReason: `Direct transition to ${toState} phase`, - isModeled: false, - }; -} - -/** - * Get all possible transitions from a given state - */ -export function getPossibleTransitions( - fromState: DevelopmentPhase -): StateTransition[] { - return STATE_TRANSITIONS.filter(t => t.from === fromState); -} - -/** - * Check if a transition is modeled (shown in state diagram) - */ -export function isModeledTransition( - fromState: DevelopmentPhase, - toState: DevelopmentPhase -): boolean { - return STATE_TRANSITIONS.some( - t => t.from === fromState && t.to === toState && t.isModeled - ); -} - -/** - * Get phase-specific instructions for continuing work in current phase - */ -export function getContinuePhaseInstructions(phase: DevelopmentPhase): string { - const continueTransition = STATE_TRANSITIONS.find( - t => t.from === phase && t.to === phase - ); - - return continueTransition?.instructions || DIRECT_PHASE_INSTRUCTIONS[phase]; -} diff --git a/packages/core/test/unit/project-docs-manager.test.ts b/packages/core/test/unit/project-docs-manager.test.ts index 92451be5..44012ce8 100644 --- a/packages/core/test/unit/project-docs-manager.test.ts +++ b/packages/core/test/unit/project-docs-manager.test.ts @@ -334,6 +334,8 @@ describe('ProjectDocsManager', () => { $BRANCH_NAME: 'main', $VIBE_DIR: join(testProjectPath, '.vibe'), $VIBE_ROLE: '', // Added for collaborative workflow support + $DONE_DEFAULT: + 'Feature work is complete. Do NOT transition to any other state — this is a terminal state. If this is a GitHub repository: create a PR. Always: present the final result to the user.', }); }); }); diff --git a/resources/workflows/adr.yaml b/resources/workflows/adr.yaml index 9cdc5440..3918c80e 100644 --- a/resources/workflows/adr.yaml +++ b/resources/workflows/adr.yaml @@ -151,7 +151,5 @@ states: Complete final validation and cleanup before the ADR is finalized. - transitions: - - trigger: need_decision_changes - to: decide - transition_reason: 'Final review found problems with the decision documentation' + $DONE_DEFAULT + transitions: [] diff --git a/resources/workflows/boundary-testing.yaml b/resources/workflows/boundary-testing.yaml index a2122669..5dff4218 100644 --- a/resources/workflows/boundary-testing.yaml +++ b/resources/workflows/boundary-testing.yaml @@ -364,13 +364,6 @@ states: - Ensure test suite is ready for ongoing use and maintenance Update the plan file with finalization progress and mark completed tasks. - transitions: - - trigger: 'need_test_changes' - to: 'test_suite_implementation' - additional_instructions: 'Finalization revealed issues with the test suite. Focus on addressing the specific problems identified during final review.' - transition_reason: 'Finalization revealed issues requiring test implementation changes' - - trigger: 'finalization_complete' - to: 'architecture_analysis' - additional_instructions: 'Boundary testing workflow complete! Test suite is ready for ongoing use and maintenance. Prepare for next boundary testing project.' - transition_reason: 'Test suite finalization complete, ready for production use' + $DONE_DEFAULT + transitions: [] diff --git a/resources/workflows/bugfix.yaml b/resources/workflows/bugfix.yaml index 7ed84bcf..36800fc8 100644 --- a/resources/workflows/bugfix.yaml +++ b/resources/workflows/bugfix.yaml @@ -162,17 +162,6 @@ states: - Verify documentation accuracy with a final review - Ensure bug fix is ready for production - Update task progress and mark completed work as you finalize the bug fix - transitions: - - trigger: 'need_fix_changes' - to: 'fix' - additional_instructions: 'Finalization revealed issues with the bug fix. Focus on addressing the specific problems identified during final review.' - transition_reason: 'Finalization revealed issues requiring fix changes' - - - trigger: 'finalization_complete' - to: 'reproduce' - transition_reason: 'Bug fix complete and finalized, ready for next issue' - - trigger: 'abandon_bug' - to: 'reproduce' - additional_instructions: 'Bug finalization abandoned. Clean up any finalization work and prepare for new bug reports.' - transition_reason: 'Bug finalization abandoned' + $DONE_DEFAULT + transitions: [] diff --git a/resources/workflows/c4-analysis.yaml b/resources/workflows/c4-analysis.yaml index 7206815d..58a1c27c 100644 --- a/resources/workflows/c4-analysis.yaml +++ b/resources/workflows/c4-analysis.yaml @@ -464,8 +464,6 @@ states: - Modernization roadmap The analysis provides a foundation for future development. Consider using other workflows (waterfall, epcc, etc.) with the comprehensive understanding gained. - transitions: - - trigger: 'refine_analysis' - to: 'component_analysis' - additional_instructions: 'Refine specific aspects of analysis. Focus on areas that need additional investigation.' - transition_reason: 'Analysis review revealed need for additional component analysis' + + $DONE_DEFAULT + transitions: [] diff --git a/resources/workflows/epcc.yaml b/resources/workflows/epcc.yaml index a88272c1..98d0ae39 100644 --- a/resources/workflows/epcc.yaml +++ b/resources/workflows/epcc.yaml @@ -180,17 +180,6 @@ states: - Ensure code is ready for production/delivery Update task progress and mark completed work as you finalize the feature. - transitions: - - trigger: 'need_code_changes' - to: 'code' - additional_instructions: 'Focus on the problems identified during final review.' - transition_reason: 'Final review found issues requiring code changes' - - - trigger: 'commit_complete' - to: 'explore' - transition_reason: 'Feature delivery complete, ready for next task' - - trigger: 'abandon_feature' - to: 'explore' - additional_instructions: 'Clean up any finalization artifacts and prepare for new tasks.' - transition_reason: 'User decided to abandon feature during finalization' + $DONE_DEFAULT + transitions: [] diff --git a/resources/workflows/greenfield.yaml b/resources/workflows/greenfield.yaml index 2adc436e..5b381df1 100644 --- a/resources/workflows/greenfield.yaml +++ b/resources/workflows/greenfield.yaml @@ -201,17 +201,6 @@ states: - Verify documentation accuracy with a final review - Ensure project is ready for users and contributors - Update task progress and mark completed work as you finalize the project - transitions: - - trigger: 'need_code_changes' - to: 'code' - additional_instructions: 'Finalization revealed issues that require code changes. Focus on the problems identified during final review that affect usability or functionality.' - transition_reason: 'Finalization revealed issues requiring code changes' - - - trigger: 'finalization_complete' - to: 'ideation' - transition_reason: 'Project delivery complete with finalized code and documentation, ready for next greenfield project' - - trigger: 'abandon_project' - to: 'ideation' - additional_instructions: 'Project development abandoned during finalization. Clean up any finalization artifacts and prepare for new projects.' - transition_reason: 'User decided to abandon project during finalization phase' + $DONE_DEFAULT + transitions: [] diff --git a/resources/workflows/minor.yaml b/resources/workflows/minor.yaml index 2facfd64..eaa18aed 100644 --- a/resources/workflows/minor.yaml +++ b/resources/workflows/minor.yaml @@ -130,17 +130,6 @@ states: - Verify documentation accuracy with a final review - Ensure minor enhancement is ready for delivery - Update task progress and mark completed work as you finalize the minor enhancement - transitions: - - trigger: 'need_implementation_changes' - to: 'implement' - additional_instructions: 'Finalization revealed issues that require implementation changes. Focus on the specific problems identified during final review.' - transition_reason: 'Finalization revealed issues requiring implementation changes' - - - trigger: 'finalization_complete' - to: 'explore' - transition_reason: 'Minor enhancement delivery complete, ready for next task' - - trigger: 'abandon_feature' - to: 'explore' - additional_instructions: 'Clean up any finalization artifacts and prepare for new tasks.' - transition_reason: 'User decided to abandon minor enhancement during finalization' + $DONE_DEFAULT + transitions: [] diff --git a/resources/workflows/posts.yaml b/resources/workflows/posts.yaml index 15dceb59..bda371bb 100644 --- a/resources/workflows/posts.yaml +++ b/resources/workflows/posts.yaml @@ -178,20 +178,5 @@ states: Maximize reach while maintaining content quality and consistency. Update `$PLAN_FILE` with distribution progress and publishing decisions. - transitions: - - trigger: distribution_complete - to: discovery - transition_reason: 'Post publishing completed successfully, ready for new projects' - - - trigger: need_final_review - to: illustration - additional_instructions: 'Refine visuals or content presentation based on issues identified during publishing preparation.' - transition_reason: 'Publishing preparation identified issues requiring visual or content refinement' - - - trigger: abandon_post - to: discovery - instructions: | - Abandon post development before distribution. Clean up distribution preparation and return to discovery. - The `$PLAN_FILE` and completed work will remain for future reference. - additional_instructions: 'Clean up and prepare for new topics.' - transition_reason: 'User decided to abandon post before distribution' + $DONE_DEFAULT + transitions: [] diff --git a/resources/workflows/pr-review.yaml b/resources/workflows/pr-review.yaml index 9f0df9c1..3d7eb557 100644 --- a/resources/workflows/pr-review.yaml +++ b/resources/workflows/pr-review.yaml @@ -171,7 +171,5 @@ states: Once confirmed, deliver accordingly. For inline comments, attach each finding to the specific file and line it refers to. For cross-cutting findings, use a top-level comment. - transitions: - - trigger: 'review_published' - to: 'determine_intent' - transition_reason: 'Review delivered, ready for next PR' + $DONE_DEFAULT + transitions: [] diff --git a/resources/workflows/qrspi.yaml b/resources/workflows/qrspi.yaml index 785eac49..404dee3a 100644 --- a/resources/workflows/qrspi.yaml +++ b/resources/workflows/qrspi.yaml @@ -231,17 +231,6 @@ states: **Validation**: Run tests to ensure no regressions. Verify the development plan is accurate. Do not add new features. - transitions: - - trigger: 'commit_complete' - to: 'questions' - transition_reason: 'Feature delivered, ready for next task' - - - trigger: 'need_code_changes' - to: 'implement' - additional_instructions: 'Fix the problems identified during final review.' - transition_reason: 'Final review found issues requiring code changes' - - trigger: 'abandon_feature' - to: 'questions' - instructions: 'Feature abandoned. Clean up artifacts and reset for new tasks.' - transition_reason: 'User abandoned feature during finalization' + $DONE_DEFAULT + transitions: [] diff --git a/resources/workflows/skilled-bugfix.yaml b/resources/workflows/skilled-bugfix.yaml index 274ed638..512ae98a 100644 --- a/resources/workflows/skilled-bugfix.yaml +++ b/resources/workflows/skilled-bugfix.yaml @@ -158,17 +158,6 @@ states: - Verify documentation accuracy with a final review - Ensure bug fix is ready for production - Update task progress and mark completed work as you finalize the bug fix - transitions: - - trigger: 'need_fix_changes' - to: 'fix' - additional_instructions: 'Finalization revealed issues with the bug fix. Focus on addressing the specific problems identified during final review.' - transition_reason: 'Finalization revealed issues requiring fix changes' - - - trigger: 'finalization_complete' - to: 'reproduce' - transition_reason: 'Bug fix complete and finalized, ready for next issue' - - trigger: 'abandon_bug' - to: 'reproduce' - additional_instructions: 'Bug finalization abandoned. Clean up any finalization work and prepare for new bug reports.' - transition_reason: 'Bug finalization abandoned' + $DONE_DEFAULT + transitions: [] diff --git a/resources/workflows/skilled-epcc.yaml b/resources/workflows/skilled-epcc.yaml index dfaf1927..ba419ee7 100644 --- a/resources/workflows/skilled-epcc.yaml +++ b/resources/workflows/skilled-epcc.yaml @@ -155,17 +155,6 @@ states: - Ensure code is ready for production/delivery Update task progress and mark completed work as you finalize the feature. - transitions: - - trigger: 'need_code_changes' - to: 'code' - additional_instructions: 'Focus on the problems identified during final review.' - transition_reason: 'Final review found issues requiring code changes' - - - trigger: 'commit_complete' - to: 'explore' - transition_reason: 'Feature delivery complete, ready for next task' - - trigger: 'abandon_feature' - to: 'explore' - additional_instructions: 'Clean up any finalization artifacts and prepare for new tasks.' - transition_reason: 'User decided to abandon feature during finalization' + $DONE_DEFAULT + transitions: [] diff --git a/resources/workflows/skilled-greenfield.yaml b/resources/workflows/skilled-greenfield.yaml index 5687cd76..832f9c5e 100644 --- a/resources/workflows/skilled-greenfield.yaml +++ b/resources/workflows/skilled-greenfield.yaml @@ -191,17 +191,6 @@ states: - Verify documentation accuracy with a final review - Ensure project is ready for users and contributors - Update task progress and mark completed work as you finalize the project - transitions: - - trigger: 'need_code_changes' - to: 'code' - additional_instructions: 'Finalization revealed issues that require code changes. Focus on the problems identified during final review that affect usability or functionality.' - transition_reason: 'Finalization revealed issues requiring code changes' - - - trigger: 'finalization_complete' - to: 'ideation' - transition_reason: 'Project delivery complete with finalized code and documentation, ready for next greenfield project' - - trigger: 'abandon_project' - to: 'ideation' - additional_instructions: 'Project development abandoned during finalization. Clean up any finalization artifacts and prepare for new projects.' - transition_reason: 'User decided to abandon project during finalization phase' + $DONE_DEFAULT + transitions: [] diff --git a/resources/workflows/slides.yaml b/resources/workflows/slides.yaml index 91698564..f2cf520b 100644 --- a/resources/workflows/slides.yaml +++ b/resources/workflows/slides.yaml @@ -213,25 +213,5 @@ states: **Update** the plan file with delivery preparation progress to ensure successful delivery. - transitions: - - trigger: delivery_complete - to: ideate - additional_instructions: | - **Delivery phase complete!** Your presentation has been successfully delivered. - - Mark all delivery tasks as complete in the plan file and prepare for new work. - transition_reason: 'Presentation delivery completed successfully, ready for new projects' - - - trigger: need_final_review - to: review - additional_instructions: 'Final preparation revealed issues requiring additional review. Focus on addressing these concerns before delivery.' - transition_reason: 'Delivery preparation identified issues requiring additional review' - - - trigger: abandon_presentation - to: ideate - instructions: | - **Abandon delivery preparation** - Clean up delivery preparation and return to ideation. - - The plan file and completed work will remain for future reference. - additional_instructions: 'Presentation abandoned before delivery. Clean up and prepare for new topics.' - transition_reason: 'User decided to abandon presentation before delivery' + $DONE_DEFAULT + transitions: [] diff --git a/resources/workflows/tdd.yaml b/resources/workflows/tdd.yaml index 13be79bc..fa2b0f50 100644 --- a/resources/workflows/tdd.yaml +++ b/resources/workflows/tdd.yaml @@ -160,11 +160,21 @@ states: transition_reason: 'Refactoring revealed need to revise implementation' - trigger: 'feature_complete' - to: 'explore' + to: 'done' additional_instructions: 'Update task progress to reflect feature completion.' - transition_reason: 'Feature fully implemented and cleaned up, ready for new tasks' + transition_reason: 'Feature fully implemented and cleaned up, ready to exit TDD cycle' - trigger: 'abandon_feature' to: 'explore' additional_instructions: 'Clean up any refactoring work and prepare for new tasks.' transition_reason: 'User decided to abandon feature during refactoring' + + done: + description: 'TDD cycle complete - feature fully implemented and cleaned up' + allowed_file_patterns: + - '**/*' + default_instructions: | + The TDD cycle is complete. All aspects of the feature have been implemented and refactored. + + $DONE_DEFAULT + transitions: [] diff --git a/resources/workflows/waterfall.yaml b/resources/workflows/waterfall.yaml index bda16dca..17ca241f 100644 --- a/resources/workflows/waterfall.yaml +++ b/resources/workflows/waterfall.yaml @@ -214,12 +214,6 @@ states: - Ensure code is ready for production/delivery Update task progress and mark completed work as you finalize the feature. - transitions: - - trigger: 'need_final_changes' - to: 'implementation' - additional_instructions: 'Finalization revealed issues that require code changes. Focus on the specific problems identified during final review.' - transition_reason: 'Final review found issues requiring implementation changes' - - trigger: 'finalization_complete' - to: 'requirements' - transition_reason: 'Feature delivery complete, beginning new development cycle' + $DONE_DEFAULT + transitions: [] From 61dac6a24e760c07537c992dec4b31cf7bf7adf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20J=C3=A4gle?= Date: Tue, 2 Jun 2026 08:32:25 +0200 Subject: [PATCH 2/3] fix(qrspi): more engagement requested --- resources/workflows/qrspi.yaml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/resources/workflows/qrspi.yaml b/resources/workflows/qrspi.yaml index 404dee3a..0b83df09 100644 --- a/resources/workflows/qrspi.yaml +++ b/resources/workflows/qrspi.yaml @@ -8,7 +8,7 @@ metadata: domain: 'code' complexity: 'high' bestFor: - - 'Creative and complex challenges' + - 'Creative or complex challenges' - 'Deep alignment before execution' - 'Unconventional problems' - 'Architecture-heavy features' @@ -34,7 +34,11 @@ states: - '**/*.adoc' default_instructions: | **Principle**: Clarify intent before exploring solutions. - + This is the most important phase: You need to really deeply understand what makes the user want to introduce a change. + Ask questions about everything you can't determine straight from the existing codebase. + - Ask about the context + - follow up on explanations + - Ask about rejected alternatives or workarounds Document in the development plan: the problem being solved, success criteria, constraints, and any clarifying questions asked. Use `$REQUIREMENTS_DOC` as context only — do not modify it. Do not research, design, plan, or write code. @@ -83,8 +87,9 @@ states: - '**/*.adoc' default_instructions: | **Principle**: Align on WHAT and WHY before deciding detailed HOW. - + This is the phase when the we imagening a suitable solution given the boundary conditions. Propose 2-3 viable high-level approaches with trade-offs. Reference `$DESIGN_DOC` and `$ARCHITECTURE_DOC` if they exist. Reach consensus with the user on the direction. On loop-back from `need_design_changes`, update those docs if they exist. + It's crucial that the user gets actively involved to take an educated decision. Document the agreed direction in the development plan. From 777b69fe21a6607588319dd37c750801ff05be5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20J=C3=A4gle?= Date: Tue, 2 Jun 2026 08:49:08 +0200 Subject: [PATCH 3/3] chore(ux): reduce spacing in visualizer --- packages/visualizer/src/WorkflowVisualizer.vue | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/visualizer/src/WorkflowVisualizer.vue b/packages/visualizer/src/WorkflowVisualizer.vue index 8291156a..3e33ee45 100644 --- a/packages/visualizer/src/WorkflowVisualizer.vue +++ b/packages/visualizer/src/WorkflowVisualizer.vue @@ -1011,6 +1011,14 @@ onUnmounted(() => { margin: var(--spacing-sm) 0; } +#workflow-visualizer-app .code-block ul, +#workflow-visualizer-app .code-block ol, +#workflow-visualizer-app .code-block li { + line-height: 1.25rem; + padding: 0; + margin: 0; +} + /* Badges */ #workflow-visualizer-app .badge { display: inline-flex;