Add OpenCode MCP installer support#54
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
✅ Files skipped from review due to trivial changes (4)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds OpenCode JSON/JSONC-aware install/uninstall for plugins and MCP graphify servers (resolving package CLI and wiring a local stdio server command), updates CLI help and README to list ChangesOpenCode MCP Server + JSONC Config Handling
Sequence DiagramsequenceDiagram
participant User
participant CLI
participant Installer
participant ConfigFile as OpenCode Config (JSON/JSONC)
participant PackageJSON as package.json (bin)
participant MCP as mcp.graphify
User->>CLI: opencode install
CLI->>Installer: agentsInstall(platform='opencode', packageRoot?)
Installer->>ConfigFile: resolveOpencodeConfigPath()
ConfigFile-->>Installer: config path (.json or .jsonc)
Installer->>ConfigFile: readOpencodeConfig()
ConfigFile-->>Installer: parsed config
Installer->>Installer: resolvePackageCliPath(packageRoot)
PackageJSON-->>Installer: CLI entrypoint path
Installer->>ConfigFile: writeOpencodePluginRegistration()
Installer->>MCP: writeOpencodeMcpServerConfig(command: [process.execPath, cliPath, "serve","--stdio","graphify-out/graph.json"])
Installer->>ConfigFile: persist changes (JSON or JSONC ranges)
Installer-->>CLI: "opencode local rules installed"
CLI-->>User: exit 0
Estimated Code Review Effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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.
Actionable comments posted: 2
🤖 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.
Inline comments:
In `@src/infrastructure/install.ts`:
- Around line 843-857: The code reads opencode.jsonc via readOpencodeConfig but
always calls writeJson (which uses JSON.stringify) and thus strips
comments/formatting; change the flow so we only mutate the file when necessary
and preserve JSONC formatting: use the original file text (obtainable via
readOpencodeConfig or by reading resolveOpencodeConfigPath) and apply a
JSONC-aware edit (e.g., jsonc.modify or a writeOpencodeJsonc helper) to insert
OPENCODE_PLUGIN_RELATIVE_PATH into the plugin array; then write the modified
text back (via writeFile) instead of writeJson. Update the branch that currently
calls writeJson (and the similar block around the other mentioned lines) to
perform a JSONC-aware modify-and-write only when plugins were actually changed,
referencing resolveOpencodeConfigPath, readOpencodeConfig,
OPENCODE_PLUGIN_RELATIVE_PATH and replacing writeJson with the JSONC-preserving
write.
- Around line 584-609: resolvePackageCliPath currently trusts package.json#bin
without verifying the target exists; after computing relativeBinPath and before
returning join(packageRoot, relativeBinPath), resolve the full path and validate
it actually exists and is a regular file (and optionally is executable) using
Node fs methods (e.g., existsSync/statSync or accessSync). If the file is
missing or not a file, throw a clear Error referencing CLI_BIN_NAME, the
resolved path, and packageJsonPath so install fails fast instead of persisting a
broken MCP command; keep existing behavior of using findPackageRoot() and
CLI_BIN_NAME to locate entries.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 6047779b-30bf-41a6-8904-665cb3190a0f
📒 Files selected for processing (7)
README.mdsrc/cli/main.tssrc/infrastructure/install.tssrc/runtime/stdio-server.tstests/unit/cli.test.tstests/unit/install.test.tstests/unit/stdio-server.test.ts
|
Addressed the review feedback in c28836f:
Validation:
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
* feat(ci): auto-update contributors list via GitHub Actions Replace the static README "Credit" handling for contributors with a self-maintaining list driven by akhilmhdh/contributors-readme-action. - Add .github/workflows/contributors.yml: runs on push to main, weekly cron, and workflow_dispatch; uses contents:write to commit the regenerated table back; pinned to v2.3.10. - Swap the contrib.rocks image in README.md for the <!-- readme: contributors -start/-end --> markers the action populates with a real HTML table (clickable avatars + usernames). - Add a one-line shout-out to @jamemackson for #54, the first community-contributed feature in graphify-ts. * chore: release v0.11.0 This release bundles the first community-contributed feature (OpenCode MCP installer support, #54 by @jamemackson) with the new auto-updating contributors workflow. - Bump version to 0.11.0 (minor: new agent integration, backward compatible). - Add CHANGELOG section for 0.11.0 covering OpenCode installer support and the contributors automation, with credit to @jamemackson. * chore(ci): pin contributors workflow actions to immutable SHAs Replace mutable tag refs with full 40-character commit SHAs so the workflow cannot be silently retargeted by upstream tag movement. Matches the hardening already applied to .github/workflows/pages.yml (see CHANGELOG entry for v0.10.9). - actions/checkout@v4 -> @de0fac2e4500dabe0009e67214ff5f5447ce83dd (same canonical SHA already used by pages.yml) - akhilmhdh/contributors-readme-action@v2.3.10 -> @1ff4c56187458b34cd602aee93e897344ce34bfc (resolved from the v2.3.10 tag at review time) Addresses CodeRabbit review comment on PR #55.
Summary
This updates
graphify-ts opencode installso OpenCode gets the same MCP-backed graph access as the other first-class assistant integrations.mcp.graphifylocal server inopencode.json, alongside the existingAGENTS.mdand OpenCode plugin setup.graphify-tsis onPATH; this supports global installs, linked installs, and project installs through package managers like pnpm.graphify.environmentvalues.graphify-ts opencode uninstall.serve --stdioreadiness output to stderr so MCP stdout remains JSON-RPC-only.Testing
npm run test:run -- tests/unit/stdio-server.test.ts tests/unit/install.test.ts tests/unit/cli.test.tsnpm run test:runnpm run typechecknpm run buildnpm pack --dry-run(if packaging or install behavior changed)Checklist
Related issues
None.
Summary by CodeRabbit
New Features
Documentation
Tests