@farthershore/cli 0.29.0 → 0.30.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.
Files changed (4) hide show
  1. package/README.md +39 -136
  2. package/dist/index.js +72 -2098
  3. package/dist/mcp.js +20 -19
  4. package/package.json +2 -3
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Create and operate [FartherShore](https://farthershore.com) software businesses
4
4
  from the terminal.
5
5
 
6
- **Status: `0.25.0`.** Pre-1.0 — the command surface is stable but may still
6
+ **Status: `0.30.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,
@@ -11,8 +11,8 @@ and bills access to it at the edge. Business behavior — plans, pricing, limits
11
11
  routes, meters, and origins — is authored in your GitHub repo with
12
12
  [`@farthershore/business`](https://www.npmjs.com/package/@farthershore/business)
13
13
  and applied automatically when you push. This CLI is the tool layer around that
14
- repo: scaffold a new business, validate it locally before you push, connect
15
- billing, publish it live, and run day-to-day operations (consumers, secrets,
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
16
  backends, webhooks, promo codes, usage). It is designed to be safe for both
17
17
  humans and agents — every command takes `--format json` for non-interactive
18
18
  scripting, and the same surface is exposed as an MCP server.
@@ -32,50 +32,35 @@ npx @farthershore/cli --help
32
32
  The package also ships an MCP stdio server for agents:
33
33
 
34
34
  ```bash
35
- FARTHERSHORE_TOKEN=mk_xxx npx -p @farthershore/cli farthershore-mcp
35
+ FARTHERSHORE_TOKEN="$FARTHERSHORE_TOKEN" npx -p @farthershore/cli farthershore-mcp
36
36
  ```
37
37
 
38
38
  ## Authentication
39
39
 
40
- Create a maker token at
41
- [farthershore.com/settings/tokens](https://farthershore.com/settings/tokens),
42
- then store it locally:
40
+ Use the credential supplied to the current environment:
43
41
 
44
42
  ```bash
45
- # Interactive — prompts for the token
46
- farthershore auth login
47
-
48
- # Non-interactive — pass it directly
49
- farthershore auth login --token mk_xxx
50
-
51
- # Or skip the file entirely with an env var (CI / agents)
52
- export FARTHERSHORE_TOKEN=mk_xxx
43
+ export FARTHERSHORE_TOKEN="<provided credential>"
44
+ farthershore auth whoami --format json
53
45
  ```
54
46
 
55
- Tokens are stored in `~/.farthershore/credentials.json`. A maker token is
56
- exchanged for a short-lived CLI access token on the first authenticated request.
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.
57
49
 
58
50
  ```bash
59
- farthershore auth whoami # Show current org, role, and scopes
60
51
  farthershore auth logout # Clear stored credentials
61
52
  ```
62
53
 
63
- GitHub account linking and Stripe Connect/KYC are browser-hosted flows; the CLI
64
- reports their status (see `connect`) so you — or an agent — can continue once the
65
- flow is finished in the dashboard.
66
-
67
54
  ## Quickstart
68
55
 
69
- Scaffold a business, validate it, connect billing, and publish:
56
+ Create a managed business repo, author the business, validate it, and push:
70
57
 
71
58
  ```bash
72
- export FARTHERSHORE_TOKEN=mk_xxx
73
-
74
- # 1. Create the managed repo (provisions GitHub repo + starter frontend)
75
- farthershore business create --name weather-api --display-name "Weather API"
59
+ # 1. Create the managed repo. Human output is exactly its URL.
60
+ REPO_URL=$(farthershore business create weather-api)
76
61
 
77
- # 2. Edit business behavior in the repo
78
- gh repo clone acme/weather-api
62
+ # 2. Clone it and author business/ from scratch.
63
+ git clone "$REPO_URL"
79
64
  cd weather-api
80
65
  # ...edit business/business.ts with @farthershore/business...
81
66
 
@@ -86,9 +71,9 @@ farthershore validate --business weather-api
86
71
  git push --set-upstream origin feature/pricing
87
72
  farthershore change-set list weather-api # inspect checks + apply state
88
73
 
89
- # 5. Connect billing, then go live
90
- farthershore connect stripe weather-api
91
- farthershore business publish weather-api
74
+ # 5. Inspect accepted state, then use the CLI for platform operations.
75
+ farthershore business status weather-api --format json
76
+ farthershore operations list --format json
92
77
  ```
93
78
 
94
79
  Plans, prices, limits, routes, meters, and origins are **repo-controlled**:
@@ -120,41 +105,6 @@ write commands cover **operational** state that lives outside the manifest
120
105
 
121
106
  Run `farthershore <group> --help` for the full flag set of any command.
122
107
 
123
- ### `farthershore init`
124
-
125
- Scaffold a starter business repo locally from a named plan preset. Each preset
126
- fills in a functional `business/business.ts` using `fs.requests()`,
127
- `fs.route()`, `fs.plan()`, and a default `fs.business()` export, then creates the matching customer
128
- `frontend/` project, repo-local `business/package.json`, `business/tsconfig.json`,
129
- and `.gitignore`.
130
-
131
- ```bash
132
- # Interactive walkthrough (TTY only) — pick a preset and a path
133
- farthershore init
134
-
135
- # Non-interactive — pass --template explicitly (required when not a TTY)
136
- farthershore init --template free
137
- farthershore init --template starter --force
138
- farthershore init --template metered --format json
139
- farthershore init --template starter --surface frontend --surface agent
140
- ```
141
-
142
- | Template | Shape |
143
- | --------- | ------------------------------------------------------------ |
144
- | `free` | $0 plan, hard-enforced 1k requests/month limit |
145
- | `starter` | $20/mo + $20 included usage, $0.001/request overage |
146
- | `pro` | $100/mo + $200 included usage, 14-day trial, $0.0005/request |
147
- | `prepaid` | $50 one-time signup credit, then pay-as-you-go |
148
- | `metered` | Pure pay-as-you-go at $0.001/request |
149
-
150
- After `init`, add functional meter, route, group, and plan declarations to grow
151
- the business. Configure the platform-owned upstream origin separately.
152
- Pass repeatable
153
- `--surface <frontend|api|docs|widget|dashboard|webhook|worker|agent>` to seed a
154
- specific shape; omitting it keeps the default `frontend + api` starter. Run
155
- `npm install` in `business/`, then `farthershore build` from the repo root to
156
- confirm it compiles.
157
-
158
108
  ### `farthershore create`
159
109
 
160
110
  Create local project components inside a managed builder repo. `create api`
@@ -201,42 +151,27 @@ farthershore validate --local-only --format json
201
151
 
202
152
  ### `farthershore business`
203
153
 
204
- Business lifecycle. Creation provisions a managed GitHub repo (the source of
205
- truth for business behavior) under your connected GitHub account and returns the
206
- clone URL plus bootstrap instructions. A new business starts as a DRAFT with a
207
- generated `frontend/` ready to customize.
154
+ Business lifecycle. Creation provisions a managed GitHub repo as the source of
155
+ truth for business behavior and returns its URL. A new business starts as a
156
+ DRAFT with repository tooling but no predefined business program.
208
157
 
209
158
  ```bash
210
159
  farthershore business list --format json
211
160
  farthershore business show weather-api --format json
212
161
  farthershore business show weather-api --env preview --format json
213
162
 
214
- farthershore business create \
215
- --name weather-api \
163
+ farthershore business create weather-api \
216
164
  --display-name "Weather API" \
217
165
  --format json
218
166
 
219
- # Seed a meter from the same templates the dashboard offers:
220
- # requests (default) | ai-tokens | credits | spend | compute
221
- farthershore business create --name llm-api --meters ai-tokens --format json
222
-
223
- # Or a fully custom meter list (key[:display[:unit]], repeatable):
224
- farthershore business create --name image-api \
225
- --meter requests \
226
- --meter images:Images:image \
227
- --format json
228
-
229
- # Seed initial Business SDK surfaces (repeatable; defaults to frontend + api):
230
- farthershore business create \
231
- --name support-agent \
232
- --surface frontend \
233
- --surface agent \
234
- --format json
235
-
236
167
  farthershore business publish weather-api --format json
237
168
  farthershore business delete weather-api --yes --format json
238
169
  ```
239
170
 
171
+ The JSON result includes `data.business`, `data.repoUrl`, and recovery metadata.
172
+ Gather the product requirements, create the `business/` program, and author its
173
+ plans, prices, limits, routes, and meters from scratch.
174
+
240
175
  `business update` changes platform-owned fields such as display name,
241
176
  description, icon, and logo (icon/logo accept PNG, JPEG, or WEBP). Plans,
242
177
  prices, limits, routes, and meters are repo-controlled and must be changed
@@ -253,9 +188,8 @@ farthershore business update weather-api \
253
188
  --clear-icon --clear-logo --format json
254
189
  ```
255
190
 
256
- `business publish` enforces the same go-live gates as the dashboard: at least one
257
- plan, an origin, and a verified Stripe connection (clear remediation is printed
258
- for `STRIPE_NOT_CONNECTED` / `STRIPE_NOT_VERIFIED` / `BILLING_TAX_NOT_ENROLLED`).
191
+ `business publish` enforces the same go-live gates as the dashboard and returns
192
+ stable remediation errors when a prerequisite is missing.
259
193
 
260
194
  ### `farthershore change-set`
261
195
 
@@ -457,46 +391,20 @@ update` requires `--kind`, `--duration-months`, and the amount flag for that kin
457
391
  whenever you change the code, amount, dates, plan scope, or redemption limits.
458
392
  Use `--all-plans` to clear plan scoping.
459
393
 
460
- ### `farthershore connect`
461
-
462
- GitHub OAuth and Stripe Connect are browser-only. These commands report status so
463
- you can poll until the flow is finished in the dashboard.
464
-
465
- ```bash
466
- farthershore connect github --format json
467
- farthershore connect stripe weather-api --format json
468
- ```
394
+ ### Farther Shore agent skills
469
395
 
470
- ### `farthershore token`
471
-
472
- Manage maker tokens for the current org.
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.
473
399
 
474
400
  ```bash
475
- farthershore token list --format json
476
- farthershore token create --name "ci-bot" --scope businesses:update businesses:publish --format json
477
- farthershore token rotate <tokenId> --sync-to-github --format json
478
- farthershore token revoke <tokenId> --yes --format json
479
- ```
480
-
481
- ### `farthershore skills`
482
-
483
- Inside a business repo, recommend agent skills matching the FartherShore SDK
484
- versions the repo actually uses. The Business SDK and Frontend SDK tracks are
485
- recommended independently, so updating one does not force a skill update for the
486
- other.
487
-
488
- ```bash
489
- farthershore skills recommend --format json
490
- SKILLS_CMD=$(farthershore skills recommend --format json | jq -r '.data.recommendation.command')
491
- eval "$SKILLS_CMD"
401
+ npx skills add https://github.com/farther-shore/skills/tree/v2.1.0 --skill '*' -g -y
492
402
  ```
493
403
 
494
404
  ### `farthershore operations`
495
405
 
496
406
  Print the machine-readable action boundary: which operations are repo-authored
497
- (`contract`), which are CLI/API operations (`operate`), which reconcile through
498
- either path (`dual`), and which are browser-only prerequisites (GitHub linking,
499
- Stripe Connect).
407
+ (`contract`) and which are CLI/API operations (`operate`).
500
408
 
501
409
  ```bash
502
410
  farthershore operations list --format json
@@ -509,14 +417,8 @@ stdout — `{ ok, op, data }` on success, or `{ ok: false, op, error }` on failu
509
417
  where `error` carries a stable `code`, `message`, HTTP `status`, a `retryable`
510
418
  flag, and a remediation `hint` when one is registered. Diagnostics go to stderr.
511
419
 
512
- In table mode, failures print `Error [CODE]: message` plus a `Hint:` line:
513
-
514
- ```text
515
- Error [STRIPE_NOT_CONFIGURED]: connect Stripe before running billing operations
516
- Hint: Stripe isn't connected on this business. Connect it in the dashboard before running billing operations.
517
- ```
518
-
519
- The bracketed code is stable across releases — quote it in support threads.
420
+ In table mode, failures print `Error [CODE]: message` plus a `Hint:` line. The
421
+ bracketed code is stable across releases — quote it in support threads.
520
422
 
521
423
  Exit codes are a branchable taxonomy so a script can tell failure classes apart
522
424
  without parsing text:
@@ -542,11 +444,12 @@ validate --local-only` need no network or auth and are safe to run in CI.
542
444
  The MCP server (`farthershore-mcp`) projects its tools from the same operation
543
445
  registry that defines the CLI commands, so every MCP tool has a CLI sibling. Tool
544
446
  names use the `fs_*` prefix and cover the agent-operable surface: businesses,
545
- environments, plans, frontends, backends, runtime tokens, webhooks, promo codes,
546
- consumers, secrets, personas, usage, and maker tokens.
447
+ environments, organizations, audit logs, notifications, plans, frontends,
448
+ backends, runtime tokens, webhooks, promo codes, consumers, secrets, personas,
449
+ and usage.
547
450
 
548
451
  ```bash
549
- FARTHERSHORE_TOKEN=mk_xxx farthershore-mcp
452
+ FARTHERSHORE_TOKEN="$FARTHERSHORE_TOKEN" farthershore-mcp
550
453
  ```
551
454
 
552
455
  ## Learn more