@staff0rd/assist 0.328.0 → 0.329.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/index.js +30 -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.
|
|
9
|
+
version: "0.329.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -4745,7 +4745,6 @@ function buildReviewPrompt(item, phaseNumber) {
|
|
|
4745
4745
|
...buildCommentLines(item.comments),
|
|
4746
4746
|
"",
|
|
4747
4747
|
"If any criterion fails, fix the issue and re-verify.",
|
|
4748
|
-
`If a criterion still fails after fixing, use \`assist backlog rewind ${item.id} <phase> --reason "<reason>"\` to return to the appropriate phase instead of using phase-done.`,
|
|
4749
4748
|
"",
|
|
4750
4749
|
`Post concise comments for any notable findings or changes using \`assist backlog comment ${item.id} "<text>"\`.`,
|
|
4751
4750
|
"",
|
|
@@ -4756,7 +4755,12 @@ function buildReviewPrompt(item, phaseNumber) {
|
|
|
4756
4755
|
"Once the user confirms:",
|
|
4757
4756
|
"1. Run: /commit",
|
|
4758
4757
|
`2. Run: assist backlog done ${item.id} "<summary>"`,
|
|
4759
|
-
`3. Run: assist backlog phase-done ${item.id} ${phaseNumber} "done"
|
|
4758
|
+
`3. Run: assist backlog phase-done ${item.id} ${phaseNumber} "done"`,
|
|
4759
|
+
"",
|
|
4760
|
+
"Precedence rules \u2014 read carefully:",
|
|
4761
|
+
"- User approval plus a successful commit means the work is complete. Always finish with done + phase-done; never rewind already-approved, committed work as an automatic response.",
|
|
4762
|
+
"- If the implementation has diverged from the recorded acceptance criteria but the user has approved it, the default is still to complete the item. You may optionally offer to update the acceptance criteria, but stale criteria are not a reason to rewind.",
|
|
4763
|
+
`- Rewinding is a confirm-first exception, not the normal path. If you believe a criterion genuinely no longer fits and the work should return to an earlier phase, you must ask the user and get explicit confirmation first. Only after they confirm may you run \`assist backlog rewind ${item.id} <phase> --reason "<reason>"\`. Never rewind silently.`
|
|
4760
4764
|
].filter((line) => line !== void 0).join("\n");
|
|
4761
4765
|
}
|
|
4762
4766
|
|
|
@@ -11514,6 +11518,29 @@ function extractComments(text6) {
|
|
|
11514
11518
|
return comments3.map((comment3) => comment3.replace(/\s+/g, " ").trim()).filter((comment3) => comment3.length > 0).filter((comment3) => !isCommentExempt(comment3));
|
|
11515
11519
|
}
|
|
11516
11520
|
|
|
11521
|
+
// src/commands/editHook/introducedComments.ts
|
|
11522
|
+
function introducedComments(added, removed) {
|
|
11523
|
+
const counts = /* @__PURE__ */ new Map();
|
|
11524
|
+
for (const comment3 of removed) {
|
|
11525
|
+
counts.set(comment3, (counts.get(comment3) ?? 0) + 1);
|
|
11526
|
+
}
|
|
11527
|
+
const candidates = [];
|
|
11528
|
+
for (const comment3 of added) {
|
|
11529
|
+
const remaining = counts.get(comment3) ?? 0;
|
|
11530
|
+
if (remaining > 0) counts.set(comment3, remaining - 1);
|
|
11531
|
+
else candidates.push(comment3);
|
|
11532
|
+
}
|
|
11533
|
+
const removedWords = new Set(removed.flatMap(commentWords));
|
|
11534
|
+
return candidates.filter((comment3) => {
|
|
11535
|
+
const words = commentWords(comment3);
|
|
11536
|
+
if (words.length === 0) return true;
|
|
11537
|
+
return !words.every((word) => removedWords.has(word));
|
|
11538
|
+
});
|
|
11539
|
+
}
|
|
11540
|
+
function commentWords(comment3) {
|
|
11541
|
+
return comment3.toLowerCase().split(/[^a-z0-9]+/).filter((word) => word.length > 0);
|
|
11542
|
+
}
|
|
11543
|
+
|
|
11517
11544
|
// src/commands/editHook/decideCommentGuard.ts
|
|
11518
11545
|
var DENY_REASON = 'This edit introduces a code comment, which is blocked by the comment gate. Comments are a last resort \u2014 prefer a clearer name, a smaller function, or a test that makes the comment unnecessary. The comment must not appear in your edit itself. If this one line genuinely earns its keep, use the escape hatch: run `assist code-comment set <file> <line> "<text>"` (single line, max 50 chars, no block comments) to get a pin, then `assist code-comment confirm <pin>` to insert it.';
|
|
11519
11546
|
function defined(values) {
|
|
@@ -11543,19 +11570,6 @@ function partitionStrings(input, existingContent) {
|
|
|
11543
11570
|
return { added: [], removed: [] };
|
|
11544
11571
|
}
|
|
11545
11572
|
}
|
|
11546
|
-
function introducedComments(added, removed) {
|
|
11547
|
-
const counts = /* @__PURE__ */ new Map();
|
|
11548
|
-
for (const comment3 of removed) {
|
|
11549
|
-
counts.set(comment3, (counts.get(comment3) ?? 0) + 1);
|
|
11550
|
-
}
|
|
11551
|
-
const introduced = [];
|
|
11552
|
-
for (const comment3 of added) {
|
|
11553
|
-
const remaining = counts.get(comment3) ?? 0;
|
|
11554
|
-
if (remaining > 0) counts.set(comment3, remaining - 1);
|
|
11555
|
-
else introduced.push(comment3);
|
|
11556
|
-
}
|
|
11557
|
-
return introduced;
|
|
11558
|
-
}
|
|
11559
11573
|
function decideCommentGuard(input, existingContent) {
|
|
11560
11574
|
if (!isSourceFile(input.tool_input.file_path)) return void 0;
|
|
11561
11575
|
const { added, removed } = partitionStrings(input, existingContent);
|