Implement 'analyze' workflow step detection in state-detector
Resolved 💬 2 comments Opened Feb 2, 2026 by SameeranB Closed Mar 3, 2026
Problem
The WorkflowStepName type in src/main/lib/speckit/state-detector.ts includes an 'analyze' step, but the determineCurrentStep() function never returns it. This creates a type/runtime mismatch where:
- TypeScript thinks
'analyze'is a possible step - Runtime jumps directly from
'tasks'to'implement' - UI components checking for
currentStep === 'analyze'never execute
Current Code
export type WorkflowStepName =
| "no-feature"
| "constitution"
| "specify"
| "clarify"
| "plan"
| "tasks"
| "analyze" // ← Defined but unreachable
| "implement"
function determineCurrentStep(
artifacts: { spec: boolean; plan: boolean; research: boolean; tasks: boolean },
constitutionExists: boolean,
needsClarification: boolean
): WorkflowStepName {
if (\!constitutionExists) return "constitution"
if (\!artifacts.spec) return "specify"
if (needsClarification) return "clarify"
if (\!artifacts.plan) return "plan"
if (\!artifacts.tasks) return "tasks"
return "implement" // ← Never returns 'analyze'
}
Analysis
This appears to be either:
- A future feature that hasn't been implemented yet, OR
- Incomplete refactoring where the step was removed from logic but left in the type
Recommendation
Choose one of the following:
Option 1: Remove 'analyze' step (if not needed)
Remove from WorkflowStepName type and any UI components that reference it.
Option 2: Implement 'analyze' step detection (if needed)
Add logic to return 'analyze' when appropriate, for example:
- When
tasks.mdexists but analysis hasn't been run yet - When a
.specify/analysis/directory is missing - Based on some other criterion that indicates analysis is needed
Related Files
src/main/lib/speckit/state-detector.ts- Step detection logicspecs/001-speckit-ui-integration/data-model.md- Mentions analyze step but doesn't define criteria
Priority
Low - This is a minor type safety issue. The workflow functions correctly without the analyze step; it's just a documentation/type inconsistency.
---
Related PR: #9 - SpecKit UI Integration
Identified during: Post-merge code review (P2-6)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