Automate README Skill Count Sync from /skills (#532)

* feat(skill): Added a skill for agents understand how then can work with mise-en-place

* Update related skills in SKILL.md

* fix(skill): Make mise configurator deterministic

* chore(package): add a npm run command, to sync skills of automatic maner on README.md

* feat(tool): add a new tool script to count and replace number of script on README.md

* refactor(method): adjusted method to grant a return

---------

Co-authored-by: sickn33 <sickn33@users.noreply.github.com>
This commit is contained in:
Emanoel Carvalho
2026-04-20 14:41:39 -03:00
committed by GitHub
parent 783f383412
commit f61417a2e0
2 changed files with 110 additions and 1 deletions

View File

@@ -48,6 +48,7 @@
"test:network": "node tools/scripts/tests/run-test-suite.js --network",
"sync:microsoft": "node tools/scripts/run-python.js tools/scripts/sync_microsoft_skills.py",
"sync:all-official": "npm run sync:microsoft && npm run chain",
"sync-readme": "node tools/scripts/sync-readme-stats.js",
"update:skills": "node tools/scripts/run-python.js tools/scripts/generate_index.py && node tools/scripts/copy-file.js skills_index.json apps/web-app/public/skills.json && node tools/scripts/copy-file.js skills_index.json apps/web-app/public/skills.json.backup",
"app:setup": "node tools/scripts/setup_web.js",
"app:install": "cd apps/web-app && npm ci",
@@ -79,4 +80,4 @@
"agentic-skills",
"ai-coding"
]
}
}

View File

@@ -0,0 +1,108 @@
const fs = require("fs");
const path = require("path");
const ROOT = path.resolve(__dirname, "../../");
const README_PATH = path.join(ROOT, "README.md");
const SKILLS_DIR = path.join(ROOT, "skills");
function countSkills(dir) {
let total = 0;
const entries = fs.readdirSync(dir, { withFileTypes: true });
for (const entry of entries) {
const fullPath = path.join(dir, entry.name);
if (entry.isDirectory()) {
const skillFile = path.join(fullPath, "SKILL.md");
if (fs.existsSync(skillFile)) {
total++;
}
total += countSkills(fullPath);
}
}
return total;
}
function formatNumber(n) {
return n.toLocaleString("en-US");
}
function replaceOrWarn(content, regex, replacement, label) {
const safeRegex = new RegExp(regex.source, regex.flags.replace("g", ""));
const hasMatch = safeRegex.test(content);
if (!hasMatch) {
console.warn(`⚠️ Pattern not found: ${label}`);
return content;
}
return content.replace(regex, replacement);
}
if (!fs.existsSync(README_PATH)) {
console.error("README.md not found");
process.exit(1);
}
if (!fs.existsSync(SKILLS_DIR)) {
console.error("/skills directory not found");
process.exit(1);
}
const count = countSkills(SKILLS_DIR);
const formatted = formatNumber(count);
let readme = fs.readFileSync(README_PATH, "utf8");
readme = replaceOrWarn(
readme,
/skills=\d+/,
`skills=${count}`,
"registry-sync comment"
);
readme = replaceOrWarn(
readme,
/(# 🌌 Antigravity Awesome Skills:\s*)[\d,]+\+/,
`$1${formatted}+`,
"main title"
);
readme = replaceOrWarn(
readme,
/(Installable GitHub library of )[\d,]+\+/,
`$1${formatted}+`,
"subtitle"
);
readme = readme.replace(
/Browse [\d,]+\+ Skills/g,
`Browse ${formatted}+ Skills`
);
readme = readme.replace(
/browse all [\d,]+\+ skills/gi,
`browse all ${formatted}+ skills`
);
readme = readme.replace(
/([\s:])[\d,]+\+ skills across/g,
`$1${formatted}+ skills across`
);
readme = readme.replace(
/\(#browse-\d+-skills\)/g,
`(#browse-${count}-skills)`
);
readme = readme.replace(
/## Browse [\d,]+\+ Skills/g,
`## Browse ${formatted}+ Skills`
);
fs.writeFileSync(README_PATH, readme);
console.log(`✅ README synced successfully`);
console.log(`📦 Skills detected: ${count}`);
console.log(`📝 README updated: README.md`);