@@ -1,6 +1,6 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { mkdtempSync, readFileSync, existsSync, rmSync } from 'node:fs';
|
||||
import { mkdtempSync, readFileSync, existsSync, rmSync, mkdirSync, writeFileSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { ensureAgentWorkspace, applyAssistantName, applyAssistantPrompt, normalizeAssistantName, templateWorkspaceDir } from '../daemon/agent-workspace.js';
|
||||
@@ -13,6 +13,9 @@ test('workspace seed copies SOUL and bootstrap, then name writes IDENTITY.md', (
|
||||
const dir = ensureAgentWorkspace({ name: 'Jarvis' });
|
||||
assert.equal(existsSync(path.join(dir, 'SOUL.md')), true);
|
||||
assert.equal(existsSync(path.join(dir, 'AGENTS.md')), true);
|
||||
assert.equal(existsSync(path.join(dir, 'skills/browser/SKILL.md')), true);
|
||||
assert.match(readFileSync(path.join(dir, 'AGENTS.md'), 'utf8'), /skills\/browser\/SKILL.md/);
|
||||
assert.match(readFileSync(path.join(dir, 'TOOLS.md'), 'utf8'), /headed Playwright Chromium window/);
|
||||
assert.equal(existsSync(path.join(dir, 'BOOTSTRAP.md')), true);
|
||||
assert.match(readFileSync(path.join(dir, 'SOUL.md'), 'utf8'), /You are \*\*Jarvis\*\*/);
|
||||
assert.match(readFileSync(path.join(dir, 'BOOTSTRAP.md'), 'utf8'), /first-run ritual/);
|
||||
@@ -33,6 +36,30 @@ test('workspace seed copies SOUL and bootstrap, then name writes IDENTITY.md', (
|
||||
assert.match(templateWorkspaceDir(), /agent-workspace$/);
|
||||
});
|
||||
|
||||
test('workspace seed patches an old Playwright one-liner and adds the browser skill', () => {
|
||||
const dir = path.join(data, 'jarvis/workspace');
|
||||
mkdirSync(path.join(dir, 'skills'), { recursive: true });
|
||||
writeFileSync(path.join(dir, 'AGENTS.md'), [
|
||||
'# AGENTS.md',
|
||||
'',
|
||||
'## Tools',
|
||||
'- `web_search` / `google_search` / `fetch_page` / `web_fetch` / `wiki_search` / `hn_search` / `code_search` — Playwright Chromium. For cookie walls or extra clicks, call `browser` with snapshot then click or type.',
|
||||
'',
|
||||
].join('\n'));
|
||||
writeFileSync(path.join(dir, 'TOOLS.md'), [
|
||||
'# TOOLS.md',
|
||||
'',
|
||||
'## Shell',
|
||||
'- Public HTTP via curl or wget is blocked. Use `web_search` / `web_fetch` in the Jarvis Chromium window. For cookie walls, call `browser` with snapshot then click or type.',
|
||||
'',
|
||||
].join('\n'));
|
||||
const seeded = ensureAgentWorkspace({ name: 'Jarvis' });
|
||||
assert.equal(seeded, dir);
|
||||
assert.match(readFileSync(path.join(dir, 'AGENTS.md'), 'utf8'), /skills\/browser\/SKILL.md/);
|
||||
assert.match(readFileSync(path.join(dir, 'TOOLS.md'), 'utf8'), /headed Playwright Chromium window/);
|
||||
assert.equal(existsSync(path.join(dir, 'skills/browser/SKILL.md')), true);
|
||||
});
|
||||
|
||||
test('cleanup', () => {
|
||||
if (previous === undefined) delete process.env.XDG_DATA_HOME;
|
||||
else process.env.XDG_DATA_HOME = previous;
|
||||
|
||||
Reference in New Issue
Block a user