fix: respect OPENCODE_CONFIG_DIR environment variable across all config paths
Multiple files were hardcoding ~/.config/opencode paths instead of using getOpenCodeConfigDir() which respects the OPENCODE_CONFIG_DIR env var. This broke profile isolation features like OCX ghost mode, where users set OPENCODE_CONFIG_DIR to a custom path but oh-my-opencode.json and other configs weren't being read from that location. Changes: - plugin-config.ts: Use getOpenCodeConfigDir() directly - cli/doctor/checks: Use getOpenCodeConfigDir() for auth and config checks - tools/lsp/config.ts: Use getOpenCodeConfigDir() for LSP config paths - command loaders: Use getOpenCodeConfigDir() for global command dirs - hooks: Use getOpenCodeConfigDir() for hook config paths - config-path.ts: Mark getUserConfigDir() as deprecated - tests: Ensure OPENCODE_CONFIG_DIR is properly isolated in tests
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
import { promises as fs, type Dirent } from "fs"
|
||||
import { join, basename } from "path"
|
||||
import { homedir } from "os"
|
||||
import { parseFrontmatter } from "../../shared/frontmatter"
|
||||
import { sanitizeModelField } from "../../shared/model-sanitizer"
|
||||
import { isMarkdownFile } from "../../shared/file-utils"
|
||||
import { getClaudeConfigDir } from "../../shared"
|
||||
import { getClaudeConfigDir, getOpenCodeConfigDir } from "../../shared"
|
||||
import { log } from "../../shared/logger"
|
||||
import type { CommandScope, CommandDefinition, CommandFrontmatter, LoadedCommand } from "./types"
|
||||
|
||||
@@ -122,7 +121,8 @@ export async function loadProjectCommands(): Promise<Record<string, CommandDefin
|
||||
}
|
||||
|
||||
export async function loadOpencodeGlobalCommands(): Promise<Record<string, CommandDefinition>> {
|
||||
const opencodeCommandsDir = join(homedir(), ".config", "opencode", "command")
|
||||
const configDir = getOpenCodeConfigDir({ binary: "opencode" })
|
||||
const opencodeCommandsDir = join(configDir, "command")
|
||||
const commands = await loadCommandsFromDir(opencodeCommandsDir, "opencode")
|
||||
return commandsToRecord(commands)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user