Skip to content

Latest commit

 

History

History
304 lines (230 loc) · 11.9 KB

File metadata and controls

304 lines (230 loc) · 11.9 KB

Claude Code Scripts

English | 中文

A collection of configuration scripts for the Claude Code CLI tool.

Quick Start

One command to install everything:

git clone https://github.com/calmkart/vibe-coding-script.git
cd vibe-coding-script/claude-code
./setup.sh install              # English
./setup.sh install --lang zh    # Chinese labels

Or install a specific feature:

./setup.sh install auto-approve             # Only auto-approve
./setup.sh install iterm-status --lang zh   # Only tab indicator (Chinese)
./setup.sh install iterm-monitor --lang zh  # Only session dashboard (Chinese)
./setup.sh install dashboard                # Only terminal TUI dashboard
./setup.sh install skills/fix-review             # fix-review skill (global ~/.claude, default)
./setup.sh install skills/fix-review --local    # fix-review skill (current project only)
./setup.sh install skills/e2e-guard             # e2e-guard skill (global, default)
./setup.sh install skills/e2e-guard --local     # e2e-guard skill (current project only)
./setup.sh install plugins/claude-hud           # claude-hud statusline plugin

Management:

./setup.sh status                    # Show all component status
./setup.sh uninstall                 # Remove everything
./setup.sh uninstall iterm-monitor   # Remove specific feature

After install, restart iTerm2. First-time only: allow Python API dialog, then drag "Claude Sessions" to the status bar.


Features

claude-code/
├── setup.sh                  # Unified entry point
├── auto-approve/             # Bash auto-approve
│   └── setup.sh
├── iterm-status/             # Tab color & title indicator
│   └── setup.sh
├── iterm-monitor/            # Session dashboard
│   ├── setup.sh
│   └── daemon.py
├── dashboard/                # Terminal TUI dashboard
│   ├── setup.sh
│   ├── app.py                # Main Textual application
│   ├── requirements.txt
│   ├── data/                 # Data layer (sessions, history, stats, search, cache)
│   ├── screens/              # UI screens (active, browser, usage, conversation)
│   ├── widgets/              # Reusable widgets (session card, chart, heatmap, etc.)
│   ├── utils/                # Formatting, pricing, export, iTerm integration
│   └── styles/               # Textual CSS theme
├── skills/                   # Claude Code custom skills
│   ├── fix-review/           # Auto-fix GitLab MR review comments
│   │   ├── setup.sh
│   │   └── SKILL.md
│   └── e2e-guard/            # Auto-generate & run minimal E2E test plans
│       ├── setup.sh
│       ├── SKILL.md
│       ├── ref-plan-template.md
│       ├── ref-write-patterns.md
│       └── ref-gitlab-ci.md
├── plugins/                  # Claude Code plugin installers
│   └── claude-hud/           # Real-time statusline HUD
│       └── setup.sh

auto-approve

Auto-approve Bash commands without manual confirmation.

  • Creates ~/.claude/hooks/auto-approve.sh
  • Requires jq (brew install jq)

iterm-status

iTerm2 tab color & title changes based on Claude Code status.

State Tab Color Tab Title
Working Green ◉ Working · project-name
Action Needed Amber ⏸ Action Needed · project-name
Ready Blue ✓ Ready · project-name

Supports --lang zh for Chinese labels (执行中 / 待确认 / 等待输入).

Hook events:

Event Status set Description
UserPromptSubmit working User sent a message
PreToolUse * attention Only for blocking tools (see below)
PostToolUse * working Tool completed
Notification done System notification
Stop done Turn ended

Blocking tool whitelist — only these trigger the Amber "Action Needed" state:

  • AskUserQuestion / EnterPlanMode / ExitPlanMode
  • Bash commands matching git.*push
  • All other tools (Read, Edit, Grep, etc.) are silently skipped

State lock — once attention is set, a lock file (/tmp/iterm-attention-$PPID) prevents Notification or Stop from overriding it back to done. Only working (from PostToolUse after user confirms) clears the lock.

Directory lock — the tab title shows the project directory from the first hook call and never changes, even when Claude edits files in subdirectories.

iterm-monitor

Multi-session dashboard with badges, status bar, and click-to-navigate popover.

Feature Description
Badge 📂 project / 🌿 branch — compact watermark (15% width)
Dashboard Click status bar → session cards, click card → jump to that terminal
Status Bar 🤖 3 │ ⚡2 🔔1 ✔️1 — total + count by state

Icons: ⚡ running, 🔔 waiting for input, ✔️ idle.

Sessions persist as long as the Claude process is alive (PID-based tracking, not timeout-based).

Supports --lang zh for Chinese dashboard labels (运行中 / 待确认 / 空闲).

Requires iterm-status (auto-installed if missing).

dashboard

A rich terminal TUI built with Python + Textual for managing Claude Code sessions from your terminal.

Requirements: Python 3, textual>=0.47.0, rich>=13.0.0 (auto-installed in a venv)

Install & launch:

./setup.sh install dashboard    # Install
claude-dashboard                # Launch

Tabs:

# Tab Description
1 Active Real-time view of running Claude Code sessions with usage/cost (auto-refreshes every 2s)
2 History Dual-pane browser — projects (with cost) on the left, sessions on the right
3 Usage Daily activity, model breakdown, per-project cost, all filterable by time period (7d/30d/all)
4 Conversation Full conversation viewer with rich text rendering

