-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsync-skill.ts
More file actions
28 lines (24 loc) · 1.17 KB
/
Copy pathsync-skill.ts
File metadata and controls
28 lines (24 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/**
* Copies the canonical agent skill from the repo root (`skills/`) into this
* package so it ships inside the published npm tarball. The skill then travels
* with the installed bumpy version, letting agents discover version-pinned
* guidance straight from `node_modules` (no separate install / registry).
*
* The canonical copy lives at the repo root so a single source of truth feeds
* both the npm bundle and any future discovery endpoints. This package copy is
* a generated artifact (gitignored) and is regenerated on every `prepack` /
* publish (run `bun run sync-skill` to refresh it manually). It is also what
* the Claude Code plugin manifest (`.claude-plugin/plugin.json`) ships to
* agents.
*/
import { existsSync, rmSync, cpSync } from 'node:fs';
import { resolve } from 'node:path';
const PKG_DIR = resolve(import.meta.dir, '..');
const SRC = resolve(PKG_DIR, '../../skills');
const DEST = resolve(PKG_DIR, 'skills');
if (!existsSync(SRC)) {
throw new Error(`[sync-skill] canonical skills dir not found at ${SRC}`);
}
rmSync(DEST, { recursive: true, force: true });
cpSync(SRC, DEST, { recursive: true });
console.log(`[sync-skill] copied ${SRC} -> ${DEST}`);