@indigoai-us/hq-cli 5.322.0 → 5.324.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 (90) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/assets/scaffold/core/scripts/derive-trigger-facts.sh +263 -0
  3. package/assets/scaffold/core/scripts/lib/transcript-tail.sh +98 -0
  4. package/assets/scaffold/core/scripts/lib/trigger-fact-text.awk +86 -0
  5. package/dist/bin/hq-auth-refresh.d.ts +5 -1
  6. package/dist/bin/hq-auth-refresh.js +33 -1
  7. package/dist/command-catalog.generated.d.ts +138 -6
  8. package/dist/command-catalog.generated.js +178 -6
  9. package/dist/command-registration-plan.d.ts +24 -0
  10. package/dist/command-registration-plan.js +4 -0
  11. package/dist/commands/anywhere-runtime-flag.d.ts +9 -0
  12. package/dist/commands/anywhere-runtime-flag.js +22 -0
  13. package/dist/commands/cloud.js +23 -4
  14. package/dist/commands/core-derive-trigger-facts-command.d.ts +3 -0
  15. package/dist/commands/core-derive-trigger-facts-command.js +47 -0
  16. package/dist/commands/core-derive-trigger-facts-native.d.ts +21 -0
  17. package/dist/commands/core-derive-trigger-facts-native.js +492 -0
  18. package/dist/commands/core.js +6 -0
  19. package/dist/commands/daemon.js +39 -2
  20. package/dist/commands/db-provision.js +6 -1
  21. package/dist/commands/doctor.js +8 -4
  22. package/dist/commands/feedback.d.ts +2 -0
  23. package/dist/commands/feedback.js +10 -0
  24. package/dist/commands/install-global.d.ts +46 -0
  25. package/dist/commands/install-global.js +674 -0
  26. package/dist/commands/link.d.ts +30 -0
  27. package/dist/commands/link.js +184 -0
  28. package/dist/commands/mcp-status.d.ts +6 -0
  29. package/dist/commands/mcp-status.js +21 -4
  30. package/dist/commands/pkg-install.js +20 -1
  31. package/dist/commands/update.d.ts +19 -0
  32. package/dist/commands/update.js +52 -6
  33. package/dist/fast-core.d.ts +2 -1
  34. package/dist/fast-core.js +12 -8
  35. package/dist/fast-scaffold.js +13 -0
  36. package/dist/index.js +9 -7
  37. package/dist/lib/cli-invite-nudge.d.ts +25 -0
  38. package/dist/lib/cli-invite-nudge.js +152 -0
  39. package/dist/lib/core-utils/timeout-guard-native-flags.d.ts +6 -0
  40. package/dist/lib/core-utils/timeout-guard-native-flags.js +30 -0
  41. package/dist/lib/core-utils/timeout-guard-native.d.ts +0 -3
  42. package/dist/lib/core-utils/timeout-guard-native.js +4 -30
  43. package/dist/lib/core-utils/timeout-guard.d.ts +2 -0
  44. package/dist/lib/core-utils/timeout-guard.js +2 -1
  45. package/dist/lib/daemon/convergence.d.ts +42 -0
  46. package/dist/lib/daemon/convergence.js +66 -0
  47. package/dist/lib/daemon/heartbeat.d.ts +43 -0
  48. package/dist/lib/daemon/heartbeat.js +70 -0
  49. package/dist/lib/daemon/ops/journal.d.ts +29 -0
  50. package/dist/lib/daemon/ops/journal.js +141 -0
  51. package/dist/lib/daemon/ops/memory.d.ts +20 -0
  52. package/dist/lib/daemon/ops/memory.js +65 -0
  53. package/dist/lib/daemon/ops/mesh.d.ts +38 -0
  54. package/dist/lib/daemon/ops/mesh.js +70 -0
  55. package/dist/lib/daemon/ops/policy.d.ts +78 -0
  56. package/dist/lib/daemon/ops/policy.js +283 -0
  57. package/dist/lib/daemon/protocol.d.ts +68 -0
  58. package/dist/lib/daemon/protocol.js +154 -0
  59. package/dist/lib/daemon/run.d.ts +10 -0
  60. package/dist/lib/daemon/run.js +85 -3
  61. package/dist/lib/daemon/server.d.ts +36 -0
  62. package/dist/lib/daemon/server.js +306 -0
  63. package/dist/lib/daemon/session-registry.d.ts +30 -0
  64. package/dist/lib/daemon/session-registry.js +42 -0
  65. package/dist/lib/doctor/checks/anywhere.d.ts +38 -0
  66. package/dist/lib/doctor/checks/anywhere.js +182 -0
  67. package/dist/lib/doctor/registry.js +6 -0
  68. package/dist/lib/first-sync-next-step.d.ts +10 -1
  69. package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
  70. package/dist/lib/flag-registry-worker-source.generated.js +1 -1
  71. package/dist/lib/install/claude-targets.d.ts +47 -0
  72. package/dist/lib/install/claude-targets.js +203 -0
  73. package/dist/lib/install/codex-targets.d.ts +57 -0
  74. package/dist/lib/install/codex-targets.js +187 -0
  75. package/dist/lib/mesh/live/session-seq.js +62 -9
  76. package/dist/lib/registry/normalize-remote.d.ts +21 -0
  77. package/dist/lib/registry/normalize-remote.js +68 -0
  78. package/dist/lib/registry/registry.d.ts +75 -0
  79. package/dist/lib/registry/registry.js +261 -0
  80. package/dist/main.js +3 -1
  81. package/dist/utils/cli-telemetry.d.ts +11 -0
  82. package/dist/utils/cli-telemetry.js +76 -0
  83. package/dist/utils/cognito-session.d.ts +5 -1
  84. package/dist/utils/cognito-session.js +8 -12
  85. package/dist/utils/feedback-diagnostics.d.ts +2 -0
  86. package/dist/utils/run-bundled-script.d.ts +7 -4
  87. package/dist/utils/run-bundled-script.js +47 -12
  88. package/dist/utils/version-check.d.ts +2 -0
  89. package/dist/utils/version-check.js +7 -0
  90. package/package.json +2 -2
