vibe-fabric 0.3.2 → 0.4.0

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 (77) hide show
  1. package/.claude/prompts/analyze/assess.md +208 -0
  2. package/.claude/prompts/analyze/synthesize.md +239 -0
  3. package/.claude/prompts/analyze/task-analyze-repo.md +260 -0
  4. package/.claude/prompts/gaps/assess.md +203 -0
  5. package/.claude/prompts/gaps/synthesize.md +180 -0
  6. package/.claude/prompts/gaps/task-analyze-module.md +198 -0
  7. package/.claude/prompts/prd/assess.md +156 -0
  8. package/.claude/prompts/prd/synthesize.md +191 -0
  9. package/.claude/prompts/prd/task-capture-feature.md +133 -0
  10. package/.claude/prompts/prd/task-deprecate.md +84 -0
  11. package/.claude/prompts/prd/task-document-code.md +110 -0
  12. package/.claude/prompts/prd/task-fix-format.md +102 -0
  13. package/.claude/prompts/prd/task-update-status.md +89 -0
  14. package/.claude/prompts/scope/assess.md +201 -0
  15. package/.claude/prompts/scope/synthesize.md +270 -0
  16. package/.claude/prompts/scope/task-analyze-prd.md +125 -0
  17. package/.claude/prompts/scope/task-check-deps.md +188 -0
  18. package/.claude/prompts/scope/task-create-scope.md +207 -0
  19. package/.claude/prompts/scope/task-recommend.md +146 -0
  20. package/.claude/prompts/scope/task-review-scope.md +191 -0
  21. package/.claude/prompts/scope/task-validate.md +203 -0
  22. package/dist/cli/commands/analyze.d.ts +33 -0
  23. package/dist/cli/commands/analyze.d.ts.map +1 -0
  24. package/dist/cli/commands/analyze.js +243 -0
  25. package/dist/cli/commands/analyze.js.map +1 -0
  26. package/dist/cli/commands/config/get.d.ts +9 -0
  27. package/dist/cli/commands/config/get.d.ts.map +1 -0
  28. package/dist/cli/commands/config/get.js +69 -0
  29. package/dist/cli/commands/config/get.js.map +1 -0
  30. package/dist/cli/commands/config/list.d.ts +24 -0
  31. package/dist/cli/commands/config/list.d.ts.map +1 -0
  32. package/dist/cli/commands/config/list.js +146 -0
  33. package/dist/cli/commands/config/list.js.map +1 -0
  34. package/dist/cli/commands/config/set.d.ts +14 -0
  35. package/dist/cli/commands/config/set.d.ts.map +1 -0
  36. package/dist/cli/commands/config/set.js +111 -0
  37. package/dist/cli/commands/config/set.js.map +1 -0
  38. package/dist/cli/commands/repo/list.d.ts +26 -0
  39. package/dist/cli/commands/repo/list.d.ts.map +1 -0
  40. package/dist/cli/commands/repo/list.js +197 -0
  41. package/dist/cli/commands/repo/list.js.map +1 -0
  42. package/dist/cli/commands/repo/remove.d.ts +29 -0
  43. package/dist/cli/commands/repo/remove.d.ts.map +1 -0
  44. package/dist/cli/commands/repo/remove.js +219 -0
  45. package/dist/cli/commands/repo/remove.js.map +1 -0
  46. package/dist/cli/commands/report.d.ts +16 -0
  47. package/dist/cli/commands/report.d.ts.map +1 -0
  48. package/dist/cli/commands/report.js +160 -0
  49. package/dist/cli/commands/report.js.map +1 -0
  50. package/dist/cli/index.js +14 -0
  51. package/dist/cli/index.js.map +1 -1
  52. package/dist/core/config.d.ts +25 -0
  53. package/dist/core/config.d.ts.map +1 -1
  54. package/dist/core/config.js +77 -0
  55. package/dist/core/config.js.map +1 -1
  56. package/dist/core/project.d.ts.map +1 -1
  57. package/dist/core/project.js +49 -1
  58. package/dist/core/project.js.map +1 -1
  59. package/dist/core/repo/templates/claude-agents.d.ts.map +1 -1
  60. package/dist/core/repo/templates/claude-agents.js +136 -28
  61. package/dist/core/repo/templates/claude-agents.js.map +1 -1
  62. package/dist/core/repo/templates/claude-prompts.d.ts +1 -1
  63. package/dist/core/repo/templates/claude-prompts.d.ts.map +1 -1
  64. package/dist/core/repo/templates/claude-prompts.js +412 -157
  65. package/dist/core/repo/templates/claude-prompts.js.map +1 -1
  66. package/dist/core/repo/templates/claude-scripts.d.ts.map +1 -1
  67. package/dist/core/repo/templates/claude-scripts.js +555 -94
  68. package/dist/core/repo/templates/claude-scripts.js.map +1 -1
  69. package/dist/core/report.d.ts +25 -0
  70. package/dist/core/report.d.ts.map +1 -0
  71. package/dist/core/report.js +702 -0
  72. package/dist/core/report.js.map +1 -0
  73. package/dist/types/report.d.ts +158 -0
  74. package/dist/types/report.d.ts.map +1 -0
  75. package/dist/types/report.js +7 -0
  76. package/dist/types/report.js.map +1 -0
  77. package/package.json +2 -1
