refactor: deduplicate code, improve type safety, simplify error classes#480
Merged
refactor: deduplicate code, improve type safety, simplify error classes#480
Conversation
- Extract shared parseYamlArgs() to yaml-schema.ts, eliminating duplicate YAML args parsing in discovery.ts and build-manifest.ts - Unify BROWSER_ONLY_STEPS: export from capabilityRouting.ts, reuse in pipeline executor (fixes missing intercept/tap in retry set) - Remove dead normalizeArgValue from commanderAdapter; bool coercion now handled solely by coerceAndValidateArgs in execution.ts - Add closeWindow?() to IPage interface, replacing unsafe casts in executor - BrowserBridge/CDPBridge implement IBrowserFactory, removing double cast in getBrowserFactory() - Simplify CliError subclasses with new.target.name (9 redundant this.name assignments removed) - Add hook dedup in addHook() to prevent duplicate registrations - Fix normalizeRows to safely handle primitive values - Unify CommandArgs type: execution.ts now imports from registry.ts - Cache strategyLabel() call in cli.ts list command
Merged
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
parseYamlArgs()to yaml-schema.ts, eliminating duplicate YAML args parsing in discovery.ts and build-manifest.tsBROWSER_ONLY_STEPS: export from capabilityRouting.ts, reuse in pipeline executor (fixes missingintercept/tapin retry set)normalizeArgValuefrom commanderAdapter; bool coercion now handled solely bycoerceAndValidateArgscloseWindow?()to IPage interface, replacing unsafe casts in executorimplements IBrowserFactory, removing double cast ingetBrowserFactory()new.target.name(9 redundantthis.nameassignments removed)addHook()to prevent duplicate registrationsnormalizeRowsto safely handle primitive valuesCommandArgstype: execution.ts now imports from registry.tsstrategyLabel()call in cli.ts list commandNet: -68 lines across 16 files, zero new dependencies.
Test plan
tsc --noEmitpasses