@uniqbit/mate-core 0.18.5 → 0.20.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 (432) hide show
  1. package/claude-capability-plugins/companion-mentions/.claude-plugin/marketplace.json +14 -0
  2. package/claude-capability-plugins/companion-mentions/.claude-plugin/plugin.json +8 -0
  3. package/claude-capability-plugins/companion-mentions/hooks/companion.ts +457 -0
  4. package/claude-capability-plugins/companion-mentions/hooks/hooks.json +1 -0
  5. package/claude-capability-plugins/companion-mentions/hooks/register.ts +403 -0
  6. package/claude-plugin/hooks/companion-instructions.mjs +9 -0
  7. package/claude-plugin/hooks/hooks.json +41 -2
  8. package/claude-plugin/hooks/session-attention.mjs +10 -0
  9. package/claude-plugin/hooks/session-end.mjs +9 -0
  10. package/claude-plugin/hooks/session-guidance.mjs +1 -1
  11. package/claude-plugin/hooks/tokensave-route.mjs +52 -0
  12. package/opencode-plugin/src/server.ts +17 -2
  13. package/opencode-plugin/src/tui.tsx +3 -1
  14. package/opencode-plugin/tui.tsx +4 -1
  15. package/package.json +52 -15
  16. package/src/brand/art.generated.ts +69 -0
  17. package/src/brand/index.ts +12 -0
  18. package/src/brand/palette.ts +19 -0
  19. package/src/brand/svg.generated.ts +8 -0
  20. package/src/brand/terminal.ts +88 -0
  21. package/src/brand/types.ts +33 -0
  22. package/src/cli/commands/artifact/apply-context.ts +275 -0
  23. package/src/cli/commands/artifact/artifact.ts +12 -0
  24. package/src/cli/commands/artifact/delivery/archive.ts +125 -0
  25. package/src/cli/commands/artifact/delivery/branch-flags.ts +55 -0
  26. package/src/cli/commands/artifact/delivery/environment.ts +127 -0
  27. package/src/cli/commands/artifact/delivery/link.ts +191 -0
  28. package/src/cli/commands/artifact/delivery/output.ts +97 -0
  29. package/src/cli/commands/artifact/finish/command.ts +83 -8
  30. package/src/cli/commands/artifact/finish/engine.ts +91 -14
  31. package/src/cli/commands/artifact/finish/finisher.ts +10 -0
  32. package/src/cli/commands/artifact/finish/git.ts +132 -19
  33. package/src/cli/commands/artifact/finish/openspec.ts +180 -138
  34. package/src/cli/commands/artifact/finish/secret-scan.ts +43 -0
  35. package/src/cli/commands/artifact/finish/worktree-cleanup.ts +92 -0
  36. package/src/cli/commands/artifact/pending/command.ts +31 -3
  37. package/src/cli/commands/artifact/pending/discovery.ts +21 -57
  38. package/src/cli/commands/cap/graphify.ts +52 -3
  39. package/src/cli/commands/cap/index-cmd.ts +71 -15
  40. package/src/cli/commands/cap/openspec.ts +13 -25
  41. package/src/cli/commands/cap/tokensave.ts +7 -5
  42. package/src/cli/commands/companion/companion.ts +1 -1
  43. package/src/cli/commands/companion/link.ts +50 -5
  44. package/src/cli/commands/companion/open.ts +101 -51
  45. package/src/cli/commands/companion/sync.ts +10 -0
  46. package/src/cli/commands/companion/tui.ts +17 -7
  47. package/src/cli/commands/companion/update.ts +143 -48
  48. package/src/cli/commands/doctor.ts +317 -7
  49. package/src/cli/commands/factory/factory.ts +301 -0
  50. package/src/cli/commands/install.ts +133 -9
  51. package/src/cli/commands/launch/shared.ts +16 -11
  52. package/src/cli/commands/plugin/install.ts +9 -4
  53. package/src/cli/commands/plugin/plugin.ts +3 -2
  54. package/src/cli/commands/report/adapter.ts +11 -2
  55. package/src/cli/commands/report/contract.ts +21 -0
  56. package/src/cli/commands/report/highlight.ts +34 -4
  57. package/src/cli/commands/report/index.ts +20 -1
  58. package/src/cli/commands/report/markdown.ts +110 -0
  59. package/src/cli/commands/report/palette.ts +118 -0
  60. package/src/cli/commands/report/renderer.ts +456 -153
  61. package/src/cli/commands/report/types.ts +16 -0
  62. package/src/cli/commands/session/context.ts +102 -0
  63. package/src/cli/commands/session/prepare.ts +32 -4
  64. package/src/cli/commands/session/registry.ts +90 -0
  65. package/src/cli/commands/setup.ts +50 -24
  66. package/src/cli/commands/studio/companion-removal.ts +79 -0
  67. package/src/cli/commands/studio/factory-credential.ts +49 -0
  68. package/src/cli/commands/studio/index.ts +29 -2
  69. package/src/cli/commands/studio/mate-inventory.ts +1 -1
  70. package/src/cli/commands/studio/openspec-cli.ts +10 -58
  71. package/src/cli/commands/studio/payload.ts +260 -15
  72. package/src/cli/commands/studio/routes.ts +41 -6
  73. package/src/cli/commands/studio/selection.ts +161 -17
  74. package/src/cli/commands/studio/server.ts +429 -326
  75. package/src/cli/commands/studio/services.ts +80 -0
  76. package/src/cli/commands/studio/skill-files.ts +133 -0
  77. package/src/cli/commands/studio/studio-app.ts +67 -0
  78. package/src/cli/commands/studio/terminal-assets.ts +21 -33
  79. package/src/cli/commands/studio/terminal.ts +85 -15
  80. package/src/cli/commands/studio/vault.ts +218 -44
  81. package/src/cli/commands/studio/views/model.ts +13 -0
  82. package/src/cli/commands/studio/views/vault/markdown-tree.ts +518 -0
  83. package/src/cli/commands/studio/views/vault/view.ts +185 -0
  84. package/src/cli/commands/studio/workset-session.ts +131 -0
  85. package/src/cli/commands/unwrap.ts +16 -0
  86. package/src/cli/commands/update.ts +53 -9
  87. package/src/cli/commands/vscode/setup.ts +155 -0
  88. package/src/cli/commands/vscode/vsix.ts +73 -0
  89. package/src/cli/commands/working/cleanup.ts +44 -11
  90. package/src/cli/commands/working/link.ts +76 -0
  91. package/src/cli/commands/working/working.ts +10 -0
  92. package/src/cli/commands/working/worktree.ts +406 -0
  93. package/src/cli/commands/wrap.ts +38 -20
  94. package/src/cli/companion-link-wizard.tsx +2 -0
  95. package/src/cli/companion-selector.tsx +2 -0
  96. package/src/cli/confirm.ts +2 -0
  97. package/src/cli/install-plan.tsx +127 -160
  98. package/src/cli/launch-selector.tsx +2 -0
  99. package/src/cli/main.ts +31 -3
  100. package/src/cli/parse-flags.ts +32 -6
  101. package/src/cli/repo-list-table.tsx +2 -0
  102. package/src/cli/setup-selector.tsx +86 -151
  103. package/src/cli/usage.ts +20 -1
  104. package/src/create-mate.ts +5 -4
  105. package/src/hooks/companion-instructions.ts +198 -0
  106. package/src/hooks/hook-io.ts +78 -0
  107. package/src/hooks/session-banner.ts +24 -30
  108. package/src/hooks/session-end.ts +10 -0
  109. package/src/hooks/session-guidance.ts +18 -22
  110. package/src/hooks/session-prepare.ts +137 -34
  111. package/src/hooks/session-register.ts +199 -0
  112. package/src/hooks/tokensave-route.ts +30 -0
  113. package/src/hooks/validate-artifact-path.ts +90 -25
  114. package/src/index.ts +4 -0
  115. package/src/lib/apply-context/fingerprint.ts +174 -0
  116. package/src/lib/apply-context/protocol.ts +193 -0
  117. package/src/lib/change-layout.ts +154 -0
  118. package/src/lib/components/confirm-prompt.tsx +21 -9
  119. package/src/lib/components/select-menu.tsx +10 -3
  120. package/src/lib/components/spinner.tsx +4 -2
  121. package/src/lib/components/startup-progress.tsx +227 -41
  122. package/src/lib/components/text-input-display.tsx +2 -0
  123. package/src/lib/components/wizard-footer.tsx +2 -0
  124. package/src/lib/components/wizard-header.tsx +16 -12
  125. package/src/lib/context-mode-package.ts +24 -11
  126. package/src/lib/delivery/archive-change.ts +165 -0
  127. package/src/lib/delivery/branches.ts +147 -0
  128. package/src/lib/delivery/environment.ts +35 -0
  129. package/src/lib/delivery/forge.ts +279 -0
  130. package/src/lib/delivery/merge-git.ts +261 -0
  131. package/src/lib/delivery/overlap.ts +209 -0
  132. package/src/lib/delivery/record-delivery.ts +338 -0
  133. package/src/lib/delivery/record.ts +405 -0
  134. package/src/lib/delivery/refresh.ts +288 -0
  135. package/src/lib/delivery/repository-access.ts +141 -0
  136. package/src/lib/delivery/resolve-branch.ts +383 -0
  137. package/src/lib/delivery/stages.ts +111 -0
  138. package/src/lib/delivery/token.ts +24 -0
  139. package/src/lib/factory/attach-client.ts +113 -0
  140. package/src/lib/factory/attach.ts +178 -0
  141. package/src/lib/factory/broker.ts +190 -0
  142. package/src/lib/factory/bun-commands.ts +39 -0
  143. package/src/lib/factory/client.ts +92 -0
  144. package/src/lib/factory/command.ts +61 -0
  145. package/src/lib/factory/credential-store.ts +153 -0
  146. package/src/lib/factory/frames.ts +77 -0
  147. package/src/lib/factory/ids.ts +58 -0
  148. package/src/lib/factory/keyed-serial.ts +27 -0
  149. package/src/lib/factory/outcomes/actions.ts +114 -0
  150. package/src/lib/factory/outcomes/index.ts +391 -0
  151. package/src/lib/factory/outcomes/lifecycle.ts +205 -0
  152. package/src/lib/factory/outcomes/runs.ts +81 -0
  153. package/src/lib/factory/outcomes/sessions.ts +38 -0
  154. package/src/lib/factory/prepare.ts +49 -0
  155. package/src/lib/factory/pty.ts +103 -0
  156. package/src/lib/factory/runner/companion-context.ts +178 -0
  157. package/src/lib/factory/runner/control.ts +92 -0
  158. package/src/lib/factory/runner/harness-agent.ts +250 -0
  159. package/src/lib/factory/runner/live.ts +159 -0
  160. package/src/lib/factory/runner/questions.ts +22 -0
  161. package/src/lib/factory/runner/rank.ts +26 -0
  162. package/src/lib/factory/runner/run-policy.ts +12 -0
  163. package/src/lib/factory/runner/run.ts +199 -0
  164. package/src/lib/factory/runner/scheduler.ts +416 -0
  165. package/src/lib/factory/runner/state.ts +233 -0
  166. package/src/lib/factory/runner/workflow.ts +542 -0
  167. package/src/lib/factory/runtime.ts +981 -0
  168. package/src/lib/factory/sandbox.ts +292 -0
  169. package/src/lib/factory/worktree-branch.ts +17 -0
  170. package/src/lib/frontmatter.ts +18 -0
  171. package/src/lib/install.ts +66 -14
  172. package/src/lib/live-progress.ts +36 -0
  173. package/src/lib/member-choices.ts +67 -0
  174. package/src/lib/opencode-plugin-package.ts +5 -5
  175. package/src/lib/opencode-server.ts +238 -0
  176. package/src/lib/openspec-cli.ts +116 -0
  177. package/src/lib/openspec-scopes.ts +86 -0
  178. package/src/lib/orchestrator/adapters/base.ts +55 -22
  179. package/src/lib/orchestrator/adapters/claude-args.ts +50 -0
  180. package/src/lib/orchestrator/adapters/claude.ts +201 -43
  181. package/src/lib/orchestrator/adapters/opencode.ts +55 -2
  182. package/src/lib/orchestrator/checkout-adoption.ts +125 -0
  183. package/src/lib/orchestrator/companion-registry-store.ts +6 -2
  184. package/src/lib/orchestrator/config-store.ts +3 -2
  185. package/src/lib/orchestrator/editor.ts +32 -26
  186. package/src/lib/orchestrator/framework-context.ts +26 -14
  187. package/src/lib/orchestrator/global-config-store.ts +11 -0
  188. package/src/lib/orchestrator/launcher.ts +15 -2
  189. package/src/lib/orchestrator/openspec-store.ts +14 -54
  190. package/src/lib/orchestrator/projection-claude-commands.ts +36 -0
  191. package/src/lib/orchestrator/projection-claude-links.ts +206 -0
  192. package/src/lib/orchestrator/projection-claude-skills.ts +37 -129
  193. package/src/lib/orchestrator/projection-companion-link.ts +12 -1
  194. package/src/lib/orchestrator/projection-entries.ts +100 -34
  195. package/src/lib/orchestrator/projection-opencode-copies.ts +32 -15
  196. package/src/lib/orchestrator/projection-openspec-store.ts +54 -9
  197. package/src/lib/orchestrator/projection-runtime-documents.ts +15 -6
  198. package/src/lib/orchestrator/projection-types.ts +36 -1
  199. package/src/lib/orchestrator/refresh-working-claude-links.ts +87 -0
  200. package/src/lib/orchestrator/registry-checkouts.ts +177 -0
  201. package/src/lib/orchestrator/repository-link.ts +216 -57
  202. package/src/lib/orchestrator/serving-claude-wrap.ts +43 -0
  203. package/src/lib/orchestrator/session-context-link.ts +73 -0
  204. package/src/lib/orchestrator/session-prepare.ts +81 -11
  205. package/src/lib/orchestrator/setup-compatibilities.ts +56 -70
  206. package/src/lib/orchestrator/types.ts +12 -2
  207. package/src/lib/orchestrator/working-repo-projection.ts +50 -7
  208. package/src/lib/orchestrator/workspace-document.ts +105 -0
  209. package/src/lib/orchestrator/workspace-inventory.ts +5 -1
  210. package/src/lib/orchestrator/wrap-pass.ts +22 -1
  211. package/src/lib/package-paths.ts +37 -0
  212. package/src/lib/public-npm.ts +17 -0
  213. package/src/lib/runtime-directory-refresh.ts +17 -1
  214. package/src/lib/session-attribution.ts +52 -0
  215. package/src/lib/session-state.ts +285 -0
  216. package/src/lib/session-stop.ts +64 -0
  217. package/src/lib/workset/record.ts +533 -0
  218. package/src/lib/workset/repositories.ts +55 -0
  219. package/src/lib/workset/stage.ts +148 -0
  220. package/src/lib/workset/stages.ts +113 -0
  221. package/src/lib/workset/worktree-index.ts +116 -0
  222. package/src/lib/workset/worktree.ts +898 -0
  223. package/src/opencode/background-server.ts +145 -0
  224. package/src/opencode/companion-hooks.ts +111 -7
  225. package/src/opencode/companion-policy.ts +39 -20
  226. package/src/opencode/enter-worktree.ts +72 -0
  227. package/src/opencode/projected-guidance.ts +6 -2
  228. package/src/opencode/session-prepare.ts +2 -1
  229. package/src/opencode/session-register.ts +176 -0
  230. package/src/opencode/tui.tsx +24 -27
  231. package/src/plugins.ts +1 -0
  232. package/src/runtime/artifact-refusal.ts +63 -0
  233. package/src/runtime/claude-delivery-plan.ts +121 -11
  234. package/src/runtime/commit-attribution-guard.ts +181 -0
  235. package/src/runtime/companion-git.ts +52 -10
  236. package/src/runtime/companion-guidance.ts +20 -8
  237. package/src/runtime/companion-instructions.ts +340 -0
  238. package/src/runtime/companion-lock.ts +30 -7
  239. package/src/runtime/current-branch.ts +10 -0
  240. package/src/runtime/env.ts +59 -8
  241. package/src/runtime/error-message.ts +4 -0
  242. package/src/runtime/git-layout.ts +366 -0
  243. package/src/runtime/index.ts +29 -0
  244. package/src/runtime/launch-env-guard.ts +65 -0
  245. package/src/runtime/managed-block.ts +117 -0
  246. package/src/runtime/markdown-scan.ts +266 -0
  247. package/src/runtime/opencode-server-record.ts +136 -0
  248. package/src/runtime/physical-path.ts +111 -0
  249. package/src/runtime/policy.ts +50 -2
  250. package/src/runtime/projected-flag.ts +7 -0
  251. package/src/runtime/projected-guidance.ts +1 -0
  252. package/src/runtime/projection.ts +40 -6
  253. package/src/runtime/repo-local.ts +6 -1
  254. package/src/runtime/runtime-directory.ts +5 -0
  255. package/src/runtime/runtime-document-manifest.ts +62 -11
  256. package/src/runtime/secret-guard.ts +162 -0
  257. package/src/runtime/secret-patterns.ts +397 -0
  258. package/src/runtime/secret-scan.ts +90 -0
  259. package/src/runtime/serving-claude-wrap.ts +28 -0
  260. package/src/runtime/session-context.ts +99 -0
  261. package/src/runtime/session-kind.ts +13 -0
  262. package/src/runtime/session-registry.ts +434 -0
  263. package/src/runtime/shell-heredoc.ts +81 -0
  264. package/src/runtime/tokensave-route.ts +157 -0
  265. package/src/runtime/wrap-state.ts +75 -2
  266. package/src/runtime/write-atomic.ts +64 -0
  267. package/src/studio.ts +126 -0
  268. package/src/templates/capabilities/openspec-cap/mate-minimal/schema.yaml +14 -10
  269. package/src/templates/capabilities/openspec-cap/mate-minimal/templates/spec.md +3 -5
  270. package/src/templates/capabilities/openspec-cap/mate-v1/schema.yaml +18 -102
  271. package/src/templates/capabilities/openspec-cap/mate-v1/templates/spec.md +3 -5
  272. package/src/templates/capabilities/openspec-cap/openspec-conventions.yaml +20 -14
  273. package/src/templates/mate-skills/THIRD-PARTY-NOTICES.md +40 -0
  274. package/src/templates/mate-skills/agents/mate-apply-change/SKILL.md +162 -0
  275. package/src/templates/mate-skills/agents/mate-apply-change/references/mate-compact-apply.md +47 -0
  276. package/src/templates/mate-skills/agents/mate-apply-change/references/openspec-apply-change.md +200 -0
  277. package/src/templates/mate-skills/agents/mate-archive-change/SKILL.md +81 -0
  278. package/src/templates/mate-skills/{claude/mate-openspec-backfill → agents/mate-backfill-spec}/SKILL.md +11 -4
  279. package/src/templates/mate-skills/agents/mate-clarify-intent/SKILL.md +110 -0
  280. package/src/templates/mate-skills/agents/mate-explore-change/SKILL.md +66 -0
  281. package/src/templates/mate-skills/agents/mate-explore-change/references/openspec-explore.md +350 -0
  282. package/src/templates/mate-skills/agents/mate-grill-me/SKILL.md +11 -4
  283. package/src/templates/mate-skills/agents/mate-grill-with-docs/SKILL.md +2 -2
  284. package/src/templates/mate-skills/agents/mate-interview-me/SKILL.md +12 -5
  285. package/src/templates/mate-skills/agents/mate-propose-change/SKILL.md +102 -0
  286. package/src/templates/mate-skills/agents/mate-propose-change/references/mate-revise.md +45 -0
  287. package/src/templates/mate-skills/agents/mate-propose-change/references/openspec-propose.md +169 -0
  288. package/src/templates/mate-skills/agents/mate-propose-change/references/openspec-update-change.md +103 -0
  289. package/src/templates/mate-skills/agents/{mate-artifact-publish → mate-publish-artifact}/SKILL.md +109 -24
  290. package/src/templates/mate-skills/{claude/mate-artifact-publish → agents/mate-publish-artifact}/references/openspec.md +8 -5
  291. package/src/templates/mate-skills/agents/mate-show-me/SKILL.md +95 -16
  292. package/src/templates/mate-skills/agents/mate-simplify-code/SKILL.md +87 -68
  293. package/src/templates/mate-skills/claude/mate-apply-change/SKILL.md +162 -0
  294. package/src/templates/mate-skills/claude/mate-apply-change/references/mate-compact-apply.md +47 -0
  295. package/src/templates/mate-skills/claude/mate-apply-change/references/openspec-apply-change.md +200 -0
  296. package/src/templates/mate-skills/claude/mate-archive-change/SKILL.md +81 -0
  297. package/src/templates/mate-skills/{agents/mate-openspec-backfill → claude/mate-backfill-spec}/SKILL.md +11 -4
  298. package/src/templates/mate-skills/claude/mate-clarify-intent/SKILL.md +110 -0
  299. package/src/templates/mate-skills/claude/mate-explore-change/SKILL.md +66 -0
  300. package/src/templates/mate-skills/claude/mate-explore-change/references/openspec-explore.md +350 -0
  301. package/src/templates/mate-skills/claude/mate-grill-me/SKILL.md +11 -4
  302. package/src/templates/mate-skills/claude/mate-grill-with-docs/SKILL.md +2 -2
  303. package/src/templates/mate-skills/claude/mate-interview-me/SKILL.md +12 -5
  304. package/src/templates/mate-skills/claude/mate-propose-change/SKILL.md +102 -0
  305. package/src/templates/mate-skills/claude/mate-propose-change/references/mate-revise.md +45 -0
  306. package/src/templates/mate-skills/claude/mate-propose-change/references/openspec-propose.md +169 -0
  307. package/src/templates/mate-skills/claude/mate-propose-change/references/openspec-update-change.md +103 -0
  308. package/src/templates/mate-skills/claude/{mate-artifact-publish → mate-publish-artifact}/SKILL.md +109 -24
  309. package/src/templates/mate-skills/{agents/mate-artifact-publish → claude/mate-publish-artifact}/references/openspec.md +8 -5
  310. package/src/templates/mate-skills/claude/mate-show-me/SKILL.md +95 -16
  311. package/src/templates/mate-skills/claude/mate-simplify-code/SKILL.md +87 -68
  312. package/src/templates/mate-skills/openspec-references.ts +142 -0
  313. package/src/templates/root/TEMPLATE_AGENTS.md +2 -2
  314. package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +4340 -419
  315. package/src/tools/setup/capabilities/companion-mentions.ts +27 -0
  316. package/src/tools/setup/capabilities/context-mode.ts +56 -7
  317. package/src/tools/setup/capabilities/graphify-gate.ts +31 -0
  318. package/src/tools/setup/capabilities/graphify-secrets.ts +243 -0
  319. package/src/tools/setup/capabilities/graphify.ts +46 -7
  320. package/src/tools/setup/capabilities/openspec.ts +163 -272
  321. package/src/tools/setup/capabilities/react-doctor.ts +8 -1
  322. package/src/tools/setup/capabilities/rtk.ts +4 -0
  323. package/src/tools/setup/capabilities/tokensave.ts +113 -71
  324. package/src/tools/setup/context-services.ts +9 -17
  325. package/src/tools/setup/dynamic-plugins/hydrate.ts +4 -3
  326. package/src/tools/setup/dynamic-plugins/install.ts +24 -28
  327. package/src/tools/setup/engine.ts +100 -23
  328. package/src/tools/setup/install-contract.ts +8 -0
  329. package/src/tools/setup/managed-output.ts +51 -0
  330. package/src/tools/setup/mate-skill-copies.ts +51 -0
  331. package/src/tools/setup/mate.ts +86 -11
  332. package/src/tools/setup/package-managers/uv.ts +73 -11
  333. package/src/tools/setup/plugin.ts +40 -0
  334. package/src/tools/setup/plugins/guidance.ts +7 -4
  335. package/src/tools/setup/providers/agent-file-sections.ts +4 -2
  336. package/src/tools/setup/providers/claude-attribution.ts +65 -0
  337. package/src/tools/setup/providers/claude-plugin-folders.ts +625 -0
  338. package/src/tools/setup/providers/claude-plugin-hooks.ts +77 -19
  339. package/src/tools/setup/providers/claude-worktree-plugins.ts +122 -0
  340. package/src/tools/setup/providers/claude.ts +310 -8
  341. package/src/tools/setup/providers/opencode.ts +180 -1
  342. package/src/tools/setup/utils.ts +18 -4
  343. package/src/tools/setup/working-repo-cleanup.ts +29 -1
  344. package/src/tools/setup/working-repo-local-state.ts +252 -75
  345. package/src/tools/setup.ts +183 -26
  346. package/studio-dist/client/assets/app-CdPiFv59.css +2 -0
  347. package/studio-dist/client/assets/button-BIIHE0EQ.js +3 -0
  348. package/studio-dist/client/assets/companion-view-DM6YyXaR.js +1 -0
  349. package/studio-dist/client/assets/delivery-path-DELxj0Av.js +1 -0
  350. package/studio-dist/client/assets/dist-Dm7MtyHc.js +5 -0
  351. package/studio-dist/client/assets/factory-BZy0E8ty.js +4 -0
  352. package/studio-dist/client/assets/index-B3wkMzjA.js +40 -0
  353. package/studio-dist/client/assets/markdown-view-pQ2Qp_i5.js +1 -0
  354. package/studio-dist/client/assets/panel-CbajlC3p.js +1 -0
  355. package/studio-dist/client/assets/preload-helper-BLdHbfdN.js +1 -0
  356. package/studio-dist/client/assets/prepaint-CwSrpdFA.js +27 -0
  357. package/studio-dist/client/assets/react-CN2GSx7x.js +1 -0
  358. package/studio-dist/client/assets/reports-DllhYQ5_.js +1 -0
  359. package/studio-dist/client/assets/rolldown-runtime-WkwZ5CU-.js +1 -0
  360. package/studio-dist/client/assets/routes-COm-G3mK.js +1 -0
  361. package/studio-dist/client/assets/skills-DmWAy-jZ.js +1 -0
  362. package/studio-dist/client/assets/specs-BG3Wi3ln.js +1 -0
  363. package/studio-dist/client/assets/steps-DFsH3Neu.js +1 -0
  364. package/studio-dist/client/assets/terminal-eU5fzQzv.css +1 -0
  365. package/studio-dist/client/assets/vault-B2q1nBY5.js +1 -0
  366. package/studio-dist/client/assets/warnings-BSXIyuSQ.js +1 -0
  367. package/studio-dist/client/assets/wasm-inline-C2en61B5.js +1 -0
  368. package/studio-dist/client/assets/workflow-DlsQD6Hc.js +1 -0
  369. package/studio-dist/server/assets/__23tanstack-start-server-fn-resolver-M2GBs8s3.js +4051 -0
  370. package/studio-dist/server/assets/_tanstack-start-manifest_v.js +95 -0
  371. package/studio-dist/server/assets/actions-Bvgj9eb8.js +54 -0
  372. package/studio-dist/server/assets/actions-D8erOphH.js +44 -0
  373. package/studio-dist/server/assets/button-CIJqAhni.js +11929 -0
  374. package/studio-dist/server/assets/companion-view-DISASvdJ.js +39 -0
  375. package/studio-dist/server/assets/companions-BYbHWKOZ.js +15 -0
  376. package/studio-dist/server/assets/createServerFn-F5sAOF8V.js +459 -0
  377. package/studio-dist/server/assets/createServerRpc-tK2lE9R2.js +11 -0
  378. package/studio-dist/server/assets/delivery-path-C29fBynY.js +654 -0
  379. package/studio-dist/server/assets/dist-DpJWKyCm.js +5582 -0
  380. package/studio-dist/server/assets/empty-plugin-adapters-Cipd4ZH4.js +4 -0
  381. package/studio-dist/server/assets/factory-DGPmNGbo.js +69 -0
  382. package/studio-dist/server/assets/factory-DUTa0eDs.js +2172 -0
  383. package/studio-dist/server/assets/markdown-view-Bn7xPdks.js +86 -0
  384. package/studio-dist/server/assets/model-PyPALjii.js +18 -0
  385. package/studio-dist/server/assets/panel-3Jmn4awF.js +169 -0
  386. package/studio-dist/server/assets/prepaint-DJfTQ_VH.js +45 -0
  387. package/studio-dist/server/assets/react-Ce6dj15C.js +46 -0
  388. package/studio-dist/server/assets/reports-C06RXVE2.js +18 -0
  389. package/studio-dist/server/assets/reports-D6YMqhnO.js +142 -0
  390. package/studio-dist/server/assets/rolldown-runtime-DYf_mQCB.js +34 -0
  391. package/studio-dist/server/assets/router-C8MGqlAY.js +13713 -0
  392. package/studio-dist/server/assets/routes-BcFgvqf7.js +622 -0
  393. package/studio-dist/server/assets/search-JAKurDNh.js +36 -0
  394. package/studio-dist/server/assets/shell-DS3wUexh.js +52 -0
  395. package/studio-dist/server/assets/skills-BEnOxiDl.js +266 -0
  396. package/studio-dist/server/assets/skills-CtrBAtX3.js +28 -0
  397. package/studio-dist/server/assets/specs-C8rv34-5.js +211 -0
  398. package/studio-dist/server/assets/start-h3ICWwd2.js +36 -0
  399. package/studio-dist/server/assets/steps-Dq_CwY_s.js +181 -0
  400. package/studio-dist/server/assets/studio-BeltxxKt.js +216 -0
  401. package/studio-dist/server/assets/utils-C9CX1kcy.js +221 -0
  402. package/studio-dist/server/assets/vault-BmWnryh3.js +85 -0
  403. package/studio-dist/server/assets/vault-Fvxt2Tzl.js +1032 -0
  404. package/studio-dist/server/assets/views-BgYa-za2.js +80 -0
  405. package/studio-dist/server/assets/warnings-DzR6fyZh.js +23 -0
  406. package/studio-dist/server/assets/wasm-inline-CNeBKGwC.js +3 -0
  407. package/studio-dist/server/assets/workflow-liRYecHk.js +73 -0
  408. package/studio-dist/server/server.js +16066 -0
  409. package/wrappers/bin/graphify +52 -4
  410. package/wrappers/bin/openspec +33 -9
  411. package/wrappers/lib/graphify-gate.mjs +8 -0
  412. package/src/cli/commands/studio/views/client.ts +0 -654
  413. package/src/cli/commands/studio/views/companion-picker.tsx +0 -95
  414. package/src/cli/commands/studio/views/companion-selector.tsx +0 -94
  415. package/src/cli/commands/studio/views/dashboard/changes.tsx +0 -107
  416. package/src/cli/commands/studio/views/dashboard/index.tsx +0 -19
  417. package/src/cli/commands/studio/views/document.tsx +0 -842
  418. package/src/cli/commands/studio/views/error.tsx +0 -20
  419. package/src/cli/commands/studio/views/reports/index.tsx +0 -49
  420. package/src/cli/commands/studio/views/selection-fields.tsx +0 -14
  421. package/src/cli/commands/studio/views/skills/index.tsx +0 -87
  422. package/src/cli/commands/studio/views/specs/index.tsx +0 -157
  423. package/src/cli/commands/studio/views/styles.ts +0 -519
  424. package/src/cli/commands/studio/views/terminal.tsx +0 -484
  425. package/src/cli/commands/studio/views/vault/state.ts +0 -43
  426. package/src/cli/commands/studio/views/warnings.tsx +0 -21
  427. package/src/cli/commands/studio/views/workflow/index.tsx +0 -21
  428. package/src/cli/commands/studio/views/workflow/steps.ts +0 -337
  429. package/src/cli/commands/studio/views/workflow/transcript.tsx +0 -190
  430. package/src/lib/components/theme.ts +0 -2
  431. package/src/tools/setup/git-utils.ts +0 -30
  432. package/src/tools/setup/runtime-documents.ts +0 -291
