@jayjiang/byoao 2.0.7 → 2.0.9

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 (62) hide show
  1. package/dist/__tests__/plugin-config.test.js +11 -0
  2. package/dist/__tests__/plugin-config.test.js.map +1 -1
  3. package/dist/assets/obsidian-skills/obsidian-cli.md +7 -0
  4. package/dist/assets/presets/common/AGENTS.md.hbs +5 -5
  5. package/dist/assets/presets/common/INDEX.base.example +136 -0
  6. package/dist/assets/presets/common/Start Here.md.hbs +1 -1
  7. package/dist/assets/presets/pm-tpm/preset.json +1 -0
  8. package/dist/assets/skills/ask/SKILL.md +47 -10
  9. package/dist/assets/skills/connect/SKILL.md +1 -1
  10. package/dist/assets/skills/cook/SKILL.md +2 -2
  11. package/dist/assets/skills/diagnose/SKILL.md +1 -1
  12. package/dist/assets/skills/ideas/SKILL.md +2 -2
  13. package/dist/assets/skills/trace/SKILL.md +1 -1
  14. package/dist/assets/skills/wiki/SKILL.md +50 -57
  15. package/dist/cli/cli-program.js +52 -15
  16. package/dist/cli/cli-program.js.map +1 -1
  17. package/dist/e2e/cli-init.e2e.test.js +92 -0
  18. package/dist/e2e/cli-init.e2e.test.js.map +1 -0
  19. package/dist/hooks/idle-suggestions.js +1 -1
  20. package/dist/hooks/idle-suggestions.js.map +1 -1
  21. package/dist/index.js +213 -171
  22. package/dist/plugin-config.js +4 -0
  23. package/dist/plugin-config.js.map +1 -1
  24. package/dist/tools/init-vault.js +1 -1
  25. package/dist/tools/init-vault.js.map +1 -1
  26. package/dist/vault/__tests__/create.test.js +4 -1
  27. package/dist/vault/__tests__/create.test.js.map +1 -1
  28. package/dist/vault/__tests__/doctor.test.js +8 -0
  29. package/dist/vault/__tests__/doctor.test.js.map +1 -1
  30. package/dist/vault/__tests__/index-base-example.test.js +31 -0
  31. package/dist/vault/__tests__/index-base-example.test.js.map +1 -0
  32. package/dist/vault/__tests__/mcp.test.js +1 -0
  33. package/dist/vault/__tests__/mcp.test.js.map +1 -1
  34. package/dist/vault/__tests__/obsidian-plugins.test.js +1 -0
  35. package/dist/vault/__tests__/obsidian-plugins.test.js.map +1 -1
  36. package/dist/vault/__tests__/preset-init-filter.test.js +18 -0
  37. package/dist/vault/__tests__/preset-init-filter.test.js.map +1 -0
  38. package/dist/vault/create.js +4 -0
  39. package/dist/vault/create.js.map +1 -1
  40. package/dist/vault/doctor.js +11 -0
  41. package/dist/vault/doctor.js.map +1 -1
  42. package/dist/vault/index-base-example.js +19 -0
  43. package/dist/vault/index-base-example.js.map +1 -0
  44. package/dist/vault/manifest.js +1 -1
  45. package/dist/vault/preset.js +18 -2
  46. package/dist/vault/preset.js.map +1 -1
  47. package/dist/vault/self-update.js +1 -1
  48. package/dist/vault/upgrade.js +3 -0
  49. package/dist/vault/upgrade.js.map +1 -1
  50. package/package.json +1 -1
  51. package/src/assets/obsidian-skills/obsidian-cli.md +7 -0
  52. package/src/assets/presets/common/AGENTS.md.hbs +5 -5
  53. package/src/assets/presets/common/INDEX.base.example +136 -0
  54. package/src/assets/presets/common/Start Here.md.hbs +1 -1
  55. package/src/assets/presets/pm-tpm/preset.json +1 -0
  56. package/src/skills/ask/SKILL.md +47 -10
  57. package/src/skills/connect/SKILL.md +1 -1
  58. package/src/skills/cook/SKILL.md +2 -2
  59. package/src/skills/diagnose/SKILL.md +1 -1
  60. package/src/skills/ideas/SKILL.md +2 -2
  61. package/src/skills/trace/SKILL.md +1 -1
  62. package/src/skills/wiki/SKILL.md +50 -57
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(path14) {
4686
- return /^\.|this\b/.test(path14.original);
4685
+ scopedId: function scopedId(path15) {
4686
+ return /^\.|this\b/.test(path15.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(path14) {
4691
- return path14.parts.length === 1 && !AST.helpers.scopedId(path14) && !path14.depth;
4690
+ simpleId: function simpleId(path15) {
4691
+ return path15.parts.length === 1 && !AST.helpers.scopedId(path15) && !path15.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(path14, params, hash2, open, strip, locInfo) {
5761
+ function prepareMustache(path15, 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: path14,
5766
+ path: path15,
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), path14 = decorator.path;
6036
+ var params = this.setupFullMustacheParams(decorator, program, void 0), path15 = decorator.path;
6037
6037
  this.useDecorators = true;
6038
- this.opcode("registerDecorator", params.length, path14.original);
6038
+ this.opcode("registerDecorator", params.length, path15.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 path14 = sexpr.path, name = path14.parts[0], isBlock = program != null || inverse != null;
6103
- this.opcode("getContext", path14.depth);
6102
+ var path15 = sexpr.path, name = path15.parts[0], isBlock = program != null || inverse != null;
6103
+ this.opcode("getContext", path15.depth);
6104
6104
  this.opcode("pushProgram", program);
6105
6105
  this.opcode("pushProgram", inverse);
6106
- path14.strict = true;
6107
- this.accept(path14);
6106
+ path15.strict = true;
6107
+ this.accept(path15);
6108
6108
  this.opcode("invokeAmbiguous", name, isBlock);
6109
6109
  },
6110
6110
  simpleSexpr: function simpleSexpr(sexpr) {
6111
- var path14 = sexpr.path;
6112
- path14.strict = true;
6113
- this.accept(path14);
6111
+ var path15 = sexpr.path;
6112
+ path15.strict = true;
6113
+ this.accept(path15);
6114
6114
  this.opcode("resolvePossibleLambda");
6115
6115
  },
6116
6116
  helperSexpr: function helperSexpr(sexpr, program, inverse) {
6117
- var params = this.setupFullMustacheParams(sexpr, program, inverse), path14 = sexpr.path, name = path14.parts[0];
6117
+ var params = this.setupFullMustacheParams(sexpr, program, inverse), path15 = sexpr.path, name = path15.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
- path14.strict = true;
6124
- path14.falsy = true;
6125
- this.accept(path14);
6126
- this.opcode("invokeHelper", params.length, path14.original, _ast2["default"].helpers.simpleId(path14));
6123
+ path15.strict = true;
6124
+ path15.falsy = true;
6125
+ this.accept(path15);
6126
+ this.opcode("invokeHelper", params.length, path15.original, _ast2["default"].helpers.simpleId(path15));
6127
6127
  }
6128
6128
  },
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);
6129
+ PathExpression: function PathExpression(path15) {
6130
+ this.addDepth(path15.depth);
6131
+ this.opcode("getContext", path15.depth);
6132
+ var name = path15.parts[0], scoped = _ast2["default"].helpers.scopedId(path15), blockParamId = !path15.depth && !scoped && this.blockParamIndex(name);
6133
6133
  if (blockParamId) {
6134
- this.opcode("lookupBlockParam", blockParamId, path14.parts);
6134
+ this.opcode("lookupBlockParam", blockParamId, path15.parts);
6135
6135
  } else if (!name) {
6136
6136
  this.opcode("pushContext");
6137
- } else if (path14.data) {
6137
+ } else if (path15.data) {
6138
6138
  this.options.data = true;
6139
- this.opcode("lookupData", path14.depth, path14.parts, path14.strict);
6139
+ this.opcode("lookupData", path15.depth, path15.parts, path15.strict);
6140
6140
  } else {
6141
- this.opcode("lookupOnContext", path14.parts, path14.falsy, path14.strict, scoped);
6141
+ this.opcode("lookupOnContext", path15.parts, path15.falsy, path15.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 path14 = aPath;
6491
+ var path15 = aPath;
6492
6492
  var url2 = urlParse(aPath);
6493
6493
  if (url2) {
6494
6494
  if (!url2.path) {
6495
6495
  return aPath;
6496
6496
  }
6497
- path14 = url2.path;
6497
+ path15 = url2.path;
6498
6498
  }
6499
- var isAbsolute = exports2.isAbsolute(path14);
6500
- var parts = path14.split(/\/+/);
6499
+ var isAbsolute = exports2.isAbsolute(path15);
6500
+ var parts = path15.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
- path14 = parts.join("/");
6518
- if (path14 === "") {
6519
- path14 = isAbsolute ? "/" : ".";
6517
+ path15 = parts.join("/");
6518
+ if (path15 === "") {
6519
+ path15 = isAbsolute ? "/" : ".";
6520
6520
  }
6521
6521
  if (url2) {
6522
- url2.path = path14;
6522
+ url2.path = path15;
6523
6523
  return urlGenerate(url2);
6524
6524
  }
6525
- return path14;
6525
+ return path15;
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 path14 = id.parts.join("/");
9307
- return (id.data ? "@" : "") + "PATH:" + path14;
9306
+ var path15 = id.parts.join("/");
9307
+ return (id.data ? "@" : "") + "PATH:" + path15;
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, path14) {
12019
- if (!path14)
12018
+ function getElementAtPath(obj, path15) {
12019
+ if (!path15)
12020
12020
  return obj;
12021
- return path14.reduce((acc, key) => acc?.[key], obj);
12021
+ return path15.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(path14, issues) {
12382
+ function prefixIssues(path15, issues) {
12383
12383
  return issues.map((iss) => {
12384
12384
  var _a;
12385
12385
  (_a = iss).path ?? (_a.path = []);
12386
- iss.path.unshift(path14);
12386
+ iss.path.unshift(path15);
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, path14 = []) => {
12554
+ const processError = (error46, path15 = []) => {
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 = [...path14, ...issue2.path];
12564
+ const fullpath = [...path15, ...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 path14 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
12597
- for (const seg of path14) {
12596
+ const path15 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
12597
+ for (const seg of path15) {
12598
12598
  if (typeof seg === "number")
12599
12599
  segs.push(`[${seg}]`);
12600
12600
  else if (typeof seg === "symbol")
@@ -23779,7 +23779,7 @@ var matter = import_gray_matter.default;
23779
23779
  var Handlebars = import_handlebars.default;
23780
23780
 
23781
23781
  // dist/vault/create.js
23782
- import path6 from "node:path";
23782
+ import path7 from "node:path";
23783
23783
 
23784
23784
  // dist/vault/template.js
23785
23785
  var templateCache = /* @__PURE__ */ new Map();
@@ -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: path14, errorMaps, issueData } = params;
24277
- const fullPath = [...path14, ...issueData.path || []];
24276
+ const { data, path: path15, errorMaps, issueData } = params;
24277
+ const fullPath = [...path15, ...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, path14, key) {
24393
+ constructor(parent, value, path15, key) {
24394
24394
  this._cachedPath = [];
24395
24395
  this.parent = parent;
24396
24396
  this.data = value;
24397
- this._path = path14;
24397
+ this._path = path15;
24398
24398
  this._key = key;
24399
24399
  }
24400
24400
  get path() {
@@ -27861,10 +27861,13 @@ var VaultConfigSchema = external_exports2.object({
27861
27861
  var VaultStatusSchema = external_exports2.object({
27862
27862
  vaultPath: external_exports2.string()
27863
27863
  });
27864
+ var InitOfferWhenSchema = external_exports2.enum(["always", "work", "personal"]);
27864
27865
  var PresetConfigSchema = external_exports2.object({
27865
27866
  name: external_exports2.string().min(1),
27866
27867
  displayName: external_exports2.string().min(1),
27867
27868
  description: external_exports2.string(),
27869
+ /** `always`: both Personal and Work paths; `work` / `personal`: only that init branch */
27870
+ initOfferWhen: InitOfferWhenSchema.default("always"),
27868
27871
  directories: external_exports2.array(external_exports2.string()).default([]),
27869
27872
  agentDescription: external_exports2.string(),
27870
27873
  frontmatterExtras: external_exports2.record(external_exports2.string(), external_exports2.array(external_exports2.string())).default({}),
@@ -27906,7 +27909,7 @@ function getPresetsDir() {
27906
27909
  ${srcPresets}
27907
27910
  ${devPresets}`);
27908
27911
  }
27909
- function listPresets() {
27912
+ function readAllPresetEntries() {
27910
27913
  const presetsDir = getPresetsDir();
27911
27914
  const entries = fs.readdirSync(presetsDir, { withFileTypes: true });
27912
27915
  const presets = [];
@@ -27921,11 +27924,19 @@ function listPresets() {
27921
27924
  presets.push({
27922
27925
  name: parsed.name,
27923
27926
  displayName: parsed.displayName,
27924
- description: parsed.description
27927
+ description: parsed.description,
27928
+ initOfferWhen: parsed.initOfferWhen
27925
27929
  });
27926
27930
  }
27927
27931
  return presets;
27928
27932
  }
27933
+ function listPresets() {
27934
+ return readAllPresetEntries().map(({ name, displayName, description }) => ({
27935
+ name,
27936
+ displayName,
27937
+ description
27938
+ }));
27939
+ }
27929
27940
  function loadPreset(name) {
27930
27941
  const presetsDir = getPresetsDir();
27931
27942
  const presetDir = path.join(presetsDir, name);
@@ -28262,7 +28273,7 @@ async function configureProvider(provider, gcpProjectId) {
28262
28273
 
28263
28274
  // dist/vault/manifest.js
28264
28275
  import path4 from "node:path";
28265
- var PKG_VERSION = "2.0.7";
28276
+ var PKG_VERSION = "2.0.9";
28266
28277
  var InfrastructureSchema = external_exports2.object({
28267
28278
  skills: external_exports2.array(external_exports2.string()).default([]),
28268
28279
  commands: external_exports2.array(external_exports2.string()).default([]),
@@ -28358,6 +28369,21 @@ function detectInitMode(targetPath) {
28358
28369
  return "fresh";
28359
28370
  }
28360
28371
 
28372
+ // dist/vault/index-base-example.js
28373
+ import path6 from "node:path";
28374
+ async function copyIndexBaseExampleIfMissing(vaultPath, commonDir) {
28375
+ const dest = path6.join(vaultPath, "INDEX.base");
28376
+ if (await fs.pathExists(dest)) {
28377
+ return false;
28378
+ }
28379
+ const src = path6.join(commonDir, "INDEX.base.example");
28380
+ if (!await fs.pathExists(src)) {
28381
+ return false;
28382
+ }
28383
+ await fs.copy(src, dest);
28384
+ return true;
28385
+ }
28386
+
28361
28387
  // dist/vault/create.js
28362
28388
  function countWikilinks(content) {
28363
28389
  const stripped = content.replace(/```[\s\S]*?```/g, "").replace(/`[^`]+`/g, "");
@@ -28387,10 +28413,10 @@ var MCP_DISPLAY_NAMES = {
28387
28413
  };
28388
28414
  async function createMinimalCore(ctx) {
28389
28415
  if (!ctx.preserveObsidian) {
28390
- await fs.ensureDir(path6.join(ctx.vaultPath, ".obsidian"));
28391
- const obsidianSrc = path6.join(ctx.commonDir, "obsidian");
28416
+ await fs.ensureDir(path7.join(ctx.vaultPath, ".obsidian"));
28417
+ const obsidianSrc = path7.join(ctx.commonDir, "obsidian");
28392
28418
  if (await fs.pathExists(obsidianSrc)) {
28393
- await fs.copy(obsidianSrc, path6.join(ctx.vaultPath, ".obsidian"), { overwrite: false });
28419
+ await fs.copy(obsidianSrc, path7.join(ctx.vaultPath, ".obsidian"), { overwrite: false });
28394
28420
  const obsidianFiles = await fs.readdir(obsidianSrc);
28395
28421
  ctx.filesCreated += obsidianFiles.length;
28396
28422
  for (const f of obsidianFiles) {
@@ -28398,13 +28424,13 @@ async function createMinimalCore(ctx) {
28398
28424
  }
28399
28425
  }
28400
28426
  }
28401
- const startHereTemplate = await fs.readFile(path6.join(ctx.commonDir, "Start Here.md.hbs"), "utf-8");
28427
+ const startHereTemplate = await fs.readFile(path7.join(ctx.commonDir, "Start Here.md.hbs"), "utf-8");
28402
28428
  const startHereContent = renderTemplate(startHereTemplate, {
28403
28429
  KB_NAME: ctx.kbName,
28404
28430
  HAS_MCP_SERVICES: ctx.mcpServices.length > 0,
28405
28431
  MCP_SERVICES: ctx.mcpServices
28406
28432
  });
28407
- const startHerePath = path6.join(ctx.vaultPath, "Start Here.md");
28433
+ const startHerePath = path7.join(ctx.vaultPath, "Start Here.md");
28408
28434
  if (!await fs.pathExists(startHerePath)) {
28409
28435
  await fs.writeFile(startHerePath, startHereContent);
28410
28436
  ctx.filesCreated++;
@@ -28413,21 +28439,21 @@ async function createMinimalCore(ctx) {
28413
28439
  async function createLlmWikiCore(ctx, wikiDomain = "") {
28414
28440
  const agentDirs = ["entities", "concepts", "comparisons", "queries"];
28415
28441
  for (const dir of agentDirs) {
28416
- const dirPath = path6.join(ctx.vaultPath, dir);
28442
+ const dirPath = path7.join(ctx.vaultPath, dir);
28417
28443
  if (!await fs.pathExists(dirPath)) {
28418
28444
  await fs.ensureDir(dirPath);
28419
28445
  ctx.filesCreated++;
28420
28446
  ctx.directories.push(dir);
28421
28447
  }
28422
28448
  }
28423
- const schemaTemplatePath = path6.join(ctx.commonDir, "SCHEMA.md.hbs");
28449
+ const schemaTemplatePath = path7.join(ctx.commonDir, "SCHEMA.md.hbs");
28424
28450
  if (await fs.pathExists(schemaTemplatePath)) {
28425
28451
  const schemaTemplate = await fs.readFile(schemaTemplatePath, "utf-8");
28426
28452
  const schemaContent = renderTemplate(schemaTemplate, {
28427
28453
  KB_NAME: ctx.kbName,
28428
28454
  WIKI_DOMAIN: wikiDomain || ""
28429
28455
  });
28430
- const schemaPath = path6.join(ctx.vaultPath, "SCHEMA.md");
28456
+ const schemaPath = path7.join(ctx.vaultPath, "SCHEMA.md");
28431
28457
  if (!await fs.pathExists(schemaPath)) {
28432
28458
  await fs.writeFile(schemaPath, schemaContent);
28433
28459
  ctx.filesCreated++;
@@ -28438,16 +28464,19 @@ async function createLlmWikiCore(ctx, wikiDomain = "") {
28438
28464
  Entries are appended here during /cook operations.
28439
28465
 
28440
28466
  `;
28441
- const logPath = path6.join(ctx.vaultPath, "log.md");
28467
+ const logPath = path7.join(ctx.vaultPath, "log.md");
28442
28468
  if (!await fs.pathExists(logPath)) {
28443
28469
  await fs.writeFile(logPath, logContent);
28444
28470
  ctx.filesCreated++;
28445
28471
  }
28472
+ if (await copyIndexBaseExampleIfMissing(ctx.vaultPath, ctx.commonDir)) {
28473
+ ctx.filesCreated++;
28474
+ }
28446
28475
  }
28447
28476
  async function createAgentsMd(ctx, ownerName, presetConfig, presetDir) {
28448
- const agentsTemplate = await fs.readFile(path6.join(ctx.commonDir, "AGENTS.md.hbs"), "utf-8");
28477
+ const agentsTemplate = await fs.readFile(path7.join(ctx.commonDir, "AGENTS.md.hbs"), "utf-8");
28449
28478
  let roleSection = "";
28450
- const agentSectionPath = path6.join(presetDir, "agent-section.hbs");
28479
+ const agentSectionPath = path7.join(presetDir, "agent-section.hbs");
28451
28480
  if (await fs.pathExists(agentSectionPath)) {
28452
28481
  const agentSectionTemplate = await fs.readFile(agentSectionPath, "utf-8");
28453
28482
  roleSection = renderTemplate(agentSectionTemplate, {
@@ -28462,7 +28491,7 @@ async function createAgentsMd(ctx, ownerName, presetConfig, presetDir) {
28462
28491
  OWNER_NAME: ownerName,
28463
28492
  ROLE_SECTION: roleSection
28464
28493
  });
28465
- const agentsMdPath = path6.join(ctx.vaultPath, "AGENTS.md");
28494
+ const agentsMdPath = path7.join(ctx.vaultPath, "AGENTS.md");
28466
28495
  if (!await fs.pathExists(agentsMdPath)) {
28467
28496
  await fs.writeFile(agentsMdPath, agentsContent);
28468
28497
  ctx.filesCreated++;
@@ -28470,17 +28499,17 @@ async function createAgentsMd(ctx, ownerName, presetConfig, presetDir) {
28470
28499
  }
28471
28500
  async function applyPresetOverlay(ctx, presetConfig, presetDir) {
28472
28501
  for (const dir of presetConfig.directories) {
28473
- await fs.ensureDir(path6.join(ctx.vaultPath, dir));
28502
+ await fs.ensureDir(path7.join(ctx.vaultPath, dir));
28474
28503
  }
28475
28504
  ctx.directories.push(...presetConfig.directories);
28476
28505
  const allTemplateNames = [];
28477
- const presetTemplatesDir = path6.join(presetDir, "templates");
28506
+ const presetTemplatesDir = path7.join(presetDir, "templates");
28478
28507
  if (await fs.pathExists(presetTemplatesDir)) {
28479
- const templateDest = path6.join(ctx.vaultPath, "templates");
28508
+ const templateDest = path7.join(ctx.vaultPath, "templates");
28480
28509
  await fs.ensureDir(templateDest);
28481
28510
  const files = await fs.readdir(presetTemplatesDir);
28482
28511
  for (const file2 of files) {
28483
- await fs.copy(path6.join(presetTemplatesDir, file2), path6.join(templateDest, file2), { overwrite: false });
28512
+ await fs.copy(path7.join(presetTemplatesDir, file2), path7.join(templateDest, file2), { overwrite: false });
28484
28513
  allTemplateNames.push(file2.replace(/\.md$/, ""));
28485
28514
  ctx.filesCreated++;
28486
28515
  ctx.installedFiles.templates.push(`templates/${file2}`);
@@ -28492,7 +28521,7 @@ async function createVault(config2) {
28492
28521
  const { kbName, vaultPath, preset } = config2;
28493
28522
  const presetName = preset ?? "minimal";
28494
28523
  const { config: presetConfig, presetsDir } = loadPreset(presetName);
28495
- const presetDir = path6.join(presetsDir, presetName);
28524
+ const presetDir = path7.join(presetsDir, presetName);
28496
28525
  const initMode = detectInitMode(vaultPath);
28497
28526
  const preserveObsidian = initMode === "obsidian-vault";
28498
28527
  const ctx = makeContext(vaultPath, kbName, preserveObsidian);
@@ -28527,7 +28556,7 @@ async function createVault(config2) {
28527
28556
  for (const entry of entries) {
28528
28557
  const entryStr = String(entry);
28529
28558
  if (entryStr.endsWith(".md") && !entryStr.startsWith(".obsidian")) {
28530
- const content = await fs.readFile(path6.join(ctx.vaultPath, entryStr), "utf-8");
28559
+ const content = await fs.readFile(path7.join(ctx.vaultPath, entryStr), "utf-8");
28531
28560
  wikilinksCreated += countWikilinks(content);
28532
28561
  }
28533
28562
  }
@@ -28543,7 +28572,7 @@ async function createVault(config2) {
28543
28572
  };
28544
28573
  }
28545
28574
  async function configureOpenCodeProject(vaultPath, installedFiles) {
28546
- const configPath = path6.join(vaultPath, ".opencode.json");
28575
+ const configPath = path7.join(vaultPath, ".opencode.json");
28547
28576
  let config2 = {};
28548
28577
  if (await fs.pathExists(configPath)) {
28549
28578
  try {
@@ -28558,31 +28587,31 @@ async function configureOpenCodeProject(vaultPath, installedFiles) {
28558
28587
  }
28559
28588
  await fs.writeJson(configPath, config2, { spaces: 2 });
28560
28589
  const assetsDir = resolveAssetsDir();
28561
- const obsidianSkillsSrc = path6.join(assetsDir, "obsidian-skills");
28562
- const skillsDest = path6.join(vaultPath, ".opencode", "skills");
28590
+ const obsidianSkillsSrc = path7.join(assetsDir, "obsidian-skills");
28591
+ const skillsDest = path7.join(vaultPath, ".opencode", "skills");
28563
28592
  if (await fs.pathExists(obsidianSkillsSrc)) {
28564
28593
  await fs.ensureDir(skillsDest);
28565
28594
  const files = await fs.readdir(obsidianSkillsSrc);
28566
28595
  for (const file2 of files) {
28567
28596
  if (file2.endsWith(".md")) {
28568
28597
  const skillName = file2.replace(/\.md$/, "");
28569
- const destDir = path6.join(skillsDest, skillName);
28598
+ const destDir = path7.join(skillsDest, skillName);
28570
28599
  await fs.ensureDir(destDir);
28571
- await fs.copy(path6.join(obsidianSkillsSrc, file2), path6.join(destDir, "SKILL.md"), { overwrite: true });
28600
+ await fs.copy(path7.join(obsidianSkillsSrc, file2), path7.join(destDir, "SKILL.md"), { overwrite: true });
28572
28601
  installedFiles.skills.push(`.opencode/skills/${skillName}/SKILL.md`);
28573
28602
  }
28574
28603
  }
28575
28604
  }
28576
- const byoaoSkillsSrc = path6.join(assetsDir, "skills");
28605
+ const byoaoSkillsSrc = path7.join(assetsDir, "skills");
28577
28606
  if (await fs.pathExists(byoaoSkillsSrc)) {
28578
28607
  const entries = await fs.readdir(byoaoSkillsSrc, { withFileTypes: true });
28579
28608
  for (const entry of entries) {
28580
28609
  if (entry.isDirectory()) {
28581
- const srcSkill = path6.join(byoaoSkillsSrc, entry.name, "SKILL.md");
28610
+ const srcSkill = path7.join(byoaoSkillsSrc, entry.name, "SKILL.md");
28582
28611
  if (await fs.pathExists(srcSkill)) {
28583
- const destDir = path6.join(skillsDest, entry.name);
28612
+ const destDir = path7.join(skillsDest, entry.name);
28584
28613
  await fs.ensureDir(destDir);
28585
- await fs.copy(srcSkill, path6.join(destDir, "SKILL.md"), { overwrite: true });
28614
+ await fs.copy(srcSkill, path7.join(destDir, "SKILL.md"), { overwrite: true });
28586
28615
  installedFiles.skills.push(`.opencode/skills/${entry.name}/SKILL.md`);
28587
28616
  }
28588
28617
  }
@@ -28590,9 +28619,9 @@ async function configureOpenCodeProject(vaultPath, installedFiles) {
28590
28619
  }
28591
28620
  }
28592
28621
  function resolveAssetsDir() {
28593
- const distAssets = path6.resolve(import.meta.dirname, "assets");
28594
- const srcAssets = path6.resolve(import.meta.dirname, "..", "assets");
28595
- const devAssets = path6.resolve(import.meta.dirname, "..", "..", "src", "assets");
28622
+ const distAssets = path7.resolve(import.meta.dirname, "assets");
28623
+ const srcAssets = path7.resolve(import.meta.dirname, "..", "assets");
28624
+ const devAssets = path7.resolve(import.meta.dirname, "..", "..", "src", "assets");
28596
28625
  if (fs.existsSync(distAssets))
28597
28626
  return distAssets;
28598
28627
  if (fs.existsSync(srcAssets))
@@ -28716,10 +28745,10 @@ function formatObsidianStatus(status) {
28716
28745
  }
28717
28746
 
28718
28747
  // dist/tools/init-vault.js
28719
- import path7 from "node:path";
28748
+ import path8 from "node:path";
28720
28749
  import os3 from "node:os";
28721
28750
  var byoao_init_vault = tool({
28722
- description: "Create an LLM Wiki knowledge base in Obsidian. Sets up agent directories (entities/, concepts/, comparisons/, queries/), SCHEMA.md, log.md, and AI routing (AGENTS.md). Your existing notes become raw material for /cook.",
28751
+ description: "Create an LLM Wiki knowledge base in Obsidian. Sets up agent directories (entities/, concepts/, comparisons/, queries/), SCHEMA.md, log.md, INDEX.base (from INDEX.base.example when missing), and AI routing (AGENTS.md). Your existing notes become raw material for /cook.",
28723
28752
  args: {
28724
28753
  kbName: tool.schema.string().describe(`Knowledge base name (e.g. "Jay's KB")`),
28725
28754
  ownerName: tool.schema.string().optional().describe("Owner's name"),
@@ -28734,7 +28763,7 @@ var byoao_init_vault = tool({
28734
28763
 
28735
28764
  Please install Obsidian first, then try again.`;
28736
28765
  }
28737
- const resolvedPath = args.vaultPath || path7.join(os3.homedir(), "Documents", args.kbName);
28766
+ const resolvedPath = args.vaultPath || path8.join(os3.homedir(), "Documents", args.kbName);
28738
28767
  const config2 = VaultConfigSchema.parse({
28739
28768
  kbName: args.kbName,
28740
28769
  ownerName: args.ownerName || "",
@@ -28851,7 +28880,7 @@ Open in Obsidian: "Open folder as vault" \u2192 select "${result.vaultPath}"`;
28851
28880
  });
28852
28881
 
28853
28882
  // dist/vault/status.js
28854
- import path8 from "node:path";
28883
+ import path9 from "node:path";
28855
28884
  async function getAllMarkdownFiles(dirPath) {
28856
28885
  const results = [];
28857
28886
  async function walk(dir) {
@@ -28859,7 +28888,7 @@ async function getAllMarkdownFiles(dirPath) {
28859
28888
  return;
28860
28889
  const entries = await fs.readdir(dir, { withFileTypes: true });
28861
28890
  for (const entry of entries) {
28862
- const fullPath = path8.join(dir, entry.name);
28891
+ const fullPath = path9.join(dir, entry.name);
28863
28892
  if (entry.isDirectory()) {
28864
28893
  if (!entry.name.startsWith(".")) {
28865
28894
  await walk(fullPath);
@@ -28898,7 +28927,7 @@ async function getVaultStatus(vaultPath) {
28898
28927
  };
28899
28928
  }
28900
28929
  const allFiles = await getAllMarkdownFiles(vaultPath);
28901
- const noteNames = new Set(allFiles.map((f) => path8.basename(f, ".md")));
28930
+ const noteNames = new Set(allFiles.map((f) => path9.basename(f, ".md")));
28902
28931
  let wikilinkCount = 0;
28903
28932
  const brokenLinksSet = /* @__PURE__ */ new Set();
28904
28933
  for (const file2 of allFiles) {
@@ -28923,7 +28952,7 @@ async function getVaultStatus(vaultPath) {
28923
28952
  "Daily"
28924
28953
  ];
28925
28954
  for (const dir of topDirs) {
28926
- const dirPath = path8.join(vaultPath, dir);
28955
+ const dirPath = path9.join(vaultPath, dir);
28927
28956
  if (await fs.pathExists(dirPath)) {
28928
28957
  const files = await getAllMarkdownFiles(dirPath);
28929
28958
  directories[dir] = files.length;
@@ -28937,7 +28966,7 @@ async function getVaultStatus(vaultPath) {
28937
28966
  queries: 0
28938
28967
  };
28939
28968
  for (const name of agentDirNames) {
28940
- const dirPath = path8.join(vaultPath, name);
28969
+ const dirPath = path9.join(vaultPath, name);
28941
28970
  const mdFiles = await getAllMarkdownFiles(dirPath);
28942
28971
  agentPages[name] = mdFiles.length;
28943
28972
  }
@@ -28948,12 +28977,12 @@ async function getVaultStatus(vaultPath) {
28948
28977
  wikilinkCount,
28949
28978
  brokenLinks: Array.from(brokenLinksSet),
28950
28979
  directories,
28951
- hasObsidianConfig: await fs.pathExists(path8.join(vaultPath, ".obsidian")),
28952
- hasAgentMd: await fs.pathExists(path8.join(vaultPath, "AGENTS.md")) || await fs.pathExists(path8.join(vaultPath, "AGENT.md")),
28980
+ hasObsidianConfig: await fs.pathExists(path9.join(vaultPath, ".obsidian")),
28981
+ hasAgentMd: await fs.pathExists(path9.join(vaultPath, "AGENTS.md")) || await fs.pathExists(path9.join(vaultPath, "AGENT.md")),
28953
28982
  agentPages,
28954
- hasSchema: await fs.pathExists(path8.join(vaultPath, "SCHEMA.md")),
28955
- hasLog: await fs.pathExists(path8.join(vaultPath, "log.md")),
28956
- hasIndexBase: await fs.pathExists(path8.join(vaultPath, "INDEX.base"))
28983
+ hasSchema: await fs.pathExists(path9.join(vaultPath, "SCHEMA.md")),
28984
+ hasLog: await fs.pathExists(path9.join(vaultPath, "log.md")),
28985
+ hasIndexBase: await fs.pathExists(path9.join(vaultPath, "INDEX.base"))
28957
28986
  };
28958
28987
  }
28959
28988
  function formatVaultStatus(status) {
@@ -29009,18 +29038,18 @@ var byoao_vault_status = tool({
29009
29038
  });
29010
29039
 
29011
29040
  // dist/vault/doctor.js
29012
- import path9 from "node:path";
29041
+ import path10 from "node:path";
29013
29042
  import { stat } from "node:fs/promises";
29014
29043
  var LLM_WIKI_V2_AGENT_DIRS = ["entities", "concepts", "comparisons", "queries"];
29015
29044
  function isAgentWikiPage(relativePath) {
29016
- const top = relativePath.split(path9.sep)[0];
29045
+ const top = relativePath.split(path10.sep)[0];
29017
29046
  return LLM_WIKI_V2_AGENT_DIRS.includes(top);
29018
29047
  }
29019
29048
  async function collectMarkdownFiles(dir) {
29020
29049
  const results = [];
29021
29050
  const entries = await fs.readdir(dir, { withFileTypes: true });
29022
29051
  for (const entry of entries) {
29023
- const fullPath = path9.join(dir, entry.name);
29052
+ const fullPath = path10.join(dir, entry.name);
29024
29053
  if (entry.isDirectory()) {
29025
29054
  if (entry.name === ".obsidian" || entry.name === ".git")
29026
29055
  continue;
@@ -29040,11 +29069,22 @@ function extractWikilinks2(content) {
29040
29069
  }
29041
29070
  async function getVaultDiagnosis(vaultPath) {
29042
29071
  const issues = [];
29072
+ const knowledgeDir = path10.join(vaultPath, "Knowledge");
29073
+ if (await fs.pathExists(knowledgeDir)) {
29074
+ const mdUnderKnowledge = await collectMarkdownFiles(knowledgeDir);
29075
+ if (mdUnderKnowledge.length === 0) {
29076
+ issues.push({
29077
+ severity: "info",
29078
+ category: "orphan",
29079
+ message: "Folder `Knowledge/` exists but contains no markdown files. BYOAO v2 does not use this path (v1 legacy). You can remove the folder if you do not need it."
29080
+ });
29081
+ }
29082
+ }
29043
29083
  const allFiles = await collectMarkdownFiles(vaultPath);
29044
- const noteNames = new Set(allFiles.map((f) => path9.basename(f, ".md")));
29084
+ const noteNames = new Set(allFiles.map((f) => path10.basename(f, ".md")));
29045
29085
  let healthyNotes = 0;
29046
29086
  for (const filePath of allFiles) {
29047
- const relativePath = path9.relative(vaultPath, filePath);
29087
+ const relativePath = path10.relative(vaultPath, filePath);
29048
29088
  if (relativePath.startsWith("Knowledge/templates/"))
29049
29089
  continue;
29050
29090
  const content = await fs.readFile(filePath, "utf-8");
@@ -29093,11 +29133,11 @@ async function getVaultDiagnosis(vaultPath) {
29093
29133
  healthyNotes++;
29094
29134
  }
29095
29135
  let agentContent = null;
29096
- let agentResolvedPath = path9.join(vaultPath, "AGENTS.md");
29136
+ let agentResolvedPath = path10.join(vaultPath, "AGENTS.md");
29097
29137
  if (await fs.pathExists(agentResolvedPath)) {
29098
29138
  agentContent = await fs.readFile(agentResolvedPath, "utf-8");
29099
29139
  } else {
29100
- agentResolvedPath = path9.join(vaultPath, "AGENT.md");
29140
+ agentResolvedPath = path10.join(vaultPath, "AGENT.md");
29101
29141
  if (await fs.pathExists(agentResolvedPath)) {
29102
29142
  agentContent = await fs.readFile(agentResolvedPath, "utf-8");
29103
29143
  }
@@ -29115,7 +29155,7 @@ async function getVaultDiagnosis(vaultPath) {
29115
29155
  }
29116
29156
  }
29117
29157
  for (const dirName of LLM_WIKI_V2_AGENT_DIRS) {
29118
- const dirPath = path9.join(vaultPath, dirName);
29158
+ const dirPath = path10.join(vaultPath, dirName);
29119
29159
  const exists = await fs.pathExists(dirPath);
29120
29160
  const isDir = exists && (await stat(dirPath)).isDirectory();
29121
29161
  if (!isDir) {
@@ -29126,7 +29166,7 @@ async function getVaultDiagnosis(vaultPath) {
29126
29166
  });
29127
29167
  }
29128
29168
  }
29129
- const schemaPath = path9.join(vaultPath, "SCHEMA.md");
29169
+ const schemaPath = path10.join(vaultPath, "SCHEMA.md");
29130
29170
  if (!await fs.pathExists(schemaPath)) {
29131
29171
  issues.push({
29132
29172
  severity: "warning",
@@ -29134,7 +29174,7 @@ async function getVaultDiagnosis(vaultPath) {
29134
29174
  message: "LLM Wiki v2: missing SCHEMA.md at vault root"
29135
29175
  });
29136
29176
  }
29137
- const logMdPath = path9.join(vaultPath, "log.md");
29177
+ const logMdPath = path10.join(vaultPath, "log.md");
29138
29178
  if (!await fs.pathExists(logMdPath)) {
29139
29179
  issues.push({
29140
29180
  severity: "warning",
@@ -29147,21 +29187,21 @@ async function getVaultDiagnosis(vaultPath) {
29147
29187
  for (const filePath of allFiles) {
29148
29188
  const content = await fs.readFile(filePath, "utf-8");
29149
29189
  const links = extractWikilinks2(content);
29150
- const name = path9.basename(filePath, ".md");
29190
+ const name = path10.basename(filePath, ".md");
29151
29191
  allLinksMap.set(name, new Set(links));
29152
29192
  for (const link of links) {
29153
29193
  incomingLinks.add(link);
29154
29194
  }
29155
29195
  }
29156
29196
  for (const filePath of allFiles) {
29157
- const relativePath = path9.relative(vaultPath, filePath);
29197
+ const relativePath = path10.relative(vaultPath, filePath);
29158
29198
  if (relativePath.startsWith("Knowledge/templates/"))
29159
29199
  continue;
29160
29200
  if (relativePath === "AGENT.md" || relativePath === "AGENTS.md")
29161
29201
  continue;
29162
29202
  if (isAgentWikiPage(relativePath))
29163
29203
  continue;
29164
- const name = path9.basename(filePath, ".md");
29204
+ const name = path10.basename(filePath, ".md");
29165
29205
  const outgoing = allLinksMap.get(name) || /* @__PURE__ */ new Set();
29166
29206
  const hasIncoming = incomingLinks.has(name);
29167
29207
  const hasOutgoing = outgoing.size > 0;
@@ -29175,7 +29215,7 @@ async function getVaultDiagnosis(vaultPath) {
29175
29215
  }
29176
29216
  }
29177
29217
  for (const filePath of allFiles) {
29178
- const relativePath = path9.relative(vaultPath, filePath);
29218
+ const relativePath = path10.relative(vaultPath, filePath);
29179
29219
  const content = await fs.readFile(filePath, "utf-8");
29180
29220
  const links = extractWikilinks2(content);
29181
29221
  for (const link of links) {
@@ -29268,15 +29308,15 @@ var byoao_switch_provider = tool({
29268
29308
  });
29269
29309
 
29270
29310
  // dist/vault/upgrade.js
29271
- import path11 from "node:path";
29311
+ import path12 from "node:path";
29272
29312
  import os4 from "node:os";
29273
29313
 
29274
29314
  // dist/vault/copy-bundled-skills.js
29275
- import path10 from "node:path";
29315
+ import path11 from "node:path";
29276
29316
  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");
29317
+ const distAssets = path11.resolve(import.meta.dirname, "assets");
29318
+ const srcAssets = path11.resolve(import.meta.dirname, "..", "assets");
29319
+ const devAssets = path11.resolve(import.meta.dirname, "..", "..", "src", "assets");
29280
29320
  if (fs.existsSync(distAssets))
29281
29321
  return distAssets;
29282
29322
  if (fs.existsSync(srcAssets))
@@ -29286,9 +29326,9 @@ function resolveBundledAssetsRoot() {
29286
29326
  return distAssets;
29287
29327
  }
29288
29328
  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");
29329
+ const distSkills = path11.resolve(import.meta.dirname, "assets", "skills");
29330
+ const srcSkills = path11.resolve(import.meta.dirname, "..", "skills");
29331
+ const devSkills = path11.resolve(import.meta.dirname, "..", "..", "src", "skills");
29292
29332
  if (fs.existsSync(distSkills))
29293
29333
  return distSkills;
29294
29334
  if (fs.existsSync(srcSkills))
@@ -29305,15 +29345,15 @@ async function copyBundledSkillsToOpenCodeSkillsDir(targetSkillsRoot, options2)
29305
29345
  let obsidianSkills = 0;
29306
29346
  let byoaoSkills = 0;
29307
29347
  if (includeObsidian) {
29308
- const obsidianSrc = path10.join(assetsRoot, "obsidian-skills");
29348
+ const obsidianSrc = path11.join(assetsRoot, "obsidian-skills");
29309
29349
  if (fs.existsSync(obsidianSrc)) {
29310
29350
  for (const file2 of fs.readdirSync(obsidianSrc)) {
29311
29351
  if (!file2.endsWith(".md"))
29312
29352
  continue;
29313
29353
  const skillName = file2.replace(/\.md$/, "");
29314
- const destDir = path10.join(targetSkillsRoot, skillName);
29354
+ const destDir = path11.join(targetSkillsRoot, skillName);
29315
29355
  await fs.ensureDir(destDir);
29316
- await fs.copy(path10.join(obsidianSrc, file2), path10.join(destDir, "SKILL.md"), { overwrite: true });
29356
+ await fs.copy(path11.join(obsidianSrc, file2), path11.join(destDir, "SKILL.md"), { overwrite: true });
29317
29357
  obsidianSkills++;
29318
29358
  }
29319
29359
  }
@@ -29323,11 +29363,11 @@ async function copyBundledSkillsToOpenCodeSkillsDir(targetSkillsRoot, options2)
29323
29363
  for (const entry of entries) {
29324
29364
  if (!entry.isDirectory())
29325
29365
  continue;
29326
- const srcSkill = path10.join(byoaoSkillsRoot, entry.name, "SKILL.md");
29366
+ const srcSkill = path11.join(byoaoSkillsRoot, entry.name, "SKILL.md");
29327
29367
  if (await fs.pathExists(srcSkill)) {
29328
- const destDir = path10.join(targetSkillsRoot, entry.name);
29368
+ const destDir = path11.join(targetSkillsRoot, entry.name);
29329
29369
  await fs.ensureDir(destDir);
29330
- await fs.copy(srcSkill, path10.join(destDir, "SKILL.md"), { overwrite: true });
29370
+ await fs.copy(srcSkill, path11.join(destDir, "SKILL.md"), { overwrite: true });
29331
29371
  byoaoSkills++;
29332
29372
  }
29333
29373
  }
@@ -29343,7 +29383,7 @@ async function scanInstalledAssets(vaultPath) {
29343
29383
  const templates = await scanDir(vaultPath, "Knowledge/templates", ".md");
29344
29384
  const obsidianConfig = [];
29345
29385
  for (const file2 of OBSIDIAN_CONFIG_FILES) {
29346
- const abs = path11.join(vaultPath, ".obsidian", file2);
29386
+ const abs = path12.join(vaultPath, ".obsidian", file2);
29347
29387
  if (await fs.pathExists(abs)) {
29348
29388
  obsidianConfig.push(`.obsidian/${file2}`);
29349
29389
  }
@@ -29351,21 +29391,21 @@ async function scanInstalledAssets(vaultPath) {
29351
29391
  return { skills, commands, obsidianConfig, templates };
29352
29392
  }
29353
29393
  async function scanDir(vaultPath, relDir, ext) {
29354
- const absDir = path11.join(vaultPath, relDir);
29394
+ const absDir = path12.join(vaultPath, relDir);
29355
29395
  if (!await fs.pathExists(absDir))
29356
29396
  return [];
29357
29397
  const files = await fs.readdir(absDir);
29358
29398
  return files.filter((f) => f.endsWith(ext)).map((f) => `${relDir}/${f}`);
29359
29399
  }
29360
29400
  async function scanSkillDirs(vaultPath) {
29361
- const skillsRoot = path11.join(vaultPath, ".opencode", "skills");
29401
+ const skillsRoot = path12.join(vaultPath, ".opencode", "skills");
29362
29402
  if (!await fs.pathExists(skillsRoot))
29363
29403
  return [];
29364
29404
  const results = [];
29365
29405
  const entries = await fs.readdir(skillsRoot, { withFileTypes: true });
29366
29406
  for (const entry of entries) {
29367
29407
  if (entry.isDirectory()) {
29368
- const skillMd = path11.join(skillsRoot, entry.name, "SKILL.md");
29408
+ const skillMd = path12.join(skillsRoot, entry.name, "SKILL.md");
29369
29409
  if (await fs.pathExists(skillMd)) {
29370
29410
  results.push(`.opencode/skills/${entry.name}/SKILL.md`);
29371
29411
  }
@@ -29394,7 +29434,7 @@ function buildUpgradePlan(vaultPath, manifest, packageAssets) {
29394
29434
  const installed = new Set(manifest.infrastructure[key]);
29395
29435
  const shippedPaths = new Set(shipped.map((s) => s.relativePath));
29396
29436
  for (const entry of shipped) {
29397
- const onDisk = fs.existsSync(path11.join(vaultPath, entry.relativePath));
29437
+ const onDisk = fs.existsSync(path12.join(vaultPath, entry.relativePath));
29398
29438
  items.push({
29399
29439
  file: entry.relativePath,
29400
29440
  action: onDisk ? "update" : "add",
@@ -29425,20 +29465,20 @@ Entries are appended here during /cook operations.
29425
29465
  `;
29426
29466
  async function migrateV1ToV2Infrastructure(vaultPath) {
29427
29467
  for (const dir of LLM_WIKI_AGENT_DIRS) {
29428
- const dirPath = path11.join(vaultPath, dir);
29468
+ const dirPath = path12.join(vaultPath, dir);
29429
29469
  if (!await fs.pathExists(dirPath)) {
29430
29470
  await fs.ensureDir(dirPath);
29431
29471
  }
29432
29472
  }
29433
- const schemaPath = path11.join(vaultPath, "SCHEMA.md");
29473
+ const schemaPath = path12.join(vaultPath, "SCHEMA.md");
29434
29474
  if (!await fs.pathExists(schemaPath)) {
29435
- const commonDir = getCommonDir();
29436
- const schemaTemplatePath = path11.join(commonDir, "SCHEMA.md.hbs");
29475
+ const commonDir2 = getCommonDir();
29476
+ const schemaTemplatePath = path12.join(commonDir2, "SCHEMA.md.hbs");
29437
29477
  let content;
29438
29478
  if (await fs.pathExists(schemaTemplatePath)) {
29439
29479
  const schemaTemplate = await fs.readFile(schemaTemplatePath, "utf-8");
29440
29480
  content = renderTemplate(schemaTemplate, {
29441
- KB_NAME: path11.basename(vaultPath),
29481
+ KB_NAME: path12.basename(vaultPath),
29442
29482
  WIKI_DOMAIN: ""
29443
29483
  });
29444
29484
  } else {
@@ -29450,10 +29490,12 @@ This file describes the vault knowledge schema. Update it as your model evolves.
29450
29490
  }
29451
29491
  await fs.writeFile(schemaPath, content, "utf-8");
29452
29492
  }
29453
- const logPath = path11.join(vaultPath, "log.md");
29493
+ const logPath = path12.join(vaultPath, "log.md");
29454
29494
  if (!await fs.pathExists(logPath)) {
29455
29495
  await fs.writeFile(logPath, LOG_MD_PLACEHOLDER, "utf-8");
29456
29496
  }
29497
+ const commonDir = getCommonDir();
29498
+ await copyIndexBaseExampleIfMissing(vaultPath, commonDir);
29457
29499
  }
29458
29500
  var BYOAO_SKILL_NAMES = [
29459
29501
  "ask",
@@ -29470,16 +29512,16 @@ var BYOAO_SKILL_NAMES = [
29470
29512
  "wiki"
29471
29513
  ];
29472
29514
  async function migrateCommandsToSkills(vaultPath) {
29473
- const commandsDir = path11.join(vaultPath, ".opencode", "commands");
29515
+ const commandsDir = path12.join(vaultPath, ".opencode", "commands");
29474
29516
  if (!await fs.pathExists(commandsDir))
29475
29517
  return;
29476
- const skillsDir = path11.join(vaultPath, ".opencode", "skills");
29518
+ const skillsDir = path12.join(vaultPath, ".opencode", "skills");
29477
29519
  for (const name of BYOAO_SKILL_NAMES) {
29478
- const src = path11.join(commandsDir, `${name}.md`);
29520
+ const src = path12.join(commandsDir, `${name}.md`);
29479
29521
  if (!await fs.pathExists(src))
29480
29522
  continue;
29481
- const destDir = path11.join(skillsDir, name);
29482
- const dest = path11.join(destDir, "SKILL.md");
29523
+ const destDir = path12.join(skillsDir, name);
29524
+ const dest = path12.join(destDir, "SKILL.md");
29483
29525
  if (await fs.pathExists(dest)) {
29484
29526
  await fs.remove(src);
29485
29527
  continue;
@@ -29494,7 +29536,7 @@ async function migrateCommandsToSkills(vaultPath) {
29494
29536
  }
29495
29537
  async function collectV1DeprecatedInfrastructureItems(vaultPath) {
29496
29538
  const items = [];
29497
- const templatesDir = path11.join(vaultPath, "Knowledge", "templates");
29539
+ const templatesDir = path12.join(vaultPath, "Knowledge", "templates");
29498
29540
  if (await fs.pathExists(templatesDir)) {
29499
29541
  const files = await fs.readdir(templatesDir);
29500
29542
  for (const f of files) {
@@ -29509,7 +29551,7 @@ async function collectV1DeprecatedInfrastructureItems(vaultPath) {
29509
29551
  }
29510
29552
  for (const cmd of ["weave.md", "emerge.md"]) {
29511
29553
  const rel = `.opencode/commands/${cmd}`;
29512
- if (await fs.pathExists(path11.join(vaultPath, rel))) {
29554
+ if (await fs.pathExists(path12.join(vaultPath, rel))) {
29513
29555
  items.push({
29514
29556
  file: rel,
29515
29557
  action: "deprecated",
@@ -29529,9 +29571,9 @@ function mergeForcedDeprecatedIntoPlan(items, forced) {
29529
29571
  return [...byFile.values()];
29530
29572
  }
29531
29573
  function resolveAssetsDir2() {
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");
29574
+ const distAssets = path12.resolve(import.meta.dirname, "assets");
29575
+ const srcAssets = path12.resolve(import.meta.dirname, "..", "assets");
29576
+ const devAssets = path12.resolve(import.meta.dirname, "..", "..", "src", "assets");
29535
29577
  if (fs.existsSync(distAssets))
29536
29578
  return distAssets;
29537
29579
  if (fs.existsSync(srcAssets))
@@ -29541,9 +29583,9 @@ function resolveAssetsDir2() {
29541
29583
  return distAssets;
29542
29584
  }
29543
29585
  function resolveSkillsDir() {
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");
29586
+ const distSkills = path12.resolve(import.meta.dirname, "assets", "skills");
29587
+ const srcSkills = path12.resolve(import.meta.dirname, "..", "skills");
29588
+ const devSkills = path12.resolve(import.meta.dirname, "..", "..", "src", "skills");
29547
29589
  if (fs.existsSync(distSkills))
29548
29590
  return distSkills;
29549
29591
  if (fs.existsSync(srcSkills))
@@ -29560,14 +29602,14 @@ function resolvePackageAssets(preset) {
29560
29602
  const commands = [];
29561
29603
  const obsidianConfig = [];
29562
29604
  const templates = [];
29563
- const obsidianSkillsDir = path11.join(assetsDir, "obsidian-skills");
29605
+ const obsidianSkillsDir = path12.join(assetsDir, "obsidian-skills");
29564
29606
  if (fs.existsSync(obsidianSkillsDir)) {
29565
29607
  for (const file2 of fs.readdirSync(obsidianSkillsDir)) {
29566
29608
  if (file2.endsWith(".md")) {
29567
29609
  const skillName = file2.replace(/\.md$/, "");
29568
29610
  skills.push({
29569
29611
  relativePath: `.opencode/skills/${skillName}/SKILL.md`,
29570
- sourcePath: path11.join(obsidianSkillsDir, file2)
29612
+ sourcePath: path12.join(obsidianSkillsDir, file2)
29571
29613
  });
29572
29614
  }
29573
29615
  }
@@ -29575,7 +29617,7 @@ function resolvePackageAssets(preset) {
29575
29617
  if (fs.existsSync(skillsDir)) {
29576
29618
  for (const entry of fs.readdirSync(skillsDir, { withFileTypes: true })) {
29577
29619
  if (entry.isDirectory()) {
29578
- const skillMd = path11.join(skillsDir, entry.name, "SKILL.md");
29620
+ const skillMd = path12.join(skillsDir, entry.name, "SKILL.md");
29579
29621
  if (fs.existsSync(skillMd)) {
29580
29622
  skills.push({
29581
29623
  relativePath: `.opencode/skills/${entry.name}/SKILL.md`,
@@ -29585,10 +29627,10 @@ function resolvePackageAssets(preset) {
29585
29627
  }
29586
29628
  }
29587
29629
  }
29588
- const obsidianSrcDir = path11.join(commonDir, "obsidian");
29630
+ const obsidianSrcDir = path12.join(commonDir, "obsidian");
29589
29631
  if (fs.existsSync(obsidianSrcDir)) {
29590
29632
  for (const file2 of OBSIDIAN_CONFIG_FILES) {
29591
- const srcPath = path11.join(obsidianSrcDir, file2);
29633
+ const srcPath = path12.join(obsidianSrcDir, file2);
29592
29634
  if (fs.existsSync(srcPath)) {
29593
29635
  obsidianConfig.push({
29594
29636
  relativePath: `.obsidian/${file2}`,
@@ -29597,26 +29639,26 @@ function resolvePackageAssets(preset) {
29597
29639
  }
29598
29640
  }
29599
29641
  }
29600
- const commonTemplatesDir = path11.join(commonDir, "templates");
29642
+ const commonTemplatesDir = path12.join(commonDir, "templates");
29601
29643
  if (fs.existsSync(commonTemplatesDir)) {
29602
29644
  for (const file2 of fs.readdirSync(commonTemplatesDir)) {
29603
29645
  if (file2.endsWith(".md")) {
29604
29646
  templates.push({
29605
29647
  relativePath: `Knowledge/templates/${file2}`,
29606
- sourcePath: path11.join(commonTemplatesDir, file2)
29648
+ sourcePath: path12.join(commonTemplatesDir, file2)
29607
29649
  });
29608
29650
  }
29609
29651
  }
29610
29652
  }
29611
29653
  try {
29612
29654
  const { presetsDir } = loadPreset(preset);
29613
- const presetTemplatesDir = path11.join(presetsDir, preset, "templates");
29655
+ const presetTemplatesDir = path12.join(presetsDir, preset, "templates");
29614
29656
  if (fs.existsSync(presetTemplatesDir)) {
29615
29657
  for (const file2 of fs.readdirSync(presetTemplatesDir)) {
29616
29658
  if (file2.endsWith(".md")) {
29617
29659
  templates.push({
29618
29660
  relativePath: `Knowledge/templates/${file2}`,
29619
- sourcePath: path11.join(presetTemplatesDir, file2)
29661
+ sourcePath: path12.join(presetTemplatesDir, file2)
29620
29662
  });
29621
29663
  }
29622
29664
  }
@@ -29641,7 +29683,7 @@ async function upgradeVault(vaultPath, options2) {
29641
29683
  let globalOpenCodeSkillsEarly;
29642
29684
  let globalOpenCodeSkillsErrorEarly;
29643
29685
  if (!dryRun && !skipGlobalSkillsSync) {
29644
- const globalSkillsRoot = path11.join(os4.homedir(), ".config", "opencode", "skills");
29686
+ const globalSkillsRoot = path12.join(os4.homedir(), ".config", "opencode", "skills");
29645
29687
  if (await fs.pathExists(globalSkillsRoot)) {
29646
29688
  try {
29647
29689
  globalOpenCodeSkillsEarly = await copyBundledSkillsToOpenCodeSkillsDir(globalSkillsRoot, {
@@ -29664,8 +29706,8 @@ async function upgradeVault(vaultPath, options2) {
29664
29706
  globalOpenCodeSkillsError: globalOpenCodeSkillsErrorEarly
29665
29707
  };
29666
29708
  }
29667
- const legacyAgentMd = path11.join(vaultPath, "AGENT.md");
29668
- const newAgentsMd = path11.join(vaultPath, "AGENTS.md");
29709
+ const legacyAgentMd = path12.join(vaultPath, "AGENT.md");
29710
+ const newAgentsMd = path12.join(vaultPath, "AGENTS.md");
29669
29711
  if (!dryRun && await fs.pathExists(legacyAgentMd) && !await fs.pathExists(newAgentsMd)) {
29670
29712
  await fs.rename(legacyAgentMd, newAgentsMd);
29671
29713
  }
@@ -29700,8 +29742,8 @@ async function upgradeVault(vaultPath, options2) {
29700
29742
  if (item.action === "add" || item.action === "update") {
29701
29743
  const source = sourceMap.get(item.file);
29702
29744
  if (source) {
29703
- const dest = path11.join(vaultPath, item.file);
29704
- await fs.ensureDir(path11.dirname(dest));
29745
+ const dest = path12.join(vaultPath, item.file);
29746
+ await fs.ensureDir(path12.dirname(dest));
29705
29747
  await fs.copy(source, dest, { overwrite: true });
29706
29748
  if (item.action === "add") {
29707
29749
  added.push(item.file);
@@ -29722,7 +29764,7 @@ async function upgradeVault(vaultPath, options2) {
29722
29764
  const installedFiles = await scanInstalledAssets(vaultPath);
29723
29765
  await writeManifest(vaultPath, effectivePreset, installedFiles);
29724
29766
  if (!skipGlobalSkillsSync && errors.length === 0) {
29725
- const globalSkillsRoot = path11.join(os4.homedir(), ".config", "opencode", "skills");
29767
+ const globalSkillsRoot = path12.join(os4.homedir(), ".config", "opencode", "skills");
29726
29768
  if (await fs.pathExists(globalSkillsRoot)) {
29727
29769
  try {
29728
29770
  globalOpenCodeSkills = await copyBundledSkillsToOpenCodeSkillsDir(globalSkillsRoot, {
@@ -29811,11 +29853,11 @@ var byoao_vault_upgrade = tool({
29811
29853
 
29812
29854
  // dist/tools/mcp-auth.js
29813
29855
  import { spawn, execSync as execSync3 } from "node:child_process";
29814
- import path12 from "node:path";
29856
+ import path13 from "node:path";
29815
29857
  import os5 from "node:os";
29816
29858
  function findOpencodeBinary() {
29817
29859
  const candidates = [
29818
- path12.join(os5.homedir(), ".opencode/bin/opencode"),
29860
+ path13.join(os5.homedir(), ".opencode/bin/opencode"),
29819
29861
  "/usr/local/bin/opencode"
29820
29862
  ];
29821
29863
  for (const p of candidates) {
@@ -29919,7 +29961,7 @@ The user may need to:
29919
29961
  });
29920
29962
 
29921
29963
  // dist/hooks/system-transform.js
29922
- import path13 from "node:path";
29964
+ import path14 from "node:path";
29923
29965
 
29924
29966
  // dist/lib/logger.js
29925
29967
  import { join } from "node:path";
@@ -29999,7 +30041,7 @@ async function log(level, source, message, options2) {
29999
30041
 
30000
30042
  // dist/hooks/system-transform.js
30001
30043
  function readVaultMarkdown(vaultPath, fileName) {
30002
- const full = path13.join(vaultPath, fileName);
30044
+ const full = path14.join(vaultPath, fileName);
30003
30045
  if (!fs.existsSync(full))
30004
30046
  return null;
30005
30047
  try {
@@ -30085,7 +30127,7 @@ function getIdleSuggestion() {
30085
30127
  const suggestions = [
30086
30128
  "Tip: run /cook to compile your notes into structured knowledge pages",
30087
30129
  "Tip: run /health to check knowledge page health",
30088
- "Tip: run /wiki to regenerate INDEX.base",
30130
+ "Tip: run /wiki to refresh your INDEX.base knowledge map",
30089
30131
  "Tip: run /trace to see how an idea evolved over time",
30090
30132
  "Tip: run /connect to bridge two topics using your vault's link graph",
30091
30133
  "Tip: run /ideas to generate actionable insights from your vault",