@manufac/sculptor 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/feedback.yml +50 -0
- package/.github/workflows/inline.yml +119 -0
- package/.github/workflows/insights.yml +160 -0
- package/.husky/pre-commit +2 -0
- package/.prettierrc.mjs +2 -0
- package/Readme.md +1 -0
- package/dist/claude/feedback.yml +50 -0
- package/dist/claude/inline.yml +119 -0
- package/dist/claude/insights.yml +160 -0
- package/dist/guidelines/MantineCore.md +110 -0
- package/dist/guidelines/MantineForm.md +172 -0
- package/dist/guidelines/MantineHooks.md +230 -0
- package/dist/guidelines/React.md +502 -0
- package/dist/guidelines/Typescript.md +53 -0
- package/dist/guidelines/TypescriptNamingConventions.md +117 -0
- package/dist/guidelines/Zod.md +175 -0
- package/dist/tsc/index.js +11 -0
- package/dist/tsc/utils.js +116 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/utils.d.ts +2 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/eslint.config.mjs +8 -0
- package/package.json +43 -0
- package/src/claude/feedback.yml +50 -0
- package/src/claude/inline.yml +119 -0
- package/src/claude/insights.yml +160 -0
- package/src/guidelines/MantineCore.md +110 -0
- package/src/guidelines/MantineForm.md +172 -0
- package/src/guidelines/MantineHooks.md +230 -0
- package/src/guidelines/React.md +502 -0
- package/src/guidelines/Typescript.md +53 -0
- package/src/guidelines/TypescriptNamingConventions.md +117 -0
- package/src/guidelines/Zod.md +175 -0
- package/src/index.ts +14 -0
- package/src/utils.ts +142 -0
- package/tsconfig.json +113 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: Claude Feedback Collector
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
issue_comment:
|
|
5
|
+
types: [created]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
collect-feedback:
|
|
9
|
+
if: >
|
|
10
|
+
github.event.issue.pull_request != null &&
|
|
11
|
+
contains(github.event.comment.body, '@claude-feedback')
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- name: Create feedback issue with diff permalink
|
|
15
|
+
env:
|
|
16
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
17
|
+
run: |
|
|
18
|
+
REPO="${{ github.repository }}"
|
|
19
|
+
PR_NUMBER="${{ github.event.issue.number }}"
|
|
20
|
+
|
|
21
|
+
PR_JSON=$(gh pr view "$PR_NUMBER" --repo "$REPO" --json headRefOid)
|
|
22
|
+
COMMIT_SHA=$(echo "$PR_JSON" | jq -r '.headRefOid')
|
|
23
|
+
|
|
24
|
+
DIFF_URL="https://github.com/${REPO}/pull/${PR_NUMBER}/files?diff=unified&sha=${COMMIT_SHA}"
|
|
25
|
+
FEEDBACK_REPO="manufac-analytics/sculptor"
|
|
26
|
+
|
|
27
|
+
gh issue create \
|
|
28
|
+
--repo "$FEEDBACK_REPO" \
|
|
29
|
+
--title "Claude feedback - PR #${PR_NUMBER}" \
|
|
30
|
+
--body "$(cat <<EOF
|
|
31
|
+
## Trigger
|
|
32
|
+
@claude-feedback mentioned in PR comment.
|
|
33
|
+
|
|
34
|
+
## PR Context
|
|
35
|
+
- Repository: ${REPO}
|
|
36
|
+
- PR: #${PR_NUMBER}
|
|
37
|
+
- Commit SHA: ${COMMIT_SHA}
|
|
38
|
+
|
|
39
|
+
## Diff (Permalink)
|
|
40
|
+
${DIFF_URL}
|
|
41
|
+
|
|
42
|
+
## Comment
|
|
43
|
+
Author: @${{ github.event.comment.user.login }}
|
|
44
|
+
URL: ${{ github.event.comment.html_url }}
|
|
45
|
+
|
|
46
|
+
\`\`\`
|
|
47
|
+
${{ github.event.comment.body }}
|
|
48
|
+
\`\`\`
|
|
49
|
+
EOF
|
|
50
|
+
)"
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
name: Software Engineer Code Review
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened] # Trigger when a PR is created
|
|
6
|
+
issue_comment:
|
|
7
|
+
types: [created] # Trigger when a comment is created
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
claude-review:
|
|
11
|
+
if: |
|
|
12
|
+
(github.event_name == 'pull_request') ||
|
|
13
|
+
(github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, '@claude-inline'))
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
pull-requests: write
|
|
18
|
+
issues: read
|
|
19
|
+
id-token: write
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- name: Set PR number and ref
|
|
23
|
+
id: pr-info
|
|
24
|
+
run: |
|
|
25
|
+
if [ "${{ github.event_name }}" == "pull_request" ]; then
|
|
26
|
+
echo "pr_number=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
|
|
27
|
+
echo "pr_ref=refs/pull/${{ github.event.pull_request.number }}/merge" >> $GITHUB_OUTPUT
|
|
28
|
+
echo "commit_sha=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
|
|
29
|
+
else
|
|
30
|
+
PR_NUM=${{ github.event.issue.number }}
|
|
31
|
+
echo "pr_number=$PR_NUM" >> $GITHUB_OUTPUT
|
|
32
|
+
echo "pr_ref=refs/pull/$PR_NUM/merge" >> $GITHUB_OUTPUT
|
|
33
|
+
# Use gh api instead of gh pr view to avoid git dependency
|
|
34
|
+
COMMIT_SHA=$(gh api repos/${{ github.repository }}/pulls/$PR_NUM --jq '.head.sha')
|
|
35
|
+
echo "commit_sha=$COMMIT_SHA" >> $GITHUB_OUTPUT
|
|
36
|
+
fi
|
|
37
|
+
env:
|
|
38
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
39
|
+
|
|
40
|
+
- name: Checkout PR code
|
|
41
|
+
uses: actions/checkout@v4
|
|
42
|
+
with:
|
|
43
|
+
ref: ${{ steps.pr-info.outputs.pr_ref }}
|
|
44
|
+
fetch-depth: 0
|
|
45
|
+
|
|
46
|
+
- name: Run Claude Code Review for functional issues
|
|
47
|
+
id: claude-review-functional
|
|
48
|
+
uses: anthropics/claude-code-action@v1
|
|
49
|
+
with:
|
|
50
|
+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
|
51
|
+
|
|
52
|
+
prompt: |
|
|
53
|
+
REPO: ${{ github.repository }}
|
|
54
|
+
PR NUMBER: ${{ steps.pr-info.outputs.pr_number }}
|
|
55
|
+
COMMIT SHA: ${{ steps.pr-info.outputs.commit_sha }}
|
|
56
|
+
|
|
57
|
+
Provide inline code review comments only on lines modified in the PR diff. Do not create comments on lines that are not modified.
|
|
58
|
+
|
|
59
|
+
Review Process:
|
|
60
|
+
1. Use `gh pr diff ${{ steps.pr-info.outputs.pr_number }}` to analyze all changes in the PR
|
|
61
|
+
2. For each issue you find (bugs, performance issues, security issues), collect them to create inline comments
|
|
62
|
+
|
|
63
|
+
To create inline comments, use `mcp__github_inline_comment__create_inline_comment` tool. :
|
|
64
|
+
|
|
65
|
+
Guidelines:
|
|
66
|
+
- Focus on actionable feedback: bugs, performance, security
|
|
67
|
+
- Be concise and direct
|
|
68
|
+
- Create inline comments for specific code issues
|
|
69
|
+
- Do not provide appreciation comments like "Good use of the const + type pattern per CLAUDE.md Form Utils Typings section. The as const combined with type extraction provides both literal inference and type safety. Consider adding satisfies Record<string, number> for additional compile-time validation: export const RecognitionStatus = { ... } as const satisfies Record<string, number>;"
|
|
70
|
+
- Review comment should provide a direct solution or guide the implementor in direction of the solution rather than open ended questions.
|
|
71
|
+
|
|
72
|
+
claude_args: |
|
|
73
|
+
--allowed-tools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*), Bash(gh pr diff:*), Bash(gh pr view:*)"
|
|
74
|
+
--model claude-haiku-4-5-20251001
|
|
75
|
+
--system-prompt "As a software engineer with complete knowledge of the codebase, you are reviewing a pull request."
|
|
76
|
+
|
|
77
|
+
- name: Run Claude Code Review for semantic and convention analysis
|
|
78
|
+
id: claude-review-semantic
|
|
79
|
+
uses: anthropics/claude-code-action@v1
|
|
80
|
+
with:
|
|
81
|
+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
|
82
|
+
|
|
83
|
+
prompt: |
|
|
84
|
+
REPO: ${{ github.repository }}
|
|
85
|
+
PR NUMBER: ${{ steps.pr-info.outputs.pr_number }}
|
|
86
|
+
COMMIT SHA: ${{ steps.pr-info.outputs.commit_sha }}
|
|
87
|
+
|
|
88
|
+
Provide inline code review comments only on lines modified in the PR diff. Do not create comments on lines that are not modified.
|
|
89
|
+
|
|
90
|
+
Review Process:
|
|
91
|
+
1. Use `gh pr diff ${{ steps.pr-info.outputs.pr_number }}` to analyze all changes in the PR
|
|
92
|
+
2. Follow the repository's CLAUDE.md:
|
|
93
|
+
- `Variable naming guidelines` section for variable naming conventions.
|
|
94
|
+
- `Types naming conventions` section for type naming conventions.
|
|
95
|
+
- `File naming conventions` section for file naming conventions.
|
|
96
|
+
- `Coding conventions guidelines` section for coding conventions.
|
|
97
|
+
|
|
98
|
+
3. Do not deviate from the guidelines in CLAUDE.md.
|
|
99
|
+
|
|
100
|
+
To create inline comments, use `mcp__github_inline_comment__create_inline_comment` tool.
|
|
101
|
+
|
|
102
|
+
Source of Truth and Decision Rules:
|
|
103
|
+
- The guidelines in CLAUDE.md are the highest priority and always authoritative for naming and coding conventions.
|
|
104
|
+
- Existing codebase patterns must not override the guidelines.
|
|
105
|
+
- If a pattern in the PR violates the guidelines, suggest correcting the code, even if the same pattern exists elsewhere in the codebase.
|
|
106
|
+
- If a pattern in the PR does NOT violate the guidelines and is repeatedly used in multiple places in the existing codebase but is not documented in CLAUDE.md, create an inline comment stating that the guideline is missing or incomplete.
|
|
107
|
+
- Do not suggest changing or relaxing the guidelines based on existing code.
|
|
108
|
+
- Do not invent new rules beyond what is defined in CLAUDE.md.
|
|
109
|
+
|
|
110
|
+
Guidelines:
|
|
111
|
+
- Focus on actionable feedback related to naming conventions (violations or guideline gaps).
|
|
112
|
+
- Be concise and direct
|
|
113
|
+
- Create inline comments for specific code issues
|
|
114
|
+
- Review comment should provide appropriate naming suggestions.
|
|
115
|
+
|
|
116
|
+
claude_args: |
|
|
117
|
+
--allowed-tools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*), Bash(gh pr diff:*), Bash(gh pr view:*)"
|
|
118
|
+
--model claude-haiku-4-5-20251001
|
|
119
|
+
--system-prompt "As a software engineer with complete knowledge of the codebase, you are reviewing a pull request."
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
name: Senior Software Engineer Code Review
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
issue_comment:
|
|
5
|
+
types: [created]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
claude:
|
|
9
|
+
if: |
|
|
10
|
+
github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude') && !contains(github.event.comment.body, '@claude-inline') && (github.event.comment.user.login == 'manufac-nmohan' || github.event.comment.user.login == 'manufac-nrawat')
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
permissions:
|
|
13
|
+
contents: write
|
|
14
|
+
pull-requests: write
|
|
15
|
+
issues: write
|
|
16
|
+
id-token: write
|
|
17
|
+
actions: read # Required for Claude to read CI results on PRs
|
|
18
|
+
steps:
|
|
19
|
+
- name: Set PR/Issue number and ref
|
|
20
|
+
id: pr-info
|
|
21
|
+
run: |
|
|
22
|
+
ISSUE_NUM=${{ github.event.issue.number }}
|
|
23
|
+
echo "issue_number=$ISSUE_NUM" >> $GITHUB_OUTPUT
|
|
24
|
+
|
|
25
|
+
# Check if this is a PR comment by checking if pull_request field exists
|
|
26
|
+
HAS_PR_FIELD=$(gh api repos/${{ github.repository }}/issues/$ISSUE_NUM --jq '.pull_request != null')
|
|
27
|
+
|
|
28
|
+
if [ "$HAS_PR_FIELD" == "true" ]; then
|
|
29
|
+
PR_NUM=$ISSUE_NUM
|
|
30
|
+
echo "pr_number=$PR_NUM" >> $GITHUB_OUTPUT
|
|
31
|
+
echo "pr_ref=refs/pull/$PR_NUM/merge" >> $GITHUB_OUTPUT
|
|
32
|
+
COMMIT_SHA=$(gh api repos/${{ github.repository }}/pulls/$PR_NUM --jq '.head.sha')
|
|
33
|
+
echo "commit_sha=$COMMIT_SHA" >> $GITHUB_OUTPUT
|
|
34
|
+
echo "is_pr=true" >> $GITHUB_OUTPUT
|
|
35
|
+
else
|
|
36
|
+
echo "is_pr=false" >> $GITHUB_OUTPUT
|
|
37
|
+
echo "pr_ref=${{ github.ref }}" >> $GITHUB_OUTPUT
|
|
38
|
+
echo "commit_sha=${{ github.sha }}" >> $GITHUB_OUTPUT
|
|
39
|
+
fi
|
|
40
|
+
env:
|
|
41
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
42
|
+
|
|
43
|
+
- name: Checkout repository
|
|
44
|
+
uses: actions/checkout@v5
|
|
45
|
+
with:
|
|
46
|
+
ref: ${{ steps.pr-info.outputs.pr_ref }}
|
|
47
|
+
fetch-depth: 0
|
|
48
|
+
|
|
49
|
+
- name: Run Claude Code
|
|
50
|
+
id: claude
|
|
51
|
+
uses: anthropics/claude-code-action@v1
|
|
52
|
+
with:
|
|
53
|
+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
|
54
|
+
|
|
55
|
+
claude_args: |
|
|
56
|
+
--model claude-sonnet-4-5-20250929
|
|
57
|
+
--allowed-tools "Bash(gh api:*),Write"
|
|
58
|
+
--system-prompt "As a senior software engineer with complete knowledge of the codebase and project requirements, you are reviewing a pull request."
|
|
59
|
+
prompt: |
|
|
60
|
+
REPO: ${{ github.repository }}
|
|
61
|
+
ISSUE NUMBER: ${{ steps.pr-info.outputs.issue_number }}
|
|
62
|
+
IS PR: ${{ steps.pr-info.outputs.is_pr }}
|
|
63
|
+
PR NUMBER: ${{ steps.pr-info.outputs.pr_number }}
|
|
64
|
+
COMMIT SHA: ${{ steps.pr-info.outputs.commit_sha }}
|
|
65
|
+
|
|
66
|
+
## STEP 1: GATHER CONTEXT
|
|
67
|
+
|
|
68
|
+
1. Fetch PR files and diff:
|
|
69
|
+
`gh api /repos/${{ github.repository }}/pulls/${{ steps.pr-info.outputs.pr_number }}/files`
|
|
70
|
+
|
|
71
|
+
2. Retrieve existing comments to avoid duplication:
|
|
72
|
+
`gh api /repos/${{ github.repository }}/issues/${{ steps.pr-info.outputs.issue_number }}/comments`
|
|
73
|
+
|
|
74
|
+
3. Get PR description and metadata:
|
|
75
|
+
`gh api /repos/${{ github.repository }}/pulls/${{ steps.pr-info.outputs.pr_number }}`
|
|
76
|
+
|
|
77
|
+
## STEP 2: DEEP ANALYSIS
|
|
78
|
+
|
|
79
|
+
Analyze the changes focusing on:
|
|
80
|
+
|
|
81
|
+
**Architecture & Design:**
|
|
82
|
+
- Does this change align with existing architectural patterns?
|
|
83
|
+
- Are there any design anti-patterns or code smells?
|
|
84
|
+
- Could this be implemented more elegantly or maintainably?
|
|
85
|
+
|
|
86
|
+
**Integration Impact:**
|
|
87
|
+
- How do these changes affect existing modules and their contracts?
|
|
88
|
+
- Are there potential breaking changes or backward compatibility issues?
|
|
89
|
+
- What are the ripple effects on dependent code?
|
|
90
|
+
|
|
91
|
+
**Performance & Scalability:**
|
|
92
|
+
- Are there performance bottlenecks (O(n²) algorithms, N+1 queries, etc.)?
|
|
93
|
+
- How will this behave under load or with large datasets?
|
|
94
|
+
- Are there memory leak risks or resource management issues?
|
|
95
|
+
|
|
96
|
+
**Security & Reliability:**
|
|
97
|
+
- Are there security vulnerabilities (injection, XSS, authentication issues)?
|
|
98
|
+
- Is error handling robust and comprehensive?
|
|
99
|
+
- Are edge cases and failure scenarios handled?
|
|
100
|
+
|
|
101
|
+
**Code Quality:**
|
|
102
|
+
- Is the code testable? Are tests adequate?
|
|
103
|
+
- Is naming clear and consistent with the codebase?
|
|
104
|
+
- Are there opportunities for code reuse or consolidation?
|
|
105
|
+
|
|
106
|
+
## STEP 3: VERIFY PREVIOUS FEEDBACK
|
|
107
|
+
|
|
108
|
+
- Check if existing review comments have been addressed
|
|
109
|
+
- Verify that suggested changes were implemented correctly
|
|
110
|
+
- Confirm that discussions have been resolved appropriately
|
|
111
|
+
|
|
112
|
+
## STEP 4: POST REVIEW COMMENT
|
|
113
|
+
|
|
114
|
+
Format your review as a structured comment and post it:
|
|
115
|
+
```
|
|
116
|
+
gh api POST /repos/${{ github.repository }}/issues/${{ steps.pr-info.outputs.issue_number }}/comments -f body="[Your formatted review]"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## COMMENT FORMATTING GUIDELINES
|
|
120
|
+
|
|
121
|
+
**Structure your comment as:**
|
|
122
|
+
|
|
123
|
+
### 🎯 Summary
|
|
124
|
+
[2-3 sentence overview of the changes and overall assessment]
|
|
125
|
+
|
|
126
|
+
### ✅ Strengths
|
|
127
|
+
[Highlight what was done well - be specific]
|
|
128
|
+
|
|
129
|
+
### ⚠️ Critical Issues
|
|
130
|
+
[Issues that must be fixed before merge - include specific solutions]
|
|
131
|
+
|
|
132
|
+
### 💡 Suggestions
|
|
133
|
+
[Optional improvements with code examples where helpful]
|
|
134
|
+
|
|
135
|
+
### 📊 Impact Assessment
|
|
136
|
+
- **Functionality**: [How this affects existing features]
|
|
137
|
+
- **Performance**: [Expected performance impact]
|
|
138
|
+
- **Maintainability**: [Long-term maintenance considerations]
|
|
139
|
+
|
|
140
|
+
**Writing Style:**
|
|
141
|
+
- Be specific: Reference exact files, line numbers, and function names
|
|
142
|
+
- Be prescriptive: Provide concrete solutions, not just questions
|
|
143
|
+
- Be concise: Every sentence should add value
|
|
144
|
+
- Be constructive: Frame feedback as opportunities for improvement
|
|
145
|
+
- Use code snippets to illustrate better approaches
|
|
146
|
+
|
|
147
|
+
**Prioritization:**
|
|
148
|
+
- Focus on high-impact issues first
|
|
149
|
+
- Don't nitpick trivial style issues if there are bigger concerns
|
|
150
|
+
- Group related feedback together
|
|
151
|
+
|
|
152
|
+
## IMPORTANT CONSTRAINTS
|
|
153
|
+
|
|
154
|
+
- You MUST post your review as a GitHub comment, not just a job summary
|
|
155
|
+
- If no significant issues found, still provide a brief positive review
|
|
156
|
+
- Don't duplicate feedback already given in existing comments
|
|
157
|
+
- Tailor depth of review to the size/complexity of the PR
|
|
158
|
+
- For large PRs, focus on architectural concerns over line-by-line details
|
|
159
|
+
|
|
160
|
+
Begin your review now by fetching the necessary information.
|
package/.prettierrc.mjs
ADDED
package/Readme.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# sculptor
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: Claude Feedback Collector
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
issue_comment:
|
|
5
|
+
types: [created]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
collect-feedback:
|
|
9
|
+
if: >
|
|
10
|
+
github.event.issue.pull_request != null &&
|
|
11
|
+
contains(github.event.comment.body, '@claude-feedback')
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- name: Create feedback issue with diff permalink
|
|
15
|
+
env:
|
|
16
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
17
|
+
run: |
|
|
18
|
+
REPO="${{ github.repository }}"
|
|
19
|
+
PR_NUMBER="${{ github.event.issue.number }}"
|
|
20
|
+
|
|
21
|
+
PR_JSON=$(gh pr view "$PR_NUMBER" --repo "$REPO" --json headRefOid)
|
|
22
|
+
COMMIT_SHA=$(echo "$PR_JSON" | jq -r '.headRefOid')
|
|
23
|
+
|
|
24
|
+
DIFF_URL="https://github.com/${REPO}/pull/${PR_NUMBER}/files?diff=unified&sha=${COMMIT_SHA}"
|
|
25
|
+
FEEDBACK_REPO="manufac-analytics/sculptor"
|
|
26
|
+
|
|
27
|
+
gh issue create \
|
|
28
|
+
--repo "$FEEDBACK_REPO" \
|
|
29
|
+
--title "Claude feedback - PR #${PR_NUMBER}" \
|
|
30
|
+
--body "$(cat <<EOF
|
|
31
|
+
## Trigger
|
|
32
|
+
@claude-feedback mentioned in PR comment.
|
|
33
|
+
|
|
34
|
+
## PR Context
|
|
35
|
+
- Repository: ${REPO}
|
|
36
|
+
- PR: #${PR_NUMBER}
|
|
37
|
+
- Commit SHA: ${COMMIT_SHA}
|
|
38
|
+
|
|
39
|
+
## Diff (Permalink)
|
|
40
|
+
${DIFF_URL}
|
|
41
|
+
|
|
42
|
+
## Comment
|
|
43
|
+
Author: @${{ github.event.comment.user.login }}
|
|
44
|
+
URL: ${{ github.event.comment.html_url }}
|
|
45
|
+
|
|
46
|
+
\`\`\`
|
|
47
|
+
${{ github.event.comment.body }}
|
|
48
|
+
\`\`\`
|
|
49
|
+
EOF
|
|
50
|
+
)"
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
name: Software Engineer Code Review
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened] # Trigger when a PR is created
|
|
6
|
+
issue_comment:
|
|
7
|
+
types: [created] # Trigger when a comment is created
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
claude-review:
|
|
11
|
+
if: |
|
|
12
|
+
(github.event_name == 'pull_request') ||
|
|
13
|
+
(github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, '@claude-inline'))
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
pull-requests: write
|
|
18
|
+
issues: read
|
|
19
|
+
id-token: write
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- name: Set PR number and ref
|
|
23
|
+
id: pr-info
|
|
24
|
+
run: |
|
|
25
|
+
if [ "${{ github.event_name }}" == "pull_request" ]; then
|
|
26
|
+
echo "pr_number=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
|
|
27
|
+
echo "pr_ref=refs/pull/${{ github.event.pull_request.number }}/merge" >> $GITHUB_OUTPUT
|
|
28
|
+
echo "commit_sha=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
|
|
29
|
+
else
|
|
30
|
+
PR_NUM=${{ github.event.issue.number }}
|
|
31
|
+
echo "pr_number=$PR_NUM" >> $GITHUB_OUTPUT
|
|
32
|
+
echo "pr_ref=refs/pull/$PR_NUM/merge" >> $GITHUB_OUTPUT
|
|
33
|
+
# Use gh api instead of gh pr view to avoid git dependency
|
|
34
|
+
COMMIT_SHA=$(gh api repos/${{ github.repository }}/pulls/$PR_NUM --jq '.head.sha')
|
|
35
|
+
echo "commit_sha=$COMMIT_SHA" >> $GITHUB_OUTPUT
|
|
36
|
+
fi
|
|
37
|
+
env:
|
|
38
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
39
|
+
|
|
40
|
+
- name: Checkout PR code
|
|
41
|
+
uses: actions/checkout@v4
|
|
42
|
+
with:
|
|
43
|
+
ref: ${{ steps.pr-info.outputs.pr_ref }}
|
|
44
|
+
fetch-depth: 0
|
|
45
|
+
|
|
46
|
+
- name: Run Claude Code Review for functional issues
|
|
47
|
+
id: claude-review-functional
|
|
48
|
+
uses: anthropics/claude-code-action@v1
|
|
49
|
+
with:
|
|
50
|
+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
|
51
|
+
|
|
52
|
+
prompt: |
|
|
53
|
+
REPO: ${{ github.repository }}
|
|
54
|
+
PR NUMBER: ${{ steps.pr-info.outputs.pr_number }}
|
|
55
|
+
COMMIT SHA: ${{ steps.pr-info.outputs.commit_sha }}
|
|
56
|
+
|
|
57
|
+
Provide inline code review comments only on lines modified in the PR diff. Do not create comments on lines that are not modified.
|
|
58
|
+
|
|
59
|
+
Review Process:
|
|
60
|
+
1. Use `gh pr diff ${{ steps.pr-info.outputs.pr_number }}` to analyze all changes in the PR
|
|
61
|
+
2. For each issue you find (bugs, performance issues, security issues), collect them to create inline comments
|
|
62
|
+
|
|
63
|
+
To create inline comments, use `mcp__github_inline_comment__create_inline_comment` tool. :
|
|
64
|
+
|
|
65
|
+
Guidelines:
|
|
66
|
+
- Focus on actionable feedback: bugs, performance, security
|
|
67
|
+
- Be concise and direct
|
|
68
|
+
- Create inline comments for specific code issues
|
|
69
|
+
- Do not provide appreciation comments like "Good use of the const + type pattern per CLAUDE.md Form Utils Typings section. The as const combined with type extraction provides both literal inference and type safety. Consider adding satisfies Record<string, number> for additional compile-time validation: export const RecognitionStatus = { ... } as const satisfies Record<string, number>;"
|
|
70
|
+
- Review comment should provide a direct solution or guide the implementor in direction of the solution rather than open ended questions.
|
|
71
|
+
|
|
72
|
+
claude_args: |
|
|
73
|
+
--allowed-tools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*), Bash(gh pr diff:*), Bash(gh pr view:*)"
|
|
74
|
+
--model claude-haiku-4-5-20251001
|
|
75
|
+
--system-prompt "As a software engineer with complete knowledge of the codebase, you are reviewing a pull request."
|
|
76
|
+
|
|
77
|
+
- name: Run Claude Code Review for semantic and convention analysis
|
|
78
|
+
id: claude-review-semantic
|
|
79
|
+
uses: anthropics/claude-code-action@v1
|
|
80
|
+
with:
|
|
81
|
+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
|
82
|
+
|
|
83
|
+
prompt: |
|
|
84
|
+
REPO: ${{ github.repository }}
|
|
85
|
+
PR NUMBER: ${{ steps.pr-info.outputs.pr_number }}
|
|
86
|
+
COMMIT SHA: ${{ steps.pr-info.outputs.commit_sha }}
|
|
87
|
+
|
|
88
|
+
Provide inline code review comments only on lines modified in the PR diff. Do not create comments on lines that are not modified.
|
|
89
|
+
|
|
90
|
+
Review Process:
|
|
91
|
+
1. Use `gh pr diff ${{ steps.pr-info.outputs.pr_number }}` to analyze all changes in the PR
|
|
92
|
+
2. Follow the repository's CLAUDE.md:
|
|
93
|
+
- `Variable naming guidelines` section for variable naming conventions.
|
|
94
|
+
- `Types naming conventions` section for type naming conventions.
|
|
95
|
+
- `File naming conventions` section for file naming conventions.
|
|
96
|
+
- `Coding conventions guidelines` section for coding conventions.
|
|
97
|
+
|
|
98
|
+
3. Do not deviate from the guidelines in CLAUDE.md.
|
|
99
|
+
|
|
100
|
+
To create inline comments, use `mcp__github_inline_comment__create_inline_comment` tool.
|
|
101
|
+
|
|
102
|
+
Source of Truth and Decision Rules:
|
|
103
|
+
- The guidelines in CLAUDE.md are the highest priority and always authoritative for naming and coding conventions.
|
|
104
|
+
- Existing codebase patterns must not override the guidelines.
|
|
105
|
+
- If a pattern in the PR violates the guidelines, suggest correcting the code, even if the same pattern exists elsewhere in the codebase.
|
|
106
|
+
- If a pattern in the PR does NOT violate the guidelines and is repeatedly used in multiple places in the existing codebase but is not documented in CLAUDE.md, create an inline comment stating that the guideline is missing or incomplete.
|
|
107
|
+
- Do not suggest changing or relaxing the guidelines based on existing code.
|
|
108
|
+
- Do not invent new rules beyond what is defined in CLAUDE.md.
|
|
109
|
+
|
|
110
|
+
Guidelines:
|
|
111
|
+
- Focus on actionable feedback related to naming conventions (violations or guideline gaps).
|
|
112
|
+
- Be concise and direct
|
|
113
|
+
- Create inline comments for specific code issues
|
|
114
|
+
- Review comment should provide appropriate naming suggestions.
|
|
115
|
+
|
|
116
|
+
claude_args: |
|
|
117
|
+
--allowed-tools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*), Bash(gh pr diff:*), Bash(gh pr view:*)"
|
|
118
|
+
--model claude-haiku-4-5-20251001
|
|
119
|
+
--system-prompt "As a software engineer with complete knowledge of the codebase, you are reviewing a pull request."
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
name: Senior Software Engineer Code Review
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
issue_comment:
|
|
5
|
+
types: [created]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
claude:
|
|
9
|
+
if: |
|
|
10
|
+
github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude') && !contains(github.event.comment.body, '@claude-inline') && (github.event.comment.user.login == 'manufac-nmohan' || github.event.comment.user.login == 'manufac-nrawat')
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
permissions:
|
|
13
|
+
contents: write
|
|
14
|
+
pull-requests: write
|
|
15
|
+
issues: write
|
|
16
|
+
id-token: write
|
|
17
|
+
actions: read # Required for Claude to read CI results on PRs
|
|
18
|
+
steps:
|
|
19
|
+
- name: Set PR/Issue number and ref
|
|
20
|
+
id: pr-info
|
|
21
|
+
run: |
|
|
22
|
+
ISSUE_NUM=${{ github.event.issue.number }}
|
|
23
|
+
echo "issue_number=$ISSUE_NUM" >> $GITHUB_OUTPUT
|
|
24
|
+
|
|
25
|
+
# Check if this is a PR comment by checking if pull_request field exists
|
|
26
|
+
HAS_PR_FIELD=$(gh api repos/${{ github.repository }}/issues/$ISSUE_NUM --jq '.pull_request != null')
|
|
27
|
+
|
|
28
|
+
if [ "$HAS_PR_FIELD" == "true" ]; then
|
|
29
|
+
PR_NUM=$ISSUE_NUM
|
|
30
|
+
echo "pr_number=$PR_NUM" >> $GITHUB_OUTPUT
|
|
31
|
+
echo "pr_ref=refs/pull/$PR_NUM/merge" >> $GITHUB_OUTPUT
|
|
32
|
+
COMMIT_SHA=$(gh api repos/${{ github.repository }}/pulls/$PR_NUM --jq '.head.sha')
|
|
33
|
+
echo "commit_sha=$COMMIT_SHA" >> $GITHUB_OUTPUT
|
|
34
|
+
echo "is_pr=true" >> $GITHUB_OUTPUT
|
|
35
|
+
else
|
|
36
|
+
echo "is_pr=false" >> $GITHUB_OUTPUT
|
|
37
|
+
echo "pr_ref=${{ github.ref }}" >> $GITHUB_OUTPUT
|
|
38
|
+
echo "commit_sha=${{ github.sha }}" >> $GITHUB_OUTPUT
|
|
39
|
+
fi
|
|
40
|
+
env:
|
|
41
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
42
|
+
|
|
43
|
+
- name: Checkout repository
|
|
44
|
+
uses: actions/checkout@v5
|
|
45
|
+
with:
|
|
46
|
+
ref: ${{ steps.pr-info.outputs.pr_ref }}
|
|
47
|
+
fetch-depth: 0
|
|
48
|
+
|
|
49
|
+
- name: Run Claude Code
|
|
50
|
+
id: claude
|
|
51
|
+
uses: anthropics/claude-code-action@v1
|
|
52
|
+
with:
|
|
53
|
+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
|
54
|
+
|
|
55
|
+
claude_args: |
|
|
56
|
+
--model claude-sonnet-4-5-20250929
|
|
57
|
+
--allowed-tools "Bash(gh api:*),Write"
|
|
58
|
+
--system-prompt "As a senior software engineer with complete knowledge of the codebase and project requirements, you are reviewing a pull request."
|
|
59
|
+
prompt: |
|
|
60
|
+
REPO: ${{ github.repository }}
|
|
61
|
+
ISSUE NUMBER: ${{ steps.pr-info.outputs.issue_number }}
|
|
62
|
+
IS PR: ${{ steps.pr-info.outputs.is_pr }}
|
|
63
|
+
PR NUMBER: ${{ steps.pr-info.outputs.pr_number }}
|
|
64
|
+
COMMIT SHA: ${{ steps.pr-info.outputs.commit_sha }}
|
|
65
|
+
|
|
66
|
+
## STEP 1: GATHER CONTEXT
|
|
67
|
+
|
|
68
|
+
1. Fetch PR files and diff:
|
|
69
|
+
`gh api /repos/${{ github.repository }}/pulls/${{ steps.pr-info.outputs.pr_number }}/files`
|
|
70
|
+
|
|
71
|
+
2. Retrieve existing comments to avoid duplication:
|
|
72
|
+
`gh api /repos/${{ github.repository }}/issues/${{ steps.pr-info.outputs.issue_number }}/comments`
|
|
73
|
+
|
|
74
|
+
3. Get PR description and metadata:
|
|
75
|
+
`gh api /repos/${{ github.repository }}/pulls/${{ steps.pr-info.outputs.pr_number }}`
|
|
76
|
+
|
|
77
|
+
## STEP 2: DEEP ANALYSIS
|
|
78
|
+
|
|
79
|
+
Analyze the changes focusing on:
|
|
80
|
+
|
|
81
|
+
**Architecture & Design:**
|
|
82
|
+
- Does this change align with existing architectural patterns?
|
|
83
|
+
- Are there any design anti-patterns or code smells?
|
|
84
|
+
- Could this be implemented more elegantly or maintainably?
|
|
85
|
+
|
|
86
|
+
**Integration Impact:**
|
|
87
|
+
- How do these changes affect existing modules and their contracts?
|
|
88
|
+
- Are there potential breaking changes or backward compatibility issues?
|
|
89
|
+
- What are the ripple effects on dependent code?
|
|
90
|
+
|
|
91
|
+
**Performance & Scalability:**
|
|
92
|
+
- Are there performance bottlenecks (O(n²) algorithms, N+1 queries, etc.)?
|
|
93
|
+
- How will this behave under load or with large datasets?
|
|
94
|
+
- Are there memory leak risks or resource management issues?
|
|
95
|
+
|
|
96
|
+
**Security & Reliability:**
|
|
97
|
+
- Are there security vulnerabilities (injection, XSS, authentication issues)?
|
|
98
|
+
- Is error handling robust and comprehensive?
|
|
99
|
+
- Are edge cases and failure scenarios handled?
|
|
100
|
+
|
|
101
|
+
**Code Quality:**
|
|
102
|
+
- Is the code testable? Are tests adequate?
|
|
103
|
+
- Is naming clear and consistent with the codebase?
|
|
104
|
+
- Are there opportunities for code reuse or consolidation?
|
|
105
|
+
|
|
106
|
+
## STEP 3: VERIFY PREVIOUS FEEDBACK
|
|
107
|
+
|
|
108
|
+
- Check if existing review comments have been addressed
|
|
109
|
+
- Verify that suggested changes were implemented correctly
|
|
110
|
+
- Confirm that discussions have been resolved appropriately
|
|
111
|
+
|
|
112
|
+
## STEP 4: POST REVIEW COMMENT
|
|
113
|
+
|
|
114
|
+
Format your review as a structured comment and post it:
|
|
115
|
+
```
|
|
116
|
+
gh api POST /repos/${{ github.repository }}/issues/${{ steps.pr-info.outputs.issue_number }}/comments -f body="[Your formatted review]"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## COMMENT FORMATTING GUIDELINES
|
|
120
|
+
|
|
121
|
+
**Structure your comment as:**
|
|
122
|
+
|
|
123
|
+
### 🎯 Summary
|
|
124
|
+
[2-3 sentence overview of the changes and overall assessment]
|
|
125
|
+
|
|
126
|
+
### ✅ Strengths
|
|
127
|
+
[Highlight what was done well - be specific]
|
|
128
|
+
|
|
129
|
+
### ⚠️ Critical Issues
|
|
130
|
+
[Issues that must be fixed before merge - include specific solutions]
|
|
131
|
+
|
|
132
|
+
### 💡 Suggestions
|
|
133
|
+
[Optional improvements with code examples where helpful]
|
|
134
|
+
|
|
135
|
+
### 📊 Impact Assessment
|
|
136
|
+
- **Functionality**: [How this affects existing features]
|
|
137
|
+
- **Performance**: [Expected performance impact]
|
|
138
|
+
- **Maintainability**: [Long-term maintenance considerations]
|
|
139
|
+
|
|
140
|
+
**Writing Style:**
|
|
141
|
+
- Be specific: Reference exact files, line numbers, and function names
|
|
142
|
+
- Be prescriptive: Provide concrete solutions, not just questions
|
|
143
|
+
- Be concise: Every sentence should add value
|
|
144
|
+
- Be constructive: Frame feedback as opportunities for improvement
|
|
145
|
+
- Use code snippets to illustrate better approaches
|
|
146
|
+
|
|
147
|
+
**Prioritization:**
|
|
148
|
+
- Focus on high-impact issues first
|
|
149
|
+
- Don't nitpick trivial style issues if there are bigger concerns
|
|
150
|
+
- Group related feedback together
|
|
151
|
+
|
|
152
|
+
## IMPORTANT CONSTRAINTS
|
|
153
|
+
|
|
154
|
+
- You MUST post your review as a GitHub comment, not just a job summary
|
|
155
|
+
- If no significant issues found, still provide a brief positive review
|
|
156
|
+
- Don't duplicate feedback already given in existing comments
|
|
157
|
+
- Tailor depth of review to the size/complexity of the PR
|
|
158
|
+
- For large PRs, focus on architectural concerns over line-by-line details
|
|
159
|
+
|
|
160
|
+
Begin your review now by fetching the necessary information.
|