@dadado/agent-kit-cli 6.14.0 → 6.15.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 (43) hide show
  1. package/dashboard/dashboard-data.mjs +134 -4
  2. package/dashboard/lib/ship-lane.mjs +238 -18
  3. package/dist/{add-LJAE4FRZ.js → add-5VIXRO5Z.js} +3 -3
  4. package/dist/{chunk-OLDRCWHE.js → chunk-2MDFNC34.js} +1 -1
  5. package/dist/{chunk-NDKSOPP7.js → chunk-2Y27P6KC.js} +1 -1
  6. package/dist/{chunk-GBHOP62P.js → chunk-5WJRUM23.js} +2 -2
  7. package/dist/{chunk-2TKPKRHO.js → chunk-CJ3JAH7L.js} +1 -1
  8. package/dist/{chunk-H5OSZ7HQ.js → chunk-CMYT6QE6.js} +2 -2
  9. package/dist/{chunk-WSJLLK3U.js → chunk-D43WS55A.js} +1 -1
  10. package/dist/{chunk-7DFEN3FF.js → chunk-D46W3SEU.js} +2 -2
  11. package/dist/{chunk-AXQJX4DC.js → chunk-D6SJQ25H.js} +3 -3
  12. package/dist/{chunk-IS35XTGX.js → chunk-DXYCBLRT.js} +4 -4
  13. package/dist/{chunk-EE3LTOBZ.js → chunk-IJQAFPY3.js} +1 -1
  14. package/dist/{chunk-CRLMS2JX.js → chunk-MEZU47IB.js} +1 -1
  15. package/dist/{chunk-GDKTTV2A.js → chunk-OQNJRQPZ.js} +1 -0
  16. package/dist/{chunk-TR6AC5FW.js → chunk-P4CAPXSX.js} +2 -2
  17. package/dist/{chunk-UNDPOCWT.js → chunk-PDEYXAJH.js} +1 -1
  18. package/dist/{chunk-NEMOV327.js → chunk-QD42L2LW.js} +2 -1
  19. package/dist/{chunk-YZSPNXR2.js → chunk-QF3534M4.js} +1 -1
  20. package/dist/{chunk-GYPCR4UO.js → chunk-QYIV6ZP6.js} +3 -3
  21. package/dist/{chunk-KTWDHHIO.js → chunk-RSOUQRPT.js} +1 -1
  22. package/dist/{chunk-AEUE74EZ.js → chunk-TICKIKCQ.js} +4 -4
  23. package/dist/{chunk-BMU74QWR.js → chunk-WS6OX2IG.js} +4 -0
  24. package/dist/{chunk-2DYKEP5V.js → chunk-XKM3K3VY.js} +8 -8
  25. package/dist/{chunk-CFJRCJWD.js → chunk-YO4BLHDT.js} +2 -2
  26. package/dist/{commands-K7OOH3AR.js → commands-FIJLHKEL.js} +5 -5
  27. package/dist/conflicts-UY6VTYIO.js +1125 -0
  28. package/dist/{contribute-QPBEPIKP.js → contribute-54IQQZVI.js} +5 -5
  29. package/dist/{countdown-TFKPAYIQ.js → countdown-JX3DZ2QU.js} +6 -6
  30. package/dist/{diff-5IQGV5VL.js → diff-E6ZMMKMG.js} +6 -6
  31. package/dist/{doctor-TKYJ3VRI.js → doctor-HJSMCNFE.js} +10 -10
  32. package/dist/{ground-control-DB5RSYAT.js → ground-control-D2X6CI66.js} +3 -3
  33. package/dist/{hook-SHR3NXPV.js → hook-JHV4HTJL.js} +6 -6
  34. package/dist/index.js +22 -20
  35. package/dist/{init-E2HI3TJY.js → init-VHNLK3SA.js} +13 -13
  36. package/dist/{install-3TGZ4TIY.js → install-WDKBEUTW.js} +13 -13
  37. package/dist/{queue-VLIWWVKM.js → queue-X7IOE525.js} +5 -5
  38. package/dist/{run-O6IDZ6WI.js → run-L63NZHAJ.js} +8 -8
  39. package/dist/{run-plan-2HIJ4CD2.js → run-plan-BWJX6R7Q.js} +4 -4
  40. package/dist/{setup-global-G27JZ2IN.js → setup-global-OKGV2IUV.js} +7 -7
  41. package/dist/{status-3J26V7QS.js → status-N4U56UXW.js} +8 -8
  42. package/dist/{update-KWIHFGPI.js → update-PQGDJYL2.js} +11 -11
  43. package/package.json +1 -1
@@ -63,9 +63,11 @@ import {
63
63
  } from "./lib/semantic-model.mjs";
