@indigoai-us/hq-cli 5.311.0 → 5.311.2

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 (47) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/commands/core-delegate-w1b.js +111 -14
  3. package/dist/commands/core-delegate.d.ts +9 -0
  4. package/dist/commands/core-delegate.js +44 -23
  5. package/dist/commands/integrations-core.d.ts +2 -0
  6. package/dist/commands/integrations-core.js +4 -0
  7. package/dist/commands/integrations.js +2 -2
  8. package/dist/commands/lanes-message.js +18 -7
  9. package/dist/commands/lanes-shared.d.ts +2 -0
  10. package/dist/commands/lanes-watch.js +1 -5
  11. package/dist/commands/lanes.js +4 -10
  12. package/dist/fast-scaffold.d.ts +4 -0
  13. package/dist/fast-scaffold.js +5 -0
  14. package/dist/index.d.ts +1 -1
  15. package/dist/index.js +1 -1
  16. package/dist/lib/bot/runtime/windows.d.ts +2 -0
  17. package/dist/lib/bot/runtime/windows.js +1 -1
  18. package/dist/lib/flag-registry.d.ts +2 -0
  19. package/dist/lib/flag-registry.js +19 -12
  20. package/dist/lib/lanes/autopilot.js +19 -2
  21. package/dist/lib/lanes/delivery.d.ts +1 -0
  22. package/dist/lib/lanes/keep-alive.d.ts +1 -3
  23. package/dist/lib/lanes/keep-alive.js +2 -4
  24. package/dist/lib/lanes/reconcile.js +14 -36
  25. package/dist/lib/lanes/spawn.d.ts +2 -0
  26. package/dist/lib/lanes/spawn.js +35 -12
  27. package/dist/lib/lanes/types.d.ts +2 -2
  28. package/dist/lib/lanes/watch.d.ts +0 -1
  29. package/dist/lib/lanes/watch.js +4 -9
  30. package/dist/main.js +1 -1
  31. package/dist/node-network-compat-core.d.ts +12 -0
  32. package/dist/node-network-compat-core.js +41 -0
  33. package/dist/node-network-compat-fast.d.ts +7 -0
  34. package/dist/node-network-compat-fast.js +23 -0
  35. package/dist/node-network-compat.d.ts +2 -18
  36. package/dist/node-network-compat.js +4 -39
  37. package/dist/node-preflight.d.ts +7 -1
  38. package/dist/node-preflight.js +5 -5
  39. package/dist/utils/hq-core-yaml.d.ts +10 -0
  40. package/dist/utils/hq-core-yaml.js +40 -0
  41. package/dist/utils/pack-contributions.d.ts +2 -9
  42. package/dist/utils/pack-contributions.js +1 -39
  43. package/dist/utils/run-bundled-script.d.ts +6 -0
  44. package/dist/utils/run-bundled-script.js +14 -3
  45. package/dist/utils/scaffold-fast-import-guard.js +5 -1
  46. package/dist/utils/version-report.js +1 -1
  47. package/package.json +1 -1
@@ -1,19 +1,3 @@
1
- /**
2
- * Node network defaults for HQ CLI entry points.
3
- *
4
- * The compatibility timeout remains the default for HQ CLI entry points.
5
- *
6
- * Keep this module safe to import immediately after the Node version preflight.
7
- */
8
- export declare const HQ_NETWORK_FAMILY_ATTEMPT_TIMEOUT_MS = 1000;
9
- export interface NodeNetworkCompatibilityOptions {
10
- nodeOptions?: string;
11
- execArgv?: readonly string[];
12
- /**
13
- * Inject the net timeout setter (tests). Pass null to simulate a runtime
14
- * that lacks setDefaultAutoSelectFamilyAttemptTimeout.
15
- */
16
- setAttemptTimeout?: ((milliseconds: number) => void) | null;
17
- }
18
- export declare function configureNodeNetworkCompatibility(options?: NodeNetworkCompatibilityOptions): boolean;
1
+ /** Unconditional compatibility setup for the full CLI command graph. */
2
+ export { configureNodeNetworkCompatibility, HQ_NETWORK_FAMILY_ATTEMPT_TIMEOUT_MS, type NodeNetworkCompatibilityOptions, } from "./node-network-compat-core.js";
19
3
  //# sourceMappingURL=node-network-compat.d.ts.map
