@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.mjs CHANGED
@@ -111,7 +111,15 @@ ${jsonToFrontMatter(content)}---
111
111
  // src/generate-types.ts
112
112
  import * as fs from "fs-extra";
113
113
  import path from "path";
114
- import fm from "front-matter";
114
+ import yaml from "js-yaml";
115
+ function extractFrontmatter(content) {
116
+ const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
117
+ if (!match) {
118
+ return { attributes: {} };
119
+ }
120
+ const attributes = yaml.load(match[1]);
121
+ return { attributes: attributes || {} };
122
+ }
115
123
  var _compile = null;
116
124
  async function getCompile() {
117
125
  var _a;
@@ -355,7 +363,7 @@ async function fetchPromptsFrontmatter(options) {
355
363
  return Promise.all(
356
364
  promptFiles.map(async (file) => {
357
365
  const content = await fs.readFile(file, "utf-8");
358
- const { attributes } = fm(content);
366
+ const { attributes } = extractFrontmatter(content);
359
367
  if (isNewFormat(attributes)) {
360
368
  return {
361
369
  path: path.relative(options.rootDir, file),