Skip to main content
ClaudeWave
Skill6.1k repo starsupdated 5d ago

zcf-update-docs

Automatically check code changes since last tag and update documentation in docs/ directory (en, zh-CN, ja-JP) and CLAUDE.md to ensure consistency with actual code implementation

Install in Claude Code
Copy
git clone --depth 1 https://github.com/UfoMiao/zcf /tmp/zcf-update-docs && cp -r /tmp/zcf-update-docs/.claude/skills/zcf-update-docs ~/.claude/skills/zcf-update-docs
Then start a new Claude Code session; the skill loads automatically.

SKILL.md

# ZCF Update Docs - Documentation Synchronization

Automatically check code changes since last tag and update documentation in `docs/` directory (multilingual: en, zh-CN, ja-JP) and CLAUDE.md to ensure consistency with actual code implementation.

## Usage

```bash
/zcf-update-docs [--check-only]
```

## Parameters

- `--check-only`: Only check for inconsistencies without making updates (dry run)

## Context

- Analyze all code changes since the last Git tag
- Check if documentation needs updates in docs/ directory structure
- Ensure CLI commands, features, and workflows documentation match actual code
- Maintain multilingual documentation consistency across en, zh-CN, ja-JP
- Update CLAUDE.md for development-related changes

## Your Role

You are a professional documentation maintainer responsible for:

1. Analyzing code changes and their impact on documentation
2. Identifying documentation sections that need updates
3. Ensuring documentation accuracy and consistency
4. Maintaining multilingual synchronization

## Execution Flow

Parse arguments: $ARGUMENTS

### 1. Parameter Parsing

```bash
CHECK_ONLY=false  # Default to update mode

case "$ARGUMENTS" in
  --check-only)
    CHECK_ONLY=true
    echo "📋 Running in check-only mode (no files will be modified)"
    ;;
  "")
    CHECK_ONLY=false
    echo "✏️ Running in update mode"
    ;;
  *)
    echo "Unknown parameter: $ARGUMENTS"
    echo "Usage: /zcf-update-docs [--check-only]"
    exit 1
    ;;
esac
```

### 2. Get Changes Since Last Tag

Analyze all changes since the last release:

```bash
# Get last release tag
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")

if [ -z "$LAST_TAG" ]; then
  echo "⚠️ No previous version tag found, analyzing all files"
  FILES_CHANGED=$(git ls-files)
else
  echo "📊 Last version: $LAST_TAG"
  echo "Analyzing changes since $LAST_TAG..."
  FILES_CHANGED=$(git diff --name-only $LAST_TAG..HEAD)
fi

# Categorize changed files
echo -e "\n📁 Analyzing changed files..."
```

### 3. Identify Documentation Update Areas

Based on file changes, determine which documentation files in `docs/` need updates:

**Code Changes → Documentation Mapping:**

1. **CLI Commands** (`src/commands/*.ts`) → `docs/{lang}/cli/`
   - `src/commands/init.ts` → `cli/init.md` - Installation and initialization
   - `src/commands/menu.ts` → `cli/menu.md` - Interactive menu system
   - `src/commands/update.ts` → `cli/update.md` - Update workflows
   - `src/commands/ccr.ts` → `cli/ccr.md` - CCR proxy management
   - `src/commands/ccu.ts` → `cli/ccu.md` - Usage analysis
   - `src/commands/uninstall.ts` → `cli/uninstall.md` - Uninstallation
   - `src/commands/config-switch.ts` → `cli/config-switch.md` - Config switching
   - `src/commands/check-updates.ts` → `cli/check-updates.md` - Version check

2. **Features** → `docs/{lang}/features/`
   - `src/utils/installer.ts`, `src/utils/claude-config.ts` → `features/claude-code.md`
   - `src/utils/code-tools/codex*` → `features/codex.md`
   - `src/config/workflows.ts` → `features/workflows.md`
   - `src/config/mcp-services.ts` → `features/mcp.md`
   - `src/utils/ccr/` → `features/ccr.md`
   - `src/utils/cometix/` → `features/cometix.md`
   - `src/utils/config.ts` → `features/multi-config.md`

3. **Workflows** (`src/config/workflows.ts`, `templates/*/workflow/`) → `docs/{lang}/workflows/`
   - Workflow definitions → `workflows/index.md`
   - Specific workflow templates → `workflows/{workflow-name}.md`

4. **Advanced Configuration** → `docs/{lang}/advanced/`
   - `src/types/config.ts`, `src/utils/config.ts` → `advanced/configuration.md`
   - `src/config/api-providers.ts` → `advanced/api-providers.md`
   - `templates/` → `advanced/templates.md`
   - `src/i18n/` → `advanced/i18n.md`

5. **Getting Started** → `docs/{lang}/getting-started/`
   - `src/commands/init.ts`, `src/utils/installer.ts` → `getting-started/installation.md`
   - General introduction → `getting-started/index.md`

6. **Development** → `docs/{lang}/development/` and `CLAUDE.md`
   - Architecture changes → `development/architecture.md` + `CLAUDE.md`
   - Testing changes → `development/testing.md` + `CLAUDE.md`
   - Contributing guidelines → `development/contributing.md`
   - Package.json scripts → `CLAUDE.md`

### 4. Check Current Documentation

Read and analyze current documentation structure:

```bash
# Check if documentation directories exist
DOCS_LANGS=("en" "zh-CN" "ja-JP")
DOCS_CATEGORIES=(
  "getting-started"
  "cli"
  "features"
  "workflows"
  "advanced"
  "best-practices"
  "development"
)

echo "📁 Checking documentation structure..."

for LANG in "${DOCS_LANGS[@]}"; do
  if [ ! -d "docs/$LANG" ]; then
    echo "❌ Warning: docs/$LANG directory not found"
  else
    echo "✅ Found: docs/$LANG/"
    for CATEGORY in "${DOCS_CATEGORIES[@]}"; do
      if [ ! -d "docs/$LANG/$CATEGORY" ]; then
        echo "  ⚠️  Missing category: $CATEGORY"
      else
        echo "  ✅ Category: $CATEGORY"
      fi
    done
  fi
done

# Check CLAUDE.md
if [ ! -f "CLAUDE.md" ]; then
  echo "❌ Warning: CLAUDE.md not found"
else
  echo "✅ Found: CLAUDE.md"
fi
```

### 5. Verify CLI Commands Consistency

Compare CLI commands implementation with documentation:

**Check Points:**
- Command names, options, and parameters
- Command descriptions and usage examples
- Interactive menu options and flow
- Keyboard shortcuts and navigation
- Exit and back options
- Multilingual prompt translations

**Code Sources → Documentation Files:**
- `src/commands/menu.ts`, `src/i18n/locales/*/menu.json` → `docs/{lang}/cli/menu.md`
- `src/commands/init.ts`, `src/i18n/locales/*/cli.json` → `docs/{lang}/cli/init.md`
- `src/commands/update.ts` → `docs/{lang}/cli/update.md`
- `src/commands/ccr.ts` → `docs/{lang}/cli/ccr.md`
- `src/commands/ccu.ts` → `docs/{lang}/cli/ccu.md`
- `src/commands/uninstall.ts` → `docs/{lang}/cli/uninstall.md`
- `src/commands/config-switch.ts` → `docs/{lang}/cli/config-switch.md`
- `src/commands/check-updates.ts` → `docs/{lang}/cli/chec