@nicertravel/cli 0.0.0-stage → 1.0.0-beta.11

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 +106 -2
  2. package/dist/index.js +11540 -0
  3. package/package.json +51 -4
package/README.md CHANGED
@@ -1,3 +1,107 @@
1
- # Temporary Holding Version
1
+ # nicer
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The Nicer API from a terminal. Every published operation is a command, named by the operation's
4
+ own public name, and the commands are generated from the API's OpenAPI document — so a new
5
+ operation becomes a command without anyone writing one.
6
+
7
+ ```sh
8
+ nicer crm travelers list --limit 25
9
+ nicer crm travelers get trv_123 --expand profile
10
+ nicer commerce orders payments create ord_42 --method '{"type":"card"}'
11
+ ```
12
+
13
+ A command is the operation's own name, one word per segment, so it is as deep as the
14
+ operation is: `commerce.orders.payments.create` is
15
+ `nicer commerce orders payments create`. `nicer --help` lists the groups, and
16
+ `nicer commerce orders --help` what is inside one.
17
+
18
+ `nicer --help` lists every resource and its commands, and the count grows on its own: the table
19
+ is regenerated whenever the API publishes an operation.
20
+
21
+ ## Install the development CLI
22
+
23
+ On macOS or Linux, download the current DEV installer. It selects the native binary and verifies its SHA-256 before installing it in `~/.local/bin`. The immutable release includes `SHA256SUMS` and the Windows x64 executable. [Native releases](https://github.com/nicertravel/cli/releases).
24
+
25
+ ```sh
26
+ curl -fsS https://cli.dev.nicer.travel/install.sh -o install-nicer.sh
27
+ sh install-nicer.sh
28
+ ~/.local/bin/nicer --version
29
+ ```
30
+
31
+ The [DEV channel](https://cli.dev.nicer.travel/beta.json) records the exact version, Git commit and download prefix. npm publication is tracked separately in the [release runbook](https://github.com/nicertravel/backend/blob/dev/docs/ecosystem/12-dev-release-runbook.md).
32
+
33
+ ## Authentication
34
+
35
+ **Signing in is not built.** Nothing outside Nicer can yet obtain a token the API accepts: the
36
+ authorization server issues tokens for the hosted MCP servers, and only Nicer's own server can
37
+ trade one for something the API takes. Until that gap is closed, the token comes from the
38
+ environment:
39
+
40
+ ```sh
41
+ export NICER_TOKEN=… # a token the API accepts
42
+ export NICER_COMPANY=acme # the agency a call acts in, or pass --company
43
+ nicer crm travelers list
44
+ ```
45
+
46
+ `nicer auth login` exits with a message saying so. Everything that does not need a token works
47
+ now: `--help` for any resource or command, every flag with its type and its allowed values, input
48
+ validation, and `--dry-run`, which prints the exact request without sending it.
49
+
50
+ ## Flags
51
+
52
+ Every field of an operation is a flag, spelled in kebab case: `travelerId` is `--traveler-id`. A
53
+ command with one path parameter also takes it bare, so `nicer crm travelers get trv_123` works.
54
+
55
+ | Flag | |
56
+ | --- | --- |
57
+ | `--input <file.json>` | the whole request body as JSON; `-` reads standard input |
58
+ | `--company <name>` | the agency the call acts in (`x-nicer-company`) |
59
+ | `--dry-run` | print the request and send nothing |
60
+ | `--yes` | run a command that cannot be undone, without being asked |
61
+ | `--base-url <url>` | another API origin; the default is the one the document names |
62
+
63
+ A field that is a real object or a list of objects is given as JSON (`--name '{"legal":"…"}'`).
64
+ A field that is nullable, or a named scalar, is spelled as its underlying type, so most fields are
65
+ plain strings, numbers, dates and enumerations.
66
+
67
+ Every write sends a fresh `Idempotency-Key`, so a retried call is the same call.
68
+
69
+ **Deletions ask before they run.** The document declares no confirmation on any operation yet, so
70
+ the command line asks on any `DELETE` of its own accord, rather than erasing a record because an
71
+ extension is missing. A script passes `--yes`.
72
+
73
+ ## How it is generated
74
+
75
+ ```text
76
+ api.<env>/openapi.json
77
+ → scripts/openapi.ts fetches the document
78
+ → scripts/generate.ts builds the plugin, runs forge, records generation.json
79
+ → src/generated/commands.ts the table: one entry per operation, its flags and their values
80
+ → src/index.ts the runtime, written once, reads the table
81
+ ```
82
+
83
+ `generation/plugins/cli.ts` is a [Cloudflare Forge](https://github.com/cloudflare/forge) plugin:
84
+ one function from Forge's model of the document to the files it writes. It writes data, not a
85
+ program, which is what keeps it small. Forge is pinned exactly, because before 1.0 a minor version
86
+ may change what it generates.
87
+
88
+ ```sh
89
+ bun install
90
+ bun run openapi # fetch the DEV document
91
+ bun run generate # rebuild src/generated/
92
+ bun run verify # typecheck and build
93
+ ```
94
+
95
+ `src/generated/generation.json` records the release, the Forge version, and the document's content
96
+ hash: its SHA-256 with `info.version` removed. That hash is what decides whether there is anything
97
+ to release — the API's version changes on every build, so comparing the whole document would
98
+ publish a new client for a deploy that changed no operation.
99
+
100
+ ## Releases
101
+
102
+ A finished deploy of the backend tells this repository, which regenerates and compares the hash;
103
+ an unchanged API releases nothing. `dev` follows the DEV document and publishes betas, `main`
104
+ follows PROD. Publishing to npm is not set up yet.
105
+
106
+ The design, the release chain and what is still open:
107
+ `docs/ecosystem/11-cli-and-mcp-releases.md` in `nicertravel/backend`.