Repository navigation
feat: name an Outfit with alias/unalias and complete it with TAB - #18
Merged
Merged
Conversation
`outfit alias` registers an Outfit under a short name — by default its own ALIAS — and that name then stands in wherever a path goes: apply, unapply, serve, and a leading argument to harness. `outfit unalias` drops it. Resolution lives in readOutfit, the choke point all four share, so one change gives every command the shorthand. A path on disk always beats a registered name, so adding an alias cannot change a command that already worked, and the lookup is gated on the argument being name-shaped, so a path never causes a config read at all. The registry stores the absolute path of the Outfit file rather than its directory, which keeps serve's relative PRESET resolving next to the aliased Outfit. The registry shares outfit's config file with the default-harness preference, so ownership of that file moves to a new leaf package, internal/config, where every write is a read-modify-write and neither setting can clobber the other. harness keeps its LoadPreference/SavePreference API and delegates. Also adds `outfit completion bash`, which prints a completion script driven by a hidden `outfit __complete`: TAB now offers commands, each command's flags, providers, harnesses, and — the point — your registered alias names, listing every match when several remain. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X2JtqNGP3SPhqeTzWFGf3G
`outfit completion` now prints a script for zsh and powershell as well as bash. The `__complete` helper was already shell-agnostic — candidates plus a :nofile/:file/:dir directive — so each shell needs only a thin script that hands over the words and inserts a result. The one shared change is in completions(): bash tokenizes `--outfit=foo` into three words on the `=`, but zsh and powershell pass it as one, so the helper now also recognises the attached `--flag=value` form. That makes `--outfit`/-O, whose value must be attached, completable in every shell. The zsh script doubles as a sourced script and an autoloaded `_outfit` in $fpath; goreleaser now installs bash and zsh completions on `brew install`. PowerShell is best-effort: it offers the same candidates and falls back to its own path completion when none match. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0133vx4Ro9QiKySZTfgdF1rT
Two behaviour gaps on this branch went untested: completing --model/-m from the catalogue (modelNames had no coverage at all), and the property that a config outfit cannot parse still lets the harness launch — the leading word is forwarded rather than erroring. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0133vx4Ro9QiKySZTfgdF1rT
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.
Register an Outfit under a short name and use it anywhere a path goes, with tab completion for bash, zsh, and PowerShell.
Summary
outfit alias [path]registers an Outfit under a short name — by default its ownALIAS— andoutfit unalias <name>drops it. The name then stands in wherever a path goes:apply,unapply,serve, and a leading argument toharness.-n/--nameoverrides the name (required when the Outfit has noALIAS),-F/--forcere-points an existing name, and-l/--listshows every name with its path, marking any whose file has gone.outfit showgrew anAliases:section too.outfit completion <bash|zsh|powershell>prints a tab-completion script. TAB completes commands, flags, providers, harnesses, and your registered aliases;outfit unalias <TAB>offers exactly the names you have.internal/configwhere every write is read-modify-write and neither setting can clobber the other.harnesskeeps itsLoadPreference/SavePreferenceAPI and delegates.docs/outfit-file.md,AGENTS.md) and Homebrew completion install (.goreleaser.yaml) updated to match.Implementation details
readOutfitis the choke pointapply/unapply/serve/harness --outfitalready share, so teaching it aliases gives every command the shorthand at once, with no change to those call sites.serve(and the test suite) independent of outfit's own config.serve's relative-PRESETresolution still lands next to an aliased Outfit.harnesspositional. The first argument is taken as an Outfit only when no--outfitwas given, flag parsing was not terminated by an explicit--, and it names one; a--immediately after a consumed Outfit is dropped, so every other command line is forwarded byte-for-byte.outfit __completeemits candidates plus a:nofile/:file/:dirdirective; each shell script is a thin wrapper. bash tokenizes--outfit=fooon the=while zsh and PowerShell pass it whole, so the helper recognises both the split and attached--flag=valueforms — the only way to complete--outfit/-O, whose value must be attached.