@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.
@@ -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.45",
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 dirname4, join as join18, resolve as resolve6, win32 as win322 } from "path";
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 = join18(currentDirectory, ".opencode");
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 = dirname4(currentDirectory);
65231
+ const parentDirectory = dirname5(currentDirectory);
65211
65232
  if (parentDirectory === currentDirectory) {
65212
65233
  return paths;
65213
65234
  }
@@ -65783,7 +65804,7 @@ var init_plugin_name_with_version = __esm(() => {
65783
65804
 
65784
65805
  // packages/omo-opencode/src/cli/config-manager/backup-config.ts
65785
65806
  import { copyFileSync as copyFileSync2, existsSync as existsSync16, mkdirSync as mkdirSync6 } from "fs";
65786
- import { dirname as dirname5 } from "path";
65807
+ import { dirname as dirname6 } from "path";
65787
65808
  function backupConfigFile(configPath) {
65788
65809
  if (!existsSync16(configPath)) {
65789
65810
  return { success: true };
@@ -65791,7 +65812,7 @@ function backupConfigFile(configPath) {
65791
65812
  const timestamp2 = new Date().toISOString().replace(/[:.]/g, "-");
65792
65813
  const backupPath = `${configPath}.backup-${timestamp2}`;
65793
65814
  try {
65794
- const dir = dirname5(backupPath);
65815
+ const dir = dirname6(backupPath);
65795
65816
  if (!existsSync16(dir)) {
65796
65817
  mkdirSync6(dir, { recursive: true });
65797
65818
  }
@@ -65989,10 +66010,10 @@ function extractVersionFromPluginEntry(entry) {
65989
66010
 
65990
66011
  // packages/omo-opencode/src/cli/config-manager/add-plugin-to-opencode-config.ts
65991
66012
  import { existsSync as existsSync19, readdirSync as readdirSync3, readFileSync as readFileSync9, writeFileSync as writeFileSync4 } from "fs";
65992
- import { basename as basename2, dirname as dirname6, join as join19 } from "path";
66013
+ import { basename as basename3, dirname as dirname7, join as join20 } from "path";
65993
66014
  function detectConfigFormatInDir(configDir) {
65994
- const configJsonc = join19(configDir, "opencode.jsonc");
65995
- const configJson = join19(configDir, "opencode.json");
66015
+ const configJsonc = join20(configDir, "opencode.jsonc");
66016
+ const configJson = join20(configDir, "opencode.json");
65996
66017
  if (existsSync19(configJsonc)) {
65997
66018
  return { format: "jsonc", path: configJsonc };
65998
66019
  }
@@ -66002,16 +66023,16 @@ function detectConfigFormatInDir(configDir) {
66002
66023
  return { format: "none", path: configJson };
66003
66024
  }
66004
66025
  function getParentConfigDirForProfile(configDir) {
66005
- const parentDir = dirname6(configDir);
66006
- if (basename2(parentDir) !== "profiles")
66026
+ const parentDir = dirname7(configDir);
66027
+ if (basename3(parentDir) !== "profiles")
66007
66028
  return null;
66008
- return dirname6(parentDir);
66029
+ return dirname7(parentDir);
66009
66030
  }
66010
66031
  function listProfileConfigDirs(rootConfigDir) {
66011
- const profilesDir = join19(rootConfigDir, "profiles");
66032
+ const profilesDir = join20(rootConfigDir, "profiles");
66012
66033
  if (!existsSync19(profilesDir))
66013
66034
  return [];
66014
- return readdirSync3(profilesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join19(profilesDir, entry.name)).filter((profileDir) => detectConfigFormatInDir(profileDir).format !== "none");
66035
+ return readdirSync3(profilesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join20(profilesDir, entry.name)).filter((profileDir) => detectConfigFormatInDir(profileDir).format !== "none");
66015
66036
  }
66016
66037
  function getConfigTargets() {
66017
66038
  const primaryConfigDir = getConfigDir();
@@ -66538,11 +66559,11 @@ var init_migrations_sidecar2 = __esm(() => {
66538
66559
 
66539
66560
  // packages/omo-opencode/src/shared/migrate-legacy-config-file.ts
66540
66561
  import { existsSync as existsSync20, readFileSync as readFileSync10, renameSync as renameSync4, rmSync } from "fs";
66541
- import { join as join20, dirname as dirname7, basename as basename3 } from "path";
66562
+ import { join as join21, dirname as dirname8, basename as basename4 } from "path";
66542
66563
  function buildCanonicalPath(legacyPath) {
66543
- const dir = dirname7(legacyPath);
66544
- const ext = basename3(legacyPath).includes(".jsonc") ? ".jsonc" : ".json";
66545
- return join20(dir, `${CONFIG_BASENAME}${ext}`);
66564
+ const dir = dirname8(legacyPath);
66565
+ const ext = basename4(legacyPath).includes(".jsonc") ? ".jsonc" : ".json";
66566
+ return join21(dir, `${CONFIG_BASENAME}${ext}`);
66546
66567
  }
66547
66568
  function archiveLegacyConfigFile(legacyPath) {
66548
66569
  const backupPath = `${legacyPath}.bak`;
@@ -66600,7 +66621,7 @@ function migrateLegacySidecarFile(legacyPath, canonicalPath) {
66600
66621
  function migrateLegacyConfigFile(legacyPath) {
66601
66622
  if (!existsSync20(legacyPath))
66602
66623
  return false;
66603
- if (!basename3(legacyPath).startsWith(LEGACY_CONFIG_BASENAME))
66624
+ if (!basename4(legacyPath).startsWith(LEGACY_CONFIG_BASENAME))
66604
66625
  return false;
66605
66626
  const canonicalPath = buildCanonicalPath(legacyPath);
66606
66627
  if (existsSync20(canonicalPath))
@@ -66648,7 +66669,7 @@ function deepMergeRecord(target, source) {
66648
66669
 
66649
66670
  // packages/omo-opencode/src/cli/config-manager/write-omo-config.ts
66650
66671
  import { existsSync as existsSync21, readFileSync as readFileSync11, statSync as statSync4, writeFileSync as writeFileSync5 } from "fs";
66651
- import { basename as basename4, dirname as dirname8, extname, join as join21 } from "path";
66672
+ import { basename as basename5, dirname as dirname9, extname, join as join22 } from "path";
66652
66673
  function isEmptyOrWhitespace2(content) {
66653
66674
  return content.trim().length === 0;
66654
66675
  }
@@ -66663,8 +66684,8 @@ function writeOmoConfig(installConfig) {
66663
66684
  };
66664
66685
  }
66665
66686
  const detectedConfigPath = getOmoConfigPath();
66666
- const canonicalConfigPath = join21(dirname8(detectedConfigPath), `${CONFIG_BASENAME}${extname(detectedConfigPath) || ".json"}`);
66667
- const shouldMigrateLegacyPath = basename4(detectedConfigPath).startsWith(LEGACY_CONFIG_BASENAME);
66687
+ const canonicalConfigPath = join22(dirname9(detectedConfigPath), `${CONFIG_BASENAME}${extname(detectedConfigPath) || ".json"}`);
66688
+ const shouldMigrateLegacyPath = basename5(detectedConfigPath).startsWith(LEGACY_CONFIG_BASENAME);
66668
66689
  const omoConfigPath = shouldMigrateLegacyPath ? migrateLegacyConfigFile(detectedConfigPath) || existsSync21(canonicalConfigPath) ? canonicalConfigPath : detectedConfigPath : detectedConfigPath;
66669
66690
  try {
66670
66691
  const newConfig = generateOmoConfig(installConfig);
@@ -67043,9 +67064,9 @@ var init_detect_current_config = __esm(() => {
67043
67064
 
67044
67065
  // packages/omo-opencode/src/cli/config-manager/bun-install.ts
67045
67066
  import { existsSync as existsSync23 } from "fs";
67046
- import { join as join22 } from "path";
67067
+ import { join as join23 } from "path";
67047
67068
  function getDefaultWorkspaceDir() {
67048
- return join22(getOpenCodeCacheDir(), "packages");
67069
+ return join23(getOpenCodeCacheDir(), "packages");
67049
67070
  }
67050
67071
  function readProcessOutput(stream) {
67051
67072
  if (!stream) {
@@ -67481,12 +67502,12 @@ var init_star_request = __esm(() => {
67481
67502
 
67482
67503
  // packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
67483
67504
  import { existsSync as existsSync24, readFileSync as readFileSync13 } from "fs";
67484
- import { join as join23 } from "path";
67505
+ import { join as join24 } from "path";
67485
67506
  function fileEntryPackageJsonPath(entry) {
67486
67507
  let path7 = entry.slice("file:".length);
67487
67508
  if (path7.startsWith("//"))
67488
67509
  path7 = path7.slice(2);
67489
- return join23(path7, "package.json");
67510
+ return join24(path7, "package.json");
67490
67511
  }
67491
67512
  function packageJsonExportsTui(pkgJsonPath) {
67492
67513
  if (!existsSync24(pkgJsonPath))
@@ -67524,7 +67545,7 @@ function packageExportsTuiForServerEntry(entry) {
67524
67545
  const packageName = packageNameFromServerEntry(entry);
67525
67546
  if (packageName === null)
67526
67547
  return null;
67527
- return packageJsonExportsTui(join23(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
67548
+ return packageJsonExportsTui(join24(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
67528
67549
  }
67529
67550
  function isOurFilePluginEntry(entry) {
67530
67551
  if (typeof entry !== "string" || !entry.startsWith("file:"))
@@ -67589,7 +67610,7 @@ function detectServerPluginRegistration() {
67589
67610
  }
67590
67611
  }
67591
67612
  function detectTuiPluginRegistration() {
67592
- const tuiJsonPath = join23(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
67613
+ const tuiJsonPath = join24(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
67593
67614
  if (!existsSync24(tuiJsonPath)) {
67594
67615
  return {
67595
67616
  registered: false,
@@ -67737,7 +67758,7 @@ var init_tui_plugin_config = __esm(() => {
67737
67758
 
67738
67759
  // packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
67739
67760
  import { existsSync as existsSync25, mkdirSync as mkdirSync8, readFileSync as readFileSync14 } from "fs";
67740
- import { join as join24 } from "path";
67761
+ import { join as join25 } from "path";
67741
67762
  function readConfig(path7) {
67742
67763
  try {
67743
67764
  const parsed = parseJsonc(readFileSync14(path7, "utf-8"));
@@ -67751,10 +67772,10 @@ function readConfig(path7) {
67751
67772
  return null;
67752
67773
  }
67753
67774
  function readServerConfig(configDir) {
67754
- const jsoncPath = join24(configDir, "opencode.jsonc");
67775
+ const jsoncPath = join25(configDir, "opencode.jsonc");
67755
67776
  if (existsSync25(jsoncPath))
67756
67777
  return readConfig(jsoncPath);
67757
- const jsonPath = join24(configDir, "opencode.json");
67778
+ const jsonPath = join25(configDir, "opencode.json");
67758
67779
  if (existsSync25(jsonPath))
67759
67780
  return readConfig(jsonPath);
67760
67781
  return null;
@@ -67796,7 +67817,7 @@ function ensureTuiPluginEntry(opts = {}) {
67796
67817
  if (!desiredEntry) {
67797
67818
  return { changed: false, reason: "no-server-entry" };
67798
67819
  }
67799
- const tuiJsonPath = join24(configDir, "tui.json");
67820
+ const tuiJsonPath = join25(configDir, "tui.json");
67800
67821
  const { config, malformed } = readTuiConfig(tuiJsonPath);
67801
67822
  if (malformed) {
67802
67823
  return { changed: false, reason: "malformed" };
@@ -67826,17 +67847,17 @@ import {
67826
67847
  unlinkSync as unlinkSync5,
67827
67848
  readFileSync as readFileSync15
67828
67849
  } from "fs";
67829
- import { dirname as dirname9, join as join25 } from "path";
67850
+ import { dirname as dirname10, join as join26 } from "path";
67830
67851
  import { homedir as homedir6 } from "os";
67831
67852
  import { spawnSync as spawnSync3 } from "child_process";
67832
67853
  function findSlashCommandSource() {
67833
67854
  const candidates = [
67834
- join25(import.meta.dir, "slash-commands"),
67835
- join25(import.meta.dir, "..", "slash-commands"),
67836
- join25(import.meta.dir, "..", "..", "src", "cli", "slash-commands")
67855
+ join26(import.meta.dir, "slash-commands"),
67856
+ join26(import.meta.dir, "..", "slash-commands"),
67857
+ join26(import.meta.dir, "..", "..", "src", "cli", "slash-commands")
67837
67858
  ];
67838
67859
  for (const c of candidates) {
67839
- if (existsSync26(c) && existsSync26(join25(c, "adopt.md")))
67860
+ if (existsSync26(c) && existsSync26(join26(c, "adopt.md")))
67840
67861
  return c;
67841
67862
  }
67842
67863
  return null;
@@ -67850,10 +67871,10 @@ function copySlashCommandsTo(dir) {
67850
67871
  return 0;
67851
67872
  let copied = 0;
67852
67873
  for (const name2 of SLASH_COMMAND_NAMES) {
67853
- const src = join25(srcDir, name2);
67874
+ const src = join26(srcDir, name2);
67854
67875
  if (!existsSync26(src))
67855
67876
  continue;
67856
- copyFileSync3(src, join25(dir, name2));
67877
+ copyFileSync3(src, join26(dir, name2));
67857
67878
  copied++;
67858
67879
  }
67859
67880
  return copied;
@@ -67863,8 +67884,8 @@ function copySlashCommandsTo(dir) {
67863
67884
  }
67864
67885
  function resolveMatrixosBin() {
67865
67886
  const candidates = [
67866
- join25(import.meta.dir, "..", "..", "bin", "matrixos.js"),
67867
- join25(import.meta.dir, "..", "bin", "matrixos.js")
67887
+ join26(import.meta.dir, "..", "..", "bin", "matrixos.js"),
67888
+ join26(import.meta.dir, "..", "bin", "matrixos.js")
67868
67889
  ];
67869
67890
  for (const c of candidates) {
67870
67891
  if (existsSync26(c))
@@ -67889,7 +67910,7 @@ function npmGlobalInstallMatrixos(version) {
67889
67910
  if (bin && existsSync26(bin))
67890
67911
  return bin;
67891
67912
  for (const dir of ["/usr/local/bin", "/usr/bin"]) {
67892
- const p = join25(dir, "matrixos");
67913
+ const p = join26(dir, "matrixos");
67893
67914
  if (existsSync26(p))
67894
67915
  return p;
67895
67916
  }
@@ -67900,8 +67921,8 @@ function npmGlobalInstallMatrixos(version) {
67900
67921
  }
67901
67922
  function getPackageVersion() {
67902
67923
  const candidates = [
67903
- join25(import.meta.dir, "..", "..", "package.json"),
67904
- join25(import.meta.dir, "..", "package.json")
67924
+ join26(import.meta.dir, "..", "..", "package.json"),
67925
+ join26(import.meta.dir, "..", "package.json")
67905
67926
  ];
67906
67927
  for (const c of candidates) {
67907
67928
  try {
@@ -67918,8 +67939,8 @@ function copyRecursive(from, to) {
67918
67939
  if (!existsSync26(to))
67919
67940
  mkdirSync9(to, { recursive: true });
67920
67941
  for (const entry of readdirSync4(from, { withFileTypes: true })) {
67921
- const src = join25(from, entry.name);
67922
- const dst = join25(to, entry.name);
67942
+ const src = join26(from, entry.name);
67943
+ const dst = join26(to, entry.name);
67923
67944
  if (entry.isDirectory()) {
67924
67945
  copyRecursive(src, dst);
67925
67946
  } else {
@@ -67928,12 +67949,12 @@ function copyRecursive(from, to) {
67928
67949
  }
67929
67950
  }
67930
67951
  function installPackageTo(path7, bin) {
67931
- const srcDir = dirname9(dirname9(bin));
67952
+ const srcDir = dirname10(dirname10(bin));
67932
67953
  if (!existsSync26(srcDir))
67933
67954
  return null;
67934
67955
  try {
67935
67956
  copyRecursive(srcDir, path7);
67936
- return join25(path7, "bin", "matrixos.js");
67957
+ return join26(path7, "bin", "matrixos.js");
67937
67958
  } catch {
67938
67959
  return null;
67939
67960
  }
@@ -67941,8 +67962,8 @@ function installPackageTo(path7, bin) {
67941
67962
  function installSlashCommandsAndPath() {
67942
67963
  const home = homedir6();
67943
67964
  const targets = [
67944
- join25(home, ".config", "opencode", "commands"),
67945
- join25(home, ".claude", "commands")
67965
+ join26(home, ".config", "opencode", "commands"),
67966
+ join26(home, ".claude", "commands")
67946
67967
  ];
67947
67968
  let total = 0;
67948
67969
  for (const t of targets)
@@ -67999,7 +68020,7 @@ var init_shared_skills = () => {};
67999
68020
 
68000
68021
  // packages/omo-opencode/src/cli/install-ast-grep-sg.ts
68001
68022
  import { homedir as homedir7 } from "os";
68002
- import { join as join26 } from "path";
68023
+ import { join as join27 } from "path";
68003
68024
  function describeResult(result) {
68004
68025
  if (result.kind === "succeeded")
68005
68026
  return null;
@@ -68009,9 +68030,9 @@ function describeResult(result) {
68009
68030
  }
68010
68031
  async function installAstGrepForOpenCode(options = {}) {
68011
68032
  const platform = options.platform ?? process.platform;
68012
- const baseDir = join26(options.homeDir ?? homedir7(), ".omo");
68033
+ const baseDir = join27(options.homeDir ?? homedir7(), ".omo");
68013
68034
  const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
68014
- const skillDir = join26(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
68035
+ const skillDir = join27(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
68015
68036
  const installer = options.installer ?? runAstGrepSkillInstall;
68016
68037
  try {
68017
68038
  const result = await installer({ platform, skillDir, targetDir });
@@ -69831,12 +69852,12 @@ var init_dist5 = __esm(() => {
69831
69852
  // packages/omo-opencode/src/cli/config-manager/write-gateway-env.ts
69832
69853
  import { homedir as homedir8 } from "os";
69833
69854
  import { existsSync as existsSync27, mkdirSync as mkdirSync10, readFileSync as readFileSync16, writeFileSync as writeFileSync6, chmodSync as chmodSync3 } from "fs";
69834
- import { join as join27 } from "path";
69855
+ import { join as join28 } from "path";
69835
69856
  function writeGatewayEnvToken(key, token) {
69836
69857
  const configDir = homedir8();
69837
69858
  if (!existsSync27(configDir))
69838
69859
  mkdirSync10(configDir, { recursive: true });
69839
- const envPath = join27(configDir, GATEWAY_ENV_FILENAME);
69860
+ const envPath = join28(configDir, GATEWAY_ENV_FILENAME);
69840
69861
  const entries = new Map;
69841
69862
  if (existsSync27(envPath)) {
69842
69863
  const existing = readFileSync16(envPath, "utf-8");
@@ -102892,7 +102913,7 @@ var require_Util = __commonJS((exports, module2) => {
102892
102913
  await client3.rest.patch(route, { body: updatedItems, reason });
102893
102914
  return updatedItems;
102894
102915
  }
102895
- function basename5(path7, ext) {
102916
+ function basename6(path7, ext) {
102896
102917
  const res = parse7(path7);
102897
102918
  return ext && res.ext.startsWith(ext) ? res.name : res.base.split("?")[0];
102898
102919
  }
@@ -103015,7 +103036,7 @@ var require_Util = __commonJS((exports, module2) => {
103015
103036
  resolveColor,
103016
103037
  discordSort,
103017
103038
  setPosition,
103018
- basename: basename5,
103039
+ basename: basename6,
103019
103040
  cleanContent,
103020
103041
  cleanCodeBlockContent,
103021
103042
  parseWebhookURL,
@@ -115836,7 +115857,7 @@ var require_MessagePayload = __commonJS((exports, module2) => {
115836
115857
  var { DiscordjsError, DiscordjsRangeError, ErrorCodes } = require_errors();
115837
115858
  var { resolveFile } = require_DataResolver();
115838
115859
  var MessageFlagsBitField = require_MessageFlagsBitField();
115839
- var { basename: basename5, verifyString, resolvePartialEmoji } = require_Util();
115860
+ var { basename: basename6, verifyString, resolvePartialEmoji } = require_Util();
115840
115861
  var getBaseInteraction = lazy2(() => require_BaseInteraction());
115841
115862
 
115842
115863
  class MessagePayload {
@@ -116021,10 +116042,10 @@ var require_MessagePayload = __commonJS((exports, module2) => {
116021
116042
  let name2;
116022
116043
  const findName = (thing) => {
116023
116044
  if (typeof thing === "string") {
116024
- return basename5(thing);
116045
+ return basename6(thing);
116025
116046
  }
116026
116047
  if (thing.path) {
116027
- return basename5(thing.path);
116048
+ return basename6(thing.path);
116028
116049
  }
116029
116050
  return "file.jpg";
116030
116051
  };
@@ -121550,7 +121571,7 @@ var require_dist9 = __commonJS((exports, module2) => {
121550
121571
  var import_node_worker_threads2 = __require("worker_threads");
121551
121572
  var import_collection2 = require_dist2();
121552
121573
  var import_node_events = __require("events");
121553
- var import_node_path25 = __require("path");
121574
+ var import_node_path26 = __require("path");
121554
121575
  var import_node_worker_threads = __require("worker_threads");
121555
121576
  var import_collection = require_dist2();
121556
121577
  var WorkerSendPayloadOp = /* @__PURE__ */ ((WorkerSendPayloadOp2) => {
@@ -121685,18 +121706,18 @@ var require_dist9 = __commonJS((exports, module2) => {
121685
121706
  resolveWorkerPath() {
121686
121707
  const path7 = this.options.workerPath;
121687
121708
  if (!path7) {
121688
- return (0, import_node_path25.join)(__dirname, "defaultWorker.js");
121709
+ return (0, import_node_path26.join)(__dirname, "defaultWorker.js");
121689
121710
  }
121690
- if ((0, import_node_path25.isAbsolute)(path7)) {
121711
+ if ((0, import_node_path26.isAbsolute)(path7)) {
121691
121712
  return path7;
121692
121713
  }
121693
121714
  if (/^\.\.?[/\\]/.test(path7)) {
121694
- return (0, import_node_path25.resolve)(path7);
121715
+ return (0, import_node_path26.resolve)(path7);
121695
121716
  }
121696
121717
  try {
121697
121718
  return __require.resolve(path7);
121698
121719
  } catch {
121699
- return (0, import_node_path25.resolve)(path7);
121720
+ return (0, import_node_path26.resolve)(path7);
121700
121721
  }
121701
121722
  }
121702
121723
  async waitForWorkerReady(worker) {
@@ -128397,7 +128418,7 @@ var require_EmbedBuilder = __commonJS((exports, module2) => {
128397
128418
 
128398
128419
  // node_modules/.bun/discord.js@14.27.0/node_modules/discord.js/src/structures/AttachmentBuilder.js
128399
128420
  var require_AttachmentBuilder = __commonJS((exports, module2) => {
128400
- var { basename: basename5, flatten } = require_Util();
128421
+ var { basename: basename6, flatten } = require_Util();
128401
128422
 
128402
128423
  class AttachmentBuilder {
128403
128424
  constructor(attachment, data = {}) {
@@ -128445,7 +128466,7 @@ var require_AttachmentBuilder = __commonJS((exports, module2) => {
128445
128466
  return this;
128446
128467
  }
128447
128468
  get spoiler() {
128448
- return basename5(this.name).startsWith("SPOILER_");
128469
+ return basename6(this.name).startsWith("SPOILER_");
128449
128470
  }
128450
128471
  toJSON() {
128451
128472
  return flatten(this);
@@ -129214,7 +129235,7 @@ var init_writer2 = __esm(() => {
129214
129235
 
129215
129236
  // packages/omo-config-core/src/generator/mini-os-generator.ts
129216
129237
  import { existsSync as existsSync29, mkdirSync as mkdirSync11, writeFileSync as writeFileSync8 } from "fs";
129217
- import { dirname as dirname10, join as join28 } from "path";
129238
+ import { dirname as dirname11, join as join29 } from "path";
129218
129239
  function generateMiniOS(options) {
129219
129240
  const fs6 = options.fs ?? defaultFS;
129220
129241
  const profile2 = options.profile;
@@ -129225,29 +129246,29 @@ function generateMiniOS(options) {
129225
129246
  if (!fs6.existsSync(targetDir)) {
129226
129247
  fs6.mkdirSync(targetDir, { recursive: true });
129227
129248
  }
129228
- const pkgPath = join28(targetDir, "package.json");
129249
+ const pkgPath = join29(targetDir, "package.json");
129229
129250
  writeIfMissing(fs6, pkgPath, TPL_PACKAGE_JSON(packageName, displayName, profile2.version, profile2.description, profile2.extends, profile2.baseAgent));
129230
129251
  filesWritten.push(pkgPath);
129231
- const srcDir = join28(targetDir, "src");
129252
+ const srcDir = join29(targetDir, "src");
129232
129253
  fs6.mkdirSync(srcDir, { recursive: true });
129233
- const indexPath = join28(srcDir, "index.ts");
129254
+ const indexPath = join29(srcDir, "index.ts");
129234
129255
  writeIfMissing(fs6, indexPath, TPL_INDEX_TS(profile2.name, displayName, profile2.description));
129235
129256
  filesWritten.push(indexPath);
129236
- const binDir = join28(targetDir, "bin");
129257
+ const binDir = join29(targetDir, "bin");
129237
129258
  fs6.mkdirSync(binDir, { recursive: true });
129238
- const binPath = join28(binDir, "matrixos-mini.js");
129259
+ const binPath = join29(binDir, "matrixos-mini.js");
129239
129260
  writeIfMissing(fs6, binPath, TPL_BIN);
129240
129261
  filesWritten.push(binPath);
129241
- const scriptDir = join28(targetDir, "script");
129262
+ const scriptDir = join29(targetDir, "script");
129242
129263
  fs6.mkdirSync(scriptDir, { recursive: true });
129243
- const buildPath = join28(scriptDir, "build.ts");
129264
+ const buildPath = join29(scriptDir, "build.ts");
129244
129265
  writeIfMissing(fs6, buildPath, TPL_BUILD_TS);
129245
129266
  filesWritten.push(buildPath);
129246
129267
  if (Object.keys(profile2.agents).length > 0) {
129247
- const agentsDir = join28(targetDir, "agents");
129268
+ const agentsDir = join29(targetDir, "agents");
129248
129269
  fs6.mkdirSync(agentsDir, { recursive: true });
129249
129270
  for (const [agentName, agentDef] of Object.entries(profile2.agents)) {
129250
- const agentFile = join28(agentsDir, `${agentName}.ts`);
129271
+ const agentFile = join29(agentsDir, `${agentName}.ts`);
129251
129272
  const description = agentDef.description ?? `Custom ${displayName} agent: ${agentName}`;
129252
129273
  writeIfMissing(fs6, agentFile, `// ${description}
129253
129274
  // Generated by MaTrixOS Mini-OS Profile Generator.
@@ -129258,10 +129279,10 @@ export const description = ${JSON.stringify(description)}
129258
129279
  }
129259
129280
  }
129260
129281
  if (profile2.skills.length > 0) {
129261
- const skillsDir = join28(targetDir, "skills");
129282
+ const skillsDir = join29(targetDir, "skills");
129262
129283
  fs6.mkdirSync(skillsDir, { recursive: true });
129263
129284
  for (const skill of profile2.skills) {
129264
- const skillFile = join28(skillsDir, `${skill}.md`);
129285
+ const skillFile = join29(skillsDir, `${skill}.md`);
129265
129286
  writeIfMissing(fs6, skillFile, `# ${skill}
129266
129287
 
129267
129288
  _Skill required by the ${displayName} profile. Implementation goes here._
@@ -129269,12 +129290,12 @@ _Skill required by the ${displayName} profile. Implementation goes here._
129269
129290
  filesWritten.push(skillFile);
129270
129291
  }
129271
129292
  }
129272
- const readmePath = join28(targetDir, "README.md");
129293
+ const readmePath = join29(targetDir, "README.md");
129273
129294
  const agentsList = Object.keys(profile2.agents);
129274
129295
  const skillsList = profile2.skills;
129275
129296
  writeIfMissing(fs6, readmePath, TPL_README(packageName, displayName, profile2.description, profile2.version, profile2.baseAgent, profile2.extends, agentsList, skillsList));
129276
129297
  filesWritten.push(readmePath);
129277
- const agentsMdPath = join28(targetDir, "AGENTS.md");
129298
+ const agentsMdPath = join29(targetDir, "AGENTS.md");
129278
129299
  writeIfMissing(fs6, agentsMdPath, TPL_AGENT_MD(displayName, profile2.description));
129279
129300
  filesWritten.push(agentsMdPath);
129280
129301
  return { packageName, packageDir: targetDir, filesWritten };
@@ -129282,7 +129303,7 @@ _Skill required by the ${displayName} profile. Implementation goes here._
129282
129303
  function writeIfMissing(fs6, path7, content) {
129283
129304
  if (fs6.existsSync(path7))
129284
129305
  return;
129285
- const dir = dirname10(path7);
129306
+ const dir = dirname11(path7);
129286
129307
  if (!fs6.existsSync(dir)) {
129287
129308
  fs6.mkdirSync(dir, { recursive: true });
129288
129309
  }
@@ -130136,19 +130157,19 @@ var init_update_toasts = __esm(() => {
130136
130157
 
130137
130158
  // packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
130138
130159
  import { existsSync as existsSync45 } from "fs";
130139
- import { dirname as dirname18, join as join40 } from "path";
130160
+ import { dirname as dirname19, join as join41 } from "path";
130140
130161
  import { fileURLToPath as fileURLToPath4 } from "url";
130141
130162
  function defaultGetModuleHostingWorkspace() {
130142
130163
  try {
130143
- const currentDir = dirname18(fileURLToPath4(import.meta.url));
130164
+ const currentDir = dirname19(fileURLToPath4(import.meta.url));
130144
130165
  const pkgJsonPath = findPackageJsonUp(currentDir);
130145
130166
  if (!pkgJsonPath)
130146
130167
  return null;
130147
- const pkgDir = dirname18(pkgJsonPath);
130148
- const nodeModulesDir = dirname18(pkgDir);
130168
+ const pkgDir = dirname19(pkgJsonPath);
130169
+ const nodeModulesDir = dirname19(pkgDir);
130149
130170
  if (nodeModulesDir.split(/[\\/]/).pop() !== "node_modules")
130150
130171
  return null;
130151
- return dirname18(nodeModulesDir);
130172
+ return dirname19(nodeModulesDir);
130152
130173
  } catch (error51) {
130153
130174
  if (error51 instanceof Error) {
130154
130175
  return null;
@@ -130290,7 +130311,7 @@ var init_background_update_check = __esm(() => {
130290
130311
  init_update_toasts();
130291
130312
  defaultDeps4 = {
130292
130313
  existsSync: existsSync45,
130293
- join: join40,
130314
+ join: join41,
130294
130315
  runBunInstallWithDetails,
130295
130316
  log: log2,
130296
130317
  getOpenCodeCacheDir,
@@ -165121,18 +165142,18 @@ __export(exports_generate, {
165121
165142
  ProfileNotFoundError: () => ProfileNotFoundError
165122
165143
  });
165123
165144
  import { existsSync as existsSync72, readFileSync as readFileSync59, realpathSync as realpathSync10 } from "fs";
165124
- import { dirname as dirname29, isAbsolute as isAbsolute6, join as join77, resolve as resolve16 } from "path";
165145
+ import { dirname as dirname30, isAbsolute as isAbsolute6, join as join78, resolve as resolve16 } from "path";
165125
165146
  function profilesDirFor(opts) {
165126
165147
  if (opts.profilesDir)
165127
165148
  return opts.profilesDir;
165128
165149
  if (opts.cwd)
165129
- return join77(opts.cwd, PROFILES_RELATIVE);
165130
- return join77(REPO_ROOT, PROFILES_RELATIVE);
165150
+ return join78(opts.cwd, PROFILES_RELATIVE);
165151
+ return join78(REPO_ROOT, PROFILES_RELATIVE);
165131
165152
  }
165132
165153
  function loadProfile(name2, options = {}) {
165133
165154
  const fs22 = options.fs ?? defaultFS2;
165134
165155
  const dir = profilesDirFor(options);
165135
- const path27 = join77(dir, `${name2}.json`);
165156
+ const path27 = join78(dir, `${name2}.json`);
165136
165157
  if (!fs22.existsSync(path27)) {
165137
165158
  throw new ProfileNotFoundError(name2);
165138
165159
  }
@@ -165145,7 +165166,7 @@ function listProfiles(options = {}) {
165145
165166
  const known = options.knownNames ?? ["trader", "plumber"];
165146
165167
  const out = [];
165147
165168
  for (const name2 of known) {
165148
- const path27 = join77(dir, `${name2}.json`);
165169
+ const path27 = join78(dir, `${name2}.json`);
165149
165170
  if (fs22.existsSync(path27)) {
165150
165171
  try {
165151
165172
  const raw = JSON.parse(fs22.readFileSync(path27, "utf-8"));
@@ -165217,7 +165238,7 @@ var REPO_ROOT, defaultFS2, PROFILES_RELATIVE = "assets/profiles", ProfileNotFoun
165217
165238
  var init_generate = __esm(() => {
165218
165239
  init_src5();
165219
165240
  init_src5();
165220
- REPO_ROOT = resolve16(dirname29(new URL(import.meta.url).pathname), "..", "..", "..", "..", "..");
165241
+ REPO_ROOT = resolve16(dirname30(new URL(import.meta.url).pathname), "..", "..", "..", "..", "..");
165221
165242
  defaultFS2 = { existsSync: existsSync72, readFileSync: readFileSync59, realpathSync: realpathSync10 };
165222
165243
  ProfileNotFoundError = class ProfileNotFoundError extends Error {
165223
165244
  profileName;
@@ -165473,7 +165494,7 @@ __export(exports_profile_resolve, {
165473
165494
  executeProfileResolveCommand: () => executeProfileResolveCommand
165474
165495
  });
165475
165496
  import { existsSync as existsSync74, readdirSync as readdirSync16, readFileSync as readFileSync60 } from "fs";
165476
- import { join as join80, resolve as resolve17, dirname as dirname30 } from "path";
165497
+ import { join as join81, resolve as resolve17, dirname as dirname31 } from "path";
165477
165498
  function executeProfileResolveCommand(args) {
165478
165499
  if (args.options.help) {
165479
165500
  return {
@@ -165498,7 +165519,7 @@ function executeProfileResolveCommand(args) {
165498
165519
  ` };
165499
165520
  }
165500
165521
  const name2 = nameRaw.endsWith(".json") ? nameRaw.slice(0, -5) : nameRaw;
165501
- const profilesDir = join80(REPO_ROOT2, PROFILES_RELATIVE2);
165522
+ const profilesDir = join81(REPO_ROOT2, PROFILES_RELATIVE2);
165502
165523
  if (!existsSync74(profilesDir)) {
165503
165524
  return { exitCode: 1, stdout: `error: profiles directory not found at ${profilesDir}
165504
165525
  ` };
@@ -165518,7 +165539,7 @@ function executeProfileResolveCommand(args) {
165518
165539
  const registry2 = {};
165519
165540
  for (const file3 of profileFiles) {
165520
165541
  try {
165521
- const filePath = join80(profilesDir, file3);
165542
+ const filePath = join81(profilesDir, file3);
165522
165543
  const raw = JSON.parse(readFileSync60(filePath, "utf-8"));
165523
165544
  const profile2 = ProfileSchema.parse(raw);
165524
165545
  registry2[profile2.name] = profile2;
@@ -165571,7 +165592,7 @@ function executeProfileResolveCommand(args) {
165571
165592
  var REPO_ROOT2, PROFILES_RELATIVE2 = "assets/profiles";
165572
165593
  var init_profile_resolve = __esm(() => {
165573
165594
  init_src5();
165574
- REPO_ROOT2 = resolve17(dirname30(new URL(import.meta.url).pathname), "..", "..", "..", "..");
165595
+ REPO_ROOT2 = resolve17(dirname31(new URL(import.meta.url).pathname), "..", "..", "..", "..");
165575
165596
  });
165576
165597
 
165577
165598
  // packages/omo-opencode/src/cli/export.ts
@@ -165582,7 +165603,7 @@ __export(exports_export, {
165582
165603
  executeExportCommand: () => executeExportCommand
165583
165604
  });
165584
165605
  import { existsSync as existsSync75, readFileSync as readFileSync61, writeFileSync as writeFileSync26, copyFileSync as copyFileSync8, realpathSync as realpathSync11, mkdirSync as mkdirSync27 } from "fs";
165585
- import { isAbsolute as isAbsolute7, join as join81, resolve as resolve18, dirname as dirname31 } from "path";
165606
+ import { isAbsolute as isAbsolute7, join as join82, resolve as resolve18, dirname as dirname32 } from "path";
165586
165607
  import { spawnSync as spawnSync4 } from "child_process";
165587
165608
  function setShell(shell) {
165588
165609
  activeShell = shell;
@@ -165623,7 +165644,7 @@ function executeExportCommand(args) {
165623
165644
  return { exitCode: 1, stdout: `error: generate failed: ${message}
165624
165645
  ` };
165625
165646
  }
165626
- const pkgPath = join81(absoluteTargetDir, "package.json");
165647
+ const pkgPath = join82(absoluteTargetDir, "package.json");
165627
165648
  let pkg;
165628
165649
  try {
165629
165650
  pkg = JSON.parse(fs24.readFileSync(pkgPath, "utf-8"));
@@ -165663,11 +165684,11 @@ ${packResult.stdout}
165663
165684
  return { exitCode: 1, stdout: `error: npm pack produced no tarball name in output
165664
165685
  ` };
165665
165686
  }
165666
- let tgzPath = join81(absoluteTargetDir, tgzName);
165687
+ let tgzPath = join82(absoluteTargetDir, tgzName);
165667
165688
  if (args.options.output) {
165668
165689
  const outputPath = args.options.output;
165669
165690
  const absoluteOutput = isAbsolute7(outputPath) ? outputPath : resolve18(process.cwd(), outputPath);
165670
- const outputDir = dirname31(absoluteOutput);
165691
+ const outputDir = dirname32(absoluteOutput);
165671
165692
  if (!fs24.existsSync(outputDir)) {
165672
165693
  fs24.mkdirSync(outputDir, { recursive: true });
165673
165694
  }
@@ -165734,18 +165755,18 @@ __export(exports_project_context, {
165734
165755
  archiveProject: () => archiveProject
165735
165756
  });
165736
165757
  import { existsSync as existsSync76, mkdirSync as mkdirSync28, readFileSync as readFileSync62, writeFileSync as writeFileSync27, rmSync as rmSync8 } from "fs";
165737
- import { join as join82 } from "path";
165758
+ import { join as join83 } from "path";
165738
165759
  function getMatrixOsDir(cwd = process.cwd()) {
165739
- return join82(cwd, ".matrixos");
165760
+ return join83(cwd, ".matrixos");
165740
165761
  }
165741
165762
  function getProjectsDir(cwd) {
165742
- return join82(getMatrixOsDir(cwd), "projects");
165763
+ return join83(getMatrixOsDir(cwd), "projects");
165743
165764
  }
165744
165765
  function getProjectDir(slug, cwd) {
165745
- return join82(getProjectsDir(cwd), slug);
165766
+ return join83(getProjectsDir(cwd), slug);
165746
165767
  }
165747
165768
  function getStatePath(cwd) {
165748
- return join82(getMatrixOsDir(cwd), "state.json");
165769
+ return join83(getMatrixOsDir(cwd), "state.json");
165749
165770
  }
165750
165771
  function loadState(cwd) {
165751
165772
  const path29 = getStatePath(cwd);
@@ -165764,7 +165785,7 @@ function saveState(state2, cwd) {
165764
165785
  `);
165765
165786
  }
165766
165787
  function loadProjectMeta(slug, cwd) {
165767
- const path29 = join82(getProjectDir(slug, cwd), "meta.json");
165788
+ const path29 = join83(getProjectDir(slug, cwd), "meta.json");
165768
165789
  if (!existsSync76(path29))
165769
165790
  return null;
165770
165791
  try {
@@ -165776,14 +165797,14 @@ function loadProjectMeta(slug, cwd) {
165776
165797
  function saveProjectMeta(slug, meta3, cwd) {
165777
165798
  const dir = getProjectDir(slug, cwd);
165778
165799
  mkdirSync28(dir, { recursive: true });
165779
- const path29 = join82(dir, "meta.json");
165800
+ const path29 = join83(dir, "meta.json");
165780
165801
  writeFileSync27(path29, JSON.stringify(meta3, null, 2) + `
165781
165802
  `);
165782
165803
  }
165783
165804
  function initProjectFiles(slug, cwd) {
165784
165805
  const dir = getProjectDir(slug, cwd);
165785
- mkdirSync28(join82(dir, "kb"), { recursive: true });
165786
- const kanbanPath = join82(dir, "kanban.json");
165806
+ mkdirSync28(join83(dir, "kb"), { recursive: true });
165807
+ const kanbanPath = join83(dir, "kanban.json");
165787
165808
  if (!existsSync76(kanbanPath)) {
165788
165809
  writeFileSync27(kanbanPath, JSON.stringify({ columns: ["todo", "in-progress", "review", "done"], tasks: [] }, null, 2) + `
165789
165810
  `);
@@ -165895,7 +165916,7 @@ __export(exports_project_memory, {
165895
165916
  addKbDocument: () => addKbDocument
165896
165917
  });
165897
165918
  import { existsSync as existsSync77, mkdirSync as mkdirSync29, readFileSync as readFileSync63, readdirSync as readdirSync17, writeFileSync as writeFileSync28 } from "fs";
165898
- import { join as join83 } from "path";
165919
+ import { join as join84 } from "path";
165899
165920
  function tagWithProject(metadata = {}, projectSlug, cwd) {
165900
165921
  const active = projectSlug ?? getActiveProject(cwd)?.slug;
165901
165922
  if (!active)
@@ -165909,14 +165930,14 @@ function isProjectEpisode(ep, projectSlug, cwd) {
165909
165930
  return ep.metadata?.project === target;
165910
165931
  }
165911
165932
  function listKbDocuments(projectSlug, cwd) {
165912
- const kbDir = join83(getProjectDir(projectSlug, cwd), "kb");
165933
+ const kbDir = join84(getProjectDir(projectSlug, cwd), "kb");
165913
165934
  if (!existsSync77(kbDir))
165914
165935
  return [];
165915
165936
  const docs = [];
165916
165937
  for (const entry of readdirSync17(kbDir, { withFileTypes: true })) {
165917
165938
  if (!entry.isFile())
165918
165939
  continue;
165919
- const path29 = join83(kbDir, entry.name);
165940
+ const path29 = join84(kbDir, entry.name);
165920
165941
  try {
165921
165942
  docs.push({ path: path29, content: readFileSync63(path29, "utf-8") });
165922
165943
  } catch {}
@@ -165960,10 +165981,10 @@ async function searchProject(query, options = {}) {
165960
165981
  return [...kbHits, ...memoryHits].sort((a2, b2) => b2.score - a2.score);
165961
165982
  }
165962
165983
  function addKbDocument(projectSlug, filename, content, cwd) {
165963
- const kbDir = join83(getProjectDir(projectSlug, cwd), "kb");
165984
+ const kbDir = join84(getProjectDir(projectSlug, cwd), "kb");
165964
165985
  mkdirSync29(kbDir, { recursive: true });
165965
165986
  const safeName = filename.replace(/[^a-zA-Z0-9._-]/g, "_");
165966
- const path29 = join83(kbDir, safeName);
165987
+ const path29 = join84(kbDir, safeName);
165967
165988
  writeFileSync28(path29, content, "utf-8");
165968
165989
  return path29;
165969
165990
  }
@@ -166216,6 +166237,104 @@ var init_gateway_set_token = __esm(() => {
166216
166237
  };
166217
166238
  });
166218
166239
 
166240
+ // packages/omo-opencode/src/cli/skill-create.ts
166241
+ var exports_skill_create = {};
166242
+ __export(exports_skill_create, {
166243
+ executeSkillCreateCommand: () => executeSkillCreateCommand
166244
+ });
166245
+ import { mkdirSync as mkdirSync30, writeFileSync as writeFileSync29, existsSync as existsSync78 } from "fs";
166246
+ import { join as join85 } from "path";
166247
+ function slugify2(input) {
166248
+ return input.toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
166249
+ }
166250
+ function buildSkillMarkdown(name2, description, category2) {
166251
+ const slug = slugify2(name2);
166252
+ return `---
166253
+ name: ${slug}
166254
+ description: ${description}
166255
+ category: ${category2}
166256
+ ---
166257
+
166258
+ # ${name2}
166259
+
166260
+ ## Overview
166261
+
166262
+ Describe what this skill does and why it exists. One or two sentences.
166263
+
166264
+ ## When to Use
166265
+
166266
+ - Trigger condition 1
166267
+ - Trigger condition 2
166268
+
166269
+ **When NOT to use:**
166270
+
166271
+ - Counter-example 1
166272
+
166273
+ ## The Process
166274
+
166275
+ 1. Step one
166276
+ 2. Step two
166277
+ 3. Step three
166278
+
166279
+ ## Output
166280
+
166281
+ What the agent should produce when this skill completes.
166282
+ `;
166283
+ }
166284
+ function executeSkillCreateCommand(options) {
166285
+ const slug = slugify2(options.name);
166286
+ if (!slug) {
166287
+ return {
166288
+ ok: false,
166289
+ name: options.name,
166290
+ slug: "",
166291
+ path: "",
166292
+ content: "",
166293
+ applied: false,
166294
+ error: "invalid skill name (empty after slugify)"
166295
+ };
166296
+ }
166297
+ const description = options.description?.trim() || `${slug} \u2014 TODO: describe this skill`;
166298
+ const category2 = options.category?.trim() || "user-generated";
166299
+ let skillDir;
166300
+ if (options.targetDir) {
166301
+ skillDir = options.targetDir;
166302
+ } else if (options.scope === "project") {
166303
+ skillDir = join85(process.cwd(), ".opencode", "skills");
166304
+ } else {
166305
+ const dirs = getOpenCodeSkillDirs({ binary: "opencode" });
166306
+ skillDir = dirs[0] ?? join85(getHomeDirectory(), ".config", "opencode", "skills");
166307
+ }
166308
+ const skillPath = join85(skillDir, slug);
166309
+ const skillFile = join85(skillPath, "SKILL.md");
166310
+ const content = buildSkillMarkdown(options.name.trim(), description, category2);
166311
+ const result = {
166312
+ ok: true,
166313
+ name: options.name.trim(),
166314
+ slug,
166315
+ path: skillFile,
166316
+ content,
166317
+ applied: false
166318
+ };
166319
+ if (!options.apply) {
166320
+ return result;
166321
+ }
166322
+ try {
166323
+ if (!existsSync78(skillPath))
166324
+ mkdirSync30(skillPath, { recursive: true });
166325
+ writeFileSync29(skillFile, content, "utf-8");
166326
+ result.applied = true;
166327
+ } catch (e) {
166328
+ result.ok = false;
166329
+ result.error = e instanceof Error ? e.message : String(e);
166330
+ }
166331
+ return result;
166332
+ }
166333
+ var init_skill_create = __esm(() => {
166334
+ init_shared();
166335
+ init_src();
166336
+ });
166337
+
166219
166338
  // packages/omo-opencode/src/gateway/gateway-handler.ts
166220
166339
  import { spawn as spawn5 } from "child_process";
166221
166340
  function maskSecrets(s) {
@@ -166351,7 +166470,7 @@ __export(exports_gateway_start, {
166351
166470
  buildTelegramConfig: () => buildTelegramConfig,
166352
166471
  buildGatewayConfig: () => buildGatewayConfig
166353
166472
  });
166354
- import { readFileSync as readFileSync64, existsSync as existsSync78 } from "fs";
166473
+ import { readFileSync as readFileSync64, existsSync as existsSync79 } from "fs";
166355
166474
  import { resolve as resolve19 } from "path";
166356
166475
  import { execSync as execSync2 } from "child_process";
166357
166476
  function resolveMatrixosCommand(fallback = "matrixos") {
@@ -166363,7 +166482,7 @@ function resolveMatrixosCommand(fallback = "matrixos") {
166363
166482
  return fallback;
166364
166483
  }
166365
166484
  function loadGatewayEnv(path29 = ENV_PATH) {
166366
- if (!existsSync78(path29))
166485
+ if (!existsSync79(path29))
166367
166486
  return {};
166368
166487
  const text = readFileSync64(path29, "utf8");
166369
166488
  const out = {};
@@ -166513,7 +166632,7 @@ var init_deployment_core = __esm(() => {
166513
166632
 
166514
166633
  // packages/omo-opencode/src/deployment/deploy-static.ts
166515
166634
  import { spawn as spawn6 } from "child_process";
166516
- import { existsSync as existsSync79 } from "fs";
166635
+ import { existsSync as existsSync80 } from "fs";
166517
166636
  import { resolve as resolve20 } from "path";
166518
166637
  function pushStage(stage, message, ok = true) {
166519
166638
  return { stage, message, ok };
@@ -166570,7 +166689,7 @@ var init_deploy_static = __esm(() => {
166570
166689
  }
166571
166690
  stages.push(pushStage("build", "build succeeded"));
166572
166691
  }
166573
- if (!existsSync79(buildDir)) {
166692
+ if (!existsSync80(buildDir)) {
166574
166693
  stages.push(pushStage("push", `build directory not found: ${buildDir}`, false));
166575
166694
  return { target: "static", ok: false, stages, error: "build directory missing" };
166576
166695
  }
@@ -166846,10 +166965,10 @@ var init_deployment = __esm(() => {
166846
166965
  });
166847
166966
 
166848
166967
  // packages/omo-opencode/src/audit/self-audit.ts
166849
- import { existsSync as existsSync80, mkdirSync as mkdirSync30, readdirSync as readdirSync18, readFileSync as readFileSync65, writeFileSync as writeFileSync29 } from "fs";
166850
- import { join as join84 } from "path";
166968
+ import { existsSync as existsSync81, mkdirSync as mkdirSync31, readdirSync as readdirSync18, readFileSync as readFileSync65, writeFileSync as writeFileSync30 } from "fs";
166969
+ import { join as join86 } from "path";
166851
166970
  function getAuditDir(cwd = process.cwd()) {
166852
- return join84(cwd, ".matrixos", "audits");
166971
+ return join86(cwd, ".matrixos", "audits");
166853
166972
  }
166854
166973
  function getWeekString(date5 = new Date) {
166855
166974
  const d = new Date(Date.UTC(date5.getFullYear(), date5.getMonth(), date5.getDate()));
@@ -166956,9 +167075,9 @@ function formatAuditReport(report) {
166956
167075
  }
166957
167076
  function writeAuditReport(report, cwd) {
166958
167077
  const dir = getAuditDir(cwd);
166959
- mkdirSync30(dir, { recursive: true });
166960
- const path29 = join84(dir, `${report.week}.md`);
166961
- writeFileSync29(path29, formatAuditReport(report), "utf-8");
167078
+ mkdirSync31(dir, { recursive: true });
167079
+ const path29 = join86(dir, `${report.week}.md`);
167080
+ writeFileSync30(path29, formatAuditReport(report), "utf-8");
166962
167081
  return path29;
166963
167082
  }
166964
167083
  var init_self_audit = () => {};
@@ -169275,7 +169394,7 @@ var import_picocolors11 = __toESM(require_picocolors(), 1);
169275
169394
  // packages/omo-opencode/src/cli/run/opencode-binary-resolver.ts
169276
169395
  init_bun_which_shim();
169277
169396
  init_spawn_with_windows_hide();
169278
- import { delimiter as delimiter2, dirname as dirname12, posix as posix3, win32 as win324 } from "path";
169397
+ import { delimiter as delimiter2, dirname as dirname13, posix as posix3, win32 as win324 } from "path";
169279
169398
  var OPENCODE_COMMANDS = ["opencode", "opencode-desktop"];
169280
169399
  var WINDOWS_SUFFIXES = ["", ".exe", ".cmd", ".bat", ".ps1"];
169281
169400
  function getCommandCandidates(platform) {
@@ -169333,7 +169452,7 @@ async function findWorkingOpencodeBinary(pathEnv = process.env.PATH, probe2 = ca
169333
169452
  return null;
169334
169453
  }
169335
169454
  function buildPathWithBinaryFirst(pathEnv, binaryPath) {
169336
- const preferredDir = dirname12(binaryPath);
169455
+ const preferredDir = dirname13(binaryPath);
169337
169456
  const existing = (pathEnv ?? "").split(delimiter2).filter((entry) => entry.length > 0 && entry !== preferredDir);
169338
169457
  return [preferredDir, ...existing].join(delimiter2);
169339
169458
  }
@@ -169779,9 +169898,9 @@ function readCurrentTopLevelTask(planPath) {
169779
169898
  }
169780
169899
  // packages/boulder-state/src/storage/path.ts
169781
169900
  import { existsSync as existsSync33 } from "fs";
169782
- import { isAbsolute as isAbsolute4, join as join30, relative as relative3, resolve as resolve8 } from "path";
169901
+ import { isAbsolute as isAbsolute4, join as join31, relative as relative3, resolve as resolve8 } from "path";
169783
169902
  function getBoulderFilePath(directory) {
169784
- return join30(directory, BOULDER_DIR, BOULDER_FILE);
169903
+ return join31(directory, BOULDER_DIR, BOULDER_FILE);
169785
169904
  }
169786
169905
  function resolveTrackedPath(baseDirectory, trackedPath) {
169787
169906
  return isAbsolute4(trackedPath) ? resolve8(trackedPath) : resolve8(baseDirectory, trackedPath);
@@ -170008,9 +170127,9 @@ init_state();
170008
170127
  var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
170009
170128
  // packages/omo-opencode/src/features/run-continuation-state/storage.ts
170010
170129
  import { existsSync as existsSync36, mkdirSync as mkdirSync12, readFileSync as readFileSync23, rmSync as rmSync2, writeFileSync as writeFileSync9 } from "fs";
170011
- import { join as join31 } from "path";
170130
+ import { join as join32 } from "path";
170012
170131
  function getMarkerPath(directory, sessionID) {
170013
- return join31(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
170132
+ return join32(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
170014
170133
  }
170015
170134
  function readContinuationMarker(directory, sessionID) {
170016
170135
  const markerPath = getMarkerPath(directory, sessionID);
@@ -170083,7 +170202,7 @@ async function isSessionInBoulderLineage(input) {
170083
170202
  init_shared();
170084
170203
  init_compaction_marker();
170085
170204
  import { readFileSync as readFileSync24, readdirSync as readdirSync6 } from "fs";
170086
- import { join as join32 } from "path";
170205
+ import { join as join33 } from "path";
170087
170206
  var defaultSessionLastAgentDeps = {
170088
170207
  getMessageDir,
170089
170208
  isSqliteBackend,
@@ -170143,7 +170262,7 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
170143
170262
  try {
170144
170263
  const messages = readdirSync6(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
170145
170264
  try {
170146
- const content = readFileSync24(join32(messageDir, fileName), "utf-8");
170265
+ const content = readFileSync24(join33(messageDir, fileName), "utf-8");
170147
170266
  const parsed = JSON.parse(content);
170148
170267
  return {
170149
170268
  fileName,
@@ -170187,7 +170306,7 @@ init_agent_display_names();
170187
170306
  // packages/omo-opencode/src/hooks/ralph-loop/storage.ts
170188
170307
  init_frontmatter2();
170189
170308
  import { existsSync as existsSync37, readFileSync as readFileSync25, writeFileSync as writeFileSync10, unlinkSync as unlinkSync6, mkdirSync as mkdirSync13 } from "fs";
170190
- import { dirname as dirname13, join as join33 } from "path";
170309
+ import { dirname as dirname14, join as join34 } from "path";
170191
170310
 
170192
170311
  // packages/omo-opencode/src/hooks/ralph-loop/constants.ts
170193
170312
  var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
@@ -170196,7 +170315,7 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
170196
170315
 
170197
170316
  // packages/omo-opencode/src/hooks/ralph-loop/storage.ts
170198
170317
  function getStateFilePath(directory, customPath) {
170199
- return customPath ? join33(directory, customPath) : join33(directory, DEFAULT_STATE_FILE);
170318
+ return customPath ? join34(directory, customPath) : join34(directory, DEFAULT_STATE_FILE);
170200
170319
  }
170201
170320
  function readState(directory, customPath) {
170202
170321
  const filePath = getStateFilePath(directory, customPath);
@@ -170780,21 +170899,21 @@ function createTimestampedStdoutController(stdout2 = process.stdout) {
170780
170899
  init_atomic_write();
170781
170900
  init_xdg_data_dir();
170782
170901
  import { existsSync as existsSync38, mkdirSync as mkdirSync14, readFileSync as readFileSync26 } from "fs";
170783
- import { basename as basename6, join as join34 } from "path";
170902
+ import { basename as basename7, join as join35 } from "path";
170784
170903
  var POSTHOG_ACTIVITY_STATE_FILE = "posthog-activity.json";
170785
170904
  function resolveTelemetryStateDir(product, options = {}) {
170786
170905
  const dataDir = resolveXdgDataDir(product.cacheDirName, {
170787
170906
  env: options.env,
170788
170907
  osProvider: options.osProvider
170789
170908
  });
170790
- const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join34(options.env.XDG_DATA_HOME, product.cacheDirName);
170791
- if (dataDir === xdgStateDir || xdgStateDir === undefined && basename6(dataDir) === product.cacheDirName) {
170909
+ const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join35(options.env.XDG_DATA_HOME, product.cacheDirName);
170910
+ if (dataDir === xdgStateDir || xdgStateDir === undefined && basename7(dataDir) === product.cacheDirName) {
170792
170911
  return dataDir;
170793
170912
  }
170794
- return join34(dataDir, product.cacheDirName);
170913
+ return join35(dataDir, product.cacheDirName);
170795
170914
  }
170796
170915
  function getTelemetryActivityStateFilePath(stateDir) {
170797
- return join34(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
170916
+ return join35(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
170798
170917
  }
170799
170918
  function getDailyActiveCaptureState(input) {
170800
170919
  const state2 = readPostHogActivityState(input.stateDir, input.diagnostics);
@@ -170907,7 +171026,7 @@ function getTelemetryDistinctId(machineIdPrefix, osProvider = getDefaultTelemetr
170907
171026
  }
170908
171027
 
170909
171028
  // node_modules/.bun/posthog-node@5.45.2/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
170910
- import { dirname as dirname14, posix as posix4, sep } from "path";
171029
+ import { dirname as dirname15, posix as posix4, sep } from "path";
170911
171030
  function createModulerModifier() {
170912
171031
  const getModuleFromFileName = createGetModuleFromFilename();
170913
171032
  return async (frames) => {
@@ -170916,7 +171035,7 @@ function createModulerModifier() {
170916
171035
  return frames;
170917
171036
  };
170918
171037
  }
170919
- function createGetModuleFromFilename(basePath = process.argv[1] ? dirname14(process.argv[1]) : process.cwd(), isWindows = sep === "\\") {
171038
+ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname15(process.argv[1]) : process.cwd(), isWindows = sep === "\\") {
170920
171039
  const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
170921
171040
  return (filename) => {
170922
171041
  if (!filename)
@@ -177954,7 +178073,7 @@ init_extract_semver();
177954
178073
  init_bun_which_shim();
177955
178074
  import { existsSync as existsSync46, accessSync as accessSync4, constants as constants8 } from "fs";
177956
178075
  import { homedir as homedir12 } from "os";
177957
- import { join as join41 } from "path";
178076
+ import { join as join42 } from "path";
177958
178077
 
177959
178078
  // packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
177960
178079
  init_spawn_with_windows_hide();
@@ -178047,17 +178166,17 @@ function getDesktopAppPaths(platform) {
178047
178166
  case "darwin":
178048
178167
  return [
178049
178168
  "/Applications/OpenCode.app/Contents/MacOS/OpenCode",
178050
- join41(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
178169
+ join42(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
178051
178170
  ];
178052
178171
  case "win32": {
178053
178172
  const programFiles = process.env.ProgramFiles;
178054
178173
  const localAppData = process.env.LOCALAPPDATA;
178055
178174
  const paths2 = [];
178056
178175
  if (programFiles) {
178057
- paths2.push(join41(programFiles, "OpenCode", "OpenCode.exe"));
178176
+ paths2.push(join42(programFiles, "OpenCode", "OpenCode.exe"));
178058
178177
  }
178059
178178
  if (localAppData) {
178060
- paths2.push(join41(localAppData, "OpenCode", "OpenCode.exe"));
178179
+ paths2.push(join42(localAppData, "OpenCode", "OpenCode.exe"));
178061
178180
  }
178062
178181
  return paths2;
178063
178182
  }
@@ -178065,8 +178184,8 @@ function getDesktopAppPaths(platform) {
178065
178184
  return [
178066
178185
  "/usr/bin/opencode",
178067
178186
  "/usr/lib/opencode/opencode",
178068
- join41(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
178069
- join41(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
178187
+ join42(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
178188
+ join42(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
178070
178189
  ];
178071
178190
  default:
178072
178191
  return [];
@@ -178098,7 +178217,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
178098
178217
  const candidates = getCommandCandidates2(platform);
178099
178218
  for (const entry of pathEnv.split(delimiter3).filter(Boolean)) {
178100
178219
  for (const command of candidates) {
178101
- const fullPath = join41(entry, command);
178220
+ const fullPath = join42(entry, command);
178102
178221
  if (checkExists(fullPath) && isExecutable2(fullPath)) {
178103
178222
  return { binary: command, path: fullPath };
178104
178223
  }
@@ -178242,21 +178361,21 @@ init_shared();
178242
178361
  import { existsSync as existsSync48, readFileSync as readFileSync35, readdirSync as readdirSync8 } from "fs";
178243
178362
  import { createRequire as createRequire2 } from "module";
178244
178363
  import { homedir as homedir13 } from "os";
178245
- import { join as join42 } from "path";
178364
+ import { join as join43 } from "path";
178246
178365
  import { fileURLToPath as fileURLToPath5 } from "url";
178247
178366
  function getPlatformDefaultCacheDir(platform = process.platform) {
178248
178367
  if (platform === "darwin")
178249
- return join42(homedir13(), "Library", "Caches");
178368
+ return join43(homedir13(), "Library", "Caches");
178250
178369
  if (platform === "win32")
178251
- return process.env.LOCALAPPDATA ?? join42(homedir13(), "AppData", "Local");
178252
- return join42(homedir13(), ".cache");
178370
+ return process.env.LOCALAPPDATA ?? join43(homedir13(), "AppData", "Local");
178371
+ return join43(homedir13(), ".cache");
178253
178372
  }
178254
178373
  function resolveOpenCodeCacheDir() {
178255
178374
  const xdgCacheHome = process.env.XDG_CACHE_HOME;
178256
178375
  if (xdgCacheHome)
178257
- return join42(xdgCacheHome, "opencode");
178376
+ return join43(xdgCacheHome, "opencode");
178258
178377
  const fromShared = getOpenCodeCacheDir();
178259
- const platformDefault = join42(getPlatformDefaultCacheDir(), "opencode");
178378
+ const platformDefault = join43(getPlatformDefaultCacheDir(), "opencode");
178260
178379
  if (existsSync48(fromShared) || !existsSync48(platformDefault))
178261
178380
  return fromShared;
178262
178381
  return platformDefault;
@@ -178288,11 +178407,11 @@ function normalizeVersion(value) {
178288
178407
  function createPackageCandidates(rootDir) {
178289
178408
  return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
178290
178409
  packageName,
178291
- installedPackagePath: join42(rootDir, "node_modules", packageName, "package.json")
178410
+ installedPackagePath: join43(rootDir, "node_modules", packageName, "package.json")
178292
178411
  }));
178293
178412
  }
178294
178413
  function createTaggedInstallCandidates(rootDir) {
178295
- const packagesDir = join42(rootDir, "packages");
178414
+ const packagesDir = join43(rootDir, "packages");
178296
178415
  if (!existsSync48(packagesDir))
178297
178416
  return [];
178298
178417
  const candidates = [];
@@ -178300,14 +178419,14 @@ function createTaggedInstallCandidates(rootDir) {
178300
178419
  const packageName = ACCEPTED_PACKAGE_NAMES.find((name2) => entryName.startsWith(`${name2}@`));
178301
178420
  if (packageName === undefined)
178302
178421
  continue;
178303
- const installDir = join42(packagesDir, entryName);
178422
+ const installDir = join43(packagesDir, entryName);
178304
178423
  candidates.push({
178305
178424
  cacheDir: installDir,
178306
- cachePackagePath: join42(installDir, "package.json"),
178425
+ cachePackagePath: join43(installDir, "package.json"),
178307
178426
  packageCandidates: [
178308
178427
  {
178309
178428
  packageName,
178310
- installedPackagePath: join42(installDir, "node_modules", packageName, "package.json")
178429
+ installedPackagePath: join43(installDir, "node_modules", packageName, "package.json")
178311
178430
  }
178312
178431
  ]
178313
178432
  });
@@ -178352,13 +178471,13 @@ function getLoadedPluginVersion() {
178352
178471
  const candidates = [
178353
178472
  {
178354
178473
  cacheDir: configDir,
178355
- cachePackagePath: join42(configDir, "package.json"),
178474
+ cachePackagePath: join43(configDir, "package.json"),
178356
178475
  packageCandidates: createPackageCandidates(configDir)
178357
178476
  },
178358
178477
  ...createTaggedInstallCandidates(configDir),
178359
178478
  {
178360
178479
  cacheDir,
178361
- cachePackagePath: join42(cacheDir, "package.json"),
178480
+ cachePackagePath: join43(cacheDir, "package.json"),
178362
178481
  packageCandidates: createPackageCandidates(cacheDir)
178363
178482
  },
178364
178483
  ...createTaggedInstallCandidates(cacheDir)
@@ -178551,7 +178670,7 @@ async function checkSystem(deps = defaultDeps6) {
178551
178670
  init_src();
178552
178671
  import { readFileSync as readFileSync37 } from "fs";
178553
178672
  import { homedir as homedir14 } from "os";
178554
- import { dirname as dirname19, relative as relative5 } from "path";
178673
+ import { dirname as dirname20, relative as relative5 } from "path";
178555
178674
  init_shared();
178556
178675
  init_plugin_identity();
178557
178676
  function resolveHomeDirectory2() {
@@ -178575,7 +178694,7 @@ function discoverProjectLayersNearestFirst(directory) {
178575
178694
  const stopDirectory = containsPath(homeDirectory, directory) ? homeDirectory : directory;
178576
178695
  return findProjectOpencodePluginConfigFiles(directory, stopDirectory).map((configPath) => ({
178577
178696
  path: configPath,
178578
- configDir: dirname19(configPath)
178697
+ configDir: dirname20(configPath)
178579
178698
  }));
178580
178699
  }
178581
178700
  function shortPath(configPath) {
@@ -178599,7 +178718,7 @@ function parseLayerConfig(configPath) {
178599
178718
  if (!isPlainRecord(rawConfig)) {
178600
178719
  return {
178601
178720
  path: configPath,
178602
- configDir: dirname19(configPath),
178721
+ configDir: dirname20(configPath),
178603
178722
  config: null,
178604
178723
  messages: [`${shortPath(configPath)}: <root>: Expected object`]
178605
178724
  };
@@ -178607,7 +178726,7 @@ function parseLayerConfig(configPath) {
178607
178726
  const result = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
178608
178727
  return {
178609
178728
  path: configPath,
178610
- configDir: dirname19(configPath),
178729
+ configDir: dirname20(configPath),
178611
178730
  config: result.success ? result.data : parseConfigPartially(rawConfig),
178612
178731
  messages: schemaMessages(configPath, rawConfig)
178613
178732
  };
@@ -178617,7 +178736,7 @@ function parseLayerConfig(configPath) {
178617
178736
  }
178618
178737
  return {
178619
178738
  path: configPath,
178620
- configDir: dirname19(configPath),
178739
+ configDir: dirname20(configPath),
178621
178740
  config: null,
178622
178741
  messages: [`${shortPath(configPath)}: ${error51.message}`]
178623
178742
  };
@@ -178668,18 +178787,18 @@ init_constants5();
178668
178787
  init_shared();
178669
178788
  import { existsSync as existsSync50, readFileSync as readFileSync38 } from "fs";
178670
178789
  import { homedir as homedir15 } from "os";
178671
- import { join as join43 } from "path";
178790
+ import { join as join44 } from "path";
178672
178791
  function getUserConfigDir2() {
178673
178792
  const xdgConfig = process.env.XDG_CONFIG_HOME;
178674
178793
  if (xdgConfig)
178675
- return join43(xdgConfig, "opencode");
178676
- return join43(homedir15(), ".config", "opencode");
178794
+ return join44(xdgConfig, "opencode");
178795
+ return join44(homedir15(), ".config", "opencode");
178677
178796
  }
178678
178797
  function loadCustomProviderNames() {
178679
178798
  const configDir = getUserConfigDir2();
178680
178799
  const candidatePaths = [
178681
- join43(configDir, "opencode.json"),
178682
- join43(configDir, "opencode.jsonc")
178800
+ join44(configDir, "opencode.json"),
178801
+ join44(configDir, "opencode.jsonc")
178683
178802
  ];
178684
178803
  for (const configPath of candidatePaths) {
178685
178804
  if (!existsSync50(configPath))
@@ -178700,7 +178819,7 @@ function loadCustomProviderNames() {
178700
178819
  return [];
178701
178820
  }
178702
178821
  function loadAvailableModelsFromCache() {
178703
- const cacheFile = join43(getOpenCodeCacheDir(), "models.json");
178822
+ const cacheFile = join44(getOpenCodeCacheDir(), "models.json");
178704
178823
  const customProviders = loadCustomProviderNames();
178705
178824
  if (!existsSync50(cacheFile)) {
178706
178825
  if (customProviders.length > 0) {
@@ -178738,8 +178857,8 @@ init_constants5();
178738
178857
  init_shared();
178739
178858
  init_plugin_identity();
178740
178859
  import { readFileSync as readFileSync39 } from "fs";
178741
- import { join as join44 } from "path";
178742
- var PROJECT_CONFIG_DIR = join44(process.cwd(), ".opencode");
178860
+ import { join as join45 } from "path";
178861
+ var PROJECT_CONFIG_DIR = join45(process.cwd(), ".opencode");
178743
178862
  function loadOmoConfig() {
178744
178863
  const projectDetected = detectPluginConfigFile(PROJECT_CONFIG_DIR, {
178745
178864
  basenames: [CONFIG_BASENAME],
@@ -178777,7 +178896,7 @@ function loadOmoConfig() {
178777
178896
 
178778
178897
  // packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
178779
178898
  init_shared();
178780
- import { join as join45 } from "path";
178899
+ import { join as join46 } from "path";
178781
178900
 
178782
178901
  // packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
178783
178902
  function formatModelWithVariant(model, variant) {
@@ -178819,7 +178938,7 @@ function formatCapabilityResolutionLabel(mode) {
178819
178938
  }
178820
178939
  function buildModelResolutionDetails(options) {
178821
178940
  const details = [];
178822
- const cacheFile = join45(getOpenCodeCacheDir(), "models.json");
178941
+ const cacheFile = join46(getOpenCodeCacheDir(), "models.json");
178823
178942
  details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
178824
178943
  details.push("");
178825
178944
  if (options.available.cacheExists) {
@@ -179098,25 +179217,25 @@ init_src();
179098
179217
  import { existsSync as existsSync51 } from "fs";
179099
179218
  import { createRequire as createRequire3 } from "module";
179100
179219
  import { homedir as homedir17 } from "os";
179101
- import { dirname as dirname20, join as join47 } from "path";
179220
+ import { dirname as dirname21, join as join48 } from "path";
179102
179221
 
179103
179222
  // packages/omo-opencode/src/hooks/comment-checker/downloader.ts
179104
- import { join as join46 } from "path";
179223
+ import { join as join47 } from "path";
179105
179224
  import { homedir as homedir16, tmpdir as tmpdir3 } from "os";
179106
179225
  init_binary_downloader();
179107
179226
  init_logger2();
179108
179227
  init_plugin_identity();
179109
179228
  var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
179110
- var DEBUG_FILE = join46(tmpdir3(), "comment-checker-debug.log");
179229
+ var DEBUG_FILE = join47(tmpdir3(), "comment-checker-debug.log");
179111
179230
  function getCacheDir2() {
179112
179231
  if (process.platform === "win32") {
179113
179232
  const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
179114
- const base2 = localAppData || join46(homedir16(), "AppData", "Local");
179115
- return join46(base2, CACHE_DIR_NAME, "bin");
179233
+ const base2 = localAppData || join47(homedir16(), "AppData", "Local");
179234
+ return join47(base2, CACHE_DIR_NAME, "bin");
179116
179235
  }
179117
179236
  const xdgCache = process.env.XDG_CACHE_HOME;
179118
- const base = xdgCache || join46(homedir16(), ".cache");
179119
- return join46(base, CACHE_DIR_NAME, "bin");
179237
+ const base = xdgCache || join47(homedir16(), ".cache");
179238
+ return join47(base, CACHE_DIR_NAME, "bin");
179120
179239
  }
179121
179240
  function getBinaryName() {
179122
179241
  return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
@@ -179166,7 +179285,7 @@ async function getBinaryVersion(binary2) {
179166
179285
  }
179167
179286
  }
179168
179287
  async function checkAstGrepCli() {
179169
- const runtimeDir = astGrepRuntimeDir(join47(homedir17(), ".omo"));
179288
+ const runtimeDir = astGrepRuntimeDir(join48(homedir17(), ".omo"));
179170
179289
  const sgPath = findSgBinarySync({ runtimeDir });
179171
179290
  if (sgPath === null) {
179172
179291
  return {
@@ -179195,11 +179314,11 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
179195
179314
  const binaryName = process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
179196
179315
  const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
179197
179316
  try {
179198
- const packageDir = baseDirOverride ?? dirname20(resolvePackageJsonPath());
179199
- const vendorPath = join47(packageDir, "vendor", platformKey, binaryName);
179317
+ const packageDir = baseDirOverride ?? dirname21(resolvePackageJsonPath());
179318
+ const vendorPath = join48(packageDir, "vendor", platformKey, binaryName);
179200
179319
  if (existsSync51(vendorPath))
179201
179320
  return vendorPath;
179202
- const binPath = join47(packageDir, "bin", binaryName);
179321
+ const binPath = join48(packageDir, "bin", binaryName);
179203
179322
  if (existsSync51(binPath))
179204
179323
  return binPath;
179205
179324
  } catch (error51) {
@@ -179345,13 +179464,13 @@ async function getGhCliInfo(dependencies = {}) {
179345
179464
 
179346
179465
  // packages/omo-opencode/src/cli/doctor/checks/tools-lsp.ts
179347
179466
  import { readFileSync as readFileSync41 } from "fs";
179348
- import { join as join48 } from "path";
179467
+ import { join as join49 } from "path";
179349
179468
 
179350
179469
  // packages/omo-opencode/src/mcp/lsp.ts
179351
179470
  init_zod();
179352
179471
  init_opencode_config_dir();
179353
179472
  import { existsSync as existsSync52, readFileSync as readFileSync40 } from "fs";
179354
- import { delimiter as delimiter3, dirname as dirname21, resolve as resolve10 } from "path";
179473
+ import { delimiter as delimiter3, dirname as dirname22, resolve as resolve10 } from "path";
179355
179474
  import { fileURLToPath as fileURLToPath6 } from "url";
179356
179475
 
179357
179476
  // packages/omo-opencode/src/mcp/cli-suffix.ts
@@ -179364,7 +179483,7 @@ function hasCliSuffix(candidatePath, suffix) {
179364
179483
 
179365
179484
  // packages/omo-opencode/src/mcp/runtime-executable.ts
179366
179485
  init_bun_which_shim();
179367
- import { basename as basename7 } from "path";
179486
+ import { basename as basename8 } from "path";
179368
179487
  var NODE_EXECUTABLE_NAMES = new Set(["node", "node.exe"]);
179369
179488
  function isUnsafeCommandName2(commandName) {
179370
179489
  if (commandName.length === 0)
@@ -179380,7 +179499,7 @@ function isUnsafeCommandName2(commandName) {
179380
179499
  return false;
179381
179500
  }
179382
179501
  function isNodeExecPath(execPath) {
179383
- return NODE_EXECUTABLE_NAMES.has(basename7(execPath).toLowerCase());
179502
+ return NODE_EXECUTABLE_NAMES.has(basename8(execPath).toLowerCase());
179384
179503
  }
179385
179504
  function resolveRuntimeExecutable(commandName, options = {}) {
179386
179505
  if (isUnsafeCommandName2(commandName)) {
@@ -179482,7 +179601,7 @@ var LSP_BOOTSTRAP_SCRIPT = [
179482
179601
  ].join(";");
179483
179602
  function getModuleDirectory(moduleUrl) {
179484
179603
  try {
179485
- return dirname21(fileURLToPath6(moduleUrl));
179604
+ return dirname22(fileURLToPath6(moduleUrl));
179486
179605
  } catch (error51) {
179487
179606
  if (!(error51 instanceof Error))
179488
179607
  throw error51;
@@ -179582,7 +179701,7 @@ function readOmoConfig(configDirectory) {
179582
179701
  }
179583
179702
  function isLspMcpDisabled(options) {
179584
179703
  const userConfigDirectory = options.configDirectory ?? getOpenCodeConfigDir({ binary: "opencode" });
179585
- const projectConfigDirectory = join48(options.cwd ?? process.cwd(), ".opencode");
179704
+ const projectConfigDirectory = join49(options.cwd ?? process.cwd(), ".opencode");
179586
179705
  const userConfig = readOmoConfig(userConfigDirectory);
179587
179706
  const projectConfig = readOmoConfig(projectConfigDirectory);
179588
179707
  const disabledMcps = new Set([
@@ -179603,13 +179722,13 @@ function getInstalledLspServers(options = {}) {
179603
179722
  init_shared();
179604
179723
  import { existsSync as existsSync53, readFileSync as readFileSync42 } from "fs";
179605
179724
  import { homedir as homedir18 } from "os";
179606
- import { join as join49 } from "path";
179725
+ import { join as join50 } from "path";
179607
179726
  var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
179608
179727
  function getMcpConfigPaths() {
179609
179728
  return [
179610
- join49(homedir18(), ".claude", ".mcp.json"),
179611
- join49(process.cwd(), ".mcp.json"),
179612
- join49(process.cwd(), ".claude", ".mcp.json")
179729
+ join50(homedir18(), ".claude", ".mcp.json"),
179730
+ join50(process.cwd(), ".mcp.json"),
179731
+ join50(process.cwd(), ".claude", ".mcp.json")
179613
179732
  ];
179614
179733
  }
179615
179734
  function loadUserMcpConfig() {
@@ -180323,12 +180442,12 @@ import {
180323
180442
  unlinkSync as unlinkSync9,
180324
180443
  writeFileSync as writeFileSync14
180325
180444
  } from "fs";
180326
- import { basename as basename8, dirname as dirname22, join as join52 } from "path";
180445
+ import { basename as basename9, dirname as dirname23, join as join53 } from "path";
180327
180446
 
180328
180447
  // packages/mcp-client-core/src/config-dir.ts
180329
180448
  import { existsSync as existsSync55, realpathSync as realpathSync7 } from "fs";
180330
180449
  import { homedir as homedir20 } from "os";
180331
- import { join as join50, resolve as resolve11 } from "path";
180450
+ import { join as join51, resolve as resolve11 } from "path";
180332
180451
  function resolveConfigPath2(pathValue) {
180333
180452
  const resolvedPath = resolve11(pathValue);
180334
180453
  if (!existsSync55(resolvedPath))
@@ -180346,13 +180465,13 @@ function getOpenCodeCliConfigDir(env2 = process.env) {
180346
180465
  if (customConfigDir) {
180347
180466
  return resolveConfigPath2(customConfigDir);
180348
180467
  }
180349
- const xdgConfigDir = env2["XDG_CONFIG_HOME"]?.trim() || join50(homedir20(), ".config");
180350
- return resolveConfigPath2(join50(xdgConfigDir, "opencode"));
180468
+ const xdgConfigDir = env2["XDG_CONFIG_HOME"]?.trim() || join51(homedir20(), ".config");
180469
+ return resolveConfigPath2(join51(xdgConfigDir, "opencode"));
180351
180470
  }
180352
180471
 
180353
180472
  // packages/mcp-client-core/src/mcp-oauth/storage-index.ts
180354
180473
  import { chmodSync as chmodSync5, existsSync as existsSync56, readFileSync as readFileSync45, renameSync as renameSync6, writeFileSync as writeFileSync13 } from "fs";
180355
- import { join as join51 } from "path";
180474
+ import { join as join52 } from "path";
180356
180475
  var INDEX_FILE_NAME = "index.json";
180357
180476
  function isTokenIndex(value) {
180358
180477
  if (typeof value !== "object" || value === null || Array.isArray(value))
@@ -180360,7 +180479,7 @@ function isTokenIndex(value) {
180360
180479
  return Object.values(value).every((entry) => typeof entry === "string");
180361
180480
  }
180362
180481
  function getIndexPath(storageDir) {
180363
- return join51(storageDir, INDEX_FILE_NAME);
180482
+ return join52(storageDir, INDEX_FILE_NAME);
180364
180483
  }
180365
180484
  function readTokenIndex(storageDir) {
180366
180485
  const indexPath = getIndexPath(storageDir);
@@ -180404,16 +180523,16 @@ function deleteTokenIndexEntry(storageDir, hash2) {
180404
180523
  var STORAGE_DIR_NAME = "mcp-oauth";
180405
180524
  var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
180406
180525
  function getMcpOauthStorageDir() {
180407
- return join52(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
180526
+ return join53(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
180408
180527
  }
180409
180528
  function getMcpOauthServerHash(serverHost, resource) {
180410
180529
  return createHash3("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
180411
180530
  }
180412
180531
  function getMcpOauthStoragePath(serverHost, resource) {
180413
- return join52(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
180532
+ return join53(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
180414
180533
  }
180415
180534
  function getLegacyStoragePath() {
180416
- return join52(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
180535
+ return join53(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
180417
180536
  }
180418
180537
  function normalizeHost2(serverHost) {
180419
180538
  let host = serverHost.trim();
@@ -180507,7 +180626,7 @@ function readLegacyStore() {
180507
180626
  }
180508
180627
  function writeTokenFile(filePath, token) {
180509
180628
  try {
180510
- const dir = dirname22(filePath);
180629
+ const dir = dirname23(filePath);
180511
180630
  if (!existsSync57(dir)) {
180512
180631
  mkdirSync16(dir, { recursive: true });
180513
180632
  }
@@ -180592,7 +180711,7 @@ function listTokensByHost(serverHost) {
180592
180711
  for (const [hash2, indexedKey] of Object.entries(index)) {
180593
180712
  if (!indexedKey.startsWith(prefix))
180594
180713
  continue;
180595
- const indexedToken = readTokenFile(join52(getMcpOauthStorageDir(), `${hash2}.json`));
180714
+ const indexedToken = readTokenFile(join53(getMcpOauthStorageDir(), `${hash2}.json`));
180596
180715
  if (indexedToken)
180597
180716
  result[indexedKey] = indexedToken;
180598
180717
  }
@@ -180607,8 +180726,8 @@ function listAllTokens() {
180607
180726
  for (const entry of readdirSync9(dir, { withFileTypes: true })) {
180608
180727
  if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
180609
180728
  continue;
180610
- const token = readTokenFile(join52(dir, entry.name));
180611
- const hash2 = basename8(entry.name, ".json");
180729
+ const token = readTokenFile(join53(dir, entry.name));
180730
+ const hash2 = basename9(entry.name, ".json");
180612
180731
  if (token)
180613
180732
  result[index[hash2] ?? hash2] = token;
180614
180733
  }
@@ -181304,7 +181423,7 @@ function createEmbeddingPort() {
181304
181423
  var import_picomatch = __toESM(require_picomatch2(), 1);
181305
181424
  import { createHash as createHash5 } from "crypto";
181306
181425
  import { readdirSync as readdirSync10, readFileSync as readFileSync48, statSync as statSync7, existsSync as existsSync59 } from "fs";
181307
- import { join as join53, relative as relative6, extname as extname3 } from "path";
181426
+ import { join as join54, relative as relative6, extname as extname3 } from "path";
181308
181427
  var EXT_TO_LANG = {
181309
181428
  ts: "typescript",
181310
181429
  tsx: "typescript",
@@ -181358,7 +181477,7 @@ function detectLanguage(filePath) {
181358
181477
  return EXT_TO_LANG[ext] ?? "text";
181359
181478
  }
181360
181479
  function loadGitignore(rootDir, fs18) {
181361
- const gitignorePath = join53(rootDir, ".gitignore");
181480
+ const gitignorePath = join54(rootDir, ".gitignore");
181362
181481
  if (!fs18.exists(gitignorePath))
181363
181482
  return [];
181364
181483
  const content = fs18.readFile(gitignorePath);
@@ -181449,7 +181568,7 @@ function createCodebaseScanner(options = {}) {
181449
181568
  return;
181450
181569
  }
181451
181570
  for (const entry of entries) {
181452
- const fullPath = join53(dir, entry);
181571
+ const fullPath = join54(dir, entry);
181453
181572
  let stat;
181454
181573
  try {
181455
181574
  stat = fs18.stat(fullPath);
@@ -181725,13 +181844,13 @@ function formatSearchResults(result) {
181725
181844
 
181726
181845
  // packages/learning-loop/src/improvement.ts
181727
181846
  import { existsSync as existsSync60, mkdirSync as mkdirSync18, readFileSync as readFileSync49, writeFileSync as writeFileSync16 } from "fs";
181728
- import { join as join54, basename as basename10 } from "path";
181847
+ import { join as join55, basename as basename11 } from "path";
181729
181848
  function createImprovementStore(improvementsDir) {
181730
181849
  if (!existsSync60(improvementsDir)) {
181731
181850
  mkdirSync18(improvementsDir, { recursive: true });
181732
181851
  }
181733
181852
  function save(improvement) {
181734
- const filePath = join54(improvementsDir, `${improvement.id}.json`);
181853
+ const filePath = join55(improvementsDir, `${improvement.id}.json`);
181735
181854
  writeFileSync16(filePath, JSON.stringify(improvement, null, 2), "utf-8");
181736
181855
  }
181737
181856
  function list() {
@@ -181746,10 +181865,10 @@ function createImprovementStore(improvementsDir) {
181746
181865
  return [];
181747
181866
  }
181748
181867
  files.sort().reverse();
181749
- return files.map((f2) => get(basename10(f2, ".json"))).filter((i3) => i3 !== null);
181868
+ return files.map((f2) => get(basename11(f2, ".json"))).filter((i3) => i3 !== null);
181750
181869
  }
181751
181870
  function get(id) {
181752
- const filePath = join54(improvementsDir, `${id}.json`);
181871
+ const filePath = join55(improvementsDir, `${id}.json`);
181753
181872
  try {
181754
181873
  const raw = readFileSync49(filePath, "utf-8");
181755
181874
  return JSON.parse(raw);
@@ -182557,25 +182676,25 @@ async function refreshModelCapabilities(options, deps = {}) {
182557
182676
  // packages/skills-loader-core/src/features/opencode-skill-loader/loader.ts
182558
182677
  init_src();
182559
182678
  init_shared_skills();
182560
- import { join as join63 } from "path";
182679
+ import { join as join64 } from "path";
182561
182680
 
182562
182681
  // packages/skills-loader-core/src/shared/claude-config-dir.ts
182563
182682
  init_src();
182564
- import { join as join57 } from "path";
182683
+ import { join as join58 } from "path";
182565
182684
  function getClaudeConfigDir() {
182566
182685
  const envConfigDir = process.env.CLAUDE_CONFIG_DIR;
182567
182686
  if (envConfigDir) {
182568
182687
  return envConfigDir;
182569
182688
  }
182570
- return join57(getHomeDirectory(), ".claude");
182689
+ return join58(getHomeDirectory(), ".claude");
182571
182690
  }
182572
182691
  // packages/skills-loader-core/src/shared/opencode-command-dirs.ts
182573
- import { basename as basename11, dirname as dirname23, join as join59 } from "path";
182692
+ import { basename as basename12, dirname as dirname24, join as join60 } from "path";
182574
182693
 
182575
182694
  // packages/skills-loader-core/src/shared/opencode-config-dir.ts
182576
182695
  import { existsSync as existsSync64, realpathSync as realpathSync8 } from "fs";
182577
182696
  import { homedir as homedir22 } from "os";
182578
- import { join as join58, posix as posix5, resolve as resolve12, win32 as win325 } from "path";
182697
+ import { join as join59, posix as posix5, resolve as resolve12, win32 as win325 } from "path";
182579
182698
 
182580
182699
  // packages/skills-loader-core/src/shared/plugin-identity.ts
182581
182700
  init_src();
@@ -182608,15 +182727,15 @@ function getTauriConfigDir2(identifier) {
182608
182727
  const platform2 = process.platform;
182609
182728
  switch (platform2) {
182610
182729
  case "darwin":
182611
- return join58(homedir22(), "Library", "Application Support", identifier);
182730
+ return join59(homedir22(), "Library", "Application Support", identifier);
182612
182731
  case "win32": {
182613
- const appData = process.env.APPDATA || join58(homedir22(), "AppData", "Roaming");
182732
+ const appData = process.env.APPDATA || join59(homedir22(), "AppData", "Roaming");
182614
182733
  return win325.join(appData, identifier);
182615
182734
  }
182616
182735
  case "linux":
182617
182736
  default: {
182618
- const xdgConfig = process.env.XDG_CONFIG_HOME || join58(homedir22(), ".config");
182619
- return join58(xdgConfig, identifier);
182737
+ const xdgConfig = process.env.XDG_CONFIG_HOME || join59(homedir22(), ".config");
182738
+ return join59(xdgConfig, identifier);
182620
182739
  }
182621
182740
  }
182622
182741
  }
@@ -182659,8 +182778,8 @@ function getWslLinuxHomeDir2(windowsConfigRoot) {
182659
182778
  function getCliDefaultConfigDir2() {
182660
182779
  const envXdgConfig = process.env.XDG_CONFIG_HOME?.trim();
182661
182780
  const shouldIgnoreWindowsXdg = envXdgConfig !== undefined && envXdgConfig.length > 0 && isWslEnvironment2() && isWindowsUserConfigRoot2(envXdgConfig);
182662
- const xdgConfig = shouldIgnoreWindowsXdg ? posix5.join(getWslLinuxHomeDir2(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join58(homedir22(), ".config");
182663
- const configDir = isWslEnvironment2() ? posix5.join(xdgConfig, "opencode") : join58(xdgConfig, "opencode");
182781
+ const xdgConfig = shouldIgnoreWindowsXdg ? posix5.join(getWslLinuxHomeDir2(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join59(homedir22(), ".config");
182782
+ const configDir = isWslEnvironment2() ? posix5.join(xdgConfig, "opencode") : join59(xdgConfig, "opencode");
182664
182783
  return resolveConfigPath3(configDir);
182665
182784
  }
182666
182785
  function getCliCustomConfigDir2() {
@@ -182693,8 +182812,8 @@ function getOpenCodeConfigDir2(options) {
182693
182812
  const tauriDir = process.platform === "win32" ? win325.isAbsolute(tauriDirBase) ? win325.normalize(tauriDirBase) : win325.resolve(tauriDirBase) : resolveConfigPath3(tauriDirBase);
182694
182813
  if (checkExisting) {
182695
182814
  const legacyDir = getCliConfigDir2();
182696
- const legacyConfig = join58(legacyDir, "opencode.json");
182697
- const legacyConfigC = join58(legacyDir, "opencode.jsonc");
182815
+ const legacyConfig = join59(legacyDir, "opencode.json");
182816
+ const legacyConfigC = join59(legacyDir, "opencode.jsonc");
182698
182817
  if (existsSync64(legacyConfig) || existsSync64(legacyConfigC)) {
182699
182818
  return legacyDir;
182700
182819
  }
@@ -182703,22 +182822,22 @@ function getOpenCodeConfigDir2(options) {
182703
182822
  }
182704
182823
 
182705
182824
  // packages/skills-loader-core/src/shared/opencode-command-dirs.ts
182706
- function getParentOpencodeConfigDir(configDir) {
182707
- const parentDir = dirname23(configDir);
182708
- if (basename11(parentDir) !== "profiles") {
182825
+ function getParentOpencodeConfigDir2(configDir) {
182826
+ const parentDir = dirname24(configDir);
182827
+ if (basename12(parentDir) !== "profiles") {
182709
182828
  return null;
182710
182829
  }
182711
- return dirname23(parentDir);
182830
+ return dirname24(parentDir);
182712
182831
  }
182713
- function getOpenCodeSkillDirs(options) {
182832
+ function getOpenCodeSkillDirs2(options) {
182714
182833
  const configDirs = getOpenCodeConfigDirs2(options);
182715
182834
  return Array.from(new Set([
182716
182835
  ...configDirs.flatMap((configDir) => {
182717
- const parentConfigDir = getParentOpencodeConfigDir(configDir);
182836
+ const parentConfigDir = getParentOpencodeConfigDir2(configDir);
182718
182837
  return [
182719
- join59(configDir, "skills"),
182720
- join59(configDir, "skill"),
182721
- ...parentConfigDir ? [join59(parentConfigDir, "skills"), join59(parentConfigDir, "skill")] : []
182838
+ join60(configDir, "skills"),
182839
+ join60(configDir, "skill"),
182840
+ ...parentConfigDir ? [join60(parentConfigDir, "skills"), join60(parentConfigDir, "skill")] : []
182722
182841
  ];
182723
182842
  })
182724
182843
  ]));
@@ -182726,7 +182845,7 @@ function getOpenCodeSkillDirs(options) {
182726
182845
  // packages/skills-loader-core/src/shared/project-discovery-dirs.ts
182727
182846
  import { execFileSync as execFileSync2 } from "child_process";
182728
182847
  import { existsSync as existsSync65, realpathSync as realpathSync9 } from "fs";
182729
- import { dirname as dirname24, join as join60, resolve as resolve13, win32 as win326 } from "path";
182848
+ import { dirname as dirname25, join as join61, resolve as resolve13, win32 as win326 } from "path";
182730
182849
  var worktreePathCache2 = new Map;
182731
182850
  function normalizePath2(path18) {
182732
182851
  const resolvedPath = process.platform !== "win32" && win326.isAbsolute(path18) ? path18 : resolve13(path18);
@@ -182761,7 +182880,7 @@ function findAncestorDirectories(startDirectory, targetPaths, stopDirectory) {
182761
182880
  const stopDirectoryKey = resolvedStopDirectory ? pathKey2(resolvedStopDirectory) : undefined;
182762
182881
  while (true) {
182763
182882
  for (const targetPath of targetPaths) {
182764
- const candidateDirectory = join60(currentDirectory, ...targetPath);
182883
+ const candidateDirectory = join61(currentDirectory, ...targetPath);
182765
182884
  if (!existsSync65(candidateDirectory)) {
182766
182885
  continue;
182767
182886
  }
@@ -182776,7 +182895,7 @@ function findAncestorDirectories(startDirectory, targetPaths, stopDirectory) {
182776
182895
  if (stopDirectoryKey === pathKey2(currentDirectory)) {
182777
182896
  return directories;
182778
182897
  }
182779
- const parentDirectory = dirname24(currentDirectory);
182898
+ const parentDirectory = dirname25(currentDirectory);
182780
182899
  if (parentDirectory === currentDirectory) {
182781
182900
  return directories;
182782
182901
  }
@@ -182844,13 +182963,13 @@ function deduplicateSkillsByName(skills2) {
182844
182963
  // packages/skills-loader-core/src/features/opencode-skill-loader/skill-directory-loader.ts
182845
182964
  init_src();
182846
182965
  import * as fs20 from "fs/promises";
182847
- import { join as join62 } from "path";
182966
+ import { join as join63 } from "path";
182848
182967
 
182849
182968
  // packages/skills-loader-core/src/features/opencode-skill-loader/loaded-skill-from-path.ts
182850
182969
  init_src();
182851
182970
  init_src2();
182852
182971
  import * as fs19 from "fs/promises";
182853
- import { basename as basename12 } from "path";
182972
+ import { basename as basename13 } from "path";
182854
182973
 
182855
182974
  // packages/skills-loader-core/src/features/opencode-skill-loader/allowed-tools-parser.ts
182856
182975
  function parseAllowedTools(allowedTools) {
@@ -182865,7 +182984,7 @@ function parseAllowedTools(allowedTools) {
182865
182984
  // packages/skills-loader-core/src/features/opencode-skill-loader/skill-mcp-config.ts
182866
182985
  init_js_yaml();
182867
182986
  import * as fs18 from "fs/promises";
182868
- import { join as join61 } from "path";
182987
+ import { join as join62 } from "path";
182869
182988
  function parseSkillMcpConfigFromFrontmatter(content) {
182870
182989
  const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
182871
182990
  if (!frontmatterMatch)
@@ -182884,7 +183003,7 @@ function parseSkillMcpConfigFromFrontmatter(content) {
182884
183003
  return;
182885
183004
  }
182886
183005
  async function loadMcpJsonFromDir(skillDir) {
182887
- const mcpJsonPath = join61(skillDir, "mcp.json");
183006
+ const mcpJsonPath = join62(skillDir, "mcp.json");
182888
183007
  try {
182889
183008
  const content = await fs18.readFile(mcpJsonPath, "utf-8");
182890
183009
  const parsed = JSON.parse(content);
@@ -182966,7 +183085,7 @@ $ARGUMENTS
182966
183085
  }
182967
183086
  }
182968
183087
  function inferSkillNameFromFileName(filePath) {
182969
- return basename12(filePath, ".md");
183088
+ return basename13(filePath, ".md");
182970
183089
  }
182971
183090
 
182972
183091
  // packages/skills-loader-core/src/features/opencode-skill-loader/skill-directory-loader.ts
@@ -183000,10 +183119,10 @@ async function loadSkillsFromDir(options) {
183000
183119
  const directories = entries.filter((entry) => !entry.name.startsWith(".") && (entry.isDirectory() || entry.isSymbolicLink()));
183001
183120
  const files = entries.filter((entry) => !entry.name.startsWith(".") && !entry.isDirectory() && !entry.isSymbolicLink() && isMarkdownFile(entry));
183002
183121
  for (const entry of directories) {
183003
- const entryPath = join62(options.skillsDir, entry.name);
183122
+ const entryPath = join63(options.skillsDir, entry.name);
183004
183123
  const resolvedPath = await resolveSymlinkAsync(entryPath);
183005
183124
  const dirName = entry.name;
183006
- const skillMdPath = join62(resolvedPath, "SKILL.md");
183125
+ const skillMdPath = join63(resolvedPath, "SKILL.md");
183007
183126
  if (await canAccessFile(skillMdPath)) {
183008
183127
  const skill = await loadSkillFromPath({
183009
183128
  skillPath: skillMdPath,
@@ -183017,7 +183136,7 @@ async function loadSkillsFromDir(options) {
183017
183136
  }
183018
183137
  continue;
183019
183138
  }
183020
- const namedSkillMdPath = join62(resolvedPath, `${dirName}.md`);
183139
+ const namedSkillMdPath = join63(resolvedPath, `${dirName}.md`);
183021
183140
  if (await canAccessFile(namedSkillMdPath)) {
183022
183141
  const skill = await loadSkillFromPath({
183023
183142
  skillPath: namedSkillMdPath,
@@ -183048,7 +183167,7 @@ async function loadSkillsFromDir(options) {
183048
183167
  }
183049
183168
  }
183050
183169
  for (const entry of files) {
183051
- const entryPath = join62(options.skillsDir, entry.name);
183170
+ const entryPath = join63(options.skillsDir, entry.name);
183052
183171
  const baseName = inferSkillNameFromFileName(entryPath);
183053
183172
  const skill = await loadSkillFromPath({
183054
183173
  skillPath: entryPath,
@@ -183100,7 +183219,7 @@ async function discoverAllSkills(directory) {
183100
183219
  ]);
183101
183220
  }
183102
183221
  async function discoverUserClaudeSkills() {
183103
- const userSkillsDir = join63(getClaudeConfigDir(), "skills");
183222
+ const userSkillsDir = join64(getClaudeConfigDir(), "skills");
183104
183223
  return loadSkillsFromDir({ skillsDir: userSkillsDir, scope: "user" });
183105
183224
  }
183106
183225
  async function discoverProjectClaudeSkills(directory) {
@@ -183109,7 +183228,7 @@ async function discoverProjectClaudeSkills(directory) {
183109
183228
  return deduplicateSkillsByName(allSkills.flat());
183110
183229
  }
183111
183230
  async function discoverOpencodeGlobalSkills() {
183112
- const skillDirs = getOpenCodeSkillDirs({ binary: "opencode" });
183231
+ const skillDirs = getOpenCodeSkillDirs2({ binary: "opencode" });
183113
183232
  const allSkills = await Promise.all(skillDirs.map((skillsDir) => loadSkillsFromDir({ skillsDir, scope: "opencode" })));
183114
183233
  return deduplicateSkillsByName(allSkills.flat());
183115
183234
  }
@@ -183127,7 +183246,7 @@ async function discoverProjectAgentsSkills(directory) {
183127
183246
  return deduplicateSkillsByName(allSkills.flat());
183128
183247
  }
183129
183248
  async function discoverGlobalAgentsSkills(homeDirectory = getHomeDirectory()) {
183130
- const agentsGlobalDir = join63(homeDirectory, ".agents", "skills");
183249
+ const agentsGlobalDir = join64(homeDirectory, ".agents", "skills");
183131
183250
  return loadSkillsFromDir({ skillsDir: agentsGlobalDir, scope: "user" });
183132
183251
  }
183133
183252
  // packages/skills-loader-core/src/features/opencode-skill-loader/merger/builtin-skill-converter.ts
@@ -183879,7 +183998,7 @@ playwright-cli close
183879
183998
  init_shared_skills();
183880
183999
  init_src();
183881
184000
  import { readFileSync as readFileSync52 } from "fs";
183882
- import { join as join64 } from "path";
184001
+ import { join as join65 } from "path";
183883
184002
  function createSharedSkillTemplateLoader(readFile3 = readFileSync52, skillsRootPath = sharedSkillsRootPath()) {
183884
184003
  const cache = new Map;
183885
184004
  return (skillName) => {
@@ -183887,7 +184006,7 @@ function createSharedSkillTemplateLoader(readFile3 = readFileSync52, skillsRootP
183887
184006
  if (cached2 !== undefined)
183888
184007
  return cached2;
183889
184008
  try {
183890
- const { body } = parseFrontmatter(readFile3(join64(skillsRootPath, skillName, "SKILL.md"), "utf8"));
184009
+ const { body } = parseFrontmatter(readFile3(join65(skillsRootPath, skillName, "SKILL.md"), "utf8"));
183891
184010
  cache.set(skillName, body);
183892
184011
  return body;
183893
184012
  } catch (error51) {
@@ -185024,9 +185143,9 @@ var gitMasterSkill = {
185024
185143
  template: GIT_MASTER_TEMPLATE
185025
185144
  };
185026
185145
  // packages/skills-loader-core/src/features/builtin-skills/skills/dev-browser.ts
185027
- import { dirname as dirname25, join as join65 } from "path";
185146
+ import { dirname as dirname26, join as join66 } from "path";
185028
185147
  import { fileURLToPath as fileURLToPath8 } from "url";
185029
- var CURRENT_DIR = dirname25(fileURLToPath8(import.meta.url));
185148
+ var CURRENT_DIR = dirname26(fileURLToPath8(import.meta.url));
185030
185149
  var devBrowserSkill = {
185031
185150
  name: "dev-browser",
185032
185151
  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.",
@@ -185244,7 +185363,7 @@ console.log({
185244
185363
  await client.disconnect();
185245
185364
  EOF
185246
185365
  \`\`\``,
185247
- resolvedPath: join65(CURRENT_DIR, "..", "dev-browser")
185366
+ resolvedPath: join66(CURRENT_DIR, "..", "dev-browser")
185248
185367
  };
185249
185368
  // packages/skills-loader-core/src/features/builtin-skills/skills/review-work.ts
185250
185369
  var reviewWorkSkill = {
@@ -187573,12 +187692,18 @@ ${row.description ? `Description: ${row.description}
187573
187692
  return { ok: false, error: "database unavailable" };
187574
187693
  try {
187575
187694
  let extractTasks = function(text) {
187576
- const summaryMatch = text.match(/"summary"\s*:\s*"([\s\S]*?)"\s*[},]/);
187577
- if (summaryMatch) {
187695
+ for (const line of text.split(`
187696
+ `)) {
187697
+ const trimmed = line.trim();
187698
+ if (!trimmed.startsWith("{") || !trimmed.endsWith("}"))
187699
+ continue;
187700
+ if (!trimmed.includes('"summary"'))
187701
+ continue;
187578
187702
  try {
187579
- let inner = summaryMatch[1].replace(/\\"/g, '"').replace(/\\n/g, `
187580
- `).replace(/\\\//g, "/").replace(/`{3}(?:json)?\n?/g, "");
187581
- const arrayMatch = inner.match(/\[[\s\S]*?\]/);
187703
+ const obj = JSON.parse(trimmed);
187704
+ const summary = obj.summary ?? "";
187705
+ const clean = summary.replace(/```(?:json)?\n?/g, "").replace(/```/g, "");
187706
+ const arrayMatch = clean.match(/\[[\s\S]*?\]/);
187582
187707
  if (arrayMatch) {
187583
187708
  const parsed = JSON.parse(arrayMatch[0]);
187584
187709
  if (Array.isArray(parsed))
@@ -188226,11 +188351,11 @@ async function restartDashboard(options) {
188226
188351
  }
188227
188352
 
188228
188353
  // packages/omo-opencode/src/cli/architect.ts
188229
- import { join as join75 } from "path";
188354
+ import { join as join76 } from "path";
188230
188355
  var IMPROVEMENTS_DIR = ".matrixos/improvements";
188231
188356
  function getStore(directory) {
188232
188357
  const baseDir = directory ?? process.cwd();
188233
- return createImprovementStore(join75(baseDir, IMPROVEMENTS_DIR));
188358
+ return createImprovementStore(join76(baseDir, IMPROVEMENTS_DIR));
188234
188359
  }
188235
188360
  async function architectReview(options) {
188236
188361
  const store4 = getStore(options.directory);
@@ -188824,6 +188949,39 @@ Examples:
188824
188949
  process.stdout.write(result.stdout);
188825
188950
  process.exit(result.exitCode);
188826
188951
  });
188952
+ 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", `
188953
+ Examples:
188954
+ $ matrixos skill-create "pdf extractor" --description "Extract text from PDFs via pdftotext"
188955
+ $ matrixos skill-create my-skill --apply # write to ~/.config/opencode/skills/my-skill/SKILL.md
188956
+ $ matrixos skill-create my-skill --apply --scope project # write to ./.opencode/skills/my-skill/SKILL.md
188957
+ `).action(async (name2, options) => {
188958
+ const { executeSkillCreateCommand: executeSkillCreateCommand2 } = await Promise.resolve().then(() => (init_skill_create(), exports_skill_create));
188959
+ const result = executeSkillCreateCommand2({
188960
+ name: name2,
188961
+ description: options.description,
188962
+ category: options.category,
188963
+ scope: options.scope === "project" ? "project" : "user",
188964
+ targetDir: options.targetDir,
188965
+ apply: options.apply ?? false,
188966
+ json: options.json ?? false
188967
+ });
188968
+ if (options.json) {
188969
+ process.stdout.write(JSON.stringify(result, null, 2) + `
188970
+ `);
188971
+ } else if (!result.applied) {
188972
+ process.stdout.write(`[dry-run] would create: ${result.path}
188973
+
188974
+ ${result.content}
188975
+ `);
188976
+ } else if (result.ok) {
188977
+ process.stdout.write(`created: ${result.path}
188978
+ `);
188979
+ } else {
188980
+ process.stdout.write(`error: ${result.error}
188981
+ `);
188982
+ process.exit(1);
188983
+ }
188984
+ });
188827
188985
  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", `
188828
188986
  Examples:
188829
188987
  $ matrixos gateway start # telegram