Skip to content

feat(vault): vault config + vault purge (PRD §7.1)#6

Merged
UnbreakableMJ merged 1 commit into
mainfrom
config-purge
Jun 13, 2026
Merged

feat(vault): vault config + vault purge (PRD §7.1)#6
UnbreakableMJ merged 1 commit into
mainfrom
config-purge

Conversation

@UnbreakableMJ

Copy link
Copy Markdown
Contributor

Summary

Adds a persistent typed config file and the two remaining PRD §7.1 verbs (config get/set/unset, purge), then wires the config into the CLI's agent auto-spawn so a saved clipboard/idle-lock interval actually takes effect. CLI-only — no protocol, agent-code, or TUI changes; the agent still receives knobs as the launch flags it already accepted.

Config — known-key registry

  • File at $XDG_CONFIG_HOME/vault/config.toml.
  • vault config set <key> <value> validates the key and parses the value to its type — a typo or non-numeric value is rejected at write time, not silently kept. unset clears; get with no key lists every known key + effective value. --json on all three.
  • Atomic writes (tempfile + rename, mirroring vault-store::write_atomic).
  • Recognised keys this release: clipboard.clear_secs and agent.idle_lock_secs (both u64, 0 disables). The registry is structured to grow into the rest of §7.1 (clipboard.backend, set vim, …).

Wired into auto-spawn

  • spawn_and_connect sources those two knobs from config and appends them as agent launch flags — so a saved clipboard.clear_secs finally has a persistent home instead of being flag/env-only. On this path config wins over $VAULT_CLIPBOARD_CLEAR_SECS; a manually launched agent is unaffected. A malformed config is reported and skipped rather than blocking the spawn.

Purge

  • vault purge drops a running agent's in-memory keys (best-effort Lock via a direct, hint-free connect — never auto-spawns) and removes the on-disk item cache ($XDG_DATA_HOME/vault). Confirmation-gated like remove (--force to skip; required when stdin isn't a TTY); an absent cache is success.

Dependencies

New toml (MIT/Apache, within deny.toml's allow-list); vault-cli gains dirs/serde/tempfile/vault-store as normal deps.

Tests

Config registry units (set/get/unset round-trips, unknown-key + bad-value rejection, 0 accepted, KNOWN_KEYS reachable by all three ops, TOML serde round-trip) and a pure agent_args test for the config→launch-flags mapping. Workspace: 123 tests green, clippy -D warnings clean, cargo deny clean, headless build green. Verified live: get/set/unset + JSON, rejection paths, auto-spawn flag pass-through (--clipboard-clear-secs 45 --idle-lock-secs 600), malformed-config degradation, and purge (agent lock + cache removal + no-TTY refusal).

🤖 Generated with Claude Code

Add a persistent typed config file and the two remaining settings /
maintenance verbs, then wire the config into the CLI's agent auto-spawn
so a saved interval actually takes effect. CLI-only: no protocol, agent,
or TUI changes — the agent still receives knobs as the launch flags it
already accepted.

Config: $XDG_CONFIG_HOME/vault/config.toml, modeled as a known-key
registry. `vault config set <key> <value>` validates the key and parses
the value to its type (typos and non-numeric values are rejected, not
silently kept); `unset` clears; `get` with no key lists every known key
with its effective value (--json on all three). Atomic writes (tempfile
+ rename, mirroring vault-store::write_atomic). Recognised keys this
release: clipboard.clear_secs and agent.idle_lock_secs (both u64, 0
disables); the registry is shaped to grow into the rest of §7.1.

Auto-spawn: spawn_and_connect sources those two knobs from config and
appends them as agent launch flags, so config wins over the agent's
env/default on this path; a manually launched agent is unaffected. A
malformed config is reported and skipped rather than blocking the spawn
(verified live).

Purge: vault purge drops a running agent's in-memory keys (best-effort
Lock via a direct, hint-free connect; never auto-spawns) and removes the
on-disk item cache (vault_store::default_data_dir()). Confirmation-gated
like remove (--force to skip; required when stdin isn't a TTY); an absent
cache is success.

New toml dependency (MIT/Apache, within deny.toml's allow-list);
vault-cli gains dirs/serde/tempfile/vault-store as normal deps.

Tests: config registry units (round-trips, unknown-key + bad-value
rejection, 0 accepted, KNOWN_KEYS reachable by all three ops, TOML serde
round-trip) and a pure agent_args test for the config→launch-flags
mapping. Verified live: get/set/unset, JSON output, rejection paths,
auto-spawn flag pass-through, malformed-config degradation, and purge
(lock + cache removal + no-TTY refusal).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@UnbreakableMJ
UnbreakableMJ merged commit 39a8403 into main Jun 13, 2026
8 checks passed
@UnbreakableMJ
UnbreakableMJ deleted the config-purge branch June 13, 2026 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant