@yorha2b-lab/autodev 1.1.0 → 2.0.1
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 +29 -87
- package/README_EN.md +47 -102
- package/bin/autodev.js +29 -44
- package/config.js +7 -25
- package/package.json +1 -1
- package/src/commands/handlers/api-handler.js +80 -0
- package/src/commands/handlers/page-handler.js +92 -0
- package/src/commands/handlers/part-handler.js +76 -0
- package/src/commands/watch.js +96 -0
- package/src/core/react-compiler.js +6 -20
- package/src/prompts/mock.js +2 -2
- package/src/prompts/react/watch-part.js +30 -25
- package/src/services/llm.js +2 -24
- package/src/utils/utils.js +7 -28
- package/src/commands/watch-api.js +0 -68
- package/src/commands/watch-page.js +0 -155
- package/src/commands/watch-part.js +0 -77
package/README.md
CHANGED
|
@@ -12,22 +12,20 @@
|
|
|
12
12
|
|
|
13
13
|
基于视觉大模型的前端(React+Antd)全自动 CRUD 代码生成器 🚀
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
</video>
|
|
15
|
+

|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
## 💡 为什么选择 2.0 版本?
|
|
18
|
+
在 2.0 时代,我们放弃了繁琐的分散指令,全面进化为 “全频道集成指挥中心”
|
|
19
|
+
- 全频道联动:不再需要开启多个进程。一个 watch 指令,同时监听 页面、组件、API 三大传感器。
|
|
20
|
+
- 语义化骇入:不仅仅是复刻 UI,通过 9S 专用语义桥接协议,自动抹平前后端字段差异。
|
|
21
|
+
- 工程级质量:生成的代码不是“演示用”,而是带 useTableQuery、EditableCell、OSS上传 等实战逻辑的高质量代码。
|
|
22
22
|
|
|
23
23
|
## ✨ 特性
|
|
24
24
|
|
|
25
|
-
- 🖼️
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
- 🔌 **API对齐**: 自动对齐Response接口与前端字段映射
|
|
30
|
-
- 🎨 **UI组件**: 支持多种UI组件类型(输入框、选择器、日期等)
|
|
25
|
+
- 🖼️ 视觉构筑 (Page): 截图丢入 screenShot,Pod 042 自动生成带 Table/Form/Tabs 的完整 CRUD 页面。
|
|
26
|
+
- 🧩 碎片提取 (Part): 局部截图丢入 screenPart,终端瞬间弹出“即插即用”的 UI 配置片段。
|
|
27
|
+
- 🔌 语义对齐 (API): 接口 JSON 丢入 response,自动修正前端字段名,达成前后端 100% 协议一致。
|
|
28
|
+
- 🔧 智能装配: 自动补全 import 语句,处理日期格式转换、金额千分位、上传授权等所有脏活累活。
|
|
31
29
|
- 📱 **响应式**: 生成的代码支持响应式布局
|
|
32
30
|
|
|
33
31
|
## 🚀 快速开始
|
|
@@ -40,18 +38,15 @@ npm install -g @yorha2b-lab/autodev
|
|
|
40
38
|
|
|
41
39
|
### 环境配置
|
|
42
40
|
|
|
43
|
-
快速开始
|
|
44
|
-
|
|
45
41
|
```bash
|
|
46
42
|
autodev init
|
|
47
43
|
```
|
|
48
44
|
|
|
49
45
|
> ### 💡 零配置快速体验 (模拟模式)
|
|
50
|
-
>
|
|
51
|
-
> 1. **无需配置 API_KEY**,直接运行 `autodev watch
|
|
46
|
+
> 项目默认开启 Demo 模式:
|
|
47
|
+
> 1. **无需配置 API_KEY**,直接运行 `autodev watch`。
|
|
52
48
|
> 2. 向 `screenShot` 目录丢入任意图片(系统将忽略图片内容,自动空投标准 `example.json` 构筑包)。
|
|
53
49
|
> 3. **观察效果**:你会看到命令行刷刷闪过,React 代码瞬间物理装配完成。
|
|
54
|
-
>
|
|
55
50
|
> *注:若想识别真实截图,请在 `config.js` 中将 `useDemo` 设为 `false` 并配置下方环境变量。*
|
|
56
51
|
|
|
57
52
|
创建 `.env` 文件并配置以下环境变量:
|
|
@@ -64,58 +59,21 @@ BASE_URL=your_api_base_url_here
|
|
|
64
59
|
|
|
65
60
|
🚗 **获取API Key直通车**: [阿里云百炼控制台](https://bailian.console.aliyun.com/cn-beijing?tab=doc#/doc/)
|
|
66
61
|
|
|
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组件。
|
|
62
|
+
### 📖 指挥中心操作指南 (v2.0 工作流)
|
|
63
|
+
进入 2.0 时代,你只需要记住一个指令:
|
|
105
64
|
|
|
106
65
|
```bash
|
|
107
|
-
autodev watch
|
|
66
|
+
autodev watch
|
|
108
67
|
```
|
|
68
|
+
启动后,地堡系统将进入 全频道联动监听状态:
|
|
109
69
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
autodev watch:api
|
|
116
|
-
```
|
|
70
|
+
| 动作 | 目标目录 | 构筑效果 |
|
|
71
|
+
| :--- | :--- | :--- |
|
|
72
|
+
| **全页截图** | `./screenShot` | 自动生成 `index.js`、`resource.js` 并同步路由配置 |
|
|
73
|
+
| **局部截图** | `./screenPart` | 终端实时打印代码片段 (随拷随用) |
|
|
74
|
+
| **接口 JSON** | `./response` | 自动执行语义对齐,修正 `resource.js` 中的字段名 |
|
|
117
75
|
|
|
118
|
-
## 📁
|
|
76
|
+
## 📁 2.0 地堡结构说明
|
|
119
77
|
|
|
120
78
|
```
|
|
121
79
|
your-project/
|
|
@@ -138,19 +96,15 @@ your-project/
|
|
|
138
96
|
module.exports = {
|
|
139
97
|
// 是否使用演示模式
|
|
140
98
|
useDemo: true,
|
|
141
|
-
|
|
142
99
|
// 是否需要生成 Mock 数据
|
|
143
100
|
needMock: false,
|
|
144
|
-
|
|
145
101
|
// 使用的 AI 模型类型
|
|
146
102
|
visionModel: 'qwen3.5-plus',
|
|
147
103
|
textModel: 'qwen-turbo',
|
|
148
|
-
|
|
149
104
|
// 自定义模板目录
|
|
150
105
|
// 如果为空,将使用内置模板
|
|
151
106
|
// 自定义模板需要在hbsdir目录创建自己的index.hbs和resource.hbs文件
|
|
152
107
|
hbsDir: '',
|
|
153
|
-
|
|
154
108
|
// 目标项目的目录路径
|
|
155
109
|
hooksDir: 'src/hooks',
|
|
156
110
|
pagesDir: 'src/pages',
|
|
@@ -159,20 +113,6 @@ module.exports = {
|
|
|
159
113
|
}
|
|
160
114
|
```
|
|
161
115
|
|
|
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
116
|
## 🤝 贡献
|
|
177
117
|
|
|
178
118
|
欢迎贡献代码!请阅读 [CONTRIBUTING.md](CONTRIBUTING.md) 了解如何参与项目开发。
|
|
@@ -183,11 +123,10 @@ module.exports = {
|
|
|
183
123
|
|
|
184
124
|
## 🙏 致谢
|
|
185
125
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
- [
|
|
189
|
-
- [
|
|
190
|
-
- [UmiJS](https://umijs.org/) - 企业级前端应用框架
|
|
126
|
+
感谢以下开源项目为地堡提供核心动力:
|
|
127
|
+
- [OpenAI](https://openai.com/) / [Alibaba Qwen](https://tongyi.aliyun.com/) - 强大的 AI 视觉与语言能力
|
|
128
|
+
- [Ant Design](https://ant.design/) - 优秀的企业级 UI 组件库
|
|
129
|
+
- [Handlebars](https://handlebarsjs.com/) / [Chokidar](https://github.com/paulmillr/chokidar) - 稳定的构筑引擎与监听机制
|
|
191
130
|
|
|
192
131
|
## 📞 联系方式
|
|
193
132
|
|
|
@@ -197,6 +136,9 @@ module.exports = {
|
|
|
197
136
|
Q: 这个工具收费吗?
|
|
198
137
|
A: 工具本身开源免费,但调用的 AI 模型(如 GPT-4v, Qwen-VL)可能需要你配置自己的 API Key。建议使用阿里云 Qwen-VL 等高性价比模型。
|
|
199
138
|
|
|
139
|
+
Q: 如何自定义生成的代码风格?
|
|
140
|
+
A: 你可以配置 hbsDir 指向你自己的 Handlebars 模板目录,打造专属的地堡构筑规范。
|
|
141
|
+
|
|
200
142
|
---
|
|
201
143
|
|
|
202
144
|
## ⚖️ Disclaimer
|
package/README_EN.md
CHANGED
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
# Auto CRUD Copilot
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[简体中文](./README.md) | English
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
|
+
|
|
7
8
|
[](https://www.npmjs.com/package/@yorha2b-lab/autodev)
|
|
8
9
|
[](https://www.npmjs.com/package/@yorha2b-lab/autodev)
|
|
9
10
|
[](https://github.com/yorha2b-lab/auto-crud-copilot/stargazers)
|
|
10
11
|
[](https://github.com/yorha2b-lab/auto-crud-copilot/blob/main/LICENSE)
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
Vision-based LLM-powered frontend (React+Antd) fully automatic CRUD code generator 🚀
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
</video>
|
|
15
|
+

|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
## 💡 Why Choose Version 2.0?
|
|
18
|
+
In the 2.0 era, we abandoned cumbersome scattered instructions and fully evolved into a "Full-Channel Integrated Command Center"
|
|
19
|
+
- Full-Channel Linkage: No need to open multiple processes. One watch command listens to Page, Component, and API sensors simultaneously.
|
|
20
|
+
- Semantic Hacking: Not just replicating UI, but automatically smoothing out frontend-backend field differences through the 9S dedicated semantic bridge protocol.
|
|
21
|
+
- Engineering-Grade Quality: Generated code is not "demo-grade" but high-quality code with useTableQuery, EditableCell, OSS upload, and other practical logic.
|
|
21
22
|
|
|
22
23
|
## ✨ Features
|
|
23
24
|
|
|
24
|
-
- 🖼️ **Visual
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
- 🔌 **API Alignment**: Automatically align Response interfaces with frontend field mappings
|
|
29
|
-
- 🎨 **UI Components**: Support various UI component types (input, select, date picker, etc.)
|
|
25
|
+
- 🖼️ **Visual Construction (Page)**: Drop screenshots into screenShot, Pod 042 automatically generates complete CRUD pages with Table/Form/Tabs.
|
|
26
|
+
- 🧩 **Fragment Extraction (Part)**: Drop partial screenshots into screenPart, terminal instantly pops up "plug-and-play" UI configuration snippets.
|
|
27
|
+
- 🔌 **Semantic Alignment (API)**: Drop interface JSON into response, automatically corrects frontend field names to achieve 100% protocol consistency between frontend and backend.
|
|
28
|
+
- 🔧 **Smart Assembly**: Automatically completes import statements, handles date format conversion, currency thousand separators, upload authorization, and all other dirty work.
|
|
30
29
|
- 📱 **Responsive**: Generated code supports responsive layout
|
|
31
30
|
|
|
32
31
|
## 🚀 Quick Start
|
|
@@ -37,21 +36,18 @@ Decoupled architecture: Core logic separated from UI frameworks, supporting Reac
|
|
|
37
36
|
npm install -g @yorha2b-lab/autodev
|
|
38
37
|
```
|
|
39
38
|
|
|
40
|
-
### Environment
|
|
41
|
-
|
|
42
|
-
Quick start
|
|
39
|
+
### Environment Configuration
|
|
43
40
|
|
|
44
41
|
```bash
|
|
45
42
|
autodev init
|
|
46
43
|
```
|
|
47
44
|
|
|
48
|
-
> ### 💡 Zero-
|
|
49
|
-
>
|
|
50
|
-
> 1. **No API_KEY required
|
|
51
|
-
> 2. Drop any image into the `screenShot` directory (the system will ignore
|
|
52
|
-
> 3. **
|
|
53
|
-
>
|
|
54
|
-
> *Note: To recognize actual screenshots, set `useDemo: false` in `config.js` and configure the environment variables above.*
|
|
45
|
+
> ### 💡 Zero-Configuration Quick Experience (Demo Mode)
|
|
46
|
+
> The project enables Demo mode by default:
|
|
47
|
+
> 1. **No API_KEY configuration required**, just run `autodev watch`.
|
|
48
|
+
> 2. Drop any image into the `screenShot` directory (the system will ignore image content and automatically airdrop the standard `example.json` construction package).
|
|
49
|
+
> 3. **Observe the effect**: You'll see the command line flash by, and React code is instantly physically assembled.
|
|
50
|
+
> *Note: To recognize real screenshots, please set `useDemo` to `false` in `config.js` and configure the environment variables below.*
|
|
55
51
|
|
|
56
52
|
Create a `.env` file and configure the following environment variables:
|
|
57
53
|
|
|
@@ -61,60 +57,24 @@ API_KEY=your_api_key_here
|
|
|
61
57
|
BASE_URL=your_api_base_url_here
|
|
62
58
|
```
|
|
63
59
|
|
|
64
|
-
🚗 **Get API Key**: [Alibaba Cloud Bailian Console](https://bailian.console.aliyun.com/cn-beijing?tab=doc#/doc/)
|
|
65
|
-
|
|
66
|
-
### Basic Usage
|
|
60
|
+
🚗 **Direct Link to Get API Key**: [Alibaba Cloud Bailian Console](https://bailian.console.aliyun.com/cn-beijing?tab=doc#/doc/)
|
|
67
61
|
|
|
68
|
-
|
|
62
|
+
### 📖 Command Center Operation Guide (v2.0 Workflow)
|
|
63
|
+
Entering the 2.0 era, you only need to remember one command:
|
|
69
64
|
|
|
70
65
|
```bash
|
|
71
|
-
|
|
72
|
-
autodev watch:page
|
|
66
|
+
autodev watch
|
|
73
67
|
```
|
|
74
68
|
|
|
75
|
-
|
|
69
|
+
After startup, the bunker system will enter Full-Channel Linkage Listening State:
|
|
76
70
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
71
|
+
| Action | Target Directory | Construction Effect |
|
|
72
|
+
| :--- | :--- | :--- |
|
|
73
|
+
| **Full Page Screenshot** | `./screenShot` | Automatically generates `index.js`, `resource.js` and synchronizes route configuration |
|
|
74
|
+
| **Partial Screenshot** | `./screenPart` | Terminal prints code snippets in real-time (copy and use instantly) |
|
|
75
|
+
| **API JSON** | `./response` | Automatically executes semantic alignment, correcting field names in `resource.js` |
|
|
81
76
|
|
|
82
|
-
|
|
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
|
|
77
|
+
## 📁 2.0 Bunker Structure Description
|
|
118
78
|
|
|
119
79
|
```
|
|
120
80
|
your-project/
|
|
@@ -131,25 +91,21 @@ your-project/
|
|
|
131
91
|
|
|
132
92
|
## ⚙️ Configuration
|
|
133
93
|
|
|
134
|
-
|
|
94
|
+
The following options can be configured in `config.js`:
|
|
135
95
|
|
|
136
96
|
```javascript
|
|
137
97
|
module.exports = {
|
|
138
98
|
// Whether to use demo mode
|
|
139
99
|
useDemo: true,
|
|
140
|
-
|
|
141
100
|
// Whether to generate Mock data
|
|
142
101
|
needMock: false,
|
|
143
|
-
|
|
144
|
-
// AI model types to use
|
|
102
|
+
// AI model type used
|
|
145
103
|
visionModel: 'qwen3.5-plus',
|
|
146
104
|
textModel: 'qwen-turbo',
|
|
147
|
-
|
|
148
|
-
//
|
|
149
|
-
//
|
|
150
|
-
// Custom templates need to create their own index.hbs and resource.hbs files in the hbsdir directory
|
|
105
|
+
// Custom template directory
|
|
106
|
+
// If empty, built-in templates will be used
|
|
107
|
+
// Custom templates need to create your own index.hbs and resource.hbs files in the hbsdir directory
|
|
151
108
|
hbsDir: '',
|
|
152
|
-
|
|
153
109
|
// Target project directory paths
|
|
154
110
|
hooksDir: 'src/hooks',
|
|
155
111
|
pagesDir: 'src/pages',
|
|
@@ -158,44 +114,33 @@ module.exports = {
|
|
|
158
114
|
}
|
|
159
115
|
```
|
|
160
116
|
|
|
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
117
|
## 🤝 Contributing
|
|
176
118
|
|
|
177
119
|
Contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) to learn how to participate in project development.
|
|
178
120
|
|
|
179
121
|
## 📄 License
|
|
180
122
|
|
|
181
|
-
This project is licensed under the [MIT](LICENSE)
|
|
123
|
+
This project is licensed under the [MIT](LICENSE) License.
|
|
182
124
|
|
|
183
125
|
## 🙏 Acknowledgments
|
|
184
126
|
|
|
185
|
-
Thanks to the following open
|
|
127
|
+
Thanks to the following open source projects for providing the core power of the bunker system:
|
|
186
128
|
|
|
187
|
-
- [OpenAI](https://openai.com/) -
|
|
129
|
+
- [OpenAI](https://openai.com/) / [Alibaba Qwen](https://tongyi.aliyun.com/) - Powerful AI capabilities
|
|
188
130
|
- [Ant Design](https://ant.design/) - Excellent enterprise-level UI design language
|
|
189
|
-
- [
|
|
131
|
+
- [Handlebars](https://handlebarsjs.com/) / [Chokidar](https://github.com/paulmillr/chokidar) - Stable construction engine and listener mechanism
|
|
190
132
|
|
|
191
133
|
## 📞 Contact
|
|
192
134
|
|
|
193
|
-
If you have any questions or suggestions,
|
|
135
|
+
If you have any questions or suggestions, please submit an [Issue](https://github.com/yorha2b-lab/auto-crud-copilot/issues).
|
|
194
136
|
|
|
195
137
|
## 🛠️ FAQ
|
|
196
138
|
|
|
197
|
-
|
|
198
|
-
A: The tool itself is open
|
|
139
|
+
Q: Is this tool free?
|
|
140
|
+
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.
|
|
141
|
+
|
|
142
|
+
Q: How to customize the generated code style?
|
|
143
|
+
A: You can configure hbsDir to point to your own Handlebars template directory to create your own exclusive bunker construction specifications.
|
|
199
144
|
|
|
200
145
|
---
|
|
201
146
|
|
|
@@ -209,4 +154,4 @@ Auto CRUD Copilot is a **fan-made, non-commercial, open-source tool**.
|
|
|
209
154
|
|
|
210
155
|
**Glory to Mankind.**
|
|
211
156
|
|
|
212
|
-
⭐ If this project helps you, please give it a Star
|
|
157
|
+
⭐ 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(' [
|
|
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('
|
|
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,
|
|
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
|
|
75
|
-
.
|
|
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
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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
|
-
|
|
25
|
-
|
|
8
|
+
useDemo: true,
|
|
9
|
+
needMock: false,
|
|
26
10
|
|
|
27
|
-
|
|
28
|
-
|
|
11
|
+
textModel: 'qwen-turbo',
|
|
12
|
+
visionModel: 'qwen3.5-plus',
|
|
29
13
|
|
|
30
|
-
|
|
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
|
}
|