@planu/cli 5.7.12 → 5.7.14

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 (62) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/.planu-build.json +1 -1
  3. package/dist/cli/commands/doctor.d.ts +2 -1
  4. package/dist/cli/commands/doctor.js +51 -1
  5. package/dist/cli/commands/install.js +14 -0
  6. package/dist/config/negative-predicate-phrases.json +33 -0
  7. package/dist/config/registries/strict-audit-scripts.json +4 -0
  8. package/dist/engine/doctor/npm-cache-check.d.ts +10 -0
  9. package/dist/engine/doctor/npm-cache-check.js +109 -0
  10. package/dist/engine/ears-gate.d.ts +1 -0
  11. package/dist/engine/ears-gate.js +64 -2
  12. package/dist/engine/framework-detector.d.ts +1 -0
  13. package/dist/engine/framework-detector.js +1 -1
  14. package/dist/engine/handoff-artifacts/schemas.d.ts +2 -0
  15. package/dist/engine/handoff-artifacts/schemas.js +1 -1
  16. package/dist/engine/spec-format/bdd-parser.d.ts +2 -0
  17. package/dist/engine/spec-format/bdd-parser.js +70 -4
  18. package/dist/engine/spec-grounding/contract.js +3 -1
  19. package/dist/engine/spec-grounding/grounding-entry-parser.js +1 -0
  20. package/dist/engine/validator/analyzer.d.ts +0 -9
  21. package/dist/engine/validator/analyzer.js +33 -9
  22. package/dist/engine/validator/blast-radius-gate.js +181 -10
  23. package/dist/engine/validator/deep-code-checker.js +2 -5
  24. package/dist/engine/validator/negative-predicate.d.ts +18 -0
  25. package/dist/engine/validator/negative-predicate.js +240 -0
  26. package/dist/engine/validator/spec-compliance-runner.d.ts +1 -0
  27. package/dist/engine/validator/spec-compliance-runner.js +91 -26
  28. package/dist/engine/validator/strict-audits-gate.d.ts +3 -0
  29. package/dist/engine/validator/strict-audits-gate.js +74 -0
  30. package/dist/engine/validator/validation-report-writer.js +4 -2
  31. package/dist/storage/runtime-db.d.ts +1 -1
  32. package/dist/storage/runtime-db.js +15 -2
  33. package/dist/tools/challenge-spec/scenarios-data.js +4 -3
  34. package/dist/tools/challenge-spec/scenarios-utils.d.ts +1 -2
  35. package/dist/tools/challenge-spec/scenarios-utils.js +13 -2
  36. package/dist/tools/create-spec.js +10 -0
  37. package/dist/tools/jobs/handlers.d.ts +2 -1
  38. package/dist/tools/jobs/handlers.js +17 -3
  39. package/dist/tools/register-spec-tools/core-spec-tools.js +5 -0
  40. package/dist/tools/tool-registry/core-tools.js +28 -2
  41. package/dist/tools/update-status/batch.js +1 -0
  42. package/dist/tools/update-status/evidence-gate.js +13 -1
  43. package/dist/tools/update-status/file-sync.d.ts +1 -1
  44. package/dist/tools/update-status/file-sync.js +4 -2
  45. package/dist/tools/update-status/index.js +4 -1
  46. package/dist/tools/update-status/transition-guard.d.ts +0 -1
  47. package/dist/tools/update-status/transition-guard.js +42 -14
  48. package/dist/tools/validate.js +79 -2
  49. package/dist/types/analysis.d.ts +20 -0
  50. package/dist/types/errors/structured-error.d.ts +1 -1
  51. package/dist/types/handoff-artifacts.d.ts +1 -1
  52. package/dist/types/installation.d.ts +10 -0
  53. package/dist/types/plugin-configs.d.ts +4 -0
  54. package/dist/types/spec/inputs.d.ts +14 -0
  55. package/dist/types/spec-format.d.ts +1 -0
  56. package/dist/types/spec-grounding.d.ts +1 -1
  57. package/dist/types/validation-evidence.d.ts +32 -1
  58. package/package.json +2 -1
  59. package/planu-plugin.json +1 -1
  60. package/src/i18n/messages/en.json +1 -1
  61. package/src/i18n/messages/es.json +1 -1
  62. package/src/i18n/messages/pt.json +1 -1
@@ -132,7 +132,7 @@ function assertSpecBodyIntegrity(args) {
132
132
  }
133
133
  }
134
134
  const FROZEN_TERMINAL_STATUSES = ['done', 'discarded'];
