@icebreakers/monorepo 3.2.18 → 4.0.1

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.
@@ -0,0 +1,118 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-twds-ZHy.mjs";
2
+ import { findWorkspaceDir } from "@pnpm/find-workspace-dir";
3
+ import { findWorkspacePackages } from "@pnpm/workspace.find-packages";
4
+ import { readWorkspaceManifest } from "@pnpm/workspace.read-manifest";
5
+ import path from "pathe";
6
+ //#region src/core/workspace.ts
7
+ var workspace_exports = /* @__PURE__ */ __exportAll({
8
+ clearWorkspaceCache: () => clearWorkspaceCache,
9
+ getWorkspaceData: () => getWorkspaceData,
10
+ getWorkspacePackageSummaries: () => getWorkspacePackageSummaries,
11
+ getWorkspacePackages: () => getWorkspacePackages
12
+ });
13
+ const workspaceDirCache = /* @__PURE__ */ new Map();
14
+ const workspaceManifestCache = /* @__PURE__ */ new Map();
15
+ const workspacePackagesCache = /* @__PURE__ */ new Map();
16
+ function normalizeDir(dir) {
17
+ return path.resolve(dir);
18
+ }
19
+ function getPatternsCacheKey(patterns) {
20
+ return patterns === void 0 ? "<manifest>" : JSON.stringify(patterns);
21
+ }
22
+ function comparePackagePath(left, right) {
23
+ return left.relativeDir.localeCompare(right.relativeDir);
24
+ }
25
+ async function findWorkspaceDirCached(cwd) {
26
+ const key = normalizeDir(cwd);
27
+ if (!workspaceDirCache.has(key)) workspaceDirCache.set(key, findWorkspaceDir(key));
28
+ return workspaceDirCache.get(key);
29
+ }
30
+ async function readWorkspaceManifestCached(workspaceDir) {
31
+ const key = normalizeDir(workspaceDir);
32
+ if (!workspaceManifestCache.has(key)) workspaceManifestCache.set(key, readWorkspaceManifest(key));
33
+ return workspaceManifestCache.get(key);
34
+ }
35
+ async function findWorkspacePackagesCached(workspaceDir, patterns) {
36
+ const normalizedWorkspaceDir = normalizeDir(workspaceDir);
37
+ const key = `${normalizedWorkspaceDir}:${getPatternsCacheKey(patterns)}`;
38
+ if (!workspacePackagesCache.has(key)) workspacePackagesCache.set(key, findWorkspacePackages(normalizedWorkspaceDir, patterns ? { patterns } : {}));
39
+ return workspacePackagesCache.get(key);
40
+ }
41
+ /**
42
+ * 清空当前进程内的 workspace 发现缓存。
43
+ *
44
+ * 普通 CLI 命令执行后进程会退出;长期运行的集成测试或程序化调用在修改
45
+ * `pnpm-workspace.yaml` / package 目录后,可以调用它让后续扫描重新读磁盘。
46
+ */
47
+ function clearWorkspaceCache() {
48
+ workspaceDirCache.clear();
49
+ workspaceManifestCache.clear();
50
+ workspacePackagesCache.clear();
51
+ }
52
+ /**
53
+ * 读取 pnpm workspace 下的所有包,并根据选项做过滤。
54
+ *
55
+ * 默认值:
56
+ * - `ignoreRootPackage`: `true`
57
+ * - `ignorePrivatePackage`: `true`
58
+ *
59
+ * @param workspaceDir workspace 根目录
60
+ * @param options 过滤选项
61
+ * @returns 带有 `pkgJsonPath` 字段的 workspace package 列表
62
+ */
63
+ async function getWorkspacePackages(workspaceDir, options) {
64
+ const normalizedWorkspaceDir = normalizeDir(workspaceDir);
65
+ const ignoreRootPackage = options?.ignoreRootPackage ?? true;
66
+ const ignorePrivatePackage = options?.ignorePrivatePackage ?? true;
67
+ const manifest = options?.patterns === void 0 ? await readWorkspaceManifestCached(normalizedWorkspaceDir) : void 0;
68
+ let pkgs = (await findWorkspacePackagesCached(normalizedWorkspaceDir, options?.patterns ?? manifest?.packages)).filter((x) => {
69
+ if (ignorePrivatePackage && x.manifest.private) return false;
70
+ return true;
71
+ }).map((project) => {
72
+ const pkgJsonPath = path.resolve(project.rootDir, "package.json");
73
+ return {
74
+ ...project,
75
+ pkgJsonPath
76
+ };
77
+ });
78
+ if (ignoreRootPackage) pkgs = pkgs.filter((x) => {
79
+ return x.rootDir !== normalizedWorkspaceDir;
80
+ });
81
+ return pkgs;
82
+ }
83
+ /**
84
+ * 一次性返回 `cwd`、真实 `workspaceDir` 与过滤后的包列表。
85
+ *
86
+ * @param cwd 当前工作目录
87
+ * @param options 传给 `getWorkspacePackages()` 的过滤选项
88
+ */
89
+ async function getWorkspaceData(cwd, options) {
90
+ const normalizedCwd = normalizeDir(cwd);
91
+ const workspaceDir = await findWorkspaceDirCached(normalizedCwd) ?? normalizedCwd;
92
+ return {
93
+ cwd: normalizedCwd,
94
+ workspaceDir,
95
+ packages: await getWorkspacePackages(workspaceDir, options)
96
+ };
97
+ }
98
+ /**
99
+ * 返回适合展示和程序化消费的 workspace package 摘要。
100
+ */
101
+ async function getWorkspacePackageSummaries(cwd, options) {
102
+ const { packages, workspaceDir } = await getWorkspaceData(cwd, options);
103
+ const summaries = packages.map((pkg) => ({
104
+ ...pkg.manifest.name ? { name: pkg.manifest.name } : {},
105
+ ...pkg.manifest.description ? { description: pkg.manifest.description } : {},
106
+ private: pkg.manifest.private === true,
107
+ rootDir: pkg.rootDir,
108
+ relativeDir: path.relative(workspaceDir, pkg.rootDir) || ".",
109
+ pkgJsonPath: pkg.pkgJsonPath
110
+ })).sort(comparePackagePath);
111
+ return {
112
+ cwd: normalizeDir(cwd),
113
+ workspaceDir,
114
+ packages: summaries
115
+ };
116
+ }
117
+ //#endregion
118
+ export { workspace_exports as a, getWorkspacePackages as i, getWorkspaceData as n, getWorkspacePackageSummaries as r, clearWorkspaceCache as t };
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@icebreakers/monorepo",
3
3
  "type": "module",
