Problem
When a user upgrades the Partio CLI binary, the git hook scripts installed in their repositories become stale — they may reference old binary paths, use outdated shim logic, or miss new hooks added in later versions. Currently, partio enable short-circuits entirely when .partio/ exists (cmd/partio/enable.go:38-42), telling the user "partio is already enabled" without checking whether the installed hooks are up to date.
The only workaround is partio disable && partio enable, which users must know to do and which unnecessarily tears down and rebuilds state.
Desired behavior
partio enable should detect stale hooks and silently upgrade them:
- If
.partio/ exists, skip directory/config creation but still check hooks.
- For each expected hook (
pre-commit, post-commit, pre-push), read the installed script from the hooks directory.
- Compare the installed content against the expected content from
hookScript() / hookScriptAbsolute().
- If the content differs, overwrite the hook file (preserving the existing backup chain).
- If a hook is missing entirely, install it following the normal backup logic.
- Print a summary of what was upgraded.
Context
cmd/partio/enable.go — the .partio/ existence check that needs to be relaxed
internal/git/hooks/install.go — installHooks() needs an upgrade-aware code path
internal/git/hooks/hooks.go — hookScript() / hookScriptAbsolute() generate expected content
Source
Inspired by entireio/cli PR #775 — rewrite hook content when it differs from expected.
Problem
When a user upgrades the Partio CLI binary, the git hook scripts installed in their repositories become stale — they may reference old binary paths, use outdated shim logic, or miss new hooks added in later versions. Currently,
partio enableshort-circuits entirely when.partio/exists (cmd/partio/enable.go:38-42), telling the user "partio is already enabled" without checking whether the installed hooks are up to date.The only workaround is
partio disable && partio enable, which users must know to do and which unnecessarily tears down and rebuilds state.Desired behavior
partio enableshould detect stale hooks and silently upgrade them:.partio/exists, skip directory/config creation but still check hooks.pre-commit,post-commit,pre-push), read the installed script from the hooks directory.hookScript()/hookScriptAbsolute().Context
cmd/partio/enable.go— the.partio/existence check that needs to be relaxedinternal/git/hooks/install.go—installHooks()needs an upgrade-aware code pathinternal/git/hooks/hooks.go—hookScript()/hookScriptAbsolute()generate expected contentSource
Inspired by entireio/cli PR #775 — rewrite hook content when it differs from expected.