From c64f3af6d60f1ee68d71197d5216711c73394c29 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 12 Aug 2026 14:41:20 +0000 Subject: [PATCH 1/2] feat(go-format): disclose goimports rewrites on the user channel Partially addresses #1596 Co-authored-by: Kyle Sexton --- plugins/go-format/CHANGELOG.md | 7 +++++++ plugins/go-format/hooks/go-format.sh | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/plugins/go-format/CHANGELOG.md b/plugins/go-format/CHANGELOG.md index a5eff7f2a0..e438718324 100644 --- a/plugins/go-format/CHANGELOG.md +++ b/plugins/go-format/CHANGELOG.md @@ -3,6 +3,13 @@ All notable changes to the `go-format` plugin are documented here. Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); this plugin uses semantic versioning. +## [0.3.8] + +### Added + +- **Content-mutation disclosure on goimports rewrites (#1596).** When goimports changes a file, + the hook emits a `systemMessage` naming the path. + ## [0.3.7] ### Changed diff --git a/plugins/go-format/hooks/go-format.sh b/plugins/go-format/hooks/go-format.sh index 73a1028fae..369876cfad 100755 --- a/plugins/go-format/hooks/go-format.sh +++ b/plugins/go-format/hooks/go-format.sh @@ -224,6 +224,10 @@ fi GOIMPORTS_ARGS=(-w -l) [[ -n "$LOCAL_PREFIX" ]] && GOIMPORTS_ARGS+=(-local "$LOCAL_PREFIX") +_go_before="" +if _go_before=$(mktemp 2>/dev/null); then + cp "$FILE" "$_go_before" 2>/dev/null || _go_before="" +fi # -w writes the fix in place; -l (combined with -w) lists the changed # filename on stdout, which this hook doesn't need (a successful autofix # carries no advisory noise, same posture as a successful ruff/typos fix @@ -240,6 +244,12 @@ STDERR=$("$GOIMPORTS_BIN" "${GOIMPORTS_ARGS[@]}" -- "$FILE" 2>&1 >/dev/null) RC=$? if [[ $RC -eq 0 ]]; then + if [[ -n "$_go_before" ]]; then + if ! cmp -s "$_go_before" "$FILE" 2>/dev/null; then + hook::emit_system_message "go-format: reformatted $(basename "$FILE") via goimports (imports and layout only)." + fi + rm -f "$_go_before" + fi # Clean, or fixed silently (formatting/import changes carry no advisory # noise — same posture as a successful ruff/typos autofix pass). emit_tel "ok" '[]' From 2c06f15945e2e19755e85d6fc90104ab4b8a8333 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 12 Aug 2026 15:02:51 +0000 Subject: [PATCH 2/2] fix(go-format): bump manifest to match CHANGELOG 0.3.8 entry Co-authored-by: Kyle Sexton --- plugins/go-format/.claude-plugin/plugin.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/go-format/.claude-plugin/plugin.json b/plugins/go-format/.claude-plugin/plugin.json index 2f210b4aa9..101d8effd1 100644 --- a/plugins/go-format/.claude-plugin/plugin.json +++ b/plugins/go-format/.claude-plugin/plugin.json @@ -1,8 +1,8 @@ { "$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json", "name": "go-format", - "version": "0.3.7", - "description": "Auto-fix Go formatting and import management on edit via goimports \u2014 runs unconditionally (no consumer-config gate), skipping generated files.", + "version": "0.3.8", + "description": "Auto-fix Go formatting and import management on edit via goimports — runs unconditionally (no consumer-config gate), skipping generated files.", "author": { "name": "Melodic Software", "email": "info@melodicsoftware.com"