Skip to content

Remove the version.gradle.kts Edit-block hook#21

Merged
alexander-yevsyukov merged 1 commit into
masterfrom
drop-version-edit-block
Jun 18, 2026
Merged

Remove the version.gradle.kts Edit-block hook#21
alexander-yevsyukov merged 1 commit into
masterfrom
drop-version-edit-block

Conversation

@alexander-yevsyukov

Copy link
Copy Markdown
Contributor

What

Deletes scripts/protect-version-file.sh — the PreToolUse hook that blocked Edit/Write/MultiEdit on version.gradle.kts.

This is the shared-repo half of the change. The companion change in config stops wiring the hook into consumers' .claude/settings.json (see "Rollout" below).

Why

The hook forced all version changes through the bump-version skill, but in practice it was friction without protection:

  • It blocked the clean tool (Edit) while leaving Bash wide open — publish-version-gate.sh only inspects ./gradlew commands, so a sed -i on the file sailed straight through. It never actually prevented editing; it only diverted the agent onto a Bash write that then needed a permission prompt, defeating the autonomy the bump-version skill exists to provide.
  • Every protection that matters is outcome-based and lives elsewhere, and is untouched by this change:
    • CI's checkVersionIncrement rejects a version that already exists in Maven.
    • publish-version-gate.sh blocks a build/publish unless the branch is bumped above base.
  • guidelines/version-policy.md itself recommends incrementing the version when a new branch starts — exactly the edit the hook fought.

Dropping the block lets agents make the trivial version edit directly. The bump-version skill remains as guidance for the non-trivial parts (alias variable, breaking round-up, conflict resolution, report regen) and now runs without a permission prompt.

Scope

The only references to the Edit-block lived inside the script itself — no skill, guideline, doc, or in-repo settings pointed at it — so removing the script is the complete change here.

Rollout

Consumers wire this hook via the config-distributed .claude/settings.json template, which config/migrate clobber-copies on every ./config/pull. Land the config change first (removes the wiring everywhere; the unused script lingering is harmless), then this PR (deletes the now-unreferenced script). After both are on master, a single ./config/pull brings each consumer fully consistent.

`protect-version-file.sh` was a PreToolUse hook that blocked
Edit/Write/MultiEdit on `version.gradle.kts` to force version changes
through the `bump-version` skill. In practice it was friction without
protection:

- It blocked the *clean* tool (Edit) but left Bash wide open — the
  Bash gate (`publish-version-gate.sh`) only inspects `./gradlew`
  commands, so a `sed -i` on the file sailed straight through. So it
  never actually prevented editing; it only diverted the agent onto a
  Bash write that then needed a permission prompt, defeating the
  autonomy the `bump-version` skill exists to provide.
- Every protection that matters is outcome-based and lives elsewhere:
  CI's `checkVersionIncrement` rejects a version that already exists in
  Maven, and `publish-version-gate.sh` blocks a build/publish unless the
  branch is bumped above base. Neither cares which tool wrote the file.
- `version-policy.md` itself recommends incrementing the version when a
  new branch starts — exactly the edit the hook fought.

Dropping the block lets agents make the trivial version edit directly;
the publish gate and CI check keep the published artifacts safe, and the
`bump-version` skill remains as guidance for the non-trivial parts
(alias variable, breaking round-up, conflict resolution, report regen).

Companion step (per consuming repo, not in this repo): remove the
`Edit|Write|MultiEdit -> protect-version-file.sh` entry from
`.claude/settings.json`. Leave the `Bash` publish gate intact.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the shared-repo PreToolUse hook script that previously blocked direct Edit/Write/MultiEdit operations on version.gradle.kts, aligning behavior with the repo’s outcome-based version protections (CI checks and publish-version-gate.sh) and reducing agent friction.

Changes:

  • Deleted scripts/protect-version-file.sh, which implemented the Edit/Write/MultiEdit block for version.gradle.kts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@alexander-yevsyukov alexander-yevsyukov changed the title Remove the version.gradle.kts Edit-block hook Remove the version.gradle.kts Edit-block hook Jun 18, 2026
@alexander-yevsyukov alexander-yevsyukov merged commit 173707b into master Jun 18, 2026
1 check passed
@alexander-yevsyukov alexander-yevsyukov deleted the drop-version-edit-block branch June 18, 2026 19:27
@github-project-automation github-project-automation Bot moved this from 🏗 In progress to ✅ Done in v2.0 Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants