@promptscript/cli 1.0.0-rc.3 → 1.0.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/CHANGELOG.md +7 -0
- package/README.md +109 -175
- package/index.js +101 -104
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.0.0](https://github.com/mrwogu/promptscript/compare/v1.0.0-rc.3...v1.0.0) (2026-03-06)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### chore
|
|
12
|
+
|
|
13
|
+
* prepare release ([d751e4b](https://github.com/mrwogu/promptscript/commit/d751e4bd7bc82d834766980bb0eba71dfd7bf92f))
|
|
14
|
+
|
|
8
15
|
## [1.0.0-rc.3](https://github.com/mrwogu/promptscript/compare/v1.0.0-rc.2...v1.0.0-rc.3) (2026-02-03)
|
|
9
16
|
|
|
10
17
|
|
package/README.md
CHANGED
|
@@ -1,242 +1,176 @@
|
|
|
1
1
|
# @promptscript/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**One source of truth for all your AI coding assistants.**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Write AI instructions once in PromptScript, compile to GitHub Copilot, Claude Code, Cursor, Antigravity, and more.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
[](https://www.npmjs.com/package/@promptscript/cli)
|
|
8
|
+
[](https://github.com/mrwogu/promptscript/actions/workflows/ci.yml)
|
|
9
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
---
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
@promptscript/cli (published)
|
|
13
|
-
│
|
|
14
|
-
├─► compiler (pipeline orchestration)
|
|
15
|
-
│ ├─► resolver
|
|
16
|
-
│ ├─► validator ─────► core
|
|
17
|
-
│ └─► formatters ────► core
|
|
18
|
-
│
|
|
19
|
-
└─► resolver (inheritance & import resolution)
|
|
20
|
-
├─► parser ────────► core
|
|
21
|
-
└───────────────────► core
|
|
22
|
-
```
|
|
13
|
+
## The Problem
|
|
23
14
|
|
|
24
|
-
|
|
15
|
+
Every AI coding tool uses a different config format. As your organization grows, so does the chaos:
|
|
25
16
|
|
|
26
|
-
## Installation
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
npm install -g @promptscript/cli
|
|
30
|
-
# or
|
|
31
|
-
pnpm add -g @promptscript/cli
|
|
32
17
|
```
|
|
18
|
+
50 repos x 4 AI tools = 200 files to maintain
|
|
33
19
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
prs init [options]
|
|
40
|
-
|
|
41
|
-
Options:
|
|
42
|
-
-n, --name <name> Project name (auto-detected)
|
|
43
|
-
-t, --team <team> Team namespace
|
|
44
|
-
--inherit <path> Inheritance path (e.g., @company/team)
|
|
45
|
-
--registry <path> Registry path
|
|
46
|
-
--targets <targets...> Target AI tools (github, claude, cursor)
|
|
47
|
-
-i, --interactive Force interactive mode
|
|
48
|
-
-y, --yes Skip prompts, use defaults
|
|
49
|
-
-f, --force Force reinitialize even if already initialized
|
|
20
|
+
repo-1/CLAUDE.md repo-1/.cursorrules repo-1/.github/copilot-instructions.md
|
|
21
|
+
repo-2/CLAUDE.md repo-2/.cursorrules repo-2/.github/copilot-instructions.md
|
|
22
|
+
...
|
|
23
|
+
repo-50/CLAUDE.md repo-50/.cursorrules repo-50/.github/copilot-instructions.md
|
|
50
24
|
```
|
|
51
25
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
26
|
+
- A security policy update means editing hundreds of files by hand
|
|
27
|
+
- Standards drift across teams and repos
|
|
28
|
+
- Switching AI tools means rewriting everything
|
|
29
|
+
- No audit trail, no validation, no reuse
|
|
55
30
|
|
|
56
|
-
|
|
57
|
-
- `.promptscript/project.prs` - Main project file
|
|
31
|
+
## The Solution
|
|
58
32
|
|
|
59
|
-
|
|
33
|
+
PromptScript lets you **build prompts like code** — with inheritance, composition, parameterization, and compilation to any target format:
|
|
60
34
|
|
|
61
|
-
```
|
|
62
|
-
prs compile
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
-a, --all All configured targets (default)
|
|
67
|
-
-w, --watch Watch mode for continuous compilation (uses chokidar)
|
|
68
|
-
-o, --output <dir> Output directory
|
|
69
|
-
--dry-run Preview changes without writing files
|
|
70
|
-
--force Force overwrite existing files without prompts
|
|
71
|
-
--registry <path> Path or URL to registry
|
|
72
|
-
--verbose Show detailed compilation progress
|
|
73
|
-
--debug Show debug information (includes verbose)
|
|
35
|
+
```
|
|
36
|
+
.promptscript/project.prs --> prs compile --> CLAUDE.md
|
|
37
|
+
--> .github/copilot-instructions.md
|
|
38
|
+
--> .cursor/rules/project.mdc
|
|
39
|
+
--> .agent/rules/project.md
|
|
74
40
|
```
|
|
75
41
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
**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:
|
|
79
|
-
|
|
80
|
-
- **Interactive mode:** You'll be prompted to overwrite (y/N/a)
|
|
81
|
-
- **Non-interactive mode:** Compilation fails with a list of conflicting files
|
|
42
|
+
Update once, propagate everywhere. Version-controlled, validated, vendor-independent.
|
|
82
43
|
|
|
83
|
-
|
|
44
|
+
---
|
|
84
45
|
|
|
85
|
-
|
|
46
|
+
## Quick Start
|
|
86
47
|
|
|
87
48
|
```bash
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
Options:
|
|
91
|
-
--strict Treat warnings as errors
|
|
92
|
-
--format <format> Output format (text, json)
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
### Pull Updates
|
|
49
|
+
# Install
|
|
50
|
+
npm install -g @promptscript/cli
|
|
96
51
|
|
|
97
|
-
|
|
98
|
-
prs
|
|
52
|
+
# Initialize (auto-detects your tech stack)
|
|
53
|
+
prs init
|
|
99
54
|
|
|
100
|
-
|
|
101
|
-
|
|
55
|
+
# Compile to all configured AI tools
|
|
56
|
+
prs compile
|
|
102
57
|
```
|
|
103
58
|
|
|
104
|
-
###
|
|
59
|
+
### Already have CLAUDE.md or .cursorrules?
|
|
105
60
|
|
|
106
61
|
```bash
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
Options:
|
|
110
|
-
-t, --target <target> Specific target to diff
|
|
111
|
-
--full Show full diff without truncation
|
|
112
|
-
--no-pager Disable pager output
|
|
62
|
+
# Auto-detect and migrate existing AI instruction files
|
|
63
|
+
prs init --migrate
|
|
113
64
|
```
|
|
114
65
|
|
|
115
|
-
|
|
66
|
+
---
|
|
116
67
|
|
|
117
|
-
|
|
68
|
+
## Example
|
|
118
69
|
|
|
119
|
-
|
|
120
|
-
prs update-check
|
|
121
|
-
```
|
|
70
|
+
`.promptscript/project.prs`:
|
|
122
71
|
|
|
123
|
-
|
|
72
|
+
```promptscript
|
|
73
|
+
@meta { id: "checkout-service" syntax: "1.0.0" }
|
|
124
74
|
|
|
125
|
-
|
|
126
|
-
@
|
|
127
|
-
|
|
128
|
-
```
|
|
75
|
+
@inherit @company/backend-security
|
|
76
|
+
@use @fragments/testing
|
|
77
|
+
@use @fragments/typescript-strict
|
|
129
78
|
|
|
130
|
-
|
|
79
|
+
@identity {
|
|
80
|
+
"""
|
|
81
|
+
You are an expert Backend Engineer working on the Checkout Service.
|
|
82
|
+
This service handles payments using hexagonal architecture.
|
|
83
|
+
"""
|
|
84
|
+
}
|
|
131
85
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
86
|
+
@shortcuts {
|
|
87
|
+
"/review": "Security-focused code review"
|
|
88
|
+
"/test": "Write unit tests with Vitest"
|
|
89
|
+
}
|
|
135
90
|
```
|
|
136
91
|
|
|
137
|
-
|
|
92
|
+
Run `prs compile` and get correctly formatted output for every AI tool your team uses.
|
|
138
93
|
|
|
139
|
-
|
|
140
|
-
PROMPTSCRIPT_NO_UPDATE_CHECK=1 prs compile
|
|
141
|
-
```
|
|
94
|
+
---
|
|
142
95
|
|
|
143
|
-
##
|
|
96
|
+
## Commands
|
|
144
97
|
|
|
145
|
-
|
|
|
146
|
-
|
|
|
147
|
-
| `
|
|
148
|
-
| `
|
|
149
|
-
| `
|
|
150
|
-
| `
|
|
151
|
-
| `
|
|
98
|
+
| Command | Description |
|
|
99
|
+
| :---------------------- | :------------------------------------------- |
|
|
100
|
+
| `prs init` | Initialize project with auto-detection |
|
|
101
|
+
| `prs compile` | Compile to target AI tool formats |
|
|
102
|
+
| `prs compile -w` | Watch mode — recompile on changes |
|
|
103
|
+
| `prs compile --dry-run` | Preview changes without writing files |
|
|
104
|
+
| `prs validate` | Validate `.prs` files with detailed errors |
|
|
105
|
+
| `prs diff` | Show diff between source and compiled output |
|
|
106
|
+
| `prs pull` | Pull updates from registry |
|
|
107
|
+
| `prs update-check` | Check for newer CLI versions |
|
|
108
|
+
|
|
109
|
+
## Key Features
|
|
110
|
+
|
|
111
|
+
- **Inheritance** — build org-wide, team-level, and project-level configs that cascade like CSS
|
|
112
|
+
- **Composition** — reuse fragments across projects with `@use`
|
|
113
|
+
- **Parameterized templates** — `@inherit @stacks/node(port: 8080, db: "postgres")`
|
|
114
|
+
- **Multi-target compilation** — one source, any number of AI tools
|
|
115
|
+
- **Watch mode** — instant recompilation on file changes
|
|
116
|
+
- **Overwrite protection** — never accidentally clobbers hand-written files
|
|
117
|
+
- **Validation** — catch errors before they reach your AI tools
|
|
118
|
+
- **Registry support** — share configs via Git registries (private or public)
|
|
119
|
+
- **AI-assisted migration** — convert existing `CLAUDE.md`, `.cursorrules`, etc.
|
|
120
|
+
|
|
121
|
+
## Supported Targets
|
|
122
|
+
|
|
123
|
+
| AI Tool | Output |
|
|
124
|
+
| :--------------------- | :------------------------------------------------- |
|
|
125
|
+
| **GitHub Copilot** | `.github/copilot-instructions.md`, agents, prompts |
|
|
126
|
+
| **Claude Code** | `CLAUDE.md`, skills, local memory |
|
|
127
|
+
| **Cursor** | `.cursor/rules/*.mdc` |
|
|
128
|
+
| **Google Antigravity** | `.agent/rules/*.md` |
|
|
152
129
|
|
|
153
130
|
## Configuration
|
|
154
131
|
|
|
155
|
-
|
|
132
|
+
`promptscript.yaml`:
|
|
156
133
|
|
|
157
134
|
```yaml
|
|
158
135
|
version: '1'
|
|
159
136
|
|
|
160
|
-
project:
|
|
161
|
-
id: my-project
|
|
162
|
-
team: frontend
|
|
163
|
-
|
|
164
|
-
inherit: '@frontend/team'
|
|
165
|
-
|
|
166
|
-
registry:
|
|
167
|
-
path: './registry'
|
|
168
|
-
cache: true # Enable HTTP registry caching
|
|
169
|
-
auth: # Authentication for HTTP registry
|
|
170
|
-
type: bearer
|
|
171
|
-
token: ${REGISTRY_TOKEN} # Environment variable interpolation
|
|
172
|
-
|
|
173
137
|
input:
|
|
174
138
|
entry: '.promptscript/project.prs'
|
|
175
|
-
include:
|
|
176
|
-
- '.promptscript/**/*.prs'
|
|
177
|
-
exclude:
|
|
178
|
-
- '**/*.local.prs'
|
|
179
|
-
|
|
180
|
-
output:
|
|
181
|
-
dir: '.' # Output base directory
|
|
182
|
-
clean: false # Clean output before compile
|
|
183
|
-
targets:
|
|
184
|
-
github: '.github/copilot-instructions.md'
|
|
185
|
-
claude: 'CLAUDE.md'
|
|
186
|
-
cursor: '.cursor/rules/project.mdc'
|
|
187
|
-
|
|
188
|
-
watch:
|
|
189
|
-
debounce: 300 # Debounce time in ms
|
|
190
|
-
ignored:
|
|
191
|
-
- '**/node_modules/**'
|
|
192
139
|
|
|
193
140
|
targets:
|
|
194
141
|
- github
|
|
195
142
|
- claude
|
|
196
143
|
- cursor
|
|
197
|
-
|
|
198
|
-
validation:
|
|
199
|
-
requiredGuards:
|
|
200
|
-
- '@core/guards/compliance'
|
|
201
|
-
rules:
|
|
202
|
-
empty-block: warn
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
## Output Examples
|
|
206
|
-
|
|
207
|
-
### Success
|
|
208
|
-
|
|
209
144
|
```
|
|
210
|
-
✔ Compilation successful
|
|
211
145
|
|
|
212
|
-
|
|
213
|
-
✓ CLAUDE.md
|
|
214
|
-
✓ .cursor/rules/project.mdc
|
|
146
|
+
See the [full configuration reference](https://getpromptscript.dev/reference/config/) for registry auth, watch settings, validation rules, and more.
|
|
215
147
|
|
|
216
|
-
|
|
217
|
-
```
|
|
148
|
+
## Environment Variables
|
|
218
149
|
|
|
219
|
-
|
|
150
|
+
| Variable | Description |
|
|
151
|
+
| ------------------------------ | ---------------------------------------------- |
|
|
152
|
+
| `PROMPTSCRIPT_NO_UPDATE_CHECK` | Set to `1` to disable automatic update checks |
|
|
153
|
+
| `PROMPTSCRIPT_VERBOSE` | Set to `1` to enable verbose output |
|
|
154
|
+
| `PROMPTSCRIPT_DEBUG` | Set to `1` to enable debug output |
|
|
155
|
+
| `PAGER` | Custom pager for diff output (default: `less`) |
|
|
156
|
+
| `NO_COLOR` | Set to disable colored output |
|
|
220
157
|
|
|
221
|
-
|
|
222
|
-
👀 Watching for changes...
|
|
158
|
+
## Docker
|
|
223
159
|
|
|
224
|
-
|
|
225
|
-
✔ Compilation successful (156ms)
|
|
160
|
+
No Node.js? Use the Docker image:
|
|
226
161
|
|
|
227
|
-
|
|
228
|
-
|
|
162
|
+
```bash
|
|
163
|
+
docker run --rm -v $(pwd):/workspace ghcr.io/mrwogu/promptscript:latest compile
|
|
164
|
+
docker run --rm -v $(pwd):/workspace ghcr.io/mrwogu/promptscript:latest validate --strict
|
|
229
165
|
```
|
|
230
166
|
|
|
231
|
-
|
|
167
|
+
## Documentation
|
|
232
168
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
suggestion: Add id: "your-id" to @meta
|
|
239
|
-
```
|
|
169
|
+
- [Getting Started](https://getpromptscript.dev/getting-started/) — 5-minute quickstart
|
|
170
|
+
- [Language Reference](https://getpromptscript.dev/reference/syntax/) — full syntax docs
|
|
171
|
+
- [Inheritance Guide](https://getpromptscript.dev/guides/inheritance/) — composition patterns
|
|
172
|
+
- [Migration Guide](https://getpromptscript.dev/guides/migration/) — converting existing files
|
|
173
|
+
- [Enterprise Guide](https://getpromptscript.dev/guides/enterprise/) — scaling across organizations
|
|
240
174
|
|
|
241
175
|
## License
|
|
242
176
|
|
package/index.js
CHANGED
|
@@ -494,9 +494,12 @@ function interpolateText(text, ctx) {
|
|
|
494
494
|
});
|
|
495
495
|
}
|
|
496
496
|
function interpolateValue(value, ctx) {
|
|
497
|
-
if (value === null || typeof value === "
|
|
497
|
+
if (value === null || typeof value === "number" || typeof value === "boolean") {
|
|
498
498
|
return value;
|
|
499
499
|
}
|
|
500
|
+
if (typeof value === "string") {
|
|
501
|
+
return interpolateText(value, ctx);
|
|
502
|
+
}
|
|
500
503
|
if (Array.isArray(value)) {
|
|
501
504
|
return value.map((v) => interpolateValue(v, ctx));
|
|
502
505
|
}
|
|
@@ -8891,7 +8894,7 @@ function uniq(array) {
|
|
|
8891
8894
|
}
|
|
8892
8895
|
var uniq_default = uniq;
|
|
8893
8896
|
|
|
8894
|
-
// node_modules/.pnpm/@chevrotain+utils@11.1.
|
|
8897
|
+
// node_modules/.pnpm/@chevrotain+utils@11.1.2/node_modules/@chevrotain/utils/lib/src/print.js
|
|
8895
8898
|
function PRINT_ERROR(msg) {
|
|
8896
8899
|
if (console && console.error) {
|
|
8897
8900
|
console.error(`Error: ${msg}`);
|
|
@@ -8903,7 +8906,7 @@ function PRINT_WARNING(msg) {
|
|
|
8903
8906
|
}
|
|
8904
8907
|
}
|
|
8905
8908
|
|
|
8906
|
-
// node_modules/.pnpm/@chevrotain+utils@11.1.
|
|
8909
|
+
// node_modules/.pnpm/@chevrotain+utils@11.1.2/node_modules/@chevrotain/utils/lib/src/timer.js
|
|
8907
8910
|
function timer(func) {
|
|
8908
8911
|
const start = (/* @__PURE__ */ new Date()).getTime();
|
|
8909
8912
|
const val = func();
|
|
@@ -8912,7 +8915,7 @@ function timer(func) {
|
|
|
8912
8915
|
return { time: total, value: val };
|
|
8913
8916
|
}
|
|
8914
8917
|
|
|
8915
|
-
// node_modules/.pnpm/@chevrotain+utils@11.1.
|
|
8918
|
+
// node_modules/.pnpm/@chevrotain+utils@11.1.2/node_modules/@chevrotain/utils/lib/src/to-fast-properties.js
|
|
8916
8919
|
function toFastProperties(toBecomeFast) {
|
|
8917
8920
|
function FakeConstructor() {
|
|
8918
8921
|
}
|
|
@@ -8928,7 +8931,7 @@ function toFastProperties(toBecomeFast) {
|
|
|
8928
8931
|
(0, eval)(toBecomeFast);
|
|
8929
8932
|
}
|
|
8930
8933
|
|
|
8931
|
-
// node_modules/.pnpm/@chevrotain+gast@11.1.
|
|
8934
|
+
// node_modules/.pnpm/@chevrotain+gast@11.1.2/node_modules/@chevrotain/gast/lib/src/model.js
|
|
8932
8935
|
function tokenLabel(tokType) {
|
|
8933
8936
|
if (hasTokenLabel(tokType)) {
|
|
8934
8937
|
return tokType.LABEL;
|
|
@@ -9134,7 +9137,7 @@ function serializeProduction(node) {
|
|
|
9134
9137
|
}
|
|
9135
9138
|
}
|
|
9136
9139
|
|
|
9137
|
-
// node_modules/.pnpm/@chevrotain+gast@11.1.
|
|
9140
|
+
// node_modules/.pnpm/@chevrotain+gast@11.1.2/node_modules/@chevrotain/gast/lib/src/visitor.js
|
|
9138
9141
|
var GAstVisitor = class {
|
|
9139
9142
|
visit(node) {
|
|
9140
9143
|
const nodeAny = node;
|
|
@@ -9196,7 +9199,7 @@ var GAstVisitor = class {
|
|
|
9196
9199
|
}
|
|
9197
9200
|
};
|
|
9198
9201
|
|
|
9199
|
-
// node_modules/.pnpm/@chevrotain+gast@11.1.
|
|
9202
|
+
// node_modules/.pnpm/@chevrotain+gast@11.1.2/node_modules/@chevrotain/gast/lib/src/helpers.js
|
|
9200
9203
|
function isSequenceProd(prod) {
|
|
9201
9204
|
return prod instanceof Alternative || prod instanceof Option || prod instanceof Repetition || prod instanceof RepetitionMandatory || prod instanceof RepetitionMandatoryWithSeparator || prod instanceof RepetitionWithSeparator || prod instanceof Terminal || prod instanceof Rule;
|
|
9202
9205
|
}
|
|
@@ -9247,7 +9250,7 @@ function getProductionDslName(prod) {
|
|
|
9247
9250
|
}
|
|
9248
9251
|
}
|
|
9249
9252
|
|
|
9250
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
9253
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/parse/grammar/rest.js
|
|
9251
9254
|
var RestWalker = class {
|
|
9252
9255
|
walk(prod, prevRest = []) {
|
|
9253
9256
|
forEach_default(prod.definition, (subProd, index) => {
|
|
@@ -9327,7 +9330,7 @@ function restForRepetitionWithSeparator(repSepProd, currRest, prevRest) {
|
|
|
9327
9330
|
return fullRepSepRest;
|
|
9328
9331
|
}
|
|
9329
9332
|
|
|
9330
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
9333
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/parse/grammar/first.js
|
|
9331
9334
|
function first(prod) {
|
|
9332
9335
|
if (prod instanceof NonTerminal) {
|
|
9333
9336
|
return first(prod.referencedRule);
|
|
@@ -9367,10 +9370,10 @@ function firstForTerminal(terminal) {
|
|
|
9367
9370
|
return [terminal.terminalType];
|
|
9368
9371
|
}
|
|
9369
9372
|
|
|
9370
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
9373
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/parse/constants.js
|
|
9371
9374
|
var IN = "_~IN~_";
|
|
9372
9375
|
|
|
9373
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
9376
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/parse/grammar/follow.js
|
|
9374
9377
|
var ResyncFollowsWalker = class extends RestWalker {
|
|
9375
9378
|
constructor(topProd) {
|
|
9376
9379
|
super();
|
|
@@ -9403,7 +9406,7 @@ function buildBetweenProdsFollowPrefix(inner, occurenceInParent) {
|
|
|
9403
9406
|
return inner.name + occurenceInParent + IN;
|
|
9404
9407
|
}
|
|
9405
9408
|
|
|
9406
|
-
// node_modules/.pnpm/@chevrotain+regexp-to-ast@11.1.
|
|
9409
|
+
// node_modules/.pnpm/@chevrotain+regexp-to-ast@11.1.2/node_modules/@chevrotain/regexp-to-ast/lib/src/utils.js
|
|
9407
9410
|
function cc(char) {
|
|
9408
9411
|
return char.charCodeAt(0);
|
|
9409
9412
|
}
|
|
@@ -9436,7 +9439,7 @@ function isCharacter(obj) {
|
|
|
9436
9439
|
return obj["type"] === "Character";
|
|
9437
9440
|
}
|
|
9438
9441
|
|
|
9439
|
-
// node_modules/.pnpm/@chevrotain+regexp-to-ast@11.1.
|
|
9442
|
+
// node_modules/.pnpm/@chevrotain+regexp-to-ast@11.1.2/node_modules/@chevrotain/regexp-to-ast/lib/src/character-classes.js
|
|
9440
9443
|
var digitsCharCodes = [];
|
|
9441
9444
|
for (let i = cc("0"); i <= cc("9"); i++) {
|
|
9442
9445
|
digitsCharCodes.push(i);
|
|
@@ -9477,7 +9480,7 @@ var whitespaceCodes = [
|
|
|
9477
9480
|
cc("\uFEFF")
|
|
9478
9481
|
];
|
|
9479
9482
|
|
|
9480
|
-
// node_modules/.pnpm/@chevrotain+regexp-to-ast@11.1.
|
|
9483
|
+
// node_modules/.pnpm/@chevrotain+regexp-to-ast@11.1.2/node_modules/@chevrotain/regexp-to-ast/lib/src/regexp-parser.js
|
|
9481
9484
|
var hexDigitPattern = /[0-9a-fA-F]/;
|
|
9482
9485
|
var decimalPattern = /[0-9]/;
|
|
9483
9486
|
var decimalPatternNoZero = /[1-9]/;
|
|
@@ -10180,7 +10183,7 @@ var RegExpParser = class {
|
|
|
10180
10183
|
}
|
|
10181
10184
|
};
|
|
10182
10185
|
|
|
10183
|
-
// node_modules/.pnpm/@chevrotain+regexp-to-ast@11.1.
|
|
10186
|
+
// node_modules/.pnpm/@chevrotain+regexp-to-ast@11.1.2/node_modules/@chevrotain/regexp-to-ast/lib/src/base-regexp-visitor.js
|
|
10184
10187
|
var BaseRegExpVisitor = class {
|
|
10185
10188
|
visitChildren(node) {
|
|
10186
10189
|
for (const key in node) {
|
|
@@ -10290,7 +10293,7 @@ var BaseRegExpVisitor = class {
|
|
|
10290
10293
|
}
|
|
10291
10294
|
};
|
|
10292
10295
|
|
|
10293
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
10296
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/scan/reg_exp_parser.js
|
|
10294
10297
|
var regExpAstCache = {};
|
|
10295
10298
|
var regExpParser = new RegExpParser();
|
|
10296
10299
|
function getRegExpAst(regExp) {
|
|
@@ -10307,7 +10310,7 @@ function clearRegExpParserCache() {
|
|
|
10307
10310
|
regExpAstCache = {};
|
|
10308
10311
|
}
|
|
10309
10312
|
|
|
10310
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
10313
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/scan/reg_exp.js
|
|
10311
10314
|
var complementErrorMessage = "Complement Sets are not supported for first char optimization";
|
|
10312
10315
|
var failedOptimizationPrefixMsg = 'Unable to use "first char" lexer optimizations:\n';
|
|
10313
10316
|
function getOptimizedStartCodesIndices(regExp, ensureOptimizations = false) {
|
|
@@ -10519,14 +10522,12 @@ function canMatchCharCode(charCodes, pattern) {
|
|
|
10519
10522
|
}
|
|
10520
10523
|
}
|
|
10521
10524
|
|
|
10522
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
10525
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/scan/lexer.js
|
|
10523
10526
|
var PATTERN = "PATTERN";
|
|
10524
10527
|
var DEFAULT_MODE = "defaultMode";
|
|
10525
10528
|
var MODES = "modes";
|
|
10526
|
-
var SUPPORT_STICKY = typeof new RegExp("(?:)").sticky === "boolean";
|
|
10527
10529
|
function analyzeTokenTypes(tokenTypes, options) {
|
|
10528
10530
|
options = defaults_default(options, {
|
|
10529
|
-
useSticky: SUPPORT_STICKY,
|
|
10530
10531
|
debug: false,
|
|
10531
10532
|
safeMode: false,
|
|
10532
10533
|
positionTracking: "full",
|
|
@@ -10575,7 +10576,7 @@ function analyzeTokenTypes(tokenTypes, options) {
|
|
|
10575
10576
|
], regExpSource[1])) {
|
|
10576
10577
|
return regExpSource[1];
|
|
10577
10578
|
} else {
|
|
10578
|
-
return
|
|
10579
|
+
return addStickyFlag(currPattern);
|
|
10579
10580
|
}
|
|
10580
10581
|
} else if (isFunction_default(currPattern)) {
|
|
10581
10582
|
hasCustom = true;
|
|
@@ -10589,7 +10590,7 @@ function analyzeTokenTypes(tokenTypes, options) {
|
|
|
10589
10590
|
} else {
|
|
10590
10591
|
const escapedRegExpString = currPattern.replace(/[\\^$.*+?()[\]{}|]/g, "\\$&");
|
|
10591
10592
|
const wrappedRegExp = new RegExp(escapedRegExpString);
|
|
10592
|
-
return
|
|
10593
|
+
return addStickyFlag(wrappedRegExp);
|
|
10593
10594
|
}
|
|
10594
10595
|
} else {
|
|
10595
10596
|
throw Error("non exhaustive match");
|
|
@@ -10995,10 +10996,6 @@ function noMetaChar(regExp) {
|
|
|
10995
10996
|
function usesLookAheadOrBehind(regExp) {
|
|
10996
10997
|
return /(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(regExp.source);
|
|
10997
10998
|
}
|
|
10998
|
-
function addStartOfInput(pattern) {
|
|
10999
|
-
const flags = pattern.ignoreCase ? "i" : "";
|
|
11000
|
-
return new RegExp(`^(?:${pattern.source})`, flags);
|
|
11001
|
-
}
|
|
11002
10999
|
function addStickyFlag(pattern) {
|
|
11003
11000
|
const flags = pattern.ignoreCase ? "iy" : "y";
|
|
11004
11001
|
return new RegExp(`${pattern.source}`, flags);
|
|
@@ -11212,7 +11209,7 @@ function initCharCodeToOptimizedIndexMap() {
|
|
|
11212
11209
|
}
|
|
11213
11210
|
}
|
|
11214
11211
|
|
|
11215
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
11212
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/scan/tokens.js
|
|
11216
11213
|
function tokenStructuredMatcher(tokInstance, tokConstructor) {
|
|
11217
11214
|
const instanceType = tokInstance.tokenTypeIdx;
|
|
11218
11215
|
if (instanceType === tokConstructor.tokenTypeIdx) {
|
|
@@ -11311,7 +11308,7 @@ function isTokenType(tokType) {
|
|
|
11311
11308
|
return has_default(tokType, "tokenTypeIdx");
|
|
11312
11309
|
}
|
|
11313
11310
|
|
|
11314
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
11311
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/scan/lexer_errors_public.js
|
|
11315
11312
|
var defaultLexerErrorProvider = {
|
|
11316
11313
|
buildUnableToPopLexerModeMessage(token) {
|
|
11317
11314
|
return `Unable to pop Lexer Mode after encountering Token ->${token.image}<- The Mode Stack is empty`;
|
|
@@ -11321,7 +11318,7 @@ var defaultLexerErrorProvider = {
|
|
|
11321
11318
|
}
|
|
11322
11319
|
};
|
|
11323
11320
|
|
|
11324
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
11321
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/scan/lexer_public.js
|
|
11325
11322
|
var LexerDefinitionErrorType;
|
|
11326
11323
|
(function(LexerDefinitionErrorType2) {
|
|
11327
11324
|
LexerDefinitionErrorType2[LexerDefinitionErrorType2["MISSING_PATTERN"] = 0] = "MISSING_PATTERN";
|
|
@@ -11479,13 +11476,6 @@ var Lexer = class {
|
|
|
11479
11476
|
PRINT_WARNING(warningDescriptor.message);
|
|
11480
11477
|
});
|
|
11481
11478
|
this.TRACE_INIT("Choosing sub-methods implementations", () => {
|
|
11482
|
-
if (SUPPORT_STICKY) {
|
|
11483
|
-
this.chopInput = identity_default;
|
|
11484
|
-
this.match = this.matchWithTest;
|
|
11485
|
-
} else {
|
|
11486
|
-
this.updateLastIndex = noop_default;
|
|
11487
|
-
this.match = this.matchWithExec;
|
|
11488
|
-
}
|
|
11489
11479
|
if (hasOnlySingleMode) {
|
|
11490
11480
|
this.handleModes = noop_default;
|
|
11491
11481
|
}
|
|
@@ -11548,7 +11538,7 @@ var Lexer = class {
|
|
|
11548
11538
|
// this method also used quite a bit of `!` none null assertions because it is too optimized
|
|
11549
11539
|
// for `tsc` to always understand it is "safe"
|
|
11550
11540
|
tokenizeInternal(text, initialMode) {
|
|
11551
|
-
let i, j, k, matchAltImage, longerAlt, matchedImage, payload, altPayload, imageLength, group, tokType, newToken, errLength,
|
|
11541
|
+
let i, j, k, matchAltImage, longerAlt, matchedImage, payload, altPayload, imageLength, group, tokType, newToken, errLength, msg, match;
|
|
11552
11542
|
const orgText = text;
|
|
11553
11543
|
const orgLength = orgText.length;
|
|
11554
11544
|
let offset = 0;
|
|
@@ -11567,19 +11557,7 @@ var Lexer = class {
|
|
|
11567
11557
|
const modeStack = [];
|
|
11568
11558
|
const emptyArray = [];
|
|
11569
11559
|
Object.freeze(emptyArray);
|
|
11570
|
-
let
|
|
11571
|
-
function getPossiblePatternsSlow() {
|
|
11572
|
-
return patternIdxToConfig;
|
|
11573
|
-
}
|
|
11574
|
-
function getPossiblePatternsOptimized(charCode) {
|
|
11575
|
-
const optimizedCharIdx = charCodeToOptimizedIndex(charCode);
|
|
11576
|
-
const possiblePatterns = currCharCodeToPatternIdxToConfig[optimizedCharIdx];
|
|
11577
|
-
if (possiblePatterns === void 0) {
|
|
11578
|
-
return emptyArray;
|
|
11579
|
-
} else {
|
|
11580
|
-
return possiblePatterns;
|
|
11581
|
-
}
|
|
11582
|
-
}
|
|
11560
|
+
let isOptimizedMode = false;
|
|
11583
11561
|
const pop_mode = (popToken) => {
|
|
11584
11562
|
if (modeStack.length === 1 && // if we have both a POP_MODE and a PUSH_MODE this is in-fact a "transition"
|
|
11585
11563
|
// So no error should occur.
|
|
@@ -11600,9 +11578,9 @@ var Lexer = class {
|
|
|
11600
11578
|
currModePatternsLength = patternIdxToConfig.length;
|
|
11601
11579
|
const modeCanBeOptimized = this.canModeBeOptimized[newMode] && this.config.safeMode === false;
|
|
11602
11580
|
if (currCharCodeToPatternIdxToConfig && modeCanBeOptimized) {
|
|
11603
|
-
|
|
11581
|
+
isOptimizedMode = true;
|
|
11604
11582
|
} else {
|
|
11605
|
-
|
|
11583
|
+
isOptimizedMode = false;
|
|
11606
11584
|
}
|
|
11607
11585
|
}
|
|
11608
11586
|
};
|
|
@@ -11614,9 +11592,9 @@ var Lexer = class {
|
|
|
11614
11592
|
currModePatternsLength = patternIdxToConfig.length;
|
|
11615
11593
|
const modeCanBeOptimized = this.canModeBeOptimized[newMode] && this.config.safeMode === false;
|
|
11616
11594
|
if (currCharCodeToPatternIdxToConfig && modeCanBeOptimized) {
|
|
11617
|
-
|
|
11595
|
+
isOptimizedMode = true;
|
|
11618
11596
|
} else {
|
|
11619
|
-
|
|
11597
|
+
isOptimizedMode = false;
|
|
11620
11598
|
}
|
|
11621
11599
|
}
|
|
11622
11600
|
push_mode.call(this, initialMode);
|
|
@@ -11624,8 +11602,16 @@ var Lexer = class {
|
|
|
11624
11602
|
const recoveryEnabled = this.config.recoveryEnabled;
|
|
11625
11603
|
while (offset < orgLength) {
|
|
11626
11604
|
matchedImage = null;
|
|
11605
|
+
imageLength = -1;
|
|
11627
11606
|
const nextCharCode = orgText.charCodeAt(offset);
|
|
11628
|
-
|
|
11607
|
+
let chosenPatternIdxToConfig;
|
|
11608
|
+
if (isOptimizedMode) {
|
|
11609
|
+
const optimizedCharIdx = charCodeToOptimizedIndex(nextCharCode);
|
|
11610
|
+
const possiblePatterns = currCharCodeToPatternIdxToConfig[optimizedCharIdx];
|
|
11611
|
+
chosenPatternIdxToConfig = possiblePatterns !== void 0 ? possiblePatterns : emptyArray;
|
|
11612
|
+
} else {
|
|
11613
|
+
chosenPatternIdxToConfig = patternIdxToConfig;
|
|
11614
|
+
}
|
|
11629
11615
|
const chosenPatternsLength = chosenPatternIdxToConfig.length;
|
|
11630
11616
|
for (i = 0; i < chosenPatternsLength; i++) {
|
|
11631
11617
|
currConfig = chosenPatternIdxToConfig[i];
|
|
@@ -11634,12 +11620,14 @@ var Lexer = class {
|
|
|
11634
11620
|
const singleCharCode = currConfig.short;
|
|
11635
11621
|
if (singleCharCode !== false) {
|
|
11636
11622
|
if (nextCharCode === singleCharCode) {
|
|
11623
|
+
imageLength = 1;
|
|
11637
11624
|
matchedImage = currPattern;
|
|
11638
11625
|
}
|
|
11639
11626
|
} else if (currConfig.isCustom === true) {
|
|
11640
11627
|
match = currPattern.exec(orgText, offset, matchedTokens, groups);
|
|
11641
11628
|
if (match !== null) {
|
|
11642
11629
|
matchedImage = match[0];
|
|
11630
|
+
imageLength = matchedImage.length;
|
|
11643
11631
|
if (match.payload !== void 0) {
|
|
11644
11632
|
payload = match.payload;
|
|
11645
11633
|
}
|
|
@@ -11647,12 +11635,13 @@ var Lexer = class {
|
|
|
11647
11635
|
matchedImage = null;
|
|
11648
11636
|
}
|
|
11649
11637
|
} else {
|
|
11650
|
-
|
|
11651
|
-
|
|
11638
|
+
currPattern.lastIndex = offset;
|
|
11639
|
+
imageLength = this.matchLength(currPattern, text, offset);
|
|
11652
11640
|
}
|
|
11653
|
-
if (
|
|
11641
|
+
if (imageLength !== -1) {
|
|
11654
11642
|
longerAlt = currConfig.longerAlt;
|
|
11655
11643
|
if (longerAlt !== void 0) {
|
|
11644
|
+
matchedImage = text.substring(offset, offset + imageLength);
|
|
11656
11645
|
const longerAltLength = longerAlt.length;
|
|
11657
11646
|
for (k = 0; k < longerAltLength; k++) {
|
|
11658
11647
|
const longerAltConfig = patternIdxToConfig[longerAlt[k]];
|
|
@@ -11669,11 +11658,12 @@ var Lexer = class {
|
|
|
11669
11658
|
matchAltImage = null;
|
|
11670
11659
|
}
|
|
11671
11660
|
} else {
|
|
11672
|
-
|
|
11661
|
+
longerAltPattern.lastIndex = offset;
|
|
11673
11662
|
matchAltImage = this.match(longerAltPattern, text, offset);
|
|
11674
11663
|
}
|
|
11675
11664
|
if (matchAltImage && matchAltImage.length > matchedImage.length) {
|
|
11676
11665
|
matchedImage = matchAltImage;
|
|
11666
|
+
imageLength = matchAltImage.length;
|
|
11677
11667
|
payload = altPayload;
|
|
11678
11668
|
currConfig = longerAltConfig;
|
|
11679
11669
|
break;
|
|
@@ -11683,10 +11673,10 @@ var Lexer = class {
|
|
|
11683
11673
|
break;
|
|
11684
11674
|
}
|
|
11685
11675
|
}
|
|
11686
|
-
if (
|
|
11687
|
-
imageLength = matchedImage.length;
|
|
11676
|
+
if (imageLength !== -1) {
|
|
11688
11677
|
group = currConfig.group;
|
|
11689
11678
|
if (group !== void 0) {
|
|
11679
|
+
matchedImage = matchedImage !== null ? matchedImage : text.substring(offset, offset + imageLength);
|
|
11690
11680
|
tokType = currConfig.tokenTypeIdx;
|
|
11691
11681
|
newToken = this.createTokenInstance(matchedImage, offset, tokType, currConfig.tokenType, line, column, imageLength);
|
|
11692
11682
|
this.handlePayload(newToken, payload);
|
|
@@ -11696,15 +11686,13 @@ var Lexer = class {
|
|
|
11696
11686
|
groups[group].push(newToken);
|
|
11697
11687
|
}
|
|
11698
11688
|
}
|
|
11699
|
-
text = this.chopInput(text, imageLength);
|
|
11700
|
-
offset = offset + imageLength;
|
|
11701
|
-
column = this.computeNewColumn(column, imageLength);
|
|
11702
11689
|
if (trackLines === true && currConfig.canLineTerminator === true) {
|
|
11703
11690
|
let numOfLTsInMatch = 0;
|
|
11704
11691
|
let foundTerminator;
|
|
11705
11692
|
let lastLTEndOffset;
|
|
11706
11693
|
lineTerminatorPattern.lastIndex = 0;
|
|
11707
11694
|
do {
|
|
11695
|
+
matchedImage = matchedImage !== null ? matchedImage : text.substring(offset, offset + imageLength);
|
|
11708
11696
|
foundTerminator = lineTerminatorPattern.test(matchedImage);
|
|
11709
11697
|
if (foundTerminator === true) {
|
|
11710
11698
|
lastLTEndOffset = lineTerminatorPattern.lastIndex - 1;
|
|
@@ -11715,8 +11703,13 @@ var Lexer = class {
|
|
|
11715
11703
|
line = line + numOfLTsInMatch;
|
|
11716
11704
|
column = imageLength - lastLTEndOffset;
|
|
11717
11705
|
this.updateTokenEndLineColumnLocation(newToken, group, lastLTEndOffset, numOfLTsInMatch, line, column, imageLength);
|
|
11706
|
+
} else {
|
|
11707
|
+
column = this.computeNewColumn(column, imageLength);
|
|
11718
11708
|
}
|
|
11709
|
+
} else {
|
|
11710
|
+
column = this.computeNewColumn(column, imageLength);
|
|
11719
11711
|
}
|
|
11712
|
+
offset = offset + imageLength;
|
|
11720
11713
|
this.handleModes(currConfig, pop_mode, push_mode, newToken);
|
|
11721
11714
|
} else {
|
|
11722
11715
|
const errorStartOffset = offset;
|
|
@@ -11724,7 +11717,6 @@ var Lexer = class {
|
|
|
11724
11717
|
const errorColumn = column;
|
|
11725
11718
|
let foundResyncPoint = recoveryEnabled === false;
|
|
11726
11719
|
while (foundResyncPoint === false && offset < orgLength) {
|
|
11727
|
-
text = this.chopInput(text, 1);
|
|
11728
11720
|
offset++;
|
|
11729
11721
|
for (j = 0; j < currModePatternsLength; j++) {
|
|
11730
11722
|
const currConfig2 = patternIdxToConfig[j];
|
|
@@ -11737,7 +11729,7 @@ var Lexer = class {
|
|
|
11737
11729
|
} else if (currConfig2.isCustom === true) {
|
|
11738
11730
|
foundResyncPoint = currPattern.exec(orgText, offset, matchedTokens, groups) !== null;
|
|
11739
11731
|
} else {
|
|
11740
|
-
|
|
11732
|
+
currPattern.lastIndex = offset;
|
|
11741
11733
|
foundResyncPoint = currPattern.exec(text) !== null;
|
|
11742
11734
|
}
|
|
11743
11735
|
if (foundResyncPoint === true) {
|
|
@@ -11780,12 +11772,6 @@ var Lexer = class {
|
|
|
11780
11772
|
push_mode.call(this, config.push);
|
|
11781
11773
|
}
|
|
11782
11774
|
}
|
|
11783
|
-
chopInput(text, length) {
|
|
11784
|
-
return text.substring(length);
|
|
11785
|
-
}
|
|
11786
|
-
updateLastIndex(regExp, newLastIndex) {
|
|
11787
|
-
regExp.lastIndex = newLastIndex;
|
|
11788
|
-
}
|
|
11789
11775
|
// TODO: decrease this under 600 characters? inspect stripping comments option in TSC compiler
|
|
11790
11776
|
updateTokenEndLineColumnLocation(newToken, group, lastLTIdx, numOfLTsInMatch, line, column, imageLength) {
|
|
11791
11777
|
let lastCharIsLT, fixForEndingInLT;
|
|
@@ -11848,22 +11834,25 @@ var Lexer = class {
|
|
|
11848
11834
|
token.payload = payload;
|
|
11849
11835
|
}
|
|
11850
11836
|
}
|
|
11851
|
-
|
|
11837
|
+
match(pattern, text, offset) {
|
|
11852
11838
|
const found = pattern.test(text);
|
|
11853
11839
|
if (found === true) {
|
|
11854
11840
|
return text.substring(offset, pattern.lastIndex);
|
|
11855
11841
|
}
|
|
11856
11842
|
return null;
|
|
11857
11843
|
}
|
|
11858
|
-
|
|
11859
|
-
const
|
|
11860
|
-
|
|
11844
|
+
matchLength(pattern, text, offset) {
|
|
11845
|
+
const found = pattern.test(text);
|
|
11846
|
+
if (found === true) {
|
|
11847
|
+
return pattern.lastIndex - offset;
|
|
11848
|
+
}
|
|
11849
|
+
return -1;
|
|
11861
11850
|
}
|
|
11862
11851
|
};
|
|
11863
11852
|
Lexer.SKIPPED = "This marks a skipped Token pattern, this means each token identified by it will be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.";
|
|
11864
11853
|
Lexer.NA = /NOT_APPLICABLE/;
|
|
11865
11854
|
|
|
11866
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
11855
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/scan/tokens_public.js
|
|
11867
11856
|
function tokenLabel2(tokType) {
|
|
11868
11857
|
if (hasTokenLabel2(tokType)) {
|
|
11869
11858
|
return tokType.LABEL;
|
|
@@ -11942,7 +11931,7 @@ function tokenMatcher(token, tokType) {
|
|
|
11942
11931
|
return tokenStructuredMatcher(token, tokType);
|
|
11943
11932
|
}
|
|
11944
11933
|
|
|
11945
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
11934
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/parse/errors_public.js
|
|
11946
11935
|
var defaultParserErrorProvider = {
|
|
11947
11936
|
buildMismatchTokenMessage({ expected, actual, previous, ruleName }) {
|
|
11948
11937
|
const hasLabel = hasTokenLabel2(expected);
|
|
@@ -12033,12 +12022,20 @@ For Further details.`;
|
|
|
12033
12022
|
return errMsg;
|
|
12034
12023
|
},
|
|
12035
12024
|
buildAlternationAmbiguityError(options) {
|
|
12036
|
-
const pathMsg = map_default(options.prefixPath, (currtok) => tokenLabel2(currtok)).join(", ");
|
|
12037
12025
|
const occurrence = options.alternation.idx === 0 ? "" : options.alternation.idx;
|
|
12026
|
+
const isEmptyPath = options.prefixPath.length === 0;
|
|
12038
12027
|
let currMessage = `Ambiguous Alternatives Detected: <${options.ambiguityIndices.join(" ,")}> in <OR${occurrence}> inside <${options.topLevelRule.name}> Rule,
|
|
12039
|
-
<${pathMsg}> may appears as a prefix path in all these alternatives.
|
|
12040
12028
|
`;
|
|
12041
|
-
|
|
12029
|
+
if (isEmptyPath) {
|
|
12030
|
+
currMessage += `These alternatives are all empty (match no tokens), making them indistinguishable.
|
|
12031
|
+
Only the last alternative may be empty.
|
|
12032
|
+
`;
|
|
12033
|
+
} else {
|
|
12034
|
+
const pathMsg = map_default(options.prefixPath, (currtok) => tokenLabel2(currtok)).join(", ");
|
|
12035
|
+
currMessage += `<${pathMsg}> may appears as a prefix path in all these alternatives.
|
|
12036
|
+
`;
|
|
12037
|
+
}
|
|
12038
|
+
currMessage += `See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
|
|
12042
12039
|
For Further details.`;
|
|
12043
12040
|
return currMessage;
|
|
12044
12041
|
},
|
|
@@ -12096,7 +12093,7 @@ see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`;
|
|
|
12096
12093
|
}
|
|
12097
12094
|
};
|
|
12098
12095
|
|
|
12099
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
12096
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/parse/grammar/resolver.js
|
|
12100
12097
|
function resolveGrammar(topLevels, errMsgProvider) {
|
|
12101
12098
|
const refResolver = new GastRefResolverVisitor(topLevels, errMsgProvider);
|
|
12102
12099
|
refResolver.resolveRefs();
|
|
@@ -12131,7 +12128,7 @@ var GastRefResolverVisitor = class extends GAstVisitor {
|
|
|
12131
12128
|
}
|
|
12132
12129
|
};
|
|
12133
12130
|
|
|
12134
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
12131
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/parse/grammar/interpreter.js
|
|
12135
12132
|
var AbstractNextPossibleTokensWalker = class extends RestWalker {
|
|
12136
12133
|
constructor(topProd, path) {
|
|
12137
12134
|
super();
|
|
@@ -12542,7 +12539,7 @@ function expandTopLevelRule(topRule, currIdx, currRuleStack, currOccurrenceStack
|
|
|
12542
12539
|
};
|
|
12543
12540
|
}
|
|
12544
12541
|
|
|
12545
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
12542
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/parse/grammar/lookahead.js
|
|
12546
12543
|
var PROD_TYPE;
|
|
12547
12544
|
(function(PROD_TYPE2) {
|
|
12548
12545
|
PROD_TYPE2[PROD_TYPE2["OPTION"] = 0] = "OPTION";
|
|
@@ -12901,7 +12898,7 @@ function areTokenCategoriesNotUsed(lookAheadPaths) {
|
|
|
12901
12898
|
return every_default(lookAheadPaths, (singleAltPaths) => every_default(singleAltPaths, (singlePath) => every_default(singlePath, (token) => isEmpty_default(token.categoryMatches))));
|
|
12902
12899
|
}
|
|
12903
12900
|
|
|
12904
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
12901
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/parse/grammar/checks.js
|
|
12905
12902
|
function validateLookahead(options) {
|
|
12906
12903
|
const lookaheadValidationErrorMessages = options.lookaheadStrategy.validate({
|
|
12907
12904
|
rules: options.rules,
|
|
@@ -13295,7 +13292,7 @@ function checkTerminalAndNoneTerminalsNameSpace(topLevels, tokenTypes, errMsgPro
|
|
|
13295
13292
|
return errors;
|
|
13296
13293
|
}
|
|
13297
13294
|
|
|
13298
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
13295
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/parse/grammar/gast/gast_resolver_public.js
|
|
13299
13296
|
function resolveGrammar2(options) {
|
|
13300
13297
|
const actualOptions = defaults_default(options, {
|
|
13301
13298
|
errMsgProvider: defaultGrammarResolverErrorProvider
|
|
@@ -13313,7 +13310,7 @@ function validateGrammar2(options) {
|
|
|
13313
13310
|
return validateGrammar(options.rules, options.tokenTypes, options.errMsgProvider, options.grammarName);
|
|
13314
13311
|
}
|
|
13315
13312
|
|
|
13316
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
13313
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/parse/exceptions_public.js
|
|
13317
13314
|
var MISMATCHED_TOKEN_EXCEPTION = "MismatchedTokenException";
|
|
13318
13315
|
var NO_VIABLE_ALT_EXCEPTION = "NoViableAltException";
|
|
13319
13316
|
var EARLY_EXIT_EXCEPTION = "EarlyExitException";
|
|
@@ -13367,7 +13364,7 @@ var EarlyExitException = class extends RecognitionException {
|
|
|
13367
13364
|
}
|
|
13368
13365
|
};
|
|
13369
13366
|
|
|
13370
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
13367
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/parse/parser/traits/recoverable.js
|
|
13371
13368
|
var EOF_FOLLOW_KEY = {};
|
|
13372
13369
|
var IN_RULE_RECOVERY_EXCEPTION = "InRuleRecoveryException";
|
|
13373
13370
|
var InRuleRecoveryException = class extends Error {
|
|
@@ -13608,7 +13605,7 @@ function attemptInRepetitionRecovery(prodFunc, args, lookaheadFunc, dslMethodIdx
|
|
|
13608
13605
|
}
|
|
13609
13606
|
}
|
|
13610
13607
|
|
|
13611
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
13608
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/parse/grammar/keys.js
|
|
13612
13609
|
var BITS_FOR_METHOD_TYPE = 4;
|
|
13613
13610
|
var BITS_FOR_OCCURRENCE_IDX = 8;
|
|
13614
13611
|
var BITS_FOR_ALT_IDX = 8;
|
|
@@ -13623,7 +13620,7 @@ function getKeyForAutomaticLookahead(ruleIdx, dslMethodIdx, occurrence) {
|
|
|
13623
13620
|
}
|
|
13624
13621
|
var BITS_START_FOR_ALT_IDX = 32 - BITS_FOR_ALT_IDX;
|
|
13625
13622
|
|
|
13626
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
13623
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/parse/grammar/llk_lookahead.js
|
|
13627
13624
|
var LLkLookaheadStrategy = class {
|
|
13628
13625
|
constructor(options) {
|
|
13629
13626
|
var _a;
|
|
@@ -13665,7 +13662,7 @@ var LLkLookaheadStrategy = class {
|
|
|
13665
13662
|
}
|
|
13666
13663
|
};
|
|
13667
13664
|
|
|
13668
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
13665
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/parse/parser/traits/looksahead.js
|
|
13669
13666
|
var LooksAhead = class {
|
|
13670
13667
|
initLooksAhead(config) {
|
|
13671
13668
|
this.dynamicTokensEnabled = has_default(config, "dynamicTokensEnabled") ? config.dynamicTokensEnabled : DEFAULT_PARSER_CONFIG.dynamicTokensEnabled;
|
|
@@ -13785,7 +13782,7 @@ function collectMethods(rule) {
|
|
|
13785
13782
|
return dslMethods;
|
|
13786
13783
|
}
|
|
13787
13784
|
|
|
13788
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
13785
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/parse/cst/cst.js
|
|
13789
13786
|
function setNodeLocationOnlyOffset(currNodeLocation, newLocationInfo) {
|
|
13790
13787
|
if (isNaN(currNodeLocation.startOffset) === true) {
|
|
13791
13788
|
currNodeLocation.startOffset = newLocationInfo.startOffset;
|
|
@@ -13823,7 +13820,7 @@ function addNoneTerminalToCst(node, ruleName, ruleResult) {
|
|
|
13823
13820
|
}
|
|
13824
13821
|
}
|
|
13825
13822
|
|
|
13826
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
13823
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/lang/lang_extensions.js
|
|
13827
13824
|
var NAME = "name";
|
|
13828
13825
|
function defineNameProp(obj, nameValue) {
|
|
13829
13826
|
Object.defineProperty(obj, NAME, {
|
|
@@ -13834,7 +13831,7 @@ function defineNameProp(obj, nameValue) {
|
|
|
13834
13831
|
});
|
|
13835
13832
|
}
|
|
13836
13833
|
|
|
13837
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
13834
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/parse/cst/cst_visitor.js
|
|
13838
13835
|
function defaultVisit(ctx, param) {
|
|
13839
13836
|
const childrenNames = keys_default(ctx);
|
|
13840
13837
|
const childrenNamesLength = childrenNames.length;
|
|
@@ -13913,7 +13910,7 @@ function validateMissingCstMethods(visitorInstance, ruleNames) {
|
|
|
13913
13910
|
return compact_default(errors);
|
|
13914
13911
|
}
|
|
13915
13912
|
|
|
13916
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
13913
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/parse/parser/traits/tree_builder.js
|
|
13917
13914
|
var TreeBuilder = class {
|
|
13918
13915
|
initTreeBuilder(config) {
|
|
13919
13916
|
this.CST_STACK = [];
|
|
@@ -14075,7 +14072,7 @@ var TreeBuilder = class {
|
|
|
14075
14072
|
}
|
|
14076
14073
|
};
|
|
14077
14074
|
|
|
14078
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
14075
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/parse/parser/traits/lexer_adapter.js
|
|
14079
14076
|
var LexerAdapter = class {
|
|
14080
14077
|
initLexerAdapter() {
|
|
14081
14078
|
this.tokVector = [];
|
|
@@ -14132,7 +14129,7 @@ var LexerAdapter = class {
|
|
|
14132
14129
|
}
|
|
14133
14130
|
};
|
|
14134
14131
|
|
|
14135
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
14132
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_api.js
|
|
14136
14133
|
var RecognizerApi = class {
|
|
14137
14134
|
ACTION(impl) {
|
|
14138
14135
|
return impl.call(this);
|
|
@@ -14448,7 +14445,7 @@ var RecognizerApi = class {
|
|
|
14448
14445
|
}
|
|
14449
14446
|
};
|
|
14450
14447
|
|
|
14451
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
14448
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_engine.js
|
|
14452
14449
|
var RecognizerEngine = class {
|
|
14453
14450
|
initRecognizerEngine(tokenVocabulary, config) {
|
|
14454
14451
|
this.className = this.constructor.name;
|
|
@@ -14872,7 +14869,7 @@ Make sure that all grammar rule definitions are done before 'performSelfAnalysis
|
|
|
14872
14869
|
}
|
|
14873
14870
|
};
|
|
14874
14871
|
|
|
14875
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
14872
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/parse/parser/traits/error_handler.js
|
|
14876
14873
|
var ErrorHandler = class {
|
|
14877
14874
|
initErrorHandler(config) {
|
|
14878
14875
|
this._errors = [];
|
|
@@ -14936,7 +14933,7 @@ var ErrorHandler = class {
|
|
|
14936
14933
|
}
|
|
14937
14934
|
};
|
|
14938
14935
|
|
|
14939
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
14936
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/parse/parser/traits/context_assist.js
|
|
14940
14937
|
var ContentAssist = class {
|
|
14941
14938
|
initContentAssist() {
|
|
14942
14939
|
}
|
|
@@ -14958,7 +14955,7 @@ var ContentAssist = class {
|
|
|
14958
14955
|
}
|
|
14959
14956
|
};
|
|
14960
14957
|
|
|
14961
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
14958
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/parse/parser/traits/gast_recorder.js
|
|
14962
14959
|
var RECORDING_NULL_OBJECT = {
|
|
14963
14960
|
description: "This Object indicates the Parser is during Recording Phase"
|
|
14964
14961
|
};
|
|
@@ -15220,7 +15217,7 @@ function assertMethodIdxIsValid(idx) {
|
|
|
15220
15217
|
}
|
|
15221
15218
|
}
|
|
15222
15219
|
|
|
15223
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
15220
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/parse/parser/traits/perf_tracer.js
|
|
15224
15221
|
var PerformanceTracer = class {
|
|
15225
15222
|
initPerformanceTracer(config) {
|
|
15226
15223
|
if (has_default(config, "traceInitPerf")) {
|
|
@@ -15254,7 +15251,7 @@ var PerformanceTracer = class {
|
|
|
15254
15251
|
}
|
|
15255
15252
|
};
|
|
15256
15253
|
|
|
15257
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
15254
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/parse/parser/utils/apply_mixins.js
|
|
15258
15255
|
function applyMixins(derivedCtor, baseCtors) {
|
|
15259
15256
|
baseCtors.forEach((baseCtor) => {
|
|
15260
15257
|
const baseProto = baseCtor.prototype;
|
|
@@ -15272,7 +15269,7 @@ function applyMixins(derivedCtor, baseCtors) {
|
|
|
15272
15269
|
});
|
|
15273
15270
|
}
|
|
15274
15271
|
|
|
15275
|
-
// node_modules/.pnpm/chevrotain@11.1.
|
|
15272
|
+
// node_modules/.pnpm/chevrotain@11.1.2/node_modules/chevrotain/lib/src/parse/parser/parser.js
|
|
15276
15273
|
var END_OF_FILE = createTokenInstance(EOF, "", NaN, NaN, NaN, NaN, NaN, NaN);
|
|
15277
15274
|
Object.freeze(END_OF_FILE);
|
|
15278
15275
|
var DEFAULT_PARSER_CONFIG = Object.freeze({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptscript/cli",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "CLI for PromptScript - standardize AI instructions across GitHub Copilot, Claude, Cursor and other AI tools",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
"node": ">=18"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@inquirer/prompts": "^8.
|
|
43
|
+
"@inquirer/prompts": "^8.3.0",
|
|
44
44
|
"chalk": "^5.6.2",
|
|
45
45
|
"chokidar": "^5.0.0",
|
|
46
46
|
"commander": "^14.0.3",
|
|
47
|
-
"ora": "^9.
|
|
47
|
+
"ora": "^9.3.0",
|
|
48
48
|
"yaml": "^2.8.2",
|
|
49
|
-
"simple-git": "^3.
|
|
49
|
+
"simple-git": "^3.32.3"
|
|
50
50
|
}
|
|
51
51
|
}
|