@mesh-tech/mesh-cli 0.25.0 → 0.26.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.
Files changed (53) hide show
  1. package/README.md +74 -246
  2. package/dist/bin/mesh.js +1415 -842
  3. package/dist/bin/mesh.js.map +3 -3
  4. package/dist/build-info.json +2 -2
  5. package/dist/src/commands/db/axes.d.ts +19 -0
  6. package/dist/src/commands/db/axes.js +35 -0
  7. package/dist/src/commands/db/connect.d.ts +2 -4
  8. package/dist/src/commands/db/connect.js +4 -19
  9. package/dist/src/commands/db/credentials.d.ts +2 -5
  10. package/dist/src/commands/db/credentials.js +7 -23
  11. package/dist/src/commands/db/env.d.ts +2 -5
  12. package/dist/src/commands/db/env.js +7 -23
  13. package/dist/src/commands/db/exec.js +7 -24
  14. package/dist/src/commands/db/psql.d.ts +2 -5
  15. package/dist/src/commands/db/psql.js +8 -23
  16. package/dist/src/commands/init/platform-setup.d.ts +68 -0
  17. package/dist/src/commands/init/platform-setup.js +203 -0
  18. package/dist/src/commands/init/wizard.d.ts +20 -0
  19. package/dist/src/commands/init/wizard.js +89 -7
  20. package/dist/src/commands/init.js +42 -36
  21. package/dist/src/commands/login.d.ts +4 -0
  22. package/dist/src/commands/login.js +16 -2
  23. package/dist/src/commands/registry.d.ts +2 -2
  24. package/dist/src/commands/registry.js +11 -6
  25. package/dist/src/commands/secrets/context.d.ts +5 -0
  26. package/dist/src/commands/secrets/context.js +5 -0
  27. package/dist/src/commands/secrets/index.js +3 -0
  28. package/dist/src/commands/secrets/migrate-config.d.ts +1 -0
  29. package/dist/src/commands/secrets/migrate-config.js +2 -3
  30. package/dist/src/commands/secrets/reindex.d.ts +1 -0
  31. package/dist/src/commands/secrets/reindex.js +2 -2
  32. package/dist/src/commands/secrets/set.d.ts +1 -0
  33. package/dist/src/commands/secrets/set.js +2 -2
  34. package/dist/src/commands/temporal.js +25 -8
  35. package/dist/src/commands/temporal.js.map +2 -2
  36. package/dist/src/commands/tunnel/index.d.ts +8 -0
  37. package/dist/src/commands/tunnel/index.js +3 -3
  38. package/dist/src/index.js +324 -62
  39. package/dist/src/index.js.map +3 -3
  40. package/dist/src/utils/context.d.ts +6 -1
  41. package/dist/src/utils/context.js +302 -39
  42. package/dist/src/utils/registry-identity.d.ts +5 -0
  43. package/dist/src/utils/registry-identity.js +16 -0
  44. package/fragments/agents/AGENTS.md.hbs +10 -2
  45. package/fragments/base/index.ts.hbs +15 -5
  46. package/package.json +2 -2
  47. package/skills/core/SKILL.md +73 -6
  48. package/templates/api-auth/index.ts.hbs +5 -4
  49. package/templates/api-role-gating/index.ts.hbs +5 -4
  50. package/templates/external-service/index.ts.hbs +5 -4
  51. package/templates/platform-repo/README.md.hbs +17 -3
  52. package/templates/platform-repo/core/Pulumi.{{tenant}}-{{env}}.yaml.hbs +7 -0
  53. package/templates/workflow/index.ts.hbs +5 -4
package/README.md CHANGED
@@ -3,295 +3,123 @@
3
3
  `mesh` is the command-line entry point to the **Mesh platform** — Trabian's
4
4
  platform for building and running financial-services applications.
5
5
 
