@icebreakers/monorepo-templates 1.0.15 → 1.2.0

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.
Files changed (161) hide show
  1. package/README.md +12 -8
  2. package/README.zh-CN.md +16 -0
  3. package/assets/.changeset/ledger.yaml +51 -0
  4. package/assets/.github/ISSUE_TEMPLATE/config.yml +1 -1
  5. package/assets/.github/workflows/release.yml +22 -97
  6. package/assets/AGENTS.md +5 -4
  7. package/assets/CONTRIBUTING.md +27 -2
  8. package/assets/SECURITY.md +12 -14
  9. package/assets/package.json +18 -10
  10. package/assets/pnpm-workspace.yaml +8 -0
  11. package/package.json +6 -4
  12. package/templates/cli/package.json +11 -4
  13. package/templates/client/package.json +22 -6
  14. package/templates/server/package.json +14 -7
  15. package/templates/server/vitest.config.ts +1 -4
  16. package/templates/tsdown/package.json +11 -4
  17. package/templates/tsdown/vitest.config.ts +1 -4
  18. package/templates/vitepress/.vitepress/config.ts +146 -165
  19. package/templates/vitepress/ai/index.md +12 -23
  20. package/templates/vitepress/ai/llms-txt.md +13 -31
  21. package/templates/vitepress/getting-started.md +3 -32
  22. package/templates/vitepress/index.md +27 -30
  23. package/templates/vitepress/knowledge/index.md +17 -41
  24. package/templates/vitepress/monorepo/commands.md +13 -18
  25. package/templates/vitepress/monorepo/index.md +22 -100
  26. package/templates/vitepress/monorepo/manage.md +15 -227
  27. package/templates/vitepress/monorepo/publish.md +17 -245
  28. package/templates/vitepress/monorepo/templates.md +10 -17
  29. package/templates/vitepress/monorepo/troubleshooting.md +13 -16
  30. package/templates/vitepress/package.json +11 -5
  31. package/templates/vitepress/public/_redirects +3 -0
  32. package/templates/vitepress/repoctl/adopt-existing.md +51 -53
  33. package/templates/vitepress/repoctl/aliases.md +18 -18
  34. package/templates/vitepress/repoctl/checks.md +21 -68
  35. package/templates/vitepress/repoctl/commands.md +16 -64
  36. package/templates/vitepress/repoctl/config.md +14 -35
  37. package/templates/vitepress/repoctl/doctor.md +20 -60
  38. package/templates/vitepress/repoctl/execution-model.md +16 -69
  39. package/templates/vitepress/repoctl/getting-started.md +34 -40
  40. package/templates/vitepress/repoctl/index.md +33 -61
  41. package/templates/vitepress/repoctl/reports.md +20 -74
  42. package/templates/vitepress/repoctl/scenarios.md +26 -28
  43. package/templates/vitepress/repoctl/template-assets.md +19 -88
  44. package/templates/vitepress/repoctl/templates.md +50 -81
  45. package/templates/vitepress/repoctl/troubleshooting.md +32 -46
  46. package/templates/vitepress/repoctl/workflows.md +38 -67
  47. package/templates/vitepress/thinking.md +4 -85
  48. package/templates/vitepress/tools/changeset.md +12 -85
  49. package/templates/vitepress/tools/husky.md +6 -124
  50. package/templates/vitepress/tools/index.md +13 -32
  51. package/templates/vitepress/tools/lint-staged.md +5 -96
  52. package/templates/vitepress/tools/llms-txt.md +4 -6
  53. package/templates/vitepress/tools/pnpm.md +7 -119
  54. package/templates/vitepress/tools/renovate.md +3 -87
  55. package/templates/vitepress/tools/turborepo.md +5 -157
  56. package/templates/vitepress/why/how-to-reuse-js-code.md +6 -247
  57. package/templates/vitepress/why/index.md +14 -1
  58. package/templates/vitepress/why/js-cjs-mjs.md +9 -96
  59. package/templates/vitepress/why/js-keywords.md +4 -129
  60. package/templates/vitepress/why/modern/bundlers.md +3 -50
  61. package/templates/vitepress/why/modern/dts.md +4 -90
  62. package/templates/vitepress/why/modern/esm-vs-cjs.md +4 -81
  63. package/templates/vitepress/why/modern/index.md +10 -51
  64. package/templates/vitepress/why/modern/package-entry-points.md +6 -117
  65. package/templates/vitepress/why/modern/typescript.md +4 -152
  66. package/templates/vitepress/why/publish-basic-npm-package.md +17 -144
  67. package/templates/vitepress/why/what-is-npm-package.md +4 -159
  68. package/templates/vitepress/zh/ai/index.md +33 -0
  69. package/templates/vitepress/zh/ai/llms-txt.md +42 -0
  70. package/templates/vitepress/zh/getting-started.md +40 -0
  71. package/templates/vitepress/zh/index.md +66 -0
  72. package/templates/vitepress/zh/knowledge/index.md +50 -0
  73. package/templates/vitepress/zh/monorepo/commands.md +21 -0
  74. package/templates/vitepress/zh/monorepo/index.md +115 -0
  75. package/templates/vitepress/zh/monorepo/manage.md +243 -0
  76. package/templates/vitepress/zh/monorepo/publish.md +87 -0
  77. package/templates/vitepress/zh/monorepo/templates.md +21 -0
  78. package/templates/vitepress/zh/monorepo/troubleshooting.md +20 -0
  79. package/templates/vitepress/zh/repoctl/adopt-existing.md +135 -0
  80. package/templates/vitepress/{en → zh}/repoctl/aliases.md +18 -18
  81. package/templates/vitepress/zh/repoctl/checks.md +86 -0
  82. package/templates/vitepress/zh/repoctl/commands.md +168 -0
  83. package/templates/vitepress/zh/repoctl/config.md +90 -0
  84. package/templates/vitepress/zh/repoctl/doctor.md +86 -0
  85. package/templates/vitepress/zh/repoctl/execution-model.md +81 -0
  86. package/templates/vitepress/zh/repoctl/getting-started.md +122 -0
  87. package/templates/vitepress/zh/repoctl/index.md +102 -0
  88. package/templates/vitepress/zh/repoctl/reports.md +94 -0
  89. package/templates/vitepress/{en → zh}/repoctl/scenarios.md +28 -26
  90. package/templates/vitepress/zh/repoctl/template-assets.md +116 -0
  91. package/templates/vitepress/zh/repoctl/templates.md +159 -0
  92. package/templates/vitepress/zh/repoctl/troubleshooting.md +110 -0
  93. package/templates/vitepress/zh/repoctl/workflows.md +118 -0
  94. package/templates/vitepress/zh/thinking.md +88 -0
  95. package/templates/vitepress/zh/tools/changeset.md +75 -0
  96. package/templates/vitepress/zh/tools/husky.md +130 -0
  97. package/templates/vitepress/zh/tools/index.md +38 -0
  98. package/templates/vitepress/zh/tools/lint-staged.md +103 -0
  99. package/templates/vitepress/zh/tools/llms-txt.md +9 -0
  100. package/templates/vitepress/zh/tools/pnpm.md +127 -0
  101. package/templates/vitepress/zh/tools/renovate.md +91 -0
  102. package/templates/vitepress/zh/tools/turborepo.md +166 -0
  103. package/templates/vitepress/zh/why/assets/npm-dt.svg +15 -0
  104. package/templates/vitepress/zh/why/assets/npm-ts.svg +19 -0
  105. package/templates/vitepress/zh/why/examples/0.npm-basic-package/index.js +10 -0
  106. package/templates/vitepress/zh/why/examples/0.npm-basic-package/package.json +11 -0
  107. package/templates/vitepress/zh/why/examples/1.npm-basic-package/index.cjs +12 -0
  108. package/templates/vitepress/zh/why/examples/1.npm-basic-package/index.d.ts +1 -0
  109. package/templates/vitepress/zh/why/examples/1.npm-basic-package/index.js +8 -0
  110. package/templates/vitepress/zh/why/examples/1.npm-basic-package/package.json +19 -0
  111. package/templates/vitepress/zh/why/examples/2.npm-basic-package/README.md +1 -0
  112. package/templates/vitepress/zh/why/examples/2.npm-basic-package/package-lock.json +30 -0
  113. package/templates/vitepress/zh/why/examples/2.npm-basic-package/package.json +35 -0
  114. package/templates/vitepress/zh/why/examples/2.npm-basic-package/rename-ext.js +24 -0
  115. package/templates/vitepress/zh/why/examples/2.npm-basic-package/src/index.ts +8 -0
  116. package/templates/vitepress/zh/why/examples/2.npm-basic-package/tsconfig.cjs.json +8 -0
  117. package/templates/vitepress/zh/why/examples/2.npm-basic-package/tsconfig.esm.json +7 -0
  118. package/templates/vitepress/zh/why/examples/2.npm-basic-package/tsconfig.json +18 -0
  119. package/templates/vitepress/zh/why/examples/3.npm-basic-package/README.md +1 -0
  120. package/templates/vitepress/zh/why/examples/3.npm-basic-package/package-lock.json +1496 -0
  121. package/templates/vitepress/zh/why/examples/3.npm-basic-package/package.json +31 -0
  122. package/templates/vitepress/zh/why/examples/3.npm-basic-package/src/index.ts +8 -0
  123. package/templates/vitepress/zh/why/examples/3.npm-basic-package/tsconfig.json +16 -0
  124. package/templates/vitepress/zh/why/examples/3.npm-basic-package/tsdown.config.ts +16 -0
  125. package/templates/vitepress/zh/why/examples/usage-cjs/cjs.cjs +4 -0
  126. package/templates/vitepress/zh/why/examples/usage-cjs/esm.mjs +4 -0
  127. package/templates/vitepress/zh/why/examples/usage-cjs/index.js +8 -0
  128. package/templates/vitepress/zh/why/examples/usage-cjs/package-lock.json +36 -0
  129. package/templates/vitepress/zh/why/examples/usage-cjs/package.json +20 -0
  130. package/templates/vitepress/zh/why/examples/usage-esm/cjs.cjs +4 -0
  131. package/templates/vitepress/zh/why/examples/usage-esm/createRequire.js +7 -0
  132. package/templates/vitepress/zh/why/examples/usage-esm/esm.mjs +4 -0
  133. package/templates/vitepress/zh/why/examples/usage-esm/index.js +8 -0
  134. package/templates/vitepress/zh/why/examples/usage-esm/package-lock.json +36 -0
  135. package/templates/vitepress/zh/why/examples/usage-esm/package.json +21 -0
  136. package/templates/vitepress/zh/why/how-to-reuse-js-code.md +250 -0
  137. package/templates/vitepress/zh/why/index.md +1 -0
  138. package/templates/vitepress/zh/why/js-cjs-mjs.md +99 -0
  139. package/templates/vitepress/zh/why/js-keywords.md +132 -0
  140. package/templates/vitepress/zh/why/modern/bundlers.md +52 -0
  141. package/templates/vitepress/zh/why/modern/dts.md +93 -0
  142. package/templates/vitepress/zh/why/modern/esm-vs-cjs.md +84 -0
  143. package/templates/vitepress/zh/why/modern/index.md +55 -0
  144. package/templates/vitepress/zh/why/modern/package-entry-points.md +128 -0
  145. package/templates/vitepress/zh/why/modern/typescript.md +155 -0
  146. package/templates/vitepress/zh/why/publish-basic-npm-package.md +146 -0
  147. package/templates/vitepress/zh/why/what-is-npm-package.md +162 -0
  148. package/templates/vue-lib/package.json +12 -5
  149. package/templates/vue-lib/vitest.config.ts +1 -1
  150. package/assets/.changeset/config.json +0 -21
  151. package/assets/.changeset/publish-versioned-packages.md +0 -5
  152. package/templates/vitepress/en/index.md +0 -63
  153. package/templates/vitepress/en/knowledge/monorepo.md +0 -37
  154. package/templates/vitepress/en/repoctl/adopt-existing.md +0 -133
  155. package/templates/vitepress/en/repoctl/commands.md +0 -120
  156. package/templates/vitepress/en/repoctl/config.md +0 -69
  157. package/templates/vitepress/en/repoctl/getting-started.md +0 -116
  158. package/templates/vitepress/en/repoctl/index.md +0 -74
  159. package/templates/vitepress/en/repoctl/templates.md +0 -128
  160. package/templates/vitepress/en/repoctl/troubleshooting.md +0 -96
  161. package/templates/vitepress/en/repoctl/workflows.md +0 -89
