@yorha2b-lab/autodev 7.0.0 → 7.2.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/bin/bunker.js +2 -1
- package/package.json +1 -1
- package/src/awakening/index.js +3 -1
- package/src/dialogues/EN-US.js +4 -0
- package/src/dialogues/FR-FR.js +4 -0
- package/src/dialogues/JA-JP.js +5 -1
- package/src/dialogues/RU-RU.js +4 -0
- package/src/dialogues/ZH-CN.js +4 -0
- package/src/headquarters/commander.js +39 -8
- package/src/headquarters/designer.js +2 -2
- package/src/headquarters/dispatcher.js +2 -2
- package/src/headquarters/observer.js +1 -1
- package/src/headquarters/reconciler.js +82 -0
- package/src/headquarters/recruiter.js +0 -10
- package/src/labs/council.js +6 -6
- package/src/labs/scout.js +3 -3
- package/src/labs/tower.js +2 -2
- package/src/units/raider.js +12 -3
- package/src/units/striker.js +19 -7
- package/src/workshop/react/briefings/striker.js +3 -0
- package/src/workshop/react/builder/index.js +6 -6
- package/src/dialogues/DE-DE.js +0 -65
- package/src/dialogues/ES-ES.js +0 -64
- package/src/dialogues/ID-ID.js +0 -65
- package/src/dialogues/IT-IT.js +0 -65
- package/src/dialogues/KO-KR.js +0 -65
- package/src/dialogues/PT-BR.js +0 -65
- package/src/dialogues/TR-TR.js +0 -65
- package/src/dialogues/ZH-TW.js +0 -65
- package/src/units/reconciler.js +0 -91
- package/src/workshop/react/briefings/visionType.js +0 -59
- /package/src/logistics/{builder.js → formater.js} +0 -0
package/bin/bunker.js
CHANGED
|
@@ -7,6 +7,7 @@ const { program } = require('commander')
|
|
|
7
7
|
const local = Intl.DateTimeFormat().resolvedOptions().locale.toUpperCase()
|
|
8
8
|
|
|
9
9
|
const { matchDialog, terminalCollapse } = require('../src/logistics/presenter')
|
|
10
|
+
|
|
10
11
|
const recruiter = require('../src/headquarters/recruiter')
|
|
11
12
|
const dialogues = recruiter(path.join(__dirname, '../src/dialogues'))
|
|
12
13
|
const dialog = matchDialog(local, dialogues) ?? dialogues['EN-US']
|
|
@@ -59,7 +60,7 @@ program
|
|
|
59
60
|
return
|
|
60
61
|
}
|
|
61
62
|
require('../src/headquarters/observer')(bunker)
|
|
62
|
-
result.yorha.operator6O.report(
|
|
63
|
+
result.yorha.operator6O.report(dialog.operator6O.call2B)
|
|
63
64
|
process.on('SIGINT', () => {
|
|
64
65
|
result.yorha.commander.report(dialog.bunker.systemOffline, 'gray')
|
|
65
66
|
result.labs?.scout?.close()
|
package/package.json
CHANGED
package/src/awakening/index.js
CHANGED
|
@@ -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,8 +24,8 @@ 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
|
|
package/src/dialogues/EN-US.js
CHANGED
|
@@ -43,11 +43,15 @@ module.exports = {
|
|
|
43
43
|
desc: 'AI-powered frontend CRUD code generator',
|
|
44
44
|
dataSynced: 'All data synced to Bunker storage nodes',
|
|
45
45
|
initDesc: 'Initialize Bunker construction environment',
|
|
46
|
+
missionUnknown: 'Unable to classify mission requirements.',
|
|
46
47
|
star: 'If it saves you time, feel free to give it a ⭐ on GitHub',
|
|
47
48
|
copyTemplateError: virus => `Template construction failed: ${virus}`,
|
|
48
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.',
|
|
49
52
|
linkSevered: 'Link Severed: Check network status or Black Box resonance',
|
|
50
53
|
systemOffline: 'Disconnecting Neural Link, Executing Physical Assembly...',
|
|
54
|
+
detectedEnemy: 'Unidentified entity detected. Initiating combat analysis...',
|
|
51
55
|
accessDenied: 'YoRHa Command Center Access Denied: Invalid API Key or quota exhausted!',
|
|
52
56
|
bootDesc: 'Start full-channel linked monitoring: Coordinated Page/Part/API construction',
|
|
53
57
|
copyEnum: `│ Backend Enums detected \n│ Weld the code below into the module's resource center`,
|
package/src/dialogues/FR-FR.js
CHANGED
|
@@ -41,9 +41,13 @@ module.exports = {
|
|
|
41
41
|
desc: 'Générateur de code CRUD frontend piloté par IA',
|
|
42
42
|
envCheck: 'Fichier .env existant détecté. Génération ignorée',
|
|
43
43
|
configCheck: 'Fichier config.js existant détecté. Génération ignorée',
|
|
44
|
+
missionUnknown: 'Impossible de déterminer les exigences de la mission.',
|
|
44
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...',
|
|
45
48
|
accessDenied: 'Accès au quartier général refusé : clé API invalide ou quota épuisé',
|
|
46
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.',
|
|
47
51
|
bootDesc: 'Démarrer la surveillance multi-canaux : construction coordonnée Page/Part/API',
|
|
48
52
|
initDesc: 'Initialiser l’environnement de construction du Bunker dans le répertoire actuel',
|
|
49
53
|
towerConnected: port => `Ordre : configurez votre cible proxy vers http://localhost:${port}`,
|
package/src/dialogues/JA-JP.js
CHANGED
|
@@ -37,18 +37,22 @@ module.exports = {
|
|
|
37
37
|
envCopy: '.envストレージ保存完了',
|
|
38
38
|
systemStandby: 'システム待機状態...',
|
|
39
39
|
configCopy: 'config.jsストレージ保存完了',
|
|
40
|
+
missionUnknown: 'ミッション要件を特定できません。',
|
|
40
41
|
desc: 'AI駆動型フロントエンドCRUDコード生成システム',
|
|
41
42
|
initDesc: '現在のディレクトリにBunker構築環境を初期化',
|
|
42
43
|
argDesc: 'フロントエンドフレームワークテンプレートを指定',
|
|
43
44
|
envCheck: '既存の.envファイルを検出。生成処理をスキップ',
|
|
45
|
+
confirmEnemy: '目標を確認。最適戦闘ユニットを展開します...',
|
|
46
|
+
detectedEnemy: '未確認対象を検知。戦術分析を開始します...',
|
|
44
47
|
dataSynced: '全構築データをBunkerストレージノードへ同期完了',
|
|
45
|
-
configCheck: '既存のconfig.jsファイルを検出。生成処理をスキップ',
|
|
46
48
|
copyTemplateError: virus => `テンプレート構築失敗: ${virus}`,
|
|
49
|
+
configCheck: '既存のconfig.jsファイルを検出。生成処理をスキップ',
|
|
47
50
|
star: 'このシステムが役立った場合、GitHubでスターをお願いします ⭐',
|
|
48
51
|
towerOnline: port => `シグナル迎撃塔オンライン [周波数: ${port}]`,
|
|
49
52
|
bootDesc: '全チャンネル連携監視を開始:Page/Part/API協調構築をサポート',
|
|
50
53
|
systemOffline: 'ニューラルクラウド接続を切断中。データを物理封印します...',
|
|
51
54
|
accessDenied: '司令部アクセス拒否:API Keyが無効、または利用上限に達しています',
|
|
55
|
+
missionFailed: 'ミッションの割り当てに失敗。適合する戦闘ユニットが見つかりません。',
|
|
52
56
|
linkSevered: '接続断絶:ネットワーク状態またはブラックボックス共鳴を確認してください',
|
|
53
57
|
disclaimer: '解析結果は参考情報です。最終判断は各ユニットが実環境に基づいて行ってください',
|
|
54
58
|
towerConnected: port => `指令:プロキシ対象を http://localhost:${port} に設定してください`,
|
package/src/dialogues/RU-RU.js
CHANGED
|
@@ -39,9 +39,11 @@ module.exports = {
|
|
|
39
39
|
argDesc: 'Указать шаблон frontend-фреймворка',
|
|
40
40
|
desc: 'AI-система генерации frontend CRUD-кода',
|
|
41
41
|
systemStandby: 'Система находится в режиме ожидания...',
|
|
42
|
+
missionUnknown: 'Не удалось определить требования миссии.',
|
|
42
43
|
copyTemplateError: virus => `Ошибка сборки шаблона: ${virus}`,
|
|
43
44
|
initDesc: 'Инициализация среды сборки Bunker в текущем каталоге',
|
|
44
45
|
envCheck: 'Обнаружен существующий файл .env. Генерация пропущена',
|
|
46
|
+
detectedEnemy: 'Обнаружена неизвестная цель. Начинаю тактический анализ...',
|
|
45
47
|
dataSynced: 'Все данные сборки синхронизированы с узлом хранения Bunker',
|
|
46
48
|
configCheck: 'Обнаружен существующий файл config.js. Генерация пропущена',
|
|
47
49
|
towerOnline: port => `Башня перехвата сигналов активна [Частота: ${port}]`,
|
|
@@ -50,6 +52,8 @@ module.exports = {
|
|
|
50
52
|
towerConnected: port => `Приказ: направьте прокси-цель на http://localhost:${port}`,
|
|
51
53
|
star: 'Если эта система помогла вам сэкономить время, поставьте звезду на GitHub ⭐',
|
|
52
54
|
linkSevered: 'Соединение разорвано: проверьте состояние сети или резонанс чёрного ящика',
|
|
55
|
+
missionFailed: 'Назначение миссии не удалось. Подходящее боевое подразделение не найдено.',
|
|
56
|
+
confirmEnemy: 'Цель подтверждена. Развёртывание наиболее подходящего боевого подразделения...',
|
|
53
57
|
systemOffline: 'Отключение нейронного облачного соединения. Физическое запечатывание данных...',
|
|
54
58
|
frameworkNotSupported: template => `Фреймворк [${template}] пока не поддерживается. Pull Request приветствуются`,
|
|
55
59
|
disclaimer: 'Результаты сопоставления являются справочными. Каждая единица должна выполнить собственную корректировку',
|
package/src/dialogues/ZH-CN.js
CHANGED
|
@@ -39,11 +39,15 @@ module.exports = {
|
|
|
39
39
|
systemStandby: '系统待机中...',
|
|
40
40
|
desc: 'AI驱动的前端CRUD代码生成器',
|
|
41
41
|
configCopy: 'config.js 存储完毕',
|
|
42
|
+
missionUnknown: '无法解析任务需求。',
|
|
42
43
|
initDesc: '在当前目录初始化地堡构筑环境',
|
|
43
44
|
envCheck: '终端已存在 .env 文件,跳过生成',
|
|
45
|
+
confirmEnemy: '目标确认。正在部署最适作战单位...',
|
|
44
46
|
dataSynced: '所有构筑数据已同步至 Bunker 存储节点',
|
|
47
|
+
missionFailed: '任务分配失败。未找到适配作战单位。',
|
|
45
48
|
configCheck: '终端已存在 config.js 文件,跳过生成',
|
|
46
49
|
linkSevered: '连接中断:请检查网络状态或黑盒共鸣情况',
|
|
50
|
+
detectedEnemy: '检测到未知目标。开始执行战术分析...',
|
|
47
51
|
systemOffline: '正在断开神经云链接,执行数据物理封存...',
|
|
48
52
|
copyTemplateError: virus => `模板构筑失败: ${virus}`,
|
|
49
53
|
star: '如果它能帮您节省时间,请在 GitHub 上给它点个赞 ⭐',
|
|
@@ -1,20 +1,51 @@
|
|
|
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
|
+
|
|
1
11
|
module.exports = bunker => {
|
|
2
12
|
|
|
3
13
|
const acp = bunker.get()
|
|
4
|
-
const
|
|
14
|
+
const units = Object.values(acp.units)
|
|
15
|
+
const dispatcher = acp.headquarters.dispatcher(acp, 2)
|
|
16
|
+
const prompt = `
|
|
17
|
+
# Mission Classification
|
|
18
|
+
分析输入图片,判断它适合以下哪一种unit执行:
|
|
19
|
+
可选units: ${units.map(unit => `
|
|
20
|
+
Unit: ${unit.meta.name}
|
|
21
|
+
Mission:${unit.meta.mission}
|
|
22
|
+
Description: ${unit.meta.description}
|
|
23
|
+
Capabilities: ${unit.meta.capabilities.join(', ')}
|
|
24
|
+
`).join('\n')}
|
|
25
|
+
|
|
26
|
+
## Result
|
|
27
|
+
return capabilities
|
|
28
|
+
`.trim()
|
|
5
29
|
|
|
6
30
|
dispatcher.onIdle(() => acp.yorha.commander.report(acp.dialog.bunker.systemStandby, 'gray'))
|
|
7
31
|
|
|
8
32
|
return {
|
|
9
33
|
receive: async mission => {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
.
|
|
13
|
-
.
|
|
14
|
-
|
|
15
|
-
|
|
34
|
+
const spinner = acp.yorha.commander.start(acp.dialog.bunker.detectedEnemy)
|
|
35
|
+
try {
|
|
36
|
+
const result = await acp.llm.recognizePage({ filePath: mission.input, prompt })
|
|
37
|
+
acp.yorha.commander.success(spinner, acp.dialog.bunker.confirmEnemy)
|
|
38
|
+
const unit = units.map(unit => ({ unit, score: unit.meta.capabilities.filter(cap => result.capabilities.includes(cap)).length }))
|
|
39
|
+
.filter(item => item.score > 0)
|
|
40
|
+
.sort((a, b) => b.score - a.score)[0]?.unit
|
|
41
|
+
if (!unit) {
|
|
42
|
+
acp.yorha.commander.fail(spinner, acp.dialog.bunker.missionFailed)
|
|
43
|
+
return
|
|
44
|
+
}
|
|
45
|
+
dispatcher.add(() => unit.execute({ acp, mission }))
|
|
46
|
+
} catch (error) {
|
|
47
|
+
acp.yorha.commander.fail(spinner, acp.dialog.bunker.missionUnknown)
|
|
16
48
|
}
|
|
17
|
-
dispatcher.add(() => unit.execute({ acp, mission }))
|
|
18
49
|
},
|
|
19
50
|
}
|
|
20
51
|
}
|
|
@@ -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.
|
|
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 = (
|
|
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()
|
|
@@ -15,7 +15,7 @@ module.exports = bunker => {
|
|
|
15
15
|
|
|
16
16
|
missionWatcher.on('add', filePath => {
|
|
17
17
|
if (['.png', '.jpg', '.jpeg', '.webp'].includes(path.extname(filePath))) {
|
|
18
|
-
commander.receive({ input: filePath
|
|
18
|
+
commander.receive({ input: filePath })
|
|
19
19
|
}
|
|
20
20
|
})
|
|
21
21
|
|
|
@@ -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
|
|
package/src/labs/council.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const fs = require('fs')
|
|
2
|
-
const path = require('path')
|
|
3
|
-
|
|
4
1
|
module.exports = async ({ llm, yorha, dialog, logistics }) => {
|
|
5
2
|
|
|
3
|
+
const fs = require('fs')
|
|
4
|
+
const path = require('path')
|
|
5
|
+
|
|
6
6
|
const { apiParser } = llm
|
|
7
7
|
const { pod153, commander } = yorha
|
|
8
|
-
const { contextStringify } = logistics.
|
|
8
|
+
const { contextStringify } = logistics.formater
|
|
9
9
|
const { apiDoc, pagesDir } = logistics.supporter.getConfig()
|
|
10
10
|
const { getLocalScore, getSemanticKeywords } = logistics.analyzer
|
|
11
11
|
|
|
@@ -59,7 +59,7 @@ module.exports = async ({ llm, yorha, dialog, logistics }) => {
|
|
|
59
59
|
.slice(0, 20) // 💡 拓宽至前 20 名,给 AI 更多的判别空间
|
|
60
60
|
|
|
61
61
|
const finalCandidates = candidates.map(item => `${item.method} ${item.path} ${item.desc}`).join('\n')
|
|
62
|
-
pod153.
|
|
62
|
+
const spinner = pod153.start(dialog.pod153.inactiveModule(fileName), 'yellow')
|
|
63
63
|
// 3. 驱动 9S 最终裁决
|
|
64
64
|
const result = await apiParser({ bunkerAnchors, realApis: finalCandidates })
|
|
65
65
|
|
|
@@ -98,7 +98,7 @@ module.exports = async ({ llm, yorha, dialog, logistics }) => {
|
|
|
98
98
|
})
|
|
99
99
|
|
|
100
100
|
fs.writeFileSync(indexPath, indexCode)
|
|
101
|
-
pod153.
|
|
101
|
+
pod153.success(spinner, dialog.pod153.signalSynchronized(Object.keys(result).length))
|
|
102
102
|
// 💡 战术免责补丁:采用橙黄色高亮,提醒指挥官保持警惕
|
|
103
103
|
commander.report(dialog.bunker.disclaimer, 'yellow')
|
|
104
104
|
}
|
package/src/labs/scout.js
CHANGED
package/src/labs/tower.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module.exports = ({ units, yorha, dialog, logistics }) => {
|
|
1
|
+
module.exports = ({ units, yorha, dialog, logistics, headquarters }) => {
|
|
2
2
|
|
|
3
3
|
const http = require('http')
|
|
4
4
|
const zlib = require('zlib')
|
|
@@ -39,7 +39,7 @@ module.exports = ({ units, yorha, dialog, logistics }) => {
|
|
|
39
39
|
return
|
|
40
40
|
}
|
|
41
41
|
pod153.report(dialog.pod153.capturedRuntimeSignal(fileName))
|
|
42
|
-
await
|
|
42
|
+
await headquarters.reconciler({ fileName, data: [coreData[0]] })
|
|
43
43
|
hackedRegistry.set(fileName, fingerprint)
|
|
44
44
|
} catch (e) {
|
|
45
45
|
// 非 JSON 信号,保持静默
|
package/src/units/raider.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const fs = require('fs')
|
|
2
|
-
|
|
3
1
|
module.exports = {
|
|
4
2
|
meta: {
|
|
5
3
|
name: 'raider',
|
|
@@ -7,9 +5,20 @@ module.exports = {
|
|
|
7
5
|
outputs: ['component-config'],
|
|
8
6
|
description: 'extract reusable UI component from visual input',
|
|
9
7
|
capabilities: ['vision', 'component-analysis', 'component-generation'],
|
|
8
|
+
mission: `
|
|
9
|
+
## Partial CRUD Page
|
|
10
|
+
局部 CRUD 页面或 UI 碎片。
|
|
11
|
+
例如:
|
|
12
|
+
- 仅包含表格
|
|
13
|
+
- 仅包含表单
|
|
14
|
+
- 仅包含筛选区域
|
|
15
|
+
- 仅包含某个 CRUD 功能区域
|
|
16
|
+
- 页面结构明显不完整
|
|
17
|
+
`
|
|
10
18
|
},
|
|
11
19
|
execute: async ({ acp, mission }) => {
|
|
12
20
|
|
|
21
|
+
const fs = require('fs')
|
|
13
22
|
const chalk = require('chalk')
|
|
14
23
|
const { llm, yorha, dialog, builder, logistics, briefings } = acp
|
|
15
24
|
|
|
@@ -17,7 +26,7 @@ module.exports = {
|
|
|
17
26
|
const { raider } = briefings
|
|
18
27
|
const { recognizePage } = llm
|
|
19
28
|
const { formatFormItemAndColumns } = builder
|
|
20
|
-
const { cleanCode, contextStringify } = logistics.
|
|
29
|
+
const { cleanCode, contextStringify } = logistics.formater
|
|
21
30
|
|
|
22
31
|
const startTime = Date.now()
|
|
23
32
|
|
package/src/units/striker.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
const fs = require('fs')
|
|
2
|
-
const path = require('path')
|
|
3
|
-
|
|
4
1
|
module.exports = {
|
|
5
2
|
meta: {
|
|
6
3
|
name: 'striker',
|
|
@@ -8,15 +5,30 @@ module.exports = {
|
|
|
8
5
|
outputs: ['page-config', 'artifacts'],
|
|
9
6
|
description: 'reconstruct full UI from visual input',
|
|
10
7
|
capabilities: ['vision', 'page-analysis', 'page-generation'],
|
|
8
|
+
mission: `
|
|
9
|
+
## Full CRUD Page
|
|
10
|
+
完整的 CRUD 页面。
|
|
11
|
+
满足以下特征中的大部分:
|
|
12
|
+
- 页面结构完整
|
|
13
|
+
- 包含页面级功能区域
|
|
14
|
+
- 包含查询表单或筛选区域
|
|
15
|
+
- 包含表格主体
|
|
16
|
+
- 包含行操作
|
|
17
|
+
- 包含新增、编辑、删除等功能按钮
|
|
18
|
+
- 可能包含统计区域、导出按钮等页面级功能
|
|
19
|
+
`
|
|
11
20
|
},
|
|
12
21
|
execute: async ({ acp, mission }) => {
|
|
13
22
|
|
|
23
|
+
const fs = require('fs')
|
|
24
|
+
const path = require('path')
|
|
25
|
+
|
|
14
26
|
const { llm, yorha, dialog, builder, template, logistics, briefings } = acp
|
|
15
27
|
|
|
16
28
|
const { striker } = briefings
|
|
17
29
|
const { nineS, pod042 } = yorha
|
|
18
30
|
const { index, resource } = builder
|
|
19
|
-
const { contextStringify } = logistics.
|
|
31
|
+
const { contextStringify } = logistics.formater
|
|
20
32
|
const { generateMock, recognizePage, nameSimilarity } = llm
|
|
21
33
|
const { useDemo, pagesDir, utilsDir, needMock } = logistics.supporter.getConfig()
|
|
22
34
|
|
|
@@ -42,10 +54,10 @@ module.exports = {
|
|
|
42
54
|
pageConfig = await recognizePage({ prompt: striker, filePath: mission.input, schema: require(`../workshop/${template}/protocols/striker.json`) })
|
|
43
55
|
}
|
|
44
56
|
|
|
45
|
-
const { similarity } = await nameSimilarity({ fileName, english: pageConfig.title
|
|
57
|
+
const { similarity } = await nameSimilarity({ fileName, english: pageConfig.title?.english })
|
|
46
58
|
if (similarity === 0) {
|
|
47
|
-
fileName = pageConfig.title
|
|
48
|
-
targetDir = path.join(process.cwd(), pagesDir, pageConfig.title
|
|
59
|
+
fileName = pageConfig.title?.english
|
|
60
|
+
targetDir = path.join(process.cwd(), pagesDir, pageConfig.title?.english)
|
|
49
61
|
if (fs.existsSync(targetDir)) {
|
|
50
62
|
targetDir = `${targetDir}_temp`
|
|
51
63
|
}
|
|
@@ -9,6 +9,9 @@ module.exports = `
|
|
|
9
9
|
- **严禁中文**: 绝对禁止在变量名、键名中使用中文字符。
|
|
10
10
|
- **屏蔽关键字**: 禁止使用 JS 保留字 (export, delete, const, let, class, default 等)。
|
|
11
11
|
|
|
12
|
+
## 页面标题 (title)
|
|
13
|
+
- **格式**: {title:{english:'页面标题[英文]',chinese:'页面标题[中文]'}}
|
|
14
|
+
|
|
12
15
|
## 零部件构筑规范 (Component Specifications)
|
|
13
16
|
|
|
14
17
|
## 标签页 (tabs)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
module.exports = ({
|
|
1
|
+
module.exports = ({ template, logistics, headquarters }) => {
|
|
2
2
|
|
|
3
|
-
const {
|
|
4
|
-
const { wrapCode, cleanCode, contextStringify } = logistics.builder
|
|
3
|
+
const { wrapCode, cleanCode, contextStringify } = logistics.formater
|
|
5
4
|
const { needMock, responseSuccess } = logistics.supporter.getConfig()
|
|
5
|
+
const { indexTpl, resourceTpl } = headquarters.designer({ template, logistics })
|
|
6
6
|
|
|
7
7
|
const formatFormItemAndColumns = ({ pageConfig }) => {
|
|
8
8
|
|
|
@@ -87,7 +87,7 @@ module.exports = ({ designer, logistics }) => {
|
|
|
87
87
|
|
|
88
88
|
const hasTabs = pageConfig.tabs?.length > 0
|
|
89
89
|
const hasFormItems = pageConfig.formItems?.length > 0
|
|
90
|
-
const tabKeys = pageConfig.tabs?.map(tab => tab.key).sort((a, b) => a.length - b.length)
|
|
90
|
+
const tabKeys = pageConfig.tabs?.map(tab => tab.key).sort((a, b) => a.length - b.length) ?? []
|
|
91
91
|
const optionDict = pageConfig.optionList?.reduce((acc, item) => ({ ...acc, [item.name]: item.options }), {})
|
|
92
92
|
|
|
93
93
|
const columnsData = processedColumns.filter(item => !['操作', 'operation'].includes(item.title?.toLowerCase()))?.map(item => {
|
|
@@ -101,10 +101,10 @@ module.exports = ({ designer, logistics }) => {
|
|
|
101
101
|
hasFormItems,
|
|
102
102
|
tabs: pageConfig.tabs,
|
|
103
103
|
dictBlocks: dictBlocks.map(item => ({ name: item, data: optionDict[item] ?? [] })),
|
|
104
|
-
tabColumns: contextStringify({ context: Object.fromEntries(tabKeys
|
|
104
|
+
tabColumns: contextStringify({ context: Object.fromEntries(tabKeys?.map(tab => [tab, wrapCode('commonColumns')])), maxLength: 100 }),
|
|
105
105
|
formItemsData: !hasTabs ?
|
|
106
106
|
`export const formItems = ${contextStringify({ context: formItems, maxLength: 120 })}` :
|
|
107
|
-
`const searchItems = ${contextStringify({ context: formItems, maxLength: 120 })}\n\nexport const formItems = ${contextStringify({ context: Object.fromEntries(tabKeys
|
|
107
|
+
`const searchItems = ${contextStringify({ context: formItems, maxLength: 120 })}\n\nexport const formItems = ${contextStringify({ context: Object.fromEntries(tabKeys?.map(tab => [tab, wrapCode('searchItems')])), maxLength: 100 })}`,
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
const bodyCode = resourceTpl(viewData)
|
package/src/dialogues/DE-DE.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
nineS: {
|
|
3
|
-
dataCamouflageComplete: 'Mock-Datengenerierung abgeschlossen',
|
|
4
|
-
scanningField: 'Analyse der Feldabweichungen zwischen Frontend und Backend läuft... Semantische Brücke wird aktiviert',
|
|
5
|
-
dataCamouflage: fileName => `Ziel-Firewall wird durchbrochen... Datenverschleierungsprotokoll wird ausgeführt [${fileName}]`,
|
|
6
|
-
},
|
|
7
|
-
pod042: {
|
|
8
|
-
capturedToast: 'Visuelle Daten erfasst. Übertragung wird gestartet...',
|
|
9
|
-
startScout: 'Aktivieren des [Taktischen Rechtsklick-Schnappschuss]-Modus...',
|
|
10
|
-
partialConstruction: time => `Bericht: Teilkonstruktion abgeschlossen. Dauer: ${time}s`,
|
|
11
|
-
extractingUiMetadata: 'UI-Metadaten werden aus dem neuronalen Cloud-Netzwerk extrahiert...',
|
|
12
|
-
simulate: 'Echte Anfrage erkannt. Standard-Simulationspaket example.json wird bereitgestellt',
|
|
13
|
-
partialRecommendation: '│ Empfehlung: Den obigen Codeblock manuell in die Zieldatei integrieren',
|
|
14
|
-
capturedPage: pageName => `Seite erfasst [${pageName}] -> In das Verzeichnis mission übertragen`,
|
|
15
|
-
visualPartCaptured: 'Lokales visuelles Fragment erkannt. „Fragment-Konstruktionsprotokoll“ wird gestartet',
|
|
16
|
-
uploadVisualMetadata: 'Visuelle Metadaten werden an die Zentrale übertragen. Semantische Analyse wird gestartet...',
|
|
17
|
-
partialConstructionAborted: virus => `[Warnung] Fragment-Konstruktion fehlgeschlagen. Logische Störung erkannt: ${virus}`,
|
|
18
|
-
constructionAborted: virus => `Konstruktion abgebrochen. Logischer Virus oder Verbindungszeitüberschreitung erkannt: ${virus}`,
|
|
19
|
-
scoutReady: '[Rechtsklick-Schnappschuss Bereit] Klicken Sie mit der rechten Maustaste auf eine beliebige Stelle der Webseite.',
|
|
20
|
-
intercept: fileName => `Modul [${fileName}] befindet sich bereits in der Bunker-Datenbank. Überschreiben zum Schutz der Daten verhindert`,
|
|
21
|
-
visualCaptured: fileName => `Visuelle Erfassung abgeschlossen: [${fileName}]. Bunker-Ressourcen werden geladen und physische Konstruktion gestartet`,
|
|
22
|
-
assemblyComplete: (fileName, time) => `Konstruktionsprotokoll abgeschlossen. Modul [${fileName}] erfolgreich implementiert. Dauer: ${time}s, Menü-Routenkonfiguration wird mit Bunker synchronisiert`,
|
|
23
|
-
},
|
|
24
|
-
pod153: {
|
|
25
|
-
signalLinkFault: virus => `Signalverbindungsfehler: ${virus}`,
|
|
26
|
-
signalSynchronized: count => `${count} Knoten synchronisiert. Energieversorgung bestätigt`,
|
|
27
|
-
autonomousAddressing: '„Vollkanal-Autoadressierungsprotokoll [Semantische Analyseversion]“ wird aktiviert...',
|
|
28
|
-
inactiveModule: fileName => `Nicht aktiviertes Modul [${fileName}] erkannt. Hochpräzise Analyse durch 9S angefordert`,
|
|
29
|
-
alignmentFailed: virus => `Signalsynchronisierung fehlgeschlagen. API-Daten durch starke Firewall blockiert: ${virus}`,
|
|
30
|
-
reconEncryptedData: fileName => `Verschlüsselte Datenquelle [${fileName}] erkannt. Semantische Synchronisierung wird versucht`,
|
|
31
|
-
bridgeProtocolComplete: (count, time) => `Semantische Brücke abgeschlossen. ${count} Feldabweichungen korrigiert. Dauer: ${time}s`,
|
|
32
|
-
capturedRuntimeSignal: fileName => `Laufzeitsignal [${fileName}] abgefangen. Automatisches Synchronisationsprotokoll wird gestartet`,
|
|
33
|
-
unknownModule: fileName => `Keine Ressourcendaten für Modul [${fileName}] in der Bunker-Datenbank gefunden. Bitte zuerst visuelle Konstruktion ausführen`,
|
|
34
|
-
},
|
|
35
|
-
bunker: {
|
|
36
|
-
exit: 'Systemsignal verloren...',
|
|
37
|
-
envCopy: '.env-Speicherung abgeschlossen',
|
|
38
|
-
argDesc: 'Frontend-Framework-Template auswählen',
|
|
39
|
-
configCopy: 'config.js-Speicherung abgeschlossen',
|
|
40
|
-
desc: 'KI-gesteuertes Frontend-CRUD-Codegenerierungssystem',
|
|
41
|
-
systemStandby: 'System befindet sich im Bereitschaftsmodus...',
|
|
42
|
-
envCheck: 'Vorhandene .env-Datei erkannt. Erstellung übersprungen',
|
|
43
|
-
towerOnline: port => `Signal-Abfangturm online [Frequenz: ${port}]`,
|
|
44
|
-
configCheck: 'Vorhandene config.js-Datei erkannt. Erstellung übersprungen',
|
|
45
|
-
copyTemplateError: virus => `Template-Konstruktion fehlgeschlagen: ${virus}`,
|
|
46
|
-
initDesc: 'Bunker-Konstruktionsumgebung im aktuellen Verzeichnis initialisieren',
|
|
47
|
-
linkSevered: 'Verbindung getrennt: Netzwerkstatus oder Blackbox-Resonanz prüfen',
|
|
48
|
-
towerConnected: port => `Befehl: Proxy-Ziel auf http://localhost:${port} setzen`,
|
|
49
|
-
bootDesc: 'Überwachung aller Kanäle starten: Page/Part/API-Konstruktion unterstützt',
|
|
50
|
-
accessDenied: 'Zentralzugriff verweigert: API-Key ungültig oder Kontingent erschöpft',
|
|
51
|
-
dataSynced: 'Alle Konstruktionsdaten wurden mit dem Bunker-Speicherknoten synchronisiert',
|
|
52
|
-
systemOffline: 'Neuronale Cloud-Verbindung wird getrennt. Daten werden physisch versiegelt...',
|
|
53
|
-
star: 'Wenn dieses System Ihnen Zeit spart, geben Sie dem Projekt bitte einen Stern auf GitHub ⭐',
|
|
54
|
-
frameworkNotSupported: template => `[${template}] Framework wird derzeit nicht unterstützt. Pull Requests willkommen`,
|
|
55
|
-
networkInstability: count => `Neuronale Cloud-Verbindung instabil. Wiederverbindung wird versucht... (Versuch ${count})`,
|
|
56
|
-
disclaimer: 'Analyseergebnis dient nur als Referenz. Die endgültige Entscheidung muss durch die jeweiligen Einheiten getroffen werden',
|
|
57
|
-
copyEnum: '│ Backend-Geninformationen (Enum) erkannt\n│ Empfehlung: Den folgenden Codeblock manuell in das Ressourcenmodul integrieren',
|
|
58
|
-
strategicThreshold: (target, current) => `Physische Klonanzahl hat strategischen Schwellenwert ${target} überschritten! Aktuelle Stärke: ${current}`,
|
|
59
|
-
initComplete: cmd => `Bunker-Bereitstellung abgeschlossen. Für schnelleren Einsatz bitte [manuell installieren]: ${cmd} zu package.json scripts hinzufügen`,
|
|
60
|
-
isLegendary: (unlockAchievement, current, target) => unlockAchievement ? 'Glückwunsch, Kommandant. Ihr Konstruktionsprotokoll ist nun Teil des Ruhms der Menschheit' : `Aktuelle Konstruktionsanzahl: ${current}. Noch ${target - current} Einheiten bis zur Auszeichnung`,
|
|
61
|
-
},
|
|
62
|
-
operator6O: {
|
|
63
|
-
call2B: 'An 2B: Bunker-weite Kanalüberwachung ist aktiviert!',
|
|
64
|
-
}
|
|
65
|
-
}
|