64
64
  import {
65
65
  buildShipLaneRows,
66
+ capCommitPaths,
66
67
  classifyGhFailure,
67
68
  FACTORY_PUBLIC_REPO,
68
69
  isFactorySlug,
70
+ MAX_COMPARE_COMMITS,
69
71
  parseForgeRemote,
70
72
  readCachedShipLaneRemote,
71
73
  SHIP_LANE_CACHE_ENV,
@@ -73,6 +75,7 @@ import {
73
75
  SHIP_LANE_NPM_TIMEOUT_MS,
74
76
  safeNpmName,
75
77
  safeTagName,
78
+ shipLaneCompare,
76
79
  shipLaneGhArgs,
77
80
  shipLaneReasonNote,
78
81
  trimShipLaneGraphql,
@@ -165,7 +168,7 @@ function redactTerminalOutput(text) {
165
168
 
166
169
  const SNAPSHOT = {
167
170
  _schema: {
168
- version: "1.10.0",
171
+ version: "1.11.0",
169
172
  description: "Mission Control dashboard data model",
170
173
  fields: {
171
174
  generatedAt: "ISO-8601 timestamp of snapshot generation",
@@ -191,7 +194,7 @@ const SNAPSHOT = {
191
194
  chats:
192
195
  "Saved agent chats of this workspace: {withheld, vendors[]} with one envelope per vendor {vendor: claude|codex|cursor, status: ok|unsupported|none, projectDir, sessions[] ({id, title, titleSource: custom|ai|first-prompt|none, modified unix ms, sizeBytes}, newest first, capped at 200), total}; same contract as agent-kit sessions --json. withheld is true (vendors empty) in broadcast mode: chat titles never leave the machine (1.7.0)",
193
196
  shipLane:
194
- "Release ship lane for the Git e CI/CD section (read-only, copy-only next commands): {lane: factory|consumer|null, repo, publicRepo, local {latestTag, version, mainRef, stagingAheadOfMain, mainInStaging, tagOnMain}, remote ({available, reason?, fetchedAt?, repo, tag, prs[] (number, capped title, base, head, draft, mergeable, mergeState, stackedOn, checks {state, total, failing[], pending, signatureScan}), prsTotal, originRelease, tagCi {workflow, runId, jobs[]}, public {release, syncPrs[]}, npm {name, version}}; one gh api graphql call + one npm registry read, run alongside gh run list and reused from serve.mjs for up to 120s; reason budget|gh-missing|gh-auth|timeout|call-failed|no-remote|provider-unsupported), rows[] ({id, label, state: green|red|pending|unknown, detail, next {text, destination}|null}) mirroring the /kit-prod Done rows} (1.8.0)",
197
+ "Release ship lane for the Git e CI/CD section (read-only, copy-only next commands): {lane: factory|consumer|null, repo, publicRepo, local {latestTag, version, mainRef, stagingAheadOfMain, mainInStaging, tagOnMain}, remote ({available, reason?, fetchedAt?, repo, tag, prs[] (number, capped title, base, head, draft, mergeable, mergeState, stackedOn, checks {state, total, failing[], pending, signatureScan}), prsTotal, originRelease, tagCi {workflow, runId, jobs[]}, tagCommit {oid, committedDate}, compare {ahead, behind, total, commits[] (oid, capped headline, parents)} from Ref.compare of main and staging, promoted {number, title, mergedAt, mergeOid} the latest merged staging -> main PR, public {release, syncPrs[]}, npm {name, version}}; one gh api graphql call + one npm registry read, run alongside gh run list and reused from serve.mjs for up to 120s; reason budget|gh-missing|gh-auth|timeout|call-failed|no-remote|provider-unsupported), compare ({source: forge|local|null, fetchedAt, ahead, behind, pending, release, merge, sync, docs, examined, total, truncated}: staging vs main from the forge, else from the unfetched local origin/* refs marked local; a release is pending only when staging holds a commit that is not a merge, not the staging sync merge-back and not docs- or memory-only (1.11.0)), rows[] ({id, label, state: green|red|pending|unknown, detail, next {text, destination}|null}) mirroring the /kit-prod Done rows; the staging -> main row shows a merged promote PR while its tag or sync is still open} (1.8.0; compare 1.11.0)",
195
198
  outcomeLedger:
196
199
  "Verified-outcome ledger (read-only, product-neutral; ADR 2026-10-23 colony-game-canon-outcome-ledger-art-policy): {available, reason (budget|unreadable)|null, version, path (.cursor/context/outcome-ledger.json), entries, totals {logic, compute, rare}, byKind {todo, test, ci, releaseCut, plan, review, releasePublished}, recent[] ({key, kind, resource, at, label}, newest 20), flow {plan, streak, lastClosedAt, brokenAt}|null (from mission-timing.json; a failed, gated or stopped tick breaks it), tests {configured, lastRun {at, ok, head}|null}}. Folded on every snapshot, idempotent by event key, entries never removed; never rewards lines of code, commits, diff size, tokens or time (1.9.0)",
197
200
  processes:
@@ -202,7 +205,7 @@ const SNAPSHOT = {
202
205
  },
203
206
  },
204
207
  generatedAt: new Date().toISOString(),
205
- dashboardDataVersion: "1.10.0",
208
+ dashboardDataVersion: "1.11.0",
206
209
  plans: [],
207
210
  system: {
208
211
  repoRoot: ROOT,
@@ -886,6 +889,112 @@ function collectShipLaneLocal() {
886
889
  };
887
890
  }
888
891
 
892
+ const SHIP_GIT_OPTS = {
893
+ cwd: ROOT,
894
+ encoding: "utf-8",
895
+ timeout: 5000,
896
+ maxBuffer: 4 * 1024 * 1024,
897
+ stdio: ["ignore", "pipe", "ignore"],
898
+ };
899
+
900
+ /**
901
+ * `git log --name-only` records (`\x00<oid>\t<parents>\t<subject>` then paths)
902
+ * as `{oid, headline, parents, paths}`.
903
+ */
904
+ function parseShipLog(text) {
905
+ const out = [];
906
+ for (const chunk of String(text || "")
907
+ .split("\x00")
908
+ .slice(1)) {
909
+ const [head, ...rest] = chunk.split("\n");
910
+ const [oid, parents, ...subject] = head.split("\t");
911
+ if (!/^[0-9a-f]{40,64}$/.test(oid || "")) continue;
912
+ out.push({
913
+ oid,
914
+ headline: subject.join("\t"),
915
+ parents: parents ? parents.trim().split(/\s+/).filter(Boolean).length : 0,
916
+ paths: capCommitPaths(rest.map((l) => l.trim()).filter(Boolean)),
917
+ });
918
+ }
919
+ return out;
920
+ }
921
+
922
+ /**
923
+ * Staging vs main from the local origin/* refs (the forge-down fallback; the
924
+ * collector never fetches, so these refs can be stale). null without both refs.
925
+ */
926
+ function collectLocalShipCompare(mainRef) {
927
+ if (!mainRef) return null;
928
+ const count = (range) => {
929
+ try {
930
+ const n = Number.parseInt(
931
+ execFileSync("git", ["rev-list", "--count", range], SHIP_GIT_OPTS).trim(),
932
+ 10,
933
+ );
934
+ return Number.isFinite(n) ? n : null;
935
+ } catch {
936
+ return null;
937
+ }
938
+ };
939
+ const ahead = count(`${mainRef}..origin/staging`);
940
+ const behind = count(`origin/staging..${mainRef}`);
941
+ if (ahead == null || behind == null) return null;
942
+ let commits = [];
943
+ try {
944
+ commits = parseShipLog(
945
+ execFileSync(
946
+ "git",
947
+ [
948
+ "log",
949
+ "--reverse",
950
+ "--format=%x00%H%x09%P%x09%s",
951
+ "--name-only",
952
+ "-n",
953
+ String(MAX_COMPARE_COMMITS),
954
+ `${mainRef}..origin/staging`,
955
+ ],
956
+ SHIP_GIT_OPTS,
957
+ ),
958
+ );
959
+ } catch {
960
+ commits = [];
961
+ }
962
+ return { ahead, behind, total: ahead, commits };
963
+ }
964
+
965
+ /**
966
+ * Paths of the forge's compare commits that are already in the local object
967
+ * store (one cat-file and one log call); the others classify by commit type.
968
+ * @param {string[]} oids
969
+ * @returns {Map<string, string[]>}
970
+ */
971
+ function localCommitPaths(oids) {
972
+ const paths = new Map();
973
+ const wanted = oids.filter((o) => /^[0-9a-f]{40,64}$/.test(o));
974
+ if (!wanted.length) return paths;
975
+ try {
976
+ const present = execFileSync("git", ["cat-file", "--batch-check=%(objectname) %(objecttype)"], {
977
+ ...SHIP_GIT_OPTS,
978
+ input: `${wanted.join("\n")}\n`,
979
+ stdio: ["pipe", "pipe", "ignore"],
980
+ })
981
+ .split("\n")
982
+ .map((l) => l.split(" "))
983
+ .filter(([oid, type]) => type === "commit" && wanted.includes(oid))
984
+ .map(([oid]) => oid);
985
+ if (!present.length) return paths;
986
+ const log = execFileSync(
987
+ "git",
988
+ ["log", "--no-walk=unsorted", "--format=%x00%H%x09%P%x09%s", "--name-only", ...present],
989
+ SHIP_GIT_OPTS,
990
+ );
991
+ for (const c of parseShipLog(log)) paths.set(c.oid, c.paths);
992
+ } catch {
993
+ // Paths are an accuracy aid only: without them the commit type decides.
994
+ }
995
+ return paths;
996
+ }
997
+
889
998
  /** execFile as a promise that never rejects: { err, stdout, stderr }. */
890
999
  function execFileSettled(bin, args, timeout) {
891
1000
  return new Promise((resolveExec) => {
@@ -921,7 +1030,13 @@ function startShipLaneRemote(ship) {
921
1030
  const fetchedAt = new Date().toISOString();
922
1031
  const gh = execFileSettled(
923
1032
  "gh",
924
- shipLaneGhArgs({ owner: forge.owner, name: forge.name, tag: local.latestTag, publicRepo }),
1033
+ shipLaneGhArgs({
1034
+ owner: forge.owner,
1035
+ name: forge.name,
1036
+ tag: local.latestTag,
1037
+ publicRepo,
1038
+ main: local.mainRef ? local.mainRef.replace(/^origin\//, "") : "main",
1039
+ }),
925
1040
  SHIP_LANE_GH_TIMEOUT_MS,
926
1041
  );
927
1042
  const npm = npmName
@@ -1682,6 +1797,19 @@ SNAPSHOT.devops = {
1682
1797
  mainInStaging: null,
1683
1798
  tagOnMain: null,
1684
1799
  };
1800
+ let compare = shipLaneCompare({ remote, local: null });
1801
+ try {
1802
+ const forgeCompare = remote.available === true ? remote.compare : null;
1803
+ compare = forgeCompare
1804
+ ? shipLaneCompare({
1805
+ remote,
1806
+ local: null,
1807
+ paths: localCommitPaths(forgeCompare.commits.map((c) => c.oid)),
1808
+ })
1809
+ : shipLaneCompare({ remote, local: collectLocalShipCompare(local.mainRef) });
1810
+ } catch {
1811
+ // keep the empty comparison (source null): the rows read unknown
1812
+ }
1685
1813
  let rows = [];
1686
1814
  try {
1687
1815
  rows = buildShipLaneRows({
@@ -1690,6 +1818,7 @@ SNAPSHOT.devops = {
1690
1818
  publicRepo: shipLaneLocal?.publicRepo ?? null,
1691
1819
  local,
1692
1820
  remote,
1821
+ compare,
1693
1822
  });
1694
1823
  } catch {
1695
1824
  rows = [];
@@ -1700,6 +1829,7 @@ SNAPSHOT.devops = {
1700
1829
  publicRepo: shipLaneLocal?.publicRepo ?? null,
1701
1830
  local,
1702
1831
  remote,
1832
+ compare,
1703
1833
  note: remote.available ? null : shipLaneReasonNote(remote.reason),
1704
1834
  rows,
1705
1835
  };
@@ -4,7 +4,8 @@
4
4
  *
5
5
  * Read-only. One `gh api graphql` call fetches the forge half (open PRs with
6
6
  * mergeable state and check rollups, the latest tag's CI jobs, GitHub Release
7
- * Latest, and, in the factory lane, the public repo's release and sync PRs);
7
+ * Latest, staging vs main from Ref.compare, the latest merged promote PR, and,
8
+ * in the factory lane, the public repo's release and sync PRs);
8
9
  * one registry fetch reads the npm version. Local git facts (latest v* tag,
9
10
  * manifest version, staging vs main) are recomputed on every snapshot, so the
10
11
  * rows stay current while the network half is cached between snapshots the
@@ -39,6 +40,10 @@ const MAX_FAILING_CHECKS = 8;
39
40
  const MAX_TAG_JOBS = 12;
40
41
  const MAX_SYNC_PRS = 5;
41
42
  const MAX_REASON_CHARS = 80;
43
+ /** Commits of the staging vs main comparison that are classified (GraphQL page size). */
44
+ export const MAX_COMPARE_COMMITS = 100;
45
+ const MAX_HEADLINE_CHARS = 120;
46
+ const MAX_COMMIT_PATHS = 200;
42
47
 
43
48
  /** Signature scan check name (errors/2026-10-05_git-prod-signature-gate-merged-staging-commit.md). */
44
49
  const SIGNATURE_SCAN_CHECK = "signature-scan";
@@ -100,8 +105,12 @@ export function isFactorySlug(slug) {
100
105
  return typeof slug === "string" && /agent-kit-dev$/i.test(slug);
101
106
  }
102
107
 
103
- export const SHIP_LANE_QUERY = `query($owner:String!,$name:String!,$tag:String!,$withPublic:Boolean!,$pubOwner:String!,$pubName:String!){
108
+ export const SHIP_LANE_QUERY = `query($owner:String!,$name:String!,$tag:String!,$main:String!,$mainRef:String!,$withPublic:Boolean!,$pubOwner:String!,$pubName:String!){
104
109
  repo: repository(owner:$owner,name:$name){
110
+ base: ref(qualifiedName:$mainRef){ compare(headRef:"refs/heads/staging"){ aheadBy behindBy
111
+ commits(first:${MAX_COMPARE_COMMITS}){ totalCount nodes{ oid messageHeadline parents{ totalCount } } } } }
112
+ promoted: pullRequests(states:MERGED,baseRefName:$main,headRefName:"staging",first:3,orderBy:{field:UPDATED_AT,direction:DESC}){
113
+ nodes{ number title mergedAt mergeCommit{ oid } } }
105
114
  pullRequests(states:OPEN,first:${MAX_SHIP_LANE_PRS},orderBy:{field:UPDATED_AT,direction:DESC}){
106
115
  totalCount
107
116
  nodes{ number title isDraft baseRefName headRefName mergeable mergeStateStatus
@@ -115,14 +124,17 @@ export const SHIP_LANE_QUERY = `query($owner:String!,$name:String!,$tag:String!,
115
124
  pullRequests(states:[OPEN,MERGED],last:${MAX_SYNC_PRS}){ nodes{ number title state mergedAt } }
116
125
  }
117
126
  }
118
- fragment suites on Commit{ checkSuites(first:12){ nodes{ workflowRun{ databaseId event workflow{ name } } checkRuns(first:20){ nodes{ name status conclusion } } } } }`;
127
+ fragment suites on Commit{ oid committedDate checkSuites(first:12){ nodes{ workflowRun{ databaseId event workflow{ name } } checkRuns(first:20){ nodes{ name status conclusion } } } } }`;
119
128
 
120
129
  /**
121
- * argv for `gh` (no shell; values are validated slugs and a v* tag name).
122
- * @param {{ owner: string, name: string, tag: string | null, publicRepo: string | null }} p
130
+ * argv for `gh` (no shell; values are validated slugs, a v* tag name and the
131
+ * production branch name `main` or `master`).
132
+ * @param {{ owner: string, name: string, tag: string | null, publicRepo: string | null,
133
+ * main?: string | null }} p
123
134
  */
124
- export function shipLaneGhArgs({ owner, name, tag, publicRepo }) {
135
+ export function shipLaneGhArgs({ owner, name, tag, publicRepo, main }) {
125
136
  const [pubOwner, pubName] = publicRepo ? publicRepo.split("/") : ["_", "_"];
137
+ const mainBranch = main === "master" ? "master" : "main";
126
138
  return [
127
139
  "api",
128
140
  "graphql",
@@ -135,6 +147,10 @@ export function shipLaneGhArgs({ owner, name, tag, publicRepo }) {
135
147
  "-F",
136
148
  `tag=refs/tags/${tag || "__no_tag__"}`,
137
149
  "-F",
150
+ `main=${mainBranch}`,
151
+ "-F",
152
+ `mainRef=refs/heads/${mainBranch}`,
153
+ "-F",
138
154
  `withPublic=${publicRepo ? "true" : "false"}`,
139
155
  "-F",
140
156
  `pubOwner=${pubOwner}`,
@@ -221,6 +237,52 @@ function trimTagCi(tagRef) {
221
237
  };
222
238
  }
223
239
 
240
+ /** The tag's commit (oid, committedDate), through an annotated tag object when there is one. */
241
+ function trimTagCommit(tagRef) {
242
+ const commit = tagRef?.target?.__typename === "Tag" ? tagRef.target.target : tagRef?.target;
243
+ if (!commit || typeof commit.oid !== "string") return null;
244
+ return {
245
+ oid: capText(commit.oid, 64),
246
+ committedDate: typeof commit.committedDate === "string" ? commit.committedDate : null,
247
+ };
248
+ }
249
+
250
+ /** Ref.compare of main (base) and staging (head): counts plus the first page of commits. */
251
+ function trimCompare(base) {
252
+ const cmp = base?.compare;
253
+ if (!cmp || typeof cmp !== "object") return null;
254
+ const ahead = Number(cmp.aheadBy);
255
+ const behind = Number(cmp.behindBy);
256
+ if (!Number.isSafeInteger(ahead) || !Number.isSafeInteger(behind)) return null;
257
+ const nodes = (cmp.commits?.nodes ?? []).slice(0, MAX_COMPARE_COMMITS);
258
+ return {
259
+ ahead,
260
+ behind,
261
+ total: Number(cmp.commits?.totalCount) || ahead,
262
+ commits: nodes.map((c) => ({
263
+ oid: capText(c?.oid, 64),
264
+ headline: capText(c?.messageHeadline, MAX_HEADLINE_CHARS),
265
+ parents: Number(c?.parents?.totalCount) || 0,
266
+ })),
267
+ };
268
+ }
269
+
270
+ /** The most recently merged staging -> main PR (the query reads three, ordered by update). */
271
+ function trimPromoted(conn) {
272
+ let best = null;
273
+ for (const n of conn?.nodes ?? []) {
274
+ if (typeof n?.mergedAt !== "string" || !Number.isFinite(Date.parse(n.mergedAt))) continue;
275
+ if (!best || Date.parse(n.mergedAt) > Date.parse(best.mergedAt)) best = n;
276
+ }
277
+ if (!best) return null;
278
+ return {
279
+ number: Number(best.number) || 0,
280
+ title: capText(best.title, MAX_PR_TITLE_CHARS),
281
+ mergedAt: best.mergedAt,
282
+ mergeOid: typeof best.mergeCommit?.oid === "string" ? capText(best.mergeCommit.oid, 64) : null,
283
+ };
284
+ }
285
+
224
286
  function trimRelease(release) {
225
287
  if (!release || typeof release.tagName !== "string") return null;
226
288
  return {
@@ -252,6 +314,9 @@ export function trimShipLaneGraphql(json, { repo: repoSlug, tag, publicRepo, fet
252
314
  prsTotal: Number(repo.pullRequests?.totalCount) || prs.length,
253
315
  originRelease: trimRelease(repo.latestRelease),
254
316
  tagCi: tag ? trimTagCi(repo.tag) : null,
317
+ tagCommit: tag ? trimTagCommit(repo.tag) : null,
318
+ compare: trimCompare(repo.base),
319
+ promoted: trimPromoted(repo.promoted),
255
320
  public:
256
321
  publicRepo && pub
257
322
  ? {
@@ -334,8 +399,130 @@ export function shipLaneCacheJsonFromSnapshot(snapshot) {
334
399
  return isCacheableRemote(remote) ? JSON.stringify(remote) : null;
335
400
  }
336
401
 
402
+ /**
403
+ * Paths that make a commit a docs- or memory-only change: repo docs, the memory
404
+ * records, plans, the handoff, dogfood notes and root-level Markdown files.
405
+ */
406
+ const DOCS_ONLY_PATH =
407
+ /^(?:docs\/|\.cursor\/memory\/|\.cursor\/plans\/|\.cursor\/dogfood\/|dogfood\/|\.cursor\/HANDOFF\.md$|[^/]+\.md$)/;
408
+ /** Conventional Commits `docs` type, not marked breaking. */
409
+ const DOCS_TYPE = /^docs(?:\([^)]*\))?:/i;
410
+ /** The staging fast-forward sync head (Colony src/prgate.ts SYNC_HEAD), or its squashed title. */
411
+ const SYNC_HEADLINE = /\bsync-staging-|^chore(?:\([^)]*\))?:\s*sync staging\b/i;
412
+
413
+ /**
414
+ * Whether staging holds something to release: the one classification of the
415
+ * commits on staging that are not on main (pure). A commit is not
416
+ * release-worthy when it is a merge commit, the staging sync merge-back, or a
417
+ * docs- or memory-only change: decided from its paths when they are known (the
418
+ * commit is in the local object store), else from the Conventional Commits
419
+ * `docs` type. When the commit list is shorter than `total` (a truncated page)
420
+ * and none of the listed commits is release-worthy, the result stays pending
421
+ * and `truncated` is true: partial data never reads as nothing to ship.
422
+ * @param {{ commits: Array<{ oid?: string, headline?: string, parents?: number,
423
+ * paths?: string[] | null }>, total?: number }} input
424
+ * @returns {{ pending: boolean, release: number, merge: number, sync: number, docs: number,
425
+ * examined: number, total: number, truncated: boolean }}
426
+ */
427
+ export function classifyReleasePending({ commits, total }) {
428
+ const list = Array.isArray(commits) ? commits : [];
429
+ const counts = { release: 0, merge: 0, sync: 0, docs: 0 };
430
+ for (const c of list) {
431
+ const headline = typeof c?.headline === "string" ? c.headline : "";
432
+ if ((Number(c?.parents) || 0) > 1) counts.merge += 1;
433
+ else if (SYNC_HEADLINE.test(headline)) counts.sync += 1;
434
+ else if (
435
+ Array.isArray(c?.paths) && c.paths.length
436
+ ? c.paths.every((p) => DOCS_ONLY_PATH.test(String(p)))
437
+ : DOCS_TYPE.test(headline)
438
+ )
439
+ counts.docs += 1;
440
+ else counts.release += 1;
441
+ }
442
+ const all = Math.max(Number(total) || 0, list.length);
443
+ const truncated = list.length < all;
444
+ return {
445
+ pending: counts.release > 0 || truncated,
446
+ ...counts,
447
+ examined: list.length,
448
+ total: all,
449
+ truncated,
450
+ };
451
+ }
452
+
453
+ /**
454
+ * The staging vs main comparison the rows read: the forge's Ref.compare when
455
+ * the forge half has one, else the local origin/* refs (which the collector
456
+ * never fetches), marked `source: "local"`; `source: null` when neither exists.
457
+ * @param {{ remote: any, local: { ahead: number, behind: number, total?: number,
458
+ * commits: any[] } | null, paths?: Map<string, string[]> | null }} input
459
+ */
460
+ export function shipLaneCompare({ remote, local, paths = null }) {
461
+ const forge = remote?.available === true ? remote.compare : null;
462
+ const picked = forge ?? local ?? null;
463
+ if (!picked) {
464
+ return {
465
+ source: null,
466
+ fetchedAt: null,
467
+ ahead: null,
468
+ behind: null,
469
+ pending: false,
470
+ release: 0,
471
+ merge: 0,
472
+ sync: 0,
473
+ docs: 0,
474
+ examined: 0,
475
+ total: 0,
476
+ truncated: false,
477
+ };
478
+ }
479
+ const commits = (picked.commits ?? []).map((c) =>
480
+ Array.isArray(c?.paths) || !paths ? c : { ...c, paths: paths.get(c?.oid) ?? null },
481
+ );
482
+ return {
483
+ source: forge ? "forge" : "local",
484
+ fetchedAt: forge ? (remote.fetchedAt ?? null) : null,
485
+ ahead: picked.ahead,
486
+ behind: picked.behind,
487
+ ...classifyReleasePending({ commits, total: picked.total ?? picked.ahead }),
488
+ };
489
+ }
490
+
491
+ /** Commit paths are repo text: cap the count and each path before classifying. */
492
+ export function capCommitPaths(paths) {
493
+ return (Array.isArray(paths) ? paths : []).slice(0, MAX_COMMIT_PATHS).map((p) => capText(p, 300));
494
+ }
495
+
337
496
  const cmd = (text, destination = "terminal") => ({ text, destination });
338
497
 
498
+ /** " · local refs" when the comparison came from unfetched local refs. */
499
+ const localMark = (compare) => (compare?.source === "local" ? " · local refs, not fetched" : "");
500
+
501
+ /** Worthy-commit summary for a pending release. */
502
+ function pendingDetail(compare) {
503
+ const n = compare.truncated
504
+ ? `${compare.total} commit(s), first ${compare.examined} classified`
505
+ : `${compare.release} commit(s)`;
506
+ return `release pending: ${n}`;
507
+ }
508
+
509
+ /**
510
+ * The latest merged promote PR when its follow-up is still open: no tag cut
511
+ * after its merge, or main not yet back in staging. null otherwise.
512
+ */
513
+ function promoteFollowUp(promoted, tagCommit, compare, mainInStagingLocal) {
514
+ if (!promoted?.mergedAt) return null;
515
+ const tagDate = tagCommit?.committedDate ? Date.parse(tagCommit.committedDate) : Number.NaN;
516
+ const waitingTag =
517
+ promoted.mergeOid !== tagCommit?.oid &&
518
+ !(Number.isFinite(tagDate) && tagDate >= Date.parse(promoted.mergedAt));
519
+ const behind = compare?.source ? compare.behind : null;
520
+ const waitingSync = behind != null ? behind > 0 : mainInStagingLocal === false;
521
+ if (!waitingTag && !waitingSync) return null;
522
+ const waits = [waitingTag && "the tag", waitingSync && "the staging sync"].filter(Boolean);
523
+ return { promoted, waits };
524
+ }
525
+
339
526
  function prCheckState(pr) {
340
527
  if (pr.checks.failing.length || pr.mergeable === "conflicting") return "red";
341
528
  return "pending";
@@ -356,9 +543,11 @@ function prDetail(pr) {
356
543
  * @param {{ lane: "factory" | "consumer", repo: string | null, publicRepo: string | null,
357
544
  * local: { latestTag: string | null, version: string | null, mainRef: string | null,
358
545
  * stagingAheadOfMain: number | null, mainInStaging: boolean | null, tagOnMain: boolean | null },
359
- * remote: any }} input
546
+ * remote: any, compare?: ReturnType<typeof shipLaneCompare> | null }} input
547
+ * `compare` (from shipLaneCompare) decides the staging vs main rows; the raw
548
+ * local counts are not read for them.
360
549
  */
361
- export function buildShipLaneRows({ lane, repo, publicRepo, local, remote }) {
550
+ export function buildShipLaneRows({ lane, repo, publicRepo, local, remote, compare = null }) {
362
551
  const slash = lane === "factory" ? "/kit-prod" : "/git-prod";
363
552
  const tag = local.latestTag;
364
553
  const tagVersion = tag ? tag.replace(/^v/, "") : null;
@@ -366,6 +555,7 @@ export function buildShipLaneRows({ lane, repo, publicRepo, local, remote }) {
366
555
  const forgeNote = forgeUp ? null : shipLaneReasonNote(remote?.reason ?? "call-failed");
367
556
  const prs = forgeUp ? remote.prs : [];
368
557
  const mainBase = local.mainRef ? local.mainRef.replace(/^origin\//, "") : "main";
558
+ const cmp = compare?.source ? compare : null;
369
559
  const rows = [];
370
560
 
371
561
  // 1. Release close (manifests bumped, close PR into staging).
@@ -394,14 +584,22 @@ export function buildShipLaneRows({ lane, repo, publicRepo, local, remote }) {
394
584
  detail: `v${local.version} closed`,
395
585
  next: null,
396
586
  });
397
- } else if ((local.stagingAheadOfMain ?? 0) > 0) {
587
+ } else if (cmp?.pending) {
398
588
  rows.push({
399
589
  id: "release-close",
400
590
  label: "Release close",
401
591
  state: "pending",
402
- detail: `staging is ${local.stagingAheadOfMain} commit(s) ahead of ${mainBase}; next release not closed`,
592
+ detail: `${pendingDetail(cmp)} on staging, not on ${mainBase}; next release not closed${localMark(cmp)}`,
403
593
  next: cmd(slash, "agent chat input"),
404
594
  });
595
+ } else if (cmp && cmp.ahead > 0) {
596
+ rows.push({
597
+ id: "release-close",
598
+ label: "Release close",
599
+ state: "green",
600
+ detail: `v${local.version} shipped; staging +${cmp.ahead} (nothing to ship)${localMark(cmp)}`,
601
+ next: null,
602
+ });
405
603
  } else {
406
604
  rows.push({
407
605
  id: "release-close",
@@ -416,6 +614,10 @@ export function buildShipLaneRows({ lane, repo, publicRepo, local, remote }) {
416
614
  const promotePr = prs.find(
417
615
  (p) => p.head === "staging" && (p.base === "main" || p.base === "master"),
418
616
  );
617
+ const followUp =
618
+ !promotePr && forgeUp
619
+ ? promoteFollowUp(remote.promoted, remote.tagCommit, cmp, local.mainInStaging)
620
+ : null;
419
621
  if (promotePr) {
420
622
  rows.push({
421
623
  id: "staging-main",
@@ -424,7 +626,15 @@ export function buildShipLaneRows({ lane, repo, publicRepo, local, remote }) {
424
626
  detail: prDetail(promotePr),
425
627
  next: cmd(`gh pr checks ${promotePr.number}`),
426
628
  });
427
- } else if (local.stagingAheadOfMain == null) {
629
+ } else if (followUp) {
630
+ rows.push({
631
+ id: "staging-main",
632
+ label: `Staging → ${mainBase}`,
633
+ state: "green",
634
+ detail: `#${followUp.promoted.number} merged; waiting on ${followUp.waits.join(" and ")}`,
635
+ next: null,
636
+ });
637
+ } else if (!cmp) {
428
638
  rows.push({
429
639
  id: "staging-main",
430
640
  label: `Staging → ${mainBase}`,
@@ -432,14 +642,22 @@ export function buildShipLaneRows({ lane, repo, publicRepo, local, remote }) {
432
642
  detail: "no origin/staging or origin/main ref",
433
643
  next: null,
434
644
  });
435
- } else if (local.stagingAheadOfMain > 0) {
645
+ } else if (cmp.pending) {
436
646
  rows.push({
437
647
  id: "staging-main",
438
648
  label: `Staging → ${mainBase}`,
439
649
  state: "pending",
440
- detail: `staging ${local.stagingAheadOfMain} ahead, no open PR${forgeNote ? ` (${forgeNote})` : ""}`,
650
+ detail: `${pendingDetail(cmp)}, no open PR${localMark(cmp)}${forgeNote ? ` (${forgeNote})` : ""}`,
441
651
  next: cmd(slash, "agent chat input"),
442
652
  });
653
+ } else if (cmp.ahead > 0) {
654
+ rows.push({
655
+ id: "staging-main",
656
+ label: `Staging → ${mainBase}`,
657
+ state: "green",
658
+ detail: `staging +${cmp.ahead} (nothing to ship)${localMark(cmp)}`,
659
+ next: null,
660
+ });
443
661
  } else {
444
662
  rows.push({
445
663
  id: "staging-main",
@@ -541,8 +759,10 @@ export function buildShipLaneRows({ lane, repo, publicRepo, local, remote }) {
541
759
  }
542
760
  }
543
761
 
544
- // 5. Staging fast-forward sync (main is an ancestor of staging).
545
- if (local.mainInStaging == null) {
762
+ // 5. Staging fast-forward sync (main is an ancestor of staging): the forge's
763
+ // behind count when the comparison has one, else the local ancestry check.
764
+ const mainInStaging = cmp ? cmp.behind === 0 : local.mainInStaging;
765
+ if (mainInStaging == null) {
546
766
  rows.push({
547
767
  id: "staging-sync",
548
768
  label: "Staging sync",
@@ -550,12 +770,12 @@ export function buildShipLaneRows({ lane, repo, publicRepo, local, remote }) {
550
770
  detail: "no origin/staging or origin/main ref",
551
771
  next: null,
552
772
  });
553
- } else if (local.mainInStaging) {
773
+ } else if (mainInStaging) {
554
774
  rows.push({
555
775
  id: "staging-sync",
556
776
  label: "Staging sync",
557
777
  state: "green",
558
- detail: `${mainBase} is an ancestor of staging`,
778
+ detail: `${mainBase} is an ancestor of staging${localMark(cmp)}`,
559
779
  next: null,
560
780
  });
561
781
  } else {
@@ -563,7 +783,7 @@ export function buildShipLaneRows({ lane, repo, publicRepo, local, remote }) {
563
783
  id: "staging-sync",
564
784
  label: "Staging sync",
565
785
  state: "red",
566
- detail: `${mainBase} has commits staging lacks`,
786
+ detail: `${mainBase} has ${cmp ? `${cmp.behind} commit(s)` : "commits"} staging lacks${localMark(cmp)}`,
567
787
  next: cmd(`git log --oneline origin/staging..${local.mainRef || "origin/main"}`),
568
788
  });
569
789
  }
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  REGISTRY_CLI_ARGS,
7
7
  resolveRegistryFromCli
8
- } from "./chunk-WSJLLK3U.js";
8
+ } from "./chunk-D43WS55A.js";
9
9
  import {
10
10
  logger
11
11
  } from "./chunk-ZB43YMHW.js";
@@ -22,8 +22,8 @@ import {
22
22
  resolveProtectedGlobs,
23
23
  saveManifest,
24
24
  upsertIdList
25
- } from "./chunk-YZSPNXR2.js";
26
- import "./chunk-NEMOV327.js";
25
+ } from "./chunk-QF3534M4.js";
26
+ import "./chunk-QD42L2LW.js";
27
27
  import {
28
28
  KIT_VERSION
29
29
  } from "./chunk-7HDQEK6T.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MANIFEST_RELATIVE_PATH
3
- } from "./chunk-YZSPNXR2.js";
3
+ } from "./chunk-QF3534M4.js";
4
4
  import {
5
5
  fileExists
6
6
  } from "./chunk-5B4DVO6C.js";
@@ -13,7 +13,7 @@ import {
13
13
  redactSecrets,
14
14
  resolveHitlRunOptions,
15
15
  spawnLogged
16
- } from "./chunk-GDKTTV2A.js";
16
+ } from "./chunk-OQNJRQPZ.js";
17
17
  import {
18
18
  RESERVED_GATE_IDS
19
19
  } from "./chunk-WRCXRV2U.js";
@@ -4,10 +4,10 @@ import {
4
4
  import {
5
5
  compareSemver,
6
6
  normalizeSemver
7
- } from "./chunk-H5OSZ7HQ.js";
7
+ } from "./chunk-CMYT6QE6.js";
8
8
  import {
9
9
  MANIFEST_RELATIVE_PATH
10
- } from "./chunk-YZSPNXR2.js";
10
+ } from "./chunk-QF3534M4.js";
11
11
  import {
12
12
  KIT_VERSION,
13
13
  pinnedCliSpec
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  claudeRedactions,
6
6
  redactSecrets
7
- } from "./chunk-GDKTTV2A.js";
7
+ } from "./chunk-OQNJRQPZ.js";
8
8
  import {
9
9
  findHitlGateInText
10
10
  } from "./chunk-WRCXRV2U.js";
@@ -6,13 +6,13 @@ import {
6
6
  import {
7
7
  diffAgainstRegistry,
8
8
  summarizeDiff
9
- } from "./chunk-AXQJX4DC.js";
9
+ } from "./chunk-D6SJQ25H.js";
10
10
  import {
11
11
  DEFAULT_REGISTRY_URL,
12
12
  assertSafeRegistrySource,
13
13
  loadAgentKitManifest,
14
14
  resolveRegistryRoot
15
- } from "./chunk-YZSPNXR2.js";
15
+ } from "./chunk-QF3534M4.js";
16
16
  import {
17
17
  KIT_PACKAGE_SPEC,
18
18
  KIT_VERSION