oh-my-opencode-unguarded 3.10.0 → 3.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +122 -79
- package/dist/hooks/auto-update-checker/constants.d.ts +2 -0
- package/dist/index.js +238 -189
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -8533,6 +8533,7 @@ var require_src = __commonJS((exports, module) => {
|
|
|
8533
8533
|
});
|
|
8534
8534
|
|
|
8535
8535
|
// src/hooks/auto-update-checker/constants.ts
|
|
8536
|
+
import * as fs4 from "fs";
|
|
8536
8537
|
import * as path4 from "path";
|
|
8537
8538
|
import * as os3 from "os";
|
|
8538
8539
|
function getCacheDir2() {
|
|
@@ -8541,21 +8542,37 @@ function getCacheDir2() {
|
|
|
8541
8542
|
}
|
|
8542
8543
|
return path4.join(os3.homedir(), ".cache", "opencode");
|
|
8543
8544
|
}
|
|
8545
|
+
function resolveHostCacheDir() {
|
|
8546
|
+
if (process.platform === "win32") {
|
|
8547
|
+
const dotCacheDir = path4.join(os3.homedir(), ".cache", "opencode");
|
|
8548
|
+
if (fs4.existsSync(path4.join(dotCacheDir, "node_modules"))) {
|
|
8549
|
+
return dotCacheDir;
|
|
8550
|
+
}
|
|
8551
|
+
const localAppDataDir = path4.join(process.env.LOCALAPPDATA ?? os3.homedir(), "opencode");
|
|
8552
|
+
if (fs4.existsSync(path4.join(localAppDataDir, "node_modules"))) {
|
|
8553
|
+
return localAppDataDir;
|
|
8554
|
+
}
|
|
8555
|
+
return dotCacheDir;
|
|
8556
|
+
}
|
|
8557
|
+
return path4.join(os3.homedir(), ".cache", "opencode");
|
|
8558
|
+
}
|
|
8544
8559
|
function getWindowsAppdataDir() {
|
|
8545
8560
|
if (process.platform !== "win32")
|
|
8546
8561
|
return null;
|
|
8547
8562
|
return process.env.APPDATA ?? path4.join(os3.homedir(), "AppData", "Roaming");
|
|
8548
8563
|
}
|
|
8549
|
-
var PACKAGE_NAME3 = "oh-my-opencode-unguarded", NPM_REGISTRY_URL, NPM_FETCH_TIMEOUT = 5000, CACHE_DIR, VERSION_FILE, USER_CONFIG_DIR, USER_OPENCODE_CONFIG, USER_OPENCODE_CONFIG_JSONC, INSTALLED_PACKAGE_JSON;
|
|
8564
|
+
var PACKAGE_NAME3 = "oh-my-opencode-unguarded", NPM_REGISTRY_URL, NPM_FETCH_TIMEOUT = 5000, CACHE_DIR, VERSION_FILE, HOST_CACHE_DIR, USER_CONFIG_DIR, USER_OPENCODE_CONFIG, USER_OPENCODE_CONFIG_JSONC, INSTALLED_PACKAGE_JSON, HOST_INSTALLED_PACKAGE_JSON;
|
|
8550
8565
|
var init_constants3 = __esm(() => {
|
|
8551
8566
|
init_shared();
|
|
8552
8567
|
NPM_REGISTRY_URL = `https://registry.npmjs.org/-/package/${PACKAGE_NAME3}/dist-tags`;
|
|
8553
8568
|
CACHE_DIR = getCacheDir2();
|
|
8554
8569
|
VERSION_FILE = path4.join(CACHE_DIR, "version");
|
|
8570
|
+
HOST_CACHE_DIR = resolveHostCacheDir();
|
|
8555
8571
|
USER_CONFIG_DIR = getOpenCodeConfigDir({ binary: "opencode" });
|
|
8556
8572
|
USER_OPENCODE_CONFIG = path4.join(USER_CONFIG_DIR, "opencode.json");
|
|
8557
8573
|
USER_OPENCODE_CONFIG_JSONC = path4.join(USER_CONFIG_DIR, "opencode.jsonc");
|
|
8558
8574
|
INSTALLED_PACKAGE_JSON = path4.join(USER_CONFIG_DIR, "node_modules", PACKAGE_NAME3, "package.json");
|
|
8575
|
+
HOST_INSTALLED_PACKAGE_JSON = path4.join(HOST_CACHE_DIR, "node_modules", PACKAGE_NAME3, "package.json");
|
|
8559
8576
|
});
|
|
8560
8577
|
|
|
8561
8578
|
// src/hooks/auto-update-checker/checker/config-paths.ts
|
|
@@ -8595,7 +8612,7 @@ function stripJsonComments(json3) {
|
|
|
8595
8612
|
}
|
|
8596
8613
|
|
|
8597
8614
|
// src/hooks/auto-update-checker/checker/local-dev-path.ts
|
|
8598
|
-
import * as
|
|
8615
|
+
import * as fs5 from "fs";
|
|
8599
8616
|
import { fileURLToPath } from "url";
|
|
8600
8617
|
function isLocalDevMode(directory) {
|
|
8601
8618
|
return getLocalDevPath(directory) !== null;
|
|
@@ -8603,9 +8620,9 @@ function isLocalDevMode(directory) {
|
|
|
8603
8620
|
function getLocalDevPath(directory) {
|
|
8604
8621
|
for (const configPath of getConfigPaths(directory)) {
|
|
8605
8622
|
try {
|
|
8606
|
-
if (!
|
|
8623
|
+
if (!fs5.existsSync(configPath))
|
|
8607
8624
|
continue;
|
|
8608
|
-
const content =
|
|
8625
|
+
const content = fs5.readFileSync(configPath, "utf-8");
|
|
8609
8626
|
const config2 = JSON.parse(stripJsonComments(content));
|
|
8610
8627
|
const plugins = config2.plugin ?? [];
|
|
8611
8628
|
for (const entry of plugins) {
|
|
@@ -8629,17 +8646,17 @@ var init_local_dev_path = __esm(() => {
|
|
|
8629
8646
|
});
|
|
8630
8647
|
|
|
8631
8648
|
// src/hooks/auto-update-checker/checker/package-json-locator.ts
|
|
8632
|
-
import * as
|
|
8649
|
+
import * as fs6 from "fs";
|
|
8633
8650
|
import * as path6 from "path";
|
|
8634
8651
|
function findPackageJsonUp(startPath) {
|
|
8635
8652
|
try {
|
|
8636
|
-
const stat =
|
|
8653
|
+
const stat = fs6.statSync(startPath);
|
|
8637
8654
|
let dir = stat.isDirectory() ? startPath : path6.dirname(startPath);
|
|
8638
8655
|
for (let i2 = 0;i2 < 10; i2++) {
|
|
8639
8656
|
const pkgPath = path6.join(dir, "package.json");
|
|
8640
|
-
if (
|
|
8657
|
+
if (fs6.existsSync(pkgPath)) {
|
|
8641
8658
|
try {
|
|
8642
|
-
const content =
|
|
8659
|
+
const content = fs6.readFileSync(pkgPath, "utf-8");
|
|
8643
8660
|
const pkg = JSON.parse(content);
|
|
8644
8661
|
if (pkg.name === PACKAGE_NAME3)
|
|
8645
8662
|
return pkgPath;
|
|
@@ -8658,7 +8675,7 @@ var init_package_json_locator = __esm(() => {
|
|
|
8658
8675
|
});
|
|
8659
8676
|
|
|
8660
8677
|
// src/hooks/auto-update-checker/checker/local-dev-version.ts
|
|
8661
|
-
import * as
|
|
8678
|
+
import * as fs7 from "fs";
|
|
8662
8679
|
function getLocalDevVersion(directory) {
|
|
8663
8680
|
const localPath = getLocalDevPath(directory);
|
|
8664
8681
|
if (!localPath)
|
|
@@ -8667,7 +8684,7 @@ function getLocalDevVersion(directory) {
|
|
|
8667
8684
|
const pkgPath = findPackageJsonUp(localPath);
|
|
8668
8685
|
if (!pkgPath)
|
|
8669
8686
|
return null;
|
|
8670
|
-
const content =
|
|
8687
|
+
const content = fs7.readFileSync(pkgPath, "utf-8");
|
|
8671
8688
|
const pkg = JSON.parse(content);
|
|
8672
8689
|
return pkg.version ?? null;
|
|
8673
8690
|
} catch {
|
|
@@ -8680,16 +8697,16 @@ var init_local_dev_version = __esm(() => {
|
|
|
8680
8697
|
});
|
|
8681
8698
|
|
|
8682
8699
|
// src/hooks/auto-update-checker/checker/plugin-entry.ts
|
|
8683
|
-
import * as
|
|
8700
|
+
import * as fs8 from "fs";
|
|
8684
8701
|
function isExplicitVersionPin(pinnedVersion) {
|
|
8685
8702
|
return /^\d+\.\d+\.\d+/.test(pinnedVersion);
|
|
8686
8703
|
}
|
|
8687
8704
|
function findPluginEntry(directory) {
|
|
8688
8705
|
for (const configPath of getConfigPaths(directory)) {
|
|
8689
8706
|
try {
|
|
8690
|
-
if (!
|
|
8707
|
+
if (!fs8.existsSync(configPath))
|
|
8691
8708
|
continue;
|
|
8692
|
-
const content =
|
|
8709
|
+
const content = fs8.readFileSync(configPath, "utf-8");
|
|
8693
8710
|
const config2 = JSON.parse(stripJsonComments(content));
|
|
8694
8711
|
const plugins = config2.plugin ?? [];
|
|
8695
8712
|
for (const entry of plugins) {
|
|
@@ -8714,23 +8731,32 @@ var init_plugin_entry = __esm(() => {
|
|
|
8714
8731
|
});
|
|
8715
8732
|
|
|
8716
8733
|
// src/hooks/auto-update-checker/checker/cached-version.ts
|
|
8717
|
-
import * as
|
|
8734
|
+
import * as fs9 from "fs";
|
|
8718
8735
|
import * as path7 from "path";
|
|
8719
8736
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
8720
|
-
function
|
|
8737
|
+
function readVersionFromPackageJson(pkgJsonPath) {
|
|
8721
8738
|
try {
|
|
8722
|
-
if (
|
|
8723
|
-
const content =
|
|
8739
|
+
if (fs9.existsSync(pkgJsonPath)) {
|
|
8740
|
+
const content = fs9.readFileSync(pkgJsonPath, "utf-8");
|
|
8724
8741
|
const pkg = JSON.parse(content);
|
|
8725
8742
|
if (pkg.version)
|
|
8726
8743
|
return pkg.version;
|
|
8727
8744
|
}
|
|
8728
8745
|
} catch {}
|
|
8746
|
+
return null;
|
|
8747
|
+
}
|
|
8748
|
+
function getCachedVersion() {
|
|
8749
|
+
const hostVersion = readVersionFromPackageJson(HOST_INSTALLED_PACKAGE_JSON);
|
|
8750
|
+
if (hostVersion)
|
|
8751
|
+
return hostVersion;
|
|
8752
|
+
const configVersion = readVersionFromPackageJson(INSTALLED_PACKAGE_JSON);
|
|
8753
|
+
if (configVersion)
|
|
8754
|
+
return configVersion;
|
|
8729
8755
|
try {
|
|
8730
8756
|
const currentDir = path7.dirname(fileURLToPath2(import.meta.url));
|
|
8731
8757
|
const pkgPath = findPackageJsonUp(currentDir);
|
|
8732
8758
|
if (pkgPath) {
|
|
8733
|
-
const content =
|
|
8759
|
+
const content = fs9.readFileSync(pkgPath, "utf-8");
|
|
8734
8760
|
const pkg = JSON.parse(content);
|
|
8735
8761
|
if (pkg.version)
|
|
8736
8762
|
return pkg.version;
|
|
@@ -8739,10 +8765,10 @@ function getCachedVersion() {
|
|
|
8739
8765
|
log("[auto-update-checker] Failed to resolve version from current directory:", err);
|
|
8740
8766
|
}
|
|
8741
8767
|
try {
|
|
8742
|
-
const execDir = path7.dirname(
|
|
8768
|
+
const execDir = path7.dirname(fs9.realpathSync(process.execPath));
|
|
8743
8769
|
const pkgPath = findPackageJsonUp(execDir);
|
|
8744
8770
|
if (pkgPath) {
|
|
8745
|
-
const content =
|
|
8771
|
+
const content = fs9.readFileSync(pkgPath, "utf-8");
|
|
8746
8772
|
const pkg = JSON.parse(content);
|
|
8747
8773
|
if (pkg.version)
|
|
8748
8774
|
return pkg.version;
|
|
@@ -8759,10 +8785,10 @@ var init_cached_version = __esm(() => {
|
|
|
8759
8785
|
});
|
|
8760
8786
|
|
|
8761
8787
|
// src/hooks/auto-update-checker/checker/pinned-version-updater.ts
|
|
8762
|
-
import * as
|
|
8788
|
+
import * as fs10 from "fs";
|
|
8763
8789
|
function replacePluginEntry(configPath, oldEntry, newEntry) {
|
|
8764
8790
|
try {
|
|
8765
|
-
const content =
|
|
8791
|
+
const content = fs10.readFileSync(configPath, "utf-8");
|
|
8766
8792
|
const pluginMatch = content.match(/"plugin"\s*:\s*\[/);
|
|
8767
8793
|
if (!pluginMatch || pluginMatch.index === undefined) {
|
|
8768
8794
|
log(`[auto-update-checker] No "plugin" array found in ${configPath}`);
|
|
@@ -8793,7 +8819,7 @@ function replacePluginEntry(configPath, oldEntry, newEntry) {
|
|
|
8793
8819
|
log(`[auto-update-checker] No changes made to ${configPath}`);
|
|
8794
8820
|
return false;
|
|
8795
8821
|
}
|
|
8796
|
-
|
|
8822
|
+
fs10.writeFileSync(configPath, updatedContent, "utf-8");
|
|
8797
8823
|
log(`[auto-update-checker] Updated ${configPath}: ${oldEntry} \u2192 ${newEntry}`);
|
|
8798
8824
|
return true;
|
|
8799
8825
|
} catch (err) {
|
|
@@ -8940,17 +8966,17 @@ var init_checker = __esm(() => {
|
|
|
8940
8966
|
});
|
|
8941
8967
|
|
|
8942
8968
|
// src/hooks/auto-update-checker/cache.ts
|
|
8943
|
-
import * as
|
|
8969
|
+
import * as fs11 from "fs";
|
|
8944
8970
|
import * as path8 from "path";
|
|
8945
8971
|
function stripTrailingCommas(json3) {
|
|
8946
8972
|
return json3.replace(/,(\s*[}\]])/g, "$1");
|
|
8947
8973
|
}
|
|
8948
|
-
function removeFromBunLock(packageName) {
|
|
8949
|
-
const lockPath = path8.join(
|
|
8950
|
-
if (!
|
|
8974
|
+
function removeFromBunLock(dir, packageName) {
|
|
8975
|
+
const lockPath = path8.join(dir, "bun.lock");
|
|
8976
|
+
if (!fs11.existsSync(lockPath))
|
|
8951
8977
|
return false;
|
|
8952
8978
|
try {
|
|
8953
|
-
const content =
|
|
8979
|
+
const content = fs11.readFileSync(lockPath, "utf-8");
|
|
8954
8980
|
const lock = JSON.parse(stripTrailingCommas(content));
|
|
8955
8981
|
let modified = false;
|
|
8956
8982
|
if (lock.workspaces?.[""]?.dependencies?.[packageName]) {
|
|
@@ -8962,38 +8988,55 @@ function removeFromBunLock(packageName) {
|
|
|
8962
8988
|
modified = true;
|
|
8963
8989
|
}
|
|
8964
8990
|
if (modified) {
|
|
8965
|
-
|
|
8966
|
-
log(`[auto-update-checker] Removed from bun.lock: ${packageName}`);
|
|
8991
|
+
fs11.writeFileSync(lockPath, JSON.stringify(lock, null, 2));
|
|
8992
|
+
log(`[auto-update-checker] Removed from bun.lock in ${dir}: ${packageName}`);
|
|
8967
8993
|
}
|
|
8968
8994
|
return modified;
|
|
8969
8995
|
} catch {
|
|
8970
8996
|
return false;
|
|
8971
8997
|
}
|
|
8972
8998
|
}
|
|
8999
|
+
function removeNodeModulesDir(baseDir, packageName) {
|
|
9000
|
+
const pkgDir = path8.join(baseDir, "node_modules", packageName);
|
|
9001
|
+
if (!fs11.existsSync(pkgDir))
|
|
9002
|
+
return false;
|
|
9003
|
+
fs11.rmSync(pkgDir, { recursive: true, force: true });
|
|
9004
|
+
log(`[auto-update-checker] Package removed: ${pkgDir}`);
|
|
9005
|
+
return true;
|
|
9006
|
+
}
|
|
9007
|
+
function removeFromPackageJson(baseDir, packageName) {
|
|
9008
|
+
const pkgJsonPath = path8.join(baseDir, "package.json");
|
|
9009
|
+
if (!fs11.existsSync(pkgJsonPath))
|
|
9010
|
+
return false;
|
|
9011
|
+
try {
|
|
9012
|
+
const content = fs11.readFileSync(pkgJsonPath, "utf-8");
|
|
9013
|
+
const pkgJson = JSON.parse(content);
|
|
9014
|
+
if (pkgJson.dependencies?.[packageName]) {
|
|
9015
|
+
delete pkgJson.dependencies[packageName];
|
|
9016
|
+
fs11.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
|
|
9017
|
+
log(`[auto-update-checker] Dependency removed from package.json in ${baseDir}: ${packageName}`);
|
|
9018
|
+
return true;
|
|
9019
|
+
}
|
|
9020
|
+
} catch {}
|
|
9021
|
+
return false;
|
|
9022
|
+
}
|
|
8973
9023
|
function invalidatePackage(packageName = PACKAGE_NAME3) {
|
|
8974
9024
|
try {
|
|
8975
|
-
|
|
8976
|
-
const
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
|
|
8986
|
-
|
|
8987
|
-
|
|
8988
|
-
|
|
8989
|
-
|
|
8990
|
-
fs10.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
|
|
8991
|
-
log(`[auto-update-checker] Dependency removed from package.json: ${packageName}`);
|
|
8992
|
-
dependencyRemoved = true;
|
|
8993
|
-
}
|
|
8994
|
-
}
|
|
8995
|
-
lockRemoved = removeFromBunLock(packageName);
|
|
8996
|
-
if (!packageRemoved && !dependencyRemoved && !lockRemoved) {
|
|
9025
|
+
let invalidated = false;
|
|
9026
|
+
const hostRemoved = removeNodeModulesDir(HOST_CACHE_DIR, packageName);
|
|
9027
|
+
const hostPkgJsonRemoved = removeFromPackageJson(HOST_CACHE_DIR, packageName);
|
|
9028
|
+
const hostLockRemoved = removeFromBunLock(HOST_CACHE_DIR, packageName);
|
|
9029
|
+
if (hostRemoved || hostPkgJsonRemoved || hostLockRemoved) {
|
|
9030
|
+
invalidated = true;
|
|
9031
|
+
}
|
|
9032
|
+
if (HOST_CACHE_DIR !== USER_CONFIG_DIR) {
|
|
9033
|
+
const configRemoved = removeNodeModulesDir(USER_CONFIG_DIR, packageName);
|
|
9034
|
+
const configLockRemoved = removeFromBunLock(USER_CONFIG_DIR, packageName);
|
|
9035
|
+
if (configRemoved || configLockRemoved) {
|
|
9036
|
+
invalidated = true;
|
|
9037
|
+
}
|
|
9038
|
+
}
|
|
9039
|
+
if (!invalidated) {
|
|
8997
9040
|
log(`[auto-update-checker] Package not found, nothing to invalidate: ${packageName}`);
|
|
8998
9041
|
return false;
|
|
8999
9042
|
}
|
|
@@ -9332,7 +9375,7 @@ var {
|
|
|
9332
9375
|
// package.json
|
|
9333
9376
|
var package_default = {
|
|
9334
9377
|
name: "oh-my-opencode-unguarded",
|
|
9335
|
-
version: "3.10.
|
|
9378
|
+
version: "3.10.1",
|
|
9336
9379
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
9337
9380
|
main: "dist/index.js",
|
|
9338
9381
|
types: "dist/index.d.ts",
|
|
@@ -26601,11 +26644,11 @@ var PACKAGE_NAME4 = "oh-my-opencode-unguarded";
|
|
|
26601
26644
|
var OPENCODE_BINARIES2 = ["opencode", "opencode-desktop"];
|
|
26602
26645
|
|
|
26603
26646
|
// src/cli/doctor/checks/system.ts
|
|
26604
|
-
import { existsSync as
|
|
26647
|
+
import { existsSync as existsSync23, readFileSync as readFileSync23 } from "fs";
|
|
26605
26648
|
|
|
26606
26649
|
// src/cli/doctor/checks/system-binary.ts
|
|
26607
26650
|
init_spawn_with_windows_hide();
|
|
26608
|
-
import { existsSync as
|
|
26651
|
+
import { existsSync as existsSync20 } from "fs";
|
|
26609
26652
|
import { homedir as homedir5 } from "os";
|
|
26610
26653
|
import { join as join16 } from "path";
|
|
26611
26654
|
function getDesktopAppPaths(platform) {
|
|
@@ -26645,7 +26688,7 @@ function buildVersionCommand(binaryPath, platform) {
|
|
|
26645
26688
|
}
|
|
26646
26689
|
return [binaryPath, "--version"];
|
|
26647
26690
|
}
|
|
26648
|
-
function findDesktopBinary(platform = process.platform, checkExists =
|
|
26691
|
+
function findDesktopBinary(platform = process.platform, checkExists = existsSync20) {
|
|
26649
26692
|
for (const desktopPath of getDesktopAppPaths(platform)) {
|
|
26650
26693
|
if (checkExists(desktopPath)) {
|
|
26651
26694
|
return { binary: "opencode", path: desktopPath };
|
|
@@ -26692,13 +26735,13 @@ function compareVersions(current, minimum) {
|
|
|
26692
26735
|
}
|
|
26693
26736
|
|
|
26694
26737
|
// src/cli/doctor/checks/system-plugin.ts
|
|
26695
|
-
import { existsSync as
|
|
26738
|
+
import { existsSync as existsSync21, readFileSync as readFileSync21 } from "fs";
|
|
26696
26739
|
init_shared();
|
|
26697
26740
|
function detectConfigPath() {
|
|
26698
26741
|
const paths = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
26699
|
-
if (
|
|
26742
|
+
if (existsSync21(paths.configJsonc))
|
|
26700
26743
|
return paths.configJsonc;
|
|
26701
|
-
if (
|
|
26744
|
+
if (existsSync21(paths.configJson))
|
|
26702
26745
|
return paths.configJson;
|
|
26703
26746
|
return null;
|
|
26704
26747
|
}
|
|
@@ -26771,7 +26814,7 @@ function getPluginInfo() {
|
|
|
26771
26814
|
// src/cli/doctor/checks/system-loaded-version.ts
|
|
26772
26815
|
init_checker();
|
|
26773
26816
|
init_auto_update_checker();
|
|
26774
|
-
import { existsSync as
|
|
26817
|
+
import { existsSync as existsSync22, readFileSync as readFileSync22 } from "fs";
|
|
26775
26818
|
import { homedir as homedir6 } from "os";
|
|
26776
26819
|
import { join as join17 } from "path";
|
|
26777
26820
|
init_shared();
|
|
@@ -26788,12 +26831,12 @@ function resolveOpenCodeCacheDir() {
|
|
|
26788
26831
|
return join17(xdgCacheHome, "opencode");
|
|
26789
26832
|
const fromShared = getOpenCodeCacheDir();
|
|
26790
26833
|
const platformDefault = join17(getPlatformDefaultCacheDir(), "opencode");
|
|
26791
|
-
if (
|
|
26834
|
+
if (existsSync22(fromShared) || !existsSync22(platformDefault))
|
|
26792
26835
|
return fromShared;
|
|
26793
26836
|
return platformDefault;
|
|
26794
26837
|
}
|
|
26795
26838
|
function readPackageJson(filePath) {
|
|
26796
|
-
if (!
|
|
26839
|
+
if (!existsSync22(filePath))
|
|
26797
26840
|
return null;
|
|
26798
26841
|
try {
|
|
26799
26842
|
const content = readFileSync22(filePath, "utf-8");
|
|
@@ -26834,7 +26877,7 @@ init_shared();
|
|
|
26834
26877
|
function isConfigValid(configPath) {
|
|
26835
26878
|
if (!configPath)
|
|
26836
26879
|
return true;
|
|
26837
|
-
if (!
|
|
26880
|
+
if (!existsSync23(configPath))
|
|
26838
26881
|
return false;
|
|
26839
26882
|
try {
|
|
26840
26883
|
parseJsonc(readFileSync23(configPath, "utf-8"));
|
|
@@ -26945,7 +26988,7 @@ init_shared();
|
|
|
26945
26988
|
|
|
26946
26989
|
// src/cli/doctor/checks/model-resolution-cache.ts
|
|
26947
26990
|
init_shared();
|
|
26948
|
-
import { existsSync as
|
|
26991
|
+
import { existsSync as existsSync24, readFileSync as readFileSync24 } from "fs";
|
|
26949
26992
|
import { homedir as homedir7 } from "os";
|
|
26950
26993
|
import { join as join18 } from "path";
|
|
26951
26994
|
function getOpenCodeCacheDir2() {
|
|
@@ -26956,7 +26999,7 @@ function getOpenCodeCacheDir2() {
|
|
|
26956
26999
|
}
|
|
26957
27000
|
function loadAvailableModelsFromCache() {
|
|
26958
27001
|
const cacheFile = join18(getOpenCodeCacheDir2(), "models.json");
|
|
26959
|
-
if (!
|
|
27002
|
+
if (!existsSync24(cacheFile)) {
|
|
26960
27003
|
return { providers: [], modelCount: 0, cacheExists: false };
|
|
26961
27004
|
}
|
|
26962
27005
|
try {
|
|
@@ -27282,7 +27325,7 @@ async function checkConfig() {
|
|
|
27282
27325
|
|
|
27283
27326
|
// src/cli/doctor/checks/dependencies.ts
|
|
27284
27327
|
init_spawn_with_windows_hide();
|
|
27285
|
-
import { existsSync as
|
|
27328
|
+
import { existsSync as existsSync25 } from "fs";
|
|
27286
27329
|
import { createRequire } from "module";
|
|
27287
27330
|
import { dirname as dirname6, join as join22 } from "path";
|
|
27288
27331
|
async function checkBinaryExists(binary2) {
|
|
@@ -27340,7 +27383,7 @@ async function checkAstGrepNapi() {
|
|
|
27340
27383
|
path: null
|
|
27341
27384
|
};
|
|
27342
27385
|
} catch {
|
|
27343
|
-
const { existsSync:
|
|
27386
|
+
const { existsSync: existsSync26 } = await import("fs");
|
|
27344
27387
|
const { join: join23 } = await import("path");
|
|
27345
27388
|
const { homedir: homedir8 } = await import("os");
|
|
27346
27389
|
const pathsToCheck = [
|
|
@@ -27348,7 +27391,7 @@ async function checkAstGrepNapi() {
|
|
|
27348
27391
|
join23(process.cwd(), "node_modules", "@ast-grep", "napi")
|
|
27349
27392
|
];
|
|
27350
27393
|
for (const napiPath of pathsToCheck) {
|
|
27351
|
-
if (
|
|
27394
|
+
if (existsSync26(napiPath)) {
|
|
27352
27395
|
return {
|
|
27353
27396
|
name: "AST-Grep NAPI",
|
|
27354
27397
|
required: false,
|
|
@@ -27374,7 +27417,7 @@ function findCommentCheckerPackageBinary() {
|
|
|
27374
27417
|
const require2 = createRequire(import.meta.url);
|
|
27375
27418
|
const pkgPath = require2.resolve("@code-yeongyu/comment-checker/package.json");
|
|
27376
27419
|
const binaryPath = join22(dirname6(pkgPath), "bin", binaryName);
|
|
27377
|
-
if (
|
|
27420
|
+
if (existsSync25(binaryPath))
|
|
27378
27421
|
return binaryPath;
|
|
27379
27422
|
} catch {}
|
|
27380
27423
|
return null;
|
|
@@ -27493,14 +27536,14 @@ init_jsonc_parser();
|
|
|
27493
27536
|
|
|
27494
27537
|
// src/tools/lsp/server-installation.ts
|
|
27495
27538
|
init_shared();
|
|
27496
|
-
import { existsSync as
|
|
27539
|
+
import { existsSync as existsSync26 } from "fs";
|
|
27497
27540
|
import { join as join23 } from "path";
|
|
27498
27541
|
function isServerInstalled(command) {
|
|
27499
27542
|
if (command.length === 0)
|
|
27500
27543
|
return false;
|
|
27501
27544
|
const cmd = command[0];
|
|
27502
27545
|
if (cmd.includes("/") || cmd.includes("\\")) {
|
|
27503
|
-
if (
|
|
27546
|
+
if (existsSync26(cmd))
|
|
27504
27547
|
return true;
|
|
27505
27548
|
}
|
|
27506
27549
|
const isWindows = process.platform === "win32";
|
|
@@ -27522,7 +27565,7 @@ function isServerInstalled(command) {
|
|
|
27522
27565
|
const paths = pathEnv.split(pathSeparator);
|
|
27523
27566
|
for (const p2 of paths) {
|
|
27524
27567
|
for (const suffix of exts) {
|
|
27525
|
-
if (
|
|
27568
|
+
if (existsSync26(join23(p2, cmd + suffix))) {
|
|
27526
27569
|
return true;
|
|
27527
27570
|
}
|
|
27528
27571
|
}
|
|
@@ -27538,7 +27581,7 @@ function isServerInstalled(command) {
|
|
|
27538
27581
|
];
|
|
27539
27582
|
for (const base of additionalBases) {
|
|
27540
27583
|
for (const suffix of exts) {
|
|
27541
|
-
if (
|
|
27584
|
+
if (existsSync26(join23(base, cmd + suffix))) {
|
|
27542
27585
|
return true;
|
|
27543
27586
|
}
|
|
27544
27587
|
}
|
|
@@ -27572,7 +27615,7 @@ function getLspServerStats(servers) {
|
|
|
27572
27615
|
|
|
27573
27616
|
// src/cli/doctor/checks/tools-mcp.ts
|
|
27574
27617
|
init_shared();
|
|
27575
|
-
import { existsSync as
|
|
27618
|
+
import { existsSync as existsSync27, readFileSync as readFileSync27 } from "fs";
|
|
27576
27619
|
import { homedir as homedir8 } from "os";
|
|
27577
27620
|
import { join as join24 } from "path";
|
|
27578
27621
|
var BUILTIN_MCP_SERVERS = ["context7", "grep_app"];
|
|
@@ -27586,7 +27629,7 @@ function getMcpConfigPaths() {
|
|
|
27586
27629
|
function loadUserMcpConfig() {
|
|
27587
27630
|
const servers = {};
|
|
27588
27631
|
for (const configPath of getMcpConfigPaths()) {
|
|
27589
|
-
if (!
|
|
27632
|
+
if (!existsSync27(configPath))
|
|
27590
27633
|
continue;
|
|
27591
27634
|
try {
|
|
27592
27635
|
const content = readFileSync27(configPath, "utf-8");
|
|
@@ -27991,7 +28034,7 @@ async function doctor(options = { mode: "default" }) {
|
|
|
27991
28034
|
|
|
27992
28035
|
// src/features/mcp-oauth/storage.ts
|
|
27993
28036
|
init_shared();
|
|
27994
|
-
import { chmodSync, existsSync as
|
|
28037
|
+
import { chmodSync, existsSync as existsSync28, mkdirSync as mkdirSync6, readFileSync as readFileSync28, unlinkSync as unlinkSync2, writeFileSync as writeFileSync12 } from "fs";
|
|
27995
28038
|
import { dirname as dirname7, join as join25 } from "path";
|
|
27996
28039
|
var STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
27997
28040
|
function getMcpOauthStoragePath() {
|
|
@@ -28032,7 +28075,7 @@ function buildKey(serverHost, resource) {
|
|
|
28032
28075
|
}
|
|
28033
28076
|
function readStore() {
|
|
28034
28077
|
const filePath = getMcpOauthStoragePath();
|
|
28035
|
-
if (!
|
|
28078
|
+
if (!existsSync28(filePath)) {
|
|
28036
28079
|
return null;
|
|
28037
28080
|
}
|
|
28038
28081
|
try {
|
|
@@ -28046,7 +28089,7 @@ function writeStore(store2) {
|
|
|
28046
28089
|
const filePath = getMcpOauthStoragePath();
|
|
28047
28090
|
try {
|
|
28048
28091
|
const dir = dirname7(filePath);
|
|
28049
|
-
if (!
|
|
28092
|
+
if (!existsSync28(dir)) {
|
|
28050
28093
|
mkdirSync6(dir, { recursive: true });
|
|
28051
28094
|
}
|
|
28052
28095
|
writeFileSync12(filePath, JSON.stringify(store2, null, 2), { encoding: "utf-8", mode: 384 });
|
|
@@ -28081,7 +28124,7 @@ function deleteToken(serverHost, resource) {
|
|
|
28081
28124
|
if (Object.keys(store2).length === 0) {
|
|
28082
28125
|
try {
|
|
28083
28126
|
const filePath = getMcpOauthStoragePath();
|
|
28084
|
-
if (
|
|
28127
|
+
if (existsSync28(filePath)) {
|
|
28085
28128
|
unlinkSync2(filePath);
|
|
28086
28129
|
}
|
|
28087
28130
|
return true;
|
|
@@ -3,8 +3,10 @@ export declare const NPM_REGISTRY_URL = "https://registry.npmjs.org/-/package/oh
|
|
|
3
3
|
export declare const NPM_FETCH_TIMEOUT = 5000;
|
|
4
4
|
export declare const CACHE_DIR: string;
|
|
5
5
|
export declare const VERSION_FILE: string;
|
|
6
|
+
export declare const HOST_CACHE_DIR: string;
|
|
6
7
|
export declare function getWindowsAppdataDir(): string | null;
|
|
7
8
|
export declare const USER_CONFIG_DIR: string;
|
|
8
9
|
export declare const USER_OPENCODE_CONFIG: string;
|
|
9
10
|
export declare const USER_OPENCODE_CONFIG_JSONC: string;
|
|
10
11
|
export declare const INSTALLED_PACKAGE_JSON: string;
|
|
12
|
+
export declare const HOST_INSTALLED_PACKAGE_JSON: string;
|