@@ -1,18 +1,21 @@
1
1
  name: mate-openspec-conventions
2
- version: 1
2
+ version: 2
3
3
  description: Shared scope, frontmatter, delta, and canonical-spec rules for Mate schemas.
4
+ # Each top-level key is one section; a stage reads the sections its instruction names.
4
5
  rules: |
5
- - Every change artifact MUST name at least one paired repository and area in its frontmatter scopes list.
6
- - Repository identity comes from the Git remote. Normalize SSH and HTTPS forms such as git@github.com:org/repository.git and https://github.com/org/repository.git to org/repository.
6
+ - Every change artifact MUST name at least one paired repository and area in its scopes list: a delta spec in its mate:delta comment, every other change artifact in its frontmatter.
7
+ - Repository identity comes from the Git remote: its full path on the host, without host, credentials, or .git. Normalize SSH and HTTPS forms such as git@github.com:org/repository.git and https://github.com/org/repository.git to org/repository; keep every nested group, so git@gitlab.example.com:group/subgroup/repository.git becomes group/subgroup/repository.
7
8
  - In a monorepo, an Area is the owning workspace or package root: the directory containing the nearest package manifest (package.json, Cargo.toml, go.mod, and similar). A non-monorepo may use the exact affected path and uses . only when the repository root is affected.
