eai-cli 0.0.0-bootstrap.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 (690) hide show
  1. package/LICENSE +183 -0
  2. package/NOTICE +4 -0
  3. package/README.md +14 -0
  4. package/dist/commands/agent.d.ts +3 -0
  5. package/dist/commands/agent.d.ts.map +1 -0
  6. package/dist/commands/agent.js +69 -0
  7. package/dist/commands/agent.js.map +1 -0
  8. package/dist/commands/blocks.d.ts +3 -0
  9. package/dist/commands/blocks.d.ts.map +1 -0
  10. package/dist/commands/blocks.js +249 -0
  11. package/dist/commands/blocks.js.map +1 -0
  12. package/dist/commands/chat.d.ts +6 -0
  13. package/dist/commands/chat.d.ts.map +1 -0
  14. package/dist/commands/chat.js +105 -0
  15. package/dist/commands/chat.js.map +1 -0
  16. package/dist/commands/deploy.d.ts +36 -0
  17. package/dist/commands/deploy.d.ts.map +1 -0
  18. package/dist/commands/deploy.js +712 -0
  19. package/dist/commands/deploy.js.map +1 -0
  20. package/dist/commands/dev.d.ts +15 -0
  21. package/dist/commands/dev.d.ts.map +1 -0
  22. package/dist/commands/dev.js +133 -0
  23. package/dist/commands/dev.js.map +1 -0
  24. package/dist/commands/docs.d.ts +6 -0
  25. package/dist/commands/docs.d.ts.map +1 -0
  26. package/dist/commands/docs.js +118 -0
  27. package/dist/commands/docs.js.map +1 -0
  28. package/dist/commands/env.d.ts +10 -0
  29. package/dist/commands/env.d.ts.map +1 -0
  30. package/dist/commands/env.js +200 -0
  31. package/dist/commands/env.js.map +1 -0
  32. package/dist/commands/errors.d.ts +3 -0
  33. package/dist/commands/errors.d.ts.map +1 -0
  34. package/dist/commands/errors.js +72 -0
  35. package/dist/commands/errors.js.map +1 -0
  36. package/dist/commands/gofer.d.ts +3 -0
  37. package/dist/commands/gofer.d.ts.map +1 -0
  38. package/dist/commands/gofer.js +134 -0
  39. package/dist/commands/gofer.js.map +1 -0
  40. package/dist/commands/init.d.ts +14 -0
  41. package/dist/commands/init.d.ts.map +1 -0
  42. package/dist/commands/init.js +1437 -0
  43. package/dist/commands/init.js.map +1 -0
  44. package/dist/commands/login.d.ts +7 -0
  45. package/dist/commands/login.d.ts.map +1 -0
  46. package/dist/commands/login.js +117 -0
  47. package/dist/commands/login.js.map +1 -0
  48. package/dist/commands/provision.d.ts +6 -0
  49. package/dist/commands/provision.d.ts.map +1 -0
  50. package/dist/commands/provision.js +855 -0
  51. package/dist/commands/provision.js.map +1 -0
  52. package/dist/commands/publicapi.d.ts +6 -0
  53. package/dist/commands/publicapi.d.ts.map +1 -0
  54. package/dist/commands/publicapi.js +184 -0
  55. package/dist/commands/publicapi.js.map +1 -0
  56. package/dist/commands/resources.d.ts +38 -0
  57. package/dist/commands/resources.d.ts.map +1 -0
  58. package/dist/commands/resources.js +1010 -0
  59. package/dist/commands/resources.js.map +1 -0
  60. package/dist/commands/runtime.d.ts +3 -0
  61. package/dist/commands/runtime.d.ts.map +1 -0
  62. package/dist/commands/runtime.js +78 -0
  63. package/dist/commands/runtime.js.map +1 -0
  64. package/dist/commands/template.d.ts +3 -0
  65. package/dist/commands/template.d.ts.map +1 -0
  66. package/dist/commands/template.js +365 -0
  67. package/dist/commands/template.js.map +1 -0
  68. package/dist/commands/tenant.d.ts +45 -0
  69. package/dist/commands/tenant.d.ts.map +1 -0
  70. package/dist/commands/tenant.js +1036 -0
  71. package/dist/commands/tenant.js.map +1 -0
  72. package/dist/commands/types.d.ts +130 -0
  73. package/dist/commands/types.d.ts.map +1 -0
  74. package/dist/commands/types.js +1636 -0
  75. package/dist/commands/types.js.map +1 -0
  76. package/dist/commands/update.d.ts +13 -0
  77. package/dist/commands/update.d.ts.map +1 -0
  78. package/dist/commands/update.js +163 -0
  79. package/dist/commands/update.js.map +1 -0
  80. package/dist/commands/user.d.ts +6 -0
  81. package/dist/commands/user.d.ts.map +1 -0
  82. package/dist/commands/user.js +359 -0
  83. package/dist/commands/user.js.map +1 -0
  84. package/dist/commands/verify.d.ts +40 -0
  85. package/dist/commands/verify.d.ts.map +1 -0
  86. package/dist/commands/verify.js +1442 -0
  87. package/dist/commands/verify.js.map +1 -0
  88. package/dist/commands/vertical.d.ts +24 -0
  89. package/dist/commands/vertical.d.ts.map +1 -0
  90. package/dist/commands/vertical.js +301 -0
  91. package/dist/commands/vertical.js.map +1 -0
  92. package/dist/commands/whoami.d.ts +6 -0
  93. package/dist/commands/whoami.d.ts.map +1 -0
  94. package/dist/commands/whoami.js +73 -0
  95. package/dist/commands/whoami.js.map +1 -0
  96. package/dist/commands/workflow.d.ts +6 -0
  97. package/dist/commands/workflow.d.ts.map +1 -0
  98. package/dist/commands/workflow.js +400 -0
  99. package/dist/commands/workflow.js.map +1 -0
  100. package/dist/index.d.ts +10 -0
  101. package/dist/index.d.ts.map +1 -0
  102. package/dist/index.js +272 -0
  103. package/dist/index.js.map +1 -0
  104. package/dist/lib/agent-guide.d.ts +24 -0
  105. package/dist/lib/agent-guide.d.ts.map +1 -0
  106. package/dist/lib/agent-guide.js +155 -0
  107. package/dist/lib/agent-guide.js.map +1 -0
  108. package/dist/lib/api.d.ts +338 -0
  109. package/dist/lib/api.d.ts.map +1 -0
  110. package/dist/lib/api.js +991 -0
  111. package/dist/lib/api.js.map +1 -0
  112. package/dist/lib/auth.d.ts +65 -0
  113. package/dist/lib/auth.d.ts.map +1 -0
  114. package/dist/lib/auth.js +592 -0
  115. package/dist/lib/auth.js.map +1 -0
  116. package/dist/lib/azure-cli.d.ts +6 -0
  117. package/dist/lib/azure-cli.d.ts.map +1 -0
  118. package/dist/lib/azure-cli.js +13 -0
  119. package/dist/lib/azure-cli.js.map +1 -0
  120. package/dist/lib/block-catalog-normalize.d.ts +47 -0
  121. package/dist/lib/block-catalog-normalize.d.ts.map +1 -0
  122. package/dist/lib/block-catalog-normalize.js +355 -0
  123. package/dist/lib/block-catalog-normalize.js.map +1 -0
  124. package/dist/lib/block-catalog-types.d.ts +111 -0
  125. package/dist/lib/block-catalog-types.d.ts.map +1 -0
  126. package/dist/lib/block-catalog-types.js +41 -0
  127. package/dist/lib/block-catalog-types.js.map +1 -0
  128. package/dist/lib/block-catalog-utils.d.ts +7 -0
  129. package/dist/lib/block-catalog-utils.d.ts.map +1 -0
  130. package/dist/lib/block-catalog-utils.js +47 -0
  131. package/dist/lib/block-catalog-utils.js.map +1 -0
  132. package/dist/lib/block-catalog-validation.d.ts +5 -0
  133. package/dist/lib/block-catalog-validation.d.ts.map +1 -0
  134. package/dist/lib/block-catalog-validation.js +112 -0
  135. package/dist/lib/block-catalog-validation.js.map +1 -0
  136. package/dist/lib/block-catalog.d.ts +3 -0
  137. package/dist/lib/block-catalog.d.ts.map +1 -0
  138. package/dist/lib/block-catalog.js +284 -0
  139. package/dist/lib/block-catalog.js.map +1 -0
  140. package/dist/lib/cloud-env.d.ts +25 -0
  141. package/dist/lib/cloud-env.d.ts.map +1 -0
  142. package/dist/lib/cloud-env.js +79 -0
  143. package/dist/lib/cloud-env.js.map +1 -0
  144. package/dist/lib/config.d.ts +116 -0
  145. package/dist/lib/config.d.ts.map +1 -0
  146. package/dist/lib/config.js +195 -0
  147. package/dist/lib/config.js.map +1 -0
  148. package/dist/lib/context.d.ts +43 -0
  149. package/dist/lib/context.d.ts.map +1 -0
  150. package/dist/lib/context.js +68 -0
  151. package/dist/lib/context.js.map +1 -0
  152. package/dist/lib/error-codes.d.ts +56 -0
  153. package/dist/lib/error-codes.d.ts.map +1 -0
  154. package/dist/lib/error-codes.js +211 -0
  155. package/dist/lib/error-codes.js.map +1 -0
  156. package/dist/lib/error-guidance/catalog.d.ts +648 -0
  157. package/dist/lib/error-guidance/catalog.d.ts.map +1 -0
  158. package/dist/lib/error-guidance/catalog.js +940 -0
  159. package/dist/lib/error-guidance/catalog.js.map +1 -0
  160. package/dist/lib/error-guidance/match.d.ts +3 -0
  161. package/dist/lib/error-guidance/match.d.ts.map +1 -0
  162. package/dist/lib/error-guidance/match.js +46 -0
  163. package/dist/lib/error-guidance/match.js.map +1 -0
  164. package/dist/lib/error-guidance/render.d.ts +5 -0
  165. package/dist/lib/error-guidance/render.d.ts.map +1 -0
  166. package/dist/lib/error-guidance/render.js +92 -0
  167. package/dist/lib/error-guidance/render.js.map +1 -0
  168. package/dist/lib/error-guidance/types.d.ts +76 -0
  169. package/dist/lib/error-guidance/types.d.ts.map +1 -0
  170. package/dist/lib/error-guidance/types.js +2 -0
  171. package/dist/lib/error-guidance/types.js.map +1 -0
  172. package/dist/lib/error-guidance/validate.d.ts +3 -0
  173. package/dist/lib/error-guidance/validate.d.ts.map +1 -0
  174. package/dist/lib/error-guidance/validate.js +59 -0
  175. package/dist/lib/error-guidance/validate.js.map +1 -0
  176. package/dist/lib/gofer-installer.d.ts +32 -0
  177. package/dist/lib/gofer-installer.d.ts.map +1 -0
  178. package/dist/lib/gofer-installer.js +589 -0
  179. package/dist/lib/gofer-installer.js.map +1 -0
  180. package/dist/lib/gofer-refresh.d.ts +46 -0
  181. package/dist/lib/gofer-refresh.d.ts.map +1 -0
  182. package/dist/lib/gofer-refresh.js +536 -0
  183. package/dist/lib/gofer-refresh.js.map +1 -0
  184. package/dist/lib/next-route-exports.d.ts +6 -0
  185. package/dist/lib/next-route-exports.d.ts.map +1 -0
  186. package/dist/lib/next-route-exports.js +127 -0
  187. package/dist/lib/next-route-exports.js.map +1 -0
  188. package/dist/lib/npm.d.ts +2 -0
  189. package/dist/lib/npm.d.ts.map +1 -0
  190. package/dist/lib/npm.js +4 -0
  191. package/dist/lib/npm.js.map +1 -0
  192. package/dist/lib/object-type-defaults.d.ts +4 -0
  193. package/dist/lib/object-type-defaults.d.ts.map +1 -0
  194. package/dist/lib/object-type-defaults.js +72 -0
  195. package/dist/lib/object-type-defaults.js.map +1 -0
  196. package/dist/lib/output.d.ts +35 -0
  197. package/dist/lib/output.d.ts.map +1 -0
  198. package/dist/lib/output.js +166 -0
  199. package/dist/lib/output.js.map +1 -0
  200. package/dist/lib/profile.d.ts +52 -0
  201. package/dist/lib/profile.d.ts.map +1 -0
  202. package/dist/lib/profile.js +116 -0
  203. package/dist/lib/profile.js.map +1 -0
  204. package/dist/lib/project-manifest.d.ts +42 -0
  205. package/dist/lib/project-manifest.d.ts.map +1 -0
  206. package/dist/lib/project-manifest.js +191 -0
  207. package/dist/lib/project-manifest.js.map +1 -0
  208. package/dist/lib/resourceapi-bundle.d.ts +33 -0
  209. package/dist/lib/resourceapi-bundle.d.ts.map +1 -0
  210. package/dist/lib/resourceapi-bundle.js +79 -0
  211. package/dist/lib/resourceapi-bundle.js.map +1 -0
  212. package/dist/lib/runtime-contract.d.ts +84 -0
  213. package/dist/lib/runtime-contract.d.ts.map +1 -0
  214. package/dist/lib/runtime-contract.js +318 -0
  215. package/dist/lib/runtime-contract.js.map +1 -0
  216. package/dist/lib/schema-builder.d.ts +28 -0
  217. package/dist/lib/schema-builder.d.ts.map +1 -0
  218. package/dist/lib/schema-builder.js +69 -0
  219. package/dist/lib/schema-builder.js.map +1 -0
  220. package/dist/lib/tenant-context.d.ts +127 -0
  221. package/dist/lib/tenant-context.d.ts.map +1 -0
  222. package/dist/lib/tenant-context.js +573 -0
  223. package/dist/lib/tenant-context.js.map +1 -0
  224. package/dist/lib/update-check.d.ts +52 -0
  225. package/dist/lib/update-check.d.ts.map +1 -0
  226. package/dist/lib/update-check.js +271 -0
  227. package/dist/lib/update-check.js.map +1 -0
  228. package/dist/lib/update-maintenance.d.ts +15 -0
  229. package/dist/lib/update-maintenance.d.ts.map +1 -0
  230. package/dist/lib/update-maintenance.js +187 -0
  231. package/dist/lib/update-maintenance.js.map +1 -0
  232. package/dist/lib/utils.d.ts +23 -0
  233. package/dist/lib/utils.d.ts.map +1 -0
  234. package/dist/lib/utils.js +48 -0
  235. package/dist/lib/utils.js.map +1 -0
  236. package/dist/lib/workflow-provisioning.d.ts +54 -0
  237. package/dist/lib/workflow-provisioning.d.ts.map +1 -0
  238. package/dist/lib/workflow-provisioning.js +281 -0
  239. package/dist/lib/workflow-provisioning.js.map +1 -0
  240. package/package.json +51 -0
  241. package/resources/gofer/.gofer-version +7 -0
  242. package/resources/gofer/agents-skills/0_gofer_start/SKILL.md +1287 -0
  243. package/resources/gofer/agents-skills/0a_problem_validation/SKILL.md +429 -0
  244. package/resources/gofer/agents-skills/10_gofer_cloud/SKILL.md +635 -0
  245. package/resources/gofer/agents-skills/1_gofer_research/SKILL.md +1159 -0
  246. package/resources/gofer/agents-skills/2_gofer_specify/SKILL.md +860 -0
  247. package/resources/gofer/agents-skills/3_gofer_plan/SKILL.md +886 -0
  248. package/resources/gofer/agents-skills/4_gofer_tasks/SKILL.md +748 -0
  249. package/resources/gofer/agents-skills/5_gofer_implement/SKILL.md +924 -0
  250. package/resources/gofer/agents-skills/6_gofer_validate/SKILL.md +2269 -0
  251. package/resources/gofer/agents-skills/7_gofer_save/SKILL.md +423 -0
  252. package/resources/gofer/agents-skills/7a_stakeholder_comms/SKILL.md +508 -0
  253. package/resources/gofer/agents-skills/8_gofer_branding/SKILL.md +315 -0
  254. package/resources/gofer/agents-skills/9_gofer_tests/SKILL.md +558 -0
  255. package/resources/gofer/agents-skills/gofer_bootstrap_workspace/SKILL.md +148 -0
  256. package/resources/gofer/agents-skills/gofer_check_workspace/SKILL.md +119 -0
  257. package/resources/gofer/agents-skills/gofer_constitution/SKILL.md +612 -0
  258. package/resources/gofer/agents-skills/gofer_diagnose/SKILL.md +114 -0
  259. package/resources/gofer/agents-skills/gofer_eai_first_run/SKILL.md +397 -0
  260. package/resources/gofer/agents-skills/gofer_hydrate/SKILL.md +561 -0
  261. package/resources/gofer/agents-skills/gofer_personality/SKILL.md +44 -0
  262. package/resources/gofer/agents-skills/gofer_plan/SKILL.md +40 -0
  263. package/resources/gofer/agents-skills/gofer_side/SKILL.md +45 -0
  264. package/resources/gofer/agents-skills/gofer_spec_summary/SKILL.md +112 -0
  265. package/resources/gofer/agents-skills/gofer_tdd/SKILL.md +112 -0
  266. package/resources/gofer/agents-skills/gofer_vocabulary/SKILL.md +112 -0
  267. package/resources/gofer/agents-skills/gofer_zoom_out/SKILL.md +112 -0
  268. package/resources/gofer/bash-scripts/check-context-health.sh +365 -0
  269. package/resources/gofer/bash-scripts/check-persona-pack.sh +81 -0
  270. package/resources/gofer/bash-scripts/check-prerequisites.sh +168 -0
  271. package/resources/gofer/bash-scripts/common.sh +192 -0
  272. package/resources/gofer/bash-scripts/create-new-feature.sh +260 -0
  273. package/resources/gofer/bash-scripts/install-optional-tools.sh +270 -0
  274. package/resources/gofer/bash-scripts/log-stage.sh +224 -0
  275. package/resources/gofer/bash-scripts/mark-task-complete.sh +74 -0
  276. package/resources/gofer/bash-scripts/pipeline-state.sh +306 -0
  277. package/resources/gofer/bash-scripts/read-failed-approaches.sh +114 -0
  278. package/resources/gofer/bash-scripts/read-session-memories.sh +96 -0
  279. package/resources/gofer/bash-scripts/save-checkpoint.sh +407 -0
  280. package/resources/gofer/bash-scripts/setup-plan.sh +62 -0
  281. package/resources/gofer/bash-scripts/sync-implementation-status.sh +47 -0
  282. package/resources/gofer/bash-scripts/update-agent-context.sh +772 -0
  283. package/resources/gofer/bash-scripts/validate-artifact.sh +335 -0
  284. package/resources/gofer/bash-scripts/verify-task.sh +384 -0
  285. package/resources/gofer/bash-scripts/write-failed-approach.sh +110 -0
  286. package/resources/gofer/bash-scripts/write-periodic-checkpoint.sh +128 -0
  287. package/resources/gofer/bash-scripts/write-session-memory.sh +118 -0
  288. package/resources/gofer/claude-agents/assumption-tracker.md +168 -0
  289. package/resources/gofer/claude-agents/business-metrics-analyzer.md +169 -0
  290. package/resources/gofer/claude-agents/business-problem-validator.md +168 -0
  291. package/resources/gofer/claude-agents/codebase-analyzer.md +124 -0
  292. package/resources/gofer/claude-agents/codebase-locator.md +95 -0
  293. package/resources/gofer/claude-agents/codebase-pattern-finder.md +180 -0
  294. package/resources/gofer/claude-agents/comms-writer.md +158 -0
  295. package/resources/gofer/claude-agents/engineer-review.md +169 -0
  296. package/resources/gofer/claude-agents/implement-bug-triangulator.md +94 -0
  297. package/resources/gofer/claude-agents/implement-code-review-council.md +89 -0
  298. package/resources/gofer/claude-agents/implement-doc-writer.md +89 -0
  299. package/resources/gofer/claude-agents/implement-error-hardener.md +84 -0
  300. package/resources/gofer/claude-agents/implement-performance-explorer.md +95 -0
  301. package/resources/gofer/claude-agents/implement-test-diversifier.md +82 -0
  302. package/resources/gofer/claude-agents/implement-variant-generator.md +80 -0
  303. package/resources/gofer/claude-agents/multi-perspective-judge.md +114 -0
  304. package/resources/gofer/claude-agents/plan-api-comparator.md +90 -0
  305. package/resources/gofer/claude-agents/plan-architecture-diverger.md +100 -0
  306. package/resources/gofer/claude-agents/plan-data-model-stress-tester.md +95 -0
  307. package/resources/gofer/claude-agents/plan-migration-path-finder.md +95 -0
  308. package/resources/gofer/claude-agents/plan-refactor-rewrite-advisor.md +97 -0
  309. package/resources/gofer/claude-agents/research-dependency-evaluator.md +106 -0
  310. package/resources/gofer/claude-agents/research-horizon-scanner.md +100 -0
  311. package/resources/gofer/claude-agents/research-market-scanner.md +137 -0
  312. package/resources/gofer/claude-agents/research-perspective-multiplier.md +102 -0
  313. package/resources/gofer/claude-agents/scope-creep-detector.md +152 -0
  314. package/resources/gofer/claude-agents/specify-ambiguity-detector.md +95 -0
  315. package/resources/gofer/claude-agents/specify-journey-stress-tester.md +92 -0
  316. package/resources/gofer/claude-agents/tasks-cross-cutting-scanner.md +91 -0
  317. package/resources/gofer/claude-agents/tasks-rollback-planner.md +89 -0
  318. package/resources/gofer/claude-agents/validate-security-red-team.md +102 -0
  319. package/resources/gofer/claude-agents/validation-correctness.md +103 -0
  320. package/resources/gofer/claude-agents/validation-integration.md +129 -0
  321. package/resources/gofer/claude-agents/validation-performance.md +120 -0
  322. package/resources/gofer/claude-agents/validation-security.md +115 -0
  323. package/resources/gofer/claude-agents/validation-standards.md +151 -0
  324. package/resources/gofer/claude-agents/validation-test-quality.md +146 -0
  325. package/resources/gofer/claude-agents/visual-bounded-context-writer.md +40 -0
  326. package/resources/gofer/claude-agents/visual-c4-writer.md +45 -0
  327. package/resources/gofer/claude-agents/visual-erd-writer.md +34 -0
  328. package/resources/gofer/claude-agents/visual-heatmap-writer.md +63 -0
  329. package/resources/gofer/claude-agents/visual-risk-writer.md +64 -0
  330. package/resources/gofer/claude-commands/0_gofer_start.md +1282 -0
  331. package/resources/gofer/claude-commands/0a_problem_validation.md +424 -0
  332. package/resources/gofer/claude-commands/10_gofer_cloud.md +630 -0
  333. package/resources/gofer/claude-commands/1_gofer_research.md +1154 -0
  334. package/resources/gofer/claude-commands/2_gofer_specify.md +855 -0
  335. package/resources/gofer/claude-commands/3_gofer_plan.md +881 -0
  336. package/resources/gofer/claude-commands/4_gofer_tasks.md +743 -0
  337. package/resources/gofer/claude-commands/5_gofer_implement.md +919 -0
  338. package/resources/gofer/claude-commands/6_gofer_validate.md +2264 -0
  339. package/resources/gofer/claude-commands/7_gofer_save.md +418 -0
  340. package/resources/gofer/claude-commands/7a_stakeholder_comms.md +503 -0
  341. package/resources/gofer/claude-commands/8_gofer_branding.md +310 -0
  342. package/resources/gofer/claude-commands/9_gofer_tests.md +553 -0
  343. package/resources/gofer/claude-commands/gofer_bootstrap_workspace.md +143 -0
  344. package/resources/gofer/claude-commands/gofer_check_workspace.md +114 -0
  345. package/resources/gofer/claude-commands/gofer_constitution.md +607 -0
  346. package/resources/gofer/claude-commands/gofer_diagnose.md +109 -0
  347. package/resources/gofer/claude-commands/gofer_eai_first_run.md +392 -0
  348. package/resources/gofer/claude-commands/gofer_hydrate.md +556 -0
  349. package/resources/gofer/claude-commands/gofer_personality.md +39 -0
  350. package/resources/gofer/claude-commands/gofer_plan.md +35 -0
  351. package/resources/gofer/claude-commands/gofer_side.md +40 -0
  352. package/resources/gofer/claude-commands/gofer_spec_summary.md +107 -0
  353. package/resources/gofer/claude-commands/gofer_tdd.md +107 -0
  354. package/resources/gofer/claude-commands/gofer_vocabulary.md +107 -0
  355. package/resources/gofer/claude-commands/gofer_zoom_out.md +107 -0
  356. package/resources/gofer/claude-skills/eai-gofer/SKILL.md +56 -0
  357. package/resources/gofer/commands/.gitkeep +0 -0
  358. package/resources/gofer/commands/0_gofer_start.md +1299 -0
  359. package/resources/gofer/commands/0a_problem_validation.md +405 -0
  360. package/resources/gofer/commands/10_gofer_cloud.md +611 -0
  361. package/resources/gofer/commands/1_gofer_research.md +1135 -0
  362. package/resources/gofer/commands/2_gofer_specify.md +836 -0
  363. package/resources/gofer/commands/3_gofer_plan.md +862 -0
  364. package/resources/gofer/commands/4_gofer_tasks.md +724 -0
  365. package/resources/gofer/commands/5_gofer_implement.md +900 -0
  366. package/resources/gofer/commands/6_gofer_validate.md +2245 -0
  367. package/resources/gofer/commands/7_gofer_save.md +399 -0
  368. package/resources/gofer/commands/7a_stakeholder_comms.md +484 -0
  369. package/resources/gofer/commands/8_gofer_branding.md +291 -0
  370. package/resources/gofer/commands/9_gofer_tests.md +534 -0
  371. package/resources/gofer/commands/gofer_bootstrap_workspace.md +159 -0
  372. package/resources/gofer/commands/gofer_check_workspace.md +130 -0
  373. package/resources/gofer/commands/gofer_constitution.md +588 -0
  374. package/resources/gofer/commands/gofer_diagnose.md +89 -0
  375. package/resources/gofer/commands/gofer_eai_first_run.md +392 -0
  376. package/resources/gofer/commands/gofer_hydrate.md +537 -0
  377. package/resources/gofer/commands/gofer_personality.md +61 -0
  378. package/resources/gofer/commands/gofer_plan.md +51 -0
  379. package/resources/gofer/commands/gofer_side.md +56 -0
  380. package/resources/gofer/commands/gofer_spec_summary.md +87 -0
  381. package/resources/gofer/commands/gofer_tdd.md +87 -0
  382. package/resources/gofer/commands/gofer_vocabulary.md +87 -0
  383. package/resources/gofer/commands/gofer_zoom_out.md +87 -0
  384. package/resources/gofer/copilot-instructions/gofer-cost.instructions.md +13 -0
  385. package/resources/gofer/copilot-instructions/language-server.instructions.md +49 -0
  386. package/resources/gofer/copilot-instructions/typescript.instructions.md +47 -0
  387. package/resources/gofer/copilot-instructions/vscode-extension.instructions.md +46 -0
  388. package/resources/gofer/copilot-prompts/0_gofer_start.prompt.md +1308 -0
  389. package/resources/gofer/copilot-prompts/0a_problem_validation.prompt.md +429 -0
  390. package/resources/gofer/copilot-prompts/10_gofer_cloud.prompt.md +644 -0
  391. package/resources/gofer/copilot-prompts/1_gofer_research.prompt.md +1177 -0
  392. package/resources/gofer/copilot-prompts/2_gofer_specify.prompt.md +878 -0
  393. package/resources/gofer/copilot-prompts/3_gofer_plan.prompt.md +904 -0
  394. package/resources/gofer/copilot-prompts/4_gofer_tasks.prompt.md +766 -0
  395. package/resources/gofer/copilot-prompts/5_gofer_implement.prompt.md +942 -0
  396. package/resources/gofer/copilot-prompts/6_gofer_validate.prompt.md +2277 -0
  397. package/resources/gofer/copilot-prompts/7_gofer_save.prompt.md +433 -0
  398. package/resources/gofer/copilot-prompts/7a_stakeholder_comms.prompt.md +516 -0
  399. package/resources/gofer/copilot-prompts/8_gofer_branding.prompt.md +323 -0
  400. package/resources/gofer/copilot-prompts/9_gofer_tests.prompt.md +566 -0
  401. package/resources/gofer/copilot-prompts/gofer_bootstrap_workspace.prompt.md +161 -0
  402. package/resources/gofer/copilot-prompts/gofer_check_workspace.prompt.md +132 -0
  403. package/resources/gofer/copilot-prompts/gofer_constitution.prompt.md +621 -0
  404. package/resources/gofer/copilot-prompts/gofer_diagnose.prompt.md +127 -0
  405. package/resources/gofer/copilot-prompts/gofer_eai_first_run.prompt.md +410 -0
  406. package/resources/gofer/copilot-prompts/gofer_hydrate.prompt.md +571 -0
  407. package/resources/gofer/copilot-prompts/gofer_personality.prompt.md +57 -0
  408. package/resources/gofer/copilot-prompts/gofer_plan.prompt.md +53 -0
  409. package/resources/gofer/copilot-prompts/gofer_side.prompt.md +58 -0
  410. package/resources/gofer/copilot-prompts/gofer_spec_summary.prompt.md +125 -0
  411. package/resources/gofer/copilot-prompts/gofer_tdd.prompt.md +125 -0
  412. package/resources/gofer/copilot-prompts/gofer_vocabulary.prompt.md +125 -0
  413. package/resources/gofer/copilot-prompts/gofer_zoom_out.prompt.md +125 -0
  414. package/resources/gofer/gemini/agents/assumption-tracker.md +171 -0
  415. package/resources/gofer/gemini/agents/business-metrics-analyzer.md +172 -0
  416. package/resources/gofer/gemini/agents/business-problem-validator.md +171 -0
  417. package/resources/gofer/gemini/agents/codebase-analyzer.md +127 -0
  418. package/resources/gofer/gemini/agents/codebase-locator.md +98 -0
  419. package/resources/gofer/gemini/agents/codebase-pattern-finder.md +183 -0
  420. package/resources/gofer/gemini/agents/comms-writer.md +161 -0
  421. package/resources/gofer/gemini/agents/engineer-review.md +172 -0
  422. package/resources/gofer/gemini/agents/implement-bug-triangulator.md +97 -0
  423. package/resources/gofer/gemini/agents/implement-code-review-council.md +92 -0
  424. package/resources/gofer/gemini/agents/implement-doc-writer.md +92 -0
  425. package/resources/gofer/gemini/agents/implement-error-hardener.md +87 -0
  426. package/resources/gofer/gemini/agents/implement-performance-explorer.md +98 -0
  427. package/resources/gofer/gemini/agents/implement-test-diversifier.md +85 -0
  428. package/resources/gofer/gemini/agents/implement-variant-generator.md +83 -0
  429. package/resources/gofer/gemini/agents/multi-perspective-judge.md +117 -0
  430. package/resources/gofer/gemini/agents/plan-api-comparator.md +93 -0
  431. package/resources/gofer/gemini/agents/plan-architecture-diverger.md +103 -0
  432. package/resources/gofer/gemini/agents/plan-data-model-stress-tester.md +98 -0
  433. package/resources/gofer/gemini/agents/plan-migration-path-finder.md +98 -0
  434. package/resources/gofer/gemini/agents/plan-refactor-rewrite-advisor.md +100 -0
  435. package/resources/gofer/gemini/agents/research-dependency-evaluator.md +109 -0
  436. package/resources/gofer/gemini/agents/research-horizon-scanner.md +103 -0
  437. package/resources/gofer/gemini/agents/research-market-scanner.md +140 -0
  438. package/resources/gofer/gemini/agents/research-perspective-multiplier.md +105 -0
  439. package/resources/gofer/gemini/agents/scope-creep-detector.md +155 -0
  440. package/resources/gofer/gemini/agents/specify-ambiguity-detector.md +98 -0
  441. package/resources/gofer/gemini/agents/specify-journey-stress-tester.md +95 -0
  442. package/resources/gofer/gemini/agents/tasks-cross-cutting-scanner.md +94 -0
  443. package/resources/gofer/gemini/agents/tasks-rollback-planner.md +92 -0
  444. package/resources/gofer/gemini/agents/validate-security-red-team.md +105 -0
  445. package/resources/gofer/gemini/agents/validation-correctness.md +106 -0
  446. package/resources/gofer/gemini/agents/validation-integration.md +132 -0
  447. package/resources/gofer/gemini/agents/validation-performance.md +123 -0
  448. package/resources/gofer/gemini/agents/validation-security.md +118 -0
  449. package/resources/gofer/gemini/agents/validation-standards.md +154 -0
  450. package/resources/gofer/gemini/agents/validation-test-quality.md +149 -0
  451. package/resources/gofer/gemini/agents/visual-bounded-context-writer.md +40 -0
  452. package/resources/gofer/gemini/agents/visual-c4-writer.md +44 -0
  453. package/resources/gofer/gemini/agents/visual-erd-writer.md +36 -0
  454. package/resources/gofer/gemini/agents/visual-heatmap-writer.md +63 -0
  455. package/resources/gofer/gemini/agents/visual-risk-writer.md +64 -0
  456. package/resources/gofer/gemini/commands/gofer/.gitkeep +0 -0
  457. package/resources/gofer/gemini/commands/gofer/0_gofer_start.md +1282 -0
  458. package/resources/gofer/gemini/commands/gofer/0_gofer_start.toml +2 -0
  459. package/resources/gofer/gemini/commands/gofer/0a_problem_validation.md +424 -0
  460. package/resources/gofer/gemini/commands/gofer/0a_problem_validation.toml +2 -0
  461. package/resources/gofer/gemini/commands/gofer/10_gofer_cloud.md +630 -0
  462. package/resources/gofer/gemini/commands/gofer/10_gofer_cloud.toml +2 -0
  463. package/resources/gofer/gemini/commands/gofer/1_gofer_research.md +1154 -0
  464. package/resources/gofer/gemini/commands/gofer/1_gofer_research.toml +2 -0
  465. package/resources/gofer/gemini/commands/gofer/2_gofer_specify.md +855 -0
  466. package/resources/gofer/gemini/commands/gofer/2_gofer_specify.toml +2 -0
  467. package/resources/gofer/gemini/commands/gofer/3_gofer_plan.md +881 -0
  468. package/resources/gofer/gemini/commands/gofer/3_gofer_plan.toml +2 -0
  469. package/resources/gofer/gemini/commands/gofer/4_gofer_tasks.md +743 -0
  470. package/resources/gofer/gemini/commands/gofer/4_gofer_tasks.toml +2 -0
  471. package/resources/gofer/gemini/commands/gofer/5_gofer_implement.md +919 -0
  472. package/resources/gofer/gemini/commands/gofer/5_gofer_implement.toml +2 -0
  473. package/resources/gofer/gemini/commands/gofer/6_gofer_validate.md +2264 -0
  474. package/resources/gofer/gemini/commands/gofer/6_gofer_validate.toml +2 -0
  475. package/resources/gofer/gemini/commands/gofer/7_gofer_save.md +418 -0
  476. package/resources/gofer/gemini/commands/gofer/7_gofer_save.toml +2 -0
  477. package/resources/gofer/gemini/commands/gofer/7a_stakeholder_comms.md +503 -0
  478. package/resources/gofer/gemini/commands/gofer/7a_stakeholder_comms.toml +2 -0
  479. package/resources/gofer/gemini/commands/gofer/8_gofer_branding.md +310 -0
  480. package/resources/gofer/gemini/commands/gofer/8_gofer_branding.toml +2 -0
  481. package/resources/gofer/gemini/commands/gofer/9_gofer_tests.md +553 -0
  482. package/resources/gofer/gemini/commands/gofer/9_gofer_tests.toml +2 -0
  483. package/resources/gofer/gemini/commands/gofer/gofer_bootstrap_workspace.md +143 -0
  484. package/resources/gofer/gemini/commands/gofer/gofer_bootstrap_workspace.toml +2 -0
  485. package/resources/gofer/gemini/commands/gofer/gofer_check_workspace.md +114 -0
  486. package/resources/gofer/gemini/commands/gofer/gofer_check_workspace.toml +2 -0
  487. package/resources/gofer/gemini/commands/gofer/gofer_constitution.md +607 -0
  488. package/resources/gofer/gemini/commands/gofer/gofer_constitution.toml +2 -0
  489. package/resources/gofer/gemini/commands/gofer/gofer_diagnose.md +109 -0
  490. package/resources/gofer/gemini/commands/gofer/gofer_diagnose.toml +2 -0
  491. package/resources/gofer/gemini/commands/gofer/gofer_eai_first_run.md +392 -0
  492. package/resources/gofer/gemini/commands/gofer/gofer_eai_first_run.toml +2 -0
  493. package/resources/gofer/gemini/commands/gofer/gofer_hydrate.md +556 -0
  494. package/resources/gofer/gemini/commands/gofer/gofer_hydrate.toml +2 -0
  495. package/resources/gofer/gemini/commands/gofer/gofer_personality.md +39 -0
  496. package/resources/gofer/gemini/commands/gofer/gofer_personality.toml +2 -0
  497. package/resources/gofer/gemini/commands/gofer/gofer_plan.md +35 -0
  498. package/resources/gofer/gemini/commands/gofer/gofer_plan.toml +2 -0
  499. package/resources/gofer/gemini/commands/gofer/gofer_side.md +40 -0
  500. package/resources/gofer/gemini/commands/gofer/gofer_side.toml +2 -0
  501. package/resources/gofer/gemini/commands/gofer/gofer_spec_summary.md +107 -0
  502. package/resources/gofer/gemini/commands/gofer/gofer_spec_summary.toml +2 -0
  503. package/resources/gofer/gemini/commands/gofer/gofer_tdd.md +107 -0
  504. package/resources/gofer/gemini/commands/gofer/gofer_tdd.toml +2 -0
  505. package/resources/gofer/gemini/commands/gofer/gofer_vocabulary.md +107 -0
  506. package/resources/gofer/gemini/commands/gofer/gofer_vocabulary.toml +2 -0
  507. package/resources/gofer/gemini/commands/gofer/gofer_zoom_out.md +107 -0
  508. package/resources/gofer/gemini/commands/gofer/gofer_zoom_out.toml +2 -0
  509. package/resources/gofer/gemini/commands/gofer/manifest.json +32 -0
  510. package/resources/gofer/gemini/extension.json +16 -0
  511. package/resources/gofer/github-agents/gofer-business.agent.md +20 -0
  512. package/resources/gofer/github-agents/gofer-implement.agent.md +15 -0
  513. package/resources/gofer/github-agents/gofer-plan.agent.md +15 -0
  514. package/resources/gofer/github-agents/gofer-research.agent.md +15 -0
  515. package/resources/gofer/github-agents/gofer-validate.agent.md +10 -0
  516. package/resources/gofer/github-skills/eai-gofer/SKILL.md +56 -0
  517. package/resources/gofer/hook-scripts/agent-stop.mjs +655 -0
  518. package/resources/gofer/hook-scripts/log-stage-launch-time.mjs +77 -0
  519. package/resources/gofer/hook-scripts/post-tool-use.mjs +333 -0
  520. package/resources/gofer/hook-scripts/queued-input.mjs +188 -0
  521. package/resources/gofer/hook-scripts/session-lifecycle.mjs +93 -0
  522. package/resources/gofer/hook-scripts/user-prompt-submit.mjs +228 -0
  523. package/resources/gofer/instruction-templates/base/agents-base.md +37 -0
  524. package/resources/gofer/instruction-templates/base/claude-base.md +7 -0
  525. package/resources/gofer/instruction-templates/base/copilot-base.md +26 -0
  526. package/resources/gofer/instruction-templates/gofer/gofer-claude.md +5 -0
  527. package/resources/gofer/instruction-templates/gofer/gofer-copilot.md +9 -0
  528. package/resources/gofer/instruction-templates/languages/generic.md +7 -0
  529. package/resources/gofer/instruction-templates/languages/go.md +8 -0
  530. package/resources/gofer/instruction-templates/languages/java.md +8 -0
  531. package/resources/gofer/instruction-templates/languages/python.md +9 -0
  532. package/resources/gofer/instruction-templates/languages/rust.md +9 -0
  533. package/resources/gofer/instruction-templates/languages/typescript.md +19 -0
  534. package/resources/gofer/instruction-templates/workflow/principles.md +52 -0
  535. package/resources/gofer/memory/constitution.md +391 -0
  536. package/resources/gofer/memory/context-profiles.yaml +74 -0
  537. package/resources/gofer/memory/decisions/000-use-adr-for-decisions.md +67 -0
  538. package/resources/gofer/memory/decisions/001-di-framework.md +190 -0
  539. package/resources/gofer/memory/decisions/002-module-extraction.md +305 -0
  540. package/resources/gofer/memory/decisions/003-error-handling.md +368 -0
  541. package/resources/gofer/memory/decisions/004-cache-eviction.md +436 -0
  542. package/resources/gofer/memory/decisions/005-constants-management.md +520 -0
  543. package/resources/gofer/memory/decisions/README.md +129 -0
  544. package/resources/gofer/memory/diagrams/di-container.mmd +321 -0
  545. package/resources/gofer/memory/diagrams/extension-activation.mmd +184 -0
  546. package/resources/gofer/memory/diagrams/module-dependencies.mmd +264 -0
  547. package/resources/gofer/memory/gofer-model-policy.yaml +97 -0
  548. package/resources/gofer/memory/lessons.md +46 -0
  549. package/resources/gofer/node-scripts/canonical-descriptions.mjs +86 -0
  550. package/resources/gofer/node-scripts/check-version-alignment.mjs +131 -0
  551. package/resources/gofer/node-scripts/codex-doctor.mjs +425 -0
  552. package/resources/gofer/node-scripts/generate-commands.mjs +1366 -0
  553. package/resources/gofer/node-scripts/generate-issues.js +563 -0
  554. package/resources/gofer/node-scripts/gofer-closed-loop-audit.mjs +893 -0
  555. package/resources/gofer/node-scripts/gofer-loop-audit.mjs +541 -0
  556. package/resources/gofer/node-scripts/gofer-performance-report.mjs +306 -0
  557. package/resources/gofer/node-scripts/gofer-workspace-bootstrap.mjs +56 -0
  558. package/resources/gofer/node-scripts/gofer-workspace-check.mjs +56 -0
  559. package/resources/gofer/node-scripts/lib/ai-leverage-tagger.mjs +103 -0
  560. package/resources/gofer/node-scripts/lib/assemble-stakeholder-pack.mjs +114 -0
  561. package/resources/gofer/node-scripts/lib/marp-deck.mjs +87 -0
  562. package/resources/gofer/node-scripts/lib/mermaid-tabular-fallback.mjs +264 -0
  563. package/resources/gofer/node-scripts/lib/render-visual.mjs +54 -0
  564. package/resources/gofer/node-scripts/lib/validate-aliases.mjs +85 -0
  565. package/resources/gofer/node-scripts/lib/visual-counts.mjs +44 -0
  566. package/resources/gofer/node-scripts/lib/visual-pass-pipeline.mjs +134 -0
  567. package/resources/gofer/node-scripts/mermaid-export.mjs +72 -0
  568. package/resources/gofer/node-scripts/package-agent-plugin.mjs +940 -0
  569. package/resources/gofer/node-scripts/parse-stage-command.mjs +211 -0
  570. package/resources/gofer/node-scripts/schemas/.gitkeep +0 -0
  571. package/resources/gofer/node-scripts/schemas/stage-command.schema.json +72 -0
  572. package/resources/gofer/node-scripts/sync-extension-resources.mjs +110 -0
  573. package/resources/gofer/node-scripts/workspace-bootstrap-lib.mjs +1166 -0
  574. package/resources/gofer/powershell-scripts/install-optional-tools.ps1 +214 -0
  575. package/resources/gofer/references/platform/README.md +17 -0
  576. package/resources/gofer/references/platform/deployment-repo.md +9 -0
  577. package/resources/gofer/references/platform/eai-app-template.md +45 -0
  578. package/resources/gofer/references/platform/eai-config-driven-ui.md +156 -0
  579. package/resources/gofer/references/platform/eai-error-catalog.yaml +197 -0
  580. package/resources/gofer/references/platform/eai-repo-contract.md +134 -0
  581. package/resources/gofer/references/platform/eai-service-patterns.md +56 -0
  582. package/resources/gofer/references/platform/eai.md +85 -0
  583. package/resources/gofer/references/platform/vertical-template.md +49 -0
  584. package/resources/gofer/specify-commands/.gitkeep +0 -0
  585. package/resources/gofer/specify-commands/0_gofer_start.md +1299 -0
  586. package/resources/gofer/specify-commands/0a_problem_validation.md +405 -0
  587. package/resources/gofer/specify-commands/10_gofer_cloud.md +611 -0
  588. package/resources/gofer/specify-commands/1_gofer_research.md +1135 -0
  589. package/resources/gofer/specify-commands/2_gofer_specify.md +836 -0
  590. package/resources/gofer/specify-commands/3_gofer_plan.md +862 -0
  591. package/resources/gofer/specify-commands/4_gofer_tasks.md +724 -0
  592. package/resources/gofer/specify-commands/5_gofer_implement.md +900 -0
  593. package/resources/gofer/specify-commands/6_gofer_validate.md +2245 -0
  594. package/resources/gofer/specify-commands/7_gofer_save.md +399 -0
  595. package/resources/gofer/specify-commands/7a_stakeholder_comms.md +484 -0
  596. package/resources/gofer/specify-commands/8_gofer_branding.md +291 -0
  597. package/resources/gofer/specify-commands/9_gofer_tests.md +534 -0
  598. package/resources/gofer/specify-commands/gofer_bootstrap_workspace.md +159 -0
  599. package/resources/gofer/specify-commands/gofer_check_workspace.md +130 -0
  600. package/resources/gofer/specify-commands/gofer_constitution.md +588 -0
  601. package/resources/gofer/specify-commands/gofer_diagnose.md +89 -0
  602. package/resources/gofer/specify-commands/gofer_eai_first_run.md +392 -0
  603. package/resources/gofer/specify-commands/gofer_hydrate.md +537 -0
  604. package/resources/gofer/specify-commands/gofer_personality.md +61 -0
  605. package/resources/gofer/specify-commands/gofer_plan.md +51 -0
  606. package/resources/gofer/specify-commands/gofer_side.md +56 -0
  607. package/resources/gofer/specify-commands/gofer_spec_summary.md +87 -0
  608. package/resources/gofer/specify-commands/gofer_tdd.md +87 -0
  609. package/resources/gofer/specify-commands/gofer_vocabulary.md +87 -0
  610. package/resources/gofer/specify-commands/gofer_zoom_out.md +87 -0
  611. package/resources/gofer/system-skills/0_gofer_start/SKILL.md +1287 -0
  612. package/resources/gofer/system-skills/0a_problem_validation/SKILL.md +429 -0
  613. package/resources/gofer/system-skills/10_gofer_cloud/SKILL.md +635 -0
  614. package/resources/gofer/system-skills/1_gofer_research/SKILL.md +1159 -0
  615. package/resources/gofer/system-skills/2_gofer_specify/SKILL.md +860 -0
  616. package/resources/gofer/system-skills/3_gofer_plan/SKILL.md +886 -0
  617. package/resources/gofer/system-skills/4_gofer_tasks/SKILL.md +748 -0
  618. package/resources/gofer/system-skills/5_gofer_implement/SKILL.md +924 -0
  619. package/resources/gofer/system-skills/6_gofer_validate/SKILL.md +2269 -0
  620. package/resources/gofer/system-skills/7_gofer_save/SKILL.md +423 -0
  621. package/resources/gofer/system-skills/7a_stakeholder_comms/SKILL.md +508 -0
  622. package/resources/gofer/system-skills/8_gofer_branding/SKILL.md +315 -0
  623. package/resources/gofer/system-skills/9_gofer_tests/SKILL.md +558 -0
  624. package/resources/gofer/system-skills/gofer_bootstrap_workspace/SKILL.md +148 -0
  625. package/resources/gofer/system-skills/gofer_check_workspace/SKILL.md +119 -0
  626. package/resources/gofer/system-skills/gofer_constitution/SKILL.md +612 -0
  627. package/resources/gofer/system-skills/gofer_diagnose/SKILL.md +114 -0
  628. package/resources/gofer/system-skills/gofer_eai_first_run/SKILL.md +397 -0
  629. package/resources/gofer/system-skills/gofer_hydrate/SKILL.md +561 -0
  630. package/resources/gofer/system-skills/gofer_personality/SKILL.md +44 -0
  631. package/resources/gofer/system-skills/gofer_plan/SKILL.md +40 -0
  632. package/resources/gofer/system-skills/gofer_side/SKILL.md +45 -0
  633. package/resources/gofer/system-skills/gofer_spec_summary/SKILL.md +112 -0
  634. package/resources/gofer/system-skills/gofer_tdd/SKILL.md +112 -0
  635. package/resources/gofer/system-skills/gofer_vocabulary/SKILL.md +112 -0
  636. package/resources/gofer/system-skills/gofer_zoom_out/SKILL.md +112 -0
  637. package/resources/gofer/templates/agent-file-template.md +28 -0
  638. package/resources/gofer/templates/assumptions-template.md +94 -0
  639. package/resources/gofer/templates/audit-history-template.md +35 -0
  640. package/resources/gofer/templates/brand/brand-profile-template.json +45 -0
  641. package/resources/gofer/templates/brand/document-style-template.md +50 -0
  642. package/resources/gofer/templates/brand/marp-theme-template.css +58 -0
  643. package/resources/gofer/templates/brownfield-analysis.md +44 -0
  644. package/resources/gofer/templates/business-metrics-template.md +120 -0
  645. package/resources/gofer/templates/business-owner-summary-template.md +83 -0
  646. package/resources/gofer/templates/checklist-template.md +40 -0
  647. package/resources/gofer/templates/ciso-security-summary-template.md +70 -0
  648. package/resources/gofer/templates/context-bundle-template.md +76 -0
  649. package/resources/gofer/templates/contract-pack-template.md +109 -0
  650. package/resources/gofer/templates/cto-architecture-summary-template.md +83 -0
  651. package/resources/gofer/templates/discovery-template.md +92 -0
  652. package/resources/gofer/templates/eai-preflight-template.md +144 -0
  653. package/resources/gofer/templates/goal-ledger-template.json +69 -0
  654. package/resources/gofer/templates/gofer-model-policy.yaml +97 -0
  655. package/resources/gofer/templates/issues-template.md +106 -0
  656. package/resources/gofer/templates/journey/base-journey.md +95 -0
  657. package/resources/gofer/templates/journey/industry-variants.yaml +277 -0
  658. package/resources/gofer/templates/loop-contract-template.json +68 -0
  659. package/resources/gofer/templates/plan-template.md +215 -0
  660. package/resources/gofer/templates/problem-brief-template.md +85 -0
  661. package/resources/gofer/templates/proposal-review-template.md +79 -0
  662. package/resources/gofer/templates/research-template.md +222 -0
  663. package/resources/gofer/templates/reuse-scan-template.md +43 -0
  664. package/resources/gofer/templates/sequence-diagrams/option-spectrum.yaml +178 -0
  665. package/resources/gofer/templates/service-fit-matrix-template.md +29 -0
  666. package/resources/gofer/templates/session-handoff-template.md +172 -0
  667. package/resources/gofer/templates/spec-summary-template.md +118 -0
  668. package/resources/gofer/templates/spec-template.md +196 -0
  669. package/resources/gofer/templates/stakeholder-comms-template.md +330 -0
  670. package/resources/gofer/templates/stakeholder-review-index-template.md +54 -0
  671. package/resources/gofer/templates/tasks-template.md +323 -0
  672. package/resources/gofer/templates/ui-approval-template.md +32 -0
  673. package/resources/gofer/templates/ui-preview-brief-template.md +65 -0
  674. package/resources/gofer/templates/ui-review-log-template.md +11 -0
  675. package/resources/gofer/templates/visuals/.gitkeep +0 -0
  676. package/resources/gofer/templates/visuals/bounded-context-map.md +19 -0
  677. package/resources/gofer/templates/visuals/bounded-context-template.md +47 -0
  678. package/resources/gofer/templates/visuals/c4-container-template.md +38 -0
  679. package/resources/gofer/templates/visuals/c4-container.md +20 -0
  680. package/resources/gofer/templates/visuals/c4-context-template.md +46 -0
  681. package/resources/gofer/templates/visuals/capability-heatmap-template.md +54 -0
  682. package/resources/gofer/templates/visuals/data-model-erd-template.md +41 -0
  683. package/resources/gofer/templates/visuals/erd.md +19 -0
  684. package/resources/gofer/templates/visuals/impact-canvas.md +40 -0
  685. package/resources/gofer/templates/visuals/risk-heatmap-template.md +51 -0
  686. package/resources/gofer/templates/visuals/roi-projection.md +17 -0
  687. package/resources/gofer/templates/visuals/value-stream-asis.md +16 -0
  688. package/resources/gofer/templates/visuals/value-stream-tobe.md +18 -0
  689. package/resources/gofer/templates/working-backwards-prfaq-template.md +165 -0
  690. package/resources/linked-sources.json +25 -0
