@geminix/gxpm 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/AGENTS.md +148 -0
  2. package/CANON.md +53 -0
  3. package/CLAUDE.md +60 -0
  4. package/CONTEXT.md +49 -0
  5. package/DEBUG.md +59 -0
  6. package/ISSUE_CONTEXT.md +25 -0
  7. package/README.md +143 -0
  8. package/VERSION +1 -0
  9. package/agents/cleanup-auditor/cleanup-auditor.md +56 -0
  10. package/agents/grill-master.md +26 -0
  11. package/agents/implementer.md +32 -0
  12. package/agents/review-army/accessibility-reviewer.md +54 -0
  13. package/agents/review-army/code-quality-reviewer.md +54 -0
  14. package/agents/review-army/security-reviewer.md +56 -0
  15. package/agents/review-army/spec-compliance-reviewer.md +51 -0
  16. package/agents/review-army/test-reviewer.md +55 -0
  17. package/agents/reviewer.md +59 -0
  18. package/agents/ship-audit-army/docs-auditor.md +53 -0
  19. package/agents/ship-audit-army/performance-auditor.md +52 -0
  20. package/agents/ship-audit-army/security-auditor.md +52 -0
  21. package/agents/specifier.md +55 -0
  22. package/agents/triage-officer.md +27 -0
  23. package/bin/gxpm +17 -0
  24. package/bin/gxpm-browser +17 -0
  25. package/bin/gxpm-config +15 -0
  26. package/bin/gxpm-eval +13 -0
  27. package/bin/gxpm-global-discover +15 -0
  28. package/bin/gxpm-init +38 -0
  29. package/bin/gxpm-investigate +194 -0
  30. package/bin/gxpm-uninstall +15 -0
  31. package/bin/gxpm-update-check +165 -0
  32. package/commands/build.md +40 -0
  33. package/commands/help.md +53 -0
  34. package/commands/plan.md +34 -0
  35. package/commands/refine.md +46 -0
  36. package/commands/review.md +34 -0
  37. package/commands/ship.md +37 -0
  38. package/core/ac-check.ts +20 -0
  39. package/core/agent-runtime.ts +363 -0
  40. package/core/artifact-validator.ts +151 -0
  41. package/core/artifacts.ts +313 -0
  42. package/core/autopilot.ts +250 -0
  43. package/core/capabilities.ts +779 -0
  44. package/core/checkpoint.ts +370 -0
  45. package/core/cleanup.ts +32 -0
  46. package/core/command-probe.ts +82 -0
  47. package/core/config.ts +533 -0
  48. package/core/contracts/behavior-spec.schema.ts +38 -0
  49. package/core/contracts/converter.ts +61 -0
  50. package/core/contracts/host.ts +43 -0
  51. package/core/converters/converter.ts +93 -0
  52. package/core/converters/index.ts +8 -0
  53. package/core/converters/managed-artifact.ts +119 -0
  54. package/core/converters/parser.ts +159 -0
  55. package/core/converters/template-renderer.ts +35 -0
  56. package/core/converters/writer.ts +61 -0
  57. package/core/dag-executor.ts +426 -0
  58. package/core/dag-loader.ts +292 -0
  59. package/core/dag-schemas.ts +150 -0
  60. package/core/dispatch.ts +125 -0
  61. package/core/evidence.ts +148 -0
  62. package/core/gate.ts +269 -0
  63. package/core/hook-engine.ts +566 -0
  64. package/core/host-probe.ts +64 -0
  65. package/core/implement.ts +16 -0
  66. package/core/isolation-errors.ts +174 -0
  67. package/core/isolation-resolver.ts +921 -0
  68. package/core/issue-context.ts +381 -0
  69. package/core/issue-readiness.ts +457 -0
  70. package/core/issue-sync.ts +427 -0
  71. package/core/issues.ts +132 -0
  72. package/core/land.ts +108 -0
  73. package/core/orchestrator.ts +54 -0
  74. package/core/phase-artifact.ts +32 -0
  75. package/core/phase-gates.ts +130 -0
  76. package/core/phase-rewind.ts +94 -0
  77. package/core/plan-lint.ts +61 -0
  78. package/core/plan.ts +77 -0
  79. package/core/port-allocation.ts +50 -0
  80. package/core/pr-check.ts +15 -0
  81. package/core/preset-system/preset-resolver.ts +221 -0
  82. package/core/project-init-status.ts +127 -0
  83. package/core/qa.ts +15 -0
  84. package/core/resilience.ts +165 -0
  85. package/core/runs.ts +288 -0
  86. package/core/safe-path.test.ts +80 -0
  87. package/core/safe-path.ts +60 -0
  88. package/core/sdd-gate.test.ts +98 -0
  89. package/core/sdd-gate.ts +134 -0
  90. package/core/self-review.ts +62 -0
  91. package/core/session.ts +70 -0
  92. package/core/ship.ts +86 -0
  93. package/core/specify.ts +173 -0
  94. package/core/state.ts +1002 -0
  95. package/core/template-engine.ts +152 -0
  96. package/core/template-resolver.test.ts +70 -0
  97. package/core/template-resolver.ts +156 -0
  98. package/core/triage.ts +26 -0
  99. package/core/verify.ts +15 -0
  100. package/core/wiki-native.ts +2423 -0
  101. package/core/wiki.ts +27 -0
  102. package/core/workflow-event-emitter.ts +163 -0
  103. package/core/workflows/engine.ts +273 -0
  104. package/core/workflows/expressions.ts +76 -0
  105. package/core/workflows/index.ts +38 -0
  106. package/core/workflows/steps/command.ts +43 -0
  107. package/core/workflows/steps/gate.ts +47 -0
  108. package/core/workflows/steps/gxpm.ts +44 -0
  109. package/core/workflows/steps/linear.ts +31 -0
  110. package/core/workflows/steps/shell.ts +65 -0
  111. package/core/workflows/types.ts +62 -0
  112. package/core/workspace-runtime.ts +227 -0
  113. package/core/worktree-init-steps.ts +647 -0
  114. package/core/worktree-init.ts +330 -0
  115. package/core/worktree-owner.ts +143 -0
  116. package/docs/GXPM_VERIFY.md +98 -0
  117. package/docs/INSTALL_FOR_AGENTS.md +113 -0
  118. package/docs/README.md +57 -0
  119. package/docs/adr/adr-005-multi-platform-skill-converter.md +72 -0
  120. package/docs/agents/domain.md +30 -0
  121. package/docs/agents/issue-tracker.md +30 -0
  122. package/docs/agents/triage-labels.md +32 -0
  123. package/docs/architecture/gxpm-architecture-diagram.md +265 -0
  124. package/docs/architecture/gxpm-current-architecture.md +175 -0
  125. package/docs/architecture/gxpm-current-flow.md +278 -0
  126. package/docs/architecture/gxpm-replacement-architecture.md +211 -0
  127. package/docs/architecture/gxpm-target-architecture.md +449 -0
  128. package/docs/architecture/gxpm-v0-contract.md +311 -0
  129. package/docs/architecture/layered-workflow-boundaries.md +193 -0
  130. package/docs/architecture/preset-system.md +126 -0
  131. package/docs/architecture/scaffold-northstar.md +23 -0
  132. package/docs/brainstorms/2026-05-14-bdd-then-tdd-design.md +320 -0
  133. package/docs/brainstorms/README.md +22 -0
  134. package/docs/brainstorms/docs-knowledge-system-requirements.md +29 -0
  135. package/docs/governance/beta-skill-promotion.md +39 -0
  136. package/docs/governance/development-contract.md +144 -0
  137. package/docs/governance/gherkin-style.md +90 -0
  138. package/docs/governance/host-adapter.md +56 -0
  139. package/docs/governance/skill-authoring.md +87 -0
  140. package/docs/governance/skill-testing.md +356 -0
  141. package/docs/governance/template-authoring.md +53 -0
  142. package/docs/migrations/v0.2.md +51 -0
  143. package/docs/plans/README.md +23 -0
  144. package/docs/plans/bdd-then-tdd-plan.md +1767 -0
  145. package/docs/plans/docs-knowledge-system-plan.md +31 -0
  146. package/docs/plans/spec-kit-sdd-adoption-plan.md +305 -0
  147. package/docs/research/agents-md-best-practices.md +207 -0
  148. package/docs/research/archon-study.md +351 -0
  149. package/docs/research/claude-hooks-study.md +440 -0
  150. package/docs/research/codex-hooks-study.md +624 -0
  151. package/docs/research/everything-claude-code-study.md +252 -0
  152. package/docs/research/from-skills-to-layered-workflow.md +322 -0
  153. package/docs/research/gsd-study.md +69 -0
  154. package/docs/research/kimi-hooks-study.md +274 -0
  155. package/docs/research/mattpocock-skills-comparison.md +429 -0
  156. package/docs/research/mattpocock-skills-study.md +275 -0
  157. package/docs/research/oh-my-codex-study.md +279 -0
  158. package/docs/research/perplexity-agent-skills-design.md +168 -0
  159. package/docs/research/pmc-gstack-skill-study.md +122 -0
  160. package/docs/research/spec-kit-study.md +224 -0
  161. package/docs/research/superpowers-study.md +209 -0
  162. package/docs/roadmap/initial-roadmap.md +53 -0
  163. package/docs/solutions/README.md +45 -0
  164. package/docs/solutions/artifact-nesting-recovery.md +58 -0
  165. package/docs/solutions/session-context-restore-practice.md +67 -0
  166. package/docs/solutions/workflow/version-drift-recovery.md +49 -0
  167. package/docs/solutions/worktree-gate-recovery.md +62 -0
  168. package/docs/specs/README.md +28 -0
  169. package/docs/specs/claude.md +45 -0
  170. package/docs/specs/codex.md +44 -0
  171. package/docs/specs/cursor.md +44 -0
  172. package/hosts/adapters/claude.ts +29 -0
  173. package/hosts/adapters/codex.ts +27 -0
  174. package/hosts/adapters/cursor.ts +27 -0
  175. package/hosts/adapters/kimi.ts +27 -0
  176. package/hosts/claude.ts +23 -0
  177. package/hosts/codex.ts +26 -0
  178. package/hosts/cursor.ts +19 -0
  179. package/hosts/index.ts +33 -0
  180. package/hosts/registry.test.ts +52 -0
  181. package/hosts/registry.ts +57 -0
  182. package/hosts/schema.ts +58 -0
  183. package/package.json +52 -0
  184. package/scripts/browser.ts +185 -0
  185. package/scripts/cleanup.ts +142 -0
  186. package/scripts/commands/artifact.ts +115 -0
  187. package/scripts/commands/autopilot.ts +143 -0
  188. package/scripts/commands/capability.ts +57 -0
  189. package/scripts/commands/config.ts +69 -0
  190. package/scripts/commands/dag.ts +126 -0
  191. package/scripts/commands/feedback.ts +123 -0
  192. package/scripts/commands/gate.ts +291 -0
  193. package/scripts/commands/helpers.ts +126 -0
  194. package/scripts/commands/hook.ts +66 -0
  195. package/scripts/commands/init.ts +515 -0
  196. package/scripts/commands/issue.ts +825 -0
  197. package/scripts/commands/phase.ts +61 -0
  198. package/scripts/commands/preset.ts +159 -0
  199. package/scripts/commands/runtime.ts +199 -0
  200. package/scripts/commands/specify.ts +71 -0
  201. package/scripts/commands/upgrade.ts +243 -0
  202. package/scripts/commands/verify.ts +183 -0
  203. package/scripts/commands/wiki.ts +242 -0
  204. package/scripts/commands/workflow.ts +131 -0
  205. package/scripts/dev-skill.ts +55 -0
  206. package/scripts/discover-skills.ts +116 -0
  207. package/scripts/doctor.ts +410 -0
  208. package/scripts/dogfood-check.ts +125 -0
  209. package/scripts/eval-functional.ts +218 -0
  210. package/scripts/eval.ts +246 -0
  211. package/scripts/gen-skill-docs.ts +201 -0
  212. package/scripts/global-discover.ts +217 -0
  213. package/scripts/governance-check.ts +75 -0
  214. package/scripts/gxpm-check.ts +12 -0
  215. package/scripts/gxpm.ts +216 -0
  216. package/scripts/host-config.ts +62 -0
  217. package/scripts/install-claude-hooks.ts +138 -0
  218. package/scripts/install-codex-hooks.ts +271 -0
  219. package/scripts/install-hooks.ts +128 -0
  220. package/scripts/install-kimi-hooks.ts +92 -0
  221. package/scripts/install-skill.ts +184 -0
  222. package/scripts/phase-artifact-commands.ts +100 -0
  223. package/scripts/post-land-sync.ts +46 -0
  224. package/scripts/scaffold-check.ts +85 -0
  225. package/scripts/skill-naming-check.ts +78 -0
  226. package/scripts/skill-structure-check.ts +157 -0
  227. package/scripts/skills-lock-check.ts +60 -0
  228. package/scripts/sync-markdown-artifacts.ts +172 -0
  229. package/scripts/uninstall.ts +162 -0
  230. package/scripts/version.ts +47 -0
  231. package/scripts/wait-pr-ready.ts +407 -0
  232. package/skills/gxpm/SKILL.md +485 -0
  233. package/skills/gxpm/SKILL.md.tmpl +422 -0
  234. package/skills/gxpm/references/CANON.md +53 -0
  235. package/skills/gxpm/references/key-rules.md +130 -0
  236. package/skills/gxpm-architecture/SKILL.md +106 -0
  237. package/skills/gxpm-architecture/references/DEEPENING.md +37 -0
  238. package/skills/gxpm-architecture/references/INTERFACE-DESIGN.md +44 -0
  239. package/skills/gxpm-autopilot/SKILL.md +116 -0
  240. package/skills/gxpm-autopilot/SKILL.md.tmpl +107 -0
  241. package/skills/gxpm-browser/SKILL.md +105 -0
  242. package/skills/gxpm-browser/SKILL.md.tmpl +41 -0
  243. package/skills/gxpm-browser/references/commands.md +43 -0
  244. package/skills/gxpm-browser/references/evidence-path.md +20 -0
  245. package/skills/gxpm-build/SKILL.md +78 -0
  246. package/skills/gxpm-cleanup/SKILL.md +76 -0
  247. package/skills/gxpm-debug-issue/SKILL.md +39 -0
  248. package/skills/gxpm-diagnose/SKILL.md +220 -0
  249. package/skills/gxpm-diagnose/SKILL.md.tmpl +31 -0
  250. package/skills/gxpm-diagnose/references/feedback-loop.md +34 -0
  251. package/skills/gxpm-diagnose/references/feedback-loops.md +43 -0
  252. package/skills/gxpm-diagnose/references/phases.md +60 -0
  253. package/skills/gxpm-eval/SKILL.md +78 -0
  254. package/skills/gxpm-explore-codebase/SKILL.md +36 -0
  255. package/skills/gxpm-explore-codebase/scripts/summarize-communities.ts +51 -0
  256. package/skills/gxpm-feedback/SKILL.md +122 -0
  257. package/skills/gxpm-grill/SKILL.md +159 -0
  258. package/skills/gxpm-grill/SKILL.md.tmpl +77 -0
  259. package/skills/gxpm-grill/references/documentation-templates.md +56 -0
  260. package/skills/gxpm-grill/references/process.md +25 -0
  261. package/skills/gxpm-handoff/SKILL.md +112 -0
  262. package/skills/gxpm-hygiene/SKILL.md +69 -0
  263. package/skills/gxpm-implementer/SKILL.md +142 -0
  264. package/skills/gxpm-implementer/SKILL.md.tmpl +141 -0
  265. package/skills/gxpm-linear/SKILL.md +282 -0
  266. package/skills/gxpm-linear/SKILL.md.tmpl +86 -0
  267. package/skills/gxpm-linear/references/commands.md +75 -0
  268. package/skills/gxpm-linear/references/workflows.md +120 -0
  269. package/skills/gxpm-planning/SKILL.md +134 -0
  270. package/skills/gxpm-prototype/SKILL.md +64 -0
  271. package/skills/gxpm-refactor-safely/SKILL.md +62 -0
  272. package/skills/gxpm-review-army/SKILL.md +117 -0
  273. package/skills/gxpm-review-changes/SKILL.md +36 -0
  274. package/skills/gxpm-setup/SKILL.md +101 -0
  275. package/skills/gxpm-specifier/SKILL.md +135 -0
  276. package/skills/gxpm-tdd/SKILL.md +187 -0
  277. package/skills/gxpm-tdd/references/interface-design.md +23 -0
  278. package/skills/gxpm-tdd/references/mocking.md +27 -0
  279. package/skills/gxpm-tdd/references/red-green-refactor.md +61 -0
  280. package/skills/gxpm-tdd/references/troubleshooting.md +28 -0
  281. package/skills/gxpm-tdd/references/workflow.md +50 -0
  282. package/skills/gxpm-tdd/testing-anti-patterns.tmpl +304 -0
  283. package/skills/gxpm-triage/SKILL.md +160 -0
  284. package/skills/gxpm-verify/SKILL.md +107 -0
  285. package/skills/gxpm-write-skill/SKILL.md +131 -0
  286. package/skills/gxpm-zoom-out/SKILL.md +69 -0
  287. package/skills/maintain-hygiene-skills-lock/SKILL.md +54 -0
  288. package/skills/maintain-hygiene-skills-lock/SKILL.md.tmpl +53 -0
  289. package/templates/constitution-template.md +63 -0
  290. package/templates/hooks/gxpm-commit-msg +16 -0
  291. package/templates/hooks/gxpm-post-checkout +19 -0
  292. package/templates/hooks/gxpm-post-commit +7 -0
  293. package/templates/hooks/gxpm-post-merge +29 -0
  294. package/templates/hooks/gxpm-pre-commit +39 -0
  295. package/templates/hooks/gxpm-pre-push +33 -0
  296. package/templates/plan-template.md.tmpl +46 -0
  297. package/templates/spec-template.md.tmpl +63 -0
  298. package/templates/specify-stub.tmpl +22 -0
  299. package/templates/tasks-template.md.tmpl +32 -0
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: gxpm-zoom-out
3
+ description: Tell the agent to zoom out and give broader context or a higher-level perspective. Use when you're unfamiliar with a section of code, stuck in implementation details, or need to understand how code fits into the bigger picture.
4
+ ---
5
+
6
+ # Zoom Out
7
+
8
+ Go up a layer of abstraction. Stop drowning in details and see the map.
9
+
10
+ ## 入口条件
11
+
12
+ **何时触发**
13
+ - 你在 implement 阶段陷入了实现细节,不确定当前修改是否符合架构设计。
14
+ - 你面对一段不熟悉的代码,需要理解它如何融入更大的系统。
15
+ - 用户说 "zoom out"、"bigger picture"、"how does this fit?"、"step back"。
16
+ - 你连续阅读了多个文件但仍无法理解系统的组织方式。
17
+ - 你在调试时迷失在调用链中,需要模块级别的地图。
18
+
19
+ **Skill 边界(什么情况下应该加载别的 skill)**
20
+ - 需要具体代码调试定位根因 → `/gxpm-debug-issue`
21
+ - 需要深度理解特定模块内部 → `/gxpm-explore-codebase`
22
+ - 需要架构改进建议 → `/gxpm-architecture`
23
+ - 需要术语对齐或计划验证 → `/gxpm-grill`
24
+
25
+ ## 可操作流程
26
+
27
+ ### 1. Ask for the map
28
+
29
+ Request a high-level overview using the project's domain glossary vocabulary:
30
+
31
+ > "Give me a map of all the relevant modules and callers. Use the domain glossary from CONTEXT.md."
32
+
33
+ ### 2. What to surface
34
+
35
+ Provide a concise architectural briefing covering:
36
+
37
+ - **Modules involved** — name and one-line responsibility for each relevant module
38
+ - **Call graph** — who calls whom, data flow direction
39
+ - **Domain concepts** — which CONTEXT.md terms are active in this area
40
+ - **ADR relevance** — any architectural decisions that govern this code path
41
+ - **Integration seams** — where this code meets external systems or other bounded contexts
42
+
43
+ ### 3. What NOT to do
44
+
45
+ - Do not dump file listings or raw directory trees.
46
+ - Do not read every file in the module — summarize from what you already know.
47
+ - Do not descend into function-level detail unless specifically asked.
48
+ - Do not suggest code changes — this is a viewing skill, not an editing skill.
49
+
50
+ ## 红旗清单 / 反模式
51
+
52
+ - **STOP:不要变成文件浏览器。** Zoom-out 的目标是理解关系,不是枚举文件。
53
+ - **STOP:不要建议重构。** 如果发现了架构问题,交给 `/gxpm-architecture`。
54
+ - **STOP:不要在 zoom-out 后继续深挖。** 如果用户说 "zoom out",不要立刻开始读下一个文件的每一行。
55
+ - **危险信号:** 输出变成了目录列表 → 重新组织为模块关系图。
56
+ - **危险信号:** 使用了与 CONTEXT.md 不一致的术语 → 纠正并引用 glossary。
57
+
58
+ ## 验证清单 / 出口条件
59
+
60
+ - [ ] 提供了模块地图(不是文件列表)。
61
+ - [ ] 使用了 CONTEXT.md 中的领域术语。
62
+ - [ ] 说明了相关 ADR(如果有)。
63
+ - [ ] 没有建议具体代码修改。
64
+ - [ ] 用户能够基于这个地图做出下一步决策(继续实现、深入调试、或架构调整)。
65
+
66
+ **失败时路由**
67
+ - 需要具体代码调试 → `/gxpm-debug-issue`
68
+ - 需要架构改进建议 → `/gxpm-architecture`
69
+ - 需要术语对齐 → `/gxpm-grill`
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: maintain-hygiene-skills-lock
3
+ description: 维护 skills-lock.json 完整性锁。在新增、修改或删除 skill 时更新锁文件。
4
+ ---
5
+ <!-- AUTO-GENERATED from SKILL.md.tmpl - do not edit directly -->
6
+
7
+ # maintain-hygiene-skills-lock
8
+
9
+ ## 入口条件
10
+
11
+ - `skills/` 目录发生变更(新增、修改、删除 skill)
12
+ - `skills-lock.json` 与当前 skill 内容不一致
13
+ - `bun run check` 报 `skills-lock: hash mismatch` 或 `not listed`
14
+
15
+ ## 可操作流程
16
+
17
+ ### 1. 重新计算哈希
18
+
19
+ 运行以下脚本重新生成 `skills-lock.json`:
20
+
21
+ ```bash
22
+ python3 -c "
23
+ import json, hashlib
24
+ from pathlib import Path
25
+ lock = {'version': 1, 'skills': {}}
26
+ for d in sorted(Path('skills').iterdir()):
27
+ p = d / 'SKILL.md'
28
+ if p.exists():
29
+ lock['skills'][d.name] = hashlib.sha256(p.read_bytes()).hexdigest()
30
+ print(json.dumps(lock, indent=2, ensure_ascii=False))
31
+ "
32
+ ```
33
+
34
+ ### 2. 写入 skills-lock.json
35
+
36
+ 将输出写入 `skills-lock.json`。
37
+
38
+ ### 3. 验证
39
+
40
+ 运行 `bun run check` 确认 `skills-lock` 校验通过。
41
+
42
+ ## 红旗清单 / 反模式
43
+
44
+ - **不要**手动编辑 `skills-lock.json` 中的哈希值;始终通过脚本重新生成
45
+ - 删除 skill 时必须同步删除 `skills-lock.json` 中的对应条目
46
+ - 新增 skill 必须立即加入 `skills-lock.json` 并提交
47
+ - `SKILL.md` 是生成产物时,以 `.tmpl` 为真值计算哈希(如技能使用模板生成)
48
+
49
+ ## 验证清单 / 出口条件
50
+
51
+ - [ ] `bun run check` 通过
52
+ - [ ] `skills-lock.json` 中所有 skill 的哈希与实际文件一致
53
+ - [ ] 没有未列入 `skills-lock.json` 的 skill
54
+ - [ ] 没有已删除但仍在 `skills-lock.json` 中的 skill
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: maintain-hygiene-skills-lock
3
+ description: 维护 skills-lock.json 完整性锁。在新增、修改或删除 skill 时更新锁文件。
4
+ ---
5
+
6
+ # maintain-hygiene-skills-lock
7
+
8
+ ## 入口条件
9
+
10
+ - `skills/` 目录发生变更(新增、修改、删除 skill)
11
+ - `skills-lock.json` 与当前 skill 内容不一致
12
+ - `bun run check` 报 `skills-lock: hash mismatch` 或 `not listed`
13
+
14
+ ## 可操作流程
15
+
16
+ ### 1. 重新计算哈希
17
+
18
+ 运行以下脚本重新生成 `skills-lock.json`:
19
+
20
+ ```bash
21
+ python3 -c "
22
+ import json, hashlib
23
+ from pathlib import Path
24
+ lock = {'version': 1, 'skills': {}}
25
+ for d in sorted(Path('skills').iterdir()):
26
+ p = d / 'SKILL.md'
27
+ if p.exists():
28
+ lock['skills'][d.name] = hashlib.sha256(p.read_bytes()).hexdigest()
29
+ print(json.dumps(lock, indent=2, ensure_ascii=False))
30
+ "
31
+ ```
32
+
33
+ ### 2. 写入 skills-lock.json
34
+
35
+ 将输出写入 `skills-lock.json`。
36
+
37
+ ### 3. 验证
38
+
39
+ 运行 `bun run check` 确认 `skills-lock` 校验通过。
40
+
41
+ ## 红旗清单 / 反模式
42
+
43
+ - **不要**手动编辑 `skills-lock.json` 中的哈希值;始终通过脚本重新生成
44
+ - 删除 skill 时必须同步删除 `skills-lock.json` 中的对应条目
45
+ - 新增 skill 必须立即加入 `skills-lock.json` 并提交
46
+ - `SKILL.md` 是生成产物时,以 `.tmpl` 为真值计算哈希(如技能使用模板生成)
47
+
48
+ ## 验证清单 / 出口条件
49
+
50
+ - [ ] `bun run check` 通过
51
+ - [ ] `skills-lock.json` 中所有 skill 的哈希与实际文件一致
52
+ - [ ] 没有未列入 `skills-lock.json` 的 skill
53
+ - [ ] 没有已删除但仍在 `skills-lock.json` 中的 skill
@@ -0,0 +1,63 @@
1
+ # gxpm Specification-Driven Development Constitution
2
+
3
+ > Adapted from Spec Kit's Nine Articles of Development.
4
+ > These constraints are enforced as Phase -1 Gates before plan phase advancement.
5
+
6
+ ## Nine Articles
7
+
8
+ ### 1. Capability-First
9
+ Every feature must first exist as a capability contract in `core/capabilities.ts` before implementation.
10
+ - Declare input/output, mutation scope, idempotency, failure modes, and evidence metadata.
11
+ - No code without a declared capability slice.
12
+
13
+ ### 2. CLI Interface Mandate
14
+ All capabilities must expose a CLI surface (stdin/stdout, JSON-compatible).
15
+ - Commands are the primary integration point, not internal APIs.
16
+ - `gxpm capability list/show` remains read-only; execution is a separate concern.
17
+
18
+ ### 3. Test-First Imperative
19
+ Strict red-green-refactor for all non-trivial changes.
20
+ - Write the test before the implementation.
21
+ - `bun test` is the fast gate; it must pass before any phase transition.
22
+
23
+ ### 4. Composition over Inheritance
24
+ Prefer composing small, focused modules over deep inheritance hierarchies.
25
+ - `StepBase`, `HostAdapter`, and `PresetResolver` are interfaces, not base classes.
26
+ - Mixins and inheritance are last resorts.
27
+
28
+ ### 5. Explicit over Implicit
29
+ No magic, no hidden conventions, no global state mutations.
30
+ - All side effects must be declared in capability contracts.
31
+ - Configuration is explicit: `config.json` > env > default.
32
+
33
+ ### 6. Fail Fast, Fail Loud
34
+ Errors must surface immediately with actionable context.
35
+ - No silent swallowing of exceptions.
36
+ - Validation happens at the boundary (config, artifact, command input).
37
+
38
+ ### 7. Simplicity Gate
39
+ A feature must justify its complexity. When in doubt, delete.
40
+ - Max 3 modules per feature slice unless proven otherwise.
41
+ - Preset system MVP: Override + Preset + Core only; Extension and hooks deferred.
42
+
43
+ ### 8. Anti-Abstraction
44
+ Use framework/language features directly. Avoid wrapper upon wrapper.
45
+ - `yaml` library directly, not a custom YAML parser.
46
+ - `execSync` directly, not a "command runner abstraction layer".
47
+
48
+ ### 9. Integration-First Testing
49
+ Prefer real environments over mocks for integration surfaces.
50
+ - Browser tests use real Playwright, not stubbed.
51
+ - Linear integration tests hit real API in sandbox mode.
52
+ - Unit tests mock; integration tests verify.
53
+
54
+ ## Phase -1 Gates
55
+
56
+ Before advancing from `triage` to `plan`, confirm:
57
+
58
+ - [ ] **Capability declared?** — `core/capabilities.ts` has the slice.
59
+ - [ ] **Test strategy defined?** — Implementation plan includes test approach.
60
+ - [ ] **Simplicity justified?** — Feature complexity is minimal viable.
61
+ - [ ] **Integration path clear?** — Real environment testing is planned, not deferred indefinitely.
62
+
63
+ These gates are optional for spike/investigation issues (type=spike), mandatory for feature delivery (default type).
@@ -0,0 +1,16 @@
1
+ #!/bin/bash
2
+ # gxpm commit-msg hook. $1 is the path to .git/COMMIT_EDITMSG
3
+ set -e
4
+
5
+ if ! command -v gxpm >/dev/null 2>&1; then
6
+ exit 0
7
+ fi
8
+
9
+ current_branch="$(git symbolic-ref --short HEAD 2>/dev/null || echo '')"
10
+ issue_id=$(printf '%s' "$current_branch" | grep -oEi '(gxg|gxpm)-[0-9]+' | head -1 | tr 'a-z' 'A-Z')
11
+
12
+ if [ -n "$issue_id" ] && [ -f ".gxpm/issues/${issue_id}/state.json" ]; then
13
+ exec gxpm gate commit-msg "$1" --issue "$issue_id"
14
+ fi
15
+
16
+ exit 0
@@ -0,0 +1,19 @@
1
+ #!/bin/bash
2
+ # gxpm post-checkout hook
3
+ # Git runs this after checkout/switch. It cannot prevent the switch, but it
4
+ # fails loudly when the canonical checkout is no longer on main.
5
+ set -e
6
+
7
+ if [ -x "./bin/gxpm" ]; then
8
+ GXPM_BIN="./bin/gxpm"
9
+ elif command -v gxpm >/dev/null 2>&1; then
10
+ GXPM_BIN="$(command -v gxpm)"
11
+ else
12
+ exit 0
13
+ fi
14
+
15
+ "$GXPM_BIN" gate branch-policy
16
+
17
+ # gxpm wiki is an optional human-facing documentation surface. Keep branch
18
+ # switching focused on policy enforcement; humans can refresh docs explicitly
19
+ # with `gxpm wiki update` when they want an up-to-date wiki.
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ # gxpm post-commit hook
3
+ # Reserved for future post-commit policy. Wiki refresh is manual because the
4
+ # gxpm wiki is an optional human-facing documentation surface.
5
+ set +e
6
+
7
+ exit 0
@@ -0,0 +1,29 @@
1
+ #!/bin/bash
2
+ # gxpm post-merge hook (runs after `git merge` or `git pull` completes)
3
+ set -e
4
+
5
+ if ! command -v gxpm >/dev/null 2>&1; then
6
+ exit 0
7
+ fi
8
+
9
+ # When a feature branch merges into develop, the post-merge runs ON the
10
+ # branch that received the merge (usually develop). Use the merged branch
11
+ # name from MERGE_MSG when available.
12
+ issue_id=""
13
+ if [ -f .git/MERGE_MSG ]; then
14
+ issue_id=$(grep -oEi '(gxg|gxpm)-[0-9]+' .git/MERGE_MSG | head -1 | tr 'a-z' 'A-Z' || true)
15
+ fi
16
+
17
+ if [ -n "$issue_id" ] && [ -f ".gxpm/issues/${issue_id}/state.json" ]; then
18
+ gxpm gate post-merge "$issue_id" || true
19
+ if current_sha=$(git rev-parse HEAD 2>/dev/null); then
20
+ log_dir="${GXPM_HOME:-$HOME/.gxpm}"
21
+ mkdir -p "$log_dir" 2>/dev/null || true
22
+ log_file="$log_dir/post-merge-error.log"
23
+ if ! gxpm gate post-merge-reconcile "$issue_id" --sha "$current_sha" 2>>"$log_file"; then
24
+ printf '%s %s\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "post-merge-reconcile failed for $issue_id $current_sha" >>"$log_file" 2>/dev/null || true
25
+ fi
26
+ fi
27
+ fi
28
+
29
+ exit 0
@@ -0,0 +1,39 @@
1
+ #!/bin/bash
2
+ # gxpm pre-commit hook
3
+ # Installed by `gxpm-init --install-hooks`. Reads `.gxpm/issues/<id>/state.json`
4
+ # to enforce phase gate. No-op if no state file or no issue id in branch name.
5
+ # Escape hatch: GXPM_GATE_DISABLE=1 git commit ...
6
+
7
+ set -e
8
+
9
+ if [ -x "./bin/gxpm" ]; then
10
+ GXPM_BIN="./bin/gxpm"
11
+ elif command -v gxpm >/dev/null 2>&1; then
12
+ GXPM_BIN="$(command -v gxpm)"
13
+ else
14
+ exit 0
15
+ fi
16
+
17
+ "$GXPM_BIN" gate branch-policy
18
+
19
+ current_branch="$(git symbolic-ref --short HEAD 2>/dev/null || echo '')"
20
+ issue_id=$(printf '%s' "$current_branch" | grep -oEi '(gxg|gxpm)-[0-9]+' | head -1 | tr 'a-z' 'A-Z')
21
+
22
+ if [ -z "$issue_id" ]; then
23
+ exit 0
24
+ fi
25
+
26
+ if [ ! -f ".gxpm/issues/${issue_id}/state.json" ]; then
27
+ exit 0
28
+ fi
29
+
30
+ staged_files=()
31
+ while IFS= read -r -d '' staged_file; do
32
+ staged_files+=("$staged_file")
33
+ done < <(git diff --cached --name-only --diff-filter=ACMR -z)
34
+
35
+ if [ "${#staged_files[@]}" -eq 0 ]; then
36
+ exit 0
37
+ fi
38
+
39
+ exec "$GXPM_BIN" gate pre-commit "$issue_id" --staged "${staged_files[@]}"
@@ -0,0 +1,33 @@
1
+ #!/bin/bash
2
+ # gxpm pre-push hook
3
+ set -e
4
+
5
+ if [ -x "./bin/gxpm" ]; then
6
+ GXPM_BIN="./bin/gxpm"
7
+ elif command -v gxpm >/dev/null 2>&1; then
8
+ GXPM_BIN="$(command -v gxpm)"
9
+ else
10
+ exit 0
11
+ fi
12
+
13
+ "$GXPM_BIN" gate branch-policy
14
+
15
+ current_branch="$(git symbolic-ref --short HEAD 2>/dev/null || echo '')"
16
+ issue_id=$(printf '%s' "$current_branch" | grep -oEi '(gxg|gxpm)-[0-9]+' | head -1 | tr 'a-z' 'A-Z')
17
+
18
+ if [ -n "$issue_id" ] && [ -f ".gxpm/issues/${issue_id}/state.json" ]; then
19
+ "$GXPM_BIN" gate pre-push "$issue_id"
20
+ fi
21
+
22
+ # Informational dogfood compliance check (non-blocking by default).
23
+ # Reports issues that reached implement without going through specify
24
+ # after SPECIFY_PHASE_CUTOFF. Set GXPM_DOGFOOD_STRICT=1 to enforce.
25
+ if command -v bun >/dev/null 2>&1 && [ -f "scripts/dogfood-check.ts" ]; then
26
+ if [ "${GXPM_DOGFOOD_STRICT:-0}" = "1" ]; then
27
+ bun run scripts/dogfood-check.ts --strict || exit 1
28
+ else
29
+ bun run scripts/dogfood-check.ts || true
30
+ fi
31
+ fi
32
+
33
+ exit 0
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: gxpm-plan
3
+ description: Use when creating an implementation plan artifact. Breaks a spec into discrete, implementable tasks with verification steps.
4
+ ---
5
+
6
+ # Plan: [Feature Name]
7
+
8
+ ## Summary
9
+
10
+ [One-paragraph summary of the implementation approach]
11
+
12
+ ## Architecture Decisions
13
+
14
+ | Decision | Rationale | Trade-offs |
15
+ |----------|-----------|------------|
16
+ | [Decision] | [Why] | [What we give up] |
17
+
18
+ ## Risks
19
+
20
+ | Risk | Likelihood | Impact | Mitigation |
21
+ |------|-----------|--------|-----------|
22
+ | [Risk] | High/Med/Low | High/Med/Low | [How we reduce it] |
23
+
24
+ ## Approach
25
+
26
+ ### Step 1: [Name]
27
+ - **Files:** [which files will be touched]
28
+ - **Details:** [what to do]
29
+ - **Verification:** [how to confirm it works]
30
+
31
+ ### Step 2: [Name]
32
+ - **Files:**
33
+ - **Details:**
34
+ - **Verification:**
35
+
36
+ ## Validation
37
+
38
+ ```bash
39
+ # Commands to run after implementation
40
+ bun test
41
+ bun run check
42
+ ```
43
+
44
+ ## Non-Goals
45
+
46
+ - [What is explicitly out of scope]
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: gxpm-spec
3
+ description: Use when creating a specification artifact for a new feature or significant change. Defines what we're building, why, and how we'll know it's done.
4
+ ---
5
+
6
+ # Spec: [Feature Name]
7
+
8
+ ## Objective
9
+
10
+ What are we building and why?
11
+
12
+ - **What:** [One-sentence description]
13
+ - **Why:** [Business or technical motivation]
14
+ - **Who:** [Target users or consumers]
15
+
16
+ ## Tech Stack
17
+
18
+ - Runtime: [e.g. TypeScript/Bun]
19
+ - Key dependencies: [list]
20
+
21
+ ## Commands
22
+
23
+ ```bash
24
+ # Primary command
25
+
26
+ # Verification command
27
+ ```
28
+
29
+ ## Project Structure
30
+
31
+ ```
32
+ [directory layout]
33
+ ```
34
+
35
+ ## Code Style
36
+
37
+ [Conventions and patterns]
38
+
39
+ ## Testing Strategy
40
+
41
+ - Framework: [e.g. bun:test]
42
+ - Coverage target: [e.g. >80%]
43
+ - Integration path: [real environment or mock]
44
+
45
+ ## Boundaries
46
+
47
+ ### Always
48
+ - [Non-negotiable discipline]
49
+
50
+ ### Ask First
51
+ - [Human-in-the-loop decisions]
52
+
53
+ ### Never
54
+ - [Hard guardrails]
55
+
56
+ ## Success Criteria
57
+
58
+ - [ ] [Measurable, testable criterion 1]
59
+ - [ ] [Measurable, testable criterion 2]
60
+
61
+ ## Open Questions
62
+
63
+ - [Question that needs resolution before implementation]
@@ -0,0 +1,22 @@
1
+ // Feature: {{feature.title}}
2
+ //
3
+ // As a {{feature.asA}}
4
+ // I want {{feature.iWant}}
5
+ // So that {{feature.soThat}}
6
+ //
7
+ {{#each scenarios}}
8
+ // Scenario ({{this.id}}): {{this.name}}
9
+ {{#each this.given}}
10
+ // {{#if @first}}Given{{else}}And{{/if}} {{this}}
11
+ {{/each}}
12
+ // When {{this.when}}
13
+ {{#each this.then}}
14
+ // {{#if @first}}Then{{else}}And{{/if}} {{this}}
15
+ {{/each}}
16
+
17
+ test("{{this.testName}}", () => {
18
+ // intentionally empty — awaiting user confirmation
19
+ // implement only after `gxpm specify confirm <issue-id>`
20
+ });
21
+
22
+ {{/each}}
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: gxpm-tasks
3
+ description: Use when creating a task list artifact. Vertical slices that are independently grabbable and completable in a single focused session.
4
+ ---
5
+
6
+ # Tasks: [Feature Name]
7
+
8
+ ## Task List
9
+
10
+ - [ ] **Task 1:** [Description]
11
+ - **Acceptance:** [What must be true when done]
12
+ - **Verify:** [How to confirm]
13
+ - **Files:** [Which files will be touched]
14
+
15
+ - [ ] **Task 2:** [Description]
16
+ - **Acceptance:**
17
+ - **Verify:**
18
+ - **Files:**
19
+
20
+ ## Dependency Graph
21
+
22
+ ```
23
+ Task 1 ──→ Task 3
24
+ Task 2 ──→ Task 3
25
+ ```
26
+
27
+ ## Verification Checklist
28
+
29
+ - [ ] All tasks have explicit acceptance criteria
30
+ - [ ] No task touches more than ~5 files
31
+ - [ ] Tasks are ordered by dependency
32
+ - [ ] Each task can be completed in one focused session