@opensassi/opencode 0.1.3 → 0.1.4
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/dashboard/dashboard.e2e.test.ts +247 -0
- package/dashboard/dist/index.d.ts +9 -0
- package/dashboard/dist/index.js +36 -0
- package/dashboard/dist/routes/api.d.ts +2 -0
- package/dashboard/dist/routes/api.js +215 -0
- package/dashboard/dist/services/cache.d.ts +13 -0
- package/dashboard/dist/services/cache.js +29 -0
- package/dashboard/dist/services/experiments.d.ts +11 -0
- package/dashboard/dist/services/experiments.js +108 -0
- package/dashboard/dist/services/git.d.ts +12 -0
- package/dashboard/dist/services/git.js +149 -0
- package/dashboard/dist/services/sessions.d.ts +25 -0
- package/dashboard/dist/services/sessions.js +208 -0
- package/dashboard/dist/services/specs.d.ts +9 -0
- package/dashboard/dist/services/specs.js +102 -0
- package/dashboard/dist/types.d.ts +173 -0
- package/dashboard/dist/types.js +1 -0
- package/dashboard/opencode.e2e.test.ts +100 -0
- package/dashboard/playwright.config.ts +11 -0
- package/dashboard/public/app.js +961 -0
- package/dashboard/public/index.html +29 -0
- package/dashboard/public/style.css +231 -0
- package/dashboard/src/index.ts +53 -0
- package/dashboard/src/routes/api.ts +235 -0
- package/dashboard/src/services/cache.ts +38 -0
- package/dashboard/src/services/experiments.ts +117 -0
- package/dashboard/src/services/git.ts +139 -0
- package/dashboard/src/services/sessions.ts +216 -0
- package/dashboard/src/services/specs.ts +95 -0
- package/dashboard/src/types.ts +168 -0
- package/dashboard/technical-specification.md +414 -0
- package/dashboard/test-api.sh +127 -0
- package/dashboard/tsconfig.json +16 -0
- package/lib/util/paths.js +9 -1
- package/package.json +9 -1
- package/scripts/dashboard.js +17 -0
- package/scripts/generate-daily-summaries.js +190 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { test, expect } from '@playwright/test';
|
|
2
|
+
import { execSync, spawn, type ChildProcess } from 'node:child_process';
|
|
3
|
+
import { resolve } from 'node:path';
|
|
4
|
+
|
|
5
|
+
const ROOT = resolve(import.meta.dirname ?? '.', '..');
|
|
6
|
+
let server: ChildProcess;
|
|
7
|
+
const PORT = 3098;
|
|
8
|
+
|
|
9
|
+
test.beforeAll(() => {
|
|
10
|
+
server = spawn(process.execPath, [resolve(ROOT, 'scripts/dashboard.js'), '--port', String(PORT)], {
|
|
11
|
+
cwd: ROOT,
|
|
12
|
+
stdio: 'pipe',
|
|
13
|
+
});
|
|
14
|
+
const maxWait = 15000;
|
|
15
|
+
const start = Date.now();
|
|
16
|
+
while (Date.now() - start < maxWait) {
|
|
17
|
+
try {
|
|
18
|
+
execSync(`curl -sf http://127.0.0.1:${PORT}/api/health`, { stdio: 'ignore' });
|
|
19
|
+
break;
|
|
20
|
+
} catch {
|
|
21
|
+
execSync('sleep 0.3');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test.afterAll(() => {
|
|
27
|
+
if (server) server.kill();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test.describe('opencode dashboard CLI', () => {
|
|
31
|
+
test('npx command starts server and health returns ok', async () => {
|
|
32
|
+
const res = await fetch(`http://127.0.0.1:${PORT}/api/health`);
|
|
33
|
+
expect(res.ok).toBe(true);
|
|
34
|
+
const body = await res.json();
|
|
35
|
+
expect(body.status).toBe('ok');
|
|
36
|
+
expect(body.days_count).toBeGreaterThan(0);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('api/days returns opencode dates', async () => {
|
|
40
|
+
const res = await fetch(`http://127.0.0.1:${PORT}/api/days`);
|
|
41
|
+
expect(res.ok).toBe(true);
|
|
42
|
+
const body = await res.json();
|
|
43
|
+
expect(body.days.length).toBeGreaterThanOrEqual(4);
|
|
44
|
+
expect(body.days).toContain('2026-05-16');
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test('api/days/latest returns latest day', async () => {
|
|
48
|
+
const res = await fetch(`http://127.0.0.1:${PORT}/api/days/latest`);
|
|
49
|
+
expect(res.ok).toBe(true);
|
|
50
|
+
const body = await res.json();
|
|
51
|
+
expect(body.date).toBeTruthy();
|
|
52
|
+
expect(body.total_sessions).toBeGreaterThan(0);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('api/sessions returns sessions list', async () => {
|
|
56
|
+
const res = await fetch(`http://127.0.0.1:${PORT}/api/sessions`);
|
|
57
|
+
expect(res.ok).toBe(true);
|
|
58
|
+
const body = await res.json();
|
|
59
|
+
expect(body.total).toBeGreaterThan(0);
|
|
60
|
+
expect(body.sessions.length).toBeGreaterThan(0);
|
|
61
|
+
expect(body.sessions[0].entry).toHaveProperty('session_id');
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test('api/stats returns aggregated stats', async () => {
|
|
65
|
+
const res = await fetch(`http://127.0.0.1:${PORT}/api/stats`);
|
|
66
|
+
expect(res.ok).toBe(true);
|
|
67
|
+
const body = await res.json();
|
|
68
|
+
expect(body.total_days).toBeGreaterThan(0);
|
|
69
|
+
expect(body.total_sessions).toBeGreaterThan(0);
|
|
70
|
+
expect(body.per_day.length).toBeGreaterThan(0);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test('frontend serves index.html', async ({ page }) => {
|
|
74
|
+
await page.goto(`http://127.0.0.1:${PORT}/`);
|
|
75
|
+
await expect(page.locator('nav')).toBeVisible();
|
|
76
|
+
await expect(page.locator('.nav-brand')).toHaveText('opencode');
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test('overview page shows stats', async ({ page }) => {
|
|
80
|
+
await page.goto(`http://127.0.0.1:${PORT}/#/`);
|
|
81
|
+
await expect(page.getByRole('heading', { name: 'Overview' })).toBeVisible();
|
|
82
|
+
await expect(page.locator('.stats-grid')).toBeVisible();
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test('daily page lists dates', async ({ page }) => {
|
|
86
|
+
await page.goto(`http://127.0.0.1:${PORT}/#/daily`);
|
|
87
|
+
await expect(page.locator('.page-title')).toHaveText('Daily Reports');
|
|
88
|
+
const links = page.locator('a[href^="#/daily/"]');
|
|
89
|
+
const count = await links.count();
|
|
90
|
+
expect(count).toBeGreaterThanOrEqual(4);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test('sessions page shows session cards', async ({ page }) => {
|
|
94
|
+
await page.goto(`http://127.0.0.1:${PORT}/#/sessions`);
|
|
95
|
+
await expect(page.locator('.page-title')).toHaveText(/All Sessions/);
|
|
96
|
+
await page.waitForSelector('.session-card');
|
|
97
|
+
const cards = await page.locator('.session-card').count();
|
|
98
|
+
expect(cards).toBeGreaterThan(0);
|
|
99
|
+
});
|
|
100
|
+
});
|