@farthershore/cli 0.14.1 → 0.14.3
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 +129 -98
- package/dist/index.js +90 -89
- package/dist/mcp.js +34 -34
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
# @farthershore/cli
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
from the terminal.
|
|
5
|
-
|
|
3
|
+
Bootstrap and operate [FartherShore](https://farthershore.com) software
|
|
4
|
+
businesses from the terminal. Product behavior is authored in the GitHub repo;
|
|
5
|
+
the CLI is the agent-friendly tool layer for setup, release, observability, and
|
|
6
|
+
runtime operations. Every command supports `--format json` for non-TTY
|
|
7
|
+
scripting. GitHub account linking and Stripe Connect/KYC stay browser-hosted;
|
|
8
|
+
the CLI reports their status so agents can continue after the builder completes
|
|
9
|
+
those flows.
|
|
6
10
|
|
|
7
11
|
## Install
|
|
8
12
|
|
|
@@ -47,6 +51,23 @@ farthershore auth whoami # Show current org, role, scopes
|
|
|
47
51
|
farthershore auth logout # Clear stored credentials
|
|
48
52
|
```
|
|
49
53
|
|
|
54
|
+
## Agent skills
|
|
55
|
+
|
|
56
|
+
Inside a managed business repo, install SDK-compatible agent skills from the SDK
|
|
57
|
+
versions the repo actually uses. The Business SDK and Frontend SDK tracks are
|
|
58
|
+
recommended independently, so updating `@farthershore/business` does not force a
|
|
59
|
+
`@farthershore/farthershore-js` skill update, or the reverse.
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
farthershore skills recommend --format json
|
|
63
|
+
SKILLS_CMD=$(farthershore skills recommend --format json | jq -r '.data.recommendation.command')
|
|
64
|
+
eval "$SKILLS_CMD"
|
|
65
|
+
|
|
66
|
+
# Refresh only the track for the SDK that changed:
|
|
67
|
+
farthershore skills recommend --format json \
|
|
68
|
+
| jq -r '.data.recommendation.tracks[] | "\(.packageName) -> \(.command)"'
|
|
69
|
+
```
|
|
70
|
+
|
|
50
71
|
## Global flags
|
|
51
72
|
|
|
52
73
|
| Flag | Description |
|
|
@@ -68,13 +89,28 @@ farthershore auth logout # Clear stored credentials
|
|
|
68
89
|
|
|
69
90
|
## Commands
|
|
70
91
|
|
|
92
|
+
### `farthershore operations`
|
|
93
|
+
|
|
94
|
+
Print the machine-readable action boundary before an agent attempts a change:
|
|
95
|
+
repo-authored product behavior, API-controlled runtime operations, dual
|
|
96
|
+
repo/API operations, and browser-only prerequisites.
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
farthershore operations list --format json
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`contract` rows are changed in `business/business.config.ts` and pushed through
|
|
103
|
+
GitHub. `operate` rows are CLI/Core API actions. `dual` rows reconcile through
|
|
104
|
+
either path. `browserOnlyPrerequisites` currently includes GitHub account
|
|
105
|
+
linking and Stripe Connect onboarding, both status-only from the CLI.
|
|
106
|
+
|
|
71
107
|
### `farthershore init`
|
|
72
108
|
|
|
73
|
-
Scaffold a starter software-
|
|
74
|
-
fills in the 5-knob spec in a single decorated `
|
|
75
|
-
`@
|
|
109
|
+
Scaffold a starter software-business repo from a named plan preset. Each preset
|
|
110
|
+
fills in the 5-knob spec in a single decorated `business/business.config.ts` — one
|
|
111
|
+
`@Business` class with `@Meter`/`@Feature`/`@Plan` members.
|
|
76
112
|
The command also creates a customer `frontend/` project, repo-local
|
|
77
|
-
`
|
|
113
|
+
`business/package.json`, `business/tsconfig.json`, and `.gitignore`, matching the
|
|
78
114
|
two-root shape generated by dashboard product creation.
|
|
79
115
|
|
|
80
116
|
```bash
|
|
@@ -98,107 +134,118 @@ Templates (sourced from shared-types `listPlanPresets()`):
|
|
|
98
134
|
| `prepaid` | $50 one-time signup credit, then PAYG |
|
|
99
135
|
| `metered` | Pure pay-as-you-go at $0.001/request |
|
|
100
136
|
|
|
101
|
-
After `init`, edit the `@
|
|
102
|
-
`
|
|
137
|
+
After `init`, edit the `@Business({ name, origin })` decorator in
|
|
138
|
+
`business/business.config.ts`. `origin` is the business logic destination Farther
|
|
103
139
|
Shore calls for customer-facing actions. Add `@Meter`/`@Feature`/`@Plan`
|
|
104
|
-
members to the class to grow the
|
|
140
|
+
members to the class to grow the business. Pass repeatable
|
|
105
141
|
`--surface <frontend|api|docs|widget|dashboard|webhook|worker|agent>` to seed a
|
|
106
|
-
frontend-only, agent, worker, API, or hybrid
|
|
142
|
+
frontend-only, agent, worker, API, or hybrid business. Omitting `--surface`
|
|
107
143
|
keeps the default `frontend + api` starter and its sample gateway route. Run
|
|
108
|
-
`npm install` in `
|
|
109
|
-
root to confirm the scaffolded
|
|
144
|
+
`npm install` in `business/` once, then run `farthershore build` from the repo
|
|
145
|
+
root to confirm the scaffolded business compiles locally. Customize `frontend/`
|
|
110
146
|
for signup, pricing, account, and usage screens.
|
|
111
147
|
|
|
112
148
|
### `farthershore build`
|
|
113
149
|
|
|
114
|
-
Build a
|
|
115
|
-
manifest builder. The CLI first uses the builder installed under `
|
|
150
|
+
Build a business-as-code `business/business.config.ts` with the Business SDK
|
|
151
|
+
manifest builder. The CLI first uses the builder installed under `business/`,
|
|
116
152
|
then falls back to a root install. The command emits a Manifest IR envelope to
|
|
117
|
-
`
|
|
118
|
-
state are handled by the GitHub bot when `
|
|
119
|
-
repo-backed
|
|
153
|
+
`business-build.json` by default. Server-side validation and accepted lifecycle
|
|
154
|
+
state are handled by the GitHub bot when `business/**` changes are pushed to the
|
|
155
|
+
repo-backed business.
|
|
120
156
|
|
|
121
157
|
```bash
|
|
122
158
|
farthershore build
|
|
123
|
-
farthershore build --entry
|
|
159
|
+
farthershore build --entry business/business.config.ts --out business-build.json
|
|
124
160
|
farthershore build --format json
|
|
125
161
|
```
|
|
126
162
|
|
|
127
|
-
### `farthershore
|
|
163
|
+
### `farthershore business`
|
|
128
164
|
|
|
129
|
-
|
|
165
|
+
Business lifecycle commands. Creation requires a connected GitHub account because
|
|
130
166
|
Farther Shore always provisions the editable `frontend/` starter repo for a new
|
|
131
167
|
product.
|
|
132
168
|
|
|
133
169
|
```bash
|
|
134
|
-
farthershore
|
|
135
|
-
farthershore
|
|
136
|
-
farthershore
|
|
170
|
+
farthershore business list --format json
|
|
171
|
+
farthershore business show weather-api --format json
|
|
172
|
+
farthershore business show weather-api --env preview --format json
|
|
137
173
|
|
|
138
|
-
farthershore
|
|
174
|
+
farthershore business create \
|
|
139
175
|
--name weather-api \
|
|
140
176
|
--display-name "Weather API" \
|
|
141
|
-
--origin https://api.example.com \
|
|
142
177
|
--format json
|
|
143
178
|
|
|
144
179
|
# Meter templates — the same smart defaults the dashboard offers:
|
|
145
180
|
# requests (default) | ai-tokens | credits | spend | compute
|
|
146
|
-
farthershore
|
|
181
|
+
farthershore business create \
|
|
147
182
|
--name llm-api \
|
|
148
|
-
--origin https://api.llm.example.com \
|
|
149
183
|
--meters ai-tokens \
|
|
150
184
|
--format json
|
|
151
185
|
|
|
152
186
|
# Or a fully custom meter list (key[:display[:unit]], repeatable):
|
|
153
|
-
farthershore
|
|
154
|
-
--origin https://api.images.example.com \
|
|
187
|
+
farthershore business create --name image-api \
|
|
155
188
|
--meter requests \
|
|
156
189
|
--meter images:Images:image \
|
|
157
190
|
--format json
|
|
158
191
|
|
|
159
|
-
# Seed initial
|
|
160
|
-
farthershore
|
|
192
|
+
# Seed initial Business SDK surfaces (repeatable). Defaults to frontend + API.
|
|
193
|
+
farthershore business create \
|
|
161
194
|
--name support-agent \
|
|
162
|
-
--origin https://app.example.com \
|
|
163
|
-
--repo-owner acme \
|
|
164
|
-
--repo-name support-agent \
|
|
165
195
|
--surface frontend \
|
|
166
196
|
--surface agent \
|
|
167
197
|
--format json
|
|
168
198
|
|
|
169
|
-
farthershore
|
|
170
|
-
farthershore
|
|
171
|
-
|
|
199
|
+
farthershore business update weather-api --display-name "Weather" --format json
|
|
200
|
+
farthershore business update weather-api \
|
|
201
|
+
--display-name "Weather" \
|
|
202
|
+
--description "Weather API for agents" \
|
|
203
|
+
--primary-color '#22c55e' \
|
|
204
|
+
--icon-file ./brand/icon.png \
|
|
205
|
+
--logo-file ./brand/logo.webp \
|
|
206
|
+
--format json
|
|
207
|
+
farthershore business update weather-api \
|
|
208
|
+
--clear-primary-color --clear-icon --clear-logo --format json
|
|
209
|
+
farthershore business publish weather-api --format json
|
|
210
|
+
farthershore business delete weather-api --yes --format json
|
|
172
211
|
```
|
|
173
212
|
|
|
174
|
-
`
|
|
175
|
-
agent bootstrap instructions in the response.
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
213
|
+
`business create` provisions a managed GitHub repo under the connected GitHub
|
|
214
|
+
account and returns clone-URL plus agent bootstrap instructions in the response.
|
|
215
|
+
That repo is the product behavior source of truth. Plans, prices, limits,
|
|
216
|
+
routes, meters, policies, workflows, gateway config, origins, and backend
|
|
217
|
+
definitions are changed by editing the Business SDK program and pushing a
|
|
218
|
+
branch. Business SDK changes can be built locally with `farthershore build`;
|
|
219
|
+
accepted changes are compiled and published by the GitHub bot after they are
|
|
220
|
+
committed and pushed.
|
|
221
|
+
|
|
222
|
+
`business update` is deliberately presentation-only. It updates operate-state
|
|
223
|
+
fields that are not the product contract: display name, description, primary
|
|
224
|
+
brand color, icon, and logo. Local icon/logo uploads accept PNG, JPEG, or WEBP
|
|
225
|
+
files. Plans, prices, limits, routes, meters, policies, workflows, origins, and
|
|
226
|
+
backend definitions are repo-controlled and must be changed through the Business
|
|
227
|
+
SDK code path.
|
|
228
|
+
|
|
229
|
+
Omitting both meter flags during bootstrap gives the starter business a
|
|
230
|
+
`requests` meter. Plain request counting is platform-managed. Variable-value
|
|
231
|
+
meters such as tokens, credits, or compute must be declared in the Business SDK
|
|
232
|
+
as route `reports` and reported by the upstream with `@farthershore/backend`.
|
|
186
233
|
|
|
187
234
|
A new product starts as a DRAFT with a generated `frontend/` project ready for
|
|
188
235
|
customization. Going live mirrors the dashboard's "Finish setting up" checklist:
|
|
189
236
|
|
|
190
237
|
```bash
|
|
191
|
-
farthershore
|
|
192
|
-
--name llm-api
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
farthershore
|
|
197
|
-
|
|
198
|
-
farthershore
|
|
238
|
+
farthershore business create \
|
|
239
|
+
--name llm-api # 1. create repo
|
|
240
|
+
gh repo clone acme/llm-api # 2. edit business/
|
|
241
|
+
farthershore build --format json # 3. validate locally
|
|
242
|
+
git push --set-upstream origin feature/pricing # 4. open PR
|
|
243
|
+
farthershore change-set list llm-api --format json # 5. inspect checks
|
|
244
|
+
farthershore connect stripe llm-api # 6. connect billing
|
|
245
|
+
farthershore business publish llm-api # 7. go live
|
|
199
246
|
```
|
|
200
247
|
|
|
201
|
-
`
|
|
248
|
+
`business publish` enforces the same gates as the dashboard: at least one
|
|
202
249
|
plan, an origin, and a verified Stripe connection (clear remediation is
|
|
203
250
|
printed for `STRIPE_NOT_CONNECTED` / `STRIPE_NOT_VERIFIED` /
|
|
204
251
|
`BILLING_TAX_NOT_ENROLLED`).
|
|
@@ -216,9 +263,9 @@ farthershore env delete weather-api preview --yes --format json
|
|
|
216
263
|
|
|
217
264
|
### `farthershore plan`
|
|
218
265
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
266
|
+
Read code-managed plans and operate live subscriber migrations. The CLI does
|
|
267
|
+
not create, update, or delete plan definitions; edit the Business SDK program in
|
|
268
|
+
the repo for product behavior changes.
|
|
222
269
|
|
|
223
270
|
```bash
|
|
224
271
|
# Human-readable table (default in TTY)
|
|
@@ -228,26 +275,8 @@ farthershore plan list weather-api --format table
|
|
|
228
275
|
# JSON envelope (default outside TTY; suitable for jq pipelines)
|
|
229
276
|
farthershore plan list weather-api --format json
|
|
230
277
|
|
|
231
|
-
#
|
|
232
|
-
farthershore plan
|
|
233
|
-
--key pro \
|
|
234
|
-
--name "Pro" \
|
|
235
|
-
--recurring-fee-cents 2900 \
|
|
236
|
-
--format json
|
|
237
|
-
|
|
238
|
-
# Included usage: fee + monthly credit grant
|
|
239
|
-
farthershore plan create weather-api \
|
|
240
|
-
--key included \
|
|
241
|
-
--name "Included" \
|
|
242
|
-
--recurring-fee-cents 2000 \
|
|
243
|
-
--grant recurring:2000 \
|
|
244
|
-
--format json
|
|
245
|
-
|
|
246
|
-
# Free plan
|
|
247
|
-
farthershore plan create weather-api --key free --name "Free" --free --format json
|
|
248
|
-
|
|
249
|
-
farthershore plan update weather-api <planId> --recurring-fee-cents 3900 --format json
|
|
250
|
-
farthershore plan delete weather-api <planId> --yes --env preview --format json
|
|
278
|
+
# Operate live subscribers after a repo-authored plan version is released
|
|
279
|
+
farthershore plan migrate weather-api pro --from 1 --to head --policy next_renewal --format json
|
|
251
280
|
```
|
|
252
281
|
|
|
253
282
|
### `farthershore persona`
|
|
@@ -331,14 +360,16 @@ Manage maker tokens for the current org.
|
|
|
331
360
|
```bash
|
|
332
361
|
farthershore token list --format json
|
|
333
362
|
farthershore token create --name "ci-bot" --scope products:update products:publish --format json
|
|
363
|
+
farthershore token rotate <tokenId> --sync-to-github --format json
|
|
334
364
|
farthershore token revoke <tokenId> --yes --format json
|
|
365
|
+
farthershore token delete <tokenId> --yes --format json
|
|
335
366
|
```
|
|
336
367
|
|
|
337
368
|
#### Plan knobs
|
|
338
369
|
|
|
339
|
-
Every plan is a configuration of orthogonal billing knobs. Older
|
|
340
|
-
`pricing.{model, monthlyPriceCents}`, top-level `billing.strategy`,
|
|
341
|
-
credit grant fields are no longer accepted by the validator.
|
|
370
|
+
Every repo-authored plan is a configuration of orthogonal billing knobs. Older
|
|
371
|
+
shapes with `pricing.{model, monthlyPriceCents}`, top-level `billing.strategy`,
|
|
372
|
+
or scalar credit grant fields are no longer accepted by the validator.
|
|
342
373
|
|
|
343
374
|
| Knob | Cents/unit | Meaning |
|
|
344
375
|
| ------------------------- | ---------------- | ------------------------------------------------------- |
|
|
@@ -418,8 +449,8 @@ plans:
|
|
|
418
449
|
#### `grants[]` array
|
|
419
450
|
|
|
420
451
|
Plans accept a typed `grants[]` array. It is the only public credit surface.
|
|
421
|
-
|
|
422
|
-
|
|
452
|
+
Declare grants in the Business SDK program and push the repo change through the
|
|
453
|
+
normal change-set flow.
|
|
423
454
|
|
|
424
455
|
Valid `kind` values:
|
|
425
456
|
|
|
@@ -498,20 +529,20 @@ A typical agent flow:
|
|
|
498
529
|
```bash
|
|
499
530
|
export FARTHERSHORE_TOKEN=mk_xxx
|
|
500
531
|
|
|
501
|
-
farthershore
|
|
532
|
+
farthershore business create \
|
|
502
533
|
--name weather-api \
|
|
503
|
-
--origin https://api.example.com \
|
|
504
534
|
--format json
|
|
505
535
|
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
536
|
+
gh repo clone acme/weather-api
|
|
537
|
+
cd weather-api
|
|
538
|
+
# Edit business/business.config.ts with the Business SDK.
|
|
510
539
|
farthershore build --format json
|
|
511
|
-
|
|
540
|
+
git push --set-upstream origin feature/pricing
|
|
541
|
+
farthershore change-set list weather-api --format json
|
|
542
|
+
farthershore business show weather-api --format json
|
|
512
543
|
```
|
|
513
544
|
|
|
514
|
-
For
|
|
545
|
+
For business updates, edit `business/business.config.ts` or any modules it imports
|
|
515
546
|
and build locally with:
|
|
516
547
|
|
|
517
548
|
```bash
|
|
@@ -522,9 +553,9 @@ farthershore build --format json
|
|
|
522
553
|
|
|
523
554
|
The MCP server (`farthershore-mcp`) projects tool definitions from the same
|
|
524
555
|
operation registry that generates the CLI command groups. Tool names use the
|
|
525
|
-
`fs_*` prefix and cover the agent-
|
|
556
|
+
`fs_*` prefix and cover the agent-operable platform surface:
|
|
526
557
|
|
|
527
|
-
- Products: `
|
|
558
|
+
- Products: `fs_business_list`, `fs_brand_update`, `fs_business_publish`
|
|
528
559
|
- Environments: `fs_env_list`, `fs_env_create`
|
|
529
560
|
- Plans: `fs_plan_list`
|
|
530
561
|
- Backends: `fs_backend_list`, `fs_backend_create`, `fs_backend_delete`
|
|
@@ -559,4 +590,4 @@ The CLI is non-interactive whenever a token is available via the
|
|
|
559
590
|
`--token` flag or `FARTHERSHORE_TOKEN` env var — `auth login` only
|
|
560
591
|
prompts when stdin is a TTY and no token argument was passed, so it's
|
|
561
592
|
safe to script. `farthershore build` is CI-safe and can be run under `CI` /
|
|
562
|
-
`GITHUB_ACTIONS` for local
|
|
593
|
+
`GITHUB_ACTIONS` for local Business SDK compilation.
|