Repository navigation
feat(doctor): session trailer prepare-commit-msg hook via workit doctor --fix - #257
Merged
Merged
Conversation
…lain commits Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Workit-Session: fb894a62-61b7-4f32-a4d0-f47c2e5e300f-w-session-trailer-hook
doctor --fix installs the commit-msg hook in a Workit workspace only, chaining an existing hook. Adds a verb-level pi_extension stale test and isolates the reliability-report doctor env from CODEX_HOME and PI_CODING_AGENT_DIR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Workit-Session: fb894a62-61b7-4f32-a4d0-f47c2e5e300f-w-session-trailer-hook
…he installer stub Workit-Session: fb894a62-61b7-4f32-a4d0-f47c2e5e300f
Workit-Session: fb894a62-61b7-4f32-a4d0-f47c2e5e300f
…nother tool's hook The hook moves to the prepare-commit-msg slot and is written only into an empty slot or over Workit's own script. A husky, lefthook or other hook there is left untouched and the check prints a tailored manual line. Chaining is gone; files left by the earlier commit-msg design are reported with recovery steps. Templates and rebase or cherry-pick replays are left unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Workit-Session: fb894a62-61b7-4f32-a4d0-f47c2e5e300f-w-session-trailer-hook
…anual line doctor --fix writes the trailer logic to <git-common-dir>/workit/session-trailer.sh, even when the prepare-commit-msg slot is blocked. Workit's hook and the lines given for husky, lefthook and other hooks are the same one-liner that runs it, so merge, editor, template, opt-out and id validation behave the same everywhere. Plain editor commits get no trailer. husky 4-8 hooks are their own manual target. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Workit-Session: fb894a62-61b7-4f32-a4d0-f47c2e5e300f-w-session-trailer-hook
…and pass once it is added
The hook and manual line are a no-op when the helper is missing, also outside a
git repository, so a committed husky line is quiet in teammates' clones. A
foreign hook, husky script or lefthook config that already runs the helper
reports pass (via husky, lefthook or the existing hook). The helper treats
lefthook's literal {2} placeholder as no message source.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Workit-Session: fb894a62-61b7-4f32-a4d0-f47c2e5e300f-w-session-trailer-hook
…uns the helper Shell targets need a non-comment line that invokes the helper, and a hook git runs needs the executable bit (husky 9 user scripts do not). lefthook needs a run: under the top-level prepare-commit-msg key, read indentation-aware from lefthook(-local) YAML. Comments, TODOs, a non-executable hook, a commented job or a job under commit-msg stay blocked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Workit-Session: fb894a62-61b7-4f32-a4d0-f47c2e5e300f-w-session-trailer-hook
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Workit-Session: fb894a62-61b7-4f32-a4d0-f47c2e5e300f-w-session-trailer-hook
…d with spaced paths
lefthook on Windows runs a job as "sh" -c "<run>" without escaping, so the
printed job now has no double quote: set -f and an empty IFS keep the helper
path one word. lefthook pastes {1} unquoted, and from a linked worktree it is
an absolute path that can hold a space, so the job single-quotes it. Tests use
long native temp paths and sh-quoted editor scripts on Windows.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Workit-Session: fb894a62-61b7-4f32-a4d0-f47c2e5e300f-w-session-trailer-hook
…elper
lefthook pastes {1} unquoted, and from a linked worktree it is an absolute path
that a quote breaks. The job now passes '' {2} {3} and the helper finds the
message file itself: COMMIT_EDITMSG, plus MERGE_MSG when the source is merge
(git merge hands the hook MERGE_MSG). Manual detection now needs sh in command
position, so echo sh $h does not count.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Workit-Session: fb894a62-61b7-4f32-a4d0-f47c2e5e300f-w-session-trailer-hook
Contributor
|
🎉 This PR is included in version 8.9.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Claude Code's worktree isolation checks refuse
workit gitin worktree-isolated subagents, and they can't be turned off (https://code.claude.com/docs/en/worktrees#how-claude-code-enforces-isolation). So subagent commits are plain git and lose theWorkit-Sessiontrailer. The user approved a hook that adds it.What
workit-core/src/git/session-hook.ts: a POSIX shprepare-commit-msghook that appendsWorkit-Session: <id>(interpret-trailersaddIfDifferent, id rules as inhost-session.ts).-m,-F, amend, merge, squash and--no-verify.prepare-commit-msg, the slot is reported asblockedwith a fix for that owner: one line for.husky/prepare-commit-msg, a ready-to-pastelefthook.ymljob, or a generic line.blocked.workit doctor: an advisorysession_hookcheck, in configured workspaces only.workit doctor --fixinstalls, and only inside a Workit workspace. There is no uninstall verb: delete the file, whose header names Workit.WORKIT_SESSION_IDset.cliVersionwiring; an isolated env in the reliability-report fixture test.The first design renamed an existing
commit-msghook in order to chain it. Review proved, with real husky 9.1.7 and lefthook 2.1.16, that this silently disables husky's hook and is undone bylefthook install. It was replaced.Verification
workit check lint,typecheckandtestpass (1862 pass).bun run knipis clean.bun run build && bun scripts/test.ts packaging: 245 pass.--fix;lefthook install --forceleaves our hook working;.oldnamed;🤖 Generated with Claude Code