@indigoai-us/hq-cli 5.345.160 → 5.345.162

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 (73) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/assets/scaffold/core/scripts/session-journal.sh +116 -24
  3. package/dist/command-catalog.generated.d.ts +262 -5
  4. package/dist/command-catalog.generated.js +322 -5
  5. package/dist/command-registration-plan.d.ts +6 -0
  6. package/dist/command-registration-plan.js +1 -0
  7. package/dist/commands/agent-inbox.js +6 -2
  8. package/dist/commands/auth.js +6 -5
  9. package/dist/commands/core-session-helper-runtime.d.ts +1 -0
  10. package/dist/commands/core-session-journal-native.d.ts +1 -0
  11. package/dist/commands/core-session-journal-native.js +158 -34
  12. package/dist/commands/feedback.d.ts +12 -0
  13. package/dist/commands/feedback.js +52 -0
  14. package/dist/commands/files-browse.d.ts +8 -0
  15. package/dist/commands/files-browse.js +83 -1
  16. package/dist/commands/install-global.d.ts +2 -0
  17. package/dist/commands/install-global.js +24 -1
  18. package/dist/commands/integrations-connect.js +1 -0
  19. package/dist/commands/integrations-manage.d.ts +2 -0
  20. package/dist/commands/integrations-manage.js +6 -4
  21. package/dist/commands/lanes-link.js +5 -3
  22. package/dist/commands/lanes-loop.js +7 -7
  23. package/dist/commands/lanes-questions.js +54 -4
  24. package/dist/commands/lanes-session-start.d.ts +12 -0
  25. package/dist/commands/lanes-session-start.js +93 -12
  26. package/dist/commands/lanes.js +2 -1
  27. package/dist/commands/meetings.d.ts +11 -0
  28. package/dist/commands/meetings.js +41 -11
  29. package/dist/commands/sync-held.d.ts +87 -0
  30. package/dist/commands/sync-held.js +191 -0
  31. package/dist/hq-cloud-sync-runner/bin/sync-runner.js +3830 -2812
  32. package/dist/hq-cloud-sync-runner/package.json +1 -1
  33. package/dist/index.js +21 -0
  34. package/dist/lanes-session-start-argv.d.ts +7 -0
  35. package/dist/lanes-session-start-argv.js +9 -0
  36. package/dist/lib/agent-kit/inbox-state.d.ts +5 -4
  37. package/dist/lib/agent-kit/inbox-state.js +24 -3
  38. package/dist/lib/bot/log.d.ts +3 -2
  39. package/dist/lib/bot/progress.d.ts +23 -1
  40. package/dist/lib/bot/progress.js +43 -5
  41. package/dist/lib/bot/run.js +2 -0
  42. package/dist/lib/bot/runtime/claude.d.ts +12 -0
  43. package/dist/lib/bot/runtime/claude.js +20 -0
  44. package/dist/lib/bot/runtime/index.d.ts +10 -1
  45. package/dist/lib/bot/runtime/index.js +14 -2
  46. package/dist/lib/bot/runtime/types.d.ts +8 -0
  47. package/dist/lib/doctor/checks/ps1-shims.d.ts +21 -0
  48. package/dist/lib/doctor/checks/ps1-shims.js +82 -0
  49. package/dist/lib/doctor/fix/apply.d.ts +13 -1
  50. package/dist/lib/doctor/fix/apply.js +38 -3
  51. package/dist/lib/doctor/fix/remediation.d.ts +9 -1
  52. package/dist/lib/doctor/fix/remediation.js +22 -0
  53. package/dist/lib/doctor/registry.js +2 -0
  54. package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
  55. package/dist/lib/flag-registry-worker-source.generated.js +1 -1
  56. package/dist/lib/lanes/links.d.ts +2 -1
  57. package/dist/lib/lanes/links.js +235 -17
  58. package/dist/lib/lanes/loop.d.ts +17 -0
  59. package/dist/lib/lanes/loop.js +235 -5
  60. package/dist/lib/lanes/questions.d.ts +1 -0
  61. package/dist/lib/lanes/registry-flag.d.ts +24 -0
  62. package/dist/lib/lanes/registry-flag.js +72 -6
  63. package/dist/lib/lanes/store.d.ts +4 -2
  64. package/dist/lib/lanes/store.js +8 -8
  65. package/dist/lib/windows/ps1-shims.d.ts +60 -0
  66. package/dist/lib/windows/ps1-shims.js +152 -0
  67. package/dist/utils/self-update.d.ts +2 -0
  68. package/dist/utils/self-update.js +8 -0
  69. package/dist/utils/staged-npm-install.js +13 -2
  70. package/dist/utils/token-keychain.d.ts +11 -8
  71. package/dist/utils/token-keychain.js +36 -15
  72. package/package.json +8 -8
  73. package/scripts/install-hook-engine.mjs +12 -0
