@workit-dev/pi 2.17.0 → 2.17.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.
- package/dist/workit.js +20 -4
- package/package.json +1 -1
package/dist/workit.js
CHANGED
|
@@ -25938,6 +25938,14 @@ var heavyDenial = (original, plan) => ({
|
|
|
25938
25938
|
reason: plan.server ? `dev_server: \`${original.trim()}\` starts a dev server (${plan.reason}), which never returns. Start it in the background, owned by this session; run exactly: ${plan.command}` : `heavy_command: \`${original.trim()}\` is heavy (${plan.reason}) and must run under the machine-wide heavy-check lease, so parallel agents cannot exhaust this machine's memory and CPU. Run exactly: ${plan.command}`,
|
|
25939
25939
|
unblock: plan.command
|
|
25940
25940
|
});
|
|
25941
|
+
var retryDenial = (gate, what, retry) => ({
|
|
25942
|
+
kind: "deny",
|
|
25943
|
+
reason: `workit ${gate}: ${what}.
|
|
25944
|
+
Retry as: ${retry}
|
|
25945
|
+
Why: Claude Code auto mode refuses a call whose input a hook changed.`,
|
|
25946
|
+
unblock: retry
|
|
25947
|
+
});
|
|
25948
|
+
var autoRouteDenial = (plan) => plan.server ? retryDenial("dev-server", "a dev server never returns, so start it in the background, owned by this session", plan.command) : retryDenial("heavy", "this heavy command runs under the machine-wide heavy-check lease", plan.command);
|
|
25941
25949
|
var splitDenial = (plan) => ({
|
|
25942
25950
|
kind: "deny",
|
|
25943
25951
|
reason: plan.reason,
|
|
@@ -30093,7 +30101,7 @@ var standingDelta = (input) => {
|
|
|
30093
30101
|
};
|
|
30094
30102
|
var sinceStart = new Map;
|
|
30095
30103
|
// packages/workit-core/src/hooks/cwd-normalize.ts
|
|
30096
|
-
var DIR = String.raw`[A-Za-z0-9_./@%+:,=-]+|'[^'$${"`"}
|
|
30104
|
+
var DIR = String.raw`(?:[A-Za-z0-9_./@%+:,=-]|(?<=[A-Za-z0-9])~)+|'[^'$${"`"}\n]*'|"(?:[^"$${"`"}\\!\n]|\\(?=[^"$${"`"}\\!\n]))*"`;
|
|
30097
30105
|
var COMPOUND2 = new RegExp(String.raw`^\s*cd\s+(${DIR})\s*&&\s*(workit(?:\s[\s\S]*)?)$`, "u");
|
|
30098
30106
|
var GLOBALS_FIRST = new RegExp(String.raw`^(\s*workit)((?:\s+(?:--json|--cwd(?:=|\s+)(?:${DIR})))+)\s+([a-z][a-z-]*)(?=\s|$)`, "u");
|
|
30099
30107
|
var VERB_FIRST = /^((?:--json\s+)*)([a-z][a-z-]*)(?=\s|$)/u;
|
|
@@ -31427,6 +31435,7 @@ function decide(input, deps) {
|
|
|
31427
31435
|
return withContextLine(text ? { kind: "context", text } : NONE6, promptNudge(input, event.prompt));
|
|
31428
31436
|
}
|
|
31429
31437
|
case "shell.pre": {
|
|
31438
|
+
const auto = input.host === "claude_code" && input.permissionMode === "auto";
|
|
31430
31439
|
const npx = npxWorkit(event.command);
|
|
31431
31440
|
if (npx && workitOnPath2()) {
|
|
31432
31441
|
const canDeny = usable2(descriptor.shellPolicy.deny);
|
|
@@ -31438,6 +31447,8 @@ function decide(input, deps) {
|
|
|
31438
31447
|
const plain = decide({ ...input, event: { ...event, command: npx } }, deps);
|
|
31439
31448
|
if (plain.kind !== "none" && plain.kind !== "context")
|
|
31440
31449
|
return plain;
|
|
31450
|
+
if (auto && canDeny)
|
|
31451
|
+
return retryDenial("npx", "workit is on PATH, so run it directly", npx);
|
|
31441
31452
|
if (usable2(descriptor.shellPolicy.rewrite))
|
|
31442
31453
|
return {
|
|
31443
31454
|
kind: "rewrite",
|
|
@@ -31506,8 +31517,10 @@ function decide(input, deps) {
|
|
|
31506
31517
|
const rewrites = usable2(descriptor.shellPolicy.rewrite);
|
|
31507
31518
|
if (plan.kind === "rewrite" && !rewrites && canDeny)
|
|
31508
31519
|
return heavyDenial(event.command, plan);
|
|
31520
|
+
if (plan.kind === "rewrite" && auto && canDeny)
|
|
31521
|
+
return autoRouteDenial(plan);
|
|
31509
31522
|
const lease = plan.kind === "rewrite" && rewrites ? plan : null;
|
|
31510
|
-
const cwdCommand = !lease && rewrites && input.host === "claude_code" ? cwdRewrite(event.command) ?? verbFirst(event.command) : null;
|
|
31523
|
+
const cwdCommand = !lease && rewrites && input.host === "claude_code" ? cwdRewrite(event.command) ?? (auto ? null : verbFirst(event.command)) : null;
|
|
31511
31524
|
const aside = plan.kind === "passthrough" ? plan.note : null;
|
|
31512
31525
|
noteRawCommit(input, event.command, postTool ? callKey(event.toolUseId, event.command) : NEXT_COMMAND);
|
|
31513
31526
|
const bypass = !lease && input.host === "claude_code" ? workitBypassFlag(event.command, event.dialect) : null;
|
|
@@ -31528,8 +31541,11 @@ function decide(input, deps) {
|
|
|
31528
31541
|
});
|
|
31529
31542
|
const nudge = canDeny ? rawGitPre(input, event.command, { nudge: nudges }) : NONE6;
|
|
31530
31543
|
const nudged = withContextLine(withContextLine(nudge, aside), shipNudge(input, event.command));
|
|
31531
|
-
if (!lease)
|
|
31532
|
-
|
|
31544
|
+
if (!lease) {
|
|
31545
|
+
if (!cwdCommand || nudged.kind === "deny")
|
|
31546
|
+
return nudged;
|
|
31547
|
+
return auto ? retryDenial("cwd", "run one verb per call with --cwd", cwdCommand) : rewritten(nudged.kind === "context" ? nudged.text : null);
|
|
31548
|
+
}
|
|
31533
31549
|
return rewritten([rewriteNote(lease), nudged.kind === "context" ? nudged.text : null].filter(Boolean).join(`
|
|
31534
31550
|
`));
|
|
31535
31551
|
}
|