файл пакета→ .shtukbase/packages/blueprint-skilled-agent/actions/build.ts
actions/build.ts
28 строк, 1.3 КБ.
Файл как есть в пакете: код и комментарии в нём не переводятся.
- // Builds what agents get from the skills: /agents/prompts/<agent>.md for every agent page with `skills:`, and the
- // mirror .claude/skills/<id>/SKILL.md of the active skills. Removes a mirrored skill that is no longer active.
- // Run from the project root: bun .shtukbase/packages/blueprint-skilled-agent/actions/build.ts [--dry-run]
- import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
- import { dirname, join } from 'node:path';
- import { plan } from '../lib/skills.ts';
- const root = process.cwd();
- const dry = process.argv.includes('--dry-run');
- const p = plan(root);
- let n = 0;
- for (const [rel, text] of p.files) {
- const f = join(root, rel);
- if (existsSync(f) && readFileSync(f, 'utf8') === text) continue;
- n++;
- console.log(`${dry ? 'would write' : 'wrote'} ${rel}`);
- if (!dry) {
- mkdirSync(dirname(f), { recursive: true });
- writeFileSync(f, text);
- }
- }
- for (const id of p.mirrors) {
- console.log(`${dry ? 'would remove' : 'removed'} .claude/skills/${id} (the skill is gone or switched off)`);
- if (!dry) rmSync(join(root, '.claude', 'skills', id), { recursive: true, force: true });
- }
- console.log(n || p.mirrors.length ? `skills: files built — ${n}` : 'skills: everything is already built');
- for (const x of p.problems) console.log(` ${x.at}: ${x.what} → ${x.fix}`);
- process.exit(p.problems.length ? 1 : 0);