name: commit-message description: >- Generate a conventional commit message for tekton-pruner. Use when the user asks to "create a commit", "generate commit message", "commit changes", "make a commit", mentions "conventional commits", or discusses commit message formatting. Provides guided workflow for creating properly formatted commit messages with line length validation and required trailers. version: 0.1.0 license: Apache-2.0 metadata: project: tekton-pruner allowed-tools: Bash(git diff:) Bash(git status:) Bash(git log:) Bash(git config:) Read
Conventional Commit Message Creation
Create properly formatted conventional commit messages following project standards with line length validation and required trailers.
Purpose
Generate commit messages that:
- Follow conventional commits format (
type(scope): description) - Use component names from changed file paths as scope
- Respect line length limits (50 for subject, 72 for body)
- Include required trailers (
Signed-off-by,Assisted-by) - Follow Tekton commit conventions (imperative mood, line length limits; conventional commit prefixes are project practice, not in the written standard)
Quick Workflow
- Analyze changes:
git statusandgit diff --cached - Determine type and scope (see tables below)
- Generate message with proper format
- Add required trailers
- Never commit without explicit user confirmation
Format
<type>(<scope>): <description>
<optional body — explain what and why, not how>
<trailers>
Type Selection
| Type | When to use |
|---|---|
feat |
New functionality |
fix |
Bug fix |
docs |
Documentation only |
refactor |
Code restructure, no behavior change |
test |
Adding or updating tests |
chore |
Maintenance, dependency updates |
build |
Build system or tooling changes |
ci |
CI/CD workflow changes |
perf |
Performance improvement |
style |
Formatting, linting fixes |
revert |
Reverting a previous commit |
See references/commit-types.md for detailed examples.
Scope Rules
Derive scope from the changed file paths:
| Path pattern | Scope |
|---|---|
pkg/reconciler/pipelinerun/ |
pipelinerun |
pkg/reconciler/taskrun/ |
taskrun |
pkg/reconciler/tektonpruner/ |
controller |
pkg/reconciler/namespaceprunerconfig/ |
controller |
pkg/config/ |
config |
pkg/webhook/ |
webhook |
pkg/metrics/ |
metrics |
cmd/controller/ |
controller |
cmd/webhook/ |
webhook |
config/ |
config |
docs/ |
scope = doc topic |
.github/workflows/ |
.github/workflows |
.tekton/ |
.tekton |
Makefile |
Makefile |
go.mod / go.sum / vendor/ |
deps |
hack/ |
hack |
skills/ |
skills |
If changes span multiple scopes, use the most significant one.
To link work to a GitHub issue, add Fixes #NNN or Closes #NNN
in the commit body (not the subject scope).
Line Length
- Subject: target 50 characters, hard limit 72
- Body: wrap at 72 characters per line
Required Trailers
Every commit must include:
Signed-off-by— for DCO complianceDetection priority:
$GIT_AUTHOR_NAME/$GIT_AUTHOR_EMAILenvironment variablesgit config user.name/git config user.email- Ask user (last resort)
Assisted-by— when AI assists with the commitFormat:
Assisted-by: <Model Name> (via <Tool Name>)Do not use
Co-Authored-Byfor AI attribution. The Tekton community adoptedAssisted-byto distinguish AI assistance from human co-authorship.Co-Authored-Byimplies ownership and accountability that AI tools cannot bear. Some AI coding tools default to injectingCo-Authored-By— override or remove it.
Trailer Format
Signed-off-by: Full Name <email@example.com>
Assisted-by: Claude Sonnet 4.6 (via Claude Code)
- Blank line before trailers
- No blank lines between trailers
- No trailing blank lines
User Confirmation
CRITICAL RULE: Always display the full commit message and wait for
explicit user approval before executing git commit.
Commit Execution
Use heredoc format for multi-line messages:
git commit -m "$(cat <<'EOF'
<type>(<scope>): <description>
<body>
Signed-off-by: Name <email>
Assisted-by: Model (via Tool)
EOF
)"
Never use: --no-verify, --no-gpg-sign, or --amend
(unless the user explicitly requests it).
Examples
Feature with component scope
feat(config): add enforcedConfigLevel validation
Validate that enforcedConfigLevel is one of the three allowed values
(global, namespace, resource) during ConfigMap admission. Previously
invalid values were silently accepted.
Signed-off-by: Jane Developer <jane@example.com>
Assisted-by: Claude Sonnet 4.6 (via Claude Code)
Bug fix closing an issue
fix(controller): prevent duplicate TTL annotations on PipelineRuns
The reconciler was setting TTL annotations on every reconcile loop
even when the annotation already existed with the correct value.
This caused unnecessary API writes and noisy audit logs.
Fixes #42
Signed-off-by: John Developer <john@example.com>
Assisted-by: Claude Sonnet 4.6 (via Claude Code)
Documentation update
docs(tutorials): add resource-group selector examples
Signed-off-by: Jane Developer <jane@example.com>
Breaking change
feat(config)!: rename historyLimit to retentionLimit
BREAKING CHANGE: The ConfigMap field `historyLimit` is now
`retentionLimit`. Update your tekton-pruner-default-spec ConfigMap
before upgrading.
Signed-off-by: John Developer <john@example.com>
Assisted-by: Claude Sonnet 4.6 (via Claude Code)
Auto-Detection Summary
When generating commit messages:
- Run
git status(without-uallflag) - Run
git diff --cachedfor staged changes - Identify primary component from staged file paths
- If scope unclear, ask user
- If user mentions a GitHub issue, add
Fixes #NNNto body - Analyze staged files to determine commit type
- Generate scope and description
- Detect author info from env vars or git config
- Ensure subject line is ≤50 characters (max 72)
- Wrap body text at 72 characters per line
- Add required trailers (
Signed-off-byandAssisted-by) - Display message and ask for user confirmation
- Only commit after receiving confirmation
Additional Resources
references/commit-types.md— complete type reference with examples- Tekton community conventions