Skip to content

fix: make oh-my-opencode optional in ModePreset and add tests#15

Merged
j4rviscmd merged 2 commits intomainfrom
fix/oh-my-opencode-optional
Mar 13, 2026
Merged

fix: make oh-my-opencode optional in ModePreset and add tests#15
j4rviscmd merged 2 commits intomainfrom
fix/oh-my-opencode-optional

Conversation

@j4rviscmd
Copy link
Owner

@j4rviscmd j4rviscmd commented Mar 13, 2026

Summary

  • Made 'oh-my-opencode' field optional in ModePreset to fix plugin startup errors in environments without oh-my-opencode
  • Added undefined guards in 4 locations in manager.ts to skip oh-my-opencode processing when not configured in preset
  • Updated initializer.ts to omit the 'oh-my-opencode' key from preset entirely when oh-my-opencode.json does not exist
  • Added 7 new test cases covering oh-my-opencode optional scenarios (82 tests total, all passing)

Changes

  • src/config/types.ts — Make 'oh-my-opencode' optional (?)
  • src/modes/manager.ts — Add undefined guards (4 locations)
  • src/config/initializer.ts — Conditionally include key via spread operator
  • src/modes/manager.test.ts — Fix MockModeManager + 4 new tests
  • src/config/initializer.test.ts — 3 new tests

Related Issues

Closes #14

- Make 'oh-my-opencode' field optional in ModePreset type
- Add undefined guards in manager.ts (4 locations) to skip
  oh-my-opencode processing when not configured in preset
- Update initializer.ts to omit 'oh-my-opencode' key from preset
  when oh-my-opencode.json does not exist
- Fix MockModeManager in manager.test.ts to match production behavior
- Add 7 new test cases covering oh-my-opencode optional scenarios

Fixes #14
@j4rviscmd j4rviscmd added the bug Something isn't working label Mar 13, 2026
@j4rviscmd j4rviscmd self-assigned this Mar 13, 2026
@j4rviscmd j4rviscmd merged commit 3b68e1e into main Mar 13, 2026
1 check passed
@j4rviscmd j4rviscmd deleted the fix/oh-my-opencode-optional branch March 13, 2026 14:48
@j4rviscmd j4rviscmd mentioned this pull request Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] oh-my-opencode を使用しない環境でプラグイン起動時にエラーが発生する

1 participant