-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
Description
Phase 1: Matcher Support for Pack Authors
Context
The matcher field on HookGroup exists in the data model (for JSON round-tripping), but the engine always sets it to nil when auto-deriving hook entries from pack components. Pack authors cannot target specific tools (e.g., only run a linting hook after Edit|Write calls).
Problem
A pack that installs a PostToolUse hook for code formatting currently fires on every tool call. The author should be able to specify matcher: "Edit|Write" so it only runs when files change.
Proposed Solution
Add a hookMatcher: String? field to ExternalComponentDefinition (alongside existing hookEvent). When the engine auto-derives hook settings entries, use this value for the HookGroup.matcher field.
Example Pack YAML
components:
- id: format-hook
description: Auto-format on file changes
hookEvent: PostToolUse
hookMatcher: "Edit|Write"
hook:
source: hooks/format.sh
destination: format.shFiles to Modify
Sources/mcs/ExternalPack/ExternalPackManifest.swift— addhookMatcherto component definitionSources/mcs/TechPack/Component.swift— addhookMatchertoComponentDefinitionSources/mcs/Install/Configurator.swiftor settings composition — usehookMatcherwhen creatingHookGroup- Validation: if
hookMatcheris set,hookEventmust also be set - Tests
Acceptance Criteria
- Pack authors can specify
hookMatcherin component definitions - Auto-derived
HookGroupentries use the specified matcher - Validation rejects
hookMatcherwithouthookEvent - Events that don't support matchers (
UserPromptSubmit,Stop, etc.) get a validation warning
Reference
Reactions are currently unavailable