@@ -1,12 +1,12 @@
1
- # 快速开始
1
+ # Getting Started
2
2
 
3
- 这一页按“把 repoctl 接进一个仓库”的顺序写。你不需要先理解所有工具,先让仓库能被诊断、能创建包、能跑提交前校验。
3
+ This guide follows the order you would use when adding repoctl to a workspace.
4
4
 
5
- ## 准备环境
5
+ ## Prerequisites
6
6
 
7
- - Node.js 20 或更高版本。
8
- - pnpm。推荐通过 Corepack 启用:`corepack enable`。
9
- - Git。`repo doctor` 会读取仓库信息,用来补全 package metadata 和诊断提交链路。
7
+ - Node.js 20 or newer.
8
+ - pnpm. Corepack is recommended: `corepack enable`.
9
+ - Git. `repo doctor` reads repository metadata and checks the commit workflow.
10
10
 
11
11
  ```bash
12
12
  node -v
@@ -14,15 +14,15 @@ pnpm -v
14
14
  git --version
15
15
  ```
16
16
 
17
- ## 安装 repoctl
17
+ ## Install
18
18
 
19
19
  ```bash
20
20
  pnpm add -D repoctl
21
21
  ```
22
22
 
23
- 如果你使用的是这套模板生成的新仓库,依赖和根脚本通常已经准备好了,可以直接从 `pnpm install` 开始。
23
+ If the repository was generated from this template, the dependency and root scripts may already be present.
24
24
 
