@uniqbit/mate-core 1.0.0-canary.3 → 1.0.0-canary.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (483) hide show
  1. package/claude-capability-plugins/companion-mentions/.claude-plugin/plugin.json +1 -1
  2. package/claude-capability-plugins/companion-mentions/hooks/register.ts +1 -1
  3. package/claude-plugin/hooks/hooks.json +61 -1
  4. package/claude-plugin/hooks/rtk-worktree-git.mjs +58 -0
  5. package/claude-plugin/hooks/session-attention.mjs +10 -0
  6. package/claude-plugin/hooks/session-end.mjs +9 -0
  7. package/claude-plugin/hooks/session-guidance.mjs +1 -1
  8. package/claude-plugin/hooks/workflow-turn.mjs +68 -0
  9. package/opencode-plugin/src/companion.ts +6 -0
  10. package/opencode-plugin/src/server.ts +46 -4
  11. package/package.json +5 -2
  12. package/src/cli/commands/artifact/apply-context.ts +1 -0
  13. package/src/cli/commands/artifact/artifact.ts +16 -0
  14. package/src/cli/commands/artifact/delivery/archive.ts +37 -112
  15. package/src/cli/commands/artifact/delivery/branch-flags.ts +19 -1
  16. package/src/cli/commands/artifact/delivery/environment.ts +32 -72
  17. package/src/cli/commands/artifact/delivery/link.ts +69 -33
  18. package/src/cli/commands/artifact/delivery/output.ts +34 -5
  19. package/src/cli/commands/artifact/delivery/resolve.ts +101 -0
  20. package/src/cli/commands/artifact/delivery/submit.ts +164 -0
  21. package/src/cli/commands/artifact/delivery/take.ts +45 -0
  22. package/src/cli/commands/artifact/extract-repo-name.ts +1 -1
  23. package/src/cli/commands/artifact/finish/command.ts +455 -43
  24. package/src/cli/commands/artifact/finish/engine.ts +79 -61
  25. package/src/cli/commands/artifact/finish/finisher.ts +5 -12
  26. package/src/cli/commands/artifact/finish/git.ts +9 -10
  27. package/src/cli/commands/artifact/finish/openspec.ts +22 -177
  28. package/src/cli/commands/artifact/finish/secret-scan.ts +5 -43
  29. package/src/cli/commands/artifact/finish/worktree-cleanup.ts +57 -7
  30. package/src/cli/commands/artifact/pending/command.ts +119 -6
  31. package/src/cli/commands/artifact/pending/discovery.ts +7 -11
  32. package/src/cli/commands/artifact/project/command.ts +60 -0
  33. package/src/cli/commands/companion/companion.ts +1 -1
  34. package/src/cli/commands/companion/link.ts +36 -4
  35. package/src/cli/commands/companion/list.ts +70 -14
  36. package/src/cli/commands/companion/open.ts +40 -12
  37. package/src/cli/commands/companion/sync.ts +18 -0
  38. package/src/cli/commands/companion/update.ts +4 -19
  39. package/src/cli/commands/doctor.ts +122 -0
  40. package/src/cli/commands/install.ts +48 -36
  41. package/src/cli/commands/launch/claude.ts +2 -0
  42. package/src/cli/commands/launch/shared.ts +33 -6
  43. package/src/cli/commands/plugin/install.ts +27 -11
  44. package/src/cli/commands/report/index.ts +180 -184
  45. package/src/cli/commands/report/markdown.ts +67 -72
  46. package/src/cli/commands/session/prepare.ts +32 -4
  47. package/src/cli/commands/session/registry.ts +90 -0
  48. package/src/cli/commands/shared/companion-selection.ts +3 -1
  49. package/src/cli/commands/studio/access.ts +6 -14
  50. package/src/cli/commands/studio/areas.ts +112 -33
  51. package/src/cli/commands/studio/companion-add.ts +72 -0
  52. package/src/cli/commands/studio/companion-removal.ts +86 -0
  53. package/src/cli/commands/studio/graph-model.ts +61 -0
  54. package/src/cli/commands/studio/graph.ts +336 -0
  55. package/src/cli/commands/studio/index.ts +4 -4
  56. package/src/{lib/factory/outcomes/sessions.ts → cli/commands/studio/live-sessions.ts} +26 -2
  57. package/src/cli/commands/studio/mate-inventory.ts +1 -1
  58. package/src/cli/commands/studio/payload.ts +223 -30
  59. package/src/cli/commands/studio/reports.ts +19 -18
  60. package/src/cli/commands/studio/routes.ts +5 -18
  61. package/src/cli/commands/studio/selection.ts +12 -5
  62. package/src/cli/commands/studio/server.ts +321 -198
  63. package/src/cli/commands/studio/service-host.ts +266 -0
  64. package/src/cli/commands/studio/services.ts +54 -16
  65. package/src/cli/commands/studio/skill-files.ts +133 -0
  66. package/src/cli/commands/studio/studio-app.ts +1 -0
  67. package/src/cli/commands/studio/terminal.ts +45 -3
  68. package/src/cli/commands/studio/vault.ts +259 -84
  69. package/src/cli/commands/studio/views/model.ts +1 -14
  70. package/src/cli/commands/studio/views/vault/markdown-tree.ts +343 -10
  71. package/src/cli/commands/unwrap.ts +11 -0
  72. package/src/cli/commands/update.ts +28 -8
  73. package/src/cli/commands/vscode/release-vsix.json +4 -0
  74. package/src/cli/commands/vscode/setup.ts +213 -0
  75. package/src/cli/commands/vscode/vsix.ts +114 -0
  76. package/src/cli/commands/workflow/workflow.ts +516 -0
  77. package/src/cli/commands/working/cleanup.ts +73 -17
  78. package/src/cli/commands/working/worktree.ts +227 -36
  79. package/src/cli/commands/wrap.ts +33 -7
  80. package/src/cli/main.ts +48 -12
  81. package/src/cli/repo-list-table.tsx +73 -37
  82. package/src/cli/usage.ts +25 -9
  83. package/src/factory-host.ts +69 -0
  84. package/src/hooks/companion-instructions.ts +35 -16
  85. package/src/hooks/hook-io.ts +18 -1
  86. package/src/hooks/rtk-worktree-git.ts +48 -0
  87. package/src/hooks/session-banner.ts +30 -3
  88. package/src/hooks/session-end.ts +10 -0
  89. package/src/hooks/session-guidance.ts +10 -6
  90. package/src/hooks/session-prepare.ts +47 -31
  91. package/src/hooks/session-register.ts +199 -0
  92. package/src/hooks/tokensave-route.ts +7 -3
  93. package/src/hooks/validate-artifact-path.ts +53 -14
  94. package/src/hooks/workflow-turn.ts +219 -0
  95. package/src/lib/apply-context/fingerprint.ts +2 -1
  96. package/src/lib/apply-context/protocol.ts +2 -2
  97. package/src/lib/artifact-trailer.ts +27 -0
  98. package/src/lib/change-layout.ts +83 -38
  99. package/src/lib/delivery/branch-template.ts +114 -0
  100. package/src/lib/delivery/branches.ts +34 -14
  101. package/src/lib/delivery/checkout.ts +103 -0
  102. package/src/lib/delivery/environment.ts +131 -7
  103. package/src/lib/delivery/merge-git.ts +282 -26
  104. package/src/lib/delivery/overlap.ts +68 -16
  105. package/src/lib/delivery/record-delivery.ts +253 -57
  106. package/src/lib/delivery/record.ts +229 -53
  107. package/src/lib/delivery/refresh.ts +222 -141
  108. package/src/lib/delivery/remote.ts +66 -0
  109. package/src/lib/delivery/repository-access.ts +19 -60
  110. package/src/lib/delivery/resolve-branch.ts +318 -50
  111. package/src/lib/delivery/stages.ts +83 -50
  112. package/src/lib/delivery/staging/apply-chain.ts +164 -0
  113. package/src/lib/delivery/staging/artifact-type.ts +101 -0
  114. package/src/lib/delivery/staging/declared-type.ts +277 -0
  115. package/src/lib/delivery/staging/naming.ts +64 -0
  116. package/src/lib/delivery/staging/openspec-type.ts +135 -0
  117. package/src/lib/delivery/staging/pending-edit.ts +291 -0
  118. package/src/lib/delivery/staging/pending.ts +780 -0
  119. package/src/lib/delivery/staging/project.ts +373 -0
  120. package/src/lib/delivery/staging/publish.ts +1024 -0
  121. package/src/lib/delivery/staging/refs.ts +258 -0
  122. package/src/lib/delivery/staging/registry.ts +73 -0
  123. package/src/lib/delivery/staging/replay.ts +308 -0
  124. package/src/lib/delivery/staging/requirement-blocks.ts +10 -0
  125. package/src/lib/delivery/staging/resolve.ts +264 -0
  126. package/src/lib/delivery/staging/settle-linked.ts +290 -0
  127. package/src/lib/delivery/staging/submit.ts +929 -0
  128. package/src/lib/delivery/staging/worktree.ts +130 -0
  129. package/src/lib/delivery/submit-change.ts +443 -0
  130. package/src/lib/git-key.ts +15 -0
  131. package/src/lib/install.ts +2 -0
  132. package/src/lib/opencode-server.ts +238 -0
  133. package/src/lib/openspec-canonical-frontmatter.ts +159 -0
  134. package/src/lib/orchestrator/adapters/base.ts +31 -20
  135. package/src/lib/orchestrator/adapters/claude.ts +162 -4
  136. package/src/lib/orchestrator/adapters/opencode.ts +55 -2
  137. package/src/lib/orchestrator/checkout-adoption.ts +125 -0
  138. package/src/lib/orchestrator/companion-git-sync.ts +152 -16
  139. package/src/lib/orchestrator/companion-hub.ts +6 -1
  140. package/src/lib/orchestrator/companion-registry-store.ts +6 -2
  141. package/src/lib/orchestrator/editor.ts +2 -2
  142. package/src/lib/orchestrator/engine-floor.ts +48 -0
  143. package/src/lib/orchestrator/framework-context.ts +41 -15
  144. package/src/lib/orchestrator/global-config-store.ts +11 -0
  145. package/src/lib/orchestrator/launcher.ts +49 -3
  146. package/src/lib/orchestrator/projection-claude-commands.ts +2 -2
  147. package/src/lib/orchestrator/projection-claude-entry.ts +42 -21
  148. package/src/lib/orchestrator/projection-claude-links.ts +83 -11
  149. package/src/lib/orchestrator/projection-claude-skills.ts +30 -4
  150. package/src/lib/orchestrator/projection-companion-link.ts +12 -1
  151. package/src/lib/orchestrator/projection-entries.ts +22 -18
  152. package/src/lib/orchestrator/projection-opencode-copies.ts +65 -21
  153. package/src/lib/orchestrator/projection-runtime-documents.ts +66 -43
  154. package/src/lib/orchestrator/projection-types.ts +28 -1
  155. package/src/lib/orchestrator/refresh-working-claude-links.ts +4 -1
  156. package/src/lib/orchestrator/registry-checkouts.ts +177 -0
  157. package/src/lib/orchestrator/repository-link.ts +216 -57
  158. package/src/lib/orchestrator/serving-claude-wrap.ts +43 -0
  159. package/src/lib/orchestrator/session-context-link.ts +11 -5
  160. package/src/lib/orchestrator/session-prepare.ts +53 -8
  161. package/src/lib/orchestrator/setup-compatibilities.ts +1 -1
  162. package/src/lib/orchestrator/types.ts +9 -0
  163. package/src/lib/orchestrator/umbrella-checkouts.ts +102 -0
  164. package/src/lib/orchestrator/working-repo-projection.ts +24 -4
  165. package/src/lib/orchestrator/workspace-inventory.ts +5 -1
  166. package/src/lib/orchestrator/wrap-pass.ts +1 -0
  167. package/src/lib/prebuilt-workspace-prepare.ts +2 -1
  168. package/src/lib/prebuilt-workspace.ts +1 -0
  169. package/src/lib/public-npm.ts +105 -43
  170. package/src/lib/session-attribution.ts +52 -0
  171. package/src/lib/session-state.ts +356 -0
  172. package/src/lib/session-stop.ts +64 -0
  173. package/src/lib/update-checker.ts +7 -1
  174. package/src/lib/usage/aggregate.ts +202 -0
  175. package/src/lib/usage/cache.ts +87 -0
  176. package/src/lib/usage/claude-pricing.ts +71 -0
  177. package/src/lib/usage/claude.ts +189 -0
  178. package/src/lib/usage/collect.ts +56 -0
  179. package/src/lib/usage/opencode.ts +188 -0
  180. package/src/lib/usage/records.ts +80 -0
  181. package/src/lib/usage/rtk-database.ts +72 -0
  182. package/src/lib/usage/savings.ts +209 -0
  183. package/src/lib/usage/scope.ts +182 -0
  184. package/src/lib/usage/source.ts +102 -0
  185. package/src/lib/usage/types.ts +143 -0
  186. package/src/lib/usage/window.ts +37 -0
  187. package/src/lib/workflow/declaration.ts +6 -0
  188. package/src/lib/workflow/handoff.ts +90 -0
  189. package/src/lib/workflow/hook-trust.ts +108 -0
  190. package/src/lib/workflow/position.ts +524 -0
  191. package/src/lib/workflow/report.ts +79 -0
  192. package/src/lib/workflow/work.ts +106 -0
  193. package/src/lib/workset/factory-local.ts +157 -0
  194. package/src/lib/workset/record.ts +45 -11
  195. package/src/lib/workset/repositories.ts +118 -25
  196. package/src/lib/workset/stage.ts +4 -2
  197. package/src/lib/workset/stages.ts +64 -4
  198. package/src/lib/workset/worktree-include.ts +161 -0
  199. package/src/lib/workset/worktree-index.ts +6 -2
  200. package/src/lib/workset/worktree.ts +665 -89
  201. package/src/opencode/background-server.ts +145 -0
  202. package/src/opencode/companion-hooks.ts +55 -14
  203. package/src/opencode/companion-policy.ts +20 -7
  204. package/src/opencode/enter-worktree.ts +254 -6
  205. package/src/opencode/projected-guidance.ts +7 -3
  206. package/src/opencode/session-register.ts +176 -0
  207. package/src/opencode/turn-hook.ts +241 -0
  208. package/src/playbooks/companion-guidance.ts +6 -3
  209. package/src/plugin-api.ts +42 -0
  210. package/src/runtime/artifact-trailers.ts +63 -0
  211. package/src/runtime/claude-bg-isolation.ts +138 -0
  212. package/src/runtime/claude-delivery-plan.ts +14 -3
  213. package/src/runtime/claude-hook-group.ts +2 -0
  214. package/src/runtime/companion-git-state.ts +155 -10
  215. package/src/runtime/companion-git.ts +96 -13
  216. package/src/runtime/companion-guidance.ts +107 -8
  217. package/src/runtime/companion-instructions.ts +1 -1
  218. package/src/runtime/companion-sync.ts +109 -21
  219. package/src/runtime/current-branch.ts +24 -0
  220. package/src/runtime/entered-worktree.ts +24 -0
  221. package/src/runtime/env-names.ts +2 -2
  222. package/src/runtime/env.ts +16 -9
  223. package/src/runtime/forge-remote.ts +48 -0
  224. package/src/runtime/git-layout.ts +185 -24
  225. package/src/runtime/git-tracked.ts +60 -0
  226. package/src/runtime/json-fields.ts +8 -0
  227. package/src/runtime/launch-env-guard.ts +65 -0
  228. package/src/runtime/opencode-server-record.ts +136 -0
  229. package/src/runtime/pending-records.ts +533 -0
  230. package/src/runtime/projected-guidance.ts +6 -2
  231. package/src/runtime/projection.ts +40 -6
  232. package/src/runtime/publication-secret-scan.ts +45 -0
  233. package/src/runtime/repo-destination.ts +72 -0
  234. package/src/runtime/repo-local.ts +29 -2
  235. package/src/runtime/rtk-git-guard.ts +66 -0
  236. package/src/runtime/runtime-document-manifest.ts +229 -19
  237. package/src/runtime/runtime-document-manifest.typecheck.ts +10 -0
  238. package/src/runtime/secret-guard.ts +9 -2
  239. package/src/runtime/secret-patterns.ts +3 -2
  240. package/src/runtime/secret-policy-weakening.ts +122 -0
  241. package/src/runtime/serving-claude-wrap.ts +41 -0
  242. package/src/runtime/session-context.ts +4 -3
  243. package/src/runtime/session-registry.ts +434 -0
  244. package/src/runtime/skill-prefix.ts +75 -0
  245. package/src/runtime/submitted-arrivals.ts +547 -0
  246. package/src/runtime/tokensave-route.ts +10 -5
  247. package/src/runtime/turn-state.d.mts +14 -0
  248. package/src/runtime/turn-state.mjs +93 -0
  249. package/src/runtime/umbrella-children.ts +52 -0
  250. package/src/runtime/umbrella-folder.ts +84 -0
  251. package/src/runtime/workflow/change-folders.ts +66 -0
  252. package/src/runtime/workflow/declaration.ts +720 -0
  253. package/src/runtime/workflow/globs.ts +85 -0
  254. package/src/runtime/workflow/next-handoff-process.ts +98 -0
  255. package/src/runtime/workflow/turn.ts +309 -0
  256. package/src/runtime/workflow/workflow.ts +262 -0
  257. package/src/runtime/wrap-state.ts +36 -13
  258. package/src/studio.ts +73 -19
  259. package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/schema.yaml +3 -3
  260. package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/templates/design.md +1 -1
  261. package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/templates/proposal.md +1 -1
  262. package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/templates/tasks.md +1 -1
  263. package/src/templates/capabilities/openspec-cap/mate-minimal/schema.yaml +3 -3
  264. package/src/templates/mate-skills/agents/mate-apply-change/SKILL.md +147 -46
  265. package/src/templates/mate-skills/agents/mate-apply-change/references/openspec-apply-change.md +1 -1
  266. package/src/templates/mate-skills/agents/mate-archive-change/SKILL.md +7 -75
  267. package/src/templates/mate-skills/agents/mate-clarify-intent/SKILL.md +13 -7
  268. package/src/templates/mate-skills/agents/mate-domain-modeling/SKILL.md +10 -0
  269. package/src/templates/mate-skills/agents/mate-explore-change/SKILL.md +46 -14
  270. package/src/templates/mate-skills/agents/mate-propose-change/SKILL.md +51 -38
  271. package/src/templates/mate-skills/agents/mate-propose-change/references/mate-revise.md +14 -10
  272. package/src/templates/mate-skills/agents/mate-propose-change/references/openspec-update-change.md +1 -1
  273. package/src/templates/mate-skills/agents/mate-publish-artifact/SKILL.md +113 -87
  274. package/src/templates/mate-skills/agents/mate-publish-artifact/references/openspec.md +111 -100
  275. package/src/templates/mate-skills/agents/mate-show-me/SKILL.md +11 -5
  276. package/src/templates/mate-skills/agents/mate-simplify-code/SKILL.md +16 -6
  277. package/src/templates/mate-skills/agents/mate-submit-change/SKILL.md +114 -0
  278. package/src/templates/mate-skills/claude/mate-apply-change/SKILL.md +147 -46
  279. package/src/templates/mate-skills/claude/mate-apply-change/references/openspec-apply-change.md +1 -1
  280. package/src/templates/mate-skills/claude/mate-archive-change/SKILL.md +7 -75
  281. package/src/templates/mate-skills/claude/mate-clarify-intent/SKILL.md +13 -7
  282. package/src/templates/mate-skills/claude/mate-domain-modeling/SKILL.md +10 -0
  283. package/src/templates/mate-skills/claude/mate-explore-change/SKILL.md +46 -14
  284. package/src/templates/mate-skills/claude/mate-propose-change/SKILL.md +51 -38
  285. package/src/templates/mate-skills/claude/mate-propose-change/references/mate-revise.md +14 -10
  286. package/src/templates/mate-skills/claude/mate-propose-change/references/openspec-update-change.md +1 -1
  287. package/src/templates/mate-skills/claude/mate-publish-artifact/SKILL.md +113 -87
  288. package/src/templates/mate-skills/claude/mate-publish-artifact/references/openspec.md +111 -100
  289. package/src/templates/mate-skills/claude/mate-show-me/SKILL.md +11 -5
  290. package/src/templates/mate-skills/claude/mate-simplify-code/SKILL.md +16 -6
  291. package/src/templates/mate-skills/claude/mate-submit-change/SKILL.md +114 -0
  292. package/src/templates/mate-skills/openspec-references.ts +3 -2
  293. package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +1301 -154
  294. package/src/tools/setup/capabilities/openspec.ts +54 -15
  295. package/src/tools/setup/capabilities/rtk.ts +98 -5
  296. package/src/tools/setup/capabilities/tokensave.ts +3 -2
  297. package/src/tools/setup/dynamic-plugins/api.ts +38 -0
  298. package/src/tools/setup/dynamic-plugins/audiences.ts +65 -21
  299. package/src/tools/setup/dynamic-plugins/frozen.ts +32 -13
  300. package/src/tools/setup/dynamic-plugins/host.ts +2 -32
  301. package/src/tools/setup/dynamic-plugins/hydrate.ts +8 -7
  302. package/src/tools/setup/dynamic-plugins/install.ts +24 -22
  303. package/src/tools/setup/dynamic-plugins/loader.ts +11 -7
  304. package/src/tools/setup/dynamic-plugins/paths.ts +30 -10
  305. package/src/tools/setup/dynamic-plugins/verify.ts +10 -7
  306. package/src/tools/setup/dynamic-plugins/workspaces.ts +153 -0
  307. package/src/tools/setup/engine.ts +20 -1
  308. package/src/tools/setup/mate.ts +5 -3
  309. package/src/tools/setup/package-managers/bun.ts +8 -8
  310. package/src/tools/setup/plugin.ts +9 -1
  311. package/src/tools/setup/plugins/gitignore.ts +15 -9
  312. package/src/tools/setup/plugins/guidance.ts +4 -2
  313. package/src/tools/setup/providers/claude-plugin-hooks.ts +56 -0
  314. package/src/tools/setup/providers/claude.ts +64 -7
  315. package/src/tools/setup/service-registry.ts +69 -0
  316. package/src/tools/setup/service.ts +233 -0
  317. package/src/tools/setup/utils.ts +28 -5
  318. package/src/tools/setup/working-repo-cleanup.ts +2 -2
  319. package/src/tools/setup/working-repo-local-state.ts +2 -0
  320. package/src/tools/setup.ts +25 -14
  321. package/studio-dist/client/assets/app-BFVyWHGo.css +2 -0
  322. package/studio-dist/client/assets/button-D6LrRkOG.js +1 -0
  323. package/studio-dist/client/assets/combobox-Dk2MMZWE.js +1 -0
  324. package/studio-dist/client/assets/companion-view-BVaZNtiI.js +1 -0
  325. package/studio-dist/client/assets/fields-D_FYhxQr.js +1 -0
  326. package/studio-dist/client/assets/getting-started-ByWRg7hC.js +1 -0
  327. package/studio-dist/client/assets/getting-started-DZSjYC-b.js +1 -0
  328. package/studio-dist/client/assets/getting-started._topic-C6OyQ4G6.js +1 -0
  329. package/studio-dist/client/assets/getting-started.index-BkmPHdEm.js +1 -0
  330. package/studio-dist/client/assets/graph-7jm2XzyL.js +2 -0
  331. package/studio-dist/client/assets/graph-canvas-DDuzsNSx.js +3242 -0
  332. package/studio-dist/client/assets/guides-D9VTjWXP.js +1 -0
  333. package/studio-dist/client/assets/index-BBmFpG4y.js +40 -0
  334. package/studio-dist/client/assets/jsx-runtime-MZURdZre.js +1 -0
  335. package/studio-dist/client/assets/markdown-view-RL5YvfZg.js +1 -0
  336. package/studio-dist/client/assets/panel-B8F8sOKQ.js +1 -0
  337. package/studio-dist/client/assets/plugins._service._view-CynxTbMx.js +1 -0
  338. package/studio-dist/client/assets/queries-axYk2u9L.js +1 -0
  339. package/studio-dist/client/assets/react-r45OnJCw.js +27 -0
  340. package/studio-dist/client/assets/reports-BCAyXh6p.js +1 -0
  341. package/studio-dist/client/assets/routes-BFPqq89E.js +1 -0
  342. package/studio-dist/client/assets/skills-DTks_uBx.js +1 -0
  343. package/studio-dist/client/assets/specs-DU1kqcp5.js +1 -0
  344. package/studio-dist/client/assets/specs-view-omrd_5P3.js +1 -0
  345. package/studio-dist/client/assets/steps-DhIFuAZy.js +1 -0
  346. package/studio-dist/client/assets/store-DJ5cncKA.js +1 -0
  347. package/studio-dist/client/assets/studio-BR9j15J0.js +100 -0
  348. package/studio-dist/client/assets/studio-queries-CFP_yTpr.js +2 -0
  349. package/studio-dist/client/assets/usage-CHmwtkoM.js +55 -0
  350. package/studio-dist/client/assets/useBaseQuery-BlC-AZ35.js +1 -0
  351. package/studio-dist/client/assets/useSelector-AYcH7lB0.js +2 -0
  352. package/studio-dist/client/assets/vault-DRg8MScm.js +1 -0
  353. package/studio-dist/client/assets/warnings-UHFy6HAp.js +1 -0
  354. package/studio-dist/client/assets/workflow-Bv9vSfVV.js +1 -0
  355. package/studio-dist/server/assets/__23tanstack-start-server-fn-resolver-DAbZ6fzY.js +106 -0
  356. package/studio-dist/server/assets/_tanstack-start-manifest_v.js +86 -31
  357. package/studio-dist/server/assets/button-BfoNadNR.js +8193 -0
  358. package/studio-dist/server/assets/combobox-oxUI6r4V.js +2089 -0
  359. package/studio-dist/server/assets/{companion-view-aBady57v.js → companion-view-DHUjPpA0.js} +13 -7
  360. package/studio-dist/server/assets/companions-kBrJZAd6.js +31 -0
  361. package/studio-dist/server/assets/{createServerRpc-tK2lE9R2.js → createServerRpc-bFKFpGFG.js} +1 -1
  362. package/studio-dist/server/assets/fields-BD_c65T1.js +1190 -0
  363. package/studio-dist/server/assets/getting-started-7P0oyWaM.js +67 -0
  364. package/studio-dist/server/assets/getting-started-B136TP57.js +4 -0
  365. package/studio-dist/server/assets/getting-started._topic-B1mV0kGz.js +13 -0
  366. package/studio-dist/server/assets/getting-started.index-CeGtvUsm.js +13 -0
  367. package/studio-dist/server/assets/graph-BWtmJOH2.js +16 -0
  368. package/studio-dist/server/assets/graph-DSDVEELZ.js +801 -0
  369. package/studio-dist/server/assets/graph-canvas-CID9Nksc.js +21066 -0
  370. package/studio-dist/server/assets/graph-wire-BdSUx0G5.js +58 -0
  371. package/studio-dist/server/assets/guides-BLJenHwQ.js +5 -0
  372. package/studio-dist/server/assets/guides-Bm3RbUB-.js +13 -0
  373. package/studio-dist/server/assets/guides.server-rHHqRuzV.js +66 -0
  374. package/studio-dist/server/assets/jsx-runtime-Bt0s0YKS.js +451 -0
  375. package/studio-dist/server/assets/markdown-view-D3v9x-cM.js +105 -0
  376. package/studio-dist/server/assets/panel-yqOl5GMU.js +169 -0
  377. package/studio-dist/server/assets/plugins._service._view-DwqJX7s9.js +92 -0
  378. package/studio-dist/server/assets/queries-DYmGrhNO.js +32 -0
  379. package/studio-dist/server/assets/react-BO0uMhpm.js +89 -0
  380. package/studio-dist/server/assets/redirect-BaZ_QyqF.js +39 -0
  381. package/studio-dist/server/assets/reports-7yaPz7aP.js +147 -0
  382. package/studio-dist/server/assets/reports-C4Y_Jd-x.js +18 -0
  383. package/studio-dist/server/assets/router-Dnoq5auE.js +12844 -0
  384. package/studio-dist/server/assets/routes-Cok4p3mK.js +768 -0
  385. package/studio-dist/server/assets/{search-JAKurDNh.js → search-DUK7Jl6f.js} +21 -2
  386. package/studio-dist/server/assets/{shell-CboT2f66.js → shell-DNVXedgE.js} +16 -6
  387. package/studio-dist/server/assets/skills-D8qdXSku.js +267 -0
  388. package/studio-dist/server/assets/skills-pKmuAs0F.js +28 -0
  389. package/studio-dist/server/assets/specs-DeHYUNFp.js +51 -0
  390. package/studio-dist/server/assets/specs-view-BGn-5Ik_.js +425 -0
  391. package/studio-dist/server/assets/{start-BW5ovN0k.js → start-h3ICWwd2.js} +4 -1
  392. package/studio-dist/server/assets/steps-CV7Yk7L7.js +224 -0
  393. package/studio-dist/server/assets/store-CWDGIp6x.js +280 -0
  394. package/studio-dist/server/assets/studio-CB94np48.js +10437 -0
  395. package/studio-dist/server/assets/studio-queries-BqZGBE70.js +1335 -0
  396. package/studio-dist/server/assets/usage-M6Gi6Km7.js +25584 -0
  397. package/studio-dist/server/assets/usage-j5jR9gX9.js +24 -0
  398. package/studio-dist/server/assets/{studio-queries-CLnP9kGu.js → useBaseQuery-Tv_QJt9r.js} +4 -1318
  399. package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-BQKuMdJW.js → useSelector-DUmCUXAs.js} +4 -498
  400. package/studio-dist/server/assets/vault-PqVmssmW.js +1035 -0
  401. package/studio-dist/server/assets/{vault-BGulVoNh.js → vault-lBlvSyD4.js} +19 -4
  402. package/studio-dist/server/assets/{views-Bd7cRr27.js → views-CsFp1i1G.js} +10 -9
  403. package/studio-dist/server/assets/warnings-BDs34j_m.js +24 -0
  404. package/studio-dist/server/assets/workflow-T0eEldsa.js +687 -0
  405. package/studio-dist/server/server.js +429 -9
  406. package/src/cli/commands/factory/factory.ts +0 -301
  407. package/src/cli/commands/report/collector.ts +0 -288
  408. package/src/cli/commands/studio/factory-credential.ts +0 -49
  409. package/src/cli/commands/studio/workset-session.ts +0 -131
  410. package/src/lib/delivery/archive-change.ts +0 -166
  411. package/src/lib/delivery/forge.ts +0 -279
  412. package/src/lib/delivery/token.ts +0 -24
  413. package/src/lib/factory/attach-client.ts +0 -113
  414. package/src/lib/factory/attach.ts +0 -178
  415. package/src/lib/factory/broker.ts +0 -190
  416. package/src/lib/factory/bun-commands.ts +0 -39
  417. package/src/lib/factory/client.ts +0 -92
  418. package/src/lib/factory/command.ts +0 -61
  419. package/src/lib/factory/credential-store.ts +0 -153
  420. package/src/lib/factory/frames.ts +0 -77
  421. package/src/lib/factory/ids.ts +0 -58
  422. package/src/lib/factory/outcomes/actions.ts +0 -114
  423. package/src/lib/factory/outcomes/index.ts +0 -381
  424. package/src/lib/factory/outcomes/lifecycle.ts +0 -205
  425. package/src/lib/factory/outcomes/runs.ts +0 -81
  426. package/src/lib/factory/prepare.ts +0 -49
  427. package/src/lib/factory/pty.ts +0 -103
  428. package/src/lib/factory/runner/companion-context.ts +0 -178
  429. package/src/lib/factory/runner/control.ts +0 -92
  430. package/src/lib/factory/runner/harness-agent.ts +0 -250
  431. package/src/lib/factory/runner/live.ts +0 -159
  432. package/src/lib/factory/runner/questions.ts +0 -22
  433. package/src/lib/factory/runner/rank.ts +0 -26
  434. package/src/lib/factory/runner/run-policy.ts +0 -12
  435. package/src/lib/factory/runner/run.ts +0 -199
  436. package/src/lib/factory/runner/scheduler.ts +0 -416
  437. package/src/lib/factory/runner/state.ts +0 -233
  438. package/src/lib/factory/runner/workflow.ts +0 -542
  439. package/src/lib/factory/runtime.ts +0 -972
  440. package/src/lib/factory/sandbox.ts +0 -292
  441. package/src/lib/factory/worktree-branch.ts +0 -17
  442. package/src/templates/capabilities/openspec-cap/mate-v1/templates/explore-brief.md +0 -25
  443. package/studio-dist/client/assets/companion-view-Csva26Ir.js +0 -1
  444. package/studio-dist/client/assets/delivery-path-DJMpRmiY.js +0 -1
  445. package/studio-dist/client/assets/factory-B7l9ZQyx.js +0 -4
  446. package/studio-dist/client/assets/index-n6uo_92S.js +0 -40
  447. package/studio-dist/client/assets/prepaint-CD5OpmTM.js +0 -24
  448. package/studio-dist/client/assets/queries-CN3JwMBX.js +0 -1
  449. package/studio-dist/client/assets/react-CabXf2Ds.js +0 -1
  450. package/studio-dist/client/assets/report-time-Dc-KOqQu.js +0 -1
  451. package/studio-dist/client/assets/reports-C01RsnMA.js +0 -1
  452. package/studio-dist/client/assets/rolldown-runtime-WkwZ5CU-.js +0 -1
  453. package/studio-dist/client/assets/routes-4pbC-2Hj.js +0 -1
  454. package/studio-dist/client/assets/skills-CihQganl.js +0 -1
  455. package/studio-dist/client/assets/spec-areas-C2L48N4C.js +0 -1
  456. package/studio-dist/client/assets/specs-D24_35_K.js +0 -1
  457. package/studio-dist/client/assets/studio-DKxfi691.css +0 -1
  458. package/studio-dist/client/assets/studio-queries-rvbJupCy.js +0 -3
  459. package/studio-dist/client/assets/vault-Bd4CQiTK.js +0 -1
  460. package/studio-dist/client/assets/warnings-V_Ys51wJ.js +0 -1
  461. package/studio-dist/client/assets/workflow-BJejeVwQ.js +0 -1
  462. package/studio-dist/server/assets/actions-Bvgj9eb8.js +0 -54
  463. package/studio-dist/server/assets/createServerFn-F5sAOF8V.js +0 -459
  464. package/studio-dist/server/assets/delivery-path-BkKNjgkf.js +0 -778
  465. package/studio-dist/server/assets/factory-D6xnjedJ.js +0 -2385
  466. package/studio-dist/server/assets/factory-DT3UzHlh.js +0 -68
  467. package/studio-dist/server/assets/prepaint-BMke0fo1.js +0 -41
  468. package/studio-dist/server/assets/queries-Ag2iL8q2.js +0 -107
  469. package/studio-dist/server/assets/react-COs0LHn-.js +0 -51
  470. package/studio-dist/server/assets/report-time-DAfzln-N.js +0 -8
  471. package/studio-dist/server/assets/reports-BnUNJVtx.js +0 -126
  472. package/studio-dist/server/assets/rolldown-runtime-DYf_mQCB.js +0 -34
  473. package/studio-dist/server/assets/router-BH--drIx.js +0 -4298
  474. package/studio-dist/server/assets/routes-khSDK1bV.js +0 -361
  475. package/studio-dist/server/assets/skills-MWYnWoKs.js +0 -106
  476. package/studio-dist/server/assets/spec-areas-DcnO6vW-.js +0 -16
  477. package/studio-dist/server/assets/specs-DE3w8hZP.js +0 -155
  478. package/studio-dist/server/assets/studio-BeltxxKt.js +0 -216
  479. package/studio-dist/server/assets/vault-CuyyhLyB.js +0 -832
  480. package/studio-dist/server/assets/warnings-BH05rOuG.js +0 -15
  481. package/studio-dist/server/assets/workflow-BSuIKWqH.js +0 -42
  482. /package/src/lib/{factory/keyed-serial.ts → keyed-serial.ts} +0 -0
  483. /package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/templates/spec.md +0 -0
