@indigoai-us/hq-cli 5.311.4 → 5.312.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.
Files changed (96) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/assets/scaffold/core/scripts/lib/work-mesh-live-hook.sh +378 -0
  3. package/assets/scaffold/core/scripts/lib/work-mesh-live-rebind.sh +141 -0
  4. package/assets/scaffold/core/scripts/migrate-policy-triggers.sh +373 -0
  5. package/assets/scaffold/core/scripts/register-project.sh +262 -0
  6. package/assets/scaffold/core/scripts/work-mesh-live-rebind.sh +59 -0
  7. package/dist/command-catalog.generated.d.ts +160 -0
  8. package/dist/command-catalog.generated.js +200 -0
  9. package/dist/command-registration-plan.d.ts +6 -0
  10. package/dist/command-registration-plan.js +1 -0
  11. package/dist/commands/company-rename-flag.d.ts +4 -0
  12. package/dist/commands/company-rename-flag.js +7 -0
  13. package/dist/commands/company-rename.d.ts +4 -0
  14. package/dist/commands/company-rename.js +90 -0
  15. package/dist/commands/company.js +2 -0
  16. package/dist/commands/core-checkpoint-stop-gate-native.js +12 -0
  17. package/dist/commands/core-eval-trigger-native.d.ts +4 -0
  18. package/dist/commands/core-eval-trigger-native.js +12 -0
  19. package/dist/commands/core-migrate-policy-triggers-native.d.ts +21 -0
  20. package/dist/commands/core-migrate-policy-triggers-native.js +378 -0
  21. package/dist/commands/core-native-hook-helper-commands.d.ts +4 -0
  22. package/dist/commands/core-native-hook-helper-commands.js +56 -0
  23. package/dist/commands/core-native-hook-helpers-flag.d.ts +4 -0
  24. package/dist/commands/core-native-hook-helpers-flag.js +7 -0
  25. package/dist/commands/core-register-project-native.d.ts +30 -0
  26. package/dist/commands/core-register-project-native.js +347 -0
  27. package/dist/commands/core-work-mesh-live-rebind-native.d.ts +18 -0
  28. package/dist/commands/core-work-mesh-live-rebind-native.js +262 -0
  29. package/dist/commands/core.js +7 -0
  30. package/dist/commands/daemon.js +22 -0
  31. package/dist/commands/dm.js +22 -6
  32. package/dist/commands/files-browse.js +16 -4
  33. package/dist/commands/lanes-message.js +17 -2
  34. package/dist/commands/lanes-shared.d.ts +1 -0
  35. package/dist/commands/lanes.js +96 -20
  36. package/dist/commands/vault-retention-flag.d.ts +3 -0
  37. package/dist/commands/vault-retention-flag.js +9 -0
  38. package/dist/commands/vault-retention.d.ts +11 -0
  39. package/dist/commands/vault-retention.js +69 -0
  40. package/dist/fast-core.js +10 -3
  41. package/dist/fast-scaffold.d.ts +2 -0
  42. package/dist/fast-scaffold.js +11 -0
  43. package/dist/lib/agents/model-catalog.d.ts +3 -2
  44. package/dist/lib/company-skill-wrapper.d.ts +0 -8
  45. package/dist/lib/core-utils/codex-skill-bridge.d.ts +2 -1
  46. package/dist/lib/core-utils/sentry-report.js +21 -4
  47. package/dist/lib/daemon/catalog.d.ts +2 -0
  48. package/dist/lib/daemon/catalog.js +13 -1
  49. package/dist/lib/daemon/config.d.ts +2 -0
  50. package/dist/lib/daemon/config.js +4 -0
  51. package/dist/lib/daemon/run.d.ts +2 -0
  52. package/dist/lib/daemon/run.js +5 -0
  53. package/dist/lib/deploy-api.d.ts +0 -1
  54. package/dist/lib/deploy-api.js +1 -1
  55. package/dist/lib/doctor/checks/work-context.js +9 -1
  56. package/dist/lib/lanes/autopilot.d.ts +38 -1
  57. package/dist/lib/lanes/autopilot.js +353 -5
  58. package/dist/lib/lanes/flag-keys.d.ts +9 -1
  59. package/dist/lib/lanes/flag-keys.js +9 -1
  60. package/dist/lib/lanes/keep-alive.d.ts +2 -0
  61. package/dist/lib/lanes/keep-alive.js +2 -0
  62. package/dist/lib/lanes/reconcile.d.ts +5 -0
  63. package/dist/lib/lanes/reconcile.js +57 -4
  64. package/dist/lib/lanes/watcher-main.js +20 -1
  65. package/dist/lib/lanes/watcher.d.ts +9 -0
  66. package/dist/lib/lanes/watcher.js +47 -1
  67. package/dist/lib/mesh/client.js +23 -5
  68. package/dist/lib/mesh/denial-codes.d.ts +5 -0
  69. package/dist/lib/mesh/denial-codes.js +14 -0
  70. package/dist/lib/mesh/live/daemon/doctor.d.ts +2 -0
  71. package/dist/lib/mesh/live/daemon/doctor.js +11 -1
  72. package/dist/lib/report-run.d.ts +3 -2
  73. package/dist/lib/report-templates.d.ts +0 -1
  74. package/dist/lib/report-templates.js +0 -3
  75. package/dist/lib/scaffold-cli-floor.d.ts +0 -1
  76. package/dist/lib/scaffold-cli-floor.js +1 -1
  77. package/dist/lib/search-index/embed-lock.d.ts +2 -0
  78. package/dist/lib/search-index/embed-lock.js +10 -1
  79. package/dist/lib/work-context/contract.d.ts +3 -0
  80. package/dist/lib/work-context/contract.schema.json +3 -1
  81. package/dist/lib/work-context/outbox.d.ts +14 -5
  82. package/dist/lib/work-context/outbox.js +48 -5
  83. package/dist/lib/work-context/reconcile.js +26 -5
  84. package/dist/main.d.ts +20 -0
  85. package/dist/main.js +8 -1
  86. package/dist/run/discover-schemas.d.ts +2 -1
  87. package/dist/utils/core-eval-trigger.d.ts +4 -0
  88. package/dist/utils/core-eval-trigger.js +88 -0
  89. package/dist/utils/hq-roots.d.ts +0 -2
  90. package/dist/utils/hq-roots.js +1 -8
  91. package/dist/utils/incomplete-install-error.d.ts +7 -6
  92. package/dist/utils/large-file-guard.d.ts +0 -10
  93. package/dist/utils/large-file-guard.js +1 -1
  94. package/dist/utils/package-root-diagnostics.d.ts +1 -1
  95. package/dist/utils/self-update.d.ts +2 -1
  96. package/package.json +1 -1
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env bash
2
+ # hq-core: public
3
+ # US-011 — enqueue session_end/session_start when project binding changes.
4
+ # Usage:
5
+ # work-mesh-live-rebind.sh --session <sid>
6
+ # Read state file and rebind if project changed vs live-binding marker.
7
+ # work-mesh-live-rebind.sh --session <sid> \
8
+ # --old-company C --old-project P [--old-task T] \
9
+ # --company C2 --project P2 [--task T2]
10
+ set -euo pipefail
11
+
12
+ ROOT="${HQ_ROOT:-${CLAUDE_PROJECT_DIR:-}}"
13
+ if [ -z "$ROOT" ]; then
14
+ ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
15
+ fi
16
+ export HQ_ROOT="$ROOT"
17
+
18
+ # shellcheck source=lib/work-mesh-enqueue.sh
19
+ . "$ROOT/core/scripts/lib/work-mesh-enqueue.sh"
20
+ # shellcheck source=lib/work-mesh-live-hook.sh
21
+ . "$ROOT/core/scripts/lib/work-mesh-live-hook.sh" 2>/dev/null || true
22
+ # shellcheck source=lib/work-mesh-live-rebind.sh
23
+ . "$ROOT/core/scripts/lib/work-mesh-live-rebind.sh"
24
+
25
+ SID=""
26
+ OLD_CO="" OLD_PR="" OLD_TK=""
27
+ NEW_CO="" NEW_PR="" NEW_TK=""
28
+ FROM_STATE=0
29
+
30
+ while [ $# -gt 0 ]; do
31
+ case "$1" in
32
+ --session|--session-id) SID="${2:-}"; shift 2 ;;
33
+ --old-company) OLD_CO="${2:-}"; shift 2 ;;
34
+ --old-project) OLD_PR="${2:-}"; shift 2 ;;
35
+ --old-task) OLD_TK="${2:-}"; shift 2 ;;
36
+ --company|--company-slug) NEW_CO="${2:-}"; shift 2 ;;
37
+ --project) NEW_PR="${2:-}"; shift 2 ;;
38
+ --task) NEW_TK="${2:-}"; shift 2 ;;
39
+ --from-state) FROM_STATE=1; shift ;;
40
+ *) shift ;;
41
+ esac
42
+ done
43
+
44
+ [ -n "$SID" ] || { echo "usage: work-mesh-live-rebind.sh --session <sid> ..." >&2; exit 1; }
45
+
46
+ if [ "$FROM_STATE" -eq 1 ] || [ -z "$NEW_PR" ]; then
47
+ work_mesh_live_maybe_rebind_from_state "$SID"
48
+ else
49
+ if [ -z "$OLD_PR" ]; then
50
+ work_mesh_live_read_binding_marker "$SID"
51
+ old=$REPLY
52
+ OLD_CO="${old%%|*}"
53
+ rest="${old#*|}"
54
+ OLD_PR="${rest%%|*}"
55
+ OLD_TK="${rest#*|}"
56
+ fi
57
+ work_mesh_live_rebind "$SID" "$OLD_CO" "$OLD_PR" "$OLD_TK" "$NEW_CO" "$NEW_PR" "$NEW_TK"
58
+ fi
59
+ exit 0
@@ -3826,6 +3826,19 @@ export declare const COMMAND_CATALOG: readonly [{
3826
3826
  }];
