@indigoai-us/hq-cli 5.59.0 → 5.61.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.
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="12b04dfd-a264-56c7-bfbb-a448c35689b3")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ac2acbfe-d6f8-52af-9e1a-38b43474a6d5")}catch(e){}}();
3
3
  import chalk from "chalk";
4
4
  import * as readline from "node:readline";
5
5
  import { spawn } from "node:child_process";
@@ -153,6 +153,74 @@ function describeSecretAclPrincipal(principal) {
153
153
  ? "@all (entire company)"
154
154
  : principal.granteeId;
155
155
  }
156
+ // Mirrors hq-pro's server-authoritative KNOWN_DESTINATION_REGISTRY
157
+ // (src/vault-service/handlers/destination-registry.ts) — a KNOWN host's
158
+ // --auth-style is optional because the server resolves the recipe itself.
159
+ // This client-side copy exists purely so an UNKNOWN host with no
160
+ // --auth-style can be rejected immediately with a clear, actionable message
161
+ // instead of a round trip; the server remains the authoritative validator
162
+ // (this list drifting stale merely means one extra CLI round trip, not a
163
+ // security gap — the server still 400s an unrecognized host with no recipe).
164
+ const KNOWN_DESTINATION_HOSTS = new Set([
165
+ "api.anthropic.com",
166
+ "api.openai.com",
167
+ "api.stripe.com",
168
+ ]);
169
+ // Parses `--auth-style` into the InjectionRecipe shape the server expects.
170
+ // Returns `null` (with a printed error) for an unrecognized value.
171
+ function parseAuthStyle(authStyle) {
172
+ if (authStyle === "bearer") {
173
+ return { header: "authorization", scheme: "bearer" };
174
+ }
175
+ if (authStyle === "x-api-key") {
176
+ return { header: "x-api-key", scheme: "raw" };
177
+ }
178
+ const headerMatch = authStyle.match(/^header:(.+)$/);
179
+ if (headerMatch) {
180
+ const headerName = headerMatch[1].trim();
181
+ if (!headerName) {
182
+ console.error(chalk.red(`Invalid --auth-style 'header:': must name a header, e.g. header:X-Custom-Key`));
183
+ return null;
184
+ }
185
+ return { header: headerName, scheme: "raw" };
186
+ }
187
+ console.error(chalk.red(`Invalid --auth-style '${authStyle}': must be one of bearer, x-api-key, or header:NAME`));
188
+ return null;
189
+ }
190
+ // Validates `--destination` is a bare HTTPS scheme+host URL (no path, query,
191
+ // port). Mirrors hq-pro's `validateDestinations` server-side check
192
+ // (src/vault-service/handlers/secrets.ts) so a malformed URL is caught
193
+ // locally with an actionable message rather than a round trip — the server
194
+ // re-validates and remains authoritative.
195
+ function parseDestinationUrl(raw) {
196
+ let parsed;
197
+ try {
198
+ parsed = new URL(raw);
199
+ }
200
+ catch {
201
+ console.error(chalk.red(`Invalid --destination '${raw}': must be a valid URL`));
202
+ return { ok: false };
203
+ }
204
+ if (parsed.protocol !== "https:") {
205
+ console.error(chalk.red(`Invalid --destination '${raw}': must use https://`));
206
+ return { ok: false };
207
+ }
208
+ if (!parsed.hostname) {
209
+ console.error(chalk.red(`Invalid --destination '${raw}': missing hostname`));
210
+ return { ok: false };
211
+ }
212
+ if ((parsed.pathname !== "" && parsed.pathname !== "/") ||
213
+ parsed.search !== "" ||
214
+ parsed.hash !== "") {
215
+ console.error(chalk.red(`Invalid --destination '${raw}': must be a bare scheme+host URL with no path, query, or fragment (e.g. https://api.openai.com)`));
216
+ return { ok: false };
217
+ }
218
+ if (parsed.port !== "") {
219
+ console.error(chalk.red(`Invalid --destination '${raw}': must not specify a port`));
220
+ return { ok: false };
221
+ }
222
+ return { ok: true, url: `https://${parsed.hostname}`, hostname: parsed.hostname };
223
+ }
156
224
  function normalizeSecretTier(tier) {
157
225
  return tier === "sensitive" || tier === "nuclear" ? tier : "standard";
158
226
  }
