@indigoai-us/hq-cli 5.322.0 → 5.324.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 (90) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/assets/scaffold/core/scripts/derive-trigger-facts.sh +263 -0
  3. package/assets/scaffold/core/scripts/lib/transcript-tail.sh +98 -0
  4. package/assets/scaffold/core/scripts/lib/trigger-fact-text.awk +86 -0
  5. package/dist/bin/hq-auth-refresh.d.ts +5 -1
  6. package/dist/bin/hq-auth-refresh.js +33 -1
  7. package/dist/command-catalog.generated.d.ts +138 -6
  8. package/dist/command-catalog.generated.js +178 -6
  9. package/dist/command-registration-plan.d.ts +24 -0
  10. package/dist/command-registration-plan.js +4 -0
  11. package/dist/commands/anywhere-runtime-flag.d.ts +9 -0
  12. package/dist/commands/anywhere-runtime-flag.js +22 -0
  13. package/dist/commands/cloud.js +23 -4
  14. package/dist/commands/core-derive-trigger-facts-command.d.ts +3 -0
  15. package/dist/commands/core-derive-trigger-facts-command.js +47 -0
  16. package/dist/commands/core-derive-trigger-facts-native.d.ts +21 -0
  17. package/dist/commands/core-derive-trigger-facts-native.js +492 -0
  18. package/dist/commands/core.js +6 -0
  19. package/dist/commands/daemon.js +39 -2
  20. package/dist/commands/db-provision.js +6 -1
  21. package/dist/commands/doctor.js +8 -4
  22. package/dist/commands/feedback.d.ts +2 -0
  23. package/dist/commands/feedback.js +10 -0
  24. package/dist/commands/install-global.d.ts +46 -0
  25. package/dist/commands/install-global.js +674 -0
  26. package/dist/commands/link.d.ts +30 -0
  27. package/dist/commands/link.js +184 -0
  28. package/dist/commands/mcp-status.d.ts +6 -0
  29. package/dist/commands/mcp-status.js +21 -4
  30. package/dist/commands/pkg-install.js +20 -1
  31. package/dist/commands/update.d.ts +19 -0
  32. package/dist/commands/update.js +52 -6
  33. package/dist/fast-core.d.ts +2 -1
  34. package/dist/fast-core.js +12 -8
  35. package/dist/fast-scaffold.js +13 -0
  36. package/dist/index.js +9 -7
  37. package/dist/lib/cli-invite-nudge.d.ts +25 -0
  38. package/dist/lib/cli-invite-nudge.js +152 -0
  39. package/dist/lib/core-utils/timeout-guard-native-flags.d.ts +6 -0
  40. package/dist/lib/core-utils/timeout-guard-native-flags.js +30 -0
  41. package/dist/lib/core-utils/timeout-guard-native.d.ts +0 -3
  42. package/dist/lib/core-utils/timeout-guard-native.js +4 -30
  43. package/dist/lib/core-utils/timeout-guard.d.ts +2 -0
  44. package/dist/lib/core-utils/timeout-guard.js +2 -1
  45. package/dist/lib/daemon/convergence.d.ts +42 -0
  46. package/dist/lib/daemon/convergence.js +66 -0
  47. package/dist/lib/daemon/heartbeat.d.ts +43 -0
  48. package/dist/lib/daemon/heartbeat.js +70 -0
  49. package/dist/lib/daemon/ops/journal.d.ts +29 -0
  50. package/dist/lib/daemon/ops/journal.js +141 -0
  51. package/dist/lib/daemon/ops/memory.d.ts +20 -0
  52. package/dist/lib/daemon/ops/memory.js +65 -0
  53. package/dist/lib/daemon/ops/mesh.d.ts +38 -0
  54. package/dist/lib/daemon/ops/mesh.js +70 -0
  55. package/dist/lib/daemon/ops/policy.d.ts +78 -0
  56. package/dist/lib/daemon/ops/policy.js +283 -0
  57. package/dist/lib/daemon/protocol.d.ts +68 -0
  58. package/dist/lib/daemon/protocol.js +154 -0
  59. package/dist/lib/daemon/run.d.ts +10 -0
  60. package/dist/lib/daemon/run.js +85 -3
  61. package/dist/lib/daemon/server.d.ts +36 -0
  62. package/dist/lib/daemon/server.js +306 -0
  63. package/dist/lib/daemon/session-registry.d.ts +30 -0
  64. package/dist/lib/daemon/session-registry.js +42 -0
  65. package/dist/lib/doctor/checks/anywhere.d.ts +38 -0
  66. package/dist/lib/doctor/checks/anywhere.js +182 -0
  67. package/dist/lib/doctor/registry.js +6 -0
  68. package/dist/lib/first-sync-next-step.d.ts +10 -1
  69. package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
  70. package/dist/lib/flag-registry-worker-source.generated.js +1 -1
  71. package/dist/lib/install/claude-targets.d.ts +47 -0
  72. package/dist/lib/install/claude-targets.js +203 -0
  73. package/dist/lib/install/codex-targets.d.ts +57 -0
  74. package/dist/lib/install/codex-targets.js +187 -0
  75. package/dist/lib/mesh/live/session-seq.js +62 -9
  76. package/dist/lib/registry/normalize-remote.d.ts +21 -0
  77. package/dist/lib/registry/normalize-remote.js +68 -0
  78. package/dist/lib/registry/registry.d.ts +75 -0
  79. package/dist/lib/registry/registry.js +261 -0
  80. package/dist/main.js +3 -1
  81. package/dist/utils/cli-telemetry.d.ts +11 -0
  82. package/dist/utils/cli-telemetry.js +76 -0
  83. package/dist/utils/cognito-session.d.ts +5 -1
  84. package/dist/utils/cognito-session.js +8 -12
  85. package/dist/utils/feedback-diagnostics.d.ts +2 -0
  86. package/dist/utils/run-bundled-script.d.ts +7 -4
  87. package/dist/utils/run-bundled-script.js +47 -12
  88. package/dist/utils/version-check.d.ts +2 -0
  89. package/dist/utils/version-check.js +7 -0
  90. package/package.json +2 -2
