@staix/agent-hub 0.44.0 → 0.46.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 (168) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/README.md +12 -11
  3. package/docs/adding-an-ai-tool.md +1 -0
  4. package/docs/agent-notes/adapters.md +35 -6
  5. package/docs/agent-notes/budget.md +2 -1
  6. package/docs/agent-notes/daemon.md +5 -1
  7. package/docs/agent-notes/local-worker.md +1 -1
  8. package/docs/agent-notes/security-review.md +3 -2
  9. package/docs/agent-notes/tasks.md +6 -2
  10. package/docs/agent-notes/tests.md +4 -3
  11. package/docs/design/adapters.md +20 -2
  12. package/docs/design/agent-hub-architecture.md +12 -0
  13. package/docs/design/agent-hub.md +1 -1
  14. package/docs/design/cli-output.md +2 -0
  15. package/docs/design/roadmap.md +158 -4
  16. package/docs/design/supervision.md +21 -1
  17. package/docs/design/task-board.md +32 -4
  18. package/docs/dogfood.md +28 -4
  19. package/docs/events.md +7 -3
  20. package/docs/influences.md +7 -0
  21. package/docs/memory.md +4 -4
  22. package/docs/operations.md +151 -36
  23. package/docs/quickstart.md +16 -4
  24. package/docs/research.md +16 -0
  25. package/docs/roadmap.json +4 -0
  26. package/docs/roadmap.md +9 -0
  27. package/docs/sdlc.md +15 -3
  28. package/docs/security.md +9 -7
  29. package/docs/smoke.md +1 -1
  30. package/docs/verification/2026-11-05-hardcoded-values-classification-rules.md +28 -0
  31. package/docs/verification/2026-11-19-claude-implementer-2.1.328.md +49 -0
  32. package/docs/verification/2026-11-20-claude-implementer-2.1.329.md +49 -0
  33. package/docs/verification/2026-11-20-sdlc-metrics-diagnosis.md +7 -0
  34. package/docs/verification/2026-11-21-0.45.0.md +69 -0
  35. package/docs/verification/2026-11-22-agy-1.5.14.md +27 -0
  36. package/docs/verification/2026-11-22-claude-instruction-hook.md +35 -0
  37. package/docs/verification/2026-11-22-codex-0171-reviewer-isolation.md +47 -0
  38. package/docs/verification/2026-11-22-instructed-ipc.md +9 -0
  39. package/docs/verification/2026-11-22-jcode-1.0.3.md +71 -0
  40. package/docs/verification/2026-11-22-jcode-separate-home.md +14 -0
  41. package/docs/verification/2026-11-22-qwen-0283-acp.md +28 -0
  42. package/docs/verification/2026-11-22-qwen-0283-dual-output.md +33 -0
  43. package/docs/verification/2026-11-22-roadmap-r5-view-receipt.md +63 -0
  44. package/docs/verification/2026-11-23-0.46.0.md +44 -0
  45. package/docs/verification/assets/1483-r5-detail-1440-light.png +0 -0
  46. package/docs/verification/assets/1483-r5-detail-390-light.png +0 -0
  47. package/docs/verification/assets/1483-r5-view-1440-dark.png +0 -0
  48. package/docs/verification/assets/1483-r5-view-1440-light.png +0 -0
  49. package/docs/verification/assets/1483-r5-view-390-dark.png +0 -0
  50. package/docs/verification/assets/1483-r5-view-390-light.png +0 -0
  51. package/docs/verification/assets/1483-r5-view-820-dark.png +0 -0
  52. package/docs/verification/assets/1483-r5-view-820-light.png +0 -0
  53. package/docs/verified.json +33 -27
  54. package/package.json +3 -2
  55. package/plugins/agent-hub/.claude-plugin/plugin.json +1 -1
  56. package/plugins/agent-hub/kimi-hook.js +4743 -4048
  57. package/plugins/agent-hub/kimi-review-policy-worker.js +5 -5
  58. package/plugins/agent-hub/server.js +1641 -1265
  59. package/plugins/agent-hub/skills/ahub/SKILL.md +17 -0
  60. package/plugins/agent-hub/skills/ahub-manage/SKILL.md +37 -0
  61. package/plugins/agent-hub/skills/ahub-status/SKILL.md +14 -0
  62. package/plugins/agent-hub/skills/ahub-use/SKILL.md +12 -0
  63. package/scripts/check-docs.mjs +9 -1
  64. package/src/adapters/acp.ts +11 -1
  65. package/src/adapters/claude-channel.ts +2 -1
  66. package/src/adapters/compat.ts +15 -14
  67. package/src/adapters/definitions/builtin-metadata.ts +2 -2
  68. package/src/adapters/definitions/native-cli-claude-setup.ts +9 -1
  69. package/src/adapters/definitions/native-cli-doctor.ts +8 -5
  70. package/src/adapters/definitions/native-cli-jcode-home-init.ts +158 -0
  71. package/src/adapters/definitions/native-cli-jcode-home.ts +72 -0
  72. package/src/adapters/definitions/native-cli-jcode-mcp.ts +20 -0
  73. package/src/adapters/definitions/native-cli-skills.ts +29 -0
  74. package/src/adapters/definitions/native-context.ts +10 -0
  75. package/src/adapters/jcode.ts +10 -0
  76. package/src/adapters/local-worker.ts +3 -2
  77. package/src/adapters/pi.ts +15 -4
  78. package/src/cli/claude-profile-hook.ts +40 -3
  79. package/src/cli/console-state.ts +58 -27
  80. package/src/cli/console-usage.ts +5 -3
  81. package/src/cli/console.ts +35 -4
  82. package/src/cli/help.ts +17 -10
  83. package/src/cli/identity.ts +4 -2
  84. package/src/cli/instruction-hook.ts +28 -0
  85. package/src/cli/jcode-mcp.ts +2 -1
  86. package/src/cli/main.js +8 -0
  87. package/src/cli/main.ts +149 -23
  88. package/src/cli/output-standard.ts +3 -55
  89. package/src/cli/output.ts +8 -2
  90. package/src/cli/recovery-package.ts +62 -13
  91. package/src/cli/roadmap-write.ts +59 -0
  92. package/src/cli/roadmap.ts +115 -4
  93. package/src/cli/sdlc-output.ts +4 -0
  94. package/src/cli/setup-homes.ts +1 -0
  95. package/src/cli/setup.ts +1 -1
  96. package/src/cli/skills-install.ts +463 -0
  97. package/src/cli/task-output.ts +1 -1
  98. package/src/cli/upgrade-presentation-flags.ts +1 -1
  99. package/src/cli/upgrade-runtime.ts +10 -6
  100. package/src/hub/agent-mem-range.ts +43 -0
  101. package/src/hub/board.ts +144 -5
  102. package/src/hub/budget-projection.ts +99 -0
  103. package/src/hub/check-runner.ts +25 -1
  104. package/src/hub/claude-launch-proof.ts +5 -1
  105. package/src/hub/conductor.ts +8 -3
  106. package/src/hub/config-apply.ts +6 -3
  107. package/src/hub/config-tier.ts +1 -1
  108. package/src/hub/config-trust.ts +1 -1
  109. package/src/hub/context-window.ts +1 -1
  110. package/src/hub/control-client.ts +9 -2
  111. package/src/hub/cost-governance.ts +11 -7
  112. package/src/hub/daemon.ts +707 -53
  113. package/src/hub/dogfood-read.ts +4 -2
  114. package/src/hub/edit-guard.ts +100 -0
  115. package/src/hub/events.ts +80 -9
  116. package/src/hub/execution-budget.ts +29 -8
  117. package/src/hub/facts.ts +57 -4
  118. package/src/hub/hub-tools.ts +3 -1
  119. package/src/hub/inference.ts +1 -1
  120. package/src/hub/instances.ts +10 -1
  121. package/src/hub/instructed-exact.ts +95 -0
  122. package/src/hub/instructed-intent.ts +64 -0
  123. package/src/hub/instructed-ipc.ts +33 -0
  124. package/src/hub/instructed-runtime.ts +19 -0
  125. package/src/hub/instruction-receipt.ts +218 -0
  126. package/src/hub/lifecycle.ts +6 -1
  127. package/src/hub/log-rotation.ts +130 -0
  128. package/src/hub/manager.ts +46 -3
  129. package/src/hub/memory-profile.ts +137 -21
  130. package/src/hub/no-writes.ts +1 -0
  131. package/src/hub/operational-authority.ts +3 -2
  132. package/src/hub/operational-settings.ts +2 -2
  133. package/src/hub/recovery-store.ts +49 -21
  134. package/src/hub/registry.ts +1 -1
  135. package/src/hub/research-experiments.ts +132 -0
  136. package/src/hub/research-quality.ts +8 -2
  137. package/src/hub/research-record.ts +35 -0
  138. package/src/hub/research.ts +128 -28
  139. package/src/hub/roadmap-check.ts +65 -0
  140. package/src/hub/roadmap-decompose.ts +139 -0
  141. package/src/hub/roadmap-export.ts +27 -0
  142. package/src/hub/roadmap-sync.ts +97 -0
  143. package/src/hub/roadmap.ts +59 -1
  144. package/src/hub/routing.ts +18 -1
  145. package/src/hub/runtime-capture-prune.ts +2 -1
  146. package/src/hub/sdlc-branch-ci.ts +128 -0
  147. package/src/hub/sdlc-merge.ts +6 -3
  148. package/src/hub/sdlc-metrics.ts +19 -5
  149. package/src/hub/sdlc.ts +73 -5
  150. package/src/hub/settings.ts +3 -1
  151. package/src/hub/snapshots.ts +13 -1
  152. package/src/hub/startup-event-seeds.ts +21 -15
  153. package/src/hub/startup-timing.ts +3 -1
  154. package/src/hub/supervision-proposals.ts +10 -2
  155. package/src/hub/supervision-rules.ts +26 -3
  156. package/src/hub/supervision.ts +7 -0
  157. package/src/hub/task-pr.ts +47 -0
  158. package/src/hub/task-worktree.ts +18 -11
  159. package/src/hub/tasks.ts +694 -44
  160. package/src/hub/ui.ts +6 -2
  161. package/src/hub/usage-rollup.ts +77 -22
  162. package/src/local/tools.ts +13 -1
  163. package/src/memory/client.ts +3 -2
  164. package/src/pi/extension.ts +15 -3
  165. package/src/pi/tool-receipts.ts +26 -0
  166. package/src/ui/index.html +342 -8
  167. package/src/ui/plugin.ts +6 -2
  168. package/src/ui/roadmap-model.ts +70 -0
