@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,174 @@
1
+ ---
2
+ name: remove
3
+ description: Use when you want to remove Forge from the current project, with options for what to keep
4
+ ---
5
+
6
+ # /forge:remove
7
+
8
+ Remove Forge artifacts from the current project. This command is interactive —
9
+ nothing is deleted until you confirm explicitly.
10
+
11
+ ## What Forge puts in a project
12
+
13
+ | Location | Contents | Safe to remove? |
14
+ |---|---|---|
15
+ | `.forge/` | Config, workflows, templates, task/sprint/bug store | Yes — regeneratable via `/forge:init` |
16
+ | `.claude/commands/` | Generated slash commands (sprint-plan, run-task, etc.) | Yes — regeneratable via `/forge:init` |
17
+ | `{KB_PATH}/` | Knowledge base, sprint history, bug history, tools | **Caution** — represents accumulated project learning |
18
+
19
+ ## Step 1 — Inventory what exists
20
+
21
+ Read the configured KB path and project prefix from config:
22
+
23
+ ```sh
24
+ FORGE_ROOT: !`echo "${CLAUDE_PLUGIN_ROOT}"`
25
+ KB_PATH: !`node -e "try{console.log(require('./.forge/config.json').paths.engineering)}catch{console.log('engineering')}"`
26
+ PREFIX: !`node -e "try{console.log(require('./.forge/config.json').project.prefix.toLowerCase())}catch{console.log('')}"`
27
+ ```
28
+
29
+ If `PREFIX` is empty or `.forge/config.json` is unreadable, fall back to scanning both
30
+ `.claude/commands/` and all immediate subdirectories for the 13 known filenames and remove
31
+ whatever is found. Log a warning: `△ Could not read project prefix from config — scanning for commands in all locations.`
32
+
33
+ Check which Forge directories are present:
34
+
35
+ ```
36
+ exists: !`[ -d ".forge" ] && echo "YES" || echo "NO"`
37
+ exists: !`[ -d "{KB_PATH}" ] && echo "YES" || echo "NO"`
38
+ exists: !`[ -d ".claude/commands" ] && echo "YES" || echo "NO"`
39
+ ```
40
+
41
+ Report to the user exactly what was found before proceeding (use the actual KB path value, e.g. `engineering/` or `ai-docs/`).
42
+
43
+ ## Step 2 — Present options
44
+
45
+ Show the user these options:
46
+
47
+ ```
48
+ Forge removal options:
49
+
50
+ [1] Minimal — remove .forge/ only
51
+ Removes config, workflows, templates, and the task/sprint/bug store.
52
+ Leaves {KB_PATH}/ and .claude/commands/ intact.
53
+ Use this to reset Forge config while keeping your knowledge base.
54
+
55
+ [2] Standard — remove .forge/ and generated commands
56
+ Removes .forge/ and the Forge-generated commands in .claude/commands/.
57
+ Leaves {KB_PATH}/ intact.
58
+ Recommended for most removals — your knowledge base survives.
59
+
60
+ [3] Full — remove everything
61
+ Removes .forge/, generated commands, AND {KB_PATH}/.
62
+ Your knowledge base, sprint history, and bug history will be lost.
63
+ This cannot be undone.
64
+
65
+ Which option? (1 / 2 / 3)
66
+ ```
67
+
68
+ Wait for the user's choice before proceeding.
69
+
70
+ ## Step 3 — Confirm KB folder removal (option 3 only)
71
+
72
+ If the user chose option 3, ask explicitly (using the actual KB_PATH value):
73
+
74
+ ```
75
+ {KB_PATH}/ contains your accumulated knowledge base — architecture docs,
76
+ entity model, stack checklist, sprint history, and bug history. This represents
77
+ real learning that took sprints to build.
78
+
79
+ Are you sure you want to delete it?
80
+ Type "delete {KB_PATH}" to confirm, or anything else to keep it and use option 2 instead.
81
+ ```
82
+
83
+ If they do not type exactly `delete {KB_PATH}` (with the actual path, e.g. `delete engineering`
84
+ or `delete ai-docs`), downgrade to option 2 and inform them.
85
+
86
+ ## Step 4 — Final confirmation
87
+
88
+ Summarise exactly what will be deleted, then ask:
89
+
90
+ ```
91
+ About to delete:
92
+ ✗ .forge/
93
+ ✗ .claude/commands/{PREFIX}/sprint-intake.md
94
+ ✗ .claude/commands/{PREFIX}/sprint-plan.md
95
+ ✗ .claude/commands/{PREFIX}/run-task.md
96
+ ✗ .claude/commands/{PREFIX}/run-sprint.md
97
+ ✗ .claude/commands/{PREFIX}/plan.md
98
+ ✗ .claude/commands/{PREFIX}/review-plan.md
99
+ ✗ .claude/commands/{PREFIX}/implement.md
100
+ ✗ .claude/commands/{PREFIX}/review-code.md
101
+ ✗ .claude/commands/{PREFIX}/fix-bug.md
102
+ ✗ .claude/commands/{PREFIX}/approve.md
103
+ ✗ .claude/commands/{PREFIX}/commit.md
104
+ ✗ .claude/commands/{PREFIX}/collate.md
105
+ ✗ .claude/commands/{PREFIX}/retrospective.md
106
+ [✗ {KB_PATH}/] ← only if option 3 confirmed
107
+
108
+ Type "confirm" to proceed, or anything else to cancel.
109
+ ```
110
+
111
+ Only proceed if the user types exactly `confirm`.
112
+
113
+ ## Step 5 — Execute
114
+
115
+ Remove only the confirmed items. Use targeted commands — never `rm -rf .`:
116
+
117
+ **Option 1 (minimal):**
118
+ ```bash
119
+ rm -rf .forge/
120
+ ```
121
+
122
+ **Option 2 (standard):**
123
+ ```bash
124
+ rm -rf .forge/
125
+ rm -f ".claude/commands/${PREFIX}/sprint-intake.md" \
126
+ ".claude/commands/${PREFIX}/sprint-plan.md" \
127
+ ".claude/commands/${PREFIX}/run-task.md" \
128
+ ".claude/commands/${PREFIX}/run-sprint.md" \
129
+ ".claude/commands/${PREFIX}/plan.md" \
130
+ ".claude/commands/${PREFIX}/review-plan.md" \
131
+ ".claude/commands/${PREFIX}/implement.md" \
132
+ ".claude/commands/${PREFIX}/review-code.md" \
133
+ ".claude/commands/${PREFIX}/fix-bug.md" \
134
+ ".claude/commands/${PREFIX}/approve.md" \
135
+ ".claude/commands/${PREFIX}/commit.md" \
136
+ ".claude/commands/${PREFIX}/collate.md" \
137
+ ".claude/commands/${PREFIX}/retrospective.md"
138
+ rmdir ".claude/commands/${PREFIX}" 2>/dev/null || true
139
+ ```
140
+
141
+ **Option 3 (full):**
142
+ ```bash
143
+ rm -rf .forge/ "{KB_PATH}/"
144
+ rm -f ".claude/commands/${PREFIX}/sprint-intake.md" \
145
+ ".claude/commands/${PREFIX}/sprint-plan.md" \
146
+ ".claude/commands/${PREFIX}/run-task.md" \
147
+ ".claude/commands/${PREFIX}/run-sprint.md" \
148
+ ".claude/commands/${PREFIX}/plan.md" \
149
+ ".claude/commands/${PREFIX}/review-plan.md" \
150
+ ".claude/commands/${PREFIX}/implement.md" \
151
+ ".claude/commands/${PREFIX}/review-code.md" \
152
+ ".claude/commands/${PREFIX}/fix-bug.md" \
153
+ ".claude/commands/${PREFIX}/approve.md" \
154
+ ".claude/commands/${PREFIX}/commit.md" \
155
+ ".claude/commands/${PREFIX}/collate.md" \
156
+ ".claude/commands/${PREFIX}/retrospective.md"
157
+ rmdir ".claude/commands/${PREFIX}" 2>/dev/null || true
158
+ ```
159
+
160
+ After removal, verify the directories are gone and report what was removed.
161
+
162
+ ## Step 6 — Close
163
+
164
+ Confirm completion and remind the user:
165
+
166
+ - To reinstall Forge in this project: `/forge:init`
167
+ - The plugin itself is unaffected — only project artifacts were removed
168
+ - To uninstall the plugin entirely: `/plugin uninstall forge`
169
+
170
+ ## On error
171
+
172
+ If any step above fails unexpectedly, describe what went wrong and ask:
173
+
174
+ > "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,191 @@
1
+ ---
2
+ name: report-bug
3
+ description: Use when you encounter a bug in Forge itself and want to file it as a GitHub issue in the Entelligentsia/forge repository
4
+ ---
5
+
6
+ # /forge:report-bug
7
+
8
+ File a bug report against Forge itself (not your project). This command
9
+ gathers context automatically, lets you describe what went wrong, shows
10
+ a draft, and files the issue to `Entelligentsia/forge` via `gh`.
11
+
12
+ ## Step 1 — Check prerequisites
13
+
14
+ Verify `gh` is available and authenticated:
15
+
16
+ ```
17
+ gh_check: !`gh auth status 2>&1 | head -3`
18
+ ```
19
+
20
+ If `gh` is not installed or not authenticated, stop and tell the user:
21
+
22
+ ```
23
+ gh is not installed or not authenticated.
24
+ Install: https://cli.github.com
25
+ Authenticate: gh auth login
26
+ ```
27
+
28
+ ## Step 2 — Gather automatic context
29
+
30
+ Collect the following in parallel:
31
+
32
+ ```
33
+ forge_version: !`cat "${CLAUDE_PLUGIN_ROOT}/.claude-plugin/plugin.json" 2>/dev/null | grep '"version"' | head -1 | sed 's/.*: *"\(.*\)".*/\1/'`
34
+ node_version: !`node --version 2>/dev/null || echo "N/A"`
35
+ os_info: !`uname -srm 2>/dev/null || echo "N/A"`
36
+ forge_config: !`cat ".forge/config.json" 2>/dev/null | head -30 || echo "No .forge/config.json found"`
37
+ ```
38
+
39
+ Extract from `forge_config` (if present): `language`, `framework`, and a
40
+ 1-line project description. If the config is absent, note that Forge was not
41
+ yet initialised in this project.
42
+
43
+ ## Step 2b — Token data opt-in
44
+
45
+ 1. **Detect a relevant sprint.** Read `.forge/config.json` to confirm the store
46
+ path (default `.forge/store`). Then read the sprint store JSONs from
47
+ `.forge/store/sprints/` to find the sprint with `status: "active"` or
48
+ `status: "in-progress"`. If multiple match, use the one with the most recent
49
+ `updatedAt` date. Check whether a `COST_REPORT.md` file exists under
50
+ `engineering/sprints/<sprint-dir>/COST_REPORT.md` for that sprint. If no
51
+ sprint qualifies or no `COST_REPORT.md` is found, skip all remaining steps
52
+ in Step 2b (silent — do not print anything to the user).
53
+
54
+ 2. **Check config override.** Read `forge_config` (already loaded in Step 2).
55
+ If `pipeline.includeTokenDataInBugReports` is a boolean:
56
+ - `true` → set `include_token_data = true`, skip the prompt
57
+ - `false` → set `include_token_data = false`, skip the prompt
58
+
59
+ 3. **Prompt the user** (only when a `COST_REPORT.md` was found and no config
60
+ override is set):
61
+ ```
62
+ Include token usage data from the relevant sprint in this report?
63
+ (Helps the Forge team diagnose efficiency issues) [Y/n]
64
+ ```
65
+ Treat empty input / Enter as **Y**. Set `include_token_data` accordingly.
66
+
67
+ 4. **Capture the cost data.** If `include_token_data = true`, read the content
68
+ of the detected `COST_REPORT.md` file. Store it as `cost_report_content`.
69
+
70
+ ## Step 3 — Interview the user
71
+
72
+ **If this command was invoked immediately after a Forge error** (i.e., the recent conversation contains an error from a Forge command), extract the answers from that context automatically:
73
+ - Which command failed → from the conversation
74
+ - What happened → from the error output
75
+ - Expected behaviour → infer from the command's purpose
76
+ - Reproduction steps → from the conversation
77
+ - Severity → infer from impact (blocked = HIGH, partial failure = MEDIUM, cosmetic = LOW)
78
+
79
+ Skip to Step 4 directly with the pre-filled answers.
80
+
81
+ **Otherwise**, ask the following questions in one message (the user may answer all at once):
82
+
83
+ ```
84
+ To file a Forge bug report, please answer:
85
+
86
+ 1. Which command or phase triggered this?
87
+ (e.g. /forge:init Phase 3, /forge:health, generate-tools.md, etc.)
88
+
89
+ 2. What happened? (actual behaviour)
90
+
91
+ 3. What did you expect to happen?
92
+
93
+ 4. Steps to reproduce — paste any relevant error messages or output.
94
+
95
+ 5. Severity: HIGH / MEDIUM / LOW
96
+ HIGH = blocks init or a core workflow entirely
97
+ MEDIUM = incorrect output, missing functionality, confusing behaviour
98
+ LOW = cosmetic, wording, minor inconvenience
99
+ ```
100
+
101
+ Wait for the user's response before continuing.
102
+
103
+ ## Step 4 — Draft the issue
104
+
105
+ Compose the issue title and body using the information collected.
106
+
107
+ **Title format:** `<command/file>: <one-line summary> [<SEVERITY>]`
108
+ Example: `generate-tools.md: Node.js tool generation fails on ESM projects [HIGH]`
109
+
110
+ **Body template:**
111
+
112
+ ```markdown
113
+ ## Summary
114
+
115
+ <one sentence description from the user>
116
+
117
+ ---
118
+
119
+ ## Bug — <title>
120
+
121
+ **Forge command / file:** <which command or phase>
122
+
123
+ <user's description of what happened>
124
+
125
+ <paste any error output from the user, in a code block>
126
+
127
+ **Expected behaviour:** <what the user expected>
128
+
129
+ **Steps to reproduce:**
130
+ <user's reproduction steps, formatted as a numbered list>
131
+
132
+ **Suggested fix:** <leave blank or add if the user mentioned one>
133
+
134
+ ---
135
+
136
+ ## Environment
137
+
138
+ - Plugin version: <forge_version>
139
+ - Claude Code model: <current model — claude-sonnet-4-6 or as known>
140
+ - Project stack: <language + framework from .forge/config.json, or "Forge not initialised">
141
+ - Node.js: <node_version>
142
+ - OS: <os_info>
143
+ ```
144
+
145
+ If `include_token_data = true`, append the following block immediately after
146
+ the `## Environment` section (leave it out entirely when `include_token_data`
147
+ is false or was never set):
148
+
149
+ ```markdown
150
+ <details>
151
+ <summary>Token Usage Data</summary>
152
+
153
+ {cost_report_content}
154
+
155
+ </details>
156
+ ```
157
+
158
+ ## Step 5 — Show draft and confirm
159
+
160
+ Print the full draft (title + body) to the user and ask:
161
+
162
+ ```
163
+ Draft issue ready. File to Entelligentsia/forge? [Y/n]
164
+ Or type "edit" to revise before filing.
165
+ ```
166
+
167
+ If the user says **edit**: ask what to change, update the draft, and show it again.
168
+
169
+ If the user says **no** or anything other than Y/y/edit: cancel and inform the user they can copy the draft above and file manually at https://github.com/Entelligentsia/forge/issues/new
170
+
171
+ ## Step 6 — File the issue
172
+
173
+ Run:
174
+
175
+ ```sh
176
+ gh issue create --repo Entelligentsia/forge --title "TITLE" --body "BODY"
177
+ ```
178
+
179
+ Substitute `TITLE` and `BODY` with the collected values. Pass title and body via variables or a heredoc to avoid shell escaping issues.
180
+ The `gh` output will include the new issue URL.
181
+
182
+ Report the URL to the user:
183
+
184
+ ```
185
+ Bug filed: https://github.com/Entelligentsia/forge/issues/<N>
186
+ Thank you — this helps improve Forge for everyone.
187
+ ```
188
+
189
+ ## Arguments
190
+
191
+ $ARGUMENTS
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: store-query
3
+ description: Query the Forge store by natural language or exact flags. Use for finding tasks, bugs, sprints, or features without manually reading the knowledge base.
4
+ allowed-tools:
5
+ - Bash
6
+ ---
7
+
8
+ # /forge:store-query
9
+
10
+ Query the Forge JSON store by intent, sprint, entity ID, or keyword.
11
+
12
+ ## Locate plugin root
13
+
14
+ ```
15
+ FORGE_ROOT: !`node -e "console.log(require('./.forge/config.json').paths.forgeRoot)"`
16
+ ```
17
+
18
+ ## Dispatch
19
+
20
+ If `$ARGUMENTS` starts with `--` (flags), run exact query:
21
+
22
+ ```sh
23
+ node "$FORGE_ROOT/tools/store-cli.cjs" query $ARGUMENTS
24
+ ```
25
+
26
+ Otherwise run NLP intent query:
27
+
28
+ ```sh
29
+ node "$FORGE_ROOT/tools/store-cli.cjs" nlp "$ARGUMENTS"
30
+ ```
31
+
32
+ If `$ARGUMENTS` is empty, print usage:
33
+
34
+ ```
35
+ Usage: /forge:store-query <intent or flags>
36
+
37
+ Examples:
38
+ /forge:store-query open bugs in S12
39
+ /forge:store-query WI-BUG-047
40
+ /forge:store-query --sprint S12 --status in-progress
41
+ /forge:store-query --keyword auth
42
+ /forge:store-query schema
43
+ ```
44
+
45
+ ## Output
46
+
47
+ Results are printed as JSON. Key fields:
48
+
49
+ | Field | Meaning |
50
+ |-------|---------|
51
+ | `results[].id` | Entity ID |
52
+ | `results[].title` | Entity title |
53
+ | `results[].status` | Current status |
54
+ | `results[].type` | `task`, `bug`, `sprint`, or `feature` |
55
+ | `results[].relationships` | FK IDs (sprintId, featureId, blockedBy, etc.) |
56
+ | `results[].fileRefs.md` | Path to INDEX.md for this entity |
57
+ | `results[].excerpt` | First 4 sentences from INDEX.md |
58
+ | `traversalTrace` | NLP parse steps and confidence |
59
+ | `meta.totalTimeMs` | Query wall-clock time |
60
+
61
+ ## Schema reference
62
+
63
+ To see the project's entity schemas and NLP grammar vocabulary:
64
+
65
+ ```sh
66
+ node "$FORGE_ROOT/tools/store-cli.cjs" schema
67
+ ```
68
+
69
+ ## Skills
70
+
71
+ - `forge:store-query-nlp` — NLP intent reference and output schema
72
+ - `forge:store-query-grammar` — Token vocabulary for constructing queries
73
+ - `forge:store-custodian` — Write/mutate operations (separate from query)
@@ -0,0 +1,187 @@
1
+ ---
2
+ name: store-repair
3
+ description: Diagnose and repair corrupted store records. Use when validate-store reports errors or store data seems wrong.
4
+ ---
5
+
6
+ # /forge:store:repair
7
+
8
+ Diagnose and repair corruption in the Forge JSON store.
9
+
10
+ ## Arguments
11
+
12
+ $ARGUMENTS
13
+
14
+ | Argument | Purpose |
15
+ |----------|---------|
16
+ | `--dry-run` | Show what would be repaired without making any changes |
17
+
18
+ ## How to Run
19
+
20
+ 1. Resolve the plugin root:
21
+ ```
22
+ FORGE_ROOT: !`echo "${CLAUDE_PLUGIN_ROOT}"`
23
+ ```
24
+
25
+ 2. Run the four-phase repair workflow below. If `--dry-run` is in `$ARGUMENTS`,
26
+ preview all changes without writing — skip Phase 2 writes and Phase 3
27
+ writes, and skip Phase 4 verification since nothing changed.
28
+
29
+ ## Phase 1: Diagnosis
30
+
31
+ Run the deterministic validator in JSON mode:
32
+
33
+ ```sh
34
+ node "$FORGE_ROOT/tools/validate-store.cjs" --dry-run --json
35
+ ```
36
+
37
+ Parse the JSON output. Categorize each error by its `category` field:
38
+
39
+ | Category | Example | Deterministic fix? |
40
+ |----------|---------|--------------------|
41
+ | `missing-required` | `"sprintId": null` on a sprint | Yes — backfill |
42
+ | `type-mismatch` | `"iteration": "1"` instead of `1` | Yes — coerce |
43
+ | `invalid-enum` | `"status": "in-progress"` on a bug | No — needs judgment |
44
+ | `undeclared-field` | `"priority": "high"` on a task | No — needs judgment |
45
+ | `orphaned-fk` | `taskId` pointing to deleted task in event | No — needs judgment |
46
+ | `filename-mismatch` | Event filename != eventId | Yes — rename |
47
+ | `minimum-violation` | `"iteration": 0` | Yes — coerce |
48
+ | `orphan-directory` | Sprint dir with no sprint record | No — needs judgment |
49
+ | `stale-path` | `path` pointing to nonexistent dir | No — needs judgment |
50
+
51
+ ## Phase 2: Auto-Fix
52
+
53
+ Run the deterministic validator with `--fix`:
54
+
55
+ ```sh
56
+ node "$FORGE_ROOT/tools/validate-store.cjs" --fix --json
57
+ ```
58
+
59
+ For dry-run, preview without writing:
60
+
61
+ ```sh
62
+ node "$FORGE_ROOT/tools/validate-store.cjs" --fix --dry-run --json
63
+ ```
64
+
65
+ Report each fix to the user (entity, field, what was backfilled or nullified).
66
+
67
+ ## Phase 3: LLM-Judgment Fixes
68
+
69
+ For each remaining error from Phase 1 that was not auto-fixed, apply LLM judgment:
70
+
71
+ 1. **Read the corrupted record**:
72
+ ```sh
73
+ node "$FORGE_ROOT/tools/store-cli.cjs" read <entity> <id> --json
74
+ ```
75
+
76
+ 2. **Determine the correct value** based on schema definitions, store context, and
77
+ the judgment rules below.
78
+
79
+ 3. **Present the proposed fix** to the user with:
80
+ - Entity ID and field affected
81
+ - Current (corrupted) value
82
+ - Proposed (corrected) value
83
+ - Reasoning
84
+
85
+ If the user declines, skip the fix and note it in the report.
86
+
87
+ 4. **Apply the fix** using the appropriate command:
88
+
89
+ | Corruption Pattern | Repair Action | Command |
90
+ |-------------------|---------------|---------|
91
+ | Invalid enum value | Map to nearest valid enum | `store-cli.cjs update-status <entity> <id> <field> <value> [--force]` |
92
+ | Undeclared field | Remove the field by rewriting | `store-cli.cjs write <entity> '<fixed-json>'` |
93
+ | Type mismatch | Coerce to correct type and rewrite | `store-cli.cjs write <entity> '<fixed-json>'` |
94
+ | Orphaned FK | Nullify or remap to existing entity | `store-cli.cjs write <entity> '<fixed-json>'` |
95
+ | Dangling sprint.taskIds | Remove taskIds referencing non-existent tasks | `store-cli.cjs write sprint '<fixed-json>'` |
96
+ | Illegal status transition | Force-correct to valid state | `store-cli.cjs update-status <entity> <id> status <value> --force` |
97
+ | Stale COLLATION_STATE | Regenerate via collate | `node "$FORGE_ROOT/tools/collate.cjs"` |
98
+
99
+ ### Judgment Rules: Invalid Enum Values
100
+
101
+ Map common misspellings and variant forms to canonical values:
102
+
103
+ | Entity | Field | Common Misspellings | Canonical Values |
104
+ |--------|-------|--------------------|------------------|
105
+ | Sprint | status | "in-progress" | active |
106
+ | Sprint | status | "done", "finished" | completed |
107
+ | Task | status | "in-progress" | implementing |
108
+ | Task | status | "in-review", "review" | review-approved |
109
+ | Task | status | "done", "finished" | committed |
110
+ | Bug | severity | "high", "critical" | critical |
111
+ | Bug | severity | "medium" | major |
112
+ | Bug | severity | "low" | minor |
113
+ | Bug | status | "open" | reported |
114
+ | Bug | status | "working" | in-progress |
115
+ | Feature | status | "complete", "done" | shipped |
116
+
117
+ When no reasonable mapping exists, ask the user to choose from valid values.
118
+
119
+ ### Judgment Rules: Orphaned References
120
+
121
+ - **Event.taskId → deleted task**: If the event's sprintId is valid, nullify the
122
+ taskId. If the sprint also doesn't exist, ask the user whether to delete the
123
+ event or create a stub sprint.
124
+ - **Sprint.taskIds containing deleted task IDs**: Remove the deleted IDs from the
125
+ array and rewrite the sprint.
126
+ - **Undeclared fields**: Remove the field and rewrite. Mention the removed data in
127
+ the report so the user can decide whether to add it to the schema.
128
+
129
+ ### Hard Rules
130
+
131
+ 1. **Never fall back to direct file writes.** All repairs go through
132
+ `store-cli.cjs`. If it rejects a write, fix the data and retry (max 2).
133
+ 2. **Never delete data without confirmation.** Ask the user before deleting any
134
+ record.
135
+ 3. **Never skip Phase 4 verification.** Always re-run validate-store after
136
+ repairs.
137
+ 4. **Preserve data priority.** Prefer corrections that retain more original data.
138
+ Mapping "in-progress" → "implementing" is better than resetting to "draft".
139
+
140
+ ## Phase 4: Verification
141
+
142
+ Re-run the validator to confirm the store is clean:
143
+
144
+ ```sh
145
+ node "$FORGE_ROOT/tools/validate-store.cjs" --dry-run --json
146
+ ```
147
+
148
+ If `"ok": true`, report success. If errors remain, report them as unresolved
149
+ with suggestions for next steps.
150
+
151
+ ## Repair Report
152
+
153
+ After all phases, output a structured report:
154
+
155
+ ```
156
+ # Store Repair Report
157
+
158
+ ## Phase 1: Diagnosis
159
+ - Errors found: N
160
+ - Warnings found: M
161
+ - Categories: {breakdown by category}
162
+
163
+ ## Phase 2: Auto-Fix
164
+ - Fixes applied: N
165
+ - Details: {list of each fix}
166
+
167
+ ## Phase 3: LLM-Judgment Fixes
168
+ - Fixes proposed: N
169
+ - Fixes applied: M (with user approval)
170
+ - Fixes skipped: K (user declined)
171
+ - Details: {list of each proposed change with reasoning}
172
+
173
+ ## Phase 4: Verification
174
+ - Errors remaining: N
175
+ - Warnings remaining: M
176
+ - Status: PASS / FAIL
177
+
178
+ ## Unresolved Issues
179
+ {List of issues that could not be automatically resolved, with suggestions}
180
+ ```
181
+
182
+ ## On Error
183
+
184
+ If `validate-store.cjs` crashes or returns unexpected output, report the error
185
+ and suggest running `/forge:report-bug` if it appears to be a Forge bug. Do NOT
186
+ attempt to continue repairs after an unexpected error in a deterministic tool —
187
+ the store state is unknown and further writes could cause additional corruption.
@@ -0,0 +1,56 @@
1
+ ---
2
+ name: update-tools
3
+ description: Use when you want to refresh .forge/schemas/ to match the currently installed Forge plugin version
4
+ ---
5
+
6
+ # /forge:update-tools
7
+
8
+ Refresh the JSON schemas in `.forge/schemas/` from the installed Forge plugin.
9
+
10
+ Forge tools (`collate.cjs`, `manage-config.cjs`, etc.) ship with the plugin and
11
+ are invoked directly from `$FORGE_ROOT/tools/` — they are not copied to the project.
12
+ This command only manages schemas.
13
+
14
+ ## Locate the plugin
15
+
16
+ ```
17
+ FORGE_ROOT: !`echo "${CLAUDE_PLUGIN_ROOT}"`
18
+ ```
19
+
20
+ ## Steps
21
+
22
+ ### 1 — Copy schemas
23
+
24
+ Copy all JSON Schema files from `$FORGE_ROOT/schemas/` to `.forge/schemas/`.
25
+ Create `.forge/schemas/` if it does not exist.
26
+
27
+ ```sh
28
+ mkdir -p .forge/schemas
29
+ cp "$FORGE_ROOT/schemas/"*.schema.json .forge/schemas/
30
+ ```
31
+
32
+ ### 2 — Record hashes
33
+
34
+ Record each copied schema file in the generation manifest so health checks
35
+ can detect modifications:
36
+
37
+ ```sh
38
+ for f in .forge/schemas/*.schema.json; do
39
+ node "$FORGE_ROOT/tools/generation-manifest.cjs" record "$f"
40
+ done
41
+ ```
42
+
43
+ ### 3 — Verify
44
+
45
+ ```sh
46
+ node "$FORGE_ROOT/tools/validate-store.cjs" --dry-run
47
+ ```
48
+
49
+ Print `〇 Schemas updated and store validation passed.` on success.
50
+ Print `× Validation failed — {output}` on non-zero exit.
51
+
52
+ ## On error
53
+
54
+ If any step above fails unexpectedly, describe what went wrong and ask:
55
+
56
+ > "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."