Browse Source

fix(builder): 修改项目初始化默认路径配置

- 将项目初始化默认路径从 ./ddd4j-project/ 改为当前执行目录
- 使用 artifactId 作为项目根目录名称
- 更新 README.md 中的输出位置说明
- 修改 SKILL.md 中的默认保存位置描述
- 调整响应结构中的路径提示信息
- 确保项目结构直接创建在命令执行的同级目录下
wandl-6A72h 8 months ago
parent
commit
3062ea2b65

+ 2 - 1
README.md

@@ -357,7 +357,8 @@ DDD(领域驱动设计)项目初始化和目录规范检查技能。支持
   - 生成详细的验证报告
 
 **输出位置:**
-- 所有生成的项目文件保存在 `./ddd4j-project/` 目录下
+- 所有生成的项目文件直接保存在命令执行的同级目录下
+- 项目根目录名称使用 artifactId(例如:`ddd4j-order`、`ddd4j-douyin`)
 
 **参考文档:**
 - 技能内置了完整的架构文档(docs/ 目录):

+ 10 - 8
skills/ddd4j-project-builder/SKILL.md

@@ -77,8 +77,8 @@ Use this skill whenever you need to:
    - Create basic directory structure with `src/main/java` and `src/test/java`
 
 5. **Save to project directory**:
-   - **Default location**: Save to `./ddd4j-project/` directory in the command execution directory
-   - **Directory creation**: Automatically create the directory if it doesn't exist
+   - **Default location**: Save directly to the command execution directory (same level as the command)
+   - **Directory creation**: Automatically create the project directory structure if it doesn't exist
    - **File naming**: Use descriptive names based on project type and module names
 
 ### For Existing Project Validation
@@ -110,24 +110,26 @@ Use this skill whenever you need to:
 
 When generating a project structure, follow this response structure:
 
-1. **Save the files first**: Create the project structure in `./ddd4j-project/` directory
-   - Create the `./ddd4j-project/` directory if it doesn't exist
-   - Generate all required files and directories
+1. **Save the files first**: Create the project structure directly in the command execution directory
+   - The project will be created at the same level as where the command is executed
+   - Generate all required files and directories (pom.xml, src/, etc.)
+   - Use the artifactId as the project root directory name
 
 2. **Inform the user**: Tell them where the files were saved
 
 3. **Display the structure**: Show the generated directory structure in a code block
 
 **Example Response Structure**:
-- First line: "I've created the DDD project structure and saved it to `./ddd4j-project/{project-name}/`."
+- First line: "I've created the DDD project structure and saved it to `./{artifactId}/` in the current directory."
 - Then show the structure wrapped in a code block:
   - Start with: three backticks + `text` + newline
   - Then the directory structure
   - End with: three backticks + newline
 
 **Critical Requirements**:
-- Always save project files to `./ddd4j-project/` directory in the command execution directory
-- Create the directory automatically if it doesn't exist
+- Always save project files directly to the command execution directory (same level)
+- Use artifactId as the project root directory name
+- Create the directory structure automatically if it doesn't exist
 - Generate complete project structure with all required files
 - Follow Maven and DDD conventions strictly
 

+ 2 - 2
skills/ddd4j-project-builder/scripts/init_project.py

@@ -18,8 +18,8 @@ from typing import Dict, List, Optional
 class DDDProjectInitializer:
     """DDD Project Initializer"""
     
-    def __init__(self, project_dir: str = "./ddd4j-project"):
-        self.project_dir = Path(project_dir)
+    def __init__(self, project_dir: str = "."):
+        self.project_dir = Path(project_dir).resolve()
         self.project_dir.mkdir(parents=True, exist_ok=True)
     
     def init_single_module(