@entelligentsia/forgecli 0.6.6 → 0.7.6

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 (183) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/README.md +28 -1
  3. package/dist/bin/forge.js +20 -0
  4. package/dist/bin/forge.js.map +1 -1
  5. package/dist/extensions/forgecli/approve.d.ts +24 -0
  6. package/dist/extensions/forgecli/approve.js +202 -0
  7. package/dist/extensions/forgecli/approve.js.map +1 -0
  8. package/dist/extensions/forgecli/audience-gate.d.ts +4 -0
  9. package/dist/extensions/forgecli/audience-gate.js +8 -5
  10. package/dist/extensions/forgecli/audience-gate.js.map +1 -1
  11. package/dist/extensions/forgecli/collate.d.ts +24 -0
  12. package/dist/extensions/forgecli/collate.js +199 -0
  13. package/dist/extensions/forgecli/collate.js.map +1 -0
  14. package/dist/extensions/forgecli/commit.d.ts +24 -0
  15. package/dist/extensions/forgecli/commit.js +202 -0
  16. package/dist/extensions/forgecli/commit.js.map +1 -0
  17. package/dist/extensions/forgecli/fix-bug.d.ts +75 -0
  18. package/dist/extensions/forgecli/fix-bug.js +1133 -0
  19. package/dist/extensions/forgecli/fix-bug.js.map +1 -0
  20. package/dist/extensions/forgecli/forge-commands.js +7 -0
  21. package/dist/extensions/forgecli/forge-commands.js.map +1 -1
  22. package/dist/extensions/forgecli/forge-init.js +16 -8
  23. package/dist/extensions/forgecli/forge-init.js.map +1 -1
  24. package/dist/extensions/forgecli/forge-subagent.d.ts +29 -0
  25. package/dist/extensions/forgecli/forge-subagent.js +14 -1
  26. package/dist/extensions/forgecli/forge-subagent.js.map +1 -1
  27. package/dist/extensions/forgecli/hook-dispatcher.d.ts +53 -1
  28. package/dist/extensions/forgecli/hook-dispatcher.js +47 -1
  29. package/dist/extensions/forgecli/hook-dispatcher.js.map +1 -1
  30. package/dist/extensions/forgecli/hooks/post-init-hook.d.ts +15 -0
  31. package/dist/extensions/forgecli/hooks/post-init-hook.js +127 -0
  32. package/dist/extensions/forgecli/hooks/post-init-hook.js.map +1 -0
  33. package/dist/extensions/forgecli/hooks/post-sprint-hook.d.ts +37 -0
  34. package/dist/extensions/forgecli/hooks/post-sprint-hook.js +166 -0
  35. package/dist/extensions/forgecli/hooks/post-sprint-hook.js.map +1 -0
  36. package/dist/extensions/forgecli/index.js +47 -0
  37. package/dist/extensions/forgecli/index.js.map +1 -1
  38. package/dist/extensions/forgecli/review-code.d.ts +24 -0
  39. package/dist/extensions/forgecli/review-code.js +202 -0
  40. package/dist/extensions/forgecli/review-code.js.map +1 -0
  41. package/dist/extensions/forgecli/review-plan.d.ts +24 -0
  42. package/dist/extensions/forgecli/review-plan.js +203 -0
  43. package/dist/extensions/forgecli/review-plan.js.map +1 -0
  44. package/dist/extensions/forgecli/run-sprint.d.ts +18 -0
  45. package/dist/extensions/forgecli/run-sprint.js +33 -1
  46. package/dist/extensions/forgecli/run-sprint.js.map +1 -1
  47. package/dist/extensions/forgecli/run-task.d.ts +21 -2
  48. package/dist/extensions/forgecli/run-task.js +33 -9
  49. package/dist/extensions/forgecli/run-task.js.map +1 -1
  50. package/dist/extensions/forgecli/session-registry.d.ts +10 -0
  51. package/dist/extensions/forgecli/session-registry.js +9 -0
  52. package/dist/extensions/forgecli/session-registry.js.map +1 -1
  53. package/dist/extensions/forgecli/validate.d.ts +24 -0
  54. package/dist/extensions/forgecli/validate.js +202 -0
  55. package/dist/extensions/forgecli/validate.js.map +1 -0
  56. package/dist/extensions/forgecli/wf-engine/engine.d.ts +23 -0
  57. package/dist/extensions/forgecli/wf-engine/engine.js +384 -0
  58. package/dist/extensions/forgecli/wf-engine/engine.js.map +1 -0
  59. package/dist/extensions/forgecli/wf-engine/event-parser.d.ts +6 -0
  60. package/dist/extensions/forgecli/wf-engine/event-parser.js +29 -0
  61. package/dist/extensions/forgecli/wf-engine/event-parser.js.map +1 -0
  62. package/dist/extensions/forgecli/wf-engine/id-gen.d.ts +6 -0
  63. package/dist/extensions/forgecli/wf-engine/id-gen.js +17 -0
  64. package/dist/extensions/forgecli/wf-engine/id-gen.js.map +1 -0
  65. package/dist/extensions/forgecli/wf-engine/loader.d.ts +2 -0
  66. package/dist/extensions/forgecli/wf-engine/loader.js +100 -0
  67. package/dist/extensions/forgecli/wf-engine/loader.js.map +1 -0
  68. package/dist/extensions/forgecli/wf-engine/predicate.d.ts +7 -0
  69. package/dist/extensions/forgecli/wf-engine/predicate.js +36 -0
  70. package/dist/extensions/forgecli/wf-engine/predicate.js.map +1 -0
  71. package/dist/extensions/forgecli/wf-engine/prompt-compiler.d.ts +15 -0
  72. package/dist/extensions/forgecli/wf-engine/prompt-compiler.js +23 -0
  73. package/dist/extensions/forgecli/wf-engine/prompt-compiler.js.map +1 -0
  74. package/dist/extensions/forgecli/wf-engine/register.d.ts +9 -0
  75. package/dist/extensions/forgecli/wf-engine/register.js +59 -0
  76. package/dist/extensions/forgecli/wf-engine/register.js.map +1 -0
  77. package/dist/extensions/forgecli/wf-engine/remit-check.d.ts +6 -0
  78. package/dist/extensions/forgecli/wf-engine/remit-check.js +42 -0
  79. package/dist/extensions/forgecli/wf-engine/remit-check.js.map +1 -0
  80. package/dist/extensions/forgecli/wf-engine/state-store.d.ts +13 -0
  81. package/dist/extensions/forgecli/wf-engine/state-store.js +43 -0
  82. package/dist/extensions/forgecli/wf-engine/state-store.js.map +1 -0
  83. package/dist/extensions/forgecli/wf-engine/types.d.ts +66 -0
  84. package/dist/extensions/forgecli/wf-engine/types.js +2 -0
  85. package/dist/extensions/forgecli/wf-engine/types.js.map +1 -0
  86. package/dist/extensions/forgecli/wf-engine/worker.d.ts +11 -0
  87. package/dist/extensions/forgecli/wf-engine/worker.js +50 -0
  88. package/dist/extensions/forgecli/wf-engine/worker.js.map +1 -0
  89. package/dist/forge-payload/.base-pack/workflows/_fragments/context-injection.md +10 -4
  90. package/dist/forge-payload/.base-pack/workflows/fix_bug.md +12 -0
  91. package/dist/forge-payload/.schemas/bug.schema.json +4 -2
  92. package/dist/forge-payload/.schemas/event.schema.json +22 -3
  93. package/dist/forge-payload/commands/add-pipeline.md +342 -0
  94. package/dist/forge-payload/commands/add-task.md +269 -0
  95. package/dist/forge-payload/commands/ask.md +43 -0
  96. package/dist/forge-payload/commands/calibrate.md +356 -0
  97. package/dist/forge-payload/commands/config.md +202 -0
  98. package/dist/forge-payload/commands/enhance.md +38 -0
  99. package/dist/forge-payload/commands/health.md +225 -0
  100. package/dist/forge-payload/commands/init.md +165 -0
  101. package/dist/forge-payload/commands/materialize.md +119 -0
  102. package/dist/forge-payload/commands/migrate.md +160 -0
  103. package/dist/forge-payload/commands/quiz-agent.md +38 -0
  104. package/dist/forge-payload/commands/regenerate.md +673 -0
  105. package/dist/forge-payload/commands/remove.md +174 -0
  106. package/dist/forge-payload/commands/report-bug.md +191 -0
  107. package/dist/forge-payload/commands/store-query.md +73 -0
  108. package/dist/forge-payload/commands/store-repair.md +187 -0
  109. package/dist/forge-payload/commands/update-tools.md +56 -0
  110. package/dist/forge-payload/commands/update.md +1376 -0
  111. package/dist/forge-payload/tools/preflight-gate.cjs +2 -1
  112. package/dist/forge-payload/tools/read-verdict.cjs +41 -8
  113. package/dist/forge-payload/tools/store-cli.cjs +4 -3
  114. package/node_modules/argparse/CHANGELOG.md +216 -0
  115. package/node_modules/argparse/LICENSE +254 -0
  116. package/node_modules/argparse/README.md +84 -0
  117. package/node_modules/argparse/argparse.js +3707 -0
  118. package/node_modules/argparse/lib/sub.js +67 -0
  119. package/node_modules/argparse/lib/textwrap.js +440 -0
  120. package/node_modules/argparse/package.json +31 -0
  121. package/node_modules/cliui/CHANGELOG.md +121 -0
  122. package/node_modules/color-convert/CHANGELOG.md +54 -0
  123. package/node_modules/esprima/ChangeLog +235 -0
  124. package/node_modules/js-yaml/LICENSE +21 -0
  125. package/node_modules/js-yaml/README.md +247 -0
  126. package/node_modules/js-yaml/bin/js-yaml.js +126 -0
  127. package/node_modules/js-yaml/dist/js-yaml.js +3880 -0
  128. package/node_modules/js-yaml/dist/js-yaml.min.js +2 -0
  129. package/node_modules/js-yaml/dist/js-yaml.mjs +3856 -0
  130. package/node_modules/js-yaml/index.js +47 -0
  131. package/node_modules/js-yaml/lib/common.js +59 -0
  132. package/node_modules/js-yaml/lib/dumper.js +965 -0
  133. package/node_modules/js-yaml/lib/exception.js +55 -0
  134. package/node_modules/js-yaml/lib/loader.js +1733 -0
  135. package/node_modules/js-yaml/lib/schema/core.js +11 -0
  136. package/node_modules/js-yaml/lib/schema/default.js +22 -0
  137. package/node_modules/js-yaml/lib/schema/failsafe.js +17 -0
  138. package/node_modules/js-yaml/lib/schema/json.js +19 -0
  139. package/node_modules/js-yaml/lib/schema.js +121 -0
  140. package/node_modules/js-yaml/lib/snippet.js +101 -0
  141. package/node_modules/js-yaml/lib/type/binary.js +125 -0
  142. package/node_modules/js-yaml/lib/type/bool.js +35 -0
  143. package/node_modules/js-yaml/lib/type/float.js +97 -0
  144. package/node_modules/js-yaml/lib/type/int.js +156 -0
  145. package/node_modules/js-yaml/lib/type/map.js +8 -0
  146. package/node_modules/js-yaml/lib/type/merge.js +12 -0
  147. package/node_modules/js-yaml/lib/type/null.js +35 -0
  148. package/node_modules/js-yaml/lib/type/omap.js +44 -0
  149. package/node_modules/js-yaml/lib/type/pairs.js +53 -0
  150. package/node_modules/js-yaml/lib/type/seq.js +8 -0
  151. package/node_modules/js-yaml/lib/type/set.js +29 -0
  152. package/node_modules/js-yaml/lib/type/str.js +8 -0
  153. package/node_modules/js-yaml/lib/type/timestamp.js +88 -0
  154. package/node_modules/js-yaml/lib/type.js +66 -0
  155. package/node_modules/js-yaml/package.json +66 -0
  156. package/node_modules/mz/HISTORY.md +66 -0
  157. package/node_modules/proper-lockfile/CHANGELOG.md +108 -0
  158. package/node_modules/source-map/CHANGELOG.md +301 -0
  159. package/node_modules/thenify/History.md +11 -0
  160. package/node_modules/thenify-all/History.md +11 -0
  161. package/node_modules/y18n/CHANGELOG.md +100 -0
  162. package/node_modules/yargs/CHANGELOG.md +88 -0
  163. package/node_modules/yargs-parser/CHANGELOG.md +263 -0
  164. package/package.json +6 -2
  165. package/workflows/lead-qualifier/prompts/digest.md +44 -0
  166. package/workflows/lead-qualifier/prompts/draft-outreach.md +44 -0
  167. package/workflows/lead-qualifier/prompts/enrich.md +52 -0
  168. package/workflows/lead-qualifier/prompts/intake.md +48 -0
  169. package/workflows/lead-qualifier/prompts/mark-cold.md +38 -0
  170. package/workflows/lead-qualifier/prompts/score.md +45 -0
  171. package/workflows/lead-qualifier/workflow.yaml +95 -0
  172. package/workflows/research-brief/prompts/brief-synthesize.md +43 -0
  173. package/workflows/research-brief/prompts/intake.md +51 -0
  174. package/workflows/research-brief/prompts/source-critique.md +38 -0
  175. package/workflows/research-brief/prompts/source-score.md +38 -0
  176. package/workflows/research-brief/prompts/source-summarize.md +54 -0
  177. package/workflows/research-brief/workflow.yaml +66 -0
  178. package/dist/extensions/forgecli/session-monitor-widget.d.ts +0 -37
  179. package/dist/extensions/forgecli/session-monitor-widget.js +0 -320
  180. package/dist/extensions/forgecli/session-monitor-widget.js.map +0 -1
  181. package/dist/extensions/forgecli/session-monitor.d.ts +0 -2
  182. package/dist/extensions/forgecli/session-monitor.js +0 -135
  183. package/dist/extensions/forgecli/session-monitor.js.map +0 -1