25
- ## 初始化仓库默认值
25
+ ## Initialize Defaults
26
26
 
27
27
  ```bash
28
28
  pnpm install
@@ -30,42 +30,40 @@ pnpm exec repo init
30
30
  pnpm exec repo doctor
31
31
  ```
32
32
 
33
- 这三步分别解决:
33
+ | Command | Purpose |
34
+ | -------------- | ----------------------------------------------------------------------------- |
35
+ | `pnpm install` | Install workspace dependencies and local links |
36
+ | `repo init` | Add recommended scripts, workspace patterns, and tooling entries |
37
+ | `repo doctor` | Check root files, Node version, CLI dependency, stale config files, and hooks |
34
38
 
35
- | 命令 | 作用 |
36
- | -------------- | --------------------------------------------------- |
37
- | `pnpm install` | 安装 workspace 依赖并创建本地链接 |
38
- | `repo init` | 补齐推荐根脚本、workspace patterns 和基础工具链入口 |
39
- | `repo doctor` | 检查根目录、Node 版本、CLI 依赖、遗留配置和提交链路 |
39
+ Fix blocking issues reported by `doctor`, then run it again.
40
40
 
41
- 如果 `doctor` 报错,先按输出里的 `fix:` 处理。处理完再跑一次 `pnpm exec repo doctor`。
41
+ ## Create A Package
42
42
 