8
9
  - Do not use a local checkout basename, internal repository ID, synthetic Area, or N/A as durable metadata.
9
10
  - Preserve each repository/Area pair. Never use separate repositories and areas arrays.
10
11
  - Default a new capability to one owning package root. Use one capability per repository when a change crosses repositories. A capability spec names exactly one repository, although a change may name several.
11
- - Area identity comes only from frontmatter. Capability and change folder names are descriptive and have no scope authority.
12
- - A delta lives at openspec/changes/<name>/specs/<capability>/spec.md.
13
- - A canonical spec lives at openspec/specs/<capability>/spec.md. The archive command merges delta requirement blocks into this durable file.
12
+ - Area identity comes only from frontmatter or a delta's mate:delta comment. Capability and change folder names are descriptive and have no scope authority.
13
+ spec_rules: |
14
+ - A delta lives at openspec/changes/<name>/specs/<capability>/spec.md. It starts with a mate:delta comment, never YAML frontmatter, and holds nothing but blank lines and at most one # title line between that comment and its first ## section; openspec validate --strict reports any other text there.
14
15
  - OpenSpec parses only ## ADDED Requirements, ## MODIFIED Requirements, ## REMOVED Requirements, and ## RENAMED Requirements. Every parsed requirement starts with ### Requirement:. Do not substitute User Stories in these headers.
