@freeticket/cli 0.1.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +80 -80
  2. package/dist/index.js +1108 -98
  3. package/package.json +14 -5
package/README.md CHANGED
@@ -9,169 +9,169 @@
9
9
 
10
10
  # FreeTicket CLI
11
11
 
12
- **Tu plataforma de eventos, desde la terminal.**
12
+ **Your event platform, from the terminal.**
13
13
 
14
- Eventos, ventas, tickets, membresías, venues, staff e informes — todo a un comando de distancia.
14
+ Events, sales, tickets, memberships, venues, staff, and reports — one command away.
15
15
 
16
16
  [![npm](https://img.shields.io/npm/v/@freeticket/cli?color=FFD500&label=npm)](https://www.npmjs.com/package/@freeticket/cli)
17
17
  [![CI](https://github.com/AppFreeticket/freeticket-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/AppFreeticket/freeticket-cli/actions/workflows/ci.yml)
18
18
  [![license](https://img.shields.io/badge/license-MIT-07C2BA.svg)](./LICENSE)
19
- [![node](https://img.shields.io/badge/node-%E2%89%A520-07C2BA.svg)](#requisitos)
19
+ [![node](https://img.shields.io/badge/node-%E2%89%A520-07C2BA.svg)](#requirements)
20
20
 
21
21
  </div>
22
22
 
23
23
  ---
24
24
 
25
- ## ✨ Qué es
25
+ ## What it is
26
26
 
27
- `ft` es el cliente de línea de comandos oficial de **FreeTicket**. Consume la
28
- **API REST B2B v1** y te deja inspeccionar y operar tu workspace sin abrir el
29
- dashboard: listar eventos, revisar ventas, exportar compradores, ver KPIs — todo
30
- con salida legible o `--json` para pipelines y scripts.
27
+ `ft` is the official command-line client for **FreeTicket**. It consumes the
28
+ **B2B REST API v1** and lets you inspect and operate your workspace without
29
+ opening the dashboard: list events, review sales, export buyers, check KPIs,
30
+ and use readable output or `--json` for pipelines and scripts.
31
31
 
32
- El cliente se **genera desde el contrato OpenAPI 3.1** del backend, así que cada
33
- endpoint que existe en la API existe como comando, y nunca queda desincronizado.
32
+ The client is **generated from the backend OpenAPI 3.1 contract**, so every
33
+ endpoint exposed by the API exists as a command and never drifts out of sync.
34
34
 
35
- ## 🚀 Instalación
35
+ ## Installation
36
36
 
37
37
  ```bash
38
- # global (recomendado)
38
+ # global install (recommended)
39
39
  npm install -g @freeticket/cli
40
40
 
41
- # o sin instalar
41
+ # or run without installing
42
42
  npx @freeticket/cli whoami
43
43
  ```
44
44
 
45
- Comprobá que quedó instalado:
45
+ Check that it was installed:
46
46
 
47
47
  ```bash
48
48
  ft --version
49
49
  ```
50
50
 
51
- ## ⚡ Quickstart
51
+ ## Quickstart
52
52
 
53
53
  ```bash
54
- # 1. Emití una API key en el backend (lado servidor):
55
- # pnpm api:key tu-email@dominio.com
56
- # → te devuelve una key ft_live_xxxxx (se muestra una sola vez)
54
+ # 1. Issue an API key in the backend (server side):
55
+ # pnpm api:key you@example.com
56
+ # -> returns an ft_live_xxxxx key (shown only once)
57
57
 
58
- # 2. Iniciá sesión (guarda la key en ~/.freeticket/config.json y la verifica)
58
+ # 2. Log in (stores the key in ~/.freeticket/config.json and verifies it)
59
59
  ft login --key ft_live_xxxxx
60
60
 
61
- # 3. ¿Quién soy y a qué workspaces tengo acceso?
61
+ # 3. Who am I, and which workspaces can I access?
62
62
  ft whoami
63
63
 
64
- # 4. Empezá a explorar
64
+ # 4. Start exploring
65
65
  ft events list
66
66
  ft reports summary --period 30d
67
67
  ft sales list --status CONFIRMED --json
68
68
  ```
69
69
 
70
- ## 🧭 Comandos
70
+ ## Commands
71
71
 
72
- | Comando | Qué hace | Rol mínimo |
72
+ | Command | What it does | Minimum role |
73
73
  |---|---|---|
74
- | `ft login --key <key>` | Guarda y verifica tu API key | VIEWER |
75
- | `ft whoami` | Usuario activo + workspaces accesibles | VIEWER |
76
- | `ft config` · `ft logout` | Ver config (key enmascarada) · borrar key | — |
77
- | `ft events list` · `get <id>` | Eventos del workspace | VIEWER |
78
- | `ft ticket-types list` · `get <id>` | Tipos de ticket (`--event-date-id`) | VIEWER |
79
- | `ft sales list` · `get <id>` | Ventas (`--status`) | STAFF |
80
- | `ft plans list` · `get <id>` | Planes de membresía | VIEWER |
74
+ | `ft login --key <key>` | Stores and verifies your API key | VIEWER |
75
+ | `ft whoami` | Active user and accessible workspaces | VIEWER |
76
+ | `ft config` · `ft logout` | Show config (masked key) · remove key | — |
77
+ | `ft events list` · `get <id>` | Workspace events | VIEWER |
78
+ | `ft ticket-types list` · `get <id>` | Ticket types (`--event-date-id`) | VIEWER |
79
+ | `ft sales list` · `get <id>` | Sales (`--status`) | STAFF |
80
+ | `ft plans list` · `get <id>` | Membership plans | VIEWER |
81
81
  | `ft venues list` · `get <id>` | Venues | VIEWER |
82
- | `ft staff list` | Staff del workspace | ADMIN |
82
+ | `ft staff list` | Workspace staff | ADMIN |
83
83
  | `ft reports summary` | KPIs (`--period 7d\|30d\|90d\|1y`) | VIEWER |
84
- | `ft reports export buyers\|subscribers` | Exporta compradores / suscriptores | ADMIN |
84
+ | `ft reports export buyers\|subscribers` | Export buyers / subscribers | ADMIN |
85
85
 
86
- > Las **escrituras** (crear/editar/borrar) están declaradas en el contrato pero
87
- > responden `501` por ahora — llegan en la **fase 2**.
86
+ > **Write operations** (create/update/delete) are declared in the contract but
87
+ > currently return `501`. They are planned for **phase 2**.
88
88
 
89
- ### Flags comunes
89
+ ### Common flags
90
90
 
91
- | Flag | Aplica a | Descripción |
91
+ | Flag | Applies to | Description |
92
92
  |---|---|---|
93
- | `--json` | todos | salida JSON cruda, ideal para `jq` y scripts |
94
- | `--workspace <id>` | todos | ejecuta el comando contra otro workspace |
95
- | `--limit <n>` `--cursor <id>` | listados | paginación por cursor (1–100, default 20) |
93
+ | `--json` | all commands | Raw JSON output, ideal for `jq` and scripts |
94
+ | `--workspace <id>` | all commands | Run the command against another workspace |
95
+ | `--limit <n>` `--cursor <id>` | list commands | Cursor pagination (1-100, default 20) |
96
96
 
97
- ## 🔐 Configuración
97
+ ## Configuration
98
98
 
99
- `ft` resuelve su config en este orden de precedencia:
99
+ `ft` resolves configuration in this precedence order:
100
100
 
101
101
  ```
102
- flags > variables de entorno > ~/.freeticket/config.json > defaults
102
+ flags > environment variables > ~/.freeticket/config.json > defaults
103
103
  ```
104
104
 
105
- | Variable | Default | Descripción |
105
+ | Variable | Default | Description |
106
106
  |---|---|---|
107
- | `FT_API_URL` | `https://admin.appfreeticket.com` | base de la API (sin `/api/v1`) |
108
- | `FT_API_KEY` | — | tu key `ft_live_…` |
109
- | `FT_WORKSPACE_ID` | *home* | workspace activo por defecto |
107
+ | `FT_API_URL` | `https://admin.appfreeticket.com` | API base URL (without `/api/v1`) |
108
+ | `FT_API_KEY` | — | Your `ft_live_...` key |
109
+ | `FT_WORKSPACE_ID` | *home* | Default active workspace |
110
110
 
111
- El archivo `~/.freeticket/config.json` se crea con permisos `0600` (solo tu
112
- usuario lo lee) porque guarda la API key. Mirá [`.env.example`](./.env.example).
111
+ The `~/.freeticket/config.json` file is created with `0600` permissions (only
112
+ your user can read it) because it stores the API key. See [`.env.example`](./.env.example).
113
113
 
114
- ## 🧱 Paginación, errores y dinero
114
+ ## Pagination, errors, and money
115
115
 
116
- - **Paginación:** los listados devuelven `page.nextCursor`. El CLI te imprime la
117
- pista `--cursor <id>` en *stderr* para que `--json` quede limpio en *stdout*.
118
- - **Errores:** formato uniforme `{ error: { code, message, details } }`. El CLI
119
- traduce `401/403/404/501` a mensajes accionables y sale con código `1`.
120
- - **Dinero:** número en la moneda del recurso (`currency`, normalmente `COP`).
121
- - **Fechas:** ISO 8601 UTC.
116
+ - **Pagination:** list responses include `page.nextCursor`. The CLI prints the
117
+ `--cursor <id>` hint to *stderr* so `--json` stays clean on *stdout*.
118
+ - **Errors:** uniform format `{ error: { code, message, details } }`. The CLI
119
+ translates `401/403/404/501` into actionable messages and exits with code `1`.
120
+ - **Money:** number in the resource currency (`currency`, usually `COP`).
121
+ - **Dates:** ISO 8601 UTC.
122
122
 
123
- ## 🛠️ Desarrollo
123
+ ## Development
124
124
 
125
125
  ```bash
126
126
  pnpm install
127
- pnpm generate # genera src/client/ desde openapi.json
128
- pnpm build # bundle a dist/ con tsup
127
+ pnpm generate # generates src/client/ from openapi.json
128
+ pnpm build # bundles dist/ with tsup
129
129
  pnpm test # vitest
130
130
  pnpm lint # biome
131
131
  ```
132
132
 
133
- ### Mantener el cliente en sync con el backend
133
+ ### Keeping the client in sync with the backend
134
134
 
135
- El contrato vive commiteado en [`openapi.json`](./openapi.json). Cuando el backend
136
- cambia la API:
135
+ The contract is committed in [`openapi.json`](./openapi.json). When the backend
136
+ API changes:
137
137
 
138
138
  ```bash
139
139
  FT_OPENAPI_URL=https://admin.appfreeticket.com/api/v1/openapi.json pnpm sync-openapi
140
140
  ```
141
141
 
142
- Esto descarga el spec, lo reescribe en `openapi.json` (el diff queda en git como
143
- contrato explícito entre equipos) y regenera `src/client/`. Si un `operationId`
144
- desaparece, TypeScript falla en compilación — el cambio incompatible se ve antes
145
- de mergear.
142
+ This downloads the spec, rewrites `openapi.json` (the diff becomes the explicit
143
+ contract between teams), and regenerates `src/client/`. If an `operationId`
144
+ disappears, TypeScript fails during compilation so the breaking change is visible
145
+ before merge.
146
146
 
147
- > `src/client/` es **generado** y está en `.gitignore`: se reconstruye en cada
148
- > build y en CI. No lo edites a mano.
147
+ > `src/client/` is **generated** and listed in `.gitignore`: it is rebuilt on
148
+ > every build and in CI. Do not edit it by hand.
149
149
 
150
- ## 📂 Estructura
150
+ ## Structure
151
151
 
152
152
  ```
153
153
  freeticket-cli/
154
- ├── openapi.json # contrato — fuente de verdad versionada
154
+ ├── openapi.json # contract — versioned source of truth
155
155
  ├── src/
156
- │ ├── client/ # generado por @hey-api (gitignored)
156
+ │ ├── client/ # generated by @hey-api (gitignored)
157
157
  │ ├── commands/ # auth, resource (factory), reports
158
158
  │ ├── lib/ # config, api, output, banner
159
- │ └── index.ts # registra los comandos (commander)
159
+ │ └── index.ts # registers commands (commander)
160
160
  ├── scripts/sync-openapi.ts
161
- └── .claude/agents/ # subagentes de revisión e integración
161
+ └── .claude/agents/ # review and integration subagents
162
162
  ```
163
163
 
164
- ## 🤖 Agentes
164
+ ## Agents
165
165
 
166
- El repo trae subagentes de Claude Code en [`.claude/agents/`](./.claude/agents)
167
- para su revisión e integración continua: revisor TS/CLI, sincronizador de
168
- OpenAPI, QA del CLI y release/devops. Ver el [README de agentes](./.claude/agents/README.md).
166
+ The repo includes Claude Code subagents in [`.claude/agents/`](./.claude/agents)
167
+ for continuous review and integration: TypeScript/CLI reviewer, OpenAPI sync,
168
+ CLI QA, and release/devops. See the [agents README](./.claude/agents/README.md).
169
169
 
170
- ## Requisitos
170
+ ## Requirements
171
171
 
172
- - Node.js **≥ 20**
173
- - Una API key de FreeTicket (`ft_live_…`)
172
+ - Node.js **>= 20**
173
+ - A FreeTicket API key (`ft_live_...`)
174
174
 
175
- ## Licencia
175
+ ## License
176
176
 
177
177
  [MIT](./LICENSE) © FreeTicket