---
name: keepass_set
kind: function
lang: bash
domain: infra
version: "1.0.0"
purity: impure
signature: "keepass_set(entry: string, password: string, username?: string, url?: string)"
description: "Crea o sobreescribe una entry en el KeePassXC database. Auto-detecta si existe (edit) o no (add). Soporta username y url opcionales."
tags: [keepass, keepassxc, secret, credential, set, write]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: "error_go_core"
imports: []
params:
  - name: entry
    desc: "path de la entry (ej. 'Servers/prod-mysql'); si el grupo no existe falla"
  - name: password
    desc: "password en texto plano a almacenar"
  - name: username
    desc: "username opcional"
  - name: url
    desc: "url opcional"
output: "ninguno (exit 0 si OK)"
tested: false
tests: []
test_file_path: ""
file_path: "bash/functions/infra/keepass_set.sh"
---

## Ejemplo

```bash
source keepass_set.sh
keepass_set "Servers/prod-mysql" "secret123" "admin" "https://prod.example.com"
```

## Notas

- Add: `keepassxc-cli add -p`. Edit: `keepassxc-cli edit -p`.
- Existencia detectada via `show -q` (exit code).
- El grupo (parte antes del ultimo `/`) debe existir; KeePassXC no auto-crea jerarquia.
