@sienklogic/plan-build-run 2.32.0 → 2.32.1
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/CHANGELOG.md +7 -0
- package/dashboard/src/index.tsx +8 -2
- package/package.json +2 -2
- package/plugins/copilot-pbr/plugin.json +1 -1
- package/plugins/cursor-pbr/.cursor-plugin/plugin.json +1 -1
- package/plugins/pbr/.claude-plugin/plugin.json +1 -1
- package/dashboard/src/app.js +0 -91
- package/dashboard/src/middleware/current-phase.js +0 -25
- package/dashboard/src/middleware/errorHandler.js +0 -62
- package/dashboard/src/middleware/notFoundHandler.js +0 -9
- package/dashboard/src/routes/events.routes.js +0 -94
- package/dashboard/src/routes/index.routes.js +0 -35
- package/dashboard/src/routes/pages.routes.js +0 -853
- package/dashboard/src/views/analytics.ejs +0 -5
- package/dashboard/src/views/audit-detail.ejs +0 -5
- package/dashboard/src/views/audits.ejs +0 -5
- package/dashboard/src/views/config.ejs +0 -5
- package/dashboard/src/views/dependencies.ejs +0 -5
- package/dashboard/src/views/error.ejs +0 -20
- package/dashboard/src/views/index.ejs +0 -5
- package/dashboard/src/views/logs.ejs +0 -3
- package/dashboard/src/views/milestone-detail.ejs +0 -5
- package/dashboard/src/views/milestones.ejs +0 -5
- package/dashboard/src/views/note-detail.ejs +0 -3
- package/dashboard/src/views/notes.ejs +0 -5
- package/dashboard/src/views/partials/activity-feed.ejs +0 -27
- package/dashboard/src/views/partials/analytics-content.ejs +0 -241
- package/dashboard/src/views/partials/audit-detail-content.ejs +0 -14
- package/dashboard/src/views/partials/audits-content.ejs +0 -36
- package/dashboard/src/views/partials/breadcrumbs.ejs +0 -18
- package/dashboard/src/views/partials/config-content.ejs +0 -219
- package/dashboard/src/views/partials/dashboard-content.ejs +0 -124
- package/dashboard/src/views/partials/dependencies-content.ejs +0 -50
- package/dashboard/src/views/partials/empty-state.ejs +0 -12
- package/dashboard/src/views/partials/footer.ejs +0 -9
- package/dashboard/src/views/partials/head.ejs +0 -31
- package/dashboard/src/views/partials/header.ejs +0 -18
- package/dashboard/src/views/partials/layout-bottom.ejs +0 -8
- package/dashboard/src/views/partials/layout-top.ejs +0 -17
- package/dashboard/src/views/partials/log-entries-content.ejs +0 -17
- package/dashboard/src/views/partials/logs-content.ejs +0 -131
- package/dashboard/src/views/partials/milestone-detail-content.ejs +0 -20
- package/dashboard/src/views/partials/milestones-content.ejs +0 -127
- package/dashboard/src/views/partials/note-detail-content.ejs +0 -24
- package/dashboard/src/views/partials/notes-content.ejs +0 -28
- package/dashboard/src/views/partials/phase-content.ejs +0 -226
- package/dashboard/src/views/partials/phase-doc-content.ejs +0 -36
- package/dashboard/src/views/partials/phase-timeline.ejs +0 -27
- package/dashboard/src/views/partials/phases-content.ejs +0 -137
- package/dashboard/src/views/partials/quick-content.ejs +0 -42
- package/dashboard/src/views/partials/quick-detail-content.ejs +0 -30
- package/dashboard/src/views/partials/requirements-content.ejs +0 -44
- package/dashboard/src/views/partials/research-content.ejs +0 -56
- package/dashboard/src/views/partials/research-detail-content.ejs +0 -25
- package/dashboard/src/views/partials/roadmap-content.ejs +0 -197
- package/dashboard/src/views/partials/sidebar.ejs +0 -98
- package/dashboard/src/views/partials/todo-create-content.ejs +0 -59
- package/dashboard/src/views/partials/todo-detail-content.ejs +0 -43
- package/dashboard/src/views/partials/todos-content.ejs +0 -110
- package/dashboard/src/views/partials/todos-done-content.ejs +0 -46
- package/dashboard/src/views/phase-detail.ejs +0 -5
- package/dashboard/src/views/phase-doc.ejs +0 -5
- package/dashboard/src/views/phases.ejs +0 -5
- package/dashboard/src/views/quick-detail.ejs +0 -5
- package/dashboard/src/views/quick.ejs +0 -5
- package/dashboard/src/views/requirements.ejs +0 -3
- package/dashboard/src/views/research-detail.ejs +0 -3
- package/dashboard/src/views/research.ejs +0 -3
- package/dashboard/src/views/roadmap.ejs +0 -5
- package/dashboard/src/views/todo-create.ejs +0 -5
- package/dashboard/src/views/todo-detail.ejs +0 -5
- package/dashboard/src/views/todos-done.ejs +0 -3
- package/dashboard/src/views/todos.ejs +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@ All notable changes to Plan-Build-Run will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.32.1](https://github.com/SienkLogic/plan-build-run/compare/plan-build-run-v2.32.0...plan-build-run-v2.32.1) (2026-02-24)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **43-02:** use tsx runtime with absolute static path for cross-cwd dashboard launch ([b19d7d5](https://github.com/SienkLogic/plan-build-run/commit/b19d7d5267632eed82760257df7f50592a71f139))
|
|
14
|
+
|
|
8
15
|
## [2.32.0](https://github.com/SienkLogic/plan-build-run/compare/plan-build-run-v2.31.0...plan-build-run-v2.32.0) (2026-02-24)
|
|
9
16
|
|
|
10
17
|
|
package/dashboard/src/index.tsx
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { serve } from '@hono/node-server';
|
|
2
2
|
import { serveStatic } from '@hono/node-server/serve-static';
|
|
3
3
|
import { Hono } from 'hono';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { dirname, join } from 'node:path';
|
|
4
6
|
import { compress } from 'hono/compress';
|
|
5
7
|
import { logger } from 'hono/logger';
|
|
6
8
|
import { secureHeaders } from 'hono/secure-headers';
|
|
@@ -33,6 +35,10 @@ type Env = {
|
|
|
33
35
|
};
|
|
34
36
|
};
|
|
35
37
|
|
|
38
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
39
|
+
const __dirname = dirname(__filename);
|
|
40
|
+
const publicDir = join(__dirname, '..', 'public');
|
|
41
|
+
|
|
36
42
|
function createApp(config: ServerConfig) {
|
|
37
43
|
const app = new Hono<Env>();
|
|
38
44
|
|
|
@@ -62,8 +68,8 @@ function createApp(config: ServerConfig) {
|
|
|
62
68
|
c.header('Vary', 'Accept');
|
|
63
69
|
});
|
|
64
70
|
|
|
65
|
-
// Static file serving from public/
|
|
66
|
-
app.use('*', serveStatic({ root:
|
|
71
|
+
// Static file serving from public/ (absolute path for cross-cwd compatibility)
|
|
72
|
+
app.use('*', serveStatic({ root: publicDir }));
|
|
67
73
|
|
|
68
74
|
// Current phase middleware — populates c.var.currentPhase for all routes
|
|
69
75
|
app.use('*', currentPhaseMiddleware);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sienklogic/plan-build-run",
|
|
3
|
-
"version": "2.32.
|
|
3
|
+
"version": "2.32.1",
|
|
4
4
|
"description": "Plan it, Build it, Run it — structured development workflow for Claude Code",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude-code",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"test": "jest",
|
|
31
31
|
"lint": "eslint plugins/pbr/scripts/ tests/",
|
|
32
32
|
"validate": "node plugins/pbr/scripts/validate-plugin-structure.js",
|
|
33
|
-
"dashboard": "
|
|
33
|
+
"dashboard": "npx --prefix dashboard tsx --tsconfig dashboard/tsconfig.json dashboard/bin/cli.js",
|
|
34
34
|
"dashboard:install": "npm install --prefix dashboard"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pbr",
|
|
3
3
|
"displayName": "Plan-Build-Run",
|
|
4
|
-
"version": "2.32.
|
|
4
|
+
"version": "2.32.1",
|
|
5
5
|
"description": "Plan-Build-Run — Structured development workflow for GitHub Copilot CLI. Solves context rot through disciplined agent delegation, structured planning, atomic execution, and goal-backward verification.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "SienkLogic",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pbr",
|
|
3
3
|
"displayName": "Plan-Build-Run",
|
|
4
|
-
"version": "2.32.
|
|
4
|
+
"version": "2.32.1",
|
|
5
5
|
"description": "Plan-Build-Run — Structured development workflow for Cursor. Solves context rot through disciplined subagent delegation, structured planning, atomic execution, and goal-backward verification.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "SienkLogic",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pbr",
|
|
3
|
-
"version": "2.32.
|
|
3
|
+
"version": "2.32.1",
|
|
4
4
|
"description": "Plan-Build-Run — Structured development workflow for Claude Code. Solves context rot through disciplined subagent delegation, structured planning, atomic execution, and goal-backward verification.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "SienkLogic",
|
package/dashboard/src/app.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import express from 'express';
|
|
2
|
-
import helmet from 'helmet';
|
|
3
|
-
import { join } from 'path';
|
|
4
|
-
import { fileURLToPath } from 'url';
|
|
5
|
-
import { dirname } from 'path';
|
|
6
|
-
import indexRouter from './routes/index.routes.js';
|
|
7
|
-
import pagesRouter from './routes/pages.routes.js';
|
|
8
|
-
import eventsRouter from './routes/events.routes.js';
|
|
9
|
-
import notFoundHandler from './middleware/notFoundHandler.js';
|
|
10
|
-
import errorHandler from './middleware/errorHandler.js';
|
|
11
|
-
import currentPhaseMiddleware from './middleware/current-phase.js';
|
|
12
|
-
import { readFileSync } from 'node:fs';
|
|
13
|
-
|
|
14
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
15
|
-
const __dirname = dirname(__filename);
|
|
16
|
-
|
|
17
|
-
export function createApp(config) {
|
|
18
|
-
const app = express();
|
|
19
|
-
|
|
20
|
-
// Security headers via Helmet
|
|
21
|
-
// CSP allows CDN scripts (HTMX, Pico.css, htmx-ext-sse) and inline styles
|
|
22
|
-
app.use(helmet({
|
|
23
|
-
contentSecurityPolicy: {
|
|
24
|
-
directives: {
|
|
25
|
-
defaultSrc: ["'self'"],
|
|
26
|
-
scriptSrc: ["'self'", "https://cdn.jsdelivr.net"],
|
|
27
|
-
styleSrc: ["'self'", "'unsafe-inline'", "https://cdn.jsdelivr.net"],
|
|
28
|
-
imgSrc: ["'self'", "data:"],
|
|
29
|
-
connectSrc: ["'self'"],
|
|
30
|
-
fontSrc: ["'self'", "https://cdn.jsdelivr.net"]
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}));
|
|
34
|
-
app.disable('x-powered-by');
|
|
35
|
-
|
|
36
|
-
// Store config for access in routes/services
|
|
37
|
-
app.locals.projectDir = config.projectDir;
|
|
38
|
-
|
|
39
|
-
// Read dashboard version from package.json for footer display
|
|
40
|
-
try {
|
|
41
|
-
const pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf-8'));
|
|
42
|
-
app.locals.dashboardVersion = pkg.version || '0.0.0';
|
|
43
|
-
} catch (_e) {
|
|
44
|
-
app.locals.dashboardVersion = '0.0.0';
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// View engine setup -- all paths use path.join (cross-platform)
|
|
48
|
-
app.set('views', join(__dirname, 'views'));
|
|
49
|
-
app.set('view engine', 'ejs');
|
|
50
|
-
|
|
51
|
-
// Built-in middleware
|
|
52
|
-
app.use(express.json());
|
|
53
|
-
app.use(express.urlencoded({ extended: false }));
|
|
54
|
-
|
|
55
|
-
// Handle common browser auto-requests cleanly (no stack traces in logs)
|
|
56
|
-
app.get('/favicon.ico', (req, res) => res.status(204).end());
|
|
57
|
-
app.get('/sw.js', (req, res) => res.status(404).end());
|
|
58
|
-
|
|
59
|
-
// Static files
|
|
60
|
-
app.use(express.static(join(__dirname, '..', 'public')));
|
|
61
|
-
|
|
62
|
-
// Auto-set HX-Title on HTMX partial responses so document.title stays current
|
|
63
|
-
app.use((req, res, next) => {
|
|
64
|
-
if (req.get('HX-Request') === 'true') {
|
|
65
|
-
const originalRender = res.render.bind(res);
|
|
66
|
-
res.render = function(view, options, callback) {
|
|
67
|
-
if (options && options.title && !res.getHeader('HX-Title')) {
|
|
68
|
-
res.setHeader('HX-Title', `${options.title} - Plan-Build-Run`);
|
|
69
|
-
}
|
|
70
|
-
return originalRender(view, options, callback);
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
next();
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
// Current phase middleware (populates res.locals.currentPhase for templates)
|
|
77
|
-
app.use(currentPhaseMiddleware);
|
|
78
|
-
|
|
79
|
-
// Routes
|
|
80
|
-
app.use('/', indexRouter);
|
|
81
|
-
app.use('/', pagesRouter);
|
|
82
|
-
app.use('/api/events', eventsRouter);
|
|
83
|
-
|
|
84
|
-
// 404 catch-all (after routes, before error handler)
|
|
85
|
-
app.use(notFoundHandler);
|
|
86
|
-
|
|
87
|
-
// Error handler MUST be registered last
|
|
88
|
-
app.use(errorHandler);
|
|
89
|
-
|
|
90
|
-
return app;
|
|
91
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { parseStateFile } from '../services/dashboard.service.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Middleware that reads STATE.md and sets res.locals.currentPhase
|
|
5
|
-
* for use in sidebar and other templates.
|
|
6
|
-
*/
|
|
7
|
-
export default async function currentPhaseMiddleware(req, res, next) {
|
|
8
|
-
try {
|
|
9
|
-
const state = await parseStateFile(req.app.locals.projectDir);
|
|
10
|
-
const cp = state.currentPhase;
|
|
11
|
-
if (cp && cp.id > 0) {
|
|
12
|
-
res.locals.currentPhase = {
|
|
13
|
-
number: cp.id,
|
|
14
|
-
name: cp.name,
|
|
15
|
-
status: cp.status,
|
|
16
|
-
nextAction: state.nextAction || null,
|
|
17
|
-
};
|
|
18
|
-
} else {
|
|
19
|
-
res.locals.currentPhase = null;
|
|
20
|
-
}
|
|
21
|
-
} catch (_err) {
|
|
22
|
-
res.locals.currentPhase = null;
|
|
23
|
-
}
|
|
24
|
-
next();
|
|
25
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Express error-handling middleware.
|
|
3
|
-
* MUST have exactly 4 parameters for Express to recognize it as an error handler.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
function escapeHtml(str) {
|
|
7
|
-
if (!str) return '';
|
|
8
|
-
return str
|
|
9
|
-
.replace(/&/g, '&')
|
|
10
|
-
.replace(/</g, '<')
|
|
11
|
-
.replace(/>/g, '>')
|
|
12
|
-
.replace(/"/g, '"')
|
|
13
|
-
.replace(/'/g, ''');
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// eslint-disable-next-line no-unused-vars
|
|
17
|
-
export default function errorHandler(err, req, res, next) {
|
|
18
|
-
// If headers already sent, delegate to Express default handler
|
|
19
|
-
if (res.headersSent) {
|
|
20
|
-
return next(err);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const isDev = process.env.NODE_ENV !== 'production';
|
|
24
|
-
const status = err.status || err.statusCode || 500;
|
|
25
|
-
|
|
26
|
-
// Logging -- skip stack traces for 404s (they're expected, not bugs)
|
|
27
|
-
if (status === 404) {
|
|
28
|
-
console.warn(`404: ${req.originalUrl}`);
|
|
29
|
-
} else {
|
|
30
|
-
console.error('Unhandled error:', err.message);
|
|
31
|
-
if (isDev) {
|
|
32
|
-
console.error(err.stack);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Detect HTMX requests
|
|
37
|
-
const isHtmx = req.get('HX-Request') === 'true';
|
|
38
|
-
|
|
39
|
-
// Set Vary header for proper caching
|
|
40
|
-
res.setHeader('Vary', 'HX-Request');
|
|
41
|
-
|
|
42
|
-
// Build template data
|
|
43
|
-
const templateData = {
|
|
44
|
-
title: `Error ${status}`,
|
|
45
|
-
status,
|
|
46
|
-
message: err.message || 'Internal Server Error',
|
|
47
|
-
stack: isDev ? err.stack : null,
|
|
48
|
-
activePage: ''
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
// Render response
|
|
52
|
-
if (isHtmx) {
|
|
53
|
-
let html = `<h1>Error ${status}</h1><p>${escapeHtml(templateData.message)}</p>`;
|
|
54
|
-
if (templateData.stack) {
|
|
55
|
-
html += `<pre><code>${escapeHtml(templateData.stack)}</code></pre>`;
|
|
56
|
-
}
|
|
57
|
-
html += '<p><a href="/">Return to Dashboard</a></p>';
|
|
58
|
-
return res.status(status).send(html);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
res.status(status).render('error', templateData);
|
|
62
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 404 catch-all handler for routes that don't match any defined route.
|
|
3
|
-
* Must be registered AFTER all route handlers but BEFORE the error handler.
|
|
4
|
-
*/
|
|
5
|
-
export default function notFoundHandler(req, res, next) {
|
|
6
|
-
const err = new Error(`Page not found: ${req.originalUrl}`);
|
|
7
|
-
err.status = 404;
|
|
8
|
-
next(err);
|
|
9
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { Router } from 'express';
|
|
2
|
-
import { addClient, removeClient } from '../services/sse.service.js';
|
|
3
|
-
import { tailLogFile } from '../services/log.service.js';
|
|
4
|
-
import { join } from 'node:path';
|
|
5
|
-
|
|
6
|
-
const router = Router();
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* GET /stream - Server-Sent Events endpoint.
|
|
10
|
-
* Establishes a long-lived SSE connection. Events are pushed by the SSE service
|
|
11
|
-
* when the file watcher detects changes. Heartbeat comments every 30s keep the
|
|
12
|
-
* connection alive.
|
|
13
|
-
*/
|
|
14
|
-
router.get('/stream', (req, res) => {
|
|
15
|
-
// Set SSE headers
|
|
16
|
-
res.writeHead(200, {
|
|
17
|
-
'Content-Type': 'text/event-stream',
|
|
18
|
-
'Cache-Control': 'no-cache',
|
|
19
|
-
'Connection': 'keep-alive',
|
|
20
|
-
'X-Accel-Buffering': 'no'
|
|
21
|
-
});
|
|
22
|
-
res.flushHeaders();
|
|
23
|
-
|
|
24
|
-
// Send initial connection confirmation
|
|
25
|
-
res.write(': connected\n\n');
|
|
26
|
-
|
|
27
|
-
// If client reconnected with a lastEventId, send state-recovery event
|
|
28
|
-
if (req.query.lastEventId) {
|
|
29
|
-
res.write(`event: state-recovery\ndata: {"action":"refresh"}\nid: ${Date.now()}\n\n`);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Register this client for broadcasts
|
|
33
|
-
addClient(res);
|
|
34
|
-
|
|
35
|
-
// Heartbeat every 30 seconds to keep connection alive
|
|
36
|
-
const heartbeat = setInterval(() => {
|
|
37
|
-
res.write(': heartbeat\n\n');
|
|
38
|
-
}, 30000);
|
|
39
|
-
|
|
40
|
-
// Clean up on client disconnect
|
|
41
|
-
req.on('close', () => {
|
|
42
|
-
clearInterval(heartbeat);
|
|
43
|
-
removeClient(res);
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* GET /logs/stream?file=<filename>
|
|
49
|
-
* SSE endpoint that tails a .planning/logs/<filename> for new JSONL entries.
|
|
50
|
-
* Sends log-entry events to the connected client.
|
|
51
|
-
*/
|
|
52
|
-
router.get('/logs/stream', async (req, res) => {
|
|
53
|
-
const { file } = req.query;
|
|
54
|
-
|
|
55
|
-
// Validate filename to prevent path traversal
|
|
56
|
-
if (!file || !/^[\w.-]+\.jsonl$/.test(file)) {
|
|
57
|
-
res.status(400).end('Invalid log file parameter');
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const projectDir = req.app.locals.projectDir;
|
|
62
|
-
const filePath = join(projectDir, '.planning', 'logs', file);
|
|
63
|
-
|
|
64
|
-
res.writeHead(200, {
|
|
65
|
-
'Content-Type': 'text/event-stream',
|
|
66
|
-
'Cache-Control': 'no-cache',
|
|
67
|
-
'Connection': 'keep-alive',
|
|
68
|
-
'X-Accel-Buffering': 'no'
|
|
69
|
-
});
|
|
70
|
-
res.flushHeaders();
|
|
71
|
-
res.write(': connected\n\n');
|
|
72
|
-
|
|
73
|
-
const sendEntry = (entry) => {
|
|
74
|
-
try {
|
|
75
|
-
const id = Date.now();
|
|
76
|
-
res.write(`event: log-entry\ndata: ${JSON.stringify(entry)}\nid: ${id}\n\n`);
|
|
77
|
-
} catch {
|
|
78
|
-
// client disconnected
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const cleanup = await tailLogFile(filePath, sendEntry);
|
|
83
|
-
|
|
84
|
-
const heartbeat = setInterval(() => {
|
|
85
|
-
res.write(': heartbeat\n\n');
|
|
86
|
-
}, 30000);
|
|
87
|
-
|
|
88
|
-
req.on('close', () => {
|
|
89
|
-
clearInterval(heartbeat);
|
|
90
|
-
cleanup();
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
export default router;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Router } from 'express';
|
|
2
|
-
import { getHomepage } from '../services/project.service.js';
|
|
3
|
-
import { getDashboardData } from '../services/dashboard.service.js';
|
|
4
|
-
import { listPendingTodos } from '../services/todo.service.js';
|
|
5
|
-
|
|
6
|
-
const router = Router();
|
|
7
|
-
|
|
8
|
-
router.get('/', async (req, res) => {
|
|
9
|
-
const projectDir = req.app.locals.projectDir;
|
|
10
|
-
|
|
11
|
-
const [homepageData, dashboardData, pendingTodos] = await Promise.all([
|
|
12
|
-
getHomepage(projectDir),
|
|
13
|
-
getDashboardData(projectDir),
|
|
14
|
-
listPendingTodos(projectDir).catch(() => [])
|
|
15
|
-
]);
|
|
16
|
-
|
|
17
|
-
const templateData = {
|
|
18
|
-
...homepageData,
|
|
19
|
-
...dashboardData,
|
|
20
|
-
pendingTodoCount: pendingTodos.length,
|
|
21
|
-
activePage: 'dashboard',
|
|
22
|
-
currentPath: '/',
|
|
23
|
-
breadcrumbs: []
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
res.setHeader('Vary', 'HX-Request');
|
|
27
|
-
|
|
28
|
-
if (req.get('HX-Request') === 'true') {
|
|
29
|
-
res.render('partials/dashboard-content', templateData);
|
|
30
|
-
} else {
|
|
31
|
-
res.render('index', templateData);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
export default router;
|