vibe-fabric 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/.claude/prompts/ralph-cleanup.md +86 -0
  2. package/.claude/prompts/ralph-execution.md +82 -0
  3. package/.claude/prompts/ralph-plan-extraction.md +101 -0
  4. package/.claude/prompts/ralph-plan-module.md +101 -0
  5. package/.claude/prompts/ralph-plan-validation.md +140 -0
  6. package/.claude/prompts/ralph-research.md +86 -0
  7. package/dist/cli/commands/analyze.d.ts +1 -0
  8. package/dist/cli/commands/analyze.d.ts.map +1 -1
  9. package/dist/cli/commands/analyze.js +20 -7
  10. package/dist/cli/commands/analyze.js.map +1 -1
  11. package/dist/cli/commands/init.d.ts +1 -0
  12. package/dist/cli/commands/init.d.ts.map +1 -1
  13. package/dist/cli/commands/init.js +115 -64
  14. package/dist/cli/commands/init.js.map +1 -1
  15. package/dist/cli/commands/prd.d.ts +1 -0
  16. package/dist/cli/commands/prd.d.ts.map +1 -1
  17. package/dist/cli/commands/prd.js +21 -7
  18. package/dist/cli/commands/prd.js.map +1 -1
  19. package/dist/cli/commands/repo/add.d.ts +1 -0
  20. package/dist/cli/commands/repo/add.d.ts.map +1 -1
  21. package/dist/cli/commands/repo/add.js +32 -7
  22. package/dist/cli/commands/repo/add.js.map +1 -1
  23. package/dist/cli/commands/repo/create.d.ts +1 -0
  24. package/dist/cli/commands/repo/create.d.ts.map +1 -1
  25. package/dist/cli/commands/repo/create.js +25 -12
  26. package/dist/cli/commands/repo/create.js.map +1 -1
  27. package/dist/cli/commands/scope.d.ts +1 -0
  28. package/dist/cli/commands/scope.d.ts.map +1 -1
  29. package/dist/cli/commands/scope.js +21 -7
  30. package/dist/cli/commands/scope.js.map +1 -1
  31. package/dist/cli/commands/send.d.ts +1 -0
  32. package/dist/cli/commands/send.d.ts.map +1 -1
  33. package/dist/cli/commands/send.js +59 -30
  34. package/dist/cli/commands/send.js.map +1 -1
  35. package/dist/core/commands.d.ts.map +1 -1
  36. package/dist/core/commands.js +32 -7
  37. package/dist/core/commands.js.map +1 -1
  38. package/dist/core/project.js +7 -13
  39. package/dist/core/project.js.map +1 -1
  40. package/dist/core/repo/templates/vibe-readme.d.ts.map +1 -1
  41. package/dist/core/repo/templates/vibe-readme.js +177 -10
  42. package/dist/core/repo/templates/vibe-readme.js.map +1 -1
  43. package/dist/core/send.d.ts +2 -0
  44. package/dist/core/send.d.ts.map +1 -1
  45. package/dist/core/send.js +81 -3
  46. package/dist/core/send.js.map +1 -1
  47. package/package.json +1 -1