@@ -1,6 +1,6 @@
1
1
  ---
2
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.
3
+ description: Implement a change on a recorded delivery branch, offering the Workset's Delivery Branch (default 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
4
  allowed-tools: Bash(mate:*), Bash(openspec:*), Bash(git:*)
5
5
  license: MIT
6
6
  compatibility: Requires the mate CLI and the openspec capability enabled.
@@ -12,75 +12,162 @@ metadata:
12
12
  # Mate Apply Change
13
13
 
14
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
15
+ Working Repository branch the change is delivered through, so submit and publication
16
16
  later know which merge to wait for. Then it runs the OpenSpec apply workflow.
17
17
 
18
+ **Selecting the change.** `openspec list` also names changes awaiting
19
+ publication. A change whose `openspec/changes/<name>/delivery.yaml` says
20
+ `state: submitted` is finished: when the user named no change, leave it out of
21
+ auto-selection and of the choices you offer, and never pick it because it is the only
22
+ one. Check only that `state` line. Apply one only when the user names it.
23
+
18
24
  ## Step 1: Read the branch and the record
19
25
 
20
26
  In the Working Repository, read local Git state only:
21
27
 
22
28
  ```bash
23
29
  git symbolic-ref --quiet --short HEAD # current branch; fails when detached
24
- git symbolic-ref --quiet --short refs/remotes/origin/HEAD # default branch
30
+ git symbolic-ref --quiet --short refs/remotes/origin/HEAD # repository's default branch
25
31
  ```
