refactor(cli): migrate from Kong to Cobra#785
Merged
Conversation
Replace alecthomas/kong with spf13/cobra for argument parsing. This gives us built-in shell completion generation (replacing 170 lines of hand-written scripts) and lipgloss-styled help output via a custom helpFunc using the Wong palette. Key changes: - Root command is the TUI launcher; subcommands (backup, config, completion) attach as children -- identical behavior to Kong's default:"withargs" - Run functions accept io.Writer from cmd.OutOrStdout() so tests can capture output in-process without building a binary - Config edit and backup accept injectable parameters (config path, env DB path) for testability - CLI tests run in-process via executeCLI() helper, dropping test time from ~10s to ~100ms by eliminating 4 redundant go build invocations - Only TestVersion_DevShowsCommitHash still needs a real binary (for VCS info), built lazily via sync.Once Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files
🚀 New features to boost your workflow:
|
Handle errcheck on fmt.Fprint/Fprintln calls, replace exec.Command with exec.CommandContext, rename unused parameters to _, and remove unused envWithEditor function. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Document the implicit MICASA_DB_PATH env var contract on resolveDBPath and extract resolveBackupSource to consolidate two-path source logic into a single method. Remove t.Parallel from TestVersion_Injected to prevent a data race on the mutable version global, add TestMain for test binary cleanup, use context.WithTimeout in getTestBin for real cancellation value, and unify errcheck suppression style to _, _ = across all CLI files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
cpcloud
added a commit
that referenced
this pull request
Mar 19, 2026
…nd sync device management Add the non-CLI foundation for micasa pro commands: - crypto: SaveDeviceToken/LoadDeviceToken with atomic writes and 0600 perms - sync: NewManagementClient constructor for management-only calls - sync: Client methods for all relay endpoints (CreateHousehold, Invite, Join, Status, ListDevices, RevokeDevice, key exchange) - data: RelayURL field on SyncDevice, GetSyncDevice/UpdateSyncDevice/ UpdateOplogDeviceIDs store methods, GormDB accessor for sync layer CLI wiring deferred until #785 (Cobra migration) merges. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
cpcloud
added a commit
that referenced
this pull request
Mar 19, 2026
…nd sync device management Add the non-CLI foundation for micasa pro commands: - crypto: SaveDeviceToken/LoadDeviceToken with atomic writes and 0600 perms - sync: NewManagementClient constructor for management-only calls - sync: Client methods for all relay endpoints (CreateHousehold, Invite, Join, Status, ListDevices, RevokeDevice, key exchange) - data: RelayURL field on SyncDevice, GetSyncDevice/UpdateSyncDevice/ UpdateOplogDeviceIDs store methods, GormDB accessor for sync layer CLI wiring deferred until #785 (Cobra migration) merges. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
cpcloud
added a commit
that referenced
this pull request
Mar 19, 2026
Co-authored-by: Claude Opus 4.6 <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
alecthomas/kongwithspf13/cobrafor CLI argument parsing--helpoutput using Wong palette colors via customhelpFuncio.Writerfromcmd.OutOrStdout()for in-process testabilityexecuteCLI()helper instead of building a binary, droppingcmd/micasatest time from ~10s to ~100msvendorHashinflake.nixfor changedgo.sum🤖 Generated with Claude Code