@uniqbit/mate-core 1.0.0-canary.2 → 1.0.0-canary.5

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 (189) hide show
  1. package/claude-capability-plugins/companion-mentions/.claude-plugin/plugin.json +1 -1
  2. package/claude-plugin/hooks/hooks.json +21 -1
  3. package/claude-plugin/hooks/session-attention.mjs +10 -0
  4. package/claude-plugin/hooks/session-end.mjs +9 -0
  5. package/claude-plugin/hooks/session-guidance.mjs +1 -1
  6. package/opencode-plugin/src/server.ts +13 -2
  7. package/opencode-plugin/src/tui.tsx +1 -1
  8. package/opencode-plugin/tui.tsx +2 -1
  9. package/package.json +1 -1
  10. package/src/cli/commands/artifact/delivery/archive.ts +2 -2
  11. package/src/cli/commands/artifact/delivery/link.ts +22 -5
  12. package/src/cli/commands/artifact/delivery/output.ts +9 -1
  13. package/src/cli/commands/artifact/finish/openspec.ts +1 -3
  14. package/src/cli/commands/companion/companion.ts +1 -1
  15. package/src/cli/commands/companion/link.ts +36 -4
  16. package/src/cli/commands/companion/open.ts +40 -12
  17. package/src/cli/commands/doctor.ts +122 -0
  18. package/src/cli/commands/session/prepare.ts +32 -4
  19. package/src/cli/commands/session/registry.ts +90 -0
  20. package/src/cli/commands/studio/companion-removal.ts +79 -0
  21. package/src/cli/commands/studio/mate-inventory.ts +1 -1
  22. package/src/cli/commands/studio/payload.ts +12 -1
  23. package/src/cli/commands/studio/server.ts +39 -16
  24. package/src/cli/commands/studio/services.ts +20 -0
  25. package/src/cli/commands/studio/skill-files.ts +133 -0
  26. package/src/cli/commands/studio/vault.ts +218 -44
  27. package/src/cli/commands/studio/views/model.ts +0 -5
  28. package/src/cli/commands/studio/views/vault/markdown-tree.ts +255 -4
  29. package/src/cli/commands/unwrap.ts +8 -0
  30. package/src/cli/commands/update.ts +26 -8
  31. package/src/cli/commands/vscode/setup.ts +155 -0
  32. package/src/cli/commands/vscode/vsix.ts +73 -0
  33. package/src/cli/commands/working/cleanup.ts +34 -10
  34. package/src/cli/commands/working/worktree.ts +58 -8
  35. package/src/cli/commands/wrap.ts +33 -7
  36. package/src/cli/main.ts +9 -2
  37. package/src/cli/usage.ts +6 -1
  38. package/src/hooks/companion-instructions.ts +19 -11
  39. package/src/hooks/hook-io.ts +15 -0
  40. package/src/hooks/session-banner.ts +5 -3
  41. package/src/hooks/session-end.ts +10 -0
  42. package/src/hooks/session-guidance.ts +10 -6
  43. package/src/hooks/session-prepare.ts +47 -31
  44. package/src/hooks/session-register.ts +199 -0
  45. package/src/hooks/tokensave-route.ts +7 -3
  46. package/src/hooks/validate-artifact-path.ts +9 -2
  47. package/src/lib/delivery/archive-change.ts +0 -1
  48. package/src/lib/delivery/branches.ts +15 -0
  49. package/src/lib/delivery/record-delivery.ts +94 -39
  50. package/src/lib/delivery/record.ts +30 -28
  51. package/src/lib/delivery/refresh.ts +37 -17
  52. package/src/lib/delivery/resolve-branch.ts +258 -37
  53. package/src/lib/factory/outcomes/index.ts +11 -1
  54. package/src/lib/factory/runtime.ts +10 -1
  55. package/src/lib/opencode-server.ts +238 -0
  56. package/src/lib/orchestrator/adapters/claude.ts +147 -2
  57. package/src/lib/orchestrator/adapters/opencode.ts +53 -2
  58. package/src/lib/orchestrator/checkout-adoption.ts +125 -0
  59. package/src/lib/orchestrator/companion-registry-store.ts +6 -2
  60. package/src/lib/orchestrator/editor.ts +2 -2
  61. package/src/lib/orchestrator/framework-context.ts +26 -14
  62. package/src/lib/orchestrator/global-config-store.ts +11 -0
  63. package/src/lib/orchestrator/launcher.ts +15 -2
  64. package/src/lib/orchestrator/projection-claude-links.ts +52 -5
  65. package/src/lib/orchestrator/projection-claude-skills.ts +28 -2
  66. package/src/lib/orchestrator/projection-companion-link.ts +12 -1
  67. package/src/lib/orchestrator/registry-checkouts.ts +177 -0
  68. package/src/lib/orchestrator/repository-link.ts +216 -57
  69. package/src/lib/orchestrator/serving-claude-wrap.ts +43 -0
  70. package/src/lib/orchestrator/session-context-link.ts +11 -5
  71. package/src/lib/orchestrator/session-prepare.ts +36 -6
  72. package/src/lib/orchestrator/types.ts +5 -0
  73. package/src/lib/orchestrator/workspace-inventory.ts +5 -1
  74. package/src/lib/public-npm.ts +17 -0
  75. package/src/lib/session-attribution.ts +52 -0
  76. package/src/lib/session-state.ts +285 -0
  77. package/src/lib/session-stop.ts +64 -0
  78. package/src/lib/workset/record.ts +20 -0
  79. package/src/lib/workset/worktree.ts +85 -17
  80. package/src/opencode/background-server.ts +145 -0
  81. package/src/opencode/companion-hooks.ts +3 -1
  82. package/src/opencode/companion-policy.ts +2 -2
  83. package/src/opencode/projected-guidance.ts +2 -1
  84. package/src/opencode/session-register.ts +176 -0
  85. package/src/opencode/tui.tsx +19 -29
  86. package/src/runtime/claude-delivery-plan.ts +14 -3
  87. package/src/runtime/current-branch.ts +10 -0
  88. package/src/runtime/env.ts +13 -7
  89. package/src/runtime/git-layout.ts +164 -17
  90. package/src/runtime/launch-env-guard.ts +65 -0
  91. package/src/runtime/opencode-server-record.ts +136 -0
  92. package/src/runtime/projection.ts +40 -6
  93. package/src/runtime/repo-local.ts +6 -1
  94. package/src/runtime/serving-claude-wrap.ts +28 -0
  95. package/src/runtime/session-context.ts +4 -3
  96. package/src/runtime/session-registry.ts +434 -0
  97. package/src/runtime/tokensave-route.ts +10 -5
  98. package/src/runtime/wrap-state.ts +31 -0
  99. package/src/studio.ts +2 -0
  100. package/src/templates/mate-skills/agents/mate-apply-change/SKILL.md +49 -21
  101. package/src/templates/mate-skills/agents/mate-archive-change/SKILL.md +0 -5
  102. package/src/templates/mate-skills/agents/mate-propose-change/SKILL.md +2 -8
  103. package/src/templates/mate-skills/agents/mate-propose-change/references/mate-revise.md +1 -3
  104. package/src/templates/mate-skills/agents/mate-publish-artifact/SKILL.md +2 -4
  105. package/src/templates/mate-skills/claude/mate-apply-change/SKILL.md +49 -21
  106. package/src/templates/mate-skills/claude/mate-archive-change/SKILL.md +0 -5
  107. package/src/templates/mate-skills/claude/mate-propose-change/SKILL.md +2 -8
  108. package/src/templates/mate-skills/claude/mate-propose-change/references/mate-revise.md +1 -3
  109. package/src/templates/mate-skills/claude/mate-publish-artifact/SKILL.md +2 -4
  110. package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +404 -30
  111. package/src/tools/setup/dynamic-plugins/hydrate.ts +4 -3
  112. package/src/tools/setup/providers/claude-plugin-hooks.ts +26 -0
  113. package/src/tools/setup/providers/claude.ts +21 -1
  114. package/studio-dist/client/assets/app-CdPiFv59.css +2 -0
  115. package/studio-dist/client/assets/button-BIIHE0EQ.js +3 -0
  116. package/studio-dist/client/assets/companion-view-DM6YyXaR.js +1 -0
  117. package/studio-dist/client/assets/delivery-path-DELxj0Av.js +1 -0
  118. package/studio-dist/client/assets/factory-BZy0E8ty.js +4 -0
  119. package/studio-dist/client/assets/index-B3wkMzjA.js +40 -0
  120. package/studio-dist/client/assets/markdown-view-pQ2Qp_i5.js +1 -0
  121. package/studio-dist/client/assets/panel-CbajlC3p.js +1 -0
  122. package/studio-dist/client/assets/{prepaint-CD5OpmTM.js → prepaint-CwSrpdFA.js} +7 -4
  123. package/studio-dist/client/assets/react-CN2GSx7x.js +1 -0
  124. package/studio-dist/client/assets/reports-DllhYQ5_.js +1 -0
  125. package/studio-dist/client/assets/routes-COm-G3mK.js +1 -0
  126. package/studio-dist/client/assets/skills-DmWAy-jZ.js +1 -0
  127. package/studio-dist/client/assets/specs-BG3Wi3ln.js +1 -0
  128. package/studio-dist/client/assets/steps-DFsH3Neu.js +1 -0
  129. package/studio-dist/client/assets/vault-B2q1nBY5.js +1 -0
  130. package/studio-dist/client/assets/warnings-BSXIyuSQ.js +1 -0
  131. package/studio-dist/client/assets/workflow-DlsQD6Hc.js +1 -0
  132. package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-BQKuMdJW.js → __23tanstack-start-server-fn-resolver-M2GBs8s3.js} +179 -9
  133. package/studio-dist/server/assets/_tanstack-start-manifest_v.js +35 -25
  134. package/studio-dist/server/assets/button-CIJqAhni.js +11929 -0
  135. package/studio-dist/server/assets/{companion-view-aBady57v.js → companion-view-DISASvdJ.js} +13 -7
  136. package/studio-dist/server/assets/companions-BYbHWKOZ.js +15 -0
  137. package/studio-dist/server/assets/delivery-path-C29fBynY.js +654 -0
  138. package/studio-dist/server/assets/{factory-DT3UzHlh.js → factory-DGPmNGbo.js} +1 -0
  139. package/studio-dist/server/assets/{factory-D6xnjedJ.js → factory-DUTa0eDs.js} +317 -530
  140. package/studio-dist/server/assets/markdown-view-Bn7xPdks.js +86 -0
  141. package/studio-dist/server/assets/panel-3Jmn4awF.js +169 -0
  142. package/studio-dist/server/assets/{prepaint-BMke0fo1.js → prepaint-DJfTQ_VH.js} +6 -2
  143. package/studio-dist/server/assets/{react-COs0LHn-.js → react-Ce6dj15C.js} +4 -9
  144. package/studio-dist/server/assets/reports-C06RXVE2.js +18 -0
  145. package/studio-dist/server/assets/reports-D6YMqhnO.js +142 -0
  146. package/studio-dist/server/assets/router-C8MGqlAY.js +13713 -0
  147. package/studio-dist/server/assets/routes-BcFgvqf7.js +622 -0
  148. package/studio-dist/server/assets/{shell-CboT2f66.js → shell-DS3wUexh.js} +1 -0
  149. package/studio-dist/server/assets/skills-BEnOxiDl.js +266 -0
  150. package/studio-dist/server/assets/skills-CtrBAtX3.js +28 -0
  151. package/studio-dist/server/assets/specs-C8rv34-5.js +211 -0
  152. package/studio-dist/server/assets/{start-BW5ovN0k.js → start-h3ICWwd2.js} +4 -1
  153. package/studio-dist/server/assets/steps-Dq_CwY_s.js +181 -0
  154. package/studio-dist/server/assets/{vault-BGulVoNh.js → vault-BmWnryh3.js} +16 -1
  155. package/studio-dist/server/assets/vault-Fvxt2Tzl.js +1032 -0
  156. package/studio-dist/server/assets/{views-Bd7cRr27.js → views-BgYa-za2.js} +1 -3
  157. package/studio-dist/server/assets/warnings-DzR6fyZh.js +23 -0
  158. package/studio-dist/server/assets/workflow-liRYecHk.js +73 -0
  159. package/studio-dist/server/server.js +3 -157
  160. package/studio-dist/client/assets/companion-view-Csva26Ir.js +0 -1
  161. package/studio-dist/client/assets/delivery-path-DJMpRmiY.js +0 -1
  162. package/studio-dist/client/assets/factory-B7l9ZQyx.js +0 -4
  163. package/studio-dist/client/assets/index-n6uo_92S.js +0 -40
  164. package/studio-dist/client/assets/queries-CN3JwMBX.js +0 -1
  165. package/studio-dist/client/assets/react-CabXf2Ds.js +0 -1
  166. package/studio-dist/client/assets/report-time-Dc-KOqQu.js +0 -1
  167. package/studio-dist/client/assets/reports-C01RsnMA.js +0 -1
  168. package/studio-dist/client/assets/routes-4pbC-2Hj.js +0 -1
  169. package/studio-dist/client/assets/skills-CihQganl.js +0 -1
  170. package/studio-dist/client/assets/spec-areas-C2L48N4C.js +0 -1
  171. package/studio-dist/client/assets/specs-D24_35_K.js +0 -1
  172. package/studio-dist/client/assets/studio-DKxfi691.css +0 -1
  173. package/studio-dist/client/assets/studio-queries-rvbJupCy.js +0 -3
  174. package/studio-dist/client/assets/vault-Bd4CQiTK.js +0 -1
  175. package/studio-dist/client/assets/warnings-V_Ys51wJ.js +0 -1
  176. package/studio-dist/client/assets/workflow-BJejeVwQ.js +0 -1
  177. package/studio-dist/server/assets/delivery-path-BkKNjgkf.js +0 -778
  178. package/studio-dist/server/assets/queries-Ag2iL8q2.js +0 -107
  179. package/studio-dist/server/assets/report-time-DAfzln-N.js +0 -8
  180. package/studio-dist/server/assets/reports-BnUNJVtx.js +0 -126
  181. package/studio-dist/server/assets/router-BH--drIx.js +0 -4298
  182. package/studio-dist/server/assets/routes-khSDK1bV.js +0 -361
  183. package/studio-dist/server/assets/skills-MWYnWoKs.js +0 -106
  184. package/studio-dist/server/assets/spec-areas-DcnO6vW-.js +0 -16
  185. package/studio-dist/server/assets/specs-DE3w8hZP.js +0 -155
  186. package/studio-dist/server/assets/studio-queries-CLnP9kGu.js +0 -3365
  187. package/studio-dist/server/assets/vault-CuyyhLyB.js +0 -832
  188. package/studio-dist/server/assets/warnings-BH05rOuG.js +0 -15
  189. package/studio-dist/server/assets/workflow-BSuIKWqH.js +0 -42
