@indigoai-us/hq-cli 5.294.0 → 5.296.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.
- package/CHANGELOG.md +33 -0
- package/dist/command-catalog.generated.d.ts +70 -9
- package/dist/command-catalog.generated.js +88 -12
- package/dist/commands/auth.d.ts +1 -0
- package/dist/commands/auth.js +76 -1
- package/dist/commands/core-job-native.d.ts +7 -0
- package/dist/commands/core-job-native.js +20 -0
- package/dist/commands/core-job-probe-native.d.ts +45 -0
- package/dist/commands/core-job-probe-native.js +564 -0
- package/dist/commands/core-job-remote-launcher.d.ts +7 -0
- package/dist/commands/core-job-remote-launcher.js +51 -0
- package/dist/commands/core-job-run-native.d.ts +47 -0
- package/dist/commands/core-job-run-native.js +1215 -0
- package/dist/commands/core.js +1 -1
- package/dist/commands/doctor.js +0 -74
- package/dist/commands/lanes-message.js +24 -5
- package/dist/commands/lanes-resume.js +1 -3
- package/dist/commands/lanes-shared.d.ts +1 -2
- package/dist/commands/lanes-stories.d.ts +1 -0
- package/dist/commands/lanes-stories.js +40 -1
- package/dist/commands/lanes.d.ts +1 -9
- package/dist/commands/lanes.js +197 -174
- package/dist/commands/run.js +5 -0
- package/dist/fast-scaffold.d.ts +0 -5
- package/dist/fast-scaffold.js +0 -10
- package/dist/index.js +1 -10
- package/dist/lib/core-utils/sentry-report.d.ts +0 -19
- package/dist/lib/core-utils/sentry-report.js +8 -61
- package/dist/lib/doctor/checks/claude-wiring.js +9 -0
- package/dist/lib/lanes/flag-keys.d.ts +2 -0
- package/dist/lib/lanes/flag-keys.js +2 -0
- package/dist/lib/lanes/manager-status-gate.d.ts +0 -17
- package/dist/lib/lanes/manager-status-gate.js +2 -43
- package/dist/lib/lanes/mesh-events.js +3 -0
- package/dist/lib/lanes/outpost-dispatch.d.ts +2 -0
- package/dist/lib/lanes/outpost-dispatch.js +7 -1
- package/dist/lib/lanes/outpost-hire-cache.d.ts +0 -1
- package/dist/lib/lanes/outpost-hire-cache.js +0 -1
- package/dist/lib/lanes/outpost-snapshot-memo.d.ts +6 -0
- package/dist/lib/lanes/outpost-snapshot-memo.js +14 -0
- package/dist/lib/lanes/reconcile.d.ts +2 -3
- package/dist/lib/lanes/reconcile.js +67 -57
- package/dist/lib/lanes/spawn.d.ts +0 -2
- package/dist/lib/lanes/spawn.js +57 -5
- package/dist/lib/lanes/store.js +54 -0
- package/dist/lib/lanes/stories.d.ts +7 -1
- package/dist/lib/lanes/stories.js +16 -0
- package/dist/lib/lanes/types.d.ts +30 -1
- package/dist/lib/lanes/types.js +2 -2
- package/dist/lib/lanes/watcher.d.ts +4 -3
- package/dist/lib/lanes/watcher.js +122 -56
- package/dist/lib/mesh/live/daemon/run.js +18 -1
- package/dist/run/env-graph-guard.d.ts +2 -2
- package/dist/run/env-graph-guard.js +5 -2
- package/dist/run/hq-plugin.js +6 -5
- package/dist/utils/cognito-session.d.ts +6 -0
- package/dist/utils/cognito-session.js +9 -0
- package/dist/utils/self-update.js +31 -0
- package/dist/utils/version-gate.js +22 -3
- package/package.json +2 -2
- package/dist/fast-lanes-list-route.d.ts +0 -8
- package/dist/fast-lanes-list-route.js +0 -32
- package/dist/fast-lanes-list.d.ts +0 -3
- package/dist/fast-lanes-list.js +0 -224
- package/dist/lib/doctor/client-health-sentry-flag.d.ts +0 -23
- package/dist/lib/doctor/client-health-sentry-flag.js +0 -99
- package/dist/lib/doctor/client-health-sentry.d.ts +0 -71
- package/dist/lib/doctor/client-health-sentry.js +0 -286
- package/dist/lib/lanes/outpost-snapshot-cache.d.ts +0 -26
- package/dist/lib/lanes/outpost-snapshot-cache.js +0 -215
- package/dist/lib/lanes/outpost-snapshot-refresh.d.ts +0 -21
- package/dist/lib/lanes/outpost-snapshot-refresh.js +0 -329
package/CHANGELOG.md
CHANGED
|
@@ -2,13 +2,46 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [5.296.0] — 2026-09-30
|
|
6
|
+
- Upgrade varlock to 1.21.1. `hq run` skips Varlock cache setup and reports malformed env files promptly without sending them to Sentry.
|
|
7
|
+
- Record bounded actor and trigger history for lane worker starts and expose it through `hq lanes show --json`. Preserve history through conflict merges and envelope repair, and record answered-question callers for immediate and queued resumes.
|
|
8
|
+
- `hq lanes` no longer lets a late terminal lane envelope change a story the senior already marked done or dropped, and `hq lanes story review <lane> <story>` moves a carried story to review before senior verification (feedback_d0164732-22b0-4426-9b66-c9758ba205e3).
|
|
9
|
+
|
|
10
|
+
## [5.295.0] — 2026-09-30
|
|
11
|
+
- Add native `hq core job run` behind the default-off `core-native-jobs` gate, retaining its bundled shell rollback companion.
|
|
12
|
+
|
|
13
|
+
- Remove the unused direct client-health Sentry route; the existing server-side reporting path remains unchanged.
|
|
14
|
+
|
|
15
|
+
- Add native `hq core job probe` behind the existing default-off `core-native-jobs` gate.
|
|
16
|
+
- Self-update supervisor copy and cleanup failures now log their error class.
|
|
17
|
+
- Report failed and ineffective self-updates to Sentry with bounded context.
|
|
18
|
+
|
|
19
|
+
- hq-cli release notes now use per-branch fragments that are folded into the next version section, reducing conflicts between parallel pull requests.
|
|
20
|
+
- Claude keep-alive resume events now retain a compact account-load selection snapshot, including when the lane stays on its current account.
|
|
21
|
+
- After a successful missing-envelope repair reports unfinished work, the watcher can queue one automatic continue behind the default-off `lanes.envelope-repair-continue` flag. The repair prompt now gives the required unfinished-story envelope fields.
|
|
22
|
+
- Add a private machine-session token-file command for supported machine-auth handoffs.
|
|
23
|
+
- Apply the 5x fast-route speedup gate only when the base p95 is at or above the 200 ms target; retain the p95 latency and base/PR regression gates.
|
|
24
|
+
- The changelog fragment check runs only on pull requests again, so pushes to main no longer fail it.
|
|
25
|
+
- Refresh terminal Outpost lane mirrors before applying `hq lanes list` state filters, so a lane whose owner is still running is listed as running.
|
|
26
|
+
- Remove the unused Outpost snapshot cache flag and its cache-first lane-list path.
|
|
27
|
+
- The mesh daemon logs spool watcher failures and continues flushing on its polling interval instead of exiting on an unhandled watcher error.
|
|
28
|
+
- Make the manager status gate always active and remove its rollout flag lookup.
|
|
29
|
+
- Compare fast-route latency with a PR-build full-graph baseline so the 5x gate remains valid after the base build gains fast routing.
|
|
30
|
+
|
|
5
31
|
## [5.294.0] — 2026-09-30
|
|
32
|
+
- Record automatic keep-alive resumes in each lane's durable, bounded history and expose it in `hq lanes show --json` and `hq lanes list --json`.
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
6
35
|
|
|
36
|
+
- Outpost `hq lanes message` now reaches primary-hosted lanes through the
|
|
37
|
+
primary owner command, which checks sender rights and includes the
|
|
38
|
+
destination in JSON output.
|
|
7
39
|
- Split the lane story command handlers into a dedicated module without changing behavior.
|
|
8
40
|
- On a box, `sudo hq daemon migrate --apply` now finds the login user's own systemd user units (hq-mesh-daemon, hq-lanes-reconcile and the rest) and stops them through that user's systemd manager. `sudo hq daemon uninstall --restore-legacy` restarts them the same way. Before, root looked only in its own home and could not reach the login user's manager.
|
|
9
41
|
|
|
10
42
|
## [5.293.0] — 2026-09-30
|
|
11
43
|
- [HQ-CLI-HOOK-TIMEOUT-KIND] Group hook timeout events by normalized kind (`warning` or `exceeded`) across scripts; keep script and platform tags for triage. Existing per-script issues will stop receiving new events, and the lead handles their status.
|
|
44
|
+
- [HQ-CLI-2C] Label unmeasured SessionStart delay as entry Bash startup when BASH_ENV is set; doctor follows the env-prefixed hook command.
|
|
12
45
|
- `hq lanes move` now reports an already-on-target no-op without dispatching or changing the queued lane.
|
|
13
46
|
- Keep bundled scheduled-job reconciliation units on the live scaffold runner, and preserve caller spelling in job-validation paths.
|
|
14
47
|
- On Linux, `hq daemon run` sets XDG_RUNTIME_DIR for its services when the system unit left it unset, so `systemctl --user` from jobs-reconcile no longer fails with "Failed to connect to bus: No medium found".
|
|
@@ -860,6 +860,18 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
860
860
|
readonly arguments: readonly [];
|
|
861
861
|
readonly options: readonly [];
|
|
862
862
|
readonly subcommands: readonly [{
|
|
863
|
+
readonly name: "machine-session";
|
|
864
|
+
readonly description: "Write the existing machine identity session to a private file";
|
|
865
|
+
readonly aliases: readonly [];
|
|
866
|
+
readonly hidden: false;
|
|
867
|
+
readonly usage: "[options]";
|
|
868
|
+
readonly arguments: readonly [];
|
|
869
|
+
readonly options: readonly [{
|
|
870
|
+
readonly flags: "--output <path>";
|
|
871
|
+
readonly description: "path for the private machine session JSON";
|
|
872
|
+
}];
|
|
873
|
+
readonly subcommands: readonly [];
|
|
874
|
+
}, {
|
|
863
875
|
readonly name: "login";
|
|
864
876
|
readonly description: "Sign in to HQ — opens the Cognito Hosted UI and caches tokens locally";
|
|
865
877
|
readonly aliases: readonly [];
|
|
@@ -5606,6 +5618,41 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
5606
5618
|
readonly options: readonly [];
|
|
5607
5619
|
readonly subcommands: readonly [];
|
|
5608
5620
|
}];
|
|
5621
|
+
}, {
|
|
5622
|
+
readonly name: "job";
|
|
5623
|
+
readonly description: "Run or inspect one scheduled job";
|
|
5624
|
+
readonly aliases: readonly [];
|
|
5625
|
+
readonly hidden: false;
|
|
5626
|
+
readonly usage: "[options] [command]";
|
|
5627
|
+
readonly arguments: readonly [];
|
|
5628
|
+
readonly options: readonly [];
|
|
5629
|
+
readonly subcommands: readonly [{
|
|
5630
|
+
readonly name: "probe";
|
|
5631
|
+
readonly description: "Check scheduled-job requirements and report readiness";
|
|
5632
|
+
readonly aliases: readonly [];
|
|
5633
|
+
readonly hidden: false;
|
|
5634
|
+
readonly usage: "[args...]";
|
|
5635
|
+
readonly arguments: readonly [{
|
|
5636
|
+
readonly name: "args";
|
|
5637
|
+
readonly required: false;
|
|
5638
|
+
readonly variadic: true;
|
|
5639
|
+
}];
|
|
5640
|
+
readonly options: readonly [];
|
|
5641
|
+
readonly subcommands: readonly [];
|
|
5642
|
+
}, {
|
|
5643
|
+
readonly name: "run";
|
|
5644
|
+
readonly description: "Run a scheduled job";
|
|
5645
|
+
readonly aliases: readonly [];
|
|
5646
|
+
readonly hidden: false;
|
|
5647
|
+
readonly usage: "[args...]";
|
|
5648
|
+
readonly arguments: readonly [{
|
|
5649
|
+
readonly name: "args";
|
|
5650
|
+
readonly required: false;
|
|
5651
|
+
readonly variadic: true;
|
|
5652
|
+
}];
|
|
5653
|
+
readonly options: readonly [];
|
|
5654
|
+
readonly subcommands: readonly [];
|
|
5655
|
+
}];
|
|
5609
5656
|
}, {
|
|
5610
5657
|
readonly name: "jobs";
|
|
5611
5658
|
readonly description: "Scheduled jobs helpers";
|
|
@@ -6130,15 +6177,6 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
6130
6177
|
}, {
|
|
6131
6178
|
readonly flags: "--client-health-report";
|
|
6132
6179
|
readonly description: "Resolve the opt-in hq-flags gate used by the client-health report hook.";
|
|
6133
|
-
}, {
|
|
6134
|
-
readonly flags: "--client-health-sentry";
|
|
6135
|
-
readonly description: "Send the opt-in client-health Sentry report from a doctor JSON document.";
|
|
6136
|
-
}, {
|
|
6137
|
-
readonly flags: "--json-input <file>";
|
|
6138
|
-
readonly description: "Doctor JSON input for the client-health report.";
|
|
6139
|
-
}, {
|
|
6140
|
-
readonly flags: "--client-health-fix-outcome <outcome>";
|
|
6141
|
-
readonly description: "Safe fix outcome label for the client-health report.";
|
|
6142
6180
|
}, {
|
|
6143
6181
|
readonly flags: "--yes";
|
|
6144
6182
|
readonly description: "Skip the interactive --fix confirmation (non-interactive use).";
|
|
@@ -8379,6 +8417,29 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
8379
8417
|
readonly description: "JSON on stdout (always)";
|
|
8380
8418
|
}];
|
|
8381
8419
|
readonly subcommands: readonly [];
|
|
8420
|
+
}, {
|
|
8421
|
+
readonly name: "review";
|
|
8422
|
+
readonly description: "Move a carried story to review";
|
|
8423
|
+
readonly aliases: readonly [];
|
|
8424
|
+
readonly hidden: false;
|
|
8425
|
+
readonly usage: "[options] <lane-id> <story-id>";
|
|
8426
|
+
readonly arguments: readonly [{
|
|
8427
|
+
readonly name: "lane-id";
|
|
8428
|
+
readonly required: true;
|
|
8429
|
+
readonly variadic: false;
|
|
8430
|
+
}, {
|
|
8431
|
+
readonly name: "story-id";
|
|
8432
|
+
readonly required: true;
|
|
8433
|
+
readonly variadic: false;
|
|
8434
|
+
}];
|
|
8435
|
+
readonly options: readonly [{
|
|
8436
|
+
readonly flags: "--project <slug>";
|
|
8437
|
+
readonly description: "Project id; defaults to the lane's current project";
|
|
8438
|
+
}, {
|
|
8439
|
+
readonly flags: "--json";
|
|
8440
|
+
readonly description: "JSON on stdout (always)";
|
|
8441
|
+
}];
|
|
8442
|
+
readonly subcommands: readonly [];
|
|
8382
8443
|
}, {
|
|
8383
8444
|
readonly name: "block";
|
|
8384
8445
|
readonly description: "Mark one carried story blocked";
|
|
@@ -1097,6 +1097,21 @@ export const COMMAND_CATALOG = [
|
|
|
1097
1097
|
"arguments": [],
|
|
1098
1098
|
"options": [],
|
|
1099
1099
|
"subcommands": [
|
|
1100
|
+
{
|
|
1101
|
+
"name": "machine-session",
|
|
1102
|
+
"description": "Write the existing machine identity session to a private file",
|
|
1103
|
+
"aliases": [],
|
|
1104
|
+
"hidden": false,
|
|
1105
|
+
"usage": "[options]",
|
|
1106
|
+
"arguments": [],
|
|
1107
|
+
"options": [
|
|
1108
|
+
{
|
|
1109
|
+
"flags": "--output <path>",
|
|
1110
|
+
"description": "path for the private machine session JSON"
|
|
1111
|
+
}
|
|
1112
|
+
],
|
|
1113
|
+
"subcommands": []
|
|
1114
|
+
},
|
|
1100
1115
|
{
|
|
1101
1116
|
"name": "login",
|
|
1102
1117
|
"description": "Sign in to HQ — opens the Cognito Hosted UI and caches tokens locally",
|
|
@@ -7229,6 +7244,49 @@ export const COMMAND_CATALOG = [
|
|
|
7229
7244
|
}
|
|
7230
7245
|
]
|
|
7231
7246
|
},
|
|
7247
|
+
{
|
|
7248
|
+
"name": "job",
|
|
7249
|
+
"description": "Run or inspect one scheduled job",
|
|
7250
|
+
"aliases": [],
|
|
7251
|
+
"hidden": false,
|
|
7252
|
+
"usage": "[options] [command]",
|
|
7253
|
+
"arguments": [],
|
|
7254
|
+
"options": [],
|
|
7255
|
+
"subcommands": [
|
|
7256
|
+
{
|
|
7257
|
+
"name": "probe",
|
|
7258
|
+
"description": "Check scheduled-job requirements and report readiness",
|
|
7259
|
+
"aliases": [],
|
|
7260
|
+
"hidden": false,
|
|
7261
|
+
"usage": "[args...]",
|
|
7262
|
+
"arguments": [
|
|
7263
|
+
{
|
|
7264
|
+
"name": "args",
|
|
7265
|
+
"required": false,
|
|
7266
|
+
"variadic": true
|
|
7267
|
+
}
|
|
7268
|
+
],
|
|
7269
|
+
"options": [],
|
|
7270
|
+
"subcommands": []
|
|
7271
|
+
},
|
|
7272
|
+
{
|
|
7273
|
+
"name": "run",
|
|
7274
|
+
"description": "Run a scheduled job",
|
|
7275
|
+
"aliases": [],
|
|
7276
|
+
"hidden": false,
|
|
7277
|
+
"usage": "[args...]",
|
|
7278
|
+
"arguments": [
|
|
7279
|
+
{
|
|
7280
|
+
"name": "args",
|
|
7281
|
+
"required": false,
|
|
7282
|
+
"variadic": true
|
|
7283
|
+
}
|
|
7284
|
+
],
|
|
7285
|
+
"options": [],
|
|
7286
|
+
"subcommands": []
|
|
7287
|
+
}
|
|
7288
|
+
]
|
|
7289
|
+
},
|
|
7232
7290
|
{
|
|
7233
7291
|
"name": "jobs",
|
|
7234
7292
|
"description": "Scheduled jobs helpers",
|
|
@@ -7883,18 +7941,6 @@ export const COMMAND_CATALOG = [
|
|
|
7883
7941
|
"flags": "--client-health-report",
|
|
7884
7942
|
"description": "Resolve the opt-in hq-flags gate used by the client-health report hook."
|
|
7885
7943
|
},
|
|
7886
|
-
{
|
|
7887
|
-
"flags": "--client-health-sentry",
|
|
7888
|
-
"description": "Send the opt-in client-health Sentry report from a doctor JSON document."
|
|
7889
|
-
},
|
|
7890
|
-
{
|
|
7891
|
-
"flags": "--json-input <file>",
|
|
7892
|
-
"description": "Doctor JSON input for the client-health report."
|
|
7893
|
-
},
|
|
7894
|
-
{
|
|
7895
|
-
"flags": "--client-health-fix-outcome <outcome>",
|
|
7896
|
-
"description": "Safe fix outcome label for the client-health report."
|
|
7897
|
-
},
|
|
7898
7944
|
{
|
|
7899
7945
|
"flags": "--yes",
|
|
7900
7946
|
"description": "Skip the interactive --fix confirmation (non-interactive use)."
|
|
@@ -10806,6 +10852,36 @@ export const COMMAND_CATALOG = [
|
|
|
10806
10852
|
],
|
|
10807
10853
|
"subcommands": []
|
|
10808
10854
|
},
|
|
10855
|
+
{
|
|
10856
|
+
"name": "review",
|
|
10857
|
+
"description": "Move a carried story to review",
|
|
10858
|
+
"aliases": [],
|
|
10859
|
+
"hidden": false,
|
|
10860
|
+
"usage": "[options] <lane-id> <story-id>",
|
|
10861
|
+
"arguments": [
|
|
10862
|
+
{
|
|
10863
|
+
"name": "lane-id",
|
|
10864
|
+
"required": true,
|
|
10865
|
+
"variadic": false
|
|
10866
|
+
},
|
|
10867
|
+
{
|
|
10868
|
+
"name": "story-id",
|
|
10869
|
+
"required": true,
|
|
10870
|
+
"variadic": false
|
|
10871
|
+
}
|
|
10872
|
+
],
|
|
10873
|
+
"options": [
|
|
10874
|
+
{
|
|
10875
|
+
"flags": "--project <slug>",
|
|
10876
|
+
"description": "Project id; defaults to the lane's current project"
|
|
10877
|
+
},
|
|
10878
|
+
{
|
|
10879
|
+
"flags": "--json",
|
|
10880
|
+
"description": "JSON on stdout (always)"
|
|
10881
|
+
}
|
|
10882
|
+
],
|
|
10883
|
+
"subcommands": []
|
|
10884
|
+
},
|
|
10809
10885
|
{
|
|
10810
10886
|
"name": "block",
|
|
10811
10887
|
"description": "Mark one carried story blocked",
|
package/dist/commands/auth.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* hq auth logout — clear the cached HQ session
|
|
7
7
|
* hq auth refresh — ensure a valid cached Cognito session (non-interactive)
|
|
8
8
|
* hq auth status — show whether a valid session is cached + expiry
|
|
9
|
+
* hq auth machine-session --output <path> — write machine tokens to a private file
|
|
9
10
|
*
|
|
10
11
|
* Sign-up is owned by the onboarding web app at
|
|
11
12
|
* https://onboarding.hq.computer. `hq auth login` signs an existing account
|
package/dist/commands/auth.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* hq auth logout — clear the cached HQ session
|
|
7
7
|
* hq auth refresh — ensure a valid cached Cognito session (non-interactive)
|
|
8
8
|
* hq auth status — show whether a valid session is cached + expiry
|
|
9
|
+
* hq auth machine-session --output <path> — write machine tokens to a private file
|
|
9
10
|
*
|
|
10
11
|
* Sign-up is owned by the onboarding web app at
|
|
11
12
|
* https://onboarding.hq.computer. `hq auth login` signs an existing account
|
|
@@ -13,9 +14,12 @@
|
|
|
13
14
|
* session is kept valid by `hq auth refresh` / `hq-auth-refresh` and consumed
|
|
14
15
|
* by the deploy + sync skills.
|
|
15
16
|
*/
|
|
17
|
+
import * as fs from "node:fs";
|
|
18
|
+
import { open, realpath } from "node:fs/promises";
|
|
19
|
+
import path from "node:path";
|
|
16
20
|
import chalk from "chalk";
|
|
17
21
|
import { browserLogin, clearCachedTokens, loadCachedTokens, isExpiring, loadMachineCreds, CognitoAuthError, } from "@indigoai-us/hq-cloud";
|
|
18
|
-
import { DEFAULT_COGNITO, refreshCachedSession, resolveCognitoTokenSource, } from "../utils/cognito-session.js";
|
|
22
|
+
import { DEFAULT_COGNITO, refreshCachedSession, resolveCognitoTokenSource, ensureMachineSessionTokens, personTokenCacheFile, machineTokenCacheFile, } from "../utils/cognito-session.js";
|
|
19
23
|
import { resolveLoginProviderSelection, } from "../utils/login-provider.js";
|
|
20
24
|
import { getLastLoginProviderStatePath, loadLastLoginProvider, storeLastLoginProvider, } from "../lib/auth-login-provider-state.js";
|
|
21
25
|
import { callbackPortBusyGuidance, DEFAULT_CALLBACK_PORT, isCallbackPortBusy, } from "../utils/callback-port-busy.js";
|
|
@@ -128,6 +132,77 @@ export function registerAuthCommands(program) {
|
|
|
128
132
|
const authCmd = program
|
|
129
133
|
.command("auth")
|
|
130
134
|
.description("Manage the local HQ Cognito session");
|
|
135
|
+
authCmd
|
|
136
|
+
.command("machine-session")
|
|
137
|
+
.description("Write the existing machine identity session to a private file")
|
|
138
|
+
.requiredOption("--output <path>", "path for the private machine session JSON")
|
|
139
|
+
.action(async (options) => {
|
|
140
|
+
const requestedPath = path.resolve(options.output);
|
|
141
|
+
let handle;
|
|
142
|
+
try {
|
|
143
|
+
if (!loadMachineCreds()) {
|
|
144
|
+
throw new Error("Machine credentials are unavailable.");
|
|
145
|
+
}
|
|
146
|
+
const outputDirectory = await realpath(path.dirname(requestedPath));
|
|
147
|
+
const outputPath = path.join(outputDirectory, path.basename(requestedPath));
|
|
148
|
+
const protectedPaths = await Promise.all([personTokenCacheFile(), machineTokenCacheFile()].map(async (protectedPath) => {
|
|
149
|
+
const resolved = path.resolve(protectedPath);
|
|
150
|
+
try {
|
|
151
|
+
return path.join(await realpath(path.dirname(resolved)), path.basename(resolved));
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
if (error.code === "ENOENT")
|
|
155
|
+
return resolved;
|
|
156
|
+
throw error;
|
|
157
|
+
}
|
|
158
|
+
}));
|
|
159
|
+
if (protectedPaths.includes(outputPath)) {
|
|
160
|
+
throw new Error("Refusing to overwrite a cached Cognito session.");
|
|
161
|
+
}
|
|
162
|
+
const tokens = await ensureMachineSessionTokens();
|
|
163
|
+
const contents = JSON.stringify({
|
|
164
|
+
accessToken: tokens.accessToken,
|
|
165
|
+
idToken: tokens.idToken,
|
|
166
|
+
expiresAt: tokens.expiresAt,
|
|
167
|
+
}) + "\n";
|
|
168
|
+
try {
|
|
169
|
+
handle = await open(outputPath, fs.constants.O_WRONLY | fs.constants.O_CREAT | fs.constants.O_EXCL |
|
|
170
|
+
(fs.constants.O_NOFOLLOW ?? 0), 0o600);
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
if (error.code !== "EEXIST")
|
|
174
|
+
throw error;
|
|
175
|
+
handle = await open(outputPath, fs.constants.O_WRONLY | (fs.constants.O_NOFOLLOW ?? 0));
|
|
176
|
+
const metadata = await handle.stat();
|
|
177
|
+
if (!metadata.isFile() ||
|
|
178
|
+
metadata.uid !== process.getuid?.() ||
|
|
179
|
+
(metadata.mode & 0o077) !== 0) {
|
|
180
|
+
throw new Error("Existing output file is not a private file owned by this user.");
|
|
181
|
+
}
|
|
182
|
+
await handle.truncate(0);
|
|
183
|
+
}
|
|
184
|
+
await handle.writeFile(contents, { encoding: "utf8" });
|
|
185
|
+
await handle.close();
|
|
186
|
+
handle = undefined;
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
if (handle)
|
|
190
|
+
await handle.close().catch(() => undefined);
|
|
191
|
+
const code = error && typeof error === "object" && "code" in error &&
|
|
192
|
+
typeof error.code === "string" && /^[A-Z0-9_]+$/.test(error.code)
|
|
193
|
+
? error.code
|
|
194
|
+
: undefined;
|
|
195
|
+
console.error(code === "EACCES" || code === "ELOOP" || code === "EEXIST"
|
|
196
|
+
? "Could not write machine session file (unsafe or inaccessible path)."
|
|
197
|
+
: error instanceof Error && error.message === "Machine credentials are unavailable."
|
|
198
|
+
? "Machine credentials are unavailable."
|
|
199
|
+
: error instanceof Error && (error.message === "Existing output file is not a private file owned by this user." ||
|
|
200
|
+
error.message === "Refusing to overwrite a cached Cognito session.")
|
|
201
|
+
? error.message
|
|
202
|
+
: "Could not obtain or write machine session.");
|
|
203
|
+
process.exitCode = 1;
|
|
204
|
+
}
|
|
205
|
+
});
|
|
131
206
|
authCmd
|
|
132
207
|
.command("login")
|
|
133
208
|
.description("Sign in to HQ — opens the Cognito Hosted UI and caches tokens locally")
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Native `hq core job <name>` command group. */
|
|
2
|
+
import type { Command } from "commander";
|
|
3
|
+
export declare function registerCoreJobNativeCommand(core: Command): void;
|
|
4
|
+
export declare function registerCoreJobCommand(core: Command): void;
|
|
5
|
+
/** Keep eager `core` registration complete while the jobs fast route loads only its own module. */
|
|
6
|
+
export declare function registerCoreJobsNativeCommand(core: Command): void;
|
|
7
|
+
//# sourceMappingURL=core-job-native.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { registerCoreJobProbeCommand } from "./core-job-probe-native.js";
|
|
2
|
+
import { registerCoreJobRunCommand } from "./core-job-run-native.js";
|
|
3
|
+
import { registerCoreJobsNativeCommand as registerPluralJobsCommand } from "./core-jobs-native.js";
|
|
4
|
+
const JOB_GROUP_DESCRIPTION = "Run or inspect one scheduled job";
|
|
5
|
+
export function registerCoreJobNativeCommand(core) {
|
|
6
|
+
const job = core.command("job").description(JOB_GROUP_DESCRIPTION);
|
|
7
|
+
registerCoreJobProbeCommand(job);
|
|
8
|
+
}
|
|
9
|
+
export function registerCoreJobCommand(core) {
|
|
10
|
+
const job = core.command("job").description(JOB_GROUP_DESCRIPTION);
|
|
11
|
+
registerCoreJobRunCommand(job);
|
|
12
|
+
}
|
|
13
|
+
/** Keep eager `core` registration complete while the jobs fast route loads only its own module. */
|
|
14
|
+
export function registerCoreJobsNativeCommand(core) {
|
|
15
|
+
const job = core.command("job").description(JOB_GROUP_DESCRIPTION);
|
|
16
|
+
registerCoreJobProbeCommand(job);
|
|
17
|
+
registerCoreJobRunCommand(job);
|
|
18
|
+
registerPluralJobsCommand(core);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=core-job-native.js.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
export declare const JOB_PROBE_ASSET = "core/scripts/hq-job-probe.sh";
|
|
3
|
+
export declare const JOB_PROBE_USAGE: string;
|
|
4
|
+
export type Checks = {
|
|
5
|
+
runtime: string;
|
|
6
|
+
auth: string;
|
|
7
|
+
secrets: {
|
|
8
|
+
status: string;
|
|
9
|
+
missing: string[];
|
|
10
|
+
};
|
|
11
|
+
cwd: string;
|
|
12
|
+
company: {
|
|
13
|
+
status: string;
|
|
14
|
+
slug?: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export type ProbeResult = {
|
|
18
|
+
code: number;
|
|
19
|
+
stdout: string;
|
|
20
|
+
stderr: string;
|
|
21
|
+
};
|
|
22
|
+
export type ProbeDeps = {
|
|
23
|
+
root: string;
|
|
24
|
+
home: string;
|
|
25
|
+
env: Record<string, string | undefined>;
|
|
26
|
+
now: () => Date;
|
|
27
|
+
sleep: (seconds: number) => Promise<void>;
|
|
28
|
+
statSize: (file: string) => number | undefined;
|
|
29
|
+
isFile: (file: string) => boolean;
|
|
30
|
+
isDirectory: (file: string) => boolean;
|
|
31
|
+
realpath: (file: string) => string | undefined;
|
|
32
|
+
readText: (file: string) => string;
|
|
33
|
+
writeState: (file: string, body: string) => void;
|
|
34
|
+
writeStderr: (line: string) => void;
|
|
35
|
+
listSecrets: (company?: string) => Promise<{
|
|
36
|
+
code: number;
|
|
37
|
+
stdout: string;
|
|
38
|
+
}>;
|
|
39
|
+
commandExists: (name: string) => boolean;
|
|
40
|
+
fetcher: (url: string, init: RequestInit) => Promise<Response>;
|
|
41
|
+
};
|
|
42
|
+
export declare function defaultProbeDeps(root: string, env?: Record<string, string | undefined>): ProbeDeps;
|
|
43
|
+
export declare function runJobProbe(argv: string[], injected?: ProbeDeps): Promise<ProbeResult>;
|
|
44
|
+
export declare function registerCoreJobProbeCommand(job: Command): void;
|
|
45
|
+
//# sourceMappingURL=core-job-probe-native.d.ts.map
|