@workit-dev/pi 1.7.2 → 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/worker.js +1 -0
- package/dist/workit.js +32 -0
- package/package.json +1 -1
package/dist/worker.js
CHANGED
|
@@ -9107,6 +9107,7 @@ import path14 from "node:path";
|
|
|
9107
9107
|
// packages/workit-core/src/approvals/store.ts
|
|
9108
9108
|
var REQUEST_TTL_MS = 30 * 60000;
|
|
9109
9109
|
var GRANT_TTL_MS = 15 * 60000;
|
|
9110
|
+
var ASKING_HOSTS = new Set(["claude_code", "pi"]);
|
|
9110
9111
|
|
|
9111
9112
|
// packages/workit-core/src/hooks/hosts/fields.ts
|
|
9112
9113
|
var SHELLS2 = new Set(["sh", "bash", "zsh", "dash", "pwsh", "powershell", "cmd"]);
|
package/dist/workit.js
CHANGED
|
@@ -27398,6 +27398,7 @@ var recordApprovalRejected = (input, now = new Date) => {
|
|
|
27398
27398
|
return;
|
|
27399
27399
|
write(fileOf("rejected", input.id), { ...input, at: now.toISOString() });
|
|
27400
27400
|
};
|
|
27401
|
+
var ASKING_HOSTS = new Set(["claude_code", "pi"]);
|
|
27401
27402
|
|
|
27402
27403
|
// packages/workit-core/src/approvals/call.ts
|
|
27403
27404
|
var isWorkitWord2 = (word) => /^(?:.*[\\/])?workit(?:-cli)?$/u.test(word);
|
|
@@ -28642,6 +28643,15 @@ var verbFirst = (command) => {
|
|
|
28642
28643
|
return null;
|
|
28643
28644
|
return `${lead} ${verb}${globals}${command.slice(whole.length)}`;
|
|
28644
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
|
+
};
|
|
28645
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;
|
|
28646
28656
|
var cdWorkitSplit = (command) => {
|
|
28647
28657
|
const match = COMPOUND2.exec(command);
|
|
@@ -29108,6 +29118,28 @@ function decide(input, deps) {
|
|
|
29108
29118
|
return withContextLine(text ? { kind: "context", text } : NONE6, promptNudge(input, event.prompt));
|
|
29109
29119
|
}
|
|
29110
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
|
+
}
|
|
29111
29143
|
const skillRead = skillReadIn(event.command, event.dialect);
|
|
29112
29144
|
if (skillRead)
|
|
29113
29145
|
recordSkillLoad(input, skillRead, "read");
|