@yorha2b-lab/autodev 1.1.0 → 2.0.0

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.
package/README.md CHANGED
@@ -15,19 +15,18 @@
15
15
  <video src="https://github.com/user-attachments/assets/6d42fce1-c815-482b-8c6a-4a3b9415ba47.mp4" controls="controls" muted="muted" style="max-width: 100%; display: block; margin: 20px auto;">
16
16
  </video>
17
17
 
18
- 拒绝重复劳动!为什么你需要 Auto CRUD Copilot?
19
- 告别手写 Table/Form:截图即代码,提升你的开发效率,告别烦人的复制粘贴。
20
- 拒绝接口联调痛苦:自动读取 Response,AI 帮你抹平前后端字段命名差异。
21
- 架构解耦:核心逻辑与 UI 框架分离,React/Vue/Angular 均可适配。
18
+ ## 💡 为什么选择 2.0 版本?
19
+ 在 2.0 时代,我们放弃了繁琐的分散指令,全面进化为 “全频道集成指挥中心”
20
+ - 全频道联动:不再需要开启多个进程。一个 watch 指令,同时监听 页面、组件、API 三大传感器。
21
+ - 语义化骇入:不仅仅是复刻 UI,通过 9S 专用语义桥接协议,自动抹平前后端字段差异。
22
+ - 工程级质量:生成的代码不是“演示用”,而是带 useTableQuery、EditableCell、OSS上传 等实战逻辑的高质量代码。
22
23
 
23
24
  ## ✨ 特性
24
25
 
25
- - 🖼️ **视觉识别**: 通过截图自动识别页面结构,生成对应的CRUD代码
26
- - 🔧 **智能生成**: 支持React、Vue、Angular等多种前端框架模板
27
- - 📊 **表格组件**: 自动生成可编辑、可排序、可筛选的数据表格
28
- - 📝 **表单组件**: 智能生成搜索表单和模态框表单
29
- - 🔌 **API对齐**: 自动对齐Response接口与前端字段映射
30
- - 🎨 **UI组件**: 支持多种UI组件类型(输入框、选择器、日期等)
26
+ - 🖼️ 视觉构筑 (Page): 截图丢入 screenShot,Pod 042 自动生成带 Table/Form/Tabs 的完整 CRUD 页面。
27
+ - 🧩 碎片提取 (Part): 局部截图丢入 screenPart,终端瞬间弹出“即插即用”的 UI 配置片段。
28
+ - 🔌 语义对齐 (API): 接口 JSON 丢入 response,自动修正前端字段名,达成前后端 100% 协议一致。
29
+ - 🔧 智能装配: 自动补全 import 语句,处理日期格式转换、金额千分位、上传授权等所有脏活累活。
31
30
  - 📱 **响应式**: 生成的代码支持响应式布局
32
31
 
33
32
  ## 🚀 快速开始
@@ -40,18 +39,15 @@ npm install -g @yorha2b-lab/autodev
40
39
 
41
40
  ### 环境配置
42
41
 
43
- 快速开始
44
-
45
42
  ```bash
46
43
  autodev init
47
44
  ```
48
45
 
49
46
  > ### 💡 零配置快速体验 (模拟模式)
50
- > 为了能立即感受到 Bunker 的构筑力量,项目默认开启了 **Demo 模式**:
51
- > 1. **无需配置 API_KEY**,直接运行 `autodev watch:page`。
47
+ > 项目默认开启 Demo 模式:
48
+ > 1. **无需配置 API_KEY**,直接运行 `autodev watch`。
52
49
  > 2. 向 `screenShot` 目录丢入任意图片(系统将忽略图片内容,自动空投标准 `example.json` 构筑包)。
53
50
  > 3. **观察效果**:你会看到命令行刷刷闪过,React 代码瞬间物理装配完成。
54
- >
55
51
  > *注:若想识别真实截图,请在 `config.js` 中将 `useDemo` 设为 `false` 并配置下方环境变量。*
56
52
 
57
53
  创建 `.env` 文件并配置以下环境变量:
