@zitadel/cli 0.1.0-alpha.8 → 0.1.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 (45) hide show
  1. package/README.md +2758 -210
  2. package/bin/run.js +8 -0
  3. package/dist/index.mjs +25199 -0
  4. package/dist/index.mjs.map +1 -0
  5. package/dist/lib/oclif/help.mjs +71 -0
  6. package/dist/lib/oclif/help.mjs.map +1 -0
  7. package/dist/skills-hint-BSspFzhr.mjs +173 -0
  8. package/dist/skills-hint-BSspFzhr.mjs.map +1 -0
  9. package/oclif.manifest.json +5846 -250
  10. package/package.json +73 -13
  11. package/skills/zitadel-cli/SKILL.md +442 -0
  12. package/skills/zitadel-cli/references/driving-login-ui.md +89 -0
  13. package/SKILLS.md +0 -152
  14. package/dist/commands/apply.mjs +0 -62
  15. package/dist/commands/apply.mjs.map +0 -1
  16. package/dist/commands/doctor.mjs +0 -490
  17. package/dist/commands/doctor.mjs.map +0 -1
  18. package/dist/commands/eject.mjs +0 -145
  19. package/dist/commands/eject.mjs.map +0 -1
  20. package/dist/commands/logs.mjs +0 -58
  21. package/dist/commands/logs.mjs.map +0 -1
  22. package/dist/commands/plan.mjs +0 -52
  23. package/dist/commands/plan.mjs.map +0 -1
  24. package/dist/commands/reset.mjs +0 -71
  25. package/dist/commands/reset.mjs.map +0 -1
  26. package/dist/commands/setup.mjs +0 -916
  27. package/dist/commands/setup.mjs.map +0 -1
  28. package/dist/commands/start.mjs +0 -221
  29. package/dist/commands/start.mjs.map +0 -1
  30. package/dist/commands/status.mjs +0 -112
  31. package/dist/commands/status.mjs.map +0 -1
  32. package/dist/commands/stop.mjs +0 -52
  33. package/dist/commands/stop.mjs.map +0 -1
  34. package/dist/docker-BA78SdC2.mjs +0 -383
  35. package/dist/docker-BA78SdC2.mjs.map +0 -1
  36. package/dist/docker-guidance-BvfpmsDj.mjs +0 -21
  37. package/dist/docker-guidance-BvfpmsDj.mjs.map +0 -1
  38. package/dist/oclif-VkCTGIEk.mjs +0 -818
  39. package/dist/oclif-VkCTGIEk.mjs.map +0 -1
  40. package/dist/orca-CfKDQRop.mjs +0 -2556
  41. package/dist/orca-CfKDQRop.mjs.map +0 -1
  42. package/dist/project-CKAHtHML.mjs +0 -87
  43. package/dist/project-CKAHtHML.mjs.map +0 -1
  44. package/dist/sync-B5lqgQO3.mjs +0 -733
  45. package/dist/sync-B5lqgQO3.mjs.map +0 -1