6
- It is the one `@mesh-tech/*` package published to public npm, so a clean laptop
7
- can install it with **no registry auth at all**, and the CLI then bootstraps
8
- everything else: your package-registry access, a new app, a full local stack,
9
- the documentation — and, only when you deploy somewhere, your platform login.
10
-
11
- This page is the getting-started path. Every command below also answers
12
- `--help`, and the complete reference ships inside the docs you start in
13
- [step 5](#5-read-the-full-docs).
14
-
15
- ---
16
-
17
- ## Requirements
18
-
19
- | Need | Why |
20
- |---|---|
21
- | Node 22+ and `pnpm` (`corepack enable`) | Everything below |
22
- | Docker Desktop (or equivalent) | Only for `mesh start` / `mesh dev` |
23
- | A Mesh account | Issued by your Mesh contact; used by `mesh registry login` |
24
- | `registry` access on that account | The grant that unlocks `@mesh-tech/*` packages and the docs |
25
-
26
- **You do not need an AWS account** to install packages, run an app locally, or
27
- read the docs. AWS credentials only come into play if you *deploy*
28
- (`mesh deploy`, `mesh stack`).
29
-
30
- **You do not need a platform context either.** Package-registry access is one
31
- global identity, separate from any deployed platform. `mesh login <tenant>.<env>`
32
- is only for people who deploy to (or operate) a platform — see
33
- [Deploying to a platform](#deploying-to-a-platform).
34
-
35
- ---
36
-
37
- ## 1. Install
6
+ It is the one `@mesh-tech/*` package on public npm, so a clean laptop installs it
7
+ with no registry auth at all, and the CLI bootstraps everything else: your
8
+ package access, a new app, a full local stack, a whole platform in your own AWS
9
+ account, and the docs.
38
10
 
39
11
  ```bash
40
12
  npm i -g @mesh-tech/mesh-cli
41
- mesh --version
42
- ```
43
-
44
- `mesh --version` must print **0.12.0 or newer**. If it prints `0.1.x`, or the
45
- install fails with `E401`, see [Troubleshooting](#troubleshooting) — both are
46
- known, one-command fixes.
47
-
48
- ## 2. Get registry access
49
-
50
- ```bash
51
- mesh registry login
52
- mesh registry status
13
+ mesh registry login # package access — one browser trip
14
+ mesh init # everything else: it asks where your tenant runs
53
15
  ```
54
16
 
55
- One command, one browser round-trip. `mesh registry login` knows which registry
56
- it is talking to; it signs you in with your Mesh identity (a browser opens —
57
- add `--device` on a headless box or over SSH), asks the platform's
58
- registry-auth broker for a package-read token, and writes the `@mesh-tech`
59
- scope + token into your `~/.npmrc`. No AWS credential is created on your
60
- machine, and the token is short-lived by design (12 hours) — re-run
61
- `mesh registry login` when it expires (your sign-in is kept; no second browser
62
- trip).
17
+ `mesh init` starts from nothing. "Nowhere yet — set up a new Mesh platform in my
18
+ AWS account" is one of the answers it offers, and it asks for the handful of
19
+ values that differ per install (region, public domain, Pulumi state bucket, AWS
20
+ profile) with a default on each, so Enter is a valid answer.
63
21
 
64
- **If your account does not hold the grant yet**, the command tells you so and
65
- prints the access-request URL the platform returned (or names the admin to
66
- ask). Contact your Mesh contact to have **registry access granted to your
67
- user**, then run `mesh registry login` again — it re-mints your sign-in so the
68
- new role is in the token the broker sees. If it still says not authorized,
69
- start a fresh sign-in: `mesh registry logout && mesh registry login`.
70
-
71
- Everything after this point — installing `@mesh-tech/*` packages, scaffolding
72
- an app, and the local docs server — depends on this step. `mesh init` (next)
73
- runs it for you.
74
-
75
- ## 3. Set up your tenant
76
-
77
- ```bash
78
- mesh init
79
- ```
80
-
81
- Run it in your `<tenant>-mesh-apps` clone, or in a brand-new empty folder — the
82
- wizard runs `git init` there for you. It asks which tenant this repo belongs to
83
- and where it runs — *local only* (`mesh start` / `mesh dev`) or *a deployed Mesh
84
- platform* — then checks your registry access (signing you in if step 2 was
85
- skipped), bootstraps the repo layout, installs the agent skills, and prints a
86
- summary with the next command.
87
- Every answer has a flag, so a headless run is one line:
88
-
89
- ```bash
90
- mesh init --tenant acme --local --yes # no prompts; --json for a machine-readable summary
91
- ```
92
-
93
- ## 4. Create an app
94
-
95
- ```bash
96
- mesh create-app --tenant acme --name billing --primitives service,database,temporal
97
- ```
98
-
99
- Scaffolds a new tenant application. `--primitives` selects what the app gets
100
- (`service`, `database`, `temporal`, `bucket`; default `service`). Run
101
- `mesh create-app --help` for the full option list, or omit the flags to be
102
- prompted. After `mesh init`, `--tenant` defaults to the tenant it recorded.
103
-
104
- `create-app` checks your registry access **before** it writes anything: with
105
- no usable token it stops and points at `mesh init` (add
106
- `--skip-registry-check` to scaffold offline anyway).
107
-
108
- ### Run it locally
109
-
110
- Two commands, in this order:
111
-
112
- ```bash
113
- mesh start # the full-local Mesh platform — Docker only, no AWS, no VPN
114
- mesh dev # from inside your app repo: run the app against it
115
- ```
116
-
117
- - `mesh status` — component health, endpoints, and ports.
118
- - `mesh stop` — stop the local platform (`--destroy` also drops volumes).
119
- - `mesh dev doctor` — diagnoses a dev session (credentials, tunnels, config,
120
- ports, Temporal) and names the fix.
121
- - `mesh dev logs <service>` / `mesh dev restart <service>` — per-service control.
122
- - `mesh dev --externals` — also realize the app's declared external services,
123
- mocked from their OpenAPI spec, run locally, or pointed at the real vendor.
124
-
125
- `mesh start` brings up the platform's own services in Docker (the Hub included,
126
- when its images are available — `--no-hub` skips it); `mesh dev` runs *your*
127
- app's processes against them.
128
-
129
- Where things are once it is up (printed at the end of `mesh start` and first
130
- by `mesh status`):
131
-
132
- - **Hub** — <http://localhost:9000>. Sign in as `dev@local.mesh` / `LocalDev1!`.
133
- The account is seeded; there is no need to register one.
134
- - **Mailbox** — <http://localhost:8025>. Every email the local platform sends
135
- (sign-up confirmation, password reset) lands here; nothing leaves your machine.
136
- - `mesh login local` logs the CLI in against the same local identity.
137
-
138
- If `mesh start` stops on `already in use`, it names the container or process
139
- holding the port; stop that (or move it) and run `mesh start` again.
22
+ ---
140
23
 
141
- ## 5. Read the full docs
24
+ ## Let your agent drive it
142
25
 
143
- The Mesh documentation is served **locally, by the CLI** — same access grant as
144
- the packages, no public site to keep in sync:
26
+ The CLI is built to be driven by a coding agent. One command installs the agent
27
+ skills — the full command reference, the conventions, and the runbooks — into
28
+ your repo:
145
29
 
146
30
  ```bash
147
- mesh docs start # → http://localhost:4400
148
- mesh docs stop
31
+ mesh skills sync
149
32
  ```
150
33
 
151
- `mesh docs start` runs detached (in a tmux session named `mesh-docs`) and prints
152
- the URL once the server answers. Outside a `mesh-platform` checkout it fetches
153
- the published docs artifact from the role-gated registry, so it needs
154
- [step 2](#2-get-registry-access) to have succeeded. Useful flags:
34
+ After that you do not have to learn the CLI: tell your agent *"set up a Mesh
35
+ platform for tenant `acme` in my AWS account and get a hello-world app running"*
36
+ and it has everything it needs. Every command below is also fully flagged
37
+ (`--yes`, `--json`), so nothing an agent runs depends on a prompt.
155
38
 
156
- | Flag | Effect |
157
- |---|---|
158
- | `-p, --port <port>` | serve on another port (`0` picks a free one) |
159
- | `-v, --version <version>` | pin a docs version (default: latest) |
160
- | `--foreground` | serve in the foreground (automatic for agents/CI) |
161
-
162
- `mesh docs list` shows the published versions. The full `mesh` CLI reference —
163
- every command, every flag, generated from the binary itself — is a page inside
164
- that site.
39
+ Prefer to drive it yourself? Everything works by hand — read on.
165
40
 
166
41
  ---
167
42
 
168
- ## Deploying to a platform
43
+ ## Requirements
169
44
 
170
- Most app developers never need this section — the platform is already running
171
- for you, and everything above works without it.
45
+ | Need | Why |
46
+ |---|---|
47
+ | Node 22+ and `pnpm` (`corepack enable`) | Everything below |
48
+ | Docker Desktop (or equivalent) | Only for `mesh start` / `mesh dev` |
49
+ | A Mesh account with `registry` access | Issued by your Mesh contact; used by `mesh registry login` |
50
+ | An AWS account + `aws` CLI | Only if you **deploy** (`mesh deploy`, or setting up a platform) |
172
51
 
173
- If your tenant has a **deployed** Mesh platform (a `<tenant>.<env>` context
174
- such as `acme.dev`), sign in to it:
52
+ ## Two sign-ins, and which one you need
175
53
 
176
- ```bash
177
- mesh login acme.dev # browser; --device over SSH
178
- mesh login acme.dev --status # who you are there
179
- mesh logout acme.dev
180
- ```
54
+ Two commands say "log in". They are not alternatives — they unlock different
55
+ things, and most people only ever need the first:
181
56
 
182
- That session is what `mesh deploy`, `mesh stack`, the Hub, and the VPN use. It
183
- has nothing to do with package access — a platform login never touches your
184
- `~/.npmrc` — which is why `mesh init` asks *where the tenant runs* and only
185
- signs you in to a platform on the "deployed" branch.
57
+ | | What it unlocks | Needs |
58
+ |---|---|---|
59
+ | **`mesh registry login`** | **Packages.** Installing `@mesh-tech/*`, scaffolding an app, the docs. | A Mesh account. **No AWS, no platform, no context.** |
60
+ | **`mesh login <tenant>.<env>`** | **A deployed platform.** `mesh deploy`, `mesh stack`, the Hub, the VPN. | A platform that exists, and access to it. |
186
61
 
187
- Deploying also needs AWS credentials that can reach the tenant's account. If
188
- your deployer account can read the registry as well, `mesh registry login
189
- --profile <aws-profile>` refreshes the package token through that profile
190
- instead of the broker — that flag is for deployers only.
62
+ `mesh registry login` writes a short-lived (12h) token into your `~/.npmrc`;
63
+ re-run it when it expires. `mesh login` never touches `~/.npmrc`. If your account
64
+ does not hold the registry grant yet, the command says so and prints the
65
+ access-request URL (or names the admin to ask).
191
66
 
192
- ### Setting up a platform of your own
67
+ ## Build and run an app
193
68
 
194
69
  ```bash
195
- mesh init platform acme --domain example.com
70
+ mesh init # tenant, where it runs, registry access, repo, skills
71
+ mesh create-app --name billing --primitives service,database,temporal
72
+ mesh start # the full-local Mesh platform — Docker only, no AWS, no VPN
73
+ mesh dev # from the app repo: run your app against it
196
74
  ```
197
75
 
198
- scaffolds a tenant **platform** repo (the core + platform Pulumi layers on
199
- `@mesh-tech/infra-components`) that deploys with `mesh deploy` unmodified.
200
-
201
- For an existing app repo, `mesh init app-tenant` is the **doctor**, not a
202
- scaffolder: it checks auth, registry access, tenant registration, repo shape,
203
- and agent skills, and repairs what it can with `--fix`. Re-run it any time
204
- something looks wrong.
205
-
206
- ---
76
+ `mesh start` brings up the platform's own services (Postgres, Temporal, Zitadel,
77
+ the local AWS fabric, and the **Hub** at <http://localhost:9000> — sign in as
78
+ `dev@local.mesh` / `LocalDev1!`). Mail the local platform sends lands in the
79
+ mailbox at <http://localhost:8025>. `mesh status` reprints all of it;
80
+ `mesh stop` shuts it down; `mesh dev doctor` diagnoses a broken session.
207
81
 
208
- ## Troubleshooting
82
+ ## Set up a platform of your own
209
83
 
210
- ### `npm i -g @mesh-tech/mesh-cli` fails with `E401`
211
-
212
- This machine already points the `@mesh-tech` scope at the private registry with
213
- an **expired** token, and npm maps registries per *scope*, never per package —
214
- so it tried the private registry for a package that is published publicly.
215
- Override the scope for this one command:
84
+ If nothing is deployed yet, `mesh init` offers to scaffold you one; the same
85
+ scaffold on its own is:
216
86
 
217
87
  ```bash
218
- npm i -g @mesh-tech/mesh-cli --@mesh-tech:registry=https://registry.npmjs.org
88
+ mesh init platform acme --domain a-domain-you-control.com
219
89
  ```
220
90
 
221
- `--registry=…` alone does **not** work: a scope mapping outranks it. Refreshing
222
- the token (`mesh registry login`) fixes it too.
223
-
224
- The release publishes the same version of `@mesh-tech/mesh-cli` to both
225
- registries in the same job, so the two copies are the same artifact — there is
226
- no fork to reconcile. Every *other* `@mesh-tech/*` package is private-registry
227
- only, so keep the scope mapping for `pnpm install` in an app repo; only the CLI
228
- bootstrap needs the override.
229
-
230
- ### The install works, but `mesh --version` prints `0.1.x`
91
+ It writes a tenant **platform** repo (the core + platform Pulumi layers on
92
+ `@mesh-tech/infra-components`) that deploys with `mesh deploy` unmodified, asks
93
+ for the per-install values, offers to create the Pulumi state bucket, and prints
94
+ the deploy sequence — including the one manual step in the middle: **delegating
95
+ the NS records** of the new public zone, without which the deploy stalls on its
96
+ ACM certificate.
231
97
 
232
- You got an abandoned public package from February 2026 that predates the current
233
- CLI — nothing after it will work. Reinstall:
98
+ The platform layer builds service images with Docker, so it needs a working
99
+ Docker daemon; the core layer does not.
234
100
 
235
- ```bash
236
- npm rm -g @mesh-tech/mesh-cli
237
- npm i -g @mesh-tech/mesh-cli
238
- ```
101
+ For an existing app repo, `mesh init app-tenant` is the **doctor**, not a
102
+ scaffolder: it checks auth, registry access, tenant registration, repo shape and
103
+ agent skills, and repairs what it can with `--fix`.
239
104
 
240
- ### `mesh: not inside a Mesh workspace (no node_modules/.bin/mesh found)`
105
+ ## Read the docs
241
106
 
242
- An old launcher shim at `~/.local/bin/mesh` is shadowing the global CLI on your
243
- `PATH`. The package is installed and fine — just unreachable.
107
+ The Mesh documentation is served **locally, by the CLI** — same access grant as
108
+ the packages:
244
109
 
245
110
  ```bash
246
- which -a mesh # the shim is listed above the npm global bin
247
- rm ~/.local/bin/mesh # if you don't develop the platform itself
111
+ mesh docs start # → http://localhost:4400 (mesh docs stop to end it)
248
112
  ```
249
113
 
250
- If you *do* work in a `mesh-platform` checkout, run
251
- `pnpm exec mesh install-shim --force` there instead — the current shim runs the
252
- checkout's source inside a checkout and falls through to the global CLI
253
- everywhere else.
254
-
255
- ### `Your Mesh account (…) is not authorized to read @mesh-tech packages.`
256
-
257
- Your account and session are fine; you don't hold the registry grant yet. The
258
- message names the request URL (or the admin to ask) — see
259
- [step 2](#2-get-registry-access). Once granted, `mesh registry login` again —
260
- it re-mints your sign-in so the new role reaches the broker (a role only rides
261
- in tokens issued after it was granted). Still refused?
262
- `mesh registry logout && mesh registry login` starts a fresh sign-in.
263
-
264
- ### `No registry access on this machine — @mesh-tech packages cannot be installed.`
265
-
266
- `mesh create-app` checked before scaffolding and found no usable token. Run
267
- `mesh init` (or just `mesh registry login`), then re-run `create-app`.
268
-
269
- ### `AWS profile '…' cannot read the Mesh registry`
270
-
271
- You passed `--profile` to `mesh registry login`. That flag skips the broker and
272
- uses the profile's AWS identity, which is only right for deployers whose AWS
273
- account is allowed to read the registry. To install packages you do not need
274
- AWS at all — drop the flag: `mesh registry login`.
275
-
276
- ### `Registry broker unavailable (…)`
277
-
278
- The broker could not be reached, and the CLI fell back to the AWS credential
279
- chain, which this machine does not have. Retry in a minute:
280
- `mesh registry login`. If you deploy and have an AWS account:
281
- `mesh registry login --profile <aws-profile>`.
282
-
283
- ### `Could not resolve the Mesh package registry`
284
-
285
- You are offline, or the platform's discovery document is unreachable. Retry
286
- once you are online: `mesh registry login`.
114
+ The full `mesh` reference — every command, every flag, generated from the binary
115
+ — is a page inside that site. `mesh --help` and `--help` on any subcommand
116
+ answer the same questions at the terminal.
287
117
 
288
118
  ---
289
119
 
290
- ## Getting help
291
-
292
- - `mesh --help`, and `--help` on any subcommand.
293
- - `mesh docs start` — the full documentation, locally.
294
- - Anything else: your Mesh contact.
120
+ - **Something not working?** [Troubleshooting](./docs/troubleshooting.md) — the
121
+ failures people actually hit, each with its one-command fix.
122
+ - **Anything else:** your Mesh contact.
295
123
 
296
124
  ## License
297
125