refactor: simplify all scripts (Agent 1, 2, 3 consolidation)#25
Closed
glauberlima wants to merge 3 commits intomainfrom
Closed
refactor: simplify all scripts (Agent 1, 2, 3 consolidation)#25glauberlima wants to merge 3 commits intomainfrom
glauberlima wants to merge 3 commits intomainfrom
Conversation
- Define marker constants (@CONFIG_START, @MESSAGES_START, etc) in patch-statusline.sh - Use constants instead of string literals throughout - Remove redundant JSON validation (replace_messages_block already validates) - Extract run_check() helper in shellcheck.sh to consolidate bash/shellcheck loops - Extract run_path_security_test() helper in integration.sh for path-based security tests - Net reduction: 7 lines while maintaining full test coverage
…n helpers - Extract compare_versions() helper for major/minor version comparison - Refactor check_bash_version() and check_git_version() to use helper - Add generic prompt_menu() function supporting piped/interactive modes - Replace prompt_language_selection() and prompt_component_selection() with thin wrappers - Remove redundant trailing 'return 0' from 8 functions (functions propagate exit status) - Net reduction: 67 lines while maintaining full functionality
statusline.sh optimizations: - Rewrite get_random_message_color() from 23 lines to 3 using bash array - Simplify build_progress_bar() clamping with ternary arithmetic (1 line vs 5) - Consolidate append_if() null checks into single compound test - Remove 7+ unnecessary IFS save/restore patterns (IFS already scoped to commands) tests/unit.sh optimization: - Merge duplicate tier boundary tests into data-driven loop (lines 90-153) - Covers all critical values: 0, 10, 19, 20, 21, 40, 41, 60, 61, 80, 81, 100 - Same coverage with 57 fewer lines (61 tests vs previous 68) Net reduction: ~75 lines across both files while maintaining 100% test coverage
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.
Consolidates 3 parallel agent refactoring efforts into single PR:
Agent 1: statusline.sh + tests/unit.sh
Agent 2: install.sh
Agent 3: patch-statusline.sh + test infrastructure
Verification
All tests pass. Ready for merge.