Files
John SmithandClaude Opus 5.5 bb2827524b feat(readme): fail-closed generation with topic/kind groups, V1/V2 badges, counts and recently added
A single unparseable entry used to blank a whole README category and still exit 0. generate-readme and export-json now validate the whole catalog and refuse to write on any problem, check that every entry renders exactly once, and escape contributor text. Plugins are grouped by primary topic and other categories by kind; plugins show V2 / V1 only / unverified; section headers show counts; a Recently Added table comes from git history. registry.json gains kind, topics, also, compat, repoPath and npmPackage (existing fields unchanged).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-17 13:00:22 -04:00

34 lines
1.0 KiB
JavaScript

/**
* Git history helpers. Requires a full clone (actions/checkout with fetch-depth: 0);
* in a shallow clone every file looks like it was added in the oldest fetched commit.
*/
const { execFileSync } = require('child_process');
const path = require('path');
const ROOT = path.join(__dirname, '../..');
/**
* Date each data file was first added, newest commits first.
* @returns {Map<string, string>} "data/plugins/x.yaml" -> ISO date; empty when git is unavailable
*/
function addedDates() {
const dates = new Map();
let out = '';
try {
out = execFileSync('git', ['log', '--diff-filter=A', '--name-only', '--format=@%cI', '--', 'data/'], {
cwd: ROOT, encoding: 'utf8', maxBuffer: 64 * 1024 * 1024, stdio: ['ignore', 'pipe', 'ignore']
});
} catch {
return dates;
}
let current = null;
for (const line of out.split('\n')) {
if (line.startsWith('@')) current = line.slice(1);
else if (line.endsWith('.yaml') && current && !dates.has(line)) dates.set(line, current);
}
return dates;
}
module.exports = { addedDates };