@indigoai-us/hq-cli 5.307.0 → 5.309.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 (35) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/assets/scaffold/core/scripts/resolve-company.sh +199 -0
  3. package/dist/command-catalog.generated.d.ts +13 -0
  4. package/dist/command-catalog.generated.js +16 -0
  5. package/dist/commands/core-resolve-company-command.d.ts +4 -0
  6. package/dist/commands/core-resolve-company-command.js +42 -0
  7. package/dist/commands/core-resolve-company-native.d.ts +28 -0
  8. package/dist/commands/core-resolve-company-native.js +408 -0
  9. package/dist/commands/core.js +3 -0
  10. package/dist/commands/lanes-checks.d.ts +7 -1
  11. package/dist/commands/lanes-checks.js +68 -18
  12. package/dist/commands/lanes-report.js +5 -2
  13. package/dist/fast-scaffold.js +12 -0
  14. package/dist/lib/doctor/checks/codex-wiring.d.ts +0 -4
  15. package/dist/lib/doctor/checks/codex-wiring.js +2 -2
  16. package/dist/lib/doctor/checks/runtime-health.d.ts +0 -17
  17. package/dist/lib/doctor/checks/runtime-health.js +4 -4
  18. package/dist/lib/doctor/checks/scaffold-cli-floor.d.ts +0 -1
  19. package/dist/lib/doctor/checks/scaffold-cli-floor.js +1 -1
  20. package/dist/lib/doctor/compat.d.ts +0 -16
  21. package/dist/lib/doctor/compat.js +3 -3
  22. package/dist/lib/doctor/platform.d.ts +0 -26
  23. package/dist/lib/doctor/platform.js +5 -5
  24. package/dist/lib/lanes/autopilot.js +122 -102
  25. package/dist/lib/onboarding/errors.d.ts +2 -1
  26. package/dist/lib/onboarding/errors.js +1 -1
  27. package/dist/lib/onboarding/index.d.ts +2 -6
  28. package/dist/lib/onboarding/index.js +2 -5
  29. package/dist/lib/search-index/embed-lock.d.ts +0 -7
  30. package/dist/lib/search-index/embed-lock.js +1 -1
  31. package/dist/lib/search-index/load-gate.d.ts +0 -8
  32. package/dist/lib/search-index/load-gate.js +3 -3
  33. package/dist/lib/search-index/max-doc-bytes.d.ts +2 -3
  34. package/dist/lib/search-index/max-doc-bytes.js +1 -1
  35. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,7 +2,18 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [5.309.0] — 2026-10-01
6
+ - `hq lanes autopilot run` now evaluates leads based on lane ownership rather than a host label, and reports registered leads assigned to another host as skipped.
7
+ - Allow non-overlapping story-prefix teams to share a project in lane checks and reports.
8
+
9
+ ## [5.308.0] — 2026-10-01
10
+ - Added native `hq core audit-log`, `git-pack-extension-check`, `pin`, and `refresh-vault-access` commands behind the default-off `core-native-utilities` flag.
11
+ - CI now cancels superseded pull-request benchmarks and reserves the additional Windows and macOS checks for changes that affect those platform paths. Main pushes retain all platform checks.
12
+ - `hq lanes list` now settles legacy failed-dispatch mirrors as undispatched only after a successful strict owner snapshot returns no row; snapshot errors and mirrors with a host report remain unverified.
13
+ - Outpost pickup and remote database requests now time out, and failed pending DM lookups are reported.
14
+
5
15
  ## [5.307.0] — 2026-10-01
16
+ - Add native `hq core resolve-company` on the fast route behind the default-off `core-native-utilities` gate.
6
17
 
7
18
  - Stop immediately when hq-deploy repeats an app-list cursor while resolving apps.
8
19
 
