Skip to content

Commit 2da32fa

Browse files
committed
feat: 新增 monorepo CLI 的 Codex skill 与参考文档
1 parent 90bb1d6 commit 2da32fa

File tree

7 files changed

+355
-148
lines changed

7 files changed

+355
-148
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@icebreakers/monorepo": patch
3+
---
4+
5+
新增 monorepo CLI 的 Codex skill 与参考文档。

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"@commitlint/cli": "^20.3.1",
5050
"@icebreakers/changelog-github": "^0.1.0",
5151
"@icebreakers/commitlint-config": "^1.2.5",
52-
"@icebreakers/eslint-config": "^1.6.12",
52+
"@icebreakers/eslint-config": "^1.6.13",
5353
"@icebreakers/monorepo": "workspace:*",
5454
"@icebreakers/stylelint-config": "^1.2.5",
5555
"@types/fs-extra": "^11.0.4",
@@ -75,7 +75,7 @@
7575
"tsup": "^8.5.1",
7676
"tsx": "^4.21.0",
7777
"turbo": "^2.7.4",
78-
"type-fest": "^5.4.0",
78+
"type-fest": "^5.4.1",
7979
"typescript": "^5.9.3",
8080
"unbuild": "^3.6.1",
8181
"vitest": "~4.0.17",

pnpm-lock.yaml

Lines changed: 146 additions & 146 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
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.
4+
---
5+
6+
# Icebreakers Monorepo Cli
7+
8+
## Overview
9+
10+
Map user requests to the correct `monorepo` CLI command, templates, and configuration defaults.
11+
12+
## Quick Workflow
13+
14+
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+
3. Select the task below and follow the linked reference.
17+
18+
## Tasks
19+
20+
### Create a template package
21+
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`.
25+
26+
### Upgrade or sync monorepo assets
27+
28+
- Use `monorepo up` (`upgrade`) and options from `references/commands.md`.
29+
30+
### Generate agentic prompt templates
31+
32+
- Use `monorepo ai create` (`ai new`) and options from `references/commands.md`.
33+
34+
### Maintenance tasks
35+
36+
- Use `monorepo clean`, `sync`, `mirror`, or `init` from `references/commands.md`.
37+
- Confirm destructive actions (clean) and note repo-wide effects.
38+
39+
## References
40+
41+
- `references/commands.md` for CLI options and flags.
42+
- `references/templates.md` for template mapping and placement.
43+
- `references/config.md` for `monorepo.config.ts` defaults.
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Commands
2+
3+
## upgrade (alias: up)
4+
5+
Purpose: sync monorepo assets and scripts into the workspace.
6+
Usage:
7+
8+
- npx monorepo up
9+
- npx monorepo upgrade
10+
Options:
11+
- --interactive: prompt for overwrites
12+
- --core: sync core config only (skip GitHub assets)
13+
- --outDir <dir>: write to another directory
14+
- --skip-overwrite: never overwrite existing files
15+
16+
## init
17+
18+
Purpose: initialize package.json and README.md.
19+
Usage:
20+
21+
- npx monorepo init
22+
23+
## sync
24+
25+
Purpose: sync workspace packages to npmmirror.
26+
Usage:
27+
28+
- npx monorepo sync
29+
30+
## clean
31+
32+
Purpose: remove selected packages and update the @icebreakers/monorepo version.
33+
Usage:
34+
35+
- npx monorepo clean
36+
Options:
37+
- --yes: auto confirm
38+
- --include-private
39+
- --pinned-version <version>
40+
41+
## mirror
42+
43+
Purpose: set VSCode binary mirror env.
44+
Usage:
45+
46+
- npx monorepo mirror
47+
48+
## ai create (alias: ai new)
49+
50+
Purpose: generate agentic prompt templates.
51+
Usage:
52+
53+
- npx monorepo ai create
54+
- npx monorepo ai create --name checkout
55+
- npx monorepo ai create --tasks agentic/tasks.json --format md -f
56+
Options:
57+
- --output <path>
58+
- --force
59+
- --format <md|json>
60+
- --dir <path>
61+
- --name <name>
62+
- --tasks <file>
63+
Notes:
64+
- If no --output or --name is set, it prompts for a folder and writes to
65+
agentic/prompts/<timestamp>/prompt.md.
66+
- If --tasks is used, it expects a JSON array of strings or objects.
67+
68+
## new (alias: create)
69+
70+
Purpose: create a new package from a template.
71+
Usage:
72+
73+
- npx monorepo new [path]
74+
Notes:
75+
- Prompts for a template choice unless defaults are set in monorepo.config.ts.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# monorepo.config.ts
2+
3+
Use `defineMonorepoConfig` to set default options for CLI commands.
4+
Only include the fields you need.
5+
6+
Example:
7+
8+
```ts
9+
import { defineMonorepoConfig } from '@icebreakers/monorepo'
10+
11+
export default defineMonorepoConfig({
12+
commands: {
13+
ai: {
14+
baseDir: 'agentic/prompts',
15+
format: 'md',
16+
force: false,
17+
tasksFile: 'agentic/tasks.json',
18+
},
19+
create: {
20+
defaultTemplate: 'tsdown',
21+
renameJson: false,
22+
templatesDir: 'packages/monorepo/templates',
23+
},
24+
clean: {
25+
autoConfirm: false,
26+
ignorePackages: ['docs'],
27+
includePrivate: true,
28+
pinnedVersion: 'latest',
29+
},
30+
sync: {
31+
concurrency: 4,
32+
command: 'cnpm sync {name}',
33+
patterns: ['apps/*', 'packages/*'],
34+
},
35+
upgrade: {
36+
skipOverwrite: false,
37+
targets: ['.github', 'monorepo.config.ts'],
38+
mergeTargets: true,
39+
},
40+
init: {
41+
skipReadme: false,
42+
skipPkgJson: false,
43+
skipChangeset: false,
44+
skipIssueTemplateConfig: false,
45+
},
46+
mirror: {
47+
env: {
48+
VSCode_CLI_MIRROR: 'https://example.invalid',
49+
},
50+
},
51+
},
52+
})
53+
```
54+
55+
Key areas:
56+
57+
- ai: default output, format, batch tasks
58+
- create: default template and template directory
59+
- clean: auto confirm and pinned version control
60+
- sync: workspace selection and concurrency
61+
- upgrade: overwrite behavior and extra targets
62+
- init: skip steps for README/package.json/changeset
63+
- mirror: add or override env mirrors
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Templates
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`.
5+
6+
Built-in template map:
7+
8+
- tsup -> packages/tsup-template
9+
- tsdown -> packages/tsdown-template
10+
- unbuild -> packages/unbuild-template
11+
- vue-lib -> packages/vue-lib-template
12+
- hono-server -> apps/server
13+
- vue-hono -> apps/client
14+
- vitepress -> apps/website
15+
- cli -> apps/cli
16+
17+
Notes:
18+
19+
- The command prompts for template selection unless defaults are set in
20+
monorepo.config.ts.
21+
- Override mappings with `commands.create.templateMap` and `commands.create.templatesDir`.

0 commit comments

Comments
 (0)