@eddacraft/anvil-aps 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.
Files changed (121) hide show
  1. package/AGENTS.md +155 -0
  2. package/LICENSE +14 -0
  3. package/README.md +57 -0
  4. package/TODO.md +40 -0
  5. package/dist/filter/context-bundle.d.ts +81 -0
  6. package/dist/filter/context-bundle.d.ts.map +1 -0
  7. package/dist/filter/context-bundle.js +230 -0
  8. package/dist/filter/index.d.ts +85 -0
  9. package/dist/filter/index.d.ts.map +1 -0
  10. package/dist/filter/index.js +169 -0
  11. package/dist/index.d.ts +16 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +15 -0
  14. package/dist/loader/index.d.ts +80 -0
  15. package/dist/loader/index.d.ts.map +1 -0
  16. package/dist/loader/index.js +253 -0
  17. package/dist/parser/index.d.ts +24 -0
  18. package/dist/parser/index.d.ts.map +1 -0
  19. package/dist/parser/index.js +22 -0
  20. package/dist/parser/parse-document.d.ts +17 -0
  21. package/dist/parser/parse-document.d.ts.map +1 -0
  22. package/dist/parser/parse-document.js +219 -0
  23. package/dist/parser/parse-index.d.ts +31 -0
  24. package/dist/parser/parse-index.d.ts.map +1 -0
  25. package/dist/parser/parse-index.js +251 -0
  26. package/dist/parser/parse-task.d.ts +30 -0
  27. package/dist/parser/parse-task.d.ts.map +1 -0
  28. package/dist/parser/parse-task.js +261 -0
  29. package/dist/state/index.d.ts +307 -0
  30. package/dist/state/index.d.ts.map +1 -0
  31. package/dist/state/index.js +689 -0
  32. package/dist/templates/generator.d.ts +71 -0
  33. package/dist/templates/generator.d.ts.map +1 -0
  34. package/dist/templates/generator.js +723 -0
  35. package/dist/templates/index.d.ts +5 -0
  36. package/dist/templates/index.d.ts.map +1 -0
  37. package/dist/templates/index.js +4 -0
  38. package/dist/types/index.d.ts +131 -0
  39. package/dist/types/index.d.ts.map +1 -0
  40. package/dist/types/index.js +107 -0
  41. package/dist/validator/index.d.ts +83 -0
  42. package/dist/validator/index.d.ts.map +1 -0
  43. package/dist/validator/index.js +611 -0
  44. package/docs/APS-Anvil-Integration.md +750 -0
  45. package/docs/APS-Conventions.md +635 -0
  46. package/docs/APS-NonGoals.md +455 -0
  47. package/docs/APS-Planning-Spec-v0.1.md +362 -0
  48. package/examples/README.md +170 -0
  49. package/examples/feature-auth.aps.md +87 -0
  50. package/examples/refactor-error-handling.aps.md +119 -0
  51. package/examples/system-ecommerce/APS.md +57 -0
  52. package/examples/system-ecommerce/modules/auth.aps.md +38 -0
  53. package/examples/system-ecommerce/modules/cart.aps.md +53 -0
  54. package/examples/system-ecommerce/modules/payments.aps.md +68 -0
  55. package/examples/system-ecommerce/modules/products.aps.md +53 -0
  56. package/package.json +34 -0
  57. package/project.json +37 -0
  58. package/scripts/generate-templates.js +33 -0
  59. package/src/filter/context-bundle.ts +312 -0
  60. package/src/filter/filter.test.ts +317 -0
  61. package/src/filter/index.ts +249 -0
  62. package/src/index.ts +16 -0
  63. package/src/loader/index.ts +364 -0
  64. package/src/loader/loader.test.ts +224 -0
  65. package/src/parser/__fixtures__/invalid-task-id-not-padded.aps.md +7 -0
  66. package/src/parser/__fixtures__/invalid-task-id.aps.md +8 -0
  67. package/src/parser/__fixtures__/minimal-task.aps.md +7 -0
  68. package/src/parser/__fixtures__/non-scope-hyphenated.aps.md +10 -0
  69. package/src/parser/__fixtures__/simple-index.aps.md +35 -0
  70. package/src/parser/__fixtures__/simple-plan.aps.md +19 -0
  71. package/src/parser/index.ts +30 -0
  72. package/src/parser/parse-document.test.ts +603 -0
  73. package/src/parser/parse-document.ts +262 -0
  74. package/src/parser/parse-index.test.ts +316 -0
  75. package/src/parser/parse-index.ts +298 -0
  76. package/src/parser/parse-task.test.ts +476 -0
  77. package/src/parser/parse-task.ts +325 -0
  78. package/src/state/__fixtures__/invalid-plan.aps.md +9 -0
  79. package/src/state/__fixtures__/test-plan.aps.md +20 -0
  80. package/src/state/index.ts +879 -0
  81. package/src/state/state.test.ts +645 -0
  82. package/src/templates/generator.test.ts +378 -0
  83. package/src/templates/generator.ts +776 -0
  84. package/src/templates/index.ts +5 -0
  85. package/src/types/index.ts +168 -0
  86. package/src/validator/__fixtures__/broken-links.aps.md +10 -0
  87. package/src/validator/__fixtures__/circular-deps-index.aps.md +26 -0
  88. package/src/validator/__fixtures__/circular-modules/module-a.aps.md +9 -0
  89. package/src/validator/__fixtures__/circular-modules/module-b.aps.md +9 -0
  90. package/src/validator/__fixtures__/circular-modules/module-c.aps.md +9 -0
  91. package/src/validator/__fixtures__/dup-modules/module-a.aps.md +9 -0
  92. package/src/validator/__fixtures__/dup-modules/module-b.aps.md +9 -0
  93. package/src/validator/__fixtures__/duplicate-ids-index.aps.md +15 -0
  94. package/src/validator/__fixtures__/invalid-task-id.aps.md +17 -0
  95. package/src/validator/__fixtures__/missing-confidence.aps.md +9 -0
  96. package/src/validator/__fixtures__/missing-h1.aps.md +5 -0
  97. package/src/validator/__fixtures__/missing-intent.aps.md +9 -0
  98. package/src/validator/__fixtures__/missing-modules-section.aps.md +7 -0
  99. package/src/validator/__fixtures__/missing-tasks-section.aps.md +7 -0
  100. package/src/validator/__fixtures__/modules/auth.aps.md +17 -0
  101. package/src/validator/__fixtures__/modules/payments.aps.md +13 -0
  102. package/src/validator/__fixtures__/scope-mismatch.aps.md +14 -0
  103. package/src/validator/__fixtures__/valid-index.aps.md +24 -0
  104. package/src/validator/__fixtures__/valid-leaf.aps.md +22 -0
  105. package/src/validator/index.ts +776 -0
  106. package/src/validator/validator.test.ts +269 -0
  107. package/templates/index-full.md +94 -0
  108. package/templates/index-minimal.md +16 -0
  109. package/templates/index-template.md +63 -0
  110. package/templates/leaf-full.md +76 -0
  111. package/templates/leaf-minimal.md +14 -0
  112. package/templates/leaf-template.md +55 -0
  113. package/templates/simple-full.md +56 -0
  114. package/templates/simple-minimal.md +14 -0
  115. package/templates/simple-template.md +30 -0
  116. package/tsconfig.json +19 -0
  117. package/tsconfig.lib.json +14 -0
  118. package/tsconfig.lib.tsbuildinfo +1 -0
  119. package/tsconfig.spec.json +9 -0
  120. package/tsconfig.tsbuildinfo +1 -0
  121. package/vitest.config.ts +15 -0
