promptopskit 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/LICENSE +211 -211
  2. package/README.md +335 -309
  3. package/dist/{chunk-FSOJVXC4.js → chunk-5BI5FP5L.js} +2 -2
  4. package/dist/chunk-5BI5FP5L.js.map +1 -0
  5. package/dist/{chunk-HEFOFQ2K.js → chunk-6KGBPHSY.js} +1 -1
  6. package/dist/chunk-6KGBPHSY.js.map +1 -0
  7. package/dist/{chunk-X64JII57.js → chunk-NIZENC7D.js} +2 -2
  8. package/dist/chunk-NIZENC7D.js.map +1 -0
  9. package/dist/{chunk-YCRWYE6N.js → chunk-PU3UPUND.js} +2 -2
  10. package/dist/chunk-PU3UPUND.js.map +1 -0
  11. package/dist/{chunk-V375NQ6C.js → chunk-UYTUGV7Z.js} +2 -2
  12. package/dist/chunk-UYTUGV7Z.js.map +1 -0
  13. package/dist/{chunk-B5UFGNDV.js → chunk-VYVEVJC3.js} +2 -2
  14. package/dist/chunk-VYVEVJC3.js.map +1 -0
  15. package/dist/cli/index.js +452 -25
  16. package/dist/cli/index.js.map +1 -1
  17. package/dist/index.cjs +963 -0
  18. package/dist/index.cjs.map +1 -0
  19. package/dist/index.d.cts +184 -0
  20. package/dist/index.d.ts +10 -5
  21. package/dist/index.js +32 -7
  22. package/dist/index.js.map +1 -1
  23. package/dist/providers/anthropic.cjs +151 -0
  24. package/dist/providers/anthropic.cjs.map +1 -0
  25. package/dist/providers/anthropic.d.cts +11 -0
  26. package/dist/providers/anthropic.d.ts +2 -2
  27. package/dist/providers/anthropic.js +2 -2
  28. package/dist/providers/gemini.cjs +155 -0
  29. package/dist/providers/gemini.cjs.map +1 -0
  30. package/dist/providers/gemini.d.cts +11 -0
  31. package/dist/providers/gemini.d.ts +2 -2
  32. package/dist/providers/gemini.js +2 -2
  33. package/dist/providers/openai.cjs +146 -0
  34. package/dist/providers/openai.cjs.map +1 -0
  35. package/dist/providers/openai.d.cts +11 -0
  36. package/dist/providers/openai.d.ts +2 -2
  37. package/dist/providers/openai.js +2 -2
  38. package/dist/providers/openrouter.cjs +161 -0
  39. package/dist/providers/openrouter.cjs.map +1 -0
  40. package/dist/providers/openrouter.d.cts +13 -0
  41. package/dist/providers/openrouter.d.ts +2 -2
  42. package/dist/providers/openrouter.js +3 -3
  43. package/dist/{schema-DHRI5Mzl.d.ts → schema-C6smABrt.d.cts} +3 -3
  44. package/dist/schema-C6smABrt.d.ts +695 -0
  45. package/dist/testing.cjs +228 -0
  46. package/dist/testing.cjs.map +1 -0
  47. package/dist/testing.d.cts +17 -0
  48. package/dist/testing.d.ts +1 -1
  49. package/dist/testing.js +1 -1
  50. package/dist/testing.js.map +1 -1
  51. package/dist/{types-D9hquVja.d.ts → types-D7lW5IYT.d.ts} +1 -1
  52. package/dist/types-S_c-ZEfK.d.cts +40 -0
  53. package/package.json +116 -79
  54. package/dist/chunk-B5UFGNDV.js.map +0 -1
  55. package/dist/chunk-FSOJVXC4.js.map +0 -1
  56. package/dist/chunk-HEFOFQ2K.js.map +0 -1
  57. package/dist/chunk-V375NQ6C.js.map +0 -1
  58. package/dist/chunk-X64JII57.js.map +0 -1
  59. package/dist/chunk-YCRWYE6N.js.map +0 -1
