@zitadel/cli 0.1.0-alpha.9 → 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.
- package/README.md +2758 -210
- package/bin/run.js +8 -0
- package/dist/index.mjs +25199 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/oclif/help.mjs +71 -0
- package/dist/lib/oclif/help.mjs.map +1 -0
- package/dist/skills-hint-BSspFzhr.mjs +173 -0
- package/dist/skills-hint-BSspFzhr.mjs.map +1 -0
- package/oclif.manifest.json +5836 -246
- package/package.json +73 -13
- package/skills/zitadel-cli/SKILL.md +442 -0
- package/skills/zitadel-cli/references/driving-login-ui.md +89 -0
- package/SKILLS.md +0 -157
- package/dist/commands/apply.mjs +0 -62
- package/dist/commands/apply.mjs.map +0 -1
- package/dist/commands/doctor.mjs +0 -569
- package/dist/commands/doctor.mjs.map +0 -1
- package/dist/commands/eject.mjs +0 -145
- package/dist/commands/eject.mjs.map +0 -1
- package/dist/commands/logs.mjs +0 -58
- package/dist/commands/logs.mjs.map +0 -1
- package/dist/commands/plan.mjs +0 -52
- package/dist/commands/plan.mjs.map +0 -1
- package/dist/commands/reset.mjs +0 -79
- package/dist/commands/reset.mjs.map +0 -1
- package/dist/commands/setup.mjs +0 -856
- package/dist/commands/setup.mjs.map +0 -1
- package/dist/commands/start.mjs +0 -288
- package/dist/commands/start.mjs.map +0 -1
- package/dist/commands/status.mjs +0 -112
- package/dist/commands/status.mjs.map +0 -1
- package/dist/commands/stop.mjs +0 -105
- package/dist/commands/stop.mjs.map +0 -1
- package/dist/docker-CnGQK3ZK.mjs +0 -432
- package/dist/docker-CnGQK3ZK.mjs.map +0 -1
- package/dist/docker-guidance-ypN3IM3o.mjs +0 -21
- package/dist/docker-guidance-ypN3IM3o.mjs.map +0 -1
- package/dist/oclif-B7lBzh3R.mjs +0 -808
- package/dist/oclif-B7lBzh3R.mjs.map +0 -1
- package/dist/orca-U142Wrau.mjs +0 -2556
- package/dist/orca-U142Wrau.mjs.map +0 -1
- package/dist/ports-B09RjuHx.mjs +0 -111
- package/dist/ports-B09RjuHx.mjs.map +0 -1
- package/dist/processes-Cw8TO1SY.mjs +0 -120
- package/dist/processes-Cw8TO1SY.mjs.map +0 -1
- package/dist/project-Cd0L3PtM.mjs +0 -87
- package/dist/project-Cd0L3PtM.mjs.map +0 -1
- package/dist/sync-BojoQm2P.mjs +0 -733
- package/dist/sync-BojoQm2P.mjs.map +0 -1
package/SKILLS.md
DELETED
|
@@ -1,157 +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
|
-
- `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
|
-
Exit codes mirror the error class (3 = validation, 4 = network, 5 = conflict,
|
|
52
|
-
1 = auth, 2 = not-implemented). An unknown command is handled by the CLI's help
|
|
53
|
-
layer, not the envelope.
|
|
54
|
-
|
|
55
|
-
## Commands
|
|
56
|
-
|
|
57
|
-
- `setup` — create a Zitadel project and scaffold local auth (routes,
|
|
58
|
-
middleware, `.zitadel/**`, env templates). The project's default user schema
|
|
59
|
-
and login flow are provisioned server-side at creation, so setup neither
|
|
60
|
-
scaffolds nor uploads them. Agents must pass `--framework` when scaffolding
|
|
61
|
-
into a fresh directory; interactive humans can omit it and choose from the
|
|
62
|
-
prompt. Flags: `--framework next|react|vue|angular|nuxt`, `--renderer
|
|
63
|
-
react|web-component` (selects the Next.js auth-page renderer; accepted for any
|
|
64
|
-
framework and recorded in `zitadel.json` branding, but only Next varies its
|
|
65
|
-
generated templates by it), `--dev-port` (dev-server port, also the issuer
|
|
66
|
-
origin registered with Zitadel — use distinct ports to run several scaffolded
|
|
67
|
-
apps side by side), `--skip-install`.
|
|
68
|
-
- `plan` — validate config and preview the sync diff without mutating anything.
|
|
69
|
-
- `apply` — validate and upload repo config to the platform.
|
|
70
|
-
- `doctor` — verify generated app files and local state once `zitadel.json`
|
|
71
|
-
exists. The default local runtime is the `@zitadel/server` npm binary;
|
|
72
|
-
Docker checks apply only when using `--runtime docker` or `--image`.
|
|
73
|
-
`--fix` re-applies missing managed files.
|
|
74
|
-
- `status` — summarize the local runtime and project state.
|
|
75
|
-
- `eject` (alias `uninstall`) — remove managed files and local Zitadel state;
|
|
76
|
-
requires `--force` when non-interactive.
|
|
77
|
-
- `start` — start the managed local Zitadel server and persist runtime metadata
|
|
78
|
-
under `.zitadel/local/runtime.json`. Use `--runtime docker` or `--image` for
|
|
79
|
-
the Docker backend.
|
|
80
|
-
- `stop` — stop the managed runtime while preserving
|
|
81
|
-
`.zitadel/local/nextgen-data`. Use `stop --all` to sweep all discovered
|
|
82
|
-
host-wide CLI-managed local runtime processes, including healthy runtimes
|
|
83
|
-
from other local projects; it does not kill arbitrary `/healthz` listeners.
|
|
84
|
-
- `logs` — print managed runtime logs; `--follow` streams in human mode.
|
|
85
|
-
- `reset` — stop/remove the managed runtime and delete local runtime data;
|
|
86
|
-
requires `--force` when non-interactive.
|
|
87
|
-
|
|
88
|
-
Alpha releases are fixed product package trains. `npx @zitadel/cli@alpha start`
|
|
89
|
-
uses the matching `@zitadel/server` package by default. `zitadel start --runtime
|
|
90
|
-
docker --image <ref>` remains the explicit image override for debugging.
|
|
91
|
-
|
|
92
|
-
## Golden path
|
|
93
|
-
|
|
94
|
-
```sh
|
|
95
|
-
npx @zitadel/cli@alpha doctor --non-interactive --json
|
|
96
|
-
npx @zitadel/cli@alpha start --non-interactive --json
|
|
97
|
-
npx @zitadel/cli@alpha setup --framework next --server local --non-interactive --json
|
|
98
|
-
npx @zitadel/cli@alpha doctor --non-interactive --json
|
|
99
|
-
npx @zitadel/cli@alpha plan --non-interactive --json
|
|
100
|
-
npx @zitadel/cli@alpha apply --non-interactive --json
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
Exact alpha train invocation:
|
|
104
|
-
|
|
105
|
-
```sh
|
|
106
|
-
npx @zitadel/cli@0.1.0-alpha.N doctor --non-interactive --json
|
|
107
|
-
npx @zitadel/cli@0.1.0-alpha.N start --non-interactive --json
|
|
108
|
-
npx @zitadel/cli@0.1.0-alpha.N setup --framework next --server local --non-interactive --json
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
After `setup`, follow `data.next_commands` to start the app. Prove the generated
|
|
112
|
-
auth flow in a visible browser by registering a unique user, logging out, logging
|
|
113
|
-
back in with the same email/password, and ending on the signed-in profile page.
|
|
114
|
-
Do not treat a rendered login or registration form as completion.
|
|
115
|
-
|
|
116
|
-
### Driving the login UI
|
|
117
|
-
|
|
118
|
-
`<zitadel-login>` and `<zitadel-logout>` are Lit elements with open shadow
|
|
119
|
-
roots. The stable automation hooks live inside nested shadow roots, so a flat
|
|
120
|
-
`document.querySelector('[data-testid="zitadel-field-email-input"]')` will not
|
|
121
|
-
find them. Browser drivers with shadow-DOM-aware locators, such as Playwright,
|
|
122
|
-
can target the hooks directly. Generic DOM-eval drivers should pierce shadow
|
|
123
|
-
roots recursively:
|
|
124
|
-
|
|
125
|
-
```js
|
|
126
|
-
function deepQuery(sel, root = document) {
|
|
127
|
-
const hit = root.querySelector(sel);
|
|
128
|
-
if (hit) return hit;
|
|
129
|
-
for (const el of root.querySelectorAll("*")) {
|
|
130
|
-
if (el.shadowRoot) {
|
|
131
|
-
const result = deepQuery(sel, el.shadowRoot);
|
|
132
|
-
if (result) return result;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return null;
|
|
136
|
-
}
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
Use `zitadel-field-email-input`, `zitadel-field-password-input`, and
|
|
140
|
-
`zitadel-action-submit-button` for sign-in and registration. For sign-out, open
|
|
141
|
-
the user menu button if needed, then pierce to `.signout-btn`; Playwright-style
|
|
142
|
-
locators may use `zitadel-logout .signout-btn`. The canonical component hook
|
|
143
|
-
list lives in `packages/components/README.md`.
|
|
144
|
-
|
|
145
|
-
The checked-in automated regression path is `moon run workspace:journey`, which
|
|
146
|
-
exercises fresh-app setup plus registration, logout, and login across the
|
|
147
|
-
supported frameworks.
|
|
148
|
-
|
|
149
|
-
Repo config is authoritative: edit `zitadel.json` or files under `.zitadel/`,
|
|
150
|
-
then re-run `plan` and `apply`. Managed files carry a marker comment; `eject`
|
|
151
|
-
removes only files that still carry it, preserving anything the user replaced.
|
|
152
|
-
For app-local development, `--server local` resolves through
|
|
153
|
-
`.zitadel/local/runtime.json` and requires a healthy `npx @zitadel/cli@alpha start`
|
|
154
|
-
runtime. Runtime-only `.zitadel/local/**` state does not block fresh
|
|
155
|
-
same-directory scaffolding. `setup` installs dependencies with the detected
|
|
156
|
-
package manager by default; pass `--skip-install` when the agent or host
|
|
157
|
-
workflow will install dependencies separately.
|
package/dist/commands/apply.mjs
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
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
|
-
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"}
|