43
- ## 创建第一个包
44
-
45
- 先看模板列表:
43
+ List templates first:
46
44
 
47
45
  ```bash
48
46
  pnpm exec repo templates
49
47
  ```
50
48
 
51
- 创建一个 TypeScript 库:
49
+ Create a TypeScript library:
52
50
 
53
51
  ```bash
54
52
  pnpm exec repo new sdk --template tsdown
55
53
  ```
56
54
 
57
- 创建前只想预览:
55
+ Preview before writing files:
58
56
 
59
57
  ```bash
60
58
  pnpm exec repo new sdk --template tsdown --dry-run
61
59
  pnpm exec repo new sdk --template tsdown --json --out plans/sdk.json
62
60
  ```
63
61
 
64
- `--json` 和 `--out` 会隐含 `--dry-run`,适合 CI、编辑器和脚本读取创建计划。
62
+ `--json` and `--out` imply `--dry-run`, which makes them suitable for CI, editor integrations, and scripts.
65
63
 
66
- ## 使用根脚本
64
+ ## Use Root Scripts
67
65
 
68
- 如果仓库已经通过 `repo init` 或模板生成补齐了根脚本,日常可以写得更短:
66
+ After `repo init`, daily commands can be shorter:
69
67
 
70
68
  ```bash
71
69
  pnpm run repo:init
@@ -74,16 +72,14 @@ pnpm run repo:new -- sdk --template tsdown
74
72
  pnpm run repo:check
75
73
  ```
76
74
 
77
- 对应关系:
78
-
79
- | 根脚本 | 等价命令 |
75
+ | Root script | Equivalent CLI |
80
76
  | ------------------------------ | ---------------------------- |
81
77
  | `pnpm run repo:init` | `pnpm exec repo init` |
82
78
  | `pnpm run repo:doctor -- args` | `pnpm exec repo doctor args` |
83
79
  | `pnpm run repo:new -- args` | `pnpm exec repo new args` |
84
80
  | `pnpm run repo:check` | `pnpm exec repo check` |
85
81
 
86
- ## 提交前检查
82
+ ## Verify Before Committing
87
83
 
88
84
  ```bash
89
85
  pnpm build
@@ -92,7 +88,7 @@ pnpm typecheck
92
88
  pnpm test
93
89
  ```
94
90
 
95
- 如果只想走 repoctl 推荐的本地检查入口:
91
+ Or use the repoctl verification entry:
96
92
 
97
93
  ```bash
98
94
  pnpm run repo:check
@@ -100,9 +96,7 @@ pnpm exec repo check --dry-run
100
96
  pnpm exec repo check --json --out reports/check-plan.json
101
97
  ```
102
98
 
103
- ## 同步模板标准资产
104
-
105
- 当模板升级后,用 `upgrade` 同步新的默认配置和脚本:
99
+ ## Sync Template Assets
106
100
 
107
101
  ```bash
108
102
  pnpm exec repo upgrade
@@ -110,13 +104,13 @@ pnpm exec repo upgrade --no-overwrite
110
104
  pnpm exec repo upgrade --yes
111
105
  ```
112
106
 
113
- - `--no-overwrite`:保留已有 drifted 文件。
114
- - `--yes` / `--overwrite`:适合明确要覆盖标准资产的自动化场景。
115
- - 非 TTY 环境不会弹出交互提示。
107
+ - `--no-overwrite` preserves changed managed files.
108
+ - `--yes` or `--overwrite` is for explicit automated overwrites.
109
+ - Non-TTY environments do not open interactive prompts.
116
110
 
117
- ## 常见下一步
111
+ ## Next Steps
118
112
 
119
- - 已有仓库渐进接入:阅读 [接入已有仓库](./adopt-existing.md)。
120
- - 想固定默认模板:阅读 [配置文件](./config.md)。
121
- - 想查看所有模板:阅读 [模板与创建](./templates.md)。
122
- - 想把诊断结果发给同事:阅读 [排障与报告](./troubleshooting.md)。
113
+ - Adopt an existing repository: [Adopt Existing Repositories](./adopt-existing.md).
114
+ - Set team defaults: [Configuration](./config.md).
115
+ - Inspect template keys: [Templates](./templates.md).
116
+ - Share diagnostic output: [Troubleshooting](./troubleshooting.md).
@@ -1,23 +1,23 @@
1
- # repoctl 概览
1
+ # repoctl Overview
2
2
 
