Skip to content

Commit e5b63a1

Browse files
committed
Add oh-my-claude devcontainer feature (disabled)
Add oh-my-claude multi-provider proxy feature for Chinese LLM routing (Kimi, DeepSeek, Qwen, Zhipu, MiniMax). Feature is disabled pending refinement — omc install modifies settings.json despite --skip-* flags. Feature structure: - devcontainer-feature.json with version, autostart, providerAgentsOnly options - install.sh with backup/restore approach to protect settings.json - poststart-hook.sh for auto-starting proxy - README.md documenting usage and configuration Supporting changes: - .secrets.example: Add Chinese LLM provider API keys - disabled-hooks.json: Add omc memory/preference hooks - setup-aliases.sh: Add --disallowedTools for omc MCP tools, omc-apply alias - devcontainer.json: Add Chinese provider secrets (feature commented out) Note: claude-code-router also commented out pending router consolidation.
1 parent f2b6a14 commit e5b63a1

8 files changed

Lines changed: 374 additions & 13 deletions

File tree

container/.devcontainer/.secrets.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,9 @@ ANTHROPIC_API_KEY=
2323
DEEPSEEK_API_KEY=
2424
GEMINI_API_KEY=
2525
OPENROUTER_API_KEY=
26+
27+
# oh-my-claude — Chinese LLM provider API keys
28+
KIMI_API_KEY=
29+
ZHIPU_API_KEY=
30+
ALIYUN_API_KEY=
31+
MINIMAX_API_KEY=

container/.devcontainer/defaults/codeforge/config/disabled-hooks.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
"git-state-injector",
44
"ticket-linker",
55
"spec-reminder",
6-
"commit-reminder"
6+
"commit-reminder",
7+
"memory-awareness",
8+
"preference-awareness",
9+
"context-memory",
10+
"post-tool"
711
]
812
}

container/.devcontainer/devcontainer.json

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,22 @@
6666
"OPENROUTER_API_KEY": {
6767
"description": "OpenRouter API key for claude-code-router (optional)",
6868
"documentationUrl": "https://openrouter.ai/keys"
69+
},
70+
"KIMI_API_KEY": {
71+
"description": "Moonshot Kimi API key for oh-my-claude (optional)",
72+
"documentationUrl": "https://platform.moonshot.cn/"
73+
},
74+
"ZHIPU_API_KEY": {
75+
"description": "ZhiPu GLM API key for oh-my-claude (optional)",
76+
"documentationUrl": "https://open.bigmodel.cn/"
77+
},
78+
"ALIYUN_API_KEY": {
79+
"description": "Aliyun DashScope API key for oh-my-claude (optional)",
80+
"documentationUrl": "https://dashscope.console.aliyun.com/"
81+
},
82+
"MINIMAX_API_KEY": {
83+
"description": "MiniMax API key for oh-my-claude (optional)",
84+
"documentationUrl": "https://platform.minimaxi.com/"
6985
}
7086
},
7187

