@yorha2b-lab/autodev 7.4.1 → 7.4.3

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
@@ -1,4 +1,4 @@
1
- # AutoDev (YoRHa Bunker Engine v6.0)
1
+ # AutoDev (YoRHa Bunker Engine)
2
2
 
3
3
  [English](./README_EN.md) | 简体中文
4
4
 
@@ -69,7 +69,7 @@ BASE_URL=your_api_base_url_here
69
69
 
70
70
  🚗 **获取API Key直通车**: [阿里云百炼控制台](https://bailian.console.aliyun.com/cn-beijing?tab=doc#/doc/)
71
71
 
72
- ## 📖 指挥中心操作指南 (v6.0 工作流)
72
+ ## 📖 指挥中心操作指南
73
73
 
74
74
  启动主监控网络:
75
75
 
@@ -79,28 +79,27 @@ bunker boot
79
79
 
80
80
  启动后,地堡系统将进入全频道联动监听状态:
81
81
 
82
- | 战术操作 | 传感器/动作 | 构筑效果 |
82
+ | 战术操作 | 传感器 / 触发动作 | 作战构筑效果 |
83
83
  | :--- | :--- | :--- |
84
- | **全页构筑** | `./bunker/screenShot` | 自动生成 `index.js`、`resource.js` 并追加同步 `menus.js` |
85
- | **碎片提取** | `./bunker/screenPart` | 终端实时弹出紫色代码框,即拷即用 |
86
- | **右键考古** | 浏览器【鼠标右键】 | 触发 `scout.js` 侦察兵,一键捕获当前页面降维重构 |
87
- | **接口 JSON** | `./bunker/response` | 自动执行语义对齐,修正 `resource.js` 中的字段名 |
84
+ | **任务空投**<br>*(智能分流)* | 拖入设计图/截图至<br>`./bunker/mission/` | **司令部(commander)视觉雷达自动研判分流**:<br>• **完整 CRUD 页面** $\rightarrow$ 派出 `striker`(重装打击):生成全套目录、`index.js`、`resource.js`、Mock 数据并同步 `menus.js`<br>• **局部 UI 碎片/下拉字典** $\rightarrow$ 派出 `raider`(轻装突袭):终端弹出紫色代码框,即拷即用 |
85
+ | **遗迹考古**<br>*(一键克隆)* | 目标老系统浏览器中<br>【鼠标右键】点击任意位置 | 调起 `scout.js` 侦察兵,全屏秒级截屏并自动推导路由命名,空投至 `./bunker/mission/` 触发自动构筑 |
86
+ | **全频道通电**<br>*(Swagger 对齐)* | 配置 `apiDoc` 启动地堡 | `council.js` 启动语义雷达与本地 NLP 分词,自动匹配真实接口、请求方式(GET/POST/DELETE)与路径变量,并同步后端 Enum 基因字典 |
87
+ | **神之塔嗅探**<br>*(抓包自愈)* | 将业务代理目标指向<br>`http://localhost:42153` | `tower.js` 实时拦截真实网络响应,`reconciler.js` 自动比对并物理覆写修正 `resource.js` 中的字段名 |
88
88
 
89
89
  ## 📁 地堡结构说明
90
90
 
91
91
  ```text
92
92
  your-project/
93
- ├── bunker/ # 地堡传感器与配置
94
- │ ├── config.js # 地堡配置文件
95
- │ ├── screenShot/ # 全页截图接收站
96
- │ ├── screenPart/ # 碎片截图接收站
97
- │ └── response/ # 响应对齐接收站
98
- ├── mock/ # 自动伪造的 Mock 数据
93
+ ├── bunker/ # 地堡前哨基地与战术传感器
94
+ │ ├── .env # 神经云连接密钥 (API Key)
95
+ │ ├── config.js # 地堡战略配置文件 (支持热重载)
96
+ │ ├── mission/ # 统一作战任务空投舱 (设计图/截图投放点,司令部自动分流)
97
+ │ └── .chrome_session/ # 侦察兵 (scout) 浏览器会话与缓存持久化目录
98
+ ├── mock/ # 9S 自动执行数据伪装的 Mock 数据包
99
99
  └── src/
100
- ├── pages/ # 自动构建的前端页面代码
100
+ ├── pages/ # 寄叶部队自动构筑的前端业务页面 (视图与 Schema 解耦)
101
101
  └── utils/
102
- └── menus.js # 自动同步的动态菜单配置
103
- ```
102
+ └── menus.js # 自动同步的战区菜单路由配置
104
103
 
105
104
  ## ⚙️ 配置
106
105
 
package/README_EN.md CHANGED
@@ -1,4 +1,4 @@
1
- # AutoDev (YoRHa Bunker Engine v6.0)
1
+ # AutoDev (YoRHa Bunker Engine)
2
2
 
3
3
  English | [简体中文](./README.md)
4
4
 
@@ -69,7 +69,7 @@ BASE_URL=your_api_base_url_here
69
69
 
70
70
  🚗 **Get API Key**: [Alibaba Cloud Bailian Console](https://bailian.console.aliyun.com/)
71
71
 
72
- ## 📖 Command Center Operations Guide (v6.0 Workflow)
72
+ ## 📖 Command Center Operations Guide
73
73
 
74
74
  Start the main monitoring network:
75
75
 
@@ -77,30 +77,29 @@ Start the main monitoring network:
77
77
  bunker boot
78
78
  ```
79
79
 
80
- Upon launch, the Bunker system enters all-channel monitoring mode:
80
+ Upon booting, the Bunker enters **Full-Channel Active Reconnaissance State**:
81
81
 
82
- | Tactical Action | Sensor / Target | Construction Output |
82
+ | Tactical Operation | Sensor / Trigger | Construction Objective & Output |
83
83
  | :--- | :--- | :--- |
84
- | **Full Page** | `./bunker/screenShot` | Auto-generates `index.js`, `resource.js`, and syncs `menus.js` |
85
- | **Fragment** | `./bunker/screenPart` | Terminal outputs copy-pasteable UI code snippets in real-time |
86
- | **Archeology** | Browser [Right-Click] | Triggers `scout.js` unit to capture and refactor current page |
87
- | **API Alignment** | `./bunker/response` | Auto-aligns semantics and fixes field names in `resource.js` |
84
+ | **Mission Drop**<br>*(Autonomous Routing)* | Drop mockups/screenshots into<br>`./bunker/mission/` | **Headquarters (`commander`) visual radar automatically analyzes and routes:**<br>• **Full CRUD Page** $\rightarrow$ Dispatches `striker` (Heavy Assault): Generates complete directory, `index.js`, `resource.js`, 9S Data Camouflage (Mock), and synchronizes `menus.js`.<br>• **UI Fragment / Dropdown Enum** $\rightarrow$ Dispatches `raider` (Tactical Extraction): Outputs styled terminal code block, ready for instant physical assembly. |
85
+ | **Remains Archaeology**<br>*(One-Click Clone)* | **[Right-Click]** anywhere on the target legacy web application | Awakens `scout.js` reconnaissance unit to capture a full-page snapshot, derive semantic route naming, and auto-airdrop the asset into `./bunker/mission/` to trigger immediate construction. |
86
+ | **Full-Channel Link**<br>*(Swagger / OpenAPI)* | Configure `apiDoc` and boot Bunker | `council.js` engages local NLP semantic radar to automatically match real endpoints, HTTP methods (GET/POST/DELETE), and RESTful path variables via ES6 template literals, while synchronizing backend Enum genomes. |
87
+ | **The Tower Sniffing**<br>*(Runtime Self-Healing)* | Direct local proxy target to<br>`http://localhost:42153` | `tower.js` intercepts live runtime JSON responses, prompting `reconciler.js` to physically mutate and self-heal field discrepancies in `resource.js` in-place. |
88
88
 
89
- ## 📁 Bunker Architecture Overview
89
+ ## 📁 Bunker Outpost Topology
90
90
 
91
91
  ```text
92
92
  your-project/
93
- ├── bunker/ # Bunker sensors and configuration
94
- │ ├── config.js # Bunker configuration file
95
- │ ├── screenShot/ # Full-page screenshot receiver
96
- │ ├── screenPart/ # UI fragment receiver
97
- │ └── response/ # Response alignment receiver
98
- ├── mock/ # Auto-generated Mock data
93
+ ├── bunker/ # Bunker Tactical Outpost & Sensors
94
+ │ ├── .env # Neural Cloud Link Credentials (API Key)
95
+ │ ├── config.js # Strategic Configuration (Hot-reloadable)
96
+ │ ├── mission/ # Unified Tactical Airdrop Bay (Drag & drop screenshots here)
97
+ │ └── .chrome_session/ # Scout Browser Persistent Session & Cache
98
+ ├── mock/ # 9S Automated Data Camouflage Payloads (Mock APIs)
99
99
  └── src/
100
- ├── pages/ # Auto-built frontend page code
100
+ ├── pages/ # YoRHa-Constructed Frontend Units (Decoupled View & Schema)
101
101
  └── utils/
102
- └── menus.js # Auto-synced dynamic menu configuration
103
- ```
102
+ └── menus.js # Synchronized Theater Menu & Routing Configurations
104
103
 
105
104
  ## ⚙️ Configuration
106
105
 
package/bin/bunker.js CHANGED
@@ -8,6 +8,7 @@ const local = Intl.DateTimeFormat().resolvedOptions().locale.toUpperCase()
8
8
 
9
9
  const { matchDialog, terminalCollapse } = require('../src/logistics/presenter')
10
10
 
11
+ let isTerminating = false
11
12
  const recruiter = require('../src/headquarters/recruiter')
12
13
  const dialogues = recruiter(path.join(__dirname, '../src/dialogues'))
13
14
  const dialog = matchDialog(local, dialogues) ?? dialogues['EN-US']
@@ -62,10 +63,13 @@ program
62
63
  require('../src/headquarters/observer')(bunker)
63
64
  result.yorha.operator6O.report(dialog.operator6O.call2B)
64
65
  process.on('SIGINT', async () => {
66
+ if (isTerminating) return
67
+ isTerminating = true
65
68
  process.stdout.write('\r\x1b[K')
66
- result.yorha.commander.report(dialog.bunker.systemOffline, 'gray')
67
- terminalCollapse(500, dialog, result)
68
- const scout = await result.labs?.scout
69
+ const currentBunker = bunker.get()
70
+ currentBunker.yorha.commander.report(dialog.bunker.systemOffline, 'gray')
71
+ terminalCollapse(500, dialog, currentBunker)
72
+ const scout = await currentBunker.labs?.scout
69
73
  scout?.close()
70
74
  })
71
75
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yorha2b-lab/autodev",
3
- "version": "7.4.1",
3
+ "version": "7.4.3",
4
4
  "description": "基于 AI 视觉与语义协议的前端 (React+Antd) 代码构筑与旧系统重构引擎",
5
5
  "bin": {
6
6
  "bunker": "bin/bunker.js"
@@ -5,7 +5,7 @@ module.exports = ({ template, logistics }) => {
5
5
  const Handlebars = require('handlebars')
6
6
 
7
7
  Handlebars.registerHelper('raw', opt => opt.fn())
8
- Handlebars.registerHelper('stringify', (context, maxLength = 200) => context ? new Handlebars.SafeString(logistics.formater.contextStringify({ context, maxLength })) : '[]')
8
+ Handlebars.registerHelper('stringify', (context, maxLength = 200) => context ? new Handlebars.SafeString(logistics.formatter.contextStringify({ context, maxLength })) : '[]')
9
9
 
10
10
  const { hbsDir } = logistics.supporter.getConfig()
11
11
  const tplDir = !!hbsDir ? path.join(process.cwd(), hbsDir) : path.join(__dirname, `../workshop/${template}/blueprint`)
@@ -8,7 +8,7 @@ module.exports = async ({ data, fileName }) => {
8
8
 
9
9
  const { nineS, pod153 } = yorha
10
10
  const { alignResponseFields } = llm
11
- const { cleanCode } = logistics.formater
11
+ const { cleanCode } = logistics.formatter
12
12
  const { pagesDir } = logistics.supporter.getConfig()
13
13
 
14
14
  const startTime = Date.now()
@@ -5,7 +5,7 @@ module.exports = async ({ llm, yorha, dialog, logistics }) => {
5
5
 
6
6
  const { apiParser } = llm
7
7
  const { pod153, commander } = yorha
8
- const { contextStringify } = logistics.formater
8
+ const { contextStringify } = logistics.formatter
9
9
  const { apiDoc, pagesDir } = logistics.supporter.getConfig()
10
10
  const { getLocalScore, getSemanticKeywords } = logistics.analyzer
11
11
 
@@ -25,8 +25,8 @@ module.exports = {
25
25
  const { pod042 } = yorha
26
26
  const { raider } = briefings
27
27
  const { recognizePage } = llm
28
- const { formatFormItemAndColumns } = builder
29
- const { cleanCode, contextStringify } = logistics.formater
28
+ const { formatPageconfig } = builder
29
+ const { cleanCode, contextStringify } = logistics.formatter
30
30
 
31
31
  const startTime = Date.now()
32
32
 
@@ -37,14 +37,16 @@ module.exports = {
37
37
 
38
38
  const pageConfig = await recognizePage({ prompt: raider, filePath: mission.input })
39
39
 
40
- let { formItems, dictBlocks, processedColumns } = formatFormItemAndColumns({ pageConfig })
40
+ let { tabs = [] } = pageConfig
41
+ tabs = tabs.map(tab => ({ ...tab, children: `<${tab.key.at(0).toUpperCase()}${tab.key.slice(1)}/>` }))
41
42
 
43
+ let { formItems, dictBlocks, processedColumns } = formatPageconfig({ pageConfig })
42
44
  processedColumns = processedColumns.map(col => {
43
45
  delete col.type
44
46
  return col
45
47
  })
46
48
 
47
- const result = Object.fromEntries(Object.entries({ formItems, processedColumns }).filter(([key, value]) => value?.length > 0))
49
+ const result = Object.fromEntries(Object.entries({ tabs, formItems, processedColumns }).filter(([key, value]) => value?.length > 0))
48
50
 
49
51
  let mainConfigStr = cleanCode(contextStringify({ context: result }))
50
52
 
@@ -28,7 +28,7 @@ module.exports = {
28
28
  const { striker } = briefings
29
29
  const { nineS, pod042 } = yorha
30
30
  const { index, resource } = builder
31
- const { contextStringify } = logistics.formater
31
+ const { contextStringify } = logistics.formatter
32
32
  const { generateMock, recognizePage, nameSimilarity } = llm
33
33
  const { useDemo, pagesDir, utilsDir, needMock } = logistics.supporter.getConfig()
34
34
 
@@ -1,7 +1,7 @@
1
1
  module.exports = `
2
2
  识别图片页面结构输出一个JSON对象
3
3
 
4
- 任务模式:请根据图片内容,分别识别搜索表单结构和表格列结构。如果图片包含搜索区,请按Form规则输出;如果包含列表区,请按Table规则输出。
4
+ 任务模式:请根据图片内容,分别识别页面结构。如果图片是表单组件,请按Form规则输出;如果是列表组件,请按Table规则输出;如果是页签组件,请按Tabs规则输出。
5
5
 
6
6
  1. 严禁包含任何 Markdown 标签。
7
7
  2. 严禁包含注释或解释文字。
@@ -51,7 +51,10 @@ module.exports = `
51
51
  - 尾操作: 若项末尾有操作按钮(如 选择、编辑 等操作),必须存入 {renderAction:true,addonAfter:'尾操作名'} 属性。
52
52
  - 必填校验: 若图片中 label 前有红色星号,必须加入 rules:[{required:true,message:'xxx不能为空'}]。
53
53
 
54
- ## 3. 下拉选项字典 (OptionDict)
54
+ ## 3. 页签 (Tabs)
55
+ - 结构: tabs: [{label:'页签名',key:'页签英文'}]
56
+
57
+ ## 4. 下拉选项字典 (OptionDict)
55
58
  - 结构: optionDict: { 字段英文名Options: [] }
56
59
  - 内容: 数组元素必须为 {label: '', value: ''} 格式。
57
60
  `.trim()
@@ -1,10 +1,10 @@
1
1
  module.exports = ({ template, logistics, headquarters }) => {
2
2
 
3
- const { wrapCode, cleanCode, contextStringify } = logistics.formater
3
+ const { wrapCode, cleanCode, contextStringify } = logistics.formatter
4
4
  const { needMock, responseSuccess } = logistics.supporter.getConfig()
5
5
  const { indexTpl, resourceTpl } = headquarters.designer({ template, logistics })
6
6
 
7
- const formatFormItemAndColumns = ({ pageConfig }) => {
7
+ const formatPageconfig = ({ pageConfig }) => {
8
8
 
9
9
  const codePresets = {
10
10
  money: 'text => moneyRender(text)',
@@ -78,10 +78,10 @@ module.exports = ({ template, logistics, headquarters }) => {
78
78
  }
79
79
 
80
80
  return {
81
- formatFormItemAndColumns,
81
+ formatPageconfig,
82
82
  resource: ({ pageConfig }) => {
83
83
 
84
- const { formItems, processedColumns, dictBlocks } = formatFormItemAndColumns({ pageConfig })
84
+ const { formItems, processedColumns, dictBlocks } = formatPageconfig({ pageConfig })
85
85
 
86
86
  const hasTabs = pageConfig.tabs?.length > 0
87
87
  const hasFormItems = pageConfig.formItems?.length > 0
File without changes