-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
50 lines (41 loc) · 1.08 KB
/
Copy pathindex.js
File metadata and controls
50 lines (41 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import readline from 'readline';
import { runAgent } from './src/agent.js';
import * as ui from './src/ui.js';
import chalk from 'chalk';
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
function showLanding() {
console.clear();
console.log('\n');
console.log(' ' + chalk.bold.cyan('MUWK') + ' ' + chalk.gray('- Beta'));
console.log(' ' + chalk.dim('Workspace: ./workspace/'));
console.log('\n ' + chalk.gray('─'.repeat(60)));
console.log(' ' + chalk.dim('Type your task below or "exit" to quit'));
console.log(' ' + chalk.gray('─'.repeat(60)) + '\n');
}
showLanding();
function prompt() {
rl.question(chalk.cyan('muwk> '), async (task) => {
if (!task.trim()) {
prompt();
return;
}
if (task.toLowerCase() === 'exit') {
console.log(chalk.gray('\nExiting...\n'));
rl.close();
return;
}
ui.showTask(task);
try {
await runAgent(task);
} catch (err) {
ui.showError(err.message);
}
ui.stopSpinner();
console.log('');
prompt();
});
}
prompt();