@staff0rd/assist 0.613.0 → 0.614.0
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/README.md +2 -2
- package/claude/commands/add-rule.md +4 -2
- package/claude/commands/fix-rules.md +4 -2
- package/dist/commands/sessions/web/bundle.js +472 -472
- package/dist/index.js +37 -10
- 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.614.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -11537,6 +11537,14 @@ function appendRulesSection(lines2, entry) {
|
|
|
11537
11537
|
}
|
|
11538
11538
|
|
|
11539
11539
|
// src/commands/rules/parseRulesSection.ts
|
|
11540
|
+
var RULE_TITLE = /^\*\*\s*([^*]+?)\s*\*\*\s*(?:[—–:-]\s*)?(.*)$/;
|
|
11541
|
+
function splitTitle(rest) {
|
|
11542
|
+
const match = RULE_TITLE.exec(rest);
|
|
11543
|
+
if (!match) return { text: rest };
|
|
11544
|
+
const title = match[1].trim();
|
|
11545
|
+
const text18 = match[2].trim();
|
|
11546
|
+
return title === "" || text18 === "" ? { text: rest } : { title, text: text18 };
|
|
11547
|
+
}
|
|
11540
11548
|
function parseRulesSection(content) {
|
|
11541
11549
|
const lines2 = content.split(/\r?\n/);
|
|
11542
11550
|
const range = rulesSectionRange(lines2);
|
|
@@ -11546,9 +11554,9 @@ function parseRulesSection(content) {
|
|
|
11546
11554
|
const match = RULE_BULLET.exec(line);
|
|
11547
11555
|
if (!match) continue;
|
|
11548
11556
|
const code = match[1].trim();
|
|
11549
|
-
const
|
|
11550
|
-
if (code === "" ||
|
|
11551
|
-
rules3.push({ code,
|
|
11557
|
+
const rest = match[2].trim();
|
|
11558
|
+
if (code === "" || rest === "") continue;
|
|
11559
|
+
rules3.push({ code, ...splitTitle(rest) });
|
|
11552
11560
|
}
|
|
11553
11561
|
return rules3;
|
|
11554
11562
|
}
|
|
@@ -30606,8 +30614,11 @@ import path71 from "path";
|
|
|
30606
30614
|
import chalk209 from "chalk";
|
|
30607
30615
|
|
|
30608
30616
|
// src/commands/rules/insertRuleBullet.ts
|
|
30609
|
-
function
|
|
30610
|
-
|
|
30617
|
+
function ruleBullet({ code, title, text: text18 }) {
|
|
30618
|
+
return title ? `- **${code}** \u2014 **${title}** \u2014 ${text18}` : `- **${code}** \u2014 ${text18}`;
|
|
30619
|
+
}
|
|
30620
|
+
function insertRuleBullet(content, rule) {
|
|
30621
|
+
const bullet = ruleBullet(rule);
|
|
30611
30622
|
const lines2 = contentLines(content);
|
|
30612
30623
|
const range = rulesSectionRange(lines2);
|
|
30613
30624
|
if (!range) return appendRulesSection(lines2, bullet);
|
|
@@ -30744,7 +30755,14 @@ function addRule(text18, options2) {
|
|
|
30744
30755
|
const targetDir = path71.dirname(target);
|
|
30745
30756
|
const root = findRepoRoot(targetDir) ?? targetDir;
|
|
30746
30757
|
const code = nextRuleCode(root);
|
|
30747
|
-
writeFileSync41(
|
|
30758
|
+
writeFileSync41(
|
|
30759
|
+
target,
|
|
30760
|
+
insertRuleBullet(read2(target), {
|
|
30761
|
+
code,
|
|
30762
|
+
title: options2.title?.trim() || void 0,
|
|
30763
|
+
text: rule
|
|
30764
|
+
})
|
|
30765
|
+
);
|
|
30748
30766
|
updateScopedRulesIndex(root);
|
|
30749
30767
|
console.log(
|
|
30750
30768
|
`Added ${chalk209.cyan(code)} to ${path71.relative(process.cwd(), target) || target}`
|
|
@@ -30773,7 +30791,7 @@ function indexRules() {
|
|
|
30773
30791
|
// src/commands/rules/listRules.ts
|
|
30774
30792
|
import path73 from "path";
|
|
30775
30793
|
import chalk211 from "chalk";
|
|
30776
|
-
function listRules(target) {
|
|
30794
|
+
function listRules(target, options2 = {}) {
|
|
30777
30795
|
const resolved = path73.resolve(target ?? process.cwd());
|
|
30778
30796
|
const rules3 = readScopedRules(resolved);
|
|
30779
30797
|
if (rules3.length === 0) {
|
|
@@ -30791,7 +30809,11 @@ function listRules(target) {
|
|
|
30791
30809
|
chalk211.dim(base ? path73.relative(base, rule.source) : rule.source)
|
|
30792
30810
|
);
|
|
30793
30811
|
}
|
|
30794
|
-
console.log(
|
|
30812
|
+
console.log(
|
|
30813
|
+
` ${chalk211.cyan(rule.code.padEnd(width))} ${rule.title ?? rule.text}`
|
|
30814
|
+
);
|
|
30815
|
+
if (options2.full && rule.title)
|
|
30816
|
+
console.log(` ${" ".repeat(width)} ${chalk211.dim(rule.text)}`);
|
|
30795
30817
|
}
|
|
30796
30818
|
}
|
|
30797
30819
|
|
|
@@ -30800,9 +30822,14 @@ function registerRules(program2) {
|
|
|
30800
30822
|
const rulesCommand = program2.command("rules").description("Read and write the CLAUDE.md rules in scope for a path");
|
|
30801
30823
|
rulesCommand.command("list [path]").description(
|
|
30802
30824
|
"List the rules from the `## Rules` section of every CLAUDE.md from a path's directory up to the repo root (default: cwd)"
|
|
30803
|
-
).
|
|
30825
|
+
).option("--full", "Show each rule's full description as well as its title").action(
|
|
30826
|
+
(target, options2) => listRules(target, options2)
|
|
30827
|
+
);
|
|
30804
30828
|
rulesCommand.command("add <text>").description(
|
|
30805
30829
|
"Add a rule to the `## Rules` section of the scope's CLAUDE.md, allocating the next repo-wide code and creating the section when absent"
|
|
30830
|
+
).option(
|
|
30831
|
+
"--title <title>",
|
|
30832
|
+
"As few words as possible summarising the rule, shown in the rule picker in place of the description"
|
|
30806
30833
|
).option(
|
|
30807
30834
|
"--scope <path>",
|
|
30808
30835
|
"File or directory whose nearest CLAUDE.md receives the rule, or a CLAUDE.md path to write to directly (default: cwd)"
|