@ericrisco/rsc 4.1.1 → 4.1.3
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 -0
- package/manifest.json +1 -1
- package/package.json +1 -1
- package/scripts/doctor.js +51 -1
- package/skills/implement/scripts/task-brief +4 -3
- package/targets/agents.js +13 -1
- package/targets/spec-completeness.mjs +3 -2
package/README.md
CHANGED
package/manifest.json
CHANGED
package/package.json
CHANGED
package/scripts/doctor.js
CHANGED
|
@@ -195,6 +195,55 @@ function ownSkillsIn(paths, declared = []) {
|
|
|
195
195
|
return { present: present.sort(), missing, declared };
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
+
// Diagnose the shipped capability-name defect without rejecting custom MCP tools or
|
|
199
|
+
// changing a user-owned file. Restrict parsing to the frontmatter's tools field.
|
|
200
|
+
function withoutYamlComment(line) {
|
|
201
|
+
let quote = null;
|
|
202
|
+
for (let i = 0; i < line.length; i++) {
|
|
203
|
+
const c = line[i];
|
|
204
|
+
if (quote === '"' && c === '\\') { i++; continue; }
|
|
205
|
+
if (quote && c === quote) {
|
|
206
|
+
if (quote === "'" && line[i + 1] === "'") { i++; continue; }
|
|
207
|
+
quote = null;
|
|
208
|
+
} else if (!quote && (c === '"' || c === "'")) quote = c;
|
|
209
|
+
else if (!quote && c === '#' && (i === 0 || /\s/.test(line[i - 1]))) return line.slice(0, i).trim();
|
|
210
|
+
}
|
|
211
|
+
return line.trim();
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function invalidClaudeAgentTools(root, names) {
|
|
215
|
+
return names.flatMap((id) => {
|
|
216
|
+
const path = agentPath('claude', root, id);
|
|
217
|
+
let text;
|
|
218
|
+
try { text = readFileSync(path, 'utf8').replace(/^\uFEFF/, '').replace(/\r\n?/g, '\n'); } catch { return []; }
|
|
219
|
+
const fm = /^---\n([\s\S]*?)\n---(?:\n|$)/.exec(text)?.[1] || '';
|
|
220
|
+
const rawLines = fm.split('\n');
|
|
221
|
+
const index = rawLines.findIndex((line) => /^tools:/.test(line));
|
|
222
|
+
const lines = rawLines.map(withoutYamlComment);
|
|
223
|
+
if (index < 0) return [];
|
|
224
|
+
let value = lines[index].slice('tools:'.length).trim();
|
|
225
|
+
if (!value) {
|
|
226
|
+
for (const line of lines.slice(index + 1)) {
|
|
227
|
+
if (!line) continue;
|
|
228
|
+
if (!line.startsWith('- ')) break;
|
|
229
|
+
value += `${line}\n`;
|
|
230
|
+
}
|
|
231
|
+
} else if (value.startsWith('[') && !value.endsWith(']')) {
|
|
232
|
+
for (const line of lines.slice(index + 1)) {
|
|
233
|
+
if (/^[\w-]+:/.test(line)) break;
|
|
234
|
+
value += `\n${line}`;
|
|
235
|
+
if (line.endsWith(']')) break;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
const values = value.split(/,|\n/)
|
|
239
|
+
.map((s) => s.trim().replace(/^-\s*/, '').replace(/^[\["']+|[\]"']+$/g, '').trim());
|
|
240
|
+
const tools = [...new Set(values.filter((s) => ['read', 'search', 'edit', 'shell'].includes(s)))];
|
|
241
|
+
return tools.length ? [{ id, path, tools,
|
|
242
|
+
action: `Claude requires native tool names. Run \`rsc sync\`; if this agent was edited, review it or use \`rsc agents reset ${id}\` (backs up your version).`,
|
|
243
|
+
}] : [];
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
|
|
198
247
|
export function doctor({ target, home, cwd }) {
|
|
199
248
|
const root = cwd || process.cwd();
|
|
200
249
|
const paths = targetPaths(target, home, cwd);
|
|
@@ -274,6 +323,7 @@ export function doctor({ target, home, cwd }) {
|
|
|
274
323
|
automationGaps: countGaps(root),
|
|
275
324
|
memory,
|
|
276
325
|
missingAgents,
|
|
326
|
+
invalidAgentTools: target === 'claude' ? invalidClaudeAgentTools(root, state.agents || []) : [],
|
|
277
327
|
agentCollisions: state.agentCollisions || [],
|
|
278
328
|
// #298 — generated agents the user edited and sync kept as they are. Not unhealthy: theirs on
|
|
279
329
|
// purpose. Named with the way back, so a stale edit is one command from rsc's version.
|
|
@@ -307,7 +357,7 @@ export function doctor({ target, home, cwd }) {
|
|
|
307
357
|
report.onboarding = { status: 'incomplete', missing: ['<onboarding readiness could not be read>'], pending: [], action: String(error?.message || error).slice(0, 200) };
|
|
308
358
|
}
|
|
309
359
|
report.healthy = report.hookWired && !report.missing.length && !missingAgents.length && !missingCommands.length
|
|
310
|
-
&& !report.opencodePluginsOutdated.length;
|
|
360
|
+
&& !report.opencodePluginsOutdated.length && !report.invalidAgentTools.length;
|
|
311
361
|
return report;
|
|
312
362
|
}
|
|
313
363
|
|
|
@@ -61,10 +61,11 @@ CONTENT="$(awk -v n="$N" '
|
|
|
61
61
|
t = $0; sub(/^\*\*/, "", t); sub(/[^Tt0-9].*$/, "", t)
|
|
62
62
|
if (idnum(t) == n) { bold = 1; found = 1; print ""; print; next }
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
# `###?` rather than a brace interval: mawk (the default awk on Debian) does not read intervals.
|
|
65
|
+
/^###?[[:space:]]/ {
|
|
65
66
|
if (printing) { printing = 0 }
|
|
66
|
-
if (match($0,
|
|
67
|
-
t = $0; sub(
|
|
67
|
+
if (match($0, /^###?[[:space:]]+[Tt][0-9]+([[:space:](]|-|$)/)) {
|
|
68
|
+
t = $0; sub(/^###?[[:space:]]+/, "", t); sub(/[^Tt0-9].*$/, "", t)
|
|
68
69
|
if (idnum(t) == n) { printing = 1; found = 1; print ""; print; next }
|
|
69
70
|
}
|
|
70
71
|
}
|
package/targets/agents.js
CHANGED
|
@@ -31,7 +31,7 @@ const TIER_MODEL = {
|
|
|
31
31
|
// (Amp/Zed/Windsurf/Cline/Roo/Continue/Aider/Jules/Antigravity) — there the developer
|
|
32
32
|
// model is advisory (model-routing), not a file.
|
|
33
33
|
const AGENT_TARGETS = {
|
|
34
|
-
claude: { dir: '.claude/agents', ext: '.md', format: 'md', model: (t) => (t === 'heavy' ? 'opus' : 'sonnet') },
|
|
34
|
+
claude: { dir: '.claude/agents', ext: '.md', format: 'md', toolsFormat: 'claude', model: (t) => (t === 'heavy' ? 'opus' : 'sonnet') },
|
|
35
35
|
junie: { dir: '.junie/agents', ext: '.md', format: 'md', model: (t) => (t === 'heavy' ? 'opus' : 'sonnet') },
|
|
36
36
|
cursor: { dir: '.cursor/agents', ext: '.md', format: 'md', model: (t) => TIER_MODEL.anthropic[t] },
|
|
37
37
|
// #298 — OpenCode is the one tool people point at a local model or another provider per session, so
|
|
@@ -213,6 +213,8 @@ export function writeDeveloperTier(cwd, tier) {
|
|
|
213
213
|
// OpenCode V1 tool names a declared capability maps to. `read`/`search` need nothing: what the agent
|
|
214
214
|
// may read is the project's policy to decide, and saying `read: true` would be a grant.
|
|
215
215
|
const RESTRICT_TOOLS = { edit: ['edit', 'write', 'patch'], shell: ['bash'] };
|
|
216
|
+
// Claude accepts native tool names, not the catalog's provider-neutral capabilities.
|
|
217
|
+
const CLAUDE_TOOLS = { read: ['Read'], search: ['Grep', 'Glob'], edit: ['Edit', 'Write'], shell: ['Bash'] };
|
|
216
218
|
function restrictedTools(tools) {
|
|
217
219
|
if (!tools) return [];
|
|
218
220
|
return Object.entries(RESTRICT_TOOLS).filter(([cap]) => !tools.includes(cap)).flatMap(([, names]) => names);
|
|
@@ -229,6 +231,12 @@ function renderMd(spec, model, agent, toolsFormat = spec.toolsFormat) {
|
|
|
229
231
|
fm.push('tools:');
|
|
230
232
|
for (const tool of denied) fm.push(` ${tool}: false`);
|
|
231
233
|
}
|
|
234
|
+
} else if (toolsFormat === 'claude') {
|
|
235
|
+
const names = agent.tools.flatMap((capability) => {
|
|
236
|
+
if (!CLAUDE_TOOLS[capability]) throw new Error(`Unknown Claude tool capability: ${capability}`);
|
|
237
|
+
return CLAUDE_TOOLS[capability];
|
|
238
|
+
});
|
|
239
|
+
fm.push(`tools: ${[...new Set(names)].join(', ')}`);
|
|
232
240
|
} else if (toolsFormat === 'map') {
|
|
233
241
|
fm.push('tools:');
|
|
234
242
|
for (const tool of agent.tools) fm.push(` ${tool}: true`);
|
|
@@ -299,6 +307,10 @@ function knownRenderings(target, cwd, agent) {
|
|
|
299
307
|
for (const tier of ['balanced', 'heavy']) {
|
|
300
308
|
out.add(renderAgent(target, spec, resolveModel(target, cwd, tier), agent));
|
|
301
309
|
out.add(renderAgent(target, spec, spec.model(tier), agent));
|
|
310
|
+
if (target === 'claude') {
|
|
311
|
+
out.add(renderAgent(target, spec, resolveModel(target, cwd, tier), agent, 'list'));
|
|
312
|
+
out.add(renderAgent(target, spec, spec.model(tier), agent, 'list'));
|
|
313
|
+
}
|
|
302
314
|
if (spec.legacyModel) out.add(renderAgent(target, spec, spec.legacyModel(tier), agent, 'map'));
|
|
303
315
|
}
|
|
304
316
|
return out;
|
|
@@ -182,7 +182,8 @@ function parseOpenPoints(lines) {
|
|
|
182
182
|
* untyped: string[], unchecked: string[]}}
|
|
183
183
|
*/
|
|
184
184
|
export function specCompleteness(markdown) {
|
|
185
|
-
const
|
|
185
|
+
const text = String(markdown ?? '').replace(/^\uFEFF/, '').replace(/\r\n?/g, '\n');
|
|
186
|
+
const lines = text.split('\n');
|
|
186
187
|
const sections = new Map(); // family -> body lines
|
|
187
188
|
|
|
188
189
|
let current = null;
|
|
@@ -197,7 +198,7 @@ export function specCompleteness(markdown) {
|
|
|
197
198
|
if (current && sections.has(current)) sections.get(current).push(line);
|
|
198
199
|
}
|
|
199
200
|
|
|
200
|
-
const families = requiredFamilies(
|
|
201
|
+
const families = requiredFamilies(text);
|
|
201
202
|
const missing = families.filter((f) => !sections.has(f));
|
|
202
203
|
const empty = families.filter((f) => sections.has(f) && !hasSubstance(sections.get(f)));
|
|
203
204
|
|