Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"node": ">=20.0.0"
},
"scripts": {
"build": "tsc --project tsconfig.json",
"build": "tsc --project tsconfig.json && node scripts/copy-prompts.js",
"build:watch": "tsc --project tsconfig.json --watch",
"dev": "tsx watch src/index.ts",
"start": "node dist/index.js",
Expand Down
38 changes: 38 additions & 0 deletions scripts/copy-prompts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env node
/**
* copy-prompts.js
*
* Copies Markdown prompt files from src/prompts/ → dist/prompts/.
* Run as part of the build pipeline after `tsc`.
*
* Why this exists:
* TypeScript's compiler only emits .js/.d.ts files — it ignores .md assets.
* PromptLoader resolves prompts from dist/prompts/ at runtime, so we must
* mirror the src/prompts/ tree into dist/ after every build.
*
* Usage:
* node scripts/copy-prompts.js
*/

import { cpSync, mkdirSync } from 'fs';
import { join, dirname } from 'path';
import { fileURLToPath } from 'url';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const root = join(__dirname, '..');
const src = join(root, 'src', 'prompts');
const dest = join(root, 'dist', 'prompts');

mkdirSync(dest, { recursive: true });

cpSync(src, dest, {
recursive: true,
filter: (source) => {
// Only copy .md files and directories
return source.endsWith('.md') || !source.includes('.');
},
});

console.log(`✅ Prompts copied: ${src} → ${dest}`);