@kl-c/matrixos 0.2.8 → 0.2.10
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/cli/index.js +522 -386
- package/dist/cli/slash-command-installer.d.ts +4 -0
- package/dist/cli/slash-commands/adopt.md +11 -0
- package/dist/cli/slash-commands/features.md +12 -0
- package/dist/cli/slash-commands/matrix-gateway-adopt-telegram.md +10 -0
- package/dist/cli/slash-commands/matrix.md +10 -0
- package/dist/cli/slash-commands/readopt.md +8 -0
- package/dist/cli-node/index.js +522 -386
- package/dist/index.js +76 -53
- package/dist/plugin/auto-adoption.d.ts +5 -3
- package/package.json +3 -2
package/dist/cli-node/index.js
CHANGED
|
@@ -2163,7 +2163,7 @@ var package_default;
|
|
|
2163
2163
|
var init_package = __esm(() => {
|
|
2164
2164
|
package_default = {
|
|
2165
2165
|
name: "@kl-c/matrixos",
|
|
2166
|
-
version: "0.2.
|
|
2166
|
+
version: "0.2.10",
|
|
2167
2167
|
description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
|
|
2168
2168
|
main: "./dist/index.js",
|
|
2169
2169
|
types: "dist/index.d.ts",
|
|
@@ -2265,7 +2265,8 @@ var init_package = __esm(() => {
|
|
|
2265
2265
|
"typecheck:packages": "tsgo --noEmit -p packages/rules-engine/tsconfig.json && tsgo --noEmit -p packages/delegate-core/tsconfig.json && tsgo --noEmit -p packages/mcp-stdio-core/tsconfig.json && tsgo --noEmit -p packages/mcp-client-core/tsconfig.json && tsgo --noEmit -p packages/git-bash-mcp/tsconfig.json && tsgo --noEmit -p packages/lsp-core/tsconfig.json && tsgo --noEmit -p packages/utils/tsconfig.json && tsgo --noEmit -p packages/model-core/tsconfig.json && tsgo --noEmit -p packages/omo-config-core/tsconfig.json && tsgo --noEmit -p packages/prompts-core/tsconfig.json && tsgo --noEmit -p packages/comment-checker-core/tsconfig.json && tsgo --noEmit -p packages/hashline-core/tsconfig.json && tsgo --noEmit -p packages/tmux-core/tsconfig.json && tsgo --noEmit -p packages/team-core/tsconfig.json && tsgo --noEmit -p packages/matrix-gateway-core/tsconfig.json && tsgo --noEmit -p packages/boulder-state/tsconfig.json && tsgo --noEmit -p packages/learning-loop/tsconfig.json && tsgo --noEmit -p packages/telemetry-core/tsconfig.json && tsgo --noEmit -p packages/claude-code-compat-core/tsconfig.json && tsgo --noEmit -p packages/skills-loader-core/tsconfig.json && tsgo --noEmit -p packages/agents-md-core/tsconfig.json && tsgo --noEmit -p packages/task-ledger-core/tsconfig.json && tsgo --noEmit -p packages/egress-core/tsconfig.json && tsgo --noEmit -p packages/http-server-core/tsconfig.json && tsgo --noEmit -p packages/webhook-core/tsconfig.json && tsgo --noEmit -p packages/daily-brief-core/tsconfig.json && tsgo --noEmit -p packages/omo-opencode/tsconfig.json",
|
|
2266
2266
|
"typecheck:script": "tsgo --noEmit -p script/tsconfig.json",
|
|
2267
2267
|
test: "bun test",
|
|
2268
|
-
"build:git-bash-mcp": "bun run --cwd packages/git-bash-mcp build"
|
|
2268
|
+
"build:git-bash-mcp": "bun run --cwd packages/git-bash-mcp build",
|
|
2269
|
+
"build:slash-commands": "rm -rf dist/cli/slash-commands && mkdir -p dist/cli/slash-commands && cp packages/omo-opencode/src/cli/slash-commands/*.md dist/cli/slash-commands/"
|
|
2269
2270
|
},
|
|
2270
2271
|
keywords: [
|
|
2271
2272
|
"opencode",
|
|
@@ -67737,6 +67738,132 @@ var init_add_tui_plugin_to_tui_config = __esm(() => {
|
|
|
67737
67738
|
init_write_file_atomically2();
|
|
67738
67739
|
});
|
|
67739
67740
|
|
|
67741
|
+
// packages/omo-opencode/src/cli/slash-command-installer.ts
|
|
67742
|
+
import {
|
|
67743
|
+
existsSync as existsSync26,
|
|
67744
|
+
mkdirSync as mkdirSync9,
|
|
67745
|
+
copyFileSync as copyFileSync3,
|
|
67746
|
+
symlinkSync,
|
|
67747
|
+
readlinkSync,
|
|
67748
|
+
readdirSync as readdirSync4,
|
|
67749
|
+
unlinkSync as unlinkSync5
|
|
67750
|
+
} from "fs";
|
|
67751
|
+
import { dirname as dirname9, join as join25 } from "path";
|
|
67752
|
+
import { homedir as homedir6 } from "os";
|
|
67753
|
+
function findSlashCommandSource() {
|
|
67754
|
+
const candidates = [
|
|
67755
|
+
join25(import.meta.dir, "slash-commands"),
|
|
67756
|
+
join25(import.meta.dir, "..", "slash-commands"),
|
|
67757
|
+
join25(import.meta.dir, "..", "..", "src", "cli", "slash-commands")
|
|
67758
|
+
];
|
|
67759
|
+
for (const c of candidates) {
|
|
67760
|
+
if (existsSync26(c) && existsSync26(join25(c, "adopt.md")))
|
|
67761
|
+
return c;
|
|
67762
|
+
}
|
|
67763
|
+
return null;
|
|
67764
|
+
}
|
|
67765
|
+
function copySlashCommandsTo(dir) {
|
|
67766
|
+
try {
|
|
67767
|
+
if (!existsSync26(dir))
|
|
67768
|
+
mkdirSync9(dir, { recursive: true });
|
|
67769
|
+
const srcDir = findSlashCommandSource();
|
|
67770
|
+
if (!srcDir)
|
|
67771
|
+
return 0;
|
|
67772
|
+
let copied = 0;
|
|
67773
|
+
for (const name2 of SLASH_COMMAND_NAMES) {
|
|
67774
|
+
const src = join25(srcDir, name2);
|
|
67775
|
+
if (!existsSync26(src))
|
|
67776
|
+
continue;
|
|
67777
|
+
copyFileSync3(src, join25(dir, name2));
|
|
67778
|
+
copied++;
|
|
67779
|
+
}
|
|
67780
|
+
return copied;
|
|
67781
|
+
} catch {
|
|
67782
|
+
return 0;
|
|
67783
|
+
}
|
|
67784
|
+
}
|
|
67785
|
+
function resolveMatrixosBin() {
|
|
67786
|
+
const candidates = [
|
|
67787
|
+
join25(import.meta.dir, "..", "..", "bin", "matrixos.js"),
|
|
67788
|
+
join25(import.meta.dir, "..", "bin", "matrixos.js")
|
|
67789
|
+
];
|
|
67790
|
+
for (const c of candidates) {
|
|
67791
|
+
if (existsSync26(c))
|
|
67792
|
+
return c;
|
|
67793
|
+
}
|
|
67794
|
+
return null;
|
|
67795
|
+
}
|
|
67796
|
+
function copyRecursive(from, to) {
|
|
67797
|
+
if (!existsSync26(to))
|
|
67798
|
+
mkdirSync9(to, { recursive: true });
|
|
67799
|
+
for (const entry of readdirSync4(from, { withFileTypes: true })) {
|
|
67800
|
+
const src = join25(from, entry.name);
|
|
67801
|
+
const dst = join25(to, entry.name);
|
|
67802
|
+
if (entry.isDirectory()) {
|
|
67803
|
+
copyRecursive(src, dst);
|
|
67804
|
+
} else {
|
|
67805
|
+
copyFileSync3(src, dst);
|
|
67806
|
+
}
|
|
67807
|
+
}
|
|
67808
|
+
}
|
|
67809
|
+
function installPackageTo(path7, bin) {
|
|
67810
|
+
const srcDir = dirname9(dirname9(bin));
|
|
67811
|
+
if (!existsSync26(srcDir))
|
|
67812
|
+
return null;
|
|
67813
|
+
try {
|
|
67814
|
+
copyRecursive(srcDir, path7);
|
|
67815
|
+
return join25(path7, "bin", "matrixos.js");
|
|
67816
|
+
} catch {
|
|
67817
|
+
return null;
|
|
67818
|
+
}
|
|
67819
|
+
}
|
|
67820
|
+
function installSlashCommandsAndPath() {
|
|
67821
|
+
const home = homedir6();
|
|
67822
|
+
const targets = [
|
|
67823
|
+
join25(home, ".config", "opencode", "commands"),
|
|
67824
|
+
join25(home, ".claude", "commands")
|
|
67825
|
+
];
|
|
67826
|
+
let total = 0;
|
|
67827
|
+
for (const t of targets)
|
|
67828
|
+
total += copySlashCommandsTo(t);
|
|
67829
|
+
let pathLinked = false;
|
|
67830
|
+
const liveBin = resolveMatrixosBin();
|
|
67831
|
+
const linkPath = "/usr/local/bin/matrixos";
|
|
67832
|
+
const persistentDir = "/usr/local/lib/matrixos";
|
|
67833
|
+
if (liveBin) {
|
|
67834
|
+
try {
|
|
67835
|
+
const target = installPackageTo(persistentDir, liveBin) ?? liveBin;
|
|
67836
|
+
if (existsSync26(linkPath)) {
|
|
67837
|
+
try {
|
|
67838
|
+
const cur = readlinkSync(linkPath);
|
|
67839
|
+
if (cur === target) {
|
|
67840
|
+
pathLinked = true;
|
|
67841
|
+
return { commands: total, pathLinked };
|
|
67842
|
+
}
|
|
67843
|
+
} catch {}
|
|
67844
|
+
try {
|
|
67845
|
+
unlinkSync5(linkPath);
|
|
67846
|
+
} catch {}
|
|
67847
|
+
}
|
|
67848
|
+
symlinkSync(target, linkPath);
|
|
67849
|
+
pathLinked = true;
|
|
67850
|
+
} catch {
|
|
67851
|
+
pathLinked = false;
|
|
67852
|
+
}
|
|
67853
|
+
}
|
|
67854
|
+
return { commands: total, pathLinked };
|
|
67855
|
+
}
|
|
67856
|
+
var SLASH_COMMAND_NAMES;
|
|
67857
|
+
var init_slash_command_installer = __esm(() => {
|
|
67858
|
+
SLASH_COMMAND_NAMES = [
|
|
67859
|
+
"adopt.md",
|
|
67860
|
+
"readopt.md",
|
|
67861
|
+
"matrix-gateway-adopt-telegram.md",
|
|
67862
|
+
"matrix.md",
|
|
67863
|
+
"features.md"
|
|
67864
|
+
];
|
|
67865
|
+
});
|
|
67866
|
+
|
|
67740
67867
|
// packages/shared-skills/index.mjs
|
|
67741
67868
|
import { fileURLToPath } from "url";
|
|
67742
67869
|
function sharedSkillsRootPath() {
|
|
@@ -67745,8 +67872,8 @@ function sharedSkillsRootPath() {
|
|
|
67745
67872
|
var init_shared_skills = () => {};
|
|
67746
67873
|
|
|
67747
67874
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
67748
|
-
import { homedir as
|
|
67749
|
-
import { join as
|
|
67875
|
+
import { homedir as homedir7 } from "os";
|
|
67876
|
+
import { join as join26 } from "path";
|
|
67750
67877
|
function describeResult(result) {
|
|
67751
67878
|
if (result.kind === "succeeded")
|
|
67752
67879
|
return null;
|
|
@@ -67756,9 +67883,9 @@ function describeResult(result) {
|
|
|
67756
67883
|
}
|
|
67757
67884
|
async function installAstGrepForOpenCode(options = {}) {
|
|
67758
67885
|
const platform = options.platform ?? process.platform;
|
|
67759
|
-
const baseDir =
|
|
67886
|
+
const baseDir = join26(options.homeDir ?? homedir7(), ".omo");
|
|
67760
67887
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
67761
|
-
const skillDir =
|
|
67888
|
+
const skillDir = join26(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
67762
67889
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
67763
67890
|
try {
|
|
67764
67891
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -67866,6 +67993,15 @@ async function runCliInstaller(args, version) {
|
|
|
67866
67993
|
if (config.hasOpenCode && !hasAnyConfiguredProvider(config)) {
|
|
67867
67994
|
printWarning(getNoModelProvidersWarning());
|
|
67868
67995
|
}
|
|
67996
|
+
try {
|
|
67997
|
+
const slash = installSlashCommandsAndPath();
|
|
67998
|
+
if (slash.commands > 0)
|
|
67999
|
+
printSuccess(`Slash commands installed (${slash.commands} files)`);
|
|
68000
|
+
if (slash.pathLinked)
|
|
68001
|
+
printSuccess("matrixos available on PATH (/usr/local/bin/matrixos)");
|
|
68002
|
+
} catch (error) {
|
|
68003
|
+
printWarning(`Slash-command setup skipped: ${error instanceof Error ? error.message : String(error)}`);
|
|
68004
|
+
}
|
|
67869
68005
|
console.log(`${SYMBOLS.star} ${import_picocolors3.default.bold(import_picocolors3.default.green(isUpdate ? "Configuration updated!" : "Installation complete!"))}`);
|
|
67870
68006
|
if (hasOpenCode) {
|
|
67871
68007
|
console.log(` Run ${import_picocolors3.default.cyan("opencode")} to start!`);
|
|
@@ -67927,6 +68063,7 @@ var init_cli_installer = __esm(() => {
|
|
|
67927
68063
|
init_star_request();
|
|
67928
68064
|
init_provider_availability();
|
|
67929
68065
|
init_add_tui_plugin_to_tui_config();
|
|
68066
|
+
init_slash_command_installer();
|
|
67930
68067
|
init_install_ast_grep_sg();
|
|
67931
68068
|
import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
67932
68069
|
});
|
|
@@ -69566,15 +69703,16 @@ var init_dist5 = __esm(() => {
|
|
|
69566
69703
|
});
|
|
69567
69704
|
|
|
69568
69705
|
// packages/omo-opencode/src/cli/config-manager/write-gateway-env.ts
|
|
69569
|
-
import {
|
|
69570
|
-
import {
|
|
69706
|
+
import { homedir as homedir8 } from "os";
|
|
69707
|
+
import { existsSync as existsSync27, mkdirSync as mkdirSync10, readFileSync as readFileSync15, writeFileSync as writeFileSync6, chmodSync as chmodSync3 } from "fs";
|
|
69708
|
+
import { join as join27 } from "path";
|
|
69571
69709
|
function writeGatewayEnvToken(key, token) {
|
|
69572
|
-
const configDir =
|
|
69573
|
-
if (!
|
|
69574
|
-
|
|
69575
|
-
const envPath =
|
|
69710
|
+
const configDir = homedir8();
|
|
69711
|
+
if (!existsSync27(configDir))
|
|
69712
|
+
mkdirSync10(configDir, { recursive: true });
|
|
69713
|
+
const envPath = join27(configDir, GATEWAY_ENV_FILENAME);
|
|
69576
69714
|
const entries = new Map;
|
|
69577
|
-
if (
|
|
69715
|
+
if (existsSync27(envPath)) {
|
|
69578
69716
|
const existing = readFileSync15(envPath, "utf-8");
|
|
69579
69717
|
for (const rawLine of existing.split(`
|
|
69580
69718
|
`)) {
|
|
@@ -69603,9 +69741,7 @@ function writeGatewayEnv(token) {
|
|
|
69603
69741
|
return writeGatewayEnvToken("TELEGRAM_BOT_TOKEN", token);
|
|
69604
69742
|
}
|
|
69605
69743
|
var GATEWAY_ENV_FILENAME = ".klc-gateway.env";
|
|
69606
|
-
var init_write_gateway_env =
|
|
69607
|
-
init_config_context();
|
|
69608
|
-
});
|
|
69744
|
+
var init_write_gateway_env = () => {};
|
|
69609
69745
|
|
|
69610
69746
|
// packages/omo-opencode/src/cli/senpi-platform-flag.ts
|
|
69611
69747
|
function isSenpiPlatformEnabled(env2 = process.env) {
|
|
@@ -102605,7 +102741,7 @@ var require_Util = __commonJS((exports, module2) => {
|
|
|
102605
102741
|
await client3.rest.patch(route, { body: updatedItems, reason });
|
|
102606
102742
|
return updatedItems;
|
|
102607
102743
|
}
|
|
102608
|
-
function
|
|
102744
|
+
function basename6(path7, ext) {
|
|
102609
102745
|
const res = parse7(path7);
|
|
102610
102746
|
return ext && res.ext.startsWith(ext) ? res.name : res.base.split("?")[0];
|
|
102611
102747
|
}
|
|
@@ -102728,7 +102864,7 @@ var require_Util = __commonJS((exports, module2) => {
|
|
|
102728
102864
|
resolveColor,
|
|
102729
102865
|
discordSort,
|
|
102730
102866
|
setPosition,
|
|
102731
|
-
basename:
|
|
102867
|
+
basename: basename6,
|
|
102732
102868
|
cleanContent,
|
|
102733
102869
|
cleanCodeBlockContent,
|
|
102734
102870
|
parseWebhookURL,
|
|
@@ -115549,7 +115685,7 @@ var require_MessagePayload = __commonJS((exports, module2) => {
|
|
|
115549
115685
|
var { DiscordjsError, DiscordjsRangeError, ErrorCodes } = require_errors();
|
|
115550
115686
|
var { resolveFile } = require_DataResolver();
|
|
115551
115687
|
var MessageFlagsBitField = require_MessageFlagsBitField();
|
|
115552
|
-
var { basename:
|
|
115688
|
+
var { basename: basename6, verifyString, resolvePartialEmoji } = require_Util();
|
|
115553
115689
|
var getBaseInteraction = lazy2(() => require_BaseInteraction());
|
|
115554
115690
|
|
|
115555
115691
|
class MessagePayload {
|
|
@@ -115734,10 +115870,10 @@ var require_MessagePayload = __commonJS((exports, module2) => {
|
|
|
115734
115870
|
let name2;
|
|
115735
115871
|
const findName = (thing) => {
|
|
115736
115872
|
if (typeof thing === "string") {
|
|
115737
|
-
return
|
|
115873
|
+
return basename6(thing);
|
|
115738
115874
|
}
|
|
115739
115875
|
if (thing.path) {
|
|
115740
|
-
return
|
|
115876
|
+
return basename6(thing.path);
|
|
115741
115877
|
}
|
|
115742
115878
|
return "file.jpg";
|
|
115743
115879
|
};
|
|
@@ -121268,7 +121404,7 @@ var require_dist9 = __commonJS((exports, module2) => {
|
|
|
121268
121404
|
var import_node_worker_threads2 = __require("worker_threads");
|
|
121269
121405
|
var import_collection2 = require_dist2();
|
|
121270
121406
|
var import_node_events = __require("events");
|
|
121271
|
-
var
|
|
121407
|
+
var import_node_path25 = __require("path");
|
|
121272
121408
|
var import_node_worker_threads = __require("worker_threads");
|
|
121273
121409
|
var import_collection = require_dist2();
|
|
121274
121410
|
var WorkerSendPayloadOp = /* @__PURE__ */ ((WorkerSendPayloadOp2) => {
|
|
@@ -121403,18 +121539,18 @@ var require_dist9 = __commonJS((exports, module2) => {
|
|
|
121403
121539
|
resolveWorkerPath() {
|
|
121404
121540
|
const path7 = this.options.workerPath;
|
|
121405
121541
|
if (!path7) {
|
|
121406
|
-
return (0,
|
|
121542
|
+
return (0, import_node_path25.join)(__dirname, "defaultWorker.js");
|
|
121407
121543
|
}
|
|
121408
|
-
if ((0,
|
|
121544
|
+
if ((0, import_node_path25.isAbsolute)(path7)) {
|
|
121409
121545
|
return path7;
|
|
121410
121546
|
}
|
|
121411
121547
|
if (/^\.\.?[/\\]/.test(path7)) {
|
|
121412
|
-
return (0,
|
|
121548
|
+
return (0, import_node_path25.resolve)(path7);
|
|
121413
121549
|
}
|
|
121414
121550
|
try {
|
|
121415
121551
|
return __require.resolve(path7);
|
|
121416
121552
|
} catch {
|
|
121417
|
-
return (0,
|
|
121553
|
+
return (0, import_node_path25.resolve)(path7);
|
|
121418
121554
|
}
|
|
121419
121555
|
}
|
|
121420
121556
|
async waitForWorkerReady(worker) {
|
|
@@ -128115,7 +128251,7 @@ var require_EmbedBuilder = __commonJS((exports, module2) => {
|
|
|
128115
128251
|
|
|
128116
128252
|
// node_modules/.bun/discord.js@14.27.0/node_modules/discord.js/src/structures/AttachmentBuilder.js
|
|
128117
128253
|
var require_AttachmentBuilder = __commonJS((exports, module2) => {
|
|
128118
|
-
var { basename:
|
|
128254
|
+
var { basename: basename6, flatten } = require_Util();
|
|
128119
128255
|
|
|
128120
128256
|
class AttachmentBuilder {
|
|
128121
128257
|
constructor(attachment, data = {}) {
|
|
@@ -128163,7 +128299,7 @@ var require_AttachmentBuilder = __commonJS((exports, module2) => {
|
|
|
128163
128299
|
return this;
|
|
128164
128300
|
}
|
|
128165
128301
|
get spoiler() {
|
|
128166
|
-
return
|
|
128302
|
+
return basename6(this.name).startsWith("SPOILER_");
|
|
128167
128303
|
}
|
|
128168
128304
|
toJSON() {
|
|
128169
128305
|
return flatten(this);
|
|
@@ -128931,8 +129067,8 @@ var init_writer2 = __esm(() => {
|
|
|
128931
129067
|
});
|
|
128932
129068
|
|
|
128933
129069
|
// packages/omo-config-core/src/generator/mini-os-generator.ts
|
|
128934
|
-
import { existsSync as
|
|
128935
|
-
import { dirname as
|
|
129070
|
+
import { existsSync as existsSync29, mkdirSync as mkdirSync11, writeFileSync as writeFileSync8 } from "fs";
|
|
129071
|
+
import { dirname as dirname10, join as join28 } from "path";
|
|
128936
129072
|
function generateMiniOS(options) {
|
|
128937
129073
|
const fs6 = options.fs ?? defaultFS;
|
|
128938
129074
|
const profile2 = options.profile;
|
|
@@ -128943,29 +129079,29 @@ function generateMiniOS(options) {
|
|
|
128943
129079
|
if (!fs6.existsSync(targetDir)) {
|
|
128944
129080
|
fs6.mkdirSync(targetDir, { recursive: true });
|
|
128945
129081
|
}
|
|
128946
|
-
const pkgPath =
|
|
129082
|
+
const pkgPath = join28(targetDir, "package.json");
|
|
128947
129083
|
writeIfMissing(fs6, pkgPath, TPL_PACKAGE_JSON(packageName, displayName, profile2.version, profile2.description, profile2.extends, profile2.baseAgent));
|
|
128948
129084
|
filesWritten.push(pkgPath);
|
|
128949
|
-
const srcDir =
|
|
129085
|
+
const srcDir = join28(targetDir, "src");
|
|
128950
129086
|
fs6.mkdirSync(srcDir, { recursive: true });
|
|
128951
|
-
const indexPath =
|
|
129087
|
+
const indexPath = join28(srcDir, "index.ts");
|
|
128952
129088
|
writeIfMissing(fs6, indexPath, TPL_INDEX_TS(profile2.name, displayName, profile2.description));
|
|
128953
129089
|
filesWritten.push(indexPath);
|
|
128954
|
-
const binDir =
|
|
129090
|
+
const binDir = join28(targetDir, "bin");
|
|
128955
129091
|
fs6.mkdirSync(binDir, { recursive: true });
|
|
128956
|
-
const binPath =
|
|
129092
|
+
const binPath = join28(binDir, "matrixos-mini.js");
|
|
128957
129093
|
writeIfMissing(fs6, binPath, TPL_BIN);
|
|
128958
129094
|
filesWritten.push(binPath);
|
|
128959
|
-
const scriptDir =
|
|
129095
|
+
const scriptDir = join28(targetDir, "script");
|
|
128960
129096
|
fs6.mkdirSync(scriptDir, { recursive: true });
|
|
128961
|
-
const buildPath =
|
|
129097
|
+
const buildPath = join28(scriptDir, "build.ts");
|
|
128962
129098
|
writeIfMissing(fs6, buildPath, TPL_BUILD_TS);
|
|
128963
129099
|
filesWritten.push(buildPath);
|
|
128964
129100
|
if (Object.keys(profile2.agents).length > 0) {
|
|
128965
|
-
const agentsDir =
|
|
129101
|
+
const agentsDir = join28(targetDir, "agents");
|
|
128966
129102
|
fs6.mkdirSync(agentsDir, { recursive: true });
|
|
128967
129103
|
for (const [agentName, agentDef] of Object.entries(profile2.agents)) {
|
|
128968
|
-
const agentFile =
|
|
129104
|
+
const agentFile = join28(agentsDir, `${agentName}.ts`);
|
|
128969
129105
|
const description = agentDef.description ?? `Custom ${displayName} agent: ${agentName}`;
|
|
128970
129106
|
writeIfMissing(fs6, agentFile, `// ${description}
|
|
128971
129107
|
// Generated by MaTrixOS Mini-OS Profile Generator.
|
|
@@ -128976,10 +129112,10 @@ export const description = ${JSON.stringify(description)}
|
|
|
128976
129112
|
}
|
|
128977
129113
|
}
|
|
128978
129114
|
if (profile2.skills.length > 0) {
|
|
128979
|
-
const skillsDir =
|
|
129115
|
+
const skillsDir = join28(targetDir, "skills");
|
|
128980
129116
|
fs6.mkdirSync(skillsDir, { recursive: true });
|
|
128981
129117
|
for (const skill of profile2.skills) {
|
|
128982
|
-
const skillFile =
|
|
129118
|
+
const skillFile = join28(skillsDir, `${skill}.md`);
|
|
128983
129119
|
writeIfMissing(fs6, skillFile, `# ${skill}
|
|
128984
129120
|
|
|
128985
129121
|
_Skill required by the ${displayName} profile. Implementation goes here._
|
|
@@ -128987,12 +129123,12 @@ _Skill required by the ${displayName} profile. Implementation goes here._
|
|
|
128987
129123
|
filesWritten.push(skillFile);
|
|
128988
129124
|
}
|
|
128989
129125
|
}
|
|
128990
|
-
const readmePath =
|
|
129126
|
+
const readmePath = join28(targetDir, "README.md");
|
|
128991
129127
|
const agentsList = Object.keys(profile2.agents);
|
|
128992
129128
|
const skillsList = profile2.skills;
|
|
128993
129129
|
writeIfMissing(fs6, readmePath, TPL_README(packageName, displayName, profile2.description, profile2.version, profile2.baseAgent, profile2.extends, agentsList, skillsList));
|
|
128994
129130
|
filesWritten.push(readmePath);
|
|
128995
|
-
const agentsMdPath =
|
|
129131
|
+
const agentsMdPath = join28(targetDir, "AGENTS.md");
|
|
128996
129132
|
writeIfMissing(fs6, agentsMdPath, TPL_AGENT_MD(displayName, profile2.description));
|
|
128997
129133
|
filesWritten.push(agentsMdPath);
|
|
128998
129134
|
return { packageName, packageDir: targetDir, filesWritten };
|
|
@@ -129000,7 +129136,7 @@ _Skill required by the ${displayName} profile. Implementation goes here._
|
|
|
129000
129136
|
function writeIfMissing(fs6, path7, content) {
|
|
129001
129137
|
if (fs6.existsSync(path7))
|
|
129002
129138
|
return;
|
|
129003
|
-
const dir =
|
|
129139
|
+
const dir = dirname10(path7);
|
|
129004
129140
|
if (!fs6.existsSync(dir)) {
|
|
129005
129141
|
fs6.mkdirSync(dir, { recursive: true });
|
|
129006
129142
|
}
|
|
@@ -129144,7 +129280,7 @@ This profile is activated when the user mentions the profile name in their reque
|
|
|
129144
129280
|
- Profiles can be composed: multiple profiles in \`profiles: [...]\` are merged in order.
|
|
129145
129281
|
`;
|
|
129146
129282
|
var init_mini_os_generator = __esm(() => {
|
|
129147
|
-
defaultFS = { existsSync:
|
|
129283
|
+
defaultFS = { existsSync: existsSync29, mkdirSync: mkdirSync11, writeFileSync: writeFileSync8 };
|
|
129148
129284
|
});
|
|
129149
129285
|
|
|
129150
129286
|
// packages/omo-config-core/src/generator/index.ts
|
|
@@ -129853,20 +129989,20 @@ var init_update_toasts = __esm(() => {
|
|
|
129853
129989
|
});
|
|
129854
129990
|
|
|
129855
129991
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
129856
|
-
import { existsSync as
|
|
129857
|
-
import { dirname as
|
|
129992
|
+
import { existsSync as existsSync45 } from "fs";
|
|
129993
|
+
import { dirname as dirname18, join as join40 } from "path";
|
|
129858
129994
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
129859
129995
|
function defaultGetModuleHostingWorkspace() {
|
|
129860
129996
|
try {
|
|
129861
|
-
const currentDir =
|
|
129997
|
+
const currentDir = dirname18(fileURLToPath4(import.meta.url));
|
|
129862
129998
|
const pkgJsonPath = findPackageJsonUp(currentDir);
|
|
129863
129999
|
if (!pkgJsonPath)
|
|
129864
130000
|
return null;
|
|
129865
|
-
const pkgDir =
|
|
129866
|
-
const nodeModulesDir =
|
|
130001
|
+
const pkgDir = dirname18(pkgJsonPath);
|
|
130002
|
+
const nodeModulesDir = dirname18(pkgDir);
|
|
129867
130003
|
if (nodeModulesDir.split(/[\\/]/).pop() !== "node_modules")
|
|
129868
130004
|
return null;
|
|
129869
|
-
return
|
|
130005
|
+
return dirname18(nodeModulesDir);
|
|
129870
130006
|
} catch (error51) {
|
|
129871
130007
|
if (error51 instanceof Error) {
|
|
129872
130008
|
return null;
|
|
@@ -130007,8 +130143,8 @@ var init_background_update_check = __esm(() => {
|
|
|
130007
130143
|
init_package_json_locator();
|
|
130008
130144
|
init_update_toasts();
|
|
130009
130145
|
defaultDeps4 = {
|
|
130010
|
-
existsSync:
|
|
130011
|
-
join:
|
|
130146
|
+
existsSync: existsSync45,
|
|
130147
|
+
join: join40,
|
|
130012
130148
|
runBunInstallWithDetails,
|
|
130013
130149
|
log: log2,
|
|
130014
130150
|
getOpenCodeCacheDir,
|
|
@@ -154992,7 +155128,7 @@ var require_libvips = __commonJS((exports2, module2) => {
|
|
|
154992
155128
|
shell: true
|
|
154993
155129
|
};
|
|
154994
155130
|
var vendorPath = path18.join(__dirname, "..", "vendor", minimumLibvipsVersion, platform());
|
|
154995
|
-
var
|
|
155131
|
+
var mkdirSync18 = function(dirPath) {
|
|
154996
155132
|
try {
|
|
154997
155133
|
fs18.mkdirSync(dirPath, { recursive: true });
|
|
154998
155134
|
} catch (err) {
|
|
@@ -155003,9 +155139,9 @@ var require_libvips = __commonJS((exports2, module2) => {
|
|
|
155003
155139
|
};
|
|
155004
155140
|
var cachePath = function() {
|
|
155005
155141
|
const npmCachePath = env4.npm_config_cache || (env4.APPDATA ? path18.join(env4.APPDATA, "npm-cache") : path18.join(os7.homedir(), ".npm"));
|
|
155006
|
-
|
|
155142
|
+
mkdirSync18(npmCachePath);
|
|
155007
155143
|
const libvipsCachePath = path18.join(npmCachePath, "_libvips");
|
|
155008
|
-
|
|
155144
|
+
mkdirSync18(libvipsCachePath);
|
|
155009
155145
|
return libvipsCachePath;
|
|
155010
155146
|
};
|
|
155011
155147
|
var integrity = function(platformAndArch) {
|
|
@@ -155082,7 +155218,7 @@ var require_libvips = __commonJS((exports2, module2) => {
|
|
|
155082
155218
|
removeVendoredLibvips,
|
|
155083
155219
|
pkgConfigPath,
|
|
155084
155220
|
useGlobalLibvips,
|
|
155085
|
-
mkdirSync:
|
|
155221
|
+
mkdirSync: mkdirSync18
|
|
155086
155222
|
};
|
|
155087
155223
|
});
|
|
155088
155224
|
|
|
@@ -164838,19 +164974,19 @@ __export(exports_generate, {
|
|
|
164838
164974
|
executeGenerateCommand: () => executeGenerateCommand,
|
|
164839
164975
|
ProfileNotFoundError: () => ProfileNotFoundError
|
|
164840
164976
|
});
|
|
164841
|
-
import { existsSync as
|
|
164842
|
-
import { dirname as
|
|
164977
|
+
import { existsSync as existsSync72, readFileSync as readFileSync57, realpathSync as realpathSync10 } from "fs";
|
|
164978
|
+
import { dirname as dirname29, isAbsolute as isAbsolute6, join as join77, resolve as resolve16 } from "path";
|
|
164843
164979
|
function profilesDirFor(opts) {
|
|
164844
164980
|
if (opts.profilesDir)
|
|
164845
164981
|
return opts.profilesDir;
|
|
164846
164982
|
if (opts.cwd)
|
|
164847
|
-
return
|
|
164848
|
-
return
|
|
164983
|
+
return join77(opts.cwd, PROFILES_RELATIVE);
|
|
164984
|
+
return join77(REPO_ROOT, PROFILES_RELATIVE);
|
|
164849
164985
|
}
|
|
164850
164986
|
function loadProfile(name2, options = {}) {
|
|
164851
164987
|
const fs22 = options.fs ?? defaultFS2;
|
|
164852
164988
|
const dir = profilesDirFor(options);
|
|
164853
|
-
const path27 =
|
|
164989
|
+
const path27 = join77(dir, `${name2}.json`);
|
|
164854
164990
|
if (!fs22.existsSync(path27)) {
|
|
164855
164991
|
throw new ProfileNotFoundError(name2);
|
|
164856
164992
|
}
|
|
@@ -164863,7 +164999,7 @@ function listProfiles(options = {}) {
|
|
|
164863
164999
|
const known = options.knownNames ?? ["trader", "plumber"];
|
|
164864
165000
|
const out = [];
|
|
164865
165001
|
for (const name2 of known) {
|
|
164866
|
-
const path27 =
|
|
165002
|
+
const path27 = join77(dir, `${name2}.json`);
|
|
164867
165003
|
if (fs22.existsSync(path27)) {
|
|
164868
165004
|
try {
|
|
164869
165005
|
const raw = JSON.parse(fs22.readFileSync(path27, "utf-8"));
|
|
@@ -164935,8 +165071,8 @@ var REPO_ROOT, defaultFS2, PROFILES_RELATIVE = "assets/profiles", ProfileNotFoun
|
|
|
164935
165071
|
var init_generate = __esm(() => {
|
|
164936
165072
|
init_src5();
|
|
164937
165073
|
init_src5();
|
|
164938
|
-
REPO_ROOT = resolve16(
|
|
164939
|
-
defaultFS2 = { existsSync:
|
|
165074
|
+
REPO_ROOT = resolve16(dirname29(new URL(import.meta.url).pathname), "..", "..", "..", "..", "..");
|
|
165075
|
+
defaultFS2 = { existsSync: existsSync72, readFileSync: readFileSync57, realpathSync: realpathSync10 };
|
|
164940
165076
|
ProfileNotFoundError = class ProfileNotFoundError extends Error {
|
|
164941
165077
|
profileName;
|
|
164942
165078
|
constructor(profileName) {
|
|
@@ -165055,12 +165191,12 @@ __export(exports_cost_report, {
|
|
|
165055
165191
|
executeCostReportCommand: () => executeCostReportCommand
|
|
165056
165192
|
});
|
|
165057
165193
|
import { Database as Database6 } from "bun:sqlite";
|
|
165058
|
-
import { existsSync as
|
|
165194
|
+
import { existsSync as existsSync73 } from "fs";
|
|
165059
165195
|
import * as path28 from "path";
|
|
165060
165196
|
import * as os14 from "os";
|
|
165061
165197
|
function executeCostReportCommand(args) {
|
|
165062
165198
|
const dbPath = path28.join(os14.homedir(), ".matrixos", "cost.db");
|
|
165063
|
-
if (!
|
|
165199
|
+
if (!existsSync73(dbPath)) {
|
|
165064
165200
|
return { exitCode: 1, stdout: `No cost data available
|
|
165065
165201
|
` };
|
|
165066
165202
|
}
|
|
@@ -165190,8 +165326,8 @@ var exports_profile_resolve = {};
|
|
|
165190
165326
|
__export(exports_profile_resolve, {
|
|
165191
165327
|
executeProfileResolveCommand: () => executeProfileResolveCommand
|
|
165192
165328
|
});
|
|
165193
|
-
import { existsSync as
|
|
165194
|
-
import { join as
|
|
165329
|
+
import { existsSync as existsSync74, readdirSync as readdirSync16, readFileSync as readFileSync58 } from "fs";
|
|
165330
|
+
import { join as join80, resolve as resolve17, dirname as dirname30 } from "path";
|
|
165195
165331
|
function executeProfileResolveCommand(args) {
|
|
165196
165332
|
if (args.options.help) {
|
|
165197
165333
|
return {
|
|
@@ -165216,14 +165352,14 @@ function executeProfileResolveCommand(args) {
|
|
|
165216
165352
|
` };
|
|
165217
165353
|
}
|
|
165218
165354
|
const name2 = nameRaw.endsWith(".json") ? nameRaw.slice(0, -5) : nameRaw;
|
|
165219
|
-
const profilesDir =
|
|
165220
|
-
if (!
|
|
165355
|
+
const profilesDir = join80(REPO_ROOT2, PROFILES_RELATIVE2);
|
|
165356
|
+
if (!existsSync74(profilesDir)) {
|
|
165221
165357
|
return { exitCode: 1, stdout: `error: profiles directory not found at ${profilesDir}
|
|
165222
165358
|
` };
|
|
165223
165359
|
}
|
|
165224
165360
|
let profileFiles;
|
|
165225
165361
|
try {
|
|
165226
|
-
profileFiles =
|
|
165362
|
+
profileFiles = readdirSync16(profilesDir).filter((f2) => f2.endsWith(".json"));
|
|
165227
165363
|
} catch (err) {
|
|
165228
165364
|
const message = err instanceof Error ? err.message : String(err);
|
|
165229
165365
|
return { exitCode: 1, stdout: `error: failed to read profiles directory: ${message}
|
|
@@ -165236,7 +165372,7 @@ function executeProfileResolveCommand(args) {
|
|
|
165236
165372
|
const registry2 = {};
|
|
165237
165373
|
for (const file3 of profileFiles) {
|
|
165238
165374
|
try {
|
|
165239
|
-
const filePath =
|
|
165375
|
+
const filePath = join80(profilesDir, file3);
|
|
165240
165376
|
const raw = JSON.parse(readFileSync58(filePath, "utf-8"));
|
|
165241
165377
|
const profile2 = ProfileSchema.parse(raw);
|
|
165242
165378
|
registry2[profile2.name] = profile2;
|
|
@@ -165289,7 +165425,7 @@ function executeProfileResolveCommand(args) {
|
|
|
165289
165425
|
var REPO_ROOT2, PROFILES_RELATIVE2 = "assets/profiles";
|
|
165290
165426
|
var init_profile_resolve = __esm(() => {
|
|
165291
165427
|
init_src5();
|
|
165292
|
-
REPO_ROOT2 = resolve17(
|
|
165428
|
+
REPO_ROOT2 = resolve17(dirname30(new URL(import.meta.url).pathname), "..", "..", "..", "..");
|
|
165293
165429
|
});
|
|
165294
165430
|
|
|
165295
165431
|
// packages/omo-opencode/src/cli/export.ts
|
|
@@ -165299,8 +165435,8 @@ __export(exports_export, {
|
|
|
165299
165435
|
getShell: () => getShell,
|
|
165300
165436
|
executeExportCommand: () => executeExportCommand
|
|
165301
165437
|
});
|
|
165302
|
-
import { existsSync as
|
|
165303
|
-
import { isAbsolute as isAbsolute7, join as
|
|
165438
|
+
import { existsSync as existsSync75, readFileSync as readFileSync59, writeFileSync as writeFileSync26, copyFileSync as copyFileSync8, realpathSync as realpathSync11, mkdirSync as mkdirSync27 } from "fs";
|
|
165439
|
+
import { isAbsolute as isAbsolute7, join as join81, resolve as resolve18, dirname as dirname31 } from "path";
|
|
165304
165440
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
165305
165441
|
function setShell(shell) {
|
|
165306
165442
|
activeShell = shell;
|
|
@@ -165341,7 +165477,7 @@ function executeExportCommand(args) {
|
|
|
165341
165477
|
return { exitCode: 1, stdout: `error: generate failed: ${message}
|
|
165342
165478
|
` };
|
|
165343
165479
|
}
|
|
165344
|
-
const pkgPath =
|
|
165480
|
+
const pkgPath = join81(absoluteTargetDir, "package.json");
|
|
165345
165481
|
let pkg;
|
|
165346
165482
|
try {
|
|
165347
165483
|
pkg = JSON.parse(fs24.readFileSync(pkgPath, "utf-8"));
|
|
@@ -165381,11 +165517,11 @@ ${packResult.stdout}
|
|
|
165381
165517
|
return { exitCode: 1, stdout: `error: npm pack produced no tarball name in output
|
|
165382
165518
|
` };
|
|
165383
165519
|
}
|
|
165384
|
-
let tgzPath =
|
|
165520
|
+
let tgzPath = join81(absoluteTargetDir, tgzName);
|
|
165385
165521
|
if (args.options.output) {
|
|
165386
165522
|
const outputPath = args.options.output;
|
|
165387
165523
|
const absoluteOutput = isAbsolute7(outputPath) ? outputPath : resolve18(process.cwd(), outputPath);
|
|
165388
|
-
const outputDir =
|
|
165524
|
+
const outputDir = dirname31(absoluteOutput);
|
|
165389
165525
|
if (!fs24.existsSync(outputDir)) {
|
|
165390
165526
|
fs24.mkdirSync(outputDir, { recursive: true });
|
|
165391
165527
|
}
|
|
@@ -165422,12 +165558,12 @@ var init_export = __esm(() => {
|
|
|
165422
165558
|
};
|
|
165423
165559
|
activeShell = defaultShell;
|
|
165424
165560
|
defaultExportFS = {
|
|
165425
|
-
existsSync:
|
|
165561
|
+
existsSync: existsSync75,
|
|
165426
165562
|
readFileSync: readFileSync59,
|
|
165427
165563
|
writeFileSync: writeFileSync26,
|
|
165428
|
-
copyFileSync:
|
|
165564
|
+
copyFileSync: copyFileSync8,
|
|
165429
165565
|
realpathSync: realpathSync11,
|
|
165430
|
-
mkdirSync:
|
|
165566
|
+
mkdirSync: mkdirSync27
|
|
165431
165567
|
};
|
|
165432
165568
|
});
|
|
165433
165569
|
|
|
@@ -165451,23 +165587,23 @@ __export(exports_project_context, {
|
|
|
165451
165587
|
createProject: () => createProject,
|
|
165452
165588
|
archiveProject: () => archiveProject
|
|
165453
165589
|
});
|
|
165454
|
-
import { existsSync as
|
|
165455
|
-
import { join as
|
|
165590
|
+
import { existsSync as existsSync76, mkdirSync as mkdirSync28, readFileSync as readFileSync60, writeFileSync as writeFileSync27, rmSync as rmSync8 } from "fs";
|
|
165591
|
+
import { join as join82 } from "path";
|
|
165456
165592
|
function getMatrixOsDir(cwd = process.cwd()) {
|
|
165457
|
-
return
|
|
165593
|
+
return join82(cwd, ".matrixos");
|
|
165458
165594
|
}
|
|
165459
165595
|
function getProjectsDir(cwd) {
|
|
165460
|
-
return
|
|
165596
|
+
return join82(getMatrixOsDir(cwd), "projects");
|
|
165461
165597
|
}
|
|
165462
165598
|
function getProjectDir(slug, cwd) {
|
|
165463
|
-
return
|
|
165599
|
+
return join82(getProjectsDir(cwd), slug);
|
|
165464
165600
|
}
|
|
165465
165601
|
function getStatePath(cwd) {
|
|
165466
|
-
return
|
|
165602
|
+
return join82(getMatrixOsDir(cwd), "state.json");
|
|
165467
165603
|
}
|
|
165468
165604
|
function loadState(cwd) {
|
|
165469
165605
|
const path29 = getStatePath(cwd);
|
|
165470
|
-
if (!
|
|
165606
|
+
if (!existsSync76(path29))
|
|
165471
165607
|
return {};
|
|
165472
165608
|
try {
|
|
165473
165609
|
return JSON.parse(readFileSync60(path29, "utf-8"));
|
|
@@ -165477,13 +165613,13 @@ function loadState(cwd) {
|
|
|
165477
165613
|
}
|
|
165478
165614
|
function saveState(state2, cwd) {
|
|
165479
165615
|
const path29 = getStatePath(cwd);
|
|
165480
|
-
|
|
165616
|
+
mkdirSync28(getMatrixOsDir(cwd), { recursive: true });
|
|
165481
165617
|
writeFileSync27(path29, JSON.stringify(state2, null, 2) + `
|
|
165482
165618
|
`);
|
|
165483
165619
|
}
|
|
165484
165620
|
function loadProjectMeta(slug, cwd) {
|
|
165485
|
-
const path29 =
|
|
165486
|
-
if (!
|
|
165621
|
+
const path29 = join82(getProjectDir(slug, cwd), "meta.json");
|
|
165622
|
+
if (!existsSync76(path29))
|
|
165487
165623
|
return null;
|
|
165488
165624
|
try {
|
|
165489
165625
|
return JSON.parse(readFileSync60(path29, "utf-8"));
|
|
@@ -165493,16 +165629,16 @@ function loadProjectMeta(slug, cwd) {
|
|
|
165493
165629
|
}
|
|
165494
165630
|
function saveProjectMeta(slug, meta3, cwd) {
|
|
165495
165631
|
const dir = getProjectDir(slug, cwd);
|
|
165496
|
-
|
|
165497
|
-
const path29 =
|
|
165632
|
+
mkdirSync28(dir, { recursive: true });
|
|
165633
|
+
const path29 = join82(dir, "meta.json");
|
|
165498
165634
|
writeFileSync27(path29, JSON.stringify(meta3, null, 2) + `
|
|
165499
165635
|
`);
|
|
165500
165636
|
}
|
|
165501
165637
|
function initProjectFiles(slug, cwd) {
|
|
165502
165638
|
const dir = getProjectDir(slug, cwd);
|
|
165503
|
-
|
|
165504
|
-
const kanbanPath =
|
|
165505
|
-
if (!
|
|
165639
|
+
mkdirSync28(join82(dir, "kb"), { recursive: true });
|
|
165640
|
+
const kanbanPath = join82(dir, "kanban.json");
|
|
165641
|
+
if (!existsSync76(kanbanPath)) {
|
|
165506
165642
|
writeFileSync27(kanbanPath, JSON.stringify({ columns: ["todo", "in-progress", "review", "done"], tasks: [] }, null, 2) + `
|
|
165507
165643
|
`);
|
|
165508
165644
|
}
|
|
@@ -165512,7 +165648,7 @@ function createProject(slug, options = {}) {
|
|
|
165512
165648
|
throw new Error(`Invalid project slug "${slug}": only lowercase letters, numbers, - and _ are allowed.`);
|
|
165513
165649
|
}
|
|
165514
165650
|
const dir = getProjectDir(slug, options.cwd);
|
|
165515
|
-
if (
|
|
165651
|
+
if (existsSync76(dir)) {
|
|
165516
165652
|
throw new Error(`Project "${slug}" already exists.`);
|
|
165517
165653
|
}
|
|
165518
165654
|
const now = new Date().toISOString();
|
|
@@ -165533,7 +165669,7 @@ function createProject(slug, options = {}) {
|
|
|
165533
165669
|
function listProjects(cwd) {
|
|
165534
165670
|
const state2 = loadState(cwd);
|
|
165535
165671
|
const root = getProjectsDir(cwd);
|
|
165536
|
-
if (!
|
|
165672
|
+
if (!existsSync76(root))
|
|
165537
165673
|
return [];
|
|
165538
165674
|
const fs24 = __require("fs");
|
|
165539
165675
|
const items = [];
|
|
@@ -165581,7 +165717,7 @@ function unarchiveProject(slug, cwd) {
|
|
|
165581
165717
|
}
|
|
165582
165718
|
function deleteProject(slug, cwd) {
|
|
165583
165719
|
const dir = getProjectDir(slug, cwd);
|
|
165584
|
-
if (!
|
|
165720
|
+
if (!existsSync76(dir))
|
|
165585
165721
|
throw new Error(`Project "${slug}" does not exist.`);
|
|
165586
165722
|
rmSync8(dir, { recursive: true, force: true });
|
|
165587
165723
|
const state2 = loadState(cwd);
|
|
@@ -165612,8 +165748,8 @@ __export(exports_project_memory, {
|
|
|
165612
165748
|
isProjectEpisode: () => isProjectEpisode,
|
|
165613
165749
|
addKbDocument: () => addKbDocument
|
|
165614
165750
|
});
|
|
165615
|
-
import { existsSync as
|
|
165616
|
-
import { join as
|
|
165751
|
+
import { existsSync as existsSync77, mkdirSync as mkdirSync29, readFileSync as readFileSync61, readdirSync as readdirSync17, writeFileSync as writeFileSync28 } from "fs";
|
|
165752
|
+
import { join as join83 } from "path";
|
|
165617
165753
|
function tagWithProject(metadata = {}, projectSlug, cwd) {
|
|
165618
165754
|
const active = projectSlug ?? getActiveProject(cwd)?.slug;
|
|
165619
165755
|
if (!active)
|
|
@@ -165627,14 +165763,14 @@ function isProjectEpisode(ep, projectSlug, cwd) {
|
|
|
165627
165763
|
return ep.metadata?.project === target;
|
|
165628
165764
|
}
|
|
165629
165765
|
function listKbDocuments(projectSlug, cwd) {
|
|
165630
|
-
const kbDir =
|
|
165631
|
-
if (!
|
|
165766
|
+
const kbDir = join83(getProjectDir(projectSlug, cwd), "kb");
|
|
165767
|
+
if (!existsSync77(kbDir))
|
|
165632
165768
|
return [];
|
|
165633
165769
|
const docs = [];
|
|
165634
|
-
for (const entry of
|
|
165770
|
+
for (const entry of readdirSync17(kbDir, { withFileTypes: true })) {
|
|
165635
165771
|
if (!entry.isFile())
|
|
165636
165772
|
continue;
|
|
165637
|
-
const path29 =
|
|
165773
|
+
const path29 = join83(kbDir, entry.name);
|
|
165638
165774
|
try {
|
|
165639
165775
|
docs.push({ path: path29, content: readFileSync61(path29, "utf-8") });
|
|
165640
165776
|
} catch {}
|
|
@@ -165678,10 +165814,10 @@ async function searchProject(query, options = {}) {
|
|
|
165678
165814
|
return [...kbHits, ...memoryHits].sort((a2, b2) => b2.score - a2.score);
|
|
165679
165815
|
}
|
|
165680
165816
|
function addKbDocument(projectSlug, filename, content, cwd) {
|
|
165681
|
-
const kbDir =
|
|
165682
|
-
|
|
165817
|
+
const kbDir = join83(getProjectDir(projectSlug, cwd), "kb");
|
|
165818
|
+
mkdirSync29(kbDir, { recursive: true });
|
|
165683
165819
|
const safeName = filename.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
165684
|
-
const path29 =
|
|
165820
|
+
const path29 = join83(kbDir, safeName);
|
|
165685
165821
|
writeFileSync28(path29, content, "utf-8");
|
|
165686
165822
|
return path29;
|
|
165687
165823
|
}
|
|
@@ -166058,10 +166194,10 @@ __export(exports_gateway_start, {
|
|
|
166058
166194
|
buildTelegramConfig: () => buildTelegramConfig,
|
|
166059
166195
|
buildGatewayConfig: () => buildGatewayConfig
|
|
166060
166196
|
});
|
|
166061
|
-
import { readFileSync as readFileSync62, existsSync as
|
|
166197
|
+
import { readFileSync as readFileSync62, existsSync as existsSync78 } from "fs";
|
|
166062
166198
|
import { resolve as resolve19 } from "path";
|
|
166063
166199
|
function loadGatewayEnv(path29 = ENV_PATH) {
|
|
166064
|
-
if (!
|
|
166200
|
+
if (!existsSync78(path29))
|
|
166065
166201
|
return {};
|
|
166066
166202
|
const text = readFileSync62(path29, "utf8");
|
|
166067
166203
|
const out = {};
|
|
@@ -166200,7 +166336,7 @@ var init_deployment_core = __esm(() => {
|
|
|
166200
166336
|
|
|
166201
166337
|
// packages/omo-opencode/src/deployment/deploy-static.ts
|
|
166202
166338
|
import { spawn as spawn6 } from "child_process";
|
|
166203
|
-
import { existsSync as
|
|
166339
|
+
import { existsSync as existsSync79 } from "fs";
|
|
166204
166340
|
import { resolve as resolve20 } from "path";
|
|
166205
166341
|
function pushStage(stage, message, ok = true) {
|
|
166206
166342
|
return { stage, message, ok };
|
|
@@ -166257,7 +166393,7 @@ var init_deploy_static = __esm(() => {
|
|
|
166257
166393
|
}
|
|
166258
166394
|
stages.push(pushStage("build", "build succeeded"));
|
|
166259
166395
|
}
|
|
166260
|
-
if (!
|
|
166396
|
+
if (!existsSync79(buildDir)) {
|
|
166261
166397
|
stages.push(pushStage("push", `build directory not found: ${buildDir}`, false));
|
|
166262
166398
|
return { target: "static", ok: false, stages, error: "build directory missing" };
|
|
166263
166399
|
}
|
|
@@ -166533,10 +166669,10 @@ var init_deployment = __esm(() => {
|
|
|
166533
166669
|
});
|
|
166534
166670
|
|
|
166535
166671
|
// packages/omo-opencode/src/audit/self-audit.ts
|
|
166536
|
-
import { existsSync as
|
|
166537
|
-
import { join as
|
|
166672
|
+
import { existsSync as existsSync80, mkdirSync as mkdirSync30, readdirSync as readdirSync18, readFileSync as readFileSync63, writeFileSync as writeFileSync29 } from "fs";
|
|
166673
|
+
import { join as join84 } from "path";
|
|
166538
166674
|
function getAuditDir(cwd = process.cwd()) {
|
|
166539
|
-
return
|
|
166675
|
+
return join84(cwd, ".matrixos", "audits");
|
|
166540
166676
|
}
|
|
166541
166677
|
function getWeekString(date5 = new Date) {
|
|
166542
166678
|
const d = new Date(Date.UTC(date5.getFullYear(), date5.getMonth(), date5.getDate()));
|
|
@@ -166643,8 +166779,8 @@ function formatAuditReport(report) {
|
|
|
166643
166779
|
}
|
|
166644
166780
|
function writeAuditReport(report, cwd) {
|
|
166645
166781
|
const dir = getAuditDir(cwd);
|
|
166646
|
-
|
|
166647
|
-
const path29 =
|
|
166782
|
+
mkdirSync30(dir, { recursive: true });
|
|
166783
|
+
const path29 = join84(dir, `${report.week}.md`);
|
|
166648
166784
|
writeFileSync29(path29, formatAuditReport(report), "utf-8");
|
|
166649
166785
|
return path29;
|
|
166650
166786
|
}
|
|
@@ -167611,7 +167747,7 @@ async function processEvents(ctx, stream, state) {
|
|
|
167611
167747
|
}
|
|
167612
167748
|
// packages/omo-opencode/src/plugin-config/layered-config-loader.ts
|
|
167613
167749
|
import * as fs7 from "fs";
|
|
167614
|
-
import { homedir as
|
|
167750
|
+
import { homedir as homedir9 } from "os";
|
|
167615
167751
|
import * as path7 from "path";
|
|
167616
167752
|
|
|
167617
167753
|
// packages/omo-opencode/src/config/schema/agent-names.ts
|
|
@@ -168595,7 +168731,7 @@ function loadConfigFromPath(configPath, _ctx) {
|
|
|
168595
168731
|
|
|
168596
168732
|
// packages/omo-opencode/src/plugin-config/layered-config-loader.ts
|
|
168597
168733
|
function resolveHomeDirectory() {
|
|
168598
|
-
return process.env.HOME ?? process.env.USERPROFILE ??
|
|
168734
|
+
return process.env.HOME ?? process.env.USERPROFILE ?? homedir9();
|
|
168599
168735
|
}
|
|
168600
168736
|
function resolveConfigPathAfterLegacyMigration(detectedPath) {
|
|
168601
168737
|
if (!path7.basename(detectedPath).startsWith(LEGACY_CONFIG_BASENAME)) {
|
|
@@ -168736,7 +168872,7 @@ var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
|
168736
168872
|
// packages/omo-opencode/src/cli/run/opencode-binary-resolver.ts
|
|
168737
168873
|
init_bun_which_shim();
|
|
168738
168874
|
init_spawn_with_windows_hide();
|
|
168739
|
-
import { delimiter as delimiter2, dirname as
|
|
168875
|
+
import { delimiter as delimiter2, dirname as dirname12, posix as posix3, win32 as win324 } from "path";
|
|
168740
168876
|
var OPENCODE_COMMANDS = ["opencode", "opencode-desktop"];
|
|
168741
168877
|
var WINDOWS_SUFFIXES = ["", ".exe", ".cmd", ".bat", ".ps1"];
|
|
168742
168878
|
function getCommandCandidates(platform) {
|
|
@@ -168794,7 +168930,7 @@ async function findWorkingOpencodeBinary(pathEnv = process.env.PATH, probe2 = ca
|
|
|
168794
168930
|
return null;
|
|
168795
168931
|
}
|
|
168796
168932
|
function buildPathWithBinaryFirst(pathEnv, binaryPath) {
|
|
168797
|
-
const preferredDir =
|
|
168933
|
+
const preferredDir = dirname12(binaryPath);
|
|
168798
168934
|
const existing = (pathEnv ?? "").split(delimiter2).filter((entry) => entry.length > 0 && entry !== preferredDir);
|
|
168799
168935
|
return [preferredDir, ...existing].join(delimiter2);
|
|
168800
168936
|
}
|
|
@@ -169187,7 +169323,7 @@ var BOULDER_STATE_PATH = `${BOULDER_DIR}/${BOULDER_FILE}`;
|
|
|
169187
169323
|
var NOTEPAD_DIR = "notepads";
|
|
169188
169324
|
var NOTEPAD_BASE_PATH = `${BOULDER_DIR}/${NOTEPAD_DIR}`;
|
|
169189
169325
|
// packages/boulder-state/src/top-level-task.ts
|
|
169190
|
-
import { existsSync as
|
|
169326
|
+
import { existsSync as existsSync32, readFileSync as readFileSync18 } from "fs";
|
|
169191
169327
|
var TODO_HEADING_PATTERN = /^##\s+TODOs\b/i;
|
|
169192
169328
|
var FINAL_VERIFICATION_HEADING_PATTERN = /^##\s+Final Verification Wave\b/i;
|
|
169193
169329
|
var SECOND_LEVEL_HEADING_PATTERN = /^##\s+/;
|
|
@@ -169210,7 +169346,7 @@ function buildTaskRef(section, taskLabel) {
|
|
|
169210
169346
|
};
|
|
169211
169347
|
}
|
|
169212
169348
|
function readCurrentTopLevelTask(planPath) {
|
|
169213
|
-
if (!
|
|
169349
|
+
if (!existsSync32(planPath)) {
|
|
169214
169350
|
return null;
|
|
169215
169351
|
}
|
|
169216
169352
|
try {
|
|
@@ -169239,10 +169375,10 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
169239
169375
|
}
|
|
169240
169376
|
}
|
|
169241
169377
|
// packages/boulder-state/src/storage/path.ts
|
|
169242
|
-
import { existsSync as
|
|
169243
|
-
import { isAbsolute as isAbsolute4, join as
|
|
169378
|
+
import { existsSync as existsSync33 } from "fs";
|
|
169379
|
+
import { isAbsolute as isAbsolute4, join as join30, relative as relative3, resolve as resolve8 } from "path";
|
|
169244
169380
|
function getBoulderFilePath(directory) {
|
|
169245
|
-
return
|
|
169381
|
+
return join30(directory, BOULDER_DIR, BOULDER_FILE);
|
|
169246
169382
|
}
|
|
169247
169383
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
169248
169384
|
return isAbsolute4(trackedPath) ? resolve8(trackedPath) : resolve8(baseDirectory, trackedPath);
|
|
@@ -169260,13 +169396,13 @@ function resolveBoulderPlanPath(directory, state) {
|
|
|
169260
169396
|
}
|
|
169261
169397
|
const absoluteWorktreePath = resolveTrackedPath(directory, worktreePath);
|
|
169262
169398
|
const worktreePlanPath = resolve8(absoluteWorktreePath, relativePlanPath);
|
|
169263
|
-
return
|
|
169399
|
+
return existsSync33(worktreePlanPath) ? worktreePlanPath : absolutePlanPath;
|
|
169264
169400
|
}
|
|
169265
169401
|
function resolveBoulderPlanPathForWork(directory, work) {
|
|
169266
169402
|
return resolveBoulderPlanPath(directory, work);
|
|
169267
169403
|
}
|
|
169268
169404
|
// packages/boulder-state/src/storage/plan-progress.ts
|
|
169269
|
-
import { existsSync as
|
|
169405
|
+
import { existsSync as existsSync34, readFileSync as readFileSync19, readdirSync as readdirSync5, statSync as statSync5 } from "fs";
|
|
169270
169406
|
var TODO_HEADING_PATTERN2 = /^##\s+TODOs\b/i;
|
|
169271
169407
|
var FINAL_VERIFICATION_HEADING_PATTERN2 = /^##\s+Final Verification Wave\b/i;
|
|
169272
169408
|
var SECOND_LEVEL_HEADING_PATTERN2 = /^##\s+/;
|
|
@@ -169275,7 +169411,7 @@ var CHECKED_CHECKBOX_PATTERN = /^(\s*)[-*]\s*\[[xX]\]\s*(.+)$/;
|
|
|
169275
169411
|
var TODO_TASK_PATTERN2 = /^\d+\.\s+/;
|
|
169276
169412
|
var FINAL_WAVE_TASK_PATTERN2 = /^F\d+\.\s+/i;
|
|
169277
169413
|
function getPlanProgress(planPath) {
|
|
169278
|
-
if (!
|
|
169414
|
+
if (!existsSync34(planPath)) {
|
|
169279
169415
|
return { total: 0, completed: 0, isComplete: false };
|
|
169280
169416
|
}
|
|
169281
169417
|
try {
|
|
@@ -169395,10 +169531,10 @@ function selectMirrorWork(state) {
|
|
|
169395
169531
|
return sorted[0] ?? null;
|
|
169396
169532
|
}
|
|
169397
169533
|
// packages/boulder-state/src/storage/read-state.ts
|
|
169398
|
-
import { existsSync as
|
|
169534
|
+
import { existsSync as existsSync35, readFileSync as readFileSync20 } from "fs";
|
|
169399
169535
|
function readBoulderState(directory) {
|
|
169400
169536
|
const filePath = getBoulderFilePath(directory);
|
|
169401
|
-
if (!
|
|
169537
|
+
if (!existsSync35(filePath)) {
|
|
169402
169538
|
return null;
|
|
169403
169539
|
}
|
|
169404
169540
|
try {
|
|
@@ -169468,14 +169604,14 @@ init_state();
|
|
|
169468
169604
|
// packages/omo-opencode/src/features/run-continuation-state/constants.ts
|
|
169469
169605
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
169470
169606
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
169471
|
-
import { existsSync as
|
|
169472
|
-
import { join as
|
|
169607
|
+
import { existsSync as existsSync36, mkdirSync as mkdirSync12, readFileSync as readFileSync21, rmSync as rmSync2, writeFileSync as writeFileSync9 } from "fs";
|
|
169608
|
+
import { join as join31 } from "path";
|
|
169473
169609
|
function getMarkerPath(directory, sessionID) {
|
|
169474
|
-
return
|
|
169610
|
+
return join31(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
169475
169611
|
}
|
|
169476
169612
|
function readContinuationMarker(directory, sessionID) {
|
|
169477
169613
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
169478
|
-
if (!
|
|
169614
|
+
if (!existsSync36(markerPath))
|
|
169479
169615
|
return null;
|
|
169480
169616
|
try {
|
|
169481
169617
|
const raw = readFileSync21(markerPath, "utf-8");
|
|
@@ -169543,8 +169679,8 @@ async function isSessionInBoulderLineage(input) {
|
|
|
169543
169679
|
// packages/omo-opencode/src/hooks/the-operator/session-last-agent.ts
|
|
169544
169680
|
init_shared();
|
|
169545
169681
|
init_compaction_marker();
|
|
169546
|
-
import { readFileSync as readFileSync22, readdirSync as
|
|
169547
|
-
import { join as
|
|
169682
|
+
import { readFileSync as readFileSync22, readdirSync as readdirSync6 } from "fs";
|
|
169683
|
+
import { join as join32 } from "path";
|
|
169548
169684
|
var defaultSessionLastAgentDeps = {
|
|
169549
169685
|
getMessageDir,
|
|
169550
169686
|
isSqliteBackend,
|
|
@@ -169602,9 +169738,9 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
|
|
|
169602
169738
|
if (!messageDir)
|
|
169603
169739
|
return null;
|
|
169604
169740
|
try {
|
|
169605
|
-
const messages =
|
|
169741
|
+
const messages = readdirSync6(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
169606
169742
|
try {
|
|
169607
|
-
const content = readFileSync22(
|
|
169743
|
+
const content = readFileSync22(join32(messageDir, fileName), "utf-8");
|
|
169608
169744
|
const parsed = JSON.parse(content);
|
|
169609
169745
|
return {
|
|
169610
169746
|
fileName,
|
|
@@ -169647,8 +169783,8 @@ init_agent_display_names();
|
|
|
169647
169783
|
|
|
169648
169784
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
169649
169785
|
init_frontmatter2();
|
|
169650
|
-
import { existsSync as
|
|
169651
|
-
import { dirname as
|
|
169786
|
+
import { existsSync as existsSync37, readFileSync as readFileSync23, writeFileSync as writeFileSync10, unlinkSync as unlinkSync6, mkdirSync as mkdirSync13 } from "fs";
|
|
169787
|
+
import { dirname as dirname13, join as join33 } from "path";
|
|
169652
169788
|
|
|
169653
169789
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
169654
169790
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -169657,11 +169793,11 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
169657
169793
|
|
|
169658
169794
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
169659
169795
|
function getStateFilePath(directory, customPath) {
|
|
169660
|
-
return customPath ?
|
|
169796
|
+
return customPath ? join33(directory, customPath) : join33(directory, DEFAULT_STATE_FILE);
|
|
169661
169797
|
}
|
|
169662
169798
|
function readState(directory, customPath) {
|
|
169663
169799
|
const filePath = getStateFilePath(directory, customPath);
|
|
169664
|
-
if (!
|
|
169800
|
+
if (!existsSync37(filePath)) {
|
|
169665
169801
|
return null;
|
|
169666
169802
|
}
|
|
169667
169803
|
try {
|
|
@@ -170240,22 +170376,22 @@ function createTimestampedStdoutController(stdout2 = process.stdout) {
|
|
|
170240
170376
|
// packages/telemetry-core/src/activity-state.ts
|
|
170241
170377
|
init_atomic_write();
|
|
170242
170378
|
init_xdg_data_dir();
|
|
170243
|
-
import { existsSync as
|
|
170244
|
-
import { basename as
|
|
170379
|
+
import { existsSync as existsSync38, mkdirSync as mkdirSync14, readFileSync as readFileSync24 } from "fs";
|
|
170380
|
+
import { basename as basename7, join as join34 } from "path";
|
|
170245
170381
|
var POSTHOG_ACTIVITY_STATE_FILE = "posthog-activity.json";
|
|
170246
170382
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
170247
170383
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
170248
170384
|
env: options.env,
|
|
170249
170385
|
osProvider: options.osProvider
|
|
170250
170386
|
});
|
|
170251
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
170252
|
-
if (dataDir === xdgStateDir || xdgStateDir === undefined &&
|
|
170387
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join34(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
170388
|
+
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename7(dataDir) === product.cacheDirName) {
|
|
170253
170389
|
return dataDir;
|
|
170254
170390
|
}
|
|
170255
|
-
return
|
|
170391
|
+
return join34(dataDir, product.cacheDirName);
|
|
170256
170392
|
}
|
|
170257
170393
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
170258
|
-
return
|
|
170394
|
+
return join34(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
170259
170395
|
}
|
|
170260
170396
|
function getDailyActiveCaptureState(input) {
|
|
170261
170397
|
const state2 = readPostHogActivityState(input.stateDir, input.diagnostics);
|
|
@@ -170280,7 +170416,7 @@ function isPostHogActivityState(value) {
|
|
|
170280
170416
|
}
|
|
170281
170417
|
function readPostHogActivityState(stateDir, diagnostics) {
|
|
170282
170418
|
const stateFilePath = getTelemetryActivityStateFilePath(stateDir);
|
|
170283
|
-
if (!
|
|
170419
|
+
if (!existsSync38(stateFilePath)) {
|
|
170284
170420
|
return {};
|
|
170285
170421
|
}
|
|
170286
170422
|
try {
|
|
@@ -170303,7 +170439,7 @@ function readPostHogActivityState(stateDir, diagnostics) {
|
|
|
170303
170439
|
function writePostHogActivityState(stateDir, nextState, diagnostics) {
|
|
170304
170440
|
const stateFilePath = getTelemetryActivityStateFilePath(stateDir);
|
|
170305
170441
|
try {
|
|
170306
|
-
|
|
170442
|
+
mkdirSync14(stateDir, { recursive: true });
|
|
170307
170443
|
writeFileAtomically(stateFilePath, `${JSON.stringify(nextState, null, 2)}
|
|
170308
170444
|
`);
|
|
170309
170445
|
} catch (error51) {
|
|
@@ -170368,7 +170504,7 @@ function getTelemetryDistinctId(machineIdPrefix, osProvider = getDefaultTelemetr
|
|
|
170368
170504
|
}
|
|
170369
170505
|
|
|
170370
170506
|
// node_modules/.bun/posthog-node@5.45.2/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
170371
|
-
import { dirname as
|
|
170507
|
+
import { dirname as dirname14, posix as posix4, sep } from "path";
|
|
170372
170508
|
function createModulerModifier() {
|
|
170373
170509
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
170374
170510
|
return async (frames) => {
|
|
@@ -170377,7 +170513,7 @@ function createModulerModifier() {
|
|
|
170377
170513
|
return frames;
|
|
170378
170514
|
};
|
|
170379
170515
|
}
|
|
170380
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
170516
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname14(process.argv[1]) : process.cwd(), isWindows = sep === "\\") {
|
|
170381
170517
|
const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
|
|
170382
170518
|
return (filename) => {
|
|
170383
170519
|
if (!filename)
|
|
@@ -177407,14 +177543,14 @@ init_constants5();
|
|
|
177407
177543
|
|
|
177408
177544
|
// packages/omo-opencode/src/cli/doctor/checks/system.ts
|
|
177409
177545
|
init_constants5();
|
|
177410
|
-
import { existsSync as
|
|
177546
|
+
import { existsSync as existsSync49, readFileSync as readFileSync34 } from "fs";
|
|
177411
177547
|
|
|
177412
177548
|
// packages/omo-opencode/src/cli/doctor/checks/system-binary.ts
|
|
177413
177549
|
init_extract_semver();
|
|
177414
177550
|
init_bun_which_shim();
|
|
177415
|
-
import { existsSync as
|
|
177416
|
-
import { homedir as
|
|
177417
|
-
import { join as
|
|
177551
|
+
import { existsSync as existsSync46, accessSync as accessSync4, constants as constants8 } from "fs";
|
|
177552
|
+
import { homedir as homedir12 } from "os";
|
|
177553
|
+
import { join as join41 } from "path";
|
|
177418
177554
|
|
|
177419
177555
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
177420
177556
|
init_spawn_with_windows_hide();
|
|
@@ -177502,22 +177638,22 @@ function isExecutable2(path14) {
|
|
|
177502
177638
|
}
|
|
177503
177639
|
}
|
|
177504
177640
|
function getDesktopAppPaths(platform) {
|
|
177505
|
-
const home =
|
|
177641
|
+
const home = homedir12();
|
|
177506
177642
|
switch (platform) {
|
|
177507
177643
|
case "darwin":
|
|
177508
177644
|
return [
|
|
177509
177645
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
177510
|
-
|
|
177646
|
+
join41(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
177511
177647
|
];
|
|
177512
177648
|
case "win32": {
|
|
177513
177649
|
const programFiles = process.env.ProgramFiles;
|
|
177514
177650
|
const localAppData = process.env.LOCALAPPDATA;
|
|
177515
177651
|
const paths2 = [];
|
|
177516
177652
|
if (programFiles) {
|
|
177517
|
-
paths2.push(
|
|
177653
|
+
paths2.push(join41(programFiles, "OpenCode", "OpenCode.exe"));
|
|
177518
177654
|
}
|
|
177519
177655
|
if (localAppData) {
|
|
177520
|
-
paths2.push(
|
|
177656
|
+
paths2.push(join41(localAppData, "OpenCode", "OpenCode.exe"));
|
|
177521
177657
|
}
|
|
177522
177658
|
return paths2;
|
|
177523
177659
|
}
|
|
@@ -177525,8 +177661,8 @@ function getDesktopAppPaths(platform) {
|
|
|
177525
177661
|
return [
|
|
177526
177662
|
"/usr/bin/opencode",
|
|
177527
177663
|
"/usr/lib/opencode/opencode",
|
|
177528
|
-
|
|
177529
|
-
|
|
177664
|
+
join41(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
177665
|
+
join41(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
177530
177666
|
];
|
|
177531
177667
|
default:
|
|
177532
177668
|
return [];
|
|
@@ -177538,7 +177674,7 @@ function buildVersionCommand(binaryPath, platform) {
|
|
|
177538
177674
|
}
|
|
177539
177675
|
return [binaryPath, "--version"];
|
|
177540
177676
|
}
|
|
177541
|
-
function findDesktopBinary(platform = process.platform, checkExists =
|
|
177677
|
+
function findDesktopBinary(platform = process.platform, checkExists = existsSync46) {
|
|
177542
177678
|
for (const desktopPath of getDesktopAppPaths(platform)) {
|
|
177543
177679
|
if (checkExists(desktopPath)) {
|
|
177544
177680
|
return { binary: "opencode", path: desktopPath };
|
|
@@ -177546,7 +177682,7 @@ function findDesktopBinary(platform = process.platform, checkExists = existsSync
|
|
|
177546
177682
|
}
|
|
177547
177683
|
return null;
|
|
177548
177684
|
}
|
|
177549
|
-
async function findOpenCodeBinary(platform = process.platform, checkExists =
|
|
177685
|
+
async function findOpenCodeBinary(platform = process.platform, checkExists = existsSync46) {
|
|
177550
177686
|
for (const binary2 of OPENCODE_BINARIES2) {
|
|
177551
177687
|
const path14 = bunWhich(binary2);
|
|
177552
177688
|
if (path14 && checkExists(path14)) {
|
|
@@ -177558,7 +177694,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
177558
177694
|
const candidates = getCommandCandidates2(platform);
|
|
177559
177695
|
for (const entry of pathEnv.split(delimiter3).filter(Boolean)) {
|
|
177560
177696
|
for (const command of candidates) {
|
|
177561
|
-
const fullPath =
|
|
177697
|
+
const fullPath = join41(entry, command);
|
|
177562
177698
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
177563
177699
|
return { binary: command, path: fullPath };
|
|
177564
177700
|
}
|
|
@@ -177604,12 +177740,12 @@ function compareVersions3(current, minimum) {
|
|
|
177604
177740
|
|
|
177605
177741
|
// packages/omo-opencode/src/cli/doctor/checks/system-plugin.ts
|
|
177606
177742
|
init_shared();
|
|
177607
|
-
import { existsSync as
|
|
177743
|
+
import { existsSync as existsSync47, readFileSync as readFileSync32 } from "fs";
|
|
177608
177744
|
function detectConfigPath() {
|
|
177609
177745
|
const paths2 = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
177610
|
-
if (
|
|
177746
|
+
if (existsSync47(paths2.configJsonc))
|
|
177611
177747
|
return paths2.configJsonc;
|
|
177612
|
-
if (
|
|
177748
|
+
if (existsSync47(paths2.configJson))
|
|
177613
177749
|
return paths2.configJson;
|
|
177614
177750
|
return null;
|
|
177615
177751
|
}
|
|
@@ -177699,35 +177835,35 @@ init_auto_update_checker();
|
|
|
177699
177835
|
init_package_json_locator();
|
|
177700
177836
|
init_constants5();
|
|
177701
177837
|
init_shared();
|
|
177702
|
-
import { existsSync as
|
|
177838
|
+
import { existsSync as existsSync48, readFileSync as readFileSync33, readdirSync as readdirSync8 } from "fs";
|
|
177703
177839
|
import { createRequire as createRequire2 } from "module";
|
|
177704
|
-
import { homedir as
|
|
177705
|
-
import { join as
|
|
177840
|
+
import { homedir as homedir13 } from "os";
|
|
177841
|
+
import { join as join42 } from "path";
|
|
177706
177842
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
177707
177843
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
177708
177844
|
if (platform === "darwin")
|
|
177709
|
-
return
|
|
177845
|
+
return join42(homedir13(), "Library", "Caches");
|
|
177710
177846
|
if (platform === "win32")
|
|
177711
|
-
return process.env.LOCALAPPDATA ??
|
|
177712
|
-
return
|
|
177847
|
+
return process.env.LOCALAPPDATA ?? join42(homedir13(), "AppData", "Local");
|
|
177848
|
+
return join42(homedir13(), ".cache");
|
|
177713
177849
|
}
|
|
177714
177850
|
function resolveOpenCodeCacheDir() {
|
|
177715
177851
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
177716
177852
|
if (xdgCacheHome)
|
|
177717
|
-
return
|
|
177853
|
+
return join42(xdgCacheHome, "opencode");
|
|
177718
177854
|
const fromShared = getOpenCodeCacheDir();
|
|
177719
|
-
const platformDefault =
|
|
177720
|
-
if (
|
|
177855
|
+
const platformDefault = join42(getPlatformDefaultCacheDir(), "opencode");
|
|
177856
|
+
if (existsSync48(fromShared) || !existsSync48(platformDefault))
|
|
177721
177857
|
return fromShared;
|
|
177722
177858
|
return platformDefault;
|
|
177723
177859
|
}
|
|
177724
177860
|
function resolveExistingDir(dirPath) {
|
|
177725
|
-
if (!
|
|
177861
|
+
if (!existsSync48(dirPath))
|
|
177726
177862
|
return dirPath;
|
|
177727
177863
|
return resolveSymlink(dirPath);
|
|
177728
177864
|
}
|
|
177729
177865
|
function readPackageJson(filePath) {
|
|
177730
|
-
if (!
|
|
177866
|
+
if (!existsSync48(filePath))
|
|
177731
177867
|
return null;
|
|
177732
177868
|
try {
|
|
177733
177869
|
const content = readFileSync33(filePath, "utf-8");
|
|
@@ -177748,26 +177884,26 @@ function normalizeVersion(value) {
|
|
|
177748
177884
|
function createPackageCandidates(rootDir) {
|
|
177749
177885
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
177750
177886
|
packageName,
|
|
177751
|
-
installedPackagePath:
|
|
177887
|
+
installedPackagePath: join42(rootDir, "node_modules", packageName, "package.json")
|
|
177752
177888
|
}));
|
|
177753
177889
|
}
|
|
177754
177890
|
function createTaggedInstallCandidates(rootDir) {
|
|
177755
|
-
const packagesDir =
|
|
177756
|
-
if (!
|
|
177891
|
+
const packagesDir = join42(rootDir, "packages");
|
|
177892
|
+
if (!existsSync48(packagesDir))
|
|
177757
177893
|
return [];
|
|
177758
177894
|
const candidates = [];
|
|
177759
|
-
for (const entryName of
|
|
177895
|
+
for (const entryName of readdirSync8(packagesDir).sort()) {
|
|
177760
177896
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name2) => entryName.startsWith(`${name2}@`));
|
|
177761
177897
|
if (packageName === undefined)
|
|
177762
177898
|
continue;
|
|
177763
|
-
const installDir =
|
|
177899
|
+
const installDir = join42(packagesDir, entryName);
|
|
177764
177900
|
candidates.push({
|
|
177765
177901
|
cacheDir: installDir,
|
|
177766
|
-
cachePackagePath:
|
|
177902
|
+
cachePackagePath: join42(installDir, "package.json"),
|
|
177767
177903
|
packageCandidates: [
|
|
177768
177904
|
{
|
|
177769
177905
|
packageName,
|
|
177770
|
-
installedPackagePath:
|
|
177906
|
+
installedPackagePath: join42(installDir, "node_modules", packageName, "package.json")
|
|
177771
177907
|
}
|
|
177772
177908
|
]
|
|
177773
177909
|
});
|
|
@@ -177775,7 +177911,7 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
177775
177911
|
return candidates;
|
|
177776
177912
|
}
|
|
177777
177913
|
function selectInstalledPackage(candidate) {
|
|
177778
|
-
return candidate.packageCandidates.find((packageCandidate) =>
|
|
177914
|
+
return candidate.packageCandidates.find((packageCandidate) => existsSync48(packageCandidate.installedPackagePath)) ?? candidate.packageCandidates[0];
|
|
177779
177915
|
}
|
|
177780
177916
|
function getExpectedVersion(cachePackage, packageName) {
|
|
177781
177917
|
return normalizeVersion(cachePackage?.dependencies?.[packageName]) ?? normalizeVersion(cachePackage?.dependencies?.[PACKAGE_NAME]);
|
|
@@ -177786,7 +177922,7 @@ function resolveInstalledPackageJsonPath() {
|
|
|
177786
177922
|
for (const packageName of ACCEPTED_PACKAGE_NAMES) {
|
|
177787
177923
|
try {
|
|
177788
177924
|
const packageJsonPath = require2.resolve(`${packageName}/package.json`);
|
|
177789
|
-
if (
|
|
177925
|
+
if (existsSync48(packageJsonPath)) {
|
|
177790
177926
|
return { packageName, packageJsonPath };
|
|
177791
177927
|
}
|
|
177792
177928
|
} catch {
|
|
@@ -177812,22 +177948,22 @@ function getLoadedPluginVersion() {
|
|
|
177812
177948
|
const candidates = [
|
|
177813
177949
|
{
|
|
177814
177950
|
cacheDir: configDir,
|
|
177815
|
-
cachePackagePath:
|
|
177951
|
+
cachePackagePath: join42(configDir, "package.json"),
|
|
177816
177952
|
packageCandidates: createPackageCandidates(configDir)
|
|
177817
177953
|
},
|
|
177818
177954
|
...createTaggedInstallCandidates(configDir),
|
|
177819
177955
|
{
|
|
177820
177956
|
cacheDir,
|
|
177821
|
-
cachePackagePath:
|
|
177957
|
+
cachePackagePath: join42(cacheDir, "package.json"),
|
|
177822
177958
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
177823
177959
|
},
|
|
177824
177960
|
...createTaggedInstallCandidates(cacheDir)
|
|
177825
177961
|
];
|
|
177826
|
-
const selectedCandidate = candidates.find((candidate) => candidate.packageCandidates.some((packageCandidate) =>
|
|
177962
|
+
const selectedCandidate = candidates.find((candidate) => candidate.packageCandidates.some((packageCandidate) => existsSync48(packageCandidate.installedPackagePath))) ?? candidates[0];
|
|
177827
177963
|
const { cacheDir: selectedDir, cachePackagePath } = selectedCandidate;
|
|
177828
177964
|
const selectedPackage = selectInstalledPackage(selectedCandidate);
|
|
177829
177965
|
const candidateInstalledPath = selectedPackage.installedPackagePath;
|
|
177830
|
-
const candidateExists =
|
|
177966
|
+
const candidateExists = existsSync48(candidateInstalledPath);
|
|
177831
177967
|
const resolvedFallback = candidateExists ? null : resolveInstalledPackageJsonPath();
|
|
177832
177968
|
const installedPackagePath = resolvedFallback?.packageJsonPath ?? candidateInstalledPath;
|
|
177833
177969
|
const resolvedPackageName = resolvedFallback?.packageName ?? selectedPackage.packageName;
|
|
@@ -177863,7 +177999,7 @@ var defaultDeps6 = {
|
|
|
177863
177999
|
getLoadedPluginVersion,
|
|
177864
178000
|
getLatestPluginVersion,
|
|
177865
178001
|
getSuggestedInstallTag,
|
|
177866
|
-
configExists:
|
|
178002
|
+
configExists: existsSync49,
|
|
177867
178003
|
readConfigFile: (path14) => readFileSync34(path14, "utf-8"),
|
|
177868
178004
|
parseConfigContent: (content) => parseJsonc(content)
|
|
177869
178005
|
};
|
|
@@ -178010,12 +178146,12 @@ async function checkSystem(deps = defaultDeps6) {
|
|
|
178010
178146
|
// packages/omo-opencode/src/config/validate.ts
|
|
178011
178147
|
init_src();
|
|
178012
178148
|
import { readFileSync as readFileSync35 } from "fs";
|
|
178013
|
-
import { homedir as
|
|
178014
|
-
import { dirname as
|
|
178149
|
+
import { homedir as homedir14 } from "os";
|
|
178150
|
+
import { dirname as dirname19, relative as relative5 } from "path";
|
|
178015
178151
|
init_shared();
|
|
178016
178152
|
init_plugin_identity();
|
|
178017
178153
|
function resolveHomeDirectory2() {
|
|
178018
|
-
return process.env.HOME ?? process.env.USERPROFILE ??
|
|
178154
|
+
return process.env.HOME ?? process.env.USERPROFILE ?? homedir14();
|
|
178019
178155
|
}
|
|
178020
178156
|
function discoverConfigInDirectory(configDir) {
|
|
178021
178157
|
const detected = detectPluginConfigFile(configDir, {
|
|
@@ -178035,7 +178171,7 @@ function discoverProjectLayersNearestFirst(directory) {
|
|
|
178035
178171
|
const stopDirectory = containsPath(homeDirectory, directory) ? homeDirectory : directory;
|
|
178036
178172
|
return findProjectOpencodePluginConfigFiles(directory, stopDirectory).map((configPath) => ({
|
|
178037
178173
|
path: configPath,
|
|
178038
|
-
configDir:
|
|
178174
|
+
configDir: dirname19(configPath)
|
|
178039
178175
|
}));
|
|
178040
178176
|
}
|
|
178041
178177
|
function shortPath(configPath) {
|
|
@@ -178059,7 +178195,7 @@ function parseLayerConfig(configPath) {
|
|
|
178059
178195
|
if (!isPlainRecord(rawConfig)) {
|
|
178060
178196
|
return {
|
|
178061
178197
|
path: configPath,
|
|
178062
|
-
configDir:
|
|
178198
|
+
configDir: dirname19(configPath),
|
|
178063
178199
|
config: null,
|
|
178064
178200
|
messages: [`${shortPath(configPath)}: <root>: Expected object`]
|
|
178065
178201
|
};
|
|
@@ -178067,7 +178203,7 @@ function parseLayerConfig(configPath) {
|
|
|
178067
178203
|
const result = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
|
|
178068
178204
|
return {
|
|
178069
178205
|
path: configPath,
|
|
178070
|
-
configDir:
|
|
178206
|
+
configDir: dirname19(configPath),
|
|
178071
178207
|
config: result.success ? result.data : parseConfigPartially(rawConfig),
|
|
178072
178208
|
messages: schemaMessages(configPath, rawConfig)
|
|
178073
178209
|
};
|
|
@@ -178077,7 +178213,7 @@ function parseLayerConfig(configPath) {
|
|
|
178077
178213
|
}
|
|
178078
178214
|
return {
|
|
178079
178215
|
path: configPath,
|
|
178080
|
-
configDir:
|
|
178216
|
+
configDir: dirname19(configPath),
|
|
178081
178217
|
config: null,
|
|
178082
178218
|
messages: [`${shortPath(configPath)}: ${error51.message}`]
|
|
178083
178219
|
};
|
|
@@ -178126,23 +178262,23 @@ init_constants5();
|
|
|
178126
178262
|
|
|
178127
178263
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-cache.ts
|
|
178128
178264
|
init_shared();
|
|
178129
|
-
import { existsSync as
|
|
178130
|
-
import { homedir as
|
|
178131
|
-
import { join as
|
|
178265
|
+
import { existsSync as existsSync50, readFileSync as readFileSync36 } from "fs";
|
|
178266
|
+
import { homedir as homedir15 } from "os";
|
|
178267
|
+
import { join as join43 } from "path";
|
|
178132
178268
|
function getUserConfigDir2() {
|
|
178133
178269
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
178134
178270
|
if (xdgConfig)
|
|
178135
|
-
return
|
|
178136
|
-
return
|
|
178271
|
+
return join43(xdgConfig, "opencode");
|
|
178272
|
+
return join43(homedir15(), ".config", "opencode");
|
|
178137
178273
|
}
|
|
178138
178274
|
function loadCustomProviderNames() {
|
|
178139
178275
|
const configDir = getUserConfigDir2();
|
|
178140
178276
|
const candidatePaths = [
|
|
178141
|
-
|
|
178142
|
-
|
|
178277
|
+
join43(configDir, "opencode.json"),
|
|
178278
|
+
join43(configDir, "opencode.jsonc")
|
|
178143
178279
|
];
|
|
178144
178280
|
for (const configPath of candidatePaths) {
|
|
178145
|
-
if (!
|
|
178281
|
+
if (!existsSync50(configPath))
|
|
178146
178282
|
continue;
|
|
178147
178283
|
try {
|
|
178148
178284
|
const content = readFileSync36(configPath, "utf-8");
|
|
@@ -178160,9 +178296,9 @@ function loadCustomProviderNames() {
|
|
|
178160
178296
|
return [];
|
|
178161
178297
|
}
|
|
178162
178298
|
function loadAvailableModelsFromCache() {
|
|
178163
|
-
const cacheFile =
|
|
178299
|
+
const cacheFile = join43(getOpenCodeCacheDir(), "models.json");
|
|
178164
178300
|
const customProviders = loadCustomProviderNames();
|
|
178165
|
-
if (!
|
|
178301
|
+
if (!existsSync50(cacheFile)) {
|
|
178166
178302
|
if (customProviders.length > 0) {
|
|
178167
178303
|
return { providers: customProviders, modelCount: 0, cacheExists: true };
|
|
178168
178304
|
}
|
|
@@ -178198,8 +178334,8 @@ init_constants5();
|
|
|
178198
178334
|
init_shared();
|
|
178199
178335
|
init_plugin_identity();
|
|
178200
178336
|
import { readFileSync as readFileSync37 } from "fs";
|
|
178201
|
-
import { join as
|
|
178202
|
-
var PROJECT_CONFIG_DIR =
|
|
178337
|
+
import { join as join44 } from "path";
|
|
178338
|
+
var PROJECT_CONFIG_DIR = join44(process.cwd(), ".opencode");
|
|
178203
178339
|
function loadOmoConfig() {
|
|
178204
178340
|
const projectDetected = detectPluginConfigFile(PROJECT_CONFIG_DIR, {
|
|
178205
178341
|
basenames: [CONFIG_BASENAME],
|
|
@@ -178237,7 +178373,7 @@ function loadOmoConfig() {
|
|
|
178237
178373
|
|
|
178238
178374
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
178239
178375
|
init_shared();
|
|
178240
|
-
import { join as
|
|
178376
|
+
import { join as join45 } from "path";
|
|
178241
178377
|
|
|
178242
178378
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
178243
178379
|
function formatModelWithVariant(model, variant) {
|
|
@@ -178279,7 +178415,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
178279
178415
|
}
|
|
178280
178416
|
function buildModelResolutionDetails(options) {
|
|
178281
178417
|
const details = [];
|
|
178282
|
-
const cacheFile =
|
|
178418
|
+
const cacheFile = join45(getOpenCodeCacheDir(), "models.json");
|
|
178283
178419
|
details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
|
|
178284
178420
|
details.push("");
|
|
178285
178421
|
if (options.available.cacheExists) {
|
|
@@ -178555,28 +178691,28 @@ async function checkConfig() {
|
|
|
178555
178691
|
|
|
178556
178692
|
// packages/omo-opencode/src/cli/doctor/checks/dependencies.ts
|
|
178557
178693
|
init_src();
|
|
178558
|
-
import { existsSync as
|
|
178694
|
+
import { existsSync as existsSync51 } from "fs";
|
|
178559
178695
|
import { createRequire as createRequire3 } from "module";
|
|
178560
|
-
import { homedir as
|
|
178561
|
-
import { dirname as
|
|
178696
|
+
import { homedir as homedir17 } from "os";
|
|
178697
|
+
import { dirname as dirname20, join as join47 } from "path";
|
|
178562
178698
|
|
|
178563
178699
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
178564
|
-
import { join as
|
|
178565
|
-
import { homedir as
|
|
178700
|
+
import { join as join46 } from "path";
|
|
178701
|
+
import { homedir as homedir16, tmpdir as tmpdir3 } from "os";
|
|
178566
178702
|
init_binary_downloader();
|
|
178567
178703
|
init_logger2();
|
|
178568
178704
|
init_plugin_identity();
|
|
178569
178705
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
178570
|
-
var DEBUG_FILE =
|
|
178706
|
+
var DEBUG_FILE = join46(tmpdir3(), "comment-checker-debug.log");
|
|
178571
178707
|
function getCacheDir2() {
|
|
178572
178708
|
if (process.platform === "win32") {
|
|
178573
178709
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
178574
|
-
const base2 = localAppData ||
|
|
178575
|
-
return
|
|
178710
|
+
const base2 = localAppData || join46(homedir16(), "AppData", "Local");
|
|
178711
|
+
return join46(base2, CACHE_DIR_NAME, "bin");
|
|
178576
178712
|
}
|
|
178577
178713
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
178578
|
-
const base = xdgCache ||
|
|
178579
|
-
return
|
|
178714
|
+
const base = xdgCache || join46(homedir16(), ".cache");
|
|
178715
|
+
return join46(base, CACHE_DIR_NAME, "bin");
|
|
178580
178716
|
}
|
|
178581
178717
|
function getBinaryName() {
|
|
178582
178718
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -178626,7 +178762,7 @@ async function getBinaryVersion(binary2) {
|
|
|
178626
178762
|
}
|
|
178627
178763
|
}
|
|
178628
178764
|
async function checkAstGrepCli() {
|
|
178629
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
178765
|
+
const runtimeDir = astGrepRuntimeDir(join47(homedir17(), ".omo"));
|
|
178630
178766
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
178631
178767
|
if (sgPath === null) {
|
|
178632
178768
|
return {
|
|
@@ -178655,12 +178791,12 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
178655
178791
|
const binaryName = process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
178656
178792
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
178657
178793
|
try {
|
|
178658
|
-
const packageDir = baseDirOverride ??
|
|
178659
|
-
const vendorPath =
|
|
178660
|
-
if (
|
|
178794
|
+
const packageDir = baseDirOverride ?? dirname20(resolvePackageJsonPath());
|
|
178795
|
+
const vendorPath = join47(packageDir, "vendor", platformKey, binaryName);
|
|
178796
|
+
if (existsSync51(vendorPath))
|
|
178661
178797
|
return vendorPath;
|
|
178662
|
-
const binPath =
|
|
178663
|
-
if (
|
|
178798
|
+
const binPath = join47(packageDir, "bin", binaryName);
|
|
178799
|
+
if (existsSync51(binPath))
|
|
178664
178800
|
return binPath;
|
|
178665
178801
|
} catch (error51) {
|
|
178666
178802
|
if (!(error51 instanceof Error) && !isModuleResolutionFailure(error51))
|
|
@@ -178805,13 +178941,13 @@ async function getGhCliInfo(dependencies = {}) {
|
|
|
178805
178941
|
|
|
178806
178942
|
// packages/omo-opencode/src/cli/doctor/checks/tools-lsp.ts
|
|
178807
178943
|
import { readFileSync as readFileSync39 } from "fs";
|
|
178808
|
-
import { join as
|
|
178944
|
+
import { join as join48 } from "path";
|
|
178809
178945
|
|
|
178810
178946
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
178811
178947
|
init_zod();
|
|
178812
178948
|
init_opencode_config_dir();
|
|
178813
|
-
import { existsSync as
|
|
178814
|
-
import { delimiter as delimiter3, dirname as
|
|
178949
|
+
import { existsSync as existsSync52, readFileSync as readFileSync38 } from "fs";
|
|
178950
|
+
import { delimiter as delimiter3, dirname as dirname21, resolve as resolve10 } from "path";
|
|
178815
178951
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
178816
178952
|
|
|
178817
178953
|
// packages/omo-opencode/src/mcp/cli-suffix.ts
|
|
@@ -178824,7 +178960,7 @@ function hasCliSuffix(candidatePath, suffix) {
|
|
|
178824
178960
|
|
|
178825
178961
|
// packages/omo-opencode/src/mcp/runtime-executable.ts
|
|
178826
178962
|
init_bun_which_shim();
|
|
178827
|
-
import { basename as
|
|
178963
|
+
import { basename as basename8 } from "path";
|
|
178828
178964
|
var NODE_EXECUTABLE_NAMES = new Set(["node", "node.exe"]);
|
|
178829
178965
|
function isUnsafeCommandName2(commandName) {
|
|
178830
178966
|
if (commandName.length === 0)
|
|
@@ -178840,7 +178976,7 @@ function isUnsafeCommandName2(commandName) {
|
|
|
178840
178976
|
return false;
|
|
178841
178977
|
}
|
|
178842
178978
|
function isNodeExecPath(execPath) {
|
|
178843
|
-
return NODE_EXECUTABLE_NAMES.has(
|
|
178979
|
+
return NODE_EXECUTABLE_NAMES.has(basename8(execPath).toLowerCase());
|
|
178844
178980
|
}
|
|
178845
178981
|
function resolveRuntimeExecutable(commandName, options = {}) {
|
|
178846
178982
|
if (isUnsafeCommandName2(commandName)) {
|
|
@@ -178942,7 +179078,7 @@ var LSP_BOOTSTRAP_SCRIPT = [
|
|
|
178942
179078
|
].join(";");
|
|
178943
179079
|
function getModuleDirectory(moduleUrl) {
|
|
178944
179080
|
try {
|
|
178945
|
-
return
|
|
179081
|
+
return dirname21(fileURLToPath6(moduleUrl));
|
|
178946
179082
|
} catch (error51) {
|
|
178947
179083
|
if (!(error51 instanceof Error))
|
|
178948
179084
|
throw error51;
|
|
@@ -178976,7 +179112,7 @@ function createBootstrapCandidate(root, pathExists, resolveExecutable) {
|
|
|
178976
179112
|
};
|
|
178977
179113
|
}
|
|
178978
179114
|
function resolveLspCommand(options = {}) {
|
|
178979
|
-
const pathExists = options.exists ??
|
|
179115
|
+
const pathExists = options.exists ?? existsSync52;
|
|
178980
179116
|
const resolveExecutable = options.resolveExecutable ?? resolveRuntimeExecutable;
|
|
178981
179117
|
const moduleDirectory = getModuleDirectory(options.moduleUrl ?? import.meta.url);
|
|
178982
179118
|
const candidates = moduleDirectory ? createAncestorCliCandidates({
|
|
@@ -179042,7 +179178,7 @@ function readOmoConfig(configDirectory) {
|
|
|
179042
179178
|
}
|
|
179043
179179
|
function isLspMcpDisabled(options) {
|
|
179044
179180
|
const userConfigDirectory = options.configDirectory ?? getOpenCodeConfigDir({ binary: "opencode" });
|
|
179045
|
-
const projectConfigDirectory =
|
|
179181
|
+
const projectConfigDirectory = join48(options.cwd ?? process.cwd(), ".opencode");
|
|
179046
179182
|
const userConfig = readOmoConfig(userConfigDirectory);
|
|
179047
179183
|
const projectConfig = readOmoConfig(projectConfigDirectory);
|
|
179048
179184
|
const disabledMcps = new Set([
|
|
@@ -179061,21 +179197,21 @@ function getInstalledLspServers(options = {}) {
|
|
|
179061
179197
|
|
|
179062
179198
|
// packages/omo-opencode/src/cli/doctor/checks/tools-mcp.ts
|
|
179063
179199
|
init_shared();
|
|
179064
|
-
import { existsSync as
|
|
179065
|
-
import { homedir as
|
|
179066
|
-
import { join as
|
|
179200
|
+
import { existsSync as existsSync53, readFileSync as readFileSync40 } from "fs";
|
|
179201
|
+
import { homedir as homedir18 } from "os";
|
|
179202
|
+
import { join as join49 } from "path";
|
|
179067
179203
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
179068
179204
|
function getMcpConfigPaths() {
|
|
179069
179205
|
return [
|
|
179070
|
-
|
|
179071
|
-
|
|
179072
|
-
|
|
179206
|
+
join49(homedir18(), ".claude", ".mcp.json"),
|
|
179207
|
+
join49(process.cwd(), ".mcp.json"),
|
|
179208
|
+
join49(process.cwd(), ".claude", ".mcp.json")
|
|
179073
179209
|
];
|
|
179074
179210
|
}
|
|
179075
179211
|
function loadUserMcpConfig() {
|
|
179076
179212
|
const servers = {};
|
|
179077
179213
|
for (const configPath of getMcpConfigPaths()) {
|
|
179078
|
-
if (!
|
|
179214
|
+
if (!existsSync53(configPath))
|
|
179079
179215
|
continue;
|
|
179080
179216
|
try {
|
|
179081
179217
|
const content = readFileSync40(configPath, "utf-8");
|
|
@@ -179213,13 +179349,13 @@ async function checkTools() {
|
|
|
179213
179349
|
}
|
|
179214
179350
|
|
|
179215
179351
|
// packages/omo-opencode/src/cli/doctor/checks/telemetry.ts
|
|
179216
|
-
import { existsSync as
|
|
179352
|
+
import { existsSync as existsSync54, readFileSync as readFileSync41 } from "fs";
|
|
179217
179353
|
init_constants5();
|
|
179218
179354
|
function isTelemetryState(value) {
|
|
179219
179355
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
179220
179356
|
}
|
|
179221
179357
|
function readLastActiveDay(stateFilePath) {
|
|
179222
|
-
if (!
|
|
179358
|
+
if (!existsSync54(stateFilePath)) {
|
|
179223
179359
|
return "never";
|
|
179224
179360
|
}
|
|
179225
179361
|
let parsed;
|
|
@@ -179282,17 +179418,17 @@ async function probeBinary(cmd, args, spawnImpl) {
|
|
|
179282
179418
|
}
|
|
179283
179419
|
|
|
179284
179420
|
// packages/team-core/src/team-registry/paths.ts
|
|
179285
|
-
import { homedir as
|
|
179421
|
+
import { homedir as homedir19 } from "os";
|
|
179286
179422
|
import path14 from "path";
|
|
179287
179423
|
function resolveBaseDir(config5) {
|
|
179288
|
-
return expandHomeDirectory(config5.base_dir ?? path14.join(
|
|
179424
|
+
return expandHomeDirectory(config5.base_dir ?? path14.join(homedir19(), ".omo"));
|
|
179289
179425
|
}
|
|
179290
179426
|
function expandHomeDirectory(directoryPath) {
|
|
179291
179427
|
if (directoryPath === "~") {
|
|
179292
|
-
return
|
|
179428
|
+
return homedir19();
|
|
179293
179429
|
}
|
|
179294
179430
|
if (directoryPath.startsWith("~/") || directoryPath.startsWith("~\\")) {
|
|
179295
|
-
return path14.join(
|
|
179431
|
+
return path14.join(homedir19(), directoryPath.slice(2));
|
|
179296
179432
|
}
|
|
179297
179433
|
return directoryPath;
|
|
179298
179434
|
}
|
|
@@ -179775,23 +179911,23 @@ Doctor failed unexpectedly: ${message}`];
|
|
|
179775
179911
|
import { createHash as createHash3 } from "crypto";
|
|
179776
179912
|
import {
|
|
179777
179913
|
chmodSync as chmodSync6,
|
|
179778
|
-
existsSync as
|
|
179779
|
-
mkdirSync as
|
|
179780
|
-
readdirSync as
|
|
179914
|
+
existsSync as existsSync57,
|
|
179915
|
+
mkdirSync as mkdirSync16,
|
|
179916
|
+
readdirSync as readdirSync9,
|
|
179781
179917
|
readFileSync as readFileSync44,
|
|
179782
179918
|
renameSync as renameSync7,
|
|
179783
|
-
unlinkSync as
|
|
179919
|
+
unlinkSync as unlinkSync9,
|
|
179784
179920
|
writeFileSync as writeFileSync14
|
|
179785
179921
|
} from "fs";
|
|
179786
|
-
import { basename as
|
|
179922
|
+
import { basename as basename9, dirname as dirname22, join as join52 } from "path";
|
|
179787
179923
|
|
|
179788
179924
|
// packages/mcp-client-core/src/config-dir.ts
|
|
179789
|
-
import { existsSync as
|
|
179790
|
-
import { homedir as
|
|
179791
|
-
import { join as
|
|
179925
|
+
import { existsSync as existsSync55, realpathSync as realpathSync7 } from "fs";
|
|
179926
|
+
import { homedir as homedir20 } from "os";
|
|
179927
|
+
import { join as join50, resolve as resolve11 } from "path";
|
|
179792
179928
|
function resolveConfigPath2(pathValue) {
|
|
179793
179929
|
const resolvedPath = resolve11(pathValue);
|
|
179794
|
-
if (!
|
|
179930
|
+
if (!existsSync55(resolvedPath))
|
|
179795
179931
|
return resolvedPath;
|
|
179796
179932
|
try {
|
|
179797
179933
|
return realpathSync7(resolvedPath);
|
|
@@ -179806,13 +179942,13 @@ function getOpenCodeCliConfigDir(env2 = process.env) {
|
|
|
179806
179942
|
if (customConfigDir) {
|
|
179807
179943
|
return resolveConfigPath2(customConfigDir);
|
|
179808
179944
|
}
|
|
179809
|
-
const xdgConfigDir = env2["XDG_CONFIG_HOME"]?.trim() ||
|
|
179810
|
-
return resolveConfigPath2(
|
|
179945
|
+
const xdgConfigDir = env2["XDG_CONFIG_HOME"]?.trim() || join50(homedir20(), ".config");
|
|
179946
|
+
return resolveConfigPath2(join50(xdgConfigDir, "opencode"));
|
|
179811
179947
|
}
|
|
179812
179948
|
|
|
179813
179949
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
179814
|
-
import { chmodSync as chmodSync5, existsSync as
|
|
179815
|
-
import { join as
|
|
179950
|
+
import { chmodSync as chmodSync5, existsSync as existsSync56, readFileSync as readFileSync43, renameSync as renameSync6, writeFileSync as writeFileSync13 } from "fs";
|
|
179951
|
+
import { join as join51 } from "path";
|
|
179816
179952
|
var INDEX_FILE_NAME = "index.json";
|
|
179817
179953
|
function isTokenIndex(value) {
|
|
179818
179954
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -179820,11 +179956,11 @@ function isTokenIndex(value) {
|
|
|
179820
179956
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
179821
179957
|
}
|
|
179822
179958
|
function getIndexPath(storageDir) {
|
|
179823
|
-
return
|
|
179959
|
+
return join51(storageDir, INDEX_FILE_NAME);
|
|
179824
179960
|
}
|
|
179825
179961
|
function readTokenIndex(storageDir) {
|
|
179826
179962
|
const indexPath = getIndexPath(storageDir);
|
|
179827
|
-
if (!
|
|
179963
|
+
if (!existsSync56(indexPath))
|
|
179828
179964
|
return {};
|
|
179829
179965
|
try {
|
|
179830
179966
|
const parsed = JSON.parse(readFileSync43(indexPath, "utf-8"));
|
|
@@ -179864,16 +180000,16 @@ function deleteTokenIndexEntry(storageDir, hash2) {
|
|
|
179864
180000
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
179865
180001
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
179866
180002
|
function getMcpOauthStorageDir() {
|
|
179867
|
-
return
|
|
180003
|
+
return join52(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
179868
180004
|
}
|
|
179869
180005
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
179870
180006
|
return createHash3("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
179871
180007
|
}
|
|
179872
180008
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
179873
|
-
return
|
|
180009
|
+
return join52(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
179874
180010
|
}
|
|
179875
180011
|
function getLegacyStoragePath() {
|
|
179876
|
-
return
|
|
180012
|
+
return join52(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
179877
180013
|
}
|
|
179878
180014
|
function normalizeHost2(serverHost) {
|
|
179879
180015
|
let host = serverHost.trim();
|
|
@@ -179934,7 +180070,7 @@ function isOAuthTokenData(value) {
|
|
|
179934
180070
|
return clientSecret === undefined || typeof clientSecret === "string";
|
|
179935
180071
|
}
|
|
179936
180072
|
function readTokenFile(filePath) {
|
|
179937
|
-
if (!
|
|
180073
|
+
if (!existsSync57(filePath))
|
|
179938
180074
|
return null;
|
|
179939
180075
|
try {
|
|
179940
180076
|
const parsed = JSON.parse(readFileSync44(filePath, "utf-8"));
|
|
@@ -179947,7 +180083,7 @@ function readTokenFile(filePath) {
|
|
|
179947
180083
|
}
|
|
179948
180084
|
function readLegacyStore() {
|
|
179949
180085
|
const filePath = getLegacyStoragePath();
|
|
179950
|
-
if (!
|
|
180086
|
+
if (!existsSync57(filePath))
|
|
179951
180087
|
return null;
|
|
179952
180088
|
try {
|
|
179953
180089
|
const parsed = JSON.parse(readFileSync44(filePath, "utf-8"));
|
|
@@ -179967,9 +180103,9 @@ function readLegacyStore() {
|
|
|
179967
180103
|
}
|
|
179968
180104
|
function writeTokenFile(filePath, token) {
|
|
179969
180105
|
try {
|
|
179970
|
-
const dir =
|
|
179971
|
-
if (!
|
|
179972
|
-
|
|
180106
|
+
const dir = dirname22(filePath);
|
|
180107
|
+
if (!existsSync57(dir)) {
|
|
180108
|
+
mkdirSync16(dir, { recursive: true });
|
|
179973
180109
|
}
|
|
179974
180110
|
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
179975
180111
|
writeFileSync14(tempPath, JSON.stringify(token, null, 2), { encoding: "utf-8", mode: 384 });
|
|
@@ -179992,10 +180128,10 @@ function saveToken(serverHost, resource, token) {
|
|
|
179992
180128
|
}
|
|
179993
180129
|
function deleteToken(serverHost, resource) {
|
|
179994
180130
|
const filePath = getMcpOauthStoragePath(serverHost, resource);
|
|
179995
|
-
if (!
|
|
180131
|
+
if (!existsSync57(filePath))
|
|
179996
180132
|
return deleteLegacyToken(serverHost, resource);
|
|
179997
180133
|
try {
|
|
179998
|
-
|
|
180134
|
+
unlinkSync9(filePath);
|
|
179999
180135
|
return deleteTokenIndexEntry(getMcpOauthStorageDir(), getMcpOauthServerHash(serverHost, resource));
|
|
180000
180136
|
} catch (deleteError) {
|
|
180001
180137
|
if (!(deleteError instanceof Error))
|
|
@@ -180014,8 +180150,8 @@ function deleteLegacyToken(serverHost, resource) {
|
|
|
180014
180150
|
if (Object.keys(store2).length === 0) {
|
|
180015
180151
|
try {
|
|
180016
180152
|
const filePath = getLegacyStoragePath();
|
|
180017
|
-
if (
|
|
180018
|
-
|
|
180153
|
+
if (existsSync57(filePath))
|
|
180154
|
+
unlinkSync9(filePath);
|
|
180019
180155
|
return true;
|
|
180020
180156
|
} catch (deleteError) {
|
|
180021
180157
|
if (!(deleteError instanceof Error))
|
|
@@ -180052,7 +180188,7 @@ function listTokensByHost(serverHost) {
|
|
|
180052
180188
|
for (const [hash2, indexedKey] of Object.entries(index)) {
|
|
180053
180189
|
if (!indexedKey.startsWith(prefix))
|
|
180054
180190
|
continue;
|
|
180055
|
-
const indexedToken = readTokenFile(
|
|
180191
|
+
const indexedToken = readTokenFile(join52(getMcpOauthStorageDir(), `${hash2}.json`));
|
|
180056
180192
|
if (indexedToken)
|
|
180057
180193
|
result[indexedKey] = indexedToken;
|
|
180058
180194
|
}
|
|
@@ -180061,14 +180197,14 @@ function listTokensByHost(serverHost) {
|
|
|
180061
180197
|
function listAllTokens() {
|
|
180062
180198
|
const result = { ...readLegacyStore() ?? {} };
|
|
180063
180199
|
const dir = getMcpOauthStorageDir();
|
|
180064
|
-
if (!
|
|
180200
|
+
if (!existsSync57(dir))
|
|
180065
180201
|
return result;
|
|
180066
180202
|
const index = readTokenIndex(dir);
|
|
180067
|
-
for (const entry of
|
|
180203
|
+
for (const entry of readdirSync9(dir, { withFileTypes: true })) {
|
|
180068
180204
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
180069
180205
|
continue;
|
|
180070
|
-
const token = readTokenFile(
|
|
180071
|
-
const hash2 =
|
|
180206
|
+
const token = readTokenFile(join52(dir, entry.name));
|
|
180207
|
+
const hash2 = basename9(entry.name, ".json");
|
|
180072
180208
|
if (token)
|
|
180073
180209
|
result[index[hash2] ?? hash2] = token;
|
|
180074
180210
|
}
|
|
@@ -180763,8 +180899,8 @@ function createEmbeddingPort() {
|
|
|
180763
180899
|
// packages/learning-loop/src/codebase-scanner.ts
|
|
180764
180900
|
var import_picomatch = __toESM(require_picomatch2(), 1);
|
|
180765
180901
|
import { createHash as createHash5 } from "crypto";
|
|
180766
|
-
import { readdirSync as
|
|
180767
|
-
import { join as
|
|
180902
|
+
import { readdirSync as readdirSync10, readFileSync as readFileSync46, statSync as statSync7, existsSync as existsSync59 } from "fs";
|
|
180903
|
+
import { join as join53, relative as relative6, extname as extname3 } from "path";
|
|
180768
180904
|
var EXT_TO_LANG = {
|
|
180769
180905
|
ts: "typescript",
|
|
180770
180906
|
tsx: "typescript",
|
|
@@ -180818,7 +180954,7 @@ function detectLanguage(filePath) {
|
|
|
180818
180954
|
return EXT_TO_LANG[ext] ?? "text";
|
|
180819
180955
|
}
|
|
180820
180956
|
function loadGitignore(rootDir, fs18) {
|
|
180821
|
-
const gitignorePath =
|
|
180957
|
+
const gitignorePath = join53(rootDir, ".gitignore");
|
|
180822
180958
|
if (!fs18.exists(gitignorePath))
|
|
180823
180959
|
return [];
|
|
180824
180960
|
const content = fs18.readFile(gitignorePath);
|
|
@@ -180828,7 +180964,7 @@ function loadGitignore(rootDir, fs18) {
|
|
|
180828
180964
|
function defaultFs() {
|
|
180829
180965
|
return {
|
|
180830
180966
|
readdir(path18) {
|
|
180831
|
-
return
|
|
180967
|
+
return readdirSync10(path18);
|
|
180832
180968
|
},
|
|
180833
180969
|
readFile(path18) {
|
|
180834
180970
|
return readFileSync46(path18, "utf-8");
|
|
@@ -180838,7 +180974,7 @@ function defaultFs() {
|
|
|
180838
180974
|
return { size: s.size, mtimeMs: s.mtimeMs, isDirectory: () => s.isDirectory(), isFile: () => s.isFile() };
|
|
180839
180975
|
},
|
|
180840
180976
|
exists(path18) {
|
|
180841
|
-
return
|
|
180977
|
+
return existsSync59(path18);
|
|
180842
180978
|
}
|
|
180843
180979
|
};
|
|
180844
180980
|
}
|
|
@@ -180909,7 +181045,7 @@ function createCodebaseScanner(options = {}) {
|
|
|
180909
181045
|
return;
|
|
180910
181046
|
}
|
|
180911
181047
|
for (const entry of entries) {
|
|
180912
|
-
const fullPath =
|
|
181048
|
+
const fullPath = join53(dir, entry);
|
|
180913
181049
|
let stat;
|
|
180914
181050
|
try {
|
|
180915
181051
|
stat = fs18.stat(fullPath);
|
|
@@ -181184,14 +181320,14 @@ function formatSearchResults(result) {
|
|
|
181184
181320
|
}
|
|
181185
181321
|
|
|
181186
181322
|
// packages/learning-loop/src/improvement.ts
|
|
181187
|
-
import { existsSync as
|
|
181188
|
-
import { join as
|
|
181323
|
+
import { existsSync as existsSync60, mkdirSync as mkdirSync18, readFileSync as readFileSync47, writeFileSync as writeFileSync16 } from "fs";
|
|
181324
|
+
import { join as join54, basename as basename11 } from "path";
|
|
181189
181325
|
function createImprovementStore(improvementsDir) {
|
|
181190
|
-
if (!
|
|
181191
|
-
|
|
181326
|
+
if (!existsSync60(improvementsDir)) {
|
|
181327
|
+
mkdirSync18(improvementsDir, { recursive: true });
|
|
181192
181328
|
}
|
|
181193
181329
|
function save(improvement) {
|
|
181194
|
-
const filePath =
|
|
181330
|
+
const filePath = join54(improvementsDir, `${improvement.id}.json`);
|
|
181195
181331
|
writeFileSync16(filePath, JSON.stringify(improvement, null, 2), "utf-8");
|
|
181196
181332
|
}
|
|
181197
181333
|
function list() {
|
|
@@ -181206,10 +181342,10 @@ function createImprovementStore(improvementsDir) {
|
|
|
181206
181342
|
return [];
|
|
181207
181343
|
}
|
|
181208
181344
|
files.sort().reverse();
|
|
181209
|
-
return files.map((f2) => get(
|
|
181345
|
+
return files.map((f2) => get(basename11(f2, ".json"))).filter((i3) => i3 !== null);
|
|
181210
181346
|
}
|
|
181211
181347
|
function get(id) {
|
|
181212
|
-
const filePath =
|
|
181348
|
+
const filePath = join54(improvementsDir, `${id}.json`);
|
|
181213
181349
|
try {
|
|
181214
181350
|
const raw = readFileSync47(filePath, "utf-8");
|
|
181215
181351
|
return JSON.parse(raw);
|
|
@@ -181233,8 +181369,8 @@ function createImprovementStore(improvementsDir) {
|
|
|
181233
181369
|
}
|
|
181234
181370
|
function readdirSyncSafe(dir) {
|
|
181235
181371
|
try {
|
|
181236
|
-
const { readdirSync:
|
|
181237
|
-
return
|
|
181372
|
+
const { readdirSync: readdirSync11 } = __require("fs");
|
|
181373
|
+
return readdirSync11(dir);
|
|
181238
181374
|
} catch {
|
|
181239
181375
|
return;
|
|
181240
181376
|
}
|
|
@@ -181282,7 +181418,7 @@ async function applyLearningsCli(options = {}) {
|
|
|
181282
181418
|
}
|
|
181283
181419
|
|
|
181284
181420
|
// packages/omo-opencode/src/cli/boulder/boulder.ts
|
|
181285
|
-
import { existsSync as
|
|
181421
|
+
import { existsSync as existsSync62 } from "fs";
|
|
181286
181422
|
|
|
181287
181423
|
// packages/omo-opencode/src/cli/boulder/formatter.ts
|
|
181288
181424
|
var import_picocolors22 = __toESM(require_picocolors(), 1);
|
|
@@ -181419,10 +181555,10 @@ async function boulder(options) {
|
|
|
181419
181555
|
const boulderFilePath = getBoulderFilePath(directory);
|
|
181420
181556
|
const state2 = readBoulderState(directory);
|
|
181421
181557
|
if (!state2) {
|
|
181422
|
-
const message =
|
|
181558
|
+
const message = existsSync62(boulderFilePath) ? formatReadErrorMessage(options.json) : formatNoBoulderMessage(options.json);
|
|
181423
181559
|
process.stderr.write(`${message}
|
|
181424
181560
|
`);
|
|
181425
|
-
return
|
|
181561
|
+
return existsSync62(boulderFilePath) ? 2 : 1;
|
|
181426
181562
|
}
|
|
181427
181563
|
const works = getBoulderWorks(state2);
|
|
181428
181564
|
const filteredWorks = options.workId ? works.filter((work) => work.work_id === options.workId) : works;
|
|
@@ -182017,25 +182153,25 @@ async function refreshModelCapabilities(options, deps = {}) {
|
|
|
182017
182153
|
// packages/skills-loader-core/src/features/opencode-skill-loader/loader.ts
|
|
182018
182154
|
init_src();
|
|
182019
182155
|
init_shared_skills();
|
|
182020
|
-
import { join as
|
|
182156
|
+
import { join as join63 } from "path";
|
|
182021
182157
|
|
|
182022
182158
|
// packages/skills-loader-core/src/shared/claude-config-dir.ts
|
|
182023
182159
|
init_src();
|
|
182024
|
-
import { join as
|
|
182160
|
+
import { join as join57 } from "path";
|
|
182025
182161
|
function getClaudeConfigDir() {
|
|
182026
182162
|
const envConfigDir = process.env.CLAUDE_CONFIG_DIR;
|
|
182027
182163
|
if (envConfigDir) {
|
|
182028
182164
|
return envConfigDir;
|
|
182029
182165
|
}
|
|
182030
|
-
return
|
|
182166
|
+
return join57(getHomeDirectory(), ".claude");
|
|
182031
182167
|
}
|
|
182032
182168
|
// packages/skills-loader-core/src/shared/opencode-command-dirs.ts
|
|
182033
|
-
import { basename as
|
|
182169
|
+
import { basename as basename12, dirname as dirname23, join as join59 } from "path";
|
|
182034
182170
|
|
|
182035
182171
|
// packages/skills-loader-core/src/shared/opencode-config-dir.ts
|
|
182036
|
-
import { existsSync as
|
|
182037
|
-
import { homedir as
|
|
182038
|
-
import { join as
|
|
182172
|
+
import { existsSync as existsSync64, realpathSync as realpathSync8 } from "fs";
|
|
182173
|
+
import { homedir as homedir22 } from "os";
|
|
182174
|
+
import { join as join58, posix as posix5, resolve as resolve12, win32 as win325 } from "path";
|
|
182039
182175
|
|
|
182040
182176
|
// packages/skills-loader-core/src/shared/plugin-identity.ts
|
|
182041
182177
|
init_src();
|
|
@@ -182068,15 +182204,15 @@ function getTauriConfigDir2(identifier) {
|
|
|
182068
182204
|
const platform2 = process.platform;
|
|
182069
182205
|
switch (platform2) {
|
|
182070
182206
|
case "darwin":
|
|
182071
|
-
return
|
|
182207
|
+
return join58(homedir22(), "Library", "Application Support", identifier);
|
|
182072
182208
|
case "win32": {
|
|
182073
|
-
const appData = process.env.APPDATA ||
|
|
182209
|
+
const appData = process.env.APPDATA || join58(homedir22(), "AppData", "Roaming");
|
|
182074
182210
|
return win325.join(appData, identifier);
|
|
182075
182211
|
}
|
|
182076
182212
|
case "linux":
|
|
182077
182213
|
default: {
|
|
182078
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME ||
|
|
182079
|
-
return
|
|
182214
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join58(homedir22(), ".config");
|
|
182215
|
+
return join58(xdgConfig, identifier);
|
|
182080
182216
|
}
|
|
182081
182217
|
}
|
|
182082
182218
|
}
|
|
@@ -182085,7 +182221,7 @@ function resolveConfigPath3(pathValue) {
|
|
|
182085
182221
|
return posix5.normalize(pathValue);
|
|
182086
182222
|
}
|
|
182087
182223
|
const resolvedPath = resolve12(pathValue);
|
|
182088
|
-
if (!
|
|
182224
|
+
if (!existsSync64(resolvedPath))
|
|
182089
182225
|
return resolvedPath;
|
|
182090
182226
|
try {
|
|
182091
182227
|
return realpathSync8(resolvedPath);
|
|
@@ -182119,8 +182255,8 @@ function getWslLinuxHomeDir2(windowsConfigRoot) {
|
|
|
182119
182255
|
function getCliDefaultConfigDir2() {
|
|
182120
182256
|
const envXdgConfig = process.env.XDG_CONFIG_HOME?.trim();
|
|
182121
182257
|
const shouldIgnoreWindowsXdg = envXdgConfig !== undefined && envXdgConfig.length > 0 && isWslEnvironment2() && isWindowsUserConfigRoot2(envXdgConfig);
|
|
182122
|
-
const xdgConfig = shouldIgnoreWindowsXdg ? posix5.join(getWslLinuxHomeDir2(envXdgConfig) ?? "/home", ".config") : envXdgConfig ||
|
|
182123
|
-
const configDir = isWslEnvironment2() ? posix5.join(xdgConfig, "opencode") :
|
|
182258
|
+
const xdgConfig = shouldIgnoreWindowsXdg ? posix5.join(getWslLinuxHomeDir2(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join58(homedir22(), ".config");
|
|
182259
|
+
const configDir = isWslEnvironment2() ? posix5.join(xdgConfig, "opencode") : join58(xdgConfig, "opencode");
|
|
182124
182260
|
return resolveConfigPath3(configDir);
|
|
182125
182261
|
}
|
|
182126
182262
|
function getCliCustomConfigDir2() {
|
|
@@ -182153,9 +182289,9 @@ function getOpenCodeConfigDir2(options) {
|
|
|
182153
182289
|
const tauriDir = process.platform === "win32" ? win325.isAbsolute(tauriDirBase) ? win325.normalize(tauriDirBase) : win325.resolve(tauriDirBase) : resolveConfigPath3(tauriDirBase);
|
|
182154
182290
|
if (checkExisting) {
|
|
182155
182291
|
const legacyDir = getCliConfigDir2();
|
|
182156
|
-
const legacyConfig =
|
|
182157
|
-
const legacyConfigC =
|
|
182158
|
-
if (
|
|
182292
|
+
const legacyConfig = join58(legacyDir, "opencode.json");
|
|
182293
|
+
const legacyConfigC = join58(legacyDir, "opencode.jsonc");
|
|
182294
|
+
if (existsSync64(legacyConfig) || existsSync64(legacyConfigC)) {
|
|
182159
182295
|
return legacyDir;
|
|
182160
182296
|
}
|
|
182161
182297
|
}
|
|
@@ -182164,11 +182300,11 @@ function getOpenCodeConfigDir2(options) {
|
|
|
182164
182300
|
|
|
182165
182301
|
// packages/skills-loader-core/src/shared/opencode-command-dirs.ts
|
|
182166
182302
|
function getParentOpencodeConfigDir(configDir) {
|
|
182167
|
-
const parentDir =
|
|
182168
|
-
if (
|
|
182303
|
+
const parentDir = dirname23(configDir);
|
|
182304
|
+
if (basename12(parentDir) !== "profiles") {
|
|
182169
182305
|
return null;
|
|
182170
182306
|
}
|
|
182171
|
-
return
|
|
182307
|
+
return dirname23(parentDir);
|
|
182172
182308
|
}
|
|
182173
182309
|
function getOpenCodeSkillDirs(options) {
|
|
182174
182310
|
const configDirs = getOpenCodeConfigDirs2(options);
|
|
@@ -182176,21 +182312,21 @@ function getOpenCodeSkillDirs(options) {
|
|
|
182176
182312
|
...configDirs.flatMap((configDir) => {
|
|
182177
182313
|
const parentConfigDir = getParentOpencodeConfigDir(configDir);
|
|
182178
182314
|
return [
|
|
182179
|
-
|
|
182180
|
-
|
|
182181
|
-
...parentConfigDir ? [
|
|
182315
|
+
join59(configDir, "skills"),
|
|
182316
|
+
join59(configDir, "skill"),
|
|
182317
|
+
...parentConfigDir ? [join59(parentConfigDir, "skills"), join59(parentConfigDir, "skill")] : []
|
|
182182
182318
|
];
|
|
182183
182319
|
})
|
|
182184
182320
|
]));
|
|
182185
182321
|
}
|
|
182186
182322
|
// packages/skills-loader-core/src/shared/project-discovery-dirs.ts
|
|
182187
182323
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
182188
|
-
import { existsSync as
|
|
182189
|
-
import { dirname as
|
|
182324
|
+
import { existsSync as existsSync65, realpathSync as realpathSync9 } from "fs";
|
|
182325
|
+
import { dirname as dirname24, join as join60, resolve as resolve13, win32 as win326 } from "path";
|
|
182190
182326
|
var worktreePathCache2 = new Map;
|
|
182191
182327
|
function normalizePath2(path18) {
|
|
182192
182328
|
const resolvedPath = process.platform !== "win32" && win326.isAbsolute(path18) ? path18 : resolve13(path18);
|
|
182193
|
-
if (!
|
|
182329
|
+
if (!existsSync65(resolvedPath)) {
|
|
182194
182330
|
return resolvedPath;
|
|
182195
182331
|
}
|
|
182196
182332
|
try {
|
|
@@ -182221,8 +182357,8 @@ function findAncestorDirectories(startDirectory, targetPaths, stopDirectory) {
|
|
|
182221
182357
|
const stopDirectoryKey = resolvedStopDirectory ? pathKey2(resolvedStopDirectory) : undefined;
|
|
182222
182358
|
while (true) {
|
|
182223
182359
|
for (const targetPath of targetPaths) {
|
|
182224
|
-
const candidateDirectory =
|
|
182225
|
-
if (!
|
|
182360
|
+
const candidateDirectory = join60(currentDirectory, ...targetPath);
|
|
182361
|
+
if (!existsSync65(candidateDirectory)) {
|
|
182226
182362
|
continue;
|
|
182227
182363
|
}
|
|
182228
182364
|
const normalizedCandidateDirectory = normalizePath2(candidateDirectory);
|
|
@@ -182236,7 +182372,7 @@ function findAncestorDirectories(startDirectory, targetPaths, stopDirectory) {
|
|
|
182236
182372
|
if (stopDirectoryKey === pathKey2(currentDirectory)) {
|
|
182237
182373
|
return directories;
|
|
182238
182374
|
}
|
|
182239
|
-
const parentDirectory =
|
|
182375
|
+
const parentDirectory = dirname24(currentDirectory);
|
|
182240
182376
|
if (parentDirectory === currentDirectory) {
|
|
182241
182377
|
return directories;
|
|
182242
182378
|
}
|
|
@@ -182304,13 +182440,13 @@ function deduplicateSkillsByName(skills2) {
|
|
|
182304
182440
|
// packages/skills-loader-core/src/features/opencode-skill-loader/skill-directory-loader.ts
|
|
182305
182441
|
init_src();
|
|
182306
182442
|
import * as fs20 from "fs/promises";
|
|
182307
|
-
import { join as
|
|
182443
|
+
import { join as join62 } from "path";
|
|
182308
182444
|
|
|
182309
182445
|
// packages/skills-loader-core/src/features/opencode-skill-loader/loaded-skill-from-path.ts
|
|
182310
182446
|
init_src();
|
|
182311
182447
|
init_src2();
|
|
182312
182448
|
import * as fs19 from "fs/promises";
|
|
182313
|
-
import { basename as
|
|
182449
|
+
import { basename as basename13 } from "path";
|
|
182314
182450
|
|
|
182315
182451
|
// packages/skills-loader-core/src/features/opencode-skill-loader/allowed-tools-parser.ts
|
|
182316
182452
|
function parseAllowedTools(allowedTools) {
|
|
@@ -182325,7 +182461,7 @@ function parseAllowedTools(allowedTools) {
|
|
|
182325
182461
|
// packages/skills-loader-core/src/features/opencode-skill-loader/skill-mcp-config.ts
|
|
182326
182462
|
init_js_yaml();
|
|
182327
182463
|
import * as fs18 from "fs/promises";
|
|
182328
|
-
import { join as
|
|
182464
|
+
import { join as join61 } from "path";
|
|
182329
182465
|
function parseSkillMcpConfigFromFrontmatter(content) {
|
|
182330
182466
|
const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
182331
182467
|
if (!frontmatterMatch)
|
|
@@ -182344,7 +182480,7 @@ function parseSkillMcpConfigFromFrontmatter(content) {
|
|
|
182344
182480
|
return;
|
|
182345
182481
|
}
|
|
182346
182482
|
async function loadMcpJsonFromDir(skillDir) {
|
|
182347
|
-
const mcpJsonPath =
|
|
182483
|
+
const mcpJsonPath = join61(skillDir, "mcp.json");
|
|
182348
182484
|
try {
|
|
182349
182485
|
const content = await fs18.readFile(mcpJsonPath, "utf-8");
|
|
182350
182486
|
const parsed = JSON.parse(content);
|
|
@@ -182426,7 +182562,7 @@ $ARGUMENTS
|
|
|
182426
182562
|
}
|
|
182427
182563
|
}
|
|
182428
182564
|
function inferSkillNameFromFileName(filePath) {
|
|
182429
|
-
return
|
|
182565
|
+
return basename13(filePath, ".md");
|
|
182430
182566
|
}
|
|
182431
182567
|
|
|
182432
182568
|
// packages/skills-loader-core/src/features/opencode-skill-loader/skill-directory-loader.ts
|
|
@@ -182460,10 +182596,10 @@ async function loadSkillsFromDir(options) {
|
|
|
182460
182596
|
const directories = entries.filter((entry) => !entry.name.startsWith(".") && (entry.isDirectory() || entry.isSymbolicLink()));
|
|
182461
182597
|
const files = entries.filter((entry) => !entry.name.startsWith(".") && !entry.isDirectory() && !entry.isSymbolicLink() && isMarkdownFile(entry));
|
|
182462
182598
|
for (const entry of directories) {
|
|
182463
|
-
const entryPath =
|
|
182599
|
+
const entryPath = join62(options.skillsDir, entry.name);
|
|
182464
182600
|
const resolvedPath = await resolveSymlinkAsync(entryPath);
|
|
182465
182601
|
const dirName = entry.name;
|
|
182466
|
-
const skillMdPath =
|
|
182602
|
+
const skillMdPath = join62(resolvedPath, "SKILL.md");
|
|
182467
182603
|
if (await canAccessFile(skillMdPath)) {
|
|
182468
182604
|
const skill = await loadSkillFromPath({
|
|
182469
182605
|
skillPath: skillMdPath,
|
|
@@ -182477,7 +182613,7 @@ async function loadSkillsFromDir(options) {
|
|
|
182477
182613
|
}
|
|
182478
182614
|
continue;
|
|
182479
182615
|
}
|
|
182480
|
-
const namedSkillMdPath =
|
|
182616
|
+
const namedSkillMdPath = join62(resolvedPath, `${dirName}.md`);
|
|
182481
182617
|
if (await canAccessFile(namedSkillMdPath)) {
|
|
182482
182618
|
const skill = await loadSkillFromPath({
|
|
182483
182619
|
skillPath: namedSkillMdPath,
|
|
@@ -182508,7 +182644,7 @@ async function loadSkillsFromDir(options) {
|
|
|
182508
182644
|
}
|
|
182509
182645
|
}
|
|
182510
182646
|
for (const entry of files) {
|
|
182511
|
-
const entryPath =
|
|
182647
|
+
const entryPath = join62(options.skillsDir, entry.name);
|
|
182512
182648
|
const baseName = inferSkillNameFromFileName(entryPath);
|
|
182513
182649
|
const skill = await loadSkillFromPath({
|
|
182514
182650
|
skillPath: entryPath,
|
|
@@ -182560,7 +182696,7 @@ async function discoverAllSkills(directory) {
|
|
|
182560
182696
|
]);
|
|
182561
182697
|
}
|
|
182562
182698
|
async function discoverUserClaudeSkills() {
|
|
182563
|
-
const userSkillsDir =
|
|
182699
|
+
const userSkillsDir = join63(getClaudeConfigDir(), "skills");
|
|
182564
182700
|
return loadSkillsFromDir({ skillsDir: userSkillsDir, scope: "user" });
|
|
182565
182701
|
}
|
|
182566
182702
|
async function discoverProjectClaudeSkills(directory) {
|
|
@@ -182587,7 +182723,7 @@ async function discoverProjectAgentsSkills(directory) {
|
|
|
182587
182723
|
return deduplicateSkillsByName(allSkills.flat());
|
|
182588
182724
|
}
|
|
182589
182725
|
async function discoverGlobalAgentsSkills(homeDirectory = getHomeDirectory()) {
|
|
182590
|
-
const agentsGlobalDir =
|
|
182726
|
+
const agentsGlobalDir = join63(homeDirectory, ".agents", "skills");
|
|
182591
182727
|
return loadSkillsFromDir({ skillsDir: agentsGlobalDir, scope: "user" });
|
|
182592
182728
|
}
|
|
182593
182729
|
// packages/skills-loader-core/src/features/opencode-skill-loader/merger/builtin-skill-converter.ts
|
|
@@ -183339,7 +183475,7 @@ playwright-cli close
|
|
|
183339
183475
|
init_shared_skills();
|
|
183340
183476
|
init_src();
|
|
183341
183477
|
import { readFileSync as readFileSync50 } from "fs";
|
|
183342
|
-
import { join as
|
|
183478
|
+
import { join as join64 } from "path";
|
|
183343
183479
|
function createSharedSkillTemplateLoader(readFile3 = readFileSync50, skillsRootPath = sharedSkillsRootPath()) {
|
|
183344
183480
|
const cache = new Map;
|
|
183345
183481
|
return (skillName) => {
|
|
@@ -183347,7 +183483,7 @@ function createSharedSkillTemplateLoader(readFile3 = readFileSync50, skillsRootP
|
|
|
183347
183483
|
if (cached2 !== undefined)
|
|
183348
183484
|
return cached2;
|
|
183349
183485
|
try {
|
|
183350
|
-
const { body } = parseFrontmatter(readFile3(
|
|
183486
|
+
const { body } = parseFrontmatter(readFile3(join64(skillsRootPath, skillName, "SKILL.md"), "utf8"));
|
|
183351
183487
|
cache.set(skillName, body);
|
|
183352
183488
|
return body;
|
|
183353
183489
|
} catch (error51) {
|
|
@@ -184484,9 +184620,9 @@ var gitMasterSkill = {
|
|
|
184484
184620
|
template: GIT_MASTER_TEMPLATE
|
|
184485
184621
|
};
|
|
184486
184622
|
// packages/skills-loader-core/src/features/builtin-skills/skills/dev-browser.ts
|
|
184487
|
-
import { dirname as
|
|
184623
|
+
import { dirname as dirname25, join as join65 } from "path";
|
|
184488
184624
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
184489
|
-
var CURRENT_DIR =
|
|
184625
|
+
var CURRENT_DIR = dirname25(fileURLToPath8(import.meta.url));
|
|
184490
184626
|
var devBrowserSkill = {
|
|
184491
184627
|
name: "dev-browser",
|
|
184492
184628
|
description: "Browser automation with persistent page state. Use when users ask to navigate websites, fill forms, take screenshots, extract web data, test web apps, or automate browser workflows. Trigger phrases include 'go to [url]', 'click on', 'fill out the form', 'take a screenshot', 'scrape', 'automate', 'test the website', 'log into', or any browser interaction request.",
|
|
@@ -184704,7 +184840,7 @@ console.log({
|
|
|
184704
184840
|
await client.disconnect();
|
|
184705
184841
|
EOF
|
|
184706
184842
|
\`\`\``,
|
|
184707
|
-
resolvedPath:
|
|
184843
|
+
resolvedPath: join65(CURRENT_DIR, "..", "dev-browser")
|
|
184708
184844
|
};
|
|
184709
184845
|
// packages/skills-loader-core/src/features/builtin-skills/skills/review-work.ts
|
|
184710
184846
|
var reviewWorkSkill = {
|
|
@@ -185697,12 +185833,12 @@ function applySnapshotRetention(options) {
|
|
|
185697
185833
|
// packages/omo-opencode/src/cli/snapshot/snapshot.ts
|
|
185698
185834
|
import { Database as Database3 } from "bun:sqlite";
|
|
185699
185835
|
import {
|
|
185700
|
-
existsSync as
|
|
185701
|
-
mkdirSync as
|
|
185702
|
-
copyFileSync as
|
|
185836
|
+
existsSync as existsSync67,
|
|
185837
|
+
mkdirSync as mkdirSync21,
|
|
185838
|
+
copyFileSync as copyFileSync4,
|
|
185703
185839
|
readFileSync as readFileSync51,
|
|
185704
185840
|
writeFileSync as writeFileSync19,
|
|
185705
|
-
readdirSync as
|
|
185841
|
+
readdirSync as readdirSync11,
|
|
185706
185842
|
statSync as statSync8,
|
|
185707
185843
|
rmSync as rmSync4
|
|
185708
185844
|
} from "fs";
|
|
@@ -185713,14 +185849,14 @@ async function snapshotCli(options = {}) {
|
|
|
185713
185849
|
const homeDir = os7.homedir();
|
|
185714
185850
|
const snapshotDir = options.snapshotDir ?? path18.join(homeDir, ".matrixos", "snapshots");
|
|
185715
185851
|
const allPaths = getAllSnapshotPaths(homeDir);
|
|
185716
|
-
const files = allPaths.files.filter((f2) =>
|
|
185852
|
+
const files = allPaths.files.filter((f2) => existsSync67(f2.sourcePath));
|
|
185717
185853
|
const realFs = {
|
|
185718
|
-
existsSync:
|
|
185719
|
-
mkdirSync:
|
|
185854
|
+
existsSync: existsSync67,
|
|
185855
|
+
mkdirSync: mkdirSync21,
|
|
185720
185856
|
readFileSync: readFileSync51,
|
|
185721
185857
|
writeFileSync: writeFileSync19,
|
|
185722
|
-
copyFileSync:
|
|
185723
|
-
readdirSync:
|
|
185858
|
+
copyFileSync: copyFileSync4,
|
|
185859
|
+
readdirSync: readdirSync11,
|
|
185724
185860
|
statSync: statSync8,
|
|
185725
185861
|
rmSync: rmSync4
|
|
185726
185862
|
};
|
|
@@ -185780,12 +185916,12 @@ async function snapshotCli(options = {}) {
|
|
|
185780
185916
|
|
|
185781
185917
|
// packages/omo-opencode/src/cli/snapshot/restore.ts
|
|
185782
185918
|
import {
|
|
185783
|
-
existsSync as
|
|
185784
|
-
mkdirSync as
|
|
185785
|
-
copyFileSync as
|
|
185919
|
+
existsSync as existsSync68,
|
|
185920
|
+
mkdirSync as mkdirSync22,
|
|
185921
|
+
copyFileSync as copyFileSync5,
|
|
185786
185922
|
readFileSync as readFileSync52,
|
|
185787
185923
|
writeFileSync as writeFileSync20,
|
|
185788
|
-
readdirSync as
|
|
185924
|
+
readdirSync as readdirSync12,
|
|
185789
185925
|
statSync as statSync9,
|
|
185790
185926
|
rmSync as rmSync5
|
|
185791
185927
|
} from "fs";
|
|
@@ -185794,12 +185930,12 @@ import * as os8 from "os";
|
|
|
185794
185930
|
async function restoreCli(options) {
|
|
185795
185931
|
const snapshotDir = options.snapshotDir ?? path19.join(os8.homedir(), ".matrixos", "snapshots");
|
|
185796
185932
|
const realFs = {
|
|
185797
|
-
existsSync:
|
|
185798
|
-
mkdirSync:
|
|
185933
|
+
existsSync: existsSync68,
|
|
185934
|
+
mkdirSync: mkdirSync22,
|
|
185799
185935
|
readFileSync: readFileSync52,
|
|
185800
185936
|
writeFileSync: writeFileSync20,
|
|
185801
|
-
copyFileSync:
|
|
185802
|
-
readdirSync:
|
|
185937
|
+
copyFileSync: copyFileSync5,
|
|
185938
|
+
readdirSync: readdirSync12,
|
|
185803
185939
|
statSync: statSync9,
|
|
185804
185940
|
rmSync: rmSync5
|
|
185805
185941
|
};
|
|
@@ -185832,12 +185968,12 @@ async function restoreCli(options) {
|
|
|
185832
185968
|
|
|
185833
185969
|
// packages/omo-opencode/src/cli/snapshot/list.ts
|
|
185834
185970
|
import {
|
|
185835
|
-
existsSync as
|
|
185836
|
-
mkdirSync as
|
|
185837
|
-
copyFileSync as
|
|
185971
|
+
existsSync as existsSync69,
|
|
185972
|
+
mkdirSync as mkdirSync23,
|
|
185973
|
+
copyFileSync as copyFileSync6,
|
|
185838
185974
|
readFileSync as readFileSync53,
|
|
185839
185975
|
writeFileSync as writeFileSync21,
|
|
185840
|
-
readdirSync as
|
|
185976
|
+
readdirSync as readdirSync13,
|
|
185841
185977
|
statSync as statSync10,
|
|
185842
185978
|
rmSync as rmSync6
|
|
185843
185979
|
} from "fs";
|
|
@@ -185856,12 +185992,12 @@ function formatBytes(bytes) {
|
|
|
185856
185992
|
async function snapshotListCli(options) {
|
|
185857
185993
|
const snapshotDir = options.snapshotDir ?? path20.join(os9.homedir(), ".matrixos", "snapshots");
|
|
185858
185994
|
const realFs = {
|
|
185859
|
-
existsSync:
|
|
185860
|
-
mkdirSync:
|
|
185995
|
+
existsSync: existsSync69,
|
|
185996
|
+
mkdirSync: mkdirSync23,
|
|
185861
185997
|
readFileSync: readFileSync53,
|
|
185862
185998
|
writeFileSync: writeFileSync21,
|
|
185863
|
-
copyFileSync:
|
|
185864
|
-
readdirSync:
|
|
185999
|
+
copyFileSync: copyFileSync6,
|
|
186000
|
+
readdirSync: readdirSync13,
|
|
185865
186001
|
statSync: statSync10,
|
|
185866
186002
|
rmSync: rmSync6
|
|
185867
186003
|
};
|
|
@@ -185886,12 +186022,12 @@ async function snapshotListCli(options) {
|
|
|
185886
186022
|
|
|
185887
186023
|
// packages/omo-opencode/src/cli/snapshot/prune.ts
|
|
185888
186024
|
import {
|
|
185889
|
-
existsSync as
|
|
185890
|
-
mkdirSync as
|
|
185891
|
-
copyFileSync as
|
|
186025
|
+
existsSync as existsSync70,
|
|
186026
|
+
mkdirSync as mkdirSync24,
|
|
186027
|
+
copyFileSync as copyFileSync7,
|
|
185892
186028
|
readFileSync as readFileSync54,
|
|
185893
186029
|
writeFileSync as writeFileSync22,
|
|
185894
|
-
readdirSync as
|
|
186030
|
+
readdirSync as readdirSync14,
|
|
185895
186031
|
statSync as statSync11,
|
|
185896
186032
|
rmSync as rmSync7
|
|
185897
186033
|
} from "fs";
|
|
@@ -185900,12 +186036,12 @@ import * as os10 from "os";
|
|
|
185900
186036
|
async function snapshotPruneCli(options = {}) {
|
|
185901
186037
|
const snapshotDir = options.snapshotDir ?? path21.join(os10.homedir(), ".matrixos", "snapshots");
|
|
185902
186038
|
const realFs = {
|
|
185903
|
-
existsSync:
|
|
185904
|
-
mkdirSync:
|
|
186039
|
+
existsSync: existsSync70,
|
|
186040
|
+
mkdirSync: mkdirSync24,
|
|
185905
186041
|
readFileSync: readFileSync54,
|
|
185906
186042
|
writeFileSync: writeFileSync22,
|
|
185907
|
-
copyFileSync:
|
|
185908
|
-
readdirSync:
|
|
186043
|
+
copyFileSync: copyFileSync7,
|
|
186044
|
+
readdirSync: readdirSync14,
|
|
185909
186045
|
statSync: statSync11,
|
|
185910
186046
|
rmSync: rmSync7
|
|
185911
186047
|
};
|
|
@@ -185950,8 +186086,8 @@ function codebaseCli(rootProgram) {
|
|
|
185950
186086
|
try {
|
|
185951
186087
|
const dimension = Number.parseInt(options.dimension, 10) || 384;
|
|
185952
186088
|
const dbDir = path22.dirname(options.db);
|
|
185953
|
-
const { mkdirSync:
|
|
185954
|
-
|
|
186089
|
+
const { mkdirSync: mkdirSync25 } = await import("fs");
|
|
186090
|
+
mkdirSync25(dbDir, { recursive: true });
|
|
185955
186091
|
const store4 = createSqliteVectorStore({ path: options.db, dimension });
|
|
185956
186092
|
if (options.reset) {
|
|
185957
186093
|
store4.clear();
|
|
@@ -187168,7 +187304,7 @@ function loadGatewayPassphrase() {
|
|
|
187168
187304
|
}
|
|
187169
187305
|
async function dashboardCli(options) {
|
|
187170
187306
|
const port3 = options.port ?? 9123;
|
|
187171
|
-
const host = options.host ?? "
|
|
187307
|
+
const host = options.host ?? "0.0.0.0";
|
|
187172
187308
|
const frontendDir = path25.resolve(import.meta.dir, "../features/dashboard/frontend");
|
|
187173
187309
|
const gatewayPassphrase = loadGatewayPassphrase();
|
|
187174
187310
|
console.log(`[dashboard] starting MaTrixOS dashboard on http://${host}:${port3}`);
|
|
@@ -187202,11 +187338,11 @@ async function dashboardCli(options) {
|
|
|
187202
187338
|
}
|
|
187203
187339
|
|
|
187204
187340
|
// packages/omo-opencode/src/cli/architect.ts
|
|
187205
|
-
import { join as
|
|
187341
|
+
import { join as join75 } from "path";
|
|
187206
187342
|
var IMPROVEMENTS_DIR = ".matrixos/improvements";
|
|
187207
187343
|
function getStore(directory) {
|
|
187208
187344
|
const baseDir = directory ?? process.cwd();
|
|
187209
|
-
return createImprovementStore(
|
|
187345
|
+
return createImprovementStore(join75(baseDir, IMPROVEMENTS_DIR));
|
|
187210
187346
|
}
|
|
187211
187347
|
async function architectReview(options) {
|
|
187212
187348
|
const store4 = getStore(options.directory);
|