@zitadel/cli 0.1.0-alpha.1 → 0.1.0-alpha.10

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 (45) hide show
  1. package/README.md +116 -26
  2. package/SKILLS.md +102 -24
  3. package/dist/commands/apply.mjs +4 -5
  4. package/dist/commands/apply.mjs.map +1 -1
  5. package/dist/commands/doctor.mjs +214 -50
  6. package/dist/commands/doctor.mjs.map +1 -1
  7. package/dist/commands/eject.mjs +14 -7
  8. package/dist/commands/eject.mjs.map +1 -1
  9. package/dist/commands/logs.mjs +15 -7
  10. package/dist/commands/logs.mjs.map +1 -1
  11. package/dist/commands/plan.mjs +4 -5
  12. package/dist/commands/plan.mjs.map +1 -1
  13. package/dist/commands/reset.mjs +28 -12
  14. package/dist/commands/reset.mjs.map +1 -1
  15. package/dist/commands/setup.mjs +266 -106
  16. package/dist/commands/setup.mjs.map +1 -1
  17. package/dist/commands/start.mjs +180 -24
  18. package/dist/commands/start.mjs.map +1 -1
  19. package/dist/commands/status.mjs +40 -16
  20. package/dist/commands/status.mjs.map +1 -1
  21. package/dist/commands/stop.mjs +72 -11
  22. package/dist/commands/stop.mjs.map +1 -1
  23. package/dist/docker-CnGQK3ZK.mjs +432 -0
  24. package/dist/docker-CnGQK3ZK.mjs.map +1 -0
  25. package/dist/docker-guidance-ypN3IM3o.mjs +21 -0
  26. package/dist/docker-guidance-ypN3IM3o.mjs.map +1 -0
  27. package/dist/{oclif-DSPO9Sck.mjs → oclif-B7lBzh3R.mjs} +158 -63
  28. package/dist/oclif-B7lBzh3R.mjs.map +1 -0
  29. package/dist/orca-BoTFU8SI.mjs +2581 -0
  30. package/dist/orca-BoTFU8SI.mjs.map +1 -0
  31. package/dist/ports-B09RjuHx.mjs +111 -0
  32. package/dist/ports-B09RjuHx.mjs.map +1 -0
  33. package/dist/processes-Cw8TO1SY.mjs +120 -0
  34. package/dist/processes-Cw8TO1SY.mjs.map +1 -0
  35. package/dist/{project-Dwb9WVAT.mjs → project-Cd0L3PtM.mjs} +3 -3
  36. package/dist/{project-Dwb9WVAT.mjs.map → project-Cd0L3PtM.mjs.map} +1 -1
  37. package/dist/{sync-DmtTYNmq.mjs → sync-BojoQm2P.mjs} +3 -3
  38. package/dist/{sync-DmtTYNmq.mjs.map → sync-BojoQm2P.mjs.map} +1 -1
  39. package/oclif.manifest.json +49 -5
  40. package/package.json +8 -41
  41. package/dist/docker-C0aVpJqm.mjs +0 -209
  42. package/dist/docker-C0aVpJqm.mjs.map +0 -1
  43. package/dist/oclif-DSPO9Sck.mjs.map +0 -1
  44. package/dist/orca-DOxshV9n.mjs +0 -1009
  45. package/dist/orca-DOxshV9n.mjs.map +0 -1
package/README.md CHANGED
@@ -1,52 +1,77 @@
1
1
  # @zitadel/cli
2
2
 
3
- Scaffolds Zitadel auth (login, register, profile, middleware) into a Next.js app.
3
+ Scaffolds Zitadel auth (login, register, profile, middleware) into a Next.js, React, Vue, Angular, or Nuxt app.
4
4
 
5
5
  ```sh
6
- npx @zitadel/cli@latest start
7
- npx @zitadel/cli@latest setup --framework next --server local
6
+ npx @zitadel/cli@alpha start
7
+ npx @zitadel/cli@alpha setup --server local
8
8
  ```
9
9
 
