@mesh-tech/mesh-cli 0.18.2 → 0.19.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 (55) hide show
  1. package/README.md +111 -56
  2. package/dist/bin/mesh.js +4843 -4077
  3. package/dist/bin/mesh.js.map +4 -4
  4. package/dist/build-info.json +2 -2
  5. package/dist/src/commands/create-app.d.ts +28 -0
  6. package/dist/src/commands/create-app.d.ts.map +1 -1
  7. package/dist/src/commands/create-app.js +45 -1
  8. package/dist/src/commands/create-app.js.map +1 -1
  9. package/dist/src/commands/dev-doctor.js +2 -2
  10. package/dist/src/commands/dev-doctor.js.map +1 -1
  11. package/dist/src/commands/init/wizard.d.ts +216 -0
  12. package/dist/src/commands/init/wizard.d.ts.map +1 -0
  13. package/dist/src/commands/init/wizard.js +471 -0
  14. package/dist/src/commands/init/wizard.js.map +1 -0
  15. package/dist/src/commands/init.d.ts +14 -6
  16. package/dist/src/commands/init.d.ts.map +1 -1
  17. package/dist/src/commands/init.js +41 -15
  18. package/dist/src/commands/init.js.map +1 -1
  19. package/dist/src/commands/local/dev-local.d.ts.map +1 -1
  20. package/dist/src/commands/local/dev-local.js +6 -0
  21. package/dist/src/commands/local/dev-local.js.map +1 -1
  22. package/dist/src/commands/login.d.ts +76 -5
  23. package/dist/src/commands/login.d.ts.map +1 -1
  24. package/dist/src/commands/login.js +161 -60
  25. package/dist/src/commands/login.js.map +1 -1
  26. package/dist/src/commands/registry.d.ts +133 -10
  27. package/dist/src/commands/registry.d.ts.map +1 -1
  28. package/dist/src/commands/registry.js +238 -86
  29. package/dist/src/commands/registry.js.map +1 -1
  30. package/dist/src/commands/temporal.js +37 -23
  31. package/dist/src/commands/temporal.js.map +3 -3
  32. package/dist/src/docs/registry-docs.d.ts.map +1 -1
  33. package/dist/src/docs/registry-docs.js +8 -3
  34. package/dist/src/docs/registry-docs.js.map +1 -1
  35. package/dist/src/program.d.ts.map +1 -1
  36. package/dist/src/program.js +5 -1
  37. package/dist/src/program.js.map +1 -1
  38. package/dist/src/utils/auth-preflight.d.ts +51 -20
  39. package/dist/src/utils/auth-preflight.d.ts.map +1 -1
  40. package/dist/src/utils/auth-preflight.js +48 -21
  41. package/dist/src/utils/auth-preflight.js.map +1 -1
  42. package/dist/src/utils/mesh-json.d.ts +58 -0
  43. package/dist/src/utils/mesh-json.d.ts.map +1 -0
  44. package/dist/src/utils/mesh-json.js +85 -0
  45. package/dist/src/utils/mesh-json.js.map +1 -0
  46. package/dist/src/utils/registry-broker.d.ts +12 -29
  47. package/dist/src/utils/registry-broker.d.ts.map +1 -1
  48. package/dist/src/utils/registry-broker.js +12 -29
  49. package/dist/src/utils/registry-broker.js.map +1 -1
  50. package/dist/src/utils/registry-identity.d.ts +170 -0
  51. package/dist/src/utils/registry-identity.d.ts.map +1 -0
  52. package/dist/src/utils/registry-identity.js +273 -0
  53. package/dist/src/utils/registry-identity.js.map +1 -0
  54. package/package.json +3 -2
  55. package/skills/core/SKILL.md +6 -5
package/README.md CHANGED
@@ -5,12 +5,12 @@ platform for building and running financial-services applications.
5
5
 
6
6
  It is the one `@mesh-tech/*` package published to public npm, so a clean laptop
7
7
  can install it with **no registry auth at all**, and the CLI then bootstraps
8
- everything else: your platform login, your package-registry access, a new app,
9
- a full local stack, and the documentation.
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
10
 
11
11
  This page is the getting-started path. Every command below also answers
12
12
  `--help`, and the complete reference ships inside the docs you start in
