@uniqbit/mate-core 0.18.4 → 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 (450) 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/add-dir.ts +76 -10
  13. package/opencode-plugin/src/companion.ts +1 -8
  14. package/opencode-plugin/src/server.ts +19 -17
  15. package/opencode-plugin/src/tui.tsx +3 -1
  16. package/opencode-plugin/tui.tsx +4 -1
  17. package/package.json +52 -15
  18. package/src/brand/art.generated.ts +69 -0
  19. package/src/brand/index.ts +12 -0
  20. package/src/brand/palette.ts +19 -0
  21. package/src/brand/svg.generated.ts +8 -0
  22. package/src/brand/terminal.ts +88 -0
  23. package/src/brand/types.ts +33 -0
  24. package/src/cli/commands/artifact/apply-context.ts +275 -0
  25. package/src/cli/commands/artifact/artifact.ts +12 -0
  26. package/src/cli/commands/artifact/delivery/archive.ts +125 -0
  27. package/src/cli/commands/artifact/delivery/branch-flags.ts +55 -0
  28. package/src/cli/commands/artifact/delivery/environment.ts +127 -0
  29. package/src/cli/commands/artifact/delivery/link.ts +191 -0
  30. package/src/cli/commands/artifact/delivery/output.ts +97 -0
  31. package/src/cli/commands/artifact/finish/command.ts +83 -8
  32. package/src/cli/commands/artifact/finish/engine.ts +91 -14
  33. package/src/cli/commands/artifact/finish/finisher.ts +10 -0
  34. package/src/cli/commands/artifact/finish/git.ts +132 -19
  35. package/src/cli/commands/artifact/finish/openspec.ts +203 -129
  36. package/src/cli/commands/artifact/finish/secret-scan.ts +43 -0
  37. package/src/cli/commands/artifact/finish/worktree-cleanup.ts +92 -0
  38. package/src/cli/commands/artifact/pending/command.ts +31 -3
  39. package/src/cli/commands/artifact/pending/discovery.ts +21 -57
  40. package/src/cli/commands/cap/graphify.ts +52 -3
  41. package/src/cli/commands/cap/index-cmd.ts +71 -15
  42. package/src/cli/commands/cap/openspec.ts +13 -25
  43. package/src/cli/commands/cap/tokensave.ts +7 -5
  44. package/src/cli/commands/companion/companion.ts +1 -1
  45. package/src/cli/commands/companion/link.ts +50 -5
  46. package/src/cli/commands/companion/open.ts +101 -51
  47. package/src/cli/commands/companion/sync.ts +10 -0
  48. package/src/cli/commands/companion/tui.ts +17 -7
  49. package/src/cli/commands/companion/update.ts +143 -48
  50. package/src/cli/commands/doctor.ts +396 -80
  51. package/src/cli/commands/factory/factory.ts +301 -0
  52. package/src/cli/commands/install.ts +133 -17
  53. package/src/cli/commands/launch/shared.ts +16 -11
  54. package/src/cli/commands/plugin/install.ts +9 -4
  55. package/src/cli/commands/plugin/plugin.ts +3 -2
  56. package/src/cli/commands/report/adapter.ts +11 -2
  57. package/src/cli/commands/report/contract.ts +21 -0
  58. package/src/cli/commands/report/highlight.ts +34 -4
  59. package/src/cli/commands/report/index.ts +20 -1
  60. package/src/cli/commands/report/markdown.ts +110 -0
  61. package/src/cli/commands/report/palette.ts +118 -0
  62. package/src/cli/commands/report/renderer.ts +456 -153
  63. package/src/cli/commands/report/types.ts +16 -0
  64. package/src/cli/commands/session/context.ts +102 -0
  65. package/src/cli/commands/session/prepare.ts +32 -4
  66. package/src/cli/commands/session/registry.ts +90 -0
  67. package/src/cli/commands/setup.ts +50 -24
  68. package/src/cli/commands/studio/companion-removal.ts +79 -0
  69. package/src/cli/commands/studio/factory-credential.ts +49 -0
  70. package/src/cli/commands/studio/index.ts +29 -2
  71. package/src/cli/commands/studio/mate-inventory.ts +1 -1
  72. package/src/cli/commands/studio/openspec-cli.ts +10 -58
  73. package/src/cli/commands/studio/payload.ts +260 -15
  74. package/src/cli/commands/studio/routes.ts +41 -6
  75. package/src/cli/commands/studio/selection.ts +161 -17
  76. package/src/cli/commands/studio/server.ts +429 -326
  77. package/src/cli/commands/studio/services.ts +80 -0
  78. package/src/cli/commands/studio/skill-files.ts +133 -0
  79. package/src/cli/commands/studio/studio-app.ts +67 -0
  80. package/src/cli/commands/studio/terminal-assets.ts +21 -33
  81. package/src/cli/commands/studio/terminal-launch.ts +7 -16
  82. package/src/cli/commands/studio/terminal.ts +85 -15
  83. package/src/cli/commands/studio/vault.ts +218 -44
  84. package/src/cli/commands/studio/views/model.ts +13 -0
  85. package/src/cli/commands/studio/views/vault/markdown-tree.ts +518 -0
  86. package/src/cli/commands/studio/views/vault/view.ts +185 -0
  87. package/src/cli/commands/studio/workset-session.ts +131 -0
  88. package/src/cli/commands/unwrap.ts +16 -0
  89. package/src/cli/commands/update.ts +53 -9
  90. package/src/cli/commands/vscode/setup.ts +155 -0
  91. package/src/cli/commands/vscode/vsix.ts +73 -0
  92. package/src/cli/commands/working/cleanup.ts +44 -11
  93. package/src/cli/commands/working/link.ts +76 -0
  94. package/src/cli/commands/working/working.ts +10 -0
  95. package/src/cli/commands/working/worktree.ts +406 -0
  96. package/src/cli/commands/wrap.ts +39 -46
  97. package/src/cli/companion-link-wizard.tsx +2 -0
  98. package/src/cli/companion-selector.tsx +2 -0
  99. package/src/cli/confirm.ts +2 -0
  100. package/src/cli/install-plan.tsx +127 -160
  101. package/src/cli/launch-selector.tsx +2 -0
  102. package/src/cli/main.ts +31 -3
  103. package/src/cli/parse-flags.ts +32 -6
  104. package/src/cli/repo-list-table.tsx +2 -0
  105. package/src/cli/setup-selector.tsx +86 -151
  106. package/src/cli/usage.ts +21 -3
  107. package/src/create-mate.ts +5 -4
  108. package/src/hooks/companion-instructions.ts +198 -0
  109. package/src/hooks/hook-io.ts +78 -0
  110. package/src/hooks/session-banner.ts +24 -30
  111. package/src/hooks/session-end.ts +10 -0
  112. package/src/hooks/session-guidance.ts +19 -41
  113. package/src/hooks/session-prepare.ts +137 -34
  114. package/src/hooks/session-register.ts +199 -0
  115. package/src/hooks/tokensave-route.ts +30 -0
  116. package/src/hooks/validate-artifact-path.ts +90 -25
  117. package/src/index.ts +4 -0
  118. package/src/lib/apply-context/fingerprint.ts +174 -0
  119. package/src/lib/apply-context/protocol.ts +193 -0
  120. package/src/lib/change-layout.ts +154 -0
  121. package/src/lib/components/confirm-prompt.tsx +21 -9
  122. package/src/lib/components/select-menu.tsx +10 -3
  123. package/src/lib/components/spinner.tsx +4 -2
  124. package/src/lib/components/startup-progress.tsx +227 -41
  125. package/src/lib/components/text-input-display.tsx +2 -0
  126. package/src/lib/components/wizard-footer.tsx +2 -0
  127. package/src/lib/components/wizard-header.tsx +16 -12
  128. package/src/lib/context-mode-package.ts +24 -11
  129. package/src/lib/delivery/archive-change.ts +165 -0
  130. package/src/lib/delivery/branches.ts +147 -0
  131. package/src/lib/delivery/environment.ts +35 -0
  132. package/src/lib/delivery/forge.ts +279 -0
  133. package/src/lib/delivery/merge-git.ts +261 -0
  134. package/src/lib/delivery/overlap.ts +209 -0
  135. package/src/lib/delivery/record-delivery.ts +338 -0
  136. package/src/lib/delivery/record.ts +405 -0
  137. package/src/lib/delivery/refresh.ts +288 -0
  138. package/src/lib/delivery/repository-access.ts +141 -0
  139. package/src/lib/delivery/resolve-branch.ts +383 -0
  140. package/src/lib/delivery/stages.ts +111 -0
  141. package/src/lib/delivery/token.ts +24 -0
  142. package/src/lib/factory/attach-client.ts +113 -0
  143. package/src/lib/factory/attach.ts +178 -0
  144. package/src/lib/factory/broker.ts +190 -0
  145. package/src/lib/factory/bun-commands.ts +39 -0
  146. package/src/lib/factory/client.ts +92 -0
  147. package/src/lib/factory/command.ts +61 -0
  148. package/src/lib/factory/credential-store.ts +153 -0
  149. package/src/lib/factory/frames.ts +77 -0
  150. package/src/lib/factory/ids.ts +58 -0
  151. package/src/lib/factory/keyed-serial.ts +27 -0
  152. package/src/lib/factory/outcomes/actions.ts +114 -0
  153. package/src/lib/factory/outcomes/index.ts +391 -0
  154. package/src/lib/factory/outcomes/lifecycle.ts +205 -0
  155. package/src/lib/factory/outcomes/runs.ts +81 -0
  156. package/src/lib/factory/outcomes/sessions.ts +38 -0
  157. package/src/lib/factory/prepare.ts +49 -0
  158. package/src/lib/factory/pty.ts +103 -0
  159. package/src/lib/factory/runner/companion-context.ts +178 -0
  160. package/src/lib/factory/runner/control.ts +92 -0
  161. package/src/lib/factory/runner/harness-agent.ts +250 -0
  162. package/src/lib/factory/runner/live.ts +159 -0
  163. package/src/lib/factory/runner/questions.ts +22 -0
  164. package/src/lib/factory/runner/rank.ts +26 -0
  165. package/src/lib/factory/runner/run-policy.ts +12 -0
  166. package/src/lib/factory/runner/run.ts +199 -0
  167. package/src/lib/factory/runner/scheduler.ts +416 -0
  168. package/src/lib/factory/runner/state.ts +233 -0
  169. package/src/lib/factory/runner/workflow.ts +542 -0
  170. package/src/lib/factory/runtime.ts +981 -0
  171. package/src/lib/factory/sandbox.ts +292 -0
  172. package/src/lib/factory/worktree-branch.ts +17 -0
  173. package/src/lib/frontmatter.ts +18 -0
  174. package/src/lib/install.ts +66 -14
  175. package/src/lib/live-progress.ts +36 -0
  176. package/src/lib/member-choices.ts +67 -0
  177. package/src/lib/opencode-plugin-package.ts +5 -5
  178. package/src/lib/opencode-server.ts +238 -0
  179. package/src/lib/openspec-cli.ts +116 -0
  180. package/src/lib/openspec-scopes.ts +86 -0
  181. package/src/lib/orchestrator/adapters/base.ts +55 -22
  182. package/src/lib/orchestrator/adapters/claude-args.ts +50 -0
  183. package/src/lib/orchestrator/adapters/claude.ts +210 -162
  184. package/src/lib/orchestrator/adapters/opencode.ts +60 -24
  185. package/src/lib/orchestrator/checkout-adoption.ts +125 -0
  186. package/src/lib/orchestrator/companion-registry-store.ts +6 -2
  187. package/src/lib/orchestrator/config-store.ts +5 -72
  188. package/src/lib/orchestrator/editor.ts +32 -26
  189. package/src/lib/orchestrator/framework-context.ts +26 -14
  190. package/src/lib/orchestrator/global-config-store.ts +11 -0
  191. package/src/lib/orchestrator/launcher.ts +15 -2
  192. package/src/lib/orchestrator/openspec-store.ts +14 -54
  193. package/src/lib/orchestrator/projection-claude-commands.ts +36 -0
  194. package/src/lib/orchestrator/projection-claude-links.ts +206 -0
  195. package/src/lib/orchestrator/projection-claude-skills.ts +37 -182
  196. package/src/lib/orchestrator/projection-companion-link.ts +12 -1
  197. package/src/lib/orchestrator/projection-entries.ts +100 -35
  198. package/src/lib/orchestrator/projection-opencode-copies.ts +32 -15
  199. package/src/lib/orchestrator/projection-openspec-store.ts +54 -9
  200. package/src/lib/orchestrator/projection-runtime-documents.ts +15 -6
  201. package/src/lib/orchestrator/projection-types.ts +36 -3
  202. package/src/lib/orchestrator/refresh-working-claude-links.ts +87 -0
  203. package/src/lib/orchestrator/registry-checkouts.ts +177 -0
  204. package/src/lib/orchestrator/repository-link.ts +216 -57
  205. package/src/lib/orchestrator/serving-claude-wrap.ts +43 -0
  206. package/src/lib/orchestrator/session-context-link.ts +73 -0
  207. package/src/lib/orchestrator/session-prepare.ts +84 -92
  208. package/src/lib/orchestrator/setup-compatibilities.ts +56 -70
  209. package/src/lib/orchestrator/types.ts +12 -2
  210. package/src/lib/orchestrator/working-repo-projection.ts +50 -7
  211. package/src/lib/orchestrator/workspace-document.ts +105 -0
  212. package/src/lib/orchestrator/workspace-inventory.ts +5 -1
  213. package/src/lib/orchestrator/wrap-pass.ts +22 -88
  214. package/src/lib/package-paths.ts +37 -0
  215. package/src/lib/public-npm.ts +17 -0
  216. package/src/lib/runtime-directory-refresh.ts +17 -1
  217. package/src/lib/session-attribution.ts +52 -0
  218. package/src/lib/session-state.ts +285 -0
  219. package/src/lib/session-stop.ts +64 -0
  220. package/src/lib/workset/record.ts +533 -0
  221. package/src/lib/workset/repositories.ts +55 -0
  222. package/src/lib/workset/stage.ts +148 -0
  223. package/src/lib/workset/stages.ts +113 -0
  224. package/src/lib/workset/worktree-index.ts +116 -0
  225. package/src/lib/workset/worktree.ts +898 -0
  226. package/src/opencode/background-server.ts +145 -0
  227. package/src/opencode/companion-hooks.ts +111 -7
  228. package/src/opencode/companion-policy.ts +39 -20
  229. package/src/opencode/enter-worktree.ts +72 -0
  230. package/src/opencode/projected-guidance.ts +6 -2
  231. package/src/opencode/session-prepare.ts +2 -1
  232. package/src/opencode/session-register.ts +176 -0
  233. package/src/opencode/tui.tsx +24 -27
  234. package/src/plugins.ts +1 -0
  235. package/src/runtime/artifact-refusal.ts +63 -0
  236. package/src/runtime/claude-delivery-plan.ts +121 -11
  237. package/src/runtime/commit-attribution-guard.ts +181 -0
  238. package/src/runtime/companion-git.ts +52 -10
  239. package/src/runtime/companion-guidance.ts +20 -8
  240. package/src/runtime/companion-instructions.ts +340 -0
  241. package/src/runtime/companion-lock.ts +30 -7
  242. package/src/runtime/current-branch.ts +10 -0
  243. package/src/runtime/env.ts +59 -8
  244. package/src/runtime/error-message.ts +4 -0
  245. package/src/runtime/git-layout.ts +366 -0
  246. package/src/runtime/guidance.ts +0 -17
  247. package/src/runtime/index.ts +29 -0
  248. package/src/runtime/launch-env-guard.ts +65 -0
  249. package/src/runtime/managed-block.ts +117 -0
  250. package/src/runtime/markdown-scan.ts +266 -0
  251. package/src/runtime/opencode-server-record.ts +136 -0
  252. package/src/runtime/physical-path.ts +111 -0
  253. package/src/runtime/policy.ts +47 -12
  254. package/src/runtime/projected-flag.ts +7 -0
  255. package/src/runtime/projected-guidance.ts +1 -0
  256. package/src/runtime/projection.ts +40 -6
  257. package/src/runtime/repo-local.ts +6 -1
  258. package/src/runtime/runtime-directory.ts +5 -0
  259. package/src/runtime/runtime-document-manifest.ts +62 -28
  260. package/src/runtime/secret-guard.ts +162 -0
  261. package/src/runtime/secret-patterns.ts +397 -0
  262. package/src/runtime/secret-scan.ts +90 -0
  263. package/src/runtime/serving-claude-wrap.ts +28 -0
  264. package/src/runtime/session-context.ts +99 -0
  265. package/src/runtime/session-kind.ts +13 -0
  266. package/src/runtime/session-registry.ts +434 -0
  267. package/src/runtime/shell-heredoc.ts +81 -0
  268. package/src/runtime/tokensave-route.ts +157 -0
  269. package/src/runtime/wrap-state.ts +75 -6
  270. package/src/runtime/write-atomic.ts +64 -0
  271. package/src/studio.ts +126 -0
  272. package/src/templates/capabilities/openspec-cap/mate-minimal/schema.yaml +14 -10
  273. package/src/templates/capabilities/openspec-cap/mate-minimal/templates/spec.md +3 -5
  274. package/src/templates/capabilities/openspec-cap/mate-v1/schema.yaml +18 -102
  275. package/src/templates/capabilities/openspec-cap/mate-v1/templates/spec.md +3 -5
  276. package/src/templates/capabilities/openspec-cap/openspec-conventions.yaml +20 -14
  277. package/src/templates/mate-skills/THIRD-PARTY-NOTICES.md +40 -0
  278. package/src/templates/mate-skills/agents/mate-apply-change/SKILL.md +162 -0
  279. package/src/templates/mate-skills/agents/mate-apply-change/references/mate-compact-apply.md +47 -0
  280. package/src/templates/mate-skills/agents/mate-apply-change/references/openspec-apply-change.md +200 -0
  281. package/src/templates/mate-skills/agents/mate-archive-change/SKILL.md +81 -0
  282. package/src/templates/mate-skills/agents/{mate-openspec-backfill → mate-backfill-spec}/SKILL.md +11 -4
  283. package/src/templates/mate-skills/agents/mate-clarify-intent/SKILL.md +110 -0
  284. package/src/templates/mate-skills/agents/mate-explore-change/SKILL.md +66 -0
  285. package/src/templates/mate-skills/agents/mate-explore-change/references/openspec-explore.md +350 -0
  286. package/src/templates/mate-skills/agents/mate-grill-me/SKILL.md +11 -4
  287. package/src/templates/mate-skills/agents/mate-grill-with-docs/SKILL.md +2 -2
  288. package/src/templates/mate-skills/agents/mate-interview-me/SKILL.md +12 -5
  289. package/src/templates/mate-skills/agents/mate-propose-change/SKILL.md +102 -0
  290. package/src/templates/mate-skills/agents/mate-propose-change/references/mate-revise.md +45 -0
  291. package/src/templates/mate-skills/agents/mate-propose-change/references/openspec-propose.md +169 -0
  292. package/src/templates/mate-skills/agents/mate-propose-change/references/openspec-update-change.md +103 -0
  293. package/src/templates/mate-skills/agents/{mate-artifact-publish → mate-publish-artifact}/SKILL.md +109 -24
  294. package/src/templates/mate-skills/{claude/mate-artifact-publish → agents/mate-publish-artifact}/references/openspec.md +8 -5
  295. package/src/templates/mate-skills/agents/mate-show-me/SKILL.md +95 -16
  296. package/src/templates/mate-skills/agents/mate-simplify-code/SKILL.md +87 -68
  297. package/src/templates/mate-skills/claude/mate-apply-change/SKILL.md +162 -0
  298. package/src/templates/mate-skills/claude/mate-apply-change/references/mate-compact-apply.md +47 -0
  299. package/src/templates/mate-skills/claude/mate-apply-change/references/openspec-apply-change.md +200 -0
  300. package/src/templates/mate-skills/claude/mate-archive-change/SKILL.md +81 -0
  301. package/src/templates/mate-skills/claude/{mate-openspec-backfill → mate-backfill-spec}/SKILL.md +11 -4
  302. package/src/templates/mate-skills/claude/mate-clarify-intent/SKILL.md +110 -0
  303. package/src/templates/mate-skills/claude/mate-explore-change/SKILL.md +66 -0
  304. package/src/templates/mate-skills/claude/mate-explore-change/references/openspec-explore.md +350 -0
  305. package/src/templates/mate-skills/claude/mate-grill-me/SKILL.md +11 -4
  306. package/src/templates/mate-skills/claude/mate-grill-with-docs/SKILL.md +2 -2
  307. package/src/templates/mate-skills/claude/mate-interview-me/SKILL.md +12 -5
  308. package/src/templates/mate-skills/claude/mate-propose-change/SKILL.md +102 -0
  309. package/src/templates/mate-skills/claude/mate-propose-change/references/mate-revise.md +45 -0
  310. package/src/templates/mate-skills/claude/mate-propose-change/references/openspec-propose.md +169 -0
  311. package/src/templates/mate-skills/claude/mate-propose-change/references/openspec-update-change.md +103 -0
  312. package/src/templates/mate-skills/claude/{mate-artifact-publish → mate-publish-artifact}/SKILL.md +109 -24
  313. package/src/templates/mate-skills/{agents/mate-artifact-publish → claude/mate-publish-artifact}/references/openspec.md +8 -5
  314. package/src/templates/mate-skills/claude/mate-show-me/SKILL.md +95 -16
  315. package/src/templates/mate-skills/claude/mate-simplify-code/SKILL.md +87 -68
  316. package/src/templates/mate-skills/openspec-references.ts +142 -0
  317. package/src/templates/root/TEMPLATE_AGENTS.md +2 -2
  318. package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +4340 -419
  319. package/src/tools/setup/capabilities/companion-mentions.ts +27 -0
  320. package/src/tools/setup/capabilities/context-mode.ts +56 -7
  321. package/src/tools/setup/capabilities/graphify-gate.ts +31 -0
  322. package/src/tools/setup/capabilities/graphify-secrets.ts +243 -0
  323. package/src/tools/setup/capabilities/graphify.ts +46 -7
  324. package/src/tools/setup/capabilities/openspec.ts +284 -271
  325. package/src/tools/setup/capabilities/react-doctor.ts +8 -1
  326. package/src/tools/setup/capabilities/rtk.ts +4 -0
  327. package/src/tools/setup/capabilities/tokensave.ts +113 -71
  328. package/src/tools/setup/context-services.ts +9 -17
  329. package/src/tools/setup/dynamic-plugins/audiences.ts +7 -39
  330. package/src/tools/setup/dynamic-plugins/declarations.ts +1 -1
  331. package/src/tools/setup/dynamic-plugins/hydrate.ts +8 -10
  332. package/src/tools/setup/dynamic-plugins/install.ts +24 -28
  333. package/src/tools/setup/engine.ts +96 -150
  334. package/src/tools/setup/install-contract.ts +8 -0
  335. package/src/tools/setup/managed-output.ts +51 -0
  336. package/src/tools/setup/mate-skill-copies.ts +51 -0
  337. package/src/tools/setup/mate.ts +86 -11
  338. package/src/tools/setup/package-managers/uv.ts +73 -11
  339. package/src/tools/setup/plugin.ts +42 -17
  340. package/src/tools/setup/plugins/gitignore.ts +1 -7
  341. package/src/tools/setup/plugins/guidance.ts +7 -4
  342. package/src/tools/setup/providers/agent-file-sections.ts +4 -2
  343. package/src/tools/setup/providers/claude-attribution.ts +65 -0
  344. package/src/tools/setup/providers/claude-plugin-folders.ts +625 -0
  345. package/src/tools/setup/providers/claude-plugin-hooks.ts +77 -19
  346. package/src/tools/setup/providers/claude-worktree-plugins.ts +122 -0
  347. package/src/tools/setup/providers/claude.ts +311 -34
  348. package/src/tools/setup/providers/opencode.ts +180 -11
  349. package/src/tools/setup/registry.ts +2 -24
  350. package/src/tools/setup/surface-target.ts +4 -13
  351. package/src/tools/setup/utils.ts +18 -4
  352. package/src/tools/setup/working-repo-cleanup.ts +29 -1
  353. package/src/tools/setup/working-repo-local-state.ts +252 -75
  354. package/src/tools/setup.ts +187 -33
  355. package/studio-dist/client/assets/app-CdPiFv59.css +2 -0
  356. package/studio-dist/client/assets/button-BIIHE0EQ.js +3 -0
  357. package/studio-dist/client/assets/companion-view-DM6YyXaR.js +1 -0
  358. package/studio-dist/client/assets/delivery-path-DELxj0Av.js +1 -0
  359. package/studio-dist/client/assets/dist-Dm7MtyHc.js +5 -0
  360. package/studio-dist/client/assets/factory-BZy0E8ty.js +4 -0
  361. package/studio-dist/client/assets/index-B3wkMzjA.js +40 -0
  362. package/studio-dist/client/assets/markdown-view-pQ2Qp_i5.js +1 -0
  363. package/studio-dist/client/assets/panel-CbajlC3p.js +1 -0
  364. package/studio-dist/client/assets/preload-helper-BLdHbfdN.js +1 -0
  365. package/studio-dist/client/assets/prepaint-CwSrpdFA.js +27 -0
  366. package/studio-dist/client/assets/react-CN2GSx7x.js +1 -0
  367. package/studio-dist/client/assets/reports-DllhYQ5_.js +1 -0
  368. package/studio-dist/client/assets/rolldown-runtime-WkwZ5CU-.js +1 -0
  369. package/studio-dist/client/assets/routes-COm-G3mK.js +1 -0
  370. package/studio-dist/client/assets/skills-DmWAy-jZ.js +1 -0
  371. package/studio-dist/client/assets/specs-BG3Wi3ln.js +1 -0
  372. package/studio-dist/client/assets/steps-DFsH3Neu.js +1 -0
  373. package/studio-dist/client/assets/terminal-eU5fzQzv.css +1 -0
  374. package/studio-dist/client/assets/vault-B2q1nBY5.js +1 -0
  375. package/studio-dist/client/assets/warnings-BSXIyuSQ.js +1 -0
  376. package/studio-dist/client/assets/wasm-inline-C2en61B5.js +1 -0
  377. package/studio-dist/client/assets/workflow-DlsQD6Hc.js +1 -0
  378. package/studio-dist/server/assets/__23tanstack-start-server-fn-resolver-M2GBs8s3.js +4051 -0
  379. package/studio-dist/server/assets/_tanstack-start-manifest_v.js +95 -0
  380. package/studio-dist/server/assets/actions-Bvgj9eb8.js +54 -0
  381. package/studio-dist/server/assets/actions-D8erOphH.js +44 -0
  382. package/studio-dist/server/assets/button-CIJqAhni.js +11929 -0
  383. package/studio-dist/server/assets/companion-view-DISASvdJ.js +39 -0
  384. package/studio-dist/server/assets/companions-BYbHWKOZ.js +15 -0
  385. package/studio-dist/server/assets/createServerFn-F5sAOF8V.js +459 -0
  386. package/studio-dist/server/assets/createServerRpc-tK2lE9R2.js +11 -0
  387. package/studio-dist/server/assets/delivery-path-C29fBynY.js +654 -0
  388. package/studio-dist/server/assets/dist-DpJWKyCm.js +5582 -0
  389. package/studio-dist/server/assets/empty-plugin-adapters-Cipd4ZH4.js +4 -0
  390. package/studio-dist/server/assets/factory-DGPmNGbo.js +69 -0
  391. package/studio-dist/server/assets/factory-DUTa0eDs.js +2172 -0
  392. package/studio-dist/server/assets/markdown-view-Bn7xPdks.js +86 -0
  393. package/studio-dist/server/assets/model-PyPALjii.js +18 -0
  394. package/studio-dist/server/assets/panel-3Jmn4awF.js +169 -0
  395. package/studio-dist/server/assets/prepaint-DJfTQ_VH.js +45 -0
  396. package/studio-dist/server/assets/react-Ce6dj15C.js +46 -0
  397. package/studio-dist/server/assets/reports-C06RXVE2.js +18 -0
  398. package/studio-dist/server/assets/reports-D6YMqhnO.js +142 -0
  399. package/studio-dist/server/assets/rolldown-runtime-DYf_mQCB.js +34 -0
  400. package/studio-dist/server/assets/router-C8MGqlAY.js +13713 -0
  401. package/studio-dist/server/assets/routes-BcFgvqf7.js +622 -0
  402. package/studio-dist/server/assets/search-JAKurDNh.js +36 -0
  403. package/studio-dist/server/assets/shell-DS3wUexh.js +52 -0
  404. package/studio-dist/server/assets/skills-BEnOxiDl.js +266 -0
  405. package/studio-dist/server/assets/skills-CtrBAtX3.js +28 -0
  406. package/studio-dist/server/assets/specs-C8rv34-5.js +211 -0
  407. package/studio-dist/server/assets/start-h3ICWwd2.js +36 -0
  408. package/studio-dist/server/assets/steps-Dq_CwY_s.js +181 -0
  409. package/studio-dist/server/assets/studio-BeltxxKt.js +216 -0
  410. package/studio-dist/server/assets/utils-C9CX1kcy.js +221 -0
  411. package/studio-dist/server/assets/vault-BmWnryh3.js +85 -0
  412. package/studio-dist/server/assets/vault-Fvxt2Tzl.js +1032 -0
  413. package/studio-dist/server/assets/views-BgYa-za2.js +80 -0
  414. package/studio-dist/server/assets/warnings-DzR6fyZh.js +23 -0
  415. package/studio-dist/server/assets/wasm-inline-CNeBKGwC.js +3 -0
  416. package/studio-dist/server/assets/workflow-liRYecHk.js +73 -0
  417. package/studio-dist/server/server.js +16066 -0
  418. package/wrappers/bin/graphify +52 -4
  419. package/wrappers/bin/openspec +33 -9
  420. package/wrappers/lib/graphify-gate.mjs +8 -0
  421. package/opencode-plugin/src/audience-layer.ts +0 -91
  422. package/src/cli/commands/studio/views/client.ts +0 -654
  423. package/src/cli/commands/studio/views/companion-picker.tsx +0 -95
  424. package/src/cli/commands/studio/views/companion-selector.tsx +0 -94
  425. package/src/cli/commands/studio/views/dashboard/changes.tsx +0 -107
  426. package/src/cli/commands/studio/views/dashboard/index.tsx +0 -19
  427. package/src/cli/commands/studio/views/document.tsx +0 -842
  428. package/src/cli/commands/studio/views/error.tsx +0 -20
  429. package/src/cli/commands/studio/views/reports/index.tsx +0 -49
  430. package/src/cli/commands/studio/views/selection-fields.tsx +0 -14
  431. package/src/cli/commands/studio/views/skills/index.tsx +0 -87
  432. package/src/cli/commands/studio/views/specs/index.tsx +0 -157
  433. package/src/cli/commands/studio/views/styles.ts +0 -519
  434. package/src/cli/commands/studio/views/terminal.tsx +0 -484
  435. package/src/cli/commands/studio/views/vault/state.ts +0 -43
  436. package/src/cli/commands/studio/views/warnings.tsx +0 -21
  437. package/src/cli/commands/studio/views/workflow/index.tsx +0 -21
  438. package/src/cli/commands/studio/views/workflow/steps.ts +0 -337
  439. package/src/cli/commands/studio/views/workflow/transcript.tsx +0 -190
  440. package/src/lib/components/theme.ts +0 -2
  441. package/src/runtime/audience-layer.ts +0 -84
  442. package/src/runtime/opencode-audience-layer.ts +0 -176
  443. package/src/tools/setup/audience-isolation.fixture.ts +0 -325
  444. package/src/tools/setup/audience-layer.ts +0 -207
  445. package/src/tools/setup/audience-registrations.ts +0 -52
  446. package/src/tools/setup/contribution-ledger.ts +0 -207
  447. package/src/tools/setup/git-utils.ts +0 -30
  448. package/src/tools/setup/isolation-diagnostics.ts +0 -139
  449. package/src/tools/setup/runtime-documents.ts +0 -291
  450. package/src/tools/setup/upgrade-sweep.ts +0 -153