Keyboard shortcuts:

Key Action
Tab / Shift+Tab Next / prev tab
14 Switch to specific tab
/ Navigate items
/ Switch panes (History) / Change period (Usage)
Enter Open / Select
Escape Back / Close
Ctrl+F or / Search conversations
Ctrl+R Refresh all data
Ctrl+G Jump to iTerm2 tab (Active)
r Resume session
Del / Backspace Delete session (History, with confirmation)
e Export to Markdown
t Toggle thinking blocks
s Cycle sort order (History)
Home / End Scroll to top / bottom (Conversation)
? Help overlay
q Quit

Data sources:

Data Path
Active sessions /tmp/claude-sessions/*.json
Session history ~/.claude/projects/
Usage stats ~/.claude/stats-cache.json

How it works:

  • The dashboard reads Claude Code's native data files — no additional daemons or agents needed.
  • Active sessions are detected via /tmp/claude-sessions/ JSON files with PID-based liveness checks.
  • History is loaded by scanning JSONL files in ~/.claude/projects/ (never relies on stale sessions-index.json).
  • Cost estimates use official Anthropic pricing (Opus / Sonnet / Haiku, including cache tiers).
  • An async TTL cache layer avoids redundant file reads.

skills/fix-review

A Claude Code custom skill that reads GitLab MR code review comments and auto-fixes the code.

Usage: In Claude Code, type /fix-review 123 (where 123 is the MR number).

Install:

./setup.sh install skills/fix-review          # Install globally (default)
./setup.sh install skills/fix-review --local  # Install to current project only

What it does:

  1. Reads GitLab MR discussions via API (configures token interactively on first use)
  2. Filters actionable review comments (skips resolved / acknowledgment-only)
  3. Locates the referenced file + line and applies the suggested fix
  4. Summarizes all changes when done

skills/e2e-guard

A Claude Code custom skill that automatically generates a minimal E2E test plan based on code changes, runs it with human-in-the-loop write operation approval, and loops through fix-and-retest until all tests pass.

Usage:

/e2e-guard                # Auto-detect changes (git diff)
/e2e-guard main..HEAD     # Specify git range
/e2e-guard mr:123         # GitLab MR mode — auto-fetch build artifact tags from CI pipeline

Install:

./setup.sh install skills/e2e-guard          # Install globally (default)
./setup.sh install skills/e2e-guard --local  # Install to current project only

Workflow:

  1. Analyzes code changes (git diff, git range, or GitLab MR diff via glab) to identify affected user flows
  2. GitLab CI integration (optional): when given mr:123, auto-fetches component image tags from the MR's CI pipeline build jobs — no manual copy-paste needed
  3. Generates a minimal E2E test plan as a human-readable Markdown file in .planning/e2e/
  4. Waits for human review — user fills in prerequisites (credentials, test machines, etc.) and approves. CI-sourced image tags are pre-filled automatically
  5. Executes tests step by step: read operations run automatically, write operations pause for confirmation
  6. Generates a detailed test report with failure classification (code bug / env issue / plan error / transient)
  7. On failure: AI analyzes root cause per failure type, fixes code, re-runs failed tests (up to 3 retries)

GitLab CI integration: Prefers glab CLI when available (simpler auth, glab mr diff works without local branch). Falls back to curl + .claude/gitlab.json (shared config with fix-review skill).

Step types in generated test plans:

Tag Behavior
[READ] Auto-execute (queries, status checks)
[WRITE] Pause and ask for confirmation before executing
[WAIT] Auto-execute (polling, waiting for rollout)
[OBSERVE] Auto-execute and judge pass/fail against expected results (supports retry for eventual consistency)
[HUMAN] Pause and wait for human to complete a physical action

plugins/claude-hud

A one-click installer for the claude-hud statusline plugin — a real-time HUD for Claude Code showing context health, tool activity, agent tracking, and todo progress.

Requirements: Claude Code CLI, Node.js

Install:

./setup.sh install plugins/claude-hud

What it does:

  1. Adds the jarrodwatts/claude-hud marketplace to Claude Code
  2. Installs and enables the claude-hud plugin
  3. After restarting Claude Code, the statusline HUD appears automatically

Display modules:

Module Description
Model Current model name
Context bar Visual context window usage with token breakdown
Tools Recent tool calls and status
Agents Active subagent tracking
Todos Task progress from TodoRead/TodoWrite
Project Current project and git status
Speed Token output speed
Usage Session cost estimate
Duration Session duration

Configuration: After install, use /claude-hud:configure in Claude Code to customize the display layout and toggle individual modules.


Standalone Use

Each feature can also be run independently:

cd auto-approve && ./setup.sh install
cd iterm-status && ./setup.sh install --lang zh
cd iterm-monitor && ./setup.sh install
cd dashboard && ./setup.sh install
cd skills/fix-review && ./setup.sh install           # global (default)
cd skills/fix-review && ./setup.sh install --local   # current project only
cd skills/e2e-guard && ./setup.sh install            # global (default)
cd skills/e2e-guard && ./setup.sh install --local    # current project only
cd plugins/claude-hud && ./setup.sh install          # claude-hud plugin