@mesh-tech/mesh-cli 0.12.7 → 0.13.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.
package/README.md ADDED
@@ -0,0 +1,227 @@
1
+ # @mesh-tech/mesh-cli
2
+
3
+ `mesh` is the command-line entry point to the **Mesh platform** — Trabian's
4
+ platform for building and running financial-services applications.
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 platform login, your package-registry access, a new app,
9
+ a full local stack, and the documentation.
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 6](#6-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 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
+ ---
31
+
32
+ ## 1. Install
33
+
34
+ ```bash
35
+ npm i -g @mesh-tech/mesh-cli
36
+ mesh --version
37
+ ```
38
+
39
+ `mesh --version` must print **0.12.0 or newer**. If it prints `0.1.x`, or the
40
+ install fails with `E401`, see [Troubleshooting](#troubleshooting) — both are
41
+ known, one-command fixes.
42
+
43
+ ## 2. Sign in
44
+
45
+ ```bash
46
+ mesh login mesh.dev
47
+ ```
48
+
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.
52
+
53
+ `mesh login` finishes by refreshing your registry auth automatically, so in the
54
+ happy path step 3 is already done.
55
+
56
+ ## 3. Get registry access
57
+
58
+ ```bash
59
+ mesh registry login mesh.dev
60
+ mesh registry status
61
+ ```
62
+
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).
74
+
75
+ Everything after this point — installing `@mesh-tech/*` packages, and the local
76
+ docs server — depends on this step.
77
+
78
+ ## 4. Create an app
79
+
80
+ ```bash
81
+ mesh create-app --tenant acme --name billing --primitives service,database,temporal
82
+ ```
83
+
84
+ Scaffolds a new tenant application. `--primitives` selects what the app gets
85
+ (`service`, `database`, `temporal`, `bucket`; default `service`). Run
86
+ `mesh create-app --help` for the full option list, or omit the flags to be
87
+ prompted.
88
+
89
+ ## 5. Run it locally
90
+
91
+ Two commands, in this order:
92
+
93
+ ```bash
94
+ mesh start # the full-local Mesh platform — Docker only, no AWS, no VPN
95
+ mesh dev # from inside your app repo: run the app against it
96
+ ```
97
+
98
+ - `mesh status` — component health, endpoints, and ports.
99
+ - `mesh stop` — stop the local platform (`--destroy` also drops volumes).
100
+ - `mesh dev doctor` — diagnoses a dev session (credentials, tunnels, config,
101
+ ports, Temporal) and names the fix.
102
+ - `mesh dev logs <service>` / `mesh dev restart <service>` — per-service control.
103
+ - `mesh dev --externals` — also realize the app's declared external services,
104
+ mocked from their OpenAPI spec, run locally, or pointed at the real vendor.
105
+
106
+ `mesh start` brings up the platform's own services in Docker (the Hub included,
107
+ when its images are available — `--no-hub` skips it); `mesh dev` runs *your*
108
+ app's processes against them.
109
+
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
128
+
129
+ The Mesh documentation is served **locally, by the CLI** — same access grant as
130
+ the packages, no public site to keep in sync:
131
+
132
+ ```bash
133
+ mesh docs start # → http://localhost:4400
134
+ mesh docs stop
135
+ ```
136
+
137
+ `mesh docs start` runs detached (in a tmux session named `mesh-docs`) and prints
138
+ the URL once the server answers. Outside a `mesh-platform` checkout it fetches
139
+ the published docs artifact from the role-gated registry, so it needs
140
+ [step 3](#3-get-registry-access) to have succeeded. Useful flags:
141
+
142
+ | Flag | Effect |
143
+ |---|---|
144
+ | `-p, --port <port>` | serve on another port (`0` picks a free one) |
145
+ | `-v, --version <version>` | pin a docs version (default: latest) |
146
+ | `--foreground` | serve in the foreground (automatic for agents/CI) |
147
+
148
+ `mesh docs list` shows the published versions. The full `mesh` CLI reference —
149
+ every command, every flag, generated from the binary itself — is a page inside
150
+ that site.
151
+
152
+ ---
153
+
154
+ ## Troubleshooting
155
+
156
+ ### `npm i -g @mesh-tech/mesh-cli` fails with `E401`
157
+
158
+ This machine already points the `@mesh-tech` scope at the private registry with
159
+ an **expired** token, and npm maps registries per *scope*, never per package —
160
+ so it tried the private registry for a package that is published publicly.
161
+ Override the scope for this one command:
162
+
163
+ ```bash
164
+ npm i -g @mesh-tech/mesh-cli --@mesh-tech:registry=https://registry.npmjs.org
165
+ ```
166
+
167
+ `--registry=…` alone does **not** work: a scope mapping outranks it. Refreshing
168
+ the token (`mesh registry login mesh.dev`) fixes it too.
169
+
170
+ The release publishes the same version of `@mesh-tech/mesh-cli` to both
171
+ registries in the same job, so the two copies are the same artifact — there is
172
+ no fork to reconcile. Every *other* `@mesh-tech/*` package is private-registry
173
+ only, so keep the scope mapping for `pnpm install` in an app repo; only the CLI
174
+ bootstrap needs the override.
175
+
176
+ ### The install works, but `mesh --version` prints `0.1.x`
177
+
178
+ You got an abandoned public package from February 2026 that predates the current
179
+ CLI — nothing after it will work. Reinstall:
180
+
181
+ ```bash
182
+ npm rm -g @mesh-tech/mesh-cli
183
+ npm i -g @mesh-tech/mesh-cli
184
+ ```
185
+
186
+ ### `mesh: not inside a Mesh workspace (no node_modules/.bin/mesh found)`
187
+
188
+ An old launcher shim at `~/.local/bin/mesh` is shadowing the global CLI on your
189
+ `PATH`. The package is installed and fine — just unreachable.
190
+
191
+ ```bash
192
+ which -a mesh # the shim is listed above the npm global bin
193
+ rm ~/.local/bin/mesh # if you don't develop the platform itself
194
+ ```
195
+
196
+ If you *do* work in a `mesh-platform` checkout, run
197
+ `pnpm exec mesh install-shim --force` there instead — the current shim runs the
198
+ checkout's source inside a checkout and falls through to the global CLI
199
+ everywhere else.
200
+
201
+ ### `Your Mesh account (…) is not authorized to read @mesh-tech packages.`
202
+
203
+ 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).
205
+
206
+ ### `No valid Mesh session …`
207
+
208
+ Your session expired. Run `mesh login mesh.dev` again.
209
+
210
+ ### `No configuration found for "mesh.dev"`
211
+
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`.
215
+
216
+ ---
217
+
218
+ ## Getting help
219
+
220
+ - `mesh --help`, and `--help` on any subcommand.
221
+ - `mesh docs start` — the full documentation, locally.
222
+ - Anything else: your Mesh contact.
223
+
224
+ ## License
225
+
226
+ UNLICENSED — © Trabian. Access to the Mesh platform and its packages is granted
227
+ per account.
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: __APP_NAME__
3
+ description: This skill should be used when working on the __APP_NAME__ app — its workflows, services, schemas, config, deploys, and the conventions that are specific to it. Grow it as the app grows; it is the only skill that knows this app.
4
+ ---
5
+
6
+ # __APP_NAME__
7
+
8
+ > **This file is yours.** `mesh create-app` seeded the stub; `mesh skills sync`
9
+ > never touches it again. It carries no managed marker on purpose — the app repo
10
+ > knows the app better than any platform skill can, so this is where the
11
+ > app-specific knowledge belongs.
12
+
13
+ ## Where the platform knowledge lives (don't duplicate it here)
14
+
15
+ | For | Load |
16
+ |---|---|
17
+ | Scaffold → wire → run → debug a Mesh app | `.claude/skills/mesh-app-kit-apps/SKILL.md`, or `pnpm exec intent load @mesh-tech/app-kit#apps` |
18
+ | Exact `AppEnvironment` / primitive / Temporal API signatures | `pnpm exec intent load @mesh-tech/app-kit#core` |
19
+ | `mesh` CLI commands (`dev`, `deploy`, `stack`, `hub dev`, tunnels, db) | `.claude/skills/mesh-core/SKILL.md` |
20
+ | Everything installed that ships a skill | `pnpm exec intent list` |
21
+
22
+ Read those first. This file is for what they cannot know.
23
+
24
+ ## What this app is
25
+
26
+ <!-- One paragraph: what __APP_NAME__ does and who calls it. -->
27
+
28
+ - **Path:** `__APP_PATH__`
29
+ - **Primitives:**
30
+ <!-- e.g. service (Hono API), database (Prisma), temporal worker, bucket -->
31
+
32
+ ## Conventions specific to this app
33
+
34
+ <!--
35
+ Fill these in as you learn them. Good candidates:
36
+ - the domain vocabulary an agent will otherwise guess wrong
37
+ - which module owns what, and what must never import what
38
+ - the shape of the app's config and where each value comes from
39
+ - required env/secrets and how they are provisioned
40
+ - workflow/activity naming and versioning rules
41
+ - test fixtures and how to run just this app's suite
42
+ -->
43
+
44
+ ## Gotchas
45
+
46
+ <!--
47
+ Every time an agent (or you) gets something wrong twice, write it here.
48
+ This section is what makes the skill worth loading.
49
+ -->
50
+
51
+ ## Runbook
52
+
53
+ ```bash
54
+ cd __APP_PATH__
55
+ pnpm install
56
+ mesh dev # run locally
57
+ mesh hub dev # watch this session's runs in a local Hub
58
+ mesh deploy up # deploy via the stack's deployer role
59
+ ```