Skip to content

feat(vault-tui): create/edit cards in the add/edit form#26

Merged
UnbreakableMJ merged 1 commit into
mainfrom
tui-card-write
Jun 15, 2026
Merged

feat(vault-tui): create/edit cards in the add/edit form#26
UnbreakableMJ merged 1 commit into
mainfrom
tui-card-write

Conversation

@UnbreakableMJ

Copy link
Copy Markdown
Contributor

What

The TUI's a/e form now creates and edits card (type 3) ciphers, not just logins and secure notes. Cards were already readable in the TUI (PR #24) and writable via the CLI (PR #25) — this closes the gap so the TUI can write them too.

No backend change. It builds the CardWrite payload that already rides Request::Add/Edit.

How (crates/vault-tui/ only)

  • app.rs — the Type row now cycles login → secure note → card. blank_fields/visible_fields grow the card rows (Holder / Brand / Number / Expiry / CVV; Number + CVV mask while unfocused, like Pass). submit splits the single MM/YYYY Expiry field via a local parse_expiry (mirrors the CLI's split_expiry) and packs the card fields into FormSubmit (number/code redacted in Debug). new_edit takes the cached DetailView and prefills Brand/Expiry; secrets — and the cardholder, which has no fetch selector yet — start blank = leave-unchanged.
  • main.rssubmit_form builds card: Option<CardWrite> when the type is a card and threads it into both Request::Add and Request::Edit.

Tests

  • card add carries split expiry + Debug-redacts the number/CVV
  • card edit prefills Brand/Expiry from the detail pane and diffs only the changed expiry
  • parse_expiry (both year widths + rejects garbage)
  • updated type_toggle_swaps_visible_fields_preserving_values for the 3-way cycle

cargo fmt --check, fresh-isolated clippy -D warnings, cargo test --workspace --all-targets (69 TUI tests), cargo deny check, and both headless builds all clean.

Out of scope (tracked follow-ups)

  • Identity TUI editing — blocked on an identity-write backend (proto IdentityWrite + from_plain identity branch + agent apply + CLI parity); that's its own slice, then identity slots into this same form.
  • A Field::CardCardholder selector so the card edit form (and detail pane) can prefill/show the cardholder.

🤖 Generated with Claude Code

The TUI `a`/`e` form now composes card (type 3) ciphers, not just logins
and secure notes. No backend change — it builds the `CardWrite` payload
that already rides `Request::Add`/`Edit` (CLI write path, PR #25).

- app.rs: the Type row cycles login → secure note → card; `blank_fields`
  / `visible_fields` grow the card rows (Holder/Brand/Number/Expiry/CVV,
  with Number+CVV masked while unfocused). `submit` splits a single
  `MM/YYYY` Expiry field via a local `parse_expiry` (mirrors the CLI's
  `split_expiry`) and packs the card fields into `FormSubmit` (number/code
  redacted in `Debug`). `new_edit` takes the cached `DetailView` and
  prefills Brand/Expiry; secrets and the (unfetchable) cardholder start
  blank = leave-unchanged.
- main.rs: `submit_form` builds `card: Option<CardWrite>` when the type is
  a card and threads it into both Add and Edit.
- Tests: card add carries split expiry + redacts secrets, card edit
  prefill/diff, `parse_expiry`; updated the type-toggle test for the
  3-way cycle.
- docs: README TUI card note, CHANGELOG entry.

Identity TUI editing stays pending — it needs an identity write backend
first (no `IdentityWrite`/`from_plain` identity path yet).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@UnbreakableMJ
UnbreakableMJ merged commit 05c8cc6 into main Jun 15, 2026
8 checks passed
@UnbreakableMJ
UnbreakableMJ deleted the tui-card-write branch June 15, 2026 22:02
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