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