- Commander.js-based CLI with subcommands - Document commands: list, get, create, update, delete, export, add-tags - Library commands: list, get, create, tree - Tag commands: list, docs - Auth commands: login, status - Axios-based API client with error handling - Config loader for ~/.config/simplenote/config.json - Chalk for colored output
132 lines
2.3 KiB
Markdown
132 lines
2.3 KiB
Markdown
# SimpleNote CLI
|
|
|
|
CLI para gestión de documentos SimpleNote. Diseñado para comunicación de agentes con el API de SimpleNote Web.
|
|
|
|
## Requisitos
|
|
|
|
- Node.js 18+
|
|
|
|
## Instalación
|
|
|
|
```bash
|
|
npm install
|
|
```
|
|
|
|
## Configuración
|
|
|
|
Copia `.env.example` a `.env` o configura manualmente:
|
|
|
|
```bash
|
|
mkdir -p ~/.config/simplenote
|
|
cat > ~/.config/simplenote/config.json << EOF
|
|
{
|
|
"apiUrl": "http://localhost:3000/api/v1",
|
|
"token": "snk_your_token_here"
|
|
}
|
|
EOF
|
|
```
|
|
|
|
## Uso
|
|
|
|
### Autenticación
|
|
|
|
```bash
|
|
# Login con token
|
|
simplenote auth login snk_your_token
|
|
|
|
# Verificar status
|
|
simplenote auth status
|
|
```
|
|
|
|
### Documentos
|
|
|
|
```bash
|
|
# Listar documentos
|
|
simplenote doc list
|
|
simplenote doc list --tag backend --type requirement
|
|
|
|
# Ver documento
|
|
simplenote doc get <id>
|
|
|
|
# Crear documento
|
|
simplenote doc create --title "API Design" --tags "backend,api" --type requirement --library <lib-id>
|
|
|
|
# Actualizar documento
|
|
simplenote doc update <id> --title "New Title" --content "New content"
|
|
|
|
# Eliminar documento
|
|
simplenote doc delete <id>
|
|
|
|
# Exportar como markdown
|
|
simplenote doc export <id>
|
|
|
|
# Agregar tags
|
|
simplenote doc add-tags <id> --tags "new-tag,another"
|
|
```
|
|
|
|
### Librerías
|
|
|
|
```bash
|
|
# Listar librerías raíz
|
|
simplenote lib list
|
|
|
|
# Ver contenido de librería
|
|
simplenote lib get <id>
|
|
|
|
# Crear librería
|
|
simplenote lib create --name "Backend Requirements"
|
|
simplenote lib create --name "API Specs" --parent <parent-id>
|
|
|
|
# Ver árbol completo
|
|
simplenote lib tree <id>
|
|
|
|
# Listar sub-librerías
|
|
simplenote lib list --parent <id>
|
|
```
|
|
|
|
### Tags
|
|
|
|
```bash
|
|
# Listar todos los tags
|
|
simplenote tag list
|
|
|
|
# Ver documentos con tag
|
|
simplenote tag docs backend
|
|
```
|
|
|
|
## Opciones Globales
|
|
|
|
- `--api-url <url>` - Override la URL del API
|
|
- `--verbose` - Modo verbose
|
|
- `--help` - Help
|
|
- `--version` - Versión
|
|
|
|
## Ejemplo de Sesión
|
|
|
|
```bash
|
|
$ simplenote auth login snk_a1b2c3d4e5f6
|
|
✓ Token verified. Logged in.
|
|
|
|
$ simplenote lib list
|
|
Root Libraries:
|
|
550e8400 Default Library
|
|
Documents: 0
|
|
|
|
$ simplenote doc create --title "API Auth" --tags "backend,auth" --type requirement --library 550e8400
|
|
Document created: 770e8400...
|
|
|
|
$ simplenote doc list --tag backend
|
|
Documents (1 total):
|
|
770e8400 API Auth
|
|
Type: requirement | Status: draft | Tags: backend, auth
|
|
|
|
$ simplenote tag list
|
|
Tags (2 total):
|
|
backend (1 docs)
|
|
auth (1 docs)
|
|
```
|
|
|
|
## Licencia
|
|
|
|
MIT
|