@@ -0,0 +1,622 @@
1
+ import { i as __toESM } from "./rolldown-runtime-DYf_mQCB.js";
2
+ import { t as CompanionView } from "./companion-view-DISASvdJ.js";
3
+ import { $ as CommandLine, Ar as cn, Bi as Link, Gr as vaultChildrenQuery, Q as Age, Vi as useNavigate, at as Pills, ct as StatusWord, et as Count, fi as useQuery, nt as ListCard, ot as Progress, qr as vaultQuery, r as Icon, rt as PAGE_PAD, st as ROW, t as Button, tt as EmptyNote } from "./button-CIJqAhni.js";
4
+ import { j as require_react, u as require_jsx_runtime } from "./__23tanstack-start-server-fn-resolver-M2GBs8s3.js";
5
+ import { n as PanelSection, r as SidePanel, t as PanelHead } from "./panel-3Jmn4awF.js";
6
+ import { t as Warnings } from "./warnings-DzR6fyZh.js";
7
+ import { t as MarkdownView } from "./markdown-view-Bn7xPdks.js";
8
+ import { C as CHANGE_GROUPS, D as groupChanges, E as changeStep, T as changeGroup, c as Route, w as GROUP_TITLES } from "./router-C8MGqlAY.js";
9
+ // src/views/overview/changed-specs.ts
10
+ var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
11
+ /** Each capability once, at the newest shipped change that touched it. */
12
+ function recentlyChangedSpecs(shipped) {
13
+ const seen = /* @__PURE__ */ new Set();
14
+ const changed = [];
15
+ for (const change of shipped) for (const capability of change.specs) {
16
+ if (seen.has(capability)) continue;
17
+ seen.add(capability);
18
+ changed.push({
19
+ capability,
20
+ change: change.name,
21
+ archivedOn: change.archivedOn
22
+ });
23
+ }
24
+ return changed;
25
+ }
26
+ // src/views/overview/analyst-overview.tsx
27
+ var import_jsx_runtime = require_jsx_runtime();
28
+ var SHIPPED_LIMIT = 20;
29
+ var CHANGED_SPECS_LIMIT = 12;
30
+ var ARCHIVE_DIR = "openspec/changes/archive";
31
+ var specPath = (capability) => `openspec/specs/${capability}/spec.md`;
32
+ var LINK_ROW = cn(ROW, "grid grid-cols-[minmax(0,1fr)_auto] gap-x-4 py-2");
33
+ /** What shipped lately and the specs it changed; never active work. */
34
+ function AnalystOverview({ payload }) {
35
+ const [open, setOpen] = (0, import_react.useState)(null);
36
+ const shipped = payload.shipped.slice(0, SHIPPED_LIMIT);
37
+ const current = shipped.find((change) => change.anchor === open) ?? null;
38
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
39
+ className: "analyst-overview",
40
+ children: [
41
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Warnings, { warnings: payload.warnings }),
42
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
43
+ className: cn(PAGE_PAD, "@container pb-10"),
44
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
45
+ className: "grid grid-cols-[minmax(0,1.5fr)_minmax(0,1fr)] items-start gap-3 @max-[760px]:grid-cols-1",
46
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Shipped, {
47
+ all: payload.shipped.length,
48
+ shown: shipped,
49
+ current: open,
50
+ onOpen: setOpen
51
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChangedSpecs, { shipped: payload.shipped })]
52
+ })
53
+ }),
54
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidePanel, {
55
+ items: shipped.map((change) => change.anchor),
56
+ current: current?.anchor ?? null,
57
+ onSelect: setOpen,
58
+ title: current ? `Shipped change ${current.name}` : "Shipped change",
59
+ children: current ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShippedDetail, { change: current }) : null
60
+ })
61
+ ]
62
+ });
63
+ }
64
+ /** Consecutive changes archived on the same day; the list is newest first. */
65
+ function byDay(changes) {
66
+ const days = [];
67
+ for (const change of changes) {
68
+ const last = days.at(-1);
69
+ if (last?.[0] === change.archivedOn) last[1].push(change);
70
+ else days.push([change.archivedOn, [change]]);
71
+ }
72
+ return days;
73
+ }
74
+ /** The weekday of an archive date; fixed locale and zone, so server and browser agree. */
75
+ function weekday(day) {
76
+ const date = /* @__PURE__ */ new Date(`${day}T00:00:00Z`);
77
+ return Number.isNaN(date.getTime()) ? "" : date.toLocaleDateString("en", {
78
+ weekday: "long",
79
+ timeZone: "UTC"
80
+ });
81
+ }
82
+ function Shipped({ all, shown, current, onOpen }) {
83
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ListCard, {
84
+ title: "Recently shipped",
85
+ count: all,
86
+ hint: all > shown.length ? `newest ${shown.length}` : void 0,
87
+ children: shown.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
88
+ className: "empty m-0 px-4 py-3 text-sm text-muted",
89
+ children: "No shipped changes yet."
90
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", {
91
+ className: "analyst-days m-0 list-none p-0",
92
+ children: byDay(shown).map(([day, changes]) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", {
93
+ className: "border-t border-rule first:border-t-0",
94
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h3", {
95
+ className: "m-0 flex items-center gap-2 bg-[color-mix(in_srgb,var(--surface)_45%,transparent)] px-4 pt-2.5 pb-1.5 text-xs font-semibold text-muted",
96
+ children: [
97
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("time", {
98
+ dateTime: day,
99
+ className: "font-mono text-text",
100
+ children: day
101
+ }),
102
+ weekday(day),
103
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Count, { value: changes.length })
104
+ ]
105
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", {
106
+ className: "analyst-list m-0 list-none p-0",
107
+ children: changes.map((change) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
108
+ type: "button",
109
+ className: cn(ROW, "grid gap-0.5 py-2"),
110
+ "aria-current": current === change.anchor ? "true" : void 0,
111
+ onClick: () => onOpen(change.anchor),
112
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
113
+ className: "analyst-row-title truncate font-mono text-sm",
114
+ children: change.name
115
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
116
+ className: "truncate text-xs text-muted",
117
+ children: change.specs.length === 0 ? "no spec changes" : change.specs.join(", ")
118
+ })]
119
+ }) }, change.anchor))
120
+ })]
121
+ }, day))
122
+ })
123
+ });
124
+ }
125
+ function ShippedDetail({ change }) {
126
+ const dir = `${ARCHIVE_DIR}/${change.anchor}`;
127
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
128
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PanelHead, {
129
+ mono: true,
130
+ title: change.name,
131
+ kicker: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: ["Shipped ", change.archivedOn] })
132
+ }),
133
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PanelSection, {
134
+ title: "Proposal",
135
+ children: change.hasProposal ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Link, {
136
+ className: "inline-flex items-center gap-2 text-sm",
137
+ to: "/vault",
138
+ search: (previous) => ({
139
+ ...previous,
140
+ path: `${dir}/proposal.md`
141
+ }),
142
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: "doc" }), " Read the proposal"]
143
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
144
+ className: "m-0 text-sm text-muted",
145
+ children: [
146
+ "This change has no proposal.",
147
+ " ",
148
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
149
+ to: "/vault",
150
+ search: (previous) => ({
151
+ ...previous,
152
+ dir
153
+ }),
154
+ children: "Open its folder"
155
+ })
156
+ ]
157
+ })
158
+ }),
159
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PanelSection, {
160
+ title: "Specs it changed",
161
+ aside: String(change.specs.length),
162
+ children: change.specs.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
163
+ className: "m-0 text-sm text-muted",
164
+ children: "No spec changed."
165
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", {
166
+ className: "m-0 grid list-none gap-1 p-0",
167
+ children: change.specs.map((capability) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
168
+ className: "font-mono text-sm",
169
+ to: "/vault",
170
+ search: (previous) => ({
171
+ ...previous,
172
+ path: specPath(capability)
173
+ }),
174
+ children: capability
175
+ }) }, capability))
176
+ })
177
+ })
178
+ ] });
179
+ }
180
+ function ChangedSpecs({ shipped }) {
181
+ const shown = recentlyChangedSpecs(shipped).slice(0, CHANGED_SPECS_LIMIT);
182
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ListCard, {
183
+ title: "Recently changed specs",
184
+ hint: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
185
+ to: "/specs",
186
+ search: (previous) => previous,
187
+ children: "All specs"
188
+ }),
189
+ children: shown.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
190
+ className: "empty m-0 px-4 py-3 text-sm text-muted",
191
+ children: "No specs changed by shipped changes yet."
192
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", {
193
+ className: "analyst-list m-0 list-none p-0",
194
+ children: shown.map((spec, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Link, {
195
+ className: LINK_ROW,
196
+ to: "/vault",
197
+ search: (previous) => ({
198
+ ...previous,
199
+ path: specPath(spec.capability)
200
+ }),
201
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
202
+ className: "grid min-w-0 gap-0.5",
203
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
204
+ className: "analyst-row-title truncate font-mono text-sm",
205
+ children: spec.capability
206
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
207
+ className: "truncate text-xs text-muted",
208
+ children: ["by ", spec.change]
209
+ })]
210
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
211
+ className: "font-mono text-xs text-muted",
212
+ children: spec.archivedOn === shown[index - 1]?.archivedOn ? null : spec.archivedOn
213
+ })]
214
+ }) }, spec.capability))
215
+ })
216
+ });
217
+ }
218
+ // src/views/overview/artifacts.tsx
219
+ var CHANGES_DIR = "openspec/changes";
220
+ var changeDir = (change) => `${CHANGES_DIR}/${change.name}`;
221
+ var ITEM = "flex w-full min-w-0 items-center gap-2.5 rounded-control border-0 bg-transparent px-2 py-1 text-left text-sm text-text hover:bg-surface-soft disabled:cursor-default disabled:hover:bg-transparent";
222
+ function Check({ done }) {
223
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
224
+ className: cn("grid size-3.5 flex-none place-items-center rounded-[4px] border", done ? "border-accent bg-accent text-on-accent" : "border-rule bg-page"),
225
+ "aria-hidden": "true",
226
+ children: done ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
227
+ name: "check",
228
+ className: "size-2.5 [stroke-width:2.4]"
229
+ }) : null
230
+ });
231
+ }
232
+ /** The change's spec deltas, one file per capability folder. */
233
+ function SpecFiles({ companion, dir, onRead }) {
234
+ const folders = useQuery(vaultChildrenQuery(companion, `${dir}/specs`));
235
+ if (folders.isPending) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
236
+ className: "m-0 pl-8 text-xs text-muted",
237
+ children: "Listing specs…"
238
+ });
239
+ const specs = (folders.data?.entries ?? []).filter((entry) => entry.kind === "directory");
240
+ if (folders.isError || specs.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
241
+ className: "m-0 pl-8 text-xs text-muted",
242
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
243
+ to: "/vault",
244
+ search: (previous) => ({
245
+ ...previous,
246
+ dir: `${dir}/specs`
247
+ }),
248
+ children: "Open the specs folder"
249
+ })
250
+ });
251
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", {
252
+ className: "m-0 grid list-none gap-0.5 p-0 pl-6",
253
+ children: specs.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
254
+ type: "button",
255
+ className: ITEM,
256
+ "data-artifact-file": `${entry.path}/spec.md`,
257
+ onClick: () => onRead(`${entry.path}/spec.md`),
258
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
259
+ name: "doc",
260
+ className: "flex-none text-muted"
261
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
262
+ className: "truncate font-mono text-xs",
263
+ children: entry.name
264
+ })]
265
+ }) }, entry.path))
266
+ });
267
+ }
268
+ /** The artifacts the Delivery Path writes, in its order; a written one opens to read. */
269
+ function Artifacts({ change, companion, onRead }) {
270
+ if (change.artifacts.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
271
+ className: "m-0 text-sm text-muted",
272
+ children: "No artifacts yet."
273
+ });
274
+ const dir = changeDir(change);
275
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", {
276
+ className: "m-0 -mx-2 grid list-none gap-0.5 p-0",
277
+ children: change.artifacts.map((artifact) => {
278
+ const done = artifact.status === "done";
279
+ const readable = done && companion !== void 0;
280
+ const folder = artifact.id === "specs";
281
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
282
+ type: "button",
283
+ className: ITEM,
284
+ disabled: !readable || folder,
285
+ "data-artifact": artifact.id,
286
+ onClick: () => onRead(`${dir}/${artifact.id}.md`),
287
+ children: [
288
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Check, { done }),
289
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
290
+ className: done ? "text-text" : "text-muted",
291
+ children: artifact.id
292
+ }),
293
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
294
+ className: "ml-auto text-xs text-muted",
295
+ children: !done ? "not yet" : folder ? "per capability" : "read"
296
+ }),
297
+ readable && !folder ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
298
+ name: "right",
299
+ className: "text-muted"
300
+ }) : null
301
+ ]
302
+ }), readable && folder ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SpecFiles, {
303
+ companion,
304
+ dir,
305
+ onRead
306
+ }) : null] }, artifact.id);
307
+ })
308
+ });
309
+ }
310
+ /** One artifact read in the panel, so a review needs no trip to the Vault. */
311
+ function ArtifactReader({ companion, path, change, onBack }) {
312
+ const file = useQuery(vaultQuery(companion, { path }));
313
+ const markdown = file.data?.open?.markdown;
314
+ const name = path.slice(changeDir(change).length + 1);
315
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
316
+ className: "grid content-start gap-3 px-5 py-4",
317
+ "aria-label": `Artifact ${name}`,
318
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
319
+ className: "flex items-center gap-2",
320
+ children: [
321
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
322
+ size: "sm",
323
+ variant: "ghost",
324
+ className: "-ml-2",
325
+ onClick: onBack,
326
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: "left" }), " Artifacts"]
327
+ }),
328
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
329
+ className: "min-w-0 truncate font-mono text-xs text-muted",
330
+ children: name
331
+ }),
332
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Link, {
333
+ className: "ml-auto inline-flex flex-none items-center gap-1.5 text-xs",
334
+ to: "/vault",
335
+ search: (previous) => ({
336
+ ...previous,
337
+ path
338
+ }),
339
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
340
+ name: "external",
341
+ className: "size-3.5"
342
+ }), " Open in Vault"]
343
+ })
344
+ ]
345
+ }), markdown ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
346
+ className: "prose-panel",
347
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MarkdownView, { nodes: markdown })
348
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
349
+ className: "m-0 text-sm text-muted",
350
+ children: file.isPending ? "Loading…" : "The file could not be read."
351
+ })]
352
+ });
353
+ }
354
+ // src/views/overview/changes.tsx
355
+ var GROUP_HINTS = {
356
+ "needs-you": "Review or fix before the build goes on",
357
+ building: "An agent is working through the tasks",
358
+ ready: "Every task is done"
359
+ };
360
+ /** A change's status word and marker shape. */
361
+ function status(change) {
362
+ if (change.valid === false) return {
363
+ marker: "issue",
364
+ word: "Invalid"
365
+ };
366
+ const group = changeGroup(change);
367
+ if (group === "needs-you") return (change.totalTasks ?? 0) === 0 ? {
368
+ marker: "warn",
369
+ word: "No tasks"
370
+ } : {
371
+ marker: "review",
372
+ word: "Review"
373
+ };
374
+ if (group === "building") return {
375
+ marker: "build",
376
+ word: "Building"
377
+ };
378
+ return {
379
+ marker: "done",
380
+ word: "Ready"
381
+ };
382
+ }
383
+ var PATH_STAGES = [
384
+ "Propose change",
385
+ "Human review",
386
+ "Apply change",
387
+ "Archive change"
388
+ ];
389
+ /** Where the change is on the Delivery Path, as four steps. */
390
+ function PathSteps({ stage }) {
391
+ const at = PATH_STAGES.indexOf(stage);
392
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", {
393
+ className: "m-0 grid list-none grid-cols-4 gap-1 p-0",
394
+ "aria-label": "Delivery Path",
395
+ children: PATH_STAGES.map((name, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", {
396
+ "aria-current": index === at ? "step" : void 0,
397
+ className: cn("grid gap-1.5 text-2xs text-muted before:h-1 before:rounded-full before:bg-rule before:content-['']", index < at && "before:bg-[color-mix(in_srgb,var(--accent)_55%,var(--border))]", index === at && "font-semibold text-text before:bg-accent", index === at && name === "Human review" && "before:bg-why"),
398
+ children: name
399
+ }, name))
400
+ });
401
+ }
402
+ function ChangeDetail({ change, companion, reading, onRead }) {
403
+ const step = changeStep(change);
404
+ const { marker, word } = status(change);
405
+ const artifacts = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PanelSection, {
406
+ title: "Artifacts",
407
+ aside: change.schemaName,
408
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Artifacts, {
409
+ change,
410
+ companion,
411
+ onRead
412
+ })
413
+ });
414
+ const review = changeGroup(change) === "needs-you";
415
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PanelHead, {
416
+ mono: true,
417
+ title: change.name,
418
+ kicker: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusWord, {
419
+ marker,
420
+ children: word
421
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Age, {
422
+ at: change.lastModified,
423
+ className: "ml-auto"
424
+ })] }),
425
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
426
+ className: "m-0 text-sm text-muted",
427
+ children: step.situation
428
+ })
429
+ }), reading && companion ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArtifactReader, {
430
+ companion,
431
+ path: reading,
432
+ change,
433
+ onBack: () => onRead(null)
434
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
435
+ review ? artifacts : null,
436
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PanelSection, {
437
+ title: "Delivery Path",
438
+ aside: step.stage,
439
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PathSteps, { stage: step.stage })
440
+ }),
441
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(PanelSection, {
442
+ title: "Next step",
443
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
444
+ className: "m-0 text-sm",
445
+ children: [step.next, "."]
446
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CommandLine, { text: step.prompt })]
447
+ }),
448
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PanelSection, {
449
+ title: "Tasks",
450
+ aside: `${change.completedTasks ?? 0}/${change.totalTasks ?? 0}`,
451
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Progress, {
452
+ done: change.completedTasks ?? 0,
453
+ total: change.totalTasks ?? 0
454
+ })
455
+ }),
456
+ review ? null : artifacts
457
+ ] })] });
458
+ }
459
+ function ChangeRow({ change, current, onOpen }) {
460
+ const { marker, word } = status(change);
461
+ const step = changeStep(change);
462
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
463
+ type: "button",
464
+ className: cn(ROW, "grid grid-cols-[minmax(0,1fr)_120px_150px_72px] @max-[640px]:grid-cols-[minmax(0,1fr)_auto]"),
465
+ "aria-current": current ? "true" : void 0,
466
+ "data-change": change.name,
467
+ onClick: onOpen,
468
+ children: [
469
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
470
+ className: "grid min-w-0 gap-0.5",
471
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
472
+ className: "truncate font-mono text-sm",
473
+ children: change.name
474
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
475
+ className: cn("truncate text-xs", change.valid === false ? "text-bad" : "text-muted"),
476
+ children: step.situation
477
+ })]
478
+ }),
479
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusWord, {
480
+ marker,
481
+ children: word
482
+ }),
483
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
484
+ className: "@max-[640px]:hidden",
485
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Progress, {
486
+ done: change.completedTasks ?? 0,
487
+ total: change.totalTasks ?? 0
488
+ })
489
+ }),
490
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Age, {
491
+ at: change.lastModified,
492
+ className: "text-right @max-[640px]:hidden"
493
+ })
494
+ ]
495
+ }) });
496
+ }
497
+ /** Active changes in up to three groups by what they need; detail opens in the panel. */
498
+ function Changes({ changes, selected, companion }) {
499
+ const navigate = useNavigate();
500
+ const [filter, setFilter] = (0, import_react.useState)("all");
501
+ const [pass, setPass] = (0, import_react.useState)(false);
502
+ const [reading, setReading] = (0, import_react.useState)(null);
503
+ const groups = groupChanges(changes);
504
+ const shown = CHANGE_GROUPS.filter((group) => filter === "all" || filter === group);
505
+ const listed = shown.flatMap((group) => groups[group]);
506
+ const walk = pass ? groups["needs-you"] : listed;
507
+ const current = changes.find((change) => change.name === selected) ?? null;
508
+ const readingPath = reading && reading.change === current?.name ? reading.path : null;
509
+ const select = (name) => {
510
+ if (name === null) setPass(false);
511
+ navigate({
512
+ to: ".",
513
+ search: (previous) => ({
514
+ ...previous,
515
+ change: name ?? void 0
516
+ }),
517
+ replace: true
518
+ });
519
+ };
520
+ if (changes.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("section", {
521
+ className: cn(PAGE_PAD, "pb-10"),
522
+ "aria-label": "Changes",
523
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyNote, { children: "No change is in flight in this companion." })
524
+ });
525
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
526
+ className: cn(PAGE_PAD, "@container grid content-start gap-3 pb-10"),
527
+ "aria-label": "Changes",
528
+ children: [
529
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
530
+ className: "flex flex-wrap items-center gap-2",
531
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pills, {
532
+ label: "Show changes",
533
+ value: filter,
534
+ onChange: setFilter,
535
+ options: [{
536
+ value: "all",
537
+ label: "All",
538
+ count: changes.length
539
+ }, ...CHANGE_GROUPS.map((group) => ({
540
+ value: group,
541
+ label: GROUP_TITLES[group],
542
+ count: groups[group].length,
543
+ tone: group === "needs-you" ? "warn" : void 0
544
+ }))]
545
+ }), groups["needs-you"].length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
546
+ variant: "primary",
547
+ size: "sm",
548
+ className: "ml-auto",
549
+ onClick: () => {
550
+ setPass(true);
551
+ select(groups["needs-you"][0].name);
552
+ },
553
+ children: ["Start review pass", /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Count, { value: groups["needs-you"].length })]
554
+ }) : null]
555
+ }),
556
+ shown.map((group) => groups[group].length === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ListCard, {
557
+ title: GROUP_TITLES[group],
558
+ count: groups[group].length,
559
+ hint: GROUP_HINTS[group],
560
+ tone: group === "needs-you" ? "warn" : void 0,
561
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", {
562
+ className: "m-0 list-none p-0",
563
+ children: groups[group].map((change) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChangeRow, {
564
+ change,
565
+ current: change.name === selected,
566
+ onOpen: () => {
567
+ setPass(false);
568
+ select(change.name);
569
+ }
570
+ }, change.name))
571
+ })
572
+ }, group)),
573
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidePanel, {
574
+ items: walk.map((change) => change.name),
575
+ current: current?.name ?? null,
576
+ onSelect: select,
577
+ pass: pass ? "Needs you" : void 0,
578
+ wide: readingPath !== null,
579
+ title: current ? `Change ${current.name}` : "Change",
580
+ children: current ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChangeDetail, {
581
+ change: current,
582
+ companion,
583
+ reading: readingPath,
584
+ onRead: (path) => setReading(path ? {
585
+ change: current.name,
586
+ path
587
+ } : null)
588
+ }) : null
589
+ })
590
+ ]
591
+ });
592
+ }
593
+ // src/views/overview/dashboard.tsx
594
+ /** Changes only: specs and skills have their own views. */
595
+ function Dashboard({ payload, selected, companion }) {
596
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Warnings, { warnings: payload.warnings }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Changes, {
597
+ changes: payload.changes,
598
+ selected,
599
+ companion
600
+ })] });
601
+ }
602
+ // src/routes/index.tsx?tsr-split=component
603
+ /** Each mode reads its own Overview; the server's effective mode picks it, not the address. */
604
+ function Overview() {
605
+ const search = Route.useSearch();
606
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CompanionView, {
607
+ view: "dashboard",
608
+ search,
609
+ children: (data) => data.studioMode === "analysis" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AnalystOverview, { payload: {
610
+ shipped: data.shipped ?? [],
611
+ warnings: data.warnings
612
+ } }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dashboard, {
613
+ payload: {
614
+ changes: data.changes ?? [],
615
+ warnings: data.warnings
616
+ },
617
+ selected: search.change,
618
+ companion: search.companion
619
+ })
620
+ });
621
+ }
622
+ export { Overview as component };
@@ -24,6 +24,7 @@ var getShell = createServerFn({ method: "GET" }).validator((input) => ({
24
24
  path: companion.path,
25
25
  note: healthNote(companion),
26
26
  unready: companion.health !== "ready",
27
+ missing: companion.health === "missing",
27
28
  pairings: companion.pairings.map((pairing) => pairing.repositoryId)
28
29
  }));
29
30
  const payload = page.payload;