13
- [step 6](#6-read-the-full-docs).
13
+ [step 5](#5-read-the-full-docs).
14
14
 
15
15
  ---
16
16
 
@@ -20,13 +20,18 @@ This page is the getting-started path. Every command below also answers
20
20
  |---|---|
21
21
  | Node 22+ and `pnpm` (`corepack enable`) | Everything below |
22
22
  | Docker Desktop (or equivalent) | Only for `mesh start` / `mesh dev` |
23
- | A Mesh account | Issued by your Mesh contact; used by `mesh login` |
23
+ | A Mesh account | Issued by your Mesh contact; used by `mesh registry login` |
24
24
  | `registry` access on that account | The grant that unlocks `@mesh-tech/*` packages and the docs |
25
25
 
26
26
  **You do not need an AWS account** to install packages, run an app locally, or
27
27
  read the docs. AWS credentials only come into play if you *deploy*
28
28
  (`mesh deploy`, `mesh stack`).
29
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
+
30
35
  ---
31
36
 
32
37
  ## 1. Install
@@ -40,40 +45,47 @@ mesh --version
40
45
  install fails with `E401`, see [Troubleshooting](#troubleshooting) — both are
41
46
  known, one-command fixes.
42
47
 
43
- ## 2. Sign in
48
+ ## 2. Get registry access
44
49
 
45
50
  ```bash
46
- mesh login mesh.dev
51
+ mesh registry login
52
+ mesh registry status
47
53
  ```
48
54
 
49
- A browser opens; sign in with your Mesh identity. The session is cached under
50
- `~/.config/mesh/`. `mesh login --status` shows who you are; `mesh logout <context>`
51
- clears it.
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).
63
+
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.
52
68
 
53
- `mesh login` finishes by refreshing your registry auth automatically, so in the
54
- happy path step 3 is already done.
69
+ Everything after this point installing `@mesh-tech/*` packages, scaffolding
70
+ an app, and the local docs server — depends on this step. `mesh init` (next)
71
+ runs it for you.
55
72
 
56
- ## 3. Get registry access
73
+ ## 3. Set up your tenant
57
74
 
58
75
  ```bash
59
- mesh registry login mesh.dev
60
- mesh registry status
76
+ mesh init
61
77
  ```
62
78
 
63
- `mesh registry login` asks the platform's registry-auth broker for a
64
- package-read token using the session from step 2, and writes the `@mesh-tech`
65
- scope + token into your `~/.npmrc`. No AWS credential is created on your
66
- machine, and the token is short-lived by design (12 hours) re-run
67
- `mesh login mesh.dev` when it expires.
68
-
69
- **If your account does not hold the grant yet**, the command tells you so and
70
- **sends the access request** — it prints the request URL the platform returned.
71
- Contact your Mesh contact to have **registry access granted to your user**, then
72
- run `mesh registry login mesh.dev` again (a token minted before the grant does
73
- not carry it, so a fresh login is required).
79
+ Run it in your `<tenant>-mesh-apps` clone (an empty one is fine). The wizard
80
+ asks which tenant this repo belongs to and where it runs — *local only*
81
+ (`mesh start` / `mesh dev`) or *a deployed Mesh platform* then checks your
82
+ registry access (signing you in if step 2 was skipped), bootstraps the repo
83
+ layout, installs the agent skills, and prints a summary with the next command.
84
+ Every answer has a flag, so a headless run is one line:
74
85
 
75
- Everything after this point — installing `@mesh-tech/*` packages, and the local
76
- docs server depends on this step.
86
+ ```bash
87
+ mesh init --tenant acme --local --yes # no prompts; --json for a machine-readable summary
88
+ ```
77
89
 
78
90
  ## 4. Create an app
79
91
 
@@ -84,9 +96,13 @@ mesh create-app --tenant acme --name billing --primitives service,database,tempo
84
96
  Scaffolds a new tenant application. `--primitives` selects what the app gets
85
97
  (`service`, `database`, `temporal`, `bucket`; default `service`). Run
86
98
  `mesh create-app --help` for the full option list, or omit the flags to be
87
- prompted.
99
+ prompted. After `mesh init`, `--tenant` defaults to the tenant it recorded.
100
+
101
+ `create-app` checks your registry access **before** it writes anything: with
102
+ no usable token it stops and points at `mesh init` (add
103
+ `--skip-registry-check` to scaffold offline anyway).
88
104
 
89
- ## 5. Run it locally
105
+ ### Run it locally
90
106
 
91
107
  Two commands, in this order:
92
108
 
@@ -107,24 +123,7 @@ mesh dev # from inside your app repo: run the app against it
107
123
  when its images are available — `--no-hub` skips it); `mesh dev` runs *your*
108
124
  app's processes against them.
109
125
 
110
- ### Setting up a platform of your own
111
-
112
- Most app developers never need this — the platform is already running for you.
113
- If you are standing one up:
114
-
115
- ```bash
116
- mesh init platform acme --domain example.com
117
- ```
118
-
119
- scaffolds a tenant **platform** repo (the core + platform Pulumi layers on
120
- `@mesh-tech/infra-components`) that deploys with `mesh deploy` unmodified.
121
-
122
- For an existing app repo, `mesh init app-tenant` is the **doctor**, not a
123
- scaffolder: it checks auth, registry access, tenant registration, repo shape,
124
- and agent skills, and repairs what it can with `--fix`. Re-run it any time
125
- something looks wrong.
126
-
127
- ## 6. Read the full docs
126
+ ## 5. Read the full docs
128
127
 
129
128
  The Mesh documentation is served **locally, by the CLI** — same access grant as
130
129
  the packages, no public site to keep in sync:
@@ -137,7 +136,7 @@ mesh docs stop
137
136
  `mesh docs start` runs detached (in a tmux session named `mesh-docs`) and prints
138
137
  the URL once the server answers. Outside a `mesh-platform` checkout it fetches
139
138
  the published docs artifact from the role-gated registry, so it needs
140
- [step 3](#3-get-registry-access) to have succeeded. Useful flags:
139
+ [step 2](#2-get-registry-access) to have succeeded. Useful flags:
141
140
 
142
141
  | Flag | Effect |
143
142
  |---|---|
@@ -151,6 +150,46 @@ that site.
151
150
 
152
151
  ---
153
152
 
153
+ ## Deploying to a platform
154
+
155
+ Most app developers never need this section — the platform is already running
156
+ for you, and everything above works without it.
157
+
158
+ If your tenant has a **deployed** Mesh platform (a `<tenant>.<env>` context
159
+ such as `acme.dev`), sign in to it:
160
+
161
+ ```bash
162
+ mesh login acme.dev # browser; --device over SSH
163
+ mesh login acme.dev --status # who you are there
164
+ mesh logout acme.dev
165
+ ```
166
+
167
+ That session is what `mesh deploy`, `mesh stack`, the Hub, and the VPN use. It
168
+ has nothing to do with package access — a platform login never touches your
169
+ `~/.npmrc` — which is why `mesh init` asks *where the tenant runs* and only
170
+ signs you in to a platform on the "deployed" branch.
171
+
172
+ Deploying also needs AWS credentials that can reach the tenant's account. If
173
+ your deployer account can read the registry as well, `mesh registry login
174
+ --profile <aws-profile>` refreshes the package token through that profile
175
+ instead of the broker — that flag is for deployers only.
176
+
177
+ ### Setting up a platform of your own
178
+
179
+ ```bash
180
+ mesh init platform acme --domain example.com
181
+ ```
182
+
183
+ scaffolds a tenant **platform** repo (the core + platform Pulumi layers on
184
+ `@mesh-tech/infra-components`) that deploys with `mesh deploy` unmodified.
185
+
186
+ For an existing app repo, `mesh init app-tenant` is the **doctor**, not a
187
+ scaffolder: it checks auth, registry access, tenant registration, repo shape,
188
+ and agent skills, and repairs what it can with `--fix`. Re-run it any time
189
+ something looks wrong.
190
+
191
+ ---
192
+
154
193
  ## Troubleshooting
155
194
 
156
195
  ### `npm i -g @mesh-tech/mesh-cli` fails with `E401`
@@ -165,7 +204,7 @@ npm i -g @mesh-tech/mesh-cli --@mesh-tech:registry=https://registry.npmjs.org
165
204
  ```
166
205
 
167
206
  `--registry=…` alone does **not** work: a scope mapping outranks it. Refreshing
168
- the token (`mesh registry login mesh.dev`) fixes it too.
207
+ the token (`mesh registry login`) fixes it too.
169
208
 
170
209
  The release publishes the same version of `@mesh-tech/mesh-cli` to both
171
210
  registries in the same job, so the two copies are the same artifact — there is
@@ -201,17 +240,33 @@ everywhere else.
201
240
  ### `Your Mesh account (…) is not authorized to read @mesh-tech packages.`
202
241
 
203
242
  Your account and session are fine; you don't hold the registry grant yet. The
204
- message names the request URL see [step 3](#3-get-registry-access).
243
+ message names the request URL (or the admin to ask) — see
244
+ [step 2](#2-get-registry-access). Once granted, `mesh registry login` again;
245
+ your sign-in is kept.
246
+
247
+ ### `No registry access on this machine — @mesh-tech packages cannot be installed.`
248
+
249
+ `mesh create-app` checked before scaffolding and found no usable token. Run
250
+ `mesh init` (or just `mesh registry login`), then re-run `create-app`.
251
+
252
+ ### `AWS profile '…' cannot read the Mesh registry`
253
+
254
+ You passed `--profile` to `mesh registry login`. That flag skips the broker and
255
+ uses the profile's AWS identity, which is only right for deployers whose AWS
256
+ account is allowed to read the registry. To install packages you do not need
257
+ AWS at all — drop the flag: `mesh registry login`.
205
258
 
206
- ### `No valid Mesh session …`
259
+ ### `Registry broker unavailable (…)`
207
260
 
208
- Your session expired. Run `mesh login mesh.dev` again.
261
+ The broker could not be reached, and the CLI fell back to the AWS credential
262
+ chain, which this machine does not have. Retry in a minute:
263
+ `mesh registry login`. If you deploy and have an AWS account:
264
+ `mesh registry login --profile <aws-profile>`.
209
265
 
210
- ### `No configuration found for "mesh.dev"`
266
+ ### `Could not resolve the Mesh package registry`
211
267
 
212
- Either you are offline, or the platform is not publishing its discovery document
213
- yet. Use the platform's full domain instead, e.g.
214
- `mesh login dev.platform.meshtech.io`.
268
+ You are offline, or the platform's discovery document is unreachable. Retry
269
+ once you are online: `mesh registry login`.
215
270
 
216
271
  ---
217
272