@@ -0,0 +1,199 @@
1
+ #!/usr/bin/env bash
2
+ # hq-core: public
3
+ # resolve-company.sh — resolve the active company for skills and routing.
4
+ #
5
+ # Resolution order (first hit wins): explicit manifest slug in the prompt,
6
+ # session company_slug, enabled device default, then none. Prompt matching is
7
+ # whole-token only; free text never guesses a company.
8
+ #
9
+ # Output: {"company":"<slug>","source":"prompt|session|device_default|none"}
10
+ # Always exits 0 and never writes state.
11
+
12
+ set -uo pipefail
13
+
14
+ ROOT=""
15
+ PROMPT=""
16
+ HAVE_PROMPT=0
17
+
18
+ while [ $# -gt 0 ]; do
19
+ case "$1" in
20
+ --root) ROOT="${2:-}"; shift 2 || shift ;;
21
+ --prompt) PROMPT="${2:-}"; HAVE_PROMPT=1; shift 2 || shift ;;
22
+ --help|-h)
23
+ sed -n '2,14p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'
24
+ exit 0
25
+ ;;
26
+ *) shift ;;
27
+ esac
28
+ done
29
+
30
+ if [ "$HAVE_PROMPT" -eq 0 ] && [ ! -t 0 ]; then
31
+ PROMPT="$(cat 2>/dev/null || true)"
32
+ fi
33
+ : "${PROMPT:=}"
34
+
35
+ emit() {
36
+ printf '{"company":"%s","source":"%s"}\n' "$1" "$2"
37
+ exit 0
38
+ }
39
+
40
+ if [ -z "$ROOT" ]; then
41
+ ROOT="${HQ_ROOT:-${CLAUDE_PROJECT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && cd .. && pwd)}}"
42
+ fi
43
+
44
+ MANIFEST="$ROOT/companies/manifest.yaml"
45
+ [ -f "$MANIFEST" ] || emit "" "none"
46
+
47
+ SLUGS="$(
48
+ awk '
49
+ function keep(slug) {
50
+ return slug != "" && slug != "_template" && slug != "companies" && slug != "unaffiliated_repos"
51
+ }
52
+ /^companies:[[:space:]]*$/ { wrapped = 1; next }
53
+ wrapped && /^[^[:space:]][^:]*:[[:space:]]*$/ { wrapped = 0 }
54
+ wrapped && /^ [A-Za-z][A-Za-z0-9_-]*:/ {
55
+ line = $0; sub(/^[[:space:]]+/, "", line); sub(/:.*/, "", line)
56
+ if (keep(line)) print line
57
+ next
58
+ }
59
+ !wrapped && /^[A-Za-z][A-Za-z0-9_-]*:/ {
60
+ line = $0; sub(/:.*/, "", line)
61
+ if (keep(line)) print line
62
+ }
63
+ ' "$MANIFEST" | sort -u
64
+ )"
65
+ [ -n "$SLUGS" ] || emit "" "none"
66
+
67
+ is_known_slug() {
68
+ printf '%s\n' "$SLUGS" | grep -Fxq "$1"
69
+ }
70
+
71
+ prompt_slug() {
72
+ local normalized="" match=""
73
+ [ -n "$PROMPT" ] || return 0
74
+ normalized="$(printf '%s' "$PROMPT" | tr '[:upper:]' '[:lower:]' | tr -c 'a-z0-9_-' ' ')"
75
+ match="$(
76
+ # Prompt normalization is case-insensitive, but company IDs are not.
77
+ # Keep a folded match only when exactly one registered ID has that key.
78
+ # If IDs differ only by case, do not guess which tenant the prompt means.
79
+ printf '%s\n' "$SLUGS" | awk -v line="$normalized" '
80
+ BEGIN {
81
+ n = split(line, tok, /[ \t]+/)
82
+ for (i = 1; i <= n; i++) if (tok[i] != "" && !(tok[i] in pos)) pos[tok[i]] = i
83
+ bestSlug = ""; bestLen = 0; bestPos = 0
84
+ }
85
+ {
86
+ slug = $0
87
+ key = tolower(slug)
88
+ if (key in pos) {
89
+ matches[key]++
90
+ candidate[key] = slug
91
+ }
92
+ }
93
+ END {
94
+ for (key in matches) {
95
+ if (matches[key] != 1) continue
96
+ slug = candidate[key]
97
+ len = length(slug); p = pos[key]
98
+ if (len > bestLen || (len == bestLen && p < bestPos)) {
99
+ bestSlug = slug; bestLen = len; bestPos = p
100
+ }
101
+ }
102
+ if (bestSlug != "") print bestSlug
103
+ }
104
+ '
105
+ )"
106
+ printf '%s' "$match"
107
+ }
108
+
109
+ MATCH="$(prompt_slug)"
110
+ [ -n "$MATCH" ] && emit "$MATCH" "prompt"
111
+
112
+ SESSION_CO=""
113
+ if [ -x "$ROOT/core/scripts/hq-session.sh" ]; then
114
+ SESSION_CO="$(bash "$ROOT/core/scripts/hq-session.sh" get company_slug 2>/dev/null || true)"
115
+ SESSION_CO="$(printf '%s' "$SESSION_CO" | tr -d '[:space:]\"')"
116
+ fi
117
+ if [ -n "$SESSION_CO" ] && is_known_slug "$SESSION_CO"; then
118
+ emit "$SESSION_CO" "session"
119
+ fi
120
+
121
+ is_fleet_identity() {
122
+ [ -n "${HQ_AGENT_WORKDIR:-}" ] && return 0
123
+ [ -n "${HQ_AGENT_COMPANY_DIR:-}" ] && return 0
124
+ [ -n "${HQ_AGENT_IDENTITY_FILE:-}" ] && return 0
125
+ [ -f /etc/hq-agent/identity.json ] && return 0
126
+ [ -f /etc/hq-agent/machine-creds.json ] && return 0
127
+ agent_root="${HQ_AGENT_ROOT_PREFIX:-}"
128
+ if [ -n "$agent_root" ]; then
129
+ [ -f "${agent_root%/}/var/lib/hq-agent/identity.json" ] && return 0
130
+ else
131
+ [ -f /var/lib/hq-agent/identity.json ] && return 0
132
+ fi
133
+ [ -f /var/lib/hq-agent/machine-creds.json ] && return 0
134
+ return 1
135
+ }
136
+
137
+ run_with_timeout() {
138
+ command -v node >/dev/null 2>&1 || return 127
139
+ node -e '
140
+ const { spawn } = require("child_process");
141
+ const command = process.argv[1];
142
+ if (!command) process.exit(127);
143
+ const child = spawn(command, process.argv.slice(2), { detached: true, stdio: ["ignore", "pipe", "ignore"] });
144
+ let finished = false;
145
+ const finish = (status) => {
146
+ if (finished) return;
147
+ finished = true;
148
+ clearTimeout(timer);
149
+ try { process.kill(-child.pid, "SIGTERM"); } catch (_) {}
150
+ process.exit(status);
151
+ };
152
+ child.stdout.on("data", (chunk) => process.stdout.write(chunk));
153
+ child.once("error", () => finish(127));
154
+ child.once("exit", (code) => finish(typeof code === "number" ? code : 1));
155
+ const timer = setTimeout(() => finish(124), 2000);
156
+ ' "$@"
157
+ }
158
+
159
+ if ! is_fleet_identity && command -v hq >/dev/null 2>&1 && command -v jq >/dev/null 2>&1; then
160
+ DEFAULT_JSON="$(run_with_timeout hq mesh context default get --json 2>/dev/null || true)"
161
+ DEFAULT_SLUG="$(printf '%s' "$DEFAULT_JSON" | jq -er '(.defaultCompany // .) as $default | if $default.enabled == true and ($default.source // "") != "disabled" and ($default.needsChoice // false) == false and ($default.slug | type == "string") then $default.slug else empty end' 2>/dev/null || true)"
162
+ DEFAULT_SLUG="$(printf '%s' "$DEFAULT_SLUG" | tr -d '[:space:]\"')"
163
+ if [ -n "$DEFAULT_SLUG" ] && is_known_slug "$DEFAULT_SLUG"; then
164
+ # A device default is only a local preference. Reconcile performs the
165
+ # token-backed active-membership check; never promote this fallback when
166
+ # that preflight is unavailable, times out, or returns a noncanonical row.
167
+ PREFLIGHT_SESSION_ID="resolve-default-$$-$RANDOM"
168
+ PREFLIGHT_OPERATION_ID="resolve-default-op-$$-$RANDOM"
169
+ PREFLIGHT_OBSERVATION="$(jq -cn \
170
+ --arg session_id "$PREFLIGHT_SESSION_ID" \
171
+ --arg operation_id "$PREFLIGHT_OPERATION_ID" \
172
+ --arg root "$ROOT" \
173
+ '{contractVersion:1,clientOperationId:$operation_id,identity:{sessionId:$session_id,harness:"hq-core",adapterVersion:"1"},cwd:$root,hqRoot:$root}')"
174
+ PREFLIGHT_STATUS=0
175
+ PREFLIGHT_RESULT="$(run_with_timeout hq mesh context reconcile --observation-json "$PREFLIGHT_OBSERVATION" --machine --offline 2>/dev/null)" || PREFLIGHT_STATUS=$?
176
+ VALIDATED_SLUG=""
177
+ if [ "$PREFLIGHT_STATUS" -eq 0 ]; then
178
+ VALIDATED_SLUG="$(printf '%s' "$PREFLIGHT_RESULT" | jq -er \
179
+ --arg slug "$DEFAULT_SLUG" \
180
+ --arg session_id "$PREFLIGHT_SESSION_ID" \
181
+ --arg operation_id "$PREFLIGHT_OPERATION_ID" '
182
+ if type == "object"
183
+ and .contractVersion == 1
184
+ and (.sessionId | type == "string") and .sessionId == $session_id
185
+ and (.clientOperationId | type == "string") and .clientOperationId == $operation_id
186
+ and (.kind == "queued" or .kind == "needs_project" or .kind == "needs_task" or .kind == "bound")
187
+ and (.classification == "needs_project" or .classification == "needs_task" or .classification == "bound")
188
+ and (.delivery == "queued" or .delivery == "acked")
189
+ and .lifecycle == "open"
190
+ and .companySlug == $slug
191
+ and (.companyUid | type == "string") and (.companyUid | length > 0)
192
+ then .companySlug else empty end
193
+ ' 2>/dev/null || true)"
194
+ fi
195
+ [ "$VALIDATED_SLUG" = "$DEFAULT_SLUG" ] && emit "$DEFAULT_SLUG" "device_default"
196
+ fi
197
+ fi
198
+
199
+ emit "" "none"
@@ -5730,6 +5730,19 @@ export declare const COMMAND_CATALOG: readonly [{
5730
5730
  readonly options: readonly [];
5731
5731
  readonly subcommands: readonly [];
5732
5732
  }];