package/SKILLS.md DELETED
@@ -1,152 +0,0 @@
1
- ---
2
- name: zitadel-cli
3
- description: >-
4
- Set up and manage Zitadel authentication in a local project with the
5
- agent-friendly `zitadel` CLI. Use when the user wants to add login,
6
- registration, or session handling, create a Zitadel project, scaffold auth
7
- for a Next.js, React, Vue, Angular, or Nuxt app, or plan and apply Zitadel
8
- config changes from repo state.
9
- ---
10
-
11
- # Zitadel CLI
12
-
13
- The `zitadel` CLI integrates Zitadel auth into an existing project and keeps the
14
- local config (`zitadel.json` and `.zitadel/**`) as the source of truth. Every
15
- command emits a JSON envelope, so you should drive it non-interactively and
16
- parse the result rather than scraping human output.
17
-
18
- ## Invocation rules
19
-
20
- - Always pass `--non-interactive --json`. The envelope is the contract.
21
- - Add `--cwd <path>` when operating outside the current working directory.
22
- - Never run interactive prompts; `--non-interactive` (and `--json`) disable them.
23
- - See `README.md` (its commands section is generated from the CLI's own
24
- metadata) or run `zitadel <command> --help` for the full per-command flag list.
25
-
26
- ```sh
27
- npx @zitadel/cli@alpha <command> --non-interactive --json
28
- ```
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
-
34
- ## Reading the envelope
35
-
36
- Each invocation prints one JSON object:
37
-
38
- - `status`: `ok` | `skipped` | `error`.
39
- - `cli_version`, `command`, `source`: always present.
40
- - On success: `data` with the command-specific payload.
41
- - On a no-op: `reason` (e.g. `no-framework-detected`, `orphaned-config`).
42
- - On failure: `code` (e.g. `E_VALIDATION`, `E_NETWORK`, `E_CONFLICT`) and
43
- `message`.
44
- - `next_commands`: the suggested follow-ups. Prefer these over free-text hints.
45
- - `E_LOCAL_SERVER_NOT_RUNNING`: start the local runtime with
46
- `npx @zitadel/cli@alpha start`, then retry with `--server local`.
47
-
48
- Exit codes mirror the error class (3 = validation, 4 = network, 5 = conflict,
49
- 1 = auth, 2 = not-implemented). An unknown command is handled by the CLI's help
50
- layer, not the envelope.
51
-
52
- ## Commands
53
-
54
- - `setup` — create a Zitadel project and scaffold local auth (routes,
55
- middleware, `.zitadel/**`, env templates). The project's default user schema
56
- and login flow are provisioned server-side at creation, so setup neither
57
- scaffolds nor uploads them. Agents must pass `--framework` when scaffolding
58
- into a fresh directory; interactive humans can omit it and choose from the
59
- prompt. Flags: `--framework next|react|vue|angular|nuxt`, `--renderer
60
- react|web-component` (selects the Next.js auth-page renderer; accepted for any
61
- framework and recorded in `zitadel.json` branding, but only Next varies its
62
- generated templates by it), `--dev-port` (dev-server port, also the issuer
63
- origin registered with Zitadel — use distinct ports to run several scaffolded
64
- apps side by side), `--skip-install`.
65
- - `plan` — validate config and preview the sync diff without mutating anything.
66
- - `apply` — validate and upload repo config to the platform.
67
- - `doctor` — verify generated app files and local state once `zitadel.json`
68
- exists. The default local runtime is the `@zitadel/server` npm binary;
69
- Docker checks apply only when using `--runtime docker` or `--image`.
70
- `--fix` re-applies missing managed files.
71
- - `status` — summarize the local runtime and project state.
72
- - `eject` (alias `uninstall`) — remove managed files and local Zitadel state;
73
- requires `--force` when non-interactive.
74
- - `start` — start the managed local Zitadel server and persist runtime metadata
75
- under `.zitadel/local/runtime.json`. Use `--runtime docker` or `--image` for
76
- the Docker backend.
77
- - `stop` — stop the managed runtime while preserving
78
- `.zitadel/local/nextgen-data`.
79
- - `logs` — print managed runtime logs; `--follow` streams in human mode.
80
- - `reset` — stop/remove the managed runtime and delete local runtime data;
81
- requires `--force` when non-interactive.
82
-
83
- Alpha releases are fixed product package trains. `npx @zitadel/cli@alpha start`
84
- uses the matching `@zitadel/server` package by default. `zitadel start --runtime
85
- docker --image <ref>` remains the explicit image override for debugging.
86
-
87
- ## Golden path
88
-
89
- ```sh
90
- npx @zitadel/cli@alpha doctor --non-interactive --json
91
- npx @zitadel/cli@alpha start --non-interactive --json
92
- npx @zitadel/cli@alpha setup --framework next --server local --non-interactive --json
93
- npx @zitadel/cli@alpha doctor --non-interactive --json
94
- npx @zitadel/cli@alpha plan --non-interactive --json
95
- npx @zitadel/cli@alpha apply --non-interactive --json
96
- ```
97
-
98
- Exact alpha train invocation:
99
-
100
- ```sh
101
- npx @zitadel/cli@0.1.0-alpha.N doctor --non-interactive --json
102
- npx @zitadel/cli@0.1.0-alpha.N start --non-interactive --json
103
- npx @zitadel/cli@0.1.0-alpha.N setup --framework next --server local --non-interactive --json
104
- ```
105
-
106
- After `setup`, follow `data.next_commands` to start the app. Prove the generated
107
- auth flow in a visible browser by registering a unique user, logging out, logging
108
- back in with the same email/password, and ending on the signed-in profile page.
109
- Do not treat a rendered login or registration form as completion.
110
-
111
- ### Driving the login UI
112
-
113
- `<zitadel-login>` and `<zitadel-logout>` are Lit elements with open shadow
114
- roots. The stable automation hooks live inside nested shadow roots, so a flat
115
- `document.querySelector('[data-testid="zitadel-field-email-input"]')` will not
116
- find them. Browser drivers with shadow-DOM-aware locators, such as Playwright,
117
- can target the hooks directly. Generic DOM-eval drivers should pierce shadow
118
- roots recursively:
119
-
120
- ```js
121
- function deepQuery(sel, root = document) {
122
- const hit = root.querySelector(sel);
123
- if (hit) return hit;
124
- for (const el of root.querySelectorAll("*")) {
125
- if (el.shadowRoot) {
126
- const result = deepQuery(sel, el.shadowRoot);
127
- if (result) return result;
128
- }
129
- }
130
- return null;
131
- }
132
- ```
133
-
134
- Use `zitadel-field-email-input`, `zitadel-field-password-input`, and
135
- `zitadel-action-submit-button` for sign-in and registration. For sign-out, open
136
- the user menu button if needed, then pierce to `.signout-btn`; Playwright-style
137
- locators may use `zitadel-logout .signout-btn`. The canonical component hook
138
- list lives in `packages/components/README.md`.
139
-
140
- The checked-in automated regression path is `moon run workspace:journey`, which
141
- exercises fresh-app setup plus registration, logout, and login across the
142
- supported frameworks.
143
-
144
- Repo config is authoritative: edit `zitadel.json` or files under `.zitadel/`,
145
- then re-run `plan` and `apply`. Managed files carry a marker comment; `eject`
146
- removes only files that still carry it, preserving anything the user replaced.
147
- For app-local development, `--server local` resolves through
148
- `.zitadel/local/runtime.json` and requires a healthy `npx @zitadel/cli@alpha start`
149
- runtime. Runtime-only `.zitadel/local/**` state does not block fresh
150
- same-directory scaffolding. `setup` installs dependencies with the detected
151
- package manager by default; pass `--skip-install` when the agent or host
152
- workflow will install dependencies separately.
@@ -1,62 +0,0 @@
1
- import { t as BaseCommand } from "../oclif-VkCTGIEk.mjs";
2
- import { o as readZitadelSecret } from "../project-CKAHtHML.mjs";
3
- import { a as makeSyncers, i as runSyncLoop, n as summarizePlan, o as environmentSchema, r as buildSyncPlan, t as renderPlan } from "../sync-B5lqgQO3.mjs";
4
- import { Flags } from "@oclif/core";
5
- import { createZitadelClient } from "@zitadel/api/client";
6
- import { consola as consola$1 } from "consola";
7
- //#region src/commands/apply.ts
8
- /**
9
- * `zitadel apply` — validate and upload repo config to the platform.
10
- *
11
- * Runs the sync loop to convergence, or (with `--dry-run`) previews the diff
12
- * without mutating. All validation — structural shape and `${VAR}` / `*_env`
13
- * reference presence — happens inside the sync engine ({@link buildSyncPlan}),
14
- * so an invalid or under-configured file fails with `E_VALIDATION` before any
15
- * platform call.
16
- */
17
- var Apply = class Apply extends BaseCommand {
18
- static description = "Validate and upload repo config to the platform.";
19
- static flags = { environment: Flags.string({
20
- char: "e",
21
- description: "Target environment (default: development).",
22
- options: [...environmentSchema.options]
23
- }) };
24
- async run() {
25
- const { flags } = await this.parse(Apply);
26
- await this.toMeta(flags);
27
- const { cwd, source, env, dryRun, isTTY } = this.meta;
28
- const secret = await readZitadelSecret(cwd);
29
- consola$1.info(`Project ${secret.project_id}`);
30
- consola$1.info(`Server ${source}`);
31
- const syncers = makeSyncers({
32
- client: createZitadelClient({
33
- baseUrl: source,
34
- token: secret.project_secret
35
- }),
36
- projectId: secret.project_id,
37
- env
38
- });
39
- if (!dryRun) {
40
- consola$1.start("Syncing schemas and flows to Zitadel");
41
- await runSyncLoop(cwd, syncers);
42
- consola$1.success("Sync complete");
43
- return this.emit({
44
- status: "ok",
45
- data: { synced: true }
46
- });
47
- }
48
- consola$1.start("Building plan (dry run)");
49
- const plan = await buildSyncPlan(cwd, syncers, true);
50
- const summary = summarizePlan(plan);
51
- consola$1.success(`Plan: ${summary.creates} create${summary.creates === 1 ? "" : "s"}, ${summary.updates} update${summary.updates === 1 ? "" : "s"}, ${summary.deletes} delete${summary.deletes === 1 ? "" : "s"}`);
52
- return this.emit({
53
- status: "ok",
54
- data: summary,
55
- pretty: renderPlan(plan, isTTY)
56
- });
57
- }
58
- };
59
- //#endregion
60
- export { Apply as default };
61
-
62
- //# sourceMappingURL=apply.mjs.map
@@ -1 +0,0 @@
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 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, isTTY),\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAmBA,IAAqB,QAArB,MAAqB,cAAc,YAAY;CAC7C,OAAgB,cAAc;CAC9B,OAAgB,QAAQ,EACtB,aAAa,MAAM,OAAO;EACxB,MAAM;EACN,aAAa;EACb,SAAS,CAAC,GAAG,kBAAkB,QAAQ;EACxC,CAAC,EACH;CAED,MAAM,MAA6B;EACjC,MAAM,EAAE,UAAU,MAAM,KAAK,MAAM,MAAM;AACzC,QAAM,KAAK,OAAO,MAAM;EACxB,MAAM,EAAE,KAAK,QAAQ,KAAK,QAAQ,UAAU,KAAK;EAEjD,MAAM,SAAS,MAAM,kBAAkB,IAAI;AAC3C,YAAQ,KAAK,aAAa,OAAO,aAAa;AAC9C,YAAQ,KAAK,aAAa,SAAS;EAKnC,MAAM,UAAU,YAAY;GAAE,QAJf,oBAAoB;IACjC,SAAS;IACT,OAAO,OAAO;IACf,CACmC;GAAE,WAAW,OAAO;GAAY;GAAK,CAAC;AAE1E,MAAI,CAAC,QAAQ;AACX,aAAQ,MAAM,uCAAuC;AACrD,SAAM,YAAY,KAAK,QAAQ;AAC/B,aAAQ,QAAQ,gBAAgB;AAChC,UAAO,KAAK,KAAK;IAAE,QAAQ;IAAM,MAAM,EAAE,QAAQ,MAAM;IAAE,CAAC;;AAG5D,YAAQ,MAAM,0BAA0B;EACxC,MAAM,OAAO,MAAM,cAAc,KAAK,SAAS,KAAK;EACpD,MAAM,UAAU,cAAc,KAAK;AACnC,YAAQ,QACN,SAAS,QAAQ,QAAQ,SAAS,QAAQ,YAAY,IAAI,KAAK,IAAI,IAC9D,QAAQ,QAAQ,SAAS,QAAQ,YAAY,IAAI,KAAK,IAAI,IAC1D,QAAQ,QAAQ,SAAS,QAAQ,YAAY,IAAI,KAAK,MAC5D;AACD,SAAO,KAAK,KAAK;GACf,QAAQ;GACR,MAAM;GACN,QAAQ,WAAW,MAAM,MAAM;GAChC,CAAC"}