@promptscript/cli 1.0.0-alpha.0
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/LICENSE +21 -0
- package/README.md +196 -0
- package/bin/prs.js +2 -0
- package/index.js +16492 -0
- package/package.json +39 -0
- package/package.publish.json +32 -0
- package/src/cli.d.ts +7 -0
- package/src/cli.d.ts.map +1 -0
- package/src/commands/check.d.ts +11 -0
- package/src/commands/check.d.ts.map +1 -0
- package/src/commands/compile.d.ts +6 -0
- package/src/commands/compile.d.ts.map +1 -0
- package/src/commands/diff.d.ts +6 -0
- package/src/commands/diff.d.ts.map +1 -0
- package/src/commands/index.d.ts +6 -0
- package/src/commands/index.d.ts.map +1 -0
- package/src/commands/init.d.ts +8 -0
- package/src/commands/init.d.ts.map +1 -0
- package/src/commands/pull.d.ts +8 -0
- package/src/commands/pull.d.ts.map +1 -0
- package/src/commands/validate.d.ts +6 -0
- package/src/commands/validate.d.ts.map +1 -0
- package/src/config/index.d.ts +2 -0
- package/src/config/index.d.ts.map +1 -0
- package/src/config/loader.d.ts +19 -0
- package/src/config/loader.d.ts.map +1 -0
- package/src/index.d.ts +20 -0
- package/src/index.d.ts.map +1 -0
- package/src/output/console.d.ts +108 -0
- package/src/output/console.d.ts.map +1 -0
- package/src/output/index.d.ts +3 -0
- package/src/output/index.d.ts.map +1 -0
- package/src/output/pager.d.ts +37 -0
- package/src/output/pager.d.ts.map +1 -0
- package/src/services.d.ts +25 -0
- package/src/services.d.ts.map +1 -0
- package/src/types.d.ts +83 -0
- package/src/types.d.ts.map +1 -0
- package/src/utils/ai-tools-detector.d.ts +32 -0
- package/src/utils/ai-tools-detector.d.ts.map +1 -0
- package/src/utils/project-detector.d.ts +34 -0
- package/src/utils/project-detector.d.ts.map +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 mrwogu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# @promptscript/cli
|
|
2
|
+
|
|
3
|
+
> Part of the [PromptScript](https://github.com/mrwogu/promptscript) ecosystem - The Infrastructure-as-Code for AI Context.
|
|
4
|
+
|
|
5
|
+
Command-line interface for PromptScript. Compile, validate, and manage AI instructions at enterprise scale.
|
|
6
|
+
|
|
7
|
+
## 🏗️ Architecture
|
|
8
|
+
|
|
9
|
+
The CLI bundles all internal packages into a single distributable:
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
@promptscript/cli (published)
|
|
13
|
+
│
|
|
14
|
+
└─► bundles:
|
|
15
|
+
├─► compiler
|
|
16
|
+
│ ├─► parser
|
|
17
|
+
│ ├─► resolver
|
|
18
|
+
│ ├─► validator
|
|
19
|
+
│ └─► formatters
|
|
20
|
+
└─► core
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
See the [PromptScript monorepo](https://github.com/mrwogu/promptscript) for development details.
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install -g @promptscript/cli
|
|
29
|
+
# or
|
|
30
|
+
pnpm add -g @promptscript/cli
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Commands
|
|
34
|
+
|
|
35
|
+
### Initialize Project
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
prs init [options]
|
|
39
|
+
|
|
40
|
+
Options:
|
|
41
|
+
-n, --name <name> Project name (auto-detected)
|
|
42
|
+
-t, --team <team> Team namespace
|
|
43
|
+
--inherit <path> Inheritance path (e.g., @company/team)
|
|
44
|
+
--registry <path> Registry path
|
|
45
|
+
--targets <targets...> Target AI tools (github, claude, cursor)
|
|
46
|
+
-i, --interactive Force interactive mode
|
|
47
|
+
-y, --yes Skip prompts, use defaults
|
|
48
|
+
-f, --force Force reinitialize even if already initialized
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Auto-detection:** Project name, languages, frameworks, and existing AI tool configurations.
|
|
52
|
+
|
|
53
|
+
Creates:
|
|
54
|
+
|
|
55
|
+
- `promptscript.yaml` - Configuration file
|
|
56
|
+
- `.promptscript/project.prs` - Main project file
|
|
57
|
+
|
|
58
|
+
### Compile
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
prs compile [options]
|
|
62
|
+
|
|
63
|
+
Options:
|
|
64
|
+
-t, --target <target> Specific target (github, claude, cursor)
|
|
65
|
+
-a, --all All configured targets (default)
|
|
66
|
+
-w, --watch Watch mode for continuous compilation (uses chokidar)
|
|
67
|
+
-o, --output <dir> Output directory
|
|
68
|
+
--dry-run Preview changes without writing files
|
|
69
|
+
--registry <path> Path or URL to registry
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Watch Mode:** Uses [chokidar](https://github.com/paulmillr/chokidar) for reliable file watching across all platforms. Automatically recompiles when `.prs` files change.
|
|
73
|
+
|
|
74
|
+
### Validate
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
prs validate [options]
|
|
78
|
+
|
|
79
|
+
Options:
|
|
80
|
+
--strict Treat warnings as errors
|
|
81
|
+
--format <format> Output format (text, json)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Pull Updates
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
prs pull [options]
|
|
88
|
+
|
|
89
|
+
Options:
|
|
90
|
+
-f, --force Force overwrite local files
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Show Diff
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
prs diff [options]
|
|
97
|
+
|
|
98
|
+
Options:
|
|
99
|
+
-t, --target <target> Specific target to diff
|
|
100
|
+
--full Show full diff without truncation
|
|
101
|
+
--no-pager Disable pager output
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
By 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.
|
|
105
|
+
|
|
106
|
+
## Configuration
|
|
107
|
+
|
|
108
|
+
Create a `promptscript.yaml` file:
|
|
109
|
+
|
|
110
|
+
```yaml
|
|
111
|
+
version: '1'
|
|
112
|
+
|
|
113
|
+
project:
|
|
114
|
+
id: my-project
|
|
115
|
+
team: frontend
|
|
116
|
+
|
|
117
|
+
inherit: '@frontend/team'
|
|
118
|
+
|
|
119
|
+
registry:
|
|
120
|
+
path: './registry'
|
|
121
|
+
cache: true # Enable HTTP registry caching
|
|
122
|
+
auth: # Authentication for HTTP registry
|
|
123
|
+
type: bearer
|
|
124
|
+
token: ${REGISTRY_TOKEN} # Environment variable interpolation
|
|
125
|
+
|
|
126
|
+
input:
|
|
127
|
+
entry: '.promptscript/project.prs'
|
|
128
|
+
include:
|
|
129
|
+
- '.promptscript/**/*.prs'
|
|
130
|
+
exclude:
|
|
131
|
+
- '**/*.local.prs'
|
|
132
|
+
|
|
133
|
+
output:
|
|
134
|
+
dir: '.' # Output base directory
|
|
135
|
+
clean: false # Clean output before compile
|
|
136
|
+
targets:
|
|
137
|
+
github: '.github/copilot-instructions.md'
|
|
138
|
+
claude: 'CLAUDE.md'
|
|
139
|
+
cursor: '.cursor/rules/project.mdc'
|
|
140
|
+
|
|
141
|
+
watch:
|
|
142
|
+
debounce: 300 # Debounce time in ms
|
|
143
|
+
ignored:
|
|
144
|
+
- '**/node_modules/**'
|
|
145
|
+
|
|
146
|
+
targets:
|
|
147
|
+
- github
|
|
148
|
+
- claude
|
|
149
|
+
- cursor
|
|
150
|
+
|
|
151
|
+
validation:
|
|
152
|
+
requiredGuards:
|
|
153
|
+
- '@core/guards/compliance'
|
|
154
|
+
rules:
|
|
155
|
+
empty-block: warn
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Output Examples
|
|
159
|
+
|
|
160
|
+
### Success
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
✔ Compilation successful
|
|
164
|
+
|
|
165
|
+
✓ .github/copilot-instructions.md
|
|
166
|
+
✓ CLAUDE.md
|
|
167
|
+
✓ .cursor/rules/project.mdc
|
|
168
|
+
|
|
169
|
+
Stats: 234ms (resolve: 45ms, validate: 8ms, format: 181ms)
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Watch Mode
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
👀 Watching for changes...
|
|
176
|
+
|
|
177
|
+
[12:34:56] File changed: .promptscript/project.prs
|
|
178
|
+
✔ Compilation successful (156ms)
|
|
179
|
+
|
|
180
|
+
✓ .github/copilot-instructions.md
|
|
181
|
+
✓ CLAUDE.md
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Error
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
✖ Compilation failed
|
|
188
|
+
|
|
189
|
+
✗ @meta.id is required
|
|
190
|
+
at .promptscript/project.prs:1:1
|
|
191
|
+
suggestion: Add id: "your-id" to @meta
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## License
|
|
195
|
+
|
|
196
|
+
MIT
|
package/bin/prs.js
ADDED