@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.
Files changed (225) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +117 -0
  3. package/agents/vector-codebase-mapper.md +770 -0
  4. package/agents/vector-debugger.md +1338 -0
  5. package/agents/vector-executor.md +487 -0
  6. package/agents/vector-integration-checker.md +443 -0
  7. package/agents/vector-nyquist-auditor.md +176 -0
  8. package/agents/vector-phase-researcher.md +553 -0
  9. package/agents/vector-plan-checker.md +706 -0
  10. package/agents/vector-planner.md +1307 -0
  11. package/agents/vector-project-researcher.md +629 -0
  12. package/agents/vector-research-synthesizer.md +247 -0
  13. package/agents/vector-roadmapper.md +650 -0
  14. package/agents/vector-ui-auditor.md +439 -0
  15. package/agents/vector-ui-checker.md +300 -0
  16. package/agents/vector-ui-researcher.md +353 -0
  17. package/agents/vector-verifier.md +579 -0
  18. package/bin/install.cjs +2907 -0
  19. package/bin/install.cjs.map +1 -0
  20. package/bin/install.cts +3103 -0
  21. package/bin/install.d.cts +3 -0
  22. package/bin/install.d.cts.map +1 -0
  23. package/commands/vector/add-phase.md +43 -0
  24. package/commands/vector/add-tests.md +41 -0
  25. package/commands/vector/add-todo.md +47 -0
  26. package/commands/vector/audit-milestone.md +36 -0
  27. package/commands/vector/autonomous.md +41 -0
  28. package/commands/vector/check-todos.md +45 -0
  29. package/commands/vector/cleanup.md +18 -0
  30. package/commands/vector/complete-milestone.md +136 -0
  31. package/commands/vector/debug.md +168 -0
  32. package/commands/vector/discuss-phase.md +90 -0
  33. package/commands/vector/do.md +30 -0
  34. package/commands/vector/execute-phase.md +41 -0
  35. package/commands/vector/health.md +22 -0
  36. package/commands/vector/help.md +22 -0
  37. package/commands/vector/insert-phase.md +32 -0
  38. package/commands/vector/join-discord.md +18 -0
  39. package/commands/vector/list-phase-assumptions.md +46 -0
  40. package/commands/vector/map-codebase.md +71 -0
  41. package/commands/vector/new-milestone.md +44 -0
  42. package/commands/vector/new-project.md +42 -0
  43. package/commands/vector/pause-work.md +38 -0
  44. package/commands/vector/plan-milestone-gaps.md +34 -0
  45. package/commands/vector/plan-phase.md +45 -0
  46. package/commands/vector/progress.md +24 -0
  47. package/commands/vector/quick.md +47 -0
  48. package/commands/vector/reapply-patches.md +123 -0
  49. package/commands/vector/remove-phase.md +31 -0
  50. package/commands/vector/research-phase.md +190 -0
  51. package/commands/vector/resume-work.md +40 -0
  52. package/commands/vector/set-profile.md +12 -0
  53. package/commands/vector/settings.md +36 -0
  54. package/commands/vector/stats.md +18 -0
  55. package/commands/vector/ui-phase.md +34 -0
  56. package/commands/vector/ui-review.md +32 -0
  57. package/commands/vector/update.md +37 -0
  58. package/commands/vector/validate-phase.md +35 -0
  59. package/commands/vector/verify-work.md +38 -0
  60. package/core/bin/lib/commands.cjs +641 -0
  61. package/core/bin/lib/commands.cjs.map +1 -0
  62. package/core/bin/lib/commands.cts +712 -0
  63. package/core/bin/lib/commands.d.cts +23 -0
  64. package/core/bin/lib/commands.d.cts.map +1 -0
  65. package/core/bin/lib/config.cjs +281 -0
  66. package/core/bin/lib/config.cjs.map +1 -0
  67. package/core/bin/lib/config.cts +301 -0
  68. package/core/bin/lib/config.d.cts +50 -0
  69. package/core/bin/lib/config.d.cts.map +1 -0
  70. package/core/bin/lib/core.cjs +483 -0
  71. package/core/bin/lib/core.cjs.map +1 -0
  72. package/core/bin/lib/core.cts +544 -0
  73. package/core/bin/lib/core.d.cts +96 -0
  74. package/core/bin/lib/core.d.cts.map +1 -0
  75. package/core/bin/lib/frontmatter.cjs +341 -0
  76. package/core/bin/lib/frontmatter.cjs.map +1 -0
  77. package/core/bin/lib/frontmatter.cts +295 -0
  78. package/core/bin/lib/frontmatter.d.cts +18 -0
  79. package/core/bin/lib/frontmatter.d.cts.map +1 -0
  80. package/core/bin/lib/init.cjs +674 -0
  81. package/core/bin/lib/init.cjs.map +1 -0
  82. package/core/bin/lib/init.cts +775 -0
  83. package/core/bin/lib/init.d.cts +16 -0
  84. package/core/bin/lib/init.d.cts.map +1 -0
  85. package/core/bin/lib/milestone.cjs +210 -0
  86. package/core/bin/lib/milestone.cjs.map +1 -0
  87. package/core/bin/lib/milestone.cts +241 -0
  88. package/core/bin/lib/milestone.d.cts +11 -0
  89. package/core/bin/lib/milestone.d.cts.map +1 -0
  90. package/core/bin/lib/model-profiles.cjs +62 -0
  91. package/core/bin/lib/model-profiles.cjs.map +1 -0
  92. package/core/bin/lib/model-profiles.cts +66 -0
  93. package/core/bin/lib/model-profiles.d.cts +33 -0
  94. package/core/bin/lib/model-profiles.d.cts.map +1 -0
  95. package/core/bin/lib/phase.cjs +713 -0
  96. package/core/bin/lib/phase.cjs.map +1 -0
  97. package/core/bin/lib/phase.cts +914 -0
  98. package/core/bin/lib/phase.d.cts +21 -0
  99. package/core/bin/lib/phase.d.cts.map +1 -0
  100. package/core/bin/lib/roadmap.cjs +246 -0
  101. package/core/bin/lib/roadmap.cjs.map +1 -0
  102. package/core/bin/lib/roadmap.cts +311 -0
  103. package/core/bin/lib/roadmap.d.cts +7 -0
  104. package/core/bin/lib/roadmap.d.cts.map +1 -0
  105. package/core/bin/lib/state.cjs +709 -0
  106. package/core/bin/lib/state.cjs.map +1 -0
  107. package/core/bin/lib/state.cts +718 -0
  108. package/core/bin/lib/state.d.cts +47 -0
  109. package/core/bin/lib/state.d.cts.map +1 -0
  110. package/core/bin/lib/template.cjs +220 -0
  111. package/core/bin/lib/template.cjs.map +1 -0
  112. package/core/bin/lib/template.cts +229 -0
  113. package/core/bin/lib/template.d.cts +15 -0
  114. package/core/bin/lib/template.d.cts.map +1 -0
  115. package/core/bin/lib/verify.cjs +824 -0
  116. package/core/bin/lib/verify.cjs.map +1 -0
  117. package/core/bin/lib/verify.cts +829 -0
  118. package/core/bin/lib/verify.d.cts +17 -0
  119. package/core/bin/lib/verify.d.cts.map +1 -0
  120. package/core/bin/vector-tools.cjs +641 -0
  121. package/core/bin/vector-tools.cjs.map +1 -0
  122. package/core/bin/vector-tools.cts +603 -0
  123. package/core/bin/vector-tools.d.cts +128 -0
  124. package/core/bin/vector-tools.d.cts.map +1 -0
  125. package/core/references/checkpoints.md +776 -0
  126. package/core/references/continuation-format.md +249 -0
  127. package/core/references/decimal-phase-calculation.md +65 -0
  128. package/core/references/git-integration.md +248 -0
  129. package/core/references/git-planning-commit.md +38 -0
  130. package/core/references/model-profile-resolution.md +36 -0
  131. package/core/references/model-profiles.md +101 -0
  132. package/core/references/phase-argument-parsing.md +61 -0
  133. package/core/references/planning-config.md +200 -0
  134. package/core/references/questioning.md +162 -0
  135. package/core/references/tdd.md +263 -0
  136. package/core/references/ui-brand.md +160 -0
  137. package/core/references/verification-patterns.md +612 -0
  138. package/core/templates/DEBUG.md +164 -0
  139. package/core/templates/UAT.md +247 -0
  140. package/core/templates/UI-SPEC.md +100 -0
  141. package/core/templates/VALIDATION.md +76 -0
  142. package/core/templates/codebase/architecture.md +255 -0
  143. package/core/templates/codebase/concerns.md +310 -0
  144. package/core/templates/codebase/conventions.md +307 -0
  145. package/core/templates/codebase/integrations.md +280 -0
  146. package/core/templates/codebase/stack.md +186 -0
  147. package/core/templates/codebase/structure.md +285 -0
  148. package/core/templates/codebase/testing.md +480 -0
  149. package/core/templates/config.json +37 -0
  150. package/core/templates/context.md +352 -0
  151. package/core/templates/continue-here.md +78 -0
  152. package/core/templates/copilot-instructions.md +7 -0
  153. package/core/templates/debug-subagent-prompt.md +91 -0
  154. package/core/templates/discovery.md +146 -0
  155. package/core/templates/milestone-archive.md +123 -0
  156. package/core/templates/milestone.md +115 -0
  157. package/core/templates/phase-prompt.md +610 -0
  158. package/core/templates/planner-subagent-prompt.md +117 -0
  159. package/core/templates/project.md +184 -0
  160. package/core/templates/requirements.md +231 -0
  161. package/core/templates/research-project/ARCHITECTURE.md +204 -0
  162. package/core/templates/research-project/FEATURES.md +147 -0
  163. package/core/templates/research-project/PITFALLS.md +200 -0
  164. package/core/templates/research-project/STACK.md +120 -0
  165. package/core/templates/research-project/SUMMARY.md +170 -0
  166. package/core/templates/research.md +552 -0
  167. package/core/templates/retrospective.md +54 -0
  168. package/core/templates/roadmap.md +202 -0
  169. package/core/templates/state.md +176 -0
  170. package/core/templates/summary-complex.md +59 -0
  171. package/core/templates/summary-minimal.md +41 -0
  172. package/core/templates/summary-standard.md +48 -0
  173. package/core/templates/summary.md +248 -0
  174. package/core/templates/user-setup.md +311 -0
  175. package/core/templates/verification-report.md +322 -0
  176. package/core/workflows/add-phase.md +112 -0
  177. package/core/workflows/add-tests.md +351 -0
  178. package/core/workflows/add-todo.md +158 -0
  179. package/core/workflows/audit-milestone.md +332 -0
  180. package/core/workflows/autonomous.md +743 -0
  181. package/core/workflows/check-todos.md +177 -0
  182. package/core/workflows/cleanup.md +152 -0
  183. package/core/workflows/complete-milestone.md +766 -0
  184. package/core/workflows/diagnose-issues.md +219 -0
  185. package/core/workflows/discovery-phase.md +289 -0
  186. package/core/workflows/discuss-phase.md +762 -0
  187. package/core/workflows/do.md +104 -0
  188. package/core/workflows/execute-phase.md +468 -0
  189. package/core/workflows/execute-plan.md +483 -0
  190. package/core/workflows/health.md +159 -0
  191. package/core/workflows/help.md +513 -0
  192. package/core/workflows/insert-phase.md +130 -0
  193. package/core/workflows/list-phase-assumptions.md +178 -0
  194. package/core/workflows/map-codebase.md +316 -0
  195. package/core/workflows/new-milestone.md +386 -0
  196. package/core/workflows/new-project.md +1113 -0
  197. package/core/workflows/node-repair.md +92 -0
  198. package/core/workflows/pause-work.md +122 -0
  199. package/core/workflows/plan-milestone-gaps.md +274 -0
  200. package/core/workflows/plan-phase.md +666 -0
  201. package/core/workflows/progress.md +382 -0
  202. package/core/workflows/quick.md +717 -0
  203. package/core/workflows/remove-phase.md +155 -0
  204. package/core/workflows/research-phase.md +74 -0
  205. package/core/workflows/resume-project.md +307 -0
  206. package/core/workflows/settings.md +243 -0
  207. package/core/workflows/stats.md +60 -0
  208. package/core/workflows/transition.md +544 -0
  209. package/core/workflows/ui-phase.md +290 -0
  210. package/core/workflows/ui-review.md +157 -0
  211. package/core/workflows/update.md +320 -0
  212. package/core/workflows/validate-phase.md +167 -0
  213. package/core/workflows/verify-phase.md +243 -0
  214. package/core/workflows/verify-work.md +584 -0
  215. package/package.json +55 -0
  216. package/scripts/build-hooks.cjs +38 -0
  217. package/scripts/build-hooks.cjs.map +1 -0
  218. package/scripts/build-hooks.cts +41 -0
  219. package/scripts/build-hooks.d.cts +6 -0
  220. package/scripts/build-hooks.d.cts.map +1 -0
  221. package/scripts/run-tests.cjs +28 -0
  222. package/scripts/run-tests.cjs.map +1 -0
  223. package/scripts/run-tests.cts +28 -0
  224. package/scripts/run-tests.d.cts +3 -0
  225. package/scripts/run-tests.d.cts.map +1 -0
