@@ -24,11 +24,11 @@ jobs:
24
24
25
25
- name : Run Claude Code to review documentation
26
26
id : claude-review
27
- uses : anthropics/claude-code-action@8b9d5bb25a638c9aa5103496c0139d99b4936d42 # beta
27
+ uses : anthropics/claude-code-action@8e84799f37d42f24e0ebae41205346879bdcab5a # v0.0.7
28
28
with :
29
29
anthropic_api_key : ${{ secrets.ANTHROPIC_API_KEY }}
30
30
prompt : |
31
- As a Documentation Validator, your task is to review the current code in this repository and ensure that the markdown documentation files (README.md, ARCHITECTURE.md, and DEVELOPMENT.md) are up-to-date and accurate.
31
+ As a Documentation Validator, review the current code in this repository and ensure that the markdown documentation files (README.md, ARCHITECTURE.md, and DEVELOPMENT.md) are up-to-date and accurate.
32
32
33
33
Focus on these specific areas:
34
34
1. Configuration options - Ensure all config options in lua/claudecode/config.lua are accurately reflected in README.md
@@ -37,155 +37,35 @@ jobs:
37
37
4. Development status - Review the implementation status in DEVELOPMENT.md against the actual codebase
38
38
5. Terminal feature - Check that the terminal integration is documented correctly across all files
39
39
40
- For any inconsistencies found :
41
- 1. Note the specific issue (what's incorrect, missing, or outdated)
42
- 2. Provide the correct information based on the current codebase
43
- 3. Create a corrected version of the relevant section
40
+ If you find any inconsistencies:
41
+ 1. Update the documentation files directly with the correct information
42
+ 2. Make the changes minimal and focused
43
+ 3. Ensure all changes are accurate based on the current codebase
44
44
45
- Output your findings in this format:
46
- ```json
47
- {
48
- "review_date": "YYYY-MM-DD",
49
- "files_checked": ["README.md", "ARCHITECTURE.md", "DEVELOPMENT.md"],
50
- "issues_found": [
51
- {
52
- "file": "path/to/file.md",
53
- "section": "Section title",
54
- "issue": "Description of inconsistency",
55
- "corrected_content": "The corrected markdown content"
56
- }
57
- ]
58
- }
59
- ```
45
+ After making any necessary updates, create a git commit with the message "docs: update documentation to match current codebase" if changes were made.
60
46
61
- If no issues are found, return an empty "issues_found" array.
62
-
63
- - name : Process documentation updates
64
- id : process-updates
65
- shell : bash
66
- # zizmor-disable-next-line template-injection
67
- env :
68
- CLAUDE_OUTPUT : ${{ steps.claude-review.outputs.result }}
69
- run : |
70
- # Extract issues from Claude's output
71
-
72
- # Check if the output contains the expected JSON format
73
- if ! echo "$CLAUDE_OUTPUT" | grep -q "\"issues_found\""; then
74
- echo "No valid JSON output found from Claude review"
75
- exit 0
76
- fi
77
-
78
- # Extract the JSON part (between ```json and ```)
79
- echo "$CLAUDE_OUTPUT" | sed -n "/\`\`\`json/,/\`\`\`/p" | sed "1d;\$d" > json_output.txt
80
- echo "JSON output extracted"
81
-
82
- # Parse the JSON and check if there are issues
83
- ISSUES_FOUND=$(jq ".issues_found | length" json_output.txt)
84
- echo "Issues found: $ISSUES_FOUND"
85
-
86
- # Clean up json_output.txt if no issues are found or after processing
87
- if [ "$ISSUES_FOUND" -eq 0 ]; then
88
- echo "No documentation issues found"
89
- rm -f json_output.txt # Clean up if exiting early
90
- exit 0
91
- fi
92
-
93
- if [ "$ISSUES_FOUND" -eq 0 ]; then
94
- echo "No documentation issues found"
95
- exit 0
96
- fi
97
-
98
- echo "Found $ISSUES_FOUND documentation issues to fix"
99
- echo "issues_found=$ISSUES_FOUND" >> "$GITHUB_OUTPUT"
100
-
101
- # Create a new branch for the fixes
102
- BRANCH_NAME="docs/update-$(date +%Y%m%d%H%M%S)"
103
- git checkout -b "$BRANCH_NAME"
104
-
105
- # Apply each correction - use a safer approach
106
- for i in $(seq 0 $((ISSUES_FOUND - 1))); do
107
- # Extract each field safely into separate files
108
- jq -r ".issues_found[$i].file" json_output.txt > issue_file.txt
109
- jq -r ".issues_found[$i].section" json_output.txt > issue_section.txt
110
- jq -r ".issues_found[$i].issue" json_output.txt > issue_desc.txt
111
- jq -r ".issues_found[$i].corrected_content" json_output.txt > issue_content.txt
112
-
113
- # Read from files
114
- FILE=$(cat issue_file.txt)
115
- SECTION=$(cat issue_section.txt)
116
- ISSUE=$(cat issue_desc.txt)
117
- CONTENT=$(cat issue_content.txt)
118
-
119
- echo "Updating $FILE - Section: $SECTION"
120
-
121
- # Escape content for sed using files for safety
122
- sed -E "s/[\/&]/\\&/g" issue_content.txt > escaped_content.txt
123
- ESCAPED_CONTENT=$(cat escaped_content.txt)
124
-
125
- # Look for the section and apply the change
126
- # This is a basic approach; more sophisticated section matching might be needed
127
- if grep -q "$SECTION" "$FILE"; then
128
- # Try to find the section and replace content from the section title until the next section
129
- sed -i "/# $SECTION/,/# /c\\# $SECTION\n\n$ESCAPED_CONTENT\n\n# " "$FILE"
130
- else
131
- echo "Section not found: $SECTION in $FILE. Adding to the end of the file."
132
- echo -e "\n# $SECTION\n\n$CONTENT" >> "$FILE"
133
- fi
134
- done
135
-
136
- # Clean up temporary files used in the loop
137
- rm -f issue_file.txt issue_section.txt issue_desc.txt issue_content.txt escaped_content.txt
138
- # Clean up json_output.txt after it's fully processed
139
- rm -f json_output.txt
140
-
141
- # Set up git identity for Claude
142
- git config --local user.email "[email protected] "
143
- git config --local user.name "Claude"
144
-
145
- # Commit the changes
146
- git add README.md ARCHITECTURE.md DEVELOPMENT.md
147
- git commit -m "docs: update documentation based on code analysis"
148
- git push origin "$BRANCH_NAME"
149
-
150
- echo "branch_name=$BRANCH_NAME" >> "$GITHUB_OUTPUT"
151
-
152
- # Create summary of changes to display in PR
153
- CHANGES_SUMMARY=""
154
- for i in $(seq 0 $((ISSUES_FOUND - 1))); do
155
- FILE=$(echo "$JSON_OUTPUT" | jq -r ".issues_found[$i].file")
156
- SECTION=$(echo "$JSON_OUTPUT" | jq -r ".issues_found[$i].section")
157
- ISSUE=$(echo "$JSON_OUTPUT" | jq -r ".issues_found[$i].issue")
158
-
159
- CHANGES_SUMMARY="${CHANGES_SUMMARY}- **${FILE}** (${SECTION}): ${ISSUE}\n"
160
- done
161
-
162
- {
163
- echo "changes_summary<<EOF"
164
- echo -e "$CHANGES_SUMMARY"
165
- echo "EOF"
166
- } >> "$GITHUB_OUTPUT"
167
-
168
- - name : Create Pull Request
169
- if : steps.process-updates.outputs.issues_found > 0
170
- uses : anthropics/claude-pr-action@8b9d5bb25a638c9aa5103496c0139d99b4936d42 # v1
47
+ - name : Create Pull Request if changes were made
48
+ uses : peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
171
49
with :
172
- anthropic_api_key : ${{ secrets.ANTHROPIC_API_KEY }}
173
- github_token : ${{ secrets.GITHUB_TOKEN }}
174
- branch : ${{ steps.process-updates.outputs.branch_name }}
175
- base : main
50
+ token : ${{ secrets.GITHUB_TOKEN }}
51
+ commit-message : " docs: update documentation to match current codebase"
176
52
title : " docs: Update documentation to match current codebase"
177
53
body : |
178
54
This PR was automatically generated by Claude Code to update documentation files based on code analysis.
179
55
180
56
## What's Changed
181
57
182
- Documentation has been updated to match the current codebase. The following issues were addressed:
183
-
184
- ${{ steps.process-updates.outputs.changes_summary }}
58
+ Documentation has been updated to match the current codebase state:
59
+ - Configuration options synchronized with actual code
60
+ - Commands and usage examples verified
61
+ - Architecture details updated to reflect current structure
62
+ - Development status aligned with implementation
185
63
186
- The following files were updated:
64
+ ## Files Updated
187
65
- README.md
188
66
- ARCHITECTURE.md
189
67
- DEVELOPMENT.md
190
68
191
69
Please review these changes to ensure they accurately reflect the current state of the project.
70
+ branch : docs/auto-update
71
+ delete-branch : true
0 commit comments