Skip to main content

omc-setup

Setup and configure oh-my-claudecode (the ONLY command you need to learn)

跳到安装

来源信息

仓库
RunnerQuan/SAFE-Agent
最近来源活动
2026年3月30日 04:33
检测到的 SKILL.md 语言
英语
星标
0
分支
0

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

文件资源管理器
3 个文件

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
omc-setup
description
Setup and configure oh-my-claudecode (the ONLY command you need to learn)
# OMC Setup This is the **only command you need to learn**. After running this, everything else is automatic. ## Graceful Interrupt Handling **IMPORTANT**: This setup process saves progress after each step. If interrupted (Ctrl+C or connection loss), the setup can resume from where it left off. ### State File Location - `.omc/state/setup-state.json` - Tracks completed steps ### Resume Detection (Step 0) Before starting any step, check for existing state: ```bash # Check for existing setup state STATE_FILE=".omc/state/setup-state.json" # Cross-platform ISO date to epoch conversion iso_to_epoch() { local iso_date="$1" local epoch="" # Try GNU date first (Linux) epoch=$(date -d "$iso_date" +%s 2>/dev/null) if [ $? -eq 0 ] && [ -n "$epoch" ]; then echo "$epoch" return 0 fi # Try BSD/macOS date local clean_date=$(echo "$iso_date" | sed 's/[+-][0-9][0-9]:[0-9][0-9]$//' | sed 's/Z$//' | sed 's/T/ /') epoch=$(date -j -f "%Y-%m-%d %H:%M:%S" "$clean_date" +%s 2>/dev/null) if [ $? -eq 0 ] && [ -n "$epoch" ]; then echo "$epoch" return 0 fi echo "0" } if [ -f "$STATE_FILE" ]; then # Check if state is stale (older than 24 hours) TIMESTAMP_RAW=$(jq -r '.timestamp // empty' "$STATE_FILE" 2>/dev/null) if [ -n "$TIMESTAMP_RAW" ]; then TIMESTAMP_EPOCH=$(iso_to_epoch "$TIMESTAMP_RAW") NOW_EPOCH=$(date +%s) STATE_AGE=$((NOW_EPOCH - TIMESTAMP_EPOCH)) else STATE_AGE=999999 # Force fresh start if no timestamp fi if [ "$STATE_AGE" -gt 86400 ]; then echo "Previous setup state is more than 24 hours old. Starting fresh." rm -f "$STATE_FILE" else LAST_STEP=$(jq -r ".lastCompletedStep // 0" "$STATE_FILE" 2>/dev/null || echo "0") TIMESTAMP=$(jq -r .timestamp "$STATE_FILE" 2>/dev/null || echo "unknown") echo "Found previous setup session (Step $LAST_STEP completed at $TIMESTAMP)" fi fi ``` If state exists, use AskUserQuestion to prompt: **Question:** "Found a previous setup session. Would you like to resume or start fresh?" **Options:** 1. **Resume from step $LAST_STEP** - Continue where you left off 2. **Start fresh** - Begin from the beginning (clears saved state) If user chooses "Start fresh": ```bash rm -f ".omc/state/setup-state.json" echo "Previous state cleared. Starting fresh setup." ``` ### Save Progress Helper After completing each major step, save progress: ```bash # Save setup progress (call after each step) # Usage: save_setup_progress STEP_NUMBER save_setup_progress() { mkdir -p .omc/state cat > ".omc/state/setup-state.json" << EOF { "lastCompletedStep": $1, "timestamp": "$(date -Iseconds)", "configType": "${CONFIG_TYPE:-unknown}" } EOF } ``` ### Clear State on Completion After successful setup completion (Step 7/8), remove the state file: ```bash rm -f ".omc/state/setup-state.json" echo "Setup completed successfully. State cleared." ``` ## Usage Modes This skill handles three scenarios: 1. **Initial Setup (no flags)**: First-time installation wizard 2. **Local Configuration (`--local`)**: Configure project-specific settings (.claude/CLAUDE.md) 3. **Global Configuration (`--global`)**: Configure global settings (~/.claude/CLAUDE.md) ## Mode Detection Check for flags in the user's invocation: - If `--local` flag present → Skip to Local Configuration (Step 2A) - If `--global` flag present → Skip to Global Configuration (Step 2B) - If no flags → Run Initial Setup wizard (Step 1) ## Step 1: Initial Setup Wizard (Default Behavior) **Note**: If resuming and lastCompletedStep >= 1, skip to the appropriate step based on configType. Use the AskUserQuestion tool to prompt the user: **Question:** "Where should I configure oh-my-claudecode?" **Options:** 1. **Local (this project)** - Creates `.claude/CLAUDE.md` in current project directory. Best for project-specific configurations. 2. **Global (all projects)** - Creates `~/.claude/CLAUDE.md` for all Claude Code sessions. Best for consistent behavior everywhere. ## Step 2A: Local Configuration (--local flag or user chose LOCAL) **CRITICAL**: This ALWAYS downloads fresh CLAUDE.md from GitHub to the local project. DO NOT use the Write tool - use bash curl exclusively. ### Create Local .claude Directory ```bash # Create .claude directory in current project mkdir -p .claude && echo ".claude directory ready" ``` ### Download Fresh CLAUDE.md ```bash # Extract old version before download OLD_VERSION=$(grep -m1 "^# oh-my-claudecode" .claude/CLAUDE.md 2>/dev/null | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' || echo "none") # Backup existing CLAUDE.md before overwriting (if it exists) if [ -f ".claude/CLAUDE.md" ]; then BACKUP_DATE=$(date +%Y-%m-%d) BACKUP_PATH=".claude/CLAUDE.md.backup.${BACKUP_DATE}" cp .claude/CLAUDE.md "$BACKUP_PATH" echo "Backed up existing CLAUDE.md to $BACKUP_PATH" fi # Download fresh CLAUDE.md from GitHub curl -fsSL "https://raw.githubusercontent.com/Yeachan-Heo/oh-my-claudecode/main/docs/CLAUDE.md" -o .claude/CLAUDE.md && \ echo "Downloaded CLAUDE.md to .claude/CLAUDE.md" # Extract new version and report NEW_VERSION=$(grep -m1 "^# oh-my-claudecode" .claude/CLAUDE.md 2>/dev/null | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' || echo "unknown") if [ "$OLD_VERSION" = "none" ]; then echo "Installed CLAUDE.md: $NEW_VERSION" elif [ "$OLD_VERSION" = "$NEW_VERSION" ]; then echo "CLAUDE.md unchanged: $NEW_VERSION" else echo "Updated CLAUDE.md: $OLD_VERSION -> $NEW_VERSION" fi ``` **Note**: The downloaded CLAUDE.md includes Context Persistence instructions with `<remember>` tags for surviving conversation compaction. **Note**: If an existing CLAUDE.md is found, it will be backed up to `.claude/CLAUDE.md.backup.YYYY-MM-DD` before downloading the new version. **MANDATORY**: Always run this command. Do NOT skip. Do NOT use Write tool. **FALLBACK** if curl fails: Tell user to manually download from: https://raw.githubusercontent.com/Yeachan-Heo/oh-my-claudecode/main/docs/CLAUDE.md ### Verify Plugin Installation ```bash grep -q "oh-my-claudecode" ~/.claude/settings.json && echo "Plugin verified" || echo "Plugin NOT found - run: claude /install-plugin oh-my-claudecode" ``` ### Confirm Local Configuration Success After completing local configuration, save progress and report: ```bash # Save progress - Step 2 complete (Local config) mkdir -p .omc/state cat > ".omc/state/setup-state.json" << EOF { "lastCompletedStep": 2, "timestamp": "$(date -Iseconds)", "configType": "local" } EOF ``` **OMC Project Configuration Complete** - CLAUDE.md: Updated with latest configuration from GitHub at ./.claude/CLAUDE.md - Backup: Previous CLAUDE.md backed up to `.claude/CLAUDE.md.backup.YYYY-MM-DD` (if existed) - Scope: **PROJECT** - applies only to this project - Hooks: Provided by plugin (no manual installation needed) - Agents: 28+ available (base + tiered variants) - Model routing: Haiku/Sonnet/Opus based on task complexity **Note**: This configuration is project-specific and won't affect other projects or global settings. If `--local` flag was used, clear state and **STOP HERE**: ```bash rm -f ".omc/state/setup-state.json" ``` Do not continue to HUD setup or other steps. ## Step 2B: Global Configuration (--global flag or user chose GLOBAL) **CRITICAL**: This ALWAYS downloads fresh CLAUDE.md from GitHub to global config. DO NOT use the Write tool - use bash curl exclusively. ### Download Fresh CLAUDE.md ```bash # Extract old version before download OLD_VERSION=$(grep -m1 "^# oh-my-claudecode" ~/.claude/CLAUDE.md 2>/dev/null | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' || echo "none") # Backup existing CLAUDE.md before overwriting (if it exists) if [ -f "$HOME/.claude/CLAUDE.md" ]; then BACKUP_DATE=$(date +%Y-%m-%d) BACKUP_PATH="$HOME/.claude/CLAUDE.md.backup.${BACKUP_DATE}" cp "$HOME/.claude/CLAUDE.md" "$BACKUP_PATH" echo "Backed up existing CLAUDE.md to $BACKUP_PATH" fi # Download fresh CLAUDE.md to global config curl -fsSL "https://raw.githubusercontent.com/Yeachan-Heo/oh-my-claudecode/main/docs/CLAUDE.md" -o ~/.claude/CLAUDE.md && \ echo "Downloaded CLAUDE.md to ~/.claude/CLAUDE.md" # Extract new version and report NEW_VERSION=$(grep -m1 "^# oh-my-claudecode" ~/.claude/CLAUDE.md 2>/dev/null | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' || echo "unknown") if [ "$OLD_VERSION" = "none" ]; then echo "Installed CLAUDE.md: $NEW_VERSION" elif [ "$OLD_VERSION" = "$NEW_VERSION" ]; then echo "CLAUDE.md unchanged: $NEW_VERSION" else echo "Updated CLAUDE.md: $OLD_VERSION -> $NEW_VERSION" fi ``` **Note**: If an existing CLAUDE.md is found, it will be backed up to `~/.claude/CLAUDE.md.backup.YYYY-MM-DD` before downloading the new version. ### Clean Up Legacy Hooks (if present) Check if old manual hooks exist and remove them to prevent duplicates: ```bash # Remove legacy bash hook scripts (now handled by plugin system) rm -f ~/.claude/hooks/keyword-detector.sh rm -f ~/.claude/hooks/stop-continuation.sh rm -f ~/.claude/hooks/persistent-mode.sh rm -f ~/.claude/hooks/session-start.sh echo "Legacy hooks cleaned" ``` Check `~/.claude/settings.json` for manual hook entries. If the "hooks" key exists with UserPromptSubmit, Stop, or SessionStart entries pointing to bash scripts, inform the user: > **Note**: Found legacy hooks in settings.json. These should be removed since the plugin now provides hooks automatically. Remove the "hooks" section from ~/.claude/settings.json to prevent duplicate hook execution. ### Verify Plugin Installation ```bash grep -q "oh-my-claudecode" ~/.claude/settings.json && echo "Plugin verified" || echo "Plugin NOT found - run: claude /install-plugin oh-my-claudecode" ``` ### Confirm Global Configuration Success After completing global configuration, save progress and report: ```bash # Save progress - Step 2 complete (Global config) mkdir -p .omc/state cat > ".omc/state/setup-state.json" << EOF { "lastCompletedStep": 2, "timestamp": "$(date -Iseconds)", "configType": "global" } EOF ``` **OMC Global Configuration Complete** - CLAUDE.md: Updated with latest configuration from GitHub at ~/.claude/CLAUDE.md - Backup: Previous CLAUDE.md backed up to `~/.claude/CLAUDE.md.backup.YYYY-MM-DD` (if existed) - Scope: **GLOBAL** - applies to all Claude Code sessions - Hooks: Provided by plugin (no manual installation needed) - Agents: 28+ available (base + tiered variants) - Model routing: Haiku/Sonnet/Opus based on task complexity **Note**: Hooks are now managed by the plugin system automatically. No manual hook installation required. If `--global` flag was used, clear state and **STOP HERE**: ```bash rm -f ".omc/state/setup-state.json" ``` Do not continue to HUD setup or other steps. ## Step 3: Setup HUD Statusline **Note**: If resuming and lastCompletedStep >= 3, skip to Step 3.5. The HUD shows real-time status in Claude Code's status bar. **Invoke the hud skill** to set up and configure: Use the Skill tool to invoke: `hud` with args: `setup` This will: 1. Install the HUD wrapper script to `~/.claude/hud/omc-hud.mjs` 2. Configure `statusLine` in `~/.claude/settings.json` 3. Report status and prompt to restart if needed After HUD setup completes, save progress: ```bash # Save progress - Step 3 complete (HUD setup) mkdir -p .omc/state
在 GitHub 查看
这个 SKILL.md 很大,SkillsMP 这里只预览前一段内容。 在 GitHub 查看