@@ -0,0 +1,47 @@
1
+ /**
2
+ * State — STATE.md operations and progression engine
3
+ */
4
+ export declare function stateExtractField(content: string, fieldName: string): string | null;
5
+ export declare function cmdStateLoad(cwd: string, raw: boolean): void;
6
+ export declare function cmdStateGet(cwd: string, section: string | undefined, raw: boolean): void;
7
+ export declare function cmdStatePatch(cwd: string, patches: Record<string, string>, raw: boolean): void;
8
+ export declare function cmdStateUpdate(cwd: string, field: string | undefined, value: string | undefined): void;
9
+ export declare function stateReplaceField(content: string, fieldName: string, newValue: string): string | null;
10
+ export declare function cmdStateAdvancePlan(cwd: string, raw: boolean): void;
11
+ interface RecordMetricOptions {
12
+ phase: string | null;
13
+ plan: string | null;
14
+ duration: string | null;
15
+ tasks?: string | null;
16
+ files?: string | null;
17
+ }
18
+ export declare function cmdStateRecordMetric(cwd: string, options: RecordMetricOptions, raw: boolean): void;
19
+ export declare function cmdStateUpdateProgress(cwd: string, raw: boolean): void;
20
+ interface AddDecisionOptions {
21
+ phase?: string | null;
22
+ summary?: string | null;
23
+ summary_file?: string | null;
24
+ rationale?: string | null;
25
+ rationale_file?: string | null;
26
+ }
27
+ export declare function cmdStateAddDecision(cwd: string, options: AddDecisionOptions, raw: boolean): void;
28
+ interface AddBlockerOptions {
29
+ text?: string | null;
30
+ text_file?: string | null;
31
+ }
32
+ export declare function cmdStateAddBlocker(cwd: string, text: string | AddBlockerOptions, raw: boolean): void;
33
+ export declare function cmdStateResolveBlocker(cwd: string, text: string | null | undefined, raw: boolean): void;
34
+ interface RecordSessionOptions {
35
+ stopped_at?: string | null;
36
+ resume_file?: string | null;
37
+ }
38
+ export declare function cmdStateRecordSession(cwd: string, options: RecordSessionOptions, raw: boolean): void;
39
+ export declare function cmdStateSnapshot(cwd: string, raw: boolean): void;
40
+ /**
41
+ * Write STATE.md with synchronized YAML frontmatter.
42
+ * All STATE.md writes should use this instead of raw writeFileSync.
43
+ */
44
+ export declare function writeStateMd(statePath: string, content: string, cwd: string): void;
45
+ export declare function cmdStateJson(cwd: string, raw: boolean): void;
46
+ export {};
47
+ //# sourceMappingURL=state.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.d.cts","sourceRoot":"","sources":["state.cts"],"names":[],"mappings":"AAAA;;GAEG;AASH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQnF;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,IAAI,CA2C5D;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,OAAO,GAAG,IAAI,CAyCxF;AAaD,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,OAAO,GAAG,IAAI,CA+B9F;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CA0BtG;AAID,wBAAgB,iBAAiB,C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,iBAAiB,EAAE,GAAG,EAAE,OAAO,GAAG,IAAI,CA+BpG;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,GAAG,EAAE,OAAO,GAAG,IAAI,CA8BvG;AAED,UAAU,oBAAoB;IAC5B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,EAAE,GAAG,EAAE,OAAO,GAAG,IAAI,CAiCpG;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,IAAI,CA+FhE;AA8HD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAGlF;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,IAAI,CAkB5D"}
@@ -0,0 +1,220 @@
1
+ "use strict";
2
+ /**
3
+ * Template — Template selection and fill operations
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.cmdTemplateSelect = cmdTemplateSelect;
10
+ exports.cmdTemplateFill = cmdTemplateFill;
11
+ const fs_1 = __importDefault(require("fs"));
12
+ const path_1 = __importDefault(require("path"));
13
+ const core_cjs_1 = require("./core.cjs");
14
+ const frontmatter_cjs_1 = require("./frontmatter.cjs");
15
+ function cmdTemplateSelect(cwd, planPath, raw) {
16
+ if (!planPath) {
17
+ (0, core_cjs_1.error)('plan-path required');
18
+ }
19
+ try {
20
+ const fullPath = path_1.default.join(cwd, planPath);
21
+ const content = fs_1.default.readFileSync(fullPath, 'utf-8');
22
+ // Simple heuristics
23
+ const taskMatch = content.match(/###\s*Task\s*\d+/g) || [];
24
+ const taskCount = taskMatch.length;
25
+ const decisionMatch = content.match(/decision/gi) || [];
26
+ const hasDecisions = decisionMatch.length > 0;
27
+ // Count file mentions
28
+ const fileMentions = new Set();
29
+ const filePattern = /`([^`]+\.[a-zA-Z]+)`/g;
30
+ let m;
31
+ while ((m = filePattern.exec(content)) !== null) {
32
+ if (m[1].includes('/') && !m[1].startsWith('http')) {
33
+ fileMentions.add(m[1]);
34
+ }
35
+ }
36
+ const fileCount = fileMentions.size;
37
+ let template = 'templates/summary-standard.md';
38
+ let type = 'standard';
39
+ if (taskCount <= 2 && fileCount <= 3 && !hasDecisions) {
40
+ template = 'templates/summary-minimal.md';
41
+ type = 'minimal';
42
+ }
43
+ else if (hasDecisions || fileCount > 6 || taskCount > 5) {
44
+ template = 'templates/summary-complex.md';
45
+ type = 'complex';
46
+ }
47
+ const result = { template, type, taskCount, fileCount, hasDecisions };
48
+ (0, core_cjs_1.output)(result, raw, template);
49
+ }
50
+ catch (e) {
51
+ // Fallback to standard
52
+ (0, core_cjs_1.output)({ template: 'templates/summary-standard.md', type: 'standard', error: e.message }, raw, 'templates/summary-standard.md');
53
+ }
54
+ }
55
+ function cmdTemplateFill(cwd, templateType, options, raw) {
56
+ if (!templateType) {
57
+ (0, core_cjs_1.error)('template type required: summary, plan, or verification');
58
+ }
59
+ if (!options.phase) {
60
+ (0, core_cjs_1.error)('--phase required');
61
+ }
62
+ const phaseInfo = (0, core_cjs_1.findPhaseInternal)(cwd, options.phase);
63
+ if (!phaseInfo || !phaseInfo.found) {
64
+ (0, core_cjs_1.output)({ error: 'Phase not found', phase: options.phase }, raw);
65
+ return;
66
+ }
67
+ const padded = (0, core_cjs_1.normalizePhaseName)(options.phase);
68
+ const today = new Date().toISOString().split('T')[0];
69
+ const phaseName = options.name || phaseInfo.phase_name || 'Unnamed';
70
+ const phaseSlug = phaseInfo.phase_slug || (0, core_cjs_1.generateSlugInternal)(phaseName);
71
+ const phaseId = `${padded}-${phaseSlug}`;
72
+ const planNum = (options.plan || '01').padStart(2, '0');
73
+ const fields = options.fields || {};
74
+ let frontmatter, body, fileName;
75
+ switch (templateType) {
76
+ case 'summary': {
77
+ frontmatter = {
78
+ phase: phaseId,
79
+ plan: planNum,
80
+ subsystem: '[primary category]',
81
+ tags: [],
82
+ provides: [],
83
+ affects: [],
84
+ 'tech-stack': { added: [], patterns: [] },
85
+ 'key-files': { created: [], modified: [] },
86
+ 'key-decisions': [],
87
+ 'patterns-established': [],
88
+ duration: '[X]min',
89
+ completed: today,
90
+ ...fields,
91
+ };
92
+ body = [
93
+ `# Phase ${options.phase}: ${phaseName} Summary`,
94
+ '',
95
+ '**[Substantive one-liner describing outcome]**',
96
+ '',
97
+ '## Performance',
98
+ '- **Duration:** [time]',
99
+ '- **Tasks:** [count completed]',
100
+ '- **Files modified:** [count]',
101
+ '',
102
+ '## Accomplishments',
103
+ '- [Key outcome 1]',
104
+ '- [Key outcome 2]',
105
+ '',
106
+ '## Task Commits',
107
+ '1. **Task 1: [task name]** - `hash`',
108
+ '',
109
+ '## Files Created/Modified',
110
+ '- `path/to/file.ts` - What it does',
111
+ '',
112
+ '## Decisions & Deviations',
113
+ '[Key decisions or "None - followed plan as specified"]',
114
+ '',
115
+ '## Next Phase Readiness',
116
+ '[What\'s ready for next phase]',
117
+ ].join('\n');
118
+ fileName = `${padded}-${planNum}-SUMMARY.md`;
119
+ break;
120
+ }
121
+ case 'plan': {
122
+ const planType = options.type || 'execute';
123
+ const wave = parseInt(options.wave || '1') || 1;
124
+ frontmatter = {
125
+ phase: phaseId,
126
+ plan: planNum,
127
+ type: planType,
128
+ wave,
129
+ depends_on: [],
130
+ files_modified: [],
131
+ autonomous: true,
132
+ user_setup: [],
133
+ must_haves: { truths: [], artifacts: [], key_links: [] },
134
+ ...fields,
135
+ };
136
+ body = [
137
+ `# Phase ${options.phase} Plan ${planNum}: [Title]`,
138
+ '',
139
+ '## Objective',
140
+ '- **What:** [What this plan builds]',
141
+ '- **Why:** [Why it matters for the phase goal]',
142
+ '- **Output:** [Concrete deliverable]',
143
+ '',
144
+ '## Context',
145
+ '@.planning/PROJECT.md',
146
+ '@.planning/ROADMAP.md',
147
+ '@.planning/STATE.md',
148
+ '',
149
+ '## Tasks',
150
+ '',
151
+ '<task type="code">',
152
+ ' <name>[Task name]</name>',
153
+ ' <files>[file paths]</files>',
154
+ ' <action>[What to do]</action>',
155
+ ' <verify>[How to verify]</verify>',
156
+ ' <done>[Definition of done]</done>',
157
+ '</task>',
158
+ '',
159
+ '## Verification',
160
+ '[How to verify this plan achieved its objective]',
161
+ '',
162
+ '## Success Criteria',
163
+ '- [ ] [Criterion 1]',
164
+ '- [ ] [Criterion 2]',
165
+ ].join('\n');
166
+ fileName = `${padded}-${planNum}-PLAN.md`;
167
+ break;
168
+ }
169
+ case 'verification': {
170
+ frontmatter = {
171
+ phase: phaseId,
172
+ verified: new Date().toISOString(),
173
+ status: 'pending',
174
+ score: '0/0 must-haves verified',
175
+ ...fields,
176
+ };
177
+ body = [
178
+ `# Phase ${options.phase}: ${phaseName} — Verification`,
179
+ '',
180
+ '## Observable Truths',
181
+ '| # | Truth | Status | Evidence |',
182
+ '|---|-------|--------|----------|',
183
+ '| 1 | [Truth] | pending | |',
184
+ '',
185
+ '## Required Artifacts',
186
+ '| Artifact | Expected | Status | Details |',
187
+ '|----------|----------|--------|---------|',
188
+ '| [path] | [what] | pending | |',
189
+ '',
190
+ '## Key Link Verification',
191
+ '| From | To | Via | Status | Details |',
192
+ '|------|----|----|--------|---------|',
193
+ '| [source] | [target] | [connection] | pending | |',
194
+ '',
195
+ '## Requirements Coverage',
196
+ '| Requirement | Status | Blocking Issue |',
197
+ '|-------------|--------|----------------|',
198
+ '| [req] | pending | |',
199
+ '',
200
+ '## Result',
201
+ '[Pending verification]',
202
+ ].join('\n');
203
+ fileName = `${padded}-VERIFICATION.md`;
204
+ break;
205
+ }
206
+ default:
207
+ (0, core_cjs_1.error)(`Unknown template type: ${templateType}. Available: summary, plan, verification`);
208
+ return;
209
+ }
210
+ const fullContent = `---\n${(0, frontmatter_cjs_1.reconstructFrontmatter)(frontmatter)}\n---\n\n${body}\n`;
211
+ const outPath = path_1.default.join(cwd, phaseInfo.directory, fileName);
212
+ if (fs_1.default.existsSync(outPath)) {
213
+ (0, core_cjs_1.output)({ error: 'File already exists', path: (0, core_cjs_1.toPosixPath)(path_1.default.relative(cwd, outPath)) }, raw);
214
+ return;
215
+ }
216
+ fs_1.default.writeFileSync(outPath, fullContent, 'utf-8');
217
+ const relPath = (0, core_cjs_1.toPosixPath)(path_1.default.relative(cwd, outPath));
218
+ (0, core_cjs_1.output)({ created: true, path: relPath, template: templateType }, raw, relPath);
219
+ }
220
+ //# sourceMappingURL=template.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.cjs","sourceRoot":"","sources":["template.cts"],"names":[],"mappings":";AAAA;;GAEG;;;;;AAOH,8CA4CC;AAWD,0CAoKC;AAhOD,4CAAoB;AACpB,gDAAwB;AACxB,yCAAqH;AACrH,uDAA2D;AAE3D,SAAgB,iBAAiB,CAAC,GAAW,EAAE,QAA4B,EAAE,GAAY;IACvF,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,IAAA,gBAAK,EAAC,oBAAoB,CAAC,CAAC;IAC9B,CAAC;IAED,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAS,CAAC,CAAC;QAC3C,MAAM,OAAO,GAAG,YAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAEnD,oBAAoB;QACpB,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,mBAAmB,CAAC,IAAI,EAAE,CAAC;QAC3D,MAAM,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC;QAEnC,MAAM,aAA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IAAA,sBAAW,EAAC,cAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;IACzD,IAAA,iBAAM,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;AACjF,CAAC"}
@@ -0,0 +1,229 @@
1
+ /**
2
+ * Template — Template selection and fill operations
3
+ */
4
+
5
+ import fs from 'fs';
6
+ import path from 'path';
7
+ import { normalizePhaseName, findPhaseInternal, generateSlugInternal, toPosixPath, output, error } from './core.cjs';
8
+ import { reconstructFrontmatter } from './frontmatter.cjs';
9
+
10
+ export function cmdTemplateSelect(cwd: string, planPath: string | undefined, raw: boolean): void {
11
+ if (!planPath) {
12
+ error('plan-path required');
13
+ }
14
+
15
+ try {
16
+ const fullPath = path.join(cwd, planPath!);
17
+ const content = fs.readFileSync(fullPath, 'utf-8');
18
+
19
+ // Simple heuristics
20
+ const taskMatch = content.match(/###\s*Task\s*\d+/g) || [];
21
+ const taskCount = taskMatch.length;
22
+
23
+ const decisionMatch = content.match(/decision/gi) || [];
24
+ const hasDecisions = decisionMatch.length > 0;
25
+
26
+ // Count file mentions
27
+ const fileMentions = new Set<string>();
28
+ const filePattern = /`([^`]+\.[a-zA-Z]+)`/g;
29
+ let m: RegExpExecArray | null;
30
+ while ((m = filePattern.exec(content)) !== null) {
31
+ if (m[1].includes('/') && !m[1].startsWith('http')) {
32
+ fileMentions.add(m[1]);
33
+ }
34
+ }
35
+ const fileCount = fileMentions.size;
36
+
37
+ let template = 'templates/summary-standard.md';
38
+ let type = 'standard';
39
+
40
+ if (taskCount <= 2 && fileCount <= 3 && !hasDecisions) {
41
+ template = 'templates/summary-minimal.md';
42
+ type = 'minimal';
43
+ } else if (hasDecisions || fileCount > 6 || taskCount > 5) {
44
+ template = 'templates/summary-complex.md';
45
+ type = 'complex';
46
+ }
47
+
48
+ const result = { template, type, taskCount, fileCount, hasDecisions };
49
+ output(result, raw, template);
50
+ } catch (e) {
51
+ // Fallback to standard
52
+ output({ template: 'templates/summary-standard.md', type: 'standard', error: (e as Error).message }, raw, 'templates/summary-standard.md');
53
+ }
54
+ }
55
+
56
+ interface TemplateFillOptions {
57
+ phase: string | null;
58
+ plan?: string | null;
59
+ name?: string | null;
60
+ type?: string | null;
61
+ wave?: string | null;
62
+ fields?: Record<string, unknown>;
63
+ }
64
+
65
+ export function cmdTemplateFill(cwd: string, templateType: string | undefined, options: TemplateFillOptions, raw: boolean): void {
66
+ if (!templateType) { error('template type required: summary, plan, or verification'); }
67
+ if (!options.phase) { error('--phase required'); }
68
+
69
+ const phaseInfo = findPhaseInternal(cwd, options.phase);
70
+ if (!phaseInfo || !phaseInfo.found) { output({ error: 'Phase not found', phase: options.phase }, raw); return; }
71
+
72
+ const padded = normalizePhaseName(options.phase);
73
+ const today = new Date().toISOString().split('T')[0];
74
+ const phaseName = options.name || phaseInfo.phase_name || 'Unnamed';
75
+ const phaseSlug = phaseInfo.phase_slug || generateSlugInternal(phaseName);
76
+ const phaseId = `${padded}-${phaseSlug}`;
77
+ const planNum = (options.plan || '01').padStart(2, '0');
78
+ const fields = options.fields || {};
79
+
80
+ let frontmatter: Record<string, unknown>, body: string, fileName: string;
81
+
82
+ switch (templateType) {
83
+ case 'summary': {
84
+ frontmatter = {
85
+ phase: phaseId,
86
+ plan: planNum,
87
+ subsystem: '[primary category]',
88
+ tags: [],
89
+ provides: [],
90
+ affects: [],
91
+ 'tech-stack': { added: [], patterns: [] },
92
+ 'key-files': { created: [], modified: [] },
93
+ 'key-decisions': [],
94
+ 'patterns-established': [],
95
+ duration: '[X]min',
96
+ completed: today,
97
+ ...fields,
98
+ };
99
+ body = [
100
+ `# Phase ${options.phase}: ${phaseName} Summary`,
101
+ '',
102
+ '**[Substantive one-liner describing outcome]**',
103
+ '',
104
+ '## Performance',
105
+ '- **Duration:** [time]',
106
+ '- **Tasks:** [count completed]',
107
+ '- **Files modified:** [count]',
108
+ '',
109
+ '## Accomplishments',
110
+ '- [Key outcome 1]',
111
+ '- [Key outcome 2]',
112
+ '',
113
+ '## Task Commits',
114
+ '1. **Task 1: [task name]** - `hash`',
115
+ '',
116
+ '## Files Created/Modified',
117
+ '- `path/to/file.ts` - What it does',
118
+ '',
119
+ '## Decisions & Deviations',
120
+ '[Key decisions or "None - followed plan as specified"]',
121
+ '',
122
+ '## Next Phase Readiness',
123
+ '[What\'s ready for next phase]',
124
+ ].join('\n');
125
+ fileName = `${padded}-${planNum}-SUMMARY.md`;
126
+ break;
127
+ }
128
+ case 'plan': {
129
+ const planType = options.type || 'execute';
130
+ const wave = parseInt(options.wave || '1') || 1;
131
+ frontmatter = {
132
+ phase: phaseId,
133
+ plan: planNum,
134
+ type: planType,
135
+ wave,
136
+ depends_on: [],
137
+ files_modified: [],
138
+ autonomous: true,
139
+ user_setup: [],
140
+ must_haves: { truths: [], artifacts: [], key_links: [] },
141
+ ...fields,
142
+ };
143
+ body = [
144
+ `# Phase ${options.phase} Plan ${planNum}: [Title]`,
145
+ '',
146
+ '## Objective',
147
+ '- **What:** [What this plan builds]',
148
+ '- **Why:** [Why it matters for the phase goal]',
149
+ '- **Output:** [Concrete deliverable]',
150
+ '',
151
+ '## Context',
152
+ '@.planning/PROJECT.md',
153
+ '@.planning/ROADMAP.md',
154
+ '@.planning/STATE.md',
155
+ '',
156
+ '## Tasks',
157
+ '',
158
+ '<task type="code">',
159
+ ' <name>[Task name]</name>',
160
+ ' <files>[file paths]</files>',
161
+ ' <action>[What to do]</action>',
162
+ ' <verify>[How to verify]</verify>',
163
+ ' <done>[Definition of done]</done>',
164
+ '</task>',
165
+ '',
166
+ '## Verification',
167
+ '[How to verify this plan achieved its objective]',
168
+ '',
169
+ '## Success Criteria',
170
+ '- [ ] [Criterion 1]',
171
+ '- [ ] [Criterion 2]',
172
+ ].join('\n');
173
+ fileName = `${padded}-${planNum}-PLAN.md`;
174
+ break;
175
+ }
176
+ case 'verification': {
177
+ frontmatter = {
178
+ phase: phaseId,
179
+ verified: new Date().toISOString(),
180
+ status: 'pending',
181
+ score: '0/0 must-haves verified',
182
+ ...fields,
183
+ };
184
+ body = [
185
+ `# Phase ${options.phase}: ${phaseName} — Verification`,
186
+ '',
187
+ '## Observable Truths',
188
+ '| # | Truth | Status | Evidence |',
189
+ '|---|-------|--------|----------|',
190
+ '| 1 | [Truth] | pending | |',
191
+ '',
192
+ '## Required Artifacts',
193
+ '| Artifact | Expected | Status | Details |',
194
+ '|----------|----------|--------|---------|',
195
+ '| [path] | [what] | pending | |',
196
+ '',
197
+ '## Key Link Verification',
198
+ '| From | To | Via | Status | Details |',
199
+ '|------|----|----|--------|---------|',
200
+ '| [source] | [target] | [connection] | pending | |',
201
+ '',
202
+ '## Requirements Coverage',
203
+ '| Requirement | Status | Blocking Issue |',
204
+ '|-------------|--------|----------------|',
205
+ '| [req] | pending | |',
206
+ '',
207
+ '## Result',
208
+ '[Pending verification]',
209
+ ].join('\n');
210
+ fileName = `${padded}-VERIFICATION.md`;
211
+ break;
212
+ }
213
+ default:
214
+ error(`Unknown template type: ${templateType}. Available: summary, plan, verification`);
215
+ return;
216
+ }
217
+
218
+ const fullContent = `---\n${reconstructFrontmatter(frontmatter)}\n---\n\n${body}\n`;
219
+ const outPath = path.join(cwd, phaseInfo.directory!, fileName);
220
+
221
+ if (fs.existsSync(outPath)) {
222
+ output({ error: 'File already exists', path: toPosixPath(path.relative(cwd, outPath)) }, raw);
223
+ return;
224
+ }
225
+
226
+ fs.writeFileSync(outPath, fullContent, 'utf-8');
227
+ const relPath = toPosixPath(path.relative(cwd, outPath));
228
+ output({ created: true, path: relPath, template: templateType }, raw, relPath);
229
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Template — Template selection and fill operations
3
+ */
4
+ export declare function cmdTemplateSelect(cwd: string, planPath: string | undefined, raw: boolean): void;
5
+ interface TemplateFillOptions {
6
+ phase: string | null;
7
+ plan?: string | null;
8
+ name?: string | null;
9
+ type?: string | null;
10
+ wave?: string | null;
11
+ fields?: Record<string, unknown>;
12
+ }
13
+ export declare function cmdTemplateFill(cwd: string, templateType: string | undefined, options: TemplateFillOptions, raw: boolean): void;
14
+ export {};
15
+ //# sourceMappingURL=template.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.d.cts","sourceRoot":"","sources":["template.cts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,OAAO,GAAG,IAAI,CA4C/F;AAED,UAAU,mBAAmB;IAC3B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,mBAAmB,EAAE,GAAG,EAAE,OAAO,GAAG,IAAI,CAoK/H"}