Add ValidArgsFunction to mount and unmount commands that reads config aliases for tab completion. Install zsh, bash, and fish completion scripts via flake postInstall. Update PLAN.md with post-1.0 roadmap. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3.7 KiB
arca — Post-1.0 Plan
Current State (v1.0.0)
Released. FIDO2/passphrase/keyfile/TPM2 unlock with method sequencing, idempotent mount/unmount, config aliases, init command, status command, NixOS LD_LIBRARY_PATH workaround for cryptsetup token plugins, unit tests, nix flake packaging.
v1.1: Shell completions and verbose mode
M6: Shell completions
Cobra generates completion scripts. Wire them up so alias names complete in the shell.
Files changed
cmd/root.goflake.nix
Work
-
Cobra provides
completionsubcommand by default (arca completion zsh,arca completion bash, etc.). Verify it works. -
Add a custom
ValidArgsFunctiontomountCmdandunmountCmdthat reads the config and returns alias names + device paths fromarca status. This gives dynamic completion for:arca mount <TAB> -> backup media /dev/sda1 arca unmount <TAB> -> backup media -
In
flake.nix, install the zsh completion file to$out/share/zsh/site-functions/_arcaso NixOS picks it up automatically.
M7: Verbose mode
Add -v / --verbose flag to aid debugging (e.g., the FIDO2 plugin
discovery issue we hit during development).
Files changed
cmd/root.gointernal/cryptsetup/cryptsetup.gointernal/unlock/unlock.gointernal/udisks/client.go
Work
-
Add a
--verbose/-vpersistent flag on the root command. Store in a package-levelVerbose bool. -
In
cryptsetup.Open: print the full command being executed (includingLD_LIBRARY_PATHand privilege wrapper). -
In
findTokenPluginDir: print which directory was found (or that none was found). -
In
unlock.Unlock: print which method is being attempted before each try. -
In
udisks.NewClient: print the D-Bus connection status.
Use fmt.Fprintf(os.Stderr, "arca: ...") for verbose output — no
logging framework needed.
v1.2: Config management and cleanup
M8: arca add <device>
Add a single device to an existing config without regenerating everything.
Files changed
cmd/add.go(new)internal/config/config.go
Work
-
New subcommand:
arca add /dev/sda1orarca add --uuid <uuid>. -
Resolve the device via udisks2 to get UUID.
-
Generate a UUID-prefix alias (same as
init). -
Prompt for alias name (default: UUID prefix), methods (default: passphrase), and optional mountpoint.
-
Append to existing config. If the UUID is already configured, print the existing alias and exit.
-
Add
config.Save(*Config)to write the config file (currently onlyinitwrites, with inline marshaling).
M9: init --merge
Merge newly discovered devices into an existing config without overwriting existing entries.
Files changed
cmd/init.gointernal/config/config.go
Work
-
Add
--mergeflag toinit. When set, load existing config first. -
For each discovered device, skip if its UUID already exists in config (regardless of alias name).
-
Add new devices with UUID-prefix aliases.
-
Write the merged config.
This replaces the current --force behavior for the common case of
"I plugged in a new drive."
M10: Mount cleanup
Privileged unmount leaves empty directories under /mnt/.
Files changed
internal/cryptsetup/cryptsetup.gocmd/unmount.go
Work
-
After
Unmount, attemptrmdiron the mount point. Only remove if empty (notrm -rf). -
Use privileged
rmdirsince the directory was created with privilege.
Non-goals
--dry-runflag--jsonoutput forstatus- udev auto-mount on plug
- Keyfile creation/management
- Multiple config files or config includes
- Systemd mount unit integration