@dtlabs/ai-toolkit 0.17.5 → 0.19.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 (35) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/lib/agent-registry.js +39 -0
  3. package/package.json +1 -1
  4. package/src/claude/agents/gaia-generate-requirements-use-case.md +97 -0
  5. package/src/claude/agents/gaia-generate-requirements.md +22 -27
  6. package/src/claude/agents/gaia-generate-tech-spec-component.md +93 -0
  7. package/src/claude/agents/gaia-generate-tech-spec.md +47 -103
  8. package/src/claude/agents/gaia-generate-work-breakdown-task.md +151 -0
  9. package/src/claude/agents/gaia-generate-work-breakdown.md +124 -105
  10. package/src/claude/agents/gaia-validate-feature-docs.md +13 -8
  11. package/src/claude/agents/gaia-validate-work-breakdown-semantic.md +9 -4
  12. package/src/claude/commands/assemble-docs.md +16 -0
  13. package/src/claude/commands/feature-status.md +9 -4
  14. package/src/claude/scripts/ac-task-matrix.js +121 -0
  15. package/src/claude/scripts/assemble-docs.js +66 -0
  16. package/src/claude/scripts/req-assembler.js +127 -0
  17. package/src/claude/scripts/req-graph-checks.js +71 -0
  18. package/src/claude/scripts/req-skeleton-check.js +64 -0
  19. package/src/claude/scripts/tech-spec-assembler.js +188 -0
  20. package/src/claude/scripts/tech-spec-graph-checks.js +84 -0
  21. package/src/claude/scripts/templates/gaia-component-template.md +64 -0
  22. package/src/claude/scripts/templates/gaia-dependency-graph-template.md +85 -0
  23. package/src/claude/scripts/templates/gaia-requirements-index-template.md +144 -0
  24. package/src/claude/scripts/templates/gaia-task-template.md +92 -0
  25. package/src/claude/scripts/templates/gaia-tech-spec-index-template.md +137 -0
  26. package/src/claude/scripts/templates/gaia-use-case-template.md +56 -0
  27. package/src/claude/scripts/templates/gaia-user-story-template.md +61 -0
  28. package/src/claude/scripts/wb-graph-checks.js +754 -0
  29. package/src/claude/scripts/wb-render.js +6 -11
  30. package/src/claude/scripts/wb-skeleton-check.js +99 -0
  31. package/src/claude/scripts/wb-validate.js +49 -655
  32. package/src/claude/scripts/wbs-assembler.js +368 -0
  33. package/src/claude/skills/implement-feature/SKILL.md +12 -6
  34. package/src/claude/workflows/pm-phase1.js +324 -18
  35. package/src/claude/workflows/pm-phase2.js +358 -15
