fix: address PR review findings in skill validator
- Guard against YAML comment lines in parseFrontmatterMultiline - Broaden PATH-02 to detect any installed_path mention, not just variable refs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
84bade9a95
commit
fd1e24c5c2
|
|
@ -135,6 +135,8 @@ function parseFrontmatterMultiline(content) {
|
||||||
currentKey = line.slice(0, colonIndex).trim();
|
currentKey = line.slice(0, colonIndex).trim();
|
||||||
currentValue = line.slice(colonIndex + 1);
|
currentValue = line.slice(colonIndex + 1);
|
||||||
} else if (currentKey !== null) {
|
} else if (currentKey !== null) {
|
||||||
|
// Skip YAML comment lines
|
||||||
|
if (line.trimStart().startsWith('#')) continue;
|
||||||
// Continuation of multiline value
|
// Continuation of multiline value
|
||||||
currentValue += '\n' + line;
|
currentValue += '\n' + line;
|
||||||
}
|
}
|
||||||
|
|
@ -448,19 +450,19 @@ function validateSkill(skillDir) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check content for {installed_path}
|
// Check content for any mention of installed_path (variable ref, prose, bare text)
|
||||||
const stripped = stripCodeBlocks(content);
|
const stripped = stripCodeBlocks(content);
|
||||||
const lines = stripped.split('\n');
|
const lines = stripped.split('\n');
|
||||||
for (const [i, line] of lines.entries()) {
|
for (const [i, line] of lines.entries()) {
|
||||||
if (line.includes('{installed_path}')) {
|
if (/installed_path/i.test(line)) {
|
||||||
findings.push({
|
findings.push({
|
||||||
rule: 'PATH-02',
|
rule: 'PATH-02',
|
||||||
title: 'No installed_path Variable',
|
title: 'No installed_path Variable',
|
||||||
severity: 'HIGH',
|
severity: 'HIGH',
|
||||||
file: relFile,
|
file: relFile,
|
||||||
line: i + 1,
|
line: i + 1,
|
||||||
detail: '`{installed_path}` reference found in content.',
|
detail: '`installed_path` reference found in content.',
|
||||||
fix: 'Replace `{installed_path}/path` with a relative path (`./path` or `../path`).',
|
fix: 'Remove all installed_path usage. Use relative paths (`./path` or `../path`) instead.',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue