factory-droid-openai 1.0.0__tar.gz

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 (52) hide show
  1. factory_droid_openai-1.0.0/.claude/skills/promptscript/SKILL.md +1039 -0
  2. factory_droid_openai-1.0.0/.editorconfig +15 -0
  3. factory_droid_openai-1.0.0/.factory/skills/promptscript/SKILL.md +1007 -0
  4. factory_droid_openai-1.0.0/.github/CODEOWNERS +4 -0
  5. factory_droid_openai-1.0.0/.github/ISSUE_TEMPLATE/bug_report.yml +77 -0
  6. factory_droid_openai-1.0.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
  7. factory_droid_openai-1.0.0/.github/ISSUE_TEMPLATE/feature_request.yml +36 -0
  8. factory_droid_openai-1.0.0/.github/dependabot.yml +24 -0
  9. factory_droid_openai-1.0.0/.github/pull_request_template.md +20 -0
  10. factory_droid_openai-1.0.0/.github/workflows/ci.yml +190 -0
  11. factory_droid_openai-1.0.0/.github/workflows/publish.yml +53 -0
  12. factory_droid_openai-1.0.0/.github/workflows/release-please.yml +24 -0
  13. factory_droid_openai-1.0.0/.gitignore +11 -0
  14. factory_droid_openai-1.0.0/.promptscript/project.prs +74 -0
  15. factory_droid_openai-1.0.0/.promptscript/skills/promptscript/SKILL.md +1036 -0
  16. factory_droid_openai-1.0.0/.release-please-manifest.json +3 -0
  17. factory_droid_openai-1.0.0/AGENTS.md +67 -0
  18. factory_droid_openai-1.0.0/CHANGELOG.md +18 -0
  19. factory_droid_openai-1.0.0/CLAUDE.md +59 -0
  20. factory_droid_openai-1.0.0/CONTRIBUTING.md +88 -0
  21. factory_droid_openai-1.0.0/LICENSE +199 -0
  22. factory_droid_openai-1.0.0/PKG-INFO +890 -0
  23. factory_droid_openai-1.0.0/README.md +851 -0
  24. factory_droid_openai-1.0.0/SECURITY.md +54 -0
  25. factory_droid_openai-1.0.0/benchmarks/benchmark_protocol.py +94 -0
  26. factory_droid_openai-1.0.0/codecov.yml +26 -0
  27. factory_droid_openai-1.0.0/openapi.json +823 -0
  28. factory_droid_openai-1.0.0/promptscript.yaml +11 -0
  29. factory_droid_openai-1.0.0/pyproject.toml +112 -0
  30. factory_droid_openai-1.0.0/release-please-config.json +86 -0
  31. factory_droid_openai-1.0.0/renovate.json5 +68 -0
  32. factory_droid_openai-1.0.0/scripts/generate_openapi.py +21 -0
  33. factory_droid_openai-1.0.0/src/factory_droid_openai/__init__.py +1 -0
  34. factory_droid_openai-1.0.0/src/factory_droid_openai/app.py +1391 -0
  35. factory_droid_openai-1.0.0/src/factory_droid_openai/attachments.py +228 -0
  36. factory_droid_openai-1.0.0/src/factory_droid_openai/cli.py +58 -0
  37. factory_droid_openai-1.0.0/src/factory_droid_openai/config.py +236 -0
  38. factory_droid_openai-1.0.0/src/factory_droid_openai/errors.py +9 -0
  39. factory_droid_openai-1.0.0/src/factory_droid_openai/metrics.py +117 -0
  40. factory_droid_openai-1.0.0/src/factory_droid_openai/models.py +135 -0
  41. factory_droid_openai-1.0.0/src/factory_droid_openai/protocol.py +466 -0
  42. factory_droid_openai-1.0.0/src/factory_droid_openai/py.typed +1 -0
  43. factory_droid_openai-1.0.0/src/factory_droid_openai/runner.py +459 -0
  44. factory_droid_openai-1.0.0/tests/test_app.py +1405 -0
  45. factory_droid_openai-1.0.0/tests/test_attachments.py +213 -0
  46. factory_droid_openai-1.0.0/tests/test_cli.py +125 -0
  47. factory_droid_openai-1.0.0/tests/test_config.py +331 -0
  48. factory_droid_openai-1.0.0/tests/test_openai_client.py +348 -0
  49. factory_droid_openai-1.0.0/tests/test_openapi.py +47 -0
  50. factory_droid_openai-1.0.0/tests/test_protocol.py +691 -0
  51. factory_droid_openai-1.0.0/tests/test_runner.py +734 -0
  52. factory_droid_openai-1.0.0/uv.lock +1283 -0
