@kevisual/cli 0.0.80 → 0.0.81
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/assistant-server.js +34548 -641
- package/dist/assistant.js +30 -30
- package/dist/envision.js +108 -5
- package/package.json +1 -1
package/dist/assistant.js
CHANGED
|
@@ -3352,12 +3352,12 @@ var require_common = __commonJS((exports, module) => {
|
|
|
3352
3352
|
createDebug.skips = [];
|
|
3353
3353
|
createDebug.formatters = {};
|
|
3354
3354
|
function selectColor(namespace) {
|
|
3355
|
-
let
|
|
3355
|
+
let hash2 = 0;
|
|
3356
3356
|
for (let i = 0;i < namespace.length; i++) {
|
|
3357
|
-
|
|
3358
|
-
|
|
3357
|
+
hash2 = (hash2 << 5) - hash2 + namespace.charCodeAt(i);
|
|
3358
|
+
hash2 |= 0;
|
|
3359
3359
|
}
|
|
3360
|
-
return createDebug.colors[Math.abs(
|
|
3360
|
+
return createDebug.colors[Math.abs(hash2) % createDebug.colors.length];
|
|
3361
3361
|
}
|
|
3362
3362
|
createDebug.selectColor = selectColor;
|
|
3363
3363
|
function createDebug(namespace) {
|
|
@@ -4078,9 +4078,9 @@ var require_etag = __commonJS((exports, module) => {
|
|
|
4078
4078
|
if (entity.length === 0) {
|
|
4079
4079
|
return '"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"';
|
|
4080
4080
|
}
|
|
4081
|
-
var
|
|
4081
|
+
var hash2 = crypto2.createHash("sha1").update(entity, "utf8").digest("base64").substring(0, 27);
|
|
4082
4082
|
var len = typeof entity === "string" ? Buffer.byteLength(entity, "utf8") : entity.length;
|
|
4083
|
-
return '"' + len.toString(16) + "-" +
|
|
4083
|
+
return '"' + len.toString(16) + "-" + hash2 + '"';
|
|
4084
4084
|
}
|
|
4085
4085
|
function etag(entity, options) {
|
|
4086
4086
|
if (entity == null) {
|
|
@@ -43958,12 +43958,12 @@ var require_spanningCellManager = __commonJS((exports) => {
|
|
|
43958
43958
|
rowHeights
|
|
43959
43959
|
});
|
|
43960
43960
|
}
|
|
43961
|
-
const
|
|
43962
|
-
(_a2 = rangeCache[
|
|
43961
|
+
const hash2 = hashRange(range);
|
|
43962
|
+
(_a2 = rangeCache[hash2]) !== null && _a2 !== undefined || (rangeCache[hash2] = getContainingRange(range, {
|
|
43963
43963
|
...parameters,
|
|
43964
43964
|
rowHeights
|
|
43965
43965
|
}));
|
|
43966
|
-
return rangeCache[
|
|
43966
|
+
return rangeCache[hash2];
|
|
43967
43967
|
},
|
|
43968
43968
|
inSameRange: (cell1, cell2) => {
|
|
43969
43969
|
return inSameRange(cell1, cell2, ranges);
|
|
@@ -44460,6 +44460,13 @@ var parseIfJson = (content) => {
|
|
|
44460
44460
|
return {};
|
|
44461
44461
|
}
|
|
44462
44462
|
};
|
|
44463
|
+
// src/module/assistant/proxy/utils.ts
|
|
44464
|
+
var isBun = typeof Bun !== "undefined" && Bun?.version != null;
|
|
44465
|
+
var isNode = typeof process !== "undefined" && process?.versions != null && process.versions?.node != null;
|
|
44466
|
+
var isDeno = typeof Deno !== "undefined" && Deno?.version != null && Deno?.version?.deno != null;
|
|
44467
|
+
|
|
44468
|
+
// src/module/assistant/proxy/s3.ts
|
|
44469
|
+
var mapS3 = new Map;
|
|
44463
44470
|
// src/module/assistant/proxy/file-proxy.ts
|
|
44464
44471
|
var import_send = __toESM(require_send(), 1);
|
|
44465
44472
|
|
|
@@ -44560,11 +44567,6 @@ var console2 = {
|
|
|
44560
44567
|
|
|
44561
44568
|
// src/module/assistant/proxy/index.ts
|
|
44562
44569
|
var import_send2 = __toESM(require_send(), 1);
|
|
44563
|
-
|
|
44564
|
-
// src/module/assistant/proxy/utils.ts
|
|
44565
|
-
var isBun = typeof Bun !== "undefined" && Bun?.version != null;
|
|
44566
|
-
var isNode = typeof process !== "undefined" && process?.versions != null && process.versions?.node != null;
|
|
44567
|
-
var isDeno = typeof Deno !== "undefined" && Deno?.version != null && Deno?.version?.deno != null;
|
|
44568
44570
|
// ../node_modules/.pnpm/@kevisual+local-app-manager@0.1.32_supports-color@10.2.2/node_modules/@kevisual/local-app-manager/dist/manager.mjs
|
|
44569
44571
|
var exports_manager = {};
|
|
44570
44572
|
__export(exports_manager, {
|
|
@@ -53240,7 +53242,6 @@ var LoadApp = async (app, opts) => {
|
|
|
53240
53242
|
console.log("gateway app not support");
|
|
53241
53243
|
} else if (app.type === "pm2-system-app" /* Pm2SystemApp */) {
|
|
53242
53244
|
const pathEntry2 = path6.join(app.path, app.entry);
|
|
53243
|
-
console.log("pm2 system app start", pathEntry2);
|
|
53244
53245
|
const pm2Manager = new Pm2Manager2({
|
|
53245
53246
|
appName: app.key,
|
|
53246
53247
|
script: pathEntry2,
|
|
@@ -53260,7 +53261,6 @@ var LoadApp = async (app, opts) => {
|
|
|
53260
53261
|
if (!pm2Options.cwd) {
|
|
53261
53262
|
pm2Options.cwd = path6.join(app.path, "../..");
|
|
53262
53263
|
}
|
|
53263
|
-
console.log("pm2 start options", pm2Options);
|
|
53264
53264
|
await pm2Manager.start(pm2Options);
|
|
53265
53265
|
} else if (app.type === "script-app" /* ScriptApp */) {
|
|
53266
53266
|
return true;
|
|
@@ -54390,7 +54390,7 @@ var source_default = chalk;
|
|
|
54390
54390
|
// src/module/chalk.ts
|
|
54391
54391
|
var chalk2 = new Chalk({ level: 3 });
|
|
54392
54392
|
|
|
54393
|
-
// ../node_modules/.pnpm/@kevisual+router@0.0.
|
|
54393
|
+
// ../node_modules/.pnpm/@kevisual+router@0.0.52_supports-color@10.2.2/node_modules/@kevisual/router/dist/router-sign.js
|
|
54394
54394
|
import require$$1 from "node:crypto";
|
|
54395
54395
|
var commonjsGlobal2 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
54396
54396
|
function getAugmentedNamespace(n) {
|
|
@@ -63921,8 +63921,8 @@ var EcAlgorithm = EcAlgorithm_1 = class EcAlgorithm2 {
|
|
|
63921
63921
|
switch (alg.name.toLowerCase()) {
|
|
63922
63922
|
case ECDSA.toLowerCase():
|
|
63923
63923
|
if ("hash" in alg) {
|
|
63924
|
-
const
|
|
63925
|
-
switch (
|
|
63924
|
+
const hash2 = typeof alg.hash === "string" ? alg.hash : alg.hash.name;
|
|
63925
|
+
switch (hash2.toLowerCase()) {
|
|
63926
63926
|
case "sha-1":
|
|
63927
63927
|
return ecdsaWithSHA1;
|
|
63928
63928
|
case "sha-256":
|
|
@@ -65703,8 +65703,8 @@ class AsnDefaultSignatureFormatter {
|
|
|
65703
65703
|
}
|
|
65704
65704
|
var RsaAlgorithm_1;
|
|
65705
65705
|
var RsaAlgorithm = RsaAlgorithm_1 = class RsaAlgorithm2 {
|
|
65706
|
-
static createPssParams(
|
|
65707
|
-
const hashAlgorithm = RsaAlgorithm_1.getHashAlgorithm(
|
|
65706
|
+
static createPssParams(hash2, saltLength) {
|
|
65707
|
+
const hashAlgorithm = RsaAlgorithm_1.getHashAlgorithm(hash2);
|
|
65708
65708
|
if (!hashAlgorithm) {
|
|
65709
65709
|
return null;
|
|
65710
65710
|
}
|
|
@@ -65731,15 +65731,15 @@ var RsaAlgorithm = RsaAlgorithm_1 = class RsaAlgorithm2 {
|
|
|
65731
65731
|
switch (alg.name.toLowerCase()) {
|
|
65732
65732
|
case "rsassa-pkcs1-v1_5":
|
|
65733
65733
|
if ("hash" in alg) {
|
|
65734
|
-
let
|
|
65734
|
+
let hash2;
|
|
65735
65735
|
if (typeof alg.hash === "string") {
|
|
65736
|
-
|
|
65736
|
+
hash2 = alg.hash;
|
|
65737
65737
|
} else if (alg.hash && typeof alg.hash === "object" && "name" in alg.hash && typeof alg.hash.name === "string") {
|
|
65738
|
-
|
|
65738
|
+
hash2 = alg.hash.name.toUpperCase();
|
|
65739
65739
|
} else {
|
|
65740
65740
|
throw new Error("Cannot get hash algorithm name");
|
|
65741
65741
|
}
|
|
65742
|
-
switch (
|
|
65742
|
+
switch (hash2.toLowerCase()) {
|
|
65743
65743
|
case "sha-1":
|
|
65744
65744
|
return new AlgorithmIdentifier({
|
|
65745
65745
|
algorithm: id_sha1WithRSAEncryption,
|
|
@@ -71822,8 +71822,8 @@ var require_core = __commonJS2((exports, module) => {
|
|
|
71822
71822
|
if (messageUpdate) {
|
|
71823
71823
|
this._append(messageUpdate);
|
|
71824
71824
|
}
|
|
71825
|
-
var
|
|
71826
|
-
return
|
|
71825
|
+
var hash2 = this._doFinalize();
|
|
71826
|
+
return hash2;
|
|
71827
71827
|
},
|
|
71828
71828
|
blockSize: 512 / 32,
|
|
71829
71829
|
_createHelper: function(hasher) {
|
|
@@ -72060,13 +72060,13 @@ var require_md5 = __commonJS2((exports, module) => {
|
|
|
72060
72060
|
dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = (nBitsTotalL << 8 | nBitsTotalL >>> 24) & 16711935 | (nBitsTotalL << 24 | nBitsTotalL >>> 8) & 4278255360;
|
|
72061
72061
|
data.sigBytes = (dataWords.length + 1) * 4;
|
|
72062
72062
|
this._process();
|
|
72063
|
-
var
|
|
72064
|
-
var H =
|
|
72063
|
+
var hash2 = this._hash;
|
|
72064
|
+
var H = hash2.words;
|
|
72065
72065
|
for (var i = 0;i < 4; i++) {
|
|
72066
72066
|
var H_i = H[i];
|
|
72067
72067
|
H[i] = (H_i << 8 | H_i >>> 24) & 16711935 | (H_i << 24 | H_i >>> 8) & 4278255360;
|
|
72068
72068
|
}
|
|
72069
|
-
return
|
|
72069
|
+
return hash2;
|
|
72070
72070
|
},
|
|
72071
72071
|
clone: function() {
|
|
72072
72072
|
var clone = Hasher.clone.call(this);
|
package/dist/envision.js
CHANGED
|
@@ -26226,12 +26226,26 @@ var pick = (obj, keys) => {
|
|
|
26226
26226
|
return acc;
|
|
26227
26227
|
}, {});
|
|
26228
26228
|
};
|
|
26229
|
-
var loginCommand = new Command("login").description("Login to the application").option("-u, --username <username>", "Specify username").option("-p, --password <password>", "Specify password").option("-f, --force", "Force login").option("-w, --web", "Login on the web").action(async (options) => {
|
|
26229
|
+
var loginCommand = new Command("login").description("Login to the application").option("-u, --username <username>", "Specify username").option("-p, --password <password>", "Specify password").option("-f, --force", "Force login").option("-w, --web", "Login on the web").option("-e, --env", "Login from KEVISUAL_TOKEN environment variable").action(async (options) => {
|
|
26230
26230
|
let { username, password: password2 } = options;
|
|
26231
26231
|
if (options.web) {
|
|
26232
26232
|
await loginInCommand();
|
|
26233
26233
|
return;
|
|
26234
26234
|
}
|
|
26235
|
+
if (options.env) {
|
|
26236
|
+
const envToken = getEnvToken();
|
|
26237
|
+
if (!envToken) {
|
|
26238
|
+
console.log("环境变量 KEVISUAL_TOKEN 未设置");
|
|
26239
|
+
return;
|
|
26240
|
+
}
|
|
26241
|
+
const res2 = await showMe(false);
|
|
26242
|
+
if (res2.code === 200) {
|
|
26243
|
+
console.log("Login success:", res2.data?.username || res2.data?.email);
|
|
26244
|
+
} else {
|
|
26245
|
+
console.log("Login failed:", res2.message || "Invalid token");
|
|
26246
|
+
}
|
|
26247
|
+
return;
|
|
26248
|
+
}
|
|
26235
26249
|
if (!username) {
|
|
26236
26250
|
username = await dist_default3({
|
|
26237
26251
|
message: "Enter your username:"
|
|
@@ -28645,13 +28659,14 @@ var checkAuth = (value = "", baseURL3 = "") => {
|
|
|
28645
28659
|
}
|
|
28646
28660
|
return false;
|
|
28647
28661
|
};
|
|
28662
|
+
var DEFAULT_IGNORE = ["node_modules/**", ".git/**", ".next/**", ".astro/**", ".pack-dist/**"];
|
|
28648
28663
|
|
|
28649
28664
|
class SyncBase {
|
|
28650
28665
|
config;
|
|
28651
28666
|
#filename;
|
|
28652
28667
|
#dir;
|
|
28653
28668
|
baseURL;
|
|
28654
|
-
defaultIgnore =
|
|
28669
|
+
defaultIgnore = DEFAULT_IGNORE;
|
|
28655
28670
|
constructor(opts) {
|
|
28656
28671
|
const filename = opts?.configFilename || "kevisual.json";
|
|
28657
28672
|
const dir = opts?.dir || process.cwd();
|
|
@@ -33949,7 +33964,7 @@ var useKey = (key, opts) => {
|
|
|
33949
33964
|
// src/command/cc.ts
|
|
33950
33965
|
import os4 from "node:os";
|
|
33951
33966
|
import fs18 from "node:fs";
|
|
33952
|
-
var MODELS = ["minimax", "glm"];
|
|
33967
|
+
var MODELS = ["minimax", "glm", "volcengine"];
|
|
33953
33968
|
var changeMinimax = (token2) => {
|
|
33954
33969
|
const auth_token = token2 || useKey("MINIMAX_API_KEY");
|
|
33955
33970
|
return {
|
|
@@ -33978,6 +33993,20 @@ var changeGLM = (token2) => {
|
|
|
33978
33993
|
}
|
|
33979
33994
|
};
|
|
33980
33995
|
};
|
|
33996
|
+
var changeVolcengine = (token2) => {
|
|
33997
|
+
const auth_token = token2 || useKey("VOLCENGINE_API_KEY");
|
|
33998
|
+
return {
|
|
33999
|
+
env: {
|
|
34000
|
+
ANTHROPIC_AUTH_TOKEN: auth_token,
|
|
34001
|
+
ANTHROPIC_BASE_URL: "https://ark.cn-beijing.volces.com/api/coding",
|
|
34002
|
+
ANTHROPIC_DEFAULT_HAIKU_MODEL: "ark-code-latest",
|
|
34003
|
+
ANTHROPIC_DEFAULT_OPUS_MODEL: "ark-code-latest",
|
|
34004
|
+
ANTHROPIC_DEFAULT_SONNET_MODEL: "ark-code-latest",
|
|
34005
|
+
ANTHROPIC_MODEL: "ark-code-latest",
|
|
34006
|
+
API_TIMEOUT_MS: "3000000"
|
|
34007
|
+
}
|
|
34008
|
+
};
|
|
34009
|
+
};
|
|
33981
34010
|
var changeNoCheck = () => {
|
|
33982
34011
|
const homeDir = os4.homedir();
|
|
33983
34012
|
const claudeConfigPath = path14.join(homeDir, ".claude.json");
|
|
@@ -33998,7 +34027,8 @@ var changeNoCheck = () => {
|
|
|
33998
34027
|
};
|
|
33999
34028
|
var modelConfig = {
|
|
34000
34029
|
minimax: changeMinimax,
|
|
34001
|
-
glm: changeGLM
|
|
34030
|
+
glm: changeGLM,
|
|
34031
|
+
volcengine: changeVolcengine
|
|
34002
34032
|
};
|
|
34003
34033
|
var readOrCreateConfig = (configPath2) => {
|
|
34004
34034
|
if (fs18.existsSync(configPath2)) {
|
|
@@ -34014,7 +34044,7 @@ var readOrCreateConfig = (configPath2) => {
|
|
|
34014
34044
|
var saveConfig = (configPath2, config2) => {
|
|
34015
34045
|
fs18.writeFileSync(configPath2, JSON.stringify(config2, null, 2));
|
|
34016
34046
|
};
|
|
34017
|
-
var command11 = new Command("cc").description("切换claude code模型,支持GLM4.7
|
|
34047
|
+
var command11 = new Command("cc").description("切换claude code模型,支持GLM4.7、Minimax和豆包").option("-m, --models <model:string>", `选择模型: ${MODELS.join(" | ")}`).action(async (options) => {
|
|
34018
34048
|
const configPath2 = path14.join(os4.homedir(), ".claude/settings.json");
|
|
34019
34049
|
const config2 = readOrCreateConfig(configPath2);
|
|
34020
34050
|
let selectedModel;
|
|
@@ -34035,6 +34065,79 @@ var command11 = new Command("cc").description("切换claude code模型,支持G
|
|
|
34035
34065
|
});
|
|
34036
34066
|
program.addCommand(command11);
|
|
34037
34067
|
|
|
34068
|
+
// src/command/docker.ts
|
|
34069
|
+
import { spawn as spawn4 } from "node:child_process";
|
|
34070
|
+
var dockerCommand = new Command("docker").description("Docker 相关指令").action(async () => {
|
|
34071
|
+
console.log(chalk2.green("Docker command executed"));
|
|
34072
|
+
});
|
|
34073
|
+
var login = new Command("login").description("登录 Docker 镜像仓库").option("-r , --registry <registry>", "Docker 镜像仓库地址", "default").action(async (options) => {
|
|
34074
|
+
const { registry = "default" } = options;
|
|
34075
|
+
let DOCKER_USERNAME = useKey("DOCKER_USERNAME");
|
|
34076
|
+
let DOCKER_PASSWORD = useKey("DOCKER_PASSWORD");
|
|
34077
|
+
let DOCKER_REGISTRY = useKey("DOCKER_REGISTRY");
|
|
34078
|
+
if (registry !== "default") {
|
|
34079
|
+
DOCKER_USERNAME = "cnb";
|
|
34080
|
+
DOCKER_PASSWORD = useKey("CNB_TOKEN");
|
|
34081
|
+
DOCKER_REGISTRY = "docker.cnb.cool";
|
|
34082
|
+
}
|
|
34083
|
+
if (!DOCKER_USERNAME || !DOCKER_PASSWORD) {
|
|
34084
|
+
console.log(chalk2.red("请先配置 DOCKER_USERNAME 和 DOCKER_PASSWORD"));
|
|
34085
|
+
return;
|
|
34086
|
+
}
|
|
34087
|
+
const loginProcess = spawn4("docker", [
|
|
34088
|
+
"login",
|
|
34089
|
+
"--username",
|
|
34090
|
+
DOCKER_USERNAME,
|
|
34091
|
+
DOCKER_REGISTRY,
|
|
34092
|
+
"--password-stdin"
|
|
34093
|
+
], {
|
|
34094
|
+
stdio: ["pipe", "inherit", "inherit"]
|
|
34095
|
+
});
|
|
34096
|
+
loginProcess.stdin.write(DOCKER_PASSWORD + `
|
|
34097
|
+
`);
|
|
34098
|
+
loginProcess.stdin.end();
|
|
34099
|
+
loginProcess.on("close", (code) => {
|
|
34100
|
+
if (code === 0) {
|
|
34101
|
+
console.log(chalk2.green("登录成功"));
|
|
34102
|
+
} else {
|
|
34103
|
+
console.log(chalk2.red(`登录失败,退出码:${code}`));
|
|
34104
|
+
}
|
|
34105
|
+
});
|
|
34106
|
+
});
|
|
34107
|
+
dockerCommand.addCommand(login);
|
|
34108
|
+
var helmLogin = new Command("helm").description("Helm 登录镜像仓库").action(async () => {});
|
|
34109
|
+
var helmLoginCommand = new Command("login").description("登录 Helm 镜像仓库").action(async () => {
|
|
34110
|
+
let DOCKER_USERNAME = "cnb";
|
|
34111
|
+
let DOCKER_PASSWORD = useKey("CNB_TOKEN");
|
|
34112
|
+
if (!DOCKER_PASSWORD) {
|
|
34113
|
+
console.log(chalk2.red("请先配置 CNB_TOKEN"));
|
|
34114
|
+
return;
|
|
34115
|
+
}
|
|
34116
|
+
const helmLoginProcess = spawn4("helm", [
|
|
34117
|
+
"registry",
|
|
34118
|
+
"login",
|
|
34119
|
+
"--username",
|
|
34120
|
+
DOCKER_USERNAME,
|
|
34121
|
+
"--password-stdin",
|
|
34122
|
+
"helm.cnb.cool"
|
|
34123
|
+
], {
|
|
34124
|
+
stdio: ["pipe", "inherit", "inherit"]
|
|
34125
|
+
});
|
|
34126
|
+
helmLoginProcess.stdin.write(DOCKER_PASSWORD + `
|
|
34127
|
+
`);
|
|
34128
|
+
helmLoginProcess.stdin.end();
|
|
34129
|
+
helmLoginProcess.on("close", (code) => {
|
|
34130
|
+
if (code === 0) {
|
|
34131
|
+
console.log(chalk2.green("Helm 登录成功"));
|
|
34132
|
+
} else {
|
|
34133
|
+
console.log(chalk2.red(`Helm 登录失败,退出码:${code}`));
|
|
34134
|
+
}
|
|
34135
|
+
});
|
|
34136
|
+
});
|
|
34137
|
+
helmLogin.addCommand(helmLoginCommand);
|
|
34138
|
+
program.addCommand(dockerCommand);
|
|
34139
|
+
program.addCommand(helmLogin);
|
|
34140
|
+
|
|
34038
34141
|
// src/index.ts
|
|
34039
34142
|
var runParser = async (argv) => {
|
|
34040
34143
|
program.parse(argv);
|