55 * This solves the issue where readFileSync with __dirname fails when the
66 * package is bundled by Bun (see issue #222, PR #272, #327).
77 *
8- * The .md files are kept for convenient editing, and this script generates
9- * .ts files with exported string constants that bundle correctly .
8+ * Only system .md remains markdown-backed because it includes optional manual
9+ * sections that are conditionally rendered. Other prompts are plain .ts files .
1010 */
1111
1212import { readFileSync , writeFileSync , readdirSync , mkdirSync , unlinkSync } from "node:fs"
@@ -27,11 +27,11 @@ for (const file of oldGeneratedFiles) {
2727 console . log ( `Cleaned up old: ${ file } ` )
2828}
2929
30- // Find all .md files in the prompts directory
31- const mdFiles = readdirSync ( PROMPTS_DIR ) . filter ( ( f ) => f . endsWith ( ".md" ) )
30+ const SYSTEM_PROMPT_FILE = "system .md"
31+ const mdFiles = [ SYSTEM_PROMPT_FILE ]
3232
33- // Remove stale generated files in _codegen that no longer have a source markdown file
34- const expectedGenerated = new Set ( mdFiles . map ( ( f ) => `${ basename ( f , ".md" ) } .generated.ts` ) )
33+ // Remove stale generated files in _codegen that are no longer generated
34+ const expectedGenerated = new Set ( [ `${ basename ( SYSTEM_PROMPT_FILE , ".md" ) } .generated.ts` ] )
3535const existingGenerated = readdirSync ( CODEGEN_DIR ) . filter ( ( f ) => f . endsWith ( ".generated.ts" ) )
3636for ( const file of existingGenerated ) {
3737 if ( ! expectedGenerated . has ( file ) ) {
0 commit comments