@icebreakers/monorepo-templates 1.1.0 → 1.2.1

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 (159) hide show
  1. package/README.md +12 -8
  2. package/README.zh-CN.md +16 -0
  3. package/assets/.github/ISSUE_TEMPLATE/config.yml +1 -1
  4. package/assets/.github/workflows/release.yml +5 -3
  5. package/assets/AGENTS.md +4 -3
  6. package/assets/CONTRIBUTING.md +27 -2
  7. package/assets/SECURITY.md +12 -14
  8. package/assets/package.json +13 -4
  9. package/assets/pnpm-workspace.yaml +2 -9
  10. package/dist/cli.mjs +1 -1
  11. package/dist/index.mjs +1 -1
  12. package/dist/{prepare-CNCmvco-.mjs → prepare--cxFop8c.mjs} +20 -0
  13. package/package.json +9 -5
  14. package/templates/cli/package.json +11 -4
  15. package/templates/client/package.json +17 -1
  16. package/templates/server/package.json +11 -4
  17. package/templates/tsdown/package.json +11 -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 +15 -70
  28. package/templates/vitepress/monorepo/templates.md +10 -17
  29. package/templates/vitepress/monorepo/troubleshooting.md +13 -16
  30. package/templates/vitepress/package.json +10 -4
  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 +9 -59
  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/assets/.changeset/ledger.yaml +0 -26
  150. package/templates/vitepress/en/index.md +0 -63
  151. package/templates/vitepress/en/knowledge/monorepo.md +0 -37
  152. package/templates/vitepress/en/repoctl/adopt-existing.md +0 -133
  153. package/templates/vitepress/en/repoctl/commands.md +0 -120
  154. package/templates/vitepress/en/repoctl/config.md +0 -69
  155. package/templates/vitepress/en/repoctl/getting-started.md +0 -116
  156. package/templates/vitepress/en/repoctl/index.md +0 -74
  157. package/templates/vitepress/en/repoctl/templates.md +0 -128
  158. package/templates/vitepress/en/repoctl/troubleshooting.md +0 -96
  159. package/templates/vitepress/en/repoctl/workflows.md +0 -89
@@ -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).
@@ -1,116 +1,47 @@
1
1
  ---
2
- description: 说明 repoctl 内置模板、templateMap、模板健康检查、创建计划和模板资产维护方式。
2
+ outline: deep
3
3
  ---
4
4
 
5
- # repoctl 模板资产治理
5
+ # Template Asset Management
6
6
 
7
- repoctl 的模板能力不只是复制目录。它会把模板元数据、默认生成目录、创建计划、健康检查和配置覆盖串起来。
7
+ Templates are one repoctl capability. `@icebreakers/monorepo-templates` packages built-in project templates and managed repository assets; templates under `templates/*` are private source workspaces and are not published independently.
8
8
 
9
- ## 1. 内置模板映射
9
+ ## Built-In Mapping
10
10
 
11
- | key | source | 默认 target | 类型 |
12
- | ------------- | --------------------- | ------------------ | --------------------- |
13
- | `tsdown` | `templates/tsdown` | `packages/tsdown` | TypeScript library |
14
- | `vue-lib` | `templates/vue-lib` | `packages/vue-lib` | Vue component library |
15
- | `hono-server` | `templates/server` | `apps/server` | Hono service |
16
- | `vue-hono` | `templates/client` | `apps/client` | Vue + Hono app |
17
- | `vitepress` | `templates/vitepress` | `apps/website` | docs site |
18
- | `cli` | `templates/cli` | `apps/cli` | command line tool |
19
-
20
- 查看实际可用模板:
11
+ Template metadata defines a stable key, category, source directory, default target, and description. The CLI, create commands, and documentation consume the same registry.
21
12
 
22
13
  ```bash
23
14
  repo templates
24
- repo templates --json
25
- repo templates --markdown --out docs/templates.md
15
+ repo templates tsdown
16
+ repo templates --category library
26
17
  ```
27
18
 
28
- ## 2. 创建计划
29
-
30
- `repo new` 会先解析创建计划,再决定是否写入文件。计划包含:
31
-
32
- | 字段 | 含义 |
33
- | ------------------- | ------------------------------------------------ |
34
- | `requestedTemplate` | 用户请求的模板 key |
35
- | `template` | 实际使用的模板 key |
36
- | `sourceDir` | 模板源目录 |
37
- | `targetDir` | 输出目录 |
38
- | `targetExists` | 目标目录是否已存在 |
39
- | `packageName` | 写入 package.json 的包名 |
40
- | `renameJson` | 是否把 `package.json` 输出为 `package.mock.json` |
41
-
42
- 预览创建:
19
+ ## Creation Plans
43
20
 
