The adopt rollback restored the worktree but not the index. Every move it makes is a plain rename as far as git is concerned -- the stash move out from under the index most of all -- so a rolled-back adopt left a half-applied rename staged against a clean vault. No bytes were at risk and the next ordinary run's `git add -A` healed it, but a hand `git commit` in that window recorded the half-applied state. Both rollback sites now re-read projects/ once the worktree is whole again, the stash restore included. projects/ is named whole rather than the two entries, because `git add` refuses a pathspec that matches nothing -- which one of the two always is, once it has been moved back -- and then stages neither. The stash itself moves from the vault root into .git/, where neither the entry walk nor `git add -A` can reach it, so a crash between the two moves can no longer leave junk at the vault root for the next run to commit. A vault whose .git is not a directory falls back to the root, which the scaffolded .gitignore now covers. --status and --restore walked the vault with a fish glob, which does not match dot-led names. A dot-led slug is both reachable and sanctioned: the sibling-bare-mirror idiom (`git remote add origin ../mirror.git`) keys as ..-mirror, a dot-led host keys as .hidden.example.com-o-r, and --adopt accepts a leading dot on purpose. Such an entry is scaffolded, linked, committed and pushed normally, yet --status under-reported it and batch --restore left that project unlinked, both without saying so. Both walks now list the directory instead. The --adopt completion gains -A for the same reason: an entry that cannot be completed reads as one that is not there. The now-fatal push failure is painted as an error rather than a warning, matching its sibling on the commit path. The header notes that --adopt does not pin a name. The slug is re-derived on every run, so the next ordinary run migrates the adopted entry back to the canonical key, memory and live link following. Behaviour unchanged; only the documentation gap is closed. Tests, 173 -> 209 checks. The whole stash branch of --adopt was uncovered, because the existing atomicity test adopts onto a slug with no entry at all: a successful stash-adopt and a stash-adopt whose relink fails are both pinned now, the latter asserting an empty `git status --porcelain` and a still-reachable live memory. The stash location is pinned by making the vault root unwritable for the duration, which only a stash at the root would need. agents-vault's own propagation of a failed sync had no test at all -- the third recurrence of fish's branchless-`if` false zero here -- so both ways it can fail are now driven end to end: a rejecting pre-commit at the vault's own core.hooksPath, and a real rebase conflict against a bare remote. A dot-led entry is asserted in --status and in --restore.
22 lines
1.3 KiB
Fish
22 lines
1.3 KiB
Fish
# Copyright (C) 2026 Rootiest
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
#
|
|
# Completions for agents-vault.
|
|
|
|
complete -c agents-vault -f
|
|
complete -c agents-vault -s h -l help -d 'Show help message'
|
|
complete -c agents-vault -l link -d "Ensure this project's memory link only"
|
|
complete -c agents-vault -l push -d 'Commit and push to the vault remote'
|
|
complete -c agents-vault -l restore -d 'Relink everything possible, report the rest'
|
|
complete -c agents-vault -l status -d 'Show entries, link health, remote, orphans'
|
|
# --adopt takes an existing vault slug, so offer the entries that are
|
|
# actually there; the vault may not exist yet, in which case this is empty.
|
|
# -A because a dot-led slug is legitimate (a relative-path remote keys as
|
|
# ..-mirror), and an entry that cannot be completed reads as one that is
|
|
# not there.
|
|
complete -c agents-vault -l adopt -r -a '(command ls -1A (_agents_vault_dir)/projects 2>/dev/null)' -d 'Bind this project to an existing vault entry'
|
|
complete -c agents-vault -l remote -r -d 'Set the vault remote URL'
|
|
complete -c agents-vault -s v -l verbose -d 'Print all per-step output (default)'
|
|
complete -c agents-vault -s q -l quiet -d 'Print one summary line only if changed'
|
|
complete -c agents-vault -s s -l silent -d 'Suppress all output; errors only'
|