@@ -218,7 +286,11 @@ export function scrubSandboxOutput(text, secretNames = []) {
218
286
  }
219
287
  function renderSandboxJobResult(job, secretNames) {
220
288
  if (job.output) {
221
- process.stdout.write(scrubSandboxOutput(job.output, secretNames));
289
+ const output = scrubSandboxOutput(job.output, secretNames);
290
+ process.stdout.write(output);
291
+ if (output.length > 0 && !output.endsWith("\n")) {
292
+ process.stdout.write("\n");
293
+ }
222
294
  }
223
295
  }
224
296
  function normalizePolicyRecord(secretPath, data) {
@@ -374,12 +446,56 @@ export function registerSecretsCommand(program) {
374
446
  .command("set <name>")
375
447
  .description("Create or update a secret")
376
448
  .option("--from-stdin", "Read secret value from piped stdin")
449
+ .option("--high-security", "Mark the secret high-security: it can never be revealed or injected locally, only used through the HQ secret proxy (requires --destination)")
450
+ .option("--destination <https-url>", "Approved scheme+host HTTPS URL the proxy may forward this secret to (e.g. https://api.openai.com); required with --high-security")
451
+ .option("--auth-style <style>", "How the proxy attaches the key upstream: bearer | x-api-key | header:NAME. Optional for known destinations (auto-resolved server-side); required for unknown ones")
377
452
  .action(async (name, opts) => {
378
453
  try {
379
454
  if (!SECRET_NAME_PATTERN.test(name)) {
380
455
  console.error(chalk.red(`Invalid secret name '${name}': must match ^[A-Z][A-Z0-9_]*(/[A-Z][A-Z0-9_]+)*$ (e.g. MY_API_KEY or DEV/MY_KEY)`));
381
456
  process.exit(1);
382
457
  }
458
+ // secrets-proxy-per-secret-destination US-006: --high-security marks
459
+ // the secret so it can only ever be used through the server-side
460
+ // proxy (never revealed/injected locally — that refusal is the
461
+ // pre-existing consumption-side behavior in `get`/`exec`/`env` above,
462
+ // unchanged by this story). It REQUIRES a --destination: the proxy
463
+ // (hq-pro US-002) fails closed with no destination configured, so
464
+ // catching the missing pin here is a clear, immediate CLI error
465
+ // rather than a deferred proxy-time failure.
466
+ let destinations;
467
+ let injection;
468
+ if (opts.highSecurity) {
469
+ if (!opts.destination) {
470
+ console.error(chalk.red("Error: --high-security requires --destination <https-url> (e.g. --destination https://api.openai.com)."));
471
+ process.exit(1);
472
+ }
473
+ const destResult = parseDestinationUrl(opts.destination);
474
+ if (!destResult.ok) {
475
+ process.exit(1);
476
+ }
477
+ destinations = [destResult.url];
478
+ if (opts.authStyle) {
479
+ const recipe = parseAuthStyle(opts.authStyle);
480
+ if (!recipe) {
481
+ process.exit(1);
482
+ }
483
+ injection = recipe;
484
+ }
485
+ else if (!KNOWN_DESTINATION_HOSTS.has(destResult.hostname)) {
486
+ // Unknown host + no explicit recipe: the server would reject this
487
+ // 400 anyway (US-004 registry lookup only, never guesses) — fail
488
+ // fast locally with an actionable message instead of a round trip.
489
+ console.error(chalk.red(`Error: unknown destination host '${destResult.hostname}' — provide --auth-style <bearer|x-api-key|header:NAME> (known hosts auto-resolve: ${[...KNOWN_DESTINATION_HOSTS].join(", ")}).`));
490
+ process.exit(1);
491
+ }
492
+ // Known host + no --auth-style: leave `injection` undefined so the
493
+ // server (US-004) auto-resolves the recipe from its registry.
494
+ }
495
+ else if (opts.destination || opts.authStyle) {
496
+ console.error(chalk.red("Error: --destination/--auth-style require --high-security."));
497
+ process.exit(1);
498
+ }
383
499
  let value;
384
500
  if (opts.fromStdin) {
385
501
  if (process.stdin.isTTY) {
@@ -415,15 +531,27 @@ export function registerSecretsCommand(program) {
415
531
  token,
416
532
  path: `/secrets/${encodeURIComponent(companyUid)}`,
417
533
  method: "POST",
418
- body: { name, value },
534
+ body: {
535
+ name,
536
+ value,
537
+ // Only present when --high-security was passed — an ordinary
538
+ // `set` with no flags sends exactly `{ name, value }`, byte-for-
539
+ // byte unchanged from before this story.
540
+ ...(opts.highSecurity ? { highSecurity: true } : {}),
541
+ ...(destinations ? { destinations } : {}),
542
+ ...(injection ? { injection } : {}),
543
+ },
419
544
  });
420
545
  if (!res.ok) {
421
- const body = await res.json().catch(() => ({}));
422
- console.error(chalk.red(`Failed to set secret: ${body.error ?? res.statusText}`));
546
+ const body = (await res.json().catch(() => ({})));
547
+ console.error(chalk.red(`Failed to set secret: ${extractApiMessage(body, res.statusText)}`));
423
548
  process.exit(1);
424
549
  }
425
550
  removeCacheEntry(companyUid, name);
426
551
  console.log(chalk.green(formatSecretSaved(name, scopeLabel)));
552
+ if (opts.highSecurity) {
553
+ console.log(chalk.dim(` High-security: destination pinned to ${destinations?.[0]}. This value can never be revealed or injected locally — only used through the HQ secret proxy.`));
554
+ }
427
555
  }
428
556
  catch (err) {
429
557
  console.error(chalk.red("Error:"), err instanceof Error ? err.message : String(err));
@@ -1254,4 +1382,4 @@ export function registerSecretsCommand(program) {
1254
1382
  });
1255
1383
  }
1256
1384
  //# sourceMappingURL=secrets.js.map
1257
- //# debugId=12b04dfd-a264-56c7-bfbb-a448c35689b3
1385
+ //# debugId=ac2acbfe-d6f8-52af-9e1a-38b43474a6d5
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env node
2
- /**
3
- * HQ CLI - Module management, package management, and cloud sync for HQ
4
- */
5
2
  import "./node-preflight.js";
3
+ declare function isVersionRequest(argv: readonly string[]): boolean;
4
+ export declare const __test__: {
5
+ isVersionRequest: typeof isVersionRequest;
6
+ };
7
+ export {};
6
8
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,247 +1,21 @@
1
1
  #!/usr/bin/env node
2
- /**
3
- * HQ CLI - Module management, package management, and cloud sync for HQ
4
- */
5
2
  // MUST be first: guard the Node version before any dependency that needs a
6
3
  // Node 20+ API (e.g. util.styleText) or a newer native ABI is evaluated.
7
4
 
8
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="8839ee7d-9f6d-54fe-8f90-99ad858e349e")}catch(e){}}();
5
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="8fdfd788-4c00-50bc-9ed0-579ed9d5f903")}catch(e){}}();
9
6
  import "./node-preflight.js";
