evil-omo 3.11.3 → 3.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/{oh-my-opencode.js → evil-omo.js} +8 -5
- package/bin/platform.js +11 -8
- package/bin/platform.test.ts +20 -20
- package/dist/cli/config-manager/config-context.d.ts +1 -0
- package/dist/cli/doctor/constants.d.ts +1 -1
- package/dist/cli/index.js +364 -303
- package/dist/config/schema.d.ts +1 -1
- package/dist/{oh-my-opencode.schema.json → evil-omo.schema.json} +2 -2
- package/dist/features/claude-code-plugin-loader/types.d.ts +1 -1
- package/dist/hooks/auto-update-checker/constants.d.ts +2 -2
- package/dist/hooks/comment-checker/downloader.d.ts +1 -1
- package/dist/index.js +15317 -15225
- package/dist/shared/data-path.d.ts +2 -2
- package/dist/shared/external-plugin-detector.d.ts +1 -1
- package/dist/shared/plugin-identity.d.ts +19 -4
- package/dist/shared/system-directive.d.ts +5 -5
- package/package.json +14 -14
- package/postinstall.mjs +3 -2
- /package/dist/config/schema/{oh-my-opencode-config.d.ts → evil-omo-config.d.ts} +0 -0
package/dist/cli/index.js
CHANGED
|
@@ -4916,137 +4916,6 @@ var init_command_executor = __esm(() => {
|
|
|
4916
4916
|
|
|
4917
4917
|
// src/shared/file-reference-resolver.ts
|
|
4918
4918
|
var init_file_reference_resolver = () => {};
|
|
4919
|
-
// src/shared/logger.ts
|
|
4920
|
-
import * as fs from "fs";
|
|
4921
|
-
import * as os from "os";
|
|
4922
|
-
import * as path from "path";
|
|
4923
|
-
function log(message, data) {
|
|
4924
|
-
try {
|
|
4925
|
-
const timestamp2 = new Date().toISOString();
|
|
4926
|
-
const logEntry = `[${timestamp2}] ${message} ${data ? JSON.stringify(data) : ""}
|
|
4927
|
-
`;
|
|
4928
|
-
fs.appendFileSync(logFile, logEntry);
|
|
4929
|
-
} catch {}
|
|
4930
|
-
}
|
|
4931
|
-
var logFile;
|
|
4932
|
-
var init_logger = __esm(() => {
|
|
4933
|
-
logFile = path.join(os.tmpdir(), "oh-my-opencode.log");
|
|
4934
|
-
});
|
|
4935
|
-
|
|
4936
|
-
// src/shared/deep-merge.ts
|
|
4937
|
-
function isPlainObject(value) {
|
|
4938
|
-
return typeof value === "object" && value !== null && !Array.isArray(value) && Object.prototype.toString.call(value) === "[object Object]";
|
|
4939
|
-
}
|
|
4940
|
-
function deepMerge(base, override, depth = 0) {
|
|
4941
|
-
if (!base && !override)
|
|
4942
|
-
return;
|
|
4943
|
-
if (!base)
|
|
4944
|
-
return override;
|
|
4945
|
-
if (!override)
|
|
4946
|
-
return base;
|
|
4947
|
-
if (depth > MAX_DEPTH)
|
|
4948
|
-
return override ?? base;
|
|
4949
|
-
const result = { ...base };
|
|
4950
|
-
for (const key of Object.keys(override)) {
|
|
4951
|
-
if (DANGEROUS_KEYS.has(key))
|
|
4952
|
-
continue;
|
|
4953
|
-
const baseValue = base[key];
|
|
4954
|
-
const overrideValue = override[key];
|
|
4955
|
-
if (overrideValue === undefined)
|
|
4956
|
-
continue;
|
|
4957
|
-
if (isPlainObject(baseValue) && isPlainObject(overrideValue)) {
|
|
4958
|
-
result[key] = deepMerge(baseValue, overrideValue, depth + 1);
|
|
4959
|
-
} else {
|
|
4960
|
-
result[key] = overrideValue;
|
|
4961
|
-
}
|
|
4962
|
-
}
|
|
4963
|
-
return result;
|
|
4964
|
-
}
|
|
4965
|
-
var DANGEROUS_KEYS, MAX_DEPTH = 50;
|
|
4966
|
-
var init_deep_merge = __esm(() => {
|
|
4967
|
-
DANGEROUS_KEYS = new Set(["__proto__", "constructor", "prototype"]);
|
|
4968
|
-
});
|
|
4969
|
-
|
|
4970
|
-
// src/shared/snake-case.ts
|
|
4971
|
-
var init_snake_case = __esm(() => {
|
|
4972
|
-
init_deep_merge();
|
|
4973
|
-
});
|
|
4974
|
-
|
|
4975
|
-
// src/shared/tool-name.ts
|
|
4976
|
-
var init_tool_name = () => {};
|
|
4977
|
-
// src/shared/file-utils.ts
|
|
4978
|
-
var init_file_utils = () => {};
|
|
4979
|
-
|
|
4980
|
-
// src/shared/context-limit-resolver.ts
|
|
4981
|
-
var init_context_limit_resolver = () => {};
|
|
4982
|
-
|
|
4983
|
-
// src/shared/normalize-sdk-response.ts
|
|
4984
|
-
function normalizeSDKResponse(response, fallback, options) {
|
|
4985
|
-
if (response === null || response === undefined) {
|
|
4986
|
-
return fallback;
|
|
4987
|
-
}
|
|
4988
|
-
if (Array.isArray(response)) {
|
|
4989
|
-
return response;
|
|
4990
|
-
}
|
|
4991
|
-
if (typeof response === "object" && "data" in response) {
|
|
4992
|
-
const data = response.data;
|
|
4993
|
-
if (data !== null && data !== undefined) {
|
|
4994
|
-
return data;
|
|
4995
|
-
}
|
|
4996
|
-
if (options?.preferResponseOnMissingData === true) {
|
|
4997
|
-
return response;
|
|
4998
|
-
}
|
|
4999
|
-
return fallback;
|
|
5000
|
-
}
|
|
5001
|
-
if (options?.preferResponseOnMissingData === true) {
|
|
5002
|
-
return response;
|
|
5003
|
-
}
|
|
5004
|
-
return fallback;
|
|
5005
|
-
}
|
|
5006
|
-
|
|
5007
|
-
// src/shared/dynamic-truncator.ts
|
|
5008
|
-
var init_dynamic_truncator = __esm(() => {
|
|
5009
|
-
init_context_limit_resolver();
|
|
5010
|
-
});
|
|
5011
|
-
|
|
5012
|
-
// src/shared/data-path.ts
|
|
5013
|
-
import * as path2 from "path";
|
|
5014
|
-
import * as os2 from "os";
|
|
5015
|
-
function getDataDir() {
|
|
5016
|
-
return process.env.XDG_DATA_HOME ?? path2.join(os2.homedir(), ".local", "share");
|
|
5017
|
-
}
|
|
5018
|
-
function getOpenCodeStorageDir() {
|
|
5019
|
-
return path2.join(getDataDir(), "opencode", "storage");
|
|
5020
|
-
}
|
|
5021
|
-
function getCacheDir() {
|
|
5022
|
-
return process.env.XDG_CACHE_HOME ?? path2.join(os2.homedir(), ".cache");
|
|
5023
|
-
}
|
|
5024
|
-
function getOmoOpenCodeCacheDir() {
|
|
5025
|
-
return path2.join(getCacheDir(), "oh-my-opencode");
|
|
5026
|
-
}
|
|
5027
|
-
function getOpenCodeCacheDir() {
|
|
5028
|
-
return path2.join(getCacheDir(), "opencode");
|
|
5029
|
-
}
|
|
5030
|
-
var init_data_path = () => {};
|
|
5031
|
-
|
|
5032
|
-
// src/shared/config-errors.ts
|
|
5033
|
-
function getConfigLoadErrors() {
|
|
5034
|
-
return configLoadErrors;
|
|
5035
|
-
}
|
|
5036
|
-
function clearConfigLoadErrors() {
|
|
5037
|
-
configLoadErrors = [];
|
|
5038
|
-
}
|
|
5039
|
-
function addConfigLoadError(error) {
|
|
5040
|
-
configLoadErrors.push(error);
|
|
5041
|
-
}
|
|
5042
|
-
var configLoadErrors;
|
|
5043
|
-
var init_config_errors = __esm(() => {
|
|
5044
|
-
configLoadErrors = [];
|
|
5045
|
-
});
|
|
5046
|
-
|
|
5047
|
-
// src/shared/claude-config-dir.ts
|
|
5048
|
-
var init_claude_config_dir = () => {};
|
|
5049
|
-
|
|
5050
4919
|
// node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
5051
4920
|
function createScanner(text, ignoreTrivia = false) {
|
|
5052
4921
|
const len = text.length;
|
|
@@ -5940,6 +5809,175 @@ var init_jsonc_parser = __esm(() => {
|
|
|
5940
5809
|
init_main();
|
|
5941
5810
|
});
|
|
5942
5811
|
|
|
5812
|
+
// src/shared/plugin-identity.ts
|
|
5813
|
+
import { join } from "path";
|
|
5814
|
+
function matchesManagedName(entry, packageName) {
|
|
5815
|
+
return entry === packageName || entry.startsWith(`${packageName}@`);
|
|
5816
|
+
}
|
|
5817
|
+
function findManagedPluginEntry(plugins) {
|
|
5818
|
+
for (const [index, entry] of plugins.entries()) {
|
|
5819
|
+
for (const packageName of ALL_PLUGIN_NAMES) {
|
|
5820
|
+
if (matchesManagedName(entry, packageName)) {
|
|
5821
|
+
return { index, packageName };
|
|
5822
|
+
}
|
|
5823
|
+
}
|
|
5824
|
+
}
|
|
5825
|
+
return null;
|
|
5826
|
+
}
|
|
5827
|
+
function detectManagedConfigFile(directory) {
|
|
5828
|
+
for (const baseName of ALL_CONFIG_BASENAMES) {
|
|
5829
|
+
const detected = detectConfigFile(join(directory, baseName));
|
|
5830
|
+
if (detected.format !== "none") {
|
|
5831
|
+
return { ...detected, baseName };
|
|
5832
|
+
}
|
|
5833
|
+
}
|
|
5834
|
+
return {
|
|
5835
|
+
format: "none",
|
|
5836
|
+
path: join(directory, `${CONFIG_BASENAME}.json`),
|
|
5837
|
+
baseName: CONFIG_BASENAME
|
|
5838
|
+
};
|
|
5839
|
+
}
|
|
5840
|
+
var PLUGIN_NAME = "evil-omo", ALL_PLUGIN_NAMES, CONFIG_BASENAME = "evil-omo", ALL_CONFIG_BASENAMES, LOG_FILENAME = "evil-omo.log", CACHE_DIR_NAME = "evil-omo", SCHEMA_FILENAME = "evil-omo.schema.json";
|
|
5841
|
+
var init_plugin_identity = __esm(() => {
|
|
5842
|
+
init_jsonc_parser();
|
|
5843
|
+
ALL_PLUGIN_NAMES = [PLUGIN_NAME];
|
|
5844
|
+
ALL_CONFIG_BASENAMES = [CONFIG_BASENAME];
|
|
5845
|
+
});
|
|
5846
|
+
|
|
5847
|
+
// src/shared/logger.ts
|
|
5848
|
+
import * as fs from "fs";
|
|
5849
|
+
import * as os from "os";
|
|
5850
|
+
import * as path from "path";
|
|
5851
|
+
function log(message, data) {
|
|
5852
|
+
try {
|
|
5853
|
+
const timestamp2 = new Date().toISOString();
|
|
5854
|
+
const logEntry = `[${timestamp2}] ${message} ${data ? JSON.stringify(data) : ""}
|
|
5855
|
+
`;
|
|
5856
|
+
fs.appendFileSync(logFile, logEntry);
|
|
5857
|
+
} catch {}
|
|
5858
|
+
}
|
|
5859
|
+
var logFile;
|
|
5860
|
+
var init_logger = __esm(() => {
|
|
5861
|
+
init_plugin_identity();
|
|
5862
|
+
logFile = path.join(os.tmpdir(), LOG_FILENAME);
|
|
5863
|
+
});
|
|
5864
|
+
|
|
5865
|
+
// src/shared/deep-merge.ts
|
|
5866
|
+
function isPlainObject(value) {
|
|
5867
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) && Object.prototype.toString.call(value) === "[object Object]";
|
|
5868
|
+
}
|
|
5869
|
+
function deepMerge(base, override, depth = 0) {
|
|
5870
|
+
if (!base && !override)
|
|
5871
|
+
return;
|
|
5872
|
+
if (!base)
|
|
5873
|
+
return override;
|
|
5874
|
+
if (!override)
|
|
5875
|
+
return base;
|
|
5876
|
+
if (depth > MAX_DEPTH)
|
|
5877
|
+
return override ?? base;
|
|
5878
|
+
const result = { ...base };
|
|
5879
|
+
for (const key of Object.keys(override)) {
|
|
5880
|
+
if (DANGEROUS_KEYS.has(key))
|
|
5881
|
+
continue;
|
|
5882
|
+
const baseValue = base[key];
|
|
5883
|
+
const overrideValue = override[key];
|
|
5884
|
+
if (overrideValue === undefined)
|
|
5885
|
+
continue;
|
|
5886
|
+
if (isPlainObject(baseValue) && isPlainObject(overrideValue)) {
|
|
5887
|
+
result[key] = deepMerge(baseValue, overrideValue, depth + 1);
|
|
5888
|
+
} else {
|
|
5889
|
+
result[key] = overrideValue;
|
|
5890
|
+
}
|
|
5891
|
+
}
|
|
5892
|
+
return result;
|
|
5893
|
+
}
|
|
5894
|
+
var DANGEROUS_KEYS, MAX_DEPTH = 50;
|
|
5895
|
+
var init_deep_merge = __esm(() => {
|
|
5896
|
+
DANGEROUS_KEYS = new Set(["__proto__", "constructor", "prototype"]);
|
|
5897
|
+
});
|
|
5898
|
+
|
|
5899
|
+
// src/shared/snake-case.ts
|
|
5900
|
+
var init_snake_case = __esm(() => {
|
|
5901
|
+
init_deep_merge();
|
|
5902
|
+
});
|
|
5903
|
+
|
|
5904
|
+
// src/shared/tool-name.ts
|
|
5905
|
+
var init_tool_name = () => {};
|
|
5906
|
+
// src/shared/file-utils.ts
|
|
5907
|
+
var init_file_utils = () => {};
|
|
5908
|
+
|
|
5909
|
+
// src/shared/context-limit-resolver.ts
|
|
5910
|
+
var init_context_limit_resolver = () => {};
|
|
5911
|
+
|
|
5912
|
+
// src/shared/normalize-sdk-response.ts
|
|
5913
|
+
function normalizeSDKResponse(response, fallback, options) {
|
|
5914
|
+
if (response === null || response === undefined) {
|
|
5915
|
+
return fallback;
|
|
5916
|
+
}
|
|
5917
|
+
if (Array.isArray(response)) {
|
|
5918
|
+
return response;
|
|
5919
|
+
}
|
|
5920
|
+
if (typeof response === "object" && "data" in response) {
|
|
5921
|
+
const data = response.data;
|
|
5922
|
+
if (data !== null && data !== undefined) {
|
|
5923
|
+
return data;
|
|
5924
|
+
}
|
|
5925
|
+
if (options?.preferResponseOnMissingData === true) {
|
|
5926
|
+
return response;
|
|
5927
|
+
}
|
|
5928
|
+
return fallback;
|
|
5929
|
+
}
|
|
5930
|
+
if (options?.preferResponseOnMissingData === true) {
|
|
5931
|
+
return response;
|
|
5932
|
+
}
|
|
5933
|
+
return fallback;
|
|
5934
|
+
}
|
|
5935
|
+
|
|
5936
|
+
// src/shared/dynamic-truncator.ts
|
|
5937
|
+
var init_dynamic_truncator = __esm(() => {
|
|
5938
|
+
init_context_limit_resolver();
|
|
5939
|
+
});
|
|
5940
|
+
|
|
5941
|
+
// src/shared/data-path.ts
|
|
5942
|
+
import * as path2 from "path";
|
|
5943
|
+
import * as os2 from "os";
|
|
5944
|
+
function getDataDir() {
|
|
5945
|
+
return process.env.XDG_DATA_HOME ?? path2.join(os2.homedir(), ".local", "share");
|
|
5946
|
+
}
|
|
5947
|
+
function getOpenCodeStorageDir() {
|
|
5948
|
+
return path2.join(getDataDir(), "opencode", "storage");
|
|
5949
|
+
}
|
|
5950
|
+
function getCacheDir() {
|
|
5951
|
+
return process.env.XDG_CACHE_HOME ?? path2.join(os2.homedir(), ".cache");
|
|
5952
|
+
}
|
|
5953
|
+
function getOmoOpenCodeCacheDir() {
|
|
5954
|
+
return path2.join(getCacheDir(), CACHE_DIR_NAME);
|
|
5955
|
+
}
|
|
5956
|
+
function getOpenCodeCacheDir() {
|
|
5957
|
+
return path2.join(getCacheDir(), "opencode");
|
|
5958
|
+
}
|
|
5959
|
+
var init_data_path = __esm(() => {
|
|
5960
|
+
init_plugin_identity();
|
|
5961
|
+
});
|
|
5962
|
+
|
|
5963
|
+
// src/shared/config-errors.ts
|
|
5964
|
+
function getConfigLoadErrors() {
|
|
5965
|
+
return configLoadErrors;
|
|
5966
|
+
}
|
|
5967
|
+
function clearConfigLoadErrors() {
|
|
5968
|
+
configLoadErrors = [];
|
|
5969
|
+
}
|
|
5970
|
+
function addConfigLoadError(error) {
|
|
5971
|
+
configLoadErrors.push(error);
|
|
5972
|
+
}
|
|
5973
|
+
var configLoadErrors;
|
|
5974
|
+
var init_config_errors = __esm(() => {
|
|
5975
|
+
configLoadErrors = [];
|
|
5976
|
+
});
|
|
5977
|
+
|
|
5978
|
+
// src/shared/claude-config-dir.ts
|
|
5979
|
+
var init_claude_config_dir = () => {};
|
|
5980
|
+
|
|
5943
5981
|
// src/shared/migration/agent-names.ts
|
|
5944
5982
|
function migrateAgentNames(agents) {
|
|
5945
5983
|
const migrated = {};
|
|
@@ -6197,7 +6235,7 @@ var init_migration = __esm(() => {
|
|
|
6197
6235
|
// src/shared/opencode-config-dir.ts
|
|
6198
6236
|
import { existsSync as existsSync2 } from "fs";
|
|
6199
6237
|
import { homedir as homedir2 } from "os";
|
|
6200
|
-
import { join as
|
|
6238
|
+
import { join as join4, resolve } from "path";
|
|
6201
6239
|
function isDevBuild(version) {
|
|
6202
6240
|
if (!version)
|
|
6203
6241
|
return false;
|
|
@@ -6207,15 +6245,15 @@ function getTauriConfigDir(identifier) {
|
|
|
6207
6245
|
const platform = process.platform;
|
|
6208
6246
|
switch (platform) {
|
|
6209
6247
|
case "darwin":
|
|
6210
|
-
return
|
|
6248
|
+
return join4(homedir2(), "Library", "Application Support", identifier);
|
|
6211
6249
|
case "win32": {
|
|
6212
|
-
const appData = process.env.APPDATA ||
|
|
6213
|
-
return
|
|
6250
|
+
const appData = process.env.APPDATA || join4(homedir2(), "AppData", "Roaming");
|
|
6251
|
+
return join4(appData, identifier);
|
|
6214
6252
|
}
|
|
6215
6253
|
case "linux":
|
|
6216
6254
|
default: {
|
|
6217
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME ||
|
|
6218
|
-
return
|
|
6255
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join4(homedir2(), ".config");
|
|
6256
|
+
return join4(xdgConfig, identifier);
|
|
6219
6257
|
}
|
|
6220
6258
|
}
|
|
6221
6259
|
}
|
|
@@ -6224,8 +6262,8 @@ function getCliConfigDir() {
|
|
|
6224
6262
|
if (envConfigDir) {
|
|
6225
6263
|
return resolve(envConfigDir);
|
|
6226
6264
|
}
|
|
6227
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME ||
|
|
6228
|
-
return
|
|
6265
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join4(homedir2(), ".config");
|
|
6266
|
+
return join4(xdgConfig, "opencode");
|
|
6229
6267
|
}
|
|
6230
6268
|
function getOpenCodeConfigDir(options) {
|
|
6231
6269
|
const { binary: binary2, version, checkExisting = true } = options;
|
|
@@ -6236,8 +6274,8 @@ function getOpenCodeConfigDir(options) {
|
|
|
6236
6274
|
const tauriDir = getTauriConfigDir(identifier);
|
|
6237
6275
|
if (checkExisting) {
|
|
6238
6276
|
const legacyDir = getCliConfigDir();
|
|
6239
|
-
const legacyConfig =
|
|
6240
|
-
const legacyConfigC =
|
|
6277
|
+
const legacyConfig = join4(legacyDir, "opencode.json");
|
|
6278
|
+
const legacyConfigC = join4(legacyDir, "opencode.jsonc");
|
|
6241
6279
|
if (existsSync2(legacyConfig) || existsSync2(legacyConfigC)) {
|
|
6242
6280
|
return legacyDir;
|
|
6243
6281
|
}
|
|
@@ -6248,14 +6286,16 @@ function getOpenCodeConfigPaths(options) {
|
|
|
6248
6286
|
const configDir = getOpenCodeConfigDir(options);
|
|
6249
6287
|
return {
|
|
6250
6288
|
configDir,
|
|
6251
|
-
configJson:
|
|
6252
|
-
configJsonc:
|
|
6253
|
-
packageJson:
|
|
6254
|
-
omoConfig:
|
|
6289
|
+
configJson: join4(configDir, "opencode.json"),
|
|
6290
|
+
configJsonc: join4(configDir, "opencode.jsonc"),
|
|
6291
|
+
packageJson: join4(configDir, "package.json"),
|
|
6292
|
+
omoConfig: join4(configDir, `${CONFIG_BASENAME}.json`)
|
|
6255
6293
|
};
|
|
6256
6294
|
}
|
|
6257
6295
|
var TAURI_APP_IDENTIFIER = "ai.opencode.desktop", TAURI_APP_IDENTIFIER_DEV = "ai.opencode.desktop.dev";
|
|
6258
|
-
var init_opencode_config_dir = () => {
|
|
6296
|
+
var init_opencode_config_dir = __esm(() => {
|
|
6297
|
+
init_plugin_identity();
|
|
6298
|
+
});
|
|
6259
6299
|
|
|
6260
6300
|
// src/shared/opencode-version.ts
|
|
6261
6301
|
var NOT_CACHED;
|
|
@@ -6275,6 +6315,7 @@ var init_opencode_storage_detection = __esm(() => {
|
|
|
6275
6315
|
var init_external_plugin_detector = __esm(() => {
|
|
6276
6316
|
init_logger();
|
|
6277
6317
|
init_jsonc_parser();
|
|
6318
|
+
init_plugin_identity();
|
|
6278
6319
|
});
|
|
6279
6320
|
|
|
6280
6321
|
// src/shared/zip-extractor.ts
|
|
@@ -6618,9 +6659,9 @@ var init_system_directive = () => {};
|
|
|
6618
6659
|
var init_agent_tool_restrictions = () => {};
|
|
6619
6660
|
// src/shared/connected-providers-cache.ts
|
|
6620
6661
|
import { existsSync as existsSync3, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync } from "fs";
|
|
6621
|
-
import { join as
|
|
6662
|
+
import { join as join5 } from "path";
|
|
6622
6663
|
function getCacheFilePath(filename) {
|
|
6623
|
-
return
|
|
6664
|
+
return join5(getOmoOpenCodeCacheDir(), filename);
|
|
6624
6665
|
}
|
|
6625
6666
|
function ensureCacheDir() {
|
|
6626
6667
|
const cacheDir = getOmoOpenCodeCacheDir();
|
|
@@ -6702,12 +6743,12 @@ var init_connected_providers_cache = __esm(() => {
|
|
|
6702
6743
|
|
|
6703
6744
|
// src/shared/model-availability.ts
|
|
6704
6745
|
import { existsSync as existsSync4, readFileSync as readFileSync3 } from "fs";
|
|
6705
|
-
import { join as
|
|
6746
|
+
import { join as join6 } from "path";
|
|
6706
6747
|
function isModelCacheAvailable() {
|
|
6707
6748
|
if (hasProviderModelsCache()) {
|
|
6708
6749
|
return true;
|
|
6709
6750
|
}
|
|
6710
|
-
const cacheFile =
|
|
6751
|
+
const cacheFile = join6(getOpenCodeCacheDir(), "models.json");
|
|
6711
6752
|
return existsSync4(cacheFile);
|
|
6712
6753
|
}
|
|
6713
6754
|
var init_model_availability = __esm(() => {
|
|
@@ -6769,14 +6810,14 @@ var init_hook_message_injector = __esm(() => {
|
|
|
6769
6810
|
});
|
|
6770
6811
|
|
|
6771
6812
|
// src/shared/opencode-storage-paths.ts
|
|
6772
|
-
import { join as
|
|
6813
|
+
import { join as join7 } from "path";
|
|
6773
6814
|
var OPENCODE_STORAGE, MESSAGE_STORAGE, PART_STORAGE, SESSION_STORAGE;
|
|
6774
6815
|
var init_opencode_storage_paths = __esm(() => {
|
|
6775
6816
|
init_data_path();
|
|
6776
6817
|
OPENCODE_STORAGE = getOpenCodeStorageDir();
|
|
6777
|
-
MESSAGE_STORAGE =
|
|
6778
|
-
PART_STORAGE =
|
|
6779
|
-
SESSION_STORAGE =
|
|
6818
|
+
MESSAGE_STORAGE = join7(OPENCODE_STORAGE, "message");
|
|
6819
|
+
PART_STORAGE = join7(OPENCODE_STORAGE, "part");
|
|
6820
|
+
SESSION_STORAGE = join7(OPENCODE_STORAGE, "session");
|
|
6780
6821
|
});
|
|
6781
6822
|
|
|
6782
6823
|
// src/shared/opencode-message-dir.ts
|
|
@@ -7051,6 +7092,7 @@ var sessionCategoryMap;
|
|
|
7051
7092
|
var init_session_category_registry = __esm(() => {
|
|
7052
7093
|
sessionCategoryMap = new Map;
|
|
7053
7094
|
});
|
|
7095
|
+
|
|
7054
7096
|
// src/shared/index.ts
|
|
7055
7097
|
var init_shared = __esm(() => {
|
|
7056
7098
|
init_model_resolver();
|
|
@@ -7100,6 +7142,7 @@ var init_shared = __esm(() => {
|
|
|
7100
7142
|
init_session_directory_resolver();
|
|
7101
7143
|
init_prompt_tools();
|
|
7102
7144
|
init_plugin_command_discovery();
|
|
7145
|
+
init_plugin_identity();
|
|
7103
7146
|
});
|
|
7104
7147
|
|
|
7105
7148
|
// src/cli/config-manager/config-context.ts
|
|
@@ -7126,9 +7169,14 @@ function getConfigJsonc() {
|
|
|
7126
7169
|
function getOmoConfigPath() {
|
|
7127
7170
|
return getConfigContext().paths.omoConfig;
|
|
7128
7171
|
}
|
|
7172
|
+
function getExistingOmoConfigPath() {
|
|
7173
|
+
const detected = detectManagedConfigFile(getConfigDir());
|
|
7174
|
+
return detected.format === "none" ? null : detected.path;
|
|
7175
|
+
}
|
|
7129
7176
|
var configContext = null;
|
|
7130
7177
|
var init_config_context = __esm(() => {
|
|
7131
7178
|
init_shared();
|
|
7179
|
+
init_plugin_identity();
|
|
7132
7180
|
});
|
|
7133
7181
|
|
|
7134
7182
|
// src/cli/config-manager/npm-dist-tags.ts
|
|
@@ -7167,8 +7215,10 @@ async function getPluginNameWithVersion(currentVersion, packageName = DEFAULT_PA
|
|
|
7167
7215
|
}
|
|
7168
7216
|
return getFallbackEntry(currentVersion, packageName);
|
|
7169
7217
|
}
|
|
7170
|
-
var DEFAULT_PACKAGE_NAME
|
|
7218
|
+
var DEFAULT_PACKAGE_NAME, PRIORITIZED_TAGS;
|
|
7171
7219
|
var init_plugin_name_with_version = __esm(() => {
|
|
7220
|
+
init_plugin_identity();
|
|
7221
|
+
DEFAULT_PACKAGE_NAME = PLUGIN_NAME;
|
|
7172
7222
|
PRIORITIZED_TAGS = ["latest", "beta", "next"];
|
|
7173
7223
|
});
|
|
7174
7224
|
|
|
@@ -7295,12 +7345,12 @@ async function addPluginToOpenCodeConfig(currentVersion) {
|
|
|
7295
7345
|
}
|
|
7296
7346
|
const config = parseResult.config;
|
|
7297
7347
|
const plugins = config.plugin ?? [];
|
|
7298
|
-
const
|
|
7299
|
-
if (
|
|
7300
|
-
if (plugins[
|
|
7348
|
+
const existingPlugin = findManagedPluginEntry(plugins);
|
|
7349
|
+
if (existingPlugin) {
|
|
7350
|
+
if (plugins[existingPlugin.index] === pluginEntry) {
|
|
7301
7351
|
return { success: true, configPath: path3 };
|
|
7302
7352
|
}
|
|
7303
|
-
plugins[
|
|
7353
|
+
plugins[existingPlugin.index] = pluginEntry;
|
|
7304
7354
|
} else {
|
|
7305
7355
|
plugins.push(pluginEntry);
|
|
7306
7356
|
}
|
|
@@ -7334,13 +7384,15 @@ async function addPluginToOpenCodeConfig(currentVersion) {
|
|
|
7334
7384
|
};
|
|
7335
7385
|
}
|
|
7336
7386
|
}
|
|
7337
|
-
var PACKAGE_NAME
|
|
7387
|
+
var PACKAGE_NAME;
|
|
7338
7388
|
var init_add_plugin_to_opencode_config = __esm(() => {
|
|
7389
|
+
init_plugin_identity();
|
|
7339
7390
|
init_config_context();
|
|
7340
7391
|
init_ensure_config_directory_exists();
|
|
7341
7392
|
init_opencode_config_format();
|
|
7342
7393
|
init_parse_opencode_config_file();
|
|
7343
7394
|
init_plugin_name_with_version();
|
|
7395
|
+
PACKAGE_NAME = PLUGIN_NAME;
|
|
7344
7396
|
});
|
|
7345
7397
|
|
|
7346
7398
|
// src/cli/model-fallback-requirements.ts
|
|
@@ -7535,11 +7587,13 @@ function generateModelConfig(config) {
|
|
|
7535
7587
|
};
|
|
7536
7588
|
return isOpenAiOnlyAvailability(avail) ? applyOpenAiOnlyModelCatalog(generatedConfig) : generatedConfig;
|
|
7537
7589
|
}
|
|
7538
|
-
var ZAI_MODEL = "zai-coding-plan/glm-4.7", ULTIMATE_FALLBACK = "opencode/glm-4.7-free", SCHEMA_URL
|
|
7590
|
+
var ZAI_MODEL = "zai-coding-plan/glm-4.7", ULTIMATE_FALLBACK = "opencode/glm-4.7-free", SCHEMA_URL;
|
|
7539
7591
|
var init_model_fallback = __esm(() => {
|
|
7540
7592
|
init_model_fallback_requirements();
|
|
7541
7593
|
init_openai_only_model_catalog();
|
|
7542
7594
|
init_fallback_chain_resolution();
|
|
7595
|
+
init_plugin_identity();
|
|
7596
|
+
SCHEMA_URL = `https://raw.githubusercontent.com/D4ch1au/evil-oh-my-openagent/dev/assets/${SCHEMA_FILENAME}`;
|
|
7543
7597
|
});
|
|
7544
7598
|
|
|
7545
7599
|
// src/cli/config-manager/generate-omo-config.ts
|
|
@@ -7583,12 +7637,13 @@ function writeOmoConfig(installConfig) {
|
|
|
7583
7637
|
};
|
|
7584
7638
|
}
|
|
7585
7639
|
const omoConfigPath = getOmoConfigPath();
|
|
7640
|
+
const existingConfigPath = getExistingOmoConfigPath() ?? omoConfigPath;
|
|
7586
7641
|
try {
|
|
7587
7642
|
const newConfig = generateOmoConfig(installConfig);
|
|
7588
|
-
if (existsSync7(
|
|
7643
|
+
if (existsSync7(existingConfigPath)) {
|
|
7589
7644
|
try {
|
|
7590
|
-
const stat = statSync2(
|
|
7591
|
-
const content = readFileSync6(
|
|
7645
|
+
const stat = statSync2(existingConfigPath);
|
|
7646
|
+
const content = readFileSync6(existingConfigPath, "utf-8");
|
|
7592
7647
|
if (stat.size === 0 || isEmptyOrWhitespace2(content)) {
|
|
7593
7648
|
writeFileSync4(omoConfigPath, JSON.stringify(newConfig, null, 2) + `
|
|
7594
7649
|
`);
|
|
@@ -7621,7 +7676,7 @@ function writeOmoConfig(installConfig) {
|
|
|
7621
7676
|
return {
|
|
7622
7677
|
success: false,
|
|
7623
7678
|
configPath: omoConfigPath,
|
|
7624
|
-
error: formatErrorWithSuggestion(err, "write
|
|
7679
|
+
error: formatErrorWithSuggestion(err, "write evil-omo config")
|
|
7625
7680
|
};
|
|
7626
7681
|
}
|
|
7627
7682
|
}
|
|
@@ -7731,8 +7786,8 @@ var init_opencode_binary = __esm(() => {
|
|
|
7731
7786
|
// src/cli/config-manager/detect-current-config.ts
|
|
7732
7787
|
import { existsSync as existsSync8, readFileSync as readFileSync7 } from "fs";
|
|
7733
7788
|
function detectProvidersFromOmoConfig() {
|
|
7734
|
-
const omoConfigPath =
|
|
7735
|
-
if (!existsSync8(omoConfigPath)) {
|
|
7789
|
+
const omoConfigPath = getExistingOmoConfigPath();
|
|
7790
|
+
if (!omoConfigPath || !existsSync8(omoConfigPath)) {
|
|
7736
7791
|
return {
|
|
7737
7792
|
hasOpenAI: true,
|
|
7738
7793
|
hasOpencodeZen: true,
|
|
@@ -7771,7 +7826,6 @@ function detectProvidersFromOmoConfig() {
|
|
|
7771
7826
|
}
|
|
7772
7827
|
}
|
|
7773
7828
|
function detectCurrentConfig() {
|
|
7774
|
-
const PACKAGE_NAME2 = "oh-my-opencode";
|
|
7775
7829
|
const result = {
|
|
7776
7830
|
isInstalled: false,
|
|
7777
7831
|
hasClaude: true,
|
|
@@ -7794,7 +7848,7 @@ function detectCurrentConfig() {
|
|
|
7794
7848
|
}
|
|
7795
7849
|
const openCodeConfig = parseResult.config;
|
|
7796
7850
|
const plugins = openCodeConfig.plugin ?? [];
|
|
7797
|
-
result.isInstalled = plugins
|
|
7851
|
+
result.isInstalled = findManagedPluginEntry(plugins) !== null;
|
|
7798
7852
|
if (!result.isInstalled) {
|
|
7799
7853
|
return result;
|
|
7800
7854
|
}
|
|
@@ -7810,6 +7864,7 @@ function detectCurrentConfig() {
|
|
|
7810
7864
|
}
|
|
7811
7865
|
var init_detect_current_config = __esm(() => {
|
|
7812
7866
|
init_shared();
|
|
7867
|
+
init_plugin_identity();
|
|
7813
7868
|
init_config_context();
|
|
7814
7869
|
init_opencode_config_format();
|
|
7815
7870
|
init_parse_opencode_config_file();
|
|
@@ -7985,10 +8040,12 @@ function getWindowsAppdataDir() {
|
|
|
7985
8040
|
return null;
|
|
7986
8041
|
return process.env.APPDATA ?? path4.join(os3.homedir(), "AppData", "Roaming");
|
|
7987
8042
|
}
|
|
7988
|
-
var PACKAGE_NAME2
|
|
8043
|
+
var PACKAGE_NAME2, NPM_REGISTRY_URL, NPM_FETCH_TIMEOUT = 5000, CACHE_DIR, VERSION_FILE, USER_CONFIG_DIR, USER_OPENCODE_CONFIG, USER_OPENCODE_CONFIG_JSONC, INSTALLED_PACKAGE_JSON;
|
|
7989
8044
|
var init_constants3 = __esm(() => {
|
|
7990
8045
|
init_data_path();
|
|
7991
8046
|
init_opencode_config_dir();
|
|
8047
|
+
init_plugin_identity();
|
|
8048
|
+
PACKAGE_NAME2 = PLUGIN_NAME;
|
|
7992
8049
|
NPM_REGISTRY_URL = `https://registry.npmjs.org/-/package/${PACKAGE_NAME2}/dist-tags`;
|
|
7993
8050
|
CACHE_DIR = getOpenCodeCacheDir();
|
|
7994
8051
|
VERSION_FILE = path4.join(CACHE_DIR, "version");
|
|
@@ -8129,15 +8186,15 @@ function findPluginEntry(directory) {
|
|
|
8129
8186
|
const content = fs7.readFileSync(configPath, "utf-8");
|
|
8130
8187
|
const config2 = JSON.parse(stripJsonComments(content));
|
|
8131
8188
|
const plugins = config2.plugin ?? [];
|
|
8132
|
-
|
|
8133
|
-
|
|
8189
|
+
const managedEntry = findManagedPluginEntry(plugins);
|
|
8190
|
+
if (managedEntry) {
|
|
8191
|
+
const entry = plugins[managedEntry.index];
|
|
8192
|
+
if (entry === managedEntry.packageName) {
|
|
8134
8193
|
return { entry, isPinned: false, pinnedVersion: null, configPath };
|
|
8135
8194
|
}
|
|
8136
|
-
|
|
8137
|
-
|
|
8138
|
-
|
|
8139
|
-
return { entry, isPinned, pinnedVersion, configPath };
|
|
8140
|
-
}
|
|
8195
|
+
const pinnedVersion = entry.slice(managedEntry.packageName.length + 1);
|
|
8196
|
+
const isPinned = EXACT_SEMVER_REGEX.test(pinnedVersion.trim());
|
|
8197
|
+
return { entry, isPinned, pinnedVersion, configPath };
|
|
8141
8198
|
}
|
|
8142
8199
|
} catch {
|
|
8143
8200
|
continue;
|
|
@@ -8147,7 +8204,7 @@ function findPluginEntry(directory) {
|
|
|
8147
8204
|
}
|
|
8148
8205
|
var EXACT_SEMVER_REGEX;
|
|
8149
8206
|
var init_plugin_entry = __esm(() => {
|
|
8150
|
-
|
|
8207
|
+
init_plugin_identity();
|
|
8151
8208
|
init_config_paths();
|
|
8152
8209
|
EXACT_SEMVER_REGEX = /^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/;
|
|
8153
8210
|
});
|
|
@@ -8808,13 +8865,13 @@ var {
|
|
|
8808
8865
|
// package.json
|
|
8809
8866
|
var package_default = {
|
|
8810
8867
|
name: "evil-omo",
|
|
8811
|
-
version: "3.11.
|
|
8868
|
+
version: "3.11.4",
|
|
8812
8869
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
8813
8870
|
main: "dist/index.js",
|
|
8814
8871
|
types: "dist/index.d.ts",
|
|
8815
8872
|
type: "module",
|
|
8816
8873
|
bin: {
|
|
8817
|
-
"evil-omo": "bin/
|
|
8874
|
+
"evil-omo": "bin/evil-omo.js"
|
|
8818
8875
|
},
|
|
8819
8876
|
files: [
|
|
8820
8877
|
"dist",
|
|
@@ -8826,7 +8883,7 @@ var package_default = {
|
|
|
8826
8883
|
types: "./dist/index.d.ts",
|
|
8827
8884
|
import: "./dist/index.js"
|
|
8828
8885
|
},
|
|
8829
|
-
"./schema.json": "./dist/
|
|
8886
|
+
"./schema.json": "./dist/evil-omo.schema.json"
|
|
8830
8887
|
},
|
|
8831
8888
|
scripts: {
|
|
8832
8889
|
build: "bun build src/index.ts --outdir dist --target bun --format esm --external @ast-grep/napi && tsc --emitDeclarationOnly && bun build src/cli/index.ts --outdir dist/cli --target bun --format esm --external @ast-grep/napi && bun run build:schema",
|
|
@@ -8884,17 +8941,17 @@ var package_default = {
|
|
|
8884
8941
|
typescript: "^5.7.3"
|
|
8885
8942
|
},
|
|
8886
8943
|
optionalDependencies: {
|
|
8887
|
-
"
|
|
8888
|
-
"
|
|
8889
|
-
"
|
|
8890
|
-
"
|
|
8891
|
-
"
|
|
8892
|
-
"
|
|
8893
|
-
"
|
|
8894
|
-
"
|
|
8895
|
-
"
|
|
8896
|
-
"
|
|
8897
|
-
"
|
|
8944
|
+
"evil-omo-darwin-arm64": "3.11.4",
|
|
8945
|
+
"evil-omo-darwin-x64": "3.11.4",
|
|
8946
|
+
"evil-omo-darwin-x64-baseline": "3.11.4",
|
|
8947
|
+
"evil-omo-linux-x64": "3.11.4",
|
|
8948
|
+
"evil-omo-linux-x64-baseline": "3.11.4",
|
|
8949
|
+
"evil-omo-linux-arm64": "3.11.4",
|
|
8950
|
+
"evil-omo-linux-x64-musl": "3.11.4",
|
|
8951
|
+
"evil-omo-linux-x64-musl-baseline": "3.11.4",
|
|
8952
|
+
"evil-omo-linux-arm64-musl": "3.11.4",
|
|
8953
|
+
"evil-omo-windows-x64": "3.11.4",
|
|
8954
|
+
"evil-omo-windows-x64-baseline": "3.11.4"
|
|
8898
8955
|
},
|
|
8899
8956
|
overrides: {
|
|
8900
8957
|
"@opencode-ai/sdk": "^1.2.24"
|
|
@@ -9065,7 +9122,7 @@ async function runCliInstaller(args, version) {
|
|
|
9065
9122
|
console.log(` ${SYMBOLS.bullet} ${err}`);
|
|
9066
9123
|
}
|
|
9067
9124
|
console.log();
|
|
9068
|
-
printInfo("Usage: bunx
|
|
9125
|
+
printInfo("Usage: bunx evil-omo install --no-tui --claude=<no|yes|max20> --gemini=<no|yes> --copilot=<no|yes>");
|
|
9069
9126
|
console.log();
|
|
9070
9127
|
return 1;
|
|
9071
9128
|
}
|
|
@@ -9088,14 +9145,14 @@ async function runCliInstaller(args, version) {
|
|
|
9088
9145
|
printInfo(`Current config: Claude=${initial.claude}, Gemini=${initial.gemini}`);
|
|
9089
9146
|
}
|
|
9090
9147
|
const config = argsToConfig(args);
|
|
9091
|
-
printStep(step++, totalSteps, "Adding
|
|
9148
|
+
printStep(step++, totalSteps, "Adding evil-omo plugin...");
|
|
9092
9149
|
const pluginResult = await addPluginToOpenCodeConfig(version);
|
|
9093
9150
|
if (!pluginResult.success) {
|
|
9094
9151
|
printError(`Failed: ${pluginResult.error}`);
|
|
9095
9152
|
return 1;
|
|
9096
9153
|
}
|
|
9097
9154
|
printSuccess(`Plugin ${isUpdate ? "verified" : "added"} ${SYMBOLS.arrow} ${import_picocolors2.default.dim(pluginResult.configPath)}`);
|
|
9098
|
-
printStep(step++, totalSteps, "Writing
|
|
9155
|
+
printStep(step++, totalSteps, "Writing evil-omo configuration...");
|
|
9099
9156
|
const omoResult = writeOmoConfig(config);
|
|
9100
9157
|
if (!omoResult.success) {
|
|
9101
9158
|
printError(`Failed: ${omoResult.error}`);
|
|
@@ -9861,7 +9918,7 @@ async function runTuiInstaller(args, version) {
|
|
|
9861
9918
|
const config = await promptInstallConfig(detected);
|
|
9862
9919
|
if (!config)
|
|
9863
9920
|
return 1;
|
|
9864
|
-
spinner.start("Adding
|
|
9921
|
+
spinner.start("Adding evil-omo to OpenCode config");
|
|
9865
9922
|
const pluginResult = await addPluginToOpenCodeConfig(version);
|
|
9866
9923
|
if (!pluginResult.success) {
|
|
9867
9924
|
spinner.stop(`Failed to add plugin: ${pluginResult.error}`);
|
|
@@ -9869,7 +9926,7 @@ async function runTuiInstaller(args, version) {
|
|
|
9869
9926
|
return 1;
|
|
9870
9927
|
}
|
|
9871
9928
|
spinner.stop(`Plugin added to ${import_picocolors4.default.cyan(pluginResult.configPath)}`);
|
|
9872
|
-
spinner.start("Writing
|
|
9929
|
+
spinner.start("Writing evil-omo configuration");
|
|
9873
9930
|
const omoResult = writeOmoConfig(config);
|
|
9874
9931
|
if (!omoResult.success) {
|
|
9875
9932
|
spinner.stop(`Failed to write config: ${omoResult.error}`);
|
|
@@ -24564,7 +24621,7 @@ var WebsearchConfigSchema = exports_external.object({
|
|
|
24564
24621
|
provider: WebsearchProviderSchema.optional()
|
|
24565
24622
|
});
|
|
24566
24623
|
|
|
24567
|
-
// src/config/schema/
|
|
24624
|
+
// src/config/schema/evil-omo-config.ts
|
|
24568
24625
|
var OhMyOpenCodeConfigSchema = exports_external.object({
|
|
24569
24626
|
$schema: exports_external.string().optional(),
|
|
24570
24627
|
new_task_system_enabled: exports_external.boolean().optional(),
|
|
@@ -24719,12 +24776,10 @@ function mergeConfigs(base, override) {
|
|
|
24719
24776
|
}
|
|
24720
24777
|
function loadPluginConfig(directory, ctx) {
|
|
24721
24778
|
const configDir = getOpenCodeConfigDir({ binary: "opencode" });
|
|
24722
|
-
const
|
|
24723
|
-
const
|
|
24724
|
-
const
|
|
24725
|
-
const
|
|
24726
|
-
const projectDetected = detectConfigFile(projectBasePath);
|
|
24727
|
-
const projectConfigPath = projectDetected.format !== "none" ? projectDetected.path : projectBasePath + ".json";
|
|
24779
|
+
const userDetected = detectManagedConfigFile(configDir);
|
|
24780
|
+
const userConfigPath = userDetected.path;
|
|
24781
|
+
const projectDetected = detectManagedConfigFile(path3.join(directory, ".opencode"));
|
|
24782
|
+
const projectConfigPath = projectDetected.path;
|
|
24728
24783
|
let config2 = loadConfigFromPath(userConfigPath, ctx) ?? {};
|
|
24729
24784
|
const projectConfig = loadConfigFromPath(projectConfigPath, ctx);
|
|
24730
24785
|
if (projectConfig) {
|
|
@@ -26190,7 +26245,7 @@ var import_picocolors9 = __toESM(require_picocolors(), 1);
|
|
|
26190
26245
|
|
|
26191
26246
|
// src/cli/run/opencode-binary-resolver.ts
|
|
26192
26247
|
init_spawn_with_windows_hide();
|
|
26193
|
-
import { delimiter, dirname, join as
|
|
26248
|
+
import { delimiter, dirname, join as join9 } from "path";
|
|
26194
26249
|
var OPENCODE_COMMANDS = ["opencode", "opencode-desktop"];
|
|
26195
26250
|
var WINDOWS_SUFFIXES = ["", ".exe", ".cmd", ".bat", ".ps1"];
|
|
26196
26251
|
function getCommandCandidates(platform) {
|
|
@@ -26213,7 +26268,7 @@ function collectCandidateBinaryPaths(pathEnv, which = Bun.which, platform = proc
|
|
|
26213
26268
|
}
|
|
26214
26269
|
for (const entry of (pathEnv ?? "").split(delimiter).filter(Boolean)) {
|
|
26215
26270
|
for (const command of commandCandidates) {
|
|
26216
|
-
addCandidate(
|
|
26271
|
+
addCandidate(join9(entry, command));
|
|
26217
26272
|
}
|
|
26218
26273
|
}
|
|
26219
26274
|
return candidates;
|
|
@@ -26347,6 +26402,7 @@ async function createServerConnection(options) {
|
|
|
26347
26402
|
|
|
26348
26403
|
// src/cli/run/session-resolver.ts
|
|
26349
26404
|
var import_picocolors10 = __toESM(require_picocolors(), 1);
|
|
26405
|
+
init_plugin_identity();
|
|
26350
26406
|
var SESSION_CREATE_MAX_RETRIES = 3;
|
|
26351
26407
|
var SESSION_CREATE_RETRY_DELAY_MS = 1000;
|
|
26352
26408
|
async function resolveSession(options) {
|
|
@@ -26364,7 +26420,7 @@ async function resolveSession(options) {
|
|
|
26364
26420
|
for (let attempt = 1;attempt <= SESSION_CREATE_MAX_RETRIES; attempt++) {
|
|
26365
26421
|
const res = await client3.session.create({
|
|
26366
26422
|
body: {
|
|
26367
|
-
title:
|
|
26423
|
+
title: `${PLUGIN_NAME} run`,
|
|
26368
26424
|
permission: [
|
|
26369
26425
|
{ permission: "question", action: "deny", pattern: "*" }
|
|
26370
26426
|
]
|
|
@@ -26580,9 +26636,9 @@ var NOTEPAD_DIR = "notepads";
|
|
|
26580
26636
|
var NOTEPAD_BASE_PATH = `${BOULDER_DIR}/${NOTEPAD_DIR}`;
|
|
26581
26637
|
// src/features/boulder-state/storage.ts
|
|
26582
26638
|
import { existsSync as existsSync11, readFileSync as readFileSync9, writeFileSync as writeFileSync5, mkdirSync as mkdirSync3, readdirSync } from "fs";
|
|
26583
|
-
import { dirname as dirname2, join as
|
|
26639
|
+
import { dirname as dirname2, join as join10, basename } from "path";
|
|
26584
26640
|
function getBoulderFilePath(directory) {
|
|
26585
|
-
return
|
|
26641
|
+
return join10(directory, BOULDER_DIR, BOULDER_FILE);
|
|
26586
26642
|
}
|
|
26587
26643
|
function readBoulderState(directory) {
|
|
26588
26644
|
const filePath = getBoulderFilePath(directory);
|
|
@@ -26626,9 +26682,9 @@ function getPlanProgress(planPath) {
|
|
|
26626
26682
|
var CONTINUATION_MARKER_DIR = ".sisyphus/run-continuation";
|
|
26627
26683
|
// src/features/run-continuation-state/storage.ts
|
|
26628
26684
|
import { existsSync as existsSync12, mkdirSync as mkdirSync4, readFileSync as readFileSync10, rmSync, writeFileSync as writeFileSync6 } from "fs";
|
|
26629
|
-
import { join as
|
|
26685
|
+
import { join as join11 } from "path";
|
|
26630
26686
|
function getMarkerPath(directory, sessionID) {
|
|
26631
|
-
return
|
|
26687
|
+
return join11(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
26632
26688
|
}
|
|
26633
26689
|
function readContinuationMarker(directory, sessionID) {
|
|
26634
26690
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
@@ -26661,7 +26717,7 @@ function getActiveContinuationMarkerReason(marker) {
|
|
|
26661
26717
|
// src/hooks/ralph-loop/storage.ts
|
|
26662
26718
|
init_frontmatter();
|
|
26663
26719
|
import { existsSync as existsSync13, readFileSync as readFileSync11, writeFileSync as writeFileSync7, unlinkSync, mkdirSync as mkdirSync5 } from "fs";
|
|
26664
|
-
import { dirname as dirname3, join as
|
|
26720
|
+
import { dirname as dirname3, join as join12 } from "path";
|
|
26665
26721
|
|
|
26666
26722
|
// src/hooks/ralph-loop/constants.ts
|
|
26667
26723
|
var DEFAULT_STATE_FILE = ".sisyphus/ralph-loop.local.md";
|
|
@@ -26670,7 +26726,7 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
26670
26726
|
|
|
26671
26727
|
// src/hooks/ralph-loop/storage.ts
|
|
26672
26728
|
function getStateFilePath(directory, customPath) {
|
|
26673
|
-
return customPath ?
|
|
26729
|
+
return customPath ? join12(directory, customPath) : join12(directory, DEFAULT_STATE_FILE);
|
|
26674
26730
|
}
|
|
26675
26731
|
function readState(directory, customPath) {
|
|
26676
26732
|
const filePath = getStateFilePath(directory, customPath);
|
|
@@ -27212,7 +27268,7 @@ var SYMBOLS2 = {
|
|
|
27212
27268
|
function formatVersionOutput(info) {
|
|
27213
27269
|
const lines = [];
|
|
27214
27270
|
lines.push("");
|
|
27215
|
-
lines.push(import_picocolors15.default.bold(import_picocolors15.default.white("
|
|
27271
|
+
lines.push(import_picocolors15.default.bold(import_picocolors15.default.white("evil-omo Version Information")));
|
|
27216
27272
|
lines.push(import_picocolors15.default.dim("\u2500".repeat(50)));
|
|
27217
27273
|
lines.push("");
|
|
27218
27274
|
if (info.currentVersion) {
|
|
@@ -27230,7 +27286,7 @@ function formatVersionOutput(info) {
|
|
|
27230
27286
|
break;
|
|
27231
27287
|
case "outdated":
|
|
27232
27288
|
lines.push(` ${SYMBOLS2.warn} ${import_picocolors15.default.yellow("Update available")}`);
|
|
27233
|
-
lines.push(` ${import_picocolors15.default.dim("Run:")} ${import_picocolors15.default.cyan("cd ~/.config/opencode && bun update
|
|
27289
|
+
lines.push(` ${import_picocolors15.default.dim("Run:")} ${import_picocolors15.default.cyan("cd ~/.config/opencode && bun update evil-omo")}`);
|
|
27234
27290
|
break;
|
|
27235
27291
|
case "local-dev":
|
|
27236
27292
|
lines.push(` ${SYMBOLS2.dev} ${import_picocolors15.default.cyan("Running in local development mode")}`);
|
|
@@ -27345,6 +27401,7 @@ async function getLocalVersion(options = {}) {
|
|
|
27345
27401
|
}
|
|
27346
27402
|
}
|
|
27347
27403
|
// src/cli/doctor/constants.ts
|
|
27404
|
+
init_plugin_identity();
|
|
27348
27405
|
var import_picocolors16 = __toESM(require_picocolors(), 1);
|
|
27349
27406
|
var SYMBOLS3 = {
|
|
27350
27407
|
check: import_picocolors16.default.green("\u2713"),
|
|
@@ -27378,7 +27435,7 @@ var EXIT_CODES = {
|
|
|
27378
27435
|
FAILURE: 1
|
|
27379
27436
|
};
|
|
27380
27437
|
var MIN_OPENCODE_VERSION = "1.0.150";
|
|
27381
|
-
var PACKAGE_NAME3 =
|
|
27438
|
+
var PACKAGE_NAME3 = PLUGIN_NAME;
|
|
27382
27439
|
var OPENCODE_BINARIES2 = ["opencode", "opencode-desktop"];
|
|
27383
27440
|
|
|
27384
27441
|
// src/cli/doctor/checks/system.ts
|
|
@@ -27388,24 +27445,24 @@ import { existsSync as existsSync23, readFileSync as readFileSync21 } from "fs";
|
|
|
27388
27445
|
init_spawn_with_windows_hide();
|
|
27389
27446
|
import { existsSync as existsSync20 } from "fs";
|
|
27390
27447
|
import { homedir as homedir5 } from "os";
|
|
27391
|
-
import { join as
|
|
27448
|
+
import { join as join18 } from "path";
|
|
27392
27449
|
function getDesktopAppPaths(platform) {
|
|
27393
27450
|
const home = homedir5();
|
|
27394
27451
|
switch (platform) {
|
|
27395
27452
|
case "darwin":
|
|
27396
27453
|
return [
|
|
27397
27454
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
27398
|
-
|
|
27455
|
+
join18(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
27399
27456
|
];
|
|
27400
27457
|
case "win32": {
|
|
27401
27458
|
const programFiles = process.env.ProgramFiles;
|
|
27402
27459
|
const localAppData = process.env.LOCALAPPDATA;
|
|
27403
27460
|
const paths = [];
|
|
27404
27461
|
if (programFiles) {
|
|
27405
|
-
paths.push(
|
|
27462
|
+
paths.push(join18(programFiles, "OpenCode", "OpenCode.exe"));
|
|
27406
27463
|
}
|
|
27407
27464
|
if (localAppData) {
|
|
27408
|
-
paths.push(
|
|
27465
|
+
paths.push(join18(localAppData, "OpenCode", "OpenCode.exe"));
|
|
27409
27466
|
}
|
|
27410
27467
|
return paths;
|
|
27411
27468
|
}
|
|
@@ -27413,8 +27470,8 @@ function getDesktopAppPaths(platform) {
|
|
|
27413
27470
|
return [
|
|
27414
27471
|
"/usr/bin/opencode",
|
|
27415
27472
|
"/usr/lib/opencode/opencode",
|
|
27416
|
-
|
|
27417
|
-
|
|
27473
|
+
join18(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
27474
|
+
join18(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
27418
27475
|
];
|
|
27419
27476
|
default:
|
|
27420
27477
|
return [];
|
|
@@ -27554,21 +27611,21 @@ init_checker();
|
|
|
27554
27611
|
init_auto_update_checker();
|
|
27555
27612
|
import { existsSync as existsSync22, readFileSync as readFileSync20 } from "fs";
|
|
27556
27613
|
import { homedir as homedir6 } from "os";
|
|
27557
|
-
import { join as
|
|
27614
|
+
import { join as join19 } from "path";
|
|
27558
27615
|
init_shared();
|
|
27559
27616
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
27560
27617
|
if (platform === "darwin")
|
|
27561
|
-
return
|
|
27618
|
+
return join19(homedir6(), "Library", "Caches");
|
|
27562
27619
|
if (platform === "win32")
|
|
27563
|
-
return process.env.LOCALAPPDATA ??
|
|
27564
|
-
return
|
|
27620
|
+
return process.env.LOCALAPPDATA ?? join19(homedir6(), "AppData", "Local");
|
|
27621
|
+
return join19(homedir6(), ".cache");
|
|
27565
27622
|
}
|
|
27566
27623
|
function resolveOpenCodeCacheDir() {
|
|
27567
27624
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
27568
27625
|
if (xdgCacheHome)
|
|
27569
|
-
return
|
|
27626
|
+
return join19(xdgCacheHome, "opencode");
|
|
27570
27627
|
const fromShared = getOpenCodeCacheDir();
|
|
27571
|
-
const platformDefault =
|
|
27628
|
+
const platformDefault = join19(getPlatformDefaultCacheDir(), "opencode");
|
|
27572
27629
|
if (existsSync22(fromShared) || !existsSync22(platformDefault))
|
|
27573
27630
|
return fromShared;
|
|
27574
27631
|
return platformDefault;
|
|
@@ -27596,12 +27653,12 @@ function getLoadedPluginVersion() {
|
|
|
27596
27653
|
{
|
|
27597
27654
|
cacheDir: configPaths.configDir,
|
|
27598
27655
|
cachePackagePath: configPaths.packageJson,
|
|
27599
|
-
installedPackagePath:
|
|
27656
|
+
installedPackagePath: join19(configPaths.configDir, "node_modules", PACKAGE_NAME3, "package.json")
|
|
27600
27657
|
},
|
|
27601
27658
|
{
|
|
27602
27659
|
cacheDir,
|
|
27603
|
-
cachePackagePath:
|
|
27604
|
-
installedPackagePath:
|
|
27660
|
+
cachePackagePath: join19(cacheDir, "package.json"),
|
|
27661
|
+
installedPackagePath: join19(cacheDir, "node_modules", PACKAGE_NAME3, "package.json")
|
|
27605
27662
|
}
|
|
27606
27663
|
];
|
|
27607
27664
|
const selectedCandidate = candidates.find((candidate) => existsSync22(candidate.installedPackagePath)) ?? candidates[0];
|
|
@@ -27696,9 +27753,9 @@ async function checkSystem() {
|
|
|
27696
27753
|
}
|
|
27697
27754
|
if (!pluginInfo.registered) {
|
|
27698
27755
|
issues.push({
|
|
27699
|
-
title:
|
|
27756
|
+
title: `${PACKAGE_NAME3} is not registered`,
|
|
27700
27757
|
description: "Plugin entry is missing from OpenCode configuration.",
|
|
27701
|
-
fix:
|
|
27758
|
+
fix: `Run: bunx ${PACKAGE_NAME3} install`,
|
|
27702
27759
|
severity: "error",
|
|
27703
27760
|
affects: ["all agents"]
|
|
27704
27761
|
});
|
|
@@ -27716,7 +27773,7 @@ async function checkSystem() {
|
|
|
27716
27773
|
issues.push({
|
|
27717
27774
|
title: "Loaded plugin is outdated",
|
|
27718
27775
|
description: `Loaded ${systemInfo.loadedVersion}, latest ${latestVersion}.`,
|
|
27719
|
-
fix: `Update: cd "${loadedInfo.cacheDir}" && bun add
|
|
27776
|
+
fix: `Update: cd "${loadedInfo.cacheDir}" && bun add ${PACKAGE_NAME3}@${installTag}`,
|
|
27720
27777
|
severity: "warning",
|
|
27721
27778
|
affects: ["plugin features"]
|
|
27722
27779
|
});
|
|
@@ -27738,22 +27795,23 @@ async function checkSystem() {
|
|
|
27738
27795
|
|
|
27739
27796
|
// src/cli/doctor/checks/config.ts
|
|
27740
27797
|
import { readFileSync as readFileSync24 } from "fs";
|
|
27741
|
-
import { join as
|
|
27798
|
+
import { join as join23 } from "path";
|
|
27742
27799
|
init_shared();
|
|
27800
|
+
init_plugin_identity();
|
|
27743
27801
|
|
|
27744
27802
|
// src/cli/doctor/checks/model-resolution-cache.ts
|
|
27745
27803
|
init_shared();
|
|
27746
27804
|
import { existsSync as existsSync24, readFileSync as readFileSync22 } from "fs";
|
|
27747
27805
|
import { homedir as homedir7 } from "os";
|
|
27748
|
-
import { join as
|
|
27806
|
+
import { join as join20 } from "path";
|
|
27749
27807
|
function getOpenCodeCacheDir2() {
|
|
27750
27808
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
27751
27809
|
if (xdgCache)
|
|
27752
|
-
return
|
|
27753
|
-
return
|
|
27810
|
+
return join20(xdgCache, "opencode");
|
|
27811
|
+
return join20(homedir7(), ".cache", "opencode");
|
|
27754
27812
|
}
|
|
27755
27813
|
function loadAvailableModelsFromCache() {
|
|
27756
|
-
const cacheFile =
|
|
27814
|
+
const cacheFile = join20(getOpenCodeCacheDir2(), "models.json");
|
|
27757
27815
|
if (!existsSync24(cacheFile)) {
|
|
27758
27816
|
return { providers: [], modelCount: 0, cacheExists: false };
|
|
27759
27817
|
}
|
|
@@ -27779,13 +27837,13 @@ init_model_requirements();
|
|
|
27779
27837
|
|
|
27780
27838
|
// src/cli/doctor/checks/model-resolution-config.ts
|
|
27781
27839
|
init_shared();
|
|
27840
|
+
init_plugin_identity();
|
|
27782
27841
|
import { readFileSync as readFileSync23 } from "fs";
|
|
27783
|
-
import { join as
|
|
27784
|
-
var
|
|
27785
|
-
var
|
|
27786
|
-
var PROJECT_CONFIG_BASE = join20(process.cwd(), ".opencode", PACKAGE_NAME4);
|
|
27842
|
+
import { join as join21 } from "path";
|
|
27843
|
+
var USER_CONFIG_DIR2 = getOpenCodeConfigPaths({ binary: "opencode", version: null }).configDir;
|
|
27844
|
+
var PROJECT_CONFIG_DIR = join21(process.cwd(), ".opencode");
|
|
27787
27845
|
function loadOmoConfig() {
|
|
27788
|
-
const projectDetected =
|
|
27846
|
+
const projectDetected = detectManagedConfigFile(PROJECT_CONFIG_DIR);
|
|
27789
27847
|
if (projectDetected.format !== "none") {
|
|
27790
27848
|
try {
|
|
27791
27849
|
const content = readFileSync23(projectDetected.path, "utf-8");
|
|
@@ -27794,7 +27852,7 @@ function loadOmoConfig() {
|
|
|
27794
27852
|
return null;
|
|
27795
27853
|
}
|
|
27796
27854
|
}
|
|
27797
|
-
const userDetected =
|
|
27855
|
+
const userDetected = detectManagedConfigFile(USER_CONFIG_DIR2);
|
|
27798
27856
|
if (userDetected.format !== "none") {
|
|
27799
27857
|
try {
|
|
27800
27858
|
const content = readFileSync23(userDetected.path, "utf-8");
|
|
@@ -27808,7 +27866,7 @@ function loadOmoConfig() {
|
|
|
27808
27866
|
|
|
27809
27867
|
// src/cli/doctor/checks/model-resolution-details.ts
|
|
27810
27868
|
init_shared();
|
|
27811
|
-
import { join as
|
|
27869
|
+
import { join as join22 } from "path";
|
|
27812
27870
|
|
|
27813
27871
|
// src/cli/doctor/checks/model-resolution-variant.ts
|
|
27814
27872
|
function formatModelWithVariant(model, variant) {
|
|
@@ -27847,7 +27905,7 @@ function getCategoryEffectiveVariant(categoryName, requirement, config2) {
|
|
|
27847
27905
|
// src/cli/doctor/checks/model-resolution-details.ts
|
|
27848
27906
|
function buildModelResolutionDetails(options) {
|
|
27849
27907
|
const details = [];
|
|
27850
|
-
const cacheFile =
|
|
27908
|
+
const cacheFile = join22(getOpenCodeCacheDir(), "models.json");
|
|
27851
27909
|
details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
|
|
27852
27910
|
details.push("");
|
|
27853
27911
|
if (options.available.cacheExists) {
|
|
@@ -27959,13 +28017,11 @@ async function checkModels() {
|
|
|
27959
28017
|
}
|
|
27960
28018
|
|
|
27961
28019
|
// src/cli/doctor/checks/config.ts
|
|
27962
|
-
var USER_CONFIG_BASE2 = join22(getOpenCodeConfigDir({ binary: "opencode" }), PACKAGE_NAME3);
|
|
27963
|
-
var PROJECT_CONFIG_BASE2 = join22(process.cwd(), ".opencode", PACKAGE_NAME3);
|
|
27964
28020
|
function findConfigPath() {
|
|
27965
|
-
const projectConfig =
|
|
28021
|
+
const projectConfig = detectManagedConfigFile(join23(process.cwd(), ".opencode"));
|
|
27966
28022
|
if (projectConfig.format !== "none")
|
|
27967
28023
|
return projectConfig.path;
|
|
27968
|
-
const userConfig =
|
|
28024
|
+
const userConfig = detectManagedConfigFile(getOpenCodeConfigDir({ binary: "opencode" }));
|
|
27969
28025
|
if (userConfig.format !== "none")
|
|
27970
28026
|
return userConfig.path;
|
|
27971
28027
|
return null;
|
|
@@ -28082,7 +28138,7 @@ async function checkConfig() {
|
|
|
28082
28138
|
init_spawn_with_windows_hide();
|
|
28083
28139
|
import { existsSync as existsSync25 } from "fs";
|
|
28084
28140
|
import { createRequire } from "module";
|
|
28085
|
-
import { dirname as dirname6, join as
|
|
28141
|
+
import { dirname as dirname6, join as join24 } from "path";
|
|
28086
28142
|
async function checkBinaryExists(binary2) {
|
|
28087
28143
|
try {
|
|
28088
28144
|
const path10 = Bun.which(binary2);
|
|
@@ -28139,11 +28195,11 @@ async function checkAstGrepNapi() {
|
|
|
28139
28195
|
};
|
|
28140
28196
|
} catch {
|
|
28141
28197
|
const { existsSync: existsSync26 } = await import("fs");
|
|
28142
|
-
const { join:
|
|
28198
|
+
const { join: join25 } = await import("path");
|
|
28143
28199
|
const { homedir: homedir8 } = await import("os");
|
|
28144
28200
|
const pathsToCheck = [
|
|
28145
|
-
|
|
28146
|
-
|
|
28201
|
+
join25(homedir8(), ".config", "opencode", "node_modules", "@ast-grep", "napi"),
|
|
28202
|
+
join25(process.cwd(), "node_modules", "@ast-grep", "napi")
|
|
28147
28203
|
];
|
|
28148
28204
|
for (const napiPath of pathsToCheck) {
|
|
28149
28205
|
if (existsSync26(napiPath)) {
|
|
@@ -28171,7 +28227,7 @@ function findCommentCheckerPackageBinary() {
|
|
|
28171
28227
|
try {
|
|
28172
28228
|
const require2 = createRequire(import.meta.url);
|
|
28173
28229
|
const pkgPath = require2.resolve("@code-yeongyu/comment-checker/package.json");
|
|
28174
|
-
const binaryPath =
|
|
28230
|
+
const binaryPath = join24(dirname6(pkgPath), "bin", binaryName);
|
|
28175
28231
|
if (existsSync25(binaryPath))
|
|
28176
28232
|
return binaryPath;
|
|
28177
28233
|
} catch {}
|
|
@@ -28330,9 +28386,10 @@ var BUILTIN_SERVERS = {
|
|
|
28330
28386
|
};
|
|
28331
28387
|
// src/tools/lsp/server-config-loader.ts
|
|
28332
28388
|
import { existsSync as existsSync26, readFileSync as readFileSync25 } from "fs";
|
|
28333
|
-
import { join as
|
|
28389
|
+
import { join as join25 } from "path";
|
|
28334
28390
|
init_shared();
|
|
28335
28391
|
init_jsonc_parser();
|
|
28392
|
+
init_plugin_identity();
|
|
28336
28393
|
function loadJsonFile(path10) {
|
|
28337
28394
|
if (!existsSync26(path10))
|
|
28338
28395
|
return null;
|
|
@@ -28346,9 +28403,9 @@ function getConfigPaths2() {
|
|
|
28346
28403
|
const cwd = process.cwd();
|
|
28347
28404
|
const configDir = getOpenCodeConfigDir({ binary: "opencode" });
|
|
28348
28405
|
return {
|
|
28349
|
-
project:
|
|
28350
|
-
user:
|
|
28351
|
-
opencode: detectConfigFile(
|
|
28406
|
+
project: detectManagedConfigFile(join25(cwd, ".opencode")).path,
|
|
28407
|
+
user: detectManagedConfigFile(configDir).path,
|
|
28408
|
+
opencode: detectConfigFile(join25(configDir, "opencode")).path
|
|
28352
28409
|
};
|
|
28353
28410
|
}
|
|
28354
28411
|
function loadAllConfigs() {
|
|
@@ -28418,20 +28475,20 @@ function getMergedServers() {
|
|
|
28418
28475
|
|
|
28419
28476
|
// src/tools/lsp/server-installation.ts
|
|
28420
28477
|
import { existsSync as existsSync27 } from "fs";
|
|
28421
|
-
import { delimiter as delimiter2, join as
|
|
28478
|
+
import { delimiter as delimiter2, join as join27 } from "path";
|
|
28422
28479
|
|
|
28423
28480
|
// src/tools/lsp/server-path-bases.ts
|
|
28424
28481
|
init_shared();
|
|
28425
|
-
import { join as
|
|
28482
|
+
import { join as join26 } from "path";
|
|
28426
28483
|
function getLspServerAdditionalPathBases(workingDirectory) {
|
|
28427
28484
|
const configDir = getOpenCodeConfigDir({ binary: "opencode" });
|
|
28428
|
-
const dataDir =
|
|
28485
|
+
const dataDir = join26(getDataDir(), "opencode");
|
|
28429
28486
|
return [
|
|
28430
|
-
|
|
28431
|
-
|
|
28432
|
-
|
|
28433
|
-
|
|
28434
|
-
|
|
28487
|
+
join26(workingDirectory, "node_modules", ".bin"),
|
|
28488
|
+
join26(configDir, "bin"),
|
|
28489
|
+
join26(configDir, "node_modules", ".bin"),
|
|
28490
|
+
join26(dataDir, "bin"),
|
|
28491
|
+
join26(dataDir, "bin", "node_modules", ".bin")
|
|
28435
28492
|
];
|
|
28436
28493
|
}
|
|
28437
28494
|
|
|
@@ -28462,14 +28519,14 @@ function isServerInstalled(command) {
|
|
|
28462
28519
|
const paths = pathEnv.split(delimiter2);
|
|
28463
28520
|
for (const p2 of paths) {
|
|
28464
28521
|
for (const suffix of exts) {
|
|
28465
|
-
if (existsSync27(
|
|
28522
|
+
if (existsSync27(join27(p2, cmd + suffix))) {
|
|
28466
28523
|
return true;
|
|
28467
28524
|
}
|
|
28468
28525
|
}
|
|
28469
28526
|
}
|
|
28470
28527
|
for (const base of getLspServerAdditionalPathBases(process.cwd())) {
|
|
28471
28528
|
for (const suffix of exts) {
|
|
28472
|
-
if (existsSync27(
|
|
28529
|
+
if (existsSync27(join27(base, cmd + suffix))) {
|
|
28473
28530
|
return true;
|
|
28474
28531
|
}
|
|
28475
28532
|
}
|
|
@@ -28533,13 +28590,13 @@ function getInstalledLspServers() {
|
|
|
28533
28590
|
init_shared();
|
|
28534
28591
|
import { existsSync as existsSync28, readFileSync as readFileSync26 } from "fs";
|
|
28535
28592
|
import { homedir as homedir8 } from "os";
|
|
28536
|
-
import { join as
|
|
28593
|
+
import { join as join28 } from "path";
|
|
28537
28594
|
var BUILTIN_MCP_SERVERS = ["context7", "grep_app"];
|
|
28538
28595
|
function getMcpConfigPaths() {
|
|
28539
28596
|
return [
|
|
28540
|
-
|
|
28541
|
-
|
|
28542
|
-
|
|
28597
|
+
join28(homedir8(), ".claude", ".mcp.json"),
|
|
28598
|
+
join28(process.cwd(), ".mcp.json"),
|
|
28599
|
+
join28(process.cwd(), ".claude", ".mcp.json")
|
|
28543
28600
|
];
|
|
28544
28601
|
}
|
|
28545
28602
|
function loadUserMcpConfig() {
|
|
@@ -28748,6 +28805,7 @@ function formatIssue(issue2, index) {
|
|
|
28748
28805
|
}
|
|
28749
28806
|
|
|
28750
28807
|
// src/cli/doctor/format-default.ts
|
|
28808
|
+
init_plugin_identity();
|
|
28751
28809
|
function formatDefault(result) {
|
|
28752
28810
|
const lines = [];
|
|
28753
28811
|
lines.push(formatHeader());
|
|
@@ -28755,7 +28813,7 @@ function formatDefault(result) {
|
|
|
28755
28813
|
if (allIssues.length === 0) {
|
|
28756
28814
|
const opencodeVer = result.systemInfo.opencodeVersion ?? "unknown";
|
|
28757
28815
|
const pluginVer = result.systemInfo.pluginVersion ?? "unknown";
|
|
28758
|
-
lines.push(` ${import_picocolors18.default.green(SYMBOLS3.check)} ${import_picocolors18.default.green(`System OK (opencode ${opencodeVer} \xB7
|
|
28816
|
+
lines.push(` ${import_picocolors18.default.green(SYMBOLS3.check)} ${import_picocolors18.default.green(`System OK (opencode ${opencodeVer} \xB7 ${PLUGIN_NAME} ${pluginVer})`)}`);
|
|
28759
28817
|
} else {
|
|
28760
28818
|
const issueCount = allIssues.filter((i2) => i2.severity === "error").length;
|
|
28761
28819
|
const warnCount = allIssues.filter((i2) => i2.severity === "warning").length;
|
|
@@ -28803,6 +28861,7 @@ function formatStatus(result) {
|
|
|
28803
28861
|
|
|
28804
28862
|
// src/cli/doctor/format-verbose.ts
|
|
28805
28863
|
var import_picocolors20 = __toESM(require_picocolors(), 1);
|
|
28864
|
+
init_plugin_identity();
|
|
28806
28865
|
function formatVerbose(result) {
|
|
28807
28866
|
const lines = [];
|
|
28808
28867
|
lines.push(formatHeader());
|
|
@@ -28810,7 +28869,7 @@ function formatVerbose(result) {
|
|
|
28810
28869
|
lines.push(`${import_picocolors20.default.bold("System Information")}`);
|
|
28811
28870
|
lines.push(`${import_picocolors20.default.dim("\u2500".repeat(40))}`);
|
|
28812
28871
|
lines.push(` ${formatStatusSymbol("pass")} opencode ${systemInfo.opencodeVersion ?? "unknown"}`);
|
|
28813
|
-
lines.push(` ${formatStatusSymbol("pass")}
|
|
28872
|
+
lines.push(` ${formatStatusSymbol("pass")} ${PLUGIN_NAME} ${systemInfo.pluginVersion ?? "unknown"}`);
|
|
28814
28873
|
if (systemInfo.loadedVersion) {
|
|
28815
28874
|
lines.push(` ${formatStatusSymbol("pass")} loaded ${systemInfo.loadedVersion}`);
|
|
28816
28875
|
}
|
|
@@ -28970,10 +29029,10 @@ async function doctor(options = { mode: "default" }) {
|
|
|
28970
29029
|
// src/features/mcp-oauth/storage.ts
|
|
28971
29030
|
init_shared();
|
|
28972
29031
|
import { chmodSync, existsSync as existsSync29, mkdirSync as mkdirSync6, readFileSync as readFileSync27, unlinkSync as unlinkSync4, writeFileSync as writeFileSync10 } from "fs";
|
|
28973
|
-
import { dirname as dirname7, join as
|
|
29032
|
+
import { dirname as dirname7, join as join29 } from "path";
|
|
28974
29033
|
var STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
28975
29034
|
function getMcpOauthStoragePath() {
|
|
28976
|
-
return
|
|
29035
|
+
return join29(getOpenCodeConfigDir({ binary: "opencode" }), STORAGE_FILE_NAME);
|
|
28977
29036
|
}
|
|
28978
29037
|
function normalizeHost(serverHost) {
|
|
28979
29038
|
let host = serverHost.trim();
|
|
@@ -29347,6 +29406,8 @@ async function runAuthorizationCodeRedirect(options) {
|
|
|
29347
29406
|
}
|
|
29348
29407
|
|
|
29349
29408
|
// src/features/mcp-oauth/provider.ts
|
|
29409
|
+
init_plugin_identity();
|
|
29410
|
+
|
|
29350
29411
|
class McpOAuthProvider {
|
|
29351
29412
|
serverUrl;
|
|
29352
29413
|
configClientId;
|
|
@@ -29414,7 +29475,7 @@ class McpOAuthProvider {
|
|
|
29414
29475
|
const clientInfo = await getOrRegisterClient({
|
|
29415
29476
|
registrationEndpoint: metadata.registrationEndpoint,
|
|
29416
29477
|
serverIdentifier: this.serverUrl,
|
|
29417
|
-
clientName:
|
|
29478
|
+
clientName: PLUGIN_NAME,
|
|
29418
29479
|
redirectUris: [this.redirectUrl()],
|
|
29419
29480
|
tokenEndpointAuthMethod: "none",
|
|
29420
29481
|
clientId: this.configClientId,
|
|
@@ -29592,12 +29653,12 @@ function createMcpOAuthCommand() {
|
|
|
29592
29653
|
// src/cli/cli-program.ts
|
|
29593
29654
|
var VERSION2 = package_default.version;
|
|
29594
29655
|
var program2 = new Command;
|
|
29595
|
-
program2.name("
|
|
29596
|
-
program2.command("install").description("Install and configure
|
|
29656
|
+
program2.name("evil-omo").description("The ultimate OpenCode plugin - multi-model orchestration, LSP tools, and more").version(VERSION2, "-v, --version", "Show version number").enablePositionalOptions();
|
|
29657
|
+
program2.command("install").description("Install and configure evil-omo with interactive setup").option("--no-tui", "Run in non-interactive mode (requires all options)").option("--claude <value>", "Claude subscription: no, yes, max20").option("--openai <value>", "OpenAI/ChatGPT subscription: no, yes (default: no)").option("--gemini <value>", "Gemini integration: no, yes").option("--copilot <value>", "GitHub Copilot subscription: no, yes").option("--opencode-zen <value>", "OpenCode Zen access: no, yes (default: no)").option("--zai-coding-plan <value>", "Z.ai Coding Plan subscription: no, yes (default: no)").option("--kimi-for-coding <value>", "Kimi For Coding subscription: no, yes (default: no)").option("--opencode-go <value>", "OpenCode Go subscription: no, yes (default: no)").option("--skip-auth", "Skip authentication setup hints").addHelpText("after", `
|
|
29597
29658
|
Examples:
|
|
29598
|
-
$ bunx
|
|
29599
|
-
$ bunx
|
|
29600
|
-
$ bunx
|
|
29659
|
+
$ bunx evil-omo install
|
|
29660
|
+
$ bunx evil-omo install --no-tui --claude=max20 --openai=yes --gemini=yes --copilot=no
|
|
29661
|
+
$ bunx evil-omo install --no-tui --claude=no --gemini=no --copilot=yes --opencode-zen=yes
|
|
29601
29662
|
|
|
29602
29663
|
Model Providers (Priority: Native > Copilot > OpenCode Zen > Z.ai > Kimi):
|
|
29603
29664
|
Claude Native anthropic/ models (Opus, Sonnet, Haiku)
|
|
@@ -29625,20 +29686,20 @@ Model Providers (Priority: Native > Copilot > OpenCode Zen > Z.ai > Kimi):
|
|
|
29625
29686
|
});
|
|
29626
29687
|
program2.command("run <message>").allowUnknownOption().passThroughOptions().description("Run opencode with todo/background task completion enforcement").option("-a, --agent <name>", "Agent to use (default: from CLI/env/config, fallback: Sisyphus)").option("-m, --model <provider/model>", "Model override (e.g., anthropic/claude-sonnet-4)").option("-d, --directory <path>", "Working directory").option("-p, --port <port>", "Server port (attaches if port already in use)", parseInt).option("--attach <url>", "Attach to existing opencode server URL").option("--on-complete <command>", "Shell command to run after completion").option("--json", "Output structured JSON result to stdout").option("--no-timestamp", "Disable timestamp prefix in run output").option("--verbose", "Show full event stream (default: messages/tools only)").option("--session-id <id>", "Resume existing session instead of creating new one").addHelpText("after", `
|
|
29627
29688
|
Examples:
|
|
29628
|
-
$ bunx
|
|
29629
|
-
$ bunx
|
|
29630
|
-
$ bunx
|
|
29631
|
-
$ bunx
|
|
29632
|
-
$ bunx
|
|
29633
|
-
$ bunx
|
|
29634
|
-
$ bunx
|
|
29635
|
-
$ bunx
|
|
29636
|
-
$ bunx
|
|
29689
|
+
$ bunx evil-omo run "Fix the bug in index.ts"
|
|
29690
|
+
$ bunx evil-omo run --agent Sisyphus "Implement feature X"
|
|
29691
|
+
$ bunx evil-omo run --port 4321 "Fix the bug"
|
|
29692
|
+
$ bunx evil-omo run --attach http://127.0.0.1:4321 "Fix the bug"
|
|
29693
|
+
$ bunx evil-omo run --json "Fix the bug" | jq .sessionId
|
|
29694
|
+
$ bunx evil-omo run --on-complete "notify-send Done" "Fix the bug"
|
|
29695
|
+
$ bunx evil-omo run --session-id ses_abc123 "Continue the work"
|
|
29696
|
+
$ bunx evil-omo run --model anthropic/claude-sonnet-4 "Fix the bug"
|
|
29697
|
+
$ bunx evil-omo run --agent Sisyphus --model openai/gpt-5.4 "Implement feature X"
|
|
29637
29698
|
|
|
29638
29699
|
Agent resolution order:
|
|
29639
29700
|
1) --agent flag
|
|
29640
29701
|
2) OPENCODE_DEFAULT_AGENT
|
|
29641
|
-
3)
|
|
29702
|
+
3) evil-omo.json "default_run_agent"
|
|
29642
29703
|
4) Sisyphus (fallback)
|
|
29643
29704
|
|
|
29644
29705
|
Available core agents:
|
|
@@ -29670,9 +29731,9 @@ Unlike 'opencode run', this command waits until:
|
|
|
29670
29731
|
});
|
|
29671
29732
|
program2.command("get-local-version").description("Show current installed version and check for updates").option("-d, --directory <path>", "Working directory to check config from").option("--json", "Output in JSON format for scripting").addHelpText("after", `
|
|
29672
29733
|
Examples:
|
|
29673
|
-
$ bunx
|
|
29674
|
-
$ bunx
|
|
29675
|
-
$ bunx
|
|
29734
|
+
$ bunx evil-omo get-local-version
|
|
29735
|
+
$ bunx evil-omo get-local-version --json
|
|
29736
|
+
$ bunx evil-omo get-local-version --directory /path/to/project
|
|
29676
29737
|
|
|
29677
29738
|
This command shows:
|
|
29678
29739
|
- Current installed version
|
|
@@ -29687,12 +29748,12 @@ This command shows:
|
|
|
29687
29748
|
const exitCode = await getLocalVersion(versionOptions);
|
|
29688
29749
|
process.exit(exitCode);
|
|
29689
29750
|
});
|
|
29690
|
-
program2.command("doctor").description("Check
|
|
29751
|
+
program2.command("doctor").description("Check evil-omo installation health and diagnose issues").option("--status", "Show compact system dashboard").option("--verbose", "Show detailed diagnostic information").option("--json", "Output results in JSON format").addHelpText("after", `
|
|
29691
29752
|
Examples:
|
|
29692
|
-
$ bunx
|
|
29693
|
-
$ bunx
|
|
29694
|
-
$ bunx
|
|
29695
|
-
$ bunx
|
|
29753
|
+
$ bunx evil-omo doctor # Show problems only
|
|
29754
|
+
$ bunx evil-omo doctor --status # Compact dashboard
|
|
29755
|
+
$ bunx evil-omo doctor --verbose # Deep diagnostics
|
|
29756
|
+
$ bunx evil-omo doctor --json # JSON output
|
|
29696
29757
|
`).action(async (options) => {
|
|
29697
29758
|
const mode = options.status ? "status" : options.verbose ? "verbose" : "default";
|
|
29698
29759
|
const doctorOptions = {
|
|
@@ -29703,7 +29764,7 @@ Examples:
|
|
|
29703
29764
|
process.exit(exitCode);
|
|
29704
29765
|
});
|
|
29705
29766
|
program2.command("version").description("Show version information").action(() => {
|
|
29706
|
-
console.log(`
|
|
29767
|
+
console.log(`evil-omo v${VERSION2}`);
|
|
29707
29768
|
});
|
|
29708
29769
|
program2.addCommand(createMcpOAuthCommand());
|
|
29709
29770
|
function runCli() {
|