@jayjiang/byoao 2.0.4 → 2.0.6

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 CHANGED
@@ -4682,13 +4682,13 @@ var require_ast = __commonJS({
4682
4682
  helperExpression: function helperExpression(node) {
4683
4683
  return node.type === "SubExpression" || (node.type === "MustacheStatement" || node.type === "BlockStatement") && !!(node.params && node.params.length || node.hash);
4684
4684
  },
4685
- scopedId: function scopedId(path13) {
4686
- return /^\.|this\b/.test(path13.original);
4685
+ scopedId: function scopedId(path14) {
4686
+ return /^\.|this\b/.test(path14.original);
4687
4687
  },
4688
4688
  // an ID is simple if it only has one part, and that part is not
4689
4689
  // `..` or `this`.
4690
- simpleId: function simpleId(path13) {
4691
- return path13.parts.length === 1 && !AST.helpers.scopedId(path13) && !path13.depth;
4690
+ simpleId: function simpleId(path14) {
4691
+ return path14.parts.length === 1 && !AST.helpers.scopedId(path14) && !path14.depth;
4692
4692
  }
4693
4693
  }
4694
4694
  };
@@ -5758,12 +5758,12 @@ var require_helpers2 = __commonJS({
5758
5758
  loc
5759
5759
  };
5760
5760
  }
5761
- function prepareMustache(path13, params, hash2, open, strip, locInfo) {
5761
+ function prepareMustache(path14, params, hash2, open, strip, locInfo) {
5762
5762
  var escapeFlag = open.charAt(3) || open.charAt(2), escaped = escapeFlag !== "{" && escapeFlag !== "&";
5763
5763
  var decorator = /\*/.test(open);
5764
5764
  return {
5765
5765
  type: decorator ? "Decorator" : "MustacheStatement",
5766
- path: path13,
5766
+ path: path14,
5767
5767
  params,
5768
5768
  hash: hash2,
5769
5769
  escaped,
@@ -6033,9 +6033,9 @@ var require_compiler = __commonJS({
6033
6033
  },
6034
6034
  DecoratorBlock: function DecoratorBlock(decorator) {
6035
6035
  var program = decorator.program && this.compileProgram(decorator.program);
6036
- var params = this.setupFullMustacheParams(decorator, program, void 0), path13 = decorator.path;
6036
+ var params = this.setupFullMustacheParams(decorator, program, void 0), path14 = decorator.path;
6037
6037
  this.useDecorators = true;
6038
- this.opcode("registerDecorator", params.length, path13.original);
6038
+ this.opcode("registerDecorator", params.length, path14.original);
6039
6039
  },
6040
6040
  PartialStatement: function PartialStatement(partial2) {
6041
6041
  this.usePartial = true;
@@ -6099,46 +6099,46 @@ var require_compiler = __commonJS({
6099
6099
  }
6100
6100
  },
6101
6101
  ambiguousSexpr: function ambiguousSexpr(sexpr, program, inverse) {
6102
- var path13 = sexpr.path, name = path13.parts[0], isBlock = program != null || inverse != null;
6103
- this.opcode("getContext", path13.depth);
6102
+ var path14 = sexpr.path, name = path14.parts[0], isBlock = program != null || inverse != null;
6103
+ this.opcode("getContext", path14.depth);
6104
6104
  this.opcode("pushProgram", program);
6105
6105
  this.opcode("pushProgram", inverse);
6106
- path13.strict = true;
6107
- this.accept(path13);
6106
+ path14.strict = true;
6107
+ this.accept(path14);
6108
6108
  this.opcode("invokeAmbiguous", name, isBlock);
6109
6109
  },
6110
6110
  simpleSexpr: function simpleSexpr(sexpr) {
6111
- var path13 = sexpr.path;
6112
- path13.strict = true;
6113
- this.accept(path13);
6111
+ var path14 = sexpr.path;
6112
+ path14.strict = true;
6113
+ this.accept(path14);
6114
6114
  this.opcode("resolvePossibleLambda");
6115
6115
  },
6116
6116
  helperSexpr: function helperSexpr(sexpr, program, inverse) {
6117
- var params = this.setupFullMustacheParams(sexpr, program, inverse), path13 = sexpr.path, name = path13.parts[0];
6117
+ var params = this.setupFullMustacheParams(sexpr, program, inverse), path14 = sexpr.path, name = path14.parts[0];
6118
6118
  if (this.options.knownHelpers[name]) {
6119
6119
  this.opcode("invokeKnownHelper", params.length, name);
6120
6120
  } else if (this.options.knownHelpersOnly) {
6121
6121
  throw new _exception2["default"]("You specified knownHelpersOnly, but used the unknown helper " + name, sexpr);
6122
6122
  } else {
6123
- path13.strict = true;
6124
- path13.falsy = true;
6125
- this.accept(path13);
6126
- this.opcode("invokeHelper", params.length, path13.original, _ast2["default"].helpers.simpleId(path13));
6123
+ path14.strict = true;
6124
+ path14.falsy = true;
6125
+ this.accept(path14);
6126
+ this.opcode("invokeHelper", params.length, path14.original, _ast2["default"].helpers.simpleId(path14));
6127
6127
  }
6128
6128
  },
6129
- PathExpression: function PathExpression(path13) {
6130
- this.addDepth(path13.depth);
6131
- this.opcode("getContext", path13.depth);
6132
- var name = path13.parts[0], scoped = _ast2["default"].helpers.scopedId(path13), blockParamId = !path13.depth && !scoped && this.blockParamIndex(name);
6129
+ PathExpression: function PathExpression(path14) {
6130
+ this.addDepth(path14.depth);
6131
+ this.opcode("getContext", path14.depth);
6132
+ var name = path14.parts[0], scoped = _ast2["default"].helpers.scopedId(path14), blockParamId = !path14.depth && !scoped && this.blockParamIndex(name);
6133
6133
  if (blockParamId) {
6134
- this.opcode("lookupBlockParam", blockParamId, path13.parts);
6134
+ this.opcode("lookupBlockParam", blockParamId, path14.parts);
6135
6135
  } else if (!name) {
6136
6136
  this.opcode("pushContext");
6137
- } else if (path13.data) {
6137
+ } else if (path14.data) {
6138
6138
  this.options.data = true;
6139
- this.opcode("lookupData", path13.depth, path13.parts, path13.strict);
6139
+ this.opcode("lookupData", path14.depth, path14.parts, path14.strict);
6140
6140
  } else {
6141
- this.opcode("lookupOnContext", path13.parts, path13.falsy, path13.strict, scoped);
6141
+ this.opcode("lookupOnContext", path14.parts, path14.falsy, path14.strict, scoped);
6142
6142
  }
6143
6143
  },
6144
6144
  StringLiteral: function StringLiteral(string4) {
@@ -6488,16 +6488,16 @@ var require_util = __commonJS({
6488
6488
  }
6489
6489
  exports2.urlGenerate = urlGenerate;
6490
6490
  function normalize(aPath) {
6491
- var path13 = aPath;
6491
+ var path14 = aPath;
6492
6492
  var url2 = urlParse(aPath);
6493
6493
  if (url2) {
6494
6494
  if (!url2.path) {
6495
6495
  return aPath;
6496
6496
  }
6497
- path13 = url2.path;
6497
+ path14 = url2.path;
6498
6498
  }
6499
- var isAbsolute = exports2.isAbsolute(path13);
6500
- var parts = path13.split(/\/+/);
6499
+ var isAbsolute = exports2.isAbsolute(path14);
6500
+ var parts = path14.split(/\/+/);
6501
6501
  for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
6502
6502
  part = parts[i];
6503
6503
  if (part === ".") {
@@ -6514,15 +6514,15 @@ var require_util = __commonJS({
6514
6514
  }
6515
6515
  }
6516
6516
  }
6517
- path13 = parts.join("/");
6518
- if (path13 === "") {
6519
- path13 = isAbsolute ? "/" : ".";
6517
+ path14 = parts.join("/");
6518
+ if (path14 === "") {
6519
+ path14 = isAbsolute ? "/" : ".";
6520
6520
  }
6521
6521
  if (url2) {
6522
- url2.path = path13;
6522
+ url2.path = path14;
6523
6523
  return urlGenerate(url2);
6524
6524
  }
6525
- return path13;
6525
+ return path14;
6526
6526
  }
6527
6527
  exports2.normalize = normalize;
6528
6528
  function join2(aRoot, aPath) {
@@ -9303,8 +9303,8 @@ var require_printer = __commonJS({
9303
9303
  return this.accept(sexpr.path) + " " + params + hash2;
9304
9304
  };
9305
9305
  PrintVisitor.prototype.PathExpression = function(id) {
9306
- var path13 = id.parts.join("/");
9307
- return (id.data ? "@" : "") + "PATH:" + path13;
9306
+ var path14 = id.parts.join("/");
9307
+ return (id.data ? "@" : "") + "PATH:" + path14;
9308
9308
  };
9309
9309
  PrintVisitor.prototype.StringLiteral = function(string4) {
9310
9310
  return '"' + string4.value + '"';
@@ -12015,10 +12015,10 @@ function mergeDefs(...defs) {
12015
12015
  function cloneDef(schema) {
12016
12016
  return mergeDefs(schema._zod.def);
12017
12017
  }
12018
- function getElementAtPath(obj, path13) {
12019
- if (!path13)
12018
+ function getElementAtPath(obj, path14) {
12019
+ if (!path14)
12020
12020
  return obj;
12021
- return path13.reduce((acc, key) => acc?.[key], obj);
12021
+ return path14.reduce((acc, key) => acc?.[key], obj);
12022
12022
  }
12023
12023
  function promiseAllObject(promisesObj) {
12024
12024
  const keys = Object.keys(promisesObj);
@@ -12379,11 +12379,11 @@ function aborted(x, startIndex = 0) {
12379
12379
  }
12380
12380
  return false;
12381
12381
  }
12382
- function prefixIssues(path13, issues) {
12382
+ function prefixIssues(path14, issues) {
12383
12383
  return issues.map((iss) => {
12384
12384
  var _a;
12385
12385
  (_a = iss).path ?? (_a.path = []);
12386
- iss.path.unshift(path13);
12386
+ iss.path.unshift(path14);
12387
12387
  return iss;
12388
12388
  });
12389
12389
  }
@@ -12551,7 +12551,7 @@ function treeifyError(error45, _mapper) {
12551
12551
  return issue2.message;
12552
12552
  };
12553
12553
  const result = { errors: [] };
12554
- const processError = (error46, path13 = []) => {
12554
+ const processError = (error46, path14 = []) => {
12555
12555
  var _a, _b;
12556
12556
  for (const issue2 of error46.issues) {
12557
12557
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -12561,7 +12561,7 @@ function treeifyError(error45, _mapper) {
12561
12561
  } else if (issue2.code === "invalid_element") {
12562
12562
  processError({ issues: issue2.issues }, issue2.path);
12563
12563
  } else {
12564
- const fullpath = [...path13, ...issue2.path];
12564
+ const fullpath = [...path14, ...issue2.path];
12565
12565
  if (fullpath.length === 0) {
12566
12566
  result.errors.push(mapper(issue2));
12567
12567
  continue;
@@ -12593,8 +12593,8 @@ function treeifyError(error45, _mapper) {
12593
12593
  }
12594
12594
  function toDotPath(_path) {
12595
12595
  const segs = [];
12596
- const path13 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
12597
- for (const seg of path13) {
12596
+ const path14 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
12597
+ for (const seg of path14) {
12598
12598
  if (typeof seg === "number")
12599
12599
  segs.push(`[${seg}]`);
12600
12600
  else if (typeof seg === "symbol")
@@ -24273,8 +24273,8 @@ function getErrorMap2() {
24273
24273
 
24274
24274
  // node_modules/zod/v3/helpers/parseUtil.js
24275
24275
  var makeIssue = (params) => {
24276
- const { data, path: path13, errorMaps, issueData } = params;
24277
- const fullPath = [...path13, ...issueData.path || []];
24276
+ const { data, path: path14, errorMaps, issueData } = params;
24277
+ const fullPath = [...path14, ...issueData.path || []];
24278
24278
  const fullIssue = {
24279
24279
  ...issueData,
24280
24280
  path: fullPath
@@ -24390,11 +24390,11 @@ var errorUtil;
24390
24390
 
24391
24391
  // node_modules/zod/v3/types.js
24392
24392
  var ParseInputLazyPath = class {
24393
- constructor(parent, value, path13, key) {
24393
+ constructor(parent, value, path14, key) {
24394
24394
  this._cachedPath = [];
24395
24395
  this.parent = parent;
24396
24396
  this.data = value;
24397
- this._path = path13;
24397
+ this._path = path14;
24398
24398
  this._key = key;
24399
24399
  }
24400
24400
  get path() {
@@ -28262,7 +28262,7 @@ async function configureProvider(provider, gcpProjectId) {
28262
28262
 
28263
28263
  // dist/vault/manifest.js
28264
28264
  import path4 from "node:path";
28265
- var PKG_VERSION = "2.0.4";
28265
+ var PKG_VERSION = "2.0.6";
28266
28266
  var InfrastructureSchema = external_exports2.object({
28267
28267
  skills: external_exports2.array(external_exports2.string()).default([]),
28268
28268
  commands: external_exports2.array(external_exports2.string()).default([]),
@@ -28622,8 +28622,8 @@ function getLinuxPaths() {
28622
28622
  ];
28623
28623
  }
28624
28624
  function findInstallPath() {
28625
- const os5 = platform();
28626
- if (os5 === "darwin") {
28625
+ const os6 = platform();
28626
+ if (os6 === "darwin") {
28627
28627
  for (const p of getMacAppPaths()) {
28628
28628
  if (existsSync2(p))
28629
28629
  return p;
@@ -28637,7 +28637,7 @@ function findInstallPath() {
28637
28637
  return result.split("\n")[0];
28638
28638
  } catch {
28639
28639
  }
28640
- } else if (os5 === "linux") {
28640
+ } else if (os6 === "linux") {
28641
28641
  for (const p of getLinuxPaths()) {
28642
28642
  if (existsSync2(p))
28643
28643
  return p;
@@ -28651,7 +28651,7 @@ function findInstallPath() {
28651
28651
  return result;
28652
28652
  } catch {
28653
28653
  }
28654
- } else if (os5 === "win32") {
28654
+ } else if (os6 === "win32") {
28655
28655
  const localAppData = process.env.LOCALAPPDATA || "";
28656
28656
  const winPath = `${localAppData}\\Obsidian\\Obsidian.exe`;
28657
28657
  if (existsSync2(winPath))
@@ -28660,21 +28660,21 @@ function findInstallPath() {
28660
28660
  return null;
28661
28661
  }
28662
28662
  function isRunning() {
28663
- const os5 = platform();
28663
+ const os6 = platform();
28664
28664
  try {
28665
- if (os5 === "darwin") {
28665
+ if (os6 === "darwin") {
28666
28666
  const result = execSync2("pgrep -x Obsidian", {
28667
28667
  timeout: 3e3,
28668
28668
  encoding: "utf-8"
28669
28669
  }).trim();
28670
28670
  return result.length > 0;
28671
- } else if (os5 === "linux") {
28671
+ } else if (os6 === "linux") {
28672
28672
  const result = execSync2("pgrep -x obsidian", {
28673
28673
  timeout: 3e3,
28674
28674
  encoding: "utf-8"
28675
28675
  }).trim();
28676
28676
  return result.length > 0;
28677
- } else if (os5 === "win32") {
28677
+ } else if (os6 === "win32") {
28678
28678
  const result = execSync2('tasklist /FI "IMAGENAME eq Obsidian.exe" /NH', {
28679
28679
  timeout: 3e3,
28680
28680
  encoding: "utf-8"
@@ -29268,7 +29268,74 @@ var byoao_switch_provider = tool({
29268
29268
  });
29269
29269
 
29270
29270
  // dist/vault/upgrade.js
29271
+ import path11 from "node:path";
29272
+ import os4 from "node:os";
29273
+
29274
+ // dist/vault/copy-bundled-skills.js
29271
29275
  import path10 from "node:path";
29276
+ function resolveBundledAssetsRoot() {
29277
+ const distAssets = path10.resolve(import.meta.dirname, "assets");
29278
+ const srcAssets = path10.resolve(import.meta.dirname, "..", "assets");
29279
+ const devAssets = path10.resolve(import.meta.dirname, "..", "..", "src", "assets");
29280
+ if (fs.existsSync(distAssets))
29281
+ return distAssets;
29282
+ if (fs.existsSync(srcAssets))
29283
+ return srcAssets;
29284
+ if (fs.existsSync(devAssets))
29285
+ return devAssets;
29286
+ return distAssets;
29287
+ }
29288
+ function resolveBundledByoaoSkillsRoot() {
29289
+ const distSkills = path10.resolve(import.meta.dirname, "assets", "skills");
29290
+ const srcSkills = path10.resolve(import.meta.dirname, "..", "skills");
29291
+ const devSkills = path10.resolve(import.meta.dirname, "..", "..", "src", "skills");
29292
+ if (fs.existsSync(distSkills))
29293
+ return distSkills;
29294
+ if (fs.existsSync(srcSkills))
29295
+ return srcSkills;
29296
+ if (fs.existsSync(devSkills))
29297
+ return devSkills;
29298
+ return distSkills;
29299
+ }
29300
+ async function copyBundledSkillsToOpenCodeSkillsDir(targetSkillsRoot, options2) {
29301
+ const includeObsidian = options2?.includeObsidianSkills !== false;
29302
+ await fs.ensureDir(targetSkillsRoot);
29303
+ const assetsRoot = resolveBundledAssetsRoot();
29304
+ const byoaoSkillsRoot = resolveBundledByoaoSkillsRoot();
29305
+ let obsidianSkills = 0;
29306
+ let byoaoSkills = 0;
29307
+ if (includeObsidian) {
29308
+ const obsidianSrc = path10.join(assetsRoot, "obsidian-skills");
29309
+ if (fs.existsSync(obsidianSrc)) {
29310
+ for (const file2 of fs.readdirSync(obsidianSrc)) {
29311
+ if (!file2.endsWith(".md"))
29312
+ continue;
29313
+ const skillName = file2.replace(/\.md$/, "");
29314
+ const destDir = path10.join(targetSkillsRoot, skillName);
29315
+ await fs.ensureDir(destDir);
29316
+ await fs.copy(path10.join(obsidianSrc, file2), path10.join(destDir, "SKILL.md"), { overwrite: true });
29317
+ obsidianSkills++;
29318
+ }
29319
+ }
29320
+ }
29321
+ if (fs.existsSync(byoaoSkillsRoot)) {
29322
+ const entries = await fs.readdir(byoaoSkillsRoot, { withFileTypes: true });
29323
+ for (const entry of entries) {
29324
+ if (!entry.isDirectory())
29325
+ continue;
29326
+ const srcSkill = path10.join(byoaoSkillsRoot, entry.name, "SKILL.md");
29327
+ if (await fs.pathExists(srcSkill)) {
29328
+ const destDir = path10.join(targetSkillsRoot, entry.name);
29329
+ await fs.ensureDir(destDir);
29330
+ await fs.copy(srcSkill, path10.join(destDir, "SKILL.md"), { overwrite: true });
29331
+ byoaoSkills++;
29332
+ }
29333
+ }
29334
+ }
29335
+ return { obsidianSkills, byoaoSkills };
29336
+ }
29337
+
29338
+ // dist/vault/upgrade.js
29272
29339
  var OBSIDIAN_CONFIG_FILES = ["core-plugins.json"];
29273
29340
  async function scanInstalledAssets(vaultPath) {
29274
29341
  const skills = await scanSkillDirs(vaultPath);
@@ -29276,7 +29343,7 @@ async function scanInstalledAssets(vaultPath) {
29276
29343
  const templates = await scanDir(vaultPath, "Knowledge/templates", ".md");
29277
29344
  const obsidianConfig = [];
29278
29345
  for (const file2 of OBSIDIAN_CONFIG_FILES) {
29279
- const abs = path10.join(vaultPath, ".obsidian", file2);
29346
+ const abs = path11.join(vaultPath, ".obsidian", file2);
29280
29347
  if (await fs.pathExists(abs)) {
29281
29348
  obsidianConfig.push(`.obsidian/${file2}`);
29282
29349
  }
@@ -29284,21 +29351,21 @@ async function scanInstalledAssets(vaultPath) {
29284
29351
  return { skills, commands, obsidianConfig, templates };
29285
29352
  }
29286
29353
  async function scanDir(vaultPath, relDir, ext) {
29287
- const absDir = path10.join(vaultPath, relDir);
29354
+ const absDir = path11.join(vaultPath, relDir);
29288
29355
  if (!await fs.pathExists(absDir))
29289
29356
  return [];
29290
29357
  const files = await fs.readdir(absDir);
29291
29358
  return files.filter((f) => f.endsWith(ext)).map((f) => `${relDir}/${f}`);
29292
29359
  }
29293
29360
  async function scanSkillDirs(vaultPath) {
29294
- const skillsRoot = path10.join(vaultPath, ".opencode", "skills");
29361
+ const skillsRoot = path11.join(vaultPath, ".opencode", "skills");
29295
29362
  if (!await fs.pathExists(skillsRoot))
29296
29363
  return [];
29297
29364
  const results = [];
29298
29365
  const entries = await fs.readdir(skillsRoot, { withFileTypes: true });
29299
29366
  for (const entry of entries) {
29300
29367
  if (entry.isDirectory()) {
29301
- const skillMd = path10.join(skillsRoot, entry.name, "SKILL.md");
29368
+ const skillMd = path11.join(skillsRoot, entry.name, "SKILL.md");
29302
29369
  if (await fs.pathExists(skillMd)) {
29303
29370
  results.push(`.opencode/skills/${entry.name}/SKILL.md`);
29304
29371
  }
@@ -29327,7 +29394,7 @@ function buildUpgradePlan(vaultPath, manifest, packageAssets) {
29327
29394
  const installed = new Set(manifest.infrastructure[key]);
29328
29395
  const shippedPaths = new Set(shipped.map((s) => s.relativePath));
29329
29396
  for (const entry of shipped) {
29330
- const onDisk = fs.existsSync(path10.join(vaultPath, entry.relativePath));
29397
+ const onDisk = fs.existsSync(path11.join(vaultPath, entry.relativePath));
29331
29398
  items.push({
29332
29399
  file: entry.relativePath,
29333
29400
  action: onDisk ? "update" : "add",
@@ -29358,20 +29425,20 @@ Entries are appended here during /cook operations.
29358
29425
  `;
29359
29426
  async function migrateV1ToV2Infrastructure(vaultPath) {
29360
29427
  for (const dir of LLM_WIKI_AGENT_DIRS) {
29361
- const dirPath = path10.join(vaultPath, dir);
29428
+ const dirPath = path11.join(vaultPath, dir);
29362
29429
  if (!await fs.pathExists(dirPath)) {
29363
29430
  await fs.ensureDir(dirPath);
29364
29431
  }
29365
29432
  }
29366
- const schemaPath = path10.join(vaultPath, "SCHEMA.md");
29433
+ const schemaPath = path11.join(vaultPath, "SCHEMA.md");
29367
29434
  if (!await fs.pathExists(schemaPath)) {
29368
29435
  const commonDir = getCommonDir();
29369
- const schemaTemplatePath = path10.join(commonDir, "SCHEMA.md.hbs");
29436
+ const schemaTemplatePath = path11.join(commonDir, "SCHEMA.md.hbs");
29370
29437
  let content;
29371
29438
  if (await fs.pathExists(schemaTemplatePath)) {
29372
29439
  const schemaTemplate = await fs.readFile(schemaTemplatePath, "utf-8");
29373
29440
  content = renderTemplate(schemaTemplate, {
29374
- KB_NAME: path10.basename(vaultPath),
29441
+ KB_NAME: path11.basename(vaultPath),
29375
29442
  WIKI_DOMAIN: ""
29376
29443
  });
29377
29444
  } else {
@@ -29383,7 +29450,7 @@ This file describes the vault knowledge schema. Update it as your model evolves.
29383
29450
  }
29384
29451
  await fs.writeFile(schemaPath, content, "utf-8");
29385
29452
  }
29386
- const logPath = path10.join(vaultPath, "log.md");
29453
+ const logPath = path11.join(vaultPath, "log.md");
29387
29454
  if (!await fs.pathExists(logPath)) {
29388
29455
  await fs.writeFile(logPath, LOG_MD_PLACEHOLDER, "utf-8");
29389
29456
  }
@@ -29403,16 +29470,16 @@ var BYOAO_SKILL_NAMES = [
29403
29470
  "wiki"
29404
29471
  ];
29405
29472
  async function migrateCommandsToSkills(vaultPath) {
29406
- const commandsDir = path10.join(vaultPath, ".opencode", "commands");
29473
+ const commandsDir = path11.join(vaultPath, ".opencode", "commands");
29407
29474
  if (!await fs.pathExists(commandsDir))
29408
29475
  return;
29409
- const skillsDir = path10.join(vaultPath, ".opencode", "skills");
29476
+ const skillsDir = path11.join(vaultPath, ".opencode", "skills");
29410
29477
  for (const name of BYOAO_SKILL_NAMES) {
29411
- const src = path10.join(commandsDir, `${name}.md`);
29478
+ const src = path11.join(commandsDir, `${name}.md`);
29412
29479
  if (!await fs.pathExists(src))
29413
29480
  continue;
29414
- const destDir = path10.join(skillsDir, name);
29415
- const dest = path10.join(destDir, "SKILL.md");
29481
+ const destDir = path11.join(skillsDir, name);
29482
+ const dest = path11.join(destDir, "SKILL.md");
29416
29483
  if (await fs.pathExists(dest)) {
29417
29484
  await fs.remove(src);
29418
29485
  continue;
@@ -29427,7 +29494,7 @@ async function migrateCommandsToSkills(vaultPath) {
29427
29494
  }
29428
29495
  async function collectV1DeprecatedInfrastructureItems(vaultPath) {
29429
29496
  const items = [];
29430
- const templatesDir = path10.join(vaultPath, "Knowledge", "templates");
29497
+ const templatesDir = path11.join(vaultPath, "Knowledge", "templates");
29431
29498
  if (await fs.pathExists(templatesDir)) {
29432
29499
  const files = await fs.readdir(templatesDir);
29433
29500
  for (const f of files) {
@@ -29442,7 +29509,7 @@ async function collectV1DeprecatedInfrastructureItems(vaultPath) {
29442
29509
  }
29443
29510
  for (const cmd of ["weave.md", "emerge.md"]) {
29444
29511
  const rel = `.opencode/commands/${cmd}`;
29445
- if (await fs.pathExists(path10.join(vaultPath, rel))) {
29512
+ if (await fs.pathExists(path11.join(vaultPath, rel))) {
29446
29513
  items.push({
29447
29514
  file: rel,
29448
29515
  action: "deprecated",
@@ -29462,9 +29529,9 @@ function mergeForcedDeprecatedIntoPlan(items, forced) {
29462
29529
  return [...byFile.values()];
29463
29530
  }
29464
29531
  function resolveAssetsDir2() {
29465
- const distAssets = path10.resolve(import.meta.dirname, "assets");
29466
- const srcAssets = path10.resolve(import.meta.dirname, "..", "assets");
29467
- const devAssets = path10.resolve(import.meta.dirname, "..", "..", "src", "assets");
29532
+ const distAssets = path11.resolve(import.meta.dirname, "assets");
29533
+ const srcAssets = path11.resolve(import.meta.dirname, "..", "assets");
29534
+ const devAssets = path11.resolve(import.meta.dirname, "..", "..", "src", "assets");
29468
29535
  if (fs.existsSync(distAssets))
29469
29536
  return distAssets;
29470
29537
  if (fs.existsSync(srcAssets))
@@ -29474,9 +29541,9 @@ function resolveAssetsDir2() {
29474
29541
  return distAssets;
29475
29542
  }
29476
29543
  function resolveSkillsDir() {
29477
- const distSkills = path10.resolve(import.meta.dirname, "assets", "skills");
29478
- const srcSkills = path10.resolve(import.meta.dirname, "..", "skills");
29479
- const devSkills = path10.resolve(import.meta.dirname, "..", "..", "src", "skills");
29544
+ const distSkills = path11.resolve(import.meta.dirname, "assets", "skills");
29545
+ const srcSkills = path11.resolve(import.meta.dirname, "..", "skills");
29546
+ const devSkills = path11.resolve(import.meta.dirname, "..", "..", "src", "skills");
29480
29547
  if (fs.existsSync(distSkills))
29481
29548
  return distSkills;
29482
29549
  if (fs.existsSync(srcSkills))
@@ -29493,14 +29560,14 @@ function resolvePackageAssets(preset) {
29493
29560
  const commands = [];
29494
29561
  const obsidianConfig = [];
29495
29562
  const templates = [];
29496
- const obsidianSkillsDir = path10.join(assetsDir, "obsidian-skills");
29563
+ const obsidianSkillsDir = path11.join(assetsDir, "obsidian-skills");
29497
29564
  if (fs.existsSync(obsidianSkillsDir)) {
29498
29565
  for (const file2 of fs.readdirSync(obsidianSkillsDir)) {
29499
29566
  if (file2.endsWith(".md")) {
29500
29567
  const skillName = file2.replace(/\.md$/, "");
29501
29568
  skills.push({
29502
29569
  relativePath: `.opencode/skills/${skillName}/SKILL.md`,
29503
- sourcePath: path10.join(obsidianSkillsDir, file2)
29570
+ sourcePath: path11.join(obsidianSkillsDir, file2)
29504
29571
  });
29505
29572
  }
29506
29573
  }
@@ -29508,7 +29575,7 @@ function resolvePackageAssets(preset) {
29508
29575
  if (fs.existsSync(skillsDir)) {
29509
29576
  for (const entry of fs.readdirSync(skillsDir, { withFileTypes: true })) {
29510
29577
  if (entry.isDirectory()) {
29511
- const skillMd = path10.join(skillsDir, entry.name, "SKILL.md");
29578
+ const skillMd = path11.join(skillsDir, entry.name, "SKILL.md");
29512
29579
  if (fs.existsSync(skillMd)) {
29513
29580
  skills.push({
29514
29581
  relativePath: `.opencode/skills/${entry.name}/SKILL.md`,
@@ -29518,10 +29585,10 @@ function resolvePackageAssets(preset) {
29518
29585
  }
29519
29586
  }
29520
29587
  }
29521
- const obsidianSrcDir = path10.join(commonDir, "obsidian");
29588
+ const obsidianSrcDir = path11.join(commonDir, "obsidian");
29522
29589
  if (fs.existsSync(obsidianSrcDir)) {
29523
29590
  for (const file2 of OBSIDIAN_CONFIG_FILES) {
29524
- const srcPath = path10.join(obsidianSrcDir, file2);
29591
+ const srcPath = path11.join(obsidianSrcDir, file2);
29525
29592
  if (fs.existsSync(srcPath)) {
29526
29593
  obsidianConfig.push({
29527
29594
  relativePath: `.obsidian/${file2}`,
@@ -29530,26 +29597,26 @@ function resolvePackageAssets(preset) {
29530
29597
  }
29531
29598
  }
29532
29599
  }
29533
- const commonTemplatesDir = path10.join(commonDir, "templates");
29600
+ const commonTemplatesDir = path11.join(commonDir, "templates");
29534
29601
  if (fs.existsSync(commonTemplatesDir)) {
29535
29602
  for (const file2 of fs.readdirSync(commonTemplatesDir)) {
29536
29603
  if (file2.endsWith(".md")) {
29537
29604
  templates.push({
29538
29605
  relativePath: `Knowledge/templates/${file2}`,
29539
- sourcePath: path10.join(commonTemplatesDir, file2)
29606
+ sourcePath: path11.join(commonTemplatesDir, file2)
29540
29607
  });
29541
29608
  }
29542
29609
  }
29543
29610
  }
29544
29611
  try {
29545
29612
  const { presetsDir } = loadPreset(preset);
29546
- const presetTemplatesDir = path10.join(presetsDir, preset, "templates");
29613
+ const presetTemplatesDir = path11.join(presetsDir, preset, "templates");
29547
29614
  if (fs.existsSync(presetTemplatesDir)) {
29548
29615
  for (const file2 of fs.readdirSync(presetTemplatesDir)) {
29549
29616
  if (file2.endsWith(".md")) {
29550
29617
  templates.push({
29551
29618
  relativePath: `Knowledge/templates/${file2}`,
29552
- sourcePath: path10.join(presetTemplatesDir, file2)
29619
+ sourcePath: path11.join(presetTemplatesDir, file2)
29553
29620
  });
29554
29621
  }
29555
29622
  }
@@ -29559,7 +29626,7 @@ function resolvePackageAssets(preset) {
29559
29626
  return { skills, commands, obsidianConfig, templates };
29560
29627
  }
29561
29628
  async function upgradeVault(vaultPath, options2) {
29562
- const { preset, dryRun = false, force = false } = options2 ?? {};
29629
+ const { preset, dryRun = false, force = false, skipGlobalSkillsSync = false } = options2 ?? {};
29563
29630
  const detectedPath = detectVaultContext(vaultPath);
29564
29631
  if (!detectedPath) {
29565
29632
  throw new Error(`No BYOAO vault detected at "${vaultPath}". Expected .obsidian/ and AGENTS.md.`);
@@ -29571,6 +29638,20 @@ async function upgradeVault(vaultPath, options2) {
29571
29638
  const pkgVersion = getPackageVersion();
29572
29639
  const fromVersion = manifest.version;
29573
29640
  if (fromVersion === pkgVersion && !force) {
29641
+ let globalOpenCodeSkillsEarly;
29642
+ let globalOpenCodeSkillsErrorEarly;
29643
+ if (!dryRun && !skipGlobalSkillsSync) {
29644
+ const globalSkillsRoot = path11.join(os4.homedir(), ".config", "opencode", "skills");
29645
+ if (await fs.pathExists(globalSkillsRoot)) {
29646
+ try {
29647
+ globalOpenCodeSkillsEarly = await copyBundledSkillsToOpenCodeSkillsDir(globalSkillsRoot, {
29648
+ includeObsidianSkills: true
29649
+ });
29650
+ } catch (err) {
29651
+ globalOpenCodeSkillsErrorEarly = err instanceof Error ? err.message : String(err);
29652
+ }
29653
+ }
29654
+ }
29574
29655
  return {
29575
29656
  fromVersion,
29576
29657
  toVersion: pkgVersion,
@@ -29578,11 +29659,13 @@ async function upgradeVault(vaultPath, options2) {
29578
29659
  updated: [],
29579
29660
  deprecated: [],
29580
29661
  errors: [],
29581
- dryRun
29662
+ dryRun,
29663
+ globalOpenCodeSkills: globalOpenCodeSkillsEarly,
29664
+ globalOpenCodeSkillsError: globalOpenCodeSkillsErrorEarly
29582
29665
  };
29583
29666
  }
29584
- const legacyAgentMd = path10.join(vaultPath, "AGENT.md");
29585
- const newAgentsMd = path10.join(vaultPath, "AGENTS.md");
29667
+ const legacyAgentMd = path11.join(vaultPath, "AGENT.md");
29668
+ const newAgentsMd = path11.join(vaultPath, "AGENTS.md");
29586
29669
  if (!dryRun && await fs.pathExists(legacyAgentMd) && !await fs.pathExists(newAgentsMd)) {
29587
29670
  await fs.rename(legacyAgentMd, newAgentsMd);
29588
29671
  }
@@ -29603,6 +29686,8 @@ async function upgradeVault(vaultPath, options2) {
29603
29686
  const updated = [];
29604
29687
  const deprecated = [];
29605
29688
  const errors = [];
29689
+ let globalOpenCodeSkills;
29690
+ let globalOpenCodeSkillsError;
29606
29691
  if (!dryRun) {
29607
29692
  const sourceMap = /* @__PURE__ */ new Map();
29608
29693
  for (const category of ["skills", "commands", "obsidianConfig", "templates"]) {
@@ -29615,8 +29700,8 @@ async function upgradeVault(vaultPath, options2) {
29615
29700
  if (item.action === "add" || item.action === "update") {
29616
29701
  const source = sourceMap.get(item.file);
29617
29702
  if (source) {
29618
- const dest = path10.join(vaultPath, item.file);
29619
- await fs.ensureDir(path10.dirname(dest));
29703
+ const dest = path11.join(vaultPath, item.file);
29704
+ await fs.ensureDir(path11.dirname(dest));
29620
29705
  await fs.copy(source, dest, { overwrite: true });
29621
29706
  if (item.action === "add") {
29622
29707
  added.push(item.file);
@@ -29636,6 +29721,18 @@ async function upgradeVault(vaultPath, options2) {
29636
29721
  }
29637
29722
  const installedFiles = await scanInstalledAssets(vaultPath);
29638
29723
  await writeManifest(vaultPath, effectivePreset, installedFiles);
29724
+ if (!skipGlobalSkillsSync && errors.length === 0) {
29725
+ const globalSkillsRoot = path11.join(os4.homedir(), ".config", "opencode", "skills");
29726
+ if (await fs.pathExists(globalSkillsRoot)) {
29727
+ try {
29728
+ globalOpenCodeSkills = await copyBundledSkillsToOpenCodeSkillsDir(globalSkillsRoot, {
29729
+ includeObsidianSkills: true
29730
+ });
29731
+ } catch (err) {
29732
+ globalOpenCodeSkillsError = err instanceof Error ? err.message : String(err);
29733
+ }
29734
+ }
29735
+ }
29639
29736
  }
29640
29737
  return {
29641
29738
  fromVersion,
@@ -29644,7 +29741,9 @@ async function upgradeVault(vaultPath, options2) {
29644
29741
  updated,
29645
29742
  deprecated,
29646
29743
  errors,
29647
- dryRun
29744
+ dryRun,
29745
+ globalOpenCodeSkills,
29746
+ globalOpenCodeSkillsError
29648
29747
  };
29649
29748
  }
29650
29749
 
@@ -29712,11 +29811,11 @@ var byoao_vault_upgrade = tool({
29712
29811
 
29713
29812
  // dist/tools/mcp-auth.js
29714
29813
  import { spawn, execSync as execSync3 } from "node:child_process";
29715
- import path11 from "node:path";
29716
- import os4 from "node:os";
29814
+ import path12 from "node:path";
29815
+ import os5 from "node:os";
29717
29816
  function findOpencodeBinary() {
29718
29817
  const candidates = [
29719
- path11.join(os4.homedir(), ".opencode/bin/opencode"),
29818
+ path12.join(os5.homedir(), ".opencode/bin/opencode"),
29720
29819
  "/usr/local/bin/opencode"
29721
29820
  ];
29722
29821
  for (const p of candidates) {
@@ -29820,7 +29919,7 @@ The user may need to:
29820
29919
  });
29821
29920
 
29822
29921
  // dist/hooks/system-transform.js
29823
- import path12 from "node:path";
29922
+ import path13 from "node:path";
29824
29923
 
29825
29924
  // dist/lib/logger.js
29826
29925
  import { join } from "node:path";
@@ -29900,7 +29999,7 @@ async function log(level, source, message, options2) {
29900
29999
 
29901
30000
  // dist/hooks/system-transform.js
29902
30001
  function readVaultMarkdown(vaultPath, fileName) {
29903
- const full = path12.join(vaultPath, fileName);
30002
+ const full = path13.join(vaultPath, fileName);
29904
30003
  if (!fs.existsSync(full))
29905
30004
  return null;
29906
30005
  try {