@planu/cli 5.7.10 → 5.7.11

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 CHANGED
@@ -1,3 +1,26 @@
1
+ ## [5.7.11] - 2026-09-02
2
+
3
+ ### Features
4
+ - feat(scripts): add test-profile to rank the slowest test files
5
+ - feat(preflight): bail the related lane on the first failure
6
+
7
+ ### Bug Fixes
8
+ - fix(spec-format): strip a leading list marker from the goal sentence
9
+ - fix(spec-format): unique headerless scenario titles and problem-sentence goal fallback
10
+ - fix(update-status): treat a missing planu/conventions.json as no disabled hooks
11
+ - fix(storage): sync spec_version from spec.md on digest refresh
12
+ - fix(validation): read the bound source digest once before awaiting the git digest
13
+ - fix(scripts): test-profile returns 1 without a report and drops the stray declaration file
14
+ - fix(vitest): keep vitest.config.ts double-quote style out of prettier scope
15
+ - fix(transport): exit exactly once when the stdio hard-stop races the drain
16
+
17
+ ### Performance
18
+ - perf(vitest): drop html, clover and text coverage reporters
19
+
20
+ ### Refactoring
21
+ - refactor(spec-format): drop the unreachable when-fallback in headerless title suffixing
22
+
23
+
1
24
  ## [5.7.10] - 2026-09-02
2
25
 
3
26
  ### Bug Fixes