10
- import { Command } from "commander";
11
- import { initSentry, Sentry } from "./sentry.js";
12
- import { registerAddCommand } from "./commands/add.js";
13
- import { registerSyncCommand } from "./commands/sync.js";
14
- import { registerListCommand } from "./commands/list.js";
15
- import { registerUpdateCommand } from "./commands/update.js";
16
- import { registerCloudCommands } from "./commands/cloud.js";
17
- import { registerSyncModeCommand } from "./commands/sync-mode.js";
18
- import { registerSyncNarrowCommand } from "./commands/sync-narrow.js";
19
- import { registerCloudProvisionCommands } from "./commands/cloud-provision.js";
20
- import { registerCloudDemoteCommands } from "./commands/cloud-demote.js";
21
- import { registerLoginCommand } from "./commands/login.js";
22
- import { registerLogoutCommand } from "./commands/logout.js";
23
- import { registerWhoamiCommand } from "./commands/whoami.js";
24
- import { registerOnboardCommand } from "./commands/onboard.js";
25
- import { registerPackageInstallCommand } from "./commands/pkg-install.js";
26
- import { registerPackageRemoveCommand } from "./commands/pkg-remove.js";
27
- import { registerPackageUpdateCommand } from "./commands/pkg-update.js";
28
- import { registerPackageListCommand } from "./commands/pkg-list.js";
29
- import { registerPacksCommand } from "./commands/packs.js";
30
- import { registerPublishCommand } from "./commands/publish.js";
31
- import { registerCreatorsCommand } from "./commands/creators.js";
32
- import { registerTeamSyncCommand } from "./commands/team-sync.js";
33
- import { registerAuthCommands } from "./commands/auth.js";
34
- import { registerApiKeysCommand } from "./commands/api-keys.js";
35
- import { registerSecretsCommand } from "./commands/secrets.js";
36
- import { registerRunCommand } from "./commands/run.js";
37
- import { registerGroupsCommand } from "./commands/groups.js";
38
- import { registerGroupGrantsCommand } from "./commands/group-grants.js";
39
- import { registerFilesCommand } from "./commands/files.js";
40
- import { registerFilesBrowseCommands } from "./commands/files-browse.js";
41
- import { registerMembersCommand } from "./commands/members.js";
42
- import { registerPeopleCommand } from "./commands/people.js";
43
- import { registerDmCommand } from "./commands/dm.js";
44
- import { registerChannelsCommand } from "./commands/channels.js";
45
- import { registerFeedbackCommand } from "./commands/feedback.js";
46
- import { registerMeetingsCommand } from "./commands/meetings.js";
47
- import { registerSourcesCommand } from "./commands/sources.js";
48
- import { registerSignalsCommand } from "./commands/signals.js";
49
- import { registerReindexCommand } from "./commands/reindex.js";
50
- import { registerRescueCommand } from "./commands/rescue.js";
51
- import { registerMcpCommand } from "./commands/mcp-status.js";
52
- import { registerCrmCommand } from "./commands/crm.js";
53
- import { registerCompanyCommand } from "./commands/company.js";
54
- import { sanitizeArgv } from "./utils/feedback-diagnostics.js";
55
- import { environmentalFsErrorMessage } from "./utils/environmental-error.js";
56
- import { isEpipe } from "./utils/epipe.js";
57
- import { isInterceptedProcessExit } from "./utils/intercepted-process-exit.js";
58
- import { maybeWarnNewVersion, refreshVersionCache, } from "./utils/version-check.js";
59
- import { enforceVersionGate, shouldSkipGate, } from "./utils/version-gate.js";
60
7
  import { CLI_VERSION } from "./cli-version.js";
