@icebreakers/monorepo-templates 1.1.0 → 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 (154) hide show
  1. package/README.md +12 -8
  2. package/README.zh-CN.md +16 -0
  3. package/assets/.changeset/ledger.yaml +25 -0
  4. package/assets/.github/ISSUE_TEMPLATE/config.yml +1 -1
  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/package.json +6 -4
  10. package/templates/cli/package.json +11 -4
  11. package/templates/client/package.json +17 -1
  12. package/templates/server/package.json +11 -4
  13. package/templates/tsdown/package.json +11 -4
  14. package/templates/vitepress/.vitepress/config.ts +146 -165
  15. package/templates/vitepress/ai/index.md +12 -23
  16. package/templates/vitepress/ai/llms-txt.md +13 -31
  17. package/templates/vitepress/getting-started.md +3 -32
  18. package/templates/vitepress/index.md +27 -30
  19. package/templates/vitepress/knowledge/index.md +17 -41
  20. package/templates/vitepress/monorepo/commands.md +13 -18
  21. package/templates/vitepress/monorepo/index.md +22 -100
  22. package/templates/vitepress/monorepo/manage.md +15 -227
  23. package/templates/vitepress/monorepo/publish.md +15 -70
  24. package/templates/vitepress/monorepo/templates.md +10 -17
  25. package/templates/vitepress/monorepo/troubleshooting.md +13 -16
  26. package/templates/vitepress/package.json +10 -4
  27. package/templates/vitepress/public/_redirects +3 -0
  28. package/templates/vitepress/repoctl/adopt-existing.md +51 -53
  29. package/templates/vitepress/repoctl/aliases.md +18 -18
  30. package/templates/vitepress/repoctl/checks.md +21 -68
  31. package/templates/vitepress/repoctl/commands.md +16 -64
  32. package/templates/vitepress/repoctl/config.md +14 -35
  33. package/templates/vitepress/repoctl/doctor.md +20 -60
  34. package/templates/vitepress/repoctl/execution-model.md +16 -69
  35. package/templates/vitepress/repoctl/getting-started.md +34 -40
  36. package/templates/vitepress/repoctl/index.md +33 -61
  37. package/templates/vitepress/repoctl/reports.md +20 -74
  38. package/templates/vitepress/repoctl/scenarios.md +26 -28
  39. package/templates/vitepress/repoctl/template-assets.md +19 -88
  40. package/templates/vitepress/repoctl/templates.md +50 -81
  41. package/templates/vitepress/repoctl/troubleshooting.md +32 -46
  42. package/templates/vitepress/repoctl/workflows.md +38 -67
  43. package/templates/vitepress/thinking.md +4 -85
  44. package/templates/vitepress/tools/changeset.md +9 -59
  45. package/templates/vitepress/tools/husky.md +6 -124
  46. package/templates/vitepress/tools/index.md +13 -32
  47. package/templates/vitepress/tools/lint-staged.md +5 -96
  48. package/templates/vitepress/tools/llms-txt.md +4 -6
  49. package/templates/vitepress/tools/pnpm.md +7 -119
  50. package/templates/vitepress/tools/renovate.md +3 -87
  51. package/templates/vitepress/tools/turborepo.md +5 -157
  52. package/templates/vitepress/why/how-to-reuse-js-code.md +6 -247
  53. package/templates/vitepress/why/index.md +14 -1
  54. package/templates/vitepress/why/js-cjs-mjs.md +9 -96
  55. package/templates/vitepress/why/js-keywords.md +4 -129
  56. package/templates/vitepress/why/modern/bundlers.md +3 -50
  57. package/templates/vitepress/why/modern/dts.md +4 -90
  58. package/templates/vitepress/why/modern/esm-vs-cjs.md +4 -81
  59. package/templates/vitepress/why/modern/index.md +10 -51
  60. package/templates/vitepress/why/modern/package-entry-points.md +6 -117
  61. package/templates/vitepress/why/modern/typescript.md +4 -152
  62. package/templates/vitepress/why/publish-basic-npm-package.md +17 -144
  63. package/templates/vitepress/why/what-is-npm-package.md +4 -159
  64. package/templates/vitepress/zh/ai/index.md +33 -0
  65. package/templates/vitepress/zh/ai/llms-txt.md +42 -0
  66. package/templates/vitepress/zh/getting-started.md +40 -0
  67. package/templates/vitepress/zh/index.md +66 -0
  68. package/templates/vitepress/zh/knowledge/index.md +50 -0
  69. package/templates/vitepress/zh/monorepo/commands.md +21 -0
  70. package/templates/vitepress/zh/monorepo/index.md +115 -0
  71. package/templates/vitepress/zh/monorepo/manage.md +243 -0
  72. package/templates/vitepress/zh/monorepo/publish.md +87 -0
  73. package/templates/vitepress/zh/monorepo/templates.md +21 -0
  74. package/templates/vitepress/zh/monorepo/troubleshooting.md +20 -0
  75. package/templates/vitepress/zh/repoctl/adopt-existing.md +135 -0
  76. package/templates/vitepress/{en → zh}/repoctl/aliases.md +18 -18
  77. package/templates/vitepress/zh/repoctl/checks.md +86 -0
  78. package/templates/vitepress/zh/repoctl/commands.md +168 -0
  79. package/templates/vitepress/zh/repoctl/config.md +90 -0
  80. package/templates/vitepress/zh/repoctl/doctor.md +86 -0
  81. package/templates/vitepress/zh/repoctl/execution-model.md +81 -0
  82. package/templates/vitepress/zh/repoctl/getting-started.md +122 -0
  83. package/templates/vitepress/zh/repoctl/index.md +102 -0
  84. package/templates/vitepress/zh/repoctl/reports.md +94 -0
  85. package/templates/vitepress/{en → zh}/repoctl/scenarios.md +28 -26
  86. package/templates/vitepress/zh/repoctl/template-assets.md +116 -0
  87. package/templates/vitepress/zh/repoctl/templates.md +159 -0
  88. package/templates/vitepress/zh/repoctl/troubleshooting.md +110 -0
  89. package/templates/vitepress/zh/repoctl/workflows.md +118 -0
  90. package/templates/vitepress/zh/thinking.md +88 -0
  91. package/templates/vitepress/zh/tools/changeset.md +75 -0
  92. package/templates/vitepress/zh/tools/husky.md +130 -0
  93. package/templates/vitepress/zh/tools/index.md +38 -0
  94. package/templates/vitepress/zh/tools/lint-staged.md +103 -0
  95. package/templates/vitepress/zh/tools/llms-txt.md +9 -0
  96. package/templates/vitepress/zh/tools/pnpm.md +127 -0
  97. package/templates/vitepress/zh/tools/renovate.md +91 -0
  98. package/templates/vitepress/zh/tools/turborepo.md +166 -0
  99. package/templates/vitepress/zh/why/assets/npm-dt.svg +15 -0
  100. package/templates/vitepress/zh/why/assets/npm-ts.svg +19 -0
  101. package/templates/vitepress/zh/why/examples/0.npm-basic-package/index.js +10 -0
  102. package/templates/vitepress/zh/why/examples/0.npm-basic-package/package.json +11 -0
  103. package/templates/vitepress/zh/why/examples/1.npm-basic-package/index.cjs +12 -0
  104. package/templates/vitepress/zh/why/examples/1.npm-basic-package/index.d.ts +1 -0
  105. package/templates/vitepress/zh/why/examples/1.npm-basic-package/index.js +8 -0
  106. package/templates/vitepress/zh/why/examples/1.npm-basic-package/package.json +19 -0
  107. package/templates/vitepress/zh/why/examples/2.npm-basic-package/README.md +1 -0
  108. package/templates/vitepress/zh/why/examples/2.npm-basic-package/package-lock.json +30 -0
  109. package/templates/vitepress/zh/why/examples/2.npm-basic-package/package.json +35 -0
  110. package/templates/vitepress/zh/why/examples/2.npm-basic-package/rename-ext.js +24 -0
  111. package/templates/vitepress/zh/why/examples/2.npm-basic-package/src/index.ts +8 -0
  112. package/templates/vitepress/zh/why/examples/2.npm-basic-package/tsconfig.cjs.json +8 -0
  113. package/templates/vitepress/zh/why/examples/2.npm-basic-package/tsconfig.esm.json +7 -0
  114. package/templates/vitepress/zh/why/examples/2.npm-basic-package/tsconfig.json +18 -0
  115. package/templates/vitepress/zh/why/examples/3.npm-basic-package/README.md +1 -0
  116. package/templates/vitepress/zh/why/examples/3.npm-basic-package/package-lock.json +1496 -0
  117. package/templates/vitepress/zh/why/examples/3.npm-basic-package/package.json +31 -0
  118. package/templates/vitepress/zh/why/examples/3.npm-basic-package/src/index.ts +8 -0
  119. package/templates/vitepress/zh/why/examples/3.npm-basic-package/tsconfig.json +16 -0
  120. package/templates/vitepress/zh/why/examples/3.npm-basic-package/tsdown.config.ts +16 -0
  121. package/templates/vitepress/zh/why/examples/usage-cjs/cjs.cjs +4 -0
  122. package/templates/vitepress/zh/why/examples/usage-cjs/esm.mjs +4 -0
  123. package/templates/vitepress/zh/why/examples/usage-cjs/index.js +8 -0
  124. package/templates/vitepress/zh/why/examples/usage-cjs/package-lock.json +36 -0
  125. package/templates/vitepress/zh/why/examples/usage-cjs/package.json +20 -0
  126. package/templates/vitepress/zh/why/examples/usage-esm/cjs.cjs +4 -0
  127. package/templates/vitepress/zh/why/examples/usage-esm/createRequire.js +7 -0
  128. package/templates/vitepress/zh/why/examples/usage-esm/esm.mjs +4 -0
  129. package/templates/vitepress/zh/why/examples/usage-esm/index.js +8 -0
  130. package/templates/vitepress/zh/why/examples/usage-esm/package-lock.json +36 -0
  131. package/templates/vitepress/zh/why/examples/usage-esm/package.json +21 -0
  132. package/templates/vitepress/zh/why/how-to-reuse-js-code.md +250 -0
  133. package/templates/vitepress/zh/why/index.md +1 -0
  134. package/templates/vitepress/zh/why/js-cjs-mjs.md +99 -0
  135. package/templates/vitepress/zh/why/js-keywords.md +132 -0
  136. package/templates/vitepress/zh/why/modern/bundlers.md +52 -0
  137. package/templates/vitepress/zh/why/modern/dts.md +93 -0
  138. package/templates/vitepress/zh/why/modern/esm-vs-cjs.md +84 -0
  139. package/templates/vitepress/zh/why/modern/index.md +55 -0
  140. package/templates/vitepress/zh/why/modern/package-entry-points.md +128 -0
  141. package/templates/vitepress/zh/why/modern/typescript.md +155 -0
  142. package/templates/vitepress/zh/why/publish-basic-npm-package.md +146 -0
  143. package/templates/vitepress/zh/why/what-is-npm-package.md +162 -0
  144. package/templates/vue-lib/package.json +12 -5
  145. package/templates/vitepress/en/index.md +0 -63
  146. package/templates/vitepress/en/knowledge/monorepo.md +0 -37
  147. package/templates/vitepress/en/repoctl/adopt-existing.md +0 -133
  148. package/templates/vitepress/en/repoctl/commands.md +0 -120
  149. package/templates/vitepress/en/repoctl/config.md +0 -69
  150. package/templates/vitepress/en/repoctl/getting-started.md +0 -116
  151. package/templates/vitepress/en/repoctl/index.md +0 -74
  152. package/templates/vitepress/en/repoctl/templates.md +0 -128
  153. package/templates/vitepress/en/repoctl/troubleshooting.md +0 -96
  154. package/templates/vitepress/en/repoctl/workflows.md +0 -89
