@farthershore/cli 0.9.2 → 0.11.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 +94 -66
- package/dist/index.js +147 -69
- package/dist/mcp.js +17 -17
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @farthershore/cli
|
|
2
2
|
|
|
3
|
-
Create and manage [FartherShore](https://farthershore.com)
|
|
4
|
-
the terminal. Designed for AI agents and humans alike — every command
|
|
5
|
-
`--format json` for non-TTY scripting.
|
|
3
|
+
Create and manage [FartherShore](https://farthershore.com) software products
|
|
4
|
+
from the terminal. Designed for AI agents and humans alike — every command
|
|
5
|
+
supports `--format json` for non-TTY scripting.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -52,7 +52,7 @@ farthershore auth logout # Clear stored credentials
|
|
|
52
52
|
| Flag | Description |
|
|
53
53
|
| --------------------- | -------------------------------------------------------- |
|
|
54
54
|
| `--token <token>` | Override auth token for this command |
|
|
55
|
-
| `--api-url <url>` | Override API
|
|
55
|
+
| `--api-url <url>` | Override platform Core API URL |
|
|
56
56
|
| `--env <environment>` | Environment scope (use `production`/`prod`/`main`) |
|
|
57
57
|
| `--format <format>` | `json` for machine-readable output (default for non-TTY) |
|
|
58
58
|
| `--version` | Show version |
|
|
@@ -60,19 +60,22 @@ farthershore auth logout # Clear stored credentials
|
|
|
60
60
|
|
|
61
61
|
## Environment variables
|
|
62
62
|
|
|
63
|
-
| Variable | Description
|
|
64
|
-
| ---------------------- |
|
|
65
|
-
| `FARTHERSHORE_TOKEN` | API token (overrides stored credentials)
|
|
66
|
-
| `FARTHERSHORE_API_URL` | API
|
|
67
|
-
| `FARTHERSHORE_ENV` | Default environment scope when `--env` is omitted
|
|
63
|
+
| Variable | Description |
|
|
64
|
+
| ---------------------- | ---------------------------------------------------------------- |
|
|
65
|
+
| `FARTHERSHORE_TOKEN` | API token (overrides stored credentials) |
|
|
66
|
+
| `FARTHERSHORE_API_URL` | Platform Core API URL (default: `https://core.farthershore.com`) |
|
|
67
|
+
| `FARTHERSHORE_ENV` | Default environment scope when `--env` is omitted |
|
|
68
68
|
|
|
69
69
|
## Commands
|
|
70
70
|
|
|
71
71
|
### `farthershore init`
|
|
72
72
|
|
|
73
|
-
Scaffold a starter
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
Scaffold a starter software-product repo from a named plan preset. Each preset
|
|
74
|
+
fills in the 5-knob spec through `product/plans.ts`, with
|
|
75
|
+
`product/product.config.ts` composing `meters.ts`, `features.ts`, and `plans.ts`.
|
|
76
|
+
The command also creates a customer `frontend/` project, repo-local
|
|
77
|
+
`product/package.json`, `product/tsconfig.json`, and `.gitignore`, matching the
|
|
78
|
+
two-root shape generated by dashboard product creation.
|
|
76
79
|
|
|
77
80
|
```bash
|
|
78
81
|
# Interactive walkthrough (TTY only) — pick a preset by number/name + path
|
|
@@ -82,6 +85,7 @@ farthershore init
|
|
|
82
85
|
farthershore init --template free
|
|
83
86
|
farthershore init --template starter --force
|
|
84
87
|
farthershore init --template metered --format json
|
|
88
|
+
farthershore init --template starter --surface frontend --surface agent
|
|
85
89
|
```
|
|
86
90
|
|
|
87
91
|
Templates (sourced from shared-types `listPlanPresets()`):
|
|
@@ -94,30 +98,30 @@ Templates (sourced from shared-types `listPlanPresets()`):
|
|
|
94
98
|
| `prepaid` | $50 one-time signup credit, then PAYG |
|
|
95
99
|
| `metered` | Pure pay-as-you-go at $0.001/request |
|
|
96
100
|
|
|
97
|
-
After `init`, edit the `fs.
|
|
98
|
-
`product/product.config.ts
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
After `init`, edit the `fs.product(...)` product name and `origin` in
|
|
102
|
+
`product/product.config.ts`. `origin` is the business logic destination Farther
|
|
103
|
+
Shore calls for customer-facing actions. Keep the generated module split or
|
|
104
|
+
reorganize the product into any imported files you want. Pass repeatable
|
|
105
|
+
`--surface <frontend|api|docs|widget|dashboard|webhook|worker|agent>` to seed a
|
|
106
|
+
frontend-only, agent, worker, API, or hybrid product. Omitting `--surface`
|
|
107
|
+
keeps the default `frontend + api` starter and its sample gateway route. Run
|
|
108
|
+
`npm install` in `product/` once, then run `farthershore build` from the repo
|
|
109
|
+
root to confirm the scaffolded product compiles locally. Customize `frontend/`
|
|
110
|
+
for signup, pricing, account, and usage screens.
|
|
101
111
|
|
|
102
112
|
### `farthershore build`
|
|
103
113
|
|
|
104
114
|
Build a product-as-code `product/product.config.ts` with the Product SDK
|
|
105
115
|
manifest builder. The CLI first uses the builder installed under `product/`,
|
|
106
116
|
then falls back to a root install. The command emits a Manifest IR envelope to
|
|
107
|
-
`manifest-ir.json` by default.
|
|
117
|
+
`manifest-ir.json` by default. Server-side validation and accepted lifecycle
|
|
118
|
+
state are handled by the GitHub bot when `product/**` changes are pushed to the
|
|
119
|
+
repo-backed product.
|
|
108
120
|
|
|
109
121
|
```bash
|
|
110
122
|
farthershore build
|
|
111
123
|
farthershore build --entry product/product.config.ts --out manifest-ir.json
|
|
112
124
|
farthershore build --format json
|
|
113
|
-
|
|
114
|
-
# Optional dry-run compile against core after the local build succeeds
|
|
115
|
-
farthershore build --validate weather-api --format json
|
|
116
|
-
farthershore build --validate weather-api --env preview --format json
|
|
117
|
-
|
|
118
|
-
# Apply the accepted lifecycle state through core without relying on GitHub
|
|
119
|
-
farthershore build --apply weather-api --format json
|
|
120
|
-
farthershore build --apply weather-api --env preview --format json
|
|
121
125
|
```
|
|
122
126
|
|
|
123
127
|
### `farthershore product`
|
|
@@ -134,53 +138,68 @@ farthershore product show weather-api --env preview --format json
|
|
|
134
138
|
farthershore product create \
|
|
135
139
|
--name weather-api \
|
|
136
140
|
--display-name "Weather API" \
|
|
137
|
-
--
|
|
141
|
+
--origin https://api.example.com \
|
|
138
142
|
--format json
|
|
139
143
|
|
|
140
144
|
# Meter templates — the same smart defaults the dashboard offers:
|
|
141
145
|
# requests (default) | ai-tokens | credits | spend | compute
|
|
142
|
-
farthershore product create
|
|
146
|
+
farthershore product create \
|
|
147
|
+
--name llm-api \
|
|
148
|
+
--origin https://api.llm.example.com \
|
|
149
|
+
--meters ai-tokens \
|
|
150
|
+
--format json
|
|
143
151
|
|
|
144
152
|
# Or a fully custom meter list (key[:display[:unit]], repeatable):
|
|
145
153
|
farthershore product create --name image-api \
|
|
154
|
+
--origin https://api.images.example.com \
|
|
146
155
|
--meter requests \
|
|
147
156
|
--meter images:Images:image \
|
|
148
157
|
--format json
|
|
149
158
|
|
|
159
|
+
# Seed initial Product SDK surfaces (repeatable). Defaults to frontend + API.
|
|
160
|
+
farthershore product create \
|
|
161
|
+
--name support-agent \
|
|
162
|
+
--origin https://app.example.com \
|
|
163
|
+
--repo-owner acme \
|
|
164
|
+
--repo-name support-agent \
|
|
165
|
+
--surface frontend \
|
|
166
|
+
--surface agent \
|
|
167
|
+
--format json
|
|
168
|
+
|
|
150
169
|
farthershore product update weather-api --display-name "Weather" --format json
|
|
151
170
|
farthershore product publish weather-api --format json
|
|
152
171
|
farthershore product delete weather-api --yes --format json
|
|
153
|
-
|
|
154
|
-
farthershore product compile weather-api --dry-run --format json
|
|
155
|
-
farthershore product compile weather-api --branch env/preview --format json
|
|
156
172
|
```
|
|
157
173
|
|
|
158
174
|
`product create` provisions a managed GitHub repo and returns clone-URL +
|
|
159
175
|
agent bootstrap instructions in the response. That repo is required for the
|
|
160
176
|
starter `frontend/` project and normal customization workflow. Product SDK
|
|
161
|
-
changes can be
|
|
162
|
-
|
|
177
|
+
changes can be built locally with `farthershore build`; accepted changes are
|
|
178
|
+
compiled and published by the GitHub bot after they are committed and pushed.
|
|
163
179
|
|
|
164
180
|
Plan pricing lives on the plan (see `farthershore plan create` below) — the
|
|
165
181
|
product itself no longer carries a `billingStrategy`. Omitting both meter flags
|
|
166
|
-
gives the product a `requests` meter
|
|
167
|
-
|
|
182
|
+
gives the product a `requests` meter. Plain request counting is
|
|
183
|
+
platform-managed. Variable-value meters such as tokens, credits, or compute must
|
|
184
|
+
be declared in the Product SDK as route `reports` and reported by the upstream
|
|
185
|
+
with `@farthershore/metering`.
|
|
168
186
|
|
|
169
187
|
A new product starts as a DRAFT with a generated `frontend/` project ready for
|
|
170
188
|
customization. Going live mirrors the dashboard's "Finish setting up" checklist:
|
|
171
189
|
|
|
172
190
|
```bash
|
|
173
|
-
farthershore product create
|
|
191
|
+
farthershore product create \
|
|
192
|
+
--name llm-api \
|
|
193
|
+
--origin https://api.example.com \
|
|
194
|
+
--meters ai-tokens # 1. create
|
|
174
195
|
farthershore connect stripe llm-api # 2. connect billing
|
|
175
196
|
farthershore plan create llm-api --key pro --name "Pro" \
|
|
176
197
|
--recurring-fee-cents 2900 # 3. how you charge
|
|
177
|
-
farthershore product
|
|
178
|
-
--base-url https://api.example.com # 4. endpoint
|
|
179
|
-
farthershore product publish llm-api # 5. go live
|
|
198
|
+
farthershore product publish llm-api # 4. go live
|
|
180
199
|
```
|
|
181
200
|
|
|
182
201
|
`product publish` enforces the same gates as the dashboard: at least one
|
|
183
|
-
plan,
|
|
202
|
+
plan, an origin, and a verified Stripe connection (clear remediation is
|
|
184
203
|
printed for `STRIPE_NOT_CONNECTED` / `STRIPE_NOT_VERIFIED` /
|
|
185
204
|
`BILLING_TAX_NOT_ENROLLED`).
|
|
186
205
|
|
|
@@ -250,6 +269,29 @@ Read recent usage off the management API.
|
|
|
250
269
|
farthershore usage summary weather-api --format json
|
|
251
270
|
```
|
|
252
271
|
|
|
272
|
+
### `farthershore metering tokens`
|
|
273
|
+
|
|
274
|
+
Provision runtime metering tokens for upstream services. Core stores only token
|
|
275
|
+
hashes; the raw token is returned once and should be deployed as
|
|
276
|
+
`FARTHERSHORE_METERING_TOKEN`.
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
farthershore metering tokens list weather-api --format json
|
|
280
|
+
farthershore metering tokens create weather-api --name "prod-api" --format json
|
|
281
|
+
farthershore metering tokens create weather-api --name "preview-api" --env preview --format json
|
|
282
|
+
farthershore metering tokens revoke weather-api <tokenId> --yes --format json
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Pair the token with `@farthershore/metering` in the upstream:
|
|
286
|
+
|
|
287
|
+
```ts
|
|
288
|
+
import { withUsage } from "@farthershore/metering";
|
|
289
|
+
|
|
290
|
+
return withUsage(request, Response.json(result), {
|
|
291
|
+
tokens_used: result.tokensUsed,
|
|
292
|
+
});
|
|
293
|
+
```
|
|
294
|
+
|
|
253
295
|
### `farthershore connect`
|
|
254
296
|
|
|
255
297
|
GitHub OAuth and Stripe Connect flows are browser-only. These commands
|
|
@@ -270,17 +312,6 @@ farthershore token create --name "ci-bot" --scope products:update products:publi
|
|
|
270
312
|
farthershore token revoke <tokenId> --yes --format json
|
|
271
313
|
```
|
|
272
314
|
|
|
273
|
-
### `farthershore build --validate <product>`
|
|
274
|
-
|
|
275
|
-
`build --validate` runs a local manifest compile + server-side validation
|
|
276
|
-
pass after `product/product.config.ts` is built. This is the replacement for the
|
|
277
|
-
deleted `validate`/`apply` proposal flow.
|
|
278
|
-
|
|
279
|
-
```bash
|
|
280
|
-
farthershore build --validate weather-api --format json
|
|
281
|
-
farthershore build --validate weather-api --env preview --format json
|
|
282
|
-
```
|
|
283
|
-
|
|
284
315
|
#### Plan knobs
|
|
285
316
|
|
|
286
317
|
Every plan is a configuration of 5 orthogonal knobs (shared-types
|
|
@@ -419,7 +450,8 @@ Validation surfaces:
|
|
|
419
450
|
#### Deprecation window (Phase 3b)
|
|
420
451
|
|
|
421
452
|
The product top-level `lifecycle.breaking_changes` block declares the
|
|
422
|
-
breaking-change governance policy validated
|
|
453
|
+
breaking-change governance policy validated by the GitHub bot/Core release
|
|
454
|
+
path:
|
|
423
455
|
|
|
424
456
|
```yaml
|
|
425
457
|
lifecycle:
|
|
@@ -428,15 +460,11 @@ lifecycle:
|
|
|
428
460
|
require_successor_route: true
|
|
429
461
|
```
|
|
430
462
|
|
|
431
|
-
When the policy is set
|
|
432
|
-
|
|
433
|
-
-
|
|
434
|
-
|
|
435
|
-
-
|
|
436
|
-
`features.<x>.routes[]` and warns when the server-side
|
|
437
|
-
`breaking-change-safety-check` cron will gate publish via
|
|
438
|
-
`ConsumerActivity` lookup. When `require_successor_route` is true,
|
|
439
|
-
it also adds a successor-required warning.
|
|
463
|
+
When the policy is set, Core emits a `route_removed` change for every route
|
|
464
|
+
dropped from `features.<x>.routes[]` and warns when the server-side
|
|
465
|
+
`breaking-change-safety-check` cron will gate publish via `ConsumerActivity`
|
|
466
|
+
lookup. When `require_successor_route` is true, it also adds a
|
|
467
|
+
successor-required warning.
|
|
440
468
|
|
|
441
469
|
The CLI never blocks on the window itself — the per-consumer lookup
|
|
442
470
|
lives server-side (Phase 1c `ConsumerActivity` table + Phase 3b cron).
|
|
@@ -450,22 +478,22 @@ export FARTHERSHORE_TOKEN=mk_xxx
|
|
|
450
478
|
|
|
451
479
|
farthershore product create \
|
|
452
480
|
--name weather-api \
|
|
453
|
-
--
|
|
481
|
+
--origin https://api.example.com \
|
|
454
482
|
--format json
|
|
455
483
|
|
|
456
484
|
farthershore plan create weather-api --key free --name "Free" --free --format json
|
|
457
485
|
farthershore plan create weather-api \
|
|
458
486
|
--key pro --name "Pro" --recurring-fee-cents 2900 --format json
|
|
459
487
|
|
|
460
|
-
farthershore build --
|
|
488
|
+
farthershore build --format json
|
|
461
489
|
farthershore product show weather-api --format json
|
|
462
490
|
```
|
|
463
491
|
|
|
464
492
|
For product updates, edit `product/product.config.ts` or any modules it imports
|
|
465
|
-
and
|
|
493
|
+
and build locally with:
|
|
466
494
|
|
|
467
495
|
```bash
|
|
468
|
-
farthershore build --
|
|
496
|
+
farthershore build --format json
|
|
469
497
|
```
|
|
470
498
|
|
|
471
499
|
## MCP server
|
|
@@ -499,5 +527,5 @@ for CI scripts.
|
|
|
499
527
|
The CLI is non-interactive whenever a token is available via the
|
|
500
528
|
`--token` flag or `FARTHERSHORE_TOKEN` env var — `auth login` only
|
|
501
529
|
prompts when stdin is a TTY and no token argument was passed, so it's
|
|
502
|
-
safe to script. `farthershore build
|
|
503
|
-
|
|
530
|
+
safe to script. `farthershore build` is CI-safe and can be run under `CI` /
|
|
531
|
+
`GITHUB_ACTIONS` for local Product SDK compilation.
|