44
21
  ```bash
45
- repo new docs --template vitepress --dry-run
22
+ repo new sdk --template tsdown --dry-run
46
23
  repo new docs --template vitepress --json --out plans/docs.json
47
24
  ```
48
25
 
49
- `--json` 和 `--out` 都隐含 `--dry-run`,不会写入文件。
26
+ A plan records the selected template, source, destination, package name, workspace pattern, and whether fallback behavior was used. Unknown explicit keys fail with a suggestion.
50
27
 
51
- ## 3. 模板选择和报错
52
-
53
- 显式传入 `--template` 时,repoctl 会先校验模板 key:
54
-
55
- ```bash
56
- repo new sdk --template tsdown
57
- ```
58
-
59
- 如果模板 key 拼错,命令会失败并提示相近 key。它不会静默回退到默认模板,这样 CI 和脚本不会生成错误类型的项目。
60
-
61
- ## 4. 健康检查
62
-
63
- 模板资产可以通过 `repo templates --check` 检查:
28
+ ## Health Checks
64
29
 
65
30
  ```bash
66
31
  repo templates --check
67
- repo templates --check --json --out reports/templates.json
32
+ repo templates --check --json
68
33
  ```
69
34
 
70
- 检查内容包括:
71
-
72
- | 检查 | 目的 |
73
- | -------------- | ------------------------------------ |
74
- | source 唯一性 | 避免多个模板 key 指向同一源目录 |
75
- | target 唯一性 | 避免多个模板默认写到同一目标目录 |
76
- | source 目录 | 确认模板目录存在 |
77
- | package.json | 确认模板根目录包含包元数据 |
78
- | metadata | 确认模板有 category 和 description |
79
- | filtered files | 避免把临时、缓存或生成文件放入模板源 |
80
-
81
- ## 5. 自定义模板
82
-
83
- 可以在 `repoctl.config.ts` 里扩展模板映射:
84
-
85
- ```ts
86
- import { defineMonorepoConfig } from 'repoctl'
87
-
88
- export default defineMonorepoConfig({
89
- commands: {
90
- create: {
91
- defaultTemplate: 'internal-service',
92
- templateMap: {
93
- 'internal-service': {
94
- source: 'templates/internal-service',
95
- target: 'apps/internal-service',
96
- },
97
- },
98
- },
99
- },
100
- })
101
- ```
35
+ Health checks validate unique sources and targets, source directories, package manifests, metadata, and filtered temporary files.
102
36
 
103
- 自定义模板建议遵守同样的治理规则:唯一 source、唯一 target、模板根目录包含 `package.json`,并避免提交构建输出和缓存文件。
37
+ ## Managed Assets
104
38
 
105
- ## 6. 维护流程
39
+ `repo init` and `repo upgrade` synchronize root scripts, configuration, hooks, and release assets. Existing custom files are preserved unless overwrite behavior is explicitly selected.
106
40
 
107
- 更新模板时建议按下面流程验证:
41
+ Repository maintainers refresh packaged copies with:
108
42
 
109
- ```txt
110
- 修改 templates/<name>
111
- -> repo templates --check
112
- -> repo new demo --template <name> --json --out plans/demo.json
113
- -> 构建或测试生成后的 workspace
43
+ ```bash
44
+ pnpm --filter @icebreakers/monorepo-templates sync:assets
114
45
  ```
115
46
 
116
- 如果模板文件数量发生变化,维护模板快照的测试也需要同步更新。
47
+ Generated copies should never be edited by hand.
@@ -1,21 +1,19 @@
1
- # 模板与创建
1
+ # Templates
2
2
 
3
- repoctl 的模板由 `@icebreakers/monorepo-templates` 维护。CLI、脚手架和文档都复用同一份模板元数据。
3
+ repoctl templates are maintained by `@icebreakers/monorepo-templates`. The CLI, scaffolder, and docs share the same template metadata.
4
4
 
5
- 更偏维护者视角的模板元数据、健康检查和自定义模板说明见:[模板资产治理](./template-assets.md)。
5
+ ## Built-In Templates
6
6
 
7
- ## 内置模板
7
+ | Key | Category | Default target | Use case |
8
+ | ------------- | -------- | ------------------ | ----------------------- |
9
+ | `tsdown` | library | `packages/tsdown` | TypeScript library |
10
+ | `vue-lib` | library | `packages/vue-lib` | Vue 3 component library |
11
+ | `vue-hono` | app | `apps/client` | Vue 3 + Hono app |
12
+ | `hono-server` | service | `apps/server` | Hono API service |
13
+ | `vitepress` | docs | `apps/website` | VitePress docs site |
14
+ | `cli` | tool | `apps/cli` | TypeScript CLI |
8
15
 
9
- | Key | Category | 默认目录 | 适合场景 |
10
- | ------------- | -------- | ------------------ | --------------------------- |
11
- | `tsdown` | library | `packages/tsdown` | TypeScript 库包 |
12
- | `vue-lib` | library | `packages/vue-lib` | Vue 3 组件库 |
13
- | `vue-hono` | app | `apps/client` | Vue 3 + Hono 前后端一体应用 |
14
- | `hono-server` | service | `apps/server` | Hono API 服务 |
15
- | `vitepress` | docs | `apps/website` | VitePress 文档站 |
16
- | `cli` | tool | `apps/cli` | TypeScript 命令行工具 |
17
-
18
- ## 查看模板
16
+ ## Discover Templates
19
17
 
20
18
  ```bash
