Add gitmoji skill and gitmoji-setup agent#2355
Conversation
Adds two complementary artifacts for the gitmoji commit convention (https://gitmoji.dev): - skills/gitmoji: generates gitmoji commit messages from a diff, staged changes, or a change description. Message-only by design (never runs git commands), with disambiguation rules and a full reference table of the 75 official gitmojis generated from the official gitmojis.json. - agents/gitmoji-setup: sets up gitmoji tooling in a repository. Audits the existing hook manager and commit convention, then installs either a non-interactive prepare-commit-msg prefill hook (default, works in GUI clients and CI), the gitmoji-cli interactive picker, or commitlint enforcement, without clobbering existing hooks. Generated README indexes updated via npm start.
🔒 PR Risk Scan ResultsScanned 5 changed file(s).
|
Addresses the package-exec-command finding from the PR risk scan: the verification example now calls the locally installed ./node_modules/.bin/commitlint rather than npx, which could fetch and execute a package on the fly.
🔍 Vally Lint Results
Summary
Full linter output |
There was a problem hiding this comment.
Pull request overview
Adds Gitmoji commit-message generation and repository tooling setup.
Changes:
- Adds a Gitmoji message-generation skill and reference.
- Adds an agent for installing Gitmoji hooks or commitlint.
- Updates generated resource documentation.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
skills/gitmoji/SKILL.md |
Defines Gitmoji message generation. |
skills/gitmoji/references/gitmoji-reference.md |
Lists the 75 official Gitmojis. |
agents/gitmoji-setup.agent.md |
Configures Gitmoji repository tooling. |
docs/README.skills.md |
Registers the new skill. |
docs/README.agents.md |
Registers the new agent. |
| - User pastes a git diff or describes a change in a project that uses gitmoji-style commit history | ||
| - User wants an expressive, scannable commit history using emojis | ||
|
|
||
| **When not to use:** if the project follows plain [Conventional Commits](https://www.conventionalcommits.org/) (`feat:`, `fix:`, ...) without emojis, use the `conventional-commit` or `commit-message-storyteller` skill instead. Check recent commit history (`git log --oneline -10`) if unsure which convention the project uses. |
| @@ -0,0 +1,141 @@ | |||
| --- | |||
| name: Gitmoji Setup | |||
| description: Sets up gitmoji (https://gitmoji.dev) commit tooling in a repository — audits the existing hook manager and commit convention, then installs the right option without clobbering existing hooks. Defaults to a non-interactive prepare-commit-msg hook that prefills a suggested emoji from the branch name and staged files; can alternatively install the gitmoji-cli interactive picker or commitlint enforcement. | |||
| git config core.hooksPath # custom hooks directory | ||
| ls .git/hooks | grep -v sample # plain git hooks already present | ||
|
|
||
| # Existing prepare-commit-msg hook (never overwrite it blindly) | ||
| cat .git/hooks/prepare-commit-msg 2>/dev/null |
|
|
||
| **Golden rule: never overwrite an existing hook.** Integrate with whatever manages hooks in this repo: | ||
|
|
||
| - **Plain git hooks**: if `.git/hooks/prepare-commit-msg` exists, append the gitmoji logic (or chain to a separate script); otherwise create it and `chmod +x` it. Remind the user that `.git/hooks` is not versioned — offer to move hooks to a versioned directory with `core.hooksPath` so the team shares them. |
|
|
||
| | Option | What it does | Choose when | | ||
| |--------|--------------|-------------| | ||
| | **A. Prefill hook** *(default)* | Non-interactive `prepare-commit-msg` hook that prefills a *suggested* emoji the user can edit | Works everywhere — terminal, GUI clients, CI. Recommend unless the user explicitly wants a picker | |
| if [ -z "$(printf '%s\n' "$files" | grep -vE '\.(md|mdx|rst|txt)$')" ]; then | ||
| emoji="📝" |
| elif [ -z "$(printf '%s\n' "$files" | grep -vE '(^|/)(package(-lock)?\.json|yarn\.lock|pnpm-lock\.yaml|go\.(mod|sum)|requirements[^/]*\.txt|Cargo\.(toml|lock)|Gemfile(\.lock)?)$')" ]; then | ||
| emoji="⬆️" |
| npm install --save-dev @commitlint/cli commitlint-config-gitmoji | ||
| echo "export default { extends: ['gitmoji'] }" > commitlint.config.mjs |
| 1. Create a scratch change and stage it: `git checkout -b test/gitmoji-hook && touch scratch.txt && git add scratch.txt` | ||
| 2. Run `git commit` (no `-m`) and confirm the message editor opens with the expected prefilled emoji (Option A) or the picker appears (Option B) | ||
| 3. Abort the commit (empty message), delete the scratch branch, and show the user the result |
| [ -n "$SOURCE" ] && exit 0 | ||
|
|
||
| # Skip if the message already starts with an emoji or :shortcode: | ||
| head -n 1 "$MSG_FILE" | grep -qE '^(:[a-z0-9_+-]+:|[^ -~])' && exit 0 |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (9)
agents/gitmoji-setup.agent.md:3
- Agent descriptions are required to be wrapped in single quotes by the repository convention (
AGENTS.md:61-63). Please quote this frontmatter value so the new agent follows the required format.
description: Sets up gitmoji (https://gitmoji.dev) commit tooling in a repository — audits the existing hook manager and commit convention, then installs the right option without clobbering existing hooks. Defaults to a non-interactive prepare-commit-msg hook that prefills a suggested emoji from the branch name and staged files; can alternatively install the gitmoji-cli interactive picker or commitlint enforcement.
agents/gitmoji-setup.agent.md:31
- Printing
core.hooksPathbut then inspecting.git/hooksmisses the active hooks in repositories with a custom hooks path and in worktrees (where.gitis a file). The audit can therefore overlook an existingprepare-commit-msghook, undermining the no-clobber guarantee. Resolve and inspect Git's active hooks directory instead.
git config core.hooksPath # custom hooks directory
ls .git/hooks | grep -v sample # plain git hooks already present
# Existing prepare-commit-msg hook (never overwrite it blindly)
cat .git/hooks/prepare-commit-msg 2>/dev/null
agents/gitmoji-setup.agent.md:40
- This compatibility claim conflicts with the reference hook's source check: GUI clients typically submit a message via
-F/-m, and CI-authored commits do likewise, so Git supplies a nonempty source and line 66 exits without prefilling. A hook also cannot prefill a GUI's message input before Commit is clicked. Restrict this recommendation to editor-based commits or redesign the GUI/CI path.
| **A. Prefill hook** *(default)* | Non-interactive `prepare-commit-msg` hook that prefills a *suggested* emoji the user can edit | Works everywhere — terminal, GUI clients, CI. Recommend unless the user explicitly wants a picker |
agents/gitmoji-setup.agent.md:50
- The installation instructions revert to
.git/hookseven though the audit supportscore.hooksPath. In a repository with a custom path or worktree this creates an ignored hook (or fails because.gitis not a directory). Use the active path returned by Git for both existence checks and installation.
- **Plain git hooks**: if `.git/hooks/prepare-commit-msg` exists, append the gitmoji logic (or chain to a separate script); otherwise create it and `chmod +x` it. Remind the user that `.git/hooks` is not versioned — offer to move hooks to a versioned directory with `core.hooksPath` so the team shares them.
agents/gitmoji-setup.agent.md:94
- Manifest filenames do not establish an upgrade:
package.jsonmay only change scripts/metadata, and lockfiles may represent additions, removals, or downgrades. This branch will confidently prefill the wrong⬆️despite the stated intent to avoid guessing. Remove this filename-only fallback or inspect the staged dependency diff to distinguish the operation.
elif [ -z "$(printf '%s\n' "$files" | grep -vE '(^|/)(package(-lock)?\.json|yarn\.lock|pnpm-lock\.yaml|go\.(mod|sum)|requirements[^/]*\.txt|Cargo\.(toml|lock)|Gemfile(\.lock)?)$')" ]; then
emoji="⬆️"
agents/gitmoji-setup.agent.md:111
gitmoji -ialways writes/replaces.git/hooks/prepare-commit-msg, so withcore.hooksPath, husky, lefthook, or pre-commit it installs an ignored side hook even if no file exists there. Direct installation must be limited to repositories whose active hooks directory is.git/hooks; otherwise integrate the gitmoji hook command through the active manager/path.
⚠️ `gitmoji -i` **replaces** `.git/hooks/prepare-commit-msg`. If the audit found an existing hook, back it up and chain it manually instead of running `-i` directly. Warn the user that the picker blocks commits from GUI clients.
agents/gitmoji-setup.agent.md:117
- This redirection silently replaces any existing
commitlint.config.mjs, potentially deleting the repository's current parser, plugins, and rules. The audit should detect all supported commitlint config filenames and mergegitmojiinto the existingextends; only create this file when no configuration exists.
echo "export default { extends: ['gitmoji'] }" > commitlint.config.mjs
agents/gitmoji-setup.agent.md:126
- After aborting,
scratch.txtremains staged and the scratch branch is still checked out, so deleting that branch fails and switching back can carry the staged file onto the user's original branch. Make the cleanup sequence explicit; also clear the prefilled emoji before closing the editor, otherwise the message is not empty and Git may create the scratch commit.
3. Abort the commit (empty message), delete the scratch branch, and show the user the result
skills/gitmoji/SKILL.md:20
- This tells the skill to execute
git log, contradicting its explicit contract in the description and line 11 that it never runs any Git command. When history was not supplied, ask the user for the convention or ask them to paste the log instead.
**When not to use:** if the project follows plain [Conventional Commits](https://www.conventionalcommits.org/) (`feat:`, `fix:`, ...) without emojis, use the `conventional-commit` or `commit-message-storyteller` skill instead. Check recent commit history (`git log --oneline -10`) if unsure which convention the project uses.
Pull Request Checklist
npm startand verified thatREADME.mdis up to date.mainbranch for this pull request.Description
Adds two complementary artifacts for the gitmoji commit convention, filling a gap next to the existing Conventional Commits skills (
conventional-commit,git-commit,commit-message-storyteller):skills/gitmoji— generates gitmoji commit messages from a git diff, staged changes, or a plain description of the change. Picks exactly one emoji using disambiguation rules (specific beats generic, hotfix vs fix, tests vs failing tests...), supports both unicode and:shortcode:styles by matching the repo history, and is message-only by design: it never runs git commands. Ships withreferences/gitmoji-reference.md, the full table of the 75 official gitmojis generated from the official gitmojis.json.agents/gitmoji-setup— sets up gitmoji tooling in a repository. It first audits the existing hook manager (husky, lefthook, pre-commit,core.hooksPath, plain.git/hooks) and commit convention, then installs one of three options without clobbering existing hooks: a non-interactiveprepare-commit-msgprefill hook (default — suggests an emoji from branch name and staged files, works in GUI clients and CI), the gitmoji-cli interactive picker, or commitlint enforcement viacommitlint-config-gitmoji.The two artifacts cross-reference each other: the skill generates messages on demand, the agent equips the repo durably.
Type of Contribution
Additional Notes
npm run skill:validatepasses (377 skills valid) andnpm startwas run to regeneratedocs/README.skills.mdanddocs/README.agents.md(included in this PR). The gitmoji reference table was generated directly from the official gitmojis.json (75 entries) rather than written by hand, so emojis, shortcodes and descriptions are exact.By submitting this pull request, I confirm that my contribution abides by the Code of Conduct and will be licensed under the MIT License.