@jayjiang/byoao 2.0.6 → 2.0.8
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/assets/obsidian-skills/obsidian-cli.md +7 -0
- package/dist/assets/presets/common/AGENTS.md.hbs +5 -5
- package/dist/assets/presets/common/INDEX.base.example +136 -0
- package/dist/assets/presets/common/Start Here.md.hbs +1 -1
- package/dist/assets/skills/ask/SKILL.md +47 -10
- package/dist/assets/skills/connect/SKILL.md +1 -1
- package/dist/assets/skills/cook/SKILL.md +2 -2
- package/dist/assets/skills/diagnose/SKILL.md +1 -1
- package/dist/assets/skills/ideas/SKILL.md +2 -2
- package/dist/assets/skills/trace/SKILL.md +1 -1
- package/dist/assets/skills/wiki/SKILL.md +50 -57
- package/dist/cli/byoao-logo-art.js +12 -0
- package/dist/cli/byoao-logo-art.js.map +1 -0
- package/dist/cli/logo-bit.js +14 -0
- package/dist/cli/logo-bit.js.map +1 -0
- package/dist/cli/ui.js +38 -62
- package/dist/cli/ui.js.map +1 -1
- package/dist/hooks/idle-suggestions.js +1 -1
- package/dist/hooks/idle-suggestions.js.map +1 -1
- package/dist/index.js +189 -169
- package/dist/tools/init-vault.js +1 -1
- package/dist/tools/init-vault.js.map +1 -1
- package/dist/vault/__tests__/create.test.js +4 -1
- package/dist/vault/__tests__/create.test.js.map +1 -1
- package/dist/vault/__tests__/index-base-example.test.js +31 -0
- package/dist/vault/__tests__/index-base-example.test.js.map +1 -0
- package/dist/vault/create.js +4 -0
- package/dist/vault/create.js.map +1 -1
- package/dist/vault/index-base-example.js +19 -0
- package/dist/vault/index-base-example.js.map +1 -0
- package/dist/vault/manifest.js +1 -1
- package/dist/vault/self-update.js +1 -1
- package/dist/vault/upgrade.js +3 -0
- package/dist/vault/upgrade.js.map +1 -1
- package/package.json +2 -1
- package/src/assets/obsidian-skills/obsidian-cli.md +7 -0
- package/src/assets/presets/common/AGENTS.md.hbs +5 -5
- package/src/assets/presets/common/INDEX.base.example +136 -0
- package/src/assets/presets/common/Start Here.md.hbs +1 -1
- package/src/skills/ask/SKILL.md +47 -10
- package/src/skills/connect/SKILL.md +1 -1
- package/src/skills/cook/SKILL.md +2 -2
- package/src/skills/diagnose/SKILL.md +1 -1
- package/src/skills/ideas/SKILL.md +2 -2
- package/src/skills/trace/SKILL.md +1 -1
- 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(
|
|
4686
|
-
return /^\.|this\b/.test(
|
|
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(
|
|
4691
|
-
return
|
|
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(
|
|
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:
|
|
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),
|
|
6036
|
+
var params = this.setupFullMustacheParams(decorator, program, void 0), path15 = decorator.path;
|
|
6037
6037
|
this.useDecorators = true;
|
|
6038
|
-
this.opcode("registerDecorator", params.length,
|
|
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
|
|
6103
|
-
this.opcode("getContext",
|
|
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
|
-
|
|
6107
|
-
this.accept(
|
|
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
|
|
6112
|
-
|
|
6113
|
-
this.accept(
|
|
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),
|
|
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
|
-
|
|
6124
|
-
|
|
6125
|
-
this.accept(
|
|
6126
|
-
this.opcode("invokeHelper", params.length,
|
|
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(
|
|
6130
|
-
this.addDepth(
|
|
6131
|
-
this.opcode("getContext",
|
|
6132
|
-
var 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,
|
|
6134
|
+
this.opcode("lookupBlockParam", blockParamId, path15.parts);
|
|
6135
6135
|
} else if (!name) {
|
|
6136
6136
|
this.opcode("pushContext");
|
|
6137
|
-
} else if (
|
|
6137
|
+
} else if (path15.data) {
|
|
6138
6138
|
this.options.data = true;
|
|
6139
|
-
this.opcode("lookupData",
|
|
6139
|
+
this.opcode("lookupData", path15.depth, path15.parts, path15.strict);
|
|
6140
6140
|
} else {
|
|
6141
|
-
this.opcode("lookupOnContext",
|
|
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
|
|
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
|
-
|
|
6497
|
+
path15 = url2.path;
|
|
6498
6498
|
}
|
|
6499
|
-
var isAbsolute = exports2.isAbsolute(
|
|
6500
|
-
var parts =
|
|
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
|
-
|
|
6518
|
-
if (
|
|
6519
|
-
|
|
6517
|
+
path15 = parts.join("/");
|
|
6518
|
+
if (path15 === "") {
|
|
6519
|
+
path15 = isAbsolute ? "/" : ".";
|
|
6520
6520
|
}
|
|
6521
6521
|
if (url2) {
|
|
6522
|
-
url2.path =
|
|
6522
|
+
url2.path = path15;
|
|
6523
6523
|
return urlGenerate(url2);
|
|
6524
6524
|
}
|
|
6525
|
-
return
|
|
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
|
|
9307
|
-
return (id.data ? "@" : "") + "PATH:" +
|
|
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,
|
|
12019
|
-
if (!
|
|
12018
|
+
function getElementAtPath(obj, path15) {
|
|
12019
|
+
if (!path15)
|
|
12020
12020
|
return obj;
|
|
12021
|
-
return
|
|
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(
|
|
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(
|
|
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,
|
|
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 = [...
|
|
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
|
|
12597
|
-
for (const seg of
|
|
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
|
|
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:
|
|
24277
|
-
const fullPath = [...
|
|
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,
|
|
24393
|
+
constructor(parent, value, path15, key) {
|
|
24394
24394
|
this._cachedPath = [];
|
|
24395
24395
|
this.parent = parent;
|
|
24396
24396
|
this.data = value;
|
|
24397
|
-
this._path =
|
|
24397
|
+
this._path = path15;
|
|
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.
|
|
28265
|
+
var PKG_VERSION = "2.0.8";
|
|
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([]),
|
|
@@ -28358,6 +28358,21 @@ function detectInitMode(targetPath) {
|
|
|
28358
28358
|
return "fresh";
|
|
28359
28359
|
}
|
|
28360
28360
|
|
|
28361
|
+
// dist/vault/index-base-example.js
|
|
28362
|
+
import path6 from "node:path";
|
|
28363
|
+
async function copyIndexBaseExampleIfMissing(vaultPath, commonDir) {
|
|
28364
|
+
const dest = path6.join(vaultPath, "INDEX.base");
|
|
28365
|
+
if (await fs.pathExists(dest)) {
|
|
28366
|
+
return false;
|
|
28367
|
+
}
|
|
28368
|
+
const src = path6.join(commonDir, "INDEX.base.example");
|
|
28369
|
+
if (!await fs.pathExists(src)) {
|
|
28370
|
+
return false;
|
|
28371
|
+
}
|
|
28372
|
+
await fs.copy(src, dest);
|
|
28373
|
+
return true;
|
|
28374
|
+
}
|
|
28375
|
+
|
|
28361
28376
|
// dist/vault/create.js
|
|
28362
28377
|
function countWikilinks(content) {
|
|
28363
28378
|
const stripped = content.replace(/```[\s\S]*?```/g, "").replace(/`[^`]+`/g, "");
|
|
@@ -28387,10 +28402,10 @@ var MCP_DISPLAY_NAMES = {
|
|
|
28387
28402
|
};
|
|
28388
28403
|
async function createMinimalCore(ctx) {
|
|
28389
28404
|
if (!ctx.preserveObsidian) {
|
|
28390
|
-
await fs.ensureDir(
|
|
28391
|
-
const obsidianSrc =
|
|
28405
|
+
await fs.ensureDir(path7.join(ctx.vaultPath, ".obsidian"));
|
|
28406
|
+
const obsidianSrc = path7.join(ctx.commonDir, "obsidian");
|
|
28392
28407
|
if (await fs.pathExists(obsidianSrc)) {
|
|
28393
|
-
await fs.copy(obsidianSrc,
|
|
28408
|
+
await fs.copy(obsidianSrc, path7.join(ctx.vaultPath, ".obsidian"), { overwrite: false });
|
|
28394
28409
|
const obsidianFiles = await fs.readdir(obsidianSrc);
|
|
28395
28410
|
ctx.filesCreated += obsidianFiles.length;
|
|
28396
28411
|
for (const f of obsidianFiles) {
|
|
@@ -28398,13 +28413,13 @@ async function createMinimalCore(ctx) {
|
|
|
28398
28413
|
}
|
|
28399
28414
|
}
|
|
28400
28415
|
}
|
|
28401
|
-
const startHereTemplate = await fs.readFile(
|
|
28416
|
+
const startHereTemplate = await fs.readFile(path7.join(ctx.commonDir, "Start Here.md.hbs"), "utf-8");
|
|
28402
28417
|
const startHereContent = renderTemplate(startHereTemplate, {
|
|
28403
28418
|
KB_NAME: ctx.kbName,
|
|
28404
28419
|
HAS_MCP_SERVICES: ctx.mcpServices.length > 0,
|
|
28405
28420
|
MCP_SERVICES: ctx.mcpServices
|
|
28406
28421
|
});
|
|
28407
|
-
const startHerePath =
|
|
28422
|
+
const startHerePath = path7.join(ctx.vaultPath, "Start Here.md");
|
|
28408
28423
|
if (!await fs.pathExists(startHerePath)) {
|
|
28409
28424
|
await fs.writeFile(startHerePath, startHereContent);
|
|
28410
28425
|
ctx.filesCreated++;
|
|
@@ -28413,21 +28428,21 @@ async function createMinimalCore(ctx) {
|
|
|
28413
28428
|
async function createLlmWikiCore(ctx, wikiDomain = "") {
|
|
28414
28429
|
const agentDirs = ["entities", "concepts", "comparisons", "queries"];
|
|
28415
28430
|
for (const dir of agentDirs) {
|
|
28416
|
-
const dirPath =
|
|
28431
|
+
const dirPath = path7.join(ctx.vaultPath, dir);
|
|
28417
28432
|
if (!await fs.pathExists(dirPath)) {
|
|
28418
28433
|
await fs.ensureDir(dirPath);
|
|
28419
28434
|
ctx.filesCreated++;
|
|
28420
28435
|
ctx.directories.push(dir);
|
|
28421
28436
|
}
|
|
28422
28437
|
}
|
|
28423
|
-
const schemaTemplatePath =
|
|
28438
|
+
const schemaTemplatePath = path7.join(ctx.commonDir, "SCHEMA.md.hbs");
|
|
28424
28439
|
if (await fs.pathExists(schemaTemplatePath)) {
|
|
28425
28440
|
const schemaTemplate = await fs.readFile(schemaTemplatePath, "utf-8");
|
|
28426
28441
|
const schemaContent = renderTemplate(schemaTemplate, {
|
|
28427
28442
|
KB_NAME: ctx.kbName,
|
|
28428
28443
|
WIKI_DOMAIN: wikiDomain || ""
|
|
28429
28444
|
});
|
|
28430
|
-
const schemaPath =
|
|
28445
|
+
const schemaPath = path7.join(ctx.vaultPath, "SCHEMA.md");
|
|
28431
28446
|
if (!await fs.pathExists(schemaPath)) {
|
|
28432
28447
|
await fs.writeFile(schemaPath, schemaContent);
|
|
28433
28448
|
ctx.filesCreated++;
|
|
@@ -28438,16 +28453,19 @@ async function createLlmWikiCore(ctx, wikiDomain = "") {
|
|
|
28438
28453
|
Entries are appended here during /cook operations.
|
|
28439
28454
|
|
|
28440
28455
|
`;
|
|
28441
|
-
const logPath =
|
|
28456
|
+
const logPath = path7.join(ctx.vaultPath, "log.md");
|
|
28442
28457
|
if (!await fs.pathExists(logPath)) {
|
|
28443
28458
|
await fs.writeFile(logPath, logContent);
|
|
28444
28459
|
ctx.filesCreated++;
|
|
28445
28460
|
}
|
|
28461
|
+
if (await copyIndexBaseExampleIfMissing(ctx.vaultPath, ctx.commonDir)) {
|
|
28462
|
+
ctx.filesCreated++;
|
|
28463
|
+
}
|
|
28446
28464
|
}
|
|
28447
28465
|
async function createAgentsMd(ctx, ownerName, presetConfig, presetDir) {
|
|
28448
|
-
const agentsTemplate = await fs.readFile(
|
|
28466
|
+
const agentsTemplate = await fs.readFile(path7.join(ctx.commonDir, "AGENTS.md.hbs"), "utf-8");
|
|
28449
28467
|
let roleSection = "";
|
|
28450
|
-
const agentSectionPath =
|
|
28468
|
+
const agentSectionPath = path7.join(presetDir, "agent-section.hbs");
|
|
28451
28469
|
if (await fs.pathExists(agentSectionPath)) {
|
|
28452
28470
|
const agentSectionTemplate = await fs.readFile(agentSectionPath, "utf-8");
|
|
28453
28471
|
roleSection = renderTemplate(agentSectionTemplate, {
|
|
@@ -28462,7 +28480,7 @@ async function createAgentsMd(ctx, ownerName, presetConfig, presetDir) {
|
|
|
28462
28480
|
OWNER_NAME: ownerName,
|
|
28463
28481
|
ROLE_SECTION: roleSection
|
|
28464
28482
|
});
|
|
28465
|
-
const agentsMdPath =
|
|
28483
|
+
const agentsMdPath = path7.join(ctx.vaultPath, "AGENTS.md");
|
|
28466
28484
|
if (!await fs.pathExists(agentsMdPath)) {
|
|
28467
28485
|
await fs.writeFile(agentsMdPath, agentsContent);
|
|
28468
28486
|
ctx.filesCreated++;
|
|
@@ -28470,17 +28488,17 @@ async function createAgentsMd(ctx, ownerName, presetConfig, presetDir) {
|
|
|
28470
28488
|
}
|
|
28471
28489
|
async function applyPresetOverlay(ctx, presetConfig, presetDir) {
|
|
28472
28490
|
for (const dir of presetConfig.directories) {
|
|
28473
|
-
await fs.ensureDir(
|
|
28491
|
+
await fs.ensureDir(path7.join(ctx.vaultPath, dir));
|
|
28474
28492
|
}
|
|
28475
28493
|
ctx.directories.push(...presetConfig.directories);
|
|
28476
28494
|
const allTemplateNames = [];
|
|
28477
|
-
const presetTemplatesDir =
|
|
28495
|
+
const presetTemplatesDir = path7.join(presetDir, "templates");
|
|
28478
28496
|
if (await fs.pathExists(presetTemplatesDir)) {
|
|
28479
|
-
const templateDest =
|
|
28497
|
+
const templateDest = path7.join(ctx.vaultPath, "templates");
|
|
28480
28498
|
await fs.ensureDir(templateDest);
|
|
28481
28499
|
const files = await fs.readdir(presetTemplatesDir);
|
|
28482
28500
|
for (const file2 of files) {
|
|
28483
|
-
await fs.copy(
|
|
28501
|
+
await fs.copy(path7.join(presetTemplatesDir, file2), path7.join(templateDest, file2), { overwrite: false });
|
|
28484
28502
|
allTemplateNames.push(file2.replace(/\.md$/, ""));
|
|
28485
28503
|
ctx.filesCreated++;
|
|
28486
28504
|
ctx.installedFiles.templates.push(`templates/${file2}`);
|
|
@@ -28492,7 +28510,7 @@ async function createVault(config2) {
|
|
|
28492
28510
|
const { kbName, vaultPath, preset } = config2;
|
|
28493
28511
|
const presetName = preset ?? "minimal";
|
|
28494
28512
|
const { config: presetConfig, presetsDir } = loadPreset(presetName);
|
|
28495
|
-
const presetDir =
|
|
28513
|
+
const presetDir = path7.join(presetsDir, presetName);
|
|
28496
28514
|
const initMode = detectInitMode(vaultPath);
|
|
28497
28515
|
const preserveObsidian = initMode === "obsidian-vault";
|
|
28498
28516
|
const ctx = makeContext(vaultPath, kbName, preserveObsidian);
|
|
@@ -28527,7 +28545,7 @@ async function createVault(config2) {
|
|
|
28527
28545
|
for (const entry of entries) {
|
|
28528
28546
|
const entryStr = String(entry);
|
|
28529
28547
|
if (entryStr.endsWith(".md") && !entryStr.startsWith(".obsidian")) {
|
|
28530
|
-
const content = await fs.readFile(
|
|
28548
|
+
const content = await fs.readFile(path7.join(ctx.vaultPath, entryStr), "utf-8");
|
|
28531
28549
|
wikilinksCreated += countWikilinks(content);
|
|
28532
28550
|
}
|
|
28533
28551
|
}
|
|
@@ -28543,7 +28561,7 @@ async function createVault(config2) {
|
|
|
28543
28561
|
};
|
|
28544
28562
|
}
|
|
28545
28563
|
async function configureOpenCodeProject(vaultPath, installedFiles) {
|
|
28546
|
-
const configPath =
|
|
28564
|
+
const configPath = path7.join(vaultPath, ".opencode.json");
|
|
28547
28565
|
let config2 = {};
|
|
28548
28566
|
if (await fs.pathExists(configPath)) {
|
|
28549
28567
|
try {
|
|
@@ -28558,31 +28576,31 @@ async function configureOpenCodeProject(vaultPath, installedFiles) {
|
|
|
28558
28576
|
}
|
|
28559
28577
|
await fs.writeJson(configPath, config2, { spaces: 2 });
|
|
28560
28578
|
const assetsDir = resolveAssetsDir();
|
|
28561
|
-
const obsidianSkillsSrc =
|
|
28562
|
-
const skillsDest =
|
|
28579
|
+
const obsidianSkillsSrc = path7.join(assetsDir, "obsidian-skills");
|
|
28580
|
+
const skillsDest = path7.join(vaultPath, ".opencode", "skills");
|
|
28563
28581
|
if (await fs.pathExists(obsidianSkillsSrc)) {
|
|
28564
28582
|
await fs.ensureDir(skillsDest);
|
|
28565
28583
|
const files = await fs.readdir(obsidianSkillsSrc);
|
|
28566
28584
|
for (const file2 of files) {
|
|
28567
28585
|
if (file2.endsWith(".md")) {
|
|
28568
28586
|
const skillName = file2.replace(/\.md$/, "");
|
|
28569
|
-
const destDir =
|
|
28587
|
+
const destDir = path7.join(skillsDest, skillName);
|
|
28570
28588
|
await fs.ensureDir(destDir);
|
|
28571
|
-
await fs.copy(
|
|
28589
|
+
await fs.copy(path7.join(obsidianSkillsSrc, file2), path7.join(destDir, "SKILL.md"), { overwrite: true });
|
|
28572
28590
|
installedFiles.skills.push(`.opencode/skills/${skillName}/SKILL.md`);
|
|
28573
28591
|
}
|
|
28574
28592
|
}
|
|
28575
28593
|
}
|
|
28576
|
-
const byoaoSkillsSrc =
|
|
28594
|
+
const byoaoSkillsSrc = path7.join(assetsDir, "skills");
|
|
28577
28595
|
if (await fs.pathExists(byoaoSkillsSrc)) {
|
|
28578
28596
|
const entries = await fs.readdir(byoaoSkillsSrc, { withFileTypes: true });
|
|
28579
28597
|
for (const entry of entries) {
|
|
28580
28598
|
if (entry.isDirectory()) {
|
|
28581
|
-
const srcSkill =
|
|
28599
|
+
const srcSkill = path7.join(byoaoSkillsSrc, entry.name, "SKILL.md");
|
|
28582
28600
|
if (await fs.pathExists(srcSkill)) {
|
|
28583
|
-
const destDir =
|
|
28601
|
+
const destDir = path7.join(skillsDest, entry.name);
|
|
28584
28602
|
await fs.ensureDir(destDir);
|
|
28585
|
-
await fs.copy(srcSkill,
|
|
28603
|
+
await fs.copy(srcSkill, path7.join(destDir, "SKILL.md"), { overwrite: true });
|
|
28586
28604
|
installedFiles.skills.push(`.opencode/skills/${entry.name}/SKILL.md`);
|
|
28587
28605
|
}
|
|
28588
28606
|
}
|
|
@@ -28590,9 +28608,9 @@ async function configureOpenCodeProject(vaultPath, installedFiles) {
|
|
|
28590
28608
|
}
|
|
28591
28609
|
}
|
|
28592
28610
|
function resolveAssetsDir() {
|
|
28593
|
-
const distAssets =
|
|
28594
|
-
const srcAssets =
|
|
28595
|
-
const devAssets =
|
|
28611
|
+
const distAssets = path7.resolve(import.meta.dirname, "assets");
|
|
28612
|
+
const srcAssets = path7.resolve(import.meta.dirname, "..", "assets");
|
|
28613
|
+
const devAssets = path7.resolve(import.meta.dirname, "..", "..", "src", "assets");
|
|
28596
28614
|
if (fs.existsSync(distAssets))
|
|
28597
28615
|
return distAssets;
|
|
28598
28616
|
if (fs.existsSync(srcAssets))
|
|
@@ -28716,10 +28734,10 @@ function formatObsidianStatus(status) {
|
|
|
28716
28734
|
}
|
|
28717
28735
|
|
|
28718
28736
|
// dist/tools/init-vault.js
|
|
28719
|
-
import
|
|
28737
|
+
import path8 from "node:path";
|
|
28720
28738
|
import os3 from "node:os";
|
|
28721
28739
|
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.",
|
|
28740
|
+
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
28741
|
args: {
|
|
28724
28742
|
kbName: tool.schema.string().describe(`Knowledge base name (e.g. "Jay's KB")`),
|
|
28725
28743
|
ownerName: tool.schema.string().optional().describe("Owner's name"),
|
|
@@ -28734,7 +28752,7 @@ var byoao_init_vault = tool({
|
|
|
28734
28752
|
|
|
28735
28753
|
Please install Obsidian first, then try again.`;
|
|
28736
28754
|
}
|
|
28737
|
-
const resolvedPath = args.vaultPath ||
|
|
28755
|
+
const resolvedPath = args.vaultPath || path8.join(os3.homedir(), "Documents", args.kbName);
|
|
28738
28756
|
const config2 = VaultConfigSchema.parse({
|
|
28739
28757
|
kbName: args.kbName,
|
|
28740
28758
|
ownerName: args.ownerName || "",
|
|
@@ -28851,7 +28869,7 @@ Open in Obsidian: "Open folder as vault" \u2192 select "${result.vaultPath}"`;
|
|
|
28851
28869
|
});
|
|
28852
28870
|
|
|
28853
28871
|
// dist/vault/status.js
|
|
28854
|
-
import
|
|
28872
|
+
import path9 from "node:path";
|
|
28855
28873
|
async function getAllMarkdownFiles(dirPath) {
|
|
28856
28874
|
const results = [];
|
|
28857
28875
|
async function walk(dir) {
|
|
@@ -28859,7 +28877,7 @@ async function getAllMarkdownFiles(dirPath) {
|
|
|
28859
28877
|
return;
|
|
28860
28878
|
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
28861
28879
|
for (const entry of entries) {
|
|
28862
|
-
const fullPath =
|
|
28880
|
+
const fullPath = path9.join(dir, entry.name);
|
|
28863
28881
|
if (entry.isDirectory()) {
|
|
28864
28882
|
if (!entry.name.startsWith(".")) {
|
|
28865
28883
|
await walk(fullPath);
|
|
@@ -28898,7 +28916,7 @@ async function getVaultStatus(vaultPath) {
|
|
|
28898
28916
|
};
|
|
28899
28917
|
}
|
|
28900
28918
|
const allFiles = await getAllMarkdownFiles(vaultPath);
|
|
28901
|
-
const noteNames = new Set(allFiles.map((f) =>
|
|
28919
|
+
const noteNames = new Set(allFiles.map((f) => path9.basename(f, ".md")));
|
|
28902
28920
|
let wikilinkCount = 0;
|
|
28903
28921
|
const brokenLinksSet = /* @__PURE__ */ new Set();
|
|
28904
28922
|
for (const file2 of allFiles) {
|
|
@@ -28923,7 +28941,7 @@ async function getVaultStatus(vaultPath) {
|
|
|
28923
28941
|
"Daily"
|
|
28924
28942
|
];
|
|
28925
28943
|
for (const dir of topDirs) {
|
|
28926
|
-
const dirPath =
|
|
28944
|
+
const dirPath = path9.join(vaultPath, dir);
|
|
28927
28945
|
if (await fs.pathExists(dirPath)) {
|
|
28928
28946
|
const files = await getAllMarkdownFiles(dirPath);
|
|
28929
28947
|
directories[dir] = files.length;
|
|
@@ -28937,7 +28955,7 @@ async function getVaultStatus(vaultPath) {
|
|
|
28937
28955
|
queries: 0
|
|
28938
28956
|
};
|
|
28939
28957
|
for (const name of agentDirNames) {
|
|
28940
|
-
const dirPath =
|
|
28958
|
+
const dirPath = path9.join(vaultPath, name);
|
|
28941
28959
|
const mdFiles = await getAllMarkdownFiles(dirPath);
|
|
28942
28960
|
agentPages[name] = mdFiles.length;
|
|
28943
28961
|
}
|
|
@@ -28948,12 +28966,12 @@ async function getVaultStatus(vaultPath) {
|
|
|
28948
28966
|
wikilinkCount,
|
|
28949
28967
|
brokenLinks: Array.from(brokenLinksSet),
|
|
28950
28968
|
directories,
|
|
28951
|
-
hasObsidianConfig: await fs.pathExists(
|
|
28952
|
-
hasAgentMd: await fs.pathExists(
|
|
28969
|
+
hasObsidianConfig: await fs.pathExists(path9.join(vaultPath, ".obsidian")),
|
|
28970
|
+
hasAgentMd: await fs.pathExists(path9.join(vaultPath, "AGENTS.md")) || await fs.pathExists(path9.join(vaultPath, "AGENT.md")),
|
|
28953
28971
|
agentPages,
|
|
28954
|
-
hasSchema: await fs.pathExists(
|
|
28955
|
-
hasLog: await fs.pathExists(
|
|
28956
|
-
hasIndexBase: await fs.pathExists(
|
|
28972
|
+
hasSchema: await fs.pathExists(path9.join(vaultPath, "SCHEMA.md")),
|
|
28973
|
+
hasLog: await fs.pathExists(path9.join(vaultPath, "log.md")),
|
|
28974
|
+
hasIndexBase: await fs.pathExists(path9.join(vaultPath, "INDEX.base"))
|
|
28957
28975
|
};
|
|
28958
28976
|
}
|
|
28959
28977
|
function formatVaultStatus(status) {
|
|
@@ -29009,18 +29027,18 @@ var byoao_vault_status = tool({
|
|
|
29009
29027
|
});
|
|
29010
29028
|
|
|
29011
29029
|
// dist/vault/doctor.js
|
|
29012
|
-
import
|
|
29030
|
+
import path10 from "node:path";
|
|
29013
29031
|
import { stat } from "node:fs/promises";
|
|
29014
29032
|
var LLM_WIKI_V2_AGENT_DIRS = ["entities", "concepts", "comparisons", "queries"];
|
|
29015
29033
|
function isAgentWikiPage(relativePath) {
|
|
29016
|
-
const top = relativePath.split(
|
|
29034
|
+
const top = relativePath.split(path10.sep)[0];
|
|
29017
29035
|
return LLM_WIKI_V2_AGENT_DIRS.includes(top);
|
|
29018
29036
|
}
|
|
29019
29037
|
async function collectMarkdownFiles(dir) {
|
|
29020
29038
|
const results = [];
|
|
29021
29039
|
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
29022
29040
|
for (const entry of entries) {
|
|
29023
|
-
const fullPath =
|
|
29041
|
+
const fullPath = path10.join(dir, entry.name);
|
|
29024
29042
|
if (entry.isDirectory()) {
|
|
29025
29043
|
if (entry.name === ".obsidian" || entry.name === ".git")
|
|
29026
29044
|
continue;
|
|
@@ -29041,10 +29059,10 @@ function extractWikilinks2(content) {
|
|
|
29041
29059
|
async function getVaultDiagnosis(vaultPath) {
|
|
29042
29060
|
const issues = [];
|
|
29043
29061
|
const allFiles = await collectMarkdownFiles(vaultPath);
|
|
29044
|
-
const noteNames = new Set(allFiles.map((f) =>
|
|
29062
|
+
const noteNames = new Set(allFiles.map((f) => path10.basename(f, ".md")));
|
|
29045
29063
|
let healthyNotes = 0;
|
|
29046
29064
|
for (const filePath of allFiles) {
|
|
29047
|
-
const relativePath =
|
|
29065
|
+
const relativePath = path10.relative(vaultPath, filePath);
|
|
29048
29066
|
if (relativePath.startsWith("Knowledge/templates/"))
|
|
29049
29067
|
continue;
|
|
29050
29068
|
const content = await fs.readFile(filePath, "utf-8");
|
|
@@ -29093,11 +29111,11 @@ async function getVaultDiagnosis(vaultPath) {
|
|
|
29093
29111
|
healthyNotes++;
|
|
29094
29112
|
}
|
|
29095
29113
|
let agentContent = null;
|
|
29096
|
-
let agentResolvedPath =
|
|
29114
|
+
let agentResolvedPath = path10.join(vaultPath, "AGENTS.md");
|
|
29097
29115
|
if (await fs.pathExists(agentResolvedPath)) {
|
|
29098
29116
|
agentContent = await fs.readFile(agentResolvedPath, "utf-8");
|
|
29099
29117
|
} else {
|
|
29100
|
-
agentResolvedPath =
|
|
29118
|
+
agentResolvedPath = path10.join(vaultPath, "AGENT.md");
|
|
29101
29119
|
if (await fs.pathExists(agentResolvedPath)) {
|
|
29102
29120
|
agentContent = await fs.readFile(agentResolvedPath, "utf-8");
|
|
29103
29121
|
}
|
|
@@ -29115,7 +29133,7 @@ async function getVaultDiagnosis(vaultPath) {
|
|
|
29115
29133
|
}
|
|
29116
29134
|
}
|
|
29117
29135
|
for (const dirName of LLM_WIKI_V2_AGENT_DIRS) {
|
|
29118
|
-
const dirPath =
|
|
29136
|
+
const dirPath = path10.join(vaultPath, dirName);
|
|
29119
29137
|
const exists = await fs.pathExists(dirPath);
|
|
29120
29138
|
const isDir = exists && (await stat(dirPath)).isDirectory();
|
|
29121
29139
|
if (!isDir) {
|
|
@@ -29126,7 +29144,7 @@ async function getVaultDiagnosis(vaultPath) {
|
|
|
29126
29144
|
});
|
|
29127
29145
|
}
|
|
29128
29146
|
}
|
|
29129
|
-
const schemaPath =
|
|
29147
|
+
const schemaPath = path10.join(vaultPath, "SCHEMA.md");
|
|
29130
29148
|
if (!await fs.pathExists(schemaPath)) {
|
|
29131
29149
|
issues.push({
|
|
29132
29150
|
severity: "warning",
|
|
@@ -29134,7 +29152,7 @@ async function getVaultDiagnosis(vaultPath) {
|
|
|
29134
29152
|
message: "LLM Wiki v2: missing SCHEMA.md at vault root"
|
|
29135
29153
|
});
|
|
29136
29154
|
}
|
|
29137
|
-
const logMdPath =
|
|
29155
|
+
const logMdPath = path10.join(vaultPath, "log.md");
|
|
29138
29156
|
if (!await fs.pathExists(logMdPath)) {
|
|
29139
29157
|
issues.push({
|
|
29140
29158
|
severity: "warning",
|
|
@@ -29147,21 +29165,21 @@ async function getVaultDiagnosis(vaultPath) {
|
|
|
29147
29165
|
for (const filePath of allFiles) {
|
|
29148
29166
|
const content = await fs.readFile(filePath, "utf-8");
|
|
29149
29167
|
const links = extractWikilinks2(content);
|
|
29150
|
-
const name =
|
|
29168
|
+
const name = path10.basename(filePath, ".md");
|
|
29151
29169
|
allLinksMap.set(name, new Set(links));
|
|
29152
29170
|
for (const link of links) {
|
|
29153
29171
|
incomingLinks.add(link);
|
|
29154
29172
|
}
|
|
29155
29173
|
}
|
|
29156
29174
|
for (const filePath of allFiles) {
|
|
29157
|
-
const relativePath =
|
|
29175
|
+
const relativePath = path10.relative(vaultPath, filePath);
|
|
29158
29176
|
if (relativePath.startsWith("Knowledge/templates/"))
|
|
29159
29177
|
continue;
|
|
29160
29178
|
if (relativePath === "AGENT.md" || relativePath === "AGENTS.md")
|
|
29161
29179
|
continue;
|
|
29162
29180
|
if (isAgentWikiPage(relativePath))
|
|
29163
29181
|
continue;
|
|
29164
|
-
const name =
|
|
29182
|
+
const name = path10.basename(filePath, ".md");
|
|
29165
29183
|
const outgoing = allLinksMap.get(name) || /* @__PURE__ */ new Set();
|
|
29166
29184
|
const hasIncoming = incomingLinks.has(name);
|
|
29167
29185
|
const hasOutgoing = outgoing.size > 0;
|
|
@@ -29175,7 +29193,7 @@ async function getVaultDiagnosis(vaultPath) {
|
|
|
29175
29193
|
}
|
|
29176
29194
|
}
|
|
29177
29195
|
for (const filePath of allFiles) {
|
|
29178
|
-
const relativePath =
|
|
29196
|
+
const relativePath = path10.relative(vaultPath, filePath);
|
|
29179
29197
|
const content = await fs.readFile(filePath, "utf-8");
|
|
29180
29198
|
const links = extractWikilinks2(content);
|
|
29181
29199
|
for (const link of links) {
|
|
@@ -29268,15 +29286,15 @@ var byoao_switch_provider = tool({
|
|
|
29268
29286
|
});
|
|
29269
29287
|
|
|
29270
29288
|
// dist/vault/upgrade.js
|
|
29271
|
-
import
|
|
29289
|
+
import path12 from "node:path";
|
|
29272
29290
|
import os4 from "node:os";
|
|
29273
29291
|
|
|
29274
29292
|
// dist/vault/copy-bundled-skills.js
|
|
29275
|
-
import
|
|
29293
|
+
import path11 from "node:path";
|
|
29276
29294
|
function resolveBundledAssetsRoot() {
|
|
29277
|
-
const distAssets =
|
|
29278
|
-
const srcAssets =
|
|
29279
|
-
const devAssets =
|
|
29295
|
+
const distAssets = path11.resolve(import.meta.dirname, "assets");
|
|
29296
|
+
const srcAssets = path11.resolve(import.meta.dirname, "..", "assets");
|
|
29297
|
+
const devAssets = path11.resolve(import.meta.dirname, "..", "..", "src", "assets");
|
|
29280
29298
|
if (fs.existsSync(distAssets))
|
|
29281
29299
|
return distAssets;
|
|
29282
29300
|
if (fs.existsSync(srcAssets))
|
|
@@ -29286,9 +29304,9 @@ function resolveBundledAssetsRoot() {
|
|
|
29286
29304
|
return distAssets;
|
|
29287
29305
|
}
|
|
29288
29306
|
function resolveBundledByoaoSkillsRoot() {
|
|
29289
|
-
const distSkills =
|
|
29290
|
-
const srcSkills =
|
|
29291
|
-
const devSkills =
|
|
29307
|
+
const distSkills = path11.resolve(import.meta.dirname, "assets", "skills");
|
|
29308
|
+
const srcSkills = path11.resolve(import.meta.dirname, "..", "skills");
|
|
29309
|
+
const devSkills = path11.resolve(import.meta.dirname, "..", "..", "src", "skills");
|
|
29292
29310
|
if (fs.existsSync(distSkills))
|
|
29293
29311
|
return distSkills;
|
|
29294
29312
|
if (fs.existsSync(srcSkills))
|
|
@@ -29305,15 +29323,15 @@ async function copyBundledSkillsToOpenCodeSkillsDir(targetSkillsRoot, options2)
|
|
|
29305
29323
|
let obsidianSkills = 0;
|
|
29306
29324
|
let byoaoSkills = 0;
|
|
29307
29325
|
if (includeObsidian) {
|
|
29308
|
-
const obsidianSrc =
|
|
29326
|
+
const obsidianSrc = path11.join(assetsRoot, "obsidian-skills");
|
|
29309
29327
|
if (fs.existsSync(obsidianSrc)) {
|
|
29310
29328
|
for (const file2 of fs.readdirSync(obsidianSrc)) {
|
|
29311
29329
|
if (!file2.endsWith(".md"))
|
|
29312
29330
|
continue;
|
|
29313
29331
|
const skillName = file2.replace(/\.md$/, "");
|
|
29314
|
-
const destDir =
|
|
29332
|
+
const destDir = path11.join(targetSkillsRoot, skillName);
|
|
29315
29333
|
await fs.ensureDir(destDir);
|
|
29316
|
-
await fs.copy(
|
|
29334
|
+
await fs.copy(path11.join(obsidianSrc, file2), path11.join(destDir, "SKILL.md"), { overwrite: true });
|
|
29317
29335
|
obsidianSkills++;
|
|
29318
29336
|
}
|
|
29319
29337
|
}
|
|
@@ -29323,11 +29341,11 @@ async function copyBundledSkillsToOpenCodeSkillsDir(targetSkillsRoot, options2)
|
|
|
29323
29341
|
for (const entry of entries) {
|
|
29324
29342
|
if (!entry.isDirectory())
|
|
29325
29343
|
continue;
|
|
29326
|
-
const srcSkill =
|
|
29344
|
+
const srcSkill = path11.join(byoaoSkillsRoot, entry.name, "SKILL.md");
|
|
29327
29345
|
if (await fs.pathExists(srcSkill)) {
|
|
29328
|
-
const destDir =
|
|
29346
|
+
const destDir = path11.join(targetSkillsRoot, entry.name);
|
|
29329
29347
|
await fs.ensureDir(destDir);
|
|
29330
|
-
await fs.copy(srcSkill,
|
|
29348
|
+
await fs.copy(srcSkill, path11.join(destDir, "SKILL.md"), { overwrite: true });
|
|
29331
29349
|
byoaoSkills++;
|
|
29332
29350
|
}
|
|
29333
29351
|
}
|
|
@@ -29343,7 +29361,7 @@ async function scanInstalledAssets(vaultPath) {
|
|
|
29343
29361
|
const templates = await scanDir(vaultPath, "Knowledge/templates", ".md");
|
|
29344
29362
|
const obsidianConfig = [];
|
|
29345
29363
|
for (const file2 of OBSIDIAN_CONFIG_FILES) {
|
|
29346
|
-
const abs =
|
|
29364
|
+
const abs = path12.join(vaultPath, ".obsidian", file2);
|
|
29347
29365
|
if (await fs.pathExists(abs)) {
|
|
29348
29366
|
obsidianConfig.push(`.obsidian/${file2}`);
|
|
29349
29367
|
}
|
|
@@ -29351,21 +29369,21 @@ async function scanInstalledAssets(vaultPath) {
|
|
|
29351
29369
|
return { skills, commands, obsidianConfig, templates };
|
|
29352
29370
|
}
|
|
29353
29371
|
async function scanDir(vaultPath, relDir, ext) {
|
|
29354
|
-
const absDir =
|
|
29372
|
+
const absDir = path12.join(vaultPath, relDir);
|
|
29355
29373
|
if (!await fs.pathExists(absDir))
|
|
29356
29374
|
return [];
|
|
29357
29375
|
const files = await fs.readdir(absDir);
|
|
29358
29376
|
return files.filter((f) => f.endsWith(ext)).map((f) => `${relDir}/${f}`);
|
|
29359
29377
|
}
|
|
29360
29378
|
async function scanSkillDirs(vaultPath) {
|
|
29361
|
-
const skillsRoot =
|
|
29379
|
+
const skillsRoot = path12.join(vaultPath, ".opencode", "skills");
|
|
29362
29380
|
if (!await fs.pathExists(skillsRoot))
|
|
29363
29381
|
return [];
|
|
29364
29382
|
const results = [];
|
|
29365
29383
|
const entries = await fs.readdir(skillsRoot, { withFileTypes: true });
|
|
29366
29384
|
for (const entry of entries) {
|
|
29367
29385
|
if (entry.isDirectory()) {
|
|
29368
|
-
const skillMd =
|
|
29386
|
+
const skillMd = path12.join(skillsRoot, entry.name, "SKILL.md");
|
|
29369
29387
|
if (await fs.pathExists(skillMd)) {
|
|
29370
29388
|
results.push(`.opencode/skills/${entry.name}/SKILL.md`);
|
|
29371
29389
|
}
|
|
@@ -29394,7 +29412,7 @@ function buildUpgradePlan(vaultPath, manifest, packageAssets) {
|
|
|
29394
29412
|
const installed = new Set(manifest.infrastructure[key]);
|
|
29395
29413
|
const shippedPaths = new Set(shipped.map((s) => s.relativePath));
|
|
29396
29414
|
for (const entry of shipped) {
|
|
29397
|
-
const onDisk = fs.existsSync(
|
|
29415
|
+
const onDisk = fs.existsSync(path12.join(vaultPath, entry.relativePath));
|
|
29398
29416
|
items.push({
|
|
29399
29417
|
file: entry.relativePath,
|
|
29400
29418
|
action: onDisk ? "update" : "add",
|
|
@@ -29425,20 +29443,20 @@ Entries are appended here during /cook operations.
|
|
|
29425
29443
|
`;
|
|
29426
29444
|
async function migrateV1ToV2Infrastructure(vaultPath) {
|
|
29427
29445
|
for (const dir of LLM_WIKI_AGENT_DIRS) {
|
|
29428
|
-
const dirPath =
|
|
29446
|
+
const dirPath = path12.join(vaultPath, dir);
|
|
29429
29447
|
if (!await fs.pathExists(dirPath)) {
|
|
29430
29448
|
await fs.ensureDir(dirPath);
|
|
29431
29449
|
}
|
|
29432
29450
|
}
|
|
29433
|
-
const schemaPath =
|
|
29451
|
+
const schemaPath = path12.join(vaultPath, "SCHEMA.md");
|
|
29434
29452
|
if (!await fs.pathExists(schemaPath)) {
|
|
29435
|
-
const
|
|
29436
|
-
const schemaTemplatePath =
|
|
29453
|
+
const commonDir2 = getCommonDir();
|
|
29454
|
+
const schemaTemplatePath = path12.join(commonDir2, "SCHEMA.md.hbs");
|
|
29437
29455
|
let content;
|
|
29438
29456
|
if (await fs.pathExists(schemaTemplatePath)) {
|
|
29439
29457
|
const schemaTemplate = await fs.readFile(schemaTemplatePath, "utf-8");
|
|
29440
29458
|
content = renderTemplate(schemaTemplate, {
|
|
29441
|
-
KB_NAME:
|
|
29459
|
+
KB_NAME: path12.basename(vaultPath),
|
|
29442
29460
|
WIKI_DOMAIN: ""
|
|
29443
29461
|
});
|
|
29444
29462
|
} else {
|
|
@@ -29450,10 +29468,12 @@ This file describes the vault knowledge schema. Update it as your model evolves.
|
|
|
29450
29468
|
}
|
|
29451
29469
|
await fs.writeFile(schemaPath, content, "utf-8");
|
|
29452
29470
|
}
|
|
29453
|
-
const logPath =
|
|
29471
|
+
const logPath = path12.join(vaultPath, "log.md");
|
|
29454
29472
|
if (!await fs.pathExists(logPath)) {
|
|
29455
29473
|
await fs.writeFile(logPath, LOG_MD_PLACEHOLDER, "utf-8");
|
|
29456
29474
|
}
|
|
29475
|
+
const commonDir = getCommonDir();
|
|
29476
|
+
await copyIndexBaseExampleIfMissing(vaultPath, commonDir);
|
|
29457
29477
|
}
|
|
29458
29478
|
var BYOAO_SKILL_NAMES = [
|
|
29459
29479
|
"ask",
|
|
@@ -29470,16 +29490,16 @@ var BYOAO_SKILL_NAMES = [
|
|
|
29470
29490
|
"wiki"
|
|
29471
29491
|
];
|
|
29472
29492
|
async function migrateCommandsToSkills(vaultPath) {
|
|
29473
|
-
const commandsDir =
|
|
29493
|
+
const commandsDir = path12.join(vaultPath, ".opencode", "commands");
|
|
29474
29494
|
if (!await fs.pathExists(commandsDir))
|
|
29475
29495
|
return;
|
|
29476
|
-
const skillsDir =
|
|
29496
|
+
const skillsDir = path12.join(vaultPath, ".opencode", "skills");
|
|
29477
29497
|
for (const name of BYOAO_SKILL_NAMES) {
|
|
29478
|
-
const src =
|
|
29498
|
+
const src = path12.join(commandsDir, `${name}.md`);
|
|
29479
29499
|
if (!await fs.pathExists(src))
|
|
29480
29500
|
continue;
|
|
29481
|
-
const destDir =
|
|
29482
|
-
const dest =
|
|
29501
|
+
const destDir = path12.join(skillsDir, name);
|
|
29502
|
+
const dest = path12.join(destDir, "SKILL.md");
|
|
29483
29503
|
if (await fs.pathExists(dest)) {
|
|
29484
29504
|
await fs.remove(src);
|
|
29485
29505
|
continue;
|
|
@@ -29494,7 +29514,7 @@ async function migrateCommandsToSkills(vaultPath) {
|
|
|
29494
29514
|
}
|
|
29495
29515
|
async function collectV1DeprecatedInfrastructureItems(vaultPath) {
|
|
29496
29516
|
const items = [];
|
|
29497
|
-
const templatesDir =
|
|
29517
|
+
const templatesDir = path12.join(vaultPath, "Knowledge", "templates");
|
|
29498
29518
|
if (await fs.pathExists(templatesDir)) {
|
|
29499
29519
|
const files = await fs.readdir(templatesDir);
|
|
29500
29520
|
for (const f of files) {
|
|
@@ -29509,7 +29529,7 @@ async function collectV1DeprecatedInfrastructureItems(vaultPath) {
|
|
|
29509
29529
|
}
|
|
29510
29530
|
for (const cmd of ["weave.md", "emerge.md"]) {
|
|
29511
29531
|
const rel = `.opencode/commands/${cmd}`;
|
|
29512
|
-
if (await fs.pathExists(
|
|
29532
|
+
if (await fs.pathExists(path12.join(vaultPath, rel))) {
|
|
29513
29533
|
items.push({
|
|
29514
29534
|
file: rel,
|
|
29515
29535
|
action: "deprecated",
|
|
@@ -29529,9 +29549,9 @@ function mergeForcedDeprecatedIntoPlan(items, forced) {
|
|
|
29529
29549
|
return [...byFile.values()];
|
|
29530
29550
|
}
|
|
29531
29551
|
function resolveAssetsDir2() {
|
|
29532
|
-
const distAssets =
|
|
29533
|
-
const srcAssets =
|
|
29534
|
-
const devAssets =
|
|
29552
|
+
const distAssets = path12.resolve(import.meta.dirname, "assets");
|
|
29553
|
+
const srcAssets = path12.resolve(import.meta.dirname, "..", "assets");
|
|
29554
|
+
const devAssets = path12.resolve(import.meta.dirname, "..", "..", "src", "assets");
|
|
29535
29555
|
if (fs.existsSync(distAssets))
|
|
29536
29556
|
return distAssets;
|
|
29537
29557
|
if (fs.existsSync(srcAssets))
|
|
@@ -29541,9 +29561,9 @@ function resolveAssetsDir2() {
|
|
|
29541
29561
|
return distAssets;
|
|
29542
29562
|
}
|
|
29543
29563
|
function resolveSkillsDir() {
|
|
29544
|
-
const distSkills =
|
|
29545
|
-
const srcSkills =
|
|
29546
|
-
const devSkills =
|
|
29564
|
+
const distSkills = path12.resolve(import.meta.dirname, "assets", "skills");
|
|
29565
|
+
const srcSkills = path12.resolve(import.meta.dirname, "..", "skills");
|
|
29566
|
+
const devSkills = path12.resolve(import.meta.dirname, "..", "..", "src", "skills");
|
|
29547
29567
|
if (fs.existsSync(distSkills))
|
|
29548
29568
|
return distSkills;
|
|
29549
29569
|
if (fs.existsSync(srcSkills))
|
|
@@ -29560,14 +29580,14 @@ function resolvePackageAssets(preset) {
|
|
|
29560
29580
|
const commands = [];
|
|
29561
29581
|
const obsidianConfig = [];
|
|
29562
29582
|
const templates = [];
|
|
29563
|
-
const obsidianSkillsDir =
|
|
29583
|
+
const obsidianSkillsDir = path12.join(assetsDir, "obsidian-skills");
|
|
29564
29584
|
if (fs.existsSync(obsidianSkillsDir)) {
|
|
29565
29585
|
for (const file2 of fs.readdirSync(obsidianSkillsDir)) {
|
|
29566
29586
|
if (file2.endsWith(".md")) {
|
|
29567
29587
|
const skillName = file2.replace(/\.md$/, "");
|
|
29568
29588
|
skills.push({
|
|
29569
29589
|
relativePath: `.opencode/skills/${skillName}/SKILL.md`,
|
|
29570
|
-
sourcePath:
|
|
29590
|
+
sourcePath: path12.join(obsidianSkillsDir, file2)
|
|
29571
29591
|
});
|
|
29572
29592
|
}
|
|
29573
29593
|
}
|
|
@@ -29575,7 +29595,7 @@ function resolvePackageAssets(preset) {
|
|
|
29575
29595
|
if (fs.existsSync(skillsDir)) {
|
|
29576
29596
|
for (const entry of fs.readdirSync(skillsDir, { withFileTypes: true })) {
|
|
29577
29597
|
if (entry.isDirectory()) {
|
|
29578
|
-
const skillMd =
|
|
29598
|
+
const skillMd = path12.join(skillsDir, entry.name, "SKILL.md");
|
|
29579
29599
|
if (fs.existsSync(skillMd)) {
|
|
29580
29600
|
skills.push({
|
|
29581
29601
|
relativePath: `.opencode/skills/${entry.name}/SKILL.md`,
|
|
@@ -29585,10 +29605,10 @@ function resolvePackageAssets(preset) {
|
|
|
29585
29605
|
}
|
|
29586
29606
|
}
|
|
29587
29607
|
}
|
|
29588
|
-
const obsidianSrcDir =
|
|
29608
|
+
const obsidianSrcDir = path12.join(commonDir, "obsidian");
|
|
29589
29609
|
if (fs.existsSync(obsidianSrcDir)) {
|
|
29590
29610
|
for (const file2 of OBSIDIAN_CONFIG_FILES) {
|
|
29591
|
-
const srcPath =
|
|
29611
|
+
const srcPath = path12.join(obsidianSrcDir, file2);
|
|
29592
29612
|
if (fs.existsSync(srcPath)) {
|
|
29593
29613
|
obsidianConfig.push({
|
|
29594
29614
|
relativePath: `.obsidian/${file2}`,
|
|
@@ -29597,26 +29617,26 @@ function resolvePackageAssets(preset) {
|
|
|
29597
29617
|
}
|
|
29598
29618
|
}
|
|
29599
29619
|
}
|
|
29600
|
-
const commonTemplatesDir =
|
|
29620
|
+
const commonTemplatesDir = path12.join(commonDir, "templates");
|
|
29601
29621
|
if (fs.existsSync(commonTemplatesDir)) {
|
|
29602
29622
|
for (const file2 of fs.readdirSync(commonTemplatesDir)) {
|
|
29603
29623
|
if (file2.endsWith(".md")) {
|
|
29604
29624
|
templates.push({
|
|
29605
29625
|
relativePath: `Knowledge/templates/${file2}`,
|
|
29606
|
-
sourcePath:
|
|
29626
|
+
sourcePath: path12.join(commonTemplatesDir, file2)
|
|
29607
29627
|
});
|
|
29608
29628
|
}
|
|
29609
29629
|
}
|
|
29610
29630
|
}
|
|
29611
29631
|
try {
|
|
29612
29632
|
const { presetsDir } = loadPreset(preset);
|
|
29613
|
-
const presetTemplatesDir =
|
|
29633
|
+
const presetTemplatesDir = path12.join(presetsDir, preset, "templates");
|
|
29614
29634
|
if (fs.existsSync(presetTemplatesDir)) {
|
|
29615
29635
|
for (const file2 of fs.readdirSync(presetTemplatesDir)) {
|
|
29616
29636
|
if (file2.endsWith(".md")) {
|
|
29617
29637
|
templates.push({
|
|
29618
29638
|
relativePath: `Knowledge/templates/${file2}`,
|
|
29619
|
-
sourcePath:
|
|
29639
|
+
sourcePath: path12.join(presetTemplatesDir, file2)
|
|
29620
29640
|
});
|
|
29621
29641
|
}
|
|
29622
29642
|
}
|
|
@@ -29641,7 +29661,7 @@ async function upgradeVault(vaultPath, options2) {
|
|
|
29641
29661
|
let globalOpenCodeSkillsEarly;
|
|
29642
29662
|
let globalOpenCodeSkillsErrorEarly;
|
|
29643
29663
|
if (!dryRun && !skipGlobalSkillsSync) {
|
|
29644
|
-
const globalSkillsRoot =
|
|
29664
|
+
const globalSkillsRoot = path12.join(os4.homedir(), ".config", "opencode", "skills");
|
|
29645
29665
|
if (await fs.pathExists(globalSkillsRoot)) {
|
|
29646
29666
|
try {
|
|
29647
29667
|
globalOpenCodeSkillsEarly = await copyBundledSkillsToOpenCodeSkillsDir(globalSkillsRoot, {
|
|
@@ -29664,8 +29684,8 @@ async function upgradeVault(vaultPath, options2) {
|
|
|
29664
29684
|
globalOpenCodeSkillsError: globalOpenCodeSkillsErrorEarly
|
|
29665
29685
|
};
|
|
29666
29686
|
}
|
|
29667
|
-
const legacyAgentMd =
|
|
29668
|
-
const newAgentsMd =
|
|
29687
|
+
const legacyAgentMd = path12.join(vaultPath, "AGENT.md");
|
|
29688
|
+
const newAgentsMd = path12.join(vaultPath, "AGENTS.md");
|
|
29669
29689
|
if (!dryRun && await fs.pathExists(legacyAgentMd) && !await fs.pathExists(newAgentsMd)) {
|
|
29670
29690
|
await fs.rename(legacyAgentMd, newAgentsMd);
|
|
29671
29691
|
}
|
|
@@ -29700,8 +29720,8 @@ async function upgradeVault(vaultPath, options2) {
|
|
|
29700
29720
|
if (item.action === "add" || item.action === "update") {
|
|
29701
29721
|
const source = sourceMap.get(item.file);
|
|
29702
29722
|
if (source) {
|
|
29703
|
-
const dest =
|
|
29704
|
-
await fs.ensureDir(
|
|
29723
|
+
const dest = path12.join(vaultPath, item.file);
|
|
29724
|
+
await fs.ensureDir(path12.dirname(dest));
|
|
29705
29725
|
await fs.copy(source, dest, { overwrite: true });
|
|
29706
29726
|
if (item.action === "add") {
|
|
29707
29727
|
added.push(item.file);
|
|
@@ -29722,7 +29742,7 @@ async function upgradeVault(vaultPath, options2) {
|
|
|
29722
29742
|
const installedFiles = await scanInstalledAssets(vaultPath);
|
|
29723
29743
|
await writeManifest(vaultPath, effectivePreset, installedFiles);
|
|
29724
29744
|
if (!skipGlobalSkillsSync && errors.length === 0) {
|
|
29725
|
-
const globalSkillsRoot =
|
|
29745
|
+
const globalSkillsRoot = path12.join(os4.homedir(), ".config", "opencode", "skills");
|
|
29726
29746
|
if (await fs.pathExists(globalSkillsRoot)) {
|
|
29727
29747
|
try {
|
|
29728
29748
|
globalOpenCodeSkills = await copyBundledSkillsToOpenCodeSkillsDir(globalSkillsRoot, {
|
|
@@ -29811,11 +29831,11 @@ var byoao_vault_upgrade = tool({
|
|
|
29811
29831
|
|
|
29812
29832
|
// dist/tools/mcp-auth.js
|
|
29813
29833
|
import { spawn, execSync as execSync3 } from "node:child_process";
|
|
29814
|
-
import
|
|
29834
|
+
import path13 from "node:path";
|
|
29815
29835
|
import os5 from "node:os";
|
|
29816
29836
|
function findOpencodeBinary() {
|
|
29817
29837
|
const candidates = [
|
|
29818
|
-
|
|
29838
|
+
path13.join(os5.homedir(), ".opencode/bin/opencode"),
|
|
29819
29839
|
"/usr/local/bin/opencode"
|
|
29820
29840
|
];
|
|
29821
29841
|
for (const p of candidates) {
|
|
@@ -29919,7 +29939,7 @@ The user may need to:
|
|
|
29919
29939
|
});
|
|
29920
29940
|
|
|
29921
29941
|
// dist/hooks/system-transform.js
|
|
29922
|
-
import
|
|
29942
|
+
import path14 from "node:path";
|
|
29923
29943
|
|
|
29924
29944
|
// dist/lib/logger.js
|
|
29925
29945
|
import { join } from "node:path";
|
|
@@ -29999,7 +30019,7 @@ async function log(level, source, message, options2) {
|
|
|
29999
30019
|
|
|
30000
30020
|
// dist/hooks/system-transform.js
|
|
30001
30021
|
function readVaultMarkdown(vaultPath, fileName) {
|
|
30002
|
-
const full =
|
|
30022
|
+
const full = path14.join(vaultPath, fileName);
|
|
30003
30023
|
if (!fs.existsSync(full))
|
|
30004
30024
|
return null;
|
|
30005
30025
|
try {
|
|
@@ -30085,7 +30105,7 @@ function getIdleSuggestion() {
|
|
|
30085
30105
|
const suggestions = [
|
|
30086
30106
|
"Tip: run /cook to compile your notes into structured knowledge pages",
|
|
30087
30107
|
"Tip: run /health to check knowledge page health",
|
|
30088
|
-
"Tip: run /wiki to
|
|
30108
|
+
"Tip: run /wiki to refresh your INDEX.base knowledge map",
|
|
30089
30109
|
"Tip: run /trace to see how an idea evolved over time",
|
|
30090
30110
|
"Tip: run /connect to bridge two topics using your vault's link graph",
|
|
30091
30111
|
"Tip: run /ideas to generate actionable insights from your vault",
|