@kl-c/matrixos 0.2.8 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +410 -324
- package/dist/cli/slash-command-installer.d.ts +4 -0
- package/dist/cli-node/index.js +410 -324
- package/dist/index.js +74 -52
- package/dist/plugin/auto-adoption.d.ts +5 -3
- package/package.json +1 -1
package/dist/cli/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",
|
|
@@ -67682,6 +67682,83 @@ var init_add_tui_plugin_to_tui_config = __esm(() => {
|
|
|
67682
67682
|
init_write_file_atomically2();
|
|
67683
67683
|
});
|
|
67684
67684
|
|
|
67685
|
+
// packages/omo-opencode/src/cli/slash-command-installer.ts
|
|
67686
|
+
import { existsSync as existsSync26, mkdirSync as mkdirSync9, copyFileSync as copyFileSync3, symlinkSync, readlinkSync } from "fs";
|
|
67687
|
+
import { join as join25 } from "path";
|
|
67688
|
+
import { homedir as homedir6 } from "os";
|
|
67689
|
+
function copySlashCommandsTo(dir) {
|
|
67690
|
+
try {
|
|
67691
|
+
if (!existsSync26(dir))
|
|
67692
|
+
mkdirSync9(dir, { recursive: true });
|
|
67693
|
+
let copied = 0;
|
|
67694
|
+
for (const name2 of SLASH_COMMAND_NAMES) {
|
|
67695
|
+
const src = join25(import.meta.dir, "slash-commands", name2);
|
|
67696
|
+
if (!existsSync26(src))
|
|
67697
|
+
continue;
|
|
67698
|
+
copyFileSync3(src, join25(dir, name2));
|
|
67699
|
+
copied++;
|
|
67700
|
+
}
|
|
67701
|
+
return copied;
|
|
67702
|
+
} catch {
|
|
67703
|
+
return 0;
|
|
67704
|
+
}
|
|
67705
|
+
}
|
|
67706
|
+
function resolveMatrixosBin() {
|
|
67707
|
+
const candidates = [
|
|
67708
|
+
join25(import.meta.dir, "..", "..", "bin", "matrixos.js"),
|
|
67709
|
+
join25(import.meta.dir, "..", "bin", "matrixos.js")
|
|
67710
|
+
];
|
|
67711
|
+
for (const c of candidates) {
|
|
67712
|
+
if (existsSync26(c))
|
|
67713
|
+
return c;
|
|
67714
|
+
}
|
|
67715
|
+
return null;
|
|
67716
|
+
}
|
|
67717
|
+
function installSlashCommandsAndPath() {
|
|
67718
|
+
const home = homedir6();
|
|
67719
|
+
const targets = [
|
|
67720
|
+
join25(home, ".config", "opencode", "commands"),
|
|
67721
|
+
join25(home, ".claude", "commands")
|
|
67722
|
+
];
|
|
67723
|
+
let total = 0;
|
|
67724
|
+
for (const t of targets)
|
|
67725
|
+
total += copySlashCommandsTo(t);
|
|
67726
|
+
let pathLinked = false;
|
|
67727
|
+
const bin = resolveMatrixosBin();
|
|
67728
|
+
const linkPath = "/usr/local/bin/matrixos";
|
|
67729
|
+
if (bin) {
|
|
67730
|
+
try {
|
|
67731
|
+
if (existsSync26(linkPath)) {
|
|
67732
|
+
try {
|
|
67733
|
+
const cur = readlinkSync(linkPath);
|
|
67734
|
+
if (cur !== bin) {
|
|
67735
|
+
symlinkSync(bin, linkPath + ".new");
|
|
67736
|
+
copyFileSync3(bin, linkPath);
|
|
67737
|
+
}
|
|
67738
|
+
} catch {
|
|
67739
|
+
copyFileSync3(bin, linkPath);
|
|
67740
|
+
}
|
|
67741
|
+
} else {
|
|
67742
|
+
symlinkSync(bin, linkPath);
|
|
67743
|
+
}
|
|
67744
|
+
pathLinked = true;
|
|
67745
|
+
} catch {
|
|
67746
|
+
pathLinked = false;
|
|
67747
|
+
}
|
|
67748
|
+
}
|
|
67749
|
+
return { commands: total, pathLinked };
|
|
67750
|
+
}
|
|
67751
|
+
var SLASH_COMMAND_NAMES;
|
|
67752
|
+
var init_slash_command_installer = __esm(() => {
|
|
67753
|
+
SLASH_COMMAND_NAMES = [
|
|
67754
|
+
"adopt.md",
|
|
67755
|
+
"readopt.md",
|
|
67756
|
+
"matrix-gateway-adopt-telegram.md",
|
|
67757
|
+
"matrix.md",
|
|
67758
|
+
"features.md"
|
|
67759
|
+
];
|
|
67760
|
+
});
|
|
67761
|
+
|
|
67685
67762
|
// packages/shared-skills/index.mjs
|
|
67686
67763
|
import { fileURLToPath } from "url";
|
|
67687
67764
|
function sharedSkillsRootPath() {
|
|
@@ -67690,8 +67767,8 @@ function sharedSkillsRootPath() {
|
|
|
67690
67767
|
var init_shared_skills = () => {};
|
|
67691
67768
|
|
|
67692
67769
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
67693
|
-
import { homedir as
|
|
67694
|
-
import { join as
|
|
67770
|
+
import { homedir as homedir7 } from "os";
|
|
67771
|
+
import { join as join26 } from "path";
|
|
67695
67772
|
function describeResult(result) {
|
|
67696
67773
|
if (result.kind === "succeeded")
|
|
67697
67774
|
return null;
|
|
@@ -67701,9 +67778,9 @@ function describeResult(result) {
|
|
|
67701
67778
|
}
|
|
67702
67779
|
async function installAstGrepForOpenCode(options = {}) {
|
|
67703
67780
|
const platform = options.platform ?? process.platform;
|
|
67704
|
-
const baseDir =
|
|
67781
|
+
const baseDir = join26(options.homeDir ?? homedir7(), ".omo");
|
|
67705
67782
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
67706
|
-
const skillDir =
|
|
67783
|
+
const skillDir = join26(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
67707
67784
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
67708
67785
|
try {
|
|
67709
67786
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -67811,6 +67888,15 @@ async function runCliInstaller(args, version) {
|
|
|
67811
67888
|
if (config.hasOpenCode && !hasAnyConfiguredProvider(config)) {
|
|
67812
67889
|
printWarning(getNoModelProvidersWarning());
|
|
67813
67890
|
}
|
|
67891
|
+
try {
|
|
67892
|
+
const slash = installSlashCommandsAndPath();
|
|
67893
|
+
if (slash.commands > 0)
|
|
67894
|
+
printSuccess(`Slash commands installed (${slash.commands} files)`);
|
|
67895
|
+
if (slash.pathLinked)
|
|
67896
|
+
printSuccess("matrixos available on PATH (/usr/local/bin/matrixos)");
|
|
67897
|
+
} catch (error) {
|
|
67898
|
+
printWarning(`Slash-command setup skipped: ${error instanceof Error ? error.message : String(error)}`);
|
|
67899
|
+
}
|
|
67814
67900
|
console.log(`${SYMBOLS.star} ${import_picocolors3.default.bold(import_picocolors3.default.green(isUpdate ? "Configuration updated!" : "Installation complete!"))}`);
|
|
67815
67901
|
if (hasOpenCode) {
|
|
67816
67902
|
console.log(` Run ${import_picocolors3.default.cyan("opencode")} to start!`);
|
|
@@ -67872,6 +67958,7 @@ var init_cli_installer = __esm(() => {
|
|
|
67872
67958
|
init_star_request();
|
|
67873
67959
|
init_provider_availability();
|
|
67874
67960
|
init_add_tui_plugin_to_tui_config();
|
|
67961
|
+
init_slash_command_installer();
|
|
67875
67962
|
init_install_ast_grep_sg();
|
|
67876
67963
|
import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
67877
67964
|
});
|
|
@@ -69511,15 +69598,16 @@ var init_dist5 = __esm(() => {
|
|
|
69511
69598
|
});
|
|
69512
69599
|
|
|
69513
69600
|
// packages/omo-opencode/src/cli/config-manager/write-gateway-env.ts
|
|
69514
|
-
import {
|
|
69515
|
-
import {
|
|
69601
|
+
import { homedir as homedir8 } from "os";
|
|
69602
|
+
import { existsSync as existsSync27, mkdirSync as mkdirSync10, readFileSync as readFileSync15, writeFileSync as writeFileSync6, chmodSync as chmodSync3 } from "fs";
|
|
69603
|
+
import { join as join27 } from "path";
|
|
69516
69604
|
function writeGatewayEnvToken(key, token) {
|
|
69517
|
-
const configDir =
|
|
69518
|
-
if (!
|
|
69519
|
-
|
|
69520
|
-
const envPath =
|
|
69605
|
+
const configDir = homedir8();
|
|
69606
|
+
if (!existsSync27(configDir))
|
|
69607
|
+
mkdirSync10(configDir, { recursive: true });
|
|
69608
|
+
const envPath = join27(configDir, GATEWAY_ENV_FILENAME);
|
|
69521
69609
|
const entries = new Map;
|
|
69522
|
-
if (
|
|
69610
|
+
if (existsSync27(envPath)) {
|
|
69523
69611
|
const existing = readFileSync15(envPath, "utf-8");
|
|
69524
69612
|
for (const rawLine of existing.split(`
|
|
69525
69613
|
`)) {
|
|
@@ -69548,9 +69636,7 @@ function writeGatewayEnv(token) {
|
|
|
69548
69636
|
return writeGatewayEnvToken("TELEGRAM_BOT_TOKEN", token);
|
|
69549
69637
|
}
|
|
69550
69638
|
var GATEWAY_ENV_FILENAME = ".klc-gateway.env";
|
|
69551
|
-
var init_write_gateway_env =
|
|
69552
|
-
init_config_context();
|
|
69553
|
-
});
|
|
69639
|
+
var init_write_gateway_env = () => {};
|
|
69554
69640
|
|
|
69555
69641
|
// packages/omo-opencode/src/cli/senpi-platform-flag.ts
|
|
69556
69642
|
function isSenpiPlatformEnabled(env2 = process.env) {
|
|
@@ -121213,7 +121299,7 @@ var require_dist9 = __commonJS((exports, module2) => {
|
|
|
121213
121299
|
var import_node_worker_threads2 = __require("worker_threads");
|
|
121214
121300
|
var import_collection2 = require_dist2();
|
|
121215
121301
|
var import_node_events = __require("events");
|
|
121216
|
-
var
|
|
121302
|
+
var import_node_path25 = __require("path");
|
|
121217
121303
|
var import_node_worker_threads = __require("worker_threads");
|
|
121218
121304
|
var import_collection = require_dist2();
|
|
121219
121305
|
var WorkerSendPayloadOp = /* @__PURE__ */ ((WorkerSendPayloadOp2) => {
|
|
@@ -121348,18 +121434,18 @@ var require_dist9 = __commonJS((exports, module2) => {
|
|
|
121348
121434
|
resolveWorkerPath() {
|
|
121349
121435
|
const path7 = this.options.workerPath;
|
|
121350
121436
|
if (!path7) {
|
|
121351
|
-
return (0,
|
|
121437
|
+
return (0, import_node_path25.join)(__dirname, "defaultWorker.js");
|
|
121352
121438
|
}
|
|
121353
|
-
if ((0,
|
|
121439
|
+
if ((0, import_node_path25.isAbsolute)(path7)) {
|
|
121354
121440
|
return path7;
|
|
121355
121441
|
}
|
|
121356
121442
|
if (/^\.\.?[/\\]/.test(path7)) {
|
|
121357
|
-
return (0,
|
|
121443
|
+
return (0, import_node_path25.resolve)(path7);
|
|
121358
121444
|
}
|
|
121359
121445
|
try {
|
|
121360
121446
|
return __require.resolve(path7);
|
|
121361
121447
|
} catch {
|
|
121362
|
-
return (0,
|
|
121448
|
+
return (0, import_node_path25.resolve)(path7);
|
|
121363
121449
|
}
|
|
121364
121450
|
}
|
|
121365
121451
|
async waitForWorkerReady(worker) {
|
|
@@ -128876,8 +128962,8 @@ var init_writer2 = __esm(() => {
|
|
|
128876
128962
|
});
|
|
128877
128963
|
|
|
128878
128964
|
// packages/omo-config-core/src/generator/mini-os-generator.ts
|
|
128879
|
-
import { existsSync as
|
|
128880
|
-
import { dirname as dirname9, join as
|
|
128965
|
+
import { existsSync as existsSync29, mkdirSync as mkdirSync11, writeFileSync as writeFileSync8 } from "fs";
|
|
128966
|
+
import { dirname as dirname9, join as join28 } from "path";
|
|
128881
128967
|
function generateMiniOS(options) {
|
|
128882
128968
|
const fs6 = options.fs ?? defaultFS;
|
|
128883
128969
|
const profile2 = options.profile;
|
|
@@ -128888,29 +128974,29 @@ function generateMiniOS(options) {
|
|
|
128888
128974
|
if (!fs6.existsSync(targetDir)) {
|
|
128889
128975
|
fs6.mkdirSync(targetDir, { recursive: true });
|
|
128890
128976
|
}
|
|
128891
|
-
const pkgPath =
|
|
128977
|
+
const pkgPath = join28(targetDir, "package.json");
|
|
128892
128978
|
writeIfMissing(fs6, pkgPath, TPL_PACKAGE_JSON(packageName, displayName, profile2.version, profile2.description, profile2.extends, profile2.baseAgent));
|
|
128893
128979
|
filesWritten.push(pkgPath);
|
|
128894
|
-
const srcDir =
|
|
128980
|
+
const srcDir = join28(targetDir, "src");
|
|
128895
128981
|
fs6.mkdirSync(srcDir, { recursive: true });
|
|
128896
|
-
const indexPath =
|
|
128982
|
+
const indexPath = join28(srcDir, "index.ts");
|
|
128897
128983
|
writeIfMissing(fs6, indexPath, TPL_INDEX_TS(profile2.name, displayName, profile2.description));
|
|
128898
128984
|
filesWritten.push(indexPath);
|
|
128899
|
-
const binDir =
|
|
128985
|
+
const binDir = join28(targetDir, "bin");
|
|
128900
128986
|
fs6.mkdirSync(binDir, { recursive: true });
|
|
128901
|
-
const binPath =
|
|
128987
|
+
const binPath = join28(binDir, "matrixos-mini.js");
|
|
128902
128988
|
writeIfMissing(fs6, binPath, TPL_BIN);
|
|
128903
128989
|
filesWritten.push(binPath);
|
|
128904
|
-
const scriptDir =
|
|
128990
|
+
const scriptDir = join28(targetDir, "script");
|
|
128905
128991
|
fs6.mkdirSync(scriptDir, { recursive: true });
|
|
128906
|
-
const buildPath =
|
|
128992
|
+
const buildPath = join28(scriptDir, "build.ts");
|
|
128907
128993
|
writeIfMissing(fs6, buildPath, TPL_BUILD_TS);
|
|
128908
128994
|
filesWritten.push(buildPath);
|
|
128909
128995
|
if (Object.keys(profile2.agents).length > 0) {
|
|
128910
|
-
const agentsDir =
|
|
128996
|
+
const agentsDir = join28(targetDir, "agents");
|
|
128911
128997
|
fs6.mkdirSync(agentsDir, { recursive: true });
|
|
128912
128998
|
for (const [agentName, agentDef] of Object.entries(profile2.agents)) {
|
|
128913
|
-
const agentFile =
|
|
128999
|
+
const agentFile = join28(agentsDir, `${agentName}.ts`);
|
|
128914
129000
|
const description = agentDef.description ?? `Custom ${displayName} agent: ${agentName}`;
|
|
128915
129001
|
writeIfMissing(fs6, agentFile, `// ${description}
|
|
128916
129002
|
// Generated by MaTrixOS Mini-OS Profile Generator.
|
|
@@ -128921,10 +129007,10 @@ export const description = ${JSON.stringify(description)}
|
|
|
128921
129007
|
}
|
|
128922
129008
|
}
|
|
128923
129009
|
if (profile2.skills.length > 0) {
|
|
128924
|
-
const skillsDir =
|
|
129010
|
+
const skillsDir = join28(targetDir, "skills");
|
|
128925
129011
|
fs6.mkdirSync(skillsDir, { recursive: true });
|
|
128926
129012
|
for (const skill of profile2.skills) {
|
|
128927
|
-
const skillFile =
|
|
129013
|
+
const skillFile = join28(skillsDir, `${skill}.md`);
|
|
128928
129014
|
writeIfMissing(fs6, skillFile, `# ${skill}
|
|
128929
129015
|
|
|
128930
129016
|
_Skill required by the ${displayName} profile. Implementation goes here._
|
|
@@ -128932,12 +129018,12 @@ _Skill required by the ${displayName} profile. Implementation goes here._
|
|
|
128932
129018
|
filesWritten.push(skillFile);
|
|
128933
129019
|
}
|
|
128934
129020
|
}
|
|
128935
|
-
const readmePath =
|
|
129021
|
+
const readmePath = join28(targetDir, "README.md");
|
|
128936
129022
|
const agentsList = Object.keys(profile2.agents);
|
|
128937
129023
|
const skillsList = profile2.skills;
|
|
128938
129024
|
writeIfMissing(fs6, readmePath, TPL_README(packageName, displayName, profile2.description, profile2.version, profile2.baseAgent, profile2.extends, agentsList, skillsList));
|
|
128939
129025
|
filesWritten.push(readmePath);
|
|
128940
|
-
const agentsMdPath =
|
|
129026
|
+
const agentsMdPath = join28(targetDir, "AGENTS.md");
|
|
128941
129027
|
writeIfMissing(fs6, agentsMdPath, TPL_AGENT_MD(displayName, profile2.description));
|
|
128942
129028
|
filesWritten.push(agentsMdPath);
|
|
128943
129029
|
return { packageName, packageDir: targetDir, filesWritten };
|
|
@@ -129089,7 +129175,7 @@ This profile is activated when the user mentions the profile name in their reque
|
|
|
129089
129175
|
- Profiles can be composed: multiple profiles in \`profiles: [...]\` are merged in order.
|
|
129090
129176
|
`;
|
|
129091
129177
|
var init_mini_os_generator = __esm(() => {
|
|
129092
|
-
defaultFS = { existsSync:
|
|
129178
|
+
defaultFS = { existsSync: existsSync29, mkdirSync: mkdirSync11, writeFileSync: writeFileSync8 };
|
|
129093
129179
|
});
|
|
129094
129180
|
|
|
129095
129181
|
// packages/omo-config-core/src/generator/index.ts
|
|
@@ -129798,8 +129884,8 @@ var init_update_toasts = __esm(() => {
|
|
|
129798
129884
|
});
|
|
129799
129885
|
|
|
129800
129886
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
129801
|
-
import { existsSync as
|
|
129802
|
-
import { dirname as dirname17, join as
|
|
129887
|
+
import { existsSync as existsSync45 } from "fs";
|
|
129888
|
+
import { dirname as dirname17, join as join40 } from "path";
|
|
129803
129889
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
129804
129890
|
function defaultGetModuleHostingWorkspace() {
|
|
129805
129891
|
try {
|
|
@@ -129952,8 +130038,8 @@ var init_background_update_check = __esm(() => {
|
|
|
129952
130038
|
init_package_json_locator();
|
|
129953
130039
|
init_update_toasts();
|
|
129954
130040
|
defaultDeps4 = {
|
|
129955
|
-
existsSync:
|
|
129956
|
-
join:
|
|
130041
|
+
existsSync: existsSync45,
|
|
130042
|
+
join: join40,
|
|
129957
130043
|
runBunInstallWithDetails,
|
|
129958
130044
|
log: log2,
|
|
129959
130045
|
getOpenCodeCacheDir,
|
|
@@ -154937,7 +155023,7 @@ var require_libvips = __commonJS((exports2, module2) => {
|
|
|
154937
155023
|
shell: true
|
|
154938
155024
|
};
|
|
154939
155025
|
var vendorPath = path18.join(__dirname, "..", "vendor", minimumLibvipsVersion, platform());
|
|
154940
|
-
var
|
|
155026
|
+
var mkdirSync18 = function(dirPath) {
|
|
154941
155027
|
try {
|
|
154942
155028
|
fs18.mkdirSync(dirPath, { recursive: true });
|
|
154943
155029
|
} catch (err) {
|
|
@@ -154948,9 +155034,9 @@ var require_libvips = __commonJS((exports2, module2) => {
|
|
|
154948
155034
|
};
|
|
154949
155035
|
var cachePath = function() {
|
|
154950
155036
|
const npmCachePath = env4.npm_config_cache || (env4.APPDATA ? path18.join(env4.APPDATA, "npm-cache") : path18.join(os7.homedir(), ".npm"));
|
|
154951
|
-
|
|
155037
|
+
mkdirSync18(npmCachePath);
|
|
154952
155038
|
const libvipsCachePath = path18.join(npmCachePath, "_libvips");
|
|
154953
|
-
|
|
155039
|
+
mkdirSync18(libvipsCachePath);
|
|
154954
155040
|
return libvipsCachePath;
|
|
154955
155041
|
};
|
|
154956
155042
|
var integrity = function(platformAndArch) {
|
|
@@ -155027,7 +155113,7 @@ var require_libvips = __commonJS((exports2, module2) => {
|
|
|
155027
155113
|
removeVendoredLibvips,
|
|
155028
155114
|
pkgConfigPath,
|
|
155029
155115
|
useGlobalLibvips,
|
|
155030
|
-
mkdirSync:
|
|
155116
|
+
mkdirSync: mkdirSync18
|
|
155031
155117
|
};
|
|
155032
155118
|
});
|
|
155033
155119
|
|
|
@@ -164783,19 +164869,19 @@ __export(exports_generate, {
|
|
|
164783
164869
|
executeGenerateCommand: () => executeGenerateCommand,
|
|
164784
164870
|
ProfileNotFoundError: () => ProfileNotFoundError
|
|
164785
164871
|
});
|
|
164786
|
-
import { existsSync as
|
|
164787
|
-
import { dirname as dirname28, isAbsolute as isAbsolute6, join as
|
|
164872
|
+
import { existsSync as existsSync72, readFileSync as readFileSync57, realpathSync as realpathSync10 } from "fs";
|
|
164873
|
+
import { dirname as dirname28, isAbsolute as isAbsolute6, join as join77, resolve as resolve16 } from "path";
|
|
164788
164874
|
function profilesDirFor(opts) {
|
|
164789
164875
|
if (opts.profilesDir)
|
|
164790
164876
|
return opts.profilesDir;
|
|
164791
164877
|
if (opts.cwd)
|
|
164792
|
-
return
|
|
164793
|
-
return
|
|
164878
|
+
return join77(opts.cwd, PROFILES_RELATIVE);
|
|
164879
|
+
return join77(REPO_ROOT, PROFILES_RELATIVE);
|
|
164794
164880
|
}
|
|
164795
164881
|
function loadProfile(name2, options = {}) {
|
|
164796
164882
|
const fs22 = options.fs ?? defaultFS2;
|
|
164797
164883
|
const dir = profilesDirFor(options);
|
|
164798
|
-
const path27 =
|
|
164884
|
+
const path27 = join77(dir, `${name2}.json`);
|
|
164799
164885
|
if (!fs22.existsSync(path27)) {
|
|
164800
164886
|
throw new ProfileNotFoundError(name2);
|
|
164801
164887
|
}
|
|
@@ -164808,7 +164894,7 @@ function listProfiles(options = {}) {
|
|
|
164808
164894
|
const known = options.knownNames ?? ["trader", "plumber"];
|
|
164809
164895
|
const out = [];
|
|
164810
164896
|
for (const name2 of known) {
|
|
164811
|
-
const path27 =
|
|
164897
|
+
const path27 = join77(dir, `${name2}.json`);
|
|
164812
164898
|
if (fs22.existsSync(path27)) {
|
|
164813
164899
|
try {
|
|
164814
164900
|
const raw = JSON.parse(fs22.readFileSync(path27, "utf-8"));
|
|
@@ -164881,7 +164967,7 @@ var init_generate = __esm(() => {
|
|
|
164881
164967
|
init_src5();
|
|
164882
164968
|
init_src5();
|
|
164883
164969
|
REPO_ROOT = resolve16(dirname28(new URL(import.meta.url).pathname), "..", "..", "..", "..", "..");
|
|
164884
|
-
defaultFS2 = { existsSync:
|
|
164970
|
+
defaultFS2 = { existsSync: existsSync72, readFileSync: readFileSync57, realpathSync: realpathSync10 };
|
|
164885
164971
|
ProfileNotFoundError = class ProfileNotFoundError extends Error {
|
|
164886
164972
|
profileName;
|
|
164887
164973
|
constructor(profileName) {
|
|
@@ -165000,12 +165086,12 @@ __export(exports_cost_report, {
|
|
|
165000
165086
|
executeCostReportCommand: () => executeCostReportCommand
|
|
165001
165087
|
});
|
|
165002
165088
|
import { Database as Database6 } from "bun:sqlite";
|
|
165003
|
-
import { existsSync as
|
|
165089
|
+
import { existsSync as existsSync73 } from "fs";
|
|
165004
165090
|
import * as path28 from "path";
|
|
165005
165091
|
import * as os14 from "os";
|
|
165006
165092
|
function executeCostReportCommand(args) {
|
|
165007
165093
|
const dbPath = path28.join(os14.homedir(), ".matrixos", "cost.db");
|
|
165008
|
-
if (!
|
|
165094
|
+
if (!existsSync73(dbPath)) {
|
|
165009
165095
|
return { exitCode: 1, stdout: `No cost data available
|
|
165010
165096
|
` };
|
|
165011
165097
|
}
|
|
@@ -165135,8 +165221,8 @@ var exports_profile_resolve = {};
|
|
|
165135
165221
|
__export(exports_profile_resolve, {
|
|
165136
165222
|
executeProfileResolveCommand: () => executeProfileResolveCommand
|
|
165137
165223
|
});
|
|
165138
|
-
import { existsSync as
|
|
165139
|
-
import { join as
|
|
165224
|
+
import { existsSync as existsSync74, readdirSync as readdirSync15, readFileSync as readFileSync58 } from "fs";
|
|
165225
|
+
import { join as join80, resolve as resolve17, dirname as dirname29 } from "path";
|
|
165140
165226
|
function executeProfileResolveCommand(args) {
|
|
165141
165227
|
if (args.options.help) {
|
|
165142
165228
|
return {
|
|
@@ -165161,8 +165247,8 @@ function executeProfileResolveCommand(args) {
|
|
|
165161
165247
|
` };
|
|
165162
165248
|
}
|
|
165163
165249
|
const name2 = nameRaw.endsWith(".json") ? nameRaw.slice(0, -5) : nameRaw;
|
|
165164
|
-
const profilesDir =
|
|
165165
|
-
if (!
|
|
165250
|
+
const profilesDir = join80(REPO_ROOT2, PROFILES_RELATIVE2);
|
|
165251
|
+
if (!existsSync74(profilesDir)) {
|
|
165166
165252
|
return { exitCode: 1, stdout: `error: profiles directory not found at ${profilesDir}
|
|
165167
165253
|
` };
|
|
165168
165254
|
}
|
|
@@ -165181,7 +165267,7 @@ function executeProfileResolveCommand(args) {
|
|
|
165181
165267
|
const registry2 = {};
|
|
165182
165268
|
for (const file3 of profileFiles) {
|
|
165183
165269
|
try {
|
|
165184
|
-
const filePath =
|
|
165270
|
+
const filePath = join80(profilesDir, file3);
|
|
165185
165271
|
const raw = JSON.parse(readFileSync58(filePath, "utf-8"));
|
|
165186
165272
|
const profile2 = ProfileSchema.parse(raw);
|
|
165187
165273
|
registry2[profile2.name] = profile2;
|
|
@@ -165244,8 +165330,8 @@ __export(exports_export, {
|
|
|
165244
165330
|
getShell: () => getShell,
|
|
165245
165331
|
executeExportCommand: () => executeExportCommand
|
|
165246
165332
|
});
|
|
165247
|
-
import { existsSync as
|
|
165248
|
-
import { isAbsolute as isAbsolute7, join as
|
|
165333
|
+
import { existsSync as existsSync75, readFileSync as readFileSync59, writeFileSync as writeFileSync26, copyFileSync as copyFileSync8, realpathSync as realpathSync11, mkdirSync as mkdirSync27 } from "fs";
|
|
165334
|
+
import { isAbsolute as isAbsolute7, join as join81, resolve as resolve18, dirname as dirname30 } from "path";
|
|
165249
165335
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
165250
165336
|
function setShell(shell) {
|
|
165251
165337
|
activeShell = shell;
|
|
@@ -165286,7 +165372,7 @@ function executeExportCommand(args) {
|
|
|
165286
165372
|
return { exitCode: 1, stdout: `error: generate failed: ${message}
|
|
165287
165373
|
` };
|
|
165288
165374
|
}
|
|
165289
|
-
const pkgPath =
|
|
165375
|
+
const pkgPath = join81(absoluteTargetDir, "package.json");
|
|
165290
165376
|
let pkg;
|
|
165291
165377
|
try {
|
|
165292
165378
|
pkg = JSON.parse(fs24.readFileSync(pkgPath, "utf-8"));
|
|
@@ -165326,7 +165412,7 @@ ${packResult.stdout}
|
|
|
165326
165412
|
return { exitCode: 1, stdout: `error: npm pack produced no tarball name in output
|
|
165327
165413
|
` };
|
|
165328
165414
|
}
|
|
165329
|
-
let tgzPath =
|
|
165415
|
+
let tgzPath = join81(absoluteTargetDir, tgzName);
|
|
165330
165416
|
if (args.options.output) {
|
|
165331
165417
|
const outputPath = args.options.output;
|
|
165332
165418
|
const absoluteOutput = isAbsolute7(outputPath) ? outputPath : resolve18(process.cwd(), outputPath);
|
|
@@ -165367,12 +165453,12 @@ var init_export = __esm(() => {
|
|
|
165367
165453
|
};
|
|
165368
165454
|
activeShell = defaultShell;
|
|
165369
165455
|
defaultExportFS = {
|
|
165370
|
-
existsSync:
|
|
165456
|
+
existsSync: existsSync75,
|
|
165371
165457
|
readFileSync: readFileSync59,
|
|
165372
165458
|
writeFileSync: writeFileSync26,
|
|
165373
|
-
copyFileSync:
|
|
165459
|
+
copyFileSync: copyFileSync8,
|
|
165374
165460
|
realpathSync: realpathSync11,
|
|
165375
|
-
mkdirSync:
|
|
165461
|
+
mkdirSync: mkdirSync27
|
|
165376
165462
|
};
|
|
165377
165463
|
});
|
|
165378
165464
|
|
|
@@ -165396,23 +165482,23 @@ __export(exports_project_context, {
|
|
|
165396
165482
|
createProject: () => createProject,
|
|
165397
165483
|
archiveProject: () => archiveProject
|
|
165398
165484
|
});
|
|
165399
|
-
import { existsSync as
|
|
165400
|
-
import { join as
|
|
165485
|
+
import { existsSync as existsSync76, mkdirSync as mkdirSync28, readFileSync as readFileSync60, writeFileSync as writeFileSync27, rmSync as rmSync8 } from "fs";
|
|
165486
|
+
import { join as join82 } from "path";
|
|
165401
165487
|
function getMatrixOsDir(cwd = process.cwd()) {
|
|
165402
|
-
return
|
|
165488
|
+
return join82(cwd, ".matrixos");
|
|
165403
165489
|
}
|
|
165404
165490
|
function getProjectsDir(cwd) {
|
|
165405
|
-
return
|
|
165491
|
+
return join82(getMatrixOsDir(cwd), "projects");
|
|
165406
165492
|
}
|
|
165407
165493
|
function getProjectDir(slug, cwd) {
|
|
165408
|
-
return
|
|
165494
|
+
return join82(getProjectsDir(cwd), slug);
|
|
165409
165495
|
}
|
|
165410
165496
|
function getStatePath(cwd) {
|
|
165411
|
-
return
|
|
165497
|
+
return join82(getMatrixOsDir(cwd), "state.json");
|
|
165412
165498
|
}
|
|
165413
165499
|
function loadState(cwd) {
|
|
165414
165500
|
const path29 = getStatePath(cwd);
|
|
165415
|
-
if (!
|
|
165501
|
+
if (!existsSync76(path29))
|
|
165416
165502
|
return {};
|
|
165417
165503
|
try {
|
|
165418
165504
|
return JSON.parse(readFileSync60(path29, "utf-8"));
|
|
@@ -165422,13 +165508,13 @@ function loadState(cwd) {
|
|
|
165422
165508
|
}
|
|
165423
165509
|
function saveState(state2, cwd) {
|
|
165424
165510
|
const path29 = getStatePath(cwd);
|
|
165425
|
-
|
|
165511
|
+
mkdirSync28(getMatrixOsDir(cwd), { recursive: true });
|
|
165426
165512
|
writeFileSync27(path29, JSON.stringify(state2, null, 2) + `
|
|
165427
165513
|
`);
|
|
165428
165514
|
}
|
|
165429
165515
|
function loadProjectMeta(slug, cwd) {
|
|
165430
|
-
const path29 =
|
|
165431
|
-
if (!
|
|
165516
|
+
const path29 = join82(getProjectDir(slug, cwd), "meta.json");
|
|
165517
|
+
if (!existsSync76(path29))
|
|
165432
165518
|
return null;
|
|
165433
165519
|
try {
|
|
165434
165520
|
return JSON.parse(readFileSync60(path29, "utf-8"));
|
|
@@ -165438,16 +165524,16 @@ function loadProjectMeta(slug, cwd) {
|
|
|
165438
165524
|
}
|
|
165439
165525
|
function saveProjectMeta(slug, meta3, cwd) {
|
|
165440
165526
|
const dir = getProjectDir(slug, cwd);
|
|
165441
|
-
|
|
165442
|
-
const path29 =
|
|
165527
|
+
mkdirSync28(dir, { recursive: true });
|
|
165528
|
+
const path29 = join82(dir, "meta.json");
|
|
165443
165529
|
writeFileSync27(path29, JSON.stringify(meta3, null, 2) + `
|
|
165444
165530
|
`);
|
|
165445
165531
|
}
|
|
165446
165532
|
function initProjectFiles(slug, cwd) {
|
|
165447
165533
|
const dir = getProjectDir(slug, cwd);
|
|
165448
|
-
|
|
165449
|
-
const kanbanPath =
|
|
165450
|
-
if (!
|
|
165534
|
+
mkdirSync28(join82(dir, "kb"), { recursive: true });
|
|
165535
|
+
const kanbanPath = join82(dir, "kanban.json");
|
|
165536
|
+
if (!existsSync76(kanbanPath)) {
|
|
165451
165537
|
writeFileSync27(kanbanPath, JSON.stringify({ columns: ["todo", "in-progress", "review", "done"], tasks: [] }, null, 2) + `
|
|
165452
165538
|
`);
|
|
165453
165539
|
}
|
|
@@ -165457,7 +165543,7 @@ function createProject(slug, options = {}) {
|
|
|
165457
165543
|
throw new Error(`Invalid project slug "${slug}": only lowercase letters, numbers, - and _ are allowed.`);
|
|
165458
165544
|
}
|
|
165459
165545
|
const dir = getProjectDir(slug, options.cwd);
|
|
165460
|
-
if (
|
|
165546
|
+
if (existsSync76(dir)) {
|
|
165461
165547
|
throw new Error(`Project "${slug}" already exists.`);
|
|
165462
165548
|
}
|
|
165463
165549
|
const now = new Date().toISOString();
|
|
@@ -165478,7 +165564,7 @@ function createProject(slug, options = {}) {
|
|
|
165478
165564
|
function listProjects(cwd) {
|
|
165479
165565
|
const state2 = loadState(cwd);
|
|
165480
165566
|
const root = getProjectsDir(cwd);
|
|
165481
|
-
if (!
|
|
165567
|
+
if (!existsSync76(root))
|
|
165482
165568
|
return [];
|
|
165483
165569
|
const fs24 = __require("fs");
|
|
165484
165570
|
const items = [];
|
|
@@ -165526,7 +165612,7 @@ function unarchiveProject(slug, cwd) {
|
|
|
165526
165612
|
}
|
|
165527
165613
|
function deleteProject(slug, cwd) {
|
|
165528
165614
|
const dir = getProjectDir(slug, cwd);
|
|
165529
|
-
if (!
|
|
165615
|
+
if (!existsSync76(dir))
|
|
165530
165616
|
throw new Error(`Project "${slug}" does not exist.`);
|
|
165531
165617
|
rmSync8(dir, { recursive: true, force: true });
|
|
165532
165618
|
const state2 = loadState(cwd);
|
|
@@ -165557,8 +165643,8 @@ __export(exports_project_memory, {
|
|
|
165557
165643
|
isProjectEpisode: () => isProjectEpisode,
|
|
165558
165644
|
addKbDocument: () => addKbDocument
|
|
165559
165645
|
});
|
|
165560
|
-
import { existsSync as
|
|
165561
|
-
import { join as
|
|
165646
|
+
import { existsSync as existsSync77, mkdirSync as mkdirSync29, readFileSync as readFileSync61, readdirSync as readdirSync16, writeFileSync as writeFileSync28 } from "fs";
|
|
165647
|
+
import { join as join83 } from "path";
|
|
165562
165648
|
function tagWithProject(metadata = {}, projectSlug, cwd) {
|
|
165563
165649
|
const active = projectSlug ?? getActiveProject(cwd)?.slug;
|
|
165564
165650
|
if (!active)
|
|
@@ -165572,14 +165658,14 @@ function isProjectEpisode(ep, projectSlug, cwd) {
|
|
|
165572
165658
|
return ep.metadata?.project === target;
|
|
165573
165659
|
}
|
|
165574
165660
|
function listKbDocuments(projectSlug, cwd) {
|
|
165575
|
-
const kbDir =
|
|
165576
|
-
if (!
|
|
165661
|
+
const kbDir = join83(getProjectDir(projectSlug, cwd), "kb");
|
|
165662
|
+
if (!existsSync77(kbDir))
|
|
165577
165663
|
return [];
|
|
165578
165664
|
const docs = [];
|
|
165579
165665
|
for (const entry of readdirSync16(kbDir, { withFileTypes: true })) {
|
|
165580
165666
|
if (!entry.isFile())
|
|
165581
165667
|
continue;
|
|
165582
|
-
const path29 =
|
|
165668
|
+
const path29 = join83(kbDir, entry.name);
|
|
165583
165669
|
try {
|
|
165584
165670
|
docs.push({ path: path29, content: readFileSync61(path29, "utf-8") });
|
|
165585
165671
|
} catch {}
|
|
@@ -165623,10 +165709,10 @@ async function searchProject(query, options = {}) {
|
|
|
165623
165709
|
return [...kbHits, ...memoryHits].sort((a2, b2) => b2.score - a2.score);
|
|
165624
165710
|
}
|
|
165625
165711
|
function addKbDocument(projectSlug, filename, content, cwd) {
|
|
165626
|
-
const kbDir =
|
|
165627
|
-
|
|
165712
|
+
const kbDir = join83(getProjectDir(projectSlug, cwd), "kb");
|
|
165713
|
+
mkdirSync29(kbDir, { recursive: true });
|
|
165628
165714
|
const safeName = filename.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
165629
|
-
const path29 =
|
|
165715
|
+
const path29 = join83(kbDir, safeName);
|
|
165630
165716
|
writeFileSync28(path29, content, "utf-8");
|
|
165631
165717
|
return path29;
|
|
165632
165718
|
}
|
|
@@ -166003,10 +166089,10 @@ __export(exports_gateway_start, {
|
|
|
166003
166089
|
buildTelegramConfig: () => buildTelegramConfig,
|
|
166004
166090
|
buildGatewayConfig: () => buildGatewayConfig
|
|
166005
166091
|
});
|
|
166006
|
-
import { readFileSync as readFileSync62, existsSync as
|
|
166092
|
+
import { readFileSync as readFileSync62, existsSync as existsSync78 } from "fs";
|
|
166007
166093
|
import { resolve as resolve19 } from "path";
|
|
166008
166094
|
function loadGatewayEnv(path29 = ENV_PATH) {
|
|
166009
|
-
if (!
|
|
166095
|
+
if (!existsSync78(path29))
|
|
166010
166096
|
return {};
|
|
166011
166097
|
const text = readFileSync62(path29, "utf8");
|
|
166012
166098
|
const out = {};
|
|
@@ -166145,7 +166231,7 @@ var init_deployment_core = __esm(() => {
|
|
|
166145
166231
|
|
|
166146
166232
|
// packages/omo-opencode/src/deployment/deploy-static.ts
|
|
166147
166233
|
import { spawn as spawn6 } from "child_process";
|
|
166148
|
-
import { existsSync as
|
|
166234
|
+
import { existsSync as existsSync79 } from "fs";
|
|
166149
166235
|
import { resolve as resolve20 } from "path";
|
|
166150
166236
|
function pushStage(stage, message, ok = true) {
|
|
166151
166237
|
return { stage, message, ok };
|
|
@@ -166202,7 +166288,7 @@ var init_deploy_static = __esm(() => {
|
|
|
166202
166288
|
}
|
|
166203
166289
|
stages.push(pushStage("build", "build succeeded"));
|
|
166204
166290
|
}
|
|
166205
|
-
if (!
|
|
166291
|
+
if (!existsSync79(buildDir)) {
|
|
166206
166292
|
stages.push(pushStage("push", `build directory not found: ${buildDir}`, false));
|
|
166207
166293
|
return { target: "static", ok: false, stages, error: "build directory missing" };
|
|
166208
166294
|
}
|
|
@@ -166478,10 +166564,10 @@ var init_deployment = __esm(() => {
|
|
|
166478
166564
|
});
|
|
166479
166565
|
|
|
166480
166566
|
// packages/omo-opencode/src/audit/self-audit.ts
|
|
166481
|
-
import { existsSync as
|
|
166482
|
-
import { join as
|
|
166567
|
+
import { existsSync as existsSync80, mkdirSync as mkdirSync30, readdirSync as readdirSync17, readFileSync as readFileSync63, writeFileSync as writeFileSync29 } from "fs";
|
|
166568
|
+
import { join as join84 } from "path";
|
|
166483
166569
|
function getAuditDir(cwd = process.cwd()) {
|
|
166484
|
-
return
|
|
166570
|
+
return join84(cwd, ".matrixos", "audits");
|
|
166485
166571
|
}
|
|
166486
166572
|
function getWeekString(date5 = new Date) {
|
|
166487
166573
|
const d = new Date(Date.UTC(date5.getFullYear(), date5.getMonth(), date5.getDate()));
|
|
@@ -166588,8 +166674,8 @@ function formatAuditReport(report) {
|
|
|
166588
166674
|
}
|
|
166589
166675
|
function writeAuditReport(report, cwd) {
|
|
166590
166676
|
const dir = getAuditDir(cwd);
|
|
166591
|
-
|
|
166592
|
-
const path29 =
|
|
166677
|
+
mkdirSync30(dir, { recursive: true });
|
|
166678
|
+
const path29 = join84(dir, `${report.week}.md`);
|
|
166593
166679
|
writeFileSync29(path29, formatAuditReport(report), "utf-8");
|
|
166594
166680
|
return path29;
|
|
166595
166681
|
}
|
|
@@ -167556,7 +167642,7 @@ async function processEvents(ctx, stream, state) {
|
|
|
167556
167642
|
}
|
|
167557
167643
|
// packages/omo-opencode/src/plugin-config/layered-config-loader.ts
|
|
167558
167644
|
import * as fs7 from "fs";
|
|
167559
|
-
import { homedir as
|
|
167645
|
+
import { homedir as homedir9 } from "os";
|
|
167560
167646
|
import * as path7 from "path";
|
|
167561
167647
|
|
|
167562
167648
|
// packages/omo-opencode/src/config/schema/agent-names.ts
|
|
@@ -168540,7 +168626,7 @@ function loadConfigFromPath(configPath, _ctx) {
|
|
|
168540
168626
|
|
|
168541
168627
|
// packages/omo-opencode/src/plugin-config/layered-config-loader.ts
|
|
168542
168628
|
function resolveHomeDirectory() {
|
|
168543
|
-
return process.env.HOME ?? process.env.USERPROFILE ??
|
|
168629
|
+
return process.env.HOME ?? process.env.USERPROFILE ?? homedir9();
|
|
168544
168630
|
}
|
|
168545
168631
|
function resolveConfigPathAfterLegacyMigration(detectedPath) {
|
|
168546
168632
|
if (!path7.basename(detectedPath).startsWith(LEGACY_CONFIG_BASENAME)) {
|
|
@@ -169132,7 +169218,7 @@ var BOULDER_STATE_PATH = `${BOULDER_DIR}/${BOULDER_FILE}`;
|
|
|
169132
169218
|
var NOTEPAD_DIR = "notepads";
|
|
169133
169219
|
var NOTEPAD_BASE_PATH = `${BOULDER_DIR}/${NOTEPAD_DIR}`;
|
|
169134
169220
|
// packages/boulder-state/src/top-level-task.ts
|
|
169135
|
-
import { existsSync as
|
|
169221
|
+
import { existsSync as existsSync32, readFileSync as readFileSync18 } from "fs";
|
|
169136
169222
|
var TODO_HEADING_PATTERN = /^##\s+TODOs\b/i;
|
|
169137
169223
|
var FINAL_VERIFICATION_HEADING_PATTERN = /^##\s+Final Verification Wave\b/i;
|
|
169138
169224
|
var SECOND_LEVEL_HEADING_PATTERN = /^##\s+/;
|
|
@@ -169155,7 +169241,7 @@ function buildTaskRef(section, taskLabel) {
|
|
|
169155
169241
|
};
|
|
169156
169242
|
}
|
|
169157
169243
|
function readCurrentTopLevelTask(planPath) {
|
|
169158
|
-
if (!
|
|
169244
|
+
if (!existsSync32(planPath)) {
|
|
169159
169245
|
return null;
|
|
169160
169246
|
}
|
|
169161
169247
|
try {
|
|
@@ -169184,10 +169270,10 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
169184
169270
|
}
|
|
169185
169271
|
}
|
|
169186
169272
|
// packages/boulder-state/src/storage/path.ts
|
|
169187
|
-
import { existsSync as
|
|
169188
|
-
import { isAbsolute as isAbsolute4, join as
|
|
169273
|
+
import { existsSync as existsSync33 } from "fs";
|
|
169274
|
+
import { isAbsolute as isAbsolute4, join as join30, relative as relative3, resolve as resolve8 } from "path";
|
|
169189
169275
|
function getBoulderFilePath(directory) {
|
|
169190
|
-
return
|
|
169276
|
+
return join30(directory, BOULDER_DIR, BOULDER_FILE);
|
|
169191
169277
|
}
|
|
169192
169278
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
169193
169279
|
return isAbsolute4(trackedPath) ? resolve8(trackedPath) : resolve8(baseDirectory, trackedPath);
|
|
@@ -169205,13 +169291,13 @@ function resolveBoulderPlanPath(directory, state) {
|
|
|
169205
169291
|
}
|
|
169206
169292
|
const absoluteWorktreePath = resolveTrackedPath(directory, worktreePath);
|
|
169207
169293
|
const worktreePlanPath = resolve8(absoluteWorktreePath, relativePlanPath);
|
|
169208
|
-
return
|
|
169294
|
+
return existsSync33(worktreePlanPath) ? worktreePlanPath : absolutePlanPath;
|
|
169209
169295
|
}
|
|
169210
169296
|
function resolveBoulderPlanPathForWork(directory, work) {
|
|
169211
169297
|
return resolveBoulderPlanPath(directory, work);
|
|
169212
169298
|
}
|
|
169213
169299
|
// packages/boulder-state/src/storage/plan-progress.ts
|
|
169214
|
-
import { existsSync as
|
|
169300
|
+
import { existsSync as existsSync34, readFileSync as readFileSync19, readdirSync as readdirSync4, statSync as statSync5 } from "fs";
|
|
169215
169301
|
var TODO_HEADING_PATTERN2 = /^##\s+TODOs\b/i;
|
|
169216
169302
|
var FINAL_VERIFICATION_HEADING_PATTERN2 = /^##\s+Final Verification Wave\b/i;
|
|
169217
169303
|
var SECOND_LEVEL_HEADING_PATTERN2 = /^##\s+/;
|
|
@@ -169220,7 +169306,7 @@ var CHECKED_CHECKBOX_PATTERN = /^(\s*)[-*]\s*\[[xX]\]\s*(.+)$/;
|
|
|
169220
169306
|
var TODO_TASK_PATTERN2 = /^\d+\.\s+/;
|
|
169221
169307
|
var FINAL_WAVE_TASK_PATTERN2 = /^F\d+\.\s+/i;
|
|
169222
169308
|
function getPlanProgress(planPath) {
|
|
169223
|
-
if (!
|
|
169309
|
+
if (!existsSync34(planPath)) {
|
|
169224
169310
|
return { total: 0, completed: 0, isComplete: false };
|
|
169225
169311
|
}
|
|
169226
169312
|
try {
|
|
@@ -169340,10 +169426,10 @@ function selectMirrorWork(state) {
|
|
|
169340
169426
|
return sorted[0] ?? null;
|
|
169341
169427
|
}
|
|
169342
169428
|
// packages/boulder-state/src/storage/read-state.ts
|
|
169343
|
-
import { existsSync as
|
|
169429
|
+
import { existsSync as existsSync35, readFileSync as readFileSync20 } from "fs";
|
|
169344
169430
|
function readBoulderState(directory) {
|
|
169345
169431
|
const filePath = getBoulderFilePath(directory);
|
|
169346
|
-
if (!
|
|
169432
|
+
if (!existsSync35(filePath)) {
|
|
169347
169433
|
return null;
|
|
169348
169434
|
}
|
|
169349
169435
|
try {
|
|
@@ -169413,14 +169499,14 @@ init_state();
|
|
|
169413
169499
|
// packages/omo-opencode/src/features/run-continuation-state/constants.ts
|
|
169414
169500
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
169415
169501
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
169416
|
-
import { existsSync as
|
|
169417
|
-
import { join as
|
|
169502
|
+
import { existsSync as existsSync36, mkdirSync as mkdirSync12, readFileSync as readFileSync21, rmSync as rmSync2, writeFileSync as writeFileSync9 } from "fs";
|
|
169503
|
+
import { join as join31 } from "path";
|
|
169418
169504
|
function getMarkerPath(directory, sessionID) {
|
|
169419
|
-
return
|
|
169505
|
+
return join31(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
169420
169506
|
}
|
|
169421
169507
|
function readContinuationMarker(directory, sessionID) {
|
|
169422
169508
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
169423
|
-
if (!
|
|
169509
|
+
if (!existsSync36(markerPath))
|
|
169424
169510
|
return null;
|
|
169425
169511
|
try {
|
|
169426
169512
|
const raw = readFileSync21(markerPath, "utf-8");
|
|
@@ -169489,7 +169575,7 @@ async function isSessionInBoulderLineage(input) {
|
|
|
169489
169575
|
init_shared();
|
|
169490
169576
|
init_compaction_marker();
|
|
169491
169577
|
import { readFileSync as readFileSync22, readdirSync as readdirSync5 } from "fs";
|
|
169492
|
-
import { join as
|
|
169578
|
+
import { join as join32 } from "path";
|
|
169493
169579
|
var defaultSessionLastAgentDeps = {
|
|
169494
169580
|
getMessageDir,
|
|
169495
169581
|
isSqliteBackend,
|
|
@@ -169549,7 +169635,7 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
|
|
|
169549
169635
|
try {
|
|
169550
169636
|
const messages = readdirSync5(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
169551
169637
|
try {
|
|
169552
|
-
const content = readFileSync22(
|
|
169638
|
+
const content = readFileSync22(join32(messageDir, fileName), "utf-8");
|
|
169553
169639
|
const parsed = JSON.parse(content);
|
|
169554
169640
|
return {
|
|
169555
169641
|
fileName,
|
|
@@ -169592,8 +169678,8 @@ init_agent_display_names();
|
|
|
169592
169678
|
|
|
169593
169679
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
169594
169680
|
init_frontmatter2();
|
|
169595
|
-
import { existsSync as
|
|
169596
|
-
import { dirname as dirname12, join as
|
|
169681
|
+
import { existsSync as existsSync37, readFileSync as readFileSync23, writeFileSync as writeFileSync10, unlinkSync as unlinkSync5, mkdirSync as mkdirSync13 } from "fs";
|
|
169682
|
+
import { dirname as dirname12, join as join33 } from "path";
|
|
169597
169683
|
|
|
169598
169684
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
169599
169685
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -169602,11 +169688,11 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
169602
169688
|
|
|
169603
169689
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
169604
169690
|
function getStateFilePath(directory, customPath) {
|
|
169605
|
-
return customPath ?
|
|
169691
|
+
return customPath ? join33(directory, customPath) : join33(directory, DEFAULT_STATE_FILE);
|
|
169606
169692
|
}
|
|
169607
169693
|
function readState(directory, customPath) {
|
|
169608
169694
|
const filePath = getStateFilePath(directory, customPath);
|
|
169609
|
-
if (!
|
|
169695
|
+
if (!existsSync37(filePath)) {
|
|
169610
169696
|
return null;
|
|
169611
169697
|
}
|
|
169612
169698
|
try {
|
|
@@ -170185,22 +170271,22 @@ function createTimestampedStdoutController(stdout2 = process.stdout) {
|
|
|
170185
170271
|
// packages/telemetry-core/src/activity-state.ts
|
|
170186
170272
|
init_atomic_write();
|
|
170187
170273
|
init_xdg_data_dir();
|
|
170188
|
-
import { existsSync as
|
|
170189
|
-
import { basename as basename6, join as
|
|
170274
|
+
import { existsSync as existsSync38, mkdirSync as mkdirSync14, readFileSync as readFileSync24 } from "fs";
|
|
170275
|
+
import { basename as basename6, join as join34 } from "path";
|
|
170190
170276
|
var POSTHOG_ACTIVITY_STATE_FILE = "posthog-activity.json";
|
|
170191
170277
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
170192
170278
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
170193
170279
|
env: options.env,
|
|
170194
170280
|
osProvider: options.osProvider
|
|
170195
170281
|
});
|
|
170196
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
170282
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join34(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
170197
170283
|
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename6(dataDir) === product.cacheDirName) {
|
|
170198
170284
|
return dataDir;
|
|
170199
170285
|
}
|
|
170200
|
-
return
|
|
170286
|
+
return join34(dataDir, product.cacheDirName);
|
|
170201
170287
|
}
|
|
170202
170288
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
170203
|
-
return
|
|
170289
|
+
return join34(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
170204
170290
|
}
|
|
170205
170291
|
function getDailyActiveCaptureState(input) {
|
|
170206
170292
|
const state2 = readPostHogActivityState(input.stateDir, input.diagnostics);
|
|
@@ -170225,7 +170311,7 @@ function isPostHogActivityState(value) {
|
|
|
170225
170311
|
}
|
|
170226
170312
|
function readPostHogActivityState(stateDir, diagnostics) {
|
|
170227
170313
|
const stateFilePath = getTelemetryActivityStateFilePath(stateDir);
|
|
170228
|
-
if (!
|
|
170314
|
+
if (!existsSync38(stateFilePath)) {
|
|
170229
170315
|
return {};
|
|
170230
170316
|
}
|
|
170231
170317
|
try {
|
|
@@ -170248,7 +170334,7 @@ function readPostHogActivityState(stateDir, diagnostics) {
|
|
|
170248
170334
|
function writePostHogActivityState(stateDir, nextState, diagnostics) {
|
|
170249
170335
|
const stateFilePath = getTelemetryActivityStateFilePath(stateDir);
|
|
170250
170336
|
try {
|
|
170251
|
-
|
|
170337
|
+
mkdirSync14(stateDir, { recursive: true });
|
|
170252
170338
|
writeFileAtomically(stateFilePath, `${JSON.stringify(nextState, null, 2)}
|
|
170253
170339
|
`);
|
|
170254
170340
|
} catch (error51) {
|
|
@@ -177352,14 +177438,14 @@ init_constants5();
|
|
|
177352
177438
|
|
|
177353
177439
|
// packages/omo-opencode/src/cli/doctor/checks/system.ts
|
|
177354
177440
|
init_constants5();
|
|
177355
|
-
import { existsSync as
|
|
177441
|
+
import { existsSync as existsSync49, readFileSync as readFileSync34 } from "fs";
|
|
177356
177442
|
|
|
177357
177443
|
// packages/omo-opencode/src/cli/doctor/checks/system-binary.ts
|
|
177358
177444
|
init_extract_semver();
|
|
177359
177445
|
init_bun_which_shim();
|
|
177360
|
-
import { existsSync as
|
|
177361
|
-
import { homedir as
|
|
177362
|
-
import { join as
|
|
177446
|
+
import { existsSync as existsSync46, accessSync as accessSync4, constants as constants8 } from "fs";
|
|
177447
|
+
import { homedir as homedir12 } from "os";
|
|
177448
|
+
import { join as join41 } from "path";
|
|
177363
177449
|
|
|
177364
177450
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
177365
177451
|
init_spawn_with_windows_hide();
|
|
@@ -177447,22 +177533,22 @@ function isExecutable2(path14) {
|
|
|
177447
177533
|
}
|
|
177448
177534
|
}
|
|
177449
177535
|
function getDesktopAppPaths(platform) {
|
|
177450
|
-
const home =
|
|
177536
|
+
const home = homedir12();
|
|
177451
177537
|
switch (platform) {
|
|
177452
177538
|
case "darwin":
|
|
177453
177539
|
return [
|
|
177454
177540
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
177455
|
-
|
|
177541
|
+
join41(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
177456
177542
|
];
|
|
177457
177543
|
case "win32": {
|
|
177458
177544
|
const programFiles = process.env.ProgramFiles;
|
|
177459
177545
|
const localAppData = process.env.LOCALAPPDATA;
|
|
177460
177546
|
const paths2 = [];
|
|
177461
177547
|
if (programFiles) {
|
|
177462
|
-
paths2.push(
|
|
177548
|
+
paths2.push(join41(programFiles, "OpenCode", "OpenCode.exe"));
|
|
177463
177549
|
}
|
|
177464
177550
|
if (localAppData) {
|
|
177465
|
-
paths2.push(
|
|
177551
|
+
paths2.push(join41(localAppData, "OpenCode", "OpenCode.exe"));
|
|
177466
177552
|
}
|
|
177467
177553
|
return paths2;
|
|
177468
177554
|
}
|
|
@@ -177470,8 +177556,8 @@ function getDesktopAppPaths(platform) {
|
|
|
177470
177556
|
return [
|
|
177471
177557
|
"/usr/bin/opencode",
|
|
177472
177558
|
"/usr/lib/opencode/opencode",
|
|
177473
|
-
|
|
177474
|
-
|
|
177559
|
+
join41(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
177560
|
+
join41(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
177475
177561
|
];
|
|
177476
177562
|
default:
|
|
177477
177563
|
return [];
|
|
@@ -177483,7 +177569,7 @@ function buildVersionCommand(binaryPath, platform) {
|
|
|
177483
177569
|
}
|
|
177484
177570
|
return [binaryPath, "--version"];
|
|
177485
177571
|
}
|
|
177486
|
-
function findDesktopBinary(platform = process.platform, checkExists =
|
|
177572
|
+
function findDesktopBinary(platform = process.platform, checkExists = existsSync46) {
|
|
177487
177573
|
for (const desktopPath of getDesktopAppPaths(platform)) {
|
|
177488
177574
|
if (checkExists(desktopPath)) {
|
|
177489
177575
|
return { binary: "opencode", path: desktopPath };
|
|
@@ -177491,7 +177577,7 @@ function findDesktopBinary(platform = process.platform, checkExists = existsSync
|
|
|
177491
177577
|
}
|
|
177492
177578
|
return null;
|
|
177493
177579
|
}
|
|
177494
|
-
async function findOpenCodeBinary(platform = process.platform, checkExists =
|
|
177580
|
+
async function findOpenCodeBinary(platform = process.platform, checkExists = existsSync46) {
|
|
177495
177581
|
for (const binary2 of OPENCODE_BINARIES2) {
|
|
177496
177582
|
const path14 = bunWhich(binary2);
|
|
177497
177583
|
if (path14 && checkExists(path14)) {
|
|
@@ -177503,7 +177589,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
177503
177589
|
const candidates = getCommandCandidates2(platform);
|
|
177504
177590
|
for (const entry of pathEnv.split(delimiter3).filter(Boolean)) {
|
|
177505
177591
|
for (const command of candidates) {
|
|
177506
|
-
const fullPath =
|
|
177592
|
+
const fullPath = join41(entry, command);
|
|
177507
177593
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
177508
177594
|
return { binary: command, path: fullPath };
|
|
177509
177595
|
}
|
|
@@ -177549,12 +177635,12 @@ function compareVersions3(current, minimum) {
|
|
|
177549
177635
|
|
|
177550
177636
|
// packages/omo-opencode/src/cli/doctor/checks/system-plugin.ts
|
|
177551
177637
|
init_shared();
|
|
177552
|
-
import { existsSync as
|
|
177638
|
+
import { existsSync as existsSync47, readFileSync as readFileSync32 } from "fs";
|
|
177553
177639
|
function detectConfigPath() {
|
|
177554
177640
|
const paths2 = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
177555
|
-
if (
|
|
177641
|
+
if (existsSync47(paths2.configJsonc))
|
|
177556
177642
|
return paths2.configJsonc;
|
|
177557
|
-
if (
|
|
177643
|
+
if (existsSync47(paths2.configJson))
|
|
177558
177644
|
return paths2.configJson;
|
|
177559
177645
|
return null;
|
|
177560
177646
|
}
|
|
@@ -177644,35 +177730,35 @@ init_auto_update_checker();
|
|
|
177644
177730
|
init_package_json_locator();
|
|
177645
177731
|
init_constants5();
|
|
177646
177732
|
init_shared();
|
|
177647
|
-
import { existsSync as
|
|
177733
|
+
import { existsSync as existsSync48, readFileSync as readFileSync33, readdirSync as readdirSync7 } from "fs";
|
|
177648
177734
|
import { createRequire as createRequire2 } from "module";
|
|
177649
|
-
import { homedir as
|
|
177650
|
-
import { join as
|
|
177735
|
+
import { homedir as homedir13 } from "os";
|
|
177736
|
+
import { join as join42 } from "path";
|
|
177651
177737
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
177652
177738
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
177653
177739
|
if (platform === "darwin")
|
|
177654
|
-
return
|
|
177740
|
+
return join42(homedir13(), "Library", "Caches");
|
|
177655
177741
|
if (platform === "win32")
|
|
177656
|
-
return process.env.LOCALAPPDATA ??
|
|
177657
|
-
return
|
|
177742
|
+
return process.env.LOCALAPPDATA ?? join42(homedir13(), "AppData", "Local");
|
|
177743
|
+
return join42(homedir13(), ".cache");
|
|
177658
177744
|
}
|
|
177659
177745
|
function resolveOpenCodeCacheDir() {
|
|
177660
177746
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
177661
177747
|
if (xdgCacheHome)
|
|
177662
|
-
return
|
|
177748
|
+
return join42(xdgCacheHome, "opencode");
|
|
177663
177749
|
const fromShared = getOpenCodeCacheDir();
|
|
177664
|
-
const platformDefault =
|
|
177665
|
-
if (
|
|
177750
|
+
const platformDefault = join42(getPlatformDefaultCacheDir(), "opencode");
|
|
177751
|
+
if (existsSync48(fromShared) || !existsSync48(platformDefault))
|
|
177666
177752
|
return fromShared;
|
|
177667
177753
|
return platformDefault;
|
|
177668
177754
|
}
|
|
177669
177755
|
function resolveExistingDir(dirPath) {
|
|
177670
|
-
if (!
|
|
177756
|
+
if (!existsSync48(dirPath))
|
|
177671
177757
|
return dirPath;
|
|
177672
177758
|
return resolveSymlink(dirPath);
|
|
177673
177759
|
}
|
|
177674
177760
|
function readPackageJson(filePath) {
|
|
177675
|
-
if (!
|
|
177761
|
+
if (!existsSync48(filePath))
|
|
177676
177762
|
return null;
|
|
177677
177763
|
try {
|
|
177678
177764
|
const content = readFileSync33(filePath, "utf-8");
|
|
@@ -177693,26 +177779,26 @@ function normalizeVersion(value) {
|
|
|
177693
177779
|
function createPackageCandidates(rootDir) {
|
|
177694
177780
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
177695
177781
|
packageName,
|
|
177696
|
-
installedPackagePath:
|
|
177782
|
+
installedPackagePath: join42(rootDir, "node_modules", packageName, "package.json")
|
|
177697
177783
|
}));
|
|
177698
177784
|
}
|
|
177699
177785
|
function createTaggedInstallCandidates(rootDir) {
|
|
177700
|
-
const packagesDir =
|
|
177701
|
-
if (!
|
|
177786
|
+
const packagesDir = join42(rootDir, "packages");
|
|
177787
|
+
if (!existsSync48(packagesDir))
|
|
177702
177788
|
return [];
|
|
177703
177789
|
const candidates = [];
|
|
177704
177790
|
for (const entryName of readdirSync7(packagesDir).sort()) {
|
|
177705
177791
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name2) => entryName.startsWith(`${name2}@`));
|
|
177706
177792
|
if (packageName === undefined)
|
|
177707
177793
|
continue;
|
|
177708
|
-
const installDir =
|
|
177794
|
+
const installDir = join42(packagesDir, entryName);
|
|
177709
177795
|
candidates.push({
|
|
177710
177796
|
cacheDir: installDir,
|
|
177711
|
-
cachePackagePath:
|
|
177797
|
+
cachePackagePath: join42(installDir, "package.json"),
|
|
177712
177798
|
packageCandidates: [
|
|
177713
177799
|
{
|
|
177714
177800
|
packageName,
|
|
177715
|
-
installedPackagePath:
|
|
177801
|
+
installedPackagePath: join42(installDir, "node_modules", packageName, "package.json")
|
|
177716
177802
|
}
|
|
177717
177803
|
]
|
|
177718
177804
|
});
|
|
@@ -177720,7 +177806,7 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
177720
177806
|
return candidates;
|
|
177721
177807
|
}
|
|
177722
177808
|
function selectInstalledPackage(candidate) {
|
|
177723
|
-
return candidate.packageCandidates.find((packageCandidate) =>
|
|
177809
|
+
return candidate.packageCandidates.find((packageCandidate) => existsSync48(packageCandidate.installedPackagePath)) ?? candidate.packageCandidates[0];
|
|
177724
177810
|
}
|
|
177725
177811
|
function getExpectedVersion(cachePackage, packageName) {
|
|
177726
177812
|
return normalizeVersion(cachePackage?.dependencies?.[packageName]) ?? normalizeVersion(cachePackage?.dependencies?.[PACKAGE_NAME]);
|
|
@@ -177731,7 +177817,7 @@ function resolveInstalledPackageJsonPath() {
|
|
|
177731
177817
|
for (const packageName of ACCEPTED_PACKAGE_NAMES) {
|
|
177732
177818
|
try {
|
|
177733
177819
|
const packageJsonPath = require2.resolve(`${packageName}/package.json`);
|
|
177734
|
-
if (
|
|
177820
|
+
if (existsSync48(packageJsonPath)) {
|
|
177735
177821
|
return { packageName, packageJsonPath };
|
|
177736
177822
|
}
|
|
177737
177823
|
} catch {
|
|
@@ -177757,22 +177843,22 @@ function getLoadedPluginVersion() {
|
|
|
177757
177843
|
const candidates = [
|
|
177758
177844
|
{
|
|
177759
177845
|
cacheDir: configDir,
|
|
177760
|
-
cachePackagePath:
|
|
177846
|
+
cachePackagePath: join42(configDir, "package.json"),
|
|
177761
177847
|
packageCandidates: createPackageCandidates(configDir)
|
|
177762
177848
|
},
|
|
177763
177849
|
...createTaggedInstallCandidates(configDir),
|
|
177764
177850
|
{
|
|
177765
177851
|
cacheDir,
|
|
177766
|
-
cachePackagePath:
|
|
177852
|
+
cachePackagePath: join42(cacheDir, "package.json"),
|
|
177767
177853
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
177768
177854
|
},
|
|
177769
177855
|
...createTaggedInstallCandidates(cacheDir)
|
|
177770
177856
|
];
|
|
177771
|
-
const selectedCandidate = candidates.find((candidate) => candidate.packageCandidates.some((packageCandidate) =>
|
|
177857
|
+
const selectedCandidate = candidates.find((candidate) => candidate.packageCandidates.some((packageCandidate) => existsSync48(packageCandidate.installedPackagePath))) ?? candidates[0];
|
|
177772
177858
|
const { cacheDir: selectedDir, cachePackagePath } = selectedCandidate;
|
|
177773
177859
|
const selectedPackage = selectInstalledPackage(selectedCandidate);
|
|
177774
177860
|
const candidateInstalledPath = selectedPackage.installedPackagePath;
|
|
177775
|
-
const candidateExists =
|
|
177861
|
+
const candidateExists = existsSync48(candidateInstalledPath);
|
|
177776
177862
|
const resolvedFallback = candidateExists ? null : resolveInstalledPackageJsonPath();
|
|
177777
177863
|
const installedPackagePath = resolvedFallback?.packageJsonPath ?? candidateInstalledPath;
|
|
177778
177864
|
const resolvedPackageName = resolvedFallback?.packageName ?? selectedPackage.packageName;
|
|
@@ -177808,7 +177894,7 @@ var defaultDeps6 = {
|
|
|
177808
177894
|
getLoadedPluginVersion,
|
|
177809
177895
|
getLatestPluginVersion,
|
|
177810
177896
|
getSuggestedInstallTag,
|
|
177811
|
-
configExists:
|
|
177897
|
+
configExists: existsSync49,
|
|
177812
177898
|
readConfigFile: (path14) => readFileSync34(path14, "utf-8"),
|
|
177813
177899
|
parseConfigContent: (content) => parseJsonc(content)
|
|
177814
177900
|
};
|
|
@@ -177955,12 +178041,12 @@ async function checkSystem(deps = defaultDeps6) {
|
|
|
177955
178041
|
// packages/omo-opencode/src/config/validate.ts
|
|
177956
178042
|
init_src();
|
|
177957
178043
|
import { readFileSync as readFileSync35 } from "fs";
|
|
177958
|
-
import { homedir as
|
|
178044
|
+
import { homedir as homedir14 } from "os";
|
|
177959
178045
|
import { dirname as dirname18, relative as relative5 } from "path";
|
|
177960
178046
|
init_shared();
|
|
177961
178047
|
init_plugin_identity();
|
|
177962
178048
|
function resolveHomeDirectory2() {
|
|
177963
|
-
return process.env.HOME ?? process.env.USERPROFILE ??
|
|
178049
|
+
return process.env.HOME ?? process.env.USERPROFILE ?? homedir14();
|
|
177964
178050
|
}
|
|
177965
178051
|
function discoverConfigInDirectory(configDir) {
|
|
177966
178052
|
const detected = detectPluginConfigFile(configDir, {
|
|
@@ -178071,23 +178157,23 @@ init_constants5();
|
|
|
178071
178157
|
|
|
178072
178158
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-cache.ts
|
|
178073
178159
|
init_shared();
|
|
178074
|
-
import { existsSync as
|
|
178075
|
-
import { homedir as
|
|
178076
|
-
import { join as
|
|
178160
|
+
import { existsSync as existsSync50, readFileSync as readFileSync36 } from "fs";
|
|
178161
|
+
import { homedir as homedir15 } from "os";
|
|
178162
|
+
import { join as join43 } from "path";
|
|
178077
178163
|
function getUserConfigDir2() {
|
|
178078
178164
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
178079
178165
|
if (xdgConfig)
|
|
178080
|
-
return
|
|
178081
|
-
return
|
|
178166
|
+
return join43(xdgConfig, "opencode");
|
|
178167
|
+
return join43(homedir15(), ".config", "opencode");
|
|
178082
178168
|
}
|
|
178083
178169
|
function loadCustomProviderNames() {
|
|
178084
178170
|
const configDir = getUserConfigDir2();
|
|
178085
178171
|
const candidatePaths = [
|
|
178086
|
-
|
|
178087
|
-
|
|
178172
|
+
join43(configDir, "opencode.json"),
|
|
178173
|
+
join43(configDir, "opencode.jsonc")
|
|
178088
178174
|
];
|
|
178089
178175
|
for (const configPath of candidatePaths) {
|
|
178090
|
-
if (!
|
|
178176
|
+
if (!existsSync50(configPath))
|
|
178091
178177
|
continue;
|
|
178092
178178
|
try {
|
|
178093
178179
|
const content = readFileSync36(configPath, "utf-8");
|
|
@@ -178105,9 +178191,9 @@ function loadCustomProviderNames() {
|
|
|
178105
178191
|
return [];
|
|
178106
178192
|
}
|
|
178107
178193
|
function loadAvailableModelsFromCache() {
|
|
178108
|
-
const cacheFile =
|
|
178194
|
+
const cacheFile = join43(getOpenCodeCacheDir(), "models.json");
|
|
178109
178195
|
const customProviders = loadCustomProviderNames();
|
|
178110
|
-
if (!
|
|
178196
|
+
if (!existsSync50(cacheFile)) {
|
|
178111
178197
|
if (customProviders.length > 0) {
|
|
178112
178198
|
return { providers: customProviders, modelCount: 0, cacheExists: true };
|
|
178113
178199
|
}
|
|
@@ -178143,8 +178229,8 @@ init_constants5();
|
|
|
178143
178229
|
init_shared();
|
|
178144
178230
|
init_plugin_identity();
|
|
178145
178231
|
import { readFileSync as readFileSync37 } from "fs";
|
|
178146
|
-
import { join as
|
|
178147
|
-
var PROJECT_CONFIG_DIR =
|
|
178232
|
+
import { join as join44 } from "path";
|
|
178233
|
+
var PROJECT_CONFIG_DIR = join44(process.cwd(), ".opencode");
|
|
178148
178234
|
function loadOmoConfig() {
|
|
178149
178235
|
const projectDetected = detectPluginConfigFile(PROJECT_CONFIG_DIR, {
|
|
178150
178236
|
basenames: [CONFIG_BASENAME],
|
|
@@ -178182,7 +178268,7 @@ function loadOmoConfig() {
|
|
|
178182
178268
|
|
|
178183
178269
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
178184
178270
|
init_shared();
|
|
178185
|
-
import { join as
|
|
178271
|
+
import { join as join45 } from "path";
|
|
178186
178272
|
|
|
178187
178273
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
178188
178274
|
function formatModelWithVariant(model, variant) {
|
|
@@ -178224,7 +178310,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
178224
178310
|
}
|
|
178225
178311
|
function buildModelResolutionDetails(options) {
|
|
178226
178312
|
const details = [];
|
|
178227
|
-
const cacheFile =
|
|
178313
|
+
const cacheFile = join45(getOpenCodeCacheDir(), "models.json");
|
|
178228
178314
|
details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
|
|
178229
178315
|
details.push("");
|
|
178230
178316
|
if (options.available.cacheExists) {
|
|
@@ -178500,28 +178586,28 @@ async function checkConfig() {
|
|
|
178500
178586
|
|
|
178501
178587
|
// packages/omo-opencode/src/cli/doctor/checks/dependencies.ts
|
|
178502
178588
|
init_src();
|
|
178503
|
-
import { existsSync as
|
|
178589
|
+
import { existsSync as existsSync51 } from "fs";
|
|
178504
178590
|
import { createRequire as createRequire3 } from "module";
|
|
178505
|
-
import { homedir as
|
|
178506
|
-
import { dirname as dirname19, join as
|
|
178591
|
+
import { homedir as homedir17 } from "os";
|
|
178592
|
+
import { dirname as dirname19, join as join47 } from "path";
|
|
178507
178593
|
|
|
178508
178594
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
178509
|
-
import { join as
|
|
178510
|
-
import { homedir as
|
|
178595
|
+
import { join as join46 } from "path";
|
|
178596
|
+
import { homedir as homedir16, tmpdir as tmpdir3 } from "os";
|
|
178511
178597
|
init_binary_downloader();
|
|
178512
178598
|
init_logger2();
|
|
178513
178599
|
init_plugin_identity();
|
|
178514
178600
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
178515
|
-
var DEBUG_FILE =
|
|
178601
|
+
var DEBUG_FILE = join46(tmpdir3(), "comment-checker-debug.log");
|
|
178516
178602
|
function getCacheDir2() {
|
|
178517
178603
|
if (process.platform === "win32") {
|
|
178518
178604
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
178519
|
-
const base2 = localAppData ||
|
|
178520
|
-
return
|
|
178605
|
+
const base2 = localAppData || join46(homedir16(), "AppData", "Local");
|
|
178606
|
+
return join46(base2, CACHE_DIR_NAME, "bin");
|
|
178521
178607
|
}
|
|
178522
178608
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
178523
|
-
const base = xdgCache ||
|
|
178524
|
-
return
|
|
178609
|
+
const base = xdgCache || join46(homedir16(), ".cache");
|
|
178610
|
+
return join46(base, CACHE_DIR_NAME, "bin");
|
|
178525
178611
|
}
|
|
178526
178612
|
function getBinaryName() {
|
|
178527
178613
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -178571,7 +178657,7 @@ async function getBinaryVersion(binary2) {
|
|
|
178571
178657
|
}
|
|
178572
178658
|
}
|
|
178573
178659
|
async function checkAstGrepCli() {
|
|
178574
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
178660
|
+
const runtimeDir = astGrepRuntimeDir(join47(homedir17(), ".omo"));
|
|
178575
178661
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
178576
178662
|
if (sgPath === null) {
|
|
178577
178663
|
return {
|
|
@@ -178601,11 +178687,11 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
178601
178687
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
178602
178688
|
try {
|
|
178603
178689
|
const packageDir = baseDirOverride ?? dirname19(resolvePackageJsonPath());
|
|
178604
|
-
const vendorPath =
|
|
178605
|
-
if (
|
|
178690
|
+
const vendorPath = join47(packageDir, "vendor", platformKey, binaryName);
|
|
178691
|
+
if (existsSync51(vendorPath))
|
|
178606
178692
|
return vendorPath;
|
|
178607
|
-
const binPath =
|
|
178608
|
-
if (
|
|
178693
|
+
const binPath = join47(packageDir, "bin", binaryName);
|
|
178694
|
+
if (existsSync51(binPath))
|
|
178609
178695
|
return binPath;
|
|
178610
178696
|
} catch (error51) {
|
|
178611
178697
|
if (!(error51 instanceof Error) && !isModuleResolutionFailure(error51))
|
|
@@ -178750,12 +178836,12 @@ async function getGhCliInfo(dependencies = {}) {
|
|
|
178750
178836
|
|
|
178751
178837
|
// packages/omo-opencode/src/cli/doctor/checks/tools-lsp.ts
|
|
178752
178838
|
import { readFileSync as readFileSync39 } from "fs";
|
|
178753
|
-
import { join as
|
|
178839
|
+
import { join as join48 } from "path";
|
|
178754
178840
|
|
|
178755
178841
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
178756
178842
|
init_zod();
|
|
178757
178843
|
init_opencode_config_dir();
|
|
178758
|
-
import { existsSync as
|
|
178844
|
+
import { existsSync as existsSync52, readFileSync as readFileSync38 } from "fs";
|
|
178759
178845
|
import { delimiter as delimiter3, dirname as dirname20, resolve as resolve10 } from "path";
|
|
178760
178846
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
178761
178847
|
|
|
@@ -178921,7 +179007,7 @@ function createBootstrapCandidate(root, pathExists, resolveExecutable) {
|
|
|
178921
179007
|
};
|
|
178922
179008
|
}
|
|
178923
179009
|
function resolveLspCommand(options = {}) {
|
|
178924
|
-
const pathExists = options.exists ??
|
|
179010
|
+
const pathExists = options.exists ?? existsSync52;
|
|
178925
179011
|
const resolveExecutable = options.resolveExecutable ?? resolveRuntimeExecutable;
|
|
178926
179012
|
const moduleDirectory = getModuleDirectory(options.moduleUrl ?? import.meta.url);
|
|
178927
179013
|
const candidates = moduleDirectory ? createAncestorCliCandidates({
|
|
@@ -178987,7 +179073,7 @@ function readOmoConfig(configDirectory) {
|
|
|
178987
179073
|
}
|
|
178988
179074
|
function isLspMcpDisabled(options) {
|
|
178989
179075
|
const userConfigDirectory = options.configDirectory ?? getOpenCodeConfigDir({ binary: "opencode" });
|
|
178990
|
-
const projectConfigDirectory =
|
|
179076
|
+
const projectConfigDirectory = join48(options.cwd ?? process.cwd(), ".opencode");
|
|
178991
179077
|
const userConfig = readOmoConfig(userConfigDirectory);
|
|
178992
179078
|
const projectConfig = readOmoConfig(projectConfigDirectory);
|
|
178993
179079
|
const disabledMcps = new Set([
|
|
@@ -179006,21 +179092,21 @@ function getInstalledLspServers(options = {}) {
|
|
|
179006
179092
|
|
|
179007
179093
|
// packages/omo-opencode/src/cli/doctor/checks/tools-mcp.ts
|
|
179008
179094
|
init_shared();
|
|
179009
|
-
import { existsSync as
|
|
179010
|
-
import { homedir as
|
|
179011
|
-
import { join as
|
|
179095
|
+
import { existsSync as existsSync53, readFileSync as readFileSync40 } from "fs";
|
|
179096
|
+
import { homedir as homedir18 } from "os";
|
|
179097
|
+
import { join as join49 } from "path";
|
|
179012
179098
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
179013
179099
|
function getMcpConfigPaths() {
|
|
179014
179100
|
return [
|
|
179015
|
-
|
|
179016
|
-
|
|
179017
|
-
|
|
179101
|
+
join49(homedir18(), ".claude", ".mcp.json"),
|
|
179102
|
+
join49(process.cwd(), ".mcp.json"),
|
|
179103
|
+
join49(process.cwd(), ".claude", ".mcp.json")
|
|
179018
179104
|
];
|
|
179019
179105
|
}
|
|
179020
179106
|
function loadUserMcpConfig() {
|
|
179021
179107
|
const servers = {};
|
|
179022
179108
|
for (const configPath of getMcpConfigPaths()) {
|
|
179023
|
-
if (!
|
|
179109
|
+
if (!existsSync53(configPath))
|
|
179024
179110
|
continue;
|
|
179025
179111
|
try {
|
|
179026
179112
|
const content = readFileSync40(configPath, "utf-8");
|
|
@@ -179158,13 +179244,13 @@ async function checkTools() {
|
|
|
179158
179244
|
}
|
|
179159
179245
|
|
|
179160
179246
|
// packages/omo-opencode/src/cli/doctor/checks/telemetry.ts
|
|
179161
|
-
import { existsSync as
|
|
179247
|
+
import { existsSync as existsSync54, readFileSync as readFileSync41 } from "fs";
|
|
179162
179248
|
init_constants5();
|
|
179163
179249
|
function isTelemetryState(value) {
|
|
179164
179250
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
179165
179251
|
}
|
|
179166
179252
|
function readLastActiveDay(stateFilePath) {
|
|
179167
|
-
if (!
|
|
179253
|
+
if (!existsSync54(stateFilePath)) {
|
|
179168
179254
|
return "never";
|
|
179169
179255
|
}
|
|
179170
179256
|
let parsed;
|
|
@@ -179227,17 +179313,17 @@ async function probeBinary(cmd, args, spawnImpl) {
|
|
|
179227
179313
|
}
|
|
179228
179314
|
|
|
179229
179315
|
// packages/team-core/src/team-registry/paths.ts
|
|
179230
|
-
import { homedir as
|
|
179316
|
+
import { homedir as homedir19 } from "os";
|
|
179231
179317
|
import path14 from "path";
|
|
179232
179318
|
function resolveBaseDir(config5) {
|
|
179233
|
-
return expandHomeDirectory(config5.base_dir ?? path14.join(
|
|
179319
|
+
return expandHomeDirectory(config5.base_dir ?? path14.join(homedir19(), ".omo"));
|
|
179234
179320
|
}
|
|
179235
179321
|
function expandHomeDirectory(directoryPath) {
|
|
179236
179322
|
if (directoryPath === "~") {
|
|
179237
|
-
return
|
|
179323
|
+
return homedir19();
|
|
179238
179324
|
}
|
|
179239
179325
|
if (directoryPath.startsWith("~/") || directoryPath.startsWith("~\\")) {
|
|
179240
|
-
return path14.join(
|
|
179326
|
+
return path14.join(homedir19(), directoryPath.slice(2));
|
|
179241
179327
|
}
|
|
179242
179328
|
return directoryPath;
|
|
179243
179329
|
}
|
|
@@ -179720,23 +179806,23 @@ Doctor failed unexpectedly: ${message}`];
|
|
|
179720
179806
|
import { createHash as createHash3 } from "crypto";
|
|
179721
179807
|
import {
|
|
179722
179808
|
chmodSync as chmodSync6,
|
|
179723
|
-
existsSync as
|
|
179724
|
-
mkdirSync as
|
|
179809
|
+
existsSync as existsSync57,
|
|
179810
|
+
mkdirSync as mkdirSync16,
|
|
179725
179811
|
readdirSync as readdirSync8,
|
|
179726
179812
|
readFileSync as readFileSync44,
|
|
179727
179813
|
renameSync as renameSync7,
|
|
179728
179814
|
unlinkSync as unlinkSync8,
|
|
179729
179815
|
writeFileSync as writeFileSync14
|
|
179730
179816
|
} from "fs";
|
|
179731
|
-
import { basename as basename8, dirname as dirname21, join as
|
|
179817
|
+
import { basename as basename8, dirname as dirname21, join as join52 } from "path";
|
|
179732
179818
|
|
|
179733
179819
|
// packages/mcp-client-core/src/config-dir.ts
|
|
179734
|
-
import { existsSync as
|
|
179735
|
-
import { homedir as
|
|
179736
|
-
import { join as
|
|
179820
|
+
import { existsSync as existsSync55, realpathSync as realpathSync7 } from "fs";
|
|
179821
|
+
import { homedir as homedir20 } from "os";
|
|
179822
|
+
import { join as join50, resolve as resolve11 } from "path";
|
|
179737
179823
|
function resolveConfigPath2(pathValue) {
|
|
179738
179824
|
const resolvedPath = resolve11(pathValue);
|
|
179739
|
-
if (!
|
|
179825
|
+
if (!existsSync55(resolvedPath))
|
|
179740
179826
|
return resolvedPath;
|
|
179741
179827
|
try {
|
|
179742
179828
|
return realpathSync7(resolvedPath);
|
|
@@ -179751,13 +179837,13 @@ function getOpenCodeCliConfigDir(env2 = process.env) {
|
|
|
179751
179837
|
if (customConfigDir) {
|
|
179752
179838
|
return resolveConfigPath2(customConfigDir);
|
|
179753
179839
|
}
|
|
179754
|
-
const xdgConfigDir = env2["XDG_CONFIG_HOME"]?.trim() ||
|
|
179755
|
-
return resolveConfigPath2(
|
|
179840
|
+
const xdgConfigDir = env2["XDG_CONFIG_HOME"]?.trim() || join50(homedir20(), ".config");
|
|
179841
|
+
return resolveConfigPath2(join50(xdgConfigDir, "opencode"));
|
|
179756
179842
|
}
|
|
179757
179843
|
|
|
179758
179844
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
179759
|
-
import { chmodSync as chmodSync5, existsSync as
|
|
179760
|
-
import { join as
|
|
179845
|
+
import { chmodSync as chmodSync5, existsSync as existsSync56, readFileSync as readFileSync43, renameSync as renameSync6, writeFileSync as writeFileSync13 } from "fs";
|
|
179846
|
+
import { join as join51 } from "path";
|
|
179761
179847
|
var INDEX_FILE_NAME = "index.json";
|
|
179762
179848
|
function isTokenIndex(value) {
|
|
179763
179849
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -179765,11 +179851,11 @@ function isTokenIndex(value) {
|
|
|
179765
179851
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
179766
179852
|
}
|
|
179767
179853
|
function getIndexPath(storageDir) {
|
|
179768
|
-
return
|
|
179854
|
+
return join51(storageDir, INDEX_FILE_NAME);
|
|
179769
179855
|
}
|
|
179770
179856
|
function readTokenIndex(storageDir) {
|
|
179771
179857
|
const indexPath = getIndexPath(storageDir);
|
|
179772
|
-
if (!
|
|
179858
|
+
if (!existsSync56(indexPath))
|
|
179773
179859
|
return {};
|
|
179774
179860
|
try {
|
|
179775
179861
|
const parsed = JSON.parse(readFileSync43(indexPath, "utf-8"));
|
|
@@ -179809,16 +179895,16 @@ function deleteTokenIndexEntry(storageDir, hash2) {
|
|
|
179809
179895
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
179810
179896
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
179811
179897
|
function getMcpOauthStorageDir() {
|
|
179812
|
-
return
|
|
179898
|
+
return join52(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
179813
179899
|
}
|
|
179814
179900
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
179815
179901
|
return createHash3("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
179816
179902
|
}
|
|
179817
179903
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
179818
|
-
return
|
|
179904
|
+
return join52(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
179819
179905
|
}
|
|
179820
179906
|
function getLegacyStoragePath() {
|
|
179821
|
-
return
|
|
179907
|
+
return join52(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
179822
179908
|
}
|
|
179823
179909
|
function normalizeHost2(serverHost) {
|
|
179824
179910
|
let host = serverHost.trim();
|
|
@@ -179879,7 +179965,7 @@ function isOAuthTokenData(value) {
|
|
|
179879
179965
|
return clientSecret === undefined || typeof clientSecret === "string";
|
|
179880
179966
|
}
|
|
179881
179967
|
function readTokenFile(filePath) {
|
|
179882
|
-
if (!
|
|
179968
|
+
if (!existsSync57(filePath))
|
|
179883
179969
|
return null;
|
|
179884
179970
|
try {
|
|
179885
179971
|
const parsed = JSON.parse(readFileSync44(filePath, "utf-8"));
|
|
@@ -179892,7 +179978,7 @@ function readTokenFile(filePath) {
|
|
|
179892
179978
|
}
|
|
179893
179979
|
function readLegacyStore() {
|
|
179894
179980
|
const filePath = getLegacyStoragePath();
|
|
179895
|
-
if (!
|
|
179981
|
+
if (!existsSync57(filePath))
|
|
179896
179982
|
return null;
|
|
179897
179983
|
try {
|
|
179898
179984
|
const parsed = JSON.parse(readFileSync44(filePath, "utf-8"));
|
|
@@ -179913,8 +179999,8 @@ function readLegacyStore() {
|
|
|
179913
179999
|
function writeTokenFile(filePath, token) {
|
|
179914
180000
|
try {
|
|
179915
180001
|
const dir = dirname21(filePath);
|
|
179916
|
-
if (!
|
|
179917
|
-
|
|
180002
|
+
if (!existsSync57(dir)) {
|
|
180003
|
+
mkdirSync16(dir, { recursive: true });
|
|
179918
180004
|
}
|
|
179919
180005
|
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
179920
180006
|
writeFileSync14(tempPath, JSON.stringify(token, null, 2), { encoding: "utf-8", mode: 384 });
|
|
@@ -179937,7 +180023,7 @@ function saveToken(serverHost, resource, token) {
|
|
|
179937
180023
|
}
|
|
179938
180024
|
function deleteToken(serverHost, resource) {
|
|
179939
180025
|
const filePath = getMcpOauthStoragePath(serverHost, resource);
|
|
179940
|
-
if (!
|
|
180026
|
+
if (!existsSync57(filePath))
|
|
179941
180027
|
return deleteLegacyToken(serverHost, resource);
|
|
179942
180028
|
try {
|
|
179943
180029
|
unlinkSync8(filePath);
|
|
@@ -179959,7 +180045,7 @@ function deleteLegacyToken(serverHost, resource) {
|
|
|
179959
180045
|
if (Object.keys(store2).length === 0) {
|
|
179960
180046
|
try {
|
|
179961
180047
|
const filePath = getLegacyStoragePath();
|
|
179962
|
-
if (
|
|
180048
|
+
if (existsSync57(filePath))
|
|
179963
180049
|
unlinkSync8(filePath);
|
|
179964
180050
|
return true;
|
|
179965
180051
|
} catch (deleteError) {
|
|
@@ -179997,7 +180083,7 @@ function listTokensByHost(serverHost) {
|
|
|
179997
180083
|
for (const [hash2, indexedKey] of Object.entries(index)) {
|
|
179998
180084
|
if (!indexedKey.startsWith(prefix))
|
|
179999
180085
|
continue;
|
|
180000
|
-
const indexedToken = readTokenFile(
|
|
180086
|
+
const indexedToken = readTokenFile(join52(getMcpOauthStorageDir(), `${hash2}.json`));
|
|
180001
180087
|
if (indexedToken)
|
|
180002
180088
|
result[indexedKey] = indexedToken;
|
|
180003
180089
|
}
|
|
@@ -180006,13 +180092,13 @@ function listTokensByHost(serverHost) {
|
|
|
180006
180092
|
function listAllTokens() {
|
|
180007
180093
|
const result = { ...readLegacyStore() ?? {} };
|
|
180008
180094
|
const dir = getMcpOauthStorageDir();
|
|
180009
|
-
if (!
|
|
180095
|
+
if (!existsSync57(dir))
|
|
180010
180096
|
return result;
|
|
180011
180097
|
const index = readTokenIndex(dir);
|
|
180012
180098
|
for (const entry of readdirSync8(dir, { withFileTypes: true })) {
|
|
180013
180099
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
180014
180100
|
continue;
|
|
180015
|
-
const token = readTokenFile(
|
|
180101
|
+
const token = readTokenFile(join52(dir, entry.name));
|
|
180016
180102
|
const hash2 = basename8(entry.name, ".json");
|
|
180017
180103
|
if (token)
|
|
180018
180104
|
result[index[hash2] ?? hash2] = token;
|
|
@@ -180708,8 +180794,8 @@ function createEmbeddingPort() {
|
|
|
180708
180794
|
// packages/learning-loop/src/codebase-scanner.ts
|
|
180709
180795
|
var import_picomatch = __toESM(require_picomatch2(), 1);
|
|
180710
180796
|
import { createHash as createHash5 } from "crypto";
|
|
180711
|
-
import { readdirSync as readdirSync9, readFileSync as readFileSync46, statSync as statSync7, existsSync as
|
|
180712
|
-
import { join as
|
|
180797
|
+
import { readdirSync as readdirSync9, readFileSync as readFileSync46, statSync as statSync7, existsSync as existsSync59 } from "fs";
|
|
180798
|
+
import { join as join53, relative as relative6, extname as extname3 } from "path";
|
|
180713
180799
|
var EXT_TO_LANG = {
|
|
180714
180800
|
ts: "typescript",
|
|
180715
180801
|
tsx: "typescript",
|
|
@@ -180763,7 +180849,7 @@ function detectLanguage(filePath) {
|
|
|
180763
180849
|
return EXT_TO_LANG[ext] ?? "text";
|
|
180764
180850
|
}
|
|
180765
180851
|
function loadGitignore(rootDir, fs18) {
|
|
180766
|
-
const gitignorePath =
|
|
180852
|
+
const gitignorePath = join53(rootDir, ".gitignore");
|
|
180767
180853
|
if (!fs18.exists(gitignorePath))
|
|
180768
180854
|
return [];
|
|
180769
180855
|
const content = fs18.readFile(gitignorePath);
|
|
@@ -180783,7 +180869,7 @@ function defaultFs() {
|
|
|
180783
180869
|
return { size: s.size, mtimeMs: s.mtimeMs, isDirectory: () => s.isDirectory(), isFile: () => s.isFile() };
|
|
180784
180870
|
},
|
|
180785
180871
|
exists(path18) {
|
|
180786
|
-
return
|
|
180872
|
+
return existsSync59(path18);
|
|
180787
180873
|
}
|
|
180788
180874
|
};
|
|
180789
180875
|
}
|
|
@@ -180854,7 +180940,7 @@ function createCodebaseScanner(options = {}) {
|
|
|
180854
180940
|
return;
|
|
180855
180941
|
}
|
|
180856
180942
|
for (const entry of entries) {
|
|
180857
|
-
const fullPath =
|
|
180943
|
+
const fullPath = join53(dir, entry);
|
|
180858
180944
|
let stat;
|
|
180859
180945
|
try {
|
|
180860
180946
|
stat = fs18.stat(fullPath);
|
|
@@ -181129,14 +181215,14 @@ function formatSearchResults(result) {
|
|
|
181129
181215
|
}
|
|
181130
181216
|
|
|
181131
181217
|
// packages/learning-loop/src/improvement.ts
|
|
181132
|
-
import { existsSync as
|
|
181133
|
-
import { join as
|
|
181218
|
+
import { existsSync as existsSync60, mkdirSync as mkdirSync18, readFileSync as readFileSync47, writeFileSync as writeFileSync16 } from "fs";
|
|
181219
|
+
import { join as join54, basename as basename10 } from "path";
|
|
181134
181220
|
function createImprovementStore(improvementsDir) {
|
|
181135
|
-
if (!
|
|
181136
|
-
|
|
181221
|
+
if (!existsSync60(improvementsDir)) {
|
|
181222
|
+
mkdirSync18(improvementsDir, { recursive: true });
|
|
181137
181223
|
}
|
|
181138
181224
|
function save(improvement) {
|
|
181139
|
-
const filePath =
|
|
181225
|
+
const filePath = join54(improvementsDir, `${improvement.id}.json`);
|
|
181140
181226
|
writeFileSync16(filePath, JSON.stringify(improvement, null, 2), "utf-8");
|
|
181141
181227
|
}
|
|
181142
181228
|
function list() {
|
|
@@ -181154,7 +181240,7 @@ function createImprovementStore(improvementsDir) {
|
|
|
181154
181240
|
return files.map((f2) => get(basename10(f2, ".json"))).filter((i3) => i3 !== null);
|
|
181155
181241
|
}
|
|
181156
181242
|
function get(id) {
|
|
181157
|
-
const filePath =
|
|
181243
|
+
const filePath = join54(improvementsDir, `${id}.json`);
|
|
181158
181244
|
try {
|
|
181159
181245
|
const raw = readFileSync47(filePath, "utf-8");
|
|
181160
181246
|
return JSON.parse(raw);
|
|
@@ -181227,7 +181313,7 @@ async function applyLearningsCli(options = {}) {
|
|
|
181227
181313
|
}
|
|
181228
181314
|
|
|
181229
181315
|
// packages/omo-opencode/src/cli/boulder/boulder.ts
|
|
181230
|
-
import { existsSync as
|
|
181316
|
+
import { existsSync as existsSync62 } from "fs";
|
|
181231
181317
|
|
|
181232
181318
|
// packages/omo-opencode/src/cli/boulder/formatter.ts
|
|
181233
181319
|
var import_picocolors22 = __toESM(require_picocolors(), 1);
|
|
@@ -181364,10 +181450,10 @@ async function boulder(options) {
|
|
|
181364
181450
|
const boulderFilePath = getBoulderFilePath(directory);
|
|
181365
181451
|
const state2 = readBoulderState(directory);
|
|
181366
181452
|
if (!state2) {
|
|
181367
|
-
const message =
|
|
181453
|
+
const message = existsSync62(boulderFilePath) ? formatReadErrorMessage(options.json) : formatNoBoulderMessage(options.json);
|
|
181368
181454
|
process.stderr.write(`${message}
|
|
181369
181455
|
`);
|
|
181370
|
-
return
|
|
181456
|
+
return existsSync62(boulderFilePath) ? 2 : 1;
|
|
181371
181457
|
}
|
|
181372
181458
|
const works = getBoulderWorks(state2);
|
|
181373
181459
|
const filteredWorks = options.workId ? works.filter((work) => work.work_id === options.workId) : works;
|
|
@@ -181962,25 +182048,25 @@ async function refreshModelCapabilities(options, deps = {}) {
|
|
|
181962
182048
|
// packages/skills-loader-core/src/features/opencode-skill-loader/loader.ts
|
|
181963
182049
|
init_src();
|
|
181964
182050
|
init_shared_skills();
|
|
181965
|
-
import { join as
|
|
182051
|
+
import { join as join63 } from "path";
|
|
181966
182052
|
|
|
181967
182053
|
// packages/skills-loader-core/src/shared/claude-config-dir.ts
|
|
181968
182054
|
init_src();
|
|
181969
|
-
import { join as
|
|
182055
|
+
import { join as join57 } from "path";
|
|
181970
182056
|
function getClaudeConfigDir() {
|
|
181971
182057
|
const envConfigDir = process.env.CLAUDE_CONFIG_DIR;
|
|
181972
182058
|
if (envConfigDir) {
|
|
181973
182059
|
return envConfigDir;
|
|
181974
182060
|
}
|
|
181975
|
-
return
|
|
182061
|
+
return join57(getHomeDirectory(), ".claude");
|
|
181976
182062
|
}
|
|
181977
182063
|
// packages/skills-loader-core/src/shared/opencode-command-dirs.ts
|
|
181978
|
-
import { basename as basename11, dirname as dirname22, join as
|
|
182064
|
+
import { basename as basename11, dirname as dirname22, join as join59 } from "path";
|
|
181979
182065
|
|
|
181980
182066
|
// packages/skills-loader-core/src/shared/opencode-config-dir.ts
|
|
181981
|
-
import { existsSync as
|
|
181982
|
-
import { homedir as
|
|
181983
|
-
import { join as
|
|
182067
|
+
import { existsSync as existsSync64, realpathSync as realpathSync8 } from "fs";
|
|
182068
|
+
import { homedir as homedir22 } from "os";
|
|
182069
|
+
import { join as join58, posix as posix5, resolve as resolve12, win32 as win325 } from "path";
|
|
181984
182070
|
|
|
181985
182071
|
// packages/skills-loader-core/src/shared/plugin-identity.ts
|
|
181986
182072
|
init_src();
|
|
@@ -182013,15 +182099,15 @@ function getTauriConfigDir2(identifier) {
|
|
|
182013
182099
|
const platform2 = process.platform;
|
|
182014
182100
|
switch (platform2) {
|
|
182015
182101
|
case "darwin":
|
|
182016
|
-
return
|
|
182102
|
+
return join58(homedir22(), "Library", "Application Support", identifier);
|
|
182017
182103
|
case "win32": {
|
|
182018
|
-
const appData = process.env.APPDATA ||
|
|
182104
|
+
const appData = process.env.APPDATA || join58(homedir22(), "AppData", "Roaming");
|
|
182019
182105
|
return win325.join(appData, identifier);
|
|
182020
182106
|
}
|
|
182021
182107
|
case "linux":
|
|
182022
182108
|
default: {
|
|
182023
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME ||
|
|
182024
|
-
return
|
|
182109
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join58(homedir22(), ".config");
|
|
182110
|
+
return join58(xdgConfig, identifier);
|
|
182025
182111
|
}
|
|
182026
182112
|
}
|
|
182027
182113
|
}
|
|
@@ -182030,7 +182116,7 @@ function resolveConfigPath3(pathValue) {
|
|
|
182030
182116
|
return posix5.normalize(pathValue);
|
|
182031
182117
|
}
|
|
182032
182118
|
const resolvedPath = resolve12(pathValue);
|
|
182033
|
-
if (!
|
|
182119
|
+
if (!existsSync64(resolvedPath))
|
|
182034
182120
|
return resolvedPath;
|
|
182035
182121
|
try {
|
|
182036
182122
|
return realpathSync8(resolvedPath);
|
|
@@ -182064,8 +182150,8 @@ function getWslLinuxHomeDir2(windowsConfigRoot) {
|
|
|
182064
182150
|
function getCliDefaultConfigDir2() {
|
|
182065
182151
|
const envXdgConfig = process.env.XDG_CONFIG_HOME?.trim();
|
|
182066
182152
|
const shouldIgnoreWindowsXdg = envXdgConfig !== undefined && envXdgConfig.length > 0 && isWslEnvironment2() && isWindowsUserConfigRoot2(envXdgConfig);
|
|
182067
|
-
const xdgConfig = shouldIgnoreWindowsXdg ? posix5.join(getWslLinuxHomeDir2(envXdgConfig) ?? "/home", ".config") : envXdgConfig ||
|
|
182068
|
-
const configDir = isWslEnvironment2() ? posix5.join(xdgConfig, "opencode") :
|
|
182153
|
+
const xdgConfig = shouldIgnoreWindowsXdg ? posix5.join(getWslLinuxHomeDir2(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join58(homedir22(), ".config");
|
|
182154
|
+
const configDir = isWslEnvironment2() ? posix5.join(xdgConfig, "opencode") : join58(xdgConfig, "opencode");
|
|
182069
182155
|
return resolveConfigPath3(configDir);
|
|
182070
182156
|
}
|
|
182071
182157
|
function getCliCustomConfigDir2() {
|
|
@@ -182098,9 +182184,9 @@ function getOpenCodeConfigDir2(options) {
|
|
|
182098
182184
|
const tauriDir = process.platform === "win32" ? win325.isAbsolute(tauriDirBase) ? win325.normalize(tauriDirBase) : win325.resolve(tauriDirBase) : resolveConfigPath3(tauriDirBase);
|
|
182099
182185
|
if (checkExisting) {
|
|
182100
182186
|
const legacyDir = getCliConfigDir2();
|
|
182101
|
-
const legacyConfig =
|
|
182102
|
-
const legacyConfigC =
|
|
182103
|
-
if (
|
|
182187
|
+
const legacyConfig = join58(legacyDir, "opencode.json");
|
|
182188
|
+
const legacyConfigC = join58(legacyDir, "opencode.jsonc");
|
|
182189
|
+
if (existsSync64(legacyConfig) || existsSync64(legacyConfigC)) {
|
|
182104
182190
|
return legacyDir;
|
|
182105
182191
|
}
|
|
182106
182192
|
}
|
|
@@ -182121,21 +182207,21 @@ function getOpenCodeSkillDirs(options) {
|
|
|
182121
182207
|
...configDirs.flatMap((configDir) => {
|
|
182122
182208
|
const parentConfigDir = getParentOpencodeConfigDir(configDir);
|
|
182123
182209
|
return [
|
|
182124
|
-
|
|
182125
|
-
|
|
182126
|
-
...parentConfigDir ? [
|
|
182210
|
+
join59(configDir, "skills"),
|
|
182211
|
+
join59(configDir, "skill"),
|
|
182212
|
+
...parentConfigDir ? [join59(parentConfigDir, "skills"), join59(parentConfigDir, "skill")] : []
|
|
182127
182213
|
];
|
|
182128
182214
|
})
|
|
182129
182215
|
]));
|
|
182130
182216
|
}
|
|
182131
182217
|
// packages/skills-loader-core/src/shared/project-discovery-dirs.ts
|
|
182132
182218
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
182133
|
-
import { existsSync as
|
|
182134
|
-
import { dirname as dirname23, join as
|
|
182219
|
+
import { existsSync as existsSync65, realpathSync as realpathSync9 } from "fs";
|
|
182220
|
+
import { dirname as dirname23, join as join60, resolve as resolve13, win32 as win326 } from "path";
|
|
182135
182221
|
var worktreePathCache2 = new Map;
|
|
182136
182222
|
function normalizePath2(path18) {
|
|
182137
182223
|
const resolvedPath = process.platform !== "win32" && win326.isAbsolute(path18) ? path18 : resolve13(path18);
|
|
182138
|
-
if (!
|
|
182224
|
+
if (!existsSync65(resolvedPath)) {
|
|
182139
182225
|
return resolvedPath;
|
|
182140
182226
|
}
|
|
182141
182227
|
try {
|
|
@@ -182166,8 +182252,8 @@ function findAncestorDirectories(startDirectory, targetPaths, stopDirectory) {
|
|
|
182166
182252
|
const stopDirectoryKey = resolvedStopDirectory ? pathKey2(resolvedStopDirectory) : undefined;
|
|
182167
182253
|
while (true) {
|
|
182168
182254
|
for (const targetPath of targetPaths) {
|
|
182169
|
-
const candidateDirectory =
|
|
182170
|
-
if (!
|
|
182255
|
+
const candidateDirectory = join60(currentDirectory, ...targetPath);
|
|
182256
|
+
if (!existsSync65(candidateDirectory)) {
|
|
182171
182257
|
continue;
|
|
182172
182258
|
}
|
|
182173
182259
|
const normalizedCandidateDirectory = normalizePath2(candidateDirectory);
|
|
@@ -182249,7 +182335,7 @@ function deduplicateSkillsByName(skills2) {
|
|
|
182249
182335
|
// packages/skills-loader-core/src/features/opencode-skill-loader/skill-directory-loader.ts
|
|
182250
182336
|
init_src();
|
|
182251
182337
|
import * as fs20 from "fs/promises";
|
|
182252
|
-
import { join as
|
|
182338
|
+
import { join as join62 } from "path";
|
|
182253
182339
|
|
|
182254
182340
|
// packages/skills-loader-core/src/features/opencode-skill-loader/loaded-skill-from-path.ts
|
|
182255
182341
|
init_src();
|
|
@@ -182270,7 +182356,7 @@ function parseAllowedTools(allowedTools) {
|
|
|
182270
182356
|
// packages/skills-loader-core/src/features/opencode-skill-loader/skill-mcp-config.ts
|
|
182271
182357
|
init_js_yaml();
|
|
182272
182358
|
import * as fs18 from "fs/promises";
|
|
182273
|
-
import { join as
|
|
182359
|
+
import { join as join61 } from "path";
|
|
182274
182360
|
function parseSkillMcpConfigFromFrontmatter(content) {
|
|
182275
182361
|
const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
182276
182362
|
if (!frontmatterMatch)
|
|
@@ -182289,7 +182375,7 @@ function parseSkillMcpConfigFromFrontmatter(content) {
|
|
|
182289
182375
|
return;
|
|
182290
182376
|
}
|
|
182291
182377
|
async function loadMcpJsonFromDir(skillDir) {
|
|
182292
|
-
const mcpJsonPath =
|
|
182378
|
+
const mcpJsonPath = join61(skillDir, "mcp.json");
|
|
182293
182379
|
try {
|
|
182294
182380
|
const content = await fs18.readFile(mcpJsonPath, "utf-8");
|
|
182295
182381
|
const parsed = JSON.parse(content);
|
|
@@ -182405,10 +182491,10 @@ async function loadSkillsFromDir(options) {
|
|
|
182405
182491
|
const directories = entries.filter((entry) => !entry.name.startsWith(".") && (entry.isDirectory() || entry.isSymbolicLink()));
|
|
182406
182492
|
const files = entries.filter((entry) => !entry.name.startsWith(".") && !entry.isDirectory() && !entry.isSymbolicLink() && isMarkdownFile(entry));
|
|
182407
182493
|
for (const entry of directories) {
|
|
182408
|
-
const entryPath =
|
|
182494
|
+
const entryPath = join62(options.skillsDir, entry.name);
|
|
182409
182495
|
const resolvedPath = await resolveSymlinkAsync(entryPath);
|
|
182410
182496
|
const dirName = entry.name;
|
|
182411
|
-
const skillMdPath =
|
|
182497
|
+
const skillMdPath = join62(resolvedPath, "SKILL.md");
|
|
182412
182498
|
if (await canAccessFile(skillMdPath)) {
|
|
182413
182499
|
const skill = await loadSkillFromPath({
|
|
182414
182500
|
skillPath: skillMdPath,
|
|
@@ -182422,7 +182508,7 @@ async function loadSkillsFromDir(options) {
|
|
|
182422
182508
|
}
|
|
182423
182509
|
continue;
|
|
182424
182510
|
}
|
|
182425
|
-
const namedSkillMdPath =
|
|
182511
|
+
const namedSkillMdPath = join62(resolvedPath, `${dirName}.md`);
|
|
182426
182512
|
if (await canAccessFile(namedSkillMdPath)) {
|
|
182427
182513
|
const skill = await loadSkillFromPath({
|
|
182428
182514
|
skillPath: namedSkillMdPath,
|
|
@@ -182453,7 +182539,7 @@ async function loadSkillsFromDir(options) {
|
|
|
182453
182539
|
}
|
|
182454
182540
|
}
|
|
182455
182541
|
for (const entry of files) {
|
|
182456
|
-
const entryPath =
|
|
182542
|
+
const entryPath = join62(options.skillsDir, entry.name);
|
|
182457
182543
|
const baseName = inferSkillNameFromFileName(entryPath);
|
|
182458
182544
|
const skill = await loadSkillFromPath({
|
|
182459
182545
|
skillPath: entryPath,
|
|
@@ -182505,7 +182591,7 @@ async function discoverAllSkills(directory) {
|
|
|
182505
182591
|
]);
|
|
182506
182592
|
}
|
|
182507
182593
|
async function discoverUserClaudeSkills() {
|
|
182508
|
-
const userSkillsDir =
|
|
182594
|
+
const userSkillsDir = join63(getClaudeConfigDir(), "skills");
|
|
182509
182595
|
return loadSkillsFromDir({ skillsDir: userSkillsDir, scope: "user" });
|
|
182510
182596
|
}
|
|
182511
182597
|
async function discoverProjectClaudeSkills(directory) {
|
|
@@ -182532,7 +182618,7 @@ async function discoverProjectAgentsSkills(directory) {
|
|
|
182532
182618
|
return deduplicateSkillsByName(allSkills.flat());
|
|
182533
182619
|
}
|
|
182534
182620
|
async function discoverGlobalAgentsSkills(homeDirectory = getHomeDirectory()) {
|
|
182535
|
-
const agentsGlobalDir =
|
|
182621
|
+
const agentsGlobalDir = join63(homeDirectory, ".agents", "skills");
|
|
182536
182622
|
return loadSkillsFromDir({ skillsDir: agentsGlobalDir, scope: "user" });
|
|
182537
182623
|
}
|
|
182538
182624
|
// packages/skills-loader-core/src/features/opencode-skill-loader/merger/builtin-skill-converter.ts
|
|
@@ -183284,7 +183370,7 @@ playwright-cli close
|
|
|
183284
183370
|
init_shared_skills();
|
|
183285
183371
|
init_src();
|
|
183286
183372
|
import { readFileSync as readFileSync50 } from "fs";
|
|
183287
|
-
import { join as
|
|
183373
|
+
import { join as join64 } from "path";
|
|
183288
183374
|
function createSharedSkillTemplateLoader(readFile3 = readFileSync50, skillsRootPath = sharedSkillsRootPath()) {
|
|
183289
183375
|
const cache = new Map;
|
|
183290
183376
|
return (skillName) => {
|
|
@@ -183292,7 +183378,7 @@ function createSharedSkillTemplateLoader(readFile3 = readFileSync50, skillsRootP
|
|
|
183292
183378
|
if (cached2 !== undefined)
|
|
183293
183379
|
return cached2;
|
|
183294
183380
|
try {
|
|
183295
|
-
const { body } = parseFrontmatter(readFile3(
|
|
183381
|
+
const { body } = parseFrontmatter(readFile3(join64(skillsRootPath, skillName, "SKILL.md"), "utf8"));
|
|
183296
183382
|
cache.set(skillName, body);
|
|
183297
183383
|
return body;
|
|
183298
183384
|
} catch (error51) {
|
|
@@ -184429,7 +184515,7 @@ var gitMasterSkill = {
|
|
|
184429
184515
|
template: GIT_MASTER_TEMPLATE
|
|
184430
184516
|
};
|
|
184431
184517
|
// packages/skills-loader-core/src/features/builtin-skills/skills/dev-browser.ts
|
|
184432
|
-
import { dirname as dirname24, join as
|
|
184518
|
+
import { dirname as dirname24, join as join65 } from "path";
|
|
184433
184519
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
184434
184520
|
var CURRENT_DIR = dirname24(fileURLToPath8(import.meta.url));
|
|
184435
184521
|
var devBrowserSkill = {
|
|
@@ -184649,7 +184735,7 @@ console.log({
|
|
|
184649
184735
|
await client.disconnect();
|
|
184650
184736
|
EOF
|
|
184651
184737
|
\`\`\``,
|
|
184652
|
-
resolvedPath:
|
|
184738
|
+
resolvedPath: join65(CURRENT_DIR, "..", "dev-browser")
|
|
184653
184739
|
};
|
|
184654
184740
|
// packages/skills-loader-core/src/features/builtin-skills/skills/review-work.ts
|
|
184655
184741
|
var reviewWorkSkill = {
|
|
@@ -185642,9 +185728,9 @@ function applySnapshotRetention(options) {
|
|
|
185642
185728
|
// packages/omo-opencode/src/cli/snapshot/snapshot.ts
|
|
185643
185729
|
import { Database as Database3 } from "bun:sqlite";
|
|
185644
185730
|
import {
|
|
185645
|
-
existsSync as
|
|
185646
|
-
mkdirSync as
|
|
185647
|
-
copyFileSync as
|
|
185731
|
+
existsSync as existsSync67,
|
|
185732
|
+
mkdirSync as mkdirSync21,
|
|
185733
|
+
copyFileSync as copyFileSync4,
|
|
185648
185734
|
readFileSync as readFileSync51,
|
|
185649
185735
|
writeFileSync as writeFileSync19,
|
|
185650
185736
|
readdirSync as readdirSync10,
|
|
@@ -185658,13 +185744,13 @@ async function snapshotCli(options = {}) {
|
|
|
185658
185744
|
const homeDir = os7.homedir();
|
|
185659
185745
|
const snapshotDir = options.snapshotDir ?? path18.join(homeDir, ".matrixos", "snapshots");
|
|
185660
185746
|
const allPaths = getAllSnapshotPaths(homeDir);
|
|
185661
|
-
const files = allPaths.files.filter((f2) =>
|
|
185747
|
+
const files = allPaths.files.filter((f2) => existsSync67(f2.sourcePath));
|
|
185662
185748
|
const realFs = {
|
|
185663
|
-
existsSync:
|
|
185664
|
-
mkdirSync:
|
|
185749
|
+
existsSync: existsSync67,
|
|
185750
|
+
mkdirSync: mkdirSync21,
|
|
185665
185751
|
readFileSync: readFileSync51,
|
|
185666
185752
|
writeFileSync: writeFileSync19,
|
|
185667
|
-
copyFileSync:
|
|
185753
|
+
copyFileSync: copyFileSync4,
|
|
185668
185754
|
readdirSync: readdirSync10,
|
|
185669
185755
|
statSync: statSync8,
|
|
185670
185756
|
rmSync: rmSync4
|
|
@@ -185725,9 +185811,9 @@ async function snapshotCli(options = {}) {
|
|
|
185725
185811
|
|
|
185726
185812
|
// packages/omo-opencode/src/cli/snapshot/restore.ts
|
|
185727
185813
|
import {
|
|
185728
|
-
existsSync as
|
|
185729
|
-
mkdirSync as
|
|
185730
|
-
copyFileSync as
|
|
185814
|
+
existsSync as existsSync68,
|
|
185815
|
+
mkdirSync as mkdirSync22,
|
|
185816
|
+
copyFileSync as copyFileSync5,
|
|
185731
185817
|
readFileSync as readFileSync52,
|
|
185732
185818
|
writeFileSync as writeFileSync20,
|
|
185733
185819
|
readdirSync as readdirSync11,
|
|
@@ -185739,11 +185825,11 @@ import * as os8 from "os";
|
|
|
185739
185825
|
async function restoreCli(options) {
|
|
185740
185826
|
const snapshotDir = options.snapshotDir ?? path19.join(os8.homedir(), ".matrixos", "snapshots");
|
|
185741
185827
|
const realFs = {
|
|
185742
|
-
existsSync:
|
|
185743
|
-
mkdirSync:
|
|
185828
|
+
existsSync: existsSync68,
|
|
185829
|
+
mkdirSync: mkdirSync22,
|
|
185744
185830
|
readFileSync: readFileSync52,
|
|
185745
185831
|
writeFileSync: writeFileSync20,
|
|
185746
|
-
copyFileSync:
|
|
185832
|
+
copyFileSync: copyFileSync5,
|
|
185747
185833
|
readdirSync: readdirSync11,
|
|
185748
185834
|
statSync: statSync9,
|
|
185749
185835
|
rmSync: rmSync5
|
|
@@ -185777,9 +185863,9 @@ async function restoreCli(options) {
|
|
|
185777
185863
|
|
|
185778
185864
|
// packages/omo-opencode/src/cli/snapshot/list.ts
|
|
185779
185865
|
import {
|
|
185780
|
-
existsSync as
|
|
185781
|
-
mkdirSync as
|
|
185782
|
-
copyFileSync as
|
|
185866
|
+
existsSync as existsSync69,
|
|
185867
|
+
mkdirSync as mkdirSync23,
|
|
185868
|
+
copyFileSync as copyFileSync6,
|
|
185783
185869
|
readFileSync as readFileSync53,
|
|
185784
185870
|
writeFileSync as writeFileSync21,
|
|
185785
185871
|
readdirSync as readdirSync12,
|
|
@@ -185801,11 +185887,11 @@ function formatBytes(bytes) {
|
|
|
185801
185887
|
async function snapshotListCli(options) {
|
|
185802
185888
|
const snapshotDir = options.snapshotDir ?? path20.join(os9.homedir(), ".matrixos", "snapshots");
|
|
185803
185889
|
const realFs = {
|
|
185804
|
-
existsSync:
|
|
185805
|
-
mkdirSync:
|
|
185890
|
+
existsSync: existsSync69,
|
|
185891
|
+
mkdirSync: mkdirSync23,
|
|
185806
185892
|
readFileSync: readFileSync53,
|
|
185807
185893
|
writeFileSync: writeFileSync21,
|
|
185808
|
-
copyFileSync:
|
|
185894
|
+
copyFileSync: copyFileSync6,
|
|
185809
185895
|
readdirSync: readdirSync12,
|
|
185810
185896
|
statSync: statSync10,
|
|
185811
185897
|
rmSync: rmSync6
|
|
@@ -185831,9 +185917,9 @@ async function snapshotListCli(options) {
|
|
|
185831
185917
|
|
|
185832
185918
|
// packages/omo-opencode/src/cli/snapshot/prune.ts
|
|
185833
185919
|
import {
|
|
185834
|
-
existsSync as
|
|
185835
|
-
mkdirSync as
|
|
185836
|
-
copyFileSync as
|
|
185920
|
+
existsSync as existsSync70,
|
|
185921
|
+
mkdirSync as mkdirSync24,
|
|
185922
|
+
copyFileSync as copyFileSync7,
|
|
185837
185923
|
readFileSync as readFileSync54,
|
|
185838
185924
|
writeFileSync as writeFileSync22,
|
|
185839
185925
|
readdirSync as readdirSync13,
|
|
@@ -185845,11 +185931,11 @@ import * as os10 from "os";
|
|
|
185845
185931
|
async function snapshotPruneCli(options = {}) {
|
|
185846
185932
|
const snapshotDir = options.snapshotDir ?? path21.join(os10.homedir(), ".matrixos", "snapshots");
|
|
185847
185933
|
const realFs = {
|
|
185848
|
-
existsSync:
|
|
185849
|
-
mkdirSync:
|
|
185934
|
+
existsSync: existsSync70,
|
|
185935
|
+
mkdirSync: mkdirSync24,
|
|
185850
185936
|
readFileSync: readFileSync54,
|
|
185851
185937
|
writeFileSync: writeFileSync22,
|
|
185852
|
-
copyFileSync:
|
|
185938
|
+
copyFileSync: copyFileSync7,
|
|
185853
185939
|
readdirSync: readdirSync13,
|
|
185854
185940
|
statSync: statSync11,
|
|
185855
185941
|
rmSync: rmSync7
|
|
@@ -185895,8 +185981,8 @@ function codebaseCli(rootProgram) {
|
|
|
185895
185981
|
try {
|
|
185896
185982
|
const dimension = Number.parseInt(options.dimension, 10) || 384;
|
|
185897
185983
|
const dbDir = path22.dirname(options.db);
|
|
185898
|
-
const { mkdirSync:
|
|
185899
|
-
|
|
185984
|
+
const { mkdirSync: mkdirSync25 } = await import("fs");
|
|
185985
|
+
mkdirSync25(dbDir, { recursive: true });
|
|
185900
185986
|
const store4 = createSqliteVectorStore({ path: options.db, dimension });
|
|
185901
185987
|
if (options.reset) {
|
|
185902
185988
|
store4.clear();
|
|
@@ -187113,7 +187199,7 @@ function loadGatewayPassphrase() {
|
|
|
187113
187199
|
}
|
|
187114
187200
|
async function dashboardCli(options) {
|
|
187115
187201
|
const port3 = options.port ?? 9123;
|
|
187116
|
-
const host = options.host ?? "
|
|
187202
|
+
const host = options.host ?? "0.0.0.0";
|
|
187117
187203
|
const frontendDir = path25.resolve(import.meta.dir, "../features/dashboard/frontend");
|
|
187118
187204
|
const gatewayPassphrase = loadGatewayPassphrase();
|
|
187119
187205
|
console.log(`[dashboard] starting MaTrixOS dashboard on http://${host}:${port3}`);
|
|
@@ -187147,11 +187233,11 @@ async function dashboardCli(options) {
|
|
|
187147
187233
|
}
|
|
187148
187234
|
|
|
187149
187235
|
// packages/omo-opencode/src/cli/architect.ts
|
|
187150
|
-
import { join as
|
|
187236
|
+
import { join as join75 } from "path";
|
|
187151
187237
|
var IMPROVEMENTS_DIR = ".matrixos/improvements";
|
|
187152
187238
|
function getStore(directory) {
|
|
187153
187239
|
const baseDir = directory ?? process.cwd();
|
|
187154
|
-
return createImprovementStore(
|
|
187240
|
+
return createImprovementStore(join75(baseDir, IMPROVEMENTS_DIR));
|
|
187155
187241
|
}
|
|
187156
187242
|
async function architectReview(options) {
|
|
187157
187243
|
const store4 = getStore(options.directory);
|