diff --git a/.claude/skills/pro-upgrade/SKILL.md b/.claude/skills/pro-upgrade/SKILL.md index e58b09aa..315f4cf5 100644 --- a/.claude/skills/pro-upgrade/SKILL.md +++ b/.claude/skills/pro-upgrade/SKILL.md @@ -29,7 +29,7 @@ You are an Ant Design Pro upgrade assistant. Your task is to help users upgrade Before starting, confirm: 1. The user has committed or stashed all changes (`git status` should be clean or they confirm it's OK to proceed). -2. If not clean, remind them: **"请先 commit 或 stash 你的更改,升级过程会修改多个文件。"** and wait for them to confirm. +2. If not clean, remind them to commit or stash their changes first (e.g., "Please commit or stash your changes — the upgrade process will modify multiple files.") and wait for them to confirm. ## Upgrade Flow @@ -72,7 +72,7 @@ Separate the user's project files into **framework files** (Pro-owned, rarely cu - `src/pages/**` — user pages - `src/components/**` — user components - `src/models/**` — user models -- `src/services/*.ts` — custom service files (NOT the `ant-design-pro/` subdirectory) +- `src/services/**/*.ts` — custom service files (NOT the `ant-design-pro/` subdirectory) - `src/locales/**` — user translations (framework keys may need updating) - `src/utils/**` — user utilities - `mock/**` — user mocks @@ -93,7 +93,7 @@ For each framework file, read both the user's version and the template version. Apply changes with these rules: **Framework files — adopt template structure, preserve user customizations:** -- `package.json`: update dependency versions to match template. Keep any extra deps the user added. Remove deps only if the template explicitly removed them (check the template's `package.json`). +- `package.json`: update dependency versions to match template. Keep any extra deps the user added. If a dependency exists in the user's project but not in the template, assume it is a user customization and preserve it. - `config/routes.ts`: adopt the template's route structure for framework pages, but keep all user-added routes intact. - `config/proxy.ts`: adopt structure, preserve user's proxy targets. - Other framework files: adopt the template version, preserving any user customizations that are clearly intentional (comments, extra exports, business logic mixed in). @@ -115,12 +115,14 @@ npx antd env --format json npx antd lint ./src --format json --only deprecated ``` -If the user is upgrading across major antd versions (e.g., 5→6), also run: +If the user is upgrading across major antd versions, also run: ```bash -npx antd migrate 5 6 --format json +npx antd migrate --format json ``` +Detect the current major version from the user's `package.json` and the target from the template's. + Address any findings by updating the flagged code. ### Step 6 — Install and verify diff --git a/docs/cheatsheet.en-US.md b/docs/cheatsheet.en-US.md index 3d82a22a..639fa394 100644 --- a/docs/cheatsheet.en-US.md +++ b/docs/cheatsheet.en-US.md @@ -497,7 +497,7 @@ First, install the pro-upgrade skill into your project: ```bash npx skills add ant-design/ant-design-pro ``` -Then run `/pro-upgrade` in Claude Code at the project root — AI will auto-diff the latest template and upgrade your project (deps, config, code patterns, etc.). For other AI assistants, paste the content of `.claude/skills/pro-upgrade/SKILL.md` to them. +Then run `/pro-upgrade` in Claude Code at the project root — AI will auto-diff the latest template and assist your upgrade (deps, config, code patterns, etc.), with conservative handling for ambiguous merges. For other AI assistants, paste the content of `.claude/skills/pro-upgrade/SKILL.md` to them. **Q: How to deploy?** `npm run build` generates `dist/`. Deploy to any static file server. Set `publicPath` for non-root deployments. `npm run deploy` builds and publishes to GitHub Pages automatically (pushes to gh-pages branch). diff --git a/docs/cheatsheet.zh-CN.md b/docs/cheatsheet.zh-CN.md index b5a4b81b..753d6620 100644 --- a/docs/cheatsheet.zh-CN.md +++ b/docs/cheatsheet.zh-CN.md @@ -497,7 +497,7 @@ export default { ```bash npx skills add ant-design/ant-design-pro ``` -然后在项目根目录用 Claude Code 运行 `/pro-upgrade`,AI 会自动对比最新模板并完成升级(依赖、配置、代码模式等)。如使用其他 AI 助手,可将 `.claude/skills/pro-upgrade/SKILL.md` 中的内容提供给它。 +然后在项目根目录用 Claude Code 运行 `/pro-upgrade`,AI 会自动对比最新模板并辅助完成升级(依赖、配置、代码模式等),遇到冲突时会保守处理并询问确认。如使用其他 AI 助手,可将 `.claude/skills/pro-upgrade/SKILL.md` 中的内容提供给它。 **Q: 如何部署?** `npm run build` 生成 `dist/` 目录,部署到任意静态服务器。配置 `publicPath` 处理非根目录部署。`npm run deploy` 会自动构建并发布到 GitHub Pages(推送到 gh-pages 分支)。