10
+ During the public alpha, bare `npx @zitadel/cli` resolves to the same tested
11
+ alpha CLI. Use `@alpha` or an exact `0.1.0-alpha.N` selector in bug reports and
12
+ automation when reproducibility matters.
13
+
10
14
  > **Beta.** This is the **next-generation Zitadel**, a ground-up rewrite of the platform. It is distinct from the established Zitadel at [github.com/zitadel/zitadel](https://github.com/zitadel/zitadel). APIs and CLI flags will change.
11
15
 
12
16
  ## Requirements
13
17
 
14
- - Node 20+
15
- - Docker for the managed local Zitadel runtime
16
- - A Next.js project created with `create-next-app`
18
+ - Node 24+
19
+ - Docker only when using the optional Docker runtime backend
20
+ - A Next.js project, or an empty directory where setup can scaffold one
17
21
 
18
22
  ## Quickstart
19
23
 
20
24
  ```sh
21
- npx create-next-app@latest my-app
25
+ mkdir my-app
22
26
  cd my-app
23
- npx @zitadel/cli@latest doctor
24
- npx @zitadel/cli@latest start
25
- npx @zitadel/cli@latest setup --framework next --server local
26
- npm install
27
+ npx @zitadel/cli@alpha doctor
28
+ npx @zitadel/cli@alpha start
29
+ npx @zitadel/cli@alpha setup --server local
27
30
  npm run dev
28
31
  ```
29
32
 
30
- `start` runs a Docker-backed local Zitadel server and stores runtime data
31
- under `.zitadel/local/`. It uses `ghcr.io/zitadel/nextgen:latest` unless
32
- overridden with `--image` or `ZITADEL_LOCAL_IMAGE`. `setup --server local`
33
- creates a project on that local server, scaffolds `app/login`, `app/register`, and
34
- `middleware.ts`, and writes `.env.local` and `.zitadel/`. The project's default
35
- user schema and login flow are provisioned server-side at creation time, so the
36
- CLI does not scaffold or upload them. Open `http://localhost:3000/login` to see
37
- the login page.
33
+ `start` runs the `@zitadel/server` npm binary by default and stores runtime data
34
+ under `.zitadel/local/`. Remote-server setup can use `--server <url>` without
35
+ starting a local runtime. Use `--runtime docker`, `--image`, or
36
+ `ZITADEL_LOCAL_IMAGE` for advanced Docker backend debugging.
37
+ `setup --server local` creates a project on that local server, asks which
38
+ framework to scaffold when the directory is fresh, writes the Next.js app into
39
+ the current directory, scaffolds `app/login`, `app/register`, `app/profile`, and
40
+ `proxy.ts` for Next 16+ or `middleware.ts` for older Next versions. Fresh
41
+ scaffolds also replace the starter `app/page.tsx` with links to sign in, create
42
+ an account, and profile. Setup writes `.env.local` and `.zitadel/`, and installs
43
+ dependencies with the detected package manager. Pass `--skip-install` to install
44
+ them yourself. The project's default user schema and login flow are provisioned
45
+ server-side at creation time, so the CLI does not scaffold or upload them. Open
46
+ the dev server URL printed by your framework, register a user, log out, log back
47
+ in, and end on the signed-in profile page.
48
+
49
+ For a reproducible tester report, use the exact alpha train from the GitHub
50
+ Release:
51
+
52
+ ```sh
53
+ npx @zitadel/cli@0.1.0-alpha.N doctor
54
+ npx @zitadel/cli@0.1.0-alpha.N start
55
+ npx @zitadel/cli@0.1.0-alpha.N setup --server local
56
+ ```
38
57
 
39
58
  The default project flow supports password registration/login, passkey
40
59
  registration/login, and optional passkey setup after password registration.
41
60
  Users who skip passkey setup can still sign in with password; users who add a
42
61
  passkey can sign in with either credential.
43
62
 
63
+ For agent scripts, pass `--non-interactive --json` and capture stdout and stderr
64
+ separately. The CLI contract is one parseable JSON object on stdout; terminals
65
+ and agent UIs may display stderr package-manager progress together with stdout.
66
+
44
67
  ## Other commands
45
68
 
46
- - `zitadel doctor` — verify the local Docker runtime and generated project files
47
- - `zitadel status` — summarise the local Docker runtime and project
69
+ - `zitadel doctor` — verify the local runtime and generated project files
70
+ - `zitadel status` — summarise the local runtime and project
71
+ - `zitadel plan` — validate config and preview sync changes without mutation
72
+ - `zitadel apply` — validate and upload repo config to Zitadel
48
73
  - `zitadel eject` — remove what setup wrote (alias: `zitadel uninstall`)
49
- - `zitadel start|stop|logs|reset` — manage the local Docker runtime
74
+ - `zitadel start|stop|logs|reset` — manage the local runtime
50
75
 
51
76
  ## Reference
52
77
 
@@ -54,12 +79,14 @@ passkey can sign in with either credential.
54
79
  <summary>Full command reference</summary>
55
80
 
56
81
  <!-- commands -->
82
+ * [`zitadel apply`](#zitadel-apply)
57
83
  * [`zitadel autocomplete [SHELL]`](#zitadel-autocomplete-shell)
58
84
  * [`zitadel commands`](#zitadel-commands)
59
85
  * [`zitadel doctor`](#zitadel-doctor)
60
86
  * [`zitadel eject`](#zitadel-eject)
61
87
  * [`zitadel help [COMMAND]`](#zitadel-help-command)
62
88
  * [`zitadel logs`](#zitadel-logs)
89
+ * [`zitadel plan`](#zitadel-plan)
63
90
  * [`zitadel reset`](#zitadel-reset)
64
91
  * [`zitadel search`](#zitadel-search)
65
92
  * [`zitadel setup`](#zitadel-setup)
@@ -70,6 +97,33 @@ passkey can sign in with either credential.
70
97
  * [`zitadel version`](#zitadel-version)
71
98
  * [`zitadel which`](#zitadel-which)
72
99
 
100
+ ## `zitadel apply`
101
+
102
+ Validate and upload repo config to the platform.
103
+
104
+ ```
105
+ USAGE
106
+ $ zitadel apply [--json] [-c <value>] [-s <value>] [-n] [-f] [--dry-run] [--verbose] [--debug] [-e
107
+ development|preview|production]
108
+
109
+ FLAGS
110
+ -c, --cwd=<value> Project directory to operate on.
111
+ -e, --environment=<option> Target environment (default: development).
112
+ <options: development|preview|production>
113
+ -f, --force Overwrite protected files on conflict.
114
+ -n, --non-interactive Disable prompts. Required when scripting or running as an agent.
115
+ -s, --server=<value> Override the resolved server URL.
116
+ --debug Debug logging.
117
+ --dry-run Preview without mutating files or the platform.
118
+ --verbose Verbose logging.
119
+
120
+ GLOBAL FLAGS
121
+ --json Format output as json.
122
+
123
+ DESCRIPTION
124
+ Validate and upload repo config to the platform.
125
+ ```
126
+
73
127
  ## `zitadel autocomplete [SHELL]`
74
128
 
75
129
  Display autocomplete installation instructions.
@@ -137,7 +191,7 @@ Verify local runtime and project state.
137
191
  ```
138
192
  USAGE
139
193
  $ zitadel doctor [--json] [-c <value>] [-s <value>] [-n] [-f] [--dry-run] [--verbose] [--debug] [--fix]
140
- [--image <value>] [--port <value>]
194
+ [--image <value>] [--port <value>] [--runtime binary|docker]
141
195
 
142
196
  FLAGS
143
197
  -c, --cwd=<value> Project directory to operate on.
@@ -149,6 +203,8 @@ FLAGS
149
203
  --fix Re-apply missing managed files.
150
204
  --image=<value> Container image to check.
151
205
  --port=<value> [default: 8080] Local HTTP port.
206
+ --runtime=<option> Local runtime backend.
207
+ <options: binary|docker>
152
208
  --verbose Verbose logging.
153
209
 
154
210
  GLOBAL FLAGS
@@ -232,6 +288,33 @@ DESCRIPTION
232
288
  Show local Zitadel server logs.
233
289
  ```
234
290
 
291
+ ## `zitadel plan`
292
+
293
+ Validate config without mutation and preview the sync diff.
294
+
295
+ ```
296
+ USAGE
297
+ $ zitadel plan [--json] [-c <value>] [-s <value>] [-n] [-f] [--dry-run] [--verbose] [--debug] [-e
298
+ development|preview|production]
299
+
300
+ FLAGS
301
+ -c, --cwd=<value> Project directory to operate on.
302
+ -e, --environment=<option> Target environment (default: development).
303
+ <options: development|preview|production>
304
+ -f, --force Overwrite protected files on conflict.
305
+ -n, --non-interactive Disable prompts. Required when scripting or running as an agent.
306
+ -s, --server=<value> Override the resolved server URL.
307
+ --debug Debug logging.
308
+ --dry-run Preview without mutating files or the platform.
309
+ --verbose Verbose logging.
310
+
311
+ GLOBAL FLAGS
312
+ --json Format output as json.
313
+
314
+ DESCRIPTION
315
+ Validate config without mutation and preview the sync diff.
316
+ ```
317
+
235
318
  ## `zitadel reset`
236
319
 
237
320
  Delete the local Zitadel server runtime and data.
@@ -279,7 +362,7 @@ Create a Zitadel project and scaffold local auth.
279
362
  ```
280
363
  USAGE
281
364
  $ zitadel setup [--json] [-c <value>] [-s <value>] [-n] [-f] [--dry-run] [--verbose] [--debug]
282
- [--framework next] [--renderer react|web-component]
365
+ [--framework next|nuxt|react|vue|angular] [--renderer react|web-component] [--dev-port <value>] [--skip-install]
283
366
 
284
367
  FLAGS
285
368
  -c, --cwd=<value> Project directory to operate on.
@@ -287,11 +370,14 @@ FLAGS
287
370
  -n, --non-interactive Disable prompts. Required when scripting or running as an agent.
288
371
  -s, --server=<value> Override the resolved server URL.
289
372
  --debug Debug logging.
373
+ --dev-port=<value> Dev-server port; also the issuer origin registered with Zitadel. Defaults to the detected
374
+ port. Use distinct ports to run several scaffolded apps side by side.
290
375
  --dry-run Preview without mutating files or the platform.
291
376
  --framework=<option> Framework to target.
292
- <options: next>
377
+ <options: next|nuxt|react|vue|angular>
293
378
  --renderer=<option> Renderer (default: react).
294
379
  <options: react|web-component>
380
+ --skip-install Do not install dependencies after setup updates package.json.
295
381
  --verbose Verbose logging.
296
382
 
297
383
  GLOBAL FLAGS
@@ -302,6 +388,8 @@ DESCRIPTION
302
388
 
303
389
  EXAMPLES
304
390
  $ zitadel setup --framework next
391
+
392
+ $ zitadel setup --framework react --dev-port 3000
305
393
  ```
306
394
 
307
395
  ## `zitadel start`
@@ -311,7 +399,7 @@ Start a local Zitadel server.
311
399
  ```
312
400
  USAGE
313
401
  $ zitadel start [--json] [-c <value>] [-s <value>] [-n] [-f] [--dry-run] [--verbose] [--debug] [--image
314
- <value>] [--port <value>]
402
+ <value>] [--port <value>] [--runtime binary|docker]
315
403
 
316
404
  FLAGS
317
405
  -c, --cwd=<value> Project directory to operate on.
@@ -322,6 +410,8 @@ FLAGS
322
410
  --dry-run Preview without mutating files or the platform.
323
411
  --image=<value> Container image to run.
324
412
  --port=<value> [default: 8080] Local HTTP port.
413
+ --runtime=<option> Local runtime backend.
414
+ <options: binary|docker>
325
415
  --verbose Verbose logging.
326
416
 
327
417
  GLOBAL FLAGS
package/SKILLS.md CHANGED
@@ -4,8 +4,8 @@ description: >-
4
4
  Set up and manage Zitadel authentication in a local project with the
5
5
  agent-friendly `zitadel` CLI. Use when the user wants to add login,
6
6
  registration, or session handling, create a Zitadel project, scaffold auth
7
- routes for a Next.js App Router app, or plan and apply Zitadel config changes
8
- from repo state.
7
+ for a Next.js, React, Vue, Angular, or Nuxt app, or plan and apply Zitadel
8
+ config changes from repo state.
9
9
  ---
10
10
 
11
11
  # Zitadel CLI
@@ -24,9 +24,13 @@ parse the result rather than scraping human output.
24
24
  metadata) or run `zitadel <command> --help` for the full per-command flag list.
25
25
 
26
26
  ```sh
27
- npx @zitadel/cli@latest <command> --non-interactive --json
27
+ npx @zitadel/cli@alpha <command> --non-interactive --json
28
28
  ```
29
29
 
30
+ During the public alpha, bare `npx @zitadel/cli` is promoted to the same tested
31
+ alpha CLI so discovery works for first-time users. Prefer `@alpha` or an exact
32
+ `0.1.0-alpha.N` selector in agent scripts and bug reports for reproducibility.
33
+
30
34
  ## Reading the envelope
31
35
 
32
36
  Each invocation prints one JSON object:
@@ -38,8 +42,16 @@ Each invocation prints one JSON object:
38
42
  - On failure: `code` (e.g. `E_VALIDATION`, `E_NETWORK`, `E_CONFLICT`) and
39
43
  `message`.
40
44
  - `next_commands`: the suggested follow-ups. Prefer these over free-text hints.
41
- - `E_LOCAL_SERVER_NOT_RUNNING`: start the local Docker runtime with
42
- `zitadel start`, then retry with `--server local`.
45
+ - `E_LOCAL_SERVER_NOT_RUNNING`: start the local runtime with
46
+ `npx @zitadel/cli@alpha start`, then retry with `--server local`.
47
+ - `E_PORT_IN_USE`: the requested local runtime port already has a listener.
48
+ Stop that process, run `npx @zitadel/cli@alpha stop --all` for host-wide
49
+ CLI-managed local runtimes, or choose another `start --port`.
50
+
51
+ Capture stdout and stderr separately when scripting. Some terminals and agent
52
+ UIs display both streams together, but the machine contract is one parseable
53
+ JSON object on stdout; installer, audit, and package-manager progress belongs
54
+ on stderr.
43
55
 
44
56
  Exit codes mirror the error class (3 = validation, 4 = network, 5 = conflict,
45
57
  1 = auth, 2 = not-implemented). An unknown command is handled by the CLI's help
@@ -50,37 +62,103 @@ layer, not the envelope.
50
62
  - `setup` — create a Zitadel project and scaffold local auth (routes,
51
63
  middleware, `.zitadel/**`, env templates). The project's default user schema
52
64
  and login flow are provisioned server-side at creation, so setup neither
53
- scaffolds nor uploads them. Flags: `--framework`, `--renderer`.
65
+ scaffolds nor uploads them. Agents must pass `--framework` when scaffolding
66
+ into a fresh directory; interactive humans can omit it and choose from the
67
+ prompt. Flags: `--framework next|react|vue|angular|nuxt`, `--renderer
68
+ react|web-component` (selects the Next.js auth-page renderer; accepted for any
69
+ framework and recorded in `zitadel.json` branding, but only Next varies its
70
+ generated templates by it), `--dev-port` (dev-server port, also the issuer
71
+ origin registered with Zitadel — use distinct ports to run several scaffolded
72
+ apps side by side), `--skip-install`.
54
73
  - `plan` — validate config and preview the sync diff without mutating anything.
55
74
  - `apply` — validate and upload repo config to the platform.
56
- - `doctor` — verify local Docker runtime prerequisites and, once `zitadel.json`
57
- exists, generated app files and local state; `--fix` re-applies missing
58
- managed files.
59
- - `status` summarize the local Docker runtime and project state.
75
+ - `doctor` — verify generated app files and local state once `zitadel.json`
76
+ exists. The default local runtime is the `@zitadel/server` npm binary;
77
+ Docker checks apply only when using `--runtime docker` or `--image`.
78
+ `--fix` re-applies missing managed files.
79
+ - `status` — summarize the local runtime and project state.
60
80
  - `eject` (alias `uninstall`) — remove managed files and local Zitadel state;
61
81
  requires `--force` when non-interactive.
62
- - `start` — start the managed local Zitadel container and persist runtime
63
- metadata under `.zitadel/local/runtime.json`.
64
- - `stop` — stop/remove the managed container while preserving
65
- `.zitadel/local/nextgen-data`.
66
- - `logs` — print managed container logs; `--follow` streams in human mode.
67
- - `reset` — stop/remove the managed container and delete local runtime data;
82
+ - `start` — start the managed local Zitadel server and persist runtime metadata
83
+ under `.zitadel/local/runtime.json`. Use `--runtime docker` or `--image` for
84
+ the Docker backend.
85
+ - `stop` — stop the managed runtime while preserving
86
+ `.zitadel/local/nextgen-data`. Use `stop --all` to sweep all discovered
87
+ host-wide CLI-managed local runtime processes, including healthy runtimes
88
+ from other local projects; it does not kill arbitrary `/healthz` listeners.
89
+ - `logs` — print managed runtime logs; `--follow` streams in human mode.
90
+ - `reset` — stop/remove the managed runtime and delete local runtime data;
68
91
  requires `--force` when non-interactive.
69
92
 
93
+ Alpha releases are fixed product package trains. `npx @zitadel/cli@alpha start`
94
+ uses the matching `@zitadel/server` package by default. `zitadel start --runtime
95
+ docker --image <ref>` remains the explicit image override for debugging.
96
+
70
97
  ## Golden path
71
98
 
72
99
  ```sh
73
- npx @zitadel/cli@latest doctor --non-interactive --json
74
- npx @zitadel/cli@latest start --non-interactive --json
75
- npx @zitadel/cli@latest setup --framework next --server local --non-interactive --json
76
- npx @zitadel/cli@latest doctor --non-interactive --json
77
- npx @zitadel/cli@latest plan --non-interactive --json
78
- npx @zitadel/cli@latest apply --non-interactive --json
100
+ npx @zitadel/cli@alpha doctor --non-interactive --json
101
+ npx @zitadel/cli@alpha start --non-interactive --json
102
+ npx @zitadel/cli@alpha setup --framework next --server local --non-interactive --json
103
+ npx @zitadel/cli@alpha doctor --non-interactive --json
104
+ npx @zitadel/cli@alpha plan --non-interactive --json
105
+ npx @zitadel/cli@alpha apply --non-interactive --json
106
+ ```
107
+
108
+ Exact alpha train invocation:
109
+
110
+ ```sh
111
+ npx @zitadel/cli@0.1.0-alpha.N doctor --non-interactive --json
112
+ npx @zitadel/cli@0.1.0-alpha.N start --non-interactive --json
113
+ npx @zitadel/cli@0.1.0-alpha.N setup --framework next --server local --non-interactive --json
79
114
  ```
80
115
 
116
+ After `setup`, follow `data.next_commands` to start the app. Prove the generated
117
+ auth flow in a visible browser by registering a unique user, logging out, logging
118
+ back in with the same email/password, and ending on the signed-in profile page.
119
+ Do not treat a rendered login or registration form as completion.
120
+
121
+ ### Driving the login UI
122
+
123
+ `<zitadel-login>` and `<zitadel-logout>` are Lit elements with open shadow
124
+ roots. The stable automation hooks live inside nested shadow roots, so a flat
125
+ `document.querySelector('[data-testid="zitadel-input-email"]')` will not find
126
+ the native control. Browser drivers with shadow-DOM-aware locators, such as
127
+ Playwright, can target the hooks directly. Generic DOM-eval drivers should
128
+ pierce shadow roots recursively:
129
+
130
+ ```js
131
+ function deepQuery(sel, root = document) {
132
+ const hit = root.querySelector(sel);
133
+ if (hit) return hit;
134
+ for (const el of root.querySelectorAll("*")) {
135
+ if (el.shadowRoot) {
136
+ const result = deepQuery(sel, el.shadowRoot);
137
+ if (result) return result;
138
+ }
139
+ }
140
+ return null;
141
+ }
142
+ ```
143
+
144
+ Use host hooks such as `zitadel-field-email`, `zitadel-field-password`, and
145
+ `zitadel-action-submit` when targeting the Lit atoms. Use native shadow-control
146
+ hooks such as `zitadel-input-email`, `zitadel-input-password`, and
147
+ `zitadel-action-submit-button` when filling or clicking the underlying input or
148
+ button. For sign-out, open the user menu button if needed, then pierce to
149
+ `.signout-btn`; Playwright-style locators may use `zitadel-logout .signout-btn`.
150
+ The canonical component hook list lives in `packages/components/README.md`.
151
+
152
+ The checked-in automated regression path is `moon run workspace:journey`, which
153
+ exercises fresh-app setup plus registration, logout, and login across the
154
+ supported frameworks.
155
+
81
156
  Repo config is authoritative: edit `zitadel.json` or files under `.zitadel/`,
82
157
  then re-run `plan` and `apply`. Managed files carry a marker comment; `eject`
83
158
  removes only files that still carry it, preserving anything the user replaced.
84
159
  For app-local development, `--server local` resolves through
85
- `.zitadel/local/runtime.json` and requires a healthy `zitadel start`
86
- runtime.
160
+ `.zitadel/local/runtime.json` and requires a healthy `npx @zitadel/cli@alpha start`
161
+ runtime. Runtime-only `.zitadel/local/**` state does not block fresh
162
+ same-directory scaffolding. `setup` installs dependencies with the detected
163
+ package manager by default; pass `--skip-install` when the agent or host
164
+ workflow will install dependencies separately.
@@ -1,9 +1,9 @@
1
- import { t as BaseCommand } from "../oclif-DSPO9Sck.mjs";
2
- import { o as readZitadelSecret } from "../project-Dwb9WVAT.mjs";
3
- import { a as makeSyncers, i as runSyncLoop, n as summarizePlan, o as environmentSchema, r as buildSyncPlan, t as renderPlan } from "../sync-DmtTYNmq.mjs";
1
+ import { t as BaseCommand } from "../oclif-B7lBzh3R.mjs";
2
+ import { o as readZitadelSecret } from "../project-Cd0L3PtM.mjs";
3
+ import { a as makeSyncers, i as runSyncLoop, n as summarizePlan, o as environmentSchema, r as buildSyncPlan, t as renderPlan } from "../sync-BojoQm2P.mjs";
4
4
  import { Flags } from "@oclif/core";
5
- import { consola as consola$1 } from "consola";
6
5
  import { createZitadelClient } from "@zitadel/api/client";
6
+ import { consola as consola$1 } from "consola";
7
7
  //#region src/commands/apply.ts
8
8
  /**
9
9
  * `zitadel apply` — validate and upload repo config to the platform.
@@ -16,7 +16,6 @@ import { createZitadelClient } from "@zitadel/api/client";
16
16
  */
17
17
  var Apply = class Apply extends BaseCommand {
18
18
  static description = "Validate and upload repo config to the platform.";
19
- static hidden = true;
20
19
  static flags = { environment: Flags.string({
21
20
  char: "e",
22
21
  description: "Target environment (default: development).",
@@ -1 +1 @@
1
- {"version":3,"file":"apply.mjs","names":[],"sources":["../../src/commands/apply.ts"],"sourcesContent":["import { Flags } from \"@oclif/core\";\nimport { consola } from \"consola\";\n\nimport { createZitadelClient } from \"@zitadel/api/client\";\n\nimport { BaseCommand, type JsonEnvelope } from \"../lib/oclif\";\nimport { environmentSchema } from \"../lib/environment\";\nimport { buildSyncPlan, makeSyncers, renderPlan, runSyncLoop, summarizePlan } from \"../lib/sync\";\nimport { readZitadelSecret } from \"../lib/project\";\n\n/**\n * `zitadel apply` — validate and upload repo config to the platform.\n *\n * Runs the sync loop to convergence, or (with `--dry-run`) previews the diff\n * without mutating. All validation — structural shape and `${VAR}` / `*_env`\n * reference presence — happens inside the sync engine ({@link buildSyncPlan}),\n * so an invalid or under-configured file fails with `E_VALIDATION` before any\n * platform call.\n */\nexport default class Apply extends BaseCommand {\n static override description = \"Validate and upload repo config to the platform.\";\n // Temporarily hidden while we collapse the dev workflow around `setup`'s\n // auto-apply. The logic stays wired up so re-exposing this command is a\n // one-line flip when we settle on the surface area.\n static override hidden = true;\n static override flags = {\n environment: Flags.string({\n char: \"e\",\n description: \"Target environment (default: development).\",\n options: [...environmentSchema.options],\n }),\n };\n\n async run(): Promise<JsonEnvelope> {\n const { flags } = await this.parse(Apply);\n await this.toMeta(flags);\n const { cwd, source, env, dryRun, isTTY } = this.meta;\n\n const secret = await readZitadelSecret(cwd);\n consola.info(`Project ${secret.project_id}`);\n consola.info(`Server ${source}`);\n const client = createZitadelClient({\n baseUrl: source,\n token: secret.project_secret,\n });\n const syncers = makeSyncers({ client, projectId: secret.project_id, env });\n\n if (!dryRun) {\n consola.start(\"Syncing schemas and flows to Zitadel\");\n await runSyncLoop(cwd, syncers);\n consola.success(\"Sync complete\");\n return this.emit({ status: \"ok\", data: { synced: true } });\n }\n\n consola.start(\"Building plan (dry run)\");\n const plan = await buildSyncPlan(cwd, syncers, true);\n const summary = summarizePlan(plan);\n consola.success(\n `Plan: ${summary.creates} create${summary.creates === 1 ? \"\" : \"s\"}, ` +\n `${summary.updates} update${summary.updates === 1 ? \"\" : \"s\"}, ` +\n `${summary.deletes} delete${summary.deletes === 1 ? \"\" : \"s\"}`,\n );\n return this.emit({\n status: \"ok\",\n data: summary,\n pretty: renderPlan(plan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version":3,"file":"apply.mjs","names":[],"sources":["../../src/commands/apply.ts"],"sourcesContent":["import { Flags } from \"@oclif/core\";\nimport { consola } from \"consola\";\n\nimport { createZitadelClient } from \"@zitadel/api/client\";\n\nimport { BaseCommand, type JsonEnvelope } from \"../lib/oclif\";\nimport { environmentSchema } from \"../lib/environment\";\nimport { buildSyncPlan, makeSyncers, renderPlan, runSyncLoop, summarizePlan } from \"../lib/sync\";\nimport { readZitadelSecret } from \"../lib/project\";\n\n/**\n * `zitadel apply` — validate and upload repo config to the platform.\n *\n * Runs the sync loop to convergence, or (with `--dry-run`) previews the diff\n * without mutating. All validation — structural shape and `${VAR}` / `*_env`\n * reference presence — happens inside the sync engine ({@link buildSyncPlan}),\n * so an invalid or under-configured file fails with `E_VALIDATION` before any\n * platform call.\n */\nexport default class Apply extends BaseCommand {\n static override description = \"Validate and upload repo config to the platform.\";\n static override flags = {\n environment: Flags.string({\n char: \"e\",\n description: \"Target environment (default: development).\",\n options: [...environmentSchema.options],\n }),\n };\n\n async run(): Promise<JsonEnvelope> {\n const { flags } = await this.parse(Apply);\n await this.toMeta(flags);\n const { cwd, source, env, dryRun, isTTY } = this.meta;\n\n const secret = await readZitadelSecret(cwd);\n consola.info(`Project ${secret.project_id}`);\n consola.info(`Server ${source}`);\n const client = createZitadelClient({\n baseUrl: source,\n token: secret.project_secret,\n });\n const syncers = makeSyncers({ client, projectId: secret.project_id, env });\n\n if (!dryRun) {\n consola.start(\"Syncing schemas and flows to Zitadel\");\n await runSyncLoop(cwd, syncers);\n consola.success(\"Sync complete\");\n return this.emit({ status: \"ok\", data: { synced: true } });\n }\n\n consola.start(\"Building plan (dry run)\");\n const plan = await buildSyncPlan(cwd, syncers, true);\n const summary = summarizePlan(plan);\n consola.success(\n `Plan: ${summary.creates} create${summary.creates === 1 ? \"\" : \"s\"}, ` +\n `${summary.updates} update${summary.updates === 1 ? \"\" : \"s\"}, ` +\n `${summary.deletes} delete${summary.deletes === 1 ? \"\" : \"s\"}`,\n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