Skip to content

Commit c908e75

Browse files
rolfedhclaude
andcommitted
feat: Implement CLAUDE.md Hybrid Automation System
Complete implementation of automated CLAUDE.md maintenance using multiple trigger mechanisms for comprehensive documentation synchronization. System Components: - Template foundation (CLAUDE.template.md) with 5 auto-generated sections - Smart updater script (512 lines) with intelligent project analysis - GitHub Actions workflow for scheduled and event-driven updates - Git hooks for immediate local updates on commits/pushes - Comprehensive documentation and management tools Auto-Generated Sections: - Dependencies: Extracted from pyproject.toml and project detection - Architecture: Live file structure with descriptive comments - Commands: Discovered tools and development workflows - Implementation Status: Phase completion based on file analysis - Recent Development: 30-day commit analysis for themes and achievements Automation Triggers: - Immediate: Git hooks on commits affecting src/, tests/, pyproject.toml - Scheduled: Weekly GitHub Actions updates (Sundays 6 AM UTC) - Event-driven: Pushes to main branch with significant changes - Manual: On-demand updates via python scripts/claude_md_updater.py Benefits: - CLAUDE.md stays synchronized with project evolution automatically - 156 insertions, 113 deletions in first automated update - Eliminates documentation drift while preserving human control - Multiple trigger mechanisms ensure comprehensive coverage 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 25e41a4 commit c908e75

File tree

8 files changed

+1787
-113
lines changed

8 files changed

+1787
-113
lines changed
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
name: Update CLAUDE.md
2+
3+
on:
4+
# Trigger on significant changes
5+
push:
6+
branches: [main]
7+
paths:
8+
- 'src/**'
9+
- 'tests/**'
10+
- 'pyproject.toml'
11+
- '.github/workflows/**'
12+
- 'docs/_config.yml'
13+
- 'scripts/**'
14+
15+
# Weekly automatic update on Sundays at 6 AM UTC
16+
schedule:
17+
- cron: '0 6 * * 0'
18+
19+
# Allow manual triggering
20+
workflow_dispatch:
21+
inputs:
22+
force_update:
23+
description: 'Force update even if no changes detected'
24+
required: false
25+
default: 'false'
26+
type: boolean
27+
28+
jobs:
29+
update-claude-md:
30+
runs-on: ubuntu-latest
31+
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v4
35+
with:
36+
# Need full history for commit analysis
37+
fetch-depth: 0
38+
token: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Set up Python
41+
uses: actions/setup-python@v4
42+
with:
43+
python-version: '3.11'
44+
45+
- name: Install dependencies
46+
run: |
47+
python -m pip install --upgrade pip
48+
pip install toml
49+
50+
- name: Run CLAUDE.md updater
51+
id: update_claude
52+
run: |
53+
echo "🔄 Running CLAUDE.md updater..."
54+
55+
# Make script executable
56+
chmod +x scripts/claude_md_updater.py
57+
58+
# Run the updater
59+
if [[ "${{ github.event.inputs.force_update }}" == "true" ]]; then
60+
python scripts/claude_md_updater.py --force
61+
else
62+
python scripts/claude_md_updater.py
63+
fi
64+
65+
# Check if CLAUDE.md was modified
66+
if git diff --quiet CLAUDE.md; then
67+
echo "updated=false" >> $GITHUB_OUTPUT
68+
echo "✅ CLAUDE.md is already up to date"
69+
else
70+
echo "updated=true" >> $GITHUB_OUTPUT
71+
echo "📝 CLAUDE.md has been updated"
72+
fi
73+
74+
- name: Show changes
75+
if: steps.update_claude.outputs.updated == 'true'
76+
run: |
77+
echo "📋 Changes made to CLAUDE.md:"
78+
git diff CLAUDE.md || true
79+
80+
- name: Commit changes
81+
if: steps.update_claude.outputs.updated == 'true'
82+
run: |
83+
git config --local user.email "action@github.com"
84+
git config --local user.name "GitHub Action"
85+
86+
git add CLAUDE.md
87+
88+
# Create descriptive commit message
89+
echo "docs: Auto-update CLAUDE.md with current project state" > commit_msg.txt
90+
echo "" >> commit_msg.txt
91+
echo "Automated update includes:" >> commit_msg.txt
92+
echo "- Current project architecture and file structure" >> commit_msg.txt
93+
echo "- Updated dependencies from pyproject.toml" >> commit_msg.txt
94+
echo "- Recent development focus and achievements" >> commit_msg.txt
95+
echo "- Available commands and tools" >> commit_msg.txt
96+
echo "- Implementation status based on project analysis" >> commit_msg.txt
97+
echo "" >> commit_msg.txt
98+
echo "🤖 Generated with automated CLAUDE.md updater" >> commit_msg.txt
99+
echo "" >> commit_msg.txt
100+
echo "Co-Authored-By: CLAUDE.md Updater <noreply@github.com>" >> commit_msg.txt
101+
102+
git commit -F commit_msg.txt
103+
rm commit_msg.txt
104+
105+
- name: Push changes
106+
if: steps.update_claude.outputs.updated == 'true'
107+
run: |
108+
git push
109+
echo "✅ CLAUDE.md updates pushed to repository"
110+
111+
- name: Create summary
112+
run: |
113+
if [[ "${{ steps.update_claude.outputs.updated }}" == "true" ]]; then
114+
echo "## ✅ CLAUDE.md Updated Successfully" >> $GITHUB_STEP_SUMMARY
115+
echo "" >> $GITHUB_STEP_SUMMARY
116+
echo "The CLAUDE.md file has been automatically updated with:" >> $GITHUB_STEP_SUMMARY
117+
echo "- 🏗️ Current project architecture" >> $GITHUB_STEP_SUMMARY
118+
echo "- 📦 Latest dependencies from pyproject.toml" >> $GITHUB_STEP_SUMMARY
119+
echo "- 🎯 Recent development focus and achievements" >> $GITHUB_STEP_SUMMARY
120+
echo "- 🛠️ Available commands and development tools" >> $GITHUB_STEP_SUMMARY
121+
echo "- ✅ Implementation status based on project analysis" >> $GITHUB_STEP_SUMMARY
122+
echo "" >> $GITHUB_STEP_SUMMARY
123+
echo "### Recent Changes" >> $GITHUB_STEP_SUMMARY
124+
echo "\`\`\`diff" >> $GITHUB_STEP_SUMMARY
125+
git show --stat HEAD >> $GITHUB_STEP_SUMMARY
126+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
127+
else
128+
echo "## ℹ️ CLAUDE.md Already Current" >> $GITHUB_STEP_SUMMARY
129+
echo "" >> $GITHUB_STEP_SUMMARY
130+
echo "No updates were needed - CLAUDE.md is already synchronized with the current project state." >> $GITHUB_STEP_SUMMARY
131+
fi
132+
133+
- name: Notify on failure
134+
if: failure()
135+
run: |
136+
echo "## ❌ CLAUDE.md Update Failed" >> $GITHUB_STEP_SUMMARY
137+
echo "" >> $GITHUB_STEP_SUMMARY
138+
echo "The automated CLAUDE.md update encountered an error. Please check the workflow logs and update manually if needed." >> $GITHUB_STEP_SUMMARY
139+
echo "" >> $GITHUB_STEP_SUMMARY
140+
echo "Manual update command: \`python scripts/claude_md_updater.py --force\`" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)