@sienklogic/plan-build-run 2.32.0 → 2.33.0

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.
Files changed (74) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dashboard/src/index.tsx +8 -2
  3. package/package.json +2 -2
  4. package/plugins/copilot-pbr/plugin.json +1 -1
  5. package/plugins/cursor-pbr/.cursor-plugin/plugin.json +1 -1
  6. package/plugins/pbr/.claude-plugin/plugin.json +1 -1
  7. package/plugins/pbr/scripts/enforce-pbr-workflow.js +19 -3
  8. package/dashboard/src/app.js +0 -91
  9. package/dashboard/src/middleware/current-phase.js +0 -25
  10. package/dashboard/src/middleware/errorHandler.js +0 -62
  11. package/dashboard/src/middleware/notFoundHandler.js +0 -9
  12. package/dashboard/src/routes/events.routes.js +0 -94
  13. package/dashboard/src/routes/index.routes.js +0 -35
  14. package/dashboard/src/routes/pages.routes.js +0 -853
  15. package/dashboard/src/views/analytics.ejs +0 -5
  16. package/dashboard/src/views/audit-detail.ejs +0 -5
  17. package/dashboard/src/views/audits.ejs +0 -5
  18. package/dashboard/src/views/config.ejs +0 -5
  19. package/dashboard/src/views/dependencies.ejs +0 -5
  20. package/dashboard/src/views/error.ejs +0 -20
  21. package/dashboard/src/views/index.ejs +0 -5
  22. package/dashboard/src/views/logs.ejs +0 -3
  23. package/dashboard/src/views/milestone-detail.ejs +0 -5
  24. package/dashboard/src/views/milestones.ejs +0 -5
  25. package/dashboard/src/views/note-detail.ejs +0 -3
  26. package/dashboard/src/views/notes.ejs +0 -5
  27. package/dashboard/src/views/partials/activity-feed.ejs +0 -27
  28. package/dashboard/src/views/partials/analytics-content.ejs +0 -241
  29. package/dashboard/src/views/partials/audit-detail-content.ejs +0 -14
  30. package/dashboard/src/views/partials/audits-content.ejs +0 -36
  31. package/dashboard/src/views/partials/breadcrumbs.ejs +0 -18
  32. package/dashboard/src/views/partials/config-content.ejs +0 -219
  33. package/dashboard/src/views/partials/dashboard-content.ejs +0 -124
  34. package/dashboard/src/views/partials/dependencies-content.ejs +0 -50
  35. package/dashboard/src/views/partials/empty-state.ejs +0 -12
  36. package/dashboard/src/views/partials/footer.ejs +0 -9
  37. package/dashboard/src/views/partials/head.ejs +0 -31
  38. package/dashboard/src/views/partials/header.ejs +0 -18
  39. package/dashboard/src/views/partials/layout-bottom.ejs +0 -8
  40. package/dashboard/src/views/partials/layout-top.ejs +0 -17
  41. package/dashboard/src/views/partials/log-entries-content.ejs +0 -17
  42. package/dashboard/src/views/partials/logs-content.ejs +0 -131
  43. package/dashboard/src/views/partials/milestone-detail-content.ejs +0 -20
  44. package/dashboard/src/views/partials/milestones-content.ejs +0 -127
  45. package/dashboard/src/views/partials/note-detail-content.ejs +0 -24
  46. package/dashboard/src/views/partials/notes-content.ejs +0 -28
  47. package/dashboard/src/views/partials/phase-content.ejs +0 -226
  48. package/dashboard/src/views/partials/phase-doc-content.ejs +0 -36
  49. package/dashboard/src/views/partials/phase-timeline.ejs +0 -27
  50. package/dashboard/src/views/partials/phases-content.ejs +0 -137
  51. package/dashboard/src/views/partials/quick-content.ejs +0 -42
  52. package/dashboard/src/views/partials/quick-detail-content.ejs +0 -30
  53. package/dashboard/src/views/partials/requirements-content.ejs +0 -44
  54. package/dashboard/src/views/partials/research-content.ejs +0 -56
  55. package/dashboard/src/views/partials/research-detail-content.ejs +0 -25
  56. package/dashboard/src/views/partials/roadmap-content.ejs +0 -197
  57. package/dashboard/src/views/partials/sidebar.ejs +0 -98
  58. package/dashboard/src/views/partials/todo-create-content.ejs +0 -59
  59. package/dashboard/src/views/partials/todo-detail-content.ejs +0 -43
  60. package/dashboard/src/views/partials/todos-content.ejs +0 -110
  61. package/dashboard/src/views/partials/todos-done-content.ejs +0 -46
  62. package/dashboard/src/views/phase-detail.ejs +0 -5
  63. package/dashboard/src/views/phase-doc.ejs +0 -5
  64. package/dashboard/src/views/phases.ejs +0 -5
  65. package/dashboard/src/views/quick-detail.ejs +0 -5
  66. package/dashboard/src/views/quick.ejs +0 -5
  67. package/dashboard/src/views/requirements.ejs +0 -3
  68. package/dashboard/src/views/research-detail.ejs +0 -3
  69. package/dashboard/src/views/research.ejs +0 -3
  70. package/dashboard/src/views/roadmap.ejs +0 -5
  71. package/dashboard/src/views/todo-create.ejs +0 -5
  72. package/dashboard/src/views/todo-detail.ejs +0 -5
  73. package/dashboard/src/views/todos-done.ejs +0 -3
  74. package/dashboard/src/views/todos.ejs +0 -5
