cc2oc
v0.1.0
Published
Claude Code compatibility layer plugin for OpenCode
Maintainers
Readme
cc2oc
cc2oc is an OpenCode plugin that adds a Claude Code compatibility layer for three core surfaces:
- Claude settings and permission rules from
.claude/settings.json - Claude commands from
~/.claude/commands/and.claude/commands/ - MCP servers from
.mcp.json
The implementation is written from scratch for this repository and keeps the project MIT-clean as required by private/PLAN.md.
What works today
- Parse and merge Claude settings from global, project, and local files
- Enforce
permissions.allow/permissions.denybefore tool execution - Bridge Claude hook events for
PreToolUse,PostToolUse,Notification, andStop - Load Claude markdown commands with project-over-global precedence
- Load local stdio MCP servers and remote HTTP MCP servers with env expansion
Install
bun installTo consume the published package in another project:
npm install cc2ocTest
bun run checkBuild
bun run buildPlugin usage
import { createClaudeCompatPlugin } from "cc2oc";
export default createClaudeCompatPlugin({
enabled: true,
settingsPath: ".claude/settings.json",
commandsPath: ".claude/commands",
mcpsPath: ".mcp.json",
});Expected workspace layout
your-project/
├── .claude/
│ ├── settings.json
│ ├── settings.local.json
│ └── commands/
│ └── review.md
└── .mcp.jsonExample Claude command
---
description: Review the current changes
agent: build
argument-hint: <path>
---
Inspect the diff for $ARGUMENTS.Example .mcp.json
{
"mcpServers": {
"docs": {
"url": "https://example.com/mcp"
},
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem"],
"env": {
"TOKEN": "${MCP_TOKEN}"
}
}
}
}Notes
- Project commands override global commands with the same name.
- Invalid settings, command files, or MCP entries fail closed only where safety matters and otherwise degrade gracefully.
- Settings and hook files are cached per plugin instance. If you edit them during a running session, reload the plugin or restart the host process to pick up changes.
- The repository test suite includes end-to-end checks for settings, hooks, command loading, and MCP loading.
Release automation
This repository publishes through GitHub Actions only.
- Push a tag like
v1.2.3to publish that exact version. - Or run the
Releaseworkflow manually and choosepatch,minor, ormajor.
Required GitHub secrets:
- none for npm publish when Trusted Publishing is configured correctly
Configure Trusted Publishing on npm instead of storing NPM_TOKEN in GitHub:
- open your package on npm
- go to
Settings→Trusted Publisher - add this GitHub Actions publisher
- GitHub owner:
nguyenphutrong - repository:
cc2oc - workflow filename:
release.yml
- GitHub owner:
- keep the repository URL in
package.jsonmatching the real GitHub repo exactly
With Trusted Publishing enabled, npm uses GitHub OIDC at publish time and you do not need a long-lived publish token in repository secrets.
Manual workflow behavior:
- resolves the next semantic version from the latest
v*git tag - injects that version into the publishable
dist/package.json - runs
bun run check - builds
dist/ - creates a publishable
dist/package.json - publishes to npm through Trusted Publishing
- creates and pushes the corresponding git tag
- creates a GitHub release if one does not already exist