@@ -96,10 +96,10 @@ export declare const COMMAND_CATALOG: readonly [{
96
96
  readonly description: "Install a package. Sources: bare slug (registry, Cognito-gated), @scope/name[@ver] (npm pack), git URL[#ref], or local path.";
97
97
  readonly aliases: readonly [];
98
98
  readonly hidden: false;
99
- readonly usage: "[options] <source>";
99
+ readonly usage: "[options] [source]";
100
100
  readonly arguments: readonly [{
101
101
  readonly name: "source";
102
- readonly required: true;
102
+ readonly required: false;
103
103
  readonly variadic: false;
104
104
  }];
105
105
  readonly options: readonly [{
@@ -114,6 +114,18 @@ export declare const COMMAND_CATALOG: readonly [{
114
114
  }, {
115
115
  readonly flags: "--branch";
116
116
  readonly description: "Follow a ref instead of SHA-pinning (git content-pack flow)";
117
+ }, {
118
+ readonly flags: "--global";
119
+ readonly description: "Install HQ into an agent runtime at user scope (requires the hq-anywhere-runtime flag)";
120
+ }, {
121
+ readonly flags: "--runtime <runtime>";
122
+ readonly description: "Runtime for --global (claude | codex)";
123
+ }, {
124
+ readonly flags: "--dry-run";
125
+ readonly description: "With --global: print every file and config diff without writing";
126
+ }, {
127
+ readonly flags: "--hq-root <dir>";
128
+ readonly description: "With --global: HQ checkout to install from (default: walk up from cwd)";
117
129
  }];
118
130
  readonly subcommands: readonly [];
119
131
  }, {
@@ -368,10 +380,10 @@ export declare const COMMAND_CATALOG: readonly [{
368
380
  readonly description: "Install a package. Sources: bare slug (registry, Cognito-gated), @scope/name[@ver] (npm pack), git URL[#ref], or local path.";
369
381
  readonly aliases: readonly [];
370
382
  readonly hidden: false;
371
- readonly usage: "[options] <source>";
383
+ readonly usage: "[options] [source]";
372
384
  readonly arguments: readonly [{
373
385
  readonly name: "source";
374
- readonly required: true;
386
+ readonly required: false;
375
387
  readonly variadic: false;
376
388
  }];
377
389
  readonly options: readonly [{
@@ -386,6 +398,18 @@ export declare const COMMAND_CATALOG: readonly [{
386
398
  }, {
387
399
  readonly flags: "--branch";
388
400
  readonly description: "Follow a ref instead of SHA-pinning (git content-pack flow)";
401
+ }, {
402
+ readonly flags: "--global";
403
+ readonly description: "Install HQ into an agent runtime at user scope (requires the hq-anywhere-runtime flag)";
404
+ }, {
405
+ readonly flags: "--runtime <runtime>";
406
+ readonly description: "Runtime for --global (claude | codex)";
407
+ }, {
408
+ readonly flags: "--dry-run";
409
+ readonly description: "With --global: print every file and config diff without writing";
410
+ }, {
411
+ readonly flags: "--hq-root <dir>";
412
+ readonly description: "With --global: HQ checkout to install from (default: walk up from cwd)";
389
413
  }];
390
414
  readonly subcommands: readonly [];
391
415
  }, {
@@ -839,6 +863,79 @@ export declare const COMMAND_CATALOG: readonly [{
839
863
  readonly description: "Also report this company's workspace plan state (Starter nag)";
840
864
  }];
841
865
  readonly subcommands: readonly [];
866
+ }, {
867
+ readonly name: "link";
868
+ readonly description: "Link this folder (or its git remote) to an HQ company";
869
+ readonly aliases: readonly [];
870
+ readonly hidden: false;
871
+ readonly usage: "[options] [company]";
872
+ readonly arguments: readonly [{
873
+ readonly name: "company";
874
+ readonly required: false;
875
+ readonly variadic: false;
876
+ }];
877
+ readonly options: readonly [{
878
+ readonly flags: "--path <dir>";
879
+ readonly description: "Folder to link (default: current directory)";
880
+ }, {
881
+ readonly flags: "--list";
882
+ readonly description: "Print every linked folder";
883
+ }, {
884
+ readonly flags: "--json";
885
+ readonly description: "Print JSON output";
886
+ }, {
887
+ readonly flags: "--seed-manifest <hqRoot>";
888
+ readonly description: "Seed entries from an HQ companies/manifest.yaml";
889
+ }];
890
+ readonly subcommands: readonly [];
891
+ }, {
892
+ readonly name: "unlink";
893
+ readonly description: "Remove the HQ company link for this folder";
894
+ readonly aliases: readonly [];
895
+ readonly hidden: false;
896
+ readonly usage: "[options]";
897
+ readonly arguments: readonly [];
898
+ readonly options: readonly [{
899
+ readonly flags: "--path <dir>";
900
+ readonly description: "Folder to unlink (default: current directory)";
901
+ }];
902
+ readonly subcommands: readonly [];
903
+ }, {
904
+ readonly name: "uninstall";
905
+ readonly description: "Remove the HQ global install from an agent runtime (use with --global)";
906
+ readonly aliases: readonly [];
907
+ readonly hidden: false;
908
+ readonly usage: "[options]";
909
+ readonly arguments: readonly [];
910
+ readonly options: readonly [{
911
+ readonly flags: "--global";
912
+ readonly description: "Reverse `hq install --global`";
913
+ }, {
914
+ readonly flags: "--runtime <runtime>";
915
+ readonly description: "Runtime to uninstall from (claude | codex)";
916
+ }, {
917
+ readonly flags: "--dry-run";
918
+ readonly description: "Print what would change without writing";
919
+ }, {
920
+ readonly flags: "--hq-root <dir>";
921
+ readonly description: "HQ checkout (only needed when install state is missing)";
922
+ }];
923
+ readonly subcommands: readonly [];
924
+ }, {
925
+ readonly name: "resolve-company";
926
+ readonly description: "Print the HQ company linked to this folder (never guesses)";
927
+ readonly aliases: readonly [];
928
+ readonly hidden: false;
929
+ readonly usage: "[options]";
930
+ readonly arguments: readonly [];
931
+ readonly options: readonly [{
932
+ readonly flags: "--path <dir>";
933
+ readonly description: "Folder to resolve (default: current directory)";
934
+ }, {
935
+ readonly flags: "--json";
936
+ readonly description: "Print JSON output";
937
+ }];
938
+ readonly subcommands: readonly [];
842
939
  }, {
843
940
  readonly name: "version";
844
941
  readonly description: "Show HQ, CLI, and latest hq-core versions";
@@ -5932,6 +6029,19 @@ export declare const COMMAND_CATALOG: readonly [{
5932
6029
  }];
5933
6030
  readonly options: readonly [];
5934
6031
  readonly subcommands: readonly [];
6032
+ }, {
6033
+ readonly name: "derive-trigger-facts";
6034
+ readonly description: "Build the open fact set for a hook trigger event";
6035
+ readonly aliases: readonly [];
6036
+ readonly hidden: false;
6037
+ readonly usage: "[args...]";
6038
+ readonly arguments: readonly [{
6039
+ readonly name: "args";
6040
+ readonly required: false;
6041
+ readonly variadic: true;
6042
+ }];
6043
+ readonly options: readonly [];
6044
+ readonly subcommands: readonly [];
5935
6045
  }, {
5936
6046
  readonly name: "share-suggestion-state";
5937
6047
  readonly description: "Manage hook share suggestion state";
@@ -9815,6 +9925,25 @@ export declare const COMMAND_CATALOG: readonly [{
9815
9925
  readonly description: "Run as a child of this app (only \"desktop\"), which has handed sync over to the daemon";
9816
9926
  }];
9817
9927
  readonly subcommands: readonly [];
9928
+ }, {
9929
+ readonly name: "call";
9930
+ readonly description: "Send one request to hqd (policy.check, journal.append, memory.get, memory.put, mesh.presence, …) and print the result as JSON";
9931
+ readonly aliases: readonly [];
9932
+ readonly hidden: false;
9933
+ readonly usage: "[options] <op>";
9934
+ readonly arguments: readonly [{
9935
+ readonly name: "op";
9936
+ readonly required: true;
9937
+ readonly variadic: false;
9938
+ }];
9939
+ readonly options: readonly [{
9940
+ readonly flags: "--json <args>";
9941
+ readonly description: "Request args as a JSON object";
9942
+ }, {
9943
+ readonly flags: "--timeout <ms>";
9944
+ readonly description: "Give up after this many milliseconds";
9945
+ }];
9946
+ readonly subcommands: readonly [];
9818
9947
  }, {
9819
9948
  readonly name: "status";
9820
9949
  readonly description: "Show the machine type and each service's state";
@@ -9987,7 +10116,7 @@ export declare const COMMAND_CATALOG: readonly [{
9987
10116
  readonly subcommands: readonly [];
9988
10117
  }, {
9989
10118
  readonly name: "restart";
9990
- readonly description: "Restart one service, or every running service";
10119
+ readonly description: "Restart one service, every service, or the daemon process";
9991
10120
  readonly aliases: readonly [];
9992
10121
  readonly hidden: false;
9993
10122
  readonly usage: "[options] [unit]";
@@ -9996,7 +10125,10 @@ export declare const COMMAND_CATALOG: readonly [{
9996
10125
  readonly required: false;
9997
10126
  readonly variadic: false;
9998
10127
  }];
9999
- readonly options: readonly [];
10128
+ readonly options: readonly [{
10129
+ readonly flags: "--daemon";
10130
+ readonly description: "Restart the supervisor process itself";
10131
+ }];
10000
10132
  readonly subcommands: readonly [];
10001
10133
  }, {
10002
10134
  readonly name: "trigger";
@@ -101,11 +101,11 @@ export const COMMAND_CATALOG = [
101
101
  "description": "Install a package. Sources: bare slug (registry, Cognito-gated), @scope/name[@ver] (npm pack), git URL[#ref], or local path.",
102
102
  "aliases": [],
103
103
  "hidden": false,
104
- "usage": "[options] <source>",
104
+ "usage": "[options] [source]",
105
105
  "arguments": [
106
106
  {
107
107
  "name": "source",
108
- "required": true,
108
+ "required": false,
109
109
  "variadic": false
110
110
  }
111
111
  ],
@@ -125,6 +125,22 @@ export const COMMAND_CATALOG = [
125
125
  {
126
126
  "flags": "--branch",
127
127
  "description": "Follow a ref instead of SHA-pinning (git content-pack flow)"
128
+ },
129
+ {
130
+ "flags": "--global",
131
+ "description": "Install HQ into an agent runtime at user scope (requires the hq-anywhere-runtime flag)"
132
+ },
133
+ {
134
+ "flags": "--runtime <runtime>",
135
+ "description": "Runtime for --global (claude | codex)"
136
+ },
137
+ {
138
+ "flags": "--dry-run",
139
+ "description": "With --global: print every file and config diff without writing"
140
+ },
141
+ {
142
+ "flags": "--hq-root <dir>",
143
+ "description": "With --global: HQ checkout to install from (default: walk up from cwd)"
128
144
  }
129
145
  ],
130
146
  "subcommands": []
@@ -465,11 +481,11 @@ export const COMMAND_CATALOG = [
465
481
  "description": "Install a package. Sources: bare slug (registry, Cognito-gated), @scope/name[@ver] (npm pack), git URL[#ref], or local path.",
466
482
  "aliases": [],
467
483
  "hidden": false,
468
- "usage": "[options] <source>",
484
+ "usage": "[options] [source]",
469
485
  "arguments": [
470
486
  {
471
487
  "name": "source",
472
- "required": true,
488
+ "required": false,
473
489
  "variadic": false
474
490
  }
475
491
  ],
@@ -489,6 +505,22 @@ export const COMMAND_CATALOG = [
489
505
  {
490
506
  "flags": "--branch",
491
507
  "description": "Follow a ref instead of SHA-pinning (git content-pack flow)"
508
+ },
509
+ {
510
+ "flags": "--global",
511
+ "description": "Install HQ into an agent runtime at user scope (requires the hq-anywhere-runtime flag)"
512
+ },
513
+ {
514
+ "flags": "--runtime <runtime>",
515
+ "description": "Runtime for --global (claude | codex)"
516
+ },
517
+ {
518
+ "flags": "--dry-run",
519
+ "description": "With --global: print every file and config diff without writing"
520
+ },
521
+ {
522
+ "flags": "--hq-root <dir>",
523
+ "description": "With --global: HQ checkout to install from (default: walk up from cwd)"
492
524
  }
493
525
  ],
494
526
  "subcommands": []
@@ -1073,6 +1105,100 @@ export const COMMAND_CATALOG = [
1073
1105
  ],
1074
1106
  "subcommands": []
1075
1107
  },
1108
+ {
1109
+ "name": "link",
1110
+ "description": "Link this folder (or its git remote) to an HQ company",
1111
+ "aliases": [],
1112
+ "hidden": false,
1113
+ "usage": "[options] [company]",
1114
+ "arguments": [
1115
+ {
1116
+ "name": "company",
1117
+ "required": false,
1118
+ "variadic": false
1119
+ }
1120
+ ],
1121
+ "options": [
1122
+ {
1123
+ "flags": "--path <dir>",
1124
+ "description": "Folder to link (default: current directory)"
1125
+ },
1126
+ {
1127
+ "flags": "--list",
1128
+ "description": "Print every linked folder"
1129
+ },
1130
+ {
1131
+ "flags": "--json",
1132
+ "description": "Print JSON output"
1133
+ },
1134
+ {
1135
+ "flags": "--seed-manifest <hqRoot>",
1136
+ "description": "Seed entries from an HQ companies/manifest.yaml"
1137
+ }
1138
+ ],
1139
+ "subcommands": []
1140
+ },
1141
+ {
1142
+ "name": "unlink",
1143
+ "description": "Remove the HQ company link for this folder",
1144
+ "aliases": [],
1145
+ "hidden": false,
1146
+ "usage": "[options]",
1147
+ "arguments": [],
1148
+ "options": [
1149
+ {
1150
+ "flags": "--path <dir>",
1151
+ "description": "Folder to unlink (default: current directory)"
1152
+ }
1153
+ ],
1154
+ "subcommands": []
1155
+ },
1156
+ {
1157
+ "name": "uninstall",
1158
+ "description": "Remove the HQ global install from an agent runtime (use with --global)",
1159
+ "aliases": [],
1160
+ "hidden": false,
1161
+ "usage": "[options]",
1162
+ "arguments": [],
1163
+ "options": [
1164
+ {
1165
+ "flags": "--global",
1166
+ "description": "Reverse `hq install --global`"
1167
+ },
1168
+ {
1169
+ "flags": "--runtime <runtime>",
1170
+ "description": "Runtime to uninstall from (claude | codex)"
1171
+ },
1172
+ {
1173
+ "flags": "--dry-run",
1174
+ "description": "Print what would change without writing"
1175
+ },
1176
+ {
1177
+ "flags": "--hq-root <dir>",
1178
+ "description": "HQ checkout (only needed when install state is missing)"
1179
+ }
1180
+ ],
1181
+ "subcommands": []
1182
+ },
1183
+ {
1184
+ "name": "resolve-company",
1185
+ "description": "Print the HQ company linked to this folder (never guesses)",
1186
+ "aliases": [],
1187
+ "hidden": false,
1188
+ "usage": "[options]",
1189
+ "arguments": [],
1190
+ "options": [
1191
+ {
1192
+ "flags": "--path <dir>",
1193
+ "description": "Folder to resolve (default: current directory)"
1194
+ },
1195
+ {
1196
+ "flags": "--json",
1197
+ "description": "Print JSON output"
1198
+ }
1199
+ ],
1200
+ "subcommands": []
1201
+ },
1076
1202
  {
1077
1203
  "name": "version",
1078
1204
  "description": "Show HQ, CLI, and latest hq-core versions",
@@ -7633,6 +7759,22 @@ export const COMMAND_CATALOG = [
7633
7759
  "options": [],
7634
7760
  "subcommands": []
7635
7761
  },
7762
+ {
7763
+ "name": "derive-trigger-facts",
7764
+ "description": "Build the open fact set for a hook trigger event",
7765
+ "aliases": [],
7766
+ "hidden": false,
7767
+ "usage": "[args...]",
7768
+ "arguments": [
7769
+ {
7770
+ "name": "args",
7771
+ "required": false,
7772
+ "variadic": true
7773
+ }
7774
+ ],
7775
+ "options": [],
7776
+ "subcommands": []
7777
+ },
7636
7778
  {
7637
7779
  "name": "share-suggestion-state",
7638
7780
  "description": "Manage hook share suggestion state",
@@ -12645,6 +12787,31 @@ export const COMMAND_CATALOG = [
12645
12787
  ],
12646
12788
  "subcommands": []
12647
12789
  },
12790
+ {
12791
+ "name": "call",
12792
+ "description": "Send one request to hqd (policy.check, journal.append, memory.get, memory.put, mesh.presence, …) and print the result as JSON",
12793
+ "aliases": [],
12794
+ "hidden": false,
12795
+ "usage": "[options] <op>",
12796
+ "arguments": [
12797
+ {
12798
+ "name": "op",
12799
+ "required": true,
12800
+ "variadic": false
12801
+ }
12802
+ ],
12803
+ "options": [
12804
+ {
12805
+ "flags": "--json <args>",
12806
+ "description": "Request args as a JSON object"
12807
+ },
12808
+ {
12809
+ "flags": "--timeout <ms>",
12810
+ "description": "Give up after this many milliseconds"
12811
+ }
12812
+ ],
12813
+ "subcommands": []
12814
+ },
12648
12815
  {
12649
12816
  "name": "status",
12650
12817
  "description": "Show the machine type and each service's state",
@@ -12863,7 +13030,7 @@ export const COMMAND_CATALOG = [
12863
13030
  },
12864
13031
  {
12865
13032
  "name": "restart",
12866
- "description": "Restart one service, or every running service",
13033
+ "description": "Restart one service, every service, or the daemon process",
12867
13034
  "aliases": [],
12868
13035
  "hidden": false,
12869
13036
  "usage": "[options] [unit]",
@@ -12874,7 +13041,12 @@ export const COMMAND_CATALOG = [
12874
13041
  "variadic": false
12875
13042
  }
12876
13043
  ],
12877
- "options": [],
13044
+ "options": [
13045
+ {
13046
+ "flags": "--daemon",
13047
+ "description": "Restart the supervisor process itself"
13048
+ }
13049
+ ],
12878
13050
  "subcommands": []
12879
13051
  },
12880
13052
  {
@@ -177,6 +177,30 @@ export declare const REGISTRATION_PLAN: readonly [{
177
177
  readonly parent: "program";
178
178
  readonly module: "./commands/whoami.js";
179
179
  readonly exportName: "registerWhoamiCommand";
180
+ }, {
181
+ readonly type: "registrar";
182
+ readonly root: "link";
183
+ readonly parent: "program";
184
+ readonly module: "./commands/link.js";
185
+ readonly exportName: "registerLinkCommand";
186
+ }, {
187
+ readonly type: "registrar";
188
+ readonly root: "unlink";
189
+ readonly parent: "program";
190
+ readonly module: "./commands/link.js";
191
+ readonly exportName: "registerUnlinkCommand";
192
+ }, {
193
+ readonly type: "registrar";
194
+ readonly root: "uninstall";
195
+ readonly parent: "program";
196
+ readonly module: "./commands/install-global.js";
197
+ readonly exportName: "registerUninstallCommand";
198
+ }, {
199
+ readonly type: "registrar";
200
+ readonly root: "resolve-company";
201
+ readonly parent: "program";
202
+ readonly module: "./commands/link.js";
203
+ readonly exportName: "registerResolveCompanyCommand";
180
204
  }, {
181
205
  readonly type: "registrar";
182
206
  readonly root: "version";
@@ -32,6 +32,10 @@ export const REGISTRATION_PLAN = [
32
32
  { type: "registrar", root: "login", parent: "program", module: "./commands/login.js", exportName: "registerLoginCommand" },
33
33
  { type: "registrar", root: "logout", parent: "program", module: "./commands/logout.js", exportName: "registerLogoutCommand" },
34
34
  { type: "registrar", root: "whoami", parent: "program", module: "./commands/whoami.js", exportName: "registerWhoamiCommand" },
35
+ { type: "registrar", root: "link", parent: "program", module: "./commands/link.js", exportName: "registerLinkCommand" },
36
+ { type: "registrar", root: "unlink", parent: "program", module: "./commands/link.js", exportName: "registerUnlinkCommand" },
37
+ { type: "registrar", root: "uninstall", parent: "program", module: "./commands/install-global.js", exportName: "registerUninstallCommand" },
38
+ { type: "registrar", root: "resolve-company", parent: "program", module: "./commands/link.js", exportName: "registerResolveCompanyCommand" },
35
39
  { type: "registrar", root: "version", parent: "program", module: "./commands/version.js", exportName: "registerVersionCommand" },
36
40
  { type: "registrar", root: "auth", parent: "program", module: "./commands/auth.js", exportName: "registerAuthCommands" },
37
41
  { type: "registrar", root: "secrets", parent: "program", module: "./commands/secrets.js", exportName: "registerSecretsCommand" },
@@ -0,0 +1,9 @@
1
+ /** hq-flags key for the staged HQ Anywhere runtime. The registry default is off. */
2
+ export declare const HQ_ANYWHERE_RUNTIME_FLAG = "hq-anywhere-runtime";
3
+ export declare class AnywhereRuntimeDisabledError extends Error {
4
+ readonly expected: true;
5
+ constructor();
6
+ }
7
+ export declare function anywhereRuntimeEnabled(env?: NodeJS.ProcessEnv): boolean;
8
+ export declare function requireAnywhereRuntime(): void;
9
+ //# sourceMappingURL=anywhere-runtime-flag.d.ts.map
@@ -0,0 +1,22 @@
1
+ import { resolveFlagGate, resolveProcessFlagGate } from "../lib/flag-registry.js";
2
+ /** hq-flags key for the staged HQ Anywhere runtime. The registry default is off. */
3
+ export const HQ_ANYWHERE_RUNTIME_FLAG = "hq-anywhere-runtime";
4
+ export class AnywhereRuntimeDisabledError extends Error {
5
+ expected = true;
6
+ constructor() {
7
+ super("HQ Anywhere is not enabled. Enable the hq-anywhere-runtime flag to use this command.");
8
+ this.name = "AnywhereRuntimeDisabledError";
9
+ }
10
+ }
11
+ export function anywhereRuntimeEnabled(env = process.env) {
12
+ const fallback = () => false;
13
+ const lookup = { fallback: false };
14
+ return env === process.env
15
+ ? resolveProcessFlagGate(HQ_ANYWHERE_RUNTIME_FLAG, lookup, fallback)
16
+ : resolveFlagGate(undefined, HQ_ANYWHERE_RUNTIME_FLAG, lookup, fallback, env);
17
+ }
18
+ export function requireAnywhereRuntime() {
19
+ if (!anywhereRuntimeEnabled())
20
+ throw new AnywhereRuntimeDisabledError();
21
+ }
22
+ //# sourceMappingURL=anywhere-runtime-flag.js.map
@@ -21,7 +21,8 @@ import { DEFAULT_HQ_ROOT, ensureCognitoToken, buildVaultConfig, } from "../utils
21
21
  import { resolveUploadAuthor } from "../utils/upload-author.js";
22
22
  import { companyFolderExceedsThreshold, emitNarrowHint, isStrictRefusal, resolveBannerLevel, resolveNarrowHintPresentationLevel, resolveNarrowHintMinBytes, } from "../lib/narrow-hint-banner.js";
23
23
  import { beginSyncHealthReport, } from "../utils/client-health.js";
24
- import { recordFirstWorkBearingSync } from "../lib/first-sync-next-step.js";
24
+ import { isWorkBearingSyncResult, recordFirstWorkBearingSync, } from "../lib/first-sync-next-step.js";
25
+ import { maybeShowCliInviteNudge } from "../lib/cli-invite-nudge.js";
25
26
  import { createPlanLimitRefusalTracker, describeRefusedCount, describeRefusedFiles, mergePlanLimitRefusals, renderPlanLimitRefusalLines, trackingProgressRecorder, } from "../lib/billing/plan-limit-refusals.js";
26
27
  import { formatPlanGateError, planGateErrorFromVaultError, } from "../utils/plan-gate-error.js";
27
28
  import { personalTargetedPushPathsEnabled } from "./personal-targeted-push-flag.js";
@@ -663,7 +664,7 @@ function readActiveCompany(hqRoot) {
663
664
  * scope. Returns `undefined` only when no company can be resolved at all (then
664
665
  * `sync()` resolves the active company itself and pulls `all`, as before).
665
666
  */
666
- async function resolveCliPullScope(client, companyRef, hqRoot) {
667
+ async function resolveCliPullScope(client, companyRef, hqRoot, onResolvedCompanyUid) {
667
668
  const ref = companyRef ?? readActiveCompany(hqRoot);
668
669
  if (!ref)
669
670
  return undefined;
@@ -676,6 +677,7 @@ async function resolveCliPullScope(client, companyRef, hqRoot) {
676
677
  const direct = memberships.find((m) => m.companyUid === ref || m.membershipKey === ref);
677
678
  if (direct) {
678
679
  companyUid = direct.companyUid;
680
+ onResolvedCompanyUid?.(companyUid);
679
681
  const ent = await client.entity.get(direct.companyUid).catch(() => null);
680
682
  if (ent?.slug)
681
683
  slug = ent.slug;
@@ -686,6 +688,7 @@ async function resolveCliPullScope(client, companyRef, hqRoot) {
686
688
  if (ent?.slug === ref) {
687
689
  companyUid = m.companyUid;
688
690
  slug = ent.slug;
691
+ onResolvedCompanyUid?.(companyUid);
689
692
  break;
690
693
  }
691
694
  }
@@ -1653,6 +1656,7 @@ async function runNowSingle(hqRoot, company, personal, message, onConflict, mode
1653
1656
  let journalSlug;
1654
1657
  let pushPaths;
1655
1658
  let pushSlug;
1659
+ let nudgeResolvedCompanyUid;
1656
1660
  if (personal) {
1657
1661
  const client = new VaultClient(vaultConfig);
1658
1662
  targetCompany = await resolveCanonicalPersonUid({
@@ -1685,7 +1689,7 @@ async function runNowSingle(hqRoot, company, personal, message, onConflict, mode
1685
1689
  let nowPushPrefixSet;
1686
1690
  if (!personalMode) {
1687
1691
  const scopeClient = new VaultClient(vaultConfig);
1688
- const pushScope = await resolveCliPullScope(scopeClient, targetCompany, hqRoot);
1692
+ const pushScope = await resolveCliPullScope(scopeClient, targetCompany ?? pushSlug, hqRoot, (companyUid) => { nudgeResolvedCompanyUid = companyUid; });
1689
1693
  nowPushPrefixSet = pushScope?.prefixSet;
1690
1694
  }
1691
1695
  const pushProgressCompany = personalMode ? null : (pushSlug ?? null);
@@ -1741,7 +1745,7 @@ async function runNowSingle(hqRoot, company, personal, message, onConflict, mode
1741
1745
  // without burning a sync.
1742
1746
  const narrowHintLevel = resolveBannerLevel();
1743
1747
  let resolvedMode;
1744
- let resolvedCompanyUid;
1748
+ let resolvedCompanyUid = nudgeResolvedCompanyUid;
1745
1749
  if (!personalMode && targetCompany) {
1746
1750
  try {
1747
1751
  const client = new VaultClient(vaultConfig);
@@ -1845,6 +1849,21 @@ async function runNowSingle(hqRoot, company, personal, message, onConflict, mode
1845
1849
  throw new SyncExitError(1, { health: "succeeded" });
1846
1850
  }
1847
1851
  console.log(chalk.green("\n✓ Sync now complete"));
1852
+ if (!personalMode &&
1853
+ nudgeResolvedCompanyUid &&
1854
+ (isWorkBearingSyncResult(pushResult) || isWorkBearingSyncResult(pullResult))) {
1855
+ try {
1856
+ await maybeShowCliInviteNudge({
1857
+ companyUid: nudgeResolvedCompanyUid,
1858
+ companyRef: pushSlug ?? targetCompany ?? "",
1859
+ accessToken,
1860
+ });
1861
+ }
1862
+ catch (error) {
1863
+ const errorClass = error instanceof Error ? error.name : "unknown";
1864
+ console.error(`hq: Could not show the teammate invite prompt (${errorClass}); sync is complete.`);
1865
+ }
1866
+ }
1848
1867
  }
1849
1868
  catch (err) {
1850
1869
  if (err instanceof SyncExitError)
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare function registerCoreDeriveTriggerFactsCommand(core: Command): void;
3
+ //# sourceMappingURL=core-derive-trigger-facts-command.d.ts.map
@@ -0,0 +1,47 @@
1
+ import { resolveLiveRoot } from "../utils/hq-roots.js";
2
+ import { runBundledScript } from "../utils/run-bundled-script.js";
3
+ import { describeCoreCommand } from "./core-command-catalog.js";
4
+ import { coreNativeHookHelpersEnabled } from "./core-native-hook-helpers-flag.js";
5
+ import { DERIVE_TRIGGER_FACTS_ASSET, runDeriveTriggerFacts, } from "./core-derive-trigger-facts-native.js";
6
+ export function registerCoreDeriveTriggerFactsCommand(core) {
7
+ const liveRoot = () => resolveLiveRoot({ hqRoot: core.opts().hqRoot });
8
+ const command = core
9
+ .command("derive-trigger-facts")
10
+ .description("Build the open fact set for a hook trigger event")
11
+ .allowUnknownOption()
12
+ .allowExcessArguments()
13
+ .helpOption(false)
14
+ .argument("[args...]")
15
+ .action(async (args = [], _options, commandContext) => {
16
+ if (!await coreNativeHookHelpersEnabled()) {
17
+ const root = liveRoot();
18
+ const result = runBundledScript({
19
+ asset: DERIVE_TRIGGER_FACTS_ASSET,
20
+ args: commandContext.args.length ? commandContext.args : args,
21
+ cwd: root,
22
+ hqRoot: root,
23
+ });
24
+ if (result.code !== 0)
25
+ process.exit(result.code);
26
+ return;
27
+ }
28
+ const chunks = [];
29
+ for await (const chunk of process.stdin)
30
+ chunks.push(chunk);
31
+ const root = liveRoot();
32
+ const result = runDeriveTriggerFacts({
33
+ argv: commandContext.args.length ? commandContext.args : args,
34
+ stdin: Buffer.concat(chunks).toString("utf8"),
35
+ cwd: process.cwd(),
36
+ hqRoot: root,
37
+ });
38
+ if (result.stdout.length)
39
+ process.stdout.write(result.stdout);
40
+ if (result.stderr.length)
41
+ process.stderr.write(result.stderr);
42
+ if (result.code !== 0)
43
+ process.exit(result.code);
44
+ });
45
+ describeCoreCommand(command, { execution: "native", asset: DERIVE_TRIGGER_FACTS_ASSET, root: "live" });
46
+ }
47
+ //# sourceMappingURL=core-derive-trigger-facts-command.js.map