返回 CodeWhale
docs-review.ts
根目录 / web / lib / i18n / dictionaries / zh / docs-review.ts
1 import type { DocsReviewDict } from "../types";
2
3 /** 「查看改动」页的简体中文词典;与 `en/docs-review.ts` 逐段对应。 */
4 export const docsReview: DocsReviewDict = {
5 metaTitle: "查看改动 · Codewhale 文档",
6 metaDescription:
7 "查看 Codewhale 在一次会话中改过的每个文件,把工作区回滚到之前的回合,对 diff 做代码审查,并为审查保留一份回执。",
8 bodyClassName: "text-ink-soft leading-[1.9] tracking-wide",
9 title: "查看改动",
10 lede:
11 "Codewhale 每改一处都会当场展示给你,并在每个回合前后为工作区保存快照。这一页介绍如何查看改了什么、把文件恢复原样,以及在推送之前请它再审一遍。",
12 sections: [
13 {
14 id: "diff",
15 title: "查看改动",
16 blocks: [
17 { p: "每次修改文件,都会以 diff 的形式出现在对话记录里。想一次看全,运行:" },
18 { code: "/diff", lang: "Codewhale" },
19 {
20 p: "`/diff` 会显示本次会话开始以来的全部改动。你自己的 git 历史不受影响,`git diff` 和 `git status` 照常可用。",
21 },
22 ],
23 },
24 {
25 id: "restore",
26 title: "把文件回滚到之前的回合",
27 blocks: [
28 {
29 p: "每个回合开始前和结束后,Codewhale 都会把工作区快照存进一个独立的 git 存储。它从不写入你仓库自己的 `.git`,在不是 git 仓库的文件夹里也能用。",
30 },
31 {
32 code: `/restore # list the 20 most recent snapshots
33 /restore list 50 # list more (up to 100)
34 /restore 1 # put files back to the newest snapshot`,
35 lang: "Codewhale",
36 },
37 {
38 p: "恢复会改动文件,所以需要工作区已被信任(`/trust on`)或处于 Full Access;查看快照列表则不受限制。你也可以直接说“撤销你刚才的修改”,Codewhale 可以回滚它自己的那个回合。",
39 },
40 {
41 p: "`/undo` 是另一回事:它只是从对话中删掉最后一次问答。想恢复文件,请用 `/restore`。",
42 },
43 {
44 note: "快照保留 7 天。超过 2 GB 的工作区不做快照,Codewhale 会提示你一次;如果仍想要快照,可以在配置中调大 `[snapshots] max_workspace_gb`。如果没有安装 git 或磁盘已满,回合照常运行,只是不做快照。",
45 },
46 ],
47 },
48 {
49 id: "code-review",
50 title: "做一次代码审查",
51 blocks: [
52 {
53 p: "在会话中,`/review` 可以对一个文件、一段 diff 或一个拉取请求做结构化审查。在 shell 中,`codewhale review` 会审查一段 git diff 并输出发现的问题:",
54 },
55 {
56 code: `codewhale review # unstaged changes in the working tree
57 codewhale review --staged # what you are about to commit
58 codewhale review --base origin/main # everything on this branch
59 codewhale review --pr 123 # a GitHub pull request (needs gh)`,
60 lang: "终端",
61 },
62 {
63 p: "加上 `--path <file>` 只审查一个路径,用 `--model` 指定审查模型,用 `--json` 输出机器可读结果。超过 200,000 个字符的 diff 会被直接拒绝,而不是截断;需要时可以用 `--max-chars` 调高上限。",
64 },
65 {
66 note: "`--post` 会把审查结果作为评论发布到拉取请求上。不加这个参数时,除了发给模型的请求,没有任何内容离开你的终端。",
67 },
68 ],
69 },
70 {
71 id: "receipts",
72 title: "为审查保留回执",
73 blocks: [
74 {
75 p: "审查回执记录了审查了什么、发现了什么,让你能证明推送出去的 diff 正是被审查过的那一份。",
76 },
77 {
78 code: `codewhale review --base origin/main --write-receipt
79 codewhale review --base origin/main --check-receipt`,
80 lang: "终端",
81 },
82 {
83 list: [
84 "`--write-receipt` 在审查成功后保存一个本地 JSON 文件:diff 的指纹、提供商与模型、各类发现的数量、未解决的风险,以及审查文本的哈希。它不保存 diff 本身。",
85 "`--check-receipt` 不调用模型。如果 diff 在回执生成后发生了变化、审查留下了未解决的风险,或者附带的检查没有通过,它都会以非零状态退出,因此可以用作推送前的检查关卡。",
86 "`--receipt-path <file>` 写入或读取指定的回执,而不是最新的那一份。",
87 ],
88 },
89 {
90 note: "目前回执只覆盖代码审查。普通智能体回合的回执——把每次工具调用、审批和文件改动汇总成一份导出——已经设计好,但还没有实现。",
91 },
92 ],
93 },
94 {
95 id: "export",
96 title: "保存整个会话",
97 blocks: [
98 { p: "想保留或分享一次会话的完整记录,可以导出:" },
99 {
100 code: `/export clipboard # a redacted copy of this session
101 /export file notes/session.md # the same, written to a file
102 codewhale sessions export <id> # full archive: messages, tool calls, results, artifacts`,
103 lang: "Codewhale / 终端",
104 },
105 {
106 p: "`codewhale sessions` 会列出已保存的会话及其 id。完整归档包含全部上下文,请像对待源代码一样对待它。",
107 },
108 ],
109 },
110 ],
111 next: [
112 {
113 href: "/docs/modes",
114 label: "设置模式与审批",
115 note: "决定 Codewhale 修改或运行任何东西之前是否先问你。",
116 },
117 {
118 href: "/docs/fleet",
119 label: "运行工作流",
120 note: "可重复的多步骤工作,每次运行都有记录。",
121 },
122 {
123 href: "/docs/troubleshooting",
124 label: "排查问题",
125 note: "回合卡住、密钥失效或会话无法恢复时该怎么办。",
126 },
127 ],
128 sourceNote:
129 "来源文档:docs/RECEIPTS.md、docs/CONFIGURATION.md([snapshots])、crates/tui/src/snapshot/mod.rs · 修改时同步更新 docs-map.ts。",
130 };
131
131 lines TYPESCRIPT