@shi_zhen/code-helper 0.1.3 → 0.1.5

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.
@@ -1,17 +1,13 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
6
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
7
- }) : x)(function(x) {
8
- if (typeof require !== "undefined") return require.apply(this, arguments);
9
- throw Error('Dynamic require of "' + x + '" is not supported');
10
- });
11
7
  var __esm = (fn, res) => function __init() {
12
8
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
13
9
  };
14
- var __commonJS = (cb, mod) => function __require2() {
10
+ var __commonJS = (cb, mod) => function __require() {
15
11
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
16
12
  };
17
13
  var __export = (target, all) => {
@@ -26,14 +22,21 @@ var __copyProps = (to, from, except, desc) => {
26
22
  }
27
23
  return to;
28
24
  };
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
26
+ // If the importer is in node compatibility mode or this is not an ESM
27
+ // file that has been converted to a CommonJS file using a Babel-
28
+ // compatible transform (i.e. "__esModule" has not been set), then set
29
+ // "default" to the CommonJS "module.exports" for node compatibility.
30
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
31
+ mod
32
+ ));
30
33
 
31
34
  // package.json
32
35
  var require_package = __commonJS({
33
36
  "package.json"(exports, module) {
34
37
  module.exports = {
35
38
  name: "@shi_zhen/code-helper",
36
- version: "0.1.3",
39
+ version: "0.1.5",
37
40
  description: "Code Helper - A unified tool to manage your Claude Code",
38
41
  repository: {
39
42
  type: "git",
@@ -176,9 +179,11 @@ __export(version_exports, {
176
179
  });
177
180
  import chalk3 from "chalk";
178
181
  import ora7 from "ora";
182
+ import os11 from "os";
183
+ import path11 from "path";
184
+ import fs10 from "fs";
179
185
  function getLocalVersion() {
180
- const pkg3 = require_package();
181
- return pkg3.version;
186
+ return import_package.default.version;
182
187
  }
183
188
  async function getRemoteVersion() {
184
189
  try {
@@ -307,14 +312,12 @@ async function testUpdate() {
307
312
  chalk3.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")
308
313
  );
309
314
  }
310
- var os11, path11, fs10, CACHE_DIR, CACHE_FILE, CHECK_INTERVAL;
315
+ var import_package, CACHE_DIR, CACHE_FILE, CHECK_INTERVAL;
311
316
  var init_version = __esm({
312
317
  "src/cli/utils/version.ts"() {
313
318
  "use strict";
314
319
  init_exec();
315
- os11 = __require("os");
316
- path11 = __require("path");
317
- fs10 = __require("fs");
320
+ import_package = __toESM(require_package());
318
321
  CACHE_DIR = path11.join(os11.homedir(), ".code-helper");
319
322
  CACHE_FILE = path11.join(CACHE_DIR, "version-check.json");
320
323
  CHECK_INTERVAL = 24 * 60 * 60 * 1e3;
@@ -1996,10 +1999,10 @@ var MCP_SERVERS_CONFIG_FILE = path4.join(CONFIG_DIR, "mcpServers.json");
1996
1999
  var CACHE_TTL = 6 * 60 * 60 * 1e3;
1997
2000
  var BUILTIN_DEFAULT_MARKETS = [
1998
2001
  {
1999
- name: "macopowers",
2000
- source: "https://github.com/macopowers-dev/macopowers.git",
2001
- description: "MacoPowers Official Plugin Marketplace",
2002
- category: "official",
2002
+ name: "superpowers",
2003
+ source: "https://github.com/obra/superpowers.git",
2004
+ description: "Superpowers - Open Source Claude Code Skills",
2005
+ category: "community",
2003
2006
  recommended: true,
2004
2007
  default: true
2005
2008
  }
@@ -2436,6 +2439,37 @@ var MarketplaceService = class {
2436
2439
  this.execClaude(`plugin marketplace add "${market.source}"`);
2437
2440
  return true;
2438
2441
  } catch (error) {
2442
+ if (error.message.includes("HTTPS authentication failed") || error.message.includes("terminal prompts disabled") || error.message.includes("could not read Username")) {
2443
+ throw new Error(`\u274C \u6DFB\u52A0\u5E02\u573A\u5931\u8D25\uFF1AGit HTTPS \u8BA4\u8BC1\u5931\u8D25
2444
+
2445
+ \u{1F4CB} \u95EE\u9898\u539F\u56E0\uFF1A
2446
+ \u4ED3\u5E93\u9700\u8981 HTTPS \u8BA4\u8BC1\uFF0C\u4F46\u7EC8\u7AEF\u63D0\u793A\u5DF2\u88AB\u7981\u7528
2447
+
2448
+ \u{1F4A1} \u89E3\u51B3\u65B9\u6848\uFF08\u8BF7\u9009\u62E9\u5176\u4E2D\u4E00\u79CD\uFF09\uFF1A
2449
+
2450
+ \u65B9\u6848 1\uFF1A\u914D\u7F6E Git \u51ED\u8BC1\u52A9\u624B\uFF08\u63A8\u8350\uFF09
2451
+ $ git config --global credential.helper store
2452
+ \u7136\u540E\u624B\u52A8\u514B\u9686\u4E00\u6B21\u8BE5\u4ED3\u5E93\uFF0C\u7CFB\u7EDF\u4F1A\u4FDD\u5B58\u51ED\u8BC1\uFF1A
2453
+ $ git clone ${market.source}
2454
+
2455
+ \u65B9\u6848 2\uFF1A\u4F7F\u7528 SSH URL \u683C\u5F0F
2456
+ \u5C06 HTTPS URL:
2457
+ ${market.source}
2458
+
2459
+ \u6539\u4E3A SSH \u683C\u5F0F\uFF0C\u4F8B\u5982\uFF1A
2460
+ git@github.com:org/repo.git
2461
+
2462
+ \u65B9\u6848 3\uFF1A\u4F7F\u7528 GitHub CLI\uFF08\u9002\u7528\u4E8E GitHub\uFF09
2463
+ $ gh auth login
2464
+
2465
+ \u65B9\u6848 4\uFF1A\u914D\u7F6E Git \u8BA4\u8BC1\u6587\u4EF6
2466
+ \u5728 ~/.netrc \u6587\u4EF6\u4E2D\u6DFB\u52A0\u8BA4\u8BC1\u4FE1\u606F\uFF1A
2467
+ machine github.com (\u6216\u5176\u4ED6\u57DF\u540D)
2468
+ login your-username
2469
+ password your-token
2470
+
2471
+ \u63D0\u793A\uFF1A\u914D\u7F6E\u5B8C\u6210\u540E\uFF0C\u8BF7\u91CD\u65B0\u8FD0\u884C\u5B89\u88C5\u547D\u4EE4`);
2472
+ }
2439
2473
  if (error.message.includes("already exists") || error.message.includes("already configured") || error.message.includes("already installed")) {
2440
2474
  return true;
2441
2475
  }
@@ -3273,68 +3307,68 @@ var PERMISSION_RULES = {
3273
3307
  "Glob(*)",
3274
3308
  "Grep(*)",
3275
3309
  // Git 常规操作
3276
- "Bash(git:status*)",
3277
- "Bash(git:add*)",
3278
- "Bash(git:commit*)",
3279
- "Bash(git:pull*)",
3280
- "Bash(git:branch*)",
3281
- "Bash(git:checkout*)",
3282
- "Bash(git:diff*)",
3283
- "Bash(git:log*)",
3284
- "Bash(git:clone*)",
3285
- "Bash(git:stash*)",
3286
- "Bash(git:show*)",
3287
- "Bash(git:fetch*)",
3310
+ "Bash(git status*)",
3311
+ "Bash(git add*)",
3312
+ "Bash(git commit*)",
3313
+ "Bash(git pull*)",
3314
+ "Bash(git branch*)",
3315
+ "Bash(git checkout*)",
3316
+ "Bash(git diff*)",
3317
+ "Bash(git log*)",
3318
+ "Bash(git clone*)",
3319
+ "Bash(git stash*)",
3320
+ "Bash(git show*)",
3321
+ "Bash(git fetch*)",
3288
3322
  // Node/NPM
3289
- "Bash(node:*)",
3290
- "Bash(npm:run*)",
3291
- "Bash(npm:test*)",
3292
- "Bash(npm:install*)",
3293
- "Bash(npx:*)",
3323
+ "Bash(node *)",
3324
+ "Bash(npm run*)",
3325
+ "Bash(npm test*)",
3326
+ "Bash(npm install*)",
3327
+ "Bash(npx *)",
3294
3328
  // Python
3295
- "Bash(python:*)",
3296
- "Bash(python3:*)",
3297
- "Bash(pip:install*)",
3298
- "Bash(pip3:install*)",
3329
+ "Bash(python *)",
3330
+ "Bash(python3 *)",
3331
+ "Bash(pip install*)",
3332
+ "Bash(pip3 install*)",
3299
3333
  // 常用工具
3300
- "Bash(cat:*)",
3301
- "Bash(ls:*)",
3302
- "Bash(grep:*)",
3303
- "Bash(find:*)",
3304
- "Bash(curl:*)",
3305
- "Bash(wget:*)",
3306
- "Bash(echo:*)",
3307
- "Bash(mkdir:*)",
3308
- "Bash(cp:*)",
3309
- "Bash(mv:*)",
3310
- "Bash(touch:*)",
3311
- "Bash(pwd:*)",
3312
- "Bash(cd:*)"
3334
+ "Bash(cat *)",
3335
+ "Bash(ls *)",
3336
+ "Bash(grep *)",
3337
+ "Bash(find *)",
3338
+ "Bash(curl *)",
3339
+ "Bash(wget *)",
3340
+ "Bash(echo *)",
3341
+ "Bash(mkdir *)",
3342
+ "Bash(cp *)",
3343
+ "Bash(mv *)",
3344
+ "Bash(touch *)",
3345
+ "Bash(pwd*)",
3346
+ "Bash(cd *)"
3313
3347
  ],
3314
3348
  deny: [
3315
3349
  // 高危操作
3316
- "Bash(rm:-rf*)",
3317
- "Bash(rm:*-rf*)",
3318
- "Bash(rm:*-r*-f*)",
3319
- "Bash(sudo:*)",
3320
- "Bash(git:push*--force*)",
3321
- "Bash(git:push*-f*)",
3322
- "Bash(chmod:*)",
3323
- "Bash(chown:*)",
3350
+ "Bash(rm -rf*)",
3351
+ "Bash(rm *-rf*)",
3352
+ "Bash(rm *-r*-f*)",
3353
+ "Bash(sudo *)",
3354
+ "Bash(git push*--force*)",
3355
+ "Bash(git push*-f*)",
3356
+ "Bash(chmod *)",
3357
+ "Bash(chown *)",
3324
3358
  // 反黑客操作
3325
- "Bash(nc:*-e*)",
3359
+ "Bash(nc *-e*)",
3326
3360
  // 反向 shell
3327
- "Bash(bash:*-i*)",
3361
+ "Bash(bash *-i*)",
3328
3362
  // 交互式 bash
3329
3363
  "Bash(*>&*)",
3330
3364
  // 重定向到网络
3331
3365
  "Bash(*base64*-d*)",
3332
3366
  // 可疑的 base64 解码
3333
- "Bash(wget:*&&*)",
3367
+ "Bash(wget *&&*)",
3334
3368
  // 下载并执行
3335
- "Bash(curl:*|*sh*)",
3369
+ "Bash(curl *|*sh*)",
3336
3370
  // 管道执行
3337
- "Bash(curl:*|*bash*)"
3371
+ "Bash(curl *|*bash*)"
3338
3372
  ]
3339
3373
  },
3340
3374
  // 最大权限配置
@@ -3347,58 +3381,58 @@ var PERMISSION_RULES = {
3347
3381
  "Glob(*)",
3348
3382
  "Grep(*)",
3349
3383
  // Git 所有操作(除了强制推送)
3350
- "Bash(git:*)",
3384
+ "Bash(git *)",
3351
3385
  // Node/NPM
3352
- "Bash(node:*)",
3353
- "Bash(npm:*)",
3354
- "Bash(npx:*)",
3386
+ "Bash(node *)",
3387
+ "Bash(npm *)",
3388
+ "Bash(npx *)",
3355
3389
  // Python
3356
- "Bash(python:*)",
3357
- "Bash(python3:*)",
3358
- "Bash(pip:*)",
3359
- "Bash(pip3:*)",
3390
+ "Bash(python *)",
3391
+ "Bash(python3 *)",
3392
+ "Bash(pip *)",
3393
+ "Bash(pip3 *)",
3360
3394
  // 常用工具
3361
- "Bash(cat:*)",
3362
- "Bash(ls:*)",
3363
- "Bash(grep:*)",
3364
- "Bash(find:*)",
3365
- "Bash(curl:*)",
3366
- "Bash(wget:*)",
3367
- "Bash(echo:*)",
3368
- "Bash(mkdir:*)",
3369
- "Bash(cp:*)",
3370
- "Bash(mv:*)",
3371
- "Bash(touch:*)",
3372
- "Bash(pwd:*)",
3373
- "Bash(cd:*)",
3395
+ "Bash(cat *)",
3396
+ "Bash(ls *)",
3397
+ "Bash(grep *)",
3398
+ "Bash(find *)",
3399
+ "Bash(curl *)",
3400
+ "Bash(wget *)",
3401
+ "Bash(echo *)",
3402
+ "Bash(mkdir *)",
3403
+ "Bash(cp *)",
3404
+ "Bash(mv *)",
3405
+ "Bash(touch *)",
3406
+ "Bash(pwd*)",
3407
+ "Bash(cd *)",
3374
3408
  // 额外允许的操作
3375
- "Bash(rm:*)"
3409
+ "Bash(rm *)"
3376
3410
  // 允许删除,但不包括 rm -rf
3377
3411
  ],
3378
3412
  deny: [
3379
3413
  // 高危操作(需要确认)
3380
- "Bash(rm:-rf*)",
3381
- "Bash(rm:*-rf*)",
3382
- "Bash(rm:*-r*-f*)",
3383
- "Bash(sudo:*)",
3384
- "Bash(git:push*--force*)",
3385
- "Bash(git:push*-f*)",
3386
- "Bash(dd:*)",
3387
- "Bash(mkfs:*)",
3414
+ "Bash(rm -rf*)",
3415
+ "Bash(rm *-rf*)",
3416
+ "Bash(rm *-r*-f*)",
3417
+ "Bash(sudo *)",
3418
+ "Bash(git push*--force*)",
3419
+ "Bash(git push*-f*)",
3420
+ "Bash(dd *)",
3421
+ "Bash(mkfs *)",
3388
3422
  // 反黑客操作
3389
- "Bash(nc:*-e*)",
3423
+ "Bash(nc *-e*)",
3390
3424
  // 反向 shell
3391
- "Bash(bash:*-i*)",
3425
+ "Bash(bash *-i*)",
3392
3426
  // 交互式 bash
3393
3427
  "Bash(*>&*)",
3394
3428
  // 重定向到网络
3395
3429
  "Bash(*base64*-d*)",
3396
3430
  // 可疑的 base64 解码
3397
- "Bash(wget:*&&*)",
3431
+ "Bash(wget *&&*)",
3398
3432
  // 下载并执行
3399
- "Bash(curl:*|*sh*)",
3433
+ "Bash(curl *|*sh*)",
3400
3434
  // 管道执行
3401
- "Bash(curl:*|*bash*)"
3435
+ "Bash(curl *|*bash*)"
3402
3436
  ]
3403
3437
  }
3404
3438
  };
@@ -3943,7 +3977,7 @@ async function showMainMenu() {
3943
3977
  await showPluginsMenu();
3944
3978
  break;
3945
3979
  case "webui" /* WEBUI */: {
3946
- const { launchWebUI: launchWebUI2 } = (init_webui(), __toCommonJS(webui_exports));
3980
+ const { launchWebUI: launchWebUI2 } = await Promise.resolve().then(() => (init_webui(), webui_exports));
3947
3981
  await launchWebUI2();
3948
3982
  break;
3949
3983
  }
@@ -3956,27 +3990,27 @@ async function showMainMenu() {
3956
3990
 
3957
3991
  // src/cli/index.ts
3958
3992
  init_version();
3959
- var pkg2 = require_package();
3993
+ var import_package2 = __toESM(require_package());
3960
3994
  async function main() {
3961
3995
  try {
3962
3996
  const args = process.argv.slice(2);
3963
3997
  if (args.includes("--version") || args.includes("-v")) {
3964
- console.log(`v${pkg2.version}`);
3998
+ console.log(`v${import_package2.default.version}`);
3965
3999
  process.exit(0);
3966
4000
  }
3967
4001
  if (args.includes("--test-update")) {
3968
- const { testUpdate: testUpdate2 } = (init_version(), __toCommonJS(version_exports));
4002
+ const { testUpdate: testUpdate2 } = await Promise.resolve().then(() => (init_version(), version_exports));
3969
4003
  await testUpdate2();
3970
4004
  process.exit(0);
3971
4005
  }
3972
4006
  if (args.includes("ui")) {
3973
- const { launchWebUI: launchWebUI2 } = (init_webui(), __toCommonJS(webui_exports));
4007
+ const { launchWebUI: launchWebUI2 } = await Promise.resolve().then(() => (init_webui(), webui_exports));
3974
4008
  await launchWebUI2();
3975
4009
  process.exit(0);
3976
4010
  }
3977
4011
  if (args.includes("--help") || args.includes("-h")) {
3978
4012
  console.log(`
3979
- Code Helper v${pkg2.version}
4013
+ Code Helper v${import_package2.default.version}
3980
4014
  A unified tool to manage your Claude Code
3981
4015
 
3982
4016
  Usage: