@sienklogic/plan-build-run 2.33.1 → 2.37.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 (140) hide show
  1. package/CHANGELOG.md +678 -0
  2. package/dashboard/public/css/command-center.css +152 -65
  3. package/dashboard/public/css/explorer.css +70 -41
  4. package/dashboard/public/css/layout.css +163 -2
  5. package/dashboard/public/css/settings.css +108 -110
  6. package/dashboard/public/css/timeline.css +2 -1
  7. package/dashboard/public/css/tokens.css +13 -0
  8. package/dashboard/public/js/sidebar-toggle.js +21 -7
  9. package/dashboard/src/components/Layout.tsx +51 -7
  10. package/dashboard/src/components/explorer/tabs/MilestonesTab.tsx +18 -2
  11. package/dashboard/src/components/explorer/tabs/PhasesTab.tsx +11 -1
  12. package/dashboard/src/components/explorer/tabs/TodosTab.tsx +25 -6
  13. package/dashboard/src/components/partials/AttentionPanel.tsx +7 -1
  14. package/dashboard/src/components/partials/CurrentPhaseCard.tsx +26 -24
  15. package/dashboard/src/components/partials/QuickActions.tsx +21 -11
  16. package/dashboard/src/components/partials/StatCardGrid.tsx +67 -0
  17. package/dashboard/src/components/partials/StatusHeader.tsx +2 -1
  18. package/dashboard/src/components/settings/LogEntryList.tsx +43 -5
  19. package/dashboard/src/routes/command-center.routes.tsx +8 -7
  20. package/dashboard/src/routes/index.routes.tsx +32 -29
  21. package/package.json +2 -2
  22. package/plugins/copilot-pbr/agents/audit.agent.md +128 -16
  23. package/plugins/copilot-pbr/agents/codebase-mapper.agent.md +48 -1
  24. package/plugins/copilot-pbr/agents/debugger.agent.md +47 -1
  25. package/plugins/copilot-pbr/agents/executor.agent.md +152 -8
  26. package/plugins/copilot-pbr/agents/general.agent.md +46 -1
  27. package/plugins/copilot-pbr/agents/integration-checker.agent.md +52 -2
  28. package/plugins/copilot-pbr/agents/plan-checker.agent.md +50 -2
  29. package/plugins/copilot-pbr/agents/planner.agent.md +54 -1
  30. package/plugins/copilot-pbr/agents/researcher.agent.md +47 -2
  31. package/plugins/copilot-pbr/agents/synthesizer.agent.md +49 -1
  32. package/plugins/copilot-pbr/agents/verifier.agent.md +86 -2
  33. package/plugins/copilot-pbr/hooks/hooks.json +11 -0
  34. package/plugins/copilot-pbr/plugin.json +1 -1
  35. package/plugins/copilot-pbr/references/agent-contracts.md +27 -0
  36. package/plugins/copilot-pbr/references/checkpoints.md +32 -1
  37. package/plugins/copilot-pbr/references/context-quality-tiers.md +45 -0
  38. package/plugins/copilot-pbr/references/pbr-tools-cli.md +115 -0
  39. package/plugins/copilot-pbr/references/questioning.md +21 -1
  40. package/plugins/copilot-pbr/references/verification-patterns.md +52 -1
  41. package/plugins/copilot-pbr/skills/audit/SKILL.md +19 -3
  42. package/plugins/copilot-pbr/skills/begin/SKILL.md +57 -4
  43. package/plugins/copilot-pbr/skills/build/SKILL.md +39 -2
  44. package/plugins/copilot-pbr/skills/debug/SKILL.md +12 -1
  45. package/plugins/copilot-pbr/skills/explore/SKILL.md +13 -2
  46. package/plugins/copilot-pbr/skills/import/SKILL.md +26 -1
  47. package/plugins/copilot-pbr/skills/milestone/SKILL.md +15 -3
  48. package/plugins/copilot-pbr/skills/plan/SKILL.md +50 -0
  49. package/plugins/copilot-pbr/skills/quick/SKILL.md +21 -0
  50. package/plugins/copilot-pbr/skills/review/SKILL.md +45 -0
  51. package/plugins/copilot-pbr/skills/scan/SKILL.md +20 -0
  52. package/plugins/copilot-pbr/templates/SUMMARY-complex.md.tmpl +95 -0
  53. package/plugins/copilot-pbr/templates/SUMMARY-minimal.md.tmpl +48 -0
  54. package/plugins/cursor-pbr/.cursor-plugin/plugin.json +1 -1
  55. package/plugins/cursor-pbr/agents/audit.md +51 -5
  56. package/plugins/cursor-pbr/agents/codebase-mapper.md +48 -1
  57. package/plugins/cursor-pbr/agents/debugger.md +47 -1
  58. package/plugins/cursor-pbr/agents/executor.md +152 -8
  59. package/plugins/cursor-pbr/agents/general.md +46 -1
  60. package/plugins/cursor-pbr/agents/integration-checker.md +51 -1
  61. package/plugins/cursor-pbr/agents/plan-checker.md +49 -1
  62. package/plugins/cursor-pbr/agents/planner.md +54 -1
  63. package/plugins/cursor-pbr/agents/researcher.md +46 -1
  64. package/plugins/cursor-pbr/agents/synthesizer.md +49 -1
  65. package/plugins/cursor-pbr/agents/verifier.md +85 -1
  66. package/plugins/cursor-pbr/hooks/hooks.json +9 -0
  67. package/plugins/cursor-pbr/references/agent-contracts.md +27 -0
  68. package/plugins/cursor-pbr/references/checkpoints.md +32 -1
  69. package/plugins/cursor-pbr/references/context-quality-tiers.md +45 -0
  70. package/plugins/cursor-pbr/references/pbr-tools-cli.md +115 -0
  71. package/plugins/cursor-pbr/references/questioning.md +21 -1
  72. package/plugins/cursor-pbr/references/verification-patterns.md +52 -1
  73. package/plugins/cursor-pbr/skills/audit/SKILL.md +19 -3
  74. package/plugins/cursor-pbr/skills/begin/SKILL.md +57 -4
  75. package/plugins/cursor-pbr/skills/build/SKILL.md +37 -2
  76. package/plugins/cursor-pbr/skills/debug/SKILL.md +12 -1
  77. package/plugins/cursor-pbr/skills/explore/SKILL.md +13 -2
  78. package/plugins/cursor-pbr/skills/import/SKILL.md +26 -1
  79. package/plugins/cursor-pbr/skills/milestone/SKILL.md +15 -3
  80. package/plugins/cursor-pbr/skills/plan/SKILL.md +50 -0
  81. package/plugins/cursor-pbr/skills/quick/SKILL.md +21 -0
  82. package/plugins/cursor-pbr/skills/review/SKILL.md +45 -0
  83. package/plugins/cursor-pbr/skills/scan/SKILL.md +20 -0
  84. package/plugins/cursor-pbr/templates/SUMMARY-complex.md.tmpl +95 -0
  85. package/plugins/cursor-pbr/templates/SUMMARY-minimal.md.tmpl +48 -0
  86. package/plugins/pbr/.claude-plugin/plugin.json +1 -1
  87. package/plugins/pbr/agents/audit.md +44 -0
  88. package/plugins/pbr/agents/codebase-mapper.md +47 -0
  89. package/plugins/pbr/agents/debugger.md +46 -0
  90. package/plugins/pbr/agents/executor.md +150 -6
  91. package/plugins/pbr/agents/general.md +45 -0
  92. package/plugins/pbr/agents/integration-checker.md +50 -0
  93. package/plugins/pbr/agents/plan-checker.md +48 -0
  94. package/plugins/pbr/agents/planner.md +51 -0
  95. package/plugins/pbr/agents/researcher.md +45 -0
  96. package/plugins/pbr/agents/synthesizer.md +48 -0
  97. package/plugins/pbr/agents/verifier.md +84 -0
  98. package/plugins/pbr/hooks/hooks.json +9 -0
  99. package/plugins/pbr/references/agent-contracts.md +27 -0
  100. package/plugins/pbr/references/checkpoints.md +32 -0
  101. package/plugins/pbr/references/context-quality-tiers.md +45 -0
  102. package/plugins/pbr/references/pbr-tools-cli.md +115 -0
  103. package/plugins/pbr/references/questioning.md +21 -0
  104. package/plugins/pbr/references/verification-patterns.md +52 -0
  105. package/plugins/pbr/scripts/check-plan-format.js +15 -3
  106. package/plugins/pbr/scripts/check-state-sync.js +26 -7
  107. package/plugins/pbr/scripts/check-subagent-output.js +30 -2
  108. package/plugins/pbr/scripts/config-schema.json +11 -1
  109. package/plugins/pbr/scripts/context-bridge.js +259 -0
  110. package/plugins/pbr/scripts/context-budget-check.js +2 -2
  111. package/plugins/pbr/scripts/lib/config.js +178 -0
  112. package/plugins/pbr/scripts/lib/core.js +578 -0
  113. package/plugins/pbr/scripts/lib/history.js +73 -0
  114. package/plugins/pbr/scripts/lib/init.js +166 -0
  115. package/plugins/pbr/scripts/lib/phase.js +364 -0
  116. package/plugins/pbr/scripts/lib/roadmap.js +175 -0
  117. package/plugins/pbr/scripts/lib/state.js +397 -0
  118. package/plugins/pbr/scripts/pbr-tools.js +346 -1235
  119. package/plugins/pbr/scripts/post-write-dispatch.js +5 -4
  120. package/plugins/pbr/scripts/post-write-quality.js +3 -3
  121. package/plugins/pbr/scripts/pre-write-dispatch.js +1 -1
  122. package/plugins/pbr/scripts/progress-tracker.js +1 -1
  123. package/plugins/pbr/scripts/suggest-compact.js +1 -1
  124. package/plugins/pbr/scripts/track-context-budget.js +53 -2
  125. package/plugins/pbr/scripts/validate-task.js +20 -28
  126. package/plugins/pbr/skills/audit/SKILL.md +19 -3
  127. package/plugins/pbr/skills/begin/SKILL.md +48 -2
  128. package/plugins/pbr/skills/build/SKILL.md +39 -2
  129. package/plugins/pbr/skills/debug/SKILL.md +12 -1
  130. package/plugins/pbr/skills/debug/templates/continuation-prompt.md.tmpl +12 -1
  131. package/plugins/pbr/skills/debug/templates/initial-investigation-prompt.md.tmpl +12 -5
  132. package/plugins/pbr/skills/explore/SKILL.md +13 -2
  133. package/plugins/pbr/skills/import/SKILL.md +26 -1
  134. package/plugins/pbr/skills/milestone/SKILL.md +15 -3
  135. package/plugins/pbr/skills/plan/SKILL.md +52 -2
  136. package/plugins/pbr/skills/quick/SKILL.md +21 -0
  137. package/plugins/pbr/skills/review/SKILL.md +46 -0
  138. package/plugins/pbr/skills/scan/SKILL.md +20 -0
  139. package/plugins/pbr/templates/SUMMARY-complex.md.tmpl +95 -0
  140. package/plugins/pbr/templates/SUMMARY-minimal.md.tmpl +48 -0
