Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
node_modules/
dist/
.npm-cache/
# client generated from openapi.json — regenerated with `pnpm generate`
# clients generated from the specs — regenerated with `pnpm generate`
src/client/
src/admin-client/
*.log
.DS_Store
.env
38 changes: 38 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,44 @@ versioning follows [SemVer](https://semver.org/).

## [Unreleased]

## [0.4.0] - 2026-06-29

### Added
- **Write layer (B2B v1):** every resource now has `create`/`update`/`delete`
plus resource actions — `events publish`, `sales cancel`/`refund`,
`staff create`/`set-role`. Bodies via `--data` (inline JSON or `@file.json`);
`delete` confirms unless `--yes`.
- `event-dates` command group for the nested `/events/{id}/dates` resource
(`list`/`create <eventId>`, `update`/`delete <eventId> <dateId>`).
- **Admin writes:** `workspaces create`/`update`/`suspend`/`restore`,
`users update`, `plans create`/`update`, `feature-flags set <key>`,
`impersonate`/`impersonate-stop`.
- **`--csv`** flag on every list command (B2B + admin) — CSV on stdout for
spreadsheets/accounting, columns matching the table view.
- `lib/input.ts`: `parseData` (`--data` inline/`@file` JSON) and an interactive
`confirm` for destructive ops (auto-aborts on non-TTY stdin).
- `toCsv` (RFC 4180 quoting) in `lib/output.ts`.

## [0.3.0] - 2026-06-29

### Added
- Superadmin commands (`ft admin …`) against the separate `/api/admin` contract
(Admin API v1.0.0): `me`, `workspaces`, `users`, `plans`, `feature-flags`,
`audit-log` (read-only first pass).
- Second generated client (`src/admin-client/`) via `openapi-ts.admin.config.ts`,
with its own `client` singleton and auth.
- `configureAdminClient` using a SUPER_ADMIN better-auth session
(`FT_ADMIN_SESSION`) — the admin contract issues no API key.
- `sync-openapi:admin` script (target `FT_ADMIN_OPENAPI_URL`); `generate` now
builds both the B2B and admin clients.

## [0.2.0] - 2026-06-29

### Added
- CFO financial reconciliation against B2B contract v1.1.0:
`ft reports reconciliation` and `ft reports export reconciliation` — cross
Mercado Pago payment, sale and Siigo invoice with a `match_status` per sale.

## [0.1.1] - 2026-06-25

### Changed
Expand Down
1 change: 1 addition & 0 deletions admin-openapi.json

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions openapi-ts.admin.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from "@hey-api/openapi-ts";

// Cliente del contrato superadmin (/api/admin). Generado — nunca a mano.
// Output separado del B2B: su propio `client` singleton => auth independiente
// (sesión SUPER_ADMIN, no API key). Ver src/lib/api.ts > configureAdminClient.
export default defineConfig({
input: "admin-openapi.json",
output: "src/admin-client",
plugins: ["@hey-api/client-fetch"],
});
4 changes: 3 additions & 1 deletion openapi-ts.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { defineConfig } from "@hey-api/openapi-ts";

// Genera el cliente tipado desde el contrato commiteado.
// Genera el cliente B2B v1 desde el contrato commiteado.
// src/client/ es generado — nunca se edita a mano (ver .gitignore).
// El cliente admin se genera aparte (openapi-ts.admin.config.ts), con su
// propio `client` singleton, para que la auth admin no se mezcle con la B2B.
export default defineConfig({
input: "openapi.json",
output: "src/client",
Expand Down
4,674 changes: 4,673 additions & 1 deletion openapi.json

Large diffs are not rendered by default.

17 changes: 13 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
{
"name": "@freeticket/cli",
"version": "0.1.1",
"version": "0.4.0",
"description": "Official FreeTicket CLI — consumes the B2B REST API for events, sales, tickets, memberships, venues, staff, and reports.",
"keywords": ["freeticket", "cli", "ticketing", "events", "api"],
"keywords": [
"freeticket",
"cli",
"ticketing",
"events",
"api"
],
"homepage": "https://github.com/AppFreeticket/freeticket-cli#readme",
"bugs": "https://github.com/AppFreeticket/freeticket-cli/issues",
"repository": {
Expand All @@ -16,7 +22,9 @@
"bin": {
"ft": "dist/index.js"
},
"files": ["dist"],
"files": [
"dist"
],
"engines": {
"node": ">=20"
},
Expand All @@ -26,8 +34,9 @@
"scripts": {
"build": "tsup",
"dev": "tsup --watch",
"generate": "openapi-ts",
"generate": "openapi-ts && openapi-ts -f openapi-ts.admin.config.ts",
"sync-openapi": "tsx scripts/sync-openapi.ts",
"sync-openapi:admin": "FT_OPENAPI_URL=${FT_ADMIN_OPENAPI_URL:-https://admin.appfreeticket.com/api/admin/openapi.json} FT_OPENAPI_OUT=admin-openapi.json tsx scripts/sync-openapi.ts",
"lint": "biome check .",
"format": "biome check --write .",
"test": "vitest run",
Expand Down
7 changes: 4 additions & 3 deletions scripts/sync-openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ if (!res.ok) {
console.error(`Could not download the spec (${res.status}) from ${url}`);
process.exit(1);
}
const out = process.env.FT_OPENAPI_OUT ?? "openapi.json";
const spec = await res.json();
writeFileSync("openapi.json", `${JSON.stringify(spec, null, 2)}\n`);
console.log(`✓ openapi.json updated from ${url}`);
writeFileSync(out, `${JSON.stringify(spec, null, 2)}\n`);
console.log(`✓ ${out} updated from ${url}`);

execSync("pnpm generate", { stdio: "inherit" });
console.log("✓ client regenerated in src/client/");
console.log("✓ clients regenerated in src/client/ + src/admin-client/");
Loading
Loading