@@ -1,40 +1,5 @@
1
- /**
2
- * Node network defaults for HQ CLI entry points.
3
- *
4
- * The compatibility timeout remains the default for HQ CLI entry points.
5
- *
6
- * Keep this module safe to import immediately after the Node version preflight.
7
- */
8
- import * as nodeNet from "node:net";
9
- export const HQ_NETWORK_FAMILY_ATTEMPT_TIMEOUT_MS = 1000;
10
- const ATTEMPT_TIMEOUT_OPTION = "--network-family-autoselection-attempt-timeout";
11
- function hasExplicitAttemptTimeout(nodeOptions, execArgv) {
12
- const optionPattern = new RegExp("(?:^|\\s)" + ATTEMPT_TIMEOUT_OPTION + "(?:=|\\s|$)");
13
- return (optionPattern.test(nodeOptions) ||
14
- execArgv.some((argument) => argument === ATTEMPT_TIMEOUT_OPTION ||
15
- argument.startsWith(ATTEMPT_TIMEOUT_OPTION + "=")));
16
- }
17
- function resolveSetAttemptTimeout(override) {
18
- if (override === null)
19
- return undefined;
20
- if (override)
21
- return override;
22
- const fn = nodeNet.setDefaultAutoSelectFamilyAttemptTimeout;
23
- return typeof fn === "function" ? fn.bind(nodeNet) : undefined;
24
- }
25
- export function configureNodeNetworkCompatibility(options = {}) {
26
- const nodeOptions = options.nodeOptions ?? process.env.NODE_OPTIONS ?? "";
27
- const execArgv = options.execArgv ?? process.execArgv;
28
- if (hasExplicitAttemptTimeout(nodeOptions, execArgv)) {
29
- return false;
30
- }
31
- const setAttemptTimeout = resolveSetAttemptTimeout(options.setAttemptTimeout);
32
- if (!setAttemptTimeout) {
33
- // Runtime lacks the API; the Node preflight should already have exited.
34
- return false;
35
- }
36
- setAttemptTimeout(HQ_NETWORK_FAMILY_ATTEMPT_TIMEOUT_MS);
37
- return true;
38
- }
39
- configureNodeNetworkCompatibility();
1
+ /** Unconditional compatibility setup for the full CLI command graph. */
2
+ import { configureNodeNetworkCompatibilityOnce } from "./node-network-compat-core.js";
3
+ export { configureNodeNetworkCompatibility, HQ_NETWORK_FAMILY_ATTEMPT_TIMEOUT_MS, } from "./node-network-compat-core.js";
4
+ configureNodeNetworkCompatibilityOnce();
40
5
  //# sourceMappingURL=node-network-compat.js.map
@@ -23,6 +23,12 @@ export interface NodeVersionCheck {
23
23
  major: number;
24
24
  message?: string;
25
25
  }
26
+ export interface NodePreflightOptions {
27
+ versionString?: string;
28
+ skip?: string;
29
+ stderr?: Pick<NodeJS.WriteStream, "write">;
30
+ exit?: (code: number) => void;
31
+ }
26
32
  /**
27
33
  * Pure check: is the given Node version string (e.g. "18.19.0") supported?
28
34
  * Defaults to the running runtime's version. An unparseable version is treated
@@ -35,5 +41,5 @@ export declare function checkNodeVersion(versionString?: string): NodeVersionChe
35
41
  * `HQ_SKIP_NODE_PREFLIGHT=1` to bypass (used by the test runner, which already
36
42
  * runs on a supported Node).
37
43
  */
38
- export declare function enforceNodeVersion(): void;
44
+ export declare function enforceNodeVersion(options?: NodePreflightOptions): void;
39
45
  //# sourceMappingURL=node-preflight.d.ts.map
