@indigoai-us/hq-cli 5.292.0 → 5.294.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 (75) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/assets/scaffold/core/scripts/outpost-jobs-reconcile.sh +5 -1
  3. package/dist/command-catalog.generated.d.ts +45 -24
  4. package/dist/command-catalog.generated.js +57 -30
  5. package/dist/commands/core-command-catalog.js +3 -2
  6. package/dist/commands/core-delegate-w1b.d.ts +2 -0
  7. package/dist/commands/core-delegate-w1b.js +28 -2
  8. package/dist/commands/core-delegate.d.ts +3 -1
  9. package/dist/commands/core-delegate.js +35 -5
  10. package/dist/commands/core-handoff-fast.d.ts +18 -0
  11. package/dist/commands/core-handoff-fast.js +103 -0
  12. package/dist/commands/core-handoff-open-steps.d.ts +21 -0
  13. package/dist/commands/core-handoff-open-steps.js +264 -0
  14. package/dist/commands/core-handoff.d.ts +4 -2
  15. package/dist/commands/core-handoff.js +22 -249
  16. package/dist/commands/core-jobs-native.d.ts +2 -0
  17. package/dist/commands/core-jobs-native.js +22 -11
  18. package/dist/commands/core-knowledge-prefs.d.ts +2 -0
  19. package/dist/commands/core-knowledge-prefs.js +13 -1
  20. package/dist/commands/core-ontology-native.d.ts +2 -0
  21. package/dist/commands/core-ontology-native.js +22 -2
  22. package/dist/commands/core-policy.d.ts +2 -0
  23. package/dist/commands/core-policy.js +18 -1
  24. package/dist/commands/core.js +2 -1
  25. package/dist/commands/daemon.d.ts +2 -1
  26. package/dist/commands/daemon.js +22 -7
  27. package/dist/commands/lanes-autopilot.d.ts +11 -0
  28. package/dist/commands/lanes-autopilot.js +336 -0
  29. package/dist/commands/lanes-move.js +54 -1
  30. package/dist/commands/lanes-questions.js +12 -5
  31. package/dist/commands/lanes-shared.d.ts +17 -0
  32. package/dist/commands/lanes-stories.d.ts +14 -0
  33. package/dist/commands/lanes-stories.js +308 -0
  34. package/dist/commands/lanes.d.ts +2 -0
  35. package/dist/commands/lanes.js +158 -314
  36. package/dist/fast-core.js +53 -25
  37. package/dist/fast-scaffold.d.ts +15 -2
  38. package/dist/fast-scaffold.js +167 -7
  39. package/dist/lib/core-utils/sentry-report.js +2 -2
  40. package/dist/lib/core-utils/worktree-resume.d.ts +2 -0
  41. package/dist/lib/core-utils/worktree-resume.js +16 -0
  42. package/dist/lib/daemon/migrate.d.ts +8 -1
  43. package/dist/lib/daemon/migrate.js +19 -7
  44. package/dist/lib/daemon/run.d.ts +11 -0
  45. package/dist/lib/daemon/run.js +17 -1
  46. package/dist/lib/lanes/autopilot-metrics.d.ts +99 -0
  47. package/dist/lib/lanes/autopilot-metrics.js +301 -0
  48. package/dist/lib/lanes/autopilot.d.ts +13 -1
  49. package/dist/lib/lanes/autopilot.js +271 -28
  50. package/dist/lib/lanes/grants.d.ts +1 -1
  51. package/dist/lib/lanes/grants.js +7 -5
  52. package/dist/lib/lanes/index.d.ts +1 -1
  53. package/dist/lib/lanes/keep-alive.d.ts +5 -0
  54. package/dist/lib/lanes/keep-alive.js +9 -4
  55. package/dist/lib/lanes/questions.d.ts +2 -1
  56. package/dist/lib/lanes/questions.js +2 -0
  57. package/dist/lib/lanes/reconcile.js +186 -9
  58. package/dist/lib/lanes/spawn.js +4 -0
  59. package/dist/lib/lanes/store.d.ts +2 -0
  60. package/dist/lib/lanes/store.js +53 -4
  61. package/dist/lib/lanes/types.d.ts +13 -1
  62. package/dist/lib/lanes/types.js +2 -2
  63. package/dist/lib/lanes/watcher.js +3 -1
  64. package/dist/native-fast-route.d.ts +3 -1
  65. package/dist/native-fast-route.js +10 -8
  66. package/dist/utils/contribution-table.d.ts +1 -1
  67. package/dist/utils/fast-stream-errors.d.ts +12 -0
  68. package/dist/utils/fast-stream-errors.js +18 -0
  69. package/dist/utils/scaffold-fast-import-guard.d.ts +2 -2
  70. package/dist/utils/scaffold-fast-import-guard.js +6 -3
  71. package/dist/utils/self-update.d.ts +7 -0
  72. package/dist/utils/self-update.js +5 -1
  73. package/dist/utils/version-gate.d.ts +15 -0
  74. package/dist/utils/version-gate.js +46 -2
  75. package/package.json +1 -1
