mine-auto-cli 2.7.1 → 2.7.2
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/index.js +261 -239
- package/dist/keyword-CwLBndfW.js +109 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,335 +1,357 @@
|
|
|
1
|
-
import { program as
|
|
1
|
+
import { program as g } from "commander";
|
|
2
2
|
import l from "chalk";
|
|
3
|
-
import { readFileSync as h, writeFileSync as v, existsSync as $, readdirSync as
|
|
4
|
-
import { join as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { execSync as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
3
|
+
import { readFileSync as h, writeFileSync as v, existsSync as $, readdirSync as je, cpSync as _, rmSync as Ce } from "fs";
|
|
4
|
+
import { join as y, resolve as f } from "path";
|
|
5
|
+
import oe from "log-symbols";
|
|
6
|
+
import we from "ora";
|
|
7
|
+
import { execSync as k } from "child_process";
|
|
8
|
+
import be from "js-yaml";
|
|
9
|
+
import ke from "strip-json-comments";
|
|
10
10
|
import Oe from "pacote";
|
|
11
11
|
import { parseRange as D } from "semver-utils";
|
|
12
|
-
import
|
|
12
|
+
import xe from "download-git-repo";
|
|
13
13
|
import q from "inquirer";
|
|
14
|
-
import
|
|
14
|
+
import se from "os";
|
|
15
15
|
import Ae from "update-notifier";
|
|
16
|
-
const
|
|
17
|
-
name:
|
|
16
|
+
const re = "mine-auto-cli", ce = "2.7.2", Ne = "./dist/index.js", Pe = "./dist/index.js", Ie = "module", Ee = { auto: "bin/mine-auto-cli.js" }, Je = { name: "biaov", email: "biaov@qq.com", url: "https://biaov.cn" }, Me = "一个将多个命令简化成一个命令的工具 😆", Le = { start: "npm run dev", dev: "npm run build -- --watch", build: "vite build", prettier: "prettier --write '**/*.{js,ts,md,json}'", tag: "node scripts/tag" }, Re = { registry: "https://registry.npmjs.org/", "engine-strict": !0, provenance: !0 }, De = { node: ">=24.x" }, Ve = ["auto", "cli", "vite", "typescript"], Te = { type: "git", url: "git+https://github.com/biaov/mine-auto-cli.git" }, _e = "https://github.com/biaov/mine-auto-cli.git", Fe = { url: "https://github.com/biaov/mine-auto-cli/issues" }, Ue = "ISC", He = [{ name: "biaov", email: "biaov@qq.com" }], qe = { chalk: "^5.6.2", commander: "^14.0.3", "download-git-repo": "^3.0.2", inquirer: "^13.3.0", "js-yaml": "^4.1.1", "log-symbols": "^7.0.1", ora: "^9.3.0", pacote: "^21.4.0", "semver-utils": "^1.1.4", "strip-json-comments": "^5.0.3", "update-notifier": "^7.3.1" }, Be = { "@types/js-yaml": "^4.0.9", "@types/node": "^25.3.3", "@types/pacote": "^11.1.8", "@types/semver-utils": "^1.1.3", "@types/update-notifier": "^6.0.8", prettier: "^3.8.1", typescript: "^5.9.3", vite: "^7.3.1" }, I = {
|
|
17
|
+
name: re,
|
|
18
18
|
private: !1,
|
|
19
|
-
version:
|
|
20
|
-
exports:
|
|
21
|
-
main:
|
|
19
|
+
version: ce,
|
|
20
|
+
exports: Ne,
|
|
21
|
+
main: Pe,
|
|
22
22
|
type: Ie,
|
|
23
|
-
bin:
|
|
24
|
-
author:
|
|
25
|
-
description:
|
|
26
|
-
scripts:
|
|
27
|
-
publishConfig:
|
|
23
|
+
bin: Ee,
|
|
24
|
+
author: Je,
|
|
25
|
+
description: Me,
|
|
26
|
+
scripts: Le,
|
|
27
|
+
publishConfig: Re,
|
|
28
28
|
engines: De,
|
|
29
|
-
keywords:
|
|
30
|
-
repository:
|
|
31
|
-
homepage:
|
|
32
|
-
bugs:
|
|
33
|
-
license:
|
|
34
|
-
contributors:
|
|
29
|
+
keywords: Ve,
|
|
30
|
+
repository: Te,
|
|
31
|
+
homepage: _e,
|
|
32
|
+
bugs: Fe,
|
|
33
|
+
license: Ue,
|
|
34
|
+
contributors: He,
|
|
35
35
|
dependencies: qe,
|
|
36
|
-
devDependencies:
|
|
37
|
-
},
|
|
38
|
-
console.log(`${
|
|
39
|
-
},
|
|
40
|
-
console.log(`${
|
|
36
|
+
devDependencies: Be
|
|
37
|
+
}, u = (e) => {
|
|
38
|
+
console.log(`${oe.success} ${l.green("SUCCESS")} ${e}`);
|
|
39
|
+
}, S = (e) => {
|
|
40
|
+
console.log(`${re} ${oe.error} ${l.red("ERROR")} ${e}`);
|
|
41
41
|
}, a = (e) => {
|
|
42
42
|
console.log(e ?? "");
|
|
43
43
|
}, ie = (e) => {
|
|
44
44
|
a(`开始执行 ${l.cyanBright(e)} 命令`);
|
|
45
|
-
const t =
|
|
45
|
+
const t = we({ text: "正在执行命令中...", color: "yellow" });
|
|
46
46
|
t.start();
|
|
47
|
-
const
|
|
48
|
-
a(
|
|
49
|
-
},
|
|
50
|
-
a(), a(`${l.yellow(">>")} 开始依次执行命令...`), a(),
|
|
51
|
-
}, H = (e) => {
|
|
52
|
-
a(), C(`\`${e}\` 命令错误,请检查你的命令`), a(), u.help();
|
|
47
|
+
const s = k(e, { cwd: process.cwd() });
|
|
48
|
+
a(s.toString()), t.succeed(`${l.green(e)} 命令执行成功`), a();
|
|
49
|
+
}, Ge = (e) => ["git add -A", `git commit -m ${e}`, "git push"], ze = (e, t) => [`npm run ${e}`, "git add -A", `git commit -m ${t}`, "git push"], Ke = async (e, t = "打包") => {
|
|
50
|
+
a(), a(`${l.yellow(">>")} 开始依次执行命令...`), a(), ze(e, t).map(ie), u("全部命令执行完成"), a();
|
|
53
51
|
}, B = (e) => {
|
|
52
|
+
a(), S(`\`${e}\` 命令错误,请检查你的命令`), a(), g.help();
|
|
53
|
+
}, G = (e) => {
|
|
54
54
|
const t = ["package.json", "README.md"].map((r) => {
|
|
55
|
-
const
|
|
56
|
-
return { path:
|
|
57
|
-
}), [
|
|
55
|
+
const c = y(process.cwd(), r), i = h(c).toString();
|
|
56
|
+
return { path: c, content: i };
|
|
57
|
+
}), [s, n] = t, o = JSON.parse(s.content);
|
|
58
58
|
if (e)
|
|
59
|
-
|
|
59
|
+
o.version = e;
|
|
60
60
|
else {
|
|
61
|
-
const r =
|
|
62
|
-
|
|
61
|
+
const r = o.version.split(".").reduce((c, i, p, m) => c + (p === m.length - 1 ? +i + 1 : `${i}.`), "");
|
|
62
|
+
o.version = r;
|
|
63
63
|
}
|
|
64
|
-
v(
|
|
65
|
-
},
|
|
64
|
+
v(s.path, JSON.stringify(o, null, 2)), n.content = n.content.replace(/version\-v.+\-blue/, () => `version-v${o.version}-blue`), v(n.path, n.content);
|
|
65
|
+
}, Ye = async (e) => {
|
|
66
66
|
const t = e.split("version")[1];
|
|
67
|
-
if (!t) return
|
|
68
|
-
const
|
|
67
|
+
if (!t) return B(e);
|
|
68
|
+
const s = JSON.parse(h(y(process.cwd(), "package.json")).toString());
|
|
69
69
|
if (t === "++") {
|
|
70
|
-
const
|
|
71
|
-
|
|
70
|
+
const o = s.version.split(".").reduce((r, c, i, p) => r + (i === p.length - 1 ? +c + 1 : `${c}.`), "");
|
|
71
|
+
G(o), a(), u("命令执行完成");
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
},
|
|
77
|
-
if (e.includes("build")) return
|
|
78
|
-
if (e.includes("version")) return
|
|
79
|
-
|
|
80
|
-
},
|
|
81
|
-
vue:
|
|
82
|
-
react:
|
|
83
|
-
"uni-app":
|
|
84
|
-
electron:
|
|
85
|
-
node:
|
|
86
|
-
"node-simple":
|
|
74
|
+
const n = t.split("@")[1];
|
|
75
|
+
n ? (G(n), a(), u("命令执行完成")) : B(e);
|
|
76
|
+
}, Ze = (e, t) => {
|
|
77
|
+
if (e.includes("build")) return Ke(e, t);
|
|
78
|
+
if (e.includes("version")) return Ye(e);
|
|
79
|
+
S(l.hex("#f56c6c")(`\`auto ${e}${t ? ` ${t}` : ""}\` 命令不存在`)), g.help();
|
|
80
|
+
}, b = "https://gitee.com/biaovorg/project-template.git", Qe = {
|
|
81
|
+
vue: b,
|
|
82
|
+
react: b,
|
|
83
|
+
"uni-app": b,
|
|
84
|
+
electron: b,
|
|
85
|
+
node: b,
|
|
86
|
+
"node-simple": b
|
|
87
87
|
}, We = Object.keys(Qe);
|
|
88
|
-
We.reduce((e, t,
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
const
|
|
88
|
+
We.reduce((e, t, s) => e + (s ? ", " : "") + t, "");
|
|
89
|
+
const C = (e = "jsonc") => `auto-cli.${e}`;
|
|
90
|
+
f(import.meta.dirname, "./presetData.json");
|
|
91
|
+
const F = (e, t = !1) => {
|
|
92
92
|
if (!$(e)) return t ? {} : "";
|
|
93
|
-
const
|
|
94
|
-
return t ? JSON.parse(
|
|
93
|
+
const s = h(e).toString();
|
|
94
|
+
return t ? JSON.parse(ke(s)) : s;
|
|
95
95
|
}, Xe = (e) => {
|
|
96
96
|
if (!$(e)) return {};
|
|
97
97
|
const t = h(e).toString();
|
|
98
98
|
try {
|
|
99
|
-
return
|
|
99
|
+
return be.load(t);
|
|
100
100
|
} catch {
|
|
101
101
|
return {};
|
|
102
102
|
}
|
|
103
|
-
},
|
|
104
|
-
const [e, t] = [
|
|
103
|
+
}, ae = (e = !1) => F(f(import.meta.dirname, C()), e), le = () => {
|
|
104
|
+
const [e, t] = [C(), C("yml")].map((n) => f(process.cwd(), n)), s = ae(!0);
|
|
105
105
|
try {
|
|
106
|
-
Object.assign(
|
|
106
|
+
Object.assign(s, Xe(t), F(e, !0));
|
|
107
107
|
} catch {
|
|
108
108
|
}
|
|
109
|
-
return
|
|
110
|
-
},
|
|
111
|
-
let
|
|
112
|
-
return t && (
|
|
113
|
-
`).slice(1, -1).reduce((
|
|
114
|
-
`, "") :
|
|
115
|
-
},
|
|
109
|
+
return s;
|
|
110
|
+
}, et = (e, t = !1) => {
|
|
111
|
+
let s = ae(t);
|
|
112
|
+
return t && (s = JSON.stringify(s, null, 2)), e.includes(".yml") ? s.trim().split(`
|
|
113
|
+
`).slice(1, -1).reduce((n, o) => n + o.trim().replace(/[",]/g, "").replace("// ", "# ") + `
|
|
114
|
+
`, "") : s;
|
|
115
|
+
}, pe = (e, t, s = " ") => Array.from({ length: t - e }, () => s).join(""), tt = ({ yml: e, uncomment: t, force: s }) => {
|
|
116
116
|
a();
|
|
117
|
-
const
|
|
118
|
-
if ($(
|
|
119
|
-
a(l.yellow(`${
|
|
117
|
+
const n = C(e ? "yml" : "jsonc"), o = f(process.cwd(), n);
|
|
118
|
+
if ($(o) && !s) {
|
|
119
|
+
a(l.yellow(`${n} 文件已存在`)), a(), a(l.yellow(`文件目录 ${o}`));
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
|
-
v(
|
|
122
|
+
v(o, et(n, t)), u(`${n} 文件创建成功`), a(), a(l.green(`文件目录 ${o}`));
|
|
123
123
|
};
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
a(), a(`${l.yellow(">>")} 开始依次执行命令...`), a(),
|
|
124
|
+
g.command("init").option("-f, --force", `强制替换 ${C()} 文件内容`, !1).option("--unc, --uncomment", `取消生成 ${C()} 带注释`, !1).option("-y, --yml", `生成 ${C("yml")} 文件`, !1).description("初始化配置文件").action(tt);
|
|
125
|
+
const nt = async (e = "更新代码") => {
|
|
126
|
+
a(), a(`${l.yellow(">>")} 开始依次执行命令...`), a(), Ge(e).forEach(ie), u("全部命令执行完成"), a();
|
|
127
127
|
};
|
|
128
|
-
|
|
129
|
-
const
|
|
130
|
-
let
|
|
131
|
-
const
|
|
132
|
-
const r = Array.from({ length: t }).reduce((
|
|
133
|
-
return !
|
|
128
|
+
g.command("git [描述]").description("简化 Git 提交命令").action(nt);
|
|
129
|
+
const z = ["dist", "node_modules", ".git", "miniprogram_npm"];
|
|
130
|
+
let J = 0, me = !1, V = !1, de = 20;
|
|
131
|
+
const K = ({ prev: e, i: t, index: s, arr: n, curText: o }) => {
|
|
132
|
+
const r = Array.from({ length: t }).reduce((m) => m + `${t === 1 && s === n.length - 1 ? "└ " : "│ "} `, ""), c = e + r, i = (r + o).length, p = Array.from({ length: de + J - i }).reduce((m) => `${m}-`, " ");
|
|
133
|
+
return !me && (J = Math.max(J, i)), `${c}${o}${V ? p : ""}
|
|
134
134
|
`;
|
|
135
|
-
},
|
|
136
|
-
let
|
|
137
|
-
return
|
|
138
|
-
}, ""),
|
|
139
|
-
|
|
140
|
-
const
|
|
141
|
-
if ($(
|
|
142
|
-
const
|
|
135
|
+
}, T = (e, t = 0) => e.reduce((s, n, o, r) => {
|
|
136
|
+
let c;
|
|
137
|
+
return n.children ? (c = `├── ${n.name}`, K({ prev: s, i: t, index: o, arr: r, curText: c }) + T(n.children, t + 1)) : (c = `${o === r.length - 1 ? "└── " : "├── "}${n.name}`, K({ prev: s, i: t, index: o, arr: r, curText: c }));
|
|
138
|
+
}, ""), Y = (e) => je(e, { withFileTypes: !0 }).sort((t, s) => +s.isDirectory() - +t.isDirectory()), ot = ({ line: e, name: t }) => {
|
|
139
|
+
V = !!e, typeof e == "string" && (de = +e);
|
|
140
|
+
const s = process.cwd(), n = y(s, ".gitignore");
|
|
141
|
+
if ($(n)) {
|
|
142
|
+
const p = h(n).toString().split(`\r
|
|
143
143
|
`);
|
|
144
|
-
|
|
144
|
+
z.push(...p);
|
|
145
145
|
}
|
|
146
|
-
const
|
|
147
|
-
const { name:
|
|
148
|
-
return !
|
|
149
|
-
}),
|
|
150
|
-
|
|
146
|
+
const o = s.split("\\").at(-1), c = Y(s).map((p) => {
|
|
147
|
+
const { name: m } = p, d = { name: m };
|
|
148
|
+
return !z.includes(m) && p.isDirectory() && (d.children = Y(y(p.path, m)).map(({ name: O }) => ({ name: O }))), d;
|
|
149
|
+
}), i = [{ name: o, children: c }];
|
|
150
|
+
V && (T(i), me = !0), v(y(s, `${typeof t == "string" && t || "directory"}.md`), T(i));
|
|
151
151
|
};
|
|
152
|
-
|
|
153
|
-
const
|
|
154
|
-
const
|
|
152
|
+
g.command("mkdir").option("-l, --line [数量]", "数量", !1).option("-n, --name [文件名称]", "文件名称", !1).option("-d, --depth [深度值]", "深度值", "3").description("生成目录结构文件").action(ot);
|
|
153
|
+
const x = le(), [M] = ["package.json"].map((e) => f(process.cwd(), e)), st = (e, t) => {
|
|
154
|
+
const s = Array.from({ length: t }, (c, i) => i < e ? "=" : " ").join(""), n = ~~(e / t * 100), o = `\r查找进度:[${s}] ${e}/${t} ${n}%\r`, r = e === t ? l.green(o) : l.yellow(o);
|
|
155
155
|
process.stdout.write(r);
|
|
156
|
-
},
|
|
157
|
-
let
|
|
158
|
-
|
|
159
|
-
const
|
|
160
|
-
if (
|
|
161
|
-
const
|
|
162
|
-
if (e ===
|
|
163
|
-
return
|
|
156
|
+
}, rt = (e, t, s) => {
|
|
157
|
+
let n = "latest";
|
|
158
|
+
x.resolve.some((r) => {
|
|
159
|
+
const c = r.lastIndexOf("@");
|
|
160
|
+
if (c <= 0) return !0;
|
|
161
|
+
const i = r.slice(0, c), p = r.slice(c + 1);
|
|
162
|
+
if (e === i)
|
|
163
|
+
return n = p, !0;
|
|
164
164
|
});
|
|
165
|
-
const
|
|
166
|
-
return { name: e, value: t, newVersion:
|
|
167
|
-
},
|
|
168
|
-
const [{ major: t = 0, minor:
|
|
169
|
-
return [+t, +
|
|
170
|
-
},
|
|
171
|
-
const [n, o,
|
|
172
|
-
return
|
|
173
|
-
},
|
|
165
|
+
const o = x.prefix + s[n];
|
|
166
|
+
return { name: e, value: t, newVersion: o, tag: n };
|
|
167
|
+
}, ct = (e, t) => (+!t + 1) * e.length, Z = (e) => {
|
|
168
|
+
const [{ major: t = 0, minor: s = 0, patch: n = 0, release: o = "" }] = D(e);
|
|
169
|
+
return [+t, +s, +n, o];
|
|
170
|
+
}, L = (e, t) => e ? "-" + l[t](e) : "", it = (e, t) => {
|
|
171
|
+
const [s, n, o, r] = Z(e), [c, i, p, m] = Z(t);
|
|
172
|
+
return c > s ? l.red(t) : c < s ? !1 : i > n ? `${c}.${l.yellow(i)}.${l.yellow(p)}${L(m, "yellow")}` : i < n ? !1 : p > o ? `${c}.${i}.${l.green(p)}${L(m, "green")}` : p === o && m && m !== r ? `${c}.${i}.${p}${L(m, "green")}` : !1;
|
|
173
|
+
}, at = (e) => {
|
|
174
174
|
const t = {};
|
|
175
|
-
e.forEach((
|
|
176
|
-
Object.entries(
|
|
177
|
-
t[
|
|
175
|
+
e.forEach((n) => {
|
|
176
|
+
Object.entries(n).forEach(([o, r]) => {
|
|
177
|
+
t[o] = Math.max(r.length, t[o] ?? 0);
|
|
178
178
|
});
|
|
179
179
|
}), e.unshift({ name: "包名", value: "版本", newVersion: "新版本", tag: "标签" });
|
|
180
|
-
const
|
|
181
|
-
e.forEach(({ name:
|
|
182
|
-
const [
|
|
183
|
-
let
|
|
184
|
-
if (
|
|
185
|
-
const
|
|
186
|
-
|
|
180
|
+
const s = [];
|
|
181
|
+
e.forEach(({ name: n, value: o, newVersion: r, tag: c }, i) => {
|
|
182
|
+
const [p, m, d, O] = Object.entries({ name: n, value: o, newVersion: r, tag: c }).map(([N, Se]) => pe(ct(Se, i), t[N]));
|
|
183
|
+
let w = l.yellow("→"), H = !0;
|
|
184
|
+
if (i) {
|
|
185
|
+
const N = it(o, r);
|
|
186
|
+
N ? r = N : H = !1;
|
|
187
187
|
} else
|
|
188
|
-
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
}),
|
|
192
|
-
},
|
|
188
|
+
n = l.green(n), o = l.green(o), r = l.green(r), c = l.green(c), w = " ";
|
|
189
|
+
const ve = `${n + p} ${m + o} ${w} ${d + r} ${O + c}`;
|
|
190
|
+
H && s.push(ve);
|
|
191
|
+
}), s.length > 1 ? s.forEach(a) : u("所有版本已是最新");
|
|
192
|
+
}, lt = async (e, t, s) => {
|
|
193
193
|
a();
|
|
194
|
-
let
|
|
195
|
-
const
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
}),
|
|
194
|
+
let n = 0;
|
|
195
|
+
const o = [], r = Object.entries(e), c = r.map(async ([i, p]) => {
|
|
196
|
+
const m = await Oe.packument(i, { registry: x.registry }), d = rt(i, p, m["dist-tags"]);
|
|
197
|
+
o.push(d), t.forEach((O) => {
|
|
198
|
+
const w = s[O];
|
|
199
|
+
w && w[i] && (w[i] = d.newVersion);
|
|
200
|
+
}), n++, await st(n, r.length);
|
|
201
201
|
});
|
|
202
|
-
return await Promise.all(
|
|
203
|
-
},
|
|
204
|
-
if (!$(
|
|
205
|
-
const t = e ||
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
!
|
|
202
|
+
return await Promise.all(c), a(), a(), o;
|
|
203
|
+
}, pt = async ({ update: e }) => {
|
|
204
|
+
if (!$(M)) return S("package.json 文件不存在");
|
|
205
|
+
const t = e || x.check, s = h(M).toString(), n = JSON.parse(s), o = ["dependencies", "devDependencies", "optionalDependencies"], r = {}, c = JSON.parse(s);
|
|
206
|
+
o.forEach((p) => {
|
|
207
|
+
n[p] && Object.entries(n[p]).forEach(([m, d]) => {
|
|
208
|
+
!x.reject.includes(m) && (r[m] = d);
|
|
209
209
|
});
|
|
210
210
|
});
|
|
211
|
-
const
|
|
212
|
-
t ? (v(
|
|
211
|
+
const i = await lt(r, o, c);
|
|
212
|
+
t ? (v(M, JSON.stringify(c, null, 2)), u("文件 package.json 已更新"), a()) : at(i);
|
|
213
213
|
};
|
|
214
|
-
|
|
215
|
-
const
|
|
216
|
-
if (!$(Q)) return
|
|
217
|
-
const e = h(Q).toString(), t = JSON.parse(e),
|
|
218
|
-
let
|
|
214
|
+
g.command("check").option("-u, --update", "更新 package.json 依赖内容", !1).description("升级 package.json 依赖版本").action(pt);
|
|
215
|
+
const mt = le(), ge = "comment.md", dt = ["package.json", ge], [Q, W] = dt.map((e) => f(process.cwd(), e)), gt = () => {
|
|
216
|
+
if (!$(Q)) return S("package.json 文件不存在");
|
|
217
|
+
const e = h(Q).toString(), t = JSON.parse(e), s = ["dependencies", "devDependencies", "optionalDependencies"];
|
|
218
|
+
let n = `### 依赖解析
|
|
219
219
|
|
|
220
220
|
`;
|
|
221
|
-
|
|
222
|
-
t[
|
|
221
|
+
s.forEach((o) => {
|
|
222
|
+
t[o] && (n += `#### ${o}
|
|
223
223
|
|
|
224
|
-
`, Object.keys(t[
|
|
225
|
-
|
|
224
|
+
`, Object.keys(t[o]).forEach((r) => {
|
|
225
|
+
n += `- \`${r}\`: ${mt.comment[r] || ""}
|
|
226
226
|
`;
|
|
227
|
-
}),
|
|
227
|
+
}), n += `
|
|
228
228
|
`);
|
|
229
|
-
}),
|
|
229
|
+
}), n = n.slice(0, -1), v(W, n), a(), u(`${ge} 文件创建成功`), a(), a(l.green(`文件目录 ${W}`));
|
|
230
230
|
};
|
|
231
|
-
|
|
231
|
+
g.command("comment").description("生成依赖注释文件").action(gt);
|
|
232
232
|
const X = { recursive: !0, force: !0 }, ut = () => {
|
|
233
|
-
const e = `${+/* @__PURE__ */ new Date()}`, t =
|
|
234
|
-
|
|
235
|
-
!
|
|
233
|
+
const e = `${+/* @__PURE__ */ new Date()}`, t = y(process.cwd()), s = y(t, e);
|
|
234
|
+
xe("direct:https://gitee.com/biaovorg/vscode-config.git#master", s, { clone: !0 }, async (n) => {
|
|
235
|
+
!n && _(y(s, ".vscode"), y(t, ".vscode"), X), Ce(s, X);
|
|
236
236
|
});
|
|
237
237
|
};
|
|
238
|
-
|
|
239
|
-
const ue = (e, t,
|
|
240
|
-
const
|
|
241
|
-
if (
|
|
242
|
-
if (
|
|
238
|
+
g.command("vscode-config").description("更新 .vscode 配置文件").action(ut);
|
|
239
|
+
const ue = (e, t, s) => {
|
|
240
|
+
const n = Object.entries(t), o = n.findIndex(([i]) => e === i), [r, c] = n[o];
|
|
241
|
+
if (c) {
|
|
242
|
+
if (s[r] === c) return o === n.length - 1 ? !0 : ue(n[o + 1][0], t, s);
|
|
243
243
|
} else
|
|
244
244
|
return !0;
|
|
245
|
-
},
|
|
246
|
-
e && (
|
|
247
|
-
},
|
|
248
|
-
e &&
|
|
249
|
-
},
|
|
250
|
-
const
|
|
251
|
-
if (
|
|
252
|
-
return
|
|
245
|
+
}, ee = (e) => {
|
|
246
|
+
e && (k(`nvm use ${e}`), a(), u(`切换成功 当前版本:${e}`), a());
|
|
247
|
+
}, R = (e) => {
|
|
248
|
+
e && k(`nvm install ${e}`);
|
|
249
|
+
}, ft = (e, t) => {
|
|
250
|
+
const s = k("nvm ls").toString(), n = D(s), [{ major: o, minor: r, patch: c }] = D(e), i = [], p = n.find((m) => {
|
|
251
|
+
if (m.major === o)
|
|
252
|
+
return i.push(m), ue("minor", { minor: r, patch: c }, m);
|
|
253
253
|
});
|
|
254
|
-
if (
|
|
255
|
-
|
|
256
|
-
else if (a(), a(l.red(`输入的版本 ${e} 不存在`)), a(),
|
|
257
|
-
const
|
|
254
|
+
if (p)
|
|
255
|
+
ee(p.semver);
|
|
256
|
+
else if (a(), a(l.red(`输入的版本 ${e} 不存在`)), a(), i.length) {
|
|
257
|
+
const m = i.map((d) => d.semver);
|
|
258
258
|
q.prompt({
|
|
259
259
|
type: "list",
|
|
260
260
|
name: "preset",
|
|
261
261
|
message: "请选择相似版本或输入版本进行安装:",
|
|
262
|
-
choices: [...
|
|
262
|
+
choices: [...m, e, "取消"]
|
|
263
263
|
}).then(({ preset: d }) => {
|
|
264
264
|
if (d !== "取消")
|
|
265
265
|
if (d === e) {
|
|
266
|
-
if (!
|
|
267
|
-
|
|
266
|
+
if (!c) return;
|
|
267
|
+
R(d);
|
|
268
268
|
} else
|
|
269
|
-
|
|
269
|
+
ee(d);
|
|
270
270
|
});
|
|
271
271
|
} else {
|
|
272
|
-
if (!
|
|
272
|
+
if (!c) return;
|
|
273
273
|
if (t.install) {
|
|
274
|
-
|
|
274
|
+
R(e);
|
|
275
275
|
return;
|
|
276
276
|
}
|
|
277
277
|
q.prompt({
|
|
278
278
|
type: "confirm",
|
|
279
279
|
name: "isInstall",
|
|
280
280
|
message: `是否安装 ${e}?`
|
|
281
|
-
}).then(({ isInstall:
|
|
282
|
-
|
|
281
|
+
}).then(({ isInstall: m }) => {
|
|
282
|
+
m && R(e);
|
|
283
283
|
});
|
|
284
284
|
}
|
|
285
285
|
};
|
|
286
|
-
|
|
287
|
-
const
|
|
288
|
-
$(
|
|
289
|
-
const e = JSON.parse(h(
|
|
286
|
+
g.command("node [版本号]").option("-i, --install", "是否安装此版本", !1).description("切换 node 版本,默认选择第一个版本").action(ft);
|
|
287
|
+
const U = ["ANTHROPIC_AUTH_TOKEN", "ANTHROPIC_BASE_URL", "ANTHROPIC_MODEL", "ANTHROPIC_SMALL_FAST_MODEL"], fe = F(f(import.meta.dirname, "ai.jsonc"), !0), te = Object.entries(fe)[0], E = f(se.homedir(), ".claude/settings.json"), j = f(se.homedir(), ".ai-model.json"), he = () => {
|
|
288
|
+
$(E) || (S(`${E} 文件不存在,请先检查或者去安装 Claude Code`), process.exit(1));
|
|
289
|
+
const e = JSON.parse(h(E).toString());
|
|
290
290
|
return !e.env && (e.env = {}), e;
|
|
291
|
-
},
|
|
292
|
-
a(), $(
|
|
293
|
-
const e = JSON.parse(h(
|
|
294
|
-
if (
|
|
295
|
-
const
|
|
296
|
-
return !(!
|
|
291
|
+
}, $e = () => {
|
|
292
|
+
a(), $(j) || (S("配置不存在,请先使用 `ai init` 初始化 AI 模型配置"), process.exit(1));
|
|
293
|
+
const e = JSON.parse(h(j).toString()), t = Object.entries(e).filter(([s, n]) => {
|
|
294
|
+
if (s === te[0]) return !1;
|
|
295
|
+
const o = n.env, r = te[1].env;
|
|
296
|
+
return !(!o || U.some((i) => !o[i] || o[i] === r[i]));
|
|
297
297
|
});
|
|
298
|
-
return t.length || (a(`暂无已配置的 AI 模型,请先配置,路径 ${l.green(
|
|
299
|
-
},
|
|
300
|
-
if (a(), $(
|
|
301
|
-
a(`配置已存在,路径 ${l.green(
|
|
298
|
+
return t.length || (a(`暂无已配置的 AI 模型,请先配置,路径 ${l.green(j)}`), process.exit(1)), [t, e];
|
|
299
|
+
}, ht = () => {
|
|
300
|
+
if (a(), $(j)) {
|
|
301
|
+
a(`配置已存在,路径 ${l.green(j)}`);
|
|
302
302
|
return;
|
|
303
303
|
}
|
|
304
|
-
v(
|
|
305
|
-
},
|
|
306
|
-
const [e] =
|
|
307
|
-
let t = 0,
|
|
308
|
-
const
|
|
309
|
-
e.forEach(([
|
|
310
|
-
t = Math.max(t,
|
|
311
|
-
}), e.forEach(([
|
|
312
|
-
const { ANTHROPIC_BASE_URL:
|
|
304
|
+
v(j, JSON.stringify(fe, null, 2)), u(`配置已初始化,路径 ${l.green(j)}`);
|
|
305
|
+
}, ne = (e) => e.replace(/[\u4e00-\u9fa5]/g, "aa").length, $t = () => {
|
|
306
|
+
const [e] = $e();
|
|
307
|
+
let t = 0, s = -1;
|
|
308
|
+
const n = he();
|
|
309
|
+
e.forEach(([o, r], c) => {
|
|
310
|
+
t = Math.max(t, ne(o)), s < 0 && !U.some((i) => n.env[i] !== r.env[i]) && (s = c);
|
|
311
|
+
}), e.forEach(([o, r], c) => {
|
|
312
|
+
const { ANTHROPIC_BASE_URL: i } = r.env, p = c === s ? l.green("*") : " ", m = pe(ne(o), t + 4, "-"), d = `${p} ${o} ${m} ${i}`;
|
|
313
313
|
a(d);
|
|
314
314
|
});
|
|
315
|
-
},
|
|
316
|
-
const t =
|
|
317
|
-
|
|
318
|
-
},
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
315
|
+
}, yt = async (e) => {
|
|
316
|
+
const t = he(), [s, n] = $e();
|
|
317
|
+
s.some(([o]) => o === e) || (a(`模型 ${l.red(e)} 不存在`), process.exit(1)), U.some((o) => t.env[o] !== n[e].env[o]) ? (t.env = n[e].env, v(E, JSON.stringify(t, null, 2)), u(`模型 ${l.green(e)} 已切换`)) : a(`当前正处于 ${l.green(e)} 模型,无需切换`);
|
|
318
|
+
}, ye = () => {
|
|
319
|
+
const e = "@anthropic-ai/claude-code";
|
|
320
|
+
try {
|
|
321
|
+
k(`npm list -g ${e} --depth=0`).toString().trim().includes(e) || (S(l.red(`请使用 nodejs 安装 ${e}`)), process.exit(1));
|
|
322
|
+
const n = k("npm root -g").toString().trim(), o = f(n, e, "cli.js"), r = f(n, e, "cli.bak.js");
|
|
323
|
+
return !$(r) && _(o, r), { cliPath: o, cliPathBak: r };
|
|
324
|
+
} catch {
|
|
325
|
+
S(l.red(`请使用 nodejs 安装 ${e}`)), process.exit(1);
|
|
326
|
+
}
|
|
327
|
+
}, vt = async () => {
|
|
328
|
+
a(), a("开始汉化 Claude Code");
|
|
329
|
+
const { cliPath: e } = ye(), t = h(e).toString(), s = (await import("./keyword-CwLBndfW.js")).default, n = Object.entries(s).reduce((o, [r, c]) => {
|
|
330
|
+
const i = r.replace(/\n/g, "\\\\n").replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), p = c.replace(/\n/g, "\\n");
|
|
331
|
+
return i[0] === "`" ? o.replace(new RegExp(i), c) : o.replace(new RegExp(`"${i}"`, "g"), `"${p}"`).replace(new RegExp(`('${i}')`, "g"), `'${p}'`);
|
|
332
|
+
}, t);
|
|
333
|
+
v(e, n), u("Claude Code 已汉化");
|
|
334
|
+
}, St = () => {
|
|
335
|
+
a(), a("开始恢复 Claude Code");
|
|
336
|
+
const { cliPath: e, cliPathBak: t } = ye();
|
|
337
|
+
_(t, e), u("Claude Code 已恢复成英文");
|
|
338
|
+
}, A = g.command("ai").description("AI 命令,详细操作请查看 ai -h").helpOption("-h, --help", "输出所有命令").helpCommand(!1);
|
|
339
|
+
A.command("init").description("初始化 AI 模型配置").action(ht);
|
|
340
|
+
A.command("ls").description("查看当前已配置的 AI 模型").action($t);
|
|
341
|
+
A.command("use <模型>").description("切换 AI 模型").action(yt);
|
|
342
|
+
A.command("zh").description("汉化 Claude Code").action(vt);
|
|
343
|
+
A.command("zh-restore").description("恢复汉化 Claude Code").action(St);
|
|
344
|
+
g.usage("[commands] [options]").version(ce, "-v, --version", "输出版本号").helpOption("-h, --help", "输出所有命令");
|
|
345
|
+
g.command("build[:环境] [描述]").description("简化打包提交命令");
|
|
346
|
+
g.command("version<[++]|[@<版本号>]>").description("例如:version++ 或者 version@1.0.0;自动更新 package.json 版本号,自动更新 `README.md` 中的 `version-v<version>-blue` 图标版本");
|
|
347
|
+
g.arguments("<cmd> [env]").action((e, t) => {
|
|
348
|
+
Ze(e, t);
|
|
327
349
|
});
|
|
328
|
-
process.argv.length < 3 ?
|
|
329
|
-
const
|
|
330
|
-
if (
|
|
350
|
+
process.argv.length < 3 ? g.help() : g.parse(process.argv);
|
|
351
|
+
const P = Ae({ pkg: I, updateCheckInterval: 1e3 * 1 });
|
|
352
|
+
if (P.update && P.update.latest !== I.version) {
|
|
331
353
|
let e = "";
|
|
332
|
-
switch (
|
|
354
|
+
switch (P.update.type) {
|
|
333
355
|
case "major":
|
|
334
356
|
e = l.red("{latestVersion}");
|
|
335
357
|
break;
|
|
@@ -340,8 +362,8 @@ if (x.update && x.update.latest !== N.version) {
|
|
|
340
362
|
e = l.green("{latestVersion}");
|
|
341
363
|
break;
|
|
342
364
|
}
|
|
343
|
-
const t = `https://github.com/biaov/${
|
|
344
|
-
|
|
365
|
+
const t = `https://github.com/biaov/${I.name}/compare/v${I.version}...v{latestVersion}`;
|
|
366
|
+
P.notify({
|
|
345
367
|
defer: !1,
|
|
346
368
|
isGlobal: !0,
|
|
347
369
|
message: `有更新 ${l.dim("{currentVersion}")}${l.reset(" → ")}${e}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
// /config
|
|
3
|
+
"Auto-compact": "自动压缩",
|
|
4
|
+
"Show tips": "显示提示",
|
|
5
|
+
"Reduce motion": "减少动画效果",
|
|
6
|
+
"Thinking mode": "深度思考模式",
|
|
7
|
+
"`Fast mode (${Ok} only)`": "`快速模式(仅限 ${Ok})`",
|
|
8
|
+
"Prompt suggestions": "提示词建议",
|
|
9
|
+
"Rewind code (checkpoints)": "代码回退(检查点)",
|
|
10
|
+
"Verbose output": "详细输出",
|
|
11
|
+
"Terminal progress bar": "终端进度条",
|
|
12
|
+
"Show turn duration": "显示每轮耗时条",
|
|
13
|
+
"Default permission mode": "默认权限模式",
|
|
14
|
+
"Respect .gitignore in file picker": "文件选择器中遵守 .gitignore 规则",
|
|
15
|
+
"Always copy full response (skip /copy picker)": "始终复制完整回复(跳过 /copy 选择器)",
|
|
16
|
+
"Auto-update channel": "自动更新频道",
|
|
17
|
+
Theme: "主题",
|
|
18
|
+
Notifications: "通知",
|
|
19
|
+
"Output style": "输出风格",
|
|
20
|
+
Language: "语言",
|
|
21
|
+
"Editor mode": "编辑器模式",
|
|
22
|
+
Model: "模型",
|
|
23
|
+
"Auto-install IDE extension": "自动安装 IDE 扩展",
|
|
24
|
+
"Enable Claude in Chrome by default": "默认启用 Chrome 中的 Claude",
|
|
25
|
+
"Search settings...": "搜索设置",
|
|
26
|
+
" more above": " 条在上方",
|
|
27
|
+
" more below": " 条在下方",
|
|
28
|
+
"Esc to cancel": "Esc 取消",
|
|
29
|
+
"Edit and press Enter to retry, or Esc to cancel": "编辑后按 Enter 重试,或按 Esc 取消",
|
|
30
|
+
"Enter to submit · Esc to cancel": "Enter 提交 · Esc 取消",
|
|
31
|
+
"Tab to toggle · Enter to confirm · Esc to cancel": "Tab 切换 · Enter 确认 · Esc 取消",
|
|
32
|
+
"Enter to copy link · Esc to cancel": "Enter 复制链接 · Esc 取消",
|
|
33
|
+
"Press ↑↓ to navigate, Enter to select, Esc to cancel": "↑↓ 导航 · Enter 选择 · Esc 取消",
|
|
34
|
+
"Esc to cancel · r to cycle dates": "Esc 取消 · r 切换日期",
|
|
35
|
+
"· Esc to cancel": "· Esc 取消",
|
|
36
|
+
"Enter to confirm · Esc to cancel": "Enter 确认 · Esc 取消",
|
|
37
|
+
"Welcome back!": "欢迎回来!",
|
|
38
|
+
"API Usage Billing": "API 使用计费",
|
|
39
|
+
"Tips for getting started": "入门技巧",
|
|
40
|
+
"Run /init to create a CLAUDE.md file with instructions for Claude": "运行 /init 来创建一个 CLAUDE.md 文件,包含 Claude 的使用说明",
|
|
41
|
+
"Recent activity": "最近活动记录",
|
|
42
|
+
"No recent activity": "暂无最近活动记录",
|
|
43
|
+
"create a util logging.py that...": "创建一个工具文件 logging.py,用于...",
|
|
44
|
+
"Initialize a new CLAUDE.md file with codebase documentation": "初始化一个新的 CLAUDE.md 文件,并写入代码库的相关文档说明",
|
|
45
|
+
"Review changed code for reuse, quality, and efficiency, then fix any issues found.": "检查修改过的代码,评估其可复用性、代码质量和执行效率,然后修复发现的所有问题。",
|
|
46
|
+
"Add a new working directory": "添加一个新的工作目录",
|
|
47
|
+
"Clear conversation history and free up context": "清除对话历史记录,释放上下文空间",
|
|
48
|
+
"Set the prompt bar color for this session": "设置本次会话的提示栏颜色",
|
|
49
|
+
"Clear conversation history but keep a summary in context. Optional: /compact [instructions for summarization]": "清除对话历史记录,但在上下文中保留一份摘要。可选:/compact [摘要的自定义指令]",
|
|
50
|
+
"Open config panel": "设置",
|
|
51
|
+
"Copy Claude's last response to clipboard (or /copy N for the Nth-latest)": "复制 Claude 的最后一条回复到剪贴板(或用 /copy N 复制第 N 条最新回复)",
|
|
52
|
+
"Show the total cost and duration of the current session": "显示当前会话的总费用和持续时间",
|
|
53
|
+
"Continue the current session in Claude Desktop": "在 Claude Desktop 中继续当前会话",
|
|
54
|
+
"View uncommitted changes and per-turn diffs": "查看未提交的更改和每轮对话的差异",
|
|
55
|
+
"Diagnose and verify your Claude Code installation and settings": "诊断并验证 Claude Code 的安装和设置",
|
|
56
|
+
"Set effort level for model usage": "设置模型使用的努力等级",
|
|
57
|
+
"Exit the REPL": "退出 REPL",
|
|
58
|
+
"Export the current conversation to a file or clipboard": "将当前对话导出到文件或剪贴板",
|
|
59
|
+
"Show help and available commands": "显示帮助信息和可用命令",
|
|
60
|
+
"View hook configurations for tool events": "查看工具事件的钩子配置",
|
|
61
|
+
"Manage IDE integrations and show status": "管理 IDE 集成并显示状态",
|
|
62
|
+
"Set up Claude GitHub Actions for a repository": "为仓库配置 Claude GitHub Actions",
|
|
63
|
+
"Install the Claude Slack app": "安装 Claude Slack 应用",
|
|
64
|
+
"Sign in with your Anthropic account": "使用 Anthropic 账号登录",
|
|
65
|
+
"Sign out from your Anthropic account": "退出 Anthropic 账号",
|
|
66
|
+
"Manage MCP servers": "管理 MCP 服务器",
|
|
67
|
+
"Edit Claude memory files": "编辑 Claude 记忆文件",
|
|
68
|
+
"Show QR code to download the Claude mobile app": "显示二维码以下载 Claude 移动端应用",
|
|
69
|
+
"Manage allow & deny tool permission rules": "管理工具的允许和拒绝权限规则",
|
|
70
|
+
"Enable plan mode or view the current session plan": "启用计划模式或查看当前会话计划",
|
|
71
|
+
"Manage Claude Code plugins": "管理 Claude Code 插件",
|
|
72
|
+
"View release notes": "查看发布说明",
|
|
73
|
+
"Activate pending plugin changes in the current session": "在当前会话中激活待生效的插件更改",
|
|
74
|
+
"Rename the current conversation": "重命名当前对话",
|
|
75
|
+
"Resume a previous conversation": "恢复之前的对话",
|
|
76
|
+
"Restore the code and/or conversation to a previous point": "将代码和/或对话恢复到之前的某个节点",
|
|
77
|
+
"List available skills": "列出可用的技能",
|
|
78
|
+
"Show your Claude Code usage statistics and activity": "显示 Claude Code 的使用统计和活动记录",
|
|
79
|
+
"Show Claude Code status including version, model, account, API connectivity, and tool statuses": "显示 Claude Code 状态,包括版本、模型、账号、API 连接和工具状态",
|
|
80
|
+
"Order Claude Code stickers": "订购 Claude Code 贴纸",
|
|
81
|
+
"List and manage background tasks": "列出并管理后台任务",
|
|
82
|
+
"Install Shift+Enter key binding for newlines": "安装 Shift+Enter 换行快捷键绑定",
|
|
83
|
+
"Change the theme": "更改主题",
|
|
84
|
+
"Upgrade to Max for higher rate limits and more Opus": "升级到 Max 计划以获得更高速率限制和更多 Opus 用量",
|
|
85
|
+
"Show plan usage limits": "显示计划用量限制",
|
|
86
|
+
"Toggle between Vim and Normal editing modes": "在 Vim 和普通编辑模式之间切换",
|
|
87
|
+
"Research and plan a large-scale change, then execute it in parallel across 5–30 isolated worktree agents that each open a PR.": "研究并规划大规模变更,然后通过 5-30 个独立的 worktree Agent 并行执行,每个 Agent 各自创建一个 PR",
|
|
88
|
+
"Build apps with the Claude API or Anthropic SDK.\nTRIGGER when: code imports `anthropic`/`@anthropic-ai/sdk`/`claude_agent_sdk`, or user asks to use Claude API, Anthropic SDKs, or Agent SDK.\nDO NOT TRIGGER when: code imports `openai`/other AI SDK, general programming, or ML/data-science tasks.": "使用 Claude API 或 Anthropic SDK 构建应用。\n触发条件:代码导入 `anthropic`/`@anthropic-ai/sdk`/`claude_agent_sdk`,或用户要求使用 Claude API、Anthropic SDK 或 Agent SDK。\n不触发条件:代码导入 `openai`/其他 AI SDK、通用编程或机器学习/数据科学任务",
|
|
89
|
+
"Enable debug logging for this session and help diagnose issues": "为本次会话启用调试日志以帮助诊断问题",
|
|
90
|
+
"Generate a report analyzing your Claude Code sessions": "生成分析 Claude Code 会话的报告",
|
|
91
|
+
"Run a prompt or slash command on a recurring interval (e.g. /loop 5m /foo, defaults to 10m)": "按固定间隔重复执行提示词或斜杠命令(例如 /loop 5m /foo,默认间隔 10 分钟)",
|
|
92
|
+
"Get comments from a GitHub pull request": "获取 GitHub Pull Request 的评论",
|
|
93
|
+
"Review a pull request": "审查 Pull Request",
|
|
94
|
+
"Complete a security review of the pending changes on the current branch": "对当前分支的待提交更改进行安全审查",
|
|
95
|
+
"Set up Claude Code's status line UI": "配置 Claude Code 的状态栏 UI",
|
|
96
|
+
"Config dialog dismissed": "配置对话框已关闭",
|
|
97
|
+
"shift+tab to cycle": "按 shift+tab 切换选项",
|
|
98
|
+
"Manage agent configurations": "管理 Agent 配置",
|
|
99
|
+
"Create a branch of the current conversation at this point": "在此处创建当前对话的分支",
|
|
100
|
+
"Ask a quick side question without interrupting the main conversation": "提问一个临时问题,不打断主对话",
|
|
101
|
+
"Claude in Chrome (Beta) settings": "Chrome 中的 Claude(测试版)设置",
|
|
102
|
+
"Visualize current context usage as a colored grid": "以彩色网格可视化当前上下文用量",
|
|
103
|
+
'Use this skill to configure the Claude Code harness via settings.json. Automated behaviors ("from now on when X", "each time X", "whenever X", "before/after X") require hooks configured in settings.json - the harness executes these, not Claude, so memory/preferences cannot fulfill them. Also use for: permissions ("allow X", "add permission", "move permission to"), env vars ("set X=Y"), hook troubleshooting, or any changes to settings.json/settings.local.json files. Examples: "allow npm commands", "add bq permission to global settings", "move permission to user settings", "set DEBUG=true", "when claude stops show X". For simple settings like theme/model, use Config tool.': '使用此技能通过 settings.json 配置 Claude Code 运行环境。自动化行为("从现在起每当 X"、"每次 X"、"每当 X"、"在 X 之前/之后")需要在 settings.json 中配置钩子——由运行环境执行,而非 Claude,因此记忆/偏好设置无法实现这类需求。也适用于:权限管理("允许 X"、"添加权限"、"移动权限至")、环境变量("设置 X=Y")、钩子排查,或对 settings.json/settings.local.json 的任何修改。示例:"允许 npm 命令"、"将 bq 权限添加到全局设置"、"将权限移至用户设置"、"设置 DEBUG=true"、"当 Claude 停止时显示 X"。如需修改主题/模型等简单设置,请使用 Config 工具。',
|
|
104
|
+
"`Toggle fast mode (${Ok} only)`": "`切换快速模式(仅限 ${Ok})`",
|
|
105
|
+
"`Set the AI model for Claude Code (currently ${Ej(JK())})`": "`设置 Claude Code 的 AI 模型(当前模型:${Ej(JK())})`"
|
|
106
|
+
};
|
|
107
|
+
export {
|
|
108
|
+
e as default
|
|
109
|
+
};
|