Skip to content

Commit 5fd289d

Browse files
authored
chores: add Claude slash command for func pr (knative#3315)
Add Claude code slash command for PR description generation that analyzes commits since main branch divergence and formats them according to Knative func PR template, including change categorization, issue linking, and release notes. Move CLAUDE.md to .claude/CLAUDE.md to align with Claude Code conventions. Signed-off-by: Stanislav Jakuschevskij <[email protected]>
1 parent 072932b commit 5fd289d

File tree

3 files changed

+108
-0
lines changed

3 files changed

+108
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
allowed-tools: Bash(git log:*), Bash(git diff:*)
3+
description: Create a pull request description for Knative func
4+
---
5+
6+
# Knative Func PR Guidelines
7+
8+
Analyze the git commits on the current branch since it diverged from the main branch and create a pull request description following the Knative func PR template below.
9+
10+
## Steps
11+
12+
1. Run `git log main..HEAD` to get all commits on this branch.
13+
2. Run `git diff main...HEAD --stat` to understand the scope of changes.
14+
3. Analyze the commits to determine:
15+
- What changes were made => extract from commit messages.
16+
- The /kind label => bug, enhancement, cleanup, documentation, etc..
17+
- Any issue numbers referenced in commits (for "Fixes #").
18+
- Whether changes are user-facing (for release notes).
19+
20+
4. Format the PR description using the template in `.github/pull-request-template.md` and do the following:
21+
- Add a PR title in a comment above `# Changes` like so: `<!-- PR Title: <pull-request-title> -->`.
22+
- Use correct English capitalization and grammar for the PR title.
23+
- Replace `<pull-request-title>` with the actual title.
24+
- Update the "Changes" section with bullet points using appropriate emoji: :gift: :bug: :broom: :wastebasket:.
25+
- Add a /kind label
26+
- Add "Fixes #" if issue is referenced or "Relates to #" if issue is not supposed to be closed by this PR.
27+
- Fill in the "Release Note" if the changes are user-facing otherwise leave it empty.
28+
- Leave docs section as is.
29+
- Remove the comments from the final PR description except the comment with the PR title: `<!-- PR Title: ...`.
30+
31+
5. Write the PR description in a file in `./.claude/pr/<pull-request-name>.md` for review and:
32+
- Create the directory if it does not exist.
33+
- Replace `<pull-request-name>` in the filename with a short, descriptive pull request name.

.github/pull-request-template.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<!-- Thanks for sending a pull request! -->
2+
3+
<!--
4+
Are you using Knative? If you do, we would love to know!
5+
https://github.com/knative/community/issues/new?template=ADOPTERS.yaml&title=%5BADOPTERS%5D%3A+%24%7BCOMPANY+NAME+HERE%7D
6+
-->
7+
8+
# Changes
9+
10+
<!--
11+
Describe your changes here- ideally you can get that description straight from
12+
your descriptive commit message(s)!
13+
14+
- :gift: Add new feature
15+
- :bug: Fix bug
16+
- :broom: Update or clean up current behavior
17+
- :wastebasket: Remove feature or internal logic
18+
-->
19+
20+
-
21+
-
22+
-
23+
24+
<!--
25+
In addition, categorize the changes you're making using the "/kind" Prow command, example:
26+
27+
/kind <kind>
28+
29+
Supported kinds are: api-change, bug, cleanup, deprecation, removal, documentation, enhancement, performance
30+
31+
-->
32+
/kind <kind>
33+
34+
<!--
35+
*Automatically closes linked issue when PR is merged.
36+
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`, or Relates to #<issue number>.
37+
_If PR is about `failing-tests or flakes`, please post the related issues/tests in a comment and do not use `Fixes`_*
38+
-->
39+
Fixes #
40+
41+
<!-- Please include the 'why' behind your changes if no issue exists -->
42+
43+
**Release Note**
44+
45+
<!--
46+
:page_facing_up: If this change has user-visible impact, write a release note in the block
47+
below. Include the string "action required" if additional action is required of
48+
users switching to the new release, for example in case of a breaking change.
49+
50+
Write as if you are speaking to users, not other Knative contributors. If this
51+
change has no user-visible impact, no release-note is needed.
52+
-->
53+
```release-note
54+
55+
```
56+
57+
**Docs**
58+
59+
<!--
60+
:book: If this change has user-visible impact, link to an issue or PR in
61+
https://github.com/knative/docs.
62+
63+
See here for guidance on getting permanent links to files: https://help.github.com/en/articles/getting-permanent-links-to-files
64+
65+
Please use the following format for linking documentation:
66+
- [knative/docs]: <issue or pr link>
67+
- [Feature Track]: <link>
68+
- [Usage]: <link>
69+
- [Other doc]: <link>
70+
-->
71+
```docs
72+
73+
```

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ __pycache__
3434
# AI
3535
AGENTS.override.md
3636
.claude/*.local.*
37+
.claude/pr/*
3738

3839
# E2E Tests
3940
/e2e/testdata/default_home/go
@@ -49,3 +50,4 @@ AGENTS.override.md
4950
# TODO: Update this test to be from a temp directory with a hard-coded impl:
5051
# https://github.com/knative/func/issues/3196
5152
/pkg/builders/testdata/go-fn-with-private-deps/.s2i
53+

0 commit comments

Comments
 (0)