26
32
 
33
+ The repository's default branch (`origin/HEAD`, e.g. `main`) is not the link result's
34
+ `defaultBranch`, which is the change's resolved delivery branch (e.g. `workset/<id>` under the default branch template).
35
+
27
36
  Read the change's existing record without changing it:
28
37
 
29
38
  ```bash
30
39
  mate artifact link "<change-name>" --json
31
40
  ```
32
41
 
42
+ **Umbrella Repository.** When the Working Repository has no `.git` of its own and its
43
+ direct child folders are Git checkouts, it is an Umbrella Repository: settle the branch
44
+ per scoped child, then continue at Step 3. A scoped child is a child whose
45
+ `git -C <child> config --get remote.origin.url` names one of the change's scoped
46
+ repositories. Read each scoped child's branch with
47
+ `git -C <child> symbolic-ref --quiet --short HEAD`, and its record with
48
+ `mate artifact link "<change-name>" --repository "<org/repo>" --json`, whose recorded
49
+ branch and `defaultBranch` are that child's.
50
+
51
+ - **Every scoped child is on the recorded branch or `defaultBranch`** → ask nothing;
52
+ record it per child:
53
+ `mate artifact link "<change-name>" --repository "<org/repo>" --branch "<branch>" --json`.
54
+ - **Otherwise** → name each child's branch and its unpushed commits, then offer one menu
55
+ for all of them, with the same protected-branch and ticket rules as Step 2:
56
+ 1. **Create a worktree** (recommended): run
57
+ `mate working worktree --change "<change-name>" --enter --json`. It records every
58
+ child's branch and returns `enter.action` `handoff` with the mirrored worktree in
59
+ `enter.path`. Report `enter.reason`, write no code, and stop; `## Next steps`: open a
60
+ new session in `enter.path` and run `/mate-apply-change <change-name>` there.
61
+ 2. **Switch each child to `defaultBranch`** with `git -C <child>`, as Step 2's option 1
62
+ does, recording each with `--repository "<org/repo>"`.
63
+
33
64
  ## Step 2: Settle the delivery branch
