-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add isolated config mode with ohmyoc wrapper command #1067
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Add isolated config mode with ohmyoc wrapper command #1067
Conversation
Adds OH_MY_OPENCODE_CONFIG_DIR environment variable support for running oh-my-opencode in isolated mode without conflicts with plain OpenCode installations. Changes: - Add OH_MY_OPENCODE_CONFIG_DIR env var (highest priority) - Add --isolated flag to install command - Add TUI prompt for config mode selection (shared/isolated) - Add ohmyoc convenience binary wrapper for auto-isolated mode - Add isolated field to InstallArgs, InstallConfig, DetectedConfig - Update config summary to display active config mode - Update documentation with isolated mode usage Closes code-yeongyu#685
docs(configurations): clarify isolated config mode behavior for CLI fix(config-manager): use dynamic config directory in error message
|
All contributors have signed the CLA. Thank you! ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 13 files
Confidence score: 4/5
- The only noted issue is documentation-related, so overall merge risk looks low and this PR feels safe to merge.
- In
docs/guide/installation.md, the instructions always force--isolated, which could confuse users after the Shared vs Isolated mode choice. - Pay close attention to
docs/guide/installation.md- resolve the mode/flag inconsistency in the installation steps.
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="docs/guide/installation.md">
<violation number="1" location="docs/guide/installation.md:94">
P2: Installation instructions always force `--isolated`, contradicting the earlier Shared vs Isolated mode choice.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 13 files
Confidence score: 4/5
- This PR looks safe to merge overall; the only noted issue is a moderate-risk assumption in the sandbox script.
test-sandbox/run-test.shrelies onpwdand a relativesrc/cli/index.ts, so running the script from non-repo-root directories may fail.- Pay close attention to
test-sandbox/run-test.sh- path assumptions can break execution outside the repo root.
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="test-sandbox/run-test.sh">
<violation number="1" location="test-sandbox/run-test.sh:5">
P2: Sandbox script assumes it is run from repo root; using `pwd` and relative `src/cli/index.ts` breaks when executed from other directories.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 13 files
Confidence score: 4/5
- Moderate risk:
test-sandbox/run-test.shcan report success even whenbun run ... installfails, which could mask install/test failures in CI. - Impact is limited to test/installer signaling rather than runtime behavior, so this looks safe to merge with a small fix.
- Pay close attention to
test-sandbox/run-test.sh- ensure installer failures propagate correctly.
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="test-sandbox/run-test.sh">
<violation number="1" location="test-sandbox/run-test.sh:17">
P2: Installer failure isn’t propagated; the script exits success even if `bun run ... install` fails.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 issues found across 13 files
Confidence score: 4/5
- The main risk is test behavior:
src/cli/install.test.tswrites to and deletes the real~/.config/oh-my-opencode, which could cause data loss and makes tests environment-dependent. src/shared/opencode-config-dir-isolated.test.tscan fail if OPENCODE_CONFIG_DIR is set externally, so default-path tests are flaky but not production-impacting.- These are test-only issues and don’t imply runtime regressions, so this looks safe to merge with minor cleanup needed.
- Pay close attention to
src/cli/install.test.ts,src/shared/opencode-config-dir-isolated.test.ts- environment-dependent test behavior and potential data loss.
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="src/cli/install.test.ts">
<violation number="1" location="src/cli/install.test.ts:202">
P2: Isolated-mode tests write to and delete the real `~/.config/oh-my-opencode` directory, risking data loss and making tests environment-dependent.</violation>
</file>
<file name="src/shared/opencode-config-dir-isolated.test.ts">
<violation number="1" location="src/shared/opencode-config-dir-isolated.test.ts:95">
P2: Default-path tests are environment-dependent because OPENCODE_CONFIG_DIR is not cleared; if it’s set externally, getOpenCodeConfigDir will return that path instead of the default and the test will fail.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this 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 13 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Summary
Add support for completely isolated configuration directories so users can run plain OpenCode and oh-my-opencode side-by-side without config conflicts.
Problem Statement
Currently oh-my-opencode shares the same
~/.config/opencode/directory with plain OpenCode. This creates conflicts because:Solution
1. Environment Variable Support
Added
OH_MY_OPENCODE_CONFIG_DIRenvironment variable with priority:OH_MY_OPENCODE_CONFIG_DIR(highest - isolated mode)OPENCODE_CONFIG_DIR(generic opencode override)2. New
ohmyocCommandCreated
bin/ohmyoc.js- a convenience wrapper that automatically uses isolated mode:OH_MY_OPENCODE_CONFIG_DIR=~/.config/oh-my-opencode/before spawning3. CLI Flag
Added
--isolatedflag to install command:This sets the isolated config directory before installation proceeds.
4. TUI Prompt
Added configuration mode selection in interactive installer:
Usage After Installation
After installing with isolated mode, users have two commands available:
Implementation Details
Config Path Resolution
Modified
src/shared/opencode-config-dir.ts:getOmoDefaultIsolatedDir()functiongetOmoIsolatedConfigDir()functiongetCliConfigDir()to checkOH_MY_OPENCODE_CONFIG_DIRfirstdetectExistingConfigDir()to include isolated directory in searchInstall Flow
Modified
src/cli/install.ts:--isolatedflag handling in non-TUI mode (lines 333-338)OH_MY_OPENCODE_CONFIG_DIRand reset config contextCLI Changes
Modified
src/cli/index.ts:--isolatedoption to install commandDocumentation Updates
docs/configurations.md: Added isolated config mode section with priority order and pathsdocs/cli-guide.md: Addedohmyoccommand documentationdocs/guide/installation.md: Added config mode step to installation guideTesting
Added comprehensive test coverage:
src/shared/opencode-config-dir-isolated.test.ts(255 lines, 15 tests)src/cli/install.test.ts(4 new tests in isolated mode section)All 22 tests pass across both files.
Bug Fixes
Fixed hardcoded error path in
src/cli/config-manager.ts:473~/.config/opencodeto dynamicgetConfigDir()Added documentation note about desktop app limitation
opencode-desktopFile Changes
Breaking Changes
None. This is a purely additive feature.
--isolatedflag orohmyoccommand to use isolated modeRelated Issues
Closes #685
Summary by cubic
Add isolated configuration mode so oh-my-opencode can run side-by-side with plain OpenCode without shared config conflicts. Includes a new ohmyoc wrapper that auto-uses isolated mode, plus an installer flag and TUI option.
New Features
Migration
Written for commit def7cab. Summary will update on new commits.