@zrhsh/wukong-cli 0.4.27 → 0.4.28
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/LICENSE +16 -0
- package/dist/cli.js +29 -46
- package/dist/cli.js.map +1 -1
- package/package.json +2 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Copyright (c) 2026 武汉壹品慧生活技术有限公司. All rights reserved.
|
|
2
|
+
|
|
3
|
+
本软件为武汉壹品慧生活技术有限公司(以下简称"公司")的专有资产,
|
|
4
|
+
仅限公司内部授权人员在公司业务范围内使用。
|
|
5
|
+
|
|
6
|
+
未经公司书面许可,任何单位和个人不得:
|
|
7
|
+
|
|
8
|
+
1. 复制、传播、分发本软件或其任何部分;
|
|
9
|
+
2. 修改、改编、翻译本软件;
|
|
10
|
+
3. 将本软件用于公司业务范围之外的任何用途;
|
|
11
|
+
4. 对本软件进行反向工程、反编译或反汇编。
|
|
12
|
+
|
|
13
|
+
本软件按"现状"提供,不附带任何明示或暗示的担保。
|
|
14
|
+
|
|
15
|
+
This software is proprietary and confidential.
|
|
16
|
+
Unauthorized copying, distribution, modification, or use is strictly prohibited.
|
package/dist/cli.js
CHANGED
|
@@ -256,8 +256,7 @@ function loadConfig() {
|
|
|
256
256
|
}
|
|
257
257
|
try {
|
|
258
258
|
const content = readFileSync2(configPath, "utf-8");
|
|
259
|
-
|
|
260
|
-
return config;
|
|
259
|
+
return JSON.parse(content);
|
|
261
260
|
} catch (error2) {
|
|
262
261
|
console.warn(`Warning: Failed to load config from ${configPath}: ${error2}`);
|
|
263
262
|
return {};
|
|
@@ -298,22 +297,6 @@ function getMergedEnvironmentConfig(env) {
|
|
|
298
297
|
}
|
|
299
298
|
return defaultEnvConfig;
|
|
300
299
|
}
|
|
301
|
-
function getAllEnvironments() {
|
|
302
|
-
const config = loadConfig();
|
|
303
|
-
const result = { ...ENVIRONMENTS };
|
|
304
|
-
if (config.customEnvironments) {
|
|
305
|
-
for (const [name, customEnv] of Object.entries(config.customEnvironments)) {
|
|
306
|
-
result[name] = {
|
|
307
|
-
name,
|
|
308
|
-
displayName: customEnv.displayName || name,
|
|
309
|
-
authBaseUrl: customEnv.authBaseUrl,
|
|
310
|
-
apiBaseUrl: customEnv.apiBaseUrl,
|
|
311
|
-
clientId: customEnv.clientId
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
return result;
|
|
316
|
-
}
|
|
317
300
|
function getDefaultEnvironment() {
|
|
318
301
|
const envFromVar = process.env.WUKONG_CLI_ENV;
|
|
319
302
|
if (envFromVar && isValidEnvironment(envFromVar)) {
|
|
@@ -568,7 +551,7 @@ var init_ora_ui_callbacks = __esm({
|
|
|
568
551
|
});
|
|
569
552
|
|
|
570
553
|
// src/core/auth/keytar-adapter.ts
|
|
571
|
-
import { createRequire } from "module";
|
|
554
|
+
import { createRequire as createRequire2 } from "module";
|
|
572
555
|
function isKeytarAvailable() {
|
|
573
556
|
return keytarModule !== null;
|
|
574
557
|
}
|
|
@@ -590,15 +573,15 @@ async function deletePassword(service, account) {
|
|
|
590
573
|
}
|
|
591
574
|
return await keytarModule.deletePassword(service, account);
|
|
592
575
|
}
|
|
593
|
-
var
|
|
576
|
+
var require3, keytarModule;
|
|
594
577
|
var init_keytar_adapter = __esm({
|
|
595
578
|
"src/core/auth/keytar-adapter.ts"() {
|
|
596
579
|
"use strict";
|
|
597
580
|
init_esm_shims();
|
|
598
|
-
|
|
581
|
+
require3 = createRequire2(import.meta.url);
|
|
599
582
|
keytarModule = null;
|
|
600
583
|
try {
|
|
601
|
-
keytarModule =
|
|
584
|
+
keytarModule = require3("keytar");
|
|
602
585
|
} catch (error2) {
|
|
603
586
|
keytarModule = null;
|
|
604
587
|
}
|
|
@@ -795,9 +778,18 @@ var init_token_cache = __esm({
|
|
|
795
778
|
|
|
796
779
|
// src/cli.ts
|
|
797
780
|
init_esm_shims();
|
|
798
|
-
init_debug();
|
|
799
781
|
import { Command as Command6 } from "commander";
|
|
800
782
|
|
|
783
|
+
// src/version.ts
|
|
784
|
+
init_esm_shims();
|
|
785
|
+
import { createRequire } from "module";
|
|
786
|
+
var require2 = createRequire(import.meta.url);
|
|
787
|
+
var pkg = require2("../package.json");
|
|
788
|
+
var CLI_VERSION = pkg.version;
|
|
789
|
+
|
|
790
|
+
// src/cli.ts
|
|
791
|
+
init_debug();
|
|
792
|
+
|
|
801
793
|
// src/utils/version/index.ts
|
|
802
794
|
init_esm_shims();
|
|
803
795
|
|
|
@@ -2098,16 +2090,18 @@ function getClient() {
|
|
|
2098
2090
|
}
|
|
2099
2091
|
|
|
2100
2092
|
// src/commands/auth.ts
|
|
2093
|
+
init_environments();
|
|
2101
2094
|
init_oceanet();
|
|
2102
|
-
|
|
2095
|
+
function resolveEnvContext() {
|
|
2096
|
+
const env = getCurrentEnvironment();
|
|
2097
|
+
setCurrentEnvironment(env);
|
|
2098
|
+
return { env, envConfig: ENVIRONMENTS[env] };
|
|
2099
|
+
}
|
|
2103
2100
|
var authCommands = new Command("auth").description("Authentication commands");
|
|
2104
2101
|
authCommands.command("login").description("Login using Device Authorization Flow").action(async () => {
|
|
2105
2102
|
try {
|
|
2106
|
-
const env =
|
|
2107
|
-
const allEnvs = getAllEnvironments();
|
|
2108
|
-
setCurrentEnvironment(env);
|
|
2103
|
+
const { env, envConfig } = resolveEnvContext();
|
|
2109
2104
|
const config = getOceanetConfig();
|
|
2110
|
-
const envConfig = allEnvs[env];
|
|
2111
2105
|
console.log("");
|
|
2112
2106
|
console.log(chalk5.bgBlue.white.bold(" Wukong CLI Login "));
|
|
2113
2107
|
console.log("");
|
|
@@ -2175,10 +2169,7 @@ authCommands.command("login").description("Login using Device Authorization Flow
|
|
|
2175
2169
|
}
|
|
2176
2170
|
});
|
|
2177
2171
|
authCommands.command("logout").description("Logout and clear saved tokens").action(async () => {
|
|
2178
|
-
const env =
|
|
2179
|
-
const allEnvs = getAllEnvironments();
|
|
2180
|
-
setCurrentEnvironment(env);
|
|
2181
|
-
const envConfig = allEnvs[env];
|
|
2172
|
+
const { env, envConfig } = resolveEnvContext();
|
|
2182
2173
|
try {
|
|
2183
2174
|
const accessToken = await getAccessToken();
|
|
2184
2175
|
const ystAccessToken = await getYstAccessToken();
|
|
@@ -2195,9 +2186,7 @@ authCommands.command("logout").description("Logout and clear saved tokens").acti
|
|
|
2195
2186
|
}
|
|
2196
2187
|
});
|
|
2197
2188
|
authCommands.command("refresh").description("Manually refresh access token").action(async () => {
|
|
2198
|
-
const env =
|
|
2199
|
-
const allEnvs = getAllEnvironments();
|
|
2200
|
-
const envConfig = allEnvs[env];
|
|
2189
|
+
const { env, envConfig } = resolveEnvContext();
|
|
2201
2190
|
try {
|
|
2202
2191
|
const config = getOceanetConfig();
|
|
2203
2192
|
const accessToken = await getAccessToken();
|
|
@@ -2243,10 +2232,7 @@ authCommands.command("refresh").description("Manually refresh access token").act
|
|
|
2243
2232
|
});
|
|
2244
2233
|
authCommands.command("status").description("Show authentication status").action(async () => {
|
|
2245
2234
|
console.log("");
|
|
2246
|
-
const env =
|
|
2247
|
-
const allEnvs = getAllEnvironments();
|
|
2248
|
-
setCurrentEnvironment(env);
|
|
2249
|
-
const envConfig = allEnvs[env];
|
|
2235
|
+
const { env, envConfig } = resolveEnvContext();
|
|
2250
2236
|
try {
|
|
2251
2237
|
const config = getOceanetConfig();
|
|
2252
2238
|
const accessToken = await getAccessToken();
|
|
@@ -2298,10 +2284,7 @@ authCommands.command("status").description("Show authentication status").action(
|
|
|
2298
2284
|
});
|
|
2299
2285
|
authCommands.command("token").description("Display current token structure and JWT payload claims").action(async () => {
|
|
2300
2286
|
console.log("");
|
|
2301
|
-
const env =
|
|
2302
|
-
const allEnvs = getAllEnvironments();
|
|
2303
|
-
setCurrentEnvironment(env);
|
|
2304
|
-
const envConfig = allEnvs[env];
|
|
2287
|
+
const { env, envConfig } = resolveEnvContext();
|
|
2305
2288
|
try {
|
|
2306
2289
|
let decodeJwt2 = function(token) {
|
|
2307
2290
|
try {
|
|
@@ -3182,7 +3165,7 @@ async function runUpdateCommand({
|
|
|
3182
3165
|
}
|
|
3183
3166
|
var updateCommand = new Command5("update").description("Update wukong-cli to the latest npm version").action(async () => {
|
|
3184
3167
|
const exitCode = await runUpdateCommand({
|
|
3185
|
-
currentVersion:
|
|
3168
|
+
currentVersion: CLI_VERSION,
|
|
3186
3169
|
versionProvider: new NpmVersionProvider(
|
|
3187
3170
|
"@zrhsh/wukong-cli",
|
|
3188
3171
|
"https://registry.npmjs.org"
|
|
@@ -3197,7 +3180,7 @@ var updateCommand = new Command5("update").description("Update wukong-cli to the
|
|
|
3197
3180
|
|
|
3198
3181
|
// src/cli.ts
|
|
3199
3182
|
var program = new Command6();
|
|
3200
|
-
program.name("wukong-cli").description("Wukong CLI - TypeScript implementation").version(
|
|
3183
|
+
program.name("wukong-cli").description("Wukong CLI - TypeScript implementation").version(CLI_VERSION).option("--debug", "Enable debug mode (show HTTP requests)").hook("preAction", (thisCommand) => {
|
|
3201
3184
|
const options = thisCommand.opts();
|
|
3202
3185
|
if (options.debug === true) {
|
|
3203
3186
|
setDebugMode(true, true);
|
|
@@ -3216,7 +3199,7 @@ if (process.argv.length === 2) {
|
|
|
3216
3199
|
program.parse();
|
|
3217
3200
|
setImmediate(() => {
|
|
3218
3201
|
try {
|
|
3219
|
-
const versionChecker = getVersionChecker(
|
|
3202
|
+
const versionChecker = getVersionChecker(CLI_VERSION);
|
|
3220
3203
|
const notifier = new ConsoleNotifier();
|
|
3221
3204
|
versionChecker.checkInBackground(notifier).catch(() => {
|
|
3222
3205
|
});
|