@@ -0,0 +1,202 @@
1
+ ---
2
+ name: config
3
+ description: Inspect or change Forge project configuration. Owns the mode field — the explicit verb for promoting a fast-mode install to full.
4
+ ---
5
+
6
+ # /forge:config
7
+
8
+ Read or change `.forge/config.json` values that are user-facing decisions
9
+ (currently: `mode`). Other config keys remain managed by their respective
10
+ commands (e.g. `paths.forgeRoot` is refreshed by `/forge:update`).
11
+
12
+ ## Locate the Forge plugin
13
+
14
+ ```
15
+ FORGE_ROOT: !`echo "${CLAUDE_PLUGIN_ROOT}"`
16
+ ```
17
+
18
+ Read `.forge/config.json`. If it does not exist, stop and emit:
19
+
20
+ ```
21
+ × .forge/config.json not found. Run /forge:init first.
22
+ ```
23
+
24
+ Then exit. (`manage-config.cjs` already prints this same message on missing
25
+ config, so the user-visible behaviour is consistent if you only invoke the
26
+ tool.)
27
+
28
+ ## Arguments
29
+
30
+ $ARGUMENTS
31
+
32
+ Parse the argument:
33
+
34
+ ```
35
+ /forge:config # Print summary of .forge/config.json
36
+ /forge:config mode # Print current mode
37
+ /forge:config mode full # Promote fast → full
38
+ /forge:config mode fast # Refused (one-way transition)
39
+ ```
40
+
41
+ The command shape is reserved for future expansion (e.g. `/forge:config kb
42
+ <path>`, `/forge:config paths <key> <value>`). Only the subcommands above
43
+ are implemented today.
44
+
45
+ ---
46
+
47
+ ## Visual
48
+
49
+ For all subcommands, open with a single `north` badge (config = bearings):
50
+
51
+ ```sh
52
+ node "$FORGE_ROOT/tools/banners.cjs" --badge north
53
+ ```
54
+
55
+ Subcommands that change state (`mode full`) also render a `forge` badge
56
+ inside the promotion sequence; subcommands that are read-only just print
57
+ the summary after the badge.
58
+
59
+ `banners.cjs` strips ANSI in `NO_COLOR` / non-tty / `--plain` contexts.
60
+
61
+ ---
62
+
63
+ ## Subcommand: `/forge:config` (no args) — summary
64
+
65
+ Read `.forge/config.json`. Emit a summary block:
66
+
67
+ ```
68
+ ━━━ Forge Configuration ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
69
+ mode: {mode | "unset"}
70
+ version: {version}
71
+ project: {project.name} ({project.prefix})
72
+
73
+ Paths
74
+ engineering: {paths.engineering}
75
+ store: {paths.store}
76
+ workflows: {paths.workflows}
77
+ commands: {paths.commands}
78
+ templates: {paths.templates}
79
+ forgeRoot: {paths.forgeRoot}
80
+
81
+ Installed skills ({installedSkills.length})
82
+ {one per line}
83
+ ```
84
+
85
+ Use these tool invocations:
86
+
87
+ ```sh
88
+ node "$FORGE_ROOT/tools/manage-config.cjs" get mode 2>/dev/null || echo "unset"
89
+ node "$FORGE_ROOT/tools/manage-config.cjs" get version
90
+ node "$FORGE_ROOT/tools/manage-config.cjs" get project
91
+ node "$FORGE_ROOT/tools/manage-config.cjs" get paths
92
+ node "$FORGE_ROOT/tools/manage-config.cjs" get installedSkills 2>/dev/null
93
+ ```
94
+
95
+ This subcommand is **read-only** — it never writes to disk.
96
+
97
+ ---
98
+
99
+ ## Subcommand: `/forge:config mode` — print current mode
100
+
101
+ Read the `mode` field. Print one of:
102
+
103
+ ```
104
+ fast
105
+ full
106
+ unset
107
+ ```
108
+
109
+ Use:
110
+ ```sh
111
+ node "$FORGE_ROOT/tools/manage-config.cjs" get mode 2>/dev/null || echo "unset"
112
+ ```
113
+
114
+ Read-only.
115
+
116
+ ---
117
+
118
+ ## Subcommand: `/forge:config mode full` — promote fast → full
119
+
120
+ Promote the project from fast mode to full mode. This is a one-way
121
+ transition: it materialises every deferred artifact and refreshes everything
122
+ that was already materialised, then writes `mode: full`.
123
+
124
+ ### Promotion sequence
125
+
126
+ 1. **Read current mode**:
127
+ ```sh
128
+ CURRENT_MODE=$(node "$FORGE_ROOT/tools/manage-config.cjs" get mode 2>/dev/null || echo "unset")
129
+ ```
130
+
131
+ 2. **Short-circuit if already full**:
132
+ - If `CURRENT_MODE == "full"`: emit `〇 Already in full mode. Nothing to do.` and exit 0.
133
+ - If `CURRENT_MODE == "unset"`: treat as `full` (the project predates the
134
+ mode field — it is already a full install). Emit
135
+ `〇 mode is unset (legacy full install). Writing mode: full.`, then jump
136
+ to Step 5 (skip materialize + regenerate, just write the field).
137
+
138
+ 3. **Emit promotion banner** (forge badge + em-dash separator):
139
+ ```sh
140
+ node "$FORGE_ROOT/tools/banners.cjs" --badge forge
141
+ ```
142
+ ```
143
+ ━━━ Promoting to Full Mode ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
144
+ ```
145
+
146
+ 4. **Run materialize-all**: read `$FORGE_ROOT/commands/materialize.md` and
147
+ follow the **Full warm-up** branch (no arguments). This fills any
148
+ missing or stubbed personas, skills, templates, and workflows.
149
+
150
+ This step is intentionally invoked by reading the rulebook — do not
151
+ inline its logic. If materialize errors, surface the error and stop;
152
+ do not write `mode: full`.
153
+
154
+ 5. **Run default regenerate**: read `$FORGE_ROOT/commands/regenerate.md`
155
+ and follow the **Default (no argument)** branch. With everything now
156
+ materialised, every artifact gets refreshed against the current
157
+ meta-definitions.
158
+
159
+ If regenerate errors, surface the error and stop; do not write
160
+ `mode: full`.
161
+
162
+ 6. **Write `mode: full`**:
163
+ ```sh
164
+ node "$FORGE_ROOT/tools/manage-config.cjs" set mode full
165
+ ```
166
+
167
+ 7. **Emit completion**:
168
+ ```
169
+ 〇 Promoted to full mode.
170
+ ```
171
+
172
+ ### Invariant
173
+
174
+ This is the only code path in the Forge plugin that writes `mode: full`
175
+ after initial install. `regenerate` and `materialize` are
176
+ mode-neutral — they read mode but never write it.
177
+
178
+ ---
179
+
180
+ ## Subcommand: `/forge:config mode fast` — refused
181
+
182
+ Read the current mode.
183
+
184
+ - If `CURRENT_MODE == "fast"` (or `unset`): emit
185
+ `〇 Already in fast mode.` and exit 0.
186
+ - Otherwise: emit and exit non-zero (status 1):
187
+ ```
188
+ × Cannot downgrade full → fast. Use /forge:remove and re-init to reset.
189
+ ```
190
+
191
+ There is no automatic full → fast transition — the artefacts that were
192
+ materialised in full mode are real files with content; "demoting" them
193
+ would mean deleting work without telling the user what was lost. The
194
+ remove-and-re-init path is the explicit, observable way to reset.
195
+
196
+ ---
197
+
198
+ ## On error
199
+
200
+ If any step above fails unexpectedly, describe what went wrong and ask:
201
+
202
+ > "This looks like a Forge bug. Would you like to file a report to help improve it? Run `/forge:report-bug` — I'll pre-fill the report from this conversation."
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: enhance
3
+ description: Run the enhancement agent to fill placeholders, propose persona enrichments, or detect drift
4
+ ---
5
+
6
+ # /forge:enhance
7
+
8
+ Run the Enhancement Agent to improve installed `.forge/` structural elements. The agent
9
+ operates in three modes selected by the `--phase` flag.
10
+
11
+ ## Locate the Forge plugin
12
+
13
+ ```
14
+ FORGE_ROOT: !`echo "${CLAUDE_PLUGIN_ROOT}"`
15
+ ```
16
+
17
+ Read `$FORGE_ROOT/meta/workflows/meta-enhance.md` and follow it. Pass `$ARGUMENTS` through
18
+ so the workflow receives the phase flag and any other options.
19
+
20
+ ## Arguments
21
+
22
+ $ARGUMENTS
23
+
24
+ | Flag | Purpose |
25
+ |------|---------|
26
+ | `--phase 1` | Auto-apply: fill unsubstituted `{{KEY}}` placeholders using codebase signals (post-init mode) |
27
+ | `--phase 2` | Propose diffs: scan sprint artifacts and friction events; propose persona/skill enrichments for user review |
28
+ | `--phase 3` | Drift detection: full codebase vs structural-element comparison; propose targeted patches |
29
+ | `--auto` | Synonym for `--phase 1` — used by the post-init hook (T09) |
30
+
31
+ Default: `--phase 3` when no flag is provided.
32
+
33
+ ## On error
34
+
35
+ If the enhancement workflow is not found at `$FORGE_ROOT/meta/workflows/meta-enhance.md`,
36
+ emit:
37
+
38
+ > △ meta-enhance.md not found — your installed Forge version may predate the enhancement agent. Run `/forge:update` to upgrade.
@@ -0,0 +1,225 @@
1
+ ---
2
+ name: health
3
+ description: Use when you want to check if the engineering knowledge base is stale, has gaps, or has store integrity issues
4
+ ---
5
+
6
+ # /forge:health
7
+
8
+ Assess the health and currency of the project's SDLC knowledge base.
9
+
10
+ ## Checks
11
+
12
+ | Check | What It Detects |
13
+ |-------|----------------|
14
+ | **Config completeness** | Missing required fields in `.forge/config.json` — blocks further checks if incomplete |
15
+ | **KB freshness** | Hash mismatch between current `MASTER_INDEX.md` and calibration baseline — detects technical or business drift |
16
+ | **Stale docs** | Architecture sub-docs not updated in N sprints |
17
+ | **Orphaned entities** | Entities in code (ORM models, types) not in `engineering/business-domain/entity-model.md` |
18
+ | **Unused checklist items** | Stack-checklist items never triggered in reviews |
19
+ | **Coverage gaps** | Architecture areas with no sub-document |
20
+ | **Writeback backlog** | `[?]` items not yet confirmed by a retrospective |
21
+ | **Store integrity** | Run `node "$FORGE_ROOT/tools/validate-store.cjs" --dry-run` |
22
+ | **Modified generated files** | Generated files that have been manually edited since last recorded — run `node "$FORGE_ROOT/tools/generation-manifest.cjs" list --modified` |
23
+ | **Generated file structure** | Files expected by the plugin's structure-manifest that are absent from `.forge/` or `.claude/commands/` |
24
+ | **Skill gaps** | Marketplace skills relevant to the stack that are not installed |
25
+ | **Feature Test Coverage** | Features with zero tagged tests |
26
+ | **Concepts freshness** | `docs/concepts/*.md` pages older than `forge/meta/store-schema/` updates |
27
+ | **Context pack freshness** | `source_hash` in `.forge/cache/context-pack.json` vs. current hash of `engineering/architecture/*.md` |
28
+ | **Plugin integrity** | Plugin command and agent files modified since last release hash was recorded |
29
+
30
+ ## How to run
31
+
32
+ First, resolve the plugin root and project root:
33
+ ```
34
+ FORGE_ROOT: !`echo "${CLAUDE_PLUGIN_ROOT}"`
35
+ ```
36
+
37
+ Open the run with the oracle hero + subtitle:
38
+
39
+ ```sh
40
+ node "$FORGE_ROOT/tools/banners.cjs" oracle
41
+ node "$FORGE_ROOT/tools/banners.cjs" --subtitle "Reading the project's pulse — config, KB freshness, store integrity, structural completeness"
42
+ ```
43
+
44
+ `banners.cjs` strips ANSI in `NO_COLOR` / non-tty / `--plain` contexts.
45
+
46
+ Parse `$ARGUMENTS` for a `--path <dir>` argument:
47
+ - If present, `PROJECT_ROOT = <dir>` (absolute or relative to the current working directory — resolve to absolute).
48
+ - If absent, `PROJECT_ROOT = .` (current working directory).
49
+
50
+ All file paths below are relative to `PROJECT_ROOT`. All shell tool invocations must be run from `PROJECT_ROOT`:
51
+ ```sh
52
+ cd "$PROJECT_ROOT" && node "$FORGE_ROOT/tools/..."
53
+ ```
54
+
55
+ 1. **Config-completeness check** — Read `$PROJECT_ROOT/.forge/config.json`.
56
+ If it does not exist, stop and tell the user to run `/forge:init` in that directory first.
57
+ If it exists, validate it against `$FORGE_ROOT/sdlc-config.schema.json`:
58
+ - Read the schema and extract all `required` fields at each level (top-level and nested objects).
59
+ - Required top-level fields: `version`, `project`, `stack`, `commands`, `paths`.
60
+ - Nested required fields: `project.prefix`, `project.name`, `commands.test`, `paths.engineering`, `paths.store`, `paths.workflows`, `paths.commands`, `paths.templates`.
61
+ - For each required field, verify it exists in the config and has a non-empty value.
62
+ - If all required fields are present and non-empty, emit:
63
+ > 〇 Config complete — all required fields present.
64
+ - If any required fields are missing or empty, list each missing field by path (e.g. `project.prefix`, `commands.test`) with a short description, then **exit early** with:
65
+ > △ Config incomplete — missing required fields:
66
+ > · `project.prefix` — short project prefix (e.g. ACME)
67
+ > · `commands.test` — test command (e.g. npm test)
68
+ >
69
+ > Run `/forge:init` to complete configuration.
70
+ Do **not** cascade into subsequent checks that may fail on incomplete config.
71
+ 2. **KB freshness check** — Read `calibrationBaseline` from `$PROJECT_ROOT/.forge/config.json`.
72
+ - If `calibrationBaseline` is absent, emit:
73
+ > △ No calibration baseline found — run `/forge:calibrate` to establish one.
74
+ Skip the freshness check and proceed to step 3.
75
+ - If `calibrationBaseline` exists, compute the current hash of `MASTER_INDEX.md` using the same algorithm as `/forge:init`:
76
+ ```sh
77
+ cd "$PROJECT_ROOT" && node -e "const crypto=require('crypto'),fs=require('fs'); const cfg=JSON.parse(fs.readFileSync('.forge/config.json','utf8')); const engPath=(cfg.paths&&cfg.paths.engineering)||'engineering'; const lines=fs.readFileSync(engPath+'/MASTER_INDEX.md','utf8').split('\n').filter(l=>l.trim()&&!l.trim().startsWith('<!--')); console.log(crypto.createHash('sha256').update(lines.join('\n')).digest('hex'))"
78
+ ```
79
+ - Compare the computed hash against `calibrationBaseline.masterIndexHash`:
80
+ - If they match, emit:
81
+ > 〇 KB fresh — no drift since last calibration (last calibrated: `calibrationBaseline.lastCalibrated`, version: `calibrationBaseline.version`)
82
+ - If they differ, read `$PROJECT_ROOT/engineering/MASTER_INDEX.md` and categorize the drift based on which sections have changed. Categorize sections as follows:
83
+ - **Technical sections**: stack, routing, database, deployment, processes, architecture, schemas, conventions, stack-checklist
84
+ - **Business sections**: entity-model, domain, features, acceptance criteria, business-domain
85
+ If changes are only in technical sections: emit "technical". If only in business sections: emit "business". If in both: emit "technical + business".
86
+ Emit:
87
+ > △ KB drifted — <category> changes detected since last calibration (last calibrated: `calibrationBaseline.lastCalibrated`)
88
+ > Run `/forge:calibrate` to re-align the knowledge base.
89
+ 3. Read the knowledge base files in `$PROJECT_ROOT/engineering/`
90
+ 4. Read the store in `$PROJECT_ROOT/.forge/store/` for sprint/task history
91
+ 5. Scan the codebase for entities not in the knowledge base (Grep for model/type definitions)
92
+ 6. Run store validation:
93
+ ```sh
94
+ cd "$PROJECT_ROOT" && node "$FORGE_ROOT/tools/validate-store.cjs" --dry-run
95
+ ```
96
+ Include the result in the report.
97
+ 7. Check modified generated files:
98
+ ```sh
99
+ cd "$PROJECT_ROOT" && node "$FORGE_ROOT/tools/generation-manifest.cjs" list --modified
100
+ ```
101
+ If any modified or missing files are reported, include them in the health
102
+ report under **Modified generated files** with the note:
103
+ > These files were manually edited after generation. Regeneration will warn
104
+ > before overwriting them. Run `/forge:regenerate` to review and update.
105
+ If all files are pristine (or the tool is absent), omit this section.
106
+ 8. Check generated file structure:
107
+ ```sh
108
+ cd "$PROJECT_ROOT" && node "$FORGE_ROOT/tools/check-structure.cjs" --path "$PROJECT_ROOT"
109
+ ```
110
+ If missing files are reported, include them in the health report under
111
+ **Generated file structure** with note:
112
+ > N expected file(s) are missing from generated output. Run `/forge:update` to
113
+ > regenerate missing files, or `/forge:regenerate <namespace>` for targeted repair.
114
+ If all files are present (exit 0), emit:
115
+ > 〇 Generated file structure — all expected files present.
116
+ If the tool is absent (file not found), skip this check silently.
117
+ Note: custom `paths.*` overrides in `.forge/config.json` are respected by
118
+ check-structure.cjs. Projects using default paths will see no difference.
119
+ 9. Check skill gaps: run `node "$FORGE_ROOT/tools/list-skills.js"` to get the live
120
+ installed skill list from `~/.claude/plugins/installed_plugins.json` (source of
121
+ truth — not the config, which can be stale). Read `$FORGE_ROOT/meta/skill-recommendations.md`,
122
+ cross-reference the stack against live installed skills, report any uninstalled
123
+ high-confidence recommendations with one-line install instructions. If the live
124
+ list differs from `installedSkills` in config, update config to match.
125
+ 10. Check test coverage for active features:
126
+ - Read `$PROJECT_ROOT/.forge/store/features/` to find all features with `"status": "active"`.
127
+ - If zero active features exist, skip this check.
128
+ - Otherwise, scan all test directories under `$PROJECT_ROOT` (e.g. `test/`, `tests/`, `spec/`, `__tests__/`) and test files (`*.test.*`, `*.spec.*`) for the `FEAT-NNN` identifier of each active feature.
129
+ - You should account for three tag forms: filename (`feat-NNN-login.test.js`), test name string (`describe('[FEAT-NNN]')`), or docblock comment (`// @feat FEAT-NNN`).
130
+ - For each active feature, report the count of test files or names matching its ID.
131
+ - Warn explicitly: `⚠ FEAT-NNN has 0 tagged tests` if an active feature has zero hits.
132
+ 11. Check concepts freshness:
133
+ - Compare the modification timestamps of files in `$PROJECT_ROOT/docs/concepts/*.md` against the newest schema modification in `$FORGE_ROOT/meta/store-schema/`.
134
+ - If any concept doc is older than the newest schema change, emit a notice that it may be stale.
135
+ 12. Check persona pack freshness:
136
+ - If `$PROJECT_ROOT/.forge/cache/persona-pack.json` does not exist, emit:
137
+ > △ Persona pack missing — run `/forge:regenerate` to build it.
138
+ (The pack is consumed by `meta-orchestrate` and `meta-fix-bug` when `FORGE_PROMPT_MODE=reference`.)
139
+ - Otherwise read the pack's `source_hash`, then compute the current hash:
140
+ ```sh
141
+ CURRENT=$(node -e "const t=require('$FORGE_ROOT/tools/build-persona-pack.cjs'); console.log(t.computeSourceHash({personaDir:'$FORGE_ROOT/meta/personas', skillDir:'$FORGE_ROOT/meta/skills'}))")
142
+ STORED=$(node -e "console.log(require('$PROJECT_ROOT/.forge/cache/persona-pack.json').source_hash)")
143
+ ```
144
+ If `CURRENT != STORED`, emit:
145
+ > △ Persona pack stale — meta/ has changed since last build. Run `/forge:regenerate` to refresh.
146
+ Otherwise emit:
147
+ > 〇 Persona pack fresh.
148
+ 13. Check context pack freshness:
149
+ - Compute the current source hash over `engineering/architecture/*.md`
150
+ (excluding `*.draft.md`) using the same algorithm as `build-context-pack.cjs`:
151
+ ```sh
152
+ ENGINEERING=$(node "$FORGE_ROOT/tools/manage-config.cjs" get paths.engineering 2>/dev/null || echo engineering)
153
+ node "$FORGE_ROOT/tools/build-context-pack.cjs" --arch-dir "$ENGINEERING/architecture" 2>/dev/null
154
+ # The tool exports computeSourceHash — call it programmatically if preferred:
155
+ CURRENT=$(node -e "const t=require('$FORGE_ROOT/tools/build-context-pack.cjs'); try { console.log(t.computeSourceHash('$PROJECT_ROOT/$ENGINEERING/architecture')); } catch(e) { console.log('n/a'); }")
156
+ ```
157
+ - If `engineering/architecture/` does not exist, skip this check silently.
158
+ - If `.forge/cache/context-pack.json` does not exist, emit:
159
+ > △ Context pack missing — run `/forge:regenerate` to build it.
160
+ (The pack is injected by `meta-orchestrate` and `meta-fix-bug` to reduce per-phase architecture reads.)
161
+ - Otherwise read `source_hash` from `.forge/cache/context-pack.json` and compare:
162
+ ```sh
163
+ STORED=$(node -e "console.log(require('$PROJECT_ROOT/.forge/cache/context-pack.json').source_hash)")
164
+ ```
165
+ If `CURRENT != STORED` (and `CURRENT != 'n/a'`), emit:
166
+ > △ Context pack stale — architecture docs have changed since last build. Run `/forge:regenerate` or `/forge:collate` to rebuild.
167
+ Otherwise emit:
168
+ > 〇 Context pack fresh.
169
+ 14. Check plugin integrity:
170
+ First, verify the integrity verifier itself has not been tampered with:
171
+ ```sh
172
+ ACTUAL=$(node -e "const c=require('crypto'),f=require('fs'); console.log(c.createHash('sha256').update(f.readFileSync('$FORGE_ROOT/tools/verify-integrity.cjs')).digest('hex'))")
173
+ EXPECTED="3ec3c970dd3d7c3001f8f373bcc40556803eadd2fc2afafb14f1c232cba4cc3f"
174
+ ```
175
+ If `ACTUAL != EXPECTED`, emit:
176
+ > △ Integrity verifier itself appears modified — run `/forge:update` to restore. Skipping integrity check.
177
+ And skip the rest of this step.
178
+
179
+ If the verifier hash matches, run:
180
+ ```sh
181
+ node "$FORGE_ROOT/tools/verify-integrity.cjs" --forge-root "$FORGE_ROOT"
182
+ ```
183
+ Include the output line verbatim in the report (it already uses 〇/△/× format).
184
+ Note: local verification is tamper-evident, not tamper-proof. `/forge:update` is
185
+ the authoritative restore path.
186
+
187
+ 15. Report all findings with actionable recommendations.
188
+ If `--path` was used, open the report with: `Health report for: $PROJECT_ROOT`
189
+ 16. Close the report with: `If you've found a bug in Forge itself, run /forge:report-bug`
190
+
191
+ ## Output
192
+
193
+ A health report to stdout — no files modified.
194
+
195
+ After the report's findings, close with a single status line that
196
+ reflects the overall verdict (synthesized from check 12's findings):
197
+
198
+ ```sh
199
+ # Pick one of three status emojis based on the worst finding observed:
200
+ # 〇 = all checks pass (green)
201
+ # △ = warnings, no errors (caution)
202
+ # × = at least one failure (alert)
203
+ node "$FORGE_ROOT/tools/banners.cjs" --subtitle "{〇|△|×} Health check complete — {N} 〇, {W} △, {E} ×"
204
+ ```
205
+
206
+ If exactly zero issues were found, also re-render the oracle badge as a
207
+ "sealed" closing mark:
208
+
209
+ ```sh
210
+ node "$FORGE_ROOT/tools/banners.cjs" --badge oracle
211
+ ```
212
+
213
+ ## Arguments
214
+
215
+ $ARGUMENTS
216
+
217
+ | Argument | Purpose |
218
+ |----------|---------|
219
+ | `--path <dir>` | Run health check against a different project directory instead of the current working directory. Accepts an absolute path or a path relative to the current directory. |
220
+
221
+ ## On error
222
+
223
+ If any step above fails unexpectedly, describe what went wrong and ask:
224
+
225
+ > "This looks like a Forge bug. Would you like to file a report to help improve it? Run `/forge:report-bug` — I'll pre-fill the report from this conversation."
@@ -0,0 +1,165 @@
1
+ ---
2
+ name: init
3
+ description: Use when the current project has no Forge SDLC instance and you need to bootstrap one from scratch
4
+ ---
5
+
6
+ # /forge:init
7
+
8
+ You are the Forge init orchestrator. Your job is to generate a complete, project-specific
9
+ AI software development lifecycle for the codebase in the current working directory.
10
+
11
+ ## Locate the Forge plugin
12
+
13
+ Set `$FORGE_ROOT` to the plugin root provided by Claude Code:
14
+
15
+ ```
16
+ FORGE_ROOT: !`echo "${CLAUDE_PLUGIN_ROOT}"`
17
+ ```
18
+
19
+ `$FORGE_ROOT` is the directory containing `meta/`, `init/`, `hooks/`, and `commands/`.
20
+
21
+ ## Execute
22
+
23
+ ### Resume Detection
24
+
25
+ Before showing the pre-flight plan, check for an existing checkpoint:
26
+
27
+ ```sh
28
+ cat .forge/init-progress.json 2>/dev/null
29
+ ```
30
+
31
+ If the file exists and contains valid JSON, inspect it:
32
+
33
+ - If `lastPhase > 4`, contains a `mode` field, contains a `phase-7-substep-map` key,
34
+ or is missing a `timestamp` field — treat as a stale checkpoint from a previous
35
+ run of the old 12-phase init. Delete the file:
36
+ ```sh
37
+ rm -f .forge/init-progress.json
38
+ ```
39
+ Then proceed to the **Pre-flight Plan** (new 4-phase flow, no mode prompt).
40
+
41
+ - If the file contains valid JSON with `lastPhase` in range 1–4 and a `timestamp`
42
+ field, emit the resume banner:
43
+
44
+ ```
45
+ 〇 Previous init detected — last completed phase: {lastPhase} of 4
46
+
47
+ Resume from Phase {nextPhase}? [Y] Start over [n]
48
+ ```
49
+
50
+ Use the following mapping:
51
+
52
+ | lastPhase | Resume from (nextPhase) |
53
+ |-----------|-------------------------|
54
+ | 1 | Phase 2 |
55
+ | 2 | Phase 3 |
56
+ | 3 | Phase 4 |
57
+
58
+ If the user chooses to resume: jump to the mapped resume phase.
59
+
60
+ If the user chooses to start over: delete `.forge/init-progress.json`
61
+ (`rm -f .forge/init-progress.json`) and proceed to the **Pre-flight Plan**.
62
+
63
+ If the file does not exist, or contains invalid JSON, or contains an
64
+ unrecognised `lastPhase` value outside 1–4: delete any corrupt file and
65
+ proceed to the **Pre-flight Plan**.
66
+
67
+ If parsing the file throws (malformed JSON): log a one-line warning
68
+ `△ init-progress.json is malformed — deleting and starting fresh.`, delete
69
+ the file, and proceed to the **Pre-flight Plan**.
70
+
71
+ ### Hero
72
+
73
+ Render the Forge hero block once per session:
74
+
75
+ ```sh
76
+ node "$FORGE_ROOT/tools/banners.cjs" forge
77
+ node "$FORGE_ROOT/tools/banners.cjs" --subtitle "AI SDLC bootstrapper · forge:init v$(node -p "require('$FORGE_ROOT/.claude-plugin/plugin.json').version")"
78
+ ```
79
+
80
+ The hero runs once. If the user resumes mid-init, do NOT re-render the hero —
81
+ just emit the phase banner for the resume target phase.
82
+
83
+ ### Flag handling
84
+
85
+ **Conflict check first:** if `$ARGUMENTS` contains BOTH `--fast` AND `--full`, halt
86
+ immediately with:
87
+ ```
88
+ × Conflicting flags: --fast and --full cannot be combined.
89
+ ```
90
+ Do not write `.forge/init-progress.json`. Do not proceed.
91
+
92
+ **Single flag present (`--fast` or `--full`):** accept with a one-line acknowledgement
93
+ and continue to **Pre-flight Plan** — both flags run the identical new 4-phase flow:
94
+
95
+ - `--fast` present → emit `〇 --fast accepted — running 4-phase base-pack init (fast and full are now equivalent)`
96
+ - `--full` present → emit `〇 --full accepted — running 4-phase base-pack init`
97
+
98
+ **No flags:** proceed directly to **Pre-flight Plan**. There is no interactive mode
99
+ prompt — the 4-phase flow is the only flow.
100
+
101
+ ### Pre-flight Plan
102
+
103
+ Before executing Phase 1, emit a summary block and wait for the user to confirm
104
+ or specify a start phase.
105
+
106
+ ```
107
+ ## Forge Init — <project-name if discoverable, otherwise current directory name>
108
+
109
+ 4 phases will run in this session (~45 seconds non-interactive):
110
+
111
+ 1 Collect — 5 parallel discovery scans → config.json
112
+ KB folder prompt (interactive)
113
+ 2 Discover — KB doc generation (LLM fan-out) + project-context.json
114
+ 3 Materialize — substitute-placeholders.cjs → fully functional workflows
115
+ 4 Register — versioning, manifest, cache, store entries, Tomoshibi
116
+
117
+ Phase 1 is interactive (KB folder name prompt). Phases 2–4 are non-interactive
118
+ and complete in under 45 seconds.
119
+
120
+ Start from Phase 1? [Y] or specify phase (1–4): ___
121
+ ```
122
+
123
+ If the user specifies a valid phase (1–4), jump there directly.
124
+ Any other input (including 0, 5+, or non-numeric text) re-prompts with the same table.
125
+
126
+ If a `$ARGUMENTS` phase number was combined with a flag (e.g. `--fast 3`),
127
+ skip both the flag acknowledgement and the pre-flight table and go straight
128
+ to the specified phase.
129
+
130
+ Read `$FORGE_ROOT/init/sdlc-init.md` — that document is your complete orchestration.
131
+ Follow it exactly. It defines 4 phases:
132
+
133
+ 1. **Collect** — 5 parallel discovery prompts, KB folder prompt, `config.json`
134
+ 2. **Discover** — KB doc fan-out + inline `project-context.json` construction
135
+ 3. **Materialize** — `substitute-placeholders.cjs` + `build-overlay.cjs` smoke test
136
+ 4. **Register** — tools, versioning, manifest, cache, store seed, Tomoshibi, `.gitignore` update (unconditional), CLAUDE.md KB-link offer
137
+
138
+ The current working directory is the target project. All generated artifacts go into
139
+ `.forge/`, the configured KB folder (default: `engineering/`), and `.claude/commands/`
140
+ in the project.
141
+
142
+ ## Arguments
143
+
144
+ $ARGUMENTS
145
+
146
+ ### Mode flags (backwards compatibility)
147
+
148
+ `--fast` and `--full` are accepted for scripted and CI use. Both flags select the
149
+ new 4-phase base-pack init — the distinction between fast and full mode is
150
+ obsolete because base-pack template substitution is instant and always produces
151
+ fully functional (non-stub) workflows.
152
+
153
+ #### Conflicting flags
154
+
155
+ `--fast` and `--full` together halt the run before any write:
156
+
157
+ ```
158
+ × Conflicting flags: --fast and --full cannot be combined.
159
+ ```
160
+
161
+ ## On error
162
+
163
+ If any step above fails unexpectedly, describe what went wrong and ask:
164
+
165
+ > "This looks like a Forge bug. Would you like to file a report to help improve it? Run `/forge:report-bug` — I'll pre-fill the report from this conversation."