@indigoai-us/hq-cli 5.121.0 → 5.121.1

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 CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [5.121.1] — 2026-09-18
6
+
7
+ ### Fixed
8
+
9
+ - `hq --version` prints only the CLI version again. The labelled HQ vs CLI vs
10
+ latest hq-core report stays on `hq version` (and `--json`). Older updaters
11
+ compare the whole `--version` output to the CLI they just installed; reading
12
+ the HQ line made every successful update look like a second install was
13
+ shadowing it.
14
+
5
15
  ### Documentation
6
16
 
7
17
  - The 2026-09-18 fleet-bots GA notes group the published CLI changes for plan
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * hq version — labelled HQ vs CLI vs latest hq-core.
3
3
  *
4
- * `hq --version` is intercepted on the fast path in index.ts and prints the
5
- * same report. This registrar exists so `hq --help` lists the command and so
6
- * `hq version --json` still works if the fast path is skipped.
4
+ * Bare `hq --version` is intercepted on the fast path in index.ts and prints
5
+ * only the CLI semver. This registrar exists so `hq --help` lists the command
6
+ * and so `hq version` / `hq version --json` still work if the fast path is skipped.
7
7
  */
8
8
  import { Command } from "commander";
9
9
  export declare function registerVersionCommand(program: Command): void;
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // Node 20+ API (e.g. util.styleText) or a newer native ABI is evaluated.
4
4
  import "./node-preflight.js";
5
5
  import "./node-network-compat.js";
6
- import { isVersionRequest } from "./version-request.js";
6
+ import { isVersionRequest, wantsLabelledVersionReport } from "./version-request.js";
7
7
  // Dependency-light: a pure parser + table, no command graph. Safe to load on
8
8
  // every path (including --version) without reintroducing the heavy startup.
9
9
  import { isFastCoreRequest } from "./commands/scaffold-fast.js";
@@ -18,9 +18,17 @@ import { installProcessRejectionBoundary } from "./unhandled-rejection-boundary.
18
18
  // so runCli's finally still finalizes release health and flushes Sentry.
19
19
  installProcessRejectionBoundary();
20
20
  if (isVersionRequest(process.argv)) {
21
- // Same report as `hq version`: HQ, CLI, latest hq-core. Lazy so --version
22
- // still skips the command graph.
23
- void import("./utils/version-report.js").then(({ runVersionCommand }) => runVersionCommand(process.argv));
21
+ // Bare `--version` is the CLI semver only (the contract field updaters
22
+ // compare). `hq version` and `--json` print the labelled HQ/CLI report.
23
+ // Lazy so this path still skips the command graph.
24
+ if (wantsLabelledVersionReport(process.argv)) {
25
+ void import("./utils/version-report.js").then(({ runVersionCommand }) => runVersionCommand(process.argv));
26
+ }
27
+ else {
28
+ void import("./cli-version.js").then(({ CLI_VERSION }) => {
29
+ process.stdout.write(`${CLI_VERSION}\n`);
30
+ });
31
+ }
24
32
  }