21
19
  repo templates
@@ -25,7 +23,7 @@ repo templates --json
25
23
  repo templates --markdown --out docs/templates.md
26
24
  ```
27
25
 
28
- ## 创建模板
26
+ ## Create From A Template
29
27
 
30
28
  ```bash
31
29
  repo new sdk --template tsdown
@@ -35,72 +33,72 @@ repo new website --template vitepress
35
33
  repo new toolbox --template cli
36
34
  ```
37
35
 
38
- 普通名字会自动放到模板约定的目录里,例如库包进入 `packages/`,应用进入 `apps/`。如果你传入带 `/` 的路径,例如 `packages/shared-utils`,repoctl 会尊重这个路径。
36
+ Simple names are placed in the conventional target folder. Library templates go under `packages/`; app templates go under `apps/`. If you pass an explicit path such as `packages/shared-utils`, repoctl respects it.
39
37
 
40
- ## 按目标选择模板
38
+ ## Choose By Goal
41
39
 
42
- ### 要发布 npm 库
40
+ ### Publish an npm library
43
41
 
44
42
  ```bash
45
43
  repo new sdk --template tsdown
46
44
  ```
47
45
 
48
- 生成后先检查:
46
+ Check first:
49
47
 
50
- - `package.json` 的 `name`、`exports`、`types`。
51
- - `tsdown.config.ts` 是否符合产物格式。
52
- - 是否需要补 `tsd` 类型测试。
48
+ - `package.json` `name`, `exports`, and `types`.
49
+ - Whether `tsdown.config.ts` matches the desired output format.
50
+ - Whether public types need `tsd` tests.
53
51
 
54
- ### 要沉淀 Vue 组件
52
+ ### Build reusable Vue components
55
53
 
56
54
  ```bash
57
55
  repo new ui --template vue-lib
58
56
  ```
59
57
 
60
- 生成后先检查:
58
+ Check first:
61
59
 
62
- - 组件入口是否只导出稳定 API。
63
- - 样式是否能通过 Stylelint。
64
- - 文档站或示例应用是否需要同步创建。
60
+ - Component entry points only expose stable APIs.
61
+ - Styles pass Stylelint.
62
+ - A docs site or example app should be created alongside it if needed.
65
63
 
66
- ### 要创建应用或服务
64
+ ### Create an app or service
67
65
 
68
66
  ```bash
69
67
  repo new web --template vue-hono
70
68
  repo new api --template hono-server
71
69
  ```
72
70
 
73
- 生成后先检查:
71
+ Check first:
74
72
 
75
- - 运行时环境变量和部署平台约束。
76
- - `dev`、`build`、`typecheck` 脚本是否接入根任务。
77
- - 是否需要在 CI 里加入 E2E 或集成测试。
73
+ - Runtime environment variables and deployment constraints.
74
+ - `dev`, `build`, and `typecheck` scripts are part of root tasks.
75
+ - CI needs integration or E2E tests.
78
76
 
79
- ### 要创建文档站
77
+ ### Create a docs site
80
78
 
81
79
  ```bash
82
80
  repo new docs --template vitepress
83
81
  ```
84
82
 
85
- 生成后先检查:
83
+ Check first:
86
84
 
87
- - 导航和 sidebar 是否围绕产品或包名组织。
88
- - 是否需要中英文 locale。
89
- - 是否需要把 `repo templates --markdown` 输出写进文档。
85
+ - Nav and sidebar are organized around the product or package.
86
+ - A second locale is required.
87
+ - `repo templates --markdown` output should be written into docs.
90
88
 
91
- ### 要创建 CLI
89
+ ### Create a CLI
92
90
 
93
91
  ```bash