package/CHANGELOG.md CHANGED
@@ -5,6 +5,20 @@ 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.33.0](https://github.com/SienkLogic/plan-build-run/compare/plan-build-run-v2.32.1...plan-build-run-v2.33.0) (2026-02-25)
9
+
10
+
11
+ ### Features
12
+
13
+ * **quick-008:** add block mode to checkNonPbrAgent for stronger enforcement ([57b2117](https://github.com/SienkLogic/plan-build-run/commit/57b2117bda206fd88f7bbf4b89895b6feec422eb))
14
+
15
+ ## [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)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * **43-02:** use tsx runtime with absolute static path for cross-cwd dashboard launch ([b19d7d5](https://github.com/SienkLogic/plan-build-run/commit/b19d7d5267632eed82760257df7f50592a71f139))
21
+
8
22
  ## [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
23
 
10
24
 
@@ -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: './public' }));
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.0",
3
+ "version": "2.33.0",
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": "node dashboard/bin/cli.js",
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.0",
4
+ "version": "2.33.0",
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.0",
4
+ "version": "2.33.0",
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.0",
3
+ "version": "2.33.0",
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",
@@ -131,11 +131,11 @@ const AGENT_MAPPING = {
131
131
  * - subagent_type is missing/empty (can't determine type)
132
132
  * - Enforcement level is "off"
133
133
  *
134
- * NOTE: This function NEVER blocks Task() blocking is too disruptive.
135
- * It always returns an advisory (exitCode 0) or null.
134
+ * In "advisory" mode (default): returns exitCode 0 with additionalContext.
135
+ * In "block" mode: returns exitCode 2 with decision/reason to hard-block the agent spawn.
136
136
  *
137
137
  * @param {Object} data - parsed hook input from Claude Code
138
- * @returns {null|{ exitCode: 0, output: Object }}
138
+ * @returns {null|{ exitCode: number, output: Object }}
139
139
  */
140
140
  function checkNonPbrAgent(data) {
141
141
  const subagentType = data.tool_input && data.tool_input.subagent_type;
@@ -154,6 +154,22 @@ function checkNonPbrAgent(data) {
154
154
  if (config.level === 'off') return null;
155
155
 
156
156
  const suggestion = AGENT_MAPPING[subagentType] || 'a pbr:* agent (e.g., pbr:researcher, pbr:general, pbr:executor)';
157
+
158
+ if (config.level === 'block') {
159
+ const blockMessage =
160
+ `PBR workflow violation: spawning generic agent "${subagentType}" is blocked. ` +
161
+ `Use ${suggestion} instead. ` +
162
+ 'PBR agents are auto-loaded via subagent_type — just change the type, no extra setup needed. ' +
163
+ 'Set workflow.enforce_pbr_skills: "advisory" in config to allow with warnings.';
164
+
165
+ logHook('enforce-pbr-workflow', 'PreToolUse', 'block', { agentType: subagentType, suggestion });
166
+ return {
167
+ exitCode: 2,
168
+ output: { decision: 'block', reason: '[pbr] ' + blockMessage }
169
+ };
170
+ }
171
+
172
+ // advisory (default)
157
173
  const message =
158
174
  `PBR workflow advisory: spawning generic agent "${subagentType}" without PBR routing. ` +
159
175
  `Use ${suggestion} instead to maintain audit logging and workflow context. ` +
@@ -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, '&amp;')
10
- .replace(/</g, '&lt;')
11
- .replace(/>/g, '&gt;')
12
- .replace(/"/g, '&quot;')
13
- .replace(/'/g, '&#39;');
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;