34
65
 
35
- Read `defaultBranch`, `diagnostics`, `ticketFormat`, `ticketCandidate`, and
36
- `record.ticket` from the link result. Report every diagnostic;
66
+ Read `defaultBranch`, `inheritedFrom`, `diagnostics`, `ticketFormat`, and
67
+ `ticketCandidate` from the link result. `defaultBranch` is the change's resolved
68
+ delivery branch, never the repository's default branch. Report every diagnostic;
37
69
  never derive a default from a change or Workset name. `defaultBranch: null` means ask
38
- for a branch name, not infer one. Preserve recorded branches after membership changes;
70
+ for a branch name, not infer one. When `inheritedFrom` is not empty, `defaultBranch` is
71
+ the open branch of those `dependsOn` changes: say this change continues on it.
72
+ Preserve recorded branches after membership changes;
39
73
  a mismatch is informational, and relinking requires explicit user confirmation.
40
74
 
41
- A branch is **protected** when it is the default branch or matches a configured
75
+ A branch is **protected** when it is the repository's default branch or matches a configured
42
76
  protected pattern; `mate artifact link` refuses a
43
- protected branch unless it is recorded as a direct delivery. Mate never asks the forge,
44
- so a branch only the forge protects looks unprotected; hence the menu below.
77
+ protected branch unless it is recorded as a direct delivery. Mate never asks the Git host,
78
+ so a branch only the host protects looks unprotected; hence the menu below.
79
+
80
+ **Isolated session.** When the link result's `session.isolated` is `true` (a Claude
81
+ Code background session outside a linked worktree), Claude Code refuses writes here, so
82
+ this block overrides the rules below. Write nothing here; never switch branch in place
83
+ or offer a direct delivery. An Umbrella Repository keeps its Step 1 handoff.
84
+
85
+ - Where a rule below continues here without asking (the recorded branch is current, on
86
+ `defaultBranch`, a fresh ticket branch), record that branch when it is not recorded
87
+ yet, then run `mate working worktree --change "<change-name>" --take-branch --enter --json`.
88
+ A protected branch recorded as a direct delivery cannot move to a worktree: write
89
+ nothing, and ask the developer to continue the change in an interactive session (or
90
+ one the VS Code extension starts) in this checkout.
91
+ - Otherwise name every local commit not on the remote
92
+ (`git log --oneline HEAD --not --remotes`), say uncommitted edits stay in this
93
+ checkout, and offer only these worktree options; option 1 is recommended, except
94
+ option 2 when the current branch is not protected and `ticketCandidate` is set:
95
+ 1. **Create a worktree on `defaultBranch`**: option 2 below, with its ticket rule. When
96
+ `defaultBranch` is null and nothing is recorded, ask for a branch name and use
97
+ option 3 with it.
98
+ 2. **Use the current branch in a worktree** (only when it is not protected): record it
99
+ with `mate artifact link "<change-name>" --branch "<current>" --json`, then run
100
+ `mate working worktree --change "<change-name>" --take-branch --enter --json`.
101
+ 3. **Use another branch in a worktree**: the user names it, as in option 4 below.
102
+ Record it with `mate artifact link "<change-name>" --branch "<name>" --json` without
103
+ switching, then run `mate working worktree --change "<change-name>" --enter --json`.
104
+ - Follow `enter` as option 2 below says. When `mate working worktree` refuses because
105
+ this checkout has uncommitted changes to tracked files, report the paths it names,
106
+ write no code, and ask the developer to commit or stash them before answering again.
45
107
 