@@ -0,0 +1,59 @@
1
+ import { constants, closeSync, fchmodSync, fstatSync, linkSync, lstatSync, openSync, renameSync, unlinkSync, writeFileSync, type Stats } from "node:fs";
2
+ import { resolve } from "node:path";
3
+ import { randomUUID } from "node:crypto";
4
+ import { guardPath } from "../local/tools.ts";
5
+ import { matchesPolicy } from "../hub/path-policy.ts";
6
+ import { realPath } from "../hub/project.ts";
7
+ import { hubGitSync } from "../hub/git.ts";
8
+
9
+ /** Bind the caller's working tree to the selected hub repository, never to an unrelated checkout. */
10
+ export function roadmapWorktree(project: string, caller: string): string {
11
+ const rootResult = hubGitSync(["-C", caller, "rev-parse", "--show-toplevel"], { encoding: "utf8" });
12
+ if (rootResult.status !== 0 || typeof rootResult.stdout !== "string" || !rootResult.stdout.trim()) throw new Error("roadmap export needs a Git worktree");
13
+ const root = realPath(rootResult.stdout.trim());
14
+ const common = (dir: string) => {
15
+ const result = hubGitSync(["-C", dir, "rev-parse", "--git-common-dir"], { encoding: "utf8" });
16
+ if (result.status !== 0 || typeof result.stdout !== "string" || !result.stdout.trim()) throw new Error("roadmap export repository identity is unavailable");
17
+ return realPath(resolve(dir, result.stdout.trim()));
18
+ };
19
+ if (common(root) !== common(project)) throw new Error("roadmap export caller is in a different repository");
20
+ return root;
21
+ }
22
+
23
+ const same = (a: Stats | undefined, b: Stats | undefined) => a === undefined ? b === undefined : !!b && a.dev === b.dev && a.ino === b.ino && a.size === b.size && a.mtimeMs === b.mtimeMs && a.ctimeMs === b.ctimeMs;
24
+ /** Only the two fixed generated files are written. A changed or linked target refuses; partial completion is reported. */
25
+ export function writeRoadmap(root: string, files: { json: string; markdown: string }, policy: { deny: string[]; readOnly: string[]; pii: string[] }): void {
26
+ if (typeof files.json !== "string" || typeof files.markdown !== "string") throw new Error("roadmap export is malformed");
27
+ const base = realPath(root), directory = resolve(base, "docs"), folder = lstatSync(directory);
28
+ if (!folder.isDirectory() || folder.isSymbolicLink()) throw new Error("roadmap docs directory is not a plain directory");
29
+ const items = [["docs/roadmap.md", files.markdown], ["docs/roadmap.json", files.json]] as const;
30
+ const targets = items.map(([name, text]) => {
31
+ if (matchesPolicy(base, name, policy.pii, true)) throw new Error("roadmap export path is private");
32
+ const path = guardPath({ cwd: base, deny: policy.deny, readOnly: policy.readOnly }, name, "write");
33
+ if (path !== resolve(base, name)) throw new Error("roadmap export path is linked");
34
+ const before = lstatSync(path, { throwIfNoEntry: false });
35
+ if (before && (!before.isFile() || before.isSymbolicLink() || before.nlink !== 1)) throw new Error("roadmap export target is not a plain file");
36
+ return { name, text, path, before };
37
+ });
38
+ let written = 0;
39
+ try {
40
+ for (const target of targets) {
41
+ const temp = resolve(directory, `.roadmap-${randomUUID()}.tmp`); let fd: number | undefined;
42
+ try {
43
+ fd = openSync(temp, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 0o600);
44
+ writeFileSync(fd, target.text); fchmodSync(fd, target.before ? target.before.mode & 0o777 : 0o644); const created = fstatSync(fd);
45
+ if (!created.isFile() || created.nlink !== 1) throw new Error("temporary export is not a plain file");
46
+ closeSync(fd); fd = undefined;
47
+ if (guardPath({ cwd: base, deny: policy.deny, readOnly: policy.readOnly }, target.name, "write") !== target.path || !same(target.before, lstatSync(target.path, { throwIfNoEntry: false }))) throw new Error("roadmap export target changed");
48
+ // ponytail: no portable conditional rename for an existing inode; a tiny compare-to-rename race remains. Use a kernel conditional replacement if one becomes available.
49
+ if (target.before) renameSync(temp, target.path); else { linkSync(temp, target.path); unlinkSync(temp); }
50
+ written++;
51
+ } finally { if (fd !== undefined) closeSync(fd); try { unlinkSync(temp); } catch {} }
52
+ }
53
+ } catch (error) {
54
+ const code = error && typeof error === "object" && "code" in error && typeof error.code === "string" && /^E[A-Z0-9]+$/.test(error.code) ? error.code : undefined;
55
+ const message = error instanceof Error && ["roadmap export target changed", "temporary export is not a plain file"].includes(error.message) ? error.message : undefined;
56
+ const cause = code ?? message ?? "unknown write failure";
57
+ throw new Error(written ? `roadmap export partially written (${cause}); inspect both files before retrying` : `roadmap export was not written (${cause}); inspect the paths before retrying`);
58
+ }
59
+ }
@@ -10,33 +10,69 @@ export const ROADMAP_FORMS = {
10
10
  order: "order <id> <n>", state: "state <id> <proposed|planned|active|done|dropped>",
11
11
  unplaced: "unplaced [--repo <owner/name>] [--json]",
12
12
  triage: "triage [--repo <owner/name>] [--list] [--json]",
13
+ decompose: "decompose <id> [--accept <part>] [--publish [--apply --confirm <fingerprint>]] [--json]",
13
14
  accept: "accept <suggestion>", reject: "reject <suggestion>",
14
15
  importGithub: "import-github [--repo <owner/name>] [--apply] [--json]",
16
+ check: "check [--json]", sync: "sync [--apply --confirm <fingerprint>] [--json]",
17
+ export: "export [--write | --issue <n> [--apply --confirm <fingerprint>]] [--json]",
15
18
  } as const;
