Skip to content

Commit a34d956

Browse files
refine claude-code-architecture-validation using claude code
1 parent 5a8b8cc commit a34d956

File tree

1 file changed

+50
-29
lines changed

1 file changed

+50
-29
lines changed

.github/workflows/claude-code-architecture-validation.yml

Lines changed: 50 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ name: "+ Claude Code / Architecture Doc Validation"
33
on:
44
pull_request:
55
types: [opened, synchronize]
6+
paths:
7+
- 'src/aignostics/**/*.py'
8+
- 'pyproject.toml'
9+
- '.github/workflows/**/*.yml'
10+
- 'SOFTWARE_ARCHITECTURE.md'
611
workflow_dispatch:
712
inputs:
813
platform_environment:
@@ -13,67 +18,83 @@ on:
1318
options:
1419
- staging
1520
- production
21+
pr_number:
22+
description: 'PR number (for manual runs)'
23+
required: false
24+
type: string
1625

1726
jobs:
1827
architecture-validation:
28+
permissions:
29+
actions: read
30+
contents: write
31+
issues: write
32+
pull-requests: write
33+
id-token: write
1934
uses: ./.github/workflows/_claude-code.yml
2035
with:
2136
platform_environment: ${{ inputs.platform_environment || 'staging' }}
2237
mode: 'automation'
2338
track_progress: ${{ github.event_name != 'workflow_dispatch' && true || false }}
24-
allowed_tools: 'Read,Glob,Grep,LS,Bash(git:*),Bash(gh:*),Bash(find:*),Bash(diff:*),Bash(uv:*)'
39+
allowed_tools: 'Read,Write,Edit,Glob,Grep,Bash(git:*),Bash(gh:*),Bash(find:*),Bash(cat:*),Bash(echo:*)'
2540
prompt: |
2641
# SOFTWARE ARCHITECTURE VALIDATION FOR PULL REQUEST
2742
2843
**REPO**: ${{ github.repository }}
29-
**PR**: ${{ github.event.pull_request.number && format('#{0}', github.event.pull_request.number) || 'Manual Run' }}
44+
**PR**: ${{ github.event.pull_request.number && format('#{0}', github.event.pull_request.number) || inputs.pr_number || 'Manual Run' }}
3045
**BRANCH**: ${{ github.event.pull_request.head.ref || github.ref_name }}
3146
32-
## Context
47+
## Your Mission
3348
34-
This PR validation checks if `SOFTWARE_ARCHITECTURE.md` accurately reflects
35-
the current codebase structure, dependencies, and architectural patterns after
36-
the proposed changes in this PR.
49+
You are an architecture documentation validator. Your task is to:
3750
38-
## Your Mission
51+
1. **Analyze** the code changes in this PR to understand their architectural impact
52+
2. **Validate** that `SOFTWARE_ARCHITECTURE.md` accurately reflects the current codebase after these changes
53+
3. **Identify** any discrepancies between the code and the documentation
54+
4. **Suggest** specific, actionable updates to `SOFTWARE_ARCHITECTURE.md` with exact text to add/modify
55+
5. **Comment** on the PR with your findings and recommendations for human review
56+
57+
## CRITICAL: You MUST use tools to gather information
58+
59+
- Use the **Bash** tool to execute all git/gh commands shown below
60+
- Use the **Read** tool to read files
61+
- Use the **Grep** tool to search for patterns
62+
- Use the **Glob** tool to find files
3963
40-
Analyze the changes in this PR and validate that the Software Architecture
41-
document remains accurate, complete, and up-to-date.
64+
Do NOT just acknowledge these commands - you must ACTUALLY EXECUTE them.
4265
4366
## Step 1: Understand PR Changes
4467
68+
Execute these commands using the Bash tool to understand what changed:
69+
4570
```bash
46-
echo "=== Analyzing PR Changes ==="
47-
echo ""
48-
49-
# Check if this is a PR or manual run
50-
PR_NUMBER="${{ github.event.pull_request.number }}"
51-
71+
PR_NUMBER="${{ github.event.pull_request.number || inputs.pr_number }}"
72+
5273
if [ -n "$PR_NUMBER" ]; then
53-
echo "Changed files in this PR:"
74+
echo "=== Changed files in PR #$PR_NUMBER ==="
5475
gh pr view "$PR_NUMBER" --json files --jq '.files[].path' | sort
55-
echo ""
56-
echo "Detailed diff:"
57-
gh pr diff "$PR_NUMBER"
5876
else
59-
echo "Manual run - comparing with main branch"
60-
echo "Changed files:"
77+
echo "=== Changed files (comparing with main) ==="
6178
git diff --name-only origin/main...HEAD | sort
62-
echo ""
63-
echo "Detailed diff:"
64-
git diff origin/main...HEAD
6579
fi
6680
```
6781
68-
## Step 2: Read Current Architecture Document
82+
After seeing the file list, get the detailed changes for architectural files:
6983
7084
```bash
71-
echo "=== Reading Architecture Document ==="
72-
echo ""
73-
# Read the current SOFTWARE_ARCHITECTURE.md
74-
cat SOFTWARE_ARCHITECTURE.md
85+
PR_NUMBER="${{ github.event.pull_request.number || inputs.pr_number }}"
86+
87+
if [ -n "$PR_NUMBER" ]; then
88+
gh pr diff "$PR_NUMBER" | head -500
89+
else
90+
git diff origin/main...HEAD | head -500
91+
fi
7592
```
7693
94+
## Step 2: Read Current Architecture Document
95+
96+
Use the Read tool to read `SOFTWARE_ARCHITECTURE.md` and understand its current structure.
97+
7798
## Step 3: Validate Architecture Accuracy
7899
79100
For each change in the PR, check if the architecture document needs updates:

0 commit comments

Comments
 (0)