@yorha2b-lab/autodev 6.1.2 → 7.1.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.
Files changed (39) hide show
  1. package/README.md +18 -10
  2. package/README_EN.md +18 -10
  3. package/bin/bunker.js +21 -3
  4. package/package.json +1 -1
  5. package/src/awakening/index.js +4 -2
  6. package/src/dialogues/EN-US.js +5 -2
  7. package/src/dialogues/FR-FR.js +5 -2
  8. package/src/dialogues/JA-JP.js +6 -3
  9. package/src/dialogues/RU-RU.js +5 -2
  10. package/src/dialogues/ZH-CN.js +5 -2
  11. package/src/gateway/index.js +1 -1
  12. package/src/headquarters/commander.js +37 -0
  13. package/src/headquarters/designer.js +2 -2
  14. package/src/headquarters/dispatcher.js +2 -2
  15. package/src/headquarters/observer.js +9 -18
  16. package/src/headquarters/quartermaster.js +7 -7
  17. package/src/headquarters/reconciler.js +82 -0
  18. package/src/headquarters/recruiter.js +0 -10
  19. package/src/labs/council.js +6 -6
  20. package/src/labs/scout.js +5 -5
  21. package/src/labs/tower.js +7 -19
  22. package/src/logistics/supporter.js +0 -22
  23. package/src/units/raider.js +16 -11
  24. package/src/units/striker.js +20 -14
  25. package/src/workshop/react/briefings/raider.js +1 -1
  26. package/src/workshop/react/briefings/striker.js +4 -1
  27. package/src/workshop/react/briefings/visionType.js +59 -0
  28. package/src/workshop/react/builder/index.js +6 -6
  29. package/src/dialogues/DE-DE.js +0 -66
  30. package/src/dialogues/ES-ES.js +0 -65
  31. package/src/dialogues/ID-ID.js +0 -66
  32. package/src/dialogues/IT-IT.js +0 -66
  33. package/src/dialogues/KO-KR.js +0 -66
  34. package/src/dialogues/PT-BR.js +0 -66
  35. package/src/dialogues/TR-TR.js +0 -66
  36. package/src/dialogues/ZH-TW.js +0 -66
  37. package/src/headquarters/engineer.js +0 -19
  38. package/src/units/reconciler.js +0 -98
  39. /package/src/logistics/{builder.js → formater.js} +0 -0
package/README.md CHANGED
@@ -14,20 +14,28 @@
14
14
 
