@promptscript/cli 1.19.0 → 1.20.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.
@@ -0,0 +1,220 @@
1
+ // packages/cli/src/managed-output-worker.ts
2
+ import { createHash } from "node:crypto";
3
+ import {
4
+ closeSync,
5
+ constants,
6
+ fsyncSync,
7
+ linkSync,
8
+ lstatSync,
9
+ mkdirSync,
10
+ openSync,
11
+ readFileSync,
12
+ renameSync,
13
+ statSync,
14
+ unlinkSync,
15
+ writeFileSync
16
+ } from "node:fs";
17
+ var MANAGED_OUTPUT_WORKER_COMMAND = "__managed-output-worker";
18
+ var WORKER_STATUSES = {
19
+ removed: "removed",
20
+ rewritten: "rewritten",
21
+ created: "created",
22
+ ready: "ready",
23
+ skipped: "skipped"
24
+ };
25
+ function isNodeError(error) {
26
+ return error instanceof Error && "code" in error;
27
+ }
28
+ function isEntryName(name) {
29
+ return name !== "" && name !== "." && name !== ".." && !name.includes("/") && !name.includes("\\");
30
+ }
31
+ function isPinnedDirectory(args) {
32
+ if (!isEntryName(args.name)) return false;
33
+ const directory = statSync(".");
34
+ return String(directory.dev) === args.directoryDev && String(directory.ino) === args.directoryIno;
35
+ }
36
+ function isRegularFileIdentity(file, fileDev, fileIno) {
37
+ return file.isFile() && !file.isSymbolicLink() && fileDev !== void 0 && fileIno !== void 0 && String(file.dev) === fileDev && String(file.ino) === fileIno;
38
+ }
39
+ function sha256(content) {
40
+ return createHash("sha256").update(content).digest("hex");
41
+ }
42
+ function guardedUnlink(args) {
43
+ if (!isPinnedDirectory(args)) return WORKER_STATUSES.skipped;
44
+ let file;
45
+ try {
46
+ file = lstatSync(args.name);
47
+ } catch (error) {
48
+ if (isNodeError(error) && error.code === "ENOENT") return WORKER_STATUSES.skipped;
49
+ throw error;
50
+ }
51
+ if (!isRegularFileIdentity(file, args.fileDev, args.fileIno)) return WORKER_STATUSES.skipped;
52
+ if (args.expectedHash) {
53
+ const currentHash = sha256(readFileSync(args.name));
54
+ if (currentHash !== args.expectedHash) return WORKER_STATUSES.skipped;
55
+ }
56
+ unlinkSync(args.name);
57
+ return WORKER_STATUSES.removed;
58
+ }
59
+ function temporaryName(name) {
60
+ return `.${name}.promptscript-${process.pid}-${Date.now()}`;
61
+ }
62
+ var openNofollowFlag;
63
+ function openFlagsForTempFile() {
64
+ openNofollowFlag ??= constants.O_NOFOLLOW ?? 0;
65
+ return constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | openNofollowFlag;
66
+ }
67
+ function guardedRewrite(args, content) {
68
+ if (!isPinnedDirectory(args)) return WORKER_STATUSES.skipped;
69
+ let file;
70
+ try {
71
+ file = lstatSync(args.name);
72
+ } catch (error) {
73
+ if (isNodeError(error) && error.code === "ENOENT") return WORKER_STATUSES.skipped;
74
+ throw error;
75
+ }
76
+ if (!isRegularFileIdentity(file, args.fileDev, args.fileIno)) return WORKER_STATUSES.skipped;
77
+ const expectedHash = args.expectedHash ?? "";
78
+ if (sha256(readFileSync(args.name)) !== expectedHash) return WORKER_STATUSES.skipped;
79
+ const temporary = temporaryName(args.name);
80
+ let temporaryCreated = false;
81
+ try {
82
+ const descriptor = openSync(
83
+ temporary,
84
+ openFlagsForTempFile(),
85
+ args.requestedMode === void 0 || args.requestedMode === "" ? file.mode & 511 : Number(args.requestedMode) & 511
86
+ );
87
+ temporaryCreated = true;
88
+ try {
89
+ writeFileSync(descriptor, content);
90
+ fsyncSync(descriptor);
91
+ } finally {
92
+ closeSync(descriptor);
93
+ }
94
+ const latest = lstatSync(args.name);
95
+ const latestHash = sha256(readFileSync(args.name));
96
+ if (!isRegularFileIdentity(latest, args.fileDev, args.fileIno) || latestHash !== expectedHash) {
97
+ unlinkSync(temporary);
98
+ temporaryCreated = false;
99
+ return WORKER_STATUSES.skipped;
100
+ }
101
+ renameSync(temporary, args.name);
102
+ temporaryCreated = false;
103
+ return WORKER_STATUSES.rewritten;
104
+ } finally {
105
+ if (temporaryCreated) {
106
+ try {
107
+ unlinkSync(temporary);
108
+ } catch {
109
+ }
110
+ }
111
+ }
112
+ }
113
+ function guardedCreate(args, content) {
114
+ if (!isPinnedDirectory(args)) return WORKER_STATUSES.skipped;
115
+ try {
116
+ lstatSync(args.name);
117
+ return WORKER_STATUSES.skipped;
118
+ } catch (error) {
119
+ if (!isNodeError(error) || error.code !== "ENOENT") throw error;
120
+ }
121
+ const temporary = temporaryName(args.name);
122
+ let temporaryCreated = false;
123
+ try {
124
+ const descriptor = openSync(temporary, openFlagsForTempFile(), Number(args.requestedMode));
125
+ temporaryCreated = true;
126
+ try {
127
+ writeFileSync(descriptor, content);
128
+ fsyncSync(descriptor);
129
+ } finally {
130
+ closeSync(descriptor);
131
+ }
132
+ linkSync(temporary, args.name);
133
+ unlinkSync(temporary);
134
+ temporaryCreated = false;
135
+ return WORKER_STATUSES.created;
136
+ } catch (error) {
137
+ if (isNodeError(error) && error.code === "EEXIST") return WORKER_STATUSES.skipped;
138
+ throw error;
139
+ } finally {
140
+ if (temporaryCreated) {
141
+ try {
142
+ unlinkSync(temporary);
143
+ } catch {
144
+ }
145
+ }
146
+ }
147
+ }
148
+ function guardedMkdir(args) {
149
+ if (!isPinnedDirectory(args)) return WORKER_STATUSES.skipped;
150
+ try {
151
+ mkdirSync(args.name);
152
+ } catch (error) {
153
+ if (!isNodeError(error) || error.code !== "EEXIST") throw error;
154
+ }
155
+ const created = lstatSync(args.name);
156
+ if (!created.isDirectory() || created.isSymbolicLink()) return WORKER_STATUSES.skipped;
157
+ return WORKER_STATUSES.ready;
158
+ }
159
+ function requireDirectoryArgs(op, name, directoryDev, directoryIno) {
160
+ if (name === void 0 || directoryDev === void 0 || directoryIno === void 0) {
161
+ throw new Error(`Managed output worker received incomplete arguments for ${op}`);
162
+ }
163
+ return { name, directoryDev, directoryIno };
164
+ }
165
+ function performManagedOutputOperation(op, args, stdinContent) {
166
+ switch (op) {
167
+ case "unlink": {
168
+ const [name, directoryDev, directoryIno, fileDev, fileIno, expectedHash] = args;
169
+ const dir = requireDirectoryArgs(op, name, directoryDev, directoryIno);
170
+ return guardedUnlink({ ...dir, fileDev, fileIno, expectedHash });
171
+ }
172
+ case "rewrite": {
173
+ const [name, directoryDev, directoryIno, fileDev, fileIno, expectedHash, requestedMode] = args;
174
+ const dir = requireDirectoryArgs(op, name, directoryDev, directoryIno);
175
+ return guardedRewrite(
176
+ { ...dir, fileDev, fileIno, expectedHash, requestedMode },
177
+ stdinContent ?? readFileSync(0)
178
+ );
179
+ }
180
+ case "create": {
181
+ const [name, directoryDev, directoryIno, requestedMode] = args;
182
+ const dir = requireDirectoryArgs(op, name, directoryDev, directoryIno);
183
+ return guardedCreate({ ...dir, requestedMode }, stdinContent ?? readFileSync(0));
184
+ }
185
+ case "mkdir": {
186
+ const [name, directoryDev, directoryIno] = args;
187
+ const dir = requireDirectoryArgs(op, name, directoryDev, directoryIno);
188
+ return guardedMkdir(dir);
189
+ }
190
+ default:
191
+ throw new Error(`Unknown managed output worker operation: ${op}`);
192
+ }
193
+ }
194
+ function runManagedOutputWorkerProtocol(opArgs, stdinContent) {
195
+ const [op, ...rest] = opArgs;
196
+ if (op === void 0) {
197
+ return 1;
198
+ }
199
+ try {
200
+ process.stdout.write(performManagedOutputOperation(op, rest, stdinContent));
201
+ return 0;
202
+ } catch {
203
+ return 1;
204
+ }
205
+ }
206
+ var dispatchedAsWorker = false;
207
+ if (process.argv[2] === MANAGED_OUTPUT_WORKER_COMMAND) {
208
+ dispatchedAsWorker = true;
209
+ process.exitCode = runManagedOutputWorkerProtocol(process.argv.slice(3));
210
+ }
211
+ function wasDispatchedAsManagedOutputWorker() {
212
+ return dispatchedAsWorker;
213
+ }
214
+ export {
215
+ MANAGED_OUTPUT_WORKER_COMMAND,
216
+ WORKER_STATUSES,
217
+ performManagedOutputOperation,
218
+ runManagedOutputWorkerProtocol,
219
+ wasDispatchedAsManagedOutputWorker
220
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptscript/cli",
3
- "version": "1.19.0",
3
+ "version": "1.20.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",
@@ -47,11 +47,12 @@
47
47
  "commander": "^15.0.0",
48
48
  "minimatch": "^10.2.6",
49
49
  "ora": "^9.4.1",
50
- "prettier": "^3.9.6",
51
- "yaml": "^2.9.0",
50
+ "prettier": "^3.9.8",
51
+ "yaml": "^2.9.1",
52
52
  "simple-git": "3.36.0",
53
- "fastify": "^5.12.3",
53
+ "fastify": "^5.12.5",
54
54
  "@fastify/cors": "^11.3.0",
55
+ "@fastify/rate-limit": "^11.2.0",
55
56
  "@fastify/websocket": "^11.3.0",
56
57
  "ws": "^8.21.3",
57
58
  "fast-glob": "^3.3.0"
@@ -1113,6 +1113,7 @@ sections without changing filenames, frontmatter, XML tags, or structured keys:
1113
1113
  - **PS037 (`valid-section-headers`)**: rejects invalid titles, unknown or unowned section keys, duplicate overrides, and nested extension overrides.
1114
1114
  - **PS038 (`valid-block-shape`)**: rejects unsupported built-in block shapes and warns about formatter-sensitive legacy shapes or multiline shortcut scalars.
1115
1115
  - **PS039 (`agent-namespaces`)**: validates qualified agent name segments and checks them against recorded import provenance.
1116
+ - **PS040 (`import-excludes`)**: errors when a `validation.excludes` entry for an import does not record the commit pinned in promptscript.lock, so consumers re-review imports whose pinned commit changed.
1116
1117
  - **PS021 (`use-block-filter`)**: errors when `only` and `exclude` are both specified in `@use` parameters.
1117
1118
  - **PS025 (`valid-skill-references`)**: errors when a `references` entry points to a file with a disallowed extension or a path that cannot be resolved.
1118
1119
  - **PS026 (`safe-reference-content`)**: warns when a referenced file contains potentially sensitive content (e.g., secrets, credentials).
@@ -0,0 +1,3 @@
1
+ /** Version of the @promptscript/cli package, resolved at build time. */
2
+ export declare const CLI_VERSION: string;
3
+ //# sourceMappingURL=cli-version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-version.d.ts","sourceRoot":"","sources":["../../../../packages/cli/src/cli-version.ts"],"names":[],"mappings":"AAUA,wEAAwE;AACxE,eAAO,MAAM,WAAW,EAAE,MAA4B,CAAC"}
package/src/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../../packages/cli/src/cli.ts"],"names":[],"mappings":";AAiXA;;;GAGG;AACH,wBAAsB,GAAG,CAAC,IAAI,GAAE,MAAM,EAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAStE"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../../packages/cli/src/cli.ts"],"names":[],"mappings":";AAgXA;;;GAGG;AACH,wBAAsB,GAAG,CAAC,IAAI,GAAE,MAAM,EAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CActE"}
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/init.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,WAAW,EAAyB,MAAM,gBAAgB,CAAC;AAoBzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,EAOL,KAAK,YAAY,EAElB,MAAM,+BAA+B,CAAC;AAIvC,OAAO,EAGL,KAAK,YAAY,EAElB,MAAM,wBAAwB,CAAC;AA4DhC;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,WAAW,EACpB,QAAQ,GAAE,WAAqC,GAC9C,OAAO,CAAC,IAAI,CAAC,CAQf;AA2UD,wBAAsB,uBAAuB,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC,CAU9F;AAqGD,wBAAgB,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CA+BtE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAM7D;AAiYD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAM7D"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/init.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,WAAW,EAAyB,MAAM,gBAAgB,CAAC;AAIzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,EAOL,KAAK,YAAY,EAElB,MAAM,+BAA+B,CAAC;AAIvC,OAAO,EAGL,KAAK,YAAY,EAElB,MAAM,wBAAwB,CAAC;AA4DhC;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,WAAW,EACpB,QAAQ,GAAE,WAAqC,GAC9C,OAAO,CAAC,IAAI,CAAC,CAQf;AA2UD,wBAAsB,uBAAuB,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC,CAU9F;AAqGD,wBAAgB,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CA0BtE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAM7D;AAiYD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAM7D"}
@@ -13,7 +13,7 @@ export interface RemoteImport {
13
13
  sourceFile?: string;
14
14
  /** Source line containing this import when location collection is enabled */
15
15
  sourceLine?: number;
16
- /** Original @use source text when location collection is enabled */
16
+ /** Original reference text when location collection is enabled */
17
17
  rawSource?: string;
18
18
  }
