@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/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",
|
|
@@ -67682,6 +67683,132 @@ var init_add_tui_plugin_to_tui_config = __esm(() => {
|
|
|
67682
67683
|
init_write_file_atomically2();
|
|
67683
67684
|
});
|
|
67684
67685
|
|
|
67686
|
+
// packages/omo-opencode/src/cli/slash-command-installer.ts
|
|
67687
|
+
import {
|
|
67688
|
+
existsSync as existsSync26,
|
|
67689
|
+
mkdirSync as mkdirSync9,
|
|
67690
|
+
copyFileSync as copyFileSync3,
|
|
67691
|
+
symlinkSync,
|
|
67692
|
+
readlinkSync,
|
|
67693
|
+
readdirSync as readdirSync4,
|
|
67694
|
+
unlinkSync as unlinkSync5
|
|
67695
|
+
} from "fs";
|
|
67696
|
+
import { dirname as dirname9, join as join25 } from "path";
|
|
67697
|
+
import { homedir as homedir6 } from "os";
|
|
67698
|
+
function findSlashCommandSource() {
|
|
67699
|
+
const candidates = [
|
|
67700
|
+
join25(import.meta.dir, "slash-commands"),
|
|
67701
|
+
join25(import.meta.dir, "..", "slash-commands"),
|
|
67702
|
+
join25(import.meta.dir, "..", "..", "src", "cli", "slash-commands")
|
|
67703
|
+
];
|
|
67704
|
+
for (const c of candidates) {
|
|
67705
|
+
if (existsSync26(c) && existsSync26(join25(c, "adopt.md")))
|
|
67706
|
+
return c;
|
|
67707
|
+
}
|
|
67708
|
+
return null;
|
|
67709
|
+
}
|
|
67710
|
+
function copySlashCommandsTo(dir) {
|
|
67711
|
+
try {
|
|
67712
|
+
if (!existsSync26(dir))
|
|
67713
|
+
mkdirSync9(dir, { recursive: true });
|
|
67714
|
+
const srcDir = findSlashCommandSource();
|
|
67715
|
+
if (!srcDir)
|
|
67716
|
+
return 0;
|
|
67717
|
+
let copied = 0;
|
|
67718
|
+
for (const name2 of SLASH_COMMAND_NAMES) {
|
|
67719
|
+
const src = join25(srcDir, name2);
|
|
67720
|
+
if (!existsSync26(src))
|
|
67721
|
+
continue;
|
|
67722
|
+
copyFileSync3(src, join25(dir, name2));
|
|
67723
|
+
copied++;
|
|
67724
|
+
}
|
|
67725
|
+
return copied;
|
|
67726
|
+
} catch {
|
|
67727
|
+
return 0;
|
|
67728
|
+
}
|
|
67729
|
+
}
|
|
67730
|
+
function resolveMatrixosBin() {
|
|
67731
|
+
const candidates = [
|
|
67732
|
+
join25(import.meta.dir, "..", "..", "bin", "matrixos.js"),
|
|
67733
|
+
join25(import.meta.dir, "..", "bin", "matrixos.js")
|
|
67734
|
+
];
|
|
67735
|
+
for (const c of candidates) {
|
|
67736
|
+
if (existsSync26(c))
|
|
67737
|
+
return c;
|
|
67738
|
+
}
|
|
67739
|
+
return null;
|
|
67740
|
+
}
|
|
67741
|
+
function copyRecursive(from, to) {
|
|
67742
|
+
if (!existsSync26(to))
|
|
67743
|
+
mkdirSync9(to, { recursive: true });
|
|
67744
|
+
for (const entry of readdirSync4(from, { withFileTypes: true })) {
|
|
67745
|
+
const src = join25(from, entry.name);
|
|
67746
|
+
const dst = join25(to, entry.name);
|
|
67747
|
+
if (entry.isDirectory()) {
|
|
67748
|
+
copyRecursive(src, dst);
|
|
67749
|
+
} else {
|
|
67750
|
+
copyFileSync3(src, dst);
|
|
67751
|
+
}
|
|
67752
|
+
}
|
|
67753
|
+
}
|
|
67754
|
+
function installPackageTo(path7, bin) {
|
|
67755
|
+
const srcDir = dirname9(dirname9(bin));
|
|
67756
|
+
if (!existsSync26(srcDir))
|
|
67757
|
+
return null;
|
|
67758
|
+
try {
|
|
67759
|
+
copyRecursive(srcDir, path7);
|
|
67760
|
+
return join25(path7, "bin", "matrixos.js");
|
|
67761
|
+
} catch {
|
|
67762
|
+
return null;
|
|
67763
|
+
}
|
|
67764
|
+
}
|
|
67765
|
+
function installSlashCommandsAndPath() {
|
|
67766
|
+
const home = homedir6();
|
|
67767
|
+
const targets = [
|
|
67768
|
+
join25(home, ".config", "opencode", "commands"),
|
|
67769
|
+
join25(home, ".claude", "commands")
|
|
67770
|
+
];
|
|
67771
|
+
let total = 0;
|
|
67772
|
+
for (const t of targets)
|
|
67773
|
+
total += copySlashCommandsTo(t);
|
|
67774
|
+
let pathLinked = false;
|
|
67775
|
+
const liveBin = resolveMatrixosBin();
|
|
67776
|
+
const linkPath = "/usr/local/bin/matrixos";
|
|
67777
|
+
const persistentDir = "/usr/local/lib/matrixos";
|
|
67778
|
+
if (liveBin) {
|
|
67779
|
+
try {
|
|
67780
|
+
const target = installPackageTo(persistentDir, liveBin) ?? liveBin;
|
|
67781
|
+
if (existsSync26(linkPath)) {
|
|
67782
|
+
try {
|
|
67783
|
+
const cur = readlinkSync(linkPath);
|
|
67784
|
+
if (cur === target) {
|
|
67785
|
+
pathLinked = true;
|
|
67786
|
+
return { commands: total, pathLinked };
|
|
67787
|
+
}
|
|
67788
|
+
} catch {}
|
|
67789
|
+
try {
|
|
67790
|
+
unlinkSync5(linkPath);
|
|
67791
|
+
} catch {}
|
|
67792
|
+
}
|
|
67793
|
+
symlinkSync(target, linkPath);
|
|
67794
|
+
pathLinked = true;
|
|
67795
|
+
} catch {
|
|
67796
|
+
pathLinked = false;
|
|
67797
|
+
}
|
|
67798
|
+
}
|
|
67799
|
+
return { commands: total, pathLinked };
|
|
67800
|
+
}
|
|
67801
|
+
var SLASH_COMMAND_NAMES;
|
|
67802
|
+
var init_slash_command_installer = __esm(() => {
|
|
67803
|
+
SLASH_COMMAND_NAMES = [
|
|
67804
|
+
"adopt.md",
|
|
67805
|
+
"readopt.md",
|
|
67806
|
+
"matrix-gateway-adopt-telegram.md",
|
|
67807
|
+
"matrix.md",
|
|
67808
|
+
"features.md"
|
|
67809
|
+
];
|
|
67810
|
+
});
|
|
67811
|
+
|
|
67685
67812
|
// packages/shared-skills/index.mjs
|
|
67686
67813
|
import { fileURLToPath } from "url";
|
|
67687
67814
|
function sharedSkillsRootPath() {
|
|
@@ -67690,8 +67817,8 @@ function sharedSkillsRootPath() {
|
|
|
67690
67817
|
var init_shared_skills = () => {};
|
|
67691
67818
|
|
|
67692
67819
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
67693
|
-
import { homedir as
|
|
67694
|
-
import { join as
|
|
67820
|
+
import { homedir as homedir7 } from "os";
|
|
67821
|
+
import { join as join26 } from "path";
|
|
67695
67822
|
function describeResult(result) {
|
|
67696
67823
|
if (result.kind === "succeeded")
|
|
67697
67824
|
return null;
|
|
@@ -67701,9 +67828,9 @@ function describeResult(result) {
|
|
|
67701
67828
|
}
|
|
67702
67829
|
async function installAstGrepForOpenCode(options = {}) {
|
|
67703
67830
|
const platform = options.platform ?? process.platform;
|
|
67704
|
-
const baseDir =
|
|
67831
|
+
const baseDir = join26(options.homeDir ?? homedir7(), ".omo");
|
|
67705
67832
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
67706
|
-
const skillDir =
|
|
67833
|
+
const skillDir = join26(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
67707
67834
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
67708
67835
|
try {
|
|
67709
67836
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -67811,6 +67938,15 @@ async function runCliInstaller(args, version) {
|
|
|
67811
67938
|
if (config.hasOpenCode && !hasAnyConfiguredProvider(config)) {
|
|
67812
67939
|
printWarning(getNoModelProvidersWarning());
|
|
67813
67940
|
}
|
|
67941
|
+
try {
|
|
67942
|
+
const slash = installSlashCommandsAndPath();
|
|
67943
|
+
if (slash.commands > 0)
|
|
67944
|
+
printSuccess(`Slash commands installed (${slash.commands} files)`);
|
|
67945
|
+
if (slash.pathLinked)
|
|
67946
|
+
printSuccess("matrixos available on PATH (/usr/local/bin/matrixos)");
|
|
67947
|
+
} catch (error) {
|
|
67948
|
+
printWarning(`Slash-command setup skipped: ${error instanceof Error ? error.message : String(error)}`);
|
|
67949
|
+
}
|
|
67814
67950
|
console.log(`${SYMBOLS.star} ${import_picocolors3.default.bold(import_picocolors3.default.green(isUpdate ? "Configuration updated!" : "Installation complete!"))}`);
|
|
67815
67951
|
if (hasOpenCode) {
|
|
67816
67952
|
console.log(` Run ${import_picocolors3.default.cyan("opencode")} to start!`);
|
|
@@ -67872,6 +68008,7 @@ var init_cli_installer = __esm(() => {
|
|
|
67872
68008
|
init_star_request();
|
|
67873
68009
|
init_provider_availability();
|
|
67874
68010
|
init_add_tui_plugin_to_tui_config();
|
|
68011
|
+
init_slash_command_installer();
|
|
67875
68012
|
init_install_ast_grep_sg();
|
|
67876
68013
|
import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
67877
68014
|
});
|
|
@@ -69511,15 +69648,16 @@ var init_dist5 = __esm(() => {
|
|
|
69511
69648
|
});
|
|
69512
69649
|
|
|
69513
69650
|
// packages/omo-opencode/src/cli/config-manager/write-gateway-env.ts
|
|
69514
|
-
import {
|
|
69515
|
-
import {
|
|
69651
|
+
import { homedir as homedir8 } from "os";
|
|
69652
|
+
import { existsSync as existsSync27, mkdirSync as mkdirSync10, readFileSync as readFileSync15, writeFileSync as writeFileSync6, chmodSync as chmodSync3 } from "fs";
|
|
69653
|
+
import { join as join27 } from "path";
|
|
69516
69654
|
function writeGatewayEnvToken(key, token) {
|
|
69517
|
-
const configDir =
|
|
69518
|
-
if (!
|
|
69519
|
-
|
|
69520
|
-
const envPath =
|
|
69655
|
+
const configDir = homedir8();
|
|
69656
|
+
if (!existsSync27(configDir))
|
|
69657
|
+
mkdirSync10(configDir, { recursive: true });
|
|
69658
|
+
const envPath = join27(configDir, GATEWAY_ENV_FILENAME);
|
|
69521
69659
|
const entries = new Map;
|
|
69522
|
-
if (
|
|
69660
|
+
if (existsSync27(envPath)) {
|
|
69523
69661
|
const existing = readFileSync15(envPath, "utf-8");
|
|
69524
69662
|
for (const rawLine of existing.split(`
|
|
69525
69663
|
`)) {
|
|
@@ -69548,9 +69686,7 @@ function writeGatewayEnv(token) {
|
|
|
69548
69686
|
return writeGatewayEnvToken("TELEGRAM_BOT_TOKEN", token);
|
|
69549
69687
|
}
|
|
69550
69688
|
var GATEWAY_ENV_FILENAME = ".klc-gateway.env";
|
|
69551
|
-
var init_write_gateway_env =
|
|
69552
|
-
init_config_context();
|
|
69553
|
-
});
|
|
69689
|
+
var init_write_gateway_env = () => {};
|
|
69554
69690
|
|
|
69555
69691
|
// packages/omo-opencode/src/cli/senpi-platform-flag.ts
|
|
69556
69692
|
function isSenpiPlatformEnabled(env2 = process.env) {
|
|
@@ -102550,7 +102686,7 @@ var require_Util = __commonJS((exports, module2) => {
|
|
|
102550
102686
|
await client3.rest.patch(route, { body: updatedItems, reason });
|
|
102551
102687
|
return updatedItems;
|
|
102552
102688
|
}
|
|
102553
|
-
function
|
|
102689
|
+
function basename6(path7, ext) {
|
|
102554
102690
|
const res = parse7(path7);
|
|
102555
102691
|
return ext && res.ext.startsWith(ext) ? res.name : res.base.split("?")[0];
|
|
102556
102692
|
}
|
|
@@ -102673,7 +102809,7 @@ var require_Util = __commonJS((exports, module2) => {
|
|
|
102673
102809
|
resolveColor,
|
|
102674
102810
|
discordSort,
|
|
102675
102811
|
setPosition,
|
|
102676
|
-
basename:
|
|
102812
|
+
basename: basename6,
|
|
102677
102813
|
cleanContent,
|
|
102678
102814
|
cleanCodeBlockContent,
|
|
102679
102815
|
parseWebhookURL,
|
|
@@ -115494,7 +115630,7 @@ var require_MessagePayload = __commonJS((exports, module2) => {
|
|
|
115494
115630
|
var { DiscordjsError, DiscordjsRangeError, ErrorCodes } = require_errors();
|
|
115495
115631
|
var { resolveFile } = require_DataResolver();
|
|
115496
115632
|
var MessageFlagsBitField = require_MessageFlagsBitField();
|
|
115497
|
-
var { basename:
|
|
115633
|
+
var { basename: basename6, verifyString, resolvePartialEmoji } = require_Util();
|
|
115498
115634
|
var getBaseInteraction = lazy2(() => require_BaseInteraction());
|
|
115499
115635
|
|
|
115500
115636
|
class MessagePayload {
|
|
@@ -115679,10 +115815,10 @@ var require_MessagePayload = __commonJS((exports, module2) => {
|
|
|
115679
115815
|
let name2;
|
|
115680
115816
|
const findName = (thing) => {
|
|
115681
115817
|
if (typeof thing === "string") {
|
|
115682
|
-
return
|
|
115818
|
+
return basename6(thing);
|
|
115683
115819
|
}
|
|
115684
115820
|
if (thing.path) {
|
|
115685
|
-
return
|
|
115821
|
+
return basename6(thing.path);
|
|
115686
115822
|
}
|
|
115687
115823
|
return "file.jpg";
|
|
115688
115824
|
};
|
|
@@ -121213,7 +121349,7 @@ var require_dist9 = __commonJS((exports, module2) => {
|
|
|
121213
121349
|
var import_node_worker_threads2 = __require("worker_threads");
|
|
121214
121350
|
var import_collection2 = require_dist2();
|
|
121215
121351
|
var import_node_events = __require("events");
|
|
121216
|
-
var
|
|
121352
|
+
var import_node_path25 = __require("path");
|
|
121217
121353
|
var import_node_worker_threads = __require("worker_threads");
|
|
121218
121354
|
var import_collection = require_dist2();
|
|
121219
121355
|
var WorkerSendPayloadOp = /* @__PURE__ */ ((WorkerSendPayloadOp2) => {
|
|
@@ -121348,18 +121484,18 @@ var require_dist9 = __commonJS((exports, module2) => {
|
|
|
121348
121484
|
resolveWorkerPath() {
|
|
121349
121485
|
const path7 = this.options.workerPath;
|
|
121350
121486
|
if (!path7) {
|
|
121351
|
-
return (0,
|
|
121487
|
+
return (0, import_node_path25.join)(__dirname, "defaultWorker.js");
|
|
121352
121488
|
}
|
|
121353
|
-
if ((0,
|
|
121489
|
+
if ((0, import_node_path25.isAbsolute)(path7)) {
|
|
121354
121490
|
return path7;
|
|
121355
121491
|
}
|
|
121356
121492
|
if (/^\.\.?[/\\]/.test(path7)) {
|
|
121357
|
-
return (0,
|
|
121493
|
+
return (0, import_node_path25.resolve)(path7);
|
|
121358
121494
|
}
|
|
121359
121495
|
try {
|
|
121360
121496
|
return __require.resolve(path7);
|
|
121361
121497
|
} catch {
|
|
121362
|
-
return (0,
|
|
121498
|
+
return (0, import_node_path25.resolve)(path7);
|
|
121363
121499
|
}
|
|
121364
121500
|
}
|
|
121365
121501
|
async waitForWorkerReady(worker) {
|
|
@@ -128060,7 +128196,7 @@ var require_EmbedBuilder = __commonJS((exports, module2) => {
|
|
|
128060
128196
|
|
|
128061
128197
|
// node_modules/.bun/discord.js@14.27.0/node_modules/discord.js/src/structures/AttachmentBuilder.js
|
|
128062
128198
|
var require_AttachmentBuilder = __commonJS((exports, module2) => {
|
|
128063
|
-
var { basename:
|
|
128199
|
+
var { basename: basename6, flatten } = require_Util();
|
|
128064
128200
|
|
|
128065
128201
|
class AttachmentBuilder {
|
|
128066
128202
|
constructor(attachment, data = {}) {
|
|
@@ -128108,7 +128244,7 @@ var require_AttachmentBuilder = __commonJS((exports, module2) => {
|
|
|
128108
128244
|
return this;
|
|
128109
128245
|
}
|
|
128110
128246
|
get spoiler() {
|
|
128111
|
-
return
|
|
128247
|
+
return basename6(this.name).startsWith("SPOILER_");
|
|
128112
128248
|
}
|
|
128113
128249
|
toJSON() {
|
|
128114
128250
|
return flatten(this);
|
|
@@ -128876,8 +129012,8 @@ var init_writer2 = __esm(() => {
|
|
|
128876
129012
|
});
|
|
128877
129013
|
|
|
128878
129014
|
// packages/omo-config-core/src/generator/mini-os-generator.ts
|
|
128879
|
-
import { existsSync as
|
|
128880
|
-
import { dirname as
|
|
129015
|
+
import { existsSync as existsSync29, mkdirSync as mkdirSync11, writeFileSync as writeFileSync8 } from "fs";
|
|
129016
|
+
import { dirname as dirname10, join as join28 } from "path";
|
|
128881
129017
|
function generateMiniOS(options) {
|
|
128882
129018
|
const fs6 = options.fs ?? defaultFS;
|
|
128883
129019
|
const profile2 = options.profile;
|
|
@@ -128888,29 +129024,29 @@ function generateMiniOS(options) {
|
|
|
128888
129024
|
if (!fs6.existsSync(targetDir)) {
|
|
128889
129025
|
fs6.mkdirSync(targetDir, { recursive: true });
|
|
128890
129026
|
}
|
|
128891
|
-
const pkgPath =
|
|
129027
|
+
const pkgPath = join28(targetDir, "package.json");
|
|
128892
129028
|
writeIfMissing(fs6, pkgPath, TPL_PACKAGE_JSON(packageName, displayName, profile2.version, profile2.description, profile2.extends, profile2.baseAgent));
|
|
128893
129029
|
filesWritten.push(pkgPath);
|
|
128894
|
-
const srcDir =
|
|
129030
|
+
const srcDir = join28(targetDir, "src");
|
|
128895
129031
|
fs6.mkdirSync(srcDir, { recursive: true });
|
|
128896
|
-
const indexPath =
|
|
129032
|
+
const indexPath = join28(srcDir, "index.ts");
|
|
128897
129033
|
writeIfMissing(fs6, indexPath, TPL_INDEX_TS(profile2.name, displayName, profile2.description));
|
|
128898
129034
|
filesWritten.push(indexPath);
|
|
128899
|
-
const binDir =
|
|
129035
|
+
const binDir = join28(targetDir, "bin");
|
|
128900
129036
|
fs6.mkdirSync(binDir, { recursive: true });
|
|
128901
|
-
const binPath =
|
|
129037
|
+
const binPath = join28(binDir, "matrixos-mini.js");
|
|
128902
129038
|
writeIfMissing(fs6, binPath, TPL_BIN);
|
|
128903
129039
|
filesWritten.push(binPath);
|
|
128904
|
-
const scriptDir =
|
|
129040
|
+
const scriptDir = join28(targetDir, "script");
|
|
128905
129041
|
fs6.mkdirSync(scriptDir, { recursive: true });
|
|
128906
|
-
const buildPath =
|
|
129042
|
+
const buildPath = join28(scriptDir, "build.ts");
|
|
128907
129043
|
writeIfMissing(fs6, buildPath, TPL_BUILD_TS);
|
|
128908
129044
|
filesWritten.push(buildPath);
|
|
128909
129045
|
if (Object.keys(profile2.agents).length > 0) {
|
|
128910
|
-
const agentsDir =
|
|
129046
|
+
const agentsDir = join28(targetDir, "agents");
|
|
128911
129047
|
fs6.mkdirSync(agentsDir, { recursive: true });
|
|
128912
129048
|
for (const [agentName, agentDef] of Object.entries(profile2.agents)) {
|
|
128913
|
-
const agentFile =
|
|
129049
|
+
const agentFile = join28(agentsDir, `${agentName}.ts`);
|
|
128914
129050
|
const description = agentDef.description ?? `Custom ${displayName} agent: ${agentName}`;
|
|
128915
129051
|
writeIfMissing(fs6, agentFile, `// ${description}
|
|
128916
129052
|
// Generated by MaTrixOS Mini-OS Profile Generator.
|
|
@@ -128921,10 +129057,10 @@ export const description = ${JSON.stringify(description)}
|
|
|
128921
129057
|
}
|
|
128922
129058
|
}
|
|
128923
129059
|
if (profile2.skills.length > 0) {
|
|
128924
|
-
const skillsDir =
|
|
129060
|
+
const skillsDir = join28(targetDir, "skills");
|
|
128925
129061
|
fs6.mkdirSync(skillsDir, { recursive: true });
|
|
128926
129062
|
for (const skill of profile2.skills) {
|
|
128927
|
-
const skillFile =
|
|
129063
|
+
const skillFile = join28(skillsDir, `${skill}.md`);
|
|
128928
129064
|
writeIfMissing(fs6, skillFile, `# ${skill}
|
|
128929
129065
|
|
|
128930
129066
|
_Skill required by the ${displayName} profile. Implementation goes here._
|
|
@@ -128932,12 +129068,12 @@ _Skill required by the ${displayName} profile. Implementation goes here._
|
|
|
128932
129068
|
filesWritten.push(skillFile);
|
|
128933
129069
|
}
|
|
128934
129070
|
}
|
|
128935
|
-
const readmePath =
|
|
129071
|
+
const readmePath = join28(targetDir, "README.md");
|
|
128936
129072
|
const agentsList = Object.keys(profile2.agents);
|
|
128937
129073
|
const skillsList = profile2.skills;
|
|
128938
129074
|
writeIfMissing(fs6, readmePath, TPL_README(packageName, displayName, profile2.description, profile2.version, profile2.baseAgent, profile2.extends, agentsList, skillsList));
|
|
128939
129075
|
filesWritten.push(readmePath);
|
|
128940
|
-
const agentsMdPath =
|
|
129076
|
+
const agentsMdPath = join28(targetDir, "AGENTS.md");
|
|
128941
129077
|
writeIfMissing(fs6, agentsMdPath, TPL_AGENT_MD(displayName, profile2.description));
|
|
128942
129078
|
filesWritten.push(agentsMdPath);
|
|
128943
129079
|
return { packageName, packageDir: targetDir, filesWritten };
|
|
@@ -128945,7 +129081,7 @@ _Skill required by the ${displayName} profile. Implementation goes here._
|
|
|
128945
129081
|
function writeIfMissing(fs6, path7, content) {
|
|
128946
129082
|
if (fs6.existsSync(path7))
|
|
128947
129083
|
return;
|
|
128948
|
-
const dir =
|
|
129084
|
+
const dir = dirname10(path7);
|
|
128949
129085
|
if (!fs6.existsSync(dir)) {
|
|
128950
129086
|
fs6.mkdirSync(dir, { recursive: true });
|
|
128951
129087
|
}
|
|
@@ -129089,7 +129225,7 @@ This profile is activated when the user mentions the profile name in their reque
|
|
|
129089
129225
|
- Profiles can be composed: multiple profiles in \`profiles: [...]\` are merged in order.
|
|
129090
129226
|
`;
|
|
129091
129227
|
var init_mini_os_generator = __esm(() => {
|
|
129092
|
-
defaultFS = { existsSync:
|
|
129228
|
+
defaultFS = { existsSync: existsSync29, mkdirSync: mkdirSync11, writeFileSync: writeFileSync8 };
|
|
129093
129229
|
});
|
|
129094
129230
|
|
|
129095
129231
|
// packages/omo-config-core/src/generator/index.ts
|
|
@@ -129798,20 +129934,20 @@ var init_update_toasts = __esm(() => {
|
|
|
129798
129934
|
});
|
|
129799
129935
|
|
|
129800
129936
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
129801
|
-
import { existsSync as
|
|
129802
|
-
import { dirname as
|
|
129937
|
+
import { existsSync as existsSync45 } from "fs";
|
|
129938
|
+
import { dirname as dirname18, join as join40 } from "path";
|
|
129803
129939
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
129804
129940
|
function defaultGetModuleHostingWorkspace() {
|
|
129805
129941
|
try {
|
|
129806
|
-
const currentDir =
|
|
129942
|
+
const currentDir = dirname18(fileURLToPath4(import.meta.url));
|
|
129807
129943
|
const pkgJsonPath = findPackageJsonUp(currentDir);
|
|
129808
129944
|
if (!pkgJsonPath)
|
|
129809
129945
|
return null;
|
|
129810
|
-
const pkgDir =
|
|
129811
|
-
const nodeModulesDir =
|
|
129946
|
+
const pkgDir = dirname18(pkgJsonPath);
|
|
129947
|
+
const nodeModulesDir = dirname18(pkgDir);
|
|
129812
129948
|
if (nodeModulesDir.split(/[\\/]/).pop() !== "node_modules")
|
|
129813
129949
|
return null;
|
|
129814
|
-
return
|
|
129950
|
+
return dirname18(nodeModulesDir);
|
|
129815
129951
|
} catch (error51) {
|
|
129816
129952
|
if (error51 instanceof Error) {
|
|
129817
129953
|
return null;
|
|
@@ -129952,8 +130088,8 @@ var init_background_update_check = __esm(() => {
|
|
|
129952
130088
|
init_package_json_locator();
|
|
129953
130089
|
init_update_toasts();
|
|
129954
130090
|
defaultDeps4 = {
|
|
129955
|
-
existsSync:
|
|
129956
|
-
join:
|
|
130091
|
+
existsSync: existsSync45,
|
|
130092
|
+
join: join40,
|
|
129957
130093
|
runBunInstallWithDetails,
|
|
129958
130094
|
log: log2,
|
|
129959
130095
|
getOpenCodeCacheDir,
|
|
@@ -154937,7 +155073,7 @@ var require_libvips = __commonJS((exports2, module2) => {
|
|
|
154937
155073
|
shell: true
|
|
154938
155074
|
};
|
|
154939
155075
|
var vendorPath = path18.join(__dirname, "..", "vendor", minimumLibvipsVersion, platform());
|
|
154940
|
-
var
|
|
155076
|
+
var mkdirSync18 = function(dirPath) {
|
|
154941
155077
|
try {
|
|
154942
155078
|
fs18.mkdirSync(dirPath, { recursive: true });
|
|
154943
155079
|
} catch (err) {
|
|
@@ -154948,9 +155084,9 @@ var require_libvips = __commonJS((exports2, module2) => {
|
|
|
154948
155084
|
};
|
|
154949
155085
|
var cachePath = function() {
|
|
154950
155086
|
const npmCachePath = env4.npm_config_cache || (env4.APPDATA ? path18.join(env4.APPDATA, "npm-cache") : path18.join(os7.homedir(), ".npm"));
|
|
154951
|
-
|
|
155087
|
+
mkdirSync18(npmCachePath);
|
|
154952
155088
|
const libvipsCachePath = path18.join(npmCachePath, "_libvips");
|
|
154953
|
-
|
|
155089
|
+
mkdirSync18(libvipsCachePath);
|
|
154954
155090
|
return libvipsCachePath;
|
|
154955
155091
|
};
|
|
154956
155092
|
var integrity = function(platformAndArch) {
|
|
@@ -155027,7 +155163,7 @@ var require_libvips = __commonJS((exports2, module2) => {
|
|
|
155027
155163
|
removeVendoredLibvips,
|
|
155028
155164
|
pkgConfigPath,
|
|
155029
155165
|
useGlobalLibvips,
|
|
155030
|
-
mkdirSync:
|
|
155166
|
+
mkdirSync: mkdirSync18
|
|
155031
155167
|
};
|
|
155032
155168
|
});
|
|
155033
155169
|
|
|
@@ -164783,19 +164919,19 @@ __export(exports_generate, {
|
|
|
164783
164919
|
executeGenerateCommand: () => executeGenerateCommand,
|
|
164784
164920
|
ProfileNotFoundError: () => ProfileNotFoundError
|
|
164785
164921
|
});
|
|
164786
|
-
import { existsSync as
|
|
164787
|
-
import { dirname as
|
|
164922
|
+
import { existsSync as existsSync72, readFileSync as readFileSync57, realpathSync as realpathSync10 } from "fs";
|
|
164923
|
+
import { dirname as dirname29, isAbsolute as isAbsolute6, join as join77, resolve as resolve16 } from "path";
|
|
164788
164924
|
function profilesDirFor(opts) {
|
|
164789
164925
|
if (opts.profilesDir)
|
|
164790
164926
|
return opts.profilesDir;
|
|
164791
164927
|
if (opts.cwd)
|
|
164792
|
-
return
|
|
164793
|
-
return
|
|
164928
|
+
return join77(opts.cwd, PROFILES_RELATIVE);
|
|
164929
|
+
return join77(REPO_ROOT, PROFILES_RELATIVE);
|
|
164794
164930
|
}
|
|
164795
164931
|
function loadProfile(name2, options = {}) {
|
|
164796
164932
|
const fs22 = options.fs ?? defaultFS2;
|
|
164797
164933
|
const dir = profilesDirFor(options);
|
|
164798
|
-
const path27 =
|
|
164934
|
+
const path27 = join77(dir, `${name2}.json`);
|
|
164799
164935
|
if (!fs22.existsSync(path27)) {
|
|
164800
164936
|
throw new ProfileNotFoundError(name2);
|
|
164801
164937
|
}
|
|
@@ -164808,7 +164944,7 @@ function listProfiles(options = {}) {
|
|
|
164808
164944
|
const known = options.knownNames ?? ["trader", "plumber"];
|
|
164809
164945
|
const out = [];
|
|
164810
164946
|
for (const name2 of known) {
|
|
164811
|
-
const path27 =
|
|
164947
|
+
const path27 = join77(dir, `${name2}.json`);
|
|
164812
164948
|
if (fs22.existsSync(path27)) {
|
|
164813
164949
|
try {
|
|
164814
164950
|
const raw = JSON.parse(fs22.readFileSync(path27, "utf-8"));
|
|
@@ -164880,8 +165016,8 @@ var REPO_ROOT, defaultFS2, PROFILES_RELATIVE = "assets/profiles", ProfileNotFoun
|
|
|
164880
165016
|
var init_generate = __esm(() => {
|
|
164881
165017
|
init_src5();
|
|
164882
165018
|
init_src5();
|
|
164883
|
-
REPO_ROOT = resolve16(
|
|
164884
|
-
defaultFS2 = { existsSync:
|
|
165019
|
+
REPO_ROOT = resolve16(dirname29(new URL(import.meta.url).pathname), "..", "..", "..", "..", "..");
|
|
165020
|
+
defaultFS2 = { existsSync: existsSync72, readFileSync: readFileSync57, realpathSync: realpathSync10 };
|
|
164885
165021
|
ProfileNotFoundError = class ProfileNotFoundError extends Error {
|
|
164886
165022
|
profileName;
|
|
164887
165023
|
constructor(profileName) {
|
|
@@ -165000,12 +165136,12 @@ __export(exports_cost_report, {
|
|
|
165000
165136
|
executeCostReportCommand: () => executeCostReportCommand
|
|
165001
165137
|
});
|
|
165002
165138
|
import { Database as Database6 } from "bun:sqlite";
|
|
165003
|
-
import { existsSync as
|
|
165139
|
+
import { existsSync as existsSync73 } from "fs";
|
|
165004
165140
|
import * as path28 from "path";
|
|
165005
165141
|
import * as os14 from "os";
|
|
165006
165142
|
function executeCostReportCommand(args) {
|
|
165007
165143
|
const dbPath = path28.join(os14.homedir(), ".matrixos", "cost.db");
|
|
165008
|
-
if (!
|
|
165144
|
+
if (!existsSync73(dbPath)) {
|
|
165009
165145
|
return { exitCode: 1, stdout: `No cost data available
|
|
165010
165146
|
` };
|
|
165011
165147
|
}
|
|
@@ -165135,8 +165271,8 @@ var exports_profile_resolve = {};
|
|
|
165135
165271
|
__export(exports_profile_resolve, {
|
|
165136
165272
|
executeProfileResolveCommand: () => executeProfileResolveCommand
|
|
165137
165273
|
});
|
|
165138
|
-
import { existsSync as
|
|
165139
|
-
import { join as
|
|
165274
|
+
import { existsSync as existsSync74, readdirSync as readdirSync16, readFileSync as readFileSync58 } from "fs";
|
|
165275
|
+
import { join as join80, resolve as resolve17, dirname as dirname30 } from "path";
|
|
165140
165276
|
function executeProfileResolveCommand(args) {
|
|
165141
165277
|
if (args.options.help) {
|
|
165142
165278
|
return {
|
|
@@ -165161,14 +165297,14 @@ function executeProfileResolveCommand(args) {
|
|
|
165161
165297
|
` };
|
|
165162
165298
|
}
|
|
165163
165299
|
const name2 = nameRaw.endsWith(".json") ? nameRaw.slice(0, -5) : nameRaw;
|
|
165164
|
-
const profilesDir =
|
|
165165
|
-
if (!
|
|
165300
|
+
const profilesDir = join80(REPO_ROOT2, PROFILES_RELATIVE2);
|
|
165301
|
+
if (!existsSync74(profilesDir)) {
|
|
165166
165302
|
return { exitCode: 1, stdout: `error: profiles directory not found at ${profilesDir}
|
|
165167
165303
|
` };
|
|
165168
165304
|
}
|
|
165169
165305
|
let profileFiles;
|
|
165170
165306
|
try {
|
|
165171
|
-
profileFiles =
|
|
165307
|
+
profileFiles = readdirSync16(profilesDir).filter((f2) => f2.endsWith(".json"));
|
|
165172
165308
|
} catch (err) {
|
|
165173
165309
|
const message = err instanceof Error ? err.message : String(err);
|
|
165174
165310
|
return { exitCode: 1, stdout: `error: failed to read profiles directory: ${message}
|
|
@@ -165181,7 +165317,7 @@ function executeProfileResolveCommand(args) {
|
|
|
165181
165317
|
const registry2 = {};
|
|
165182
165318
|
for (const file3 of profileFiles) {
|
|
165183
165319
|
try {
|
|
165184
|
-
const filePath =
|
|
165320
|
+
const filePath = join80(profilesDir, file3);
|
|
165185
165321
|
const raw = JSON.parse(readFileSync58(filePath, "utf-8"));
|
|
165186
165322
|
const profile2 = ProfileSchema.parse(raw);
|
|
165187
165323
|
registry2[profile2.name] = profile2;
|
|
@@ -165234,7 +165370,7 @@ function executeProfileResolveCommand(args) {
|
|
|
165234
165370
|
var REPO_ROOT2, PROFILES_RELATIVE2 = "assets/profiles";
|
|
165235
165371
|
var init_profile_resolve = __esm(() => {
|
|
165236
165372
|
init_src5();
|
|
165237
|
-
REPO_ROOT2 = resolve17(
|
|
165373
|
+
REPO_ROOT2 = resolve17(dirname30(new URL(import.meta.url).pathname), "..", "..", "..", "..");
|
|
165238
165374
|
});
|
|
165239
165375
|
|
|
165240
165376
|
// packages/omo-opencode/src/cli/export.ts
|
|
@@ -165244,8 +165380,8 @@ __export(exports_export, {
|
|
|
165244
165380
|
getShell: () => getShell,
|
|
165245
165381
|
executeExportCommand: () => executeExportCommand
|
|
165246
165382
|
});
|
|
165247
|
-
import { existsSync as
|
|
165248
|
-
import { isAbsolute as isAbsolute7, join as
|
|
165383
|
+
import { existsSync as existsSync75, readFileSync as readFileSync59, writeFileSync as writeFileSync26, copyFileSync as copyFileSync8, realpathSync as realpathSync11, mkdirSync as mkdirSync27 } from "fs";
|
|
165384
|
+
import { isAbsolute as isAbsolute7, join as join81, resolve as resolve18, dirname as dirname31 } from "path";
|
|
165249
165385
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
165250
165386
|
function setShell(shell) {
|
|
165251
165387
|
activeShell = shell;
|
|
@@ -165286,7 +165422,7 @@ function executeExportCommand(args) {
|
|
|
165286
165422
|
return { exitCode: 1, stdout: `error: generate failed: ${message}
|
|
165287
165423
|
` };
|
|
165288
165424
|
}
|
|
165289
|
-
const pkgPath =
|
|
165425
|
+
const pkgPath = join81(absoluteTargetDir, "package.json");
|
|
165290
165426
|
let pkg;
|
|
165291
165427
|
try {
|
|
165292
165428
|
pkg = JSON.parse(fs24.readFileSync(pkgPath, "utf-8"));
|
|
@@ -165326,11 +165462,11 @@ ${packResult.stdout}
|
|
|
165326
165462
|
return { exitCode: 1, stdout: `error: npm pack produced no tarball name in output
|
|
165327
165463
|
` };
|
|
165328
165464
|
}
|
|
165329
|
-
let tgzPath =
|
|
165465
|
+
let tgzPath = join81(absoluteTargetDir, tgzName);
|
|
165330
165466
|
if (args.options.output) {
|
|
165331
165467
|
const outputPath = args.options.output;
|
|
165332
165468
|
const absoluteOutput = isAbsolute7(outputPath) ? outputPath : resolve18(process.cwd(), outputPath);
|
|
165333
|
-
const outputDir =
|
|
165469
|
+
const outputDir = dirname31(absoluteOutput);
|
|
165334
165470
|
if (!fs24.existsSync(outputDir)) {
|
|
165335
165471
|
fs24.mkdirSync(outputDir, { recursive: true });
|
|
165336
165472
|
}
|
|
@@ -165367,12 +165503,12 @@ var init_export = __esm(() => {
|
|
|
165367
165503
|
};
|
|
165368
165504
|
activeShell = defaultShell;
|
|
165369
165505
|
defaultExportFS = {
|
|
165370
|
-
existsSync:
|
|
165506
|
+
existsSync: existsSync75,
|
|
165371
165507
|
readFileSync: readFileSync59,
|
|
165372
165508
|
writeFileSync: writeFileSync26,
|
|
165373
|
-
copyFileSync:
|
|
165509
|
+
copyFileSync: copyFileSync8,
|
|
165374
165510
|
realpathSync: realpathSync11,
|
|
165375
|
-
mkdirSync:
|
|
165511
|
+
mkdirSync: mkdirSync27
|
|
165376
165512
|
};
|
|
165377
165513
|
});
|
|
165378
165514
|
|
|
@@ -165396,23 +165532,23 @@ __export(exports_project_context, {
|
|
|
165396
165532
|
createProject: () => createProject,
|
|
165397
165533
|
archiveProject: () => archiveProject
|
|
165398
165534
|
});
|
|
165399
|
-
import { existsSync as
|
|
165400
|
-
import { join as
|
|
165535
|
+
import { existsSync as existsSync76, mkdirSync as mkdirSync28, readFileSync as readFileSync60, writeFileSync as writeFileSync27, rmSync as rmSync8 } from "fs";
|
|
165536
|
+
import { join as join82 } from "path";
|
|
165401
165537
|
function getMatrixOsDir(cwd = process.cwd()) {
|
|
165402
|
-
return
|
|
165538
|
+
return join82(cwd, ".matrixos");
|
|
165403
165539
|
}
|
|
165404
165540
|
function getProjectsDir(cwd) {
|
|
165405
|
-
return
|
|
165541
|
+
return join82(getMatrixOsDir(cwd), "projects");
|
|
165406
165542
|
}
|
|
165407
165543
|
function getProjectDir(slug, cwd) {
|
|
165408
|
-
return
|
|
165544
|
+
return join82(getProjectsDir(cwd), slug);
|
|
165409
165545
|
}
|
|
165410
165546
|
function getStatePath(cwd) {
|
|
165411
|
-
return
|
|
165547
|
+
return join82(getMatrixOsDir(cwd), "state.json");
|
|
165412
165548
|
}
|
|
165413
165549
|
function loadState(cwd) {
|
|
165414
165550
|
const path29 = getStatePath(cwd);
|
|
165415
|
-
if (!
|
|
165551
|
+
if (!existsSync76(path29))
|
|
165416
165552
|
return {};
|
|
165417
165553
|
try {
|
|
165418
165554
|
return JSON.parse(readFileSync60(path29, "utf-8"));
|
|
@@ -165422,13 +165558,13 @@ function loadState(cwd) {
|
|
|
165422
165558
|
}
|
|
165423
165559
|
function saveState(state2, cwd) {
|
|
165424
165560
|
const path29 = getStatePath(cwd);
|
|
165425
|
-
|
|
165561
|
+
mkdirSync28(getMatrixOsDir(cwd), { recursive: true });
|
|
165426
165562
|
writeFileSync27(path29, JSON.stringify(state2, null, 2) + `
|
|
165427
165563
|
`);
|
|
165428
165564
|
}
|
|
165429
165565
|
function loadProjectMeta(slug, cwd) {
|
|
165430
|
-
const path29 =
|
|
165431
|
-
if (!
|
|
165566
|
+
const path29 = join82(getProjectDir(slug, cwd), "meta.json");
|
|
165567
|
+
if (!existsSync76(path29))
|
|
165432
165568
|
return null;
|
|
165433
165569
|
try {
|
|
165434
165570
|
return JSON.parse(readFileSync60(path29, "utf-8"));
|
|
@@ -165438,16 +165574,16 @@ function loadProjectMeta(slug, cwd) {
|
|
|
165438
165574
|
}
|
|
165439
165575
|
function saveProjectMeta(slug, meta3, cwd) {
|
|
165440
165576
|
const dir = getProjectDir(slug, cwd);
|
|
165441
|
-
|
|
165442
|
-
const path29 =
|
|
165577
|
+
mkdirSync28(dir, { recursive: true });
|
|
165578
|
+
const path29 = join82(dir, "meta.json");
|
|
165443
165579
|
writeFileSync27(path29, JSON.stringify(meta3, null, 2) + `
|
|
165444
165580
|
`);
|
|
165445
165581
|
}
|
|
165446
165582
|
function initProjectFiles(slug, cwd) {
|
|
165447
165583
|
const dir = getProjectDir(slug, cwd);
|
|
165448
|
-
|
|
165449
|
-
const kanbanPath =
|
|
165450
|
-
if (!
|
|
165584
|
+
mkdirSync28(join82(dir, "kb"), { recursive: true });
|
|
165585
|
+
const kanbanPath = join82(dir, "kanban.json");
|
|
165586
|
+
if (!existsSync76(kanbanPath)) {
|
|
165451
165587
|
writeFileSync27(kanbanPath, JSON.stringify({ columns: ["todo", "in-progress", "review", "done"], tasks: [] }, null, 2) + `
|
|
165452
165588
|
`);
|
|
165453
165589
|
}
|
|
@@ -165457,7 +165593,7 @@ function createProject(slug, options = {}) {
|
|
|
165457
165593
|
throw new Error(`Invalid project slug "${slug}": only lowercase letters, numbers, - and _ are allowed.`);
|
|
165458
165594
|
}
|
|
165459
165595
|
const dir = getProjectDir(slug, options.cwd);
|
|
165460
|
-
if (
|
|
165596
|
+
if (existsSync76(dir)) {
|
|
165461
165597
|
throw new Error(`Project "${slug}" already exists.`);
|
|
165462
165598
|
}
|
|
165463
165599
|
const now = new Date().toISOString();
|
|
@@ -165478,7 +165614,7 @@ function createProject(slug, options = {}) {
|
|
|
165478
165614
|
function listProjects(cwd) {
|
|
165479
165615
|
const state2 = loadState(cwd);
|
|
165480
165616
|
const root = getProjectsDir(cwd);
|
|
165481
|
-
if (!
|
|
165617
|
+
if (!existsSync76(root))
|
|
165482
165618
|
return [];
|
|
165483
165619
|
const fs24 = __require("fs");
|
|
165484
165620
|
const items = [];
|
|
@@ -165526,7 +165662,7 @@ function unarchiveProject(slug, cwd) {
|
|
|
165526
165662
|
}
|
|
165527
165663
|
function deleteProject(slug, cwd) {
|
|
165528
165664
|
const dir = getProjectDir(slug, cwd);
|
|
165529
|
-
if (!
|
|
165665
|
+
if (!existsSync76(dir))
|
|
165530
165666
|
throw new Error(`Project "${slug}" does not exist.`);
|
|
165531
165667
|
rmSync8(dir, { recursive: true, force: true });
|
|
165532
165668
|
const state2 = loadState(cwd);
|
|
@@ -165557,8 +165693,8 @@ __export(exports_project_memory, {
|
|
|
165557
165693
|
isProjectEpisode: () => isProjectEpisode,
|
|
165558
165694
|
addKbDocument: () => addKbDocument
|
|
165559
165695
|
});
|
|
165560
|
-
import { existsSync as
|
|
165561
|
-
import { join as
|
|
165696
|
+
import { existsSync as existsSync77, mkdirSync as mkdirSync29, readFileSync as readFileSync61, readdirSync as readdirSync17, writeFileSync as writeFileSync28 } from "fs";
|
|
165697
|
+
import { join as join83 } from "path";
|
|
165562
165698
|
function tagWithProject(metadata = {}, projectSlug, cwd) {
|
|
165563
165699
|
const active = projectSlug ?? getActiveProject(cwd)?.slug;
|
|
165564
165700
|
if (!active)
|
|
@@ -165572,14 +165708,14 @@ function isProjectEpisode(ep, projectSlug, cwd) {
|
|
|
165572
165708
|
return ep.metadata?.project === target;
|
|
165573
165709
|
}
|
|
165574
165710
|
function listKbDocuments(projectSlug, cwd) {
|
|
165575
|
-
const kbDir =
|
|
165576
|
-
if (!
|
|
165711
|
+
const kbDir = join83(getProjectDir(projectSlug, cwd), "kb");
|
|
165712
|
+
if (!existsSync77(kbDir))
|
|
165577
165713
|
return [];
|
|
165578
165714
|
const docs = [];
|
|
165579
|
-
for (const entry of
|
|
165715
|
+
for (const entry of readdirSync17(kbDir, { withFileTypes: true })) {
|
|
165580
165716
|
if (!entry.isFile())
|
|
165581
165717
|
continue;
|
|
165582
|
-
const path29 =
|
|
165718
|
+
const path29 = join83(kbDir, entry.name);
|
|
165583
165719
|
try {
|
|
165584
165720
|
docs.push({ path: path29, content: readFileSync61(path29, "utf-8") });
|
|
165585
165721
|
} catch {}
|
|
@@ -165623,10 +165759,10 @@ async function searchProject(query, options = {}) {
|
|
|
165623
165759
|
return [...kbHits, ...memoryHits].sort((a2, b2) => b2.score - a2.score);
|
|
165624
165760
|
}
|
|
165625
165761
|
function addKbDocument(projectSlug, filename, content, cwd) {
|
|
165626
|
-
const kbDir =
|
|
165627
|
-
|
|
165762
|
+
const kbDir = join83(getProjectDir(projectSlug, cwd), "kb");
|
|
165763
|
+
mkdirSync29(kbDir, { recursive: true });
|
|
165628
165764
|
const safeName = filename.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
165629
|
-
const path29 =
|
|
165765
|
+
const path29 = join83(kbDir, safeName);
|
|
165630
165766
|
writeFileSync28(path29, content, "utf-8");
|
|
165631
165767
|
return path29;
|
|
165632
165768
|
}
|
|
@@ -166003,10 +166139,10 @@ __export(exports_gateway_start, {
|
|
|
166003
166139
|
buildTelegramConfig: () => buildTelegramConfig,
|
|
166004
166140
|
buildGatewayConfig: () => buildGatewayConfig
|
|
166005
166141
|
});
|
|
166006
|
-
import { readFileSync as readFileSync62, existsSync as
|
|
166142
|
+
import { readFileSync as readFileSync62, existsSync as existsSync78 } from "fs";
|
|
166007
166143
|
import { resolve as resolve19 } from "path";
|
|
166008
166144
|
function loadGatewayEnv(path29 = ENV_PATH) {
|
|
166009
|
-
if (!
|
|
166145
|
+
if (!existsSync78(path29))
|
|
166010
166146
|
return {};
|
|
166011
166147
|
const text = readFileSync62(path29, "utf8");
|
|
166012
166148
|
const out = {};
|
|
@@ -166145,7 +166281,7 @@ var init_deployment_core = __esm(() => {
|
|
|
166145
166281
|
|
|
166146
166282
|
// packages/omo-opencode/src/deployment/deploy-static.ts
|
|
166147
166283
|
import { spawn as spawn6 } from "child_process";
|
|
166148
|
-
import { existsSync as
|
|
166284
|
+
import { existsSync as existsSync79 } from "fs";
|
|
166149
166285
|
import { resolve as resolve20 } from "path";
|
|
166150
166286
|
function pushStage(stage, message, ok = true) {
|
|
166151
166287
|
return { stage, message, ok };
|
|
@@ -166202,7 +166338,7 @@ var init_deploy_static = __esm(() => {
|
|
|
166202
166338
|
}
|
|
166203
166339
|
stages.push(pushStage("build", "build succeeded"));
|
|
166204
166340
|
}
|
|
166205
|
-
if (!
|
|
166341
|
+
if (!existsSync79(buildDir)) {
|
|
166206
166342
|
stages.push(pushStage("push", `build directory not found: ${buildDir}`, false));
|
|
166207
166343
|
return { target: "static", ok: false, stages, error: "build directory missing" };
|
|
166208
166344
|
}
|
|
@@ -166478,10 +166614,10 @@ var init_deployment = __esm(() => {
|
|
|
166478
166614
|
});
|
|
166479
166615
|
|
|
166480
166616
|
// packages/omo-opencode/src/audit/self-audit.ts
|
|
166481
|
-
import { existsSync as
|
|
166482
|
-
import { join as
|
|
166617
|
+
import { existsSync as existsSync80, mkdirSync as mkdirSync30, readdirSync as readdirSync18, readFileSync as readFileSync63, writeFileSync as writeFileSync29 } from "fs";
|
|
166618
|
+
import { join as join84 } from "path";
|
|
166483
166619
|
function getAuditDir(cwd = process.cwd()) {
|
|
166484
|
-
return
|
|
166620
|
+
return join84(cwd, ".matrixos", "audits");
|
|
166485
166621
|
}
|
|
166486
166622
|
function getWeekString(date5 = new Date) {
|
|
166487
166623
|
const d = new Date(Date.UTC(date5.getFullYear(), date5.getMonth(), date5.getDate()));
|
|
@@ -166588,8 +166724,8 @@ function formatAuditReport(report) {
|
|
|
166588
166724
|
}
|
|
166589
166725
|
function writeAuditReport(report, cwd) {
|
|
166590
166726
|
const dir = getAuditDir(cwd);
|
|
166591
|
-
|
|
166592
|
-
const path29 =
|
|
166727
|
+
mkdirSync30(dir, { recursive: true });
|
|
166728
|
+
const path29 = join84(dir, `${report.week}.md`);
|
|
166593
166729
|
writeFileSync29(path29, formatAuditReport(report), "utf-8");
|
|
166594
166730
|
return path29;
|
|
166595
166731
|
}
|
|
@@ -167556,7 +167692,7 @@ async function processEvents(ctx, stream, state) {
|
|
|
167556
167692
|
}
|
|
167557
167693
|
// packages/omo-opencode/src/plugin-config/layered-config-loader.ts
|
|
167558
167694
|
import * as fs7 from "fs";
|
|
167559
|
-
import { homedir as
|
|
167695
|
+
import { homedir as homedir9 } from "os";
|
|
167560
167696
|
import * as path7 from "path";
|
|
167561
167697
|
|
|
167562
167698
|
// packages/omo-opencode/src/config/schema/agent-names.ts
|
|
@@ -168540,7 +168676,7 @@ function loadConfigFromPath(configPath, _ctx) {
|
|
|
168540
168676
|
|
|
168541
168677
|
// packages/omo-opencode/src/plugin-config/layered-config-loader.ts
|
|
168542
168678
|
function resolveHomeDirectory() {
|
|
168543
|
-
return process.env.HOME ?? process.env.USERPROFILE ??
|
|
168679
|
+
return process.env.HOME ?? process.env.USERPROFILE ?? homedir9();
|
|
168544
168680
|
}
|
|
168545
168681
|
function resolveConfigPathAfterLegacyMigration(detectedPath) {
|
|
168546
168682
|
if (!path7.basename(detectedPath).startsWith(LEGACY_CONFIG_BASENAME)) {
|
|
@@ -168681,7 +168817,7 @@ var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
|
168681
168817
|
// packages/omo-opencode/src/cli/run/opencode-binary-resolver.ts
|
|
168682
168818
|
init_bun_which_shim();
|
|
168683
168819
|
init_spawn_with_windows_hide();
|
|
168684
|
-
import { delimiter as delimiter2, dirname as
|
|
168820
|
+
import { delimiter as delimiter2, dirname as dirname12, posix as posix3, win32 as win324 } from "path";
|
|
168685
168821
|
var OPENCODE_COMMANDS = ["opencode", "opencode-desktop"];
|
|
168686
168822
|
var WINDOWS_SUFFIXES = ["", ".exe", ".cmd", ".bat", ".ps1"];
|
|
168687
168823
|
function getCommandCandidates(platform) {
|
|
@@ -168739,7 +168875,7 @@ async function findWorkingOpencodeBinary(pathEnv = process.env.PATH, probe2 = ca
|
|
|
168739
168875
|
return null;
|
|
168740
168876
|
}
|
|
168741
168877
|
function buildPathWithBinaryFirst(pathEnv, binaryPath) {
|
|
168742
|
-
const preferredDir =
|
|
168878
|
+
const preferredDir = dirname12(binaryPath);
|
|
168743
168879
|
const existing = (pathEnv ?? "").split(delimiter2).filter((entry) => entry.length > 0 && entry !== preferredDir);
|
|
168744
168880
|
return [preferredDir, ...existing].join(delimiter2);
|
|
168745
168881
|
}
|
|
@@ -169132,7 +169268,7 @@ var BOULDER_STATE_PATH = `${BOULDER_DIR}/${BOULDER_FILE}`;
|
|
|
169132
169268
|
var NOTEPAD_DIR = "notepads";
|
|
169133
169269
|
var NOTEPAD_BASE_PATH = `${BOULDER_DIR}/${NOTEPAD_DIR}`;
|
|
169134
169270
|
// packages/boulder-state/src/top-level-task.ts
|
|
169135
|
-
import { existsSync as
|
|
169271
|
+
import { existsSync as existsSync32, readFileSync as readFileSync18 } from "fs";
|
|
169136
169272
|
var TODO_HEADING_PATTERN = /^##\s+TODOs\b/i;
|
|
169137
169273
|
var FINAL_VERIFICATION_HEADING_PATTERN = /^##\s+Final Verification Wave\b/i;
|
|
169138
169274
|
var SECOND_LEVEL_HEADING_PATTERN = /^##\s+/;
|
|
@@ -169155,7 +169291,7 @@ function buildTaskRef(section, taskLabel) {
|
|
|
169155
169291
|
};
|
|
169156
169292
|
}
|
|
169157
169293
|
function readCurrentTopLevelTask(planPath) {
|
|
169158
|
-
if (!
|
|
169294
|
+
if (!existsSync32(planPath)) {
|
|
169159
169295
|
return null;
|
|
169160
169296
|
}
|
|
169161
169297
|
try {
|
|
@@ -169184,10 +169320,10 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
169184
169320
|
}
|
|
169185
169321
|
}
|
|
169186
169322
|
// packages/boulder-state/src/storage/path.ts
|
|
169187
|
-
import { existsSync as
|
|
169188
|
-
import { isAbsolute as isAbsolute4, join as
|
|
169323
|
+
import { existsSync as existsSync33 } from "fs";
|
|
169324
|
+
import { isAbsolute as isAbsolute4, join as join30, relative as relative3, resolve as resolve8 } from "path";
|
|
169189
169325
|
function getBoulderFilePath(directory) {
|
|
169190
|
-
return
|
|
169326
|
+
return join30(directory, BOULDER_DIR, BOULDER_FILE);
|
|
169191
169327
|
}
|
|
169192
169328
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
169193
169329
|
return isAbsolute4(trackedPath) ? resolve8(trackedPath) : resolve8(baseDirectory, trackedPath);
|
|
@@ -169205,13 +169341,13 @@ function resolveBoulderPlanPath(directory, state) {
|
|
|
169205
169341
|
}
|
|
169206
169342
|
const absoluteWorktreePath = resolveTrackedPath(directory, worktreePath);
|
|
169207
169343
|
const worktreePlanPath = resolve8(absoluteWorktreePath, relativePlanPath);
|
|
169208
|
-
return
|
|
169344
|
+
return existsSync33(worktreePlanPath) ? worktreePlanPath : absolutePlanPath;
|
|
169209
169345
|
}
|
|
169210
169346
|
function resolveBoulderPlanPathForWork(directory, work) {
|
|
169211
169347
|
return resolveBoulderPlanPath(directory, work);
|
|
169212
169348
|
}
|
|
169213
169349
|
// packages/boulder-state/src/storage/plan-progress.ts
|
|
169214
|
-
import { existsSync as
|
|
169350
|
+
import { existsSync as existsSync34, readFileSync as readFileSync19, readdirSync as readdirSync5, statSync as statSync5 } from "fs";
|
|
169215
169351
|
var TODO_HEADING_PATTERN2 = /^##\s+TODOs\b/i;
|
|
169216
169352
|
var FINAL_VERIFICATION_HEADING_PATTERN2 = /^##\s+Final Verification Wave\b/i;
|
|
169217
169353
|
var SECOND_LEVEL_HEADING_PATTERN2 = /^##\s+/;
|
|
@@ -169220,7 +169356,7 @@ var CHECKED_CHECKBOX_PATTERN = /^(\s*)[-*]\s*\[[xX]\]\s*(.+)$/;
|
|
|
169220
169356
|
var TODO_TASK_PATTERN2 = /^\d+\.\s+/;
|
|
169221
169357
|
var FINAL_WAVE_TASK_PATTERN2 = /^F\d+\.\s+/i;
|
|
169222
169358
|
function getPlanProgress(planPath) {
|
|
169223
|
-
if (!
|
|
169359
|
+
if (!existsSync34(planPath)) {
|
|
169224
169360
|
return { total: 0, completed: 0, isComplete: false };
|
|
169225
169361
|
}
|
|
169226
169362
|
try {
|
|
@@ -169340,10 +169476,10 @@ function selectMirrorWork(state) {
|
|
|
169340
169476
|
return sorted[0] ?? null;
|
|
169341
169477
|
}
|
|
169342
169478
|
// packages/boulder-state/src/storage/read-state.ts
|
|
169343
|
-
import { existsSync as
|
|
169479
|
+
import { existsSync as existsSync35, readFileSync as readFileSync20 } from "fs";
|
|
169344
169480
|
function readBoulderState(directory) {
|
|
169345
169481
|
const filePath = getBoulderFilePath(directory);
|
|
169346
|
-
if (!
|
|
169482
|
+
if (!existsSync35(filePath)) {
|
|
169347
169483
|
return null;
|
|
169348
169484
|
}
|
|
169349
169485
|
try {
|
|
@@ -169413,14 +169549,14 @@ init_state();
|
|
|
169413
169549
|
// packages/omo-opencode/src/features/run-continuation-state/constants.ts
|
|
169414
169550
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
169415
169551
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
169416
|
-
import { existsSync as
|
|
169417
|
-
import { join as
|
|
169552
|
+
import { existsSync as existsSync36, mkdirSync as mkdirSync12, readFileSync as readFileSync21, rmSync as rmSync2, writeFileSync as writeFileSync9 } from "fs";
|
|
169553
|
+
import { join as join31 } from "path";
|
|
169418
169554
|
function getMarkerPath(directory, sessionID) {
|
|
169419
|
-
return
|
|
169555
|
+
return join31(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
169420
169556
|
}
|
|
169421
169557
|
function readContinuationMarker(directory, sessionID) {
|
|
169422
169558
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
169423
|
-
if (!
|
|
169559
|
+
if (!existsSync36(markerPath))
|
|
169424
169560
|
return null;
|
|
169425
169561
|
try {
|
|
169426
169562
|
const raw = readFileSync21(markerPath, "utf-8");
|
|
@@ -169488,8 +169624,8 @@ async function isSessionInBoulderLineage(input) {
|
|
|
169488
169624
|
// packages/omo-opencode/src/hooks/the-operator/session-last-agent.ts
|
|
169489
169625
|
init_shared();
|
|
169490
169626
|
init_compaction_marker();
|
|
169491
|
-
import { readFileSync as readFileSync22, readdirSync as
|
|
169492
|
-
import { join as
|
|
169627
|
+
import { readFileSync as readFileSync22, readdirSync as readdirSync6 } from "fs";
|
|
169628
|
+
import { join as join32 } from "path";
|
|
169493
169629
|
var defaultSessionLastAgentDeps = {
|
|
169494
169630
|
getMessageDir,
|
|
169495
169631
|
isSqliteBackend,
|
|
@@ -169547,9 +169683,9 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
|
|
|
169547
169683
|
if (!messageDir)
|
|
169548
169684
|
return null;
|
|
169549
169685
|
try {
|
|
169550
|
-
const messages =
|
|
169686
|
+
const messages = readdirSync6(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
169551
169687
|
try {
|
|
169552
|
-
const content = readFileSync22(
|
|
169688
|
+
const content = readFileSync22(join32(messageDir, fileName), "utf-8");
|
|
169553
169689
|
const parsed = JSON.parse(content);
|
|
169554
169690
|
return {
|
|
169555
169691
|
fileName,
|
|
@@ -169592,8 +169728,8 @@ init_agent_display_names();
|
|
|
169592
169728
|
|
|
169593
169729
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
169594
169730
|
init_frontmatter2();
|
|
169595
|
-
import { existsSync as
|
|
169596
|
-
import { dirname as
|
|
169731
|
+
import { existsSync as existsSync37, readFileSync as readFileSync23, writeFileSync as writeFileSync10, unlinkSync as unlinkSync6, mkdirSync as mkdirSync13 } from "fs";
|
|
169732
|
+
import { dirname as dirname13, join as join33 } from "path";
|
|
169597
169733
|
|
|
169598
169734
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
169599
169735
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -169602,11 +169738,11 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
169602
169738
|
|
|
169603
169739
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
169604
169740
|
function getStateFilePath(directory, customPath) {
|
|
169605
|
-
return customPath ?
|
|
169741
|
+
return customPath ? join33(directory, customPath) : join33(directory, DEFAULT_STATE_FILE);
|
|
169606
169742
|
}
|
|
169607
169743
|
function readState(directory, customPath) {
|
|
169608
169744
|
const filePath = getStateFilePath(directory, customPath);
|
|
169609
|
-
if (!
|
|
169745
|
+
if (!existsSync37(filePath)) {
|
|
169610
169746
|
return null;
|
|
169611
169747
|
}
|
|
169612
169748
|
try {
|
|
@@ -170185,22 +170321,22 @@ function createTimestampedStdoutController(stdout2 = process.stdout) {
|
|
|
170185
170321
|
// packages/telemetry-core/src/activity-state.ts
|
|
170186
170322
|
init_atomic_write();
|
|
170187
170323
|
init_xdg_data_dir();
|
|
170188
|
-
import { existsSync as
|
|
170189
|
-
import { basename as
|
|
170324
|
+
import { existsSync as existsSync38, mkdirSync as mkdirSync14, readFileSync as readFileSync24 } from "fs";
|
|
170325
|
+
import { basename as basename7, join as join34 } from "path";
|
|
170190
170326
|
var POSTHOG_ACTIVITY_STATE_FILE = "posthog-activity.json";
|
|
170191
170327
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
170192
170328
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
170193
170329
|
env: options.env,
|
|
170194
170330
|
osProvider: options.osProvider
|
|
170195
170331
|
});
|
|
170196
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
170197
|
-
if (dataDir === xdgStateDir || xdgStateDir === undefined &&
|
|
170332
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join34(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
170333
|
+
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename7(dataDir) === product.cacheDirName) {
|
|
170198
170334
|
return dataDir;
|
|
170199
170335
|
}
|
|
170200
|
-
return
|
|
170336
|
+
return join34(dataDir, product.cacheDirName);
|
|
170201
170337
|
}
|
|
170202
170338
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
170203
|
-
return
|
|
170339
|
+
return join34(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
170204
170340
|
}
|
|
170205
170341
|
function getDailyActiveCaptureState(input) {
|
|
170206
170342
|
const state2 = readPostHogActivityState(input.stateDir, input.diagnostics);
|
|
@@ -170225,7 +170361,7 @@ function isPostHogActivityState(value) {
|
|
|
170225
170361
|
}
|
|
170226
170362
|
function readPostHogActivityState(stateDir, diagnostics) {
|
|
170227
170363
|
const stateFilePath = getTelemetryActivityStateFilePath(stateDir);
|
|
170228
|
-
if (!
|
|
170364
|
+
if (!existsSync38(stateFilePath)) {
|
|
170229
170365
|
return {};
|
|
170230
170366
|
}
|
|
170231
170367
|
try {
|
|
@@ -170248,7 +170384,7 @@ function readPostHogActivityState(stateDir, diagnostics) {
|
|
|
170248
170384
|
function writePostHogActivityState(stateDir, nextState, diagnostics) {
|
|
170249
170385
|
const stateFilePath = getTelemetryActivityStateFilePath(stateDir);
|
|
170250
170386
|
try {
|
|
170251
|
-
|
|
170387
|
+
mkdirSync14(stateDir, { recursive: true });
|
|
170252
170388
|
writeFileAtomically(stateFilePath, `${JSON.stringify(nextState, null, 2)}
|
|
170253
170389
|
`);
|
|
170254
170390
|
} catch (error51) {
|
|
@@ -170313,7 +170449,7 @@ function getTelemetryDistinctId(machineIdPrefix, osProvider = getDefaultTelemetr
|
|
|
170313
170449
|
}
|
|
170314
170450
|
|
|
170315
170451
|
// node_modules/.bun/posthog-node@5.45.2/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
170316
|
-
import { dirname as
|
|
170452
|
+
import { dirname as dirname14, posix as posix4, sep } from "path";
|
|
170317
170453
|
function createModulerModifier() {
|
|
170318
170454
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
170319
170455
|
return async (frames) => {
|
|
@@ -170322,7 +170458,7 @@ function createModulerModifier() {
|
|
|
170322
170458
|
return frames;
|
|
170323
170459
|
};
|
|
170324
170460
|
}
|
|
170325
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
170461
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname14(process.argv[1]) : process.cwd(), isWindows = sep === "\\") {
|
|
170326
170462
|
const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
|
|
170327
170463
|
return (filename) => {
|
|
170328
170464
|
if (!filename)
|
|
@@ -177352,14 +177488,14 @@ init_constants5();
|
|
|
177352
177488
|
|
|
177353
177489
|
// packages/omo-opencode/src/cli/doctor/checks/system.ts
|
|
177354
177490
|
init_constants5();
|
|
177355
|
-
import { existsSync as
|
|
177491
|
+
import { existsSync as existsSync49, readFileSync as readFileSync34 } from "fs";
|
|
177356
177492
|
|
|
177357
177493
|
// packages/omo-opencode/src/cli/doctor/checks/system-binary.ts
|
|
177358
177494
|
init_extract_semver();
|
|
177359
177495
|
init_bun_which_shim();
|
|
177360
|
-
import { existsSync as
|
|
177361
|
-
import { homedir as
|
|
177362
|
-
import { join as
|
|
177496
|
+
import { existsSync as existsSync46, accessSync as accessSync4, constants as constants8 } from "fs";
|
|
177497
|
+
import { homedir as homedir12 } from "os";
|
|
177498
|
+
import { join as join41 } from "path";
|
|
177363
177499
|
|
|
177364
177500
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
177365
177501
|
init_spawn_with_windows_hide();
|
|
@@ -177447,22 +177583,22 @@ function isExecutable2(path14) {
|
|
|
177447
177583
|
}
|
|
177448
177584
|
}
|
|
177449
177585
|
function getDesktopAppPaths(platform) {
|
|
177450
|
-
const home =
|
|
177586
|
+
const home = homedir12();
|
|
177451
177587
|
switch (platform) {
|
|
177452
177588
|
case "darwin":
|
|
177453
177589
|
return [
|
|
177454
177590
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
177455
|
-
|
|
177591
|
+
join41(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
177456
177592
|
];
|
|
177457
177593
|
case "win32": {
|
|
177458
177594
|
const programFiles = process.env.ProgramFiles;
|
|
177459
177595
|
const localAppData = process.env.LOCALAPPDATA;
|
|
177460
177596
|
const paths2 = [];
|
|
177461
177597
|
if (programFiles) {
|
|
177462
|
-
paths2.push(
|
|
177598
|
+
paths2.push(join41(programFiles, "OpenCode", "OpenCode.exe"));
|
|
177463
177599
|
}
|
|
177464
177600
|
if (localAppData) {
|
|
177465
|
-
paths2.push(
|
|
177601
|
+
paths2.push(join41(localAppData, "OpenCode", "OpenCode.exe"));
|
|
177466
177602
|
}
|
|
177467
177603
|
return paths2;
|
|
177468
177604
|
}
|
|
@@ -177470,8 +177606,8 @@ function getDesktopAppPaths(platform) {
|
|
|
177470
177606
|
return [
|
|
177471
177607
|
"/usr/bin/opencode",
|
|
177472
177608
|
"/usr/lib/opencode/opencode",
|
|
177473
|
-
|
|
177474
|
-
|
|
177609
|
+
join41(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
177610
|
+
join41(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
177475
177611
|
];
|
|
177476
177612
|
default:
|
|
177477
177613
|
return [];
|
|
@@ -177483,7 +177619,7 @@ function buildVersionCommand(binaryPath, platform) {
|
|
|
177483
177619
|
}
|
|
177484
177620
|
return [binaryPath, "--version"];
|
|
177485
177621
|
}
|
|
177486
|
-
function findDesktopBinary(platform = process.platform, checkExists =
|
|
177622
|
+
function findDesktopBinary(platform = process.platform, checkExists = existsSync46) {
|
|
177487
177623
|
for (const desktopPath of getDesktopAppPaths(platform)) {
|
|
177488
177624
|
if (checkExists(desktopPath)) {
|
|
177489
177625
|
return { binary: "opencode", path: desktopPath };
|
|
@@ -177491,7 +177627,7 @@ function findDesktopBinary(platform = process.platform, checkExists = existsSync
|
|
|
177491
177627
|
}
|
|
177492
177628
|
return null;
|
|
177493
177629
|
}
|
|
177494
|
-
async function findOpenCodeBinary(platform = process.platform, checkExists =
|
|
177630
|
+
async function findOpenCodeBinary(platform = process.platform, checkExists = existsSync46) {
|
|
177495
177631
|
for (const binary2 of OPENCODE_BINARIES2) {
|
|
177496
177632
|
const path14 = bunWhich(binary2);
|
|
177497
177633
|
if (path14 && checkExists(path14)) {
|
|
@@ -177503,7 +177639,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
177503
177639
|
const candidates = getCommandCandidates2(platform);
|
|
177504
177640
|
for (const entry of pathEnv.split(delimiter3).filter(Boolean)) {
|
|
177505
177641
|
for (const command of candidates) {
|
|
177506
|
-
const fullPath =
|
|
177642
|
+
const fullPath = join41(entry, command);
|
|
177507
177643
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
177508
177644
|
return { binary: command, path: fullPath };
|
|
177509
177645
|
}
|
|
@@ -177549,12 +177685,12 @@ function compareVersions3(current, minimum) {
|
|
|
177549
177685
|
|
|
177550
177686
|
// packages/omo-opencode/src/cli/doctor/checks/system-plugin.ts
|
|
177551
177687
|
init_shared();
|
|
177552
|
-
import { existsSync as
|
|
177688
|
+
import { existsSync as existsSync47, readFileSync as readFileSync32 } from "fs";
|
|
177553
177689
|
function detectConfigPath() {
|
|
177554
177690
|
const paths2 = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
177555
|
-
if (
|
|
177691
|
+
if (existsSync47(paths2.configJsonc))
|
|
177556
177692
|
return paths2.configJsonc;
|
|
177557
|
-
if (
|
|
177693
|
+
if (existsSync47(paths2.configJson))
|
|
177558
177694
|
return paths2.configJson;
|
|
177559
177695
|
return null;
|
|
177560
177696
|
}
|
|
@@ -177644,35 +177780,35 @@ init_auto_update_checker();
|
|
|
177644
177780
|
init_package_json_locator();
|
|
177645
177781
|
init_constants5();
|
|
177646
177782
|
init_shared();
|
|
177647
|
-
import { existsSync as
|
|
177783
|
+
import { existsSync as existsSync48, readFileSync as readFileSync33, readdirSync as readdirSync8 } from "fs";
|
|
177648
177784
|
import { createRequire as createRequire2 } from "module";
|
|
177649
|
-
import { homedir as
|
|
177650
|
-
import { join as
|
|
177785
|
+
import { homedir as homedir13 } from "os";
|
|
177786
|
+
import { join as join42 } from "path";
|
|
177651
177787
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
177652
177788
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
177653
177789
|
if (platform === "darwin")
|
|
177654
|
-
return
|
|
177790
|
+
return join42(homedir13(), "Library", "Caches");
|
|
177655
177791
|
if (platform === "win32")
|
|
177656
|
-
return process.env.LOCALAPPDATA ??
|
|
177657
|
-
return
|
|
177792
|
+
return process.env.LOCALAPPDATA ?? join42(homedir13(), "AppData", "Local");
|
|
177793
|
+
return join42(homedir13(), ".cache");
|
|
177658
177794
|
}
|
|
177659
177795
|
function resolveOpenCodeCacheDir() {
|
|
177660
177796
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
177661
177797
|
if (xdgCacheHome)
|
|
177662
|
-
return
|
|
177798
|
+
return join42(xdgCacheHome, "opencode");
|
|
177663
177799
|
const fromShared = getOpenCodeCacheDir();
|
|
177664
|
-
const platformDefault =
|
|
177665
|
-
if (
|
|
177800
|
+
const platformDefault = join42(getPlatformDefaultCacheDir(), "opencode");
|
|
177801
|
+
if (existsSync48(fromShared) || !existsSync48(platformDefault))
|
|
177666
177802
|
return fromShared;
|
|
177667
177803
|
return platformDefault;
|
|
177668
177804
|
}
|
|
177669
177805
|
function resolveExistingDir(dirPath) {
|
|
177670
|
-
if (!
|
|
177806
|
+
if (!existsSync48(dirPath))
|
|
177671
177807
|
return dirPath;
|
|
177672
177808
|
return resolveSymlink(dirPath);
|
|
177673
177809
|
}
|
|
177674
177810
|
function readPackageJson(filePath) {
|
|
177675
|
-
if (!
|
|
177811
|
+
if (!existsSync48(filePath))
|
|
177676
177812
|
return null;
|
|
177677
177813
|
try {
|
|
177678
177814
|
const content = readFileSync33(filePath, "utf-8");
|
|
@@ -177693,26 +177829,26 @@ function normalizeVersion(value) {
|
|
|
177693
177829
|
function createPackageCandidates(rootDir) {
|
|
177694
177830
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
177695
177831
|
packageName,
|
|
177696
|
-
installedPackagePath:
|
|
177832
|
+
installedPackagePath: join42(rootDir, "node_modules", packageName, "package.json")
|
|
177697
177833
|
}));
|
|
177698
177834
|
}
|
|
177699
177835
|
function createTaggedInstallCandidates(rootDir) {
|
|
177700
|
-
const packagesDir =
|
|
177701
|
-
if (!
|
|
177836
|
+
const packagesDir = join42(rootDir, "packages");
|
|
177837
|
+
if (!existsSync48(packagesDir))
|
|
177702
177838
|
return [];
|
|
177703
177839
|
const candidates = [];
|
|
177704
|
-
for (const entryName of
|
|
177840
|
+
for (const entryName of readdirSync8(packagesDir).sort()) {
|
|
177705
177841
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name2) => entryName.startsWith(`${name2}@`));
|
|
177706
177842
|
if (packageName === undefined)
|
|
177707
177843
|
continue;
|
|
177708
|
-
const installDir =
|
|
177844
|
+
const installDir = join42(packagesDir, entryName);
|
|
177709
177845
|
candidates.push({
|
|
177710
177846
|
cacheDir: installDir,
|
|
177711
|
-
cachePackagePath:
|
|
177847
|
+
cachePackagePath: join42(installDir, "package.json"),
|
|
177712
177848
|
packageCandidates: [
|
|
177713
177849
|
{
|
|
177714
177850
|
packageName,
|
|
177715
|
-
installedPackagePath:
|
|
177851
|
+
installedPackagePath: join42(installDir, "node_modules", packageName, "package.json")
|
|
177716
177852
|
}
|
|
177717
177853
|
]
|
|
177718
177854
|
});
|
|
@@ -177720,7 +177856,7 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
177720
177856
|
return candidates;
|
|
177721
177857
|
}
|
|
177722
177858
|
function selectInstalledPackage(candidate) {
|
|
177723
|
-
return candidate.packageCandidates.find((packageCandidate) =>
|
|
177859
|
+
return candidate.packageCandidates.find((packageCandidate) => existsSync48(packageCandidate.installedPackagePath)) ?? candidate.packageCandidates[0];
|
|
177724
177860
|
}
|
|
177725
177861
|
function getExpectedVersion(cachePackage, packageName) {
|
|
177726
177862
|
return normalizeVersion(cachePackage?.dependencies?.[packageName]) ?? normalizeVersion(cachePackage?.dependencies?.[PACKAGE_NAME]);
|
|
@@ -177731,7 +177867,7 @@ function resolveInstalledPackageJsonPath() {
|
|
|
177731
177867
|
for (const packageName of ACCEPTED_PACKAGE_NAMES) {
|
|
177732
177868
|
try {
|
|
177733
177869
|
const packageJsonPath = require2.resolve(`${packageName}/package.json`);
|
|
177734
|
-
if (
|
|
177870
|
+
if (existsSync48(packageJsonPath)) {
|
|
177735
177871
|
return { packageName, packageJsonPath };
|
|
177736
177872
|
}
|
|
177737
177873
|
} catch {
|
|
@@ -177757,22 +177893,22 @@ function getLoadedPluginVersion() {
|
|
|
177757
177893
|
const candidates = [
|
|
177758
177894
|
{
|
|
177759
177895
|
cacheDir: configDir,
|
|
177760
|
-
cachePackagePath:
|
|
177896
|
+
cachePackagePath: join42(configDir, "package.json"),
|
|
177761
177897
|
packageCandidates: createPackageCandidates(configDir)
|
|
177762
177898
|
},
|
|
177763
177899
|
...createTaggedInstallCandidates(configDir),
|
|
177764
177900
|
{
|
|
177765
177901
|
cacheDir,
|
|
177766
|
-
cachePackagePath:
|
|
177902
|
+
cachePackagePath: join42(cacheDir, "package.json"),
|
|
177767
177903
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
177768
177904
|
},
|
|
177769
177905
|
...createTaggedInstallCandidates(cacheDir)
|
|
177770
177906
|
];
|
|
177771
|
-
const selectedCandidate = candidates.find((candidate) => candidate.packageCandidates.some((packageCandidate) =>
|
|
177907
|
+
const selectedCandidate = candidates.find((candidate) => candidate.packageCandidates.some((packageCandidate) => existsSync48(packageCandidate.installedPackagePath))) ?? candidates[0];
|
|
177772
177908
|
const { cacheDir: selectedDir, cachePackagePath } = selectedCandidate;
|
|
177773
177909
|
const selectedPackage = selectInstalledPackage(selectedCandidate);
|
|
177774
177910
|
const candidateInstalledPath = selectedPackage.installedPackagePath;
|
|
177775
|
-
const candidateExists =
|
|
177911
|
+
const candidateExists = existsSync48(candidateInstalledPath);
|
|
177776
177912
|
const resolvedFallback = candidateExists ? null : resolveInstalledPackageJsonPath();
|
|
177777
177913
|
const installedPackagePath = resolvedFallback?.packageJsonPath ?? candidateInstalledPath;
|
|
177778
177914
|
const resolvedPackageName = resolvedFallback?.packageName ?? selectedPackage.packageName;
|
|
@@ -177808,7 +177944,7 @@ var defaultDeps6 = {
|
|
|
177808
177944
|
getLoadedPluginVersion,
|
|
177809
177945
|
getLatestPluginVersion,
|
|
177810
177946
|
getSuggestedInstallTag,
|
|
177811
|
-
configExists:
|
|
177947
|
+
configExists: existsSync49,
|
|
177812
177948
|
readConfigFile: (path14) => readFileSync34(path14, "utf-8"),
|
|
177813
177949
|
parseConfigContent: (content) => parseJsonc(content)
|
|
177814
177950
|
};
|
|
@@ -177955,12 +178091,12 @@ async function checkSystem(deps = defaultDeps6) {
|
|
|
177955
178091
|
// packages/omo-opencode/src/config/validate.ts
|
|
177956
178092
|
init_src();
|
|
177957
178093
|
import { readFileSync as readFileSync35 } from "fs";
|
|
177958
|
-
import { homedir as
|
|
177959
|
-
import { dirname as
|
|
178094
|
+
import { homedir as homedir14 } from "os";
|
|
178095
|
+
import { dirname as dirname19, relative as relative5 } from "path";
|
|
177960
178096
|
init_shared();
|
|
177961
178097
|
init_plugin_identity();
|
|
177962
178098
|
function resolveHomeDirectory2() {
|
|
177963
|
-
return process.env.HOME ?? process.env.USERPROFILE ??
|
|
178099
|
+
return process.env.HOME ?? process.env.USERPROFILE ?? homedir14();
|
|
177964
178100
|
}
|
|
177965
178101
|
function discoverConfigInDirectory(configDir) {
|
|
177966
178102
|
const detected = detectPluginConfigFile(configDir, {
|
|
@@ -177980,7 +178116,7 @@ function discoverProjectLayersNearestFirst(directory) {
|
|
|
177980
178116
|
const stopDirectory = containsPath(homeDirectory, directory) ? homeDirectory : directory;
|
|
177981
178117
|
return findProjectOpencodePluginConfigFiles(directory, stopDirectory).map((configPath) => ({
|
|
177982
178118
|
path: configPath,
|
|
177983
|
-
configDir:
|
|
178119
|
+
configDir: dirname19(configPath)
|
|
177984
178120
|
}));
|
|
177985
178121
|
}
|
|
177986
178122
|
function shortPath(configPath) {
|
|
@@ -178004,7 +178140,7 @@ function parseLayerConfig(configPath) {
|
|
|
178004
178140
|
if (!isPlainRecord(rawConfig)) {
|
|
178005
178141
|
return {
|
|
178006
178142
|
path: configPath,
|
|
178007
|
-
configDir:
|
|
178143
|
+
configDir: dirname19(configPath),
|
|
178008
178144
|
config: null,
|
|
178009
178145
|
messages: [`${shortPath(configPath)}: <root>: Expected object`]
|
|
178010
178146
|
};
|
|
@@ -178012,7 +178148,7 @@ function parseLayerConfig(configPath) {
|
|
|
178012
178148
|
const result = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
|
|
178013
178149
|
return {
|
|
178014
178150
|
path: configPath,
|
|
178015
|
-
configDir:
|
|
178151
|
+
configDir: dirname19(configPath),
|
|
178016
178152
|
config: result.success ? result.data : parseConfigPartially(rawConfig),
|
|
178017
178153
|
messages: schemaMessages(configPath, rawConfig)
|
|
178018
178154
|
};
|
|
@@ -178022,7 +178158,7 @@ function parseLayerConfig(configPath) {
|
|
|
178022
178158
|
}
|
|
178023
178159
|
return {
|
|
178024
178160
|
path: configPath,
|
|
178025
|
-
configDir:
|
|
178161
|
+
configDir: dirname19(configPath),
|
|
178026
178162
|
config: null,
|
|
178027
178163
|
messages: [`${shortPath(configPath)}: ${error51.message}`]
|
|
178028
178164
|
};
|
|
@@ -178071,23 +178207,23 @@ init_constants5();
|
|
|
178071
178207
|
|
|
178072
178208
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-cache.ts
|
|
178073
178209
|
init_shared();
|
|
178074
|
-
import { existsSync as
|
|
178075
|
-
import { homedir as
|
|
178076
|
-
import { join as
|
|
178210
|
+
import { existsSync as existsSync50, readFileSync as readFileSync36 } from "fs";
|
|
178211
|
+
import { homedir as homedir15 } from "os";
|
|
178212
|
+
import { join as join43 } from "path";
|
|
178077
178213
|
function getUserConfigDir2() {
|
|
178078
178214
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
178079
178215
|
if (xdgConfig)
|
|
178080
|
-
return
|
|
178081
|
-
return
|
|
178216
|
+
return join43(xdgConfig, "opencode");
|
|
178217
|
+
return join43(homedir15(), ".config", "opencode");
|
|
178082
178218
|
}
|
|
178083
178219
|
function loadCustomProviderNames() {
|
|
178084
178220
|
const configDir = getUserConfigDir2();
|
|
178085
178221
|
const candidatePaths = [
|
|
178086
|
-
|
|
178087
|
-
|
|
178222
|
+
join43(configDir, "opencode.json"),
|
|
178223
|
+
join43(configDir, "opencode.jsonc")
|
|
178088
178224
|
];
|
|
178089
178225
|
for (const configPath of candidatePaths) {
|
|
178090
|
-
if (!
|
|
178226
|
+
if (!existsSync50(configPath))
|
|
178091
178227
|
continue;
|
|
178092
178228
|
try {
|
|
178093
178229
|
const content = readFileSync36(configPath, "utf-8");
|
|
@@ -178105,9 +178241,9 @@ function loadCustomProviderNames() {
|
|
|
178105
178241
|
return [];
|
|
178106
178242
|
}
|
|
178107
178243
|
function loadAvailableModelsFromCache() {
|
|
178108
|
-
const cacheFile =
|
|
178244
|
+
const cacheFile = join43(getOpenCodeCacheDir(), "models.json");
|
|
178109
178245
|
const customProviders = loadCustomProviderNames();
|
|
178110
|
-
if (!
|
|
178246
|
+
if (!existsSync50(cacheFile)) {
|
|
178111
178247
|
if (customProviders.length > 0) {
|
|
178112
178248
|
return { providers: customProviders, modelCount: 0, cacheExists: true };
|
|
178113
178249
|
}
|
|
@@ -178143,8 +178279,8 @@ init_constants5();
|
|
|
178143
178279
|
init_shared();
|
|
178144
178280
|
init_plugin_identity();
|
|
178145
178281
|
import { readFileSync as readFileSync37 } from "fs";
|
|
178146
|
-
import { join as
|
|
178147
|
-
var PROJECT_CONFIG_DIR =
|
|
178282
|
+
import { join as join44 } from "path";
|
|
178283
|
+
var PROJECT_CONFIG_DIR = join44(process.cwd(), ".opencode");
|
|
178148
178284
|
function loadOmoConfig() {
|
|
178149
178285
|
const projectDetected = detectPluginConfigFile(PROJECT_CONFIG_DIR, {
|
|
178150
178286
|
basenames: [CONFIG_BASENAME],
|
|
@@ -178182,7 +178318,7 @@ function loadOmoConfig() {
|
|
|
178182
178318
|
|
|
178183
178319
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
178184
178320
|
init_shared();
|
|
178185
|
-
import { join as
|
|
178321
|
+
import { join as join45 } from "path";
|
|
178186
178322
|
|
|
178187
178323
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
178188
178324
|
function formatModelWithVariant(model, variant) {
|
|
@@ -178224,7 +178360,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
178224
178360
|
}
|
|
178225
178361
|
function buildModelResolutionDetails(options) {
|
|
178226
178362
|
const details = [];
|
|
178227
|
-
const cacheFile =
|
|
178363
|
+
const cacheFile = join45(getOpenCodeCacheDir(), "models.json");
|
|
178228
178364
|
details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
|
|
178229
178365
|
details.push("");
|
|
178230
178366
|
if (options.available.cacheExists) {
|
|
@@ -178500,28 +178636,28 @@ async function checkConfig() {
|
|
|
178500
178636
|
|
|
178501
178637
|
// packages/omo-opencode/src/cli/doctor/checks/dependencies.ts
|
|
178502
178638
|
init_src();
|
|
178503
|
-
import { existsSync as
|
|
178639
|
+
import { existsSync as existsSync51 } from "fs";
|
|
178504
178640
|
import { createRequire as createRequire3 } from "module";
|
|
178505
|
-
import { homedir as
|
|
178506
|
-
import { dirname as
|
|
178641
|
+
import { homedir as homedir17 } from "os";
|
|
178642
|
+
import { dirname as dirname20, join as join47 } from "path";
|
|
178507
178643
|
|
|
178508
178644
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
178509
|
-
import { join as
|
|
178510
|
-
import { homedir as
|
|
178645
|
+
import { join as join46 } from "path";
|
|
178646
|
+
import { homedir as homedir16, tmpdir as tmpdir3 } from "os";
|
|
178511
178647
|
init_binary_downloader();
|
|
178512
178648
|
init_logger2();
|
|
178513
178649
|
init_plugin_identity();
|
|
178514
178650
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
178515
|
-
var DEBUG_FILE =
|
|
178651
|
+
var DEBUG_FILE = join46(tmpdir3(), "comment-checker-debug.log");
|
|
178516
178652
|
function getCacheDir2() {
|
|
178517
178653
|
if (process.platform === "win32") {
|
|
178518
178654
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
178519
|
-
const base2 = localAppData ||
|
|
178520
|
-
return
|
|
178655
|
+
const base2 = localAppData || join46(homedir16(), "AppData", "Local");
|
|
178656
|
+
return join46(base2, CACHE_DIR_NAME, "bin");
|
|
178521
178657
|
}
|
|
178522
178658
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
178523
|
-
const base = xdgCache ||
|
|
178524
|
-
return
|
|
178659
|
+
const base = xdgCache || join46(homedir16(), ".cache");
|
|
178660
|
+
return join46(base, CACHE_DIR_NAME, "bin");
|
|
178525
178661
|
}
|
|
178526
178662
|
function getBinaryName() {
|
|
178527
178663
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -178571,7 +178707,7 @@ async function getBinaryVersion(binary2) {
|
|
|
178571
178707
|
}
|
|
178572
178708
|
}
|
|
178573
178709
|
async function checkAstGrepCli() {
|
|
178574
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
178710
|
+
const runtimeDir = astGrepRuntimeDir(join47(homedir17(), ".omo"));
|
|
178575
178711
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
178576
178712
|
if (sgPath === null) {
|
|
178577
178713
|
return {
|
|
@@ -178600,12 +178736,12 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
178600
178736
|
const binaryName = process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
178601
178737
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
178602
178738
|
try {
|
|
178603
|
-
const packageDir = baseDirOverride ??
|
|
178604
|
-
const vendorPath =
|
|
178605
|
-
if (
|
|
178739
|
+
const packageDir = baseDirOverride ?? dirname20(resolvePackageJsonPath());
|
|
178740
|
+
const vendorPath = join47(packageDir, "vendor", platformKey, binaryName);
|
|
178741
|
+
if (existsSync51(vendorPath))
|
|
178606
178742
|
return vendorPath;
|
|
178607
|
-
const binPath =
|
|
178608
|
-
if (
|
|
178743
|
+
const binPath = join47(packageDir, "bin", binaryName);
|
|
178744
|
+
if (existsSync51(binPath))
|
|
178609
178745
|
return binPath;
|
|
178610
178746
|
} catch (error51) {
|
|
178611
178747
|
if (!(error51 instanceof Error) && !isModuleResolutionFailure(error51))
|
|
@@ -178750,13 +178886,13 @@ async function getGhCliInfo(dependencies = {}) {
|
|
|
178750
178886
|
|
|
178751
178887
|
// packages/omo-opencode/src/cli/doctor/checks/tools-lsp.ts
|
|
178752
178888
|
import { readFileSync as readFileSync39 } from "fs";
|
|
178753
|
-
import { join as
|
|
178889
|
+
import { join as join48 } from "path";
|
|
178754
178890
|
|
|
178755
178891
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
178756
178892
|
init_zod();
|
|
178757
178893
|
init_opencode_config_dir();
|
|
178758
|
-
import { existsSync as
|
|
178759
|
-
import { delimiter as delimiter3, dirname as
|
|
178894
|
+
import { existsSync as existsSync52, readFileSync as readFileSync38 } from "fs";
|
|
178895
|
+
import { delimiter as delimiter3, dirname as dirname21, resolve as resolve10 } from "path";
|
|
178760
178896
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
178761
178897
|
|
|
178762
178898
|
// packages/omo-opencode/src/mcp/cli-suffix.ts
|
|
@@ -178769,7 +178905,7 @@ function hasCliSuffix(candidatePath, suffix) {
|
|
|
178769
178905
|
|
|
178770
178906
|
// packages/omo-opencode/src/mcp/runtime-executable.ts
|
|
178771
178907
|
init_bun_which_shim();
|
|
178772
|
-
import { basename as
|
|
178908
|
+
import { basename as basename8 } from "path";
|
|
178773
178909
|
var NODE_EXECUTABLE_NAMES = new Set(["node", "node.exe"]);
|
|
178774
178910
|
function isUnsafeCommandName2(commandName) {
|
|
178775
178911
|
if (commandName.length === 0)
|
|
@@ -178785,7 +178921,7 @@ function isUnsafeCommandName2(commandName) {
|
|
|
178785
178921
|
return false;
|
|
178786
178922
|
}
|
|
178787
178923
|
function isNodeExecPath(execPath) {
|
|
178788
|
-
return NODE_EXECUTABLE_NAMES.has(
|
|
178924
|
+
return NODE_EXECUTABLE_NAMES.has(basename8(execPath).toLowerCase());
|
|
178789
178925
|
}
|
|
178790
178926
|
function resolveRuntimeExecutable(commandName, options = {}) {
|
|
178791
178927
|
if (isUnsafeCommandName2(commandName)) {
|
|
@@ -178887,7 +179023,7 @@ var LSP_BOOTSTRAP_SCRIPT = [
|
|
|
178887
179023
|
].join(";");
|
|
178888
179024
|
function getModuleDirectory(moduleUrl) {
|
|
178889
179025
|
try {
|
|
178890
|
-
return
|
|
179026
|
+
return dirname21(fileURLToPath6(moduleUrl));
|
|
178891
179027
|
} catch (error51) {
|
|
178892
179028
|
if (!(error51 instanceof Error))
|
|
178893
179029
|
throw error51;
|
|
@@ -178921,7 +179057,7 @@ function createBootstrapCandidate(root, pathExists, resolveExecutable) {
|
|
|
178921
179057
|
};
|
|
178922
179058
|
}
|
|
178923
179059
|
function resolveLspCommand(options = {}) {
|
|
178924
|
-
const pathExists = options.exists ??
|
|
179060
|
+
const pathExists = options.exists ?? existsSync52;
|
|
178925
179061
|
const resolveExecutable = options.resolveExecutable ?? resolveRuntimeExecutable;
|
|
178926
179062
|
const moduleDirectory = getModuleDirectory(options.moduleUrl ?? import.meta.url);
|
|
178927
179063
|
const candidates = moduleDirectory ? createAncestorCliCandidates({
|
|
@@ -178987,7 +179123,7 @@ function readOmoConfig(configDirectory) {
|
|
|
178987
179123
|
}
|
|
178988
179124
|
function isLspMcpDisabled(options) {
|
|
178989
179125
|
const userConfigDirectory = options.configDirectory ?? getOpenCodeConfigDir({ binary: "opencode" });
|
|
178990
|
-
const projectConfigDirectory =
|
|
179126
|
+
const projectConfigDirectory = join48(options.cwd ?? process.cwd(), ".opencode");
|
|
178991
179127
|
const userConfig = readOmoConfig(userConfigDirectory);
|
|
178992
179128
|
const projectConfig = readOmoConfig(projectConfigDirectory);
|
|
178993
179129
|
const disabledMcps = new Set([
|
|
@@ -179006,21 +179142,21 @@ function getInstalledLspServers(options = {}) {
|
|
|
179006
179142
|
|
|
179007
179143
|
// packages/omo-opencode/src/cli/doctor/checks/tools-mcp.ts
|
|
179008
179144
|
init_shared();
|
|
179009
|
-
import { existsSync as
|
|
179010
|
-
import { homedir as
|
|
179011
|
-
import { join as
|
|
179145
|
+
import { existsSync as existsSync53, readFileSync as readFileSync40 } from "fs";
|
|
179146
|
+
import { homedir as homedir18 } from "os";
|
|
179147
|
+
import { join as join49 } from "path";
|
|
179012
179148
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
179013
179149
|
function getMcpConfigPaths() {
|
|
179014
179150
|
return [
|
|
179015
|
-
|
|
179016
|
-
|
|
179017
|
-
|
|
179151
|
+
join49(homedir18(), ".claude", ".mcp.json"),
|
|
179152
|
+
join49(process.cwd(), ".mcp.json"),
|
|
179153
|
+
join49(process.cwd(), ".claude", ".mcp.json")
|
|
179018
179154
|
];
|
|
179019
179155
|
}
|
|
179020
179156
|
function loadUserMcpConfig() {
|
|
179021
179157
|
const servers = {};
|
|
179022
179158
|
for (const configPath of getMcpConfigPaths()) {
|
|
179023
|
-
if (!
|
|
179159
|
+
if (!existsSync53(configPath))
|
|
179024
179160
|
continue;
|
|
179025
179161
|
try {
|
|
179026
179162
|
const content = readFileSync40(configPath, "utf-8");
|
|
@@ -179158,13 +179294,13 @@ async function checkTools() {
|
|
|
179158
179294
|
}
|
|
179159
179295
|
|
|
179160
179296
|
// packages/omo-opencode/src/cli/doctor/checks/telemetry.ts
|
|
179161
|
-
import { existsSync as
|
|
179297
|
+
import { existsSync as existsSync54, readFileSync as readFileSync41 } from "fs";
|
|
179162
179298
|
init_constants5();
|
|
179163
179299
|
function isTelemetryState(value) {
|
|
179164
179300
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
179165
179301
|
}
|
|
179166
179302
|
function readLastActiveDay(stateFilePath) {
|
|
179167
|
-
if (!
|
|
179303
|
+
if (!existsSync54(stateFilePath)) {
|
|
179168
179304
|
return "never";
|
|
179169
179305
|
}
|
|
179170
179306
|
let parsed;
|
|
@@ -179227,17 +179363,17 @@ async function probeBinary(cmd, args, spawnImpl) {
|
|
|
179227
179363
|
}
|
|
179228
179364
|
|
|
179229
179365
|
// packages/team-core/src/team-registry/paths.ts
|
|
179230
|
-
import { homedir as
|
|
179366
|
+
import { homedir as homedir19 } from "os";
|
|
179231
179367
|
import path14 from "path";
|
|
179232
179368
|
function resolveBaseDir(config5) {
|
|
179233
|
-
return expandHomeDirectory(config5.base_dir ?? path14.join(
|
|
179369
|
+
return expandHomeDirectory(config5.base_dir ?? path14.join(homedir19(), ".omo"));
|
|
179234
179370
|
}
|
|
179235
179371
|
function expandHomeDirectory(directoryPath) {
|
|
179236
179372
|
if (directoryPath === "~") {
|
|
179237
|
-
return
|
|
179373
|
+
return homedir19();
|
|
179238
179374
|
}
|
|
179239
179375
|
if (directoryPath.startsWith("~/") || directoryPath.startsWith("~\\")) {
|
|
179240
|
-
return path14.join(
|
|
179376
|
+
return path14.join(homedir19(), directoryPath.slice(2));
|
|
179241
179377
|
}
|
|
179242
179378
|
return directoryPath;
|
|
179243
179379
|
}
|
|
@@ -179720,23 +179856,23 @@ Doctor failed unexpectedly: ${message}`];
|
|
|
179720
179856
|
import { createHash as createHash3 } from "crypto";
|
|
179721
179857
|
import {
|
|
179722
179858
|
chmodSync as chmodSync6,
|
|
179723
|
-
existsSync as
|
|
179724
|
-
mkdirSync as
|
|
179725
|
-
readdirSync as
|
|
179859
|
+
existsSync as existsSync57,
|
|
179860
|
+
mkdirSync as mkdirSync16,
|
|
179861
|
+
readdirSync as readdirSync9,
|
|
179726
179862
|
readFileSync as readFileSync44,
|
|
179727
179863
|
renameSync as renameSync7,
|
|
179728
|
-
unlinkSync as
|
|
179864
|
+
unlinkSync as unlinkSync9,
|
|
179729
179865
|
writeFileSync as writeFileSync14
|
|
179730
179866
|
} from "fs";
|
|
179731
|
-
import { basename as
|
|
179867
|
+
import { basename as basename9, dirname as dirname22, join as join52 } from "path";
|
|
179732
179868
|
|
|
179733
179869
|
// packages/mcp-client-core/src/config-dir.ts
|
|
179734
|
-
import { existsSync as
|
|
179735
|
-
import { homedir as
|
|
179736
|
-
import { join as
|
|
179870
|
+
import { existsSync as existsSync55, realpathSync as realpathSync7 } from "fs";
|
|
179871
|
+
import { homedir as homedir20 } from "os";
|
|
179872
|
+
import { join as join50, resolve as resolve11 } from "path";
|
|
179737
179873
|
function resolveConfigPath2(pathValue) {
|
|
179738
179874
|
const resolvedPath = resolve11(pathValue);
|
|
179739
|
-
if (!
|
|
179875
|
+
if (!existsSync55(resolvedPath))
|
|
179740
179876
|
return resolvedPath;
|
|
179741
179877
|
try {
|
|
179742
179878
|
return realpathSync7(resolvedPath);
|
|
@@ -179751,13 +179887,13 @@ function getOpenCodeCliConfigDir(env2 = process.env) {
|
|
|
179751
179887
|
if (customConfigDir) {
|
|
179752
179888
|
return resolveConfigPath2(customConfigDir);
|
|
179753
179889
|
}
|
|
179754
|
-
const xdgConfigDir = env2["XDG_CONFIG_HOME"]?.trim() ||
|
|
179755
|
-
return resolveConfigPath2(
|
|
179890
|
+
const xdgConfigDir = env2["XDG_CONFIG_HOME"]?.trim() || join50(homedir20(), ".config");
|
|
179891
|
+
return resolveConfigPath2(join50(xdgConfigDir, "opencode"));
|
|
179756
179892
|
}
|
|
179757
179893
|
|
|
179758
179894
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
179759
|
-
import { chmodSync as chmodSync5, existsSync as
|
|
179760
|
-
import { join as
|
|
179895
|
+
import { chmodSync as chmodSync5, existsSync as existsSync56, readFileSync as readFileSync43, renameSync as renameSync6, writeFileSync as writeFileSync13 } from "fs";
|
|
179896
|
+
import { join as join51 } from "path";
|
|
179761
179897
|
var INDEX_FILE_NAME = "index.json";
|
|
179762
179898
|
function isTokenIndex(value) {
|
|
179763
179899
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -179765,11 +179901,11 @@ function isTokenIndex(value) {
|
|
|
179765
179901
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
179766
179902
|
}
|
|
179767
179903
|
function getIndexPath(storageDir) {
|
|
179768
|
-
return
|
|
179904
|
+
return join51(storageDir, INDEX_FILE_NAME);
|
|
179769
179905
|
}
|
|
179770
179906
|
function readTokenIndex(storageDir) {
|
|
179771
179907
|
const indexPath = getIndexPath(storageDir);
|
|
179772
|
-
if (!
|
|
179908
|
+
if (!existsSync56(indexPath))
|
|
179773
179909
|
return {};
|
|
179774
179910
|
try {
|
|
179775
179911
|
const parsed = JSON.parse(readFileSync43(indexPath, "utf-8"));
|
|
@@ -179809,16 +179945,16 @@ function deleteTokenIndexEntry(storageDir, hash2) {
|
|
|
179809
179945
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
179810
179946
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
179811
179947
|
function getMcpOauthStorageDir() {
|
|
179812
|
-
return
|
|
179948
|
+
return join52(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
179813
179949
|
}
|
|
179814
179950
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
179815
179951
|
return createHash3("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
179816
179952
|
}
|
|
179817
179953
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
179818
|
-
return
|
|
179954
|
+
return join52(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
179819
179955
|
}
|
|
179820
179956
|
function getLegacyStoragePath() {
|
|
179821
|
-
return
|
|
179957
|
+
return join52(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
179822
179958
|
}
|
|
179823
179959
|
function normalizeHost2(serverHost) {
|
|
179824
179960
|
let host = serverHost.trim();
|
|
@@ -179879,7 +180015,7 @@ function isOAuthTokenData(value) {
|
|
|
179879
180015
|
return clientSecret === undefined || typeof clientSecret === "string";
|
|
179880
180016
|
}
|
|
179881
180017
|
function readTokenFile(filePath) {
|
|
179882
|
-
if (!
|
|
180018
|
+
if (!existsSync57(filePath))
|
|
179883
180019
|
return null;
|
|
179884
180020
|
try {
|
|
179885
180021
|
const parsed = JSON.parse(readFileSync44(filePath, "utf-8"));
|
|
@@ -179892,7 +180028,7 @@ function readTokenFile(filePath) {
|
|
|
179892
180028
|
}
|
|
179893
180029
|
function readLegacyStore() {
|
|
179894
180030
|
const filePath = getLegacyStoragePath();
|
|
179895
|
-
if (!
|
|
180031
|
+
if (!existsSync57(filePath))
|
|
179896
180032
|
return null;
|
|
179897
180033
|
try {
|
|
179898
180034
|
const parsed = JSON.parse(readFileSync44(filePath, "utf-8"));
|
|
@@ -179912,9 +180048,9 @@ function readLegacyStore() {
|
|
|
179912
180048
|
}
|
|
179913
180049
|
function writeTokenFile(filePath, token) {
|
|
179914
180050
|
try {
|
|
179915
|
-
const dir =
|
|
179916
|
-
if (!
|
|
179917
|
-
|
|
180051
|
+
const dir = dirname22(filePath);
|
|
180052
|
+
if (!existsSync57(dir)) {
|
|
180053
|
+
mkdirSync16(dir, { recursive: true });
|
|
179918
180054
|
}
|
|
179919
180055
|
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
179920
180056
|
writeFileSync14(tempPath, JSON.stringify(token, null, 2), { encoding: "utf-8", mode: 384 });
|
|
@@ -179937,10 +180073,10 @@ function saveToken(serverHost, resource, token) {
|
|
|
179937
180073
|
}
|
|
179938
180074
|
function deleteToken(serverHost, resource) {
|
|
179939
180075
|
const filePath = getMcpOauthStoragePath(serverHost, resource);
|
|
179940
|
-
if (!
|
|
180076
|
+
if (!existsSync57(filePath))
|
|
179941
180077
|
return deleteLegacyToken(serverHost, resource);
|
|
179942
180078
|
try {
|
|
179943
|
-
|
|
180079
|
+
unlinkSync9(filePath);
|
|
179944
180080
|
return deleteTokenIndexEntry(getMcpOauthStorageDir(), getMcpOauthServerHash(serverHost, resource));
|
|
179945
180081
|
} catch (deleteError) {
|
|
179946
180082
|
if (!(deleteError instanceof Error))
|
|
@@ -179959,8 +180095,8 @@ function deleteLegacyToken(serverHost, resource) {
|
|
|
179959
180095
|
if (Object.keys(store2).length === 0) {
|
|
179960
180096
|
try {
|
|
179961
180097
|
const filePath = getLegacyStoragePath();
|
|
179962
|
-
if (
|
|
179963
|
-
|
|
180098
|
+
if (existsSync57(filePath))
|
|
180099
|
+
unlinkSync9(filePath);
|
|
179964
180100
|
return true;
|
|
179965
180101
|
} catch (deleteError) {
|
|
179966
180102
|
if (!(deleteError instanceof Error))
|
|
@@ -179997,7 +180133,7 @@ function listTokensByHost(serverHost) {
|
|
|
179997
180133
|
for (const [hash2, indexedKey] of Object.entries(index)) {
|
|
179998
180134
|
if (!indexedKey.startsWith(prefix))
|
|
179999
180135
|
continue;
|
|
180000
|
-
const indexedToken = readTokenFile(
|
|
180136
|
+
const indexedToken = readTokenFile(join52(getMcpOauthStorageDir(), `${hash2}.json`));
|
|
180001
180137
|
if (indexedToken)
|
|
180002
180138
|
result[indexedKey] = indexedToken;
|
|
180003
180139
|
}
|
|
@@ -180006,14 +180142,14 @@ function listTokensByHost(serverHost) {
|
|
|
180006
180142
|
function listAllTokens() {
|
|
180007
180143
|
const result = { ...readLegacyStore() ?? {} };
|
|
180008
180144
|
const dir = getMcpOauthStorageDir();
|
|
180009
|
-
if (!
|
|
180145
|
+
if (!existsSync57(dir))
|
|
180010
180146
|
return result;
|
|
180011
180147
|
const index = readTokenIndex(dir);
|
|
180012
|
-
for (const entry of
|
|
180148
|
+
for (const entry of readdirSync9(dir, { withFileTypes: true })) {
|
|
180013
180149
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
180014
180150
|
continue;
|
|
180015
|
-
const token = readTokenFile(
|
|
180016
|
-
const hash2 =
|
|
180151
|
+
const token = readTokenFile(join52(dir, entry.name));
|
|
180152
|
+
const hash2 = basename9(entry.name, ".json");
|
|
180017
180153
|
if (token)
|
|
180018
180154
|
result[index[hash2] ?? hash2] = token;
|
|
180019
180155
|
}
|
|
@@ -180708,8 +180844,8 @@ function createEmbeddingPort() {
|
|
|
180708
180844
|
// packages/learning-loop/src/codebase-scanner.ts
|
|
180709
180845
|
var import_picomatch = __toESM(require_picomatch2(), 1);
|
|
180710
180846
|
import { createHash as createHash5 } from "crypto";
|
|
180711
|
-
import { readdirSync as
|
|
180712
|
-
import { join as
|
|
180847
|
+
import { readdirSync as readdirSync10, readFileSync as readFileSync46, statSync as statSync7, existsSync as existsSync59 } from "fs";
|
|
180848
|
+
import { join as join53, relative as relative6, extname as extname3 } from "path";
|
|
180713
180849
|
var EXT_TO_LANG = {
|
|
180714
180850
|
ts: "typescript",
|
|
180715
180851
|
tsx: "typescript",
|
|
@@ -180763,7 +180899,7 @@ function detectLanguage(filePath) {
|
|
|
180763
180899
|
return EXT_TO_LANG[ext] ?? "text";
|
|
180764
180900
|
}
|
|
180765
180901
|
function loadGitignore(rootDir, fs18) {
|
|
180766
|
-
const gitignorePath =
|
|
180902
|
+
const gitignorePath = join53(rootDir, ".gitignore");
|
|
180767
180903
|
if (!fs18.exists(gitignorePath))
|
|
180768
180904
|
return [];
|
|
180769
180905
|
const content = fs18.readFile(gitignorePath);
|
|
@@ -180773,7 +180909,7 @@ function loadGitignore(rootDir, fs18) {
|
|
|
180773
180909
|
function defaultFs() {
|
|
180774
180910
|
return {
|
|
180775
180911
|
readdir(path18) {
|
|
180776
|
-
return
|
|
180912
|
+
return readdirSync10(path18);
|
|
180777
180913
|
},
|
|
180778
180914
|
readFile(path18) {
|
|
180779
180915
|
return readFileSync46(path18, "utf-8");
|
|
@@ -180783,7 +180919,7 @@ function defaultFs() {
|
|
|
180783
180919
|
return { size: s.size, mtimeMs: s.mtimeMs, isDirectory: () => s.isDirectory(), isFile: () => s.isFile() };
|
|
180784
180920
|
},
|
|
180785
180921
|
exists(path18) {
|
|
180786
|
-
return
|
|
180922
|
+
return existsSync59(path18);
|
|
180787
180923
|
}
|
|
180788
180924
|
};
|
|
180789
180925
|
}
|
|
@@ -180854,7 +180990,7 @@ function createCodebaseScanner(options = {}) {
|
|
|
180854
180990
|
return;
|
|
180855
180991
|
}
|
|
180856
180992
|
for (const entry of entries) {
|
|
180857
|
-
const fullPath =
|
|
180993
|
+
const fullPath = join53(dir, entry);
|
|
180858
180994
|
let stat;
|
|
180859
180995
|
try {
|
|
180860
180996
|
stat = fs18.stat(fullPath);
|
|
@@ -181129,14 +181265,14 @@ function formatSearchResults(result) {
|
|
|
181129
181265
|
}
|
|
181130
181266
|
|
|
181131
181267
|
// packages/learning-loop/src/improvement.ts
|
|
181132
|
-
import { existsSync as
|
|
181133
|
-
import { join as
|
|
181268
|
+
import { existsSync as existsSync60, mkdirSync as mkdirSync18, readFileSync as readFileSync47, writeFileSync as writeFileSync16 } from "fs";
|
|
181269
|
+
import { join as join54, basename as basename11 } from "path";
|
|
181134
181270
|
function createImprovementStore(improvementsDir) {
|
|
181135
|
-
if (!
|
|
181136
|
-
|
|
181271
|
+
if (!existsSync60(improvementsDir)) {
|
|
181272
|
+
mkdirSync18(improvementsDir, { recursive: true });
|
|
181137
181273
|
}
|
|
181138
181274
|
function save(improvement) {
|
|
181139
|
-
const filePath =
|
|
181275
|
+
const filePath = join54(improvementsDir, `${improvement.id}.json`);
|
|
181140
181276
|
writeFileSync16(filePath, JSON.stringify(improvement, null, 2), "utf-8");
|
|
181141
181277
|
}
|
|
181142
181278
|
function list() {
|
|
@@ -181151,10 +181287,10 @@ function createImprovementStore(improvementsDir) {
|
|
|
181151
181287
|
return [];
|
|
181152
181288
|
}
|
|
181153
181289
|
files.sort().reverse();
|
|
181154
|
-
return files.map((f2) => get(
|
|
181290
|
+
return files.map((f2) => get(basename11(f2, ".json"))).filter((i3) => i3 !== null);
|
|
181155
181291
|
}
|
|
181156
181292
|
function get(id) {
|
|
181157
|
-
const filePath =
|
|
181293
|
+
const filePath = join54(improvementsDir, `${id}.json`);
|
|
181158
181294
|
try {
|
|
181159
181295
|
const raw = readFileSync47(filePath, "utf-8");
|
|
181160
181296
|
return JSON.parse(raw);
|
|
@@ -181178,8 +181314,8 @@ function createImprovementStore(improvementsDir) {
|
|
|
181178
181314
|
}
|
|
181179
181315
|
function readdirSyncSafe(dir) {
|
|
181180
181316
|
try {
|
|
181181
|
-
const { readdirSync:
|
|
181182
|
-
return
|
|
181317
|
+
const { readdirSync: readdirSync11 } = __require("fs");
|
|
181318
|
+
return readdirSync11(dir);
|
|
181183
181319
|
} catch {
|
|
181184
181320
|
return;
|
|
181185
181321
|
}
|
|
@@ -181227,7 +181363,7 @@ async function applyLearningsCli(options = {}) {
|
|
|
181227
181363
|
}
|
|
181228
181364
|
|
|
181229
181365
|
// packages/omo-opencode/src/cli/boulder/boulder.ts
|
|
181230
|
-
import { existsSync as
|
|
181366
|
+
import { existsSync as existsSync62 } from "fs";
|
|
181231
181367
|
|
|
181232
181368
|
// packages/omo-opencode/src/cli/boulder/formatter.ts
|
|
181233
181369
|
var import_picocolors22 = __toESM(require_picocolors(), 1);
|
|
@@ -181364,10 +181500,10 @@ async function boulder(options) {
|
|
|
181364
181500
|
const boulderFilePath = getBoulderFilePath(directory);
|
|
181365
181501
|
const state2 = readBoulderState(directory);
|
|
181366
181502
|
if (!state2) {
|
|
181367
|
-
const message =
|
|
181503
|
+
const message = existsSync62(boulderFilePath) ? formatReadErrorMessage(options.json) : formatNoBoulderMessage(options.json);
|
|
181368
181504
|
process.stderr.write(`${message}
|
|
181369
181505
|
`);
|
|
181370
|
-
return
|
|
181506
|
+
return existsSync62(boulderFilePath) ? 2 : 1;
|
|
181371
181507
|
}
|
|
181372
181508
|
const works = getBoulderWorks(state2);
|
|
181373
181509
|
const filteredWorks = options.workId ? works.filter((work) => work.work_id === options.workId) : works;
|
|
@@ -181962,25 +182098,25 @@ async function refreshModelCapabilities(options, deps = {}) {
|
|
|
181962
182098
|
// packages/skills-loader-core/src/features/opencode-skill-loader/loader.ts
|
|
181963
182099
|
init_src();
|
|
181964
182100
|
init_shared_skills();
|
|
181965
|
-
import { join as
|
|
182101
|
+
import { join as join63 } from "path";
|
|
181966
182102
|
|
|
181967
182103
|
// packages/skills-loader-core/src/shared/claude-config-dir.ts
|
|
181968
182104
|
init_src();
|
|
181969
|
-
import { join as
|
|
182105
|
+
import { join as join57 } from "path";
|
|
181970
182106
|
function getClaudeConfigDir() {
|
|
181971
182107
|
const envConfigDir = process.env.CLAUDE_CONFIG_DIR;
|
|
181972
182108
|
if (envConfigDir) {
|
|
181973
182109
|
return envConfigDir;
|
|
181974
182110
|
}
|
|
181975
|
-
return
|
|
182111
|
+
return join57(getHomeDirectory(), ".claude");
|
|
181976
182112
|
}
|
|
181977
182113
|
// packages/skills-loader-core/src/shared/opencode-command-dirs.ts
|
|
181978
|
-
import { basename as
|
|
182114
|
+
import { basename as basename12, dirname as dirname23, join as join59 } from "path";
|
|
181979
182115
|
|
|
181980
182116
|
// packages/skills-loader-core/src/shared/opencode-config-dir.ts
|
|
181981
|
-
import { existsSync as
|
|
181982
|
-
import { homedir as
|
|
181983
|
-
import { join as
|
|
182117
|
+
import { existsSync as existsSync64, realpathSync as realpathSync8 } from "fs";
|
|
182118
|
+
import { homedir as homedir22 } from "os";
|
|
182119
|
+
import { join as join58, posix as posix5, resolve as resolve12, win32 as win325 } from "path";
|
|
181984
182120
|
|
|
181985
182121
|
// packages/skills-loader-core/src/shared/plugin-identity.ts
|
|
181986
182122
|
init_src();
|
|
@@ -182013,15 +182149,15 @@ function getTauriConfigDir2(identifier) {
|
|
|
182013
182149
|
const platform2 = process.platform;
|
|
182014
182150
|
switch (platform2) {
|
|
182015
182151
|
case "darwin":
|
|
182016
|
-
return
|
|
182152
|
+
return join58(homedir22(), "Library", "Application Support", identifier);
|
|
182017
182153
|
case "win32": {
|
|
182018
|
-
const appData = process.env.APPDATA ||
|
|
182154
|
+
const appData = process.env.APPDATA || join58(homedir22(), "AppData", "Roaming");
|
|
182019
182155
|
return win325.join(appData, identifier);
|
|
182020
182156
|
}
|
|
182021
182157
|
case "linux":
|
|
182022
182158
|
default: {
|
|
182023
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME ||
|
|
182024
|
-
return
|
|
182159
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join58(homedir22(), ".config");
|
|
182160
|
+
return join58(xdgConfig, identifier);
|
|
182025
182161
|
}
|
|
182026
182162
|
}
|
|
182027
182163
|
}
|
|
@@ -182030,7 +182166,7 @@ function resolveConfigPath3(pathValue) {
|
|
|
182030
182166
|
return posix5.normalize(pathValue);
|
|
182031
182167
|
}
|
|
182032
182168
|
const resolvedPath = resolve12(pathValue);
|
|
182033
|
-
if (!
|
|
182169
|
+
if (!existsSync64(resolvedPath))
|
|
182034
182170
|
return resolvedPath;
|
|
182035
182171
|
try {
|
|
182036
182172
|
return realpathSync8(resolvedPath);
|
|
@@ -182064,8 +182200,8 @@ function getWslLinuxHomeDir2(windowsConfigRoot) {
|
|
|
182064
182200
|
function getCliDefaultConfigDir2() {
|
|
182065
182201
|
const envXdgConfig = process.env.XDG_CONFIG_HOME?.trim();
|
|
182066
182202
|
const shouldIgnoreWindowsXdg = envXdgConfig !== undefined && envXdgConfig.length > 0 && isWslEnvironment2() && isWindowsUserConfigRoot2(envXdgConfig);
|
|
182067
|
-
const xdgConfig = shouldIgnoreWindowsXdg ? posix5.join(getWslLinuxHomeDir2(envXdgConfig) ?? "/home", ".config") : envXdgConfig ||
|
|
182068
|
-
const configDir = isWslEnvironment2() ? posix5.join(xdgConfig, "opencode") :
|
|
182203
|
+
const xdgConfig = shouldIgnoreWindowsXdg ? posix5.join(getWslLinuxHomeDir2(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join58(homedir22(), ".config");
|
|
182204
|
+
const configDir = isWslEnvironment2() ? posix5.join(xdgConfig, "opencode") : join58(xdgConfig, "opencode");
|
|
182069
182205
|
return resolveConfigPath3(configDir);
|
|
182070
182206
|
}
|
|
182071
182207
|
function getCliCustomConfigDir2() {
|
|
@@ -182098,9 +182234,9 @@ function getOpenCodeConfigDir2(options) {
|
|
|
182098
182234
|
const tauriDir = process.platform === "win32" ? win325.isAbsolute(tauriDirBase) ? win325.normalize(tauriDirBase) : win325.resolve(tauriDirBase) : resolveConfigPath3(tauriDirBase);
|
|
182099
182235
|
if (checkExisting) {
|
|
182100
182236
|
const legacyDir = getCliConfigDir2();
|
|
182101
|
-
const legacyConfig =
|
|
182102
|
-
const legacyConfigC =
|
|
182103
|
-
if (
|
|
182237
|
+
const legacyConfig = join58(legacyDir, "opencode.json");
|
|
182238
|
+
const legacyConfigC = join58(legacyDir, "opencode.jsonc");
|
|
182239
|
+
if (existsSync64(legacyConfig) || existsSync64(legacyConfigC)) {
|
|
182104
182240
|
return legacyDir;
|
|
182105
182241
|
}
|
|
182106
182242
|
}
|
|
@@ -182109,11 +182245,11 @@ function getOpenCodeConfigDir2(options) {
|
|
|
182109
182245
|
|
|
182110
182246
|
// packages/skills-loader-core/src/shared/opencode-command-dirs.ts
|
|
182111
182247
|
function getParentOpencodeConfigDir(configDir) {
|
|
182112
|
-
const parentDir =
|
|
182113
|
-
if (
|
|
182248
|
+
const parentDir = dirname23(configDir);
|
|
182249
|
+
if (basename12(parentDir) !== "profiles") {
|
|
182114
182250
|
return null;
|
|
182115
182251
|
}
|
|
182116
|
-
return
|
|
182252
|
+
return dirname23(parentDir);
|
|
182117
182253
|
}
|
|
182118
182254
|
function getOpenCodeSkillDirs(options) {
|
|
182119
182255
|
const configDirs = getOpenCodeConfigDirs2(options);
|
|
@@ -182121,21 +182257,21 @@ function getOpenCodeSkillDirs(options) {
|
|
|
182121
182257
|
...configDirs.flatMap((configDir) => {
|
|
182122
182258
|
const parentConfigDir = getParentOpencodeConfigDir(configDir);
|
|
182123
182259
|
return [
|
|
182124
|
-
|
|
182125
|
-
|
|
182126
|
-
...parentConfigDir ? [
|
|
182260
|
+
join59(configDir, "skills"),
|
|
182261
|
+
join59(configDir, "skill"),
|
|
182262
|
+
...parentConfigDir ? [join59(parentConfigDir, "skills"), join59(parentConfigDir, "skill")] : []
|
|
182127
182263
|
];
|
|
182128
182264
|
})
|
|
182129
182265
|
]));
|
|
182130
182266
|
}
|
|
182131
182267
|
// packages/skills-loader-core/src/shared/project-discovery-dirs.ts
|
|
182132
182268
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
182133
|
-
import { existsSync as
|
|
182134
|
-
import { dirname as
|
|
182269
|
+
import { existsSync as existsSync65, realpathSync as realpathSync9 } from "fs";
|
|
182270
|
+
import { dirname as dirname24, join as join60, resolve as resolve13, win32 as win326 } from "path";
|
|
182135
182271
|
var worktreePathCache2 = new Map;
|
|
182136
182272
|
function normalizePath2(path18) {
|
|
182137
182273
|
const resolvedPath = process.platform !== "win32" && win326.isAbsolute(path18) ? path18 : resolve13(path18);
|
|
182138
|
-
if (!
|
|
182274
|
+
if (!existsSync65(resolvedPath)) {
|
|
182139
182275
|
return resolvedPath;
|
|
182140
182276
|
}
|
|
182141
182277
|
try {
|
|
@@ -182166,8 +182302,8 @@ function findAncestorDirectories(startDirectory, targetPaths, stopDirectory) {
|
|
|
182166
182302
|
const stopDirectoryKey = resolvedStopDirectory ? pathKey2(resolvedStopDirectory) : undefined;
|
|
182167
182303
|
while (true) {
|
|
182168
182304
|
for (const targetPath of targetPaths) {
|
|
182169
|
-
const candidateDirectory =
|
|
182170
|
-
if (!
|
|
182305
|
+
const candidateDirectory = join60(currentDirectory, ...targetPath);
|
|
182306
|
+
if (!existsSync65(candidateDirectory)) {
|
|
182171
182307
|
continue;
|
|
182172
182308
|
}
|
|
182173
182309
|
const normalizedCandidateDirectory = normalizePath2(candidateDirectory);
|
|
@@ -182181,7 +182317,7 @@ function findAncestorDirectories(startDirectory, targetPaths, stopDirectory) {
|
|
|
182181
182317
|
if (stopDirectoryKey === pathKey2(currentDirectory)) {
|
|
182182
182318
|
return directories;
|
|
182183
182319
|
}
|
|
182184
|
-
const parentDirectory =
|
|
182320
|
+
const parentDirectory = dirname24(currentDirectory);
|
|
182185
182321
|
if (parentDirectory === currentDirectory) {
|
|
182186
182322
|
return directories;
|
|
182187
182323
|
}
|
|
@@ -182249,13 +182385,13 @@ function deduplicateSkillsByName(skills2) {
|
|
|
182249
182385
|
// packages/skills-loader-core/src/features/opencode-skill-loader/skill-directory-loader.ts
|
|
182250
182386
|
init_src();
|
|
182251
182387
|
import * as fs20 from "fs/promises";
|
|
182252
|
-
import { join as
|
|
182388
|
+
import { join as join62 } from "path";
|
|
182253
182389
|
|
|
182254
182390
|
// packages/skills-loader-core/src/features/opencode-skill-loader/loaded-skill-from-path.ts
|
|
182255
182391
|
init_src();
|
|
182256
182392
|
init_src2();
|
|
182257
182393
|
import * as fs19 from "fs/promises";
|
|
182258
|
-
import { basename as
|
|
182394
|
+
import { basename as basename13 } from "path";
|
|
182259
182395
|
|
|
182260
182396
|
// packages/skills-loader-core/src/features/opencode-skill-loader/allowed-tools-parser.ts
|
|
182261
182397
|
function parseAllowedTools(allowedTools) {
|
|
@@ -182270,7 +182406,7 @@ function parseAllowedTools(allowedTools) {
|
|
|
182270
182406
|
// packages/skills-loader-core/src/features/opencode-skill-loader/skill-mcp-config.ts
|
|
182271
182407
|
init_js_yaml();
|
|
182272
182408
|
import * as fs18 from "fs/promises";
|
|
182273
|
-
import { join as
|
|
182409
|
+
import { join as join61 } from "path";
|
|
182274
182410
|
function parseSkillMcpConfigFromFrontmatter(content) {
|
|
182275
182411
|
const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
182276
182412
|
if (!frontmatterMatch)
|
|
@@ -182289,7 +182425,7 @@ function parseSkillMcpConfigFromFrontmatter(content) {
|
|
|
182289
182425
|
return;
|
|
182290
182426
|
}
|
|
182291
182427
|
async function loadMcpJsonFromDir(skillDir) {
|
|
182292
|
-
const mcpJsonPath =
|
|
182428
|
+
const mcpJsonPath = join61(skillDir, "mcp.json");
|
|
182293
182429
|
try {
|
|
182294
182430
|
const content = await fs18.readFile(mcpJsonPath, "utf-8");
|
|
182295
182431
|
const parsed = JSON.parse(content);
|
|
@@ -182371,7 +182507,7 @@ $ARGUMENTS
|
|
|
182371
182507
|
}
|
|
182372
182508
|
}
|
|
182373
182509
|
function inferSkillNameFromFileName(filePath) {
|
|
182374
|
-
return
|
|
182510
|
+
return basename13(filePath, ".md");
|
|
182375
182511
|
}
|
|
182376
182512
|
|
|
182377
182513
|
// packages/skills-loader-core/src/features/opencode-skill-loader/skill-directory-loader.ts
|
|
@@ -182405,10 +182541,10 @@ async function loadSkillsFromDir(options) {
|
|
|
182405
182541
|
const directories = entries.filter((entry) => !entry.name.startsWith(".") && (entry.isDirectory() || entry.isSymbolicLink()));
|
|
182406
182542
|
const files = entries.filter((entry) => !entry.name.startsWith(".") && !entry.isDirectory() && !entry.isSymbolicLink() && isMarkdownFile(entry));
|
|
182407
182543
|
for (const entry of directories) {
|
|
182408
|
-
const entryPath =
|
|
182544
|
+
const entryPath = join62(options.skillsDir, entry.name);
|
|
182409
182545
|
const resolvedPath = await resolveSymlinkAsync(entryPath);
|
|
182410
182546
|
const dirName = entry.name;
|
|
182411
|
-
const skillMdPath =
|
|
182547
|
+
const skillMdPath = join62(resolvedPath, "SKILL.md");
|
|
182412
182548
|
if (await canAccessFile(skillMdPath)) {
|
|
182413
182549
|
const skill = await loadSkillFromPath({
|
|
182414
182550
|
skillPath: skillMdPath,
|
|
@@ -182422,7 +182558,7 @@ async function loadSkillsFromDir(options) {
|
|
|
182422
182558
|
}
|
|
182423
182559
|
continue;
|
|
182424
182560
|
}
|
|
182425
|
-
const namedSkillMdPath =
|
|
182561
|
+
const namedSkillMdPath = join62(resolvedPath, `${dirName}.md`);
|
|
182426
182562
|
if (await canAccessFile(namedSkillMdPath)) {
|
|
182427
182563
|
const skill = await loadSkillFromPath({
|
|
182428
182564
|
skillPath: namedSkillMdPath,
|
|
@@ -182453,7 +182589,7 @@ async function loadSkillsFromDir(options) {
|
|
|
182453
182589
|
}
|
|
182454
182590
|
}
|
|
182455
182591
|
for (const entry of files) {
|
|
182456
|
-
const entryPath =
|
|
182592
|
+
const entryPath = join62(options.skillsDir, entry.name);
|
|
182457
182593
|
const baseName = inferSkillNameFromFileName(entryPath);
|
|
182458
182594
|
const skill = await loadSkillFromPath({
|
|
182459
182595
|
skillPath: entryPath,
|
|
@@ -182505,7 +182641,7 @@ async function discoverAllSkills(directory) {
|
|
|
182505
182641
|
]);
|
|
182506
182642
|
}
|
|
182507
182643
|
async function discoverUserClaudeSkills() {
|
|
182508
|
-
const userSkillsDir =
|
|
182644
|
+
const userSkillsDir = join63(getClaudeConfigDir(), "skills");
|
|
182509
182645
|
return loadSkillsFromDir({ skillsDir: userSkillsDir, scope: "user" });
|
|
182510
182646
|
}
|
|
182511
182647
|
async function discoverProjectClaudeSkills(directory) {
|
|
@@ -182532,7 +182668,7 @@ async function discoverProjectAgentsSkills(directory) {
|
|
|
182532
182668
|
return deduplicateSkillsByName(allSkills.flat());
|
|
182533
182669
|
}
|
|
182534
182670
|
async function discoverGlobalAgentsSkills(homeDirectory = getHomeDirectory()) {
|
|
182535
|
-
const agentsGlobalDir =
|
|
182671
|
+
const agentsGlobalDir = join63(homeDirectory, ".agents", "skills");
|
|
182536
182672
|
return loadSkillsFromDir({ skillsDir: agentsGlobalDir, scope: "user" });
|
|
182537
182673
|
}
|
|
182538
182674
|
// packages/skills-loader-core/src/features/opencode-skill-loader/merger/builtin-skill-converter.ts
|
|
@@ -183284,7 +183420,7 @@ playwright-cli close
|
|
|
183284
183420
|
init_shared_skills();
|
|
183285
183421
|
init_src();
|
|
183286
183422
|
import { readFileSync as readFileSync50 } from "fs";
|
|
183287
|
-
import { join as
|
|
183423
|
+
import { join as join64 } from "path";
|
|
183288
183424
|
function createSharedSkillTemplateLoader(readFile3 = readFileSync50, skillsRootPath = sharedSkillsRootPath()) {
|
|
183289
183425
|
const cache = new Map;
|
|
183290
183426
|
return (skillName) => {
|
|
@@ -183292,7 +183428,7 @@ function createSharedSkillTemplateLoader(readFile3 = readFileSync50, skillsRootP
|
|
|
183292
183428
|
if (cached2 !== undefined)
|
|
183293
183429
|
return cached2;
|
|
183294
183430
|
try {
|
|
183295
|
-
const { body } = parseFrontmatter(readFile3(
|
|
183431
|
+
const { body } = parseFrontmatter(readFile3(join64(skillsRootPath, skillName, "SKILL.md"), "utf8"));
|
|
183296
183432
|
cache.set(skillName, body);
|
|
183297
183433
|
return body;
|
|
183298
183434
|
} catch (error51) {
|
|
@@ -184429,9 +184565,9 @@ var gitMasterSkill = {
|
|
|
184429
184565
|
template: GIT_MASTER_TEMPLATE
|
|
184430
184566
|
};
|
|
184431
184567
|
// packages/skills-loader-core/src/features/builtin-skills/skills/dev-browser.ts
|
|
184432
|
-
import { dirname as
|
|
184568
|
+
import { dirname as dirname25, join as join65 } from "path";
|
|
184433
184569
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
184434
|
-
var CURRENT_DIR =
|
|
184570
|
+
var CURRENT_DIR = dirname25(fileURLToPath8(import.meta.url));
|
|
184435
184571
|
var devBrowserSkill = {
|
|
184436
184572
|
name: "dev-browser",
|
|
184437
184573
|
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.",
|
|
@@ -184649,7 +184785,7 @@ console.log({
|
|
|
184649
184785
|
await client.disconnect();
|
|
184650
184786
|
EOF
|
|
184651
184787
|
\`\`\``,
|
|
184652
|
-
resolvedPath:
|
|
184788
|
+
resolvedPath: join65(CURRENT_DIR, "..", "dev-browser")
|
|
184653
184789
|
};
|
|
184654
184790
|
// packages/skills-loader-core/src/features/builtin-skills/skills/review-work.ts
|
|
184655
184791
|
var reviewWorkSkill = {
|
|
@@ -185642,12 +185778,12 @@ function applySnapshotRetention(options) {
|
|
|
185642
185778
|
// packages/omo-opencode/src/cli/snapshot/snapshot.ts
|
|
185643
185779
|
import { Database as Database3 } from "bun:sqlite";
|
|
185644
185780
|
import {
|
|
185645
|
-
existsSync as
|
|
185646
|
-
mkdirSync as
|
|
185647
|
-
copyFileSync as
|
|
185781
|
+
existsSync as existsSync67,
|
|
185782
|
+
mkdirSync as mkdirSync21,
|
|
185783
|
+
copyFileSync as copyFileSync4,
|
|
185648
185784
|
readFileSync as readFileSync51,
|
|
185649
185785
|
writeFileSync as writeFileSync19,
|
|
185650
|
-
readdirSync as
|
|
185786
|
+
readdirSync as readdirSync11,
|
|
185651
185787
|
statSync as statSync8,
|
|
185652
185788
|
rmSync as rmSync4
|
|
185653
185789
|
} from "fs";
|
|
@@ -185658,14 +185794,14 @@ async function snapshotCli(options = {}) {
|
|
|
185658
185794
|
const homeDir = os7.homedir();
|
|
185659
185795
|
const snapshotDir = options.snapshotDir ?? path18.join(homeDir, ".matrixos", "snapshots");
|
|
185660
185796
|
const allPaths = getAllSnapshotPaths(homeDir);
|
|
185661
|
-
const files = allPaths.files.filter((f2) =>
|
|
185797
|
+
const files = allPaths.files.filter((f2) => existsSync67(f2.sourcePath));
|
|
185662
185798
|
const realFs = {
|
|
185663
|
-
existsSync:
|
|
185664
|
-
mkdirSync:
|
|
185799
|
+
existsSync: existsSync67,
|
|
185800
|
+
mkdirSync: mkdirSync21,
|
|
185665
185801
|
readFileSync: readFileSync51,
|
|
185666
185802
|
writeFileSync: writeFileSync19,
|
|
185667
|
-
copyFileSync:
|
|
185668
|
-
readdirSync:
|
|
185803
|
+
copyFileSync: copyFileSync4,
|
|
185804
|
+
readdirSync: readdirSync11,
|
|
185669
185805
|
statSync: statSync8,
|
|
185670
185806
|
rmSync: rmSync4
|
|
185671
185807
|
};
|
|
@@ -185725,12 +185861,12 @@ async function snapshotCli(options = {}) {
|
|
|
185725
185861
|
|
|
185726
185862
|
// packages/omo-opencode/src/cli/snapshot/restore.ts
|
|
185727
185863
|
import {
|
|
185728
|
-
existsSync as
|
|
185729
|
-
mkdirSync as
|
|
185730
|
-
copyFileSync as
|
|
185864
|
+
existsSync as existsSync68,
|
|
185865
|
+
mkdirSync as mkdirSync22,
|
|
185866
|
+
copyFileSync as copyFileSync5,
|
|
185731
185867
|
readFileSync as readFileSync52,
|
|
185732
185868
|
writeFileSync as writeFileSync20,
|
|
185733
|
-
readdirSync as
|
|
185869
|
+
readdirSync as readdirSync12,
|
|
185734
185870
|
statSync as statSync9,
|
|
185735
185871
|
rmSync as rmSync5
|
|
185736
185872
|
} from "fs";
|
|
@@ -185739,12 +185875,12 @@ import * as os8 from "os";
|
|
|
185739
185875
|
async function restoreCli(options) {
|
|
185740
185876
|
const snapshotDir = options.snapshotDir ?? path19.join(os8.homedir(), ".matrixos", "snapshots");
|
|
185741
185877
|
const realFs = {
|
|
185742
|
-
existsSync:
|
|
185743
|
-
mkdirSync:
|
|
185878
|
+
existsSync: existsSync68,
|
|
185879
|
+
mkdirSync: mkdirSync22,
|
|
185744
185880
|
readFileSync: readFileSync52,
|
|
185745
185881
|
writeFileSync: writeFileSync20,
|
|
185746
|
-
copyFileSync:
|
|
185747
|
-
readdirSync:
|
|
185882
|
+
copyFileSync: copyFileSync5,
|
|
185883
|
+
readdirSync: readdirSync12,
|
|
185748
185884
|
statSync: statSync9,
|
|
185749
185885
|
rmSync: rmSync5
|
|
185750
185886
|
};
|
|
@@ -185777,12 +185913,12 @@ async function restoreCli(options) {
|
|
|
185777
185913
|
|
|
185778
185914
|
// packages/omo-opencode/src/cli/snapshot/list.ts
|
|
185779
185915
|
import {
|
|
185780
|
-
existsSync as
|
|
185781
|
-
mkdirSync as
|
|
185782
|
-
copyFileSync as
|
|
185916
|
+
existsSync as existsSync69,
|
|
185917
|
+
mkdirSync as mkdirSync23,
|
|
185918
|
+
copyFileSync as copyFileSync6,
|
|
185783
185919
|
readFileSync as readFileSync53,
|
|
185784
185920
|
writeFileSync as writeFileSync21,
|
|
185785
|
-
readdirSync as
|
|
185921
|
+
readdirSync as readdirSync13,
|
|
185786
185922
|
statSync as statSync10,
|
|
185787
185923
|
rmSync as rmSync6
|
|
185788
185924
|
} from "fs";
|
|
@@ -185801,12 +185937,12 @@ function formatBytes(bytes) {
|
|
|
185801
185937
|
async function snapshotListCli(options) {
|
|
185802
185938
|
const snapshotDir = options.snapshotDir ?? path20.join(os9.homedir(), ".matrixos", "snapshots");
|
|
185803
185939
|
const realFs = {
|
|
185804
|
-
existsSync:
|
|
185805
|
-
mkdirSync:
|
|
185940
|
+
existsSync: existsSync69,
|
|
185941
|
+
mkdirSync: mkdirSync23,
|
|
185806
185942
|
readFileSync: readFileSync53,
|
|
185807
185943
|
writeFileSync: writeFileSync21,
|
|
185808
|
-
copyFileSync:
|
|
185809
|
-
readdirSync:
|
|
185944
|
+
copyFileSync: copyFileSync6,
|
|
185945
|
+
readdirSync: readdirSync13,
|
|
185810
185946
|
statSync: statSync10,
|
|
185811
185947
|
rmSync: rmSync6
|
|
185812
185948
|
};
|
|
@@ -185831,12 +185967,12 @@ async function snapshotListCli(options) {
|
|
|
185831
185967
|
|
|
185832
185968
|
// packages/omo-opencode/src/cli/snapshot/prune.ts
|
|
185833
185969
|
import {
|
|
185834
|
-
existsSync as
|
|
185835
|
-
mkdirSync as
|
|
185836
|
-
copyFileSync as
|
|
185970
|
+
existsSync as existsSync70,
|
|
185971
|
+
mkdirSync as mkdirSync24,
|
|
185972
|
+
copyFileSync as copyFileSync7,
|
|
185837
185973
|
readFileSync as readFileSync54,
|
|
185838
185974
|
writeFileSync as writeFileSync22,
|
|
185839
|
-
readdirSync as
|
|
185975
|
+
readdirSync as readdirSync14,
|
|
185840
185976
|
statSync as statSync11,
|
|
185841
185977
|
rmSync as rmSync7
|
|
185842
185978
|
} from "fs";
|
|
@@ -185845,12 +185981,12 @@ import * as os10 from "os";
|
|
|
185845
185981
|
async function snapshotPruneCli(options = {}) {
|
|
185846
185982
|
const snapshotDir = options.snapshotDir ?? path21.join(os10.homedir(), ".matrixos", "snapshots");
|
|
185847
185983
|
const realFs = {
|
|
185848
|
-
existsSync:
|
|
185849
|
-
mkdirSync:
|
|
185984
|
+
existsSync: existsSync70,
|
|
185985
|
+
mkdirSync: mkdirSync24,
|
|
185850
185986
|
readFileSync: readFileSync54,
|
|
185851
185987
|
writeFileSync: writeFileSync22,
|
|
185852
|
-
copyFileSync:
|
|
185853
|
-
readdirSync:
|
|
185988
|
+
copyFileSync: copyFileSync7,
|
|
185989
|
+
readdirSync: readdirSync14,
|
|
185854
185990
|
statSync: statSync11,
|
|
185855
185991
|
rmSync: rmSync7
|
|
185856
185992
|
};
|
|
@@ -185895,8 +186031,8 @@ function codebaseCli(rootProgram) {
|
|
|
185895
186031
|
try {
|
|
185896
186032
|
const dimension = Number.parseInt(options.dimension, 10) || 384;
|
|
185897
186033
|
const dbDir = path22.dirname(options.db);
|
|
185898
|
-
const { mkdirSync:
|
|
185899
|
-
|
|
186034
|
+
const { mkdirSync: mkdirSync25 } = await import("fs");
|
|
186035
|
+
mkdirSync25(dbDir, { recursive: true });
|
|
185900
186036
|
const store4 = createSqliteVectorStore({ path: options.db, dimension });
|
|
185901
186037
|
if (options.reset) {
|
|
185902
186038
|
store4.clear();
|
|
@@ -187113,7 +187249,7 @@ function loadGatewayPassphrase() {
|
|
|
187113
187249
|
}
|
|
187114
187250
|
async function dashboardCli(options) {
|
|
187115
187251
|
const port3 = options.port ?? 9123;
|
|
187116
|
-
const host = options.host ?? "
|
|
187252
|
+
const host = options.host ?? "0.0.0.0";
|
|
187117
187253
|
const frontendDir = path25.resolve(import.meta.dir, "../features/dashboard/frontend");
|
|
187118
187254
|
const gatewayPassphrase = loadGatewayPassphrase();
|
|
187119
187255
|
console.log(`[dashboard] starting MaTrixOS dashboard on http://${host}:${port3}`);
|
|
@@ -187147,11 +187283,11 @@ async function dashboardCli(options) {
|
|
|
187147
187283
|
}
|
|
187148
187284
|
|
|
187149
187285
|
// packages/omo-opencode/src/cli/architect.ts
|
|
187150
|
-
import { join as
|
|
187286
|
+
import { join as join75 } from "path";
|
|
187151
187287
|
var IMPROVEMENTS_DIR = ".matrixos/improvements";
|
|
187152
187288
|
function getStore(directory) {
|
|
187153
187289
|
const baseDir = directory ?? process.cwd();
|
|
187154
|
-
return createImprovementStore(
|
|
187290
|
+
return createImprovementStore(join75(baseDir, IMPROVEMENTS_DIR));
|
|
187155
187291
|
}
|
|
187156
187292
|
async function architectReview(options) {
|
|
187157
187293
|
const store4 = getStore(options.directory);
|