From f552c19f32b3ad675d5c61a9a45d90dcfd0f4b53 Mon Sep 17 00:00:00 2001 From: yanghl Date: Fri, 29 May 2026 14:56:55 +0800 Subject: [PATCH] refactor(skills): 后端构建工具从 Maven 整体切换为 Gradle 最新版 --- README.md | 4 ++-- skills/coding/feature-plan/SKILL.md | 2 +- skills/coding/feature-tdd/SKILL.md | 2 +- skills/coding/feature-verify/SKILL.md | 2 +- skills/plan/project-init/templates/CLAUDE-template.md | 2 +- skills/plan/project-init/templates/docs-04-stack-template.md | 2 +- skills/plan/skeleton-gen/templates/gitignore-append-template | 5 +++-- 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index a75d5f7..0f99c5b 100644 --- a/README.md +++ b/README.md @@ -309,9 +309,9 @@ step 0 流程图被抽到独立 `.txt` 文件,SKILL.md 步骤 0 改为 `bash cat - **MySQL 8.x** 实例已就绪(推荐本地 / `*.local` host;A4 `db-init` 的安全守护要求 host 在白名单且 schema 名含 `test`/`dev`/`local`,避免误删生产库) - **`mysql` 命令行**:A4 `db-init` 验证连接 + 自动 `DROP+CREATE` schema 后 apply V1;`scripts/setup-test-db.sh` 在测试闸门前后 drop+create 空库 -- **Spring Boot + Flyway**(**必需**):pom.xml 声明 `flyway-core` + `flyway-mysql`;Spring 启动时自动 apply `sql/migrations/V*.sql`。本插件生成的 `setup-test-db.sh` 只清库,schema 必须由 Flyway 应用 +- **Spring Boot + Flyway**(**必需**):`build.gradle.kts` 声明 `flyway-core` + `flyway-mysql`;Spring 启动时自动 apply `sql/migrations/V*.sql`。本插件生成的 `setup-test-db.sh` 只清库,schema 必须由 Flyway 应用 - **本地 git 仓库**(纯本地,无需远程):A0 `project-init` 执行 `git init`;B 阶段每模块由 `milestone-tag` 本地 `git merge --no-ff` 进默认分支并 `git tag -a milestone/`,完成信号由 `git tag -l` 判定。**不依赖任何远程仓库 / push / GitLab** -- **本地可运行 `mvn test` / `pnpm test`**:测试闸门 `scripts/test.sh` 由 `skeleton-gen` 生成 +- **本地可运行 `./gradlew test` / `pnpm test`**:测试闸门 `scripts/test.sh` 由 `skeleton-gen` 生成 ## 设计原则 diff --git a/skills/coding/feature-plan/SKILL.md b/skills/coding/feature-plan/SKILL.md index b5e153c..57f12c5 100644 --- a/skills/coding/feature-plan/SKILL.md +++ b/skills/coding/feature-plan/SKILL.md @@ -17,7 +17,7 @@ allowed-tools: Read Write Grep Skill AskUserQuestion - Plan 告诉 TDD 执行者**做什么**,不是**怎么写代码**——执行者是 `feature-tdd`(同一模型,全上下文),不是机械复制粘贴员 - Plan 锁定**文件边界 + 测试意图 + API 形状 + 完成判据**;代码由 TDD 红绿循环产出 -- **禁止 dump 整个文件内容**(pom.xml / entity 类 / config 文件)到 plan——plan 和代码会成为两个 source of truth 并漂移;2000+ 行 plan 浪费上下文 +- **禁止 dump 整个文件内容**(build.gradle.kts / entity 类 / config 文件)到 plan——plan 和代码会成为两个 source of truth 并漂移;2000+ 行 plan 浪费上下文 - DRY、YAGNI、TDD、frequent commits ## 占位符规则 diff --git a/skills/coding/feature-tdd/SKILL.md b/skills/coding/feature-tdd/SKILL.md index edfff42..093578e 100644 --- a/skills/coding/feature-tdd/SKILL.md +++ b/skills/coding/feature-tdd/SKILL.md @@ -32,7 +32,7 @@ allowed-tools: Read Write Edit Agent Skill Bash(git add *) Bash(git commit *) ## 护栏 -- **绝不**在主会话直接跑 `mvn test` / `pnpm test` / `scripts/test.sh`,必须通过子会话 +- **绝不**在主会话直接跑 `./gradlew test` / `pnpm test` / `scripts/test.sh`,必须通过子会话 - **绝不**在主会话直接 `mysql -e "ALTER ..."`;业务 schema 改动一律走 `sql/migrations/V*.sql` 文件(只读查询 / 临时调试除外) - 每次 commit 必须含 `REQ-XXX-NNN` 标签;不混合无关改动到同一 commit - **后端阶段路径硬护栏**:任务表里的 `impl_file` 路径以 `frontend/` 开头 → 硬停并打印 `feature-tdd 后端阶段不允许写前端代码:。请检查 plan 任务定义;UI 推迟到前端阶段(fe-feature-*)`,不再继续 TDD 循环 diff --git a/skills/coding/feature-verify/SKILL.md b/skills/coding/feature-verify/SKILL.md index d9c56f6..1553b5b 100644 --- a/skills/coding/feature-verify/SKILL.md +++ b/skills/coding/feature-verify/SKILL.md @@ -13,7 +13,7 @@ allowed-tools: Skill Read Agent ## 执行步骤 -1. 从 plan 文件或项目标准命令中确定功能的测试目标(如 Maven profile / pnpm script / pytest path)。 +1. 从 plan 文件或项目标准命令中确定功能的测试目标(如 Gradle task / pnpm script / pytest path)。 2. 派发 Agent 子会话(general-purpose)运行该目标,子会话只返回结构化 JSON(不输出描述文字): ```json { diff --git a/skills/plan/project-init/templates/CLAUDE-template.md b/skills/plan/project-init/templates/CLAUDE-template.md index f5c646f..0e6937e 100644 --- a/skills/plan/project-init/templates/CLAUDE-template.md +++ b/skills/plan/project-init/templates/CLAUDE-template.md @@ -138,7 +138,7 @@ B 阶段分两段,**全部固化到 skills**。入口:`/erp-workflow:coding- 1. **文件命名**:`sql/migrations/V__.sql`,例:`V5__add_user_email_unique_index.sql` 2. **版本号分配**:建文件前 `ls sql/migrations/V*.sql` 查当前最大 n,新文件 `n_max + 1` -3. **Apply 方式**:Spring Boot 启动 / 测试启动时 Flyway 自动 apply(项目必须在 `pom.xml` 声明 `flyway-core` + `flyway-mysql` 依赖)。`scripts/setup-test-db.sh` 只负责清空库,不做 apply +3. **Apply 方式**:Spring Boot 启动 / 测试启动时 Flyway 自动 apply(项目必须在 `build.gradle.kts` 声明 `flyway-core` + `flyway-mysql` 依赖)。`scripts/setup-test-db.sh` 只负责清空库,不做 apply 4. **已合并的 migration 永不修改**:发现错了写一个补救 migration(如 `V7__fix_V5_index_name.sql`),旧 `V_n.sql` 5. **临时调试 DDL**:临时在本地试字段/索引可手动 `mysql -e`,但不写 migration;下次 `setup-test-db.sh` 会 drop+create 清掉 6. **A4 生成的 V1**:`V1__initial_schema.sql` 是 A 阶段由 `db-init` 从 `docs/03-数据库设计文档.md`(A3 正向设计的 schema SSoT)翻译生成的初始版本;后续 V2/V3/... 由 B 阶段每个 REQ 按需写入,**同时**反向同步更新 docs/03 对应表小节以保持 SSoT 一致 diff --git a/skills/plan/project-init/templates/docs-04-stack-template.md b/skills/plan/project-init/templates/docs-04-stack-template.md index 234b200..1570982 100644 --- a/skills/plan/project-init/templates/docs-04-stack-template.md +++ b/skills/plan/project-init/templates/docs-04-stack-template.md @@ -21,7 +21,7 @@ | 接口风格 | RESTful API | 统一规范 | 前后端接口设计规范 | | 权限认证 | Spring Security / JWT | 最新稳定版 | 登录认证、权限控制 | | API 文档 | OpenAPI / Swagger | 最新稳定版 | 接口文档与调试 | -| 项目构建管理 | Maven | 3.9.x | Java 项目依赖与构建 | +| 项目构建管理 | Gradle (Kotlin DSL) | 最新稳定版(8.x / 9.x) | Java 项目依赖与构建;统一用 Gradle Wrapper (`./gradlew`),构建脚本 `build.gradle.kts` | | JDK 运行环境 | Java | 17 / 21 | Spring Boot 3 推荐版本 | | 部署容器 | Docker | 最新稳定版 | 容器化部署 | | Web 服务器 / 反向代理 | Nginx | 最新稳定版 | 前端托管、反向代理、负载分发 | diff --git a/skills/plan/skeleton-gen/templates/gitignore-append-template b/skills/plan/skeleton-gen/templates/gitignore-append-template index ac39aa6..72d64d5 100644 --- a/skills/plan/skeleton-gen/templates/gitignore-append-template +++ b/skills/plan/skeleton-gen/templates/gitignore-append-template @@ -3,8 +3,9 @@ .env.local .env.*.local -# Java / Maven -target/ +# Java / Gradle +.gradle/ +build/ *.class # Node / 前端构建产物 -- libgit2 0.22.2