46
108
  - **A branch is already recorded** and it is the current branch → continue. When the
47
- current branch differs, warn, name both branches, and ask before implementing
48
- whether to switch to the recorded branch or record the current one.
109
+ current branch differs and `git worktree list --porcelain` shows the recorded branch
110
+ checked out in a linked worktree, run
111
+ `mate working worktree --change "<change-name>" --enter --json`, which reuses it, and
112
+ follow `enter` as in option 2 below. Otherwise, when the current branch differs, warn,
113
+ name both branches, and ask before implementing whether to switch to the recorded
114
+ branch or record the current one.
49
115
  - **On `defaultBranch`** → record it without asking:
50
116
  `mate artifact link "<change-name>" --branch "<defaultBranch>" --json`.
51
117
  - **Detached HEAD** → ask for the branch name, then record it.
118
+ - **On a fresh ticket branch** (only with `ticketFormat` `jira`): nothing is recorded,
119
+ the current branch is not protected, `ticketCandidate` is set, and
120
+ `git rev-list --count origin/HEAD..HEAD` is `0` → record it without asking
121
+ (`mate artifact link "<change-name>" --branch "<current>" --json`) and say in one line
122
+ that the change uses it with ticket `<ticketCandidate>`.
52
123
  - **On any other branch**, protected or not → do not implement there yet. First name
