@staff0rd/assist 0.330.0 → 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/commands/sessions/web/bundle.js +38 -38
- package/dist/index.js +26 -21
- 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: {
|
|
@@ -6274,18 +6274,24 @@ async function prList(req, res) {
|
|
|
6274
6274
|
}
|
|
6275
6275
|
|
|
6276
6276
|
// src/commands/sessions/web/prStatus.ts
|
|
6277
|
-
var
|
|
6278
|
-
["pr", "view", "--json", "number"],
|
|
6277
|
+
var getPr = createCachedGhJson(
|
|
6278
|
+
["pr", "view", "--json", "number,title,author,createdAt"],
|
|
6279
6279
|
(stdout) => {
|
|
6280
6280
|
const parsed = JSON.parse(stdout);
|
|
6281
|
-
|
|
6281
|
+
if (typeof parsed.number !== "number") return null;
|
|
6282
|
+
return {
|
|
6283
|
+
number: parsed.number,
|
|
6284
|
+
title: parsed.title ?? "",
|
|
6285
|
+
author: parsed.author?.name || parsed.author?.login || "unknown",
|
|
6286
|
+
createdAt: parsed.createdAt ?? ""
|
|
6287
|
+
};
|
|
6282
6288
|
},
|
|
6283
6289
|
null
|
|
6284
6290
|
);
|
|
6285
6291
|
async function prStatus(req, res) {
|
|
6286
6292
|
const cwd = getCwdParam(req, res);
|
|
6287
6293
|
if (!cwd) return;
|
|
6288
|
-
respondJson(res, 200, {
|
|
6294
|
+
respondJson(res, 200, { pr: await getPr(cwd) });
|
|
6289
6295
|
}
|
|
6290
6296
|
|
|
6291
6297
|
// src/commands/sessions/daemon/stopDaemon.ts
|
|
@@ -8535,19 +8541,6 @@ var BUILTIN_DENIES = [
|
|
|
8535
8541
|
message: `Do not run 'git commit' directly. Use 'assist commit "<message>"' instead.`
|
|
8536
8542
|
}
|
|
8537
8543
|
];
|
|
8538
|
-
function matchesBuiltinDeny(part) {
|
|
8539
|
-
return BUILTIN_DENIES.find(
|
|
8540
|
-
(rule) => part === rule.pattern || part.startsWith(`${rule.pattern} `)
|
|
8541
|
-
);
|
|
8542
|
-
}
|
|
8543
|
-
function findBuiltinDeny(parts) {
|
|
8544
|
-
const rule = parts.map(matchesBuiltinDeny).find(Boolean);
|
|
8545
|
-
if (!rule) return void 0;
|
|
8546
|
-
return {
|
|
8547
|
-
permissionDecision: "deny",
|
|
8548
|
-
permissionDecisionReason: rule.message
|
|
8549
|
-
};
|
|
8550
|
-
}
|
|
8551
8544
|
function rawDenyRegex(pattern2) {
|
|
8552
8545
|
const tokens = pattern2.trim().split(/\s+/).map((token) => token.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)).join(String.raw`\s+`);
|
|
8553
8546
|
return new RegExp(`(?<=^|\\s)${tokens}(?=\\s|$)`);
|
|
@@ -8556,14 +8549,26 @@ var RAW_BUILTIN_DENIES = BUILTIN_DENIES.map((rule) => ({
|
|
|
8556
8549
|
...rule,
|
|
8557
8550
|
regex: rawDenyRegex(rule.pattern)
|
|
8558
8551
|
}));
|
|
8559
|
-
function
|
|
8560
|
-
|
|
8552
|
+
function matchBuiltinDeny(text6) {
|
|
8553
|
+
return RAW_BUILTIN_DENIES.find((rule) => rule.regex.test(text6));
|
|
8554
|
+
}
|
|
8555
|
+
function toDecision(rule) {
|
|
8561
8556
|
if (!rule) return void 0;
|
|
8562
8557
|
return {
|
|
8563
8558
|
permissionDecision: "deny",
|
|
8564
8559
|
permissionDecisionReason: rule.message
|
|
8565
8560
|
};
|
|
8566
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
|
+
}
|
|
8567
8572
|
|
|
8568
8573
|
// src/commands/cliHook/logDeniedToolCall.ts
|
|
8569
8574
|
import { mkdirSync as mkdirSync9 } from "fs";
|
|
@@ -21257,7 +21262,7 @@ function watchActivity(session, notify2) {
|
|
|
21257
21262
|
} catch {
|
|
21258
21263
|
return;
|
|
21259
21264
|
}
|
|
21260
|
-
|
|
21265
|
+
reconcileActivity(session.id, session.activity);
|
|
21261
21266
|
let timer = null;
|
|
21262
21267
|
const read = () => {
|
|
21263
21268
|
timer = null;
|