@indigoai-us/hq-cli 5.345.219 → 5.345.221

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 (199) hide show
  1. package/CHANGELOG.md +170 -0
  2. package/dist/command-catalog.generated.d.ts +169 -3
  3. package/dist/command-catalog.generated.js +206 -3
  4. package/dist/commands/auth.js +4 -1
  5. package/dist/commands/bot-runtime.d.ts +18 -5
  6. package/dist/commands/bot-runtime.js +29 -12
  7. package/dist/commands/bot.d.ts +85 -0
  8. package/dist/commands/bot.js +245 -16
  9. package/dist/commands/cloud.d.ts +16 -0
  10. package/dist/commands/cloud.js +112 -102
  11. package/dist/commands/core-checkpoint-native.d.ts +13 -0
  12. package/dist/commands/core-checkpoint-native.js +167 -52
  13. package/dist/commands/core-hook-registration-plan.js +5 -4
  14. package/dist/commands/core-stop-autosave.d.ts +21 -0
  15. package/dist/commands/core-stop-autosave.js +300 -0
  16. package/dist/commands/core.js +2 -0
  17. package/dist/commands/daemon.d.ts +5 -0
  18. package/dist/commands/daemon.js +52 -9
  19. package/dist/commands/doctor-usage.d.ts +5 -0
  20. package/dist/commands/doctor-usage.js +25 -0
  21. package/dist/commands/env.d.ts +49 -4
  22. package/dist/commands/env.js +355 -5
  23. package/dist/commands/integrations.js +84 -3
  24. package/dist/commands/lanes-shared.d.ts +3 -0
  25. package/dist/commands/lanes.d.ts +3 -0
  26. package/dist/commands/lanes.js +87 -3
  27. package/dist/commands/packs.js +23 -0
  28. package/dist/commands/pkg-update.d.ts +6 -0
  29. package/dist/commands/pkg-update.js +15 -7
  30. package/dist/commands/run.js +55 -45
  31. package/dist/commands/sources.js +4 -3
  32. package/dist/commands/sync-core.d.ts +1 -0
  33. package/dist/commands/sync-core.js +77 -3
  34. package/dist/commands/whoami.js +96 -80
  35. package/dist/lib/bot/config.d.ts +17 -0
  36. package/dist/lib/bot/config.js +13 -0
  37. package/dist/lib/bot/fleet-cron.js +29 -4
  38. package/dist/lib/bot/fleet-local.d.ts +30 -2
  39. package/dist/lib/bot/fleet-local.js +60 -1
  40. package/dist/lib/bot/grok-login-scope.d.ts +36 -0
  41. package/dist/lib/bot/grok-login-scope.js +93 -0
  42. package/dist/lib/bot/inflight.d.ts +9 -0
  43. package/dist/lib/bot/jobs/hot-signal-sync.d.ts +51 -0
  44. package/dist/lib/bot/jobs/hot-signal-sync.js +90 -9
  45. package/dist/lib/bot/legacy-provider-login.d.ts +32 -9
  46. package/dist/lib/bot/legacy-provider-login.js +28 -22
  47. package/dist/lib/bot/run.d.ts +29 -5
  48. package/dist/lib/bot/run.js +203 -1
  49. package/dist/lib/bot/runtime-sign-in-check.js +6 -1
  50. package/dist/lib/bot/runtime-sign-in.d.ts +2 -0
  51. package/dist/lib/bot/signals-try-now.d.ts +76 -0
  52. package/dist/lib/bot/signals-try-now.js +111 -0
  53. package/dist/lib/capacity/collectors/claude-oauth.d.ts +22 -3
  54. package/dist/lib/capacity/collectors/claude-oauth.js +78 -22
  55. package/dist/lib/capacity/scheduler.d.ts +8 -0
  56. package/dist/lib/capacity/scheduler.js +5 -2
  57. package/dist/lib/core-utils/sentry-report.js +2 -0
  58. package/dist/lib/daemon/machine-checks.d.ts +22 -1
  59. package/dist/lib/daemon/machine-checks.js +54 -12
  60. package/dist/lib/daemon/run.js +71 -8
  61. package/dist/lib/daemon/runtime-notifications.d.ts +7 -0
  62. package/dist/lib/daemon/runtime-notifications.js +50 -0
  63. package/dist/lib/daemon/stop-autosave-lock.d.ts +19 -0
  64. package/dist/lib/daemon/stop-autosave-lock.js +166 -0
  65. package/dist/lib/daemon/stop-autosave.d.ts +28 -0
  66. package/dist/lib/daemon/stop-autosave.js +111 -0
  67. package/dist/lib/daemon/stop-diagnostics.d.ts +11 -0
  68. package/dist/lib/daemon/stop-diagnostics.js +136 -0
  69. package/dist/lib/daemon/stop-job-executor.d.ts +19 -0
  70. package/dist/lib/daemon/stop-job-executor.js +126 -0
  71. package/dist/lib/daemon/stop-jobs.d.ts +93 -0
  72. package/dist/lib/daemon/stop-jobs.js +599 -0
  73. package/dist/lib/doctor/checks/fleet-hook-core.d.ts +9 -1
  74. package/dist/lib/doctor/checks/fleet-hook-core.js +39 -15
  75. package/dist/lib/doctor/checks/host-core.js +1 -1
  76. package/dist/lib/environment/access-probes.d.ts +234 -0
  77. package/dist/lib/environment/access-probes.js +918 -0
  78. package/dist/lib/environment/profile.d.ts +15 -2
  79. package/dist/lib/environment/profile.js +55 -20
  80. package/dist/lib/environment/rfc3339.d.ts +8 -0
  81. package/dist/lib/environment/rfc3339.js +26 -0
  82. package/dist/lib/environment/work-requirements.d.ts +169 -0
  83. package/dist/lib/environment/work-requirements.js +389 -0
  84. package/dist/lib/hook-engine/coverage.d.ts +137 -7
  85. package/dist/lib/hook-engine/coverage.js +1424 -4
  86. package/dist/lib/hook-engine/fleet-registration.d.ts +17 -5
  87. package/dist/lib/hook-engine/fleet-registration.js +53 -17
  88. package/dist/lib/hook-engine/git-stop-config.json +513 -0
  89. package/dist/lib/hook-engine/native-stop-compatibility.json +311 -0
  90. package/dist/lib/hook-engine/reconcile.js +2 -2
  91. package/dist/lib/hot-channels/alert.d.ts +10 -1
  92. package/dist/lib/hot-channels/alert.js +38 -8
  93. package/dist/lib/hot-channels/signals-claude-login.d.ts +53 -0
  94. package/dist/lib/hot-channels/signals-claude-login.js +96 -0
  95. package/dist/lib/hot-channels/signals-pass.d.ts +143 -17
  96. package/dist/lib/hot-channels/signals-pass.js +324 -17
  97. package/dist/lib/hot-channels/signals-runtime.d.ts +30 -0
  98. package/dist/lib/hot-channels/signals-runtime.js +82 -0
  99. package/dist/lib/install/hook-target.js +1 -1
  100. package/dist/lib/lanes/host-capacity.d.ts +26 -2
  101. package/dist/lib/lanes/host-capacity.js +17 -2
  102. package/dist/lib/lanes/host-compute.d.ts +90 -0
  103. package/dist/lib/lanes/host-compute.js +185 -0
  104. package/dist/lib/lanes/index.d.ts +2 -0
  105. package/dist/lib/lanes/index.js +1 -0
  106. package/dist/lib/lanes/reconcile.js +22 -1
  107. package/dist/lib/lanes/resource-usage.d.ts +155 -0
  108. package/dist/lib/lanes/resource-usage.js +589 -0
  109. package/dist/lib/lanes/run-size.d.ts +46 -0
  110. package/dist/lib/lanes/run-size.js +197 -0
  111. package/dist/lib/lanes/store.js +27 -0
  112. package/dist/lib/lanes/throttle.d.ts +36 -1
  113. package/dist/lib/lanes/throttle.js +47 -10
  114. package/dist/lib/lanes/types.d.ts +40 -0
  115. package/dist/lib/lanes/types.js +2 -2
  116. package/dist/lib/lanes/watcher.js +13 -4
  117. package/dist/lib/lanes/worker-process.d.ts +25 -2
  118. package/dist/lib/lanes/worker-process.js +71 -19
  119. package/dist/lib/placement/match.d.ts +192 -0
  120. package/dist/lib/placement/match.js +667 -0
  121. package/dist/lib/safe-store.d.ts +14 -0
  122. package/dist/lib/safe-store.js +77 -4
  123. package/dist/lib/search-index/index.d.ts +88 -4
  124. package/dist/lib/search-index/index.js +299 -25
  125. package/dist/lib/search-index/max-doc-bytes.d.ts +17 -6
  126. package/dist/lib/search-index/max-doc-bytes.js +48 -23
  127. package/dist/lib/signals/codex-lockdown.d.ts +79 -0
  128. package/dist/lib/signals/codex-lockdown.js +271 -0
  129. package/dist/lib/signals/codex-login.d.ts +37 -0
  130. package/dist/lib/signals/codex-login.js +83 -0
  131. package/dist/lib/signals/engine.d.ts +28 -0
  132. package/dist/lib/signals/engine.js +77 -0
  133. package/dist/lib/signals/reply.d.ts +48 -0
  134. package/dist/lib/signals/reply.js +94 -12
  135. package/dist/lib/signals/run-record.js +6 -1
  136. package/dist/lib/signals/settings.d.ts +5 -0
  137. package/dist/lib/signals/settings.js +2 -0
  138. package/dist/lib/signals/steps/adapters.js +6 -0
  139. package/dist/lib/signals/steps/extract.d.ts +135 -12
  140. package/dist/lib/signals/steps/extract.js +416 -84
  141. package/dist/lib/signals/steps/types.d.ts +21 -0
  142. package/dist/lib/sync-core/engine-home.d.ts +41 -2
  143. package/dist/lib/sync-core/engine-home.js +132 -19
  144. package/dist/lib/sync-core/reconcile.js +1 -1
  145. package/dist/lib/sync-core/release-compare.d.ts +7 -0
  146. package/dist/lib/sync-core/release-compare.js +16 -0
  147. package/dist/lib/sync-core/release.d.ts +2 -1
  148. package/dist/lib/sync-core/release.js +2 -10
  149. package/dist/lib/sync-core/rollout-state.d.ts +2 -1
  150. package/dist/lib/sync-core/rollout-state.js +5 -2
  151. package/dist/lib/sync-core/vault-uid.d.ts +2 -0
  152. package/dist/lib/sync-core/vault-uid.js +4 -0
  153. package/dist/run/schema-env-overrides.d.ts +24 -0
  154. package/dist/run/schema-env-overrides.js +72 -0
  155. package/dist/schemas/hq-work-requirements.v1.schema.json +145 -0
  156. package/dist/utils/auth-session-check.d.ts +16 -0
  157. package/dist/utils/auth-session-check.js +16 -0
  158. package/dist/utils/client-health-contract.d.ts +6 -0
  159. package/dist/utils/client-health-contract.js +13 -0
  160. package/dist/utils/client-health.d.ts +7 -0
  161. package/dist/utils/client-health.js +22 -1
  162. package/dist/utils/command-usage.d.ts +40 -0
  163. package/dist/utils/command-usage.js +61 -0
  164. package/dist/utils/duplicate-command-usage.d.ts +72 -0
  165. package/dist/utils/duplicate-command-usage.js +125 -0
  166. package/dist/utils/host-registration.d.ts +1 -1
  167. package/dist/utils/host-registration.js +6 -1
  168. package/dist/utils/resident-package-preload.js +4 -0
  169. package/dist/utils/sentry-fingerprint.js +9 -0
  170. package/dist/utils/windows-bash.d.ts +2 -0
  171. package/dist/utils/windows-bash.js +2 -1
  172. package/package.json +15 -10
  173. package/scripts/bench-core-compare.mjs +313 -0
  174. package/scripts/bench-core.mjs +399 -12
  175. package/scripts/check-function-manifest.mjs +121 -7
  176. package/dist/commands/__fixtures__/access-vault.d.ts +0 -95
  177. package/dist/commands/__fixtures__/access-vault.js +0 -166
  178. package/dist/commands/__fixtures__/make-tar.d.ts +0 -38
  179. package/dist/commands/__fixtures__/make-tar.js +0 -102
  180. package/dist/commands/secrets-public-types.test-d.d.ts +0 -2
  181. package/dist/commands/secrets-public-types.test-d.js +0 -18
  182. package/dist/lib/decisions/fixtures/us001.d.ts +0 -137
  183. package/dist/lib/decisions/fixtures/us001.js +0 -21
  184. package/dist/lib/doctor/__testing__/fake-hq-tree.d.ts +0 -226
  185. package/dist/lib/doctor/__testing__/fake-hq-tree.js +0 -408
  186. package/dist/lib/doctor/__testing__/run-doctor.d.ts +0 -8
  187. package/dist/lib/doctor/__testing__/run-doctor.js +0 -69
  188. package/dist/lib/fingerprint/fixtures.d.ts +0 -19
  189. package/dist/lib/fingerprint/fixtures.js +0 -61
  190. package/dist/lib/hot-channels/adapters/__fixtures__/dummy.d.ts +0 -33
  191. package/dist/lib/hot-channels/adapters/__fixtures__/dummy.js +0 -53
  192. package/dist/lib/hot-channels/adapters/__fixtures__/meeting-providers.d.ts +0 -38
  193. package/dist/lib/hot-channels/adapters/__fixtures__/meeting-providers.js +0 -64
  194. package/dist/lib/mesh/live/daemon/mqtt-events.test-d.d.ts +0 -2
  195. package/dist/lib/mesh/live/daemon/mqtt-events.test-d.js +0 -10
  196. package/dist/lib/test-utils/isolated-flag-company-context.d.ts +0 -3
  197. package/dist/lib/test-utils/isolated-flag-company-context.js +0 -18
  198. package/scripts/hook-engine-manifest.mjs +0 -22
  199. package/scripts/mesh-daemon-if-stale.mjs +0 -20