4
- "version": "3.2.18",
5
- "description": "The icebreaker's monorepo manager",
4
+ "version": "4.0.1",
5
+ "description": "Core engine and compatibility package behind the repoctl monorepo CLI",
6
6
  "author": "ice breaker <hi@sonofmagic.top>",
7
7
  "license": "MIT",
8
8
  "homepage": "https://monorepo.icebreaker.top",
@@ -16,65 +16,73 @@
16
16
  },
17
17
  "keywords": [
18
18
  "monorepo",
19
+ "repoctl",
20
+ "tooling",
21
+ "compatibility",
19
22
  "icebreaker"
20
23
  ],
21
24
  "sideEffects": false,
22
25
  "exports": {
23
26
  ".": {
24
27
  "types": "./dist/index.d.mts",
25
- "import": {
26
- "types": "./dist/index.d.mts",
27
- "default": "./dist/index.mjs"
28
- },
29
- "require": {
30
- "types": "./dist/index.d.cts",
31
- "default": "./dist/index.cjs"
32
- }
28
+ "default": "./dist/index.mjs"
33
29
  },
34
30
  "./cli": {
35
31
  "types": "./dist/cli.d.mts",
36
- "import": {
37
- "types": "./dist/cli.d.mts",
38
- "default": "./dist/cli.mjs"
39
- },
40
- "require": {
41
- "types": "./dist/cli.d.cts",
42
- "default": "./dist/cli.cjs"
43
- }
32
+ "default": "./dist/cli.mjs"
44
33
  },
34
+ "./tooling": {
35
+ "types": "./dist/tooling-entry.d.mts",
36
+ "default": "./dist/tooling-entry.mjs"
37
+ },
38
+ "./tsconfig": "./tsconfig.base.json",
39
+ "./tsconfig.json": "./tsconfig.base.json",
45
40
  "./package.json": "./package.json"
46
41
  },
47
- "main": "./dist/index.cjs",
42
+ "main": "./dist/index.mjs",
48
43
  "module": "./dist/index.mjs",
49
44
  "types": "./dist/index.d.mts",
