@farthershore/cli 0.8.0 → 0.9.1

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 +55 -79
  2. package/dist/index.js +92 -242
  3. package/dist/mcp.js +43 -181
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -70,9 +70,9 @@ farthershore auth logout # Clear stored credentials
70
70
 
71
71
  ### `farthershore init`
72
72
 
73
- Scaffold a starter `product.yaml` from a named plan preset. Each preset
74
- fills in the 5-knob spec for a common shape so first-time builders skip
75
- the blank-page problem.
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.
76
76
 
77
77
  ```bash
78
78
  # Interactive walkthrough (TTY only) — pick a preset by number/name + path
@@ -94,12 +94,30 @@ Templates (sourced from shared-types `listPlanPresets()`):
94
94
  | `prepaid` | $50 one-time signup credit, then PAYG |
95
95
  | `metered` | Pure pay-as-you-go at $0.001/request |
96
96
 
97
- After `init`, edit `product.name` + `product.baseUrl`, then run
98
- `farthershore validate` to confirm the scaffolded YAML is acceptable.
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
+
102
+ ### `farthershore build`
103
+
104
+ Build a product-as-code `product/product.config.ts` with the repo-local
105
+ `./node_modules/.bin/farthershore-manifest-build` binary. The command
106
+ emits a Manifest IR envelope to `manifest-ir.json` by default.
107
+
108
+ ```bash
109
+ farthershore build
110
+ farthershore build --entry product/product.config.ts --out manifest-ir.json
111
+ farthershore build --format json
112
+
113
+ # Optional dry-run compile against core after the local build succeeds
114
+ farthershore build --validate weather-api --format json
115
+ farthershore build --validate weather-api --env preview --format json
116
+ ```
99
117
 
100
118
  ### `farthershore product`
101
119
 
102
- Product lifecycle commands — direct API, no local `product.yaml` round-trip.
120
+ Product lifecycle commands — direct API, no local manifest upload flow.
103
121
 
104
122
  ```bash
105
123
  farthershore product list --format json
@@ -137,16 +155,17 @@ longer carries a `billingStrategy`. Omitting both meter flags gives the
137
155
  product a `requests` meter; variable-value meters (tokens, credits, spend)
138
156
  are settled from upstream `x-fs-cost-{key}` response headers.
139
157
 
140
- A new product starts as a DRAFT with its portal already live in template
141
- mode. Going live mirrors the dashboard's "Finish setting up" checklist:
158
+ A new product starts as a DRAFT with a generated `frontend/` project ready for
159
+ customization. Going live mirrors the dashboard's "Finish setting up" checklist:
142
160
 
143
161
  ```bash
144
162
  farthershore product create --name llm-api --meters ai-tokens # 1. create
163
+ farthershore connect stripe llm-api # 2. connect billing
145
164
  farthershore plan create llm-api --key pro --name "Pro" \
146
- --recurring-fee-cents 2900 # 2. how you charge
165
+ --recurring-fee-cents 2900 # 3. how you charge
147
166
  farthershore product update llm-api \
148
- --base-url https://api.example.com # 3. endpoint
149
- farthershore product publish llm-api # 4. go live
167
+ --base-url https://api.example.com # 4. endpoint
168
+ farthershore product publish llm-api # 5. go live
150
169
  ```
151
170
 
152
171
  `product publish` enforces the same gates as the dashboard: at least one
@@ -168,8 +187,8 @@ farthershore env delete weather-api preview --yes --format json
168
187
  ### `farthershore plan`
169
188
 
170
189
  Plan CRUD via the management API. The body uses the unified 5-knob
171
- spec (see "`product.yaml` plan shape" below) — pass cents-denominated
172
- flags for whichever knobs the plan flavor needs.
190
+ shape (see "Plan knobs" below) — pass cents-denominated flags for
191
+ whichever knobs the plan flavor needs.
173
192
 
174
193
  ```bash
175
194
  # Human-readable table (default in TTY)
@@ -240,21 +259,18 @@ farthershore token create --name "ci-bot" --scope products:update products:publi
240
259
  farthershore token revoke <tokenId> --yes --format json
241
260
  ```
242
261
 
243
- ### `farthershore validate`
262
+ ### `farthershore build --validate <product>`
244
263
 
245
- Validate the managed repo (`product.yaml`, `brand.yaml`, `docs/`,
246
- `skills/`, `.github/workflows/`) through the same backend checks the
247
- Farther Shore GitHub bot runs.
264
+ `build --validate` runs a local manifest compile + server-side validation
265
+ pass after `product/product.config.ts` is built. This is the replacement for the
266
+ deleted `validate`/`apply` proposal flow.
248
267
 
249
268
  ```bash
250
- farthershore validate
251
- farthershore validate --format json
269
+ farthershore build --validate weather-api --format json
270
+ farthershore build --validate weather-api --env preview --format json
252
271
  ```
253
272
 
254
- Emits GitHub Actions-formatted annotations when run under `CI` /
255
- `GITHUB_ACTIONS`.
256
-
257
- #### `product.yaml` plan shape
273
+ #### Plan knobs
258
274
 
259
275
  Every plan is a configuration of 5 orthogonal knobs (shared-types
260
276
  v0.53.0). Older shapes with `pricing.{model, monthlyPriceCents}` and
@@ -382,7 +398,7 @@ plans:
382
398
  refill_cents: 5000
