agent-rev 0.2.4 → 0.2.6
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/dist/commands/repl.js +10 -13
- package/dist/commands/setup.js +10 -18
- package/dist/index.js +38 -3
- package/dist/utils/config.d.ts +1 -0
- package/package.json +1 -31
package/dist/commands/repl.js
CHANGED
|
@@ -223,20 +223,17 @@ function detectModels(cliName) {
|
|
|
223
223
|
case 'agent-impl':
|
|
224
224
|
case 'agent-rev':
|
|
225
225
|
case 'agent-explorer': {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
const out = execSync('opencode models 2>/dev/null', { encoding: 'utf-8' });
|
|
236
|
-
return out.trim().split('\n').filter(Boolean);
|
|
226
|
+
for (const dir of [`.${cliName}`, '.agent-mp']) {
|
|
227
|
+
try {
|
|
228
|
+
const cfg = JSON.parse(fsSync.readFileSync(path.join(os.homedir(), dir, 'cli-config.json'), 'utf-8'));
|
|
229
|
+
if (cfg.availableModels?.length)
|
|
230
|
+
return cfg.availableModels;
|
|
231
|
+
if (cfg.coordinatorModel)
|
|
232
|
+
return [cfg.coordinatorModel];
|
|
233
|
+
}
|
|
234
|
+
catch { }
|
|
237
235
|
}
|
|
238
|
-
|
|
239
|
-
return ['configured'];
|
|
236
|
+
return [`run: ${cliName} --login`];
|
|
240
237
|
}
|
|
241
238
|
default: return ['default'];
|
|
242
239
|
}
|
package/dist/commands/setup.js
CHANGED
|
@@ -63,25 +63,17 @@ function detectModels(cliName) {
|
|
|
63
63
|
case 'agent-impl':
|
|
64
64
|
case 'agent-rev':
|
|
65
65
|
case 'agent-explorer': {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
for (const dir of [`.${cliName}`, '.agent-mp']) {
|
|
67
|
+
try {
|
|
68
|
+
const cfg = JSON.parse(fsSync.readFileSync(path.join(os.homedir(), dir, 'cli-config.json'), 'utf-8'));
|
|
69
|
+
if (cfg.availableModels?.length)
|
|
70
|
+
return cfg.availableModels;
|
|
71
|
+
if (cfg.coordinatorModel)
|
|
72
|
+
return [cfg.coordinatorModel];
|
|
73
|
+
}
|
|
74
|
+
catch { }
|
|
73
75
|
}
|
|
74
|
-
|
|
75
|
-
// Try to read from shared agent-mp config as fallback
|
|
76
|
-
try {
|
|
77
|
-
const agentHome = path.join(os.homedir(), '.agent-mp');
|
|
78
|
-
const cfgRaw = fsSync.readFileSync(path.join(agentHome, 'cli-config.json'), 'utf-8');
|
|
79
|
-
const cfg = JSON.parse(cfgRaw);
|
|
80
|
-
if (cfg.coordinatorModel)
|
|
81
|
-
return [cfg.coordinatorModel];
|
|
82
|
-
}
|
|
83
|
-
catch { }
|
|
84
|
-
return ['(configure with /model after login)'];
|
|
76
|
+
return [`run: ${cliName} --login`];
|
|
85
77
|
}
|
|
86
78
|
default:
|
|
87
79
|
return ['default'];
|
package/dist/index.js
CHANGED
|
@@ -68,8 +68,40 @@ const ROLE_BINS = {
|
|
|
68
68
|
};
|
|
69
69
|
const nativeRole = ROLE_BINS[PKG_NAME];
|
|
70
70
|
if (nativeRole) {
|
|
71
|
-
// Parse --model flag if provided
|
|
72
71
|
const args = process.argv.slice(2);
|
|
72
|
+
// --login: OAuth login for this role's account
|
|
73
|
+
if (args.includes('--login') || args.includes('login')) {
|
|
74
|
+
const { qwenLogin, fetchQwenModels } = await import('./utils/qwen-auth.js');
|
|
75
|
+
const { loadCliConfig, saveCliConfig } = await import('./utils/config.js');
|
|
76
|
+
const ok = await qwenLogin();
|
|
77
|
+
if (ok) {
|
|
78
|
+
// Fetch and cache available models so /setup can show them
|
|
79
|
+
const models = await fetchQwenModels();
|
|
80
|
+
if (models.length) {
|
|
81
|
+
const cliConfig = await loadCliConfig();
|
|
82
|
+
cliConfig.availableModels = models;
|
|
83
|
+
if (!cliConfig.coordinatorModel)
|
|
84
|
+
cliConfig.coordinatorModel = models[0];
|
|
85
|
+
await saveCliConfig(cliConfig);
|
|
86
|
+
console.log(chalk.green(` ✓ Models cached: ${models.slice(0, 3).join(', ')}${models.length > 3 ? '...' : ''}`));
|
|
87
|
+
console.log(chalk.dim(` Default model: ${cliConfig.coordinatorModel}`));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
process.exit(ok ? 0 : 1);
|
|
91
|
+
}
|
|
92
|
+
// --status: show auth status
|
|
93
|
+
if (args.includes('--status') || args.includes('status')) {
|
|
94
|
+
const { qwenAuthStatus } = await import('./utils/qwen-auth.js');
|
|
95
|
+
const status = await qwenAuthStatus();
|
|
96
|
+
if (status.authenticated) {
|
|
97
|
+
console.log(chalk.green(` ✓ ${PKG_NAME}: authenticated`));
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
console.log(chalk.yellow(` ✗ ${PKG_NAME}: not authenticated — run: ${PKG_NAME} --login`));
|
|
101
|
+
}
|
|
102
|
+
process.exit(0);
|
|
103
|
+
}
|
|
104
|
+
// Parse --model flag if provided
|
|
73
105
|
const modelIdx = args.findIndex(a => a === '--model' || a === '-m');
|
|
74
106
|
let model;
|
|
75
107
|
if (modelIdx !== -1 && args[modelIdx + 1]) {
|
|
@@ -77,8 +109,11 @@ if (nativeRole) {
|
|
|
77
109
|
}
|
|
78
110
|
const taskArg = args.filter((a, i) => !a.startsWith('-') && i !== modelIdx + 1).join(' ').trim();
|
|
79
111
|
if (!taskArg) {
|
|
80
|
-
console.
|
|
81
|
-
|
|
112
|
+
console.log(chalk.bold.cyan(`\n ${PKG_NAME} — ${nativeRole} agent\n`));
|
|
113
|
+
console.log(chalk.dim(` Usage: ${PKG_NAME} [--model <model>] "<task>"`));
|
|
114
|
+
console.log(chalk.dim(` Login: ${PKG_NAME} --login`));
|
|
115
|
+
console.log(chalk.dim(` Status: ${PKG_NAME} --status\n`));
|
|
116
|
+
process.exit(0);
|
|
82
117
|
}
|
|
83
118
|
await runRole(nativeRole, taskArg, model);
|
|
84
119
|
process.exit(0);
|
package/dist/utils/config.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,31 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "agent-rev",
|
|
3
|
-
"version": "0.2.4",
|
|
4
|
-
"description": "Reviewer agent — validates and reviews code written by the implementor",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./dist/index.js",
|
|
7
|
-
"files": ["dist/"],
|
|
8
|
-
"bin": { "agent-rev": "dist/index.js" },
|
|
9
|
-
"scripts": {
|
|
10
|
-
"build": "tsc && echo '#!/usr/bin/env node' | cat - dist/index.js > dist/index.tmp && mv dist/index.tmp dist/index.js && chmod +x dist/index.js",
|
|
11
|
-
"dev": "tsx src/index.ts",
|
|
12
|
-
"prepublishOnly": "npm run build"
|
|
13
|
-
},
|
|
14
|
-
"keywords": ["ai", "agent", "reviewer", "multi-agent", "cli", "coding"],
|
|
15
|
-
"license": "MIT",
|
|
16
|
-
"dependencies": {
|
|
17
|
-
"@anthropic-ai/sdk": "^0.39.0",
|
|
18
|
-
"@google/generative-ai": "^0.24.0",
|
|
19
|
-
"chalk": "^5.4.1",
|
|
20
|
-
"commander": "^13.1.0",
|
|
21
|
-
"open": "^11.0.0",
|
|
22
|
-
"openai": "^4.91.0"
|
|
23
|
-
},
|
|
24
|
-
"devDependencies": {
|
|
25
|
-
"@types/node": "^22.13.0",
|
|
26
|
-
"@types/open": "^6.1.0",
|
|
27
|
-
"tsx": "^4.19.3",
|
|
28
|
-
"typescript": "^5.7.3"
|
|
29
|
-
},
|
|
30
|
-
"engines": { "node": ">=18.0.0" }
|
|
31
|
-
}
|
|
1
|
+
{"name":"agent-rev","version":"0.2.6","description":"agent-rev agent","type":"module","main":"./dist/index.js","files":["dist/"],"bin":{"agent-rev":"dist/index.js"},"scripts":{"build":"tsc && echo '#!/usr/bin/env node' | cat - dist/index.js > dist/index.tmp && mv dist/index.tmp dist/index.js && chmod +x dist/index.js","dev":"tsx src/index.ts","prepublishOnly":"npm run build"},"keywords":["ai","agent","cli"],"license":"MIT","dependencies":{"@anthropic-ai/sdk":"^0.39.0","@google/generative-ai":"^0.24.0","chalk":"^5.4.1","commander":"^13.1.0","open":"^11.0.0","openai":"^4.91.0"},"devDependencies":{"@types/node":"^22.13.0","@types/open":"^6.1.0","tsx":"^4.19.3","typescript":"^5.7.3"},"engines":{"node":">=18.0.0"}}
|