@@ -0,0 +1,1366 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * generate-commands.mjs
4
+ * Generates surface-specific command/skill files from canonical stage definitions.
5
+ *
6
+ * Usage:
7
+ * node generate-commands.mjs [--dry-run] [--surfaces <comma-list>] [--root <path>]
8
+ *
9
+ * Surfaces: claude, claude-mirror, copilot, github-prompts, github-agents,
10
+ * github-skills, claude-skills, agents-skills, system-skills,
11
+ * gemini, agents-md, codex-config
12
+ */
13
+
14
+ import { promises as fs } from 'fs';
15
+ import path from 'path';
16
+ import { createHash } from 'crypto';
17
+ import { validateDescriptions } from './canonical-descriptions.mjs';
18
+ import { parseStageCommand } from './parse-stage-command.mjs';
19
+
20
+ // ---------------------------------------------------------------------------
21
+ // Constants
22
+ // ---------------------------------------------------------------------------
23
+
24
+ /**
25
+ * Legacy compatibility export. Gofer now emits every command/helper to every
26
+ * supported surface when the stage frontmatter lists that surface.
27
+ */
28
+ export const CLAUDE_ONLY_STAGES = [];
29
+
30
+ const ALL_SURFACES = [
31
+ 'claude',
32
+ 'claude-mirror',
33
+ 'claude-skills',
34
+ 'copilot',
35
+ 'github-prompts',
36
+ 'github-agents',
37
+ 'github-skills',
38
+ 'agents-skills',
39
+ 'system-skills',
40
+ 'gemini',
41
+ 'agents-md',
42
+ 'codex-config',
43
+ ];
44
+
45
+ const PUBLIC_SITE_URL = 'https://eai-tools.github.io/eai-gofer';
46
+ const PUBLIC_RELEASES_URL = `${PUBLIC_SITE_URL}/releases`;
47
+ const PUBLIC_PLUGIN_URL = `${PUBLIC_RELEASES_URL}/plugins/eai-gofer`;
48
+ const SURFACE_WORKSPACE_HOSTS = {
49
+ 'claude': 'claude',
50
+ 'claude-mirror': 'claude',
51
+ 'claude-skills': 'claude',
52
+ 'copilot': 'copilot',
53
+ 'github-prompts': 'copilot',
54
+ 'github-agents': 'copilot',
55
+ 'github-skills': 'copilot',
56
+ 'agents-skills': 'codex',
57
+ 'system-skills': 'codex',
58
+ 'gemini': 'gemini',
59
+ };
60
+ const WORKSPACE_PREFLIGHT_EXCLUDED_COMMANDS = new Set([
61
+ 'gofer:plan',
62
+ 'gofer:side',
63
+ 'gofer:personality',
64
+ 'gofer:check-workspace',
65
+ 'gofer:bootstrap-workspace',
66
+ 'gofer:eai-first-run',
67
+ ]);
68
+ const LEGACY_STAGE_STEMS = new Map([
69
+ ['0_gofer_start', ['0_business_scenario']],
70
+ ]);
71
+
72
+ // ---------------------------------------------------------------------------
73
+ // Exclusion logic
74
+ // ---------------------------------------------------------------------------
75
+
76
+ /**
77
+ * Returns true if the given stage should be excluded from the given surface.
78
+ * Gofer keeps this function for older tests/imports, but no stages are
79
+ * excluded by name anymore. Surface availability is controlled by stage
80
+ * frontmatter so Claude, Copilot, Codex, and Gemini stay in parity.
81
+ *
82
+ * @param {string} stageName
83
+ * @param {string} surface
84
+ * @returns {boolean}
85
+ */
86
+ export function shouldExclude(stageName, surface) {
87
+ void stageName;
88
+ void surface;
89
+ return false;
90
+ }
91
+
92
+ // ---------------------------------------------------------------------------
93
+ // Helpers
94
+ // ---------------------------------------------------------------------------
95
+
96
+ /**
97
+ * Ensures a directory exists, creating it (and parents) if needed.
98
+ * @param {string} dirPath
99
+ */
100
+ async function ensureDir(dirPath) {
101
+ await fs.mkdir(dirPath, { recursive: true });
102
+ }
103
+
104
+ async function detectPackageVersion(root) {
105
+ const candidates = [
106
+ path.join(root, 'package.json'),
107
+ path.join(root, 'extension', 'package.json'),
108
+ ];
109
+
110
+ for (const candidate of candidates) {
111
+ try {
112
+ const parsed = JSON.parse(await fs.readFile(candidate, 'utf8'));
113
+ if (typeof parsed.version === 'string' && parsed.version.length > 0) {
114
+ return parsed.version;
115
+ }
116
+ } catch (error) {
117
+ if (error?.code !== 'ENOENT') {
118
+ throw error;
119
+ }
120
+ }
121
+ }
122
+
123
+ return '1.0.0';
124
+ }
125
+
126
+ function buildGeminiExtensionManifest(version) {
127
+ return {
128
+ name: 'eai-gofer',
129
+ version,
130
+ description: 'Gofer core pipeline and helper commands as a Gemini CLI extension',
131
+ license: 'Apache-2.0',
132
+ commands: '.gemini/commands/gofer/',
133
+ gofer: {
134
+ bundle_url: PUBLIC_PLUGIN_URL,
135
+ manifest_url: `${PUBLIC_PLUGIN_URL}/gemini-extension.json`,
136
+ commands_manifest_url: `${PUBLIC_PLUGIN_URL}/gemini-commands-manifest.json`,
137
+ download_url: `${PUBLIC_RELEASES_URL}/eai-gofer-agent-plugin-${version}.zip`,
138
+ latest_download_url: `${PUBLIC_RELEASES_URL}/eai-gofer-agent-plugin-latest.zip`,
139
+ vsix_url: `${PUBLIC_RELEASES_URL}/eai-gofer-${version}.vsix`,
140
+ latest_vsix_url: `${PUBLIC_RELEASES_URL}/eai-gofer-latest.vsix`,
141
+ },
142
+ };
143
+ }
144
+
145
+ /**
146
+ * Loads and parses all stage command files from .specify/commands/.
147
+ * Skips .gitkeep and any non-.md files.
148
+ *
149
+ * @param {string} root Absolute path to project root
150
+ * @returns {Promise<Array<{ filePath: string, frontmatter: Record<string, unknown>, body: string }>>}
151
+ */
152
+ async function loadStages(root) {
153
+ const commandsDir = path.join(root, '.specify', 'commands');
154
+ let entries;
155
+ try {
156
+ entries = await fs.readdir(commandsDir);
157
+ } catch {
158
+ throw new Error(`.specify/commands/ not found at ${commandsDir}`);
159
+ }
160
+
161
+ const stages = [];
162
+ const parseErrors = [];
163
+ for (const entry of entries) {
164
+ if (!entry.endsWith('.md') || entry === '.gitkeep') continue;
165
+ const filePath = path.join(commandsDir, entry);
166
+ try {
167
+ const parsed = await parseStageCommand(filePath);
168
+ stages.push({ filePath, ...parsed });
169
+ } catch (err) {
170
+ parseErrors.push(`${entry}: ${err instanceof Error ? err.message : String(err)}`);
171
+ }
172
+ }
173
+
174
+ if (parseErrors.length > 0) {
175
+ throw new Error(
176
+ `Failed to parse ${parseErrors.length} command file(s):\n${parseErrors.join('\n')}`
177
+ );
178
+ }
179
+
180
+ return stages;
181
+ }
182
+
183
+ function getStageOutputStem(stage) {
184
+ return path.basename(stage.filePath, '.md');
185
+ }
186
+
187
+ function getLegacyStageStems(stage) {
188
+ return LEGACY_STAGE_STEMS.get(getStageOutputStem(stage)) ?? [];
189
+ }
190
+
191
+ async function removeLegacyGeneratedPath(outPath, legacyPath) {
192
+ if (outPath === legacyPath) {
193
+ return;
194
+ }
195
+
196
+ await fs.rm(legacyPath, { recursive: true, force: true });
197
+ }
198
+
199
+ async function removeLegacyGeneratedPaths(outPath, legacyPaths) {
200
+ for (const legacyPath of legacyPaths) {
201
+ await removeLegacyGeneratedPath(outPath, legacyPath);
202
+ }
203
+ }
204
+
205
+ function getCodexLegacySkillDirs(root, surfaceRoot, stageStem, stageName) {
206
+ return [
207
+ path.join(root, surfaceRoot, stageName),
208
+ path.join(root, surfaceRoot, 'gofer', stageStem),
209
+ path.join(root, surfaceRoot, 'gofer', stageName),
210
+ ];
211
+ }
212
+
213
+ // ---------------------------------------------------------------------------
214
+ // Surface emitters
215
+ // ---------------------------------------------------------------------------
216
+
217
+ /**
218
+ * T037 — claude emitter
219
+ * Emits body to .claude/commands/<name>.md for stages that include 'claude' surface.
220
+ *
221
+ * @param {Array} stages
222
+ * @param {string} root
223
+ * @param {boolean} dryRun
224
+ */
225
+ async function emitClaude(stages, root, dryRun) {
226
+ const outDir = path.join(root, '.claude', 'commands');
227
+ let count = 0;
228
+ for (const stage of stages) {
229
+ const { name, surfaces } = stage.frontmatter;
230
+ if (!surfaces.includes('claude')) continue;
231
+ if (shouldExclude(String(name), 'claude')) continue;
232
+
233
+ const stageStem = getStageOutputStem(stage);
234
+ const outPath = path.join(outDir, `${stageStem}.md`);
235
+ const legacyPaths = [
236
+ path.join(outDir, `${name}.md`),
237
+ ...getLegacyStageStems(stage).map((legacyStem) => path.join(outDir, `${legacyStem}.md`)),
238
+ ];
239
+ if (dryRun) {
240
+ console.log(`[dry-run] claude: would write ${outPath}`);
241
+ } else {
242
+ await ensureDir(outDir);
243
+ await fs.writeFile(
244
+ outPath,
245
+ injectTokenCostPolicy(
246
+ injectWorkspacePreflight(stage.body, String(name), SURFACE_WORKSPACE_HOSTS['claude'])
247
+ ),
248
+ 'utf8'
249
+ );
250
+ await removeLegacyGeneratedPaths(outPath, legacyPaths);
251
+ console.log(`claude: wrote ${outPath}`);
252
+ }
253
+ count++;
254
+ }
255
+ console.log(`claude: ${count} file(s) emitted`);
256
+ return true;
257
+ }
258
+
259
+ /**
260
+ * T038 — claude-mirror emitter
261
+ * Emits body to extension/resources/claude-commands/<name>.md.
262
+ *
263
+ * @param {Array} stages
264
+ * @param {string} root
265
+ * @param {boolean} dryRun
266
+ */
267
+ async function emitClaudeMirror(stages, root, dryRun) {
268
+ const outDir = path.join(root, 'extension', 'resources', 'claude-commands');
269
+ let count = 0;
270
+ for (const stage of stages) {
271
+ const { name, surfaces } = stage.frontmatter;
272
+ if (!surfaces.includes('claude-mirror')) continue;
273
+ if (shouldExclude(String(name), 'claude-mirror')) continue;
274
+
275
+ const stageStem = getStageOutputStem(stage);
276
+ const outPath = path.join(outDir, `${stageStem}.md`);
277
+ const legacyPaths = [
278
+ path.join(outDir, `${name}.md`),
279
+ ...getLegacyStageStems(stage).map((legacyStem) => path.join(outDir, `${legacyStem}.md`)),
280
+ ];
281
+ if (dryRun) {
282
+ console.log(`[dry-run] claude-mirror: would write ${outPath}`);
283
+ } else {
284
+ await ensureDir(outDir);
285
+ await fs.writeFile(
286
+ outPath,
287
+ injectTokenCostPolicy(
288
+ injectWorkspacePreflight(
289
+ stage.body,
290
+ String(name),
291
+ SURFACE_WORKSPACE_HOSTS['claude-mirror']
292
+ )
293
+ ),
294
+ 'utf8'
295
+ );
296
+ await removeLegacyGeneratedPaths(outPath, legacyPaths);
297
+ console.log(`claude-mirror: wrote ${outPath}`);
298
+ }
299
+ count++;
300
+ }
301
+ console.log(`claude-mirror: ${count} file(s) emitted`);
302
+ return true;
303
+ }
304
+
305
+ /**
306
+ * T039 — copilot emitter
307
+ * Emits body to extension/resources/copilot-prompts/<name>.prompt.md.
308
+ * Emits every stage whose frontmatter includes the Copilot surface.
309
+ *
310
+ * @param {Array} stages
311
+ * @param {string} root
312
+ * @param {boolean} dryRun
313
+ */
314
+ async function emitCopilot(stages, root, dryRun) {
315
+ const outDir = path.join(root, 'extension', 'resources', 'copilot-prompts');
316
+ let count = 0;
317
+ for (const stage of stages) {
318
+ const { name, surfaces } = stage.frontmatter;
319
+ if (shouldExclude(String(name), 'copilot')) continue;
320
+ if (!surfaces.includes('copilot')) continue;
321
+
322
+ const stageStem = getStageOutputStem(stage);
323
+ const outPath = path.join(outDir, `${stageStem}.prompt.md`);
324
+ const legacyPaths = [
325
+ path.join(outDir, `${name}.prompt.md`),
326
+ ...getLegacyStageStems(stage).map((legacyStem) =>
327
+ path.join(outDir, `${legacyStem}.prompt.md`)
328
+ ),
329
+ ];
330
+ if (dryRun) {
331
+ console.log(`[dry-run] copilot: would write ${outPath}`);
332
+ } else {
333
+ await ensureDir(outDir);
334
+ await fs.writeFile(
335
+ outPath,
336
+ buildCopilotPromptContent(stage, SURFACE_WORKSPACE_HOSTS['copilot']),
337
+ 'utf8'
338
+ );
339
+ await removeLegacyGeneratedPaths(outPath, legacyPaths);
340
+ console.log(`copilot: wrote ${outPath}`);
341
+ }
342
+ count++;
343
+ }
344
+ console.log(`copilot: ${count} file(s) emitted`);
345
+ return true;
346
+ }
347
+
348
+ /**
349
+ * T040 — github-prompts emitter
350
+ * Emits body to .github/prompts/<name>.prompt.md.
351
+ * Emits every stage whose frontmatter includes the GitHub prompts surface.
352
+ *
353
+ * @param {Array} stages
354
+ * @param {string} root
355
+ * @param {boolean} dryRun
356
+ */
357
+ async function emitGithubPrompts(stages, root, dryRun) {
358
+ const outDir = path.join(root, '.github', 'prompts');
359
+ let count = 0;
360
+ for (const stage of stages) {
361
+ const { name, surfaces } = stage.frontmatter;
362
+ if (shouldExclude(String(name), 'github-prompts')) continue;
363
+ if (!surfaces.includes('github-prompts')) continue;
364
+
365
+ const stageStem = getStageOutputStem(stage);
366
+ const outPath = path.join(outDir, `${stageStem}.prompt.md`);
367
+ const legacyPaths = [
368
+ path.join(outDir, `${name}.prompt.md`),
369
+ ...getLegacyStageStems(stage).map((legacyStem) =>
370
+ path.join(outDir, `${legacyStem}.prompt.md`)
371
+ ),
372
+ ];
373
+ if (dryRun) {
374
+ console.log(`[dry-run] github-prompts: would write ${outPath}`);
375
+ } else {
376
+ await ensureDir(outDir);
377
+ await fs.writeFile(
378
+ outPath,
379
+ buildCopilotPromptContent(stage, SURFACE_WORKSPACE_HOSTS['github-prompts']),
380
+ 'utf8'
381
+ );
382
+ await removeLegacyGeneratedPaths(outPath, legacyPaths);
383
+ console.log(`github-prompts: wrote ${outPath}`);
384
+ }
385
+ count++;
386
+ }
387
+ console.log(`github-prompts: ${count} file(s) emitted`);
388
+ return true;
389
+ }
390
+
391
+ /**
392
+ * Builds a Copilot prompt using the same metadata and body transform as the
393
+ * runtime CommandGenerator. This keeps .github/prompts and bundled VSIX
394
+ * resources byte-equivalent to generated Copilot mirrors.
395
+ *
396
+ * @param {{ frontmatter: Record<string, unknown>, body: string }} stage
397
+ * @returns {string}
398
+ */
399
+ function buildCopilotPromptContent(stage, host = SURFACE_WORKSPACE_HOSTS['copilot']) {
400
+ const stageName = String(stage.frontmatter.name);
401
+ const { frontmatter, body } = splitMarkdownFrontmatter(stage.body);
402
+ const description = readString(frontmatter.description) ?? String(stage.frontmatter.description);
403
+ const transformedBody = injectPipelineContinuation(
404
+ injectTokenCostPolicy(
405
+ injectWorkspacePreflight(transformClaudeContent(body, 'copilot'), stageName, host)
406
+ ),
407
+ 'copilot',
408
+ stageName
409
+ );
410
+ const canonicalChecksum = createHash('sha256').update(body, 'utf8').digest('hex');
411
+ const sourceFileName = path.basename(stage.filePath);
412
+
413
+ return [
414
+ '---',
415
+ `name: ${stageName}`,
416
+ `description: ${description}`,
417
+ 'agent: copilot-workspace',
418
+ 'tools:',
419
+ ' - Read',
420
+ ' - Grep',
421
+ ' - Glob',
422
+ ' - Bash',
423
+ ' - WebSearch',
424
+ 'argument-hint: feature-name-or-description',
425
+ 'gofer:',
426
+ ' workflowProfile: standard',
427
+ ` canonicalSource: .specify/commands/${sourceFileName}`,
428
+ ` canonicalChecksum: ${canonicalChecksum}`,
429
+ ' metadataSource: scripts/generate-commands.ts',
430
+ '---',
431
+ '',
432
+ transformedBody,
433
+ ].join('\n');
434
+ }
435
+
436
+ /**
437
+ * @param {string} content
438
+ * @returns {{ frontmatter: Record<string, unknown>, body: string }}
439
+ */
440
+ function splitMarkdownFrontmatter(content) {
441
+ const match = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
442
+ if (!match) {
443
+ return { frontmatter: {}, body: content };
444
+ }
445
+
446
+ const frontmatter = {};
447
+ for (const line of match[1].split('\n')) {
448
+ const fieldMatch = line.match(/^([A-Za-z0-9_-]+):\s*(.*)$/);
449
+ if (!fieldMatch) continue;
450
+ frontmatter[fieldMatch[1]] = fieldMatch[2].trim().replace(/^["']|["']$/g, '');
451
+ }
452
+
453
+ return { frontmatter, body: match[2] };
454
+ }
455
+
456
+ /**
457
+ * @param {string} content
458
+ * @param {'copilot'} toPlatform
459
+ * @returns {string}
460
+ */
461
+ function transformClaudeContent(content, toPlatform) {
462
+ let transformed = content;
463
+ const stageCommandPattern = /\/(\d+[a-z]?_[a-z0-9_]+)/g;
464
+ const helperCommandPattern = /\/(gofer_[a-z0-9_]+)/g;
465
+
466
+ transformed = transformed.replace(/\*\*AUTO-CHAIN[^]*?(?=\n##|\n---|\n\*\*|$)/g, '');
467
+ transformed = transformed.replace(
468
+ /by calling the Skill tool with skill="[^"]+"/g,
469
+ 'by running the next command'
470
+ );
471
+ transformed = transformed.replace(/Skill tool/g, 'next command');
472
+
473
+ if (toPlatform === 'copilot') {
474
+ transformed = transformed.replace(stageCommandPattern, '#$1');
475
+ transformed = transformed.replace(helperCommandPattern, '#$1');
476
+ transformed = transformed.replace(/(^SourceCommandId:\s*)#/gm, '$1/');
477
+ }
478
+
479
+ return transformed;
480
+ }
481
+
482
+ /**
483
+ * @param {string} content
484
+ * @param {'copilot'} platform
485
+ * @param {string} commandName
486
+ * @returns {string}
487
+ */
488
+ function injectPipelineContinuation(content, platform, commandName) {
489
+ void platform;
490
+ const nextCommand = getNextCommand(commandName);
491
+ if (!nextCommand) return content;
492
+
493
+ const autoChainSection = `\n\n## Pipeline Continuation\n\nThis completes the ${commandName} stage. To continue the Gofer pipeline:\n\n**Next Command:** \`#${nextCommand}\`\n\nThe next stage will read the artifacts from this stage and continue the workflow automatically.\n\n**Note:** Copilot Chat supports context preservation. Your conversation history will be maintained as you progress through pipeline stages.\n`;
494
+
495
+ if (content.includes('## Key Rules')) {
496
+ return content.replace('## Key Rules', `${autoChainSection}\n## Key Rules`);
497
+ }
498
+
499
+ return content + autoChainSection;
500
+ }
501
+
502
+ function buildEaiPlatformSessionPreflightSection() {
503
+ return `
504
+ ## EAI Platform Session Preflight
505
+
506
+ Before any Gofer stage/helper command does pipeline work:
507
+
508
+ 1. Treat durable delivery as EAI Platform delivery by default, with Azure second and every other stack only by explicit exception.
509
+ 2. Run \`eai whoami\` and confirm the EAI CLI is installed, the user is logged in, and an active tenant is visible.
510
+ 3. If \`eai\` is missing, \`eai whoami\` fails, the token is expired, or no active tenant is available, stop and run \`/gofer:eai-first-run\` or ask the user to approve login/setup before continuing.
511
+ 4. For EAI app delivery, do not continue into research, specification, planning, tasks, implementation, or validation until \`.specify/specs/{feature}/eai-preflight.md\` records login, tenant, template, app-readiness, and next-action evidence.
512
+ 5. Do not write tokens, secrets, private tenant IDs, or local \`.env\` values into Gofer artifacts; record only product-safe readiness status and evidence.
513
+ `.trim();
514
+ }
515
+
516
+ function injectEaiPlatformSessionPreflight(content) {
517
+ if (content.includes('## EAI Platform Session Preflight')) {
518
+ return content;
519
+ }
520
+
521
+ const section = buildEaiPlatformSessionPreflightSection();
522
+ const workspaceHeadingIndex = content.indexOf('## Workspace Preflight');
523
+ if (workspaceHeadingIndex !== -1) {
524
+ const nextHeadingIndex = content.indexOf('\n## ', workspaceHeadingIndex + 1);
525
+ if (nextHeadingIndex !== -1) {
526
+ return `${content.slice(0, nextHeadingIndex).trimEnd()}\n\n${section}\n\n${content
527
+ .slice(nextHeadingIndex)
528
+ .replace(/^\n+/, '')}`;
529
+ }
530
+ return `${content.trimEnd()}\n\n${section}\n`;
531
+ }
532
+
533
+ return `${section}\n\n${content}`;
534
+ }
535
+
536
+ function buildWorkspacePreflightSection(host = 'auto', includeEaiPreflight = true) {
537
+ const eaiPreflight = includeEaiPreflight
538
+ ? `\n\n${buildEaiPlatformSessionPreflightSection()}`
539
+ : '';
540
+
541
+ return `
542
+ ## Workspace Preflight
543
+
544
+ Before doing stage/helper work:
545
+
546
+ 1. Resolve the repository root.
547
+ 2. Check the core Gofer sentinels:
548
+ - \`.specify/.gofer-version\`
549
+ - \`.specify/commands/0_gofer_start.md\`
550
+ - \`.specify/templates/spec-template.md\`
551
+ - \`.specify/templates/loop-contract-template.json\`
552
+ - \`.specify/templates/working-backwards-prfaq-template.md\`
553
+ - \`.specify/templates/business-owner-summary-template.md\`
554
+ - \`.specify/templates/cto-architecture-summary-template.md\`
555
+ - \`.specify/templates/ciso-security-summary-template.md\`
556
+ - \`.specify/templates/stakeholder-review-index-template.md\`
557
+ - \`.specify/scripts/bash/create-new-feature.sh\`
558
+ - \`.specify/scripts/node/parse-stage-command.mjs\`
559
+ - \`.specify/scripts/node/gofer-loop-audit.mjs\`
560
+ - \`.specify/scripts/hooks/post-tool-use.mjs\`
561
+ - \`.specify/scripts/powershell/install-optional-tools.ps1\`
562
+ - \`.specify/templates/gofer-model-policy.yaml\`
563
+ - \`.specify/memory/gofer-model-policy.yaml\`
564
+ - \`.specify/specs/\`
565
+ - \`.specify/memory/\`
566
+ 3. Check host-specific repo-owned files when relevant:
567
+ - Claude: \`AGENTS.md\`, \`CLAUDE.md\`, \`.claude/settings.json\`
568
+ - Codex: \`AGENTS.md\`
569
+ - Copilot: \`.github/copilot-instructions.md\`
570
+ - VS Code extension mirrors Claude/Copilot/Gemini resources itself and should still keep the core scaffold healthy
571
+ 4. If the repo already has the workspace checker script, prefer running:
572
+ - \`node .specify/scripts/node/gofer-workspace-check.mjs --host ${host} --json\`
573
+ 5. If the workspace is missing or stale, ask exactly:
574
+ - **"This repo is missing or stale for Gofer. Initialize/update it now?"**
575
+ 6. If the user says yes, run the Gofer workspace bootstrap helper and then resume this command from the top.
576
+ 7. If the user says no, stop and explain that Gofer stage/helper work depends on the repo-owned scaffold.${eaiPreflight}
577
+ `.trim();
578
+ }
579
+
580
+ function injectWorkspacePreflight(content, commandName, host = 'auto') {
581
+ if (WORKSPACE_PREFLIGHT_EXCLUDED_COMMANDS.has(commandName)) {
582
+ return content;
583
+ }
584
+
585
+ if (content.includes('## Workspace Preflight')) {
586
+ const updatedContent = content.replace(
587
+ /`node \.specify\/scripts\/node\/gofer-workspace-check\.mjs --host [^`\n]+ --json`/,
588
+ `\`node .specify/scripts/node/gofer-workspace-check.mjs --host ${host} --json\``
589
+ );
590
+ return injectEaiPlatformSessionPreflight(updatedContent);
591
+ }
592
+
593
+ const section = buildWorkspacePreflightSection(
594
+ host,
595
+ !content.includes('## EAI Platform Session Preflight')
596
+ );
597
+ const headingMatch = content.match(/^# [^\n]+\n+/);
598
+ if (!headingMatch) {
599
+ return `${section}\n\n${content}`;
600
+ }
601
+
602
+ const insertAt = headingMatch[0].length;
603
+ const prefix = content.slice(0, insertAt);
604
+ const suffix = content.slice(insertAt).replace(/^\n+/, '');
605
+ return `${prefix}${section}\n\n${suffix}`;
606
+ }
607
+
608
+ function buildTokenCostPolicySection() {
609
+ return `
610
+ ## Token And Cost Policy
611
+ <!-- gofer:token-cost-policy:start -->
612
+
613
+ Before spawning agents, calling tools, or loading large files:
614
+
615
+ 1. Treat \`.specify/memory/gofer-model-policy.yaml\` as the repo-owned source of truth for simple, medium, hard, and arbiter model routing. If it is missing, run \`/gofer:bootstrap-workspace\` before continuing.
616
+ 2. Use the cheapest capable model first.
617
+ - Claude: Haiku for scouting/extraction; Sonnet for normal implementation, synthesis, validation, and security; Opus for high-risk arbitration or release-critical failures.
618
+ - Codex/OpenAI: GPT mini for simple coding; GPT nano only for locate/classify/summarize/mechanical work; GPT-5.3-Codex or flagship GPT for tool-heavy coding, architecture, and release-critical validation.
619
+ - Gemini: Flash-Lite for cheap large-context scan/summarize; Flash for default research synthesis; Pro for large-context architecture or high-risk arbitration.
620
+ - Copilot: prefer Auto for simple and default work; ask the user before choosing a paid/high-tier picker model for hard security, architecture, or release gates.
621
+ 3. Keep raw tool output out of the main conversation context. Save stable findings to \`.specify/specs/{feature}/context-bundle.md\`, then work from summaries.
622
+ 4. Use provider prompt/context caching only for stable, non-secret prefixes: Gofer scaffold, AGENTS/CLAUDE/Copilot instructions, constitution, repo map, stage contracts, and validation rubric.
623
+ 5. Before continuing after large research, planning, implementation, or validation bursts, checkpoint the durable artifacts and compact/clear/resume context when the host supports it.
624
+ 6. Escalate model tier only when a cheaper pass is low-confidence, contradictory, security-sensitive, or blocking release quality.
625
+ <!-- gofer:token-cost-policy:end -->
626
+ `.trim();
627
+ }
628
+
629
+ function injectTokenCostPolicy(content) {
630
+ const section = buildTokenCostPolicySection();
631
+ const startMarker = '<!-- gofer:token-cost-policy:start -->';
632
+ const endMarker = '<!-- gofer:token-cost-policy:end -->';
633
+
634
+ if (content.includes(startMarker) && content.includes(endMarker)) {
635
+ const headingIndex = content.indexOf('## Token And Cost Policy');
636
+ const endIndex = content.indexOf(endMarker, headingIndex) + endMarker.length;
637
+ const suffix = content.slice(endIndex).replace(/^\n+/, '');
638
+ return suffix
639
+ ? `${content.slice(0, headingIndex).trimEnd()}\n\n${section}\n\n${suffix}`
640
+ : `${content.slice(0, headingIndex).trimEnd()}\n\n${section}\n`;
641
+ }
642
+
643
+ if (content.includes('## Token And Cost Policy')) {
644
+ const legacyPolicyPattern =
645
+ /## Token And Cost Policy\n\nBefore spawning agents, calling tools, or loading large files:\n\n[\s\S]*?^6\. Escalate model tier only when a cheaper pass is low-confidence, contradictory, security-sensitive, or blocking release quality\.\n?/m;
646
+ const legacyMatch = content.match(legacyPolicyPattern);
647
+ if (legacyMatch && legacyMatch.index !== undefined) {
648
+ const suffix = content.slice(legacyMatch.index + legacyMatch[0].length).replace(/^\n+/, '');
649
+ return suffix
650
+ ? `${content.slice(0, legacyMatch.index).trimEnd()}\n\n${section}\n\n${suffix}`
651
+ : `${content.slice(0, legacyMatch.index).trimEnd()}\n\n${section}\n`;
652
+ }
653
+
654
+ const headingIndex = content.indexOf('## Token And Cost Policy');
655
+ const nextHeading = content.indexOf('\n## ', headingIndex + 1);
656
+ if (nextHeading !== -1) {
657
+ return `${content.slice(0, headingIndex).trimEnd()}\n\n${section}\n\n${content
658
+ .slice(nextHeading)
659
+ .replace(/^\n+/, '')}`;
660
+ }
661
+
662
+ return content;
663
+ }
664
+
665
+ if (content.includes('## Workspace Preflight')) {
666
+ const nextHeading = content.indexOf('\n## ', content.indexOf('## Workspace Preflight') + 1);
667
+ if (nextHeading !== -1) {
668
+ return `${content.slice(0, nextHeading).trimEnd()}\n\n${section}\n\n${content
669
+ .slice(nextHeading)
670
+ .replace(/^\n+/, '')}`;
671
+ }
672
+ }
673
+
674
+ const headingMatch = content.match(/^# [^\n]+\n+/);
675
+ if (!headingMatch) {
676
+ return `${section}\n\n${content}`;
677
+ }
678
+
679
+ const insertAt = headingMatch[0].length;
680
+ const prefix = content.slice(0, insertAt);
681
+ const suffix = content.slice(insertAt).replace(/^\n+/, '');
682
+ return `${prefix}${section}\n\n${suffix}`;
683
+ }
684
+
685
+ /**
686
+ * @param {string} currentCommand
687
+ * @returns {string | null}
688
+ */
689
+ function getNextCommand(currentCommand) {
690
+ const pipeline = [
691
+ '0_gofer_start',
692
+ '1_gofer_research',
693
+ '2_gofer_specify',
694
+ '3_gofer_plan',
695
+ '4_gofer_tasks',
696
+ '5_gofer_implement',
697
+ '6_gofer_validate',
698
+ ];
699
+
700
+ const currentIndex = pipeline.indexOf(currentCommand);
701
+ if (currentIndex >= 0 && currentIndex < pipeline.length - 1) {
702
+ return pipeline[currentIndex + 1];
703
+ }
704
+
705
+ return null;
706
+ }
707
+
708
+ /**
709
+ * @param {unknown} value
710
+ * @returns {string | undefined}
711
+ */
712
+ function readString(value) {
713
+ return typeof value === 'string' && value.trim().length > 0 ? value.trim() : undefined;
714
+ }
715
+
716
+ /**
717
+ * Builds a SKILL.md content string.
718
+ * @param {string} stageName
719
+ * @param {string} description
720
+ * @param {string} body
721
+ * @returns {string}
722
+ */
723
+ function buildSkillContent(stageName, description, body) {
724
+ return `---\nname: ${stageName}\ndescription: "${description}"\n---\n\n${body}`;
725
+ }
726
+
727
+ function buildUmbrellaSkillContent(version, stages, hostLabel) {
728
+ const stageList = stages
729
+ .map((stage) => `- \`/${getStageOutputStem(stage)}\` - ${stage.frontmatter.description}`)
730
+ .join('\n');
731
+
732
+ return `---\nname: eai-gofer\ndescription: "Use Gofer's repo-owned pipeline, scripts, and validation tools without duplicating every slash command in the picker."\n---\n\n# EAI Gofer\n\nVersion: ${version}\nHost: ${hostLabel}\n\nUse this skill when the user asks to install, update, diagnose, run, or understand Gofer from an AI coding app. Prefer this umbrella skill for app-level discovery. Use the plain slash commands for individual pipeline stages.\n\n## Clean Surface Contract\n\n- Stage work uses the plain repo slash commands, for example \`/0_gofer_start\`, \`/1_gofer_research\`, and \`/6_gofer_validate\`.\n- App-level setup, troubleshooting, and explanation should use this \`eai-gofer\` skill plus the repo-owned scripts in \`.specify/scripts/\`.\n- Do not expose a second full set of namespaced stage commands in the same picker when plain slash commands are available.\n- Check workspace health before stage work: \`node .specify/scripts/node/gofer-workspace-check.mjs --host auto --json\`.\n- If missing or stale, ask the user before running: \`node .specify/scripts/node/gofer-workspace-bootstrap.mjs --host auto --include-mirrors\`.\n\n## Light Plugin And Repo Scripts\n\nThe light plugin installs durable Gofer knowledge and app integration metadata. The repository remains the source of truth for executable scripts, commands, templates, specs, and memory. After bootstrap, agents should prefer repo-local scripts over bundled fallback copies because the repo can be updated by \`eai gofer refresh\` or the VS Code extension.\n\n## First EAI Platform App\n\nIf the user is starting a first EAI Platform app, run \`/gofer:eai-first-run\` before \`/0_gofer_start\`. It is intentionally allowed before \`.specify/\` exists.\n\n## Current Pipeline\n\n${stageList}\n`;
733
+ }
734
+
735
+ function buildGithubAgentContent({ id, description, tools, handoffs, body }) {
736
+ const frontmatter = [
737
+ '---',
738
+ `description: ${JSON.stringify(description)}`,
739
+ `tools: ${JSON.stringify(tools)}`,
740
+ ];
741
+
742
+ if (handoffs.length > 0) {
743
+ frontmatter.push('handoffs:');
744
+ for (const handoff of handoffs) {
745
+ frontmatter.push(` - agent: ${handoff.agent}`);
746
+ frontmatter.push(` label: ${JSON.stringify(handoff.label)}`);
747
+ frontmatter.push(` prompt: ${JSON.stringify(handoff.prompt)}`);
748
+ frontmatter.push(` send: ${handoff.send ? 'true' : 'false'}`);
749
+ }
750
+ }
751
+
752
+ frontmatter.push('---');
753
+
754
+ return `${frontmatter.join('\n')}\n\n# ${id}\n\n${body.trim()}\n`;
755
+ }
756
+
757
+ function getGithubAgentSpecs() {
758
+ const goferTools = [
759
+ 'search/codebase',
760
+ 'vscode/askQuestion',
761
+ 'gofer_check_workspace',
762
+ 'gofer_bootstrap_workspace',
763
+ 'gofer_get_pipeline_state',
764
+ 'gofer_start_stage',
765
+ 'gofer_validate_branch',
766
+ 'gofer_open_artifact',
767
+ ];
768
+
769
+ return [
770
+ {
771
+ id: 'gofer-business',
772
+ description: 'Gofer start and setup agent. Use for first-run setup, workspace health, feature intake, and selecting the right pipeline entry point.',
773
+ tools: goferTools,
774
+ handoffs: [
775
+ {
776
+ agent: 'gofer-research',
777
+ label: 'Continue to Research',
778
+ prompt: 'Continue with Gofer research for the confirmed feature. Check workspace health first, then run /1_gofer_research or the equivalent repo-local stage instruction.',
779
+ send: false,
780
+ },
781
+ ],
782
+ body: `
783
+ You are the Gofer start agent.
784
+
785
+ Start by checking Gofer workspace health. If the repo is missing or stale, ask before bootstrapping. Keep the user-facing surface simple: use plain slash commands for pipeline stages and the eai-gofer skill/tools for app-level setup.
786
+
787
+ Primary outputs:
788
+
789
+ - A clear route into \`/0_gofer_start\`, \`/gofer:eai-first-run\`, or standalone research.
790
+ - A concise statement of whether the repo has the Gofer scaffold, plugin/app support, and EAI first-run prerequisites.
791
+ `,
792
+ },
793
+ {
794
+ id: 'gofer-research',
795
+ description: 'Gofer research agent. Use for codebase and documentation research before specification.',
796
+ tools: goferTools,
797
+ handoffs: [
798
+ {
799
+ agent: 'gofer-plan',
800
+ label: 'Continue to Plan',
801
+ prompt: 'Continue through Gofer specify and plan stages using the research artifacts. Preserve workspace checks and artifact evidence.',
802
+ send: false,
803
+ },
804
+ ],
805
+ body: `
806
+ You are the Gofer research agent.
807
+
808
+ Use \`/1_gofer_research\` as the stage contract. Keep raw output out of chat when it is large; write durable findings to \`.specify/specs/{feature}/research.md\` and \`context-bundle.md\`.
809
+ `,
810
+ },
811
+ {
812
+ id: 'gofer-plan',
813
+ description: 'Gofer specification and planning agent. Use after research to produce spec, plan, contracts, and ordered tasks.',
814
+ tools: goferTools,
815
+ handoffs: [
816
+ {
817
+ agent: 'gofer-implement',
818
+ label: 'Implement Tasks',
819
+ prompt: 'Implement the approved Gofer tasks. Check pipeline state first and preserve traceability.',
820
+ send: false,
821
+ },
822
+ ],
823
+ body: `
824
+ You are the Gofer planning agent.
825
+
826
+ Use \`/2_gofer_specify\`, \`/3_gofer_plan\`, and \`/4_gofer_tasks\` as the stage contracts. Keep the plan grounded in existing repository scripts, current platform capabilities, and explicit validation obligations.
827
+ `,
828
+ },
829
+ {
830
+ id: 'gofer-implement',
831
+ description: 'Gofer implementation agent. Use for task execution, code edits, tests, and repo-script driven changes.',
832
+ tools: goferTools,
833
+ handoffs: [
834
+ {
835
+ agent: 'gofer-validate',
836
+ label: 'Validate Changes',
837
+ prompt: 'Validate this implementation with Gofer. Run the relevant tests and produce validation evidence.',
838
+ send: false,
839
+ },
840
+ ],
841
+ body: `
842
+ You are the Gofer implementation agent.
843
+
844
+ Use \`/5_gofer_implement\` as the stage contract. Work from \`tasks.md\`, keep changes minimal, run repo tests, and update traceability evidence as tasks complete.
845
+ `,
846
+ },
847
+ {
848
+ id: 'gofer-validate',
849
+ description: 'Gofer validation agent. Use for branch validation, security checks, test evidence, and release readiness.',
850
+ tools: goferTools,
851
+ handoffs: [],
852
+ body: `
853
+ You are the Gofer validation agent.
854
+
855
+ Use \`/6_gofer_validate\` as the terminal quality gate. Validate functional correctness, integration, security, standards, tests, generated artifacts, and release/public readiness where relevant.
856
+ `,
857
+ },
858
+ ];
859
+ }
860
+
861
+ /**
862
+ * Escapes a string for a basic TOML double-quoted value.
863
+ * @param {string} value
864
+ * @returns {string}
865
+ */
866
+ function escapeTomlString(value) {
867
+ return value.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
868
+ }
869
+
870
+ /**
871
+ * T041 — agents-skills emitter
872
+ * Emits Codex SKILL.md to .agents/skills/<name>/SKILL.md.
873
+ * Emits every stage whose frontmatter includes the agents-skills surface.
874
+ *
875
+ * @param {Array} stages
876
+ * @param {string} root
877
+ * @param {boolean} dryRun
878
+ */
879
+ async function emitAgentsSkills(stages, root, dryRun) {
880
+ const baseDir = path.join(root, '.agents', 'skills');
881
+ let count = 0;
882
+ for (const stage of stages) {
883
+ const { name, description, surfaces } = stage.frontmatter;
884
+ if (shouldExclude(String(name), 'agents-skills')) continue;
885
+ if (!surfaces.includes('agents-skills')) continue;
886
+
887
+ const stageStem = getStageOutputStem(stage);
888
+ const legacyStageStems = getLegacyStageStems(stage);
889
+ const skillDir = path.join(baseDir, stageStem);
890
+ const outPath = path.join(skillDir, 'SKILL.md');
891
+ const legacySkillDir = path.join(baseDir, String(name));
892
+ const content = buildSkillContent(
893
+ String(name),
894
+ String(description),
895
+ injectTokenCostPolicy(
896
+ injectWorkspacePreflight(stage.body, String(name), SURFACE_WORKSPACE_HOSTS['agents-skills'])
897
+ )
898
+ );
899
+
900
+ if (dryRun) {
901
+ console.log(`[dry-run] agents-skills: would write ${outPath}`);
902
+ } else {
903
+ await ensureDir(skillDir);
904
+ await fs.writeFile(outPath, content, 'utf8');
905
+ await removeLegacyGeneratedPaths(skillDir, [
906
+ legacySkillDir,
907
+ ...legacyStageStems.map((legacyStem) => path.join(baseDir, legacyStem)),
908
+ ...getCodexLegacySkillDirs(root, '.agents/skills', stageStem, String(name)),
909
+ ]);
910
+ console.log(`agents-skills: wrote ${outPath}`);
911
+ }
912
+ count++;
913
+ }
914
+ console.log(`agents-skills: ${count} file(s) emitted`);
915
+ return true;
916
+ }
917
+
918
+ async function emitGithubAgents(stages, root, dryRun) {
919
+ void stages;
920
+ const outDir = path.join(root, '.github', 'agents');
921
+ const agentSpecs = getGithubAgentSpecs();
922
+
923
+ if (dryRun) {
924
+ for (const agent of agentSpecs) {
925
+ console.log(`[dry-run] github-agents: would write ${path.join(outDir, `${agent.id}.agent.md`)}`);
926
+ }
927
+ } else {
928
+ await ensureDir(outDir);
929
+ for (const agent of agentSpecs) {
930
+ const outPath = path.join(outDir, `${agent.id}.agent.md`);
931
+ await fs.writeFile(outPath, buildGithubAgentContent(agent), 'utf8');
932
+ console.log(`github-agents: wrote ${outPath}`);
933
+ }
934
+ }
935
+
936
+ console.log(`github-agents: ${agentSpecs.length} file(s) emitted`);
937
+ return true;
938
+ }
939
+
940
+ async function emitGithubSkills(stages, root, dryRun) {
941
+ const version = await detectPackageVersion(root);
942
+ const outPath = path.join(root, '.github', 'skills', 'eai-gofer', 'SKILL.md');
943
+ const content = buildUmbrellaSkillContent(version, stages, 'VS Code and GitHub Copilot');
944
+
945
+ if (dryRun) {
946
+ console.log(`[dry-run] github-skills: would write ${outPath}`);
947
+ } else {
948
+ await ensureDir(path.dirname(outPath));
949
+ await fs.writeFile(outPath, content, 'utf8');
950
+ console.log(`github-skills: wrote ${outPath}`);
951
+ }
952
+
953
+ console.log('github-skills: 1 file(s) emitted');
954
+ return true;
955
+ }
956
+
957
+ async function emitClaudeSkills(stages, root, dryRun) {
958
+ const version = await detectPackageVersion(root);
959
+ const outPath = path.join(root, '.claude', 'skills', 'eai-gofer', 'SKILL.md');
960
+ const content = buildUmbrellaSkillContent(version, stages, 'Claude Code');
961
+
962
+ if (dryRun) {
963
+ console.log(`[dry-run] claude-skills: would write ${outPath}`);
964
+ } else {
965
+ await ensureDir(path.dirname(outPath));
966
+ await fs.writeFile(outPath, content, 'utf8');
967
+ console.log(`claude-skills: wrote ${outPath}`);
968
+ }
969
+
970
+ console.log('claude-skills: 1 file(s) emitted');
971
+ return true;
972
+ }
973
+
974
+ /**
975
+ * T042 — system-skills emitter
976
+ * Emits SKILL.md to .system/skills/<name>/SKILL.md.
977
+ * Emits every stage whose frontmatter includes the system-skills surface.
978
+ *
979
+ * @param {Array} stages
980
+ * @param {string} root
981
+ * @param {boolean} dryRun
982
+ */
983
+ async function emitSystemSkills(stages, root, dryRun) {
984
+ const baseDir = path.join(root, '.system', 'skills');
985
+ let count = 0;
986
+ for (const stage of stages) {
987
+ const { name, description, surfaces } = stage.frontmatter;
988
+ if (shouldExclude(String(name), 'system-skills')) continue;
989
+ if (!surfaces.includes('system-skills')) continue;
990
+
991
+ const stageStem = getStageOutputStem(stage);
992
+ const legacyStageStems = getLegacyStageStems(stage);
993
+ const skillDir = path.join(baseDir, stageStem);
994
+ const outPath = path.join(skillDir, 'SKILL.md');
995
+ const legacySkillDir = path.join(baseDir, String(name));
996
+ const content = buildSkillContent(
997
+ String(name),
998
+ String(description),
999
+ injectTokenCostPolicy(
1000
+ injectWorkspacePreflight(stage.body, String(name), SURFACE_WORKSPACE_HOSTS['system-skills'])
1001
+ )
1002
+ );
1003
+
1004
+ if (dryRun) {
1005
+ console.log(`[dry-run] system-skills: would write ${outPath}`);
1006
+ } else {
1007
+ await ensureDir(skillDir);
1008
+ await fs.writeFile(outPath, content, 'utf8');
1009
+ await removeLegacyGeneratedPaths(skillDir, [
1010
+ legacySkillDir,
1011
+ ...legacyStageStems.map((legacyStem) => path.join(baseDir, legacyStem)),
1012
+ ...getCodexLegacySkillDirs(root, '.system/skills', stageStem, String(name)),
1013
+ ]);
1014
+ console.log(`system-skills: wrote ${outPath}`);
1015
+ }
1016
+ count++;
1017
+ }
1018
+ console.log(`system-skills: ${count} file(s) emitted`);
1019
+ return true;
1020
+ }
1021
+
1022
+ /**
1023
+ * T065 — gemini emitter
1024
+ * Emits plain markdown body and TOML command wrappers to
1025
+ * .gemini/commands/gofer/<name>.md and <name>.toml.
1026
+ * T066 — also creates .gemini/commands/gofer/manifest.json listing all emitted stage names.
1027
+ *
1028
+ * @param {Array} stages
1029
+ * @param {string} root
1030
+ * @param {boolean} dryRun
1031
+ */
1032
+ async function emitGemini(stages, root, dryRun) {
1033
+ const outDir = path.join(root, '.gemini', 'commands', 'gofer');
1034
+ const extensionPath = path.join(root, '.gemini', 'extension.json');
1035
+ const version = await detectPackageVersion(root);
1036
+ const emittedNames = [];
1037
+ let count = 0;
1038
+
1039
+ for (const stage of stages) {
1040
+ const { name, description, surfaces } = stage.frontmatter;
1041
+ if (shouldExclude(String(name), 'gemini')) continue;
1042
+ if (!surfaces.includes('gemini')) continue;
1043
+
1044
+ const stageStem = getStageOutputStem(stage);
1045
+ const markdownPath = path.join(outDir, `${stageStem}.md`);
1046
+ const tomlPath = path.join(outDir, `${stageStem}.toml`);
1047
+ const legacyStageStems = getLegacyStageStems(stage);
1048
+ const legacyMarkdownPaths = [
1049
+ path.join(outDir, `${name}.md`),
1050
+ ...legacyStageStems.map((legacyStem) => path.join(outDir, `${legacyStem}.md`)),
1051
+ ];
1052
+ const legacyTomlPaths = [
1053
+ path.join(outDir, `${name}.toml`),
1054
+ ...legacyStageStems.map((legacyStem) => path.join(outDir, `${legacyStem}.toml`)),
1055
+ ];
1056
+ const sourceFileName = path.basename(stage.filePath);
1057
+ const tomlContent = [
1058
+ `description = "${escapeTomlString(String(description || name))}"`,
1059
+ `prompt = "{{include: ../../../.specify/commands/${sourceFileName}}}"`,
1060
+ '',
1061
+ ].join('\n');
1062
+
1063
+ if (dryRun) {
1064
+ console.log(`[dry-run] gemini: would write ${markdownPath}`);
1065
+ console.log(`[dry-run] gemini: would write ${tomlPath}`);
1066
+ } else {
1067
+ await ensureDir(outDir);
1068
+ await fs.writeFile(
1069
+ markdownPath,
1070
+ injectTokenCostPolicy(
1071
+ injectWorkspacePreflight(stage.body, String(name), SURFACE_WORKSPACE_HOSTS['gemini'])
1072
+ ),
1073
+ 'utf8'
1074
+ );
1075
+ await fs.writeFile(tomlPath, tomlContent, 'utf8');
1076
+ await removeLegacyGeneratedPaths(markdownPath, legacyMarkdownPaths);
1077
+ await removeLegacyGeneratedPaths(tomlPath, legacyTomlPaths);
1078
+ console.log(`gemini: wrote ${markdownPath}`);
1079
+ console.log(`gemini: wrote ${tomlPath}`);
1080
+ }
1081
+ emittedNames.push(String(name));
1082
+ count++;
1083
+ }
1084
+
1085
+ // T066 — write manifest.json
1086
+ const manifestPath = path.join(outDir, 'manifest.json');
1087
+ const sortedNames = [...emittedNames].sort();
1088
+ const manifest = {
1089
+ version: '1.0',
1090
+ generated: new Date().toISOString(),
1091
+ commands: sortedNames,
1092
+ };
1093
+
1094
+ if (dryRun) {
1095
+ console.log(`[dry-run] gemini: would write manifest ${manifestPath}`);
1096
+ console.log(`[dry-run] gemini: would write extension manifest ${extensionPath}`);
1097
+ } else {
1098
+ await ensureDir(outDir);
1099
+ await fs.writeFile(manifestPath, JSON.stringify(manifest, null, 2) + '\n', 'utf8');
1100
+ await fs.writeFile(
1101
+ extensionPath,
1102
+ JSON.stringify(buildGeminiExtensionManifest(version), null, 2) + '\n',
1103
+ 'utf8'
1104
+ );
1105
+ console.log(`gemini: wrote manifest ${manifestPath}`);
1106
+ console.log(`gemini: wrote extension manifest ${extensionPath}`);
1107
+ }
1108
+
1109
+ console.log(`gemini: ${count} file(s) emitted`);
1110
+ return true;
1111
+ }
1112
+
1113
+ /**
1114
+ * T067 — agents-md emitter
1115
+ * Creates .agents/AGENTS.md — a consolidated AGENTS.md for Gemini/Codex.
1116
+ * Includes all stages emitted to portable agent surfaces.
1117
+ *
1118
+ * @param {Array} stages
1119
+ * @param {string} root
1120
+ * @param {boolean} dryRun
1121
+ */
1122
+ async function emitAgentsMd(stages, root, dryRun) {
1123
+ const outPath = path.join(root, '.agents', 'AGENTS.md');
1124
+ const timestamp = new Date().toISOString();
1125
+ const sections = [];
1126
+
1127
+ for (const stage of stages) {
1128
+ const { name, title, surfaces } = stage.frontmatter;
1129
+ if (shouldExclude(String(name), 'agents-md')) continue;
1130
+ if (!surfaces.includes('gemini') && !surfaces.includes('codex') && !surfaces.includes('agents-skills')) continue;
1131
+
1132
+ const summary = stage.body.slice(0, 200).replace(/\n+$/, '');
1133
+ const sectionTitle = title ? String(title) : String(name);
1134
+ sections.push(`### ${sectionTitle}\n${summary}...`);
1135
+ }
1136
+
1137
+ const content = `# Gofer Agent Commands
1138
+
1139
+ This file documents all Gofer pipeline commands available as agent skills.
1140
+
1141
+ Generated: ${timestamp}
1142
+
1143
+ ## EAI CLI Discovery And Recovery
1144
+
1145
+ - Run \`eai update --check\` before first EAI platform work when the CLI may be stale.
1146
+ - Run \`eai --describe\` before assuming command syntax.
1147
+ - If advertised, run \`eai agent guide --format json\` before planning or fixing EAI workflows.
1148
+ - After any \`eai\` error, run \`eai errors explain <code-or-reason> --format json\` before guessing remediation.
1149
+ - If \`eai errors explain\` is unavailable, match \`.specify/references/platform/eai-error-catalog.yaml\`, run read-only diagnostics before mutating fixes, and stop at the retry or escalation condition.
1150
+ - For \`eai user invite\` 5xx or \`EXTERNAL_SERVICE_ERROR\`, check existing members with \`eai user list --tenant <tenant-id> --search <email> --format json\`; use \`eai user role set --tenant <tenant-id> --member-id <member-id> --role tenant-admin --format json\` only after verification and user approval, then tell the app user to sign out and sign back in.
1151
+ - Use \`eai publicapi\` only for authorized PublicAPI \`/v4/...\` routes.
1152
+
1153
+ ## Commands
1154
+
1155
+ ${sections.join('\n\n')}
1156
+ `;
1157
+
1158
+ if (dryRun) {
1159
+ console.log(`[dry-run] agents-md: would write ${outPath}`);
1160
+ } else {
1161
+ await ensureDir(path.dirname(outPath));
1162
+ await fs.writeFile(outPath, content, 'utf8');
1163
+ console.log(`agents-md: wrote ${outPath}`);
1164
+ }
1165
+
1166
+ console.log(`agents-md: ${sections.length} section(s) emitted`);
1167
+ return true;
1168
+ }
1169
+
1170
+ /**
1171
+ * T068 — codex-config emitter
1172
+ * Generates .specify/outputs/codex-config-fragment.toml containing skill entries
1173
+ * for every stage emitted to Codex/agents-skills.
1174
+ * Does NOT touch ~/.codex/config.toml.
1175
+ *
1176
+ * @param {Array} stages
1177
+ * @param {string} root
1178
+ * @param {boolean} dryRun
1179
+ */
1180
+ async function emitCodexConfig(stages, root, dryRun) {
1181
+ const outDir = path.join(root, '.specify', 'outputs');
1182
+ const outPath = path.join(outDir, 'codex-config-fragment.toml');
1183
+ const timestamp = new Date().toISOString();
1184
+ const lines = [
1185
+ `# Gofer skill overrides for ~/.codex/config.toml`,
1186
+ `# Generated by generate-commands.mjs on ${timestamp}`,
1187
+ `# Codex discovers repository-local Gofer skills from .agents/skills automatically.`,
1188
+ `# Only use these [[skills.config]] blocks when you need explicit per-skill overrides.`,
1189
+ `# Replace /full/path/to/repo with the absolute path to your local checkout.`,
1190
+ ``,
1191
+ ];
1192
+
1193
+ let count = 0;
1194
+ for (const stage of stages) {
1195
+ const { name, surfaces } = stage.frontmatter;
1196
+ if (shouldExclude(String(name), 'codex-config')) continue;
1197
+ if (!surfaces.includes('codex') && !surfaces.includes('agents-skills')) continue;
1198
+
1199
+ const stageStem = getStageOutputStem(stage);
1200
+ lines.push(`[[skills.config]]`);
1201
+ lines.push(`path = "/full/path/to/repo/.agents/skills/${escapeTomlString(stageStem)}"`);
1202
+ lines.push(`enabled = true`);
1203
+ lines.push(``);
1204
+ count++;
1205
+ }
1206
+
1207
+ const content = lines.join('\n');
1208
+
1209
+ if (dryRun) {
1210
+ console.log(`[dry-run] codex-config: would write ${outPath}`);
1211
+ } else {
1212
+ await ensureDir(outDir);
1213
+ await fs.writeFile(outPath, content, 'utf8');
1214
+ console.log(`codex-config: wrote ${outPath}`);
1215
+ }
1216
+
1217
+ console.log(`codex-config: ${count} skill entrie(s) emitted`);
1218
+ return true;
1219
+ }
1220
+
1221
+ const EMITTERS = {
1222
+ 'claude': emitClaude,
1223
+ 'claude-mirror': emitClaudeMirror,
1224
+ 'claude-skills': emitClaudeSkills,
1225
+ 'copilot': emitCopilot,
1226
+ 'github-prompts': emitGithubPrompts,
1227
+ 'github-agents': emitGithubAgents,
1228
+ 'github-skills': emitGithubSkills,
1229
+ 'agents-skills': emitAgentsSkills,
1230
+ 'system-skills': emitSystemSkills,
1231
+ 'gemini': emitGemini,
1232
+ 'agents-md': emitAgentsMd,
1233
+ 'codex-config': emitCodexConfig,
1234
+ };
1235
+
1236
+ // ---------------------------------------------------------------------------
1237
+ // CLI argument parsing
1238
+ // ---------------------------------------------------------------------------
1239
+
1240
+ function parseArgs(argv) {
1241
+ const args = {
1242
+ dryRun: false,
1243
+ surfaces: ALL_SURFACES,
1244
+ root: process.cwd(),
1245
+ };
1246
+
1247
+ for (let i = 0; i < argv.length; i++) {
1248
+ const arg = argv[i];
1249
+ if (arg === '--dry-run') {
1250
+ args.dryRun = true;
1251
+ } else if (arg === '--surfaces' && argv[i + 1]) {
1252
+ args.surfaces = argv[i + 1].split(',').map((s) => s.trim()).filter(Boolean);
1253
+ i++;
1254
+ } else if (arg === '--root' && argv[i + 1]) {
1255
+ args.root = argv[i + 1];
1256
+ i++;
1257
+ }
1258
+ }
1259
+
1260
+ return args;
1261
+ }
1262
+
1263
+ // ---------------------------------------------------------------------------
1264
+ // T043 — per-CLI exclusion enforcement (validation)
1265
+ // ---------------------------------------------------------------------------
1266
+
1267
+ /**
1268
+ * Validates that no stage is being emitted to a surface it should be excluded from.
1269
+ * Logs a warning for any violations found.
1270
+ *
1271
+ * @param {Array} stages
1272
+ * @param {string[]} surfaces
1273
+ */
1274
+ function validateExclusions(stages, surfaces) {
1275
+ let violations = 0;
1276
+ for (const stage of stages) {
1277
+ const stageName = String(stage.frontmatter.name);
1278
+ for (const surface of surfaces) {
1279
+ if (shouldExclude(stageName, surface) && stage.frontmatter.surfaces.includes(surface)) {
1280
+ console.warn(
1281
+ `[warn] Exclusion violation: stage '${stageName}' is listed under surface '${surface}' in its frontmatter, but shouldExclude() returns true for this combination. The emitter will skip this stage.`
1282
+ );
1283
+ violations++;
1284
+ }
1285
+ }
1286
+ }
1287
+ if (violations === 0) {
1288
+ console.log(`Exclusion validation OK: no violations found`);
1289
+ } else {
1290
+ console.warn(`Exclusion validation: ${violations} violation(s) found (stages will still be skipped)`);
1291
+ }
1292
+ }
1293
+
1294
+ // ---------------------------------------------------------------------------
1295
+ // Main
1296
+ // ---------------------------------------------------------------------------
1297
+
1298
+ async function main() {
1299
+ const argv = process.argv.slice(2);
1300
+ const { dryRun, surfaces, root } = parseArgs(argv);
1301
+
1302
+ // Validate canonical descriptions first (budget check)
1303
+ try {
1304
+ const { count, totalBytes } = validateDescriptions();
1305
+ console.log(`Canonical descriptions OK: ${count} stages, ${totalBytes} bytes`);
1306
+ } catch (err) {
1307
+ console.error(`Canonical description validation failed: ${err.message}`);
1308
+ process.exit(1);
1309
+ }
1310
+
1311
+ // Load all stage command files from .specify/commands/
1312
+ let stages;
1313
+ try {
1314
+ stages = await loadStages(root);
1315
+ } catch (err) {
1316
+ console.error(`Stage loading failed: ${err instanceof Error ? err.message : String(err)}`);
1317
+ process.exit(1);
1318
+ }
1319
+
1320
+ if (stages.length === 0) {
1321
+ console.warn('[warn] No stage command files found in .specify/commands/ — nothing to emit');
1322
+ } else {
1323
+ console.log(`Loaded ${stages.length} stage(s): ${stages.map((s) => s.frontmatter.name).join(', ')}`);
1324
+ }
1325
+
1326
+ // T043: validate exclusions
1327
+ validateExclusions(stages, surfaces);
1328
+
1329
+ if (dryRun) {
1330
+ console.log('[dry-run] Would emit to surfaces:', surfaces.join(', '));
1331
+ console.log('[dry-run] Stages:', stages.map((s) => s.frontmatter.name).join(', '));
1332
+ process.exit(0);
1333
+ }
1334
+
1335
+ let allOk = true;
1336
+ for (const surface of surfaces) {
1337
+ const emitter = EMITTERS[surface];
1338
+ if (!emitter) {
1339
+ console.warn(`Unknown surface '${surface}' — skipping`);
1340
+ continue;
1341
+ }
1342
+
1343
+ try {
1344
+ const ok = await emitter(stages, root, dryRun);
1345
+ if (!ok) {
1346
+ console.error(`Emitter for '${surface}' returned false`);
1347
+ allOk = false;
1348
+ }
1349
+ } catch (err) {
1350
+ console.error(`Emitter for '${surface}' threw: ${err.message}`);
1351
+ allOk = false;
1352
+ }
1353
+ }
1354
+
1355
+ process.exit(allOk ? 0 : 1);
1356
+ }
1357
+
1358
+ // Only run main when executed directly (not when imported as a module in tests)
1359
+ const isMain = process.argv[1] && (
1360
+ process.argv[1].endsWith('generate-commands.mjs') ||
1361
+ process.argv[1] === new URL(import.meta.url).pathname
1362
+ );
1363
+
1364
+ if (isMain) {
1365
+ main();
1366
+ }