-
Commit Co-authorship: After every successful
git commit
, automatically run:git commit --amend --no-edit --trailer="Co-authored-by: [AI_ASSISTANT_NAME] <noreply@[AI_PLATFORM]>"
- For opencode:
Co-authored-by: opencode <[email protected]>
- For Gemini CLI:
Co-authored-by: gemini <[email protected]>
- For Claude Code:
Co-authored-by: claude <[email protected]>
- For GitHub Copilot:
Co-authored-by: copilot <[email protected]>
- For opencode:
-
Semantic Commit Messages: Use the Conventional Commits format:
<type>(<scope>): <subject>
- Example:
feat: add hat wobble
- Types:
feat
,fix
,docs
,style
,refactor
,test
,chore
- Example:
-
Force Push Confirmation: ALWAYS ask for user confirmation before
git push --force
This guide is for Gentoo overlay projects with a typical structure (e.g., profiles/eapi
). This repository contains custom ebuilds.
- Adhere to Gentoo ebuild standards
- Use
EAPI=8
for new ebuilds (unless backward compatibility is required) - Include copyright headers and
metadata.xml
for all packages - Follow upstream versioning
- Place ebuilds in
[category]/[package]
- Ensure
Manifest
andmetadata.xml
files are present
- Binary Packages: Define
SRC_URI
with descriptive filenames - Dependencies: Specify
DEPEND
andRDEPEND
- Keywords: Set
KEYWORDS
(e.g.,~amd64
) - Restrictions: Configure
RESTRICT
(e.g.,bindist
) - Pre-compiled Files: Use
QA_PREBUILT
-
Check Special Cases FIRST: Before determining a new version or
SRC_URI
, consult theSpecial Cases
section below. If listed, follow its instructions ONLY. -
Identify Upgrade Needs: If the user asks which packages need upgrading, or doesn't specify, check GitHub issues:
- Run
git remote -v
- For each GitHub remote (
github.com
), fetch open issues viacurl -sL https://api.github.com/repos/OWNER/REPO/issues
- Present potential matches (Title + URL) to the user
- Run
-
Branch Prompt (MANDATORY): ALWAYS ask the user if they want to create a new branch for the commit, typically named after the package
-
Get
SRC_URI
:- Refer to the previous ebuild
- For GitHub projects, use
curl -sL https://api.github.com/repos/[organization]/[project]/releases/latest
. This is authoritative - If
.github/workflows/overlay.toml
exists and a packagesource
isregex
, use itsurl
withcurl -sL [url]
-
Create New Ebuild: Copy the existing ebuild. Do NOT manually replace
${PV}
-
Update Variables: Update version-specific variables (e.g.,
BUILD_ID
,SRC_URI
hashes) -
Verify Dependencies/Features: Check for new dependencies or removed features
-
Pre-Commit Quality Assurance (MANDATORY):
- Regenerate Manifest:
ebuild <package>.ebuild manifest --force
- Run QA Check:
pkgcheck scan --verbose <package>.ebuild
- Fix Errors: Repeat if
pkgcheck
reports errors - Commit: Proceed only after
pkgcheck
passes
- Regenerate Manifest:
-
Check Old Version Stability (MANDATORY): Before deciding whether to remove old ebuild:
- Read the old ebuild's
KEYWORDS
line - If old version has stable keywords (e.g.,
amd64
without~
prefix): MUST ASK user if they want to delete the old version - If old version has no stable keywords but upgrade crosses major/minor versions (e.g.,
1.2.3
→1.3.0
or1.2.3
→2.0.0
): MUST ASK user if they want to delete the old version- For semantic versioning (MAJOR.MINOR.PATCH), only MAJOR or MINOR version changes count as cross-version upgrades
- PATCH-only changes (e.g.,
0.3.13
→0.3.22
) do NOT count as cross-version upgrades
- Otherwise: Can proceed with deletion automatically
- Read the old ebuild's
-
Commit Logic:
- Single Commit Approach (Recommended): Add new ebuild, remove old ebuild, and regenerate manifest in one commit
- Two Commit Approach:
- First commit: Add new ebuild + manifest regeneration
- Second commit: Remove old ebuild + manifest regeneration
- Both commits MUST include
Part-of: [GitHub issue URL]
trailer - Only the FIRST commit (add new version) should include
Closes: [GitHub issue URL]
-
Remove Old Ebuild (if approved): Use
git rm
for the old ebuild file -
Regenerate Manifest (Post-Removal): After removing the old ebuild, run
ebuild <new-package-version>.ebuild manifest --force
to clean theManifest
file -
Branch Deletion (MANDATORY): If a new branch was created, ALWAYS prompt the user to delete it after a successful upgrade and commit. Ask: "Would you like to delete the [branch-name] branch and return to master? (y/n)"
-
Multiple Upgrades: If upgrading another package, ensure the user switches back to the
master
branch first
- app-editors/cursor: To get the latest version, execute EXACTLY:
Parse its JSON output for version and download URL. Do NOT modify this command.curl -sL "https://www.cursor.com/api/download?platform=linux-x64&releaseTrack=latest"
- Remove the entire package directory:
[category]/[package]
- Search and remove any lingering references (respect
.gitignore
)
Follow this sequence strictly for every commit:
-
Stage Changes: Use
git add [specific files]
. For package upgrades, only stage necessary files (new ebuild, manifest, metadata). NEVER usegit add .
-
Commit:
- For
.ebuild
changes:pkgdev commit --signoff
. DO NOT use--message
or-m
- For other changes:
git commit --signoff
with a semantic message
- For
-
Verify Commit: Ensure the commit was successful
-
Handle Related Issues (MANDATORY for Package Upgrades):
- Identify Remotes: Run
git remote -v
- GitHub Remotes: For each
github.com
remote:- Extract
OWNER/REPO
- Fetch open issues:
curl -sL https://api.github.com/repos/OWNER/REPO/issues
- Present a numbered list of potential matches (Title + URL) to the user
- Ask the user to select an issue to close. If selected, amend the commit with
Closes: [issue URL]
- Extract
- Non-GitHub Remotes: Ask the user if they want to close a related issue. If they provide a URL, amend the commit
- Proceed: If no issues are found/provided, or not a package upgrade, proceed
- Identify Remotes: Run
-
Verify Commit Message (MANDATORY): After amending, run
git show --format=%B -s
to inspect the full commit message. Ensure all required trailers (e.g.,Closes:
,Co-authored-by:
) are present and correctly formatted. Re-amend if needed -
Push to Remote: Get the current branch name. Ask the user if they want to push changes to the remote
-
Display Repository Link (MANDATORY): After successful push, display the repository access link
- Extract URL from
git remote -v
- Convert SSH to HTTPS (e.g.,
[email protected]:owner/repo.git
→https://github.com/owner/repo
) - Display as: "Changes pushed successfully! Repository: [URL]"
- Extract URL from
-
Branch Cleanup (MANDATORY): After successful push, if working on a feature branch:
- Ask: "Would you like to delete the [branch-name] branch and return to master? (y/n)"
- If yes:
- Switch to master:
git checkout master
- Delete branch:
git branch -d [branch-name]
- Switch to master:
- Remind user that future package upgrades should start from master