3
- `repoctl` 是这套模板推荐给使用者的包名。默认命令是 `repo`,目标是把 pnpm workspace、Turborepo、模板创建、诊断报告和提交前校验收敛到一组稳定入口里。
3
+ `repoctl` is the user-facing package name for this monorepo toolkit. Its recommended command is `repo`.
4
4
 
5
- 它不替代 pnpm、Turbo 或 changesets,而是把这些工具在 monorepo 里的常见动作串起来。
5
+ The CLI does not replace pnpm, Turborepo, or pnpm versioning. It gives teams a stable layer for common monorepo actions: setup, diagnostics, scaffolding, local verification, and template asset upgrades.
6
6
 
7
- ## 什么时候使用 repoctl
7
+ ## When To Use It
8
8
 
9
- | 场景 | 推荐入口 |
10
- | ---------------------------------------- | ------------------------ |
11
- | 给已有 pnpm workspace 补齐标准脚本和配置 | `pnpm exec repo init` |
12
- | 判断当前仓库是不是能顺利开发 | `pnpm exec repo doctor` |
13
- | 创建新的包、应用、文档站或 CLI | `pnpm exec repo new` |
14
- | 提交前复现推荐校验链路 | `pnpm exec repo check` |
15
- | 同步模板最新标准资产 | `pnpm exec repo upgrade` |
16
- | 给 CI、编辑器或脚本读取结构化结果 | `--json --out <file>` |
9
+ | Goal | Command |
10
+ | ----------------------------------------------------- | ------------------------ |
11
+ | Add recommended scripts and workspace defaults | `pnpm exec repo init` |
12
+ | Check whether a repository is ready to develop | `pnpm exec repo doctor` |
13
+ | Create a package, app, docs site, service, or CLI | `pnpm exec repo new` |
14
+ | Reproduce the recommended pre-commit or pre-push flow | `pnpm exec repo check` |
15
+ | Sync newer standard assets from the template | `pnpm exec repo upgrade` |
16
+ | Persist output for CI, editors, or issue reports | `--json --out <file>` |
17
17
 
18
- ## 推荐命令层级
18
+ ## Recommended Command Layers
19
19
 
20
- ### 1. 生成仓库里的 repo:\* 根脚本
20
+ ### repo:\* Root Scripts
21
21
 
22
22
  ```bash
23
23
  pnpm run repo:init
@@ -26,9 +26,9 @@ pnpm run repo:new
26
26
  pnpm run repo:check
27
27
  ```
28
28
 
29
- 这是给日常开发和团队文档使用的入口。短、稳定、不需要先解释 CLI 包名,也不会和 pnpm 内置命令冲突。
29
+ These are the best commands for day-to-day team docs. They are short, explicit, and do not collide with pnpm built-in commands.
30
30
 
31
- ### 2. 明确调用 repo CLI
31
+ ### Explicit CLI Calls
32
32
 
33
33
  ```bash
34
34
  pnpm exec repo init
@@ -38,9 +38,9 @@ pnpm exec repo new sdk --template tsdown
38
38
  pnpm exec repo check --dry-run
39
39
  ```
40
40
 
41
- 这是文档、CI、脚本和排障里最清楚的写法。
41
+ Use this form in CI, scripts, troubleshooting docs, and reproducible examples.
42
42
 
43
- ### 3. 分组命令
43
+ ### Grouped Commands
44
44
 
45
45
  ```bash
46
46
  pnpm exec repo ws ls
@@ -49,54 +49,26 @@ pnpm exec repo env support --markdown --redact
49
49
  pnpm exec repo config inspect
50
50
  ```
51
51
 
52
- 这些入口适合已经熟悉 repoctl 的维护者,用来做更细的 workspace、tooling、环境和配置操作。
52
+ Grouped commands are for maintainers and automation that need finer control.
53
53
 
54
- ## repoctl 管什么
54
+ ## Command Entrypoints
55
55
 
