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