返回 CodeWhale
install.ts
根目录 / web / lib / content / install.ts
1 /**
2 * Installation commands shared by the install page and homepage hero.
3 * Code-owned shell, never translated.
4 */
5 export const INSTALL_COMMANDS = {
6 shell: "curl -fsSL https://codewhale.net/install.sh | sh",
7 npm: "npm install -g codewhale",
8 windows: "winget install --id HunterBown.CodeWhale --exact --source winget",
9 cargo: "cargo install codewhale-cli --locked",
10 } as const;
11
12 export const INSTALL_PAGE_COMMANDS = {
13 noModifyPath: "curl -fsSL https://codewhale.net/install.sh | sh -s -- --no-modify-path",
14 pathBlock: '# >>> codewhale PATH >>>\nexport PATH="$HOME/.local/bin:$PATH"\n# <<< codewhale PATH <<<',
15 pathNow: 'export PATH="$HOME/.local/bin:$PATH"; hash -r',
16 pathManualBash: "echo 'export PATH=\"$HOME/.local/bin:$PATH\"' >> ~/.bashrc",
17 pathManualZsh: "echo 'export PATH=\"$HOME/.local/bin:$PATH\"' >> ~/.zshrc",
18 version: "codewhale --version",
19 telemetryOff: "codewhale config set telemetry false",
20 update: "codewhale update",
21 uninstall: "codewhale uninstall --yes",
22 removeFiles: "rm -f ~/.local/bin/codewhale ~/.local/bin/codew ~/.local/bin/.codewhale-install.sha256",
23 removeData: "rm -rf ~/.codewhale",
24 windowsUpgrade: "winget upgrade HunterBown.CodeWhale",
25 npmUpdate: "npm install -g codewhale@latest",
26 npmRemove: "npm uninstall -g codewhale",
27 npmPrefix: 'npm config set prefix "$HOME/.npm-global"\necho \'export PATH="$HOME/.npm-global/bin:$PATH"\' >> ~/.bashrc\nexport PATH="$HOME/.npm-global/bin:$PATH"',
28 cargoUpdate: "cargo install codewhale-cli --locked --force",
29 cargoRemove: "cargo uninstall codewhale-cli",
30 brewInstall: "brew install Hmbown/deepseek-tui/codewhale",
31 brewUpdate: "brew upgrade codewhale",
32 brewRemove: "brew uninstall codewhale && brew untap Hmbown/deepseek-tui",
33 cnbVerify: "sha256sum -c codewhale-artifacts-sha256.txt --ignore-missing",
34 } as const;
35
36 export const PATH_MARKER_START = "# >>> codewhale PATH >>>";
37 export const PATH_MARKER_END = "# <<< codewhale PATH <<<";
38
39 export const INSTALL_COPY = {
40 windowsNote: { en: "Windows x64. Winget updates can lag behind GitHub releases; npm is another option.", zh: "适用于 Windows x64。Winget 更新可能晚于 GitHub 发布;也可以通过 npm 安装。" },
41 cargoNote: { en: "Builds from source. Requires current stable Rust and build tools. The Cargo package can lag behind GitHub releases.", zh: "从源码构建,需要当前稳定版 Rust 和构建工具。Cargo 包可能晚于 GitHub 发布。" },
42 metaTitle: { en: "Install Codewhale", zh: "安装 Codewhale" },
43 metaDescription: {
44 en: "Install Codewhale on macOS, Linux or Windows. You need no account.",
45 zh: "在 macOS、Linux 或 Windows 上安装 Codewhale。你无需账号。",
46 },
47
48 scriptLink: { en: "View install script", zh: "查看安装脚本" },
49 releaseLine: { en: "This installs the latest published release, v{version}.", zh: "这会安装最新已发布版本 v{version}。" },
50
51 newTitle: { en: "New to the terminal?", zh: "第一次使用终端?" },
52 newLead: {
53 en: "You install Codewhale by pasting one command into a terminal. These steps show how to open one and how to check that it worked.",
54 zh: "你在终端中粘贴一条命令来安装 Codewhale。下面的步骤说明如何打开终端,以及如何确认安装成功。",
55 },
56 newMacTitle: { en: "macOS", zh: "macOS" },
57 newMac1: { en: "Press Cmd+Space, type Terminal and press Return.", zh: "按 Cmd+空格键,输入 Terminal,然后按回车键。" },
58 newMac2: { en: "Paste this command with Cmd+V and press Return:", zh: "用 Cmd+V 粘贴下面这条命令,然后按回车键:" },
59 newMac3: {
60 en: "When it finishes, open a new window with Cmd+N, type `codewhale --version` and press Return. A version number means it worked.",
61 zh: "安装完成后,按 Cmd+N 打开一个新窗口,输入 `codewhale --version` 并按回车键。显示版本号就说明安装成功了。",
62 },
63 newLinuxTitle: { en: "Linux", zh: "Linux" },
64 newLinux1: {
65 en: "Open a terminal from your application launcher, or press Ctrl+Alt+T on desktops that offer it.",
66 zh: "从应用启动器打开终端;在支持的桌面环境中,也可以按 Ctrl+Alt+T。",
67 },
68 newLinux2: {
69 en: "Paste this command with Ctrl+Shift+V and press Enter:",
70 zh: "用 Ctrl+Shift+V 粘贴下面这条命令,然后按回车键:",
71 },
72 newLinux3: {
73 en: "When it finishes, open a new terminal, type `codewhale --version` and press Enter. A version number means it worked.",
74 zh: "安装完成后,打开一个新终端,输入 `codewhale --version` 并按回车键。显示版本号就说明安装成功了。",
75 },
76 newWinTitle: { en: "Windows", zh: "Windows" },
77 newWin1: { en: "Open the Start menu, type PowerShell and press Enter.", zh: "打开“开始”菜单,输入 PowerShell,然后按回车键。" },
78 newWin2: { en: "Paste this command with Ctrl+V and press Enter:", zh: "用 Ctrl+V 粘贴下面这条命令,然后按回车键:" },
79 newWin3: {
80 en: "When it finishes, close the window, open PowerShell again, type `codewhale --version` and press Enter. A version number means it worked.",
81 zh: "安装完成后,关闭窗口,重新打开 PowerShell,输入 `codewhale --version` 并按回车键。显示版本号就说明安装成功了。",
82 },
83 newNext: {
84 en: "Read the first-time guide: which folder to work in, your first task, and how to undo",
85 zh: "阅读首次使用指南:在哪个文件夹工作、第一个任务,以及如何撤回",
86 },
87
88 pathTitle: { en: "What the installer does to your PATH", zh: "安装程序对 PATH 做了什么" },
89 pathPlaces: {
90 en: "The installer puts `codewhale` and `codew` in `~/.local/bin`. When that folder is not on your PATH, it adds three marked lines to the startup file for your shell:",
91 zh: "安装程序会把 `codewhale` 和 `codew` 放进 `~/.local/bin`。当该文件夹不在你的 PATH 中时,它会向你所用 shell 的启动文件添加三行带标记的内容:",
92 },
93 pathZsh: { en: "zsh: `~/.zshrc`, or `.zshrc` in `$ZDOTDIR` when you set it.", zh: "zsh:`~/.zshrc`;如果设置了 `$ZDOTDIR`,则是其中的 `.zshrc`。" },
94 pathBashLinux: { en: "bash on Linux: `~/.bashrc`.", zh: "Linux 上的 bash:`~/.bashrc`。" },
95 pathBashMac: {
96 en: "bash on macOS: `~/.bash_profile`, or `~/.bash_login` or `~/.profile` when one of those exists and `~/.bash_profile` does not.",
97 zh: "macOS 上的 bash:`~/.bash_profile`;如果它不存在而 `~/.bash_login` 或 `~/.profile` 已存在,则使用后者。",
98 },
99 pathOther: { en: "sh, dash, ksh and other POSIX shells: `~/.profile`.", zh: "sh、dash、ksh 等其他 POSIX shell:`~/.profile`。" },
100 pathFish: { en: "fish: nothing is edited. The installer prints `fish_add_path` for you to run.", zh: "fish:不会修改任何文件,安装程序会打印 `fish_add_path` 供你自行运行。" },
101 pathBlockIntro: { en: "The three lines are:", zh: "这三行是:" },
102 pathBlockAfter: {
103 en: "The installer prints them and a command that removes them, and changes nothing else in the file. It does not edit your profile when the folder is already on your PATH. Shells that are already open do not reread the profile, so run this line in the shell you installed from, or open a new terminal:",
104 zh: "安装程序会打印这三行,以及一条用于删除它们的命令,并且不会改动文件中的其他内容。如果该文件夹已经在你的 PATH 中,它不会修改你的启动文件。已经打开的 shell 不会重新读取启动文件,因此请在你运行安装命令的 shell 中执行下面这一行,或打开一个新终端:",
105 },
106 pathOptOut: {
107 en: "To leave your startup file alone, run the installer with `--no-modify-path`, or set `CODEWHALE_NO_MODIFY_PATH=1`:",
108 zh: "如果不想让安装程序修改启动文件,请加上 `--no-modify-path` 运行,或设置 `CODEWHALE_NO_MODIFY_PATH=1`:",
109 },
110 pathManualIntro: {
111 en: "Then add the line for your shell to its startup file yourself. For fish, run `fish_add_path ~/.local/bin`.",
112 zh: "然后自行把对应你所用 shell 的那一行加入它的启动文件。fish 请运行 `fish_add_path ~/.local/bin`。",
113 },
114 pathManualBash: { en: "For bash, write it to `~/.bashrc`:", zh: "bash:写入 `~/.bashrc`:" },
115 pathManualZsh: { en: "For zsh, write it to `~/.zshrc`:", zh: "zsh:写入 `~/.zshrc`:" },
116
117 verifyTitle: { en: "Check that it worked", zh: "确认安装成功" },
118 verifyBody: {
119 en: "Run this in a shell that has the PATH line. It prints `codewhale {version}` followed by a short commit id in parentheses.",
120 zh: "请在已带有 PATH 设置的 shell 中运行。它会打印 `codewhale {version}`,后面括号里是一个简短的提交编号。",
121 },
122 verifyBodyUnknown: {
123 en: "Run this in a shell that has the PATH line. It prints `codewhale` and its version.",
124 zh: "请在已带有 PATH 设置的 shell 中运行。它会打印 `codewhale` 及其版本号。",
125 },
126
127 firstTitle: { en: "Your first task", zh: "你的第一个任务" },
128 firstStep1: {
129 en: "Run `codewhale` in the folder you want to work in. A git repository is not required. In a git repository, edits inside it run without asking. In a folder without git, Codewhale asks before every edit.",
130 zh: "在你想工作的文件夹中运行 `codewhale`。不要求是 git 仓库。在 git 仓库中,仓库内的编辑无需询问;在没有 git 的文件夹中,Codewhale 会在每次编辑前询问你。",
131 },
132 firstStep2: {
133 en: "Type `/provider` before your first message and choose a provider, or paste a Custom endpoint.",
134 zh: "在发送第一条消息之前输入 `/provider`,选择一个提供商,或粘贴自定义端点。",
135 },
136 firstStep3: {
137 en: "Give it a small task. It asks before it runs a command or changes a file outside that rule. Then type `/receipts` to read what it did, and `/cost` to see what it cost or why the cost is unknown.",
138 zh: "给它一个小任务。在运行命令,或修改不符合上述规则的文件之前,它会先询问你。然后输入 `/receipts` 查看它做了什么,输入 `/cost` 查看费用,或查看费用未知的原因。",
139 },
140 quickstart: { en: "Read the quickstart", zh: "阅读快速入门" },
141
142 usageTitle: { en: "Usage counting", zh: "使用统计" },
143 usageBody: {
144 en: "Usage counting is on by default. Run `codewhale config set telemetry false` to turn it off.",
145 zh: "使用统计默认开启。运行 `codewhale config set telemetry false` 可将其关闭。",
146 },
147 usageInstaller: {
148 en: "When it finishes, the installer runs a short health check, `codewhale doctor --installs --brief`, with usage counting off. It does not start Codewhale.",
149 zh: "安装程序结束时会运行一次简短的健康检查 `codewhale doctor --installs --brief`,该次运行不做使用统计,也不会启动 Codewhale。",
150 },
151 usageLink: { en: "What is counted", zh: "统计的内容" },
152
153 updateTitle: { en: "Update", zh: "更新" },
154 updateBody: {
155 en: "Run `codewhale update`. If you installed with npm, Cargo or Homebrew, update with that tool instead, as shown below.",
156 zh: "运行 `codewhale update`。如果你是通过 npm、Cargo 或 Homebrew 安装的,请改用对应的工具更新,见下文。",
157 },
158
159 removeTitle: { en: "Remove it", zh: "卸载" },
160 removeNow: {
161 en: "Run `codewhale uninstall --yes`. Your data in `~/.codewhale` is kept.",
162 zh: "运行 `codewhale uninstall --yes`。`~/.codewhale` 中的数据会保留。",
163 },
164 removeFilesNow: { en: "To remove an older release by hand, delete its files:", zh: "要手动卸载较早的版本,请删除它的文件:" },
165 removeFilesOnly: { en: "Removal for v{version}: delete the program files.", zh: "v{version} 的卸载方法:删除程序文件。" },
166 removeFilesOnlyUnknown: { en: "Removal for the released version: delete the program files.", zh: "已发布版本的卸载方法:删除程序文件。" },
167 removePath: {
168 en: "Then delete the three lines from `# >>> codewhale PATH >>>` to `# <<< codewhale PATH <<<`, inclusive, from the startup file the installer named.",
169 zh: "然后从安装程序指出的启动文件中,删除从 `# >>> codewhale PATH >>>` 到 `# <<< codewhale PATH <<<` 的三行(含这两行标记)。",
170 },
171 removeData: {
172 en: "`~/.codewhale` holds your settings, sessions and any keys you saved. Delete it only if you want them gone:",
173 zh: "`~/.codewhale` 保存着你的设置、会话和你保存过的密钥。只有在你想一并删除它们时才删除:",
174 },
175 removeGuide: {
176 en: "The v{version} guide also lists each repository's `.codewhale` folder as a place Codewhale writes.",
177 zh: "v{version} 的指南还列出了每个仓库中的 `.codewhale` 文件夹,它也是 Codewhale 写入数据的位置。",
178 },
179
180 troubleTitle: { en: "If something goes wrong", zh: "遇到问题时" },
181 troubleNotFound: {
182 en: "If your shell says `codewhale: command not found`, it has not picked up the PATH line yet. Run the line shown above in that shell, or open a new terminal.",
183 zh: "如果 shell 提示 `codewhale: command not found`,说明它还没有读取到 PATH 设置。请在该 shell 中运行上面的那一行,或打开一个新终端。",
184 },
185 troubleQueued: {
186 en: "If messages say they were saved for later after you connect, quit with Ctrl+D and run `codewhale` again.",
187 zh: "如果在你连接提供商之后,消息仍显示为稍后保存,请按 Ctrl+D 退出,然后重新运行 `codewhale`。",
188 },
189 troubleLegacy: {
190 en: "A Custom (OpenAI-compatible) row in `/provider` may show \"legacy ! provider admission failed\" although the endpoint works.",
191 zh: "`/provider` 中的“Custom (OpenAI-compatible)”一行可能显示“legacy ! provider admission failed”,但该端点实际可以正常使用。",
192 },
193 troubleMore: { en: "More fixes", zh: "更多解决办法" },
194
195 channelsTitle: { en: "Other ways to install", zh: "其他安装方式" },
196 channelsLead: {
197 en: "Each channel updates and removes with its own tool. The steps here are the ones in the v{version} guide.",
198 zh: "每种安装方式都用各自的工具更新和卸载。这里的步骤与 v{version} 的指南一致。",
199 },
200 channelsLeadUnknown: {
201 en: "Each channel updates and removes with its own tool.",
202 zh: "每种安装方式都用各自的工具更新和卸载。",
203 },
204
205 windowsTitle: { en: "Windows", zh: "Windows" },
206 windowsVerify: { en: "Open a new terminal and run `codewhale --version`.", zh: "打开一个新终端并运行 `codewhale --version`。" },
207 windowsSandbox: {
208 en: "Windows has no operating-system sandbox yet. In Ask, Codewhale asks before shell commands that are not read-only.",
209 zh: "Windows 目前没有操作系统级沙箱。在 Ask 下,Codewhale 会在运行非只读的 shell 命令之前询问你。",
210 },
211 windowsPackage: {
212 en: "The winget package is for Windows x64 and can lag behind GitHub releases. On Windows ARM64, use npm under native ARM64 Node.js.",
213 zh: "winget 包适用于 Windows x64,可能晚于 GitHub 发布。在 Windows ARM64 上,请在原生 ARM64 的 Node.js 下使用 npm。",
214 },
215 windowsUpdate: {
216 en: "Update with `winget upgrade HunterBown.CodeWhale`, or with npm if you installed with npm. Remove it with winget or with npm, whichever installed it.",
217 zh: "使用 `winget upgrade HunterBown.CodeWhale` 更新;如果是通过 npm 安装的,则用 npm 更新。卸载时使用当初安装它的 winget 或 npm。",
218 },
219
220 npmTitle: { en: "npm", zh: "npm" },
221 npmBody: {
222 en: "npm needs Node.js 22 or newer and a global folder you can write to, and that folder's `bin` must be on your PATH. On Windows, Node stays the launcher for the whole session, so do not stop it by process name.",
223 zh: "npm 需要 Node.js 22 或更高版本,以及一个你有写入权限的全局文件夹,并且该文件夹的 `bin` 必须在 PATH 中。在 Windows 上,Node 会在整个会话期间作为启动器,因此不要按进程名终止它。",
224 },
225 npmEacces: {
226 en: "If npm stops with `EACCES`, do not use sudo. Point npm at a folder you own:",
227 zh: "如果 npm 因 `EACCES` 而停止,不要使用 sudo。请让 npm 使用你自己拥有的文件夹:",
228 },
229 npmScripts: {
230 en: "npm 11 may then print a notice that one package has install scripts not yet covered by `allowScripts`. The notice names `codewhale`. `codewhale --version` still works, because the first run fetches the program if the install script did not.",
231 zh: "npm 11 随后可能打印一条提示,说有一个包的安装脚本尚未被 `allowScripts` 覆盖,提示中会点名 `codewhale`。`codewhale --version` 仍然可以运行,因为即使安装脚本没有运行,首次运行时也会获取程序。",
232 },
233 npmUpdate: {
234 en: "Update with `npm install -g codewhale@latest`. Remove the program with `npm uninstall -g codewhale`; it leaves `~/.codewhale`.",
235 zh: "使用 `npm install -g codewhale@latest` 更新。使用 `npm uninstall -g codewhale` 卸载程序;它会保留 `~/.codewhale`。",
236 },
237
238 cargoTitle: { en: "Cargo", zh: "Cargo" },
239 cargoBody: {
240 en: "Cargo builds from source. It needs current stable Rust, and on Linux `libdbus-1-dev` and `pkg-config`. It installs `codewhale` only, with no `codew`. Install `codewhale-cli`: the Cargo package named `codewhale` is an older package.",
241 zh: "Cargo 从源码构建,需要当前稳定版 Rust;在 Linux 上还需要 `libdbus-1-dev` 和 `pkg-config`。它只安装 `codewhale`,不含 `codew`。请安装 `codewhale-cli`:名为 `codewhale` 的 Cargo 包是一个较早的旧包。",
242 },
243 cargoUpdate: { en: "Update with the command below. Remove it with `cargo uninstall codewhale-cli`.", zh: "使用下面的命令更新。使用 `cargo uninstall codewhale-cli` 卸载。" },
244
245 brewTitle: { en: "Homebrew on Linux", zh: "Linux 上的 Homebrew" },
246 brewBody: {
247 en: "The full name taps and trusts in one step. The two-step form fails on Homebrew 7.",
248 zh: "使用完整名称可以一步完成 tap 和信任。两步写法在 Homebrew 7 上会失败。",
249 },
250 brewUpdate: { en: "Update with `brew upgrade codewhale`. Remove it with:", zh: "使用 `brew upgrade codewhale` 更新。使用下面的命令卸载:" },
251
252 mirrorsTitle: { en: "Mirrors for mainland China", zh: "中国大陆镜像" },
253 mirrorsNpm: {
254 en: "npmmirror serves the npm package. The program it installs still downloads from a release asset source: GitHub, or the CNB mirror, which the npm package tries on Linux x64.",
255 zh: "npmmirror 提供 npm 包。它安装的程序仍然要从发布资源来源下载:GitHub,或 CNB 镜像(npm 包在 Linux x64 上会自动尝试 CNB)。",
256 },
257 mirrorsCnb: {
258 en: "The CNB mirror carries the source of each release tag and, for tags it has built, Linux x64 binaries with a checksum manifest. A mirrored source tag is not a binary release, so confirm the version you want has binaries and a manifest, then verify the download:",
259 zh: "CNB 镜像保存每个发布标签的源码;对于它已构建的标签,还提供 Linux x64 二进制文件及校验清单。镜像的源码标签不等于二进制发布,请先确认你要的版本有二进制文件和校验清单,再校验下载文件:",
260 },
261 mirrorsGuide: { en: "Read the mirror guide", zh: "阅读镜像指南" },
262
263 fullGuide: { en: "Read the full installation guide on GitHub", zh: "在 GitHub 上阅读完整安装指南" },
264 } as const;
265
265 lines TYPESCRIPT