@@ -63,7 +63,7 @@ import * as path from "node:path";
63
63
  import semver from "semver";
64
64
  import chalk from "chalk";
65
65
  import { CLI_NAME, CLI_VERSION } from "../cli-version.js";
66
- import { buildBunInstallArgv, buildPnpmInstallArgv, buildPrefixedInstallArgv, buildSpawnPlan, checkUpdateConvergence, derivePnpmHome, isBunManagedPackageDir, isLocalDependencyInstall, isPnpmManagedPackageDir, isPrefixWritable, nonWritablePrefixNote, openInstallOutput, pnpmUpdateEnv, resolveRunningInstall, runUpdateCommand, runSupervisedUpdateCommand, } from "./version-gate.js";
66
+ import { buildBunInstallArgv, buildPnpmInstallArgv, buildPrefixedInstallArgv, buildSpawnPlan, checkUpdateConvergence, derivePnpmHome, detachUpdateSupervisor, isBunManagedPackageDir, isLocalDependencyInstall, isPnpmManagedPackageDir, isPrefixWritable, nonWritablePrefixNote, openInstallOutput, pnpmUpdateEnv, resolveRunningInstall, runUpdateCommand, runSupervisedUpdateCommand, } from "./version-gate.js";
67
67
  import { canStageInstall, stagedNpmInstall } from "./staged-install.js";
68
68
  import { acquireUpdateLock as acquireSharedUpdateLock } from "./update-lock.js";
69
69
  import { markLatestIneffective } from "./version-check.js";
