Skip to content

feat(utilities): commit attribution mod for Claude Code (part of #1497) - #2234

Open
Kaap10 wants to merge 2 commits into
apache:mainfrom
Kaap10:feat/utilities-commit-attribution-mod
Open

Kaap10 wants to merge 2 commits into
apache:mainfrom
Kaap10:feat/utilities-commit-attribution-mod

Conversation

@Kaap10

@Kaap10 Kaap10 commented Nov 22, 2026

Copy link
Copy Markdown
Member

Summary

  • Implement the Commit Attribution Claude Code mod in magpie-utilities to provide zero-token attribution trailers complying with the ASF Generative Tooling guidance and prevent agent-guard rejections upfront.
  • Hook Claude Code's native attribution.text event to provide compliant trailer text resolved according to docs/setup/commit-attribution.md (project .apache-magpie-overrides/ layer wins unless contributor-choice; unadopted .git/apache-magpie/ or adopted .apache-magpie-local/ personal fallback; generated-by default).
  • Hook tool.call (Bash) to inspect git commit commands for unauthorized Co-authored-by: trailers with fail-open safety, compound pipeline segmentation, and support for MAGPIE_ALLOW_COAUTHOR=1 / MAGPIE_GUARD_OFF=1 overrides.
  • Implement zero-dependency quote-aware TOML parsing, shell metacharacter stripping, and ReDoS-safe command tokenization.

Type of change

  • Other: Claude Code mod enhancement (plugins/magpie-utilities/)

Test plan

  • claude plugin validate --strict plugins/magpie-utilities passes (0 errors, 0 warnings)
  • claude plugin test plugins/magpie-utilities passes (52/52 unit tests across skills-command.test.ts and commit-attribution.test.ts)
  • python tools/dev/add-license-headers.py --check passes (0 violations)
  • prek run typos passes (0 typos)
  • ReDoS benchmark verifies sub-millisecond command evaluation under nested whitespace stress test

RFC-AI-0004 compliance

  • HITL — non-invasive attribution provider; all commit authoring decisions remain under human control
  • Sandbox — strictly reads local configuration via $.fs.read; zero external subprocesses and zero network egress
  • Vendor neutrality — mod is strictly additive in magpie-utilities; skills function 100% normally on other harnesses without the mod
  • Conversational + correctable — honors project policies and per-command overrides (MAGPIE_ALLOW_COAUTHOR=1)
  • Write-access discipline — read-only configuration observer; makes no autonomous external writes
  • Privacy LLM — zero model tokens consumed; deterministic local TypeScript execution only

Linked issues

Notes for reviewers (optional)

  • Strictly adheres to the Claude Code single-module manifest contract: hooks.json registers ./skills-command.ts, which cleanly delegates to ./commit-attribution.ts.
  • Implements strict fail-closed precedence: a corrupted or invalid project TOML immediately resolves to generated-by rather than leaking through to contributor local configuration.

…he#1497)

Implement the Claude Code commit attribution mod in magpie-utilities to
provide zero-token attribution trailers complying with the ASF
Generative Tooling guidance and prevent agent-guard rejections upfront.

- Hook attribution.text to supply configured trailers directly to Claude Code.
- Hook tool.call on Bash to evaluate commands and warn before unauthorized co-authorship.
- Implement zero-dependency TOML parser and fail-closed resolution matching agent-guard.
- Sanitize trailers against ANSI escapes, BiDi overrides, and shell metacharacters.
- Add comprehensive 36 unit tests in commit-attribution.test.ts (52 tests passing in plugin).

Refs apache#1497

Generated-by: Antigravity
@github-actions github-actions Bot added the family:utilities utilities skills label Nov 22, 2026
@Kaap10
Kaap10 marked this pull request as draft November 22, 2026 11:19
@Kaap10
Kaap10 marked this pull request as ready for review November 22, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

family:utilities utilities skills

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant