Skip to content

feat(paw_sign): append puppy signature to code-puppy git commits#480

Open
dudeinthemirror wants to merge 1 commit into
mainfrom
feature/paw-sign-commits
Open

feat(paw_sign): append puppy signature to code-puppy git commits#480
dudeinthemirror wants to merge 1 commit into
mainfrom
feature/paw-sign-commits

Conversation

@dudeinthemirror

Copy link
Copy Markdown
Collaborator

Summary

Adds a builtin plugin that paw-signs commit messages composed by code-puppy. When code-puppy runs a git commit -m "...", the plugin tacks on an extra -m paragraph:

[-- paw-signed: code-puppy  --]

So the audience knows the commit came from a very good boy.

How it works

Hooks pre_tool_call and mutates the agent_run_shell_command args in place (same pattern as the emoji_filter plugin). Adds the signature as a second -m, which git stacks as a trailer-style paragraph at the bottom of the message.

Safety / design

A corrupted git commit is far worse than a missing paw print, so the detector is deliberately conservative:

  • Analyse, don't rebuild. Uses shlex only to inspect the command (respecting quotes), never to reconstruct it — so shell substitutions $(...), heredocs, and exotic quoting in the original are preserved untouched.
  • Only signs when the git commit -m is the LAST segment in the chain. This means git add . && git commit -m "x" gets signed, but git commit -m "x" && git push is left alone (no paw landing on push).
  • Idempotent — already-signed commands are skipped (no double paw).
  • Skips editor commits (no -m) and anything shlex can't parse cleanly.
  • Never blocks or crashes — exceptions are swallowed.
  • The paw glyph is stored as a \\U0001F43E unicode escape so the repo's emoji_filter doesn't strip it from source on write.

Testing

  • 18 unit tests covering happy path, conservative no-op cases, and helper internals — all pass.
  • Verified no regressions: full plugins suite 2357 passed, 5 skipped, plus plugin-loader/callback tests 122 passed.

Config

No toggle — always on, keep it simple (YAGNI).

Add a builtin plugin that hooks pre_tool_call and appends a playful
'[-- paw-signed: code-puppy --]' signature (with paw-print glyph) as an
extra -m paragraph to git commit messages composed by code-puppy.

Design notes:
- Uses shlex to ANALYSE commands (respecting quotes), never to rebuild
  them, so shell substitutions / heredocs / exotic quoting are preserved.
- Only signs when the 'git commit -m' invocation is the LAST segment in
  the chain, so chains like 'git commit && git push' are never corrupted.
- Skips editor-style commits (no -m), already-signed commands
  (idempotent), and anything shlex can't parse cleanly.
- The paw-print is stored as a \\U0001F43E unicode escape so the repo's
  emoji_filter doesn't strip it from the source on write.

18 unit tests cover the happy path, the conservative no-op cases, and
helper internals.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant