@promptscript/cli 1.12.0 → 1.12.1
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.
- package/index.js +60 -2
- package/package.json +2 -2
- package/skills/promptscript/SKILL.md +166 -3
package/index.js
CHANGED
|
@@ -15878,7 +15878,7 @@ var init_factory = __esm({
|
|
|
15878
15878
|
outputPath: "AGENTS.md"
|
|
15879
15879
|
}
|
|
15880
15880
|
};
|
|
15881
|
-
FactoryFormatter = class extends MarkdownInstructionFormatter {
|
|
15881
|
+
FactoryFormatter = class _FactoryFormatter extends MarkdownInstructionFormatter {
|
|
15882
15882
|
constructor() {
|
|
15883
15883
|
super({
|
|
15884
15884
|
name: "factory",
|
|
@@ -16022,7 +16022,7 @@ var init_factory = __esm({
|
|
|
16022
16022
|
const skillName = factoryConfig2.name.replace(/\./g, "-");
|
|
16023
16023
|
lines.push("---");
|
|
16024
16024
|
if (factoryConfig2.rawFrontmatter) {
|
|
16025
|
-
lines.push(factoryConfig2.rawFrontmatter);
|
|
16025
|
+
lines.push(...this.filterFactoryFrontmatter(factoryConfig2.rawFrontmatter));
|
|
16026
16026
|
} else {
|
|
16027
16027
|
lines.push(`name: ${skillName}`);
|
|
16028
16028
|
lines.push(`description: ${this.yamlString(factoryConfig2.description)}`);
|
|
@@ -16307,6 +16307,64 @@ ${lines.join("\n")}
|
|
|
16307
16307
|
}
|
|
16308
16308
|
return handoffs;
|
|
16309
16309
|
}
|
|
16310
|
+
// ============================================================
|
|
16311
|
+
// Frontmatter Filtering (Factory-specific)
|
|
16312
|
+
// ============================================================
|
|
16313
|
+
/**
|
|
16314
|
+
* Factory AI supported frontmatter fields for skills.
|
|
16315
|
+
* Fields not in this set are stripped to avoid parsing failures.
|
|
16316
|
+
*
|
|
16317
|
+
* @see https://docs.factory.ai/cli/configuration/skills
|
|
16318
|
+
*/
|
|
16319
|
+
static FACTORY_SKILL_FRONTMATTER_FIELDS = /* @__PURE__ */ new Set([
|
|
16320
|
+
"name",
|
|
16321
|
+
"description",
|
|
16322
|
+
"user-invocable",
|
|
16323
|
+
"disable-model-invocation"
|
|
16324
|
+
]);
|
|
16325
|
+
/**
|
|
16326
|
+
* Filter raw YAML frontmatter to only include fields that Factory AI
|
|
16327
|
+
* recognizes in skill SKILL.md files. Strips unsupported fields like
|
|
16328
|
+
* `license`, `metadata`, `compatibility`, `allowed-tools`, and comments,
|
|
16329
|
+
* which cause Factory to fail to load the skill.
|
|
16330
|
+
*
|
|
16331
|
+
* @param rawFrontmatter - Raw YAML frontmatter string (between --- markers)
|
|
16332
|
+
* @returns Array of filtered frontmatter lines
|
|
16333
|
+
*/
|
|
16334
|
+
filterFactoryFrontmatter(rawFrontmatter) {
|
|
16335
|
+
const lines = rawFrontmatter.split("\n");
|
|
16336
|
+
const filtered = [];
|
|
16337
|
+
let skipBlock = false;
|
|
16338
|
+
let blockIndent = -1;
|
|
16339
|
+
for (const line of lines) {
|
|
16340
|
+
const trimmed = line.trim();
|
|
16341
|
+
if (trimmed.startsWith("#")) continue;
|
|
16342
|
+
if (skipBlock) {
|
|
16343
|
+
if (trimmed === "") {
|
|
16344
|
+
skipBlock = false;
|
|
16345
|
+
blockIndent = -1;
|
|
16346
|
+
continue;
|
|
16347
|
+
}
|
|
16348
|
+
const currentIndent = line.length - line.trimStart().length;
|
|
16349
|
+
if (currentIndent > blockIndent) continue;
|
|
16350
|
+
skipBlock = false;
|
|
16351
|
+
blockIndent = -1;
|
|
16352
|
+
}
|
|
16353
|
+
if (trimmed === "") continue;
|
|
16354
|
+
const keyMatch = trimmed.match(/^([a-zA-Z][a-zA-Z0-9_-]*):/);
|
|
16355
|
+
if (keyMatch) {
|
|
16356
|
+
const key = keyMatch[1];
|
|
16357
|
+
const indent = line.length - line.trimStart().length;
|
|
16358
|
+
if (!_FactoryFormatter.FACTORY_SKILL_FRONTMATTER_FIELDS.has(key)) {
|
|
16359
|
+
skipBlock = true;
|
|
16360
|
+
blockIndent = indent;
|
|
16361
|
+
continue;
|
|
16362
|
+
}
|
|
16363
|
+
}
|
|
16364
|
+
filtered.push(line);
|
|
16365
|
+
}
|
|
16366
|
+
return filtered;
|
|
16367
|
+
}
|
|
16310
16368
|
};
|
|
16311
16369
|
}
|
|
16312
16370
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptscript/cli",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.1",
|
|
4
4
|
"description": "CLI for PromptScript - standardize AI instructions across GitHub Copilot, Claude, Cursor and other AI tools",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"fastify": "^5.8.5",
|
|
51
51
|
"@fastify/cors": "^11.0.0",
|
|
52
52
|
"@fastify/websocket": "^11.0.0",
|
|
53
|
-
"ws": "^8.
|
|
53
|
+
"ws": "^8.21.0",
|
|
54
54
|
"fast-glob": "^3.3.0"
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -65,6 +65,7 @@ A `.prs` file is made of blocks. Order doesn't matter except `@meta` should come
|
|
|
65
65
|
@knowledge { ... } # Reference documentation
|
|
66
66
|
@skills { ... } # Reusable skill definitions
|
|
67
67
|
@agents { ... } # Subagent definitions
|
|
68
|
+
@examples { ... } # Few-shot input/output examples (syntax 1.2.0+)
|
|
68
69
|
@params { ... } # Template parameters
|
|
69
70
|
@guards { ... } # File globs and priorities
|
|
70
71
|
@local { ... } # Private config (not committed)
|
|
@@ -362,6 +363,45 @@ Factory AI droids support additional properties: `model` (any model ID or "inher
|
|
|
362
363
|
`reasoningEffort` ("low", "medium", "high"), and `tools` (category name like "read-only"
|
|
363
364
|
or array of tool IDs).
|
|
364
365
|
|
|
366
|
+
### @examples
|
|
367
|
+
|
|
368
|
+
Structured few-shot examples for AI assistants (requires syntax `1.2.0`):
|
|
369
|
+
|
|
370
|
+
```
|
|
371
|
+
@meta {
|
|
372
|
+
id: "commit-style"
|
|
373
|
+
syntax: "1.2.0"
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
@examples {
|
|
377
|
+
feat-commit: {
|
|
378
|
+
description: "Feature commit with scope"
|
|
379
|
+
input: "Added user authentication with JWT tokens"
|
|
380
|
+
output: "feat(auth): add JWT-based user authentication"
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
Each entry is a named example with `input` and `output` (both required),
|
|
386
|
+
plus optional `description`. Multi-line content uses triple-quoted strings.
|
|
387
|
+
|
|
388
|
+
Examples can also be attached to skills via the `examples` property:
|
|
389
|
+
|
|
390
|
+
```
|
|
391
|
+
@skills {
|
|
392
|
+
commit: {
|
|
393
|
+
description: "Create conventional commits"
|
|
394
|
+
examples: {
|
|
395
|
+
basic: {
|
|
396
|
+
input: "Added dark mode toggle"
|
|
397
|
+
output: "feat(settings): add dark mode toggle"
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
content: (triple-quoted text)
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
```
|
|
404
|
+
|
|
365
405
|
### @knowledge
|
|
366
406
|
|
|
367
407
|
Reference documentation as triple-quoted text. Used for command references,
|
|
@@ -443,6 +483,46 @@ Merge rules:
|
|
|
443
483
|
- Objects: deep merged (target wins on conflicts)
|
|
444
484
|
- Arrays: unique concatenation
|
|
445
485
|
|
|
486
|
+
### Block Filtering
|
|
487
|
+
|
|
488
|
+
Control which blocks are imported using the reserved `only` and `exclude` parameters:
|
|
489
|
+
|
|
490
|
+
```
|
|
491
|
+
@use ./shared-config(only: ["skills", "context"])
|
|
492
|
+
@use ./shared-config(exclude: ["knowledge"])
|
|
493
|
+
@use ./shared-config(exclude: ["knowledge"], mode: "strict")
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
Rules:
|
|
497
|
+
|
|
498
|
+
- `only` and `exclude` are mutually exclusive — using both is a validation error (PS021)
|
|
499
|
+
- Values are block type names: `identity`, `context`, `standards`, `knowledge`, `skills`, `shortcuts`, `agents`, etc.
|
|
500
|
+
- Block filtering does not apply to `@inherit` directives
|
|
501
|
+
|
|
502
|
+
### Markdown Imports
|
|
503
|
+
|
|
504
|
+
Import skills directly from `.md` files (v1.8+). No external tools needed:
|
|
505
|
+
|
|
506
|
+
```
|
|
507
|
+
@use ./skills/frontend-design.md
|
|
508
|
+
@use ./shared/commit.md as commit
|
|
509
|
+
@use github.com/anthropics/skills/commit@1.0.0
|
|
510
|
+
@use github.com/repo/skills/gitnexus # directory → SKILL.md
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
Content detection: PromptScript blocks in `.md` are parsed as a `.prs` fragment;
|
|
514
|
+
YAML frontmatter with `name`/`description` is loaded as a skill definition;
|
|
515
|
+
otherwise content is treated as free-form knowledge.
|
|
516
|
+
|
|
517
|
+
CLI management:
|
|
518
|
+
|
|
519
|
+
```
|
|
520
|
+
prs skills add github.com/anthropics/skills/commit@1.0.0
|
|
521
|
+
prs skills remove commit
|
|
522
|
+
prs skills list
|
|
523
|
+
prs skills update
|
|
524
|
+
```
|
|
525
|
+
|
|
446
526
|
### @extend (modify imported blocks)
|
|
447
527
|
|
|
448
528
|
Requires an aliased @use:
|
|
@@ -651,13 +731,55 @@ registries:
|
|
|
651
731
|
oss:
|
|
652
732
|
url: github.com/prscrpt/community-registry
|
|
653
733
|
ref: v2
|
|
734
|
+
policies:
|
|
735
|
+
- name: adjacent-layers-only
|
|
736
|
+
kind: layer-boundary
|
|
737
|
+
severity: error
|
|
738
|
+
layers: ['@core', '@team', '@project']
|
|
739
|
+
maxDistance: 1
|
|
654
740
|
```
|
|
655
741
|
|
|
656
742
|
### Lockfile: `promptscript.lock`
|
|
657
743
|
|
|
658
744
|
When remote imports are used, `prs compile` automatically generates a lockfile
|
|
659
|
-
recording the exact resolved commit for each dependency.
|
|
660
|
-
|
|
745
|
+
recording the exact resolved commit for each dependency. Integrity hashes
|
|
746
|
+
(SHA-256) are included for registry references to detect tampering or drift.
|
|
747
|
+
This enables reproducible builds across machines and CI. Commit `promptscript.lock`
|
|
748
|
+
to version control.
|
|
749
|
+
|
|
750
|
+
Use `--ignore-hashes` on `prs compile` or `prs validate` to skip integrity
|
|
751
|
+
hash verification when needed.
|
|
752
|
+
|
|
753
|
+
### Policy Engine
|
|
754
|
+
|
|
755
|
+
Define organizational policies in `promptscript.yaml` to validate skill extensions:
|
|
756
|
+
|
|
757
|
+
```yaml
|
|
758
|
+
policies:
|
|
759
|
+
- name: adjacent-layers-only
|
|
760
|
+
kind: layer-boundary
|
|
761
|
+
description: 'Only adjacent layers can extend each other'
|
|
762
|
+
severity: error
|
|
763
|
+
layers: ['@core', '@team', '@project']
|
|
764
|
+
maxDistance: 1
|
|
765
|
+
|
|
766
|
+
- name: protect-content
|
|
767
|
+
kind: property-protection
|
|
768
|
+
description: 'Content override requires explicit approval'
|
|
769
|
+
severity: warning
|
|
770
|
+
properties: ['content', 'description']
|
|
771
|
+
|
|
772
|
+
- name: approved-registries
|
|
773
|
+
kind: registry-allowlist
|
|
774
|
+
description: 'Extensions must come from approved registries'
|
|
775
|
+
severity: error
|
|
776
|
+
allowed: ['@core', '@team']
|
|
777
|
+
```
|
|
778
|
+
|
|
779
|
+
Policy kinds: `layer-boundary` (controls layer distance), `property-protection`
|
|
780
|
+
(prevents overriding specific properties), `registry-allowlist` (restricts extension sources).
|
|
781
|
+
Severity: `error` (fails validation) or `warning` (reported only).
|
|
782
|
+
Skip with `--skip-policies` during development (never in CI).
|
|
661
783
|
|
|
662
784
|
## Syntax Version Validation
|
|
663
785
|
|
|
@@ -669,16 +791,28 @@ The `syntax` field in `@meta` declares the PromptScript language version (semver
|
|
|
669
791
|
| ------- | ----------------------------------------------------------------------------------------------------------------------- |
|
|
670
792
|
| `1.0.0` | Core blocks (identity, context, standards, restrictions, knowledge, shortcuts, commands, guards, params, skills, local) |
|
|
671
793
|
| `1.1.0` | Adds `@agents` (plus internal `@workflows`, `@prompts` - not user-facing) |
|
|
794
|
+
| `1.2.0` | Adds `@examples` (few-shot input/output pairs) |
|
|
795
|
+
|
|
796
|
+
### Block Version Requirements
|
|
797
|
+
|
|
798
|
+
| Block | Minimum Syntax Version |
|
|
799
|
+
| ----------- | ---------------------- |
|
|
800
|
+
| `@agents` | `1.1.0` |
|
|
801
|
+
| `@examples` | `1.2.0` |
|
|
802
|
+
|
|
803
|
+
All other built-in blocks are available from `1.0.0`.
|
|
672
804
|
|
|
673
805
|
### Validation Rules
|
|
674
806
|
|
|
675
807
|
- **PS018 (`syntax-version-compat`)**: warns when blocks used in a file require a higher syntax version than declared. For example, `@agents` with `syntax: "1.0.0"` triggers PS018. Suggestion: run `prs validate --fix`.
|
|
676
808
|
- **PS019 (`unknown-block-name`)**: warns when a block name is not a known PromptScript type, with fuzzy-match suggestions for typos.
|
|
809
|
+
- **PS021 (`use-block-filter`)**: errors when `only` and `exclude` are both specified in `@use` parameters.
|
|
677
810
|
- **PS025 (`valid-skill-references`)**: errors when a `references` entry points to a file with a disallowed extension or a path that cannot be resolved.
|
|
678
811
|
- **PS026 (`safe-reference-content`)**: warns when a referenced file contains potentially sensitive content (e.g., secrets, credentials).
|
|
679
812
|
- **PS027 (`valid-skill-composition`)**: warns about conflicting phase names or excessive phases in composed skills.
|
|
680
813
|
- **PS028 (`valid-append-negation`)**: warns when negation prefix `!` appears in base skill definitions (only effective in `@extend`).
|
|
681
814
|
- **PS029 (`valid-sealed-property`)**: warns when `sealed` contains non-replace-strategy property names.
|
|
815
|
+
- **PS030 (`policy-compliance`)**: validates skill extensions against organizational policies defined in `promptscript.yaml`.
|
|
682
816
|
|
|
683
817
|
### Fixing Syntax Versions
|
|
684
818
|
|
|
@@ -701,11 +835,22 @@ prs migrate --static # Non-interactive static import
|
|
|
701
835
|
prs migrate --llm # Generate AI-assisted migration prompt
|
|
702
836
|
prs compile # Compile to all targets
|
|
703
837
|
prs compile --watch # Watch mode
|
|
838
|
+
prs compile --ignore-hashes # Skip integrity hash verification
|
|
839
|
+
prs build <name> # Compile a named build profile
|
|
704
840
|
prs validate --strict # Validate syntax
|
|
705
841
|
prs validate --fix # Auto-fix syntax version declarations
|
|
842
|
+
prs validate --skip-policies # Skip policy engine evaluation
|
|
706
843
|
prs upgrade # Upgrade all .prs files to latest syntax version
|
|
707
844
|
prs import CLAUDE.md # Import existing AI instructions
|
|
708
845
|
prs import --dry-run # Preview import conversion
|
|
846
|
+
prs inspect <skill> # Show skill composition provenance
|
|
847
|
+
prs inspect <skill> --layers # Show layer-level breakdown
|
|
848
|
+
prs hooks install # Install auto-compilation hooks for AI tools
|
|
849
|
+
prs hooks install claude # Install hooks for a specific tool
|
|
850
|
+
prs skills add <source> # Add a remote skill (@use + lock update)
|
|
851
|
+
prs skills remove <name> # Remove a skill (@use line + lock entry)
|
|
852
|
+
prs skills list # List all imported skills
|
|
853
|
+
prs skills update # Re-resolve markdown-imported skills
|
|
709
854
|
prs pull # Update registry
|
|
710
855
|
prs diff --target claude # Show compilation diff
|
|
711
856
|
prs lock # Generate/update promptscript.lock
|
|
@@ -721,7 +866,7 @@ prs registry add <alias> <url> # Add a registry alias
|
|
|
721
866
|
|
|
722
867
|
## Output Targets
|
|
723
868
|
|
|
724
|
-
38 supported targets. Key examples:
|
|
869
|
+
38+ supported targets. Key examples:
|
|
725
870
|
|
|
726
871
|
| Target | Main File | Skills |
|
|
727
872
|
| ----------- | ------------------------------- | -------------------------------------------------- |
|
|
@@ -748,6 +893,22 @@ For detailed information about each formatter's output paths, supported features
|
|
|
748
893
|
- **Dedicated pages exist for:** Claude Code, GitHub Copilot, Cursor, Antigravity, Factory AI, Gemini CLI, OpenCode
|
|
749
894
|
- **All 37 formatters indexed at:** `docs/reference/formatters/index.md` with output paths, tier, and feature flags
|
|
750
895
|
|
|
896
|
+
### Auto-Compilation Hooks
|
|
897
|
+
|
|
898
|
+
Instead of running `prs compile --watch` manually, install hooks so your AI tool
|
|
899
|
+
triggers compilation automatically when you edit `.prs` files:
|
|
900
|
+
|
|
901
|
+
```
|
|
902
|
+
prs hooks install # Auto-detect and install for all detected tools
|
|
903
|
+
prs hooks install claude # Install for a specific tool
|
|
904
|
+
prs hooks install --all # Install for all supported tools
|
|
905
|
+
```
|
|
906
|
+
|
|
907
|
+
Hooks also protect generated files from direct edits — when an AI agent tries
|
|
908
|
+
to edit a compiled output (e.g., CLAUDE.md), the write is blocked with a message
|
|
909
|
+
pointing to the source `.prs` file. Supported tools: Claude Code, Factory AI,
|
|
910
|
+
Cursor, Windsurf, Cline, GitHub Copilot, Gemini CLI.
|
|
911
|
+
|
|
751
912
|
## Project Organization
|
|
752
913
|
|
|
753
914
|
Typical modular structure:
|
|
@@ -775,6 +936,8 @@ The entry file uses `@use ./context`, `@use ./standards`, etc. to compose them.
|
|
|
775
936
|
in a parent file that defines `params` in `@meta`, with values passed by the child
|
|
776
937
|
via `@inherit ./parent(key: value)` or `@use ./fragment(key: value)`. They are NOT
|
|
777
938
|
set from `promptscript.yaml` or CLI flags
|
|
939
|
+
8. Using `@examples` with `syntax: "1.0.0"` or `"1.1.0"` - `@examples` requires
|
|
940
|
+
syntax version `1.2.0`. Run `prs validate --fix` to auto-upgrade
|
|
778
941
|
|
|
779
942
|
## Migrating Existing AI Instructions to PromptScript
|
|
780
943
|
|