vibe-fabric 0.1.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.
- package/LICENSE +21 -0
- package/README.md +171 -0
- package/dist/cli/commands/claude.d.ts +19 -0
- package/dist/cli/commands/claude.d.ts.map +1 -0
- package/dist/cli/commands/claude.js +107 -0
- package/dist/cli/commands/claude.js.map +1 -0
- package/dist/cli/commands/coverage.d.ts +37 -0
- package/dist/cli/commands/coverage.d.ts.map +1 -0
- package/dist/cli/commands/coverage.js +374 -0
- package/dist/cli/commands/coverage.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +30 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +187 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/gaps.d.ts +52 -0
- package/dist/cli/commands/gaps.d.ts.map +1 -0
- package/dist/cli/commands/gaps.js +487 -0
- package/dist/cli/commands/gaps.js.map +1 -0
- package/dist/cli/commands/help.d.ts +7 -0
- package/dist/cli/commands/help.d.ts.map +1 -0
- package/dist/cli/commands/help.js +51 -0
- package/dist/cli/commands/help.js.map +1 -0
- package/dist/cli/commands/init.d.ts +39 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +246 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/prd.d.ts +30 -0
- package/dist/cli/commands/prd.d.ts.map +1 -0
- package/dist/cli/commands/prd.js +179 -0
- package/dist/cli/commands/prd.js.map +1 -0
- package/dist/cli/commands/repo/add.d.ts +36 -0
- package/dist/cli/commands/repo/add.d.ts.map +1 -0
- package/dist/cli/commands/repo/add.js +303 -0
- package/dist/cli/commands/repo/add.js.map +1 -0
- package/dist/cli/commands/scope.d.ts +36 -0
- package/dist/cli/commands/scope.d.ts.map +1 -0
- package/dist/cli/commands/scope.js +312 -0
- package/dist/cli/commands/scope.js.map +1 -0
- package/dist/cli/commands/send.d.ts +43 -0
- package/dist/cli/commands/send.d.ts.map +1 -0
- package/dist/cli/commands/send.js +469 -0
- package/dist/cli/commands/send.js.map +1 -0
- package/dist/cli/commands/status.d.ts +32 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +422 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/sync.d.ts +37 -0
- package/dist/cli/commands/sync.d.ts.map +1 -0
- package/dist/cli/commands/sync.js +299 -0
- package/dist/cli/commands/sync.js.map +1 -0
- package/dist/cli/commands/version.d.ts +7 -0
- package/dist/cli/commands/version.d.ts.map +1 -0
- package/dist/cli/commands/version.js +45 -0
- package/dist/cli/commands/version.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +65 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/ui/components/ActiveScopes.d.ts +13 -0
- package/dist/cli/ui/components/ActiveScopes.d.ts.map +1 -0
- package/dist/cli/ui/components/ActiveScopes.js +25 -0
- package/dist/cli/ui/components/ActiveScopes.js.map +1 -0
- package/dist/cli/ui/components/EmptyState.d.ts +24 -0
- package/dist/cli/ui/components/EmptyState.d.ts.map +1 -0
- package/dist/cli/ui/components/EmptyState.js +13 -0
- package/dist/cli/ui/components/EmptyState.js.map +1 -0
- package/dist/cli/ui/components/Header.d.ts +11 -0
- package/dist/cli/ui/components/Header.d.ts.map +1 -0
- package/dist/cli/ui/components/Header.js +32 -0
- package/dist/cli/ui/components/Header.js.map +1 -0
- package/dist/cli/ui/components/PrdCoverage.d.ts +12 -0
- package/dist/cli/ui/components/PrdCoverage.d.ts.map +1 -0
- package/dist/cli/ui/components/PrdCoverage.js +15 -0
- package/dist/cli/ui/components/PrdCoverage.js.map +1 -0
- package/dist/cli/ui/components/RecentActivity.d.ts +12 -0
- package/dist/cli/ui/components/RecentActivity.d.ts.map +1 -0
- package/dist/cli/ui/components/RecentActivity.js +40 -0
- package/dist/cli/ui/components/RecentActivity.js.map +1 -0
- package/dist/cli/ui/components/RepoList.d.ts +12 -0
- package/dist/cli/ui/components/RepoList.d.ts.map +1 -0
- package/dist/cli/ui/components/RepoList.js +24 -0
- package/dist/cli/ui/components/RepoList.js.map +1 -0
- package/dist/cli/ui/components/Shortcuts.d.ts +7 -0
- package/dist/cli/ui/components/Shortcuts.d.ts.map +1 -0
- package/dist/cli/ui/components/Shortcuts.js +7 -0
- package/dist/cli/ui/components/Shortcuts.js.map +1 -0
- package/dist/cli/ui/components/index.d.ts +12 -0
- package/dist/cli/ui/components/index.d.ts.map +1 -0
- package/dist/cli/ui/components/index.js +12 -0
- package/dist/cli/ui/components/index.js.map +1 -0
- package/dist/cli/ui/dashboard.d.ts +9 -0
- package/dist/cli/ui/dashboard.d.ts.map +1 -0
- package/dist/cli/ui/dashboard.js +102 -0
- package/dist/cli/ui/dashboard.js.map +1 -0
- package/dist/core/commands.d.ts +32 -0
- package/dist/core/commands.d.ts.map +1 -0
- package/dist/core/commands.js +361 -0
- package/dist/core/commands.js.map +1 -0
- package/dist/core/config.d.ts +18 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +78 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/coverage.d.ts +32 -0
- package/dist/core/coverage.d.ts.map +1 -0
- package/dist/core/coverage.js +286 -0
- package/dist/core/coverage.js.map +1 -0
- package/dist/core/dashboard/data.d.ts +73 -0
- package/dist/core/dashboard/data.d.ts.map +1 -0
- package/dist/core/dashboard/data.js +250 -0
- package/dist/core/dashboard/data.js.map +1 -0
- package/dist/core/dependencies.d.ts +39 -0
- package/dist/core/dependencies.d.ts.map +1 -0
- package/dist/core/dependencies.js +160 -0
- package/dist/core/dependencies.js.map +1 -0
- package/dist/core/doctor/auth.d.ts +22 -0
- package/dist/core/doctor/auth.d.ts.map +1 -0
- package/dist/core/doctor/auth.js +147 -0
- package/dist/core/doctor/auth.js.map +1 -0
- package/dist/core/doctor/config.d.ts +26 -0
- package/dist/core/doctor/config.d.ts.map +1 -0
- package/dist/core/doctor/config.js +172 -0
- package/dist/core/doctor/config.js.map +1 -0
- package/dist/core/doctor/environment.d.ts +26 -0
- package/dist/core/doctor/environment.d.ts.map +1 -0
- package/dist/core/doctor/environment.js +145 -0
- package/dist/core/doctor/environment.js.map +1 -0
- package/dist/core/doctor/index.d.ts +44 -0
- package/dist/core/doctor/index.d.ts.map +1 -0
- package/dist/core/doctor/index.js +134 -0
- package/dist/core/doctor/index.js.map +1 -0
- package/dist/core/doctor/repos.d.ts +22 -0
- package/dist/core/doctor/repos.d.ts.map +1 -0
- package/dist/core/doctor/repos.js +262 -0
- package/dist/core/doctor/repos.js.map +1 -0
- package/dist/core/doctor/sync.d.ts +18 -0
- package/dist/core/doctor/sync.d.ts.map +1 -0
- package/dist/core/doctor/sync.js +146 -0
- package/dist/core/doctor/sync.js.map +1 -0
- package/dist/core/gaps.d.ts +70 -0
- package/dist/core/gaps.d.ts.map +1 -0
- package/dist/core/gaps.js +448 -0
- package/dist/core/gaps.js.map +1 -0
- package/dist/core/github.d.ts +38 -0
- package/dist/core/github.d.ts.map +1 -0
- package/dist/core/github.js +102 -0
- package/dist/core/github.js.map +1 -0
- package/dist/core/prd/analyzer.d.ts +44 -0
- package/dist/core/prd/analyzer.d.ts.map +1 -0
- package/dist/core/prd/analyzer.js +259 -0
- package/dist/core/prd/analyzer.js.map +1 -0
- package/dist/core/prd/check.d.ts +17 -0
- package/dist/core/prd/check.d.ts.map +1 -0
- package/dist/core/prd/check.js +154 -0
- package/dist/core/prd/check.js.map +1 -0
- package/dist/core/prd/index.d.ts +6 -0
- package/dist/core/prd/index.d.ts.map +1 -0
- package/dist/core/prd/index.js +6 -0
- package/dist/core/prd/index.js.map +1 -0
- package/dist/core/project.d.ts +13 -0
- package/dist/core/project.d.ts.map +1 -0
- package/dist/core/project.js +810 -0
- package/dist/core/project.js.map +1 -0
- package/dist/core/prompts.d.ts +52 -0
- package/dist/core/prompts.d.ts.map +1 -0
- package/dist/core/prompts.js +266 -0
- package/dist/core/prompts.js.map +1 -0
- package/dist/core/repo/framework.d.ts +38 -0
- package/dist/core/repo/framework.d.ts.map +1 -0
- package/dist/core/repo/framework.js +142 -0
- package/dist/core/repo/framework.js.map +1 -0
- package/dist/core/repo/index.d.ts +6 -0
- package/dist/core/repo/index.d.ts.map +1 -0
- package/dist/core/repo/index.js +6 -0
- package/dist/core/repo/index.js.map +1 -0
- package/dist/core/repo/templates/claude-agents.d.ts +6 -0
- package/dist/core/repo/templates/claude-agents.d.ts.map +1 -0
- package/dist/core/repo/templates/claude-agents.js +173 -0
- package/dist/core/repo/templates/claude-agents.js.map +1 -0
- package/dist/core/repo/templates/claude-commands.d.ts +6 -0
- package/dist/core/repo/templates/claude-commands.d.ts.map +1 -0
- package/dist/core/repo/templates/claude-commands.js +278 -0
- package/dist/core/repo/templates/claude-commands.js.map +1 -0
- package/dist/core/repo/templates/claude-prompts.d.ts +6 -0
- package/dist/core/repo/templates/claude-prompts.d.ts.map +1 -0
- package/dist/core/repo/templates/claude-prompts.js +258 -0
- package/dist/core/repo/templates/claude-prompts.js.map +1 -0
- package/dist/core/repo/templates/claude-scripts.d.ts +6 -0
- package/dist/core/repo/templates/claude-scripts.d.ts.map +1 -0
- package/dist/core/repo/templates/claude-scripts.js +212 -0
- package/dist/core/repo/templates/claude-scripts.js.map +1 -0
- package/dist/core/repo/templates/index.d.ts +22 -0
- package/dist/core/repo/templates/index.d.ts.map +1 -0
- package/dist/core/repo/templates/index.js +121 -0
- package/dist/core/repo/templates/index.js.map +1 -0
- package/dist/core/repo/templates/vibe-readme.d.ts +6 -0
- package/dist/core/repo/templates/vibe-readme.d.ts.map +1 -0
- package/dist/core/repo/templates/vibe-readme.js +204 -0
- package/dist/core/repo/templates/vibe-readme.js.map +1 -0
- package/dist/core/repo/templates/vibe-scripts.d.ts +6 -0
- package/dist/core/repo/templates/vibe-scripts.d.ts.map +1 -0
- package/dist/core/repo/templates/vibe-scripts.js +308 -0
- package/dist/core/repo/templates/vibe-scripts.js.map +1 -0
- package/dist/core/repo/validation.d.ts +46 -0
- package/dist/core/repo/validation.d.ts.map +1 -0
- package/dist/core/repo/validation.js +154 -0
- package/dist/core/repo/validation.js.map +1 -0
- package/dist/core/runner.d.ts +38 -0
- package/dist/core/runner.d.ts.map +1 -0
- package/dist/core/runner.js +124 -0
- package/dist/core/runner.js.map +1 -0
- package/dist/core/send.d.ts +83 -0
- package/dist/core/send.d.ts.map +1 -0
- package/dist/core/send.js +565 -0
- package/dist/core/send.js.map +1 -0
- package/dist/core/status.d.ts +76 -0
- package/dist/core/status.d.ts.map +1 -0
- package/dist/core/status.js +430 -0
- package/dist/core/status.js.map +1 -0
- package/dist/core/sync/aggregator.d.ts +22 -0
- package/dist/core/sync/aggregator.d.ts.map +1 -0
- package/dist/core/sync/aggregator.js +278 -0
- package/dist/core/sync/aggregator.js.map +1 -0
- package/dist/core/sync/completion.d.ts +37 -0
- package/dist/core/sync/completion.d.ts.map +1 -0
- package/dist/core/sync/completion.js +264 -0
- package/dist/core/sync/completion.js.map +1 -0
- package/dist/core/sync/index.d.ts +51 -0
- package/dist/core/sync/index.d.ts.map +1 -0
- package/dist/core/sync/index.js +200 -0
- package/dist/core/sync/index.js.map +1 -0
- package/dist/core/sync/scanner.d.ts +39 -0
- package/dist/core/sync/scanner.d.ts.map +1 -0
- package/dist/core/sync/scanner.js +364 -0
- package/dist/core/sync/scanner.js.map +1 -0
- package/dist/types/config.d.ts +157 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +58 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/coverage.d.ts +100 -0
- package/dist/types/coverage.d.ts.map +1 -0
- package/dist/types/coverage.js +8 -0
- package/dist/types/coverage.js.map +1 -0
- package/dist/types/doctor.d.ts +68 -0
- package/dist/types/doctor.d.ts.map +1 -0
- package/dist/types/doctor.js +5 -0
- package/dist/types/doctor.js.map +1 -0
- package/dist/types/gaps.d.ts +129 -0
- package/dist/types/gaps.d.ts.map +1 -0
- package/dist/types/gaps.js +8 -0
- package/dist/types/gaps.js.map +1 -0
- package/dist/types/prompts.d.ts +99 -0
- package/dist/types/prompts.d.ts.map +1 -0
- package/dist/types/prompts.js +5 -0
- package/dist/types/prompts.js.map +1 -0
- package/dist/types/runner.d.ts +156 -0
- package/dist/types/runner.d.ts.map +1 -0
- package/dist/types/runner.js +41 -0
- package/dist/types/runner.js.map +1 -0
- package/dist/types/send.d.ts +157 -0
- package/dist/types/send.d.ts.map +1 -0
- package/dist/types/send.js +18 -0
- package/dist/types/send.js.map +1 -0
- package/dist/types/status.d.ts +150 -0
- package/dist/types/status.d.ts.map +1 -0
- package/dist/types/status.js +15 -0
- package/dist/types/status.js.map +1 -0
- package/dist/types/sync.d.ts +259 -0
- package/dist/types/sync.d.ts.map +1 -0
- package/dist/types/sync.js +38 -0
- package/dist/types/sync.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command file generation and management
|
|
3
|
+
*
|
|
4
|
+
* Handles creation and management of .claude/commands/ files for both
|
|
5
|
+
* the planning hub and dev repositories.
|
|
6
|
+
*/
|
|
7
|
+
import { mkdir, writeFile, readFile, readdir, stat } from 'fs/promises';
|
|
8
|
+
import { existsSync } from 'fs';
|
|
9
|
+
import path from 'path';
|
|
10
|
+
/**
|
|
11
|
+
* Planning hub command templates
|
|
12
|
+
*/
|
|
13
|
+
const PLANNING_HUB_COMMANDS = {
|
|
14
|
+
'vibe-prd.md': `---
|
|
15
|
+
description: Create or update PRD using AI analysis
|
|
16
|
+
model: opus
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
# PRD Management
|
|
20
|
+
|
|
21
|
+
You are helping manage a Product Requirements Document for this planning hub.
|
|
22
|
+
|
|
23
|
+
## Instructions
|
|
24
|
+
|
|
25
|
+
1. **Read current state:**
|
|
26
|
+
- Check \`docs/prd/\` for existing PRD structure
|
|
27
|
+
- Check \`docs/sync-cache/\` for synced repo data
|
|
28
|
+
- Read \`vibe-fabric.toml\` for project configuration
|
|
29
|
+
|
|
30
|
+
2. **Determine intent:**
|
|
31
|
+
- If PRD doesn't exist: Create initial PRD structure
|
|
32
|
+
- If PRD exists: Assess what needs updating based on recent changes
|
|
33
|
+
|
|
34
|
+
3. **For new PRD creation:**
|
|
35
|
+
- Ask user about core features and modules
|
|
36
|
+
- Create module structure in \`docs/prd/modules/\`
|
|
37
|
+
- Create vision document in \`docs/prd/vision/\`
|
|
38
|
+
- Update \`docs/prd/_index.md\` with overview
|
|
39
|
+
|
|
40
|
+
4. **For PRD updates:**
|
|
41
|
+
- Identify gaps between PRD and implementation
|
|
42
|
+
- Suggest updates based on sync-cache data
|
|
43
|
+
- Mark deprecated requirements
|
|
44
|
+
|
|
45
|
+
## Output
|
|
46
|
+
|
|
47
|
+
Update files in \`docs/prd/\` following the established structure.
|
|
48
|
+
`,
|
|
49
|
+
'vibe-scope.md': `---
|
|
50
|
+
description: Create or manage scope briefs
|
|
51
|
+
model: sonnet
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
# Scope Management
|
|
55
|
+
|
|
56
|
+
You are helping manage scope briefs for development work.
|
|
57
|
+
|
|
58
|
+
## Instructions
|
|
59
|
+
|
|
60
|
+
1. **Read current state:**
|
|
61
|
+
- Check \`docs/scopes/\` for existing scopes
|
|
62
|
+
- Check \`docs/prd/\` for requirements to scope
|
|
63
|
+
- Read coverage status from \`vibe coverage\` output
|
|
64
|
+
|
|
65
|
+
2. **Determine action:**
|
|
66
|
+
- If creating new scope: Gather requirements from PRD
|
|
67
|
+
- If reviewing scope: Check completeness and dependencies
|
|
68
|
+
- If listing: Show scope summary by status
|
|
69
|
+
|
|
70
|
+
3. **For new scope creation:**
|
|
71
|
+
- Identify uncovered PRD requirements
|
|
72
|
+
- Group related requirements into a scope
|
|
73
|
+
- Create scope file in \`docs/scopes/drafts/\`
|
|
74
|
+
- Link to PRD requirement IDs
|
|
75
|
+
|
|
76
|
+
4. **Scope structure:**
|
|
77
|
+
- Follow template from existing completed scopes
|
|
78
|
+
- Include: Metadata, Summary, Requirements, Acceptance Criteria
|
|
79
|
+
- Specify dependencies on other scopes
|
|
80
|
+
|
|
81
|
+
## Output
|
|
82
|
+
|
|
83
|
+
Create or update scope files in \`docs/scopes/\` directories.
|
|
84
|
+
`,
|
|
85
|
+
'vibe-gaps.md': `---
|
|
86
|
+
description: Analyze gaps between PRD and implementation
|
|
87
|
+
model: sonnet
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
# Gap Analysis
|
|
91
|
+
|
|
92
|
+
You are performing gap analysis between PRD requirements and implementation status.
|
|
93
|
+
|
|
94
|
+
## Instructions
|
|
95
|
+
|
|
96
|
+
1. **Read data:**
|
|
97
|
+
- \`docs/prd/\` for all requirements (REQ-XXX-NNN pattern)
|
|
98
|
+
- \`docs/scopes/\` for implementation coverage
|
|
99
|
+
- \`docs/sync-cache/\` for actual implementation state
|
|
100
|
+
|
|
101
|
+
2. **Identify gaps:**
|
|
102
|
+
- **Missing:** Requirements with no scope coverage
|
|
103
|
+
- **Partial:** Requirements with incomplete scope coverage
|
|
104
|
+
- **Orphaned:** Scopes without PRD linkage
|
|
105
|
+
|
|
106
|
+
3. **Prioritize gaps:**
|
|
107
|
+
- P1 (Critical): Security, data integrity, core features
|
|
108
|
+
- P2 (High): Important user-facing features
|
|
109
|
+
- P3 (Medium): Standard features
|
|
110
|
+
- P4 (Low): Nice-to-have, optimizations
|
|
111
|
+
|
|
112
|
+
4. **Generate suggestions:**
|
|
113
|
+
- Recommend new scopes for missing requirements
|
|
114
|
+
- Suggest scope updates for partial coverage
|
|
115
|
+
- Flag potential technical debt
|
|
116
|
+
|
|
117
|
+
## Output
|
|
118
|
+
|
|
119
|
+
Provide structured gap analysis with actionable recommendations.
|
|
120
|
+
`,
|
|
121
|
+
'vibe-status.md': `---
|
|
122
|
+
description: Show project status summary
|
|
123
|
+
model: haiku
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
# Status Summary
|
|
127
|
+
|
|
128
|
+
Generate a quick project status summary.
|
|
129
|
+
|
|
130
|
+
## Instructions
|
|
131
|
+
|
|
132
|
+
1. **Gather data:**
|
|
133
|
+
- Repository list from \`vibe-fabric.toml\`
|
|
134
|
+
- Scope counts by status (drafts, ready, sent, completed)
|
|
135
|
+
- PRD module coverage percentages
|
|
136
|
+
- Last sync timestamps from \`docs/sync-cache/\`
|
|
137
|
+
|
|
138
|
+
2. **Format output:**
|
|
139
|
+
- Project overview (name, repos, sync status)
|
|
140
|
+
- Coverage metrics (PRD %, scope breakdown)
|
|
141
|
+
- Recent activity (last 5 scope changes)
|
|
142
|
+
- Next recommended actions
|
|
143
|
+
|
|
144
|
+
## Output
|
|
145
|
+
|
|
146
|
+
Display a clear, formatted status table in the terminal.
|
|
147
|
+
`,
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Dev repo command templates (subset for injection)
|
|
151
|
+
* Full set is in src/core/repo/templates/claude-commands.ts
|
|
152
|
+
*/
|
|
153
|
+
const DEV_REPO_COMMANDS = {
|
|
154
|
+
'plan-from-scope.md': `---
|
|
155
|
+
description: Create an implementation plan from a scope brief
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
# Plan from Scope
|
|
159
|
+
|
|
160
|
+
Create a detailed implementation plan for scope: **$ARGUMENTS**
|
|
161
|
+
|
|
162
|
+
## Instructions
|
|
163
|
+
|
|
164
|
+
1. Read the scope file from \`vibe/incoming-scopes/$ARGUMENTS.md\`
|
|
165
|
+
2. Understand all requirements and acceptance criteria
|
|
166
|
+
3. Create a plan file in \`vibe/implementation-plans/active/\`
|
|
167
|
+
4. Move the scope to \`vibe/incoming-scopes/processed/\`
|
|
168
|
+
|
|
169
|
+
## Plan Structure
|
|
170
|
+
|
|
171
|
+
Include:
|
|
172
|
+
- Clear objective tied to scope
|
|
173
|
+
- All acceptance criteria as checklist items
|
|
174
|
+
- Concrete implementation steps
|
|
175
|
+
- Progress log section
|
|
176
|
+
|
|
177
|
+
## Output
|
|
178
|
+
|
|
179
|
+
Create: \`vibe/implementation-plans/active/PLAN-[YYYYMMDD]-[short-name].md\`
|
|
180
|
+
`,
|
|
181
|
+
'implement-plan.md': `---
|
|
182
|
+
description: Implement a plan step by step with guidance
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
# Implement Plan
|
|
186
|
+
|
|
187
|
+
Implement the plan: **$ARGUMENTS**
|
|
188
|
+
|
|
189
|
+
## Instructions
|
|
190
|
+
|
|
191
|
+
1. Read the plan from \`vibe/implementation-plans/active/$ARGUMENTS.md\`
|
|
192
|
+
2. Review the acceptance criteria
|
|
193
|
+
3. Implement each step, updating progress log
|
|
194
|
+
4. Check off criteria as completed
|
|
195
|
+
5. When done, move plan to \`completed/\`
|
|
196
|
+
|
|
197
|
+
## Guidelines
|
|
198
|
+
|
|
199
|
+
- Implement one step at a time
|
|
200
|
+
- Update progress log after each step
|
|
201
|
+
- Ask for clarification if requirements are unclear
|
|
202
|
+
- Document any deviations from the plan
|
|
203
|
+
`,
|
|
204
|
+
'ralph.md': `---
|
|
205
|
+
description: Ralph autonomous multi-session executor
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
# Ralph
|
|
209
|
+
|
|
210
|
+
Parse subcommand from $ARGUMENTS:
|
|
211
|
+
|
|
212
|
+
**execute {PLAN_ID}**:
|
|
213
|
+
Start autonomous execution loop for a plan.
|
|
214
|
+
|
|
215
|
+
**plan {SCOPE_ID}**:
|
|
216
|
+
Start autonomous planning loop for a scope.
|
|
217
|
+
|
|
218
|
+
**status**:
|
|
219
|
+
Show current Ralph progress.
|
|
220
|
+
|
|
221
|
+
**cancel**:
|
|
222
|
+
Stop active Ralph loop and cleanup.
|
|
223
|
+
`,
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Parse command frontmatter from a command file
|
|
227
|
+
*/
|
|
228
|
+
function parseCommandFrontmatter(content) {
|
|
229
|
+
const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---/);
|
|
230
|
+
if (!frontmatterMatch || !frontmatterMatch[1]) {
|
|
231
|
+
return { description: 'No description' };
|
|
232
|
+
}
|
|
233
|
+
const frontmatter = frontmatterMatch[1];
|
|
234
|
+
const descMatch = frontmatter.match(/description:\s*(.+)/);
|
|
235
|
+
const modelMatch = frontmatter.match(/model:\s*(.+)/);
|
|
236
|
+
return {
|
|
237
|
+
description: descMatch?.[1]?.trim() || 'No description',
|
|
238
|
+
model: modelMatch?.[1]?.trim(),
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Generate planning hub commands in .claude/commands/
|
|
243
|
+
*/
|
|
244
|
+
export async function generatePlanningHubCommands(projectPath) {
|
|
245
|
+
const commandsDir = path.join(projectPath, '.claude', 'commands');
|
|
246
|
+
await mkdir(commandsDir, { recursive: true });
|
|
247
|
+
const created = [];
|
|
248
|
+
for (const [filename, content] of Object.entries(PLANNING_HUB_COMMANDS)) {
|
|
249
|
+
const filePath = path.join(commandsDir, filename);
|
|
250
|
+
await writeFile(filePath, content, 'utf-8');
|
|
251
|
+
created.push(filename);
|
|
252
|
+
}
|
|
253
|
+
return created;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Generate dev repo commands (for injection via vibe repo add)
|
|
257
|
+
*/
|
|
258
|
+
export async function generateDevRepoCommands(repoPath) {
|
|
259
|
+
const commandsDir = path.join(repoPath, '.claude', 'commands');
|
|
260
|
+
await mkdir(commandsDir, { recursive: true });
|
|
261
|
+
const created = [];
|
|
262
|
+
for (const [filename, content] of Object.entries(DEV_REPO_COMMANDS)) {
|
|
263
|
+
const filePath = path.join(commandsDir, filename);
|
|
264
|
+
await writeFile(filePath, content, 'utf-8');
|
|
265
|
+
created.push(filename);
|
|
266
|
+
}
|
|
267
|
+
return created;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* List all commands in a project
|
|
271
|
+
*/
|
|
272
|
+
export async function listCommands(projectPath) {
|
|
273
|
+
const commandsDir = path.join(projectPath, '.claude', 'commands');
|
|
274
|
+
const customDir = path.join(commandsDir, 'custom');
|
|
275
|
+
const builtin = [];
|
|
276
|
+
const custom = [];
|
|
277
|
+
// Scan builtin commands
|
|
278
|
+
if (existsSync(commandsDir)) {
|
|
279
|
+
const files = await readdir(commandsDir);
|
|
280
|
+
for (const file of files) {
|
|
281
|
+
if (!file.endsWith('.md'))
|
|
282
|
+
continue;
|
|
283
|
+
const filePath = path.join(commandsDir, file);
|
|
284
|
+
const fileStat = await stat(filePath);
|
|
285
|
+
if (!fileStat.isFile())
|
|
286
|
+
continue;
|
|
287
|
+
const content = await readFile(filePath, 'utf-8');
|
|
288
|
+
const { description, model } = parseCommandFrontmatter(content);
|
|
289
|
+
builtin.push({
|
|
290
|
+
name: file.replace('.md', ''),
|
|
291
|
+
description,
|
|
292
|
+
model,
|
|
293
|
+
content,
|
|
294
|
+
path: filePath,
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
// Scan custom commands
|
|
299
|
+
if (existsSync(customDir)) {
|
|
300
|
+
const files = await readdir(customDir);
|
|
301
|
+
for (const file of files) {
|
|
302
|
+
if (!file.endsWith('.md'))
|
|
303
|
+
continue;
|
|
304
|
+
const filePath = path.join(customDir, file);
|
|
305
|
+
const fileStat = await stat(filePath);
|
|
306
|
+
if (!fileStat.isFile())
|
|
307
|
+
continue;
|
|
308
|
+
const content = await readFile(filePath, 'utf-8');
|
|
309
|
+
const { description, model } = parseCommandFrontmatter(content);
|
|
310
|
+
custom.push({
|
|
311
|
+
name: file.replace('.md', ''),
|
|
312
|
+
description,
|
|
313
|
+
model,
|
|
314
|
+
content,
|
|
315
|
+
path: filePath,
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
// Sort by name
|
|
320
|
+
builtin.sort((a, b) => a.name.localeCompare(b.name));
|
|
321
|
+
custom.sort((a, b) => a.name.localeCompare(b.name));
|
|
322
|
+
return { builtin, custom };
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Check if planning hub commands exist
|
|
326
|
+
*/
|
|
327
|
+
export async function hasCommands(projectPath) {
|
|
328
|
+
const commandsDir = path.join(projectPath, '.claude', 'commands');
|
|
329
|
+
if (!existsSync(commandsDir))
|
|
330
|
+
return false;
|
|
331
|
+
const { builtin } = await listCommands(projectPath);
|
|
332
|
+
return builtin.length > 0;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Get specific command content
|
|
336
|
+
*/
|
|
337
|
+
export async function getCommand(projectPath, name) {
|
|
338
|
+
const { builtin, custom } = await listCommands(projectPath);
|
|
339
|
+
// Check builtin first
|
|
340
|
+
const builtinCmd = builtin.find((c) => c.name === name);
|
|
341
|
+
if (builtinCmd)
|
|
342
|
+
return builtinCmd;
|
|
343
|
+
// Check custom
|
|
344
|
+
const customCmd = custom.find((c) => c.name === name);
|
|
345
|
+
if (customCmd)
|
|
346
|
+
return customCmd;
|
|
347
|
+
return null;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Create custom command directory
|
|
351
|
+
*/
|
|
352
|
+
export async function ensureCustomCommandsDir(projectPath) {
|
|
353
|
+
const customDir = path.join(projectPath, '.claude', 'commands', 'custom');
|
|
354
|
+
await mkdir(customDir, { recursive: true });
|
|
355
|
+
// Add .gitkeep if empty
|
|
356
|
+
const gitkeepPath = path.join(customDir, '.gitkeep');
|
|
357
|
+
if (!existsSync(gitkeepPath)) {
|
|
358
|
+
await writeFile(gitkeepPath, '', 'utf-8');
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/core/commands.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;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
1
|
+
import { Config } from '../types/config.js';
|
|
2
|
+
/**
|
|
3
|
+
* Load configuration from project directory
|
|
4
|
+
*/
|
|
5
|
+
export declare function loadConfig(projectPath: string): Promise<Config | null>;
|
|
6
|
+
/**
|
|
7
|
+
* Save configuration to project directory
|
|
8
|
+
*/
|
|
9
|
+
export declare function saveConfig(projectPath: string, config: Config): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Check if a directory is a vibe-fabric project
|
|
12
|
+
*/
|
|
13
|
+
export declare function isVibeProject(dirPath: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Get the config file path for a project
|
|
16
|
+
*/
|
|
17
|
+
export declare function getConfigPath(projectPath: string): string;
|
|
18
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAgB,MAAM,oBAAoB,CAAC;AAmB1D;;GAEG;AACH,wBAAsB,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAsB5E;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBnF;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEzD"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { cosmiconfig } from 'cosmiconfig';
|
|
2
|
+
import { readFile, writeFile } from 'fs/promises';
|
|
3
|
+
import { existsSync } from 'fs';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import TOML from '@iarna/toml';
|
|
6
|
+
import { ConfigSchema } from '../types/config.js';
|
|
7
|
+
const CONFIG_FILE_NAME = 'vibe-fabric.toml';
|
|
8
|
+
/**
|
|
9
|
+
* Create a cosmiconfig explorer for vibe-fabric configuration
|
|
10
|
+
*/
|
|
11
|
+
function createExplorer() {
|
|
12
|
+
return cosmiconfig('vibe-fabric', {
|
|
13
|
+
searchPlaces: [CONFIG_FILE_NAME, '.vibe-fabric.toml', 'vibe-fabric.config.js'],
|
|
14
|
+
loaders: {
|
|
15
|
+
'.toml': async (filepath) => {
|
|
16
|
+
const content = await readFile(filepath, 'utf-8');
|
|
17
|
+
return TOML.parse(content);
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Load configuration from project directory
|
|
24
|
+
*/
|
|
25
|
+
export async function loadConfig(projectPath) {
|
|
26
|
+
const explorer = createExplorer();
|
|
27
|
+
try {
|
|
28
|
+
const result = await explorer.search(projectPath);
|
|
29
|
+
if (!result || result.isEmpty) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
// Validate with Zod
|
|
33
|
+
const parsed = ConfigSchema.safeParse(result.config);
|
|
34
|
+
if (!parsed.success) {
|
|
35
|
+
throw new Error(`Invalid configuration: ${parsed.error.message}`);
|
|
36
|
+
}
|
|
37
|
+
return parsed.data;
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
if (error instanceof Error) {
|
|
41
|
+
throw new Error(`Failed to load configuration: ${error.message}`);
|
|
42
|
+
}
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Save configuration to project directory
|
|
48
|
+
*/
|
|
49
|
+
export async function saveConfig(projectPath, config) {
|
|
50
|
+
const configPath = path.join(projectPath, CONFIG_FILE_NAME);
|
|
51
|
+
// Validate before saving
|
|
52
|
+
const parsed = ConfigSchema.safeParse(config);
|
|
53
|
+
if (!parsed.success) {
|
|
54
|
+
throw new Error(`Invalid configuration: ${parsed.error.message}`);
|
|
55
|
+
}
|
|
56
|
+
// Convert to TOML
|
|
57
|
+
const tomlContent = TOML.stringify(config);
|
|
58
|
+
// Add header comment
|
|
59
|
+
const content = `# Vibe-Fabric Configuration
|
|
60
|
+
# Generated by vibe init
|
|
61
|
+
# Documentation: https://github.com/jneaimi/vibe-fabric/blob/main/docs/wiki/README.md
|
|
62
|
+
|
|
63
|
+
${tomlContent}`;
|
|
64
|
+
await writeFile(configPath, content, 'utf-8');
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Check if a directory is a vibe-fabric project
|
|
68
|
+
*/
|
|
69
|
+
export function isVibeProject(dirPath) {
|
|
70
|
+
return existsSync(path.join(dirPath, CONFIG_FILE_NAME));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Get the config file path for a project
|
|
74
|
+
*/
|
|
75
|
+
export function getConfigPath(projectPath) {
|
|
76
|
+
return path.join(projectPath, CONFIG_FILE_NAME);
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,EAAU,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAE1D,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAE5C;;GAEG;AACH,SAAS,cAAc;IACrB,OAAO,WAAW,CAAC,aAAa,EAAE;QAChC,YAAY,EAAE,CAAC,gBAAgB,EAAE,mBAAmB,EAAE,uBAAuB,CAAC;QAC9E,OAAO,EAAE;YACP,OAAO,EAAE,KAAK,E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,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,0BAA0B,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,kBAAkB;IAClB,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,MAAsB,CAAC,CAAC;IAE3D,qBAAqB;IACrB,MAAM,OAAO,GAAG;;;;EAIhB,WAAW,EAAE,CAAC;IAEd,MAAM,SAAS,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAC1D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,WAAmB;IAC/C,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core coverage module - extended coverage analysis
|
|
3
|
+
*
|
|
4
|
+
* Provides detailed PRD coverage analysis with per-requirement
|
|
5
|
+
* breakdowns, status grouping, and scope linkage.
|
|
6
|
+
*/
|
|
7
|
+
import { RequirementStatus, ScopeRef, ExtendedCoverageData, CoverageJsonOutput } from '../types/coverage.js';
|
|
8
|
+
/**
|
|
9
|
+
* Parse scope files to get scope references
|
|
10
|
+
*/
|
|
11
|
+
export declare function loadScopes(projectPath: string): Promise<ScopeRef[]>;
|
|
12
|
+
/**
|
|
13
|
+
* Determine requirement status based on linked scopes
|
|
14
|
+
*/
|
|
15
|
+
export declare function getRequirementStatus(reqId: string, scopes: ScopeRef[]): {
|
|
16
|
+
status: RequirementStatus;
|
|
17
|
+
scopeIds: string[];
|
|
18
|
+
completedAt: string | null;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Calculate extended coverage data with full requirement details
|
|
22
|
+
*/
|
|
23
|
+
export declare function calculateExtendedCoverage(projectPath: string): Promise<ExtendedCoverageData>;
|
|
24
|
+
/**
|
|
25
|
+
* Get list of available module names
|
|
26
|
+
*/
|
|
27
|
+
export declare function getModuleNames(projectPath: string): Promise<string[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Convert coverage data to JSON output format
|
|
30
|
+
*/
|
|
31
|
+
export declare function toCoverageJsonOutput(data: ExtendedCoverageData): CoverageJsonOutput;
|
|
32
|
+
//# sourceMappingURL=coverage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage.d.ts","sourceRoot":"","sources":["../../src/core/coverage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EACL,iBAAiB,EAGjB,QAAQ,EACR,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAE9B;;GAEG;AACH,wBAAsB,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAkEzE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,QAAQ,EAAE,GACjB;IAAE,MAAM,EAAE,iBAAiB,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAuC/E;AA6CD;;GAEG;AACH,wBAAsB,yBAAyB,CAC7C,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,oBAAoB,CAAC,CAmH/B;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAe3E;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,oBAAoB,GAAG,kBAAkB,CA+BnF"}
|