feat: add oh-my-pi (OMP) support#1069
Conversation
📝 WalkthroughWalkthroughThis PR adds support for oh-my-pi as a new tool in the command-generation system. It defines an adapter that maps commands to ChangesAdd oh-my-pi Tool Support
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/core/update.ts (1)
200-200: ⚡ Quick winConsider centralizing the hyphen-transformer tool list instead of repeating it in three places.
The condition
tool.value === 'opencode' || tool.value === 'pi' || tool.value === 'oh-my-pi'now appears verbatim in three locations:
src/core/init.tsline 541src/core/update.tsline 200 (here)src/core/update.tsline 694Every time a new tool requires the hyphen transformer, all three files must be updated in sync. A field on
AIToolOption(e.g.useHyphenTransformer?: boolean) would makeconfig.tsthe single source of truth.♻️ Suggested refactor sketch
In
src/core/config.ts, extend the interface and tag the affected tools:export interface AIToolOption { name: string; value: string; available: boolean; successLabel?: string; skillsDir?: string; detectionPaths?: string[]; + useHyphenTransformer?: boolean; // skill files use /opsx-<cmd> references } - { name: 'oh-my-pi', value: 'oh-my-pi', available: true, successLabel: 'oh-my-pi', skillsDir: '.omp' }, + { name: 'oh-my-pi', value: 'oh-my-pi', available: true, successLabel: 'oh-my-pi', skillsDir: '.omp', useHyphenTransformer: true }, - { name: 'OpenCode', value: 'opencode', ...}, + { name: 'OpenCode', value: 'opencode', ..., useHyphenTransformer: true }, - { name: 'Pi', value: 'pi', ...}, + { name: 'Pi', value: 'pi', ..., useHyphenTransformer: true },Then in all three call sites:
-const transformer = (tool.value === 'opencode' || tool.value === 'pi' || tool.value === 'oh-my-pi') ? transformToHyphenCommands : undefined; +const transformer = tool.useHyphenTransformer ? transformToHyphenCommands : undefined;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/core/update.ts` at line 200, Centralize the hyphen-transformer flag by adding a boolean field (e.g. useHyphenTransformer?: boolean) to the AIToolOption type in src/core/config.ts and mark the affected tool entries (opencode, pi, oh-my-pi); then replace the repeated literal checks in the transformer assignment sites (the transformer variable in update.ts, the call site in init.ts, and the other occurrence in update.ts) to read tool.useHyphenTransformer and set transformer = tool.useHyphenTransformer ? transformToHyphenCommands : undefined so the transformer decision comes from the config single source of truth.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/core/update.ts`:
- Line 200: Centralize the hyphen-transformer flag by adding a boolean field
(e.g. useHyphenTransformer?: boolean) to the AIToolOption type in
src/core/config.ts and mark the affected tool entries (opencode, pi, oh-my-pi);
then replace the repeated literal checks in the transformer assignment sites
(the transformer variable in update.ts, the call site in init.ts, and the other
occurrence in update.ts) to read tool.useHyphenTransformer and set transformer =
tool.useHyphenTransformer ? transformToHyphenCommands : undefined so the
transformer decision comes from the config single source of truth.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 051aa0c1-3309-4dc9-810c-8532113d829e
📒 Files selected for processing (7)
src/core/command-generation/adapters/index.tssrc/core/command-generation/adapters/oh-my-pi.tssrc/core/command-generation/registry.tssrc/core/config.tssrc/core/init.tssrc/core/update.tstest/core/command-generation/adapters.test.ts
Add ToolCommandAdapter for Oh My Pi terminal AI coding agent. Commands generate to .omp/commands/opsx-<id>.md with description frontmatter and hyphen-based command references. Skills generate to .omp/skills/ via transformToHyphenCommands. - New adapter: src/core/command-generation/adapters/oh-my-pi.ts - Register in CommandAdapterRegistry and index - Add to AI_TOOLS with skillsDir: '.omp' - Add to hyphen command transformer whitelist in init.ts and update.ts - Full test coverage following OMP patterns
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/core/init.ts (1)
541-542: ⚡ Quick winCentralize the hyphen-command whitelist in the tool config rather than inline string comparisons.
The same
tool.value === 'opencode' || tool.value === 'pi' || tool.value === 'oh-my-pi'guard now lives in bothinit.tsandupdate.ts. Every future tool that needs hyphen-based command references requires two manual edits in separate files — easy to miss and already a DRY violation after just one PR.A better approach: add a
useHyphenCommands(or similar) boolean toAIToolOption/AI_TOOLS, then derive the transformer from the tool config itself. This makes the check self-contained and removes the scattered whitelist.♻️ Proposed refactor
In
config.ts(or whereverAIToolOptionis defined), extend the type and set the flag for the relevant tools:type AIToolOption = { value: string; name: string; skillsDir?: string; + useHyphenCommands?: boolean; }; // ... { value: 'opencode', name: 'OpenCode', skillsDir: '.opencode', useHyphenCommands: true }, { value: 'pi', name: 'Pi', skillsDir: '.pi', useHyphenCommands: true }, { value: 'oh-my-pi', name: 'Oh My Pi', skillsDir: '.omp', useHyphenCommands: true },Then in
init.ts(andupdate.ts) replace the inline condition:-const transformer = (tool.value === 'opencode' || tool.value === 'pi' || tool.value === 'oh-my-pi') - ? transformToHyphenCommands - : undefined; +const toolConfig = AI_TOOLS.find((t) => t.value === tool.value); +const transformer = toolConfig?.useHyphenCommands ? transformToHyphenCommands : undefined;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/core/init.ts` around lines 541 - 542, Centralize the hyphen-command whitelist by adding a boolean flag (e.g., useHyphenCommands) to the AIToolOption type and set it on relevant entries in AI_TOOLS, then replace the inline checks in init.ts and update.ts (the expressions comparing tool.value to 'opencode'|'pi'|'oh-my-pi') with a lookup of that flag on the tool object and derive the transformer via transformToHyphenCommands when tool.useHyphenCommands is true before calling generateSkillContent; update AIToolOption/AI_TOOLS, and change the transformer assignment in the blocks that currently reference tool.value to use tool.useHyphenCommands instead.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/core/init.ts`:
- Around line 541-542: Centralize the hyphen-command whitelist by adding a
boolean flag (e.g., useHyphenCommands) to the AIToolOption type and set it on
relevant entries in AI_TOOLS, then replace the inline checks in init.ts and
update.ts (the expressions comparing tool.value to 'opencode'|'pi'|'oh-my-pi')
with a lookup of that flag on the tool object and derive the transformer via
transformToHyphenCommands when tool.useHyphenCommands is true before calling
generateSkillContent; update AIToolOption/AI_TOOLS, and change the transformer
assignment in the blocks that currently reference tool.value to use
tool.useHyphenCommands instead.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: dde55a09-31d4-4bed-89f9-76ee1c09797e
📒 Files selected for processing (7)
src/core/command-generation/adapters/index.tssrc/core/command-generation/adapters/oh-my-pi.tssrc/core/command-generation/registry.tssrc/core/config.tssrc/core/init.tssrc/core/update.tstest/core/command-generation/adapters.test.ts
✅ Files skipped from review due to trivial changes (3)
- src/core/command-generation/registry.ts
- src/core/config.ts
- src/core/command-generation/adapters/index.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- src/core/command-generation/adapters/oh-my-pi.ts
- test/core/command-generation/adapters.test.ts
- src/core/update.ts
Add ToolCommandAdapter for oh-my-pi terminal AI coding agent. Commands generate to .omp/commands/opsx-.md with description frontmatter and hyphen-based command references.
Skills generate to .omp/skills/ via transformToHyphenCommands.
takes care of: #713
Summary by CodeRabbit
New Features
Improvements
Tests