@git.zone/cli 2.13.15 → 2.14.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/dist_ts/00_commitinfo_data.js +2 -2
- package/dist_ts/gitzone.cli.js +46 -35
- package/dist_ts/helpers.climode.d.ts +22 -0
- package/dist_ts/helpers.climode.js +158 -0
- package/dist_ts/helpers.smartconfig.d.ts +11 -0
- package/dist_ts/helpers.smartconfig.js +139 -0
- package/dist_ts/mod_commit/index.d.ts +2 -0
- package/dist_ts/mod_commit/index.js +204 -92
- package/dist_ts/mod_config/index.d.ts +7 -2
- package/dist_ts/mod_config/index.js +390 -176
- package/dist_ts/mod_format/classes.formatcontext.d.ts +11 -2
- package/dist_ts/mod_format/classes.formatcontext.js +14 -4
- package/dist_ts/mod_format/formatters/packagejson.formatter.js +1 -67
- package/dist_ts/mod_format/formatters/smartconfig.formatter.d.ts +2 -2
- package/dist_ts/mod_format/formatters/smartconfig.formatter.js +46 -39
- package/dist_ts/mod_format/index.d.ts +4 -1
- package/dist_ts/mod_format/index.js +221 -75
- package/dist_ts/mod_format/mod.plugins.d.ts +1 -2
- package/dist_ts/mod_format/mod.plugins.js +2 -3
- package/dist_ts/mod_services/index.d.ts +2 -0
- package/dist_ts/mod_services/index.js +366 -168
- package/dist_ts/mod_standard/index.d.ts +3 -1
- package/dist_ts/mod_standard/index.js +159 -59
- package/package.json +1 -1
- package/readme.hints.md +25 -32
- package/readme.md +87 -65
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/gitzone.cli.ts +50 -38
- package/ts/helpers.climode.ts +212 -0
- package/ts/helpers.smartconfig.ts +192 -0
- package/ts/mod_commit/index.ts +325 -98
- package/ts/mod_config/index.ts +490 -182
- package/ts/mod_format/classes.formatcontext.ts +20 -3
- package/ts/mod_format/formatters/packagejson.formatter.ts +0 -91
- package/ts/mod_format/formatters/smartconfig.formatter.ts +55 -39
- package/ts/mod_format/index.ts +279 -90
- package/ts/mod_format/mod.plugins.ts +0 -2
- package/ts/mod_services/index.ts +550 -183
- package/ts/mod_standard/index.ts +191 -58
package/ts/mod_standard/index.ts
CHANGED
|
@@ -1,91 +1,224 @@
|
|
|
1
1
|
/* -----------------------------------------------
|
|
2
2
|
* executes as standard task
|
|
3
3
|
* ----------------------------------------------- */
|
|
4
|
-
import * as plugins from
|
|
5
|
-
import * as paths from
|
|
4
|
+
import * as plugins from "./mod.plugins.js";
|
|
5
|
+
import * as paths from "../paths.js";
|
|
6
|
+
import type { ICliMode } from "../helpers.climode.js";
|
|
7
|
+
import { getCliMode, printJson } from "../helpers.climode.js";
|
|
6
8
|
|
|
7
|
-
import { logger } from
|
|
9
|
+
import { logger } from "../gitzone.logging.js";
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
type ICommandHelpSummary = {
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const commandSummaries: ICommandHelpSummary[] = [
|
|
17
|
+
{
|
|
18
|
+
name: "commit",
|
|
19
|
+
description:
|
|
20
|
+
"Create semantic commits or generate read-only commit recommendations",
|
|
21
|
+
},
|
|
22
|
+
{ name: "format", description: "Plan or apply project formatting changes" },
|
|
23
|
+
{ name: "config", description: "Read and change .smartconfig.json settings" },
|
|
24
|
+
{ name: "services", description: "Manage or configure development services" },
|
|
25
|
+
{ name: "template", description: "Create a project from a template" },
|
|
26
|
+
{ name: "open", description: "Open project assets and CI pages" },
|
|
27
|
+
{ name: "docker", description: "Run Docker-related maintenance tasks" },
|
|
28
|
+
{
|
|
29
|
+
name: "deprecate",
|
|
30
|
+
description: "Deprecate npm packages across registries",
|
|
31
|
+
},
|
|
32
|
+
{ name: "meta", description: "Run meta-repository commands" },
|
|
33
|
+
{ name: "start", description: "Prepare a project for local work" },
|
|
34
|
+
{ name: "helpers", description: "Run helper utilities" },
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
export let run = async (argvArg: any = {}) => {
|
|
38
|
+
const mode = await getCliMode(argvArg);
|
|
39
|
+
const requestedCommandHelp =
|
|
40
|
+
argvArg._?.[0] === "help" ? argvArg._?.[1] : undefined;
|
|
41
|
+
|
|
42
|
+
if (mode.help || requestedCommandHelp) {
|
|
43
|
+
await showHelp(mode, requestedCommandHelp);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (!mode.interactive) {
|
|
48
|
+
await showHelp(mode);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
console.log("");
|
|
53
|
+
console.log(
|
|
54
|
+
"╭─────────────────────────────────────────────────────────────╮",
|
|
55
|
+
);
|
|
56
|
+
console.log(
|
|
57
|
+
"│ gitzone - Development Workflow CLI │",
|
|
58
|
+
);
|
|
59
|
+
console.log(
|
|
60
|
+
"╰─────────────────────────────────────────────────────────────╯",
|
|
61
|
+
);
|
|
62
|
+
console.log("");
|
|
15
63
|
|
|
16
64
|
const interactInstance = new plugins.smartinteract.SmartInteract();
|
|
17
65
|
const response = await interactInstance.askQuestion({
|
|
18
|
-
type:
|
|
19
|
-
name:
|
|
20
|
-
message:
|
|
21
|
-
default:
|
|
66
|
+
type: "list",
|
|
67
|
+
name: "action",
|
|
68
|
+
message: "What would you like to do?",
|
|
69
|
+
default: "commit",
|
|
22
70
|
choices: [
|
|
23
|
-
{ name:
|
|
24
|
-
{ name:
|
|
25
|
-
{ name:
|
|
26
|
-
{ name:
|
|
27
|
-
{ name:
|
|
28
|
-
{ name:
|
|
29
|
-
{ name:
|
|
71
|
+
{ name: "Commit changes (semantic versioning)", value: "commit" },
|
|
72
|
+
{ name: "Format project files", value: "format" },
|
|
73
|
+
{ name: "Configure release settings", value: "config" },
|
|
74
|
+
{ name: "Create from template", value: "template" },
|
|
75
|
+
{ name: "Manage dev services (MongoDB, S3)", value: "services" },
|
|
76
|
+
{ name: "Open project assets", value: "open" },
|
|
77
|
+
{ name: "Show help", value: "help" },
|
|
30
78
|
],
|
|
31
79
|
});
|
|
32
80
|
|
|
33
81
|
const action = (response as any).value;
|
|
34
82
|
|
|
35
83
|
switch (action) {
|
|
36
|
-
case
|
|
37
|
-
const modCommit = await import(
|
|
38
|
-
await modCommit.run({ _: [
|
|
84
|
+
case "commit": {
|
|
85
|
+
const modCommit = await import("../mod_commit/index.js");
|
|
86
|
+
await modCommit.run({ _: ["commit"] });
|
|
39
87
|
break;
|
|
40
88
|
}
|
|
41
|
-
case
|
|
42
|
-
const modFormat = await import(
|
|
89
|
+
case "format": {
|
|
90
|
+
const modFormat = await import("../mod_format/index.js");
|
|
43
91
|
await modFormat.run({ interactive: true });
|
|
44
92
|
break;
|
|
45
93
|
}
|
|
46
|
-
case
|
|
47
|
-
const modConfig = await import(
|
|
48
|
-
await modConfig.run({ _: [
|
|
94
|
+
case "config": {
|
|
95
|
+
const modConfig = await import("../mod_config/index.js");
|
|
96
|
+
await modConfig.run({ _: ["config"] });
|
|
49
97
|
break;
|
|
50
98
|
}
|
|
51
|
-
case
|
|
52
|
-
const modTemplate = await import(
|
|
53
|
-
await modTemplate.run({ _: [
|
|
99
|
+
case "template": {
|
|
100
|
+
const modTemplate = await import("../mod_template/index.js");
|
|
101
|
+
await modTemplate.run({ _: ["template"] });
|
|
54
102
|
break;
|
|
55
103
|
}
|
|
56
|
-
case
|
|
57
|
-
const modServices = await import(
|
|
58
|
-
await modServices.run({ _: [
|
|
104
|
+
case "services": {
|
|
105
|
+
const modServices = await import("../mod_services/index.js");
|
|
106
|
+
await modServices.run({ _: ["services"] });
|
|
59
107
|
break;
|
|
60
108
|
}
|
|
61
|
-
case
|
|
62
|
-
const modOpen = await import(
|
|
63
|
-
await modOpen.run({ _: [
|
|
109
|
+
case "open": {
|
|
110
|
+
const modOpen = await import("../mod_open/index.js");
|
|
111
|
+
await modOpen.run({ _: ["open"] });
|
|
64
112
|
break;
|
|
65
113
|
}
|
|
66
|
-
case
|
|
67
|
-
showHelp();
|
|
114
|
+
case "help":
|
|
115
|
+
await showHelp(mode);
|
|
68
116
|
break;
|
|
69
117
|
}
|
|
70
118
|
};
|
|
71
119
|
|
|
72
|
-
function showHelp(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
120
|
+
export async function showHelp(
|
|
121
|
+
mode: ICliMode,
|
|
122
|
+
commandName?: string,
|
|
123
|
+
): Promise<void> {
|
|
124
|
+
if (commandName) {
|
|
125
|
+
const handled = await showCommandHelp(commandName, mode);
|
|
126
|
+
if (handled) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (mode.json) {
|
|
132
|
+
printJson({
|
|
133
|
+
name: "gitzone",
|
|
134
|
+
usage: "gitzone <command> [options]",
|
|
135
|
+
commands: commandSummaries,
|
|
136
|
+
globalFlags: [
|
|
137
|
+
{ flag: "--help, -h", description: "Show help output" },
|
|
138
|
+
{
|
|
139
|
+
flag: "--json",
|
|
140
|
+
description: "Emit machine-readable JSON when supported",
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
flag: "--plain",
|
|
144
|
+
description: "Use plain text output when supported",
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
flag: "--agent",
|
|
148
|
+
description: "Prefer non-interactive machine-friendly output",
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
flag: "--no-interactive",
|
|
152
|
+
description: "Disable prompts and interactive menus",
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
flag: "--no-check-updates",
|
|
156
|
+
description: "Skip the update check banner",
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
});
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
console.log("");
|
|
164
|
+
console.log("Usage: gitzone <command> [options]");
|
|
165
|
+
console.log("");
|
|
166
|
+
console.log("Commands:");
|
|
167
|
+
for (const commandSummary of commandSummaries) {
|
|
168
|
+
console.log(
|
|
169
|
+
` ${commandSummary.name.padEnd(11)} ${commandSummary.description}`,
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
console.log("");
|
|
173
|
+
console.log("Global flags:");
|
|
174
|
+
console.log(" --help, -h Show help output");
|
|
175
|
+
console.log(
|
|
176
|
+
" --json Emit machine-readable JSON when supported",
|
|
177
|
+
);
|
|
178
|
+
console.log(" --plain Use plain text output when supported");
|
|
179
|
+
console.log(
|
|
180
|
+
" --agent Prefer non-interactive machine-friendly output",
|
|
181
|
+
);
|
|
182
|
+
console.log(" --no-interactive Disable prompts and interactive menus");
|
|
183
|
+
console.log(" --no-check-updates Skip the update check banner");
|
|
184
|
+
console.log("");
|
|
185
|
+
console.log("Examples:");
|
|
186
|
+
console.log(" gitzone help commit");
|
|
187
|
+
console.log(" gitzone config show --json");
|
|
188
|
+
console.log(" gitzone commit recommend --json");
|
|
189
|
+
console.log(" gitzone format plan --json");
|
|
190
|
+
console.log(" gitzone services set mongodb,minio");
|
|
191
|
+
console.log("");
|
|
192
|
+
console.log("Run gitzone <command> --help for command-specific usage.");
|
|
193
|
+
console.log("");
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
async function showCommandHelp(
|
|
197
|
+
commandName: string,
|
|
198
|
+
mode: ICliMode,
|
|
199
|
+
): Promise<boolean> {
|
|
200
|
+
switch (commandName) {
|
|
201
|
+
case "commit": {
|
|
202
|
+
const modCommit = await import("../mod_commit/index.js");
|
|
203
|
+
modCommit.showHelp(mode);
|
|
204
|
+
return true;
|
|
205
|
+
}
|
|
206
|
+
case "config": {
|
|
207
|
+
const modConfig = await import("../mod_config/index.js");
|
|
208
|
+
modConfig.showHelp(mode);
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
case "format": {
|
|
212
|
+
const modFormat = await import("../mod_format/index.js");
|
|
213
|
+
modFormat.showHelp(mode);
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
case "services": {
|
|
217
|
+
const modServices = await import("../mod_services/index.js");
|
|
218
|
+
modServices.showHelp(mode);
|
|
219
|
+
return true;
|
|
220
|
+
}
|
|
221
|
+
default:
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
91
224
|
}
|