25
33
  else if (isFastCoreRequest(process.argv)) {
26
34
  // Hot relocated plumbing (`hq core hq-session`, `hq core checkpoint-stop-gate`)
@@ -348,11 +348,16 @@ declare function nudgeUpdateRecommended(decision: VersionCheckResponse, install?
348
348
  */
349
349
  export declare function resolveHqOnPath(): string | null;
350
350
  /**
351
- * Pull the CLI version out of `hq --version` output.
351
+ * Pull the CLI version out of `hq --version` / `hq version` output.
352
352
  *
353
- * Older builds printed a bare semver. Current builds print a labelled report
354
- * (`HQ …` / `CLI 5.119.12` / …). Convergence must accept both, otherwise a
355
- * successful install looks like a PATH shadow.
353
+ * Compare CLI to CLI. Never take the first version-shaped token: 5.119.13–
354
+ * 5.121.0 printed `HQ <core>` above `CLI <cli>`, and scraping the HQ line
355
+ * made a successful install look like a PATH shadow.
356
+ *
357
+ * Accepts:
358
+ * - bare semver (historical `--version`, and `--version` again after this fix)
359
+ * - labelled `CLI x.y.z` (those 5.119.13–5.121.0 builds)
360
+ * - JSON `{ "cli": "x.y.z", ... }` from `--json`
356
361
  */
357
362
  export declare function parseReportedCliVersion(stdout: string): string | null;
358
363
  /** `<bin> --version` output (trimmed), or null on any failure/timeout. */
@@ -811,17 +811,33 @@ export function resolveHqOnPath() {
811
811
  }
812
812
  }
813
813
  /**
814
- * Pull the CLI version out of `hq --version` output.
814
+ * Pull the CLI version out of `hq --version` / `hq version` output.
815
815
  *
816
- * Older builds printed a bare semver. Current builds print a labelled report
817
- * (`HQ …` / `CLI 5.119.12` / …). Convergence must accept both, otherwise a
818
- * successful install looks like a PATH shadow.
816
+ * Compare CLI to CLI. Never take the first version-shaped token: 5.119.13–
817
+ * 5.121.0 printed `HQ <core>` above `CLI <cli>`, and scraping the HQ line
818
+ * made a successful install look like a PATH shadow.
819
+ *
820
+ * Accepts:
821
+ * - bare semver (historical `--version`, and `--version` again after this fix)
822
+ * - labelled `CLI x.y.z` (those 5.119.13–5.121.0 builds)
823
+ * - JSON `{ "cli": "x.y.z", ... }` from `--json`
819
824
  */
820
825
  export function parseReportedCliVersion(stdout) {
821
826
  const text = stdout.trim();
822
827
  if (!text)
823
828
  return null;
824
- const labelled = /^CLI\s+(\S+)/m.exec(text);
829
+ if (text.startsWith("{")) {
830
+ try {
831
+ const parsed = JSON.parse(text);
832
+ if (typeof parsed.cli === "string" && parsed.cli.trim()) {
833
+ return parsed.cli.trim();
834
+ }
835
+ }
836
+ catch {
837
+ // Fall through to labelled / bare parsers.
838
+ }
839
+ }
840
+ const labelled = /^[ \t]*CLI[ \t]+(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)/m.exec(text);
825
841
  if (labelled)
826
842
  return labelled[1];
827
843
  const lines = text
@@ -19,8 +19,7 @@ export declare function fetchLatestHqCoreRelease(fetchImpl?: typeof fetch, timeo
19
19
  export declare function collectVersionReport(deps?: VersionReportDeps): Promise<VersionReport>;
20
20
  export declare function formatVersionReport(report: VersionReport): string;
21
21
  export declare function versionReportJson(report: VersionReport): string;
22
- export { isVersionRequest } from "../version-request.js";
23
- export declare function wantsJson(argv: readonly string[]): boolean;
22
+ export { isVersionRequest, wantsJson } from "../version-request.js";
24
23
  export declare function runVersionCommand(argv?: readonly string[], deps?: VersionReportDeps, stdout?: {
25
24
  write(chunk: string): unknown;
26
25
  }): Promise<void>;
@@ -1,12 +1,16 @@
1
1
  /**
2
- * The payload behind `hq version` / labelled `hq --version`.
2
+ * The payload behind `hq version` and `hq --version --json`.
3
3
  *
4
4
  * Prints the installed HQ scaffold version, the CLI version (labelled so it
5
5
  * cannot be confused with HQ), and the latest hq-core GitHub release. A
6
6
  * network failure is an explicit line, never a silent omission.
7
+ *
8
+ * Bare `hq --version` / `-V` / `-v` do not use this report: they print the
9
+ * CLI semver alone so older updaters that compare whole stdout still work.
7
10
  */
8
11
  import semver from "semver";
9
12
  import { CLI_VERSION } from "../cli-version.js";
13
+ import { wantsJson } from "../version-request.js";
10
14
  import { findHqRoot } from "./manifest.js";
11
15
  import { readHqVersion } from "./pack-contributions.js";
12
16
  export const HQ_CORE_LATEST_URL = "https://api.github.com/repos/indigoai-us/hq-core/releases/latest";
@@ -86,10 +90,7 @@ export function versionReportJson(report) {
86
90
  latestLookup: report.latestLookup,
87
91
  }, null, 2)}\n`;
88
92
  }
89
- export { isVersionRequest } from "../version-request.js";
90
- export function wantsJson(argv) {
91
- return argv.includes("--json");
92
- }
93
+ export { isVersionRequest, wantsJson } from "../version-request.js";
93
94
  export async function runVersionCommand(argv = process.argv, deps = {}, stdout = process.stdout) {
94
95
  const report = await collectVersionReport(deps);
95
96
  stdout.write(wantsJson(argv) ? versionReportJson(report) : formatVersionReport(report));
@@ -4,4 +4,11 @@
4
4
  * yaml, semver, or the command graph.
5
5
  */
6
6
  export declare function isVersionRequest(argv: readonly string[]): boolean;
7
+ export declare function wantsJson(argv: readonly string[]): boolean;
8
+ /**
9
+ * The labelled HQ / CLI / latest-hq-core report (and JSON). Bare
10
+ * `--version` / `-V` / `-v` stay a single CLI semver so field updaters that
11
+ * compare the whole stdout to the version they just installed still converge.
12
+ */
13
+ export declare function wantsLabelledVersionReport(argv: readonly string[]): boolean;
7
14
  //# sourceMappingURL=version-request.d.ts.map
@@ -19,4 +19,18 @@ export function isVersionRequest(argv) {
19
19
  }
20
20
  return positionals.length === 1 && positionals[0] === "version";
21
21
  }
22
+ export function wantsJson(argv) {
23
+ return argv.includes("--json");
24
+ }
25
+ /**
26
+ * The labelled HQ / CLI / latest-hq-core report (and JSON). Bare
27
+ * `--version` / `-V` / `-v` stay a single CLI semver so field updaters that
28
+ * compare the whole stdout to the version they just installed still converge.
29
+ */
30
+ export function wantsLabelledVersionReport(argv) {
31
+ if (wantsJson(argv))
32
+ return true;
33
+ const positionals = argv.slice(2).filter((a) => !a.startsWith("-"));
34
+ return positionals.length === 1 && positionals[0] === "version";
35
+ }
22
36
  //# sourceMappingURL=version-request.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigoai-us/hq-cli",
3
- "version": "5.121.0",
3
+ "version": "5.121.1",
4
4
  "description": "HQ by Indigo management CLI \u2014 modules and cloud sync",
5
5
  "main": "dist/index.js",
6
6
  "bin": {