78 lines
2.0 KiB
JavaScript
78 lines
2.0 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* CI: Tier-1 /bin count in key markdown must match COREUTILS_COMMANDS.length
|
|
* (prevents ~113 / ~115 / 146-style drift).
|
|
*/
|
|
import fs from 'node:fs'
|
|
import path from 'node:path'
|
|
import process from 'node:process'
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
|
|
|
|
function read(rel) {
|
|
return fs.readFileSync(path.join(root, rel), 'utf8')
|
|
}
|
|
|
|
function must(cond, msg) {
|
|
if (!cond) {
|
|
console.error('verify-doc-tier1-count:', msg)
|
|
process.exit(1)
|
|
}
|
|
}
|
|
|
|
async function main() {
|
|
const { COREUTILS_COMMANDS } = await import(
|
|
path.join(root, 'packages/bare-os-coreutils/lib/commands.mjs')
|
|
)
|
|
const n = COREUTILS_COMMANDS.length
|
|
const needle = `**${n}**`
|
|
|
|
const checks = [
|
|
{
|
|
rel: 'README.md',
|
|
test: (t) => t.includes('Tier-1 `/bin`') && t.includes(needle)
|
|
},
|
|
{
|
|
rel: 'kernel/README.md',
|
|
test: (t) => t.includes('Tier-1 utilities') && t.includes(needle)
|
|
},
|
|
{
|
|
rel: 'docs/reference/environment-and-posix-appendix.md',
|
|
test: (t) => t.includes('Tier-1 JS') && t.includes(needle)
|
|
},
|
|
{
|
|
rel: 'docs/audit/PLACEHOLDER_BASELINE.md',
|
|
test: (t) =>
|
|
t.includes('verify-man-coverage.mjs') &&
|
|
t.includes(needle) &&
|
|
t.includes('Tier-1')
|
|
},
|
|
{
|
|
rel: 'packages/bare-os-coreutils/README.md',
|
|
test: (t) =>
|
|
t.includes('COREUTILS_COMMANDS') && t.includes(needle) && t.includes('Tier-1')
|
|
}
|
|
]
|
|
|
|
const obsolete = ['~113', '~115', '146 Tier-1', '**146**']
|
|
|
|
for (const { rel, test } of checks) {
|
|
const text = read(rel)
|
|
must(test(text), `${rel}: must document Tier-1 count ${n} (${needle}) consistently`)
|
|
for (const o of obsolete) {
|
|
must(
|
|
!text.includes(o),
|
|
`${rel}: remove obsolete tier-1 count fragment ${JSON.stringify(o)}`
|
|
)
|
|
}
|
|
}
|
|
|
|
console.log('verify-doc-tier1-count: OK', n, 'commands')
|
|
}
|
|
|
|
main().catch((e) => {
|
|
console.error(e)
|
|
process.exit(1)
|
|
})
|