@promptscript/cli 1.4.4 → 1.4.6
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 +272 -36
- 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
|
@@ -3694,8 +3694,16 @@ var MarkdownInstructionFormatter = class extends BaseFormatter {
|
|
|
3694
3694
|
}
|
|
3695
3695
|
project(ast, renderer) {
|
|
3696
3696
|
const identity2 = this.findBlock(ast, "identity");
|
|
3697
|
-
|
|
3698
|
-
|
|
3697
|
+
let text = "";
|
|
3698
|
+
if (identity2) {
|
|
3699
|
+
text = this.extractText(identity2.content);
|
|
3700
|
+
} else {
|
|
3701
|
+
const context = this.findBlock(ast, "context");
|
|
3702
|
+
if (context?.content.type === "MixedContent" && context.content.text) {
|
|
3703
|
+
text = context.content.text.value.trim();
|
|
3704
|
+
}
|
|
3705
|
+
}
|
|
3706
|
+
if (!text) return null;
|
|
3699
3707
|
const cleanText = text.split(/\n{2,}/).map(
|
|
3700
3708
|
(para) => para.split("\n").map((line) => line.trim()).filter((line) => line).join("\n")
|
|
3701
3709
|
).filter((para) => para).join("\n\n");
|
|
@@ -4723,7 +4731,7 @@ var GitHubFormatter = class extends BaseFormatter {
|
|
|
4723
4731
|
if (restrictions) sections.push(restrictions);
|
|
4724
4732
|
const diagrams = this.diagrams(ast, renderer);
|
|
4725
4733
|
if (diagrams) sections.push(diagrams);
|
|
4726
|
-
const knowledge = this.
|
|
4734
|
+
const knowledge = this.knowledgeContent(ast, renderer);
|
|
4727
4735
|
if (knowledge) sections.push(knowledge);
|
|
4728
4736
|
}
|
|
4729
4737
|
header(_ast) {
|
|
@@ -4731,13 +4739,41 @@ var GitHubFormatter = class extends BaseFormatter {
|
|
|
4731
4739
|
}
|
|
4732
4740
|
project(ast, renderer) {
|
|
4733
4741
|
const identity2 = this.findBlock(ast, "identity");
|
|
4734
|
-
|
|
4735
|
-
|
|
4742
|
+
let content = "";
|
|
4743
|
+
if (identity2) {
|
|
4744
|
+
content = this.extractText(identity2.content);
|
|
4745
|
+
} else {
|
|
4746
|
+
const context = this.findBlock(ast, "context");
|
|
4747
|
+
if (context?.content.type === "MixedContent" && context.content.text) {
|
|
4748
|
+
content = context.content.text.value.trim();
|
|
4749
|
+
}
|
|
4750
|
+
}
|
|
4751
|
+
if (!content) return null;
|
|
4736
4752
|
return renderer.renderSection("project", this.stripAllIndent(content));
|
|
4737
4753
|
}
|
|
4738
4754
|
techStack(ast, renderer) {
|
|
4739
4755
|
const context = this.findBlock(ast, "context");
|
|
4740
|
-
if (
|
|
4756
|
+
if (context) {
|
|
4757
|
+
const items = this.extractTechStackFromContext(context);
|
|
4758
|
+
if (items.length > 0) {
|
|
4759
|
+
const content = renderer.renderList(items);
|
|
4760
|
+
return renderer.renderSection("tech-stack", content);
|
|
4761
|
+
}
|
|
4762
|
+
}
|
|
4763
|
+
const standards = this.findBlock(ast, "standards");
|
|
4764
|
+
if (standards) {
|
|
4765
|
+
const items = this.extractTechStackFromStandards(standards);
|
|
4766
|
+
if (items.length > 0) {
|
|
4767
|
+
const content = renderer.renderList(items);
|
|
4768
|
+
return renderer.renderSection("tech-stack", content);
|
|
4769
|
+
}
|
|
4770
|
+
}
|
|
4771
|
+
return null;
|
|
4772
|
+
}
|
|
4773
|
+
/**
|
|
4774
|
+
* Extract tech stack items from @context block.
|
|
4775
|
+
*/
|
|
4776
|
+
extractTechStackFromContext(context) {
|
|
4741
4777
|
const props = this.getProps(context.content);
|
|
4742
4778
|
const items = [];
|
|
4743
4779
|
const languages = props["languages"];
|
|
@@ -4760,9 +4796,21 @@ var GitHubFormatter = class extends BaseFormatter {
|
|
|
4760
4796
|
);
|
|
4761
4797
|
}
|
|
4762
4798
|
}
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4799
|
+
return items;
|
|
4800
|
+
}
|
|
4801
|
+
/**
|
|
4802
|
+
* Extract tech stack items from @standards.code (languages, frameworks, testing).
|
|
4803
|
+
*/
|
|
4804
|
+
extractTechStackFromStandards(standards) {
|
|
4805
|
+
const code = this.getProp(standards.content, "code");
|
|
4806
|
+
if (!code || typeof code !== "object" || Array.isArray(code)) return [];
|
|
4807
|
+
const codeObj = code;
|
|
4808
|
+
const items = [];
|
|
4809
|
+
for (const key of ["languages", "frameworks", "testing"]) {
|
|
4810
|
+
const val = codeObj[key];
|
|
4811
|
+
if (val) items.push(...(Array.isArray(val) ? val : [val]).map(String));
|
|
4812
|
+
}
|
|
4813
|
+
return items;
|
|
4766
4814
|
}
|
|
4767
4815
|
architecture(ast, renderer) {
|
|
4768
4816
|
const context = this.findBlock(ast, "context");
|
|
@@ -4962,8 +5010,35 @@ ${this.stripAllIndent(content)}`
|
|
|
4962
5010
|
if (items.length === 0) return null;
|
|
4963
5011
|
return renderer.renderSection("diagrams", renderer.renderList(items));
|
|
4964
5012
|
}
|
|
4965
|
-
|
|
4966
|
-
|
|
5013
|
+
/**
|
|
5014
|
+
* Render remaining @knowledge content not already consumed by
|
|
5015
|
+
* commands() (## Development Commands) or postWork() (## Post-Work Verification).
|
|
5016
|
+
*/
|
|
5017
|
+
knowledgeContent(ast, _renderer) {
|
|
5018
|
+
const knowledge = this.findBlock(ast, "knowledge");
|
|
5019
|
+
if (!knowledge) return null;
|
|
5020
|
+
const text = this.extractText(knowledge.content);
|
|
5021
|
+
if (!text) return null;
|
|
5022
|
+
const consumedHeaders = ["## Development Commands", "## Post-Work Verification"];
|
|
5023
|
+
let remaining = text;
|
|
5024
|
+
for (const header of consumedHeaders) {
|
|
5025
|
+
const headerIndex = remaining.indexOf(header);
|
|
5026
|
+
if (headerIndex === -1) continue;
|
|
5027
|
+
const afterHeader = remaining.indexOf("\n", headerIndex);
|
|
5028
|
+
if (afterHeader === -1) {
|
|
5029
|
+
remaining = remaining.substring(0, headerIndex).trimEnd();
|
|
5030
|
+
continue;
|
|
5031
|
+
}
|
|
5032
|
+
const nextSection = remaining.indexOf("\n## ", afterHeader);
|
|
5033
|
+
if (nextSection === -1) {
|
|
5034
|
+
remaining = remaining.substring(0, headerIndex).trimEnd();
|
|
5035
|
+
} else {
|
|
5036
|
+
remaining = remaining.substring(0, headerIndex) + remaining.substring(nextSection + 1);
|
|
5037
|
+
}
|
|
5038
|
+
}
|
|
5039
|
+
remaining = remaining.trim();
|
|
5040
|
+
if (!remaining) return null;
|
|
5041
|
+
return this.stripAllIndent(remaining);
|
|
4967
5042
|
}
|
|
4968
5043
|
// Helper methods
|
|
4969
5044
|
formatTechItem(arr) {
|
|
@@ -5543,6 +5618,7 @@ var ClaudeFormatter = class extends BaseFormatter {
|
|
|
5543
5618
|
this.addSection(sections, this.postWork(ast, renderer));
|
|
5544
5619
|
this.addSection(sections, this.documentation(ast, renderer));
|
|
5545
5620
|
this.addSection(sections, this.diagrams(ast, renderer));
|
|
5621
|
+
this.addSection(sections, this.knowledgeContent(ast, renderer));
|
|
5546
5622
|
this.addSection(sections, this.donts(ast, renderer));
|
|
5547
5623
|
}
|
|
5548
5624
|
addSection(sections, content) {
|
|
@@ -5550,8 +5626,16 @@ var ClaudeFormatter = class extends BaseFormatter {
|
|
|
5550
5626
|
}
|
|
5551
5627
|
project(ast, renderer) {
|
|
5552
5628
|
const identity2 = this.findBlock(ast, "identity");
|
|
5553
|
-
|
|
5554
|
-
|
|
5629
|
+
let text = "";
|
|
5630
|
+
if (identity2) {
|
|
5631
|
+
text = this.extractText(identity2.content);
|
|
5632
|
+
} else {
|
|
5633
|
+
const context = this.findBlock(ast, "context");
|
|
5634
|
+
if (context?.content.type === "MixedContent" && context.content.text) {
|
|
5635
|
+
text = context.content.text.value.trim();
|
|
5636
|
+
}
|
|
5637
|
+
}
|
|
5638
|
+
if (!text) return null;
|
|
5555
5639
|
const cleanText = text.split(/\n{2,}/).map(
|
|
5556
5640
|
(para) => para.split("\n").map((line) => line.trim()).filter((line) => line).join("\n")
|
|
5557
5641
|
).filter((para) => para).join("\n\n");
|
|
@@ -5723,6 +5807,36 @@ var ClaudeFormatter = class extends BaseFormatter {
|
|
|
5723
5807
|
const content = renderer.renderList(items);
|
|
5724
5808
|
return renderer.renderSection("Diagrams", content) + "\n";
|
|
5725
5809
|
}
|
|
5810
|
+
/**
|
|
5811
|
+
* Render remaining @knowledge content not already consumed by
|
|
5812
|
+
* commands() (## Development Commands) or postWork() (## Post-Work Verification).
|
|
5813
|
+
*/
|
|
5814
|
+
knowledgeContent(ast, _renderer) {
|
|
5815
|
+
const knowledge = this.findBlock(ast, "knowledge");
|
|
5816
|
+
if (!knowledge) return null;
|
|
5817
|
+
const text = this.extractText(knowledge.content);
|
|
5818
|
+
if (!text) return null;
|
|
5819
|
+
const consumedHeaders = ["## Development Commands", "## Post-Work Verification"];
|
|
5820
|
+
let remaining = text;
|
|
5821
|
+
for (const header of consumedHeaders) {
|
|
5822
|
+
const headerIndex = remaining.indexOf(header);
|
|
5823
|
+
if (headerIndex === -1) continue;
|
|
5824
|
+
const afterHeader = remaining.indexOf("\n", headerIndex);
|
|
5825
|
+
if (afterHeader === -1) {
|
|
5826
|
+
remaining = remaining.substring(0, headerIndex).trimEnd();
|
|
5827
|
+
continue;
|
|
5828
|
+
}
|
|
5829
|
+
const nextSection = remaining.indexOf("\n## ", afterHeader);
|
|
5830
|
+
if (nextSection === -1) {
|
|
5831
|
+
remaining = remaining.substring(0, headerIndex).trimEnd();
|
|
5832
|
+
} else {
|
|
5833
|
+
remaining = remaining.substring(0, headerIndex) + remaining.substring(nextSection + 1);
|
|
5834
|
+
}
|
|
5835
|
+
}
|
|
5836
|
+
remaining = remaining.trim();
|
|
5837
|
+
if (!remaining) return null;
|
|
5838
|
+
return this.stripAllIndent(remaining) + "\n";
|
|
5839
|
+
}
|
|
5726
5840
|
donts(ast, renderer) {
|
|
5727
5841
|
const block = this.findBlock(ast, "restrictions");
|
|
5728
5842
|
if (!block) return null;
|
|
@@ -6060,6 +6174,8 @@ var CursorFormatter = class extends BaseFormatter {
|
|
|
6060
6174
|
if (documentation) sections.push(documentation);
|
|
6061
6175
|
const diagrams = this.diagrams(ast);
|
|
6062
6176
|
if (diagrams) sections.push(diagrams);
|
|
6177
|
+
const knowledge = this.knowledgeContent(ast);
|
|
6178
|
+
if (knowledge) sections.push(knowledge);
|
|
6063
6179
|
const never = this.never(ast);
|
|
6064
6180
|
if (never) sections.push(never);
|
|
6065
6181
|
}
|
|
@@ -6071,6 +6187,13 @@ var CursorFormatter = class extends BaseFormatter {
|
|
|
6071
6187
|
return fullText;
|
|
6072
6188
|
}
|
|
6073
6189
|
}
|
|
6190
|
+
if (!identity2) {
|
|
6191
|
+
const context = this.findBlock(ast, "context");
|
|
6192
|
+
if (context?.content.type === "MixedContent" && context.content.text) {
|
|
6193
|
+
const text = this.dedent(context.content.text.value.trim());
|
|
6194
|
+
if (text) return text;
|
|
6195
|
+
}
|
|
6196
|
+
}
|
|
6074
6197
|
const projectInfo = this.extractProjectInfo(ast);
|
|
6075
6198
|
const orgSuffix = projectInfo.org ? ` at ${projectInfo.org}` : "";
|
|
6076
6199
|
return `You are working on ${projectInfo.text}${orgSuffix}.`;
|
|
@@ -6377,6 +6500,32 @@ ${items.map((i) => "- " + i).join("\n")}`;
|
|
|
6377
6500
|
}
|
|
6378
6501
|
return items;
|
|
6379
6502
|
}
|
|
6503
|
+
knowledgeContent(ast) {
|
|
6504
|
+
const knowledge = this.findBlock(ast, "knowledge");
|
|
6505
|
+
if (!knowledge) return null;
|
|
6506
|
+
const text = this.extractText(knowledge.content);
|
|
6507
|
+
if (!text) return null;
|
|
6508
|
+
const consumedHeaders = ["## Development Commands", "## Post-Work Verification"];
|
|
6509
|
+
let remaining = text;
|
|
6510
|
+
for (const header of consumedHeaders) {
|
|
6511
|
+
const headerIndex = remaining.indexOf(header);
|
|
6512
|
+
if (headerIndex === -1) continue;
|
|
6513
|
+
const afterHeader = remaining.indexOf("\n", headerIndex);
|
|
6514
|
+
if (afterHeader === -1) {
|
|
6515
|
+
remaining = remaining.substring(0, headerIndex).trimEnd();
|
|
6516
|
+
continue;
|
|
6517
|
+
}
|
|
6518
|
+
const nextSection = remaining.indexOf("\n## ", afterHeader);
|
|
6519
|
+
if (nextSection === -1) {
|
|
6520
|
+
remaining = remaining.substring(0, headerIndex).trimEnd();
|
|
6521
|
+
} else {
|
|
6522
|
+
remaining = remaining.substring(0, headerIndex) + remaining.substring(nextSection + 1);
|
|
6523
|
+
}
|
|
6524
|
+
}
|
|
6525
|
+
remaining = remaining.trim();
|
|
6526
|
+
if (!remaining) return null;
|
|
6527
|
+
return this.stripAllIndent(remaining);
|
|
6528
|
+
}
|
|
6380
6529
|
never(ast) {
|
|
6381
6530
|
const block = this.findBlock(ast, "restrictions");
|
|
6382
6531
|
if (!block) return null;
|
|
@@ -6482,6 +6631,8 @@ var AntigravityFormatter = class extends BaseFormatter {
|
|
|
6482
6631
|
if (documentation) sections.push(documentation);
|
|
6483
6632
|
const diagrams = this.diagrams(ast, renderer);
|
|
6484
6633
|
if (diagrams) sections.push(diagrams);
|
|
6634
|
+
const knowledge = this.knowledgeContent(ast);
|
|
6635
|
+
if (knowledge) sections.push(knowledge);
|
|
6485
6636
|
const restrictions = this.restrictions(ast, renderer);
|
|
6486
6637
|
if (restrictions) sections.push(restrictions);
|
|
6487
6638
|
const content = sections.join("\n\n") + "\n";
|
|
@@ -6652,8 +6803,15 @@ var AntigravityFormatter = class extends BaseFormatter {
|
|
|
6652
6803
|
}
|
|
6653
6804
|
identity(ast, _renderer) {
|
|
6654
6805
|
const identity2 = this.findBlock(ast, "identity");
|
|
6655
|
-
|
|
6656
|
-
|
|
6806
|
+
let content = "";
|
|
6807
|
+
if (identity2) {
|
|
6808
|
+
content = this.extractText(identity2.content);
|
|
6809
|
+
} else {
|
|
6810
|
+
const context = this.findBlock(ast, "context");
|
|
6811
|
+
if (context?.content.type === "MixedContent" && context.content.text) {
|
|
6812
|
+
content = context.content.text.value.trim();
|
|
6813
|
+
}
|
|
6814
|
+
}
|
|
6657
6815
|
if (!content) return null;
|
|
6658
6816
|
return `## Project Identity
|
|
6659
6817
|
|
|
@@ -6664,7 +6822,29 @@ ${this.stripAllIndent(content)}`;
|
|
|
6664
6822
|
*/
|
|
6665
6823
|
techStack(ast, _renderer) {
|
|
6666
6824
|
const context = this.findBlock(ast, "context");
|
|
6667
|
-
if (
|
|
6825
|
+
if (context) {
|
|
6826
|
+
const items = this.extractTechStackFromContext(context);
|
|
6827
|
+
if (items.length > 0) {
|
|
6828
|
+
return `## Tech Stack
|
|
6829
|
+
|
|
6830
|
+
${items.join("\n")}`;
|
|
6831
|
+
}
|
|
6832
|
+
}
|
|
6833
|
+
const standards = this.findBlock(ast, "standards");
|
|
6834
|
+
if (standards) {
|
|
6835
|
+
const items = this.extractTechStackFromStandards(standards);
|
|
6836
|
+
if (items.length > 0) {
|
|
6837
|
+
return `## Tech Stack
|
|
6838
|
+
|
|
6839
|
+
${items.join(", ")}`;
|
|
6840
|
+
}
|
|
6841
|
+
}
|
|
6842
|
+
return null;
|
|
6843
|
+
}
|
|
6844
|
+
/**
|
|
6845
|
+
* Extract tech stack items from @context block.
|
|
6846
|
+
*/
|
|
6847
|
+
extractTechStackFromContext(context) {
|
|
6668
6848
|
const props = this.getProps(context.content);
|
|
6669
6849
|
const items = [];
|
|
6670
6850
|
const languages = props["languages"];
|
|
@@ -6694,10 +6874,21 @@ ${this.stripAllIndent(content)}`;
|
|
|
6694
6874
|
const arr = Array.isArray(frameworks) ? frameworks : [frameworks];
|
|
6695
6875
|
items.push(`**Frameworks:** ${arr.map((f) => this.valueToString(f)).join(", ")}`);
|
|
6696
6876
|
}
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6877
|
+
return items;
|
|
6878
|
+
}
|
|
6879
|
+
/**
|
|
6880
|
+
* Extract tech stack items from @standards.code (languages, frameworks, testing).
|
|
6881
|
+
*/
|
|
6882
|
+
extractTechStackFromStandards(standards) {
|
|
6883
|
+
const code = this.getProp(standards.content, "code");
|
|
6884
|
+
if (!code || typeof code !== "object" || Array.isArray(code)) return [];
|
|
6885
|
+
const codeObj = code;
|
|
6886
|
+
const items = [];
|
|
6887
|
+
for (const key of ["languages", "frameworks", "testing"]) {
|
|
6888
|
+
const val = codeObj[key];
|
|
6889
|
+
if (val) items.push(...(Array.isArray(val) ? val : [val]).map(String));
|
|
6890
|
+
}
|
|
6891
|
+
return items;
|
|
6701
6892
|
}
|
|
6702
6893
|
/**
|
|
6703
6894
|
* Extract architecture from @context block (same as GitHub/Cursor).
|
|
@@ -6941,6 +7132,32 @@ ${items.map((i) => "- " + i).join("\n")}`;
|
|
|
6941
7132
|
/**
|
|
6942
7133
|
* Extract restrictions from @restrictions block (same as GitHub/Cursor).
|
|
6943
7134
|
*/
|
|
7135
|
+
knowledgeContent(ast) {
|
|
7136
|
+
const knowledge = this.findBlock(ast, "knowledge");
|
|
7137
|
+
if (!knowledge) return null;
|
|
7138
|
+
const text = this.extractText(knowledge.content);
|
|
7139
|
+
if (!text) return null;
|
|
7140
|
+
const consumedHeaders = ["## Development Commands", "## Post-Work Verification"];
|
|
7141
|
+
let remaining = text;
|
|
7142
|
+
for (const header of consumedHeaders) {
|
|
7143
|
+
const headerIndex = remaining.indexOf(header);
|
|
7144
|
+
if (headerIndex === -1) continue;
|
|
7145
|
+
const afterHeader = remaining.indexOf("\n", headerIndex);
|
|
7146
|
+
if (afterHeader === -1) {
|
|
7147
|
+
remaining = remaining.substring(0, headerIndex).trimEnd();
|
|
7148
|
+
continue;
|
|
7149
|
+
}
|
|
7150
|
+
const nextSection = remaining.indexOf("\n## ", afterHeader);
|
|
7151
|
+
if (nextSection === -1) {
|
|
7152
|
+
remaining = remaining.substring(0, headerIndex).trimEnd();
|
|
7153
|
+
} else {
|
|
7154
|
+
remaining = remaining.substring(0, headerIndex) + remaining.substring(nextSection + 1);
|
|
7155
|
+
}
|
|
7156
|
+
}
|
|
7157
|
+
remaining = remaining.trim();
|
|
7158
|
+
if (!remaining) return null;
|
|
7159
|
+
return this.stripAllIndent(remaining);
|
|
7160
|
+
}
|
|
6944
7161
|
restrictions(ast, _renderer) {
|
|
6945
7162
|
const block = this.findBlock(ast, "restrictions");
|
|
6946
7163
|
if (!block) return null;
|
|
@@ -6960,6 +7177,14 @@ ${items.map((i) => "- " + i).join("\n")}`;
|
|
|
6960
7177
|
if (content.type === "TextContent") {
|
|
6961
7178
|
return content.value.trim().split("\n").filter((line) => line.trim()).map((line) => this.formatRestriction(line.trim()));
|
|
6962
7179
|
}
|
|
7180
|
+
if (content.type === "ObjectContent") {
|
|
7181
|
+
const itemsArray = this.getProp(content, "items");
|
|
7182
|
+
if (Array.isArray(itemsArray)) {
|
|
7183
|
+
return itemsArray.map(
|
|
7184
|
+
(item) => this.formatRestriction(this.valueToString(item))
|
|
7185
|
+
);
|
|
7186
|
+
}
|
|
7187
|
+
}
|
|
6963
7188
|
return [];
|
|
6964
7189
|
}
|
|
6965
7190
|
/**
|
|
@@ -8705,9 +8930,13 @@ async function initCommand(options, services = createDefaultServices()) {
|
|
|
8705
8930
|
const skillSource = resolve2(BUNDLED_SKILLS_DIR, skillName, "SKILL.md");
|
|
8706
8931
|
try {
|
|
8707
8932
|
const rawSkillContent = readFileSync3(skillSource, "utf-8");
|
|
8708
|
-
|
|
8709
|
-
const
|
|
8710
|
-
|
|
8933
|
+
let skillContent = rawSkillContent;
|
|
8934
|
+
const hasMarker = rawSkillContent.includes("<!-- PromptScript") || rawSkillContent.includes("# promptscript-generated:");
|
|
8935
|
+
if (!hasMarker && rawSkillContent.startsWith("---")) {
|
|
8936
|
+
const yamlMarker = `# promptscript-generated: ${(/* @__PURE__ */ new Date()).toISOString()}`;
|
|
8937
|
+
skillContent = `---
|
|
8938
|
+
${yamlMarker}${rawSkillContent.slice(3)}`;
|
|
8939
|
+
}
|
|
8711
8940
|
const skillDest = `.promptscript/skills/${skillName}`;
|
|
8712
8941
|
await fs4.mkdir(skillDest, { recursive: true });
|
|
8713
8942
|
await fs4.writeFile(`${skillDest}/SKILL.md`, skillContent, "utf-8");
|
|
@@ -24571,31 +24800,32 @@ var SECURITY_STRICT_MULTILINGUAL = {
|
|
|
24571
24800
|
};
|
|
24572
24801
|
|
|
24573
24802
|
// packages/compiler/src/compiler.ts
|
|
24574
|
-
function
|
|
24803
|
+
function generateHtmlMarker() {
|
|
24575
24804
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
24576
24805
|
return `<!-- PromptScript ${timestamp} - do not edit -->`;
|
|
24577
24806
|
}
|
|
24807
|
+
function generateYamlMarker() {
|
|
24808
|
+
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
24809
|
+
return `# promptscript-generated: ${timestamp}`;
|
|
24810
|
+
}
|
|
24578
24811
|
function addMarkerToOutput(output) {
|
|
24579
24812
|
const { content, path } = output;
|
|
24580
|
-
if (content.includes("<!-- PromptScript")) {
|
|
24813
|
+
if (content.includes("<!-- PromptScript") || content.includes("# promptscript-generated:")) {
|
|
24581
24814
|
return output;
|
|
24582
24815
|
}
|
|
24583
|
-
const marker = generateMarker();
|
|
24584
24816
|
if (!path.endsWith(".md") && !path.endsWith(".mdc")) {
|
|
24585
24817
|
return output;
|
|
24586
24818
|
}
|
|
24587
24819
|
if (content.startsWith("---")) {
|
|
24588
24820
|
const closingIndex = content.indexOf("---", 3);
|
|
24589
24821
|
if (closingIndex !== -1) {
|
|
24590
|
-
const
|
|
24591
|
-
const
|
|
24592
|
-
|
|
24593
|
-
|
|
24594
|
-
${marker}
|
|
24595
|
-
${afterMarker.replace(/^\n+/, "\n")}`;
|
|
24822
|
+
const afterOpening = content.slice(3);
|
|
24823
|
+
const newContent = `---
|
|
24824
|
+
${generateYamlMarker()}${afterOpening}`;
|
|
24596
24825
|
return { ...output, content: newContent };
|
|
24597
24826
|
}
|
|
24598
24827
|
}
|
|
24828
|
+
const marker = generateHtmlMarker();
|
|
24599
24829
|
const lines = content.split("\n");
|
|
24600
24830
|
if (lines[0]?.startsWith("# ")) {
|
|
24601
24831
|
lines.splice(1, 0, "", marker);
|
|
@@ -25168,13 +25398,16 @@ function findConfigInDir(dir) {
|
|
|
25168
25398
|
}
|
|
25169
25399
|
var PROMPTSCRIPT_MARKERS = [
|
|
25170
25400
|
"<!-- PromptScript",
|
|
25171
|
-
//
|
|
25401
|
+
// HTML comment marker (files without frontmatter)
|
|
25402
|
+
"# promptscript-generated:",
|
|
25403
|
+
// YAML comment marker (files with frontmatter)
|
|
25172
25404
|
"> Auto-generated by PromptScript"
|
|
25173
25405
|
// Legacy - for backwards compatibility
|
|
25174
25406
|
];
|
|
25175
|
-
var
|
|
25407
|
+
var HTML_MARKER_REGEX = /<!-- PromptScript [^>]+ -->\n*/g;
|
|
25408
|
+
var YAML_MARKER_REGEX = /# promptscript-generated: [^\n]+\n*/g;
|
|
25176
25409
|
function stripMarkers(content) {
|
|
25177
|
-
return content.replace(
|
|
25410
|
+
return content.replace(HTML_MARKER_REGEX, "").replace(YAML_MARKER_REGEX, "");
|
|
25178
25411
|
}
|
|
25179
25412
|
function createCliLogger() {
|
|
25180
25413
|
return {
|
|
@@ -25410,7 +25643,7 @@ async function compileCommand(options, services = createDefaultServices()) {
|
|
|
25410
25643
|
logger,
|
|
25411
25644
|
skillContent
|
|
25412
25645
|
});
|
|
25413
|
-
const entryPath = resolve5(localPath, "project.prs");
|
|
25646
|
+
const entryPath = config.input?.entry ? resolve5(projectRoot, config.input.entry) : resolve5(localPath, "project.prs");
|
|
25414
25647
|
if (!existsSync9(entryPath)) {
|
|
25415
25648
|
spinner.fail("Entry file not found");
|
|
25416
25649
|
ConsoleOutput.error(`File not found: ${entryPath}`);
|
|
@@ -27097,6 +27330,9 @@ function classifySection(section) {
|
|
|
27097
27330
|
if (IDENTITY_PATTERN.test(content)) {
|
|
27098
27331
|
return scored(section, "identity", 0.9);
|
|
27099
27332
|
}
|
|
27333
|
+
if (!heading && section.level === 0) {
|
|
27334
|
+
return scored(section, "identity", 0.7);
|
|
27335
|
+
}
|
|
27100
27336
|
if (heading && RESTRICTION_HEADINGS.test(heading)) {
|
|
27101
27337
|
return scored(section, "restrictions", 0.9);
|
|
27102
27338
|
}
|
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"}
|