@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
@@ -1,86 +1,46 @@
1
1
  ---
2
- description: 说明 repoctl doctor 的检查项、状态含义、strict 模式和修复建议。
2
+ outline: deep
3
3
  ---
4
4
 
5
- # repoctl doctor 诊断
5
+ # repoctl Doctor
6
6
 
7
- `repo doctor` 用来判断当前目录是不是一个可维护、可开发、可接入 repoctl 工作流的 pnpm monorepo 根目录。
7
+ `repo doctor` diagnoses whether the current pnpm workspace is ready for development and release. It does not rewrite files.
8
8
 
9
- ## 1. 状态含义
9
+ ## Statuses
10
10
 
11
- | 状态 | 含义 | 对退出码的影响 |
12
- | ------ | -------------- | ----------------------------- |
13
- | `pass` | 检查通过 | 不影响 |
14
- | `warn` | 存在建议修复项 | 默认不失败,`--strict` 下失败 |
15
- | `fail` | 阻塞项 | 命令返回失败状态 |
11
+ - `pass`: the check is satisfied.
12
+ - `warn`: the repository works, but maintenance or consistency needs attention.
13
+ - `fail`: a required workspace contract is missing or invalid.
16
14
 
17
- CI 中推荐使用:
15
+ ## Checks
18
16
 
19
- ```bash
20
- repo doctor --strict
21
- ```
17
+ Doctor covers the root `package.json`, `pnpm-workspace.yaml`, Node compatibility, the `repoctl` dependency, recommended `repo:*` scripts, `repoctl.config.ts`, commit hooks, workspace pattern coverage, tooling imports, and release configuration.
22
18
 
23
- 这样 warning 不会长期堆积成隐性风险。
19
+ Check IDs and JSON fields remain stable in every locale.
24
20
 
25
- ## 2. 核心检查项
26
-
27
- | 检查项 | 通过标准 | 常见修复 |
28
- | ---------------------------- | ---------------------------------------------------------------- | ---------------------------- |
29
- | `package-json` | 当前 workspace 根目录存在 `package.json` | 回到仓库根目录或先初始化项目 |
30
- | `workspace-manifest` | 存在 `pnpm-workspace.yaml` | `repo init --yes` |
31
- | `node-version` | 当前 Node 满足 `engines.node` | 切换 Node 版本或补充 engines |
32
- | `tool-package` | 根依赖包含 `repoctl` | `pnpm add -D repoctl` |
33
- | `root-scripts` | 存在 `repo:init`、`repo:new`、`repo:check`、`repo:doctor` 根脚本 | `repo init --yes` |
34
- | `config-file` | 使用 `repoctl.config.ts`,且没有残留 `monorepo.config.ts` | 保留 `repoctl.config.ts` |
35
- | `commit-hooks` | Husky 和 lint-staged 同时就绪 | `repo upgrade --yes` |
36
- | `tooling-imports` | 配置不再引用本地源码 loader 或旧 config wrapper | `repo upgrade --yes` |
37
- | `workspace-patterns` | 常见目录被 workspace patterns 覆盖 | `repo init --yes` |
38
- | `workspace-package-coverage` | 常见目录下的包都被 pnpm 覆盖 | `repo init --yes` |
39
-
40
- ## 3. 输出报告
21
+ ## Reports
41
22
 
42
23
  ```bash
43
- repo doctor
44
24
  repo doctor --json
45
- repo doctor --markdown --redact
46
- repo doctor --json --out reports/doctor.json
25
+ repo doctor --markdown
47
26
  repo doctor --markdown --redact --out reports/doctor.md
48
27
  ```
49
28
 
50
- 自动化脚本推荐使用 `pnpm run repo:doctor -- --json` 或 `pnpm exec repo doctor --json`。
51
-
52
- | 输出 | 适合场景 |
53
- | ------------ | --------------------------- |
54
- | 默认交互文本 | 本地直接阅读 |
55
- | JSON | CI、编辑器、脚本消费 |
56
- | Markdown | 粘贴到 issue、PR 或排障文档 |
57
- | `--redact` | 分享报告前隐藏本机绝对路径 |
29
+ `--redact` replaces workspace, current-directory, and home paths before output is shared.
58
30
 
59
- ## 4. strict 模式
60
-
61
- `--strict` 会把 warning 也视为失败。它适合放在 CI 早期阶段:
31
+ ## Strict Mode
62
32
 
63
33
  ```bash
64
- pnpm install --frozen-lockfile
65
34
  repo doctor --strict
66
- repo check --full
67
35
  ```
68
36
 
69
- 如果你正在接入存量仓库,建议先不用 strict,把报告保存下来逐项修复:
37
+ Normal mode exits non-zero for failures. Strict mode also treats warnings as blocking, which is useful for CI policy enforcement.
38
+
39
+ ## Language
70
40
 
71
41
  ```bash
72
- repo doctor --markdown --redact --out reports/doctor.md
73
- repo upgrade --no-overwrite
74
- repo doctor
42
+ repo --lang zh-CN doctor
43
+ REPOCTL_LANG=zh-CN repo doctor
75
44
  ```
76
45
 
77
- ## 5. 排查顺序
78
-
79
- 建议按阻塞程度处理:
80
-
81
- 1. 先处理 `fail`,否则命令或 CI 很可能无法继续。
82
- 2. 再处理遗留配置和 Node 版本问题。
83
- 3. 然后补根脚本、hook 和 lint-staged。
84
- 4. 最后整理 workspace patterns 与 tooling imports。
85
-
86
- 如果不确定报告能否安全分享,使用 [报告与自动化输出](./reports.md) 里的 `--redact` 和 `env support`。
46
+ The explicit option wins over `REPOCTL_LANG`; English is the fixed fallback.
@@ -1,81 +1,28 @@
1
1
  ---
