fix: count observations for whitespace paths

This commit is contained in:
haelyra
2026-08-29 16:07:00 -04:00
parent 1bdda4bdac
commit 299544e680
2 changed files with 9 additions and 2 deletions
+1 -1
View File
@@ -134,7 +134,7 @@ scan_dir_to_json() {
name=$(extract_field "$file" "name")
desc=$(extract_field "$file" "description")
mtime=$(date -u -r "$file" +%Y-%m-%dT%H:%M:%SZ)
if [[ "$file" == *$'\n'* ]]; then
if [[ "$file" == *[[:space:]]* ]]; then
# The aggregated fast path is line-delimited. Preserve unusual paths by
# falling back to the structured JSON matcher for this record.
u7=$(count_obs "$file" "$c7")
@@ -61,7 +61,7 @@ if (process.platform === 'win32') {
const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-skill-stocktake-'));
try {
const projectSkills = path.join(tempRoot, 'project', '.claude', 'skills');
const directSkill = path.join(projectSkills, 'direct-skill');
const directSkill = path.join(projectSkills, 'direct skill');
const linkedTarget = path.join(tempRoot, 'shared', 'linked-skill');
const newlineSkill = path.join(projectSkills, 'newline\nskill');
const resultsPath = path.join(tempRoot, 'results.json');
@@ -83,6 +83,10 @@ if (process.platform === 'win32') {
tool: 'Read',
path: path.join(newlineSkill, 'SKILL.md'),
timestamp: new Date().toISOString(),
})}\n${JSON.stringify({
tool: 'Read',
path: path.join(directSkill, 'SKILL.md'),
timestamp: new Date().toISOString(),
})}\n`,
);
@@ -104,6 +108,9 @@ if (process.platform === 'win32') {
const newlineEntry = output.skills.find(skill => skill.name === 'newline-skill');
assert.strictEqual(newlineEntry.use_7d, 1);
assert.strictEqual(newlineEntry.use_30d, 1);
const spaceEntry = output.skills.find(skill => skill.name === 'direct-skill');
assert.strictEqual(spaceEntry.use_7d, 1);
assert.strictEqual(spaceEntry.use_30d, 1);
});
test('quick diff keeps newline-containing skill paths as one record', () => {