@@ -8,10 +8,11 @@
8
8
  *
9
9
  * Deliberate choices:
10
10
  *
11
- * - `stdio: "inherit"`. Not piped. Piping would buffer output that callers
12
- * stream, reorder stdout against stderr, and require re-emitting bytes we
13
- * have no reason to touch. Inheriting also means a script that reads stdin
14
- * (the hook payload pattern) gets the real fd, unbuffered and unconsumed.
11
+ * - stdio inherits by default. Captured runs pipe only stdout/stderr, and
12
+ * inherit stdin unless the caller supplies an explicit payload. Piping
13
+ * output would buffer streams, reorder stdout against stderr, and require
14
+ * re-emitting bytes, so capture remains an explicit opt-in for native
15
+ * parity fallbacks that need the shell's exact output bytes.
15
16
  *
16
17
  * - an explicit interpreter (`bash` or `node`) rather than executing the file
17
18
  * directly. The executable bit does survive `npm publish` for files that
@@ -30,6 +31,7 @@
30
31
  */
31
32
  import { spawnSync } from "child_process";
32
33
  import * as fs from "node:fs";
34
+ import * as os from "node:os";
33
35
  import * as path from "path";
34
36
  import { resolveBundledAsset } from "./hq-roots.js";
35
37
  /**
@@ -152,12 +154,41 @@ export function runBundledScript(opts) {
152
154
  if (windowsBash && !windowsBash.executable) {
153
155
  throw bashNotFoundError(opts.asset, windowsBash.cause);
154
156
  }
155
- const result = spawnSync(executable, [script, ...(opts.args ?? [])], {
156
- cwd: opts.cwd,
157
- env,
158
- stdio: opts.captureOutput ? ["inherit", "pipe", "pipe"] : "inherit",
159
- ...(opts.captureOutput ? { maxBuffer: Number.MAX_SAFE_INTEGER } : {}),
160
- });
157
+ let inputDirectory;
158
+ let inputDescriptor;
159
+ let result;
160
+ try {
161
+ if (opts.stdin !== undefined) {
162
+ // Some scaffold scripts reopen /dev/stdin by pathname. Node's spawnSync
163
+ // input pipe cannot be reopened through /dev/stdin on Linux, so capture
164
+ // mode supplies a private regular file descriptor to preserve that ABI.
165
+ const sharedMemory = process.platform === "linux" && fs.existsSync("/dev/shm")
166
+ ? "/dev/shm"
167
+ : os.tmpdir();
168
+ inputDirectory = fs.mkdtempSync(path.join(sharedMemory, "hq-bundled-stdin-"));
169
+ const inputPath = path.join(inputDirectory, "stdin");
170
+ fs.writeFileSync(inputPath, opts.stdin, { mode: 0o600 });
171
+ inputDescriptor = fs.openSync(inputPath, "r");
172
+ }
173
+ const stdinStdio = inputDescriptor ?? "inherit";
174
+ const stdio = opts.captureOutput
175
+ ? [stdinStdio, "pipe", "pipe"]
176
+ : inputDescriptor !== undefined
177
+ ? [stdinStdio, "inherit", "inherit"]
178
+ : "inherit";
179
+ result = spawnSync(executable, [script, ...(opts.args ?? [])], {
180
+ cwd: opts.cwd,
181
+ env,
182
+ stdio,
183
+ ...(opts.captureOutput ? { maxBuffer: Number.MAX_SAFE_INTEGER } : {}),
184
+ });
185
+ }
186
+ finally {
187
+ if (inputDescriptor !== undefined)
188
+ fs.closeSync(inputDescriptor);
189
+ if (inputDirectory)
190
+ fs.rmSync(inputDirectory, { recursive: true, force: true });
191
+ }
161
192
  if (result.error) {
162
193
  const spawnError = result.error;
163
194
  if (process.platform === "win32" &&
@@ -185,8 +216,12 @@ export function runBundledScript(opts) {
185
216
  return {
186
217
  code,
187
218
  ...(opts.captureOutput ? {
188
- stdout: result.stdout ?? Buffer.alloc(0),
189
- stderr: result.stderr ?? Buffer.alloc(0),
219
+ stdout: Buffer.isBuffer(result.stdout)
220
+ ? result.stdout
221
+ : Buffer.from(result.stdout ?? ""),
222
+ stderr: Buffer.isBuffer(result.stderr)
223
+ ? result.stderr
224
+ : Buffer.from(result.stderr ?? ""),
190
225
  } : {}),
191
226
  };
192
227
  }
@@ -1,5 +1,7 @@
1
1
  export declare const CLI_VERSION_NUDGE_FLAG = "cli.version-update-nudge";
2
2
  declare function isKnownNoninteractiveStatusProbe(argv?: readonly string[]): boolean;
3
+ /** Return the fresh npm `latest` already cached by the startup update check. */
4
+ export declare function cachedLatestVersion(now?: number): string | null;
3
5
  /**
4
6
  * The cached npm `latest` when it is newer than the running version, else null.
5
7
  *
@@ -111,6 +111,13 @@ function acquireRefreshLock(now = Date.now()) {
111
111
  return null;
112
112
  }
113
113
  }
114
+ /** Return the fresh npm `latest` already cached by the startup update check. */
115
+ export function cachedLatestVersion(now = Date.now()) {
116
+ const entry = readCache();
117
+ if (!entry || now - entry.fetchedAt > CACHE_TTL_MS)
118
+ return null;
119
+ return semver.valid(entry.latest) ? entry.latest : null;
120
+ }
114
121
  /**
115
122
  * The cached npm `latest` when it is newer than the running version, else null.
116
123
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigoai-us/hq-cli",
3
- "version": "5.322.0",
3
+ "version": "5.324.0",
4
4
  "description": "HQ by Indigo management CLI — modules and cloud sync",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -44,7 +44,7 @@
44
44
  "dependencies": {
45
45
  "@aws-sdk/client-iot-data-plane": "^3.1096.0",
46
46
  "@aws-sdk/client-s3": "^3.1049.0",
47
- "@indigoai-us/hq-cloud": "~6.18.17",
47
+ "@indigoai-us/hq-cloud": "~6.18.33",
48
48
  "@indigoai-us/hq-flags-client": "^0.1.2",
49
49
  "@sentry/node": "^10.49.0",
50
50
  "@tobilu/qmd": "2.5.3",