oh-my-opencode-gpt-slim 0.1.2 → 0.1.3
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/README.md +2 -2
- package/README.zh-cn.md +2 -2
- package/dist/agents/dynamic-agent-prompt-builder.d.ts +9 -1
- package/dist/agents/sisyphus/gpt-5-4.d.ts +1 -1
- package/dist/agents/sisyphus.d.ts +2 -2
- package/dist/cli/doctor/checks/config-validation.d.ts +10 -0
- package/dist/cli/index.js +250 -238
- package/dist/index.js +659 -513
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/omo-config-file.d.ts +5 -0
- package/package.json +10 -10
package/dist/cli/index.js
CHANGED
|
@@ -2145,7 +2145,7 @@ var package_default;
|
|
|
2145
2145
|
var init_package = __esm(() => {
|
|
2146
2146
|
package_default = {
|
|
2147
2147
|
name: "oh-my-opencode-gpt-slim",
|
|
2148
|
-
version: "0.1.
|
|
2148
|
+
version: "0.1.3",
|
|
2149
2149
|
description: "GPT-optimized lean fork of oh-my-openagent \u2014 33 hooks removed, 5 tools removed, Sisyphus prompt rewritten based on OpenAI Codex prompt.md",
|
|
2150
2150
|
main: "dist/index.js",
|
|
2151
2151
|
types: "dist/index.d.ts",
|
|
@@ -2223,15 +2223,15 @@ var init_package = __esm(() => {
|
|
|
2223
2223
|
typescript: "^5.7.3"
|
|
2224
2224
|
},
|
|
2225
2225
|
optionalDependencies: {
|
|
2226
|
-
"oh-my-opencode-gpt-slim-darwin-arm64": "0.1.
|
|
2227
|
-
"oh-my-opencode-gpt-slim-darwin-x64": "0.1.
|
|
2228
|
-
"oh-my-opencode-gpt-slim-darwin-x64-baseline": "0.1.
|
|
2229
|
-
"oh-my-opencode-gpt-slim-linux-arm64": "0.1.
|
|
2230
|
-
"oh-my-opencode-gpt-slim-linux-arm64-musl": "0.1.
|
|
2231
|
-
"oh-my-opencode-gpt-slim-linux-x64": "0.1.
|
|
2232
|
-
"oh-my-opencode-gpt-slim-linux-x64-baseline": "0.1.
|
|
2233
|
-
"oh-my-opencode-gpt-slim-linux-x64-musl": "0.1.
|
|
2234
|
-
"oh-my-opencode-gpt-slim-linux-x64-musl-baseline": "0.1.
|
|
2226
|
+
"oh-my-opencode-gpt-slim-darwin-arm64": "0.1.3",
|
|
2227
|
+
"oh-my-opencode-gpt-slim-darwin-x64": "0.1.3",
|
|
2228
|
+
"oh-my-opencode-gpt-slim-darwin-x64-baseline": "0.1.3",
|
|
2229
|
+
"oh-my-opencode-gpt-slim-linux-arm64": "0.1.3",
|
|
2230
|
+
"oh-my-opencode-gpt-slim-linux-arm64-musl": "0.1.3",
|
|
2231
|
+
"oh-my-opencode-gpt-slim-linux-x64": "0.1.3",
|
|
2232
|
+
"oh-my-opencode-gpt-slim-linux-x64-baseline": "0.1.3",
|
|
2233
|
+
"oh-my-opencode-gpt-slim-linux-x64-musl": "0.1.3",
|
|
2234
|
+
"oh-my-opencode-gpt-slim-linux-x64-musl-baseline": "0.1.3"
|
|
2235
2235
|
},
|
|
2236
2236
|
overrides: {
|
|
2237
2237
|
"@opencode-ai/sdk": "^1.2.17"
|
|
@@ -2451,11 +2451,10 @@ function getPluginEntrySource(entry) {
|
|
|
2451
2451
|
return "github";
|
|
2452
2452
|
return "package";
|
|
2453
2453
|
}
|
|
2454
|
-
var LEGACY_PLUGIN_PACKAGE_NAME = "oh-my-opencode", PLUGIN_PACKAGE_NAME,
|
|
2454
|
+
var LEGACY_PLUGIN_PACKAGE_NAME = "oh-my-opencode", PLUGIN_PACKAGE_NAME, rawRepositoryUrl, PLUGIN_REPOSITORY_URL, PLUGIN_GITHUB_REPOSITORY, CURRENT_PLUGIN_PREFIXES, LEGACY_PLUGIN_PREFIXES, FILE_REFERENCE_TOKENS;
|
|
2455
2455
|
var init_plugin_reference = __esm(() => {
|
|
2456
2456
|
init_package();
|
|
2457
2457
|
PLUGIN_PACKAGE_NAME = package_default.name;
|
|
2458
|
-
CONFIG_BASENAME = PLUGIN_PACKAGE_NAME;
|
|
2459
2458
|
rawRepositoryUrl = typeof package_default.repository === "string" ? package_default.repository : package_default.repository.url;
|
|
2460
2459
|
PLUGIN_REPOSITORY_URL = rawRepositoryUrl.replace(/^git\+/, "");
|
|
2461
2460
|
PLUGIN_GITHUB_REPOSITORY = PLUGIN_REPOSITORY_URL.replace(/^https:\/\/github\.com\//, "").replace(/\.git$/, "");
|
|
@@ -6234,7 +6233,6 @@ var init_main = __esm(() => {
|
|
|
6234
6233
|
});
|
|
6235
6234
|
|
|
6236
6235
|
// src/shared/jsonc-parser.ts
|
|
6237
|
-
import { existsSync as existsSync4, readFileSync } from "fs";
|
|
6238
6236
|
function parseJsonc(content) {
|
|
6239
6237
|
const errors = [];
|
|
6240
6238
|
const result = parse2(content, errors, {
|
|
@@ -6247,21 +6245,24 @@ function parseJsonc(content) {
|
|
|
6247
6245
|
}
|
|
6248
6246
|
return result;
|
|
6249
6247
|
}
|
|
6250
|
-
function detectConfigFile(basePath) {
|
|
6251
|
-
const jsoncPath = `${basePath}.jsonc`;
|
|
6252
|
-
const jsonPath = `${basePath}.json`;
|
|
6253
|
-
if (existsSync4(jsoncPath)) {
|
|
6254
|
-
return { format: "jsonc", path: jsoncPath };
|
|
6255
|
-
}
|
|
6256
|
-
if (existsSync4(jsonPath)) {
|
|
6257
|
-
return { format: "json", path: jsonPath };
|
|
6258
|
-
}
|
|
6259
|
-
return { format: "none", path: jsonPath };
|
|
6260
|
-
}
|
|
6261
6248
|
var init_jsonc_parser = __esm(() => {
|
|
6262
6249
|
init_main();
|
|
6263
6250
|
});
|
|
6264
6251
|
|
|
6252
|
+
// src/shared/omo-config-file.ts
|
|
6253
|
+
import { join as join5 } from "path";
|
|
6254
|
+
function getOmoConfigFilePath(directory) {
|
|
6255
|
+
return join5(directory, OMO_CONFIG_FILENAME);
|
|
6256
|
+
}
|
|
6257
|
+
function getProjectOmoConfigFilePath(projectRoot) {
|
|
6258
|
+
return getOmoConfigFilePath(join5(projectRoot, ".opencode"));
|
|
6259
|
+
}
|
|
6260
|
+
function parseOmoConfigJson(content) {
|
|
6261
|
+
return JSON.parse(content);
|
|
6262
|
+
}
|
|
6263
|
+
var OMO_CONFIG_FILENAME = "oh-my-opencode-gpt-slim.json";
|
|
6264
|
+
var init_omo_config_file = () => {};
|
|
6265
|
+
|
|
6265
6266
|
// src/shared/migration/agent-names.ts
|
|
6266
6267
|
function migrateAgentNames(agents) {
|
|
6267
6268
|
const migrated = {};
|
|
@@ -6624,8 +6625,8 @@ var init_opencode_version = __esm(() => {
|
|
|
6624
6625
|
});
|
|
6625
6626
|
|
|
6626
6627
|
// src/shared/opencode-storage-detection.ts
|
|
6627
|
-
import { existsSync as
|
|
6628
|
-
import { join as
|
|
6628
|
+
import { existsSync as existsSync4 } from "fs";
|
|
6629
|
+
import { join as join6 } from "path";
|
|
6629
6630
|
function isSqliteBackend() {
|
|
6630
6631
|
if (cachedResult === true)
|
|
6631
6632
|
return true;
|
|
@@ -6633,8 +6634,8 @@ function isSqliteBackend() {
|
|
|
6633
6634
|
return false;
|
|
6634
6635
|
const check = () => {
|
|
6635
6636
|
const versionOk = isOpenCodeVersionAtLeast(OPENCODE_SQLITE_VERSION);
|
|
6636
|
-
const dbPath =
|
|
6637
|
-
return versionOk &&
|
|
6637
|
+
const dbPath = join6(getDataDir(), "opencode", "opencode.db");
|
|
6638
|
+
return versionOk && existsSync4(dbPath);
|
|
6638
6639
|
};
|
|
6639
6640
|
if (cachedResult === FALSE_PENDING_RETRY) {
|
|
6640
6641
|
const result2 = check();
|
|
@@ -6988,19 +6989,19 @@ var init_hook_message_injector = __esm(() => {
|
|
|
6988
6989
|
});
|
|
6989
6990
|
|
|
6990
6991
|
// src/shared/opencode-storage-paths.ts
|
|
6991
|
-
import { join as
|
|
6992
|
+
import { join as join7 } from "path";
|
|
6992
6993
|
var OPENCODE_STORAGE, MESSAGE_STORAGE, PART_STORAGE, SESSION_STORAGE;
|
|
6993
6994
|
var init_opencode_storage_paths = __esm(() => {
|
|
6994
6995
|
init_data_path();
|
|
6995
6996
|
OPENCODE_STORAGE = getOpenCodeStorageDir();
|
|
6996
|
-
MESSAGE_STORAGE =
|
|
6997
|
-
PART_STORAGE =
|
|
6998
|
-
SESSION_STORAGE =
|
|
6997
|
+
MESSAGE_STORAGE = join7(OPENCODE_STORAGE, "message");
|
|
6998
|
+
PART_STORAGE = join7(OPENCODE_STORAGE, "part");
|
|
6999
|
+
SESSION_STORAGE = join7(OPENCODE_STORAGE, "session");
|
|
6999
7000
|
});
|
|
7000
7001
|
|
|
7001
7002
|
// src/shared/opencode-message-dir.ts
|
|
7002
|
-
import { existsSync as
|
|
7003
|
-
import { join as
|
|
7003
|
+
import { existsSync as existsSync5, readdirSync } from "fs";
|
|
7004
|
+
import { join as join8 } from "path";
|
|
7004
7005
|
function getMessageDir(sessionID) {
|
|
7005
7006
|
if (!sessionID.startsWith("ses_"))
|
|
7006
7007
|
return null;
|
|
@@ -7008,16 +7009,16 @@ function getMessageDir(sessionID) {
|
|
|
7008
7009
|
return null;
|
|
7009
7010
|
if (isSqliteBackend())
|
|
7010
7011
|
return null;
|
|
7011
|
-
if (!
|
|
7012
|
+
if (!existsSync5(MESSAGE_STORAGE))
|
|
7012
7013
|
return null;
|
|
7013
|
-
const directPath =
|
|
7014
|
-
if (
|
|
7014
|
+
const directPath = join8(MESSAGE_STORAGE, sessionID);
|
|
7015
|
+
if (existsSync5(directPath)) {
|
|
7015
7016
|
return directPath;
|
|
7016
7017
|
}
|
|
7017
7018
|
try {
|
|
7018
7019
|
for (const dir of readdirSync(MESSAGE_STORAGE)) {
|
|
7019
|
-
const sessionPath =
|
|
7020
|
-
if (
|
|
7020
|
+
const sessionPath = join8(MESSAGE_STORAGE, dir, sessionID);
|
|
7021
|
+
if (existsSync5(sessionPath)) {
|
|
7021
7022
|
return sessionPath;
|
|
7022
7023
|
}
|
|
7023
7024
|
}
|
|
@@ -7328,6 +7329,7 @@ var init_shared = __esm(() => {
|
|
|
7328
7329
|
init_config_errors();
|
|
7329
7330
|
init_claude_config_dir();
|
|
7330
7331
|
init_jsonc_parser();
|
|
7332
|
+
init_omo_config_file();
|
|
7331
7333
|
init_migration();
|
|
7332
7334
|
init_opencode_config_dir();
|
|
7333
7335
|
init_opencode_version();
|
|
@@ -7361,7 +7363,7 @@ var init_shared = __esm(() => {
|
|
|
7361
7363
|
});
|
|
7362
7364
|
|
|
7363
7365
|
// src/cli/config-manager/parse-opencode-config-file.ts
|
|
7364
|
-
import { readFileSync
|
|
7366
|
+
import { readFileSync, statSync } from "fs";
|
|
7365
7367
|
function isEmptyOrWhitespace(content) {
|
|
7366
7368
|
return content.trim().length === 0;
|
|
7367
7369
|
}
|
|
@@ -7371,7 +7373,7 @@ function parseOpenCodeConfigFileWithError(path3) {
|
|
|
7371
7373
|
if (stat.size === 0) {
|
|
7372
7374
|
return { config: null, error: `Config file is empty: ${path3}. Delete it or add valid JSON content.` };
|
|
7373
7375
|
}
|
|
7374
|
-
const content =
|
|
7376
|
+
const content = readFileSync(path3, "utf-8");
|
|
7375
7377
|
if (isEmptyOrWhitespace(content)) {
|
|
7376
7378
|
return { config: null, error: `Config file contains only whitespace: ${path3}. Delete it or add valid JSON content.` };
|
|
7377
7379
|
}
|
|
@@ -7413,7 +7415,7 @@ var init_plugin_array_updater = __esm(() => {
|
|
|
7413
7415
|
});
|
|
7414
7416
|
|
|
7415
7417
|
// src/cli/config-manager/add-plugin-to-opencode-config.ts
|
|
7416
|
-
import { readFileSync as
|
|
7418
|
+
import { readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
7417
7419
|
async function addPluginToOpenCodeConfig(currentVersion) {
|
|
7418
7420
|
try {
|
|
7419
7421
|
ensureConfigDirectoryExists();
|
|
@@ -7448,7 +7450,7 @@ async function addPluginToOpenCodeConfig(currentVersion) {
|
|
|
7448
7450
|
}
|
|
7449
7451
|
config.plugin = plugins;
|
|
7450
7452
|
if (format2 === "jsonc") {
|
|
7451
|
-
const content =
|
|
7453
|
+
const content = readFileSync2(path3, "utf-8");
|
|
7452
7454
|
const pluginArrayRegex = /"plugin"\s*:\s*\[([\s\S]*?)\]/;
|
|
7453
7455
|
const match = content.match(pluginArrayRegex);
|
|
7454
7456
|
if (match) {
|
|
@@ -7887,7 +7889,7 @@ function deepMergeRecord(target, source) {
|
|
|
7887
7889
|
}
|
|
7888
7890
|
|
|
7889
7891
|
// src/cli/config-manager/write-omo-config.ts
|
|
7890
|
-
import { existsSync as
|
|
7892
|
+
import { existsSync as existsSync6, readFileSync as readFileSync3, statSync as statSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
7891
7893
|
function isEmptyOrWhitespace2(content) {
|
|
7892
7894
|
return content.trim().length === 0;
|
|
7893
7895
|
}
|
|
@@ -7904,34 +7906,34 @@ function writeOmoConfig(installConfig) {
|
|
|
7904
7906
|
const omoConfigPath = getOmoConfigPath();
|
|
7905
7907
|
try {
|
|
7906
7908
|
const newConfig = generateOmoConfig(installConfig);
|
|
7907
|
-
if (
|
|
7909
|
+
if (existsSync6(omoConfigPath)) {
|
|
7908
7910
|
try {
|
|
7909
7911
|
const stat = statSync2(omoConfigPath);
|
|
7910
|
-
const content =
|
|
7912
|
+
const content = readFileSync3(omoConfigPath, "utf-8");
|
|
7911
7913
|
if (stat.size === 0 || isEmptyOrWhitespace2(content)) {
|
|
7912
|
-
writeFileSync3(omoConfigPath, JSON.stringify(newConfig, null, 2)
|
|
7914
|
+
writeFileSync3(omoConfigPath, `${JSON.stringify(newConfig, null, 2)}
|
|
7913
7915
|
`);
|
|
7914
7916
|
return { success: true, configPath: omoConfigPath };
|
|
7915
7917
|
}
|
|
7916
|
-
const existing =
|
|
7918
|
+
const existing = parseOmoConfigJson(content);
|
|
7917
7919
|
if (!existing || typeof existing !== "object" || Array.isArray(existing)) {
|
|
7918
|
-
writeFileSync3(omoConfigPath, JSON.stringify(newConfig, null, 2)
|
|
7920
|
+
writeFileSync3(omoConfigPath, `${JSON.stringify(newConfig, null, 2)}
|
|
7919
7921
|
`);
|
|
7920
7922
|
return { success: true, configPath: omoConfigPath };
|
|
7921
7923
|
}
|
|
7922
7924
|
const merged = deepMergeRecord(newConfig, existing);
|
|
7923
|
-
writeFileSync3(omoConfigPath, JSON.stringify(merged, null, 2)
|
|
7925
|
+
writeFileSync3(omoConfigPath, `${JSON.stringify(merged, null, 2)}
|
|
7924
7926
|
`);
|
|
7925
7927
|
} catch (parseErr) {
|
|
7926
7928
|
if (parseErr instanceof SyntaxError) {
|
|
7927
|
-
writeFileSync3(omoConfigPath, JSON.stringify(newConfig, null, 2)
|
|
7929
|
+
writeFileSync3(omoConfigPath, `${JSON.stringify(newConfig, null, 2)}
|
|
7928
7930
|
`);
|
|
7929
7931
|
return { success: true, configPath: omoConfigPath };
|
|
7930
7932
|
}
|
|
7931
7933
|
throw parseErr;
|
|
7932
7934
|
}
|
|
7933
7935
|
} else {
|
|
7934
|
-
writeFileSync3(omoConfigPath, JSON.stringify(newConfig, null, 2)
|
|
7936
|
+
writeFileSync3(omoConfigPath, `${JSON.stringify(newConfig, null, 2)}
|
|
7935
7937
|
`);
|
|
7936
7938
|
}
|
|
7937
7939
|
return { success: true, configPath: omoConfigPath };
|
|
@@ -8047,17 +8049,27 @@ var init_opencode_binary = __esm(() => {
|
|
|
8047
8049
|
});
|
|
8048
8050
|
|
|
8049
8051
|
// src/cli/config-manager/detect-current-config.ts
|
|
8050
|
-
import { existsSync as
|
|
8052
|
+
import { existsSync as existsSync7, readFileSync as readFileSync4 } from "fs";
|
|
8051
8053
|
function detectProvidersFromOmoConfig() {
|
|
8052
8054
|
const omoConfigPath = getOmoConfigPath();
|
|
8053
|
-
if (!
|
|
8054
|
-
return {
|
|
8055
|
+
if (!existsSync7(omoConfigPath)) {
|
|
8056
|
+
return {
|
|
8057
|
+
hasOpenAI: true,
|
|
8058
|
+
hasOpencodeZen: true,
|
|
8059
|
+
hasZaiCodingPlan: false,
|
|
8060
|
+
hasKimiForCoding: false
|
|
8061
|
+
};
|
|
8055
8062
|
}
|
|
8056
8063
|
try {
|
|
8057
|
-
const content =
|
|
8058
|
-
const omoConfig =
|
|
8064
|
+
const content = readFileSync4(omoConfigPath, "utf-8");
|
|
8065
|
+
const omoConfig = parseOmoConfigJson(content);
|
|
8059
8066
|
if (!omoConfig || typeof omoConfig !== "object") {
|
|
8060
|
-
return {
|
|
8067
|
+
return {
|
|
8068
|
+
hasOpenAI: true,
|
|
8069
|
+
hasOpencodeZen: true,
|
|
8070
|
+
hasZaiCodingPlan: false,
|
|
8071
|
+
hasKimiForCoding: false
|
|
8072
|
+
};
|
|
8061
8073
|
}
|
|
8062
8074
|
const configStr = JSON.stringify(omoConfig);
|
|
8063
8075
|
const hasOpenAI = configStr.includes('"openai/');
|
|
@@ -8066,7 +8078,12 @@ function detectProvidersFromOmoConfig() {
|
|
|
8066
8078
|
const hasKimiForCoding = configStr.includes('"kimi-for-coding/');
|
|
8067
8079
|
return { hasOpenAI, hasOpencodeZen, hasZaiCodingPlan, hasKimiForCoding };
|
|
8068
8080
|
} catch {
|
|
8069
|
-
return {
|
|
8081
|
+
return {
|
|
8082
|
+
hasOpenAI: true,
|
|
8083
|
+
hasOpencodeZen: true,
|
|
8084
|
+
hasZaiCodingPlan: false,
|
|
8085
|
+
hasKimiForCoding: false
|
|
8086
|
+
};
|
|
8070
8087
|
}
|
|
8071
8088
|
}
|
|
8072
8089
|
function detectCurrentConfig() {
|
|
@@ -8105,15 +8122,15 @@ function detectCurrentConfig() {
|
|
|
8105
8122
|
return result;
|
|
8106
8123
|
}
|
|
8107
8124
|
var init_detect_current_config = __esm(() => {
|
|
8108
|
-
|
|
8125
|
+
init_omo_config_file();
|
|
8109
8126
|
init_plugin_reference();
|
|
8110
|
-
|
|
8127
|
+
init_config_context();
|
|
8111
8128
|
init_opencode_config_format();
|
|
8112
8129
|
init_parse_opencode_config_file();
|
|
8113
8130
|
});
|
|
8114
8131
|
|
|
8115
8132
|
// src/cli/config-manager/bun-install.ts
|
|
8116
|
-
import { existsSync as
|
|
8133
|
+
import { existsSync as existsSync8 } from "fs";
|
|
8117
8134
|
async function runBunInstall() {
|
|
8118
8135
|
const result = await runBunInstallWithDetails();
|
|
8119
8136
|
return result.success;
|
|
@@ -8121,7 +8138,7 @@ async function runBunInstall() {
|
|
|
8121
8138
|
async function runBunInstallWithDetails() {
|
|
8122
8139
|
const cacheDir = getOpenCodeCacheDir();
|
|
8123
8140
|
const packageJsonPath = `${cacheDir}/package.json`;
|
|
8124
|
-
if (!
|
|
8141
|
+
if (!existsSync8(packageJsonPath)) {
|
|
8125
8142
|
return {
|
|
8126
8143
|
success: false,
|
|
8127
8144
|
error: `Workspace not initialized: ${packageJsonPath} not found. OpenCode should create this on first run.`
|
|
@@ -8261,16 +8278,16 @@ var init_config_paths = __esm(() => {
|
|
|
8261
8278
|
});
|
|
8262
8279
|
|
|
8263
8280
|
// src/hooks/auto-update-checker/checker/plugin-entry.ts
|
|
8264
|
-
import { existsSync as
|
|
8281
|
+
import { existsSync as existsSync13, readFileSync as readFileSync9 } from "fs";
|
|
8265
8282
|
function isExplicitVersionPin(version2) {
|
|
8266
8283
|
return version2 !== null && /^\d+\.\d+\.\d+/.test(version2);
|
|
8267
8284
|
}
|
|
8268
8285
|
function findPluginEntry(directory) {
|
|
8269
8286
|
for (const configPath of getConfigPaths(directory)) {
|
|
8270
8287
|
try {
|
|
8271
|
-
if (!
|
|
8288
|
+
if (!existsSync13(configPath))
|
|
8272
8289
|
continue;
|
|
8273
|
-
const config2 = parseJsonc(
|
|
8290
|
+
const config2 = parseJsonc(readFileSync9(configPath, "utf-8"));
|
|
8274
8291
|
for (const entry of config2.plugin ?? []) {
|
|
8275
8292
|
if (!isManagedPluginEntry(entry))
|
|
8276
8293
|
continue;
|
|
@@ -8311,11 +8328,11 @@ var init_constants3 = __esm(() => {
|
|
|
8311
8328
|
});
|
|
8312
8329
|
|
|
8313
8330
|
// src/hooks/auto-update-checker/checker/cached-version.ts
|
|
8314
|
-
import { existsSync as
|
|
8331
|
+
import { existsSync as existsSync14, readFileSync as readFileSync10 } from "fs";
|
|
8315
8332
|
function getCachedVersion() {
|
|
8316
8333
|
try {
|
|
8317
|
-
if (
|
|
8318
|
-
const installedPackage = JSON.parse(
|
|
8334
|
+
if (existsSync14(INSTALLED_PACKAGE_JSON)) {
|
|
8335
|
+
const installedPackage = JSON.parse(readFileSync10(INSTALLED_PACKAGE_JSON, "utf-8"));
|
|
8319
8336
|
if (installedPackage.version)
|
|
8320
8337
|
return installedPackage.version;
|
|
8321
8338
|
}
|
|
@@ -8351,14 +8368,14 @@ var init_latest_version = __esm(() => {
|
|
|
8351
8368
|
});
|
|
8352
8369
|
|
|
8353
8370
|
// src/hooks/auto-update-checker/checker/local-dev-path.ts
|
|
8354
|
-
import { existsSync as
|
|
8371
|
+
import { existsSync as existsSync15, readFileSync as readFileSync11 } from "fs";
|
|
8355
8372
|
import { fileURLToPath } from "url";
|
|
8356
8373
|
function getLocalDevPath(directory) {
|
|
8357
8374
|
for (const configPath of getConfigPaths(directory)) {
|
|
8358
8375
|
try {
|
|
8359
|
-
if (!
|
|
8376
|
+
if (!existsSync15(configPath))
|
|
8360
8377
|
continue;
|
|
8361
|
-
const config2 = parseJsonc(
|
|
8378
|
+
const config2 = parseJsonc(readFileSync11(configPath, "utf-8"));
|
|
8362
8379
|
for (const entry of config2.plugin ?? []) {
|
|
8363
8380
|
if (!isManagedPluginEntry(entry))
|
|
8364
8381
|
continue;
|
|
@@ -8386,13 +8403,13 @@ var init_local_dev_path = __esm(() => {
|
|
|
8386
8403
|
});
|
|
8387
8404
|
|
|
8388
8405
|
// src/hooks/auto-update-checker/checker/local-dev-version.ts
|
|
8389
|
-
import { existsSync as
|
|
8406
|
+
import { existsSync as existsSync16, readFileSync as readFileSync12 } from "fs";
|
|
8390
8407
|
import { dirname as dirname3, join as join15 } from "path";
|
|
8391
8408
|
function findPackageJsonUp(startPath) {
|
|
8392
8409
|
let current = startPath;
|
|
8393
8410
|
while (true) {
|
|
8394
8411
|
const candidate = join15(current, "package.json");
|
|
8395
|
-
if (
|
|
8412
|
+
if (existsSync16(candidate))
|
|
8396
8413
|
return candidate;
|
|
8397
8414
|
const parent = dirname3(current);
|
|
8398
8415
|
if (parent === current)
|
|
@@ -8408,7 +8425,7 @@ function getLocalDevVersion(directory) {
|
|
|
8408
8425
|
const packageJsonPath = findPackageJsonUp(localPath);
|
|
8409
8426
|
if (!packageJsonPath)
|
|
8410
8427
|
return null;
|
|
8411
|
-
const packageJson = JSON.parse(
|
|
8428
|
+
const packageJson = JSON.parse(readFileSync12(packageJsonPath, "utf-8"));
|
|
8412
8429
|
return packageJson.version ?? null;
|
|
8413
8430
|
} catch {
|
|
8414
8431
|
return null;
|
|
@@ -8515,10 +8532,10 @@ var init_checker = __esm(() => {
|
|
|
8515
8532
|
});
|
|
8516
8533
|
|
|
8517
8534
|
// src/hooks/auto-update-checker/cache.ts
|
|
8518
|
-
import { existsSync as
|
|
8535
|
+
import { existsSync as existsSync17, rmSync as rmSync3, unlinkSync } from "fs";
|
|
8519
8536
|
import { join as join16 } from "path";
|
|
8520
8537
|
function deleteLockfile(lockPath) {
|
|
8521
|
-
if (!
|
|
8538
|
+
if (!existsSync17(lockPath))
|
|
8522
8539
|
return false;
|
|
8523
8540
|
try {
|
|
8524
8541
|
unlinkSync(lockPath);
|
|
@@ -8534,7 +8551,7 @@ function invalidatePackage(packageName = PACKAGE_NAME) {
|
|
|
8534
8551
|
join16(USER_CONFIG_DIR, "node_modules", packageName),
|
|
8535
8552
|
join16(CACHE_DIR, "node_modules", packageName)
|
|
8536
8553
|
]) {
|
|
8537
|
-
if (!
|
|
8554
|
+
if (!existsSync17(packageDir))
|
|
8538
8555
|
continue;
|
|
8539
8556
|
rmSync3(packageDir, { recursive: true, force: true });
|
|
8540
8557
|
changed = true;
|
|
@@ -10349,7 +10366,6 @@ async function processEvents(ctx, stream, state) {
|
|
|
10349
10366
|
}
|
|
10350
10367
|
// src/plugin-config.ts
|
|
10351
10368
|
import * as fs3 from "fs";
|
|
10352
|
-
import * as path3 from "path";
|
|
10353
10369
|
|
|
10354
10370
|
// node_modules/zod/v4/classic/external.js
|
|
10355
10371
|
var exports_external = {};
|
|
@@ -24309,7 +24325,9 @@ function parseConfigPartially(rawConfig) {
|
|
|
24309
24325
|
const partialConfig = {};
|
|
24310
24326
|
const invalidSections = [];
|
|
24311
24327
|
for (const key of Object.keys(rawConfig)) {
|
|
24312
|
-
const sectionResult = OhMyOpenCodeConfigSchema.safeParse({
|
|
24328
|
+
const sectionResult = OhMyOpenCodeConfigSchema.safeParse({
|
|
24329
|
+
[key]: rawConfig[key]
|
|
24330
|
+
});
|
|
24313
24331
|
if (sectionResult.success) {
|
|
24314
24332
|
const parsed = sectionResult.data;
|
|
24315
24333
|
if (parsed[key] !== undefined) {
|
|
@@ -24331,7 +24349,7 @@ function loadConfigFromPath(configPath, _ctx) {
|
|
|
24331
24349
|
try {
|
|
24332
24350
|
if (fs3.existsSync(configPath)) {
|
|
24333
24351
|
const content = fs3.readFileSync(configPath, "utf-8");
|
|
24334
|
-
const rawConfig =
|
|
24352
|
+
const rawConfig = parseOmoConfigJson(content);
|
|
24335
24353
|
migrateConfigFile(configPath, rawConfig);
|
|
24336
24354
|
const result = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
|
|
24337
24355
|
if (result.success) {
|
|
@@ -24346,7 +24364,9 @@ function loadConfigFromPath(configPath, _ctx) {
|
|
|
24346
24364
|
});
|
|
24347
24365
|
const partialResult = parseConfigPartially(rawConfig);
|
|
24348
24366
|
if (partialResult) {
|
|
24349
|
-
log(`Partial config loaded from ${configPath}`, {
|
|
24367
|
+
log(`Partial config loaded from ${configPath}`, {
|
|
24368
|
+
agents: partialResult.agents
|
|
24369
|
+
});
|
|
24350
24370
|
return partialResult;
|
|
24351
24371
|
}
|
|
24352
24372
|
return null;
|
|
@@ -24398,13 +24418,11 @@ function mergeConfigs(base, override) {
|
|
|
24398
24418
|
};
|
|
24399
24419
|
}
|
|
24400
24420
|
function loadPluginConfig(directory, ctx) {
|
|
24401
|
-
const
|
|
24402
|
-
|
|
24403
|
-
|
|
24404
|
-
|
|
24405
|
-
const
|
|
24406
|
-
const projectDetected = detectConfigFile(projectBasePath);
|
|
24407
|
-
const projectConfigPath = projectDetected.format !== "none" ? projectDetected.path : projectBasePath + ".json";
|
|
24421
|
+
const userConfigPath = getOpenCodeConfigPaths({
|
|
24422
|
+
binary: "opencode",
|
|
24423
|
+
version: null
|
|
24424
|
+
}).omoConfig;
|
|
24425
|
+
const projectConfigPath = getProjectOmoConfigFilePath(directory);
|
|
24408
24426
|
let config2 = loadConfigFromPath(userConfigPath, ctx) ?? {};
|
|
24409
24427
|
const projectConfig = loadConfigFromPath(projectConfigPath, ctx);
|
|
24410
24428
|
if (projectConfig) {
|
|
@@ -24656,7 +24674,7 @@ var serializeObjectParam = ({ allowReserved, explode, name, style, value, valueO
|
|
|
24656
24674
|
|
|
24657
24675
|
// node_modules/@opencode-ai/sdk/dist/gen/core/utils.gen.js
|
|
24658
24676
|
var PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
24659
|
-
var defaultPathSerializer = ({ path:
|
|
24677
|
+
var defaultPathSerializer = ({ path: path3, url: _url2 }) => {
|
|
24660
24678
|
let url2 = _url2;
|
|
24661
24679
|
const matches = _url2.match(PATH_PARAM_RE);
|
|
24662
24680
|
if (matches) {
|
|
@@ -24675,7 +24693,7 @@ var defaultPathSerializer = ({ path: path4, url: _url2 }) => {
|
|
|
24675
24693
|
name = name.substring(1);
|
|
24676
24694
|
style = "matrix";
|
|
24677
24695
|
}
|
|
24678
|
-
const value =
|
|
24696
|
+
const value = path3[name];
|
|
24679
24697
|
if (value === undefined || value === null) {
|
|
24680
24698
|
continue;
|
|
24681
24699
|
}
|
|
@@ -24706,11 +24724,11 @@ var defaultPathSerializer = ({ path: path4, url: _url2 }) => {
|
|
|
24706
24724
|
}
|
|
24707
24725
|
return url2;
|
|
24708
24726
|
};
|
|
24709
|
-
var getUrl = ({ baseUrl, path:
|
|
24727
|
+
var getUrl = ({ baseUrl, path: path3, query, querySerializer, url: _url2 }) => {
|
|
24710
24728
|
const pathUrl = _url2.startsWith("/") ? _url2 : `/${_url2}`;
|
|
24711
24729
|
let url2 = (baseUrl ?? "") + pathUrl;
|
|
24712
|
-
if (
|
|
24713
|
-
url2 = defaultPathSerializer({ path:
|
|
24730
|
+
if (path3) {
|
|
24731
|
+
url2 = defaultPathSerializer({ path: path3, url: url2 });
|
|
24714
24732
|
}
|
|
24715
24733
|
let search = query ? querySerializer(query) : "";
|
|
24716
24734
|
if (search.startsWith("?")) {
|
|
@@ -26205,18 +26223,18 @@ var BOULDER_STATE_PATH = `${BOULDER_DIR}/${BOULDER_FILE}`;
|
|
|
26205
26223
|
var NOTEPAD_DIR = "notepads";
|
|
26206
26224
|
var NOTEPAD_BASE_PATH = `${BOULDER_DIR}/${NOTEPAD_DIR}`;
|
|
26207
26225
|
// src/features/boulder-state/storage.ts
|
|
26208
|
-
import { existsSync as
|
|
26226
|
+
import { existsSync as existsSync10, readFileSync as readFileSync6, writeFileSync as writeFileSync4, mkdirSync as mkdirSync2, readdirSync as readdirSync2 } from "fs";
|
|
26209
26227
|
import { dirname as dirname2, join as join10, basename } from "path";
|
|
26210
26228
|
function getBoulderFilePath(directory) {
|
|
26211
26229
|
return join10(directory, BOULDER_DIR, BOULDER_FILE);
|
|
26212
26230
|
}
|
|
26213
26231
|
function readBoulderState(directory) {
|
|
26214
26232
|
const filePath = getBoulderFilePath(directory);
|
|
26215
|
-
if (!
|
|
26233
|
+
if (!existsSync10(filePath)) {
|
|
26216
26234
|
return null;
|
|
26217
26235
|
}
|
|
26218
26236
|
try {
|
|
26219
|
-
const content =
|
|
26237
|
+
const content = readFileSync6(filePath, "utf-8");
|
|
26220
26238
|
const parsed = JSON.parse(content);
|
|
26221
26239
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
26222
26240
|
return null;
|
|
@@ -26230,11 +26248,11 @@ function readBoulderState(directory) {
|
|
|
26230
26248
|
}
|
|
26231
26249
|
}
|
|
26232
26250
|
function getPlanProgress(planPath) {
|
|
26233
|
-
if (!
|
|
26251
|
+
if (!existsSync10(planPath)) {
|
|
26234
26252
|
return { total: 0, completed: 0, isComplete: true };
|
|
26235
26253
|
}
|
|
26236
26254
|
try {
|
|
26237
|
-
const content =
|
|
26255
|
+
const content = readFileSync6(planPath, "utf-8");
|
|
26238
26256
|
const uncheckedMatches = content.match(/^\s*[-*]\s*\[\s*\]/gm) || [];
|
|
26239
26257
|
const checkedMatches = content.match(/^\s*[-*]\s*\[[xX]\]/gm) || [];
|
|
26240
26258
|
const total = uncheckedMatches.length + checkedMatches.length;
|
|
@@ -26251,17 +26269,17 @@ function getPlanProgress(planPath) {
|
|
|
26251
26269
|
// src/features/run-continuation-state/constants.ts
|
|
26252
26270
|
var CONTINUATION_MARKER_DIR = ".sisyphus/run-continuation";
|
|
26253
26271
|
// src/features/run-continuation-state/storage.ts
|
|
26254
|
-
import { existsSync as
|
|
26272
|
+
import { existsSync as existsSync11, mkdirSync as mkdirSync3, readFileSync as readFileSync7, rmSync, writeFileSync as writeFileSync5 } from "fs";
|
|
26255
26273
|
import { join as join11 } from "path";
|
|
26256
26274
|
function getMarkerPath(directory, sessionID) {
|
|
26257
26275
|
return join11(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
26258
26276
|
}
|
|
26259
26277
|
function readContinuationMarker(directory, sessionID) {
|
|
26260
26278
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
26261
|
-
if (!
|
|
26279
|
+
if (!existsSync11(markerPath))
|
|
26262
26280
|
return null;
|
|
26263
26281
|
try {
|
|
26264
|
-
const raw =
|
|
26282
|
+
const raw = readFileSync7(markerPath, "utf-8");
|
|
26265
26283
|
const parsed = JSON.parse(raw);
|
|
26266
26284
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
26267
26285
|
return null;
|
|
@@ -26285,17 +26303,17 @@ function getActiveContinuationMarkerReason(marker) {
|
|
|
26285
26303
|
return entry.reason ?? `${source} continuation is active`;
|
|
26286
26304
|
}
|
|
26287
26305
|
// src/hooks/ralph-loop/storage.ts
|
|
26288
|
-
import { existsSync as
|
|
26306
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync4, readFileSync as readFileSync8, rmSync as rmSync2, writeFileSync as writeFileSync6 } from "fs";
|
|
26289
26307
|
import { join as join12 } from "path";
|
|
26290
26308
|
function getStatePath(directory) {
|
|
26291
26309
|
return join12(directory, ".sisyphus", "ralph-loop-state.json");
|
|
26292
26310
|
}
|
|
26293
26311
|
function readState(directory) {
|
|
26294
26312
|
const statePath = getStatePath(directory);
|
|
26295
|
-
if (!
|
|
26313
|
+
if (!existsSync12(statePath))
|
|
26296
26314
|
return null;
|
|
26297
26315
|
try {
|
|
26298
|
-
return JSON.parse(
|
|
26316
|
+
return JSON.parse(readFileSync8(statePath, "utf-8"));
|
|
26299
26317
|
} catch {
|
|
26300
26318
|
return null;
|
|
26301
26319
|
}
|
|
@@ -26982,17 +27000,16 @@ var EXIT_CODES = {
|
|
|
26982
27000
|
FAILURE: 1
|
|
26983
27001
|
};
|
|
26984
27002
|
var MIN_OPENCODE_VERSION = "1.0.150";
|
|
26985
|
-
var CONFIG_BASENAME2 = "oh-my-opencode-gpt-slim";
|
|
26986
27003
|
var OPENCODE_BINARIES2 = ["opencode", "opencode-desktop"];
|
|
26987
27004
|
|
|
26988
27005
|
// src/cli/doctor/checks/system.ts
|
|
26989
27006
|
init_plugin_reference();
|
|
26990
27007
|
init_jsonc_parser();
|
|
26991
|
-
import { existsSync as
|
|
27008
|
+
import { existsSync as existsSync21, readFileSync as readFileSync15 } from "fs";
|
|
26992
27009
|
|
|
26993
27010
|
// src/cli/doctor/checks/system-binary.ts
|
|
26994
27011
|
init_spawn_with_windows_hide();
|
|
26995
|
-
import { existsSync as
|
|
27012
|
+
import { existsSync as existsSync18 } from "fs";
|
|
26996
27013
|
import { homedir as homedir4 } from "os";
|
|
26997
27014
|
import { join as join17 } from "path";
|
|
26998
27015
|
function getDesktopAppPaths(platform) {
|
|
@@ -27032,7 +27049,7 @@ function buildVersionCommand(binaryPath, platform) {
|
|
|
27032
27049
|
}
|
|
27033
27050
|
return [binaryPath, "--version"];
|
|
27034
27051
|
}
|
|
27035
|
-
function findDesktopBinary(platform = process.platform, checkExists =
|
|
27052
|
+
function findDesktopBinary(platform = process.platform, checkExists = existsSync18) {
|
|
27036
27053
|
for (const desktopPath of getDesktopAppPaths(platform)) {
|
|
27037
27054
|
if (checkExists(desktopPath)) {
|
|
27038
27055
|
return { binary: "opencode", path: desktopPath };
|
|
@@ -27042,9 +27059,9 @@ function findDesktopBinary(platform = process.platform, checkExists = existsSync
|
|
|
27042
27059
|
}
|
|
27043
27060
|
async function findOpenCodeBinary() {
|
|
27044
27061
|
for (const binary2 of OPENCODE_BINARIES2) {
|
|
27045
|
-
const
|
|
27046
|
-
if (
|
|
27047
|
-
return { binary: binary2, path:
|
|
27062
|
+
const path3 = Bun.which(binary2);
|
|
27063
|
+
if (path3) {
|
|
27064
|
+
return { binary: binary2, path: path3 };
|
|
27048
27065
|
}
|
|
27049
27066
|
}
|
|
27050
27067
|
return findDesktopBinary();
|
|
@@ -27084,7 +27101,7 @@ init_auto_update_checker();
|
|
|
27084
27101
|
init_plugin_reference();
|
|
27085
27102
|
init_data_path();
|
|
27086
27103
|
init_jsonc_parser();
|
|
27087
|
-
import { existsSync as
|
|
27104
|
+
import { existsSync as existsSync19, readFileSync as readFileSync13 } from "fs";
|
|
27088
27105
|
import { homedir as homedir5 } from "os";
|
|
27089
27106
|
import { join as join18 } from "path";
|
|
27090
27107
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
@@ -27100,15 +27117,15 @@ function resolveOpenCodeCacheDir() {
|
|
|
27100
27117
|
return join18(xdgCacheHome, "opencode");
|
|
27101
27118
|
const fromShared = getOpenCodeCacheDir();
|
|
27102
27119
|
const platformDefault = join18(getPlatformDefaultCacheDir(), "opencode");
|
|
27103
|
-
if (
|
|
27120
|
+
if (existsSync19(fromShared) || !existsSync19(platformDefault))
|
|
27104
27121
|
return fromShared;
|
|
27105
27122
|
return platformDefault;
|
|
27106
27123
|
}
|
|
27107
27124
|
function readPackageJson(filePath) {
|
|
27108
|
-
if (!
|
|
27125
|
+
if (!existsSync19(filePath))
|
|
27109
27126
|
return null;
|
|
27110
27127
|
try {
|
|
27111
|
-
const content =
|
|
27128
|
+
const content = readFileSync13(filePath, "utf-8");
|
|
27112
27129
|
return parseJsonc(content);
|
|
27113
27130
|
} catch {
|
|
27114
27131
|
return null;
|
|
@@ -27148,12 +27165,12 @@ function getSuggestedInstallTag(currentVersion) {
|
|
|
27148
27165
|
init_plugin_reference();
|
|
27149
27166
|
init_opencode_config_dir();
|
|
27150
27167
|
init_jsonc_parser();
|
|
27151
|
-
import { existsSync as
|
|
27168
|
+
import { existsSync as existsSync20, readFileSync as readFileSync14 } from "fs";
|
|
27152
27169
|
function detectConfigPath() {
|
|
27153
27170
|
const paths = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
27154
|
-
if (
|
|
27171
|
+
if (existsSync20(paths.configJsonc))
|
|
27155
27172
|
return paths.configJsonc;
|
|
27156
|
-
if (
|
|
27173
|
+
if (existsSync20(paths.configJson))
|
|
27157
27174
|
return paths.configJson;
|
|
27158
27175
|
return null;
|
|
27159
27176
|
}
|
|
@@ -27180,7 +27197,7 @@ function getPluginInfo() {
|
|
|
27180
27197
|
};
|
|
27181
27198
|
}
|
|
27182
27199
|
try {
|
|
27183
|
-
const content =
|
|
27200
|
+
const content = readFileSync14(configPath, "utf-8");
|
|
27184
27201
|
const parsedConfig = parseJsonc(content);
|
|
27185
27202
|
const pluginEntry = findPluginEntry2(parsedConfig.plugin ?? []);
|
|
27186
27203
|
if (!pluginEntry) {
|
|
@@ -27221,10 +27238,10 @@ function getPluginInfo() {
|
|
|
27221
27238
|
function isConfigValid(configPath) {
|
|
27222
27239
|
if (!configPath)
|
|
27223
27240
|
return true;
|
|
27224
|
-
if (!
|
|
27241
|
+
if (!existsSync21(configPath))
|
|
27225
27242
|
return false;
|
|
27226
27243
|
try {
|
|
27227
|
-
parseJsonc(
|
|
27244
|
+
parseJsonc(readFileSync15(configPath, "utf-8"));
|
|
27228
27245
|
return true;
|
|
27229
27246
|
} catch {
|
|
27230
27247
|
return false;
|
|
@@ -27327,11 +27344,56 @@ async function checkSystem() {
|
|
|
27327
27344
|
}
|
|
27328
27345
|
|
|
27329
27346
|
// src/cli/doctor/checks/config.ts
|
|
27330
|
-
import { existsSync as existsSync24, readFileSync as readFileSync19 } from "fs";
|
|
27331
|
-
import { join as join22 } from "path";
|
|
27332
27347
|
init_data_path();
|
|
27348
|
+
import { existsSync as existsSync24, readFileSync as readFileSync19 } from "fs";
|
|
27349
|
+
import { join as join21 } from "path";
|
|
27350
|
+
|
|
27351
|
+
// src/cli/doctor/checks/config-validation.ts
|
|
27352
|
+
import { existsSync as existsSync22, readFileSync as readFileSync16 } from "fs";
|
|
27353
|
+
init_omo_config_file();
|
|
27333
27354
|
init_opencode_config_dir();
|
|
27334
|
-
|
|
27355
|
+
var USER_CONFIG_PATH = getOmoConfigFilePath(getOpenCodeConfigDir({ binary: "opencode" }));
|
|
27356
|
+
var PROJECT_CONFIG_PATH = getProjectOmoConfigFilePath(process.cwd());
|
|
27357
|
+
function findConfigPath() {
|
|
27358
|
+
if (existsSync22(PROJECT_CONFIG_PATH)) {
|
|
27359
|
+
return PROJECT_CONFIG_PATH;
|
|
27360
|
+
}
|
|
27361
|
+
if (existsSync22(USER_CONFIG_PATH)) {
|
|
27362
|
+
return USER_CONFIG_PATH;
|
|
27363
|
+
}
|
|
27364
|
+
return null;
|
|
27365
|
+
}
|
|
27366
|
+
function validateConfig() {
|
|
27367
|
+
const configPath = findConfigPath();
|
|
27368
|
+
if (!configPath) {
|
|
27369
|
+
return { exists: false, path: null, valid: true, config: null, errors: [] };
|
|
27370
|
+
}
|
|
27371
|
+
try {
|
|
27372
|
+
const rawConfig = parseOmoConfigJson(readFileSync16(configPath, "utf-8"));
|
|
27373
|
+
const schemaResult = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
|
|
27374
|
+
if (!schemaResult.success) {
|
|
27375
|
+
return {
|
|
27376
|
+
exists: true,
|
|
27377
|
+
path: configPath,
|
|
27378
|
+
valid: false,
|
|
27379
|
+
config: rawConfig,
|
|
27380
|
+
errors: schemaResult.error.issues.map((issue2) => `${issue2.path.join(".")}: ${issue2.message}`)
|
|
27381
|
+
};
|
|
27382
|
+
}
|
|
27383
|
+
return { exists: true, path: configPath, valid: true, config: rawConfig, errors: [] };
|
|
27384
|
+
} catch (error48) {
|
|
27385
|
+
return {
|
|
27386
|
+
exists: true,
|
|
27387
|
+
path: configPath,
|
|
27388
|
+
valid: false,
|
|
27389
|
+
config: null,
|
|
27390
|
+
errors: [error48 instanceof Error ? error48.message : "Failed to parse config"]
|
|
27391
|
+
};
|
|
27392
|
+
}
|
|
27393
|
+
}
|
|
27394
|
+
|
|
27395
|
+
// src/cli/doctor/checks/model-resolution.ts
|
|
27396
|
+
init_model_requirements();
|
|
27335
27397
|
|
|
27336
27398
|
// src/cli/doctor/checks/model-resolution-cache.ts
|
|
27337
27399
|
init_shared();
|
|
@@ -27366,42 +27428,31 @@ function loadAvailableModelsFromCache() {
|
|
|
27366
27428
|
}
|
|
27367
27429
|
}
|
|
27368
27430
|
|
|
27369
|
-
// src/cli/doctor/checks/model-resolution.ts
|
|
27370
|
-
init_model_requirements();
|
|
27371
|
-
|
|
27372
27431
|
// src/cli/doctor/checks/model-resolution-config.ts
|
|
27373
|
-
|
|
27432
|
+
init_omo_config_file();
|
|
27374
27433
|
init_opencode_config_dir();
|
|
27375
|
-
init_jsonc_parser();
|
|
27376
27434
|
import { readFileSync as readFileSync18 } from "fs";
|
|
27377
|
-
|
|
27378
|
-
|
|
27379
|
-
|
|
27435
|
+
var USER_CONFIG_PATH2 = getOpenCodeConfigPaths({
|
|
27436
|
+
binary: "opencode",
|
|
27437
|
+
version: null
|
|
27438
|
+
}).omoConfig;
|
|
27439
|
+
var PROJECT_CONFIG_PATH2 = getProjectOmoConfigFilePath(process.cwd());
|
|
27380
27440
|
function loadOmoConfig() {
|
|
27381
|
-
|
|
27382
|
-
|
|
27383
|
-
|
|
27384
|
-
|
|
27385
|
-
|
|
27386
|
-
|
|
27387
|
-
|
|
27388
|
-
|
|
27389
|
-
|
|
27390
|
-
const userDetected = detectConfigFile(USER_CONFIG_BASE);
|
|
27391
|
-
if (userDetected.format !== "none") {
|
|
27392
|
-
try {
|
|
27393
|
-
const content = readFileSync18(userDetected.path, "utf-8");
|
|
27394
|
-
return parseJsonc(content);
|
|
27395
|
-
} catch {
|
|
27396
|
-
return null;
|
|
27397
|
-
}
|
|
27441
|
+
try {
|
|
27442
|
+
const content = readFileSync18(PROJECT_CONFIG_PATH2, "utf-8");
|
|
27443
|
+
return parseOmoConfigJson(content);
|
|
27444
|
+
} catch {}
|
|
27445
|
+
try {
|
|
27446
|
+
const content = readFileSync18(USER_CONFIG_PATH2, "utf-8");
|
|
27447
|
+
return parseOmoConfigJson(content);
|
|
27448
|
+
} catch {
|
|
27449
|
+
return null;
|
|
27398
27450
|
}
|
|
27399
|
-
return null;
|
|
27400
27451
|
}
|
|
27401
27452
|
|
|
27402
27453
|
// src/cli/doctor/checks/model-resolution-details.ts
|
|
27403
27454
|
init_shared();
|
|
27404
|
-
import { join as
|
|
27455
|
+
import { join as join20 } from "path";
|
|
27405
27456
|
|
|
27406
27457
|
// src/cli/doctor/checks/model-resolution-variant.ts
|
|
27407
27458
|
function formatModelWithVariant(model, variant) {
|
|
@@ -27440,7 +27491,7 @@ function getCategoryEffectiveVariant(categoryName, requirement, config2) {
|
|
|
27440
27491
|
// src/cli/doctor/checks/model-resolution-details.ts
|
|
27441
27492
|
function buildModelResolutionDetails(options) {
|
|
27442
27493
|
const details = [];
|
|
27443
|
-
const cacheFile =
|
|
27494
|
+
const cacheFile = join20(getOpenCodeCacheDir(), "models.json");
|
|
27444
27495
|
details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
|
|
27445
27496
|
details.push("");
|
|
27446
27497
|
if (options.available.cacheExists) {
|
|
@@ -27552,55 +27603,15 @@ async function checkModels() {
|
|
|
27552
27603
|
}
|
|
27553
27604
|
|
|
27554
27605
|
// src/cli/doctor/checks/config.ts
|
|
27555
|
-
var USER_CONFIG_BASE2 = join22(getOpenCodeConfigDir({ binary: "opencode" }), CONFIG_BASENAME2);
|
|
27556
|
-
var PROJECT_CONFIG_BASE2 = join22(process.cwd(), ".opencode", CONFIG_BASENAME2);
|
|
27557
|
-
function findConfigPath() {
|
|
27558
|
-
const projectConfig = detectConfigFile(PROJECT_CONFIG_BASE2);
|
|
27559
|
-
if (projectConfig.format !== "none")
|
|
27560
|
-
return projectConfig.path;
|
|
27561
|
-
const userConfig = detectConfigFile(USER_CONFIG_BASE2);
|
|
27562
|
-
if (userConfig.format !== "none")
|
|
27563
|
-
return userConfig.path;
|
|
27564
|
-
return null;
|
|
27565
|
-
}
|
|
27566
|
-
function validateConfig() {
|
|
27567
|
-
const configPath = findConfigPath();
|
|
27568
|
-
if (!configPath) {
|
|
27569
|
-
return { exists: false, path: null, valid: true, config: null, errors: [] };
|
|
27570
|
-
}
|
|
27571
|
-
try {
|
|
27572
|
-
const content = readFileSync19(configPath, "utf-8");
|
|
27573
|
-
const rawConfig = parseJsonc(content);
|
|
27574
|
-
const schemaResult = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
|
|
27575
|
-
if (!schemaResult.success) {
|
|
27576
|
-
return {
|
|
27577
|
-
exists: true,
|
|
27578
|
-
path: configPath,
|
|
27579
|
-
valid: false,
|
|
27580
|
-
config: rawConfig,
|
|
27581
|
-
errors: schemaResult.error.issues.map((issue2) => `${issue2.path.join(".")}: ${issue2.message}`)
|
|
27582
|
-
};
|
|
27583
|
-
}
|
|
27584
|
-
return { exists: true, path: configPath, valid: true, config: rawConfig, errors: [] };
|
|
27585
|
-
} catch (error48) {
|
|
27586
|
-
return {
|
|
27587
|
-
exists: true,
|
|
27588
|
-
path: configPath,
|
|
27589
|
-
valid: false,
|
|
27590
|
-
config: null,
|
|
27591
|
-
errors: [error48 instanceof Error ? error48.message : "Failed to parse config"]
|
|
27592
|
-
};
|
|
27593
|
-
}
|
|
27594
|
-
}
|
|
27595
27606
|
function loadKnownProviderIds() {
|
|
27596
27607
|
const availableModels = loadAvailableModelsFromCache();
|
|
27597
27608
|
const providers = new Set(availableModels.providers);
|
|
27598
27609
|
const cacheDirs = [
|
|
27599
|
-
|
|
27600
|
-
|
|
27610
|
+
join21(getCacheDir(), "oh-my-opencode-gpt-slim"),
|
|
27611
|
+
join21(getCacheDir(), "oh-my-opencode")
|
|
27601
27612
|
];
|
|
27602
27613
|
for (const cacheDir of cacheDirs) {
|
|
27603
|
-
const providerModelsPath =
|
|
27614
|
+
const providerModelsPath = join21(cacheDir, "provider-models.json");
|
|
27604
27615
|
if (existsSync24(providerModelsPath)) {
|
|
27605
27616
|
try {
|
|
27606
27617
|
const content = readFileSync19(providerModelsPath, "utf-8");
|
|
@@ -27610,7 +27621,7 @@ function loadKnownProviderIds() {
|
|
|
27610
27621
|
}
|
|
27611
27622
|
} catch {}
|
|
27612
27623
|
}
|
|
27613
|
-
const connectedProvidersPath =
|
|
27624
|
+
const connectedProvidersPath = join21(cacheDir, "connected-providers.json");
|
|
27614
27625
|
if (existsSync24(connectedProvidersPath)) {
|
|
27615
27626
|
try {
|
|
27616
27627
|
const content = readFileSync19(connectedProvidersPath, "utf-8");
|
|
@@ -27705,12 +27716,12 @@ async function checkConfig() {
|
|
|
27705
27716
|
init_spawn_with_windows_hide();
|
|
27706
27717
|
import { existsSync as existsSync25 } from "fs";
|
|
27707
27718
|
import { createRequire } from "module";
|
|
27708
|
-
import { dirname as dirname4, join as
|
|
27719
|
+
import { dirname as dirname4, join as join22 } from "path";
|
|
27709
27720
|
async function checkBinaryExists(binary2) {
|
|
27710
27721
|
try {
|
|
27711
|
-
const
|
|
27712
|
-
if (
|
|
27713
|
-
return { exists: true, path:
|
|
27722
|
+
const path3 = Bun.which(binary2);
|
|
27723
|
+
if (path3) {
|
|
27724
|
+
return { exists: true, path: path3 };
|
|
27714
27725
|
}
|
|
27715
27726
|
} catch {}
|
|
27716
27727
|
return { exists: false, path: null };
|
|
@@ -27762,11 +27773,11 @@ async function checkAstGrepNapi() {
|
|
|
27762
27773
|
};
|
|
27763
27774
|
} catch {
|
|
27764
27775
|
const { existsSync: existsSync26 } = await import("fs");
|
|
27765
|
-
const { join:
|
|
27776
|
+
const { join: join23 } = await import("path");
|
|
27766
27777
|
const { homedir: homedir7 } = await import("os");
|
|
27767
27778
|
const pathsToCheck = [
|
|
27768
|
-
|
|
27769
|
-
|
|
27779
|
+
join23(homedir7(), ".config", "opencode", "node_modules", "@ast-grep", "napi"),
|
|
27780
|
+
join23(process.cwd(), "node_modules", "@ast-grep", "napi")
|
|
27770
27781
|
];
|
|
27771
27782
|
for (const napiPath of pathsToCheck) {
|
|
27772
27783
|
if (existsSync26(napiPath)) {
|
|
@@ -27794,7 +27805,7 @@ function findCommentCheckerPackageBinary() {
|
|
|
27794
27805
|
try {
|
|
27795
27806
|
const require2 = createRequire(import.meta.url);
|
|
27796
27807
|
const pkgPath = require2.resolve("@code-yeongyu/comment-checker/package.json");
|
|
27797
|
-
const binaryPath =
|
|
27808
|
+
const binaryPath = join22(dirname4(pkgPath), "bin", binaryName);
|
|
27798
27809
|
if (existsSync25(binaryPath))
|
|
27799
27810
|
return binaryPath;
|
|
27800
27811
|
} catch {}
|
|
@@ -27911,11 +27922,12 @@ async function getGhCliInfo() {
|
|
|
27911
27922
|
// src/tools/lsp/server-config-loader.ts
|
|
27912
27923
|
init_shared();
|
|
27913
27924
|
init_jsonc_parser();
|
|
27925
|
+
init_omo_config_file();
|
|
27914
27926
|
|
|
27915
27927
|
// src/tools/lsp/server-installation.ts
|
|
27916
27928
|
init_shared();
|
|
27917
27929
|
import { existsSync as existsSync26 } from "fs";
|
|
27918
|
-
import { join as
|
|
27930
|
+
import { join as join23 } from "path";
|
|
27919
27931
|
function isServerInstalled(command) {
|
|
27920
27932
|
if (command.length === 0)
|
|
27921
27933
|
return false;
|
|
@@ -27943,23 +27955,23 @@ function isServerInstalled(command) {
|
|
|
27943
27955
|
const paths = pathEnv.split(pathSeparator);
|
|
27944
27956
|
for (const p2 of paths) {
|
|
27945
27957
|
for (const suffix of exts) {
|
|
27946
|
-
if (existsSync26(
|
|
27958
|
+
if (existsSync26(join23(p2, cmd + suffix))) {
|
|
27947
27959
|
return true;
|
|
27948
27960
|
}
|
|
27949
27961
|
}
|
|
27950
27962
|
}
|
|
27951
27963
|
const cwd = process.cwd();
|
|
27952
27964
|
const configDir = getOpenCodeConfigDir({ binary: "opencode" });
|
|
27953
|
-
const dataDir =
|
|
27965
|
+
const dataDir = join23(getDataDir(), "opencode");
|
|
27954
27966
|
const additionalBases = [
|
|
27955
|
-
|
|
27956
|
-
|
|
27957
|
-
|
|
27958
|
-
|
|
27967
|
+
join23(cwd, "node_modules", ".bin"),
|
|
27968
|
+
join23(configDir, "bin"),
|
|
27969
|
+
join23(configDir, "node_modules", ".bin"),
|
|
27970
|
+
join23(dataDir, "bin")
|
|
27959
27971
|
];
|
|
27960
27972
|
for (const base of additionalBases) {
|
|
27961
27973
|
for (const suffix of exts) {
|
|
27962
|
-
if (existsSync26(
|
|
27974
|
+
if (existsSync26(join23(base, cmd + suffix))) {
|
|
27963
27975
|
return true;
|
|
27964
27976
|
}
|
|
27965
27977
|
}
|
|
@@ -27995,13 +28007,13 @@ function getLspServerStats(servers) {
|
|
|
27995
28007
|
init_shared();
|
|
27996
28008
|
import { existsSync as existsSync27, readFileSync as readFileSync20 } from "fs";
|
|
27997
28009
|
import { homedir as homedir7 } from "os";
|
|
27998
|
-
import { join as
|
|
28010
|
+
import { join as join24 } from "path";
|
|
27999
28011
|
var BUILTIN_MCP_SERVERS = ["context7", "grep_app"];
|
|
28000
28012
|
function getMcpConfigPaths() {
|
|
28001
28013
|
return [
|
|
28002
|
-
|
|
28003
|
-
|
|
28004
|
-
|
|
28014
|
+
join24(homedir7(), ".claude", ".mcp.json"),
|
|
28015
|
+
join24(process.cwd(), ".mcp.json"),
|
|
28016
|
+
join24(process.cwd(), ".claude", ".mcp.json")
|
|
28005
28017
|
];
|
|
28006
28018
|
}
|
|
28007
28019
|
function loadUserMcpConfig() {
|
|
@@ -28413,10 +28425,10 @@ async function doctor(options = { mode: "default" }) {
|
|
|
28413
28425
|
// src/features/mcp-oauth/storage.ts
|
|
28414
28426
|
init_shared();
|
|
28415
28427
|
import { chmodSync, existsSync as existsSync28, mkdirSync as mkdirSync5, readFileSync as readFileSync21, unlinkSync as unlinkSync2, writeFileSync as writeFileSync7 } from "fs";
|
|
28416
|
-
import { dirname as dirname5, join as
|
|
28428
|
+
import { dirname as dirname5, join as join25 } from "path";
|
|
28417
28429
|
var STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
28418
28430
|
function getMcpOauthStoragePath() {
|
|
28419
|
-
return
|
|
28431
|
+
return join25(getOpenCodeConfigDir({ binary: "opencode" }), STORAGE_FILE_NAME);
|
|
28420
28432
|
}
|
|
28421
28433
|
function normalizeHost(serverHost) {
|
|
28422
28434
|
let host = serverHost.trim();
|
|
@@ -29034,7 +29046,7 @@ function createMcpOAuthCommand() {
|
|
|
29034
29046
|
|
|
29035
29047
|
// src/cli/validate-skill/validate-skill.ts
|
|
29036
29048
|
import { existsSync as existsSync30 } from "fs";
|
|
29037
|
-
import { join as
|
|
29049
|
+
import { join as join30 } from "path";
|
|
29038
29050
|
|
|
29039
29051
|
// src/features/skill-creator/eval-grader.ts
|
|
29040
29052
|
function includesAll(text, values) {
|
|
@@ -29113,7 +29125,7 @@ function gradeEvalReport(report, sourceReport) {
|
|
|
29113
29125
|
}
|
|
29114
29126
|
// src/features/skill-creator/eval-runner.ts
|
|
29115
29127
|
import { mkdtemp, mkdir, cp, rm } from "fs/promises";
|
|
29116
|
-
import { dirname as dirname6, join as
|
|
29128
|
+
import { dirname as dirname6, join as join28, resolve as resolve2 } from "path";
|
|
29117
29129
|
import { tmpdir as tmpdir2 } from "os";
|
|
29118
29130
|
|
|
29119
29131
|
// src/tools/session-manager/storage.ts
|
|
@@ -29122,14 +29134,14 @@ init_opencode_message_dir();
|
|
|
29122
29134
|
init_opencode_storage_detection();
|
|
29123
29135
|
import { existsSync as existsSync29 } from "fs";
|
|
29124
29136
|
import { readdir, readFile } from "fs/promises";
|
|
29125
|
-
import { join as
|
|
29137
|
+
import { join as join27 } from "path";
|
|
29126
29138
|
|
|
29127
29139
|
// src/tools/session-manager/constants.ts
|
|
29128
29140
|
init_shared();
|
|
29129
29141
|
init_shared();
|
|
29130
|
-
import { join as
|
|
29131
|
-
var TODO_DIR =
|
|
29132
|
-
var TRANSCRIPT_DIR =
|
|
29142
|
+
import { join as join26 } from "path";
|
|
29143
|
+
var TODO_DIR = join26(getClaudeConfigDir(), "todos");
|
|
29144
|
+
var TRANSCRIPT_DIR = join26(getClaudeConfigDir(), "transcripts");
|
|
29133
29145
|
|
|
29134
29146
|
// src/tools/session-manager/storage.ts
|
|
29135
29147
|
init_opencode_message_dir();
|
|
@@ -29201,7 +29213,7 @@ async function readSessionMessages(sessionID) {
|
|
|
29201
29213
|
if (!file2.endsWith(".json"))
|
|
29202
29214
|
continue;
|
|
29203
29215
|
try {
|
|
29204
|
-
const content = await readFile(
|
|
29216
|
+
const content = await readFile(join27(messageDir, file2), "utf-8");
|
|
29205
29217
|
const meta3 = JSON.parse(content);
|
|
29206
29218
|
const parts = await readParts(meta3.id);
|
|
29207
29219
|
messages.push({
|
|
@@ -29225,7 +29237,7 @@ async function readSessionMessages(sessionID) {
|
|
|
29225
29237
|
});
|
|
29226
29238
|
}
|
|
29227
29239
|
async function readParts(messageID) {
|
|
29228
|
-
const partDir =
|
|
29240
|
+
const partDir = join27(PART_STORAGE, messageID);
|
|
29229
29241
|
if (!existsSync29(partDir))
|
|
29230
29242
|
return [];
|
|
29231
29243
|
const parts = [];
|
|
@@ -29235,7 +29247,7 @@ async function readParts(messageID) {
|
|
|
29235
29247
|
if (!file2.endsWith(".json"))
|
|
29236
29248
|
continue;
|
|
29237
29249
|
try {
|
|
29238
|
-
const content = await readFile(
|
|
29250
|
+
const content = await readFile(join27(partDir, file2), "utf-8");
|
|
29239
29251
|
parts.push(JSON.parse(content));
|
|
29240
29252
|
} catch {}
|
|
29241
29253
|
}
|
|
@@ -29317,13 +29329,13 @@ function detectSkillInvocation(messages, skillName) {
|
|
|
29317
29329
|
}));
|
|
29318
29330
|
}
|
|
29319
29331
|
async function createEvalWorkspace(skillDir, skillName, evalBaseDir, files) {
|
|
29320
|
-
const workspaceDir = await mkdtemp(
|
|
29321
|
-
const skillTargetDir =
|
|
29332
|
+
const workspaceDir = await mkdtemp(join28(tmpdir2(), "omo-skill-eval-"));
|
|
29333
|
+
const skillTargetDir = join28(workspaceDir, ".opencode", "skills", skillName);
|
|
29322
29334
|
await mkdir(dirname6(skillTargetDir), { recursive: true });
|
|
29323
29335
|
await cp(skillDir, skillTargetDir, { recursive: true });
|
|
29324
29336
|
for (const file2 of files) {
|
|
29325
29337
|
const sourcePath = resolve2(evalBaseDir, file2);
|
|
29326
|
-
const targetPath =
|
|
29338
|
+
const targetPath = join28(workspaceDir, file2);
|
|
29327
29339
|
await mkdir(dirname6(targetPath), { recursive: true });
|
|
29328
29340
|
await cp(sourcePath, targetPath, { recursive: true });
|
|
29329
29341
|
}
|
|
@@ -29430,7 +29442,7 @@ async function loadSkillEvalSuite(evalFilePath) {
|
|
|
29430
29442
|
}
|
|
29431
29443
|
// src/features/skill-creator/skill-validator.ts
|
|
29432
29444
|
import { access, readFile as readFile3 } from "fs/promises";
|
|
29433
|
-
import { dirname as dirname7, join as
|
|
29445
|
+
import { dirname as dirname7, join as join29, resolve as resolve3 } from "path";
|
|
29434
29446
|
init_frontmatter();
|
|
29435
29447
|
var ALLOWED_FRONTMATTER_KEYS = new Set([
|
|
29436
29448
|
"name",
|
|
@@ -29448,16 +29460,16 @@ var ALLOWED_FRONTMATTER_KEYS = new Set([
|
|
|
29448
29460
|
function isZodError(error48) {
|
|
29449
29461
|
return error48 instanceof exports_external.ZodError;
|
|
29450
29462
|
}
|
|
29451
|
-
async function pathExists(
|
|
29463
|
+
async function pathExists(path3) {
|
|
29452
29464
|
try {
|
|
29453
|
-
await access(
|
|
29465
|
+
await access(path3);
|
|
29454
29466
|
return true;
|
|
29455
29467
|
} catch {
|
|
29456
29468
|
return false;
|
|
29457
29469
|
}
|
|
29458
29470
|
}
|
|
29459
29471
|
async function resolveSkillFilePath(skillPath) {
|
|
29460
|
-
const directSkillFile = skillPath.endsWith("SKILL.md") ? skillPath :
|
|
29472
|
+
const directSkillFile = skillPath.endsWith("SKILL.md") ? skillPath : join29(skillPath, "SKILL.md");
|
|
29461
29473
|
const exists = await pathExists(directSkillFile);
|
|
29462
29474
|
if (!exists) {
|
|
29463
29475
|
throw new Error(`SKILL.md not found at ${directSkillFile}`);
|
|
@@ -29579,9 +29591,9 @@ async function validateSkillDirectory(skillPath, evalFilePath) {
|
|
|
29579
29591
|
// src/cli/validate-skill/validate-skill.ts
|
|
29580
29592
|
function findDefaultEvalFile(skillDir) {
|
|
29581
29593
|
const candidates = [
|
|
29582
|
-
|
|
29583
|
-
|
|
29584
|
-
|
|
29594
|
+
join30(skillDir, "evals", "evals.json"),
|
|
29595
|
+
join30(skillDir, "evals", "evals.yaml"),
|
|
29596
|
+
join30(skillDir, "evals", "evals.yml")
|
|
29585
29597
|
];
|
|
29586
29598
|
return candidates.find((candidate) => existsSync30(candidate));
|
|
29587
29599
|
}
|