@shi_zhen/code-helper 0.1.4 → 0.1.6
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/index.js +206 -109
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +210 -109
- package/dist/cli/index.mjs.map +1 -1
- package/dist/index.d.mts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +0 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +0 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -31,14 +31,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
31
31
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
32
32
|
mod
|
|
33
33
|
));
|
|
34
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
34
|
|
|
36
35
|
// package.json
|
|
37
36
|
var require_package = __commonJS({
|
|
38
37
|
"package.json"(exports2, module2) {
|
|
39
38
|
module2.exports = {
|
|
40
39
|
name: "@shi_zhen/code-helper",
|
|
41
|
-
version: "0.1.
|
|
40
|
+
version: "0.1.6",
|
|
42
41
|
description: "Code Helper - A unified tool to manage your Claude Code",
|
|
43
42
|
repository: {
|
|
44
43
|
type: "git",
|
|
@@ -182,8 +181,7 @@ __export(version_exports, {
|
|
|
182
181
|
testUpdate: () => testUpdate
|
|
183
182
|
});
|
|
184
183
|
function getLocalVersion() {
|
|
185
|
-
|
|
186
|
-
return pkg3.version;
|
|
184
|
+
return import_package.default.version;
|
|
187
185
|
}
|
|
188
186
|
async function getRemoteVersion() {
|
|
189
187
|
try {
|
|
@@ -198,10 +196,10 @@ async function getRemoteVersion() {
|
|
|
198
196
|
}
|
|
199
197
|
function readCache() {
|
|
200
198
|
try {
|
|
201
|
-
if (!
|
|
199
|
+
if (!import_fs10.default.existsSync(CACHE_FILE)) {
|
|
202
200
|
return null;
|
|
203
201
|
}
|
|
204
|
-
const content =
|
|
202
|
+
const content = import_fs10.default.readFileSync(CACHE_FILE, "utf-8");
|
|
205
203
|
return JSON.parse(content);
|
|
206
204
|
} catch {
|
|
207
205
|
return null;
|
|
@@ -209,10 +207,10 @@ function readCache() {
|
|
|
209
207
|
}
|
|
210
208
|
function writeCache(data) {
|
|
211
209
|
try {
|
|
212
|
-
if (!
|
|
213
|
-
|
|
210
|
+
if (!import_fs10.default.existsSync(CACHE_DIR)) {
|
|
211
|
+
import_fs10.default.mkdirSync(CACHE_DIR, { recursive: true });
|
|
214
212
|
}
|
|
215
|
-
|
|
213
|
+
import_fs10.default.writeFileSync(CACHE_FILE, JSON.stringify(data, null, 2));
|
|
216
214
|
} catch (error) {
|
|
217
215
|
}
|
|
218
216
|
}
|
|
@@ -312,18 +310,19 @@ async function testUpdate() {
|
|
|
312
310
|
import_chalk3.default.cyan("\n\u{1F4A1} \u63D0\u793A: \u53D1\u5E03\u65B0\u7248\u672C\u540E\uFF0C\u7528\u6237\u9996\u6B21\u542F\u52A8\u65F6\u4F1A\u81EA\u52A8\u66F4\u65B0\n")
|
|
313
311
|
);
|
|
314
312
|
}
|
|
315
|
-
var import_chalk3, import_ora7,
|
|
313
|
+
var import_chalk3, import_ora7, import_os11, import_path11, import_fs10, import_package, CACHE_DIR, CACHE_FILE, CHECK_INTERVAL;
|
|
316
314
|
var init_version = __esm({
|
|
317
315
|
"src/cli/utils/version.ts"() {
|
|
318
316
|
"use strict";
|
|
319
317
|
import_chalk3 = __toESM(require("chalk"));
|
|
320
318
|
import_ora7 = __toESM(require("ora"));
|
|
319
|
+
import_os11 = __toESM(require("os"));
|
|
320
|
+
import_path11 = __toESM(require("path"));
|
|
321
|
+
import_fs10 = __toESM(require("fs"));
|
|
321
322
|
init_exec();
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
CACHE_DIR = path11.join(os11.homedir(), ".code-helper");
|
|
326
|
-
CACHE_FILE = path11.join(CACHE_DIR, "version-check.json");
|
|
323
|
+
import_package = __toESM(require_package());
|
|
324
|
+
CACHE_DIR = import_path11.default.join(import_os11.default.homedir(), ".code-helper");
|
|
325
|
+
CACHE_FILE = import_path11.default.join(CACHE_DIR, "version-check.json");
|
|
327
326
|
CHECK_INTERVAL = 24 * 60 * 60 * 1e3;
|
|
328
327
|
}
|
|
329
328
|
});
|
|
@@ -698,6 +697,15 @@ function switchProfile(id) {
|
|
|
698
697
|
if (profile.timeout) {
|
|
699
698
|
settings.env.API_TIMEOUT_MS = profile.timeout;
|
|
700
699
|
}
|
|
700
|
+
if (profile.haikuModel) {
|
|
701
|
+
settings.env.ANTHROPIC_DEFAULT_HAIKU_MODEL = profile.haikuModel;
|
|
702
|
+
}
|
|
703
|
+
if (profile.sonnetModel) {
|
|
704
|
+
settings.env.ANTHROPIC_DEFAULT_SONNET_MODEL = profile.sonnetModel;
|
|
705
|
+
}
|
|
706
|
+
if (profile.opusModel) {
|
|
707
|
+
settings.env.ANTHROPIC_DEFAULT_OPUS_MODEL = profile.opusModel;
|
|
708
|
+
}
|
|
701
709
|
writeClaudeSettings(settings);
|
|
702
710
|
config.currentProfileId = id;
|
|
703
711
|
writeProfiles(config);
|
|
@@ -718,14 +726,14 @@ var import_ora = __toESM(require("ora"));
|
|
|
718
726
|
// src/cli/utils/api.ts
|
|
719
727
|
var import_http = __toESM(require("http"));
|
|
720
728
|
var import_https = __toESM(require("https"));
|
|
721
|
-
async function verifyApiKey(baseUrl, apiKey) {
|
|
729
|
+
async function verifyApiKey(baseUrl, apiKey, model) {
|
|
722
730
|
return new Promise((resolve) => {
|
|
723
731
|
try {
|
|
724
732
|
const url = new URL(baseUrl);
|
|
725
733
|
const isHttps = url.protocol === "https:";
|
|
726
734
|
const client = isHttps ? import_https.default : import_http.default;
|
|
727
735
|
const testPayload = JSON.stringify({
|
|
728
|
-
model: "claude-3-5-sonnet-20241022",
|
|
736
|
+
model: model || "claude-3-5-sonnet-20241022",
|
|
729
737
|
max_tokens: 1,
|
|
730
738
|
messages: [{ role: "user", content: "test" }]
|
|
731
739
|
});
|
|
@@ -815,6 +823,15 @@ async function showAuthMenu() {
|
|
|
815
823
|
console.log(
|
|
816
824
|
`${theme.dim(" API Key:")} ${maskApiKey(currentProfile.apiKey)}`
|
|
817
825
|
);
|
|
826
|
+
if (currentProfile.haikuModel) {
|
|
827
|
+
console.log(`${theme.dim(" Haiku Model:")} ${currentProfile.haikuModel}`);
|
|
828
|
+
}
|
|
829
|
+
if (currentProfile.sonnetModel) {
|
|
830
|
+
console.log(`${theme.dim(" Sonnet Model:")} ${currentProfile.sonnetModel}`);
|
|
831
|
+
}
|
|
832
|
+
if (currentProfile.opusModel) {
|
|
833
|
+
console.log(`${theme.dim(" Opus Model:")} ${currentProfile.opusModel}`);
|
|
834
|
+
}
|
|
818
835
|
console.log();
|
|
819
836
|
}
|
|
820
837
|
const savedProfiles = getAllProfiles();
|
|
@@ -1118,9 +1135,49 @@ async function handleManualAuth() {
|
|
|
1118
1135
|
}
|
|
1119
1136
|
}
|
|
1120
1137
|
]);
|
|
1138
|
+
let haikuModel;
|
|
1139
|
+
let sonnetModel;
|
|
1140
|
+
let opusModel;
|
|
1141
|
+
const { configModels } = await import_inquirer.default.prompt([
|
|
1142
|
+
{
|
|
1143
|
+
type: "confirm",
|
|
1144
|
+
name: "configModels",
|
|
1145
|
+
message: "\u662F\u5426\u9700\u8981\u914D\u7F6E\u6A21\u578B\u6620\u5C04\uFF1F\uFF08\u7528\u4E8E ZenMux \u7B49\u9700\u8981\u81EA\u5B9A\u4E49\u6A21\u578B\u7684\u5E73\u53F0\uFF09",
|
|
1146
|
+
default: false
|
|
1147
|
+
}
|
|
1148
|
+
]);
|
|
1149
|
+
if (configModels) {
|
|
1150
|
+
console.log();
|
|
1151
|
+
console.log(theme.dim("\u8BF7\u8F93\u5165\u5404\u6A21\u578B\u7684\u6620\u5C04\u540D\u79F0\uFF08\u76F4\u63A5\u56DE\u8F66\u8DF3\u8FC7\uFF09\uFF1A"));
|
|
1152
|
+
console.log();
|
|
1153
|
+
const modelAnswers = await import_inquirer.default.prompt([
|
|
1154
|
+
{
|
|
1155
|
+
type: "input",
|
|
1156
|
+
name: "haikuModel",
|
|
1157
|
+
message: "ANTHROPIC_DEFAULT_HAIKU_MODEL\uFF08\u5FEB\u901F\u6A21\u578B\uFF09:",
|
|
1158
|
+
default: ""
|
|
1159
|
+
},
|
|
1160
|
+
{
|
|
1161
|
+
type: "input",
|
|
1162
|
+
name: "sonnetModel",
|
|
1163
|
+
message: "ANTHROPIC_DEFAULT_SONNET_MODEL\uFF08\u5747\u8861\u6A21\u578B\uFF09:",
|
|
1164
|
+
default: ""
|
|
1165
|
+
},
|
|
1166
|
+
{
|
|
1167
|
+
type: "input",
|
|
1168
|
+
name: "opusModel",
|
|
1169
|
+
message: "ANTHROPIC_DEFAULT_OPUS_MODEL\uFF08\u6700\u5F3A\u6A21\u578B\uFF09:",
|
|
1170
|
+
default: ""
|
|
1171
|
+
}
|
|
1172
|
+
]);
|
|
1173
|
+
if (modelAnswers.haikuModel?.trim()) haikuModel = modelAnswers.haikuModel.trim();
|
|
1174
|
+
if (modelAnswers.sonnetModel?.trim()) sonnetModel = modelAnswers.sonnetModel.trim();
|
|
1175
|
+
if (modelAnswers.opusModel?.trim()) opusModel = modelAnswers.opusModel.trim();
|
|
1176
|
+
}
|
|
1177
|
+
const verifyModel = sonnetModel || haikuModel || opusModel;
|
|
1121
1178
|
console.log();
|
|
1122
1179
|
const spinner = (0, import_ora.default)("\u6B63\u5728\u9A8C\u8BC1 API Key...").start();
|
|
1123
|
-
const verification = await verifyApiKey(baseUrl.trim(), apiKey.trim());
|
|
1180
|
+
const verification = await verifyApiKey(baseUrl.trim(), apiKey.trim(), verifyModel);
|
|
1124
1181
|
if (!verification.valid) {
|
|
1125
1182
|
spinner.fail("API Key \u9A8C\u8BC1\u5931\u8D25");
|
|
1126
1183
|
console.log();
|
|
@@ -1134,6 +1191,9 @@ async function handleManualAuth() {
|
|
|
1134
1191
|
if (timeout && timeout.trim()) {
|
|
1135
1192
|
options.timeout = timeout.trim();
|
|
1136
1193
|
}
|
|
1194
|
+
if (haikuModel) options.haikuModel = haikuModel;
|
|
1195
|
+
if (sonnetModel) options.sonnetModel = sonnetModel;
|
|
1196
|
+
if (opusModel) options.opusModel = opusModel;
|
|
1137
1197
|
await saveApiConfig(baseUrl.trim(), apiKey.trim(), options);
|
|
1138
1198
|
console.log();
|
|
1139
1199
|
showSuccess("\u914D\u7F6E\u5DF2\u751F\u6548");
|
|
@@ -1143,7 +1203,10 @@ async function handleManualAuth() {
|
|
|
1143
1203
|
baseUrl.trim(),
|
|
1144
1204
|
apiKey.trim(),
|
|
1145
1205
|
void 0,
|
|
1146
|
-
timeout && timeout.trim() ? timeout.trim() : void 0
|
|
1206
|
+
timeout && timeout.trim() ? timeout.trim() : void 0,
|
|
1207
|
+
haikuModel,
|
|
1208
|
+
sonnetModel,
|
|
1209
|
+
opusModel
|
|
1147
1210
|
);
|
|
1148
1211
|
} catch (error) {
|
|
1149
1212
|
console.log();
|
|
@@ -1151,7 +1214,7 @@ async function handleManualAuth() {
|
|
|
1151
1214
|
await waitForEnter();
|
|
1152
1215
|
}
|
|
1153
1216
|
}
|
|
1154
|
-
async function askToSaveProfile(defaultName, baseUrl, apiKey, model, timeout) {
|
|
1217
|
+
async function askToSaveProfile(defaultName, baseUrl, apiKey, model, timeout, haikuModel, sonnetModel, opusModel) {
|
|
1155
1218
|
console.log();
|
|
1156
1219
|
const { save } = await import_inquirer.default.prompt([
|
|
1157
1220
|
{
|
|
@@ -1180,7 +1243,10 @@ async function askToSaveProfile(defaultName, baseUrl, apiKey, model, timeout) {
|
|
|
1180
1243
|
baseUrl,
|
|
1181
1244
|
apiKey,
|
|
1182
1245
|
model,
|
|
1183
|
-
timeout
|
|
1246
|
+
timeout,
|
|
1247
|
+
haikuModel,
|
|
1248
|
+
sonnetModel,
|
|
1249
|
+
opusModel
|
|
1184
1250
|
});
|
|
1185
1251
|
switchProfile(newProfile.id);
|
|
1186
1252
|
showSuccess(`\u914D\u7F6E "${name.trim()}" \u5DF2\u4FDD\u5B58`);
|
|
@@ -2443,6 +2509,37 @@ var MarketplaceService = class {
|
|
|
2443
2509
|
this.execClaude(`plugin marketplace add "${market.source}"`);
|
|
2444
2510
|
return true;
|
|
2445
2511
|
} catch (error) {
|
|
2512
|
+
if (error.message.includes("HTTPS authentication failed") || error.message.includes("terminal prompts disabled") || error.message.includes("could not read Username")) {
|
|
2513
|
+
throw new Error(`\u274C \u6DFB\u52A0\u5E02\u573A\u5931\u8D25\uFF1AGit HTTPS \u8BA4\u8BC1\u5931\u8D25
|
|
2514
|
+
|
|
2515
|
+
\u{1F4CB} \u95EE\u9898\u539F\u56E0\uFF1A
|
|
2516
|
+
\u4ED3\u5E93\u9700\u8981 HTTPS \u8BA4\u8BC1\uFF0C\u4F46\u7EC8\u7AEF\u63D0\u793A\u5DF2\u88AB\u7981\u7528
|
|
2517
|
+
|
|
2518
|
+
\u{1F4A1} \u89E3\u51B3\u65B9\u6848\uFF08\u8BF7\u9009\u62E9\u5176\u4E2D\u4E00\u79CD\uFF09\uFF1A
|
|
2519
|
+
|
|
2520
|
+
\u65B9\u6848 1\uFF1A\u914D\u7F6E Git \u51ED\u8BC1\u52A9\u624B\uFF08\u63A8\u8350\uFF09
|
|
2521
|
+
$ git config --global credential.helper store
|
|
2522
|
+
\u7136\u540E\u624B\u52A8\u514B\u9686\u4E00\u6B21\u8BE5\u4ED3\u5E93\uFF0C\u7CFB\u7EDF\u4F1A\u4FDD\u5B58\u51ED\u8BC1\uFF1A
|
|
2523
|
+
$ git clone ${market.source}
|
|
2524
|
+
|
|
2525
|
+
\u65B9\u6848 2\uFF1A\u4F7F\u7528 SSH URL \u683C\u5F0F
|
|
2526
|
+
\u5C06 HTTPS URL:
|
|
2527
|
+
${market.source}
|
|
2528
|
+
|
|
2529
|
+
\u6539\u4E3A SSH \u683C\u5F0F\uFF0C\u4F8B\u5982\uFF1A
|
|
2530
|
+
git@github.com:org/repo.git
|
|
2531
|
+
|
|
2532
|
+
\u65B9\u6848 3\uFF1A\u4F7F\u7528 GitHub CLI\uFF08\u9002\u7528\u4E8E GitHub\uFF09
|
|
2533
|
+
$ gh auth login
|
|
2534
|
+
|
|
2535
|
+
\u65B9\u6848 4\uFF1A\u914D\u7F6E Git \u8BA4\u8BC1\u6587\u4EF6
|
|
2536
|
+
\u5728 ~/.netrc \u6587\u4EF6\u4E2D\u6DFB\u52A0\u8BA4\u8BC1\u4FE1\u606F\uFF1A
|
|
2537
|
+
machine github.com (\u6216\u5176\u4ED6\u57DF\u540D)
|
|
2538
|
+
login your-username
|
|
2539
|
+
password your-token
|
|
2540
|
+
|
|
2541
|
+
\u63D0\u793A\uFF1A\u914D\u7F6E\u5B8C\u6210\u540E\uFF0C\u8BF7\u91CD\u65B0\u8FD0\u884C\u5B89\u88C5\u547D\u4EE4`);
|
|
2542
|
+
}
|
|
2446
2543
|
if (error.message.includes("already exists") || error.message.includes("already configured") || error.message.includes("already installed")) {
|
|
2447
2544
|
return true;
|
|
2448
2545
|
}
|
|
@@ -3280,68 +3377,68 @@ var PERMISSION_RULES = {
|
|
|
3280
3377
|
"Glob(*)",
|
|
3281
3378
|
"Grep(*)",
|
|
3282
3379
|
// Git 常规操作
|
|
3283
|
-
"Bash(git
|
|
3284
|
-
"Bash(git
|
|
3285
|
-
"Bash(git
|
|
3286
|
-
"Bash(git
|
|
3287
|
-
"Bash(git
|
|
3288
|
-
"Bash(git
|
|
3289
|
-
"Bash(git
|
|
3290
|
-
"Bash(git
|
|
3291
|
-
"Bash(git
|
|
3292
|
-
"Bash(git
|
|
3293
|
-
"Bash(git
|
|
3294
|
-
"Bash(git
|
|
3380
|
+
"Bash(git status*)",
|
|
3381
|
+
"Bash(git add*)",
|
|
3382
|
+
"Bash(git commit*)",
|
|
3383
|
+
"Bash(git pull*)",
|
|
3384
|
+
"Bash(git branch*)",
|
|
3385
|
+
"Bash(git checkout*)",
|
|
3386
|
+
"Bash(git diff*)",
|
|
3387
|
+
"Bash(git log*)",
|
|
3388
|
+
"Bash(git clone*)",
|
|
3389
|
+
"Bash(git stash*)",
|
|
3390
|
+
"Bash(git show*)",
|
|
3391
|
+
"Bash(git fetch*)",
|
|
3295
3392
|
// Node/NPM
|
|
3296
|
-
"Bash(node
|
|
3297
|
-
"Bash(npm
|
|
3298
|
-
"Bash(npm
|
|
3299
|
-
"Bash(npm
|
|
3300
|
-
"Bash(npx
|
|
3393
|
+
"Bash(node *)",
|
|
3394
|
+
"Bash(npm run*)",
|
|
3395
|
+
"Bash(npm test*)",
|
|
3396
|
+
"Bash(npm install*)",
|
|
3397
|
+
"Bash(npx *)",
|
|
3301
3398
|
// Python
|
|
3302
|
-
"Bash(python
|
|
3303
|
-
"Bash(python3
|
|
3304
|
-
"Bash(pip
|
|
3305
|
-
"Bash(pip3
|
|
3399
|
+
"Bash(python *)",
|
|
3400
|
+
"Bash(python3 *)",
|
|
3401
|
+
"Bash(pip install*)",
|
|
3402
|
+
"Bash(pip3 install*)",
|
|
3306
3403
|
// 常用工具
|
|
3307
|
-
"Bash(cat
|
|
3308
|
-
"Bash(ls
|
|
3309
|
-
"Bash(grep
|
|
3310
|
-
"Bash(find
|
|
3311
|
-
"Bash(curl
|
|
3312
|
-
"Bash(wget
|
|
3313
|
-
"Bash(echo
|
|
3314
|
-
"Bash(mkdir
|
|
3315
|
-
"Bash(cp
|
|
3316
|
-
"Bash(mv
|
|
3317
|
-
"Bash(touch
|
|
3318
|
-
"Bash(pwd
|
|
3319
|
-
"Bash(cd
|
|
3404
|
+
"Bash(cat *)",
|
|
3405
|
+
"Bash(ls *)",
|
|
3406
|
+
"Bash(grep *)",
|
|
3407
|
+
"Bash(find *)",
|
|
3408
|
+
"Bash(curl *)",
|
|
3409
|
+
"Bash(wget *)",
|
|
3410
|
+
"Bash(echo *)",
|
|
3411
|
+
"Bash(mkdir *)",
|
|
3412
|
+
"Bash(cp *)",
|
|
3413
|
+
"Bash(mv *)",
|
|
3414
|
+
"Bash(touch *)",
|
|
3415
|
+
"Bash(pwd*)",
|
|
3416
|
+
"Bash(cd *)"
|
|
3320
3417
|
],
|
|
3321
3418
|
deny: [
|
|
3322
3419
|
// 高危操作
|
|
3323
|
-
"Bash(rm
|
|
3324
|
-
"Bash(rm
|
|
3325
|
-
"Bash(rm
|
|
3326
|
-
"Bash(sudo
|
|
3327
|
-
"Bash(git
|
|
3328
|
-
"Bash(git
|
|
3329
|
-
"Bash(chmod
|
|
3330
|
-
"Bash(chown
|
|
3420
|
+
"Bash(rm -rf*)",
|
|
3421
|
+
"Bash(rm *-rf*)",
|
|
3422
|
+
"Bash(rm *-r*-f*)",
|
|
3423
|
+
"Bash(sudo *)",
|
|
3424
|
+
"Bash(git push*--force*)",
|
|
3425
|
+
"Bash(git push*-f*)",
|
|
3426
|
+
"Bash(chmod *)",
|
|
3427
|
+
"Bash(chown *)",
|
|
3331
3428
|
// 反黑客操作
|
|
3332
|
-
"Bash(nc
|
|
3429
|
+
"Bash(nc *-e*)",
|
|
3333
3430
|
// 反向 shell
|
|
3334
|
-
"Bash(bash
|
|
3431
|
+
"Bash(bash *-i*)",
|
|
3335
3432
|
// 交互式 bash
|
|
3336
3433
|
"Bash(*>&*)",
|
|
3337
3434
|
// 重定向到网络
|
|
3338
3435
|
"Bash(*base64*-d*)",
|
|
3339
3436
|
// 可疑的 base64 解码
|
|
3340
|
-
"Bash(wget
|
|
3437
|
+
"Bash(wget *&&*)",
|
|
3341
3438
|
// 下载并执行
|
|
3342
|
-
"Bash(curl
|
|
3439
|
+
"Bash(curl *|*sh*)",
|
|
3343
3440
|
// 管道执行
|
|
3344
|
-
"Bash(curl
|
|
3441
|
+
"Bash(curl *|*bash*)"
|
|
3345
3442
|
]
|
|
3346
3443
|
},
|
|
3347
3444
|
// 最大权限配置
|
|
@@ -3354,58 +3451,58 @@ var PERMISSION_RULES = {
|
|
|
3354
3451
|
"Glob(*)",
|
|
3355
3452
|
"Grep(*)",
|
|
3356
3453
|
// Git 所有操作(除了强制推送)
|
|
3357
|
-
"Bash(git
|
|
3454
|
+
"Bash(git *)",
|
|
3358
3455
|
// Node/NPM
|
|
3359
|
-
"Bash(node
|
|
3360
|
-
"Bash(npm
|
|
3361
|
-
"Bash(npx
|
|
3456
|
+
"Bash(node *)",
|
|
3457
|
+
"Bash(npm *)",
|
|
3458
|
+
"Bash(npx *)",
|
|
3362
3459
|
// Python
|
|
3363
|
-
"Bash(python
|
|
3364
|
-
"Bash(python3
|
|
3365
|
-
"Bash(pip
|
|
3366
|
-
"Bash(pip3
|
|
3460
|
+
"Bash(python *)",
|
|
3461
|
+
"Bash(python3 *)",
|
|
3462
|
+
"Bash(pip *)",
|
|
3463
|
+
"Bash(pip3 *)",
|
|
3367
3464
|
// 常用工具
|
|
3368
|
-
"Bash(cat
|
|
3369
|
-
"Bash(ls
|
|
3370
|
-
"Bash(grep
|
|
3371
|
-
"Bash(find
|
|
3372
|
-
"Bash(curl
|
|
3373
|
-
"Bash(wget
|
|
3374
|
-
"Bash(echo
|
|
3375
|
-
"Bash(mkdir
|
|
3376
|
-
"Bash(cp
|
|
3377
|
-
"Bash(mv
|
|
3378
|
-
"Bash(touch
|
|
3379
|
-
"Bash(pwd
|
|
3380
|
-
"Bash(cd
|
|
3465
|
+
"Bash(cat *)",
|
|
3466
|
+
"Bash(ls *)",
|
|
3467
|
+
"Bash(grep *)",
|
|
3468
|
+
"Bash(find *)",
|
|
3469
|
+
"Bash(curl *)",
|
|
3470
|
+
"Bash(wget *)",
|
|
3471
|
+
"Bash(echo *)",
|
|
3472
|
+
"Bash(mkdir *)",
|
|
3473
|
+
"Bash(cp *)",
|
|
3474
|
+
"Bash(mv *)",
|
|
3475
|
+
"Bash(touch *)",
|
|
3476
|
+
"Bash(pwd*)",
|
|
3477
|
+
"Bash(cd *)",
|
|
3381
3478
|
// 额外允许的操作
|
|
3382
|
-
"Bash(rm
|
|
3479
|
+
"Bash(rm *)"
|
|
3383
3480
|
// 允许删除,但不包括 rm -rf
|
|
3384
3481
|
],
|
|
3385
3482
|
deny: [
|
|
3386
3483
|
// 高危操作(需要确认)
|
|
3387
|
-
"Bash(rm
|
|
3388
|
-
"Bash(rm
|
|
3389
|
-
"Bash(rm
|
|
3390
|
-
"Bash(sudo
|
|
3391
|
-
"Bash(git
|
|
3392
|
-
"Bash(git
|
|
3393
|
-
"Bash(dd
|
|
3394
|
-
"Bash(mkfs
|
|
3484
|
+
"Bash(rm -rf*)",
|
|
3485
|
+
"Bash(rm *-rf*)",
|
|
3486
|
+
"Bash(rm *-r*-f*)",
|
|
3487
|
+
"Bash(sudo *)",
|
|
3488
|
+
"Bash(git push*--force*)",
|
|
3489
|
+
"Bash(git push*-f*)",
|
|
3490
|
+
"Bash(dd *)",
|
|
3491
|
+
"Bash(mkfs *)",
|
|
3395
3492
|
// 反黑客操作
|
|
3396
|
-
"Bash(nc
|
|
3493
|
+
"Bash(nc *-e*)",
|
|
3397
3494
|
// 反向 shell
|
|
3398
|
-
"Bash(bash
|
|
3495
|
+
"Bash(bash *-i*)",
|
|
3399
3496
|
// 交互式 bash
|
|
3400
3497
|
"Bash(*>&*)",
|
|
3401
3498
|
// 重定向到网络
|
|
3402
3499
|
"Bash(*base64*-d*)",
|
|
3403
3500
|
// 可疑的 base64 解码
|
|
3404
|
-
"Bash(wget
|
|
3501
|
+
"Bash(wget *&&*)",
|
|
3405
3502
|
// 下载并执行
|
|
3406
|
-
"Bash(curl
|
|
3503
|
+
"Bash(curl *|*sh*)",
|
|
3407
3504
|
// 管道执行
|
|
3408
|
-
"Bash(curl
|
|
3505
|
+
"Bash(curl *|*bash*)"
|
|
3409
3506
|
]
|
|
3410
3507
|
}
|
|
3411
3508
|
};
|
|
@@ -3950,7 +4047,7 @@ async function showMainMenu() {
|
|
|
3950
4047
|
await showPluginsMenu();
|
|
3951
4048
|
break;
|
|
3952
4049
|
case "webui" /* WEBUI */: {
|
|
3953
|
-
const { launchWebUI: launchWebUI2 } = (init_webui(),
|
|
4050
|
+
const { launchWebUI: launchWebUI2 } = await Promise.resolve().then(() => (init_webui(), webui_exports));
|
|
3954
4051
|
await launchWebUI2();
|
|
3955
4052
|
break;
|
|
3956
4053
|
}
|
|
@@ -3963,27 +4060,27 @@ async function showMainMenu() {
|
|
|
3963
4060
|
|
|
3964
4061
|
// src/cli/index.ts
|
|
3965
4062
|
init_version();
|
|
3966
|
-
var
|
|
4063
|
+
var import_package2 = __toESM(require_package());
|
|
3967
4064
|
async function main() {
|
|
3968
4065
|
try {
|
|
3969
4066
|
const args = process.argv.slice(2);
|
|
3970
4067
|
if (args.includes("--version") || args.includes("-v")) {
|
|
3971
|
-
console.log(`v${
|
|
4068
|
+
console.log(`v${import_package2.default.version}`);
|
|
3972
4069
|
process.exit(0);
|
|
3973
4070
|
}
|
|
3974
4071
|
if (args.includes("--test-update")) {
|
|
3975
|
-
const { testUpdate: testUpdate2 } = (init_version(),
|
|
4072
|
+
const { testUpdate: testUpdate2 } = await Promise.resolve().then(() => (init_version(), version_exports));
|
|
3976
4073
|
await testUpdate2();
|
|
3977
4074
|
process.exit(0);
|
|
3978
4075
|
}
|
|
3979
4076
|
if (args.includes("ui")) {
|
|
3980
|
-
const { launchWebUI: launchWebUI2 } = (init_webui(),
|
|
4077
|
+
const { launchWebUI: launchWebUI2 } = await Promise.resolve().then(() => (init_webui(), webui_exports));
|
|
3981
4078
|
await launchWebUI2();
|
|
3982
4079
|
process.exit(0);
|
|
3983
4080
|
}
|
|
3984
4081
|
if (args.includes("--help") || args.includes("-h")) {
|
|
3985
4082
|
console.log(`
|
|
3986
|
-
Code Helper v${
|
|
4083
|
+
Code Helper v${import_package2.default.version}
|
|
3987
4084
|
A unified tool to manage your Claude Code
|
|
3988
4085
|
|
|
3989
4086
|
Usage:
|