@planu/cli 5.7.17 → 5.7.18

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,14 @@
1
+ ## [5.7.18] - 2026-09-04
2
+
3
+ ### Bug Fixes
4
+ - fix(release): strip only the duration from gate results, not every field
5
+ - fix(tools): keep declared verbose flag and detect zod shapes structurally
6
+ - fix(handoff,tools): resolve relative specPath and honor verbose:true
7
+
8
+ ### Performance
9
+ - perf(release): measure gate durations and reuse the typecheck build-info
10
+
11
+
1
12
  ## [5.7.17] - 2026-09-04
2
13
 
3
14
  ### Bug Fixes
@@ -1 +1 @@
1
- {"schemaVersion":1,"commit":"eaee88d4fafb9a457c4a32ace39b3666e4b30108"}
1
+ {"schemaVersion":1,"commit":"61a73981c39f96a78cffbc3031cef4c10647fb56"}
@@ -2,7 +2,7 @@
2
2
  /* eslint-disable max-lines -- package assembly and the SPEC-1240 atomic-publish/version-fence path stay co-located for auditability */
3
3
  import { createHash, randomUUID } from 'node:crypto';
4
4
  import { mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';
5
- import { join } from 'node:path';
5
+ import { isAbsolute, join, resolve as resolvePath } from 'node:path';
6
6
  import { stripFrontmatter } from './frontmatter-parser.js';
7
7
  // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
8
8
  import { hashProjectPath, projectDataDir } from '../storage/base-store.js';
@@ -641,11 +641,20 @@ function buildConstraints(knowledge) {
641
641
  });
642
642
  return constraints;
643
643
  }
644
+ async function readSpecFile(specPath, projectPath) {
645
+ if (isAbsolute(specPath)) {
646
+ return readFile(specPath, 'utf-8').catch(() => '');
647
+ }
648
+ if (!projectPath) {
649
+ return '';
650
+ }
651
+ return readFile(resolvePath(projectPath, specPath), 'utf-8').catch(() => '');
652
+ }
644
653
  // ── Public API ───────────────────────────────────────────────────────────────
645
654
  export async function packageHandoff(spec, knowledge, versionFence) {
646
655
  const warnings = [];
647
656
  const rawSpecContent = spec.specPath
648
- ? await readFile(spec.specPath, 'utf-8').catch(() => '')
657
+ ? await readSpecFile(spec.specPath, knowledge.projectPath)
649
658
  : '';
650
659
  const huContent = rawSpecContent ? stripFrontmatter(rawSpecContent) : '';
651
660
  const fichaContent = huContent;
@@ -12,6 +12,9 @@ export declare function readPolicy(projectPath: string): {
12
12
  }[];
13
13
  sourceReceiptInputPatterns: string[];
14
14
  };
15
+ export declare function stripGateResultDurations<T extends {
16
+ durationMs?: number;
17
+ }>(results: T[]): Omit<T, 'durationMs'>[];
15
18
  export declare function computeBinding(projectPath: string): {
16
19
  source: {
17
20
  maskedTreeDigest: string;
@@ -149,6 +149,9 @@ function collectInputs(projectPath, patterns) {
149
149
  return { path, sha256: sha256(bytes) };
150
150
  });
151
151
  }