@@ -17,7 +17,10 @@
17
17
  * execute bit, add a hook id to the gate profiles it is missing from,
18
18
  * re-register a script present on disk, or pull a company or personal
19
19
  * vault whose local tree exists but whose journal is stale — and NEVER
20
- * rewrites a hook body or deletes a file. Classification is owned by
20
+ * rewrites a hook body or deletes a file, with one scoped exception: on
21
+ * Windows, `remove-ps1-shims` deletes npm-generated hq-cli `.ps1`
22
+ * launchers (and only files whose content is that shim) from the npm
23
+ * prefix, outside the HQ tree. Classification is owned by
21
24
  * {@link deriveRemediation};
22
25
  * a content-drift finding is manual-only and simply never appears in the
23
26
  * fixable set.
@@ -44,6 +47,7 @@ import { parseHookGateProfiles, requiredMissingProfiles, } from "../hook-gate-pr
44
47
  import { createBackup } from "./backup.js";
45
48
  import { removeStrayGateEntries } from "../stray-gate-entries.js";
46
49
  import { deriveRemediation } from "./remediation.js";
50
+ import { HQ_CLI_BINS, removeHqCliPs1Shims } from "../../windows/ps1-shims.js";
47
51
  import { botDir } from "../../bot/paths.js";
48
52
  import { readBotConfig } from "../../bot/config.js";
49
53
  import { buildBotDaemonPaths, installedDaemonHqBinary, repairBotDaemonIfStale, rewriteBotDaemonNodePath, } from "../../bot/daemon.js";
@@ -197,6 +201,7 @@ export async function applyFixes(options) {
197
201
  };
198
202
  const rewriteBotNodePath = options.rewriteBotNodePath ?? defaultRewriteBotNodePath;
199
203
  const repairBotHqBinary = options.repairBotHqBinary ?? defaultRepairBotHqBinary;
204
+ const removePs1Shims = options.removePs1Shims ?? defaultRemovePs1Shims;
200
205
  // 2. Collect findings, then plan each newly unlocked allowlisted repair.
201
206
  // Identity is deliberately the check id + target pair: an unsuccessful
202
207
  // repair must not be applied repeatedly in one invocation.