5733
+ }, {
5734
+ readonly name: "resolve-company";
5735
+ readonly description: "Resolve the active company for skills and routing";
5736
+ readonly aliases: readonly [];
5737
+ readonly hidden: false;
5738
+ readonly usage: "[args...]";
5739
+ readonly arguments: readonly [{
5740
+ readonly name: "args";
5741
+ readonly required: false;
5742
+ readonly variadic: true;
5743
+ }];
5744
+ readonly options: readonly [];
5745
+ readonly subcommands: readonly [];
5733
5746
  }, {
5734
5747
  readonly name: "audit-log";
5735
5748
  readonly description: "Append, query, or summarize the HQ audit log";
@@ -7384,6 +7384,22 @@ export const COMMAND_CATALOG = [
7384
7384
  }
7385
7385
  ]
7386
7386
  },
7387
+ {
7388
+ "name": "resolve-company",
7389
+ "description": "Resolve the active company for skills and routing",
7390
+ "aliases": [],
7391
+ "hidden": false,
7392
+ "usage": "[args...]",
7393
+ "arguments": [
7394
+ {
7395
+ "name": "args",
7396
+ "required": false,
7397
+ "variadic": true
7398
+ }
7399
+ ],
7400
+ "options": [],
7401
+ "subcommands": []
7402
+ },
7387
7403
  {
7388
7404
  "name": "audit-log",
7389
7405
  "description": "Append, query, or summarize the HQ audit log",
@@ -0,0 +1,4 @@
1
+ import type { Command } from "commander";
2
+ /** Commander registration stays in the full graph; the native resolver is fast-path safe. */
3
+ export declare function registerCoreResolveCompanyNativeCommand(core: Command): void;
4
+ //# sourceMappingURL=core-resolve-company-command.d.ts.map
@@ -0,0 +1,42 @@
1
+ import { resolveLiveRoot } from "../utils/hq-roots.js";
2
+ import { runBundledScript } from "../utils/run-bundled-script.js";
3
+ import { describeCoreCommand } from "./core-command-catalog.js";
4
+ import { coreNativeUtilitiesEnabled } from "./core-native-utilities-flag.js";
5
+ import { RESOLVE_COMPANY_ASSET, resolveCompany } from "./core-resolve-company-native.js";
6
+ /** Commander registration stays in the full graph; the native resolver is fast-path safe. */
7
+ export function registerCoreResolveCompanyNativeCommand(core) {
8
+ const command = core.command("resolve-company")
9
+ .description("Resolve the active company for skills and routing")
10
+ .allowUnknownOption()
11
+ .allowExcessArguments()
12
+ .helpOption(false)
13
+ .argument("[args...]")
14
+ .action(async (args = [], _options, cmd) => {
15
+ const operands = cmd.args.length > 0 ? cmd.args : args;
16
+ if (!await coreNativeUtilitiesEnabled()) {
17
+ const root = resolveLiveRoot({ hqRoot: core.opts().hqRoot });
18
+ const { code } = runBundledScript({
19
+ asset: RESOLVE_COMPANY_ASSET,
20
+ args: operands,
21
+ cwd: root,
22
+ hqRoot: root,
23
+ });
24
+ if (code !== 0)
25
+ process.exit(code);
26
+ return;
27
+ }
28
+ const root = resolveLiveRoot({ hqRoot: core.opts().hqRoot });
29
+ const result = await resolveCompany(operands, {
30
+ cwd: process.cwd(),
31
+ hqRoot: root,
32
+ stdinIsTty: process.stdin.isTTY === true,
33
+ });
34
+ process.stdout.write(result.stdout);
35
+ if (result.stderr.length)
36
+ process.stderr.write(result.stderr);
37
+ if (result.code !== 0)
38
+ process.exit(result.code);
39
+ });
40
+ describeCoreCommand(command, { execution: "native", asset: RESOLVE_COMPANY_ASSET, root: "live" });
41
+ }
42
+ //# sourceMappingURL=core-resolve-company-command.js.map
@@ -0,0 +1,28 @@
1
+ import * as fs from "node:fs";
2
+ export declare const RESOLVE_COMPANY_ASSET = "core/scripts/resolve-company.sh";
3
+ export declare const RESOLVE_COMPANY_HELP: string;
4
+ export type ResolveCompanyResult = {
5
+ code: number;
6
+ stdout: Buffer;
7
+ stderr: Buffer;
8
+ };
9
+ type HqResult = {
10
+ code: number;
11
+ stdout: string;
12
+ };
13
+ type ResolveCompanyFs = Pick<typeof fs, "readFileSync" | "statSync" | "accessSync">;
14
+ export type ResolveCompanyDependencies = {
15
+ cwd: string;
16
+ hqRoot?: string;
17
+ env?: NodeJS.ProcessEnv;
18
+ fs?: ResolveCompanyFs;
19
+ stdin?: string;
20
+ stdinIsTty?: boolean;
21
+ spawnHq?: (args: string[], env: NodeJS.ProcessEnv, timeoutMs: number, cwd?: string) => Promise<HqResult>;
22
+ pid?: number;
23
+ random?: () => number;
24
+ };
25
+ export declare function resolveCompany(args: readonly string[], dependencies: ResolveCompanyDependencies): Promise<ResolveCompanyResult>;
26
+ export declare function runResolveCompanyFast(args: readonly string[], stdin: string, cwd: string, hqRoot: string | undefined, _commandName?: string, _hqRootArg?: string, stdinReader?: () => Promise<string>): Promise<number>;
27
+ export {};
28
+ //# sourceMappingURL=core-resolve-company-native.d.ts.map