15
15
  ![Auto CRUD Copilot 2.0 Demo](https://github.com/user-attachments/assets/287d0db1-d0b0-4290-87da-751ba638655e)
16
16
 
17
- ## 🌟 v6.0 地堡架构升级
17
+ ## 🌟 v7.0 地堡架构升级
18
18
 
19
- 在 v6.0 时代,AutoDev 全面升级为模块化地堡架构,以 Headquarters 为核心,通过独立单位完成监听、调度、构筑与外部通信。
20
- - 🕵️ **旧系统侦察 (Scout)**:Puppeteer 无头侦察兵,在旧项目网页上**【单击右键】**即可秒级捕获快照并自动重构!
21
- - 🗼 **现网防御塔 (Tower)**:搭建 42153 战术代理端口,代理真实 XHR/Fetch 流量,自动将现网数据反向填装入 `resource.js`。
22
- - 🏛️ **议会自动通电 (Council)**:自动对接 OpenAPI/Swagger 文档,自动提炼枚举信息,并更新 `BUNKER_API_ANCHOR` 语义锚点。
19
+ 在 v7.0 时代,AutoDev 进一步升级为 **Mission-Driven 的模块化地堡架构**。
20
+
21
+ 所有任务统一进入 `Mission`,由 **Headquarters** 中的 **Commander** 识别任务需求、匹配最合适的 Unit,并交由 Dispatcher 调度执行。
22
+
23
+ Unit 不再绑定固定输入目录,而是通过声明自身的 `capabilities` 主动参与任务匹配,让地堡可以根据任务动态组织作战单位。
24
+
25
+ - 🧠 **任务指挥 (Commander)**:识别任务类型与所需能力,从全部 Units 中选择最合适的执行单位。
26
+ - ⚔️ **作战单位 (Units)**:通过能力声明参与任务匹配,负责具体的页面构筑、语义对齐等任务。
27
+ - 🕵️ **数字考古 (Scout)**:Puppeteer 无头侦察兵,从旧系统捕获页面并生成重构任务。
28
+ - 🗼 **现网防御塔 (Tower)**:代理真实 XHR/Fetch 流量,将现网数据直接送入地堡任务链。
29
+ - 🏛️ **议会 (Council)**:解析 OpenAPI / Swagger 文档,提炼枚举与接口语义,为构筑任务提供协议情报。
23
30
 
24
31
  ## ✨ 特性
25
32
 
26
- - 🖼️ **全页构筑 (Page)**: 截图丢入 `./bunker/screenShot`,Pod 042 自动生成带 Table/Form/Tabs 的完整 CRUD 页面并追加菜单。
27
- - 🧩 **碎片提取 (Part)**: 局部截图丢入 `./bunker/screenPart`,终端瞬间弹出“即插即用”的 UI 配置代码块。
28
- - 🕵️ **右键考古 (Scout)**: Puppeteer 无头浏览器巡检,网页任意处点击【鼠标右键】即可秒级一键捕获页面重构。
29
- - 🔌 **语义对齐 (API)**: 接口 JSON 丢入 `./bunker/response`,自动发现并修正前后端字段语义差异,减少手工对齐工作。
30
- - 🔧 **智能装配**: 自动补全 import 语句、日期格式转换、金额千分位、枚举字典以及 OSS 上传等实战逻辑。
33
+ - 🖼️ **全页构筑 (Page)**:输入完整页面截图,Commander 自动识别构筑需求并调度对应 Unit,生成包含 Table / Form / Tabs 的完整 CRUD 页面及菜单。
34
+ - 🧩 **碎片提取 (Part)**:输入局部 UI 截图,自动识别为组件构筑任务,生成可直接使用的 UI 配置代码。
35
+ - 🕵️ **数字考古 (Scout)**:通过 Puppeteer 巡检旧系统,浏览器中右键即可捕获当前页面,并将其转换为重构任务。
36
+ - 🗼 **现网数据采集 (Tower)**:代理真实 XHR / Fetch 请求,将运行中的后端响应直接送入任务链,无需手工准备 JSON。
37
+ - 🔌 **语义对齐 (Reconciler)**:分析后端响应与前端资源定义之间的字段差异,自动修正 `resource.js`。
38
+ - 🔧 **智能装配**:自动补全 import、日期格式转换、金额千分位、枚举字典、OSS 上传等实战逻辑。
31
39
 
32
40
  ## 🚀 快速开始
33
41
 
package/README_EN.md CHANGED
@@ -14,20 +14,28 @@ AI Vision and Semantic Protocol-based Frontend (React + Ant Design) Code Constru
14
14
 
15
15
  ![Auto CRUD Copilot 2.0 Demo](https://github.com/user-attachments/assets/287d0db1-d0b0-4290-87da-751ba638655e)
16
16
 
17
- ## 🌟 v6.0 Bunker Architecture Upgrade
17
+ ## 🌟 v7.0 Bunker Architecture Upgrade
18
18
 
19
- In the v6.0 era, AutoDev has fully upgraded to a modular Bunker architecture. Centered around Headquarters, it accomplishes monitoring, dispatching, construction, and external communication through independent units.
20
- - 🕵️ **Legacy System Recon (Scout)**: Puppeteer headless scout unit. Simply **[Right-Click]** anywhere on legacy web pages to capture instant snapshots and auto-refactor!
21
- - 🗼 **Live Proxy Tower (Tower)**: Tactical proxy server on port 42153. Proxies live XHR/Fetch traffic and automatically hot-loads real production data into `resource.js`.
22
- - 🏛️ **OpenAPI Council (Council)**: Auto-connects Swagger/OpenAPI docs, automatically extracts enum information, and updates `BUNKER_API_ANCHOR` semantic anchors.
19
+ In v7.0, AutoDev evolves into a **Mission-Driven modular bunker architecture**.
20
+
21
+ All tasks are unified as `Mission` objects and routed through **Headquarters**. The **Commander** analyzes mission requirements, identifies the capabilities needed, selects the most suitable Unit, and dispatches it for execution.
22
+
23
+ Units are no longer bound to fixed input directories. Instead, each Unit declares its own `capabilities` and participates dynamically in mission matching, allowing the Bunker to assemble the right team for each task.
24
+
25
+ - 🧠 **Mission Command (Commander)**: Analyzes mission requirements and selects the most suitable Unit from all available capabilities.
26
+ - ⚔️ **Combat Units (Units)**: Declare their capabilities and participate in mission matching, handling tasks such as page reconstruction and semantic alignment.
27
+ - 🕵️ **Digital Archaeology (Scout)**: A Puppeteer-based reconnaissance unit that captures pages from legacy systems and turns them into reconstruction missions.
28
+ - 🗼 **Live Network Defense (Tower)**: Proxies real XHR / Fetch traffic and feeds live backend responses directly into the Bunker mission pipeline.
29
+ - 🏛️ **Council**: Parses OpenAPI / Swagger documentation, extracting enums and API semantics to provide protocol intelligence for construction missions.
23
30
 
24
31
  ## ✨ Features
25
32
 
26
- - 🖼️ **Full-Page Construction (Page)**: Drop a screenshot into `./bunker/screenShot`, and Pod 042 auto-generates complete CRUD pages with Table/Form/Tabs and appends menus.
27
- - 🧩 **Fragment Extraction (Part)**: Drop a partial screenshot into `./bunker/screenPart`, and the terminal instantly outputs plug-and-play UI config code blocks.
28
- - 🕵️ **Right-Click Archeology (Scout)**: Puppeteer headless browser inspection. Right-click anywhere in the browser to capture and refactor pages in seconds.
29
- - 🔌 **Semantic Alignment (API)**: Drop an API JSON into `./bunker/response` to automatically discover and fix frontend/backend field semantic differences, reducing manual alignment work.
30
- - 🔧 **Smart Assembly**: Auto-completes import statements, date format conversions, currency separators, enum dictionaries, and OSS upload logic.
33
+ - 🖼️ **Full Page Reconstruction (Page)**: Feed a complete page screenshot into the Bunker. The Commander identifies the required capabilities and dispatches the appropriate Unit to generate a complete CRUD page with Table / Form / Tabs and synchronized menus.
34
+ - 🧩 **UI Fragment Extraction (Part)**: Feed a partial UI screenshot and let the Bunker identify it as a component reconstruction mission, generating ready-to-use UI configuration code.
35
+ - 🕵️ **Digital Archaeology (Scout)**: Use Puppeteer to inspect legacy systems. Right-click anywhere in the browser to capture the current page and turn it into a reconstruction mission.
36
+ - 🗼 **Live Data Acquisition (Tower)**: Proxy real XHR / Fetch requests and feed live backend responses directly into the mission pipeline, eliminating the need to prepare response JSON manually.
37
+ - 🔌 **Semantic Alignment (Reconciler)**: Analyze differences between backend responses and frontend resource definitions, then automatically reconcile fields in `resource.js`.
38
+ - 🔧 **Smart Assembly**: Automatically handle imports, date formatting, number formatting, enum dictionaries, OSS uploads, and other practical frontend engineering tasks.
31
39
 
32
40
  ## 🚀 Quick Start
33
41
 
package/bin/bunker.js CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ const fs = require('fs')
2
3
  const path = require('path')
3
4
  const chalk = require('chalk')
4
5
  const pkg = require('../package.json')
@@ -6,6 +7,7 @@ const { program } = require('commander')
6
7
  const local = Intl.DateTimeFormat().resolvedOptions().locale.toUpperCase()
7
8
 
8
9
  const { matchDialog, terminalCollapse } = require('../src/logistics/presenter')
10
+
9
11
  const recruiter = require('../src/headquarters/recruiter')
10
12
  const dialogues = recruiter(path.join(__dirname, '../src/dialogues'))
11
13
  const dialog = matchDialog(local, dialogues) ?? dialogues['EN-US']
@@ -20,13 +22,28 @@ program
20
22
  .command('init')
21
23
  .description(dialog.bunker.initDesc)
22
24
  .action(() => {
25
+
26
+ const equipments = []
27
+ const root = process.cwd()
28
+ const { template } = program.opts()
29
+ const workshop = path.join(__dirname, `../src/workshop/${template}`)
30
+ const quartermaster = require('../src/headquarters/quartermaster')({ dialog })
31
+ const { hbsDir, hooksDir, utilsDir, componentsDir } = require('../src/logistics/supporter').getConfig()
32
+
33
+ if (!hbsDir) {
34
+ equipments.push(...fs.readdirSync(`${workshop}/kit`).map(file => ({ from: `${workshop}/kit/${file}`, to: `${path.join(root, utilsDir, file)}` })))
35
+ equipments.push(...fs.readdirSync(`${workshop}/extensions`).map(file => ({ from: `${workshop}/extensions/${file}`, to: `${path.join(root, hooksDir, file)}` })))
36
+ equipments.push(...fs.readdirSync(`${workshop}/standardParts`).map(file => ({ from: `${workshop}/standardParts/${file}`, to: `${path.join(root, componentsDir, file)}` })))
37
+ }
38
+
23
39
  const outpost = {
40
+ dirs: [`${path.join(root, 'bunker', 'mission')}`],
24
41
  files: [
25
- { from: '.env.example', to: '.env', exist: 'envCheck', success: 'envCopy' },
26
- { from: 'config.js', to: 'config.js', exist: 'configCheck', success: 'configCopy' }
42
+ ...equipments,
43
+ { from: path.join(__dirname, `../.env.example`), to: `${path.join(root, 'bunker', '.env')}`, exist: 'envCheck', success: 'envCopy' },
44
+ { from: path.join(__dirname, `../config.js`), to: `${path.join(root, 'bunker', 'config.js')}`, exist: 'configCheck', success: 'configCopy' }
27
45
  ]
28
46
  }
29
- const quartermaster = require('../src/headquarters/quartermaster')({ root: process.cwd(), dialog })
30
47
  Object.entries(outpost).forEach(([type, items]) => items.forEach(quartermaster[type]))
31
48
  const bunkerCmd = chalk.yellow(`'bunker': 'bunker boot'`)
32
49
  console.log(chalk.cyan(dialog.bunker.initComplete(bunkerCmd)))
@@ -43,6 +60,7 @@ program
43
60
  return
44
61
  }
45
62
  require('../src/headquarters/observer')(bunker)
63
+ result.yorha.operator6O.report(dialog.operator6O.call2B)
46
64
  process.on('SIGINT', () => {
47
65
  result.yorha.commander.report(dialog.bunker.systemOffline, 'gray')
48
66
  result.labs?.scout?.close()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yorha2b-lab/autodev",
3
- "version": "6.1.2",
3
+ "version": "7.1.0",
4
4
  "description": "基于 AI 视觉与语义协议的前端 (React+Antd) 代码构筑与旧系统重构引擎",
5
5
  "bin": {
6
6
  "bunker": "bin/bunker.js"
@@ -9,6 +9,8 @@ module.exports = {
9
9
 
10
10
  const recruiter = require('../headquarters/recruiter')
11
11
  const logistics = recruiter(path.join(__dirname, '../logistics'))
12
+ const headquarters = recruiter(path.join(__dirname, '../headquarters'))
13
+
12
14
  const yorha = logistics.presenter.yorha()
13
15
 
14
16
  const builderPath = path.join(__dirname, `../workshop/${template}/builder`)
@@ -22,15 +24,15 @@ module.exports = {
22
24
  dialog,
23
25
  template,
24
26
  logistics,
27
+ headquarters,
25
28
  units: recruiter(path.join(__dirname, '../units')),
26
- designer: require('../headquarters/designer')({ logistics, template }),
27
29
  briefings: recruiter(path.join(__dirname, `../workshop/${template}/briefings`)),
28
30
  }
29
31
 
30
32
  if (version) {
31
33
  await logistics.presenter.bootSequence(version, local)
32
34
  }
33
- require('../headquarters/engineer')(accessPoint)
35
+
34
36
  const llm = require('../gateway')(accessPoint)
35
37
  const builder = require(builderPath)(accessPoint)
36
38
  const labs = require('../labs')({ llm, ...accessPoint })
@@ -11,7 +11,7 @@ module.exports = {
11
11
  simulate: 'Real-fire request intercepted. Dropping simulation package: example.json',
12
12
  uploadVisualMetadata: 'Uploading visual metadata to Command for semantic analysis...',
13
13
  partialConstruction: time => `Report: Partial construction achieved. Elapsed: ${time}s`,
14
- capturedPage: pageName => `Page captured [${pageName}] -> Transmitted to screenShot directory`,
14
+ capturedPage: pageName => `Page captured [${pageName}] -> Transmitted to mission directory`,
15
15
  constructionAborted: virus => `Construction aborted. Logic virus or timeout detected: ${virus}`,
16
16
  visualPartCaptured: `Partial visual sample detected. Executing 'Fragment Construction Protocol'...`,
17
17
  scoutReady: '[Right-Click Snapshot Ready] Right-click anywhere on the webpage to capture instantly.',
@@ -24,7 +24,6 @@ module.exports = {
24
24
  pod153: {
25
25
  signalLinkFault: virus => `Signal Link Fault: ${virus}`,
26
26
  signalSynchronized: count => `Signal Synchronized: ${count} nodes energized`,
27
- formatError: 'Data format is not standard JSON, will try to align by character',
28
27
  alignmentFailed: virus => `Alignment failed. Encountered powerful API firewall: ${virus}`,
29
28
  autonomousAddressing: `Initiating 'Full-Channel Autonomous Addressing Protocol [Semantic Scan]'...`,
30
29
  inactiveModule: fileName => `Inactive module: [${fileName}]. Requesting 9S for precise alignment...`,
@@ -44,11 +43,15 @@ module.exports = {
44
43
  desc: 'AI-powered frontend CRUD code generator',
45
44
  dataSynced: 'All data synced to Bunker storage nodes',
46
45
  initDesc: 'Initialize Bunker construction environment',
46
+ missionUnknown: 'Unable to classify mission requirements.',
47
47
  star: 'If it saves you time, feel free to give it a ⭐ on GitHub',
48
48
  copyTemplateError: virus => `Template construction failed: ${virus}`,
49
49
  towerOnline: port => `Signal Intercept Tower Online [Band: ${port}]`,
50
+ confirmEnemy: 'Target confirmed. Deploying the most suitable unit...',
51
+ missionFailed: 'Mission assignment failed. No suitable unit available.',
50
52
  linkSevered: 'Link Severed: Check network status or Black Box resonance',
51
53
  systemOffline: 'Disconnecting Neural Link, Executing Physical Assembly...',
54
+ detectedEnemy: 'Unidentified entity detected. Initiating combat analysis...',
52
55
  accessDenied: 'YoRHa Command Center Access Denied: Invalid API Key or quota exhausted!',
53
56
  bootDesc: 'Start full-channel linked monitoring: Coordinated Page/Part/API construction',
54
57
  copyEnum: `│ Backend Enums detected \n│ Weld the code below into the module's resource center`,
@@ -10,7 +10,7 @@ module.exports = {
10
10
  extractingUiMetadata: 'Extraction des métadonnées UI depuis le réseau neuronal cloud...',
11
11
  partialConstruction: time => `Rapport : Construction partielle terminée. Durée : ${time}s`,
12
12
  simulate: 'Requête réelle détectée. Déploiement du paquet de simulation standard : example.json',
13
- capturedPage: pageName => `Page capturée [${pageName}] -> Transférée vers le répertoire screenShot`,
13
+ capturedPage: pageName => `Page capturée [${pageName}] -> Transférée vers le répertoire mission`,
14
14
  scoutReady: '[Capture par Clic Droit Prête] Effectuez un clic droit n’importe où sur la page web pour capturer.',
15
15
  visualPartCaptured: 'Fragment visuel local détecté. Activation du « protocole de construction fragmentaire »...',
16
16
  uploadVisualMetadata: 'Transmission des métadonnées visuelles au quartier général. Analyse sémantique en cours...',
@@ -24,7 +24,6 @@ module.exports = {
24
24
  pod153: {
25
25
  signalLinkFault: virus => `Erreur de liaison du signal : ${virus}`,
26
26
  signalSynchronized: count => `${count} nœuds synchronisés. Alimentation confirmée`,
27
- formatError: 'Format JSON non standard détecté. Tentative de synchronisation avec les données brutes',
28
27
  inactiveModule: fileName => `Module non activé détecté [${fileName}]. Analyse haute précision demandée à 9S`,
29
28
  autonomousAddressing: 'Activation du « protocole d’adressage automatique multi-canaux [version analyse sémantique] »...',
30
29
  alignmentFailed: virus => `Échec de synchronisation du signal. Les données API sont bloquées par un pare-feu puissant : ${virus}`,
@@ -42,9 +41,13 @@ module.exports = {
42
41
  desc: 'Générateur de code CRUD frontend piloté par IA',
43
42
  envCheck: 'Fichier .env existant détecté. Génération ignorée',
44
43
  configCheck: 'Fichier config.js existant détecté. Génération ignorée',
44
+ missionUnknown: 'Impossible de déterminer les exigences de la mission.',
45
45
  copyTemplateError: virus => `Échec de construction du modèle : ${virus}`,
46
+ confirmEnemy: 'Cible confirmée. Déploiement de l’unité la plus adaptée...',
47
+ detectedEnemy: 'Cible non identifiée détectée. Lancement de l’analyse tactique...',
46
48
  accessDenied: 'Accès au quartier général refusé : clé API invalide ou quota épuisé',
47
49
  towerOnline: port => `Tour d’interception des signaux en ligne [Fréquence : ${port}]`,
50
+ missionFailed: 'Échec de l’attribution de la mission. Aucune unité appropriée trouvée.',
48
51
  bootDesc: 'Démarrer la surveillance multi-canaux : construction coordonnée Page/Part/API',
49
52
  initDesc: 'Initialiser l’environnement de construction du Bunker dans le répertoire actuel',
50
53
  towerConnected: port => `Ordre : configurez votre cible proxy vers http://localhost:${port}`,
@@ -15,7 +15,7 @@ module.exports = {
15
15
  partialConstructionAborted: virus => `[警告] 断片構築失敗。論理干渉を検出:${virus}`,
16
16
  simulate: '実弾リクエストを検知。標準シミュレーションパッケージ example.json を投下します',
17
17
  constructionAborted: virus => `構築中断。論理ウイルスまたは接続タイムアウトを検出:${virus}`,
18
- capturedPage: pageName => `ページデータを取得【${pageName}】-> screenShot ディレクトリへ送信完了`,
18
+ capturedPage: pageName => `ページデータを取得【${pageName}】-> mission ディレクトリへ送信完了`,
19
19
  scoutReady: '【スナップショット準備完了】ウェブページ上の任意の位置で【右クリック】すると即座に撮影されます。',
20
20
  visualCaptured: fileName => `視覚センサーによる捕捉完了: [${fileName}]。Bunkerリソースを展開し物理構築を開始します`,
21
21
  intercept: fileName => `モジュール [${fileName}] は既にBunkerデータベースに存在。データ上書き防止のため構築プロトコルを中断`,
@@ -23,7 +23,6 @@ module.exports = {
23
23
  },
24
24
  pod153: {
25
25
  signalLinkFault: virus => `シグナルリンク障害: ${virus}`,
26
- formatError: '非標準JSON形式を検出。原始文字列による同期処理を試行します',
27
26
  signalSynchronized: count => `${count}個のノード同期完了。電力供給を確認`,
28
27
  autonomousAddressing: '「全チャンネル自動アドレス指定プロトコル [セマンティック解析版]」を起動...',
29
28
  inactiveModule: fileName => `未通電モジュール [${fileName}] を検出。9Sによる高精度照合を要求します`,
@@ -38,18 +37,22 @@ module.exports = {
38
37
  envCopy: '.envストレージ保存完了',
39
38
  systemStandby: 'システム待機状態...',
40
39
  configCopy: 'config.jsストレージ保存完了',
40
+ missionUnknown: 'ミッション要件を特定できません。',
41
41
  desc: 'AI駆動型フロントエンドCRUDコード生成システム',
42
42
  initDesc: '現在のディレクトリにBunker構築環境を初期化',
43
43
  argDesc: 'フロントエンドフレームワークテンプレートを指定',
44
44
  envCheck: '既存の.envファイルを検出。生成処理をスキップ',
45
+ confirmEnemy: '目標を確認。最適戦闘ユニットを展開します...',
46
+ detectedEnemy: '未確認対象を検知。戦術分析を開始します...',
45
47
  dataSynced: '全構築データをBunkerストレージノードへ同期完了',
46
- configCheck: '既存のconfig.jsファイルを検出。生成処理をスキップ',
47
48
  copyTemplateError: virus => `テンプレート構築失敗: ${virus}`,
49
+ configCheck: '既存のconfig.jsファイルを検出。生成処理をスキップ',
48
50
  star: 'このシステムが役立った場合、GitHubでスターをお願いします ⭐',
49
51
  towerOnline: port => `シグナル迎撃塔オンライン [周波数: ${port}]`,
50
52
  bootDesc: '全チャンネル連携監視を開始:Page/Part/API協調構築をサポート',
51
53
  systemOffline: 'ニューラルクラウド接続を切断中。データを物理封印します...',
52
54
  accessDenied: '司令部アクセス拒否:API Keyが無効、または利用上限に達しています',
55
+ missionFailed: 'ミッションの割り当てに失敗。適合する戦闘ユニットが見つかりません。',
53
56
  linkSevered: '接続断絶:ネットワーク状態またはブラックボックス共鳴を確認してください',
54
57
  disclaimer: '解析結果は参考情報です。最終判断は各ユニットが実環境に基づいて行ってください',
55
58
  towerConnected: port => `指令:プロキシ対象を http://localhost:${port} に設定してください`,
@@ -8,8 +8,8 @@ module.exports = {
8
8
  capturedToast: 'Визуальные разведданные захвачены. Начиная передачу...',
9
9
  startScout: 'Активация режима [Тактический снимок правой кнопкой мыши]...',
10
10
  extractingUiMetadata: 'Извлечение метаданных UI из нейронной облачной сети...',
11
+ capturedPage: pageName => `Страница захвачена [${pageName}] -> Передано в каталог mission`,
11
12
  partialConstruction: time => `Доклад: частичная сборка завершена. Время обработки: ${time}s`,
12
- capturedPage: pageName => `Страница захвачена [${pageName}] -> Передано в каталог screenShot`,
13
13
  uploadVisualMetadata: 'Передача визуальных метаданных в штаб. Запуск семантического анализа...',
14
14
  partialRecommendation: '│ Рекомендация: вручную интегрируйте указанный блок кода в целевой файл',
15
15
  simulate: 'Обнаружен реальный запрос. Развёртывание стандартного симуляционного пакета: example.json',
@@ -23,7 +23,6 @@ module.exports = {
23
23
  },
24
24
  pod153: {
25
25
  signalLinkFault: virus => `Ошибка сигнального соединения: ${virus}`,
26
- formatError: 'Обнаружен нестандартный формат JSON. Попытка синхронизации исходных данных',
27
26
  signalSynchronized: count => `Синхронизация ${count} узлов завершена. Питание подтверждено`,
28
27
  inactiveModule: fileName => `Обнаружен неактивный модуль [${fileName}]. Запрошен высокоточный анализ 9S`,
29
28
  autonomousAddressing: 'Запуск «протокола автоматической адресации всех каналов [семантическая версия]»...',
@@ -40,9 +39,11 @@ module.exports = {
40
39
  argDesc: 'Указать шаблон frontend-фреймворка',
41
40
  desc: 'AI-система генерации frontend CRUD-кода',
42
41
  systemStandby: 'Система находится в режиме ожидания...',
42
+ missionUnknown: 'Не удалось определить требования миссии.',
43
43
  copyTemplateError: virus => `Ошибка сборки шаблона: ${virus}`,
44
44
  initDesc: 'Инициализация среды сборки Bunker в текущем каталоге',
45
45
  envCheck: 'Обнаружен существующий файл .env. Генерация пропущена',
46
+ detectedEnemy: 'Обнаружена неизвестная цель. Начинаю тактический анализ...',
46
47
  dataSynced: 'Все данные сборки синхронизированы с узлом хранения Bunker',
47
48
  configCheck: 'Обнаружен существующий файл config.js. Генерация пропущена',
48
49
  towerOnline: port => `Башня перехвата сигналов активна [Частота: ${port}]`,
@@ -51,6 +52,8 @@ module.exports = {
51
52
  towerConnected: port => `Приказ: направьте прокси-цель на http://localhost:${port}`,
52
53
  star: 'Если эта система помогла вам сэкономить время, поставьте звезду на GitHub ⭐',
53
54
  linkSevered: 'Соединение разорвано: проверьте состояние сети или резонанс чёрного ящика',
55
+ missionFailed: 'Назначение миссии не удалось. Подходящее боевое подразделение не найдено.',
56
+ confirmEnemy: 'Цель подтверждена. Развёртывание наиболее подходящего боевого подразделения...',
54
57
  systemOffline: 'Отключение нейронного облачного соединения. Физическое запечатывание данных...',
55
58
  frameworkNotSupported: template => `Фреймворк [${template}] пока не поддерживается. Pull Request приветствуются`,
56
59
  disclaimer: 'Результаты сопоставления являются справочными. Каждая единица должна выполнить собственную корректировку',
@@ -15,7 +15,7 @@ module.exports = {
15
15
  partialRecommendation: '│ 建议:请手动将上述代码块物理装配至您的目标文件中',
16
16
  scoutReady: '【右键快照模式就绪】在浏览器页面任意位置点击【鼠标右键】即可秒截屏',
17
17
  constructionAborted: virus => `构筑中断。检测到逻辑病毒或连接超时:${virus}`,
18
- capturedPage: pageName => `捕获页面【${pageName}】-> 已投递至 screenShot 目录`,
18
+ capturedPage: pageName => `捕获页面【${pageName}】-> 已投递至 mission 目录`,
19
19
  partialConstructionAborted: virus => `[警告] 碎片构筑失败。系统检测到逻辑干扰:${virus}`,
20
20
  visualCaptured: fileName => `视觉传感器捕捉完成: [${fileName}]。正在调配地堡资源进行物理构筑...`,
21
21
  intercept: fileName => `模块 [${fileName}] 已存在于地堡数据库中。为了防止数据覆盖,构筑协议已跳过`,
@@ -23,7 +23,6 @@ module.exports = {
23
23
  },
24
24
  pod153: {
25
25
  signalLinkFault: virus => `信号链路故障: ${virus}`,
26
- formatError: '数据格式非标准 JSON,将尝试原始字符对齐',
27
26
  autonomousAddressing: `启动‘全频道自动寻址协议 [语义扫描版]’...`,
28
27
  signalSynchronized: count => `信号同步完成,${count} 个节点已通电`,
29
28
  alignmentFailed: virus => `信号对齐失败。接口数据遭遇强力防火墙:${virus}`,
@@ -40,11 +39,15 @@ module.exports = {
40
39
  systemStandby: '系统待机中...',
41
40
  desc: 'AI驱动的前端CRUD代码生成器',
42
41
  configCopy: 'config.js 存储完毕',
42
+ missionUnknown: '无法解析任务需求。',
43
43
  initDesc: '在当前目录初始化地堡构筑环境',
44
44
  envCheck: '终端已存在 .env 文件,跳过生成',
45
+ confirmEnemy: '目标确认。正在部署最适作战单位...',
45
46
  dataSynced: '所有构筑数据已同步至 Bunker 存储节点',
47
+ missionFailed: '任务分配失败。未找到适配作战单位。',
46
48
  configCheck: '终端已存在 config.js 文件,跳过生成',
47
49
  linkSevered: '连接中断:请检查网络状态或黑盒共鸣情况',
50
+ detectedEnemy: '检测到未知目标。开始执行战术分析...',
48
51
  systemOffline: '正在断开神经云链接,执行数据物理封存...',
49
52
  copyTemplateError: virus => `模板构筑失败: ${virus}`,
50
53
  star: '如果它能帮您节省时间,请在 GitHub 上给它点个赞 ⭐',
@@ -38,7 +38,7 @@ module.exports = ({ yorha, dialog, logistics, briefings }) => {
38
38
  ]
39
39
  })
40
40
  },
41
- recognizePage: async ({ prompt, filePath, schema }) => {
41
+ recognizePage: async ({ schema, prompt, filePath }) => {
42
42
  const compressedBuffer = await sharp(filePath)
43
43
  .resize(1280, null, { withoutEnlargement: true })
44
44
  .jpeg({ quality: 80 })
@@ -0,0 +1,37 @@
1
+ /**
2
+ * YoRHa Bunker Construction System
3
+ * This file is part of Bunker.
4
+ * Bunker is free software: you can redistribute it and/or modify
5
+ * it under the terms of the GNU Affero General Public License as
6
+ * published by the Free Software Foundation, either version 3 of the
7
+ * License, or (at your option) any later version.
8
+ * (c) 2026 [yorha2b-lab]. Glory to Mankind.
9
+ */
10
+
11
+ module.exports = bunker => {
12
+
13
+ const acp = bunker.get()
14
+ const dispatcher = acp.headquarters.dispatcher(acp, 2)
15
+
16
+ dispatcher.onIdle(() => acp.yorha.commander.report(acp.dialog.bunker.systemStandby, 'gray'))
17
+
18
+ return {
19
+ receive: async mission => {
20
+ const spinner = acp.yorha.commander.start(acp.dialog.bunker.detectedEnemy)
21
+ try {
22
+ const result = await acp.llm.recognizePage({ filePath: mission.input, prompt: acp.briefings.visionType })
23
+ acp.yorha.commander.success(spinner, acp.dialog.bunker.confirmEnemy)
24
+ const unit = Object.values(acp.units).map(unit => ({ unit, score: unit.meta.capabilities.filter(cap => result.capabilities.includes(cap)).length }))
25
+ .filter(item => item.score > 0)
26
+ .sort((a, b) => b.score - a.score)[0]?.unit
27
+ if (!unit) {
28
+ acp.yorha.commander.fail(spinner, acp.dialog.bunker.missionFailed)
29
+ return
30
+ }
31
+ dispatcher.add(() => unit.execute({ acp, mission }))
32
+ } catch (error) {
33
+ acp.yorha.commander.fail(spinner, acp.dialog.bunker.missionUnknown)
34
+ }
35
+ },
36
+ }
37
+ }
@@ -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.builder.contextStringify({ context, maxLength })) : '[]')
8
+ Handlebars.registerHelper('stringify', (context, maxLength = 200) => context ? new Handlebars.SafeString(logistics.formater.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`)
@@ -13,7 +13,7 @@ module.exports = ({ template, logistics }) => {
13
13
 
14
14
  fs.readdirSync(moldsDir).forEach(file => {
15
15
  if (file.endsWith('.hbs')) {
16
- const name = path.basename(file, '.hbs') // 去掉后缀拿名字
16
+ const name = path.basename(file, '.hbs')
17
17
  const content = fs.readFileSync(path.join(moldsDir, file), 'utf-8')
18
18
  Handlebars.registerPartial(name, `${content}\n`)
19
19
  }
@@ -1,4 +1,4 @@
1
- module.exports = ({ yorha, dialog }, concurrency = 1) => {
1
+ module.exports = (acp, concurrency = 1) => {
2
2
 
3
3
  let running = 0
4
4
  let queue = []
@@ -14,7 +14,7 @@ module.exports = ({ yorha, dialog }, concurrency = 1) => {
14
14
  try {
15
15
  await task()
16
16
  } catch (err) {
17
- yorha.pod153.report(dialog.pod153.signalLinkFault(err.message), 'red')
17
+ acp.yorha.pod153.report(acp.dialog.pod153.signalLinkFault(err.message), 'red')
18
18
  } finally {
19
19
  running--
20
20
  next()
@@ -1,29 +1,21 @@
1
1
  module.exports = bunker => {
2
2
 
3
+ const path = require('path')
3
4
  const chokidar = require('chokidar')
5
+ const commander = require('../headquarters/commander')(bunker)
4
6
 
5
- const acp = bunker.get()
6
- const units = Object.values(acp.units)
7
- const dispatcher = require('../headquarters/dispatcher')(acp, 2)
7
+ const settingWatcher = chokidar.watch('./bunker/config.js', { persistent: true, ignoreInitial: true })
8
8
 
9
- dispatcher.onIdle(() => acp.yorha.commander.report(acp.dialog.bunker.systemStandby, 'gray'))
10
-
11
- const options = {
9
+ const missionWatcher = chokidar.watch('./bunker/mission/', {
12
10
  persistent: true,
13
11
  ignoreInitial: true,
14
12
  ignored: /(^|[\/\\])\../,
15
- awaitWriteFinish: { stabilityThreshold: 500, pollInterval: 100 }
16
- }
17
-
18
- const settingWatcher = chokidar.watch(['./bunker/config.js'], options)
19
- const fileWatcher = chokidar.watch(units.map(unit => `./bunker/${unit.station}`), options)
20
-
21
- acp.yorha.operator6O.report(acp.dialog.operator6O.call2B)
13
+ awaitWriteFinish: { stabilityThreshold: 500, pollInterval: 100 },
14
+ })
22
15
 
23
- fileWatcher.on('add', filePath => {
24
- const unit = acp.logistics.supporter.findUnit(units, filePath)
25
- if (unit) {
26
- dispatcher.add(() => unit.handle(filePath))
16
+ missionWatcher.on('add', filePath => {
17
+ if (['.png', '.jpg', '.jpeg', '.webp'].includes(path.extname(filePath))) {
18
+ commander.receive({ input: filePath })
27
19
  }
28
20
  })
29
21
 
@@ -32,5 +24,4 @@ module.exports = bunker => {
32
24
  bunker.reboot()
33
25
  }
34
26
  })
35
-
36
27
  }
@@ -1,15 +1,15 @@
1
1
  const fs = require('fs')
2
- const path = require('path')
3
2
  const chalk = require('chalk')
4
3
 
5
- module.exports = ({ root, dialog }) => ({
6
- dirs: dir => fs.mkdirSync(path.join(root, dir), { recursive: true }),
4
+ module.exports = ({ dialog }) => ({
5
+ dirs: dir => fs.mkdirSync(dir, { recursive: true }),
7
6
  files: ({ from, to, exist, success }) => {
8
- const target = path.join(root, 'bunker', to)
9
- if (fs.existsSync(target)) {
7
+ if (fs.existsSync(to) && !!exist) {
10
8
  return console.log(chalk.yellow(dialog.bunker[exist]))
11
9
  }
12
- fs.cpSync(path.resolve(__dirname, `../../${from}`), target, { recursive: true })
13
- console.log(chalk.green(dialog.bunker[success]))
10
+ fs.cpSync(from, to, { recursive: true })
11
+ if (!!success) {
12
+ console.log(chalk.green(dialog.bunker[success]))
13
+ }
14
14
  }
15
15
  })
@@ -0,0 +1,82 @@
1
+ const fs = require('fs')
2
+ const path = require('path')
3
+ const chalk = require('chalk')
4
+
5
+ module.exports = async ({ data, fileName }) => {
6
+
7
+ const { llm, labs, yorha, dialog, logistics } = require('../awakening').get()
8
+
9
+ const { nineS, pod153 } = yorha
10
+ const { alignResponseFields } = llm
11
+ const { cleanCode } = logistics.formater
12
+ const { pagesDir } = logistics.supporter.getConfig()
13
+
14
+ const startTime = Date.now()
15
+ const resourcePath = path.join(process.cwd(), pagesDir, fileName, 'resource.js')
16
+ const enumParams = (await labs?.council)?.[fileName] ?? '{}'
17
+
18
+ const spinner = pod153.start(dialog.pod153.reconEncryptedData(fileName))
19
+
20
+ try {
21
+ if (!fs.existsSync(resourcePath)) {
22
+ pod153.fail(spinner, dialog.pod153.unknownModule(fileName))
23
+ return
24
+ }
25
+
26
+ let resourceStr = fs.readFileSync(resourcePath, 'utf8')
27
+
28
+ nineS.update(spinner, dialog.nineS.scanningField)
29
+
30
+ const extractKeys = str => {
31
+ const keys = []
32
+ const regex = /(dataIndex|name)\s*:\s*['"]([^'"]+)['"]/g
33
+ let match
34
+ while ((match = regex.exec(str)) !== null) {
35
+ keys.push(match[2])
36
+ }
37
+ return Array.from(new Set(keys.filter(key => key !== 'index')))
38
+ }
39
+
40
+ const result = await alignResponseFields({ responseStr: JSON.stringify(data), resourceStr: extractKeys(resourceStr).join(',') })
41
+ let changeCount = 0
42
+ const resultMapping = {}
43
+ Object.entries(result).forEach(([oldField, newField]) => {
44
+ if (oldField === newField) return
45
+ const regex = new RegExp(`(dataIndex|name)\\s*:\\s*['"]${oldField}['"]`, 'g')
46
+ resourceStr = resourceStr.replace(regex, `$1: '${newField}'`)
47
+ changeCount++
48
+ resultMapping[oldField] = newField
49
+ })
50
+
51
+ fs.writeFileSync(resourcePath, resourceStr)
52
+ const endTime = Date.now()
53
+
54
+ pod153.success(spinner, dialog.pod153.bridgeProtocolComplete(changeCount, (endTime - startTime) / 1000))
55
+
56
+ if (changeCount > 0) {
57
+ console.log(chalk.magenta(`\n┌────── [ YoRHa Autonomous Backend Alignment ] ──────┐`))
58
+ const maxOldFieldLength = Math.max(...Object.keys(resultMapping).map(key => key.length))
59
+ Object.entries(resultMapping).forEach(([oldField, newField]) => {
60
+ const padding = ' '.repeat(Math.max(1, maxOldFieldLength + 1 - oldField.length))
61
+ console.log(
62
+ chalk.yellow(` │ `) +
63
+ chalk.yellow(oldField) +
64
+ padding +
65
+ chalk.cyan(` -> `) +
66
+ chalk.white(newField)
67
+ )
68
+ })
69
+ console.log(chalk.magenta(`└────────────────────────────────────────────────────┘`))
70
+ }
71
+
72
+ if (enumParams !== '{}') {
73
+ console.log(chalk.magenta(`\n┌──────── [ YoRHa Physical Assembly: Enum Genomes ] ────────┐`))
74
+ console.log(chalk.gray(dialog.bunker.copyEnum))
75
+ console.log(chalk.white(cleanCode(enumParams)))
76
+ console.log(chalk.magenta(`├───────────────────────────────────────────────────────────┘`))
77
+ }
78
+
79
+ } catch (error) {
80
+ pod153.fail(spinner, dialog.pod153.alignmentFailed(error))
81
+ }
82
+ }
@@ -1,13 +1,3 @@
1
- /**
2
- * YoRHa Bunker Construction System
3
- * This file is part of Bunker.
4
- * Bunker is free software: you can redistribute it and/or modify
5
- * it under the terms of the GNU Affero General Public License as
6
- * published by the Free Software Foundation, either version 3 of the
7
- * License, or (at your option) any later version.
8
- * (c) 2026 [yorha2b-lab]. Glory to Mankind.
9
- */
10
-
11
1
  const fs = require('fs')
12
2
  const path = require('path')
13
3