@mobiman/vector 1.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 +117 -0
- package/agents/vector-codebase-mapper.md +770 -0
- package/agents/vector-debugger.md +1338 -0
- package/agents/vector-executor.md +487 -0
- package/agents/vector-integration-checker.md +443 -0
- package/agents/vector-nyquist-auditor.md +176 -0
- package/agents/vector-phase-researcher.md +553 -0
- package/agents/vector-plan-checker.md +706 -0
- package/agents/vector-planner.md +1307 -0
- package/agents/vector-project-researcher.md +629 -0
- package/agents/vector-research-synthesizer.md +247 -0
- package/agents/vector-roadmapper.md +650 -0
- package/agents/vector-ui-auditor.md +439 -0
- package/agents/vector-ui-checker.md +300 -0
- package/agents/vector-ui-researcher.md +353 -0
- package/agents/vector-verifier.md +579 -0
- package/bin/install.cjs +2907 -0
- package/bin/install.cjs.map +1 -0
- package/bin/install.cts +3103 -0
- package/bin/install.d.cts +3 -0
- package/bin/install.d.cts.map +1 -0
- package/commands/vector/add-phase.md +43 -0
- package/commands/vector/add-tests.md +41 -0
- package/commands/vector/add-todo.md +47 -0
- package/commands/vector/audit-milestone.md +36 -0
- package/commands/vector/autonomous.md +41 -0
- package/commands/vector/check-todos.md +45 -0
- package/commands/vector/cleanup.md +18 -0
- package/commands/vector/complete-milestone.md +136 -0
- package/commands/vector/debug.md +168 -0
- package/commands/vector/discuss-phase.md +90 -0
- package/commands/vector/do.md +30 -0
- package/commands/vector/execute-phase.md +41 -0
- package/commands/vector/health.md +22 -0
- package/commands/vector/help.md +22 -0
- package/commands/vector/insert-phase.md +32 -0
- package/commands/vector/join-discord.md +18 -0
- package/commands/vector/list-phase-assumptions.md +46 -0
- package/commands/vector/map-codebase.md +71 -0
- package/commands/vector/new-milestone.md +44 -0
- package/commands/vector/new-project.md +42 -0
- package/commands/vector/pause-work.md +38 -0
- package/commands/vector/plan-milestone-gaps.md +34 -0
- package/commands/vector/plan-phase.md +45 -0
- package/commands/vector/progress.md +24 -0
- package/commands/vector/quick.md +47 -0
- package/commands/vector/reapply-patches.md +123 -0
- package/commands/vector/remove-phase.md +31 -0
- package/commands/vector/research-phase.md +190 -0
- package/commands/vector/resume-work.md +40 -0
- package/commands/vector/set-profile.md +12 -0
- package/commands/vector/settings.md +36 -0
- package/commands/vector/stats.md +18 -0
- package/commands/vector/ui-phase.md +34 -0
- package/commands/vector/ui-review.md +32 -0
- package/commands/vector/update.md +37 -0
- package/commands/vector/validate-phase.md +35 -0
- package/commands/vector/verify-work.md +38 -0
- package/core/bin/lib/commands.cjs +641 -0
- package/core/bin/lib/commands.cjs.map +1 -0
- package/core/bin/lib/commands.cts +712 -0
- package/core/bin/lib/commands.d.cts +23 -0
- package/core/bin/lib/commands.d.cts.map +1 -0
- package/core/bin/lib/config.cjs +281 -0
- package/core/bin/lib/config.cjs.map +1 -0
- package/core/bin/lib/config.cts +301 -0
- package/core/bin/lib/config.d.cts +50 -0
- package/core/bin/lib/config.d.cts.map +1 -0
- package/core/bin/lib/core.cjs +483 -0
- package/core/bin/lib/core.cjs.map +1 -0
- package/core/bin/lib/core.cts +544 -0
- package/core/bin/lib/core.d.cts +96 -0
- package/core/bin/lib/core.d.cts.map +1 -0
- package/core/bin/lib/frontmatter.cjs +341 -0
- package/core/bin/lib/frontmatter.cjs.map +1 -0
- package/core/bin/lib/frontmatter.cts +295 -0
- package/core/bin/lib/frontmatter.d.cts +18 -0
- package/core/bin/lib/frontmatter.d.cts.map +1 -0
- package/core/bin/lib/init.cjs +674 -0
- package/core/bin/lib/init.cjs.map +1 -0
- package/core/bin/lib/init.cts +775 -0
- package/core/bin/lib/init.d.cts +16 -0
- package/core/bin/lib/init.d.cts.map +1 -0
- package/core/bin/lib/milestone.cjs +210 -0
- package/core/bin/lib/milestone.cjs.map +1 -0
- package/core/bin/lib/milestone.cts +241 -0
- package/core/bin/lib/milestone.d.cts +11 -0
- package/core/bin/lib/milestone.d.cts.map +1 -0
- package/core/bin/lib/model-profiles.cjs +62 -0
- package/core/bin/lib/model-profiles.cjs.map +1 -0
- package/core/bin/lib/model-profiles.cts +66 -0
- package/core/bin/lib/model-profiles.d.cts +33 -0
- package/core/bin/lib/model-profiles.d.cts.map +1 -0
- package/core/bin/lib/phase.cjs +713 -0
- package/core/bin/lib/phase.cjs.map +1 -0
- package/core/bin/lib/phase.cts +914 -0
- package/core/bin/lib/phase.d.cts +21 -0
- package/core/bin/lib/phase.d.cts.map +1 -0
- package/core/bin/lib/roadmap.cjs +246 -0
- package/core/bin/lib/roadmap.cjs.map +1 -0
- package/core/bin/lib/roadmap.cts +311 -0
- package/core/bin/lib/roadmap.d.cts +7 -0
- package/core/bin/lib/roadmap.d.cts.map +1 -0
- package/core/bin/lib/state.cjs +709 -0
- package/core/bin/lib/state.cjs.map +1 -0
- package/core/bin/lib/state.cts +718 -0
- package/core/bin/lib/state.d.cts +47 -0
- package/core/bin/lib/state.d.cts.map +1 -0
- package/core/bin/lib/template.cjs +220 -0
- package/core/bin/lib/template.cjs.map +1 -0
- package/core/bin/lib/template.cts +229 -0
- package/core/bin/lib/template.d.cts +15 -0
- package/core/bin/lib/template.d.cts.map +1 -0
- package/core/bin/lib/verify.cjs +824 -0
- package/core/bin/lib/verify.cjs.map +1 -0
- package/core/bin/lib/verify.cts +829 -0
- package/core/bin/lib/verify.d.cts +17 -0
- package/core/bin/lib/verify.d.cts.map +1 -0
- package/core/bin/vector-tools.cjs +641 -0
- package/core/bin/vector-tools.cjs.map +1 -0
- package/core/bin/vector-tools.cts +603 -0
- package/core/bin/vector-tools.d.cts +128 -0
- package/core/bin/vector-tools.d.cts.map +1 -0
- package/core/references/checkpoints.md +776 -0
- package/core/references/continuation-format.md +249 -0
- package/core/references/decimal-phase-calculation.md +65 -0
- package/core/references/git-integration.md +248 -0
- package/core/references/git-planning-commit.md +38 -0
- package/core/references/model-profile-resolution.md +36 -0
- package/core/references/model-profiles.md +101 -0
- package/core/references/phase-argument-parsing.md +61 -0
- package/core/references/planning-config.md +200 -0
- package/core/references/questioning.md +162 -0
- package/core/references/tdd.md +263 -0
- package/core/references/ui-brand.md +160 -0
- package/core/references/verification-patterns.md +612 -0
- package/core/templates/DEBUG.md +164 -0
- package/core/templates/UAT.md +247 -0
- package/core/templates/UI-SPEC.md +100 -0
- package/core/templates/VALIDATION.md +76 -0
- package/core/templates/codebase/architecture.md +255 -0
- package/core/templates/codebase/concerns.md +310 -0
- package/core/templates/codebase/conventions.md +307 -0
- package/core/templates/codebase/integrations.md +280 -0
- package/core/templates/codebase/stack.md +186 -0
- package/core/templates/codebase/structure.md +285 -0
- package/core/templates/codebase/testing.md +480 -0
- package/core/templates/config.json +37 -0
- package/core/templates/context.md +352 -0
- package/core/templates/continue-here.md +78 -0
- package/core/templates/copilot-instructions.md +7 -0
- package/core/templates/debug-subagent-prompt.md +91 -0
- package/core/templates/discovery.md +146 -0
- package/core/templates/milestone-archive.md +123 -0
- package/core/templates/milestone.md +115 -0
- package/core/templates/phase-prompt.md +610 -0
- package/core/templates/planner-subagent-prompt.md +117 -0
- package/core/templates/project.md +184 -0
- package/core/templates/requirements.md +231 -0
- package/core/templates/research-project/ARCHITECTURE.md +204 -0
- package/core/templates/research-project/FEATURES.md +147 -0
- package/core/templates/research-project/PITFALLS.md +200 -0
- package/core/templates/research-project/STACK.md +120 -0
- package/core/templates/research-project/SUMMARY.md +170 -0
- package/core/templates/research.md +552 -0
- package/core/templates/retrospective.md +54 -0
- package/core/templates/roadmap.md +202 -0
- package/core/templates/state.md +176 -0
- package/core/templates/summary-complex.md +59 -0
- package/core/templates/summary-minimal.md +41 -0
- package/core/templates/summary-standard.md +48 -0
- package/core/templates/summary.md +248 -0
- package/core/templates/user-setup.md +311 -0
- package/core/templates/verification-report.md +322 -0
- package/core/workflows/add-phase.md +112 -0
- package/core/workflows/add-tests.md +351 -0
- package/core/workflows/add-todo.md +158 -0
- package/core/workflows/audit-milestone.md +332 -0
- package/core/workflows/autonomous.md +743 -0
- package/core/workflows/check-todos.md +177 -0
- package/core/workflows/cleanup.md +152 -0
- package/core/workflows/complete-milestone.md +766 -0
- package/core/workflows/diagnose-issues.md +219 -0
- package/core/workflows/discovery-phase.md +289 -0
- package/core/workflows/discuss-phase.md +762 -0
- package/core/workflows/do.md +104 -0
- package/core/workflows/execute-phase.md +468 -0
- package/core/workflows/execute-plan.md +483 -0
- package/core/workflows/health.md +159 -0
- package/core/workflows/help.md +513 -0
- package/core/workflows/insert-phase.md +130 -0
- package/core/workflows/list-phase-assumptions.md +178 -0
- package/core/workflows/map-codebase.md +316 -0
- package/core/workflows/new-milestone.md +386 -0
- package/core/workflows/new-project.md +1113 -0
- package/core/workflows/node-repair.md +92 -0
- package/core/workflows/pause-work.md +122 -0
- package/core/workflows/plan-milestone-gaps.md +274 -0
- package/core/workflows/plan-phase.md +666 -0
- package/core/workflows/progress.md +382 -0
- package/core/workflows/quick.md +717 -0
- package/core/workflows/remove-phase.md +155 -0
- package/core/workflows/research-phase.md +74 -0
- package/core/workflows/resume-project.md +307 -0
- package/core/workflows/settings.md +243 -0
- package/core/workflows/stats.md +60 -0
- package/core/workflows/transition.md +544 -0
- package/core/workflows/ui-phase.md +290 -0
- package/core/workflows/ui-review.md +157 -0
- package/core/workflows/update.md +320 -0
- package/core/workflows/validate-phase.md +167 -0
- package/core/workflows/verify-phase.md +243 -0
- package/core/workflows/verify-work.md +584 -0
- package/package.json +55 -0
- package/scripts/build-hooks.cjs +38 -0
- package/scripts/build-hooks.cjs.map +1 -0
- package/scripts/build-hooks.cts +41 -0
- package/scripts/build-hooks.d.cts +6 -0
- package/scripts/build-hooks.d.cts.map +1 -0
- package/scripts/run-tests.cjs +28 -0
- package/scripts/run-tests.cjs.map +1 -0
- package/scripts/run-tests.cts +28 -0
- package/scripts/run-tests.d.cts +3 -0
- package/scripts/run-tests.d.cts.map +1 -0
|
@@ -0,0 +1,674 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Init — Compound init commands for workflow bootstrapping
|
|
4
|
+
*/
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.cmdInitExecutePhase = cmdInitExecutePhase;
|
|
10
|
+
exports.cmdInitPlanPhase = cmdInitPlanPhase;
|
|
11
|
+
exports.cmdInitNewProject = cmdInitNewProject;
|
|
12
|
+
exports.cmdInitNewMilestone = cmdInitNewMilestone;
|
|
13
|
+
exports.cmdInitQuick = cmdInitQuick;
|
|
14
|
+
exports.cmdInitResume = cmdInitResume;
|
|
15
|
+
exports.cmdInitVerifyWork = cmdInitVerifyWork;
|
|
16
|
+
exports.cmdInitPhaseOp = cmdInitPhaseOp;
|
|
17
|
+
exports.cmdInitTodos = cmdInitTodos;
|
|
18
|
+
exports.cmdInitMilestoneOp = cmdInitMilestoneOp;
|
|
19
|
+
exports.cmdInitMapCodebase = cmdInitMapCodebase;
|
|
20
|
+
exports.cmdInitProgress = cmdInitProgress;
|
|
21
|
+
const fs_1 = __importDefault(require("fs"));
|
|
22
|
+
const path_1 = __importDefault(require("path"));
|
|
23
|
+
const os_1 = __importDefault(require("os"));
|
|
24
|
+
const child_process_1 = require("child_process");
|
|
25
|
+
const core_cjs_1 = require("./core.cjs");
|
|
26
|
+
function cmdInitExecutePhase(cwd, phase, raw) {
|
|
27
|
+
if (!phase) {
|
|
28
|
+
(0, core_cjs_1.error)('phase required for init execute-phase');
|
|
29
|
+
}
|
|
30
|
+
const config = (0, core_cjs_1.loadConfig)(cwd);
|
|
31
|
+
const phaseInfo = (0, core_cjs_1.findPhaseInternal)(cwd, phase);
|
|
32
|
+
const milestone = (0, core_cjs_1.getMilestoneInfo)(cwd);
|
|
33
|
+
const roadmapPhase = (0, core_cjs_1.getRoadmapPhaseInternal)(cwd, phase);
|
|
34
|
+
const reqMatch = roadmapPhase?.section?.match(/^\*\*Requirements\*\*:[^\S\n]*([^\n]*)$/m);
|
|
35
|
+
const reqExtracted = reqMatch
|
|
36
|
+
? reqMatch[1].replace(/[\[\]]/g, '').split(',').map((s) => s.trim()).filter(Boolean).join(', ')
|
|
37
|
+
: null;
|
|
38
|
+
const phase_req_ids = (reqExtracted && reqExtracted !== 'TBD') ? reqExtracted : null;
|
|
39
|
+
const result = {
|
|
40
|
+
// Models
|
|
41
|
+
executor_model: (0, core_cjs_1.resolveModelInternal)(cwd, 'vector-executor'),
|
|
42
|
+
verifier_model: (0, core_cjs_1.resolveModelInternal)(cwd, 'vector-verifier'),
|
|
43
|
+
// Config flags
|
|
44
|
+
commit_docs: config.commit_docs,
|
|
45
|
+
parallelization: config.parallelization,
|
|
46
|
+
branching_strategy: config.branching_strategy,
|
|
47
|
+
phase_branch_template: config.phase_branch_template,
|
|
48
|
+
milestone_branch_template: config.milestone_branch_template,
|
|
49
|
+
verifier_enabled: config.verifier,
|
|
50
|
+
// Phase info
|
|
51
|
+
phase_found: !!phaseInfo,
|
|
52
|
+
phase_dir: phaseInfo?.directory || null,
|
|
53
|
+
phase_number: phaseInfo?.phase_number || null,
|
|
54
|
+
phase_name: phaseInfo?.phase_name || null,
|
|
55
|
+
phase_slug: phaseInfo?.phase_slug || null,
|
|
56
|
+
phase_req_ids,
|
|
57
|
+
// Plan inventory
|
|
58
|
+
plans: phaseInfo?.plans || [],
|
|
59
|
+
summaries: phaseInfo?.summaries || [],
|
|
60
|
+
incomplete_plans: phaseInfo?.incomplete_plans || [],
|
|
61
|
+
plan_count: phaseInfo?.plans?.length || 0,
|
|
62
|
+
incomplete_count: phaseInfo?.incomplete_plans?.length || 0,
|
|
63
|
+
// Branch name (pre-computed)
|
|
64
|
+
branch_name: config.branching_strategy === 'phase' && phaseInfo
|
|
65
|
+
? config.phase_branch_template
|
|
66
|
+
.replace('{phase}', phaseInfo.phase_number)
|
|
67
|
+
.replace('{slug}', phaseInfo.phase_slug || 'phase')
|
|
68
|
+
: config.branching_strategy === 'milestone'
|
|
69
|
+
? config.milestone_branch_template
|
|
70
|
+
.replace('{milestone}', milestone.version)
|
|
71
|
+
.replace('{slug}', (0, core_cjs_1.generateSlugInternal)(milestone.name) || 'milestone')
|
|
72
|
+
: null,
|
|
73
|
+
// Milestone info
|
|
74
|
+
milestone_version: milestone.version,
|
|
75
|
+
milestone_name: milestone.name,
|
|
76
|
+
milestone_slug: (0, core_cjs_1.generateSlugInternal)(milestone.name),
|
|
77
|
+
// File existence
|
|
78
|
+
state_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning/STATE.md'),
|
|
79
|
+
roadmap_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning/ROADMAP.md'),
|
|
80
|
+
config_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning/config.json'),
|
|
81
|
+
// File paths
|
|
82
|
+
state_path: '.planning/STATE.md',
|
|
83
|
+
roadmap_path: '.planning/ROADMAP.md',
|
|
84
|
+
config_path: '.planning/config.json',
|
|
85
|
+
};
|
|
86
|
+
(0, core_cjs_1.output)(result, raw);
|
|
87
|
+
}
|
|
88
|
+
function cmdInitPlanPhase(cwd, phase, raw) {
|
|
89
|
+
if (!phase) {
|
|
90
|
+
(0, core_cjs_1.error)('phase required for init plan-phase');
|
|
91
|
+
}
|
|
92
|
+
const config = (0, core_cjs_1.loadConfig)(cwd);
|
|
93
|
+
const phaseInfo = (0, core_cjs_1.findPhaseInternal)(cwd, phase);
|
|
94
|
+
const roadmapPhase = (0, core_cjs_1.getRoadmapPhaseInternal)(cwd, phase);
|
|
95
|
+
const reqMatch = roadmapPhase?.section?.match(/^\*\*Requirements\*\*:[^\S\n]*([^\n]*)$/m);
|
|
96
|
+
const reqExtracted = reqMatch
|
|
97
|
+
? reqMatch[1].replace(/[\[\]]/g, '').split(',').map((s) => s.trim()).filter(Boolean).join(', ')
|
|
98
|
+
: null;
|
|
99
|
+
const phase_req_ids = (reqExtracted && reqExtracted !== 'TBD') ? reqExtracted : null;
|
|
100
|
+
const result = {
|
|
101
|
+
// Models
|
|
102
|
+
researcher_model: (0, core_cjs_1.resolveModelInternal)(cwd, 'vector-phase-researcher'),
|
|
103
|
+
planner_model: (0, core_cjs_1.resolveModelInternal)(cwd, 'vector-planner'),
|
|
104
|
+
checker_model: (0, core_cjs_1.resolveModelInternal)(cwd, 'vector-plan-checker'),
|
|
105
|
+
// Workflow flags
|
|
106
|
+
research_enabled: config.research,
|
|
107
|
+
plan_checker_enabled: config.plan_checker,
|
|
108
|
+
nyquist_validation_enabled: config.nyquist_validation,
|
|
109
|
+
commit_docs: config.commit_docs,
|
|
110
|
+
// Phase info
|
|
111
|
+
phase_found: !!phaseInfo,
|
|
112
|
+
phase_dir: phaseInfo?.directory || null,
|
|
113
|
+
phase_number: phaseInfo?.phase_number || null,
|
|
114
|
+
phase_name: phaseInfo?.phase_name || null,
|
|
115
|
+
phase_slug: phaseInfo?.phase_slug || null,
|
|
116
|
+
padded_phase: phaseInfo?.phase_number ? (0, core_cjs_1.normalizePhaseName)(phaseInfo.phase_number) : null,
|
|
117
|
+
phase_req_ids,
|
|
118
|
+
// Existing artifacts
|
|
119
|
+
has_research: phaseInfo?.has_research || false,
|
|
120
|
+
has_context: phaseInfo?.has_context || false,
|
|
121
|
+
has_plans: (phaseInfo?.plans?.length || 0) > 0,
|
|
122
|
+
plan_count: phaseInfo?.plans?.length || 0,
|
|
123
|
+
// Environment
|
|
124
|
+
planning_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning'),
|
|
125
|
+
roadmap_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning/ROADMAP.md'),
|
|
126
|
+
// File paths
|
|
127
|
+
state_path: '.planning/STATE.md',
|
|
128
|
+
roadmap_path: '.planning/ROADMAP.md',
|
|
129
|
+
requirements_path: '.planning/REQUIREMENTS.md',
|
|
130
|
+
};
|
|
131
|
+
if (phaseInfo?.directory) {
|
|
132
|
+
// Find *-CONTEXT.md in phase directory
|
|
133
|
+
const phaseDirFull = path_1.default.join(cwd, phaseInfo.directory);
|
|
134
|
+
try {
|
|
135
|
+
const files = fs_1.default.readdirSync(phaseDirFull);
|
|
136
|
+
const contextFile = files.find(f => f.endsWith('-CONTEXT.md') || f === 'CONTEXT.md');
|
|
137
|
+
if (contextFile) {
|
|
138
|
+
result.context_path = (0, core_cjs_1.toPosixPath)(path_1.default.join(phaseInfo.directory, contextFile));
|
|
139
|
+
}
|
|
140
|
+
const researchFile = files.find(f => f.endsWith('-RESEARCH.md') || f === 'RESEARCH.md');
|
|
141
|
+
if (researchFile) {
|
|
142
|
+
result.research_path = (0, core_cjs_1.toPosixPath)(path_1.default.join(phaseInfo.directory, researchFile));
|
|
143
|
+
}
|
|
144
|
+
const verificationFile = files.find(f => f.endsWith('-VERIFICATION.md') || f === 'VERIFICATION.md');
|
|
145
|
+
if (verificationFile) {
|
|
146
|
+
result.verification_path = (0, core_cjs_1.toPosixPath)(path_1.default.join(phaseInfo.directory, verificationFile));
|
|
147
|
+
}
|
|
148
|
+
const uatFile = files.find(f => f.endsWith('-UAT.md') || f === 'UAT.md');
|
|
149
|
+
if (uatFile) {
|
|
150
|
+
result.uat_path = (0, core_cjs_1.toPosixPath)(path_1.default.join(phaseInfo.directory, uatFile));
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
catch { }
|
|
154
|
+
}
|
|
155
|
+
(0, core_cjs_1.output)(result, raw);
|
|
156
|
+
}
|
|
157
|
+
function cmdInitNewProject(cwd, raw) {
|
|
158
|
+
const config = (0, core_cjs_1.loadConfig)(cwd);
|
|
159
|
+
// Detect Brave Search API key availability
|
|
160
|
+
const homedir = os_1.default.homedir();
|
|
161
|
+
const braveKeyFile = path_1.default.join(homedir, '.vector', 'brave_api_key');
|
|
162
|
+
const hasBraveSearch = !!(process.env.BRAVE_API_KEY || fs_1.default.existsSync(braveKeyFile));
|
|
163
|
+
// Detect existing code
|
|
164
|
+
let hasCode = false;
|
|
165
|
+
let hasPackageFile = false;
|
|
166
|
+
try {
|
|
167
|
+
const files = (0, child_process_1.execSync)('find . -maxdepth 3 \\( -name "*.ts" -o -name "*.js" -o -name "*.py" -o -name "*.go" -o -name "*.rs" -o -name "*.swift" -o -name "*.java" \\) 2>/dev/null | grep -v node_modules | grep -v .git | head -5', {
|
|
168
|
+
cwd,
|
|
169
|
+
encoding: 'utf-8',
|
|
170
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
171
|
+
});
|
|
172
|
+
hasCode = files.trim().length > 0;
|
|
173
|
+
}
|
|
174
|
+
catch { }
|
|
175
|
+
hasPackageFile = (0, core_cjs_1.pathExistsInternal)(cwd, 'package.json') ||
|
|
176
|
+
(0, core_cjs_1.pathExistsInternal)(cwd, 'requirements.txt') ||
|
|
177
|
+
(0, core_cjs_1.pathExistsInternal)(cwd, 'Cargo.toml') ||
|
|
178
|
+
(0, core_cjs_1.pathExistsInternal)(cwd, 'go.mod') ||
|
|
179
|
+
(0, core_cjs_1.pathExistsInternal)(cwd, 'Package.swift');
|
|
180
|
+
const result = {
|
|
181
|
+
// Models
|
|
182
|
+
researcher_model: (0, core_cjs_1.resolveModelInternal)(cwd, 'vector-project-researcher'),
|
|
183
|
+
synthesizer_model: (0, core_cjs_1.resolveModelInternal)(cwd, 'vector-research-synthesizer'),
|
|
184
|
+
roadmapper_model: (0, core_cjs_1.resolveModelInternal)(cwd, 'vector-roadmapper'),
|
|
185
|
+
// Config
|
|
186
|
+
commit_docs: config.commit_docs,
|
|
187
|
+
// Existing state
|
|
188
|
+
project_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning/PROJECT.md'),
|
|
189
|
+
has_codebase_map: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning/codebase'),
|
|
190
|
+
planning_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning'),
|
|
191
|
+
// Brownfield detection
|
|
192
|
+
has_existing_code: hasCode,
|
|
193
|
+
has_package_file: hasPackageFile,
|
|
194
|
+
is_brownfield: hasCode || hasPackageFile,
|
|
195
|
+
needs_codebase_map: (hasCode || hasPackageFile) && !(0, core_cjs_1.pathExistsInternal)(cwd, '.planning/codebase'),
|
|
196
|
+
// Git state
|
|
197
|
+
has_git: (0, core_cjs_1.pathExistsInternal)(cwd, '.git'),
|
|
198
|
+
// Enhanced search
|
|
199
|
+
brave_search_available: hasBraveSearch,
|
|
200
|
+
// File paths
|
|
201
|
+
project_path: '.planning/PROJECT.md',
|
|
202
|
+
};
|
|
203
|
+
(0, core_cjs_1.output)(result, raw);
|
|
204
|
+
}
|
|
205
|
+
function cmdInitNewMilestone(cwd, raw) {
|
|
206
|
+
const config = (0, core_cjs_1.loadConfig)(cwd);
|
|
207
|
+
const milestone = (0, core_cjs_1.getMilestoneInfo)(cwd);
|
|
208
|
+
const result = {
|
|
209
|
+
// Models
|
|
210
|
+
researcher_model: (0, core_cjs_1.resolveModelInternal)(cwd, 'vector-project-researcher'),
|
|
211
|
+
synthesizer_model: (0, core_cjs_1.resolveModelInternal)(cwd, 'vector-research-synthesizer'),
|
|
212
|
+
roadmapper_model: (0, core_cjs_1.resolveModelInternal)(cwd, 'vector-roadmapper'),
|
|
213
|
+
// Config
|
|
214
|
+
commit_docs: config.commit_docs,
|
|
215
|
+
research_enabled: config.research,
|
|
216
|
+
// Current milestone
|
|
217
|
+
current_milestone: milestone.version,
|
|
218
|
+
current_milestone_name: milestone.name,
|
|
219
|
+
// File existence
|
|
220
|
+
project_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning/PROJECT.md'),
|
|
221
|
+
roadmap_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning/ROADMAP.md'),
|
|
222
|
+
state_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning/STATE.md'),
|
|
223
|
+
// File paths
|
|
224
|
+
project_path: '.planning/PROJECT.md',
|
|
225
|
+
roadmap_path: '.planning/ROADMAP.md',
|
|
226
|
+
state_path: '.planning/STATE.md',
|
|
227
|
+
};
|
|
228
|
+
(0, core_cjs_1.output)(result, raw);
|
|
229
|
+
}
|
|
230
|
+
function cmdInitQuick(cwd, description, raw) {
|
|
231
|
+
const config = (0, core_cjs_1.loadConfig)(cwd);
|
|
232
|
+
const now = new Date();
|
|
233
|
+
const slug = description ? (0, core_cjs_1.generateSlugInternal)(description)?.substring(0, 40) : null;
|
|
234
|
+
// Generate collision-resistant quick task ID: YYMMDD-xxx
|
|
235
|
+
// xxx = 2-second precision blocks since midnight, encoded as 3-char Base36 (lowercase)
|
|
236
|
+
// Range: 000 (00:00:00) to xbz (23:59:58), guaranteed 3 chars for any time of day.
|
|
237
|
+
// Provides ~2s uniqueness window per user — practically collision-free across a team.
|
|
238
|
+
const yy = String(now.getFullYear()).slice(-2);
|
|
239
|
+
const mm = String(now.getMonth() + 1).padStart(2, '0');
|
|
240
|
+
const dd = String(now.getDate()).padStart(2, '0');
|
|
241
|
+
const dateStr = yy + mm + dd;
|
|
242
|
+
const secondsSinceMidnight = now.getHours() * 3600 + now.getMinutes() * 60 + now.getSeconds();
|
|
243
|
+
const timeBlocks = Math.floor(secondsSinceMidnight / 2);
|
|
244
|
+
const timeEncoded = timeBlocks.toString(36).padStart(3, '0');
|
|
245
|
+
const quickId = dateStr + '-' + timeEncoded;
|
|
246
|
+
const result = {
|
|
247
|
+
// Models
|
|
248
|
+
planner_model: (0, core_cjs_1.resolveModelInternal)(cwd, 'vector-planner'),
|
|
249
|
+
executor_model: (0, core_cjs_1.resolveModelInternal)(cwd, 'vector-executor'),
|
|
250
|
+
checker_model: (0, core_cjs_1.resolveModelInternal)(cwd, 'vector-plan-checker'),
|
|
251
|
+
verifier_model: (0, core_cjs_1.resolveModelInternal)(cwd, 'vector-verifier'),
|
|
252
|
+
// Config
|
|
253
|
+
commit_docs: config.commit_docs,
|
|
254
|
+
// Quick task info
|
|
255
|
+
quick_id: quickId,
|
|
256
|
+
slug: slug,
|
|
257
|
+
description: description || null,
|
|
258
|
+
// Timestamps
|
|
259
|
+
date: now.toISOString().split('T')[0],
|
|
260
|
+
timestamp: now.toISOString(),
|
|
261
|
+
// Paths
|
|
262
|
+
quick_dir: '.planning/quick',
|
|
263
|
+
task_dir: slug ? `.planning/quick/${quickId}-${slug}` : null,
|
|
264
|
+
// File existence
|
|
265
|
+
roadmap_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning/ROADMAP.md'),
|
|
266
|
+
planning_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning'),
|
|
267
|
+
};
|
|
268
|
+
(0, core_cjs_1.output)(result, raw);
|
|
269
|
+
}
|
|
270
|
+
function cmdInitResume(cwd, raw) {
|
|
271
|
+
const config = (0, core_cjs_1.loadConfig)(cwd);
|
|
272
|
+
// Check for interrupted agent
|
|
273
|
+
let interruptedAgentId = null;
|
|
274
|
+
try {
|
|
275
|
+
interruptedAgentId = fs_1.default.readFileSync(path_1.default.join(cwd, '.planning', 'current-agent-id.txt'), 'utf-8').trim();
|
|
276
|
+
}
|
|
277
|
+
catch { }
|
|
278
|
+
const result = {
|
|
279
|
+
// File existence
|
|
280
|
+
state_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning/STATE.md'),
|
|
281
|
+
roadmap_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning/ROADMAP.md'),
|
|
282
|
+
project_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning/PROJECT.MD'),
|
|
283
|
+
planning_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning'),
|
|
284
|
+
// File paths
|
|
285
|
+
state_path: '.planning/STATE.md',
|
|
286
|
+
roadmap_path: '.planning/ROADMAP.md',
|
|
287
|
+
project_path: '.planning/PROJECT.md',
|
|
288
|
+
// Agent state
|
|
289
|
+
has_interrupted_agent: !!interruptedAgentId,
|
|
290
|
+
interrupted_agent_id: interruptedAgentId,
|
|
291
|
+
// Config
|
|
292
|
+
commit_docs: config.commit_docs,
|
|
293
|
+
};
|
|
294
|
+
(0, core_cjs_1.output)(result, raw);
|
|
295
|
+
}
|
|
296
|
+
function cmdInitVerifyWork(cwd, phase, raw) {
|
|
297
|
+
if (!phase) {
|
|
298
|
+
(0, core_cjs_1.error)('phase required for init verify-work');
|
|
299
|
+
}
|
|
300
|
+
const config = (0, core_cjs_1.loadConfig)(cwd);
|
|
301
|
+
const phaseInfo = (0, core_cjs_1.findPhaseInternal)(cwd, phase);
|
|
302
|
+
const result = {
|
|
303
|
+
// Models
|
|
304
|
+
planner_model: (0, core_cjs_1.resolveModelInternal)(cwd, 'vector-planner'),
|
|
305
|
+
checker_model: (0, core_cjs_1.resolveModelInternal)(cwd, 'vector-plan-checker'),
|
|
306
|
+
// Config
|
|
307
|
+
commit_docs: config.commit_docs,
|
|
308
|
+
// Phase info
|
|
309
|
+
phase_found: !!phaseInfo,
|
|
310
|
+
phase_dir: phaseInfo?.directory || null,
|
|
311
|
+
phase_number: phaseInfo?.phase_number || null,
|
|
312
|
+
phase_name: phaseInfo?.phase_name || null,
|
|
313
|
+
// Existing artifacts
|
|
314
|
+
has_verification: phaseInfo?.has_verification || false,
|
|
315
|
+
};
|
|
316
|
+
(0, core_cjs_1.output)(result, raw);
|
|
317
|
+
}
|
|
318
|
+
function cmdInitPhaseOp(cwd, phase, raw) {
|
|
319
|
+
const config = (0, core_cjs_1.loadConfig)(cwd);
|
|
320
|
+
let phaseInfo = (0, core_cjs_1.findPhaseInternal)(cwd, phase);
|
|
321
|
+
// If the only disk match comes from an archived milestone, prefer the
|
|
322
|
+
// current milestone's ROADMAP entry so discuss-phase and similar flows
|
|
323
|
+
// don't attach to shipped work that reused the same phase number.
|
|
324
|
+
if (phaseInfo?.archived) {
|
|
325
|
+
const roadmapPhase = (0, core_cjs_1.getRoadmapPhaseInternal)(cwd, phase);
|
|
326
|
+
if (roadmapPhase?.found) {
|
|
327
|
+
const phaseName = roadmapPhase.phase_name;
|
|
328
|
+
phaseInfo = {
|
|
329
|
+
found: true,
|
|
330
|
+
directory: null,
|
|
331
|
+
phase_number: roadmapPhase.phase_number,
|
|
332
|
+
phase_name: phaseName,
|
|
333
|
+
phase_slug: phaseName ? phaseName.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '') : null,
|
|
334
|
+
plans: [],
|
|
335
|
+
summaries: [],
|
|
336
|
+
incomplete_plans: [],
|
|
337
|
+
has_research: false,
|
|
338
|
+
has_context: false,
|
|
339
|
+
has_verification: false,
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
// Fallback to ROADMAP.md if no directory exists (e.g., Plans: TBD)
|
|
344
|
+
if (!phaseInfo) {
|
|
345
|
+
const roadmapPhase = (0, core_cjs_1.getRoadmapPhaseInternal)(cwd, phase);
|
|
346
|
+
if (roadmapPhase?.found) {
|
|
347
|
+
const phaseName = roadmapPhase.phase_name;
|
|
348
|
+
phaseInfo = {
|
|
349
|
+
found: true,
|
|
350
|
+
directory: null,
|
|
351
|
+
phase_number: roadmapPhase.phase_number,
|
|
352
|
+
phase_name: phaseName,
|
|
353
|
+
phase_slug: phaseName ? phaseName.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '') : null,
|
|
354
|
+
plans: [],
|
|
355
|
+
summaries: [],
|
|
356
|
+
incomplete_plans: [],
|
|
357
|
+
has_research: false,
|
|
358
|
+
has_context: false,
|
|
359
|
+
has_verification: false,
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
const result = {
|
|
364
|
+
// Config
|
|
365
|
+
commit_docs: config.commit_docs,
|
|
366
|
+
brave_search: config.brave_search,
|
|
367
|
+
// Phase info
|
|
368
|
+
phase_found: !!phaseInfo,
|
|
369
|
+
phase_dir: phaseInfo?.directory || null,
|
|
370
|
+
phase_number: phaseInfo?.phase_number || null,
|
|
371
|
+
phase_name: phaseInfo?.phase_name || null,
|
|
372
|
+
phase_slug: phaseInfo?.phase_slug || null,
|
|
373
|
+
padded_phase: phaseInfo?.phase_number ? (0, core_cjs_1.normalizePhaseName)(phaseInfo.phase_number) : null,
|
|
374
|
+
// Existing artifacts
|
|
375
|
+
has_research: phaseInfo?.has_research || false,
|
|
376
|
+
has_context: phaseInfo?.has_context || false,
|
|
377
|
+
has_plans: (phaseInfo?.plans?.length || 0) > 0,
|
|
378
|
+
has_verification: phaseInfo?.has_verification || false,
|
|
379
|
+
plan_count: phaseInfo?.plans?.length || 0,
|
|
380
|
+
// File existence
|
|
381
|
+
roadmap_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning/ROADMAP.md'),
|
|
382
|
+
planning_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning'),
|
|
383
|
+
// File paths
|
|
384
|
+
state_path: '.planning/STATE.md',
|
|
385
|
+
roadmap_path: '.planning/ROADMAP.md',
|
|
386
|
+
requirements_path: '.planning/REQUIREMENTS.md',
|
|
387
|
+
};
|
|
388
|
+
if (phaseInfo?.directory) {
|
|
389
|
+
const phaseDirFull = path_1.default.join(cwd, phaseInfo.directory);
|
|
390
|
+
try {
|
|
391
|
+
const files = fs_1.default.readdirSync(phaseDirFull);
|
|
392
|
+
const contextFile = files.find(f => f.endsWith('-CONTEXT.md') || f === 'CONTEXT.md');
|
|
393
|
+
if (contextFile) {
|
|
394
|
+
result.context_path = (0, core_cjs_1.toPosixPath)(path_1.default.join(phaseInfo.directory, contextFile));
|
|
395
|
+
}
|
|
396
|
+
const researchFile = files.find(f => f.endsWith('-RESEARCH.md') || f === 'RESEARCH.md');
|
|
397
|
+
if (researchFile) {
|
|
398
|
+
result.research_path = (0, core_cjs_1.toPosixPath)(path_1.default.join(phaseInfo.directory, researchFile));
|
|
399
|
+
}
|
|
400
|
+
const verificationFile = files.find(f => f.endsWith('-VERIFICATION.md') || f === 'VERIFICATION.md');
|
|
401
|
+
if (verificationFile) {
|
|
402
|
+
result.verification_path = (0, core_cjs_1.toPosixPath)(path_1.default.join(phaseInfo.directory, verificationFile));
|
|
403
|
+
}
|
|
404
|
+
const uatFile = files.find(f => f.endsWith('-UAT.md') || f === 'UAT.md');
|
|
405
|
+
if (uatFile) {
|
|
406
|
+
result.uat_path = (0, core_cjs_1.toPosixPath)(path_1.default.join(phaseInfo.directory, uatFile));
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
catch { }
|
|
410
|
+
}
|
|
411
|
+
(0, core_cjs_1.output)(result, raw);
|
|
412
|
+
}
|
|
413
|
+
function cmdInitTodos(cwd, area, raw) {
|
|
414
|
+
const config = (0, core_cjs_1.loadConfig)(cwd);
|
|
415
|
+
const now = new Date();
|
|
416
|
+
// List todos (reuse existing logic)
|
|
417
|
+
const pendingDir = path_1.default.join(cwd, '.planning', 'todos', 'pending');
|
|
418
|
+
let count = 0;
|
|
419
|
+
const todos = [];
|
|
420
|
+
try {
|
|
421
|
+
const files = fs_1.default.readdirSync(pendingDir).filter(f => f.endsWith('.md'));
|
|
422
|
+
for (const file of files) {
|
|
423
|
+
try {
|
|
424
|
+
const content = fs_1.default.readFileSync(path_1.default.join(pendingDir, file), 'utf-8');
|
|
425
|
+
const createdMatch = content.match(/^created:\s*(.+)$/m);
|
|
426
|
+
const titleMatch = content.match(/^title:\s*(.+)$/m);
|
|
427
|
+
const areaMatch = content.match(/^area:\s*(.+)$/m);
|
|
428
|
+
const todoArea = areaMatch ? areaMatch[1].trim() : 'general';
|
|
429
|
+
if (area && todoArea !== area)
|
|
430
|
+
continue;
|
|
431
|
+
count++;
|
|
432
|
+
todos.push({
|
|
433
|
+
file,
|
|
434
|
+
created: createdMatch ? createdMatch[1].trim() : 'unknown',
|
|
435
|
+
title: titleMatch ? titleMatch[1].trim() : 'Untitled',
|
|
436
|
+
area: todoArea,
|
|
437
|
+
path: '.planning/todos/pending/' + file,
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
catch { }
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
catch { }
|
|
444
|
+
const result = {
|
|
445
|
+
// Config
|
|
446
|
+
commit_docs: config.commit_docs,
|
|
447
|
+
// Timestamps
|
|
448
|
+
date: now.toISOString().split('T')[0],
|
|
449
|
+
timestamp: now.toISOString(),
|
|
450
|
+
// Todo inventory
|
|
451
|
+
todo_count: count,
|
|
452
|
+
todos,
|
|
453
|
+
area_filter: area || null,
|
|
454
|
+
// Paths
|
|
455
|
+
pending_dir: '.planning/todos/pending',
|
|
456
|
+
completed_dir: '.planning/todos/completed',
|
|
457
|
+
// File existence
|
|
458
|
+
planning_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning'),
|
|
459
|
+
todos_dir_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning/todos'),
|
|
460
|
+
pending_dir_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning/todos/pending'),
|
|
461
|
+
};
|
|
462
|
+
(0, core_cjs_1.output)(result, raw);
|
|
463
|
+
}
|
|
464
|
+
function cmdInitMilestoneOp(cwd, raw) {
|
|
465
|
+
const config = (0, core_cjs_1.loadConfig)(cwd);
|
|
466
|
+
const milestone = (0, core_cjs_1.getMilestoneInfo)(cwd);
|
|
467
|
+
// Count phases
|
|
468
|
+
let phaseCount = 0;
|
|
469
|
+
let completedPhases = 0;
|
|
470
|
+
const phasesDir = path_1.default.join(cwd, '.planning', 'phases');
|
|
471
|
+
try {
|
|
472
|
+
const entries = fs_1.default.readdirSync(phasesDir, { withFileTypes: true });
|
|
473
|
+
const dirs = entries.filter(e => e.isDirectory()).map(e => e.name);
|
|
474
|
+
phaseCount = dirs.length;
|
|
475
|
+
// Count phases with summaries (completed)
|
|
476
|
+
for (const dir of dirs) {
|
|
477
|
+
try {
|
|
478
|
+
const phaseFiles = fs_1.default.readdirSync(path_1.default.join(phasesDir, dir));
|
|
479
|
+
const hasSummary = phaseFiles.some(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md');
|
|
480
|
+
if (hasSummary)
|
|
481
|
+
completedPhases++;
|
|
482
|
+
}
|
|
483
|
+
catch { }
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
catch { }
|
|
487
|
+
// Check archive
|
|
488
|
+
const archiveDir = path_1.default.join(cwd, '.planning', 'archive');
|
|
489
|
+
let archivedMilestones = [];
|
|
490
|
+
try {
|
|
491
|
+
archivedMilestones = fs_1.default.readdirSync(archiveDir, { withFileTypes: true })
|
|
492
|
+
.filter(e => e.isDirectory())
|
|
493
|
+
.map(e => e.name);
|
|
494
|
+
}
|
|
495
|
+
catch { }
|
|
496
|
+
const result = {
|
|
497
|
+
// Config
|
|
498
|
+
commit_docs: config.commit_docs,
|
|
499
|
+
// Current milestone
|
|
500
|
+
milestone_version: milestone.version,
|
|
501
|
+
milestone_name: milestone.name,
|
|
502
|
+
milestone_slug: (0, core_cjs_1.generateSlugInternal)(milestone.name),
|
|
503
|
+
// Phase counts
|
|
504
|
+
phase_count: phaseCount,
|
|
505
|
+
completed_phases: completedPhases,
|
|
506
|
+
all_phases_complete: phaseCount > 0 && phaseCount === completedPhases,
|
|
507
|
+
// Archive
|
|
508
|
+
archived_milestones: archivedMilestones,
|
|
509
|
+
archive_count: archivedMilestones.length,
|
|
510
|
+
// File existence
|
|
511
|
+
project_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning/PROJECT.md'),
|
|
512
|
+
roadmap_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning/ROADMAP.md'),
|
|
513
|
+
state_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning/STATE.md'),
|
|
514
|
+
archive_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning/archive'),
|
|
515
|
+
phases_dir_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning/phases'),
|
|
516
|
+
};
|
|
517
|
+
(0, core_cjs_1.output)(result, raw);
|
|
518
|
+
}
|
|
519
|
+
function cmdInitMapCodebase(cwd, raw) {
|
|
520
|
+
const config = (0, core_cjs_1.loadConfig)(cwd);
|
|
521
|
+
// Check for existing codebase maps
|
|
522
|
+
const codebaseDir = path_1.default.join(cwd, '.planning', 'codebase');
|
|
523
|
+
let existingMaps = [];
|
|
524
|
+
try {
|
|
525
|
+
existingMaps = fs_1.default.readdirSync(codebaseDir).filter(f => f.endsWith('.md'));
|
|
526
|
+
}
|
|
527
|
+
catch { }
|
|
528
|
+
const result = {
|
|
529
|
+
// Models
|
|
530
|
+
mapper_model: (0, core_cjs_1.resolveModelInternal)(cwd, 'vector-codebase-mapper'),
|
|
531
|
+
// Config
|
|
532
|
+
commit_docs: config.commit_docs,
|
|
533
|
+
search_gitignored: config.search_gitignored,
|
|
534
|
+
parallelization: config.parallelization,
|
|
535
|
+
// Paths
|
|
536
|
+
codebase_dir: '.planning/codebase',
|
|
537
|
+
// Existing maps
|
|
538
|
+
existing_maps: existingMaps,
|
|
539
|
+
has_maps: existingMaps.length > 0,
|
|
540
|
+
// File existence
|
|
541
|
+
planning_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning'),
|
|
542
|
+
codebase_dir_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning/codebase'),
|
|
543
|
+
};
|
|
544
|
+
(0, core_cjs_1.output)(result, raw);
|
|
545
|
+
}
|
|
546
|
+
function cmdInitProgress(cwd, raw) {
|
|
547
|
+
const config = (0, core_cjs_1.loadConfig)(cwd);
|
|
548
|
+
const milestone = (0, core_cjs_1.getMilestoneInfo)(cwd);
|
|
549
|
+
// Analyze phases — filter to current milestone and include ROADMAP-only phases
|
|
550
|
+
const phasesDir = path_1.default.join(cwd, '.planning', 'phases');
|
|
551
|
+
const phases = [];
|
|
552
|
+
let currentPhase = null;
|
|
553
|
+
let nextPhase = null;
|
|
554
|
+
// Build set of phases defined in ROADMAP for the current milestone
|
|
555
|
+
const roadmapPhaseNums = new Set();
|
|
556
|
+
const roadmapPhaseNames = new Map();
|
|
557
|
+
try {
|
|
558
|
+
const roadmapContent = (0, core_cjs_1.stripShippedMilestones)(fs_1.default.readFileSync(path_1.default.join(cwd, '.planning', 'ROADMAP.md'), 'utf-8'));
|
|
559
|
+
const headingPattern = /#{2,4}\s*Phase\s+(\d+[A-Z]?(?:\.\d+)*)\s*:\s*([^\n]+)/gi;
|
|
560
|
+
let hm;
|
|
561
|
+
while ((hm = headingPattern.exec(roadmapContent)) !== null) {
|
|
562
|
+
roadmapPhaseNums.add(hm[1]);
|
|
563
|
+
roadmapPhaseNames.set(hm[1], hm[2].replace(/\(INSERTED\)/i, '').trim());
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
catch { }
|
|
567
|
+
const isDirInMilestone = (0, core_cjs_1.getMilestonePhaseFilter)(cwd);
|
|
568
|
+
const seenPhaseNums = new Set();
|
|
569
|
+
try {
|
|
570
|
+
const entries = fs_1.default.readdirSync(phasesDir, { withFileTypes: true });
|
|
571
|
+
const dirs = entries.filter(e => e.isDirectory()).map(e => e.name)
|
|
572
|
+
.filter(isDirInMilestone)
|
|
573
|
+
.sort((a, b) => {
|
|
574
|
+
const pa = a.match(/^(\d+[A-Z]?(?:\.\d+)*)/i);
|
|
575
|
+
const pb = b.match(/^(\d+[A-Z]?(?:\.\d+)*)/i);
|
|
576
|
+
if (!pa || !pb)
|
|
577
|
+
return a.localeCompare(b);
|
|
578
|
+
return parseInt(pa[1], 10) - parseInt(pb[1], 10);
|
|
579
|
+
});
|
|
580
|
+
for (const dir of dirs) {
|
|
581
|
+
const match = dir.match(/^(\d+[A-Z]?(?:\.\d+)*)-?(.*)/i);
|
|
582
|
+
const phaseNumber = match ? match[1] : dir;
|
|
583
|
+
const phaseName = match && match[2] ? match[2] : null;
|
|
584
|
+
seenPhaseNums.add(phaseNumber.replace(/^0+/, '') || '0');
|
|
585
|
+
const phasePath = path_1.default.join(phasesDir, dir);
|
|
586
|
+
const phaseFiles = fs_1.default.readdirSync(phasePath);
|
|
587
|
+
const plans = phaseFiles.filter(f => f.endsWith('-PLAN.md') || f === 'PLAN.md');
|
|
588
|
+
const summaries = phaseFiles.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md');
|
|
589
|
+
const hasResearch = phaseFiles.some(f => f.endsWith('-RESEARCH.md') || f === 'RESEARCH.md');
|
|
590
|
+
const status = summaries.length >= plans.length && plans.length > 0 ? 'complete' :
|
|
591
|
+
plans.length > 0 ? 'in_progress' :
|
|
592
|
+
hasResearch ? 'researched' : 'pending';
|
|
593
|
+
const phaseEntry = {
|
|
594
|
+
number: phaseNumber,
|
|
595
|
+
name: phaseName,
|
|
596
|
+
directory: '.planning/phases/' + dir,
|
|
597
|
+
status,
|
|
598
|
+
plan_count: plans.length,
|
|
599
|
+
summary_count: summaries.length,
|
|
600
|
+
has_research: hasResearch,
|
|
601
|
+
};
|
|
602
|
+
phases.push(phaseEntry);
|
|
603
|
+
// Find current (first incomplete with plans) and next (first pending)
|
|
604
|
+
if (!currentPhase && (status === 'in_progress' || status === 'researched')) {
|
|
605
|
+
currentPhase = phaseEntry;
|
|
606
|
+
}
|
|
607
|
+
if (!nextPhase && status === 'pending') {
|
|
608
|
+
nextPhase = phaseEntry;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
catch { }
|
|
613
|
+
// Add phases defined in ROADMAP but not yet scaffolded to disk
|
|
614
|
+
for (const [num, name] of roadmapPhaseNames) {
|
|
615
|
+
const stripped = num.replace(/^0+/, '') || '0';
|
|
616
|
+
if (!seenPhaseNums.has(stripped)) {
|
|
617
|
+
const phaseEntry = {
|
|
618
|
+
number: num,
|
|
619
|
+
name: name.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, ''),
|
|
620
|
+
directory: null,
|
|
621
|
+
status: 'not_started',
|
|
622
|
+
plan_count: 0,
|
|
623
|
+
summary_count: 0,
|
|
624
|
+
has_research: false,
|
|
625
|
+
};
|
|
626
|
+
phases.push(phaseEntry);
|
|
627
|
+
if (!nextPhase && !currentPhase) {
|
|
628
|
+
nextPhase = phaseEntry;
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
// Re-sort phases by number after adding ROADMAP-only phases
|
|
633
|
+
phases.sort((a, b) => parseInt(a.number, 10) - parseInt(b.number, 10));
|
|
634
|
+
// Check for paused work
|
|
635
|
+
let pausedAt = null;
|
|
636
|
+
try {
|
|
637
|
+
const state = fs_1.default.readFileSync(path_1.default.join(cwd, '.planning', 'STATE.md'), 'utf-8');
|
|
638
|
+
const pauseMatch = state.match(/\*\*Paused At:\*\*\s*(.+)/);
|
|
639
|
+
if (pauseMatch)
|
|
640
|
+
pausedAt = pauseMatch[1].trim();
|
|
641
|
+
}
|
|
642
|
+
catch { }
|
|
643
|
+
const result = {
|
|
644
|
+
// Models
|
|
645
|
+
executor_model: (0, core_cjs_1.resolveModelInternal)(cwd, 'vector-executor'),
|
|
646
|
+
planner_model: (0, core_cjs_1.resolveModelInternal)(cwd, 'vector-planner'),
|
|
647
|
+
// Config
|
|
648
|
+
commit_docs: config.commit_docs,
|
|
649
|
+
// Milestone
|
|
650
|
+
milestone_version: milestone.version,
|
|
651
|
+
milestone_name: milestone.name,
|
|
652
|
+
// Phase overview
|
|
653
|
+
phases,
|
|
654
|
+
phase_count: phases.length,
|
|
655
|
+
completed_count: phases.filter(p => p.status === 'complete').length,
|
|
656
|
+
in_progress_count: phases.filter(p => p.status === 'in_progress').length,
|
|
657
|
+
// Current state
|
|
658
|
+
current_phase: currentPhase,
|
|
659
|
+
next_phase: nextPhase,
|
|
660
|
+
paused_at: pausedAt,
|
|
661
|
+
has_work_in_progress: !!currentPhase,
|
|
662
|
+
// File existence
|
|
663
|
+
project_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning/PROJECT.md'),
|
|
664
|
+
roadmap_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning/ROADMAP.md'),
|
|
665
|
+
state_exists: (0, core_cjs_1.pathExistsInternal)(cwd, '.planning/STATE.md'),
|
|
666
|
+
// File paths
|
|
667
|
+
state_path: '.planning/STATE.md',
|
|
668
|
+
roadmap_path: '.planning/ROADMAP.md',
|
|
669
|
+
project_path: '.planning/PROJECT.md',
|
|
670
|
+
config_path: '.planning/config.json',
|
|
671
|
+
};
|
|
672
|
+
(0, core_cjs_1.output)(result, raw);
|
|
673
|
+
}
|
|
674
|
+
//# sourceMappingURL=init.cjs.map
|