@farthershore/cli 0.10.0 → 0.12.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
@@ -1,8 +1,8 @@
1
1
  # @farthershore/cli
2
2
 
3
- Create and manage [FartherShore](https://farthershore.com) API products from
4
- the terminal. Designed for AI agents and humans alike — every command supports
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 base URL |
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 base URL (default: `https://core.farthershore.com`) |
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 `product/product.config.ts` from a named plan preset. Each
74
- preset fills in the 5-knob spec through the Product SDK so first-time builders
75
- skip the blank-page problem.
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.business(...)` product name + base URL in
98
- `product/product.config.ts`, split the product into any imported modules you
99
- want, then run `farthershore build --validate` to confirm the scaffolded
100
- manifest compiles.
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,32 +138,44 @@ 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
- --base-url https://api.example.com \
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 --name llm-api --meters ai-tokens --format json
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 validated with `farthershore build --validate` and applied to the
162
- repo-backed product with `farthershore build --apply`.
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
@@ -172,17 +188,18 @@ A new product starts as a DRAFT with a generated `frontend/` project ready for
172
188
  customization. Going live mirrors the dashboard's "Finish setting up" checklist:
173
189
 
174
190
  ```bash
175
- farthershore product create --name llm-api --meters ai-tokens # 1. create
191
+ farthershore product create \
192
+ --name llm-api \
193
+ --origin https://api.example.com \
194
+ --meters ai-tokens # 1. create
176
195
  farthershore connect stripe llm-api # 2. connect billing
177
196
  farthershore plan create llm-api --key pro --name "Pro" \
178
197
  --recurring-fee-cents 2900 # 3. how you charge
179
- farthershore product update llm-api \
180
- --base-url https://api.example.com # 4. endpoint
181
- farthershore product publish llm-api # 5. go live
198
+ farthershore product publish llm-api # 4. go live
182
199
  ```
183
200
 
184
201
  `product publish` enforces the same gates as the dashboard: at least one
185
- plan, a base URL, and a verified Stripe connection (clear remediation is
202
+ plan, an origin, and a verified Stripe connection (clear remediation is
186
203
  printed for `STRIPE_NOT_CONNECTED` / `STRIPE_NOT_VERIFIED` /
187
204
  `BILLING_TAX_NOT_ENROLLED`).
188
205
 
@@ -252,17 +269,17 @@ Read recent usage off the management API.
252
269
  farthershore usage summary weather-api --format json
253
270
  ```
254
271
 
255
- ### `farthershore metering-token`
272
+ ### `farthershore metering tokens`
256
273
 
257
274
  Provision runtime metering tokens for upstream services. Core stores only token
258
275
  hashes; the raw token is returned once and should be deployed as
259
276
  `FARTHERSHORE_METERING_TOKEN`.
260
277
 
261
278
  ```bash
262
- farthershore metering-token list weather-api --format json
263
- farthershore metering-token create weather-api --name "prod-api" --format json
264
- farthershore metering-token create weather-api --name "preview-api" --env preview --format json
265
- farthershore metering-token revoke weather-api <tokenId> --yes --format json
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
266
283
  ```
267
284
 
268
285
  Pair the token with `@farthershore/metering` in the upstream:
@@ -295,17 +312,6 @@ farthershore token create --name "ci-bot" --scope products:update products:publi
295
312
  farthershore token revoke <tokenId> --yes --format json
296
313
  ```
297
314
 
298
- ### `farthershore build --validate <product>`
299
-
300
- `build --validate` runs a local manifest compile + server-side validation
301
- pass after `product/product.config.ts` is built. This is the replacement for the
302
- deleted `validate`/`apply` proposal flow.
303
-
304
- ```bash
305
- farthershore build --validate weather-api --format json
306
- farthershore build --validate weather-api --env preview --format json
307
- ```
308
-
309
315
  #### Plan knobs
310
316
 
311
317
  Every plan is a configuration of 5 orthogonal knobs (shared-types
@@ -444,7 +450,8 @@ Validation surfaces:
444
450
  #### Deprecation window (Phase 3b)
445
451
 
446
452
  The product top-level `lifecycle.breaking_changes` block declares the
447
- breaking-change governance policy validated during `build --validate`:
453
+ breaking-change governance policy validated by the GitHub bot/Core release
454
+ path:
448
455
 
449
456
  ```yaml
450
457
  lifecycle:
@@ -453,15 +460,11 @@ lifecycle:
453
460
  require_successor_route: true
454
461
  ```
455
462
 
456
- When the policy is set:
457
-
458
- - `build --validate` emits an informational warning so the builder
459
- sees the active policy locally.
460
- - It emits a `route_removed` change for every route dropped from
461
- `features.<x>.routes[]` and warns when the server-side
462
- `breaking-change-safety-check` cron will gate publish via
463
- `ConsumerActivity` lookup. When `require_successor_route` is true,
464
- 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.
465
468
 
466
469
  The CLI never blocks on the window itself — the per-consumer lookup
467
470
  lives server-side (Phase 1c `ConsumerActivity` table + Phase 3b cron).
@@ -475,22 +478,22 @@ export FARTHERSHORE_TOKEN=mk_xxx
475
478
 
476
479
  farthershore product create \
477
480
  --name weather-api \
478
- --base-url https://api.example.com \
481
+ --origin https://api.example.com \
479
482
  --format json
480
483
 
481
484
  farthershore plan create weather-api --key free --name "Free" --free --format json
482
485
  farthershore plan create weather-api \
483
486
  --key pro --name "Pro" --recurring-fee-cents 2900 --format json
484
487
 
485
- farthershore build --validate weather-api --format json
488
+ farthershore build --format json
486
489
  farthershore product show weather-api --format json
487
490
  ```
488
491
 
489
492
  For product updates, edit `product/product.config.ts` or any modules it imports
490
- and validate with:
493
+ and build locally with:
491
494
 
492
495
  ```bash
493
- farthershore build --validate weather-api --format json
496
+ farthershore build --format json
494
497
  ```
495
498
 
496
499
  ## MCP server
@@ -524,5 +527,5 @@ for CI scripts.
524
527
  The CLI is non-interactive whenever a token is available via the
525
528
  `--token` flag or `FARTHERSHORE_TOKEN` env var — `auth login` only
526
529
  prompts when stdin is a TTY and no token argument was passed, so it's
527
- safe to script. `farthershore build --validate` is CI-safe and can be
528
- run under `CI` / `GITHUB_ACTIONS` for automation.
530
+ safe to script. `farthershore build` is CI-safe and can be run under `CI` /
531
+ `GITHUB_ACTIONS` for local Product SDK compilation.