Commit f1ca11a
feat(vault): vault config + vault purge (PRD §7.1)
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>1 parent d0ad250 commit f1ca11a
8 files changed
Lines changed: 600 additions & 3 deletions
File tree
- crates/vault-cli
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
13 | 42 | | |
14 | 43 | | |
15 | 44 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
47 | 64 | | |
48 | 65 | | |
49 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | 31 | | |
35 | 32 | | |
36 | 33 | | |
| 34 | + | |
| 35 | + | |
37 | 36 | | |
| 37 | + | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| 43 | + | |
0 commit comments