@prompd/cli 0.3.3

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.
Files changed (223) hide show
  1. package/README.md +162 -0
  2. package/bin/prompd.js +23 -0
  3. package/dist/commands/cache.d.ts +3 -0
  4. package/dist/commands/cache.d.ts.map +1 -0
  5. package/dist/commands/cache.js +199 -0
  6. package/dist/commands/cache.js.map +1 -0
  7. package/dist/commands/compile.d.ts +9 -0
  8. package/dist/commands/compile.d.ts.map +1 -0
  9. package/dist/commands/compile.js +104 -0
  10. package/dist/commands/compile.js.map +1 -0
  11. package/dist/commands/config.d.ts +7 -0
  12. package/dist/commands/config.d.ts.map +1 -0
  13. package/dist/commands/config.js +212 -0
  14. package/dist/commands/config.js.map +1 -0
  15. package/dist/commands/create.d.ts +3 -0
  16. package/dist/commands/create.d.ts.map +1 -0
  17. package/dist/commands/create.js +183 -0
  18. package/dist/commands/create.js.map +1 -0
  19. package/dist/commands/deps.d.ts +3 -0
  20. package/dist/commands/deps.d.ts.map +1 -0
  21. package/dist/commands/deps.js +192 -0
  22. package/dist/commands/deps.js.map +1 -0
  23. package/dist/commands/explain.d.ts +3 -0
  24. package/dist/commands/explain.d.ts.map +1 -0
  25. package/dist/commands/explain.js +227 -0
  26. package/dist/commands/explain.js.map +1 -0
  27. package/dist/commands/git.d.ts +3 -0
  28. package/dist/commands/git.d.ts.map +1 -0
  29. package/dist/commands/git.js +306 -0
  30. package/dist/commands/git.js.map +1 -0
  31. package/dist/commands/init.d.ts +3 -0
  32. package/dist/commands/init.d.ts.map +1 -0
  33. package/dist/commands/init.js +177 -0
  34. package/dist/commands/init.js.map +1 -0
  35. package/dist/commands/list.d.ts +3 -0
  36. package/dist/commands/list.d.ts.map +1 -0
  37. package/dist/commands/list.js +126 -0
  38. package/dist/commands/list.js.map +1 -0
  39. package/dist/commands/mcp.d.ts +3 -0
  40. package/dist/commands/mcp.d.ts.map +1 -0
  41. package/dist/commands/mcp.js +326 -0
  42. package/dist/commands/mcp.js.map +1 -0
  43. package/dist/commands/namespace.d.ts +3 -0
  44. package/dist/commands/namespace.d.ts.map +1 -0
  45. package/dist/commands/namespace.js +113 -0
  46. package/dist/commands/namespace.js.map +1 -0
  47. package/dist/commands/package.d.ts +23 -0
  48. package/dist/commands/package.d.ts.map +1 -0
  49. package/dist/commands/package.js +746 -0
  50. package/dist/commands/package.js.map +1 -0
  51. package/dist/commands/provider.d.ts +3 -0
  52. package/dist/commands/provider.d.ts.map +1 -0
  53. package/dist/commands/provider.js +285 -0
  54. package/dist/commands/provider.js.map +1 -0
  55. package/dist/commands/registry.d.ts +9 -0
  56. package/dist/commands/registry.d.ts.map +1 -0
  57. package/dist/commands/registry.js +361 -0
  58. package/dist/commands/registry.js.map +1 -0
  59. package/dist/commands/run.d.ts +3 -0
  60. package/dist/commands/run.d.ts.map +1 -0
  61. package/dist/commands/run.js +157 -0
  62. package/dist/commands/run.js.map +1 -0
  63. package/dist/commands/show.d.ts +3 -0
  64. package/dist/commands/show.d.ts.map +1 -0
  65. package/dist/commands/show.js +90 -0
  66. package/dist/commands/show.js.map +1 -0
  67. package/dist/commands/uninstall.d.ts +3 -0
  68. package/dist/commands/uninstall.d.ts.map +1 -0
  69. package/dist/commands/uninstall.js +95 -0
  70. package/dist/commands/uninstall.js.map +1 -0
  71. package/dist/commands/validate.d.ts +3 -0
  72. package/dist/commands/validate.d.ts.map +1 -0
  73. package/dist/commands/validate.js +57 -0
  74. package/dist/commands/validate.js.map +1 -0
  75. package/dist/commands/version.d.ts +3 -0
  76. package/dist/commands/version.d.ts.map +1 -0
  77. package/dist/commands/version.js +166 -0
  78. package/dist/commands/version.js.map +1 -0
  79. package/dist/index.d.ts +5 -0
  80. package/dist/index.d.ts.map +1 -0
  81. package/dist/index.js +388 -0
  82. package/dist/index.js.map +1 -0
  83. package/dist/lib/auth.d.ts +164 -0
  84. package/dist/lib/auth.d.ts.map +1 -0
  85. package/dist/lib/auth.js +388 -0
  86. package/dist/lib/auth.js.map +1 -0
  87. package/dist/lib/compiler/file-system.d.ts +178 -0
  88. package/dist/lib/compiler/file-system.d.ts.map +1 -0
  89. package/dist/lib/compiler/file-system.js +440 -0
  90. package/dist/lib/compiler/file-system.js.map +1 -0
  91. package/dist/lib/compiler/formatters/anthropic.d.ts +21 -0
  92. package/dist/lib/compiler/formatters/anthropic.d.ts.map +1 -0
  93. package/dist/lib/compiler/formatters/anthropic.js +95 -0
  94. package/dist/lib/compiler/formatters/anthropic.js.map +1 -0
  95. package/dist/lib/compiler/formatters/markdown.d.ts +17 -0
  96. package/dist/lib/compiler/formatters/markdown.d.ts.map +1 -0
  97. package/dist/lib/compiler/formatters/markdown.js +114 -0
  98. package/dist/lib/compiler/formatters/markdown.js.map +1 -0
  99. package/dist/lib/compiler/formatters/openai.d.ts +21 -0
  100. package/dist/lib/compiler/formatters/openai.d.ts.map +1 -0
  101. package/dist/lib/compiler/formatters/openai.js +98 -0
  102. package/dist/lib/compiler/formatters/openai.js.map +1 -0
  103. package/dist/lib/compiler/index.d.ts +56 -0
  104. package/dist/lib/compiler/index.d.ts.map +1 -0
  105. package/dist/lib/compiler/index.js +165 -0
  106. package/dist/lib/compiler/index.js.map +1 -0
  107. package/dist/lib/compiler/language-map.d.ts +31 -0
  108. package/dist/lib/compiler/language-map.d.ts.map +1 -0
  109. package/dist/lib/compiler/language-map.js +156 -0
  110. package/dist/lib/compiler/language-map.js.map +1 -0
  111. package/dist/lib/compiler/package-resolver.d.ts +68 -0
  112. package/dist/lib/compiler/package-resolver.d.ts.map +1 -0
  113. package/dist/lib/compiler/package-resolver.js +254 -0
  114. package/dist/lib/compiler/package-resolver.js.map +1 -0
  115. package/dist/lib/compiler/pipeline.d.ts +53 -0
  116. package/dist/lib/compiler/pipeline.d.ts.map +1 -0
  117. package/dist/lib/compiler/pipeline.js +209 -0
  118. package/dist/lib/compiler/pipeline.js.map +1 -0
  119. package/dist/lib/compiler/prompd-loader.d.ts +108 -0
  120. package/dist/lib/compiler/prompd-loader.d.ts.map +1 -0
  121. package/dist/lib/compiler/prompd-loader.js +270 -0
  122. package/dist/lib/compiler/prompd-loader.js.map +1 -0
  123. package/dist/lib/compiler/section-override.d.ts +40 -0
  124. package/dist/lib/compiler/section-override.d.ts.map +1 -0
  125. package/dist/lib/compiler/section-override.js +296 -0
  126. package/dist/lib/compiler/section-override.js.map +1 -0
  127. package/dist/lib/compiler/stages/assets.d.ts +71 -0
  128. package/dist/lib/compiler/stages/assets.d.ts.map +1 -0
  129. package/dist/lib/compiler/stages/assets.js +456 -0
  130. package/dist/lib/compiler/stages/assets.js.map +1 -0
  131. package/dist/lib/compiler/stages/codegen.d.ts +17 -0
  132. package/dist/lib/compiler/stages/codegen.d.ts.map +1 -0
  133. package/dist/lib/compiler/stages/codegen.js +64 -0
  134. package/dist/lib/compiler/stages/codegen.js.map +1 -0
  135. package/dist/lib/compiler/stages/dependency.d.ts +38 -0
  136. package/dist/lib/compiler/stages/dependency.d.ts.map +1 -0
  137. package/dist/lib/compiler/stages/dependency.js +307 -0
  138. package/dist/lib/compiler/stages/dependency.js.map +1 -0
  139. package/dist/lib/compiler/stages/lexical.d.ts +19 -0
  140. package/dist/lib/compiler/stages/lexical.d.ts.map +1 -0
  141. package/dist/lib/compiler/stages/lexical.js +92 -0
  142. package/dist/lib/compiler/stages/lexical.js.map +1 -0
  143. package/dist/lib/compiler/stages/semantic.d.ts +20 -0
  144. package/dist/lib/compiler/stages/semantic.d.ts.map +1 -0
  145. package/dist/lib/compiler/stages/semantic.js +166 -0
  146. package/dist/lib/compiler/stages/semantic.js.map +1 -0
  147. package/dist/lib/compiler/stages/template.d.ts +94 -0
  148. package/dist/lib/compiler/stages/template.d.ts.map +1 -0
  149. package/dist/lib/compiler/stages/template.js +1044 -0
  150. package/dist/lib/compiler/stages/template.js.map +1 -0
  151. package/dist/lib/compiler/types.d.ts +200 -0
  152. package/dist/lib/compiler/types.d.ts.map +1 -0
  153. package/dist/lib/compiler/types.js +137 -0
  154. package/dist/lib/compiler/types.js.map +1 -0
  155. package/dist/lib/config.d.ts +29 -0
  156. package/dist/lib/config.d.ts.map +1 -0
  157. package/dist/lib/config.js +375 -0
  158. package/dist/lib/config.js.map +1 -0
  159. package/dist/lib/errors.d.ts +19 -0
  160. package/dist/lib/errors.d.ts.map +1 -0
  161. package/dist/lib/errors.js +47 -0
  162. package/dist/lib/errors.js.map +1 -0
  163. package/dist/lib/executor.d.ts +18 -0
  164. package/dist/lib/executor.d.ts.map +1 -0
  165. package/dist/lib/executor.js +372 -0
  166. package/dist/lib/executor.js.map +1 -0
  167. package/dist/lib/git.d.ts +74 -0
  168. package/dist/lib/git.d.ts.map +1 -0
  169. package/dist/lib/git.js +254 -0
  170. package/dist/lib/git.js.map +1 -0
  171. package/dist/lib/index.d.ts +43 -0
  172. package/dist/lib/index.d.ts.map +1 -0
  173. package/dist/lib/index.js +108 -0
  174. package/dist/lib/index.js.map +1 -0
  175. package/dist/lib/mcp.d.ts +42 -0
  176. package/dist/lib/mcp.d.ts.map +1 -0
  177. package/dist/lib/mcp.js +477 -0
  178. package/dist/lib/mcp.js.map +1 -0
  179. package/dist/lib/model-updater.d.ts +51 -0
  180. package/dist/lib/model-updater.d.ts.map +1 -0
  181. package/dist/lib/model-updater.js +275 -0
  182. package/dist/lib/model-updater.js.map +1 -0
  183. package/dist/lib/parser.d.ts +9 -0
  184. package/dist/lib/parser.d.ts.map +1 -0
  185. package/dist/lib/parser.js +197 -0
  186. package/dist/lib/parser.js.map +1 -0
  187. package/dist/lib/registry.d.ts +183 -0
  188. package/dist/lib/registry.d.ts.map +1 -0
  189. package/dist/lib/registry.js +786 -0
  190. package/dist/lib/registry.js.map +1 -0
  191. package/dist/lib/rpc-server.d.ts +78 -0
  192. package/dist/lib/rpc-server.d.ts.map +1 -0
  193. package/dist/lib/rpc-server.js +404 -0
  194. package/dist/lib/rpc-server.js.map +1 -0
  195. package/dist/lib/security.d.ts +120 -0
  196. package/dist/lib/security.d.ts.map +1 -0
  197. package/dist/lib/security.js +478 -0
  198. package/dist/lib/security.js.map +1 -0
  199. package/dist/lib/validation.d.ts +106 -0
  200. package/dist/lib/validation.d.ts.map +1 -0
  201. package/dist/lib/validation.js +398 -0
  202. package/dist/lib/validation.js.map +1 -0
  203. package/dist/lib/version.d.ts +29 -0
  204. package/dist/lib/version.d.ts.map +1 -0
  205. package/dist/lib/version.js +202 -0
  206. package/dist/lib/version.js.map +1 -0
  207. package/dist/lib/workflow-engine.d.ts +161 -0
  208. package/dist/lib/workflow-engine.d.ts.map +1 -0
  209. package/dist/lib/workflow-engine.js +422 -0
  210. package/dist/lib/workflow-engine.js.map +1 -0
  211. package/dist/lib/workflow.d.ts +102 -0
  212. package/dist/lib/workflow.d.ts.map +1 -0
  213. package/dist/lib/workflow.js +228 -0
  214. package/dist/lib/workflow.js.map +1 -0
  215. package/dist/server.d.ts +8 -0
  216. package/dist/server.d.ts.map +1 -0
  217. package/dist/server.js +134 -0
  218. package/dist/server.js.map +1 -0
  219. package/dist/types/index.d.ts +116 -0
  220. package/dist/types/index.d.ts.map +1 -0
  221. package/dist/types/index.js +144 -0
  222. package/dist/types/index.js.map +1 -0
  223. package/package.json +104 -0
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ /**
3
+ * Markdown Output Formatter
4
+ *
5
+ * Formats compiled prompts as human-readable markdown with optional YAML frontmatter.
6
+ */
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = { enumerable: true, get: function() { return m[k]; } };
12
+ }
13
+ Object.defineProperty(o, k2, desc);
14
+ }) : (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ o[k2] = m[k];
17
+ }));
18
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
20
+ }) : function(o, v) {
21
+ o["default"] = v;
22
+ });
23
+ var __importStar = (this && this.__importStar) || (function () {
24
+ var ownKeys = function(o) {
25
+ ownKeys = Object.getOwnPropertyNames || function (o) {
26
+ var ar = [];
27
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
28
+ return ar;
29
+ };
30
+ return ownKeys(o);
31
+ };
32
+ return function (mod) {
33
+ if (mod && mod.__esModule) return mod;
34
+ var result = {};
35
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
36
+ __setModuleDefault(result, mod);
37
+ return result;
38
+ };
39
+ })();
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ exports.MarkdownFormatter = void 0;
42
+ const yaml = __importStar(require("yaml"));
43
+ class MarkdownFormatter {
44
+ constructor() {
45
+ this.name = 'markdown';
46
+ this.fileExtension = '.md';
47
+ this.mimeType = 'text/markdown';
48
+ }
49
+ async format(compiled) {
50
+ const output = [];
51
+ // Add metadata as YAML frontmatter comment (only in verbose mode)
52
+ if (compiled.verbose && compiled.metadata) {
53
+ output.push('<!-- PROMPD METADATA');
54
+ const cleanMetadata = this.cleanMetadataForDisplay(compiled.metadata);
55
+ output.push(yaml.stringify(cleanMetadata));
56
+ output.push('-->');
57
+ output.push('');
58
+ }
59
+ // Add extracted contexts as sections
60
+ if (compiled.contexts && compiled.contexts.length > 0) {
61
+ output.push('# Extracted Context Files');
62
+ output.push('');
63
+ for (const ctx of compiled.contexts) {
64
+ output.push(ctx);
65
+ output.push('');
66
+ }
67
+ }
68
+ // Add main content (clean output without extra headers by default)
69
+ if (compiled.content) {
70
+ if (compiled.verbose) {
71
+ output.push('# Main Prompt Content');
72
+ output.push('');
73
+ }
74
+ output.push(compiled.content);
75
+ }
76
+ return output.join('\n');
77
+ }
78
+ /**
79
+ * Clean metadata dictionary for YAML display, converting complex objects to strings.
80
+ */
81
+ cleanMetadataForDisplay(metadata) {
82
+ if (typeof metadata !== 'object' || metadata === null) {
83
+ return metadata;
84
+ }
85
+ if (Array.isArray(metadata)) {
86
+ return metadata.map(item => this.cleanMetadataForDisplay(item));
87
+ }
88
+ const cleaned = {};
89
+ for (const [key, value] of Object.entries(metadata)) {
90
+ if (value === undefined) {
91
+ continue; // Skip undefined values
92
+ }
93
+ // Handle enums and complex objects
94
+ if (typeof value === 'object' && value !== null) {
95
+ if ('value' in value) {
96
+ // Enum object - return its string value
97
+ cleaned[key] = value.value;
98
+ }
99
+ else if (Array.isArray(value)) {
100
+ cleaned[key] = value.map(item => this.cleanMetadataForDisplay(item));
101
+ }
102
+ else {
103
+ cleaned[key] = this.cleanMetadataForDisplay(value);
104
+ }
105
+ }
106
+ else {
107
+ cleaned[key] = value;
108
+ }
109
+ }
110
+ return cleaned;
111
+ }
112
+ }
113
+ exports.MarkdownFormatter = MarkdownFormatter;
114
+ //# sourceMappingURL=markdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.js","sourceRoot":"","sources":["../../../../src/lib/compiler/formatters/markdown.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2CAA6B;AAG7B,MAAa,iBAAiB;IAA9B;QACE,SAAI,GAAG,UAAU,CAAC;QAClB,kBAAa,GAAG,KAAK,CAAC;QACtB,aAAQ,GAAG,eAAe,CAAC;IAuE7B,CAAC;IArEC,KAAK,CAAC,MAAM,CAAC,QAAwB;QACnC,MAAM,MAAM,GAAa,EAAE,CAAC;QAE5B,kEAAkE;QAClE,IAAI,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,QAAQ,EAAE,CAAC;YAC1C,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;YACpC,MAAM,aAAa,GAAG,IAAI,CAAC,uBAAuB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACtE,MAAM,CAAC,IAAI,C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ClE,CAAC;QAED,MAAM,OAAO,GAAQ,EAAE,CAAC;QACxB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YACpD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,SAAS,CAAC,wBAAwB;YACpC,CAAC;YAED,mCAAmC;YACnC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;gBAChD,IAAI,OAAO,IAAI,KAAK,EAAE,CAAC;oBACrB,wCAAwC;oBACxC,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC;gBAC7B,CAAC;qBAAM,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;oBAChC,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC,CAAC;gBACvE,CAAC;qBAAM,CAAC;oBACN,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC;gBACrD,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YACvB,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA1ED,8CA0EC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * OpenAI API JSON Formatter
3
+ *
4
+ * Formats compiled prompts for OpenAI API consumption with proper message structure.
5
+ */
6
+ import { OutputFormatter, CompiledPrompt } from '../types';
7
+ export declare class OpenAIFormatter implements OutputFormatter {
8
+ name: string;
9
+ fileExtension: string;
10
+ mimeType: string;
11
+ format(compiled: CompiledPrompt): Promise<string>;
12
+ /**
13
+ * Extract a specific section from markdown content.
14
+ */
15
+ private extractSection;
16
+ /**
17
+ * Remove a specific section from markdown content.
18
+ */
19
+ private removeSection;
20
+ }
21
+ //# sourceMappingURL=openai.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../../../src/lib/compiler/formatters/openai.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE3D,qBAAa,eAAgB,YAAW,eAAe;IACrD,IAAI,SAA0B;IAC9B,aAAa,SAAW;IACxB,QAAQ,SAAsB;IAExB,MAAM,CAAC,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IA0CvD;;OAEG;IACH,OAAO,CAAC,cAAc;IAyBtB;;OAEG;IACH,OAAO,CAAC,aAAa;CAsBtB"}
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ /**
3
+ * OpenAI API JSON Formatter
4
+ *
5
+ * Formats compiled prompts for OpenAI API consumption with proper message structure.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.OpenAIFormatter = void 0;
9
+ class OpenAIFormatter {
10
+ constructor() {
11
+ this.name = 'provider-json:openai';
12
+ this.fileExtension = '.json';
13
+ this.mimeType = 'application/json';
14
+ }
15
+ async format(compiled) {
16
+ const messages = [];
17
+ // Extract system message if present
18
+ if (compiled.content && compiled.content.includes('## System')) {
19
+ const systemContent = this.extractSection(compiled.content, 'System');
20
+ if (systemContent) {
21
+ messages.push({
22
+ role: 'system',
23
+ content: systemContent
24
+ });
25
+ }
26
+ }
27
+ // Add user message (full content or content without system section)
28
+ let userContent = compiled.content || '';
29
+ // If we extracted a system message, remove it from user content
30
+ if (messages.length > 0) {
31
+ userContent = this.removeSection(userContent, 'System');
32
+ }
33
+ // Add extracted contexts to user message
34
+ if (compiled.contexts && compiled.contexts.length > 0) {
35
+ const contextContent = compiled.contexts.join('\n\n');
36
+ userContent = `${contextContent}\n\n${userContent}`;
37
+ }
38
+ messages.push({
39
+ role: 'user',
40
+ content: userContent.trim()
41
+ });
42
+ const apiRequest = {
43
+ model: 'gpt-4',
44
+ messages: messages,
45
+ temperature: 0.1
46
+ };
47
+ return JSON.stringify(apiRequest, null, 2);
48
+ }
49
+ /**
50
+ * Extract a specific section from markdown content.
51
+ */
52
+ extractSection(content, sectionName) {
53
+ const lines = content.split('\n');
54
+ let inSection = false;
55
+ const sectionContent = [];
56
+ for (const line of lines) {
57
+ const trimmed = line.trim();
58
+ if (trimmed === `## ${sectionName}`) {
59
+ inSection = true;
60
+ continue;
61
+ }
62
+ else if (trimmed.startsWith('## ') && inSection) {
63
+ break; // Reached next section
64
+ }
65
+ else if (inSection) {
66
+ sectionContent.push(line);
67
+ }
68
+ }
69
+ if (sectionContent.length === 0) {
70
+ return null;
71
+ }
72
+ return sectionContent.join('\n').trim();
73
+ }
74
+ /**
75
+ * Remove a specific section from markdown content.
76
+ */
77
+ removeSection(content, sectionName) {
78
+ const lines = content.split('\n');
79
+ let inSection = false;
80
+ const resultLines = [];
81
+ for (const line of lines) {
82
+ const trimmed = line.trim();
83
+ if (trimmed === `## ${sectionName}`) {
84
+ inSection = true;
85
+ continue;
86
+ }
87
+ else if (trimmed.startsWith('## ') && inSection) {
88
+ inSection = false;
89
+ }
90
+ if (!inSection) {
91
+ resultLines.push(line);
92
+ }
93
+ }
94
+ return resultLines.join('\n').trim();
95
+ }
96
+ }
97
+ exports.OpenAIFormatter = OpenAIFormatter;
98
+ //# sourceMappingURL=openai.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openai.js","sourceRoot":"","sources":["../../../../src/lib/compiler/formatters/openai.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAIH,MAAa,eAAe;IAA5B;QACE,SAAI,GAAG,sBAAsB,CAAC;QAC9B,kBAAa,GAAG,OAAO,CAAC;QACxB,aAAQ,GAAG,kBAAkB,CAAC;IAiGhC,CAAC;IA/FC,KAAK,CAAC,MAAM,CAAC,QAAwB;QACnC,MAAM,QAA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AS,GAAG,KAAK,CAAC;YACpB,CAAC;YAED,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;QAED,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;IACvC,CAAC;CACF;AApGD,0CAoGC"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Prompd Compiler - Main Entry Point
3
+ *
4
+ * The 6-stage compilation pipeline for transforming .prmd files into various output formats.
5
+ * This is the npm CLI's complete port of the Python CLI's compiler with full feature parity.
6
+ */
7
+ import { CompilerPipeline } from './pipeline';
8
+ import { CompilationOptions, CompilationContext, SecurityConfig } from './types';
9
+ /**
10
+ * High-level compiler interface.
11
+ *
12
+ * Provides a simple API for compiling .prmd files to various output formats.
13
+ */
14
+ export declare class PrompdCompiler {
15
+ private pipeline;
16
+ private securityConfig;
17
+ constructor(securityConfig?: SecurityConfig);
18
+ /**
19
+ * Compile a .prmd file to the specified format.
20
+ *
21
+ * @param source - Path to .prmd file or package reference
22
+ * @param options - Compilation options
23
+ * @returns Compiled content as string
24
+ */
25
+ compile(source: string, options?: CompilationOptions): Promise<string>;
26
+ /**
27
+ * Compile with detailed context (for advanced usage).
28
+ *
29
+ * @param source - Path to .prmd file or package reference
30
+ * @param options - Compilation options
31
+ * @returns Complete compilation context with metadata
32
+ */
33
+ compileWithContext(source: string, options?: CompilationOptions): Promise<CompilationContext>;
34
+ /**
35
+ * Get the underlying pipeline (for advanced customization).
36
+ */
37
+ getPipeline(): CompilerPipeline;
38
+ }
39
+ /**
40
+ * Convenience function for quick compilation.
41
+ */
42
+ export declare function compile(source: string, outputFormat?: string, parameters?: Record<string, any>, outputFile?: string): Promise<string>;
43
+ export * from './types';
44
+ export * from './pipeline';
45
+ export * from './file-system';
46
+ export { LexicalAnalysisStage } from './stages/lexical';
47
+ export { DependencyResolutionStage } from './stages/dependency';
48
+ export { SemanticAnalysisStage } from './stages/semantic';
49
+ export { AssetExtractionStage } from './stages/assets';
50
+ export { TemplateProcessingStage } from './stages/template';
51
+ export { CodeGenerationStage } from './stages/codegen';
52
+ export { SectionOverrideProcessor } from './section-override';
53
+ export { MarkdownFormatter } from './formatters/markdown';
54
+ export { OpenAIFormatter } from './formatters/openai';
55
+ export { AnthropicFormatter } from './formatters/anthropic';
56
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/compiler/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAA2B,cAAc,EAAE,MAAM,SAAS,CAAC;AAS1G;;;;GAIG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAmB;IACnC,OAAO,CAAC,cAAc,CAAiB;gBAE3B,cAAc,CAAC,EAAE,cAAc;IAgB3C;;;;;;OAMG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC;IAkChF;;;;;;OAMG;IACG,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAIvG;;OAEG;IACH,WAAW,IAAI,gBAAgB;CAGhC;AAED;;GAEG;AACH,wBAAsB,OAAO,CAC3B,MAAM,EAAE,MAAM,EACd,YAAY,GAAE,MAAmB,EACjC,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EACpC,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,CAOjB;AAGD,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ /**
3
+ * Prompd Compiler - Main Entry Point
4
+ *
5
+ * The 6-stage compilation pipeline for transforming .prmd files into various output formats.
6
+ * This is the npm CLI's complete port of the Python CLI's compiler with full feature parity.
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
42
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
43
+ };
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.AnthropicFormatter = exports.OpenAIFormatter = exports.MarkdownFormatter = exports.SectionOverrideProcessor = exports.CodeGenerationStage = exports.TemplateProcessingStage = exports.AssetExtractionStage = exports.SemanticAnalysisStage = exports.DependencyResolutionStage = exports.LexicalAnalysisStage = exports.PrompdCompiler = void 0;
46
+ exports.compile = compile;
47
+ const path = __importStar(require("path"));
48
+ const fs = __importStar(require("fs-extra"));
49
+ const pipeline_1 = require("./pipeline");
50
+ const types_1 = require("./types");
51
+ const lexical_1 = require("./stages/lexical");
52
+ const dependency_1 = require("./stages/dependency");
53
+ const semantic_1 = require("./stages/semantic");
54
+ const assets_1 = require("./stages/assets");
55
+ const template_1 = require("./stages/template");
56
+ const codegen_1 = require("./stages/codegen");
57
+ const errors_1 = require("../errors");
58
+ /**
59
+ * High-level compiler interface.
60
+ *
61
+ * Provides a simple API for compiling .prmd files to various output formats.
62
+ */
63
+ class PrompdCompiler {
64
+ constructor(securityConfig) {
65
+ this.securityConfig = securityConfig || types_1.DEFAULT_SECURITY_CONFIG;
66
+ // Create pipeline with default stages
67
+ const stages = [
68
+ new lexical_1.LexicalAnalysisStage(),
69
+ new dependency_1.DependencyResolutionStage(),
70
+ new semantic_1.SemanticAnalysisStage(),
71
+ new assets_1.AssetExtractionStage(),
72
+ new template_1.TemplateProcessingStage(),
73
+ new codegen_1.CodeGenerationStage()
74
+ ];
75
+ this.pipeline = new pipeline_1.CompilerPipeline(stages, this.securityConfig);
76
+ }
77
+ /**
78
+ * Compile a .prmd file to the specified format.
79
+ *
80
+ * @param source - Path to .prmd file or package reference
81
+ * @param options - Compilation options
82
+ * @returns Compiled content as string
83
+ */
84
+ async compile(source, options = {}) {
85
+ // Execute pipeline
86
+ const context = await this.pipeline.execute(source, options);
87
+ // Check for errors
88
+ if (context.hasErrors()) {
89
+ const errorMessages = context.errors.join('\n - ');
90
+ throw new errors_1.CompilationError(`Compilation failed:\n - ${errorMessages}`);
91
+ }
92
+ // Display warnings
93
+ if (context.warnings.length > 0 && options.verbose) {
94
+ for (const warning of context.warnings) {
95
+ console.log(`Warning: ${warning}`);
96
+ }
97
+ }
98
+ // Write to output file if specified
99
+ if (options.outputFile && context.compiledResult) {
100
+ const outputPath = path.resolve(options.outputFile);
101
+ const content = typeof context.compiledResult === 'string'
102
+ ? context.compiledResult
103
+ : context.compiledResult.toString('utf-8');
104
+ await fs.writeFile(outputPath, content, 'utf-8');
105
+ if (options.verbose) {
106
+ console.log(`✓ Compiled output written to: ${outputPath}`);
107
+ }
108
+ }
109
+ const result = context.compiledResult || '';
110
+ return typeof result === 'string' ? result : result.toString('utf-8');
111
+ }
112
+ /**
113
+ * Compile with detailed context (for advanced usage).
114
+ *
115
+ * @param source - Path to .prmd file or package reference
116
+ * @param options - Compilation options
117
+ * @returns Complete compilation context with metadata
118
+ */
119
+ async compileWithContext(source, options = {}) {
120
+ return await this.pipeline.execute(source, options);
121
+ }
122
+ /**
123
+ * Get the underlying pipeline (for advanced customization).
124
+ */
125
+ getPipeline() {
126
+ return this.pipeline;
127
+ }
128
+ }
129
+ exports.PrompdCompiler = PrompdCompiler;
130
+ /**
131
+ * Convenience function for quick compilation.
132
+ */
133
+ async function compile(source, outputFormat = 'markdown', parameters = {}, outputFile) {
134
+ const compiler = new PrompdCompiler();
135
+ return await compiler.compile(source, {
136
+ outputFormat,
137
+ parameters,
138
+ outputFile
139
+ });
140
+ }
141
+ // Export all types and classes
142
+ __exportStar(require("./types"), exports);
143
+ __exportStar(require("./pipeline"), exports);
144
+ __exportStar(require("./file-system"), exports);
145
+ var lexical_2 = require("./stages/lexical");
146
+ Object.defineProperty(exports, "LexicalAnalysisStage", { enumerable: true, get: function () { return lexical_2.LexicalAnalysisStage; } });
147
+ var dependency_2 = require("./stages/dependency");
148
+ Object.defineProperty(exports, "DependencyResolutionStage", { enumerable: true, get: function () { return dependency_2.DependencyResolutionStage; } });
149
+ var semantic_2 = require("./stages/semantic");
150
+ Object.defineProperty(exports, "SemanticAnalysisStage", { enumerable: true, get: function () { return semantic_2.SemanticAnalysisStage; } });
151
+ var assets_2 = require("./stages/assets");
152
+ Object.defineProperty(exports, "AssetExtractionStage", { enumerable: true, get: function () { return assets_2.AssetExtractionStage; } });
153
+ var template_2 = require("./stages/template");
154
+ Object.defineProperty(exports, "TemplateProcessingStage", { enumerable: true, get: function () { return template_2.TemplateProcessingStage; } });
155
+ var codegen_2 = require("./stages/codegen");
156
+ Object.defineProperty(exports, "CodeGenerationStage", { enumerable: true, get: function () { return codegen_2.CodeGenerationStage; } });
157
+ var section_override_1 = require("./section-override");
158
+ Object.defineProperty(exports, "SectionOverrideProcessor", { enumerable: true, get: function () { return section_override_1.SectionOverrideProcessor; } });
159
+ var markdown_1 = require("./formatters/markdown");
160
+ Object.defineProperty(exports, "MarkdownFormatter", { enumerable: true, get: function () { return markdown_1.MarkdownFormatter; } });
161
+ var openai_1 = require("./formatters/openai");
162
+ Object.defineProperty(exports, "OpenAIFormatter", { enumerable: true, get: function () { return openai_1.OpenAIFormatter; } });
163
+ var anthropic_1 = require("./formatters/anthropic");
164
+ Object.defineProperty(exports, "AnthropicFormatter", { enumerable: true, get: function () { return anthropic_1.AnthropicFormatter; } });
165
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/compiler/index.ts"],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GAAG,IAAI,cAAc,EAAE,CAAC;IACtC,OAAO,MAAM,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE;QACpC,YAAY;QACZ,UAAU;QACV,UAAU;KACX,CAAC,CAAC;AACL,CAAC;AAED,+BAA+B;AAC/B,0CAAwB;AACxB,6CAA2B;AAC3B,gDAA8B;AAC9B,4CAAwD;AAA/C,+GAAA,oBAAoB,OAAA;AAC7B,kDAAgE;AAAvD,uHAAA,yBAAyB,OAAA;AAClC,8CAA0D;AAAjD,iHAAA,qBAAqB,OAAA;AAC9B,0CAAuD;AAA9C,8GAAA,oBAAoB,OAAA;AAC7B,8CAA4D;AAAnD,mHAAA,uBAAuB,OAAA;AAChC,4CAAuD;AAA9C,8GAAA,mBAAmB,OAAA;AAC5B,uDAA8D;AAArD,4HAAA,wBAAwB,OAAA;AACjC,kDAA0D;AAAjD,6GAAA,iBAAiB,OAAA;AAC1B,8CAAsD;AAA7C,yGAAA,eAAe,OAAA;AACxB,oDAA4D;AAAnD,+GAAA,kBAAkB,OAAA"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Language Mapping Utilities
3
+ *
4
+ * Centralized file extension to programming language mappings
5
+ * used across the compilation pipeline for:
6
+ * - Wrapping extracted code files in markdown code blocks
7
+ * - Filtering code blocks based on context file types
8
+ */
9
+ /**
10
+ * Map of file extensions to primary markdown code block language identifier.
11
+ * Used when wrapping extracted code files in markdown code blocks.
12
+ */
13
+ export declare const EXTENSION_TO_LANGUAGE: Record<string, string>;
14
+ /**
15
+ * Map of file extensions to all valid code block language identifiers.
16
+ * Used when filtering code blocks - includes aliases (e.g., 'ts' for 'typescript').
17
+ */
18
+ export declare const EXTENSION_TO_LANGUAGE_ALIASES: Record<string, string[]>;
19
+ /**
20
+ * Get the primary language identifier for a file extension.
21
+ * @param ext - File extension (e.g., '.ts')
22
+ * @returns Primary language identifier or undefined
23
+ */
24
+ export declare function getLanguageForExtension(ext: string): string | undefined;
25
+ /**
26
+ * Get all valid language identifiers (including aliases) for a file extension.
27
+ * @param ext - File extension (e.g., '.ts')
28
+ * @returns Array of language identifiers or empty array
29
+ */
30
+ export declare function getLanguageAliasesForExtension(ext: string): string[];
31
+ //# sourceMappingURL=language-map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"language-map.d.ts","sourceRoot":"","sources":["../../../src/lib/compiler/language-map.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA0DxD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,6BAA6B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CA0DlE,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEvE;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAEpE"}