16
19
  export const ROADMAP_USAGE = `usage: ${Object.values(ROADMAP_FORMS).map(form => `ahub roadmap ${form}`).join(" | ")}`;
17
20
  export interface RoadmapArgs {
18
- op: "hub_roadmap_list" | "hub_roadmap_show" | "hub_roadmap_edit" | "hub_roadmap_unplaced" | "hub_roadmap_triage" | "roadmap_import_github";
21
+ op: "hub_roadmap_list" | "hub_roadmap_show" | "hub_roadmap_check" | "hub_roadmap_edit" | "hub_roadmap_unplaced" | "hub_roadmap_triage" | "hub_roadmap_decompose" | "roadmap_import_github" | "roadmap_sync" | "roadmap_sync_apply" | "roadmap_export" | "roadmap_export_apply";
19
22
  args: Record<string, unknown>;
20
23
  json: boolean;
24
+ write?: boolean;
21
25
  }
22
26
  /** R3 commands: their flags are not milestone fields, so they are parsed apart from new/edit. */
23
- const R3_COMMANDS = ["unplaced", "triage", "accept", "reject", "import-github"];
24
- const R3_JSON = ["unplaced", "triage", "import-github"];
27
+ const R3_COMMANDS = ["unplaced", "triage", "decompose", "accept", "reject", "import-github"];
28
+ const R3_JSON = ["unplaced", "triage", "decompose", "import-github"];
25
29
  const fieldFlags = ["title", "outcome", "horizon", "order", "target", "parent"];