19
19
  /**
@@ -35,7 +35,7 @@ export interface ScanOptions {
35
35
  }
36
36
  /**
37
37
  * Scan `.prs` files starting from an entry point, recursively follow local
38
- * `@use` imports, and collect all remote `@use` references.
38
+ * references, and collect remote `@use`, `@inherit`, and inline skill imports.
39
39
  *
40
40
  * Remote references are those that resolve to registry markers — either direct
41
41
  * URL-style imports (e.g. `github.com/org/repo/path`) or registry alias
@@ -1 +1 @@
1
- {"version":3,"file":"lock-scanner.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/lock-scanner.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,+DAA+D;IAC/D,OAAO,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,mDAAmD;IACnD,SAAS,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,6DAA6D;IAC7D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,mEAAmE;IACnE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,uDAAuD;IACvD,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,oBAAoB,CACxC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,YAAY,EAAE,CAAC,CAmGzB"}
1
+ {"version":3,"file":"lock-scanner.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/lock-scanner.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAiB,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,+DAA+D;IAC/D,OAAO,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,mDAAmD;IACnD,SAAS,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,6DAA6D;IAC7D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,mEAAmE;IACnE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,uDAAuD;IACvD,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,oBAAoB,CACxC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,YAAY,EAAE,CAAC,CA2HzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"lock.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/lock.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,KAAK,EAAY,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGvE,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,wBAAwB,CAAC;AAQhC,4CAA4C;AAC5C,eAAO,MAAM,aAAa,sBAAsB,CAAC;AAUjD,MAAM,WAAW,uBAAuB;IACtC,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAyLrE;AAkBD,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,MAAM,EACf,iBAAiB,EAAE,MAAM,EAAE,EAC3B,QAAQ,EAAE,kBAAkB,GAAG,SAAS,EACxC,WAAW,EAAE,OAAO,EACpB,WAAW,CAAC,EAAE,MAAM,EACpB,IAAI,CAAC,EAAE,cAAc,EACrB,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,kBAAkB,CAAC,CAmE7B"}
1
+ {"version":3,"file":"lock.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/lock.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,KAAK,EAAY,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGvE,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,wBAAwB,CAAC;AAQhC,4CAA4C;AAC5C,eAAO,MAAM,aAAa,sBAAsB,CAAC;AAUjD,MAAM,WAAW,uBAAuB;IACtC,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA0LrE;AAkBD,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,MAAM,EACf,iBAAiB,EAAE,MAAM,EAAE,EAC3B,QAAQ,EAAE,kBAAkB,GAAG,SAAS,EACxC,WAAW,EAAE,OAAO,EACpB,WAAW,CAAC,EAAE,MAAM,EACpB,IAAI,CAAC,EAAE,cAAc,EACrB,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,kBAAkB,CAAC,CAmE7B"}
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-cmd.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/resolve-cmd.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAoIzD;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAiKf"}
1
+ {"version":3,"file":"resolve-cmd.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/resolve-cmd.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAoIzD;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAuKf"}
@@ -1 +1 @@
1
- {"version":3,"file":"update-check.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/update-check.ts"],"names":[],"mappings":"AASA;;;GAGG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CA4BxD"}
1
+ {"version":3,"file":"update-check.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/update-check.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CA4BxD"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Generated by scripts/sync-skill.sh - do not edit.
3
+ * Embedded PromptScript skill content, so the CLI works without
4
+ * filesystem skill discovery (including deno compile binaries).
5
+ */
6
+ export declare const PROMPTSCRIPT_SKILL_CONTENT = "---\nname: promptscript\ndescription: >-\n PromptScript language expert for reading, writing, modifying, and\n troubleshooting .prs files. Use when working with PromptScript syntax,\n creating or editing .prs files, adding blocks like @identity, @standards,\n @restrictions, @shortcuts, @skills, or @agents, configuring\n promptscript.yaml, resolving compilation errors, understanding inheritance\n (@inherit), composition (@use, @extend, @override), contextual @header\n metadata, or migrating AI instructions\n to PromptScript. Also use when asked about the 50 built-in compilation\n targets, including GitHub Copilot, Claude Code, Cursor, Antigravity,\n Factory AI, and AGENTS.md-based platforms.\nlicense: MIT\nmetadata:\n author: PromptScript\n homepage: https://getpromptscript.dev\ncompatibility:\n - claude-code\n - github-copilot\n - cursor\n - factory-ai\n - gemini-cli\n - opencode\n - windsurf\n - cline\n - roo\n - codex\n - continue\n - augment\n - goose\n - kilo\n - amp\n - trae\n - junie\n - kiro-cli\nallowed-tools:\n - Read\n - Write\n - Glob\n - Grep\n - Bash\nuser-invocable: true\n---\n\n# PromptScript Language Guide\n\nPromptScript is a domain-specific language that compiles `.prs` files into native instruction formats for AI coding assistants (GitHub Copilot, Claude Code, Cursor, Antigravity, Factory AI, OpenCode, Gemini CLI). One source of truth, multiple outputs.\n\n## File Structure\n\nA `.prs` file contains ordered declarations. Syntax `1.5.0` applies `@inherit`,\n`@use`, local blocks, `@extend`, and `@override` in source order. Put `@meta`\nfirst.\n\n```\n# Comments start with #\n\n@meta { ... } # Required metadata\n@inherit @path # Single inheritance (optional)\n@use @path [as alias] # Imports/mixins (optional, multiple)\n\n@identity { ... } # AI persona\n@context { ... } # Project context\n@standards { ... } # Coding conventions\n@restrictions { ... } # Hard rules\n@shortcuts { ... } # Command aliases\n@knowledge { ... } # Reference documentation\n@skills { ... } # Reusable skill definitions\n@agents { ... } # Subagent definitions\n@workflows { ... } # Repeatable agent procedures\n@examples { ... } # Few-shot input/output examples (syntax 1.2.0+)\n@params { ... } # Template parameters\n@guards { ... } # File globs and priorities\n@hooks { ... } # Portable lifecycle hooks (syntax 1.4.0+)\n@mcpServers { ... } # MCP server configurations (syntax 1.4.0+)\n@plugins { ... } # Capability bundles (syntax 1.4.0+)\n@local { ... } # Private config (not committed)\n@extend path { ... } # Modify imported blocks\n@override path { ... } # Replace one complete existing target (syntax 1.5.0+)\n@custom-name { ... } # Arbitrary named blocks\n```\n\nContextual `@header` entries appear inside supported owner blocks, not at the\ntop level.\n\n## Content Types\n\nPromptScript has four canonical content shapes inside blocks:\n\n### Text Content\n\nUse triple quotes (three double-quote characters) to wrap multiline text.\nText is automatically dedented - leading whitespace from source indentation is stripped.\nUse for prose, markdown, or freeform content.\n\nExample: `@identity` with a text block describing an AI persona starting with \"You are...\"\n\n### Object Content (key-value pairs)\n\n```\n@context {\n project: \"My App\"\n team: \"Frontend\"\n monorepo: {\n tool: \"Nx\"\n packageManager: \"pnpm\"\n }\n}\n```\n\nValues can be strings (quoted or unquoted), numbers, booleans, nested objects, or arrays.\n\n### Array Content\n\n```\n@standards {\n code: [\n \"Use strict TypeScript\",\n \"Named exports only\"\n ]\n}\n\n@restrictions {\n - \"Never use any type\"\n - \"Never commit secrets\"\n}\n```\n\n### Mixed Content\n\nBlocks can contain both object properties and text in the same block.\nPlace the triple-quoted text block alongside key-value pairs.\n\n## Block Reference\n\n### @meta (required)\n\n```\n@meta {\n id: \"project-id\" # Required: unique identifier\n syntax: \"1.0.0\" # Required: syntax version (semver)\n org: \"Company Name\" # Optional\n team: \"Frontend\" # Optional\n tags: [react, ts] # Optional\n params: { # Optional: template parameters\n projectName: string\n port: number = 3000\n debug?: boolean\n framework: enum(\"react\", \"vue\") = \"react\"\n }\n}\n```\n\n### @identity\n\nDefines AI persona. Start with \"You are...\" for consistent output across all formatters.\nContains a triple-quoted text block with the persona description.\n\n### @context\n\nProject context with structured properties (project, team, languages, runtime)\nplus optional triple-quoted text for architecture details, diagrams, etc.\n\n### @standards\n\nCategory-based conventions. Any category name is valid:\n\n```\n@standards {\n typescript: [\"Strict mode\", \"No any type\"]\n naming: [\"Files: kebab-case.ts\", \"Classes: PascalCase\"]\n git: {\n format: \"Conventional Commits\"\n types: [feat, fix, docs, refactor, test, chore]\n }\n}\n```\n\nCategory names are arbitrary. `@standards` can also contain free-form text:\n\n```\n@standards {\n \"\"\"\n ## Formatting\n Preserve heading structure and use four-space indentation.\n\n ## Testing\n Add regression coverage for every behavior change.\n \"\"\"\n typescript: [\"Strict mode\", \"Named exports only\"]\n git: {\n format: \"Conventional Commits\"\n }\n}\n```\n\nFree-form text is dedented and rendered with its Markdown heading structure. Factory\nmonolith output nests it under `Conventions & Patterns`; split Factory rules adjust\nheading levels relative to the generated section. Custom structured categories remain\navailable to formatters that support them.\n\n### @restrictions\n\nHard rules as a list of dash-prefixed strings:\n\n```\n@restrictions {\n - \"Never expose API keys\"\n - \"Never commit secrets to version control\"\n - \"Always validate user input\"\n}\n```\n\n### @shortcuts\n\nSimple strings appear as documentation. Objects with `prompt: true` generate\nexecutable prompt/command files for GitHub Copilot and Cursor:\n\n```\n@shortcuts {\n \"/review\": \"Review code for quality\"\n \"/test\": {\n prompt: true\n description: \"Write unit tests\"\n content: (triple-quoted text with instructions)\n }\n}\n```\n\n> `@commands` is a backwards-compatible alias for `@shortcuts` \u2014 prefer `@shortcuts` in new files.\n\n### @skills\n\nReusable skill definitions with metadata:\n\n```\n@skills {\n commit: {\n description: \"Create git commits\"\n trigger: \"commit, git commit\"\n disableModelInvocation: true\n userInvocable: true\n allowedTools: [\"Bash\", \"Read\"]\n content: (triple-quoted text with skill instructions)\n }\n}\n```\n\nProperties: description (required), content (required), trigger, disableModelInvocation,\nuserInvocable, allowedTools, context (\"fork\" or \"inherit\"), agent, requires, references, inputs, outputs.\n\nThe `references` property attaches external files to the skill's context:\n\n```\n@skills {\n architecture-review: {\n description: \"Review architecture decisions\"\n references: [\n ./references/architecture.md\n ./references/modules.md\n ]\n content: (triple-quoted text)\n }\n}\n```\n\nAllowed file types: `.md`, `.json`, `.yaml`, `.yml`, `.txt`, `.csv`. Paths are resolved relative\nto the `.prs` file. Formatters emit referenced files alongside SKILL.md in the output directory.\n\n### Parameterized Skills\n\nSkills in `.promptscript/skills/<name>/SKILL.md` support template parameters via\nYAML frontmatter. Define `params` in frontmatter and use `{{variable}}` in content:\n\n```yaml\n---\nname: review\ndescription: 'Review {{language}} code for {{standard}}'\nparams:\n language:\n type: string\n standard:\n type: string\n default: 'best practices'\nreferences:\n - references/architecture.md\n---\nReview the code using {{language}} conventions following {{standard}}.\n```\n\nThe `references` field in SKILL.md frontmatter lists files to attach to the skill's context.\nPaths are relative to the SKILL.md file.\n\nImported SKILL.md frontmatter is bounded: 256 KiB per document, 10,000 YAML nodes, 32 nesting\nlevels, 2,000 entries per mapping or sequence, and 64 KiB per string value. Documents over any\nlimit are rejected before their YAML values are converted.\n\nPass values in `@skills` block:\n\n```\n@skills {\n review: {\n description: \"Review code\"\n language: \"typescript\"\n standard: \"strict mode\"\n }\n}\n```\n\nNon-reserved properties (anything other than description, content, trigger,\nuserInvocable, allowedTools, disableModelInvocation, context, agent, requires,\ninputs, outputs) are treated as skill parameter arguments.\n\n### Skill Dependencies\n\nSkills can declare dependencies on other skills via `requires`:\n\n```\n@skills {\n deploy: {\n description: \"Deploy service\"\n requires: [\"lint-check\", \"test-suite\"]\n content: (triple-quoted text)\n }\n}\n```\n\nThe validator (PS016) checks that required skills exist, detects self-references,\nand catches circular dependency chains.\n\n### Skill Contracts (Inputs/Outputs)\n\nSkills can declare typed inputs and outputs in SKILL.md frontmatter:\n\n```yaml\n---\nname: security-scan\ndescription: 'Scan for vulnerabilities'\ninputs:\n files:\n description: 'Files to scan'\n type: string\n severity:\n description: 'Minimum severity'\n type: enum\n options: [low, medium, high]\n default: medium\noutputs:\n report:\n description: 'Scan report'\n type: string\n passed:\n description: 'Whether scan passed'\n type: boolean\n---\n```\n\nField types: `string`, `number`, `boolean`, `enum` (with `options` list).\nThe validator (PS017) checks field types, ensures enum fields have options,\nand warns if param names collide with input names.\n\n### Shared Resources\n\nSkills in a folder can share common resources via `.promptscript/shared/`:\n\n```\n.promptscript/\n shared/\n templates.md # Shared across all skills\n style-guide.md\n skills/\n review/\n SKILL.md # Gets @shared/templates.md, @shared/style-guide.md\n deploy/\n SKILL.md # Also gets shared resources\n```\n\nFiles in `shared/` are automatically included in every skill with `@shared/` prefix.\n\n### @agents\n\nCustom subagent definitions. Compiles to `.claude/agents/` for Claude Code,\n`.github/agents/` for GitHub Copilot, `.factory/droids/` for Factory AI, etc.\n\n```\n@agents {\n code-reviewer: {\n description: \"Reviews code quality\"\n tools: [\"Read\", \"Grep\", \"Glob\", \"Bash\"]\n model: \"sonnet\"\n permissionMode: \"default\"\n content: (triple-quoted text with agent instructions)\n }\n}\n```\n\nImported agent definitions are qualified by an aliased `@use`:\n\n```\n@use ./frontend-team as frontend\n@use ./backend-team as backend\n```\n\nIf both imports define `reviewer`, the resolved names are `frontend.reviewer` and\n`backend.reviewer`. Unique unaliased imports keep their original names. Conflicting unaliased\ndefinitions stop compilation with source and import diagnostics instead of silently overwriting\none another. Native targets map dots to hyphens, so `frontend.reviewer` becomes\n`frontend-reviewer`.\n\nSupports mixed models per agent: `specModel` sets a different model for\nSpecification/planning mode (GitHub, Factory), `specReasoningEffort` sets reasoning\neffort for the spec model (Factory only, values: \"low\", \"medium\", \"high\").\n\nFactory AI droids support additional properties: `model` (any model ID or \"inherit\"),\n`reasoningEffort` (\"low\", \"medium\", \"high\"), and `tools` (category name like \"read-only\"\nor array of tool IDs).\n\n### @workflows\n\nRepeatable multi-step agent procedures. Requires syntax `1.1.0`.\n\n```\n@workflows {\n release: {\n description: \"Prepare a validated release\"\n content: \"\"\"\n 1. Run formatting, linting, type checks, and tests.\n 2. Validate compiled output.\n 3. Stop before publishing and request approval.\n \"\"\"\n }\n}\n```\n\nTargets with native workflow discovery emit dedicated workflow files. Other targets\nretain workflow instructions in their main output when supported.\n\n### @examples\n\nStructured few-shot examples for AI assistants (requires syntax `1.2.0`):\n\n```\n@meta {\n id: \"commit-style\"\n syntax: \"1.2.0\"\n}\n\n@examples {\n feat-commit: {\n description: \"Feature commit with scope\"\n input: \"Added user authentication with JWT tokens\"\n output: \"feat(auth): add JWT-based user authentication\"\n }\n}\n```\n\nEach entry is a named example with `input` and `output` (both required),\nplus optional `description`. Multi-line content uses triple-quoted strings.\n\nExamples can also be attached to skills via the `examples` property:\n\n```\n@skills {\n commit: {\n description: \"Create conventional commits\"\n examples: {\n basic: {\n input: \"Added dark mode toggle\"\n output: \"feat(settings): add dark mode toggle\"\n }\n }\n content: (triple-quoted text)\n }\n}\n```\n\n### @knowledge\n\nReference documentation as triple-quoted text. Used for command references,\nAPI docs, and other material that should appear in the output.\n\n### @params\n\nTemplate parameter definitions with types: string, number, boolean, enum(\"a\", \"b\").\nOptional parameters use `?` suffix. Defaults use `= value`.\n\n### @guards\n\nFile glob patterns and priority rules for path-specific instructions.\n\n### @hooks\n\nPortable lifecycle hooks. Requires syntax `1.4.0`. Each hook needs exactly one of\n`command` or `script`.\n\n```\n@hooks {\n validate-types: {\n event: \"post-tool-use\"\n matcher: \"Edit|Write\"\n script: {\n path: \".promptscript/scripts/validate.py\"\n interpreter: \"python3\"\n args: [\"--strict\"]\n }\n cwd: \"project\"\n timeoutMs: 120000\n statusMessage: \"Checking TypeScript\"\n continueOnFailure: false\n enabled: true\n targets: {\n factory: { matcher: \"Execute\" }\n vscode: { matcher: \"run_in_terminal\" }\n github: { enabled: false }\n }\n }\n}\n```\n\nPortable events:\n\n| Event | Meaning |\n| ---------------------- | ------------------------- |\n| `pre-terminal-command` | Before a terminal command |\n| `pre-tool-use` | Before a tool invocation |\n| `post-tool-use` | After a tool invocation |\n| `session-start` | Agent session start |\n| `setup` | Session setup |\n| `subagent-start` | Subagent start |\n| `notification` | Agent notification |\n| `stop` | Agent stop |\n\n`command` is a non-empty string array. Shell interpolation (`$()`, backticks,\n`${...}`) is forbidden. `script` requires:\n\n- `path` under `.promptscript/scripts/`, using forward slashes.\n- Existing regular file at compile time.\n- No traversal, absolute path, invalid segment, or symlink escape.\n- Explicit interpreter: `python3`, `python`, `node`, `deno`, `bun`, `ruby`, `php`,\n `perl`, `bash`, `sh`, `zsh`, `pwsh`, or `powershell`.\n- Optional `args` string array; each argument remains one argument.\n\n`cwd: \"project\"` runs from project root. Other values are portable forward-slash\npaths relative to project root. Hook config file location does not set command cwd.\nEnvironment-root and Git-root wrappers exit before script or command execution when\nthe required root is unavailable. Native-cwd and workspace-cwd targets retain host\ncwd fields and report `PS4002` when PromptScript cannot verify that cwd.\n`timeoutMs` range is 100-600000. `matcher` uses target-native tool names, so a\nmatcher valid for one target may match nothing on another.\n\n`pre-terminal-command` supplies native defaults: Factory `Execute`, Claude and\nCodex `Bash`, Windsurf `pre_run_command`, Cursor `run_terminal_cmd`, Gemini\n`run_shell_command`, and VS Code `run_in_terminal`. Override a native tool name\nwith `targets.<name>.matcher`. Cursor, Gemini, and VS Code report best-effort\n`PS4002` warnings. GitHub and Grok omit the event with `PS4002`.\n\nTarget overrides may change `event`, `matcher`, `timeoutMs`, `statusMessage`,\n`continueOnFailure`, `enabled`, or `cwd`. Native hook files are emitted only in\ntarget modes that support additional files:\n\n| Target | Hook output | Mode |\n| -------------- | ---------------------------------------------------------------------- | ------------------- |\n| Claude Code | `.claude/settings.json` | `full` |\n| Factory AI | `.factory/hooks.json` | `multifile`, `full` |\n| GitHub Copilot | `.github/hooks/promptscript.json` | `multifile`, `full` |\n| Cursor | `.cursor/hooks.json` | `full` |\n| Codex | `.codex/hooks.json` | `multifile`, `full` |\n| Gemini CLI | `.gemini/settings.json` | `multifile`, `full` |\n| Windsurf | `.windsurf/hooks.json` | `multifile`, `full` |\n| Grok Build | `.grok/hooks/promptscript.json` | `full` |\n| OpenCode | `.opencode/plugins/promptscript.ts` (generated plugin) | `multifile`, `full` |\n| VS Code Agent | `.github/hooks/promptscript-vscode.json` when `vscode` override exists | target-specific |\n\nOpenCode starts generated hook commands asynchronously. It enforces authored\ntimeouts or a 30-second default, then escalates from `SIGTERM` to `SIGKILL`.\nPayloads are bounded by UTF-8 byte length. OpenCode tool hooks expose tool\narguments, session ID, and call ID, but no model or agent context; compilation\nreports that limitation with `PS4002`.\n\nSimple mode and targets without native project hooks report `PS4002` instead of\nsilently dropping hooks. Use `prs compile --watch` as fallback. Plugin-only and\nagent-scoped integrations are not emitted as universal project hooks.\n\nEach generated command carries a PromptScript ownership marker. CLI cleanup removes\nonly marked entries and preserves user hooks/settings. Removing `@hooks` removes a\nfully owned generated hook file and prunes directories left empty. `prs hooks install factory`\nmigrates unambiguous legacy hooks from `.factory/settings.json`; ambiguous\nentries remain for manual review.\n\nFactory compilation performs the same migration when `.factory/hooks.json` is\nabsent. Use `prs compile --dry-run` to preview the changes or\n`--no-migrate-factory-hooks` to keep warning-only behavior. Unknown events,\nmalformed entries, and mixed ownership abort without a partial migration.\n\n`@hooks` compilation is separate from `prs hooks install`. The latter installs\nauto-compilation and generated-output protection for supported AI tools. Copilot VS\nCode Agent hooks use `promptscript-vscode.json`; GitHub Copilot repository hooks use\n`promptscript.json`.\n\n### @mcpServers\n\nProject-local Model Context Protocol servers. Requires syntax `1.4.0`.\n\n```\n@mcpServers {\n issue-tracker: {\n transport: \"stdio\"\n command: [\"node\", \"./tools/issues.mjs\"]\n env: { LOG_LEVEL: \"info\" }\n }\n}\n```\n\nUse `stdio` with `command`, or `http`/`sse` with `url`. Keep credentials out of\n`.prs` files and provide them through target-native secret management.\n\n### @plugins\n\nPortable capability bundles. Requires syntax `1.4.0`.\n\n```\n@plugins {\n security-suite: {\n description: \"Security review tooling\"\n version: \"1.0.0\"\n skills: [\"security-review\"]\n hooks: [\"validate-types\"]\n mcpServers: [\"issue-tracker\"]\n }\n}\n```\n\n### @local\n\nPrivate local configuration. Not included in compiled output or committed to git.\n\n## Inheritance and Composition\n\n### @inherit (single, linear)\n\nOne per file. Child blocks merge on top of parent:\n\n```\n@inherit @company/frontend-team\n@inherit ./parent\n@inherit @stacks/react-app(projectName: \"my-app\", port: 3000)\n```\n\n### @use (multiple, mixins)\n\nImport and merge fragments:\n\n```\n@use @core/security\n@use @core/quality\n@use ./local-config\n@use @core/typescript as ts # alias enables @extend access\n```\n\n#### URL imports (Go-module style)\n\nImport directly from any Git repository by host path - no alias required:\n\n```\n@use github.com/acme/shared-standards/@fragments/security\n@use gitlab.com/myorg/prompts/@stacks/python\n```\n\nVersion pinning with `@`:\n\n```\n@use github.com/acme/shared-standards/@org/base@1.2.0 # exact version\n@use github.com/acme/shared-standards/@org/base@^1.0.0 # semver range\n@use github.com/acme/shared-standards/@org/base@main # branch\n```\n\n#### Registry aliases\n\nShort names for Git repository URLs, configured in `promptscript.yaml`:\n\n```yaml\nregistries:\n company:\n url: github.com/acme/promptscript-registry\n```\n\nThen use the alias as scope prefix:\n\n```\n@use @company/security\n@inherit @company/base-config\n```\n\nMerge rules:\n\n- Text: concatenated with deduplication\n- Objects: deep merged (imported source wins same-shape conflicts)\n- Arrays: unique concatenation\n- Shape mismatch: existing target body wins\n\nUnder syntax `1.5.0`, later local blocks, `@extend`, and `@override`\noperations apply to the accumulated import result in declaration order.\n\n### Block Filtering\n\nControl which blocks are imported using the reserved `only` and `exclude` parameters:\n\n```\n@use ./shared-config(only: [\"skills\", \"context\"])\n@use ./shared-config(exclude: [\"knowledge\"])\n@use ./shared-config(exclude: [\"knowledge\"], mode: \"strict\")\n```\n\nRules:\n\n- `only` and `exclude` are mutually exclusive \u2014 using both is a validation error (PS021)\n- Values are block type names: `identity`, `context`, `standards`, `knowledge`, `skills`, `shortcuts`, `agents`, etc.\n- Block filtering does not apply to `@inherit` directives\n\n### Markdown Imports\n\nImport skills directly from `.md` files (v1.8+). No external tools needed:\n\n```\n@use ./skills/frontend-design.md\n@use ./shared/commit.md as commit\n@use github.com/anthropics/skills/commit@1.0.0\n@use github.com/repo/skills/gitnexus # directory \u2192 SKILL.md\n```\n\nContent detection: PromptScript blocks in `.md` are parsed as a `.prs` fragment;\nYAML frontmatter with `name`/`description` is loaded as a skill definition;\notherwise content is treated as free-form knowledge.\n\nCLI management:\n\n```\nprs skills add github.com/anthropics/skills/commit@1.0.0\nprs skills remove commit\nprs skills list\nprs skills update\n```\n\n### @extend (modify existing or imported blocks)\n\nUse a direct path for inherited or local blocks:\n\n```\n@extend standards.testing {\n coverage: 95\n}\n```\n\nUse an alias when targeting a specific imported block:\n\n```\n@use @core/typescript as ts\n\n@extend ts.standards {\n testing: { coverage: 95 }\n}\n```\n\n#### Replacing regular block fields\n\nSyntax `1.3.0` supports explicit replacement of complete regular block field values:\n\n```\n@meta { id: \"project\" syntax: \"1.3.0\" }\n\n@inherit ./company-base\n\n@extend standards {\n testing!: [\"Use Vitest\"]\n linting: [\"Use ESLint\"]\n}\n```\n\n`testing!` replaces the inherited value. Fields without `!` keep normal merge behavior.\nReplacement works after `@inherit` and `@use`, including aliases and nested target paths.\nA missing field is set. The modifier is rejected for `@skills`, which retain their dedicated\nmerge and sealing semantics.\n\n#### Replacing complete targets with @override\n\nSyntax `1.5.0` adds atomic replacement for an existing block or nested value:\n\n```\n@meta { id: \"project\" syntax: \"1.5.0\" }\n\n@standards {\n testing: [\"Use Jest\", \"Use Mocha\"]\n}\n\n@override standards.testing {\n [\"Use Vitest\"]\n}\n```\n\n`@override` requires the complete target path to exist, applies in declaration\norder, and cannot bypass sealed skill properties. Later `@extend` declarations\nmerge into the replacement. Use `@extend` for additive changes, `field!` for\ncompatibility replacement of one direct regular field, and `@override` for\nintentional complete replacement.\n\n#### Skill-aware @extend semantics\n\nWhen extending a skill definition via `@extend`, individual skill properties follow specific merge\nstrategies rather than the generic block merge rules:\n\n| Strategy | Properties |\n| ----------------- | ----------------------------------------------------------------------------------------------------------- |\n| **Replace** | content, description, trigger, userInvocable, allowedTools, disableModelInvocation, context, agent, license |\n| **Append** | references, examples, requires |\n| **Shallow merge** | params, inputs, outputs |\n\nExample \u2014 extending a base skill to add references and override content:\n\n```\n@use @company/skills as skills\n\n@extend skills.code-review {\n content: (triple-quoted text with overridden instructions)\n references: [\n ./extra-context.md\n ]\n}\n```\n\nThe `references` array from the base skill and the overlay are combined (append). The `content`\nfield from the overlay replaces the base (replace).\n\n#### Reference negation\n\nUse `!` prefix in `@extend` to remove entries from a lower layer's append-strategy arrays:\n\n```\n@extend skills.code-review {\n references: [\n \"!references/deprecated.md\"\n \"references/replacement.md\"\n ]\n}\n```\n\nPath matching is normalized (`\"!./foo.md\"` matches `\"foo.md\"`). Only works in `@extend` blocks\non `references` and `requires`. Validator PS028 warns about `!` in base definitions.\n\n#### Overlay consistency warnings\n\nThe resolver emits warnings during compile when an overlay drifts from its base. Always shown\n(not gated by `--verbose`):\n\n- **Orphaned extend** \u2014 `@extend target \"X\" not found \u2014 overlay will be ignored.` Triggered when\n the targeted block doesn't exist (base removed or renamed).\n- **Stale skill target** \u2014 `@extend creates new skill \"X\" \u2014 base does not define it.` Triggered\n when an `@extend` inside `@skills` would create a new skill instead of extending an existing one.\n- **Negation orphan** \u2014 `Negation \"!path\" did not match any base entry \u2014 it may be stale.`\n Triggered when a `!entry` in references/requires doesn't match anything in the base.\n\nThese come from the resolver, not the validator (PS0XX rules). They appear during `prs compile`,\nnot `prs validate`.\n\n#### Sealed properties\n\nPrevent `@extend` from overriding specified replace-strategy properties:\n\n```\n@skills {\n deploy: {\n content: (triple-quoted text with critical workflow)\n sealed: [\"content\", \"description\"]\n }\n}\n```\n\n`sealed: true` seals all replace-strategy properties. Attempting to override a sealed\nproperty is a hard compilation error. Only the base skill author can set `sealed` \u2014\noverlays cannot add or modify it. Append-strategy properties remain extendable.\nValidator PS029 warns about invalid entries in `sealed`.\n\n#### Skill composition (inline @use)\n\nImport sub-skills within a `@skills` block to compose multi-phase workflows:\n\n```\n@skills {\n ops: {\n description: \"Production triage\"\n content: (triple-quoted text with orchestrator instructions)\n }\n @use ./phases/health-scan\n @use ./phases/triage\n @use ./phases/code-fix as autofix\n}\n```\n\nEach `@use` resolves the referenced `.prs` file, extracts its skill definition and context\nblocks, and flattens them as numbered phase sections into the parent skill's content. The\n`as alias` form controls the phase display name. Validator PS027 checks composition validity.\n\n### Parameterized Inheritance (Template Variables)\n\nUse `{{variable}}` placeholders in a **parent/template** file, and pass values\nfrom the **child** file via `@inherit` or `@use` with `(key: value)` syntax.\n\n**IMPORTANT:** Variables are NOT set from `promptscript.yaml` or CLI. They are\npassed from one `.prs` file to another through `@inherit` or `@use`.\n\n**Step 1: Create the template** (parent file with `params` in `@meta`):\n\n```\n# base.prs - reusable template\n@meta {\n id: \"service-template\"\n syntax: \"1.0.0\"\n params: {\n serviceName: string\n port?: number = 3000\n }\n}\n\n@identity {\n \"\"\"\n You are working on {{serviceName}} running on port {{port}}.\n \"\"\"\n}\n```\n\n**Step 2: Inherit with values** (child file passes params):\n\n```\n# project.prs - concrete project\n@meta { id: \"user-api\" syntax: \"1.0.0\" }\n\n@inherit ./base(serviceName: \"user-api\", port: 8080)\n```\n\nAfter compilation, `{{serviceName}}` becomes `user-api` and `{{port}}` becomes `8080`.\n\nThe same works with `@use`:\n\n```\n@use ./base(serviceName: \"auth-service\") as auth\n```\n\n**Parameter types:** `string`, `number`, `boolean`, `enum(\"a\", \"b\")`.\nOptional params use `?` suffix. Defaults use `= value`.\nMissing required params produce a compile error.\n\n**Multi-service pattern** - reuse one template across many projects:\n\n```\nservices/\n base.prs # template with params\n user-api/\n promptscript.yaml # source: project.prs\n project.prs # @inherit ../base(serviceName: \"user-api\")\n auth-service/\n promptscript.yaml\n project.prs # @inherit ../base(serviceName: \"auth-service\")\n```\n\n## Configuration: promptscript.yaml\n\n### Auto-injection\n\nThis skill is automatically included when compiling with `prs compile`. No manual copying needed.\nTo disable, set `includePromptScriptSkill: false` in your `promptscript.yaml`.\n\n```\nid: my-project\nsyntax: \"1.1.0\"\ndescription: \"My project description\"\ninput:\n entry: .promptscript/project.prs\n include: ['.promptscript/**/*.prs']\ntargets:\n github:\n version: full # simple | multifile | full\n claude:\n version: full\n cursor:\n version: standard\n antigravity:\n version: frontmatter\n factory:\n version: full\n windsurf: # 41 additional targets supported\n version: simple\n cline:\n version: simple\nregistry:\n git: https://github.com/org/registry.git\n ref: main\nregistries:\n company:\n url: github.com/acme/promptscript-registry\n oss:\n url: github.com/prscrpt/community-registry\n ref: v2\npolicies:\n - name: adjacent-layers-only\n kind: layer-boundary\n severity: error\n layers: ['@core', '@team', '@project']\n maxDistance: 1\n```\n\n### Lockfile: `promptscript.lock`\n\nWhen remote imports are used, run `prs lock` to generate or update the lockfile\nbefore compilation. It records the exact resolved commit for each dependency.\nIntegrity hashes (SHA-256) are included for registry references to detect\ntampering or drift. This enables reproducible builds across machines and CI.\nCommit `promptscript.lock` to version control.\n\nUse `--ignore-hashes` on `prs compile` or `prs validate` to skip integrity\nhash verification when needed.\n\n### Policy Engine\n\nDefine organizational policies in `promptscript.yaml` to validate skill extensions:\n\n```yaml\npolicies:\n - name: adjacent-layers-only\n kind: layer-boundary\n description: 'Only adjacent layers can extend each other'\n severity: error\n layers: ['@core', '@team', '@project']\n maxDistance: 1\n\n - name: protect-content\n kind: property-protection\n description: 'Content override requires explicit approval'\n severity: warning\n properties: ['content', 'description']\n\n - name: approved-registries\n kind: registry-allowlist\n description: 'Extensions must come from approved registries'\n severity: error\n allowed: ['@core', '@team']\n```\n\nPolicy kinds: `layer-boundary` (controls layer distance), `property-protection`\n(prevents overriding specific properties), `registry-allowlist` (restricts extension sources).\nSeverity: `error` (fails validation) or `warning` (reported only).\nSkip with `--skip-policies` during development (never in CI).\n\n## Syntax Version Validation\n\nThe `syntax` field in `@meta` declares the PromptScript language version (semver).\n\n### Known Versions\n\n| Version | What it adds |\n| ------- | ----------------------------------------------------------------------------------------------------------------------- |\n| `1.0.0` | Core blocks (identity, context, standards, restrictions, knowledge, shortcuts, commands, guards, params, skills, local) |\n| `1.1.0` | Adds `@agents` and `@workflows`; reserves internal `@prompts` |\n| `1.2.0` | Adds `@examples` (few-shot input/output pairs) |\n| `1.3.0` | Adds explicit regular block field replacement in `@extend` |\n| `1.4.0` | Adds `@hooks`, `@mcpServers`, and `@plugins` |\n| `1.5.0` | Adds `@header` section titles, `@override` replacement, and unquoted `${VAR}` values |\n\n### Block Version Requirements\n\n| Block | Minimum Syntax Version |\n| ------------- | ---------------------- |\n| `@agents` | `1.1.0` |\n| `@workflows` | `1.1.0` |\n| `@examples` | `1.2.0` |\n| `@hooks` | `1.4.0` |\n| `@mcpServers` | `1.4.0` |\n| `@plugins` | `1.4.0` |\n\nAll other built-in blocks are available from `1.0.0`.\nRegular block field replacement with `field!: value` requires syntax `1.3.0`.\nGenerated section title overrides with `@header` require syntax `1.5.0`.\nAtomic replacement with `@override` requires syntax `1.5.0`.\nUnquoted `${VAR}` references as values require syntax `1.5.0`.\n\n### Generated Section Headers\n\nUse `@header` inside a registered owner block to rename human-readable output\nsections without changing filenames, frontmatter, XML tags, or structured keys:\n\n```promptscript\n@meta { id: \"localized\" syntax: \"1.5.0\" }\n\n@standards {\n @header \"Coding Rules\"\n @header git-commits \"Commit Rules\"\n code: [\"Use strict TypeScript\"]\n}\n```\n\n- `@header \"Title\"` targets the block's primary section.\n- `@header <section-key> \"Title\"` targets an owned derived section.\n- Titles must be non-empty, single-line strings.\n- Source overrides take precedence over formatter configuration and target defaults.\n- Child inheritance, imported source, and the latest root extension take precedence.\n- An initial `## Heading` in a registered text-only primary owner is a syntax\n `1.5.0` compatibility fallback. Explicit `@header` metadata wins.\n- Ordinary `header` and `headers` fields remain domain data.\n\n### Validation Rules\n\n- **PS018 (`syntax-version-compat`)**: warns when resolved blocks or syntax features require a higher version than declared. Requirements from inheritance, imports, and skill composition are included. Suggestion: run `prs validate --fix`.\n- **PS019 (`unknown-block-name`)**: warns when a block name is not a known PromptScript type, with fuzzy-match suggestions for typos.\n- **PS037 (`valid-section-headers`)**: rejects invalid titles, unknown or unowned section keys, duplicate overrides, and nested extension overrides.\n- **PS038 (`valid-block-shape`)**: rejects unsupported built-in block shapes and warns about formatter-sensitive legacy shapes or multiline shortcut scalars.\n- **PS039 (`agent-namespaces`)**: validates qualified agent name segments and checks them against recorded import provenance.\n- **PS040 (`import-excludes`)**: errors when a `validation.excludes` entry for an import does not record the commit pinned in promptscript.lock, so consumers re-review imports whose pinned commit changed.\n- **PS021 (`use-block-filter`)**: errors when `only` and `exclude` are both specified in `@use` parameters.\n- **PS025 (`valid-skill-references`)**: errors when a `references` entry points to a file with a disallowed extension or a path that cannot be resolved.\n- **PS026 (`safe-reference-content`)**: warns when a referenced file contains potentially sensitive content (e.g., secrets, credentials).\n- **PS027 (`valid-skill-composition`)**: warns about conflicting phase names or excessive phases in composed skills.\n- **PS028 (`valid-append-negation`)**: warns when negation prefix `!` appears in base skill definitions (only effective in `@extend`).\n- **PS029 (`valid-sealed-property`)**: warns when `sealed` contains non-replace-strategy property names.\n- **PS030 (`policy-compliance`)**: validates skill extensions against organizational policies defined in `promptscript.yaml`.\n- **PS034 (`valid-hooks`)**: validates portable hook events, commands/scripts, paths, interpreters, timeouts, cwd, and target overrides.\n\nTarget formatters report **PS4002** when a hook event or field has no native equivalent,\nwhen a target cannot guarantee project-root execution, or when output mode cannot emit\nthe additional hook file.\n\n### Fixing Syntax Versions\n\n```\nprs validate --fix # Auto-fix syntax versions in .prs files\nprs upgrade # Upgrade all .prs files to the latest version\n```\n\n`--fix` rewrites the `syntax: \"...\"` line in each file's `@meta` block to match the minimum version required by resolved blocks and syntax features. It follows inheritance, imports, and skill composition. It only upgrades, never downgrades.\n\n`prs upgrade` upgrades all files to the latest known syntax version regardless of what blocks they use.\n\n## CLI Commands\n\n```\nprs init # Initialize project (auto-detects existing files)\nprs init --yes --targets claude factory\nprs init --dry-run # Preview initialization\nprs init --auto-import # Initialize + static import of existing files\nprs migrate # Interactive migration flow\nprs migrate --static # Non-interactive static import\nprs migrate --llm # Generate AI-assisted migration prompt\nprs migrate --static --dry-run\nprs compile # Compile to all targets\nprs compile --watch # Watch mode\nprs compile --ignore-hashes # Skip integrity hash verification\nprs build <name> # Compile a named build profile\nprs validate --strict # Validate syntax\nprs validate --fix # Auto-fix syntax version declarations\nprs validate --skip-policies # Skip policy engine evaluation\nprs upgrade # Upgrade all .prs files to latest syntax version\nprs import CLAUDE.md # Import existing AI instructions\nprs import CLAUDE.md --dry-run # Preview import conversion\nprs inspect <skill> # Show skill composition provenance\nprs inspect <skill> --layers # Show layer-level breakdown\nprs explain <path> # Explain source and composition provenance\nprs explain <path> --format json # Machine-readable provenance history\nprs hooks install # Install auto-compilation hooks for AI tools\nprs hooks install claude # Install hooks for a specific tool\nprs hooks uninstall # Remove installed auto-compilation hooks\nprs hooks uninstall claude # Remove hooks for a specific tool\nprs skills add <source> # Add a remote skill (@use + lock update + SKILL.md validation)\nprs skills add <source> --strict # Treat validation warnings as errors\nprs skills add <source> --skip-validation # Bypass Agent Skills spec checks (not recommended)\nprs skills remove <name> # Remove a skill (@use line + lock entry)\nprs skills list # List all imported skills\nprs skills update # Re-resolve markdown-imported skills (re-validates + re-hashes)\nprs pull # Update registry\nprs diff --target claude # Show compilation diff\nprs diff --all --format json # Machine-readable diff report for CI\nprs diff --format json --include-content # Include generated content in the report\nprs lock # Generate/update promptscript.lock\nprs lock --dry-run # Preview lockfile changes\nprs update # Re-resolve all remote imports to latest\nprs update <url> # Update a specific registry\nprs vendor sync # Copy cached deps to .promptscript/vendor/\nprs vendor check # Verify vendor matches lockfile\nprs resolve @alias/path # Debug: show how an import resolves\nprs registry list # Show configured registries and aliases\nprs registry add <alias> <url> # Add a registry alias\n```\n\n`prs init --yes` requires explicit, detected, or user-configured targets. It does not invent\ndefault tools. For existing projects, `prs migrate` preserves `promptscript.yaml`, isolates static\noutput under `.promptscript/migrated/`, leaves source instructions untouched, and performs no\nwrites when no candidates are detected.\n\n## Output Targets\n\n50 supported targets. Key examples:\n\n| Target | Main File | Skills |\n| ----------- | ------------------------------- | -------------------------------------------------- |\n| GitHub | .github/copilot-instructions.md | .github/skills/\\*/SKILL.md |\n| Claude | CLAUDE.md | .claude/skills/\\*/SKILL.md |\n| Cursor | .cursor/rules/project.mdc | .agents/skills/\\*/SKILL.md |\n| Antigravity | .agent/rules/project.md | - |\n| Factory | AGENTS.md | .factory/skills/\\*/SKILL.md, .factory/droids/\\*.md |\n| OpenCode | OPENCODE.md | .opencode/skills/\\*/SKILL.md |\n| Gemini | GEMINI.md | .agents/skills/\\*/skill.md |\n| Windsurf | .windsurf/rules/project.md | .windsurf/skills/\\*/SKILL.md |\n| Cline | .clinerules | - |\n| Roo Code | .roorules | - |\n| Codex | AGENTS.md | .agents/skills/\\*/SKILL.md |\n| Continue | .continue/rules/project.md | - |\n| Hermes | AGENTS.md | - |\n| + 37 more | | See full list in documentation |\n\nTargets that share an output path (for example Factory, Codex, and every AGENTS.md target) are\nreconciled in one output plan before anything is written. Identical content merges silently;\ndiffering content reports `PS4001`, where a formatter output replaces an earlier one and a\nresource or the auto-injected PromptScript skill keeps the file already planned. Paths are compared\ncase-insensitively and NFC-normalized on every platform.\n\n### Formatter Documentation\n\nFor detailed information about each formatter's output paths, supported features, quirks, and example outputs:\n\n- **Full formatter reference:** `docs/reference/formatters/` (7 dedicated pages + index of all 50)\n- **llms-full.txt:** Available at the docs site root - contains all documentation in a single file for LLM consumption\n- **Dedicated pages exist for:** Claude Code, GitHub Copilot, Cursor, Antigravity, Factory AI, Gemini CLI, OpenCode\n- **All 50 formatters indexed at:** `docs/reference/formatters/index.md` with output paths, tier, and feature flags\n\n### Auto-Compilation Hooks\n\nInstead of running `prs compile --watch` manually, install hooks so your AI tool\ntriggers compilation automatically when you edit `.prs` files:\n\n```\nprs hooks install # Auto-detect and install for all detected tools\nprs hooks install claude # Install for a specific tool\n```\n\nHooks also protect generated files from direct edits \u2014 when an AI agent tries\nto edit a compiled output (e.g., CLAUDE.md), the write is blocked with a message\npointing to the source `.prs` file. Supported tools: Claude Code, Factory AI,\nCursor, Windsurf, Cline, GitHub Copilot, Gemini CLI.\n\n## Project Organization\n\nTypical modular structure:\n\n```\n.promptscript/\n project.prs # Entry: @meta, @inherit, @use, @identity, @agents\n context.prs # @context (architecture, tech stack)\n standards.prs # @standards (coding conventions)\n restrictions.prs # @restrictions (hard rules)\n commands.prs # @shortcuts and @knowledge\n```\n\nThe entry file uses `@use ./context`, `@use ./standards`, etc. to compose them.\n\n## Common Mistakes\n\n1. Missing @meta block - every .prs file needs `@meta` with `id` and `syntax`\n2. Multiple @inherit - only one per file; use `@use` for additional imports\n3. Extending an unknown path - target an inherited or local block, or use an imported alias\n4. Unquoted strings with special chars - quote strings containing `:`, `#`, `{`, `}`\n5. Forgetting to compile - `.prs` changes need `prs compile` to take effect\n6. Triple quotes inside triple quotes - not supported; describe content textually instead\n7. Using `{{var}}` in the root file without `@inherit` - template variables only work\n in a parent file that defines `params` in `@meta`, with values passed by the child\n via `@inherit ./parent(key: value)` or `@use ./fragment(key: value)`. They are NOT\n set from `promptscript.yaml` or CLI flags\n8. Using `@examples` with `syntax: \"1.0.0\"` or `\"1.1.0\"` - `@examples` requires\n syntax version `1.2.0`. Run `prs validate --fix` to auto-upgrade\n\n## Migrating Existing AI Instructions to PromptScript\n\n### Automated: `prs import`\n\nThe fastest way to convert existing AI instructions to PromptScript:\n\n```\nprs import CLAUDE.md # Convert a single file\nprs import .github/copilot-instructions.md\nprs import AGENTS.md --output ./imported\nprs import --dry-run CLAUDE.md # Preview without writing\n```\n\n`prs import` automatically:\n\n- Detects the source format (Claude, GitHub Copilot, Cursor, Factory, etc.)\n- Maps content to appropriate PromptScript blocks (@identity, @standards, etc.)\n- Generates a valid `.prs` file with `@meta` block\n- Preserves the original intent and structure\n\nSupported source formats:\n\n- `CLAUDE.md` (Claude Code)\n- `.github/copilot-instructions.md` (GitHub Copilot)\n- `.cursorrules` or `.cursor/rules/*.mdc` (Cursor)\n- `AGENTS.md` (Factory AI / Codex)\n- `.clinerules` (Cline), `.roorules` (Roo Code)\n- `.windsurf/rules/*.md` (Windsurf)\n- Any Markdown-based AI instruction file\n\n### Manual Migration\n\nFor complex migrations or when `prs import` needs refinement:\n\n| Source Pattern | PromptScript Block |\n| ----------------------------------- | ------------------ |\n| \"You are...\" persona text | `@identity` |\n| Project description, tech stack | `@context` |\n| Coding conventions, style rules | `@standards` |\n| \"Never...\", \"Always...\", hard rules | `@restrictions` |\n| `/command` definitions | `@shortcuts` |\n| Skill/tool definitions | `@skills` |\n| Agent/subagent configs | `@agents` |\n| Reference docs, API specs | `@knowledge` |\n\nAfter import, split into modular files (`context.prs`, `standards.prs`, etc.)\nand compose with `@use` in `project.prs`. Run `prs validate --strict` then\n`prs compile` to verify output matches the original.\n";
7
+ //# sourceMappingURL=promptscript-skill.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promptscript-skill.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/generated/promptscript-skill.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,ml/CACwv+C,CAAC"}
@@ -0,0 +1,44 @@
1
+ /** Hidden CLI command that dispatches to this worker. */
2
+ export declare const MANAGED_OUTPUT_WORKER_COMMAND = "__managed-output-worker";
3
+ /** Status words reported on stdout, kept identical to the inline scripts. */
4
+ export declare const WORKER_STATUSES: {
5
+ readonly removed: "removed";
6
+ readonly rewritten: "rewritten";
7
+ readonly created: "created";
8
+ readonly ready: "ready";
9
+ readonly skipped: "skipped";
10
+ };
11
+ /** Arguments of one guarded operation, as passed through argv. */
12
+ export interface ManagedOutputOperationArgs {
13
+ name: string;
14
+ directoryDev: string;
15
+ directoryIno: string;
16
+ fileDev?: string;
17
+ fileIno?: string;
18
+ expectedHash?: string;
19
+ requestedMode?: string;
20
+ }
21
+ /**
22
+ * Run one guarded operation and return its status word. Throws on protocol
23
+ * violations (unknown operation, missing arguments) and unexpected
24
+ * filesystem errors; callers report them as worker failures.
25
+ *
26
+ * Argument positions are flat and operation-specific, exactly like the
27
+ * inline scripts this worker replaced.
28
+ *
29
+ * `stdinContent` lets in-process callers (tests) supply the file content
30
+ * directly; spawned workers leave it undefined and the worker reads fd 0.
31
+ */
32
+ export declare function performManagedOutputOperation(op: string, args: string[], stdinContent?: Buffer): string;
33
+ /**
34
+ * Run the worker protocol for a full argument list (`<op> <args...>`).
35
+ * Returns the process exit code: 0 when the operation reported a status
36
+ * word, 1 on unexpected failures.
37
+ */
38
+ export declare function runManagedOutputWorkerProtocol(opArgs: string[], stdinContent?: Buffer): number;
39
+ /**
40
+ * True when this process handled the hidden worker command and already
41
+ * finished. The CLI runner checks this before parsing arguments.
42
+ */
43
+ export declare function wasDispatchedAsManagedOutputWorker(): boolean;
44
+ //# sourceMappingURL=managed-output-worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"managed-output-worker.d.ts","sourceRoot":"","sources":["../../../../packages/cli/src/managed-output-worker.ts"],"names":[],"mappings":"AAsCA,yDAAyD;AACzD,eAAO,MAAM,6BAA6B,4BAA4B,CAAC;AAEvE,6EAA6E;AAC7E,eAAO,MAAM,eAAe;;;;;;CAMlB,CAAC;AAEX,kEAAkE;AAClE,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAyND;;;;;;;;;;GAUG;AACH,wBAAgB,6BAA6B,CAC3C,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EAAE,EACd,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,CA6BR;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAW9F;AAgBD;;;GAGG;AACH,wBAAgB,kCAAkC,IAAI,OAAO,CAE5D"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Runtime detection for the CLI.
3
+ *
4
+ * The CLI runs on Node.js and, since issue #486, on Deno - both through
5
+ * `deno run npm:@promptscript/cli` and as a `deno compile` standalone binary.
6
+ * Callers branch on this information to decide how to re-execute this
7
+ * process (see self-invocation.ts) and which runtime to report in telemetry.
8
+ */
9
+ /** JavaScript runtime hosting the current process. */
10
+ export type RuntimeKind = 'node' | 'deno';
11
+ /** Detected properties of the current runtime. */
12
+ export interface RuntimeInfo {
13
+ /** Runtime hosting this process. */
14
+ runtime: RuntimeKind;
15
+ /**
16
+ * True when running as a `deno compile` standalone binary. Compiled
17
+ * binaries have no filesystem-backed module graph: `import.meta.url`
18
+ * points at an embedded virtual path and there is no package directory.
19
+ */
20
+ standalone: boolean;
21
+ }
22
+ /**
23
+ * Detect the current runtime and, under Deno, whether the process is a
24
+ * compiled standalone binary (`Deno.build.standalone`).
25
+ */
26
+ export declare function getRuntimeInfo(): RuntimeInfo;
27
+ /** Report the full version of the runtime hosting this process. */
28
+ export declare function getRuntimeVersion(): string;
29
+ //# sourceMappingURL=runtime-info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-info.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/runtime/runtime-info.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,sDAAsD;AACtD,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,CAAC;AAE1C,kDAAkD;AAClD,MAAM,WAAW,WAAW;IAC1B,oCAAoC;IACpC,OAAO,EAAE,WAAW,CAAC;IACrB;;;;OAIG;IACH,UAAU,EAAE,OAAO,CAAC;CACrB;AAyBD;;;GAGG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAM5C;AAED,mEAAmE;AACnE,wBAAgB,iBAAiB,IAAI,MAAM,CAQ1C"}
@@ -0,0 +1,22 @@
1
+ /** How to spawn this program again: executable plus argv prefix. */
2
+ export interface SelfInvocation {
3
+ /** Executable to spawn. */
4
+ executable: string;
5
+ /** Arguments placed before the hidden command and operation arguments. */
6
+ prefixArgs: string[];
7
+ }
8
+ /** Options for resolving a self-invocation. */
9
+ export interface SelfInvocationOptions {
10
+ /**
11
+ * Absolute path of the managed output worker module (bundled .js in
12
+ * published layouts, source .ts in development). Not needed when the
13
+ * process is a Deno standalone binary, which re-executes itself instead.
14
+ */
15
+ workerPath: string | undefined;
16
+ }
17
+ /**
18
+ * Resolve how to re-execute this program, or undefined when no safe
19
+ * self-invocation exists (callers must then fail closed).
20
+ */
21
+ export declare function resolveSelfInvocation(options: SelfInvocationOptions): SelfInvocation | undefined;
22
+ //# sourceMappingURL=self-invocation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"self-invocation.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/runtime/self-invocation.ts"],"names":[],"mappings":"AAmBA,oEAAoE;AACpE,MAAM,WAAW,cAAc;IAC7B,2BAA2B;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,0EAA0E;IAC1E,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,+CAA+C;AAC/C,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AA4FD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,qBAAqB,GAAG,cAAc,GAAG,SAAS,CAoBhG"}
package/src/services.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { writeFile, mkdir, readFile, readdir } from 'fs/promises';
2
- import { existsSync, readFileSync } from 'fs';
3
- import type { PathLike, Stats } from 'fs';
1
+ import { writeFile, mkdir, readFile, readdir } from 'node:fs/promises';
2
+ import { existsSync, readFileSync } from 'node:fs';
3
+ import type { PathLike, Stats } from 'node:fs';
4
4
  import * as prompts from '@inquirer/prompts';
