11name : " + Claude Code / Architecture Doc Validation"
2+ permissions :
3+ contents : read
4+ pull-requests : write
25
36on :
47 pull_request :
58 types : [opened, synchronize]
9+ paths :
10+ - ' src/aignostics/**/*.py'
11+ - ' pyproject.toml'
12+ - ' .github/workflows/**/*.yml'
13+ - ' SOFTWARE_ARCHITECTURE.md'
614 workflow_dispatch :
715 inputs :
816 platform_environment :
1321 options :
1422 - staging
1523 - production
24+ pr_number :
25+ description : ' PR number (for manual runs)'
26+ required : false
27+ type : string
1628
1729jobs :
1830 architecture-validation :
@@ -21,59 +33,65 @@ jobs:
2133 platform_environment : ${{ inputs.platform_environment || 'staging' }}
2234 mode : ' automation'
2335 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 :*)'
36+ allowed_tools : ' Read,Write,Edit, Glob,Grep,Bash(git:*),Bash(gh:*),Bash(find:*),Bash(cat :*),Bash(echo :*)'
2537 prompt : |
2638 # SOFTWARE ARCHITECTURE VALIDATION FOR PULL REQUEST
2739
2840 **REPO**: ${{ github.repository }}
29- **PR**: ${{ github.event.pull_request.number && format('#{0}', github.event.pull_request.number) || 'Manual Run' }}
41+ **PR**: ${{ github.event.pull_request.number && format('#{0}', github.event.pull_request.number) || inputs.pr_number || 'Manual Run' }}
3042 **BRANCH**: ${{ github.event.pull_request.head.ref || github.ref_name }}
3143
32- ## Context
44+ ## Your Mission
3345
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.
46+ You are an architecture documentation validator. Your task is to:
3747
38- ## Your Mission
48+ 1. **Analyze** the code changes in this PR to understand their architectural impact
49+ 2. **Validate** that `SOFTWARE_ARCHITECTURE.md` accurately reflects the current codebase after these changes
50+ 3. **Identify** any discrepancies between the code and the documentation
51+ 4. **Suggest** specific, actionable updates to `SOFTWARE_ARCHITECTURE.md` with exact text to add/modify
52+ 5. **Comment** on the PR with your findings and recommendations for human review
53+
54+ ## CRITICAL: You MUST use tools to gather information
55+
56+ - Use the **Bash** tool to execute all git/gh commands shown below
57+ - Use the **Read** tool to read files
58+ - Use the **Grep** tool to search for patterns
59+ - Use the **Glob** tool to find files
3960
40- Analyze the changes in this PR and validate that the Software Architecture
41- document remains accurate, complete, and up-to-date.
61+ Do NOT just acknowledge these commands - you must ACTUALLY EXECUTE them.
4262
4363 ## Step 1: Understand PR Changes
4464
65+ Execute these commands using the Bash tool to understand what changed:
66+
4567 ```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-
68+ PR_NUMBER="${{ github.event.pull_request.number || inputs.pr_number }}"
69+
5270 if [ -n "$PR_NUMBER" ]; then
53- echo "Changed files in this PR: "
71+ echo "=== Changed files in PR #$PR_NUMBER === "
5472 gh pr view "$PR_NUMBER" --json files --jq '.files[].path' | sort
55- echo ""
56- echo "Detailed diff:"
57- gh pr diff "$PR_NUMBER"
5873 else
59- echo "Manual run - comparing with main branch"
60- echo "Changed files:"
74+ echo "=== Changed files (comparing with main) ==="
6175 git diff --name-only origin/main...HEAD | sort
62- echo ""
63- echo "Detailed diff:"
64- git diff origin/main...HEAD
6576 fi
6677 ```
6778
68- ## Step 2: Read Current Architecture Document
79+ After seeing the file list, get the detailed changes for architectural files:
6980
7081 ```bash
71- echo "=== Reading Architecture Document ==="
72- echo ""
73- # Read the current SOFTWARE_ARCHITECTURE.md
74- cat SOFTWARE_ARCHITECTURE.md
82+ PR_NUMBER="${{ github.event.pull_request.number || inputs.pr_number }}"
83+
84+ if [ -n "$PR_NUMBER" ]; then
85+ gh pr diff "$PR_NUMBER" | head -500
86+ else
87+ git diff origin/main...HEAD | head -500
88+ fi
7589 ```
7690
91+ ## Step 2: Read Current Architecture Document
92+
93+ Use the Read tool to read `SOFTWARE_ARCHITECTURE.md` and understand its current structure.
94+
7795 ## Step 3: Validate Architecture Accuracy
7896
7997 For each change in the PR, check if the architecture document needs updates:
0 commit comments