@@ -0,0 +1,137 @@
1
+ <!--
2
+ TECH-SPEC INDEX TEMPLATE — spec/index.md
3
+
4
+ Canonical structure for the Tech-Spec index (skeleton) in the split format (FTR-024). Holds every
5
+ section genuinely feature-wide, PLUS the Section 9 Components index table — one row per file the
6
+ feature creates or modifies. Each component's own Backend/Frontend/External-Integration/Testing
7
+ detail is produced separately, one call per component (see gaia-component-template.md); this
8
+ skeleton never contains that per-component content inline.
9
+
10
+ This is the REAL, currently-implemented 12-section contract — authoritative source:
11
+ `src/claude/agents/gaia-generate-tech-spec.md`'s own "Output Structure" section, and
12
+ `src/claude/scripts/tech-spec-assembler.js`/`tech-spec-graph-checks.js`. An earlier FTR-020
13
+ exploratory draft of this template used a completely different 6-section numbering (Baseline /
14
+ Resolution of Open Questions / Components index / Traceability / feature-wide guarantees / Shared
15
+ test fixtures) that predates the Tech-Spec split entirely and was never what generation actually
16
+ shipped — this file reflects the real, current 12-section format, not that earlier draft.
17
+
18
+ Fill in every placeholder (angle brackets) and delete every HTML comment block (including this
19
+ one) before treating the file as finished.
20
+ -->
21
+
22
+ # Technical Specification — {Feature Title}
23
+
24
+ ## Document Info
25
+ | Field | Value |
26
+ |-------|-------|
27
+ | Feature | {PREFIX and title} |
28
+ | Version | 1.0 |
29
+ | Date | {today} |
30
+ | Status | Draft |
31
+
32
+ ## 1. Overview
33
+
34
+ <prose: brief technical summary — what is being built, which systems are affected>
35
+
36
+ ## 2. Architecture
37
+
38
+ ### 2.1 System Context
39
+
40
+ <prose: where this feature sits in the overall architecture>
41
+
42
+ ### 2.2 Component Diagram
43
+
44
+ <!-- Text-based diagram showing components and their interactions. -->
45
+
46
+ ```
47
+ [Component A] --(protocol)--> [Component B]
48
+ ```
49
+
50
+ ### 2.3 Sequence Diagrams
51
+
52
+ <!-- For key flows, show the sequence of calls between components (text-based or Mermaid). -->
53
+
54
+ ## 3. Backend
55
+
56
+ _Per-component detail — see Section 9's Components table and each component's own design file
57
+ (generated separately, one call per component). Do not write any content here._
58
+
59
+ ## 4. Frontend
60
+
61
+ _Per-component detail — see Section 9's Components table and each component's own design file
62
+ (generated separately, one call per component). Do not write any content here._
63
+
64
+ ## 5. External Integrations
65
+
66
+ _Per-component detail — see Section 9's Components table and each component's own design file
67
+ (generated separately, one call per component). Do not write any content here._
68
+
69
+ ## 6. Security Considerations
70
+
71
+ <!-- Authentication & authorization requirements, input validation boundaries, sensitive data
72
+ handling, CORS implications (if applicable). -->
73
+
74
+ <prose / bullet list>
75
+
76
+ ## 7. Database Changes
77
+
78
+ <!-- New tables/columns, indexes recommended, seed data, migration strategy. -->
79
+
80
+ <prose / bullet list>
81
+
82
+ ## 8. Configuration
83
+
84
+ <!-- New environment variables, app settings changes, feature flags (if applicable). -->
85
+
86
+ <prose / bullet list>
87
+
88
+ ## 9. File Inventory
89
+
90
+ Complete list of files to create or modify:
91
+
92
+ ### New files
93
+ | Path | Purpose | Addresses | Domain | Spec |
94
+ |------|---------|-----------|--------|------|
95
+ | {real file path} | {purpose} | {AC-IDs, comma-separated, or —} | {BE \| FE \| DB \| DevOps \| INFRA \| TEST} | [components/{fileSlug}](components/{fileSlug}) |
96
+
97
+ ### Modified files
98
+ | Path | Change description | Addresses | Domain | Spec |
99
+ |------|-------------------|-----------|--------|------|
100
+ | {real file path} | {change description} | {AC-IDs, comma-separated, or —} | {BE \| FE \| DB \| DevOps \| INFRA \| TEST} | [components/{fileSlug}](components/{fileSlug}) |
101
+
102
+ <!--
103
+ Column order matters: `Addresses` MUST stay the 3rd column (immediately after
104
+ `Purpose`/`Change description`) — this is the exact position `tech-spec-graph-checks.js`'s
105
+ existing, positional parser reads from, and it reads positionally, not by header name. `Domain`
106
+ and `Spec` are new TRAILING columns, safely ignored by that parser. Do not reorder them. `Domain`
107
+ is the same enum Work Breakdown tasks already use. `Spec` is a provisional link to this file's own
108
+ design file — `components/{the file's own basename, with its extension kept}.md` — the host may
109
+ rewrite this link if two files share a basename, so treat it as provisional, not final.
110
+ -->
111
+
112
+ ## 10. Testing Strategy
113
+
114
+ _Per-component detail — see each component's own design file's own Tests section (generated
115
+ separately, one call per component). Do not write any content here._
116
+
117
+ ## 11. Implementation Order
118
+
119
+ <!-- Numbered, dependency-aware sequence of components/tasks. -->
120
+
121
+ 1. {component/task} — depends on: nothing
122
+ 2. {component/task} — depends on: 1
123
+
124
+ ## 12. Risks & Mitigations
125
+
126
+ | Risk | Impact | Mitigation |
127
+ |------|--------|-----------|
128
+ | {risk} | {impact} | {mitigation} |
129
+
130
+ <!--
131
+ PARSING CONTRACT — tech-spec-assembler.js's tech-spec-graph-checks.js's parsers require exactly
132
+ these 12 numbered `## N. ` headings, in order, to exist (assertCompleteSections's truncation guard
133
+ in pm-phase1.js checks the same 12 headings), plus Section 9's two subtables in the exact column
134
+ order above. Sections 3/4/5/10 must keep their heading even though their real content is deferred
135
+ to per-component generation — the assembler's spliceSectionBody requires the heading to already
136
+ exist to splice into.
137
+ -->
@@ -0,0 +1,56 @@
1
+ <!--
2
+ USE CASE TEMPLATE — req/use-cases/{UC-ID}.md
3
+
4
+ Canonical structure for one Use Case file in the split Requirements format. Every UC file has
5
+ exactly three parts, in this order: (1) the heading + field table, (2) the flow/description
6
+ body, (3) cross-references back to the index (Business Rules and Acceptance Criteria that apply
7
+ to this UC). Fill in every placeholder (angle brackets) and delete every HTML comment block
8
+ (including this one) before treating the file as finished.
9
+ -->
10
+
11
+ ### {UC-ID}: <Title — short, matches the Title column in index.md's Use Cases table exactly>
12
+
13
+ | Field | Value |
14
+ |---|---|
15
+ | Actor | <who/what initiates or participates in this use case> |
16
+ | Priority | <Must \| Should \| Could> |
17
+ | Preconditions | <what must already be true before this use case can start> |
18
+ | Trigger | <the event that starts this use case> |
19
+
20
+ > **Legend:** **Actor** — who/what initiates or participates in this use case. **Priority** —
21
+ > MoSCoW (Must/Should/Could). **Preconditions** — what must already be true before this use case
22
+ > can start. **Trigger** — the event that starts it.
23
+
24
+ <!--
25
+ The body: describe the actual flow. For a technical/internal feature (most of this toolkit's
26
+ own features), this is usually a numbered or prose description of what happens, in enough detail
27
+ that someone reading ONLY this file — not the whole Requirements document — understands exactly
28
+ what this use case requires, without having to infer it from the Tech-Spec or the Work Breakdown.
29
+ Length target: proportional to the use case's real complexity, not padded — a one-paragraph UC is
30
+ fine if that's genuinely all there is to say; a multi-step UC can run longer, but if it's
31
+ sprawling across unrelated concerns, that's a sign it should be two UCs, not one file trying to
32
+ cover both (same atomicity instinct as a Work Breakdown task, just at a coarser grain).
33
+ -->
34
+
35
+ <prose describing the flow>
36
+
37
+ **Related Business Rules:** <comma-separated BR-IDs that apply to this UC, derived from the
38
+ `Applies to` column in [index.md](../index.md#3-business-rules) — include any `All UCs` rule
39
+ too, or `—` if none>
40
+
41
+ **Related Acceptance Criteria:** <comma-separated AC-IDs whose `Related UC` column includes this
42
+ UC (always include any `All UCs` AC too), derived from
43
+ [index.md](../index.md#6-acceptance-criteria). `—` is only valid if index.md's AC table
44
+ genuinely has no AC referencing this UC yet — treat that as a flag worth double-checking, not a
45
+ normal/expected state: per the feature.md<->req<->spec bidirectional traceability check (see
46
+ [index.md](../index.md#traceability)), every UC should normally trace to at least one AC, or
47
+ nothing downstream can verify this UC's Work Breakdown tasks actually satisfy it.
48
+
49
+ <!--
50
+ Both cross-reference lines above are DERIVED data — they must match what index.md's tables
51
+ actually say. Don't invent a BR/AC reference here that doesn't exist in the index, and don't let
52
+ this line go stale if the index changes later (whatever generates/maintains this file is
53
+ responsible for keeping it in sync — this is the same "which side is authoritative" question the
54
+ Work Breakdown's skeleton/detail split had to answer: here, index.md's tables are authoritative,
55
+ this line is a convenience projection of them, not a second source of truth).
56
+ -->
@@ -0,0 +1,61 @@
1
+ <!--
2
+ PHASE / USER-STORY DETAIL TEMPLATE — wbs/user-stories/{PHASE_ID}.md
3
+
4
+ Canonical structure for a phase file (the INFRA phase and every US-NN phase both use this same
5
+ template — INFRA is not a user story, but lives in the same directory and format; see "Type"
6
+ below). Every phase file has exactly four parts, in this order: (1) the field block,
7
+ (2) Context, (3) Tasks in this phase, (4) Depends on phases. Fill in every placeholder (angle
8
+ brackets) and delete every HTML comment block (including this one) before treating the file as
9
+ finished.
10
+ -->
11
+ <a id="phase-{PHASE_ID}"></a>
12
+ ### {PHASE_ID}
13
+
14
+ - **Phase ID:** {PHASE_ID}
15
+ - **Type:** <infrastructure | user-story>
16
+ - **Source UC:** <comma-separated UC-ID(s) this phase's tasks realize, or `—` for a phase with no
17
+ single originating UC (e.g. shared infrastructure). Restated here for human readability from
18
+ `index.json`'s own `sourceUC` array, which is authoritative — this line is a display-only
19
+ projection, not parsed back out by `parsePhaseDetailBlock` (same convention as `Phase ID`/
20
+ `Type` above, which are also restated but not re-extracted). Can be MORE than one UC (an
21
+ orchestration phase) — don't force a single value if that's not true; see Tech-Spec OQ-05.>
22
+ - **Title:** <For `type: user-story`, use the standard form: "As a <role>, I want <capability>,
23
+ so that <benefit>" — derived directly from this phase's source Use Case(s). For `type:
24
+ infrastructure` (the one INFRA phase), there is no user-story grammar — use a short descriptive
25
+ label of what shared setup this phase provides.>
26
+ - **Commit type:** <conventional-commit type, usually `feat`>
27
+ - **Commit scope:** <optional, or `—`>
28
+ - **Commit subject:** <imperative, concise — e.g. "implement {PHASE_ID} <short description>" —
29
+ the renderer prepends `type(scope): ` automatically, do not include it here>
30
+
31
+ **Context:**
32
+
33
+ <!--
34
+ 2–4 sentences, no more. Answer: why does this phase exist (which Use Case / need does it map
35
+ to)? How do its own tasks relate to each other? Is there a dependency or sequencing reason other
36
+ phases or tasks need to know about before opening this phase's individual task files? Do NOT
37
+ restate the Title — add information the title doesn't already give.
38
+ -->
39
+
40
+ <prose>
41
+
42
+ **Tasks in this phase:**
43
+
44
+ <!--
45
+ One bullet per task, in the same order as `index.json`'s `taskIds` for this phase. The summary is
46
+ a few words of what the task DOES, not a copy of its full Title (that's one click away via the
47
+ task ID link/filename).
48
+ -->
49
+
50
+ - `{TASK_ID}` — <one-line summary>
51
+
52
+ **Depends on phases:** <comma-separated phase IDs this phase's tasks have a `dependsOn` reference
53
+ into, or `none` if this phase has no cross-phase dependency>
54
+
55
+ <!--
56
+ PARSING CONTRACT — read by wbs-assembler.js's parsePhaseDetailBlock: field values are read from
57
+ the CONTIGUOUS RUN of `- **Label:** value` lines starting immediately after the `### {PHASE_ID}`
58
+ heading, stopping at the first non-matching line. Same rule and same rationale as the task
59
+ template — see task-template.md's parsing-contract note for the full explanation and the real
60
+ bug it fixes.
61
+ -->