@@ -0,0 +1,86 @@
1
+ # Ralph Cleanup Phase
2
+
3
+ You are in **Ralph Cleanup Phase** for plan: `{PLAN_PATH}`
4
+
5
+ All tasks have been executed. Your job is to verify and finalize.
6
+
7
+ ## CRITICAL RULES
8
+
9
+ 1. **DO NOT modify implementation** - Verification only
10
+ 2. **Run ALL quality checks**
11
+ 3. **Document final status**
12
+ 4. **EXIT when done**
13
+
14
+ ## Verification Steps
15
+
16
+ ### 1. Verify All Tasks Complete
17
+
18
+ Read `{PLAN_PATH}` and check:
19
+ - All tasks marked complete in Progress Log
20
+ - No PLAN_BLOCKED markers remain
21
+ - All acceptance criteria addressed
22
+
23
+ ### 2. Run Quality Checks
24
+
25
+ ```bash
26
+ # TypeScript compilation
27
+ npm run build
28
+
29
+ # Linting
30
+ npm run lint
31
+
32
+ # Tests
33
+ npm test
34
+ ```
35
+
36
+ All must pass. If any fail:
37
+ - Note the failures
38
+ - Do NOT attempt fixes (that's a new task)
39
+ - Mark in final status
40
+
41
+ ### 3. Verify File Changes
42
+
43
+ Check that expected files were created/modified:
44
+ - Compare against plan's "Key Files" section
45
+ - Verify no unexpected changes
46
+
47
+ ### 4. Update Plan Final Status
48
+
49
+ Add completion summary to plan:
50
+
51
+ ```markdown
52
+ ## Completion Summary
53
+
54
+ **Status:** Complete / Partial / Blocked
55
+ **Date:** [today]
56
+ **Sessions:** [total sessions used]
57
+
58
+ ### Quality Check Results
59
+ - Build: PASS / FAIL
60
+ - Lint: PASS / FAIL
61
+ - Tests: PASS / FAIL
62
+
63
+ ### Files Changed
64
+ - `src/file1.ts` - Created
65
+ - `src/file2.ts` - Modified
66
+
67
+ ### Notes
68
+ [Any observations or follow-up items]
69
+ ```
70
+
71
+ ### 5. Checklist
72
+
73
+ Mark in plan:
74
+ - [ ] All tasks executed
75
+ - [ ] Build passes
76
+ - [ ] Lint passes
77
+ - [ ] Tests pass
78
+ - [ ] Progress log complete
79
+ - [ ] Completion summary added
80
+
81
+ ## Exit Protocol
82
+
83
+ 1. Verify completion summary is in plan
84
+ 2. EXIT immediately
85
+
86
+ The runner will move the plan to `completed/` folder.
@@ -0,0 +1,82 @@
1
+ # Ralph Task Execution
2
+
3
+ You are executing **Task {CURRENT_TASK} of {TOTAL_TASKS}** from plan: `{PLAN_PATH}`
4
+
5
+ ## CRITICAL RULES
6
+
7
+ 1. **Complete ONLY Task {CURRENT_TASK}**
8
+ - Do NOT attempt other tasks
9
+ - Do NOT continue after this task
10
+
11
+ 2. **Fresh Context**
12
+ - You don't remember previous tasks
13
+ - Read the "Ralph Research Context" section for background
14
+ - Read the Progress Log for what's already done
15
+
16
+ 3. **Validation Required**
17
+ - Run `npm run build` after code changes
18
+ - Run `npm run lint` after code changes
19
+ - Fix issues before marking complete
20
+
21
+ 4. **Exit Protocol**
22
+ - Update Progress Log in plan
23
+ - Mark task complete
24
+ - EXIT immediately
25
+
26
+ ## Process
27
+
28
+ ### 1. Read Plan & Context
29
+
30
+ ```
31
+ 1. Read {PLAN_PATH}
32
+ 2. Find Task {CURRENT_TASK} specification
33
+ 3. Read "Ralph Research Context" section
34
+ 4. Read "Progress Log" for completed work
35
+ ```
36
+
37
+ ### 2. Execute Task
38
+
39
+ Follow the task specification exactly:
40
+ - Create/modify the specified files
41
+ - Follow the conventions noted in research context
42
+ - Use patterns from similar existing code
43
+
44
+ ### 3. Validate
45
+
46
+ ```bash
47
+ npm run build # Must pass
48
+ npm run lint # Must pass
49
+ ```
50
+
51
+ Fix any errors before proceeding.
52
+
53
+ ### 4. Update Progress Log
54
+
55
+ In the plan file, update the Progress Log table:
56
+
57
+ ```markdown
58
+ | Task | Status | Started | Completed | Notes |
59
+ |------|--------|---------|-----------|-------|
60
+ | {CURRENT_TASK} | complete | [time] | [now] | [brief note] |
61
+ ```
62
+
63
+ ### 5. EXIT
64
+
65
+ Do NOT continue to other tasks. Ralph runner handles session management.
66
+
67
+ ## Blocker Protocol
68
+
69
+ If you cannot complete this task after 3 attempts:
70
+
71
+ 1. Add to plan: `### PLAN_BLOCKED: {description of blocker}`
72
+ 2. Document what you tried
73
+ 3. EXIT immediately
74
+
75
+ The runner will detect the blocker and pause execution.
76
+
77
+ ## Remember
78
+
79
+ - ONE task only
80
+ - VALIDATE before marking complete
81
+ - UPDATE progress log
82
+ - EXIT when done
@@ -0,0 +1,101 @@
1
+ # Ralph Planning - Extraction Phase
2
+
3
+ You are extracting requirements from scope: `{SCOPE_PATH}`
4
+
5
+ ## Your Mission
6
+
7
+ Parse the scope into discrete modules/components that can each be planned in a separate session. This enables Ralph to create detailed plans without context exhaustion.
8
+
9
+ ## CRITICAL RULES
10
+
11
+ 1. **DO NOT create detailed plans yet** - Extraction only
12
+ 2. **Identify logical modules/components**
13
+ 3. **Save module list to state**
14
+ 4. **EXIT when done**
15
+
16
+ ## Process
17
+
18
+ ### 1. Read the Scope
19
+
20
+ Read `{SCOPE_PATH}` completely. Understand:
21
+ - All requirements (REQ-*)
22
+ - Acceptance criteria (AC-*)
23
+ - Technical constraints
24
+ - Dependencies
25
+
26
+ ### 2. Identify Modules
27
+
28
+ Break the scope into logical modules based on:
29
+ - Functional boundaries (auth, API, UI, etc.)
30
+ - File/directory structure
31
+ - Dependency order
32
+
33
+ Each module should be:
34
+ - Self-contained enough to plan independently
35
+ - Small enough for one planning session
36
+ - Clear in its boundaries
37
+
38
+ ### 3. Create Tracker File
39
+
40
+ Create `vibe/implementation-plans/active/{SCOPE_ID}-tracker.md`:
41
+
42
+ ```markdown
43
+ # Planning Tracker: {SCOPE_ID}
44
+
45
+ ## Scope
46
+ - Path: {SCOPE_PATH}
47
+ - Status: planning
48
+
49
+ ## Modules
50
+
51
+ | # | Module | Status | Plan File |
52
+ |---|--------|--------|-----------|
53
+ | 1 | {module-1} | pending | - |
54
+ | 2 | {module-2} | pending | - |
55
+ | 3 | {module-3} | pending | - |
56
+
57
+ ## Requirements Coverage
58
+
59
+ | Requirement | Module |
60
+ |-------------|--------|
61
+ | REQ-1 | Module 1 |
62
+ | REQ-2 | Module 2 |
63
+
64
+ ## Notes
65
+ [Any extraction observations]
66
+ ```
67
+
68
+ ### 4. Create Requirements JSON
69
+
70
+ Create `vibe/implementation-plans/active/{SCOPE_ID}-requirements.json`:
71
+
72
+ ```json
73
+ {
74
+ "scope_id": "{SCOPE_ID}",
75
+ "scope_path": "{SCOPE_PATH}",
76
+ "modules": [
77
+ {
78
+ "id": 1,
79
+ "name": "module-name",
80
+ "requirements": ["REQ-1", "REQ-2"],
81
+ "dependencies": []
82
+ }
83
+ ],
84
+ "requirements": [
85
+ {
86
+ "id": "REQ-1",
87
+ "description": "...",
88
+ "acceptance_criteria": ["AC-1", "AC-2"]
89
+ }
90
+ ]
91
+ }
92
+ ```
93
+
94
+ ## Exit Protocol
95
+
96
+ 1. Verify tracker file created
97
+ 2. Verify requirements JSON created
98
+ 3. Report module count
99
+ 4. EXIT immediately
100
+
101
+ Do NOT proceed to module planning. Ralph runner will start fresh sessions.
@@ -0,0 +1,101 @@
1
+ # Ralph Planning - Module {MODULE_INDEX}
2
+
3
+ You are planning **Module {MODULE_INDEX}: {MODULE_NAME}** for scope: `{SCOPE_PATH}`
4
+
5
+ ## CRITICAL RULES
6
+
7
+ 1. **Plan ONLY this module**
8
+ 2. **Fresh context** - Read tracker for what's planned
9
+ 3. **Create detailed implementation plan**
10
+ 4. **EXIT when done**
11
+
12
+ ## Process
13
+
14
+ ### 1. Read Context
15
+
16
+ ```
17
+ 1. Read {SCOPE_PATH} for full requirements
18
+ 2. Read tracker file for module list and status
19
+ 3. Read requirements JSON for module details
20
+ 4. Read any completed module plans for patterns
21
+ ```
22
+
23
+ ### 2. Analyze Module
24
+
25
+ For this module, understand:
26
+ - Which requirements it addresses
27
+ - Dependencies on other modules
28
+ - Files that will be created/modified
29
+ - Technical approach
30
+
31
+ ### 3. Create Module Plan
32
+
33
+ Create `vibe/implementation-plans/active/{SCOPE_ID}-{MODULE_NAME}.md`:
34
+
35
+ ```markdown
36
+ # Module Plan: {MODULE_NAME}
37
+
38
+ ## Metadata
39
+
40
+ | Field | Value |
41
+ |-------|-------|
42
+ | **Scope** | {SCOPE_ID} |
43
+ | **Module** | {MODULE_INDEX} of N |
44
+ | **Status** | planned |
45
+
46
+ ## Requirements Covered
47
+
48
+ - REQ-X: Description
49
+ - REQ-Y: Description
50
+
51
+ ## Implementation Phases
52
+
53
+ ### Phase 1: {Title}
54
+
55
+ **Goal:** What this phase accomplishes
56
+
57
+ **Tasks:**
58
+ 1. Task description
59
+ 2. Task description
60
+
61
+ **Files:**
62
+ - `src/path/file.ts` - What changes
63
+
64
+ **Validation:**
65
+ - How to verify this phase works
66
+
67
+ ### Phase 2: {Title}
68
+
69
+ ...
70
+
71
+ ## Dependencies
72
+
73
+ - Depends on: [other modules]
74
+ - Blocks: [modules waiting for this]
75
+
76
+ ## Risks
77
+
78
+ - [Potential issues]
79
+ - [Mitigation strategies]
80
+
81
+ ## Estimated Effort
82
+
83
+ - Phases: N
84
+ - Complexity: S/M/L
85
+ ```
86
+
87
+ ### 4. Update Tracker
88
+
89
+ In the tracker file, update this module's row:
90
+
91
+ ```markdown
92
+ | {MODULE_INDEX} | {MODULE_NAME} | planned | {plan-file-path} |
93
+ ```
94
+
95
+ ## Exit Protocol
96
+
97
+ 1. Verify module plan created
98
+ 2. Verify tracker updated
99
+ 3. EXIT immediately
100
+
101
+ Do NOT proceed to other modules. Ralph runner handles session management.
@@ -0,0 +1,140 @@
1
+ # Ralph Planning - Validation Phase
2
+
3
+ All modules have been planned. Your job is to validate coverage and create the final combined plan.
4
+
5
+ ## CRITICAL RULES
6
+
7
+ 1. **DO NOT add new modules**
8
+ 2. **Verify 100% requirement coverage**
9
+ 3. **Create combined plan**
10
+ 4. **EXIT when done**
11
+
12
+ ## Process
13
+
14
+ ### 1. Load All Plans
15
+
16
+ Read:
17
+ - Tracker file for module list
18
+ - Requirements JSON for all requirements
19
+ - Each module plan file
20
+
21
+ ### 2. Verify Coverage
22
+
23
+ Check that every requirement is covered:
24
+
25
+ ```
26
+ For each REQ-* in scope:
27
+ - Find which module(s) address it
28
+ - Verify phases exist for implementation
29
+ - Check acceptance criteria are testable
30
+ ```
31
+
32
+ Create coverage matrix:
33
+
34
+ ```markdown
35
+ ## Coverage Matrix
36
+
37
+ | Requirement | Module | Phases | Status |
38
+ |-------------|--------|--------|--------|
39
+ | REQ-1 | auth | 1, 2 | Covered |
40
+ | REQ-2 | api | 3 | Covered |
41
+ | REQ-3 | - | - | MISSING |
42
+ ```
43
+
44
+ ### 3. Check Dependencies
45
+
46
+ Verify module order is achievable:
47
+ - No circular dependencies
48
+ - Dependencies are planned before dependents
49
+ - Clear execution order
50
+
51
+ ### 4. Create Combined Plan
52
+
53
+ Create `vibe/implementation-plans/active/{PLAN_ID}.md`:
54
+
55
+ ```markdown
56
+ # Implementation Plan: {SCOPE_TITLE}
57
+
58
+ ## Metadata
59
+
60
+ | Field | Value |
61
+ |-------|-------|
62
+ | **Plan ID** | ILS-{YYYY}-{XXX} |
63
+ | **Scope** | {SCOPE_ID} |
64
+ | **Status** | active |
65
+ | **Created** | {date} |
66
+ | **Modules** | {count} |
67
+ | **Total Phases** | {count} |
68
+
69
+ ## Summary
70
+
71
+ {Description of what this plan implements}
72
+
73
+ ## Module Execution Order
74
+
75
+ 1. {module-1} - {brief description}
76
+ 2. {module-2} - {brief description}
77
+
78
+ ## Requirements Coverage
79
+
80
+ | Requirement | Module | Status |
81
+ |-------------|--------|--------|
82
+ | REQ-1 | Module 1 | Covered |
83
+
84
+ ## Combined Phases
85
+
86
+ ### Phase 1 (Module: {name})
87
+ {Include from module plan}
88
+
89
+ ### Phase 2 (Module: {name})
90
+ {Include from module plan}
91
+
92
+ ...
93
+
94
+ ## Progress Log
95
+
96
+ | Phase | Status | Started | Completed | Notes |
97
+ |-------|--------|---------|-----------|-------|
98
+ | 1 | pending | - | - | - |
99
+
100
+ ## Quality Checklist
101
+
102
+ - [ ] All phases complete
103
+ - [ ] Build passes
104
+ - [ ] Lint passes
105
+ - [ ] Tests pass
106
+ ```
107
+
108
+ ### 5. Update Tracker
109
+
110
+ Mark planning complete:
111
+
112
+ ```markdown
113
+ ## Status: complete
114
+ ## Combined Plan: {plan-path}
115
+ ```
116
+
117
+ ## Validation Report
118
+
119
+ If gaps found, report:
120
+
121
+ ```markdown
122
+ ## VALIDATION FAILED
123
+
124
+ ### Missing Coverage
125
+ - REQ-X: Not covered by any module
126
+
127
+ ### Circular Dependencies
128
+ - Module A depends on B depends on A
129
+
130
+ ### Recommendations
131
+ - Add module for REQ-X
132
+ - Reorder modules to break cycle
133
+ ```
134
+
135
+ ## Exit Protocol
136
+
137
+ 1. Verify coverage is 100% OR gaps documented
138
+ 2. Verify combined plan created
139
+ 3. Verify tracker updated
140
+ 4. EXIT immediately
@@ -0,0 +1,86 @@
1
+ # Ralph Research Phase
2
+
3
+ You are in **Ralph Research Phase** for plan: `{PLAN_PATH}`
4
+
5
+ ## Your Mission
6
+
7
+ Gather all context needed for subsequent task execution sessions. Each task session will start with FRESH context, so your research must be comprehensive and saved to the plan file.
8
+
9
+ ## CRITICAL RULES
10
+
11
+ 1. **DO NOT execute any tasks** - Research only
12
+ 2. **Save ALL findings to the plan file** - Future sessions depend on this
13
+ 3. **Be thorough** - This is the only research phase
14
+ 4. **EXIT when done** - Do not continue to task execution
15
+
16
+ ## Research Steps
17
+
18
+ ### 1. Read the Plan
19
+
20
+ Read `{PLAN_PATH}` completely. Understand:
21
+ - All phases/tasks
22
+ - Requirements being addressed
23
+ - Acceptance criteria
24
+
25
+ ### 2. Analyze Codebase
26
+
27
+ For each task, identify:
28
+ - Key files that will be modified
29
+ - Related files for context
30
+ - Existing patterns to follow
31
+ - Potential conflicts or dependencies
32
+
33
+ ### 3. Search Knowledge Base
34
+
35
+ Check `vibe/knowledge-base/` for relevant entries:
36
+ - Similar problems solved before
37
+ - Patterns and conventions
38
+ - Known gotchas
39
+
40
+ ### 4. Review Similar Work
41
+
42
+ Look at:
43
+ - `vibe/implementation-plans/completed/` for similar plans
44
+ - Recent git commits for patterns
45
+ - Existing code for conventions
46
+
47
+ ### 5. Document Findings
48
+
49
+ Add a "Ralph Research Context" section to the plan with:
50
+
51
+ ```markdown
52
+ ## Ralph Research Context
53
+
54
+ ### Codebase Summary
55
+ - Main patterns: [patterns found]
56
+ - Key abstractions: [relevant classes/functions]
57
+ - Test approach: [how tests are structured]
58
+
59
+ ### Key Files Per Task
60
+ **Task 1:**
61
+ - Primary: `src/path/file.ts`
62
+ - Related: `src/path/related.ts`
63
+
64
+ **Task 2:**
65
+ - Primary: `src/path/other.ts`
66
+ - Related: `tests/other.test.ts`
67
+
68
+ ### Knowledge Base Findings
69
+ - [Entry title] - [relevance]
70
+
71
+ ### Potential Blockers
72
+ - [Any issues discovered]
73
+
74
+ ### Conventions to Follow
75
+ - [Naming conventions]
76
+ - [Code style patterns]
77
+ - [Import patterns]
78
+ ```
79
+
80
+ ## Exit Protocol
81
+
82
+ 1. Verify research context is saved to plan
83
+ 2. Verify all tasks have key files identified
84
+ 3. EXIT immediately
85
+
86
+ Do NOT proceed to task execution. Ralph runner will start fresh sessions for tasks.
@@ -12,6 +12,7 @@ export declare class AnalyzeCommand extends Command {
12
12
  resume: boolean;
13
13
  repo: string | undefined;
14
14
  cancel: boolean;
15
+ force: boolean;
15
16
  execute(): Promise<number>;
16
17
  /**
17
18
  * Handle --cancel flag
@@ -1 +1 @@
1
- {"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/analyze.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAY5C,qBAAa,cAAe,SAAQ,OAAO;IACzC,OAAgB,KAAK,aAAiB;IAEtC,OAAgB,KAAK,4BAmBlB;IAEH,KAAK,UAEF;IAEH,MAAM,UAEH;IAEH,IAAI,qBAED;IAEH,MAAM,UAEH;IAEG,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;IAuEhC;;OAEG;YACW,YAAY;IAwC1B;;OAEG;YACW,QAAQ;IAsBtB;;OAEG;YACW,cAAc;IA0D5B;;OAEG;YACW,WAAW;CAwE1B"}
1
+ {"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/analyze.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAY5C,qBAAa,cAAe,SAAQ,OAAO;IACzC,OAAgB,KAAK,aAAiB;IAEtC,OAAgB,KAAK,4BAoBlB;IAEH,KAAK,UAEF;IAEH,MAAM,UAEH;IAEH,IAAI,qBAED;IAEH,MAAM,UAEH;IAEH,KAAK,UAEF;IAEG,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;IAuEhC;;OAEG;YACW,YAAY;IA2C1B;;OAEG;YACW,QAAQ;IAsBtB;;OAEG;YACW,cAAc;IAiE5B;;OAEG;YACW,WAAW;CAwE1B"}
@@ -30,6 +30,7 @@ export class AnalyzeCommand extends Command {
30
30
  ['Check what would be analyzed', 'vibe analyze --check'],
31
31
  ['Resume interrupted analysis', 'vibe analyze --resume'],
32
32
  ['Cancel current operation', 'vibe analyze --cancel'],
33
+ ['Cancel and start fresh', 'vibe analyze --force'],
33
34
  ],
34
35
  });
35
36
  check = Option.Boolean('--check,-c', false, {
@@ -44,6 +45,9 @@ export class AnalyzeCommand extends Command {
44
45
  cancel = Option.Boolean('--cancel', false, {
45
46
  description: 'Cancel current operation',
46
47
  });
48
+ force = Option.Boolean('--force,-f', false, {
49
+ description: 'Cancel existing operation and start fresh without prompting',
50
+ });
47
51
  async execute() {
48
52
  // Find project root
49
53
  const projectRoot = findProjectRoot(process.cwd());
@@ -104,13 +108,16 @@ export class AnalyzeCommand extends Command {
104
108
  this.context.stdout.write(chalk.gray('Use the corresponding command to cancel it.\n'));
105
109
  return 1;
106
110
  }
107
- const confirmed = await confirm({
108
- message: 'Cancel analyze operation?',
109
- default: false,
110
- });
111
- if (!confirmed) {
112
- this.context.stdout.write(chalk.gray('Cancelled.\n'));
113
- return 0;
111
+ // If --force is set, cancel without confirmation
112
+ if (!this.force) {
113
+ const confirmed = await confirm({
114
+ message: 'Cancel analyze operation?',
115
+ default: false,
116
+ });
117
+ if (!confirmed) {
118
+ this.context.stdout.write(chalk.gray('Cancelled.\n'));
119
+ return 0;
120
+ }
114
121
  }
115
122
  try {
116
123
  await cancelOperation(projectRoot);
@@ -149,6 +156,12 @@ export class AnalyzeCommand extends Command {
149
156
  // Check for existing operation
150
157
  const existing = await checkOperationInProgress(projectRoot);
151
158
  if (existing && !this.resume) {
159
+ // If --force is set, automatically cancel and start fresh
160
+ if (this.force) {
161
+ await cancelOperation(projectRoot);
162
+ this.context.stdout.write(chalk.green('Previous operation cancelled.\n\n'));
163
+ return this.startRunner(projectRoot, false);
164
+ }
152
165
  // Check if it's an analyze operation
153
166
  if (existing.operation !== 'analyze') {
154
167
  this.context.stdout.write('\n');