26
30
  const usage = (message: string): never => { throw new Error(`${message}; ${ROADMAP_USAGE}`); };
31
+
32
+ function parseR4(command: string, rest: readonly string[], jsonSeen: boolean): RoadmapArgs {
33
+ let json = jsonSeen, apply = false, write = false, issue: number | undefined, confirm: string | undefined;
34
+ for (let i = 0; i < rest.length; i++) {
35
+ const word = rest[i]!;
36
+ if (word === "--json" && !json) json = true;
37
+ else if (word === "--apply" && !apply && command !== "check") apply = true;
38
+ else if (word === "--write" && !write && command === "export") write = true;
39
+ else if (word === "--issue" && issue === undefined && command === "export") issue = integer(rest[++i]);
40
+ else if (word === "--confirm" && confirm === undefined && command !== "check") { confirm = rest[++i]; if (!confirm || !/^[a-f0-9]{64}$/.test(confirm)) return usage("roadmap confirmation needs a full fingerprint"); }
41
+ else return usage("unknown or duplicate roadmap option");
42
+ }
43
+ if (confirm && !apply || apply && !confirm || write && (apply || issue !== undefined) || command === "export" && apply && issue === undefined) return usage("roadmap apply needs its preview fingerprint and export --write is separate from --issue");
44
+ if (command === "check") return { op: "hub_roadmap_check", args: {}, json };
45
+ if (command === "sync") return { op: apply ? "roadmap_sync_apply" : "roadmap_sync", args: apply ? { apply, confirm } : {}, json };
46
+ return { op: apply ? "roadmap_export_apply" : "roadmap_export", args: { ...(issue === undefined ? {} : { issue }), ...(apply ? { apply, confirm } : {}) }, json, ...(write ? { write } : {}) };
47
+ }
27
48
  function integer(value: string | undefined, zero = false): number {
28
49
  if (value === undefined || !/^(0|[1-9][0-9]*)$/.test(value)) return usage("roadmap needs a whole-number operand");
29
50
  return zero ? milestoneRevision(Number(value)) : milestoneId(Number(value));
30
51
  }
