refactor(completion): use @gunshi/plugin-completion; upgrade gunshi 0.34→0.36#9
Merged
Merged
Conversation
….34→0.36 Replace the hand-rolled @bomb.sh/tab shell completion with gunshi's official completion plugin. Subcommands and every flag are now derived automatically from each command's `args` schema, so the duplicated FLAGS / JSR_FLAGS tables (which could silently drift from the real command definitions) are gone. - Bump gunshi 0.34.0 → 0.36.0, drop the direct @bomb.sh/tab dependency, add @gunshi/plugin-completion (pulls @bomb.sh/tab + @gunshi/plugin transitively). - Register the plugin via `plugins: [completionPlugin()]` and remove the manual `maybeHandleCompletion` argv intercept in cli.ts. - completion.ts now only supplies the dynamic-value handlers (workspace package names, --provider, --permissions). - Declare the `packages` positional in npmArgs / jsrArgs so the plugin can complete it; commands still read selectors via `selectorsOf(ctx)`. Bonus: it's now documented in --help under ARGUMENTS. Verified: typecheck + build clean; package/--provider/--permissions/jsr completions and shell-script generation work; runtime selector parsing unchanged.
|
The changes in this PR will be included in the next version bump.
|
7f9e72e to
a3c6e5a
Compare
Mirrors the bumpy repo's pre-push setup, scoped to fledgling's tooling (no oxlint/oxfmt here). `postinstall: lefthook install` registers the hook on `bun install`.
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.


What & why
We were two minors behind on gunshi (
0.34.0, latest0.36.0) and hand-rolling shell completion by calling@bomb.sh/tabdirectly, with a manualmaybeHandleCompletionargv intercept ahead of gunshi. gunshi ships an official@gunshi/plugin-completion— built on the same@bomb.sh/tab— that derives subcommands and flags straight from each command'sargsschema.Changes
0.34.0 → 0.36.0.@bomb.sh/tabdependency; add@gunshi/plugin-completion(pulls@bomb.sh/tab+@gunshi/plugintransitively).plugins: [completionPlugin()]and remove the manualmaybeHandleCompletionintercept incli.ts.FLAGS/JSR_FLAGStables — flags now come from the realargsdefinitions, so they can't drift.completion.tsshrinks to just the dynamic-value handlers (package names,--provider,--permissions).packagespositional innpmArgs/jsrArgsso the plugin can complete it; commands still read selectors viaselectorsOf(ctx). Bonus: it's now documented in--helpunderARGUMENTS.Net: −105 / +60 lines, completion stays in lockstep with command definitions.
Notes
@gunshi/plugin-i18n@0.36.0comes in as a transitive peer of the completion plugin. It's declaredoptional: trueat runtime and we don't reference it — descriptions just aren't localized (same as before).completesubcommand is now visible infledgling --help(it's a real gunshi command the plugin registers, not an argv intercept). Harmless / more discoverable.Verification
bun run typecheck+bun run build: clean.fledgling complete -- …: workspace package names,--provider(github/gitlab/circleci),--permissions(publish/stage/both), andjsrpackages all resolve. Shell-script generation works for zsh/bash/fish/powershell.add <pkg> --dry-runtargets correctly; unknown selectors are rejected with the right error.