fix: add Windows config path documentation and config error warnings (#97) (#109)

- Document platform-specific config paths in README (en/ko/ja)
  - Windows: %APPDATA%\opencode\oh-my-opencode.json
  - macOS/Linux: ~/.config/opencode/oh-my-opencode.json
- Show config file path in startup toast
- Add config load error warnings when JSON parsing or validation fails
- Extract getUserConfigDir to shared/config-path.ts for reuse

Fixes #97

🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
YeonGyu-Kim
2025-12-19 02:03:31 +09:00
parent 845a1d2a03
commit 63fea77572
8 changed files with 98 additions and 21 deletions

30
src/shared/config-path.ts Normal file
View File

@@ -0,0 +1,30 @@
import * as path from "path"
import * as os from "os"
/**
* Returns the user-level config directory based on the OS.
* - Linux/macOS: XDG_CONFIG_HOME or ~/.config
* - Windows: %APPDATA%
*/
export function getUserConfigDir(): string {
if (process.platform === "win32") {
return process.env.APPDATA || path.join(os.homedir(), "AppData", "Roaming")
}
// Linux, macOS, and other Unix-like systems: respect XDG_CONFIG_HOME
return process.env.XDG_CONFIG_HOME || path.join(os.homedir(), ".config")
}
/**
* Returns the full path to the user-level oh-my-opencode config file.
*/
export function getUserConfigPath(): string {
return path.join(getUserConfigDir(), "opencode", "oh-my-opencode.json")
}
/**
* Returns the full path to the project-level oh-my-opencode config file.
*/
export function getProjectConfigPath(directory: string): string {
return path.join(directory, ".opencode", "oh-my-opencode.json")
}

View File

@@ -10,3 +10,4 @@ export * from "./hook-disabled"
export * from "./deep-merge"
export * from "./file-utils"
export * from "./dynamic-truncator"
export * from "./config-path"