@@ -0,0 +1,1039 @@
1
+ ---
2
+ # promptscript-generated: true
3
+ name: promptscript
4
+ description: >-
5
+ PromptScript language expert for reading, writing, modifying, and
6
+ troubleshooting .prs files. Use when working with PromptScript syntax,
7
+ creating or editing .prs files, adding blocks like @identity, @standards,
8
+ @restrictions, @shortcuts, @skills, or @agents, configuring
9
+ promptscript.yaml, resolving compilation errors, understanding inheritance
10
+ (@inherit) and composition (@use, @extend), or migrating AI instructions
11
+ to PromptScript. Also use when asked about the 48 built-in compilation
12
+ targets, including GitHub Copilot, Claude Code, Cursor, Antigravity,
13
+ Factory AI, and AGENTS.md-based platforms.
14
+ license: MIT
15
+ metadata:
16
+ author: PromptScript
17
+ homepage: https://getpromptscript.dev
18
+ compatibility:
19
+ - claude-code
20
+ - github-copilot
21
+ - cursor
22
+ - factory-ai
23
+ - gemini-cli
24
+ - opencode
25
+ - windsurf
26
+ - cline
27
+ - roo
28
+ - codex
29
+ - continue
30
+ - augment
31
+ - goose
32
+ - kilo
33
+ - amp
34
+ - trae
35
+ - junie
36
+ - kiro-cli
37
+ allowed-tools:
38
+ - Read
39
+ - Write
40
+ - Glob
41
+ - Grep
42
+ - Bash
43
+ user-invocable: true
44
+ ---
45
+
46
+ # PromptScript Language Guide
47
+
48
+ PromptScript is a domain-specific language that compiles `.prs` files into native instruction formats for AI coding assistants (GitHub Copilot, Claude Code, Cursor, Antigravity, Factory AI, OpenCode, Gemini CLI). One source of truth, multiple outputs.
49
+
50
+ ## File Structure
51
+
52
+ A `.prs` file is made of blocks. Order doesn't matter except `@meta` should come first by convention.
53
+
54
+ ```
55
+ # Comments start with #
56
+
57
+ @meta { ... } # Required metadata
58
+ @inherit @path # Single inheritance (optional)
59
+ @use @path [as alias] # Imports/mixins (optional, multiple)
60
+
61
+ @identity { ... } # AI persona
62
+ @context { ... } # Project context
63
+ @standards { ... } # Coding conventions
64
+ @restrictions { ... } # Hard rules
65
+ @shortcuts { ... } # Command aliases
66
+ @knowledge { ... } # Reference documentation
67
+ @skills { ... } # Reusable skill definitions
68
+ @agents { ... } # Subagent definitions
69
+ @examples { ... } # Few-shot input/output examples (syntax 1.2.0+)
70
+ @params { ... } # Template parameters
71
+ @guards { ... } # File globs and priorities
72
+ @local { ... } # Private config (not committed)
73
+ @extend path { ... } # Modify imported blocks
74
+ @custom-name { ... } # Arbitrary named blocks
75
+ ```
76
+
77
+ ## Content Types
78
+
79
+ PromptScript has three content types inside blocks:
80
+
81
+ ### Text Content
82
+
83
+ Use triple quotes (three double-quote characters) to wrap multiline text.
84
+ Text is automatically dedented - leading whitespace from source indentation is stripped.
85
+ Use for prose, markdown, or freeform content.
86
+
87
+ Example: `@identity` with a text block describing an AI persona starting with "You are..."
88
+
89
+ ### Object Content (key-value pairs)
90
+
91
+ ```
92
+ @context {
93
+ project: "My App"
94
+ team: "Frontend"
95
+ monorepo: {
96
+ tool: "Nx"
97
+ packageManager: "pnpm"
98
+ }
99
+ }
100
+ ```
101
+
102
+ Values can be strings (quoted or unquoted), numbers, booleans, nested objects, or arrays.
103
+
104
+ ### Array Content
105
+
106
+ ```
107
+ @standards {
108
+ code: [
109
+ "Use strict TypeScript",
110
+ "Named exports only"
111
+ ]
112
+ }
113
+
114
+ @restrictions {
115
+ - "Never use any type"
116
+ - "Never commit secrets"
117
+ }
118
+ ```
119
+
120
+ ### Mixed Content
121
+
122
+ Blocks can contain both object properties and text in the same block.
123
+ Place the triple-quoted text block alongside key-value pairs.
124
+
125
+ ## Block Reference
126
+
127
+ ### @meta (required)
128
+
129
+ ```
130
+ @meta {
131
+ id: "project-id" # Required: unique identifier
132
+ syntax: "1.0.0" # Required: syntax version (semver)
133
+ org: "Company Name" # Optional
134
+ team: "Frontend" # Optional
135
+ tags: [react, ts] # Optional
136
+ params: { # Optional: template parameters
137
+ projectName: string
138
+ port: number = 3000
139
+ debug?: boolean
140
+ framework: enum("react", "vue") = "react"
141
+ }
142
+ }
143
+ ```
144
+
145
+ ### @identity
146
+
147
+ Defines AI persona. Start with "You are..." for consistent output across all formatters.
148
+ Contains a triple-quoted text block with the persona description.
149
+
150
+ ### @context
151
+
152
+ Project context with structured properties (project, team, languages, runtime)
153
+ plus optional triple-quoted text for architecture details, diagrams, etc.
154
+
155
+ ### @standards
156
+
157
+ Category-based conventions. Any category name is valid:
158
+
159
+ ```
160
+ @standards {
161
+ typescript: ["Strict mode", "No any type"]
162
+ naming: ["Files: kebab-case.ts", "Classes: PascalCase"]
163
+ git: {
164
+ format: "Conventional Commits"
165
+ types: [feat, fix, docs, refactor, test, chore]
166
+ }
167
+ }
168
+ ```
169
+
170
+ ### @restrictions
171
+
172
+ Hard rules as a list of dash-prefixed strings:
173
+
174
+ ```
175
+ @restrictions {
176
+ - "Never expose API keys"
177
+ - "Never commit secrets to version control"
178
+ - "Always validate user input"
179
+ }
180
+ ```
181
+
182
+ ### @shortcuts
183
+
184
+ Simple strings appear as documentation. Objects with `prompt: true` generate
185
+ executable prompt/command files for GitHub Copilot and Cursor:
186
+
187
+ ```
188
+ @shortcuts {
189
+ "/review": "Review code for quality"
190
+ "/test": {
191
+ prompt: true
192
+ description: "Write unit tests"
193
+ content: (triple-quoted text with instructions)
194
+ }
195
+ }
196
+ ```
197
+
198
+ > `@commands` is a backwards-compatible alias for `@shortcuts` — prefer `@shortcuts` in new files.
199
+
200
+ ### @skills
201
+
202
+ Reusable skill definitions with metadata:
203
+
204
+ ```
205
+ @skills {
206
+ commit: {
207
+ description: "Create git commits"
208
+ trigger: "commit, git commit"
209
+ disableModelInvocation: true
210
+ userInvocable: true
211
+ allowedTools: ["Bash", "Read"]
212
+ content: (triple-quoted text with skill instructions)
213
+ }
214
+ }
215
+ ```
216
+
217
+ Properties: description (required), content (required), trigger, disableModelInvocation,
218
+ userInvocable, allowedTools, context ("fork" or "inherit"), agent, requires, references, inputs, outputs.
219
+
220
+ The `references` property attaches external files to the skill's context:
221
+
222
+ ```
223
+ @skills {
224
+ architecture-review: {
225
+ description: "Review architecture decisions"
226
+ references: [
227
+ ./references/architecture.md
228
+ ./references/modules.md
229
+ ]
230
+ content: (triple-quoted text)
231
+ }
232
+ }
233
+ ```
234
+
235
+ Allowed file types: `.md`, `.json`, `.yaml`, `.yml`, `.txt`, `.csv`. Paths are resolved relative
236
+ to the `.prs` file. Formatters emit referenced files alongside SKILL.md in the output directory.
237
+
238
+ ### Parameterized Skills
239
+
240
+ Skills in `.promptscript/skills/<name>/SKILL.md` support template parameters via
241
+ YAML frontmatter. Define `params` in frontmatter and use `{{variable}}` in content:
242
+
243
+ ```yaml
244
+ ---
245
+ name: review
246
+ description: "Review {{language}} code for {{standard}}"
247
+ params:
248
+ language:
249
+ type: string
250
+ standard:
251
+ type: string
252
+ default: "best practices"
253
+ references:
254
+ - references/architecture.md
255
+ ---
256
+ Review the code using {{language}} conventions following {{standard}}.
257
+ ```
258
+
259
+ The `references` field in SKILL.md frontmatter lists files to attach to the skill's context.
260
+ Paths are relative to the SKILL.md file.
261
+
262
+ Pass values in `@skills` block:
263
+
264
+ ```
265
+ @skills {
266
+ review: {
267
+ description: "Review code"
268
+ language: "typescript"
269
+ standard: "strict mode"
270
+ }
271
+ }
272
+ ```
273
+
274
+ Non-reserved properties (anything other than description, content, trigger,
275
+ userInvocable, allowedTools, disableModelInvocation, context, agent, requires,
276
+ inputs, outputs) are treated as skill parameter arguments.
277
+
278
+ ### Skill Dependencies
279
+
280
+ Skills can declare dependencies on other skills via `requires`:
281
+
282
+ ```
283
+ @skills {
284
+ deploy: {
285
+ description: "Deploy service"
286
+ requires: ["lint-check", "test-suite"]
287
+ content: (triple-quoted text)
288
+ }
289
+ }
290
+ ```
291
+
292
+ The validator (PS016) checks that required skills exist, detects self-references,
293
+ and catches circular dependency chains.
294
+
295
+ ### Skill Contracts (Inputs/Outputs)
296
+
297
+ Skills can declare typed inputs and outputs in SKILL.md frontmatter:
298
+
299
+ ```yaml
300
+ ---
301
+ name: security-scan
302
+ description: "Scan for vulnerabilities"
303
+ inputs:
304
+ files:
305
+ description: "Files to scan"
306
+ type: string
307
+ severity:
308
+ description: "Minimum severity"
309
+ type: enum
310
+ options: [low, medium, high]
311
+ default: medium
312
+ outputs:
313
+ report:
314
+ description: "Scan report"
315
+ type: string
316
+ passed:
317
+ description: "Whether scan passed"
318
+ type: boolean
319
+ ---
320
+ ```
321
+
322
+ Field types: `string`, `number`, `boolean`, `enum` (with `options` list).
323
+ The validator (PS017) checks field types, ensures enum fields have options,
324
+ and warns if param names collide with input names.
325
+
326
+ ### Shared Resources
327
+
328
+ Skills in a folder can share common resources via `.promptscript/shared/`:
329
+
330
+ ```
331
+ .promptscript/
332
+ shared/
333
+ templates.md # Shared across all skills
334
+ style-guide.md
335
+ skills/
336
+ review/
337
+ SKILL.md # Gets @shared/templates.md, @shared/style-guide.md
338
+ deploy/
339
+ SKILL.md # Also gets shared resources
340
+ ```
341
+
342
+ Files in `shared/` are automatically included in every skill with `@shared/` prefix.
343
+
344
+ ### @agents
345
+
346
+ Custom subagent definitions. Compiles to `.claude/agents/` for Claude Code,
347
+ `.github/agents/` for GitHub Copilot, `.factory/droids/` for Factory AI, etc.
348
+
349
+ ```
350
+ @agents {
351
+ code-reviewer: {
352
+ description: "Reviews code quality"
353
+ tools: ["Read", "Grep", "Glob", "Bash"]
354
+ model: "sonnet"
355
+ permissionMode: "default"
356
+ content: (triple-quoted text with agent instructions)
357
+ }
358
+ }
359
+ ```
360
+
361
+ Supports mixed models per agent: `specModel` sets a different model for
362
+ Specification/planning mode (GitHub, Factory), `specReasoningEffort` sets reasoning
363
+ effort for the spec model (Factory only, values: "low", "medium", "high").
364
+
365
+ Factory AI droids support additional properties: `model` (any model ID or "inherit"),
366
+ `reasoningEffort` ("low", "medium", "high"), and `tools` (category name like "read-only"
367
+ or array of tool IDs).
368
+
369
+ ### @examples
370
+
371
+ Structured few-shot examples for AI assistants (requires syntax `1.2.0`):
372
+
373
+ ```
374
+ @meta {
375
+ id: "commit-style"
376
+ syntax: "1.2.0"
377
+ }
378
+
379
+ @examples {
380
+ feat-commit: {
381
+ description: "Feature commit with scope"
382
+ input: "Added user authentication with JWT tokens"
383
+ output: "feat(auth): add JWT-based user authentication"
384
+ }
385
+ }
386
+ ```
387
+
388
+ Each entry is a named example with `input` and `output` (both required),
389
+ plus optional `description`. Multi-line content uses triple-quoted strings.
390
+
391
+ Examples can also be attached to skills via the `examples` property:
392
+
393
+ ```
394
+ @skills {
395
+ commit: {
396
+ description: "Create conventional commits"
397
+ examples: {
398
+ basic: {
399
+ input: "Added dark mode toggle"
400
+ output: "feat(settings): add dark mode toggle"
401
+ }
402
+ }
403
+ content: (triple-quoted text)
404
+ }
405
+ }
406
+ ```
407
+
408
+ ### @knowledge
409
+
410
+ Reference documentation as triple-quoted text. Used for command references,
411
+ API docs, and other material that should appear in the output.
412
+
413
+ ### @params
414
+
415
+ Template parameter definitions with types: string, number, boolean, enum("a", "b").
416
+ Optional parameters use `?` suffix. Defaults use `= value`.
417
+
418
+ ### @guards
419
+
420
+ File glob patterns and priority rules for path-specific instructions.
421
+
422
+ ### @local
423
+
424
+ Private local configuration. Not included in compiled output or committed to git.
425
+
426
+ ## Inheritance and Composition
427
+
428
+ ### @inherit (single, linear)
429
+
430
+ One per file. Child blocks merge on top of parent:
431
+
432
+ ```
433
+ @inherit @company/frontend-team
434
+ @inherit ./parent
435
+ @inherit @stacks/react-app(projectName: "my-app", port: 3000)
436
+ ```
437
+
438
+ ### @use (multiple, mixins)
439
+
440
+ Import and merge fragments:
441
+
442
+ ```
443
+ @use @core/security
444
+ @use @core/quality
445
+ @use ./local-config
446
+ @use @core/typescript as ts # alias enables @extend access
447
+ ```
448
+
449
+ #### URL imports (Go-module style)
450
+
451
+ Import directly from any Git repository by host path - no alias required:
452
+
453
+ ```
454
+ @use github.com/acme/shared-standards/@fragments/security
455
+ @use gitlab.com/myorg/prompts/@stacks/python
456
+ ```
457
+
458
+ Version pinning with `@`:
459
+
460
+ ```
461
+ @use github.com/acme/shared-standards/@org/base@1.2.0 # exact version
462
+ @use github.com/acme/shared-standards/@org/base@^1.0.0 # semver range
463
+ @use github.com/acme/shared-standards/@org/base@main # branch
464
+ ```
465
+
466
+ #### Registry aliases
467
+
468
+ Short names for Git repository URLs, configured in `promptscript.yaml`:
469
+
470
+ ```yaml
471
+ registries:
472
+ company:
473
+ url: github.com/acme/promptscript-registry
474
+ ```
475
+
476
+ Then use the alias as scope prefix:
477
+
478
+ ```
479
+ @use @company/security
480
+ @inherit @company/base-config
481
+ ```
482
+
483
+ Merge rules:
484
+
485
+ - Text: concatenated with deduplication
486
+ - Objects: deep merged (target wins on conflicts)
487
+ - Arrays: unique concatenation
488
+
489
+ ### Block Filtering
490
+
491
+ Control which blocks are imported using the reserved `only` and `exclude` parameters:
492
+
493
+ ```
494
+ @use ./shared-config(only: ["skills", "context"])
495
+ @use ./shared-config(exclude: ["knowledge"])
496
+ @use ./shared-config(exclude: ["knowledge"], mode: "strict")
497
+ ```
498
+
499
+ Rules:
500
+
501
+ - `only` and `exclude` are mutually exclusive — using both is a validation error (PS021)
502
+ - Values are block type names: `identity`, `context`, `standards`, `knowledge`, `skills`, `shortcuts`, `agents`, etc.
503
+ - Block filtering does not apply to `@inherit` directives
504
+
505
+ ### Markdown Imports
506
+
507
+ Import skills directly from `.md` files (v1.8+). No external tools needed:
508
+
509
+ ```
510
+ @use ./skills/frontend-design.md
511
+ @use ./shared/commit.md as commit
512
+ @use github.com/anthropics/skills/commit@1.0.0
513
+ @use github.com/repo/skills/gitnexus # directory → SKILL.md
514
+ ```
515
+
516
+ Content detection: PromptScript blocks in `.md` are parsed as a `.prs` fragment;
517
+ YAML frontmatter with `name`/`description` is loaded as a skill definition;
518
+ otherwise content is treated as free-form knowledge.
519
+
520
+ CLI management:
521
+
522
+ ```
523
+ prs skills add github.com/anthropics/skills/commit@1.0.0
524
+ prs skills remove commit
525
+ prs skills list
526
+ prs skills update
527
+ ```
528
+
529
+ ### @extend (modify existing or imported blocks)
530
+
531
+ Use a direct path for inherited or local blocks:
532
+
533
+ ```
534
+ @extend standards.testing {
535
+ coverage: 95
536
+ }
537
+ ```
538
+
539
+ Use an alias when targeting a specific imported block:
540
+
541
+ ```
542
+ @use @core/typescript as ts
543
+
544
+ @extend ts.standards {
545
+ testing: { coverage: 95 }
546
+ }
547
+ ```
548
+
549
+ #### Replacing regular block fields
550
+
551
+ Syntax `1.3.0` supports explicit replacement of complete regular block field values:
552
+
553
+ ```
554
+ @meta { id: "project" syntax: "1.3.0" }
555
+
556
+ @inherit ./company-base
557
+
558
+ @extend standards {
559
+ testing!: ["Use Vitest"]
560
+ linting: ["Use ESLint"]
561
+ }
562
+ ```
563
+
564
+ `testing!` replaces the inherited value. Fields without `!` keep normal merge behavior.
565
+ Replacement works after `@inherit` and `@use`, including aliases and nested target paths.
566
+ A missing field is set. The modifier is rejected for `@skills`, which retain their dedicated
567
+ merge and sealing semantics.
568
+
569
+ #### Skill-aware @extend semantics
570
+
571
+ When extending a skill definition via `@extend`, individual skill properties follow specific merge
572
+ strategies rather than the generic block merge rules:
573
+
574
+ | Strategy | Properties |
575
+ | ----------------- | -------------------------------------------------------------------------------------------------- |
576
+ | **Replace** | content, description, trigger, userInvocable, allowedTools, disableModelInvocation, context, agent |
577
+ | **Append** | references, examples, requires |
578
+ | **Shallow merge** | params, inputs, outputs |
579
+
580
+ Example — extending a base skill to add references and override content:
581
+
582
+ ```
583
+ @use @company/skills as skills
584
+
585
+ @extend skills.code-review {
586
+ content: (triple-quoted text with overridden instructions)
587
+ references: [
588
+ ./extra-context.md
589
+ ]
590
+ }
591
+ ```
592
+
593
+ The `references` array from the base skill and the overlay are combined (append). The `content`
594
+ field from the overlay replaces the base (replace).
595
+
596
+ #### Reference negation
597
+
598
+ Use `!` prefix in `@extend` to remove entries from a lower layer's append-strategy arrays:
599
+
600
+ ```
601
+ @extend skills.code-review {
602
+ references: [
603
+ "!references/deprecated.md"
604
+ "references/replacement.md"
605
+ ]
606
+ }
607
+ ```
608
+
609
+ Path matching is normalized (`"!./foo.md"` matches `"foo.md"`). Only works in `@extend` blocks
610
+ on `references` and `requires`. Validator PS028 warns about `!` in base definitions.
611
+
612
+ #### Overlay consistency warnings
613
+
614
+ The resolver emits warnings during compile when an overlay drifts from its base. Always shown
615
+ (not gated by `--verbose`):
616
+
617
+ - **Orphaned extend** — `@extend target "X" not found — overlay will be ignored.` Triggered when
618
+ the targeted block doesn't exist (base removed or renamed).
619
+
620
+ - **Stale skill target** — `@extend creates new skill "X" — base does not define it.` Triggered
621
+ when an `@extend` inside `@skills` would create a new skill instead of extending an existing one.
622
+
623
+ - **Negation orphan** — `Negation "!path" did not match any base entry — it may be stale.`
624
+ Triggered when a `!entry` in references/requires doesn't match anything in the base.
625
+
626
+ These come from the resolver, not the validator (PS0XX rules). They appear during `prs compile`,
627
+ not `prs validate`.
628
+
629
+ #### Sealed properties
630
+
631
+ Prevent `@extend` from overriding specified replace-strategy properties:
632
+
633
+ ```
634
+ @skills {
635
+ deploy: {
636
+ content: (triple-quoted text with critical workflow)
637
+ sealed: ["content", "description"]
638
+ }
639
+ }
640
+ ```
641
+
642
+ `sealed: true` seals all replace-strategy properties. Attempting to override a sealed
643
+ property is a hard compilation error. Only the base skill author can set `sealed` —
644
+ overlays cannot add or modify it. Append-strategy properties remain extendable.
645
+ Validator PS029 warns about invalid entries in `sealed`.
646
+
647
+ #### Skill composition (inline @use)
648
+
649
+ Import sub-skills within a `@skills` block to compose multi-phase workflows:
650
+
651
+ ```
652
+ @skills {
653
+ ops: {
654
+ description: "Production triage"
655
+ content: (triple-quoted text with orchestrator instructions)
656
+ }
657
+ @use ./phases/health-scan
658
+ @use ./phases/triage
659
+ @use ./phases/code-fix as autofix
660
+ }
661
+ ```
662
+
663
+ Each `@use` resolves the referenced `.prs` file, extracts its skill definition and context
664
+ blocks, and flattens them as numbered phase sections into the parent skill's content. The
665
+ `as alias` form controls the phase display name. Validator PS027 checks composition validity.
666
+
667
+ ### Parameterized Inheritance (Template Variables)
668
+
669
+ Use `{{variable}}` placeholders in a **parent/template** file, and pass values
670
+ from the **child** file via `@inherit` or `@use` with `(key: value)` syntax.
671
+
672
+ **IMPORTANT:** Variables are NOT set from `promptscript.yaml` or CLI. They are
673
+ passed from one `.prs` file to another through `@inherit` or `@use`.
674
+
675
+ **Step 1: Create the template** (parent file with `params` in `@meta`):
676
+
677
+ ```
678
+ # base.prs - reusable template
679
+ @meta {
680
+ id: "service-template"
681
+ syntax: "1.0.0"
682
+ params: {
683
+ serviceName: string
684
+ port?: number = 3000
685
+ }
686
+ }
687
+
688
+ @identity {
689
+ """
690
+ You are working on {{serviceName}} running on port {{port}}.
691
+ """
692
+ }
693
+ ```
694
+
695
+ **Step 2: Inherit with values** (child file passes params):
696
+
697
+ ```
698
+ # project.prs - concrete project
699
+ @meta { id: "user-api" syntax: "1.0.0" }
700
+
701
+ @inherit ./base(serviceName: "user-api", port: 8080)
702
+ ```
703
+
704
+ After compilation, `{{serviceName}}` becomes `user-api` and `{{port}}` becomes `8080`.
705
+
706
+ The same works with `@use`:
707
+
708
+ ```
709
+ @use ./base(serviceName: "auth-service") as auth
710
+ ```
711
+
712
+ **Parameter types:** `string`, `number`, `boolean`, `enum("a", "b")`.
713
+ Optional params use `?` suffix. Defaults use `= value`.
714
+ Missing required params produce a compile error.
715
+
716
+ **Multi-service pattern** - reuse one template across many projects:
717
+
718
+ ```
719
+ services/
720
+ base.prs # template with params
721
+ user-api/
722
+ promptscript.yaml # source: project.prs
723
+ project.prs # @inherit ../base(serviceName: "user-api")
724
+ auth-service/
725
+ promptscript.yaml
726
+ project.prs # @inherit ../base(serviceName: "auth-service")
727
+ ```
728
+
729
+ ## Configuration: promptscript.yaml
730
+
731
+ ### Auto-injection
732
+
733
+ This skill is automatically included when compiling with `prs compile`. No manual copying needed.
734
+ To disable, set `includePromptScriptSkill: false` in your `promptscript.yaml`.
735
+
736
+ ```
737
+ id: my-project
738
+ syntax: "1.1.0"
739
+ description: "My project description"
740
+ input:
741
+ entry: .promptscript/project.prs
742
+ include: ['.promptscript/**/*.prs']
743
+ targets:
744
+ github:
745
+ version: full # simple | multifile | full
746
+ claude:
747
+ version: full
748
+ cursor:
749
+ version: standard
750
+ antigravity:
751
+ version: frontmatter
752
+ factory:
753
+ version: full
754
+ windsurf: # 41 additional targets supported
755
+ version: simple
756
+ cline:
757
+ version: simple
758
+ registry:
759
+ git: https://github.com/org/registry.git
760
+ ref: main
761
+ registries:
762
+ company:
763
+ url: github.com/acme/promptscript-registry
764
+ oss:
765
+ url: github.com/prscrpt/community-registry
766
+ ref: v2
767
+ policies:
768
+ - name: adjacent-layers-only
769
+ kind: layer-boundary
770
+ severity: error
771
+ layers: ['@core', '@team', '@project']
772
+ maxDistance: 1
773
+ ```
774
+
775
+ ### Lockfile: `promptscript.lock`
776
+
777
+ When remote imports are used, `prs compile` automatically generates a lockfile
778
+ recording the exact resolved commit for each dependency. Integrity hashes
779
+ (SHA-256) are included for registry references to detect tampering or drift.
780
+ This enables reproducible builds across machines and CI. Commit `promptscript.lock`
781
+ to version control.
782
+
783
+ Use `--ignore-hashes` on `prs compile` or `prs validate` to skip integrity
784
+ hash verification when needed.
785
+
786
+ ### Policy Engine
787
+
788
+ Define organizational policies in `promptscript.yaml` to validate skill extensions:
789
+
790
+ ```yaml
791
+ policies:
792
+ - name: adjacent-layers-only
793
+ kind: layer-boundary
794
+ description: "Only adjacent layers can extend each other"
795
+ severity: error
796
+ layers: ["@core", "@team", "@project"]
797
+ maxDistance: 1
798
+
799
+ - name: protect-content
800
+ kind: property-protection
801
+ description: "Content override requires explicit approval"
802
+ severity: warning
803
+ properties: ["content", "description"]
804
+
805
+ - name: approved-registries
806
+ kind: registry-allowlist
807
+ description: "Extensions must come from approved registries"
808
+ severity: error
809
+ allowed: ["@core", "@team"]
810
+ ```
811
+
812
+ Policy kinds: `layer-boundary` (controls layer distance), `property-protection`
813
+ (prevents overriding specific properties), `registry-allowlist` (restricts extension sources).
814
+ Severity: `error` (fails validation) or `warning` (reported only).
815
+ Skip with `--skip-policies` during development (never in CI).
816
+
817
+ ## Syntax Version Validation
818
+
819
+ The `syntax` field in `@meta` declares the PromptScript language version (semver).
820
+
821
+ ### Known Versions
822
+
823
+ | Version | What it adds |
824
+ | ------- | ----------------------------------------------------------------------------------------------------------------------- |
825
+ | `1.0.0` | Core blocks (identity, context, standards, restrictions, knowledge, shortcuts, commands, guards, params, skills, local) |
826
+ | `1.1.0` | Adds `@agents` and `@workflows`; reserves internal `@prompts` |
827
+ | `1.2.0` | Adds `@examples` (few-shot input/output pairs) |
828
+ | `1.3.0` | Adds explicit regular block field replacement in `@extend` |
829
+ | `1.4.0` | Adds `@hooks`, `@mcpServers`, and `@plugins` |
830
+
831
+ ### Block Version Requirements
832
+
833
+ | Block | Minimum Syntax Version |
834
+ | ------------- | ---------------------- |
835
+ | `@agents` | `1.1.0` |
836
+ | `@workflows` | `1.1.0` |
837
+ | `@examples` | `1.2.0` |
838
+ | `@hooks` | `1.4.0` |
839
+ | `@mcpServers` | `1.4.0` |
840
+ | `@plugins` | `1.4.0` |
841
+
842
+ All other built-in blocks are available from `1.0.0`.
843
+ Regular block field replacement with `field!: value` requires syntax `1.3.0`.
844
+
845
+ ### Validation Rules
846
+
847
+ - **PS018 (`syntax-version-compat`)**: warns when resolved blocks or syntax features require a higher version than declared. Requirements from inheritance, imports, and skill composition are included. Suggestion: run `prs validate --fix`.
848
+ - **PS019 (`unknown-block-name`)**: warns when a block name is not a known PromptScript type, with fuzzy-match suggestions for typos.
849
+ - **PS021 (`use-block-filter`)**: errors when `only` and `exclude` are both specified in `@use` parameters.
850
+ - **PS025 (`valid-skill-references`)**: errors when a `references` entry points to a file with a disallowed extension or a path that cannot be resolved.
851
+ - **PS026 (`safe-reference-content`)**: warns when a referenced file contains potentially sensitive content (e.g., secrets, credentials).
852
+ - **PS027 (`valid-skill-composition`)**: warns about conflicting phase names or excessive phases in composed skills.
853
+ - **PS028 (`valid-append-negation`)**: warns when negation prefix `!` appears in base skill definitions (only effective in `@extend`).
854
+ - **PS029 (`valid-sealed-property`)**: warns when `sealed` contains non-replace-strategy property names.
855
+ - **PS030 (`policy-compliance`)**: validates skill extensions against organizational policies defined in `promptscript.yaml`.
856
+
857
+ ### Fixing Syntax Versions
858
+
859
+ ```
860
+ prs validate --fix # Auto-fix syntax versions in .prs files
861
+ prs upgrade # Upgrade all .prs files to the latest version
862
+ ```
863
+
864
+ `--fix` rewrites the `syntax: "..."` line in each file's `@meta` block to match the minimum version required by resolved blocks and syntax features. It follows inheritance, imports, and skill composition. It only upgrades, never downgrades.
865
+
866
+ `prs upgrade` upgrades all files to the latest known syntax version regardless of what blocks they use.
867
+
868
+ ## CLI Commands
869
+
870
+ ```
871
+ prs init # Initialize project (auto-detects existing files)
872
+ prs init --yes --targets claude factory
873
+ prs init --dry-run # Preview initialization
874
+ prs init --auto-import # Initialize + static import of existing files
875
+ prs migrate # Interactive migration flow
876
+ prs migrate --static # Non-interactive static import
877
+ prs migrate --llm # Generate AI-assisted migration prompt
878
+ prs migrate --static --dry-run
879
+ prs compile # Compile to all targets
880
+ prs compile --watch # Watch mode
881
+ prs compile --ignore-hashes # Skip integrity hash verification
882
+ prs build <name> # Compile a named build profile
883
+ prs validate --strict # Validate syntax
884
+ prs validate --fix # Auto-fix syntax version declarations
885
+ prs validate --skip-policies # Skip policy engine evaluation
886
+ prs upgrade # Upgrade all .prs files to latest syntax version
887
+ prs import CLAUDE.md # Import existing AI instructions
888
+ prs import CLAUDE.md --dry-run # Preview import conversion
889
+ prs inspect <skill> # Show skill composition provenance
890
+ prs inspect <skill> --layers # Show layer-level breakdown
891
+ prs hooks install # Install auto-compilation hooks for AI tools
892
+ prs hooks install claude # Install hooks for a specific tool
893
+ prs skills add <source> # Add a remote skill (@use + lock update + SKILL.md validation)
894
+ prs skills add <source> --strict # Treat validation warnings as errors
895
+ prs skills add <source> --skip-validation # Bypass Agent Skills spec checks (not recommended)
896
+ prs skills remove <name> # Remove a skill (@use line + lock entry)
897
+ prs skills list # List all imported skills
898
+ prs skills update # Re-resolve markdown-imported skills (re-validates + re-hashes)
899
+ prs pull # Update registry
900
+ prs diff --target claude # Show compilation diff
901
+ prs lock # Generate/update promptscript.lock
902
+ prs lock --dry-run # Preview lockfile changes
903
+ prs update # Re-resolve all remote imports to latest
904
+ prs update <url> # Update a specific registry
905
+ prs vendor sync # Copy cached deps to .promptscript/vendor/
906
+ prs vendor check # Verify vendor matches lockfile
907
+ prs resolve @alias/path # Debug: show how an import resolves
908
+ prs registry list # Show configured registries and aliases
909
+ prs registry add <alias> <url> # Add a registry alias
910
+ ```
911
+
912
+ `prs init --yes` requires explicit, detected, or user-configured targets. It does not invent
913
+ default tools. For existing projects, `prs migrate` preserves `promptscript.yaml`, isolates static
914
+ output under `.promptscript/migrated/`, leaves source instructions untouched, and performs no
915
+ writes when no candidates are detected.
916
+
917
+ ## Output Targets
918
+
919
+ 48 supported targets. Key examples:
920
+
921
+ | Target | Main File | Skills |
922
+ | ----------- | ------------------------------- | -------------------------------------------------- |
923
+ | GitHub | .github/copilot-instructions.md | .github/skills/\*/SKILL.md |
924
+ | Claude | CLAUDE.md | .claude/skills/\*/SKILL.md |
925
+ | Cursor | .cursor/rules/project.mdc | .agents/skills/\*/SKILL.md |
926
+ | Antigravity | .agent/rules/project.md | -------------------------------------------------- |
927
+ | Factory | AGENTS.md | .factory/skills/\*/SKILL.md, .factory/droids/\*.md |
928
+ | OpenCode | OPENCODE.md | .opencode/skills/\*/SKILL.md |
929
+ | Gemini | GEMINI.md | .agents/skills/\*/skill.md |
930
+ | Windsurf | .windsurf/rules/project.md | .windsurf/skills/\*/SKILL.md |
931
+ | Cline | .clinerules | -------------------------------------------------- |
932
+ | Roo Code | .roorules | -------------------------------------------------- |
933
+ | Codex | AGENTS.md | .agents/skills/\*/SKILL.md |
934
+ | Continue | .continue/rules/project.md | -------------------------------------------------- |
935
+ | + 36 more | | See full list in documentation |
936
+
937
+ ### Formatter Documentation
938
+
939
+ For detailed information about each formatter's output paths, supported features, quirks, and example outputs:
940
+
941
+ - **Full formatter reference:** `docs/reference/formatters/` (7 dedicated pages + index of all 48)
942
+ - **llms-full.txt:** Available at the docs site root - contains all documentation in a single file for LLM consumption
943
+ - **Dedicated pages exist for:** Claude Code, GitHub Copilot, Cursor, Antigravity, Factory AI, Gemini CLI, OpenCode
944
+ - **All 48 formatters indexed at:** `docs/reference/formatters/index.md` with output paths, tier, and feature flags
945
+
946
+ ### Auto-Compilation Hooks
947
+
948
+ Instead of running `prs compile --watch` manually, install hooks so your AI tool
949
+ triggers compilation automatically when you edit `.prs` files:
950
+
951
+ ```
952
+ prs hooks install # Auto-detect and install for all detected tools
953
+ prs hooks install claude # Install for a specific tool
954
+ ```
955
+
956
+ Hooks also protect generated files from direct edits — when an AI agent tries
957
+ to edit a compiled output (e.g., CLAUDE.md), the write is blocked with a message
958
+ pointing to the source `.prs` file. Supported tools: Claude Code, Factory AI,
959
+ Cursor, Windsurf, Cline, GitHub Copilot, Gemini CLI.
960
+
961
+ ## Project Organization
962
+
963
+ Typical modular structure:
964
+
965
+ ```
966
+ .promptscript/
967
+ project.prs # Entry: @meta, @inherit, @use, @identity, @agents
968
+ context.prs # @context (architecture, tech stack)
969
+ standards.prs # @standards (coding conventions)
970
+ restrictions.prs # @restrictions (hard rules)
971
+ commands.prs # @shortcuts and @knowledge
972
+ ```
973
+
974
+ The entry file uses `@use ./context`, `@use ./standards`, etc. to compose them.
975
+
976
+ ## Common Mistakes
977
+
978
+ 1. Missing @meta block - every .prs file needs `@meta` with `id` and `syntax`
979
+ 2. Multiple @inherit - only one per file; use `@use` for additional imports
980
+ 3. Extending an unknown path - target an inherited or local block, or use an imported alias
981
+ 4. Unquoted strings with special chars - quote strings containing `:`, `#`, `{`, `}`
982
+ 5. Forgetting to compile - `.prs` changes need `prs compile` to take effect
983
+ 6. Triple quotes inside triple quotes - not supported; describe content textually instead
984
+ 7. Using `{{var}}` in the root file without `@inherit` - template variables only work
985
+ in a parent file that defines `params` in `@meta`, with values passed by the child
986
+ via `@inherit ./parent(key: value)` or `@use ./fragment(key: value)`. They are NOT
987
+ set from `promptscript.yaml` or CLI flags
988
+
989
+ 8. Using `@examples` with `syntax: "1.0.0"` or `"1.1.0"` - `@examples` requires
990
+ syntax version `1.2.0`. Run `prs validate --fix` to auto-upgrade
991
+
992
+ ## Migrating Existing AI Instructions to PromptScript
993
+
994
+ ### Automated: `prs import`
995
+
996
+ The fastest way to convert existing AI instructions to PromptScript:
997
+
998
+ ```
999
+ prs import CLAUDE.md # Convert a single file
1000
+ prs import .github/copilot-instructions.md
1001
+ prs import AGENTS.md --output ./imported.prs
1002
+ prs import --dry-run CLAUDE.md # Preview without writing
1003
+ ```
1004
+
1005
+ `prs import` automatically:
1006
+
1007
+ - Detects the source format (Claude, GitHub Copilot, Cursor, Factory, etc.)
1008
+ - Maps content to appropriate PromptScript blocks (@identity, @standards, etc.)
1009
+ - Generates a valid `.prs` file with `@meta` block
1010
+ - Preserves the original intent and structure
1011
+
1012
+ Supported source formats:
1013
+
1014
+ - `CLAUDE.md` (Claude Code)
1015
+ - `.github/copilot-instructions.md` (GitHub Copilot)
1016
+ - `.cursorrules` or `.cursor/rules/*.mdc` (Cursor)
1017
+ - `AGENTS.md` (Factory AI / Codex)
1018
+ - `.clinerules` (Cline), `.roorules` (Roo Code)
1019
+ - `.windsurf/rules/*.md` (Windsurf)
1020
+ - Any Markdown-based AI instruction file
1021
+
1022
+ ### Manual Migration
1023
+
1024
+ For complex migrations or when `prs import` needs refinement:
1025
+
1026
+ | Source Pattern | PromptScript Block |
1027
+ | ----------------------------------- | ------------------ |
1028
+ | "You are..." persona text | `@identity` |
1029
+ | Project description, tech stack | `@context` |
1030
+ | Coding conventions, style rules | `@standards` |
1031
+ | "Never...", "Always...", hard rules | `@restrictions` |
1032
+ | `/command` definitions | `@shortcuts` |
1033
+ | Skill/tool definitions | `@skills` |
1034
+ | Agent/subagent configs | `@agents` |
1035
+ | Reference docs, API specs | `@knowledge` |
1036
+
1037
+ After import, split into modular files (`context.prs`, `standards.prs`, etc.)
1038
+ and compose with `@use` in `project.prs`. Run `prs validate --strict` then
1039
+ `prs compile` to verify output matches the original.