viben 0.1.1 → 1.0.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/README.md +11 -1
- package/bin/viben.js +42 -134
- package/dist/index.cjs +3 -1112
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -94
- package/dist/index.d.ts +1 -94
- package/dist/index.js +2 -1097
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -3,7 +3,17 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/viben)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
|
|
6
|
-
Command-line interface for Viben
|
|
6
|
+
**Agent Swarm × Code Evolution** - Command-line interface for Viben.
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Viben CLI enables autonomous code evolution through multi-agent orchestration:
|
|
11
|
+
|
|
12
|
+
- **FileEvo** - File-based self-evolution for code iteration and optimization
|
|
13
|
+
- **Multi-Agent Swarm** - Coordinate multiple AI agents working in parallel
|
|
14
|
+
- **MCP Protocol** - Model Context Protocol for seamless tool integration
|
|
15
|
+
- **XState Task System** - State machine-driven task workflow management
|
|
16
|
+
- **Idea Generation** - Transform ideas into executable development tasks
|
|
7
17
|
|
|
8
18
|
## Installation
|
|
9
19
|
|
package/bin/viben.js
CHANGED
|
@@ -5,37 +5,25 @@
|
|
|
5
5
|
*
|
|
6
6
|
* This script serves as the main entry point for the Viben CLI.
|
|
7
7
|
* It routes to either:
|
|
8
|
-
* - The
|
|
8
|
+
* - The @viben/core CLI for all commands
|
|
9
9
|
* - The Python browse-mcp wrapper for MCP server functionality
|
|
10
10
|
*
|
|
11
11
|
* Usage:
|
|
12
|
-
* viben init # Initialize workspace
|
|
13
|
-
* viben config list # List config
|
|
14
|
-
* viben agent list # List agents
|
|
15
|
-
* viben serve
|
|
16
|
-
* viben mcp # Start MCP server (Python wrapper, alias)
|
|
12
|
+
* viben init # Initialize workspace
|
|
13
|
+
* viben config list # List config
|
|
14
|
+
* viben agent list # List agents
|
|
15
|
+
* viben mcp serve # Start MCP server (Python wrapper)
|
|
17
16
|
*/
|
|
18
17
|
|
|
19
|
-
import { createRequire } from 'module';
|
|
20
|
-
import { fileURLToPath } from 'url';
|
|
21
|
-
import { dirname, join } from 'path';
|
|
22
18
|
import { spawnSync, execSync } from 'child_process';
|
|
23
19
|
import { platform } from 'os';
|
|
24
20
|
|
|
25
|
-
const require = createRequire(import.meta.url);
|
|
26
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
27
|
-
const __dirname = dirname(__filename);
|
|
28
|
-
|
|
29
21
|
// Configuration for Python wrapper
|
|
30
22
|
const PYTHON_PACKAGE = 'browse-mcp';
|
|
31
23
|
const MIN_PYTHON_VERSION = '3.10';
|
|
32
|
-
const BRAND_NAME = 'Viben';
|
|
33
|
-
|
|
34
|
-
// Commands that should be handled by the TypeScript CLI
|
|
35
|
-
const TS_CLI_COMMANDS = ['init', 'config', 'agent'];
|
|
36
24
|
|
|
37
|
-
//
|
|
38
|
-
const
|
|
25
|
+
// Subcommands of 'mcp' that should be handled by the Python wrapper
|
|
26
|
+
const MCP_PYTHON_SUBCOMMANDS = ['serve'];
|
|
39
27
|
|
|
40
28
|
// ANSI colors
|
|
41
29
|
const colors = {
|
|
@@ -44,8 +32,6 @@ const colors = {
|
|
|
44
32
|
green: '\x1b[32m',
|
|
45
33
|
yellow: '\x1b[33m',
|
|
46
34
|
blue: '\x1b[34m',
|
|
47
|
-
cyan: '\x1b[36m',
|
|
48
|
-
bold: '\x1b[1m',
|
|
49
35
|
};
|
|
50
36
|
|
|
51
37
|
function info(message) {
|
|
@@ -204,25 +190,8 @@ function runBrowseMcp(args, pythonCmd) {
|
|
|
204
190
|
process.exit(1);
|
|
205
191
|
}
|
|
206
192
|
|
|
207
|
-
async function runTypeScriptCli(args) {
|
|
208
|
-
try {
|
|
209
|
-
const { run } = await import('../dist/index.js');
|
|
210
|
-
await run(['node', 'viben', ...args]);
|
|
211
|
-
} catch (err) {
|
|
212
|
-
// If dist doesn't exist, try running from source (development mode)
|
|
213
|
-
try {
|
|
214
|
-
const { run } = await import('../src/index.ts');
|
|
215
|
-
await run(['node', 'viben', ...args]);
|
|
216
|
-
} catch {
|
|
217
|
-
error('CLI not built. Run "npm run build" in packages/cli first.');
|
|
218
|
-
console.error(err);
|
|
219
|
-
process.exit(1);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
193
|
function handlePythonCommand(args) {
|
|
225
|
-
// Remove '
|
|
194
|
+
// Remove 'mcp' and 'serve' from args if present
|
|
226
195
|
const filteredArgs = args.filter((a) => a !== 'serve' && a !== 'mcp');
|
|
227
196
|
|
|
228
197
|
const python = findPython();
|
|
@@ -262,51 +231,15 @@ function handlePythonCommand(args) {
|
|
|
262
231
|
runBrowseMcp(filteredArgs, python.cmd);
|
|
263
232
|
}
|
|
264
233
|
|
|
265
|
-
function
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
${colors.bold}Workspace Commands:${colors.reset}
|
|
276
|
-
init Initialize a Viben workspace
|
|
277
|
-
config <subcommand> Manage configuration (get, set, list, edit, unset)
|
|
278
|
-
agent <subcommand> Manage agents (list, create, show)
|
|
279
|
-
|
|
280
|
-
${colors.bold}Server Commands:${colors.reset}
|
|
281
|
-
serve Start the MCP server (browse-mcp)
|
|
282
|
-
mcp Alias for serve
|
|
283
|
-
|
|
284
|
-
${colors.bold}Global Options:${colors.reset}
|
|
285
|
-
--json Output in JSON format
|
|
286
|
-
-g, --global Use global scope
|
|
287
|
-
-w, --workspace Use workspace scope
|
|
288
|
-
--verbose Enable verbose output
|
|
289
|
-
-q, --quiet Suppress non-essential output
|
|
290
|
-
-v, --version Show version
|
|
291
|
-
-h, --help Show help
|
|
292
|
-
|
|
293
|
-
${colors.bold}Examples:${colors.reset}
|
|
294
|
-
viben init # Initialize workspace
|
|
295
|
-
viben config list # List all config
|
|
296
|
-
viben config set settings.editor vim
|
|
297
|
-
viben agent list # List all agents
|
|
298
|
-
viben agent create -n my-agent
|
|
299
|
-
viben serve # Start MCP server
|
|
300
|
-
viben serve -t sse --port 8080
|
|
301
|
-
|
|
302
|
-
${colors.bold}Environment Variables:${colors.reset}
|
|
303
|
-
VIBEN_STATE_DIR State directory (default: ~/.viben)
|
|
304
|
-
VIBEN_AGENT Current agent ID
|
|
305
|
-
VIBEN_SCOPE Default scope (global/workspace)
|
|
306
|
-
|
|
307
|
-
${colors.bold}More information:${colors.reset}
|
|
308
|
-
https://github.com/LinXueyuanStdio/viben
|
|
309
|
-
`);
|
|
234
|
+
async function runCoreCli(args) {
|
|
235
|
+
try {
|
|
236
|
+
const { run } = await import('@viben/core/cli');
|
|
237
|
+
await run(['node', 'viben', ...args]);
|
|
238
|
+
} catch (err) {
|
|
239
|
+
error('Failed to load @viben/core CLI');
|
|
240
|
+
console.error(err);
|
|
241
|
+
process.exit(1);
|
|
242
|
+
}
|
|
310
243
|
}
|
|
311
244
|
|
|
312
245
|
/**
|
|
@@ -321,63 +254,38 @@ function findCommand(args) {
|
|
|
321
254
|
return null;
|
|
322
255
|
}
|
|
323
256
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
if (installBrowseMcp(python.cmd)) {
|
|
336
|
-
success('Installation complete');
|
|
337
|
-
process.exit(0);
|
|
338
|
-
} else {
|
|
339
|
-
error('Installation failed');
|
|
340
|
-
process.exit(1);
|
|
257
|
+
/**
|
|
258
|
+
* Find the subcommand (second non-flag argument)
|
|
259
|
+
*/
|
|
260
|
+
function findSubcommand(args) {
|
|
261
|
+
let count = 0;
|
|
262
|
+
for (const arg of args) {
|
|
263
|
+
if (!arg.startsWith('-')) {
|
|
264
|
+
count++;
|
|
265
|
+
if (count === 2) {
|
|
266
|
+
return arg;
|
|
267
|
+
}
|
|
341
268
|
}
|
|
342
269
|
}
|
|
270
|
+
return null;
|
|
271
|
+
}
|
|
343
272
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
const pkg = require('../package.json');
|
|
347
|
-
console.log(`${BRAND_NAME} CLI v${pkg.version}`);
|
|
348
|
-
process.exit(0);
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
// Handle help (only if no command is present)
|
|
352
|
-
if (args.length === 0) {
|
|
353
|
-
printHelp();
|
|
354
|
-
process.exit(0);
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
// Find the first command argument (skip flags)
|
|
273
|
+
async function main() {
|
|
274
|
+
const args = process.argv.slice(2);
|
|
358
275
|
const command = findCommand(args);
|
|
359
276
|
|
|
360
|
-
//
|
|
361
|
-
if (
|
|
362
|
-
|
|
363
|
-
|
|
277
|
+
// Handle Python-specific mcp subcommands
|
|
278
|
+
if (command === 'mcp') {
|
|
279
|
+
const subcommand = findSubcommand(args);
|
|
280
|
+
if (subcommand && MCP_PYTHON_SUBCOMMANDS.includes(subcommand)) {
|
|
281
|
+
// mcp serve -> Python wrapper
|
|
282
|
+
handlePythonCommand(args);
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
364
285
|
}
|
|
365
286
|
|
|
366
|
-
//
|
|
367
|
-
|
|
368
|
-
// TypeScript CLI commands (pass all args including global flags)
|
|
369
|
-
await runTypeScriptCli(args);
|
|
370
|
-
} else if (command && PYTHON_COMMANDS.includes(command)) {
|
|
371
|
-
// Python wrapper commands
|
|
372
|
-
handlePythonCommand(args);
|
|
373
|
-
} else if (command) {
|
|
374
|
-
// Unknown command - try TypeScript CLI (it will show proper error)
|
|
375
|
-
await runTypeScriptCli(args);
|
|
376
|
-
} else {
|
|
377
|
-
// No command found - show help
|
|
378
|
-
printHelp();
|
|
379
|
-
process.exit(0);
|
|
380
|
-
}
|
|
287
|
+
// All other commands go to @viben/core CLI
|
|
288
|
+
await runCoreCli(args);
|
|
381
289
|
}
|
|
382
290
|
|
|
383
291
|
main().catch((err) => {
|