CLI Reference¶
Complete reference for the PromptScript command-line interface.
Installation¶
Global Options¶
These options are available for all commands:
| Option | Description |
|---|---|
-h, --help | Display help information |
-V, --version | Display version number |
--verbose | Enable verbose output |
--debug | Enable debug output (includes verbose) |
--quiet | Suppress non-error output |
Commands¶
prs init¶
Initialize PromptScript in the current directory.
Options:
| Option | Description |
|---|---|
-n, --name <name> | Project name (auto-detected from package.json, etc.) |
-t, --team <team> | Team namespace for organization |
--inherit <path> | Inheritance path (e.g., @company/team) |
--registry <path> | Registry path for shared configurations |
--targets <targets...> | Target AI tools (github, claude, cursor, opencode, gemini, ...) |
-i, --interactive | Force interactive mode with prompts |
-y, --yes | Skip prompts, use defaults |
-f, --force | Force reinitialize even if already initialized |
-m, --migrate | Install migration skill for AI-assisted migration |
Examples:
# Interactive initialization (default)
prs init
# Quick initialization with defaults
prs init -y
# Initialize with custom project name
prs init --name my-project
# Initialize for a specific team with inheritance
prs init --team frontend --inherit @frontend/team
# Initialize with specific targets only
prs init --targets github claude
# Initialize with migration skill for existing projects
prs init --migrate
# Full non-interactive setup
prs init -n my-project --inherit @company/team --targets github claude cursor
Auto-detection:
The init command automatically detects:
- Project name from
package.json,pyproject.toml,Cargo.toml, orgo.mod - Languages (TypeScript, Python, Rust, Go, etc.)
- Frameworks (React, Next.js, Django, FastAPI, etc.)
- Existing AI tools (GitHub Copilot, Claude, Cursor configurations)
- Prettier configuration (
.prettierrc,.prettierrc.json,.prettierrc.yaml,.prettierrc.yml)
Prettier Integration:
If a Prettier configuration file is detected:
- Displays:
Prettier config detected: .prettierrc - Adds
formatting: { prettier: true }to enable auto-detection during compilation - Output formatting will respect your project's Prettier settings (tabWidth, proseWrap, printWidth)
If no Prettier configuration is found:
- Displays:
No Prettier config found - Adds default formatting options:
formatting: { tabWidth: 2, proseWrap: preserve }
Created Files:
promptscript.yaml- Configuration file (includes formatting settings).promptscript/project.prs- Main instructions file
prs compile¶
Compile PromptScript to target formats.
Options:
| Option | Description |
|---|---|
-t, --target <target> | Compile to specific target |
-f, --format <format> | Output format (alias for --target) |
-a, --all | Compile to all configured targets |
-w, --watch | Watch mode for continuous compilation |
-o, --output <dir> | Override output directory |
--dry-run | Preview changes without writing |
-c, --config <path> | Path to config file |
--force | Force overwrite existing files without prompts |
--strict | Treat output path conflicts as errors |
--ignore-hashes | Skip reference integrity hash verification |
--verbose | Show detailed compilation progress |
--debug | Show debug information (includes verbose) |
Examples:
# Compile all targets (default)
prs compile
# Compile specific target
prs compile --target github
prs compile --target claude
prs compile --target cursor
# Using --format (alias for --target)
prs compile --format github
prs compile -f claude
# Watch mode
prs compile --watch
# Preview changes
prs compile --dry-run
# Custom config
prs compile --config ./custom.config.yaml
# Verbose output (shows pipeline stages, files, timing)
prs compile --verbose
# Debug output (includes AST details, cache info, validation rules)
prs compile --debug
Automatic compilation with hooks
Instead of running prs compile --watch in a terminal, you can let your AI tool trigger compilation automatically. Run prs hooks install once to wire prs compile into your tool's native hook system — no manual watch process needed. See the Hooks Guide for details.
Available Targets:
| Target | Output File | Description |
|---|---|---|
github | .github/copilot-instructions.md | GitHub Copilot |
claude | CLAUDE.md | Claude Code |
cursor | .cursor/rules/project.mdc | Cursor (modern) |
antigravity | .agent/rules/project.md | Google Antigravity |
opencode | OPENCODE.md | OpenCode |
gemini | GEMINI.md | Gemini CLI |
factory | AGENTS.md | Factory AI |
prs validate¶
Validate PromptScript files.
Options:
| Option | Description |
|---|---|
--strict | Treat warnings as errors |
--format <format> | Output format (text, json) |
--fix | Auto-fix syntax version issues |
--skip-policies | Skip extension compliance policy evaluation |
--ignore-hashes | Skip reference integrity hash verification |
Examples:
# Validate current project
prs validate
# Validate with strict mode
prs validate --strict
# Validate specific files
prs validate .promptscript/project.prs
# JSON output for CI
prs validate --format json
Exit Codes:
| Code | Meaning |
|---|---|
| 0 | Validation passed |
| 1 | Validation errors found |
| 2 | Validation warnings found (with --strict) |
prs inspect¶
Inspect how skill composition layers contribute to the final resolved skill. Shows per-property provenance (default) or per-layer breakdown.
Arguments:
| Argument | Description |
|---|---|
<skill-name> | Name of the skill to inspect |
Options:
| Option | Description |
|---|---|
--layers | Show layer-level breakdown |
--format <format> | Output format (text, json) |
-c, --config <path> | Path to custom config file |
Examples:
# Show per-property provenance (default)
prs inspect code-review
# Show layer-level breakdown
prs inspect code-review --layers
# JSON output for tooling
prs inspect code-review --format json
prs diff¶
Show diff for compiled output.
Options:
| Option | Description |
|---|---|
-t, --target <target> | Show diff for specific target |
-a, --all | Show diff for all targets |
--color | Force colored output |
--no-color | Disable colored output |
Examples:
prs pull¶
Pull updates from registry. Supports local, HTTP, and Git registries.
Options:
| Option | Description |
|---|---|
-f, --force | Force overwrite local changes |
--dry-run | Preview changes without pulling |
-b, --branch <name> | Git branch to pull from (overrides config) |
--tag <name> | Git tag to pull from |
--commit <hash> | Git commit to pull from |
--refresh | Force re-clone, ignore cache |
Examples:
# Pull registry updates
prs pull
# Force overwrite
prs pull --force
# Preview changes
prs pull --dry-run
# Pull from specific Git branch
prs pull --branch develop
# Pull from specific Git tag
prs pull --tag v1.0.0
# Pull from specific commit
prs pull --commit abc123
# Force fresh clone (ignore cache)
prs pull --refresh
Git Registry Options
The --branch, --tag, --commit, and --refresh options only apply to Git registries. For local or HTTP registries, these options are ignored.
prs check¶
Check configuration and dependencies.
Examples:
prs serve¶
Start a local development server that connects the online playground to your local .prs files.
Options:
| Option | Description | Default |
|---|---|---|
-p, --port <port> | Port to listen on | 3000 |
--host <host> | Host to bind to | 127.0.0.1 |
--read-only | Disable file modifications from playground | false |
--cors-origin <origin> | Allowed CORS origin | https://getpromptscript.dev |
Examples:
# Start server with defaults (localhost:3000)
prs serve
# Custom port
prs serve --port 8080
# Expose on all interfaces (e.g. Docker, remote access)
prs serve --host 0.0.0.0
# Read-only mode (safe for shared environments)
prs serve --read-only
How it works:
- Run
prs servein your project directory - The CLI prints a playground URL:
https://getpromptscript.dev/playground/?server=127.0.0.1:3000 - Open the URL - the playground loads your local
.prsfiles - Edit in the playground or your editor - changes sync both ways via WebSocket
- The playground reads your
promptscript.yamland applies your project configuration (enabled targets, formatting settings)
File discovery: The server scans only the source directory (.promptscript/ by default, or the directory from input.entry in your promptscript.yaml) and config files - not the entire repository.
API endpoints (used by the playground):
| Endpoint | Method | Description |
|---|---|---|
/api/health | GET | Health check |
/api/config | GET | Server config and project settings from promptscript.yaml |
/api/files | GET | List .prs and config files |
/api/files/* | GET/PUT/POST/DELETE | Read, update, create, delete files |
/ws | WebSocket | Real-time file change events |
Privacy
All compilation happens locally in your browser - no data is sent to any external server. The prs serve command only serves files to the playground running in your browser.
Security
The server only accepts requests from https://getpromptscript.dev by default (CORS). Use --cors-origin to allow other origins. Use --read-only to prevent file modifications.
prs import¶
Import an existing AI instruction file to PromptScript format.
Options:
| Option | Description | Default |
|---|---|---|
-f, --format <format> | Source format (claude, github, cursor, generic) | Auto-detected |
-o, --output <dir> | Output directory | .promptscript |
--dry-run | Preview output without writing files | |
--validate | Run roundtrip validation after import |
Examples:
# Import a CLAUDE.md file (format auto-detected)
prs import CLAUDE.md
# Import with explicit format
prs import .github/copilot-instructions.md --format github
# Preview without writing
prs import CLAUDE.md --dry-run
# Import and validate roundtrip fidelity
prs import CLAUDE.md --validate
# Import to custom output directory
prs import CLAUDE.md --output ./my-prompts
prs registry¶
Manage PromptScript registries. This command group contains subcommands for creating, validating, and publishing registries.
prs registry init¶
Create a new PromptScript registry.
Options:
| Option | Description |
|---|---|
-n, --name <name> | Registry name |
-d, --description <desc> | Registry description |
--namespaces <ns...> | Namespace names (e.g., @core @stacks) |
-y, --yes | Non-interactive mode with defaults |
-o, --output <dir> | Output directory |
--no-seed | Skip seed configurations |
Examples:
# Interactive registry creation (default)
prs registry init
# Create with defaults (non-interactive)
prs registry init -y
# Create with custom name and namespaces
prs registry init --name my-registry --namespaces @core @stacks @fragments
# Create in a specific directory
prs registry init ./my-registry
# Skip seed configurations
prs registry init --no-seed
prs registry validate¶
Validate registry structure and manifest.
Options:
| Option | Description |
|---|---|
--strict | Treat warnings as errors |
--format <format> | Output format (text, json) |
Examples:
# Validate registry in current directory
prs registry validate
# Validate specific registry path
prs registry validate ./my-registry
# Strict mode (warnings become errors)
prs registry validate --strict
# JSON output for CI
prs registry validate --format json
prs registry publish¶
Publish registry to remote.
Options:
| Option | Description |
|---|---|
--dry-run | Preview what would be published |
-f, --force | Skip validation |
-m, --message <msg> | Git commit message |
--tag <tag> | Git tag for release |
Examples:
# Publish registry in current directory
prs registry publish
# Preview what would be published
prs registry publish --dry-run
# Publish with custom commit message
prs registry publish --message "feat: add new stack configs"
# Publish with a release tag
prs registry publish --tag v1.0.0
# Skip validation before publishing
prs registry publish --force
prs registry list¶
List all configured registry alias mappings, showing the merged result from project, user, and system sources.
Options:
| Option | Description |
|---|---|
--source <source> | Show only aliases from project, user, or system |
--format <format> | Output format (text, json) |
Examples:
# Show all resolved aliases
prs registry list
# Show only project-level aliases
prs registry list --source project
# JSON output
prs registry list --format json
Example output:
Registry aliases (merged: project > user > system)
@company github.com/acme/promptscript-base [project]
@team github.com/acme/team-frontend [project]
@shared github.com/acme/shared-libs [user]
prs registry add¶
Add a registry alias to the project or user config.
Arguments:
| Argument | Description |
|---|---|
<alias> | Alias name, e.g. @company |
<url> | Git host path, e.g. github.com/org/repo |
Options:
| Option | Description |
|---|---|
--global | Add to user config (~/.promptscript/config.yaml) instead of project config |
Examples:
# Add alias to project config
prs registry add @company github.com/acme/promptscript-base
# Add alias to user config (available across all projects)
prs registry add @company github.com/acme/promptscript-base --global
prs lock¶
Generate or update the promptscript.lock lockfile. The lockfile records the exact resolved commit for every remote import, enabling reproducible builds.
Options:
| Option | Description |
|---|---|
--dry-run | Show what would change without writing |
Examples:
The lockfile is also written automatically during prs compile when remote imports are present. Commit promptscript.lock to version control.
prs update¶
Update one or all remote dependencies to their latest allowed versions and refresh the lockfile.
Arguments:
| Argument | Description |
|---|---|
[package] | Specific package to update, e.g. github.com/acme/base. Omit to update all. |
Options:
| Option | Description |
|---|---|
--dry-run | Preview updates without writing |
Examples:
# Update all dependencies
prs update
# Update a specific package
prs update github.com/acme/promptscript-base
# Preview updates
prs update --dry-run
prs skills¶
Manage markdown-imported skills. See the Markdown Imports guide for full details.
prs skills add¶
Add a remote skill to the project. Inserts a @use directive into the entry .prs file and updates promptscript.lock.
Arguments:
| Argument | Description |
|---|---|
<source> | Remote skill path (e.g., github.com/anthropics/skills/commit@1.0.0) |
Options:
| Option | Description |
|---|---|
-f, --file <file> | Target .prs file to modify |
--dry-run | Preview changes without writing |
Examples:
# Add a versioned skill
prs skills add github.com/anthropics/skills/commit@1.0.0
# Add a skill directory (auto-discovers SKILL.md)
prs skills add github.com/repo/skills/gitnexus
# Add to a specific .prs file
prs skills add github.com/anthropics/skills/commit@1.0.0 --file .promptscript/team.prs
# Preview what would change
prs skills add github.com/anthropics/skills/commit@1.0.0 --dry-run
prs skills remove¶
Remove a skill from the project. Removes the matching @use line and its lock entry.
Arguments:
| Argument | Description |
|---|---|
<name> | Skill name or path fragment to match against @use lines |
Options:
| Option | Description |
|---|---|
--dry-run | Preview changes without writing |
Examples:
# Remove by full path
prs skills remove github.com/anthropics/skills/commit@1.0.0
# Remove by partial match
prs skills remove commit
# Preview removal
prs skills remove commit --dry-run
prs skills list¶
List all skills imported in the current project via @use directives.
Examples:
prs skills update¶
Update lock entries for markdown-sourced skills. Resets lock pins so the next prs compile re-resolves to the latest matching versions.
Arguments:
| Argument | Description |
|---|---|
[name] | Specific skill to update (partial match). Omit to update all. |
Options:
| Option | Description |
|---|---|
--dry-run | Preview changes without writing |
Examples:
# Update all markdown-sourced skills
prs skills update
# Update a specific skill
prs skills update github.com/anthropics/skills/commit
# Preview updates
prs skills update --dry-run
prs vendor¶
Manage the vendor directory for offline builds. Vendor mode copies all lockfile-resolved dependencies into .promptscript/vendor/.
prs vendor sync¶
Download all dependencies from the lockfile into the vendor directory.
After syncing, compilation uses the vendored files and makes no network requests.
prs vendor check¶
Verify that the vendor directory matches the current lockfile.
Exits with code 1 if vendor is out of sync. Use in CI before compiling:
prs resolve¶
Debug the resolution chain for an import. Shows how an import path is resolved step-by-step: alias expansion, URL construction, cache lookup, and file path within the repository.
Arguments:
| Argument | Description |
|---|---|
<import> | Import path to resolve, e.g. @company/security or github.com/acme/base/@org/base |
Options:
| Option | Description |
|---|---|
--format <format> | Output format (text, json) |
Examples:
# Resolve an aliased import
prs resolve @company/security
# Resolve a URL import
prs resolve github.com/acme/promptscript-base/@org/base
# JSON output for tooling
prs resolve @company/security --format json
Example output:
Resolving: @company/security
1. Alias lookup: @company -> github.com/acme/promptscript-base [project config]
2. URL construction: https://github.com/acme/promptscript-base.git
3. Cache status: HIT (commit: a3f8c2d, age: 12m)
4. File path: security.prs
5. Resolved to: ~/.promptscript/.cache/git/abc123/security.prs
prs update-check¶
Check for CLI updates.
Examples:
Configuration File¶
The CLI uses promptscript.yaml by default. Override with --config:
# Input settings
input:
entry: .promptscript/project.prs
# Registry configuration
registry:
path: ./registry
# Or remote URL
# url: https://github.com/org/registry
# Output targets
targets:
github:
enabled: true
output: .github/copilot-instructions.md
claude:
enabled: true
output: CLAUDE.md
cursor:
enabled: true
output: .cursor/rules/project.mdc
antigravity:
enabled: true
output: .agent/rules/project.md
# Validation settings
validation:
strict: false
ignoreWarnings: []
# Watch settings
watch:
include:
- '.promptscript/**/*.prs'
exclude:
- '**/node_modules/**'
Environment Variables¶
| Variable | Description |
|---|---|
PROMPTSCRIPT_CONFIG | Path to config file |
PROMPTSCRIPT_REGISTRY | Registry path or URL |
PROMPTSCRIPT_VERBOSE | Enable verbose output (1 or true) |
PROMPTSCRIPT_DEBUG | Enable debug output (1 or true) |
NO_COLOR | Disable colored output |
Exit Codes¶
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Error occurred |
| 2 | Warning (with --strict) |
| 130 | Interrupted (Ctrl+C) |
Troubleshooting¶
Common Issues¶
Config file not found:
Run prs init to create a configuration file.
Registry not accessible:
Ensure the registry path exists or configure a valid remote URL.
Invalid PromptScript syntax:
Check your .prs file syntax. Use prs validate for detailed errors.
Debug Mode¶
Enable verbose output to see compilation progress:
For maximum detail (AST info, cache hits, validation rules), use debug mode:
Verbose output shows:
- Pipeline stages (Resolve, Validate, Format)
- Files being parsed and resolved
- Import and inheritance resolution paths
- Per-stage timing
Debug output additionally shows:
- AST node counts
- Cache hits and stores
- Individual validation rules being executed
- Formatter conventions used