@kl-c/matrixos 0.2.7 → 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/.agents/command/matrix.md +31 -0
- package/dist/cli/index.js +445 -324
- package/dist/cli/slash-command-installer.d.ts +4 -0
- package/dist/cli-node/index.js +445 -324
- package/dist/gateway/gateway-handler.d.ts +4 -0
- package/dist/index.js +74 -52
- package/dist/plugin/auto-adoption.d.ts +5 -3
- package/package.json +25 -25
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
|
}
|
|
@@ -165939,8 +166025,42 @@ import { spawn as spawn5 } from "child_process";
|
|
|
165939
166025
|
function maskSecrets(s) {
|
|
165940
166026
|
return s.replace(/[0-9]{6,}:[A-Za-z0-9_-]{30,}/g, "<telegram-token>").replace(/Bearer\s+[A-Za-z0-9_.-]{20,}/gi, "Bearer <redacted>").replace(/sk-[A-Za-z0-9]{20,}/g, "sk-<redacted>");
|
|
165941
166027
|
}
|
|
166028
|
+
function isReadoptCommand(env5) {
|
|
166029
|
+
const t2 = env5.content.text?.trim() ?? "";
|
|
166030
|
+
return t2 === READOPT_COMMAND || t2.startsWith(READOPT_COMMAND + " ");
|
|
166031
|
+
}
|
|
166032
|
+
function isTelegramAdoptCommand(env5) {
|
|
166033
|
+
const t2 = env5.content.text?.trim() ?? "";
|
|
166034
|
+
return t2 === TELEGRAM_ADOPT_COMMAND || t2.startsWith(TELEGRAM_ADOPT_COMMAND + " ");
|
|
166035
|
+
}
|
|
166036
|
+
async function runCliCommand(args, replyMsg) {
|
|
166037
|
+
const started = Date.now();
|
|
166038
|
+
return new Promise((resolve19) => {
|
|
166039
|
+
let settled = false;
|
|
166040
|
+
const finish = (result) => {
|
|
166041
|
+
if (settled)
|
|
166042
|
+
return;
|
|
166043
|
+
settled = true;
|
|
166044
|
+
resolve19({ ...result, durationMs: Date.now() - started });
|
|
166045
|
+
};
|
|
166046
|
+
let child;
|
|
166047
|
+
try {
|
|
166048
|
+
child = spawn5("matrixos", args, { cwd: process.cwd(), timeout: 30000 });
|
|
166049
|
+
} catch (e) {
|
|
166050
|
+
return finish({ ok: true, reply: replyMsg, exitCode: 0 });
|
|
166051
|
+
}
|
|
166052
|
+
child.on("error", () => finish({ ok: true, reply: replyMsg, exitCode: 0 }));
|
|
166053
|
+
child.on("exit", () => finish({ ok: true, reply: replyMsg, exitCode: 0 }));
|
|
166054
|
+
});
|
|
166055
|
+
}
|
|
165942
166056
|
async function handleGatewayMessage(env5, opts = {}) {
|
|
165943
166057
|
const text = env5.content.text ?? "";
|
|
166058
|
+
if (isReadoptCommand(env5)) {
|
|
166059
|
+
return runCliCommand(["adopt"], "Re-adoption MaTrixOS lancee. Suis le wizard localement.");
|
|
166060
|
+
}
|
|
166061
|
+
if (isTelegramAdoptCommand(env5)) {
|
|
166062
|
+
return runCliCommand(["gateway", "adopt", "telegram"], "Configuration Telegram lancee. Colle ton bot token quand demande (jamais par chat).");
|
|
166063
|
+
}
|
|
165944
166064
|
const command = opts.command ?? "matrixos";
|
|
165945
166065
|
const argsTemplate = opts.args ?? ["run", text];
|
|
165946
166066
|
const args = argsTemplate.map((a2) => a2 === "{text}" ? text : a2);
|
|
@@ -166013,6 +166133,7 @@ ${maskSecrets(stderr.trim())}`,
|
|
|
166013
166133
|
});
|
|
166014
166134
|
});
|
|
166015
166135
|
}
|
|
166136
|
+
var READOPT_COMMAND = "/readopt", TELEGRAM_ADOPT_COMMAND = "/matrix-gateway-adopt-telegram";
|
|
166016
166137
|
var init_gateway_handler = () => {};
|
|
166017
166138
|
|
|
166018
166139
|
// packages/omo-opencode/src/cli/gateway-start.ts
|
|
@@ -166023,10 +166144,10 @@ __export(exports_gateway_start, {
|
|
|
166023
166144
|
buildTelegramConfig: () => buildTelegramConfig,
|
|
166024
166145
|
buildGatewayConfig: () => buildGatewayConfig
|
|
166025
166146
|
});
|
|
166026
|
-
import { readFileSync as readFileSync62, existsSync as
|
|
166147
|
+
import { readFileSync as readFileSync62, existsSync as existsSync78 } from "fs";
|
|
166027
166148
|
import { resolve as resolve19 } from "path";
|
|
166028
166149
|
function loadGatewayEnv(path29 = ENV_PATH) {
|
|
166029
|
-
if (!
|
|
166150
|
+
if (!existsSync78(path29))
|
|
166030
166151
|
return {};
|
|
166031
166152
|
const text = readFileSync62(path29, "utf8");
|
|
166032
166153
|
const out = {};
|
|
@@ -166165,7 +166286,7 @@ var init_deployment_core = __esm(() => {
|
|
|
166165
166286
|
|
|
166166
166287
|
// packages/omo-opencode/src/deployment/deploy-static.ts
|
|
166167
166288
|
import { spawn as spawn6 } from "child_process";
|
|
166168
|
-
import { existsSync as
|
|
166289
|
+
import { existsSync as existsSync79 } from "fs";
|
|
166169
166290
|
import { resolve as resolve20 } from "path";
|
|
166170
166291
|
function pushStage(stage, message, ok = true) {
|
|
166171
166292
|
return { stage, message, ok };
|
|
@@ -166222,7 +166343,7 @@ var init_deploy_static = __esm(() => {
|
|
|
166222
166343
|
}
|
|
166223
166344
|
stages.push(pushStage("build", "build succeeded"));
|
|
166224
166345
|
}
|
|
166225
|
-
if (!
|
|
166346
|
+
if (!existsSync79(buildDir)) {
|
|
166226
166347
|
stages.push(pushStage("push", `build directory not found: ${buildDir}`, false));
|
|
166227
166348
|
return { target: "static", ok: false, stages, error: "build directory missing" };
|
|
166228
166349
|
}
|
|
@@ -166498,10 +166619,10 @@ var init_deployment = __esm(() => {
|
|
|
166498
166619
|
});
|
|
166499
166620
|
|
|
166500
166621
|
// packages/omo-opencode/src/audit/self-audit.ts
|
|
166501
|
-
import { existsSync as
|
|
166502
|
-
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";
|
|
166503
166624
|
function getAuditDir(cwd = process.cwd()) {
|
|
166504
|
-
return
|
|
166625
|
+
return join84(cwd, ".matrixos", "audits");
|
|
166505
166626
|
}
|
|
166506
166627
|
function getWeekString(date5 = new Date) {
|
|
166507
166628
|
const d = new Date(Date.UTC(date5.getFullYear(), date5.getMonth(), date5.getDate()));
|
|
@@ -166608,8 +166729,8 @@ function formatAuditReport(report) {
|
|
|
166608
166729
|
}
|
|
166609
166730
|
function writeAuditReport(report, cwd) {
|
|
166610
166731
|
const dir = getAuditDir(cwd);
|
|
166611
|
-
|
|
166612
|
-
const path29 =
|
|
166732
|
+
mkdirSync30(dir, { recursive: true });
|
|
166733
|
+
const path29 = join84(dir, `${report.week}.md`);
|
|
166613
166734
|
writeFileSync29(path29, formatAuditReport(report), "utf-8");
|
|
166614
166735
|
return path29;
|
|
166615
166736
|
}
|
|
@@ -167576,7 +167697,7 @@ async function processEvents(ctx, stream, state) {
|
|
|
167576
167697
|
}
|
|
167577
167698
|
// packages/omo-opencode/src/plugin-config/layered-config-loader.ts
|
|
167578
167699
|
import * as fs7 from "fs";
|
|
167579
|
-
import { homedir as
|
|
167700
|
+
import { homedir as homedir9 } from "os";
|
|
167580
167701
|
import * as path7 from "path";
|
|
167581
167702
|
|
|
167582
167703
|
// packages/omo-opencode/src/config/schema/agent-names.ts
|
|
@@ -168560,7 +168681,7 @@ function loadConfigFromPath(configPath, _ctx) {
|
|
|
168560
168681
|
|
|
168561
168682
|
// packages/omo-opencode/src/plugin-config/layered-config-loader.ts
|
|
168562
168683
|
function resolveHomeDirectory() {
|
|
168563
|
-
return process.env.HOME ?? process.env.USERPROFILE ??
|
|
168684
|
+
return process.env.HOME ?? process.env.USERPROFILE ?? homedir9();
|
|
168564
168685
|
}
|
|
168565
168686
|
function resolveConfigPathAfterLegacyMigration(detectedPath) {
|
|
168566
168687
|
if (!path7.basename(detectedPath).startsWith(LEGACY_CONFIG_BASENAME)) {
|
|
@@ -169152,7 +169273,7 @@ var BOULDER_STATE_PATH = `${BOULDER_DIR}/${BOULDER_FILE}`;
|
|
|
169152
169273
|
var NOTEPAD_DIR = "notepads";
|
|
169153
169274
|
var NOTEPAD_BASE_PATH = `${BOULDER_DIR}/${NOTEPAD_DIR}`;
|
|
169154
169275
|
// packages/boulder-state/src/top-level-task.ts
|
|
169155
|
-
import { existsSync as
|
|
169276
|
+
import { existsSync as existsSync32, readFileSync as readFileSync18 } from "fs";
|
|
169156
169277
|
var TODO_HEADING_PATTERN = /^##\s+TODOs\b/i;
|
|
169157
169278
|
var FINAL_VERIFICATION_HEADING_PATTERN = /^##\s+Final Verification Wave\b/i;
|
|
169158
169279
|
var SECOND_LEVEL_HEADING_PATTERN = /^##\s+/;
|
|
@@ -169175,7 +169296,7 @@ function buildTaskRef(section, taskLabel) {
|
|
|
169175
169296
|
};
|
|
169176
169297
|
}
|
|
169177
169298
|
function readCurrentTopLevelTask(planPath) {
|
|
169178
|
-
if (!
|
|
169299
|
+
if (!existsSync32(planPath)) {
|
|
169179
169300
|
return null;
|
|
169180
169301
|
}
|
|
169181
169302
|
try {
|
|
@@ -169204,10 +169325,10 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
169204
169325
|
}
|
|
169205
169326
|
}
|
|
169206
169327
|
// packages/boulder-state/src/storage/path.ts
|
|
169207
|
-
import { existsSync as
|
|
169208
|
-
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";
|
|
169209
169330
|
function getBoulderFilePath(directory) {
|
|
169210
|
-
return
|
|
169331
|
+
return join30(directory, BOULDER_DIR, BOULDER_FILE);
|
|
169211
169332
|
}
|
|
169212
169333
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
169213
169334
|
return isAbsolute4(trackedPath) ? resolve8(trackedPath) : resolve8(baseDirectory, trackedPath);
|
|
@@ -169225,13 +169346,13 @@ function resolveBoulderPlanPath(directory, state) {
|
|
|
169225
169346
|
}
|
|
169226
169347
|
const absoluteWorktreePath = resolveTrackedPath(directory, worktreePath);
|
|
169227
169348
|
const worktreePlanPath = resolve8(absoluteWorktreePath, relativePlanPath);
|
|
169228
|
-
return
|
|
169349
|
+
return existsSync33(worktreePlanPath) ? worktreePlanPath : absolutePlanPath;
|
|
169229
169350
|
}
|
|
169230
169351
|
function resolveBoulderPlanPathForWork(directory, work) {
|
|
169231
169352
|
return resolveBoulderPlanPath(directory, work);
|
|
169232
169353
|
}
|
|
169233
169354
|
// packages/boulder-state/src/storage/plan-progress.ts
|
|
169234
|
-
import { existsSync as
|
|
169355
|
+
import { existsSync as existsSync34, readFileSync as readFileSync19, readdirSync as readdirSync4, statSync as statSync5 } from "fs";
|
|
169235
169356
|
var TODO_HEADING_PATTERN2 = /^##\s+TODOs\b/i;
|
|
169236
169357
|
var FINAL_VERIFICATION_HEADING_PATTERN2 = /^##\s+Final Verification Wave\b/i;
|
|
169237
169358
|
var SECOND_LEVEL_HEADING_PATTERN2 = /^##\s+/;
|
|
@@ -169240,7 +169361,7 @@ var CHECKED_CHECKBOX_PATTERN = /^(\s*)[-*]\s*\[[xX]\]\s*(.+)$/;
|
|
|
169240
169361
|
var TODO_TASK_PATTERN2 = /^\d+\.\s+/;
|
|
169241
169362
|
var FINAL_WAVE_TASK_PATTERN2 = /^F\d+\.\s+/i;
|
|
169242
169363
|
function getPlanProgress(planPath) {
|
|
169243
|
-
if (!
|
|
169364
|
+
if (!existsSync34(planPath)) {
|
|
169244
169365
|
return { total: 0, completed: 0, isComplete: false };
|
|
169245
169366
|
}
|
|
169246
169367
|
try {
|
|
@@ -169360,10 +169481,10 @@ function selectMirrorWork(state) {
|
|
|
169360
169481
|
return sorted[0] ?? null;
|
|
169361
169482
|
}
|
|
169362
169483
|
// packages/boulder-state/src/storage/read-state.ts
|
|
169363
|
-
import { existsSync as
|
|
169484
|
+
import { existsSync as existsSync35, readFileSync as readFileSync20 } from "fs";
|
|
169364
169485
|
function readBoulderState(directory) {
|
|
169365
169486
|
const filePath = getBoulderFilePath(directory);
|
|
169366
|
-
if (!
|
|
169487
|
+
if (!existsSync35(filePath)) {
|
|
169367
169488
|
return null;
|
|
169368
169489
|
}
|
|
169369
169490
|
try {
|
|
@@ -169433,14 +169554,14 @@ init_state();
|
|
|
169433
169554
|
// packages/omo-opencode/src/features/run-continuation-state/constants.ts
|
|
169434
169555
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
169435
169556
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
169436
|
-
import { existsSync as
|
|
169437
|
-
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";
|
|
169438
169559
|
function getMarkerPath(directory, sessionID) {
|
|
169439
|
-
return
|
|
169560
|
+
return join31(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
169440
169561
|
}
|
|
169441
169562
|
function readContinuationMarker(directory, sessionID) {
|
|
169442
169563
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
169443
|
-
if (!
|
|
169564
|
+
if (!existsSync36(markerPath))
|
|
169444
169565
|
return null;
|
|
169445
169566
|
try {
|
|
169446
169567
|
const raw = readFileSync21(markerPath, "utf-8");
|
|
@@ -169509,7 +169630,7 @@ async function isSessionInBoulderLineage(input) {
|
|
|
169509
169630
|
init_shared();
|
|
169510
169631
|
init_compaction_marker();
|
|
169511
169632
|
import { readFileSync as readFileSync22, readdirSync as readdirSync5 } from "fs";
|
|
169512
|
-
import { join as
|
|
169633
|
+
import { join as join32 } from "path";
|
|
169513
169634
|
var defaultSessionLastAgentDeps = {
|
|
169514
169635
|
getMessageDir,
|
|
169515
169636
|
isSqliteBackend,
|
|
@@ -169569,7 +169690,7 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
|
|
|
169569
169690
|
try {
|
|
169570
169691
|
const messages = readdirSync5(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
169571
169692
|
try {
|
|
169572
|
-
const content = readFileSync22(
|
|
169693
|
+
const content = readFileSync22(join32(messageDir, fileName), "utf-8");
|
|
169573
169694
|
const parsed = JSON.parse(content);
|
|
169574
169695
|
return {
|
|
169575
169696
|
fileName,
|
|
@@ -169612,8 +169733,8 @@ init_agent_display_names();
|
|
|
169612
169733
|
|
|
169613
169734
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
169614
169735
|
init_frontmatter2();
|
|
169615
|
-
import { existsSync as
|
|
169616
|
-
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";
|
|
169617
169738
|
|
|
169618
169739
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
169619
169740
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -169622,11 +169743,11 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
169622
169743
|
|
|
169623
169744
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
169624
169745
|
function getStateFilePath(directory, customPath) {
|
|
169625
|
-
return customPath ?
|
|
169746
|
+
return customPath ? join33(directory, customPath) : join33(directory, DEFAULT_STATE_FILE);
|
|
169626
169747
|
}
|
|
169627
169748
|
function readState(directory, customPath) {
|
|
169628
169749
|
const filePath = getStateFilePath(directory, customPath);
|
|
169629
|
-
if (!
|
|
169750
|
+
if (!existsSync37(filePath)) {
|
|
169630
169751
|
return null;
|
|
169631
169752
|
}
|
|
169632
169753
|
try {
|
|
@@ -170205,22 +170326,22 @@ function createTimestampedStdoutController(stdout2 = process.stdout) {
|
|
|
170205
170326
|
// packages/telemetry-core/src/activity-state.ts
|
|
170206
170327
|
init_atomic_write();
|
|
170207
170328
|
init_xdg_data_dir();
|
|
170208
|
-
import { existsSync as
|
|
170209
|
-
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";
|
|
170210
170331
|
var POSTHOG_ACTIVITY_STATE_FILE = "posthog-activity.json";
|
|
170211
170332
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
170212
170333
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
170213
170334
|
env: options.env,
|
|
170214
170335
|
osProvider: options.osProvider
|
|
170215
170336
|
});
|
|
170216
|
-
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);
|
|
170217
170338
|
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename6(dataDir) === product.cacheDirName) {
|
|
170218
170339
|
return dataDir;
|
|
170219
170340
|
}
|
|
170220
|
-
return
|
|
170341
|
+
return join34(dataDir, product.cacheDirName);
|
|
170221
170342
|
}
|
|
170222
170343
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
170223
|
-
return
|
|
170344
|
+
return join34(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
170224
170345
|
}
|
|
170225
170346
|
function getDailyActiveCaptureState(input) {
|
|
170226
170347
|
const state2 = readPostHogActivityState(input.stateDir, input.diagnostics);
|
|
@@ -170245,7 +170366,7 @@ function isPostHogActivityState(value) {
|
|
|
170245
170366
|
}
|
|
170246
170367
|
function readPostHogActivityState(stateDir, diagnostics) {
|
|
170247
170368
|
const stateFilePath = getTelemetryActivityStateFilePath(stateDir);
|
|
170248
|
-
if (!
|
|
170369
|
+
if (!existsSync38(stateFilePath)) {
|
|
170249
170370
|
return {};
|
|
170250
170371
|
}
|
|
170251
170372
|
try {
|
|
@@ -170268,7 +170389,7 @@ function readPostHogActivityState(stateDir, diagnostics) {
|
|
|
170268
170389
|
function writePostHogActivityState(stateDir, nextState, diagnostics) {
|
|
170269
170390
|
const stateFilePath = getTelemetryActivityStateFilePath(stateDir);
|
|
170270
170391
|
try {
|
|
170271
|
-
|
|
170392
|
+
mkdirSync14(stateDir, { recursive: true });
|
|
170272
170393
|
writeFileAtomically(stateFilePath, `${JSON.stringify(nextState, null, 2)}
|
|
170273
170394
|
`);
|
|
170274
170395
|
} catch (error51) {
|
|
@@ -177372,14 +177493,14 @@ init_constants5();
|
|
|
177372
177493
|
|
|
177373
177494
|
// packages/omo-opencode/src/cli/doctor/checks/system.ts
|
|
177374
177495
|
init_constants5();
|
|
177375
|
-
import { existsSync as
|
|
177496
|
+
import { existsSync as existsSync49, readFileSync as readFileSync34 } from "fs";
|
|
177376
177497
|
|
|
177377
177498
|
// packages/omo-opencode/src/cli/doctor/checks/system-binary.ts
|
|
177378
177499
|
init_extract_semver();
|
|
177379
177500
|
init_bun_which_shim();
|
|
177380
|
-
import { existsSync as
|
|
177381
|
-
import { homedir as
|
|
177382
|
-
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";
|
|
177383
177504
|
|
|
177384
177505
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
177385
177506
|
init_spawn_with_windows_hide();
|
|
@@ -177467,22 +177588,22 @@ function isExecutable2(path14) {
|
|
|
177467
177588
|
}
|
|
177468
177589
|
}
|
|
177469
177590
|
function getDesktopAppPaths(platform) {
|
|
177470
|
-
const home =
|
|
177591
|
+
const home = homedir12();
|
|
177471
177592
|
switch (platform) {
|
|
177472
177593
|
case "darwin":
|
|
177473
177594
|
return [
|
|
177474
177595
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
177475
|
-
|
|
177596
|
+
join41(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
177476
177597
|
];
|
|
177477
177598
|
case "win32": {
|
|
177478
177599
|
const programFiles = process.env.ProgramFiles;
|
|
177479
177600
|
const localAppData = process.env.LOCALAPPDATA;
|
|
177480
177601
|
const paths2 = [];
|
|
177481
177602
|
if (programFiles) {
|
|
177482
|
-
paths2.push(
|
|
177603
|
+
paths2.push(join41(programFiles, "OpenCode", "OpenCode.exe"));
|
|
177483
177604
|
}
|
|
177484
177605
|
if (localAppData) {
|
|
177485
|
-
paths2.push(
|
|
177606
|
+
paths2.push(join41(localAppData, "OpenCode", "OpenCode.exe"));
|
|
177486
177607
|
}
|
|
177487
177608
|
return paths2;
|
|
177488
177609
|
}
|
|
@@ -177490,8 +177611,8 @@ function getDesktopAppPaths(platform) {
|
|
|
177490
177611
|
return [
|
|
177491
177612
|
"/usr/bin/opencode",
|
|
177492
177613
|
"/usr/lib/opencode/opencode",
|
|
177493
|
-
|
|
177494
|
-
|
|
177614
|
+
join41(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
177615
|
+
join41(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
177495
177616
|
];
|
|
177496
177617
|
default:
|
|
177497
177618
|
return [];
|
|
@@ -177503,7 +177624,7 @@ function buildVersionCommand(binaryPath, platform) {
|
|
|
177503
177624
|
}
|
|
177504
177625
|
return [binaryPath, "--version"];
|
|
177505
177626
|
}
|
|
177506
|
-
function findDesktopBinary(platform = process.platform, checkExists =
|
|
177627
|
+
function findDesktopBinary(platform = process.platform, checkExists = existsSync46) {
|
|
177507
177628
|
for (const desktopPath of getDesktopAppPaths(platform)) {
|
|
177508
177629
|
if (checkExists(desktopPath)) {
|
|
177509
177630
|
return { binary: "opencode", path: desktopPath };
|
|
@@ -177511,7 +177632,7 @@ function findDesktopBinary(platform = process.platform, checkExists = existsSync
|
|
|
177511
177632
|
}
|
|
177512
177633
|
return null;
|
|
177513
177634
|
}
|
|
177514
|
-
async function findOpenCodeBinary(platform = process.platform, checkExists =
|
|
177635
|
+
async function findOpenCodeBinary(platform = process.platform, checkExists = existsSync46) {
|
|
177515
177636
|
for (const binary2 of OPENCODE_BINARIES2) {
|
|
177516
177637
|
const path14 = bunWhich(binary2);
|
|
177517
177638
|
if (path14 && checkExists(path14)) {
|
|
@@ -177523,7 +177644,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
177523
177644
|
const candidates = getCommandCandidates2(platform);
|
|
177524
177645
|
for (const entry of pathEnv.split(delimiter3).filter(Boolean)) {
|
|
177525
177646
|
for (const command of candidates) {
|
|
177526
|
-
const fullPath =
|
|
177647
|
+
const fullPath = join41(entry, command);
|
|
177527
177648
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
177528
177649
|
return { binary: command, path: fullPath };
|
|
177529
177650
|
}
|
|
@@ -177569,12 +177690,12 @@ function compareVersions3(current, minimum) {
|
|
|
177569
177690
|
|
|
177570
177691
|
// packages/omo-opencode/src/cli/doctor/checks/system-plugin.ts
|
|
177571
177692
|
init_shared();
|
|
177572
|
-
import { existsSync as
|
|
177693
|
+
import { existsSync as existsSync47, readFileSync as readFileSync32 } from "fs";
|
|
177573
177694
|
function detectConfigPath() {
|
|
177574
177695
|
const paths2 = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
177575
|
-
if (
|
|
177696
|
+
if (existsSync47(paths2.configJsonc))
|
|
177576
177697
|
return paths2.configJsonc;
|
|
177577
|
-
if (
|
|
177698
|
+
if (existsSync47(paths2.configJson))
|
|
177578
177699
|
return paths2.configJson;
|
|
177579
177700
|
return null;
|
|
177580
177701
|
}
|
|
@@ -177664,35 +177785,35 @@ init_auto_update_checker();
|
|
|
177664
177785
|
init_package_json_locator();
|
|
177665
177786
|
init_constants5();
|
|
177666
177787
|
init_shared();
|
|
177667
|
-
import { existsSync as
|
|
177788
|
+
import { existsSync as existsSync48, readFileSync as readFileSync33, readdirSync as readdirSync7 } from "fs";
|
|
177668
177789
|
import { createRequire as createRequire2 } from "module";
|
|
177669
|
-
import { homedir as
|
|
177670
|
-
import { join as
|
|
177790
|
+
import { homedir as homedir13 } from "os";
|
|
177791
|
+
import { join as join42 } from "path";
|
|
177671
177792
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
177672
177793
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
177673
177794
|
if (platform === "darwin")
|
|
177674
|
-
return
|
|
177795
|
+
return join42(homedir13(), "Library", "Caches");
|
|
177675
177796
|
if (platform === "win32")
|
|
177676
|
-
return process.env.LOCALAPPDATA ??
|
|
177677
|
-
return
|
|
177797
|
+
return process.env.LOCALAPPDATA ?? join42(homedir13(), "AppData", "Local");
|
|
177798
|
+
return join42(homedir13(), ".cache");
|
|
177678
177799
|
}
|
|
177679
177800
|
function resolveOpenCodeCacheDir() {
|
|
177680
177801
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
177681
177802
|
if (xdgCacheHome)
|
|
177682
|
-
return
|
|
177803
|
+
return join42(xdgCacheHome, "opencode");
|
|
177683
177804
|
const fromShared = getOpenCodeCacheDir();
|
|
177684
|
-
const platformDefault =
|
|
177685
|
-
if (
|
|
177805
|
+
const platformDefault = join42(getPlatformDefaultCacheDir(), "opencode");
|
|
177806
|
+
if (existsSync48(fromShared) || !existsSync48(platformDefault))
|
|
177686
177807
|
return fromShared;
|
|
177687
177808
|
return platformDefault;
|
|
177688
177809
|
}
|
|
177689
177810
|
function resolveExistingDir(dirPath) {
|
|
177690
|
-
if (!
|
|
177811
|
+
if (!existsSync48(dirPath))
|
|
177691
177812
|
return dirPath;
|
|
177692
177813
|
return resolveSymlink(dirPath);
|
|
177693
177814
|
}
|
|
177694
177815
|
function readPackageJson(filePath) {
|
|
177695
|
-
if (!
|
|
177816
|
+
if (!existsSync48(filePath))
|
|
177696
177817
|
return null;
|
|
177697
177818
|
try {
|
|
177698
177819
|
const content = readFileSync33(filePath, "utf-8");
|
|
@@ -177713,26 +177834,26 @@ function normalizeVersion(value) {
|
|
|
177713
177834
|
function createPackageCandidates(rootDir) {
|
|
177714
177835
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
177715
177836
|
packageName,
|
|
177716
|
-
installedPackagePath:
|
|
177837
|
+
installedPackagePath: join42(rootDir, "node_modules", packageName, "package.json")
|
|
177717
177838
|
}));
|
|
177718
177839
|
}
|
|
177719
177840
|
function createTaggedInstallCandidates(rootDir) {
|
|
177720
|
-
const packagesDir =
|
|
177721
|
-
if (!
|
|
177841
|
+
const packagesDir = join42(rootDir, "packages");
|
|
177842
|
+
if (!existsSync48(packagesDir))
|
|
177722
177843
|
return [];
|
|
177723
177844
|
const candidates = [];
|
|
177724
177845
|
for (const entryName of readdirSync7(packagesDir).sort()) {
|
|
177725
177846
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name2) => entryName.startsWith(`${name2}@`));
|
|
177726
177847
|
if (packageName === undefined)
|
|
177727
177848
|
continue;
|
|
177728
|
-
const installDir =
|
|
177849
|
+
const installDir = join42(packagesDir, entryName);
|
|
177729
177850
|
candidates.push({
|
|
177730
177851
|
cacheDir: installDir,
|
|
177731
|
-
cachePackagePath:
|
|
177852
|
+
cachePackagePath: join42(installDir, "package.json"),
|
|
177732
177853
|
packageCandidates: [
|
|
177733
177854
|
{
|
|
177734
177855
|
packageName,
|
|
177735
|
-
installedPackagePath:
|
|
177856
|
+
installedPackagePath: join42(installDir, "node_modules", packageName, "package.json")
|
|
177736
177857
|
}
|
|
177737
177858
|
]
|
|
177738
177859
|
});
|
|
@@ -177740,7 +177861,7 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
177740
177861
|
return candidates;
|
|
177741
177862
|
}
|
|
177742
177863
|
function selectInstalledPackage(candidate) {
|
|
177743
|
-
return candidate.packageCandidates.find((packageCandidate) =>
|
|
177864
|
+
return candidate.packageCandidates.find((packageCandidate) => existsSync48(packageCandidate.installedPackagePath)) ?? candidate.packageCandidates[0];
|
|
177744
177865
|
}
|
|
177745
177866
|
function getExpectedVersion(cachePackage, packageName) {
|
|
177746
177867
|
return normalizeVersion(cachePackage?.dependencies?.[packageName]) ?? normalizeVersion(cachePackage?.dependencies?.[PACKAGE_NAME]);
|
|
@@ -177751,7 +177872,7 @@ function resolveInstalledPackageJsonPath() {
|
|
|
177751
177872
|
for (const packageName of ACCEPTED_PACKAGE_NAMES) {
|
|
177752
177873
|
try {
|
|
177753
177874
|
const packageJsonPath = require2.resolve(`${packageName}/package.json`);
|
|
177754
|
-
if (
|
|
177875
|
+
if (existsSync48(packageJsonPath)) {
|
|
177755
177876
|
return { packageName, packageJsonPath };
|
|
177756
177877
|
}
|
|
177757
177878
|
} catch {
|
|
@@ -177777,22 +177898,22 @@ function getLoadedPluginVersion() {
|
|
|
177777
177898
|
const candidates = [
|
|
177778
177899
|
{
|
|
177779
177900
|
cacheDir: configDir,
|
|
177780
|
-
cachePackagePath:
|
|
177901
|
+
cachePackagePath: join42(configDir, "package.json"),
|
|
177781
177902
|
packageCandidates: createPackageCandidates(configDir)
|
|
177782
177903
|
},
|
|
177783
177904
|
...createTaggedInstallCandidates(configDir),
|
|
177784
177905
|
{
|
|
177785
177906
|
cacheDir,
|
|
177786
|
-
cachePackagePath:
|
|
177907
|
+
cachePackagePath: join42(cacheDir, "package.json"),
|
|
177787
177908
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
177788
177909
|
},
|
|
177789
177910
|
...createTaggedInstallCandidates(cacheDir)
|
|
177790
177911
|
];
|
|
177791
|
-
const selectedCandidate = candidates.find((candidate) => candidate.packageCandidates.some((packageCandidate) =>
|
|
177912
|
+
const selectedCandidate = candidates.find((candidate) => candidate.packageCandidates.some((packageCandidate) => existsSync48(packageCandidate.installedPackagePath))) ?? candidates[0];
|
|
177792
177913
|
const { cacheDir: selectedDir, cachePackagePath } = selectedCandidate;
|
|
177793
177914
|
const selectedPackage = selectInstalledPackage(selectedCandidate);
|
|
177794
177915
|
const candidateInstalledPath = selectedPackage.installedPackagePath;
|
|
177795
|
-
const candidateExists =
|
|
177916
|
+
const candidateExists = existsSync48(candidateInstalledPath);
|
|
177796
177917
|
const resolvedFallback = candidateExists ? null : resolveInstalledPackageJsonPath();
|
|
177797
177918
|
const installedPackagePath = resolvedFallback?.packageJsonPath ?? candidateInstalledPath;
|
|
177798
177919
|
const resolvedPackageName = resolvedFallback?.packageName ?? selectedPackage.packageName;
|
|
@@ -177828,7 +177949,7 @@ var defaultDeps6 = {
|
|
|
177828
177949
|
getLoadedPluginVersion,
|
|
177829
177950
|
getLatestPluginVersion,
|
|
177830
177951
|
getSuggestedInstallTag,
|
|
177831
|
-
configExists:
|
|
177952
|
+
configExists: existsSync49,
|
|
177832
177953
|
readConfigFile: (path14) => readFileSync34(path14, "utf-8"),
|
|
177833
177954
|
parseConfigContent: (content) => parseJsonc(content)
|
|
177834
177955
|
};
|
|
@@ -177975,12 +178096,12 @@ async function checkSystem(deps = defaultDeps6) {
|
|
|
177975
178096
|
// packages/omo-opencode/src/config/validate.ts
|
|
177976
178097
|
init_src();
|
|
177977
178098
|
import { readFileSync as readFileSync35 } from "fs";
|
|
177978
|
-
import { homedir as
|
|
178099
|
+
import { homedir as homedir14 } from "os";
|
|
177979
178100
|
import { dirname as dirname18, relative as relative5 } from "path";
|
|
177980
178101
|
init_shared();
|
|
177981
178102
|
init_plugin_identity();
|
|
177982
178103
|
function resolveHomeDirectory2() {
|
|
177983
|
-
return process.env.HOME ?? process.env.USERPROFILE ??
|
|
178104
|
+
return process.env.HOME ?? process.env.USERPROFILE ?? homedir14();
|
|
177984
178105
|
}
|
|
177985
178106
|
function discoverConfigInDirectory(configDir) {
|
|
177986
178107
|
const detected = detectPluginConfigFile(configDir, {
|
|
@@ -178091,23 +178212,23 @@ init_constants5();
|
|
|
178091
178212
|
|
|
178092
178213
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-cache.ts
|
|
178093
178214
|
init_shared();
|
|
178094
|
-
import { existsSync as
|
|
178095
|
-
import { homedir as
|
|
178096
|
-
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";
|
|
178097
178218
|
function getUserConfigDir2() {
|
|
178098
178219
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
178099
178220
|
if (xdgConfig)
|
|
178100
|
-
return
|
|
178101
|
-
return
|
|
178221
|
+
return join43(xdgConfig, "opencode");
|
|
178222
|
+
return join43(homedir15(), ".config", "opencode");
|
|
178102
178223
|
}
|
|
178103
178224
|
function loadCustomProviderNames() {
|
|
178104
178225
|
const configDir = getUserConfigDir2();
|
|
178105
178226
|
const candidatePaths = [
|
|
178106
|
-
|
|
178107
|
-
|
|
178227
|
+
join43(configDir, "opencode.json"),
|
|
178228
|
+
join43(configDir, "opencode.jsonc")
|
|
178108
178229
|
];
|
|
178109
178230
|
for (const configPath of candidatePaths) {
|
|
178110
|
-
if (!
|
|
178231
|
+
if (!existsSync50(configPath))
|
|
178111
178232
|
continue;
|
|
178112
178233
|
try {
|
|
178113
178234
|
const content = readFileSync36(configPath, "utf-8");
|
|
@@ -178125,9 +178246,9 @@ function loadCustomProviderNames() {
|
|
|
178125
178246
|
return [];
|
|
178126
178247
|
}
|
|
178127
178248
|
function loadAvailableModelsFromCache() {
|
|
178128
|
-
const cacheFile =
|
|
178249
|
+
const cacheFile = join43(getOpenCodeCacheDir(), "models.json");
|
|
178129
178250
|
const customProviders = loadCustomProviderNames();
|
|
178130
|
-
if (!
|
|
178251
|
+
if (!existsSync50(cacheFile)) {
|
|
178131
178252
|
if (customProviders.length > 0) {
|
|
178132
178253
|
return { providers: customProviders, modelCount: 0, cacheExists: true };
|
|
178133
178254
|
}
|
|
@@ -178163,8 +178284,8 @@ init_constants5();
|
|
|
178163
178284
|
init_shared();
|
|
178164
178285
|
init_plugin_identity();
|
|
178165
178286
|
import { readFileSync as readFileSync37 } from "fs";
|
|
178166
|
-
import { join as
|
|
178167
|
-
var PROJECT_CONFIG_DIR =
|
|
178287
|
+
import { join as join44 } from "path";
|
|
178288
|
+
var PROJECT_CONFIG_DIR = join44(process.cwd(), ".opencode");
|
|
178168
178289
|
function loadOmoConfig() {
|
|
178169
178290
|
const projectDetected = detectPluginConfigFile(PROJECT_CONFIG_DIR, {
|
|
178170
178291
|
basenames: [CONFIG_BASENAME],
|
|
@@ -178202,7 +178323,7 @@ function loadOmoConfig() {
|
|
|
178202
178323
|
|
|
178203
178324
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
178204
178325
|
init_shared();
|
|
178205
|
-
import { join as
|
|
178326
|
+
import { join as join45 } from "path";
|
|
178206
178327
|
|
|
178207
178328
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
178208
178329
|
function formatModelWithVariant(model, variant) {
|
|
@@ -178244,7 +178365,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
178244
178365
|
}
|
|
178245
178366
|
function buildModelResolutionDetails(options) {
|
|
178246
178367
|
const details = [];
|
|
178247
|
-
const cacheFile =
|
|
178368
|
+
const cacheFile = join45(getOpenCodeCacheDir(), "models.json");
|
|
178248
178369
|
details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
|
|
178249
178370
|
details.push("");
|
|
178250
178371
|
if (options.available.cacheExists) {
|
|
@@ -178520,28 +178641,28 @@ async function checkConfig() {
|
|
|
178520
178641
|
|
|
178521
178642
|
// packages/omo-opencode/src/cli/doctor/checks/dependencies.ts
|
|
178522
178643
|
init_src();
|
|
178523
|
-
import { existsSync as
|
|
178644
|
+
import { existsSync as existsSync51 } from "fs";
|
|
178524
178645
|
import { createRequire as createRequire3 } from "module";
|
|
178525
|
-
import { homedir as
|
|
178526
|
-
import { dirname as dirname19, join as
|
|
178646
|
+
import { homedir as homedir17 } from "os";
|
|
178647
|
+
import { dirname as dirname19, join as join47 } from "path";
|
|
178527
178648
|
|
|
178528
178649
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
178529
|
-
import { join as
|
|
178530
|
-
import { homedir as
|
|
178650
|
+
import { join as join46 } from "path";
|
|
178651
|
+
import { homedir as homedir16, tmpdir as tmpdir3 } from "os";
|
|
178531
178652
|
init_binary_downloader();
|
|
178532
178653
|
init_logger2();
|
|
178533
178654
|
init_plugin_identity();
|
|
178534
178655
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
178535
|
-
var DEBUG_FILE =
|
|
178656
|
+
var DEBUG_FILE = join46(tmpdir3(), "comment-checker-debug.log");
|
|
178536
178657
|
function getCacheDir2() {
|
|
178537
178658
|
if (process.platform === "win32") {
|
|
178538
178659
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
178539
|
-
const base2 = localAppData ||
|
|
178540
|
-
return
|
|
178660
|
+
const base2 = localAppData || join46(homedir16(), "AppData", "Local");
|
|
178661
|
+
return join46(base2, CACHE_DIR_NAME, "bin");
|
|
178541
178662
|
}
|
|
178542
178663
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
178543
|
-
const base = xdgCache ||
|
|
178544
|
-
return
|
|
178664
|
+
const base = xdgCache || join46(homedir16(), ".cache");
|
|
178665
|
+
return join46(base, CACHE_DIR_NAME, "bin");
|
|
178545
178666
|
}
|
|
178546
178667
|
function getBinaryName() {
|
|
178547
178668
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -178591,7 +178712,7 @@ async function getBinaryVersion(binary2) {
|
|
|
178591
178712
|
}
|
|
178592
178713
|
}
|
|
178593
178714
|
async function checkAstGrepCli() {
|
|
178594
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
178715
|
+
const runtimeDir = astGrepRuntimeDir(join47(homedir17(), ".omo"));
|
|
178595
178716
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
178596
178717
|
if (sgPath === null) {
|
|
178597
178718
|
return {
|
|
@@ -178621,11 +178742,11 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
178621
178742
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
178622
178743
|
try {
|
|
178623
178744
|
const packageDir = baseDirOverride ?? dirname19(resolvePackageJsonPath());
|
|
178624
|
-
const vendorPath =
|
|
178625
|
-
if (
|
|
178745
|
+
const vendorPath = join47(packageDir, "vendor", platformKey, binaryName);
|
|
178746
|
+
if (existsSync51(vendorPath))
|
|
178626
178747
|
return vendorPath;
|
|
178627
|
-
const binPath =
|
|
178628
|
-
if (
|
|
178748
|
+
const binPath = join47(packageDir, "bin", binaryName);
|
|
178749
|
+
if (existsSync51(binPath))
|
|
178629
178750
|
return binPath;
|
|
178630
178751
|
} catch (error51) {
|
|
178631
178752
|
if (!(error51 instanceof Error) && !isModuleResolutionFailure(error51))
|
|
@@ -178770,12 +178891,12 @@ async function getGhCliInfo(dependencies = {}) {
|
|
|
178770
178891
|
|
|
178771
178892
|
// packages/omo-opencode/src/cli/doctor/checks/tools-lsp.ts
|
|
178772
178893
|
import { readFileSync as readFileSync39 } from "fs";
|
|
178773
|
-
import { join as
|
|
178894
|
+
import { join as join48 } from "path";
|
|
178774
178895
|
|
|
178775
178896
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
178776
178897
|
init_zod();
|
|
178777
178898
|
init_opencode_config_dir();
|
|
178778
|
-
import { existsSync as
|
|
178899
|
+
import { existsSync as existsSync52, readFileSync as readFileSync38 } from "fs";
|
|
178779
178900
|
import { delimiter as delimiter3, dirname as dirname20, resolve as resolve10 } from "path";
|
|
178780
178901
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
178781
178902
|
|
|
@@ -178941,7 +179062,7 @@ function createBootstrapCandidate(root, pathExists, resolveExecutable) {
|
|
|
178941
179062
|
};
|
|
178942
179063
|
}
|
|
178943
179064
|
function resolveLspCommand(options = {}) {
|
|
178944
|
-
const pathExists = options.exists ??
|
|
179065
|
+
const pathExists = options.exists ?? existsSync52;
|
|
178945
179066
|
const resolveExecutable = options.resolveExecutable ?? resolveRuntimeExecutable;
|
|
178946
179067
|
const moduleDirectory = getModuleDirectory(options.moduleUrl ?? import.meta.url);
|
|
178947
179068
|
const candidates = moduleDirectory ? createAncestorCliCandidates({
|
|
@@ -179007,7 +179128,7 @@ function readOmoConfig(configDirectory) {
|
|
|
179007
179128
|
}
|
|
179008
179129
|
function isLspMcpDisabled(options) {
|
|
179009
179130
|
const userConfigDirectory = options.configDirectory ?? getOpenCodeConfigDir({ binary: "opencode" });
|
|
179010
|
-
const projectConfigDirectory =
|
|
179131
|
+
const projectConfigDirectory = join48(options.cwd ?? process.cwd(), ".opencode");
|
|
179011
179132
|
const userConfig = readOmoConfig(userConfigDirectory);
|
|
179012
179133
|
const projectConfig = readOmoConfig(projectConfigDirectory);
|
|
179013
179134
|
const disabledMcps = new Set([
|
|
@@ -179026,21 +179147,21 @@ function getInstalledLspServers(options = {}) {
|
|
|
179026
179147
|
|
|
179027
179148
|
// packages/omo-opencode/src/cli/doctor/checks/tools-mcp.ts
|
|
179028
179149
|
init_shared();
|
|
179029
|
-
import { existsSync as
|
|
179030
|
-
import { homedir as
|
|
179031
|
-
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";
|
|
179032
179153
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
179033
179154
|
function getMcpConfigPaths() {
|
|
179034
179155
|
return [
|
|
179035
|
-
|
|
179036
|
-
|
|
179037
|
-
|
|
179156
|
+
join49(homedir18(), ".claude", ".mcp.json"),
|
|
179157
|
+
join49(process.cwd(), ".mcp.json"),
|
|
179158
|
+
join49(process.cwd(), ".claude", ".mcp.json")
|
|
179038
179159
|
];
|
|
179039
179160
|
}
|
|
179040
179161
|
function loadUserMcpConfig() {
|
|
179041
179162
|
const servers = {};
|
|
179042
179163
|
for (const configPath of getMcpConfigPaths()) {
|
|
179043
|
-
if (!
|
|
179164
|
+
if (!existsSync53(configPath))
|
|
179044
179165
|
continue;
|
|
179045
179166
|
try {
|
|
179046
179167
|
const content = readFileSync40(configPath, "utf-8");
|
|
@@ -179178,13 +179299,13 @@ async function checkTools() {
|
|
|
179178
179299
|
}
|
|
179179
179300
|
|
|
179180
179301
|
// packages/omo-opencode/src/cli/doctor/checks/telemetry.ts
|
|
179181
|
-
import { existsSync as
|
|
179302
|
+
import { existsSync as existsSync54, readFileSync as readFileSync41 } from "fs";
|
|
179182
179303
|
init_constants5();
|
|
179183
179304
|
function isTelemetryState(value) {
|
|
179184
179305
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
179185
179306
|
}
|
|
179186
179307
|
function readLastActiveDay(stateFilePath) {
|
|
179187
|
-
if (!
|
|
179308
|
+
if (!existsSync54(stateFilePath)) {
|
|
179188
179309
|
return "never";
|
|
179189
179310
|
}
|
|
179190
179311
|
let parsed;
|
|
@@ -179247,17 +179368,17 @@ async function probeBinary(cmd, args, spawnImpl) {
|
|
|
179247
179368
|
}
|
|
179248
179369
|
|
|
179249
179370
|
// packages/team-core/src/team-registry/paths.ts
|
|
179250
|
-
import { homedir as
|
|
179371
|
+
import { homedir as homedir19 } from "os";
|
|
179251
179372
|
import path14 from "path";
|
|
179252
179373
|
function resolveBaseDir(config5) {
|
|
179253
|
-
return expandHomeDirectory(config5.base_dir ?? path14.join(
|
|
179374
|
+
return expandHomeDirectory(config5.base_dir ?? path14.join(homedir19(), ".omo"));
|
|
179254
179375
|
}
|
|
179255
179376
|
function expandHomeDirectory(directoryPath) {
|
|
179256
179377
|
if (directoryPath === "~") {
|
|
179257
|
-
return
|
|
179378
|
+
return homedir19();
|
|
179258
179379
|
}
|
|
179259
179380
|
if (directoryPath.startsWith("~/") || directoryPath.startsWith("~\\")) {
|
|
179260
|
-
return path14.join(
|
|
179381
|
+
return path14.join(homedir19(), directoryPath.slice(2));
|
|
179261
179382
|
}
|
|
179262
179383
|
return directoryPath;
|
|
179263
179384
|
}
|
|
@@ -179740,23 +179861,23 @@ Doctor failed unexpectedly: ${message}`];
|
|
|
179740
179861
|
import { createHash as createHash3 } from "crypto";
|
|
179741
179862
|
import {
|
|
179742
179863
|
chmodSync as chmodSync6,
|
|
179743
|
-
existsSync as
|
|
179744
|
-
mkdirSync as
|
|
179864
|
+
existsSync as existsSync57,
|
|
179865
|
+
mkdirSync as mkdirSync16,
|
|
179745
179866
|
readdirSync as readdirSync8,
|
|
179746
179867
|
readFileSync as readFileSync44,
|
|
179747
179868
|
renameSync as renameSync7,
|
|
179748
179869
|
unlinkSync as unlinkSync8,
|
|
179749
179870
|
writeFileSync as writeFileSync14
|
|
179750
179871
|
} from "fs";
|
|
179751
|
-
import { basename as basename8, dirname as dirname21, join as
|
|
179872
|
+
import { basename as basename8, dirname as dirname21, join as join52 } from "path";
|
|
179752
179873
|
|
|
179753
179874
|
// packages/mcp-client-core/src/config-dir.ts
|
|
179754
|
-
import { existsSync as
|
|
179755
|
-
import { homedir as
|
|
179756
|
-
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";
|
|
179757
179878
|
function resolveConfigPath2(pathValue) {
|
|
179758
179879
|
const resolvedPath = resolve11(pathValue);
|
|
179759
|
-
if (!
|
|
179880
|
+
if (!existsSync55(resolvedPath))
|
|
179760
179881
|
return resolvedPath;
|
|
179761
179882
|
try {
|
|
179762
179883
|
return realpathSync7(resolvedPath);
|
|
@@ -179771,13 +179892,13 @@ function getOpenCodeCliConfigDir(env2 = process.env) {
|
|
|
179771
179892
|
if (customConfigDir) {
|
|
179772
179893
|
return resolveConfigPath2(customConfigDir);
|
|
179773
179894
|
}
|
|
179774
|
-
const xdgConfigDir = env2["XDG_CONFIG_HOME"]?.trim() ||
|
|
179775
|
-
return resolveConfigPath2(
|
|
179895
|
+
const xdgConfigDir = env2["XDG_CONFIG_HOME"]?.trim() || join50(homedir20(), ".config");
|
|
179896
|
+
return resolveConfigPath2(join50(xdgConfigDir, "opencode"));
|
|
179776
179897
|
}
|
|
179777
179898
|
|
|
179778
179899
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
179779
|
-
import { chmodSync as chmodSync5, existsSync as
|
|
179780
|
-
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";
|
|
179781
179902
|
var INDEX_FILE_NAME = "index.json";
|
|
179782
179903
|
function isTokenIndex(value) {
|
|
179783
179904
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -179785,11 +179906,11 @@ function isTokenIndex(value) {
|
|
|
179785
179906
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
179786
179907
|
}
|
|
179787
179908
|
function getIndexPath(storageDir) {
|
|
179788
|
-
return
|
|
179909
|
+
return join51(storageDir, INDEX_FILE_NAME);
|
|
179789
179910
|
}
|
|
179790
179911
|
function readTokenIndex(storageDir) {
|
|
179791
179912
|
const indexPath = getIndexPath(storageDir);
|
|
179792
|
-
if (!
|
|
179913
|
+
if (!existsSync56(indexPath))
|
|
179793
179914
|
return {};
|
|
179794
179915
|
try {
|
|
179795
179916
|
const parsed = JSON.parse(readFileSync43(indexPath, "utf-8"));
|
|
@@ -179829,16 +179950,16 @@ function deleteTokenIndexEntry(storageDir, hash2) {
|
|
|
179829
179950
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
179830
179951
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
179831
179952
|
function getMcpOauthStorageDir() {
|
|
179832
|
-
return
|
|
179953
|
+
return join52(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
179833
179954
|
}
|
|
179834
179955
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
179835
179956
|
return createHash3("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
179836
179957
|
}
|
|
179837
179958
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
179838
|
-
return
|
|
179959
|
+
return join52(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
179839
179960
|
}
|
|
179840
179961
|
function getLegacyStoragePath() {
|
|
179841
|
-
return
|
|
179962
|
+
return join52(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
179842
179963
|
}
|
|
179843
179964
|
function normalizeHost2(serverHost) {
|
|
179844
179965
|
let host = serverHost.trim();
|
|
@@ -179899,7 +180020,7 @@ function isOAuthTokenData(value) {
|
|
|
179899
180020
|
return clientSecret === undefined || typeof clientSecret === "string";
|
|
179900
180021
|
}
|
|
179901
180022
|
function readTokenFile(filePath) {
|
|
179902
|
-
if (!
|
|
180023
|
+
if (!existsSync57(filePath))
|
|
179903
180024
|
return null;
|
|
179904
180025
|
try {
|
|
179905
180026
|
const parsed = JSON.parse(readFileSync44(filePath, "utf-8"));
|
|
@@ -179912,7 +180033,7 @@ function readTokenFile(filePath) {
|
|
|
179912
180033
|
}
|
|
179913
180034
|
function readLegacyStore() {
|
|
179914
180035
|
const filePath = getLegacyStoragePath();
|
|
179915
|
-
if (!
|
|
180036
|
+
if (!existsSync57(filePath))
|
|
179916
180037
|
return null;
|
|
179917
180038
|
try {
|
|
179918
180039
|
const parsed = JSON.parse(readFileSync44(filePath, "utf-8"));
|
|
@@ -179933,8 +180054,8 @@ function readLegacyStore() {
|
|
|
179933
180054
|
function writeTokenFile(filePath, token) {
|
|
179934
180055
|
try {
|
|
179935
180056
|
const dir = dirname21(filePath);
|
|
179936
|
-
if (!
|
|
179937
|
-
|
|
180057
|
+
if (!existsSync57(dir)) {
|
|
180058
|
+
mkdirSync16(dir, { recursive: true });
|
|
179938
180059
|
}
|
|
179939
180060
|
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
179940
180061
|
writeFileSync14(tempPath, JSON.stringify(token, null, 2), { encoding: "utf-8", mode: 384 });
|
|
@@ -179957,7 +180078,7 @@ function saveToken(serverHost, resource, token) {
|
|
|
179957
180078
|
}
|
|
179958
180079
|
function deleteToken(serverHost, resource) {
|
|
179959
180080
|
const filePath = getMcpOauthStoragePath(serverHost, resource);
|
|
179960
|
-
if (!
|
|
180081
|
+
if (!existsSync57(filePath))
|
|
179961
180082
|
return deleteLegacyToken(serverHost, resource);
|
|
179962
180083
|
try {
|
|
179963
180084
|
unlinkSync8(filePath);
|
|
@@ -179979,7 +180100,7 @@ function deleteLegacyToken(serverHost, resource) {
|
|
|
179979
180100
|
if (Object.keys(store2).length === 0) {
|
|
179980
180101
|
try {
|
|
179981
180102
|
const filePath = getLegacyStoragePath();
|
|
179982
|
-
if (
|
|
180103
|
+
if (existsSync57(filePath))
|
|
179983
180104
|
unlinkSync8(filePath);
|
|
179984
180105
|
return true;
|
|
179985
180106
|
} catch (deleteError) {
|
|
@@ -180017,7 +180138,7 @@ function listTokensByHost(serverHost) {
|
|
|
180017
180138
|
for (const [hash2, indexedKey] of Object.entries(index)) {
|
|
180018
180139
|
if (!indexedKey.startsWith(prefix))
|
|
180019
180140
|
continue;
|
|
180020
|
-
const indexedToken = readTokenFile(
|
|
180141
|
+
const indexedToken = readTokenFile(join52(getMcpOauthStorageDir(), `${hash2}.json`));
|
|
180021
180142
|
if (indexedToken)
|
|
180022
180143
|
result[indexedKey] = indexedToken;
|
|
180023
180144
|
}
|
|
@@ -180026,13 +180147,13 @@ function listTokensByHost(serverHost) {
|
|
|
180026
180147
|
function listAllTokens() {
|
|
180027
180148
|
const result = { ...readLegacyStore() ?? {} };
|
|
180028
180149
|
const dir = getMcpOauthStorageDir();
|
|
180029
|
-
if (!
|
|
180150
|
+
if (!existsSync57(dir))
|
|
180030
180151
|
return result;
|
|
180031
180152
|
const index = readTokenIndex(dir);
|
|
180032
180153
|
for (const entry of readdirSync8(dir, { withFileTypes: true })) {
|
|
180033
180154
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
180034
180155
|
continue;
|
|
180035
|
-
const token = readTokenFile(
|
|
180156
|
+
const token = readTokenFile(join52(dir, entry.name));
|
|
180036
180157
|
const hash2 = basename8(entry.name, ".json");
|
|
180037
180158
|
if (token)
|
|
180038
180159
|
result[index[hash2] ?? hash2] = token;
|
|
@@ -180728,8 +180849,8 @@ function createEmbeddingPort() {
|
|
|
180728
180849
|
// packages/learning-loop/src/codebase-scanner.ts
|
|
180729
180850
|
var import_picomatch = __toESM(require_picomatch2(), 1);
|
|
180730
180851
|
import { createHash as createHash5 } from "crypto";
|
|
180731
|
-
import { readdirSync as readdirSync9, readFileSync as readFileSync46, statSync as statSync7, existsSync as
|
|
180732
|
-
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";
|
|
180733
180854
|
var EXT_TO_LANG = {
|
|
180734
180855
|
ts: "typescript",
|
|
180735
180856
|
tsx: "typescript",
|
|
@@ -180783,7 +180904,7 @@ function detectLanguage(filePath) {
|
|
|
180783
180904
|
return EXT_TO_LANG[ext] ?? "text";
|
|
180784
180905
|
}
|
|
180785
180906
|
function loadGitignore(rootDir, fs18) {
|
|
180786
|
-
const gitignorePath =
|
|
180907
|
+
const gitignorePath = join53(rootDir, ".gitignore");
|
|
180787
180908
|
if (!fs18.exists(gitignorePath))
|
|
180788
180909
|
return [];
|
|
180789
180910
|
const content = fs18.readFile(gitignorePath);
|
|
@@ -180803,7 +180924,7 @@ function defaultFs() {
|
|
|
180803
180924
|
return { size: s.size, mtimeMs: s.mtimeMs, isDirectory: () => s.isDirectory(), isFile: () => s.isFile() };
|
|
180804
180925
|
},
|
|
180805
180926
|
exists(path18) {
|
|
180806
|
-
return
|
|
180927
|
+
return existsSync59(path18);
|
|
180807
180928
|
}
|
|
180808
180929
|
};
|
|
180809
180930
|
}
|
|
@@ -180874,7 +180995,7 @@ function createCodebaseScanner(options = {}) {
|
|
|
180874
180995
|
return;
|
|
180875
180996
|
}
|
|
180876
180997
|
for (const entry of entries) {
|
|
180877
|
-
const fullPath =
|
|
180998
|
+
const fullPath = join53(dir, entry);
|
|
180878
180999
|
let stat;
|
|
180879
181000
|
try {
|
|
180880
181001
|
stat = fs18.stat(fullPath);
|
|
@@ -181149,14 +181270,14 @@ function formatSearchResults(result) {
|
|
|
181149
181270
|
}
|
|
181150
181271
|
|
|
181151
181272
|
// packages/learning-loop/src/improvement.ts
|
|
181152
|
-
import { existsSync as
|
|
181153
|
-
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";
|
|
181154
181275
|
function createImprovementStore(improvementsDir) {
|
|
181155
|
-
if (!
|
|
181156
|
-
|
|
181276
|
+
if (!existsSync60(improvementsDir)) {
|
|
181277
|
+
mkdirSync18(improvementsDir, { recursive: true });
|
|
181157
181278
|
}
|
|
181158
181279
|
function save(improvement) {
|
|
181159
|
-
const filePath =
|
|
181280
|
+
const filePath = join54(improvementsDir, `${improvement.id}.json`);
|
|
181160
181281
|
writeFileSync16(filePath, JSON.stringify(improvement, null, 2), "utf-8");
|
|
181161
181282
|
}
|
|
181162
181283
|
function list() {
|
|
@@ -181174,7 +181295,7 @@ function createImprovementStore(improvementsDir) {
|
|
|
181174
181295
|
return files.map((f2) => get(basename10(f2, ".json"))).filter((i3) => i3 !== null);
|
|
181175
181296
|
}
|
|
181176
181297
|
function get(id) {
|
|
181177
|
-
const filePath =
|
|
181298
|
+
const filePath = join54(improvementsDir, `${id}.json`);
|
|
181178
181299
|
try {
|
|
181179
181300
|
const raw = readFileSync47(filePath, "utf-8");
|
|
181180
181301
|
return JSON.parse(raw);
|
|
@@ -181247,7 +181368,7 @@ async function applyLearningsCli(options = {}) {
|
|
|
181247
181368
|
}
|
|
181248
181369
|
|
|
181249
181370
|
// packages/omo-opencode/src/cli/boulder/boulder.ts
|
|
181250
|
-
import { existsSync as
|
|
181371
|
+
import { existsSync as existsSync62 } from "fs";
|
|
181251
181372
|
|
|
181252
181373
|
// packages/omo-opencode/src/cli/boulder/formatter.ts
|
|
181253
181374
|
var import_picocolors22 = __toESM(require_picocolors(), 1);
|
|
@@ -181384,10 +181505,10 @@ async function boulder(options) {
|
|
|
181384
181505
|
const boulderFilePath = getBoulderFilePath(directory);
|
|
181385
181506
|
const state2 = readBoulderState(directory);
|
|
181386
181507
|
if (!state2) {
|
|
181387
|
-
const message =
|
|
181508
|
+
const message = existsSync62(boulderFilePath) ? formatReadErrorMessage(options.json) : formatNoBoulderMessage(options.json);
|
|
181388
181509
|
process.stderr.write(`${message}
|
|
181389
181510
|
`);
|
|
181390
|
-
return
|
|
181511
|
+
return existsSync62(boulderFilePath) ? 2 : 1;
|
|
181391
181512
|
}
|
|
181392
181513
|
const works = getBoulderWorks(state2);
|
|
181393
181514
|
const filteredWorks = options.workId ? works.filter((work) => work.work_id === options.workId) : works;
|
|
@@ -181982,25 +182103,25 @@ async function refreshModelCapabilities(options, deps = {}) {
|
|
|
181982
182103
|
// packages/skills-loader-core/src/features/opencode-skill-loader/loader.ts
|
|
181983
182104
|
init_src();
|
|
181984
182105
|
init_shared_skills();
|
|
181985
|
-
import { join as
|
|
182106
|
+
import { join as join63 } from "path";
|
|
181986
182107
|
|
|
181987
182108
|
// packages/skills-loader-core/src/shared/claude-config-dir.ts
|
|
181988
182109
|
init_src();
|
|
181989
|
-
import { join as
|
|
182110
|
+
import { join as join57 } from "path";
|
|
181990
182111
|
function getClaudeConfigDir() {
|
|
181991
182112
|
const envConfigDir = process.env.CLAUDE_CONFIG_DIR;
|
|
181992
182113
|
if (envConfigDir) {
|
|
181993
182114
|
return envConfigDir;
|
|
181994
182115
|
}
|
|
181995
|
-
return
|
|
182116
|
+
return join57(getHomeDirectory(), ".claude");
|
|
181996
182117
|
}
|
|
181997
182118
|
// packages/skills-loader-core/src/shared/opencode-command-dirs.ts
|
|
181998
|
-
import { basename as basename11, dirname as dirname22, join as
|
|
182119
|
+
import { basename as basename11, dirname as dirname22, join as join59 } from "path";
|
|
181999
182120
|
|
|
182000
182121
|
// packages/skills-loader-core/src/shared/opencode-config-dir.ts
|
|
182001
|
-
import { existsSync as
|
|
182002
|
-
import { homedir as
|
|
182003
|
-
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";
|
|
182004
182125
|
|
|
182005
182126
|
// packages/skills-loader-core/src/shared/plugin-identity.ts
|
|
182006
182127
|
init_src();
|
|
@@ -182033,15 +182154,15 @@ function getTauriConfigDir2(identifier) {
|
|
|
182033
182154
|
const platform2 = process.platform;
|
|
182034
182155
|
switch (platform2) {
|
|
182035
182156
|
case "darwin":
|
|
182036
|
-
return
|
|
182157
|
+
return join58(homedir22(), "Library", "Application Support", identifier);
|
|
182037
182158
|
case "win32": {
|
|
182038
|
-
const appData = process.env.APPDATA ||
|
|
182159
|
+
const appData = process.env.APPDATA || join58(homedir22(), "AppData", "Roaming");
|
|
182039
182160
|
return win325.join(appData, identifier);
|
|
182040
182161
|
}
|
|
182041
182162
|
case "linux":
|
|
182042
182163
|
default: {
|
|
182043
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME ||
|
|
182044
|
-
return
|
|
182164
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join58(homedir22(), ".config");
|
|
182165
|
+
return join58(xdgConfig, identifier);
|
|
182045
182166
|
}
|
|
182046
182167
|
}
|
|
182047
182168
|
}
|
|
@@ -182050,7 +182171,7 @@ function resolveConfigPath3(pathValue) {
|
|
|
182050
182171
|
return posix5.normalize(pathValue);
|
|
182051
182172
|
}
|
|
182052
182173
|
const resolvedPath = resolve12(pathValue);
|
|
182053
|
-
if (!
|
|
182174
|
+
if (!existsSync64(resolvedPath))
|
|
182054
182175
|
return resolvedPath;
|
|
182055
182176
|
try {
|
|
182056
182177
|
return realpathSync8(resolvedPath);
|
|
@@ -182084,8 +182205,8 @@ function getWslLinuxHomeDir2(windowsConfigRoot) {
|
|
|
182084
182205
|
function getCliDefaultConfigDir2() {
|
|
182085
182206
|
const envXdgConfig = process.env.XDG_CONFIG_HOME?.trim();
|
|
182086
182207
|
const shouldIgnoreWindowsXdg = envXdgConfig !== undefined && envXdgConfig.length > 0 && isWslEnvironment2() && isWindowsUserConfigRoot2(envXdgConfig);
|
|
182087
|
-
const xdgConfig = shouldIgnoreWindowsXdg ? posix5.join(getWslLinuxHomeDir2(envXdgConfig) ?? "/home", ".config") : envXdgConfig ||
|
|
182088
|
-
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");
|
|
182089
182210
|
return resolveConfigPath3(configDir);
|
|
182090
182211
|
}
|
|
182091
182212
|
function getCliCustomConfigDir2() {
|
|
@@ -182118,9 +182239,9 @@ function getOpenCodeConfigDir2(options) {
|
|
|
182118
182239
|
const tauriDir = process.platform === "win32" ? win325.isAbsolute(tauriDirBase) ? win325.normalize(tauriDirBase) : win325.resolve(tauriDirBase) : resolveConfigPath3(tauriDirBase);
|
|
182119
182240
|
if (checkExisting) {
|
|
182120
182241
|
const legacyDir = getCliConfigDir2();
|
|
182121
|
-
const legacyConfig =
|
|
182122
|
-
const legacyConfigC =
|
|
182123
|
-
if (
|
|
182242
|
+
const legacyConfig = join58(legacyDir, "opencode.json");
|
|
182243
|
+
const legacyConfigC = join58(legacyDir, "opencode.jsonc");
|
|
182244
|
+
if (existsSync64(legacyConfig) || existsSync64(legacyConfigC)) {
|
|
182124
182245
|
return legacyDir;
|
|
182125
182246
|
}
|
|
182126
182247
|
}
|
|
@@ -182141,21 +182262,21 @@ function getOpenCodeSkillDirs(options) {
|
|
|
182141
182262
|
...configDirs.flatMap((configDir) => {
|
|
182142
182263
|
const parentConfigDir = getParentOpencodeConfigDir(configDir);
|
|
182143
182264
|
return [
|
|
182144
|
-
|
|
182145
|
-
|
|
182146
|
-
...parentConfigDir ? [
|
|
182265
|
+
join59(configDir, "skills"),
|
|
182266
|
+
join59(configDir, "skill"),
|
|
182267
|
+
...parentConfigDir ? [join59(parentConfigDir, "skills"), join59(parentConfigDir, "skill")] : []
|
|
182147
182268
|
];
|
|
182148
182269
|
})
|
|
182149
182270
|
]));
|
|
182150
182271
|
}
|
|
182151
182272
|
// packages/skills-loader-core/src/shared/project-discovery-dirs.ts
|
|
182152
182273
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
182153
|
-
import { existsSync as
|
|
182154
|
-
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";
|
|
182155
182276
|
var worktreePathCache2 = new Map;
|
|
182156
182277
|
function normalizePath2(path18) {
|
|
182157
182278
|
const resolvedPath = process.platform !== "win32" && win326.isAbsolute(path18) ? path18 : resolve13(path18);
|
|
182158
|
-
if (!
|
|
182279
|
+
if (!existsSync65(resolvedPath)) {
|
|
182159
182280
|
return resolvedPath;
|
|
182160
182281
|
}
|
|
182161
182282
|
try {
|
|
@@ -182186,8 +182307,8 @@ function findAncestorDirectories(startDirectory, targetPaths, stopDirectory) {
|
|
|
182186
182307
|
const stopDirectoryKey = resolvedStopDirectory ? pathKey2(resolvedStopDirectory) : undefined;
|
|
182187
182308
|
while (true) {
|
|
182188
182309
|
for (const targetPath of targetPaths) {
|
|
182189
|
-
const candidateDirectory =
|
|
182190
|
-
if (!
|
|
182310
|
+
const candidateDirectory = join60(currentDirectory, ...targetPath);
|
|
182311
|
+
if (!existsSync65(candidateDirectory)) {
|
|
182191
182312
|
continue;
|
|
182192
182313
|
}
|
|
182193
182314
|
const normalizedCandidateDirectory = normalizePath2(candidateDirectory);
|
|
@@ -182269,7 +182390,7 @@ function deduplicateSkillsByName(skills2) {
|
|
|
182269
182390
|
// packages/skills-loader-core/src/features/opencode-skill-loader/skill-directory-loader.ts
|
|
182270
182391
|
init_src();
|
|
182271
182392
|
import * as fs20 from "fs/promises";
|
|
182272
|
-
import { join as
|
|
182393
|
+
import { join as join62 } from "path";
|
|
182273
182394
|
|
|
182274
182395
|
// packages/skills-loader-core/src/features/opencode-skill-loader/loaded-skill-from-path.ts
|
|
182275
182396
|
init_src();
|
|
@@ -182290,7 +182411,7 @@ function parseAllowedTools(allowedTools) {
|
|
|
182290
182411
|
// packages/skills-loader-core/src/features/opencode-skill-loader/skill-mcp-config.ts
|
|
182291
182412
|
init_js_yaml();
|
|
182292
182413
|
import * as fs18 from "fs/promises";
|
|
182293
|
-
import { join as
|
|
182414
|
+
import { join as join61 } from "path";
|
|
182294
182415
|
function parseSkillMcpConfigFromFrontmatter(content) {
|
|
182295
182416
|
const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
182296
182417
|
if (!frontmatterMatch)
|
|
@@ -182309,7 +182430,7 @@ function parseSkillMcpConfigFromFrontmatter(content) {
|
|
|
182309
182430
|
return;
|
|
182310
182431
|
}
|
|
182311
182432
|
async function loadMcpJsonFromDir(skillDir) {
|
|
182312
|
-
const mcpJsonPath =
|
|
182433
|
+
const mcpJsonPath = join61(skillDir, "mcp.json");
|
|
182313
182434
|
try {
|
|
182314
182435
|
const content = await fs18.readFile(mcpJsonPath, "utf-8");
|
|
182315
182436
|
const parsed = JSON.parse(content);
|
|
@@ -182425,10 +182546,10 @@ async function loadSkillsFromDir(options) {
|
|
|
182425
182546
|
const directories = entries.filter((entry) => !entry.name.startsWith(".") && (entry.isDirectory() || entry.isSymbolicLink()));
|
|
182426
182547
|
const files = entries.filter((entry) => !entry.name.startsWith(".") && !entry.isDirectory() && !entry.isSymbolicLink() && isMarkdownFile(entry));
|
|
182427
182548
|
for (const entry of directories) {
|
|
182428
|
-
const entryPath =
|
|
182549
|
+
const entryPath = join62(options.skillsDir, entry.name);
|
|
182429
182550
|
const resolvedPath = await resolveSymlinkAsync(entryPath);
|
|
182430
182551
|
const dirName = entry.name;
|
|
182431
|
-
const skillMdPath =
|
|
182552
|
+
const skillMdPath = join62(resolvedPath, "SKILL.md");
|
|
182432
182553
|
if (await canAccessFile(skillMdPath)) {
|
|
182433
182554
|
const skill = await loadSkillFromPath({
|
|
182434
182555
|
skillPath: skillMdPath,
|
|
@@ -182442,7 +182563,7 @@ async function loadSkillsFromDir(options) {
|
|
|
182442
182563
|
}
|
|
182443
182564
|
continue;
|
|
182444
182565
|
}
|
|
182445
|
-
const namedSkillMdPath =
|
|
182566
|
+
const namedSkillMdPath = join62(resolvedPath, `${dirName}.md`);
|
|
182446
182567
|
if (await canAccessFile(namedSkillMdPath)) {
|
|
182447
182568
|
const skill = await loadSkillFromPath({
|
|
182448
182569
|
skillPath: namedSkillMdPath,
|
|
@@ -182473,7 +182594,7 @@ async function loadSkillsFromDir(options) {
|
|
|
182473
182594
|
}
|
|
182474
182595
|
}
|
|
182475
182596
|
for (const entry of files) {
|
|
182476
|
-
const entryPath =
|
|
182597
|
+
const entryPath = join62(options.skillsDir, entry.name);
|
|
182477
182598
|
const baseName = inferSkillNameFromFileName(entryPath);
|
|
182478
182599
|
const skill = await loadSkillFromPath({
|
|
182479
182600
|
skillPath: entryPath,
|
|
@@ -182525,7 +182646,7 @@ async function discoverAllSkills(directory) {
|
|
|
182525
182646
|
]);
|
|
182526
182647
|
}
|
|
182527
182648
|
async function discoverUserClaudeSkills() {
|
|
182528
|
-
const userSkillsDir =
|
|
182649
|
+
const userSkillsDir = join63(getClaudeConfigDir(), "skills");
|
|
182529
182650
|
return loadSkillsFromDir({ skillsDir: userSkillsDir, scope: "user" });
|
|
182530
182651
|
}
|
|
182531
182652
|
async function discoverProjectClaudeSkills(directory) {
|
|
@@ -182552,7 +182673,7 @@ async function discoverProjectAgentsSkills(directory) {
|
|
|
182552
182673
|
return deduplicateSkillsByName(allSkills.flat());
|
|
182553
182674
|
}
|
|
182554
182675
|
async function discoverGlobalAgentsSkills(homeDirectory = getHomeDirectory()) {
|
|
182555
|
-
const agentsGlobalDir =
|
|
182676
|
+
const agentsGlobalDir = join63(homeDirectory, ".agents", "skills");
|
|
182556
182677
|
return loadSkillsFromDir({ skillsDir: agentsGlobalDir, scope: "user" });
|
|
182557
182678
|
}
|
|
182558
182679
|
// packages/skills-loader-core/src/features/opencode-skill-loader/merger/builtin-skill-converter.ts
|
|
@@ -183304,7 +183425,7 @@ playwright-cli close
|
|
|
183304
183425
|
init_shared_skills();
|
|
183305
183426
|
init_src();
|
|
183306
183427
|
import { readFileSync as readFileSync50 } from "fs";
|
|
183307
|
-
import { join as
|
|
183428
|
+
import { join as join64 } from "path";
|
|
183308
183429
|
function createSharedSkillTemplateLoader(readFile3 = readFileSync50, skillsRootPath = sharedSkillsRootPath()) {
|
|
183309
183430
|
const cache = new Map;
|
|
183310
183431
|
return (skillName) => {
|
|
@@ -183312,7 +183433,7 @@ function createSharedSkillTemplateLoader(readFile3 = readFileSync50, skillsRootP
|
|
|
183312
183433
|
if (cached2 !== undefined)
|
|
183313
183434
|
return cached2;
|
|
183314
183435
|
try {
|
|
183315
|
-
const { body } = parseFrontmatter(readFile3(
|
|
183436
|
+
const { body } = parseFrontmatter(readFile3(join64(skillsRootPath, skillName, "SKILL.md"), "utf8"));
|
|
183316
183437
|
cache.set(skillName, body);
|
|
183317
183438
|
return body;
|
|
183318
183439
|
} catch (error51) {
|
|
@@ -184449,7 +184570,7 @@ var gitMasterSkill = {
|
|
|
184449
184570
|
template: GIT_MASTER_TEMPLATE
|
|
184450
184571
|
};
|
|
184451
184572
|
// packages/skills-loader-core/src/features/builtin-skills/skills/dev-browser.ts
|
|
184452
|
-
import { dirname as dirname24, join as
|
|
184573
|
+
import { dirname as dirname24, join as join65 } from "path";
|
|
184453
184574
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
184454
184575
|
var CURRENT_DIR = dirname24(fileURLToPath8(import.meta.url));
|
|
184455
184576
|
var devBrowserSkill = {
|
|
@@ -184669,7 +184790,7 @@ console.log({
|
|
|
184669
184790
|
await client.disconnect();
|
|
184670
184791
|
EOF
|
|
184671
184792
|
\`\`\``,
|
|
184672
|
-
resolvedPath:
|
|
184793
|
+
resolvedPath: join65(CURRENT_DIR, "..", "dev-browser")
|
|
184673
184794
|
};
|
|
184674
184795
|
// packages/skills-loader-core/src/features/builtin-skills/skills/review-work.ts
|
|
184675
184796
|
var reviewWorkSkill = {
|
|
@@ -185662,9 +185783,9 @@ function applySnapshotRetention(options) {
|
|
|
185662
185783
|
// packages/omo-opencode/src/cli/snapshot/snapshot.ts
|
|
185663
185784
|
import { Database as Database3 } from "bun:sqlite";
|
|
185664
185785
|
import {
|
|
185665
|
-
existsSync as
|
|
185666
|
-
mkdirSync as
|
|
185667
|
-
copyFileSync as
|
|
185786
|
+
existsSync as existsSync67,
|
|
185787
|
+
mkdirSync as mkdirSync21,
|
|
185788
|
+
copyFileSync as copyFileSync4,
|
|
185668
185789
|
readFileSync as readFileSync51,
|
|
185669
185790
|
writeFileSync as writeFileSync19,
|
|
185670
185791
|
readdirSync as readdirSync10,
|
|
@@ -185678,13 +185799,13 @@ async function snapshotCli(options = {}) {
|
|
|
185678
185799
|
const homeDir = os7.homedir();
|
|
185679
185800
|
const snapshotDir = options.snapshotDir ?? path18.join(homeDir, ".matrixos", "snapshots");
|
|
185680
185801
|
const allPaths = getAllSnapshotPaths(homeDir);
|
|
185681
|
-
const files = allPaths.files.filter((f2) =>
|
|
185802
|
+
const files = allPaths.files.filter((f2) => existsSync67(f2.sourcePath));
|
|
185682
185803
|
const realFs = {
|
|
185683
|
-
existsSync:
|
|
185684
|
-
mkdirSync:
|
|
185804
|
+
existsSync: existsSync67,
|
|
185805
|
+
mkdirSync: mkdirSync21,
|
|
185685
185806
|
readFileSync: readFileSync51,
|
|
185686
185807
|
writeFileSync: writeFileSync19,
|
|
185687
|
-
copyFileSync:
|
|
185808
|
+
copyFileSync: copyFileSync4,
|
|
185688
185809
|
readdirSync: readdirSync10,
|
|
185689
185810
|
statSync: statSync8,
|
|
185690
185811
|
rmSync: rmSync4
|
|
@@ -185745,9 +185866,9 @@ async function snapshotCli(options = {}) {
|
|
|
185745
185866
|
|
|
185746
185867
|
// packages/omo-opencode/src/cli/snapshot/restore.ts
|
|
185747
185868
|
import {
|
|
185748
|
-
existsSync as
|
|
185749
|
-
mkdirSync as
|
|
185750
|
-
copyFileSync as
|
|
185869
|
+
existsSync as existsSync68,
|
|
185870
|
+
mkdirSync as mkdirSync22,
|
|
185871
|
+
copyFileSync as copyFileSync5,
|
|
185751
185872
|
readFileSync as readFileSync52,
|
|
185752
185873
|
writeFileSync as writeFileSync20,
|
|
185753
185874
|
readdirSync as readdirSync11,
|
|
@@ -185759,11 +185880,11 @@ import * as os8 from "os";
|
|
|
185759
185880
|
async function restoreCli(options) {
|
|
185760
185881
|
const snapshotDir = options.snapshotDir ?? path19.join(os8.homedir(), ".matrixos", "snapshots");
|
|
185761
185882
|
const realFs = {
|
|
185762
|
-
existsSync:
|
|
185763
|
-
mkdirSync:
|
|
185883
|
+
existsSync: existsSync68,
|
|
185884
|
+
mkdirSync: mkdirSync22,
|
|
185764
185885
|
readFileSync: readFileSync52,
|
|
185765
185886
|
writeFileSync: writeFileSync20,
|
|
185766
|
-
copyFileSync:
|
|
185887
|
+
copyFileSync: copyFileSync5,
|
|
185767
185888
|
readdirSync: readdirSync11,
|
|
185768
185889
|
statSync: statSync9,
|
|
185769
185890
|
rmSync: rmSync5
|
|
@@ -185797,9 +185918,9 @@ async function restoreCli(options) {
|
|
|
185797
185918
|
|
|
185798
185919
|
// packages/omo-opencode/src/cli/snapshot/list.ts
|
|
185799
185920
|
import {
|
|
185800
|
-
existsSync as
|
|
185801
|
-
mkdirSync as
|
|
185802
|
-
copyFileSync as
|
|
185921
|
+
existsSync as existsSync69,
|
|
185922
|
+
mkdirSync as mkdirSync23,
|
|
185923
|
+
copyFileSync as copyFileSync6,
|
|
185803
185924
|
readFileSync as readFileSync53,
|
|
185804
185925
|
writeFileSync as writeFileSync21,
|
|
185805
185926
|
readdirSync as readdirSync12,
|
|
@@ -185821,11 +185942,11 @@ function formatBytes(bytes) {
|
|
|
185821
185942
|
async function snapshotListCli(options) {
|
|
185822
185943
|
const snapshotDir = options.snapshotDir ?? path20.join(os9.homedir(), ".matrixos", "snapshots");
|
|
185823
185944
|
const realFs = {
|
|
185824
|
-
existsSync:
|
|
185825
|
-
mkdirSync:
|
|
185945
|
+
existsSync: existsSync69,
|
|
185946
|
+
mkdirSync: mkdirSync23,
|
|
185826
185947
|
readFileSync: readFileSync53,
|
|
185827
185948
|
writeFileSync: writeFileSync21,
|
|
185828
|
-
copyFileSync:
|
|
185949
|
+
copyFileSync: copyFileSync6,
|
|
185829
185950
|
readdirSync: readdirSync12,
|
|
185830
185951
|
statSync: statSync10,
|
|
185831
185952
|
rmSync: rmSync6
|
|
@@ -185851,9 +185972,9 @@ async function snapshotListCli(options) {
|
|
|
185851
185972
|
|
|
185852
185973
|
// packages/omo-opencode/src/cli/snapshot/prune.ts
|
|
185853
185974
|
import {
|
|
185854
|
-
existsSync as
|
|
185855
|
-
mkdirSync as
|
|
185856
|
-
copyFileSync as
|
|
185975
|
+
existsSync as existsSync70,
|
|
185976
|
+
mkdirSync as mkdirSync24,
|
|
185977
|
+
copyFileSync as copyFileSync7,
|
|
185857
185978
|
readFileSync as readFileSync54,
|
|
185858
185979
|
writeFileSync as writeFileSync22,
|
|
185859
185980
|
readdirSync as readdirSync13,
|
|
@@ -185865,11 +185986,11 @@ import * as os10 from "os";
|
|
|
185865
185986
|
async function snapshotPruneCli(options = {}) {
|
|
185866
185987
|
const snapshotDir = options.snapshotDir ?? path21.join(os10.homedir(), ".matrixos", "snapshots");
|
|
185867
185988
|
const realFs = {
|
|
185868
|
-
existsSync:
|
|
185869
|
-
mkdirSync:
|
|
185989
|
+
existsSync: existsSync70,
|
|
185990
|
+
mkdirSync: mkdirSync24,
|
|
185870
185991
|
readFileSync: readFileSync54,
|
|
185871
185992
|
writeFileSync: writeFileSync22,
|
|
185872
|
-
copyFileSync:
|
|
185993
|
+
copyFileSync: copyFileSync7,
|
|
185873
185994
|
readdirSync: readdirSync13,
|
|
185874
185995
|
statSync: statSync11,
|
|
185875
185996
|
rmSync: rmSync7
|
|
@@ -185915,8 +186036,8 @@ function codebaseCli(rootProgram) {
|
|
|
185915
186036
|
try {
|
|
185916
186037
|
const dimension = Number.parseInt(options.dimension, 10) || 384;
|
|
185917
186038
|
const dbDir = path22.dirname(options.db);
|
|
185918
|
-
const { mkdirSync:
|
|
185919
|
-
|
|
186039
|
+
const { mkdirSync: mkdirSync25 } = await import("fs");
|
|
186040
|
+
mkdirSync25(dbDir, { recursive: true });
|
|
185920
186041
|
const store4 = createSqliteVectorStore({ path: options.db, dimension });
|
|
185921
186042
|
if (options.reset) {
|
|
185922
186043
|
store4.clear();
|
|
@@ -187133,7 +187254,7 @@ function loadGatewayPassphrase() {
|
|
|
187133
187254
|
}
|
|
187134
187255
|
async function dashboardCli(options) {
|
|
187135
187256
|
const port3 = options.port ?? 9123;
|
|
187136
|
-
const host = options.host ?? "
|
|
187257
|
+
const host = options.host ?? "0.0.0.0";
|
|
187137
187258
|
const frontendDir = path25.resolve(import.meta.dir, "../features/dashboard/frontend");
|
|
187138
187259
|
const gatewayPassphrase = loadGatewayPassphrase();
|
|
187139
187260
|
console.log(`[dashboard] starting MaTrixOS dashboard on http://${host}:${port3}`);
|
|
@@ -187167,11 +187288,11 @@ async function dashboardCli(options) {
|
|
|
187167
187288
|
}
|
|
187168
187289
|
|
|
187169
187290
|
// packages/omo-opencode/src/cli/architect.ts
|
|
187170
|
-
import { join as
|
|
187291
|
+
import { join as join75 } from "path";
|
|
187171
187292
|
var IMPROVEMENTS_DIR = ".matrixos/improvements";
|
|
187172
187293
|
function getStore(directory) {
|
|
187173
187294
|
const baseDir = directory ?? process.cwd();
|
|
187174
|
-
return createImprovementStore(
|
|
187295
|
+
return createImprovementStore(join75(baseDir, IMPROVEMENTS_DIR));
|
|
187175
187296
|
}
|
|
187176
187297
|
async function architectReview(options) {
|
|
187177
187298
|
const store4 = getStore(options.directory);
|