94
92
  repo new toolbox --template cli
95
93
  ```
96
94
 
97
- 生成后先检查:
95
+ Check first:
98
96
 
99
- - `bin` 字段是否符合最终命令名。
100
- - 参数解析、退出码和帮助信息是否可测试。
101
- - 是否需要把命令用法写入 README。
97
+ - The `bin` field matches the final command name.
98
+ - Argument parsing, exit codes, and help output are testable.
99
+ - README documents command usage.
102
100
 
103
- ## 创建前预览
101
+ ## Preview Creation
104
102
 
105
103
  ```bash
106
104
  repo new website --template vitepress --dry-run
@@ -108,52 +106,23 @@ repo new website --template vitepress --json
108
106
  repo new website --template vitepress --json --out plans/website.json
109
107
  ```
110
108
 
111
- `--dry-run` 不写入磁盘,只展示模板、源目录、目标目录、package name 和输出文件。
112
-
113
- `--json` 输出同一份创建计划的结构化数据,隐含 `--dry-run`。
114
-
115
- `--out <file>` 可以把文本或 JSON 预览写入文件,也隐含 `--dry-run`。
109
+ `--dry-run` does not write files. It shows the template, source directory, target directory, package name, and output files.
116
110
 
117
- ## 固化默认模板
111
+ `--json` emits the same plan as structured data and implies `--dry-run`.
118
112
 
119
- ```ts
120
- import { defineMonorepoConfig } from 'repoctl'
113
+ `--out <file>` persists the preview and also implies `--dry-run`.
121
114
 
122
- export default defineMonorepoConfig({
123
- commands: {
124
- create: {
125
- defaultTemplate: 'tsdown',
126
- },
127
- },
128
- })
129
- ```
130
-
131
- 之后:
132
-
133
- ```bash
134
- repo new utils
135
- ```
136
-
137
- 会直接创建 `tsdown` 库包。
138
-
139
- ## 检查模板健康状态
115
+ ## Check Template Health
140
116
 
141
117
  ```bash
142
118
  repo templates --check
143
119
  repo templates --check --json
144
120
  ```
145
121
 
146
- 模板检查会确认:
147
-
148
- - 模板 source 和 target 没有重复。
149
- - 每个模板 source 目录都存在。
150
- - 每个模板根目录都有 `package.json`。
151
- - 每个模板都有 category 和 description。
152
- - 模板源目录里没有会被脚手架过滤掉的临时或生成文件。
122
+ The check validates duplicate sources and targets, existing source directories, package metadata, categories, descriptions, and temporary files that would be filtered by the scaffolder.
153
123
 
154
- ## 继续阅读
124
+ ## Keep Reading
155
125
 
156
- - [接入已有仓库](./adopt-existing.md)
157
- - [工作流与 CI](./workflows.md)
158
- - [配置文件](./config.md)
159
- - [模板资产治理](./template-assets.md)
126
+ - [Adopt Existing Repositories](./adopt-existing.md)
127
+ - [Workflows and CI](./workflows.md)
128
+ - [Configuration](./config.md)
@@ -1,34 +1,34 @@
1
- # 排障与报告
1
+ # Troubleshooting
2
2
 
3
- repoctl 的排障重点不是让你猜错在哪里,而是尽量输出可以复现、可以保存、可以发给同事的报告。
3
+ repoctl focuses on reports that can be reproduced, saved, and shared.
4
4
 
5
- ## 先跑 doctor
5
+ ## Start With Doctor
6
6
 
7
7
  ```bash
8
8
  repo doctor
9
9
  repo doctor --strict
10
10
  ```
11
11
 
12
- `doctor` 主要检查:
12
+ `doctor` checks:
13
13
 
14
- - 当前目录是不是仓库根目录。
15
- - Node 版本是否满足要求。
16
- - `pnpm-workspace.yaml` 是否存在。
17
- - `repoctl` 是否作为 CLI 依赖安装。
18
- - 根脚本是否齐全。
19
- - 是否仍残留已废弃的 `monorepo.config.ts`。
20
- - Husky 与 lint-staged 是否都接上。
14
+ - Current directory and repository root.
15
+ - Node.js version.
16
+ - `pnpm-workspace.yaml`.
17
+ - The `repoctl` CLI dependency.
18
+ - Recommended root scripts.
19
+ - Conflicting config files.
20
+ - Husky and lint-staged wiring.
21
21
 
22
- ## 保存诊断报告
22
+ ## Save A Diagnostic Report
23
23
 
24
24
  ```bash
25
25
  repo doctor --json --out reports/doctor.json
26
26
  repo doctor --markdown --redact --out reports/doctor.md