@@ -1 +1 @@
1
- {"schemaVersion":1,"commit":"5b60b214ba5caa34dcafd810f0f2d6ad18d4a4b0"}
1
+ {"schemaVersion":1,"commit":"751d4ec85be2cb3fcb93112587d70211814166b0"}
@@ -44,15 +44,19 @@ function isSingleLineGivenWhenThenText(text) {
44
44
  function opensHeaderlessScenario(rawKeyword, text) {
45
45
  return rawKeyword === 'given' || isSingleLineGivenWhenThenText(text);
46
46
  }
47
+ function suffixedTitle(thenText, steps) {
48
+ return `${thenText} (given ${steps.find((step) => step.keyword === 'given')?.text ?? ''})`;
49
+ }
47
50
  export function parseBddScenarios(markdown) {
48
51
  const scenarios = [];
49
52
  const lines = markdown.split('\n');
50
53
  let current = null;
51
- // Tracks whether the current scenario was auto-created (no Scenario: header)
52
54
  let currentIsHeaderless = false;
55
+ const closedTitles = new Set();
53
56
  const closeCurrent = () => {
54
57
  if (current && hasThenSignal(current)) {
55
58
  scenarios.push(current);
59
+ closedTitles.add(current.title);
56
60
  }
57
61
  current = null;
58
62
  currentIsHeaderless = false;
@@ -88,9 +92,8 @@ export function parseBddScenarios(markdown) {
88
92
  currentIsHeaderless = true;
89
93
  }
90
94
  current.steps.push({ keyword, text });
91
- // For headerless scenarios, update the title to the THEN text for better descriptiveness
92
95
  if (currentIsHeaderless && keyword === 'then') {
93
- current.title = text;
96
+ current.title = closedTitles.has(text) ? suffixedTitle(text, current.steps) : text;
94
97
  }
95
98
  }
96
99
  closeCurrent();
@@ -22,7 +22,7 @@ export function buildCanonicalUnifiedSpecContent(input) {
22
22
  const proseBeforeHeading = source.split(/^##[ \t]+\S.*$/m, 1)[0]?.trim() ?? '';
23
23
  const problem = firstNonEmpty(explicitProblem, proseBeforeHeading, source);
24
24
  const explicitGoal = extractTopLevelSectionBody(source, 'Goal');
25
- const goal = firstNonEmpty(explicitGoal, input.criteria[0]?.text, 'Needs decision: define the goal this spec must achieve.');
25
+ const goal = firstNonEmpty(explicitGoal, firstSentence(problem), 'Needs decision: define the goal this spec must achieve.');
26
26
  const explicitTechnical = extractTopLevelSectionBody(source, 'Technical');
27
27
  const generatedNotes = extractTopLevelSectionBody(input.technicalBody, 'Implementation Notes');
28
28
  const technical = firstNonEmpty(explicitTechnical, generatedNotes, groundedTechnicalFallback(input.files, input.criteria));
@@ -306,6 +306,13 @@ function extractTopLevelSectionBody(body, section) {
306
306
  function renderSection(title, body) {
307
307
  return `## ${title}\n\n${body.trim()}`;
308
308
  }
309
+ function firstSentence(text) {
310
+ const paragraph = (text.split(/\n\s*\n/).find((part) => part.trim().length > 0) ?? '')
311
+ .trim()
312
+ .replace(/\s+/g, ' ')
313
+ .replace(/^(?:\d+[.)]|[-*+])\s+/, '');
314
+ return /^[\s\S]*?[.!?](?=\s|$)/.exec(paragraph)?.[0] ?? paragraph;
315
+ }
309
316
  function firstNonEmpty(...values) {
310
317
  return (values.find((value) => value !== undefined && value !== null && value.length > 0) ?? '');
311
318
  }
@@ -658,9 +658,10 @@ export async function evaluateValidationFreshnessBarrier(lease, bindings) {
658
658
  invalidateExactEpoch(lease, candidate);
659
659
  return { fresh: false, reason: 'evidence-changed', changedInput: candidate.handoffPath };
660
660
  }
661
+ const boundSourceDigest = candidate.bindings?.sourceDigest;
661
662
  try {
662
- if (candidate.bindings &&
663
- (await gitSourceTreeDigest(candidate.projectPath)) !== candidate.bindings.sourceDigest) {
663
+ if (boundSourceDigest !== undefined &&
664
+ (await gitSourceTreeDigest(candidate.projectPath)) !== boundSourceDigest) {
664
665
  invalidateExactEpoch(lease, candidate);
665
666
  return { fresh: false, reason: 'source-changed', changedInput: candidate.projectPath };
666
667
  }
@@ -230,14 +230,16 @@ export async function discoverCanonicalSpecPath(specId, canonicalRoot) {
230
230
  * getSpec/listSpecs is otherwise doing. Best-effort: failure to persist never
231
231
  * blocks the caller — the freshly parsed value is already what gets returned.
232
232
  */
233
- async function persistDigestRefresh(projectId, specId, title, contentDigest) {
233
+ async function persistDigestRefresh(projectId, specId, title, specVersion, contentDigest) {
234
234
  await withSpecMutationLock(projectId, async () => {
235
235
  const specs = await loadAll(projectId);
236
236
  const idx = specs.findIndex((s) => s.id === specId);
237
237
  if (idx === -1) {
238
238
  return;
239
239
  }
240
- const nextSpecs = specs.map((current, currentIdx) => currentIdx === idx ? { ...current, title, contentDigest } : current);
240
+ const nextSpecs = specs.map((current, currentIdx) => currentIdx === idx
241
+ ? { ...current, title, spec_version: specVersion, contentDigest }
242
+ : current);
241
243
  await saveAll(projectId, nextSpecs);
242
244
  });
243
245
  }
@@ -281,8 +283,13 @@ async function refreshSpecFromDisk(projectId, spec, canonicalRoot) {
281
283
  return spec;
282
284
  }
283
285
  const fields = readFrontmatterScalars(content);
284
- const refreshed = { ...spec, title: fields.title ?? spec.title, contentDigest: digest };
285
- await persistDigestRefresh(projectId, spec.id, refreshed.title, digest).catch((error) => {
286
+ const refreshed = {
287
+ ...spec,
288
+ title: fields.title ?? spec.title,
289
+ spec_version: fields.spec_version ?? spec.spec_version,
290
+ contentDigest: digest,
291
+ };
292
+ await persistDigestRefresh(projectId, spec.id, refreshed.title, refreshed.spec_version, digest).catch((error) => {
286
293
  reportClassifiedDegradation('SPEC_CONTENT_DIGEST_REFRESH_PERSIST', error);
287
294
  });
288
295
  return refreshed;
@@ -219,7 +219,9 @@ async function readDisabledByConfig(projectPath) {
219
219
  return Array.isArray(disabled) ? new Set(disabled) : new Set();
220
220
  }
221
221
  catch (error) {
222
- /* reliability-optional: CASCADE_CONFIG_UNAVAILABLE — default empty disable set is explicit */
222
+ if (error.code === 'ENOENT') {
223
+ return new Set();
224
+ }
223
225
  reportClassifiedDegradation('CASCADE_CONFIG_UNAVAILABLE', error);
224
226
  return new Set();
225
227
  }
@@ -142,6 +142,17 @@ async function drainPostCommitWorkOnShutdown() {
142
142
  reportClassifiedDegradation('POST_COMMIT_DRAIN_TIMEOUT', new Error(`Shutdown drain exceeded ${String(POST_COMMIT_DRAIN_MS)}ms with ${String(drainResult.pendingCount)} pending`));
143
143
  }
144
144
  }
145
+ function createExitOnce() {
146
+ let exited = false;
147
+ return () => {
148
+ if (exited) {
149
+ return;
150
+ }
151
+ exited = true;
152
+ signalDescendants('SIGKILL');
153
+ process.exit(0);
154
+ };
155
+ }
145
156
  function installStdioShutdownHandlers(server) {
146
157
  let shuttingDown = false;
147
158
  const handlers = new Map();
@@ -170,10 +181,9 @@ function installStdioShutdownHandlers(server) {
170
181
  shuttingDown = true;
171
182
  removeHandlers();
172
183
  console.error(`[Planu] MCP stdio ${reason}; shutting down.`);
173
- const hardStop = setTimeout(() => {
174
- signalDescendants('SIGKILL');
175
- process.exit(0);
176
- }, 1_500);
184
+ const exitOnce = createExitOnce();
185
+ const hardStop = setTimeout(exitOnce, 1_500);
186
+ hardStop.unref();
177
187
  void import('../tools/safe-handler.js')
178
188
  .then(({ abortActiveToolExecutions }) => {
179
189
  abortActiveToolExecutions(`MCP stdio ${reason}`);
@@ -195,8 +205,7 @@ function installStdioShutdownHandlers(server) {
195
205
  })
196
206
  .finally(() => {
197
207
  clearTimeout(hardStop);
198
- signalDescendants('SIGKILL');
199
- process.exit(0);
208
+ exitOnce();
200
209
  });
201
210
  };
202
211
  const end = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planu/cli",
3
- "version": "5.7.10",
3
+ "version": "5.7.11",
4
4
  "description": "Planu — MCP Server for Spec Driven Development. Cross-platform (Linux/macOS/Windows, x64/arm64).",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -47,6 +47,7 @@
47
47
  "test": "vitest run --maxWorkers=6",
48
48
  "test:watch": "vitest",
49
49
  "test:coverage": "vitest run --coverage --testTimeout=60000 --maxWorkers=6",
50
+ "test:profile": "node scripts/test-profile.mjs",
50
51
  "test:release-gate": "vitest run --exclude 'tests/integration/**'",
51
52
  "test:pre-push-scripts": "PLANU_PRE_PUSH_SCRIPTS_LANE=1 vitest run tests/scripts --reporter=dot",
52
53
  "test:integration": "vitest run tests/integration",
package/planu-plugin.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "dev.planu.cli",
3
3
  "displayName": "Planu — Spec Driven Development",
4
4
  "description": "Manage software specs, estimations, and autonomous SDD workflows. Language-agnostic MCP server for Claude Code.",
5
- "version": "5.7.10",
5
+ "version": "5.7.11",
6
6
  "icon": "assets/plugin/icon.svg",
7
7
  "command": ["npx", "@planu/cli@latest"],
8
8
  "packageName": "@planu/cli",