56
- repoctl 把 monorepo 里最容易分散的动作收敛为五条主线:
57
-
58
- | 主线 | 代表命令 | 解决的问题 |
59
- | ------ | ----------------------------- | --------------------------------------------------------- |
60
- | 初始化 | `repo init` / `repo upgrade` | 生成或同步 workspace、根脚本、Husky、lint-staged 等资产 |
61
- | 诊断 | `repo doctor` | 判断仓库根目录、运行时、脚本、配置和提交链路是否就绪 |
62
- | 创建 | `repo templates` / `repo new` | 使用内置模板生成库、应用、服务、文档站和 CLI |
63
- | 校验 | `repo check` / `repo verify` | 统一 pre-commit、staged typecheck、pre-push 和 commit-msg |
64
- | 报告 | `repo env support` | 输出可保存、可脱敏、可给 CI 和协作者读取的上下文 |
65
-
66
- 这几条主线都支持非交互参数。需要自动化时,优先使用 `--json`、`--markdown`、`--out <file>`、`--redact` 和 `--dry-run` 组合。
67
-
68
- ## 新人和维护者的边界
69
-
70
- | 角色 | 推荐只记住 | 需要深入时再看 |
71
- | ---------- | ------------------------------------------------------------------ | ----------------------------------------------------------- |
72
- | 新成员 | `pnpm run repo:doctor`、`pnpm run repo:new`、`pnpm run repo:check` | [按场景选命令](./scenarios.md) |
73
- | 包维护者 | `repo templates`、`repo new --template`、`repo check --full` | [模板资产治理](./template-assets.md) |
74
- | CI 维护者 | `repo doctor --strict`、`repo check --full`、`repo env support` | [报告与自动化输出](./reports.md) |
75
- | 平台维护者 | `repo init`、`repo upgrade`、`repo config inspect` | [执行模型](./execution-model.md) 和 [配置文件](./config.md) |
76
-
77
- ## 命令入口
78
-
79
- `repoctl` 包提供多个 bin,例如:
56
+ The package exposes multiple bins:
80
57
 
81
58
  ```bash
82
59
  pnpm exec repoctl doctor
83
60
  pnpm exec repoctl new
84
61
  ```
85
62
 
86
- 文档统一推荐 `repo`,是为了减少新人需要记住的名字。底层实现来自同一套 CLI。
87
-
88
- ## 下一步
89
-
90
- - 第一次接入:[快速开始](./getting-started.md)
91
- - 不知道用哪个命令:[按场景选命令](./scenarios.md)
92
- - 理解 CLI 怎么执行:[执行模型](./execution-model.md)
93
- - 查命令参数:[命令速查](./commands.md)
94
- - 理解本地校验:[校验链路](./checks.md)
95
- - 看 doctor 具体检查项:[doctor 诊断](./doctor.md)
96
- - 固化团队默认值:[配置文件](./config.md)
97
- - 看可创建的模板:[模板与创建](./templates.md)
98
- - 治理模板资产:[模板资产治理](./template-assets.md)
99
- - 接入 CI 和本地流程:[工作流与 CI](./workflows.md)
100
- - 生成机器可读报告:[报告与自动化输出](./reports.md)
101
- - 排查常见问题:[排障与报告](./troubleshooting.md)
102
- - 熟悉短命令:[命令别名](./aliases.md)
63
+ The docs prefer `repo` so new users only need to remember one command name.
64
+
65
+ ## Keep Reading
66
+
67
+ - [Getting Started](./getting-started.md)
68
+ - [Choose By Scenario](./scenarios.md)
69
+ - [Command Reference](./commands.md)
70
+ - [Configuration](./config.md)
71
+ - [Templates](./templates.md)
72
+ - [Workflows and CI](./workflows.md)
73
+ - [Troubleshooting](./troubleshooting.md)
74
+ - [Command Aliases](./aliases.md)
@@ -1,94 +1,40 @@
1
1
  ---
2
- description: 说明 repoctl 的 JSON、Markdown、out、redact、env info、env snapshot 和 env support 报告能力。
2
+ outline: deep
3
3
  ---
4
4
 
5
- # 报告与自动化输出
5
+ # Reports and Automation Output
6
6
 
7
- repoctl 的报告能力用于把本地上下文变成可保存、可脱敏、可给脚本读取的文件。它适合 CI artifact、issue 模板、编辑器集成和跨机器排障。
7
+ repoctl commands expose human-readable text for terminals, Markdown for issues and pull requests, and stable JSON for automation.
8
8
 
9
- ## 1. 通用输出参数
9
+ ## Common Options
10
10
 
11
- | 参数 | 支持命令示例 | 作用 |
12
- | -------------- | --------------------------------------- | ------------------------------ |
13
- | `--json` | `doctor`、`check`、`templates`、`env` | 输出结构化数据 |
14
- | `--markdown` | `doctor`、`check`、`templates`、`env` | 输出便于阅读和粘贴的报告 |
15
- | `--out <file>` | 多数报告命令 | 把输出写入文件 |
16
- | `--redact` | `doctor`、`check`、`env` | 脱敏本机路径 |
17
- | `--strict` | `doctor`、`env snapshot`、`env support` | 有 fail 或 warn 时返回失败状态 |
11
+ - `--json`: emit structured data with stable field names.
12
+ - `--markdown`: emit a shareable report.
13
+ - `--out <file>`: write output to a file.
14
+ - `--redact`: replace local absolute paths.
15
+ - `--strict`: treat doctor warnings as failures where supported.
18
16
 