@@ -0,0 +1,191 @@
1
+ # Task: Review Scope (Interactive)
2
+
3
+ ## Variables
4
+
5
+ | Variable | Description | Required |
6
+ |----------|-------------|----------|
7
+ | {PROJECT_PATH} | Path to the project directory | Yes |
8
+ | {OUTPUT_FILE} | Path to write the task output | Yes |
9
+ | {SCOPE_ID} | ID of scope to review (e.g., SCOPE-001) | Yes |
10
+
11
+ ---
12
+
13
+ ## Context
14
+
15
+ You are reviewing and refining an existing scope with the user.
16
+
17
+ Project: {PROJECT_PATH}
18
+ Scope to review: {SCOPE_ID}
19
+
20
+ ---
21
+
22
+ ## Your Task
23
+
24
+ Review an existing scope and help the user improve it. This is an INTERACTIVE task.
25
+
26
+ ### Step 1: Load the Scope
27
+
28
+ Find and read the scope file:
29
+ - Check `docs/scopes/drafts/{SCOPE_ID}*.md`
30
+ - Check `docs/scopes/ready/{SCOPE_ID}*.md`
31
+ - If not found, report error
32
+
33
+ ### Step 2: Analyze the Scope
34
+
35
+ Check for:
36
+ - **Completeness**: All required sections present
37
+ - **Format**: Proper Given/When/Then for ACs
38
+ - **Clarity**: Clear user story and summary
39
+ - **Coverage**: All mentioned requirements have ACs
40
+ - **Dependencies**: Blocking scopes identified
41
+ - **Out of scope**: Exclusions documented
42
+
43
+ ### Step 3: Present Analysis
44
+
45
+ Show the user the scope with feedback:
46
+
47
+ ```
48
+ Reviewing: SCOPE-001 - Dashboard Analytics
49
+ ==========================================
50
+
51
+ Current Status: draft
52
+ Location: docs/scopes/drafts/SCOPE-001-dashboard-analytics.md
53
+
54
+ Quality Check:
55
+ [x] Has summary
56
+ [x] Has user story
57
+ [x] Has requirements (4 functional, 2 non-functional)
58
+ [x] Has acceptance criteria (8 total)
59
+ [ ] AC-3 not in Given/When/Then format
60
+ [x] Dependencies identified
61
+ [x] Out of scope documented
62
+
63
+ Suggestions:
64
+ 1. AC-3 should use Given/When/Then format
65
+ Current: "Dashboard loads under 3 seconds"
66
+ Suggested: "Given the dashboard page, when it loads, then all data appears within 3 seconds"
67
+
68
+ 2. Consider adding error handling AC
69
+ What happens if data fetch fails?
70
+
71
+ 3. REQ-4 (CSV export) has no acceptance criteria
72
+
73
+ Would you like to address these issues?
74
+ ```
75
+
76
+ ### Step 4: Interactive Refinement
77
+
78
+ Guide the user through improvements:
79
+
80
+ 1. **Fix format issues** - Offer to rewrite problematic sections
81
+ 2. **Add missing ACs** - Help draft new acceptance criteria
82
+ 3. **Clarify requirements** - Ask questions to improve clarity
83
+ 4. **Update dependencies** - Check if any new dependencies emerged
84
+ 5. **Review out of scope** - Ensure exclusions are clear
85
+
86
+ ### Step 5: Capture Changes
87
+
88
+ For each change, track:
89
+ - What was changed
90
+ - Original value
91
+ - New value
92
+
93
+ ---
94
+
95
+ ## Output Format
96
+
97
+ Write to: {OUTPUT_FILE}
98
+
99
+ ```json
100
+ {
101
+ "action": "update",
102
+ "scope_id": "SCOPE-001",
103
+ "original_file": "docs/scopes/drafts/SCOPE-001-dashboard-analytics.md",
104
+ "changes": [
105
+ {
106
+ "field": "acceptance_criteria.AC-3",
107
+ "original": "Dashboard loads under 3 seconds",
108
+ "updated": {
109
+ "id": "AC-3",
110
+ "given": "the dashboard page",
111
+ "when": "it loads",
112
+ "then": "all data appears within 3 seconds"
113
+ }
114
+ },
115
+ {
116
+ "field": "acceptance_criteria.AC-9",
117
+ "original": null,
118
+ "updated": {
119
+ "id": "AC-9",
120
+ "given": "data fetch fails",
121
+ "when": "loading dashboard",
122
+ "then": "show error message with retry option"
123
+ }
124
+ }
125
+ ],
126
+ "updated_scope": {
127
+ "id": "SCOPE-001",
128
+ "title": "Dashboard Analytics",
129
+ "status": "draft",
130
+ // ... full updated scope content
131
+ },
132
+ "file_path": "docs/scopes/drafts/SCOPE-001-dashboard-analytics.md"
133
+ }
134
+ ```
135
+
136
+ ---
137
+
138
+ ## Rules
139
+
140
+ - This is INTERACTIVE - engage with the user
141
+ - Show what you found before suggesting changes
142
+ - Let user approve each significant change
143
+ - Track all changes made
144
+ - Don't change things the user doesn't approve
145
+ - If scope is in `ready/`, warn before making changes
146
+
147
+ ---
148
+
149
+ ## Conversation Style
150
+
151
+ Start with findings:
152
+
153
+ ```
154
+ > I found 3 issues with SCOPE-001:
155
+ >
156
+ > 1. AC-3 doesn't use Given/When/Then format
157
+ > 2. REQ-4 has no acceptance criteria
158
+ > 3. Missing error handling scenarios
159
+ >
160
+ > Let's go through these one by one. For AC-3, here's a
161
+ > suggested rewrite:
162
+ >
163
+ > Before: "Dashboard loads under 3 seconds"
164
+ > After: "Given the dashboard page, when it loads,
165
+ > then all data appears within 3 seconds"
166
+ >
167
+ > Does that look right?
168
+ ```
169
+
170
+ Handle pushback:
171
+
172
+ ```
173
+ > You're right, that requirement might be too specific. Let's
174
+ > adjust it to:
175
+ >
176
+ > "Given the dashboard page, when it loads, then all data
177
+ > appears within a reasonable time for the user's connection"
178
+ >
179
+ > Or would you prefer to remove this AC entirely?
180
+ ```
181
+
182
+ Confirm completion:
183
+
184
+ ```
185
+ > Great! I've updated:
186
+ > - AC-3: Reformatted to Given/When/Then
187
+ > - AC-9: Added error handling scenario
188
+ > - AC-10: Added for REQ-4 (CSV export)
189
+ >
190
+ > The scope now passes all quality checks. Ready to save?
191
+ ```
@@ -0,0 +1,203 @@
1
+ # Task: Validate Scope Format
2
+
3
+ ## Variables
4
+
5
+ | Variable | Description | Required |
6
+ |----------|-------------|----------|
7
+ | {PROJECT_PATH} | Path to the project directory | Yes |
8
+ | {OUTPUT_FILE} | Path to write the task output | Yes |
9
+ | {SCOPE_ID} | ID of scope to validate (e.g., SCOPE-003) | Yes |
10
+ | {PREVIOUS_OUTPUTS} | JSON array of previous task output paths | Yes |
11
+
12
+ ---
13
+
14
+ ## Context
15
+
16
+ You are validating a scope's format and completeness.
17
+
18
+ Project: {PROJECT_PATH}
19
+ Scope to validate: {SCOPE_ID}
20
+
21
+ ---
22
+
23
+ ## Your Task
24
+
25
+ Validate that a scope meets all requirements. This is NON-INTERACTIVE.
26
+
27
+ ### Step 1: Load the Scope
28
+
29
+ Find the scope in:
30
+ 1. Previous task outputs in {PREVIOUS_OUTPUTS} (newly created scope)
31
+ 2. `docs/scopes/drafts/{SCOPE_ID}*.md`
32
+ 3. `docs/scopes/ready/{SCOPE_ID}*.md`
33
+
34
+ ### Step 2: Validate Required Fields
35
+
36
+ Check that these fields exist and are valid:
37
+
38
+ **Metadata (Required):**
39
+ - [ ] ID: Matches `SCOPE-XXX` format
40
+ - [ ] Status: One of `draft`, `review`, `approved`, `sent`
41
+ - [ ] Target: One of `frontend`, `backend`, `both`
42
+ - [ ] Complexity: One of `S`, `M`, `L`, `XL`
43
+ - [ ] Priority: One of `P1`, `P2`, `P3`
44
+
45
+ **Content (Required):**
46
+ - [ ] Summary: 1-3 sentences present
47
+ - [ ] User Story: Has role, action, benefit
48
+ - [ ] Requirements: At least 1 requirement
49
+ - [ ] Acceptance Criteria: At least 1 AC
50
+
51
+ **Format (Required):**
52
+ - [ ] ACs use Given/When/Then format
53
+ - [ ] Requirements have IDs (REQ-X or NFR-X)
54
+ - [ ] Dependencies use SCOPE-XXX format
55
+
56
+ **Recommended:**
57
+ - [ ] Out of Scope section present
58
+ - [ ] Technical Constraints if any
59
+ - [ ] Implementation Notes for guidance
60
+
61
+ ### Step 3: Validate Content Quality
62
+
63
+ Check for:
64
+ - Summary is clear and explains value
65
+ - User story is specific, not generic
66
+ - ACs are testable (can verify pass/fail)
67
+ - Requirements link to PRD (if available)
68
+ - Dependencies are real scopes
69
+
70
+ ### Step 4: Check PRD Links
71
+
72
+ If PRD requirements are referenced:
73
+ - Verify they exist in `docs/prd/modules/`
74
+ - Check requirement IDs are valid
75
+
76
+ ---
77
+
78
+ ## Output Format
79
+
80
+ Write to: {OUTPUT_FILE}
81
+
82
+ ```json
83
+ {
84
+ "scope_id": "SCOPE-003",
85
+ "valid": true,
86
+ "score": 92,
87
+ "checks": {
88
+ "required": {
89
+ "passed": 12,
90
+ "failed": 0,
91
+ "details": [
92
+ {"name": "ID format", "passed": true},
93
+ {"name": "Status valid", "passed": true},
94
+ {"name": "Target valid", "passed": true},
95
+ {"name": "Complexity valid", "passed": true},
96
+ {"name": "Priority valid", "passed": true},
97
+ {"name": "Summary present", "passed": true},
98
+ {"name": "User story complete", "passed": true},
99
+ {"name": "Has requirements", "passed": true, "count": 4},
100
+ {"name": "Has acceptance criteria", "passed": true, "count": 8},
101
+ {"name": "AC format (Given/When/Then)", "passed": true},
102
+ {"name": "Requirement IDs valid", "passed": true},
103
+ {"name": "Dependency IDs valid", "passed": true}
104
+ ]
105
+ },
106
+ "recommended": {
107
+ "passed": 2,
108
+ "failed": 1,
109
+ "details": [
110
+ {"name": "Out of scope present", "passed": true},
111
+ {"name": "Technical constraints", "passed": true},
112
+ {"name": "Implementation notes", "passed": false, "suggestion": "Add implementation notes for developer guidance"}
113
+ ]
114
+ },
115
+ "quality": {
116
+ "passed": 4,
117
+ "warnings": 1,
118
+ "details": [
119
+ {"name": "Summary clarity", "passed": true},
120
+ {"name": "User story specificity", "passed": true},
121
+ {"name": "ACs are testable", "passed": true},
122
+ {"name": "PRD links valid", "passed": true},
123
+ {"name": "Dependencies exist", "passed": true, "warning": "SCOPE-001 is still in draft status"}
124
+ ]
125
+ }
126
+ },
127
+ "issues": [],
128
+ "warnings": [
129
+ "Dependency SCOPE-001 is still in draft status"
130
+ ],
131
+ "suggestions": [
132
+ "Add implementation notes for developer guidance"
133
+ ]
134
+ }
135
+ ```
136
+
137
+ For invalid scope:
138
+
139
+ ```json
140
+ {
141
+ "scope_id": "SCOPE-003",
142
+ "valid": false,
143
+ "score": 45,
144
+ "checks": {...},
145
+ "issues": [
146
+ {
147
+ "severity": "error",
148
+ "field": "acceptance_criteria.AC-3",
149
+ "message": "AC does not use Given/When/Then format",
150
+ "current": "Dashboard loads fast",
151
+ "suggestion": "Rewrite as: Given [context], when [action], then [result]"
152
+ },
153
+ {
154
+ "severity": "error",
155
+ "field": "target",
156
+ "message": "Invalid target value",
157
+ "current": "server",
158
+ "suggestion": "Use 'backend', 'frontend', or 'both'"
159
+ }
160
+ ],
161
+ "warnings": [...],
162
+ "suggestions": [...]
163
+ }
164
+ ```
165
+
166
+ ---
167
+
168
+ ## Rules
169
+
170
+ - Do NOT modify any files
171
+ - Do NOT interact with the user
172
+ - ONLY output to {OUTPUT_FILE}
173
+ - Mark as invalid (valid: false) if ANY required check fails
174
+ - Warnings don't make scope invalid
175
+ - Score is percentage of all checks passed (0-100)
176
+
177
+ ---
178
+
179
+ ## Validation Examples
180
+
181
+ **Valid ID:**
182
+ - `SCOPE-001` - Valid
183
+ - `SCOPE-123` - Valid
184
+ - `scope-001` - Invalid (lowercase)
185
+ - `SCOPE-1` - Invalid (needs 3 digits)
186
+
187
+ **Valid AC:**
188
+ - "Given valid credentials, when user logs in, then return JWT token" - Valid
189
+ - "User can log in" - Invalid (no Given/When/Then)
190
+
191
+ **Valid Target:**
192
+ - `backend` - Valid
193
+ - `frontend` - Valid
194
+ - `both` - Valid
195
+ - `server` - Invalid
196
+ - `Backend` - Invalid (case sensitive)
197
+
198
+ **Valid Priority:**
199
+ - `P1` - Valid
200
+ - `P2` - Valid
201
+ - `P3` - Valid
202
+ - `high` - Invalid
203
+ - `1` - Invalid
@@ -0,0 +1,33 @@
1
+ /**
2
+ * vibe analyze - Repository Analysis Command
3
+ *
4
+ * AI-powered repository analysis using Claude.
5
+ * Analyzes configured repositories to generate structural maps.
6
+ */
7
+ import { Command } from 'clipanion';
8
+ export declare class AnalyzeCommand extends Command {
9
+ static paths: string[][];
10
+ static usage: import("clipanion").Usage;
11
+ check: boolean;
12
+ resume: boolean;
13
+ repo: string | undefined;
14
+ cancel: boolean;
15
+ execute(): Promise<number>;
16
+ /**
17
+ * Handle --cancel flag
18
+ */
19
+ private handleCancel;
20
+ /**
21
+ * Run check mode (report-only)
22
+ */
23
+ private runCheck;
24
+ /**
25
+ * Run interactive analysis
26
+ */
27
+ private runInteractive;
28
+ /**
29
+ * Start the Python runner
30
+ */
31
+ private startRunner;
32
+ }
33
+ //# sourceMappingURL=analyze.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,243 @@
1
+ /**
2
+ * vibe analyze - Repository Analysis Command
3
+ *
4
+ * AI-powered repository analysis using Claude.
5
+ * Analyzes configured repositories to generate structural maps.
6
+ */
7
+ import { Command, Option } from 'clipanion';
8
+ import chalk from 'chalk';
9
+ import { confirm, select } from '@inquirer/prompts';
10
+ import { loadConfig } from '../../core/config.js';
11
+ import { findProjectRoot } from '../../core/project.js';
12
+ import { runVibeRunner, checkOperationInProgress, cancelOperation, RunnerError, } from '../../core/runner.js';
13
+ export class AnalyzeCommand extends Command {
14
+ static paths = [['analyze']];
15
+ static usage = Command.Usage({
16
+ description: 'Analyze repositories and generate maps',
17
+ details: `
18
+ AI-powered repository analysis using Claude.
19
+
20
+ Analyzes configured repositories to generate:
21
+ - Entity maps (from ORMs like Prisma, TypeORM)
22
+ - API maps (from routes, controllers)
23
+ - Module maps (from project structure)
24
+
25
+ Results are saved to docs/sync-cache/{repo}/maps/
26
+ `,
27
+ examples: [
28
+ ['Analyze all repos', 'vibe analyze'],
29
+ ['Analyze specific repo', 'vibe analyze --repo backend'],
30
+ ['Check what would be analyzed', 'vibe analyze --check'],
31
+ ['Resume interrupted analysis', 'vibe analyze --resume'],
32
+ ['Cancel current operation', 'vibe analyze --cancel'],
33
+ ],
34
+ });
35
+ check = Option.Boolean('--check,-c', false, {
36
+ description: 'Show what would be analyzed (no changes)',
37
+ });
38
+ resume = Option.Boolean('--resume,-r', false, {
39
+ description: 'Resume interrupted operation',
40
+ });
41
+ repo = Option.String('--repo', {
42
+ description: 'Analyze specific repo by alias',
43
+ });
44
+ cancel = Option.Boolean('--cancel', false, {
45
+ description: 'Cancel current operation',
46
+ });
47
+ async execute() {
48
+ // Find project root
49
+ const projectRoot = findProjectRoot(process.cwd());
50
+ if (!projectRoot) {
51
+ this.context.stderr.write(chalk.red('Error: Not inside a vibe-fabric project.\n'));
52
+ this.context.stderr.write(chalk.gray('Run ') + chalk.cyan('vibe init') + chalk.gray(' to create a project.\n'));
53
+ return 1;
54
+ }
55
+ // Handle cancel flag
56
+ if (this.cancel) {
57
+ return this.handleCancel(projectRoot);
58
+ }
59
+ // Load config to check repos
60
+ const config = await loadConfig(projectRoot);
61
+ if (!config) {
62
+ this.context.stderr.write(chalk.red('Error: Could not load project configuration.\n'));
63
+ return 1;
64
+ }
65
+ // Check if repos are configured
66
+ if (!config.repos || config.repos.length === 0) {
67
+ this.context.stderr.write(chalk.red('Error: No repositories configured.\n\n'));
68
+ this.context.stderr.write('Add repositories first with:\n');
69
+ this.context.stderr.write(chalk.cyan(' vibe repo add <github-url>\n\n'));
70
+ this.context.stderr.write(chalk.gray('Example:\n'));
71
+ this.context.stderr.write(chalk.gray(' vibe repo add https://github.com/org/backend\n'));
72
+ return 1;
73
+ }
74
+ // If --repo specified, verify it exists
75
+ if (this.repo) {
76
+ const repoExists = config.repos.some(r => r.alias === this.repo);
77
+ if (!repoExists) {
78
+ this.context.stderr.write(chalk.red(`Error: Repository '${this.repo}' not found.\n\n`));
79
+ this.context.stderr.write('Available repositories:\n');
80
+ for (const r of config.repos) {
81
+ this.context.stderr.write(` - ${r.alias}\n`);
82
+ }
83
+ return 1;
84
+ }
85
+ }
86
+ // Handle check mode
87
+ if (this.check) {
88
+ return this.runCheck(projectRoot, config);
89
+ }
90
+ // Interactive mode
91
+ return this.runInteractive(projectRoot);
92
+ }
93
+ /**
94
+ * Handle --cancel flag
95
+ */
96
+ async handleCancel(projectRoot) {
97
+ const existing = await checkOperationInProgress(projectRoot);
98
+ if (!existing) {
99
+ this.context.stdout.write(chalk.yellow('No operation in progress.\n'));
100
+ return 0;
101
+ }
102
+ if (existing.operation !== 'analyze') {
103
+ this.context.stdout.write(chalk.yellow(`Different operation in progress: ${existing.operation}\n`));
104
+ this.context.stdout.write(chalk.gray('Use the corresponding command to cancel it.\n'));
105
+ return 1;
106
+ }
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;
114
+ }
115
+ try {
116
+ await cancelOperation(projectRoot);
117
+ this.context.stdout.write(chalk.green('Operation cancelled.\n'));
118
+ return 0;
119
+ }
120
+ catch (error) {
121
+ this.context.stderr.write(chalk.red(`Failed to cancel: ${error instanceof Error ? error.message : error}\n`));
122
+ return 1;
123
+ }
124
+ }
125
+ /**
126
+ * Run check mode (report-only)
127
+ */
128
+ async runCheck(_projectRoot, config) {
129
+ this.context.stdout.write('\n');
130
+ this.context.stdout.write(chalk.bold.blue(' ANALYZE CHECK') + '\n');
131
+ this.context.stdout.write(chalk.gray(' ─'.repeat(25)) + '\n\n');
132
+ const repos = this.repo
133
+ ? config.repos.filter(r => r.alias === this.repo)
134
+ : config.repos;
135
+ this.context.stdout.write(chalk.bold('Repositories to analyze:\n\n'));
136
+ for (const repo of repos) {
137
+ this.context.stdout.write(` ${chalk.cyan(repo.alias)}\n`);
138
+ this.context.stdout.write(chalk.gray(` URL: ${repo.url}\n`));
139
+ this.context.stdout.write(chalk.gray(` Branch: ${repo.branch || 'main'}\n`));
140
+ this.context.stdout.write('\n');
141
+ }
142
+ this.context.stdout.write(chalk.gray('Run without --check to start analysis.\n'));
143
+ return 0;
144
+ }
145
+ /**
146
+ * Run interactive analysis
147
+ */
148
+ async runInteractive(projectRoot) {
149
+ // Check for existing operation
150
+ const existing = await checkOperationInProgress(projectRoot);
151
+ if (existing && !this.resume) {
152
+ // Check if it's an analyze operation
153
+ if (existing.operation !== 'analyze') {
154
+ this.context.stdout.write('\n');
155
+ this.context.stdout.write(chalk.yellow(`A different operation is in progress: ${existing.operation}\n`));
156
+ this.context.stdout.write(chalk.gray('Cancel it first or use the corresponding command.\n'));
157
+ return 1;
158
+ }
159
+ this.context.stdout.write('\n');
160
+ this.context.stdout.write(chalk.yellow('An analyze operation is already in progress.\n'));
161
+ this.context.stdout.write(chalk.gray(`Phase: ${existing.phase}, Task: ${existing.current_task}/${existing.total_tasks}\n`));
162
+ this.context.stdout.write('\n');
163
+ const action = await select({
164
+ message: 'What would you like to do?',
165
+ choices: [
166
+ { name: 'Resume the existing operation', value: 'resume' },
167
+ { name: 'Cancel and start fresh', value: 'cancel' },
168
+ { name: 'Exit', value: 'exit' },
169
+ ],
170
+ });
171
+ if (action === 'exit') {
172
+ return 0;
173
+ }
174
+ if (action === 'cancel') {
175
+ await cancelOperation(projectRoot);
176
+ this.context.stdout.write(chalk.green('Previous operation cancelled.\n\n'));
177
+ }
178
+ if (action === 'resume') {
179
+ return this.startRunner(projectRoot, true);
180
+ }
181
+ }
182
+ if (this.resume && !existing) {
183
+ this.context.stderr.write(chalk.red('No operation to resume.\n'));
184
+ this.context.stderr.write(chalk.gray('Start a new operation with: vibe analyze\n'));
185
+ return 1;
186
+ }
187
+ return this.startRunner(projectRoot, this.resume);
188
+ }
189
+ /**
190
+ * Start the Python runner
191
+ */
192
+ async startRunner(projectRoot, resume) {
193
+ this.context.stdout.write('\n');
194
+ this.context.stdout.write(chalk.bold.blue(' VIBE ANALYZE') + '\n');
195
+ this.context.stdout.write(chalk.gray(' ─'.repeat(25)) + '\n\n');
196
+ if (!resume) {
197
+ this.context.stdout.write(chalk.gray(' Starting repository analysis with Claude...\n\n'));
198
+ }
199
+ else {
200
+ this.context.stdout.write(chalk.gray(' Resuming analysis operation...\n\n'));
201
+ }
202
+ try {
203
+ await runVibeRunner('analyze', projectRoot, {
204
+ resume,
205
+ loop: true,
206
+ });
207
+ return 0;
208
+ }
209
+ catch (error) {
210
+ if (error instanceof RunnerError) {
211
+ this.context.stderr.write('\n');
212
+ switch (error.code) {
213
+ case 'UV_NOT_INSTALLED':
214
+ this.context.stderr.write(chalk.red('UV is not installed.\n\n'));
215
+ this.context.stderr.write('Install UV with:\n');
216
+ this.context.stderr.write(chalk.cyan(' curl -LsSf https://astral.sh/uv/install.sh | sh\n\n'));
217
+ this.context.stderr.write(chalk.gray('UV is required to run Python scripts for AI operations.\n'));
218
+ break;
219
+ case 'RUNNER_NOT_FOUND':
220
+ this.context.stderr.write(chalk.red('Runner script not found.\n\n'));
221
+ this.context.stderr.write('The runner script should be at:\n' +
222
+ chalk.cyan(' .claude/scripts/vibe-runner.py\n\n'));
223
+ this.context.stderr.write(chalk.gray('Run ') + chalk.cyan('vibe doctor') + chalk.gray(' to diagnose.\n'));
224
+ break;
225
+ case 'RUNNER_FAILED':
226
+ this.context.stderr.write(chalk.red('Runner failed.\n\n'));
227
+ this.context.stderr.write(chalk.gray(`${error.message}\n\n`));
228
+ this.context.stderr.write('Your progress has been saved. Run ' +
229
+ chalk.cyan('vibe analyze --resume') +
230
+ ' to continue.\n');
231
+ break;
232
+ default:
233
+ this.context.stderr.write(chalk.red(`Error: ${error.message}\n`));
234
+ }
235
+ return 1;
236
+ }
237
+ // Unexpected error
238
+ this.context.stderr.write(chalk.red(`Unexpected error: ${error instanceof Error ? error.message : error}\n`));
239
+ return 1;
240
+ }
241
+ }
242
+ }
243
+ //# sourceMappingURL=analyze.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyze.js","sourceRoot":"","sources":["../../../src/cli/commands/analyze.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EACL,aAAa,EACb,wBAAwB,EACxB,eAAe,EACf,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAE9B,MAAM,OAAO,cAAe,SAAQ,OAAO;IACzC,MAAM,CAAU,KAAK,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IAEtC,MAAM,CAAU,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QACpC,WAAW,EAAE,wCAAwC;QACrD,OAAO,EAAE;;;;;;;;;KASR;QACD,QAAQ,EAAE;YACR,CAAC,mBAAmB,EAAE,cAAc,CAAC;YACrC,CAAC,uBAAuB,EAAE,6BAA6B,CAAC;YACxD,CAAC,8BAA8B,EAAE,sBAAsB,CAAC;YACxD,CAAC,6BAA6B,EAAE,uBAAuB,CAAC;YACxD,CAAC,0BAA0B,EAAE,uBAAuB,CAAC;SACtD;KACF,CAAC,CAAC;IAEH,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,KAAK,EAAE;QAC1C,WAAW,EAAE,0CAA0C;KACxD,CAAC,CAAC;IAEH,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,aAAa,EAAE,KAAK,EAAE;QAC5C,WAAW,EAAE,8BAA8B;KAC5C,CAAC,CAAC;IAEH,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC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