Description
When using ocx add <component> -p <profile>, component files are incorrectly installed to .opencode/plugin/ instead of the flattened plugin/ path that profiles should use.
Expected Behavior
Profile installations should use flattened paths:
~/.config/opencode/profiles/<name>/plugin/component.ts
~/.config/opencode/profiles/<name>/opencode.jsonc
Actual Behavior
Files are installed with .opencode/ prefix:
~/.config/opencode/profiles/<name>/.opencode/plugin/component.ts
~/.config/opencode/profiles/<name>/.opencode/opencode.jsonc
Root Cause
In packages/cli/src/utils/update-opencode-config.ts, the updateOpencodeJsonConfig() function at line ~248 hardcodes the .opencode/ prefix via LOCAL_CONFIG_DIR, ignoring the isFlattened flag.
The handleNpmPlugins() function likely has the same issue.
Suggested Fix
- Add
isFlattened parameter to findOpencodeConfig() and updateOpencodeJsonConfig()
- When
isFlattened is true, don't prepend .opencode/ to paths
- Ensure all profile-mode code paths pass
isFlattened: true
Reproduction
# Create a profile
ocx profile add test-profile
# Add a component with -p flag
ocx add kdco/worktree -p test-profile
# Check where files were installed
ls -la ~/.config/opencode/profiles/test-profile/
ls -la ~/.config/opencode/profiles/test-profile/.opencode/ # Should not exist
Related
Found while testing #80 (OCX-aware worktree feature).