@@ -89,7 +105,8 @@
89105
"./features/agent-browser",
90106
"./features/claude-monitor",
91107
"./features/ccusage",
92-
"./features/claude-code-router",
108+
// "./features/claude-code-router",
109+
// "./features/oh-my-claude", // disabled — needs refinement (omc install modifies settings.json)
93110
// "./features/ccburn",
94111
"./features/ccstatusline",
95112
"./features/ast-grep",
@@ -134,12 +151,18 @@
134151
"shells": "both",
135152
"username": "automatic"
136153
},
137-
"./features/claude-code-router": {
138-
"version": "latest",
139-
"shells": "both",
140-
"username": "automatic",
141-
"autostart": "true"
142-
},
154+
// "./features/claude-code-router": {
155+
// "version": "latest",
156+
// "shells": "both",
157+
// "username": "automatic",
158+
// "autostart": "true"
159+
// },
160+
// oh-my-claude — disabled; needs refinement (omc install modifies settings.json)
161+
// "./features/oh-my-claude": {
162+
// "version": "latest",
163+
// "autostart": true,
164+
// "providerAgentsOnly": true
165+
// },
143166
"./features/claude-monitor": {
144167
"version": "latest",
145168
"installer": "uv",
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# oh-my-claude
2+
3+
Multi-provider proxy for Claude Code with Chinese LLM routing.
4+
5+
## Description
6+
7+
Installs [oh-my-claude](https://github.com/lgcyaxi/oh-my-claude), a proxy that routes Claude Code API calls to Chinese LLM providers (Kimi, DeepSeek, Qwen, Zhipu, MiniMax).
8+
9+
**Important**: This feature installs agents only (`--skip-hooks --skip-mcp`). CodeForge manages settings.json separately to avoid conflicts.
10+
11+
## Options
12+
13+
| Option | Type | Default | Description |
14+
|--------|------|---------|-------------|
15+
| `version` | string | `latest` | oh-my-claude version to install (`latest`, `2.2.3`, `none` to skip) |
16+
| `autostart` | boolean | `true` | Auto-start proxy on container start |
17+
| `providerAgentsOnly` | boolean | `true` | Keep only provider agents, delete role agents |
18+
19+
## Provider Agents (Kept)
20+
21+
When `providerAgentsOnly: true`, these 6 agents are preserved:
22+
23+
- `@kimi` — Moonshot Kimi
24+
- `@deepseek` — DeepSeek
25+
- `@deepseek-r` — DeepSeek Reasoner
26+
- `@qwen` — Alibaba Qwen (via Aliyun DashScope)
27+
- `@zhipu` — Zhipu GLM
28+
- `@mm-cn` — MiniMax
29+
30+
## Role Agents (Deleted)
31+
32+
These 11 agents are removed when `providerAgentsOnly: true`:
33+
34+
sisyphus, prometheus, claude-reviewer, claude-scout, oracle, ui-designer, analyst, librarian, document-writer, navigator, hephaestus
35+
36+
## Disabled Tools
37+
38+
The `cc`/`claude` aliases disable these oh-my-claude MCP tools via `--disallowedTools`:
39+
40+
**Memory (9)**: remember, recall, get_memory, forget, list_memories, memory_status, compact_memories, clear_memories, summarize_memories
41+
42+
**Preferences (7)**: add_preference, list_preferences, get_preference, update_preference, delete_preference, match_preferences, preference_stats
43+
44+
**Coworker (1)**: coworker_task
45+
46+
**Kept (3)**: switch_model, switch_status, switch_revert (proxy routing)
47+
48+
## Usage
49+
50+
```bash
51+
omc proxy start # Start the proxy
52+
omc proxy stop # Stop the proxy
53+
omc proxy status # Check proxy status
54+
omc proxy switch MODEL # Switch to a different model
55+
```
56+
57+
## Authentication
58+
59+
Set provider API keys in `.devcontainer/.secrets`:
60+
61+
```bash
62+
KIMI_API_KEY=
63+
ZHIPU_API_KEY=
64+
ALIYUN_API_KEY=
65+
MINIMAX_API_KEY=
66+
DEEPSEEK_API_KEY=
67+
```
68+
69+
oh-my-claude has built-in provider configs — no separate config file needed. Just set the API keys and they'll be picked up automatically.
70+
71+
## Notes
72+
73+
- oh-my-claude does not install skills/commands in current version (2.2.x)
74+
- The feature skips hooks and MCP server installation to avoid settings.json conflicts
75+
- Statusline integration is disabled to preserve ccstatusline
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"id": "oh-my-claude",
3+
"version": "1.0.0",
4+
"name": "oh-my-claude",
5+
"description": "Multi-provider proxy for Claude Code with Chinese LLM routing",
6+
"documentationURL": "https://github.com/lgcyaxi/oh-my-claude",
7+
"options": {
8+
"version": {
9+
"type": "string",
10+
"default": "latest",
11+
"description": "oh-my-claude version to install"
12+
},
13+
"autostart": {
14+
"type": "boolean",
15+
"default": true,
16+
"description": "Auto-start proxy on container start"
17+
},
18+
"providerAgentsOnly": {
19+
"type": "boolean",
20+
"default": true,
21+
"description": "Only install provider agents (@kimi, @deepseek, etc.), delete role agents"
22+
}
23+
},
24+
"installsAfter": ["ghcr.io/devcontainers/features/node:1"]
25+
}
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
#!/bin/bash
2+
# SPDX-License-Identifier: GPL-3.0-only
3+
set -euo pipefail
4+
5+
# Options
6+
OMC_VERSION="${VERSION:-latest}"
7+
USERNAME="${USERNAME:-automatic}"
8+
AUTOSTART="${AUTOSTART:-true}"
9+
PROVIDER_AGENTS_ONLY="${PROVIDERAGENTSONLY:-true}"
10+
11+
# Skip if version=none
12+
if [ "${OMC_VERSION}" = "none" ]; then
13+
echo "[oh-my-claude] Skipping installation (version=none)"
14+
exit 0
15+
fi
16+
17+
echo "[oh-my-claude] Starting installation..."
18+
19+
# Source NVM
20+
if [ -f /usr/local/share/nvm/nvm.sh ]; then
21+
source /usr/local/share/nvm/nvm.sh
22+
fi
23+
24+
# Validate npm
25+
if ! command -v npm &>/dev/null; then
26+
echo "[oh-my-claude] ERROR: npm is not available"
27+
exit 1
28+
fi
29+
30+
# Detect user (same pattern as ccr)
31+
if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then
32+
USERNAME=""
33+
for CURRENT_USER in vscode node codespace; do
34+
if id -u "${CURRENT_USER}" >/dev/null 2>&1; then
35+
USERNAME=${CURRENT_USER}
36+
break
37+
fi
38+
done
39+
[ -z "${USERNAME}" ] && USERNAME=root
40+
elif [ "${USERNAME}" = "none" ] || ! id -u "${USERNAME}" >/dev/null 2>&1; then
41+
USERNAME=root
42+
fi
43+
44+
USER_HOME=$(eval echo "~${USERNAME}")
45+
46+
# Install npm package
47+
echo "[oh-my-claude] Installing @lgcyaxi/oh-my-claude@${OMC_VERSION} globally..."
48+
npm install -g "@lgcyaxi/oh-my-claude@${OMC_VERSION}"
49+
50+
# Backup settings.json before omc install (it modifies settings.json despite --skip-* flags)
51+
SETTINGS_JSON="${USER_HOME}/.claude/settings.json"
52+
SETTINGS_BACKUP=""
53+
if [ -f "${SETTINGS_JSON}" ]; then
54+
SETTINGS_BACKUP="${SETTINGS_JSON}.omc-backup.$$"
55+
cp "${SETTINGS_JSON}" "${SETTINGS_BACKUP}"
56+
echo "[oh-my-claude] Backed up settings.json"
57+
fi
58+
59+
# Run omc install to generate agents (--skip-* flags don't fully work, so we restore settings.json after)
60+
echo "[oh-my-claude] Running omc install (agents only)..."
61+
sudo -u "${USERNAME}" HOME="${USER_HOME}" omc install --skip-agents=false --force 2>&1 || {
62+
echo "[oh-my-claude] WARNING: omc install had errors (commands directory missing is expected)"
63+
}
64+
65+
# Restore settings.json to undo any changes made by omc install
66+
if [ -n "${SETTINGS_BACKUP}" ] && [ -f "${SETTINGS_BACKUP}" ]; then
67+
mv "${SETTINGS_BACKUP}" "${SETTINGS_JSON}"
68+
chown "${USERNAME}:${USERNAME}" "${SETTINGS_JSON}" 2>/dev/null || true
69+
echo "[oh-my-claude] Restored settings.json (omc changes reverted)"
70+
fi
71+
72+
# Clean up oh-my-claude data directory (we don't need its hooks/MCP/statusline)
73+
rm -rf "${USER_HOME}/.claude/oh-my-claude" 2>/dev/null || true
74+
rm -rf "${USER_HOME}/.config/oh-my-claude" 2>/dev/null || true
75+
echo "[oh-my-claude] Cleaned up oh-my-claude data directories"
76+
77+
# Filter agents (delete role agents, keep provider agents)
78+
if [ "${PROVIDER_AGENTS_ONLY}" = "true" ]; then
79+
echo "[oh-my-claude] Filtering agents (provider-only mode)..."
80+
AGENTS_DIR="${USER_HOME}/.claude/agents"
81+
if [ -d "$AGENTS_DIR" ]; then
82+
for agent in sisyphus prometheus claude-reviewer claude-scout oracle \
83+
ui-designer analyst librarian document-writer navigator hephaestus; do
84+
if [ -f "$AGENTS_DIR/${agent}.md" ]; then
85+
rm -f "$AGENTS_DIR/${agent}.md"
86+
echo "[oh-my-claude] Deleted agent: ${agent}"
87+
fi
88+
done
89+
fi
90+
fi
91+
92+
# Note: oh-my-claude doesn't install skills/commands in current version (2.2.x)
93+
# The commands directory doesn't exist in the npm package
94+
95+
# Shell activation block
96+
OMC_BLOCK_START="# === oh-my-claude activation START (managed by install.sh — do not edit) ==="
97+
OMC_BLOCK_END="# === oh-my-claude activation END ==="
98+
99+
configure_shell() {
100+
local shell_rc="$1"
101+
local shell_name="$2"
102+
103+
if [ ! -f "${shell_rc}" ]; then
104+
sudo -u "${USERNAME}" touch "${shell_rc}"
105+
fi
106+
107+
# Remove existing block
108+
if grep -q "oh-my-claude activation START" "${shell_rc}"; then
109+
sed -i '/oh-my-claude activation START/,/oh-my-claude activation END/d' "${shell_rc}"
110+
fi
111+
112+
# Write activation block
113+
cat >> "${shell_rc}" <<OMCBLOCK
114+
${OMC_BLOCK_START}
115+
if command -v omc >/dev/null 2>&1; then
116+
eval "\$(omc activate 2>/dev/null)" || true
117+
fi
118+
${OMC_BLOCK_END}
119+
OMCBLOCK
120+
121+
chown "${USERNAME}:${USERNAME}" "${shell_rc}" 2>/dev/null || true
122+
echo "[oh-my-claude] Added activation to ${shell_name}"
123+
}
124+
125+
configure_shell "${USER_HOME}/.bashrc" "bash"
126+
configure_shell "${USER_HOME}/.zshrc" "zsh"
127+
128+
# Autostart hook
129+
if [ "${AUTOSTART}" = "true" ]; then
130+
HOOK_DIR="/usr/local/devcontainer-poststart.d"
131+
mkdir -p "$HOOK_DIR"
132+
133+
# Copy poststart hook
134+
FEATURE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
135+
if [ -f "${FEATURE_DIR}/poststart-hook.sh" ]; then
136+
cp "${FEATURE_DIR}/poststart-hook.sh" "${HOOK_DIR}/46-oh-my-claude.sh"
137+
chmod +x "${HOOK_DIR}/46-oh-my-claude.sh"
138+
echo "[oh-my-claude] Poststart hook installed"
139+
fi
140+
fi
141+
142+
# Verification
143+
echo "[oh-my-claude] Verifying installation..."
144+
if command -v omc &>/dev/null; then
145+
OMC_VERSION_INSTALLED=$(omc --version 2>/dev/null || echo "unknown")
146+
echo "[oh-my-claude] ✓ omc is installed (${OMC_VERSION_INSTALLED})"
147+
else
148+
echo "[oh-my-claude] WARNING: omc command not found after install"
149+
fi
150+
151+
# Summary
152+
echo ""
153+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
154+
echo " oh-my-claude Installation Complete"
155+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
156+
echo ""
157+
echo "Configuration:"
158+
echo " • User: ${USERNAME}"
159+
echo " • Version: ${OMC_VERSION}"
160+
echo " • Provider agents only: ${PROVIDER_AGENTS_ONLY}"
161+
echo " • Autostart: ${AUTOSTART}"
162+
echo ""
163+
echo "Note: Hooks and MCP server skipped during install."
164+
echo " CodeForge manages settings.json separately."
165+
echo ""
166+
echo "Usage:"
167+
echo " omc proxy start # Start the proxy"
168+
echo " omc proxy stop # Stop the proxy"
169+
echo " omc proxy status # Check proxy status"
170+
echo ""
171+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"

0 commit comments

Comments
 (0)