@@ -420,6 +420,9 @@ async function updateAndReexec(argv, flavor, known, deps) {
420
420
  if (!releaseLock)
421
421
  return { action: "skipped", latest };
422
422
  const renamePath = deps.renamePath ?? fs.renameSync;
423
+ // The in-place update moves the package aside, and the installer's
424
+ // supervisor ships inside it, so run the installer through a copy.
425
+ const supervisor = staged ? null : (deps.detachSupervisor ?? detachUpdateSupervisor)();
423
426
  // The staged install keeps the running package in place until the swap and
424
427
  // restores it itself, so it takes no snapshot.
425
428
  const installSnapshot = staged ? null : snapshotInstall(install, renamePath);
@@ -467,6 +470,7 @@ async function updateAndReexec(argv, flavor, known, deps) {
467
470
  throw error;
468
471
  }
469
472
  finally {
473
+ supervisor?.dispose();
470
474
  releaseLock();
471
475
  }
472
476
  if (!result.ok) {
@@ -284,6 +284,21 @@ export { buildSpawnPlan, quoteForWindowsShell };
284
284
  */
285
285
  export declare function inOwnProcessGroup<T extends object>(options: T): T;
286
286
  declare function updateTimeoutMs(env?: NodeJS.ProcessEnv): number;
287
+ /** The supervisor script the next install runs under. */
288
+ export declare function updateSupervisorPath(): string;
289
+ export interface DetachedUpdateSupervisor {
290
+ path: string;
291
+ dispose(): void;
292
+ }
293
+ /**
294
+ * Copies the supervisor to a temp dir and runs installs through the copy until
295
+ * disposed. The in-place self-update moves the whole hq-cli package aside
296
+ * before it starts the installer, and the supervisor ships inside that package
297
+ * (5.290.0-5.292.0 failed every npm global self-update with MODULE_NOT_FOUND).
298
+ * The script needs only Node builtins, so the copy runs on its own. Returns
299
+ * null when the copy cannot be made; the caller then keeps the bundled path.
300
+ */
301
+ export declare function detachUpdateSupervisor(): DetachedUpdateSupervisor | null;
287
302
  /**
288
303
  * Where an install's output goes — the other half of surviving a killed parent.
289
304
  *
@@ -30,7 +30,7 @@
30
30
  import { spawnSync } from "node:child_process";
31
31
  import { installPathCompatibilityEnabled } from "../lib/install-path-compatibility-flag.js";
32
32
  import { buildSpawnPlan, quoteForWindowsShell } from "./windows-spawn.js";
33
- import { accessSync, closeSync, constants as fsConstants, existsSync, mkdtempSync, openSync, readdirSync, realpathSync, readFileSync, rmSync, } from "node:fs";
33
+ import { accessSync, closeSync, constants as fsConstants, copyFileSync, existsSync, mkdtempSync, openSync, readdirSync, realpathSync, readFileSync, rmSync, } from "node:fs";
34
34
  import os from "node:os";
35
35
  import path from "node:path";
36
36
  import { fileURLToPath } from "node:url";
@@ -674,6 +674,50 @@ function updateTimeoutMs(env = process.env) {
674
674
  * compiled module for production and is directly runnable from source tests.
675
675
  */
676
676
  const UPDATE_COMMAND_SUPERVISOR = fileURLToPath(new URL("./update-command-supervisor.cjs", import.meta.url));
677
+ /** Set while a self-update runs the installer through a copy of the supervisor. */
678
+ let detachedSupervisor = null;
679
+ /** The supervisor script the next install runs under. */
680
+ export function updateSupervisorPath() {
681
+ return detachedSupervisor ?? UPDATE_COMMAND_SUPERVISOR;
682
+ }
683
+ /**
684
+ * Copies the supervisor to a temp dir and runs installs through the copy until
685
+ * disposed. The in-place self-update moves the whole hq-cli package aside
686
+ * before it starts the installer, and the supervisor ships inside that package
687
+ * (5.290.0-5.292.0 failed every npm global self-update with MODULE_NOT_FOUND).
688
+ * The script needs only Node builtins, so the copy runs on its own. Returns
689
+ * null when the copy cannot be made; the caller then keeps the bundled path.
690
+ */
691
+ export function detachUpdateSupervisor() {
692
+ if (detachedSupervisor)
693
+ return null;
694
+ let dir;
695
+ try {
696
+ dir = mkdtempSync(path.join(os.tmpdir(), "hq-cli-update-supervisor-"));
697
+ const copy = path.join(dir, "update-command-supervisor.cjs");
698
+ copyFileSync(UPDATE_COMMAND_SUPERVISOR, copy);
699
+ detachedSupervisor = copy;
700
+ const tempDir = dir;
701
+ return {
702
+ path: copy,
703
+ dispose: () => {
704
+ if (detachedSupervisor === copy)
705
+ detachedSupervisor = null;
706
+ try {
707
+ rmSync(tempDir, { recursive: true, force: true });
708
+ }
709
+ catch {
710
+ // Best-effort cleanup of a temp dir.
711
+ }
712
+ },
713
+ };
714
+ }
715
+ catch {
716
+ if (dir)
717
+ rmSync(dir, { recursive: true, force: true });
718
+ return null;
719
+ }
720
+ }
677
721
  function readSupervisorSpawnError(errorMarker) {
678
722
  try {
679
723
  const value = JSON.parse(readFileSync(errorMarker, "utf-8"));
@@ -754,7 +798,7 @@ export function runSupervisedUpdateCommand(cmd, args, output, env) {
754
798
  // waits briefly, sends KILL to survivors, and waits for its direct child so
755
799
  // the completed result leaves no zombie behind.
756
800
  const result = spawnSync(process.execPath, [
757
- UPDATE_COMMAND_SUPERVISOR,
801
+ updateSupervisorPath(),
758
802
  JSON.stringify({
759
803
  cmd: plan.cmd,
760
804
  args: plan.args,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigoai-us/hq-cli",
3
- "version": "5.292.0",
3
+ "version": "5.294.0",
4
4
  "description": "HQ by Indigo management CLI — modules and cloud sync",
5
5
  "main": "dist/index.js",
6
6
  "bin": {