3827
3827
  readonly subcommands: readonly [];
3828
3828
  }];
3829
+ }, {
3830
+ readonly name: "rename";
3831
+ readonly description: "Rename a cloud-backed company display name";
3832
+ readonly aliases: readonly [];
3833
+ readonly hidden: false;
3834
+ readonly usage: "[options] <new-name>";
3835
+ readonly arguments: readonly [{
3836
+ readonly name: "new-name";
3837
+ readonly required: true;
3838
+ readonly variadic: false;
3839
+ }];
3840
+ readonly options: readonly [];
3841
+ readonly subcommands: readonly [];
3829
3842
  }, {
3830
3843
  readonly name: "settings";
3831
3844
  readonly description: "Per-company settings (owner-only)";
@@ -5071,6 +5084,49 @@ export declare const COMMAND_CATALOG: readonly [{
5071
5084
  readonly subcommands: readonly [];
5072
5085
  }];
5073
5086
  }];
5087
+ }, {
5088
+ readonly name: "vault";
5089
+ readonly description: "Manage HQ vault settings";
5090
+ readonly aliases: readonly [];
5091
+ readonly hidden: false;
5092
+ readonly usage: "[options] [command]";
5093
+ readonly arguments: readonly [];
5094
+ readonly options: readonly [];
5095
+ readonly subcommands: readonly [{
5096
+ readonly name: "retention";
5097
+ readonly description: "Get or set the default retention for future vault object versions";
5098
+ readonly aliases: readonly [];
5099
+ readonly hidden: false;
5100
+ readonly usage: "[options] [command]";
5101
+ readonly arguments: readonly [];
5102
+ readonly options: readonly [{
5103
+ readonly flags: "--company <slug>";
5104
+ readonly description: "Company vault slug (omit for your personal vault)";
5105
+ }];
5106
+ readonly subcommands: readonly [{
5107
+ readonly name: "get";
5108
+ readonly description: "Show the vault's default retention in days";
5109
+ readonly aliases: readonly [];
5110
+ readonly hidden: false;
5111
+ readonly usage: "[options]";
5112
+ readonly arguments: readonly [];
5113
+ readonly options: readonly [];
5114
+ readonly subcommands: readonly [];
5115
+ }, {
5116
+ readonly name: "set";
5117
+ readonly description: "Set the vault's default retention in days (1-30)";
5118
+ readonly aliases: readonly [];
5119
+ readonly hidden: false;
5120
+ readonly usage: "[options] <days>";
5121
+ readonly arguments: readonly [{
5122
+ readonly name: "days";
5123
+ readonly required: true;
5124
+ readonly variadic: false;
5125
+ }];
5126
+ readonly options: readonly [];
5127
+ readonly subcommands: readonly [];
5128
+ }];
5129
+ }];
5074
5130
  }, {
5075
5131
  readonly name: "core";
5076
5132
  readonly description: "HQ scaffold scripts hosted by the CLI (core; not a stable surface)";
@@ -5824,6 +5880,58 @@ export declare const COMMAND_CATALOG: readonly [{
5824
5880
  }];
5825
5881
  readonly options: readonly [];
5826
5882
  readonly subcommands: readonly [];
5883
+ }, {
5884
+ readonly name: "eval-trigger";
5885
+ readonly description: "Evaluate policy trigger expressions";
5886
+ readonly aliases: readonly [];
5887
+ readonly hidden: false;
5888
+ readonly usage: "[args...]";
5889
+ readonly arguments: readonly [{
5890
+ readonly name: "args";
5891
+ readonly required: false;
5892
+ readonly variadic: true;
5893
+ }];
5894
+ readonly options: readonly [];
5895
+ readonly subcommands: readonly [];
5896
+ }, {
5897
+ readonly name: "migrate-policy-triggers";
5898
+ readonly description: "Backfill policy trigger frontmatter";
5899
+ readonly aliases: readonly [];
5900
+ readonly hidden: false;
5901
+ readonly usage: "[args...]";
5902
+ readonly arguments: readonly [{
5903
+ readonly name: "args";
5904
+ readonly required: false;
5905
+ readonly variadic: true;
5906
+ }];
5907
+ readonly options: readonly [];
5908
+ readonly subcommands: readonly [];
5909
+ }, {
5910
+ readonly name: "register-project";
5911
+ readonly description: "Register a project with Work Mesh";
5912
+ readonly aliases: readonly [];
5913
+ readonly hidden: false;
5914
+ readonly usage: "[args...]";
5915
+ readonly arguments: readonly [{
5916
+ readonly name: "args";
5917
+ readonly required: false;
5918
+ readonly variadic: true;
5919
+ }];
5920
+ readonly options: readonly [];
5921
+ readonly subcommands: readonly [];
5922
+ }, {
5923
+ readonly name: "work-mesh-live-rebind";
5924
+ readonly description: "Rebind a live Work Mesh session to its current project";
5925
+ readonly aliases: readonly [];
5926
+ readonly hidden: false;
5927
+ readonly usage: "[args...]";
5928
+ readonly arguments: readonly [{
5929
+ readonly name: "args";
5930
+ readonly required: false;
5931
+ readonly variadic: true;
5932
+ }];
5933
+ readonly options: readonly [];
5934
+ readonly subcommands: readonly [];
5827
5935
  }, {
5828
5936
  readonly name: "worktree-gc";
5829
5937
  readonly description: "Safely collect old, preserved HQ worktrees";
@@ -8630,6 +8738,9 @@ export declare const COMMAND_CATALOG: readonly [{
8630
8738
  readonly options: readonly [{
8631
8739
  readonly flags: "--text <msg>";
8632
8740
  readonly description: "Message text";
8741
+ }, {
8742
+ readonly flags: "--text-file <path>";
8743
+ readonly description: "Read message text from a file";
8633
8744
  }, {
8634
8745
  readonly flags: "--project <slug>";
8635
8746
  readonly description: "Re-point project attribution; a changed story is named in the resumed prompt";
@@ -9292,6 +9403,30 @@ export declare const COMMAND_CATALOG: readonly [{
9292
9403
  }];
9293
9404
  readonly subcommands: readonly [];
9294
9405
  }];
9406
+ }, {
9407
+ readonly name: "_keep-alive-terminal-trigger";
9408
+ readonly description: "";
9409
+ readonly aliases: readonly [];
9410
+ readonly hidden: true;
9411
+ readonly usage: "[options] <laneId> <version> <dueAt>";
9412
+ readonly arguments: readonly [{
9413
+ readonly name: "laneId";
9414
+ readonly required: true;
9415
+ readonly variadic: false;
9416
+ }, {
9417
+ readonly name: "version";
9418
+ readonly required: true;
9419
+ readonly variadic: false;
9420
+ }, {
9421
+ readonly name: "dueAt";
9422
+ readonly required: true;
9423
+ readonly variadic: false;
9424
+ }];
9425
+ readonly options: readonly [{
9426
+ readonly flags: "--json";
9427
+ readonly description: "JSON on stdout (always)";
9428
+ }];
9429
+ readonly subcommands: readonly [];
9295
9430
  }];
9296
9431
  }, {
9297
9432
  readonly name: "monitor";
@@ -9551,6 +9686,31 @@ export declare const COMMAND_CATALOG: readonly [{
9551
9686
  readonly description: "Print machine-readable JSON";
9552
9687
  }];
9553
9688
  readonly subcommands: readonly [];
9689
+ }, {
9690
+ readonly name: "instant-sync";
9691
+ readonly description: "Control daemon Instant Sync";
9692
+ readonly aliases: readonly [];
9693
+ readonly hidden: false;
9694
+ readonly usage: "[options] [command]";
9695
+ readonly arguments: readonly [];
9696
+ readonly options: readonly [];
9697
+ readonly subcommands: readonly [{
9698
+ readonly name: "set";
9699
+ readonly description: "Set whether daemon sync uses Instant Sync";
9700
+ readonly aliases: readonly [];
9701
+ readonly hidden: false;
9702
+ readonly usage: "[options] <state>";
9703
+ readonly arguments: readonly [{
9704
+ readonly name: "state";
9705
+ readonly required: true;
9706
+ readonly variadic: false;
9707
+ }];
9708
+ readonly options: readonly [{
9709
+ readonly flags: "--json";
9710
+ readonly description: "Print machine-readable JSON";
9711
+ }];
9712
+ readonly subcommands: readonly [];
9713
+ }];
9554
9714
  }, {
9555
9715
  readonly name: "pause";
9556
9716
  readonly description: "Pause daemon sync until resumed";
@@ -4940,6 +4940,22 @@ export const COMMAND_CATALOG = [
4940
4940
  }
4941
4941
  ]
