repoburg 1.3.217 → 1.3.219

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.
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const http_1 = __importDefault(require("http"));
7
+ const express_1 = __importDefault(require("express"));
8
+ const fs_extra_1 = __importDefault(require("fs-extra"));
9
+ const os_1 = __importDefault(require("os"));
10
+ const path_1 = __importDefault(require("path"));
11
+ const staticServing_1 = require("./staticServing");
12
+ const tmpDist = fs_extra_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), 'pane-dist-'));
13
+ // Fake dist bundle: index.html + one asset.
14
+ fs_extra_1.default.writeFileSync(path_1.default.join(tmpDist, 'index.html'), '<!DOCTYPE html><html><body>pane-spa</body></html>');
15
+ fs_extra_1.default.ensureDirSync(path_1.default.join(tmpDist, 'assets'));
16
+ fs_extra_1.default.writeFileSync(path_1.default.join(tmpDist, 'assets', 'app.js'), 'console.log("pane");');
17
+ function buildApp() {
18
+ const app = (0, express_1.default)();
19
+ // API routes are matched before the static router — simulate the delegate.
20
+ app.all('/api/*', (_req, res) => {
21
+ res.status(503).json({ error: 'pane unavailable' });
22
+ });
23
+ app.get('/health', (_req, res) => {
24
+ res.status(200).json({ status: 'ok' });
25
+ });
26
+ app.use((0, staticServing_1.createPaneFrontendRouter)(tmpDist));
27
+ return app.listen(0, '127.0.0.1');
28
+ }
29
+ function request(server, method, url) {
30
+ const { port } = server.address();
31
+ return new Promise((resolve, reject) => {
32
+ const req = http_1.default.request({ host: '127.0.0.1', port, method, path: url }, (res) => {
33
+ let data = '';
34
+ res.on('data', (chunk) => (data += chunk));
35
+ res.on('end', () => resolve({ status: res.statusCode ?? 0, body: data, type: res.headers['content-type'] }));
36
+ });
37
+ req.on('error', reject);
38
+ req.end();
39
+ });
40
+ }
41
+ describe('staticServing', () => {
42
+ let server;
43
+ beforeAll(async () => {
44
+ server = await new Promise((resolve) => {
45
+ const s = buildApp();
46
+ s.on('listening', () => resolve(s));
47
+ });
48
+ });
49
+ afterAll(() => new Promise((resolve) => {
50
+ server.close(() => resolve());
51
+ fs_extra_1.default.removeSync(tmpDist);
52
+ }));
53
+ it('serves the SPA index at the root', async () => {
54
+ const res = await request(server, 'GET', '/');
55
+ expect(res.status).toBe(200);
56
+ expect(res.body).toContain('pane-spa');
57
+ });
58
+ it('serves static assets with correct content type', async () => {
59
+ const res = await request(server, 'GET', '/assets/app.js');
60
+ expect(res.status).toBe(200);
61
+ expect(res.body).toContain('pane');
62
+ expect(res.type).toContain('javascript');
63
+ });
64
+ it('falls back to the SPA for client-side routes', async () => {
65
+ const res = await request(server, 'GET', '/sessions/abc-123');
66
+ expect(res.status).toBe(200);
67
+ expect(res.body).toContain('pane-spa');
68
+ });
69
+ it('never shadows /api paths (handled by the pane delegate first)', async () => {
70
+ const res = await request(server, 'GET', '/api/sessions');
71
+ expect(res.status).toBe(503);
72
+ });
73
+ it('never shadows /health', async () => {
74
+ const res = await request(server, 'GET', '/health');
75
+ expect(res.status).toBe(200);
76
+ expect(JSON.parse(res.body)).toEqual({ status: 'ok' });
77
+ });
78
+ it('resolves the dist path absolutely from the daemon module directory', () => {
79
+ expect((0, staticServing_1.resolvePaneFrontendDist)('/repo/daemon/src')).toBe(path_1.default.resolve('/repo/agent-pane/frontend/dist'));
80
+ expect((0, staticServing_1.resolvePaneFrontendDist)('/repo/daemon/dist')).toBe(path_1.default.resolve('/repo/agent-pane/frontend/dist'));
81
+ });
82
+ it('returns null when the dist bundle is missing', () => {
83
+ expect((0, staticServing_1.createPaneFrontendRouter)('/nonexistent/pane/dist')).toBeNull();
84
+ });
85
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repoburg",
3
- "version": "1.3.217",
3
+ "version": "1.3.219",
4
4
  "description": "A local AI-powered software developer assistant that runs on your own machine.",
5
5
  "author": "Celal Ertug",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -39,7 +39,7 @@
39
39
  "dev:agent-pane": "concurrently -n backend,frontend -c blue,green \"cd agent-pane/backend && npm run dev\" \"cd agent-pane/frontend && npm run dev\"",
40
40
  "jaeger:start": "docker run -d --rm --name jaeger -e COLLECTOR_OTLP_ENABLED=true -p 16686:16686 -p 4318:4318 jaegertracing/all-in-one:latest",
41
41
  "jaeger:stop": "docker stop jaeger",
42
- "lo:build": "npm run build -w backend && npm run build -w website2 && (cd agent-pane/backend && npm run build) && npm run build -w daemon && npm run build -w visual-editor-proxy && cd frontend && npm run build",
42
+ "lo:build": "npm run build -w backend && npm run build -w website2 && (cd agent-pane/backend && npm run build) && (cd agent-pane/frontend && npm run build) && npm run build -w daemon && npm run build -w visual-editor-proxy && cd frontend && npm run build",
43
43
  "lo:publish": "npm publish"
44
44
  },
45
45
  "dependencies": {