@@ -1,137 +0,0 @@
1
- /** Producer-service fixtures verified against hq-pro PR #5060 at 7c234efa (in-memory service output; handler wrappers). */
2
- import type { Decision } from "../client.js";
3
- export declare const openDecision: Decision;
4
- export declare const decisionFixtures: {
5
- create: {
6
- decision: Decision;
7
- };
8
- list: {
9
- decisions: Decision[];
10
- };
11
- answer: {
12
- decision: {
13
- state: string;
14
- updatedAt: string;
15
- answer: {
16
- choiceId: string;
17
- by: string;
18
- at: string;
19
- source: string;
20
- };
21
- id: string;
22
- askerPrincipal: string;
23
- companyUid: string;
24
- audience: {
25
- kind: "person";
26
- personUid: string;
27
- } | {
28
- kind: "company_admins";
29
- };
30
- statement: string;
31
- options: import("../client.js").DecisionOption[];
32
- context: {
33
- links: string[];
34
- brief: string;
35
- commitmentId: string | null;
36
- };
37
- talkThreadId: string | null;
38
- createdAt: string;
39
- expiresAt: string;
40
- };
41
- };
42
- talk: {
43
- decision: {
44
- state: string;
45
- updatedAt: string;
46
- talkThreadId: null;
47
- id: string;
48
- askerPrincipal: string;
49
- companyUid: string;
50
- audience: {
51
- kind: "person";
52
- personUid: string;
53
- } | {
54
- kind: "company_admins";
55
- };
56
- statement: string;
57
- options: import("../client.js").DecisionOption[];
58
- context: {
59
- links: string[];
60
- brief: string;
61
- commitmentId: string | null;
62
- };
63
- answer: {
64
- choiceId: string;
65
- by: string;
66
- at: string;
67
- source: "tap" | "thread" | "desktop";
68
- } | null;
69
- createdAt: string;
70
- expiresAt: string;
71
- };
72
- };
73
- withdraw: {
74
- decision: {
75
- state: string;
76
- updatedAt: string;
77
- id: string;
78
- askerPrincipal: string;
79
- companyUid: string;
80
- audience: {
81
- kind: "person";
82
- personUid: string;
83
- } | {
84
- kind: "company_admins";
85
- };
86
- statement: string;
87
- options: import("../client.js").DecisionOption[];
88
- context: {
89
- links: string[];
90
- brief: string;
91
- commitmentId: string | null;
92
- };
93
- answer: {
94
- choiceId: string;
95
- by: string;
96
- at: string;
97
- source: "tap" | "thread" | "desktop";
98
- } | null;
99
- talkThreadId: string | null;
100
- createdAt: string;
101
- expiresAt: string;
102
- };
103
- };
104
- expired: {
105
- decision: {
106
- state: string;
107
- updatedAt: string;
108
- id: string;
109
- askerPrincipal: string;
110
- companyUid: string;
111
- audience: {
112
- kind: "person";
113
- personUid: string;
114
- } | {
115
- kind: "company_admins";
116
- };
117
- statement: string;
118
- options: import("../client.js").DecisionOption[];
119
- context: {
120
- links: string[];
121
- brief: string;
122
- commitmentId: string | null;
123
- };
124
- answer: {
125
- choiceId: string;
126
- by: string;
127
- at: string;
128
- source: "tap" | "thread" | "desktop";
129
- } | null;
130
- talkThreadId: string | null;
131
- createdAt: string;
132
- expiresAt: string;
133
- };
134
- };
135
- };
136
- export declare const decisionRoutes: string[][];
137
- //# sourceMappingURL=us001.d.ts.map
@@ -1,21 +0,0 @@
1
- export const openDecision = {
2
- id: "f3ccdf93-9b7e-4564-a3ad-566067900aee", companyUid: "cmp_indigo", askerPrincipal: "agt_personal", audience: { kind: "person", personUid: "prs_owner" },
3
- statement: "Release the update?",
4
- options: [{ id: "A", label: "Release", recommended: true }, { id: "B", label: "Wait", recommended: false }],
5
- context: { links: ["https://example.com/review"], brief: "Checks passed", commitmentId: "cm_1" },
6
- state: "open", answer: null, talkThreadId: null,
7
- createdAt: "2026-10-18T02:00:00.000Z", expiresAt: "2026-10-19T02:00:00.000Z", updatedAt: "2026-10-18T02:00:00.000Z",
8
- };
9
- export const decisionFixtures = {
10
- create: { decision: openDecision },
11
- list: { decisions: [openDecision] },
12
- answer: { decision: { ...openDecision, state: "answered", updatedAt: "2026-10-18T03:00:00.000Z", answer: { choiceId: "A", by: "prs_owner", at: "2026-10-18T03:00:00.000Z", source: "desktop" } } },
13
- talk: { decision: { ...openDecision, state: "talking", updatedAt: "2026-10-18T03:00:00.000Z", talkThreadId: null } },
14
- withdraw: { decision: { ...openDecision, state: "withdrawn", updatedAt: "2026-10-18T03:00:00.000Z" } },
15
- expired: { decision: { ...openDecision, state: "expired", updatedAt: "2026-10-19T03:00:00.000Z" } },
16
- };
17
- export const decisionRoutes = [
18
- ["POST", "/v1/decisions"], ["GET", "/v1/decisions"],
19
- ["POST", "/v1/decisions/{id}/answer"], ["POST", "/v1/decisions/{id}/talk"], ["POST", "/v1/decisions/{id}/withdraw"],
20
- ];
21
- //# sourceMappingURL=us001.js.map
@@ -1,226 +0,0 @@
1
- /**
2
- * buildFakeHqTree — a reusable test harness that materialises a fake HQ tree in
3
- * the OS temp directory from a declarative spec.
4
- *
5
- * Every `hq doctor` check is fundamentally a function of the on-disk shape of an
6
- * HQ tree: which hooks exist, whether they are executable, whether they are
7
- * registered in settings, which `hook-gate.sh` profiles list them, and whether
8
- * the Codex mirror still matches its Claude original. This helper lets a test
9
- * declare that shape — including its deliberately-broken variants — and get back
10
- * a throwaway tree plus a manifest describing exactly what was written, without
11
- * ever touching the real HQ tree.
12
- *
13
- * Design notes:
14
- * - Everything is written under a `mkdtempSync` root inside `os.tmpdir()`. The
15
- * real HQ tree is never read or written.
16
- * - The root path is canonicalised with `realpathSync` so callers can assert
17
- * containment under the temp dir on platforms (macOS) where the temp dir is
18
- * a symlink (`/var` -> `/private/var`).
19
- * - Cleanup is automatic: the first build registers a single `process` exit
20
- * handler that removes every tracked root, so nothing survives a test run,
21
- * including on test failure. `tree.cleanup()` is also exposed for eager
22
- * removal, and is idempotent.
23
- *
24
- * The reference for this pattern is core/scripts/test-codex-hook-adapter.sh,
25
- * which stands up a throwaway HQ tree with `mktemp -d` and stubbed hook scripts.
26
- */
27
- /** Claude/Codex lifecycle events a hook can be registered against. */
28
- type HookEventName = "PreToolUse" | "PostToolUse" | "UserPromptSubmit" | "SessionStart" | "Stop" | "SubagentStop" | "PreCompact" | "Notification";
29
- /** The three `hook-gate.sh` allowlist profiles. */
30
- export type GateProfile = "minimal" | "standard" | "strict";
31
- /** Canonical ordering of the gate profiles. */
32
- export declare const GATE_PROFILES: readonly GateProfile[];
33
- /**
34
- * Declares a Codex mirror of a Claude hook. Claude and Grok both execute the
35
- * canonical `.claude/hooks/` scripts; only Codex runs duplicated copies, so the
36
- * Codex mirror is the entire drift surface the doctor has to watch.
37
- */
38
- interface FakeCodexMirrorSpec {
39
- /** Whether the mirror file is written to `.codex/hooks/`. Default: true. */
40
- present?: boolean;
41
- /**
42
- * Script body for the mirror. Defaults to the Claude original's body (an
43
- * identical, healthy mirror). Supply a different string to model content
44
- * drift between the Codex copy and its Claude original.
45
- */
46
- body?: string;
47
- /** Whether the mirror file carries the executable bit. Default: true. */
48
- executable?: boolean;
49
- /** Explicit file mode override (masked to 0o777). Overrides `executable`. */
50
- mode?: number;
51
- /** Whether the mirror is registered in `.codex/hooks.json`. Default: true. */
52
- registered?: boolean;
53
- /** Optional settings matcher (e.g. "Bash", "Glob"). */
54
- matcher?: string;
55
- }
56
- /** Declares a single hook and its cross-platform state. */
57
- export interface FakeHookSpec {
58
- /** Hook id, e.g. "detect-secrets". Also names the `<id>.sh` file. */
59
- id: string;
60
- /** Script body. Default: a trivial pass-through that exits 0. */
61
- body?: string;
62
- /**
63
- * Whether the `.claude/hooks/<id>.sh` file is written to disk. Default: true.
64
- * Set false to model a missing hook file (combine with `registered: true` for
65
- * a hook that is registered in settings but absent from disk).
66
- */
67
- present?: boolean;
68
- /**
69
- * Whether the hook file carries the executable bit. Default: true. Set false
70
- * to model a present-but-not-executable hook (mode 0o644).
71
- */
72
- executable?: boolean;
73
- /** Explicit file mode override (masked to 0o777). Overrides `executable`. */
74
- mode?: number;
75
- /** Whether the hook is registered in `.claude/settings.json`. Default: true. */
76
- registered?: boolean;
77
- /** Events the hook registers against. Default: SessionStart and PreToolUse. */
78
- events?: HookEventName[];
79
- /** Optional settings matcher (e.g. "Bash", "Glob"). */
80
- matcher?: string;
81
- /**
82
- * Which `hook-gate.sh` profiles list this id. Default: all three. Pass a
83
- * subset (e.g. ["minimal"]) to model a hook id present in only some of the
84
- * three profiles — the exact defect the three-profile check exists to catch.
85
- */
86
- profiles?: GateProfile[];
87
- /**
88
- * Codex mirror configuration. When omitted, a healthy identical mirror is
89
- * created. Pass `false` to model a Claude hook with no Codex counterpart, or
90
- * an object to override the mirror (e.g. `{ body }` to model content drift).
91
- */
92
- codex?: FakeCodexMirrorSpec | false;
93
- }
94
- /**
95
- * Declares the adapter-architecture Codex wiring: `.codex/config.toml` routing
96
- * lifecycle events to `hq-codex-hook-adapter.sh`, which dispatches the
97
- * `.claude/settings.json` hooks live. When this spec is present the tree models
98
- * a current-release root: no `.codex/hooks.json` and no per-hook mirrors are
99
- * written by default (declare a hook's `codex` spec explicitly, or set
100
- * `legacyHooksJson`, to model pre-adapter leftovers).
101
- */
102
- interface FakeCodexAdapterSpec {
103
- /** Events wired to the adapter in config.toml. Default: the shipped eight. */
104
- events?: string[];
105
- /** Whether the adapter script is written. Default: true. */
106
- adapterPresent?: boolean;
107
- /** Whether the adapter script carries the executable bit. Default: true. */
108
- adapterExecutable?: boolean;
109
- /** Whether `core/scripts/lib/hook-adapter-core.sh` is written. Default: true. */
110
- dispatchLibPresent?: boolean;
111
- /** Whether a leftover `.codex/hooks.json` is still written. Default: false. */
112
- legacyHooksJson?: boolean;
113
- }
114
- /** Declares the `.grok/hooks/` state. */
115
- interface FakeGrokSpec {
116
- /** Whether the `.grok/hooks/` scaffold is created at all. Default: true. */
117
- present?: boolean;
118
- /** Whether `hq-grok-hook-adapter.sh` carries the executable bit. Default: true. */
119
- adapterExecutable?: boolean;
120
- /**
121
- * Whether the user-global bridge under `~/.grok/hooks/` is recorded as
122
- * installed. The real bridge lives in the home dir and cannot be simulated in
123
- * a project-local temp tree, so this is a manifest flag only. Default: true.
124
- */
125
- bridgeInstalled?: boolean;
126
- }
127
- /** The declarative spec passed to {@link buildFakeHqTree}. */
128
- export interface FakeHqTreeSpec {
129
- /** Hooks to materialise. Default: none. */
130
- hooks?: FakeHookSpec[];
131
- /** Extra top-level keys merged into `.claude/settings.json`. */
132
- claudeSettings?: Record<string, unknown>;
133
- /**
134
- * Adapter-architecture Codex wiring. When set (object or `true` for a fully
135
- * healthy default), the tree models a current-release root: config.toml +
136
- * adapter + dispatch library, and no hooks.json or per-hook mirrors unless
137
- * explicitly declared. When omitted, the tree keeps the legacy mirror shape.
138
- */
139
- codexAdapter?: FakeCodexAdapterSpec | true;
140
- /** Grok scaffold config, or `false` to omit `.grok/`. Default: healthy. */
141
- grok?: FakeGrokSpec | false;
142
- /** Initialise a git repo at the tree root. Default: false. */
143
- git?: boolean;
144
- /** temp-dir name prefix. Default: "hq-doctor-fake-". */
145
- prefix?: string;
146
- }
147
- /** Manifest entry describing a materialised Codex mirror. */
148
- interface FakeCodexManifestEntry {
149
- /** Absolute path where the mirror lives (whether or not it was written). */
150
- scriptPath: string;
151
- /** Whether the mirror file exists on disk. */
152
- present: boolean;
153
- /** On-disk mode bits (0o777-masked), or null when absent. */
154
- mode: number | null;
155
- /** Whether the mirror carries the executable bit. */
156
- executable: boolean;
157
- /** Whether the mirror is registered in `.codex/hooks.json`. */
158
- registered: boolean;
159
- /** Whether the mirror's content differs from its Claude original. */
160
- drifted: boolean;
161
- }
162
- /** Manifest entry describing a materialised hook across all platforms. */
163
- interface FakeHookManifestEntry {
164
- id: string;
165
- /** Absolute path of the Claude script (whether or not it was written). */
166
- scriptPath: string;
167
- /** Whether the Claude hook file exists on disk. */
168
- present: boolean;
169
- /** On-disk mode bits (0o777-masked), or null when absent. */
170
- mode: number | null;
171
- /** Whether the Claude hook carries the executable bit. */
172
- executable: boolean;
173
- /** Whether the hook is registered in `.claude/settings.json`. */
174
- registered: boolean;
175
- /** Events the hook is registered against. */
176
- events: HookEventName[];
177
- /** Optional settings matcher (e.g. "Bash", "Glob"), or null when unset. */
178
- matcher: string | null;
179
- /** Which `hook-gate.sh` profiles list this id. */
180
- profiles: GateProfile[];
181
- /** The Codex mirror, or null when the hook has no Codex counterpart. */
182
- codex: FakeCodexManifestEntry | null;
183
- }
184
- /** A structured description of everything {@link buildFakeHqTree} wrote. */
185
- interface FakeHqTreeManifest {
186
- root: string;
187
- claudeSettingsPath: string;
188
- claudeHooksDir: string;
189
- claudeHookGatePath: string;
190
- codexHooksJsonPath: string;
191
- codexHooksDir: string;
192
- codexHookGatePath: string;
193
- /** Path of `.codex/config.toml`, or null when no adapter spec was given. */
194
- codexConfigTomlPath: string | null;
195
- /** Path of the adapter script, or null when no adapter spec was given. */
196
- codexAdapterPath: string | null;
197
- grokDir: string | null;
198
- grokAdapterPath: string | null;
199
- grokRegistrationPath: string | null;
200
- grokBridgeInstalled: boolean;
201
- gitInitialised: boolean;
202
- hooks: FakeHookManifestEntry[];
203
- }
204
- /** The handle returned by {@link buildFakeHqTree}. */
205
- export interface FakeHqTree {
206
- /** Absolute, canonicalised tree root under the OS temp dir. */
207
- root: string;
208
- /** Structured description of everything that was written. */
209
- manifest: FakeHqTreeManifest;
210
- /** Join a path relative to the tree root. */
211
- path: (...segments: string[]) => string;
212
- /** Remove this tree from disk. Idempotent. */
213
- cleanup: () => void;
214
- }
215
- /** Remove every fake HQ tree still on disk. Safe to call repeatedly. */
216
- export declare function cleanupAllFakeHqTrees(): void;
217
- /** The set of tree roots this process is still tracking for cleanup. */
218
- export declare function trackedFakeHqTreeRoots(): string[];
219
- /**
220
- * Materialise a fake HQ tree from `spec` and return its root, manifest, and a
221
- * cleanup handle. The tree lives under `os.tmpdir()` and is swept automatically
222
- * when the process exits.
223
- */
224
- export declare function buildFakeHqTree(spec?: FakeHqTreeSpec): FakeHqTree;
225
- export {};
226
- //# sourceMappingURL=fake-hq-tree.d.ts.map