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