-
Notifications
You must be signed in to change notification settings - Fork 1
chore: Add CLAUDE.md and commit-msg hook #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+81
−0
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # CLAUDE.md - Kagenti Automation Repository | ||
|
|
||
| ## DCO Sign-Off (Mandatory) | ||
|
|
||
| All commits **must** include a `Signed-off-by` trailer (Developer Certificate of Origin). | ||
| Always use the `-s` flag when committing: | ||
|
|
||
| ```sh | ||
| git commit -s -m "feat: Add new feature" | ||
| ``` | ||
|
|
||
| This adds a line like `Signed-off-by: Your Name <your@email.com>` to the commit message. | ||
| PRs without DCO sign-off will fail CI checks. To retroactively sign-off existing commits: | ||
|
|
||
| ```sh | ||
| git rebase --signoff main | ||
| ``` | ||
|
|
||
| ## Commit Attribution Policy | ||
|
|
||
| When creating git commits, do NOT use `Co-Authored-By` trailers for AI attribution. | ||
| Instead, use `Assisted-By` to acknowledge AI assistance without inflating contributor stats: | ||
|
|
||
| Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> | ||
|
|
||
| Never add `Co-authored-by`, `Made-with`, or similar trailers that GitHub parses as co-authorship. | ||
|
|
||
| A `commit-msg` hook in `scripts/hooks/commit-msg` enforces this automatically. | ||
| Install it by configuring the hooks path: | ||
|
|
||
| ```sh | ||
| git config core.hooksPath scripts/hooks | ||
| ``` | ||
|
|
||
| ## PR Description Attribution | ||
|
|
||
| When generating PR descriptions, summaries, or any PR metadata, use | ||
| `Assisted-By: Claude Code` — never `Generated by Claude Code` or similar phrasing. | ||
| The work is the developer's; Claude Code assists. This differs from the commit | ||
| trailer format (`Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>`) | ||
| because PR body text is human-readable and doesn't need the email for git tooling. | ||
| This applies to: | ||
|
|
||
| - PR body text (e.g., the footer line) | ||
| - Commit message trailers referenced in PR descriptions | ||
| - Any auto-generated changelogs or release notes | ||
|
|
||
| ## Scope Discipline | ||
|
|
||
| Only commit files directly related to the PR's stated purpose. Do not bundle | ||
| unrelated changes (tooling, configs, hooks, formatting) into a PR unless the | ||
| PR is explicitly for that purpose. If a prerequisite change is needed, open a | ||
| separate PR for it first. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| COMMIT_MSG_FILE="$1" | ||
| TEMP_FILE=$(mktemp) | ||
|
|
||
| # Check if any AI co-author trailers exist before stripping | ||
| HAS_AI_TRAILER=false | ||
| if grep -qi -E '^Co-authored-by:.*(Claude|Cursor|anthropic)' "$COMMIT_MSG_FILE"; then | ||
| HAS_AI_TRAILER=true | ||
| fi | ||
|
|
||
| # Strip Co-authored-by lines for Claude/Cursor and Made-with lines | ||
| grep -vi -E '^Co-authored-by:.*(Claude|Cursor|anthropic|cursor)' "$COMMIT_MSG_FILE" \ | ||
| | grep -vi '^Made-with:' \ | ||
| > "$TEMP_FILE" || true | ||
|
|
||
| # Remove trailing blank lines (awk is portable across macOS/Linux unlike sed labels) | ||
| awk '/^[[:space:]]*$/{buf=buf $0 ORS; next} {if(buf) printf "%s",buf; buf=""; print}' "$TEMP_FILE" > "$COMMIT_MSG_FILE" | ||
|
|
||
| # If AI trailers were present, add Assisted-By instead | ||
| if [ "$HAS_AI_TRAILER" = true ]; then | ||
| # Ensure there's a blank line before the trailer | ||
| echo "" >> "$COMMIT_MSG_FILE" | ||
| echo "Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>" >> "$COMMIT_MSG_FILE" | ||
| fi | ||
|
|
||
| rm -f "$TEMP_FILE" | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: This line uses
Claude (Anthropic AI)but the commit that introduces this PR usesClaude Opus 4.6as theAssisted-Byvalue.CLAUDE.md(line 24) documentsClaude (Anthropic AI) <noreply@anthropic.com>as the canonical form — the hook is correct, but the introducing commit itself doesn't follow it. Consider amending to match.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair call out. The
Assisted-By: Claude Opus 4.6 <noreply@anthropic.com>is due to my own local hooks. I will modify the local ones to match the CLAUDE.md one so that the trailers are not tied to a particular model for future commits.