refactor: extract magic strings, decompose long functions, standardize error display#628
Open
refactor: extract magic strings, decompose long functions, standardize error display#628
Conversation
…e error display
- Add WORKTREE_ADMIN_PREFIX constant to naming.rs alongside KILD_BRANCH_PREFIX
- Use kild_branch_name() instead of raw format!("kild/{}") in pr.rs, detail_view.rs
- Use KILD_BRANCH_PREFIX in kild_branch_name() function body
- Add SHIM_VERSION constant for tmux version string in shim commands
- Extract kill_tracked_agents() from destroy_session() (127 lines → helper)
- Extract sweep_ui_daemon_sessions() from destroy_session() (55 lines → helper)
- Extract resolve_resume_args() from open_session() (46 lines → helper)
- Add display_operation_error() helper for consistent CLI error formatting
- Standardize error display across open, hide, focus, diff, health, stats,
sync, commits, and teammates commands to use color::error() consistently
Closes #438
…t helpers
- Restore non-fatal comment on daemon cleanup in kill_tracked_agents()
- Change WORKTREE_ADMIN_PREFIX to pub(crate) — no external callers
- Replace raw format!("kild/...") in cleanup/handler.rs and overlaps.rs
test helpers with kild_branch_name() / kild_worktree_admin_name()
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
WORKTREE_ADMIN_PREFIX,SHIM_VERSION, and usekild_branch_name()/KILD_BRANCH_PREFIXconsistently instead of rawformat!("kild/...")literalskill_tracked_agents()andsweep_ui_daemon_sessions()fromdestroy_session(),resolve_resume_args()fromopen_session()display_operation_error()helper and consistentcolor::error()usage across 9 command handlersTest plan
cargo fmt --checkpassescargo clippy --all -- -D warningspassescargo test --allpasses (3 pre-existing env-dependent test failures unrelated to this change)Closes #438