[#266] Consolidate hook metadata into HookRegistration struct#268
Merged
[#266] Consolidate hook metadata into HookRegistration struct#268
Conversation
- Replace four flat fields (hookEvent/hookTimeout/hookAsync/hookStatusMessage) with single HookRegistration? on ComponentDefinition and ExternalComponentDefinition - Remove ConfigurationDiscovery.HookInfo (replaced by HookRegistration) - Add 5 missing hook events from official docs: StopFailure, InstructionsLoaded, PostCompact, Elicitation, ElicitationResult
- Restore orphaned hook metadata rejection (decode-time DecodingError) - Add Equatable conformance to HookRegistration - Remove dual-parameter hookComponent helper — use hookRegistration only - Clean up stale blank lines in ExternalPackAdapterTests
- Strengthen orphaned metadata test: assert DecodingError.dataCorrupted with message check - Include component ID in DecodingError debugDescription for actionable messages - Use try #require to unwrap hookRegistration before asserting nil sub-fields - Add timeout: 0 boundary test for off-by-one guard - Clean up stray blank line in ExternalPackAdapterTests
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.
Summary
Replaces four flat optional fields (
hookEvent,hookTimeout,hookAsync,hookStatusMessage) onComponentDefinitionandExternalComponentDefinitionwith a singleHookRegistration?struct. This reduces parameter sprawl, enforces semantic grouping (hook metadata can only exist with an event), and unifies the export path'sHookInfotype. Also syncsvalidEventswith the latest Claude Code hooks documentation (+5 missing events).Closes #266
Changes
HookRegistrationstruct inComponent.swiftwithevent: String,timeout: Int?,isAsync: Bool?,statusMessage: String?ComponentDefinition: 4 flat fields →hookRegistration: HookRegistration?ExternalComponentDefinition: same, with flat YAML CodingKeys preserved for pack author ergonomicsConfigurationDiscovery.HookInfo— replaced byHookRegistrationDiscoveredFile: 4 flat fields →hookRegistration: HookRegistration?HookRegistration.eventis non-optional)StopFailure,InstructionsLoaded,PostCompact,Elicitation,ElicitationResultTest plan
swift testpasses locally (797 tests)swiftformat --lint .andswiftlintpass without violationsmcs sync,mcs doctor)Checklist for engine changes
LifecycleIntegrationTestsorDoctorRunnerIntegrationTests)