@staff0rd/assist 0.330.1 → 0.330.2
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/index.js +15 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.330.
|
|
9
|
+
version: "0.330.2",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -8541,19 +8541,6 @@ var BUILTIN_DENIES = [
|
|
|
8541
8541
|
message: `Do not run 'git commit' directly. Use 'assist commit "<message>"' instead.`
|
|
8542
8542
|
}
|
|
8543
8543
|
];
|
|
8544
|
-
function matchesBuiltinDeny(part) {
|
|
8545
|
-
return BUILTIN_DENIES.find(
|
|
8546
|
-
(rule) => part === rule.pattern || part.startsWith(`${rule.pattern} `)
|
|
8547
|
-
);
|
|
8548
|
-
}
|
|
8549
|
-
function findBuiltinDeny(parts) {
|
|
8550
|
-
const rule = parts.map(matchesBuiltinDeny).find(Boolean);
|
|
8551
|
-
if (!rule) return void 0;
|
|
8552
|
-
return {
|
|
8553
|
-
permissionDecision: "deny",
|
|
8554
|
-
permissionDecisionReason: rule.message
|
|
8555
|
-
};
|
|
8556
|
-
}
|
|
8557
8544
|
function rawDenyRegex(pattern2) {
|
|
8558
8545
|
const tokens = pattern2.trim().split(/\s+/).map((token) => token.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)).join(String.raw`\s+`);
|
|
8559
8546
|
return new RegExp(`(?<=^|\\s)${tokens}(?=\\s|$)`);
|
|
@@ -8562,14 +8549,26 @@ var RAW_BUILTIN_DENIES = BUILTIN_DENIES.map((rule) => ({
|
|
|
8562
8549
|
...rule,
|
|
8563
8550
|
regex: rawDenyRegex(rule.pattern)
|
|
8564
8551
|
}));
|
|
8565
|
-
function
|
|
8566
|
-
|
|
8552
|
+
function matchBuiltinDeny(text6) {
|
|
8553
|
+
return RAW_BUILTIN_DENIES.find((rule) => rule.regex.test(text6));
|
|
8554
|
+
}
|
|
8555
|
+
function toDecision(rule) {
|
|
8567
8556
|
if (!rule) return void 0;
|
|
8568
8557
|
return {
|
|
8569
8558
|
permissionDecision: "deny",
|
|
8570
8559
|
permissionDecisionReason: rule.message
|
|
8571
8560
|
};
|
|
8572
8561
|
}
|
|
8562
|
+
function findBuiltinDeny(parts) {
|
|
8563
|
+
for (const part of parts) {
|
|
8564
|
+
const decision = toDecision(matchBuiltinDeny(part));
|
|
8565
|
+
if (decision) return decision;
|
|
8566
|
+
}
|
|
8567
|
+
return void 0;
|
|
8568
|
+
}
|
|
8569
|
+
function findBuiltinDenyRaw(rawCommand) {
|
|
8570
|
+
return toDecision(matchBuiltinDeny(rawCommand));
|
|
8571
|
+
}
|
|
8573
8572
|
|
|
8574
8573
|
// src/commands/cliHook/logDeniedToolCall.ts
|
|
8575
8574
|
import { mkdirSync as mkdirSync9 } from "fs";
|