Add completion auto-install and uninstall#1488
Draft
mnorth-stripe wants to merge 2 commits intoplugin-completion-protocolfrom
Draft
Add completion auto-install and uninstall#1488mnorth-stripe wants to merge 2 commits intoplugin-completion-protocolfrom
mnorth-stripe wants to merge 2 commits intoplugin-completion-protocolfrom
Conversation
This was referenced Mar 15, 2026
Contributor
Author
|
PR stack (3 of 3)
|
Adds --install and --uninstall flags to `stripe completion` that automatically write the completion script and configure the user's shell profile. Detects and warns about pre-existing manual completion references to avoid double-loading. Also adds the plugin completion protocol: when a plugin command receives tab completion requests, the host CLI invokes the plugin binary with Cobra's __complete protocol and returns the results. Committed-By-Agent: claude
e39678d to
e70818d
Compare
Show users a line-numbered, colorized diff of proposed changes to their shell config file before prompting for confirmation. This replaces the plain-text description that was used previously. - Add RenderDiff in pkg/ansi for colorized diff output with context lines, multi-hunk support, and dark green/red true-color backgrounds - Refactor sentinel functions into pure compute functions (no I/O) - Inline read → compute → diff → confirm → write flow in callers - Remove dead addSentinelBlock/removeSentinelBlock functions - Add early shell validation, Long/Example help text, quoted source paths - Delete orphaned pkg/cmd/configdiff.go Committed-By-Agent: claude
233722f to
a91fae7
Compare
Collaborator
|
Do we actually need a colorized diff? I'm unsure if it's meaningfully useful, especially as a default feature. Also the pr title is confusing me, this isn't auto-installing or uninstalling? |
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
Add a colorized diff preview when
stripe completion --installor--uninstallmodifies shell config files. Users see the exact changes before approving.pkg/ansi/diff.go) with line numbers, context lines, multi-hunk support, and dark green/red true-color backgroundscomputeAddSentinel/computeRemoveSentinelfunctions (no I/O) for sentinel block manipulationLong/Examplehelp text, quoted source pathsstripe completion --install(new file)stripe completion --uninstall(lines removed)~/.zshrc: 1 export PATH=/usr/local/bin:$PATH 2 alias ll='ls -la' - 3 -# begin stripe-completion - 4 -source "/Users/jane/.stripe/stripe-completion.zsh" - 5 -# end stripe-completion Apply changes? [y/N]stripe completion --helpTest plan
go test ./pkg/ansi/...— 15 diff renderer tests (new file, add/remove/replace, multi-hunk, context capping, line alignment)go test ./pkg/cmd/...— pure function tests forcomputeAddSentinel/computeRemoveSentinel,readConfigFile, install/uninstall integration tests, confirmation accept/decline, manual remnant warningsgolangci-lintpasses--color off,CLICOLOR=0, non-TTY piping (viaansi.Color(w))