Package Exports
- @promptscript/cli
- @promptscript/cli/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@promptscript/cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@promptscript/cli
Part of the PromptScript ecosystem - The Infrastructure-as-Code for AI Context.
Command-line interface for PromptScript. Compile, validate, and manage AI instructions at enterprise scale.
🏗️ Architecture
The CLI bundles all internal packages into a single distributable:
@promptscript/cli (published)
│
├─► compiler (pipeline orchestration)
│ ├─► resolver
│ ├─► validator ─────► core
│ └─► formatters ────► core
│
└─► resolver (inheritance & import resolution)
├─► parser ────────► core
└───────────────────► coreSee the PromptScript monorepo for development details.
Installation
npm install -g @promptscript/cli
# or
pnpm add -g @promptscript/cliCommands
Initialize Project
prs init [options]
Options:
-n, --name <name> Project name (auto-detected)
-t, --team <team> Team namespace
--inherit <path> Inheritance path (e.g., @company/team)
--registry <path> Registry path
--targets <targets...> Target AI tools (github, claude, cursor)
-i, --interactive Force interactive mode
-y, --yes Skip prompts, use defaults
-f, --force Force reinitialize even if already initializedAuto-detection: Project name, languages, frameworks, and existing AI tool configurations.
Creates:
promptscript.yaml- Configuration file.promptscript/project.prs- Main project file
Compile
prs compile [options]
Options:
-t, --target <target> Specific target (github, claude, cursor)
-a, --all All configured targets (default)
-w, --watch Watch mode for continuous compilation (uses chokidar)
-o, --output <dir> Output directory
--dry-run Preview changes without writing files
--force Force overwrite existing files without prompts
--registry <path> Path or URL to registry
--verbose Show detailed compilation progress
--debug Show debug information (includes verbose)Watch Mode: Uses chokidar for reliable file watching across all platforms. Automatically recompiles when .prs files change.
Overwrite Protection: By default, prs compile protects user-created files from accidental overwriting. Files generated by PromptScript contain a marker (> Auto-generated by PromptScript) and are overwritten silently. For files without this marker:
- Interactive mode: You'll be prompted to overwrite (y/N/a)
- Non-interactive mode: Compilation fails with a list of conflicting files
Use --force to skip all prompts and overwrite everything. Use --dry-run to preview conflicts before writing.
Validate
prs validate [options]
Options:
--strict Treat warnings as errors
--format <format> Output format (text, json)Pull Updates
prs pull [options]
Options:
-f, --force Force overwrite local filesShow Diff
prs diff [options]
Options:
-t, --target <target> Specific target to diff
--full Show full diff without truncation
--no-pager Disable pager outputBy default, diff output is shown through a pager (less) for easy scrolling. Use --no-pager to disable this behavior. You can customize the pager via the PAGER environment variable.
Configuration
Create a promptscript.yaml file:
version: '1'
project:
id: my-project
team: frontend
inherit: '@frontend/team'
registry:
path: './registry'
cache: true # Enable HTTP registry caching
auth: # Authentication for HTTP registry
type: bearer
token: ${REGISTRY_TOKEN} # Environment variable interpolation
input:
entry: '.promptscript/project.prs'
include:
- '.promptscript/**/*.prs'
exclude:
- '**/*.local.prs'
output:
dir: '.' # Output base directory
clean: false # Clean output before compile
targets:
github: '.github/copilot-instructions.md'
claude: 'CLAUDE.md'
cursor: '.cursor/rules/project.mdc'
watch:
debounce: 300 # Debounce time in ms
ignored:
- '**/node_modules/**'
targets:
- github
- claude
- cursor
validation:
requiredGuards:
- '@core/guards/compliance'
rules:
empty-block: warnOutput Examples
Success
✔ Compilation successful
✓ .github/copilot-instructions.md
✓ CLAUDE.md
✓ .cursor/rules/project.mdc
Stats: 234ms (resolve: 45ms, validate: 8ms, format: 181ms)Watch Mode
👀 Watching for changes...
[12:34:56] File changed: .promptscript/project.prs
✔ Compilation successful (156ms)
✓ .github/copilot-instructions.md
✓ CLAUDE.mdError
✖ Compilation failed
✗ @meta.id is required
at .promptscript/project.prs:1:1
suggestion: Add id: "your-id" to @metaLicense
MIT