@farthershore/cli 0.14.1 → 0.14.3

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