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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devassist-agent",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "AI Agent 开发质量守护工具 — 30+规则检测代码缺陷/安全漏洞/性能反模式,多引擎AI根因分析,零外部依赖",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -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
- const projectAIConfig = path.join(projectRoot, '.devassist', 'ai-config.json');
40
- const globalAIConfig = path.join(os.homedir(), '.devassist', 'ai-config.json');
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
- let aiReady = false;
43
- let configSource = '';
44
-
45
- if (fs.existsSync(projectAIConfig)) {
46
- aiReady = true;
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
- console.log(` ${c.green('2/3')} AI 引擎已就绪 (${configSource}:通义千问 + 腾讯混元)`);
55
- } else if (!aiReady && !noAI) {
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('将仅使用规则引擎检查(28条规则)')}`);
58
- console.log(` ${c.gray('配置 AI 后可启用多引擎对比:devassist ai --setup --provider qwen --key <key>')}`);
59
+ console.log(` ${c.gray('将仅使用规则引擎检查(30条规则)')}`);
60
+ console.log(` ${c.gray('配置 AIdevassist 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')} 规则引擎模式 ✓`);