ShtukbaseStandard
archivo del paquete→ .shtukbase/packages/blueprint-skilled-agent/checks/k01_skills.ts

checks/k01_skills.ts

19 líneas, 1.2 KB.

El archivo tal como está en el paquete: el código y sus comentarios no se traducen.

  1. // SKL-R01. An agent with skills gets every skill it names, as they are now: each skill is a valid Agent Skills page,
  2. // and the built prompt of the agent and the .claude/skills mirror match the skills. Read-only.
  3. // Run from the project root: bun .shtukbase/packages/blueprint-skilled-agent/checks/k01_skills.ts
  4. import { existsSync, readFileSync } from 'node:fs';
  5. import { join } from 'node:path';
  6. import { plan } from '../lib/skills.ts';
  7. const root = process.cwd();
  8. const p = plan(root);
  9. const out: string[] = p.problems.map((x) => `${x.at}: ${x.what} → ${x.fix}`);
  10. for (const [rel, text] of p.files) {
  11. const f = join(root, rel);
  12. if (!existsSync(f)) out.push(`${rel}: no such file → shtuk run blueprint-skilled-agent build`);
  13. else if (readFileSync(f, 'utf8') !== text) out.push(`${rel}: not built from the current skills and the agent page → shtuk run blueprint-skilled-agent build`);
  14. }
  15. for (const id of p.mirrors) out.push(`.claude/skills/${id}: the skill is gone or switched off → shtuk run blueprint-skilled-agent build`);
  16. for (const l of out) console.log(l);
  17. console.log(out.length ? `SKL-R01: violations — ${out.length}` : `SKL-R01: the skills are built (${p.files.size} files)`);
  18. process.exit(out.length ? 1 : 0);