@@ -64,58 +60,21 @@ BASE_URL=your_api_base_url_here
64
60
 
65
61
  🚗 **获取API Key直通车**: [阿里云百炼控制台](https://bailian.console.aliyun.com/cn-beijing?tab=doc#/doc/)
66
62
 
67
- ### 基本使用
68
-
69
- 1. **生成完整CRUD页面**
70
-
71
- ```bash
72
- # 将页面截图放入screenShot目录
73
- autodev watch:page
74
- ```
75
-
76
- 2. **生成局部UI组件**
77
-
78
- ```bash
79
- # 将组件截图放入screenPart目录
80
- autodev watch:part
81
- ```
82
-
83
- 3. **对齐API字段**
84
-
85
- ```bash
86
- autodev watch:api
87
- ```
88
-
89
- ## 📖 详细使用指南
90
-
91
- ### watch:page 命令
92
-
93
- 监听 `screenShot` 目录下的截图文件,自动生成完整的增删改查页面。
94
-
95
- ```bash
96
- autodev watch:page -t react
97
- ```
98
-
99
- 参数说明:
100
- - `-t, --template <type>`: 指定前端框架模板,默认为 `react`
101
-
102
- ### watch:part 命令
103
-
104
- 监听 `screenPart` 目录下的截图文件,自动生成局部UI组件。
63
+ ### 📖 指挥中心操作指南 (v2.0 工作流)
64
+ 进入 2.0 时代,你只需要记住一个指令:
105
65
 
106
66
  ```bash
107
- autodev watch:part -t vue
67
+ autodev watch
108
68
  ```
69
+ 启动后,地堡系统将进入 全频道联动监听状态:
109
70
 
110
- ### watch:api 命令
111
-
112
- 监听 `response` 目录下的与模块同名的json文件,自动对齐真实接口字段。
113
-
114
- ```bash
115
- autodev watch:api
116
- ```
71
+ | 动作 | 目标目录 | 构筑效果 |
72
+ | :--- | :--- | :--- |
73
+ | **全页截图** | `./screenShot` | 自动生成 `index.js`、`resource.js` 并同步路由配置 |
74
+ | **局部截图** | `./screenPart` | 终端实时打印代码片段 (随拷随用) |
75
+ | **接口 JSON** | `./response` | 自动执行语义对齐,修正 `resource.js` 中的字段名 |
117
76
 
118
- ## 📁 项目结构
77
+ ## 📁 2.0 地堡结构说明
119
78
 
120
79
  ```
121
80
  your-project/
@@ -138,19 +97,15 @@ your-project/
138
97
  module.exports = {
139
98
  // 是否使用演示模式
140
99
  useDemo: true,
141
-
142
100
  // 是否需要生成 Mock 数据
143
101
  needMock: false,
144
-
145
102
  // 使用的 AI 模型类型
146
103
  visionModel: 'qwen3.5-plus',
147
104
  textModel: 'qwen-turbo',
148
-
149
105
  // 自定义模板目录
150
106
  // 如果为空,将使用内置模板
151
107
  // 自定义模板需要在hbsdir目录创建自己的index.hbs和resource.hbs文件
152
108
  hbsDir: '',
153
-
154
109
  // 目标项目的目录路径
155
110
  hooksDir: 'src/hooks',
156
111
  pagesDir: 'src/pages',
@@ -159,20 +114,6 @@ module.exports = {
159
114
  }
160
115
  ```
161
116
 
162
- ## 🎯 支持的UI组件
163
-
164
- - 输入框 (Input)
165
- - 数字输入框 (InputNumber)
166
- - 选择器 (Select)
167
- - 单选框 (Radio)
168
- - 复选框 (Checkbox)
169
- - 日期选择器 (DatePicker)
170
- - 日期范围选择器 (RangePicker)
171
- - 级联选择器 (Cascader)
172
- - 自动完成 (AutoComplete)
173
- - 文本域 (TextArea)
174
- - 文件上传 (Upload)
175
-
176
117
  ## 🤝 贡献
177
118
 
178
119
  欢迎贡献代码!请阅读 [CONTRIBUTING.md](CONTRIBUTING.md) 了解如何参与项目开发。
@@ -183,11 +124,10 @@ module.exports = {
183
124
 
184
125
  ## 🙏 致谢
185
126
 
186
- 感谢以下开源项目:
187
-
188
- - [OpenAI](https://openai.com/) - 提供强大的AI能力
189
- - [Ant Design](https://ant.design/) - 优秀的企业级UI设计语言
190
- - [UmiJS](https://umijs.org/) - 企业级前端应用框架
127
+ 感谢以下开源项目为地堡提供核心动力:
128
+ - [OpenAI](https://openai.com/) / [Alibaba Qwen](https://tongyi.aliyun.com/) - 强大的 AI 视觉与语言能力
129
+ - [Ant Design](https://ant.design/) - 优秀的企业级 UI 组件库
130
+ - [Handlebars](https://handlebarsjs.com/) / [Chokidar](https://github.com/paulmillr/chokidar) - 稳定的构筑引擎与监听机制
191
131
 
192
132
  ## 📞 联系方式
193
133
 
@@ -197,6 +137,9 @@ module.exports = {
197
137
  Q: 这个工具收费吗?
198
138
  A: 工具本身开源免费,但调用的 AI 模型(如 GPT-4v, Qwen-VL)可能需要你配置自己的 API Key。建议使用阿里云 Qwen-VL 等高性价比模型。
199
139
 
140
+ Q: 如何自定义生成的代码风格?
141
+ A: 你可以配置 hbsDir 指向你自己的 Handlebars 模板目录,打造专属的地堡构筑规范。
142
+
200
143
  ---
201
144
 
202
145
  ## ⚖️ Disclaimer
package/README_EN.md CHANGED
@@ -1,32 +1,32 @@
1
1
  # Auto CRUD Copilot
2
2
 
3
- English | [简体中文](./README.md)
3
+ [简体中文](./README.md) | English
4
4
 
5
5
  ![Auto CRUD Copilot Banner](https://github.com/user-attachments/assets/e168ef33-7616-434c-91e6-e2c9eef017c0)
6
6
 
7
+
7
8
  [![NPM Version](https://img.shields.io/npm/v/@yorha2b-lab/autodev.svg?style=flat-square)](https://www.npmjs.com/package/@yorha2b-lab/autodev)
8
9
  [![NPM Downloads](https://img.shields.io/npm/dm/@yorha2b-lab/autodev.svg?style=flat-square)](https://www.npmjs.com/package/@yorha2b-lab/autodev)
9
10
  [![GitHub Stars](https://img.shields.io/github/stars/yorha2b-lab/auto-crud-copilot.svg?style=flat-square)](https://github.com/yorha2b-lab/auto-crud-copilot/stargazers)
10
11
  [![License](https://img.shields.io/npm/l/@yorha2b-lab/autodev.svg?style=flat-square)](https://github.com/yorha2b-lab/auto-crud-copilot/blob/main/LICENSE)
11
12
 
12
- An AI-powered frontend CRUD code generator based on vision models (React+Antd) 🚀
13
+ Vision-based LLM-powered frontend (React+Antd) fully automatic CRUD code generator 🚀
13
14
 
14
15
  <video src="https://github.com/user-attachments/assets/6d42fce1-c815-482b-8c6a-4a3b9415ba47.mp4" controls="controls" muted="muted" style="max-width: 100%; display: block; margin: 20px auto;">
15
16
  </video>
16
17
 
17
- Say goodbye to repetitive work! Why do you need Auto CRUD Copilot?
18
- Stop writing Tables/Forms manually: Screenshot to code, boost your development efficiency, and say goodbye to tedious copy-paste.
19
- Eliminate API integration pain: Automatically read Response data, and let AI help you bridge frontend-backend field naming differences.
20
- Decoupled architecture: Core logic separated from UI frameworks, supporting React/Vue/Angular.
18
+ ## 💡 Why Choose Version 2.0?
19
+ In the 2.0 era, we abandoned cumbersome scattered instructions and fully evolved into a "Full-Channel Integrated Command Center"
20
+ - Full-Channel Linkage: No need to open multiple processes. One watch command listens to Page, Component, and API sensors simultaneously.
21
+ - Semantic Hacking: Not just replicating UI, but automatically smoothing out frontend-backend field differences through the 9S dedicated semantic bridge protocol.
22
+ - Engineering-Grade Quality: Generated code is not "demo-grade" but high-quality code with useTableQuery, EditableCell, OSS upload, and other practical logic.
21
23
 
22
24
  ## ✨ Features
23
25
 
24
- - 🖼️ **Visual Recognition**: Automatically recognize page structures from screenshots and generate corresponding CRUD code
25
- - 🔧 **Smart Generation**: Support multiple frontend framework templates including React, Vue, and Angular
26
- - 📊 **Table Components**: Automatically generate editable, sortable, and filterable data tables
27
- - 📝 **Form Components**: Intelligently generate search forms and modal forms
28
- - 🔌 **API Alignment**: Automatically align Response interfaces with frontend field mappings
29
- - 🎨 **UI Components**: Support various UI component types (input, select, date picker, etc.)
26
+ - 🖼️ **Visual Construction (Page)**: Drop screenshots into screenShot, Pod 042 automatically generates complete CRUD pages with Table/Form/Tabs.
27
+ - 🧩 **Fragment Extraction (Part)**: Drop partial screenshots into screenPart, terminal instantly pops up "plug-and-play" UI configuration snippets.
28
+ - 🔌 **Semantic Alignment (API)**: Drop interface JSON into response, automatically corrects frontend field names to achieve 100% protocol consistency between frontend and backend.
29
+ - 🔧 **Smart Assembly**: Automatically completes import statements, handles date format conversion, currency thousand separators, upload authorization, and all other dirty work.
30
30
  - 📱 **Responsive**: Generated code supports responsive layout
31
31
 
32
32
  ## 🚀 Quick Start
@@ -37,21 +37,18 @@ Decoupled architecture: Core logic separated from UI frameworks, supporting Reac
37
37
  npm install -g @yorha2b-lab/autodev
38
38
  ```
39
39
 
40
- ### Environment Setup
41
-
42
- Quick start
40
+ ### Environment Configuration
43
41
 
44
42
  ```bash
45
43
  autodev init
46
44
  ```
47
45
 
48
- > ### 💡 Zero-Config Quick Start (Simulation Mode)
49
- > To allow YoRHa units to experience the construction power immediately, **Demo Mode** is enabled by default:
50
- > 1. **No API_KEY required**. Simply run `autodev watch:page`.
51
- > 2. Drop any image into the `screenShot` directory (the system will ignore the image content and deploy a standard `example.json` construction package).
52
- > 3. **Watch the Magic**: The terminal will flash, and React code is physically assembled in seconds.
53
- >
54
- > *Note: To recognize actual screenshots, set `useDemo: false` in `config.js` and configure the environment variables above.*
46
+ > ### 💡 Zero-Configuration Quick Experience (Demo Mode)
47
+ > The project enables Demo mode by default:
48
+ > 1. **No API_KEY configuration required**, just run `autodev watch`.
49
+ > 2. Drop any image into the `screenShot` directory (the system will ignore image content and automatically airdrop the standard `example.json` construction package).
50
+ > 3. **Observe the effect**: You'll see the command line flash by, and React code is instantly physically assembled.
51
+ > *Note: To recognize real screenshots, please set `useDemo` to `false` in `config.js` and configure the environment variables below.*
55
52
 
56
53
  Create a `.env` file and configure the following environment variables:
57
54
 
@@ -61,60 +58,24 @@ API_KEY=your_api_key_here
61
58
  BASE_URL=your_api_base_url_here
62
59
  ```
63
60
 
64
- 🚗 **Get API Key**: [Alibaba Cloud Bailian Console](https://bailian.console.aliyun.com/cn-beijing?tab=doc#/doc/)
65
-
66
- ### Basic Usage
61
+ 🚗 **Direct Link to Get API Key**: [Alibaba Cloud Bailian Console](https://bailian.console.aliyun.com/cn-beijing?tab=doc#/doc/)
67
62
 
68
- 1. **Generate Complete CRUD Pages**
63
+ ### 📖 Command Center Operation Guide (v2.0 Workflow)
64
+ Entering the 2.0 era, you only need to remember one command:
69
65
 
70
66
  ```bash
71
- # Put page screenshots in the screenShot directory
72
- autodev watch:page
67
+ autodev watch
73
68
  ```
74
69
 
75
- 2. **Generate Partial UI Components**
70
+ After startup, the bunker system will enter Full-Channel Linkage Listening State:
76
71
 
77
- ```bash
78
- # Put component screenshots in the screenPart directory
79
- autodev watch:part
80
- ```
72
+ | Action | Target Directory | Construction Effect |
73
+ | :--- | :--- | :--- |
74
+ | **Full Page Screenshot** | `./screenShot` | Automatically generates `index.js`, `resource.js` and synchronizes route configuration |
75
+ | **Partial Screenshot** | `./screenPart` | Terminal prints code snippets in real-time (copy and use instantly) |
76
+ | **API JSON** | `./response` | Automatically executes semantic alignment, correcting field names in `resource.js` |
81
77
 
82
- 3. **Align API Fields**
83
-
84
- ```bash
85
- autodev watch:api
86
- ```
87
-
88
- ## 📖 Detailed Usage Guide
89
-
90
- ### watch:page Command
91
-
92
- Monitor screenshot files in the `screenShot` directory and automatically generate complete CRUD pages.
93
-
94
- ```bash
95
- autodev watch:page -t react
96
- ```
97
-
98
- Parameters:
99
- - `-t, --template <type>`: Specify frontend framework template, default is `react`
100
-
101
- ### watch:part Command
102
-
103
- Monitor screenshot files in the `screenPart` directory and automatically generate partial UI components.
104
-
105
- ```bash
106
- autodev watch:part -t vue
107
- ```
108
-
109
- ### watch:api Command
110
-
111
- Monitor JSON files in the `response` directory (named after modules) and automatically align real API fields.
112
-
113
- ```bash
114
- autodev watch:api
115
- ```
116
-
117
- ## 📁 Project Structure
78
+ ## 📁 2.0 Bunker Structure Description
118
79
 
119
80
  ```
120
81
  your-project/
@@ -131,25 +92,21 @@ your-project/
131
92
 
132
93
  ## ⚙️ Configuration
133
94
 
134
- You can configure the following options in `config.js`:
95
+ The following options can be configured in `config.js`:
135
96
 
136
97
  ```javascript
137
98
  module.exports = {
138
99
  // Whether to use demo mode
139
100
  useDemo: true,
140
-
141
101
  // Whether to generate Mock data
142
102
  needMock: false,
143
-
144
- // AI model types to use
103
+ // AI model type used
145
104
  visionModel: 'qwen3.5-plus',
146
105
  textModel: 'qwen-turbo',
147
-
148
- // Custom template directory path
149
- // If empty, will use built-in templates
150
- // Custom templates need to create their own index.hbs and resource.hbs files in the hbsdir directory
106
+ // Custom template directory
107
+ // If empty, built-in templates will be used
108
+ // Custom templates need to create your own index.hbs and resource.hbs files in the hbsdir directory
151
109
  hbsDir: '',
152
-
153
110
  // Target project directory paths
154
111
  hooksDir: 'src/hooks',
155
112
  pagesDir: 'src/pages',
@@ -158,44 +115,33 @@ module.exports = {
158
115
  }
159
116
  ```
160
117
 
161
- ## 🎯 Supported UI Components
162
-
163
- - Input
164
- - InputNumber
165
- - Select
166
- - Radio
167
- - Checkbox
168
- - DatePicker
169
- - RangePicker
170
- - Cascader
171
- - AutoComplete
172
- - TextArea
173
- - Upload
174
-
175
118
  ## 🤝 Contributing
176
119
 
177
120
  Contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) to learn how to participate in project development.
178
121
 
179
122
  ## 📄 License
180
123
 
181
- This project is licensed under the [MIT](LICENSE) license.
124
+ This project is licensed under the [MIT](LICENSE) License.
182
125
 
183
126
  ## 🙏 Acknowledgments
184
127
 
185
- Thanks to the following open-source projects:
128
+ Thanks to the following open source projects for providing the core power of the bunker system:
186
129
 
187
- - [OpenAI](https://openai.com/) - Providing powerful AI capabilities
130
+ - [OpenAI](https://openai.com/) / [Alibaba Qwen](https://tongyi.aliyun.com/) - Powerful AI capabilities
188
131
  - [Ant Design](https://ant.design/) - Excellent enterprise-level UI design language
189
- - [UmiJS](https://umijs.org/) - Enterprise-level frontend application framework
132
+ - [Handlebars](https://handlebarsjs.com/) / [Chokidar](https://github.com/paulmillr/chokidar) - Stable construction engine and listener mechanism
190
133
 
191
134
  ## 📞 Contact
192
135
 
193
- If you have any questions or suggestions, feel free to submit an [Issue](https://github.com/yorha2b-lab/auto-crud-copilot/issues).
136
+ If you have any questions or suggestions, please submit an [Issue](https://github.com/yorha2b-lab/auto-crud-copilot/issues).
194
137
 
195
138
  ## 🛠️ FAQ
196
139
 
197
- **Q: Is this tool free?**
198
- A: The tool itself is open-source and free, but the AI models it calls (such as GPT-4v, Qwen-VL) may require you to configure your own API Key. We recommend using cost-effective models like Alibaba Cloud's Qwen-VL.
140
+ Q: Is this tool free?
141
+ A: The tool itself is open source and free, but the AI models called (such as GPT-4v, Qwen-VL) may require you to configure your own API Key. It is recommended to use cost-effective models like Alibaba Cloud Qwen-VL.
142
+
143
+ Q: How to customize the generated code style?
144
+ A: You can configure hbsDir to point to your own Handlebars template directory to create your own exclusive bunker construction specifications.
199
145
 
200
146
  ---
201
147
 
@@ -209,4 +155,4 @@ Auto CRUD Copilot is a **fan-made, non-commercial, open-source tool**.
209
155
 
210
156
  **Glory to Mankind.**
211
157
 
212
- ⭐ If this project helps you, please give it a Star to show your support!
158
+ ⭐ If this project helps you, please give it a Star!
package/bin/autodev.js CHANGED
@@ -12,11 +12,11 @@ console.log(chalk.gray('Booting System...'))
12
12
  console.log(chalk.white(' [System] ') + chalk.green('Locale Detection: ') + chalk.cyan(language('ZH-CN', 'EN-US')))
13
13
  console.log(chalk.white(' [System] ') + chalk.green('YoRHa No.2 Type B Unit: ') + chalk.cyan('Online'))
14
14
  console.log(chalk.white(' [System] ') + chalk.green('Scanner Type 9S Unit: ') + chalk.cyan('Standby'))
15
- console.log(chalk.white(' [Mission] ') + chalk.yellow('Frontend Architecture Construction: ') + chalk.cyan('Awaiting Command'))
15
+ console.log(chalk.white(' [System] ') + chalk.green('Full-Channel Link: ') + chalk.cyan('Established')) // 2.0 新增
16
+ console.log(chalk.white(' [Mission] ') + chalk.yellow('Bunker Construction Protocol: ') + chalk.cyan('v' + pkg.version))
16
17
  console.log(chalk.white(' [Bunker] ') + chalk.magenta('Glory to mankind. (人类荣光永存)'))
17
18
  console.log(chalk.gray('--------------------------------------------------\n'))
18
19
 
19
- // --- Commander 配置 ---
20
20
  program
21
21
  .version(pkg.version)
22
22
  .description(language('AI驱动的前端CRUD代码生成器', 'AI-powered frontend CRUD code generator'))
@@ -25,7 +25,7 @@ program.option('-t, --template <type>', language('指定前端框架模板', 'Sp
25
25
 
26
26
  program
27
27
  .command('init')
28
- .description(language('在当前目录初始化 .env 和 config.js 配置文件', 'Initialize .env and config.js in the current directory'))
28
+ .description(language('在当前目录初始化地堡构筑环境', 'Initialize Bunker construction environment'))
29
29
  .action(() => {
30
30
  const tplConfig = path.resolve(__dirname, '../config.js')
31
31
  const tplEnv = path.resolve(__dirname, '../.env.example')
@@ -36,62 +36,47 @@ program
36
36
  fs.mkdirSync(path.join(process.cwd(), 'screenShot'), { recursive: true })
37
37
  fs.mkdirSync(path.join(process.cwd(), 'screenPart'), { recursive: true })
38
38
 
39
- // .env 处理
40
39
  if (fs.existsSync(targetEnv)) {
41
- console.log(chalk.yellow(language(
42
- '🤖 Pod 042: [警告] 终端已存在 .env 文件,跳过生成以免覆盖数据。',
43
- '🤖 Pod 042: [Warning] .env already exists. Skipping to avoid data overwrite.'
44
- )));
40
+ console.log(chalk.yellow(language('🤖 Pod 042: [警告] 终端已存在 .env 文件,跳过生成。', '🤖 Pod 042: [Warning] .env already exists.')))
45
41
  } else {
46
- fs.copyFileSync(tplEnv, targetEnv);
47
- console.log(chalk.green(language(
48
- '🤖 Pod 042: [报告] .env 存储完毕。',
49
- '🤖 Pod 042: [Report] .env storage complete.'
50
- )));
42
+ fs.copyFileSync(tplEnv, targetEnv)
43
+ console.log(chalk.green(language('🤖 Pod 042: [报告] .env 存储完毕。', '🤖 Pod 042: [Report] .env storage complete.')))
51
44
  }
52
45
 
53
- // config.js 处理
54
46
  if (fs.existsSync(targetConfig)) {
55
- console.log(chalk.yellow(language(
56
- '🤖 Pod 042: [警告] 终端已存在 config.js 文件,跳过生成以免覆盖数据。',
57
- '🤖 Pod 042: [Warning] config.js already exists. Skipping to avoid data overwrite.'
58
- )));
47
+ console.log(chalk.yellow(language('🤖 Pod 042: [警告] 终端已存在 config.js 文件,跳过生成。', '🤖 Pod 042: [Warning] config.js already exists.')))
59
48
  } else {
60
49
  fs.copyFileSync(tplConfig, targetConfig)
61
- console.log(chalk.green(language(
62
- '🤖 Pod 042: [报告] config.js 存储完毕。',
63
- '🤖 Pod 042: [Report] config.js storage complete.'
64
- )));
50
+ console.log(chalk.green(language('🤖 Pod 042: [报告] config.js 存储完毕。', '🤖 Pod 042: [Report] config.js storage complete.')))
65
51
  }
66
52
 
67
53
  console.log(chalk.cyan(language(
68
- '📡 Operator 6O: 呼叫 2B,环境配置文件已下发至本地终端!',
69
- '📡 Operator 6O: Calling 2B, environmental config files have been deployed to your local terminal!'
54
+ '📡 Operator 6O: 呼叫 2B,地堡部署完毕,请开启 watch 模式进入战场!',
55
+ '📡 Operator 6O: Calling 2B, Bunker deployed. Execute [watch] to enter the battlefield!'
70
56
  )))
71
57
  })
72
58
 
73
59
  program
74
- .command('watch:page')
75
- .description(language('监听截图,自动生成完整的增删改查页面', 'Watch screenshots and auto-generate complete CRUD pages'))
60
+ .command('watch')
61
+ .alias('start')
62
+ .description(language('开启全频道联动监控:支持 Page/Part/API 协同构筑', 'Start full-channel linked monitoring: Coordinated Page/Part/API construction'))
76
63
  .action(() => {
77
- const watchPage = require('../src/commands/watch-page')
78
- watchPage(program.opts())
79
- })
80
-
81
- program
82
- .command('watch:part')
83
- .description(language('监听截图,自动生成局部 UI 组件', 'Watch screenshots and auto-generate partial UI components'))
84
- .action(() => {
85
- const watchPart = require('../src/commands/watch-part')
86
- watchPart(program.opts())
87
- })
88
-
89
- program
90
- .command('watch:api')
91
- .description(language('监听 Response,自动对齐真实接口字段', 'Watch responses and auto-align real API fields'))
92
- .action(() => {
93
- const watchApi = require('../src/commands/watch-api')
94
- watchApi(program.opts())
64
+ const watch = require('../src/commands/watch')
65
+ watch(program.opts())
66
+ process.on('SIGINT', () => {
67
+ console.log('\n')
68
+ console.log(chalk.gray('--------------------------------------------------'))
69
+ console.log(chalk.white(' [System] ') + chalk.yellow(language('正在断开神经云链接...', 'Disconnecting Neural Link...')))
70
+ console.log(chalk.white(' [System] ') + chalk.green(language('所有构筑数据已同步至 Bunker 存储节点。', 'All data synced to Bunker storage nodes.')))
71
+ setTimeout(() => {
72
+ console.log(chalk.cyan(language(
73
+ '📡 Operator 6O: 辛苦了,2B!地堡系统已进入待机状态,愿人类荣光永存。',
74
+ '📡 Operator 6O: Well done, 2B! Bunker system is in standby. Glory to mankind.'
75
+ )))
76
+ console.log(chalk.gray(' [Bunker] ') + chalk.white('Signal Lost... Bye.\n'))
77
+ process.exit(0)
78
+ }, 500)
79
+ })
95
80
  })
96
81
 
97
82
  program.parse(process.argv)
package/config.js CHANGED
@@ -1,39 +1,21 @@
1
- /**
2
- * Auto CRUD Copilot 配置文件
3
- *
4
- * 此文件包含了项目运行所需的所有配置项
5
- */
6
-
7
1
  module.exports = {
8
2
 
9
- useDemo: true,
10
-
11
- // 是否需要生成 Mock 数据
12
- needMock: false,
13
-
14
- // 使用的 AI 模型类型
15
- visionModel: 'qwen3.5-plus',
16
-
17
- textModel: 'qwen-turbo',
18
-
19
3
  // 自定义模板目录
20
4
  // 如果为空,将使用内置模板
21
5
  // 自定义模板需要在hbsdir目录创建自己的index.hbs和resource.hbs文件
22
6
  hbsDir: '',
23
7
 
24
- // 目标项目的 hooks 目录路径
25
- hooksDir: 'src/hooks',
8
+ useDemo: true,
9
+ needMock: false,
26
10
 
27
- // 目标项目的 pages 目录路径
28
- pagesDir: 'src/pages',
11
+ textModel: 'qwen-turbo',
12
+ visionModel: 'qwen3.5-plus',
29
13
 
30
- // 目标项目的 utils 目录路径
14
+ hooksDir: 'src/hooks',
15
+ pagesDir: 'src/pages',
31
16
  utilsDir: 'src/utils',
32
-
33
- // 目标项目的 components 目录路径
34
17
  componentsDir: 'src/components',
35
18
 
36
- // 响应成功条件
37
- responseSuccess: 'response?.code === 200',
19
+ responseSuccess: `response?.code === 200`,
38
20
 
39
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yorha2b-lab/autodev",
3
- "version": "1.1.0",
3
+ "version": "2.0.0",
4
4
  "description": "基于视觉大模型的前端(react+Antd)全自动 CRUD 代码生成器",
5
5
  "bin": {
6
6
  "autodev": "bin/autodev.js"