@farthershore/cli 0.30.0 → 0.31.1

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 CHANGED
@@ -3,54 +3,85 @@
3
3
  Create and operate [FartherShore](https://farthershore.com) software businesses
4
4
  from the terminal.
5
5
 
6
- **Status: `0.30.0`.** Pre-1.0 — the command surface is stable but may still
6
+ **Status: `0.31.1`.** Pre-1.0 — the command surface is stable but may still
7
7
  change between minor versions. Pin an exact version in CI.
8
8
 
9
9
  FartherShore lets you define a software business as code, then sells, meters,
10
10
  and bills access to it at the edge. Business behavior — plans, pricing, limits,
11
- routes, meters, and origins — is authored in your GitHub repo with
11
+ routes and meters — is authored in your GitHub repo with
12
12
  [`@farthershore/business`](https://www.npmjs.com/package/@farthershore/business)
13
- and applied automatically when you push. This CLI is the tool layer around that
14
- repo: provision a managed business repo, validate it locally before you push,
15
- publish it live, and run day-to-day operations (consumers, secrets,
16
- backends, webhooks, promo codes, usage). It is designed to be safe for both
17
- humans and agents — every command takes `--format json` for non-interactive
18
- scripting, and the same surface is exposed as an MCP server.
13
+ and reconciled through repository checks and the apply timeline after you push.
14
+ This CLI is the tool layer around that repo: provision a managed business repo,
15
+ validate it locally before you push, inspect publication state, and run
16
+ day-to-day operations (consumers, secrets, backends, webhooks, promo codes,
17
+ usage). It is designed to be safe for both humans and agents — every command
18
+ takes `--format json` for non-interactive scripting, and the MCP server exposes
19
+ the explicitly agent-operable subset of the CLI surface.
19
20
 
20
21
  ## Install
21
22
 
22
23
  ```bash
23
- npm install -g @farthershore/cli
24
+ npm install -g @farthershore/cli@0.31.1
24
25
  ```
25
26
 
26
27
  Or run it directly with npx:
27
28
 
28
29
  ```bash
29
- npx @farthershore/cli --help
30
+ npx -p @farthershore/cli@0.31.1 farthershore --help
30
31
  ```
31
32
 
32
33
  The package also ships an MCP stdio server for agents:
33
34
 
34
35
  ```bash
35
- FARTHERSHORE_TOKEN="$FARTHERSHORE_TOKEN" npx -p @farthershore/cli farthershore-mcp
36
+ npx -p @farthershore/cli@0.31.1 farthershore-mcp
36
37
  ```
37
38
 
38
39
  ## Authentication
39
40
 
40
- Use the credential supplied to the current environment:
41
+ Start the device login. The CLI opens the complete authorization request in
42
+ your browser without printing a code, then waits for you to approve access:
41
43
 
42
44
  ```bash
43
- export FARTHERSHORE_TOKEN="<provided credential>"
45
+ farthershore login
44
46
  farthershore auth whoami --format json
45
47
  ```
46
48
 
47
- The CLI exchanges that credential for a short-lived access token on the first
48
- authenticated request. Do not write credentials into the managed repository.
49
+ On a headless machine, print the manual verification URL and user code without
50
+ trying to open a browser:
49
51
 
50
52
  ```bash
51
- farthershore auth logout # Clear stored credentials
53
+ farthershore login --headless
52
54
  ```
53
55
 
56
+ Normal login creates a user-bound CLI session. It uses your live role in each
57
+ organization instead of copying a permission list into the credential. By
58
+ default it follows all of your current and future organization memberships and
59
+ all businesses in them. Normal login has no permission or scope choices: use an
60
+ organization-scoped MakerToken when automation needs narrower access.
61
+
62
+ Choose the active organization for a command with `--organization <id-or-slug>`,
63
+ or save a default context:
64
+
65
+ ```bash
66
+ farthershore auth organization list
67
+ farthershore auth organization use <id-or-slug>
68
+ ```
69
+
70
+ For a separately issued organization-scoped MakerToken, pipe it through bounded stdin:
71
+
72
+ ```bash
73
+ printf %s "$FARTHERSHORE_MAKER_TOKEN" | farthershore login --token-stdin
74
+ ```
75
+
76
+ `FARTHERSHORE_TOKEN` accepts an organization-scoped MakerToken as an ephemeral
77
+ process override and is never persisted automatically. `farthershore logout` deletes the stored credential after
78
+ revoking the current user CLI session on the platform. Signing in again also
79
+ supersedes older user CLI sessions.
80
+ Membership and role changes take effect on the next authenticated request. A
81
+ restricted MakerToken remains available through `--token-stdin` or
82
+ `FARTHERSHORE_TOKEN`. Never write
83
+ credentials into the managed repository.
84
+
54
85
  ## Quickstart
55
86
 
56
87
  Create a managed business repo, author the business, validate it, and push:
@@ -62,22 +93,28 @@ REPO_URL=$(farthershore business create weather-api)
62
93
  # 2. Clone it and author business/ from scratch.
63
94
  git clone "$REPO_URL"
64
95
  cd weather-api
65
- # ...edit business/business.ts with @farthershore/business...
96
+ # ...author business/ with @farthershore/business...
66
97
 
67
98
  # 3. Validate the same way the PR check will, before pushing
68
99
  farthershore validate --business weather-api
69
100
 
70
- # 4. Push — the GitHub bot compiles + applies your manifest
101
+ # 4. Push — the GitHub bot validates and records apply state
71
102
  git push --set-upstream origin feature/pricing
72
- farthershore change-set list weather-api # inspect checks + apply state
103
+ farthershore apply-timeline list weather-api # inspect checks + apply state
73
104
 
74
105
  # 5. Inspect accepted state, then use the CLI for platform operations.
75
106
  farthershore business status weather-api --format json
76
107
  farthershore operations list --format json
77
108
  ```
78
109
 
79
- Plans, prices, limits, routes, meters, and origins are **repo-controlled**:
80
- change them by editing `business/business.ts` and pushing. The CLI's
110
+ Do not infer a successful apply from a push alone. A default-branch runtime-only
111
+ change may publish after validation; an economic change is deferred to a GitHub
112
+ Release. Preview-environment branches publish only to that environment. Inspect
113
+ the repository checks and apply timeline for the actual outcome.
114
+
115
+ Plans, prices, limits, routes, and meters are **repo-controlled**: change them
116
+ by editing the program under `business/` and pushing. Presentation and origin bindings
117
+ are platform-owned operating state. The CLI's
81
118
  write commands cover **operational** state that lives outside the manifest
82
119
  (consumers, secrets, backends, webhooks, promo codes, brand presentation).
83
120
 
@@ -85,7 +122,6 @@ write commands cover **operational** state that lives outside the manifest
85
122
 
86
123
  | Flag | Description |
87
124
  | --------------------- | -------------------------------------------------------- |
88
- | `--token <token>` | Override auth token for this command |
89
125
  | `--api-url <url>` | Override platform Core API URL |
90
126
  | `--env <environment>` | Environment scope (`production`/`prod`/`main` aliases) |
91
127
  | `--format <format>` | `json` for machine-readable output (default for non-TTY) |
@@ -97,7 +133,7 @@ write commands cover **operational** state that lives outside the manifest
97
133
 
98
134
  | Variable | Description |
99
135
  | ---------------------- | --------------------------------------------------------------- |
100
- | `FARTHERSHORE_TOKEN` | API token (overrides stored credentials) |
136
+ | `FARTHERSHORE_TOKEN` | Ephemeral organization-scoped MakerToken; never persisted |
101
137
  | `FARTHERSHORE_API_URL` | Platform Core API URL (default `https://core.farthershore.com`) |
102
138
  | `FARTHERSHORE_ENV` | Default environment scope when `--env` is omitted |
103
139
 
@@ -105,6 +141,14 @@ write commands cover **operational** state that lives outside the manifest
105
141
 
106
142
  Run `farthershore <group> --help` for the full flag set of any command.
107
143
 
144
+ Database-backed list commands use Core's shared query contract: repeat
145
+ `--filter field=value` for exact AND filters, pass one
146
+ `--sort field[:asc|desc]` (ascending when omitted), and use
147
+ `--search <text>` for case-insensitive text search. Core applies all three
148
+ before pagination; the CLI does not sort or filter a partial page locally.
149
+ Each command rejects fields outside its endpoint-specific allowlist shown by
150
+ `--help`.
151
+
108
152
  ### `farthershore create`
109
153
 
110
154
  Create local project components inside a managed builder repo. `create api`
@@ -124,7 +168,7 @@ planned.
124
168
 
125
169
  ### `farthershore build`
126
170
 
127
- Compile `business/business.ts` to a Manifest IR envelope locally (default
171
+ Compile the program under `business/` to a Manifest IR envelope locally (default
128
172
  output `business-build.json`). The CLI uses the Business SDK installed under
129
173
  `business/`, falling back to a root install. This is local compilation only;
130
174
  server-side validation and apply happen when you push `business/**` changes.
@@ -157,6 +201,7 @@ DRAFT with repository tooling but no predefined business program.
157
201
 
158
202
  ```bash
159
203
  farthershore business list --format json
204
+ farthershore business list --filter status=ACTIVE --sort updatedAt:desc --search weather --format json
160
205
  farthershore business show weather-api --format json
161
206
  farthershore business show weather-api --env preview --format json
162
207
 
@@ -165,6 +210,7 @@ farthershore business create weather-api \
165
210
  --format json
166
211
 
167
212
  farthershore business publish weather-api --format json
213
+ farthershore business rollback weather-api wfe_previous --reason "bad release" --format json
168
214
  farthershore business delete weather-api --yes --format json
169
215
  ```
170
216
 
@@ -190,15 +236,17 @@ farthershore business update weather-api \
190
236
 
191
237
  `business publish` enforces the same go-live gates as the dashboard and returns
192
238
  stable remediation errors when a prerequisite is missing.
239
+ `business rollback` enqueues a rollback of the specified prior publish workflow
240
+ and requires the exact `business:rollback` permission.
193
241
 
194
- ### `farthershore change-set`
242
+ ### `farthershore apply-timeline`
195
243
 
196
- Inspect repo-backed change sets — PRs, pushes, releases, checks, semantic diffs,
244
+ Inspect repo-backed applies — PRs, pushes, releases, checks, semantic diffs,
197
245
  and apply state — for a business.
198
246
 
199
247
  ```bash
200
- farthershore change-set list weather-api --format json
201
- farthershore change-set inspect weather-api 42 --format json # by id, PR #, branch, or SHA
248
+ farthershore apply-timeline list weather-api --format json
249
+ farthershore apply-timeline inspect weather-api 42 --format json # by id, PR #, branch, or SHA
202
250
  ```
203
251
 
204
252
  ### `farthershore env`
@@ -208,10 +256,21 @@ Manage preview/production environments. Production is the default scope when
208
256
 
209
257
  ```bash
210
258
  farthershore env list weather-api --format json
259
+ farthershore env list weather-api --filter branch=env/preview --sort createdAt:desc --search preview --format json
211
260
  farthershore env create weather-api --name preview --branch env/preview --format json
212
261
  farthershore env delete weather-api preview --yes --format json
213
262
  ```
214
263
 
264
+ ### `farthershore organization`
265
+
266
+ Manage organization members and the exact platform-permission roles assigned
267
+ to them. Built-in and custom roles use the same list contract.
268
+
269
+ ```bash
270
+ farthershore organization role list <organizationId> --filter builtIn=true --sort name --search security --format json
271
+ farthershore organization members <organizationId> --filter roleKey=auditor --sort email:asc --search person --format json
272
+ ```
273
+
215
274
  ### `farthershore plan`
216
275
 
217
276
  Read code-managed plans and operate live subscriber migrations. The CLI does not
@@ -354,7 +413,7 @@ export async function POST(request: Request) {
354
413
  ### `farthershore webhook`
355
414
 
356
415
  Provision outbound webhook endpoints and inspect delivery health. If the business
357
- declares webhooks in `business/business.ts`, writes return
416
+ declares webhooks under `business/`, writes return
358
417
  `409 MANAGED_BY_CODE` so the repo stays canonical.
359
418
 
360
419
  ```bash
@@ -393,14 +452,21 @@ Use `--all-plans` to clear plan scoping.
393
452
 
394
453
  ### Farther Shore agent skills
395
454
 
396
- Install or refresh the complete skills bundle together. When a newer tagged
397
- bundle is available, the CLI prints the same command with the release tag in
398
- the GitHub URL.
455
+ Install or refresh the platform-verified skills bundle together. The platform
456
+ pins this immutable release, and CI plus a daily repository check compare it to
457
+ GitHub's latest stable release so the guidance cannot silently drift.
458
+ This command requires `@farthershore/cli` 0.31.1 or newer.
399
459
 
400
460
  ```bash
401
- npx skills add https://github.com/farther-shore/skills/tree/v2.1.0 --skill '*' -g -y
461
+ farthershore skills install --help
462
+ # If the command is unavailable, upgrade to the required CLI release:
463
+ npm install -g @farthershore/cli@0.31.1
464
+ farthershore skills install
402
465
  ```
403
466
 
467
+ The Farther Shore CLI downloads the exact installer archive and verifies this
468
+ SHA-512 before it extracts or executes any installer code.
469
+
404
470
  ### `farthershore operations`
405
471
 
406
472
  Print the machine-readable action boundary: which operations are repo-authored
@@ -434,22 +500,24 @@ without parsing text:
434
500
 
435
501
  ## CI and agent usage
436
502
 
437
- The CLI is non-interactive whenever a token is available via `--token` or
438
- `FARTHERSHORE_TOKEN` — `auth login` only prompts when stdin is a TTY and no token
439
- was passed, so it is safe to script. `farthershore build` and `farthershore
440
- validate --local-only` need no network or auth and are safe to run in CI.
503
+ Authenticate before unattended work, or supply an organization-scoped
504
+ MakerToken through `FARTHERSHORE_TOKEN`. Device login waits for human approval; use
505
+ `--headless` when the CLI cannot open a browser. `farthershore build` and
506
+ `farthershore validate --local-only` need no network or auth and are safe to
507
+ run in CI.
441
508
 
442
509
  ## MCP server
443
510
 
444
511
  The MCP server (`farthershore-mcp`) projects its tools from the same operation
445
- registry that defines the CLI commands, so every MCP tool has a CLI sibling. Tool
446
- names use the `fs_*` prefix and cover the agent-operable surface: businesses,
447
- environments, organizations, audit logs, notifications, plans, frontends,
448
- backends, runtime tokens, webhooks, promo codes, consumers, secrets, personas,
449
- and usage.
512
+ registry that defines the CLI commands. Every MCP tool has a CLI sibling, but
513
+ not every CLI command is exposed through MCP. Tool names use the `fs_*` prefix
514
+ and cover only operations explicitly marked agent-operable in that registry.
515
+ Organization, role, member, and invitation administration requires a live-user
516
+ CLI session and is not projected into MCP; audit logs, notifications, and apply
517
+ timelines are also CLI-only.
450
518
 
451
519
  ```bash
452
- FARTHERSHORE_TOKEN="$FARTHERSHORE_TOKEN" farthershore-mcp
520
+ farthershore-mcp
453
521
  ```
454
522
 
455
523
  ## Learn more