15
- - Every requirement MUST carry an Area marker whose values appear in the delta frontmatter. This survives archive, which copies requirement blocks but discards delta frontmatter.
16
+ - Every requirement MUST carry an Area marker whose values appear in the delta's mate:delta comment. This survives archive, which copies requirement blocks but discards the mate:delta comment.
17
+ canonical_rules: |
18
+ - A canonical spec lives at openspec/specs/<capability>/spec.md. The archive command merges delta requirement blocks into this durable file.
16
19
  - A canonical spec uses flat frontmatter: type: spec, capability, scalar repository, areas list, and tags: [openspec/spec]. It MUST NOT retain a nested scopes list or delta-only change and delta tags.
17
20
  - To project a delta, all its scope entries MUST name the same repository. Emit that repository as the canonical scalar and distinct Areas as areas in their original order. If repositories differ, split the capability before archive.
18
21
  verification: |
@@ -20,16 +23,19 @@ verification: |
20
23
  - mate-react-doctor: when writing tasks, end the task list of every Area whose tasks change React code (components, hooks, or other .tsx/.jsx modules) with one verification task, numbered like its neighbours, for example `- [ ] N.M Verify React changes with React Doctor [skill:mate-react-doctor]`. Areas whose tasks do not change React code get no verification task.
21
24
  - During apply, a tagged verification task is worked like any other task by invoking its skill.
