> ## Documentation Index
> Fetch the complete documentation index at: https://capy.sc/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# capy edit: Interactive TUI for Secret Editing

> Edit and rotate secrets in a two-pane TUI. Reveal values, edit inline, commit and push — r e c q keybindings, with conflict status indicators per row.

## Synopsis

```bash theme={null}
capy edit
```

## Description

Opens a two-pane TUI for the current project and branch:

* **Left pane** lists every variable known to the project (pinned ∪ local ∪ remote) with its key, an `abc…xyz` value snippet, drift status, and an updated label.
* **Right pane** is an inspector for the selected row — the value (shown as a snippet by default; `r` reveals the full value; long values wrap), the row's status, and which side last moved.
* **Top status row** summarizes the active branch, total tracked variables, drift count, and conflict count.

Edits buffer in memory. Pressing `Enter` after typing a new value updates the in-memory buffer; nothing lands on disk until you commit. Choosing **commit & push** runs the same pipeline as the conflict-resolver's "commit and push all local values" action: re-encrypts the merged local state, updates `keep.lock` pins, uploads ciphertext to the service, and bumps sync state.

## Example

```text theme={null}
  capy edit: my-app (development)

  development         12 tracked              2 drift              0 conflicts
  active branch       shown as abc…xyz snip… changed local/remote all clear

  Variables                                              │  DATABASE_URL
  KEY              VALUE        STATUS         UPDATED   │
> DATABASE_URL     pos…dev      * local        local     │  status   * local
  API_KEY          sk_…wxy      * in sync      in sync   │  updated  local
  STRIPE_KEY       sk_…abc      * remote       remote    │
  …                                                      │  value
                                                         │  pos…dev

  ↑↓ navigate · r reveal · e edit · c commit & push (1) · q quit
```

## Keys

In the variables list:

| Key             | What it does                                               |
| --------------- | ---------------------------------------------------------- |
| `↑` / `↓`       | Move the cursor                                            |
| `r`             | Reveal the full value of the selected row (toggle to hide) |
| `e`             | Edit the value of the selected row inline                  |
| `c`             | Commit & push all pending edits (only shown when dirty)    |
| `q` or `Ctrl-C` | Quit. If you have uncommitted edits, you'll be prompted    |

While editing a value (after `e`):

| Key         | What it does                                |
| ----------- | ------------------------------------------- |
| typing      | Append to the in-memory buffer              |
| `Backspace` | Trim the buffer                             |
| `Enter`     | Buffer the edit (still uncommitted on disk) |
| `Esc`       | Cancel without buffering                    |

When quitting with uncommitted edits:

| Key          | What it does                     |
| ------------ | -------------------------------- |
| `c`          | Commit & push and exit           |
| `d`          | Discard pending edits and exit   |
| `k` or `Esc` | Keep working — return to the TUI |

## Statuses

| Status     | Meaning                                                           |
| ---------- | ----------------------------------------------------------------- |
| `in sync`  | Pinned, local, and remote all match.                              |
| `local`    | Local differs from pinned. Remote still matches pinned.           |
| `remote`   | Remote differs from pinned. Local still matches pinned.           |
| `conflict` | All three sides differ. Resolve via [`capy`](/cli/capy).          |
| `unknown`  | Remote couldn't be reached — TUI is running with local-only data. |

## When to use `capy edit` vs editing `.env` directly

Both flows work. Pick whichever fits the moment:

* **`capy edit`** — when you want to see what's set, mask/reveal values without exposing them to your editor's buffer, or change a single variable without thinking about encryption. Always commits and pushes in one step.
* **Edit `.env` directly** — when you're already in your editor adding a brand-new variable as plaintext, or rotating multiple values alongside code changes. Run [`capy`](/cli/capy) afterward to encrypt and reconcile. See [Editing secrets](/using/editing-secrets).

## See also

* [Editing secrets](/using/editing-secrets) — the two ways to change values, side by side
* [`capy`](/cli/capy) — full sync loop, reconciles drift after a direct `.env` edit
* [`capy push`](/cli/push) — push local changes without pulling
