@agentmark-ai/shared-utils 0.2.0 → 0.3.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.
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -173,7 +173,15 @@ ${jsonToFrontMatter(content)}---
|
|
|
173
173
|
// src/generate-types.ts
|
|
174
174
|
var fs = __toESM(require("fs-extra"));
|
|
175
175
|
var import_path = __toESM(require("path"));
|
|
176
|
-
var
|
|
176
|
+
var import_js_yaml = __toESM(require("js-yaml"));
|
|
177
|
+
function extractFrontmatter(content) {
|
|
178
|
+
const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
179
|
+
if (!match) {
|
|
180
|
+
return { attributes: {} };
|
|
181
|
+
}
|
|
182
|
+
const attributes = import_js_yaml.default.load(match[1]);
|
|
183
|
+
return { attributes: attributes || {} };
|
|
184
|
+
}
|
|
177
185
|
var _compile = null;
|
|
178
186
|
async function getCompile() {
|
|
179
187
|
var _a;
|
|
@@ -417,7 +425,7 @@ async function fetchPromptsFrontmatter(options) {
|
|
|
417
425
|
return Promise.all(
|
|
418
426
|
promptFiles.map(async (file) => {
|
|
419
427
|
const content = await fs.readFile(file, "utf-8");
|
|
420
|
-
const { attributes } = (
|
|
428
|
+
const { attributes } = extractFrontmatter(content);
|
|
421
429
|
if (isNewFormat(attributes)) {
|
|
422
430
|
return {
|
|
423
431
|
path: import_path.default.relative(options.rootDir, file),
|