@icebreakers/monorepo-templates 1.0.15 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -8
- package/README.zh-CN.md +16 -0
- package/assets/.changeset/ledger.yaml +51 -0
- package/assets/.github/ISSUE_TEMPLATE/config.yml +1 -1
- package/assets/.github/workflows/release.yml +22 -97
- package/assets/AGENTS.md +5 -4
- package/assets/CONTRIBUTING.md +27 -2
- package/assets/SECURITY.md +12 -14
- package/assets/package.json +18 -10
- package/assets/pnpm-workspace.yaml +8 -0
- package/package.json +6 -4
- package/templates/cli/package.json +11 -4
- package/templates/client/package.json +22 -6
- package/templates/server/package.json +14 -7
- package/templates/server/vitest.config.ts +1 -4
- package/templates/tsdown/package.json +11 -4
- package/templates/tsdown/vitest.config.ts +1 -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 +17 -245
- package/templates/vitepress/monorepo/templates.md +10 -17
- package/templates/vitepress/monorepo/troubleshooting.md +13 -16
- package/templates/vitepress/package.json +11 -5
- 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 +12 -85
- 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/vue-lib/vitest.config.ts +1 -1
- package/assets/.changeset/config.json +0 -21
- package/assets/.changeset/publish-versioned-packages.md +0 -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,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.
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Choose By Scenario
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Start here when you know what you want to do, but not which repoctl command to use.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## I Just Opened A Repository
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
pnpm install
|
|
9
9
|
pnpm run repo:doctor
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
If the `repo:*` scripts do not exist yet:
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
15
|
pnpm add -D repoctl
|
|
@@ -17,9 +17,9 @@ pnpm exec repo init --yes
|
|
|
17
17
|
pnpm exec repo doctor
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Keep reading: [Getting Started](./getting-started.md).
|
|
21
21
|
|
|
22
|
-
##
|
|
22
|
+
## I Want To Adopt repoctl In An Existing Repo
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
25
|
pnpm add -D repoctl
|
|
@@ -29,9 +29,9 @@ pnpm exec repo upgrade --no-overwrite
|
|
|
29
29
|
pnpm exec repo doctor --markdown --redact --out reports/doctor-after.md
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
Keep reading: [Adopt Existing Repositories](./adopt-existing.md).
|
|
33
33
|
|
|
34
|
-
##
|
|
34
|
+
## I Want To Create A Package Or App
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
37
|
pnpm exec repo templates
|
|
@@ -39,15 +39,15 @@ pnpm exec repo new sdk --template tsdown
|
|
|
39
39
|
pnpm exec repo new docs --template vitepress --dry-run
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
For daily development, root scripts also work:
|
|
43
43
|
|
|
44
44
|
```bash
|
|
45
45
|
pnpm run repo:new -- sdk --template tsdown
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
Keep reading: [Templates](./templates.md).
|
|
49
49
|
|
|
50
|
-
##
|
|
50
|
+
## I Want To Check Before Committing
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
53
|
pnpm run repo:check
|
|
@@ -55,16 +55,16 @@ pnpm exec repo check --dry-run
|
|
|
55
55
|
pnpm exec repo check --full
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
Save the plan when automation needs it:
|
|
59
59
|
|
|
60
60
|
```bash
|
|
61
61
|
pnpm exec repo check --json --out reports/check-plan.json
|
|
62
62
|
pnpm exec repo check --markdown --redact --out reports/check-plan.md
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
Keep reading: [Workflows and CI](./workflows.md).
|
|
66
66
|
|
|
67
|
-
##
|
|
67
|
+
## I Want To Debug CI Or Another Machine
|
|
68
68
|
|
|
69
69
|
```bash
|
|
70
70
|
pnpm exec repo doctor --markdown --redact --out reports/doctor.md
|
|
@@ -72,9 +72,9 @@ pnpm exec repo env support --markdown --redact --out reports/support.md
|
|
|
72
72
|
pnpm exec repo env snapshot --json --out reports/snapshot.json
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
Keep reading: [Troubleshooting](./troubleshooting.md).
|
|
76
76
|
|
|
77
|
-
##
|
|
77
|
+
## I Want To Sync Standard Assets
|
|
78
78
|
|
|
79
79
|
```bash
|
|
80
80
|
pnpm exec repo upgrade --no-overwrite
|
|
@@ -82,15 +82,13 @@ pnpm exec repo upgrade --yes
|
|
|
82
82
|
pnpm exec repo upgrade --core
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
| Goal | Command |
|
|
86
|
+
| ------------------------------------------ | ----------------------------- |
|
|
87
|
+
| First adoption pass, preserve local config | `repo upgrade --no-overwrite` |
|
|
88
|
+
| Explicitly overwrite managed assets | `repo upgrade --yes` |
|
|
89
|
+
| Sync only core config | `repo upgrade --core` |
|
|
86
90
|
|
|
87
|
-
|
|
88
|
-
| ------------------------ | ----------------------------- |
|
|
89
|
-
| 第一次接入,保留已有配置 | `repo upgrade --no-overwrite` |
|
|
90
|
-
| 明确要覆盖标准资产 | `repo upgrade --yes` |
|
|
91
|
-
| 只同步核心配置 | `repo upgrade --core` |
|
|
92
|
-
|
|
93
|
-
## 我要看 workspace 结构
|
|
91
|
+
## I Want To Inspect Workspace Structure
|
|
94
92
|
|
|
95
93
|
```bash
|
|
96
94
|
pnpm exec repo ws ls
|
|
@@ -98,16 +96,16 @@ pnpm exec repo ws ls --json --out reports/workspaces.json
|
|
|
98
96
|
pnpm exec repo ws ls --markdown --redact --out reports/workspaces.md
|
|
99
97
|
```
|
|
100
98
|
|
|
101
|
-
##
|
|
99
|
+
## I Want To Inspect Config
|
|
102
100
|
|
|
103
101
|
```bash
|
|
104
102
|
pnpm exec repo config inspect
|
|
105
103
|
pnpm exec repo cfg i --json --out reports/config.json
|
|
106
104
|
```
|
|
107
105
|
|
|
108
|
-
|
|
106
|
+
Keep reading: [Configuration](./config.md).
|
|
109
107
|
|
|
110
|
-
##
|
|
108
|
+
## I Want Shorter Commands
|
|
111
109
|
|
|
112
110
|
```bash
|
|
113
111
|
repo tpl
|
|
@@ -116,4 +114,4 @@ repo e support --markdown --redact
|
|
|
116
114
|
repo cfg i
|
|
117
115
|
```
|
|
118
116
|
|
|
119
|
-
|
|
117
|
+
Keep reading: [Command Aliases](./aliases.md).
|