@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.
- package/README.md +12 -8
- package/README.zh-CN.md +16 -0
- package/assets/.changeset/ledger.yaml +25 -0
- package/assets/.github/ISSUE_TEMPLATE/config.yml +1 -1
- package/assets/AGENTS.md +4 -3
- package/assets/CONTRIBUTING.md +27 -2
- package/assets/SECURITY.md +12 -14
- package/assets/package.json +13 -4
- package/package.json +6 -4
- package/templates/cli/package.json +11 -4
- package/templates/client/package.json +17 -1
- package/templates/server/package.json +11 -4
- package/templates/tsdown/package.json +11 -4
- package/templates/vitepress/.vitepress/config.ts +146 -165
- package/templates/vitepress/ai/index.md +12 -23
- package/templates/vitepress/ai/llms-txt.md +13 -31
- package/templates/vitepress/getting-started.md +3 -32
- package/templates/vitepress/index.md +27 -30
- package/templates/vitepress/knowledge/index.md +17 -41
- package/templates/vitepress/monorepo/commands.md +13 -18
- package/templates/vitepress/monorepo/index.md +22 -100
- package/templates/vitepress/monorepo/manage.md +15 -227
- package/templates/vitepress/monorepo/publish.md +15 -70
- package/templates/vitepress/monorepo/templates.md +10 -17
- package/templates/vitepress/monorepo/troubleshooting.md +13 -16
- package/templates/vitepress/package.json +10 -4
- package/templates/vitepress/public/_redirects +3 -0
- package/templates/vitepress/repoctl/adopt-existing.md +51 -53
- package/templates/vitepress/repoctl/aliases.md +18 -18
- package/templates/vitepress/repoctl/checks.md +21 -68
- package/templates/vitepress/repoctl/commands.md +16 -64
- package/templates/vitepress/repoctl/config.md +14 -35
- package/templates/vitepress/repoctl/doctor.md +20 -60
- package/templates/vitepress/repoctl/execution-model.md +16 -69
- package/templates/vitepress/repoctl/getting-started.md +34 -40
- package/templates/vitepress/repoctl/index.md +33 -61
- package/templates/vitepress/repoctl/reports.md +20 -74
- package/templates/vitepress/repoctl/scenarios.md +26 -28
- package/templates/vitepress/repoctl/template-assets.md +19 -88
- package/templates/vitepress/repoctl/templates.md +50 -81
- package/templates/vitepress/repoctl/troubleshooting.md +32 -46
- package/templates/vitepress/repoctl/workflows.md +38 -67
- package/templates/vitepress/thinking.md +4 -85
- package/templates/vitepress/tools/changeset.md +9 -59
- package/templates/vitepress/tools/husky.md +6 -124
- package/templates/vitepress/tools/index.md +13 -32
- package/templates/vitepress/tools/lint-staged.md +5 -96
- package/templates/vitepress/tools/llms-txt.md +4 -6
- package/templates/vitepress/tools/pnpm.md +7 -119
- package/templates/vitepress/tools/renovate.md +3 -87
- package/templates/vitepress/tools/turborepo.md +5 -157
- package/templates/vitepress/why/how-to-reuse-js-code.md +6 -247
- package/templates/vitepress/why/index.md +14 -1
- package/templates/vitepress/why/js-cjs-mjs.md +9 -96
- package/templates/vitepress/why/js-keywords.md +4 -129
- package/templates/vitepress/why/modern/bundlers.md +3 -50
- package/templates/vitepress/why/modern/dts.md +4 -90
- package/templates/vitepress/why/modern/esm-vs-cjs.md +4 -81
- package/templates/vitepress/why/modern/index.md +10 -51
- package/templates/vitepress/why/modern/package-entry-points.md +6 -117
- package/templates/vitepress/why/modern/typescript.md +4 -152
- package/templates/vitepress/why/publish-basic-npm-package.md +17 -144
- package/templates/vitepress/why/what-is-npm-package.md +4 -159
- package/templates/vitepress/zh/ai/index.md +33 -0
- package/templates/vitepress/zh/ai/llms-txt.md +42 -0
- package/templates/vitepress/zh/getting-started.md +40 -0
- package/templates/vitepress/zh/index.md +66 -0
- package/templates/vitepress/zh/knowledge/index.md +50 -0
- package/templates/vitepress/zh/monorepo/commands.md +21 -0
- package/templates/vitepress/zh/monorepo/index.md +115 -0
- package/templates/vitepress/zh/monorepo/manage.md +243 -0
- package/templates/vitepress/zh/monorepo/publish.md +87 -0
- package/templates/vitepress/zh/monorepo/templates.md +21 -0
- package/templates/vitepress/zh/monorepo/troubleshooting.md +20 -0
- package/templates/vitepress/zh/repoctl/adopt-existing.md +135 -0
- package/templates/vitepress/{en → zh}/repoctl/aliases.md +18 -18
- package/templates/vitepress/zh/repoctl/checks.md +86 -0
- package/templates/vitepress/zh/repoctl/commands.md +168 -0
- package/templates/vitepress/zh/repoctl/config.md +90 -0
- package/templates/vitepress/zh/repoctl/doctor.md +86 -0
- package/templates/vitepress/zh/repoctl/execution-model.md +81 -0
- package/templates/vitepress/zh/repoctl/getting-started.md +122 -0
- package/templates/vitepress/zh/repoctl/index.md +102 -0
- package/templates/vitepress/zh/repoctl/reports.md +94 -0
- package/templates/vitepress/{en → zh}/repoctl/scenarios.md +28 -26
- package/templates/vitepress/zh/repoctl/template-assets.md +116 -0
- package/templates/vitepress/zh/repoctl/templates.md +159 -0
- package/templates/vitepress/zh/repoctl/troubleshooting.md +110 -0
- package/templates/vitepress/zh/repoctl/workflows.md +118 -0
- package/templates/vitepress/zh/thinking.md +88 -0
- package/templates/vitepress/zh/tools/changeset.md +75 -0
- package/templates/vitepress/zh/tools/husky.md +130 -0
- package/templates/vitepress/zh/tools/index.md +38 -0
- package/templates/vitepress/zh/tools/lint-staged.md +103 -0
- package/templates/vitepress/zh/tools/llms-txt.md +9 -0
- package/templates/vitepress/zh/tools/pnpm.md +127 -0
- package/templates/vitepress/zh/tools/renovate.md +91 -0
- package/templates/vitepress/zh/tools/turborepo.md +166 -0
- package/templates/vitepress/zh/why/assets/npm-dt.svg +15 -0
- package/templates/vitepress/zh/why/assets/npm-ts.svg +19 -0
- package/templates/vitepress/zh/why/examples/0.npm-basic-package/index.js +10 -0
- package/templates/vitepress/zh/why/examples/0.npm-basic-package/package.json +11 -0
- package/templates/vitepress/zh/why/examples/1.npm-basic-package/index.cjs +12 -0
- package/templates/vitepress/zh/why/examples/1.npm-basic-package/index.d.ts +1 -0
- package/templates/vitepress/zh/why/examples/1.npm-basic-package/index.js +8 -0
- package/templates/vitepress/zh/why/examples/1.npm-basic-package/package.json +19 -0
- package/templates/vitepress/zh/why/examples/2.npm-basic-package/README.md +1 -0
- package/templates/vitepress/zh/why/examples/2.npm-basic-package/package-lock.json +30 -0
- package/templates/vitepress/zh/why/examples/2.npm-basic-package/package.json +35 -0
- package/templates/vitepress/zh/why/examples/2.npm-basic-package/rename-ext.js +24 -0
- package/templates/vitepress/zh/why/examples/2.npm-basic-package/src/index.ts +8 -0
- package/templates/vitepress/zh/why/examples/2.npm-basic-package/tsconfig.cjs.json +8 -0
- package/templates/vitepress/zh/why/examples/2.npm-basic-package/tsconfig.esm.json +7 -0
- package/templates/vitepress/zh/why/examples/2.npm-basic-package/tsconfig.json +18 -0
- package/templates/vitepress/zh/why/examples/3.npm-basic-package/README.md +1 -0
- package/templates/vitepress/zh/why/examples/3.npm-basic-package/package-lock.json +1496 -0
- package/templates/vitepress/zh/why/examples/3.npm-basic-package/package.json +31 -0
- package/templates/vitepress/zh/why/examples/3.npm-basic-package/src/index.ts +8 -0
- package/templates/vitepress/zh/why/examples/3.npm-basic-package/tsconfig.json +16 -0
- package/templates/vitepress/zh/why/examples/3.npm-basic-package/tsdown.config.ts +16 -0
- package/templates/vitepress/zh/why/examples/usage-cjs/cjs.cjs +4 -0
- package/templates/vitepress/zh/why/examples/usage-cjs/esm.mjs +4 -0
- package/templates/vitepress/zh/why/examples/usage-cjs/index.js +8 -0
- package/templates/vitepress/zh/why/examples/usage-cjs/package-lock.json +36 -0
- package/templates/vitepress/zh/why/examples/usage-cjs/package.json +20 -0
- package/templates/vitepress/zh/why/examples/usage-esm/cjs.cjs +4 -0
- package/templates/vitepress/zh/why/examples/usage-esm/createRequire.js +7 -0
- package/templates/vitepress/zh/why/examples/usage-esm/esm.mjs +4 -0
- package/templates/vitepress/zh/why/examples/usage-esm/index.js +8 -0
- package/templates/vitepress/zh/why/examples/usage-esm/package-lock.json +36 -0
- package/templates/vitepress/zh/why/examples/usage-esm/package.json +21 -0
- package/templates/vitepress/zh/why/how-to-reuse-js-code.md +250 -0
- package/templates/vitepress/zh/why/index.md +1 -0
- package/templates/vitepress/zh/why/js-cjs-mjs.md +99 -0
- package/templates/vitepress/zh/why/js-keywords.md +132 -0
- package/templates/vitepress/zh/why/modern/bundlers.md +52 -0
- package/templates/vitepress/zh/why/modern/dts.md +93 -0
- package/templates/vitepress/zh/why/modern/esm-vs-cjs.md +84 -0
- package/templates/vitepress/zh/why/modern/index.md +55 -0
- package/templates/vitepress/zh/why/modern/package-entry-points.md +128 -0
- package/templates/vitepress/zh/why/modern/typescript.md +155 -0
- package/templates/vitepress/zh/why/publish-basic-npm-package.md +146 -0
- package/templates/vitepress/zh/why/what-is-npm-package.md +162 -0
- package/templates/vue-lib/package.json +12 -5
- package/templates/vitepress/en/index.md +0 -63
- package/templates/vitepress/en/knowledge/monorepo.md +0 -37
- package/templates/vitepress/en/repoctl/adopt-existing.md +0 -133
- package/templates/vitepress/en/repoctl/commands.md +0 -120
- package/templates/vitepress/en/repoctl/config.md +0 -69
- package/templates/vitepress/en/repoctl/getting-started.md +0 -116
- package/templates/vitepress/en/repoctl/index.md +0 -74
- package/templates/vitepress/en/repoctl/templates.md +0 -128
- package/templates/vitepress/en/repoctl/troubleshooting.md +0 -96
- package/templates/vitepress/en/repoctl/workflows.md +0 -89
|
@@ -1,86 +1,46 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
outline: deep
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
# repoctl
|
|
5
|
+
# repoctl Doctor
|
|
6
6
|
|
|
7
|
-
`repo doctor`
|
|
7
|
+
`repo doctor` diagnoses whether the current pnpm workspace is ready for development and release. It does not rewrite files.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Statuses
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
15
|
+
## Checks
|
|
18
16
|
|
|
19
|
-
|
|
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
|
-
|
|
19
|
+
Check IDs and JSON fields remain stable in every locale.
|
|
24
20
|
|
|
25
|
-
##
|
|
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
|
|
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
|
-
|
|
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
|
-
##
|
|
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
|
-
|
|
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
|
|
73
|
-
repo
|
|
74
|
-
repo doctor
|
|
42
|
+
repo --lang zh-CN doctor
|
|
43
|
+
REPOCTL_LANG=zh-CN repo doctor
|
|
75
44
|
```
|
|
76
45
|
|
|
77
|
-
|
|
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
|
-
|
|
2
|
+
outline: deep
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
# repoctl
|
|
5
|
+
# repoctl Execution Model
|
|
6
6
|
|
|
7
|
-
repoctl
|
|
7
|
+
repoctl is a task layer over pnpm, Turborepo, repository scripts, and managed assets. It coordinates those systems without replacing them.
|
|
8
8
|
|
|
9
|
-
##
|
|
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
|
-
##
|
|
13
|
+
## Command Lifecycle
|
|
18
14
|
|
|
19
|
-
|
|
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
|
-
|
|
22
|
-
repo --help
|
|
23
|
-
-> 注册命令树
|
|
24
|
-
-> 输出帮助
|
|
22
|
+
## Output Contracts
|
|
25
23
|
|
|
26
|
-
|
|
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
|
-
|
|
26
|
+
## Configuration
|
|
34
27
|
|
|
35
|
-
|
|
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
|
-
|
|
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
|
|
9
|
-
- Git
|
|
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
|
-
##
|
|
17
|
+
## Install
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
20
|
pnpm add -D repoctl
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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`
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
114
|
-
- `--yes`
|
|
115
|
-
-
|
|
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
|
-
-
|
|
120
|
-
-
|
|
121
|
-
-
|
|
122
|
-
-
|
|
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`
|
|
3
|
+
`repoctl` is the user-facing package name for this monorepo toolkit. Its recommended command is `repo`.
|
|
4
4
|
|
|
5
|
-
|
|
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
|
-
##
|
|
7
|
+
## When To Use It
|
|
8
8
|
|
|
9
|
-
|
|
|
10
|
-
|
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
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
|
-
###
|
|
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
|
-
|
|
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
|
-
###
|
|
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
|
-
|
|
41
|
+
Use this form in CI, scripts, troubleshooting docs, and reproducible examples.
|
|
42
42
|
|
|
43
|
-
###
|
|
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
|
-
|
|
52
|
+
Grouped commands are for maintainers and automation that need finer control.
|
|
53
53
|
|
|
54
|
-
##
|
|
54
|
+
## Command Entrypoints
|
|
55
55
|
|
|
56
|
-
|
|
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
|
-
|
|
87
|
-
|
|
88
|
-
##
|
|
89
|
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
-
|
|
93
|
-
-
|
|
94
|
-
-
|
|
95
|
-
-
|
|
96
|
-
-
|
|
97
|
-
-
|
|
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
|
-
|
|
2
|
+
outline: deep
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
#
|
|
5
|
+
# Reports and Automation Output
|
|
6
6
|
|
|
7
|
-
repoctl
|
|
7
|
+
repoctl commands expose human-readable text for terminals, Markdown for issues and pull requests, and stable JSON for automation.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Common Options
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
##
|
|
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
|
|
41
|
-
repo
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
## 4. issue 排障模板
|
|
26
|
+
The support bundle combines environment facts, resolved configuration, doctor results, the check plan, and report paths.
|
|
48
27
|
|
|
49
|
-
|
|
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
|
|
72
|
-
repo
|
|
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
|
-
|
|
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.
|