@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 CHANGED
@@ -1,8 +1,10 @@
1
1
  # @farthershore/cli
2
2
 
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.
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-product repo from a named plan preset. Each preset
74
- fills in the 5-knob spec in a single decorated `product/product.config.ts` — one
75
- `@Product` class with `@Meter`/`@Feature`/`@Plan` members.
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
- `product/package.json`, `product/tsconfig.json`, and `.gitignore`, matching the
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 `@Product({ name, origin })` decorator in
102
- `product/product.config.ts`. `origin` is the business logic destination Farther
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 product. Pass repeatable
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 product. Omitting `--surface`
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 `product/` once, then run `farthershore build` from the repo
109
- root to confirm the scaffolded product compiles locally. Customize `frontend/`
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 product-as-code `product/product.config.ts` with the Product SDK
115
- manifest builder. The CLI first uses the builder installed under `product/`,
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
- `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.
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 product/product.config.ts --out manifest-ir.json
142
+ farthershore build --entry business/business.config.ts --out business-build.json
124
143
  farthershore build --format json
125
144
  ```
126
145
 
127
- ### `farthershore product`
146
+ ### `farthershore business`
128
147
 
129
- Product lifecycle commands. Creation requires a connected GitHub account because
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 product list --format json
135
- farthershore product show weather-api --format json
136
- farthershore product show weather-api --env preview --format json
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 product create \
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 product create \
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 product create --name image-api \
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 Product SDK surfaces (repeatable). Defaults to frontend + API.
160
- farthershore product create \
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 product update weather-api --display-name "Weather" --format json
170
- farthershore product publish weather-api --format json
171
- farthershore product delete weather-api --yes --format json
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
- `product create` provisions a managed GitHub repo and returns clone-URL +
175
- agent bootstrap instructions in the response. That repo is required for the
176
- starter `frontend/` project and normal customization workflow. Product SDK
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.
179
-
180
- Plan pricing lives on the plan (see `farthershore plan create` below) — the
181
- product itself no longer carries a `billingStrategy`. Omitting both meter flags
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/backend`.
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 product create \
192
- --name llm-api \
193
- --origin https://api.example.com \
194
- --meters ai-tokens # 1. create
195
- farthershore connect stripe llm-api # 2. connect billing
196
- farthershore plan create llm-api --key pro --name "Pro" \
197
- --recurring-fee-cents 2900 # 3. how you charge
198
- farthershore product publish llm-api # 4. go live
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
- `product publish` enforces the same gates as the dashboard: at least one
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
- Plan CRUD via the management API. The body uses the unified 5-knob
220
- shape (see "Plan knobs" below) — pass cents-denominated flags for
221
- whichever knobs the plan flavor needs.
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
- # Flat subscription: recurring fee only
232
- farthershore plan create weather-api \
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 shapes with
340
- `pricing.{model, monthlyPriceCents}`, top-level `billing.strategy`, or scalar
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
- For CLI plan create/update, pass one or more canonical grants with
422
- `--grant <kind:amount_cents>`.
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 product create \
513
+ farthershore business create \
502
514
  --name weather-api \
503
- --origin https://api.example.com \
504
515
  --format json
505
516
 
506
- farthershore plan create weather-api --key free --name "Free" --free --format json
507
- farthershore plan create weather-api \
508
- --key pro --name "Pro" --recurring-fee-cents 2900 --format json
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
- farthershore product show weather-api --format json
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 product updates, edit `product/product.config.ts` or any modules it imports
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-writable product surface:
537
+ `fs_*` prefix and cover the agent-operable platform surface:
526
538
 
527
- - Products: `fs_product_list`, `fs_brand_update`, `fs_product_publish`
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 Product SDK compilation.
574
+ `GITHUB_ACTIONS` for local Business SDK compilation.