devassist-agent 1.0.2 → 1.0.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/package.json +1 -1
- package/src/cli/commands/start.js +19 -17
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Automatically:
|
|
5
5
|
* 1. Initialize project (if not already initialized)
|
|
6
|
-
* 2. Verify AI config (global or project-level)
|
|
6
|
+
* 2. Verify AI config (global or project-level, with real API keys)
|
|
7
7
|
* 3. Start watch mode with --ai --compare
|
|
8
8
|
*
|
|
9
9
|
* Usage:
|
|
@@ -36,26 +36,28 @@ module.exports = async function start(projectRoot, args, ui) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
// ─── Step 2: Verify AI config ─────────────────────
|
|
39
|
-
|
|
40
|
-
const
|
|
39
|
+
// Use loadAIConfig to check if real API keys are configured
|
|
40
|
+
const aiCmd = require('./ai');
|
|
41
|
+
const config = aiCmd.loadAIConfig(projectRoot);
|
|
42
|
+
const readyEngines = config ? config.engines.filter(e => e.enabled && e.apiKey) : [];
|
|
43
|
+
const aiReady = readyEngines.length >= 2;
|
|
41
44
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
configSource = '项目配置';
|
|
48
|
-
} else if (fs.existsSync(globalAIConfig)) {
|
|
49
|
-
aiReady = true;
|
|
50
|
-
configSource = '全局配置';
|
|
51
|
-
}
|
|
45
|
+
// Determine config source
|
|
46
|
+
const projectConfigPath = path.join(projectRoot, '.devassist', 'ai-config.json');
|
|
47
|
+
const globalConfigPath = path.join(os.homedir(), '.devassist', 'ai-config.json');
|
|
48
|
+
const configSource = fs.existsSync(projectConfigPath) ? '项目配置' :
|
|
49
|
+
(fs.existsSync(globalConfigPath) ? '全局配置' : '');
|
|
52
50
|
|
|
53
51
|
if (aiReady && !noAI) {
|
|
54
|
-
|
|
55
|
-
}
|
|
52
|
+
const engineNames = readyEngines.map(e => e.name || e.provider).join(' + ');
|
|
53
|
+
console.log(` ${c.green('2/3')} AI 引擎已就绪 ✓ (${configSource}:${engineNames})`);
|
|
54
|
+
} else if (readyEngines.length === 1 && !noAI) {
|
|
55
|
+
console.log(` ${c.green('2/3')} AI 引擎已就绪 ✓ (${configSource}:${readyEngines[0].name},仅单引擎)`);
|
|
56
|
+
console.log(` ${c.gray('提示:配置第二个引擎可启用对比模式')}`);
|
|
57
|
+
} else if (!noAI) {
|
|
56
58
|
console.log(` ${c.yellow('2/3')} 未检测到 AI 配置`);
|
|
57
|
-
console.log(` ${c.gray('将仅使用规则引擎检查(
|
|
58
|
-
console.log(` ${c.gray('配置 AI
|
|
59
|
+
console.log(` ${c.gray('将仅使用规则引擎检查(30条规则)')}`);
|
|
60
|
+
console.log(` ${c.gray('配置 AI:devassist ai --setup --provider qwen --key <key>')}`);
|
|
59
61
|
noAI = true; // fallback to rules-only
|
|
60
62
|
} else {
|
|
61
63
|
console.log(` ${c.green('2/3')} 规则引擎模式 ✓`);
|