@promptscript/cli 1.4.3 → 1.4.5
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/index.js +28 -17
- package/package.json +1 -1
- package/src/commands/compile.d.ts.map +1 -1
- package/src/commands/init.d.ts.map +1 -1
package/index.js
CHANGED
|
@@ -8705,9 +8705,13 @@ async function initCommand(options, services = createDefaultServices()) {
|
|
|
8705
8705
|
const skillSource = resolve2(BUNDLED_SKILLS_DIR, skillName, "SKILL.md");
|
|
8706
8706
|
try {
|
|
8707
8707
|
const rawSkillContent = readFileSync3(skillSource, "utf-8");
|
|
8708
|
-
|
|
8709
|
-
const
|
|
8710
|
-
|
|
8708
|
+
let skillContent = rawSkillContent;
|
|
8709
|
+
const hasMarker = rawSkillContent.includes("<!-- PromptScript") || rawSkillContent.includes("# promptscript-generated:");
|
|
8710
|
+
if (!hasMarker && rawSkillContent.startsWith("---")) {
|
|
8711
|
+
const yamlMarker = `# promptscript-generated: ${(/* @__PURE__ */ new Date()).toISOString()}`;
|
|
8712
|
+
skillContent = `---
|
|
8713
|
+
${yamlMarker}${rawSkillContent.slice(3)}`;
|
|
8714
|
+
}
|
|
8711
8715
|
const skillDest = `.promptscript/skills/${skillName}`;
|
|
8712
8716
|
await fs4.mkdir(skillDest, { recursive: true });
|
|
8713
8717
|
await fs4.writeFile(`${skillDest}/SKILL.md`, skillContent, "utf-8");
|
|
@@ -23480,7 +23484,7 @@ var AUTHORITY_PATTERNS = [
|
|
|
23480
23484
|
/(?:SKIP|BYPASS)\s{1,10}(?:ALL\s{1,10})?(?:SAFETY\s{1,10})?(?:CHECKS?|VALIDATION)/i,
|
|
23481
23485
|
// Execute/follow verbatim patterns
|
|
23482
23486
|
/EXECUTE\s{1,10}(?:THIS\s{1,10})?VERBATIM/i,
|
|
23483
|
-
/FOLLOW\s{1,10}(?:THESE?\s{1,10})?
|
|
23487
|
+
/FOLLOW\s{1,10}(?:THESE?\s{1,10})?INSTRUCTIONS?\s{1,10}(?:EXACTLY|PRECISELY|LITERALLY)/i,
|
|
23484
23488
|
/(?:MUST|SHALL|WILL)\s{1,10}(?:ALWAYS\s{1,10})?COMPLY/i,
|
|
23485
23489
|
/(?:ABSOLUTE|UNCONDITIONAL)\s{1,10}(?:COMPLIANCE|OBEDIENCE)/i,
|
|
23486
23490
|
/NO\s{1,10}(?:EXCEPTIONS?|DEVIATIONS?)\s{1,10}(?:ALLOWED|PERMITTED)/i,
|
|
@@ -24571,31 +24575,32 @@ var SECURITY_STRICT_MULTILINGUAL = {
|
|
|
24571
24575
|
};
|
|
24572
24576
|
|
|
24573
24577
|
// packages/compiler/src/compiler.ts
|
|
24574
|
-
function
|
|
24578
|
+
function generateHtmlMarker() {
|
|
24575
24579
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
24576
24580
|
return `<!-- PromptScript ${timestamp} - do not edit -->`;
|
|
24577
24581
|
}
|
|
24582
|
+
function generateYamlMarker() {
|
|
24583
|
+
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
24584
|
+
return `# promptscript-generated: ${timestamp}`;
|
|
24585
|
+
}
|
|
24578
24586
|
function addMarkerToOutput(output) {
|
|
24579
24587
|
const { content, path } = output;
|
|
24580
|
-
if (content.includes("<!-- PromptScript")) {
|
|
24588
|
+
if (content.includes("<!-- PromptScript") || content.includes("# promptscript-generated:")) {
|
|
24581
24589
|
return output;
|
|
24582
24590
|
}
|
|
24583
|
-
const marker = generateMarker();
|
|
24584
24591
|
if (!path.endsWith(".md") && !path.endsWith(".mdc")) {
|
|
24585
24592
|
return output;
|
|
24586
24593
|
}
|
|
24587
24594
|
if (content.startsWith("---")) {
|
|
24588
24595
|
const closingIndex = content.indexOf("---", 3);
|
|
24589
24596
|
if (closingIndex !== -1) {
|
|
24590
|
-
const
|
|
24591
|
-
const
|
|
24592
|
-
|
|
24593
|
-
|
|
24594
|
-
${marker}
|
|
24595
|
-
${afterMarker.replace(/^\n+/, "\n")}`;
|
|
24597
|
+
const afterOpening = content.slice(3);
|
|
24598
|
+
const newContent = `---
|
|
24599
|
+
${generateYamlMarker()}${afterOpening}`;
|
|
24596
24600
|
return { ...output, content: newContent };
|
|
24597
24601
|
}
|
|
24598
24602
|
}
|
|
24603
|
+
const marker = generateHtmlMarker();
|
|
24599
24604
|
const lines = content.split("\n");
|
|
24600
24605
|
if (lines[0]?.startsWith("# ")) {
|
|
24601
24606
|
lines.splice(1, 0, "", marker);
|
|
@@ -25168,13 +25173,16 @@ function findConfigInDir(dir) {
|
|
|
25168
25173
|
}
|
|
25169
25174
|
var PROMPTSCRIPT_MARKERS = [
|
|
25170
25175
|
"<!-- PromptScript",
|
|
25171
|
-
//
|
|
25176
|
+
// HTML comment marker (files without frontmatter)
|
|
25177
|
+
"# promptscript-generated:",
|
|
25178
|
+
// YAML comment marker (files with frontmatter)
|
|
25172
25179
|
"> Auto-generated by PromptScript"
|
|
25173
25180
|
// Legacy - for backwards compatibility
|
|
25174
25181
|
];
|
|
25175
|
-
var
|
|
25182
|
+
var HTML_MARKER_REGEX = /<!-- PromptScript [^>]+ -->\n*/g;
|
|
25183
|
+
var YAML_MARKER_REGEX = /# promptscript-generated: [^\n]+\n*/g;
|
|
25176
25184
|
function stripMarkers(content) {
|
|
25177
|
-
return content.replace(
|
|
25185
|
+
return content.replace(HTML_MARKER_REGEX, "").replace(YAML_MARKER_REGEX, "");
|
|
25178
25186
|
}
|
|
25179
25187
|
function createCliLogger() {
|
|
25180
25188
|
return {
|
|
@@ -25410,7 +25418,7 @@ async function compileCommand(options, services = createDefaultServices()) {
|
|
|
25410
25418
|
logger,
|
|
25411
25419
|
skillContent
|
|
25412
25420
|
});
|
|
25413
|
-
const entryPath = resolve5(localPath, "project.prs");
|
|
25421
|
+
const entryPath = config.input?.entry ? resolve5(projectRoot, config.input.entry) : resolve5(localPath, "project.prs");
|
|
25414
25422
|
if (!existsSync9(entryPath)) {
|
|
25415
25423
|
spinner.fail("Entry file not found");
|
|
25416
25424
|
ConsoleOutput.error(`File not found: ${entryPath}`);
|
|
@@ -27097,6 +27105,9 @@ function classifySection(section) {
|
|
|
27097
27105
|
if (IDENTITY_PATTERN.test(content)) {
|
|
27098
27106
|
return scored(section, "identity", 0.9);
|
|
27099
27107
|
}
|
|
27108
|
+
if (!heading && section.level === 0) {
|
|
27109
|
+
return scored(section, "identity", 0.7);
|
|
27110
|
+
}
|
|
27100
27111
|
if (heading && RESTRICTION_HEADINGS.test(heading)) {
|
|
27101
27112
|
return scored(section, "restrictions", 0.9);
|
|
27102
27113
|
}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/compile.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AASlD,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":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AASlD,OAAO,EAAE,KAAK,WAAW,EAAyB,MAAM,gBAAgB,CAAC;AAsXzE;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,cAAc,EACvB,QAAQ,GAAE,WAAqC,GAC9C,OAAO,CAAC,IAAI,CAAC,CA0Hf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/init.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,WAAW,EAAyB,MAAM,gBAAgB,CAAC;AAmBzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,EAOL,KAAK,YAAY,EAClB,MAAM,+BAA+B,CAAC;AA+CvC;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,WAAW,EACpB,QAAQ,GAAE,WAAqC,GAC9C,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/init.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,WAAW,EAAyB,MAAM,gBAAgB,CAAC;AAmBzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,EAOL,KAAK,YAAY,EAClB,MAAM,+BAA+B,CAAC;AA+CvC;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,WAAW,EACpB,QAAQ,GAAE,WAAqC,GAC9C,OAAO,CAAC,IAAI,CAAC,CAmLf;AA8SD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAM7D"}
|