27
27
  ```
28
28
 
29
- 推荐把 Markdown 报告贴到 issue 或 PR。`--redact` 会脱敏本机路径。
29
+ Markdown reports are useful in issues and PRs. `--redact` removes local absolute paths.
30
30
 
31
- ## 查看校验计划
31
+ ## Inspect The Verification Plan
32
32
 
33
33
  ```bash
34
34
  repo check --dry-run
@@ -36,9 +36,9 @@ repo check --json --out reports/check-plan.json
36
36
  repo check --markdown --redact --out reports/check-plan.md
37
37
  ```
38
38
 
39
- 当你不确定为什么某个文件触发了 workspace typecheck、pre-push 要跑哪些任务时,先看 check plan。
39
+ Use this when you need to understand why a file triggers a workspace typecheck or which tasks pre-push would run.
40
40
 
41
- ## 收集环境信息
41
+ ## Collect Environment Information
42
42
 
43
43
  ```bash
44
44
  repo env info
@@ -47,51 +47,41 @@ repo env snapshot --json --out reports/snapshot.json
47
47
  repo env paths --markdown --redact --out reports/paths.md
48
48
  ```
49
49
 
50
- 这些命令适合排查 Node、pnpm、workspace、Git、路径和 CI 环境差异。
50
+ These commands help compare local, CI, Git, Node, pnpm, and workspace differences.
51
51
 
52
- ## 先判断问题类型
52
+ ## Common Fixes
53
53
 
54
- | 现象 | 优先命令 | 继续阅读 |
55
- | ------------------------------ | ----------------------------------------- | ------------------------------------ |
56
- | 不确定当前目录是不是仓库根目录 | `repo doctor` | [doctor 诊断](./doctor.md) |
57
- | 不知道 `repo check` 会跑什么 | `repo check --dry-run` | [校验链路](./checks.md) |
58
- | CI 失败但日志不完整 | `repo env support --markdown --redact` | [报告与自动化输出](./reports.md) |
59
- | 模板创建结果不符合预期 | `repo new <name> --template <key> --json` | [模板资产治理](./template-assets.md) |
60
- | 模板列表或元数据异常 | `repo templates --check` | [模板资产治理](./template-assets.md) |
54
+ ### Not At Repository Root
61
55
 
62
- ## 常见问题
63
-
64
- ### 当前目录不是仓库根目录
65
-
66
- 切回包含 `pnpm-workspace.yaml` 和根 `package.json` 的目录,再运行:
56
+ Change into the directory that contains `pnpm-workspace.yaml` and the root `package.json`, then run:
67
57
 
68
58
  ```bash
69
59
  repo doctor
70
60
  ```
71
61
 
72
- ### 同时存在两个配置文件
62
+ ### Conflicting Config Files
73
63
 
74
- 只保留一个:
64
+ Keep only:
75
65
 
76
66
  ```txt
77
67
  repoctl.config.ts
78
68
  ```
79
69
 
80
- `monorepo.config.ts` 已不再加载。旧项目需要改名为 `repoctl.config.ts`。
70
+ `monorepo.config.ts` is no longer loaded at runtime; rename it to `repoctl.config.ts`.
81
71
 
82
- ### `repo new` 提示模板不存在
72
+ ### Unknown Template Key
83
73
 
84
- 先查看可用模板:
74
+ List available templates:
85
75
 
86
76
  ```bash
87
77
  repo templates
88
78
  ```
89
79
 
90
- 显式传入的 `--template` 会先校验。拼错时命令会失败并提示相近 key,不会静默回退。
80
+ Explicit `--template` values are validated first. Invalid keys fail with suggestions.
91
81
 
92
- ### 自动化里不希望出现交互
82
+ ### Automation Should Not Prompt
93
83
 
94
- 使用非交互参数:
84
+ Use non-interactive options:
95
85
 
96
86
  ```bash
97
87
  repo init --yes
@@ -99,12 +89,8 @@ repo upgrade --no-overwrite
99
89
  repo check --json --out reports/check-plan.json
100
90
  ```
101
91
 
102
- 非 TTY 环境下,repoctl 不会弹出交互选择框。
103
-
104
- ## 继续阅读
92
+ ## Keep Reading
105
93
 
106
- - [工作流与 CI](./workflows.md)
107
- - [命令速查](./commands.md)
108
- - [doctor 诊断](./doctor.md)
109
- - [报告与自动化输出](./reports.md)
110
- - [命令别名](./aliases.md)
94
+ - [Workflows and CI](./workflows.md)
95
+ - [Command Reference](./commands.md)
96
+ - [Command Aliases](./aliases.md)