package/README.md CHANGED
@@ -1,309 +1,335 @@
1
- # PromptOpsKit
2
-
3
- [![npm version](https://img.shields.io/npm/v/promptopskit.svg)](https://www.npmjs.com/package/promptopskit)
4
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
5
- [![Node.js](https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg)](https://nodejs.org)
6
-
7
- Open-source developer toolkit for managing prompts, system instructions, tools, and model settings **as code**. One `npm install` gives you both a runtime library and a CLI.
8
-
9
- PromptOpsKit treats every prompt as a Markdown file — YAML front matter defines model settings, sampling parameters, reasoning levels, tool bindings, and override rules, while H1 headings separate system instructions from prompt templates. Variables use `{{ mustache }}` syntax, shared instructions are composed via `includes`, and environment/tier overrides let the same prompt target dev vs. prod or free vs. pro without duplication.
10
-
11
- Provider adapters for OpenAI, Anthropic, Gemini, and OpenRouter produce a ready-to-send **request body only** — no HTTP client, no auth, no headers. Your application owns transport, so PromptOpsKit slots into any stack without opinions about how you call the API.
12
-
13
- ### Why PromptOpsKit?
14
-
15
- - **Version-control your prompts** — plain Markdown files that diff, review, and merge like any other code.
16
- - **One prompt, many providers** — write once, render for OpenAI, Anthropic, Gemini, or OpenRouter with correct body shapes.
17
- - **Override without forking** — environment and tier overrides swap models and parameters without duplicating prompt files.
18
- - **Compose and share** — `includes` lets you define shared tone, policy, or safety instructions once and reuse them everywhere.
19
- - **Validate early** — Zod schema validation, Levenshtein-based "did you mean?" suggestions for typos, and variable usage checks catch mistakes before runtime.
20
- - **Compile for production** — pre-compile `.md` to JSON or ESM so deployments skip parsing entirely.
21
- - **No lock-in** — body-only output means you choose the HTTP client, auth strategy, and infrastructure.
22
-
23
- ## Install
24
-
25
- ```bash
26
- npm install promptopskit
27
- ```
28
-
29
- ## Quick Start
30
-
31
- ### 1. Scaffold starter prompts
32
-
33
- ```bash
34
- npx promptopskit init ./prompts
35
- ```
36
-
37
- This creates:
38
-
39
- ```
40
- prompts/
41
- ├── hello.md # Sample prompt with variables
42
- ├── hello.test.yaml # Test sidecar with sample inputs
43
- └── shared/
44
- └── tone.md # Shared system instructions (included via composition)
45
- ```
46
-
47
- ### 2. Write a prompt
48
-
49
- ```markdown
50
- ---
51
- id: support.reply
52
- schema_version: 1
53
- provider: openai
54
- model: gpt-5.4
55
- reasoning:
56
- effort: medium
57
- sampling:
58
- temperature: 0.7
59
- context:
60
- inputs:
61
- - user_message
62
- includes:
63
- - ./shared/tone.md
64
- ---
65
-
66
- # System instructions
67
-
68
- You are a helpful support assistant.
69
-
70
- # Prompt template
71
-
72
- {{ user_message }}
73
- ```
74
-
75
- ### 3. Render for a provider
76
-
77
- ```typescript
78
- import { createPromptOpsKit } from 'promptopskit';
79
-
80
- const kit = createPromptOpsKit({ sourceDir: './prompts' });
81
-
82
- const result = await kit.renderPrompt({
83
- path: 'support/reply',
84
- provider: 'openai',
85
- variables: { user_message: 'How do I reset my password?' },
86
- });
87
-
88
- // result.request.body is ready for fetch()
89
- const response = await fetch('https://api.openai.com/v1/chat/completions', {
90
- method: 'POST',
91
- headers: {
92
- 'Content-Type': 'application/json',
93
- 'Authorization': `Bearer ${process.env.OPENAI_API_KEY}`,
94
- },
95
- body: JSON.stringify(result.request.body),
96
- });
97
- ```
98
-
99
- ## Features
100
-
101
- - **Prompts as Markdown** — YAML front matter for settings, H1 headings for sections (`# System instructions`, `# Prompt template`, `# Notes`)
102
- - **Variable interpolation** — `{{ variable }}` syntax with strict and permissive modes
103
- - **Composition** — `includes` to share system instructions across prompts, with circular detection
104
- - **Overrides** — Environment and tier-based overrides (base → env → tier → runtime)
105
- - **4 provider adapters** — OpenAI, Anthropic, Gemini, OpenRouter — body-only output
106
- - **Validation** — Zod schema validation, Levenshtein-based "did you mean?" for typos, variable usage checks
107
- - **Caching** — LRU cache with mtime-based invalidation
108
- - **CLI** — init, validate, compile, render, inspect
109
- - **Compiled artifacts** — Pre-compile `.md` → JSON or ESM for production
110
-
111
- ## Provider Adapters
112
-
113
- Each adapter produces a `{ body, provider, model }` object shaped for the target API. You handle the HTTP call.
114
-
115
- ```typescript
116
- // OpenAI
117
- import { createPromptOpsKit } from 'promptopskit';
118
- const kit = createPromptOpsKit({ sourceDir: './prompts' });
119
- const { request } = await kit.renderPrompt({ path: 'hello', provider: 'openai', variables: { name: 'World' } });
120
- // request.body → { model, messages, temperature, reasoning_effort, ... }
121
-
122
- // Anthropic — system is a top-level field, max_tokens defaults to 4096
123
- const { request } = await kit.renderPrompt({ path: 'hello', provider: 'anthropic', variables: { name: 'World' } });
124
- // request.body → { model, messages, system, max_tokens, ... }
125
-
126
- // Gemini — contents/systemInstruction/generationConfig structure
127
- const { request } = await kit.renderPrompt({ path: 'hello', provider: 'gemini', variables: { name: 'World' } });
128
- // request.body → { contents, systemInstruction, generationConfig, ... }
129
-
130
- // OpenRouter — same shape as OpenAI, different provider label
131
- const { request } = await kit.renderPrompt({ path: 'hello', provider: 'openrouter', variables: { name: 'World' } });
132
- ```
133
-
134
- Provider adapters are also available as direct imports:
135
-
136
- ```typescript
137
- import { openaiAdapter } from 'promptopskit/openai';
138
- import { anthropicAdapter } from 'promptopskit/anthropic';
139
- import { geminiAdapter } from 'promptopskit/gemini';
140
- import { openrouterAdapter } from 'promptopskit/openrouter';
141
- ```
142
-
143
- ## Overrides
144
-
145
- Define environment and tier overrides in front matter. Precedence: **base → environment → tier → runtime**. Scalars and arrays are replaced, not merged.
146
-
147
- ```markdown
148
- ---
149
- id: support.reply
150
- schema_version: 1
151
- provider: openai
152
- model: gpt-5.4
153
- sampling:
154
- temperature: 0.7
155
- environments:
156
- dev:
157
- model: gpt-5.4-mini
158
- sampling:
159
- temperature: 0.2
160
- prod:
161
- model: gpt-5.4
162
- tiers:
163
- free:
164
- model: gpt-5.4-mini
165
- pro:
166
- model: gpt-5.4
167
- ---
168
- ```
169
-
170
- ```typescript
171
- const result = await kit.renderPrompt({
172
- path: 'support/reply',
173
- provider: 'openai',
174
- environment: 'dev',
175
- tier: 'pro',
176
- variables: { user_message: '...' },
177
- });
178
- ```
179
-
180
- ## Composition
181
-
182
- Share system instructions across prompts using `includes`. Included system instructions are prepended before local ones.
183
-
184
- ```markdown
185
- ---
186
- id: support.reply
187
- schema_version: 1
188
- includes:
189
- - ./shared/tone.md
190
- ---
191
-
192
- # System instructions
193
-
194
- Handle support requests carefully.
195
- ```
196
-
197
- ## CLI
198
-
199
- ```bash
200
- # Scaffold starter prompts
201
- promptopskit init [dir]
202
-
203
- # Validate all .md files in a directory
204
- promptopskit validate <dir> [--strict]
205
-
206
- # Compile .md → JSON/ESM artifacts
207
- promptopskit compile <src> <out> [--dry-run] [--format json|esm] [--no-clean]
208
-
209
- # Render a prompt preview (auto-loads .test.yaml sidecar)
210
- promptopskit render <file> [--env <name>] [--tier <name>] [--vars <file>] [--json]
211
-
212
- # Print normalized asset as JSON
213
- promptopskit inspect <file>
214
- ```
215
-
216
- ## Inline Source
217
-
218
- Render prompts from strings without files:
219
-
220
- ```typescript
221
- const result = await kit.renderPrompt({
222
- source: `---
223
- id: inline
224
- schema_version: 1
225
- provider: openai
226
- model: gpt-5.4
227
- ---
228
-
229
- # Prompt template
230
-
231
- Hello {{ name }}!`,
232
- provider: 'openai',
233
- variables: { name: 'World' },
234
- });
235
- ```
236
-
237
- ## Testing Helpers
238
-
239
- ```typescript
240
- import { createMockAsset, createMockResolvedAsset, parseTestPrompt } from 'promptopskit/testing';
241
-
242
- const asset = createMockAsset({ model: 'gpt-5.4' });
243
- const resolved = createMockResolvedAsset();
244
- const parsed = parseTestPrompt('---\nid: test\nschema_version: 1\n---\n\nHello');
245
- ```
246
-
247
- ## API Reference
248
-
249
- ### `createPromptOpsKit(config)`
250
-
251
- Creates a `PromptOpsKit` instance.
252
-
253
- | Option | Type | Default | Description |
254
- |--------|------|---------|-------------|
255
- | `sourceDir` | `string` | — | Path to prompt `.md` files (required) |
256
- | `compiledDir` | `string` | — | Path to compiled artifacts |
257
- | `mode` | `'auto' \| 'compiled-only' \| 'source-only'` | `'auto'` | Resolution strategy |
258
- | `cache` | `boolean` | `true` | Enable LRU cache with mtime invalidation |
259
-
260
- ### `kit.renderPrompt(options)`
261
-
262
- Renders a prompt for a specific provider. Returns `{ resolved, request, warnings }`.
263
-
264
- | Option | Type | Description |
265
- |--------|------|-------------|
266
- | `path` | `string` | Prompt path (no extension), e.g. `'support/reply'` |
267
- | `source` | `string` | Inline prompt source (alternative to path) |
268
- | `provider` | `string` | `'openai'`, `'anthropic'`, `'gemini'`, `'openrouter'` |
269
- | `variables` | `Record<string, string>` | Template variables |
270
- | `environment` | `string` | Environment override name |
271
- | `tier` | `string` | Tier override name |
272
- | `history` | `Array<{ role, content }>` | Conversation history |
273
- | `strict` | `boolean` | Fail on missing variables |
274
-
275
- ### `kit.loadPrompt(path)` / `kit.resolvePrompt(path, options)` / `kit.validatePrompt(path)`
276
-
277
- Lower-level methods for loading, resolving (includes + overrides), and validating individual prompts.
278
-
279
- ### Standalone Functions
280
-
281
- ```typescript
282
- import { parsePrompt, interpolate, extractVariables, resolveIncludes, applyOverrides, validateAsset, getAdapter } from 'promptopskit';
283
- ```
284
-
285
- ## Schema
286
-
287
- Prompt files use YAML front matter with these fields:
288
-
289
- | Field | Type | Description |
290
- |-------|------|-------------|
291
- | `id` | `string` | Unique prompt identifier (required) |
292
- | `schema_version` | `number` | Schema version, currently `1` |
293
- | `provider` | `string` | `openai`, `anthropic`, `google`, `openrouter`, `any` |
294
- | `model` | `string` | Model name |
295
- | `fallback_models` | `string[]` | Fallback model list |
296
- | `reasoning` | `object` | `{ effort, budget_tokens }` |
297
- | `sampling` | `object` | `{ temperature, top_p, frequency_penalty, presence_penalty, stop, max_output_tokens }` |
298
- | `response` | `object` | `{ format, stream }` |
299
- | `tools` | `array` | Tool references (string names or inline definitions) |
300
- | `mcp` | `object` | MCP server references |
301
- | `context` | `object` | `{ inputs, history }` — declare expected variables |
302
- | `includes` | `string[]` | Paths to included prompt files |
303
- | `environments` | `object` | Named environment overrides |
304
- | `tiers` | `object` | Named tier overrides |
305
- | `metadata` | `object` | `{ owner, tags, review_required, stable }` |
306
-
307
- ## License
308
-
309
- [MIT](LICENSE)
1
+ # PromptOpsKit
2
+
3
+ [![npm version](https://img.shields.io/npm/v/promptopskit.svg)](https://www.npmjs.com/package/promptopskit)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
5
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg)](https://nodejs.org)
6
+
7
+ Open-source developer toolkit for managing prompts, system instructions, tools, and model settings **as code**. One `npm install` gives you both a runtime library and a CLI.
8
+
9
+ PromptOpsKit treats every prompt as a Markdown file — YAML front matter defines model settings, sampling parameters, reasoning levels, tool bindings, and override rules, while H1 headings separate system instructions from prompt templates. Variables use `{{ mustache }}` syntax, shared instructions are composed via `includes`, and environment/tier overrides let the same prompt target dev vs. prod or free vs. pro without duplication.
10
+
11
+ Provider adapters for OpenAI, Anthropic, Gemini, and OpenRouter produce a ready-to-send **request body only** — no HTTP client, no auth, no headers. Your application owns transport, so PromptOpsKit slots into any stack without opinions about how you call the API.
12
+
13
+ ### Why PromptOpsKit?
14
+
15
+ - **Version-control your prompts** — plain Markdown files that diff, review, and merge like any other code.
16
+ - **One prompt, many providers** — write once, render for OpenAI, Anthropic, Gemini, or OpenRouter with correct body shapes.
17
+ - **Override without forking** — environment and tier overrides swap models and parameters without duplicating prompt files.
18
+ - **Compose and share** — `includes` lets you define shared tone, policy, or safety instructions once and reuse them everywhere.
19
+ - **Validate early** — Zod schema validation, Levenshtein-based "did you mean?" suggestions for typos, and variable usage checks catch mistakes before runtime.
20
+ - **Compile for production** — pre-compile `.md` to JSON or ESM so deployments skip parsing entirely.
21
+ - **No lock-in** — body-only output means you choose the HTTP client, auth strategy, and infrastructure.
22
+
23
+ ## Install
24
+
25
+ ```bash
26
+ npm install promptopskit
27
+ ```
28
+
29
+ ## Quick Start
30
+
31
+ ### 1. Scaffold starter prompts
32
+
33
+ ```bash
34
+ npx promptopskit init ./prompts
35
+ ```
36
+
37
+ This creates:
38
+
39
+ ```
40
+ prompts/
41
+ ├── hello.md # Sample prompt with variables
42
+ ├── hello.test.yaml # Test sidecar with sample inputs
43
+ └── shared/
44
+ └── tone.md # Shared system instructions (included via composition)
45
+ ```
46
+
47
+ ### 2. Write a prompt
48
+
49
+ ```markdown
50
+ ---
51
+ id: support.reply
52
+ schema_version: 1
53
+ provider: openai
54
+ model: gpt-5.4
55
+ reasoning:
56
+ effort: medium
57
+ sampling:
58
+ temperature: 0.7
59
+ context:
60
+ inputs:
61
+ - user_message
62
+ includes:
63
+ - ./shared/tone.md
64
+ ---
65
+
66
+ # System instructions
67
+
68
+ You are a helpful support assistant.
69
+
70
+ # Prompt template
71
+
72
+ {{ user_message }}
73
+ ```
74
+
75
+ ### 3. Render for a provider
76
+
77
+ ```typescript
78
+ import { createPromptOpsKit } from 'promptopskit';
79
+
80
+ const kit = createPromptOpsKit({ sourceDir: './prompts' });
81
+
82
+ const result = await kit.renderPrompt({
83
+ path: 'support/reply',
84
+ provider: 'openai',
85
+ variables: { user_message: 'How do I reset my password?' },
86
+ });
87
+
88
+ // result.request.body is ready for fetch()
89
+ const response = await fetch('https://api.openai.com/v1/chat/completions', {
90
+ method: 'POST',
91
+ headers: {
92
+ 'Content-Type': 'application/json',
93
+ 'Authorization': `Bearer ${process.env.OPENAI_API_KEY}`,
94
+ },
95
+ body: JSON.stringify(result.request.body),
96
+ });
97
+ ```
98
+
99
+ ## Features
100
+
101
+ - **Prompts as Markdown** — YAML front matter for settings, H1 headings for sections (`# System instructions`, `# Prompt template`, `# Notes`)
102
+ - **Variable interpolation** — `{{ variable }}` syntax with strict and permissive modes
103
+ - **Composition** — `includes` to share system instructions across prompts, with circular detection
104
+ - **Overrides** — Environment and tier-based overrides (base → env → tier → runtime)
105
+ - **4 provider adapters** — OpenAI, Anthropic, Gemini, OpenRouter — body-only output
106
+ - **Validation** — Zod schema validation, Levenshtein-based "did you mean?" for typos, variable usage checks
107
+ - **Caching** — LRU cache with mtime-based invalidation
108
+ - **CLI** — init, validate, compile, render, inspect, skill
109
+ - **Compiled artifacts** — Pre-compile `.md` → JSON or ESM for production
110
+
111
+ ## Provider Adapters
112
+
113
+ Each adapter produces a `{ body, provider, model }` object shaped for the target API. You handle the HTTP call.
114
+
115
+ ```typescript
116
+ // OpenAI
117
+ import { createPromptOpsKit } from 'promptopskit';
118
+ const kit = createPromptOpsKit({ sourceDir: './prompts' });
119
+ const { request } = await kit.renderPrompt({ path: 'hello', provider: 'openai', variables: { name: 'World' } });
120
+ // request.body → { model, messages, temperature, reasoning_effort, ... }
121
+
122
+ // Anthropic — system is a top-level field, max_tokens defaults to 4096
123
+ const { request } = await kit.renderPrompt({ path: 'hello', provider: 'anthropic', variables: { name: 'World' } });
124
+ // request.body → { model, messages, system, max_tokens, ... }
125
+
126
+ // Gemini — contents/systemInstruction/generationConfig structure
127
+ const { request } = await kit.renderPrompt({ path: 'hello', provider: 'gemini', variables: { name: 'World' } });
128
+ // request.body → { contents, systemInstruction, generationConfig, ... }
129
+
130
+ // OpenRouter — same shape as OpenAI, different provider label
131
+ const { request } = await kit.renderPrompt({ path: 'hello', provider: 'openrouter', variables: { name: 'World' } });
132
+ ```
133
+
134
+ Provider adapters are also available as direct imports:
135
+
136
+ ```typescript
137
+ import { openaiAdapter } from 'promptopskit/openai';
138
+ import { anthropicAdapter } from 'promptopskit/anthropic';
139
+ import { geminiAdapter } from 'promptopskit/gemini';
140
+ import { openrouterAdapter } from 'promptopskit/openrouter';
141
+ ```
142
+
143
+ ## Overrides
144
+
145
+ Define environment and tier overrides in front matter. Precedence: **base → environment → tier → runtime**. Scalars and arrays are replaced, not merged.
146
+
147
+ ```markdown
148
+ ---
149
+ id: support.reply
150
+ schema_version: 1
151
+ provider: openai
152
+ model: gpt-5.4
153
+ sampling:
154
+ temperature: 0.7
155
+ environments:
156
+ dev:
157
+ model: gpt-5.4-mini
158
+ sampling:
159
+ temperature: 0.2
160
+ prod:
161
+ model: gpt-5.4
162
+ tiers:
163
+ free:
164
+ model: gpt-5.4-mini
165
+ pro:
166
+ model: gpt-5.4
167
+ ---
168
+ ```
169
+
170
+ ```typescript
171
+ const result = await kit.renderPrompt({
172
+ path: 'support/reply',
173
+ provider: 'openai',
174
+ environment: 'dev',
175
+ tier: 'pro',
176
+ variables: { user_message: '...' },
177
+ });
178
+ ```
179
+
180
+ ## Composition
181
+
182
+ Share system instructions across prompts using `includes`. Included system instructions are prepended before local ones.
183
+
184
+ ```markdown
185
+ ---
186
+ id: support.reply
187
+ schema_version: 1
188
+ includes:
189
+ - ./shared/tone.md
190
+ ---
191
+
192
+ # System instructions
193
+
194
+ Handle support requests carefully.
195
+ ```
196
+
197
+ ## CLI
198
+
199
+ ```bash
200
+ # Scaffold starter prompts
201
+ promptopskit init [dir]
202
+
203
+ # Validate all .md files in a directory
204
+ promptopskit validate <dir> [--strict]
205
+
206
+ # Compile .md → JSON/ESM artifacts
207
+ promptopskit compile <src> <out> [--dry-run] [--format json|esm] [--no-clean]
208
+
209
+ # Render a prompt preview (auto-loads .test.yaml sidecar)
210
+ promptopskit render <file> [--env <name>] [--tier <name>] [--vars <file>] [--json]
211
+
212
+ # Print normalized asset as JSON
213
+ promptopskit inspect <file>
214
+
215
+ # Deploy AI agent instructions into your project
216
+ promptopskit skill [--target copilot|cursor|generic] [--force]
217
+ ```
218
+
219
+ ## AI Agent Instructions
220
+
221
+ The `skill` command deploys a comprehensive instructions file so AI coding assistants (GitHub Copilot, Cursor, etc.) automatically understand how to create and manage prompts with promptopskit.
222
+
223
+ ```bash
224
+ # Deploy for GitHub Copilot (default)
225
+ promptopskit skill
226
+ # .github/instructions/promptopskit.instructions.md
227
+
228
+ # Deploy for Cursor
229
+ promptopskit skill --target cursor
230
+ # → .cursor/rules/promptopskit.mdc
231
+
232
+ # Deploy a generic instructions file
233
+ promptopskit skill --target generic
234
+ # → .ai/promptopskit-skill.md
235
+
236
+ # Overwrite an existing instructions file
237
+ promptopskit skill --force
238
+ ```
239
+
240
+ The deployed file covers the prompt format, front matter schema, variable interpolation, includes, overrides, the TypeScript API, provider adapters, and project conventions — everything an AI agent needs to write correct prompts on the first try.
241
+
242
+ ## Inline Source
243
+
244
+ Render prompts from strings without files:
245
+
246
+ ```typescript
247
+ const result = await kit.renderPrompt({
248
+ source: `---
249
+ id: inline
250
+ schema_version: 1
251
+ provider: openai
252
+ model: gpt-5.4
253
+ ---
254
+
255
+ # Prompt template
256
+
257
+ Hello {{ name }}!`,
258
+ provider: 'openai',
259
+ variables: { name: 'World' },
260
+ });
261
+ ```
262
+
263
+ ## Testing Helpers
264
+
265
+ ```typescript
266
+ import { createMockAsset, createMockResolvedAsset, parseTestPrompt } from 'promptopskit/testing';
267
+
268
+ const asset = createMockAsset({ model: 'gpt-5.4' });
269
+ const resolved = createMockResolvedAsset();
270
+ const parsed = parseTestPrompt('---\nid: test\nschema_version: 1\n---\n\nHello');
271
+ ```
272
+
273
+ ## API Reference
274
+
275
+ ### `createPromptOpsKit(config)`
276
+
277
+ Creates a `PromptOpsKit` instance.
278
+
279
+ | Option | Type | Default | Description |
280
+ |--------|------|---------|-------------|
281
+ | `sourceDir` | `string` | — | Path to prompt `.md` files (required) |
282
+ | `compiledDir` | `string` | | Path to compiled artifacts |
283
+ | `mode` | `'auto' \| 'compiled-only' \| 'source-only'` | `'auto'` | Resolution strategy |
284
+ | `cache` | `boolean` | `true` | Enable LRU cache with mtime invalidation |
285
+
286
+ ### `kit.renderPrompt(options)`
287
+
288
+ Renders a prompt for a specific provider. Returns `{ resolved, request, warnings }`.
289
+
290
+ | Option | Type | Description |
291
+ |--------|------|-------------|
292
+ | `path` | `string` | Prompt path (no extension), e.g. `'support/reply'` |
293
+ | `source` | `string` | Inline prompt source (alternative to path) |
294
+ | `provider` | `string` | `'openai'`, `'anthropic'`, `'gemini'`, `'openrouter'` |
295
+ | `variables` | `Record<string, string>` | Template variables |
296
+ | `environment` | `string` | Environment override name |
297
+ | `tier` | `string` | Tier override name |
298
+ | `history` | `Array<{ role, content }>` | Conversation history |
299
+ | `strict` | `boolean` | Fail on missing variables |
300
+
301
+ ### `kit.loadPrompt(path)` / `kit.resolvePrompt(path, options)` / `kit.validatePrompt(path)`
302
+
303
+ Lower-level methods for loading, resolving (includes + overrides), and validating individual prompts.
304
+
305
+ ### Standalone Functions
306
+
307
+ ```typescript
308
+ import { parsePrompt, interpolate, extractVariables, resolveIncludes, applyOverrides, validateAsset, getAdapter } from 'promptopskit';
309
+ ```
310
+
311
+ ## Schema
312
+
313
+ Prompt files use YAML front matter with these fields:
314
+
315
+ | Field | Type | Description |
316
+ |-------|------|-------------|
317
+ | `id` | `string` | Unique prompt identifier (required) |
318
+ | `schema_version` | `number` | Schema version, currently `1` |
319
+ | `provider` | `string` | `openai`, `anthropic`, `gemini` (or `google`), `openrouter`, `any` |
320
+ | `model` | `string` | Model name |
321
+ | `fallback_models` | `string[]` | Fallback model list |
322
+ | `reasoning` | `object` | `{ effort, budget_tokens }` |
323
+ | `sampling` | `object` | `{ temperature, top_p, frequency_penalty, presence_penalty, stop, max_output_tokens }` |
324
+ | `response` | `object` | `{ format, stream }` |
325
+ | `tools` | `array` | Tool references (string names or inline definitions) |
326
+ | `mcp` | `object` | MCP server references |
327
+ | `context` | `object` | `{ inputs, history }` — declare expected variables |
328
+ | `includes` | `string[]` | Paths to included prompt files |
329
+ | `environments` | `object` | Named environment overrides |
330
+ | `tiers` | `object` | Named tier overrides |
331
+ | `metadata` | `object` | `{ owner, tags, review_required, stable }` |
332
+
333
+ ## License
334
+
335
+ [MIT](LICENSE)
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  renderSections
3
- } from "./chunk-HEFOFQ2K.js";
3
+ } from "./chunk-6KGBPHSY.js";
4
4
 
5
5
  // src/providers/gemini.ts
6
6
  var geminiAdapter = {
@@ -89,4 +89,4 @@ var geminiAdapter = {
89
89
  export {
90
90
  geminiAdapter
91
91
  };
92
- //# sourceMappingURL=chunk-FSOJVXC4.js.map
92
+ //# sourceMappingURL=chunk-5BI5FP5L.js.map