@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.
- package/README.md +80 -80
- package/dist/index.js +1108 -98
- package/package.json +14 -5
package/README.md
CHANGED
|
@@ -9,169 +9,169 @@
|
|
|
9
9
|
|
|
10
10
|
# FreeTicket CLI
|
|
11
11
|
|
|
12
|
-
**
|
|
12
|
+
**Your event platform, from the terminal.**
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Events, sales, tickets, memberships, venues, staff, and reports — one command away.
|
|
15
15
|
|
|
16
16
|
[](https://www.npmjs.com/package/@freeticket/cli)
|
|
17
17
|
[](https://github.com/AppFreeticket/freeticket-cli/actions/workflows/ci.yml)
|
|
18
18
|
[](./LICENSE)
|
|
19
|
-
[](#
|
|
19
|
+
[](#requirements)
|
|
20
20
|
|
|
21
21
|
</div>
|
|
22
22
|
|
|
23
23
|
---
|
|
24
24
|
|
|
25
|
-
##
|
|
25
|
+
## What it is
|
|
26
26
|
|
|
27
|
-
`ft`
|
|
28
|
-
**
|
|
29
|
-
dashboard:
|
|
30
|
-
|
|
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
|
-
|
|
33
|
-
endpoint
|
|
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
|
-
##
|
|
35
|
+
## Installation
|
|
36
36
|
|
|
37
37
|
```bash
|
|
38
|
-
# global (
|
|
38
|
+
# global install (recommended)
|
|
39
39
|
npm install -g @freeticket/cli
|
|
40
40
|
|
|
41
|
-
#
|
|
41
|
+
# or run without installing
|
|
42
42
|
npx @freeticket/cli whoami
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
Check that it was installed:
|
|
46
46
|
|
|
47
47
|
```bash
|
|
48
48
|
ft --version
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
##
|
|
51
|
+
## Quickstart
|
|
52
52
|
|
|
53
53
|
```bash
|
|
54
|
-
# 1.
|
|
55
|
-
# pnpm api:key
|
|
56
|
-
#
|
|
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.
|
|
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.
|
|
61
|
+
# 3. Who am I, and which workspaces can I access?
|
|
62
62
|
ft whoami
|
|
63
63
|
|
|
64
|
-
# 4.
|
|
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
|
-
##
|
|
70
|
+
## Commands
|
|
71
71
|
|
|
72
|
-
|
|
|
72
|
+
| Command | What it does | Minimum role |
|
|
73
73
|
|---|---|---|
|
|
74
|
-
| `ft login --key <key>` |
|
|
75
|
-
| `ft whoami` |
|
|
76
|
-
| `ft config` · `ft logout` |
|
|
77
|
-
| `ft events list` · `get <id>` |
|
|
78
|
-
| `ft ticket-types list` · `get <id>` |
|
|
79
|
-
| `ft sales list` · `get <id>` |
|
|
80
|
-
| `ft plans list` · `get <id>` |
|
|
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` |
|
|
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` |
|
|
84
|
+
| `ft reports export buyers\|subscribers` | Export buyers / subscribers | ADMIN |
|
|
85
85
|
|
|
86
|
-
>
|
|
87
|
-
>
|
|
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
|
-
###
|
|
89
|
+
### Common flags
|
|
90
90
|
|
|
91
|
-
| Flag |
|
|
91
|
+
| Flag | Applies to | Description |
|
|
92
92
|
|---|---|---|
|
|
93
|
-
| `--json` |
|
|
94
|
-
| `--workspace <id>` |
|
|
95
|
-
| `--limit <n>` `--cursor <id>` |
|
|
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
|
-
##
|
|
97
|
+
## Configuration
|
|
98
98
|
|
|
99
|
-
`ft`
|
|
99
|
+
`ft` resolves configuration in this precedence order:
|
|
100
100
|
|
|
101
101
|
```
|
|
102
|
-
flags > variables
|
|
102
|
+
flags > environment variables > ~/.freeticket/config.json > defaults
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
-
| Variable | Default |
|
|
105
|
+
| Variable | Default | Description |
|
|
106
106
|
|---|---|---|
|
|
107
|
-
| `FT_API_URL` | `https://admin.appfreeticket.com` | base
|
|
108
|
-
| `FT_API_KEY` | — |
|
|
109
|
-
| `FT_WORKSPACE_ID` | *home* |
|
|
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
|
-
|
|
112
|
-
|
|
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
|
-
##
|
|
114
|
+
## Pagination, errors, and money
|
|
115
115
|
|
|
116
|
-
- **
|
|
117
|
-
|
|
118
|
-
- **
|
|
119
|
-
|
|
120
|
-
- **
|
|
121
|
-
- **
|
|
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
|
-
##
|
|
123
|
+
## Development
|
|
124
124
|
|
|
125
125
|
```bash
|
|
126
126
|
pnpm install
|
|
127
|
-
pnpm generate #
|
|
128
|
-
pnpm build #
|
|
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
|
-
###
|
|
133
|
+
### Keeping the client in sync with the backend
|
|
134
134
|
|
|
135
|
-
|
|
136
|
-
|
|
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
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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/`
|
|
148
|
-
> build
|
|
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
|
-
##
|
|
150
|
+
## Structure
|
|
151
151
|
|
|
152
152
|
```
|
|
153
153
|
freeticket-cli/
|
|
154
|
-
├── openapi.json #
|
|
154
|
+
├── openapi.json # contract — versioned source of truth
|
|
155
155
|
├── src/
|
|
156
|
-
│ ├── client/ #
|
|
156
|
+
│ ├── client/ # generated by @hey-api (gitignored)
|
|
157
157
|
│ ├── commands/ # auth, resource (factory), reports
|
|
158
158
|
│ ├── lib/ # config, api, output, banner
|
|
159
|
-
│ └── index.ts #
|
|
159
|
+
│ └── index.ts # registers commands (commander)
|
|
160
160
|
├── scripts/sync-openapi.ts
|
|
161
|
-
└── .claude/agents/ #
|
|
161
|
+
└── .claude/agents/ # review and integration subagents
|
|
162
162
|
```
|
|
163
163
|
|
|
164
|
-
##
|
|
164
|
+
## Agents
|
|
165
165
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
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
|
-
##
|
|
170
|
+
## Requirements
|
|
171
171
|
|
|
172
|
-
- Node.js
|
|
173
|
-
-
|
|
172
|
+
- Node.js **>= 20**
|
|
173
|
+
- A FreeTicket API key (`ft_live_...`)
|
|
174
174
|
|
|
175
|
-
##
|
|
175
|
+
## License
|
|
176
176
|
|
|
177
177
|
[MIT](./LICENSE) © FreeTicket
|