@kl-c/matrixos 0.2.8 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +410 -324
- package/dist/cli/slash-command-installer.d.ts +4 -0
- package/dist/cli-node/index.js +410 -324
- package/dist/index.js +74 -52
- package/dist/plugin/auto-adoption.d.ts +5 -3
- package/package.json +1 -1
package/dist/cli-node/index.js
CHANGED
|
@@ -2163,7 +2163,7 @@ var package_default;
|
|
|
2163
2163
|
var init_package = __esm(() => {
|
|
2164
2164
|
package_default = {
|
|
2165
2165
|
name: "@kl-c/matrixos",
|
|
2166
|
-
version: "0.2.
|
|
2166
|
+
version: "0.2.9",
|
|
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",
|
|
@@ -67737,6 +67737,83 @@ var init_add_tui_plugin_to_tui_config = __esm(() => {
|
|
|
67737
67737
|
init_write_file_atomically2();
|
|
67738
67738
|
});
|
|
67739
67739
|
|
|
67740
|
+
// packages/omo-opencode/src/cli/slash-command-installer.ts
|
|
67741
|
+
import { existsSync as existsSync26, mkdirSync as mkdirSync9, copyFileSync as copyFileSync3, symlinkSync, readlinkSync } from "fs";
|
|
67742
|
+
import { join as join25 } from "path";
|
|
67743
|
+
import { homedir as homedir6 } from "os";
|
|
67744
|
+
function copySlashCommandsTo(dir) {
|
|
67745
|
+
try {
|
|
67746
|
+
if (!existsSync26(dir))
|
|
67747
|
+
mkdirSync9(dir, { recursive: true });
|
|
67748
|
+
let copied = 0;
|
|
67749
|
+
for (const name2 of SLASH_COMMAND_NAMES) {
|
|
67750
|
+
const src = join25(import.meta.dir, "slash-commands", name2);
|
|
67751
|
+
if (!existsSync26(src))
|
|
67752
|
+
continue;
|
|
67753
|
+
copyFileSync3(src, join25(dir, name2));
|
|
67754
|
+
copied++;
|
|
67755
|
+
}
|
|
67756
|
+
return copied;
|
|
67757
|
+
} catch {
|
|
67758
|
+
return 0;
|
|
67759
|
+
}
|
|
67760
|
+
}
|
|
67761
|
+
function resolveMatrixosBin() {
|
|
67762
|
+
const candidates = [
|
|
67763
|
+
join25(import.meta.dir, "..", "..", "bin", "matrixos.js"),
|
|
67764
|
+
join25(import.meta.dir, "..", "bin", "matrixos.js")
|
|
67765
|
+
];
|
|
67766
|
+
for (const c of candidates) {
|
|
67767
|
+
if (existsSync26(c))
|
|
67768
|
+
return c;
|
|
67769
|
+
}
|
|
67770
|
+
return null;
|
|
67771
|
+
}
|
|
67772
|
+
function installSlashCommandsAndPath() {
|
|
67773
|
+
const home = homedir6();
|
|
67774
|
+
const targets = [
|
|
67775
|
+
join25(home, ".config", "opencode", "commands"),
|
|
67776
|
+
join25(home, ".claude", "commands")
|
|
67777
|
+
];
|
|
67778
|
+
let total = 0;
|
|
67779
|
+
for (const t of targets)
|
|
67780
|
+
total += copySlashCommandsTo(t);
|
|
67781
|
+
let pathLinked = false;
|
|
67782
|
+
const bin = resolveMatrixosBin();
|
|
67783
|
+
const linkPath = "/usr/local/bin/matrixos";
|
|
67784
|
+
if (bin) {
|
|
67785
|
+
try {
|
|
67786
|
+
if (existsSync26(linkPath)) {
|
|
67787
|
+
try {
|
|
67788
|
+
const cur = readlinkSync(linkPath);
|
|
67789
|
+
if (cur !== bin) {
|
|
67790
|
+
symlinkSync(bin, linkPath + ".new");
|
|
67791
|
+
copyFileSync3(bin, linkPath);
|
|
67792
|
+
}
|
|
67793
|
+
} catch {
|
|
67794
|
+
copyFileSync3(bin, linkPath);
|
|
67795
|
+
}
|
|
67796
|
+
} else {
|
|
67797
|
+
symlinkSync(bin, linkPath);
|
|
67798
|
+
}
|
|
67799
|
+
pathLinked = true;
|
|
67800
|
+
} catch {
|
|
67801
|
+
pathLinked = false;
|
|
67802
|
+
}
|
|
67803
|
+
}
|
|
67804
|
+
return { commands: total, pathLinked };
|
|
67805
|
+
}
|
|
67806
|
+
var SLASH_COMMAND_NAMES;
|
|
67807
|
+
var init_slash_command_installer = __esm(() => {
|
|
67808
|
+
SLASH_COMMAND_NAMES = [
|
|
67809
|
+
"adopt.md",
|
|
67810
|
+
"readopt.md",
|
|
67811
|
+
"matrix-gateway-adopt-telegram.md",
|
|
67812
|
+
"matrix.md",
|
|
67813
|
+
"features.md"
|
|
67814
|
+
];
|
|
67815
|
+
});
|
|
67816
|
+
|
|
67740
67817
|
// packages/shared-skills/index.mjs
|
|
67741
67818
|
import { fileURLToPath } from "url";
|
|
67742
67819
|
function sharedSkillsRootPath() {
|
|
@@ -67745,8 +67822,8 @@ function sharedSkillsRootPath() {
|
|
|
67745
67822
|
var init_shared_skills = () => {};
|
|
67746
67823
|
|
|
67747
67824
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
67748
|
-
import { homedir as
|
|
67749
|
-
import { join as
|
|
67825
|
+
import { homedir as homedir7 } from "os";
|
|
67826
|
+
import { join as join26 } from "path";
|
|
67750
67827
|
function describeResult(result) {
|
|
67751
67828
|
if (result.kind === "succeeded")
|
|
67752
67829
|
return null;
|
|
@@ -67756,9 +67833,9 @@ function describeResult(result) {
|
|
|
67756
67833
|
}
|
|
67757
67834
|
async function installAstGrepForOpenCode(options = {}) {
|
|
67758
67835
|
const platform = options.platform ?? process.platform;
|
|
67759
|
-
const baseDir =
|
|
67836
|
+
const baseDir = join26(options.homeDir ?? homedir7(), ".omo");
|
|
67760
67837
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
67761
|
-
const skillDir =
|
|
67838
|
+
const skillDir = join26(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
67762
67839
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
67763
67840
|
try {
|
|
67764
67841
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -67866,6 +67943,15 @@ async function runCliInstaller(args, version) {
|
|
|
67866
67943
|
if (config.hasOpenCode && !hasAnyConfiguredProvider(config)) {
|
|
67867
67944
|
printWarning(getNoModelProvidersWarning());
|
|
67868
67945
|
}
|
|
67946
|
+
try {
|
|
67947
|
+
const slash = installSlashCommandsAndPath();
|
|
67948
|
+
if (slash.commands > 0)
|
|
67949
|
+
printSuccess(`Slash commands installed (${slash.commands} files)`);
|
|
67950
|
+
if (slash.pathLinked)
|
|
67951
|
+
printSuccess("matrixos available on PATH (/usr/local/bin/matrixos)");
|
|
67952
|
+
} catch (error) {
|
|
67953
|
+
printWarning(`Slash-command setup skipped: ${error instanceof Error ? error.message : String(error)}`);
|
|
67954
|
+
}
|
|
67869
67955
|
console.log(`${SYMBOLS.star} ${import_picocolors3.default.bold(import_picocolors3.default.green(isUpdate ? "Configuration updated!" : "Installation complete!"))}`);
|
|
67870
67956
|
if (hasOpenCode) {
|
|
67871
67957
|
console.log(` Run ${import_picocolors3.default.cyan("opencode")} to start!`);
|
|
@@ -67927,6 +68013,7 @@ var init_cli_installer = __esm(() => {
|
|
|
67927
68013
|
init_star_request();
|
|
67928
68014
|
init_provider_availability();
|
|
67929
68015
|
init_add_tui_plugin_to_tui_config();
|
|
68016
|
+
init_slash_command_installer();
|
|
67930
68017
|
init_install_ast_grep_sg();
|
|
67931
68018
|
import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
67932
68019
|
});
|
|
@@ -69566,15 +69653,16 @@ var init_dist5 = __esm(() => {
|
|
|
69566
69653
|
});
|
|
69567
69654
|
|
|
69568
69655
|
// packages/omo-opencode/src/cli/config-manager/write-gateway-env.ts
|
|
69569
|
-
import {
|
|
69570
|
-
import {
|
|
69656
|
+
import { homedir as homedir8 } from "os";
|
|
69657
|
+
import { existsSync as existsSync27, mkdirSync as mkdirSync10, readFileSync as readFileSync15, writeFileSync as writeFileSync6, chmodSync as chmodSync3 } from "fs";
|
|
69658
|
+
import { join as join27 } from "path";
|
|
69571
69659
|
function writeGatewayEnvToken(key, token) {
|
|
69572
|
-
const configDir =
|
|
69573
|
-
if (!
|
|
69574
|
-
|
|
69575
|
-
const envPath =
|
|
69660
|
+
const configDir = homedir8();
|
|
69661
|
+
if (!existsSync27(configDir))
|
|
69662
|
+
mkdirSync10(configDir, { recursive: true });
|
|
69663
|
+
const envPath = join27(configDir, GATEWAY_ENV_FILENAME);
|
|
69576
69664
|
const entries = new Map;
|
|
69577
|
-
if (
|
|
69665
|
+
if (existsSync27(envPath)) {
|
|
69578
69666
|
const existing = readFileSync15(envPath, "utf-8");
|
|
69579
69667
|
for (const rawLine of existing.split(`
|
|
69580
69668
|
`)) {
|
|
@@ -69603,9 +69691,7 @@ function writeGatewayEnv(token) {
|
|
|
69603
69691
|
return writeGatewayEnvToken("TELEGRAM_BOT_TOKEN", token);
|
|
69604
69692
|
}
|
|
69605
69693
|
var GATEWAY_ENV_FILENAME = ".klc-gateway.env";
|
|
69606
|
-
var init_write_gateway_env =
|
|
69607
|
-
init_config_context();
|
|
69608
|
-
});
|
|
69694
|
+
var init_write_gateway_env = () => {};
|
|
69609
69695
|
|
|
69610
69696
|
// packages/omo-opencode/src/cli/senpi-platform-flag.ts
|
|
69611
69697
|
function isSenpiPlatformEnabled(env2 = process.env) {
|
|
@@ -121268,7 +121354,7 @@ var require_dist9 = __commonJS((exports, module2) => {
|
|
|
121268
121354
|
var import_node_worker_threads2 = __require("worker_threads");
|
|
121269
121355
|
var import_collection2 = require_dist2();
|
|
121270
121356
|
var import_node_events = __require("events");
|
|
121271
|
-
var
|
|
121357
|
+
var import_node_path25 = __require("path");
|
|
121272
121358
|
var import_node_worker_threads = __require("worker_threads");
|
|
121273
121359
|
var import_collection = require_dist2();
|
|
121274
121360
|
var WorkerSendPayloadOp = /* @__PURE__ */ ((WorkerSendPayloadOp2) => {
|
|
@@ -121403,18 +121489,18 @@ var require_dist9 = __commonJS((exports, module2) => {
|
|
|
121403
121489
|
resolveWorkerPath() {
|
|
121404
121490
|
const path7 = this.options.workerPath;
|
|
121405
121491
|
if (!path7) {
|
|
121406
|
-
return (0,
|
|
121492
|
+
return (0, import_node_path25.join)(__dirname, "defaultWorker.js");
|
|
121407
121493
|
}
|
|
121408
|
-
if ((0,
|
|
121494
|
+
if ((0, import_node_path25.isAbsolute)(path7)) {
|
|
121409
121495
|
return path7;
|
|
121410
121496
|
}
|
|
121411
121497
|
if (/^\.\.?[/\\]/.test(path7)) {
|
|
121412
|
-
return (0,
|
|
121498
|
+
return (0, import_node_path25.resolve)(path7);
|
|
121413
121499
|
}
|
|
121414
121500
|
try {
|
|
121415
121501
|
return __require.resolve(path7);
|
|
121416
121502
|
} catch {
|
|
121417
|
-
return (0,
|
|
121503
|
+
return (0, import_node_path25.resolve)(path7);
|
|
121418
121504
|
}
|
|
121419
121505
|
}
|
|
121420
121506
|
async waitForWorkerReady(worker) {
|
|
@@ -128931,8 +129017,8 @@ var init_writer2 = __esm(() => {
|
|
|
128931
129017
|
});
|
|
128932
129018
|
|
|
128933
129019
|
// packages/omo-config-core/src/generator/mini-os-generator.ts
|
|
128934
|
-
import { existsSync as
|
|
128935
|
-
import { dirname as dirname9, join as
|
|
129020
|
+
import { existsSync as existsSync29, mkdirSync as mkdirSync11, writeFileSync as writeFileSync8 } from "fs";
|
|
129021
|
+
import { dirname as dirname9, join as join28 } from "path";
|
|
128936
129022
|
function generateMiniOS(options) {
|
|
128937
129023
|
const fs6 = options.fs ?? defaultFS;
|
|
128938
129024
|
const profile2 = options.profile;
|
|
@@ -128943,29 +129029,29 @@ function generateMiniOS(options) {
|
|
|
128943
129029
|
if (!fs6.existsSync(targetDir)) {
|
|
128944
129030
|
fs6.mkdirSync(targetDir, { recursive: true });
|
|
128945
129031
|
}
|
|
128946
|
-
const pkgPath =
|
|
129032
|
+
const pkgPath = join28(targetDir, "package.json");
|
|
128947
129033
|
writeIfMissing(fs6, pkgPath, TPL_PACKAGE_JSON(packageName, displayName, profile2.version, profile2.description, profile2.extends, profile2.baseAgent));
|
|
128948
129034
|
filesWritten.push(pkgPath);
|
|
128949
|
-
const srcDir =
|
|
129035
|
+
const srcDir = join28(targetDir, "src");
|
|
128950
129036
|
fs6.mkdirSync(srcDir, { recursive: true });
|
|
128951
|
-
const indexPath =
|
|
129037
|
+
const indexPath = join28(srcDir, "index.ts");
|
|
128952
129038
|
writeIfMissing(fs6, indexPath, TPL_INDEX_TS(profile2.name, displayName, profile2.description));
|
|
128953
129039
|
filesWritten.push(indexPath);
|
|
128954
|
-
const binDir =
|
|
129040
|
+
const binDir = join28(targetDir, "bin");
|
|
128955
129041
|
fs6.mkdirSync(binDir, { recursive: true });
|
|
128956
|
-
const binPath =
|
|
129042
|
+
const binPath = join28(binDir, "matrixos-mini.js");
|
|
128957
129043
|
writeIfMissing(fs6, binPath, TPL_BIN);
|
|
128958
129044
|
filesWritten.push(binPath);
|
|
128959
|
-
const scriptDir =
|
|
129045
|
+
const scriptDir = join28(targetDir, "script");
|
|
128960
129046
|
fs6.mkdirSync(scriptDir, { recursive: true });
|
|
128961
|
-
const buildPath =
|
|
129047
|
+
const buildPath = join28(scriptDir, "build.ts");
|
|
128962
129048
|
writeIfMissing(fs6, buildPath, TPL_BUILD_TS);
|
|
128963
129049
|
filesWritten.push(buildPath);
|
|
128964
129050
|
if (Object.keys(profile2.agents).length > 0) {
|
|
128965
|
-
const agentsDir =
|
|
129051
|
+
const agentsDir = join28(targetDir, "agents");
|
|
128966
129052
|
fs6.mkdirSync(agentsDir, { recursive: true });
|
|
128967
129053
|
for (const [agentName, agentDef] of Object.entries(profile2.agents)) {
|
|
128968
|
-
const agentFile =
|
|
129054
|
+
const agentFile = join28(agentsDir, `${agentName}.ts`);
|
|
128969
129055
|
const description = agentDef.description ?? `Custom ${displayName} agent: ${agentName}`;
|
|
128970
129056
|
writeIfMissing(fs6, agentFile, `// ${description}
|
|
128971
129057
|
// Generated by MaTrixOS Mini-OS Profile Generator.
|
|
@@ -128976,10 +129062,10 @@ export const description = ${JSON.stringify(description)}
|
|
|
128976
129062
|
}
|
|
128977
129063
|
}
|
|
128978
129064
|
if (profile2.skills.length > 0) {
|
|
128979
|
-
const skillsDir =
|
|
129065
|
+
const skillsDir = join28(targetDir, "skills");
|
|
128980
129066
|
fs6.mkdirSync(skillsDir, { recursive: true });
|
|
128981
129067
|
for (const skill of profile2.skills) {
|
|
128982
|
-
const skillFile =
|
|
129068
|
+
const skillFile = join28(skillsDir, `${skill}.md`);
|
|
128983
129069
|
writeIfMissing(fs6, skillFile, `# ${skill}
|
|
128984
129070
|
|
|
128985
129071
|
_Skill required by the ${displayName} profile. Implementation goes here._
|
|
@@ -128987,12 +129073,12 @@ _Skill required by the ${displayName} profile. Implementation goes here._
|
|
|
128987
129073
|
filesWritten.push(skillFile);
|
|
128988
129074
|
}
|
|
128989
129075
|
}
|
|
128990
|
-
const readmePath =
|
|
129076
|
+
const readmePath = join28(targetDir, "README.md");
|
|
128991
129077
|
const agentsList = Object.keys(profile2.agents);
|
|
128992
129078
|
const skillsList = profile2.skills;
|
|
128993
129079
|
writeIfMissing(fs6, readmePath, TPL_README(packageName, displayName, profile2.description, profile2.version, profile2.baseAgent, profile2.extends, agentsList, skillsList));
|
|
128994
129080
|
filesWritten.push(readmePath);
|
|
128995
|
-
const agentsMdPath =
|
|
129081
|
+
const agentsMdPath = join28(targetDir, "AGENTS.md");
|
|
128996
129082
|
writeIfMissing(fs6, agentsMdPath, TPL_AGENT_MD(displayName, profile2.description));
|
|
128997
129083
|
filesWritten.push(agentsMdPath);
|
|
128998
129084
|
return { packageName, packageDir: targetDir, filesWritten };
|
|
@@ -129144,7 +129230,7 @@ This profile is activated when the user mentions the profile name in their reque
|
|
|
129144
129230
|
- Profiles can be composed: multiple profiles in \`profiles: [...]\` are merged in order.
|
|
129145
129231
|
`;
|
|
129146
129232
|
var init_mini_os_generator = __esm(() => {
|
|
129147
|
-
defaultFS = { existsSync:
|
|
129233
|
+
defaultFS = { existsSync: existsSync29, mkdirSync: mkdirSync11, writeFileSync: writeFileSync8 };
|
|
129148
129234
|
});
|
|
129149
129235
|
|
|
129150
129236
|
// packages/omo-config-core/src/generator/index.ts
|
|
@@ -129853,8 +129939,8 @@ var init_update_toasts = __esm(() => {
|
|
|
129853
129939
|
});
|
|
129854
129940
|
|
|
129855
129941
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
129856
|
-
import { existsSync as
|
|
129857
|
-
import { dirname as dirname17, join as
|
|
129942
|
+
import { existsSync as existsSync45 } from "fs";
|
|
129943
|
+
import { dirname as dirname17, join as join40 } from "path";
|
|
129858
129944
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
129859
129945
|
function defaultGetModuleHostingWorkspace() {
|
|
129860
129946
|
try {
|
|
@@ -130007,8 +130093,8 @@ var init_background_update_check = __esm(() => {
|
|
|
130007
130093
|
init_package_json_locator();
|
|
130008
130094
|
init_update_toasts();
|
|
130009
130095
|
defaultDeps4 = {
|
|
130010
|
-
existsSync:
|
|
130011
|
-
join:
|
|
130096
|
+
existsSync: existsSync45,
|
|
130097
|
+
join: join40,
|
|
130012
130098
|
runBunInstallWithDetails,
|
|
130013
130099
|
log: log2,
|
|
130014
130100
|
getOpenCodeCacheDir,
|
|
@@ -154992,7 +155078,7 @@ var require_libvips = __commonJS((exports2, module2) => {
|
|
|
154992
155078
|
shell: true
|
|
154993
155079
|
};
|
|
154994
155080
|
var vendorPath = path18.join(__dirname, "..", "vendor", minimumLibvipsVersion, platform());
|
|
154995
|
-
var
|
|
155081
|
+
var mkdirSync18 = function(dirPath) {
|
|
154996
155082
|
try {
|
|
154997
155083
|
fs18.mkdirSync(dirPath, { recursive: true });
|
|
154998
155084
|
} catch (err) {
|
|
@@ -155003,9 +155089,9 @@ var require_libvips = __commonJS((exports2, module2) => {
|
|
|
155003
155089
|
};
|
|
155004
155090
|
var cachePath = function() {
|
|
155005
155091
|
const npmCachePath = env4.npm_config_cache || (env4.APPDATA ? path18.join(env4.APPDATA, "npm-cache") : path18.join(os7.homedir(), ".npm"));
|
|
155006
|
-
|
|
155092
|
+
mkdirSync18(npmCachePath);
|
|
155007
155093
|
const libvipsCachePath = path18.join(npmCachePath, "_libvips");
|
|
155008
|
-
|
|
155094
|
+
mkdirSync18(libvipsCachePath);
|
|
155009
155095
|
return libvipsCachePath;
|
|
155010
155096
|
};
|
|
155011
155097
|
var integrity = function(platformAndArch) {
|
|
@@ -155082,7 +155168,7 @@ var require_libvips = __commonJS((exports2, module2) => {
|
|
|
155082
155168
|
removeVendoredLibvips,
|
|
155083
155169
|
pkgConfigPath,
|
|
155084
155170
|
useGlobalLibvips,
|
|
155085
|
-
mkdirSync:
|
|
155171
|
+
mkdirSync: mkdirSync18
|
|
155086
155172
|
};
|
|
155087
155173
|
});
|
|
155088
155174
|
|
|
@@ -164838,19 +164924,19 @@ __export(exports_generate, {
|
|
|
164838
164924
|
executeGenerateCommand: () => executeGenerateCommand,
|
|
164839
164925
|
ProfileNotFoundError: () => ProfileNotFoundError
|
|
164840
164926
|
});
|
|
164841
|
-
import { existsSync as
|
|
164842
|
-
import { dirname as dirname28, isAbsolute as isAbsolute6, join as
|
|
164927
|
+
import { existsSync as existsSync72, readFileSync as readFileSync57, realpathSync as realpathSync10 } from "fs";
|
|
164928
|
+
import { dirname as dirname28, isAbsolute as isAbsolute6, join as join77, resolve as resolve16 } from "path";
|
|
164843
164929
|
function profilesDirFor(opts) {
|
|
164844
164930
|
if (opts.profilesDir)
|
|
164845
164931
|
return opts.profilesDir;
|
|
164846
164932
|
if (opts.cwd)
|
|
164847
|
-
return
|
|
164848
|
-
return
|
|
164933
|
+
return join77(opts.cwd, PROFILES_RELATIVE);
|
|
164934
|
+
return join77(REPO_ROOT, PROFILES_RELATIVE);
|
|
164849
164935
|
}
|
|
164850
164936
|
function loadProfile(name2, options = {}) {
|
|
164851
164937
|
const fs22 = options.fs ?? defaultFS2;
|
|
164852
164938
|
const dir = profilesDirFor(options);
|
|
164853
|
-
const path27 =
|
|
164939
|
+
const path27 = join77(dir, `${name2}.json`);
|
|
164854
164940
|
if (!fs22.existsSync(path27)) {
|
|
164855
164941
|
throw new ProfileNotFoundError(name2);
|
|
164856
164942
|
}
|
|
@@ -164863,7 +164949,7 @@ function listProfiles(options = {}) {
|
|
|
164863
164949
|
const known = options.knownNames ?? ["trader", "plumber"];
|
|
164864
164950
|
const out = [];
|
|
164865
164951
|
for (const name2 of known) {
|
|
164866
|
-
const path27 =
|
|
164952
|
+
const path27 = join77(dir, `${name2}.json`);
|
|
164867
164953
|
if (fs22.existsSync(path27)) {
|
|
164868
164954
|
try {
|
|
164869
164955
|
const raw = JSON.parse(fs22.readFileSync(path27, "utf-8"));
|
|
@@ -164936,7 +165022,7 @@ var init_generate = __esm(() => {
|
|
|
164936
165022
|
init_src5();
|
|
164937
165023
|
init_src5();
|
|
164938
165024
|
REPO_ROOT = resolve16(dirname28(new URL(import.meta.url).pathname), "..", "..", "..", "..", "..");
|
|
164939
|
-
defaultFS2 = { existsSync:
|
|
165025
|
+
defaultFS2 = { existsSync: existsSync72, readFileSync: readFileSync57, realpathSync: realpathSync10 };
|
|
164940
165026
|
ProfileNotFoundError = class ProfileNotFoundError extends Error {
|
|
164941
165027
|
profileName;
|
|
164942
165028
|
constructor(profileName) {
|
|
@@ -165055,12 +165141,12 @@ __export(exports_cost_report, {
|
|
|
165055
165141
|
executeCostReportCommand: () => executeCostReportCommand
|
|
165056
165142
|
});
|
|
165057
165143
|
import { Database as Database6 } from "bun:sqlite";
|
|
165058
|
-
import { existsSync as
|
|
165144
|
+
import { existsSync as existsSync73 } from "fs";
|
|
165059
165145
|
import * as path28 from "path";
|
|
165060
165146
|
import * as os14 from "os";
|
|
165061
165147
|
function executeCostReportCommand(args) {
|
|
165062
165148
|
const dbPath = path28.join(os14.homedir(), ".matrixos", "cost.db");
|
|
165063
|
-
if (!
|
|
165149
|
+
if (!existsSync73(dbPath)) {
|
|
165064
165150
|
return { exitCode: 1, stdout: `No cost data available
|
|
165065
165151
|
` };
|
|
165066
165152
|
}
|
|
@@ -165190,8 +165276,8 @@ var exports_profile_resolve = {};
|
|
|
165190
165276
|
__export(exports_profile_resolve, {
|
|
165191
165277
|
executeProfileResolveCommand: () => executeProfileResolveCommand
|
|
165192
165278
|
});
|
|
165193
|
-
import { existsSync as
|
|
165194
|
-
import { join as
|
|
165279
|
+
import { existsSync as existsSync74, readdirSync as readdirSync15, readFileSync as readFileSync58 } from "fs";
|
|
165280
|
+
import { join as join80, resolve as resolve17, dirname as dirname29 } from "path";
|
|
165195
165281
|
function executeProfileResolveCommand(args) {
|
|
165196
165282
|
if (args.options.help) {
|
|
165197
165283
|
return {
|
|
@@ -165216,8 +165302,8 @@ function executeProfileResolveCommand(args) {
|
|
|
165216
165302
|
` };
|
|
165217
165303
|
}
|
|
165218
165304
|
const name2 = nameRaw.endsWith(".json") ? nameRaw.slice(0, -5) : nameRaw;
|
|
165219
|
-
const profilesDir =
|
|
165220
|
-
if (!
|
|
165305
|
+
const profilesDir = join80(REPO_ROOT2, PROFILES_RELATIVE2);
|
|
165306
|
+
if (!existsSync74(profilesDir)) {
|
|
165221
165307
|
return { exitCode: 1, stdout: `error: profiles directory not found at ${profilesDir}
|
|
165222
165308
|
` };
|
|
165223
165309
|
}
|
|
@@ -165236,7 +165322,7 @@ function executeProfileResolveCommand(args) {
|
|
|
165236
165322
|
const registry2 = {};
|
|
165237
165323
|
for (const file3 of profileFiles) {
|
|
165238
165324
|
try {
|
|
165239
|
-
const filePath =
|
|
165325
|
+
const filePath = join80(profilesDir, file3);
|
|
165240
165326
|
const raw = JSON.parse(readFileSync58(filePath, "utf-8"));
|
|
165241
165327
|
const profile2 = ProfileSchema.parse(raw);
|
|
165242
165328
|
registry2[profile2.name] = profile2;
|
|
@@ -165299,8 +165385,8 @@ __export(exports_export, {
|
|
|
165299
165385
|
getShell: () => getShell,
|
|
165300
165386
|
executeExportCommand: () => executeExportCommand
|
|
165301
165387
|
});
|
|
165302
|
-
import { existsSync as
|
|
165303
|
-
import { isAbsolute as isAbsolute7, join as
|
|
165388
|
+
import { existsSync as existsSync75, readFileSync as readFileSync59, writeFileSync as writeFileSync26, copyFileSync as copyFileSync8, realpathSync as realpathSync11, mkdirSync as mkdirSync27 } from "fs";
|
|
165389
|
+
import { isAbsolute as isAbsolute7, join as join81, resolve as resolve18, dirname as dirname30 } from "path";
|
|
165304
165390
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
165305
165391
|
function setShell(shell) {
|
|
165306
165392
|
activeShell = shell;
|
|
@@ -165341,7 +165427,7 @@ function executeExportCommand(args) {
|
|
|
165341
165427
|
return { exitCode: 1, stdout: `error: generate failed: ${message}
|
|
165342
165428
|
` };
|
|
165343
165429
|
}
|
|
165344
|
-
const pkgPath =
|
|
165430
|
+
const pkgPath = join81(absoluteTargetDir, "package.json");
|
|
165345
165431
|
let pkg;
|
|
165346
165432
|
try {
|
|
165347
165433
|
pkg = JSON.parse(fs24.readFileSync(pkgPath, "utf-8"));
|
|
@@ -165381,7 +165467,7 @@ ${packResult.stdout}
|
|
|
165381
165467
|
return { exitCode: 1, stdout: `error: npm pack produced no tarball name in output
|
|
165382
165468
|
` };
|
|
165383
165469
|
}
|
|
165384
|
-
let tgzPath =
|
|
165470
|
+
let tgzPath = join81(absoluteTargetDir, tgzName);
|
|
165385
165471
|
if (args.options.output) {
|
|
165386
165472
|
const outputPath = args.options.output;
|
|
165387
165473
|
const absoluteOutput = isAbsolute7(outputPath) ? outputPath : resolve18(process.cwd(), outputPath);
|
|
@@ -165422,12 +165508,12 @@ var init_export = __esm(() => {
|
|
|
165422
165508
|
};
|
|
165423
165509
|
activeShell = defaultShell;
|
|
165424
165510
|
defaultExportFS = {
|
|
165425
|
-
existsSync:
|
|
165511
|
+
existsSync: existsSync75,
|
|
165426
165512
|
readFileSync: readFileSync59,
|
|
165427
165513
|
writeFileSync: writeFileSync26,
|
|
165428
|
-
copyFileSync:
|
|
165514
|
+
copyFileSync: copyFileSync8,
|
|
165429
165515
|
realpathSync: realpathSync11,
|
|
165430
|
-
mkdirSync:
|
|
165516
|
+
mkdirSync: mkdirSync27
|
|
165431
165517
|
};
|
|
165432
165518
|
});
|
|
165433
165519
|
|
|
@@ -165451,23 +165537,23 @@ __export(exports_project_context, {
|
|
|
165451
165537
|
createProject: () => createProject,
|
|
165452
165538
|
archiveProject: () => archiveProject
|
|
165453
165539
|
});
|
|
165454
|
-
import { existsSync as
|
|
165455
|
-
import { join as
|
|
165540
|
+
import { existsSync as existsSync76, mkdirSync as mkdirSync28, readFileSync as readFileSync60, writeFileSync as writeFileSync27, rmSync as rmSync8 } from "fs";
|
|
165541
|
+
import { join as join82 } from "path";
|
|
165456
165542
|
function getMatrixOsDir(cwd = process.cwd()) {
|
|
165457
|
-
return
|
|
165543
|
+
return join82(cwd, ".matrixos");
|
|
165458
165544
|
}
|
|
165459
165545
|
function getProjectsDir(cwd) {
|
|
165460
|
-
return
|
|
165546
|
+
return join82(getMatrixOsDir(cwd), "projects");
|
|
165461
165547
|
}
|
|
165462
165548
|
function getProjectDir(slug, cwd) {
|
|
165463
|
-
return
|
|
165549
|
+
return join82(getProjectsDir(cwd), slug);
|
|
165464
165550
|
}
|
|
165465
165551
|
function getStatePath(cwd) {
|
|
165466
|
-
return
|
|
165552
|
+
return join82(getMatrixOsDir(cwd), "state.json");
|
|
165467
165553
|
}
|
|
165468
165554
|
function loadState(cwd) {
|
|
165469
165555
|
const path29 = getStatePath(cwd);
|
|
165470
|
-
if (!
|
|
165556
|
+
if (!existsSync76(path29))
|
|
165471
165557
|
return {};
|
|
165472
165558
|
try {
|
|
165473
165559
|
return JSON.parse(readFileSync60(path29, "utf-8"));
|
|
@@ -165477,13 +165563,13 @@ function loadState(cwd) {
|
|
|
165477
165563
|
}
|
|
165478
165564
|
function saveState(state2, cwd) {
|
|
165479
165565
|
const path29 = getStatePath(cwd);
|
|
165480
|
-
|
|
165566
|
+
mkdirSync28(getMatrixOsDir(cwd), { recursive: true });
|
|
165481
165567
|
writeFileSync27(path29, JSON.stringify(state2, null, 2) + `
|
|
165482
165568
|
`);
|
|
165483
165569
|
}
|
|
165484
165570
|
function loadProjectMeta(slug, cwd) {
|
|
165485
|
-
const path29 =
|
|
165486
|
-
if (!
|
|
165571
|
+
const path29 = join82(getProjectDir(slug, cwd), "meta.json");
|
|
165572
|
+
if (!existsSync76(path29))
|
|
165487
165573
|
return null;
|
|
165488
165574
|
try {
|
|
165489
165575
|
return JSON.parse(readFileSync60(path29, "utf-8"));
|
|
@@ -165493,16 +165579,16 @@ function loadProjectMeta(slug, cwd) {
|
|
|
165493
165579
|
}
|
|
165494
165580
|
function saveProjectMeta(slug, meta3, cwd) {
|
|
165495
165581
|
const dir = getProjectDir(slug, cwd);
|
|
165496
|
-
|
|
165497
|
-
const path29 =
|
|
165582
|
+
mkdirSync28(dir, { recursive: true });
|
|
165583
|
+
const path29 = join82(dir, "meta.json");
|
|
165498
165584
|
writeFileSync27(path29, JSON.stringify(meta3, null, 2) + `
|
|
165499
165585
|
`);
|
|
165500
165586
|
}
|
|
165501
165587
|
function initProjectFiles(slug, cwd) {
|
|
165502
165588
|
const dir = getProjectDir(slug, cwd);
|
|
165503
|
-
|
|
165504
|
-
const kanbanPath =
|
|
165505
|
-
if (!
|
|
165589
|
+
mkdirSync28(join82(dir, "kb"), { recursive: true });
|
|
165590
|
+
const kanbanPath = join82(dir, "kanban.json");
|
|
165591
|
+
if (!existsSync76(kanbanPath)) {
|
|
165506
165592
|
writeFileSync27(kanbanPath, JSON.stringify({ columns: ["todo", "in-progress", "review", "done"], tasks: [] }, null, 2) + `
|
|
165507
165593
|
`);
|
|
165508
165594
|
}
|
|
@@ -165512,7 +165598,7 @@ function createProject(slug, options = {}) {
|
|
|
165512
165598
|
throw new Error(`Invalid project slug "${slug}": only lowercase letters, numbers, - and _ are allowed.`);
|
|
165513
165599
|
}
|
|
165514
165600
|
const dir = getProjectDir(slug, options.cwd);
|
|
165515
|
-
if (
|
|
165601
|
+
if (existsSync76(dir)) {
|
|
165516
165602
|
throw new Error(`Project "${slug}" already exists.`);
|
|
165517
165603
|
}
|
|
165518
165604
|
const now = new Date().toISOString();
|
|
@@ -165533,7 +165619,7 @@ function createProject(slug, options = {}) {
|
|
|
165533
165619
|
function listProjects(cwd) {
|
|
165534
165620
|
const state2 = loadState(cwd);
|
|
165535
165621
|
const root = getProjectsDir(cwd);
|
|
165536
|
-
if (!
|
|
165622
|
+
if (!existsSync76(root))
|
|
165537
165623
|
return [];
|
|
165538
165624
|
const fs24 = __require("fs");
|
|
165539
165625
|
const items = [];
|
|
@@ -165581,7 +165667,7 @@ function unarchiveProject(slug, cwd) {
|
|
|
165581
165667
|
}
|
|
165582
165668
|
function deleteProject(slug, cwd) {
|
|
165583
165669
|
const dir = getProjectDir(slug, cwd);
|
|
165584
|
-
if (!
|
|
165670
|
+
if (!existsSync76(dir))
|
|
165585
165671
|
throw new Error(`Project "${slug}" does not exist.`);
|
|
165586
165672
|
rmSync8(dir, { recursive: true, force: true });
|
|
165587
165673
|
const state2 = loadState(cwd);
|
|
@@ -165612,8 +165698,8 @@ __export(exports_project_memory, {
|
|
|
165612
165698
|
isProjectEpisode: () => isProjectEpisode,
|
|
165613
165699
|
addKbDocument: () => addKbDocument
|
|
165614
165700
|
});
|
|
165615
|
-
import { existsSync as
|
|
165616
|
-
import { join as
|
|
165701
|
+
import { existsSync as existsSync77, mkdirSync as mkdirSync29, readFileSync as readFileSync61, readdirSync as readdirSync16, writeFileSync as writeFileSync28 } from "fs";
|
|
165702
|
+
import { join as join83 } from "path";
|
|
165617
165703
|
function tagWithProject(metadata = {}, projectSlug, cwd) {
|
|
165618
165704
|
const active = projectSlug ?? getActiveProject(cwd)?.slug;
|
|
165619
165705
|
if (!active)
|
|
@@ -165627,14 +165713,14 @@ function isProjectEpisode(ep, projectSlug, cwd) {
|
|
|
165627
165713
|
return ep.metadata?.project === target;
|
|
165628
165714
|
}
|
|
165629
165715
|
function listKbDocuments(projectSlug, cwd) {
|
|
165630
|
-
const kbDir =
|
|
165631
|
-
if (!
|
|
165716
|
+
const kbDir = join83(getProjectDir(projectSlug, cwd), "kb");
|
|
165717
|
+
if (!existsSync77(kbDir))
|
|
165632
165718
|
return [];
|
|
165633
165719
|
const docs = [];
|
|
165634
165720
|
for (const entry of readdirSync16(kbDir, { withFileTypes: true })) {
|
|
165635
165721
|
if (!entry.isFile())
|
|
165636
165722
|
continue;
|
|
165637
|
-
const path29 =
|
|
165723
|
+
const path29 = join83(kbDir, entry.name);
|
|
165638
165724
|
try {
|
|
165639
165725
|
docs.push({ path: path29, content: readFileSync61(path29, "utf-8") });
|
|
165640
165726
|
} catch {}
|
|
@@ -165678,10 +165764,10 @@ async function searchProject(query, options = {}) {
|
|
|
165678
165764
|
return [...kbHits, ...memoryHits].sort((a2, b2) => b2.score - a2.score);
|
|
165679
165765
|
}
|
|
165680
165766
|
function addKbDocument(projectSlug, filename, content, cwd) {
|
|
165681
|
-
const kbDir =
|
|
165682
|
-
|
|
165767
|
+
const kbDir = join83(getProjectDir(projectSlug, cwd), "kb");
|
|
165768
|
+
mkdirSync29(kbDir, { recursive: true });
|
|
165683
165769
|
const safeName = filename.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
165684
|
-
const path29 =
|
|
165770
|
+
const path29 = join83(kbDir, safeName);
|
|
165685
165771
|
writeFileSync28(path29, content, "utf-8");
|
|
165686
165772
|
return path29;
|
|
165687
165773
|
}
|
|
@@ -166058,10 +166144,10 @@ __export(exports_gateway_start, {
|
|
|
166058
166144
|
buildTelegramConfig: () => buildTelegramConfig,
|
|
166059
166145
|
buildGatewayConfig: () => buildGatewayConfig
|
|
166060
166146
|
});
|
|
166061
|
-
import { readFileSync as readFileSync62, existsSync as
|
|
166147
|
+
import { readFileSync as readFileSync62, existsSync as existsSync78 } from "fs";
|
|
166062
166148
|
import { resolve as resolve19 } from "path";
|
|
166063
166149
|
function loadGatewayEnv(path29 = ENV_PATH) {
|
|
166064
|
-
if (!
|
|
166150
|
+
if (!existsSync78(path29))
|
|
166065
166151
|
return {};
|
|
166066
166152
|
const text = readFileSync62(path29, "utf8");
|
|
166067
166153
|
const out = {};
|
|
@@ -166200,7 +166286,7 @@ var init_deployment_core = __esm(() => {
|
|
|
166200
166286
|
|
|
166201
166287
|
// packages/omo-opencode/src/deployment/deploy-static.ts
|
|
166202
166288
|
import { spawn as spawn6 } from "child_process";
|
|
166203
|
-
import { existsSync as
|
|
166289
|
+
import { existsSync as existsSync79 } from "fs";
|
|
166204
166290
|
import { resolve as resolve20 } from "path";
|
|
166205
166291
|
function pushStage(stage, message, ok = true) {
|
|
166206
166292
|
return { stage, message, ok };
|
|
@@ -166257,7 +166343,7 @@ var init_deploy_static = __esm(() => {
|
|
|
166257
166343
|
}
|
|
166258
166344
|
stages.push(pushStage("build", "build succeeded"));
|
|
166259
166345
|
}
|
|
166260
|
-
if (!
|
|
166346
|
+
if (!existsSync79(buildDir)) {
|
|
166261
166347
|
stages.push(pushStage("push", `build directory not found: ${buildDir}`, false));
|
|
166262
166348
|
return { target: "static", ok: false, stages, error: "build directory missing" };
|
|
166263
166349
|
}
|
|
@@ -166533,10 +166619,10 @@ var init_deployment = __esm(() => {
|
|
|
166533
166619
|
});
|
|
166534
166620
|
|
|
166535
166621
|
// packages/omo-opencode/src/audit/self-audit.ts
|
|
166536
|
-
import { existsSync as
|
|
166537
|
-
import { join as
|
|
166622
|
+
import { existsSync as existsSync80, mkdirSync as mkdirSync30, readdirSync as readdirSync17, readFileSync as readFileSync63, writeFileSync as writeFileSync29 } from "fs";
|
|
166623
|
+
import { join as join84 } from "path";
|
|
166538
166624
|
function getAuditDir(cwd = process.cwd()) {
|
|
166539
|
-
return
|
|
166625
|
+
return join84(cwd, ".matrixos", "audits");
|
|
166540
166626
|
}
|
|
166541
166627
|
function getWeekString(date5 = new Date) {
|
|
166542
166628
|
const d = new Date(Date.UTC(date5.getFullYear(), date5.getMonth(), date5.getDate()));
|
|
@@ -166643,8 +166729,8 @@ function formatAuditReport(report) {
|
|
|
166643
166729
|
}
|
|
166644
166730
|
function writeAuditReport(report, cwd) {
|
|
166645
166731
|
const dir = getAuditDir(cwd);
|
|
166646
|
-
|
|
166647
|
-
const path29 =
|
|
166732
|
+
mkdirSync30(dir, { recursive: true });
|
|
166733
|
+
const path29 = join84(dir, `${report.week}.md`);
|
|
166648
166734
|
writeFileSync29(path29, formatAuditReport(report), "utf-8");
|
|
166649
166735
|
return path29;
|
|
166650
166736
|
}
|
|
@@ -167611,7 +167697,7 @@ async function processEvents(ctx, stream, state) {
|
|
|
167611
167697
|
}
|
|
167612
167698
|
// packages/omo-opencode/src/plugin-config/layered-config-loader.ts
|
|
167613
167699
|
import * as fs7 from "fs";
|
|
167614
|
-
import { homedir as
|
|
167700
|
+
import { homedir as homedir9 } from "os";
|
|
167615
167701
|
import * as path7 from "path";
|
|
167616
167702
|
|
|
167617
167703
|
// packages/omo-opencode/src/config/schema/agent-names.ts
|
|
@@ -168595,7 +168681,7 @@ function loadConfigFromPath(configPath, _ctx) {
|
|
|
168595
168681
|
|
|
168596
168682
|
// packages/omo-opencode/src/plugin-config/layered-config-loader.ts
|
|
168597
168683
|
function resolveHomeDirectory() {
|
|
168598
|
-
return process.env.HOME ?? process.env.USERPROFILE ??
|
|
168684
|
+
return process.env.HOME ?? process.env.USERPROFILE ?? homedir9();
|
|
168599
168685
|
}
|
|
168600
168686
|
function resolveConfigPathAfterLegacyMigration(detectedPath) {
|
|
168601
168687
|
if (!path7.basename(detectedPath).startsWith(LEGACY_CONFIG_BASENAME)) {
|
|
@@ -169187,7 +169273,7 @@ var BOULDER_STATE_PATH = `${BOULDER_DIR}/${BOULDER_FILE}`;
|
|
|
169187
169273
|
var NOTEPAD_DIR = "notepads";
|
|
169188
169274
|
var NOTEPAD_BASE_PATH = `${BOULDER_DIR}/${NOTEPAD_DIR}`;
|
|
169189
169275
|
// packages/boulder-state/src/top-level-task.ts
|
|
169190
|
-
import { existsSync as
|
|
169276
|
+
import { existsSync as existsSync32, readFileSync as readFileSync18 } from "fs";
|
|
169191
169277
|
var TODO_HEADING_PATTERN = /^##\s+TODOs\b/i;
|
|
169192
169278
|
var FINAL_VERIFICATION_HEADING_PATTERN = /^##\s+Final Verification Wave\b/i;
|
|
169193
169279
|
var SECOND_LEVEL_HEADING_PATTERN = /^##\s+/;
|
|
@@ -169210,7 +169296,7 @@ function buildTaskRef(section, taskLabel) {
|
|
|
169210
169296
|
};
|
|
169211
169297
|
}
|
|
169212
169298
|
function readCurrentTopLevelTask(planPath) {
|
|
169213
|
-
if (!
|
|
169299
|
+
if (!existsSync32(planPath)) {
|
|
169214
169300
|
return null;
|
|
169215
169301
|
}
|
|
169216
169302
|
try {
|
|
@@ -169239,10 +169325,10 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
169239
169325
|
}
|
|
169240
169326
|
}
|
|
169241
169327
|
// packages/boulder-state/src/storage/path.ts
|
|
169242
|
-
import { existsSync as
|
|
169243
|
-
import { isAbsolute as isAbsolute4, join as
|
|
169328
|
+
import { existsSync as existsSync33 } from "fs";
|
|
169329
|
+
import { isAbsolute as isAbsolute4, join as join30, relative as relative3, resolve as resolve8 } from "path";
|
|
169244
169330
|
function getBoulderFilePath(directory) {
|
|
169245
|
-
return
|
|
169331
|
+
return join30(directory, BOULDER_DIR, BOULDER_FILE);
|
|
169246
169332
|
}
|
|
169247
169333
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
169248
169334
|
return isAbsolute4(trackedPath) ? resolve8(trackedPath) : resolve8(baseDirectory, trackedPath);
|
|
@@ -169260,13 +169346,13 @@ function resolveBoulderPlanPath(directory, state) {
|
|
|
169260
169346
|
}
|
|
169261
169347
|
const absoluteWorktreePath = resolveTrackedPath(directory, worktreePath);
|
|
169262
169348
|
const worktreePlanPath = resolve8(absoluteWorktreePath, relativePlanPath);
|
|
169263
|
-
return
|
|
169349
|
+
return existsSync33(worktreePlanPath) ? worktreePlanPath : absolutePlanPath;
|
|
169264
169350
|
}
|
|
169265
169351
|
function resolveBoulderPlanPathForWork(directory, work) {
|
|
169266
169352
|
return resolveBoulderPlanPath(directory, work);
|
|
169267
169353
|
}
|
|
169268
169354
|
// packages/boulder-state/src/storage/plan-progress.ts
|
|
169269
|
-
import { existsSync as
|
|
169355
|
+
import { existsSync as existsSync34, readFileSync as readFileSync19, readdirSync as readdirSync4, statSync as statSync5 } from "fs";
|
|
169270
169356
|
var TODO_HEADING_PATTERN2 = /^##\s+TODOs\b/i;
|
|
169271
169357
|
var FINAL_VERIFICATION_HEADING_PATTERN2 = /^##\s+Final Verification Wave\b/i;
|
|
169272
169358
|
var SECOND_LEVEL_HEADING_PATTERN2 = /^##\s+/;
|
|
@@ -169275,7 +169361,7 @@ var CHECKED_CHECKBOX_PATTERN = /^(\s*)[-*]\s*\[[xX]\]\s*(.+)$/;
|
|
|
169275
169361
|
var TODO_TASK_PATTERN2 = /^\d+\.\s+/;
|
|
169276
169362
|
var FINAL_WAVE_TASK_PATTERN2 = /^F\d+\.\s+/i;
|
|
169277
169363
|
function getPlanProgress(planPath) {
|
|
169278
|
-
if (!
|
|
169364
|
+
if (!existsSync34(planPath)) {
|
|
169279
169365
|
return { total: 0, completed: 0, isComplete: false };
|
|
169280
169366
|
}
|
|
169281
169367
|
try {
|
|
@@ -169395,10 +169481,10 @@ function selectMirrorWork(state) {
|
|
|
169395
169481
|
return sorted[0] ?? null;
|
|
169396
169482
|
}
|
|
169397
169483
|
// packages/boulder-state/src/storage/read-state.ts
|
|
169398
|
-
import { existsSync as
|
|
169484
|
+
import { existsSync as existsSync35, readFileSync as readFileSync20 } from "fs";
|
|
169399
169485
|
function readBoulderState(directory) {
|
|
169400
169486
|
const filePath = getBoulderFilePath(directory);
|
|
169401
|
-
if (!
|
|
169487
|
+
if (!existsSync35(filePath)) {
|
|
169402
169488
|
return null;
|
|
169403
169489
|
}
|
|
169404
169490
|
try {
|
|
@@ -169468,14 +169554,14 @@ init_state();
|
|
|
169468
169554
|
// packages/omo-opencode/src/features/run-continuation-state/constants.ts
|
|
169469
169555
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
169470
169556
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
169471
|
-
import { existsSync as
|
|
169472
|
-
import { join as
|
|
169557
|
+
import { existsSync as existsSync36, mkdirSync as mkdirSync12, readFileSync as readFileSync21, rmSync as rmSync2, writeFileSync as writeFileSync9 } from "fs";
|
|
169558
|
+
import { join as join31 } from "path";
|
|
169473
169559
|
function getMarkerPath(directory, sessionID) {
|
|
169474
|
-
return
|
|
169560
|
+
return join31(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
169475
169561
|
}
|
|
169476
169562
|
function readContinuationMarker(directory, sessionID) {
|
|
169477
169563
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
169478
|
-
if (!
|
|
169564
|
+
if (!existsSync36(markerPath))
|
|
169479
169565
|
return null;
|
|
169480
169566
|
try {
|
|
169481
169567
|
const raw = readFileSync21(markerPath, "utf-8");
|
|
@@ -169544,7 +169630,7 @@ async function isSessionInBoulderLineage(input) {
|
|
|
169544
169630
|
init_shared();
|
|
169545
169631
|
init_compaction_marker();
|
|
169546
169632
|
import { readFileSync as readFileSync22, readdirSync as readdirSync5 } from "fs";
|
|
169547
|
-
import { join as
|
|
169633
|
+
import { join as join32 } from "path";
|
|
169548
169634
|
var defaultSessionLastAgentDeps = {
|
|
169549
169635
|
getMessageDir,
|
|
169550
169636
|
isSqliteBackend,
|
|
@@ -169604,7 +169690,7 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
|
|
|
169604
169690
|
try {
|
|
169605
169691
|
const messages = readdirSync5(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
169606
169692
|
try {
|
|
169607
|
-
const content = readFileSync22(
|
|
169693
|
+
const content = readFileSync22(join32(messageDir, fileName), "utf-8");
|
|
169608
169694
|
const parsed = JSON.parse(content);
|
|
169609
169695
|
return {
|
|
169610
169696
|
fileName,
|
|
@@ -169647,8 +169733,8 @@ init_agent_display_names();
|
|
|
169647
169733
|
|
|
169648
169734
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
169649
169735
|
init_frontmatter2();
|
|
169650
|
-
import { existsSync as
|
|
169651
|
-
import { dirname as dirname12, join as
|
|
169736
|
+
import { existsSync as existsSync37, readFileSync as readFileSync23, writeFileSync as writeFileSync10, unlinkSync as unlinkSync5, mkdirSync as mkdirSync13 } from "fs";
|
|
169737
|
+
import { dirname as dirname12, join as join33 } from "path";
|
|
169652
169738
|
|
|
169653
169739
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
169654
169740
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -169657,11 +169743,11 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
169657
169743
|
|
|
169658
169744
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
169659
169745
|
function getStateFilePath(directory, customPath) {
|
|
169660
|
-
return customPath ?
|
|
169746
|
+
return customPath ? join33(directory, customPath) : join33(directory, DEFAULT_STATE_FILE);
|
|
169661
169747
|
}
|
|
169662
169748
|
function readState(directory, customPath) {
|
|
169663
169749
|
const filePath = getStateFilePath(directory, customPath);
|
|
169664
|
-
if (!
|
|
169750
|
+
if (!existsSync37(filePath)) {
|
|
169665
169751
|
return null;
|
|
169666
169752
|
}
|
|
169667
169753
|
try {
|
|
@@ -170240,22 +170326,22 @@ function createTimestampedStdoutController(stdout2 = process.stdout) {
|
|
|
170240
170326
|
// packages/telemetry-core/src/activity-state.ts
|
|
170241
170327
|
init_atomic_write();
|
|
170242
170328
|
init_xdg_data_dir();
|
|
170243
|
-
import { existsSync as
|
|
170244
|
-
import { basename as basename6, join as
|
|
170329
|
+
import { existsSync as existsSync38, mkdirSync as mkdirSync14, readFileSync as readFileSync24 } from "fs";
|
|
170330
|
+
import { basename as basename6, join as join34 } from "path";
|
|
170245
170331
|
var POSTHOG_ACTIVITY_STATE_FILE = "posthog-activity.json";
|
|
170246
170332
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
170247
170333
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
170248
170334
|
env: options.env,
|
|
170249
170335
|
osProvider: options.osProvider
|
|
170250
170336
|
});
|
|
170251
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
170337
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join34(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
170252
170338
|
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename6(dataDir) === product.cacheDirName) {
|
|
170253
170339
|
return dataDir;
|
|
170254
170340
|
}
|
|
170255
|
-
return
|
|
170341
|
+
return join34(dataDir, product.cacheDirName);
|
|
170256
170342
|
}
|
|
170257
170343
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
170258
|
-
return
|
|
170344
|
+
return join34(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
170259
170345
|
}
|
|
170260
170346
|
function getDailyActiveCaptureState(input) {
|
|
170261
170347
|
const state2 = readPostHogActivityState(input.stateDir, input.diagnostics);
|
|
@@ -170280,7 +170366,7 @@ function isPostHogActivityState(value) {
|
|
|
170280
170366
|
}
|
|
170281
170367
|
function readPostHogActivityState(stateDir, diagnostics) {
|
|
170282
170368
|
const stateFilePath = getTelemetryActivityStateFilePath(stateDir);
|
|
170283
|
-
if (!
|
|
170369
|
+
if (!existsSync38(stateFilePath)) {
|
|
170284
170370
|
return {};
|
|
170285
170371
|
}
|
|
170286
170372
|
try {
|
|
@@ -170303,7 +170389,7 @@ function readPostHogActivityState(stateDir, diagnostics) {
|
|
|
170303
170389
|
function writePostHogActivityState(stateDir, nextState, diagnostics) {
|
|
170304
170390
|
const stateFilePath = getTelemetryActivityStateFilePath(stateDir);
|
|
170305
170391
|
try {
|
|
170306
|
-
|
|
170392
|
+
mkdirSync14(stateDir, { recursive: true });
|
|
170307
170393
|
writeFileAtomically(stateFilePath, `${JSON.stringify(nextState, null, 2)}
|
|
170308
170394
|
`);
|
|
170309
170395
|
} catch (error51) {
|
|
@@ -177407,14 +177493,14 @@ init_constants5();
|
|
|
177407
177493
|
|
|
177408
177494
|
// packages/omo-opencode/src/cli/doctor/checks/system.ts
|
|
177409
177495
|
init_constants5();
|
|
177410
|
-
import { existsSync as
|
|
177496
|
+
import { existsSync as existsSync49, readFileSync as readFileSync34 } from "fs";
|
|
177411
177497
|
|
|
177412
177498
|
// packages/omo-opencode/src/cli/doctor/checks/system-binary.ts
|
|
177413
177499
|
init_extract_semver();
|
|
177414
177500
|
init_bun_which_shim();
|
|
177415
|
-
import { existsSync as
|
|
177416
|
-
import { homedir as
|
|
177417
|
-
import { join as
|
|
177501
|
+
import { existsSync as existsSync46, accessSync as accessSync4, constants as constants8 } from "fs";
|
|
177502
|
+
import { homedir as homedir12 } from "os";
|
|
177503
|
+
import { join as join41 } from "path";
|
|
177418
177504
|
|
|
177419
177505
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
177420
177506
|
init_spawn_with_windows_hide();
|
|
@@ -177502,22 +177588,22 @@ function isExecutable2(path14) {
|
|
|
177502
177588
|
}
|
|
177503
177589
|
}
|
|
177504
177590
|
function getDesktopAppPaths(platform) {
|
|
177505
|
-
const home =
|
|
177591
|
+
const home = homedir12();
|
|
177506
177592
|
switch (platform) {
|
|
177507
177593
|
case "darwin":
|
|
177508
177594
|
return [
|
|
177509
177595
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
177510
|
-
|
|
177596
|
+
join41(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
177511
177597
|
];
|
|
177512
177598
|
case "win32": {
|
|
177513
177599
|
const programFiles = process.env.ProgramFiles;
|
|
177514
177600
|
const localAppData = process.env.LOCALAPPDATA;
|
|
177515
177601
|
const paths2 = [];
|
|
177516
177602
|
if (programFiles) {
|
|
177517
|
-
paths2.push(
|
|
177603
|
+
paths2.push(join41(programFiles, "OpenCode", "OpenCode.exe"));
|
|
177518
177604
|
}
|
|
177519
177605
|
if (localAppData) {
|
|
177520
|
-
paths2.push(
|
|
177606
|
+
paths2.push(join41(localAppData, "OpenCode", "OpenCode.exe"));
|
|
177521
177607
|
}
|
|
177522
177608
|
return paths2;
|
|
177523
177609
|
}
|
|
@@ -177525,8 +177611,8 @@ function getDesktopAppPaths(platform) {
|
|
|
177525
177611
|
return [
|
|
177526
177612
|
"/usr/bin/opencode",
|
|
177527
177613
|
"/usr/lib/opencode/opencode",
|
|
177528
|
-
|
|
177529
|
-
|
|
177614
|
+
join41(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
177615
|
+
join41(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
177530
177616
|
];
|
|
177531
177617
|
default:
|
|
177532
177618
|
return [];
|
|
@@ -177538,7 +177624,7 @@ function buildVersionCommand(binaryPath, platform) {
|
|
|
177538
177624
|
}
|
|
177539
177625
|
return [binaryPath, "--version"];
|
|
177540
177626
|
}
|
|
177541
|
-
function findDesktopBinary(platform = process.platform, checkExists =
|
|
177627
|
+
function findDesktopBinary(platform = process.platform, checkExists = existsSync46) {
|
|
177542
177628
|
for (const desktopPath of getDesktopAppPaths(platform)) {
|
|
177543
177629
|
if (checkExists(desktopPath)) {
|
|
177544
177630
|
return { binary: "opencode", path: desktopPath };
|
|
@@ -177546,7 +177632,7 @@ function findDesktopBinary(platform = process.platform, checkExists = existsSync
|
|
|
177546
177632
|
}
|
|
177547
177633
|
return null;
|
|
177548
177634
|
}
|
|
177549
|
-
async function findOpenCodeBinary(platform = process.platform, checkExists =
|
|
177635
|
+
async function findOpenCodeBinary(platform = process.platform, checkExists = existsSync46) {
|
|
177550
177636
|
for (const binary2 of OPENCODE_BINARIES2) {
|
|
177551
177637
|
const path14 = bunWhich(binary2);
|
|
177552
177638
|
if (path14 && checkExists(path14)) {
|
|
@@ -177558,7 +177644,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
177558
177644
|
const candidates = getCommandCandidates2(platform);
|
|
177559
177645
|
for (const entry of pathEnv.split(delimiter3).filter(Boolean)) {
|
|
177560
177646
|
for (const command of candidates) {
|
|
177561
|
-
const fullPath =
|
|
177647
|
+
const fullPath = join41(entry, command);
|
|
177562
177648
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
177563
177649
|
return { binary: command, path: fullPath };
|
|
177564
177650
|
}
|
|
@@ -177604,12 +177690,12 @@ function compareVersions3(current, minimum) {
|
|
|
177604
177690
|
|
|
177605
177691
|
// packages/omo-opencode/src/cli/doctor/checks/system-plugin.ts
|
|
177606
177692
|
init_shared();
|
|
177607
|
-
import { existsSync as
|
|
177693
|
+
import { existsSync as existsSync47, readFileSync as readFileSync32 } from "fs";
|
|
177608
177694
|
function detectConfigPath() {
|
|
177609
177695
|
const paths2 = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
177610
|
-
if (
|
|
177696
|
+
if (existsSync47(paths2.configJsonc))
|
|
177611
177697
|
return paths2.configJsonc;
|
|
177612
|
-
if (
|
|
177698
|
+
if (existsSync47(paths2.configJson))
|
|
177613
177699
|
return paths2.configJson;
|
|
177614
177700
|
return null;
|
|
177615
177701
|
}
|
|
@@ -177699,35 +177785,35 @@ init_auto_update_checker();
|
|
|
177699
177785
|
init_package_json_locator();
|
|
177700
177786
|
init_constants5();
|
|
177701
177787
|
init_shared();
|
|
177702
|
-
import { existsSync as
|
|
177788
|
+
import { existsSync as existsSync48, readFileSync as readFileSync33, readdirSync as readdirSync7 } from "fs";
|
|
177703
177789
|
import { createRequire as createRequire2 } from "module";
|
|
177704
|
-
import { homedir as
|
|
177705
|
-
import { join as
|
|
177790
|
+
import { homedir as homedir13 } from "os";
|
|
177791
|
+
import { join as join42 } from "path";
|
|
177706
177792
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
177707
177793
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
177708
177794
|
if (platform === "darwin")
|
|
177709
|
-
return
|
|
177795
|
+
return join42(homedir13(), "Library", "Caches");
|
|
177710
177796
|
if (platform === "win32")
|
|
177711
|
-
return process.env.LOCALAPPDATA ??
|
|
177712
|
-
return
|
|
177797
|
+
return process.env.LOCALAPPDATA ?? join42(homedir13(), "AppData", "Local");
|
|
177798
|
+
return join42(homedir13(), ".cache");
|
|
177713
177799
|
}
|
|
177714
177800
|
function resolveOpenCodeCacheDir() {
|
|
177715
177801
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
177716
177802
|
if (xdgCacheHome)
|
|
177717
|
-
return
|
|
177803
|
+
return join42(xdgCacheHome, "opencode");
|
|
177718
177804
|
const fromShared = getOpenCodeCacheDir();
|
|
177719
|
-
const platformDefault =
|
|
177720
|
-
if (
|
|
177805
|
+
const platformDefault = join42(getPlatformDefaultCacheDir(), "opencode");
|
|
177806
|
+
if (existsSync48(fromShared) || !existsSync48(platformDefault))
|
|
177721
177807
|
return fromShared;
|
|
177722
177808
|
return platformDefault;
|
|
177723
177809
|
}
|
|
177724
177810
|
function resolveExistingDir(dirPath) {
|
|
177725
|
-
if (!
|
|
177811
|
+
if (!existsSync48(dirPath))
|
|
177726
177812
|
return dirPath;
|
|
177727
177813
|
return resolveSymlink(dirPath);
|
|
177728
177814
|
}
|
|
177729
177815
|
function readPackageJson(filePath) {
|
|
177730
|
-
if (!
|
|
177816
|
+
if (!existsSync48(filePath))
|
|
177731
177817
|
return null;
|
|
177732
177818
|
try {
|
|
177733
177819
|
const content = readFileSync33(filePath, "utf-8");
|
|
@@ -177748,26 +177834,26 @@ function normalizeVersion(value) {
|
|
|
177748
177834
|
function createPackageCandidates(rootDir) {
|
|
177749
177835
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
177750
177836
|
packageName,
|
|
177751
|
-
installedPackagePath:
|
|
177837
|
+
installedPackagePath: join42(rootDir, "node_modules", packageName, "package.json")
|
|
177752
177838
|
}));
|
|
177753
177839
|
}
|
|
177754
177840
|
function createTaggedInstallCandidates(rootDir) {
|
|
177755
|
-
const packagesDir =
|
|
177756
|
-
if (!
|
|
177841
|
+
const packagesDir = join42(rootDir, "packages");
|
|
177842
|
+
if (!existsSync48(packagesDir))
|
|
177757
177843
|
return [];
|
|
177758
177844
|
const candidates = [];
|
|
177759
177845
|
for (const entryName of readdirSync7(packagesDir).sort()) {
|
|
177760
177846
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name2) => entryName.startsWith(`${name2}@`));
|
|
177761
177847
|
if (packageName === undefined)
|
|
177762
177848
|
continue;
|
|
177763
|
-
const installDir =
|
|
177849
|
+
const installDir = join42(packagesDir, entryName);
|
|
177764
177850
|
candidates.push({
|
|
177765
177851
|
cacheDir: installDir,
|
|
177766
|
-
cachePackagePath:
|
|
177852
|
+
cachePackagePath: join42(installDir, "package.json"),
|
|
177767
177853
|
packageCandidates: [
|
|
177768
177854
|
{
|
|
177769
177855
|
packageName,
|
|
177770
|
-
installedPackagePath:
|
|
177856
|
+
installedPackagePath: join42(installDir, "node_modules", packageName, "package.json")
|
|
177771
177857
|
}
|
|
177772
177858
|
]
|
|
177773
177859
|
});
|
|
@@ -177775,7 +177861,7 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
177775
177861
|
return candidates;
|
|
177776
177862
|
}
|
|
177777
177863
|
function selectInstalledPackage(candidate) {
|
|
177778
|
-
return candidate.packageCandidates.find((packageCandidate) =>
|
|
177864
|
+
return candidate.packageCandidates.find((packageCandidate) => existsSync48(packageCandidate.installedPackagePath)) ?? candidate.packageCandidates[0];
|
|
177779
177865
|
}
|
|
177780
177866
|
function getExpectedVersion(cachePackage, packageName) {
|
|
177781
177867
|
return normalizeVersion(cachePackage?.dependencies?.[packageName]) ?? normalizeVersion(cachePackage?.dependencies?.[PACKAGE_NAME]);
|
|
@@ -177786,7 +177872,7 @@ function resolveInstalledPackageJsonPath() {
|
|
|
177786
177872
|
for (const packageName of ACCEPTED_PACKAGE_NAMES) {
|
|
177787
177873
|
try {
|
|
177788
177874
|
const packageJsonPath = require2.resolve(`${packageName}/package.json`);
|
|
177789
|
-
if (
|
|
177875
|
+
if (existsSync48(packageJsonPath)) {
|
|
177790
177876
|
return { packageName, packageJsonPath };
|
|
177791
177877
|
}
|
|
177792
177878
|
} catch {
|
|
@@ -177812,22 +177898,22 @@ function getLoadedPluginVersion() {
|
|
|
177812
177898
|
const candidates = [
|
|
177813
177899
|
{
|
|
177814
177900
|
cacheDir: configDir,
|
|
177815
|
-
cachePackagePath:
|
|
177901
|
+
cachePackagePath: join42(configDir, "package.json"),
|
|
177816
177902
|
packageCandidates: createPackageCandidates(configDir)
|
|
177817
177903
|
},
|
|
177818
177904
|
...createTaggedInstallCandidates(configDir),
|
|
177819
177905
|
{
|
|
177820
177906
|
cacheDir,
|
|
177821
|
-
cachePackagePath:
|
|
177907
|
+
cachePackagePath: join42(cacheDir, "package.json"),
|
|
177822
177908
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
177823
177909
|
},
|
|
177824
177910
|
...createTaggedInstallCandidates(cacheDir)
|
|
177825
177911
|
];
|
|
177826
|
-
const selectedCandidate = candidates.find((candidate) => candidate.packageCandidates.some((packageCandidate) =>
|
|
177912
|
+
const selectedCandidate = candidates.find((candidate) => candidate.packageCandidates.some((packageCandidate) => existsSync48(packageCandidate.installedPackagePath))) ?? candidates[0];
|
|
177827
177913
|
const { cacheDir: selectedDir, cachePackagePath } = selectedCandidate;
|
|
177828
177914
|
const selectedPackage = selectInstalledPackage(selectedCandidate);
|
|
177829
177915
|
const candidateInstalledPath = selectedPackage.installedPackagePath;
|
|
177830
|
-
const candidateExists =
|
|
177916
|
+
const candidateExists = existsSync48(candidateInstalledPath);
|
|
177831
177917
|
const resolvedFallback = candidateExists ? null : resolveInstalledPackageJsonPath();
|
|
177832
177918
|
const installedPackagePath = resolvedFallback?.packageJsonPath ?? candidateInstalledPath;
|
|
177833
177919
|
const resolvedPackageName = resolvedFallback?.packageName ?? selectedPackage.packageName;
|
|
@@ -177863,7 +177949,7 @@ var defaultDeps6 = {
|
|
|
177863
177949
|
getLoadedPluginVersion,
|
|
177864
177950
|
getLatestPluginVersion,
|
|
177865
177951
|
getSuggestedInstallTag,
|
|
177866
|
-
configExists:
|
|
177952
|
+
configExists: existsSync49,
|
|
177867
177953
|
readConfigFile: (path14) => readFileSync34(path14, "utf-8"),
|
|
177868
177954
|
parseConfigContent: (content) => parseJsonc(content)
|
|
177869
177955
|
};
|
|
@@ -178010,12 +178096,12 @@ async function checkSystem(deps = defaultDeps6) {
|
|
|
178010
178096
|
// packages/omo-opencode/src/config/validate.ts
|
|
178011
178097
|
init_src();
|
|
178012
178098
|
import { readFileSync as readFileSync35 } from "fs";
|
|
178013
|
-
import { homedir as
|
|
178099
|
+
import { homedir as homedir14 } from "os";
|
|
178014
178100
|
import { dirname as dirname18, relative as relative5 } from "path";
|
|
178015
178101
|
init_shared();
|
|
178016
178102
|
init_plugin_identity();
|
|
178017
178103
|
function resolveHomeDirectory2() {
|
|
178018
|
-
return process.env.HOME ?? process.env.USERPROFILE ??
|
|
178104
|
+
return process.env.HOME ?? process.env.USERPROFILE ?? homedir14();
|
|
178019
178105
|
}
|
|
178020
178106
|
function discoverConfigInDirectory(configDir) {
|
|
178021
178107
|
const detected = detectPluginConfigFile(configDir, {
|
|
@@ -178126,23 +178212,23 @@ init_constants5();
|
|
|
178126
178212
|
|
|
178127
178213
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-cache.ts
|
|
178128
178214
|
init_shared();
|
|
178129
|
-
import { existsSync as
|
|
178130
|
-
import { homedir as
|
|
178131
|
-
import { join as
|
|
178215
|
+
import { existsSync as existsSync50, readFileSync as readFileSync36 } from "fs";
|
|
178216
|
+
import { homedir as homedir15 } from "os";
|
|
178217
|
+
import { join as join43 } from "path";
|
|
178132
178218
|
function getUserConfigDir2() {
|
|
178133
178219
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
178134
178220
|
if (xdgConfig)
|
|
178135
|
-
return
|
|
178136
|
-
return
|
|
178221
|
+
return join43(xdgConfig, "opencode");
|
|
178222
|
+
return join43(homedir15(), ".config", "opencode");
|
|
178137
178223
|
}
|
|
178138
178224
|
function loadCustomProviderNames() {
|
|
178139
178225
|
const configDir = getUserConfigDir2();
|
|
178140
178226
|
const candidatePaths = [
|
|
178141
|
-
|
|
178142
|
-
|
|
178227
|
+
join43(configDir, "opencode.json"),
|
|
178228
|
+
join43(configDir, "opencode.jsonc")
|
|
178143
178229
|
];
|
|
178144
178230
|
for (const configPath of candidatePaths) {
|
|
178145
|
-
if (!
|
|
178231
|
+
if (!existsSync50(configPath))
|
|
178146
178232
|
continue;
|
|
178147
178233
|
try {
|
|
178148
178234
|
const content = readFileSync36(configPath, "utf-8");
|
|
@@ -178160,9 +178246,9 @@ function loadCustomProviderNames() {
|
|
|
178160
178246
|
return [];
|
|
178161
178247
|
}
|
|
178162
178248
|
function loadAvailableModelsFromCache() {
|
|
178163
|
-
const cacheFile =
|
|
178249
|
+
const cacheFile = join43(getOpenCodeCacheDir(), "models.json");
|
|
178164
178250
|
const customProviders = loadCustomProviderNames();
|
|
178165
|
-
if (!
|
|
178251
|
+
if (!existsSync50(cacheFile)) {
|
|
178166
178252
|
if (customProviders.length > 0) {
|
|
178167
178253
|
return { providers: customProviders, modelCount: 0, cacheExists: true };
|
|
178168
178254
|
}
|
|
@@ -178198,8 +178284,8 @@ init_constants5();
|
|
|
178198
178284
|
init_shared();
|
|
178199
178285
|
init_plugin_identity();
|
|
178200
178286
|
import { readFileSync as readFileSync37 } from "fs";
|
|
178201
|
-
import { join as
|
|
178202
|
-
var PROJECT_CONFIG_DIR =
|
|
178287
|
+
import { join as join44 } from "path";
|
|
178288
|
+
var PROJECT_CONFIG_DIR = join44(process.cwd(), ".opencode");
|
|
178203
178289
|
function loadOmoConfig() {
|
|
178204
178290
|
const projectDetected = detectPluginConfigFile(PROJECT_CONFIG_DIR, {
|
|
178205
178291
|
basenames: [CONFIG_BASENAME],
|
|
@@ -178237,7 +178323,7 @@ function loadOmoConfig() {
|
|
|
178237
178323
|
|
|
178238
178324
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
178239
178325
|
init_shared();
|
|
178240
|
-
import { join as
|
|
178326
|
+
import { join as join45 } from "path";
|
|
178241
178327
|
|
|
178242
178328
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
178243
178329
|
function formatModelWithVariant(model, variant) {
|
|
@@ -178279,7 +178365,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
178279
178365
|
}
|
|
178280
178366
|
function buildModelResolutionDetails(options) {
|
|
178281
178367
|
const details = [];
|
|
178282
|
-
const cacheFile =
|
|
178368
|
+
const cacheFile = join45(getOpenCodeCacheDir(), "models.json");
|
|
178283
178369
|
details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
|
|
178284
178370
|
details.push("");
|
|
178285
178371
|
if (options.available.cacheExists) {
|
|
@@ -178555,28 +178641,28 @@ async function checkConfig() {
|
|
|
178555
178641
|
|
|
178556
178642
|
// packages/omo-opencode/src/cli/doctor/checks/dependencies.ts
|
|
178557
178643
|
init_src();
|
|
178558
|
-
import { existsSync as
|
|
178644
|
+
import { existsSync as existsSync51 } from "fs";
|
|
178559
178645
|
import { createRequire as createRequire3 } from "module";
|
|
178560
|
-
import { homedir as
|
|
178561
|
-
import { dirname as dirname19, join as
|
|
178646
|
+
import { homedir as homedir17 } from "os";
|
|
178647
|
+
import { dirname as dirname19, join as join47 } from "path";
|
|
178562
178648
|
|
|
178563
178649
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
178564
|
-
import { join as
|
|
178565
|
-
import { homedir as
|
|
178650
|
+
import { join as join46 } from "path";
|
|
178651
|
+
import { homedir as homedir16, tmpdir as tmpdir3 } from "os";
|
|
178566
178652
|
init_binary_downloader();
|
|
178567
178653
|
init_logger2();
|
|
178568
178654
|
init_plugin_identity();
|
|
178569
178655
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
178570
|
-
var DEBUG_FILE =
|
|
178656
|
+
var DEBUG_FILE = join46(tmpdir3(), "comment-checker-debug.log");
|
|
178571
178657
|
function getCacheDir2() {
|
|
178572
178658
|
if (process.platform === "win32") {
|
|
178573
178659
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
178574
|
-
const base2 = localAppData ||
|
|
178575
|
-
return
|
|
178660
|
+
const base2 = localAppData || join46(homedir16(), "AppData", "Local");
|
|
178661
|
+
return join46(base2, CACHE_DIR_NAME, "bin");
|
|
178576
178662
|
}
|
|
178577
178663
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
178578
|
-
const base = xdgCache ||
|
|
178579
|
-
return
|
|
178664
|
+
const base = xdgCache || join46(homedir16(), ".cache");
|
|
178665
|
+
return join46(base, CACHE_DIR_NAME, "bin");
|
|
178580
178666
|
}
|
|
178581
178667
|
function getBinaryName() {
|
|
178582
178668
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -178626,7 +178712,7 @@ async function getBinaryVersion(binary2) {
|
|
|
178626
178712
|
}
|
|
178627
178713
|
}
|
|
178628
178714
|
async function checkAstGrepCli() {
|
|
178629
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
178715
|
+
const runtimeDir = astGrepRuntimeDir(join47(homedir17(), ".omo"));
|
|
178630
178716
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
178631
178717
|
if (sgPath === null) {
|
|
178632
178718
|
return {
|
|
@@ -178656,11 +178742,11 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
178656
178742
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
178657
178743
|
try {
|
|
178658
178744
|
const packageDir = baseDirOverride ?? dirname19(resolvePackageJsonPath());
|
|
178659
|
-
const vendorPath =
|
|
178660
|
-
if (
|
|
178745
|
+
const vendorPath = join47(packageDir, "vendor", platformKey, binaryName);
|
|
178746
|
+
if (existsSync51(vendorPath))
|
|
178661
178747
|
return vendorPath;
|
|
178662
|
-
const binPath =
|
|
178663
|
-
if (
|
|
178748
|
+
const binPath = join47(packageDir, "bin", binaryName);
|
|
178749
|
+
if (existsSync51(binPath))
|
|
178664
178750
|
return binPath;
|
|
178665
178751
|
} catch (error51) {
|
|
178666
178752
|
if (!(error51 instanceof Error) && !isModuleResolutionFailure(error51))
|
|
@@ -178805,12 +178891,12 @@ async function getGhCliInfo(dependencies = {}) {
|
|
|
178805
178891
|
|
|
178806
178892
|
// packages/omo-opencode/src/cli/doctor/checks/tools-lsp.ts
|
|
178807
178893
|
import { readFileSync as readFileSync39 } from "fs";
|
|
178808
|
-
import { join as
|
|
178894
|
+
import { join as join48 } from "path";
|
|
178809
178895
|
|
|
178810
178896
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
178811
178897
|
init_zod();
|
|
178812
178898
|
init_opencode_config_dir();
|
|
178813
|
-
import { existsSync as
|
|
178899
|
+
import { existsSync as existsSync52, readFileSync as readFileSync38 } from "fs";
|
|
178814
178900
|
import { delimiter as delimiter3, dirname as dirname20, resolve as resolve10 } from "path";
|
|
178815
178901
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
178816
178902
|
|
|
@@ -178976,7 +179062,7 @@ function createBootstrapCandidate(root, pathExists, resolveExecutable) {
|
|
|
178976
179062
|
};
|
|
178977
179063
|
}
|
|
178978
179064
|
function resolveLspCommand(options = {}) {
|
|
178979
|
-
const pathExists = options.exists ??
|
|
179065
|
+
const pathExists = options.exists ?? existsSync52;
|
|
178980
179066
|
const resolveExecutable = options.resolveExecutable ?? resolveRuntimeExecutable;
|
|
178981
179067
|
const moduleDirectory = getModuleDirectory(options.moduleUrl ?? import.meta.url);
|
|
178982
179068
|
const candidates = moduleDirectory ? createAncestorCliCandidates({
|
|
@@ -179042,7 +179128,7 @@ function readOmoConfig(configDirectory) {
|
|
|
179042
179128
|
}
|
|
179043
179129
|
function isLspMcpDisabled(options) {
|
|
179044
179130
|
const userConfigDirectory = options.configDirectory ?? getOpenCodeConfigDir({ binary: "opencode" });
|
|
179045
|
-
const projectConfigDirectory =
|
|
179131
|
+
const projectConfigDirectory = join48(options.cwd ?? process.cwd(), ".opencode");
|
|
179046
179132
|
const userConfig = readOmoConfig(userConfigDirectory);
|
|
179047
179133
|
const projectConfig = readOmoConfig(projectConfigDirectory);
|
|
179048
179134
|
const disabledMcps = new Set([
|
|
@@ -179061,21 +179147,21 @@ function getInstalledLspServers(options = {}) {
|
|
|
179061
179147
|
|
|
179062
179148
|
// packages/omo-opencode/src/cli/doctor/checks/tools-mcp.ts
|
|
179063
179149
|
init_shared();
|
|
179064
|
-
import { existsSync as
|
|
179065
|
-
import { homedir as
|
|
179066
|
-
import { join as
|
|
179150
|
+
import { existsSync as existsSync53, readFileSync as readFileSync40 } from "fs";
|
|
179151
|
+
import { homedir as homedir18 } from "os";
|
|
179152
|
+
import { join as join49 } from "path";
|
|
179067
179153
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
179068
179154
|
function getMcpConfigPaths() {
|
|
179069
179155
|
return [
|
|
179070
|
-
|
|
179071
|
-
|
|
179072
|
-
|
|
179156
|
+
join49(homedir18(), ".claude", ".mcp.json"),
|
|
179157
|
+
join49(process.cwd(), ".mcp.json"),
|
|
179158
|
+
join49(process.cwd(), ".claude", ".mcp.json")
|
|
179073
179159
|
];
|
|
179074
179160
|
}
|
|
179075
179161
|
function loadUserMcpConfig() {
|
|
179076
179162
|
const servers = {};
|
|
179077
179163
|
for (const configPath of getMcpConfigPaths()) {
|
|
179078
|
-
if (!
|
|
179164
|
+
if (!existsSync53(configPath))
|
|
179079
179165
|
continue;
|
|
179080
179166
|
try {
|
|
179081
179167
|
const content = readFileSync40(configPath, "utf-8");
|
|
@@ -179213,13 +179299,13 @@ async function checkTools() {
|
|
|
179213
179299
|
}
|
|
179214
179300
|
|
|
179215
179301
|
// packages/omo-opencode/src/cli/doctor/checks/telemetry.ts
|
|
179216
|
-
import { existsSync as
|
|
179302
|
+
import { existsSync as existsSync54, readFileSync as readFileSync41 } from "fs";
|
|
179217
179303
|
init_constants5();
|
|
179218
179304
|
function isTelemetryState(value) {
|
|
179219
179305
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
179220
179306
|
}
|
|
179221
179307
|
function readLastActiveDay(stateFilePath) {
|
|
179222
|
-
if (!
|
|
179308
|
+
if (!existsSync54(stateFilePath)) {
|
|
179223
179309
|
return "never";
|
|
179224
179310
|
}
|
|
179225
179311
|
let parsed;
|
|
@@ -179282,17 +179368,17 @@ async function probeBinary(cmd, args, spawnImpl) {
|
|
|
179282
179368
|
}
|
|
179283
179369
|
|
|
179284
179370
|
// packages/team-core/src/team-registry/paths.ts
|
|
179285
|
-
import { homedir as
|
|
179371
|
+
import { homedir as homedir19 } from "os";
|
|
179286
179372
|
import path14 from "path";
|
|
179287
179373
|
function resolveBaseDir(config5) {
|
|
179288
|
-
return expandHomeDirectory(config5.base_dir ?? path14.join(
|
|
179374
|
+
return expandHomeDirectory(config5.base_dir ?? path14.join(homedir19(), ".omo"));
|
|
179289
179375
|
}
|
|
179290
179376
|
function expandHomeDirectory(directoryPath) {
|
|
179291
179377
|
if (directoryPath === "~") {
|
|
179292
|
-
return
|
|
179378
|
+
return homedir19();
|
|
179293
179379
|
}
|
|
179294
179380
|
if (directoryPath.startsWith("~/") || directoryPath.startsWith("~\\")) {
|
|
179295
|
-
return path14.join(
|
|
179381
|
+
return path14.join(homedir19(), directoryPath.slice(2));
|
|
179296
179382
|
}
|
|
179297
179383
|
return directoryPath;
|
|
179298
179384
|
}
|
|
@@ -179775,23 +179861,23 @@ Doctor failed unexpectedly: ${message}`];
|
|
|
179775
179861
|
import { createHash as createHash3 } from "crypto";
|
|
179776
179862
|
import {
|
|
179777
179863
|
chmodSync as chmodSync6,
|
|
179778
|
-
existsSync as
|
|
179779
|
-
mkdirSync as
|
|
179864
|
+
existsSync as existsSync57,
|
|
179865
|
+
mkdirSync as mkdirSync16,
|
|
179780
179866
|
readdirSync as readdirSync8,
|
|
179781
179867
|
readFileSync as readFileSync44,
|
|
179782
179868
|
renameSync as renameSync7,
|
|
179783
179869
|
unlinkSync as unlinkSync8,
|
|
179784
179870
|
writeFileSync as writeFileSync14
|
|
179785
179871
|
} from "fs";
|
|
179786
|
-
import { basename as basename8, dirname as dirname21, join as
|
|
179872
|
+
import { basename as basename8, dirname as dirname21, join as join52 } from "path";
|
|
179787
179873
|
|
|
179788
179874
|
// packages/mcp-client-core/src/config-dir.ts
|
|
179789
|
-
import { existsSync as
|
|
179790
|
-
import { homedir as
|
|
179791
|
-
import { join as
|
|
179875
|
+
import { existsSync as existsSync55, realpathSync as realpathSync7 } from "fs";
|
|
179876
|
+
import { homedir as homedir20 } from "os";
|
|
179877
|
+
import { join as join50, resolve as resolve11 } from "path";
|
|
179792
179878
|
function resolveConfigPath2(pathValue) {
|
|
179793
179879
|
const resolvedPath = resolve11(pathValue);
|
|
179794
|
-
if (!
|
|
179880
|
+
if (!existsSync55(resolvedPath))
|
|
179795
179881
|
return resolvedPath;
|
|
179796
179882
|
try {
|
|
179797
179883
|
return realpathSync7(resolvedPath);
|
|
@@ -179806,13 +179892,13 @@ function getOpenCodeCliConfigDir(env2 = process.env) {
|
|
|
179806
179892
|
if (customConfigDir) {
|
|
179807
179893
|
return resolveConfigPath2(customConfigDir);
|
|
179808
179894
|
}
|
|
179809
|
-
const xdgConfigDir = env2["XDG_CONFIG_HOME"]?.trim() ||
|
|
179810
|
-
return resolveConfigPath2(
|
|
179895
|
+
const xdgConfigDir = env2["XDG_CONFIG_HOME"]?.trim() || join50(homedir20(), ".config");
|
|
179896
|
+
return resolveConfigPath2(join50(xdgConfigDir, "opencode"));
|
|
179811
179897
|
}
|
|
179812
179898
|
|
|
179813
179899
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
179814
|
-
import { chmodSync as chmodSync5, existsSync as
|
|
179815
|
-
import { join as
|
|
179900
|
+
import { chmodSync as chmodSync5, existsSync as existsSync56, readFileSync as readFileSync43, renameSync as renameSync6, writeFileSync as writeFileSync13 } from "fs";
|
|
179901
|
+
import { join as join51 } from "path";
|
|
179816
179902
|
var INDEX_FILE_NAME = "index.json";
|
|
179817
179903
|
function isTokenIndex(value) {
|
|
179818
179904
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -179820,11 +179906,11 @@ function isTokenIndex(value) {
|
|
|
179820
179906
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
179821
179907
|
}
|
|
179822
179908
|
function getIndexPath(storageDir) {
|
|
179823
|
-
return
|
|
179909
|
+
return join51(storageDir, INDEX_FILE_NAME);
|
|
179824
179910
|
}
|
|
179825
179911
|
function readTokenIndex(storageDir) {
|
|
179826
179912
|
const indexPath = getIndexPath(storageDir);
|
|
179827
|
-
if (!
|
|
179913
|
+
if (!existsSync56(indexPath))
|
|
179828
179914
|
return {};
|
|
179829
179915
|
try {
|
|
179830
179916
|
const parsed = JSON.parse(readFileSync43(indexPath, "utf-8"));
|
|
@@ -179864,16 +179950,16 @@ function deleteTokenIndexEntry(storageDir, hash2) {
|
|
|
179864
179950
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
179865
179951
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
179866
179952
|
function getMcpOauthStorageDir() {
|
|
179867
|
-
return
|
|
179953
|
+
return join52(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
179868
179954
|
}
|
|
179869
179955
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
179870
179956
|
return createHash3("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
179871
179957
|
}
|
|
179872
179958
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
179873
|
-
return
|
|
179959
|
+
return join52(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
179874
179960
|
}
|
|
179875
179961
|
function getLegacyStoragePath() {
|
|
179876
|
-
return
|
|
179962
|
+
return join52(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
179877
179963
|
}
|
|
179878
179964
|
function normalizeHost2(serverHost) {
|
|
179879
179965
|
let host = serverHost.trim();
|
|
@@ -179934,7 +180020,7 @@ function isOAuthTokenData(value) {
|
|
|
179934
180020
|
return clientSecret === undefined || typeof clientSecret === "string";
|
|
179935
180021
|
}
|
|
179936
180022
|
function readTokenFile(filePath) {
|
|
179937
|
-
if (!
|
|
180023
|
+
if (!existsSync57(filePath))
|
|
179938
180024
|
return null;
|
|
179939
180025
|
try {
|
|
179940
180026
|
const parsed = JSON.parse(readFileSync44(filePath, "utf-8"));
|
|
@@ -179947,7 +180033,7 @@ function readTokenFile(filePath) {
|
|
|
179947
180033
|
}
|
|
179948
180034
|
function readLegacyStore() {
|
|
179949
180035
|
const filePath = getLegacyStoragePath();
|
|
179950
|
-
if (!
|
|
180036
|
+
if (!existsSync57(filePath))
|
|
179951
180037
|
return null;
|
|
179952
180038
|
try {
|
|
179953
180039
|
const parsed = JSON.parse(readFileSync44(filePath, "utf-8"));
|
|
@@ -179968,8 +180054,8 @@ function readLegacyStore() {
|
|
|
179968
180054
|
function writeTokenFile(filePath, token) {
|
|
179969
180055
|
try {
|
|
179970
180056
|
const dir = dirname21(filePath);
|
|
179971
|
-
if (!
|
|
179972
|
-
|
|
180057
|
+
if (!existsSync57(dir)) {
|
|
180058
|
+
mkdirSync16(dir, { recursive: true });
|
|
179973
180059
|
}
|
|
179974
180060
|
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
179975
180061
|
writeFileSync14(tempPath, JSON.stringify(token, null, 2), { encoding: "utf-8", mode: 384 });
|
|
@@ -179992,7 +180078,7 @@ function saveToken(serverHost, resource, token) {
|
|
|
179992
180078
|
}
|
|
179993
180079
|
function deleteToken(serverHost, resource) {
|
|
179994
180080
|
const filePath = getMcpOauthStoragePath(serverHost, resource);
|
|
179995
|
-
if (!
|
|
180081
|
+
if (!existsSync57(filePath))
|
|
179996
180082
|
return deleteLegacyToken(serverHost, resource);
|
|
179997
180083
|
try {
|
|
179998
180084
|
unlinkSync8(filePath);
|
|
@@ -180014,7 +180100,7 @@ function deleteLegacyToken(serverHost, resource) {
|
|
|
180014
180100
|
if (Object.keys(store2).length === 0) {
|
|
180015
180101
|
try {
|
|
180016
180102
|
const filePath = getLegacyStoragePath();
|
|
180017
|
-
if (
|
|
180103
|
+
if (existsSync57(filePath))
|
|
180018
180104
|
unlinkSync8(filePath);
|
|
180019
180105
|
return true;
|
|
180020
180106
|
} catch (deleteError) {
|
|
@@ -180052,7 +180138,7 @@ function listTokensByHost(serverHost) {
|
|
|
180052
180138
|
for (const [hash2, indexedKey] of Object.entries(index)) {
|
|
180053
180139
|
if (!indexedKey.startsWith(prefix))
|
|
180054
180140
|
continue;
|
|
180055
|
-
const indexedToken = readTokenFile(
|
|
180141
|
+
const indexedToken = readTokenFile(join52(getMcpOauthStorageDir(), `${hash2}.json`));
|
|
180056
180142
|
if (indexedToken)
|
|
180057
180143
|
result[indexedKey] = indexedToken;
|
|
180058
180144
|
}
|
|
@@ -180061,13 +180147,13 @@ function listTokensByHost(serverHost) {
|
|
|
180061
180147
|
function listAllTokens() {
|
|
180062
180148
|
const result = { ...readLegacyStore() ?? {} };
|
|
180063
180149
|
const dir = getMcpOauthStorageDir();
|
|
180064
|
-
if (!
|
|
180150
|
+
if (!existsSync57(dir))
|
|
180065
180151
|
return result;
|
|
180066
180152
|
const index = readTokenIndex(dir);
|
|
180067
180153
|
for (const entry of readdirSync8(dir, { withFileTypes: true })) {
|
|
180068
180154
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
180069
180155
|
continue;
|
|
180070
|
-
const token = readTokenFile(
|
|
180156
|
+
const token = readTokenFile(join52(dir, entry.name));
|
|
180071
180157
|
const hash2 = basename8(entry.name, ".json");
|
|
180072
180158
|
if (token)
|
|
180073
180159
|
result[index[hash2] ?? hash2] = token;
|
|
@@ -180763,8 +180849,8 @@ function createEmbeddingPort() {
|
|
|
180763
180849
|
// packages/learning-loop/src/codebase-scanner.ts
|
|
180764
180850
|
var import_picomatch = __toESM(require_picomatch2(), 1);
|
|
180765
180851
|
import { createHash as createHash5 } from "crypto";
|
|
180766
|
-
import { readdirSync as readdirSync9, readFileSync as readFileSync46, statSync as statSync7, existsSync as
|
|
180767
|
-
import { join as
|
|
180852
|
+
import { readdirSync as readdirSync9, readFileSync as readFileSync46, statSync as statSync7, existsSync as existsSync59 } from "fs";
|
|
180853
|
+
import { join as join53, relative as relative6, extname as extname3 } from "path";
|
|
180768
180854
|
var EXT_TO_LANG = {
|
|
180769
180855
|
ts: "typescript",
|
|
180770
180856
|
tsx: "typescript",
|
|
@@ -180818,7 +180904,7 @@ function detectLanguage(filePath) {
|
|
|
180818
180904
|
return EXT_TO_LANG[ext] ?? "text";
|
|
180819
180905
|
}
|
|
180820
180906
|
function loadGitignore(rootDir, fs18) {
|
|
180821
|
-
const gitignorePath =
|
|
180907
|
+
const gitignorePath = join53(rootDir, ".gitignore");
|
|
180822
180908
|
if (!fs18.exists(gitignorePath))
|
|
180823
180909
|
return [];
|
|
180824
180910
|
const content = fs18.readFile(gitignorePath);
|
|
@@ -180838,7 +180924,7 @@ function defaultFs() {
|
|
|
180838
180924
|
return { size: s.size, mtimeMs: s.mtimeMs, isDirectory: () => s.isDirectory(), isFile: () => s.isFile() };
|
|
180839
180925
|
},
|
|
180840
180926
|
exists(path18) {
|
|
180841
|
-
return
|
|
180927
|
+
return existsSync59(path18);
|
|
180842
180928
|
}
|
|
180843
180929
|
};
|
|
180844
180930
|
}
|
|
@@ -180909,7 +180995,7 @@ function createCodebaseScanner(options = {}) {
|
|
|
180909
180995
|
return;
|
|
180910
180996
|
}
|
|
180911
180997
|
for (const entry of entries) {
|
|
180912
|
-
const fullPath =
|
|
180998
|
+
const fullPath = join53(dir, entry);
|
|
180913
180999
|
let stat;
|
|
180914
181000
|
try {
|
|
180915
181001
|
stat = fs18.stat(fullPath);
|
|
@@ -181184,14 +181270,14 @@ function formatSearchResults(result) {
|
|
|
181184
181270
|
}
|
|
181185
181271
|
|
|
181186
181272
|
// packages/learning-loop/src/improvement.ts
|
|
181187
|
-
import { existsSync as
|
|
181188
|
-
import { join as
|
|
181273
|
+
import { existsSync as existsSync60, mkdirSync as mkdirSync18, readFileSync as readFileSync47, writeFileSync as writeFileSync16 } from "fs";
|
|
181274
|
+
import { join as join54, basename as basename10 } from "path";
|
|
181189
181275
|
function createImprovementStore(improvementsDir) {
|
|
181190
|
-
if (!
|
|
181191
|
-
|
|
181276
|
+
if (!existsSync60(improvementsDir)) {
|
|
181277
|
+
mkdirSync18(improvementsDir, { recursive: true });
|
|
181192
181278
|
}
|
|
181193
181279
|
function save(improvement) {
|
|
181194
|
-
const filePath =
|
|
181280
|
+
const filePath = join54(improvementsDir, `${improvement.id}.json`);
|
|
181195
181281
|
writeFileSync16(filePath, JSON.stringify(improvement, null, 2), "utf-8");
|
|
181196
181282
|
}
|
|
181197
181283
|
function list() {
|
|
@@ -181209,7 +181295,7 @@ function createImprovementStore(improvementsDir) {
|
|
|
181209
181295
|
return files.map((f2) => get(basename10(f2, ".json"))).filter((i3) => i3 !== null);
|
|
181210
181296
|
}
|
|
181211
181297
|
function get(id) {
|
|
181212
|
-
const filePath =
|
|
181298
|
+
const filePath = join54(improvementsDir, `${id}.json`);
|
|
181213
181299
|
try {
|
|
181214
181300
|
const raw = readFileSync47(filePath, "utf-8");
|
|
181215
181301
|
return JSON.parse(raw);
|
|
@@ -181282,7 +181368,7 @@ async function applyLearningsCli(options = {}) {
|
|
|
181282
181368
|
}
|
|
181283
181369
|
|
|
181284
181370
|
// packages/omo-opencode/src/cli/boulder/boulder.ts
|
|
181285
|
-
import { existsSync as
|
|
181371
|
+
import { existsSync as existsSync62 } from "fs";
|
|
181286
181372
|
|
|
181287
181373
|
// packages/omo-opencode/src/cli/boulder/formatter.ts
|
|
181288
181374
|
var import_picocolors22 = __toESM(require_picocolors(), 1);
|
|
@@ -181419,10 +181505,10 @@ async function boulder(options) {
|
|
|
181419
181505
|
const boulderFilePath = getBoulderFilePath(directory);
|
|
181420
181506
|
const state2 = readBoulderState(directory);
|
|
181421
181507
|
if (!state2) {
|
|
181422
|
-
const message =
|
|
181508
|
+
const message = existsSync62(boulderFilePath) ? formatReadErrorMessage(options.json) : formatNoBoulderMessage(options.json);
|
|
181423
181509
|
process.stderr.write(`${message}
|
|
181424
181510
|
`);
|
|
181425
|
-
return
|
|
181511
|
+
return existsSync62(boulderFilePath) ? 2 : 1;
|
|
181426
181512
|
}
|
|
181427
181513
|
const works = getBoulderWorks(state2);
|
|
181428
181514
|
const filteredWorks = options.workId ? works.filter((work) => work.work_id === options.workId) : works;
|
|
@@ -182017,25 +182103,25 @@ async function refreshModelCapabilities(options, deps = {}) {
|
|
|
182017
182103
|
// packages/skills-loader-core/src/features/opencode-skill-loader/loader.ts
|
|
182018
182104
|
init_src();
|
|
182019
182105
|
init_shared_skills();
|
|
182020
|
-
import { join as
|
|
182106
|
+
import { join as join63 } from "path";
|
|
182021
182107
|
|
|
182022
182108
|
// packages/skills-loader-core/src/shared/claude-config-dir.ts
|
|
182023
182109
|
init_src();
|
|
182024
|
-
import { join as
|
|
182110
|
+
import { join as join57 } from "path";
|
|
182025
182111
|
function getClaudeConfigDir() {
|
|
182026
182112
|
const envConfigDir = process.env.CLAUDE_CONFIG_DIR;
|
|
182027
182113
|
if (envConfigDir) {
|
|
182028
182114
|
return envConfigDir;
|
|
182029
182115
|
}
|
|
182030
|
-
return
|
|
182116
|
+
return join57(getHomeDirectory(), ".claude");
|
|
182031
182117
|
}
|
|
182032
182118
|
// packages/skills-loader-core/src/shared/opencode-command-dirs.ts
|
|
182033
|
-
import { basename as basename11, dirname as dirname22, join as
|
|
182119
|
+
import { basename as basename11, dirname as dirname22, join as join59 } from "path";
|
|
182034
182120
|
|
|
182035
182121
|
// packages/skills-loader-core/src/shared/opencode-config-dir.ts
|
|
182036
|
-
import { existsSync as
|
|
182037
|
-
import { homedir as
|
|
182038
|
-
import { join as
|
|
182122
|
+
import { existsSync as existsSync64, realpathSync as realpathSync8 } from "fs";
|
|
182123
|
+
import { homedir as homedir22 } from "os";
|
|
182124
|
+
import { join as join58, posix as posix5, resolve as resolve12, win32 as win325 } from "path";
|
|
182039
182125
|
|
|
182040
182126
|
// packages/skills-loader-core/src/shared/plugin-identity.ts
|
|
182041
182127
|
init_src();
|
|
@@ -182068,15 +182154,15 @@ function getTauriConfigDir2(identifier) {
|
|
|
182068
182154
|
const platform2 = process.platform;
|
|
182069
182155
|
switch (platform2) {
|
|
182070
182156
|
case "darwin":
|
|
182071
|
-
return
|
|
182157
|
+
return join58(homedir22(), "Library", "Application Support", identifier);
|
|
182072
182158
|
case "win32": {
|
|
182073
|
-
const appData = process.env.APPDATA ||
|
|
182159
|
+
const appData = process.env.APPDATA || join58(homedir22(), "AppData", "Roaming");
|
|
182074
182160
|
return win325.join(appData, identifier);
|
|
182075
182161
|
}
|
|
182076
182162
|
case "linux":
|
|
182077
182163
|
default: {
|
|
182078
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME ||
|
|
182079
|
-
return
|
|
182164
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join58(homedir22(), ".config");
|
|
182165
|
+
return join58(xdgConfig, identifier);
|
|
182080
182166
|
}
|
|
182081
182167
|
}
|
|
182082
182168
|
}
|
|
@@ -182085,7 +182171,7 @@ function resolveConfigPath3(pathValue) {
|
|
|
182085
182171
|
return posix5.normalize(pathValue);
|
|
182086
182172
|
}
|
|
182087
182173
|
const resolvedPath = resolve12(pathValue);
|
|
182088
|
-
if (!
|
|
182174
|
+
if (!existsSync64(resolvedPath))
|
|
182089
182175
|
return resolvedPath;
|
|
182090
182176
|
try {
|
|
182091
182177
|
return realpathSync8(resolvedPath);
|
|
@@ -182119,8 +182205,8 @@ function getWslLinuxHomeDir2(windowsConfigRoot) {
|
|
|
182119
182205
|
function getCliDefaultConfigDir2() {
|
|
182120
182206
|
const envXdgConfig = process.env.XDG_CONFIG_HOME?.trim();
|
|
182121
182207
|
const shouldIgnoreWindowsXdg = envXdgConfig !== undefined && envXdgConfig.length > 0 && isWslEnvironment2() && isWindowsUserConfigRoot2(envXdgConfig);
|
|
182122
|
-
const xdgConfig = shouldIgnoreWindowsXdg ? posix5.join(getWslLinuxHomeDir2(envXdgConfig) ?? "/home", ".config") : envXdgConfig ||
|
|
182123
|
-
const configDir = isWslEnvironment2() ? posix5.join(xdgConfig, "opencode") :
|
|
182208
|
+
const xdgConfig = shouldIgnoreWindowsXdg ? posix5.join(getWslLinuxHomeDir2(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join58(homedir22(), ".config");
|
|
182209
|
+
const configDir = isWslEnvironment2() ? posix5.join(xdgConfig, "opencode") : join58(xdgConfig, "opencode");
|
|
182124
182210
|
return resolveConfigPath3(configDir);
|
|
182125
182211
|
}
|
|
182126
182212
|
function getCliCustomConfigDir2() {
|
|
@@ -182153,9 +182239,9 @@ function getOpenCodeConfigDir2(options) {
|
|
|
182153
182239
|
const tauriDir = process.platform === "win32" ? win325.isAbsolute(tauriDirBase) ? win325.normalize(tauriDirBase) : win325.resolve(tauriDirBase) : resolveConfigPath3(tauriDirBase);
|
|
182154
182240
|
if (checkExisting) {
|
|
182155
182241
|
const legacyDir = getCliConfigDir2();
|
|
182156
|
-
const legacyConfig =
|
|
182157
|
-
const legacyConfigC =
|
|
182158
|
-
if (
|
|
182242
|
+
const legacyConfig = join58(legacyDir, "opencode.json");
|
|
182243
|
+
const legacyConfigC = join58(legacyDir, "opencode.jsonc");
|
|
182244
|
+
if (existsSync64(legacyConfig) || existsSync64(legacyConfigC)) {
|
|
182159
182245
|
return legacyDir;
|
|
182160
182246
|
}
|
|
182161
182247
|
}
|
|
@@ -182176,21 +182262,21 @@ function getOpenCodeSkillDirs(options) {
|
|
|
182176
182262
|
...configDirs.flatMap((configDir) => {
|
|
182177
182263
|
const parentConfigDir = getParentOpencodeConfigDir(configDir);
|
|
182178
182264
|
return [
|
|
182179
|
-
|
|
182180
|
-
|
|
182181
|
-
...parentConfigDir ? [
|
|
182265
|
+
join59(configDir, "skills"),
|
|
182266
|
+
join59(configDir, "skill"),
|
|
182267
|
+
...parentConfigDir ? [join59(parentConfigDir, "skills"), join59(parentConfigDir, "skill")] : []
|
|
182182
182268
|
];
|
|
182183
182269
|
})
|
|
182184
182270
|
]));
|
|
182185
182271
|
}
|
|
182186
182272
|
// packages/skills-loader-core/src/shared/project-discovery-dirs.ts
|
|
182187
182273
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
182188
|
-
import { existsSync as
|
|
182189
|
-
import { dirname as dirname23, join as
|
|
182274
|
+
import { existsSync as existsSync65, realpathSync as realpathSync9 } from "fs";
|
|
182275
|
+
import { dirname as dirname23, join as join60, resolve as resolve13, win32 as win326 } from "path";
|
|
182190
182276
|
var worktreePathCache2 = new Map;
|
|
182191
182277
|
function normalizePath2(path18) {
|
|
182192
182278
|
const resolvedPath = process.platform !== "win32" && win326.isAbsolute(path18) ? path18 : resolve13(path18);
|
|
182193
|
-
if (!
|
|
182279
|
+
if (!existsSync65(resolvedPath)) {
|
|
182194
182280
|
return resolvedPath;
|
|
182195
182281
|
}
|
|
182196
182282
|
try {
|
|
@@ -182221,8 +182307,8 @@ function findAncestorDirectories(startDirectory, targetPaths, stopDirectory) {
|
|
|
182221
182307
|
const stopDirectoryKey = resolvedStopDirectory ? pathKey2(resolvedStopDirectory) : undefined;
|
|
182222
182308
|
while (true) {
|
|
182223
182309
|
for (const targetPath of targetPaths) {
|
|
182224
|
-
const candidateDirectory =
|
|
182225
|
-
if (!
|
|
182310
|
+
const candidateDirectory = join60(currentDirectory, ...targetPath);
|
|
182311
|
+
if (!existsSync65(candidateDirectory)) {
|
|
182226
182312
|
continue;
|
|
182227
182313
|
}
|
|
182228
182314
|
const normalizedCandidateDirectory = normalizePath2(candidateDirectory);
|
|
@@ -182304,7 +182390,7 @@ function deduplicateSkillsByName(skills2) {
|
|
|
182304
182390
|
// packages/skills-loader-core/src/features/opencode-skill-loader/skill-directory-loader.ts
|
|
182305
182391
|
init_src();
|
|
182306
182392
|
import * as fs20 from "fs/promises";
|
|
182307
|
-
import { join as
|
|
182393
|
+
import { join as join62 } from "path";
|
|
182308
182394
|
|
|
182309
182395
|
// packages/skills-loader-core/src/features/opencode-skill-loader/loaded-skill-from-path.ts
|
|
182310
182396
|
init_src();
|
|
@@ -182325,7 +182411,7 @@ function parseAllowedTools(allowedTools) {
|
|
|
182325
182411
|
// packages/skills-loader-core/src/features/opencode-skill-loader/skill-mcp-config.ts
|
|
182326
182412
|
init_js_yaml();
|
|
182327
182413
|
import * as fs18 from "fs/promises";
|
|
182328
|
-
import { join as
|
|
182414
|
+
import { join as join61 } from "path";
|
|
182329
182415
|
function parseSkillMcpConfigFromFrontmatter(content) {
|
|
182330
182416
|
const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
182331
182417
|
if (!frontmatterMatch)
|
|
@@ -182344,7 +182430,7 @@ function parseSkillMcpConfigFromFrontmatter(content) {
|
|
|
182344
182430
|
return;
|
|
182345
182431
|
}
|
|
182346
182432
|
async function loadMcpJsonFromDir(skillDir) {
|
|
182347
|
-
const mcpJsonPath =
|
|
182433
|
+
const mcpJsonPath = join61(skillDir, "mcp.json");
|
|
182348
182434
|
try {
|
|
182349
182435
|
const content = await fs18.readFile(mcpJsonPath, "utf-8");
|
|
182350
182436
|
const parsed = JSON.parse(content);
|
|
@@ -182460,10 +182546,10 @@ async function loadSkillsFromDir(options) {
|
|
|
182460
182546
|
const directories = entries.filter((entry) => !entry.name.startsWith(".") && (entry.isDirectory() || entry.isSymbolicLink()));
|
|
182461
182547
|
const files = entries.filter((entry) => !entry.name.startsWith(".") && !entry.isDirectory() && !entry.isSymbolicLink() && isMarkdownFile(entry));
|
|
182462
182548
|
for (const entry of directories) {
|
|
182463
|
-
const entryPath =
|
|
182549
|
+
const entryPath = join62(options.skillsDir, entry.name);
|
|
182464
182550
|
const resolvedPath = await resolveSymlinkAsync(entryPath);
|
|
182465
182551
|
const dirName = entry.name;
|
|
182466
|
-
const skillMdPath =
|
|
182552
|
+
const skillMdPath = join62(resolvedPath, "SKILL.md");
|
|
182467
182553
|
if (await canAccessFile(skillMdPath)) {
|
|
182468
182554
|
const skill = await loadSkillFromPath({
|
|
182469
182555
|
skillPath: skillMdPath,
|
|
@@ -182477,7 +182563,7 @@ async function loadSkillsFromDir(options) {
|
|
|
182477
182563
|
}
|
|
182478
182564
|
continue;
|
|
182479
182565
|
}
|
|
182480
|
-
const namedSkillMdPath =
|
|
182566
|
+
const namedSkillMdPath = join62(resolvedPath, `${dirName}.md`);
|
|
182481
182567
|
if (await canAccessFile(namedSkillMdPath)) {
|
|
182482
182568
|
const skill = await loadSkillFromPath({
|
|
182483
182569
|
skillPath: namedSkillMdPath,
|
|
@@ -182508,7 +182594,7 @@ async function loadSkillsFromDir(options) {
|
|
|
182508
182594
|
}
|
|
182509
182595
|
}
|
|
182510
182596
|
for (const entry of files) {
|
|
182511
|
-
const entryPath =
|
|
182597
|
+
const entryPath = join62(options.skillsDir, entry.name);
|
|
182512
182598
|
const baseName = inferSkillNameFromFileName(entryPath);
|
|
182513
182599
|
const skill = await loadSkillFromPath({
|
|
182514
182600
|
skillPath: entryPath,
|
|
@@ -182560,7 +182646,7 @@ async function discoverAllSkills(directory) {
|
|
|
182560
182646
|
]);
|
|
182561
182647
|
}
|
|
182562
182648
|
async function discoverUserClaudeSkills() {
|
|
182563
|
-
const userSkillsDir =
|
|
182649
|
+
const userSkillsDir = join63(getClaudeConfigDir(), "skills");
|
|
182564
182650
|
return loadSkillsFromDir({ skillsDir: userSkillsDir, scope: "user" });
|
|
182565
182651
|
}
|
|
182566
182652
|
async function discoverProjectClaudeSkills(directory) {
|
|
@@ -182587,7 +182673,7 @@ async function discoverProjectAgentsSkills(directory) {
|
|
|
182587
182673
|
return deduplicateSkillsByName(allSkills.flat());
|
|
182588
182674
|
}
|
|
182589
182675
|
async function discoverGlobalAgentsSkills(homeDirectory = getHomeDirectory()) {
|
|
182590
|
-
const agentsGlobalDir =
|
|
182676
|
+
const agentsGlobalDir = join63(homeDirectory, ".agents", "skills");
|
|
182591
182677
|
return loadSkillsFromDir({ skillsDir: agentsGlobalDir, scope: "user" });
|
|
182592
182678
|
}
|
|
182593
182679
|
// packages/skills-loader-core/src/features/opencode-skill-loader/merger/builtin-skill-converter.ts
|
|
@@ -183339,7 +183425,7 @@ playwright-cli close
|
|
|
183339
183425
|
init_shared_skills();
|
|
183340
183426
|
init_src();
|
|
183341
183427
|
import { readFileSync as readFileSync50 } from "fs";
|
|
183342
|
-
import { join as
|
|
183428
|
+
import { join as join64 } from "path";
|
|
183343
183429
|
function createSharedSkillTemplateLoader(readFile3 = readFileSync50, skillsRootPath = sharedSkillsRootPath()) {
|
|
183344
183430
|
const cache = new Map;
|
|
183345
183431
|
return (skillName) => {
|
|
@@ -183347,7 +183433,7 @@ function createSharedSkillTemplateLoader(readFile3 = readFileSync50, skillsRootP
|
|
|
183347
183433
|
if (cached2 !== undefined)
|
|
183348
183434
|
return cached2;
|
|
183349
183435
|
try {
|
|
183350
|
-
const { body } = parseFrontmatter(readFile3(
|
|
183436
|
+
const { body } = parseFrontmatter(readFile3(join64(skillsRootPath, skillName, "SKILL.md"), "utf8"));
|
|
183351
183437
|
cache.set(skillName, body);
|
|
183352
183438
|
return body;
|
|
183353
183439
|
} catch (error51) {
|
|
@@ -184484,7 +184570,7 @@ var gitMasterSkill = {
|
|
|
184484
184570
|
template: GIT_MASTER_TEMPLATE
|
|
184485
184571
|
};
|
|
184486
184572
|
// packages/skills-loader-core/src/features/builtin-skills/skills/dev-browser.ts
|
|
184487
|
-
import { dirname as dirname24, join as
|
|
184573
|
+
import { dirname as dirname24, join as join65 } from "path";
|
|
184488
184574
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
184489
184575
|
var CURRENT_DIR = dirname24(fileURLToPath8(import.meta.url));
|
|
184490
184576
|
var devBrowserSkill = {
|
|
@@ -184704,7 +184790,7 @@ console.log({
|
|
|
184704
184790
|
await client.disconnect();
|
|
184705
184791
|
EOF
|
|
184706
184792
|
\`\`\``,
|
|
184707
|
-
resolvedPath:
|
|
184793
|
+
resolvedPath: join65(CURRENT_DIR, "..", "dev-browser")
|
|
184708
184794
|
};
|
|
184709
184795
|
// packages/skills-loader-core/src/features/builtin-skills/skills/review-work.ts
|
|
184710
184796
|
var reviewWorkSkill = {
|
|
@@ -185697,9 +185783,9 @@ function applySnapshotRetention(options) {
|
|
|
185697
185783
|
// packages/omo-opencode/src/cli/snapshot/snapshot.ts
|
|
185698
185784
|
import { Database as Database3 } from "bun:sqlite";
|
|
185699
185785
|
import {
|
|
185700
|
-
existsSync as
|
|
185701
|
-
mkdirSync as
|
|
185702
|
-
copyFileSync as
|
|
185786
|
+
existsSync as existsSync67,
|
|
185787
|
+
mkdirSync as mkdirSync21,
|
|
185788
|
+
copyFileSync as copyFileSync4,
|
|
185703
185789
|
readFileSync as readFileSync51,
|
|
185704
185790
|
writeFileSync as writeFileSync19,
|
|
185705
185791
|
readdirSync as readdirSync10,
|
|
@@ -185713,13 +185799,13 @@ async function snapshotCli(options = {}) {
|
|
|
185713
185799
|
const homeDir = os7.homedir();
|
|
185714
185800
|
const snapshotDir = options.snapshotDir ?? path18.join(homeDir, ".matrixos", "snapshots");
|
|
185715
185801
|
const allPaths = getAllSnapshotPaths(homeDir);
|
|
185716
|
-
const files = allPaths.files.filter((f2) =>
|
|
185802
|
+
const files = allPaths.files.filter((f2) => existsSync67(f2.sourcePath));
|
|
185717
185803
|
const realFs = {
|
|
185718
|
-
existsSync:
|
|
185719
|
-
mkdirSync:
|
|
185804
|
+
existsSync: existsSync67,
|
|
185805
|
+
mkdirSync: mkdirSync21,
|
|
185720
185806
|
readFileSync: readFileSync51,
|
|
185721
185807
|
writeFileSync: writeFileSync19,
|
|
185722
|
-
copyFileSync:
|
|
185808
|
+
copyFileSync: copyFileSync4,
|
|
185723
185809
|
readdirSync: readdirSync10,
|
|
185724
185810
|
statSync: statSync8,
|
|
185725
185811
|
rmSync: rmSync4
|
|
@@ -185780,9 +185866,9 @@ async function snapshotCli(options = {}) {
|
|
|
185780
185866
|
|
|
185781
185867
|
// packages/omo-opencode/src/cli/snapshot/restore.ts
|
|
185782
185868
|
import {
|
|
185783
|
-
existsSync as
|
|
185784
|
-
mkdirSync as
|
|
185785
|
-
copyFileSync as
|
|
185869
|
+
existsSync as existsSync68,
|
|
185870
|
+
mkdirSync as mkdirSync22,
|
|
185871
|
+
copyFileSync as copyFileSync5,
|
|
185786
185872
|
readFileSync as readFileSync52,
|
|
185787
185873
|
writeFileSync as writeFileSync20,
|
|
185788
185874
|
readdirSync as readdirSync11,
|
|
@@ -185794,11 +185880,11 @@ import * as os8 from "os";
|
|
|
185794
185880
|
async function restoreCli(options) {
|
|
185795
185881
|
const snapshotDir = options.snapshotDir ?? path19.join(os8.homedir(), ".matrixos", "snapshots");
|
|
185796
185882
|
const realFs = {
|
|
185797
|
-
existsSync:
|
|
185798
|
-
mkdirSync:
|
|
185883
|
+
existsSync: existsSync68,
|
|
185884
|
+
mkdirSync: mkdirSync22,
|
|
185799
185885
|
readFileSync: readFileSync52,
|
|
185800
185886
|
writeFileSync: writeFileSync20,
|
|
185801
|
-
copyFileSync:
|
|
185887
|
+
copyFileSync: copyFileSync5,
|
|
185802
185888
|
readdirSync: readdirSync11,
|
|
185803
185889
|
statSync: statSync9,
|
|
185804
185890
|
rmSync: rmSync5
|
|
@@ -185832,9 +185918,9 @@ async function restoreCli(options) {
|
|
|
185832
185918
|
|
|
185833
185919
|
// packages/omo-opencode/src/cli/snapshot/list.ts
|
|
185834
185920
|
import {
|
|
185835
|
-
existsSync as
|
|
185836
|
-
mkdirSync as
|
|
185837
|
-
copyFileSync as
|
|
185921
|
+
existsSync as existsSync69,
|
|
185922
|
+
mkdirSync as mkdirSync23,
|
|
185923
|
+
copyFileSync as copyFileSync6,
|
|
185838
185924
|
readFileSync as readFileSync53,
|
|
185839
185925
|
writeFileSync as writeFileSync21,
|
|
185840
185926
|
readdirSync as readdirSync12,
|
|
@@ -185856,11 +185942,11 @@ function formatBytes(bytes) {
|
|
|
185856
185942
|
async function snapshotListCli(options) {
|
|
185857
185943
|
const snapshotDir = options.snapshotDir ?? path20.join(os9.homedir(), ".matrixos", "snapshots");
|
|
185858
185944
|
const realFs = {
|
|
185859
|
-
existsSync:
|
|
185860
|
-
mkdirSync:
|
|
185945
|
+
existsSync: existsSync69,
|
|
185946
|
+
mkdirSync: mkdirSync23,
|
|
185861
185947
|
readFileSync: readFileSync53,
|
|
185862
185948
|
writeFileSync: writeFileSync21,
|
|
185863
|
-
copyFileSync:
|
|
185949
|
+
copyFileSync: copyFileSync6,
|
|
185864
185950
|
readdirSync: readdirSync12,
|
|
185865
185951
|
statSync: statSync10,
|
|
185866
185952
|
rmSync: rmSync6
|
|
@@ -185886,9 +185972,9 @@ async function snapshotListCli(options) {
|
|
|
185886
185972
|
|
|
185887
185973
|
// packages/omo-opencode/src/cli/snapshot/prune.ts
|
|
185888
185974
|
import {
|
|
185889
|
-
existsSync as
|
|
185890
|
-
mkdirSync as
|
|
185891
|
-
copyFileSync as
|
|
185975
|
+
existsSync as existsSync70,
|
|
185976
|
+
mkdirSync as mkdirSync24,
|
|
185977
|
+
copyFileSync as copyFileSync7,
|
|
185892
185978
|
readFileSync as readFileSync54,
|
|
185893
185979
|
writeFileSync as writeFileSync22,
|
|
185894
185980
|
readdirSync as readdirSync13,
|
|
@@ -185900,11 +185986,11 @@ import * as os10 from "os";
|
|
|
185900
185986
|
async function snapshotPruneCli(options = {}) {
|
|
185901
185987
|
const snapshotDir = options.snapshotDir ?? path21.join(os10.homedir(), ".matrixos", "snapshots");
|
|
185902
185988
|
const realFs = {
|
|
185903
|
-
existsSync:
|
|
185904
|
-
mkdirSync:
|
|
185989
|
+
existsSync: existsSync70,
|
|
185990
|
+
mkdirSync: mkdirSync24,
|
|
185905
185991
|
readFileSync: readFileSync54,
|
|
185906
185992
|
writeFileSync: writeFileSync22,
|
|
185907
|
-
copyFileSync:
|
|
185993
|
+
copyFileSync: copyFileSync7,
|
|
185908
185994
|
readdirSync: readdirSync13,
|
|
185909
185995
|
statSync: statSync11,
|
|
185910
185996
|
rmSync: rmSync7
|
|
@@ -185950,8 +186036,8 @@ function codebaseCli(rootProgram) {
|
|
|
185950
186036
|
try {
|
|
185951
186037
|
const dimension = Number.parseInt(options.dimension, 10) || 384;
|
|
185952
186038
|
const dbDir = path22.dirname(options.db);
|
|
185953
|
-
const { mkdirSync:
|
|
185954
|
-
|
|
186039
|
+
const { mkdirSync: mkdirSync25 } = await import("fs");
|
|
186040
|
+
mkdirSync25(dbDir, { recursive: true });
|
|
185955
186041
|
const store4 = createSqliteVectorStore({ path: options.db, dimension });
|
|
185956
186042
|
if (options.reset) {
|
|
185957
186043
|
store4.clear();
|
|
@@ -187168,7 +187254,7 @@ function loadGatewayPassphrase() {
|
|
|
187168
187254
|
}
|
|
187169
187255
|
async function dashboardCli(options) {
|
|
187170
187256
|
const port3 = options.port ?? 9123;
|
|
187171
|
-
const host = options.host ?? "
|
|
187257
|
+
const host = options.host ?? "0.0.0.0";
|
|
187172
187258
|
const frontendDir = path25.resolve(import.meta.dir, "../features/dashboard/frontend");
|
|
187173
187259
|
const gatewayPassphrase = loadGatewayPassphrase();
|
|
187174
187260
|
console.log(`[dashboard] starting MaTrixOS dashboard on http://${host}:${port3}`);
|
|
@@ -187202,11 +187288,11 @@ async function dashboardCli(options) {
|
|
|
187202
187288
|
}
|
|
187203
187289
|
|
|
187204
187290
|
// packages/omo-opencode/src/cli/architect.ts
|
|
187205
|
-
import { join as
|
|
187291
|
+
import { join as join75 } from "path";
|
|
187206
187292
|
var IMPROVEMENTS_DIR = ".matrixos/improvements";
|
|
187207
187293
|
function getStore(directory) {
|
|
187208
187294
|
const baseDir = directory ?? process.cwd();
|
|
187209
|
-
return createImprovementStore(
|
|
187295
|
+
return createImprovementStore(join75(baseDir, IMPROVEMENTS_DIR));
|
|
187210
187296
|
}
|
|
187211
187297
|
async function architectReview(options) {
|
|
187212
187298
|
const store4 = getStore(options.directory);
|