@@ -238,7 +243,7 @@ export async function applyFixes(options) {
238
243
  const rem = deriveRemediation(result);
239
244
  if (!rem?.autoFixable)
240
245
  continue;
241
- const plan = planFix(hqRoot, result, rem, refreshSync, rewriteBotNodePath, repairBotHqBinary, refreshManifest);
246
+ const plan = planFix(hqRoot, result, rem, refreshSync, rewriteBotNodePath, repairBotHqBinary, refreshManifest, removePs1Shims);
242
247
  if (!plan)
243
248
  continue;
244
249
  const key = JSON.stringify([plan.checkId, plan.target]);
@@ -683,8 +688,10 @@ export function uncommittedHookConfigChanges(hqRoot) {
683
688
  }
684
689
  // --- Fix planning --------------------------------------------------------------
685
690
  /** Build the concrete plan for one auto-fixable finding, or null if unplannable. */
686
- function planFix(hqRoot, result, rem, refreshSync, rewriteBotNodePath = defaultRewriteBotNodePath, repairBotHqBinary = defaultRepairBotHqBinary, refreshManifest = defaultRefreshManifest) {
691
+ function planFix(hqRoot, result, rem, refreshSync, rewriteBotNodePath = defaultRewriteBotNodePath, repairBotHqBinary = defaultRepairBotHqBinary, refreshManifest = defaultRefreshManifest, removePs1Shims = defaultRemovePs1Shims) {
687
692
  switch (rem.fixClass) {
693
+ case "remove-ps1-shims":
694
+ return planRemovePs1Shims(result, rem, removePs1Shims);
688
695
  case "bot-node-path":
689
696
  return planBotNodePath(result, rem, rewriteBotNodePath);
690
697
  case "bot-hq-binary":
@@ -753,6 +760,34 @@ function planBotHqBinary(result, rem, repair) {
753
760
  postStatus: (results) => results.find((entry) => entry.checkId === result.checkId)?.status ?? null,
754
761
  };
755
762
  }
763
+ /** Remove npm's hq-cli `.ps1` launchers so PowerShell falls back to `hq.cmd`. */
764
+ function planRemovePs1Shims(result, rem, remove) {
765
+ const dir = rem.fixTarget;
766
+ if (!dir)
767
+ return null;
768
+ let failure;
769
+ return {
770
+ checkId: result.checkId,
771
+ fixClass: "remove-ps1-shims",
772
+ target: dir,
773
+ relpath: "",
774
+ preview: Object.keys(HQ_CLI_BINS).map((bin) => ` - ${path.win32.join(dir, `${bin}.ps1`)}`).join("\n") +
775
+ "\n only npm's hq-cli launchers are removed; hq.cmd stays and the execution policy is not changed",
776
+ summary: "remove hq .ps1 launchers",
777
+ apply: () => {
778
+ const outcome = remove(dir);
779
+ failure = outcome.failed.length > 0 ? outcome.failed.map((entry) => entry.reason).join("; ") : undefined;
780
+ },
781
+ postStatus: (results) => results.find((entry) => entry.checkId === result.checkId)?.status ?? null,
782
+ failureReason: () => failure,
783
+ };
784
+ }
785
+ /** Default `remove-ps1-shims` repair: Windows only, a no-op elsewhere. */
786
+ export function defaultRemovePs1Shims(dir) {
787
+ if (process.platform !== "win32")
788
+ return { removed: [], kept: [], failed: [] };
789
+ return removeHqCliPs1Shims(dir);
790
+ }
756
791
  /** Real launchctl for the `bot-hq-binary` reload; a failure is a non-ok result. */
757
792
  const doctorLaunchctl = (args) => {
758
793
  const r = spawnSync("launchctl", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
@@ -35,6 +35,14 @@
35
35
  * and hashes); it never writes the HQ tree. A company
36
36
  * scope whose slug did not resolve locally stays
37
37
  * manual-only.
38
+ * - `remove-ps1-shims` — Windows only: delete the npm-generated `hq.ps1` /
39
+ * `hq-auth-refresh.ps1` launchers from the npm prefix
40
+ * when the PowerShell execution policy blocks them.
41
+ * `hq.cmd` stays and PowerShell falls back to it. The
42
+ * removal only touches files whose content is npm's
43
+ * hq-cli shim (see `lib/windows/ps1-shims.ts`); the
44
+ * execution policy is never changed. This is the one
45
+ * scoped exception to the no-delete rule below.
38
46
  *
39
47
  * EVERYTHING else — content drift between platform copies, a missing script, a
40
48
  * missing Codex counterpart, an unquoted `$CLAUDE_PROJECT_DIR`, a stale
@@ -46,7 +54,7 @@
46
54
  */
47
55
  import type { CheckResult } from "../types.js";
48
56
  /** The allowlisted safe repair classes `--fix` is permitted to apply. */
49
- export type FixClass = "executable-bit" | "gate-profile" | "remove-stray-gate-entries" | "refresh-sync" | "refresh-manifest" | "bot-node-path" | "bot-hq-binary";
57
+ export type FixClass = "executable-bit" | "gate-profile" | "remove-stray-gate-entries" | "refresh-sync" | "refresh-manifest" | "bot-node-path" | "bot-hq-binary" | "remove-ps1-shims";
50
58
  /**
51
59
  * A finding's structured remediation. `autoFixable`, `action`, and `command`
52
60
  * are the `--json` surface (AC1); `fixTarget`/`fixClass` are the internal handle
@@ -35,6 +35,14 @@
35
35
  * and hashes); it never writes the HQ tree. A company
36
36
  * scope whose slug did not resolve locally stays
37
37
  * manual-only.
38
+ * - `remove-ps1-shims` — Windows only: delete the npm-generated `hq.ps1` /
39
+ * `hq-auth-refresh.ps1` launchers from the npm prefix
40
+ * when the PowerShell execution policy blocks them.
41
+ * `hq.cmd` stays and PowerShell falls back to it. The
42
+ * removal only touches files whose content is npm's
43
+ * hq-cli shim (see `lib/windows/ps1-shims.ts`); the
44
+ * execution policy is never changed. This is the one
45
+ * scoped exception to the no-delete rule below.
38
46
  *
39
47
  * EVERYTHING else — content drift between platform copies, a missing script, a
40
48
  * missing Codex counterpart, an unquoted `$CLAUDE_PROJECT_DIR`, a stale
@@ -44,6 +52,7 @@
44
52
  * content-drift finding is manual-only, because that boundary is load-bearing:
45
53
  * deciding which of two diverged copies is correct needs human judgement.
46
54
  */
55
+ import * as path from "node:path";
47
56
  import { isCompanyJournalSlug, isSafeCompanySlug, isPersonalJournalSlug, journalSlugFromCheckId, } from "../checks/sync-health.js";
48
57
  /** Matches an exec-bit remediation command, quoted or not: `chmod +x <path>`. */
49
58
  const CHMOD_EXEC = /^chmod\s+\+x\s+(.+)$/;
@@ -143,6 +152,19 @@ export function deriveRemediation(result) {
143
152
  command: remediation ?? `hq bot daemon install ${name}`,
144
153
  };
145
154
  }
155
+ // remove-ps1-shims — PowerShell resolves `hq` to npm's hq.ps1 and the
156
+ // execution policy blocks it (feedback_29d91817). The target is the shim;
157
+ // the fix acts on its directory, the npm prefix.
158
+ if (checkId === "cli-ps1-shim.blocked-by-policy" && result.status === "WARN" && target) {
159
+ const dir = path.win32.dirname(target);
160
+ return {
161
+ autoFixable: true,
162
+ fixClass: "remove-ps1-shims",
163
+ fixTarget: dir,
164
+ action: `Remove the npm-generated hq .ps1 launchers from ${dir} so PowerShell runs hq.cmd (the execution policy is not changed).`,
165
+ command: "hq.cmd install --global",
166
+ };
167
+ }
146
168
  // Available hq-core upgrade. WARN is intentional in `hq doctor` and is
147
169
  // not a broken sync; --fix has no mechanical repair for it.
148
170
  if (checkId === "sync.update.core") {
@@ -29,6 +29,7 @@ import { scaffoldCliFloorFamily } from "./checks/scaffold-cli-floor.js";
29
29
  import { strandedLanesFamily } from "./checks/stranded-lanes.js";
30
30
  import { releaseLinksFamily } from "./checks/release-links.js";
31
31
  import { cliPathFamily } from "./checks/cli-path.js";
32
+ import { ps1ShimsFamily } from "./checks/ps1-shims.js";
32
33
  import { tempHomesFamily } from "./checks/temp-homes.js";
33
34
  import { fixtureCoverageFamily } from "./fixtures/discover.js";
34
35
  import { checkClaudeWiring } from "./checks/claude-wiring.js";
@@ -280,6 +281,7 @@ export function createDefaultRegistry() {
280
281
  // Windows: the npm hq.cmd shim folder must be on PATH for a new terminal to
281
282
  // find hq. Registry read only; prints the fix, never edits PATH.
282
283
  registry.register(cliPathFamily);
284
+ registry.register(ps1ShimsFamily);
283
285
  // Idle tmp.* throwaway homes holding a Rust toolchain download. Dry-run
284
286
  // scan only; `hq doctor --sweep-temp-homes` is the delete path.
285
287
  registry.register(tempHomesFamily);