@visulima/cerebro 3.0.0-alpha.13 → 3.0.0-alpha.15
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/CHANGELOG.md +25 -0
- package/LICENSE.md +92 -91
- package/dist/commands/completion-command.d.ts +1 -1
- package/dist/commands/completion-command.js +5 -204
- package/dist/commands/help-command.d.ts +1 -1
- package/dist/commands/help-command.js +1 -262
- package/dist/commands/readme-command.d.ts +1 -1
- package/dist/commands/readme-command.js +32 -317
- package/dist/commands/version-command.d.ts +1 -1
- package/dist/commands/version-command.js +1 -18
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -8
- package/dist/logger/create-pail-logger.js +1 -34
- package/dist/packem_chunks/has-new-version.js +1 -264
- package/dist/packem_shared/Cerebro-Cnr7AGMP.js +4 -0
- package/dist/packem_shared/VERBOSITY_QUIET-XPultrIA.js +1 -0
- package/dist/packem_shared/VisulimaError-Bh91XNXu.js +76 -0
- package/dist/packem_shared/cerebro-error-BnJTixb2.js +1 -0
- package/dist/packem_shared/index-B0BiusY7.js +6 -0
- package/dist/packem_shared/isVisulimaError-jVZgumOU-C4fgdbWg.js +1 -0
- package/dist/packem_shared/lazyNamed-DOmefeJM.js +1 -0
- package/dist/packem_shared/{plugin-manager.d-Du-YXFui.d.ts → plugin-manager.d-Dz-wu1tI.d.ts} +3 -0
- package/dist/packem_shared/renderError-B_XyYPKJ-B65kP-Ou.js +24 -0
- package/dist/packem_shared/runtime-process-DKHFvYkv.js +1 -0
- package/dist/plugins/error-handler-plugin.d.ts +1 -1
- package/dist/plugins/error-handler-plugin.js +1 -648
- package/dist/plugins/runtime-version-check-plugin.d.ts +1 -1
- package/dist/plugins/runtime-version-check-plugin.js +1 -77
- package/dist/plugins/update-notifier/update-notifier-plugin.d.ts +1 -1
- package/dist/plugins/update-notifier/update-notifier-plugin.js +1 -517
- package/dist/util/general/compile-cache.js +1 -16
- package/dist/util/general/heap-tuning.js +1 -91
- package/package.json +23 -23
- package/dist/packem_shared/Cerebro-C1h3DXwy.js +0 -3509
- package/dist/packem_shared/VERBOSITY_QUIET-Dp46zlLW.js +0 -10
- package/dist/packem_shared/VisulimaError-DA7QsCxH.js +0 -34
- package/dist/packem_shared/cerebro-error-GmJ3jN7Q.js +0 -16
- package/dist/packem_shared/index--1UArng3.js +0 -267
- package/dist/packem_shared/lazyNamed-B278Tf9_.js +0 -6
- package/dist/packem_shared/runtime-process-B6ZplyWn.js +0 -187
|
@@ -1,262 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { t as templateFormat, c as commandLineUsage } from '../packem_shared/index--1UArng3.js';
|
|
3
|
-
|
|
4
|
-
const defaultEnv = [
|
|
5
|
-
{
|
|
6
|
-
defaultValue: "32",
|
|
7
|
-
description: "Controls the verbosity level of output. Valid values: '16' (quiet), '32' (normal), '64' (verbose), '128' (debug)",
|
|
8
|
-
name: "CEREBRO_OUTPUT_LEVEL",
|
|
9
|
-
type: String
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
description: "Sets the minimum required Node.js version. Overrides the default minimum version check",
|
|
13
|
-
name: "CEREBRO_MIN_NODE_VERSION",
|
|
14
|
-
type: Number
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
defaultValue: false,
|
|
18
|
-
description: "When set, disables the update notifier check",
|
|
19
|
-
name: "NO_UPDATE_NOTIFIER",
|
|
20
|
-
type: Boolean
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
description: "Standard Node.js environment variable. When set to 'test', disables update notifier",
|
|
24
|
-
name: "NODE_ENV",
|
|
25
|
-
type: String
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
defaultValue: false,
|
|
29
|
-
description: "When set, enables debug output (same as --debug flag)",
|
|
30
|
-
name: "DEBUG",
|
|
31
|
-
type: Boolean
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
description: "Sets the terminal width for table rendering. Useful for testing and consistent output",
|
|
35
|
-
name: "CEREBRO_TERMINAL_WIDTH",
|
|
36
|
-
type: Number
|
|
37
|
-
}
|
|
38
|
-
];
|
|
39
|
-
|
|
40
|
-
const EMPTY_GROUP_KEY = "__Other";
|
|
41
|
-
const upperFirstChar = (string_) => string_.charAt(0).toUpperCase() + string_.slice(1);
|
|
42
|
-
const printGeneralHelp = (logger, runtime, commands, groupOption) => {
|
|
43
|
-
logger.debug("no command given, printing general help...");
|
|
44
|
-
let filteredCommands = [...new Set(commands.values())].filter((command) => !command.hidden);
|
|
45
|
-
if (groupOption) {
|
|
46
|
-
filteredCommands = filteredCommands.filter((command) => command.group === groupOption);
|
|
47
|
-
}
|
|
48
|
-
const groupedCommands = filteredCommands.reduce((accumulator, command) => {
|
|
49
|
-
const group = command.group ?? EMPTY_GROUP_KEY;
|
|
50
|
-
accumulator[group] ??= [];
|
|
51
|
-
accumulator[group].push(command);
|
|
52
|
-
return accumulator;
|
|
53
|
-
}, {});
|
|
54
|
-
const buildCommandList = (commandList) => commandList.map((command) => {
|
|
55
|
-
let aliases = "";
|
|
56
|
-
if (typeof command.alias === "string") {
|
|
57
|
-
aliases = command.alias;
|
|
58
|
-
} else if (Array.isArray(command.alias)) {
|
|
59
|
-
aliases = command.alias.join(", ");
|
|
60
|
-
}
|
|
61
|
-
if (aliases !== "") {
|
|
62
|
-
aliases = ` [${aliases}]`;
|
|
63
|
-
}
|
|
64
|
-
let commandDisplay = command.name;
|
|
65
|
-
if (command.commandPath && command.commandPath.length > 0) {
|
|
66
|
-
commandDisplay = `${command.commandPath.join(" ")} ${command.name}`;
|
|
67
|
-
}
|
|
68
|
-
return [`${green(commandDisplay)}${aliases}`, command.description ?? ""];
|
|
69
|
-
});
|
|
70
|
-
(logger.raw ?? logger.log)(
|
|
71
|
-
commandLineUsage(
|
|
72
|
-
[
|
|
73
|
-
{
|
|
74
|
-
content: `${cyan(runtime.getCliName())} ${green("<command>")} [positional arguments] ${yellow("[options]")}`,
|
|
75
|
-
header: inverse.cyan(" Usage ")
|
|
76
|
-
},
|
|
77
|
-
...Object.keys(groupedCommands).map((key) => {
|
|
78
|
-
const groupOptionName = groupOption ? ` ${upperFirstChar(groupOption)}` : "";
|
|
79
|
-
return {
|
|
80
|
-
content: buildCommandList(groupedCommands[key]),
|
|
81
|
-
header: key === EMPTY_GROUP_KEY || groupOption ? inverse.green(` Available${groupOptionName} Commands `) : ` ${inverse.green(` ${upperFirstChar(key)} `)}`
|
|
82
|
-
};
|
|
83
|
-
}),
|
|
84
|
-
commands.has("help") ? {
|
|
85
|
-
header: inverse.yellow(" Command Options "),
|
|
86
|
-
optionList: commands.get("help").options?.filter((option) => !option.hidden)
|
|
87
|
-
} : void 0,
|
|
88
|
-
{ header: inverse.yellow(" Global Options "), optionList: runtime.getGlobalOptions() },
|
|
89
|
-
{
|
|
90
|
-
content: defaultEnv.filter((envVariable) => !envVariable.hidden).map((envVariable) => [envVariable.name, envVariable.description ?? ""]),
|
|
91
|
-
header: inverse.magenta(" Environment Variables ")
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
content: `Run "${cyan(runtime.getCliName())} ${green("help <command>")}" or "${cyan(runtime.getCliName())} ${green("<command>")} ${yellow("--help")}" for help with a specific command.`,
|
|
95
|
-
raw: true
|
|
96
|
-
}
|
|
97
|
-
].filter(Boolean)
|
|
98
|
-
)
|
|
99
|
-
);
|
|
100
|
-
};
|
|
101
|
-
const findChildren = (commands, parentPath) => {
|
|
102
|
-
const matches = [];
|
|
103
|
-
for (const cmd of commands.values()) {
|
|
104
|
-
if (cmd.hidden) {
|
|
105
|
-
continue;
|
|
106
|
-
}
|
|
107
|
-
const commandPath = cmd.commandPath ?? [];
|
|
108
|
-
if (commandPath.length !== parentPath.length) {
|
|
109
|
-
continue;
|
|
110
|
-
}
|
|
111
|
-
let isMatch = true;
|
|
112
|
-
for (let index = 0; index < parentPath.length; index += 1) {
|
|
113
|
-
if (commandPath[index] !== parentPath[index]) {
|
|
114
|
-
isMatch = false;
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
if (isMatch) {
|
|
119
|
-
matches.push(cmd);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
return matches;
|
|
123
|
-
};
|
|
124
|
-
const printParentHelp = (logger, runtime, parentPath, children) => {
|
|
125
|
-
const parentDisplay = parentPath.join(" ");
|
|
126
|
-
const usageGroups = [
|
|
127
|
-
{
|
|
128
|
-
content: `${cyan(runtime.getCliName())} ${green(parentDisplay)} ${green("<subcommand>")} [positional arguments] ${yellow("[options]")}`,
|
|
129
|
-
header: inverse.cyan(" Usage ")
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
content: children.map((child) => {
|
|
133
|
-
const fullPath = [...child.commandPath ?? [], child.name].join(" ");
|
|
134
|
-
return [green(fullPath), child.description ?? ""];
|
|
135
|
-
}),
|
|
136
|
-
header: inverse.green(" Subcommands ")
|
|
137
|
-
},
|
|
138
|
-
{ header: inverse.yellow(" Global Options "), optionList: runtime.getGlobalOptions() },
|
|
139
|
-
{
|
|
140
|
-
content: `Run "${cyan(runtime.getCliName())} ${green(`${parentDisplay} <subcommand>`)} ${yellow("--help")}" for help with a specific subcommand.`,
|
|
141
|
-
raw: true
|
|
142
|
-
}
|
|
143
|
-
];
|
|
144
|
-
(logger.raw ?? logger.log)(commandLineUsage(usageGroups));
|
|
145
|
-
};
|
|
146
|
-
const printCommandHelp = (logger, runtime, commands, name) => {
|
|
147
|
-
let command = commands.get(name);
|
|
148
|
-
if (!command) {
|
|
149
|
-
for (const cmd of commands.values()) {
|
|
150
|
-
const fullPath = cmd.commandPath ? [...cmd.commandPath, cmd.name] : [cmd.name];
|
|
151
|
-
if (fullPath.at(-1) === name || fullPath.join(" ") === name) {
|
|
152
|
-
command = cmd;
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
if (!command) {
|
|
158
|
-
const parentPath = name.split(" ").filter(Boolean);
|
|
159
|
-
const children = parentPath.length > 0 ? findChildren(commands, parentPath) : [];
|
|
160
|
-
if (children.length > 0) {
|
|
161
|
-
printParentHelp(logger, runtime, parentPath, children);
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
logger.error(`Command "${name}" not found`);
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
const usageGroups = [];
|
|
168
|
-
const fullCommandPath = command.commandPath ? [...command.commandPath, command.name] : [command.name];
|
|
169
|
-
const commandDisplay = fullCommandPath.join(" ");
|
|
170
|
-
usageGroups.push({
|
|
171
|
-
content: `${cyan(runtime.getCliName())} ${green(commandDisplay)}${command.argument ? " [positional arguments]" : ""}${command.options ? " [options]" : ""}`,
|
|
172
|
-
header: inverse.cyan(" Usage ")
|
|
173
|
-
});
|
|
174
|
-
if (command.description) {
|
|
175
|
-
usageGroups.push({ content: command.description, header: inverse.green(" Description ") });
|
|
176
|
-
}
|
|
177
|
-
if (command.argument) {
|
|
178
|
-
usageGroups.push({ header: "Command Positional Arguments", isArgument: true, optionList: [command.argument] });
|
|
179
|
-
}
|
|
180
|
-
if (Array.isArray(command.options) && command.options.length > 0) {
|
|
181
|
-
usageGroups.push({
|
|
182
|
-
header: inverse.yellow(" Command Options "),
|
|
183
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
184
|
-
optionList: command.options.filter((option) => !option.hidden)
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
usageGroups.push({ header: inverse.yellow(" Global Options "), optionList: runtime.getGlobalOptions() });
|
|
188
|
-
if (Array.isArray(command.env) && command.env.length > 0) {
|
|
189
|
-
const visibleEnvVariables = command.env.filter((envVariable) => !envVariable.hidden);
|
|
190
|
-
if (visibleEnvVariables.length > 0) {
|
|
191
|
-
usageGroups.push({
|
|
192
|
-
content: visibleEnvVariables.map((envVariable) => [envVariable.name, envVariable.description ?? ""]),
|
|
193
|
-
header: inverse.magenta(" Environment Variables ")
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
if (command.alias !== void 0 && command.alias.length > 0) {
|
|
198
|
-
let alias = command.alias;
|
|
199
|
-
if (typeof command.alias === "string") {
|
|
200
|
-
alias = [command.alias];
|
|
201
|
-
}
|
|
202
|
-
usageGroups.splice(1, 0, {
|
|
203
|
-
content: alias,
|
|
204
|
-
header: "Alias(es)"
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
if (Array.isArray(command.examples) && command.examples.length > 0) {
|
|
208
|
-
usageGroups.push({
|
|
209
|
-
content: command.examples,
|
|
210
|
-
header: "Examples"
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
const ownPath = [...command.commandPath ?? [], command.name];
|
|
214
|
-
const ownChildren = findChildren(commands, ownPath);
|
|
215
|
-
if (ownChildren.length > 0) {
|
|
216
|
-
usageGroups.push({
|
|
217
|
-
content: ownChildren.map((child) => {
|
|
218
|
-
const fullPath = [...child.commandPath ?? [], child.name].join(" ");
|
|
219
|
-
return [green(fullPath), child.description ?? ""];
|
|
220
|
-
}),
|
|
221
|
-
header: inverse.green(" Subcommands ")
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
(logger.raw ?? logger.log)(commandLineUsage(usageGroups));
|
|
225
|
-
};
|
|
226
|
-
class HelpCommand {
|
|
227
|
-
name = "help";
|
|
228
|
-
options = [
|
|
229
|
-
{
|
|
230
|
-
description: "Display only the specified group",
|
|
231
|
-
name: "group",
|
|
232
|
-
type: String
|
|
233
|
-
}
|
|
234
|
-
];
|
|
235
|
-
commands;
|
|
236
|
-
constructor(commands) {
|
|
237
|
-
this.commands = commands;
|
|
238
|
-
}
|
|
239
|
-
execute(toolbox) {
|
|
240
|
-
const { commandName, logger, options, runtime } = toolbox;
|
|
241
|
-
const { footer, header } = runtime.getCommandSection();
|
|
242
|
-
if (header) {
|
|
243
|
-
(logger.raw ?? logger.log)(templateFormat(header));
|
|
244
|
-
}
|
|
245
|
-
if (commandName === "help") {
|
|
246
|
-
printGeneralHelp(
|
|
247
|
-
logger,
|
|
248
|
-
runtime,
|
|
249
|
-
this.commands,
|
|
250
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- options may be undefined at runtime
|
|
251
|
-
typeof options?.group === "string" ? options.group : void 0
|
|
252
|
-
);
|
|
253
|
-
} else {
|
|
254
|
-
printCommandHelp(logger, runtime, this.commands, commandName);
|
|
255
|
-
}
|
|
256
|
-
if (footer) {
|
|
257
|
-
(logger.raw ?? logger.log)(templateFormat(footer));
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
export { HelpCommand as default };
|
|
1
|
+
var O=Object.defineProperty;var f=(r,a)=>O(r,"name",{value:a,configurable:!0});import{green as c,inverse as p,cyan as u,yellow as g}from"@visulima/colorize";import{f as y,p as b}from"../packem_shared/index-B0BiusY7.js";const E=[{defaultValue:"32",description:"Controls the verbosity level of output. Valid values: '16' (quiet), '32' (normal), '64' (verbose), '128' (debug)",name:"CEREBRO_OUTPUT_LEVEL",type:String},{description:"Sets the minimum required Node.js version. Overrides the default minimum version check",name:"CEREBRO_MIN_NODE_VERSION",type:Number},{defaultValue:!1,description:"When set, disables the update notifier check",name:"NO_UPDATE_NOTIFIER",type:Boolean},{description:"Standard Node.js environment variable. When set to 'test', disables update notifier",name:"NODE_ENV",type:String},{defaultValue:!1,description:"When set, enables debug output (same as --debug flag)",name:"DEBUG",type:Boolean},{description:"Sets the terminal width for table rendering. Useful for testing and consistent output",name:"CEREBRO_TERMINAL_WIDTH",type:Number}];var N=Object.defineProperty,h=f((r,a)=>N(r,"name",{value:a,configurable:!0}),"h");const $="__Other",v=h(r=>r.charAt(0).toUpperCase()+r.slice(1),"upperFirstChar"),w=h((r,a,l,o)=>{r.debug("no command given, printing general help...");let e=[...new Set(l.values())].filter(t=>!t.hidden);o&&(e=e.filter(t=>t.group===o));const i=e.reduce((t,s)=>{const n=s.group??$;return t[n]??=[],t[n].push(s),t},{}),d=h(t=>t.map(s=>{let n="";typeof s.alias=="string"?n=s.alias:Array.isArray(s.alias)&&(n=s.alias.join(", ")),n!==""&&(n=` [${n}]`);let m=s.name;return s.commandPath&&s.commandPath.length>0&&(m=`${s.commandPath.join(" ")} ${s.name}`),[`${c(m)}${n}`,s.description??""]}),"buildCommandList");(r.raw??r.log)(b([{content:`${u(a.getCliName())} ${c("<command>")} [positional arguments] ${g("[options]")}`,header:p.cyan(" Usage ")},...Object.keys(i).map(t=>{const s=o?` ${v(o)}`:"";return{content:d(i[t]),header:t===$||o?p.green(` Available${s} Commands `):` ${p.green(` ${v(t)} `)}`}}),l.has("help")?{header:p.yellow(" Command Options "),optionList:l.get("help").options?.filter(t=>!t.hidden)}:void 0,{header:p.yellow(" Global Options "),optionList:a.getGlobalOptions()},{content:E.filter(t=>!t.hidden).map(t=>[t.name,t.description??""]),header:p.magenta(" Environment Variables ")},{content:`Run "${u(a.getCliName())} ${c("help <command>")}" or "${u(a.getCliName())} ${c("<command>")} ${g("--help")}" for help with a specific command.`,raw:!0}].filter(Boolean)))},"printGeneralHelp"),C=h((r,a)=>{const l=[];for(const o of r.values()){if(o.hidden)continue;const e=o.commandPath??[];if(e.length!==a.length)continue;let i=!0;for(const[d,t]of a.entries())if(e[d]!==t){i=!1;break}i&&l.push(o)}return l},"findChildren"),P=h((r,a,l,o)=>{const e=l.join(" "),i=[{content:`${u(a.getCliName())} ${c(e)} ${c("<subcommand>")} [positional arguments] ${g("[options]")}`,header:p.cyan(" Usage ")},{content:o.map(d=>{const t=[...d.commandPath??[],d.name].join(" ");return[c(t),d.description??""]}),header:p.green(" Subcommands ")},{header:p.yellow(" Global Options "),optionList:a.getGlobalOptions()},{content:`Run "${u(a.getCliName())} ${c(`${e} <subcommand>`)} ${g("--help")}" for help with a specific subcommand.`,raw:!0}];(r.raw??r.log)(b(i))},"printParentHelp"),A=h((r,a,l,o)=>{let e=l.get(o);if(!e)for(const n of l.values()){const m=n.commandPath?[...n.commandPath,n.name]:[n.name];if(m.at(-1)===o||m.join(" ")===o){e=n;break}}if(!e){const n=o.split(" ").filter(Boolean),m=n.length>0?C(l,n):[];if(m.length>0){P(r,a,n,m);return}r.error(`Command "${o}" not found`);return}const i=[],d=(e.commandPath?[...e.commandPath,e.name]:[e.name]).join(" ");if(i.push({content:`${u(a.getCliName())} ${c(d)}${e.argument?" [positional arguments]":""}${e.options?" [options]":""}`,header:p.cyan(" Usage ")}),e.description&&i.push({content:e.description,header:p.green(" Description ")}),e.argument&&i.push({header:"Command Positional Arguments",isArgument:!0,optionList:[e.argument]}),Array.isArray(e.options)&&e.options.length>0&&i.push({header:p.yellow(" Command Options "),optionList:e.options.filter(n=>!n.hidden)}),i.push({header:p.yellow(" Global Options "),optionList:a.getGlobalOptions()}),Array.isArray(e.env)&&e.env.length>0){const n=e.env.filter(m=>!m.hidden);n.length>0&&i.push({content:n.map(m=>[m.name,m.description??""]),header:p.magenta(" Environment Variables ")})}if(e.alias!==void 0&&e.alias.length>0){let n=e.alias;typeof e.alias=="string"&&(n=[e.alias]),i.splice(1,0,{content:n,header:"Alias(es)"})}Array.isArray(e.examples)&&e.examples.length>0&&i.push({content:e.examples,header:"Examples"});const t=[...e.commandPath??[],e.name],s=C(l,t);s.length>0&&i.push({content:s.map(n=>{const m=[...n.commandPath??[],n.name].join(" ");return[c(m),n.description??""]}),header:p.green(" Subcommands ")}),(r.raw??r.log)(b(i))},"printCommandHelp");class S{static{f(this,"x")}static{h(this,"HelpCommand")}name="help";options=[{description:"Display only the specified group",name:"group",type:String}];commands;constructor(a){this.commands=a}execute(a){const{commandName:l,logger:o,options:e,runtime:i}=a,{footer:d,header:t}=i.getCommandSection();t&&(o.raw??o.log)(y(t)),l==="help"?w(o,i,this.commands,typeof e?.group=="string"?e.group:void 0):A(o,i,this.commands,l),d&&(o.raw??o.log)(y(d))}}export{S as default};
|
|
@@ -1,252 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (typeof __cjs_getProcess !== "undefined" && __cjs_getProcess.versions && __cjs_getProcess.versions.node) {
|
|
10
|
-
const [major, minor] = __cjs_getProcess.versions.node.split(".").map(Number);
|
|
11
|
-
// Node.js 20.16.0+ and 22.3.0+
|
|
12
|
-
if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
|
|
13
|
-
return __cjs_getProcess.getBuiltinModule(module);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
// Fallback to createRequire
|
|
17
|
-
return __cjs_require(module);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const {
|
|
21
|
-
existsSync
|
|
22
|
-
} = __cjs_getBuiltinModule("node:fs");
|
|
23
|
-
const {
|
|
24
|
-
readFile,
|
|
25
|
-
mkdir,
|
|
26
|
-
writeFile
|
|
27
|
-
} = __cjs_getBuiltinModule("node:fs/promises");
|
|
28
|
-
const {
|
|
29
|
-
resolve,
|
|
30
|
-
join,
|
|
31
|
-
dirname
|
|
32
|
-
} = __cjs_getBuiltinModule("node:path");
|
|
33
|
-
import GithubSlugger from 'github-slugger';
|
|
34
|
-
import { c as commandLineUsage } from '../packem_shared/index--1UArng3.js';
|
|
35
|
-
import { g as getCwd, a as getVersions, b as getPlatform, c as getArch } from '../packem_shared/runtime-process-B6ZplyWn.js';
|
|
36
|
-
|
|
37
|
-
const slugger = new GithubSlugger();
|
|
38
|
-
const slugify = (text) => slugger.slug(text);
|
|
39
|
-
const compact = (array) => array.filter(Boolean);
|
|
40
|
-
const uniqBy = (array, keyFunction) => {
|
|
41
|
-
const seen = /* @__PURE__ */ new Set();
|
|
42
|
-
const result = [];
|
|
43
|
-
for (const item of array) {
|
|
44
|
-
const key = keyFunction(item);
|
|
45
|
-
if (!seen.has(key)) {
|
|
46
|
-
seen.add(key);
|
|
47
|
-
result.push(item);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return result;
|
|
51
|
-
};
|
|
52
|
-
const formatCommandUsage = (command, cliName) => {
|
|
53
|
-
const fullPath = command.commandPath ? [...command.commandPath, command.name] : [command.name];
|
|
54
|
-
const commandId = fullPath.join(" ");
|
|
55
|
-
if (command.argument) {
|
|
56
|
-
const argumentName = command.argument.name.toUpperCase();
|
|
57
|
-
const argumentString = command.argument.required ? argumentName : `[${argumentName}]`;
|
|
58
|
-
return `${cliName} ${commandId} ${argumentString}`;
|
|
59
|
-
}
|
|
60
|
-
return `${cliName} ${commandId}`;
|
|
61
|
-
};
|
|
62
|
-
const addEnvironmentVariables = (command, usageGroups) => {
|
|
63
|
-
if (!Array.isArray(command.env) || command.env.length === 0) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const visibleEnvVariables = command.env.filter((envVariable) => !envVariable.hidden);
|
|
67
|
-
if (visibleEnvVariables.length > 0) {
|
|
68
|
-
usageGroups.push({
|
|
69
|
-
content: visibleEnvVariables.map((envVariable) => [envVariable.name, envVariable.description ?? ""]),
|
|
70
|
-
header: " Environment Variables "
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
const formatCommandHelp = (command, cliName) => {
|
|
75
|
-
const usageGroups = [];
|
|
76
|
-
const fullCommandPath = command.commandPath ? [...command.commandPath, command.name] : [command.name];
|
|
77
|
-
const commandDisplay = fullCommandPath.join(" ");
|
|
78
|
-
const hasArgument = Boolean(command.argument);
|
|
79
|
-
const hasOptions = Boolean(command.options);
|
|
80
|
-
usageGroups.push({
|
|
81
|
-
content: `${cliName} ${commandDisplay}${hasArgument ? " [positional arguments]" : ""}${hasOptions ? " [options]" : ""}`,
|
|
82
|
-
header: " Usage "
|
|
83
|
-
});
|
|
84
|
-
if (command.description) {
|
|
85
|
-
usageGroups.push({ content: command.description, header: " Description " });
|
|
86
|
-
}
|
|
87
|
-
if (command.argument) {
|
|
88
|
-
usageGroups.push({ header: "Command Positional Arguments", isArgument: true, optionList: [command.argument] });
|
|
89
|
-
}
|
|
90
|
-
if (Array.isArray(command.options) && command.options.length > 0) {
|
|
91
|
-
usageGroups.push({
|
|
92
|
-
header: " Command Options ",
|
|
93
|
-
optionList: command.options.filter((option) => !option.hidden)
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
addEnvironmentVariables(command, usageGroups);
|
|
97
|
-
if (command.alias !== void 0 && command.alias.length > 0) {
|
|
98
|
-
const alias = Array.isArray(command.alias) ? command.alias : [command.alias];
|
|
99
|
-
usageGroups.splice(1, 0, {
|
|
100
|
-
content: alias,
|
|
101
|
-
header: "Alias(es)"
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
if (Array.isArray(command.examples) && command.examples.length > 0) {
|
|
105
|
-
usageGroups.push({
|
|
106
|
-
content: command.examples,
|
|
107
|
-
header: "Examples"
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
return commandLineUsage(usageGroups);
|
|
111
|
-
};
|
|
112
|
-
const renderCommand = (command, cliName) => {
|
|
113
|
-
const title = command.description?.trim().split("\n")[0] ?? "";
|
|
114
|
-
const usage = formatCommandUsage(command, cliName);
|
|
115
|
-
const helpText = formatCommandHelp(command, cliName);
|
|
116
|
-
return compact([`## \`${usage}\``, title, `\`\`\`
|
|
117
|
-
${helpText.trim()}
|
|
118
|
-
\`\`\``]).join("\n\n");
|
|
119
|
-
};
|
|
120
|
-
const generateUsage = (cliName, packageName, version, nodeVersion) => {
|
|
121
|
-
const versionFlags = ["--version", "-V"];
|
|
122
|
-
const versionFlagsString = `(${versionFlags.join("|")})`;
|
|
123
|
-
const platform = getPlatform();
|
|
124
|
-
const arch = getArch();
|
|
125
|
-
return `\`\`\`sh-session
|
|
126
|
-
$ npm install -g ${packageName}
|
|
127
|
-
$ ${cliName} COMMAND
|
|
1
|
+
var O=Object.defineProperty;var f=(e,t)=>O(e,"name",{value:t,configurable:!0});import{createRequire as L}from"node:module";import U from"github-slugger";import{p as G}from"../packem_shared/index-B0BiusY7.js";import{g as F,a as M,b as W,c as z}from"../packem_shared/runtime-process-DKHFvYkv.js";const N=L(import.meta.url),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,A=f(e=>{if(typeof g<"u"&&g.versions&&g.versions.node){const[t,n]=g.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return g.getBuiltinModule(e)}return N(e)},"__cjs_getBuiltinModule"),{existsSync:v}=A("node:fs"),{readFile:T,mkdir:k,writeFile:B}=A("node:fs/promises"),{resolve:P,join:V,dirname:q}=A("node:path");var H=Object.defineProperty,c=f((e,t)=>H(e,"name",{value:t,configurable:!0}),"m");const I=new U,C=c(e=>I.slug(e),"slugify"),J=c(e=>e.filter(Boolean),"compact"),K=c((e,t)=>{const n=new Set,o=[];for(const r of e){const i=t(r);n.has(i)||(n.add(i),o.push(r))}return o},"uniqBy"),D=c((e,t)=>{const n=(e.commandPath?[...e.commandPath,e.name]:[e.name]).join(" ");if(e.argument){const o=e.argument.name.toUpperCase(),r=e.argument.required?o:`[${o}]`;return`${t} ${n} ${r}`}return`${t} ${n}`},"formatCommandUsage"),Q=c((e,t)=>{if(!Array.isArray(e.env)||e.env.length===0)return;const n=e.env.filter(o=>!o.hidden);n.length>0&&t.push({content:n.map(o=>[o.name,o.description??""]),header:" Environment Variables "})},"addEnvironmentVariables"),X=c((e,t)=>{const n=[],o=(e.commandPath?[...e.commandPath,e.name]:[e.name]).join(" "),r=!!e.argument,i=!!e.options;if(n.push({content:`${t} ${o}${r?" [positional arguments]":""}${i?" [options]":""}`,header:" Usage "}),e.description&&n.push({content:e.description,header:" Description "}),e.argument&&n.push({header:"Command Positional Arguments",isArgument:!0,optionList:[e.argument]}),Array.isArray(e.options)&&e.options.length>0&&n.push({header:" Command Options ",optionList:e.options.filter(a=>!a.hidden)}),Q(e,n),e.alias!==void 0&&e.alias.length>0){const a=Array.isArray(e.alias)?e.alias:[e.alias];n.splice(1,0,{content:a,header:"Alias(es)"})}return Array.isArray(e.examples)&&e.examples.length>0&&n.push({content:e.examples,header:"Examples"}),G(n)},"formatCommandHelp"),Y=c((e,t)=>{const n=e.description?.trim().split(`
|
|
2
|
+
`)[0]??"",o=D(e,t),r=X(e,t);return J([`## \`${o}\``,n,`\`\`\`
|
|
3
|
+
${r.trim()}
|
|
4
|
+
\`\`\``]).join(`
|
|
5
|
+
|
|
6
|
+
`)},"renderCommand"),Z=c((e,t,n,o)=>{const r=`(${["--version","-V"].join("|")})`,i=W(),a=z();return`\`\`\`sh-session
|
|
7
|
+
$ npm install -g ${t}
|
|
8
|
+
$ ${e} COMMAND
|
|
128
9
|
running command...
|
|
129
|
-
$ ${
|
|
130
|
-
${
|
|
131
|
-
$ ${
|
|
10
|
+
$ ${e} ${r}
|
|
11
|
+
${t}/${n??"unknown"} ${i}-${a} node-v${o}
|
|
12
|
+
$ ${e} --help [COMMAND]
|
|
132
13
|
USAGE
|
|
133
|
-
$ ${
|
|
14
|
+
$ ${e} COMMAND
|
|
134
15
|
...
|
|
135
16
|
\`\`\`
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
};
|
|
154
|
-
const generateMultiCommands = async (commands, outputDirectory, cliName, options) => {
|
|
155
|
-
const groupedCommands = /* @__PURE__ */ new Map();
|
|
156
|
-
for (const command of commands) {
|
|
157
|
-
const group = command.group ?? "__Other";
|
|
158
|
-
const groupCommands = groupedCommands.get(group) ?? [];
|
|
159
|
-
groupCommands.push(command);
|
|
160
|
-
groupedCommands.set(group, groupCommands);
|
|
161
|
-
}
|
|
162
|
-
const groups = Array.from(groupedCommands.entries(), ([group, groupCommands]) => {
|
|
163
|
-
if (group === "__Other") {
|
|
164
|
-
return ["Other", groupCommands];
|
|
165
|
-
}
|
|
166
|
-
return [group, groupCommands];
|
|
167
|
-
});
|
|
168
|
-
await Promise.all(
|
|
169
|
-
groups.map(async ([group, groupCommands]) => {
|
|
170
|
-
const groupPath = group.replaceAll(":", "/");
|
|
171
|
-
const filePath = join(".", outputDirectory, `${groupPath}.md`);
|
|
172
|
-
const bin = `\`${cliName} ${group}\``;
|
|
173
|
-
const document = `${[bin, "=".repeat(bin.length), "", `Commands in the ${group} group.`, "", generateCommands(groupCommands, cliName)].join("\n").trim()}
|
|
174
|
-
`;
|
|
175
|
-
if (!options.dryRun) {
|
|
176
|
-
await writeFileWithDirectory(resolve(getCwd(), filePath), document);
|
|
177
|
-
}
|
|
178
|
-
})
|
|
179
|
-
);
|
|
180
|
-
const topicLinks = groups.map(([group]) => {
|
|
181
|
-
const groupPath = group.replaceAll(":", "/");
|
|
182
|
-
return `* [\`${cliName} ${group}\`](${outputDirectory}/${groupPath}.md)`;
|
|
183
|
-
});
|
|
184
|
-
return `${["# Command Topics\n", ...topicLinks].join("\n").trim()}
|
|
185
|
-
`;
|
|
186
|
-
};
|
|
187
|
-
const normalizeLineEndings = (text) => text.replaceAll("\r\n", "\n").replaceAll("\r", "\n");
|
|
188
|
-
const generateTableOfContents = (readme) => {
|
|
189
|
-
const normalizedReadme = normalizeLineEndings(readme);
|
|
190
|
-
const toc = normalizedReadme.split("\n").filter((line) => line.startsWith("# ")).map((line) => line.trim().slice(2)).map((line) => `* [${line}](#${slugify(line)})`);
|
|
191
|
-
return toc.join("\n");
|
|
192
|
-
};
|
|
193
|
-
const escapeRegex = (string_) => string_.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
|
|
194
|
-
const replaceTag = (readme, tag, body) => {
|
|
195
|
-
const normalizedReadme = normalizeLineEndings(readme);
|
|
196
|
-
const tagStart = `<!-- ${tag} -->`;
|
|
197
|
-
const tagStop = `<!-- ${tag}stop -->`;
|
|
198
|
-
if (normalizedReadme.includes(tagStart) && normalizedReadme.includes(tagStop)) {
|
|
199
|
-
const escapedStart = escapeRegex(tagStart);
|
|
200
|
-
const escapedStop = escapeRegex(tagStop);
|
|
201
|
-
const tagPattern = new RegExp(String.raw`${escapedStart}(.|\n)*${escapedStop}`, "m");
|
|
202
|
-
return normalizedReadme.replace(tagPattern, `${tagStart}
|
|
203
|
-
${body}
|
|
204
|
-
${tagStop}`);
|
|
205
|
-
}
|
|
206
|
-
return normalizedReadme.replace(tagStart, `${tagStart}
|
|
207
|
-
${body}
|
|
208
|
-
${tagStop}`);
|
|
209
|
-
};
|
|
210
|
-
const readmeCommand = {
|
|
211
|
-
description: "Generate README documentation for CLI commands",
|
|
212
|
-
execute: async ({ logger, options, runtime }) => {
|
|
213
|
-
const cliName = runtime.getCliName();
|
|
214
|
-
const packageName = runtime.getPackageName() ?? cliName;
|
|
215
|
-
const packageVersion = runtime.getPackageVersion();
|
|
216
|
-
const versions = getVersions();
|
|
217
|
-
const nodeVersion = versions.node ?? "unknown";
|
|
218
|
-
const readmeOptions = {
|
|
219
|
-
aliases: options.aliases,
|
|
220
|
-
dryRun: options.dryRun,
|
|
221
|
-
multi: options.multi,
|
|
222
|
-
outputDir: options.outputDir ?? "docs",
|
|
223
|
-
readmePath: options.readmePath ?? "README.md",
|
|
224
|
-
version: options.version ?? packageVersion ?? void 0
|
|
225
|
-
};
|
|
226
|
-
const commandsMap = runtime.getCommands();
|
|
227
|
-
const commands = [...commandsMap.values()].filter((c) => !c.hidden).filter((c) => {
|
|
228
|
-
if (readmeOptions.aliases) {
|
|
229
|
-
return true;
|
|
230
|
-
}
|
|
231
|
-
return c.name === commandsMap.get(c.name)?.name;
|
|
232
|
-
}).toSorted((a, b) => {
|
|
233
|
-
const aPath = a.commandPath ? [...a.commandPath, a.name].join(" ") : a.name;
|
|
234
|
-
const bPath = b.commandPath ? [...b.commandPath, b.name].join(" ") : b.name;
|
|
235
|
-
return aPath.localeCompare(bPath);
|
|
236
|
-
});
|
|
237
|
-
const uniqueCommands = uniqBy(commands, (c) => {
|
|
238
|
-
const path = c.commandPath ? [...c.commandPath, c.name].join(" ") : c.name;
|
|
239
|
-
return path;
|
|
240
|
-
});
|
|
241
|
-
logger.debug(`Processing ${String(uniqueCommands.length)} commands for README generation`);
|
|
242
|
-
let readme;
|
|
243
|
-
const readmePath = resolve(getCwd(), readmeOptions.readmePath ?? "README.md");
|
|
244
|
-
if (existsSync(readmePath)) {
|
|
245
|
-
const rawReadme = await readFile(readmePath, "utf8");
|
|
246
|
-
readme = normalizeLineEndings(rawReadme);
|
|
247
|
-
} else {
|
|
248
|
-
logger.warn(`README file not found at ${readmePath}, creating template`);
|
|
249
|
-
readme = `# ${packageName}
|
|
17
|
+
`},"generateUsage"),b=c((e,t,n)=>{const o=e.map(i=>{const a=D(i,t);return`* [\`${a}\`](#${C(a)})`}),r=e.map(i=>Y(i,t)).map(i=>`${i.trim()}
|
|
18
|
+
`);return[...o,"",...r].join(`
|
|
19
|
+
`).trim()},"generateCommands"),R=c(async(e,t)=>{const n=q(e);v(n)||await k(n,{recursive:!0}),await B(e,t,"utf8")},"writeFileWithDirectory"),ee=c(async(e,t,n,o)=>{const r=new Map;for(const a of e){const s=a.group??"__Other",l=r.get(s)??[];l.push(a),r.set(s,l)}const i=Array.from(r.entries(),([a,s])=>a==="__Other"?["Other",s]:[a,s]);return await Promise.all(i.map(async([a,s])=>{const l=a.replaceAll(":","/"),$=V(".",t,`${l}.md`),d=`\`${n} ${a}\``,p=`${[d,"=".repeat(d.length),"",`Commands in the ${a} group.`,"",b(s,n,o)].join(`
|
|
20
|
+
`).trim()}
|
|
21
|
+
`;o.dryRun||await R(P(M(),$),p)})),`${[`# Command Topics
|
|
22
|
+
`,...i.map(([a])=>{const s=a.replaceAll(":","/");return`* [\`${n} ${a}\`](${t}/${s}.md)`})].join(`
|
|
23
|
+
`).trim()}
|
|
24
|
+
`},"generateMultiCommands"),w=c(e=>e.replaceAll(`\r
|
|
25
|
+
`,`
|
|
26
|
+
`).replaceAll("\r",`
|
|
27
|
+
`),"normalizeLineEndings"),te=c(e=>w(e).split(`
|
|
28
|
+
`).filter(t=>t.startsWith("# ")).map(t=>t.trim().slice(2)).map(t=>`* [${t}](#${C(t)})`).join(`
|
|
29
|
+
`),"generateTableOfContents"),E=c(e=>e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),"escapeRegex"),y=c((e,t,n)=>{const o=w(e),r=`<!-- ${t} -->`,i=`<!-- ${t}stop -->`;if(o.includes(r)&&o.includes(i)){const a=E(r),s=E(i),l=new RegExp(String.raw`${a}(.|\n)*${s}`,"m");return o.replace(l,`${r}
|
|
30
|
+
${n}
|
|
31
|
+
${i}`)}return o.replace(r,`${r}
|
|
32
|
+
${n}
|
|
33
|
+
${i}`)},"replaceTag"),se={description:"Generate README documentation for CLI commands",execute:c(async({logger:e,options:t,runtime:n})=>{const o=n.getCliName(),r=n.getPackageName()??o,i=n.getPackageVersion(),a=F().node??"unknown",s={aliases:t.aliases,dryRun:t.dryRun,multi:t.multi,nestedTopicsDepth:t.nestedTopicsDepth,outputDir:t.outputDir??"docs",readmePath:t.readmePath??"README.md",repositoryPrefix:t.repositoryPrefix,version:t.version??i??void 0},l=n.getCommands(),$=[...l.values()].filter(m=>!m.hidden).filter(m=>s.aliases?!0:m.name===l.get(m.name)?.name).toSorted((m,h)=>{const _=m.commandPath?[...m.commandPath,m.name].join(" "):m.name,S=h.commandPath?[...h.commandPath,h.name].join(" "):h.name;return _.localeCompare(S)}),d=K($,m=>m.commandPath?[...m.commandPath,m.name].join(" "):m.name);e.debug(`Processing ${String(d.length)} commands for README generation`);let p;const u=P(M(),s.readmePath??"README.md");if(v(u)){const m=await T(u,"utf8");p=w(m)}else e.warn(`README file not found at ${u}, creating template`),p=`# ${r}
|
|
250
34
|
|
|
251
35
|
<!-- usage -->
|
|
252
36
|
<!-- usagestop -->
|
|
@@ -256,75 +40,6 @@ const readmeCommand = {
|
|
|
256
40
|
|
|
257
41
|
<!-- toc -->
|
|
258
42
|
<!-- tocstop -->
|
|
259
|
-
`;
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
const version = readmeOptions.version ?? packageVersion ?? "unknown";
|
|
263
|
-
readme = replaceTag(readme, "usage", generateUsage(cliName, packageName, version, nodeVersion));
|
|
264
|
-
readme = replaceTag(
|
|
265
|
-
readme,
|
|
266
|
-
"commands",
|
|
267
|
-
readmeOptions.multi ? await generateMultiCommands(uniqueCommands, outputDirectory, cliName, readmeOptions) : generateCommands(uniqueCommands, cliName)
|
|
268
|
-
);
|
|
269
|
-
readme = replaceTag(readme, "toc", generateTableOfContents(readme));
|
|
270
|
-
readme = `${readme.trimEnd()}
|
|
271
|
-
`;
|
|
272
|
-
if (readmeOptions.dryRun) {
|
|
273
|
-
logger.info("Dry run mode - README not written");
|
|
274
|
-
logger.info(`Generated README content:
|
|
275
|
-
${readme}`);
|
|
276
|
-
} else {
|
|
277
|
-
await writeFileWithDirectory(readmePath, readme);
|
|
278
|
-
logger.info(`README generated successfully at ${readmePath}`);
|
|
279
|
-
}
|
|
280
|
-
},
|
|
281
|
-
name: "readme",
|
|
282
|
-
options: [
|
|
283
|
-
{
|
|
284
|
-
description: "Include aliases in command list",
|
|
285
|
-
name: "aliases",
|
|
286
|
-
type: Boolean
|
|
287
|
-
},
|
|
288
|
-
{
|
|
289
|
-
description: "Show what would be generated without writing files",
|
|
290
|
-
name: "dry-run",
|
|
291
|
-
type: Boolean
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
description: "Generate multi-file documentation by command groups",
|
|
295
|
-
name: "multi",
|
|
296
|
-
type: Boolean
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
description: "Maximum depth for nested topics when using multi-file mode",
|
|
300
|
-
name: "nested-topics-depth",
|
|
301
|
-
type: Number
|
|
302
|
-
},
|
|
303
|
-
{
|
|
304
|
-
description: "Output directory for multi-file documentation",
|
|
305
|
-
name: "output-dir",
|
|
306
|
-
type: String,
|
|
307
|
-
typeLabel: "{underline directory}"
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
description: "Path to README file to generate",
|
|
311
|
-
name: "readme-path",
|
|
312
|
-
type: String,
|
|
313
|
-
typeLabel: "{underline path}"
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
description: "Repository prefix for code links",
|
|
317
|
-
name: "repository-prefix",
|
|
318
|
-
type: String,
|
|
319
|
-
typeLabel: "{underline prefix}"
|
|
320
|
-
},
|
|
321
|
-
{
|
|
322
|
-
description: "Version to use in generated documentation",
|
|
323
|
-
name: "version",
|
|
324
|
-
type: String,
|
|
325
|
-
typeLabel: "{underline version}"
|
|
326
|
-
}
|
|
327
|
-
]
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
export { readmeCommand as default };
|
|
43
|
+
`;const j=s.outputDir??"docs",x=s.version??i??"unknown";p=y(p,"usage",Z(o,r,x,a)),p=y(p,"commands",s.multi?await ee(d,j,o,s):b(d,o,s)),p=y(p,"toc",te(p)),p=`${p.trimEnd()}
|
|
44
|
+
`,s.dryRun?(e.info("Dry run mode - README not written"),e.info(`Generated README content:
|
|
45
|
+
${p}`)):(await R(u,p),e.info(`README generated successfully at ${u}`))},"execute"),name:"readme",options:[{description:"Include aliases in command list",name:"aliases",type:Boolean},{description:"Show what would be generated without writing files",name:"dry-run",type:Boolean},{description:"Generate multi-file documentation by command groups",name:"multi",type:Boolean},{description:"Maximum depth for nested topics when using multi-file mode",name:"nested-topics-depth",type:Number},{description:"Output directory for multi-file documentation",name:"output-dir",type:String,typeLabel:"{underline directory}"},{description:"Path to README file to generate",name:"readme-path",type:String,typeLabel:"{underline path}"},{description:"Repository prefix for code links",name:"repository-prefix",type:String,typeLabel:"{underline prefix}"},{description:"Version to use in generated documentation",name:"version",type:String,typeLabel:"{underline version}"}]};export{se as default};
|