feat(hooks): tell session hooks which kind of worktree they are in #410
No reviewers
Labels
No labels
bug
contract
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/iw-cli!410
Loading…
Reference in a new issue
No description provided.
Delete branch "hook-worktree-kind"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
iw start --effortshipped in #409, but the session hook that makesiw startuseful was nevertold about the new worktree kind.
SessionContextcarried a single identity field namedissueId,which an effort worktree filled with its slug — so kanon's start hook sent
/iterative-works:triage-issue mail-capture, and triage stops on a tracker lookup for an issue thatdoes not exist. Every
iw start --effortopened a session that dead-ended.What changed
SessionContext—issueIdis nowkey(the identity the worktree is addressed under) pluskind(IssueorEffort). A hook readskindbefore interpretingkey, because only an issuekey resolves against the tracker. This is a breaking change to the hook API; the only consumer
in existence is kanon's start hook, updated alongside.
Hook version requirements are now enforced.
iw-runalready hadread_iw_version,compare_versionsandcheck_version_requirementparsing// REQUIRES: iw-cli >= X.Y.Z— it wassimply never applied to hook files. The parser is extracted into
read_version_requirementandreused by a new
filter_compatible_hooks, wired into both hook-collection sites.Commands and hooks differ deliberately:
A hook decorates a command rather than being the thing you asked for, so one stale plugin hook must
not brick every command it attaches to. And since hooks are compiled alongside the command, a hook
written against a newer core otherwise fails at compile time with no hint as to why — which is
exactly the failure this header exists to prevent.
Verification
core.test·dashboard.test· full BATS suite 176 ok / 0 not ok (7 new, covering satisfied,unsatisfied, malformed, absent, mixed and empty hook lists) ·
scala-cli compile --scalac-option -Werror core/. Tests were written first and observed failing (value key is not a member of SessionContext) before the model changed.The updated kanon hook was compiled against this core exactly as
iw-runcompiles it — exit 0.Note for the release
kanon's hook declares
// REQUIRES: iw-cli >= 0.7.0, so it is correctly skipped until VERSIONreaches 0.7.0:
Declaring anything lower would be false — no released version carries
ctx.key. The bump followsthis merge.