Skip to content

Conversation

@kdcokenny
Copy link
Collaborator

@kdcokenny kdcokenny commented Jan 9, 2026

Summary

Adds OPENCODE_CONFIG_DIR environment variable support for config directory override, enabling compatibility with OCX ghost mode profiles.

Closes #627

Changes

  • Add env var check at start of getCliConfigDir() in src/shared/opencode-config-dir.ts
  • Update detectExistingConfigDir() to include env var path in locations array
  • Add 7 comprehensive tests for the new functionality
  • Document in README under Configuration → Environment Variables

Behavior

Scenario Result
OPENCODE_CONFIG_DIR=/custom/path Uses /custom/path
OPENCODE_CONFIG_DIR=./relative Resolves to absolute path
OPENCODE_CONFIG_DIR="" or whitespace Falls back to default
Env var not set Falls back to XDG_CONFIG_HOME or ~/.config/opencode

Testing

  • 7 new tests added, all passing
  • Follows existing CLAUDE_CONFIG_DIR pattern in codebase

OCX Integration

OCX ghost mode can now set the env var when spawning OpenCode:

OPENCODE_CONFIG_DIR=~/.config/opencode/profiles/work opencode

Summary by cubic

Adds OPENCODE_CONFIG_DIR to let users override the OpenCode config directory. This enables OCX ghost mode profile isolation while keeping defaults when the env var isn’t set.

  • New Features
    • getCliConfigDir uses OPENCODE_CONFIG_DIR when set, resolves relative paths, ignores empty/whitespace, and takes priority over XDG_CONFIG_HOME.
    • detectExistingConfigDir includes the env var path in its search order.
    • Added README docs and 7 tests covering override, fallback, and precedence.

Written for commit 0e7516c. Summary will update on new commits.

- Add env var check to getCliConfigDir() for config directory override
- Update detectExistingConfigDir() to include env var path in locations
- Add comprehensive tests (7 test cases)
- Document in README

Closes code-yeongyu#627
@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2026

All contributors have signed the CLA. Thank you! ✅
Posted by the CLA Assistant Lite bot.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@kdcokenny
Copy link
Collaborator Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Jan 9, 2026
@kdcokenny
Copy link
Collaborator Author

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

rip

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

@kdcokenny
Copy link
Collaborator Author

Follow-up: Documentation for Ghost Profiles?

Would you be open to adding a documentation section about using OMO with OCX Ghost Profiles?

Since OCX already sets OPENCODE_CONFIG_DIR when running ghost mode, users can have per-profile OMO configurations. However, there's some manual migration involved (copying existing config to the profile directory).

I'm thinking a section like "Ghost Profiles (OCX Integration)" covering:

  • What ghost profiles are and use cases
  • How to migrate existing OMO config to a profile
  • Profile directory structure
  • Basic usage (ocx ghost opencode)

Let me know if this would be welcome, or if you'd prefer to keep the OMO docs focused and link to OCX docs instead.

renekris pushed a commit to renekris/oh-my-glm that referenced this pull request Jan 10, 2026
@code-yeongyu
Copy link
Owner

@sisyphus-dev-ai review

@sisyphus-dev-ai sisyphus-dev-ai added sisyphus: working Sisyphus is currently working on this and removed sisyphus: working Sisyphus is currently working on this labels Jan 11, 2026
@code-yeongyu code-yeongyu merged commit 1c262a6 into code-yeongyu:dev Jan 11, 2026
3 of 4 checks passed
@kdcokenny kdcokenny deleted the feat/opencode-config-dir-env-var branch January 11, 2026 02:50
KNN-07 pushed a commit to KNN-07/oh-my-opencode that referenced this pull request Jan 11, 2026
…gyu#629)

- Add env var check to getCliConfigDir() for config directory override
- Update detectExistingConfigDir() to include env var path in locations
- Add comprehensive tests (7 test cases)
- Document in README

Closes code-yeongyu#627
kdcokenny pushed a commit that referenced this pull request Jan 13, 2026
kdcokenny added a commit that referenced this pull request Jan 13, 2026
- Add env var check to getCliConfigDir() for config directory override
- Update detectExistingConfigDir() to include env var path in locations
- Add comprehensive tests (7 test cases)
- Document in README

Closes #627
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add OPENCODE_CONFIG_DIR environment variable for config directory override

3 participants