4942
4942
  },
4943
+ {
4944
+ "name": "rename",
4945
+ "description": "Rename a cloud-backed company display name",
4946
+ "aliases": [],
4947
+ "hidden": false,
4948
+ "usage": "[options] <new-name>",
4949
+ "arguments": [
4950
+ {
4951
+ "name": "new-name",
4952
+ "required": true,
4953
+ "variadic": false
4954
+ }
4955
+ ],
4956
+ "options": [],
4957
+ "subcommands": []
4958
+ },
4943
4959
  {
4944
4960
  "name": "settings",
4945
4961
  "description": "Per-company settings (owner-only)",
@@ -6559,6 +6575,59 @@ export const COMMAND_CATALOG = [
6559
6575
  }
6560
6576
  ]
6561
6577
  },
6578
+ {
6579
+ "name": "vault",
6580
+ "description": "Manage HQ vault settings",
6581
+ "aliases": [],
6582
+ "hidden": false,
6583
+ "usage": "[options] [command]",
6584
+ "arguments": [],
6585
+ "options": [],
6586
+ "subcommands": [
6587
+ {
6588
+ "name": "retention",
6589
+ "description": "Get or set the default retention for future vault object versions",
6590
+ "aliases": [],
6591
+ "hidden": false,
6592
+ "usage": "[options] [command]",
6593
+ "arguments": [],
6594
+ "options": [
6595
+ {
6596
+ "flags": "--company <slug>",
6597
+ "description": "Company vault slug (omit for your personal vault)"
6598
+ }
6599
+ ],
6600
+ "subcommands": [
6601
+ {
6602
+ "name": "get",
6603
+ "description": "Show the vault's default retention in days",
6604
+ "aliases": [],
6605
+ "hidden": false,
6606
+ "usage": "[options]",
6607
+ "arguments": [],
6608
+ "options": [],
6609
+ "subcommands": []
6610
+ },
6611
+ {
6612
+ "name": "set",
6613
+ "description": "Set the vault's default retention in days (1-30)",
6614
+ "aliases": [],
6615
+ "hidden": false,
6616
+ "usage": "[options] <days>",
6617
+ "arguments": [
6618
+ {
6619
+ "name": "days",
6620
+ "required": true,
6621
+ "variadic": false
6622
+ }
6623
+ ],
6624
+ "options": [],
6625
+ "subcommands": []
6626
+ }
6627
+ ]
6628
+ }
6629
+ ]
6630
+ },
6562
6631
  {
6563
6632
  "name": "core",
6564
6633
  "description": "HQ scaffold scripts hosted by the CLI (core; not a stable surface)",
@@ -7500,6 +7569,70 @@ export const COMMAND_CATALOG = [
7500
7569
  "options": [],
7501
7570
  "subcommands": []
7502
7571
  },
7572
+ {
7573
+ "name": "eval-trigger",
7574
+ "description": "Evaluate policy trigger expressions",
7575
+ "aliases": [],
7576
+ "hidden": false,
7577
+ "usage": "[args...]",
7578
+ "arguments": [
7579
+ {
7580
+ "name": "args",
7581
+ "required": false,
7582
+ "variadic": true
7583
+ }
7584
+ ],
7585
+ "options": [],
7586
+ "subcommands": []
7587
+ },
7588
+ {
7589
+ "name": "migrate-policy-triggers",
7590
+ "description": "Backfill policy trigger frontmatter",
7591
+ "aliases": [],
7592
+ "hidden": false,
7593
+ "usage": "[args...]",
7594
+ "arguments": [
7595
+ {
7596
+ "name": "args",
7597
+ "required": false,
7598
+ "variadic": true
7599
+ }
7600
+ ],
7601
+ "options": [],
7602
+ "subcommands": []
7603
+ },
7604
+ {
7605
+ "name": "register-project",
7606
+ "description": "Register a project with Work Mesh",
7607
+ "aliases": [],
7608
+ "hidden": false,
7609
+ "usage": "[args...]",
7610
+ "arguments": [
7611
+ {
7612
+ "name": "args",
7613
+ "required": false,
7614
+ "variadic": true
7615
+ }
7616
+ ],
7617
+ "options": [],
7618
+ "subcommands": []
7619
+ },
7620
+ {
7621
+ "name": "work-mesh-live-rebind",
7622
+ "description": "Rebind a live Work Mesh session to its current project",
7623
+ "aliases": [],
7624
+ "hidden": false,
7625
+ "usage": "[args...]",
7626
+ "arguments": [
7627
+ {
7628
+ "name": "args",
7629
+ "required": false,
7630
+ "variadic": true
7631
+ }
7632
+ ],
7633
+ "options": [],
7634
+ "subcommands": []
7635
+ },
7503
7636
  {
7504
7637
  "name": "worktree-gc",
7505
7638
  "description": "Safely collect old, preserved HQ worktrees",
@@ -11124,6 +11257,10 @@ export const COMMAND_CATALOG = [
11124
11257
  "flags": "--text <msg>",
11125
11258
  "description": "Message text"
11126
11259
  },
11260
+ {
11261
+ "flags": "--text-file <path>",
11262
+ "description": "Read message text from a file"
11263
+ },
11127
11264
  {
11128
11265
  "flags": "--project <slug>",
11129
11266
  "description": "Re-point project attribution; a changed story is named in the resumed prompt"
@@ -11986,6 +12123,37 @@ export const COMMAND_CATALOG = [
11986
12123
  "subcommands": []
11987
12124
  }
11988
12125
  ]
12126
+ },
12127
+ {
12128
+ "name": "_keep-alive-terminal-trigger",
12129
+ "description": "",
12130
+ "aliases": [],
12131
+ "hidden": true,
12132
+ "usage": "[options] <laneId> <version> <dueAt>",
12133
+ "arguments": [
12134
+ {
12135
+ "name": "laneId",
12136
+ "required": true,
12137
+ "variadic": false
12138
+ },
12139
+ {
12140
+ "name": "version",
12141
+ "required": true,
12142
+ "variadic": false
12143
+ },
12144
+ {
12145
+ "name": "dueAt",
12146
+ "required": true,
12147
+ "variadic": false
12148
+ }
12149
+ ],
12150
+ "options": [
12151
+ {
12152
+ "flags": "--json",
12153
+ "description": "JSON on stdout (always)"
12154
+ }
12155
+ ],
12156
+ "subcommands": []
11989
12157
  }
11990
12158
  ]
