feat: assistant reads, lists and writes files and runs commands on any of the user's machines; agent mode does the steps itself, asking before each command and write
This commit is contained in:
1 parent
d9c7c2dd42
commit
a7e43ab700
5 files changed
+207
-31
No files matched your search
@@ -49,3 +49,16 @@ test('scope: nothing new runs after it ended', async () => {
|
||||
await new Promise(r => setTimeout(r, 20));
|
||||
assert.strictEqual(n, 0);
|
||||
});
|
||||
|
||||
test('parseActions: run, read, ls and write blocks with or without a machine', () => {
|
||||
const text = 'Сделаю так:\n```run web\nuptime\n```\nи\n```read db:/etc/hosts\n```\n```ls /var/log\n```\n```write web:/tmp/a b.txt\nline 1\nline 2\n```\n```bash\nnot an action\n```\n```run\ndf -h\n```';
|
||||
assert.deepStrictEqual(U.parseActions(text), [
|
||||
{kind: 'run', machine: 'web', path: '', body: 'uptime'},
|
||||
{kind: 'read', machine: 'db', path: '/etc/hosts', body: ''},
|
||||
{kind: 'ls', machine: '', path: '/var/log', body: ''},
|
||||
{kind: 'write', machine: 'web', path: '/tmp/a b.txt', body: 'line 1\nline 2'},
|
||||
{kind: 'run', machine: '', path: '', body: 'df -h'}
|
||||
]);
|
||||
// A block still being written is not an action yet.
|
||||
assert.strictEqual(U.parseActions('```run\nls').length, 0);
|
||||
});
|
||||
Reference in new issue
Block a user