@@ -2,18 +2,24 @@
2
2
  "name": "@icebreakers/website",
3
3
  "type": "module",
4
4
  "version": "0.0.1",
5
- "description": "https://repo.icebreaker.top source code",
5
+ "private": true,
6
+ "description": "Documentation website for repoctl",
6
7
  "author": "ice breaker <hi@sonofmagic.top>",
7
8
  "homepage": "https://repo.icebreaker.top",
8
9
  "repository": {
9
10
  "type": "git",
10
- "url": "git+https://github.com/sonofmagic/monorepo-template.git",
11
+ "url": "git+https://github.com/sonofmagic/repoctl.git",
11
12
  "directory": "templates/vitepress"
12
13
  },
13
14
  "bugs": {
14
- "url": "https://github.com/sonofmagic/monorepo-template/issues"
15
+ "url": "https://github.com/sonofmagic/repoctl/issues"
15
16
  },
16
- "keywords": [],
17
+ "keywords": [
18
+ "repoctl",
19
+ "documentation",
20
+ "vitepress",
21
+ "monorepo"
22
+ ],
17
23
  "scripts": {
18
24
  "dev": "vitepress dev",
19
25
  "build": "vitepress build",
@@ -0,0 +1,3 @@
1
+ /en / 301
2
+ /en/ / 301
3
+ /en/* /:splat 301
@@ -1,17 +1,17 @@
1
- # 接入已有仓库
1
+ # Adopt Existing Repositories
2
2
 
3
- repoctl 不只适合新模板仓库。它也可以渐进接入已有 pnpm workspace,用诊断报告和非覆盖同步把风险降下来。
3
+ repoctl is not only for newly generated repositories. It can be adopted gradually in existing pnpm workspaces by using diagnostics and conservative asset syncs.
4
4
 
5
- ## 适合接入的仓库
5
+ ## Good Candidates
6
6
 
7
- 优先满足这些条件:
7
+ A repository is a good fit when:
8
8
 
9
- - 已经使用 pnpm 或准备迁移到 pnpm。
10
- - 有根 `package.json`。
11
- - 能接受 `apps/*`、`packages/*`、`examples/*` 这类 workspace 目录约定。
12
- - 希望统一 `repo:init`、`repo:doctor`、`repo:new`、`repo:check` 这类日常入口。
9
+ - It already uses pnpm, or is ready to move to pnpm.
10
+ - It has a root `package.json`.
11
+ - It can use workspace folders such as `apps/*`, `packages/*`, or `examples/*`.
12
+ - The team wants stable daily entries such as `repo:init`, `repo:doctor`, `repo:new`, and `repo:check`.
13
13
 
14
- 如果仓库还不是 pnpm workspace,先补最小 `pnpm-workspace.yaml`:
14
+ If the repository is not yet a pnpm workspace, start with a minimal `pnpm-workspace.yaml`:
15
15
 
16
16
  ```yaml
17
17
  packages:
@@ -19,47 +19,47 @@ packages:
19
19
  - packages/*
20
20
  ```
21
21
 
22
- ## 第一步:安装并初始化
22
+ ## Step 1: Install And Setup
23
23
 
24
24
  ```bash
25
25
  pnpm add -D repoctl
26
26
  pnpm exec repo init --yes
27
27
  ```
28
28
 
29
- `repo init --yes` 会使用安全默认值。它会补齐推荐脚本和 workspace patterns,但不会无条件覆盖已有 README、package.json、pnpm-workspace.yaml 或 tooling 配置。
29
+ `repo init --yes` uses safe defaults. It adds recommended scripts and workspace patterns, but it does not blindly overwrite existing README, package.json, pnpm-workspace.yaml, or tooling files.
30
30
 
31
- ## 第二步:保存第一次诊断
31
+ ## Step 2: Save The First Diagnostic Report
32
32
 
33
33
  ```bash
34
34
  pnpm exec repo doctor --markdown --redact --out reports/doctor-before.md
35
35
  pnpm exec repo doctor --json --out reports/doctor-before.json
36
36
  ```
37
37
 
38
- 建议把第一次报告提交到 PR 评论或 artifact,而不是只看终端输出。
38
+ Prefer saving the first report as a PR comment or CI artifact instead of relying only on terminal output.
39
39
 
40
- 重点看这些项:
40
+ Watch these checks:
41
41
 
42
- | 检查项 | 常见问题 |
43
- | ---------------------------- | ------------------------------------------------ |
44
- | `package-json` | 当前目录不是仓库根目录 |
45
- | `workspace-manifest` | 缺少 `pnpm-workspace.yaml` |
46
- | `node-version` | 根 package 没声明 `engines.node` 或版本不匹配 |
47
- | `tool-package` | 没安装 `repoctl` |
48
- | `root-scripts` | 缺少 `repo:init/repo:new/repo:check/repo:doctor` |
49
- | `config-file` | 残留已废弃的 `monorepo.config.ts` |
50
- | `commit-hooks` | Husky 和 lint-staged 只接了一半 |
51
- | `workspace-package-coverage` | package.json 没被 workspace patterns 覆盖 |
42
+ | Check | Common Issue |
43
+ | ---------------------------- | ----------------------------------------------------------------- |
44
+ | `package-json` | Current directory is not the repository root |
45
+ | `workspace-manifest` | `pnpm-workspace.yaml` is missing |
46
+ | `node-version` | Root package has no `engines.node`, or the version does not match |
47
+ | `tool-package` | `repoctl` is not installed |
48
+ | `root-scripts` | `repo:init/repo:new/repo:check/repo:doctor` scripts are missing |
49
+ | `config-file` | A stale `monorepo.config.ts` file is still present |
50
+ | `commit-hooks` | Husky and lint-staged are only partially configured |
51
+ | `workspace-package-coverage` | Some package.json files are not covered by workspace patterns |
52
52
 
53
- ## 第三步:保守同步标准资产
53
+ ## Step 3: Sync Conservatively
54
54
 
55
55
  ```bash
56
56
  pnpm exec repo upgrade --no-overwrite
57
57
  pnpm exec repo doctor --markdown --redact --out reports/doctor-after.md
58
58
  ```
59
59
 
60
- `--no-overwrite` 适合第一次接入:它同步缺失资产,但保留已有 drifted 文件。你可以在 PR diff 里逐项看哪些配置要进一步迁移。
60
+ Use `--no-overwrite` for the first adoption pass. It syncs missing assets while preserving changed managed files.
61
61
 
62
- ## 第四步:预览校验计划
62
+ ## Step 4: Preview Verification
63
63
 
64
64
  ```bash
65
65
  pnpm exec repo check --dry-run
@@ -67,11 +67,11 @@ pnpm exec repo check --json --out reports/check-plan.json
67
67
  pnpm exec repo check --markdown --redact --out reports/check-plan.md
68
68
  ```
69
69
 
70
- 先看 plan,再决定要不要接入 hook 或 CI。
70
+ Review the plan before wiring hooks or CI.
71
71
 
72
- ## 第五步:接入根脚本
72
+ ## Step 5: Use Root Scripts
73
73
 
74
- 如果 `repo init` 已补齐根脚本,团队日常文档优先改成:
74
+ After `repo init`, team docs can use:
75
75
 
76
76
  ```bash
77
77
  pnpm run repo:doctor
@@ -79,57 +79,55 @@ pnpm run repo:new -- sdk
79
79
  pnpm run repo:check
80
80
  ```
81
81
 
82
- CI 和自动化脚本仍建议写完整 CLI:
82
+ CI and automation should still prefer explicit commands:
83
83
 
84
84
  ```bash
85
85
  pnpm exec repo doctor --strict
86
86
  pnpm exec repo check --full
87
87
  ```
88
88
 
89
- ## 第六步:处理遗留配置
89
+ ## Step 6: Resolve Legacy Config
90
90
 
91
- ### 遗留配置文件
91
+ ### Config Conflicts
92
92
 
93
- 只保留:
93
+ Keep only:
94
94
 
95
95
  ```txt
96
96
  repoctl.config.ts
97
97
  ```
98
98
 
99
- `monorepo.config.ts` 已不再加载;请改名为 `repoctl.config.ts`。
99
+ `monorepo.config.ts` is no longer loaded at runtime; rename it to `repoctl.config.ts`.
100
100
 
101
- ### 本地 tooling loader
101
+ ### Local Tooling Loader
102
102
 
103
- 如果 `doctor` 提示 tooling 配置引用了本地源码 loader,使用:
103
+ If `doctor` reports local source tooling loaders, migrate with:
104
104
 
105
105
  ```bash
106
106
  pnpm exec repo upgrade --yes
107
107
  ```
108
108
 
109
- 这个命令会迁移到 `repoctl/tooling` 入口。简单的 `@icebreakers/commitlint-config`、`@icebreakers/eslint-config`、`@icebreakers/stylelint-config` wrapper 也会被保守转换为 `repoctl/tooling`,复杂 ESLint 配置会保留原有 rules、ignores、overrides 和额外 flat config 语义。
109
+ The same migration also converts simple wrappers from `@icebreakers/commitlint-config`, `@icebreakers/eslint-config`, and `@icebreakers/stylelint-config` to `repoctl/tooling`. Complex ESLint configs keep their rules, ignores, overrides, and extra flat config semantics.
110
110
 
111
- ### workspace patterns 不覆盖包
111
+ ### Workspace Pattern Gaps
112
112
 
113
- 运行:
113
+ Run:
114
114
 
115
115
  ```bash
116
116
  pnpm exec repo init --yes
117
117
  ```
118
118
 
119
- 或手动扩展 `pnpm-workspace.yaml`。
119
+ or manually extend `pnpm-workspace.yaml`.
120
120
 
121
- ## 推荐 PR 结构
121
+ ## Recommended PR Shape
122
122
 
123
- 存量仓库接入建议拆成小 PR:
123
+ 1. Install `repoctl` and add root scripts.
124
+ 2. Attach `doctor-before` and `doctor-after` reports.
125
+ 3. Sync or migrate tooling config.
126
+ 4. Wire hooks and CI.
127
+ 5. Verify scaffolding paths with `repo new --dry-run`.
124
128
 
125
- 1. 安装 `repoctl`,补 `init/doctor/new/check` 根脚本。
126
- 2. 提交 `doctor-before` 和 `doctor-after` 报告。
127
- 3. 同步或迁移 tooling 配置。
128
- 4. 接入 hook 和 CI。
129
- 5. 用 `repo new --dry-run` 验证模板创建路径。
129
+ ## Keep Reading
130
130
 
131
- ## 下一步
132
-
133
- - [工作流与 CI](./workflows.md)
134
- - [排障与报告](./troubleshooting.md)
135
- - [配置文件](./config.md)
131
+ - [Workflows and CI](./workflows.md)
132
+ - [Troubleshooting](./troubleshooting.md)
133
+ - [Configuration](./config.md)
@@ -1,10 +1,10 @@
1
- # 命令别名
1
+ # Command Aliases
2
2
 
3
- repoctl 保留了一组短别名,方便熟悉后在终端里少打字。团队文档仍建议优先写完整命令,减少新人理解成本。
3
+ repoctl keeps several aliases for terminal convenience. Team docs should still prefer full commands because they are easier for new users to read.
4
4
 
5
- ## 包入口别名
5
+ ## Binary Aliases
6
6
 
7
- `repoctl` 包提供多个 bin:
7
+ The `repoctl` package exposes these bins:
8
8
 
9
9
  ```bash
10
10
  repo
@@ -14,9 +14,9 @@ rc
14
14
  mo
15
15
  ```
16
16
 
17
- 文档统一推荐 `repo`。
17
+ The docs recommend `repo`.
18
18
 
19
- 这些 bin 都进入同一套命令实现:
19
+ These bins all enter the same command implementation:
20
20
 
21
21
  ```bash
22
22
  repoctl doctor
@@ -25,16 +25,16 @@ rc doctor
25
25
  mo doctor
26
26
  ```
27
27
 
28
- ## 顶层命令别名
28
+ ## Top-Level Aliases
29
29
 
30
- | 推荐写法 | 短写 | 说明 |
31
- | ---------------- | ----------- | ---------------- |
32
- | `repo init` | `repo init` | 初始化仓库默认值 |
33
- | `repo templates` | `repo tpl` | 查看或检查模板 |
30
+ | Recommended | Alias | Purpose |
31
+ | ---------------- | ----------- | ----------------------------- |
32
+ | `repo init` | `repo init` | Initialize workspace defaults |
33
+ | `repo templates` | `repo tpl` | Inspect or check templates |
34
34
 
35
- ## 分组命令别名
35
+ ## Group Aliases
36
36
 
37
- | 完整命令 | 短写 |
37
+ | Full Command | Alias |
38
38
  | ------------------------------ | --------------- |
39
39
  | `repo workspace` | `repo ws` |
40
40
  | `repo workspace upgrade` | `repo ws up` |
@@ -62,9 +62,9 @@ mo doctor
62
62
  | `repo ai prompt` | `repo ai p` |
63
63
  | `repo ai prompt create` | `repo ai p new` |
64
64
 
65
- ## 推荐使用原则
65
+ ## Recommendation
66
66
 
67
- - 新手教程写完整命令,例如 `pnpm exec repo doctor`。
68
- - 团队 README 写根脚本,例如 `pnpm run repo:doctor`。
69
- - 维护者脚本可以写短别名,但要在注释或文档里说明用途。
70
- - CI 里优先写完整命令,方便日志搜索。
67
+ - Use full commands in onboarding docs.
68
+ - Use `repo:*` root scripts in project README files, for example `pnpm run repo:doctor`.
69
+ - Use short aliases in maintainer scripts only when the surrounding docs explain them.
70
+ - Prefer full commands in CI logs.
@@ -1,86 +1,39 @@
1
1
  ---
2
- description: 说明 repoctl check 和 verify 的校验模式、pre-commit、staged typecheck、pre-push 与 commit-msg 链路。
2
+ outline: deep
3
3
  ---
4
4
 
5
- # repoctl 校验链路
5
+ # repoctl Verification
6
6
 
7
- `repo check` 是给人使用的统一入口,`repo verify` 是给 hook、CI 和脚本复用的底层入口。
7
+ `repo check` provides stable, task-oriented entrypoints for local and CI verification. It preserves the underlying workspace scripts and reports which commands will run before execution.
8
8
 
9
- ## 1. 模式速查
9
+ ## Modes
10
10
 
11
- | 命令 | 模式 | 实际动作 |
12
- | -------------------------------------------- | ------------ | -------------------------------------------------------------- |
13
- | `repo check` | `default` | 执行 `repo verify pre-commit` |
14
- | `repo check --staged` | `staged` | 执行 pre-commit,并按 staged TypeScript/Vue 文件路由 typecheck |
15
- | `repo check --full` | `full` | 按根脚本执行 `lint`、`typecheck`、`test`、`build` 中存在的任务 |
16
- | `repo check --edit-file .git/COMMIT_EDITMSG` | `commit-msg` | 执行 commit message 校验 |
11
+ | Mode | Command | Purpose |
12
+ | -------------- | ------------------------------- | --------------------------------------------------- |
13
+ | Default | `repo check` | Lightweight pre-commit verification |
14
+ | Staged | `repo check --staged` | lint-staged plus workspace-aware type checking |
15
+ | Full | `repo check --full` | Root lint, typecheck, build, test, and tsd workflow |
16
+ | Commit message | `repo check --edit-file <file>` | Validate a commit message file |
17
17
 
18
- 预览模式不会真正执行校验:
18
+ Use `--dry-run`, `--json`, or `--markdown` to inspect the plan without running it. `--out <file>` persists the result and `--redact` removes local paths.
19
19
 
20
- ```bash
21
- repo check --dry-run
22
- repo check --full --json --out reports/check-plan.json
23
- repo check --markdown --redact --out reports/check-plan.md
24
- ```
25
-
26
- ## 2. pre-commit
27
-
28
- `repo verify pre-commit` 默认执行 lint-staged。适合在提交前只处理 staged 文件,避免每次提交都跑整仓校验。
29
-
30
- 推荐的 lint-staged 行为包括:
31
-
32
- | 文件类型 | 推荐处理 |
33
- | -------------------------- | ---------------------------------------- |
34
- | JS、TS、Vue | ESLint 自动修复 |
35
- | CSS、SCSS、Less、Vue style | Stylelint 自动修复 |
36
- | TS、TSX、MTS、CTS、Vue | 路由到最近 workspace 的 `typecheck` 脚本 |
37
-
38
- ## 3. staged typecheck
39
-
40
- `repo verify staged-typecheck <files...>` 会根据文件路径向上查找最近的 workspace,并执行该 workspace 的 `typecheck`。
41
-
42
- ```bash
43
- repo verify staged-typecheck packages/ui/src/button.ts templates/client/src/App.vue
44
- ```
45
-
46
- 它解决的是 monorepo 里常见的问题:一个提交只改了某个包,不应该让所有 Vue 和 TypeScript workspace 都重复跑类型检查。
47
-
48
- ## 4. pre-push
49
-
50
- `repo verify pre-push` 面向推送前的完整保护。默认策略是:
51
-
52
- | 阶段 | 行为 |
53
- | ------------ | ------------------------------------------------ |
54
- | 根任务 | 强制执行整仓 `lint` 与 `typecheck` |
55
- | 变更范围任务 | 按 workspace 改动范围补跑 `build`、`test`、`tsd` |
56
- | 失败处理 | 任一任务失败时停止并返回失败状态 |
20
+ ## Pre-Commit
57
21
 
58
- 如果 CI 想要更明确地复现整仓校验,可以使用:
22
+ `repo verify pre-commit` runs the repository's staged-file policy. JavaScript, TypeScript, Vue, and style files are routed to the configured lint tasks.
59
23
 
60
- ```bash
61
- repo check --full
62
- ```
24
+ ## Staged Type Checking
63
25
 
64
- ## 5. commit message
26
+ `repo verify staged-typecheck <files...>` maps changed TypeScript and Vue files to their owning workspace. Vue packages use their `vue-tsc` based typecheck script; TypeScript packages use `tsc`.
65
27
 
66
- `repo verify commit-msg <file>` 用于 Git 的 `commit-msg` hook。未配置自定义命令时,它会执行:
28
+ ## Pre-Push
67
29
 
68
- ```bash
69
- pnpm exec commitlint --edit <file>
70
- ```
30
+ `repo verify pre-push` is the comprehensive delivery gate. The repository policy builds first, then runs lint, type checks, type-level tests, and test suites against built artifacts.
71
31
 
72
- 如果你只是手动验证当前提交信息,可以运行:
32
+ ## Automation
73
33
 
74
34
  ```bash
75
- repo check --edit-file .git/COMMIT_EDITMSG
35
+ repo check --full --dry-run --json --out reports/check-plan.json
36
+ repo check --staged --markdown --redact --out reports/check-plan.md
76
37
  ```
77
38
 
78
- ## 6. 选择建议
79
-
80
- | 场景 | 推荐命令 |
81
- | ------------------ | ------------------------------------------------- |
82
- | 本地提交前快速复现 | `repo check` |
83
- | lint-staged 调试 | `repo check --staged --dry-run` |
84
- | 推送前完整检查 | `repo check --full` |
85
- | CI 门禁 | `repo doctor --strict` 后接 `repo check --full` |
86
- | 只生成计划 | `repo check --json --out reports/check-plan.json` |
39
+ JSON field names and command IDs do not change with `--lang`; only human-readable descriptions do.
@@ -1,8 +1,8 @@
1
- # 命令速查
1
+ # Command Reference
2
2
 
3
- 这一页只保留 repoctl 高频、实用、容易记错的命令。
3
+ This page focuses on high-value repoctl commands and options.
4
4
 
5
- ## 最推荐入口
5
+ ## Main Entry
6
6
 
7
7
  ```bash
8
8
  pnpm exec repo init
@@ -12,7 +12,7 @@ pnpm exec repo new
12
12
  pnpm exec repo check
13
13
  ```
14
14
 
15
- 模板生成仓库里的推荐根脚本:
15
+ Generated repositories also expose:
16
16
 
17
17
  ```bash
18
18
  pnpm run repo:init
@@ -31,31 +31,20 @@ repo init --preset standard --force
31
31
  repo init --overwrite
32
32
  ```
33
33
 
34
- 用途:
35
-
36
- - 初始化当前 workspace 的推荐默认值。
37
- - 默认不覆盖已有 README、package.json、pnpm-workspace.yaml 和 tooling 配置。
38
- - 追加缺失的 `apps/*`、`packages/*`、`examples/*` workspace patterns。
39
- - `--yes` 用于 CI 或非 TTY 环境。
40
- - 需要重写受管理文件时显式传 `--force` 或 `--overwrite`。
34
+ Use it to initialize recommended workspace defaults. It skips existing managed files by default, appends missing workspace patterns, and supports non-interactive CI usage with `--yes`.
41
35
 
42
36
  ## `repo doctor`
43
37
 
44
38
  ```bash
45
39
  repo doctor
46
40
  repo doctor --strict
47
- repo doctor --json
48
41
  repo doctor --json --out reports/doctor.json
49
42
  repo doctor --markdown --redact --out reports/doctor.md
50
43
  ```
51
44
 
52
- 用途:
45
+ Use it to check root workspace files, Node compatibility, CLI dependency presence, `repo:*` root scripts, stale config files, and commit hooks.
53
46
 
54
- - 诊断当前目录是不是可直接开始使用的 monorepo 根目录。
55
- - 检查 Node 版本、workspace 文件、CLI 依赖、根脚本、遗留配置和提交链路。
56
- - `--strict` 会把 warning 也视为失败,适合 CI 门禁。
57
- - `--json` 和 `--markdown` 适合自动化、PR、issue 和外部协作。
58
- - `--redact` 会脱敏 workspace、cwd、home 等绝对路径。
47
+ `--strict` treats warnings as failures. `--redact` removes local absolute paths from shareable reports.
59
48
 
60
49
  ## `repo templates`
61
50
 
@@ -68,11 +57,7 @@ repo templates --json
68
57
  repo templates --markdown --out docs/templates.md
69
58
  ```
70
59
 
71
- 用途:
72
-
73
- - 查看内置模板 key、分类、默认生成目录和用途。
74
- - 检查模板元数据和源目录健康状态。
75
- - 给脚本读取 JSON,或生成 Markdown 文档片段。
60
+ Use it to discover built-in template keys, inspect metadata, verify template health, or generate machine-readable output.
76
61
 
77
62
  ## `repo new`
78
63
 
@@ -84,12 +69,7 @@ repo new docs --template vitepress --dry-run
84
69
  repo new docs --template vitepress --json --out plans/docs.json
85
70
  ```
86
71
 
87
- 用途:
88
-
89
- - 交互式或直接创建新的 package、app、service、docs 或 CLI。
90
- - `--dry-run` 只预览模板、目标目录、package name 和输出文件。
91
- - `--json` 输出结构化创建计划,隐含 `--dry-run`。
92
- - 显式传入的 `--template` 会先校验,拼错时会失败并提示相近 key。
72
+ Use it to create packages and apps. Explicit template keys are validated first; invalid keys fail with suggestions instead of silently falling back.
93
73
 
94
74
  ## `repo check`
95
75
 
@@ -103,13 +83,7 @@ repo check --json --out reports/check-plan.json
103
83
  repo check --markdown --redact --out reports/check-plan.md
104
84
  ```
105
85
 
106
- 用途:
107
-
108
- - 运行推荐的本地校验入口。
109
- - `--staged` 偏 pre-commit。
110
- - `--full` 偏 pre-push。
111
- - `--edit-file` 用于 commit message 校验。
112
- - `--dry-run` 只预览将要执行的校验。
86
+ Use it to preview or run the recommended local verification flow. `--staged` is closer to pre-commit; `--full` is closer to pre-push.
113
87
 
114
88
  ## `repo upgrade`
115
89
 
@@ -123,15 +97,9 @@ repo upgrade -i
123
97
  repo upgrade -s
124
98
  ```
125
99
 
126
- 用途:
100
+ Use it to sync standard assets and scripts. `--core` skips GitHub-related assets. `--no-overwrite` preserves changed files.
127
101
 
128
- - 同步仓库标准资产与脚本。
129
- - `--core` 只同步核心配置,跳过 GitHub 相关资产。
130
- - `-i` 交互式选择。
131
- - `--no-overwrite` / `-s` 保留已有 drifted 文件。
132
- - `--yes` / `--overwrite` 非交互覆盖 drifted 标准资产。
133
-
134
- ## 分组命令
102
+ ## Grouped Commands
135
103
 
136
104
  ```bash
137
105
  repo ws ls
@@ -145,24 +113,8 @@ repo config inspect
145
113
  repo skills sync --codex
146
114
  ```
147
115
 
148
- 分组命令适合维护者和自动化脚本。日常开发优先使用顶层命令。
149
-
150
- ## 输出参数速查
151
-
152
- | 参数 | 适用命令 | 说明 |
153
- | -------------- | -------------------------------------------- | ------------------------------------- |
154
- | `--json` | `doctor`、`check`、`templates`、`new`、`env` | 输出机器可读数据 |
155
- | `--markdown` | `doctor`、`check`、`templates`、`env` | 输出适合 PR 和 issue 的 Markdown |
156
- | `--out <file>` | 多数报告和计划命令 | 写入文件,便于 CI artifact 或脚本读取 |
157
- | `--redact` | `doctor`、`check`、`env` | 分享报告前脱敏本机路径 |
158
- | `--strict` | `doctor`、`env snapshot`、`env support` | warning 也会导致失败 |
159
- | `--dry-run` | `check`、`new` | 只看计划,不执行校验或写入文件 |
160
-
161
- ## 继续阅读
116
+ ## Keep Reading
162
117
 
163
- - [执行模型](./execution-model.md)
164
- - [校验链路](./checks.md)
165
- - [doctor 诊断](./doctor.md)
166
- - [工作流与 CI](./workflows.md)
167
- - [报告与自动化输出](./reports.md)
168
- - [命令别名](./aliases.md)
118
+ - [Workflows and CI](./workflows.md)
119
+ - [Troubleshooting](./troubleshooting.md)
120
+ - [Command Aliases](./aliases.md)
@@ -1,16 +1,14 @@
1
- # 配置文件
1
+ # Configuration
2
2
 
3
- repoctl 推荐在仓库根目录使用一个配置文件:
3
+ repoctl recommends one root config file:
4
4
 
5
5
  ```txt
6
6
  repoctl.config.ts
7
7
  ```
8
8
 
9
- `monorepo.config.ts` 已不再作为运行时配置入口。迁移旧仓库时请改名为 `repoctl.config.ts`。
9
+ `monorepo.config.ts` is no longer loaded at runtime. Rename it to `repoctl.config.ts` before running repoctl.
10
10
 
11
- repoctl 支持 `ts`、`mts`、`cts`、`js`、`mjs`、`cjs` 等配置文件后缀。新项目优先使用 `repoctl.config.ts`,这样能保留类型提示和更清晰的迁移路径。
12
-
13
- ## 最小配置
11
+ ## Minimal Config
14
12
 
15
13
  ```ts
16
14
  import { defineMonorepoConfig } from 'repoctl'
@@ -24,15 +22,13 @@ export default defineMonorepoConfig({
24
22
  })
25
23
  ```
26
24
 
27
- 设置 `commands.create.defaultTemplate` 后:
25
+ After setting `commands.create.defaultTemplate`, this command can create a package without asking for the template:
28
26
 
29
27
  ```bash
30
28
  repo new utils
31
29
  ```
32
30
 
33
- 会直接按默认模板创建,不再询问模板类型。
34
-
35
- ## 常用配置
31
+ ## Common Config
36
32
 
37
33
  ```ts
38
34
  import { defineMonorepoConfig } from 'repoctl'
@@ -55,14 +51,14 @@ export default defineMonorepoConfig({
55
51
  })
56
52
  ```
57
53
 
58
- | 配置 | 作用 |
59
- | --------------------------------- | --------------------------------------- |
60
- | `commands.init.preset` | 控制初始化默认预设 |
61
- | `commands.create.defaultTemplate` | 控制 `repo new <name>` 的默认模板 |
62
- | `commands.clean.autoConfirm` | 清理命令是否默认确认 |
63
- | `commands.upgrade.skipOverwrite` | 同步标准资产时是否保留已有 drifted 文件 |
54
+ | Option | Purpose |
55
+ | --------------------------------- | ----------------------------------------------- |
56
+ | `commands.init.preset` | Default setup preset |
57
+ | `commands.create.defaultTemplate` | Default template for `repo new <name>` |
58
+ | `commands.clean.autoConfirm` | Whether clean commands confirm by default |
59
+ | `commands.upgrade.skipOverwrite` | Whether upgrade preserves changed managed files |
64
60
 
65
- ## 查看当前配置
61
+ ## Inspect Config
66
62
 
67
63
  ```bash
68
64
  repo config inspect
@@ -70,21 +66,4 @@ repo cfg i --json --out reports/config.json
70
66
  repo cfg i --markdown --redact --out reports/config.md
71
67
  ```
72
68
 
73
- `--redact` 适合把报告发到 issue、PR 或外部协作渠道。
74
-
75
- ## 配置的定位
76
-
77
- 配置文件只负责团队默认值,不建议把一次性命令参数都写进去。
78
-
79
- 推荐做法:
80
-
81
- - 团队长期一致的选择写进 `repoctl.config.ts`。
82
- - 临时行为用命令参数表达,例如 `--dry-run`、`--json`、`--out`。
83
- - 自动化脚本优先使用显式参数,减少隐藏状态。
84
-
85
- ## 继续阅读
86
-
87
- - [执行模型](./execution-model.md)
88
- - [模板与创建](./templates.md)
89
- - [模板资产治理](./template-assets.md)
90
- - [报告与自动化输出](./reports.md)
69
+ Use `--redact` before sharing reports in issues, PRs, or external support channels.