@indigoai-us/hq-cli 5.345.220 → 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.
- package/CHANGELOG.md +118 -0
- package/dist/command-catalog.generated.d.ts +144 -2
- package/dist/command-catalog.generated.js +175 -2
- package/dist/commands/auth.js +4 -1
- package/dist/commands/bot-runtime.d.ts +18 -5
- package/dist/commands/bot-runtime.js +29 -12
- package/dist/commands/bot.d.ts +39 -2
- package/dist/commands/bot.js +140 -11
- package/dist/commands/core-stop-autosave.d.ts +21 -0
- package/dist/commands/core-stop-autosave.js +300 -0
- package/dist/commands/core.js +2 -0
- package/dist/commands/daemon.d.ts +5 -0
- package/dist/commands/daemon.js +31 -7
- package/dist/commands/doctor-usage.d.ts +5 -0
- package/dist/commands/doctor-usage.js +25 -0
- package/dist/commands/env.d.ts +49 -4
- package/dist/commands/env.js +355 -5
- package/dist/commands/lanes-shared.d.ts +3 -0
- package/dist/commands/lanes.d.ts +3 -0
- package/dist/commands/lanes.js +87 -3
- package/dist/commands/sources.js +3 -3
- package/dist/commands/sync-core.d.ts +1 -0
- package/dist/commands/sync-core.js +77 -3
- package/dist/commands/whoami.js +96 -80
- package/dist/lib/bot/config.d.ts +17 -0
- package/dist/lib/bot/config.js +13 -0
- package/dist/lib/bot/fleet-cron.js +24 -2
- package/dist/lib/bot/fleet-local.d.ts +30 -2
- package/dist/lib/bot/fleet-local.js +60 -1
- package/dist/lib/bot/grok-login-scope.d.ts +36 -0
- package/dist/lib/bot/grok-login-scope.js +93 -0
- package/dist/lib/bot/legacy-provider-login.d.ts +32 -9
- package/dist/lib/bot/legacy-provider-login.js +28 -22
- package/dist/lib/bot/runtime-sign-in-check.js +6 -1
- package/dist/lib/bot/runtime-sign-in.d.ts +2 -0
- package/dist/lib/core-utils/sentry-report.js +2 -0
- package/dist/lib/daemon/machine-checks.d.ts +22 -1
- package/dist/lib/daemon/machine-checks.js +54 -12
- package/dist/lib/daemon/run.js +66 -8
- package/dist/lib/daemon/stop-autosave-lock.d.ts +19 -0
- package/dist/lib/daemon/stop-autosave-lock.js +166 -0
- package/dist/lib/daemon/stop-autosave.d.ts +28 -0
- package/dist/lib/daemon/stop-autosave.js +111 -0
- package/dist/lib/daemon/stop-diagnostics.d.ts +11 -0
- package/dist/lib/daemon/stop-diagnostics.js +136 -0
- package/dist/lib/daemon/stop-job-executor.d.ts +19 -0
- package/dist/lib/daemon/stop-job-executor.js +126 -0
- package/dist/lib/daemon/stop-jobs.d.ts +93 -0
- package/dist/lib/daemon/stop-jobs.js +599 -0
- package/dist/lib/doctor/checks/fleet-hook-core.js +1 -1
- package/dist/lib/doctor/checks/host-core.js +1 -1
- package/dist/lib/environment/access-probes.d.ts +234 -0
- package/dist/lib/environment/access-probes.js +918 -0
- package/dist/lib/environment/profile.d.ts +15 -2
- package/dist/lib/environment/profile.js +55 -20
- package/dist/lib/environment/rfc3339.d.ts +8 -0
- package/dist/lib/environment/rfc3339.js +26 -0
- package/dist/lib/environment/work-requirements.d.ts +169 -0
- package/dist/lib/environment/work-requirements.js +389 -0
- package/dist/lib/hook-engine/coverage.d.ts +137 -7
- package/dist/lib/hook-engine/coverage.js +1424 -4
- package/dist/lib/hook-engine/fleet-registration.js +2 -2
- package/dist/lib/hook-engine/git-stop-config.json +513 -0
- package/dist/lib/hook-engine/native-stop-compatibility.json +311 -0
- package/dist/lib/hook-engine/reconcile.js +2 -2
- package/dist/lib/hot-channels/alert.d.ts +2 -2
- package/dist/lib/hot-channels/alert.js +8 -5
- package/dist/lib/hot-channels/signals-pass.d.ts +126 -17
- package/dist/lib/hot-channels/signals-pass.js +296 -17
- package/dist/lib/hot-channels/signals-runtime.d.ts +30 -0
- package/dist/lib/hot-channels/signals-runtime.js +82 -0
- package/dist/lib/install/hook-target.js +1 -1
- package/dist/lib/lanes/host-capacity.d.ts +26 -2
- package/dist/lib/lanes/host-capacity.js +17 -2
- package/dist/lib/lanes/host-compute.d.ts +90 -0
- package/dist/lib/lanes/host-compute.js +185 -0
- package/dist/lib/lanes/index.d.ts +2 -0
- package/dist/lib/lanes/index.js +1 -0
- package/dist/lib/lanes/reconcile.js +22 -1
- package/dist/lib/lanes/resource-usage.d.ts +155 -0
- package/dist/lib/lanes/resource-usage.js +589 -0
- package/dist/lib/lanes/run-size.d.ts +46 -0
- package/dist/lib/lanes/run-size.js +197 -0
- package/dist/lib/lanes/store.js +27 -0
- package/dist/lib/lanes/throttle.d.ts +36 -1
- package/dist/lib/lanes/throttle.js +47 -10
- package/dist/lib/lanes/types.d.ts +40 -0
- package/dist/lib/lanes/types.js +2 -2
- package/dist/lib/lanes/watcher.js +13 -4
- package/dist/lib/lanes/worker-process.d.ts +25 -2
- package/dist/lib/lanes/worker-process.js +71 -19
- package/dist/lib/placement/match.d.ts +192 -0
- package/dist/lib/placement/match.js +667 -0
- package/dist/lib/safe-store.d.ts +14 -0
- package/dist/lib/safe-store.js +77 -4
- package/dist/lib/search-index/index.d.ts +88 -4
- package/dist/lib/search-index/index.js +288 -24
- package/dist/lib/search-index/max-doc-bytes.d.ts +17 -6
- package/dist/lib/search-index/max-doc-bytes.js +48 -23
- package/dist/lib/signals/codex-lockdown.d.ts +79 -0
- package/dist/lib/signals/codex-lockdown.js +271 -0
- package/dist/lib/signals/codex-login.d.ts +37 -0
- package/dist/lib/signals/codex-login.js +83 -0
- package/dist/lib/signals/engine.d.ts +27 -0
- package/dist/lib/signals/engine.js +70 -0
- package/dist/lib/signals/reply.js +22 -1
- package/dist/lib/signals/run-record.js +6 -1
- package/dist/lib/signals/settings.d.ts +5 -0
- package/dist/lib/signals/settings.js +2 -0
- package/dist/lib/signals/steps/extract.d.ts +85 -9
- package/dist/lib/signals/steps/extract.js +317 -68
- package/dist/lib/signals/steps/types.d.ts +2 -0
- package/dist/lib/sync-core/engine-home.d.ts +35 -1
- package/dist/lib/sync-core/engine-home.js +119 -16
- package/dist/lib/sync-core/rollout-state.d.ts +2 -1
- package/dist/lib/sync-core/rollout-state.js +5 -2
- package/dist/lib/sync-core/vault-uid.d.ts +2 -0
- package/dist/lib/sync-core/vault-uid.js +4 -0
- package/dist/schemas/hq-work-requirements.v1.schema.json +145 -0
- package/dist/utils/auth-session-check.d.ts +16 -0
- package/dist/utils/auth-session-check.js +16 -0
- package/dist/utils/client-health-contract.d.ts +6 -0
- package/dist/utils/client-health-contract.js +13 -0
- package/dist/utils/client-health.d.ts +7 -0
- package/dist/utils/client-health.js +22 -1
- package/dist/utils/command-usage.d.ts +40 -0
- package/dist/utils/command-usage.js +61 -0
- package/dist/utils/duplicate-command-usage.d.ts +72 -0
- package/dist/utils/duplicate-command-usage.js +125 -0
- package/dist/utils/host-registration.js +2 -1
- package/dist/utils/resident-package-preload.js +4 -0
- package/dist/utils/sentry-fingerprint.js +9 -0
- package/dist/utils/windows-bash.d.ts +2 -0
- package/dist/utils/windows-bash.js +2 -1
- package/package.json +9 -8
- package/scripts/bench-core-compare.mjs +313 -0
- package/scripts/bench-core.mjs +399 -12
- package/scripts/check-function-manifest.mjs +116 -3
|
@@ -29,6 +29,18 @@
|
|
|
29
29
|
// --no-manifest run without a manifest (hq-cli pull request job: the
|
|
30
30
|
// manifest lives in another repository). Only the
|
|
31
31
|
// command-states file is checked against the hq-cli tree
|
|
32
|
+
// --installed-core <dir> an installed HQ core (the folder an install or
|
|
33
|
+
// update writes). Reports every test or tooling file in
|
|
34
|
+
// it; see "Installed core" below. Runs alone (no
|
|
35
|
+
// manifest needed) or beside the other rules
|
|
36
|
+
// --keep <path> with --installed-core: a path (relative to that
|
|
37
|
+
// folder) that is kept although it matches; end it with
|
|
38
|
+
// / to keep a whole folder. Repeatable
|
|
39
|
+
// --keep-file <file> with --installed-core: --keep entries, one per line
|
|
40
|
+
// (blank lines and lines starting with # are skipped)
|
|
41
|
+
// --tooling <glob> with --installed-core: a CI or release script glob
|
|
42
|
+
// the release leaves out (* within a folder, ** across
|
|
43
|
+
// folders, ?). Repeatable; none are built in
|
|
32
44
|
// --json print the result as JSON
|
|
33
45
|
//
|
|
34
46
|
// Exit 0: no problem. Exit 1: at least one problem. Exit 2: usage error.
|
|
@@ -68,6 +80,18 @@
|
|
|
68
80
|
// src/lib/daemon. Other daemon functions: the owner path as text, or an
|
|
69
81
|
// import of the owner (a relative import is resolved from the importing
|
|
70
82
|
// file), in any file including other daemon files.
|
|
83
|
+
//
|
|
84
|
+
// Installed core (--installed-core)
|
|
85
|
+
// Walks every file and symlink under the folder; symlinks are not followed,
|
|
86
|
+
// and a symlink whose own path matches is reported. A path (relative, forward
|
|
87
|
+
// slashes) is reported as installed-test-file when any of these match:
|
|
88
|
+
// core/scripts/tests/...; any path part named tests, __tests__, __fixtures__
|
|
89
|
+
// or __snapshots__; test/... at the root; core/scripts/hook-corpus/...;
|
|
90
|
+
// a file name *.test.<ext> or *.spec.<ext> with ext sh, bash, js, mjs, cjs,
|
|
91
|
+
// ts, mts, cts or py; a file name test_*.py.
|
|
92
|
+
// and as installed-tooling-file when it matches a --tooling glob. Names that
|
|
93
|
+
// only contain -test. or test- (keyboard-test.md) and core/hook-tests/ (an
|
|
94
|
+
// install reads it) are not test files here. --keep paths are not reported.
|
|
71
95
|
|
|
72
96
|
import { execFileSync } from "node:child_process";
|
|
73
97
|
import { existsSync, lstatSync, readFileSync, readdirSync, realpathSync, statSync } from "node:fs";
|
|
@@ -564,9 +588,85 @@ export function checkCliStates(entries, states, file) {
|
|
|
564
588
|
return { problems, notices };
|
|
565
589
|
}
|
|
566
590
|
|
|
591
|
+
// ---------- installed core: no test or tooling files ----------
|
|
592
|
+
const INSTALLED_TEST_PREFIX = ["core/scripts/tests/", "test/", "core/scripts/hook-corpus/"];
|
|
593
|
+
const INSTALLED_TEST_PART = new Set(["tests", "__tests__", "__fixtures__", "__snapshots__"]);
|
|
594
|
+
const INSTALLED_TEST_NAME_RE = /\.(test|spec)\.(sh|bash|js|mjs|cjs|ts|mts|cts|py)$|^test_[^/]*\.py$/;
|
|
595
|
+
|
|
596
|
+
/** The reason a path is a test file in an installed core, or null. */
|
|
597
|
+
export function installedTestReason(rel) {
|
|
598
|
+
const prefix = INSTALLED_TEST_PREFIX.find((p) => rel.startsWith(p));
|
|
599
|
+
if (prefix) return `under ${prefix}`;
|
|
600
|
+
const parts = rel.split("/");
|
|
601
|
+
const part = parts.find((x) => INSTALLED_TEST_PART.has(x));
|
|
602
|
+
if (part) return `a "${part}" folder`;
|
|
603
|
+
if (INSTALLED_TEST_NAME_RE.test(parts[parts.length - 1])) return "a test file name";
|
|
604
|
+
return null;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/** A glob (* within a folder, ** across folders, ?) as an anchored regex. */
|
|
608
|
+
export function globToRegExp(glob) {
|
|
609
|
+
let re = "";
|
|
610
|
+
for (let i = 0; i < glob.length; i++) {
|
|
611
|
+
const c = glob[i];
|
|
612
|
+
if (c === "*" && glob[i + 1] === "*") {
|
|
613
|
+
i++;
|
|
614
|
+
if (glob[i + 1] === "/") { i++; re += "(?:.*/)?"; } else re += ".*";
|
|
615
|
+
} else if (c === "*") re += "[^/]*";
|
|
616
|
+
else if (c === "?") re += "[^/]";
|
|
617
|
+
else re += esc(c);
|
|
618
|
+
}
|
|
619
|
+
return new RegExp(`^${re}$`);
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
const normalRel = (p) => p.replace(/\\/g, "/").replace(/^(\.\/)+/, "");
|
|
623
|
+
|
|
624
|
+
/** Every test or tooling file in an installed core, minus the kept paths. */
|
|
625
|
+
export function checkInstalledCore(root, { keep = [], tooling = [] } = {}) {
|
|
626
|
+
const problems = [];
|
|
627
|
+
const keepExact = new Set();
|
|
628
|
+
const keepDirs = [];
|
|
629
|
+
for (const k of keep.map(normalRel).filter(Boolean)) {
|
|
630
|
+
if (k.endsWith("/")) keepDirs.push(k);
|
|
631
|
+
else keepExact.add(k);
|
|
632
|
+
}
|
|
633
|
+
const kept = (rel, isDir) => (!isDir && keepExact.has(rel)) || keepDirs.some((d) => (isDir ? `${rel}/` : rel).startsWith(d));
|
|
634
|
+
const toolingRes = tooling.map((g) => ({ glob: g, re: globToRegExp(normalRel(g)) }));
|
|
635
|
+
let walked = 0;
|
|
636
|
+
const walk = (rel) => {
|
|
637
|
+
const entries = readdirSync(rel ? path.join(root, rel) : root, { withFileTypes: true });
|
|
638
|
+
entries.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
|
|
639
|
+
for (const entry of entries) {
|
|
640
|
+
const child = rel ? `${rel}/${entry.name}` : entry.name;
|
|
641
|
+
// Dirent types come from lstat: a symlink is never a directory here.
|
|
642
|
+
if (entry.isDirectory()) {
|
|
643
|
+
if (!kept(child, true)) walk(child);
|
|
644
|
+
continue;
|
|
645
|
+
}
|
|
646
|
+
walked++;
|
|
647
|
+
if (kept(child, false)) continue;
|
|
648
|
+
const link = entry.isSymbolicLink() ? " (a symlink)" : "";
|
|
649
|
+
const reason = installedTestReason(child);
|
|
650
|
+
if (reason) {
|
|
651
|
+
problems.push({ rule: "installed-test-file", file: child, message: `${child}${link} is a test file in the installed core (${reason}). The release must leave it out; pass --keep ${child} if an install needs it.` });
|
|
652
|
+
continue;
|
|
653
|
+
}
|
|
654
|
+
const tool = toolingRes.find((t) => t.re.test(child));
|
|
655
|
+
if (tool) problems.push({ rule: "installed-tooling-file", file: child, message: `${child}${link} is a tooling file in the installed core (matches --tooling ${tool.glob}). The release must leave it out; pass --keep ${child} if an install needs it.` });
|
|
656
|
+
}
|
|
657
|
+
};
|
|
658
|
+
walk("");
|
|
659
|
+
return { problems, files: walked };
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
function readKeepFile(file) {
|
|
663
|
+
if (!existsSync(file)) usage(`--keep-file ${file} does not exist`);
|
|
664
|
+
return readFileSync(file, "utf8").split("\n").map((l) => l.replace(/\r$/, "").trim()).filter((l) => l && !l.startsWith("#"));
|
|
665
|
+
}
|
|
666
|
+
|
|
567
667
|
// ---------- main ----------
|
|
568
668
|
function parseArgs(argv) {
|
|
569
|
-
const opt = { json: false, noManifest: false };
|
|
669
|
+
const opt = { json: false, noManifest: false, keep: [], tooling: [] };
|
|
570
670
|
const value = (i) => {
|
|
571
671
|
if (argv[i + 1] === undefined) usage(`${argv[i]} needs a value`);
|
|
572
672
|
return argv[i + 1];
|
|
@@ -580,6 +680,10 @@ function parseArgs(argv) {
|
|
|
580
680
|
else if (a === "--cli-states") opt.cliStates = path.resolve(value(i++));
|
|
581
681
|
else if (a === "--require-cli-states") opt.requireCliStates = true;
|
|
582
682
|
else if (a === "--no-manifest") opt.noManifest = true;
|
|
683
|
+
else if (a === "--installed-core") opt.installedCore = path.resolve(value(i++));
|
|
684
|
+
else if (a === "--keep") opt.keep.push(value(i++));
|
|
685
|
+
else if (a === "--keep-file") opt.keep.push(...readKeepFile(path.resolve(value(i++))));
|
|
686
|
+
else if (a === "--tooling") opt.tooling.push(value(i++));
|
|
583
687
|
else if (a === "--json") opt.json = true;
|
|
584
688
|
else if (a === "--help" || a === "-h") usage();
|
|
585
689
|
else usage(`unknown argument: ${a}`);
|
|
@@ -588,7 +692,7 @@ function parseArgs(argv) {
|
|
|
588
692
|
}
|
|
589
693
|
function usage(error) {
|
|
590
694
|
if (error) console.error(`check-function-manifest: ${error}`);
|
|
591
|
-
console.error("usage: node scripts/check-function-manifest.mjs [--manifest <file>] [--core-root <dir>] [--cli-root <dir> | --cli-package <dir>] [--cli-states <file> [--require-cli-states]] [--no-manifest] [--json]");
|
|
695
|
+
console.error("usage: node scripts/check-function-manifest.mjs [--manifest <file>] [--core-root <dir>] [--cli-root <dir> | --cli-package <dir>] [--cli-states <file> [--require-cli-states]] [--no-manifest] [--installed-core <dir> [--keep <path>]... [--keep-file <file>] [--tooling <glob>]...] [--json]");
|
|
592
696
|
process.exit(2);
|
|
593
697
|
}
|
|
594
698
|
|
|
@@ -606,7 +710,11 @@ export async function run(argv) {
|
|
|
606
710
|
}
|
|
607
711
|
if (!opt.manifest && opt.coreRoot) opt.manifest = path.join(opt.coreRoot, MANIFEST_REL);
|
|
608
712
|
if (opt.noManifest && (opt.manifest || opt.coreRoot)) usage("--no-manifest cannot be combined with --manifest or --core-root");
|
|
609
|
-
if (
|
|
713
|
+
if (opt.installedCore && !(existsSync(opt.installedCore) && statSync(opt.installedCore).isDirectory())) usage(`--installed-core ${opt.installedCore} is not a folder`);
|
|
714
|
+
if (!opt.installedCore && (opt.keep.length || opt.tooling.length)) usage("--keep, --keep-file and --tooling need --installed-core");
|
|
715
|
+
// --installed-core alone needs no manifest.
|
|
716
|
+
const installedOnly = opt.installedCore && !opt.manifest && !opt.coreRoot && !opt.noManifest && !opt.cliStates;
|
|
717
|
+
if (!opt.noManifest && !opt.manifest && !installedOnly) usage("no manifest: pass --core-root or --manifest (or --no-manifest in the hq-cli pull request job)");
|
|
610
718
|
if (opt.manifest && !existsSync(opt.manifest)) usage(`manifest ${opt.manifest} does not exist`);
|
|
611
719
|
|
|
612
720
|
const problems = [];
|
|
@@ -672,6 +780,11 @@ export async function run(argv) {
|
|
|
672
780
|
}
|
|
673
781
|
}
|
|
674
782
|
}
|
|
783
|
+
if (opt.installedCore) {
|
|
784
|
+
const inst = checkInstalledCore(opt.installedCore, { keep: opt.keep, tooling: opt.tooling });
|
|
785
|
+
problems.push(...inst.problems);
|
|
786
|
+
checked.push(`installed core ${opt.installedCore}: ${inst.files} files and links checked for test and tooling files (${opt.keep.length} kept paths, ${opt.tooling.length} tooling globs)`);
|
|
787
|
+
}
|
|
675
788
|
if (opt.noManifest) notices.push("--no-manifest: the manifest rules did not run here; they run where the manifest is (hq-core-staging pull requests and a local run with --core-root)");
|
|
676
789
|
|
|
677
790
|
const seconds = ((Date.now() - started) / 1000).toFixed(1);
|