agent-window 1.1.3 → 1.1.4
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/package.json +1 -1
- package/src/core/instance/validator.js +39 -28
package/package.json
CHANGED
|
@@ -19,10 +19,14 @@ import { existsSync } from 'fs';
|
|
|
19
19
|
export function detectInstanceType(projectPath) {
|
|
20
20
|
const normalizedPath = path.resolve(projectPath);
|
|
21
21
|
|
|
22
|
+
// Check if it has BMAD framework (_bmad directory)
|
|
23
|
+
const hasBmad = existsSync(path.join(normalizedPath, '_bmad'));
|
|
24
|
+
|
|
22
25
|
// Check if it has BMAD plugin (_agent-bridge directory)
|
|
23
26
|
const hasPlugin = existsSync(path.join(normalizedPath, '_agent-bridge'));
|
|
24
27
|
|
|
25
|
-
|
|
28
|
+
// BMAD plugin instance (has either _bmad or _agent-bridge)
|
|
29
|
+
if (hasBmad || hasPlugin) {
|
|
26
30
|
return 'bmad-plugin';
|
|
27
31
|
}
|
|
28
32
|
|
|
@@ -105,39 +109,46 @@ export async function validateInstance(projectPath) {
|
|
|
105
109
|
// BMAD-specific checks
|
|
106
110
|
const bmadPath = path.join(normalizedPath, '_bmad');
|
|
107
111
|
const bmadExists = pathExists(bmadPath);
|
|
108
|
-
checks.push({
|
|
109
|
-
name: 'bmad.exists',
|
|
110
|
-
passed: bmadExists,
|
|
111
|
-
required: true,
|
|
112
|
-
error: bmadExists ? null : '未检测到 BMAD 框架 (_bmad 目录)'
|
|
113
|
-
});
|
|
114
112
|
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
checks.push({
|
|
118
|
-
name: 'plugin.exists',
|
|
119
|
-
passed: pluginExists,
|
|
120
|
-
required: true,
|
|
121
|
-
error: pluginExists ? null : '未检测到 _agent-bridge 插件目录'
|
|
122
|
-
});
|
|
113
|
+
const agentBridgePath = path.join(normalizedPath, '_agent-bridge');
|
|
114
|
+
const agentBridgeExists = pathExists(agentBridgePath);
|
|
123
115
|
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
checks.push({
|
|
127
|
-
name: 'plugin.botjs',
|
|
128
|
-
passed: botJsExists,
|
|
129
|
-
required: true,
|
|
130
|
-
error: botJsExists ? null : '插件缺少核心文件 src/bot.js'
|
|
131
|
-
});
|
|
116
|
+
// At least one of _bmad or _agent-bridge must exist
|
|
117
|
+
const hasAnyBmadStructure = bmadExists || agentBridgeExists;
|
|
132
118
|
|
|
133
|
-
const pluginPkgPath = path.join(pluginPath, 'package.json');
|
|
134
|
-
const hasDiscord = await hasDependency(pluginPkgPath, 'discord.js');
|
|
135
119
|
checks.push({
|
|
136
|
-
name: '
|
|
137
|
-
passed:
|
|
120
|
+
name: 'bmad.exists',
|
|
121
|
+
passed: hasAnyBmadStructure,
|
|
138
122
|
required: true,
|
|
139
|
-
error:
|
|
123
|
+
error: hasAnyBmadStructure ? null : '未检测到 BMAD 框架 (_bmad 或 _agent-bridge 目录)'
|
|
140
124
|
});
|
|
125
|
+
|
|
126
|
+
// Prefer _agent-bridge if exists, otherwise use project root
|
|
127
|
+
if (agentBridgeExists) {
|
|
128
|
+
pluginPath = agentBridgePath;
|
|
129
|
+
} else if (bmadExists) {
|
|
130
|
+
pluginPath = normalizedPath;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (pluginPath) {
|
|
134
|
+
const botJsPath = path.join(pluginPath, 'src/bot.js');
|
|
135
|
+
const botJsExists = pathExists(botJsPath);
|
|
136
|
+
checks.push({
|
|
137
|
+
name: 'plugin.botjs',
|
|
138
|
+
passed: botJsExists,
|
|
139
|
+
required: true,
|
|
140
|
+
error: botJsExists ? null : '插件缺少核心文件 src/bot.js'
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
const pluginPkgPath = path.join(pluginPath, 'package.json');
|
|
144
|
+
const hasDiscord = await hasDependency(pluginPkgPath, 'discord.js');
|
|
145
|
+
checks.push({
|
|
146
|
+
name: 'plugin.package',
|
|
147
|
+
passed: hasDiscord,
|
|
148
|
+
required: true,
|
|
149
|
+
error: hasDiscord ? null : '插件 package.json 缺少 discord.js 依赖'
|
|
150
|
+
});
|
|
151
|
+
}
|
|
141
152
|
} else if (instanceType === 'simple-config') {
|
|
142
153
|
// Simple config instance
|
|
143
154
|
const configPath = path.join(normalizedPath, 'config.json');
|