19
- ## 2. env 子命令
20
-
21
- | 命令 | 内容 | 适合用途 |
22
- | ------------------- | -------------------------------------------- | ---------------- |
23
- | `repo env info` | cwd、workspace、Node、pnpm、包数量等环境摘要 | 快速确认环境 |
24
- | `repo env paths` | 关键路径和建议报告路径 | 统一报告落盘位置 |
25
- | `repo env snapshot` | 环境、doctor 和 check plan | CI 快照 |
26
- | `repo env support` | 环境、路径、配置、doctor 和 check plan | 完整排障包 |
27
- | `repo env mirror` | VS Code binary mirror 设置 | 国内网络环境优化 |
28
-
29
- 常用组合:
30
-
31
- ```bash
32
- repo env info --json --out reports/env.json
33
- repo env snapshot --markdown --redact --out reports/snapshot.md
34
- repo env support --markdown --redact --out reports/support.md
35
- ```
36
-
37
- ## 3. CI artifact 示例
17
+ ## Environment Commands
38
18
 
39
19
  ```bash
40
- repo doctor --json --out reports/doctor.json
41
- repo check --full --json --out reports/check-plan.json
20
+ repo env info --json
21
+ repo env paths --markdown
22
+ repo env snapshot --json --out reports/snapshot.json
42
23
  repo env support --markdown --redact --out reports/support.md
43
24
  ```
44
25
 
45
- 建议把 `reports/` 上传为 artifact。这样 CI 失败时,不需要重新询问维护者使用了什么 Node、pnpm、workspace 根目录和校验计划。
46
-
47
- ## 4. issue 排障模板
26
+ The support bundle combines environment facts, resolved configuration, doctor results, the check plan, and report paths.
48
27
 
49
- 当你需要把问题交给同事或维护者时,可以先生成 Markdown:
50
-
51
- ```bash
52
- repo env support --markdown --redact --out reports/support.md
53
- ```
54
-
55
- 然后在 issue 里附上:
56
-
57
- | 内容 | 来源 |
58
- | ------------- | ----------------- |
59
- | 环境摘要 | `env info` |
60
- | 配置命中情况 | `config inspect` |
61
- | doctor 失败项 | `doctor` |
62
- | check 计划 | `check --dry-run` |
63
- | 推荐报告路径 | `env paths` |
64
-
65
- ## 5. 什么时候使用 JSON
66
-
67
- JSON 适合机器判断,不适合人工长时间阅读:
28
+ ## CI Example
68
29
 
69
30
  ```bash
70
31
  repo doctor --json --out reports/doctor.json
71
- repo templates --check --json --out reports/templates.json
72
- repo new docs --template vitepress --json --out plans/docs.json
32
+ repo check --full --dry-run --json --out reports/check-plan.json
33
+ repo env support --markdown --redact --out reports/support.md
73
34
  ```
74
35
 
75
- 常见消费方式:
36
+ Upload `reports/` as a CI artifact so failures can be inspected without exposing local paths.
76
37
 
77
- | 目标 | 使用方式 |
78
- | ------------------- | ------------------------------------ |
79
- | CI 判断是否有阻塞项 | 读取 `doctor.summary.fail` |
80
- | 编辑器展示模板列表 | 读取 `repo templates --json` |
81
- | 预览创建结果 | 读取 `repo new --json` |
82
- | 审计模板健康状态 | 读取 `repo templates --check --json` |
83
-
84
- ## 6. 什么时候使用 Markdown
85
-
86
- Markdown 适合给人看,尤其适合 PR、issue 和协作文档:
87
-
88
- ```bash
89
- repo doctor --markdown --redact --out reports/doctor.md
90
- repo check --markdown --redact --out reports/check-plan.md
91
- repo templates --markdown --out docs/templates.md
92
- ```
38
+ ## Choosing A Format
93
39
 
94
- 如果报告要离开本机,默认加 `--redact`。
40
+ Use JSON when another program consumes the result. Use Markdown when a person will read or paste the report. Locale only changes human-readable strings; JSON field names and status codes stay unchanged.
@@ -1,15 +1,15 @@
1
- # 按场景选命令
1
+ # Choose By Scenario
2
2
 
3
- 如果你不确定该用哪个 repoctl 命令,先从这一页开始。
3
+ Start here when you know what you want to do, but not which repoctl command to use.
4
4
 
5
- ## 我刚拿到一个仓库
5
+ ## I Just Opened A Repository
6
6
 
7
7
  ```bash
8
8
  pnpm install
9
9
  pnpm run repo:doctor
10
10
  ```
11
11
 
12
- 如果 `repo:*` 根脚本还不存在:
12
+ If the `repo:*` scripts do not exist yet:
13
13
 
14
14
  ```bash
15
15
  pnpm add -D repoctl
@@ -17,9 +17,9 @@ pnpm exec repo init --yes
17
17
  pnpm exec repo doctor
18
18
  ```
19
19
 
20
- 继续看:[快速开始](./getting-started.md)。
20
+ Keep reading: [Getting Started](./getting-started.md).
21
21
 