22
25
  - Before reporting a change complete, check every Area that changed React code: if its tagged verification task is already checked, do nothing more; otherwise invoke the skill once for that Area.
23
- example_delta_frontmatter: |
24
- ---
25
- type: delta-spec
26
+ skill_tagging: |
27
+ A task's `[skill:<name>]` tag names only a skill installed in the Companion Repository, so every session runs the task the same way.
28
+ - Before tagging, check that the Companion Repository has `<name>/SKILL.md` under `.claude/skills/` or `.agents/skills/`.
29
+ - Never tag user-global, plugin (`<plugin>:<skill>`), or built-in skills, even when the current session offers them.
30
+ - When no companion skill applies, leave the task untagged.
31
+ example_delta_metadata: |
32
+ <!-- mate:delta
26
33
  change: <change-name>
27
34
  capability: <capability>
28
- tags: [openspec/change, openspec/spec, openspec/delta]
29
35
  scopes:
30
36
  - repository: org/repository
31
37
  area: .
32
- ---
38
+ -->
33
39
  notes:
34
- - "Change frontmatter uses paired scopes. Canonical frontmatter uses flat repository and areas scalars instead."
35
- - "Do not add a ## Scopes body section; frontmatter is the only source of scope identity."
40
+ - "Change frontmatter and the delta mate:delta comment use paired scopes. Canonical frontmatter uses flat repository and areas scalars instead."
41
+ - "Do not add a ## Scopes body section; frontmatter and the mate:delta comment are the only sources of scope identity."
@@ -0,0 +1,40 @@
1
+ # Third-Party Notices
2
+
3
+ The following files contain workflow text from OpenSpec 1.15.0
4
+ (https://github.com/Fission-AI/OpenSpec), with command references rewritten to
5
+ the matching Mate skills:
6
+
7
+ - `claude/mate-explore-change/references/openspec-explore.md`
8
+ - `claude/mate-propose-change/references/openspec-propose.md`
9
+ - `claude/mate-apply-change/references/openspec-apply-change.md`
10
+ - `claude/mate-propose-change/references/openspec-update-change.md`
11
+ - `agents/mate-explore-change/references/openspec-explore.md`
12
+ - `agents/mate-propose-change/references/openspec-propose.md`
13
+ - `agents/mate-apply-change/references/openspec-apply-change.md`
14
+ - `agents/mate-propose-change/references/openspec-update-change.md`
15
+
16
+ OpenSpec is distributed under this license:
17
+
18
+ ```text
19
+ MIT License
20
+
21
+ Copyright (c) 2024 OpenSpec Contributors
22
+
23
+ Permission is hereby granted, free of charge, to any person obtaining a copy
24
+ of this software and associated documentation files (the "Software"), to deal
25
+ in the Software without restriction, including without limitation the rights
26
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
27
+ copies of the Software, and to permit persons to whom the Software is
28
+ furnished to do so, subject to the following conditions:
29
+
30
+ The above copyright notice and this permission notice shall be included in all
31
+ copies or substantial portions of the Software.
32
+
33
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
36
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
37
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
38
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
39
+ SOFTWARE.
40
+ ```
@@ -0,0 +1,162 @@
1
+ ---
2
+ name: mate-apply-change
3
+ description: Implement a change on a recorded delivery branch, offering workset/<workset-id> instead of a protected branch. Builds on the OpenSpec apply workflow. Use when the user wants to implement, apply, or continue implementing a reviewed change.
4
+ allowed-tools: Bash(mate:*), Bash(openspec:*), Bash(git:*)
5
+ license: MIT
6
+ compatibility: Requires the mate CLI and the openspec capability enabled.
7
+ metadata:
8
+ author: mate
9
+ version: "1.0"
10
+ ---
11
+
12
+ # Mate Apply Change
13
+
14
+ The Apply change stage of the Delivery Path. Before any code changes, it records the
15
+ Working Repository branch the change is delivered through, so archive and publication
16
+ later know which merge to wait for. Then it runs the OpenSpec apply workflow.
17
+
18
+ ## Step 1: Read the branch and the record
19
+
20
+ In the Working Repository, read local Git state only:
21
+
22
+ ```bash
23
+ git symbolic-ref --quiet --short HEAD # current branch; fails when detached
24
+ git symbolic-ref --quiet --short refs/remotes/origin/HEAD # repository's default branch
25
+ ```
26
+
27
+ The repository's default branch (`origin/HEAD`, e.g. `main`) is not the link result's
28
+ `defaultBranch`, which is the change's resolved delivery branch (e.g. `workset/<id>`).
29
+
30
+ Read the change's existing record without changing it:
31
+
32
+ ```bash
33
+ mate artifact link "<change-name>" --json
34
+ ```
35
+
36
+ ## Step 2: Settle the delivery branch
37
+
38
+ Read `defaultBranch`, `inheritedFrom`, `diagnostics`, `ticketFormat`, and
39
+ `ticketCandidate` from the link result. `defaultBranch` is the change's resolved
40
+ delivery branch, never the repository's default branch. Report every diagnostic;
41
+ never derive a default from a change or Workset name. `defaultBranch: null` means ask
42
+ for a branch name, not infer one. When `inheritedFrom` is not empty, `defaultBranch` is
43
+ the open branch of those `dependsOn` changes: say this change continues on it.
44
+ Preserve recorded branches after membership changes;
45
+ a mismatch is informational, and relinking requires explicit user confirmation.
46
+
47
+ A branch is **protected** when it is the repository's default branch or matches a configured
48
+ protected pattern; `mate artifact link` refuses a
49
+ protected branch unless it is recorded as a direct delivery. Mate never asks the forge,
50
+ so a branch only the forge protects looks unprotected; hence the menu below.
51
+
52
+ - **A branch is already recorded** and it is the current branch → continue. When the
53
+ current branch differs, warn, name both branches, and ask before implementing
54
+ whether to switch to the recorded branch or record the current one.
55
+ - **On `defaultBranch`** → record it without asking:
56
+ `mate artifact link "<change-name>" --branch "<defaultBranch>" --json`.
57
+ - **Detached HEAD** → ask for the branch name, then record it.
58
+ - **On a fresh ticket branch** (only with `ticketFormat` `jira`): nothing is recorded,
59
+ the current branch is not protected, `ticketCandidate` is set, and
60
+ `git rev-list --count origin/HEAD..HEAD` is `0` → record it without asking
61
+ (`mate artifact link "<change-name>" --branch "<current>" --json`) and say in one line
62
+ that the change uses it with ticket `<ticketCandidate>`.
63
+ - **On any other branch**, protected or not → do not implement there yet. First name
64
+ every local commit that is not on the remote (`git log --oneline HEAD --not --remotes`)
65
+ and leave them where they are; never move, reset, or rebase them. On another
66
+ Workset's `workset/<id>` branch, name that Workset. Then offer one menu; option 1 is
67
+ recommended, except option 3 when the current branch is not protected and
68
+ `ticketCandidate` is set:
69
+ 1. **Create or switch to `defaultBranch`**: check local and `origin`
70
+ refs; `git switch "<defaultBranch>"` when local,
71
+ `git switch --track -c "<defaultBranch>" "origin/<defaultBranch>"` when remote-only.
72
+ Otherwise the branch is new: record it first with
73
+ `mate artifact link "<change-name>" --ticket "<KEY>" --json` when a ticket was given
74
+ (below), else with `--branch "<defaultBranch>"`, then `git switch -c` the branch its
75
+ record now names. Uncommitted edits carry over. Record an existing branch after
76
+ switching. When `defaultBranch` is null, ask for a name instead; do not offer an
77
+ inferred branch.
78
+ 2. **Create a worktree** (only when `defaultBranch` is set): say uncommitted edits stay
79
+ in this checkout, run `mate working worktree --change "<change-name>" --enter --json`,
80
+ adding `--ticket "<KEY>"` when a ticket was given (below);
81
+ it records the branch. When `enter.action` is `tool`, say an approval prompt may
82
+ follow (Claude Code asks), call the tool `enter.tool` with `enter.path`, then say
83
+ `enter.path` is now the Working Repository and continue at Step 3 there. On `handoff`
84
+ or a declined move, report `enter.reason` and any warnings, write no code, and
85
+ stop. `## Next steps`: name each `repositories[].path`, open a new session in this
86
+ repository's worktree, run `/mate-apply-change <change-name>` there. On failure,
87
+ report its diagnostics and offer the other options again.
88
+ 3. **Use the current branch** (only when it is not protected): record it.
89
+ 4. **Use or create another branch**: the user names it. Record it first with
90
+ `mate artifact link "<change-name>" --branch "<name>" --json`; only after that
91
+ succeeds, check local and `origin` refs: `git switch "<name>"` when local,
92
+ `git switch --track -c "<name>" "origin/<name>"` when remote-only, otherwise
93
+ `git switch -c "<name>"` from the current `HEAD`, so a refused name leaves no branch.
94
+ Uncommitted edits carry over. With `jira`, the menu hints to put the key in the name
95
+ (`feature/ABC-123-acme-retry`); a named branch carries its ticket only in its name,
96
+ so never pass `--ticket` for it. When the name holds no Jira key, say in one line
97
+ that no ticket is tracked, and continue.
98
+ 5. **Work directly here** (protected branch only) — only when the user explicitly chooses it.
99
+ Record it as a direct delivery:
100
+ `mate artifact link "<change-name>" --branch "<branch>" --direct --json`.
101
+
102
+ **Tickets** exist only when `ticketFormat` is `jira`; otherwise never ask for, offer, or
103
+ mention one. A ticket only names a new branch; it is stored nowhere else. With `jira`,
104
+ when nothing is recorded or inherited and `defaultBranch` exists neither locally nor on
105
+ `origin`, options 1 and 2 accept an optional Jira key in the same answer: say so in the
106
+ menu (`1 ABC-123` names the new branch after the ticket; `1` alone creates it without
107
+ one). Option 4 takes no key in the answer; its name carries it. Never ask a separate
108
+ ticket question. An agent without a person to ask passes no
109
+ ticket. On a refused key, name the expected format and ask once more.
110
+
111
+ Record the branch before writing any code. When `mate artifact link` refuses, report
112
+ its message and ask; never work around it.
113
+
114
+ When its result lists `warnings`, a `dependsOn` change is not implemented yet, so this
115
+ change would be built without the code it builds on. Report each warning and ask
116
+ whether to apply the dependency first or continue here. A dependency that is
117
+ implemented but unarchived is no such warning; it only affects archive order.
118
+
119
+ ## Step 3: Apply
120
+
121
+ Read [references/openspec-apply-change.md](references/openspec-apply-change.md) and
122
+ follow it for the implementation. The PR need not exist yet; the branch is the delivery.
123
+ Retrieve its instructions the ordinary way. Only when the user explicitly asks for compact
124
+ apply, also read [references/mate-compact-apply.md](references/mate-compact-apply.md) and
125
+ use its transport.
126
+
127
+ ## Step 4: Hand off
128
+
129
+ End the response with a final `## Next steps` section: numbered required actions in
130
+ execution order, with exact commands and known change names, prerequisites first.
131
+ Summaries, evidence, warnings, optional work, and deferred context go above it; nothing
132
+ follows it. Listing an action never invokes it. Never offer the user an optional command, in or above the section; optional work appears above it only as a skill invocation labelled optional.
133
+
134
+ **Skill invocation.** Skill invocations here use `/name`, the syntax of Claude Code
135
+ and Cursor and the fallback. When the current runtime uses another syntax, swap only
136
+ the prefix: `@name` in OpenCode, `$name` in Codex, `/skill:name` in Pi. Only the
137
+ user's statement or the harness's own identity sets the runtime, never a skill's
138
+ folder or an older example. Arguments, commands, paths, and order stay, and naming
139
+ never invokes.
140
+
141
+ - Above the section, label `/mate-show-me` and `/mate-simplify-code` as optional, in
142
+ any order; they are not prerequisites for archive.
143
+ - In the section, list `/mate-archive-change <change-name>`, after any required work
144
+ still open (a failing check, an unanswered question). Name the archive action only
145
+ there: omit the reference's completion sentence that also points to
146
+ `/mate-archive-change`.
147
+ - Several changes on one branch: list their archives in dependency order, and say above
148
+ the section that this order avoids an advisory archive warning; it is not a gate.
149
+
150
+ ```text
151
+ Optional, any order: /mate-show-me acme-queue, /mate-simplify-code.
152
+
153
+ ## Next steps
154
+ 1. /mate-archive-change acme-queue
155
+ ```
156
+
157
+ ## Guardrails
158
+
159
+ - Never push, open a PR, or merge on the user's behalf.
160
+ - Never record a protected branch except as an explicit direct delivery.
161
+ - The forge token, when one is used by `mate artifact link`, is never printed or
162
+ written; do not read or echo `MATE_GIT_TOKEN`.
@@ -0,0 +1,47 @@
1
+ # Mate Compact Apply Transport
2
+
3
+ Use this only when the user explicitly asks for compact apply. It replaces one thing in
4
+ the apply workflow: how its instructions are retrieved. Every other step, check, and
5
+ stop of [openspec-apply-change.md](openspec-apply-change.md) still applies. This is a
6
+ Mate transport, not native OpenSpec delta support.
7
+
8
+ ## Retrieval
9
+
10
+ Wherever the workflow runs `openspec instructions apply --change "<name>" --json`, run
11
+ instead:
12
+
13
+ ```bash
14
+ mate artifact apply-context "<name>" --json [--since <digest>]
15
+ ```
16
+
17
+ Each call fetches fresh upstream instructions. It returns one of two version 1
18
+ envelopes:
19
+
20
+ - `{"version": 1, "mode": "full", "digest", "payload"}`: `payload` is the complete
21
+ upstream apply object. Treat it exactly as the apply instructions output, read every
22
+ `contextFiles` path again, and make it your baseline, replacing any earlier one. A
23
+ `null` digest (with a `limitation`) means compaction is unavailable: keep calling
24
+ without `--since`.
25
+ - `{"version": 1, "mode": "compact", "digest", "state", "progress", "taskStates"}`:
26
+ nothing static changed since the baseline. The current object is the baseline with
27
+ `state` and `progress` replaced and each task's `done` taken from `taskStates`, which
28
+ lists every task in order.
29
+
30
+ A failing command is a failure, never a cached success: report it and stop, or fall back
31
+ to the ordinary command.
32
+
33
+ ## When to pass `--since`
34
+
35
+ Pass `--since <digest>` only when the complete full envelope with that digest is in this
36
+ conversation. Omit it, and reread the required context before any edit, on session
37
+ start, after resume or context compaction, or whenever you are unsure the baseline is
38
+ complete. A digest in a summary is not a baseline.
39
+
40
+ ## Unchanged obligations
41
+
42
+ - After each task, check its box at its current `sourcePath` and `line`, then fetch
43
+ again and confirm the task is done and progress changed.
44
+ - `state: "blocked"` in either envelope stops implementation; follow the blocked-state
45
+ steps.
46
+ - A full envelope after a compact one means context changed: reread it before continuing.
47
+ - When you cannot meet any of these, switch back to the ordinary command.
@@ -0,0 +1,200 @@
1
+ <!-- Vendored from OpenSpec 1.15.0: the `openspec-apply-change` workflow its `agents` tool generates.
2
+ Copyright (c) OpenSpec Contributors, MIT License (see THIRD-PARTY-NOTICES.md in Mate).
3
+ Regenerated by `bun run vendor:openspec`; do not edit. -->
4
+
5
+ > **Skill invocation:** `/mate-*` invocations below use the fallback `/name` syntax. For another established runtime, swap only the prefix per **Skill invocation** in this skill's `SKILL.md`.
6
+
7
+ Implement tasks from an OpenSpec change.
8
+
9
+ **Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
10
+
11
+ **Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
12
+
13
+ One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
14
+
15
+ Otherwise, with no root, what happens next depends on how this workflow was reached:
16
+
17
+ - **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
18
+ - **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
19
+
20
+ In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
21
+
22
+ **Input**: Optionally specify a change name (e.g., `/mate-apply-change add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
23
+
24
+ **Steps**
25
+
26
+ 1. **Select the change**
27
+
28
+ If a name is provided, use it. Otherwise:
29
+ - Infer from conversation context if the user mentioned a change
30
+ - Auto-select if only one active change exists
31
+ - If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
32
+
33
+ Always announce: "Using change: <name>" and how to override (e.g., `/mate-apply-change <other>`).
34
+
35
+ 2. **Check status to understand the schema**
36
+ ```bash
37
+ openspec status --change "<name>" --json
38
+ ```
39
+ Parse the JSON to understand:
40
+ - `schemaName`: The workflow being used (e.g., "spec-driven")
41
+ - `planningHome`, `changeRoot`, and `actionContext`: planning scope and edit constraints
42
+ - Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
43
+
44
+ 3. **Get apply instructions**
45
+
46
+ ```bash
47
+ openspec instructions apply --change "<name>" --json
48
+ ```
49
+
50
+ This returns:
51
+ - `contextFiles`: artifact ID -> array of concrete file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
52
+ - Progress (total, complete, remaining)
53
+ - Task list with status, source path, and source line
54
+ - Dynamic instruction based on current state
55
+ - Optional `context`: current required project instruction input from the selected root
56
+ - Optional `operationGuidance`: current advisory guidance for apply
57
+ - `missingArtifacts` (when present): required artifact ids with no output
58
+
59
+ **Handle states:**
60
+ - If `state: "blocked"`: show the message and pause implementation.
61
+ - If `missingArtifacts` is non-empty: suggest completing the missing artifacts. Run `openspec status --change "<name>" --json`, select the next `ready` artifact (not `skipped` or `blocked`), and use `openspec instructions "<artifact-id>" --change "<name>" --json` for its rules and template. Keep the selected `--store <id>` on both commands.
62
+ - Otherwise, follow the CLI instruction to create or repair the schema-configured tracking file from existing planning artifacts. Do not assume another artifact is ready or start implementation while blocked.
63
+ - If `state: "all_done"`: report that all tracked tasks are complete and suggest review or verification as appropriate before archiving
64
+ - Otherwise: proceed to implementation
65
+
66
+ Treat `context` as a required prompt-level input. Read and consider it, and
67
+ apply relevant project facts, conventions, and constraints while implementing.
68
+ Treat `operationGuidance` as optional additive advice. Read and consider every
69
+ entry, and follow entries that are applicable and compatible with the built-in
70
+ workflow.
71
+
72
+ Keep both fields separate from CLI-returned state, missing artifacts, tasks,
73
+ progress, `contextFiles`, and the built-in `instruction`. They are not
74
+ evidence of task completion, do not replace the built-in instruction, and do
75
+ not permit bypassing a blocked state. If context conflicts with the built-in
76
+ instruction, an explicit user choice, or a CLI-controlled value, report the
77
+ conflict and preserve the controlling value. If guidance is inapplicable or
78
+ conflicts with those controlling inputs, do not follow it and explain why.
79
+ These are prompt-level behavior contracts, not enforceable checks.
80
+
81
+ 4. **Read context files**
82
+
83
+ Read every file path listed under `contextFiles` from the apply instructions output.
84
+ The files depend on the schema being used:
85
+ - **spec-driven**: proposal, specs, design, tasks
86
+ - Other schemas: follow the contextFiles from CLI output
87
+
88
+ Do not copy `context` or `operationGuidance` verbatim into implementation
89
+ files or planning artifacts unless the user separately asks for that content.
90
+
91
+ 5. **Show current progress**
92
+
93
+ Display:
94
+ - Schema being used
95
+ - Progress: "N/M tasks complete"
96
+ - Remaining tasks overview
97
+ - Dynamic instruction from CLI
98
+
99
+ 6. **Implement tasks (loop until done or blocked)**
100
+
101
+ For each pending task:
102
+ - Show which task is being worked on
103
+ - Make the code changes required
104
+ - Keep changes minimal and focused
105
+ - Before editing, confirm the checkbox at the returned `sourcePath` and `line` still matches the task description; if it does not, rerun the apply instructions and use the refreshed location
106
+ - Mark the task complete at its returned `sourcePath` and `line`: `- [ ]` → `- [x]`
107
+ - Rerun the apply instructions and confirm that task is now done and progress changed
108
+ - Continue to next task
109
+
110
+ **Pause if:**
111
+ - Task is unclear → ask for clarification
112
+ - Implementation reveals a design issue → suggest updating artifacts
113
+ - A task needs work beyond what the spec and tasks describe, or you are tempted to drop, narrow, defer, or accept exceptions to specified behavior to make it fit → surface the added scope and ask; do not absorb it silently
114
+ - Error or blocker encountered → report and wait for guidance
115
+ - User interrupts
116
+
117
+ 7. **On completion or pause, show status**
118
+
119
+ Display:
120
+ - Tasks completed this session
121
+ - Overall progress: "N/M tasks complete"
122
+ - If all done: report that tracked tasks are complete and suggest review or verification as appropriate before archiving
123
+ - If paused: explain why and wait for guidance
124
+
125
+ **Output During Implementation**
126
+
127
+ ```
128
+ ## Implementing: <change-name> (schema: <schema-name>)
129
+
130
+ Working on task 3/7: <task description>
131
+ [...implementation happening...]
132
+ ✓ Task complete
133
+
134
+ Working on task 4/7: <task description>
135
+ [...implementation happening...]
136
+ ✓ Task complete
137
+ ```
138
+
139
+ **Output On Completion**
140
+
141
+ ```
142
+ ## Implementation Complete
143
+
144
+ **Change:** <change-name>
145
+ **Schema:** <schema-name>
146
+ **Progress:** 7/7 tasks complete ✓
147
+
148
+ ### Completed This Session
149
+ - [x] Task 1
150
+ - [x] Task 2
151
+ ...
152
+
153
+ All tracked tasks are complete. Review or verify the change as appropriate
154
+ before archiving. You can archive this change with `/mate-archive-change`.
155
+ ```
156
+
157
+ **Output On Pause (Issue Encountered)**
158
+
159
+ ```
160
+ ## Implementation Paused
161
+
162
+ **Change:** <change-name>
163
+ **Schema:** <schema-name>
164
+ **Progress:** 4/7 tasks complete
165
+
166
+ ### Issue Encountered
167
+ <description of the issue>
168
+
169
+ **Options:**
170
+ 1. <option 1>
171
+ 2. <option 2>
172
+ 3. Other approach
173
+
174
+ What would you like to do?
175
+ ```
176
+
177
+ **Guardrails**
178
+ - Keep going through tasks until done or blocked
179
+ - Always read context files before starting (from the apply instructions output)
180
+ - If task is ambiguous, pause and ask before implementing
181
+ - If implementation reveals issues, pause and suggest artifact updates
182
+ - Keep code changes minimal and scoped to each task
183
+ - Update task checkbox immediately after completing each task
184
+ - Pause on errors, blockers, or unclear requirements - don't guess
185
+ - When a task needs work beyond what the spec describes, surface the added scope and pause - never silently narrow, defer, or simplify away specified behavior
186
+ - Only mark a task `- [x]` when its specified behavior is fully implemented, not when it is partially done or deferred
187
+ - Use contextFiles from CLI output, don't assume specific file names
188
+ - Use each task's sourcePath and line to update its exact checkbox
189
+ - Do not use context or operation guidance as proof that a task is complete
190
+ - Apply relevant project context; report conflicts with controlling workflow inputs
191
+ - Consider every guidance entry; explain any inapplicable or conflicting advice
192
+ - Do not copy runtime context or operation guidance into implementation files or planning artifacts
193
+ - Preserve CLI-controlled blocked/ready/all-done behavior and completion criteria
194
+
195
+ **Fluid Workflow Integration**
196
+
197
+ This skill supports the "actions on a change" model:
198
+
199
+ - **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
200
+ - **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly
@@ -0,0 +1,81 @@
1
+ ---
2
+ name: mate-archive-change
3
+ description: Archive a change through mate artifact archive, which records its delivery, reports merge state and its warnings, and runs the OpenSpec archive, also before the merge. Use when the user wants to archive, finalize, or close out an implemented change.
4
+ allowed-tools: Bash(mate:*), Bash(git:*)
5
+ license: MIT
6
+ compatibility: Requires the mate CLI and the openspec capability enabled.
7
+ metadata:
8
+ author: mate
9
+ version: "1.0"
10
+ ---
11
+
12
+ # Mate Archive Change
13
+
14
+ The Archive change stage of the Delivery Path. Archiving applies the change's delta
15
+ specs to the local canonical specs, so a feature's later changes build on it. It is
16
+ allowed **before** the delivery branch merges: publication, not archive, waits for the
17
+ merge. Archiving is local and uncommitted; it publishes nothing.
18
+
19
+ ## Steps
20
+
21
+ 1. **Archive.**
22
+
23
+ ```bash
24
+ mate artifact archive "<change-name>" --json
25
+ ```
26
+
27
+ Run it from the companion or the linked Working Repository. It shows warnings,
28
+ refreshes merge state from the forge when a token is available, writes the change's
29
+ `delivery.yaml`, and runs `openspec archive` itself. Do not run `openspec archive`
30
+ separately.
31
+
32
+ 2. **Answer a missing branch.** When the result's `status` is `needs-branch`, nothing
33
+ was archived. Ask the user which branch delivers the change, suggesting
34
+ `suggestedBranch` when it is set, and re-run with exactly one of:
35
+
36
+ - `--branch "<branch>"` — a protected branch only with `--direct`, after the user
37
+ explicitly confirms a direct delivery;
38
+ - `--not-applicable "<reason>"` — for a specification-only change;
39
+ - `--skip-branch` — when the user skips the question; publication will ask again.
40
+
41
+ 3. **Report.** Relay every entry of `warnings` first: another active change that
42
+ modifies the same requirement, a declared dependency that is not archived yet, or
43
+ planning artifacts its schema requires that are missing (`incomplete-planning`).
44
+ Warnings never block. Then report the archive `path` and the delivery: each branch
45
+ with its merge result and source (`forge`, `git`, or `user`) and PR link, or the
46
+ not-applicable reason. An open or unknown merge is information, not a failure and not an
47
+ action: never offer to record it (`mate artifact link … --confirm-*`); publication asks
48
+ the merge question; a `likely-merged` outcome is only a suggestion that publication
49
+ confirms with the user.
50
+
51
+ 4. **Hand off.**
52
+ End the response with a final `## Next steps` section: numbered required actions in
53
+ execution order, with exact commands and known change names, prerequisites first.
54
+ Summaries, evidence, warnings, optional work, and deferred context go above it; nothing
55
+ follows it. Listing an action never invokes it. Never offer the user an optional command, in or above the section; optional work appears above it only as a skill invocation labelled optional.
56
+
57
+ **Skill invocation.** Skill invocations here use `/name`, the syntax of Claude Code
58
+ and Cursor and the fallback. When the current runtime uses another syntax, swap only
59
+ the prefix: `@name` in OpenCode, `$name` in Codex, `/skill:name` in Pi. Only the
60
+ user's statement or the harness's own identity sets the runtime, never a skill's
61
+ folder or an older example. Arguments, commands, paths, and order stay, and naming
62
+ never invokes.
63
+
64
+ When the delivery branch is not merged yet, list merging it before
65
+ `/mate-publish-artifact`, and say above the section that publication, not archive,
66
+ waits for the merge. Never commit, push, open a PR, or merge for the user.
67
+
68
+ ```text
69
+ ## Next steps
70
+ 1. Merge workset/acme-queue
71
+ 2. /mate-publish-artifact
72
+ ```
73
+
74
+ When `status` is `failed`, report the message (typically incomplete tasks or a
75
+ validation error) and stop.
76
+
77
+ ## Guardrails
78
+
79
+ - Never commit, tag, or push; publication is `mate-publish-artifact`.
80
+ - A merger account is provenance, never an artifact review.
81
+ - Do not read or echo `MATE_GIT_TOKEN`.
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: mate-openspec-backfill
2
+ name: mate-backfill-spec
3
3
  description: Reverse-engineer an OpenSpec spec for one existing feature and write it directly to the canonical spec, ready to publish. Use when the user wants to backfill, document, or spec existing or legacy behavior that has no spec yet.
4
4
  allowed-tools: Bash(openspec:*), Bash(mate:*), Bash(git remote:*), Bash(git diff:*)
5
5
  license: MIT
@@ -11,7 +11,7 @@ metadata:
11
11
 
12
12
  # Mate OpenSpec Backfill
13
13
 
14
- Specify one feature that already exists in the working repository. A backfill records behavior that already shipped, so the run writes the canonical spec `openspec/specs/<capability>/spec.md` directly and leaves it uncommitted. It never creates a change and never publishes; publication happens afterwards through `mate-artifact-publish`.
14
+ Specify one feature that already exists in the working repository. A backfill records behavior that already shipped, so the run writes the canonical spec `openspec/specs/<capability>/spec.md` directly and leaves it uncommitted. It never creates a change and never publishes; publication happens afterwards through `mate-publish-artifact`.
15
15
 
16
16
  ## Scope rules
17
17
 
@@ -70,12 +70,19 @@ Specify one feature that already exists in the working repository. A backfill re
70
70
 
71
71
  Fix every reported error and re-validate until it passes. Do not hand off a spec that fails validation.
72
72
 
73
- 8. **Hand off.** Report the written path and show the uncommitted diff (`git diff -- openspec/specs/<capability>/`, or the file itself when it is new). Point the user to `mate-artifact-publish`: the spec appears there under **Drifted specs** and can be published on its own or with the rest.
73
+ 8. **Hand off.** Report the written path and show the uncommitted diff (`git diff -- openspec/specs/<capability>/`, or the file itself when it is new). Point the user to `/mate-publish-artifact`: the spec appears there under **Drifted specs** and can be published on its own or with the rest.
74
+
75
+ **Skill invocation.** Skill invocations here use `/name`, the syntax of Claude Code
76
+ and Cursor and the fallback. When the current runtime uses another syntax, swap only
77
+ the prefix: `@name` in OpenCode, `$name` in Codex, `/skill:name` in Pi. Only the
78
+ user's statement or the harness's own identity sets the runtime, never a skill's
79
+ folder or an older example. Arguments, commands, paths, and order stay, and naming
80
+ never invokes.
74
81
 
75
82
  ## Guardrails
76
83
 
77
84
  - Never create an OpenSpec change, change artifacts, or verification tasks, and never archive.
78
- - Never commit, tag, push, or publish — never run `mate artifact publish`. Publication belongs to `mate-artifact-publish`.
85
+ - Never commit, tag, push, or publish — never run `mate artifact publish`. Publication belongs to `mate-publish-artifact`.
79
86
  - Never write any file before the user approves the review table.
80
87
  - Never write a requirement without a citation in the review table, and never spec a suspected bug without the user's ruling.
81
88
  - Never write citations or evidence tags into the canonical spec.