61
- // Swallow EPIPE when a downstream reader (e.g. `source <(…)`, `| head`) closes
62
- // the pipe early. This covers the ASYNC path — an 'error' event emitted on the
63
- // stream. The SYNCHRONOUS path (a `write EPIPE` thrown straight out of
64
- // console.log inside a command) is handled in the top-level catch below; both
65
- // share `isEpipe` (HQ-6B).
66
- const onPipeError = (err) => {
67
- if (isEpipe(err)) {
68
- process.exit(0);
69
- }
70
- throw err;
71
- };
72
- process.stdout.on("error", onPipeError);
73
- process.stderr.on("error", onPipeError);
74
- initSentry();
75
- maybeWarnNewVersion();
76
- const program = new Command();
77
- program
78
- .name("hq")
79
- .description("HQ management CLI — modules, packages, and cloud sync")
80
- .version(CLI_VERSION);
81
- // Module management subcommand group
82
- const modulesCmd = program
83
- .command("modules")
84
- .description("Module management commands");
85
- registerAddCommand(modulesCmd);
86
- registerSyncCommand(modulesCmd);
87
- registerListCommand(modulesCmd);
88
- registerUpdateCommand(modulesCmd);
89
- // Package management subcommand group
90
- const packagesCmd = program
91
- .command("packages")
92
- .description("Package management commands");
93
- registerPackageInstallCommand(packagesCmd);
94
- registerPackageRemoveCommand(packagesCmd);
95
- registerPackageUpdateCommand(packagesCmd);
96
- registerPackageListCommand(packagesCmd);
97
- // Content-pack lifecycle (core/packages/hq-pack-*). Distinct from the registry
98
- // `packages` system above. Available as both `hq packages packs …` (grouped)
99
- // and `hq packs …` (top-level convenience).
100
- registerPacksCommand(packagesCmd);
101
- registerPacksCommand(program);
102
- // Top-level shortcuts for package commands
103
- // "hq install <slug>" = "hq packages install <slug>"
104
- // "hq remove <slug>" = "hq packages remove <slug>"
105
- registerPackageInstallCommand(program);
106
- registerPackageRemoveCommand(program);
107
- // Marketplace publish (top-level — packer + authenticated upload, US-004)
108
- // "hq publish <skill-or-worker-path>" packages and submits a pack to the
109
- // marketplace via POST /v1/listings.
110
- registerPublishCommand(program);
111
- // `hq creators apply` — request verified-creator access (required to publish).
112
- registerCreatorsCommand(program);
113
- // Cloud sync subcommand group
114
- const syncCmd = program
115
- .command("sync")
116
- .description("Cloud sync commands — sync HQ to S3 for mobile access");
117
- registerCloudCommands(syncCmd);
118
- registerSyncModeCommand(syncCmd);
119
- registerSyncNarrowCommand(syncCmd);
120
- // Cloud provisioning subcommand group (entity + bucket + initial sync)
121
- // Distinct from `hq sync` which assumes provisioning has already happened.
122
- const cloudCmd = program
123
- .command("cloud")
124
- .description("Cloud commands — provision entities and manage cloud-backed companies");
125
- registerCloudProvisionCommands(cloudCmd);
126
- registerCloudDemoteCommands(cloudCmd);
127
- // Team commands (top-level)
128
- registerTeamSyncCommand(program);
129
- // Auth commands (top-level — Cognito OAuth)
130
- registerLoginCommand(program);
131
- registerLogoutCommand(program);
132
- registerWhoamiCommand(program);
133
- registerAuthCommands(program);
134
- // Secrets management (subcommand group — hq secrets set|get|list|delete|exec|generate-link|cache)
135
- registerSecretsCommand(program);
136
- // API key management (subcommand group — hq api-keys create|list|revoke)
137
- registerApiKeysCommand(program);
138
- // Schema-driven dev runner — hq run [options] -- <cmd>
139
- registerRunCommand(program);
140
- // Groups management (subcommand group — hq groups create|delete|add|remove|list|members)
141
- registerGroupsCommand(program);
142
- // Cross-company group grants (subcommand group —
143
- // hq group-grants grant|revoke|outbound|inbound)
144
- registerGroupGrantsCommand(program);
145
- // Files ACL management (subcommand group — hq files share|unshare|acl)
146
- // `registerFilesCommand` returns the `files` group so we can attach the
147
- // browse-vs-sync subcommands (`hq files browse`/`cat`) onto the same group.
148
- const filesCmd = registerFilesCommand(program);
149
- registerFilesBrowseCommands(filesCmd);
150
- // Membership management (subcommand group — hq members invite|list|revoke)
151
- registerMembersCommand(program);
152
- // People directory (subcommand group — hq people list|search|resolve), reading
153
- // the local companies/<co>/people store scoped to one company.
154
- registerPeopleCommand(program);
155
- registerDmCommand(program);
156
- registerChannelsCommand(program);
157
- // Onboarding (top-level — Cognito + vault-service provisioning)
158
- registerOnboardCommand(program);
159
- // Feedback (subcommand group — hq feedback bug|feature)
160
- registerFeedbackCommand(program);
161
- // Meetings (subcommand group — hq meetings list|get|search|transcript|notes)
162
- registerMeetingsCommand(program);
163
- // Sources read surface (subcommand group — hq sources list|get|channels|entities)
164
- registerSourcesCommand(program);
165
- // Signals read surface (subcommand group — hq signals list|get|types|entities)
166
- registerSignalsCommand(program);
167
- // Skill/personal-overlay mirroring + workers-registry regen. Invoked by the
168
- // hq-core reindex hook shim (Stop / PostToolUse) and by sync()/rescue() after
169
- // they change on-disk sources. Keeps a `master-sync` alias for one release.
170
- // Implementation lives in @indigoai-us/hq-cloud.
171
- registerReindexCommand(program);
172
- // Drift-preserving HQ-core re-sync (top-level — `hq rescue`). CLI sibling of
173
- // the HQ Sync app's "Update / Restore" pill; drives the same replace-rescue.sh
174
- // shipped from @indigoai-us/hq-cloud.
175
- registerRescueCommand(program);
176
- // MCP pack observability (subcommand group — `hq mcp status`). Read-only
177
- // provenance-based status across BOTH Claude + Codex runtimes (reads `_hqPack`
178
- // off the configs, NOT linkStatus), with secret-redacted output + `--json`.
179
- registerMcpCommand(program);
180
- // Native CRM entity upsert (subcommand group — `hq crm entity upsert`). Wraps
181
- // POST /crm/entities (the ontology write gate) so an authenticated company
182
- // member can create/update canonical CRM entities in the company vault.
183
- registerCrmCommand(program);
184
- // Company settings (subcommand group — `hq company settings set`). Owner-only
185
- // toggles for crmEnabled / ontologyEnabled via PUT /company-settings.
186
- registerCompanyCommand(program);
187
- (async () => {
188
- try {
189
- Sentry.addBreadcrumb({
190
- category: "command",
191
- message: sanitizeArgv(process.argv.slice(2)).join(" "),
192
- level: "info",
193
- });
194
- // Hard version gate: ask hq-pro whether this CLI is below the floor and
195
- // auto-update if so (exits the process on update). Skipped for inspection
196
- // flags (`--version`, `--help`) so users debugging a broken install can
197
- // still introspect what they have. Silent on any failure — never blocks
198
- // the CLI on a flaky network or hq-pro hiccup. See `utils/version-gate.ts`.
199
- if (!shouldSkipGate(process.argv)) {
200
- await enforceVersionGate();
201
- }
202
- await program.parseAsync();
203
- }
204
- catch (err) {
205
- // A broken pipe (EPIPE) means the reader of `hq`'s output closed it early
206
- // (`hq … | head`, `source <(hq …)`, a parent that exited). That is normal
207
- // Unix behavior with no user-facing degradation — exit cleanly (0) and
208
- // skip Sentry capture instead of shipping a fatal (HQ-6B). A synchronous
209
- // `write EPIPE` thrown out of console.log lands here rather than on the
210
- // stream 'error' listener above.
211
- if (isEpipe(err)) {
212
- process.exitCode = 0;
213
- }
214
- else if (isInterceptedProcessExit(err)) {
215
- // A security/audit FUZZ harness replaced `process.exit` with a throw so it
216
- // can keep exercising the binary. Commander calling `process.exit` for
217
- // normal CLI control flow (e.g. an unknown command → exit 1) then surfaces
218
- // here as that synthetic marker. It is a test-harness artifact, NOT an
219
- // hq-cli defect — a real user's `process.exit` just exits, so nothing is
220
- // thrown or captured. Skip Sentry capture (no signal, no user-facing
221
- // degradation) and preserve the intended non-zero exit (HQ-CLI-3).
222
- process.exitCode = 1;
223
- }
224
- else {
225
- // A full disk / exhausted quota / read-only filesystem is the user's
226
- // machine, not an HQ code defect. Surface a clear, actionable message and
227
- // skip Sentry capture so one full disk doesn't flood the tracker with
228
- // identical, unfixable crash reports (HQ-CLI-2). Genuine errors still go
229
- // to Sentry and still exit 1.
230
- const envMsg = environmentalFsErrorMessage(err);
231
- if (envMsg) {
232
- process.stderr.write(`hq: ${envMsg}\n`);
233
- }
234
- else {
235
- Sentry.captureException(err);
236
- }
237
- process.exitCode = 1;
238
- }
239
- }
240
- finally {
241
- // Release health: finalize the per-run session before the flush.
242
- Sentry.endSession();
243
- await Promise.allSettled([refreshVersionCache(), Sentry.flush(2000)]);
244
- }
245
- })();
8
+ function isVersionRequest(argv) {
9
+ const args = argv.slice(2);
10
+ return args.length === 1 && (args[0] === "--version" || args[0] === "-V" || args[0] === "-v");
11
+ }
12
+ if (isVersionRequest(process.argv)) {
13
+ process.stdout.write(`${CLI_VERSION}\n`);
14
+ }
15
+ else {
16
+ const { runCli } = await import("./main.js");
17
+ await runCli();
18
+ }
19
+ export const __test__ = { isVersionRequest };
246
20
  //# sourceMappingURL=index.js.map
247
- //# debugId=8839ee7d-9f6d-54fe-8f90-99ad858e349e
21
+ //# debugId=8fdfd788-4c00-50bc-9ed0-579ed9d5f903
package/dist/main.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * HQ CLI - Module management, package management, and cloud sync for HQ
4
+ */
5
+ import "./node-preflight.js";
6
+ export declare function runCli(): Promise<void>;
7
+ //# sourceMappingURL=main.d.ts.map