@staff0rd/assist 0.1155.0 → 0.1157.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/agent/commands/add-rule.md +7 -1
- package/dist/.build-files +16 -17
- package/dist/built-version +1 -1
- package/dist/{chunk-FKHKR4UU.js → chunk-47342FQ6.js} +1 -1
- package/dist/{chunk-QXVJYD33.js → chunk-6ZGNASPH.js} +1 -1
- package/dist/{chunk-R7MRAYLZ.js → chunk-7OPKFWV7.js} +2 -2
- package/dist/{chunk-ZA7XPP63.js → chunk-DMNI6R3V.js} +1 -1
- package/dist/{chunk-U7UPKLBZ.js → chunk-GVFVEKA7.js} +1 -1
- package/dist/{chunk-OCMOCAJ5.js → chunk-HWIPF4RO.js} +1 -1
- package/dist/commands/sessions/web/bundle.js +385 -385
- package/dist/{doctorNodes-7VOBS7QT.js → doctorNodes-X65BKJTV.js} +3 -3
- package/dist/index.js +16 -17
- package/dist/{restartNode-OYD6K3I3.js → restartNode-BS54KMDE.js} +5 -5
- package/dist/rulesAdd-BY3QLX3M.js +317 -0
- package/dist/{runDaemon-AK3NM65C.js → runDaemon-NHDXRPTA.js} +6 -3
- package/dist/{signExtension-KDADDRPS.js → signExtension-AKNHXLIK.js} +1 -1
- package/dist/{updateNode-MNAVM4QG.js → updateNode-PUE4TL5Q.js} +5 -5
- package/dist/{web-W47PETV3.js → web-7FYUCPQU.js} +5 -5
- package/dist/{web-3GFJKG3L.js → web-DDPTXXOY.js} +5 -5
- package/package.json +1 -1
- package/dist/addRule-J432LIS3.js +0 -102
- package/dist/addUserRule-XO2BNQFH.js +0 -136
- package/dist/{add-QQQ472AZ.js → add-LM2C4OO4.js} +3 -3
- package/dist/{sqlQuery-OAXPQJPY.js → sqlQuery-XCD5LQOS.js} +3 -3
package/dist/addRule-J432LIS3.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
findClaudeFiles,
|
|
3
|
-
updateScopedRulesIndex
|
|
4
|
-
} from "./chunk-I3TEQBTO.js";
|
|
5
|
-
import {
|
|
6
|
-
RULE_BULLET,
|
|
7
|
-
appendRulesSection,
|
|
8
|
-
contentLines,
|
|
9
|
-
parseRulesSection,
|
|
10
|
-
rulesSectionRange,
|
|
11
|
-
scopeDirectory
|
|
12
|
-
} from "./chunk-ADLCDG2V.js";
|
|
13
|
-
import {
|
|
14
|
-
findRepoRoot
|
|
15
|
-
} from "./chunk-WXQ3EA5H.js";
|
|
16
|
-
|
|
17
|
-
// src/commands/rules/addRule.ts
|
|
18
|
-
import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync } from "fs";
|
|
19
|
-
import path2 from "path";
|
|
20
|
-
import chalk from "chalk";
|
|
21
|
-
|
|
22
|
-
// src/commands/rules/insertRuleBullet.ts
|
|
23
|
-
function ruleBullet({ code, title, text }) {
|
|
24
|
-
return title ? `- **${code}** \u2014 **${title}** \u2014 ${text}` : `- **${code}** \u2014 ${text}`;
|
|
25
|
-
}
|
|
26
|
-
function insertRuleBullet(content, rule) {
|
|
27
|
-
const bullet = ruleBullet(rule);
|
|
28
|
-
const lines = contentLines(content);
|
|
29
|
-
const range = rulesSectionRange(lines);
|
|
30
|
-
if (!range) return appendRulesSection(lines, bullet);
|
|
31
|
-
const body = lines.slice(range.start + 1, range.end);
|
|
32
|
-
const lastBullet = body.reduce(
|
|
33
|
-
(last, line, index) => RULE_BULLET.test(line) ? index : last,
|
|
34
|
-
-1
|
|
35
|
-
);
|
|
36
|
-
const at = lastBullet === -1 ? range.start + 1 : range.start + lastBullet + 2;
|
|
37
|
-
const inserted = lastBullet === -1 ? ["", bullet] : [bullet];
|
|
38
|
-
return `${[...lines.slice(0, at), ...inserted, ...lines.slice(at)].join("\n")}
|
|
39
|
-
`;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// src/commands/rules/nextRuleCode.ts
|
|
43
|
-
import { readFileSync } from "fs";
|
|
44
|
-
var CODE_PREFIX = "R";
|
|
45
|
-
function nextRuleCode(root) {
|
|
46
|
-
const numbers = findClaudeFiles(root).flatMap(
|
|
47
|
-
(file) => parseRulesSection(readFileSync(file, "utf8")).map(
|
|
48
|
-
(rule) => Number(/(\d+)\s*$/.exec(rule.code)?.[1] ?? 0)
|
|
49
|
-
)
|
|
50
|
-
);
|
|
51
|
-
return `${CODE_PREFIX}${Math.max(0, ...numbers) + 1}`;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// src/commands/rules/resolveRuleScope.ts
|
|
55
|
-
import { existsSync } from "fs";
|
|
56
|
-
import path from "path";
|
|
57
|
-
function resolveRuleScope(target) {
|
|
58
|
-
const resolved = path.resolve(target);
|
|
59
|
-
if (path.basename(resolved) === "CLAUDE.md") return resolved;
|
|
60
|
-
const startDir = scopeDirectory(resolved);
|
|
61
|
-
const root = findRepoRoot(startDir) ?? startDir;
|
|
62
|
-
let current = startDir;
|
|
63
|
-
while (true) {
|
|
64
|
-
const candidate = path.join(current, "CLAUDE.md");
|
|
65
|
-
if (existsSync(candidate)) return candidate;
|
|
66
|
-
if (current === root || current === path.dirname(current)) break;
|
|
67
|
-
current = path.dirname(current);
|
|
68
|
-
}
|
|
69
|
-
return path.join(root, "CLAUDE.md");
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// src/commands/rules/addRule.ts
|
|
73
|
-
function read(file) {
|
|
74
|
-
return existsSync2(file) ? readFileSync2(file, "utf8") : "";
|
|
75
|
-
}
|
|
76
|
-
function addRule(text, options) {
|
|
77
|
-
const rule = text.trim();
|
|
78
|
-
if (rule === "") {
|
|
79
|
-
console.error(chalk.red("Rule text is required"));
|
|
80
|
-
process.exitCode = 1;
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
const target = resolveRuleScope(options.scope ?? process.cwd());
|
|
84
|
-
const targetDir = path2.dirname(target);
|
|
85
|
-
const root = findRepoRoot(targetDir) ?? targetDir;
|
|
86
|
-
const code = nextRuleCode(root);
|
|
87
|
-
writeFileSync(
|
|
88
|
-
target,
|
|
89
|
-
insertRuleBullet(read(target), {
|
|
90
|
-
code,
|
|
91
|
-
title: options.title?.trim() || void 0,
|
|
92
|
-
text: rule
|
|
93
|
-
})
|
|
94
|
-
);
|
|
95
|
-
updateScopedRulesIndex(root);
|
|
96
|
-
console.log(
|
|
97
|
-
`Added ${chalk.cyan(code)} to ${path2.relative(process.cwd(), target) || target}`
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
export {
|
|
101
|
-
addRule
|
|
102
|
-
};
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
globalConfigFileLabel
|
|
3
|
-
} from "./chunk-SEXIHLGA.js";
|
|
4
|
-
import {
|
|
5
|
-
applyUserConfigSet
|
|
6
|
-
} from "./chunk-2O7TIRCQ.js";
|
|
7
|
-
import {
|
|
8
|
-
applyConfigSet
|
|
9
|
-
} from "./chunk-5WQDLREX.js";
|
|
10
|
-
import {
|
|
11
|
-
applySharedRepoConfigSet
|
|
12
|
-
} from "./chunk-MY4TNZNI.js";
|
|
13
|
-
import "./chunk-OU6Q5ZS3.js";
|
|
14
|
-
import "./chunk-5JOVEUBS.js";
|
|
15
|
-
import "./chunk-VPMI4LV2.js";
|
|
16
|
-
import {
|
|
17
|
-
resolveSharedRepoBlock
|
|
18
|
-
} from "./chunk-BBXEZVRL.js";
|
|
19
|
-
import "./chunk-7CEIET2O.js";
|
|
20
|
-
import "./chunk-WGV2ELBS.js";
|
|
21
|
-
import "./chunk-YOFY27RM.js";
|
|
22
|
-
import "./chunk-B5ZOANOD.js";
|
|
23
|
-
import "./chunk-3XQHTIHW.js";
|
|
24
|
-
import "./chunk-HSWDSL22.js";
|
|
25
|
-
import "./chunk-MBPVW7BY.js";
|
|
26
|
-
import "./chunk-YNHPTUHS.js";
|
|
27
|
-
import "./chunk-XZFSW5AY.js";
|
|
28
|
-
import {
|
|
29
|
-
getDb
|
|
30
|
-
} from "./chunk-PD2BTMEY.js";
|
|
31
|
-
import "./chunk-3QKE2ONF.js";
|
|
32
|
-
import "./chunk-O5JIFWMQ.js";
|
|
33
|
-
import "./chunk-LMUTL44M.js";
|
|
34
|
-
import "./chunk-6NDXAN45.js";
|
|
35
|
-
import "./chunk-EW2ZM2PC.js";
|
|
36
|
-
import "./chunk-QKHOYKUQ.js";
|
|
37
|
-
import {
|
|
38
|
-
loadGlobalConfigRaw
|
|
39
|
-
} from "./chunk-KGFZYUE2.js";
|
|
40
|
-
import {
|
|
41
|
-
getGlobalConfigPath
|
|
42
|
-
} from "./chunk-LBAPKP6M.js";
|
|
43
|
-
import "./chunk-GRXFWFGP.js";
|
|
44
|
-
import "./chunk-TVQY3HPZ.js";
|
|
45
|
-
import "./chunk-CGYVYHMM.js";
|
|
46
|
-
import "./chunk-WXQ3EA5H.js";
|
|
47
|
-
import "./chunk-YXXKT6LL.js";
|
|
48
|
-
import "./chunk-USKD27FY.js";
|
|
49
|
-
import "./chunk-HN7MFXZ7.js";
|
|
50
|
-
import "./chunk-DZGYHAE7.js";
|
|
51
|
-
|
|
52
|
-
// src/commands/rules/addUserRule.ts
|
|
53
|
-
import chalk3 from "chalk";
|
|
54
|
-
|
|
55
|
-
// src/commands/rules/addToRepoDb.ts
|
|
56
|
-
import chalk2 from "chalk";
|
|
57
|
-
|
|
58
|
-
// src/commands/rules/appendRule.ts
|
|
59
|
-
function appendRule(current, rule) {
|
|
60
|
-
return [...Array.isArray(current) ? current : [], rule];
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// src/commands/rules/failRule.ts
|
|
64
|
-
import chalk from "chalk";
|
|
65
|
-
function failRule(message) {
|
|
66
|
-
console.error(chalk.red(message));
|
|
67
|
-
process.exitCode = 1;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// src/commands/rules/addToRepoDb.ts
|
|
71
|
-
async function addToRepoDb(rule, repo, cwd) {
|
|
72
|
-
const repoName = typeof repo === "string" ? repo : void 0;
|
|
73
|
-
const { block } = await resolveSharedRepoBlock(await getDb(), repoName, cwd);
|
|
74
|
-
const advice = block.advice;
|
|
75
|
-
const result = await applySharedRepoConfigSet(
|
|
76
|
-
"advice.rules",
|
|
77
|
-
appendRule(advice?.rules, rule),
|
|
78
|
-
repoName,
|
|
79
|
-
cwd
|
|
80
|
-
);
|
|
81
|
-
if (!result.ok) return failRule(result.errors.join("\n"));
|
|
82
|
-
console.log(
|
|
83
|
-
`Added ${chalk2.cyan(rule.title)} to advice.rules in repo (db): ${result.label}`
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// src/commands/rules/userRuleOptionsError.ts
|
|
88
|
-
function userRuleOptionsError(options) {
|
|
89
|
-
const targets = [
|
|
90
|
-
options.user && "--user",
|
|
91
|
-
options.node && "--node",
|
|
92
|
-
options.repo !== void 0 && "--repo"
|
|
93
|
-
].filter(Boolean);
|
|
94
|
-
if (targets.length > 1)
|
|
95
|
-
return `${targets.join(", ")} each write advice.rules in a different scope (user (db), user (node), repo (db)); pass one`;
|
|
96
|
-
if (options.scope !== void 0)
|
|
97
|
-
return `${targets[0]} writes advice.rules, not a CLAUDE.md, and cannot be combined with --scope`;
|
|
98
|
-
return void 0;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// src/commands/rules/addUserRule.ts
|
|
102
|
-
async function addToUserDb(rule) {
|
|
103
|
-
const result = await applyUserConfigSet(
|
|
104
|
-
"advice.rules",
|
|
105
|
-
(current) => appendRule(current, rule)
|
|
106
|
-
);
|
|
107
|
-
if (!result.ok) return failRule(result.errors.join("\n"));
|
|
108
|
-
console.log(`Added ${chalk3.cyan(rule.title)} to advice.rules in user (db)`);
|
|
109
|
-
}
|
|
110
|
-
function addToUserNode(rule, globalConfigPath) {
|
|
111
|
-
const advice = loadGlobalConfigRaw(globalConfigPath).advice;
|
|
112
|
-
const result = applyConfigSet(
|
|
113
|
-
"advice.rules",
|
|
114
|
-
appendRule(advice?.rules, rule),
|
|
115
|
-
true,
|
|
116
|
-
process.cwd(),
|
|
117
|
-
globalConfigPath
|
|
118
|
-
);
|
|
119
|
-
if (!result.ok) return failRule(result.errors.join("\n"));
|
|
120
|
-
console.log(
|
|
121
|
-
`Added ${chalk3.cyan(rule.title)} to advice.rules in user (node) (${globalConfigFileLabel(globalConfigPath)})`
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
async function addUserRule(text, options, globalConfigPath = getGlobalConfigPath(), cwd = process.cwd()) {
|
|
125
|
-
const error = userRuleOptionsError(options);
|
|
126
|
-
if (error) return failRule(error);
|
|
127
|
-
const rule = { title: options.title?.trim() ?? "", text: text.trim() };
|
|
128
|
-
if (rule.text === "" || rule.title === "")
|
|
129
|
-
return failRule("advice.rules entries need both rule text and --title");
|
|
130
|
-
if (options.user) return addToUserDb(rule);
|
|
131
|
-
if (options.repo !== void 0) return addToRepoDb(rule, options.repo, cwd);
|
|
132
|
-
addToUserNode(rule, globalConfigPath);
|
|
133
|
-
}
|
|
134
|
-
export {
|
|
135
|
-
addUserRule
|
|
136
|
-
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
extractOption
|
|
3
|
+
} from "./chunk-KP5S3FE5.js";
|
|
1
4
|
import {
|
|
2
5
|
editRepoRunList,
|
|
3
6
|
runCommandFilePath
|
|
4
7
|
} from "./chunk-6EYCU3MQ.js";
|
|
5
|
-
import {
|
|
6
|
-
extractOption
|
|
7
|
-
} from "./chunk-KP5S3FE5.js";
|
|
8
8
|
import "./chunk-JPRADR2E.js";
|
|
9
9
|
import {
|
|
10
10
|
buildRunEntry
|