135
- export async function syncSpecFiles(updatedSpec, _currentStatus, newStatus, projectPath, qualityWarnings = []) {
135
+ export async function syncSpecFiles(updatedSpec, _currentStatus, newStatus, projectPath, qualityWarnings = [], frozenTransitionReason) {
136
136
  let warning;
137
137
  let refreshedTitle;
138
138
  let transitionSpecPath;
@@ -171,7 +171,9 @@ export async function syncSpecFiles(updatedSpec, _currentStatus, newStatus, proj
171
171
  newStatus,
172
172
  specId: updatedSpec.id,
173
173
  });
174
- await atomicWriteFile(transitionSpecPath, updatedContent);
174
+ await atomicWriteFile(transitionSpecPath, updatedContent, ...(frozenTransitionReason !== undefined && frozenTransitionReason.trim().length >= 30
175
+ ? [{ forceEdit: { reason: frozenTransitionReason } }]
176
+ : []));
175
177
  // SPEC-544: Auto-stage spec.md after writing so it's included in the user's next commit
176
178
  // SPEC-575: Auto-commit staged planu/ docs (idempotent, safe-fail)
177
179
  // Commit message must reflect the actual transition — 'mark-done' is only
@@ -653,7 +653,10 @@ async function commitTransitionWithNarrowLock(args) {
653
653
  expectedSpec: freshSpec,
654
654
  });
655
655
  const updatedSpec = transitionRecord.spec;
