@indigoai-us/hq-cli 5.345.208 → 5.345.210
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 +98 -0
- package/assets/scaffold/core/scripts/derive-trigger-facts.sh +22 -3
- package/dist/command-catalog.generated.d.ts +33 -8
- package/dist/command-catalog.generated.js +40 -8
- package/dist/command-registration-plan.d.ts +2 -2
- package/dist/command-registration-plan.js +1 -1
- package/dist/commands/access.js +11 -5
- package/dist/commands/agents.d.ts +8 -0
- package/dist/commands/agents.js +5 -0
- package/dist/commands/bot.d.ts +8 -0
- package/dist/commands/bot.js +67 -7
- package/dist/commands/channels.js +4 -0
- package/dist/commands/cloud.d.ts +83 -2
- package/dist/commands/cloud.js +161 -31
- package/dist/commands/company.d.ts +9 -0
- package/dist/commands/company.js +44 -14
- package/dist/commands/core-checkpoint-native.js +21 -0
- package/dist/commands/core-derive-trigger-facts-native.js +14 -3
- package/dist/commands/core-generate-workers-registry-fast.d.ts +1 -1
- package/dist/commands/core-generate-workers-registry-fast.js +7 -1
- package/dist/commands/core-job-run-native.d.ts +8 -0
- package/dist/commands/core-job-run-native.js +11 -3
- package/dist/commands/core-jobs-native.js +1 -1
- package/dist/commands/core-register-project-native.js +31 -1
- package/dist/commands/core-scan-packages-fast.d.ts +1 -1
- package/dist/commands/core-scan-packages-fast.js +8 -1
- package/dist/commands/core.js +12 -3
- package/dist/commands/dm-attach.d.ts +10 -0
- package/dist/commands/dm-attach.js +33 -5
- package/dist/commands/integrations-connect.js +47 -2
- package/dist/commands/lanes-session-start.d.ts +17 -0
- package/dist/commands/lanes-session-start.js +281 -13
- package/dist/commands/lanes-watch.js +11 -3
- package/dist/commands/lanes.d.ts +4 -0
- package/dist/commands/lanes.js +95 -22
- package/dist/commands/library.d.ts +10 -0
- package/dist/commands/library.js +30 -3
- package/dist/commands/meetings.d.ts +42 -0
- package/dist/commands/meetings.js +157 -12
- package/dist/commands/mesh.js +3 -0
- package/dist/commands/monitor.d.ts +6 -0
- package/dist/commands/monitor.js +29 -19
- package/dist/commands/onboard.js +8 -1
- package/dist/commands/sources.js +7 -3
- package/dist/index.js +9 -0
- package/dist/lanes-monitor-check-argv.d.ts +1 -1
- package/dist/lanes-monitor-check-argv.js +2 -2
- package/dist/lanes-session-start-argv.d.ts +4 -1
- package/dist/lanes-session-start-argv.js +5 -2
- package/dist/lib/bot/fleet-daemon.d.ts +101 -0
- package/dist/lib/bot/fleet-daemon.js +227 -0
- package/dist/lib/bot/fleet-local.d.ts +26 -0
- package/dist/lib/bot/fleet-local.js +51 -2
- package/dist/lib/bot/index.d.ts +1 -0
- package/dist/lib/bot/index.js +1 -0
- package/dist/lib/bot/jobs/hot-signal-sync.d.ts +4 -0
- package/dist/lib/bot/jobs/hot-signal-sync.js +8 -1
- package/dist/lib/bot/log.js +3 -1
- package/dist/lib/bot/probe.js +2 -0
- package/dist/lib/bot/run.js +28 -3
- package/dist/lib/bot/runtime-failure.d.ts +4 -2
- package/dist/lib/bot/runtime-failure.js +9 -1
- package/dist/lib/bot/status.d.ts +17 -0
- package/dist/lib/bot/status.js +53 -2
- package/dist/lib/capacity/collectors/claude-oauth.d.ts +5 -5
- package/dist/lib/capacity/collectors/claude-oauth.js +6 -6
- package/dist/lib/core-utils/native-scaffold-help.d.ts +16 -0
- package/dist/lib/core-utils/native-scaffold-help.js +26 -0
- package/dist/lib/core-utils/session-company.d.ts +25 -8
- package/dist/lib/core-utils/session-company.js +59 -17
- package/dist/lib/daemon/catalog.d.ts +25 -1
- package/dist/lib/daemon/catalog.js +29 -2
- package/dist/lib/daemon/run.d.ts +0 -1
- package/dist/lib/daemon/run.js +3 -11
- package/dist/lib/daemon/server.js +26 -7
- package/dist/lib/daemon/supervisor.js +1 -1
- package/dist/lib/daemon/tools.js +17 -1
- package/dist/lib/db/sqlite-binding.js +2 -1
- package/dist/lib/doctor/checks/bots.d.ts +2 -0
- package/dist/lib/doctor/checks/bots.js +11 -0
- package/dist/lib/doctor/checks/runtime-health.js +3 -2
- package/dist/lib/doctor/checks/work-context.js +5 -2
- package/dist/lib/hook-engine/resolve.d.ts +1 -1
- package/dist/lib/hook-engine/resolve.js +4 -1
- package/dist/lib/hot-channels/adapters/meeting-providers.d.ts +2 -0
- package/dist/lib/hot-channels/adapters/meeting-providers.js +13 -2
- package/dist/lib/lanes/index.d.ts +1 -1
- package/dist/lib/lanes/index.js +1 -1
- package/dist/lib/lanes/monitor.d.ts +14 -0
- package/dist/lib/lanes/monitor.js +51 -10
- package/dist/lib/lanes/outpost-dispatch.d.ts +3 -0
- package/dist/lib/lanes/outpost-dispatch.js +1 -0
- package/dist/lib/lanes/store.d.ts +1 -1
- package/dist/lib/lanes/store.js +2 -1
- package/dist/lib/mesh/client.js +7 -1
- package/dist/lib/mesh/live/backfill-held.d.ts +3 -0
- package/dist/lib/mesh/live/backfill-held.js +167 -7
- package/dist/lib/mesh/live/flush.d.ts +7 -0
- package/dist/lib/mesh/live/flush.js +10 -1
- package/dist/lib/monitor.d.ts +9 -0
- package/dist/lib/monitor.js +33 -7
- package/dist/lib/onboarding/orchestrator.js +269 -132
- package/dist/lib/onboarding/types.d.ts +2 -0
- package/dist/lib/scaffold-cli-floor.js +2 -1
- package/dist/lib/signals/failure-alert.js +3 -1
- package/dist/lib/work-context/organize.d.ts +6 -0
- package/dist/lib/work-context/organize.js +28 -0
- package/dist/lib/work-context/paths.d.ts +9 -0
- package/dist/lib/work-context/paths.js +15 -0
- package/dist/lib/work-context/prd-sync.js +2 -1
- package/dist/runners-alias.d.ts +54 -0
- package/dist/runners-alias.js +86 -0
- package/dist/utils/install-tree-torn.js +5 -3
- package/dist/utils/npm-install-flags.d.ts +27 -0
- package/dist/utils/npm-install-flags.js +68 -0
- package/dist/utils/package-use-lease.js +1 -1
- package/dist/utils/qmd-native-binding-error.js +2 -1
- package/dist/utils/self-update.js +2 -1
- package/dist/utils/staged-install.js +2 -1
- package/dist/utils/staged-npm-install.js +2 -1
- package/dist/utils/upload-author.d.ts +2 -1
- package/dist/utils/upload-author.js +9 -5
- package/dist/utils/version-check.js +2 -1
- package/dist/utils/version-gate.js +7 -6
- package/package.json +7 -7
- package/scripts/install-hook-engine.mjs +7 -3
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `hq runners` is the primary name of the detached-execution command group;
|
|
3
|
+
* `hq lanes` is a deprecated compatibility alias (US-013). HQ core still calls
|
|
4
|
+
* `hq lanes`, so the alias has no scheduled removal; it goes in a later
|
|
5
|
+
* release, once HQ core no longer uses it.
|
|
6
|
+
*
|
|
7
|
+
* Dependency-free: imported statically by src/index.ts for the fast routes,
|
|
8
|
+
* so it must not import anything.
|
|
9
|
+
*/
|
|
10
|
+
/** The primary command-group name. */
|
|
11
|
+
export declare const RUNNERS_COMMAND = "runners";
|
|
12
|
+
/** The deprecated alias, kept until HQ core stops calling it. */
|
|
13
|
+
export declare const LANES_ALIAS = "lanes";
|
|
14
|
+
export declare const LANES_ALIAS_DEPRECATION_LINE = "hq lanes is deprecated; use hq runners instead. The hq lanes name will be removed in a later release, after HQ core stops using it.";
|
|
15
|
+
/** True for either name of the command group. */
|
|
16
|
+
export declare function isRunnersGroupToken(token: string | undefined): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Subcommands that hooks, monitors and scripts run. HQ core's hooks treat any
|
|
19
|
+
* stderr from them as a failure, so the alias never prints the line for them.
|
|
20
|
+
*/
|
|
21
|
+
export declare const MACHINE_SUBCOMMANDS: ReadonlySet<string>;
|
|
22
|
+
/** Whether stdout and stderr are terminals. */
|
|
23
|
+
export interface TerminalStreams {
|
|
24
|
+
stdoutIsTTY: boolean;
|
|
25
|
+
stderrIsTTY: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Write the deprecation line to stderr once per process. The fast routes and
|
|
29
|
+
* the Commander path can both see one invocation (monitor-check falls back to
|
|
30
|
+
* the full command graph), so the guard keeps it to one line. Callers decide
|
|
31
|
+
* whether a person is reading; see shouldWriteLanesAliasDeprecation.
|
|
32
|
+
*/
|
|
33
|
+
export declare function writeLanesAliasDeprecation(write?: (text: string) => void): void;
|
|
34
|
+
/**
|
|
35
|
+
* True when Commander argv (`node hq ...`) names the group through the alias:
|
|
36
|
+
* `hq lanes ...`, `hq --verbose lanes ...`, or `hq help lanes ...`. Mirrors the
|
|
37
|
+
* root-token rules of findLazyCommand so both agree on which root was asked for.
|
|
38
|
+
*/
|
|
39
|
+
export declare function argvUsesLanesAlias(argv: readonly string[]): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* True when the line should print for this alias invocation. `groupArgs`
|
|
42
|
+
* starts at the group token (`["lanes", "list", ...]`). The line is for a
|
|
43
|
+
* person at a terminal only: never for a machine subcommand, never with
|
|
44
|
+
* `--json`, and never when stdout or stderr is not a terminal.
|
|
45
|
+
*/
|
|
46
|
+
export declare function shouldWriteLanesAliasDeprecation(groupArgs: readonly string[], streams?: TerminalStreams): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Write the deprecation line when Commander argv invokes the group through
|
|
49
|
+
* the alias and a person is reading (see shouldWriteLanesAliasDeprecation).
|
|
50
|
+
*/
|
|
51
|
+
export declare function writeLanesAliasDeprecationForArgv(argv: readonly string[], streams?: TerminalStreams): void;
|
|
52
|
+
/** Test seam: clear the once-per-process guard. */
|
|
53
|
+
export declare function resetLanesAliasDeprecationForTests(): void;
|
|
54
|
+
//# sourceMappingURL=runners-alias.d.ts.map
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `hq runners` is the primary name of the detached-execution command group;
|
|
3
|
+
* `hq lanes` is a deprecated compatibility alias (US-013). HQ core still calls
|
|
4
|
+
* `hq lanes`, so the alias has no scheduled removal; it goes in a later
|
|
5
|
+
* release, once HQ core no longer uses it.
|
|
6
|
+
*
|
|
7
|
+
* Dependency-free: imported statically by src/index.ts for the fast routes,
|
|
8
|
+
* so it must not import anything.
|
|
9
|
+
*/
|
|
10
|
+
/** The primary command-group name. */
|
|
11
|
+
export const RUNNERS_COMMAND = "runners";
|
|
12
|
+
/** The deprecated alias, kept until HQ core stops calling it. */
|
|
13
|
+
export const LANES_ALIAS = "lanes";
|
|
14
|
+
export const LANES_ALIAS_DEPRECATION_LINE = "hq lanes is deprecated; use hq runners instead. The hq lanes name will be removed in a later release, after HQ core stops using it.";
|
|
15
|
+
/** True for either name of the command group. */
|
|
16
|
+
export function isRunnersGroupToken(token) {
|
|
17
|
+
return token === RUNNERS_COMMAND || token === LANES_ALIAS;
|
|
18
|
+
}
|
|
19
|
+
let deprecationWritten = false;
|
|
20
|
+
/**
|
|
21
|
+
* Subcommands that hooks, monitors and scripts run. HQ core's hooks treat any
|
|
22
|
+
* stderr from them as a failure, so the alias never prints the line for them.
|
|
23
|
+
*/
|
|
24
|
+
export const MACHINE_SUBCOMMANDS = new Set(["monitor-check", "session-start", "link", "watch", "wait"]);
|
|
25
|
+
function processTerminalStreams() {
|
|
26
|
+
return { stdoutIsTTY: process.stdout.isTTY === true, stderrIsTTY: process.stderr.isTTY === true };
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Write the deprecation line to stderr once per process. The fast routes and
|
|
30
|
+
* the Commander path can both see one invocation (monitor-check falls back to
|
|
31
|
+
* the full command graph), so the guard keeps it to one line. Callers decide
|
|
32
|
+
* whether a person is reading; see shouldWriteLanesAliasDeprecation.
|
|
33
|
+
*/
|
|
34
|
+
export function writeLanesAliasDeprecation(write = (text) => {
|
|
35
|
+
process.stderr.write(text);
|
|
36
|
+
}) {
|
|
37
|
+
if (deprecationWritten)
|
|
38
|
+
return;
|
|
39
|
+
deprecationWritten = true;
|
|
40
|
+
write(`${LANES_ALIAS_DEPRECATION_LINE}\n`);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* True when Commander argv (`node hq ...`) names the group through the alias:
|
|
44
|
+
* `hq lanes ...`, `hq --verbose lanes ...`, or `hq help lanes ...`. Mirrors the
|
|
45
|
+
* root-token rules of findLazyCommand so both agree on which root was asked for.
|
|
46
|
+
*/
|
|
47
|
+
export function argvUsesLanesAlias(argv) {
|
|
48
|
+
let commandIndex = 2;
|
|
49
|
+
while (argv[commandIndex] === "--verbose")
|
|
50
|
+
commandIndex += 1;
|
|
51
|
+
const first = argv[commandIndex];
|
|
52
|
+
const token = first === "help" ? argv[commandIndex + 1] : first;
|
|
53
|
+
return token === LANES_ALIAS;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* True when the line should print for this alias invocation. `groupArgs`
|
|
57
|
+
* starts at the group token (`["lanes", "list", ...]`). The line is for a
|
|
58
|
+
* person at a terminal only: never for a machine subcommand, never with
|
|
59
|
+
* `--json`, and never when stdout or stderr is not a terminal.
|
|
60
|
+
*/
|
|
61
|
+
export function shouldWriteLanesAliasDeprecation(groupArgs, streams = processTerminalStreams()) {
|
|
62
|
+
if (groupArgs[0] !== LANES_ALIAS)
|
|
63
|
+
return false;
|
|
64
|
+
if (!streams.stdoutIsTTY || !streams.stderrIsTTY)
|
|
65
|
+
return false;
|
|
66
|
+
const subcommand = groupArgs[1];
|
|
67
|
+
if (subcommand !== undefined && MACHINE_SUBCOMMANDS.has(subcommand))
|
|
68
|
+
return false;
|
|
69
|
+
return !groupArgs.some((arg) => arg === "--json" || arg.startsWith("--json="));
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Write the deprecation line when Commander argv invokes the group through
|
|
73
|
+
* the alias and a person is reading (see shouldWriteLanesAliasDeprecation).
|
|
74
|
+
*/
|
|
75
|
+
export function writeLanesAliasDeprecationForArgv(argv, streams = processTerminalStreams()) {
|
|
76
|
+
if (!argvUsesLanesAlias(argv))
|
|
77
|
+
return;
|
|
78
|
+
const groupIndex = argv.indexOf(LANES_ALIAS, 2);
|
|
79
|
+
if (shouldWriteLanesAliasDeprecation(argv.slice(groupIndex), streams))
|
|
80
|
+
writeLanesAliasDeprecation();
|
|
81
|
+
}
|
|
82
|
+
/** Test seam: clear the once-per-process guard. */
|
|
83
|
+
export function resetLanesAliasDeprecationForTests() {
|
|
84
|
+
deprecationWritten = false;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=runners-alias.js.map
|
|
@@ -36,6 +36,7 @@ import { fileURLToPath } from "node:url";
|
|
|
36
36
|
import { CLI_NAME } from "../cli-version.js";
|
|
37
37
|
import { boundedDiagnosticValue } from "./package-root-diagnostics.js";
|
|
38
38
|
import { isLockStale, UPDATE_LOCK_STALE_MS } from "./update-lock.js";
|
|
39
|
+
import { HQ_CLI_NPM_UPDATE_COMMAND } from "./npm-install-flags.js";
|
|
39
40
|
/** Byte caps for the (hq-derived, path-shaped) diagnostic strings. */
|
|
40
41
|
const SPECIFIER_BYTES = 256;
|
|
41
42
|
const IMPORTER_BYTES = 256;
|
|
@@ -1298,16 +1299,17 @@ export function scrubHomeDirectoryPrefix(value, homeDirectory = homedir()) {
|
|
|
1298
1299
|
* appended by {@link installTreeTornStderrLine}.
|
|
1299
1300
|
*/
|
|
1300
1301
|
export const INSTALL_TREE_TORN_REMEDY = "hq-cli could not finish automatic install-tree recovery. Re-run your command; " +
|
|
1301
|
-
|
|
1302
|
+
`if it still fails, reinstall with \`${HQ_CLI_NPM_UPDATE_COMMAND}\` ` +
|
|
1302
1303
|
"(or `pnpm add -g @indigoai-us/hq-cli@latest` / `bun add -g @indigoai-us/hq-cli@latest` " +
|
|
1303
1304
|
"when that manager owns your install).";
|
|
1304
1305
|
/** Fixed repair guidance for an unchanged tree with no active updater signal. */
|
|
1305
1306
|
export const INSTALL_TREE_STALE_REMEDY = "hq-cli's install tree is incomplete and no active updater was detected. " +
|
|
1306
|
-
|
|
1307
|
+
`Reinstall with \`${HQ_CLI_NPM_UPDATE_COMMAND}\` ` +
|
|
1307
1308
|
"(or `pnpm add -g @indigoai-us/hq-cli@latest` / `bun add -g @indigoai-us/hq-cli@latest` " +
|
|
1308
1309
|
"when that manager owns your install), then run the command again.";
|
|
1309
1310
|
/** Guidance when a retired package sibling's activity could not be verified. */
|
|
1310
|
-
export const INSTALL_TREE_RETIRED_UNVERIFIED_REMEDY = "hq-cli found a retired install sibling but could not verify whether an installer is still using it. Wait for any npm or desktop CLI update to finish, then run the command again.
|
|
1311
|
+
export const INSTALL_TREE_RETIRED_UNVERIFIED_REMEDY = "hq-cli found a retired install sibling but could not verify whether an installer is still using it. Wait for any npm or desktop CLI update to finish, then run the command again. " +
|
|
1312
|
+
`If no install is running, repair with \`${HQ_CLI_NPM_UPDATE_COMMAND}\` ` +
|
|
1311
1313
|
"(or `pnpm add -g @indigoai-us/hq-cli@latest` / `bun add -g @indigoai-us/hq-cli@latest` " +
|
|
1312
1314
|
"when that manager owns your install).";
|
|
1313
1315
|
/**
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Packages in hq-cli's install tree whose install scripts must run. */
|
|
2
|
+
export declare const HQ_CLI_INSTALL_SCRIPT_PACKAGES: readonly string[];
|
|
3
|
+
/** `--allow-scripts=<name>` for each package, then `--include=optional`. */
|
|
4
|
+
export declare function npmInstallScriptFlags(allowScripts: readonly string[]): string[];
|
|
5
|
+
/** The flags for an hq-cli install. */
|
|
6
|
+
export declare const HQ_CLI_NPM_INSTALL_FLAGS: readonly string[];
|
|
7
|
+
/**
|
|
8
|
+
* `install -g [--prefix <prefix>] <spec> <flags>` for npm. `allowScripts`
|
|
9
|
+
* defaults to hq-cli's list; pass another list for another package.
|
|
10
|
+
*/
|
|
11
|
+
export declare function npmGlobalInstallArgv(spec: string, options?: {
|
|
12
|
+
prefix?: string;
|
|
13
|
+
allowScripts?: readonly string[];
|
|
14
|
+
}): string[];
|
|
15
|
+
/**
|
|
16
|
+
* An `npm install -g` command line for hq-cli to print to users. `prefixArg`
|
|
17
|
+
* is placed as given, so a caller that needs shell quoting passes it quoted.
|
|
18
|
+
*/
|
|
19
|
+
export declare function hqCliNpmInstallCommand(options?: {
|
|
20
|
+
spec?: string;
|
|
21
|
+
prefixArg?: string;
|
|
22
|
+
}): string;
|
|
23
|
+
/** The repair command printed to users: reinstall hq-cli with every flag. */
|
|
24
|
+
export declare const HQ_CLI_NPM_REPAIR_COMMAND: string;
|
|
25
|
+
/** The update command printed to users: install hq-cli@latest with every flag. */
|
|
26
|
+
export declare const HQ_CLI_NPM_UPDATE_COMMAND: string;
|
|
27
|
+
//# sourceMappingURL=npm-install-flags.d.ts.map
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The npm flags every hq-cli install and repair command must carry.
|
|
3
|
+
*
|
|
4
|
+
* npm 12 blocks dependency install scripts unless the package is named in
|
|
5
|
+
* `--allow-scripts`, and npm 11.16 to 11.x runs them but warns. Without the
|
|
6
|
+
* names below, a self-update or rescue install leaves better-sqlite3,
|
|
7
|
+
* node-llama-cpp and the tree-sitter grammars unbuilt and skips hq-cli's own
|
|
8
|
+
* postinstall (which installs the native hook engine). `--include=optional`
|
|
9
|
+
* keeps the platform hook-engine package when the user's npm config omits
|
|
10
|
+
* optional dependencies.
|
|
11
|
+
*
|
|
12
|
+
* Older npm accepts both flags without failing: npm 10 accepts the unknown
|
|
13
|
+
* `allow-scripts` key silently and npm 11 before 11.16 accepts it with an
|
|
14
|
+
* "Unknown cli config" warning, and both run install scripts anyway. `--include` exists
|
|
15
|
+
* since npm 7. So the flags are passed on every npm version, with no
|
|
16
|
+
* `npm --version` probe.
|
|
17
|
+
*
|
|
18
|
+
* The package list matches the HQ desktop app's allow-list
|
|
19
|
+
* (`managed_npm_allow_scripts` in hq-desktop-app-src
|
|
20
|
+
* apps/sync/src-tauri/src/commands/install_deps.rs) and the build list in this
|
|
21
|
+
* repo's pnpm-workspace.yaml `allowBuilds`. Keep the three in step.
|
|
22
|
+
*/
|
|
23
|
+
// No imports, on purpose: staged installers and resident processes load this
|
|
24
|
+
// file while an update may be replacing the package tree, so it must not read
|
|
25
|
+
// package.json when it loads. npm-install-flags.test.ts checks this name
|
|
26
|
+
// against package.json.
|
|
27
|
+
const CLI_NAME = "@indigoai-us/hq-cli";
|
|
28
|
+
/** Packages in hq-cli's install tree whose install scripts must run. */
|
|
29
|
+
export const HQ_CLI_INSTALL_SCRIPT_PACKAGES = [
|
|
30
|
+
CLI_NAME,
|
|
31
|
+
"better-sqlite3",
|
|
32
|
+
"node-llama-cpp",
|
|
33
|
+
"tree-sitter-go",
|
|
34
|
+
"tree-sitter-python",
|
|
35
|
+
"tree-sitter-rust",
|
|
36
|
+
"tree-sitter-typescript",
|
|
37
|
+
"tree-sitter-javascript",
|
|
38
|
+
];
|
|
39
|
+
/** `--allow-scripts=<name>` for each package, then `--include=optional`. */
|
|
40
|
+
export function npmInstallScriptFlags(allowScripts) {
|
|
41
|
+
return [...allowScripts.map((name) => `--allow-scripts=${name}`), "--include=optional"];
|
|
42
|
+
}
|
|
43
|
+
/** The flags for an hq-cli install. */
|
|
44
|
+
export const HQ_CLI_NPM_INSTALL_FLAGS = npmInstallScriptFlags(HQ_CLI_INSTALL_SCRIPT_PACKAGES);
|
|
45
|
+
/**
|
|
46
|
+
* `install -g [--prefix <prefix>] <spec> <flags>` for npm. `allowScripts`
|
|
47
|
+
* defaults to hq-cli's list; pass another list for another package.
|
|
48
|
+
*/
|
|
49
|
+
export function npmGlobalInstallArgv(spec, options = {}) {
|
|
50
|
+
const prefixArgs = options.prefix ? ["--prefix", options.prefix] : [];
|
|
51
|
+
const flags = options.allowScripts
|
|
52
|
+
? npmInstallScriptFlags(options.allowScripts)
|
|
53
|
+
: HQ_CLI_NPM_INSTALL_FLAGS;
|
|
54
|
+
return ["install", "-g", ...prefixArgs, spec, ...flags];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* An `npm install -g` command line for hq-cli to print to users. `prefixArg`
|
|
58
|
+
* is placed as given, so a caller that needs shell quoting passes it quoted.
|
|
59
|
+
*/
|
|
60
|
+
export function hqCliNpmInstallCommand(options = {}) {
|
|
61
|
+
const spec = options.spec ?? `${CLI_NAME}@latest`;
|
|
62
|
+
return `npm ${npmGlobalInstallArgv(spec, { prefix: options.prefixArg }).join(" ")}`;
|
|
63
|
+
}
|
|
64
|
+
/** The repair command printed to users: reinstall hq-cli with every flag. */
|
|
65
|
+
export const HQ_CLI_NPM_REPAIR_COMMAND = hqCliNpmInstallCommand({ spec: CLI_NAME });
|
|
66
|
+
/** The update command printed to users: install hq-cli@latest with every flag. */
|
|
67
|
+
export const HQ_CLI_NPM_UPDATE_COMMAND = hqCliNpmInstallCommand();
|
|
68
|
+
//# sourceMappingURL=npm-install-flags.js.map
|
|
@@ -79,7 +79,7 @@ export function packageUseLeasePurposeForArgv(argv) {
|
|
|
79
79
|
(args[0] === "bot" && (args[1] === "run" || (args[1] === "logs" && hasOption("--follow", "-f")))) ||
|
|
80
80
|
(args[0] === "daemon" && args[1] === "logs" && hasOption("--follow", "-f")) ||
|
|
81
81
|
(args[0] === "integrations" && args[1] === "connect") ||
|
|
82
|
-
(args[0] === "lanes" && ["watch", "message", "resume"].includes(args[1] ?? "")) ||
|
|
82
|
+
((args[0] === "runners" || args[0] === "lanes") && ["watch", "message", "resume"].includes(args[1] ?? "")) ||
|
|
83
83
|
(args[0] === "monitor" && ["wait", "_run"].includes(args[1] ?? "")) ||
|
|
84
84
|
(args[0] === "pack" && args[1] === "install") ||
|
|
85
85
|
(args[0] === "pkg" && args[1] === "update") ||
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
// 2. SHAPE: the distinctive "Could not locate the bindings file" text, OR a
|
|
28
28
|
// `better_sqlite3.node` reference that co-occurs with a genuine
|
|
29
29
|
// module-load failure. Either alone would be too loose.
|
|
30
|
+
import { HQ_CLI_NPM_REPAIR_COMMAND } from "./npm-install-flags.js";
|
|
30
31
|
/** The `bindings` module's exact "not found" text — sufficient on its own. */
|
|
31
32
|
const BINDINGS_NOT_LOCATED = /could not locate the bindings file/i;
|
|
32
33
|
/** A reference to the compiled better-sqlite3 module. */
|
|
@@ -49,7 +50,7 @@ export const QMD_NATIVE_BINDING_REMEDY = "hq's local search index can't start: i
|
|
|
49
50
|
"which leaves better-sqlite3 uncompiled. Approve the build and reinstall — for " +
|
|
50
51
|
"a global install run `pnpm approve-builds -g better-sqlite3` (drop -g for a " +
|
|
51
52
|
"local project). npm 11.16 and later skip install scripts unless you opt in; reinstall with " +
|
|
52
|
-
|
|
53
|
+
`\`${HQ_CLI_NPM_REPAIR_COMMAND}\`. ` +
|
|
53
54
|
"Or reinstall hq with npm, then run the command again.";
|
|
54
55
|
/**
|
|
55
56
|
* The text to inspect. For a QmdExitError the captured stderr/stdout is the qmd
|
|
@@ -67,6 +67,7 @@ import { isCliTelemetryDisabled } from "./cli-telemetry.js";
|
|
|
67
67
|
import { CLI_NAME, CLI_VERSION } from "../cli-version.js";
|
|
68
68
|
import { buildBunInstallArgv, buildPnpmInstallArgv, buildPrefixedInstallArgv, buildSpawnPlan, canWriteNpmInstall, captureNonWritableNpmPrefixNotice, claimNonWritableNpmPrefixNotice, checkUpdateConvergence, derivePnpmHome, detachUpdateSupervisor, isBunManagedPackageDir, isLocalDependencyInstall, isPnpmManagedPackageDir, normalizeRunningInstall, nonWritablePrefixNote, openInstallOutput, resolvePnpmPathInstall, pnpmUpdateEnv, pnpmInstalledVersion, performPnpmUpdate, resolveRunningInstall, runUpdateCommand, runSupervisedUpdateCommand, UPDATE_RECURSION_GUARD_ENV, } from "./version-gate.js";
|
|
69
69
|
import { canStageInstall, stagedNpmInstall } from "./staged-install.js";
|
|
70
|
+
import { npmGlobalInstallArgv } from "./npm-install-flags.js";
|
|
70
71
|
import { acquireUpdateLock as acquireSharedUpdateLock } from "./update-lock.js";
|
|
71
72
|
import { markLatestIneffective } from "./version-check.js";
|
|
72
73
|
import { fileSelfUpdateBackoff } from "./self-update-backoff.js";
|
|
@@ -696,7 +697,7 @@ export function buildSelfUpdatePlan(install) {
|
|
|
696
697
|
return { cmd: "bun", args: buildBunInstallArgv() };
|
|
697
698
|
if (install.prefix)
|
|
698
699
|
return { cmd: "npm", args: buildPrefixedInstallArgv(install.prefix) };
|
|
699
|
-
return { cmd: "npm", args:
|
|
700
|
+
return { cmd: "npm", args: npmGlobalInstallArgv(`${CLI_NAME}@latest`) };
|
|
700
701
|
}
|
|
701
702
|
/**
|
|
702
703
|
* Install without letting the package manager write to OUR stdout. The startup
|
|
@@ -17,6 +17,7 @@ import { randomBytes } from "node:crypto";
|
|
|
17
17
|
import * as fs from "node:fs";
|
|
18
18
|
import * as path from "node:path";
|
|
19
19
|
import { CLI_NAME } from "../cli-version.js";
|
|
20
|
+
import { npmGlobalInstallArgv } from "./npm-install-flags.js";
|
|
20
21
|
import { runUpdateCommand } from "./version-gate.js";
|
|
21
22
|
/** Set for the staging install; hq-cli's own postinstall skips itself on it. */
|
|
22
23
|
export const STAGED_INSTALL_ENV = "HQ_STAGED_INSTALL";
|
|
@@ -57,7 +58,7 @@ export function stagedNpmInstall(install, version, deps = {}) {
|
|
|
57
58
|
const backup = path.join(path.dirname(live), `.hq-cli-backup-${tag}`);
|
|
58
59
|
let keepBackup = false;
|
|
59
60
|
try {
|
|
60
|
-
const result = run("npm",
|
|
61
|
+
const result = run("npm", npmGlobalInstallArgv(`${CLI_NAME}@${version}`, { prefix: staging }), { ...env, [STAGED_INSTALL_ENV]: "1" });
|
|
61
62
|
if (!result.ok)
|
|
62
63
|
return result;
|
|
63
64
|
const reported = probe(staged);
|
|
@@ -4,6 +4,7 @@ import os from "node:os";
|
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import { isMainModule } from "./is-main-module.js";
|
|
7
|
+
import { npmGlobalInstallArgv } from "./npm-install-flags.js";
|
|
7
8
|
import { removeHqCliPs1Shims } from "../lib/windows/ps1-shims.js";
|
|
8
9
|
const PACKAGE_NAME = "@indigoai-us/hq-cli";
|
|
9
10
|
const RANDOM_HEX_BYTES = 6;
|
|
@@ -84,7 +85,7 @@ export function installNpmPackageStaged(prefix, packageSpec, runner, platform =
|
|
|
84
85
|
let stagePrefix;
|
|
85
86
|
try {
|
|
86
87
|
stagePrefix = temporaryRoot();
|
|
87
|
-
const npmResult = runner("npm",
|
|
88
|
+
const npmResult = runner("npm", npmGlobalInstallArgv(packageSpec, { prefix: stagePrefix }), { ...process.env, HQ_STAGED_INSTALL: "1" });
|
|
88
89
|
if (!npmResult.ok)
|
|
89
90
|
return npmResult;
|
|
90
91
|
const activation = activate(prefix, stagePrefix, platform);
|
|
@@ -9,7 +9,8 @@ import type { UploadAuthor } from "@indigoai-us/hq-cloud";
|
|
|
9
9
|
* Resolve the upload author from the cached id token of the session the push
|
|
10
10
|
* uses. Decoded, not verified: Cognito verified it at issuance and no auth
|
|
11
11
|
* decision rides on the label. Returns undefined when that session has no
|
|
12
|
-
* cached token or the token lacks `sub
|
|
12
|
+
* cached token or the token lacks `sub`; share() then skips the stamp. A token
|
|
13
|
+
* with `sub` and no `email` yields an author with an empty email (sub only).
|
|
13
14
|
*/
|
|
14
15
|
export declare function resolveUploadAuthor(env?: NodeJS.ProcessEnv, home?: string): UploadAuthor | undefined;
|
|
15
16
|
//# sourceMappingURL=upload-author.d.ts.map
|
|
@@ -14,10 +14,13 @@ function authorFromIdToken(idToken) {
|
|
|
14
14
|
return undefined;
|
|
15
15
|
try {
|
|
16
16
|
const claims = JSON.parse(Buffer.from(parts[1], "base64url").toString("utf8"));
|
|
17
|
-
if (claims.sub
|
|
18
|
-
return
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
if (!claims.sub)
|
|
18
|
+
return undefined;
|
|
19
|
+
// feedback_65ee9e51: a machine token (agent, Outpost) can carry no email.
|
|
20
|
+
// Stamp its sub alone, as hq-sync-runner does, so the files it creates
|
|
21
|
+
// carry `created-by-sub` and the unattended delete hold lets it delete
|
|
22
|
+
// them later. hq-cloud writes no `created-by` for the empty email.
|
|
23
|
+
return { userSub: claims.sub, email: claims.email ?? "" };
|
|
21
24
|
}
|
|
22
25
|
catch {
|
|
23
26
|
// Unparseable claims only mean no author label; share() skips the stamp.
|
|
@@ -28,7 +31,8 @@ function authorFromIdToken(idToken) {
|
|
|
28
31
|
* Resolve the upload author from the cached id token of the session the push
|
|
29
32
|
* uses. Decoded, not verified: Cognito verified it at issuance and no auth
|
|
30
33
|
* decision rides on the label. Returns undefined when that session has no
|
|
31
|
-
* cached token or the token lacks `sub
|
|
34
|
+
* cached token or the token lacks `sub`; share() then skips the stamp. A token
|
|
35
|
+
* with `sub` and no `email` yields an author with an empty email (sub only).
|
|
32
36
|
*/
|
|
33
37
|
export function resolveUploadAuthor(env = process.env, home = os.homedir()) {
|
|
34
38
|
const tokens = wantsMachineCognitoTokens({}, env)
|
|
@@ -3,6 +3,7 @@ import * as os from "os";
|
|
|
3
3
|
import * as path from "path";
|
|
4
4
|
import semver from "semver";
|
|
5
5
|
import { CLI_VERSION } from "../cli-version.js";
|
|
6
|
+
import { HQ_CLI_NPM_UPDATE_COMMAND } from "./npm-install-flags.js";
|
|
6
7
|
const PACKAGE_NAME = "@indigoai-us/hq-cli";
|
|
7
8
|
const REGISTRY_URL = `https://registry.npmjs.org/${encodeURIComponent(PACKAGE_NAME)}/latest`;
|
|
8
9
|
const CACHE_TTL_MS = 60 * 60 * 1000; // 1h — catch fresh releases within the hour
|
|
@@ -228,7 +229,7 @@ export async function printCachedVersionNudge(stderr = process.stderr) {
|
|
|
228
229
|
return;
|
|
229
230
|
const latest = staleAgainstCachedLatest();
|
|
230
231
|
if (latest) {
|
|
231
|
-
stderr.write(`Update available: ${latest}. Update with
|
|
232
|
+
stderr.write(`Update available: ${latest}. Update with ${HQ_CLI_NPM_UPDATE_COMMAND}, pnpm add -g @indigoai-us/hq-cli@latest, or bun add -g @indigoai-us/hq-cli@latest.\n`);
|
|
232
233
|
}
|
|
233
234
|
}
|
|
234
235
|
export async function printVersionAndNudge(stdout = process.stdout, stderr = process.stderr) {
|
|
@@ -43,6 +43,7 @@ import { Sentry } from "../sentry.js";
|
|
|
43
43
|
import { isCliTelemetryDisabled } from "./cli-telemetry.js";
|
|
44
44
|
import { DEFAULT_VAULT_API_URL } from "./cognito-session.js";
|
|
45
45
|
import { acquireUpdateLock, } from "./update-lock.js";
|
|
46
|
+
import { HQ_CLI_NPM_UPDATE_COMMAND, hqCliNpmInstallCommand, npmGlobalInstallArgv } from "./npm-install-flags.js";
|
|
46
47
|
/** Prevent an update package manager's lifecycle child from starting another updater. */
|
|
47
48
|
export const UPDATE_RECURSION_GUARD_ENV = "HQ_RESCUE_SELF_UPDATED";
|
|
48
49
|
const CLIENT_ID = "hq-cli";
|
|
@@ -668,14 +669,14 @@ export function nonWritablePrefixNote(prefix, platform = process.platform) {
|
|
|
668
669
|
if (platform === "win32") {
|
|
669
670
|
const windowsPrefixArg = `"${prefix.replace(/"/g, '""')}"`;
|
|
670
671
|
return (`The npm global prefix ${prefix} is not writable by the current user, so hq-cli was not updated. ` +
|
|
671
|
-
`Open PowerShell as Administrator and run
|
|
672
|
+
`Open PowerShell as Administrator and run \`${hqCliNpmInstallCommand({ prefixArg: windowsPrefixArg })}\`, ` +
|
|
672
673
|
`or set a user-owned prefix with \`npm config set prefix "$env:APPDATA\\npm"\` and run ` +
|
|
673
|
-
|
|
674
|
+
`\`${HQ_CLI_NPM_UPDATE_COMMAND}\` from that PowerShell session.`);
|
|
674
675
|
}
|
|
675
676
|
return (`The npm global prefix ${prefix} is not writable by the current user, so hq-cli was not updated. ` +
|
|
676
|
-
`Run \`sudo
|
|
677
|
+
`Run \`sudo ${hqCliNpmInstallCommand({ prefixArg })}\` to update this install, ` +
|
|
677
678
|
`or switch to a user-owned prefix with \`npm config set prefix ~/.npm-global\`, then run ` +
|
|
678
|
-
|
|
679
|
+
`\`${HQ_CLI_NPM_UPDATE_COMMAND}\` after adding ~/.npm-global/bin to PATH.`);
|
|
679
680
|
}
|
|
680
681
|
/**
|
|
681
682
|
* Derive `PNPM_HOME` from a pnpm-managed install's own path. pnpm resolves its
|
|
@@ -750,7 +751,7 @@ export function pnpmUpdateEnv(install, base = process.env) {
|
|
|
750
751
|
return Object.keys(result).some((key) => result[key] !== base[key]) ? result : undefined;
|
|
751
752
|
}
|
|
752
753
|
export function buildPrefixedInstallArgv(prefix) {
|
|
753
|
-
return
|
|
754
|
+
return npmGlobalInstallArgv(LATEST_PACKAGE_SPEC, { prefix });
|
|
754
755
|
}
|
|
755
756
|
/**
|
|
756
757
|
* Argv for updating a pnpm-managed global install. `pnpm add -g` rewrites the
|
|
@@ -2083,7 +2084,7 @@ export function shouldSkipGate(argv) {
|
|
|
2083
2084
|
// Hook-time deliveries must finish inside the provider's timeout budget.
|
|
2084
2085
|
// process.argv slots 0 and 1 are the runtime and CLI entry point. Inspect
|
|
2085
2086
|
// command positions only; user arguments may legitimately contain these words.
|
|
2086
|
-
const hookTimeLinkDelivery = argv[2] === "lanes" && argv[3] === "link" && argv[4] === "_deliver";
|
|
2087
|
+
const hookTimeLinkDelivery = (argv[2] === "runners" || argv[2] === "lanes") && argv[3] === "link" && argv[4] === "_deliver";
|
|
2087
2088
|
return hookTimeLinkDelivery || isVersionRequest(argv) || argv.some((a) => a === "--version" ||
|
|
2088
2089
|
a === "-V" ||
|
|
2089
2090
|
a === "-v" ||
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indigoai-us/hq-cli",
|
|
3
|
-
"version": "5.345.
|
|
3
|
+
"version": "5.345.210",
|
|
4
4
|
"description": "HQ by Indigo management CLI — modules and cloud sync",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -117,11 +117,11 @@
|
|
|
117
117
|
"*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}": "eslint --cache --no-error-on-unmatched-pattern"
|
|
118
118
|
},
|
|
119
119
|
"optionalDependencies": {
|
|
120
|
-
"@indigoai-us/hq-hook-win32-x64": "5.345.
|
|
121
|
-
"@indigoai-us/hq-hook-win32-arm64": "5.345.
|
|
122
|
-
"@indigoai-us/hq-hook-darwin-x64": "5.345.
|
|
123
|
-
"@indigoai-us/hq-hook-darwin-arm64": "5.345.
|
|
124
|
-
"@indigoai-us/hq-hook-linux-x64": "5.345.
|
|
125
|
-
"@indigoai-us/hq-hook-linux-arm64": "5.345.
|
|
120
|
+
"@indigoai-us/hq-hook-win32-x64": "5.345.210",
|
|
121
|
+
"@indigoai-us/hq-hook-win32-arm64": "5.345.210",
|
|
122
|
+
"@indigoai-us/hq-hook-darwin-x64": "5.345.210",
|
|
123
|
+
"@indigoai-us/hq-hook-darwin-arm64": "5.345.210",
|
|
124
|
+
"@indigoai-us/hq-hook-linux-x64": "5.345.210",
|
|
125
|
+
"@indigoai-us/hq-hook-linux-arm64": "5.345.210"
|
|
126
126
|
}
|
|
127
127
|
}
|
|
@@ -3,11 +3,15 @@ import { fileURLToPath } from 'node:url';
|
|
|
3
3
|
// A source checkout has not built dist during pnpm install. Published tarballs
|
|
4
4
|
// never contain src; a broken tarball warns and keeps existing bash hooks active.
|
|
5
5
|
if (!existsSync(new URL('../dist/lib/hook-engine/resolve.js', import.meta.url)) && existsSync(new URL('../src/index.ts', import.meta.url))) process.exit(0);
|
|
6
|
+
// Fallback when the resolver cannot load; keep it equal to HQ_CLI_NPM_REPAIR_COMMAND
|
|
7
|
+
// in src/utils/npm-install-flags.ts (feedback d83de3c3).
|
|
8
|
+
let repair = 'npm install -g @indigoai-us/hq-cli --allow-scripts=@indigoai-us/hq-cli --allow-scripts=better-sqlite3 --allow-scripts=node-llama-cpp --allow-scripts=tree-sitter-go --allow-scripts=tree-sitter-python --allow-scripts=tree-sitter-rust --allow-scripts=tree-sitter-typescript --allow-scripts=tree-sitter-javascript --include=optional';
|
|
6
9
|
try {
|
|
7
|
-
const
|
|
8
|
-
if (
|
|
10
|
+
const resolver = await import('../dist/lib/hook-engine/resolve.js');
|
|
11
|
+
if (typeof resolver.HOOK_ENGINE_REPAIR === 'string') repair = resolver.HOOK_ENGINE_REPAIR;
|
|
12
|
+
if (!resolver.installHookEngine()) throw new Error('Optional platform package missing');
|
|
9
13
|
} catch (error) {
|
|
10
|
-
console.warn(`HQ native hook engine unavailable: ${error instanceof Error ? error.message : String(error)}. Existing bash hooks remain active. Repair:
|
|
14
|
+
console.warn(`HQ native hook engine unavailable: ${error instanceof Error ? error.message : String(error)}. Existing bash hooks remain active. Repair: ${repair}`);
|
|
11
15
|
}
|
|
12
16
|
// npm writes hq.ps1 next to hq.cmd on Windows. PowerShell prefers it and the
|
|
13
17
|
// default Restricted execution policy blocks it, so remove hq-cli's own .ps1
|