5
5
  export interface FileSystem {
6
6
  writeFile: typeof writeFile;
@@ -1 +1 @@
1
- {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../../packages/cli/src/services.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAC1C,OAAO,KAAK,OAAO,MAAM,mBAAmB,CAAC;AAE7C,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,OAAO,SAAS,CAAC;IAC5B,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,QAAQ,EAAE,OAAO,QAAQ,CAAC;IAC1B,OAAO,EAAE,OAAO,OAAO,CAAC;IACxB,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,YAAY,EAAE,OAAO,YAAY,CAAC;IAClC,MAAM,CAAC,EAAE,cAAc,aAAa,EAAE,MAAM,CAAC;IAC7C,EAAE,CAAC,EAAE,cAAc,aAAa,EAAE,EAAE,CAAC;IACrC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC;IAC3C,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAChD;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,OAAO,OAAO,CAAC,KAAK,CAAC;IAC5B,OAAO,EAAE,OAAO,OAAO,CAAC,OAAO,CAAC;IAChC,QAAQ,EAAE,OAAO,OAAO,CAAC,QAAQ,CAAC;IAClC,MAAM,EAAE,OAAO,OAAO,CAAC,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,UAAU,CAAC;IACf,OAAO,EAAE,YAAY,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,iBAAiB,EAAE,UAuB/B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,YAS5B,CAAC;AAEF,eAAO,MAAM,qBAAqB,QAAO,WAIvC,CAAC"}
1
+ {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../../packages/cli/src/services.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,OAAO,MAAM,mBAAmB,CAAC;AAE7C,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,OAAO,SAAS,CAAC;IAC5B,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,QAAQ,EAAE,OAAO,QAAQ,CAAC;IAC1B,OAAO,EAAE,OAAO,OAAO,CAAC;IACxB,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,YAAY,EAAE,OAAO,YAAY,CAAC;IAClC,MAAM,CAAC,EAAE,cAAc,aAAa,EAAE,MAAM,CAAC;IAC7C,EAAE,CAAC,EAAE,cAAc,aAAa,EAAE,EAAE,CAAC;IACrC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC;IAC3C,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAChD;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,OAAO,OAAO,CAAC,KAAK,CAAC;IAC5B,OAAO,EAAE,OAAO,OAAO,CAAC,OAAO,CAAC;IAChC,QAAQ,EAAE,OAAO,OAAO,CAAC,QAAQ,CAAC;IAClC,MAAM,EAAE,OAAO,OAAO,CAAC,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,UAAU,CAAC;IACf,OAAO,EAAE,YAAY,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,iBAAiB,EAAE,UAuB/B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,YAS5B,CAAC;AAEF,eAAO,MAAM,qBAAqB,QAAO,WAIvC,CAAC"}
@@ -1,8 +1,18 @@
1
1
  import type { Command } from 'commander';
2
- import { getSpoolInfo, readFlushState, type ResolvedTelemetryConfig, type TelemetryOutcome } from '@promptscript/telemetry';
2
+ import { getSpoolInfo, readFlushState, type FlushSelfInvocation, type ResolvedTelemetryConfig, type TelemetryOutcome } from '@promptscript/telemetry';
3
3
  export declare function normalizedCommandName(command: Command): string;
4
4
  export declare function commandFeatures(command: Command): string[];
5
5
  export declare function exitOutcome(code: number): TelemetryOutcome;
6
+ /**
7
+ * Resolve how this process re-executes itself for a background flush.
8
+ *
9
+ * Node spawns its entrypoint as before. A deno compile binary re-executes
10
+ * itself with the hidden flush command. Under `deno run` the published npm
11
+ * package is re-run with scoped permissions: env and sys for the CLI, net
12
+ * only for the collector host, reads on the directories the flush child
13
+ * inspects, and writes only on the telemetry spool.
14
+ */
15
+ export declare function resolveFlushSelfInvocation(config: ResolvedTelemetryConfig): FlushSelfInvocation | undefined;
6
16
  export declare function prepareCliTelemetry(command: Command, appVersion: string): Promise<void>;
7
17
  export declare function finishCliTelemetry(outcome?: TelemetryOutcome): void;
8
18
  export declare function flushCliTelemetry(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/telemetry/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EACL,YAAY,EAGZ,cAAc,EAKd,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AAMjC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAU9D;AAYD,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,CA0B1D;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAK1D;AA4BD,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkB7F;AAED,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAMnE;AAED,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAGvD;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC;IAC/C,MAAM,EAAE,uBAAuB,CAAC;IAChC,KAAK,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;IACvC,KAAK,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;CAC1C,CAAC,CAOD"}
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/telemetry/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,EACL,YAAY,EAGZ,cAAc,EAKd,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AASjC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAU9D;AAYD,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,CA0B1D;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAK1D;AA4BD;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,uBAAuB,GAC9B,mBAAmB,GAAG,SAAS,CA8CjC;AAUD,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoB7F;AAED,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAMnE;AAED,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAGvD;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC;IAC/C,MAAM,EAAE,uBAAuB,CAAC;IAChC,KAAK,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;IACvC,KAAK,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;CAC1C,CAAC,CAOD"}
@@ -1,6 +1,11 @@
1
1
  import type { Logger } from '@promptscript/core';
2
2
  /**
3
- * Resolve the bundled PromptScript skill in development and bundled layouts.
3
+ * Resolve the bundled PromptScript skill.
4
+ *
5
+ * The SKILL.md content is embedded at build time (scripts/sync-skill.sh
6
+ * generates src/generated/promptscript-skill.ts), so it is available in
7
+ * every execution mode - including `deno compile` binaries, which have no
8
+ * package directory to discover files in.
4
9
  */
5
10
  export declare function loadBundledSkillContent(logger: Logger): Promise<string | undefined>;
6
11
  //# sourceMappingURL=bundled-skill.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bundled-skill.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/utils/bundled-skill.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAKjD;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAqBzF"}
1
+ {"version":3,"file":"bundled-skill.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/utils/bundled-skill.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGjD;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAGzF"}