53
124
  every local commit that is not on the remote (`git log --oneline HEAD --not --remotes`)
54
125
  and leave them where they are; never move, reset, or rebase them. On another
55
- Workset's `workset/<id>` branch, name that Workset. Then offer one menu:
56
- 1. **Create or switch to `defaultBranch`** (recommended): check local and `origin`
126
+ Workset's Delivery Branch, name that Workset. Then offer one menu; option 1 is
127
+ recommended, except option 3 when the current branch is not protected and
128
+ `ticketCandidate` is set:
129
+ 1. **Create or switch to `defaultBranch`**: check local and `origin`
57
130
  refs; `git switch "<defaultBranch>"` when local,
58
- `git switch --track -c "<defaultBranch>" "origin/<defaultBranch>"` when remote-only,
59
- otherwise `git switch -c "<defaultBranch>"`. Uncommitted edits carry over. Record it.
60
- When `defaultBranch` is null, ask for a name instead; do not offer an inferred branch.
131
+ `git switch --track -c "<defaultBranch>" "origin/<defaultBranch>"` when remote-only.
132
+ Otherwise the branch is new: record it first with
133
+ `mate artifact link "<change-name>" --ticket "<KEY>" --json` when a ticket was given
134
+ (below), else with `--branch "<defaultBranch>"`, then `git switch -c` the branch its
135
+ record now names. Uncommitted edits carry over. Record an existing branch after
136
+ switching. When `defaultBranch` is null, ask for a name instead; do not offer an
137
+ inferred branch.
61
138
  2. **Create a worktree** (only when `defaultBranch` is set): say uncommitted edits stay
62
- in this checkout, run `mate working worktree --change "<change-name>" --enter --json`;
139
+ in this checkout, run `mate working worktree --change "<change-name>" --enter --json`,
140
+ adding `--ticket "<KEY>"` when a ticket was given (below);
63
141
  it records the branch. When `enter.action` is `tool`, say an approval prompt may
64
142
  follow (Claude Code asks), call the tool `enter.tool` with `enter.path`, then say
65
- `enter.path` is now the Working Repository and continue at Step 3 there. On `handoff`
143
+ `enter.path` is now the Working Repository and continue at Step 3 there, following
144
+ `enter.reason` when it is set (it says how to run git there). On `handoff`
66
145
  or a declined move, report `enter.reason` and any warnings, write no code, and
67
146
  stop. `## Next steps`: name each `repositories[].path`, open a new session in this
68
147
  repository's worktree, run `/mate-apply-change <change-name>` there. On failure,
69
148
  report its diagnostics and offer the other options again.
70
- 3. **Use the current branch** (only when it is not protected): record it. When
71
- `ticketCandidate` is set, offer it with and without recording that ticket
72
- (`--ticket "<ticketCandidate>"` on the same link call).
73
- 4. **Use another existing branch**: switch to the branch the user names and record it.
149
+ 3. **Use the current branch** (only when it is not protected): record it.
150
+ 4. **Use or create another branch**: the user names it. Record it first with
151
+ `mate artifact link "<change-name>" --branch "<name>" --json`; only after that
152
+ succeeds, check local and `origin` refs: `git switch "<name>"` when local,
153
+ `git switch --track -c "<name>" "origin/<name>"` when remote-only, otherwise
154
+ `git switch -c "<name>"` from the current `HEAD`, so a refused name leaves no branch.
155
+ Uncommitted edits carry over. With `jira`, the menu hints to put the key in the name
156
+ (`feature/ABC-123-acme-retry`); a named branch carries its ticket only in its name,
157
+ so never pass `--ticket` for it. When the name holds no Jira key, say in one line
158
+ that no ticket is tracked, and continue.
74
159
  5. **Work directly here** (protected branch only) — only when the user explicitly chooses it.
75
160
  Record it as a direct delivery:
76
161
  `mate artifact link "<change-name>" --branch "<branch>" --direct --json`.
77
162
 
78
163
  **Tickets** exist only when `ticketFormat` is `jira`; otherwise never ask for, offer, or