@@ -0,0 +1,776 @@
1
+ /**
2
+ * Template generator for APS planning documents
3
+ *
4
+ * Generates Markdown templates for index files and leaf specs
5
+ * based on the APS Planning Spec v0.1.
6
+ *
7
+ * Templates come in three variants:
8
+ * - **minimal**: Quick start, bare essentials
9
+ * - **standard**: Recommended for most projects (default)
10
+ * - **full**: Comprehensive, for complex enterprise plans
11
+ */
12
+
13
+ /**
14
+ * Template variant options
15
+ */
16
+ export type TemplateVariant = 'minimal' | 'standard' | 'full';
17
+
18
+ /**
19
+ * Bundle of all APS planning document templates
20
+ */
21
+ export interface TemplateBundle {
22
+ /** Index file template for multi-module plans */
23
+ index: string;
24
+ /** Leaf spec template for individual modules */
25
+ leaf: string;
26
+ /** Simple single-file plan template */
27
+ simple: string;
28
+ /** Action plan template for execution breakdowns */
29
+ actions: string;
30
+ }
31
+
32
+ /**
33
+ * Options for template generation
34
+ */
35
+ export interface TemplateOptions {
36
+ /** Template variant: minimal, standard, or full */
37
+ variant?: TemplateVariant;
38
+ }
39
+
40
+ // ============================================================================
41
+ // Index Templates
42
+ // ============================================================================
43
+
44
+ /**
45
+ * Minimal index template - navigation only
46
+ */
47
+ function generateMinimalIndexTemplate(): string {
48
+ return `# [Plan Title]
49
+
50
+ ## Modules
51
+
52
+ ### [module-id]
53
+
54
+ - **Path:** [./modules/[module-name].aps.md](./modules/[module-name].aps.md)
55
+ - **Scope:** [SCOPE]
56
+ - **Owner:** @[username]
57
+
58
+ ### [another-module-id]
59
+
60
+ - **Path:** [./modules/[another-module].aps.md](./modules/[another-module].aps.md)
61
+ - **Scope:** [SCOPE2]
62
+ - **Owner:** @[username]
63
+ `;
64
+ }
65
+
66
+ /**
67
+ * Standard index template - recommended for most projects
68
+ * The index is a map, not the territory.
69
+ */
70
+ function generateStandardIndexTemplate(): string {
71
+ return `# [Plan Title]
72
+
73
+ ## Problem & Success Criteria
74
+
75
+ **Problem:** [What problem are we solving? Why does this work matter?]
76
+
77
+ **Success Criteria:**
78
+ - [ ] [Measurable outcome 1]
79
+ - [ ] [Measurable outcome 2]
80
+ - [ ] [How we know we're done]
81
+
82
+ ## System Map
83
+
84
+ [High-level view of modules and their relationships]
85
+
86
+ - **[module-a]** → depends on → **[module-b]**
87
+ - **[module-c]** — standalone
88
+
89
+ ## Milestones
90
+
91
+ ### M1: [Milestone Name]
92
+ - [What's included]
93
+ - Target: [date or modules/features]
94
+
95
+ ### M2: [Milestone Name]
96
+ - [What's included]
97
+ - Target: [date or modules/features]
98
+
99
+ ## Modules
100
+
101
+ ### [module-id]
102
+
103
+ - **Path:** [./modules/[module-name].aps.md](./modules/[module-name].aps.md)
104
+ - **Scope:** [SCOPE]
105
+ - **Owner:** @[username]
106
+ - **Status:** Draft
107
+ - **Priority:** [low|medium|high]
108
+ - **Tags:** [tag1, tag2]
109
+ - **Dependencies:** [other-module-id]
110
+
111
+ ### [another-module-id]
112
+
113
+ - **Path:** [./modules/[another-module].aps.md](./modules/[another-module].aps.md)
114
+ - **Scope:** [SCOPE2]
115
+ - **Owner:** @[username]
116
+ - **Status:** Draft
117
+ - **Priority:** [low|medium|high]
118
+ - **Tags:** [tag1, tag2]
119
+ - **Dependencies:** (none)
120
+
121
+ ## Decisions
122
+
123
+ - **D-001:** [Short decision] — [rationale] ([ADR-001](./decisions/ADR-001.md))
124
+ - **D-002:** [Another decision] — [rationale]
125
+
126
+ ## Open Questions
127
+
128
+ - [Unresolved question 1]
129
+ - [Unresolved question 2]
130
+ `;
131
+ }
132
+
133
+ /**
134
+ * Full index template - comprehensive for enterprise plans
135
+ */
136
+ function generateFullIndexTemplate(): string {
137
+ return `# APS Index — [Project Name]
138
+
139
+ ## Problem & Success Criteria
140
+
141
+ **Problem:** [What problem are we solving? Why does this work matter?]
142
+
143
+ **Success Criteria:**
144
+ - [ ] [Measurable outcome 1]
145
+ - [ ] [Measurable outcome 2]
146
+ - [ ] [How we know we're done]
147
+
148
+ ## Scope
149
+
150
+ **In Scope:**
151
+ - [What this plan covers]
152
+ - [Boundaries of work]
153
+
154
+ **Out of Scope:**
155
+ - [What this plan explicitly excludes]
156
+ - [Things deferred to future work]
157
+
158
+ ## System Map
159
+
160
+ [High-level view of modules and their relationships]
161
+
162
+ \`\`\`
163
+ [Module A] ──→ [Module B] ──→ [Module C]
164
+ ↑ ↓
165
+ [External Service] [Database]
166
+ \`\`\`
167
+
168
+ ## Milestones
169
+
170
+ ### M1: [Milestone Name]
171
+ - [What's included]
172
+ - Modules: [module-a, module-b]
173
+ - Target: [date]
174
+
175
+ ### M2: [Milestone Name]
176
+ - [What's included]
177
+ - Modules: [module-c]
178
+ - Target: [date]
179
+
180
+ ## Modules
181
+
182
+ ### [module-id]
183
+
184
+ - **Path:** [./modules/[module-name].aps.md](./modules/[module-name].aps.md)
185
+ - **Scope:** [SCOPE]
186
+ - **Owner:** @[username]
187
+ - **Status:** Draft
188
+ - **Priority:** [low|medium|high]
189
+ - **Tags:** [tag1, tag2]
190
+ - **Dependencies:** [other-module-id]
191
+
192
+ ### [another-module-id]
193
+
194
+ - **Path:** [./modules/[another-module].aps.md](./modules/[another-module].aps.md)
195
+ - **Scope:** [SCOPE2]
196
+ - **Owner:** @[username]
197
+ - **Status:** Draft
198
+ - **Priority:** [low|medium|high]
199
+ - **Tags:** [tag1, tag2]
200
+ - **Dependencies:** (none)
201
+
202
+ ## Epics
203
+
204
+ ### [epic-id]
205
+
206
+ - **Path:** [./epics/[epic-name].aps.md](./epics/[epic-name].aps.md)
207
+ - **Owner:** @[username]
208
+ - **Modules:** [module-id-1, module-id-2]
209
+ - **Milestone:** M1
210
+
211
+ ## Decisions
212
+
213
+ - **D-001:** [Short decision] — [rationale] ([ADR-001](./decisions/ADR-001.md))
214
+ - **D-002:** [Another decision] — [rationale]
215
+
216
+ ## Risks
217
+
218
+ - **R-001:** [Risk description] — Mitigation: [approach]
219
+ - **R-002:** [Risk description] — Mitigation: [approach]
220
+
221
+ ## Open Questions
222
+
223
+ - [Unresolved question 1]
224
+ - [Unresolved question 2]
225
+ `;
226
+ }
227
+
228
+ // ============================================================================
229
+ // Leaf Templates
230
+ // ============================================================================
231
+
232
+ /**
233
+ * Minimal leaf template - tasks only
234
+ */
235
+ function generateMinimalLeafTemplate(): string {
236
+ return `# [Module Title]
237
+
238
+ **Scope:** [SCOPE] **Owner:** @[username]
239
+
240
+ ## Tasks
241
+
242
+ ### [SCOPE]-001: [Task title]
243
+
244
+ **Intent:** [What this task aims to achieve]
245
+ **Confidence:** [low|medium|high]
246
+
247
+ ### [SCOPE]-002: [Another task]
248
+
249
+ **Intent:** [What this task does]
250
+ **Confidence:** [low|medium|high]
251
+ **Dependencies:** [SCOPE]-001
252
+ `;
253
+ }
254
+
255
+ /**
256
+ * Standard leaf template - recommended for most modules
257
+ */
258
+ function generateStandardLeafTemplate(): string {
259
+ return `# [Module Title]
260
+
261
+ **Scope:** [SCOPE] **Owner:** @[username] **Priority:** [low|medium|high]
262
+
263
+ ## Purpose
264
+
265
+ [Why this module exists and what problem it solves]
266
+
267
+ ## In Scope / Out of Scope
268
+
269
+ **In Scope:**
270
+ - [What this module WILL do]
271
+ - [Boundaries of responsibility]
272
+
273
+ **Out of Scope:**
274
+ - [What this module will NOT do]
275
+ - [Things that belong elsewhere]
276
+
277
+ ## Interfaces
278
+
279
+ **Depends on:**
280
+ - [Service/Module name] — [what we need from it]
281
+
282
+ **Exposes:**
283
+ - [Endpoint/API] — [what others can use]
284
+
285
+ ## Tasks
286
+
287
+ ### [SCOPE]-001: [Task title]
288
+
289
+ **Intent:** [Clear statement of what this task aims to achieve]
290
+ **Expected Outcome:** [What success looks like]
291
+ **Confidence:** [low|medium|high]
292
+ **Link:** [PROJ-123](https://jira.example.com/browse/PROJ-123)
293
+ **Scopes:** [SCOPE1, SCOPE2]
294
+ **Tags:** [tag1, tag2, tag3]
295
+ **Dependencies:** [SCOPE-XXX, OTHER-YYY]
296
+ **Inputs:**
297
+ - [Required input 1]
298
+ - [Required input 2]
299
+
300
+ ### [SCOPE]-002: [Another task]
301
+
302
+ **Intent:** [What this task does]
303
+ **Confidence:** [low|medium|high]
304
+ **Scopes:** [SCOPE]
305
+ **Dependencies:** [SCOPE]-001
306
+
307
+ ## Decisions
308
+
309
+ - **D-001:** [Short decision] — [rationale]
310
+
311
+ ## Notes
312
+
313
+ - [Additional context or considerations]
314
+ `;
315
+ }
316
+
317
+ /**
318
+ * Full leaf template - comprehensive for complex modules
319
+ */
320
+ function generateFullLeafTemplate(): string {
321
+ return `# Module APS — [Module Name]
322
+
323
+ **Scope:** [SCOPE] **Owner:** @[username] **Priority:** [low|medium|high]
324
+
325
+ ## Purpose
326
+
327
+ [Why this module exists and what problem it solves. The "why" behind this work.]
328
+
329
+ ## In Scope / Out of Scope
330
+
331
+ **In Scope:**
332
+ - [What this module WILL do]
333
+ - [Boundaries of responsibility]
334
+ - [Features included]
335
+
336
+ **Out of Scope:**
337
+ - [What this module will NOT do]
338
+ - [Things that belong elsewhere]
339
+ - [Explicit exclusions]
340
+
341
+ ## Assumptions
342
+
343
+ - [Assumption 1] — Confidence: [low|medium|high]
344
+ - [Assumption 2] — Confidence: [low|medium|high]
345
+
346
+ ## Interfaces
347
+
348
+ **Depends on:**
349
+ - [Service/Module name] — [what we need from it]
350
+ - [External API] — [what we consume]
351
+
352
+ **Exposes:**
353
+ - [Endpoint/API] — [what others can use]
354
+ - [Event/Hook] — [what we publish]
355
+
356
+ ## Tasks
357
+
358
+ ### [SCOPE]-001: [Task title]
359
+
360
+ **Intent:** [Clear statement of what this task aims to achieve]
361
+ **Expected Outcome:** [What success looks like]
362
+ **Confidence:** [low|medium|high]
363
+ **Link:** [PROJ-123](https://jira.example.com/browse/PROJ-123)
364
+ **Scopes:** [SCOPE1, SCOPE2]
365
+ **Tags:** [tag1, tag2, tag3]
366
+ **Dependencies:** [SCOPE-XXX, OTHER-YYY]
367
+ **Inputs:**
368
+ - [Required input 1]
369
+ - [Required input 2]
370
+
371
+ ### [SCOPE]-002: [Another task]
372
+
373
+ **Intent:** [What this task does]
374
+ **Expected Outcome:** [Success criteria]
375
+ **Confidence:** [low|medium|high]
376
+ **Link:** [PROJ-124](https://jira.example.com/browse/PROJ-124)
377
+ **Scopes:** [SCOPE]
378
+ **Dependencies:** [SCOPE]-001
379
+
380
+ ## Decisions
381
+
382
+ - **D-001:** [Short decision] — [rationale] ([ADR-001](../decisions/ADR-001.md))
383
+ - **D-002:** [Another decision] — [rationale]
384
+
385
+ ## Risks
386
+
387
+ - **R-001:** [Risk description] — Mitigation: [approach]
388
+
389
+ ## Open Questions
390
+
391
+ - [Unresolved question about this module]
392
+
393
+ ## Notes
394
+
395
+ - [Additional context or considerations]
396
+ - [Links to relevant resources]
397
+ `;
398
+ }
399
+
400
+ // ============================================================================
401
+ // Simple (Single-File) Templates
402
+ // ============================================================================
403
+
404
+ /**
405
+ * Minimal simple template - quick feature plan
406
+ */
407
+ function generateMinimalSimpleTemplate(): string {
408
+ return `# [Feature Name]
409
+
410
+ **Scope:** [SCOPE] **Owner:** @[username]
411
+
412
+ ## Tasks
413
+
414
+ ### [SCOPE]-001: [First task]
415
+
416
+ **Intent:** [What this task achieves]
417
+ **Confidence:** [low|medium|high]
418
+
419
+ ### [SCOPE]-002: [Second task]
420
+
421
+ **Intent:** [What this task achieves]
422
+ **Confidence:** [low|medium|high]
423
+ **Dependencies:** [SCOPE]-001
424
+ `;
425
+ }
426
+
427
+ /**
428
+ * Standard simple template - recommended for single-file plans
429
+ */
430
+ function generateStandardSimpleTemplate(): string {
431
+ return `# Feature: [Feature Name]
432
+
433
+ **Scope:** [SCOPE] **Owner:** @[username] **Priority:** [low|medium|high]
434
+
435
+ ## Purpose
436
+
437
+ [Why we're building this feature and what problem it solves]
438
+
439
+ ## Success Criteria
440
+
441
+ - [ ] [Measurable outcome 1]
442
+ - [ ] [Measurable outcome 2]
443
+
444
+ ## Tasks
445
+
446
+ ### [SCOPE]-001: [First task]
447
+
448
+ **Intent:** [What this task achieves]
449
+ **Expected Outcome:** [Success criteria]
450
+ **Confidence:** [low|medium|high]
451
+ **Link:** [PROJ-123](https://jira.example.com/browse/PROJ-123)
452
+ **Scopes:** [SCOPE]
453
+ **Tags:** [tag1, tag2]
454
+
455
+ ### [SCOPE]-002: [Second task]
456
+
457
+ **Intent:** [What this task achieves]
458
+ **Confidence:** [low|medium|high]
459
+ **Scopes:** [SCOPE]
460
+ **Dependencies:** [SCOPE]-001
461
+
462
+ ## Notes
463
+
464
+ - [Additional notes or considerations]
465
+ `;
466
+ }
467
+
468
+ /**
469
+ * Full simple template - comprehensive single-file plan
470
+ */
471
+ function generateFullSimpleTemplate(): string {
472
+ return `# Feature: [Feature Name]
473
+
474
+ **Scope:** [SCOPE] **Owner:** @[username] **Priority:** [low|medium|high]
475
+
476
+ ## Purpose
477
+
478
+ [Why we're building this feature and what problem it solves]
479
+
480
+ ## Success Criteria
481
+
482
+ - [ ] [Measurable outcome 1]
483
+ - [ ] [Measurable outcome 2]
484
+ - [ ] [How we know we're done]
485
+
486
+ ## In Scope / Out of Scope
487
+
488
+ **In Scope:**
489
+ - [What this feature WILL do]
490
+
491
+ **Out of Scope:**
492
+ - [What this feature will NOT do]
493
+
494
+ ## Assumptions
495
+
496
+ - [Assumption 1] — Confidence: [low|medium|high]
497
+
498
+ ## Tasks
499
+
500
+ ### [SCOPE]-001: [First task]
501
+
502
+ **Intent:** [What this task achieves]
503
+ **Expected Outcome:** [Success criteria]
504
+ **Confidence:** [low|medium|high]
505
+ **Link:** [PROJ-123](https://jira.example.com/browse/PROJ-123)
506
+ **Scopes:** [SCOPE]
507
+ **Tags:** [tag1, tag2]
508
+ **Inputs:**
509
+ - [Required input 1]
510
+
511
+ ### [SCOPE]-002: [Second task]
512
+
513
+ **Intent:** [What this task achieves]
514
+ **Expected Outcome:** [Success criteria]
515
+ **Confidence:** [low|medium|high]
516
+ **Scopes:** [SCOPE]
517
+ **Dependencies:** [SCOPE]-001
518
+
519
+ ## Decisions
520
+
521
+ - **D-001:** [Decision] — [rationale]
522
+
523
+ ## Open Questions
524
+
525
+ - [Unresolved question]
526
+
527
+ ## Notes
528
+
529
+ - [Additional notes or considerations]
530
+ `;
531
+ }
532
+
533
+ // ============================================================================
534
+ // Action Plan Templates
535
+ // ============================================================================
536
+
537
+ /**
538
+ * Minimal action plan template - checkpoints only
539
+ */
540
+ function generateMinimalActionsTemplate(): string {
541
+ return `# Actions: [SCOPE-NNN]
542
+
543
+ | Source | Work Item | Created by | Status |
544
+ |--------|-----------|------------|--------|
545
+ | [module.aps.md](./module.aps.md) | [SCOPE-NNN]: [Title] | @[username] | In Progress |
546
+
547
+ ## Actions
548
+
549
+ ### 1. [Action verb] [target]
550
+
551
+ - **Checkpoint:** [Observable state — max 12 words]
552
+ - **Validate:** \`[command]\`
553
+
554
+ ### 2. [Next action]
555
+
556
+ - **Checkpoint:** [Observable state]
557
+ - **Validate:** \`[command]\`
558
+
559
+ ## Completion
560
+
561
+ - [ ] All checkpoints validated
562
+ - [ ] Work item marked complete
563
+ `;
564
+ }
565
+
566
+ /**
567
+ * Standard action plan template - recommended for most tasks
568
+ */
569
+ function generateStandardActionsTemplate(): string {
570
+ return `# Actions: [SCOPE-NNN]
571
+
572
+ | Source | Work Item | Created by | Status |
573
+ |--------|-----------|------------|--------|
574
+ | [module.aps.md](./module.aps.md) | [SCOPE-NNN]: [Title] | @[username] | In Progress |
575
+
576
+ ## Prerequisites
577
+
578
+ - [ ] Dependencies completed: [list any prerequisite work items]
579
+ - [ ] Decisions made: [list any decisions needed]
580
+ - [ ] Context available: [list any required inputs]
581
+
582
+ ## Actions
583
+
584
+ ### 1. [Action verb] [target]
585
+
586
+ - **Purpose:** [Why this action is needed]
587
+ - **Produces:** [What this action creates or changes]
588
+ - **Checkpoint:** [Observable state — max 12 words]
589
+ - **Validate:** \`[command]\`
590
+
591
+ ### 2. [Next action]
592
+
593
+ - **Purpose:** [Why this action is needed]
594
+ - **Produces:** [What this action creates or changes]
595
+ - **Checkpoint:** [Observable state — max 12 words]
596
+ - **Validate:** \`[command]\`
597
+
598
+ ### 3. [Final action]
599
+
600
+ - **Purpose:** [Why this action is needed]
601
+ - **Produces:** [What this action creates or changes]
602
+ - **Checkpoint:** [Observable state — max 12 words]
603
+ - **Validate:** \`[command]\`
604
+
605
+ ## Completion
606
+
607
+ - [ ] All checkpoints validated
608
+ - [ ] Work item marked complete
609
+ - [ ] Completed by: @[username]
610
+ - [ ] Completed at: [timestamp]
611
+ `;
612
+ }
613
+
614
+ /**
615
+ * Full action plan template - comprehensive for complex tasks
616
+ */
617
+ function generateFullActionsTemplate(): string {
618
+ return `# Actions: [SCOPE-NNN]
619
+
620
+ | Source | Work Item | Created by | Status |
621
+ |--------|-----------|------------|--------|
622
+ | [module.aps.md](./module.aps.md) | [SCOPE-NNN]: [Title] | @[username] | In Progress |
623
+
624
+ ## Overview
625
+
626
+ **Intent:** [Copy from work item — what this achieves]
627
+ **Expected Outcome:** [Copy from work item — success criteria]
628
+
629
+ ## Prerequisites
630
+
631
+ - [ ] Dependencies completed: [list any prerequisite work items]
632
+ - [ ] Decisions made: [list any decisions needed]
633
+ - [ ] Context available: [list any required inputs]
634
+ - [ ] Environment ready: [list any setup requirements]
635
+
636
+ ## Actions
637
+
638
+ ### 1. [Action verb] [target]
639
+
640
+ - **Purpose:** [Why this action is needed]
641
+ - **Produces:** [What this action creates or changes]
642
+ - **Checkpoint:** [Observable state — max 12 words]
643
+ - **Validate:** \`[command]\`
644
+ - **Status:** [Blocked/Deferred — only if applicable]
645
+
646
+ ### 2. [Next action]
647
+
648
+ - **Purpose:** [Why this action is needed]
649
+ - **Produces:** [What this action creates or changes]
650
+ - **Checkpoint:** [Observable state — max 12 words]
651
+ - **Validate:** \`[command]\`
652
+
653
+ ### 3. [Verification action]
654
+
655
+ - **Purpose:** [Why this action is needed]
656
+ - **Produces:** [What this action creates or changes]
657
+ - **Checkpoint:** [Observable state — max 12 words]
658
+ - **Validate:** \`[command]\`
659
+
660
+ ## Blocked/Deferred
661
+
662
+ [Document any actions that are blocked or deferred, with reasons]
663
+
664
+ ## Notes
665
+
666
+ - [Additional context or considerations]
667
+ - [Links to relevant resources]
668
+
669
+ ## Completion
670
+
671
+ - [ ] All checkpoints validated
672
+ - [ ] Tests pass: \`[test command]\`
673
+ - [ ] Work item marked complete
674
+ - [ ] Completed by: @[username]
675
+ - [ ] Completed at: [timestamp]
676
+ `;
677
+ }
678
+
679
+ // ============================================================================
680
+ // Public API
681
+ // ============================================================================
682
+
683
+ /**
684
+ * Generate an index file template
685
+ *
686
+ * @param options - Template options
687
+ * @returns Index template markdown
688
+ */
689
+ export function generateIndexTemplate(options: TemplateOptions = {}): string {
690
+ const variant = options.variant ?? 'standard';
691
+
692
+ switch (variant) {
693
+ case 'minimal':
694
+ return generateMinimalIndexTemplate();
695
+ case 'full':
696
+ return generateFullIndexTemplate();
697
+ case 'standard':
698
+ default:
699
+ return generateStandardIndexTemplate();
700
+ }
701
+ }
702
+
703
+ /**
704
+ * Generate a leaf spec template
705
+ *
706
+ * @param options - Template options
707
+ * @returns Leaf spec template markdown
708
+ */
709
+ export function generateLeafTemplate(options: TemplateOptions = {}): string {
710
+ const variant = options.variant ?? 'standard';
711
+
712
+ switch (variant) {
713
+ case 'minimal':
714
+ return generateMinimalLeafTemplate();
715
+ case 'full':
716
+ return generateFullLeafTemplate();
717
+ case 'standard':
718
+ default:
719
+ return generateStandardLeafTemplate();
720
+ }
721
+ }
722
+
723
+ /**
724
+ * Generate a simple single-file plan template
725
+ *
726
+ * @param options - Template options
727
+ * @returns Simple plan template markdown
728
+ */
729
+ export function generateSimplePlanTemplate(options: TemplateOptions = {}): string {
730
+ const variant = options.variant ?? 'standard';
731
+
732
+ switch (variant) {
733
+ case 'minimal':
734
+ return generateMinimalSimpleTemplate();
735
+ case 'full':
736
+ return generateFullSimpleTemplate();
737
+ case 'standard':
738
+ default:
739
+ return generateStandardSimpleTemplate();
740
+ }
741
+ }
742
+
743
+ /**
744
+ * Generate an action plan template for execution breakdowns
745
+ *
746
+ * @param options - Template options
747
+ * @returns Action plan template markdown
748
+ */
749
+ export function generateActionsTemplate(options: TemplateOptions = {}): string {
750
+ const variant = options.variant ?? 'standard';
751
+
752
+ switch (variant) {
753
+ case 'minimal':
754
+ return generateMinimalActionsTemplate();
755
+ case 'full':
756
+ return generateFullActionsTemplate();
757
+ case 'standard':
758
+ default:
759
+ return generateStandardActionsTemplate();
760
+ }
761
+ }
762
+
763
+ /**
764
+ * Generate all templates and return as a typed bundle
765
+ *
766
+ * @param options - Template options
767
+ * @returns Bundle of all templates
768
+ */
769
+ export function generateAllTemplates(options: TemplateOptions = {}): TemplateBundle {
770
+ return {
771
+ index: generateIndexTemplate(options),
772
+ leaf: generateLeafTemplate(options),
773
+ simple: generateSimplePlanTemplate(options),
774
+ actions: generateActionsTemplate(options),
775
+ };
776
+ }