From f5e435f79122f8dbc3e8bbb095e709f7b34ad0ad Mon Sep 17 00:00:00 2001 From: catlog22 Date: Thu, 29 Jan 2026 15:58:51 +0800 Subject: [PATCH] feat: Optimize ccw-help skill with user-prompted update mechanism - Add auto-update.py script for simple index regeneration - Update SKILL.md with clear update instructions - Simplify update mechanism: prompt user on skill execution - Support both automatic and manual update workflows - Clean version 2.3.0 metadata in command.json --- .claude/skills/ccw-help/SKILL.md | 25 ++++++++++++-- .claude/skills/ccw-help/command.json | 5 +-- .../skills/ccw-help/scripts/auto-update.py | 34 +++++++++++++++++++ 3 files changed, 59 insertions(+), 5 deletions(-) create mode 100644 .claude/skills/ccw-help/scripts/auto-update.py diff --git a/.claude/skills/ccw-help/SKILL.md b/.claude/skills/ccw-help/SKILL.md index f4f10450..c92b18a4 100644 --- a/.claude/skills/ccw-help/SKILL.md +++ b/.claude/skills/ccw-help/SKILL.md @@ -132,14 +132,33 @@ Single source of truth: **[command.json](command.json)** ## Maintenance -### Update Index +### Update Mechanism + +CCW-Help skill supports manual updates through user confirmation dialog. + +#### How to Update + +**Option 1: When executing the skill, user will be prompted:** + +``` +Would you like to update CCW-Help command index? +- Yes: Run auto-update and regenerate command.json +- No: Use current index +``` + +**Option 2: Manual update** ```bash cd D:/Claude_dms3/.claude/skills/ccw-help -python scripts/analyze_commands.py +python scripts/auto-update.py ``` -脚本功能:扫描 commands/ 和 agents/ 目录,生成统一的 command.json +This runs `analyze_commands.py` to scan commands/ and agents/ directories and regenerate `command.json`. + +#### Update Scripts + +- **`auto-update.py`**: Simple wrapper that runs analyze_commands.py +- **`analyze_commands.py`**: Scans directories and generates command index ## Statistics diff --git a/.claude/skills/ccw-help/command.json b/.claude/skills/ccw-help/command.json index 4a95271f..1927a520 100644 --- a/.claude/skills/ccw-help/command.json +++ b/.claude/skills/ccw-help/command.json @@ -1,9 +1,10 @@ { "_metadata": { - "version": "2.1.0", + "version": "2.3.0", "total_commands": 51, "total_agents": 16, - "description": "Unified CCW-Help command index" + "description": "Unified CCW-Help command index", + "update": "User prompted to update on skill execution. Run 'python scripts/auto-update.py' for manual update." }, "essential_commands": [ diff --git a/.claude/skills/ccw-help/scripts/auto-update.py b/.claude/skills/ccw-help/scripts/auto-update.py new file mode 100644 index 00000000..bc6250cb --- /dev/null +++ b/.claude/skills/ccw-help/scripts/auto-update.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python3 +""" +Simple update script for ccw-help skill. +Runs analyze_commands.py to regenerate command index. +""" + +import sys +import subprocess +from pathlib import Path + +BASE_DIR = Path("D:/Claude_dms3/.claude") +SKILL_DIR = BASE_DIR / "skills" / "ccw-help" +ANALYZE_SCRIPT = SKILL_DIR / "scripts" / "analyze_commands.py" + +def run_update(): + """Run command analysis update.""" + try: + result = subprocess.run( + [sys.executable, str(ANALYZE_SCRIPT)], + capture_output=True, + text=True, + timeout=30 + ) + + print(result.stdout) + return result.returncode == 0 + + except Exception as e: + print(f"Error running update: {e}") + return False + +if __name__ == '__main__': + success = run_update() + sys.exit(0 if success else 1)