@@ -39,13 +39,13 @@ export function checkNodeVersion(versionString = process.versions.node) {
39
39
  * `HQ_SKIP_NODE_PREFLIGHT=1` to bypass (used by the test runner, which already
40
40
  * runs on a supported Node).
41
41
  */
42
- export function enforceNodeVersion() {
43
- if (process.env.HQ_SKIP_NODE_PREFLIGHT)
42
+ export function enforceNodeVersion(options = {}) {
43
+ if (options.skip ?? process.env.HQ_SKIP_NODE_PREFLIGHT)
44
44
  return;
45
- const result = checkNodeVersion();
45
+ const result = checkNodeVersion(options.versionString ?? process.versions.node);
46
46
  if (!result.ok && result.message) {
47
- process.stderr.write(`${result.message}\n`);
48
- process.exit(1);
47
+ (options.stderr ?? process.stderr).write(`${result.message}\n`);
48
+ (options.exit ?? process.exit)(1);
49
49
  }
50
50
  }
51
51
  enforceNodeVersion();
@@ -0,0 +1,10 @@
1
+ export declare function readHqVersion(hqRoot: string): string | null;
2
+ export interface CatalogEntry {
3
+ source: string;
4
+ description?: string;
5
+ conditional?: string;
6
+ auto_install?: boolean;
7
+ }
8
+ /** Read recommended_packages from core.yaml (the curated content-pack catalog). */
9
+ export declare function readRecommendedPackages(hqRoot: string): CatalogEntry[];
10
+ //# sourceMappingURL=hq-core-yaml.d.ts.map
@@ -0,0 +1,40 @@
1
+ import * as fs from "fs";
2
+ import * as path from "path";
3
+ import * as yaml from "js-yaml";
4
+ /** Locate core.yaml: v14+ nests it under core/, older layouts at the root. */
5
+ function coreYamlPath(hqRoot) {
6
+ const nested = path.join(hqRoot, "core", "core.yaml");
7
+ if (fs.existsSync(nested))
8
+ return nested;
9
+ const flat = path.join(hqRoot, "core.yaml");
10
+ if (fs.existsSync(flat))
11
+ return flat;
12
+ return null;
13
+ }
14
+ export function readHqVersion(hqRoot) {
15
+ const filePath = coreYamlPath(hqRoot);
16
+ if (!filePath)
17
+ return null;
18
+ try {
19
+ const config = yaml.load(fs.readFileSync(filePath, "utf-8"));
20
+ return config?.hqVersion ?? null;
21
+ }
22
+ catch {
23
+ return null;
24
+ }
25
+ }
26
+ /** Read recommended_packages from core.yaml (the curated content-pack catalog). */
27
+ export function readRecommendedPackages(hqRoot) {
28
+ const filePath = coreYamlPath(hqRoot);
29
+ if (!filePath)
30
+ return [];
31
+ try {
32
+ const config = yaml.load(fs.readFileSync(filePath, "utf-8"));
33
+ const list = config?.recommended_packages;
34
+ return Array.isArray(list) ? list : [];
35
+ }
36
+ catch {
37
+ return [];
38
+ }
39
+ }
40
+ //# sourceMappingURL=hq-core-yaml.js.map
@@ -39,6 +39,8 @@
39
39
  import type { PackManifest, PackContributeKey } from '../types.js';
40
40
  import { CONTRIBUTION_TABLE, type WireMode } from './contribution-table.js';
41
41
  import { type UnregisterServerResult, type SafeWriteEnv, type AcquireLockOptions } from '../commands/mcp-registration.js';
42
+ export { readHqVersion, readRecommendedPackages } from './hq-core-yaml.js';
43
+ export type { CatalogEntry } from './hq-core-yaml.js';
42
44
  export { CONTRIBUTION_TABLE };
43
45
  export type { WireMode };
44
46
  /**
@@ -163,13 +165,4 @@ export interface UnwirePackMcpOptions {
163
165
  * @param contributes the pack's `contributes` block (its `mcp` list drives removal)
164
166
  */
165
167
  export declare function unwirePackMcp(packName: string, contributes: Partial<Record<PackContributeKey, string[]>>, options?: UnwirePackMcpOptions): UnwireMcpResult;
166
- export declare function readHqVersion(hqRoot: string): string | null;
167
- export interface CatalogEntry {
168
- source: string;
169
- description?: string;
170
- conditional?: string;
171
- auto_install?: boolean;
172
- }
173
- /** Read `recommended_packages` from core.yaml (the curated content-pack catalog). */
174
- export declare function readRecommendedPackages(hqRoot: string): CatalogEntry[];
175
168
  //# sourceMappingURL=pack-contributions.d.ts.map
@@ -41,6 +41,7 @@ import * as path from 'path';
41
41
  import * as yaml from 'js-yaml';
42
42
  import { CONTRIBUTION_TABLE, payloadFor } from './contribution-table.js';
43
43
  import { unregisterMcpServers, } from '../commands/mcp-registration.js';
44
+ export { readHqVersion, readRecommendedPackages } from './hq-core-yaml.js';
44
45
  // NOTE on dependency direction: this module imports from ../commands/mcp-registration.js
45
46
  // to un-register `wire:merge` (mcp) servers on uninstall. mcp-registration.ts imports
46
47
  // ONLY fs/os/path/smol-toml (it does NOT import from pack-contributions.ts), so there
@@ -343,43 +344,4 @@ export function unwirePackMcp(packName, contributes, options) {
343
344
  }
344
345
  return { servers };
345
346
  }
346
- // ---------------------------------------------------------------------------
347
- // Host introspection: hqVersion + recommended_packages catalog
348
- // ---------------------------------------------------------------------------
349
- /** Locate core.yaml -- v14+ nests it under `core/`, older layouts at the root. */
350
- function coreYamlPath(hqRoot) {
351
- const nested = path.join(hqRoot, 'core', 'core.yaml');
352
- if (fs.existsSync(nested))
353
- return nested;
354
- const flat = path.join(hqRoot, 'core.yaml');
355
- if (fs.existsSync(flat))
356
- return flat;
357
- return null;
358
- }
359
- export function readHqVersion(hqRoot) {
360
- const p = coreYamlPath(hqRoot);
361
- if (!p)
362
- return null;
363
- try {
364
- const c = yaml.load(fs.readFileSync(p, 'utf-8'));
365
- return c?.hqVersion ?? null;
366
- }
367
- catch {
368
- return null;
369
- }
370
- }
371
- /** Read `recommended_packages` from core.yaml (the curated content-pack catalog). */
372
- export function readRecommendedPackages(hqRoot) {
373
- const p = coreYamlPath(hqRoot);
374
- if (!p)
375
- return [];
376
- try {
377
- const c = yaml.load(fs.readFileSync(p, 'utf-8'));
378
- const list = c?.recommended_packages;
379
- return Array.isArray(list) ? list : [];
380
- }
381
- catch {
382
- return [];
383
- }
384
- }
385
347
  //# sourceMappingURL=pack-contributions.js.map
@@ -50,10 +50,16 @@ export type RunBundledScriptOptions = {
50
50
  hqRoot?: string;
51
51
  /** Extra environment for the child, applied last. */
52
52
  env?: Record<string, string | undefined>;
53
+ /** Capture stdout and stderr as bytes instead of inheriting those streams. */
54
+ captureOutput?: boolean;
53
55
  };
54
56
  export type RunBundledScriptResult = {
55
57
  /** The child's exit code, or 128+signal if it was terminated by one. */
56
58
  code: number;
59
+ /** Present when captureOutput is true. */
60
+ stdout?: Buffer;
61
+ /** Present when captureOutput is true. */
62
+ stderr?: Buffer;
57
63
  };
58
64
  /**
59
65
  * Execute a bundled scaffold script and return its exit code.
@@ -155,7 +155,8 @@ export function runBundledScript(opts) {
155
155
  const result = spawnSync(executable, [script, ...(opts.args ?? [])], {
156
156
  cwd: opts.cwd,
157
157
  env,
158
- stdio: "inherit",
158
+ stdio: opts.captureOutput ? ["inherit", "pipe", "pipe"] : "inherit",
159
+ ...(opts.captureOutput ? { maxBuffer: Number.MAX_SAFE_INTEGER } : {}),
159
160
  });
160
161
  if (result.error) {
161
162
  const spawnError = result.error;
@@ -166,6 +167,7 @@ export function runBundledScript(opts) {
166
167
  }
167
168
  throw new Error(`Failed to run bundled script ${opts.asset}: ${result.error.message}`);
168
169
  }
170
+ let code;
169
171
  if (result.signal) {
170
172
  // Conventional shell encoding, so a caller checking for termination sees it.
171
173
  const signals = {
@@ -175,8 +177,17 @@ export function runBundledScript(opts) {
175
177
  SIGKILL: 9,
176
178
  SIGTERM: 15,
177
179
  };
178
- return { code: 128 + (signals[result.signal] ?? 0) };
180
+ code = 128 + (signals[result.signal] ?? 0);
179
181
  }
180
- return { code: result.status ?? 0 };
182
+ else {
183
+ code = result.status ?? 0;
184
+ }
185
+ return {
186
+ code,
187
+ ...(opts.captureOutput ? {
188
+ stdout: result.stdout ?? Buffer.alloc(0),
189
+ stderr: result.stderr ?? Buffer.alloc(0),
190
+ } : {}),
191
+ };
181
192
  }
182
193
  //# sourceMappingURL=run-bundled-script.js.map
@@ -6,6 +6,8 @@ function forbiddenFastPathModules(loadedModules, distDirectory, allowedCommandMo
6
6
  const commands = `${path.join(dist, "commands")}${path.sep}`;
7
7
  const flagRegistry = path.join(dist, "lib", "flag-registry.js");
8
8
  const coreCommand = path.join(dist, "commands", "core.js");
9
+ const fullNetworkCompat = path.join(dist, "node-network-compat.js");
10
+ const sentryEntrypoint = path.join(dist, "sentry.js");
9
11
  const allowedCommands = new Set(allowedCommandModules.map((module) => path.resolve(module)));
10
12
  return [...new Set(loadedModules.map((loaded) => {
11
13
  if (loaded.startsWith("file:")) {
@@ -22,7 +24,9 @@ function forbiddenFastPathModules(loadedModules, distDirectory, allowedCommandMo
22
24
  path.resolve(loaded).startsWith(commands) ||
23
25
  path.resolve(loaded) === flagRegistry ||
24
26
  path.resolve(loaded) === coreCommand ||
25
- path.resolve(loaded).includes(`${path.sep}node_modules${path.sep}@sentry${path.sep}node${path.sep}`))
27
+ path.resolve(loaded) === fullNetworkCompat ||
28
+ path.resolve(loaded) === sentryEntrypoint ||
29
+ path.resolve(loaded).includes(`${path.sep}node_modules${path.sep}@sentry${path.sep}`))
26
30
  .filter((loaded) => !allowedCommands.has(path.resolve(loaded)) ||
27
31
  path.resolve(loaded) === main || path.resolve(loaded) === coreCommand)
28
32
  .sort();
@@ -12,7 +12,7 @@ import semver from "semver";
12
12
  import { CLI_VERSION } from "../cli-version.js";
13
13
  import { wantsJson } from "../version-request.js";
14
14
  import { findHqRoot } from "./manifest.js";
15
- import { readHqVersion } from "./pack-contributions.js";
15
+ import { readHqVersion } from "./hq-core-yaml.js";
16
16
  export const HQ_CORE_LATEST_URL = "https://api.github.com/repos/indigoai-us/hq-core/releases/latest";
17
17
  export const LATEST_FETCH_TIMEOUT_MS = 3_000;
18
18
  export function normalizeHqCoreTag(tag) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigoai-us/hq-cli",
3
- "version": "5.311.0",
3
+ "version": "5.311.2",
4
4
  "description": "HQ by Indigo management CLI — modules and cloud sync",
5
5
  "main": "dist/index.js",
6
6
  "bin": {