@zitadel/cli 0.1.0 → 0.3.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 +2219 -840
- package/dist/index.mjs +9497 -9715
- package/dist/index.mjs.map +1 -1
- package/dist/lib/oclif/help.mjs +66 -20
- package/dist/lib/oclif/help.mjs.map +1 -1
- package/dist/skills-hint-N1H5-ny1.mjs +4444 -0
- package/dist/skills-hint-N1H5-ny1.mjs.map +1 -0
- package/oclif.manifest.json +4221 -1311
- package/package.json +50 -18
- package/skills/zitadel-cli/SKILL.md +198 -58
- package/skills/zitadel-cli/references/driving-login-ui.md +50 -15
- package/dist/skills-hint-BSspFzhr.mjs +0 -173
- package/dist/skills-hint-BSspFzhr.mjs.map +0 -1
package/dist/lib/oclif/help.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { M as COMMAND_GROUPS, N as CommandGroups, P as compareInGroup, i as exploreAllCommands, t as showSkillsHint } from "../../skills-hint-N1H5-ny1.mjs";
|
|
2
2
|
import { Help, toConfiguredId, ux } from "@oclif/core";
|
|
3
3
|
//#region src/lib/oclif/help.ts
|
|
4
4
|
/**
|
|
@@ -8,31 +8,30 @@ import { Help, toConfiguredId, ux } from "@oclif/core";
|
|
|
8
8
|
const PLUGIN_SUMMARIES = { version: "Show the CLI version" };
|
|
9
9
|
/**
|
|
10
10
|
* Root help in the style of `gh --help`: a tagline, usage, the commands under
|
|
11
|
-
* headed groups
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* headed groups, then flags and examples. A family of commands (`users`,
|
|
12
|
+
* `release`) is one row, and its own help lists the operations. Only
|
|
13
|
+
* {@link showRootHelp} is replaced; per-command and per-topic help
|
|
14
|
+
* (`start --help`, `schemas --help`) stay oclif's own, with a pointer back to
|
|
15
|
+
* the root screen added. Wired in via `oclif.helpClass` in `package.json`.
|
|
15
16
|
*/
|
|
16
17
|
var ZitadelHelp = class extends Help {
|
|
17
18
|
async showRootHelp() {
|
|
18
19
|
const { bin } = this.config;
|
|
19
20
|
const commands = this.rootCommands();
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const additional = commands.filter((command) => command.group === void 0).sort((a, b) => a.id.localeCompare(b.id));
|
|
21
|
+
const groups = COMMAND_GROUPS.map((group) => [group, this.rowsOf(this.commandsOf(commands, group))]).filter(([, rows]) => rows.length > 0);
|
|
22
|
+
const width = Math.max(0, ...groups.flatMap(([, rows]) => rows.map((row) => row.name.length)));
|
|
23
|
+
const list = (rows) => rows.map((row) => `${row.name.padEnd(width)} ${row.summary}`).join("\n");
|
|
24
24
|
const sections = [
|
|
25
25
|
this.render(this.config.pjson.oclif.description ?? this.config.pjson.description ?? ""),
|
|
26
26
|
this.section("Usage", `${bin} <command> [flags]`),
|
|
27
|
-
|
|
28
|
-
...
|
|
27
|
+
`Run a command below. Use \`${bin} <command> --help\` to see its options.`,
|
|
28
|
+
...groups.map(([group, rows]) => this.section(group, list(rows))),
|
|
29
29
|
this.section("Flags", ["--help Show help for command", `--version Show ${bin} version`].join("\n")),
|
|
30
30
|
this.section("Examples", [
|
|
31
31
|
`$ ${bin} setup --framework next`,
|
|
32
32
|
`$ ${bin} start`,
|
|
33
33
|
`$ ${bin} doctor`
|
|
34
|
-
].join("\n"))
|
|
35
|
-
this.section("Learn more", `Use \`${bin} <command> --help\` for more information about a command.`)
|
|
34
|
+
].join("\n"))
|
|
36
35
|
];
|
|
37
36
|
if (process.argv.length <= 2) await showSkillsHint({
|
|
38
37
|
env: process.env,
|
|
@@ -40,6 +39,14 @@ var ZitadelHelp = class extends Help {
|
|
|
40
39
|
});
|
|
41
40
|
this.log(sections.join("\n\n"));
|
|
42
41
|
}
|
|
42
|
+
async showCommandHelp(command) {
|
|
43
|
+
await super.showCommandHelp(command);
|
|
44
|
+
this.log(exploreAllCommands(this.config.version));
|
|
45
|
+
}
|
|
46
|
+
async showTopicHelp(topic) {
|
|
47
|
+
await super.showTopicHelp(topic);
|
|
48
|
+
this.log(exploreAllCommands(this.config.version));
|
|
49
|
+
}
|
|
43
50
|
/**
|
|
44
51
|
* The commands the root screen lists: every visible command, grouped or
|
|
45
52
|
* not, whatever its depth. Alias entries and `help` itself are left out.
|
|
@@ -47,8 +54,50 @@ var ZitadelHelp = class extends Help {
|
|
|
47
54
|
rootCommands() {
|
|
48
55
|
return this.sortedCommands.filter((command) => command.id !== "help" && !command.aliases?.includes(command.id));
|
|
49
56
|
}
|
|
50
|
-
|
|
51
|
-
|
|
57
|
+
/**
|
|
58
|
+
* The commands a group lists. oclif's own utilities declare no group and are
|
|
59
|
+
* listed with the last one.
|
|
60
|
+
*/
|
|
61
|
+
commandsOf(commands, group) {
|
|
62
|
+
return commands.filter((command) => command.group === group || command.group === void 0 && group === CommandGroups.diagnostics);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The rows of one group. Commands sharing a first word (`users create`,
|
|
66
|
+
* `users get`) are one row named for it, described by the topic when it has
|
|
67
|
+
* a description and otherwise by the command of that name; a command on its
|
|
68
|
+
* own keeps its name. Rows follow `groupOrder` (the lowest of a family's
|
|
69
|
+
* commands), then the name.
|
|
70
|
+
*/
|
|
71
|
+
rowsOf(commands) {
|
|
72
|
+
const families = /* @__PURE__ */ new Map();
|
|
73
|
+
for (const command of commands) {
|
|
74
|
+
const [family = command.id] = command.id.split(":");
|
|
75
|
+
families.set(family, [...families.get(family) ?? [], command]);
|
|
76
|
+
}
|
|
77
|
+
return [...families].map(([family, members]) => {
|
|
78
|
+
const order = Math.min(...members.map((member) => member.groupOrder ?? Number.MAX_SAFE_INTEGER));
|
|
79
|
+
if (!members.some((member) => member.id.includes(":"))) {
|
|
80
|
+
const [only] = members;
|
|
81
|
+
return {
|
|
82
|
+
name: toConfiguredId(family, this.config),
|
|
83
|
+
summary: this.oneLineSummary(only?.summary ?? only?.description, only?.id),
|
|
84
|
+
order
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const topic = this.config.topics.find((candidate) => candidate.name === family);
|
|
88
|
+
const root = members.find((member) => member.id === family) ?? members[0];
|
|
89
|
+
return {
|
|
90
|
+
name: toConfiguredId(family, this.config),
|
|
91
|
+
summary: this.oneLineSummary(topic?.description ?? root?.summary ?? root?.description),
|
|
92
|
+
order
|
|
93
|
+
};
|
|
94
|
+
}).sort((a, b) => compareInGroup({
|
|
95
|
+
id: a.name,
|
|
96
|
+
groupOrder: a.order
|
|
97
|
+
}, {
|
|
98
|
+
id: b.name,
|
|
99
|
+
groupOrder: b.order
|
|
100
|
+
}));
|
|
52
101
|
}
|
|
53
102
|
/**
|
|
54
103
|
* The summary as `gh` prints it: the first clause of the summary or
|
|
@@ -56,15 +105,12 @@ var ZitadelHelp = class extends Help {
|
|
|
56
105
|
* than {@link summary} so a user theme's colour codes cannot end up inside
|
|
57
106
|
* the clause; the theme is applied once the text is final.
|
|
58
107
|
*/
|
|
59
|
-
oneLineSummary(
|
|
60
|
-
const source = PLUGIN_SUMMARIES[
|
|
108
|
+
oneLineSummary(text, id) {
|
|
109
|
+
const source = (id === void 0 ? void 0 : PLUGIN_SUMMARIES[id]) ?? text ?? "";
|
|
61
110
|
const [clause = ""] = this.render(source).split(/[.:]\s|\n/, 1);
|
|
62
111
|
return ux.colorize(this.config.theme?.commandSummary, clause.trim().replace(/\.$/, ""));
|
|
63
112
|
}
|
|
64
113
|
};
|
|
65
|
-
function byGroup(commands, group) {
|
|
66
|
-
return commands.filter((command) => command.group === group).sort(compareInGroup);
|
|
67
|
-
}
|
|
68
114
|
//#endregion
|
|
69
115
|
export { ZitadelHelp as default };
|
|
70
116
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.mjs","names":[],"sources":["../../../src/lib/oclif/help.ts"],"sourcesContent":["import { type Command, Help, toConfiguredId, ux } from \"@oclif/core\";\n\nimport { showSkillsHint } from \"../skills-hint\";\nimport {
|
|
1
|
+
{"version":3,"file":"help.mjs","names":[],"sources":["../../../src/lib/oclif/help.ts"],"sourcesContent":["import { type Command, Help, type Interfaces, toConfiguredId, ux } from \"@oclif/core\";\n\nimport { exploreAllCommands } from \"../journey-guidance\";\nimport { showSkillsHint } from \"../skills-hint\";\nimport { COMMAND_GROUPS, type CommandGroup, CommandGroups, compareInGroup } from \"./groups\";\n\n/** A loaded command plus the root-help statics `BaseCommand` (`./base`) declares. */\ntype GroupedCommand = Command.Loadable & { group?: CommandGroup; groupOrder?: number };\n\n/** One line of the root screen: a command, or a family of commands under one name. */\ntype Row = { name: string; summary: string; order: number };\n\n/**\n * Summaries for oclif plugin commands that ship without one. `version` prints\n * a blank line otherwise.\n */\nconst PLUGIN_SUMMARIES: Readonly<Record<string, string>> = {\n version: \"Show the CLI version\",\n};\n\n/**\n * Root help in the style of `gh --help`: a tagline, usage, the commands under\n * headed groups, then flags and examples. A family of commands (`users`,\n * `release`) is one row, and its own help lists the operations. Only\n * {@link showRootHelp} is replaced; per-command and per-topic help\n * (`start --help`, `schemas --help`) stay oclif's own, with a pointer back to\n * the root screen added. Wired in via `oclif.helpClass` in `package.json`.\n */\nexport default class ZitadelHelp extends Help {\n protected override async showRootHelp(): Promise<void> {\n const { bin } = this.config;\n const commands = this.rootCommands();\n const groups = COMMAND_GROUPS.map(\n (group) => [group, this.rowsOf(this.commandsOf(commands, group))] as const,\n ).filter(([, rows]) => rows.length > 0);\n const width = Math.max(0, ...groups.flatMap(([, rows]) => rows.map((row) => row.name.length)));\n const list = (rows: readonly Row[]): string =>\n rows.map((row) => `${row.name.padEnd(width)} ${row.summary}`).join(\"\\n\");\n\n const sections = [\n this.render(this.config.pjson.oclif.description ?? this.config.pjson.description ?? \"\"),\n this.section(\"Usage\", `${bin} <command> [flags]`),\n `Run a command below. Use \\`${bin} <command> --help\\` to see its options.`,\n ...groups.map(([group, rows]) => this.section(group, list(rows))),\n this.section(\n \"Flags\",\n [\"--help Show help for command\", `--version Show ${bin} version`].join(\"\\n\"),\n ),\n this.section(\n \"Examples\",\n [`$ ${bin} setup --framework next`, `$ ${bin} start`, `$ ${bin} doctor`].join(\"\\n\"),\n ),\n ];\n // Only a bare `zitadel`, not `zitadel --help` or an unknown command's help.\n if (process.argv.length <= 2) {\n await showSkillsHint({\n env: process.env,\n interactive: Boolean(process.stdout.isTTY && process.stdin.isTTY),\n });\n }\n this.log(sections.join(\"\\n\\n\"));\n }\n\n override async showCommandHelp(command: Command.Loadable): Promise<void> {\n await super.showCommandHelp(command);\n this.log(exploreAllCommands(this.config.version));\n }\n\n override async showTopicHelp(topic: Interfaces.Topic): Promise<void> {\n await super.showTopicHelp(topic);\n this.log(exploreAllCommands(this.config.version));\n }\n\n /**\n * The commands the root screen lists: every visible command, grouped or\n * not, whatever its depth. Alias entries and `help` itself are left out.\n */\n private rootCommands(): GroupedCommand[] {\n return (this.sortedCommands as GroupedCommand[]).filter(\n (command) => command.id !== \"help\" && !command.aliases?.includes(command.id),\n );\n }\n\n /**\n * The commands a group lists. oclif's own utilities declare no group and are\n * listed with the last one.\n */\n private commandsOf(commands: readonly GroupedCommand[], group: CommandGroup): GroupedCommand[] {\n return commands.filter(\n (command) =>\n command.group === group ||\n (command.group === undefined && group === CommandGroups.diagnostics),\n );\n }\n\n /**\n * The rows of one group. Commands sharing a first word (`users create`,\n * `users get`) are one row named for it, described by the topic when it has\n * a description and otherwise by the command of that name; a command on its\n * own keeps its name. Rows follow `groupOrder` (the lowest of a family's\n * commands), then the name.\n */\n private rowsOf(commands: readonly GroupedCommand[]): Row[] {\n const families = new Map<string, GroupedCommand[]>();\n for (const command of commands) {\n const [family = command.id] = command.id.split(\":\");\n families.set(family, [...(families.get(family) ?? []), command]);\n }\n const rows = [...families].map(([family, members]): Row => {\n const order = Math.min(\n ...members.map((member) => member.groupOrder ?? Number.MAX_SAFE_INTEGER),\n );\n const isFamily = members.some((member) => member.id.includes(\":\"));\n if (!isFamily) {\n const [only] = members;\n return {\n name: toConfiguredId(family, this.config),\n summary: this.oneLineSummary(only?.summary ?? only?.description, only?.id),\n order,\n };\n }\n const topic = this.config.topics.find((candidate) => candidate.name === family);\n const root = members.find((member) => member.id === family) ?? members[0];\n return {\n name: toConfiguredId(family, this.config),\n summary: this.oneLineSummary(topic?.description ?? root?.summary ?? root?.description),\n order,\n };\n });\n return rows.sort((a, b) =>\n compareInGroup({ id: a.name, groupOrder: a.order }, { id: b.name, groupOrder: b.order }),\n );\n }\n\n /**\n * The summary as `gh` prints it: the first clause of the summary or\n * description, with no trailing full stop. Built from the raw statics rather\n * than {@link summary} so a user theme's colour codes cannot end up inside\n * the clause; the theme is applied once the text is final.\n */\n private oneLineSummary(text: string | undefined, id?: string): string {\n const source = (id === undefined ? undefined : PLUGIN_SUMMARIES[id]) ?? text ?? \"\";\n const [clause = \"\"] = this.render(source).split(/[.:]\\s|\\n/, 1);\n return ux.colorize(this.config.theme?.commandSummary, clause.trim().replace(/\\.$/, \"\"));\n }\n}\n"],"mappings":";;;;;;;AAgBA,MAAM,mBAAqD,EACzD,SAAS,uBACX;;;;;;;;;AAUA,IAAqB,cAArB,cAAyC,KAAK;CAC5C,MAAyB,eAA8B;EACrD,MAAM,EAAE,QAAQ,KAAK;EACrB,MAAM,WAAW,KAAK,aAAa;EACnC,MAAM,SAAS,eAAe,KAC3B,UAAU,CAAC,OAAO,KAAK,OAAO,KAAK,WAAW,UAAU,KAAK,CAAC,CAAC,CAClE,CAAC,CAAC,QAAQ,GAAG,UAAU,KAAK,SAAS,CAAC;EACtC,MAAM,QAAQ,KAAK,IAAI,GAAG,GAAG,OAAO,SAAS,GAAG,UAAU,KAAK,KAAK,QAAQ,IAAI,KAAK,MAAM,CAAC,CAAC;EAC7F,MAAM,QAAQ,SACZ,KAAK,KAAK,QAAQ,GAAG,IAAI,KAAK,OAAO,KAAK,EAAE,IAAI,IAAI,SAAS,CAAC,CAAC,KAAK,IAAI;EAE1E,MAAM,WAAW;GACf,KAAK,OAAO,KAAK,OAAO,MAAM,MAAM,eAAe,KAAK,O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