@indigoai-us/hq-cli 5.312.2-beta.0 → 5.313.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 +9 -2
- package/assets/scaffold/core/scripts/lib/work-mesh-live-hook.sh +378 -0
- package/assets/scaffold/core/scripts/lib/work-mesh-live-rebind.sh +141 -0
- package/assets/scaffold/core/scripts/migrate-policy-triggers.sh +373 -0
- package/assets/scaffold/core/scripts/register-project.sh +262 -0
- package/assets/scaffold/core/scripts/work-mesh-live-rebind.sh +59 -0
- package/dist/command-catalog.generated.d.ts +80 -0
- package/dist/command-catalog.generated.js +99 -0
- package/dist/commands/cloud.js +0 -1
- package/dist/commands/company-rename-flag.d.ts +4 -0
- package/dist/commands/company-rename-flag.js +7 -0
- package/dist/commands/company-rename.d.ts +4 -0
- package/dist/commands/company-rename.js +90 -0
- package/dist/commands/company.js +2 -0
- package/dist/commands/core-eval-trigger-native.d.ts +4 -0
- package/dist/commands/core-eval-trigger-native.js +12 -0
- package/dist/commands/core-knowledge-prefs.d.ts +0 -1
- package/dist/commands/core-knowledge-prefs.js +1 -1
- package/dist/commands/core-migrate-policy-triggers-native.d.ts +21 -0
- package/dist/commands/core-migrate-policy-triggers-native.js +378 -0
- package/dist/commands/core-native-hook-helper-commands.d.ts +4 -0
- package/dist/commands/core-native-hook-helper-commands.js +56 -0
- package/dist/commands/core-native-hook-helpers-flag.d.ts +4 -0
- package/dist/commands/core-native-hook-helpers-flag.js +7 -0
- package/dist/commands/core-register-project-native.d.ts +30 -0
- package/dist/commands/core-register-project-native.js +347 -0
- package/dist/commands/core-work-mesh-live-rebind-native.d.ts +18 -0
- package/dist/commands/core-work-mesh-live-rebind-native.js +262 -0
- package/dist/commands/core-worker-share-native.d.ts +0 -1
- package/dist/commands/core-worker-share-native.js +1 -1
- package/dist/commands/core.js +7 -0
- package/dist/commands/lanes-message.js +3 -0
- package/dist/commands/lanes-questions.js +2 -1
- package/dist/commands/lanes-resume.js +3 -0
- package/dist/commands/lanes.js +151 -21
- package/dist/fast-core.js +10 -3
- package/dist/fast-scaffold.d.ts +2 -0
- package/dist/fast-scaffold.js +11 -0
- package/dist/lib/doctor/checks/work-context.js +9 -1
- package/dist/lib/lanes/config.d.ts +3 -0
- package/dist/lib/lanes/config.js +14 -0
- package/dist/lib/lanes/disk-guard.d.ts +66 -0
- package/dist/lib/lanes/disk-guard.js +172 -0
- package/dist/lib/lanes/flag-keys.d.ts +2 -0
- package/dist/lib/lanes/flag-keys.js +2 -0
- package/dist/lib/lanes/grants.d.ts +4 -3
- package/dist/lib/lanes/grants.js +12 -7
- package/dist/lib/lanes/hire-grant-dispatch.js +2 -3
- package/dist/lib/lanes/index.d.ts +1 -1
- package/dist/lib/lanes/index.js +1 -1
- package/dist/lib/lanes/reconcile.d.ts +7 -1
- package/dist/lib/lanes/reconcile.js +142 -11
- package/dist/lib/lanes/registry-flag.d.ts +6 -0
- package/dist/lib/lanes/registry-flag.js +25 -0
- package/dist/lib/lanes/spawn.d.ts +5 -0
- package/dist/lib/lanes/spawn.js +26 -1
- package/dist/lib/lanes/store.js +11 -0
- package/dist/lib/lanes/types.d.ts +11 -1
- package/dist/lib/lanes/types.js +1 -0
- package/dist/lib/mesh/client.js +23 -5
- package/dist/lib/mesh/denial-codes.d.ts +5 -0
- package/dist/lib/mesh/denial-codes.js +14 -0
- package/dist/lib/mesh/live/daemon/doctor.d.ts +2 -0
- package/dist/lib/mesh/live/daemon/doctor.js +11 -1
- package/dist/lib/search-index/embed-lock.d.ts +2 -0
- package/dist/lib/search-index/embed-lock.js +10 -1
- package/dist/lib/work-context/contract.d.ts +3 -0
- package/dist/lib/work-context/contract.schema.json +3 -1
- package/dist/lib/work-context/outbox.d.ts +14 -5
- package/dist/lib/work-context/outbox.js +48 -5
- package/dist/lib/work-context/reconcile.js +26 -5
- package/dist/main.d.ts +20 -0
- package/dist/main.js +8 -1
- package/dist/utils/core-eval-trigger.d.ts +4 -0
- package/dist/utils/core-eval-trigger.js +88 -0
- package/dist/utils/pack-contributions.d.ts +0 -5
- package/dist/utils/pack-contributions.js +1 -1
- package/dist/utils/redact-error-text.d.ts +0 -2
- package/dist/utils/redact-error-text.js +1 -1
- package/dist/utils/sandbox-runner-client.d.ts +2 -1
- 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)";
|
|
@@ -5867,6 +5880,58 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
5867
5880
|
}];
|
|
5868
5881
|
readonly options: readonly [];
|
|
5869
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 [];
|
|
5870
5935
|
}, {
|
|
5871
5936
|
readonly name: "worktree-gc";
|
|
5872
5937
|
readonly description: "Safely collect old, preserved HQ worktrees";
|
|
@@ -9338,6 +9403,21 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
9338
9403
|
}];
|
|
9339
9404
|
readonly subcommands: readonly [];
|
|
9340
9405
|
}];
|
|
9406
|
+
}, {
|
|
9407
|
+
readonly name: "gc-rollouts";
|
|
9408
|
+
readonly description: "Compress or remove unreferenced old Codex session rollouts";
|
|
9409
|
+
readonly aliases: readonly [];
|
|
9410
|
+
readonly hidden: false;
|
|
9411
|
+
readonly usage: "[options]";
|
|
9412
|
+
readonly arguments: readonly [];
|
|
9413
|
+
readonly options: readonly [{
|
|
9414
|
+
readonly flags: "--dry-run";
|
|
9415
|
+
readonly description: "Report changes without modifying rollout files";
|
|
9416
|
+
}, {
|
|
9417
|
+
readonly flags: "--json";
|
|
9418
|
+
readonly description: "Emit JSON on stdout (default)";
|
|
9419
|
+
}];
|
|
9420
|
+
readonly subcommands: readonly [];
|
|
9341
9421
|
}, {
|
|
9342
9422
|
readonly name: "_keep-alive-terminal-trigger";
|
|
9343
9423
|
readonly description: "";
|
|
@@ -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)",
|
|
@@ -7553,6 +7569,70 @@ export const COMMAND_CATALOG = [
|
|
|
7553
7569
|
"options": [],
|
|
7554
7570
|
"subcommands": []
|
|
7555
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
|
+
},
|
|
7556
7636
|
{
|
|
7557
7637
|
"name": "worktree-gc",
|
|
7558
7638
|
"description": "Safely collect old, preserved HQ worktrees",
|
|
@@ -12044,6 +12124,25 @@ export const COMMAND_CATALOG = [
|
|
|
12044
12124
|
}
|
|
12045
12125
|
]
|
|
12046
12126
|
},
|
|
12127
|
+
{
|
|
12128
|
+
"name": "gc-rollouts",
|
|
12129
|
+
"description": "Compress or remove unreferenced old Codex session rollouts",
|
|
12130
|
+
"aliases": [],
|
|
12131
|
+
"hidden": false,
|
|
12132
|
+
"usage": "[options]",
|
|
12133
|
+
"arguments": [],
|
|
12134
|
+
"options": [
|
|
12135
|
+
{
|
|
12136
|
+
"flags": "--dry-run",
|
|
12137
|
+
"description": "Report changes without modifying rollout files"
|
|
12138
|
+
},
|
|
12139
|
+
{
|
|
12140
|
+
"flags": "--json",
|
|
12141
|
+
"description": "Emit JSON on stdout (default)"
|
|
12142
|
+
}
|
|
12143
|
+
],
|
|
12144
|
+
"subcommands": []
|
|
12145
|
+
},
|
|
12047
12146
|
{
|
|
12048
12147
|
"name": "_keep-alive-terminal-trigger",
|
|
12049
12148
|
"description": "",
|
package/dist/commands/cloud.js
CHANGED
|
@@ -1697,7 +1697,6 @@ async function runNowSingle(hqRoot, company, personal, message, onConflict, mode
|
|
|
1697
1697
|
hqRoot,
|
|
1698
1698
|
progressRecorder: trackingProgressRecorder(planLimitTracker, pushProgressCompany),
|
|
1699
1699
|
skipUnchanged: true,
|
|
1700
|
-
serverOwnedPathPolicy: "skip",
|
|
1701
1700
|
propagateDeletes: true,
|
|
1702
1701
|
propagateDeletePolicy: resolveDeletePolicy(),
|
|
1703
1702
|
...(onConflict ? { onConflict } : {}),
|
|
@@ -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,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
|
package/dist/commands/company.js
CHANGED
|
@@ -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)");
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { checkTriggerExpressions, evaluateTrigger } from "../utils/core-eval-trigger.js";
|
|
2
|
+
export declare const EVAL_TRIGGER_ASSET = "core/scripts/eval-trigger.sh";
|
|
3
|
+
export declare function runEvalTriggerFast(args: readonly string[], stdin: string, _cwd: string, _root: string | undefined): Promise<number>;
|
|
4
|
+
//# sourceMappingURL=core-eval-trigger-native.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Native implementation of core/scripts/eval-trigger.sh. */
|
|
2
|
+
import { checkTriggerExpressions, evaluateTrigger } from "../utils/core-eval-trigger.js";
|
|
3
|
+
export { checkTriggerExpressions, evaluateTrigger } from "../utils/core-eval-trigger.js";
|
|
4
|
+
export const EVAL_TRIGGER_ASSET = "core/scripts/eval-trigger.sh";
|
|
5
|
+
export async function runEvalTriggerFast(args, stdin, _cwd, _root) {
|
|
6
|
+
if (args[0] === "--check") {
|
|
7
|
+
process.stdout.write(checkTriggerExpressions(stdin));
|
|
8
|
+
return 0;
|
|
9
|
+
}
|
|
10
|
+
return evaluateTrigger(args[0] ?? "", args[1] ?? "");
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=core-eval-trigger-native.js.map
|
|
@@ -9,7 +9,7 @@ import * as path from 'node:path';
|
|
|
9
9
|
import { resolveLiveRoot } from '../utils/hq-roots.js';
|
|
10
10
|
import { runBundledScript } from '../utils/run-bundled-script.js';
|
|
11
11
|
import { describeCoreCommand } from './core-command-catalog.js';
|
|
12
|
-
|
|
12
|
+
const KNOWLEDGE_PREFS_ASSET = 'core/scripts/knowledge-prefs.sh';
|
|
13
13
|
const DEFAULTS = {
|
|
14
14
|
signals_enabled: 'true',
|
|
15
15
|
ontology_enabled: 'true',
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
export declare const MIGRATE_POLICY_TRIGGERS_ASSET = "core/scripts/migrate-policy-triggers.sh";
|
|
3
|
+
export type MigratePolicyDependencies = {
|
|
4
|
+
root: string;
|
|
5
|
+
cwd: string;
|
|
6
|
+
env: NodeJS.ProcessEnv;
|
|
7
|
+
now: () => Date;
|
|
8
|
+
fs: typeof fs;
|
|
9
|
+
evaluatorExists?: () => boolean;
|
|
10
|
+
runFlock?: (lockFd: number, cwd: string, pathValue: string) => {
|
|
11
|
+
status: number | null;
|
|
12
|
+
error?: Error;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare function runMigratePolicyTriggers(args: readonly string[], deps: MigratePolicyDependencies): {
|
|
16
|
+
code: number;
|
|
17
|
+
stdout: string;
|
|
18
|
+
stderr: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function runMigratePolicyTriggersFast(args: readonly string[], _stdin: string, cwd: string, root?: string): Promise<number>;
|
|
21
|
+
//# sourceMappingURL=core-migrate-policy-triggers-native.d.ts.map
|