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 c
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-zcf-update-docs-5a7a0bb83fda ,按照其中的说明把「zcf-update-docs」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
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.
/zcf-update-docs [--check-only]
--check-only: Only check for inconsistencies without making updates (dry run)You are a professional documentation maintainer responsible for:
Parse arguments: $ARGUMENTS
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
Analyze all changes since the last release:
# 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..."
Based on file changes, determine which documentation files in docs/ need updates:
Code Changes → Documentation Mapping:
CLI Commands (src/commands/*.ts) → docs/{lang}/cli/
src/commands/init.ts → cli/init.md - Installation and initializationsrc/commands/menu.ts → cli/menu.md - Interactive menu systemsrc/commands/update.ts → cli/update.md - Update workflowssrc/commands/ccr.ts → cli/ccr.md - CCR proxy managementsrc/commands/ccu.ts → cli/ccu.md - Usage analysissrc/commands/uninstall.ts → cli/uninstall.md - Uninstallationsrc/commands/config-switch.ts → cli/config-switch.md - Config switchingsrc/commands/check-updates.ts → cli/check-updates.md - Version checkFeatures → docs/{lang}/features/
src/utils/installer.ts, src/utils/claude-config.ts → features/claude-code.mdsrc/utils/code-tools/codex* → features/codex.mdsrc/config/workflows.ts → features/workflows.mdsrc/config/mcp-services.ts → features/mcp.mdsrc/utils/ccr/ → features/ccr.mdsrc/utils/cometix/ → features/cometix.mdsrc/utils/config.ts → features/multi-config.mdWorkflows (src/config/workflows.ts, templates/*/workflow/) → docs/{lang}/workflows/
workflows/index.mdworkflows/{workflow-name}.mdAdvanced Configuration → docs/{lang}/advanced/
src/types/config.ts, src/utils/config.ts → advanced/configuration.mdsrc/config/api-providers.ts → advanced/api-providers.mdtemplates/ → advanced/templates.mdRead and analyze current documentation structure:
# 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
Compare CLI commands implementation with documentation:
Check Points:
Code Sources → Documentation Files:
src/commands/menu.ts, src/i18n/locales/*/menu.json → docs/{lang}/cli/menu.mdsrc/commands/init.ts, src/i18n/locales/*/cli.json → docs/{lang}/cli/init.mdsrc/commands/update.ts → docs/{lang}/cli/update.mdsrc/commands/ccr.ts → docs/{lang}/cli/ccr.mdsrc/commands/ccu.ts → docs/{lang}/cli/ccu.mdsrc/commands/uninstall.ts → docs/{lang}/cli/uninstall.mdsrc/commands/config-switch.ts → docs/{lang}/cli/config-switch.mdsrc/commands/check-updates.ts → docs/{lang}/cli/check-updates.mdEnsure features documentation matches actual implementation:
Check Points:
Code Sources → Documentation Files:
src/utils/installer.ts, src/utils/claude-config.ts → docs/{lang}/features/claude-code.mdsrc/utils/code-tools/codex*.ts, templates/codex/ → docs/{lang}/features/codex.mdsrc/config/workflows.ts → docs/{lang}/features/workflows.mdsrc/config/mcp-services.ts → docs/{lang}/features/mcp.mdsrc/utils/ccr/ → docs/{lang}/features/ccr.mdsrc/utils/cometix/ → docs/{lang}/features/cometix.mdsrc/utils/config.ts → docs/{lang}/features/multi-config.mdCreate a detailed report of findings:
## Documentation Update Report
### Files Changed Since $LAST_TAG
- [List of relevant changed files categorized by module]
### Documentation Files Requiring Updates
#### docs/en/ (English Documentation)
- [ ] getting-started/installation.md - Installation and setup
- [ ] cli/*.md - CLI command documentation
- [ ] features/*.md - Feature descriptions
- [ ] workflows/*.md - Workflow guides
- [ ] advanced/*.md - Advanced configuration
- [ ] development/*.md - Development documentation
#### docs/zh-CN/ (Chinese Documentation)
- [ ] getting-started/installation.md - 安装和设置
- [ ] cli/*.md - CLI 命令文档
- [ ] features/*.md - 功能说明
- [ ] workflows/*.md - 工作流指南
- [ ] advanced/*.md - 高级配置
- [ ] development/*.md - 开发文档
#### docs/ja-JP/ (Japanese Documentation)
- [ ] getting-started/installation.md - インストールとセットアップ
- [ ] cli/*.md - CLI コマンドドキュメント
- [ ] features/*.md - 機能説明
- [ ] workflows/*.md - ワークフローガイド
- [ ] advanced/*.md - 高度な設定
- [ ] development/*.md - 開発ドキュメント
#### CLAUDE.md (Root Development Documentation)
- [ ] Development commands (package.json scripts)
- [ ] Architecture and module structure
- [ ] Testing guidelines and coverage
- [ ] Workflow system implementation
- [ ] Code standards and conventions
### Specific Inconsistencies Found
[Detailed list of mismatches between code and documentation, organized by file]
If not in check-only mode, update the documentation:
if [ "$CHECK_ONLY" = false ]; then
echo "📝 Updating documentation files in docs/ directory..."
# Update docs/en/ (English Documentation)
# - CLI commands: Update docs/en/cli/*.md based on src/commands/*.ts
# - Features: Update docs/en/features/*.md based on feature implementations
# - Workflows: Update docs/en/workflows/*.md based on src/config/workflows.ts
# - Getting Started: Update docs/en/getting-started/*.md based on installation flow
# - Advanced: Update docs/en/advanced/*.md based on configuration and templates
# - Development: Update docs/en/development/*.md based on architecture changes
# - Use translations from src/i18n/locales/en/*.json
# Update docs/zh-CN/ (Chinese Documentation)
# - Maintain same structure and sections as English version
# - Use proper Chinese translations from src/i18n/locales/zh-CN/*.json
# - Update all corresponding CLI, features, workflows, etc.
# - Ensure technical terms and examples are properly localized
# Update docs/ja-JP/ (Japanese Documentation)
# - Maintain same structure and sections as English version
# - Use proper Japanese translations (maintain consistency with project style)
# - Update all corresponding CLI, features, workflows, etc.
# - Ensure proper Japanese formatting and terminology
# Update CLAUDE.md (Root Development Documentation)
# - Update development commands if package.json scripts changed
# - Update architecture section if new modules added
# - Update testing section if test structure changed
# - Update workflow system if src/config/workflows.ts changed
# - Update module index if directory structure changed
# - Maintain English-only for development documentation
# Update SUMMARY.md for each language
# - Ensure table of contents matches actual file structure
# - Update links if files were added/removed/renamed
# - Maintain consistent ordering across all languages
echo "✅ Documentation files updated in docs/ directory"
else
echo "ℹ️ Check-only mode: No files were modified"
fi
Perform final validation checks:
echo -e "\n🔍 Performing validation checks..."
# Check for broken internal links in all language versions
echo "Checking internal links in docs/en/, docs/zh-CN/, docs/ja-JP/..."
# Verify SUMMARY.md matches actual file structure
echo "Validating SUMMARY.md table of contents..."
# Ensure structure consistency across languages
echo "Checking structural consistency across en, zh-CN, ja-JP..."
# Verify code examples still work
echo "Verifying code examples and command syntax..."
# Validate markdown formatting
echo "Validating markdown format..."
# Check translation completeness
echo "Checking multilingual translation completeness..."
# Verify CLI command documentation matches implementation
echo "Verifying CLI command documentation accuracy..."
# Validate feature documentation completeness
echo "Checking feature documentation coverage..."
echo "✅ Validation complete"
Generate final summary:
echo -e "\n📊 Documentation Update Summary"
echo "================================"
echo "Files analyzed: [count]"
echo "Documentation files updated: [list]"
echo "Sections modified: [count]"
echo ""
echo "Key updates:"
echo "- [List major updates]"
echo ""
if [ "$CHECK_ONLY" = true ]; then
echo "📋 This was a check-only run. To apply updates, run without --check-only"
else
echo "✅ Documentation has been synchronized with code"
echo "📝 Please review the changes before committing"
fi
Each language directory contains the following categories:
getting-started/ - Installation and quick start
index.md - Quick start guideinstallation.md - Installation guide (Must match src/commands/init.ts)cli/ - CLI command documentation
index.md - Commands overviewinit.md, update.md, menu.md, etc. (Must match src/commands/*.ts)features/ - Feature descriptions
index.md - Features overviewclaude-code.md, codex.md, workflows.md, etc. (Must match implementations)workflows/ - Workflow guides
index.md - Workflow overviewsrc/config/workflows.ts)advanced/ - Advanced configuration
configuration.md, api-providers.md, templates.md, etc.best-practices/ - Best practices and tips
development/ - Development documentation
architecture.md, contributing.md, testing.mdSUMMARY.md - Table of contents for each language
package.json scripts)⚠️ Critical Requirements:
src/commands/📌 Best Practices:
src/i18n/locales/{lang}/*.json🔍 Validation Checklist:
src/commands/*.ts implementationsrc/config/workflows.ts definitionssrc/commands/init.ts flowsrc/types/*.tssrc/config/mcp-services.tsNow starting documentation update process...
src/i18n/ → advanced/i18n.mdGetting Started → docs/{lang}/getting-started/
src/commands/init.ts, src/utils/installer.ts → getting-started/installation.mdgetting-started/index.mdDevelopment → docs/{lang}/development/ and CLAUDE.md
development/architecture.md + CLAUDE.mddevelopment/testing.md + CLAUDE.mddevelopment/contributing.mdCLAUDE.md