22
- ## 我要把 repoctl 接入旧仓库
22
+ ## I Want To Adopt repoctl In An Existing Repo
23
23
 
24
24
  ```bash
25
25
  pnpm add -D repoctl
@@ -29,9 +29,9 @@ pnpm exec repo upgrade --no-overwrite
29
29
  pnpm exec repo doctor --markdown --redact --out reports/doctor-after.md
30
30
  ```
31
31
 
32
- 继续看:[接入已有仓库](./adopt-existing.md)。
32
+ Keep reading: [Adopt Existing Repositories](./adopt-existing.md).
33
33
 
34
- ## 我要创建新包或应用
34
+ ## I Want To Create A Package Or App
35
35
 
36
36
  ```bash
37
37
  pnpm exec repo templates
@@ -39,15 +39,15 @@ pnpm exec repo new sdk --template tsdown
39
39
  pnpm exec repo new docs --template vitepress --dry-run
40
40
  ```
41
41
 
42
- 如果只是日常开发,根脚本也可以:
42
+ For daily development, root scripts also work:
43
43
 
44
44
  ```bash
45
45
  pnpm run repo:new -- sdk --template tsdown
46
46
  ```
47
47
 
48
- 继续看:[模板与创建](./templates.md)。
48
+ Keep reading: [Templates](./templates.md).
49
49
 
50
- ## 我要提交前自查
50
+ ## I Want To Check Before Committing
51
51
 
52
52
  ```bash
53
53
  pnpm run repo:check
@@ -55,16 +55,16 @@ pnpm exec repo check --dry-run
55
55
  pnpm exec repo check --full
56
56
  ```
57
57
 
58
- 如果你想保存计划:
58
+ Save the plan when automation needs it:
59
59
 
60
60
  ```bash
61
61
  pnpm exec repo check --json --out reports/check-plan.json
62
62
  pnpm exec repo check --markdown --redact --out reports/check-plan.md
63
63
  ```
64
64
 
65
- 继续看:[工作流与 CI](./workflows.md)。
65
+ Keep reading: [Workflows and CI](./workflows.md).
66
66
 
67
- ## 我要调试 CI 或同事机器问题
67
+ ## I Want To Debug CI Or Another Machine
68
68
 
69
69
  ```bash
70
70
  pnpm exec repo doctor --markdown --redact --out reports/doctor.md
@@ -72,9 +72,9 @@ pnpm exec repo env support --markdown --redact --out reports/support.md
72
72
  pnpm exec repo env snapshot --json --out reports/snapshot.json
73
73
  ```
74
74
 
75
- 继续看:[排障与报告](./troubleshooting.md)。
75
+ Keep reading: [Troubleshooting](./troubleshooting.md).
76
76
 
77
- ## 我要同步模板标准资产
77
+ ## I Want To Sync Standard Assets
78
78
 
79
79
  ```bash
80
80
  pnpm exec repo upgrade --no-overwrite
@@ -82,15 +82,13 @@ pnpm exec repo upgrade --yes
82
82
  pnpm exec repo upgrade --core
83
83
  ```
84
84
 
85
- 选择建议:
85
+ | Goal | Command |
86
+ | ------------------------------------------ | ----------------------------- |
87
+ | First adoption pass, preserve local config | `repo upgrade --no-overwrite` |
88
+ | Explicitly overwrite managed assets | `repo upgrade --yes` |
89
+ | Sync only core config | `repo upgrade --core` |
86
90
 
87
- | 目标 | 命令 |
88
- | ------------------------ | ----------------------------- |
89
- | 第一次接入,保留已有配置 | `repo upgrade --no-overwrite` |
90
- | 明确要覆盖标准资产 | `repo upgrade --yes` |
91
- | 只同步核心配置 | `repo upgrade --core` |
92
-
93
- ## 我要看 workspace 结构
91
+ ## I Want To Inspect Workspace Structure
94
92
 
95
93
  ```bash
96
94
  pnpm exec repo ws ls
@@ -98,16 +96,16 @@ pnpm exec repo ws ls --json --out reports/workspaces.json
98
96
  pnpm exec repo ws ls --markdown --redact --out reports/workspaces.md
99
97
  ```
100
98
 
101
- ## 我要看配置是否生效
99
+ ## I Want To Inspect Config
102
100
 
103
101
  ```bash
104
102
  pnpm exec repo config inspect
105
103
  pnpm exec repo cfg i --json --out reports/config.json
106
104
  ```
107
105
 
108
- 继续看:[配置文件](./config.md)。
106
+ Keep reading: [Configuration](./config.md).
109
107
 
110
- ## 我要写更短的命令
108
+ ## I Want Shorter Commands
111
109
 
112
110
  ```bash
113
111
  repo tpl
@@ -116,4 +114,4 @@ repo e support --markdown --redact
116
114
  repo cfg i
117
115
  ```
118
116
 
119
- 继续看:[命令别名](./aliases.md)。
117
+ Keep reading: [Command Aliases](./aliases.md).