@@ -0,0 +1,654 @@
1
+ import { i as __toESM } from "./rolldown-runtime-DYf_mQCB.js";
2
+ import { j as require_react, u as require_jsx_runtime } from "./__23tanstack-start-server-fn-resolver-M2GBs8s3.js";
3
+ import { $ as CommandLine, Ar as cn, at as Pills, et as Count, nt as ListCard, rt as PAGE_PAD } from "./button-CIJqAhni.js";
4
+ import { n as PanelSection, r as SidePanel, t as PanelHead } from "./panel-3Jmn4awF.js";
5
+ import { n as workflowPlan, t as PHASE_LABELS } from "./steps-Dq_CwY_s.js";
6
+ // src/views/workflow/graph.ts
7
+ var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
8
+ var stageNode = (step) => ({
9
+ id: step.id,
10
+ kind: "stage",
11
+ step
12
+ });
13
+ function columnsOf(path) {
14
+ const columns = path.map.map((entry) => {
15
+ if (entry.kind === "stage") return {
16
+ nodes: [stageNode(entry.step)],
17
+ optional: entry.step.optional,
18
+ phase: entry.step.phase
19
+ };
20
+ if (entry.group === "human") return {
21
+ nodes: [{
22
+ id: "reviews",
23
+ kind: "review-group",
24
+ steps: entry.steps
25
+ }],
26
+ optional: false,
27
+ phase: entry.steps[0].phase
28
+ };
29
+ return {
30
+ nodes: entry.steps.map(stageNode),
31
+ optional: true,
32
+ phase: entry.steps[0].phase
33
+ };
34
+ });
35
+ columns.unshift({
36
+ nodes: [{
37
+ id: "start",
38
+ kind: "start"
39
+ }],
40
+ optional: false,
41
+ phase: columns[0]?.phase ?? "plan"
42
+ });
43
+ return columns;
44
+ }
45
+ function entersNewSession(node) {
46
+ if (node.kind === "stage") return Boolean(node.step.sessionBreakBefore);
47
+ if (node.kind === "review-group") return Boolean(node.steps[0].sessionBreakBefore);
48
+ return false;
49
+ }
50
+ function edgesOf(columns) {
51
+ const edges = [];
52
+ const link = (from, to, kind) => {
53
+ for (const a of from) for (const b of to) edges.push({
54
+ from: a.id,
55
+ to: b.id,
56
+ kind,
57
+ newSession: entersNewSession(b)
58
+ });
59
+ };
60
+ columns.forEach((column, index) => {
61
+ const next = columns[index + 1];
62
+ if (next) link(column.nodes, next.nodes, "flow");
63
+ const before = columns[index - 1];
64
+ if (column.optional && before && next) link(before.nodes, next.nodes, "bypass");
65
+ });
66
+ return edges;
67
+ }
68
+ function bandsOf(columns) {
69
+ const bands = [];
70
+ columns.forEach((column, index) => {
71
+ const band = bands.at(-1);
72
+ if (band?.phase === column.phase) {
73
+ band.to = index + 1;
74
+ return;
75
+ }
76
+ bands.push({
77
+ phase: column.phase,
78
+ label: PHASE_LABELS[column.phase],
79
+ from: index,
80
+ to: index + 1
81
+ });
82
+ });
83
+ return bands;
84
+ }
85
+ /** Changes archive before they publish, so everything up to Archive change repeats per change. */
86
+ function cycleOf(columns) {
87
+ const archive = columns.findIndex((column) => column.nodes.some((node) => node.id === "archive"));
88
+ return archive === -1 ? null : {
89
+ from: 0,
90
+ to: archive + 1
91
+ };
92
+ }
93
+ /** The path's node graph. Single nodes span every row; peers take a row each. */
94
+ function workflowGraph(path) {
95
+ const columns = columnsOf(path);
96
+ const rows = Math.max(1, ...columns.map((column) => column.nodes.length));
97
+ const nodes = columns.flatMap((column, index) => column.nodes.map((node, row) => column.nodes.length === 1 ? {
98
+ ...node,
99
+ column: index,
100
+ row: 0,
101
+ rowSpan: rows
102
+ } : {
103
+ ...node,
104
+ column: index,
105
+ row,
106
+ rowSpan: 1
107
+ }));
108
+ return {
109
+ columns: columns.length,
110
+ rows,
111
+ nodes,
112
+ edges: edgesOf(columns),
113
+ bands: bandsOf(columns),
114
+ cycle: cycleOf(columns)
115
+ };
116
+ }
117
+ var graphAcross = (graph) => graph.rows * 2 + 1;
118
+ function nodeCenter(node) {
119
+ return {
120
+ along: node.column + .5,
121
+ across: node.row * 2 + node.rowSpan
122
+ };
123
+ }
124
+ var round = (value) => Math.round(value * 1e4) / 1e4;
125
+ var percent = (part, whole) => `${round(part / whole * 100)}%`;
126
+ /** An SVG `x y` pair: across is horizontal, along runs down. */
127
+ var pair = ({ along, across }) => `${round(across)} ${round(along)}`;
128
+ function endpoints(graph, edge) {
129
+ const at = (id) => {
130
+ const node = graph.nodes.find((candidate) => candidate.id === id);
131
+ if (!node) throw new Error(`Unknown graph node: ${id}`);
132
+ return nodeCenter(node);
133
+ };
134
+ return [at(edge.from), at(edge.to)];
135
+ }
136
+ /** Center to center: nodes are opaque and drawn over the edges, so a line meets each border. */
137
+ function edgePath(graph, edge) {
138
+ const [a, b] = endpoints(graph, edge);
139
+ if (edge.kind === "bypass") {
140
+ const lane = graphAcross(graph);
141
+ return `M ${pair(a)} C ${pair({
142
+ along: a.along,
143
+ across: lane
144
+ })}, ${pair({
145
+ along: b.along,
146
+ across: lane
147
+ })}, ${pair(b)}`;
148
+ }
149
+ const middle = (a.along + b.along) / 2;
150
+ return `M ${pair(a)} C ${pair({
151
+ along: middle,
152
+ across: a.across
153
+ })}, ${pair({
154
+ along: middle,
155
+ across: b.across
156
+ })}, ${pair(b)}`;
157
+ }
158
+ /** Midpoint of an edge's curve, where a new-session mark sits. */
159
+ function edgeMidpoint(graph, edge) {
160
+ const [a, b] = endpoints(graph, edge);
161
+ const along = (a.along + b.along) / 2;
162
+ if (edge.kind === "bypass") return {
163
+ along,
164
+ across: (a.across + b.across) / 8 + graphAcross(graph) * 3 / 4
165
+ };
166
+ return {
167
+ along,
168
+ across: (a.across + b.across) / 2
169
+ };
170
+ }
171
+ /** A point as percentages of the drawing, for undistorted marks. */
172
+ function percentOf(graph, point) {
173
+ return {
174
+ x: percent(point.across, graphAcross(graph)),
175
+ y: percent(point.along, graph.columns)
176
+ };
177
+ }
178
+ /** A column range's vertical extent as percentages of the drawing: a band or the cycle. */
179
+ function bandSpan(graph, band) {
180
+ return {
181
+ top: percent(band.from, graph.columns),
182
+ height: percent(band.to - band.from, graph.columns)
183
+ };
184
+ }
185
+ // src/views/workflow/delivery-path.tsx
186
+ var import_jsx_runtime = require_jsx_runtime();
187
+ var NO_COUNTS = {};
188
+ var NO_STAGES = [];
189
+ function DeliveryPathView({ payload, counts = NO_COUNTS, changesByStage = NO_STAGES }) {
190
+ const plan = workflowPlan({
191
+ skills: payload.skills && payload.skills.length > 0 ? payload.skills : void 0,
192
+ topology: payload.topology
193
+ });
194
+ const [schema, setSchema] = (0, import_react.useState)(plan.paths[0].schema);
195
+ const path = plan.paths.find((entry) => entry.schema === schema) ?? plan.paths[0];
196
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
197
+ className: "workflow-delivery-path @container grid content-start gap-2",
198
+ "aria-label": "Delivery Path",
199
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
200
+ className: cn(PAGE_PAD, "flex flex-wrap items-center gap-3"),
201
+ "data-workflow-schema-root": true,
202
+ children: [
203
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
204
+ className: "text-sm text-muted",
205
+ children: "OpenSpec schema"
206
+ }),
207
+ plan.paths.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pills, {
208
+ label: "OpenSpec schema",
209
+ value: schema,
210
+ onChange: setSchema,
211
+ options: plan.paths.map((entry) => ({
212
+ value: entry.schema,
213
+ label: entry.label
214
+ }))
215
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
216
+ className: "font-mono text-sm",
217
+ children: path.label
218
+ }),
219
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
220
+ className: "text-sm text-muted",
221
+ children: path.tagline
222
+ })
223
+ ]
224
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PathBody, {
225
+ path,
226
+ counts,
227
+ changesByStage
228
+ }, path.schema)]
229
+ });
230
+ }
231
+ var nodeOf = (step) => step.kind === "human" ? "reviews" : step.id;
232
+ /** The graph on the page; one stage's detail opens in the slide-over panel. */
233
+ function PathBody({ path, counts, changesByStage }) {
234
+ const [selected, setSelected] = (0, import_react.useState)(null);
235
+ const step = path.steps.find((entry) => entry.id === selected) ?? null;
236
+ const placed = changesByStage.filter((group) => group.changes.length > 0);
237
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
238
+ className: cn(PAGE_PAD, "workflow-path grid grid-cols-[minmax(380px,520px)_minmax(260px,1fr)] items-start gap-10 pt-10 pb-12 @max-[880px]:grid-cols-1"),
239
+ "data-workflow-schema-panel": path.schema,
240
+ children: [
241
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
242
+ className: "workflow-path-graph grid min-w-0 justify-items-center gap-9 px-8",
243
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(WorkflowGraphView, {
244
+ path,
245
+ selected,
246
+ onSelect: setSelected,
247
+ counts
248
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GraphLegend, {})]
249
+ }),
250
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
251
+ className: "workflow-detail-overview grid content-start gap-5",
252
+ id: overviewId(path),
253
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
254
+ className: "grid gap-2 text-sm leading-relaxed text-muted",
255
+ children: [
256
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
257
+ className: "workflow-description m-0 text-text",
258
+ children: path.description
259
+ }),
260
+ !path.reviewsKnown ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
261
+ className: "workflow-description m-0",
262
+ children: "The schema's artifacts could not be read, so its review stages are unknown."
263
+ }) : null,
264
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
265
+ className: "workflow-description m-0",
266
+ children: "A workset is one or more changes published together: after Archive change, start again at the top for the next change, and publish once they are archived."
267
+ }),
268
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
269
+ className: "workflow-detail-hint m-0",
270
+ children: "Choose a stage to see what it does and the prompt that runs it."
271
+ })
272
+ ]
273
+ }), placed.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ListCard, {
274
+ title: "Where your changes are",
275
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", {
276
+ className: "m-0 list-none p-0",
277
+ children: placed.map((group) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", {
278
+ className: "grid gap-1 border-t border-rule-soft px-4 py-2 first:border-t-0",
279
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
280
+ className: "flex items-center gap-2 text-sm font-semibold",
281
+ children: [group.label, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Count, { value: group.changes.length })]
282
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
283
+ className: "truncate font-mono text-xs text-muted",
284
+ children: group.changes.join(", ")
285
+ })]
286
+ }, group.node))
287
+ })
288
+ }) : null]
289
+ }),
290
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidePanel, {
291
+ items: path.steps.map((entry) => entry.id),
292
+ current: step?.id ?? null,
293
+ onSelect: setSelected,
294
+ title: step ? `Stage ${step.label}` : "Stage",
295
+ children: step ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StageDetail, {
296
+ step,
297
+ changes: changesByStage.find((group) => group.node === nodeOf(step))?.changes ?? []
298
+ }) : null
299
+ })
300
+ ]
301
+ });
302
+ }
303
+ var overviewId = (path) => `workflow-${path.schema}-overview`;
304
+ /** Each node's progress, by column: everything left of the current node is done. */
305
+ function progressOf(graph, progress) {
306
+ if (!progress) return () => void 0;
307
+ const at = currentColumn(graph, progress.current);
308
+ return (node) => {
309
+ if (node.column < at) return "done";
310
+ return node.id === progress.current ? "current" : "next";
311
+ };
312
+ }
313
+ /** The current node's column; past the last column when `complete`. */
314
+ function currentColumn(graph, current) {
315
+ const found = graph.nodes.find((node) => node.id === current);
316
+ if (found) return found.column;
317
+ if (current === "complete") return graph.columns;
318
+ return -1;
319
+ }
320
+ var COUNT_NAMES = { reviews: (count) => `${count} ${count === 1 ? "change waits" : "changes wait"} for review` };
321
+ var countName = (node, label, count) => COUNT_NAMES[node]?.(count) ?? `${count} ${count === 1 ? "change" : "changes"} at ${label}`;
322
+ /** How many of the companion's changes are at a node; named for assistive technology. */
323
+ function CountBadge({ count, name }) {
324
+ if (!count) return null;
325
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
326
+ className: "workflow-graph-count absolute -top-2.5 -right-2.5 z-1 inline-grid h-5 min-w-5 place-items-center rounded-full border border-[color-mix(in_srgb,var(--accent)_45%,var(--border))] bg-accent-soft px-1.5 font-sans text-2xs font-bold text-text",
327
+ "aria-label": name,
328
+ role: "img",
329
+ children: count
330
+ });
331
+ }
332
+ /**
333
+ * Stage buttons are the only announced part: their document order is the stage order. Bands,
334
+ * edges, and marks are decorative and hidden from assistive technology. With `progress` the
335
+ * map shows one item's position, and nodes are plain labels.
336
+ */
337
+ function WorkflowGraphView({ path, progress, label = "Delivery Path map", selected = null, onSelect, counts = NO_COUNTS }) {
338
+ const graph = workflowGraph(path);
339
+ const stateOf = progressOf(graph, progress);
340
+ const plain = Boolean(progress) || !onSelect;
341
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("nav", {
342
+ className: "workflow-graph",
343
+ "aria-label": label,
344
+ "data-progress-activity": progress?.activity,
345
+ style: {
346
+ "--graph-columns": String(graph.columns),
347
+ "--graph-rows": String(graph.rows)
348
+ },
349
+ children: [
350
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
351
+ className: "workflow-graph-bands",
352
+ "aria-hidden": "true",
353
+ children: [
354
+ graph.bands.map((band) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
355
+ className: "workflow-graph-band",
356
+ "data-band": band.phase,
357
+ style: bandSpan(graph, band),
358
+ children: band.label
359
+ }, band.phase)),
360
+ graph.cycle ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
361
+ className: "workflow-graph-cycle",
362
+ style: bandSpan(graph, graph.cycle),
363
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "repeats for each change" })
364
+ }) : null,
365
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
366
+ className: "workflow-graph-workset",
367
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "workset" })
368
+ })
369
+ ]
370
+ }),
371
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GraphLayer, {
372
+ graph,
373
+ stateOf
374
+ }),
375
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", {
376
+ className: "workflow-graph-nodes",
377
+ children: graph.nodes.map((node) => node.kind === "start" ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", {
378
+ className: "workflow-graph-node",
379
+ "data-node-kind": node.kind,
380
+ "data-progress": stateOf(node),
381
+ "aria-current": stateOf(node) === "current" ? "step" : void 0,
382
+ style: {
383
+ "--graph-row": String(node.column + 1),
384
+ "--graph-lane": String(node.row + 1),
385
+ "--graph-span": String(node.rowSpan)
386
+ },
387
+ children: node.kind === "stage" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
388
+ className: "relative max-w-full",
389
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(NodeLink, {
390
+ step: node.step,
391
+ box: true,
392
+ plain,
393
+ current: selected === node.step.id,
394
+ onSelect,
395
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressNote, {
396
+ progress,
397
+ state: stateOf(node)
398
+ })
399
+ }), plain ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CountBadge, {
400
+ count: counts[node.id],
401
+ name: countName(node.id, node.step.label, counts[node.id] ?? 0)
402
+ })]
403
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
404
+ className: "workflow-graph-box workflow-graph-group relative",
405
+ "data-map-group": "human",
406
+ "data-current": node.steps.some((step) => step.id === selected) ? "true" : void 0,
407
+ children: [
408
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
409
+ className: "workflow-graph-group-label",
410
+ children: "Human review"
411
+ }),
412
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", { children: node.steps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NodeLink, {
413
+ step,
414
+ plain,
415
+ current: selected === step.id,
416
+ onSelect
417
+ }) }, step.id)) }),
418
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressNote, {
419
+ progress,
420
+ state: stateOf(node)
421
+ }),
422
+ plain ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CountBadge, {
423
+ count: counts.reviews,
424
+ name: countName("reviews", "Human review", counts.reviews ?? 0)
425
+ })
426
+ ]
427
+ })
428
+ }, node.id))
429
+ })
430
+ ]
431
+ });
432
+ }
433
+ /** Explains the graph's visual marks; the panel states the same facts per stage. */
434
+ function GraphLegend() {
435
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("ul", {
436
+ className: "workflow-graph-legend",
437
+ "aria-hidden": "true",
438
+ children: [
439
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { className: "workflow-legend-optional" }), "optional"] }),
440
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { className: "workflow-graph-openspec" }), "OpenSpec"] }),
441
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { className: "workflow-legend-session" }), "new session"] }),
442
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { className: "workflow-legend-skip" }), "can be skipped"] })
443
+ ]
444
+ });
445
+ }
446
+ /** The current node's note, plus the done mark for assistive technology. */
447
+ function ProgressNote({ progress, state }) {
448
+ if (state === "done") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
449
+ className: "sr-only",
450
+ children: ", done"
451
+ });
452
+ if (state !== "current" || !progress?.note) return null;
453
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
454
+ className: "workflow-graph-note",
455
+ children: progress.note
456
+ });
457
+ }
458
+ function GraphLayer({ graph, stateOf }) {
459
+ /** A flow edge into a done or current node is the way the item came. */
460
+ const travelled = (edge) => {
461
+ const to = graph.nodes.find((node) => node.id === edge.to);
462
+ const state = to ? stateOf(to) : void 0;
463
+ return edge.kind === "flow" && (state === "done" || state === "current");
464
+ };
465
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", {
466
+ className: "workflow-graph-layer",
467
+ "aria-hidden": "true",
468
+ focusable: "false",
469
+ children: [
470
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
471
+ viewBox: `0 0 ${graphAcross(graph)} ${graph.columns}`,
472
+ preserveAspectRatio: "none",
473
+ overflow: "visible",
474
+ children: graph.edges.map((edge) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
475
+ className: "workflow-graph-edge",
476
+ d: edgePath(graph, edge),
477
+ "data-edge-kind": edge.kind,
478
+ "data-edge-from": edge.from,
479
+ "data-edge-to": edge.to,
480
+ "data-new-session": edge.newSession ? "true" : void 0,
481
+ "data-travelled": travelled(edge) ? "true" : void 0
482
+ }, `${edge.kind}-${edge.from}-${edge.to}`))
483
+ }),
484
+ graph.nodes.map((node) => {
485
+ if (node.kind !== "start") return null;
486
+ const { x, y } = percentOf(graph, nodeCenter(node));
487
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", {
488
+ className: "workflow-graph-start",
489
+ cx: x,
490
+ cy: y,
491
+ r: "3.5"
492
+ }, node.id);
493
+ }),
494
+ graph.edges.map((edge) => {
495
+ if (!edge.newSession) return null;
496
+ const { x, y } = percentOf(graph, edgeMidpoint(graph, edge));
497
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", {
498
+ className: "workflow-graph-session",
499
+ "data-session-mark": edge.to,
500
+ cx: x,
501
+ cy: y,
502
+ r: "3.5"
503
+ }, `${edge.from}-${edge.to}`);
504
+ })
505
+ ]
506
+ });
507
+ }
508
+ /**
509
+ * `box` marks a standalone node; stages inside the review group share its box. `plain` renders
510
+ * a label, for a map that opens nothing.
511
+ */
512
+ function NodeLink({ step, box, plain, current, onSelect, children }) {
513
+ const shared = {
514
+ className: box ? "workflow-graph-link workflow-graph-box" : "workflow-graph-link",
515
+ "data-map-stage": step.id,
516
+ "data-stage-kind": step.kind,
517
+ "data-optional": step.optional ? "true" : void 0
518
+ };
519
+ const body = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
520
+ step.badges.includes("openspec") ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
521
+ className: "workflow-graph-openspec",
522
+ "aria-hidden": "true"
523
+ }) : null,
524
+ step.kind === "human" ? step.artifact : step.label,
525
+ children
526
+ ] });
527
+ if (plain) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
528
+ ...shared,
529
+ children: body
530
+ });
531
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
532
+ type: "button",
533
+ ...shared,
534
+ "aria-label": step.kind === "human" ? step.label : void 0,
535
+ "aria-current": current ? "true" : void 0,
536
+ onClick: () => onSelect?.(step.id),
537
+ children: body
538
+ });
539
+ }
540
+ /** One stage in the panel: what it does, how it runs, and the changes at it. */
541
+ function StageDetail({ step, changes }) {
542
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("article", {
543
+ className: "workflow-card",
544
+ "data-stage": step.id,
545
+ "data-stage-kind": step.kind,
546
+ "data-optional": step.optional ? "true" : void 0,
547
+ children: [
548
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PanelHead, {
549
+ title: step.label,
550
+ kicker: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
551
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: PHASE_LABELS[step.phase] }),
552
+ step.optional ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "· optional" }) : null,
553
+ step.kind === "human" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
554
+ className: "text-why",
555
+ children: "· human review"
556
+ }) : null,
557
+ step.badges.includes("openspec") ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "· OpenSpec" }) : null
558
+ ] }),
559
+ children: step.skill || step.sessionBreakBefore ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
560
+ className: "m-0 flex flex-wrap items-center gap-2 text-sm text-muted",
561
+ children: [step.skill ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
562
+ className: "font-mono text-text",
563
+ children: step.skill
564
+ }) : null, step.sessionBreakBefore ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
565
+ className: "workflow-card-session inline-flex items-center gap-1.5 text-accent",
566
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
567
+ className: "size-2 rounded-full border-[1.5px] border-accent",
568
+ "aria-hidden": "true"
569
+ }), "New session / clean chat"]
570
+ }) : null]
571
+ }) : null
572
+ }),
573
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(PanelSection, {
574
+ title: step.kind === "human" ? "How it runs" : "Run",
575
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StageRun, { step }), step.missingSkill ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
576
+ className: "workflow-missing-skill m-0 text-sm text-warn",
577
+ role: "note",
578
+ children: [
579
+ "Skill not reported for this companion:",
580
+ " ",
581
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
582
+ className: "font-mono",
583
+ children: step.missingSkill
584
+ }),
585
+ ". Run",
586
+ " ",
587
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
588
+ className: "font-mono",
589
+ children: "mate companion update"
590
+ }),
591
+ "; this stage is not complete."
592
+ ]
593
+ }) : null]
594
+ }),
595
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PanelSection, {
596
+ title: "What",
597
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
598
+ className: "m-0 text-sm leading-relaxed",
599
+ children: step.what
600
+ })
601
+ }),
602
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PanelSection, {
603
+ title: "Why",
604
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
605
+ className: "m-0 text-sm leading-relaxed",
606
+ children: step.why
607
+ })
608
+ }),
609
+ changes.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PanelSection, {
610
+ title: "Changes at this stage",
611
+ aside: String(changes.length),
612
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", {
613
+ className: "m-0 grid list-none gap-1 p-0",
614
+ children: changes.map((name) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", {
615
+ className: "truncate font-mono text-sm",
616
+ children: name
617
+ }, name))
618
+ })
619
+ }) : null
620
+ ]
621
+ });
622
+ }
623
+ /** How a stage runs: a person's review, a choice of prompts, or its one prompt. */
624
+ function StageRun({ step }) {
625
+ if (step.kind === "human") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
626
+ className: "workflow-card-human m-0 text-sm",
627
+ children: [
628
+ "Review ",
629
+ step.artifact,
630
+ " yourself — no skill, no prompt"
631
+ ]
632
+ });
633
+ if (step.alternatives?.length) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
634
+ className: "workflow-option-list grid gap-3",
635
+ children: step.alternatives.map((alternative) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
636
+ className: "workflow-option grid gap-1.5",
637
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CommandLine, {
638
+ text: alternative.prompt,
639
+ copy: alternative.copyPrompt,
640
+ label: `${alternative.name} prompt`
641
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", {
642
+ className: "text-xs text-muted",
643
+ children: alternative.description
644
+ })]
645
+ }, alternative.name))
646
+ });
647
+ if (!step.prompt) return null;
648
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CommandLine, {
649
+ text: step.prompt,
650
+ copy: step.copyPrompt ?? step.prompt,
651
+ label: `${step.label} prompt`
652
+ });
653
+ }
654
+ export { WorkflowGraphView as n, DeliveryPathView as t };