@indigoai-us/hq-cli 5.345.10 → 5.345.12
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 +10 -0
- package/assets/scaffold/core/scripts/hq-delegate-grant.sh +11 -4
- package/assets/scaffold/core/scripts/hq-delegate-send.sh +11 -4
- package/assets/scaffold/core/scripts/hq-job-probe.sh +11 -4
- package/assets/scaffold/core/scripts/jobs-validate.sh +11 -4
- package/assets/scaffold/core/scripts/register-project.sh +5 -5
- package/assets/scaffold/core/scripts/repo-run-registry.sh +8 -8
- package/assets/scaffold/core/scripts/resume-thread-lock.sh +4 -4
- package/assets/scaffold/core/scripts/session-journal.sh +3 -3
- package/assets/scaffold/core/scripts/verify-story-deliverables.sh +1 -1
- package/assets/scaffold/core/scripts/worktree-gc.sh +1 -1
- package/dist/commands/core-delegate-w1b.js +4 -1
- package/dist/commands/core-handoff.js +69 -34
- package/dist/commands/core-hq-session-native.js +31 -6
- package/dist/commands/core-job-notify-fast.d.ts +2 -0
- package/dist/commands/core-job-notify-fast.js +6 -0
- package/dist/commands/core-job-probe-fast.d.ts +2 -0
- package/dist/commands/core-job-probe-fast.js +11 -0
- package/dist/commands/core-job-probe-native.js +1 -1
- package/dist/commands/core-job-remediate-fast.d.ts +2 -0
- package/dist/commands/core-job-remediate-fast.js +6 -0
- package/dist/commands/core-job-run-fast.d.ts +2 -0
- package/dist/commands/core-job-run-fast.js +6 -0
- package/dist/commands/core-pin-fast.d.ts +2 -0
- package/dist/commands/core-pin-fast.js +15 -0
- package/dist/commands/core-rebuild-index-fast.d.ts +6 -0
- package/dist/commands/core-rebuild-index-fast.js +39 -0
- package/dist/commands/core-register-project-native.js +11 -2
- package/dist/commands/core-repo-run-registry-native.js +47 -4
- package/dist/commands/core-session-journal-native.d.ts +1 -1
- package/dist/commands/core-session-journal-native.js +4 -4
- package/dist/commands/core-session-project-native.js +2 -1
- package/dist/commands/core-share-suggestion-state-native.js +6 -2
- package/dist/commands/core-work-mesh-live-rebind-native.js +5 -2
- package/dist/commands/core-worker-lint-fast.d.ts +2 -0
- package/dist/commands/core-worker-lint-fast.js +11 -0
- package/dist/commands/core.js +9 -6
- package/dist/fast-scaffold.js +49 -0
- package/dist/lib/checkpoint-ontology/merge-copies.d.ts +4 -3
- package/dist/lib/core-utils/worktree-resume.d.ts +1 -0
- package/dist/lib/core-utils/worktree-resume.js +68 -31
- package/dist/lib/daemon/catalog.d.ts +10 -0
- package/dist/lib/daemon/catalog.js +8 -0
- package/dist/lib/daemon/lanes-reconcile-guard.d.ts +43 -0
- package/dist/lib/daemon/lanes-reconcile-guard.js +115 -0
- package/dist/lib/daemon/ops/journal.d.ts +0 -1
- package/dist/lib/daemon/ops/journal.js +1 -1
- package/dist/lib/daemon/ops/mcp.d.ts +0 -1
- package/dist/lib/daemon/ops/mcp.js +1 -1
- package/dist/lib/daemon/ops/policy.d.ts +0 -7
- package/dist/lib/daemon/ops/policy.js +1 -1
- package/dist/lib/daemon/run.js +2 -0
- package/dist/lib/daemon/supervisor.d.ts +2 -0
- package/dist/lib/daemon/supervisor.js +28 -0
- package/dist/lib/doctor/checks/sync-health.d.ts +0 -2
- package/dist/lib/doctor/checks/sync-health.js +1 -1
- package/dist/lib/lanes/admission.d.ts +0 -2
- package/dist/lib/lanes/admission.js +2 -2
- package/dist/lib/lanes/autopilot-metrics.d.ts +5 -4
- package/dist/lib/lanes/autopilot-registry.d.ts +2 -5
- package/dist/lib/lanes/autopilot-registry.js +4 -4
- package/dist/lib/lanes/compaction.d.ts +2 -1
- package/dist/lib/lanes/delivery.d.ts +0 -2
- package/dist/lib/lanes/delivery.js +1 -1
- package/dist/lib/lanes/hooks-install.d.ts +0 -1
- package/dist/lib/lanes/hooks-install.js +1 -1
- package/dist/lib/lanes/merge-command.d.ts +2 -1
- package/dist/lib/lanes/orphans.d.ts +0 -1
- package/dist/lib/lanes/orphans.js +1 -1
- package/dist/lib/lanes/outpost-worktree-pruner.d.ts +3 -2
- package/dist/lib/lanes/provider-rejection.d.ts +0 -1
- package/dist/lib/lanes/provider-rejection.js +1 -1
- package/dist/lib/lanes/reconcile.d.ts +0 -5
- package/dist/lib/lanes/reconcile.js +4 -4
- package/dist/lib/lanes/runaway-tool-guard.d.ts +1 -1
- package/dist/lib/lanes/spawn.d.ts +1 -7
- package/dist/lib/lanes/spawn.js +4 -4
- package/dist/lib/lanes/throttle.d.ts +0 -1
- package/dist/lib/lanes/throttle.js +1 -1
- package/dist/lib/lanes/types.d.ts +6 -5
- package/dist/lib/lanes/watcher.d.ts +0 -9
- package/dist/lib/lanes/watcher.js +2 -2
- package/dist/lib/mesh/live/daemon/legacy-listen.d.ts +0 -3
- package/dist/lib/mesh/live/daemon/legacy-listen.js +3 -3
- package/dist/lib/mesh/live/paths.d.ts +0 -1
- package/dist/lib/mesh/live/paths.js +1 -1
- package/dist/lib/mesh/live/spool.d.ts +0 -8
- package/dist/lib/mesh/live/spool.js +3 -3
- package/dist/lib/mesh/story-status.d.ts +2 -7
- package/dist/lib/mesh/story-status.js +2 -2
- package/dist/lib/sync-invalid-entity-warning.d.ts +0 -1
- package/dist/lib/sync-invalid-entity-warning.js +1 -1
- package/dist/lib/work-context/atomic.d.ts +0 -4
- package/dist/lib/work-context/atomic.js +1 -1
- package/dist/lib/work-context/contract.d.ts +2 -3
- package/dist/lib/work-context/contract.js +1 -1
- package/dist/lib/work-context/preflight-contract.d.ts +2 -7
- package/dist/lib/work-context/preflight-contract.js +1 -1
- package/dist/lib/work-context/repo-remote.d.ts +2 -1
- package/dist/utils/manifest.d.ts +0 -2
- package/dist/utils/manifest.js +2 -2
- package/dist/utils/resident-package-preload.d.ts +0 -5
- package/dist/utils/resident-package-preload.js +1 -1
- package/dist/utils/run-bundled-script.js +1 -1
- package/dist/utils/version-gate.d.ts +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Isolated fast-entry adapter for the native pin utility. */
|
|
2
|
+
import { runPin } from "./core-pin-native.js";
|
|
3
|
+
export function runPinFast(args, _stdin, _cwd, hqRoot) {
|
|
4
|
+
const result = runPin([...args], {
|
|
5
|
+
root: hqRoot ?? process.env.HQ_ROOT ?? process.cwd(),
|
|
6
|
+
env: process.env,
|
|
7
|
+
now: () => new Date(),
|
|
8
|
+
});
|
|
9
|
+
if (result.stdout)
|
|
10
|
+
process.stdout.write(result.stdout);
|
|
11
|
+
if (result.stderr)
|
|
12
|
+
process.stderr.write(result.stderr);
|
|
13
|
+
return result.code;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=core-pin-fast.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run a standard rebuild with the same renderer used by the full command.
|
|
3
|
+
* Argument forms that need Commander error formatting remain on the full graph.
|
|
4
|
+
*/
|
|
5
|
+
export declare function runRebuildIndexFast(args: readonly string[], _stdin: string, _cwd: string, hqRoot: string | undefined): Promise<number | undefined>;
|
|
6
|
+
//# sourceMappingURL=core-rebuild-index-fast.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** Isolated fast-entry adapter for rebuild-index native renderers. */
|
|
2
|
+
import { CompanyIndexUserError, renderIndexTarget } from "../lib/index-render/index.js";
|
|
3
|
+
const targets = new Set([
|
|
4
|
+
"all", "companies", "company-knowledge", "orchestrator", "projects",
|
|
5
|
+
"public-knowledge", "reports", "social-drafts", "threads", "workers",
|
|
6
|
+
]);
|
|
7
|
+
/**
|
|
8
|
+
* Run a standard rebuild with the same renderer used by the full command.
|
|
9
|
+
* Argument forms that need Commander error formatting remain on the full graph.
|
|
10
|
+
*/
|
|
11
|
+
export async function runRebuildIndexFast(args, _stdin, _cwd, hqRoot) {
|
|
12
|
+
const [target, ...rest] = args;
|
|
13
|
+
if (!target || !targets.has(target) || rest.length > 0 || !hqRoot)
|
|
14
|
+
return undefined;
|
|
15
|
+
const logs = [];
|
|
16
|
+
const flushLogs = () => {
|
|
17
|
+
for (const message of logs)
|
|
18
|
+
process.stderr.write(`${message}\n`);
|
|
19
|
+
};
|
|
20
|
+
try {
|
|
21
|
+
const refused = [];
|
|
22
|
+
renderIndexTarget(target, {
|
|
23
|
+
root: hqRoot,
|
|
24
|
+
log: (message) => logs.push(message),
|
|
25
|
+
refused,
|
|
26
|
+
});
|
|
27
|
+
if (refused.length > 0)
|
|
28
|
+
return undefined;
|
|
29
|
+
flushLogs();
|
|
30
|
+
return 0;
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
if (error instanceof CompanyIndexUserError)
|
|
34
|
+
return undefined;
|
|
35
|
+
flushLogs();
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=core-rebuild-index-fast.js.map
|
|
@@ -5,14 +5,18 @@ import * as path from "node:path";
|
|
|
5
5
|
import { spawnSync } from "node:child_process";
|
|
6
6
|
import { serializeJqJson } from "../lib/core-utils/jq-json-serializer.js";
|
|
7
7
|
import { resolveBundledAsset } from "../utils/hq-roots-core.js";
|
|
8
|
+
import { buildSpawnPlan } from "../utils/windows-spawn.js";
|
|
8
9
|
export const REGISTER_PROJECT_ASSET = "core/scripts/register-project.sh";
|
|
9
10
|
const USAGE = "usage: register-project.sh <company> <project> | --audit <company> | --backfill <company> --only-active [--yes] | --retry-pending <company>";
|
|
10
11
|
const MIN_HQ_CLI = "5.139.0";
|
|
11
12
|
export function createRegisterProjectHqRunner(spawn = spawnSync) {
|
|
12
13
|
return (args, options) => {
|
|
13
|
-
const
|
|
14
|
+
const plan = buildSpawnPlan("hq", args);
|
|
15
|
+
const { cmd, args: spawnArgs, ...spawnOptions } = plan;
|
|
16
|
+
const result = spawn(cmd, spawnArgs, {
|
|
14
17
|
cwd: options.cwd,
|
|
15
18
|
env: options.env,
|
|
19
|
+
...spawnOptions,
|
|
16
20
|
encoding: "utf8",
|
|
17
21
|
// Shell hq children inherit fd 0 even when their output is captured or discarded.
|
|
18
22
|
stdio: options.capture ? ["inherit", "pipe", "pipe"] : ["inherit", "ignore", "ignore"],
|
|
@@ -130,7 +134,12 @@ function ensureOne(company, project, deps) {
|
|
|
130
134
|
catch { /* legacy jq/write errors remain a failed registration */ }
|
|
131
135
|
return errorResult(`hq-cli ${MIN_HQ_CLI} or newer is required; ${company}/${project} stays local until then`);
|
|
132
136
|
}
|
|
133
|
-
|
|
137
|
+
// The shell builds this argument from its raw HQ_ROOT plus POSIX separators.
|
|
138
|
+
// On Git Bash that preserves a Win32 drive prefix and appends `/companies/...`.
|
|
139
|
+
const hqPrd = process.platform === "win32"
|
|
140
|
+
? `${deps.root.replace(/[\\/]+$/u, "")}/companies/${company}/projects/${project}/prd.json`
|
|
141
|
+
: prd;
|
|
142
|
+
const ensure = deps.runHq(["mesh", "project", "ensure", project, "--company", company, "--stories-file", hqPrd, "--json"], {
|
|
134
143
|
cwd: deps.cwd, env: deps.env, capture: true,
|
|
135
144
|
});
|
|
136
145
|
if (ensure.code !== 0)
|
|
@@ -28,7 +28,16 @@ function epoch(value, parseDate) {
|
|
|
28
28
|
}
|
|
29
29
|
return parseDate(value);
|
|
30
30
|
}
|
|
31
|
+
function nativePath(value) {
|
|
32
|
+
if (process.platform === "win32") {
|
|
33
|
+
const gitBashPath = /^\/([A-Za-z])\/(.*)$/u.exec(value);
|
|
34
|
+
if (gitBashPath)
|
|
35
|
+
return `${gitBashPath[1]}:\\${gitBashPath[2].replaceAll("/", "\\")}`;
|
|
36
|
+
}
|
|
37
|
+
return value;
|
|
38
|
+
}
|
|
31
39
|
function pathAbs(value, cwd, f) {
|
|
40
|
+
value = nativePath(value);
|
|
32
41
|
if (value.startsWith("/"))
|
|
33
42
|
return value;
|
|
34
43
|
const parent = path.dirname(value);
|
|
@@ -40,8 +49,29 @@ function pathAbs(value, cwd, f) {
|
|
|
40
49
|
return value;
|
|
41
50
|
}
|
|
42
51
|
}
|
|
52
|
+
function shellAbsolutePath(value) {
|
|
53
|
+
if (process.platform !== "win32")
|
|
54
|
+
return value;
|
|
55
|
+
// The shell companion stores drive paths with forward slashes. The shared
|
|
56
|
+
// shellDisplayPath helper emits Git Bash mount paths for command output, but
|
|
57
|
+
// that is not the registry's persisted path format.
|
|
58
|
+
if (/^\/[A-Za-z]\//u.test(value))
|
|
59
|
+
return value;
|
|
60
|
+
return path.win32.resolve(nativePath(value)).replaceAll("\\", "/");
|
|
61
|
+
}
|
|
62
|
+
function shellScope(value) {
|
|
63
|
+
return value.startsWith("worktree:") ? `worktree:${shellAbsolutePath(value.slice("worktree:".length))}` : value;
|
|
64
|
+
}
|
|
43
65
|
function worktreeScopeCovers(target, scope) {
|
|
44
66
|
const rawRoot = scope.slice("worktree:".length);
|
|
67
|
+
if (process.platform === "win32") {
|
|
68
|
+
const canonical = (value) => {
|
|
69
|
+
return path.win32.normalize(nativePath(value).replaceAll("/", "\\")).replace(/[\\/]+$/u, "").toLowerCase();
|
|
70
|
+
};
|
|
71
|
+
const canonicalTarget = canonical(target);
|
|
72
|
+
const canonicalRoot = canonical(rawRoot);
|
|
73
|
+
return canonicalTarget === canonicalRoot || canonicalTarget.startsWith(`${canonicalRoot}\\`);
|
|
74
|
+
}
|
|
45
75
|
const trimmedRoot = rawRoot.replace(/\/+$/, "");
|
|
46
76
|
const root = trimmedRoot === "" && rawRoot.startsWith("/") ? "/" : trimmedRoot;
|
|
47
77
|
if (root === "/")
|
|
@@ -135,7 +165,10 @@ export function runRepoRunRegistry(args, deps) {
|
|
|
135
165
|
f.rmSync(lockDir, { recursive: true, force: true });
|
|
136
166
|
}
|
|
137
167
|
catch {
|
|
138
|
-
|
|
168
|
+
const displayLock = process.platform === "win32"
|
|
169
|
+
? `${root.replace(/[\\/]+$/u, "")}/workspace/orchestrator/active-runs.json.lock`
|
|
170
|
+
: lockDir;
|
|
171
|
+
throw new Error(`ERROR: could not remove stale registry lock: ${displayLock}`);
|
|
139
172
|
}
|
|
140
173
|
continue;
|
|
141
174
|
}
|
|
@@ -157,6 +190,10 @@ export function runRepoRunRegistry(args, deps) {
|
|
|
157
190
|
const value = Number(raw);
|
|
158
191
|
if (!Number.isFinite(value))
|
|
159
192
|
return false;
|
|
193
|
+
// Git Bash's kill -0 -1 probes all signalable processes and succeeds on
|
|
194
|
+
// Windows; Node's process.kill does not accept the same sentinel there.
|
|
195
|
+
if (process.platform === "win32" && value === -1)
|
|
196
|
+
return true;
|
|
160
197
|
try {
|
|
161
198
|
return deps.isPidAlive ? deps.isPidAlive(value) : (process.kill(value, 0), true);
|
|
162
199
|
}
|
|
@@ -207,7 +244,7 @@ export function runRepoRunRegistry(args, deps) {
|
|
|
207
244
|
catch { /* keep resolved path */ }
|
|
208
245
|
while (dir !== "/" && dir) {
|
|
209
246
|
if (f.existsSync(path.join(dir, ".git")))
|
|
210
|
-
return dir;
|
|
247
|
+
return process.platform === "win32" ? shellAbsolutePath(dir) : dir;
|
|
211
248
|
const parent = path.dirname(dir);
|
|
212
249
|
if (parent === dir)
|
|
213
250
|
break;
|
|
@@ -256,7 +293,8 @@ export function runRepoRunRegistry(args, deps) {
|
|
|
256
293
|
let runId = valueAfter(rest, "--run-id"), runPid = valueAfter(rest, "--pid"), sessionId = valueAfter(rest, "--session-id"), command = valueAfter(rest, "--command"), project = valueAfter(rest, "--project"), repo = valueAfter(rest, "--repo"), scope = valueAfter(rest, "--scope"), host = valueAfter(rest, "--host");
|
|
257
294
|
if (!runPid || !command || !repo || !scope)
|
|
258
295
|
return die("register requires --pid --command --repo --scope");
|
|
259
|
-
repo = pathAbs(repo, deps.cwd, f);
|
|
296
|
+
repo = shellAbsolutePath(pathAbs(repo, deps.cwd, f));
|
|
297
|
+
scope = shellScope(scope);
|
|
260
298
|
if (!runId)
|
|
261
299
|
runId = `${command.replaceAll("/", "-")}-${Math.floor(now().getTime() / 1000)}-${project || "none"}-${runPid}`;
|
|
262
300
|
if (!host)
|
|
@@ -357,7 +395,12 @@ export function runRepoRunRegistry(args, deps) {
|
|
|
357
395
|
const owners = runs.filter((run) => covers(run) && String(run?.pid) !== myPid && run?.session_id !== mySession);
|
|
358
396
|
if (!owners.length)
|
|
359
397
|
return output();
|
|
360
|
-
const lines = owners.map((run) =>
|
|
398
|
+
const lines = owners.map((run) => {
|
|
399
|
+
// This diagnostic interpolates the stored fields directly in Bash.
|
|
400
|
+
// Keep their original spelling (including a trailing slash) rather
|
|
401
|
+
// than canonicalizing paths only on the native side.
|
|
402
|
+
return `run_id=${run?.run_id} pid=${run?.pid} command=${run?.command} project=${run?.project} scope=${run?.scope} repo=${run?.repo_path} started=${run?.started_at} heartbeat=${run?.heartbeat_at}`;
|
|
403
|
+
}).join("\n") + "\n";
|
|
361
404
|
return output(2, "", lines);
|
|
362
405
|
}
|
|
363
406
|
return die(`unknown subcommand: ${sub}`);
|
|
@@ -10,6 +10,6 @@ export type SessionJournalOperationResult = {
|
|
|
10
10
|
/** Execute one native helper call while retaining its two output byte streams. */
|
|
11
11
|
export declare function runSessionJournalOperation(args: readonly string[], _stdin: string, cwd: string, hqRoot: string | undefined, dependencies?: SessionHelperRuntimeOverrides): SessionJournalOperationResult;
|
|
12
12
|
/** Native implementation of the fail-soft session journal helper. */
|
|
13
|
-
export declare function runSessionJournalFast(args: readonly string[],
|
|
13
|
+
export declare function runSessionJournalFast(args: readonly string[], _stdin: string, cwd: string, hqRoot: string | undefined, dependencies?: SessionHelperRuntimeOverrides): number;
|
|
14
14
|
export {};
|
|
15
15
|
//# sourceMappingURL=core-session-journal-native.d.ts.map
|
|
@@ -23,7 +23,7 @@ const counterKey = (value) => {
|
|
|
23
23
|
key = "unscoped";
|
|
24
24
|
return key.length > 96 ? key.slice(0, 96) : key;
|
|
25
25
|
};
|
|
26
|
-
const slugify = (
|
|
26
|
+
const slugify = (input) => (process.platform === "win32" ? input.replaceAll("\n", "-") : input).toLowerCase()
|
|
27
27
|
.split("\n")
|
|
28
28
|
.map((line) => line.replace(/[^a-z0-9]+/g, "-").replace(/^-+/, "").replace(/-+$/, "").slice(0, 40))
|
|
29
29
|
.join("\n");
|
|
@@ -92,7 +92,7 @@ function processIsAlive(pid) {
|
|
|
92
92
|
function acquireJournalWriteLock(dir) {
|
|
93
93
|
const lock = path.join(dir, ".session-journal-write.lock");
|
|
94
94
|
const ownerFile = path.join(lock, "pid");
|
|
95
|
-
const deadline = Date.now() + 5_000;
|
|
95
|
+
const deadline = Date.now() + (process.platform === "win32" ? 30_000 : 5_000);
|
|
96
96
|
while (Date.now() < deadline) {
|
|
97
97
|
try {
|
|
98
98
|
fs.mkdirSync(lock);
|
|
@@ -243,8 +243,8 @@ export function runSessionJournalOperation(args, _stdin, cwd, hqRoot, dependenci
|
|
|
243
243
|
return { code, stdout: Buffer.concat(stdout), stderr: Buffer.concat(stderr) };
|
|
244
244
|
}
|
|
245
245
|
/** Native implementation of the fail-soft session journal helper. */
|
|
246
|
-
export function runSessionJournalFast(args,
|
|
247
|
-
const result = runSessionJournalOperation(args,
|
|
246
|
+
export function runSessionJournalFast(args, _stdin, cwd, hqRoot, dependencies = {}) {
|
|
247
|
+
const result = runSessionJournalOperation(args, _stdin, cwd, hqRoot, dependencies);
|
|
248
248
|
process.stdout.write(result.stdout);
|
|
249
249
|
process.stderr.write(result.stderr);
|
|
250
250
|
return result.code;
|
|
@@ -252,7 +252,8 @@ export function runSessionProjectFast(argv, stdin, cwd, root, dependencies = {})
|
|
|
252
252
|
function acquireProjectWriteLock(prdPath) {
|
|
253
253
|
const lock = `${prdPath}.write-lock`;
|
|
254
254
|
const ownerFile = path.join(lock, "pid");
|
|
255
|
-
|
|
255
|
+
// Git Bash and Node process startup can stretch Windows lock contention beyond the short POSIX window.
|
|
256
|
+
const deadline = Date.now() + (process.platform === "win32" ? 30_000 : 5_000);
|
|
256
257
|
while (Date.now() < deadline) {
|
|
257
258
|
try {
|
|
258
259
|
fs.mkdirSync(lock);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** Native port of share-suggestion-state.sh; kept dependency-light for hooks. */
|
|
2
2
|
import * as fs from "node:fs";
|
|
3
3
|
import * as path from "node:path";
|
|
4
|
+
import { shellDisplayPath } from "../lib/core-utils/shell-display-path.js";
|
|
4
5
|
import { isByteOrientedLocale } from "../lib/core-utils/byte-oriented-locale.js";
|
|
5
6
|
export const SHARE_SUGGESTION_STATE_ASSET = "core/scripts/share-suggestion-state.sh";
|
|
6
7
|
const isObj = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
@@ -170,10 +171,13 @@ export function runShareSuggestionState(args, stdin, deps) {
|
|
|
170
171
|
}
|
|
171
172
|
catch { /* locate the first existing non-directory parent when present */ }
|
|
172
173
|
}
|
|
174
|
+
const displayBlockedPath = platform === "win32"
|
|
175
|
+
? shellDisplayPath(blockedPath)
|
|
176
|
+
: blockedPath;
|
|
173
177
|
const reason = code === "ENOTDIR" ? "Not a directory" : code === "EACCES" || code === "EPERM" ? "Permission denied" : code === "EEXIST" ? "File exists" : (error instanceof Error ? error.message : String(error));
|
|
174
178
|
const mkdirError = platform === "darwin"
|
|
175
|
-
? `mkdir: ${
|
|
176
|
-
: `mkdir: cannot create directory ‘${
|
|
179
|
+
? `mkdir: ${displayBlockedPath}: ${reason}\n`
|
|
180
|
+
: `mkdir: cannot create directory ‘${displayBlockedPath}’: ${reason}\n`;
|
|
177
181
|
return failFromShellMain(`${mkdirError}share-suggestion-state: unable to create state directory\n`);
|
|
178
182
|
}
|
|
179
183
|
const sessionUnits = platform === "darwin" && !isByteOrientedLocale(env, platform)
|
|
@@ -4,6 +4,7 @@ import * as os from "node:os";
|
|
|
4
4
|
import * as path from "node:path";
|
|
5
5
|
import { generateUlid } from "../lib/mesh/live/ulid.js";
|
|
6
6
|
import { formatSpoolLine } from "../lib/mesh/live/format-spool-line.js";
|
|
7
|
+
import { shellDisplayPath } from "../lib/core-utils/shell-display-path.js";
|
|
7
8
|
export const WORK_MESH_LIVE_REBIND_ASSET = "core/scripts/work-mesh-live-rebind.sh";
|
|
8
9
|
const WORK_MESH_LIVE_REBIND_LIBRARY_ASSET = "core/scripts/lib/work-mesh-live-rebind.sh";
|
|
9
10
|
const USAGE = "usage: work-mesh-live-rebind.sh --session <sid> ...\n";
|
|
@@ -118,7 +119,7 @@ function enqueueLifecycle(kind, sid, harness, adapter, company, project, task, d
|
|
|
118
119
|
at: `${now.toISOString().slice(0, 19)}.000Z`,
|
|
119
120
|
seq,
|
|
120
121
|
cwd: deps.env.PWD ?? "",
|
|
121
|
-
hqRoot: deps.env.HQ_ROOT ?? deps.root,
|
|
122
|
+
hqRoot: shellDisplayPath(deps.env.HQ_ROOT ?? deps.root),
|
|
122
123
|
};
|
|
123
124
|
if (company)
|
|
124
125
|
event.companySlug = company;
|
|
@@ -247,7 +248,9 @@ export function runWorkMeshLiveRebind(args, deps) {
|
|
|
247
248
|
: cause?.code === "ENOSPC" ? "No space left on device"
|
|
248
249
|
: "Input/output error";
|
|
249
250
|
const script = path.join(deps.root, WORK_MESH_LIVE_REBIND_LIBRARY_ASSET);
|
|
250
|
-
|
|
251
|
+
const scriptPath = shellDisplayPath(script);
|
|
252
|
+
const targetPath = shellDisplayPath(error.target);
|
|
253
|
+
return { code: 1, stdout: "", stderr: `${scriptPath}: line 34: ${targetPath}: ${message}\n` };
|
|
251
254
|
}
|
|
252
255
|
}
|
|
253
256
|
export async function runWorkMeshLiveRebindFast(args, _stdin, cwd, root) {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Isolated fast-entry adapter for native worker-skill linting. */
|
|
2
|
+
import { runWorkerSkillLint } from "./core-worker-lint-native.js";
|
|
3
|
+
export function runWorkerSkillLintFast(args, _stdin, cwd) {
|
|
4
|
+
const result = runWorkerSkillLint([...args], { cwd });
|
|
5
|
+
if (result.stdout)
|
|
6
|
+
process.stdout.write(result.stdout);
|
|
7
|
+
if (result.stderr)
|
|
8
|
+
process.stderr.write(result.stderr);
|
|
9
|
+
return result.code;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=core-worker-lint-fast.js.map
|
package/dist/commands/core.js
CHANGED
|
@@ -631,12 +631,15 @@ export function registerCoreCommands(program) {
|
|
|
631
631
|
}
|
|
632
632
|
});
|
|
633
633
|
describeCoreCommand(rebuildCommand, {
|
|
634
|
-
entries:
|
|
635
|
-
name:
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
634
|
+
entries: [
|
|
635
|
+
{ name: "rebuild-index", execution: "native", root: "live" },
|
|
636
|
+
...REBUILD_INDEX_TARGETS.map((entry) => ({
|
|
637
|
+
name: `rebuild-index ${entry.target}`,
|
|
638
|
+
execution: "native",
|
|
639
|
+
asset: entry.asset,
|
|
640
|
+
root: "live",
|
|
641
|
+
})),
|
|
642
|
+
],
|
|
640
643
|
});
|
|
641
644
|
for (const entry of SCAFFOLD_COMMANDS) {
|
|
642
645
|
const command = core
|
package/dist/fast-scaffold.js
CHANGED
|
@@ -11,6 +11,55 @@
|
|
|
11
11
|
*/
|
|
12
12
|
/** The relocated scripts that qualify for the entrypoint fast path. */
|
|
13
13
|
export const FAST_SCAFFOLD_SCRIPTS = [
|
|
14
|
+
...["notify", "probe", "remediate", "run"].map((name) => ({
|
|
15
|
+
name: `job ${name}`,
|
|
16
|
+
kind: "native",
|
|
17
|
+
modulePath: `./commands/core-job-${name}-fast.js`,
|
|
18
|
+
exportName: name === "notify" ? "runJobNotifyFast"
|
|
19
|
+
: name === "probe" ? "runJobProbeFast"
|
|
20
|
+
: name === "remediate" ? "runJobRemediateFast"
|
|
21
|
+
: "runJobFast",
|
|
22
|
+
flagKey: "hq-core-native-fast-route",
|
|
23
|
+
familyFlagKey: "core-native-jobs",
|
|
24
|
+
asset: `core/scripts/hq-job-${name}.sh`,
|
|
25
|
+
root: "live",
|
|
26
|
+
shellCwd: "live",
|
|
27
|
+
shellHqRoot: "live",
|
|
28
|
+
requiresNodeNetworkCompatibility: name === "probe" || name === "run",
|
|
29
|
+
})),
|
|
30
|
+
{
|
|
31
|
+
name: "pin",
|
|
32
|
+
kind: "native",
|
|
33
|
+
modulePath: "./commands/core-pin-fast.js",
|
|
34
|
+
exportName: "runPinFast",
|
|
35
|
+
flagKey: "hq-core-native-fast-route",
|
|
36
|
+
familyFlagKey: "core-native-utilities",
|
|
37
|
+
asset: "core/scripts/hq-pin.sh",
|
|
38
|
+
root: "live",
|
|
39
|
+
shellCwd: "live",
|
|
40
|
+
shellHqRoot: "live",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "worker lint",
|
|
44
|
+
kind: "native",
|
|
45
|
+
modulePath: "./commands/core-worker-lint-fast.js",
|
|
46
|
+
exportName: "runWorkerSkillLintFast",
|
|
47
|
+
flagKey: "hq-core-native-fast-route",
|
|
48
|
+
familyFlagKey: "core-native-worker-skills",
|
|
49
|
+
asset: "core/scripts/lint-shared-worker-skills.sh",
|
|
50
|
+
root: "cwd",
|
|
51
|
+
shellCwd: "caller",
|
|
52
|
+
shellHqRoot: "none",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: "rebuild-index",
|
|
56
|
+
kind: "native",
|
|
57
|
+
modulePath: "./commands/core-rebuild-index-fast.js",
|
|
58
|
+
exportName: "runRebuildIndexFast",
|
|
59
|
+
flagKey: "hq-core-native-fast-route",
|
|
60
|
+
root: "live",
|
|
61
|
+
fallbackToCommandGraph: true,
|
|
62
|
+
},
|
|
14
63
|
{
|
|
15
64
|
name: "checkpoint-stop-gate",
|
|
16
65
|
kind: "native",
|
|
@@ -63,8 +63,8 @@ export declare const MERGE_LISTED_PAIRS_FLAG = "checkpoint.ontology.merge-listed
|
|
|
63
63
|
* carry the copy's `external_ids` and `web_domains` to the survivor.
|
|
64
64
|
*/
|
|
65
65
|
export declare const MERGE_REWRITE_REFS_FLAG = "checkpoint.ontology.merge-rewrite-refs";
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
type CopySkipReason = "no_original" | "original_invalid" | "identity_differs" | "not_in_duplicate_group" | "group_size" | "type_differs" | "names_differ" | "numbered_copy" | "not_listed" | "listed_conflict";
|
|
67
|
+
type PairKind = "numbered" | "variants" | "listed";
|
|
68
68
|
export interface CopySkip {
|
|
69
69
|
copy: string;
|
|
70
70
|
reason: CopySkipReason;
|
|
@@ -93,7 +93,7 @@ export interface ListedPair {
|
|
|
93
93
|
/** Provider -> resolution, applied only when `rewriteRefs` is on and the ids conflict. */
|
|
94
94
|
resolve_external_ids?: Record<string, ExternalIdResolution>;
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
interface CopyPlan extends CopyPair {
|
|
97
97
|
add_aliases: string[];
|
|
98
98
|
/** Copy names the original lacks that another entity already holds, so they do not move. */
|
|
99
99
|
dropped_aliases: string[];
|
|
@@ -196,4 +196,5 @@ export declare function findListedPairs(index: EntityIndex, only: ListedPair[]):
|
|
|
196
196
|
* local copy files only.
|
|
197
197
|
*/
|
|
198
198
|
export declare function mergeCopies(options: MergeCopiesOptions): Promise<MergeCopiesReport>;
|
|
199
|
+
export {};
|
|
199
200
|
//# sourceMappingURL=merge-copies.d.ts.map
|
|
@@ -9,6 +9,7 @@ export type CoreIo = {
|
|
|
9
9
|
env?: NodeJS.ProcessEnv;
|
|
10
10
|
cwd?: string;
|
|
11
11
|
now?: () => Date;
|
|
12
|
+
randomBytes?: (size: number) => Buffer;
|
|
12
13
|
};
|
|
13
14
|
export declare function worktreeGcPathKey(value: string): string;
|
|
14
15
|
export declare function runWorktreeGc(args: readonly string[], hqRoot: string, io?: CoreIo): number;
|