@moskala/oneagent-templates 0.2.3 → 0.2.4

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +7 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moskala/oneagent-templates",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "type": "module",
5
5
  "description": "Built-in templates for oneagent",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import path from "path";
2
2
  import fs from "fs/promises";
3
+ import { fileURLToPath } from "url";
4
+
5
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
3
6
 
4
7
  export interface TemplateDefinition {
5
8
  name: string;
@@ -14,11 +17,11 @@ type BuiltinTemplateName = "default" | "react" | "react-native";
14
17
  const TEMPLATE_NAMES: BuiltinTemplateName[] = ["default", "react", "react-native"];
15
18
 
16
19
  async function loadTemplate(name: BuiltinTemplateName): Promise<TemplateDefinition> {
17
- const templateDir = path.join(import.meta.dir, "templates", name);
20
+ const templateDir = path.join(__dirname, "templates", name);
18
21
 
19
22
  const [yamlText, instructions] = await Promise.all([
20
- Bun.file(path.join(templateDir, "template.yml")).text(),
21
- Bun.file(path.join(templateDir, "instructions.md")).text(),
23
+ fs.readFile(path.join(templateDir, "template.yml"), "utf-8"),
24
+ fs.readFile(path.join(templateDir, "instructions.md"), "utf-8"),
22
25
  ]);
23
26
 
24
27
  // Minimal YAML parsing for our simple structure
@@ -44,7 +47,7 @@ async function loadTemplate(name: BuiltinTemplateName): Promise<TemplateDefiniti
44
47
  .filter((f) => f.endsWith(".md"))
45
48
  .map(async (f) => ({
46
49
  name: path.basename(f, ".md"),
47
- content: await Bun.file(path.join(rulesDir, f)).text(),
50
+ content: await fs.readFile(path.join(rulesDir, f), "utf-8"),
48
51
  })),
49
52
  );
50
53
  } catch {