@workit-dev/pi 1.7.3 → 1.7.4
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 +31 -0
- package/package.json +1 -1
package/dist/workit.js
CHANGED
|
@@ -28643,6 +28643,15 @@ var verbFirst = (command) => {
|
|
|
28643
28643
|
return null;
|
|
28644
28644
|
return `${lead} ${verb}${globals}${command.slice(whole.length)}`;
|
|
28645
28645
|
};
|
|
28646
|
+
var NPX = new RegExp(String.raw`^(\s*(?:cd\s+(?:${DIR})\s*&&\s*)?)npx(?:\s+(?:-y|--yes))*\s+@workit-dev\/cli(?:@[\w.-]+)?(?=\s|$)`, "u");
|
|
28647
|
+
var npxWorkit = (command) => {
|
|
28648
|
+
const match = NPX.exec(command);
|
|
28649
|
+
if (!match)
|
|
28650
|
+
return null;
|
|
28651
|
+
const call = `${match[1]}workit${command.slice(match[0].length)}`;
|
|
28652
|
+
const left = segmentsOf(call).some((s) => s.unanalyzable || s.words.some((w) => /^(npx|@workit-dev\/cli(@\S*)?)$/u.test(w)));
|
|
28653
|
+
return left ? null : cwdRewrite(call) ?? verbFirst(call) ?? call;
|
|
28654
|
+
};
|
|
28646
28655
|
var MUTATING_GIT2 = /^git( -\S+| -[Cc] \S+)* (commit|push|add|switch|checkout|merge|rebase|reset|cherry-pick|revert|branch .*(-[dDmM]|--delete|--move)\b|tag (?!-l\b|--list)|stash(?! (list|show)\b))/u;
|
|
28647
28656
|
var cdWorkitSplit = (command) => {
|
|
28648
28657
|
const match = COMPOUND2.exec(command);
|
|
@@ -29109,6 +29118,28 @@ function decide(input, deps) {
|
|
|
29109
29118
|
return withContextLine(text ? { kind: "context", text } : NONE6, promptNudge(input, event.prompt));
|
|
29110
29119
|
}
|
|
29111
29120
|
case "shell.pre": {
|
|
29121
|
+
const npx = npxWorkit(event.command);
|
|
29122
|
+
if (npx && workitOnPath2()) {
|
|
29123
|
+
const canDeny = usable2(descriptor.shellPolicy.deny);
|
|
29124
|
+
const approve = approveCallIn(npx, event.dialect);
|
|
29125
|
+
if (approve && canDeny && (input.host === "claude_code" || input.host === "pi")) {
|
|
29126
|
+
const fix = approve.plain ? `workit approve ${approve.ids.join(" ")}` : approve.fix;
|
|
29127
|
+
return { kind: "deny", reason: approveCallDeny(fix), unblock: fix };
|
|
29128
|
+
}
|
|
29129
|
+
const plain = decide({ ...input, event: { ...event, command: npx } }, deps);
|
|
29130
|
+
if (plain.kind !== "none" && plain.kind !== "context")
|
|
29131
|
+
return plain;
|
|
29132
|
+
if (usable2(descriptor.shellPolicy.rewrite))
|
|
29133
|
+
return {
|
|
29134
|
+
kind: "rewrite",
|
|
29135
|
+
command: npx,
|
|
29136
|
+
input: event.toolInput ? { ...event.toolInput, command: npx } : null,
|
|
29137
|
+
text: plain.kind === "context" ? plain.text : null
|
|
29138
|
+
};
|
|
29139
|
+
if (canDeny)
|
|
29140
|
+
return { kind: "deny", reason: `Run \`${npx}\`: workit is on PATH.`, unblock: npx };
|
|
29141
|
+
return plain;
|
|
29142
|
+
}
|
|
29112
29143
|
const skillRead = skillReadIn(event.command, event.dialect);
|
|
29113
29144
|
if (skillRead)
|
|
29114
29145
|
recordSkillLoad(input, skillRead, "read");
|