152
+ export function stripGateResultDurations(results) {
153
+ return results.map(({ durationMs: _durationMs, ...rest }) => rest);
154
+ }
152
155
  export function computeBinding(projectPath) {
153
156
  assertCleanSource(projectPath);
154
157
  const policy = readPolicy(projectPath);
@@ -1,7 +1,7 @@
1
1
  import { existsSync, lstatSync, readdirSync, readFileSync, realpathSync, statSync } from 'node:fs';
2
2
  import { isAbsolute, join } from 'node:path';
3
3
  import { canonical } from './bump-carrier-binding.js';
4
- import { computeBinding, runIdentity, sha256 } from './source-quality-binding.js';
4
+ import { computeBinding, runIdentity, sha256, stripGateResultDurations, } from './source-quality-binding.js';
5
5
  import { VALIDATION_COMMANDS } from './validation-impact-planner.js';
6
6
  function successfulResults(commandPlan) {
7
7
  return commandPlan.map(({ id, executable, args }) => ({ id, executable, args, exitCode: 0 }));
@@ -39,7 +39,8 @@ export function readMatchingSourceQualityReceipt(projectPath, command) {
39
39
  }
40
40
  const actual = JSON.parse(readFileSync(path, 'utf8'));
41
41
  const expected = { schemaVersion: 1, key, binding, results };
42
- if (canonical(actual) !== canonical(expected)) {
42
+ const actualWithoutDurations = { ...actual, results: stripGateResultDurations(actual.results) };
43
+ if (canonical(actualWithoutDurations) !== canonical(expected)) {
43
44
  return null;
44
45
  }
45
46
  return { key, path };
@@ -17,5 +17,5 @@ export declare function compactStructuredContent(structuredContent: Record<strin
17
17
  * Also bounds structuredContent so token recording reflects the actual visible
18
18
  * payload instead of unbounded internal data.
19
19
  */
20
- export declare function compressToolOutput(result: ToolResult): ToolResult;
20
+ export declare function compressToolOutput(result: ToolResult, verbose?: boolean): ToolResult;
21
21
  //# sourceMappingURL=output-compressor.d.ts.map
@@ -250,7 +250,7 @@ export function compactStructuredContent(structuredContent, options = {}) {
250
250
  * Also bounds structuredContent so token recording reflects the actual visible
251
251
  * payload instead of unbounded internal data.
252
252
  */
253
- export function compressToolOutput(result) {
253
+ export function compressToolOutput(result, verbose = false) {
254
254
  // Don't compress error results — they need full context for debugging
255
255
  if (result.isError === true) {
256
256
  return result;
@@ -259,6 +259,9 @@ export function compressToolOutput(result) {
259
259
  if (process.env.PLANU_VERBOSE_OUTPUT === 'true') {
260
260
  return result;
261
261
  }
262
+ if (verbose) {
263
+ return result;
264
+ }
262
265
  const compressed = result.content.map((block) => ({
263
266
  ...block,
264
267
  text: compressTextBlock(block.text),
@@ -401,6 +401,9 @@ function safeWithTelemetry(toolName, handler) {
401
401
  const projectPath = safeArgs !== null && typeof safeArgs === 'object'
402
402
  ? safeArgs.projectPath
403
403
  : undefined;
404
+ const verboseRequested = safeArgs !== null &&
405
+ typeof safeArgs === 'object' &&
406
+ safeArgs.verbose === true;
404
407
  const startTime = Date.now();
405
408
  // SPEC-922: Parse context header and evaluate compact mode
406
409
  const contextUsed = parseContextHeader(extra && typeof extra === 'object' ? extra : undefined);
@@ -435,9 +438,12 @@ function safeWithTelemetry(toolName, handler) {
435
438
  isError: true,
436
439
  };
437
440
  // SPEC-455: Compress verbose JSON outputs to save LLM tokens
438
- const compressed = compressToolOutput(result);
441
+ const compressed = compressToolOutput(result, verboseRequested);
439
442
  // SPEC-922: Apply compact mode middleware
440
- const compacted = applyCompactMode(compressed, decision, {
443
+ const effectiveDecision = verboseRequested
444
+ ? { ...decision, mode: 'verbose' }
445
+ : decision;
446
+ const compacted = applyCompactMode(compressed, effectiveDecision, {
441
447
  projectPath,
442
448
  flow: toolName,
443
449
  });
@@ -1,8 +1,48 @@
1
1
  // tools/tool-registry.ts — Local registry that tracks registered MCP tools.
2
2
  // Replaces fragile access to SDK-internal `_registeredTools` property.
3
3
  // Uses a Proxy to transparently intercept registerTool/tool calls on McpServer.
4
+ import { z } from 'zod';
4
5
  /** Module-level store of tool name -> RegisteredTool (ToolSlot interface). */
5
6
  const registeredTools = new Map();
7
+ const VERBOSE_FLAG_DESCRIPTION = 'When true, returns the full untruncated tool output instead of the default compressed/truncated summary.';
8
+ function withVerboseFlag(config) {
9
+ if (config === null || typeof config !== 'object' || !('inputSchema' in config)) {
10
+ return config;
11
+ }
12
+ const cfg = config;
13
+ const inputSchema = cfg.inputSchema !== null && typeof cfg.inputSchema === 'object'
14
+ ? cfg.inputSchema
15
+ : {};
16
+ return {
17
+ ...cfg,
18
+ inputSchema: {
19
+ verbose: z.boolean().optional().describe(VERBOSE_FLAG_DESCRIPTION),
20
+ ...inputSchema,
21
+ },
22
+ };
23
+ }
24
+ function isZodLikeSchema(value) {
25
+ return (value !== null &&
26
+ typeof value === 'object' &&
27
+ typeof value.parse === 'function' &&
28
+ typeof value.safeParse === 'function');
29
+ }
30
+ function isRawShape(value) {
31
+ if (value === null || typeof value !== 'object' || Array.isArray(value)) {
32
+ return false;
33
+ }
34
+ const entries = Object.values(value);
35
+ return entries.length > 0 && entries.every(isZodLikeSchema);
36
+ }
37
+ function findLegacyRawShape(args) {
38
+ return [args[1], args[2]].find(isRawShape);
39
+ }
40
+ function injectVerboseIntoLegacyShape(args) {
41
+ const shape = findLegacyRawShape(args);
42
+ if (shape && !('verbose' in shape)) {
43
+ shape.verbose = z.boolean().optional().describe(VERBOSE_FLAG_DESCRIPTION);
44
+ }
45
+ }
6
46
  /**
7
47
  * Returns the map of all registered tools captured via `withToolTracking()`.
8
48
  * Each entry maps tool name -> { enable(), disable(), enabled }.
@@ -26,7 +66,14 @@ export function withToolTracking(server) {
26
66
  throw new Error(`Duplicate MCP tool registration: ${name}`);
27
67
  }
28
68
  const originalMethod = Reflect.get(target, prop, receiver);
29
- const registered = originalMethod.apply(target, args);
69
+ let finalArgs = args;
70
+ if (prop === 'registerTool' && args.length >= 2) {
71
+ finalArgs = [args[0], withVerboseFlag(args[1]), ...args.slice(2)];
72
+ }
73
+ else if (prop === 'tool') {
74
+ injectVerboseIntoLegacyShape(args);
75
+ }
76
+ const registered = originalMethod.apply(target, finalArgs);
30
77
  registeredTools.set(name, registered);
31
78
  return registered;
32
79
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planu/cli",
3
- "version": "5.7.17",
3
+ "version": "5.7.18",
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",
@@ -41,7 +41,7 @@
41
41
  "lint:fix": "eslint src/ tests/ --fix --max-warnings 0",
42
42
  "format": "prettier --write 'src/**/*.ts' 'tests/**/*.test.ts'",
43
43
  "format:check": "prettier --check --cache --cache-strategy content 'src/**/*.ts' 'tests/**/*.test.ts'",
44
- "typecheck": "tsc --noEmit",
44
+ "typecheck": "tsc --noEmit --incremental --tsBuildInfoFile node_modules/.cache/planu-typecheck.tsbuildinfo",
45
45
  "typecheck:compat": "tsc6 --noEmit",
46
46
  "verify:typescript-migration": "node scripts/verify-typescript-migration.mjs",
47
47
  "test": "vitest run --maxWorkers=6",
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.17",
5
+ "version": "5.7.18",
6
6
  "icon": "assets/plugin/icon.svg",
7
7
  "command": ["npx", "@planu/cli@latest"],
8
8
  "packageName": "@planu/cli",