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

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 +115 -2
  2. package/dist/index.js +11540 -0
  3. package/package.json +51 -4
package/README.md CHANGED
@@ -1,3 +1,116 @@
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
+ With Node.js 22 or newer, install the current DEV beta from npm. Run the same install command to update to a newer beta.
24
+
25
+ ```sh
26
+ npm install --global @nicertravel/cli@beta
27
+ nicer --version
28
+ ```
29
+
30
+ On macOS or Linux, you can also 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).
31
+
32
+ ```sh
33
+ curl -fsS https://cli.dev.nicer.travel/install.sh -o install-nicer.sh
34
+ sh install-nicer.sh
35
+ ~/.local/bin/nicer --version
36
+ ```
37
+
38
+ The [DEV channel](https://cli.dev.nicer.travel/beta.json) records the exact version, Git commit and download prefix.
39
+
40
+ ## Authentication
41
+
42
+ **Signing in is not built.** Nothing outside Nicer can yet obtain a token the API accepts: the
43
+ authorization server issues tokens for the hosted MCP servers, and only Nicer's own server can
44
+ trade one for something the API takes. Until that gap is closed, the token comes from the
45
+ environment:
46
+
47
+ ```sh
48
+ export NICER_TOKEN=… # a token the API accepts
49
+ export NICER_COMPANY=acme # the agency a call acts in, or pass --company
50
+ nicer crm travelers list
51
+ ```
52
+
53
+ `nicer auth login` exits with a message saying so. Everything that does not need a token works
54
+ now: `--help` for any resource or command, every flag with its type and its allowed values, input
55
+ validation, and `--dry-run`, which prints the exact request without sending it.
56
+
57
+ ## Flags
58
+
59
+ Every field of an operation is a flag, spelled in kebab case: `travelerId` is `--traveler-id`. A
60
+ command with one path parameter also takes it bare, so `nicer crm travelers get trv_123` works.
61
+
62
+ | Flag | |
63
+ | --- | --- |
64
+ | `--input <file.json>` | the whole request body as JSON; `-` reads standard input |
65
+ | `--company <name>` | the agency the call acts in (`x-nicer-company`) |
66
+ | `--dry-run` | print the request and send nothing |
67
+ | `--yes` | run a command that cannot be undone, without being asked |
68
+ | `--base-url <url>` | another API origin; the default is the one the document names |
69
+
70
+ A field that is a real object or a list of objects is given as JSON (`--name '{"legal":"…"}'`).
71
+ A field that is nullable, or a named scalar, is spelled as its underlying type, so most fields are
72
+ plain strings, numbers, dates and enumerations.
73
+
74
+ Every write sends a fresh `Idempotency-Key`, so a retried call is the same call.
75
+
76
+ **Deletions ask before they run.** The document declares no confirmation on any operation yet, so
77
+ the command line asks on any `DELETE` of its own accord, rather than erasing a record because an
78
+ extension is missing. A script passes `--yes`.
79
+
80
+ ## How it is generated
81
+
82
+ ```text
83
+ api.<env>/openapi.json
84
+ → scripts/openapi.ts fetches the document
85
+ → scripts/generate.ts builds the plugin, runs forge, records generation.json
86
+ → src/generated/commands.ts the table: one entry per operation, its flags and their values
87
+ → src/index.ts the runtime, written once, reads the table
88
+ ```
89
+
90
+ `generation/plugins/cli.ts` is a [Cloudflare Forge](https://github.com/cloudflare/forge) plugin:
91
+ one function from Forge's model of the document to the files it writes. It writes data, not a
92
+ program, which is what keeps it small. Forge is pinned exactly, because before 1.0 a minor version
93
+ may change what it generates.
94
+
95
+ ```sh
96
+ bun install
97
+ bun run openapi # fetch the DEV document
98
+ bun run generate # rebuild src/generated/
99
+ bun run verify # typecheck and build
100
+ ```
101
+
102
+ `src/generated/generation.json` records the release, the Forge version, and the document's content
103
+ hash: its SHA-256 with `info.version` removed. That hash is what decides whether there is anything
104
+ to release — the API's version changes on every build, so comparing the whole document would
105
+ publish a new client for a deploy that changed no operation.
106
+
107
+ ## Releases
108
+
109
+ Every push to `dev` runs Generate against the DEV API and starts Publish. Publish builds the
110
+ release once, uploads the native downloads and publishes the same verified tarball to npm with
111
+ the `beta` tag. A backend contract change can also trigger regeneration and a new beta. A backend
112
+ deployment with the same contract and the same CLI commit reuses the existing release.
113
+ Stable releases use a separate, manually promoted version from `main`.
114
+
115
+ The design, the release chain and what is still open:
116
+ `docs/ecosystem/11-cli-and-mcp-releases.md` in `nicertravel/backend`.