@promptscript/cli 1.0.0-alpha.3 → 1.0.0-alpha.4
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 +16 -0
- package/index.js +47 -28
- package/package.json +1 -1
- package/src/commands/compile.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,22 @@ 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-alpha.4](https://github.com/mrwogu/promptscript/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2026-01-27)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### ⚠ BREAKING CHANGES
|
|
12
|
+
|
|
13
|
+
* **compiler:** Generated files now have compact marker instead of verbose header. Existing files with legacy marker still recognized.
|
|
14
|
+
|
|
15
|
+
### chore
|
|
16
|
+
|
|
17
|
+
* prepare alpha release ([8c3a428](https://github.com/mrwogu/promptscript/commit/8c3a428856bc088fb27a4fdd6a16185fe5e63589))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **compiler:** add compact PromptScript marker to all outputs ([6d74480](https://github.com/mrwogu/promptscript/commit/6d744800a4ab38030b6c23b2ab949c79977ab12e))
|
|
23
|
+
|
|
8
24
|
## [1.0.0-alpha.3](https://github.com/mrwogu/promptscript/compare/v1.0.0-alpha.2...v1.0.0-alpha.3) (2026-01-27)
|
|
9
25
|
|
|
10
26
|
|
package/index.js
CHANGED
|
@@ -2064,8 +2064,6 @@ var GitHubFormatter = class extends BaseFormatter {
|
|
|
2064
2064
|
const lines = [];
|
|
2065
2065
|
lines.push("# Agent Instructions");
|
|
2066
2066
|
lines.push("");
|
|
2067
|
-
lines.push("> Auto-generated by PromptScript");
|
|
2068
|
-
lines.push("");
|
|
2069
2067
|
const identityText = this.extractText(identity2.content);
|
|
2070
2068
|
if (identityText) {
|
|
2071
2069
|
lines.push("## Identity");
|
|
@@ -2225,16 +2223,8 @@ var GitHubFormatter = class extends BaseFormatter {
|
|
|
2225
2223
|
const knowledge = this.knowledge(ast, renderer);
|
|
2226
2224
|
if (knowledge) sections.push(knowledge);
|
|
2227
2225
|
}
|
|
2228
|
-
header(
|
|
2229
|
-
|
|
2230
|
-
const syntax = this.getMetaField(ast, "syntax") ?? "0.0.0";
|
|
2231
|
-
return `# GitHub Copilot Instructions
|
|
2232
|
-
|
|
2233
|
-
> Auto-generated by PromptScript
|
|
2234
|
-
> Source: ${id} (syntax ${syntax})
|
|
2235
|
-
> Generated: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
2236
|
-
>
|
|
2237
|
-
> **Do not edit manually**`;
|
|
2226
|
+
header(_ast) {
|
|
2227
|
+
return `# GitHub Copilot Instructions`;
|
|
2238
2228
|
}
|
|
2239
2229
|
project(ast, renderer) {
|
|
2240
2230
|
const identity2 = this.findBlock(ast, "identity");
|
|
@@ -4068,17 +4058,8 @@ var AntigravityFormatter = class extends BaseFormatter {
|
|
|
4068
4058
|
formatWorkflowTitle(name) {
|
|
4069
4059
|
return name.replace(/^\//, "").split(/[-_]/).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
4070
4060
|
}
|
|
4071
|
-
header(
|
|
4072
|
-
|
|
4073
|
-
const syntax = this.getMetaField(ast, "syntax") ?? "0.0.0";
|
|
4074
|
-
return `# Project Rules
|
|
4075
|
-
|
|
4076
|
-
> Auto-generated by PromptScript
|
|
4077
|
-
> Source: ${id} (syntax ${syntax})
|
|
4078
|
-
> Generated: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
4079
|
-
>
|
|
4080
|
-
> **Do not edit manually** - these rules are generated from PromptScript.
|
|
4081
|
-
> To modify, update the source .prs file and recompile.`;
|
|
4061
|
+
header(_ast) {
|
|
4062
|
+
return `# Project Rules`;
|
|
4082
4063
|
}
|
|
4083
4064
|
identity(ast, _renderer) {
|
|
4084
4065
|
const identity2 = this.findBlock(ast, "identity");
|
|
@@ -16878,6 +16859,39 @@ var Validator = class {
|
|
|
16878
16859
|
};
|
|
16879
16860
|
|
|
16880
16861
|
// packages/compiler/src/compiler.ts
|
|
16862
|
+
function generateMarker() {
|
|
16863
|
+
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
16864
|
+
return `<!-- PromptScript ${timestamp} - do not edit -->`;
|
|
16865
|
+
}
|
|
16866
|
+
function addMarkerToOutput(output) {
|
|
16867
|
+
const { content, path } = output;
|
|
16868
|
+
if (content.includes("<!-- PromptScript")) {
|
|
16869
|
+
return output;
|
|
16870
|
+
}
|
|
16871
|
+
const marker = generateMarker();
|
|
16872
|
+
if (!path.endsWith(".md") && !path.endsWith(".mdc")) {
|
|
16873
|
+
return output;
|
|
16874
|
+
}
|
|
16875
|
+
if (content.startsWith("---")) {
|
|
16876
|
+
const closingIndex = content.indexOf("---", 3);
|
|
16877
|
+
if (closingIndex !== -1) {
|
|
16878
|
+
const beforeMarker = content.slice(0, closingIndex + 3);
|
|
16879
|
+
const afterMarker = content.slice(closingIndex + 3);
|
|
16880
|
+
const newContent = `${beforeMarker}
|
|
16881
|
+
|
|
16882
|
+
${marker}
|
|
16883
|
+
${afterMarker.replace(/^\n+/, "\n")}`;
|
|
16884
|
+
return { ...output, content: newContent };
|
|
16885
|
+
}
|
|
16886
|
+
}
|
|
16887
|
+
const lines = content.split("\n");
|
|
16888
|
+
if (lines[0]?.startsWith("# ")) {
|
|
16889
|
+
lines.splice(1, 0, "", marker);
|
|
16890
|
+
} else {
|
|
16891
|
+
lines.unshift(marker, "");
|
|
16892
|
+
}
|
|
16893
|
+
return { ...output, content: lines.join("\n") };
|
|
16894
|
+
}
|
|
16881
16895
|
var Compiler = class _Compiler {
|
|
16882
16896
|
constructor(options) {
|
|
16883
16897
|
this.options = options;
|
|
@@ -16948,10 +16962,10 @@ var Compiler = class _Compiler {
|
|
|
16948
16962
|
try {
|
|
16949
16963
|
const formatOptions = this.getFormatOptionsForTarget(formatter.name, config);
|
|
16950
16964
|
const output = formatter.format(resolved.ast, formatOptions);
|
|
16951
|
-
outputs.set(output.path, output);
|
|
16965
|
+
outputs.set(output.path, addMarkerToOutput(output));
|
|
16952
16966
|
if (output.additionalFiles) {
|
|
16953
16967
|
for (const additionalFile of output.additionalFiles) {
|
|
16954
|
-
outputs.set(additionalFile.path, additionalFile);
|
|
16968
|
+
outputs.set(additionalFile.path, addMarkerToOutput(additionalFile));
|
|
16955
16969
|
}
|
|
16956
16970
|
}
|
|
16957
16971
|
} catch (err) {
|
|
@@ -17257,7 +17271,12 @@ function createPager(enabled = true) {
|
|
|
17257
17271
|
}
|
|
17258
17272
|
|
|
17259
17273
|
// packages/cli/src/commands/compile.ts
|
|
17260
|
-
var
|
|
17274
|
+
var PROMPTSCRIPT_MARKERS = [
|
|
17275
|
+
"<!-- PromptScript",
|
|
17276
|
+
// Current marker (HTML comment with date)
|
|
17277
|
+
"> Auto-generated by PromptScript"
|
|
17278
|
+
// Legacy - for backwards compatibility
|
|
17279
|
+
];
|
|
17261
17280
|
function parseTargets(targets) {
|
|
17262
17281
|
return targets.map((entry) => {
|
|
17263
17282
|
if (typeof entry === "string") {
|
|
@@ -17275,7 +17294,7 @@ async function isPromptScriptGenerated(filePath) {
|
|
|
17275
17294
|
try {
|
|
17276
17295
|
const content = await readFile6(filePath, "utf-8");
|
|
17277
17296
|
const lines = content.split("\n").slice(0, 10);
|
|
17278
|
-
return lines.some((line) => line.includes(
|
|
17297
|
+
return lines.some((line) => PROMPTSCRIPT_MARKERS.some((marker) => line.includes(marker)));
|
|
17279
17298
|
} catch {
|
|
17280
17299
|
return false;
|
|
17281
17300
|
}
|
|
@@ -18073,7 +18092,7 @@ program.name("prs").description("PromptScript CLI - Standardize AI instructions"
|
|
|
18073
18092
|
}
|
|
18074
18093
|
});
|
|
18075
18094
|
program.command("init").description("Initialize PromptScript in current directory").option("-n, --name <name>", "Project name (auto-detected from package.json, etc.)").option("-t, --team <team>", "Team namespace").option("--inherit <path>", "Inheritance path (e.g., @company/team)").option("--registry <path>", "Registry path").option("--targets <targets...>", "Target AI tools (github, claude, cursor)").option("-i, --interactive", "Force interactive mode").option("-y, --yes", "Skip prompts, use defaults").option("-f, --force", "Force reinitialize even if already initialized").action((opts) => initCommand(opts));
|
|
18076
|
-
program.command("compile").description("Compile PromptScript to target formats").option("-t, --target <target>", "Specific target (github, claude, cursor)").option("-f, --format <format>", "Output format (alias for --target)").option("-a, --all", "All configured targets", true).option("-w, --watch", "Watch mode").option("-o, --output <dir>", "Output directory").option("--dry-run", "Preview changes").option("--registry <path>", "Registry path (overrides config)").option("-c, --config <path>", "Path to custom config file").option("--force", "Force overwrite existing files without prompts").action(compileCommand);
|
|
18095
|
+
program.command("compile").description("Compile PromptScript to target formats").option("-t, --target <target>", "Specific target (github, claude, cursor)").option("-f, --format <format>", "Output format (alias for --target)").option("-a, --all", "All configured targets", true).option("-w, --watch", "Watch mode").option("-o, --output <dir>", "Output directory").option("--dry-run", "Preview changes").option("--registry <path>", "Registry path (overrides config)").option("-c, --config <path>", "Path to custom config file").option("--force", "Force overwrite existing files without prompts").action((opts) => compileCommand(opts));
|
|
18077
18096
|
program.command("validate").description("Validate PromptScript files").option("--strict", "Treat warnings as errors").option("--format <format>", "Output format (text, json)", "text").action(validateCommand);
|
|
18078
18097
|
program.command("pull").description("Pull updates from registry").option("-f, --force", "Force overwrite").option("--dry-run", "Preview changes without pulling").option("-b, --branch <name>", "Git branch to pull from").option("--tag <name>", "Git tag to pull from").option("--commit <hash>", "Git commit to pull from").option("--refresh", "Force re-fetch from remote (ignore cache)").action(pullCommand);
|
|
18079
18098
|
program.command("diff").description("Show diff for compiled output").option("-t, --target <target>", "Specific target").option("-a, --all", "Show diff for all targets at once").option("--full", "Show full diff without truncation").option("--no-pager", "Disable pager output").option("--color", "Force colored output").option("--no-color", "Disable colored output").action(diffCommand);
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/compile.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAQlD,OAAO,EAAE,KAAK,WAAW,EAAyB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/compile.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAQlD,OAAO,EAAE,KAAK,WAAW,EAAyB,MAAM,gBAAgB,CAAC;AAkOzE;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,cAAc,EACvB,QAAQ,GAAE,WAAqC,GAC9C,OAAO,CAAC,IAAI,CAAC,CA4Ef"}
|