Special Files
Three scopes are named: work@ is the current directory (it does not search
upward), global@ is the CLI alias directory, and special@ gathers the
non-alias files that each have their own dedicated commands — config, tap,
and shell. Only the scope may be abbreviated, to a unique prefix — w@ /
wo@ / wor@, g@, s@.
work@ and global@ look for alias files; special@ is their inverse: it
points at files that are not aliases, each with its own dedicated commands.
None of them is an alias file or an operating-system "system file": config is
byk's own configuration inside the CLI home (~/.byk/), tap is the tap
repositories under ~/.byk/tap/, and shell is the user's shell startup file.
Three special files exist today:
- Special files never take part in alias lookup, and have no
clone/link: there is no notion of several of them referencing each other. - The name after
special@must be a registered special file; a typo reportsUnknown special fileand lists the available names. - Commands follow the name after a space, not a dot:
special@config.setreportsInvalid special file. configandtappoint at byk's own files, so the worst case is falling back to defaults;shellpoints at someone else's file, so it only inserts or removes one marked block and never rewrites the file.
config
Commands
With no command it prints every setting (the common case); -h prints usage
help instead.
get prints a bare value; set / unset report on stderr, so pipelines stay
clean.
Settings
auto hides it when stdout is not a terminal, so byk -h | head, scripts, and
editor plugins get clean output for free. always and never are literal.
When scanning alias files turns up problems, the N alias files have problems
line ignores this setting: it is a warning, not decoration.
The file
- A missing file is normal — every key falls back to its default, no error.
- Unreadable content (broken JSON, a non-object top level) prints one warning
and falls back to defaults with the usual exit code; a broken config must not
take
-hdown with it. - Writes are atomic and keep every key they read, including keys this version does not know yet.
- Keys are written back in alphabetical order, so a hand-written order gets normalized.
- The
Config:line ofbyk --pathsis this file.
tap (special@tap)
special@tap does two things: put a tap repository into
~/.byk/tap/<user>/<repo>, and bring it up to date with upstream — no hand-written
git clone / git pull either way. It only knows git, so add and update
need git on the machine.
<user> and <repo> accept letters, digits, ., -, and _ only: they are
directory names.
Custom sources
The second value is handed to git clone verbatim: https://, ssh://,
git@host:path, file://, and plain local paths all work. There is no
protocol allowlist — git itself already refuses ext:: and friends, where a
URL turns into a command.
<user>/<repo>is only the local name: it decides the directory and the ledger key, says nothing about where the code comes from, and is not checked against the URL — same asbrew tap user/repo URL.- The only requirement is that it does not look like an option: no leading
-, no whitespace, or git would read it as a flag instead of an address. - Without a URL the source is
https://github.com/<user>/<repo>.git. - Private repositories ride on your own ssh keys or credential helper; byk disables interactive prompting, so a failed login errors out instead of waiting for a password.
Updating (update)
Underneath it is just "make the checkout you cloned match upstream" — git fetch
plus git reset --hard, deliberately not git pull:
- a tap is a read-only mirror, there are no local commits to merge, so the merge/rebase semantics buy nothing;
- branches that were force-pushed and tags that were moved still catch up
(
fetch --force); - the shallow clone stays shallow instead of quietly turning into full history.
updatefollows the ledger'sref:update aaa/bbwill not jump back to the default branch just because you left@v1off the command line. Pinned to a tag, an untouched tag means there is nothing to do.updatenever writes the ledger: what is installed and which ref it is pinned to have not changed, only the commits in the checkout.listreads the same before and after.- A checkout with local changes is left alone:
reset --hardwould throw those edits away, so it reportshas local changesand lets you decide (commit, move them aside, orremove+add). - A lost index rolls back: if upstream deleted
byk.tap.json, the update returns to the previous commit rather than leaving a checkout that--tapcannot use. - With no argument, one failure does not stop the rest: every repository is
reported, then a single
Failed to update 1 of 2 tap repositories: …closes the run with exit code 1. - It only touches the ledger:
updatenever looks at a directory yougit cloned in by hand, and a deleted directory reportsTap repository is missing.
Directory and index
The ledger is ~/.byk/tap/index.json, and only special@tap reads or writes it:
- The key is
<user>/<repo>; the directory follows from it, so no absolute paths are stored — moving machines or your home directory cannot make the ledger lie. originis the source host (github.comis writtengithub, and sources without a host arelocal);refis the ref used at install time, and the targetupdatefollows afterwards.urlonly appears when a second value was given: the default source's address is derivable, so storing it would just be a second copy.- Losing the ledger does not affect
clone --tap: it scans directories and never reads this file. You lose a list, not the feature. - Entries that cannot be read are still listed (
origin/refshow?), otherwise you could neither see nor remove them. - Writes are atomic, sharing the same path as
config.json.
Rules of behaviour
addnever overwrites an existing directory;removefirst to change versions.- The repository root must contain a parsable
byk.tap.json, or the install rolls back right after landing and leaves nothing behind — once a local index exists it is authoritative, and a broken one would keep every key of that repository failing. addonly ever runsgit clone --depth 1, so what lands is a real repository you can later pull withgit -C ~/.byk/tap/<user>/<repo> pull. There is no curl + tar fallback: two paths produce different things, need the semantics explained twice, and double the failure surface.addandupdaterequire git (Homebrew's taps do too; it does not bundle git).listandremovedo not — they only read the ledger and delete directories, so they keep working without git. If you have no git and still need a repository in place, put it at~/.byk/tap/<user>/<repo>by hand.removeonly knows the keys in the ledger. A repository yougit cloned in by hand is not in it, soremovereportsnot installedand will not delete it.- A shallow clone carries no history, but
pullworks, andupdatekeeps fetching shallow; switching refs always takesremove+add. - Downloads follow the usual proxy settings such as
BYK_PROXY, translated to git's-c http.proxy. Writing the ledger does not touch the network. - Installing a third-party tap means trusting the alias files it ships.
addonly moves data around; the risk shows up later, whenclone --tapreads those aliases and something runs them.
shell (special@shell)
Manages shell completion: insert one marked block into your shell's startup file, or take it out.
No argument and -h are the same screen, byte for byte: the file has two verbs,
so a separate "status" page would only mean typing twice to find out what can be
done. special@config -h and special@tap -h open with those same few lines.
The item name may be abbreviated to a unique prefix: byk special@shell add comp is
the same as byk special@shell add completion. Only a unique match is accepted —
if a future second item also matched, it reports the ambiguity instead of
picking one.
The target shell is whichever one is running byk; it cannot be named, see
"No switch, no naming a shell" below.
Which file it targets
Not by operating system — by environment. macOS defaults to zsh but /bin/bash
is always there, and Windows has Git Bash. Guessing by OS guesses wrong;
identifying the shell does not. PowerShell is the one place where the OS does
come in: its $PROFILE location differs per operating system — that is
PowerShell's own rule, not guessing the shell.
The bash order is deliberate: a login shell only reads the first three, while
.bashrc is read by non-login interactive shells — so it comes last, and only
when nothing else exists does it tell you which path you are on. Creating
.bash_profile when none exist is safe, because there is nothing for it to
shadow; creating it while .profile exists would shadow that file entirely.
The shell is identified as parent process name → $SHELL. $SHELL names the
login shell, so after exec bash it still says zsh; the parent process is what
is actually running. The name comes from /proc or ps on Unix and a Toolhelp
snapshot on Windows, so powershell.exe / pwsh.exe / bash.exe are recognised
the same way. Only when that is unavailable (restricted environments, editors
that spawn byk directly) does the environment variable take over. special@shell
prints the answer together with where it came from:
The first three are one level: same label colour, one space after the colon and then the value — no padding for alignment, since paths differ so much in length that the filler would outweigh the information. One blank line later comes the usage, so "which file is this" and "what can I do" share a screen instead of costing two runs.
When .zshrc is a symlink into a dotfiles repository, a Target: line in the
same column names the file that is really written — and that is where the write
goes, so the link itself never turns into a regular file.
No switch, no naming a shell
The target follows the environment, so there is neither a "change the startup file" subcommand nor an argument to name one — asking for it is refused, and the refusal says where to run the command instead:
The reason is that this kind of mismatch fails silently: install into
.bash_profile from a zsh terminal and the terminal in front of you does
nothing, with no message saying it went to the wrong place. To set up bash,
run the command in bash — then there is exactly one answer to "which file am I
changing", and it matches both the line special@shell prints and the terminal you
are looking at.
Other shells: cmd, sh
Completion generators cover zsh, bash, fish, and PowerShell (pwsh /
Windows PowerShell 5.1). Running special@shell in any other shell is not an error —
it simply answers that the current shell points at no file:
The screen ends there, with no Usage / Commands: there is no file to edit, so
add and remove cannot do anything on this machine, and a list of commands
that do not apply is just noise. An explicit -h prints the same thing — both
entry points are one output. The reason sits right under the fields, since it
explains Completion: not available, and the screen keeps a blank line above
and below it, just like the zsh one.
The exit code is 0: that is a normal answer, not a failure. Actually changing
something (add / remove) does fail, with exit code 1 and those same two
sentences, because nothing was changed:
When neither the parent process nor $SHELL gives an answer (common in Windows
cmd), the Shell: line reads unknown and the note becomes
Only zsh, bash, fish and PowerShell are supported; run byk from one of them.
To use completion, run byk inside one of those four.
Write rules
This is the only special@ member that edits someone else's file, so its rules
differ from config.json:
- only the marked block (
# The following lines have been added by byk to enable byk cli completions.through# End of byk cli completions) is inserted or removed — every other byte stays, including hand-written order and CRLF endings. The markers are full sentences rather than# >>> ... >>>because a startup file is read by people; - symlinks are written through, and stay symlinks;
- the unmarked bare line earlier
install.shversions wrote is recognised too (uninstall.shmatches it as well):removedeletes it, whileaddonly reports "already enabled" and suggests removing and re-adding; - idempotent: a second
addadds nothing, andremovewith nothing installed does nothing and exits 0.
The installer no longer writes that line — like pip, it only puts the binary in place. Turn completion on once, yourself:
Completion
Each special file owns its grammar, so the candidates come from the file itself rather than from the file-command verb list:
- typing
special@listsconfig,tap, andshell, each with a one-line description; - after
special@config/special@tap/special@shella tab offers the verbs, and-offers--help/-h— those live in the verb slot only, sincespecial@config set -hpasses-htoset; get,set, andunsetcomplete setting names, andset <name>completes that key's values (banner→auto/always/never);removeandupdatecomplete the<user>/<repo>keys in the ledger;addtakes its source from the network, so it offers nothing;addandremovecompletecompletionin the first slot and nothing after it — the target shell comes from the environment, so offeringbashthere would be teaching a command that gets refused.
Verbs that take no arguments (list, get without a name) offer no
candidates, so the shell has nothing to insert.