2
- description: 说明 repoctl CLI 的入口层级、命令懒加载、非交互输出和脚本集成方式。
2
+ outline: deep
3
3
  ---
4
4
 
5
- # repoctl 执行模型
5
+ # repoctl Execution Model
6
6
 
7
- repoctl 的核心设计是把日常入口保持短,把细粒度能力放到分组命令里,并让 CI、编辑器和脚本可以读取结构化输出。
7
+ repoctl is a task layer over pnpm, Turborepo, repository scripts, and managed assets. It coordinates those systems without replacing them.
8
8
 
9
- ## 1. 入口层级
9
+ ## Entrypoints
10
10
 
11
- | 层级 | 示例 | 使用场景 |
12
- | ----------- | ------------------------------------------------------------------ | ------------------------------ |
13
- | 根脚本 | `pnpm run repo:doctor`、`pnpm run repo:new`、`pnpm run repo:check` | 团队日常开发、README、贡献指南 |
14
- | `repo` 命令 | `pnpm exec repo doctor` | 文档、CI、脚本、排障 |
15
- | 分组命令 | `repo env support`、`repo verify pre-push` | 维护者、自动化和集成工具 |
11
+ The recommended binary is `repo`. `repoctl` is an equivalent public bin. Generated workspaces also expose `repo:init`, `repo:new`, `repo:doctor`, and `repo:check` root scripts.
16
12
 
17
- ## 2. 命令执行过程
13
+ ## Command Lifecycle
18
14
 
19
- repoctl 启动时只注册命令树。具体实现会在 action 执行时再加载,因此查看帮助和列出命令不会提前扫描所有 workspace、Git 状态和模板文件。
15
+ 1. Resolve locale from `--lang`, then `REPOCTL_LANG`, then English.
16
+ 2. Find the pnpm workspace root and load `repoctl.config.ts` when present.
17
+ 3. Build a deterministic plan from workspace state and command options.
18
+ 4. Prompt only when the terminal is interactive and the command needs a choice.
19
+ 5. Execute the plan or emit text, Markdown, or JSON output.
20
+ 6. Set a non-zero exit code for blocking diagnostics or command failures.
20
21
 
21
- ```txt
22
- repo --help
23
- -> 注册命令树
24
- -> 输出帮助
22
+ ## Output Contracts
25
23
 
26
- repo doctor
27
- -> 注册命令树
28
- -> 加载 doctor 实现
29
- -> 发现 workspace
30
- -> 输出诊断报告
31
- ```
24
+ Text and Markdown are localized. JSON keys, status values, check IDs, command names, and option names are stable across locales.
32
25
 
33
- 这种模型适合命令数量较多的 monorepo 工具:日常命令保持快,重逻辑只在真正执行时进入。
26
+ ## Configuration
34
27
 
35
- ## 3. 输出模式
36
-
37
- 很多 repoctl 命令都同时服务人和机器:
38
-
39
- | 参数 | 行为 | 典型用途 |
40
- | -------------- | -------------------------------- | ------------------------ |
41
- | `--json` | 输出结构化 JSON | CI、编辑器、脚本 |
42
- | `--markdown` | 输出 Markdown 报告 | issue、PR、协作文档 |
43
- | `--out <file>` | 写入文件 | 保存 artifact 或生成计划 |
44
- | `--redact` | 脱敏 cwd、workspace、home 等路径 | 分享本机报告 |
45
- | `--dry-run` | 只生成计划,不写入业务文件 | 审查创建和校验动作 |
46
-
47
- `--json`、`--markdown`、`--out` 在 `repo check` 和 `repo new` 这类命令里会隐含预览语义,避免自动化读取计划时意外执行写入。
48
-
49
- ## 4. 失败状态
50
-
51
- repoctl 的失败状态遵循阻塞优先:
52
-
53
- | 命令 | 什么时候失败 |
54
- | ------------------------ | ----------------------------------------------------- |
55
- | `repo doctor` | 存在 `fail` 检查项;加 `--strict` 时 warning 也会失败 |
56
- | `repo templates --check` | 模板健康检查出现 fail |
57
- | `repo new` | 模板不存在、目标校验失败或写入失败 |
58
- | `repo check --full` | 任一 root script 校验失败 |
59
- | `repo verify *` | 对应 hook 或校验命令失败 |
60
-
61
- 如果只是想知道会发生什么,先加 `--dry-run` 或输出计划:
62
-
63
- ```bash
64
- repo new docs --template vitepress --json --out plans/docs.json
65
- repo check --markdown --out reports/check-plan.md
66
- ```
67
-
68
- ## 5. 和配置文件的关系
69
-
70
- repoctl 会从 workspace 根目录加载 `repoctl.config.*`。`monorepo.config.*` 已不再加载。
71
-
72
- 配置加载后会影响具体命令,例如:
73
-
74
- | 配置区域 | 影响命令 |
75
- | ------------------ | ------------------------------------------------------------------- |
76
- | `commands.init` | `repo init` |
77
- | `commands.create` | `repo new` |
78
- | `commands.upgrade` | `repo upgrade` |
79
- | `tooling` | `repoctl/tooling` wrapper 生成的 ESLint、Vitest、lint-staged 等配置 |
80
-
81
- 更多配置示例见:[配置文件](./config.md)。
28
+ Configuration supplies repository defaults. Explicit CLI options take precedence. Non-interactive automation should use `--yes`, explicit template keys, and report output options instead of relying on prompts.
@@ -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 或 pnpm versioning,而是把这些工具在 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.