You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"build": "npm run validate:prompts && npm run build:prompts && tsup"
349
349
}
350
350
}
351
351
```
352
352
353
-
Use `--format json` for server-side Node usage where prompts are loaded from disk. Use `--format esm` when prompts need to be imported into a bundle.
353
+
`promptopskit compile`defaults to JSON output in `./.generated-prompts/json`, which matches runtime `compiledDir` loading. Use `promptopskit compile --format esm` when prompts need to be imported into a bundle; those artifacts default to `./.generated-prompts/esm`.
354
354
355
355
### Build strategy by environment
356
356
@@ -362,7 +362,7 @@ Use `--format json` for server-side Node usage where prompts are loaded from dis
362
362
363
363
- Add `validate:prompts` before `build:prompts` so schema or variable mistakes fail fast
364
364
- Treat compiled artifacts as build outputs, not the source of truth
365
-
- Keep prompt source in `./prompts` and compiled output in a generated directory such as `./dist/prompts` or `./src/generated/prompts`
365
+
- Keep prompt source in `./prompts`; use `./.generated-prompts/json` as the default server output and `./.generated-prompts/esm` for imported client artifacts unless a project-specific build layout needs something else
366
366
- If using `createPromptOpsKit` in `auto` mode, point both `sourceDir` and `compiledDir` at those directories so local development can fall back to source when artifacts are stale or missing
367
367
368
368
### Typical server-side setup
@@ -372,7 +372,7 @@ import { createPromptOpsKit } from 'promptopskit';
372
372
373
373
export const prompts = createPromptOpsKit({
374
374
sourceDir: './prompts',
375
-
compiledDir: './dist/prompts',
375
+
compiledDir: './.generated-prompts/json',
376
376
mode: 'auto',
377
377
});
378
378
```
@@ -432,7 +432,7 @@ Hello {{ name }}
432
432
|---------|-------------|
433
433
| `promptopskit init [dir]` | Scaffold a prompts directory with starter files (including `defaults.md`) |
434
434
| `promptopskit validate <dir>` | Validate all prompt files in a directory |
435
-
| `promptopskit compile <src> <out>` | Compile `.md` prompts to JSON or ESM artifacts |
435
+
| `promptopskit compile [src] [out]` | Compile `.md` prompts to JSON or ESM artifacts |
436
436
| `promptopskit render <file>` | Render a prompt preview |
|`--format`|`json`| Output format: `json` or `esm`|
76
78
|`--dry-run`| — | Show what would be compiled without writing |
77
79
|`--no-clean`| — | Don't clear the output directory before compiling |
78
80
79
81
Includes are resolved during compilation so compiled artifacts are self-sufficient. The output directory is cleared by default before compiling (unless `--no-clean` is set).
80
82
83
+
If you omit `<out>`, the CLI chooses `./.generated-prompts/json` for `json` and `./.generated-prompts/esm` for `esm`.
84
+
81
85
`defaults.md` files are treated as configuration inputs and are not compiled as standalone prompts.
@@ -86,7 +86,7 @@ The top-level `promptopskit` runtime is Node-oriented. It supports prompt loadin
86
86
87
87
For browser or client-side code:
88
88
89
-
- Precompile prompts to ESM with `promptopskit compile ./prompts ./dist/prompts --format esm` and import the generated artifact, or inline a small `ResolvedPromptAsset`.
89
+
- Precompile prompts to ESM with `promptopskit compile --format esm` and import the generated artifact from `./.generated-prompts/esm`, or inline a small `ResolvedPromptAsset`.
90
90
- Pass `environment` and `tier` directly to `adapter.validate()` and `adapter.render()` when you need overrides on the client side.
91
91
- Avoid `renderPrompt()` in browser-only code because resolving prompt files from disk is Node-oriented.
92
92
- Keep provider credentials on the server. In production, use the rendered request body with a server endpoint, server action, or edge function that owns the API key.
0 commit comments