2025-12-13 01:18:39 +09:00
|
|
|
import * as path from "node:path"
|
|
|
|
|
import * as os from "node:os"
|
2026-03-07 15:56:21 -07:00
|
|
|
import { getOpenCodeCacheDir } from "../../shared/data-path"
|
|
|
|
|
import { getOpenCodeConfigDir } from "../../shared/opencode-config-dir"
|
2025-12-13 01:18:39 +09:00
|
|
|
|
|
|
|
|
export const PACKAGE_NAME = "oh-my-opencode"
|
|
|
|
|
export const NPM_REGISTRY_URL = `https://registry.npmjs.org/-/package/${PACKAGE_NAME}/dist-tags`
|
|
|
|
|
export const NPM_FETCH_TIMEOUT = 5000
|
|
|
|
|
|
2026-03-07 15:56:21 -07:00
|
|
|
export const CACHE_DIR = getOpenCodeCacheDir()
|
2025-12-13 01:18:39 +09:00
|
|
|
export const VERSION_FILE = path.join(CACHE_DIR, "version")
|
|
|
|
|
|
2026-01-02 14:28:44 +09:00
|
|
|
export function getWindowsAppdataDir(): string | null {
|
|
|
|
|
if (process.platform !== "win32") return null
|
|
|
|
|
return process.env.APPDATA ?? path.join(os.homedir(), "AppData", "Roaming")
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-22 12:15:09 +07:00
|
|
|
export const USER_CONFIG_DIR = getOpenCodeConfigDir({ binary: "opencode" })
|
|
|
|
|
export const USER_OPENCODE_CONFIG = path.join(USER_CONFIG_DIR, "opencode.json")
|
|
|
|
|
export const USER_OPENCODE_CONFIG_JSONC = path.join(USER_CONFIG_DIR, "opencode.jsonc")
|
2026-02-03 17:34:12 +09:00
|
|
|
|
|
|
|
|
export const INSTALLED_PACKAGE_JSON = path.join(
|
2026-03-07 15:56:21 -07:00
|
|
|
CACHE_DIR,
|
2026-02-03 17:34:12 +09:00
|
|
|
"node_modules",
|
|
|
|
|
PACKAGE_NAME,
|
|
|
|
|
"package.json"
|
|
|
|
|
)
|