@@ -21,7 +21,7 @@ const fs = require('fs');
21
21
  const path = require('path');
22
22
  const { logHook } = require('./hook-logger');
23
23
  const { logEvent } = require('./event-logger');
24
- const { atomicWrite, configLoad, tailLines } = require('./pbr-tools');
24
+ const { configLoad, tailLines, lockedFileUpdate } = require('./pbr-tools');
25
25
 
26
26
  function main() {
27
27
  const cwd = process.cwd();
@@ -87,7 +87,7 @@ function main() {
87
87
  content = content.trimEnd() + `\n\n${continuityHeader}\n${continuityContent}\n`;
88
88
  }
89
89
 
90
- atomicWrite(stateFile, content);
90
+ lockedFileUpdate(stateFile, () => content);
91
91
 
92
92
  // Output additionalContext for post-compaction recovery
93
93
  const recoveryContext = buildRecoveryContext(activeOp, roadmapSummary, currentPlan, configHighlights, recentErrors, recentAgents);
@@ -0,0 +1,178 @@
1
+ /**
2
+ * lib/config.js — Config operations for Plan-Build-Run tools.
3
+ *
4
+ * Handles loading, caching, validating, and resolving depth profiles
5
+ * for .planning/config.json.
6
+ */
7
+
8
+ const fs = require('fs');
9
+ const path = require('path');
10
+ const { validateObject } = require('./core');
11
+
12
+ // --- Cached config loader ---
13
+
14
+ let _configCache = null;
15
+ let _configMtime = 0;
16
+ let _configPath = null;
17
+
18
+ /**
19
+ * Load config.json with in-process mtime-based caching.
20
+ * Returns the parsed config object, or null if not found / parse error.
21
+ * Cache invalidates when file mtime changes or path differs.
22
+ *
23
+ * @param {string} [dir] - Path to .planning directory (defaults to PBR_PROJECT_ROOT/.planning or cwd/.planning)
24
+ * @returns {object|null} Parsed config or null
25
+ */
26
+ function configLoad(dir) {
27
+ const planningDir = dir || path.join(process.env.PBR_PROJECT_ROOT || process.cwd(), '.planning');
28
+ const configPath = path.join(planningDir, 'config.json');
29
+ try {
30
+ if (!fs.existsSync(configPath)) return null;
31
+ const stat = fs.statSync(configPath);
32
+ const mtime = stat.mtimeMs;
33
+ if (_configCache && mtime === _configMtime && configPath === _configPath) {
34
+ return _configCache;
35
+ }
36
+ _configCache = JSON.parse(fs.readFileSync(configPath, 'utf8'));
37
+ _configMtime = mtime;
38
+ _configPath = configPath;
39
+ return _configCache;
40
+ } catch (_e) {
41
+ return null;
42
+ }
43
+ }
44
+
45
+ /**
46
+ * Clear the configLoad() in-process cache.
47
+ * Useful in tests where multiple temp directories are used in rapid succession.
48
+ */
49
+ function configClearCache() {
50
+ _configCache = null;
51
+ _configMtime = 0;
52
+ _configPath = null;
53
+ }
54
+
55
+ /**
56
+ * Validate config.json against schema. Accepts a preloaded config object
57
+ * or reads from the default planningDir.
58
+ *
59
+ * @param {object} [preloadedConfig] - Pre-parsed config object. If omitted, reads from disk.
60
+ * @param {string} [planningDir] - Path to .planning directory (used when reading from disk)
61
+ * @returns {{ valid: boolean, errors: string[], warnings: string[] }}
62
+ */
63
+ function configValidate(preloadedConfig, planningDir) {
64
+ let config;
65
+ if (preloadedConfig) {
66
+ config = preloadedConfig;
67
+ } else {
68
+ const dir = planningDir || path.join(process.env.PBR_PROJECT_ROOT || process.cwd(), '.planning');
69
+ const configPath = path.join(dir, 'config.json');
70
+ if (!fs.existsSync(configPath)) {
71
+ return { valid: false, errors: ['config.json not found'], warnings: [] };
72
+ }
73
+
74
+ try {
75
+ config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
76
+ } catch (e) {
77
+ return { valid: false, errors: [`config.json is not valid JSON: ${e.message}`], warnings: [] };
78
+ }
79
+ }
80
+
81
+ const schema = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'config-schema.json'), 'utf8'));
82
+ const warnings = [];
83
+ const errors = [];
84
+
85
+ validateObject(config, schema, '', errors, warnings);
86
+
87
+ // Schema version check — detect outdated config format
88
+ const CURRENT_SCHEMA_VERSION = 1;
89
+ if (config.schema_version && config.schema_version > CURRENT_SCHEMA_VERSION) {
90
+ warnings.push(`config.json schema_version (${config.schema_version}) is newer than this PBR version supports (${CURRENT_SCHEMA_VERSION}). Some fields may be ignored. Consider updating PBR.`);
91
+ }
92
+
93
+ // Semantic conflict detection — logical contradictions that pass schema validation
94
+ // Clear contradictions -> errors; ambiguous/preference issues -> warnings
95
+ if (config.mode === 'autonomous' && config.gates) {
96
+ const activeGates = Object.entries(config.gates || {}).filter(([, v]) => v === true).map(([k]) => k);
97
+ if (activeGates.length > 0) {
98
+ errors.push(`mode=autonomous with active gates (${activeGates.join(', ')}): gates are unreachable in autonomous mode`);
99
+ }
100
+ }
101
+ if (config.features && config.features.auto_continue && config.mode === 'interactive') {
102
+ warnings.push('features.auto_continue=true with mode=interactive: auto_continue only fires in autonomous mode');
103
+ }
104
+ if (config.parallelization) {
105
+ if (config.parallelization.enabled === false && config.parallelization.plan_level === true) {
106
+ warnings.push('parallelization.enabled=false with plan_level=true: plan_level is ignored when parallelization is disabled');
107
+ }
108
+ if (config.parallelization.max_concurrent_agents === 1 && config.teams && config.teams.coordination) {
109
+ errors.push('parallelization.max_concurrent_agents=1 with teams.coordination set: teams require concurrent agents to be useful');
110
+ }
111
+ }
112
+
113
+ return {
114
+ valid: errors.length === 0,
115
+ errors,
116
+ warnings
117
+ };
118
+ }
119
+
120
+ /**
121
+ * Built-in depth profile defaults. These define the effective settings
122
+ * for each depth level. User config.depth_profiles overrides these.
123
+ */
124
+ const DEPTH_PROFILE_DEFAULTS = {
125
+ quick: {
126
+ 'features.research_phase': false,
127
+ 'features.plan_checking': false,
128
+ 'features.goal_verification': false,
129
+ 'features.inline_verify': false,
130
+ 'scan.mapper_count': 2,
131
+ 'scan.mapper_areas': ['tech', 'arch'],
132
+ 'debug.max_hypothesis_rounds': 3
133
+ },
134
+ standard: {
135
+ 'features.research_phase': true,
136
+ 'features.plan_checking': true,
137
+ 'features.goal_verification': true,
138
+ 'features.inline_verify': false,
139
+ 'scan.mapper_count': 4,
140
+ 'scan.mapper_areas': ['tech', 'arch', 'quality', 'concerns'],
141
+ 'debug.max_hypothesis_rounds': 5
142
+ },
143
+ comprehensive: {
144
+ 'features.research_phase': true,
145
+ 'features.plan_checking': true,
146
+ 'features.goal_verification': true,
147
+ 'features.inline_verify': true,
148
+ 'scan.mapper_count': 4,
149
+ 'scan.mapper_areas': ['tech', 'arch', 'quality', 'concerns'],
150
+ 'debug.max_hypothesis_rounds': 10
151
+ }
152
+ };
153
+
154
+ /**
155
+ * Resolve the effective depth profile for the current config.
156
+ * Merges built-in defaults with any user overrides from config.depth_profiles.
157
+ *
158
+ * @param {object|null} config - Parsed config.json (from configLoad). If null, returns 'standard' defaults.
159
+ * @returns {{ depth: string, profile: object }} The resolved depth name and flattened profile settings.
160
+ */
161
+ function resolveDepthProfile(config) {
162
+ const depth = (config && config.depth) || 'standard';
163
+ const defaults = DEPTH_PROFILE_DEFAULTS[depth] || DEPTH_PROFILE_DEFAULTS.standard;
164
+
165
+ // Merge user overrides if present
166
+ const userOverrides = (config && config.depth_profiles && config.depth_profiles[depth]) || {};
167
+ const profile = { ...defaults, ...userOverrides };
168
+
169
+ return { depth, profile };
170
+ }
171
+
172
+ module.exports = {
173
+ configLoad,
174
+ configClearCache,
175
+ configValidate,
176
+ resolveDepthProfile,
177
+ DEPTH_PROFILE_DEFAULTS
178
+ };