383
399
  ```
384
400
 
385
- The validator surfaces:
401
+ Validation surfaces:
386
402
 
387
403
  - **error** — invalid `kind` is rewritten to `Unknown grant kind. Valid kinds: …`
388
404
  - **warning** — `grants[]` declares `recurring`/`one_time` _and_ the matching legacy knob is also non-zero (legacy is silently ignored)
@@ -392,7 +408,7 @@ The validator surfaces:
392
408
  #### Deprecation window (Phase 3b)
393
409
 
394
410
  The product top-level `lifecycle.breaking_changes` block declares the
395
- breaking-change governance policy enforced on `apply`:
411
+ breaking-change governance policy validated during `build --validate`:
396
412
 
397
413
  ```yaml
398
414
  lifecycle:
@@ -403,52 +419,16 @@ lifecycle:
403
419
 
404
420
  When the policy is set:
405
421
 
406
- - `farthershore validate` emits an informational warning so the builder
422
+ - `build --validate` emits an informational warning so the builder
407
423
  sees the active policy locally.
408
- - `farthershore apply` (which compares the proposed spec against the
409
- accepted spec) emits a `route_removed` change for every route
410
- dropped from `features.<x>.routes[]` and warns that the server-side
411
- `breaking-change-safety-check` cron will gate the publish via
424
+ - It emits a `route_removed` change for every route dropped from
425
+ `features.<x>.routes[]` and warns when the server-side
426
+ `breaking-change-safety-check` cron will gate publish via
412
427
  `ConsumerActivity` lookup. When `require_successor_route` is true,
413
- the apply path additionally surfaces a successor-required warning.
428
+ it also adds a successor-required warning.
414
429
 
415
430
  The CLI never blocks on the window itself — the per-consumer lookup
416
431
  lives server-side (Phase 1c `ConsumerActivity` table + Phase 3b cron).
417
- The CLI's job is to surface the policy and the route delta locally so
418
- the builder knows what the gate will see.
419
-
420
- ### `farthershore apply [product]`
421
-
422
- Publish the shared server draft as one product release. Core accepts the
423
- release only after schema validation, transition-safety validation, and
424
- a compiler dry-run all pass.
425
-
426
- ```bash
427
- # Publish the current shared draft
428
- farthershore apply
429
-
430
- # Or pass the product slug/UUID explicitly
431
- farthershore apply weather-api
432
-
433
- # Validate and compile without publishing
434
- farthershore apply --dry-run --format json
435
- farthershore apply --env preview --dry-run --format json
436
-
437
- # Submit a local product.yaml as a one-off proposal
438
- farthershore apply --to product.yaml --dry-run --format json
439
- farthershore apply --to product.yaml --format json
440
-
441
- # Also stage that file as the shared draft before publishing
442
- farthershore apply --to product.yaml --save-draft --format json
443
-
444
- # Pin compilation to a specific branch
445
- farthershore apply weather-api --branch feature/billing-change --dry-run --format json
446
- ```
447
-
448
- JSON output is stable: `{ ok, success, errors, warnings, lifecyclePlan,
449
- nextActions, ... }`. `lifecyclePlan` is always present (or `null` on
450
- first deploys / older core builds) and surfaces ADR-0010 per-domain
451
- subscriber-migration actions.
452
432
 
453
433
  ## Agent workflow
454
434
 
@@ -466,27 +446,23 @@ farthershore plan create weather-api --key free --name "Free" --free --format js
466
446
  farthershore plan create weather-api \
467
447
  --key pro --name "Pro" --recurring-fee-cents 2900 --format json
468
448
 
469
- farthershore apply weather-api --dry-run --format json
470
- farthershore apply weather-api --format json
449
+ farthershore build --validate weather-api --format json
471
450
  farthershore product show weather-api --format json
472
451
  ```
473
452
 
474
- For a YAML-driven flow, edit `product.yaml` in the managed repo, then:
453
+ For product updates, edit `product/product.config.ts` or any modules it imports
454
+ and validate with:
475
455
 
476
456
  ```bash
477
- farthershore validate --format json
478
- farthershore apply --to product.yaml --dry-run --format json
479
- farthershore apply --to product.yaml --format json
457
+ farthershore build --validate weather-api --format json
480
458
  ```
481
459
 
482
460
  ## MCP server
483
461
 
484
- The MCP server (`farthershore-mcp`) exposes two tools:
462
+ The MCP server (`farthershore-mcp`) exposes one tool:
485
463
 
486
- - `farthershore_draft_validate` — run server-side validation on the shared
487
- draft.
488
- - `farthershore_apply` — apply the draft, optionally with a `product.yaml`
489
- proposal via `toFile`. Defaults to `dryRun: true`.
464
+ - `farthershore_status` — return product list context and selected product
465
+ metadata.
490
466
 
491
467
  Both accept optional `product` and `env` fields and return JSON.
492
468
 
@@ -512,5 +488,5 @@ for CI scripts.
512
488
  The CLI is non-interactive whenever a token is available via the
513
489
  `--token` flag or `FARTHERSHORE_TOKEN` env var — `auth login` only
514
490
  prompts when stdin is a TTY and no token argument was passed, so it's
515
- safe to script. `validate` and `apply` emit GitHub Actions-formatted
516
- annotations when run under `CI` / `GITHUB_ACTIONS`.
491
+ safe to script. `farthershore build --validate` is CI-safe and can be
492
+ run under `CI` / `GITHUB_ACTIONS` for automation.