31
52
 
32
53
  function parseR3(command: string, rest: readonly string[], jsonSeen: boolean): RoadmapArgs {
33
- let json = jsonSeen, list = false, apply = false, repo: string | undefined;
54
+ let json = jsonSeen, list = false, apply = false, repo: string | undefined, accept: number | undefined, publish = false, confirm: string | undefined;
34
55
  const operands: string[] = [];
35
56
  for (let at = 0; at < rest.length; at++) {
36
57
  const word = rest[at]!;
37
58
  if (word === "--json") { if (json) return usage("duplicate roadmap --json flag"); json = true; continue; }
38
59
  if (word === "--list" && command === "triage") { if (list) return usage("duplicate roadmap --list flag"); list = true; continue; }
39
60
  if (word === "--apply" && command === "import-github") { if (apply) return usage("duplicate roadmap --apply flag"); apply = true; continue; }
61
+ if (word === "--publish" && command === "decompose") { if (publish) return usage("duplicate roadmap --publish flag"); publish = true; continue; }
62
+ if (word === "--apply" && command === "decompose") { if (apply) return usage("duplicate roadmap --apply flag"); apply = true; continue; }
63
+ if ((word === "--confirm" || word.startsWith("--confirm=")) && command === "decompose") {
64
+ if (confirm !== undefined) return usage("duplicate roadmap --confirm option");
65
+ const value = word === "--confirm" ? rest[++at] : word.slice("--confirm=".length);
66
+ if (!value || !/^[a-f0-9]{64}$/.test(value)) return usage("roadmap confirmation needs a full fingerprint");
67
+ confirm = value;
68
+ continue;
69
+ }
70
+ if ((word === "--accept" || word.startsWith("--accept=")) && command === "decompose") {
71
+ if (accept !== undefined) return usage("duplicate roadmap --accept option");
72
+ const value = word === "--accept" ? rest[++at] : word.slice("--accept=".length);
73
+ accept = integer(value);
74
+ continue;
75
+ }
40
76
  if ((word === "--repo" || word.startsWith("--repo=")) && ["unplaced", "triage", "import-github"].includes(command)) {
41
77
  if (repo !== undefined) return usage("duplicate roadmap --repo option");
42
78
  const value = word === "--repo" ? rest[++at] : word.slice("--repo=".length);
@@ -48,10 +84,19 @@ function parseR3(command: string, rest: readonly string[], jsonSeen: boolean): R
48
84
  operands.push(word);
49
85
  }
50
86
  if (json && !R3_JSON.includes(command)) return usage(`roadmap ${command} has no --json form`);
87
+ if (command === "decompose") {
88
+ if ((apply || confirm !== undefined) && !publish) return usage("roadmap decompose apply needs its --publish preview");
89
+ if (apply !== (confirm !== undefined)) return usage("roadmap decompose --apply needs its preview fingerprint");
90
+ if (publish && accept !== undefined) return usage("roadmap decompose takes --accept <part> or --publish, not both");
91
+ }
51
92
  if (command === "accept" || command === "reject") {
52
93
  if (operands.length !== 1) return usage(`roadmap ${command} needs one suggestion id`);
53
94
  return { op: "hub_roadmap_edit", args: { op: command, suggestion: integer(operands[0]) }, json };
54
95
  }
96
+ if (command === "decompose") {
97
+ if (operands.length !== 1) return usage("roadmap decompose needs one milestone id");
98
+ return { op: "hub_roadmap_decompose", args: { id: integer(operands[0]), ...(accept === undefined ? {} : { accept }), ...(publish ? { publish: true } : {}), ...(apply ? { apply: true, confirm } : {}) }, json };
99
+ }
55
100
  if (operands.length) return usage(`roadmap ${command} takes no operands`);
56
101
  const base = repo === undefined ? {} : { repo };
57
102
  if (command === "unplaced") return { op: "hub_roadmap_unplaced", args: base, json };
@@ -65,6 +110,7 @@ export function parseRoadmapArgs(argv: readonly string[]): RoadmapArgs {
65
110
  if (argv[index] === "--json") { json = true; index++; }
66
111
  const command = argv[index] ?? "list";
67
112
  if (argv[index] !== undefined) index++;
113
+ if (["check", "sync", "export"].includes(command)) return parseR4(command, argv.slice(index), json);
68
114
  if (!["list", "show", "new", "edit", "link", "unlink", "order", "state", ...R3_COMMANDS].includes(command)) return usage("unknown roadmap command");
69
115
  if (R3_COMMANDS.includes(command)) return parseR3(command, argv.slice(index), json);
70
116
  const operands: string[] = [], flags = new Map<string, string>();
@@ -165,6 +211,48 @@ export function renderRoadmap(input: unknown, width = 80): string {
165
211
  }
166
212
  };
167
213
  const names = (rows: unknown[], one: (value: Row) => string) => { for (const value of rows) add(one(row(value))); };
214
+ if (Array.isArray(view.findings) && Array.isArray(view.unknown)) {
215
+ add(`Roadmap drift (${view.findings.length} findings)`);
216
+ names(view.findings, finding => ` Rule ${count(finding.rule)}, milestone ${finding.milestone === null ? "none" : count(finding.milestone)}: ${text(finding.cause)}; ${list(finding.items).map(text).join(", ")}. Next: ${text(finding.remedy)}`);
217
+ if (view.unknown.length) add(`Unknown evidence for rules: ${view.unknown.map(count).join(", ")}`);
218
+ if (view.truncated === true) add("More findings exist; narrow the roadmap before relying on this list.");
219
+ return lines.join("\n");
220
+ }
221
+ if (view.publish === true && Array.isArray(view.parts)) {
222
+ add(`Milestone ${count(view.milestone)} publish preview (${text(view.repo)})`);
223
+ for (const value of list(view.parts)) {
224
+ const part = row(value), issue = part.issue === null || part.issue === undefined ? null : `${text(view.repo)}#${count(part.issue)}`;
225
+ const action = part.action === "create" ? "a spec issue would be created"
226
+ : part.action === "published" ? `already published as ${issue}`
227
+ : part.action === "task" ? `goes straight to its held task ${count(part.task)}, so no issue`
228
+ : "released already, so this hold publishes nothing";
229
+ add(` part ${count(part.part)} (${part.intake === "spec" ? "needs its own spec issue" : "straight to a task"}): ${action}`);
230
+ }
231
+ if (!list(view.parts).length && !Number(view.skippedPrivate) && !Number(view.skippedUnknown)) add("This milestone holds no accepted part to publish.");
232
+ if (Number(view.skippedPrivate) > 0) add(`Private parts skipped: ${count(view.skippedPrivate)}; a private part is never published.`);
233
+ if (Number(view.skippedUnknown) > 0) add(`Parts with no stored text: ${count(view.skippedUnknown)}; run ahub roadmap decompose ${count(view.milestone)} to propose them again.`);
234
+ for (const call of list(view.calls)) if (Array.isArray(call)) add(` gh ${call.map(value => `'${String(value).replaceAll("'", "'\\''")}'`).join(" ")}`);
235
+ if (view.githubMilestone === null || view.githubMilestone === undefined) add("No GitHub milestone is bound to this roadmap milestone, so a created issue joins none; run ahub roadmap sync first.");
236
+ else add(`Each created issue joins GitHub milestone ${count(view.githubMilestone)}.`);
237
+ if (view.applied === true) add(`Created ${count(list(view.created).length)} issue${list(view.created).length === 1 ? "" : "s"}; the drafts stay held until ahub intake approve.`);
238
+ else add(`Apply this exact preview: ahub roadmap decompose ${count(view.milestone)} --publish --apply --confirm ${text(view.fingerprint)}`);
239
+ return lines.join("\n");
240
+ }
241
+ if (Array.isArray(view.calls) && typeof view.fingerprint === "string") {
242
+ add(`GitHub mirror: ${view.applied ? "applied" : "dry run"}`);
243
+ for (const call of view.calls) if (Array.isArray(call)) add(` gh ${call.map(value => `'${String(value).replaceAll("'", "'\\''")}'`).join(" ")}`);
244
+ for (const binding of list(view.bindings)) { const b = row(binding); add(` Bind local milestone ${count(b.milestone)} to GitHub milestone ${count(b.number)}`); }
245
+ if (!view.applied) add(`Apply this exact preview: ahub roadmap sync --apply --confirm ${text(view.fingerprint)}`);
246
+ return lines.join("\n");
247
+ }
248
+ if (typeof view.markdown === "string" && typeof view.fingerprint === "string") {
249
+ add(view.markdown);
250
+ const endpoint = Array.isArray(view.call) ? view.call[1] : undefined;
251
+ const issue = typeof endpoint === "string" ? /\/issues\/([1-9][0-9]*)$/.exec(endpoint)?.[1] : undefined;
252
+ if (issue && !view.applied) add(`Apply this exact issue preview: ahub roadmap export --issue ${issue} --apply --confirm ${text(view.fingerprint)}`);
253
+ if (view.applied) add("GitHub issue update confirmed.");
254
+ return lines.join("\n");
255
+ }
168
256
  if (Array.isArray(view.issues) && Array.isArray(view.tasks) && Array.isArray(view.specs) && view.privateTasks !== undefined) {
169
257
  add(`Unplaced work${view.repo ? ` (${text(view.repo)})` : ""}`);
170
258
  if (view.partial === true) add("Partial: the GitHub read stopped early or a list was cut, so these lists are a lower bound.");
@@ -178,6 +266,29 @@ export function renderRoadmap(input: unknown, width = 80): string {
178
266
  add(`Private tasks counted, not listed: ${count(view.privateTasks)}`);
179
267
  return lines.join("\n");
180
268
  }
269
+ if (typeof view.part === "number" && typeof view.milestone === "number" && view.task !== undefined && view.task !== null) {
270
+ const task = row(view.task), draft = count(task.id);
271
+ add(`Milestone ${count(view.milestone)} part ${count(view.part)}: ${view.created === true ? "held as intake draft" : "already held as intake draft"} ${draft}`);
272
+ add(` ${text(task.title)} (${text(task.state)})`);
273
+ add(` ${view.intake === "spec" ? "It needs its own spec issue before implementation." : "It goes straight to a task."}`);
274
+ add(` Nothing offers it until the hold is released: ahub intake approve ${draft}`);
275
+ return lines.join("\n");
276
+ }
277
+ if (Array.isArray(view.parts) && typeof view.milestone === "number") {
278
+ add(`Milestone ${count(view.milestone)} decomposition`);
279
+ if (view.unavailable) add(`Decompose unavailable: ${text(view.unavailable)}`);
280
+ const saved = row(view.saved);
281
+ if (view.saved !== null && view.saved !== undefined) add(`${count(view.parts.length)} part${view.parts.length === 1 ? "" : "s"} saved as pending model answer ${count(saved.id)}; nothing is intaken, linked or published.`);
282
+ if (Number(view.dropped) > 0) add(`Dropped ${count(view.dropped)} model part${Number(view.dropped) === 1 ? "" : "s"} that cited nothing it was shown or did not fit the split schema.`);
283
+ for (const value of list(view.parts)) {
284
+ const part = row(value);
285
+ add(` ${text(part.title)} -> ${part.intake === "spec" ? "needs its own spec issue" : "goes straight to a task"} (${text(part.class)})`);
286
+ add(` cites: ${list(part.cites).map(text).join(", ")}`);
287
+ add(` ${text(part.detail)}`);
288
+ }
289
+ if (!list(view.parts).length && !view.unavailable) add("The model proposed no part that cited an id it was shown.");
290
+ return lines.join("\n");
291
+ }
181
292
  if (Array.isArray(view.suggestions)) {
182
293
  add(`Triage suggestions (${view.suggestions.length})`);
183
294
  if (view.unavailable) add(`Triage unavailable: ${text(view.unavailable)}`);
@@ -269,6 +269,7 @@ const SUMMARY_ROWS: [string, string, boolean][] = [
269
269
  ["acceptance_to_plan_ms", "acceptance to plan", true], ["accepted_to_plan_ms", "task acceptance to plan", true], ["acceptance_to_first_review_ms", "acceptance to first review", true], ["acceptance_to_merge_ms", "acceptance to merge", true],
270
270
  ["rework_rounds", "rework rounds", false], ["same_head_ci_reruns", "same-head CI reruns", false], ["stale_head_re_reviews", "stale-head re-reviews", false],
271
271
  ["review_rounds_at_merge", "review rounds at merge", false], ["ci_runs_at_merge", "CI runs at merge", false], ["github_reviews_at_merge", "GitHub reviews at merge", false],
272
+ ["full_gate_runs", "full gate runs", false], ["successful_gate_runs", "successful gate runs", false], ["failed_gate_runs", "failed gate runs", false], ["cancelled_gate_runs", "cancelled gate runs", false], ["other_gate_runs", "other gate runs", false], ["macos_shard_runs", "macOS shard runs", false],
272
273
  ];
273
274
  const BAND_TONE: Record<string, Tone> = { ok: "success", log: "muted", diagnose: "attention", propose: "failure" };
274
275
  /** `ahub sdlc metrics [--since ...]`: times and counts from board history, the two approval rates, stalls and band tiers. */
@@ -310,6 +311,9 @@ export function renderSdlcCosts(result: unknown, columns?: number, _now = Date.n
310
311
  out.push(...(out.length > 1 ? [blank] : []), ...wrap(repo, room(columns), 2).map((line): Line => [s(line, "info")]), ...grid(["PR", "ROUNDS", "CI", "RERUNS", "FULL", "DELTA", "REVIEW", "UNK", "OK"], rows.filter(row => String(row.repo) === repo).map(row => [
311
312
  s(`#${row.pr}`, "issueRef"), s(count(row.reviewRounds)), s(count(row.ciRuns)), s(count(row.ciReruns)), s(count(row.fullReReviews)), s(count(row.deltaReviews)), s(span(row.reviewMs)),
312
313
  s(count(row.unknownReviewScopes), row.unknownReviewScopes ? "attention" : "muted"), s(row.complete ? "yes" : "no", row.complete ? "success" : "attention")]), columns));
314
+ for (const row of rows.filter(row => String(row.repo) === repo && row.fullGateRuns !== undefined)) {
315
+ out.push(...para(`#${row.pr}: full gates ${count(row.fullGateRuns)} (success ${count(row.successfulGateRuns)}, failed ${count(row.failedGateRuns)}, cancelled ${count(row.cancelledGateRuns)}, other ${count(row.otherGateRuns)}); macOS shards ${count(row.macosShardRuns)}`, columns));
316
+ }
313
317
  }
314
318
  if (c?.truncated) out.push(blank, ...para("truncated: more PRs than one read covers, or a read was incomplete", columns, "attention"));
315
319
  if (c?.privateTasks === "withheld") out.push(...para("private tasks are withheld", columns, "muted"));
@@ -32,6 +32,7 @@ export async function setupClaudeHomes(ports: SetupHomesPorts): Promise<void> {
32
32
  }
33
33
  for (const check of initial) if (check.next) ports.print(`${check.home.path}: ${check.next.blocked ? "setup blocked" : check.next.argv.join(" ")} (${check.next.why})`);
34
34
  if (initial.every(check => !check.next && check.hook.state === "installed")) return;
35
+ if (ports.hook?.instruction && initial.some(check => check.hook.state !== "installed")) ports.print("The Claude UserPromptSubmit and Stop hooks record and close hash-only pending instruction evidence; they grant no command authority.");
35
36
  if (!ports.yes && ports.interactive === false) throw new Error("not a terminal: nothing was changed; rerun with --yes to apply");
36
37
  if (!ports.yes && !["y", "yes"].includes((await ports.ask("Install the hub plugin and project-neutral hook in these Claude homes? [y/N] "))?.trim().toLowerCase() ?? "")) { ports.print("Claude setup was not changed."); return; }
37
38
  ports.current?.();
package/src/cli/setup.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  /** Compatibility exports; native plugin policy belongs to its adapter definition leaf. */
2
- export { PLUGIN, CLAUDE_PLUGIN_INVENTORY, parseList, pluginState, nextStep, type InstalledPlugin, type Marketplace, type PluginState, type SetupStep } from "../adapters/definitions/native-cli-claude-setup.ts";
2
+ export { PLUGIN, HUB_SKILL_NAMES, hubSkillsPresent, CLAUDE_PLUGIN_INVENTORY, parseList, pluginState, nextStep, type InstalledPlugin, type Marketplace, type PluginState, type SetupStep } from "../adapters/definitions/native-cli-claude-setup.ts";