Update src/cli/system.test.ts - #70
Merged
Merged
Conversation
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Contributor
Greptile SummaryRefactored Key Changes
Issues Found
Confidence Score: 2/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Install
participant ConfigIO
participant Paths
participant System
participant Providers
User->>Install: Run install command
Install->>System: isOpenCodeInstalled()
System-->>Install: boolean
Install->>ConfigIO: detectCurrentConfig()
ConfigIO->>Paths: getExistingConfigPath()
Paths-->>ConfigIO: config path
ConfigIO->>ConfigIO: parseConfig(path)
ConfigIO-->>Install: DetectedConfig
Install->>ConfigIO: addPluginToOpenCodeConfig()
ConfigIO->>Paths: ensureConfigDir()
Paths->>Paths: getConfigDir()
ConfigIO->>Paths: getExistingConfigPath()
ConfigIO->>ConfigIO: parseConfig(path)
ConfigIO->>ConfigIO: writeConfig(path, config)
ConfigIO-->>Install: ConfigMergeResult
Install->>ConfigIO: addAuthPlugins(installConfig)
ConfigIO->>System: fetchLatestVersion(package)
System-->>ConfigIO: version string
ConfigIO->>ConfigIO: writeConfig(path, config)
ConfigIO-->>Install: ConfigMergeResult
Install->>ConfigIO: addProviderConfig(installConfig)
ConfigIO->>Providers: GOOGLE_PROVIDER_CONFIG
ConfigIO->>ConfigIO: writeConfig(path, config)
ConfigIO-->>Install: ConfigMergeResult
Install->>ConfigIO: writeLiteConfig(installConfig)
ConfigIO->>Providers: generateLiteConfig(installConfig)
Providers-->>ConfigIO: config object
ConfigIO->>Paths: getLiteConfig()
ConfigIO->>ConfigIO: atomic write with backup
ConfigIO-->>Install: ConfigMergeResult
Install-->>User: Installation complete
|
Comment on lines
+5
to
+13
| export function getConfigDir(): string { | ||
| // Keep this aligned with OpenCode itself and the plugin config loader: | ||
| // base dir is $XDG_CONFIG_HOME (if set) else ~/.config, and OpenCode config lives under /opencode. | ||
| const userConfigDir = process.env.XDG_CONFIG_HOME | ||
| ? process.env.XDG_CONFIG_HOME | ||
| : join(homedir(), ".config") | ||
|
|
||
| return join(userConfigDir, "opencode") | ||
| } |
Contributor
There was a problem hiding this comment.
logic: removed Windows-specific path handling that existed in the previous implementation - this breaks Windows support where configs could be in %APPDATA% or .config
The old implementation checked for existing configs in ~/.config/opencode on Windows and fell back to %APPDATA% if not found. Now it always uses ~/.config/opencode on Windows, which may not align with where users' existing configs are located.
Suggested change
| export function getConfigDir(): string { | |
| // Keep this aligned with OpenCode itself and the plugin config loader: | |
| // base dir is $XDG_CONFIG_HOME (if set) else ~/.config, and OpenCode config lives under /opencode. | |
| const userConfigDir = process.env.XDG_CONFIG_HOME | |
| ? process.env.XDG_CONFIG_HOME | |
| : join(homedir(), ".config") | |
| return join(userConfigDir, "opencode") | |
| } | |
| export function getConfigDir(): string { | |
| if (process.platform === "win32") { | |
| const homedirPath = homedir() | |
| const crossPlatformDir = join(homedirPath, ".config") | |
| const appdataDir = process.env.APPDATA ?? join(homedirPath, "AppData", "Roaming") | |
| const crossPlatformConfig = join(crossPlatformDir, "opencode", "opencode.json") | |
| const crossPlatformConfigJsonc = join(crossPlatformDir, "opencode", "opencode.jsonc") | |
| if (existsSync(crossPlatformConfig) || existsSync(crossPlatformConfigJsonc)) { | |
| return join(crossPlatformDir, "opencode") | |
| } | |
| return join(appdataDir, "opencode") | |
| } | |
| // Keep this aligned with OpenCode itself and the plugin config loader: | |
| // base dir is $XDG_CONFIG_HOME (if set) else ~/.config, and OpenCode config lives under /opencode. | |
| const userConfigDir = process.env.XDG_CONFIG_HOME | |
| ? process.env.XDG_CONFIG_HOME | |
| : join(homedir(), ".config") | |
| return join(userConfigDir, "opencode") | |
| } |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/cli/paths.ts
Line: 5:13
Comment:
**logic:** removed Windows-specific path handling that existed in the previous implementation - this breaks Windows support where configs could be in `%APPDATA%` or `.config`
The old implementation checked for existing configs in `~/.config/opencode` on Windows and fell back to `%APPDATA%` if not found. Now it always uses `~/.config/opencode` on Windows, which may not align with where users' existing configs are located.
```suggestion
export function getConfigDir(): string {
if (process.platform === "win32") {
const homedirPath = homedir()
const crossPlatformDir = join(homedirPath, ".config")
const appdataDir = process.env.APPDATA ?? join(homedirPath, "AppData", "Roaming")
const crossPlatformConfig = join(crossPlatformDir, "opencode", "opencode.json")
const crossPlatformConfigJsonc = join(crossPlatformDir, "opencode", "opencode.jsonc")
if (existsSync(crossPlatformConfig) || existsSync(crossPlatformConfigJsonc)) {
return join(crossPlatformDir, "opencode")
}
return join(appdataDir, "opencode")
}
// Keep this aligned with OpenCode itself and the plugin config loader:
// base dir is $XDG_CONFIG_HOME (if set) else ~/.config, and OpenCode config lives under /opencode.
const userConfigDir = process.env.XDG_CONFIG_HOME
? process.env.XDG_CONFIG_HOME
: join(homedir(), ".config")
return join(userConfigDir, "opencode")
}
```
How can I resolve this? If you propose a fix, please make it concise.
mhenke
pushed a commit
to mhenke/oh-my-opencode-slim
that referenced
this pull request
Jul 17, 2026
* Clean cli * Rename features to background * Fix test * Update src/cli/providers.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * Update src/cli/system.test.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes