@botim/botim-cli 0.0.3 → 0.0.4
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/cli.js +33 -33
- package/dist/cli.mjs +2 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -9,13 +9,13 @@ import { setRuntimeEnvironment, parseEnvironment, getEnvironmentDisplayName } fr
|
|
|
9
9
|
import chalk from "chalk";
|
|
10
10
|
import fs from "fs-extra";
|
|
11
11
|
import path from "path";
|
|
12
|
-
const version = "0.0.
|
|
12
|
+
const version = "0.0.4";
|
|
13
13
|
const program = new Command();
|
|
14
|
-
program.name("botim-cli").description("CLI tool to generate boilerplate code for React and Vue applications").version(version, "-v, --version", "Output the current version").option("--env <environment>", "Target environment: prod or
|
|
14
|
+
program.name("botim-cli").description("CLI tool to generate boilerplate code for React and Vue applications").version(version, "-v, --version", "Output the current version").option("--env <environment>", "Target environment: prod or uat (overrides default)", (value) => {
|
|
15
15
|
const env = parseEnvironment(value);
|
|
16
16
|
if (!env) {
|
|
17
17
|
console.error(chalk.red(`
|
|
18
|
-
Invalid environment: ${value}. Valid values: prod,
|
|
18
|
+
Invalid environment: ${value}. Valid values: prod, uat
|
|
19
19
|
`));
|
|
20
20
|
process.exit(1);
|
|
21
21
|
}
|
|
@@ -64,7 +64,7 @@ program.command("quick-start").description("Show quick start guide").alias("qs")
|
|
|
64
64
|
program.command("login").description("Login via QR code and save authentication token").action(async () => {
|
|
65
65
|
const currentEnv = await getCurrentEnvironment();
|
|
66
66
|
const envDisplay = getEnvironmentDisplayName(currentEnv);
|
|
67
|
-
const envColor = currentEnv === "
|
|
67
|
+
const envColor = currentEnv === "production" ? chalk.green : chalk.yellow;
|
|
68
68
|
console.log(chalk.cyan.bold(`
|
|
69
69
|
\u{1F510} Botim CLI v${version} - Login ${envColor(`[${envDisplay}]`)}
|
|
70
70
|
`));
|
|
@@ -73,7 +73,7 @@ program.command("login").description("Login via QR code and save authentication
|
|
|
73
73
|
program.command("logout").description("Logout and clear saved authentication token").option("--all", "Clear credentials for all environments").action(async (options) => {
|
|
74
74
|
const currentEnv = await getCurrentEnvironment();
|
|
75
75
|
const envDisplay = getEnvironmentDisplayName(currentEnv);
|
|
76
|
-
const envColor = currentEnv === "
|
|
76
|
+
const envColor = currentEnv === "production" ? chalk.green : chalk.yellow;
|
|
77
77
|
console.log(chalk.cyan.bold(`
|
|
78
78
|
\u{1F6AA} Botim CLI v${version} - Logout ${envColor(`[${envDisplay}]`)}
|
|
79
79
|
`));
|
|
@@ -98,20 +98,20 @@ program.command("status").description("Show login status for all environments").
|
|
|
98
98
|
console.log(chalk.gray(" Not logged in"));
|
|
99
99
|
}
|
|
100
100
|
console.log("");
|
|
101
|
-
const
|
|
102
|
-
const
|
|
103
|
-
const
|
|
104
|
-
console.log(` ${
|
|
105
|
-
if (
|
|
106
|
-
console.log(chalk.gray(` Partner: ${
|
|
107
|
-
} else if (!
|
|
101
|
+
const uatStatus = allStatus.uat;
|
|
102
|
+
const uatIndicator = uatStatus.loggedIn ? chalk.green("\u2713") : chalk.red("\u2717");
|
|
103
|
+
const uatActive = currentEnv === "uat" ? chalk.cyan(" (active)") : "";
|
|
104
|
+
console.log(` ${uatIndicator} UAT${uatActive}`);
|
|
105
|
+
if (uatStatus.loggedIn && uatStatus.partnerName) {
|
|
106
|
+
console.log(chalk.gray(` Partner: ${uatStatus.partnerName}`));
|
|
107
|
+
} else if (!uatStatus.loggedIn) {
|
|
108
108
|
console.log(chalk.gray(" Not logged in"));
|
|
109
109
|
}
|
|
110
110
|
console.log("");
|
|
111
111
|
console.log(chalk.gray("Tips:"));
|
|
112
|
-
console.log(chalk.gray(" Switch environment: botim-cli config set env
|
|
113
|
-
console.log(chalk.gray(" One-time override: botim-cli --env
|
|
114
|
-
console.log(chalk.gray(" Login to
|
|
112
|
+
console.log(chalk.gray(" Switch environment: botim-cli config set env uat"));
|
|
113
|
+
console.log(chalk.gray(" One-time override: botim-cli --env uat <command>"));
|
|
114
|
+
console.log(chalk.gray(" Login to uat: botim-cli --env uat login\n"));
|
|
115
115
|
});
|
|
116
116
|
program.command("auth").description("Access authenticated commands (requires login)").alias("authenticated").action(async () => {
|
|
117
117
|
await showMenuOrRequireAuth();
|
|
@@ -150,8 +150,8 @@ Examples:
|
|
|
150
150
|
--audience 1 \\
|
|
151
151
|
--reviewNote "Internal testing app"
|
|
152
152
|
|
|
153
|
-
Use
|
|
154
|
-
$ botim-cli --env
|
|
153
|
+
Use UAT environment:
|
|
154
|
+
$ botim-cli --env uat create-mp-app --projectName my-uat-app
|
|
155
155
|
|
|
156
156
|
Creator Types:
|
|
157
157
|
hybrid - Fastest, local resources with full platform capabilities (default)
|
|
@@ -171,7 +171,7 @@ Audience Options:
|
|
|
171
171
|
const currentEnv = await getCurrentEnvironment();
|
|
172
172
|
const envDisplay = getEnvironmentDisplayName(currentEnv);
|
|
173
173
|
console.log(chalk.red(`
|
|
174
|
-
\u274C Authentication required for ${envDisplay}. Please login first using: botim-cli ${currentEnv === "
|
|
174
|
+
\u274C Authentication required for ${envDisplay}. Please login first using: botim-cli ${currentEnv === "uat" ? "--env uat " : ""}login
|
|
175
175
|
`));
|
|
176
176
|
process.exit(1);
|
|
177
177
|
}
|
|
@@ -191,7 +191,7 @@ program.command("init-mp-app").description("Initialize MP app in current directo
|
|
|
191
191
|
const currentEnv = await getCurrentEnvironment();
|
|
192
192
|
const envDisplay = getEnvironmentDisplayName(currentEnv);
|
|
193
193
|
console.log(chalk.red(`
|
|
194
|
-
\u274C Authentication required for ${envDisplay}. Please login first using: botim-cli ${currentEnv === "
|
|
194
|
+
\u274C Authentication required for ${envDisplay}. Please login first using: botim-cli ${currentEnv === "uat" ? "--env uat " : ""}login
|
|
195
195
|
`));
|
|
196
196
|
process.exit(1);
|
|
197
197
|
}
|
|
@@ -207,7 +207,7 @@ program.command("deploy-mp-app").description("Deploy MP app to server (requires
|
|
|
207
207
|
const currentEnv = await getCurrentEnvironment();
|
|
208
208
|
const envDisplay = getEnvironmentDisplayName(currentEnv);
|
|
209
209
|
console.log(chalk.red(`
|
|
210
|
-
\u274C Authentication required for ${envDisplay}. Please login first using: botim-cli ${currentEnv === "
|
|
210
|
+
\u274C Authentication required for ${envDisplay}. Please login first using: botim-cli ${currentEnv === "uat" ? "--env uat " : ""}login
|
|
211
211
|
`));
|
|
212
212
|
process.exit(1);
|
|
213
213
|
}
|
|
@@ -223,7 +223,7 @@ program.command("debug-mp-app").description("Debug MP app (requires authenticati
|
|
|
223
223
|
const currentEnv = await getCurrentEnvironment();
|
|
224
224
|
const envDisplay = getEnvironmentDisplayName(currentEnv);
|
|
225
225
|
console.log(chalk.red(`
|
|
226
|
-
\u274C Authentication required for ${envDisplay}. Please login first using: botim-cli ${currentEnv === "
|
|
226
|
+
\u274C Authentication required for ${envDisplay}. Please login first using: botim-cli ${currentEnv === "uat" ? "--env uat " : ""}login
|
|
227
227
|
`));
|
|
228
228
|
process.exit(1);
|
|
229
229
|
}
|
|
@@ -239,7 +239,7 @@ program.command("list-mp-permissions [app-id]").description("List permissions fo
|
|
|
239
239
|
const currentEnv = await getCurrentEnvironment();
|
|
240
240
|
const envDisplay = getEnvironmentDisplayName(currentEnv);
|
|
241
241
|
console.log(chalk.red(`
|
|
242
|
-
\u274C Authentication required for ${envDisplay}. Please login first using: botim-cli ${currentEnv === "
|
|
242
|
+
\u274C Authentication required for ${envDisplay}. Please login first using: botim-cli ${currentEnv === "uat" ? "--env uat " : ""}login
|
|
243
243
|
`));
|
|
244
244
|
process.exit(1);
|
|
245
245
|
}
|
|
@@ -259,7 +259,7 @@ configCommand.command("set <key> <value>").description("Set a configuration valu
|
|
|
259
259
|
if (!env) {
|
|
260
260
|
console.log(chalk.red(`\u274C Invalid environment: ${value}
|
|
261
261
|
`));
|
|
262
|
-
console.log(chalk.yellow("Valid values: prod, production,
|
|
262
|
+
console.log(chalk.yellow("Valid values: prod, production, uat\n"));
|
|
263
263
|
process.exit(1);
|
|
264
264
|
}
|
|
265
265
|
await setCurrentEnvironment(env);
|
|
@@ -288,7 +288,7 @@ configCommand.command("set <key> <value>").description("Set a configuration valu
|
|
|
288
288
|
console.log(chalk.red(`\u274C Unknown configuration key: ${key}
|
|
289
289
|
`));
|
|
290
290
|
console.log(chalk.yellow("Available keys:\n"));
|
|
291
|
-
console.log(chalk.yellow(" - env (or environment): Set default environment (prod,
|
|
291
|
+
console.log(chalk.yellow(" - env (or environment): Set default environment (prod, uat)\n"));
|
|
292
292
|
console.log(chalk.yellow("\nNote: Template repository URLs are configured via .env file, not CLI commands.\n"));
|
|
293
293
|
process.exit(1);
|
|
294
294
|
}
|
|
@@ -464,7 +464,7 @@ async function showMainMenu() {
|
|
|
464
464
|
try {
|
|
465
465
|
const currentEnv = await getCurrentEnvironment();
|
|
466
466
|
const envDisplay = getEnvironmentDisplayName(currentEnv);
|
|
467
|
-
const envColor = currentEnv === "
|
|
467
|
+
const envColor = currentEnv === "production" ? chalk.green : chalk.yellow;
|
|
468
468
|
console.log(chalk.cyan.bold("\n\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"));
|
|
469
469
|
console.log(chalk.cyan.bold("\u2551 \u{1F680} Botim CLI Generator \u2551"));
|
|
470
470
|
console.log(chalk.cyan.bold(`\u2551 v${version.padEnd(32)}\u2551`));
|
|
@@ -575,8 +575,8 @@ async function showMainMenu() {
|
|
|
575
575
|
value: "production"
|
|
576
576
|
},
|
|
577
577
|
{
|
|
578
|
-
name: `
|
|
579
|
-
value: "
|
|
578
|
+
name: `UAT ${allStatus.uat.loggedIn ? chalk.green("\u2713 Logged in") : chalk.gray("(not logged in)")}${currentEnv === "uat" ? chalk.cyan(" \u2190 current") : ""}`,
|
|
579
|
+
value: "uat"
|
|
580
580
|
},
|
|
581
581
|
new inquirer.Separator(),
|
|
582
582
|
{ name: "\u2190 Back to main menu", value: "back" }
|
|
@@ -612,12 +612,12 @@ async function showMainMenu() {
|
|
|
612
612
|
if (prodStatus.loggedIn && prodStatus.partnerName) {
|
|
613
613
|
console.log(chalk.gray(` Partner: ${prodStatus.partnerName}`));
|
|
614
614
|
}
|
|
615
|
-
const
|
|
616
|
-
const
|
|
617
|
-
const
|
|
618
|
-
console.log(` ${
|
|
619
|
-
if (
|
|
620
|
-
console.log(chalk.gray(` Partner: ${
|
|
615
|
+
const uatStatus = allStatus.uat;
|
|
616
|
+
const uatIndicator = uatStatus.loggedIn ? chalk.green("\u2713") : chalk.red("\u2717");
|
|
617
|
+
const uatActive = currentEnv === "uat" ? chalk.cyan(" (active)") : "";
|
|
618
|
+
console.log(` ${uatIndicator} UAT${uatActive}`);
|
|
619
|
+
if (uatStatus.loggedIn && uatStatus.partnerName) {
|
|
620
|
+
console.log(chalk.gray(` Partner: ${uatStatus.partnerName}`));
|
|
621
621
|
}
|
|
622
622
|
console.log("");
|
|
623
623
|
await showMainMenu();
|