79
- mention one. With `jira` and no `record.ticket`, options 1 and 2 accept an optional Jira
80
- key in the answer (`1 ABC-123`). Record it first with
81
- `mate artifact link "<change-name>" --ticket "<KEY>" --json`, then read `defaultBranch`
82
- again with `mate artifact link "<change-name>" --json` before creating the branch or
83
- running the worktree command. On a refused key, name the expected format and ask once more.
164
+ mention one. A ticket only names a new branch; it is stored nowhere else. With `jira`,
165
+ when nothing is recorded or inherited and `defaultBranch` exists neither locally nor on
166
+ `origin`, options 1 and 2 accept an optional Jira key in the same answer: say so in the
167
+ menu (`1 ABC-123` names the new branch after the ticket; `1` alone creates it without
168
+ one). Option 4 takes no key in the answer; its name carries it. Never ask a separate
169
+ ticket question. An agent without a person to ask passes no
170
+ ticket. On a refused key, name the expected format and ask once more.
84
171
 
85
172
  Record the branch before writing any code. When `mate artifact link` refuses, report
86
173
  its message and ask; never work around it.
@@ -88,7 +175,16 @@ its message and ask; never work around it.
88
175
  When its result lists `warnings`, a `dependsOn` change is not implemented yet, so this
89
176
  change would be built without the code it builds on. Report each warning and ask
90
177
  whether to apply the dependency first or continue here. A dependency that is
91
- implemented but unarchived is no such warning; it only affects archive order.
178
+ implemented but unsubmitted is no such warning; it only affects submit order. A
179
+ submitted or locally active dependency counts as satisfied. For a change with
180
+ `dependsOn`, read the specs it builds on with `mate artifact project "<change-name>" --json`:
181
+ its requirements are not in the canonical specs until the chain is published.
182
+
183
+ **Earlier steps.** Run `mate workflow next "<change-name>"`. A step of an earlier
184
+ stage it names, as an action or counted, that the request or the user says ran: record
185
+ it with `mate workflow done <skill> "<change-name>"`; otherwise name it above the hand-off.
186
+ Being asked to apply settles what comes before it: a review or earlier step the command
187
+ names never stops this skill and is never recorded to get past it; continue at Step 3.
92
188
 
93
189
  ## Step 3: Apply
94
190
 
@@ -98,12 +194,24 @@ Retrieve its instructions the ordinary way. Only when the user explicitly asks f
98
194
  apply, also read [references/mate-compact-apply.md](references/mate-compact-apply.md) and
99
195
  use its transport.
100
196
 
101
- ## Step 4: Hand off
197
+ ## Step 4: Close the stage
102
198
 
103
- End the response with a final `## Next steps` section: numbered required actions in
104
- execution order, with exact commands and known change names, prerequisites first.
105
- Summaries, evidence, warnings, optional work, and deferred context go above it; nothing
106
- 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.
199
+ At the end of every run of this skill, also with tasks still open or after a blocker,
200
+ run:
201
+
202
+ ```bash
203
+ mate workflow done mate-apply-change "<change-name>"
204
+ ```
205
+
206
+ It prints the next actions for the change. End the response with a final `## Next steps`
207
+ section: numbered required actions in execution order, with exact commands and known
208
+ change names, prerequisites first: required work of this run that is still open, then
209
+ the actions the command printed, in its order. Summaries, evidence, warnings, optional
210
+ work, and deferred context go above it; nothing follows it. Listing an action never
211
+ invokes it. Never offer the user an optional command, in or above the section; optional
212
+ work appears above it only as a skill invocation labelled optional, as the command's
213
+ `optional:` line names it. If the command fails, report its problems and end without a
214
+ `Next steps` section.
107
215
 
108
216
  **Skill invocation.** Skill invocations here use `/name`, the syntax of Claude Code
109
217
  and Cursor and the fallback. When the current runtime uses another syntax, swap only
@@ -112,23 +220,16 @@ user's statement or the harness's own identity sets the runtime, never a skill's
112
220
  folder or an older example. Arguments, commands, paths, and order stay, and naming
113
221
  never invokes.
114
222
 
115
- - Above the section, label `/mate-show-me` and `/mate-simplify-code` as optional, in
116
- any order; they are not prerequisites for archive.
117
- - In the section, list `/mate-archive-change <change-name>`, after any required work
118
- still open (a failing check, an unanswered question).
119
- - Several changes on one branch: list their archives in dependency order, and say above
120
- the section that this order avoids an advisory archive warning; it is not a gate.
223
+ Add only this skill's own required actions to the section:
121
224
 
122
- ```text
123
- Optional, any order: /mate-show-me acme-queue, /mate-simplify-code.
225
+ - Required work still open (a failing check, an unanswered question) comes first.
226
+ - Several changes on one branch: run the command for each, list their actions in
227
+ dependency order, and say above the section that this order avoids an advisory submit
228
+ warning; it is not a gate.
124
229
 
125
- ## Next steps
126
- 1. /mate-archive-change acme-queue
127
- ```
230
+ Omit the reference's completion sentence.
128
231
 
129
232
  ## Guardrails
130
233
 
131
234
  - Never push, open a PR, or merge on the user's behalf.
132
235
  - Never record a protected branch except as an explicit direct delivery.
133
- - The forge token, when one is used by `mate artifact link`, is never printed or
134
- written; do not read or echo `MATE_GIT_TOKEN`.
@@ -151,7 +151,7 @@ Working on task 4/7: <task description>
151
151
  ...
152
152
 
153
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`.
154
+ before archiving. You can archive this change with `/mate-submit-change`.
155
155
  ```
156
156
 
157
157
  **Output On Pause (Issue Encountered)**
@@ -1,86 +1,18 @@
1
1
  ---
2
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.
3
+ description: Deprecated alias that forwards to mate-submit-change, since changes are now submitted before the merge and archived at publication. Use when the user asks to archive a change.
4
4
  allowed-tools: Bash(mate:*), Bash(git:*)
5
5
  license: MIT
6
6
  compatibility: Requires the mate CLI and the openspec capability enabled.
7
7
  metadata:
8
8
  author: mate
9
- version: "1.0"
9
+ version: "2.0"
10
10
  ---
11
11
 
12
12
  # Mate Archive Change
13
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
- Before re-running with a named branch, read `mate artifact link "<change-name>" --json`.
42
- Only when it reports `ticketFormat` `jira` and no `record.ticket`, and the branch name
43
- holds exactly one Jira key (`feature/ABC-123-retry`), offer to record that ticket first:
44
- `mate artifact link "<change-name>" --ticket "<KEY>" --json`.
45
-
46
- 3. **Report.** Relay every entry of `warnings` first: another active change that
47
- modifies the same requirement, a declared dependency that is not archived yet, or
48
- planning artifacts its schema requires that are missing (`incomplete-planning`).
49
- Warnings never block. Then report the archive `path` and the delivery: each branch
50
- with its merge result and source (`forge`, `git`, or `user`) and PR link, or the
51
- not-applicable reason. An open or unknown merge is information, not a failure and not an
52
- action: never offer to record it (`mate artifact link … --confirm-*`); publication asks
53
- the merge question; a `likely-merged` outcome is only a suggestion that publication
54
- confirms with the user.
55
-
56
- 4. **Hand off.**
57
- End the response with a final `## Next steps` section: numbered required actions in
58
- execution order, with exact commands and known change names, prerequisites first.
59
- Summaries, evidence, warnings, optional work, and deferred context go above it; nothing
60
- 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.
61
-
62
- **Skill invocation.** Skill invocations here use `/name`, the syntax of Claude Code
63
- and Cursor and the fallback. When the current runtime uses another syntax, swap only
64
- the prefix: `@name` in OpenCode, `$name` in Codex, `/skill:name` in Pi. Only the
65
- user's statement or the harness's own identity sets the runtime, never a skill's
66
- folder or an older example. Arguments, commands, paths, and order stay, and naming
67
- never invokes.
68
-
69
- When the delivery branch is not merged yet, list merging it before
70
- `/mate-publish-artifact`, and say above the section that publication, not archive,
71
- waits for the merge. Never commit, push, open a PR, or merge for the user.
72
-
73
- ```text
74
- ## Next steps
75
- 1. Merge workset/acme-queue
76
- 2. /mate-publish-artifact
77
- ```
78
-
79
- When `status` is `failed`, report the message (typically incomplete tasks or a
80
- validation error) and stop.
81
-
82
- ## Guardrails
83
-
84
- - Never commit, tag, or push; publication is `mate-publish-artifact`.
85
- - A merger account is provenance, never an artifact review.
86
- - Do not read or echo `MATE_GIT_TOKEN`.
14
+ Deprecated: archiving before the merge is replaced by the Submit change stage, and
15
+ publication archives. Say so in one line, then follow
16
+ [../mate-submit-change/SKILL.md](../mate-submit-change/SKILL.md) for the same change, from
17
+ its first step. `mate artifact archive` is a deprecated alias that only checks and
18
+ submits nothing; never run it.
@@ -85,16 +85,22 @@ Assumptions: <points explore should verify, or "none">
85
85
  Next: /mate-explore-change
