refactor(hooks,scripts): extract shared helpers to reduce duplication#882
Open
qte77 wants to merge 1 commit intortk-ai:developfrom
Open
refactor(hooks,scripts): extract shared helpers to reduce duplication#882qte77 wants to merge 1 commit intortk-ai:developfrom
qte77 wants to merge 1 commit intortk-ai:developfrom
Conversation
- Extract _emit_hook_response() in hooks/rtk-rewrite.sh to deduplicate the ask (exit 3) and allow (exit 0) JSON output blocks - Add comment in both hook files explaining dep-check duplication is intentional (hooks must be self-contained for deployment) - Create scripts/_test_harness.sh with shared state vars, color defs, assert_ok/contains/output/exit_nonzero/skip_test, section(), and report_and_exit() - Update test-aristote.sh and test-ruby.sh to source the harness and remove ~80 lines of duplicated boilerplate each Co-Authored-By: Claude <noreply@anthropic.com>
|
|
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
_emit_hook_response()helper inhooks/rtk-rewrite.shto deduplicate JSON response constructionscripts/_test_harness.sh) from duplicatedassert_ok/assert_exit/color/summary code acrosstest-aristote.shandtest-ruby.shsource _test_harness.shinstead of maintaining ~80 lines of identical boilerplateeach
NOTE:comments in hook files explaining why dependency guards remain duplicated (hooks must beself-contained for deployment)
Includes same upstream fixes as other branches (truncation accuracy from #833, copilot integration, swift test
support, read default/safety).
Test plan
scripts/test-aristote.shandscripts/test-ruby.shstill run correctly with shared harnesscargo fmt --all && cargo clippy --all-targets && cargo testdevelopafter feat(refacto-codebase-onboarding): partie 1 - folders and technical docs #826 refactor