refactor: move shared helpers to their correct files - #181
Open
nathanjcochran wants to merge 4 commits into
Open
refactor: move shared helpers to their correct files#181nathanjcochran wants to merge 4 commits into
nathanjcochran wants to merge 4 commits into
Conversation
nathanjcochran
marked this pull request as ready for review
August 3, 2026 21:53
Askir
approved these changes
Aug 4, 2026
| @@ -0,0 +1,81 @@ | |||
| package cmd | |||
|
|
|||
Contributor
There was a problem hiding this comment.
any opinion about giving files like this one that do not contain any actual cli command a different name so they are more easily identifiable (like the _test for the test files)?
E.g. password_util.go or password_helper.go?
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.
Follow-up to #179, addressing review feedback about where shared helpers should live.
The main outcome is a written-down rule for helper placement in CLAUDE.md — place a helper by who calls it, working down the list until one matches:
internal/util.internal/common.Applying it:
terminal.goforcheckStdinIsTTY,readPasswordFromTerminal, andreadString.password.gofor the password rotation helpers shared bydb connectandservice update-password.completion.go(serviceIDCompletion,configOptionCompletion,mcpGetCompletion), matching how ghost does it.generateSecurePasswordmoved tointernal/utilasutil.GenerateSecurePassword.read_replica.goandpassword_recovery.gofolded intodb_connect.go— both were reachable only fromdb connect.service listoutput chain moved out ofservice.gointoservice_list.go, and MCP'sServiceInfo/convertToServiceInfoout ofutils.gointoservice_list.go.Also fixed two stale
.goreleaser.ymlreferences in CLAUDE.md.As with #179 this is a pure reorganization — every moved declaration is byte-identical to before, verified by diffing declaration text against main. The exceptions are exporting
GenerateSecurePasswordplus its two call sites, and splitting onevarblock so the terminal helpers could move independently.