656
- const syncResult = await syncSpecFiles(updatedSpec, args.originalStatus, args.newStatus, args.projectPath, args.qualityWarnings);
656
+ const frozenReasonArgs = isReverseTransition(args.originalStatus, args.newStatus)
657
+ ? [args.options.reason]
658
+ : [];
659
+ const syncResult = await syncSpecFiles(updatedSpec, args.originalStatus, args.newStatus, args.projectPath, args.qualityWarnings, ...frozenReasonArgs);
657
660
  if (!syncResult.warning) {
658
661
  if (syncResult.title) {
659
662
  updatedSpec.title = syncResult.title;
@@ -12,7 +12,6 @@ import type { Spec } from '../../types/spec/core.js';
12
12
  export declare const VALID_TRANSITIONS: Record<SpecStatus, SpecStatus[]>;
13
13
  /**
14
14
  * Allowed reverse transition pairs (from terminal state back to active).
15
- * Only these two pairs are supported. Any other reverse pair is rejected.
16
15
  */
17
16
  export declare const REVERSE_TRANSITIONS: (readonly [SpecStatus, SpecStatus])[];
18
17
  /**
@@ -27,7 +27,7 @@ export const VALID_TRANSITIONS = {
27
27
  review: ['draft', 'approved', 'discarded'],
28
28
  approved: ['draft', 'review', 'implementing', 'discarded'],
29
29
  implementing: ['approved', 'done', 'discarded'],
30
- done: ['implementing'], // SPEC-733: reverse transition with mandatory reason
30
+ done: ['implementing', 'discarded'], // SPEC-733: reverse transition with mandatory reason
31
31
  discarded: ['draft'], // SPEC-733: reverse transition with mandatory reason
32
32
  };
33
33
  // ---------------------------------------------------------------------------
@@ -35,12 +35,15 @@ export const VALID_TRANSITIONS = {
35
35
  // ---------------------------------------------------------------------------
36
36
  /**
37
37
  * Allowed reverse transition pairs (from terminal state back to active).
38
- * Only these two pairs are supported. Any other reverse pair is rejected.
39
38
  */
40
39
  export const REVERSE_TRANSITIONS = [
41
40
  ['done', 'implementing'],
41
+ ['done', 'discarded'],
42
42
  ['discarded', 'draft'],
43
43
  ];
44
+ function allowedReversePairs() {
45
+ return REVERSE_TRANSITIONS.map(([from, to]) => `${from}→${to}`).join(', ');
46
+ }
44
47
  /**
45
48
  * Returns true if the (from, to) pair is a whitelisted reverse transition.
46
49
  */
@@ -57,15 +60,15 @@ export function validateReverseTransition(input) {
57
60
  if (!isReverseTransition(from, to)) {
58
61
  return {
59
62
  ok: false,
60
- error: `Reverse transition ${from} → ${to} is not supported. Allowed: done→implementing, discarded→draft.`,
61
- fixHint: 'Only done→implementing and discarded→draft are supported reverse transitions.',
63
+ error: `Reverse transition ${from} → ${to} is not supported. Allowed: ${allowedReversePairs()}.`,
64
+ fixHint: `Only ${allowedReversePairs()} are supported reverse transitions.`,
62
65
  };
63
66
  }
64
67
  if (!reason || reason.trim().length < 30) {
65
68
  return {
66
69
  ok: false,
67
70
  error: `Reverse transition ${from} → ${to} requires reason (≥ 30 chars). Received: "${reason ?? ''}" (${String(reason?.trim().length ?? 0)} chars).`,
68
- fixHint: 'Reverse transitions require reason (>= 30 chars). Example: "Regression found in prod traced to AC#3 — reopening to fix."',
71
+ fixHint: `Reverse transitions (${allowedReversePairs()}) require reason (>= 30 chars). Example: "Regression found in prod traced to AC#3 — reopening to fix."`,
69
72
  };
70
73
  }
71
74
  return { ok: true };
@@ -107,6 +110,7 @@ export function checkTransition(currentStatus, newStatus) {
107
110
  text: ti('spec.invalidTransition', {
108
111
  from: currentStatus,
109
112
  to: newStatus,
113
+ valid: validNextStates.join(', '),
110
114
  }),
111
115
  },
112
116
  ],
@@ -205,7 +209,7 @@ export async function checkAmbiguityGate(spec, newStatus) {
205
209
  }
206
210
  const report = await scoreAmbiguityFromPath(spec.specPath);
207
211
  if (!report) {
208
- return gateUnavailableResult('AMBIGUITY_GATE_UNAVAILABLE', 'Ambiguity scoring failed.');
212
+ return gateUnavailableResult('AMBIGUITY_GATE_UNAVAILABLE', 'Ambiguity scoring failed.', readinessGateIdentity(spec));
209
213
  }
210
214
  if (report.score >= 70) {
211
215
  return null;
@@ -338,11 +342,11 @@ export async function checkReadinessGate(spec, newStatus, forceApprove, projectP
338
342
  ? `spec.md is missing at ${spec.specPath}. Recreate the spec via create_spec or restore spec.md from git/backup before retrying this transition.`
339
343
  : error instanceof Error
340
344
  ? error.message
341
- : 'spec.md could not be read');
345
+ : 'spec.md could not be read', readinessGateIdentity(spec, projectPath));
342
346
  }
343
347
  // Guard: mock environments return undefined; unreadable files return non-string
344
348
  if (typeof body !== 'string') {
345
- return readinessUnavailable('READINESS_SPEC_INVALID', 'spec.md did not return text content');
349
+ return readinessUnavailable('READINESS_SPEC_INVALID', 'spec.md did not return text content', readinessGateIdentity(spec, projectPath));
346
350
  }
347
351
  const languageValidation = validateEnglishOnlySpecText(body);
348
352
  if (!languageValidation.ok) {
@@ -436,7 +440,7 @@ export async function checkReadinessGate(spec, newStatus, forceApprove, projectP
436
440
  catch (error) {
437
441
  /* reliability-optional: READINESS_EVALUATION_FAILED — transition fails closed below */
438
442
  reportClassifiedDegradation('READINESS_EVALUATION_FAILED', error);
439
- return readinessUnavailable('READINESS_EVALUATION_FAILED', error instanceof Error ? error.message : 'readiness evaluation failed', structuralInterpolationWarnings);
443
+ return readinessUnavailable('READINESS_EVALUATION_FAILED', error instanceof Error ? error.message : 'readiness evaluation failed', readinessGateIdentity(spec, projectPath), structuralInterpolationWarnings);
440
444
  }
441
445
  const { score } = readiness;
442
446
  const blockers = [...readiness.issues.blockers];
@@ -575,15 +579,39 @@ export async function checkReadinessGate(spec, newStatus, forceApprove, projectP
575
579
  qualityWarnings: structuralInterpolationWarnings,
576
580
  };
577
581
  }
578
- function gateUnavailableResult(code, message) {
582
+ function gateBlockedText(message) {
583
+ return `${message} Transition blocked until the gate succeeds. Do not retry the spec-level transition until the originating condition is cleared.`;
584
+ }
585
+ function readinessGateIdentity(spec, projectPath) {
586
+ const identity = { specId: spec.id, projectId: spec.projectId };
587
+ return projectPath === undefined ? identity : { ...identity, projectPath };
588
+ }
589
+ function gateUnavailableResult(code, message, identity) {
590
+ const structuredContent = {
591
+ error: code,
592
+ message,
593
+ retryable: false,
594
+ externalGateBlocked: true,
595
+ originatingCondition: code,
596
+ nextAction: {
597
+ tool: 'check_readiness',
598
+ args: {
599
+ specId: identity.specId,
600
+ ...(identity.projectPath === undefined
601
+ ? { projectId: identity.projectId }
602
+ : { projectPath: identity.projectPath }),
603
+ },
604
+ rationale: `${message} Fix the originating condition outside the spec contract, then re-run check_readiness to confirm it cleared. Retrying update_status on the same spec will not clear it.`,
605
+ },
606
+ };
579
607
  return {
580
- content: [{ type: 'text', text: `${message} Transition blocked until the gate succeeds.` }],
608
+ content: [{ type: 'text', text: gateBlockedText(message) }],
581
609
  isError: true,
582
- structuredContent: { error: code, message, retryable: true },
610
+ structuredContent: structuredContent,
583
611
  };
584
612
  }
585
- function readinessUnavailable(code, message, qualityWarnings = []) {
586
- return { blockResult: gateUnavailableResult(code, message), qualityWarnings };
613
+ function readinessUnavailable(code, message, identity, qualityWarnings = []) {
614
+ return { blockResult: gateUnavailableResult(code, message, identity), qualityWarnings };
587
615
  }
588
616
  const CHALLENGE_RESOLUTION_INSTRUCTIONS = 'Add a "### Challenge Resolution" subsection to the spec\'s spec.md with one "- " bullet per unresolved finding, each bullet containing that finding\'s exact scenario text plus your mitigation, then re-run challenge_spec to re-derive the report.';
589
617
  /**
@@ -74,6 +74,7 @@ import { isAbsolute, join } from 'node:path';
74
74
  import { writeImplementationReviewReport } from '../engine/validator/validation-report-writer.js';
75
75
  import { runReliabilityGate } from '../engine/validator/reliability-gate.js';
76
76
  import { runBlastRadiusGate } from '../engine/validator/blast-radius-gate.js';
77
+ import { runStrictAuditsGate } from '../engine/validator/strict-audits-gate.js';
77
78
  import { collectDeclaredSpecFiles } from '../engine/validator/spec-compliance-runner.js';
78
79
  import { buildGraphCoverageReport, formatGraphCoverageText } from './validate-graph-coverage.js';
79
80
  import { buildMinimalityReport } from './validate-minimality.js';
@@ -82,6 +83,7 @@ import { runLintCheck } from './validate-lint.js';
82
83
  import { checkPlanuUncommittedChanges, runAssuranceGates } from './validate-assurance.js';
83
84
  import { applyValidateStructuredCompat } from './validate-structured-compat.js';
84
85
  import { getToolExecutionSignal } from './safe-handler.js';
86
+ import { remainingExecutionMs } from '../engine/execution/context.js';
85
87
  import { DurableJobRuntime, publicJobCursor } from '../engine/execution/job-runtime.js';
86
88
  import { scheduleValidateJobExecution } from '../engine/execution/validate-job-executor.js';
87
89
  import { createPendingValidationSubmission } from '../engine/validation/durable-validation.js';
@@ -91,7 +93,7 @@ import { getRuntimePolicy } from '../engine/runtime-policy.js';
91
93
  import { resolveValidationWorktree, ValidationWorktreeError, } from '../engine/validation/validation-worktree.js';
92
94
  // Re-export for external use (SPEC-018)
93
95
  export { validateContractCompliance };
94
- const VALIDATION_GATE_TOTAL = 10;
96
+ const VALIDATION_GATE_TOTAL = 11;
95
97
  const GATE_DEADLINE_EXEMPT_PHASES = new Set(['lint', 'compliance']);
96
98
  async function runWithGateDeadline(phase, command, work) {
97
99
  if (GATE_DEADLINE_EXEMPT_PHASES.has(phase)) {
@@ -111,6 +113,70 @@ async function runWithGateDeadline(phase, command, work) {
111
113
  clearTimeout(timer);
112
114
  }
113
115
  }
116
+ function computeIntegrationTimeoutMs() {
117
+ const blastRadiusTimeoutMs = getRuntimePolicy().validation.blastRadiusTimeoutMs;
118
+ return Math.max(0, Math.min(blastRadiusTimeoutMs, remainingExecutionMs() - blastRadiusTimeoutMs));
119
+ }
120
+ function isBlastRadiusPassed(blastRadiusGate) {
121
+ return blastRadiusGate.passed && blastRadiusGate.warningReason === null;
122
+ }
123
+ function blastRadiusWarnings(blastRadiusGate) {
124
+ if (blastRadiusGate.warningReason === 'stale-dist') {
125
+ return [
126
+ {
127
+ file: 'blast-radius',
128
+ line: 0,
129
+ severity: 'warning',
130
+ rule: 'stale-dist',
131
+ message: 'Blast radius gate could not run: dist/ build provenance is stale',
132
+ suggestion: 'Run pnpm build:ts and re-run validate.',
133
+ },
134
+ ];
135
+ }
136
+ return blastRadiusGate.warningReason === null
137
+ ? []
138
+ : [
139
+ {
140
+ file: 'blast-radius',
141
+ line: 0,
142
+ severity: 'warning',
143
+ rule: blastRadiusGate.warningReason,
144
+ message: 'Integration importers of the changed files were not exercised within the validate budget.',
145
+ suggestion: 'Run `npx vitest related --run <changed files>` without PLANU_EXCLUDE_INTEGRATION_TESTS, or raise validation.blastRadiusTimeoutMs, before marking this spec done.',
146
+ },
147
+ ];
148
+ }
149
+ function strictAuditsQualityIssues(strictAuditsGate) {
150
+ const findingIssues = strictAuditsGate.findings.map((finding) => ({
151
+ file: finding.script,
152
+ line: 0,
153
+ severity: 'critical',
154
+ rule: 'strict-audits',
155
+ message: `Strict audit ${finding.script} failed: ${finding.line}`,
156
+ suggestion: 'Fix the strict audit finding before marking this spec done — the release runs the same script.',
157
+ }));
158
+ if (strictAuditsGate.skipped !== 'deadline-exceeded') {
159
+ return findingIssues;
160
+ }
161
+ return [
162
+ ...findingIssues,
163
+ {
164
+ file: 'strict-audits',
165
+ line: 0,
166
+ severity: 'warning',
167
+ rule: 'strict-audits-skipped',
168
+ message: `Strict audits stopped at the validate deadline after: ${strictAuditsGate.executedScripts.join(', ')}`,
169
+ suggestion: 'Run `pnpm check:strict` locally before marking this spec done.',
170
+ },
171
+ ];
172
+ }
173
+ function strictAuditsSuggestions(strictAuditsGate) {
174
+ return strictAuditsGate.passed
175
+ ? []
176
+ : [
177
+ `Strict audits failed: ${String(strictAuditsGate.findings.length)} finding(s). Fix before marking as done.`,
178
+ ];
179
+ }
114
180
  export function createValidationStageRunner(onProgress) {
115
181
  const startedAt = Date.now();
116
182
  let completedGates = 0;
@@ -384,6 +450,7 @@ export async function executeValidate(args, server, onProgress) {
384
450
  ];
385
451
  return runBlastRadiusGate(projectPath, candidateFiles, {
386
452
  timeoutMs: getRuntimePolicy().validation.blastRadiusTimeoutMs,
453
+ integrationTimeoutMs: computeIntegrationTimeoutMs(),
387
454
  signal: getToolExecutionSignal(),
388
455
  });
389
456
  });
@@ -393,6 +460,10 @@ export async function executeValidate(args, server, onProgress) {
393
460
  specId,
394
461
  maximumTimeoutMs: getRuntimePolicy().validation.durableLintTimeoutMs,
395
462
  }));
463
+ const strictAuditsGate = await runStage('strict-audits', 'strict release audits declared by the project', () => runStrictAuditsGate(projectPath, {
464
+ timeoutMs: getRuntimePolicy().validation.durableLintTimeoutMs,
465
+ signal: getToolExecutionSignal(),
466
+ }));
396
467
  const { assuranceGates, minimalityReport } = await runStage('assurance', 'validate assurance and minimality', async () => ({
397
468
  assuranceGates: runAssuranceGates(projectPath),
398
469
  minimalityReport: await buildMinimalityReport({
@@ -426,7 +497,8 @@ export async function executeValidate(args, server, onProgress) {
426
497
  assurancePassed: assuranceGates.newCode.passed,
427
498
  minimalityBlocked: minimalityReport?.blocked === true,
428
499
  reliabilityPassed: reliabilityGate.passed,
429
- blastRadiusPassed: blastRadiusGate.passed,
500
+ blastRadiusPassed: isBlastRadiusPassed(blastRadiusGate),
501
+ strictAuditsPassed: strictAuditsGate.passed,
430
502
  score: effectiveResult.score,
431
503
  });
432
504
  const output = {
@@ -562,6 +634,8 @@ export async function executeValidate(args, server, onProgress) {
562
634
  suggestion: 'No importer regression coverage ran for this validate call.',
563
635
  });
564
636
  }
637
+ output.qualityIssues.push(...blastRadiusWarnings(blastRadiusGate));
638
+ output.qualityIssues.push(...strictAuditsQualityIssues(strictAuditsGate));
565
639
  // Auto-suggest corrective actions based on validation results
566
640
  // score is null when no criteria can be extracted — treat as 0 for comparisons.
567
641
  const scoreValue = effectiveResult.score ?? 0;
@@ -602,6 +676,7 @@ export async function executeValidate(args, server, onProgress) {
602
676
  if (blastRadiusGate.skipped === null && !blastRadiusGate.passed) {
603
677
  suggestions.push('Fix the failing importer tests (or raise validation.blastRadiusTimeoutMs) before marking this spec done.');
604
678
  }
679
+ suggestions.push(...strictAuditsSuggestions(strictAuditsGate));
605
680
  if (!assuranceGates.newCode.passed) {
606
681
  suggestions.push(`Assurance gate failed: ${String(assuranceGates.newCode.findings.length)} new-code domain inference issue(s) found.`);
607
682
  }
@@ -754,6 +829,7 @@ function buildQualityGateSummary(input) {
754
829
  ...(input.minimalityBlocked ? ['minimality'] : []),
755
830
  ...(!input.reliabilityPassed ? ['reliability'] : []),
756
831
  ...(!input.blastRadiusPassed ? ['blast-radius'] : []),
832
+ ...(!input.strictAuditsPassed ? ['strict-audits'] : []),
757
833
  ];
758
834
  return {
759
835
  passed: failures.length === 0,
@@ -766,6 +842,7 @@ function buildQualityGateSummary(input) {
766
842
  minimalityPassed: !input.minimalityBlocked,
767
843
  reliabilityPassed: input.reliabilityPassed,
768
844
  blastRadiusPassed: input.blastRadiusPassed,
845
+ strictAuditsPassed: input.strictAuditsPassed,
769
846
  };
770
847
  }
771
848
  function buildExecutableCoverage(specCompliance) {
@@ -327,6 +327,26 @@ export interface DeepCheckResult {
327
327
  expected: number;
328
328
  description: string;
329
329
  }
330
+ export interface TokenAbsenceResult {
331
+ met: boolean;
332
+ unverifiable: boolean;
333
+ evidence: string[];
334
+ }
335
+ export type ProjectEntryStatus = {
336
+ status: 'absent';
337
+ } | {
338
+ status: 'present';
339
+ } | {
340
+ status: 'unverifiable';
341
+ evidence: string;
342
+ };
343
+ export type TokenHitScan = {
344
+ ok: true;
345
+ hits: string[];
346
+ } | {
347
+ ok: false;
348
+ result: TokenAbsenceResult;
349
+ };
330
350
  export interface DeepCheckConfig {
331
351
  pattern: string;
332
352
  scope: string;
@@ -1,4 +1,4 @@
1
- import type { ToolResult } from '../index.js';
1
+ import type { ToolResult } from '../common/primitives.js';
2
2
  export type ToolHandler = (args: Record<string, unknown>, extra?: unknown) => Promise<ToolResult>;
3
3
  export interface StructuredErrorNextAction {
4
4
  tool: string;
@@ -85,7 +85,7 @@ export interface ValidationReportV1 {
85
85
  command: string;
86
86
  scenarios: {
87
87
  title: string;
88
- verdict: 'pass' | 'fail' | 'missing';
88
+ verdict: 'pass' | 'fail' | 'missing' | 'indeterminate';
89
89
  evidence: string[];
90
90
  unverifiable?: true;
91
91
  }[];
@@ -13,4 +13,14 @@ export interface InstallationManifest {
13
13
  updatedAt: string;
14
14
  installations: InstallationRecord[];
15
15
  }
16
+ export type NpmCacheStatus = 'ok' | 'foreign-owned' | 'unreadable';
17
+ export interface NpmCacheFinding {
18
+ status: NpmCacheStatus;
19
+ cacheDir: string;
20
+ foreignCount: number;
21
+ scanned: number;
22
+ truncated: boolean;
23
+ sampleEntries: string[];
24
+ fix: string;
25
+ }
16
26
  //# sourceMappingURL=installation.d.ts.map
@@ -5,6 +5,10 @@ export interface AcGapKeywordGroup {
5
5
  language: string;
6
6
  keywords: string[];
7
7
  }
8
+ export interface NegativePredicatePhraseGroup {
9
+ id: string;
10
+ phrases: string[];
11
+ }
8
12
  export interface CodeQualityThreshold {
9
13
  id: string;
10
14
  language: string;
@@ -2,6 +2,7 @@ import type { ModelTierUsed, SpecStatus, SpecType, SpecScope, SpecTarget, ToolRe
2
2
  import type { Actuals } from '../estimation.js';
3
3
  import type { GlobalConfig } from '../project/config-metrics.js';
4
4
  import type { ProjectKnowledge } from '../project.js';
5
+ import type { StructuredErrorNextAction } from '../errors/structured-error.js';
5
6
  import type { Spec, ChecklistCategory, SpecDiagram, SpecSplitSuggestion, ReconcileChange } from './core.js';
6
7
  export interface ReconciliationInvocationContext {
7
8
  surface: 'local-mcp' | 'http' | 'dashboard' | 'direct' | 'unknown';
@@ -121,6 +122,19 @@ export interface ReadinessGateOutput {
121
122
  /** Warnings collected when force-approved with score < 70. Empty otherwise. */
122
123
  qualityWarnings: string[];
123
124
  }
125
+ export interface GateUnavailableIdentity {
126
+ specId: string;
127
+ projectId: string;
128
+ projectPath?: string;
129
+ }
130
+ export interface ExternalGateBlockedContext {
131
+ error: string;
132
+ message: string;
133
+ retryable: false;
134
+ externalGateBlocked: true;
135
+ originatingCondition: string;
136
+ nextAction: StructuredErrorNextAction;
137
+ }
124
138
  /**
125
139
  * SPEC-780: Output from the format gate check in update_status(approved).
126
140
  * Mirrors ReadinessGateOutput so callers can merge qualityWarnings from both gates.
@@ -130,6 +130,7 @@ export interface UpdateStatusBatchInput {
130
130
  projectPath?: string;
131
131
  dryRun?: boolean;
132
132
  reviewNotes?: string;
133
+ reason?: string;
133
134
  evidence?: Record<string, UpdateStatusBatchEvidence>;
134
135
  }
135
136
  /** Report of detected migration drift (SPEC-715). Read-only — no FS mutations. */
@@ -1,4 +1,4 @@
1
- export type GroundingSource = 'user_input' | 'project_evidence' | 'documented_assumption' | 'ungrounded_advisory';
1
+ export type GroundingSource = 'user_input' | 'project_evidence' | 'review_evidence' | 'documented_assumption' | 'ungrounded_advisory';
2
2
  export type GroundingConfidence = 'low' | 'medium' | 'high';
3
3
  export interface CriterionGroundingRecord {
4
4
  text: string;
@@ -1,4 +1,5 @@
1
1
  import type { AbortableProcessOptions, AbortableProcessResult } from './abortable-process.js';
2
+ import type { BuildFreshnessResult } from './build-freshness.js';
2
3
  export declare const VALIDATION_EVIDENCE_SCHEMA_VERSION: '1.0.0';
3
4
  export type ValidationGateCapability = 'typecheck' | 'lint' | 'test-related' | 'test-full' | 'contract' | 'coverage' | 'migration' | 'fault-injection' | 'security' | 'native' | 'website' | 'reproducibility';
4
5
  export type ValidationEvidenceStatus = 'passed' | 'failed' | 'cancelled' | 'invalidated';
@@ -60,7 +61,7 @@ export interface ValidationImpactPlan {
60
61
  reason: string;
61
62
  changedPaths: string[];
62
63
  }
63
- export type ScenarioVerdict = 'pass' | 'fail' | 'missing';
64
+ export type ScenarioVerdict = 'pass' | 'fail' | 'missing' | 'indeterminate';
64
65
  export interface ScenarioTestLink {
65
66
  path: string;
66
67
  line?: number;
@@ -89,6 +90,11 @@ export interface DoneDriftMissingFileFinding {
89
90
  specId: string;
90
91
  missingPath: string;
91
92
  }
93
+ export interface SpecComplianceRunnerFailure {
94
+ kind: 'runner-output-unparseable';
95
+ detail: string;
96
+ indeterminateScenarios: number;
97
+ }
92
98
  export interface SpecComplianceResult {
93
99
  dimensionScore: number;
94
100
  perScenario: PerScenarioResult[];
@@ -96,6 +102,7 @@ export interface SpecComplianceResult {
96
102
  evidenceSource?: 'frontmatter' | 'criteria' | 'none';
97
103
  ignoredCriteriaTitles?: string[];
98
104
  doneDriftFindings?: DoneDriftMissingFileFinding[];
105
+ runnerFailure?: SpecComplianceRunnerFailure;
99
106
  }
100
107
  export interface EvidenceTestLink {
101
108
  path: string;
@@ -137,8 +144,32 @@ export interface BlastRadiusGateResult {
137
144
  passed: boolean;
138
145
  timedOut: boolean;
139
146
  failures: BlastRadiusGateFailure[];
147
+ integrationImporters: string[];
148
+ warningReason: 'integration-importers-skipped' | 'stale-dist' | null;
140
149
  }
141
150
  export interface RunBlastRadiusGateOptions {
151
+ timeoutMs: number;
152
+ integrationTimeoutMs?: number;
153
+ signal?: AbortSignal;
154
+ runProcess?: (command: string, args: string[], options: AbortableProcessOptions) => Promise<AbortableProcessResult>;
155
+ checkBuildFreshness?: (distRoot: string) => BuildFreshnessResult;
156
+ }
157
+ export type StrictAuditsSkipReason = 'no-strict-scripts' | 'deadline-exceeded';
158
+ export interface StrictAuditsGateFinding {
159
+ script: string;
160
+ line: string;
161
+ }
162
+ export interface StrictAuditsGateResult {
163
+ skipped: StrictAuditsSkipReason | null;
164
+ executedScripts: string[];
165
+ passed: boolean;
166
+ findings: StrictAuditsGateFinding[];
167
+ }
168
+ export interface StrictAuditScriptsRegistry {
169
+ schemaVersion: 1;
170
+ scripts: string[];
171
+ }
172
+ export interface RunStrictAuditsGateOptions {
142
173
  timeoutMs: number;
143
174
  signal?: AbortSignal;
144
175
  runProcess?: (command: string, args: string[], options: AbortableProcessOptions) => Promise<AbortableProcessResult>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planu/cli",
3
- "version": "5.7.12",
3
+ "version": "5.7.14",
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",
@@ -83,6 +83,7 @@
83
83
  "audit:i18n": "bash scripts/audit-i18n.sh",
84
84
  "audit:hardcodes": "node scripts/check-hardcodes.mjs",
85
85
  "audit:mutation": "stryker run",
86
+ "audit:test-suite": "bash scripts/test-suite-audit.sh",
86
87
  "setup:protection": "bash scripts/setup-branch-protection.sh",
87
88
  "prepare": "husky || true",
88
89
  "prepublishOnly": "bash scripts/prepublish-guard.sh",
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.12",
5
+ "version": "5.7.14",
6
6
  "icon": "assets/plugin/icon.svg",
7
7
  "command": ["npx", "@planu/cli@latest"],
8
8
  "packageName": "@planu/cli",
@@ -3,7 +3,7 @@
3
3
  "created": "Spec {id} created successfully",
4
4
  "updated": "Spec {id} status updated to {status}",
5
5
  "notFound": "Spec {id} not found",
6
- "invalidTransition": "Invalid transition from {from} to {to}. Valid: draft → review → approved → implementing → done (any → discarded)",
6
+ "invalidTransition": "Invalid transition from {from} to {to}. Valid from {from}: {valid}.",
7
7
  "actualsRequired": "Actuals (real metrics) are required when marking spec as done",
8
8
  "duplicateTitle": "A spec with title '{title}' already exists. Using slug: {slug}"
9
9
  },
@@ -3,7 +3,7 @@
3
3
  "created": "Spec {id} creada exitosamente",
4
4
  "updated": "Spec {id} actualizada a estado {status}",
5
5
  "notFound": "Spec {id} no encontrada",
6
- "invalidTransition": "Transición inválida de {from} a {to}. Válido: draft → review → approved → implementing → done (cualquiera → discarded)",
6
+ "invalidTransition": "Transición inválida de {from} a {to}. Válido desde {from}: {valid}.",
7
7
  "actualsRequired": "Se requieren métricas reales (actuals) al marcar spec como done",
8
8
  "duplicateTitle": "Ya existe una spec con título '{title}'. Usando slug: {slug}"
9
9
  },
@@ -3,7 +3,7 @@
3
3
  "created": "Spec {id} criada com sucesso",
4
4
  "updated": "Spec {id} atualizada para status {status}",
5
5
  "notFound": "Spec {id} não encontrada",
6
- "invalidTransition": "Transição inválida de {from} para {to}. Válido: draft → review → approved → implementing → done (qualquer → discarded)",
6
+ "invalidTransition": "Transição inválida de {from} para {to}. Válido a partir de {from}: {valid}.",
7
7
  "actualsRequired": "Métricas reais (actuals) são obrigatórias ao marcar spec como done",
8
8
  "duplicateTitle": "Já existe uma spec com título '{title}'. Usando slug: {slug}"
9
9
  },