50
- "bin": "bin/monorepo.js",
45
+ "bin": {
46
+ "rc": "bin/rc.js",
47
+ "repo": "bin/repo.js",
48
+ "repoctl": "bin/repoctl.js",
49
+ "monorepo": "bin/monorepo.js",
50
+ "mo": "bin/mo.js"
51
+ },
51
52
  "files": [
52
53
  "bin",
53
54
  "dist",
54
- "resources"
55
+ "resources",
56
+ "tsconfig.base.json"
55
57
  ],
56
58
  "engines": {
57
59
  "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0"
58
60
  },
59
61
  "dependencies": {
60
- "@pnpm/find-workspace-dir": "^1000.1.4",
61
- "@pnpm/logger": "^1001.0.1",
62
- "@pnpm/types": "^1001.3.0",
63
- "@pnpm/worker": "^1000.6.6",
64
- "@pnpm/workspace.find-packages": "^1000.0.64",
65
- "@pnpm/workspace.read-manifest": "^1000.3.0",
66
- "c12": "^3.3.3",
67
- "comment-json": "^4.6.2",
62
+ "@icebreakers/commitlint-config": "^2.0.0",
63
+ "@icebreakers/eslint-config": "^4.0.10",
64
+ "@icebreakers/stylelint-config": "^3.0.6",
65
+ "@pnpm/find-workspace-dir": "^1000.1.5",
66
+ "@pnpm/logger": "^1100.0.0",
67
+ "@pnpm/types": "^1101.0.0",
68
+ "@pnpm/worker": "^1100.1.1",
69
+ "@pnpm/workspace.find-packages": "^1000.0.65",
70
+ "@pnpm/workspace.read-manifest": "^1000.3.1",
71
+ "c12": "^3.3.4",
72
+ "commander": "^14.0.3",
73
+ "comment-json": "^5.0.0",
68
74
  "consola": "^3.4.2",
69
75
  "git-url-parse": "^16.1.0",
70
76
  "klaw": "^4.1.0",
71
- "p-queue": "^9.1.0",
77
+ "lint-staged": "^16.4.0",
78
+ "p-queue": "^9.2.0",
72
79
  "pathe": "^2.0.3",
73
80
  "picocolors": "^1.1.1",
74
81
  "semver": "^7.7.4",
75
- "simple-git": "^3.33.0",
76
- "yaml": "^2.8.2",
77
- "@icebreakers/monorepo-templates": "0.1.16"
82
+ "simple-git": "^3.36.0",
83
+ "vitest": "~4.1.5",
84
+ "yaml": "^2.8.4",
85
+ "@icebreakers/monorepo-templates": "1.0.1"
78
86
  },
