|
1 | 1 | --- |
2 | | -title: dry-run and clean |
3 | | -description: Explains how tnmsc previews outputs, then performs cleanup, with dry-run and built-in guardrails used to control risk. |
4 | | -sidebarTitle: dry-run and clean |
| 2 | +title: dry-run 与 clean |
| 3 | +description: 说明 tnmsc 如何通过 `dry-run` 预览输出,再通过 `clean` 执行清理,并依靠内建护栏控制风险。 |
| 4 | +sidebarTitle: dry-run 与 clean |
5 | 5 | status: stable |
6 | 6 | --- |
7 | 7 |
|
8 | | -# dry-run and clean |
| 8 | +# `dry-run` 与 `clean` |
9 | 9 |
|
10 | | -## What `dry-run` Does |
| 10 | +## `dry-run` 会做什么 |
11 | 11 |
|
12 | | -`tnmsc dry-run` previews the files and directories that the current execution would write. It is especially useful in these situations: |
| 12 | +`tnmsc dry-run` 会预览当前执行将要写入的文件和目录。它在以下场景中特别有用: |
13 | 13 |
|
14 | | -- When integrating a project for the first time |
15 | | -- Right after changing `plugin.config.ts` |
16 | | -- Right after changing source prompt scope or global config |
17 | | -- Before validating the impact of a large source-content change |
| 14 | +- 首次接入一个项目时 |
| 15 | +- 修改 `plugin.config.ts` 之后 |
| 16 | +- 修改源 prompt 作用域或全局配置之后 |
| 17 | +- 想验证一次较大源内容变更的影响之前 |
18 | 18 |
|
19 | | -## What `clean` Does |
| 19 | +## `clean` 会做什么 |
20 | 20 |
|
21 | | -`tnmsc clean` removes generated output files. It is not a blind directory deletion command. It follows the current output model and the cleanup declarations built into the runtime. |
| 21 | +`tnmsc clean` 会移除生成出的输出文件。它不是一个盲删目录的命令,而是遵循当前输出模型和运行时内建的清理声明来执行。 |
22 | 22 |
|
23 | | -After normal cleanup finishes, `tnmsc clean` also scans the current project source tree and removes remaining empty directories. That empty-dir sweep explicitly skips Git internals as well as dependency, build-output, and cache directory trees. |
| 23 | +常规清理完成后,`tnmsc clean` 还会扫描当前项目源码树,删除剩余的空目录。这个空目录扫描会明确跳过 Git 内部目录,以及依赖、构建输出和缓存目录树。 |
24 | 24 |
|
25 | | -Before running it for real, prefer: |
| 25 | +在真正执行之前,优先先运行: |
26 | 26 |
|
27 | 27 | ```sh |
28 | 28 | tnmsc clean --dry-run |
29 | 29 | ``` |
30 | 30 |
|
31 | | -`--dry-run` will also show the empty directories that would be removed afterward. |
| 31 | +`--dry-run` 也会显示后续将被移除的空目录。 |
32 | 32 |
|
33 | | -## Risk Boundary |
| 33 | +## 风险边界 |
34 | 34 |
|
35 | | -If your output directories also contain hand-written files or outputs from other tools, do not rely on a `cleanupProtection` block in `~/.aindex/.tnmsc.json`. Keep those files out of tnmsc-managed output paths, or adjust the project/plugin assembly before running a real clean. |
| 35 | +如果你的输出目录里还混有手写文件或其他工具生成的内容,不要依赖 `~/.aindex/.tnmsc.json` 中的 `cleanupProtection` 配置块。应把这些文件移出 tnmsc 管理的输出路径,或者在真正执行清理前调整项目或插件装配方式。 |
36 | 36 |
|
37 | | -## Recommended Habits |
| 37 | +## 推荐习惯 |
38 | 38 |
|
39 | | -1. Run `dry-run` first when you change config, source scope, or plugin assembly. |
40 | | -2. Run `clean --dry-run` first when you really intend to clean. |
41 | | -3. If something looks wrong, continue with [Troubleshooting](/docs/cli/troubleshooting). |
| 39 | +1. 当你修改配置、源作用域或插件装配时,先运行 `dry-run`。 |
| 40 | +2. 当你确实准备清理时,先运行 `clean --dry-run`。 |
| 41 | +3. 如果结果看起来不对,请继续查看 [故障排查](/docs/cli/troubleshooting)。 |
0 commit comments