@kl-c/matrixos 0.3.45 → 0.3.47
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 +426 -268
- package/dist/cli/skill-create.d.ts +19 -0
- package/dist/cli-node/index.js +426 -268
- package/dist/index.js +1 -1
- 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.3.
|
|
2166
|
+
version: "0.3.47",
|
|
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",
|
|
@@ -65151,13 +65151,34 @@ var init_safe_create_hook = __esm(() => {
|
|
|
65151
65151
|
});
|
|
65152
65152
|
|
|
65153
65153
|
// packages/omo-opencode/src/shared/opencode-command-dirs.ts
|
|
65154
|
+
import { basename as basename2, dirname as dirname4, join as join18 } from "path";
|
|
65155
|
+
function getParentOpencodeConfigDir(configDir) {
|
|
65156
|
+
const parentDir = dirname4(configDir);
|
|
65157
|
+
if (basename2(parentDir) !== "profiles") {
|
|
65158
|
+
return null;
|
|
65159
|
+
}
|
|
65160
|
+
return dirname4(parentDir);
|
|
65161
|
+
}
|
|
65162
|
+
function getOpenCodeSkillDirs(options) {
|
|
65163
|
+
const configDirs = getOpenCodeConfigDirs(options);
|
|
65164
|
+
return Array.from(new Set([
|
|
65165
|
+
...configDirs.flatMap((configDir) => {
|
|
65166
|
+
const parentConfigDir = getParentOpencodeConfigDir(configDir);
|
|
65167
|
+
return [
|
|
65168
|
+
join18(configDir, "skills"),
|
|
65169
|
+
join18(configDir, "skill"),
|
|
65170
|
+
...parentConfigDir ? [join18(parentConfigDir, "skills"), join18(parentConfigDir, "skill")] : []
|
|
65171
|
+
];
|
|
65172
|
+
})
|
|
65173
|
+
]));
|
|
65174
|
+
}
|
|
65154
65175
|
var init_opencode_command_dirs = __esm(() => {
|
|
65155
65176
|
init_opencode_config_dir();
|
|
65156
65177
|
});
|
|
65157
65178
|
|
|
65158
65179
|
// packages/omo-opencode/src/shared/project-discovery-dirs.ts
|
|
65159
65180
|
import { existsSync as existsSync15, realpathSync as realpathSync5 } from "fs";
|
|
65160
|
-
import { dirname as
|
|
65181
|
+
import { dirname as dirname5, join as join19, resolve as resolve6, win32 as win322 } from "path";
|
|
65161
65182
|
function normalizePath(path7) {
|
|
65162
65183
|
const resolvedPath = process.platform !== "win32" && win322.isAbsolute(path7) ? path7 : resolve6(path7);
|
|
65163
65184
|
if (!existsSync15(resolvedPath)) {
|
|
@@ -65190,7 +65211,7 @@ function findProjectOpencodePluginConfigFiles(startDirectory, stopDirectory) {
|
|
|
65190
65211
|
const resolvedStopDirectory = stopDirectory ? normalizePath(stopDirectory) : undefined;
|
|
65191
65212
|
const stopDirectoryKey = resolvedStopDirectory ? pathKey(resolvedStopDirectory) : undefined;
|
|
65192
65213
|
while (true) {
|
|
65193
|
-
const opencodeDirectory =
|
|
65214
|
+
const opencodeDirectory = join19(currentDirectory, ".opencode");
|
|
65194
65215
|
if (existsSync15(opencodeDirectory)) {
|
|
65195
65216
|
const detected = detectPluginConfigFile(opencodeDirectory, {
|
|
65196
65217
|
basenames: [CONFIG_BASENAME],
|
|
@@ -65207,7 +65228,7 @@ function findProjectOpencodePluginConfigFiles(startDirectory, stopDirectory) {
|
|
|
65207
65228
|
if (stopDirectoryKey === pathKey(currentDirectory)) {
|
|
65208
65229
|
return paths;
|
|
65209
65230
|
}
|
|
65210
|
-
const parentDirectory =
|
|
65231
|
+
const parentDirectory = dirname5(currentDirectory);
|
|
65211
65232
|
if (parentDirectory === currentDirectory) {
|
|
65212
65233
|
return paths;
|
|
65213
65234
|
}
|
|
@@ -65728,7 +65749,7 @@ var init_plugin_name_with_version = __esm(() => {
|
|
|
65728
65749
|
|
|
65729
65750
|
// packages/omo-opencode/src/cli/config-manager/backup-config.ts
|
|
65730
65751
|
import { copyFileSync as copyFileSync2, existsSync as existsSync16, mkdirSync as mkdirSync6 } from "fs";
|
|
65731
|
-
import { dirname as
|
|
65752
|
+
import { dirname as dirname6 } from "path";
|
|
65732
65753
|
function backupConfigFile(configPath) {
|
|
65733
65754
|
if (!existsSync16(configPath)) {
|
|
65734
65755
|
return { success: true };
|
|
@@ -65736,7 +65757,7 @@ function backupConfigFile(configPath) {
|
|
|
65736
65757
|
const timestamp2 = new Date().toISOString().replace(/[:.]/g, "-");
|
|
65737
65758
|
const backupPath = `${configPath}.backup-${timestamp2}`;
|
|
65738
65759
|
try {
|
|
65739
|
-
const dir =
|
|
65760
|
+
const dir = dirname6(backupPath);
|
|
65740
65761
|
if (!existsSync16(dir)) {
|
|
65741
65762
|
mkdirSync6(dir, { recursive: true });
|
|
65742
65763
|
}
|
|
@@ -65934,10 +65955,10 @@ function extractVersionFromPluginEntry(entry) {
|
|
|
65934
65955
|
|
|
65935
65956
|
// packages/omo-opencode/src/cli/config-manager/add-plugin-to-opencode-config.ts
|
|
65936
65957
|
import { existsSync as existsSync19, readdirSync as readdirSync3, readFileSync as readFileSync9, writeFileSync as writeFileSync4 } from "fs";
|
|
65937
|
-
import { basename as
|
|
65958
|
+
import { basename as basename3, dirname as dirname7, join as join20 } from "path";
|
|
65938
65959
|
function detectConfigFormatInDir(configDir) {
|
|
65939
|
-
const configJsonc =
|
|
65940
|
-
const configJson =
|
|
65960
|
+
const configJsonc = join20(configDir, "opencode.jsonc");
|
|
65961
|
+
const configJson = join20(configDir, "opencode.json");
|
|
65941
65962
|
if (existsSync19(configJsonc)) {
|
|
65942
65963
|
return { format: "jsonc", path: configJsonc };
|
|
65943
65964
|
}
|
|
@@ -65947,16 +65968,16 @@ function detectConfigFormatInDir(configDir) {
|
|
|
65947
65968
|
return { format: "none", path: configJson };
|
|
65948
65969
|
}
|
|
65949
65970
|
function getParentConfigDirForProfile(configDir) {
|
|
65950
|
-
const parentDir =
|
|
65951
|
-
if (
|
|
65971
|
+
const parentDir = dirname7(configDir);
|
|
65972
|
+
if (basename3(parentDir) !== "profiles")
|
|
65952
65973
|
return null;
|
|
65953
|
-
return
|
|
65974
|
+
return dirname7(parentDir);
|
|
65954
65975
|
}
|
|
65955
65976
|
function listProfileConfigDirs(rootConfigDir) {
|
|
65956
|
-
const profilesDir =
|
|
65977
|
+
const profilesDir = join20(rootConfigDir, "profiles");
|
|
65957
65978
|
if (!existsSync19(profilesDir))
|
|
65958
65979
|
return [];
|
|
65959
|
-
return readdirSync3(profilesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) =>
|
|
65980
|
+
return readdirSync3(profilesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join20(profilesDir, entry.name)).filter((profileDir) => detectConfigFormatInDir(profileDir).format !== "none");
|
|
65960
65981
|
}
|
|
65961
65982
|
function getConfigTargets() {
|
|
65962
65983
|
const primaryConfigDir = getConfigDir();
|
|
@@ -66483,11 +66504,11 @@ var init_migrations_sidecar2 = __esm(() => {
|
|
|
66483
66504
|
|
|
66484
66505
|
// packages/omo-opencode/src/shared/migrate-legacy-config-file.ts
|
|
66485
66506
|
import { existsSync as existsSync20, readFileSync as readFileSync10, renameSync as renameSync4, rmSync } from "fs";
|
|
66486
|
-
import { join as
|
|
66507
|
+
import { join as join21, dirname as dirname8, basename as basename4 } from "path";
|
|
66487
66508
|
function buildCanonicalPath(legacyPath) {
|
|
66488
|
-
const dir =
|
|
66489
|
-
const ext =
|
|
66490
|
-
return
|
|
66509
|
+
const dir = dirname8(legacyPath);
|
|
66510
|
+
const ext = basename4(legacyPath).includes(".jsonc") ? ".jsonc" : ".json";
|
|
66511
|
+
return join21(dir, `${CONFIG_BASENAME}${ext}`);
|
|
66491
66512
|
}
|
|
66492
66513
|
function archiveLegacyConfigFile(legacyPath) {
|
|
66493
66514
|
const backupPath = `${legacyPath}.bak`;
|
|
@@ -66545,7 +66566,7 @@ function migrateLegacySidecarFile(legacyPath, canonicalPath) {
|
|
|
66545
66566
|
function migrateLegacyConfigFile(legacyPath) {
|
|
66546
66567
|
if (!existsSync20(legacyPath))
|
|
66547
66568
|
return false;
|
|
66548
|
-
if (!
|
|
66569
|
+
if (!basename4(legacyPath).startsWith(LEGACY_CONFIG_BASENAME))
|
|
66549
66570
|
return false;
|
|
66550
66571
|
const canonicalPath = buildCanonicalPath(legacyPath);
|
|
66551
66572
|
if (existsSync20(canonicalPath))
|
|
@@ -66593,7 +66614,7 @@ function deepMergeRecord(target, source) {
|
|
|
66593
66614
|
|
|
66594
66615
|
// packages/omo-opencode/src/cli/config-manager/write-omo-config.ts
|
|
66595
66616
|
import { existsSync as existsSync21, readFileSync as readFileSync11, statSync as statSync4, writeFileSync as writeFileSync5 } from "fs";
|
|
66596
|
-
import { basename as
|
|
66617
|
+
import { basename as basename5, dirname as dirname9, extname, join as join22 } from "path";
|
|
66597
66618
|
function isEmptyOrWhitespace2(content) {
|
|
66598
66619
|
return content.trim().length === 0;
|
|
66599
66620
|
}
|
|
@@ -66608,8 +66629,8 @@ function writeOmoConfig(installConfig) {
|
|
|
66608
66629
|
};
|
|
66609
66630
|
}
|
|
66610
66631
|
const detectedConfigPath = getOmoConfigPath();
|
|
66611
|
-
const canonicalConfigPath =
|
|
66612
|
-
const shouldMigrateLegacyPath =
|
|
66632
|
+
const canonicalConfigPath = join22(dirname9(detectedConfigPath), `${CONFIG_BASENAME}${extname(detectedConfigPath) || ".json"}`);
|
|
66633
|
+
const shouldMigrateLegacyPath = basename5(detectedConfigPath).startsWith(LEGACY_CONFIG_BASENAME);
|
|
66613
66634
|
const omoConfigPath = shouldMigrateLegacyPath ? migrateLegacyConfigFile(detectedConfigPath) || existsSync21(canonicalConfigPath) ? canonicalConfigPath : detectedConfigPath : detectedConfigPath;
|
|
66614
66635
|
try {
|
|
66615
66636
|
const newConfig = generateOmoConfig(installConfig);
|
|
@@ -66988,9 +67009,9 @@ var init_detect_current_config = __esm(() => {
|
|
|
66988
67009
|
|
|
66989
67010
|
// packages/omo-opencode/src/cli/config-manager/bun-install.ts
|
|
66990
67011
|
import { existsSync as existsSync23 } from "fs";
|
|
66991
|
-
import { join as
|
|
67012
|
+
import { join as join23 } from "path";
|
|
66992
67013
|
function getDefaultWorkspaceDir() {
|
|
66993
|
-
return
|
|
67014
|
+
return join23(getOpenCodeCacheDir(), "packages");
|
|
66994
67015
|
}
|
|
66995
67016
|
function readProcessOutput(stream) {
|
|
66996
67017
|
if (!stream) {
|
|
@@ -67426,12 +67447,12 @@ var init_star_request = __esm(() => {
|
|
|
67426
67447
|
|
|
67427
67448
|
// packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
|
|
67428
67449
|
import { existsSync as existsSync24, readFileSync as readFileSync13 } from "fs";
|
|
67429
|
-
import { join as
|
|
67450
|
+
import { join as join24 } from "path";
|
|
67430
67451
|
function fileEntryPackageJsonPath(entry) {
|
|
67431
67452
|
let path7 = entry.slice("file:".length);
|
|
67432
67453
|
if (path7.startsWith("//"))
|
|
67433
67454
|
path7 = path7.slice(2);
|
|
67434
|
-
return
|
|
67455
|
+
return join24(path7, "package.json");
|
|
67435
67456
|
}
|
|
67436
67457
|
function packageJsonExportsTui(pkgJsonPath) {
|
|
67437
67458
|
if (!existsSync24(pkgJsonPath))
|
|
@@ -67469,7 +67490,7 @@ function packageExportsTuiForServerEntry(entry) {
|
|
|
67469
67490
|
const packageName = packageNameFromServerEntry(entry);
|
|
67470
67491
|
if (packageName === null)
|
|
67471
67492
|
return null;
|
|
67472
|
-
return packageJsonExportsTui(
|
|
67493
|
+
return packageJsonExportsTui(join24(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
|
|
67473
67494
|
}
|
|
67474
67495
|
function isOurFilePluginEntry(entry) {
|
|
67475
67496
|
if (typeof entry !== "string" || !entry.startsWith("file:"))
|
|
@@ -67534,7 +67555,7 @@ function detectServerPluginRegistration() {
|
|
|
67534
67555
|
}
|
|
67535
67556
|
}
|
|
67536
67557
|
function detectTuiPluginRegistration() {
|
|
67537
|
-
const tuiJsonPath =
|
|
67558
|
+
const tuiJsonPath = join24(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
|
|
67538
67559
|
if (!existsSync24(tuiJsonPath)) {
|
|
67539
67560
|
return {
|
|
67540
67561
|
registered: false,
|
|
@@ -67682,7 +67703,7 @@ var init_tui_plugin_config = __esm(() => {
|
|
|
67682
67703
|
|
|
67683
67704
|
// packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
|
|
67684
67705
|
import { existsSync as existsSync25, mkdirSync as mkdirSync8, readFileSync as readFileSync14 } from "fs";
|
|
67685
|
-
import { join as
|
|
67706
|
+
import { join as join25 } from "path";
|
|
67686
67707
|
function readConfig(path7) {
|
|
67687
67708
|
try {
|
|
67688
67709
|
const parsed = parseJsonc(readFileSync14(path7, "utf-8"));
|
|
@@ -67696,10 +67717,10 @@ function readConfig(path7) {
|
|
|
67696
67717
|
return null;
|
|
67697
67718
|
}
|
|
67698
67719
|
function readServerConfig(configDir) {
|
|
67699
|
-
const jsoncPath =
|
|
67720
|
+
const jsoncPath = join25(configDir, "opencode.jsonc");
|
|
67700
67721
|
if (existsSync25(jsoncPath))
|
|
67701
67722
|
return readConfig(jsoncPath);
|
|
67702
|
-
const jsonPath =
|
|
67723
|
+
const jsonPath = join25(configDir, "opencode.json");
|
|
67703
67724
|
if (existsSync25(jsonPath))
|
|
67704
67725
|
return readConfig(jsonPath);
|
|
67705
67726
|
return null;
|
|
@@ -67741,7 +67762,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
67741
67762
|
if (!desiredEntry) {
|
|
67742
67763
|
return { changed: false, reason: "no-server-entry" };
|
|
67743
67764
|
}
|
|
67744
|
-
const tuiJsonPath =
|
|
67765
|
+
const tuiJsonPath = join25(configDir, "tui.json");
|
|
67745
67766
|
const { config, malformed } = readTuiConfig(tuiJsonPath);
|
|
67746
67767
|
if (malformed) {
|
|
67747
67768
|
return { changed: false, reason: "malformed" };
|
|
@@ -67771,17 +67792,17 @@ import {
|
|
|
67771
67792
|
unlinkSync as unlinkSync5,
|
|
67772
67793
|
readFileSync as readFileSync15
|
|
67773
67794
|
} from "fs";
|
|
67774
|
-
import { dirname as
|
|
67795
|
+
import { dirname as dirname10, join as join26 } from "path";
|
|
67775
67796
|
import { homedir as homedir6 } from "os";
|
|
67776
67797
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
67777
67798
|
function findSlashCommandSource() {
|
|
67778
67799
|
const candidates = [
|
|
67779
|
-
|
|
67780
|
-
|
|
67781
|
-
|
|
67800
|
+
join26(import.meta.dir, "slash-commands"),
|
|
67801
|
+
join26(import.meta.dir, "..", "slash-commands"),
|
|
67802
|
+
join26(import.meta.dir, "..", "..", "src", "cli", "slash-commands")
|
|
67782
67803
|
];
|
|
67783
67804
|
for (const c of candidates) {
|
|
67784
|
-
if (existsSync26(c) && existsSync26(
|
|
67805
|
+
if (existsSync26(c) && existsSync26(join26(c, "adopt.md")))
|
|
67785
67806
|
return c;
|
|
67786
67807
|
}
|
|
67787
67808
|
return null;
|
|
@@ -67795,10 +67816,10 @@ function copySlashCommandsTo(dir) {
|
|
|
67795
67816
|
return 0;
|
|
67796
67817
|
let copied = 0;
|
|
67797
67818
|
for (const name2 of SLASH_COMMAND_NAMES) {
|
|
67798
|
-
const src =
|
|
67819
|
+
const src = join26(srcDir, name2);
|
|
67799
67820
|
if (!existsSync26(src))
|
|
67800
67821
|
continue;
|
|
67801
|
-
copyFileSync3(src,
|
|
67822
|
+
copyFileSync3(src, join26(dir, name2));
|
|
67802
67823
|
copied++;
|
|
67803
67824
|
}
|
|
67804
67825
|
return copied;
|
|
@@ -67808,8 +67829,8 @@ function copySlashCommandsTo(dir) {
|
|
|
67808
67829
|
}
|
|
67809
67830
|
function resolveMatrixosBin() {
|
|
67810
67831
|
const candidates = [
|
|
67811
|
-
|
|
67812
|
-
|
|
67832
|
+
join26(import.meta.dir, "..", "..", "bin", "matrixos.js"),
|
|
67833
|
+
join26(import.meta.dir, "..", "bin", "matrixos.js")
|
|
67813
67834
|
];
|
|
67814
67835
|
for (const c of candidates) {
|
|
67815
67836
|
if (existsSync26(c))
|
|
@@ -67834,7 +67855,7 @@ function npmGlobalInstallMatrixos(version) {
|
|
|
67834
67855
|
if (bin && existsSync26(bin))
|
|
67835
67856
|
return bin;
|
|
67836
67857
|
for (const dir of ["/usr/local/bin", "/usr/bin"]) {
|
|
67837
|
-
const p =
|
|
67858
|
+
const p = join26(dir, "matrixos");
|
|
67838
67859
|
if (existsSync26(p))
|
|
67839
67860
|
return p;
|
|
67840
67861
|
}
|
|
@@ -67845,8 +67866,8 @@ function npmGlobalInstallMatrixos(version) {
|
|
|
67845
67866
|
}
|
|
67846
67867
|
function getPackageVersion() {
|
|
67847
67868
|
const candidates = [
|
|
67848
|
-
|
|
67849
|
-
|
|
67869
|
+
join26(import.meta.dir, "..", "..", "package.json"),
|
|
67870
|
+
join26(import.meta.dir, "..", "package.json")
|
|
67850
67871
|
];
|
|
67851
67872
|
for (const c of candidates) {
|
|
67852
67873
|
try {
|
|
@@ -67863,8 +67884,8 @@ function copyRecursive(from, to) {
|
|
|
67863
67884
|
if (!existsSync26(to))
|
|
67864
67885
|
mkdirSync9(to, { recursive: true });
|
|
67865
67886
|
for (const entry of readdirSync4(from, { withFileTypes: true })) {
|
|
67866
|
-
const src =
|
|
67867
|
-
const dst =
|
|
67887
|
+
const src = join26(from, entry.name);
|
|
67888
|
+
const dst = join26(to, entry.name);
|
|
67868
67889
|
if (entry.isDirectory()) {
|
|
67869
67890
|
copyRecursive(src, dst);
|
|
67870
67891
|
} else {
|
|
@@ -67873,12 +67894,12 @@ function copyRecursive(from, to) {
|
|
|
67873
67894
|
}
|
|
67874
67895
|
}
|
|
67875
67896
|
function installPackageTo(path7, bin) {
|
|
67876
|
-
const srcDir =
|
|
67897
|
+
const srcDir = dirname10(dirname10(bin));
|
|
67877
67898
|
if (!existsSync26(srcDir))
|
|
67878
67899
|
return null;
|
|
67879
67900
|
try {
|
|
67880
67901
|
copyRecursive(srcDir, path7);
|
|
67881
|
-
return
|
|
67902
|
+
return join26(path7, "bin", "matrixos.js");
|
|
67882
67903
|
} catch {
|
|
67883
67904
|
return null;
|
|
67884
67905
|
}
|
|
@@ -67886,8 +67907,8 @@ function installPackageTo(path7, bin) {
|
|
|
67886
67907
|
function installSlashCommandsAndPath() {
|
|
67887
67908
|
const home = homedir6();
|
|
67888
67909
|
const targets = [
|
|
67889
|
-
|
|
67890
|
-
|
|
67910
|
+
join26(home, ".config", "opencode", "commands"),
|
|
67911
|
+
join26(home, ".claude", "commands")
|
|
67891
67912
|
];
|
|
67892
67913
|
let total = 0;
|
|
67893
67914
|
for (const t of targets)
|
|
@@ -67944,7 +67965,7 @@ var init_shared_skills = () => {};
|
|
|
67944
67965
|
|
|
67945
67966
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
67946
67967
|
import { homedir as homedir7 } from "os";
|
|
67947
|
-
import { join as
|
|
67968
|
+
import { join as join27 } from "path";
|
|
67948
67969
|
function describeResult(result) {
|
|
67949
67970
|
if (result.kind === "succeeded")
|
|
67950
67971
|
return null;
|
|
@@ -67954,9 +67975,9 @@ function describeResult(result) {
|
|
|
67954
67975
|
}
|
|
67955
67976
|
async function installAstGrepForOpenCode(options = {}) {
|
|
67956
67977
|
const platform = options.platform ?? process.platform;
|
|
67957
|
-
const baseDir =
|
|
67978
|
+
const baseDir = join27(options.homeDir ?? homedir7(), ".omo");
|
|
67958
67979
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
67959
|
-
const skillDir =
|
|
67980
|
+
const skillDir = join27(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
67960
67981
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
67961
67982
|
try {
|
|
67962
67983
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -69776,12 +69797,12 @@ var init_dist5 = __esm(() => {
|
|
|
69776
69797
|
// packages/omo-opencode/src/cli/config-manager/write-gateway-env.ts
|
|
69777
69798
|
import { homedir as homedir8 } from "os";
|
|
69778
69799
|
import { existsSync as existsSync27, mkdirSync as mkdirSync10, readFileSync as readFileSync16, writeFileSync as writeFileSync6, chmodSync as chmodSync3 } from "fs";
|
|
69779
|
-
import { join as
|
|
69800
|
+
import { join as join28 } from "path";
|
|
69780
69801
|
function writeGatewayEnvToken(key, token) {
|
|
69781
69802
|
const configDir = homedir8();
|
|
69782
69803
|
if (!existsSync27(configDir))
|
|
69783
69804
|
mkdirSync10(configDir, { recursive: true });
|
|
69784
|
-
const envPath =
|
|
69805
|
+
const envPath = join28(configDir, GATEWAY_ENV_FILENAME);
|
|
69785
69806
|
const entries = new Map;
|
|
69786
69807
|
if (existsSync27(envPath)) {
|
|
69787
69808
|
const existing = readFileSync16(envPath, "utf-8");
|
|
@@ -102837,7 +102858,7 @@ var require_Util = __commonJS((exports, module2) => {
|
|
|
102837
102858
|
await client3.rest.patch(route, { body: updatedItems, reason });
|
|
102838
102859
|
return updatedItems;
|
|
102839
102860
|
}
|
|
102840
|
-
function
|
|
102861
|
+
function basename6(path7, ext) {
|
|
102841
102862
|
const res = parse7(path7);
|
|
102842
102863
|
return ext && res.ext.startsWith(ext) ? res.name : res.base.split("?")[0];
|
|
102843
102864
|
}
|
|
@@ -102960,7 +102981,7 @@ var require_Util = __commonJS((exports, module2) => {
|
|
|
102960
102981
|
resolveColor,
|
|
102961
102982
|
discordSort,
|
|
102962
102983
|
setPosition,
|
|
102963
|
-
basename:
|
|
102984
|
+
basename: basename6,
|
|
102964
102985
|
cleanContent,
|
|
102965
102986
|
cleanCodeBlockContent,
|
|
102966
102987
|
parseWebhookURL,
|
|
@@ -115781,7 +115802,7 @@ var require_MessagePayload = __commonJS((exports, module2) => {
|
|
|
115781
115802
|
var { DiscordjsError, DiscordjsRangeError, ErrorCodes } = require_errors();
|
|
115782
115803
|
var { resolveFile } = require_DataResolver();
|
|
115783
115804
|
var MessageFlagsBitField = require_MessageFlagsBitField();
|
|
115784
|
-
var { basename:
|
|
115805
|
+
var { basename: basename6, verifyString, resolvePartialEmoji } = require_Util();
|
|
115785
115806
|
var getBaseInteraction = lazy2(() => require_BaseInteraction());
|
|
115786
115807
|
|
|
115787
115808
|
class MessagePayload {
|
|
@@ -115966,10 +115987,10 @@ var require_MessagePayload = __commonJS((exports, module2) => {
|
|
|
115966
115987
|
let name2;
|
|
115967
115988
|
const findName = (thing) => {
|
|
115968
115989
|
if (typeof thing === "string") {
|
|
115969
|
-
return
|
|
115990
|
+
return basename6(thing);
|
|
115970
115991
|
}
|
|
115971
115992
|
if (thing.path) {
|
|
115972
|
-
return
|
|
115993
|
+
return basename6(thing.path);
|
|
115973
115994
|
}
|
|
115974
115995
|
return "file.jpg";
|
|
115975
115996
|
};
|
|
@@ -121495,7 +121516,7 @@ var require_dist9 = __commonJS((exports, module2) => {
|
|
|
121495
121516
|
var import_node_worker_threads2 = __require("worker_threads");
|
|
121496
121517
|
var import_collection2 = require_dist2();
|
|
121497
121518
|
var import_node_events = __require("events");
|
|
121498
|
-
var
|
|
121519
|
+
var import_node_path26 = __require("path");
|
|
121499
121520
|
var import_node_worker_threads = __require("worker_threads");
|
|
121500
121521
|
var import_collection = require_dist2();
|
|
121501
121522
|
var WorkerSendPayloadOp = /* @__PURE__ */ ((WorkerSendPayloadOp2) => {
|
|
@@ -121630,18 +121651,18 @@ var require_dist9 = __commonJS((exports, module2) => {
|
|
|
121630
121651
|
resolveWorkerPath() {
|
|
121631
121652
|
const path7 = this.options.workerPath;
|
|
121632
121653
|
if (!path7) {
|
|
121633
|
-
return (0,
|
|
121654
|
+
return (0, import_node_path26.join)(__dirname, "defaultWorker.js");
|
|
121634
121655
|
}
|
|
121635
|
-
if ((0,
|
|
121656
|
+
if ((0, import_node_path26.isAbsolute)(path7)) {
|
|
121636
121657
|
return path7;
|
|
121637
121658
|
}
|
|
121638
121659
|
if (/^\.\.?[/\\]/.test(path7)) {
|
|
121639
|
-
return (0,
|
|
121660
|
+
return (0, import_node_path26.resolve)(path7);
|
|
121640
121661
|
}
|
|
121641
121662
|
try {
|
|
121642
121663
|
return __require.resolve(path7);
|
|
121643
121664
|
} catch {
|
|
121644
|
-
return (0,
|
|
121665
|
+
return (0, import_node_path26.resolve)(path7);
|
|
121645
121666
|
}
|
|
121646
121667
|
}
|
|
121647
121668
|
async waitForWorkerReady(worker) {
|
|
@@ -128342,7 +128363,7 @@ var require_EmbedBuilder = __commonJS((exports, module2) => {
|
|
|
128342
128363
|
|
|
128343
128364
|
// node_modules/.bun/discord.js@14.27.0/node_modules/discord.js/src/structures/AttachmentBuilder.js
|
|
128344
128365
|
var require_AttachmentBuilder = __commonJS((exports, module2) => {
|
|
128345
|
-
var { basename:
|
|
128366
|
+
var { basename: basename6, flatten } = require_Util();
|
|
128346
128367
|
|
|
128347
128368
|
class AttachmentBuilder {
|
|
128348
128369
|
constructor(attachment, data = {}) {
|
|
@@ -128390,7 +128411,7 @@ var require_AttachmentBuilder = __commonJS((exports, module2) => {
|
|
|
128390
128411
|
return this;
|
|
128391
128412
|
}
|
|
128392
128413
|
get spoiler() {
|
|
128393
|
-
return
|
|
128414
|
+
return basename6(this.name).startsWith("SPOILER_");
|
|
128394
128415
|
}
|
|
128395
128416
|
toJSON() {
|
|
128396
128417
|
return flatten(this);
|
|
@@ -129159,7 +129180,7 @@ var init_writer2 = __esm(() => {
|
|
|
129159
129180
|
|
|
129160
129181
|
// packages/omo-config-core/src/generator/mini-os-generator.ts
|
|
129161
129182
|
import { existsSync as existsSync29, mkdirSync as mkdirSync11, writeFileSync as writeFileSync8 } from "fs";
|
|
129162
|
-
import { dirname as
|
|
129183
|
+
import { dirname as dirname11, join as join29 } from "path";
|
|
129163
129184
|
function generateMiniOS(options) {
|
|
129164
129185
|
const fs6 = options.fs ?? defaultFS;
|
|
129165
129186
|
const profile2 = options.profile;
|
|
@@ -129170,29 +129191,29 @@ function generateMiniOS(options) {
|
|
|
129170
129191
|
if (!fs6.existsSync(targetDir)) {
|
|
129171
129192
|
fs6.mkdirSync(targetDir, { recursive: true });
|
|
129172
129193
|
}
|
|
129173
|
-
const pkgPath =
|
|
129194
|
+
const pkgPath = join29(targetDir, "package.json");
|
|
129174
129195
|
writeIfMissing(fs6, pkgPath, TPL_PACKAGE_JSON(packageName, displayName, profile2.version, profile2.description, profile2.extends, profile2.baseAgent));
|
|
129175
129196
|
filesWritten.push(pkgPath);
|
|
129176
|
-
const srcDir =
|
|
129197
|
+
const srcDir = join29(targetDir, "src");
|
|
129177
129198
|
fs6.mkdirSync(srcDir, { recursive: true });
|
|
129178
|
-
const indexPath =
|
|
129199
|
+
const indexPath = join29(srcDir, "index.ts");
|
|
129179
129200
|
writeIfMissing(fs6, indexPath, TPL_INDEX_TS(profile2.name, displayName, profile2.description));
|
|
129180
129201
|
filesWritten.push(indexPath);
|
|
129181
|
-
const binDir =
|
|
129202
|
+
const binDir = join29(targetDir, "bin");
|
|
129182
129203
|
fs6.mkdirSync(binDir, { recursive: true });
|
|
129183
|
-
const binPath =
|
|
129204
|
+
const binPath = join29(binDir, "matrixos-mini.js");
|
|
129184
129205
|
writeIfMissing(fs6, binPath, TPL_BIN);
|
|
129185
129206
|
filesWritten.push(binPath);
|
|
129186
|
-
const scriptDir =
|
|
129207
|
+
const scriptDir = join29(targetDir, "script");
|
|
129187
129208
|
fs6.mkdirSync(scriptDir, { recursive: true });
|
|
129188
|
-
const buildPath =
|
|
129209
|
+
const buildPath = join29(scriptDir, "build.ts");
|
|
129189
129210
|
writeIfMissing(fs6, buildPath, TPL_BUILD_TS);
|
|
129190
129211
|
filesWritten.push(buildPath);
|
|
129191
129212
|
if (Object.keys(profile2.agents).length > 0) {
|
|
129192
|
-
const agentsDir =
|
|
129213
|
+
const agentsDir = join29(targetDir, "agents");
|
|
129193
129214
|
fs6.mkdirSync(agentsDir, { recursive: true });
|
|
129194
129215
|
for (const [agentName, agentDef] of Object.entries(profile2.agents)) {
|
|
129195
|
-
const agentFile =
|
|
129216
|
+
const agentFile = join29(agentsDir, `${agentName}.ts`);
|
|
129196
129217
|
const description = agentDef.description ?? `Custom ${displayName} agent: ${agentName}`;
|
|
129197
129218
|
writeIfMissing(fs6, agentFile, `// ${description}
|
|
129198
129219
|
// Generated by MaTrixOS Mini-OS Profile Generator.
|
|
@@ -129203,10 +129224,10 @@ export const description = ${JSON.stringify(description)}
|
|
|
129203
129224
|
}
|
|
129204
129225
|
}
|
|
129205
129226
|
if (profile2.skills.length > 0) {
|
|
129206
|
-
const skillsDir =
|
|
129227
|
+
const skillsDir = join29(targetDir, "skills");
|
|
129207
129228
|
fs6.mkdirSync(skillsDir, { recursive: true });
|
|
129208
129229
|
for (const skill of profile2.skills) {
|
|
129209
|
-
const skillFile =
|
|
129230
|
+
const skillFile = join29(skillsDir, `${skill}.md`);
|
|
129210
129231
|
writeIfMissing(fs6, skillFile, `# ${skill}
|
|
129211
129232
|
|
|
129212
129233
|
_Skill required by the ${displayName} profile. Implementation goes here._
|
|
@@ -129214,12 +129235,12 @@ _Skill required by the ${displayName} profile. Implementation goes here._
|
|
|
129214
129235
|
filesWritten.push(skillFile);
|
|
129215
129236
|
}
|
|
129216
129237
|
}
|
|
129217
|
-
const readmePath =
|
|
129238
|
+
const readmePath = join29(targetDir, "README.md");
|
|
129218
129239
|
const agentsList = Object.keys(profile2.agents);
|
|
129219
129240
|
const skillsList = profile2.skills;
|
|
129220
129241
|
writeIfMissing(fs6, readmePath, TPL_README(packageName, displayName, profile2.description, profile2.version, profile2.baseAgent, profile2.extends, agentsList, skillsList));
|
|
129221
129242
|
filesWritten.push(readmePath);
|
|
129222
|
-
const agentsMdPath =
|
|
129243
|
+
const agentsMdPath = join29(targetDir, "AGENTS.md");
|
|
129223
129244
|
writeIfMissing(fs6, agentsMdPath, TPL_AGENT_MD(displayName, profile2.description));
|
|
129224
129245
|
filesWritten.push(agentsMdPath);
|
|
129225
129246
|
return { packageName, packageDir: targetDir, filesWritten };
|
|
@@ -129227,7 +129248,7 @@ _Skill required by the ${displayName} profile. Implementation goes here._
|
|
|
129227
129248
|
function writeIfMissing(fs6, path7, content) {
|
|
129228
129249
|
if (fs6.existsSync(path7))
|
|
129229
129250
|
return;
|
|
129230
|
-
const dir =
|
|
129251
|
+
const dir = dirname11(path7);
|
|
129231
129252
|
if (!fs6.existsSync(dir)) {
|
|
129232
129253
|
fs6.mkdirSync(dir, { recursive: true });
|
|
129233
129254
|
}
|
|
@@ -130081,19 +130102,19 @@ var init_update_toasts = __esm(() => {
|
|
|
130081
130102
|
|
|
130082
130103
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
130083
130104
|
import { existsSync as existsSync45 } from "fs";
|
|
130084
|
-
import { dirname as
|
|
130105
|
+
import { dirname as dirname19, join as join41 } from "path";
|
|
130085
130106
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
130086
130107
|
function defaultGetModuleHostingWorkspace() {
|
|
130087
130108
|
try {
|
|
130088
|
-
const currentDir =
|
|
130109
|
+
const currentDir = dirname19(fileURLToPath4(import.meta.url));
|
|
130089
130110
|
const pkgJsonPath = findPackageJsonUp(currentDir);
|
|
130090
130111
|
if (!pkgJsonPath)
|
|
130091
130112
|
return null;
|
|
130092
|
-
const pkgDir =
|
|
130093
|
-
const nodeModulesDir =
|
|
130113
|
+
const pkgDir = dirname19(pkgJsonPath);
|
|
130114
|
+
const nodeModulesDir = dirname19(pkgDir);
|
|
130094
130115
|
if (nodeModulesDir.split(/[\\/]/).pop() !== "node_modules")
|
|
130095
130116
|
return null;
|
|
130096
|
-
return
|
|
130117
|
+
return dirname19(nodeModulesDir);
|
|
130097
130118
|
} catch (error51) {
|
|
130098
130119
|
if (error51 instanceof Error) {
|
|
130099
130120
|
return null;
|
|
@@ -130235,7 +130256,7 @@ var init_background_update_check = __esm(() => {
|
|
|
130235
130256
|
init_update_toasts();
|
|
130236
130257
|
defaultDeps4 = {
|
|
130237
130258
|
existsSync: existsSync45,
|
|
130238
|
-
join:
|
|
130259
|
+
join: join41,
|
|
130239
130260
|
runBunInstallWithDetails,
|
|
130240
130261
|
log: log2,
|
|
130241
130262
|
getOpenCodeCacheDir,
|
|
@@ -165066,18 +165087,18 @@ __export(exports_generate, {
|
|
|
165066
165087
|
ProfileNotFoundError: () => ProfileNotFoundError
|
|
165067
165088
|
});
|
|
165068
165089
|
import { existsSync as existsSync72, readFileSync as readFileSync59, realpathSync as realpathSync10 } from "fs";
|
|
165069
|
-
import { dirname as
|
|
165090
|
+
import { dirname as dirname30, isAbsolute as isAbsolute6, join as join78, resolve as resolve16 } from "path";
|
|
165070
165091
|
function profilesDirFor(opts) {
|
|
165071
165092
|
if (opts.profilesDir)
|
|
165072
165093
|
return opts.profilesDir;
|
|
165073
165094
|
if (opts.cwd)
|
|
165074
|
-
return
|
|
165075
|
-
return
|
|
165095
|
+
return join78(opts.cwd, PROFILES_RELATIVE);
|
|
165096
|
+
return join78(REPO_ROOT, PROFILES_RELATIVE);
|
|
165076
165097
|
}
|
|
165077
165098
|
function loadProfile(name2, options = {}) {
|
|
165078
165099
|
const fs22 = options.fs ?? defaultFS2;
|
|
165079
165100
|
const dir = profilesDirFor(options);
|
|
165080
|
-
const path27 =
|
|
165101
|
+
const path27 = join78(dir, `${name2}.json`);
|
|
165081
165102
|
if (!fs22.existsSync(path27)) {
|
|
165082
165103
|
throw new ProfileNotFoundError(name2);
|
|
165083
165104
|
}
|
|
@@ -165090,7 +165111,7 @@ function listProfiles(options = {}) {
|
|
|
165090
165111
|
const known = options.knownNames ?? ["trader", "plumber"];
|
|
165091
165112
|
const out = [];
|
|
165092
165113
|
for (const name2 of known) {
|
|
165093
|
-
const path27 =
|
|
165114
|
+
const path27 = join78(dir, `${name2}.json`);
|
|
165094
165115
|
if (fs22.existsSync(path27)) {
|
|
165095
165116
|
try {
|
|
165096
165117
|
const raw = JSON.parse(fs22.readFileSync(path27, "utf-8"));
|
|
@@ -165162,7 +165183,7 @@ var REPO_ROOT, defaultFS2, PROFILES_RELATIVE = "assets/profiles", ProfileNotFoun
|
|
|
165162
165183
|
var init_generate = __esm(() => {
|
|
165163
165184
|
init_src5();
|
|
165164
165185
|
init_src5();
|
|
165165
|
-
REPO_ROOT = resolve16(
|
|
165186
|
+
REPO_ROOT = resolve16(dirname30(new URL(import.meta.url).pathname), "..", "..", "..", "..", "..");
|
|
165166
165187
|
defaultFS2 = { existsSync: existsSync72, readFileSync: readFileSync59, realpathSync: realpathSync10 };
|
|
165167
165188
|
ProfileNotFoundError = class ProfileNotFoundError extends Error {
|
|
165168
165189
|
profileName;
|
|
@@ -165418,7 +165439,7 @@ __export(exports_profile_resolve, {
|
|
|
165418
165439
|
executeProfileResolveCommand: () => executeProfileResolveCommand
|
|
165419
165440
|
});
|
|
165420
165441
|
import { existsSync as existsSync74, readdirSync as readdirSync16, readFileSync as readFileSync60 } from "fs";
|
|
165421
|
-
import { join as
|
|
165442
|
+
import { join as join81, resolve as resolve17, dirname as dirname31 } from "path";
|
|
165422
165443
|
function executeProfileResolveCommand(args) {
|
|
165423
165444
|
if (args.options.help) {
|
|
165424
165445
|
return {
|
|
@@ -165443,7 +165464,7 @@ function executeProfileResolveCommand(args) {
|
|
|
165443
165464
|
` };
|
|
165444
165465
|
}
|
|
165445
165466
|
const name2 = nameRaw.endsWith(".json") ? nameRaw.slice(0, -5) : nameRaw;
|
|
165446
|
-
const profilesDir =
|
|
165467
|
+
const profilesDir = join81(REPO_ROOT2, PROFILES_RELATIVE2);
|
|
165447
165468
|
if (!existsSync74(profilesDir)) {
|
|
165448
165469
|
return { exitCode: 1, stdout: `error: profiles directory not found at ${profilesDir}
|
|
165449
165470
|
` };
|
|
@@ -165463,7 +165484,7 @@ function executeProfileResolveCommand(args) {
|
|
|
165463
165484
|
const registry2 = {};
|
|
165464
165485
|
for (const file3 of profileFiles) {
|
|
165465
165486
|
try {
|
|
165466
|
-
const filePath =
|
|
165487
|
+
const filePath = join81(profilesDir, file3);
|
|
165467
165488
|
const raw = JSON.parse(readFileSync60(filePath, "utf-8"));
|
|
165468
165489
|
const profile2 = ProfileSchema.parse(raw);
|
|
165469
165490
|
registry2[profile2.name] = profile2;
|
|
@@ -165516,7 +165537,7 @@ function executeProfileResolveCommand(args) {
|
|
|
165516
165537
|
var REPO_ROOT2, PROFILES_RELATIVE2 = "assets/profiles";
|
|
165517
165538
|
var init_profile_resolve = __esm(() => {
|
|
165518
165539
|
init_src5();
|
|
165519
|
-
REPO_ROOT2 = resolve17(
|
|
165540
|
+
REPO_ROOT2 = resolve17(dirname31(new URL(import.meta.url).pathname), "..", "..", "..", "..");
|
|
165520
165541
|
});
|
|
165521
165542
|
|
|
165522
165543
|
// packages/omo-opencode/src/cli/export.ts
|
|
@@ -165527,7 +165548,7 @@ __export(exports_export, {
|
|
|
165527
165548
|
executeExportCommand: () => executeExportCommand
|
|
165528
165549
|
});
|
|
165529
165550
|
import { existsSync as existsSync75, readFileSync as readFileSync61, writeFileSync as writeFileSync26, copyFileSync as copyFileSync8, realpathSync as realpathSync11, mkdirSync as mkdirSync27 } from "fs";
|
|
165530
|
-
import { isAbsolute as isAbsolute7, join as
|
|
165551
|
+
import { isAbsolute as isAbsolute7, join as join82, resolve as resolve18, dirname as dirname32 } from "path";
|
|
165531
165552
|
import { spawnSync as spawnSync4 } from "child_process";
|
|
165532
165553
|
function setShell(shell) {
|
|
165533
165554
|
activeShell = shell;
|
|
@@ -165568,7 +165589,7 @@ function executeExportCommand(args) {
|
|
|
165568
165589
|
return { exitCode: 1, stdout: `error: generate failed: ${message}
|
|
165569
165590
|
` };
|
|
165570
165591
|
}
|
|
165571
|
-
const pkgPath =
|
|
165592
|
+
const pkgPath = join82(absoluteTargetDir, "package.json");
|
|
165572
165593
|
let pkg;
|
|
165573
165594
|
try {
|
|
165574
165595
|
pkg = JSON.parse(fs24.readFileSync(pkgPath, "utf-8"));
|
|
@@ -165608,11 +165629,11 @@ ${packResult.stdout}
|
|
|
165608
165629
|
return { exitCode: 1, stdout: `error: npm pack produced no tarball name in output
|
|
165609
165630
|
` };
|
|
165610
165631
|
}
|
|
165611
|
-
let tgzPath =
|
|
165632
|
+
let tgzPath = join82(absoluteTargetDir, tgzName);
|
|
165612
165633
|
if (args.options.output) {
|
|
165613
165634
|
const outputPath = args.options.output;
|
|
165614
165635
|
const absoluteOutput = isAbsolute7(outputPath) ? outputPath : resolve18(process.cwd(), outputPath);
|
|
165615
|
-
const outputDir =
|
|
165636
|
+
const outputDir = dirname32(absoluteOutput);
|
|
165616
165637
|
if (!fs24.existsSync(outputDir)) {
|
|
165617
165638
|
fs24.mkdirSync(outputDir, { recursive: true });
|
|
165618
165639
|
}
|
|
@@ -165679,18 +165700,18 @@ __export(exports_project_context, {
|
|
|
165679
165700
|
archiveProject: () => archiveProject
|
|
165680
165701
|
});
|
|
165681
165702
|
import { existsSync as existsSync76, mkdirSync as mkdirSync28, readFileSync as readFileSync62, writeFileSync as writeFileSync27, rmSync as rmSync8 } from "fs";
|
|
165682
|
-
import { join as
|
|
165703
|
+
import { join as join83 } from "path";
|
|
165683
165704
|
function getMatrixOsDir(cwd = process.cwd()) {
|
|
165684
|
-
return
|
|
165705
|
+
return join83(cwd, ".matrixos");
|
|
165685
165706
|
}
|
|
165686
165707
|
function getProjectsDir(cwd) {
|
|
165687
|
-
return
|
|
165708
|
+
return join83(getMatrixOsDir(cwd), "projects");
|
|
165688
165709
|
}
|
|
165689
165710
|
function getProjectDir(slug, cwd) {
|
|
165690
|
-
return
|
|
165711
|
+
return join83(getProjectsDir(cwd), slug);
|
|
165691
165712
|
}
|
|
165692
165713
|
function getStatePath(cwd) {
|
|
165693
|
-
return
|
|
165714
|
+
return join83(getMatrixOsDir(cwd), "state.json");
|
|
165694
165715
|
}
|
|
165695
165716
|
function loadState(cwd) {
|
|
165696
165717
|
const path29 = getStatePath(cwd);
|
|
@@ -165709,7 +165730,7 @@ function saveState(state2, cwd) {
|
|
|
165709
165730
|
`);
|
|
165710
165731
|
}
|
|
165711
165732
|
function loadProjectMeta(slug, cwd) {
|
|
165712
|
-
const path29 =
|
|
165733
|
+
const path29 = join83(getProjectDir(slug, cwd), "meta.json");
|
|
165713
165734
|
if (!existsSync76(path29))
|
|
165714
165735
|
return null;
|
|
165715
165736
|
try {
|
|
@@ -165721,14 +165742,14 @@ function loadProjectMeta(slug, cwd) {
|
|
|
165721
165742
|
function saveProjectMeta(slug, meta3, cwd) {
|
|
165722
165743
|
const dir = getProjectDir(slug, cwd);
|
|
165723
165744
|
mkdirSync28(dir, { recursive: true });
|
|
165724
|
-
const path29 =
|
|
165745
|
+
const path29 = join83(dir, "meta.json");
|
|
165725
165746
|
writeFileSync27(path29, JSON.stringify(meta3, null, 2) + `
|
|
165726
165747
|
`);
|
|
165727
165748
|
}
|
|
165728
165749
|
function initProjectFiles(slug, cwd) {
|
|
165729
165750
|
const dir = getProjectDir(slug, cwd);
|
|
165730
|
-
mkdirSync28(
|
|
165731
|
-
const kanbanPath =
|
|
165751
|
+
mkdirSync28(join83(dir, "kb"), { recursive: true });
|
|
165752
|
+
const kanbanPath = join83(dir, "kanban.json");
|
|
165732
165753
|
if (!existsSync76(kanbanPath)) {
|
|
165733
165754
|
writeFileSync27(kanbanPath, JSON.stringify({ columns: ["todo", "in-progress", "review", "done"], tasks: [] }, null, 2) + `
|
|
165734
165755
|
`);
|
|
@@ -165840,7 +165861,7 @@ __export(exports_project_memory, {
|
|
|
165840
165861
|
addKbDocument: () => addKbDocument
|
|
165841
165862
|
});
|
|
165842
165863
|
import { existsSync as existsSync77, mkdirSync as mkdirSync29, readFileSync as readFileSync63, readdirSync as readdirSync17, writeFileSync as writeFileSync28 } from "fs";
|
|
165843
|
-
import { join as
|
|
165864
|
+
import { join as join84 } from "path";
|
|
165844
165865
|
function tagWithProject(metadata = {}, projectSlug, cwd) {
|
|
165845
165866
|
const active = projectSlug ?? getActiveProject(cwd)?.slug;
|
|
165846
165867
|
if (!active)
|
|
@@ -165854,14 +165875,14 @@ function isProjectEpisode(ep, projectSlug, cwd) {
|
|
|
165854
165875
|
return ep.metadata?.project === target;
|
|
165855
165876
|
}
|
|
165856
165877
|
function listKbDocuments(projectSlug, cwd) {
|
|
165857
|
-
const kbDir =
|
|
165878
|
+
const kbDir = join84(getProjectDir(projectSlug, cwd), "kb");
|
|
165858
165879
|
if (!existsSync77(kbDir))
|
|
165859
165880
|
return [];
|
|
165860
165881
|
const docs = [];
|
|
165861
165882
|
for (const entry of readdirSync17(kbDir, { withFileTypes: true })) {
|
|
165862
165883
|
if (!entry.isFile())
|
|
165863
165884
|
continue;
|
|
165864
|
-
const path29 =
|
|
165885
|
+
const path29 = join84(kbDir, entry.name);
|
|
165865
165886
|
try {
|
|
165866
165887
|
docs.push({ path: path29, content: readFileSync63(path29, "utf-8") });
|
|
165867
165888
|
} catch {}
|
|
@@ -165905,10 +165926,10 @@ async function searchProject(query, options = {}) {
|
|
|
165905
165926
|
return [...kbHits, ...memoryHits].sort((a2, b2) => b2.score - a2.score);
|
|
165906
165927
|
}
|
|
165907
165928
|
function addKbDocument(projectSlug, filename, content, cwd) {
|
|
165908
|
-
const kbDir =
|
|
165929
|
+
const kbDir = join84(getProjectDir(projectSlug, cwd), "kb");
|
|
165909
165930
|
mkdirSync29(kbDir, { recursive: true });
|
|
165910
165931
|
const safeName = filename.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
165911
|
-
const path29 =
|
|
165932
|
+
const path29 = join84(kbDir, safeName);
|
|
165912
165933
|
writeFileSync28(path29, content, "utf-8");
|
|
165913
165934
|
return path29;
|
|
165914
165935
|
}
|
|
@@ -166161,6 +166182,104 @@ var init_gateway_set_token = __esm(() => {
|
|
|
166161
166182
|
};
|
|
166162
166183
|
});
|
|
166163
166184
|
|
|
166185
|
+
// packages/omo-opencode/src/cli/skill-create.ts
|
|
166186
|
+
var exports_skill_create = {};
|
|
166187
|
+
__export(exports_skill_create, {
|
|
166188
|
+
executeSkillCreateCommand: () => executeSkillCreateCommand
|
|
166189
|
+
});
|
|
166190
|
+
import { mkdirSync as mkdirSync30, writeFileSync as writeFileSync29, existsSync as existsSync78 } from "fs";
|
|
166191
|
+
import { join as join85 } from "path";
|
|
166192
|
+
function slugify2(input) {
|
|
166193
|
+
return input.toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
166194
|
+
}
|
|
166195
|
+
function buildSkillMarkdown(name2, description, category2) {
|
|
166196
|
+
const slug = slugify2(name2);
|
|
166197
|
+
return `---
|
|
166198
|
+
name: ${slug}
|
|
166199
|
+
description: ${description}
|
|
166200
|
+
category: ${category2}
|
|
166201
|
+
---
|
|
166202
|
+
|
|
166203
|
+
# ${name2}
|
|
166204
|
+
|
|
166205
|
+
## Overview
|
|
166206
|
+
|
|
166207
|
+
Describe what this skill does and why it exists. One or two sentences.
|
|
166208
|
+
|
|
166209
|
+
## When to Use
|
|
166210
|
+
|
|
166211
|
+
- Trigger condition 1
|
|
166212
|
+
- Trigger condition 2
|
|
166213
|
+
|
|
166214
|
+
**When NOT to use:**
|
|
166215
|
+
|
|
166216
|
+
- Counter-example 1
|
|
166217
|
+
|
|
166218
|
+
## The Process
|
|
166219
|
+
|
|
166220
|
+
1. Step one
|
|
166221
|
+
2. Step two
|
|
166222
|
+
3. Step three
|
|
166223
|
+
|
|
166224
|
+
## Output
|
|
166225
|
+
|
|
166226
|
+
What the agent should produce when this skill completes.
|
|
166227
|
+
`;
|
|
166228
|
+
}
|
|
166229
|
+
function executeSkillCreateCommand(options) {
|
|
166230
|
+
const slug = slugify2(options.name);
|
|
166231
|
+
if (!slug) {
|
|
166232
|
+
return {
|
|
166233
|
+
ok: false,
|
|
166234
|
+
name: options.name,
|
|
166235
|
+
slug: "",
|
|
166236
|
+
path: "",
|
|
166237
|
+
content: "",
|
|
166238
|
+
applied: false,
|
|
166239
|
+
error: "invalid skill name (empty after slugify)"
|
|
166240
|
+
};
|
|
166241
|
+
}
|
|
166242
|
+
const description = options.description?.trim() || `${slug} \u2014 TODO: describe this skill`;
|
|
166243
|
+
const category2 = options.category?.trim() || "user-generated";
|
|
166244
|
+
let skillDir;
|
|
166245
|
+
if (options.targetDir) {
|
|
166246
|
+
skillDir = options.targetDir;
|
|
166247
|
+
} else if (options.scope === "project") {
|
|
166248
|
+
skillDir = join85(process.cwd(), ".opencode", "skills");
|
|
166249
|
+
} else {
|
|
166250
|
+
const dirs = getOpenCodeSkillDirs({ binary: "opencode" });
|
|
166251
|
+
skillDir = dirs[0] ?? join85(getHomeDirectory(), ".config", "opencode", "skills");
|
|
166252
|
+
}
|
|
166253
|
+
const skillPath = join85(skillDir, slug);
|
|
166254
|
+
const skillFile = join85(skillPath, "SKILL.md");
|
|
166255
|
+
const content = buildSkillMarkdown(options.name.trim(), description, category2);
|
|
166256
|
+
const result = {
|
|
166257
|
+
ok: true,
|
|
166258
|
+
name: options.name.trim(),
|
|
166259
|
+
slug,
|
|
166260
|
+
path: skillFile,
|
|
166261
|
+
content,
|
|
166262
|
+
applied: false
|
|
166263
|
+
};
|
|
166264
|
+
if (!options.apply) {
|
|
166265
|
+
return result;
|
|
166266
|
+
}
|
|
166267
|
+
try {
|
|
166268
|
+
if (!existsSync78(skillPath))
|
|
166269
|
+
mkdirSync30(skillPath, { recursive: true });
|
|
166270
|
+
writeFileSync29(skillFile, content, "utf-8");
|
|
166271
|
+
result.applied = true;
|
|
166272
|
+
} catch (e) {
|
|
166273
|
+
result.ok = false;
|
|
166274
|
+
result.error = e instanceof Error ? e.message : String(e);
|
|
166275
|
+
}
|
|
166276
|
+
return result;
|
|
166277
|
+
}
|
|
166278
|
+
var init_skill_create = __esm(() => {
|
|
166279
|
+
init_shared();
|
|
166280
|
+
init_src();
|
|
166281
|
+
});
|
|
166282
|
+
|
|
166164
166283
|
// packages/omo-opencode/src/gateway/gateway-handler.ts
|
|
166165
166284
|
import { spawn as spawn5 } from "child_process";
|
|
166166
166285
|
function maskSecrets(s) {
|
|
@@ -166296,7 +166415,7 @@ __export(exports_gateway_start, {
|
|
|
166296
166415
|
buildTelegramConfig: () => buildTelegramConfig,
|
|
166297
166416
|
buildGatewayConfig: () => buildGatewayConfig
|
|
166298
166417
|
});
|
|
166299
|
-
import { readFileSync as readFileSync64, existsSync as
|
|
166418
|
+
import { readFileSync as readFileSync64, existsSync as existsSync79 } from "fs";
|
|
166300
166419
|
import { resolve as resolve19 } from "path";
|
|
166301
166420
|
import { execSync as execSync2 } from "child_process";
|
|
166302
166421
|
function resolveMatrixosCommand(fallback = "matrixos") {
|
|
@@ -166308,7 +166427,7 @@ function resolveMatrixosCommand(fallback = "matrixos") {
|
|
|
166308
166427
|
return fallback;
|
|
166309
166428
|
}
|
|
166310
166429
|
function loadGatewayEnv(path29 = ENV_PATH) {
|
|
166311
|
-
if (!
|
|
166430
|
+
if (!existsSync79(path29))
|
|
166312
166431
|
return {};
|
|
166313
166432
|
const text = readFileSync64(path29, "utf8");
|
|
166314
166433
|
const out = {};
|
|
@@ -166458,7 +166577,7 @@ var init_deployment_core = __esm(() => {
|
|
|
166458
166577
|
|
|
166459
166578
|
// packages/omo-opencode/src/deployment/deploy-static.ts
|
|
166460
166579
|
import { spawn as spawn6 } from "child_process";
|
|
166461
|
-
import { existsSync as
|
|
166580
|
+
import { existsSync as existsSync80 } from "fs";
|
|
166462
166581
|
import { resolve as resolve20 } from "path";
|
|
166463
166582
|
function pushStage(stage, message, ok = true) {
|
|
166464
166583
|
return { stage, message, ok };
|
|
@@ -166515,7 +166634,7 @@ var init_deploy_static = __esm(() => {
|
|
|
166515
166634
|
}
|
|
166516
166635
|
stages.push(pushStage("build", "build succeeded"));
|
|
166517
166636
|
}
|
|
166518
|
-
if (!
|
|
166637
|
+
if (!existsSync80(buildDir)) {
|
|
166519
166638
|
stages.push(pushStage("push", `build directory not found: ${buildDir}`, false));
|
|
166520
166639
|
return { target: "static", ok: false, stages, error: "build directory missing" };
|
|
166521
166640
|
}
|
|
@@ -166791,10 +166910,10 @@ var init_deployment = __esm(() => {
|
|
|
166791
166910
|
});
|
|
166792
166911
|
|
|
166793
166912
|
// packages/omo-opencode/src/audit/self-audit.ts
|
|
166794
|
-
import { existsSync as
|
|
166795
|
-
import { join as
|
|
166913
|
+
import { existsSync as existsSync81, mkdirSync as mkdirSync31, readdirSync as readdirSync18, readFileSync as readFileSync65, writeFileSync as writeFileSync30 } from "fs";
|
|
166914
|
+
import { join as join86 } from "path";
|
|
166796
166915
|
function getAuditDir(cwd = process.cwd()) {
|
|
166797
|
-
return
|
|
166916
|
+
return join86(cwd, ".matrixos", "audits");
|
|
166798
166917
|
}
|
|
166799
166918
|
function getWeekString(date5 = new Date) {
|
|
166800
166919
|
const d = new Date(Date.UTC(date5.getFullYear(), date5.getMonth(), date5.getDate()));
|
|
@@ -166901,9 +167020,9 @@ function formatAuditReport(report) {
|
|
|
166901
167020
|
}
|
|
166902
167021
|
function writeAuditReport(report, cwd) {
|
|
166903
167022
|
const dir = getAuditDir(cwd);
|
|
166904
|
-
|
|
166905
|
-
const path29 =
|
|
166906
|
-
|
|
167023
|
+
mkdirSync31(dir, { recursive: true });
|
|
167024
|
+
const path29 = join86(dir, `${report.week}.md`);
|
|
167025
|
+
writeFileSync30(path29, formatAuditReport(report), "utf-8");
|
|
166907
167026
|
return path29;
|
|
166908
167027
|
}
|
|
166909
167028
|
var init_self_audit = () => {};
|
|
@@ -169220,7 +169339,7 @@ var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
|
169220
169339
|
// packages/omo-opencode/src/cli/run/opencode-binary-resolver.ts
|
|
169221
169340
|
init_bun_which_shim();
|
|
169222
169341
|
init_spawn_with_windows_hide();
|
|
169223
|
-
import { delimiter as delimiter2, dirname as
|
|
169342
|
+
import { delimiter as delimiter2, dirname as dirname13, posix as posix3, win32 as win324 } from "path";
|
|
169224
169343
|
var OPENCODE_COMMANDS = ["opencode", "opencode-desktop"];
|
|
169225
169344
|
var WINDOWS_SUFFIXES = ["", ".exe", ".cmd", ".bat", ".ps1"];
|
|
169226
169345
|
function getCommandCandidates(platform) {
|
|
@@ -169278,7 +169397,7 @@ async function findWorkingOpencodeBinary(pathEnv = process.env.PATH, probe2 = ca
|
|
|
169278
169397
|
return null;
|
|
169279
169398
|
}
|
|
169280
169399
|
function buildPathWithBinaryFirst(pathEnv, binaryPath) {
|
|
169281
|
-
const preferredDir =
|
|
169400
|
+
const preferredDir = dirname13(binaryPath);
|
|
169282
169401
|
const existing = (pathEnv ?? "").split(delimiter2).filter((entry) => entry.length > 0 && entry !== preferredDir);
|
|
169283
169402
|
return [preferredDir, ...existing].join(delimiter2);
|
|
169284
169403
|
}
|
|
@@ -169724,9 +169843,9 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
169724
169843
|
}
|
|
169725
169844
|
// packages/boulder-state/src/storage/path.ts
|
|
169726
169845
|
import { existsSync as existsSync33 } from "fs";
|
|
169727
|
-
import { isAbsolute as isAbsolute4, join as
|
|
169846
|
+
import { isAbsolute as isAbsolute4, join as join31, relative as relative3, resolve as resolve8 } from "path";
|
|
169728
169847
|
function getBoulderFilePath(directory) {
|
|
169729
|
-
return
|
|
169848
|
+
return join31(directory, BOULDER_DIR, BOULDER_FILE);
|
|
169730
169849
|
}
|
|
169731
169850
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
169732
169851
|
return isAbsolute4(trackedPath) ? resolve8(trackedPath) : resolve8(baseDirectory, trackedPath);
|
|
@@ -169953,9 +170072,9 @@ init_state();
|
|
|
169953
170072
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
169954
170073
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
169955
170074
|
import { existsSync as existsSync36, mkdirSync as mkdirSync12, readFileSync as readFileSync23, rmSync as rmSync2, writeFileSync as writeFileSync9 } from "fs";
|
|
169956
|
-
import { join as
|
|
170075
|
+
import { join as join32 } from "path";
|
|
169957
170076
|
function getMarkerPath(directory, sessionID) {
|
|
169958
|
-
return
|
|
170077
|
+
return join32(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
169959
170078
|
}
|
|
169960
170079
|
function readContinuationMarker(directory, sessionID) {
|
|
169961
170080
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
@@ -170028,7 +170147,7 @@ async function isSessionInBoulderLineage(input) {
|
|
|
170028
170147
|
init_shared();
|
|
170029
170148
|
init_compaction_marker();
|
|
170030
170149
|
import { readFileSync as readFileSync24, readdirSync as readdirSync6 } from "fs";
|
|
170031
|
-
import { join as
|
|
170150
|
+
import { join as join33 } from "path";
|
|
170032
170151
|
var defaultSessionLastAgentDeps = {
|
|
170033
170152
|
getMessageDir,
|
|
170034
170153
|
isSqliteBackend,
|
|
@@ -170088,7 +170207,7 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
|
|
|
170088
170207
|
try {
|
|
170089
170208
|
const messages = readdirSync6(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
170090
170209
|
try {
|
|
170091
|
-
const content = readFileSync24(
|
|
170210
|
+
const content = readFileSync24(join33(messageDir, fileName), "utf-8");
|
|
170092
170211
|
const parsed = JSON.parse(content);
|
|
170093
170212
|
return {
|
|
170094
170213
|
fileName,
|
|
@@ -170132,7 +170251,7 @@ init_agent_display_names();
|
|
|
170132
170251
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
170133
170252
|
init_frontmatter2();
|
|
170134
170253
|
import { existsSync as existsSync37, readFileSync as readFileSync25, writeFileSync as writeFileSync10, unlinkSync as unlinkSync6, mkdirSync as mkdirSync13 } from "fs";
|
|
170135
|
-
import { dirname as
|
|
170254
|
+
import { dirname as dirname14, join as join34 } from "path";
|
|
170136
170255
|
|
|
170137
170256
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
170138
170257
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -170141,7 +170260,7 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
170141
170260
|
|
|
170142
170261
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
170143
170262
|
function getStateFilePath(directory, customPath) {
|
|
170144
|
-
return customPath ?
|
|
170263
|
+
return customPath ? join34(directory, customPath) : join34(directory, DEFAULT_STATE_FILE);
|
|
170145
170264
|
}
|
|
170146
170265
|
function readState(directory, customPath) {
|
|
170147
170266
|
const filePath = getStateFilePath(directory, customPath);
|
|
@@ -170725,21 +170844,21 @@ function createTimestampedStdoutController(stdout2 = process.stdout) {
|
|
|
170725
170844
|
init_atomic_write();
|
|
170726
170845
|
init_xdg_data_dir();
|
|
170727
170846
|
import { existsSync as existsSync38, mkdirSync as mkdirSync14, readFileSync as readFileSync26 } from "fs";
|
|
170728
|
-
import { basename as
|
|
170847
|
+
import { basename as basename7, join as join35 } from "path";
|
|
170729
170848
|
var POSTHOG_ACTIVITY_STATE_FILE = "posthog-activity.json";
|
|
170730
170849
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
170731
170850
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
170732
170851
|
env: options.env,
|
|
170733
170852
|
osProvider: options.osProvider
|
|
170734
170853
|
});
|
|
170735
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
170736
|
-
if (dataDir === xdgStateDir || xdgStateDir === undefined &&
|
|
170854
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join35(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
170855
|
+
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename7(dataDir) === product.cacheDirName) {
|
|
170737
170856
|
return dataDir;
|
|
170738
170857
|
}
|
|
170739
|
-
return
|
|
170858
|
+
return join35(dataDir, product.cacheDirName);
|
|
170740
170859
|
}
|
|
170741
170860
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
170742
|
-
return
|
|
170861
|
+
return join35(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
170743
170862
|
}
|
|
170744
170863
|
function getDailyActiveCaptureState(input) {
|
|
170745
170864
|
const state2 = readPostHogActivityState(input.stateDir, input.diagnostics);
|
|
@@ -170852,7 +170971,7 @@ function getTelemetryDistinctId(machineIdPrefix, osProvider = getDefaultTelemetr
|
|
|
170852
170971
|
}
|
|
170853
170972
|
|
|
170854
170973
|
// node_modules/.bun/posthog-node@5.45.2/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
170855
|
-
import { dirname as
|
|
170974
|
+
import { dirname as dirname15, posix as posix4, sep } from "path";
|
|
170856
170975
|
function createModulerModifier() {
|
|
170857
170976
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
170858
170977
|
return async (frames) => {
|
|
@@ -170861,7 +170980,7 @@ function createModulerModifier() {
|
|
|
170861
170980
|
return frames;
|
|
170862
170981
|
};
|
|
170863
170982
|
}
|
|
170864
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
170983
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname15(process.argv[1]) : process.cwd(), isWindows = sep === "\\") {
|
|
170865
170984
|
const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
|
|
170866
170985
|
return (filename) => {
|
|
170867
170986
|
if (!filename)
|
|
@@ -177899,7 +178018,7 @@ init_extract_semver();
|
|
|
177899
178018
|
init_bun_which_shim();
|
|
177900
178019
|
import { existsSync as existsSync46, accessSync as accessSync4, constants as constants8 } from "fs";
|
|
177901
178020
|
import { homedir as homedir12 } from "os";
|
|
177902
|
-
import { join as
|
|
178021
|
+
import { join as join42 } from "path";
|
|
177903
178022
|
|
|
177904
178023
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
177905
178024
|
init_spawn_with_windows_hide();
|
|
@@ -177992,17 +178111,17 @@ function getDesktopAppPaths(platform) {
|
|
|
177992
178111
|
case "darwin":
|
|
177993
178112
|
return [
|
|
177994
178113
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
177995
|
-
|
|
178114
|
+
join42(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
177996
178115
|
];
|
|
177997
178116
|
case "win32": {
|
|
177998
178117
|
const programFiles = process.env.ProgramFiles;
|
|
177999
178118
|
const localAppData = process.env.LOCALAPPDATA;
|
|
178000
178119
|
const paths2 = [];
|
|
178001
178120
|
if (programFiles) {
|
|
178002
|
-
paths2.push(
|
|
178121
|
+
paths2.push(join42(programFiles, "OpenCode", "OpenCode.exe"));
|
|
178003
178122
|
}
|
|
178004
178123
|
if (localAppData) {
|
|
178005
|
-
paths2.push(
|
|
178124
|
+
paths2.push(join42(localAppData, "OpenCode", "OpenCode.exe"));
|
|
178006
178125
|
}
|
|
178007
178126
|
return paths2;
|
|
178008
178127
|
}
|
|
@@ -178010,8 +178129,8 @@ function getDesktopAppPaths(platform) {
|
|
|
178010
178129
|
return [
|
|
178011
178130
|
"/usr/bin/opencode",
|
|
178012
178131
|
"/usr/lib/opencode/opencode",
|
|
178013
|
-
|
|
178014
|
-
|
|
178132
|
+
join42(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
178133
|
+
join42(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
178015
178134
|
];
|
|
178016
178135
|
default:
|
|
178017
178136
|
return [];
|
|
@@ -178043,7 +178162,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
178043
178162
|
const candidates = getCommandCandidates2(platform);
|
|
178044
178163
|
for (const entry of pathEnv.split(delimiter3).filter(Boolean)) {
|
|
178045
178164
|
for (const command of candidates) {
|
|
178046
|
-
const fullPath =
|
|
178165
|
+
const fullPath = join42(entry, command);
|
|
178047
178166
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
178048
178167
|
return { binary: command, path: fullPath };
|
|
178049
178168
|
}
|
|
@@ -178187,21 +178306,21 @@ init_shared();
|
|
|
178187
178306
|
import { existsSync as existsSync48, readFileSync as readFileSync35, readdirSync as readdirSync8 } from "fs";
|
|
178188
178307
|
import { createRequire as createRequire2 } from "module";
|
|
178189
178308
|
import { homedir as homedir13 } from "os";
|
|
178190
|
-
import { join as
|
|
178309
|
+
import { join as join43 } from "path";
|
|
178191
178310
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
178192
178311
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
178193
178312
|
if (platform === "darwin")
|
|
178194
|
-
return
|
|
178313
|
+
return join43(homedir13(), "Library", "Caches");
|
|
178195
178314
|
if (platform === "win32")
|
|
178196
|
-
return process.env.LOCALAPPDATA ??
|
|
178197
|
-
return
|
|
178315
|
+
return process.env.LOCALAPPDATA ?? join43(homedir13(), "AppData", "Local");
|
|
178316
|
+
return join43(homedir13(), ".cache");
|
|
178198
178317
|
}
|
|
178199
178318
|
function resolveOpenCodeCacheDir() {
|
|
178200
178319
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
178201
178320
|
if (xdgCacheHome)
|
|
178202
|
-
return
|
|
178321
|
+
return join43(xdgCacheHome, "opencode");
|
|
178203
178322
|
const fromShared = getOpenCodeCacheDir();
|
|
178204
|
-
const platformDefault =
|
|
178323
|
+
const platformDefault = join43(getPlatformDefaultCacheDir(), "opencode");
|
|
178205
178324
|
if (existsSync48(fromShared) || !existsSync48(platformDefault))
|
|
178206
178325
|
return fromShared;
|
|
178207
178326
|
return platformDefault;
|
|
@@ -178233,11 +178352,11 @@ function normalizeVersion(value) {
|
|
|
178233
178352
|
function createPackageCandidates(rootDir) {
|
|
178234
178353
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
178235
178354
|
packageName,
|
|
178236
|
-
installedPackagePath:
|
|
178355
|
+
installedPackagePath: join43(rootDir, "node_modules", packageName, "package.json")
|
|
178237
178356
|
}));
|
|
178238
178357
|
}
|
|
178239
178358
|
function createTaggedInstallCandidates(rootDir) {
|
|
178240
|
-
const packagesDir =
|
|
178359
|
+
const packagesDir = join43(rootDir, "packages");
|
|
178241
178360
|
if (!existsSync48(packagesDir))
|
|
178242
178361
|
return [];
|
|
178243
178362
|
const candidates = [];
|
|
@@ -178245,14 +178364,14 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
178245
178364
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name2) => entryName.startsWith(`${name2}@`));
|
|
178246
178365
|
if (packageName === undefined)
|
|
178247
178366
|
continue;
|
|
178248
|
-
const installDir =
|
|
178367
|
+
const installDir = join43(packagesDir, entryName);
|
|
178249
178368
|
candidates.push({
|
|
178250
178369
|
cacheDir: installDir,
|
|
178251
|
-
cachePackagePath:
|
|
178370
|
+
cachePackagePath: join43(installDir, "package.json"),
|
|
178252
178371
|
packageCandidates: [
|
|
178253
178372
|
{
|
|
178254
178373
|
packageName,
|
|
178255
|
-
installedPackagePath:
|
|
178374
|
+
installedPackagePath: join43(installDir, "node_modules", packageName, "package.json")
|
|
178256
178375
|
}
|
|
178257
178376
|
]
|
|
178258
178377
|
});
|
|
@@ -178297,13 +178416,13 @@ function getLoadedPluginVersion() {
|
|
|
178297
178416
|
const candidates = [
|
|
178298
178417
|
{
|
|
178299
178418
|
cacheDir: configDir,
|
|
178300
|
-
cachePackagePath:
|
|
178419
|
+
cachePackagePath: join43(configDir, "package.json"),
|
|
178301
178420
|
packageCandidates: createPackageCandidates(configDir)
|
|
178302
178421
|
},
|
|
178303
178422
|
...createTaggedInstallCandidates(configDir),
|
|
178304
178423
|
{
|
|
178305
178424
|
cacheDir,
|
|
178306
|
-
cachePackagePath:
|
|
178425
|
+
cachePackagePath: join43(cacheDir, "package.json"),
|
|
178307
178426
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
178308
178427
|
},
|
|
178309
178428
|
...createTaggedInstallCandidates(cacheDir)
|
|
@@ -178496,7 +178615,7 @@ async function checkSystem(deps = defaultDeps6) {
|
|
|
178496
178615
|
init_src();
|
|
178497
178616
|
import { readFileSync as readFileSync37 } from "fs";
|
|
178498
178617
|
import { homedir as homedir14 } from "os";
|
|
178499
|
-
import { dirname as
|
|
178618
|
+
import { dirname as dirname20, relative as relative5 } from "path";
|
|
178500
178619
|
init_shared();
|
|
178501
178620
|
init_plugin_identity();
|
|
178502
178621
|
function resolveHomeDirectory2() {
|
|
@@ -178520,7 +178639,7 @@ function discoverProjectLayersNearestFirst(directory) {
|
|
|
178520
178639
|
const stopDirectory = containsPath(homeDirectory, directory) ? homeDirectory : directory;
|
|
178521
178640
|
return findProjectOpencodePluginConfigFiles(directory, stopDirectory).map((configPath) => ({
|
|
178522
178641
|
path: configPath,
|
|
178523
|
-
configDir:
|
|
178642
|
+
configDir: dirname20(configPath)
|
|
178524
178643
|
}));
|
|
178525
178644
|
}
|
|
178526
178645
|
function shortPath(configPath) {
|
|
@@ -178544,7 +178663,7 @@ function parseLayerConfig(configPath) {
|
|
|
178544
178663
|
if (!isPlainRecord(rawConfig)) {
|
|
178545
178664
|
return {
|
|
178546
178665
|
path: configPath,
|
|
178547
|
-
configDir:
|
|
178666
|
+
configDir: dirname20(configPath),
|
|
178548
178667
|
config: null,
|
|
178549
178668
|
messages: [`${shortPath(configPath)}: <root>: Expected object`]
|
|
178550
178669
|
};
|
|
@@ -178552,7 +178671,7 @@ function parseLayerConfig(configPath) {
|
|
|
178552
178671
|
const result = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
|
|
178553
178672
|
return {
|
|
178554
178673
|
path: configPath,
|
|
178555
|
-
configDir:
|
|
178674
|
+
configDir: dirname20(configPath),
|
|
178556
178675
|
config: result.success ? result.data : parseConfigPartially(rawConfig),
|
|
178557
178676
|
messages: schemaMessages(configPath, rawConfig)
|
|
178558
178677
|
};
|
|
@@ -178562,7 +178681,7 @@ function parseLayerConfig(configPath) {
|
|
|
178562
178681
|
}
|
|
178563
178682
|
return {
|
|
178564
178683
|
path: configPath,
|
|
178565
|
-
configDir:
|
|
178684
|
+
configDir: dirname20(configPath),
|
|
178566
178685
|
config: null,
|
|
178567
178686
|
messages: [`${shortPath(configPath)}: ${error51.message}`]
|
|
178568
178687
|
};
|
|
@@ -178613,18 +178732,18 @@ init_constants5();
|
|
|
178613
178732
|
init_shared();
|
|
178614
178733
|
import { existsSync as existsSync50, readFileSync as readFileSync38 } from "fs";
|
|
178615
178734
|
import { homedir as homedir15 } from "os";
|
|
178616
|
-
import { join as
|
|
178735
|
+
import { join as join44 } from "path";
|
|
178617
178736
|
function getUserConfigDir2() {
|
|
178618
178737
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
178619
178738
|
if (xdgConfig)
|
|
178620
|
-
return
|
|
178621
|
-
return
|
|
178739
|
+
return join44(xdgConfig, "opencode");
|
|
178740
|
+
return join44(homedir15(), ".config", "opencode");
|
|
178622
178741
|
}
|
|
178623
178742
|
function loadCustomProviderNames() {
|
|
178624
178743
|
const configDir = getUserConfigDir2();
|
|
178625
178744
|
const candidatePaths = [
|
|
178626
|
-
|
|
178627
|
-
|
|
178745
|
+
join44(configDir, "opencode.json"),
|
|
178746
|
+
join44(configDir, "opencode.jsonc")
|
|
178628
178747
|
];
|
|
178629
178748
|
for (const configPath of candidatePaths) {
|
|
178630
178749
|
if (!existsSync50(configPath))
|
|
@@ -178645,7 +178764,7 @@ function loadCustomProviderNames() {
|
|
|
178645
178764
|
return [];
|
|
178646
178765
|
}
|
|
178647
178766
|
function loadAvailableModelsFromCache() {
|
|
178648
|
-
const cacheFile =
|
|
178767
|
+
const cacheFile = join44(getOpenCodeCacheDir(), "models.json");
|
|
178649
178768
|
const customProviders = loadCustomProviderNames();
|
|
178650
178769
|
if (!existsSync50(cacheFile)) {
|
|
178651
178770
|
if (customProviders.length > 0) {
|
|
@@ -178683,8 +178802,8 @@ init_constants5();
|
|
|
178683
178802
|
init_shared();
|
|
178684
178803
|
init_plugin_identity();
|
|
178685
178804
|
import { readFileSync as readFileSync39 } from "fs";
|
|
178686
|
-
import { join as
|
|
178687
|
-
var PROJECT_CONFIG_DIR =
|
|
178805
|
+
import { join as join45 } from "path";
|
|
178806
|
+
var PROJECT_CONFIG_DIR = join45(process.cwd(), ".opencode");
|
|
178688
178807
|
function loadOmoConfig() {
|
|
178689
178808
|
const projectDetected = detectPluginConfigFile(PROJECT_CONFIG_DIR, {
|
|
178690
178809
|
basenames: [CONFIG_BASENAME],
|
|
@@ -178722,7 +178841,7 @@ function loadOmoConfig() {
|
|
|
178722
178841
|
|
|
178723
178842
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
178724
178843
|
init_shared();
|
|
178725
|
-
import { join as
|
|
178844
|
+
import { join as join46 } from "path";
|
|
178726
178845
|
|
|
178727
178846
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
178728
178847
|
function formatModelWithVariant(model, variant) {
|
|
@@ -178764,7 +178883,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
178764
178883
|
}
|
|
178765
178884
|
function buildModelResolutionDetails(options) {
|
|
178766
178885
|
const details = [];
|
|
178767
|
-
const cacheFile =
|
|
178886
|
+
const cacheFile = join46(getOpenCodeCacheDir(), "models.json");
|
|
178768
178887
|
details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
|
|
178769
178888
|
details.push("");
|
|
178770
178889
|
if (options.available.cacheExists) {
|
|
@@ -179043,25 +179162,25 @@ init_src();
|
|
|
179043
179162
|
import { existsSync as existsSync51 } from "fs";
|
|
179044
179163
|
import { createRequire as createRequire3 } from "module";
|
|
179045
179164
|
import { homedir as homedir17 } from "os";
|
|
179046
|
-
import { dirname as
|
|
179165
|
+
import { dirname as dirname21, join as join48 } from "path";
|
|
179047
179166
|
|
|
179048
179167
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
179049
|
-
import { join as
|
|
179168
|
+
import { join as join47 } from "path";
|
|
179050
179169
|
import { homedir as homedir16, tmpdir as tmpdir3 } from "os";
|
|
179051
179170
|
init_binary_downloader();
|
|
179052
179171
|
init_logger2();
|
|
179053
179172
|
init_plugin_identity();
|
|
179054
179173
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
179055
|
-
var DEBUG_FILE =
|
|
179174
|
+
var DEBUG_FILE = join47(tmpdir3(), "comment-checker-debug.log");
|
|
179056
179175
|
function getCacheDir2() {
|
|
179057
179176
|
if (process.platform === "win32") {
|
|
179058
179177
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
179059
|
-
const base2 = localAppData ||
|
|
179060
|
-
return
|
|
179178
|
+
const base2 = localAppData || join47(homedir16(), "AppData", "Local");
|
|
179179
|
+
return join47(base2, CACHE_DIR_NAME, "bin");
|
|
179061
179180
|
}
|
|
179062
179181
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
179063
|
-
const base = xdgCache ||
|
|
179064
|
-
return
|
|
179182
|
+
const base = xdgCache || join47(homedir16(), ".cache");
|
|
179183
|
+
return join47(base, CACHE_DIR_NAME, "bin");
|
|
179065
179184
|
}
|
|
179066
179185
|
function getBinaryName() {
|
|
179067
179186
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -179111,7 +179230,7 @@ async function getBinaryVersion(binary2) {
|
|
|
179111
179230
|
}
|
|
179112
179231
|
}
|
|
179113
179232
|
async function checkAstGrepCli() {
|
|
179114
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
179233
|
+
const runtimeDir = astGrepRuntimeDir(join48(homedir17(), ".omo"));
|
|
179115
179234
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
179116
179235
|
if (sgPath === null) {
|
|
179117
179236
|
return {
|
|
@@ -179140,11 +179259,11 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
179140
179259
|
const binaryName = process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
179141
179260
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
179142
179261
|
try {
|
|
179143
|
-
const packageDir = baseDirOverride ??
|
|
179144
|
-
const vendorPath =
|
|
179262
|
+
const packageDir = baseDirOverride ?? dirname21(resolvePackageJsonPath());
|
|
179263
|
+
const vendorPath = join48(packageDir, "vendor", platformKey, binaryName);
|
|
179145
179264
|
if (existsSync51(vendorPath))
|
|
179146
179265
|
return vendorPath;
|
|
179147
|
-
const binPath =
|
|
179266
|
+
const binPath = join48(packageDir, "bin", binaryName);
|
|
179148
179267
|
if (existsSync51(binPath))
|
|
179149
179268
|
return binPath;
|
|
179150
179269
|
} catch (error51) {
|
|
@@ -179290,13 +179409,13 @@ async function getGhCliInfo(dependencies = {}) {
|
|
|
179290
179409
|
|
|
179291
179410
|
// packages/omo-opencode/src/cli/doctor/checks/tools-lsp.ts
|
|
179292
179411
|
import { readFileSync as readFileSync41 } from "fs";
|
|
179293
|
-
import { join as
|
|
179412
|
+
import { join as join49 } from "path";
|
|
179294
179413
|
|
|
179295
179414
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
179296
179415
|
init_zod();
|
|
179297
179416
|
init_opencode_config_dir();
|
|
179298
179417
|
import { existsSync as existsSync52, readFileSync as readFileSync40 } from "fs";
|
|
179299
|
-
import { delimiter as delimiter3, dirname as
|
|
179418
|
+
import { delimiter as delimiter3, dirname as dirname22, resolve as resolve10 } from "path";
|
|
179300
179419
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
179301
179420
|
|
|
179302
179421
|
// packages/omo-opencode/src/mcp/cli-suffix.ts
|
|
@@ -179309,7 +179428,7 @@ function hasCliSuffix(candidatePath, suffix) {
|
|
|
179309
179428
|
|
|
179310
179429
|
// packages/omo-opencode/src/mcp/runtime-executable.ts
|
|
179311
179430
|
init_bun_which_shim();
|
|
179312
|
-
import { basename as
|
|
179431
|
+
import { basename as basename8 } from "path";
|
|
179313
179432
|
var NODE_EXECUTABLE_NAMES = new Set(["node", "node.exe"]);
|
|
179314
179433
|
function isUnsafeCommandName2(commandName) {
|
|
179315
179434
|
if (commandName.length === 0)
|
|
@@ -179325,7 +179444,7 @@ function isUnsafeCommandName2(commandName) {
|
|
|
179325
179444
|
return false;
|
|
179326
179445
|
}
|
|
179327
179446
|
function isNodeExecPath(execPath) {
|
|
179328
|
-
return NODE_EXECUTABLE_NAMES.has(
|
|
179447
|
+
return NODE_EXECUTABLE_NAMES.has(basename8(execPath).toLowerCase());
|
|
179329
179448
|
}
|
|
179330
179449
|
function resolveRuntimeExecutable(commandName, options = {}) {
|
|
179331
179450
|
if (isUnsafeCommandName2(commandName)) {
|
|
@@ -179427,7 +179546,7 @@ var LSP_BOOTSTRAP_SCRIPT = [
|
|
|
179427
179546
|
].join(";");
|
|
179428
179547
|
function getModuleDirectory(moduleUrl) {
|
|
179429
179548
|
try {
|
|
179430
|
-
return
|
|
179549
|
+
return dirname22(fileURLToPath6(moduleUrl));
|
|
179431
179550
|
} catch (error51) {
|
|
179432
179551
|
if (!(error51 instanceof Error))
|
|
179433
179552
|
throw error51;
|
|
@@ -179527,7 +179646,7 @@ function readOmoConfig(configDirectory) {
|
|
|
179527
179646
|
}
|
|
179528
179647
|
function isLspMcpDisabled(options) {
|
|
179529
179648
|
const userConfigDirectory = options.configDirectory ?? getOpenCodeConfigDir({ binary: "opencode" });
|
|
179530
|
-
const projectConfigDirectory =
|
|
179649
|
+
const projectConfigDirectory = join49(options.cwd ?? process.cwd(), ".opencode");
|
|
179531
179650
|
const userConfig = readOmoConfig(userConfigDirectory);
|
|
179532
179651
|
const projectConfig = readOmoConfig(projectConfigDirectory);
|
|
179533
179652
|
const disabledMcps = new Set([
|
|
@@ -179548,13 +179667,13 @@ function getInstalledLspServers(options = {}) {
|
|
|
179548
179667
|
init_shared();
|
|
179549
179668
|
import { existsSync as existsSync53, readFileSync as readFileSync42 } from "fs";
|
|
179550
179669
|
import { homedir as homedir18 } from "os";
|
|
179551
|
-
import { join as
|
|
179670
|
+
import { join as join50 } from "path";
|
|
179552
179671
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
179553
179672
|
function getMcpConfigPaths() {
|
|
179554
179673
|
return [
|
|
179555
|
-
|
|
179556
|
-
|
|
179557
|
-
|
|
179674
|
+
join50(homedir18(), ".claude", ".mcp.json"),
|
|
179675
|
+
join50(process.cwd(), ".mcp.json"),
|
|
179676
|
+
join50(process.cwd(), ".claude", ".mcp.json")
|
|
179558
179677
|
];
|
|
179559
179678
|
}
|
|
179560
179679
|
function loadUserMcpConfig() {
|
|
@@ -180268,12 +180387,12 @@ import {
|
|
|
180268
180387
|
unlinkSync as unlinkSync9,
|
|
180269
180388
|
writeFileSync as writeFileSync14
|
|
180270
180389
|
} from "fs";
|
|
180271
|
-
import { basename as
|
|
180390
|
+
import { basename as basename9, dirname as dirname23, join as join53 } from "path";
|
|
180272
180391
|
|
|
180273
180392
|
// packages/mcp-client-core/src/config-dir.ts
|
|
180274
180393
|
import { existsSync as existsSync55, realpathSync as realpathSync7 } from "fs";
|
|
180275
180394
|
import { homedir as homedir20 } from "os";
|
|
180276
|
-
import { join as
|
|
180395
|
+
import { join as join51, resolve as resolve11 } from "path";
|
|
180277
180396
|
function resolveConfigPath2(pathValue) {
|
|
180278
180397
|
const resolvedPath = resolve11(pathValue);
|
|
180279
180398
|
if (!existsSync55(resolvedPath))
|
|
@@ -180291,13 +180410,13 @@ function getOpenCodeCliConfigDir(env2 = process.env) {
|
|
|
180291
180410
|
if (customConfigDir) {
|
|
180292
180411
|
return resolveConfigPath2(customConfigDir);
|
|
180293
180412
|
}
|
|
180294
|
-
const xdgConfigDir = env2["XDG_CONFIG_HOME"]?.trim() ||
|
|
180295
|
-
return resolveConfigPath2(
|
|
180413
|
+
const xdgConfigDir = env2["XDG_CONFIG_HOME"]?.trim() || join51(homedir20(), ".config");
|
|
180414
|
+
return resolveConfigPath2(join51(xdgConfigDir, "opencode"));
|
|
180296
180415
|
}
|
|
180297
180416
|
|
|
180298
180417
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
180299
180418
|
import { chmodSync as chmodSync5, existsSync as existsSync56, readFileSync as readFileSync45, renameSync as renameSync6, writeFileSync as writeFileSync13 } from "fs";
|
|
180300
|
-
import { join as
|
|
180419
|
+
import { join as join52 } from "path";
|
|
180301
180420
|
var INDEX_FILE_NAME = "index.json";
|
|
180302
180421
|
function isTokenIndex(value) {
|
|
180303
180422
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -180305,7 +180424,7 @@ function isTokenIndex(value) {
|
|
|
180305
180424
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
180306
180425
|
}
|
|
180307
180426
|
function getIndexPath(storageDir) {
|
|
180308
|
-
return
|
|
180427
|
+
return join52(storageDir, INDEX_FILE_NAME);
|
|
180309
180428
|
}
|
|
180310
180429
|
function readTokenIndex(storageDir) {
|
|
180311
180430
|
const indexPath = getIndexPath(storageDir);
|
|
@@ -180349,16 +180468,16 @@ function deleteTokenIndexEntry(storageDir, hash2) {
|
|
|
180349
180468
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
180350
180469
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
180351
180470
|
function getMcpOauthStorageDir() {
|
|
180352
|
-
return
|
|
180471
|
+
return join53(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
180353
180472
|
}
|
|
180354
180473
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
180355
180474
|
return createHash3("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
180356
180475
|
}
|
|
180357
180476
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
180358
|
-
return
|
|
180477
|
+
return join53(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
180359
180478
|
}
|
|
180360
180479
|
function getLegacyStoragePath() {
|
|
180361
|
-
return
|
|
180480
|
+
return join53(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
180362
180481
|
}
|
|
180363
180482
|
function normalizeHost2(serverHost) {
|
|
180364
180483
|
let host = serverHost.trim();
|
|
@@ -180452,7 +180571,7 @@ function readLegacyStore() {
|
|
|
180452
180571
|
}
|
|
180453
180572
|
function writeTokenFile(filePath, token) {
|
|
180454
180573
|
try {
|
|
180455
|
-
const dir =
|
|
180574
|
+
const dir = dirname23(filePath);
|
|
180456
180575
|
if (!existsSync57(dir)) {
|
|
180457
180576
|
mkdirSync16(dir, { recursive: true });
|
|
180458
180577
|
}
|
|
@@ -180537,7 +180656,7 @@ function listTokensByHost(serverHost) {
|
|
|
180537
180656
|
for (const [hash2, indexedKey] of Object.entries(index)) {
|
|
180538
180657
|
if (!indexedKey.startsWith(prefix))
|
|
180539
180658
|
continue;
|
|
180540
|
-
const indexedToken = readTokenFile(
|
|
180659
|
+
const indexedToken = readTokenFile(join53(getMcpOauthStorageDir(), `${hash2}.json`));
|
|
180541
180660
|
if (indexedToken)
|
|
180542
180661
|
result[indexedKey] = indexedToken;
|
|
180543
180662
|
}
|
|
@@ -180552,8 +180671,8 @@ function listAllTokens() {
|
|
|
180552
180671
|
for (const entry of readdirSync9(dir, { withFileTypes: true })) {
|
|
180553
180672
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
180554
180673
|
continue;
|
|
180555
|
-
const token = readTokenFile(
|
|
180556
|
-
const hash2 =
|
|
180674
|
+
const token = readTokenFile(join53(dir, entry.name));
|
|
180675
|
+
const hash2 = basename9(entry.name, ".json");
|
|
180557
180676
|
if (token)
|
|
180558
180677
|
result[index[hash2] ?? hash2] = token;
|
|
180559
180678
|
}
|
|
@@ -181249,7 +181368,7 @@ function createEmbeddingPort() {
|
|
|
181249
181368
|
var import_picomatch = __toESM(require_picomatch2(), 1);
|
|
181250
181369
|
import { createHash as createHash5 } from "crypto";
|
|
181251
181370
|
import { readdirSync as readdirSync10, readFileSync as readFileSync48, statSync as statSync7, existsSync as existsSync59 } from "fs";
|
|
181252
|
-
import { join as
|
|
181371
|
+
import { join as join54, relative as relative6, extname as extname3 } from "path";
|
|
181253
181372
|
var EXT_TO_LANG = {
|
|
181254
181373
|
ts: "typescript",
|
|
181255
181374
|
tsx: "typescript",
|
|
@@ -181303,7 +181422,7 @@ function detectLanguage(filePath) {
|
|
|
181303
181422
|
return EXT_TO_LANG[ext] ?? "text";
|
|
181304
181423
|
}
|
|
181305
181424
|
function loadGitignore(rootDir, fs18) {
|
|
181306
|
-
const gitignorePath =
|
|
181425
|
+
const gitignorePath = join54(rootDir, ".gitignore");
|
|
181307
181426
|
if (!fs18.exists(gitignorePath))
|
|
181308
181427
|
return [];
|
|
181309
181428
|
const content = fs18.readFile(gitignorePath);
|
|
@@ -181394,7 +181513,7 @@ function createCodebaseScanner(options = {}) {
|
|
|
181394
181513
|
return;
|
|
181395
181514
|
}
|
|
181396
181515
|
for (const entry of entries) {
|
|
181397
|
-
const fullPath =
|
|
181516
|
+
const fullPath = join54(dir, entry);
|
|
181398
181517
|
let stat;
|
|
181399
181518
|
try {
|
|
181400
181519
|
stat = fs18.stat(fullPath);
|
|
@@ -181670,13 +181789,13 @@ function formatSearchResults(result) {
|
|
|
181670
181789
|
|
|
181671
181790
|
// packages/learning-loop/src/improvement.ts
|
|
181672
181791
|
import { existsSync as existsSync60, mkdirSync as mkdirSync18, readFileSync as readFileSync49, writeFileSync as writeFileSync16 } from "fs";
|
|
181673
|
-
import { join as
|
|
181792
|
+
import { join as join55, basename as basename11 } from "path";
|
|
181674
181793
|
function createImprovementStore(improvementsDir) {
|
|
181675
181794
|
if (!existsSync60(improvementsDir)) {
|
|
181676
181795
|
mkdirSync18(improvementsDir, { recursive: true });
|
|
181677
181796
|
}
|
|
181678
181797
|
function save(improvement) {
|
|
181679
|
-
const filePath =
|
|
181798
|
+
const filePath = join55(improvementsDir, `${improvement.id}.json`);
|
|
181680
181799
|
writeFileSync16(filePath, JSON.stringify(improvement, null, 2), "utf-8");
|
|
181681
181800
|
}
|
|
181682
181801
|
function list() {
|
|
@@ -181691,10 +181810,10 @@ function createImprovementStore(improvementsDir) {
|
|
|
181691
181810
|
return [];
|
|
181692
181811
|
}
|
|
181693
181812
|
files.sort().reverse();
|
|
181694
|
-
return files.map((f2) => get(
|
|
181813
|
+
return files.map((f2) => get(basename11(f2, ".json"))).filter((i3) => i3 !== null);
|
|
181695
181814
|
}
|
|
181696
181815
|
function get(id) {
|
|
181697
|
-
const filePath =
|
|
181816
|
+
const filePath = join55(improvementsDir, `${id}.json`);
|
|
181698
181817
|
try {
|
|
181699
181818
|
const raw = readFileSync49(filePath, "utf-8");
|
|
181700
181819
|
return JSON.parse(raw);
|
|
@@ -182502,25 +182621,25 @@ async function refreshModelCapabilities(options, deps = {}) {
|
|
|
182502
182621
|
// packages/skills-loader-core/src/features/opencode-skill-loader/loader.ts
|
|
182503
182622
|
init_src();
|
|
182504
182623
|
init_shared_skills();
|
|
182505
|
-
import { join as
|
|
182624
|
+
import { join as join64 } from "path";
|
|
182506
182625
|
|
|
182507
182626
|
// packages/skills-loader-core/src/shared/claude-config-dir.ts
|
|
182508
182627
|
init_src();
|
|
182509
|
-
import { join as
|
|
182628
|
+
import { join as join58 } from "path";
|
|
182510
182629
|
function getClaudeConfigDir() {
|
|
182511
182630
|
const envConfigDir = process.env.CLAUDE_CONFIG_DIR;
|
|
182512
182631
|
if (envConfigDir) {
|
|
182513
182632
|
return envConfigDir;
|
|
182514
182633
|
}
|
|
182515
|
-
return
|
|
182634
|
+
return join58(getHomeDirectory(), ".claude");
|
|
182516
182635
|
}
|
|
182517
182636
|
// packages/skills-loader-core/src/shared/opencode-command-dirs.ts
|
|
182518
|
-
import { basename as
|
|
182637
|
+
import { basename as basename12, dirname as dirname24, join as join60 } from "path";
|
|
182519
182638
|
|
|
182520
182639
|
// packages/skills-loader-core/src/shared/opencode-config-dir.ts
|
|
182521
182640
|
import { existsSync as existsSync64, realpathSync as realpathSync8 } from "fs";
|
|
182522
182641
|
import { homedir as homedir22 } from "os";
|
|
182523
|
-
import { join as
|
|
182642
|
+
import { join as join59, posix as posix5, resolve as resolve12, win32 as win325 } from "path";
|
|
182524
182643
|
|
|
182525
182644
|
// packages/skills-loader-core/src/shared/plugin-identity.ts
|
|
182526
182645
|
init_src();
|
|
@@ -182553,15 +182672,15 @@ function getTauriConfigDir2(identifier) {
|
|
|
182553
182672
|
const platform2 = process.platform;
|
|
182554
182673
|
switch (platform2) {
|
|
182555
182674
|
case "darwin":
|
|
182556
|
-
return
|
|
182675
|
+
return join59(homedir22(), "Library", "Application Support", identifier);
|
|
182557
182676
|
case "win32": {
|
|
182558
|
-
const appData = process.env.APPDATA ||
|
|
182677
|
+
const appData = process.env.APPDATA || join59(homedir22(), "AppData", "Roaming");
|
|
182559
182678
|
return win325.join(appData, identifier);
|
|
182560
182679
|
}
|
|
182561
182680
|
case "linux":
|
|
182562
182681
|
default: {
|
|
182563
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME ||
|
|
182564
|
-
return
|
|
182682
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join59(homedir22(), ".config");
|
|
182683
|
+
return join59(xdgConfig, identifier);
|
|
182565
182684
|
}
|
|
182566
182685
|
}
|
|
182567
182686
|
}
|
|
@@ -182604,8 +182723,8 @@ function getWslLinuxHomeDir2(windowsConfigRoot) {
|
|
|
182604
182723
|
function getCliDefaultConfigDir2() {
|
|
182605
182724
|
const envXdgConfig = process.env.XDG_CONFIG_HOME?.trim();
|
|
182606
182725
|
const shouldIgnoreWindowsXdg = envXdgConfig !== undefined && envXdgConfig.length > 0 && isWslEnvironment2() && isWindowsUserConfigRoot2(envXdgConfig);
|
|
182607
|
-
const xdgConfig = shouldIgnoreWindowsXdg ? posix5.join(getWslLinuxHomeDir2(envXdgConfig) ?? "/home", ".config") : envXdgConfig ||
|
|
182608
|
-
const configDir = isWslEnvironment2() ? posix5.join(xdgConfig, "opencode") :
|
|
182726
|
+
const xdgConfig = shouldIgnoreWindowsXdg ? posix5.join(getWslLinuxHomeDir2(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join59(homedir22(), ".config");
|
|
182727
|
+
const configDir = isWslEnvironment2() ? posix5.join(xdgConfig, "opencode") : join59(xdgConfig, "opencode");
|
|
182609
182728
|
return resolveConfigPath3(configDir);
|
|
182610
182729
|
}
|
|
182611
182730
|
function getCliCustomConfigDir2() {
|
|
@@ -182638,8 +182757,8 @@ function getOpenCodeConfigDir2(options) {
|
|
|
182638
182757
|
const tauriDir = process.platform === "win32" ? win325.isAbsolute(tauriDirBase) ? win325.normalize(tauriDirBase) : win325.resolve(tauriDirBase) : resolveConfigPath3(tauriDirBase);
|
|
182639
182758
|
if (checkExisting) {
|
|
182640
182759
|
const legacyDir = getCliConfigDir2();
|
|
182641
|
-
const legacyConfig =
|
|
182642
|
-
const legacyConfigC =
|
|
182760
|
+
const legacyConfig = join59(legacyDir, "opencode.json");
|
|
182761
|
+
const legacyConfigC = join59(legacyDir, "opencode.jsonc");
|
|
182643
182762
|
if (existsSync64(legacyConfig) || existsSync64(legacyConfigC)) {
|
|
182644
182763
|
return legacyDir;
|
|
182645
182764
|
}
|
|
@@ -182648,22 +182767,22 @@ function getOpenCodeConfigDir2(options) {
|
|
|
182648
182767
|
}
|
|
182649
182768
|
|
|
182650
182769
|
// packages/skills-loader-core/src/shared/opencode-command-dirs.ts
|
|
182651
|
-
function
|
|
182652
|
-
const parentDir =
|
|
182653
|
-
if (
|
|
182770
|
+
function getParentOpencodeConfigDir2(configDir) {
|
|
182771
|
+
const parentDir = dirname24(configDir);
|
|
182772
|
+
if (basename12(parentDir) !== "profiles") {
|
|
182654
182773
|
return null;
|
|
182655
182774
|
}
|
|
182656
|
-
return
|
|
182775
|
+
return dirname24(parentDir);
|
|
182657
182776
|
}
|
|
182658
|
-
function
|
|
182777
|
+
function getOpenCodeSkillDirs2(options) {
|
|
182659
182778
|
const configDirs = getOpenCodeConfigDirs2(options);
|
|
182660
182779
|
return Array.from(new Set([
|
|
182661
182780
|
...configDirs.flatMap((configDir) => {
|
|
182662
|
-
const parentConfigDir =
|
|
182781
|
+
const parentConfigDir = getParentOpencodeConfigDir2(configDir);
|
|
182663
182782
|
return [
|
|
182664
|
-
|
|
182665
|
-
|
|
182666
|
-
...parentConfigDir ? [
|
|
182783
|
+
join60(configDir, "skills"),
|
|
182784
|
+
join60(configDir, "skill"),
|
|
182785
|
+
...parentConfigDir ? [join60(parentConfigDir, "skills"), join60(parentConfigDir, "skill")] : []
|
|
182667
182786
|
];
|
|
182668
182787
|
})
|
|
182669
182788
|
]));
|
|
@@ -182671,7 +182790,7 @@ function getOpenCodeSkillDirs(options) {
|
|
|
182671
182790
|
// packages/skills-loader-core/src/shared/project-discovery-dirs.ts
|
|
182672
182791
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
182673
182792
|
import { existsSync as existsSync65, realpathSync as realpathSync9 } from "fs";
|
|
182674
|
-
import { dirname as
|
|
182793
|
+
import { dirname as dirname25, join as join61, resolve as resolve13, win32 as win326 } from "path";
|
|
182675
182794
|
var worktreePathCache2 = new Map;
|
|
182676
182795
|
function normalizePath2(path18) {
|
|
182677
182796
|
const resolvedPath = process.platform !== "win32" && win326.isAbsolute(path18) ? path18 : resolve13(path18);
|
|
@@ -182706,7 +182825,7 @@ function findAncestorDirectories(startDirectory, targetPaths, stopDirectory) {
|
|
|
182706
182825
|
const stopDirectoryKey = resolvedStopDirectory ? pathKey2(resolvedStopDirectory) : undefined;
|
|
182707
182826
|
while (true) {
|
|
182708
182827
|
for (const targetPath of targetPaths) {
|
|
182709
|
-
const candidateDirectory =
|
|
182828
|
+
const candidateDirectory = join61(currentDirectory, ...targetPath);
|
|
182710
182829
|
if (!existsSync65(candidateDirectory)) {
|
|
182711
182830
|
continue;
|
|
182712
182831
|
}
|
|
@@ -182721,7 +182840,7 @@ function findAncestorDirectories(startDirectory, targetPaths, stopDirectory) {
|
|
|
182721
182840
|
if (stopDirectoryKey === pathKey2(currentDirectory)) {
|
|
182722
182841
|
return directories;
|
|
182723
182842
|
}
|
|
182724
|
-
const parentDirectory =
|
|
182843
|
+
const parentDirectory = dirname25(currentDirectory);
|
|
182725
182844
|
if (parentDirectory === currentDirectory) {
|
|
182726
182845
|
return directories;
|
|
182727
182846
|
}
|
|
@@ -182789,13 +182908,13 @@ function deduplicateSkillsByName(skills2) {
|
|
|
182789
182908
|
// packages/skills-loader-core/src/features/opencode-skill-loader/skill-directory-loader.ts
|
|
182790
182909
|
init_src();
|
|
182791
182910
|
import * as fs20 from "fs/promises";
|
|
182792
|
-
import { join as
|
|
182911
|
+
import { join as join63 } from "path";
|
|
182793
182912
|
|
|
182794
182913
|
// packages/skills-loader-core/src/features/opencode-skill-loader/loaded-skill-from-path.ts
|
|
182795
182914
|
init_src();
|
|
182796
182915
|
init_src2();
|
|
182797
182916
|
import * as fs19 from "fs/promises";
|
|
182798
|
-
import { basename as
|
|
182917
|
+
import { basename as basename13 } from "path";
|
|
182799
182918
|
|
|
182800
182919
|
// packages/skills-loader-core/src/features/opencode-skill-loader/allowed-tools-parser.ts
|
|
182801
182920
|
function parseAllowedTools(allowedTools) {
|
|
@@ -182810,7 +182929,7 @@ function parseAllowedTools(allowedTools) {
|
|
|
182810
182929
|
// packages/skills-loader-core/src/features/opencode-skill-loader/skill-mcp-config.ts
|
|
182811
182930
|
init_js_yaml();
|
|
182812
182931
|
import * as fs18 from "fs/promises";
|
|
182813
|
-
import { join as
|
|
182932
|
+
import { join as join62 } from "path";
|
|
182814
182933
|
function parseSkillMcpConfigFromFrontmatter(content) {
|
|
182815
182934
|
const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
182816
182935
|
if (!frontmatterMatch)
|
|
@@ -182829,7 +182948,7 @@ function parseSkillMcpConfigFromFrontmatter(content) {
|
|
|
182829
182948
|
return;
|
|
182830
182949
|
}
|
|
182831
182950
|
async function loadMcpJsonFromDir(skillDir) {
|
|
182832
|
-
const mcpJsonPath =
|
|
182951
|
+
const mcpJsonPath = join62(skillDir, "mcp.json");
|
|
182833
182952
|
try {
|
|
182834
182953
|
const content = await fs18.readFile(mcpJsonPath, "utf-8");
|
|
182835
182954
|
const parsed = JSON.parse(content);
|
|
@@ -182911,7 +183030,7 @@ $ARGUMENTS
|
|
|
182911
183030
|
}
|
|
182912
183031
|
}
|
|
182913
183032
|
function inferSkillNameFromFileName(filePath) {
|
|
182914
|
-
return
|
|
183033
|
+
return basename13(filePath, ".md");
|
|
182915
183034
|
}
|
|
182916
183035
|
|
|
182917
183036
|
// packages/skills-loader-core/src/features/opencode-skill-loader/skill-directory-loader.ts
|
|
@@ -182945,10 +183064,10 @@ async function loadSkillsFromDir(options) {
|
|
|
182945
183064
|
const directories = entries.filter((entry) => !entry.name.startsWith(".") && (entry.isDirectory() || entry.isSymbolicLink()));
|
|
182946
183065
|
const files = entries.filter((entry) => !entry.name.startsWith(".") && !entry.isDirectory() && !entry.isSymbolicLink() && isMarkdownFile(entry));
|
|
182947
183066
|
for (const entry of directories) {
|
|
182948
|
-
const entryPath =
|
|
183067
|
+
const entryPath = join63(options.skillsDir, entry.name);
|
|
182949
183068
|
const resolvedPath = await resolveSymlinkAsync(entryPath);
|
|
182950
183069
|
const dirName = entry.name;
|
|
182951
|
-
const skillMdPath =
|
|
183070
|
+
const skillMdPath = join63(resolvedPath, "SKILL.md");
|
|
182952
183071
|
if (await canAccessFile(skillMdPath)) {
|
|
182953
183072
|
const skill = await loadSkillFromPath({
|
|
182954
183073
|
skillPath: skillMdPath,
|
|
@@ -182962,7 +183081,7 @@ async function loadSkillsFromDir(options) {
|
|
|
182962
183081
|
}
|
|
182963
183082
|
continue;
|
|
182964
183083
|
}
|
|
182965
|
-
const namedSkillMdPath =
|
|
183084
|
+
const namedSkillMdPath = join63(resolvedPath, `${dirName}.md`);
|
|
182966
183085
|
if (await canAccessFile(namedSkillMdPath)) {
|
|
182967
183086
|
const skill = await loadSkillFromPath({
|
|
182968
183087
|
skillPath: namedSkillMdPath,
|
|
@@ -182993,7 +183112,7 @@ async function loadSkillsFromDir(options) {
|
|
|
182993
183112
|
}
|
|
182994
183113
|
}
|
|
182995
183114
|
for (const entry of files) {
|
|
182996
|
-
const entryPath =
|
|
183115
|
+
const entryPath = join63(options.skillsDir, entry.name);
|
|
182997
183116
|
const baseName = inferSkillNameFromFileName(entryPath);
|
|
182998
183117
|
const skill = await loadSkillFromPath({
|
|
182999
183118
|
skillPath: entryPath,
|
|
@@ -183045,7 +183164,7 @@ async function discoverAllSkills(directory) {
|
|
|
183045
183164
|
]);
|
|
183046
183165
|
}
|
|
183047
183166
|
async function discoverUserClaudeSkills() {
|
|
183048
|
-
const userSkillsDir =
|
|
183167
|
+
const userSkillsDir = join64(getClaudeConfigDir(), "skills");
|
|
183049
183168
|
return loadSkillsFromDir({ skillsDir: userSkillsDir, scope: "user" });
|
|
183050
183169
|
}
|
|
183051
183170
|
async function discoverProjectClaudeSkills(directory) {
|
|
@@ -183054,7 +183173,7 @@ async function discoverProjectClaudeSkills(directory) {
|
|
|
183054
183173
|
return deduplicateSkillsByName(allSkills.flat());
|
|
183055
183174
|
}
|
|
183056
183175
|
async function discoverOpencodeGlobalSkills() {
|
|
183057
|
-
const skillDirs =
|
|
183176
|
+
const skillDirs = getOpenCodeSkillDirs2({ binary: "opencode" });
|
|
183058
183177
|
const allSkills = await Promise.all(skillDirs.map((skillsDir) => loadSkillsFromDir({ skillsDir, scope: "opencode" })));
|
|
183059
183178
|
return deduplicateSkillsByName(allSkills.flat());
|
|
183060
183179
|
}
|
|
@@ -183072,7 +183191,7 @@ async function discoverProjectAgentsSkills(directory) {
|
|
|
183072
183191
|
return deduplicateSkillsByName(allSkills.flat());
|
|
183073
183192
|
}
|
|
183074
183193
|
async function discoverGlobalAgentsSkills(homeDirectory = getHomeDirectory()) {
|
|
183075
|
-
const agentsGlobalDir =
|
|
183194
|
+
const agentsGlobalDir = join64(homeDirectory, ".agents", "skills");
|
|
183076
183195
|
return loadSkillsFromDir({ skillsDir: agentsGlobalDir, scope: "user" });
|
|
183077
183196
|
}
|
|
183078
183197
|
// packages/skills-loader-core/src/features/opencode-skill-loader/merger/builtin-skill-converter.ts
|
|
@@ -183824,7 +183943,7 @@ playwright-cli close
|
|
|
183824
183943
|
init_shared_skills();
|
|
183825
183944
|
init_src();
|
|
183826
183945
|
import { readFileSync as readFileSync52 } from "fs";
|
|
183827
|
-
import { join as
|
|
183946
|
+
import { join as join65 } from "path";
|
|
183828
183947
|
function createSharedSkillTemplateLoader(readFile3 = readFileSync52, skillsRootPath = sharedSkillsRootPath()) {
|
|
183829
183948
|
const cache = new Map;
|
|
183830
183949
|
return (skillName) => {
|
|
@@ -183832,7 +183951,7 @@ function createSharedSkillTemplateLoader(readFile3 = readFileSync52, skillsRootP
|
|
|
183832
183951
|
if (cached2 !== undefined)
|
|
183833
183952
|
return cached2;
|
|
183834
183953
|
try {
|
|
183835
|
-
const { body } = parseFrontmatter(readFile3(
|
|
183954
|
+
const { body } = parseFrontmatter(readFile3(join65(skillsRootPath, skillName, "SKILL.md"), "utf8"));
|
|
183836
183955
|
cache.set(skillName, body);
|
|
183837
183956
|
return body;
|
|
183838
183957
|
} catch (error51) {
|
|
@@ -184969,9 +185088,9 @@ var gitMasterSkill = {
|
|
|
184969
185088
|
template: GIT_MASTER_TEMPLATE
|
|
184970
185089
|
};
|
|
184971
185090
|
// packages/skills-loader-core/src/features/builtin-skills/skills/dev-browser.ts
|
|
184972
|
-
import { dirname as
|
|
185091
|
+
import { dirname as dirname26, join as join66 } from "path";
|
|
184973
185092
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
184974
|
-
var CURRENT_DIR =
|
|
185093
|
+
var CURRENT_DIR = dirname26(fileURLToPath8(import.meta.url));
|
|
184975
185094
|
var devBrowserSkill = {
|
|
184976
185095
|
name: "dev-browser",
|
|
184977
185096
|
description: "Browser automation with persistent page state. Use when users ask to navigate websites, fill forms, take screenshots, extract web data, test web apps, or automate browser workflows. Trigger phrases include 'go to [url]', 'click on', 'fill out the form', 'take a screenshot', 'scrape', 'automate', 'test the website', 'log into', or any browser interaction request.",
|
|
@@ -185189,7 +185308,7 @@ console.log({
|
|
|
185189
185308
|
await client.disconnect();
|
|
185190
185309
|
EOF
|
|
185191
185310
|
\`\`\``,
|
|
185192
|
-
resolvedPath:
|
|
185311
|
+
resolvedPath: join66(CURRENT_DIR, "..", "dev-browser")
|
|
185193
185312
|
};
|
|
185194
185313
|
// packages/skills-loader-core/src/features/builtin-skills/skills/review-work.ts
|
|
185195
185314
|
var reviewWorkSkill = {
|
|
@@ -187518,12 +187637,18 @@ ${row.description ? `Description: ${row.description}
|
|
|
187518
187637
|
return { ok: false, error: "database unavailable" };
|
|
187519
187638
|
try {
|
|
187520
187639
|
let extractTasks = function(text) {
|
|
187521
|
-
const
|
|
187522
|
-
|
|
187640
|
+
for (const line of text.split(`
|
|
187641
|
+
`)) {
|
|
187642
|
+
const trimmed = line.trim();
|
|
187643
|
+
if (!trimmed.startsWith("{") || !trimmed.endsWith("}"))
|
|
187644
|
+
continue;
|
|
187645
|
+
if (!trimmed.includes('"summary"'))
|
|
187646
|
+
continue;
|
|
187523
187647
|
try {
|
|
187524
|
-
|
|
187525
|
-
|
|
187526
|
-
const
|
|
187648
|
+
const obj = JSON.parse(trimmed);
|
|
187649
|
+
const summary = obj.summary ?? "";
|
|
187650
|
+
const clean = summary.replace(/```(?:json)?\n?/g, "").replace(/```/g, "");
|
|
187651
|
+
const arrayMatch = clean.match(/\[[\s\S]*?\]/);
|
|
187527
187652
|
if (arrayMatch) {
|
|
187528
187653
|
const parsed = JSON.parse(arrayMatch[0]);
|
|
187529
187654
|
if (Array.isArray(parsed))
|
|
@@ -188171,11 +188296,11 @@ async function restartDashboard(options) {
|
|
|
188171
188296
|
}
|
|
188172
188297
|
|
|
188173
188298
|
// packages/omo-opencode/src/cli/architect.ts
|
|
188174
|
-
import { join as
|
|
188299
|
+
import { join as join76 } from "path";
|
|
188175
188300
|
var IMPROVEMENTS_DIR = ".matrixos/improvements";
|
|
188176
188301
|
function getStore(directory) {
|
|
188177
188302
|
const baseDir = directory ?? process.cwd();
|
|
188178
|
-
return createImprovementStore(
|
|
188303
|
+
return createImprovementStore(join76(baseDir, IMPROVEMENTS_DIR));
|
|
188179
188304
|
}
|
|
188180
188305
|
async function architectReview(options) {
|
|
188181
188306
|
const store4 = getStore(options.directory);
|
|
@@ -188769,6 +188894,39 @@ Examples:
|
|
|
188769
188894
|
process.stdout.write(result.stdout);
|
|
188770
188895
|
process.exit(result.exitCode);
|
|
188771
188896
|
});
|
|
188897
|
+
program2.command("skill-create <name>").description("Generate a SKILL.md scaffold for a new user skill (dry-run by default; --apply to write)").option("-d, --description <text>", "Skill description (triggers)").option("-c, --category <name>", "Skill category", "user-generated").option("-s, --scope <scope>", "Scope: user (default) or project", "user").option("--target-dir <path>", "Write directly to this directory instead of the resolved scope dir").option("--apply", "Write the file (default is dry-run, per D-006)").option("--json", "Output as JSON").addHelpText("after", `
|
|
188898
|
+
Examples:
|
|
188899
|
+
$ matrixos skill-create "pdf extractor" --description "Extract text from PDFs via pdftotext"
|
|
188900
|
+
$ matrixos skill-create my-skill --apply # write to ~/.config/opencode/skills/my-skill/SKILL.md
|
|
188901
|
+
$ matrixos skill-create my-skill --apply --scope project # write to ./.opencode/skills/my-skill/SKILL.md
|
|
188902
|
+
`).action(async (name2, options) => {
|
|
188903
|
+
const { executeSkillCreateCommand: executeSkillCreateCommand2 } = await Promise.resolve().then(() => (init_skill_create(), exports_skill_create));
|
|
188904
|
+
const result = executeSkillCreateCommand2({
|
|
188905
|
+
name: name2,
|
|
188906
|
+
description: options.description,
|
|
188907
|
+
category: options.category,
|
|
188908
|
+
scope: options.scope === "project" ? "project" : "user",
|
|
188909
|
+
targetDir: options.targetDir,
|
|
188910
|
+
apply: options.apply ?? false,
|
|
188911
|
+
json: options.json ?? false
|
|
188912
|
+
});
|
|
188913
|
+
if (options.json) {
|
|
188914
|
+
process.stdout.write(JSON.stringify(result, null, 2) + `
|
|
188915
|
+
`);
|
|
188916
|
+
} else if (!result.applied) {
|
|
188917
|
+
process.stdout.write(`[dry-run] would create: ${result.path}
|
|
188918
|
+
|
|
188919
|
+
${result.content}
|
|
188920
|
+
`);
|
|
188921
|
+
} else if (result.ok) {
|
|
188922
|
+
process.stdout.write(`created: ${result.path}
|
|
188923
|
+
`);
|
|
188924
|
+
} else {
|
|
188925
|
+
process.stdout.write(`error: ${result.error}
|
|
188926
|
+
`);
|
|
188927
|
+
process.exit(1);
|
|
188928
|
+
}
|
|
188929
|
+
});
|
|
188772
188930
|
gateway2.command("start [channel]").description("Start the MaTrixOS gateway (Telegram by default). Long-polling. Reads token from .klc-gateway.env.").option("--command <cmd>", "Subprocess to invoke on inbound message (default: matrixos)").option("--timeout <ms>", "Subprocess timeout in ms (default: 30000)").addHelpText("after", `
|
|
188773
188931
|
Examples:
|
|
188774
188932
|
$ matrixos gateway start # telegram
|