86
86
  ```
87
87
 
88
- End the response with a final `## Next steps` section: numbered required actions in
89
- execution order, with exact commands and known change names, prerequisites first.
90
- Summaries, evidence, warnings, optional work, and deferred context go above it; nothing
91
- 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. For **skip**, the block is followed by:
88
+ After the block, at the end of every run of this skill, run:
92
89
 
93
- ```text
94
- ## Next steps
95
- 1. /mate-explore-change
90
+ ```bash
91
+ mate workflow done mate-clarify-intent
96
92
  ```
97
93
 
94
+ It prints the next actions for the change. End the response with a final `## Next steps`
95
+ section: numbered required actions in execution order, with exact commands and known
96
+ change names, prerequisites first: required work of this run that is still open, then
97
+ the actions the command printed, in its order. Summaries, evidence, warnings, optional
98
+ work, and deferred context go above it; nothing follows it. Listing an action never
99
+ invokes it. Never offer the user an optional command, in or above the section; optional
100
+ work appears above it only as a skill invocation labelled optional, as the command's
101
+ `optional:` line names it. If the command fails, report its problems and end without a
102
+ `Next steps` section.
103
+
98
104
  **Skill invocation.** Skill invocations here use `/name`, the syntax of Claude Code
99
105
  and Cursor and the fallback. When the current runtime uses another syntax, swap only
100
106
  the prefix: `@name` in OpenCode, `$name` in Codex, `/skill:name` in Pi. Only the
@@ -24,6 +24,16 @@ or decision.
24
24
  2. Resolve the primary Working Repository from its canonical Git remote or the
25
25
  explicit Mate repository attachment. Do not use a checkout basename as its
26
26
  identity.
27
+
28
+ **Umbrella Repository.** When the Working Repository has no `.git` of its own
29
+ and its direct child folders are Git checkouts, it is an Umbrella Repository:
30
+ each child is a Working Repository of its own. Take the children from the
31
+ session's `umbrella-children` block; without a list there, read each child's
32
+ identity with `git -C <child> config --get remote.origin.url`. Resolve the
33
+ child the topic concerns first, then continue with that child's identity and
34
+ load no context of the other children. When it is unclear which child the
35
+ topic concerns, ask the user before loading any context.
36
+
27
37
  3. Convert the canonical external repository ID to its filesystem key only for
28
38
  path lookup. For example, `acme/repo` maps to `acme_repo`. Keep the canonical
29
39
  ID authoritative, and use the same normalized key everywhere; do not guess
@@ -21,7 +21,14 @@ large for one change is suggested as several.
21
21
  [references/openspec-explore.md](references/openspec-explore.md) and follow it for the
22
22
  exploration itself. When a `PRE-EXPLORE HANDOFF` block is in this conversation, treat
23
23
  its Confirmed points as settled and start from its Unresolved questions and
24
- Assumptions.
24
+ Assumptions. `openspec list` also names changes awaiting publication: a change whose `openspec/changes/<name>/delivery.yaml` says
25
+ `state: submitted` is not what the user is working on and never the current
26
+ behaviour. Run `mate artifact pending --json` once: each submitted change lists its
27
+ `author` and `touches` (the capability and requirement it rewrites or removes). When
28
+ one touches what this exploration is about, name the change and its author to the
29
+ user and read only that change's delta for that capability, from the companion with
30
+ `git show <ref>:<path>/specs/<capability>/spec.md` (`submitted.ref` and the change's
31
+ `path`); read any other submitted change only when the user names it.
25
32
 
26
33
  2. **Resolve scope from the context map.** Before reading code, identify the canonical
27
34
  Working Repository (`org/repository` from its Git remote) and the repository-relative
@@ -31,23 +38,48 @@ large for one change is suggested as several.
31
38
  exploration. When the map has no entry for the Area, say so instead of borrowing
32
39
  another Area's context.
33
40
 
41
+ **Umbrella Repository.** When the Working Repository has no `.git` of its own and its
42
+ direct child folders are Git checkouts, it is an Umbrella Repository: each child is a
43
+ Working Repository of its own. Take the children from the session's
44
+ `umbrella-children` block; without a list there, read each child's identity with
45
+ `git -C <child> config --get remote.origin.url`. Before reading code, resolve the
46
+ children the work concerns, read the repository-scoped map of each of them only, and
47
+ name one scope per concerned child and Area. When it is unclear which child the work
48
+ concerns, ask the user before loading any context.
49
+
34
50
  3. **Suggest slicing when the feature is large.** Slicing test: a feature needs
35
- slicing when it holds several behaviours that can each ship and be reviewed on
36
- their own, or more work than one review can hold (roughly more than 20 tasks or
37
- 800 changed lines). Several Areas alone are no reason to slice: they stay one
38
- change with a scope per Area. Suggest slices only when the test clearly passes; a
51
+ slicing only when it holds more work than one review can hold (roughly more
52
+ than 20 tasks or 800 changed lines) and that work splits into behaviours that
53
+ can each ship and be reviewed on their own. Several Areas alone are no reason
54
+ to slice: they stay one change with a scope per Area. Cut as few slices as the
55
+ work allows, each close to one review's size; merge a slice of fewer than about
56
+ 10 tasks into its neighbour. When each slice needs the one before it to be
57
+ useful, cut only where a reviewer needs a break, not at every behaviour.
58
+ Suggest slices only when the test clearly passes; a
39
59
  borderline case stays one change. When the explored direction clearly passes the
40
60
  test, propose slices: one change per slice,
41
- each reviewable and archivable on its own, in dependency order. Name the
61
+ each reviewable and shippable on its own, in dependency order. Name the
42
62
  dependencies between slices; they become `dependsOn` entries when the changes are
43
63
  proposed. Several slices may share one delivery branch. Slicing is a suggestion;
44
64
  the user decides.
45
65
 
46
- 4. **Hand off.**
47
- End the response with a final `## Next steps` section: numbered required actions in
48
- execution order, with exact commands and known change names, prerequisites first.
49
- Summaries, evidence, warnings, optional work, and deferred context go above it; nothing
50
- 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.
66
+ 4. **Close the stage.** At the end of every run of this skill, run the first command
67
+ while no change folder exists, else the second:
68
+
69
+ ```bash
70
+ mate workflow done mate-explore-change
71
+ mate workflow done mate-explore-change "<change-name>"
72
+ ```
73
+
74
+ It prints the next actions for the change. End the response with a final `## Next
75
+ steps` section: numbered required actions in execution order, with exact commands and
76
+ known change names, prerequisites first: required work of this run that is still
77
+ open, then the actions the command printed, in its order. Summaries, evidence,
78
+ warnings, optional work, and deferred context go above it; nothing follows it.
79
+ Listing an action never invokes it. Never offer the user an optional command, in or
80
+ above the section; optional work appears above it only as a skill invocation labelled
81
+ optional, as the command's `optional:` line names it. If the command fails, report its
82
+ problems and end without a `Next steps` section.
51
83
 
52
84
  **Skill invocation.** Skill invocations here use `/name`, the syntax of Claude Code
53
85
  and Cursor and the fallback. When the current runtime uses another syntax, swap only
@@ -56,9 +88,9 @@ large for one change is suggested as several.
56
88
  folder or an older example. Arguments, commands, paths, and order stay, and naming
57
89
  never invokes.
58
90
 
59
- List `/mate-propose-change <change-name>`, or one `/mate-propose-change <slice>` per
60
- agreed slice in dependency order. A slice deferred for later is context above the
61
- section, not an action in it.
91
+ Add only what this skill knows: the agreed change name on the printed action, or
92
+ that action once per agreed slice in dependency order. A slice deferred for later is
93
+ context above the section, not an action in it.
62
94
 
63
95
  ## Boundary
64
96