11991
12159
  },
@@ -12314,6 +12482,38 @@ export const COMMAND_CATALOG = [
12314
12482
  ],
12315
12483
  "subcommands": []
12316
12484
  },
12485
+ {
12486
+ "name": "instant-sync",
12487
+ "description": "Control daemon Instant Sync",
12488
+ "aliases": [],
12489
+ "hidden": false,
12490
+ "usage": "[options] [command]",
12491
+ "arguments": [],
12492
+ "options": [],
12493
+ "subcommands": [
12494
+ {
12495
+ "name": "set",
12496
+ "description": "Set whether daemon sync uses Instant Sync",
12497
+ "aliases": [],
12498
+ "hidden": false,
12499
+ "usage": "[options] <state>",
12500
+ "arguments": [
12501
+ {
12502
+ "name": "state",
12503
+ "required": true,
12504
+ "variadic": false
12505
+ }
12506
+ ],
12507
+ "options": [
12508
+ {
12509
+ "flags": "--json",
12510
+ "description": "Print machine-readable JSON"
12511
+ }
12512
+ ],
12513
+ "subcommands": []
12514
+ }
12515
+ ]
12516
+ },
12317
12517
  {
12318
12518
  "name": "pause",
12319
12519
  "description": "Pause daemon sync until resumed",
@@ -370,6 +370,12 @@ export declare const REGISTRATION_PLAN: readonly [{
370
370
  readonly parent: "program";
371
371
  readonly module: "./commands/billing.js";
372
372
  readonly exportName: "registerBillingCommand";
373
+ }, {
374
+ readonly type: "registrar";
375
+ readonly root: "vault";
376
+ readonly parent: "program";
377
+ readonly module: "./commands/vault-retention.js";
378
+ readonly exportName: "registerVaultRetentionCommand";
373
379
  }, {
374
380
  readonly type: "registrar";
375
381
  readonly root: "core";
@@ -64,6 +64,7 @@ export const REGISTRATION_PLAN = [
64
64
  { type: "registrar", root: "agent", parent: "program", module: "./commands/agent.js", exportName: "registerAgentCommand" },
65
65
  { type: "registrar", root: "outposts", parent: "program", module: "./commands/outposts.js", exportName: "registerOutpostsCommand" },
66
66
  { type: "registrar", root: "billing", parent: "program", module: "./commands/billing.js", exportName: "registerBillingCommand" },
67
+ { type: "registrar", root: "vault", parent: "program", module: "./commands/vault-retention.js", exportName: "registerVaultRetentionCommand" },
67
68
  { type: "registrar", root: "core", parent: "program", module: "./commands/core.js", exportName: "registerCoreCommands" },
68
69
  { type: "registrar", root: "search", parent: "program", module: "./commands/search.js", exportName: "registerSearchCommand" },
69
70
  { type: "registrar", root: "index", parent: "program", module: "./commands/index-cmd.js", exportName: "registerIndexCommand" },
@@ -0,0 +1,4 @@
1
+ export declare const CLI_COMPANY_RENAME_FLAG = "cli.company-rename";
2
+ /** Company display-name updates stay unavailable until hq-flags enables them. */
3
+ export declare function companyRenameEnabled(): boolean;
4
+ //# sourceMappingURL=company-rename-flag.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { resolveProcessFlagGate } from "../lib/flag-registry.js";
2
+ export const CLI_COMPANY_RENAME_FLAG = "cli.company-rename";
3
+ /** Company display-name updates stay unavailable until hq-flags enables them. */
4
+ export function companyRenameEnabled() {
5
+ return resolveProcessFlagGate(CLI_COMPANY_RENAME_FLAG, { fallback: false }, () => false);
6
+ }
7
+ //# sourceMappingURL=company-rename-flag.js.map
@@ -0,0 +1,4 @@
1
+ import { Command } from "commander";
2
+ /** Register `hq company rename <new name>` for the selected/current company. */
3
+ export declare function registerCompanyRenameCommand(company: Command): void;
4
+ //# sourceMappingURL=company-rename.d.ts.map
@@ -0,0 +1,90 @@
1
+ import * as fs from "node:fs";
2
+ import * as path from "node:path";
3
+ import * as yaml from "js-yaml";
4
+ import chalk from "chalk";
5
+ import { resolveDefaultHqRoot } from "../utils/hq-root-resolver.js";
6
+ import { parseUserYaml } from "../utils/user-yaml-error.js";
7
+ import { ensureCognitoToken } from "../utils/cognito-session.js";
8
+ import { getEntityUid, vaultApiFetch } from "../utils/vault-api.js";
9
+ import { companyRenameEnabled } from "./company-rename-flag.js";
10
+ function fail(message) {
11
+ console.error(chalk.red(message));
12
+ process.exit(1);
13
+ throw new Error(message);
14
+ }
15
+ function resolveManifestTarget(hqRoot, requestedSlug, companyUid) {
16
+ const manifestPath = path.join(hqRoot, "companies", "manifest.yaml");
17
+ if (!fs.existsSync(manifestPath)) {
18
+ throw new Error(`companies/manifest.yaml not found at ${manifestPath}`);
19
+ }
20
+ const raw = fs.readFileSync(manifestPath, "utf8");
21
+ const parsed = parseUserYaml(raw, manifestPath);
22
+ if (!parsed || !parsed.companies || typeof parsed.companies !== "object") {
23
+ throw new Error("companies/manifest.yaml is malformed — missing top-level .companies map");
24
+ }
25
+ const slug = requestedSlug ?? Object.entries(parsed.companies).find(([, entry]) => entry && typeof entry === "object" && entry.cloud_uid === companyUid)?.[0];
26
+ if (!slug) {
27
+ throw new Error(`No local company manifest entry is bound to ${companyUid}; run from the HQ root or pass --company <slug>.`);
28
+ }
29
+ const value = parsed.companies[slug];
30
+ if (!value || typeof value !== "object") {
31
+ throw new Error(`Company '${slug}' is not present in companies/manifest.yaml.`);
32
+ }
33
+ if (requestedSlug && value.cloud_uid !== companyUid) {
34
+ throw new Error(`Company '${slug}' has no matching cloud_uid in companies/manifest.yaml.`);
35
+ }
36
+ return { slug, path: manifestPath, document: parsed, entry: value };
37
+ }
38
+ function writeManifestName(target, name) {
39
+ target.entry.name = name;
40
+ target.document.companies[target.slug] = target.entry;
41
+ const mode = fs.statSync(target.path).mode;
42
+ const temporaryPath = `${target.path}.tmp.${process.pid}`;
43
+ fs.writeFileSync(temporaryPath, yaml.dump(target.document, { lineWidth: -1, noRefs: true }), { mode });
44
+ fs.chmodSync(temporaryPath, mode);
45
+ fs.renameSync(temporaryPath, target.path);
46
+ }
47
+ /** Register `hq company rename <new name>` for the selected/current company. */
48
+ export function registerCompanyRenameCommand(company) {
49
+ company
50
+ .command("rename <new-name>")
51
+ .description("Rename a cloud-backed company display name")
52
+ .action(async (newName) => {
53
+ if (!companyRenameEnabled()) {
54
+ fail("Company rename is not available yet.");
55
+ }
56
+ const name = newName.trim();
57
+ if (!name)
58
+ fail("Company name cannot be empty.");
59
+ try {
60
+ const requestedSlug = company.opts().company;
61
+ const token = await ensureCognitoToken();
62
+ const companyUid = await getEntityUid(token, { companySlug: requestedSlug });
63
+ const hqRoot = resolveDefaultHqRoot({ onMissing: "throw" });
64
+ const manifestTarget = resolveManifestTarget(hqRoot, requestedSlug, companyUid);
65
+ const response = await vaultApiFetch({
66
+ token,
67
+ path: `/entity/${encodeURIComponent(companyUid)}`,
68
+ method: "PATCH",
69
+ body: { name },
70
+ });
71
+ if (!response.ok) {
72
+ if (response.status === 403) {
73
+ fail("Only a company owner can rename this company.");
74
+ }
75
+ if (response.status === 404) {
76
+ fail("Company not found in HQ Cloud.");
77
+ }
78
+ fail(`Could not rename company (HTTP ${response.status}).`);
79
+ }
80
+ writeManifestName(manifestTarget, name);
81
+ console.log(chalk.green(`Company renamed to ${name}.`));
82
+ }
83
+ catch (error) {
84
+ if (error instanceof Error && error.message.startsWith("process.exit"))
85
+ throw error;
86
+ fail(error instanceof Error ? error.message : String(error));
87
+ }
88
+ });
89
+ }
90
+ //# sourceMappingURL=company-rename.js.map
@@ -2,6 +2,7 @@ import chalk from "chalk";
2
2
  import { ensureCognitoToken } from "../utils/cognito-session.js";
3
3
  import { vaultApiFetch, getEntityUid } from "../utils/vault-api.js";
4
4
  import { registerCompanyTransferCommand } from "./company-transfer.js";
5
+ import { registerCompanyRenameCommand } from "./company-rename.js";
5
6
  import { describeRefreshOutcome, refreshCheckpointGateSetting, } from "./core-checkpoint-gate-setting.js";
6
7
  /**
7
8
  * Parse a `--flag <true|false>` string into a boolean, or throw. Commander
@@ -23,6 +24,7 @@ export function registerCompanyCommand(program) {
23
24
  .option("--company <slug>", "Company slug (resolves to companyUid)");
24
25
  // `hq company transfer …` — ownership handover (client-service-pack US-010).
25
26
  registerCompanyTransferCommand(company);
27
+ registerCompanyRenameCommand(company);
26
28
  const settings = company
27
29
  .command("settings")
28
30
  .description("Per-company settings (owner-only)");
@@ -481,6 +481,11 @@ export function executeCheckpointStopGate(input, context, overrides = {}) {
481
481
  return { code: 0, stdout: "", stderr: "" };
482
482
  }
483
483
  const evidence = payloadReplyEvidence(payload);
484
+ // The shell's jq-backed input_fields assignment exits successfully before
485
+ // any state work when jq is unavailable. Keep that early-exit ordering even
486
+ // though the native parser does not otherwise need jq.
487
+ if (!deps.commandExists("jq", env))
488
+ return { code: 0, stdout: "", stderr: "" };
484
489
  const transcriptPath = toShellString(payload.transcript_path);
485
490
  const sessionId = toShellString(payload.session_id);
486
491
  if (env.HQ_CHECKPOINT_SIBLING === "1")
@@ -517,6 +522,13 @@ export function executeCheckpointStopGate(input, context, overrides = {}) {
517
522
  else
518
523
  return { code: 0, stdout: "", stderr };
519
524
  const stateDir = path.join(root, "workspace", "orchestrator", "hook-state");
525
+ try {
526
+ deps.mkdir(stateDir);
527
+ }
528
+ catch {
529
+ // hook-lib.sh runs `mkdir -p ... 2>/dev/null || true`; the directory and
530
+ // write checks below determine whether this invocation can continue.
531
+ }
520
532
  if (!deps.isDirectory(stateDir) || !deps.canWrite(stateDir))
521
533
  return { code: 0, stdout: "", stderr };
522
534
  const eligibilityFile = path.join(stateDir, `checkpoint-gate-eligible-${runtime}`);