79
87
  "devDependencies": {
80
88
  "@types/klaw": "^3.0.7",
@@ -87,7 +95,8 @@
87
95
  "build": "tsdown",
88
96
  "test": "vitest run",
89
97
  "test:dev": "vitest",
90
- "typecheck": "tsc -p tsconfig.json",
98
+ "typecheck": "pnpm --filter @icebreakers/monorepo-templates build && node ../../node_modules/typescript/bin/tsc -p tsconfig.json",
99
+ "tsd": "pnpm build && tsd --files test-d/**/*.test-d.ts",
91
100
  "release": "pnpm publish",
92
101
  "lint": "eslint .",
93
102
  "lint:fix": "eslint . --fix"
@@ -1,43 +1,45 @@
1
1
  ---
2
2
  name: icebreakers-monorepo-cli
3
- description: Use when working with @icebreakers/monorepo in this pnpm/turbo monorepo. Covers CLI tasks like upgrade/up, init, sync, clean, mirror, creating new template packages (tsdown/tsup/unbuild/vitepress/etc), generating agentic prompt templates (monorepo ai create/new), and editing monorepo.config.ts defaults.
3
+ description: Use when working with repoctl or @icebreakers/monorepo in this pnpm/turbo monorepo. Covers CLI tasks like workspace upgrade/ws up, init, clean, mirror, skills sync, creating new template packages (tsdown/vitepress/etc), generating agentic prompt templates (repoctl ai prompt create / ai p new), and editing repoctl.config.ts or monorepo.config.ts defaults.
4
4
  ---
5
5
 
6
6
  # Icebreakers Monorepo Cli
7
7
 
8
8
  ## Overview
9
9
 
10
- Map user requests to the correct `monorepo` CLI command, templates, and configuration defaults.
10
+ Map user requests to the correct `repoctl` CLI command, templates, and configuration defaults.
11
+ Prefer `repoctl` in examples, allow `repo` as the short alias, and treat `rc` as a compatibility alias rather than the primary recommendation.
11
12
 
12
13
  ## Quick Workflow
13
14
 
14
15
  1. Confirm the workspace root (look for `pnpm-workspace.yaml` and `package.json`).
15
- 2. Check `monorepo.config.ts` for command defaults or overrides.
16
+ 2. Check `repoctl.config.ts` first, then `monorepo.config.ts` for command defaults or overrides.
16
17
  3. Select the task below and follow the linked reference.
17
18
 
18
19
  ## Tasks
19
20
 
20
21
  ### Create a template package
21
22
 
22
- - Use `monorepo new [path]` (alias `create`) and pick a template from `references/templates.md`.
23
- - Example: for "create a tsdown app in apps/my-app", run `npx monorepo new apps/my-app` and select `tsdown`.
24
- - For non-interactive defaults, set `commands.create.defaultTemplate` in `monorepo.config.ts`.
23
+ - Prefer `repoctl new [name]` for the guided flow and use `references/templates.md` for intent-to-template mapping.
24
+ - Use `repoctl package create [path]` (alias `pkg new`) when the user explicitly wants direct template selection.
25
+ - Example: for "create a tsdown app in apps/my-app", run `npx repoctl new my-app`, choose `library`, then choose `tsdown`.
26
+ - For non-interactive defaults, set `commands.create.defaultTemplate` in `repoctl.config.ts` or `monorepo.config.ts`.
25
27
 
26
28
  ### Upgrade or sync monorepo assets
27
29
 
28
- - Use `monorepo up` (`upgrade`) and options from `references/commands.md`.
30
+ - Prefer `repoctl upgrade`; use `repoctl workspace upgrade` (`ws up`) when matching existing scripts or user wording.
29
31
 
30
32
  ### Generate agentic prompt templates
31
33
 
32
- - Use `monorepo ai create` (`ai new`) and options from `references/commands.md`.
34
+ - Use `repoctl ai prompt create` (`ai p new`) and options from `references/commands.md`.
33
35
 
34
36
  ### Maintenance tasks
35
37
 
36
- - Use `monorepo clean`, `sync`, `mirror`, or `init` from `references/commands.md`.
38
+ - Use `repoctl init`, `check`, `clean`, `mirror`, or `skills sync` from `references/commands.md`.
37
39
  - Confirm destructive actions (clean) and note repo-wide effects.
38
40
 
39
41
  ## References
40
42
 
41
43
  - `references/commands.md` for CLI options and flags.
42
44
  - `references/templates.md` for template mapping and placement.
43
- - `references/config.md` for `monorepo.config.ts` defaults.
45
+ - `references/config.md` for `repoctl.config.ts` / `monorepo.config.ts` defaults.
@@ -1,58 +1,194 @@
1
1
  # Commands
2
2
 
3
- ## upgrade (alias: up)
3
+ ## init
4
+
5
+ Purpose: bootstrap workspace metadata plus recommended tooling defaults.
6
+ Usage:
7
+
8
+ - npx repoctl init
9
+ Options:
10
+ - --preset <minimal|standard>: choose a lighter or fuller setup
11
+ - --force: overwrite existing tooling config files
12
+ Notes:
13
+ - `standard` is the default preset
14
+ - `minimal` currently focuses on the base TypeScript setup
15
+
16
+ ## new
17
+
18
+ Purpose: create a new package or app through an intent-driven flow.
19
+ Usage:
20
+
21
+ - npx repoctl new
22
+ - npx repoctl new my-lib
23
+ Notes:
24
+ - Prompts for what you want to create first, then maps to a template
25
+ - `library` defaults to `packages/<name>`
26
+ - `web-app`, `api-service`, `docs-site`, and `cli-tool` default to `apps/<name>`
27
+ - Advanced users can still use `repoctl package create` or `repoctl pkg new`
28
+
29
+ ## check
30
+
31
+ Purpose: run recommended local checks.
32
+ Usage:
33
+
34
+ - npx repoctl check
35
+ - npx repoctl check --staged
36
+ - npx repoctl check --full
37
+ - npx repoctl check --dry-run
38
+ - npx repoctl check --json --out reports/check-plan.json
39
+ Notes:
40
+ - default mode runs the lightweight local verification flow
41
+ - `--staged` adds staged typecheck routing
42
+ - `--full` maps to the heavier pre-push verification flow
43
+ - `--dry-run` previews the verification route without running checks
44
+ - `--json` and `--out <file>` emit the same plan for automation and imply dry-run
45
+
46
+ ## doctor
47
+
48
+ Purpose: diagnose whether the current workspace is ready to use.
49
+ Usage:
50
+
51
+ - npx repoctl doctor
52
+ - npx repoctl doctor --json
53
+ - npx repoctl doctor --json --out reports/doctor.json
54
+ Notes:
55
+ - default output is human-readable
56
+ - `--json` emits the structured report only and still exits non-zero when blocking failures exist
57
+ - `--out <file>` persists the text or JSON report and still exits non-zero when blocking failures exist
58
+
59
+ ## upgrade
60
+
61
+ Purpose: sync repo assets and scripts into the workspace.
62
+ Usage:
63
+
64
+ - npx repoctl upgrade
65
+ - npx repoctl workspace upgrade
66
+ - npx repoctl ws up
67
+ Options:
68
+ - --interactive: prompt for overwrites
69
+ - --core: sync core config only (skip GitHub assets)
70
+ - --outDir <dir>: write to another directory
71
+ - --skip-overwrite: never overwrite existing files
72
+
73
+ ## workspace upgrade (alias: ws up)
4
74
 
5
75
  Purpose: sync monorepo assets and scripts into the workspace.
6
76
  Usage:
7
77
 
8
- - npx monorepo up
9
- - npx monorepo upgrade
78
+ - npx repoctl workspace upgrade
79
+ - npx repoctl ws up
10
80
  Options:
11
81
  - --interactive: prompt for overwrites
12
82
  - --core: sync core config only (skip GitHub assets)
13
83
  - --outDir <dir>: write to another directory
14
84
  - --skip-overwrite: never overwrite existing files
15
85
 
16
- ## init
86
+ ## workspace init (alias: ws init)
87
+
88
+ Purpose: initialize workspace metadata such as README, package.json, changeset, and issue template.
89
+ Usage:
90
+
91
+ - npx repoctl init
92
+ - npx repoctl workspace init
93
+ - npx repoctl ws init
17
94
 
18
- Purpose: initialize package.json and README.md.
95
+ ## workspace list (alias: ws ls)
96
+
97
+ Purpose: list workspace packages for inspection or automation.
19
98
  Usage:
20
99
 
21
- - npx monorepo init
100
+ - npx repoctl workspace list
101
+ - npx repoctl ws ls --json
102
+ - npx repoctl ws ls --json --out reports/workspaces.json
103
+ Options:
104
+ - --json: emit structured workspace summary data
105
+ - --out <file>: persist the current text or JSON output
106
+ - --include-private: include private packages
107
+ - --include-root: include the workspace root package
108
+ - --pattern <glob>: add custom workspace globs; repeatable
22
109
 
23
- ## sync
110
+ ## tooling init (alias: tg init)
24
111
 
25
- Purpose: sync workspace packages to npmmirror.
112
+ Purpose: generate tooling config files plus matching devDependencies.
26
113
  Usage:
27
114
 
28
- - npx monorepo sync
115
+ - npx repoctl tooling init
116
+ - npx repoctl tooling init eslint tsconfig vitest
117
+ - npx repoctl tg init --all
118
+ Options:
119
+ - --all: generate every built-in tooling config
120
+ - --force: overwrite existing tooling config files
121
+ Notes:
122
+ - Built-in tooling targets: commitlint, eslint, stylelint, lint-staged, tsconfig, vitest
123
+ - Generated files also update root package.json devDependencies
29
124
 
30
- ## clean
125
+ ## workspace clean (alias: ws clean)
31
126
 
32
- Purpose: remove selected packages and update the @icebreakers/monorepo version.
127
+ Purpose: remove selected packages and update the repo helper package version.
33
128
  Usage:
34
129
 
35
- - npx monorepo clean
130
+ - npx repoctl workspace clean
131
+ - npx repoctl ws clean
36
132
  Options:
37
133
  - --yes: auto confirm
38
134
  - --include-private
39
135
  - --pinned-version <version>
40
136
 
41
- ## mirror
137
+ ## env info (alias: e i)
138
+
139
+ Purpose: print environment details for debugging and automation.
140
+ Usage:
141
+
142
+ - npx repoctl env info
143
+ - npx repoctl e i --json
144
+ - npx repoctl env info --json --out reports/env.json
145
+ Options:
146
+ - --json: emit structured environment info
147
+ - --out <file>: persist the current text or JSON output
148
+ Notes:
149
+ - Includes cwd, workspace root, package manager, Node version, pnpm version,
150
+ platform, arch, and workspace package count.
151
+
152
+ ## env snapshot (alias: e s)
153
+
154
+ Purpose: collect a combined debugging snapshot for issues, CI artifacts, or editor integrations.
155
+ Usage:
156
+
157
+ - npx repoctl env snapshot
158
+ - npx repoctl e s --json
159
+ - npx repoctl env snapshot --json --out reports/snapshot.json
160
+ Options:
161
+ - --json: emit structured snapshot data
162
+ - --out <file>: persist the current text or JSON output
163
+ Notes:
164
+ - Includes `env info`, `doctor` report data, and the default `check` plan.
165
+
166
+ ## env mirror (alias: e m)
42
167
 
43
168
  Purpose: set VSCode binary mirror env.
44
169
  Usage:
45
170
 
46
- - npx monorepo mirror
171
+ - npx repoctl env mirror
172
+ - npx repoctl e m
173
+
174
+ ## skills sync
175
+
176
+ Purpose: sync built-in skill files into global Codex or Claude directories.
177
+ Usage:
178
+
179
+ - npx repoctl skills sync
180
+ - npx repoctl skills sync --codex
181
+ - npx repoctl skills sync --claude
182
+ - npx repoctl skills sync --all
47
183
 
48
- ## ai create (alias: ai new)
184
+ ## ai prompt create (aliases: ai p create, ai p new)
49
185
 
50
186
  Purpose: generate agentic prompt templates.
51
187
  Usage:
52
188
 
53
- - npx monorepo ai create
54
- - npx monorepo ai create --name checkout
55
- - npx monorepo ai create --tasks agentic/tasks.json --format md -f
189
+ - npx repoctl ai prompt create
190
+ - npx repoctl ai p new --name checkout
191
+ - npx repoctl ai prompt create --tasks agentic/tasks.json --format md -f
56
192
  Options:
57
193
  - --output <path>
58
194
  - --force
@@ -65,11 +201,20 @@ Usage:
65
201
  agentic/prompts/<timestamp>/prompt.md.
66
202
  - If --tasks is used, it expects a JSON array of strings or objects.
67
203
 
68
- ## new (alias: create)
204
+ ## package create (alias: pkg new)
69
205
 
70
206
  Purpose: create a new package from a template.
71
207
  Usage:
72
208
 
73
- - npx monorepo new [path]
209
+ - npx repoctl new
210
+ - npx repoctl package create [path]
211
+ - npx repoctl pkg new [path]
74
212
  Notes:
75
- - Prompts for a template choice unless defaults are set in monorepo.config.ts.
213
+ - Prefer `repoctl new` for the lower-cost guided flow.
214
+ - Prompts for a template choice unless defaults are set in repoctl.config.ts or monorepo.config.ts.
215
+ - Explicit `--template` values are validated before writing files. Unknown keys
216
+ fail with the closest suggestion instead of silently falling back.
217
+ - Use `--json` to print the resolved create plan for automation. It implies
218
+ `--dry-run` and does not write files.
219
+ - Add `--out <file>` to write the preview or JSON plan to disk. It also implies
220
+ `--dry-run`.
@@ -1,4 +1,14 @@
1
- # monorepo.config.ts
1
+ # repoctl.config.ts
2
+
3
+ Preferred filename: `repoctl.config.ts`
4
+
5
+ Compatible legacy filename: `monorepo.config.ts`
6
+
7
+ Rule:
8
+
9
+ - `repoctl.config.*` has higher priority
10
+ - `monorepo.config.*` remains supported
11
+ - if both exist at the same time, CLI loading fails fast with an error
2
12
 
3
13
  Use `defineMonorepoConfig` to set default options for CLI commands.
4
14
  Only include the fields you need.
@@ -6,7 +16,7 @@ Only include the fields you need.
6
16
  Example:
7
17
 
8
18
  ```ts
9
- import { defineMonorepoConfig } from '@icebreakers/monorepo'
19
+ import { defineMonorepoConfig } from 'repoctl'
10
20
 
11
21
  export default defineMonorepoConfig({
12
22
  commands: {
@@ -27,14 +37,9 @@ export default defineMonorepoConfig({
27
37
  includePrivate: true,
28
38
  pinnedVersion: 'latest',
29
39
  },
30
- sync: {
31
- concurrency: 4,
32
- command: 'cnpm sync {name}',
33
- patterns: ['apps/*', 'packages/*', 'templates/*'],
34
- },
35
40
  upgrade: {
36
41
  skipOverwrite: false,
37
- targets: ['.github', 'monorepo.config.ts'],
42
+ targets: ['.github', 'repoctl.config.ts'],
38
43
  mergeTargets: true,
39
44
  },
40
45
  init: {
@@ -57,7 +62,6 @@ Key areas:
57
62
  - ai: default output, format, batch tasks
58
63
  - create: default template and template directory
59
64
  - clean: auto confirm and pinned version control
60
- - sync: workspace selection and concurrency
61
65
  - upgrade: overwrite behavior and extra targets
62
66
  - init: skip steps for README/package.json/changeset
63
67
  - mirror: add or override env mirrors
@@ -1,13 +1,38 @@
1
1
  # Templates
2
2
 
3
- `monorepo new [path]` copies a template into the target path. If you want an app
4
- under `apps/`, pass the path explicitly, e.g. `apps/my-app`.
3
+ Prefer `repo new [name]` for the guided flow. It first asks what you want to
4
+ create, then maps that intent to a template and default target directory.
5
+
6
+ Intent defaults:
7
+
8
+ - library -> `tsdown` -> `packages/<name>`
9
+ - web-app -> `vue-hono` -> `apps/<name>`
10
+ - api-service -> `hono-server` -> `apps/<name>`
11
+ - docs-site -> `vitepress` -> `apps/<name>`
12
+ - cli-tool -> `cli` -> `apps/<name>`
13
+
14
+ Run `repo templates` to discover template keys, categories, default targets, and
15
+ descriptions. Use `repo templates <key>` for a single template detail page, and
16
+ `repo templates --json` when scripting. Use `repo templates --check` to verify
17
+ template metadata, directories, package.json files, duplicate targets, and
18
+ temporary files; combine it with `--json` for CI. Use `repo templates --markdown`
19
+ or `repo templates <key> --markdown` when generating documentation snippets.
20
+ Add `--out <file>` to write the selected output to disk.
21
+
22
+ Use `repo new <name> --template <key> --dry-run` to preview the target directory
23
+ and package metadata without writing files. Use `repo new <name> --template <key>
24
+ --json` when a script needs the same create plan as structured data; `--json`
25
+ implies `--dry-run`. Add `--out <file>` to write either preview format to disk.
26
+
27
+ Explicit template keys are validated before any files are written. If a key is
28
+ misspelled, the CLI fails and prints the closest known key when one is available.
29
+
30
+ Advanced users can still use `repo package create [path]` or `repo pkg new [path]`
31
+ to select templates directly.
5
32
 
6
33
  Built-in template map:
7
34
 
8
- - tsup -> templates/tsup => packages/tsup
9
35
  - tsdown -> templates/tsdown => packages/tsdown
10
- - unbuild -> templates/unbuild => packages/unbuild
11
36
  - vue-lib -> templates/vue-lib => packages/vue-lib
12
37
  - hono-server -> templates/server => apps/server
13
38
  - vue-hono -> templates/client => apps/client
@@ -17,5 +42,5 @@ Built-in template map:
17
42
  Notes:
18
43
 
19
44
  - The command prompts for template selection unless defaults are set in
20
- monorepo.config.ts.
45
+ repoctl.config.ts or monorepo.config.ts.
21
46
  - Override mappings with `commands.create.templateMap` and `commands.create.templatesDir`.
@@ -0,0 +1,23 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "ESNext",
5
+ "moduleResolution": "Bundler",
6
+ "resolveJsonModule": true,
7
+ "types": [
8
+ "node",
9
+ "vitest/globals"
10
+ ],
11
+ "allowJs": true,
12
+ "strict": true,
13
+ "ignoreDeprecations": "6.0",
14
+ "exactOptionalPropertyTypes": true,
15
+ "noImplicitOverride": true,
16
+ "noPropertyAccessFromIndexSignature": true,
17
+ "noUncheckedIndexedAccess": true,
18
+ "noEmit": true,
19
+ "allowSyntheticDefaultImports": true,
20
+ "esModuleInterop": true,
21
+ "skipLibCheck": true
22
+ }
23
+ }