oneagent 0.2.2 → 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/dist/index.js +99 -88
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env node
2
- #!/usr/bin/env bun
3
2
  // @bun
4
3
  import { createRequire } from "node:module";
5
4
  var __create = Object.create;
@@ -8244,6 +8243,7 @@ var init_dist4 = __esm(() => {
8244
8243
 
8245
8244
  // ../core/src/config.ts
8246
8245
  import path from "path";
8246
+ import fs from "fs/promises";
8247
8247
  function activeTargets(config) {
8248
8248
  return ALL_AGENT_TARGETS.filter((t) => config.targets[t]);
8249
8249
  }
@@ -8251,15 +8251,16 @@ function makeTargets(...enabled) {
8251
8251
  return Object.fromEntries(ALL_AGENT_TARGETS.map((t) => [t, enabled.includes(t)]));
8252
8252
  }
8253
8253
  async function configExists(root) {
8254
- return Bun.file(path.join(root, CONFIG_REL)).exists();
8254
+ return fs.access(path.join(root, CONFIG_REL)).then(() => true, () => false);
8255
8255
  }
8256
8256
  async function readConfig(root) {
8257
- const content = await Bun.file(path.join(root, CONFIG_REL)).text();
8257
+ const content = await fs.readFile(path.join(root, CONFIG_REL), "utf-8");
8258
8258
  return $parse(content);
8259
8259
  }
8260
8260
  async function writeConfig(root, config) {
8261
8261
  const filePath = path.join(root, CONFIG_REL);
8262
- await Bun.write(filePath, $stringify(config));
8262
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
8263
+ await fs.writeFile(filePath, $stringify(config));
8263
8264
  }
8264
8265
  var CONFIG_REL = ".oneagent/config.yml", ALL_AGENT_TARGETS;
8265
8266
  var init_config = __esm(() => {
@@ -8269,18 +8270,18 @@ var init_config = __esm(() => {
8269
8270
 
8270
8271
  // ../core/src/detect.ts
8271
8272
  import path2 from "path";
8272
- import fs from "fs/promises";
8273
+ import fs2 from "fs/promises";
8273
8274
  async function readDetectedFile(root, rel) {
8274
8275
  const absolutePath = path2.join(root, rel);
8275
8276
  try {
8276
- const stat = await fs.lstat(absolutePath);
8277
+ const stat = await fs2.lstat(absolutePath);
8277
8278
  if (stat.isSymbolicLink()) {
8278
- const linkTarget = await fs.readlink(absolutePath);
8279
+ const linkTarget = await fs2.readlink(absolutePath);
8279
8280
  const resolved = path2.resolve(path2.dirname(absolutePath), linkTarget);
8280
8281
  if (resolved.startsWith(path2.join(root, ".one")))
8281
8282
  return null;
8282
8283
  }
8283
- const content = await Bun.file(absolutePath).text();
8284
+ const content = await fs2.readFile(absolutePath, "utf-8");
8284
8285
  return {
8285
8286
  relativePath: rel,
8286
8287
  absolutePath,
@@ -8306,16 +8307,16 @@ async function removeDeprecatedFiles(root) {
8306
8307
  for (const rel of DEPRECATED_FILES) {
8307
8308
  const absPath = path2.join(root, rel);
8308
8309
  try {
8309
- const stat = await fs.lstat(absPath);
8310
+ const stat = await fs2.lstat(absPath);
8310
8311
  if (!stat.isSymbolicLink())
8311
- await fs.unlink(absPath);
8312
+ await fs2.unlink(absPath);
8312
8313
  } catch {}
8313
8314
  }
8314
8315
  }
8315
8316
  async function detectDeprecatedCommandFiles(root) {
8316
8317
  const commandsDir = path2.join(root, ".claude/commands");
8317
8318
  try {
8318
- const entries = await fs.readdir(commandsDir, { withFileTypes: true });
8319
+ const entries = await fs2.readdir(commandsDir, { withFileTypes: true });
8319
8320
  return entries.filter((e2) => e2.isFile()).map((e2) => path2.join(".claude/commands", e2.name));
8320
8321
  } catch {
8321
8322
  return [];
@@ -8335,7 +8336,7 @@ var init_detect = __esm(() => {
8335
8336
 
8336
8337
  // ../core/src/rules.ts
8337
8338
  import path3 from "path";
8338
- import fs2 from "fs/promises";
8339
+ import fs3 from "fs/promises";
8339
8340
  function parseFrontmatter(raw) {
8340
8341
  const match = raw.match(/^---\s*\n([\s\S]*?)\n---\s*\n?([\s\S]*)$/);
8341
8342
  if (!match)
@@ -8347,14 +8348,14 @@ function parseFrontmatter(raw) {
8347
8348
  return { applyTo, content };
8348
8349
  }
8349
8350
  async function readRuleFile(filePath) {
8350
- const raw = await Bun.file(filePath).text();
8351
+ const raw = await fs3.readFile(filePath, "utf-8");
8351
8352
  const { applyTo, content } = parseFrontmatter(raw);
8352
8353
  return { name: path3.basename(filePath, ".md"), path: filePath, applyTo, content };
8353
8354
  }
8354
8355
  async function readRules(root) {
8355
8356
  const rulesDir = path3.join(root, ".oneagent/rules");
8356
8357
  try {
8357
- const files = await fs2.readdir(rulesDir);
8358
+ const files = await fs3.readdir(rulesDir);
8358
8359
  const mdFiles = files.filter((f) => f.endsWith(".md"));
8359
8360
  const rules = await Promise.all(mdFiles.map((f) => readRuleFile(path3.join(rulesDir, f))));
8360
8361
  return rules.sort((a, b) => a.name.localeCompare(b.name));
@@ -8366,7 +8367,7 @@ var init_rules = () => {};
8366
8367
 
8367
8368
  // ../core/src/skills.ts
8368
8369
  import path4 from "path";
8369
- import fs3 from "fs/promises";
8370
+ import fs4 from "fs/promises";
8370
8371
  function parseSkillFrontmatter(raw) {
8371
8372
  const match = raw.match(/^---\s*\n([\s\S]*?)\n---\s*\n?([\s\S]*)$/);
8372
8373
  if (!match)
@@ -8381,14 +8382,14 @@ function parseSkillFrontmatter(raw) {
8381
8382
  return { description, mode, content };
8382
8383
  }
8383
8384
  async function readSkillFile(filePath) {
8384
- const raw = await Bun.file(filePath).text();
8385
+ const raw = await fs4.readFile(filePath, "utf-8");
8385
8386
  const { description, mode, content } = parseSkillFrontmatter(raw);
8386
8387
  return { name: path4.basename(filePath, ".md"), path: filePath, description, mode, content };
8387
8388
  }
8388
8389
  async function readSkills(root) {
8389
8390
  const skillsDir = path4.join(root, ".oneagent/skills");
8390
8391
  try {
8391
- const files = await fs3.readdir(skillsDir);
8392
+ const files = await fs4.readdir(skillsDir);
8392
8393
  const mdFiles = files.filter((f) => f.endsWith(".md"));
8393
8394
  const skills = await Promise.all(mdFiles.map((f) => readSkillFile(path4.join(skillsDir, f))));
8394
8395
  return skills.sort((a, b) => a.name.localeCompare(b.name));
@@ -8403,16 +8404,16 @@ var init_skills = __esm(() => {
8403
8404
 
8404
8405
  // ../core/src/symlinks.ts
8405
8406
  import path5 from "path";
8406
- import fs4 from "fs/promises";
8407
+ import fs5 from "fs/promises";
8407
8408
  async function ensureDir(dirPath) {
8408
- await fs4.mkdir(dirPath, { recursive: true });
8409
+ await fs5.mkdir(dirPath, { recursive: true });
8409
8410
  }
8410
8411
  async function createSymlink(symlinkPath, target) {
8411
8412
  await ensureDir(path5.dirname(symlinkPath));
8412
8413
  try {
8413
- await fs4.unlink(symlinkPath);
8414
+ await fs5.unlink(symlinkPath);
8414
8415
  } catch {}
8415
- await fs4.symlink(target, symlinkPath);
8416
+ await fs5.symlink(target, symlinkPath);
8416
8417
  }
8417
8418
  function relativeTarget(symlinkPath, targetAbsPath) {
8418
8419
  return path5.relative(path5.dirname(symlinkPath), targetAbsPath);
@@ -8481,18 +8482,19 @@ function buildRulesSymlinks(root, targets, rules) {
8481
8482
  }
8482
8483
  return entries;
8483
8484
  }
8484
- function buildSkillSymlinks(root, targets, skills) {
8485
- if (!targets.includes("claude"))
8486
- return [];
8487
- const commandsDir = path5.join(root, ".claude/commands");
8488
- return skills.map((skill) => {
8489
- const symlinkPath = path5.join(commandsDir, `${skill.name}.md`);
8490
- return {
8491
- symlinkPath,
8492
- target: relativeTarget(symlinkPath, skill.path),
8493
- label: path5.relative(root, symlinkPath)
8494
- };
8495
- });
8485
+ function buildSkillSymlinks(root, targets) {
8486
+ const targetAbs = path5.join(root, ".oneagent/skills");
8487
+ const agentDirs = {
8488
+ claude: path5.join(root, ".claude/skills"),
8489
+ cursor: path5.join(root, ".cursor/skills"),
8490
+ windsurf: path5.join(root, ".windsurf/skills"),
8491
+ copilot: path5.join(root, ".github/skills")
8492
+ };
8493
+ return Object.entries(agentDirs).filter(([target]) => targets.includes(target)).map(([, dir]) => ({
8494
+ symlinkPath: dir,
8495
+ target: relativeTarget(dir, targetAbs),
8496
+ label: path5.relative(root, dir)
8497
+ }));
8496
8498
  }
8497
8499
  function buildAgentsDirSymlinks(root) {
8498
8500
  const symlinkPath = path5.join(root, ".agents/skills");
@@ -8500,10 +8502,10 @@ function buildAgentsDirSymlinks(root) {
8500
8502
  return [{ symlinkPath, target: relativeTarget(symlinkPath, targetAbs), label: ".agents/skills" }];
8501
8503
  }
8502
8504
  async function migrateFilesFromDir(srcDir, destDir, root) {
8503
- await fs4.mkdir(destDir, { recursive: true });
8505
+ await fs5.mkdir(destDir, { recursive: true });
8504
8506
  let entries;
8505
8507
  try {
8506
- entries = await fs4.readdir(srcDir, { withFileTypes: true });
8508
+ entries = await fs5.readdir(srcDir, { withFileTypes: true });
8507
8509
  } catch {
8508
8510
  return;
8509
8511
  }
@@ -8514,37 +8516,37 @@ async function migrateFilesFromDir(srcDir, destDir, root) {
8514
8516
  const destFile = path5.join(destDir, entry.name);
8515
8517
  let destExists = false;
8516
8518
  try {
8517
- await fs4.access(destFile);
8519
+ await fs5.access(destFile);
8518
8520
  destExists = true;
8519
8521
  } catch {}
8520
8522
  if (destExists) {
8521
8523
  const [srcContent, destContent] = await Promise.all([
8522
- Bun.file(srcFile).text(),
8523
- Bun.file(destFile).text()
8524
+ fs5.readFile(srcFile, "utf-8"),
8525
+ fs5.readFile(destFile, "utf-8")
8524
8526
  ]);
8525
8527
  if (srcContent !== destContent) {
8526
8528
  const backupDir = path5.join(root, ".oneagent/backup");
8527
- await fs4.mkdir(backupDir, { recursive: true });
8529
+ await fs5.mkdir(backupDir, { recursive: true });
8528
8530
  const safeName = path5.relative(root, srcFile).replace(/\//g, "_");
8529
- await Bun.write(path5.join(backupDir, safeName), srcContent);
8531
+ await fs5.writeFile(path5.join(backupDir, safeName), srcContent);
8530
8532
  }
8531
- await fs4.unlink(srcFile);
8533
+ await fs5.unlink(srcFile);
8532
8534
  } else {
8533
- await fs4.rename(srcFile, destFile);
8535
+ await fs5.rename(srcFile, destFile);
8534
8536
  }
8535
8537
  }
8536
8538
  }
8537
8539
  async function migrateAndRemoveDir(src, dest, root) {
8538
8540
  let stat;
8539
8541
  try {
8540
- stat = await fs4.lstat(src);
8542
+ stat = await fs5.lstat(src);
8541
8543
  } catch {
8542
8544
  return;
8543
8545
  }
8544
8546
  if (stat.isSymbolicLink() || !stat.isDirectory())
8545
8547
  return;
8546
8548
  await migrateFilesFromDir(src, dest, root);
8547
- await fs4.rm(src, { recursive: true, force: true });
8549
+ await fs5.rm(src, { recursive: true, force: true });
8548
8550
  }
8549
8551
  async function migrateRuleAndSkillFiles(root) {
8550
8552
  const destRules = path5.join(root, ".oneagent/rules");
@@ -8559,11 +8561,11 @@ async function createAllSymlinks(entries) {
8559
8561
  }
8560
8562
  async function checkSymlink(entry) {
8561
8563
  try {
8562
- const stat = await fs4.lstat(entry.symlinkPath);
8564
+ const stat = await fs5.lstat(entry.symlinkPath);
8563
8565
  if (!stat.isSymbolicLink()) {
8564
8566
  return { ...entry, exists: true, valid: false };
8565
8567
  }
8566
- const linkTarget = await fs4.readlink(entry.symlinkPath);
8568
+ const linkTarget = await fs5.readlink(entry.symlinkPath);
8567
8569
  return { ...entry, exists: true, valid: linkTarget === entry.target };
8568
8570
  } catch {
8569
8571
  return { ...entry, exists: false, valid: false };
@@ -8573,7 +8575,7 @@ var init_symlinks = () => {};
8573
8575
 
8574
8576
  // ../core/src/copilot.ts
8575
8577
  import path6 from "path";
8576
- import fs5 from "fs/promises";
8578
+ import fs6 from "fs/promises";
8577
8579
  function buildCopilotContent(rule) {
8578
8580
  return `---
8579
8581
  applyTo: "${rule.applyTo}"
@@ -8585,8 +8587,8 @@ function copilotFilePath(root, ruleName) {
8585
8587
  }
8586
8588
  async function generateCopilotRule(root, rule) {
8587
8589
  const filePath = copilotFilePath(root, rule.name);
8588
- await fs5.mkdir(path6.dirname(filePath), { recursive: true });
8589
- await Bun.write(filePath, buildCopilotContent(rule));
8590
+ await fs6.mkdir(path6.dirname(filePath), { recursive: true });
8591
+ await fs6.writeFile(filePath, buildCopilotContent(rule));
8590
8592
  }
8591
8593
  async function generateCopilotRules(root, rules) {
8592
8594
  await Promise.all(rules.map((rule) => generateCopilotRule(root, rule)));
@@ -8604,8 +8606,8 @@ function copilotPromptFilePath(root, skillName) {
8604
8606
  }
8605
8607
  async function generateCopilotSkill(root, skill) {
8606
8608
  const filePath = copilotPromptFilePath(root, skill.name);
8607
- await fs5.mkdir(path6.dirname(filePath), { recursive: true });
8608
- await Bun.write(filePath, buildCopilotPromptContent(skill));
8609
+ await fs6.mkdir(path6.dirname(filePath), { recursive: true });
8610
+ await fs6.writeFile(filePath, buildCopilotPromptContent(skill));
8609
8611
  }
8610
8612
  async function generateCopilotSkills(root, skills) {
8611
8613
  await Promise.all(skills.map((skill) => generateCopilotSkill(root, skill)));
@@ -8614,9 +8616,10 @@ var init_copilot = () => {};
8614
8616
 
8615
8617
  // ../core/src/opencode.ts
8616
8618
  import path7 from "path";
8619
+ import fs7 from "fs/promises";
8617
8620
  async function readOpencode(root) {
8618
8621
  try {
8619
- const content = await Bun.file(path7.join(root, "opencode.json")).text();
8622
+ const content = await fs7.readFile(path7.join(root, "opencode.json"), "utf-8");
8620
8623
  return JSON.parse(content);
8621
8624
  } catch {
8622
8625
  return null;
@@ -8631,21 +8634,21 @@ function buildOpencodeConfig(existing) {
8631
8634
  async function writeOpencode(root, _rules) {
8632
8635
  const existing = await readOpencode(root);
8633
8636
  const config = buildOpencodeConfig(existing);
8634
- await Bun.write(path7.join(root, "opencode.json"), JSON.stringify(config, null, 2) + `
8637
+ await fs7.writeFile(path7.join(root, "opencode.json"), JSON.stringify(config, null, 2) + `
8635
8638
  `);
8636
8639
  }
8637
8640
  var init_opencode = () => {};
8638
8641
 
8639
8642
  // ../core/src/generate.ts
8640
8643
  import path8 from "path";
8641
- import fs6 from "fs/promises";
8644
+ import fs8 from "fs/promises";
8642
8645
  async function detectGenerateCollisions(root, config) {
8643
8646
  const [rules, skills] = await Promise.all([readRules(root), readSkills(root)]);
8644
8647
  const targets = activeTargets(config);
8645
8648
  const mainEntries = buildMainSymlinks(root, targets);
8646
8649
  const ruleSkillEntries = [
8647
8650
  ...buildRulesSymlinks(root, targets, rules),
8648
- ...buildSkillSymlinks(root, targets, skills)
8651
+ ...buildSkillSymlinks(root, targets)
8649
8652
  ];
8650
8653
  const [mainCollisions, ruleSkillSymlinkCollisions] = await Promise.all([
8651
8654
  Promise.all(mainEntries.map((entry) => readDetectedFile(root, path8.relative(root, entry.symlinkPath)))).then((files) => files.filter((f) => f !== null)),
@@ -8657,10 +8660,10 @@ async function detectGenerateCollisions(root, config) {
8657
8660
  ...rules.map(async (rule) => {
8658
8661
  const filePath = copilotFilePath(root, rule.name);
8659
8662
  try {
8660
- const content = await Bun.file(filePath).text();
8663
+ const content = await fs8.readFile(filePath, "utf-8");
8661
8664
  if (content === buildCopilotContent(rule))
8662
8665
  return null;
8663
- const stat = await fs6.lstat(filePath);
8666
+ const stat = await fs8.lstat(filePath);
8664
8667
  return { relativePath: path8.relative(root, filePath), absolutePath: filePath, sizeBytes: stat.size, modifiedAt: stat.mtime, content };
8665
8668
  } catch {
8666
8669
  return null;
@@ -8669,10 +8672,10 @@ async function detectGenerateCollisions(root, config) {
8669
8672
  ...skills.map(async (skill) => {
8670
8673
  const filePath = copilotPromptFilePath(root, skill.name);
8671
8674
  try {
8672
- const content = await Bun.file(filePath).text();
8675
+ const content = await fs8.readFile(filePath, "utf-8");
8673
8676
  if (content === buildCopilotPromptContent(skill))
8674
8677
  return null;
8675
- const stat = await fs6.lstat(filePath);
8678
+ const stat = await fs8.lstat(filePath);
8676
8679
  return { relativePath: path8.relative(root, filePath), absolutePath: filePath, sizeBytes: stat.size, modifiedAt: stat.mtime, content };
8677
8680
  } catch {
8678
8681
  return null;
@@ -8689,10 +8692,10 @@ async function detectGenerateCollisions(root, config) {
8689
8692
  async function generate(root, config) {
8690
8693
  const [rules, skills] = await Promise.all([readRules(root), readSkills(root)]);
8691
8694
  const targets = activeTargets(config);
8695
+ await migrateRuleAndSkillFiles(root);
8692
8696
  const mainSymlinks = buildMainSymlinks(root, targets);
8693
8697
  const rulesSymlinks = buildRulesSymlinks(root, targets, rules);
8694
- const skillSymlinks = buildSkillSymlinks(root, targets, skills);
8695
- await migrateRuleAndSkillFiles(root);
8698
+ const skillSymlinks = await buildSkillSymlinks(root, targets);
8696
8699
  await createAllSymlinks([...mainSymlinks, ...rulesSymlinks, ...skillSymlinks, ...buildAgentsDirSymlinks(root)]);
8697
8700
  if (targets.includes("copilot")) {
8698
8701
  await Promise.all([generateCopilotRules(root, rules), generateCopilotSkills(root, skills)]);
@@ -8712,11 +8715,12 @@ var init_generate = __esm(() => {
8712
8715
  });
8713
8716
 
8714
8717
  // ../core/src/status.ts
8718
+ import fs9 from "fs/promises";
8715
8719
  async function checkGeneratedFile(root, rule) {
8716
8720
  const filePath = copilotFilePath(root, rule.name);
8717
8721
  const expected = buildCopilotContent(rule);
8718
8722
  try {
8719
- const content = await Bun.file(filePath).text();
8723
+ const content = await fs9.readFile(filePath, "utf-8");
8720
8724
  return { path: filePath, exists: true, upToDate: content === expected };
8721
8725
  } catch {
8722
8726
  return { path: filePath, exists: false, upToDate: false };
@@ -8732,7 +8736,7 @@ async function checkCopilotPrompt(root, skill) {
8732
8736
  const filePath = copilotPromptFilePath(root, skill.name);
8733
8737
  const expected = buildCopilotPromptContent(skill);
8734
8738
  try {
8735
- const content = await Bun.file(filePath).text();
8739
+ const content = await fs9.readFile(filePath, "utf-8");
8736
8740
  return { path: filePath, exists: true, upToDate: content === expected };
8737
8741
  } catch {
8738
8742
  return { path: filePath, exists: false, upToDate: false };
@@ -8744,7 +8748,7 @@ async function checkStatus(root, config) {
8744
8748
  const allEntries = [
8745
8749
  ...buildMainSymlinks(root, targets),
8746
8750
  ...buildRulesSymlinks(root, targets, rules),
8747
- ...buildSkillSymlinks(root, targets, skills),
8751
+ ...buildSkillSymlinks(root, targets),
8748
8752
  ...buildAgentsDirSymlinks(root)
8749
8753
  ];
8750
8754
  const symlinks = await Promise.all(allEntries.map(checkSymlink));
@@ -8766,20 +8770,22 @@ var init_status = __esm(() => {
8766
8770
 
8767
8771
  // ../core/src/apply-template.ts
8768
8772
  import path9 from "path";
8769
- import fs7 from "fs/promises";
8773
+ import fs10 from "fs/promises";
8774
+ import { execFile } from "child_process";
8775
+ import { promisify } from "util";
8770
8776
  async function applyTemplateFiles(root, template) {
8771
8777
  const oneagentDir = path9.join(root, ".oneagent");
8772
- await fs7.mkdir(path9.join(oneagentDir, "rules"), { recursive: true });
8773
- await fs7.mkdir(path9.join(oneagentDir, "skills"), { recursive: true });
8774
- await Bun.write(path9.join(oneagentDir, "instructions.md"), template.instructions);
8778
+ await fs10.mkdir(path9.join(oneagentDir, "rules"), { recursive: true });
8779
+ await fs10.mkdir(path9.join(oneagentDir, "skills"), { recursive: true });
8780
+ await fs10.writeFile(path9.join(oneagentDir, "instructions.md"), template.instructions);
8775
8781
  for (const rule of template.rules) {
8776
- await Bun.write(path9.join(oneagentDir, "rules", `${rule.name}.md`), rule.content);
8782
+ await fs10.writeFile(path9.join(oneagentDir, "rules", `${rule.name}.md`), rule.content);
8777
8783
  }
8778
8784
  }
8779
8785
  async function installTemplateSkills(root, template, onSkillInstalled) {
8780
8786
  for (const identifier of template.skills) {
8781
8787
  try {
8782
- await Bun.$`bunx skills add ${identifier} --agent universal --yes`.cwd(root).quiet();
8788
+ await execFileAsync("npx", ["skills", "add", identifier, "--agent", "universal", "--yes"], { cwd: root });
8783
8789
  onSkillInstalled?.(identifier);
8784
8790
  } catch (err) {
8785
8791
  const message = err instanceof Error ? err.message : String(err);
@@ -8849,7 +8855,10 @@ async function fetchGitHubRules(repoUrl) {
8849
8855
  return [];
8850
8856
  }
8851
8857
  }
8852
- var init_apply_template = () => {};
8858
+ var execFileAsync;
8859
+ var init_apply_template = __esm(() => {
8860
+ execFileAsync = promisify(execFile);
8861
+ });
8853
8862
 
8854
8863
  // ../core/src/index.ts
8855
8864
  var init_src = __esm(() => {
@@ -8900,12 +8909,13 @@ var init_utils = __esm(() => {
8900
8909
 
8901
8910
  // ../templates/src/index.ts
8902
8911
  import path10 from "path";
8903
- import fs8 from "fs/promises";
8912
+ import fs11 from "fs/promises";
8913
+ import { fileURLToPath } from "url";
8904
8914
  async function loadTemplate(name) {
8905
- const templateDir = path10.join(import.meta.dir, "templates", name);
8915
+ const templateDir = path10.join(__dirname2, "templates", name);
8906
8916
  const [yamlText, instructions] = await Promise.all([
8907
- Bun.file(path10.join(templateDir, "template.yml")).text(),
8908
- Bun.file(path10.join(templateDir, "instructions.md")).text()
8917
+ fs11.readFile(path10.join(templateDir, "template.yml"), "utf-8"),
8918
+ fs11.readFile(path10.join(templateDir, "instructions.md"), "utf-8")
8909
8919
  ]);
8910
8920
  const descMatch = yamlText.match(/^description:\s*(.+)$/m);
8911
8921
  const description = descMatch?.[1]?.trim() ?? "";
@@ -8923,10 +8933,10 @@ async function loadTemplate(name) {
8923
8933
  const rulesDir = path10.join(templateDir, "rules");
8924
8934
  let rules2 = [];
8925
8935
  try {
8926
- const ruleFiles = await fs8.readdir(rulesDir);
8936
+ const ruleFiles = await fs11.readdir(rulesDir);
8927
8937
  rules2 = await Promise.all(ruleFiles.filter((f) => f.endsWith(".md")).map(async (f) => ({
8928
8938
  name: path10.basename(f, ".md"),
8929
- content: await Bun.file(path10.join(rulesDir, f)).text()
8939
+ content: await fs11.readFile(path10.join(rulesDir, f), "utf-8")
8930
8940
  })));
8931
8941
  } catch {}
8932
8942
  return { name, description, skills: skills2, instructions, rules: rules2 };
@@ -8936,8 +8946,9 @@ async function resolveBuiltinTemplate(name) {
8936
8946
  return null;
8937
8947
  return loadTemplate(name);
8938
8948
  }
8939
- var TEMPLATE_NAMES, BUILTIN_TEMPLATE_NAMES;
8949
+ var __dirname2, TEMPLATE_NAMES, BUILTIN_TEMPLATE_NAMES;
8940
8950
  var init_src2 = __esm(() => {
8951
+ __dirname2 = path10.dirname(fileURLToPath(import.meta.url));
8941
8952
  TEMPLATE_NAMES = ["default", "react", "react-native"];
8942
8953
  BUILTIN_TEMPLATE_NAMES = TEMPLATE_NAMES;
8943
8954
  });
@@ -8948,7 +8959,7 @@ __export(exports_init, {
8948
8959
  default: () => init_default
8949
8960
  });
8950
8961
  import path11 from "path";
8951
- import fs9 from "fs/promises";
8962
+ import fs12 from "fs/promises";
8952
8963
  function cancelAndExit() {
8953
8964
  Le("Cancelled.");
8954
8965
  process.exit(0);
@@ -9022,10 +9033,10 @@ async function backupFiles(root, files) {
9022
9033
  if (files.length === 0)
9023
9034
  return;
9024
9035
  const backupDir = path11.join(root, ".oneagent/backup");
9025
- await fs9.mkdir(backupDir, { recursive: true });
9036
+ await fs12.mkdir(backupDir, { recursive: true });
9026
9037
  for (const file of files) {
9027
9038
  const safeName = file.relativePath.replace(/\//g, "_");
9028
- await Bun.write(path11.join(backupDir, safeName), file.content);
9039
+ await fs12.writeFile(path11.join(backupDir, safeName), file.content);
9029
9040
  }
9030
9041
  }
9031
9042
  async function resolveTemplate(templateArg) {
@@ -9105,8 +9116,8 @@ var init_init = __esm(() => {
9105
9116
  const selectedTargets = await pickTargets();
9106
9117
  const s = bt2();
9107
9118
  s.start("Setting up .oneagent/ directory...");
9108
- await fs9.mkdir(path11.join(root, ".oneagent/rules"), { recursive: true });
9109
- await fs9.mkdir(path11.join(root, ".oneagent/skills"), { recursive: true });
9119
+ await fs12.mkdir(path11.join(root, ".oneagent/rules"), { recursive: true });
9120
+ await fs12.mkdir(path11.join(root, ".oneagent/skills"), { recursive: true });
9110
9121
  await backupFiles(root, detected);
9111
9122
  await removeDeprecatedFiles(root);
9112
9123
  await warnDeprecatedCommandFiles(root);
@@ -9120,9 +9131,9 @@ var init_init = __esm(() => {
9120
9131
 
9121
9132
  Add your AI instructions here.
9122
9133
  `;
9123
- await Bun.write(path11.join(root, ".oneagent/instructions.md"), instructionsContent);
9134
+ await fs12.writeFile(path11.join(root, ".oneagent/instructions.md"), instructionsContent);
9124
9135
  }
9125
- await Bun.write(path11.join(root, ".oneagent/rules/oneagent.md"), DOTAI_META_RULE);
9136
+ await fs12.writeFile(path11.join(root, ".oneagent/rules/oneagent.md"), DOTAI_META_RULE);
9126
9137
  s.stop("Directory structure created.");
9127
9138
  const s2 = bt2();
9128
9139
  s2.start("Generating symlinks and agent files...");
@@ -9158,7 +9169,7 @@ __export(exports_generate, {
9158
9169
  default: () => generate_default
9159
9170
  });
9160
9171
  import path12 from "path";
9161
- import fs10 from "fs/promises";
9172
+ import fs13 from "fs/promises";
9162
9173
  var generate_default;
9163
9174
  var init_generate2 = __esm(() => {
9164
9175
  init_dist();
@@ -9182,10 +9193,10 @@ var init_generate2 = __esm(() => {
9182
9193
  const { mainFiles, ruleSkillFiles } = await detectGenerateCollisions(root, config2);
9183
9194
  if (mainFiles.length > 0) {
9184
9195
  const backupDir = path12.join(root, ".oneagent/backup");
9185
- await fs10.mkdir(backupDir, { recursive: true });
9196
+ await fs13.mkdir(backupDir, { recursive: true });
9186
9197
  for (const file of mainFiles) {
9187
9198
  const safeName = file.relativePath.replace(/\//g, "_");
9188
- await Bun.write(path12.join(backupDir, safeName), file.content);
9199
+ await fs13.writeFile(path12.join(backupDir, safeName), file.content);
9189
9200
  }
9190
9201
  }
9191
9202
  await warnDeprecatedCommandFiles(root);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oneagent",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "type": "module",
5
5
  "description": "One source of truth for AI agent rules — distributed via symlinks to Claude, Cursor, Windsurf, Copilot, OpenCode",
6
6
  "license": "MIT",