@planu/cli 5.7.22 → 5.7.23

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 (40) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/.planu-build.json +1 -1
  3. package/dist/cli/commands/release.js +23 -10
  4. package/dist/config/registries/error-recovery.json +18 -18
  5. package/dist/config/registries/legacy-guidance.json +33 -1
  6. package/dist/config/server-instructions.js +16 -20
  7. package/dist/config/skill-templates/planu-release.md +3 -3
  8. package/dist/config/token-waste-autopilot.json +1 -1
  9. package/dist/engine/errors/registry-loader.js +3 -2
  10. package/dist/engine/evidence-gates/artifact-reader.d.ts +78 -0
  11. package/dist/engine/evidence-gates/artifact-reader.js +19 -7
  12. package/dist/engine/health/auto-fixer.js +2 -2
  13. package/dist/engine/telemetry/health-checker.js +1 -1
  14. package/dist/engine/validation-evidence-ledger.d.ts +1 -0
  15. package/dist/engine/validation-evidence-ledger.js +44 -3
  16. package/dist/hosts/codex/config-scaffold.js +1 -1
  17. package/dist/hosts/gemini/config-scaffold.js +1 -1
  18. package/dist/storage/spec-index.js +8 -3
  19. package/dist/tools/create-spec/post-creation.d.ts +1 -1
  20. package/dist/tools/create-spec/post-creation.js +7 -49
  21. package/dist/tools/create-spec.js +1 -1
  22. package/dist/tools/facilitate.js +6 -6
  23. package/dist/tools/init-project/result-builder.js +4 -4
  24. package/dist/tools/safe-handler.js +1 -1
  25. package/dist/tools/status-handler.js +1 -1
  26. package/dist/tools/tool-registry/core-tools.js +3 -1
  27. package/dist/tools/update-status/evidence-payload.d.ts +180 -0
  28. package/dist/tools/update-status/evidence-payload.js +76 -0
  29. package/dist/tools/update-status/index.js +30 -0
  30. package/dist/tools/validate.js +1 -1
  31. package/dist/types/evidence-gates.d.ts +9 -0
  32. package/dist/types/lifecycle.d.ts +1 -10
  33. package/dist/types/spec/inputs.d.ts +2 -1
  34. package/package.json +1 -1
  35. package/planu-plugin.json +14 -4
  36. package/src/i18n/messages/en.json +2 -2
  37. package/src/i18n/messages/es.json +2 -2
  38. package/src/i18n/messages/pt.json +2 -2
  39. package/dist/engine/detectors/cicd-detector.d.ts +0 -7
  40. package/dist/engine/detectors/cicd-detector.js +0 -170
@@ -11,7 +11,7 @@ export declare function checkContradictions(projectId: string, specId: string, d
11
11
  /** Dispatches the on_spec_created hook event (fire-and-forget). */
12
12
  export declare function fireSpecCreatedHook(projectId: string, spec: Spec, projectPath: string): void;
13
13
  /** Generates post-creation suggestions based on project state and spec description. Best-effort: never throws. */
14
- export declare function generatePostCreationSuggestions(projectPath: string, description: string, knowledge?: ProjectKnowledge): Promise<PostCreationSuggestion[]>;
14
+ export declare function generatePostCreationSuggestions(_projectPath: string, description: string, knowledge?: ProjectKnowledge): Promise<PostCreationSuggestion[]>;
15
15
  /** Formats a structured post-creation suggestion for human-readable next steps. */
16
16
  export declare function formatPostCreationSuggestion(suggestion: PostCreationSuggestion): string;
17
17
  /**
@@ -1,7 +1,6 @@
1
1
  import { technologyValue } from '../../engine/technology-registry.js';
2
2
  import { specStore } from '../../storage/index.js';
3
3
  import { detectContradictions } from '../../engine/contradiction-detector.js';
4
- import { detectCiCd } from '../../engine/detectors/cicd-detector.js';
5
4
  import { tryAutoSetupGit } from '../create-spec-helpers.js';
6
5
  import { emitAutopilotEvent } from '../../engine/autopilot/event-bus.js';
7
6
  import { incrementSpecCount } from '../../engine/autopilot/state-updater.js';
@@ -80,8 +79,8 @@ export async function checkContradictions(projectId, specId, description) {
80
79
  }
81
80
  const blockers = newSpecContradictions.filter((c) => c.severity === 'blocker');
82
81
  return blockers.length > 0
83
- ? `[CONFLICT] ${blockers.length} potential blocker contradiction(s) detected. Run detect_contradictions for details.`
84
- : `[WARNING] ${newSpecContradictions.length} potential contradiction(s) detected. Run detect_contradictions for details.`;
82
+ ? `[CONFLICT] ${blockers.length} potential blocker contradiction(s) detected. Run challenge_spec for details.`
83
+ : `[WARNING] ${newSpecContradictions.length} potential contradiction(s) detected. Run challenge_spec for details.`;
85
84
  }
86
85
  catch {
87
86
  return undefined;
@@ -167,67 +166,26 @@ function isServerlessKnowledge(knowledge) {
167
166
  const deployPlatform = (knowledge.conventions?.['deploy-platform'] ?? '').toLowerCase();
168
167
  return SERVERLESS_PLATFORMS.some((p) => services.some((s) => s.includes(p)) || deployPlatform.includes(p));
169
168
  }
170
- // === Template pattern matching ===
171
- const TEMPLATE_PATTERNS = [
172
- { pattern: /\b(?:crud|create\s+read\s+update\s+delete|rest\s+api)\b/i, category: 'crud' },
173
- { pattern: /\b(?:auth|login|signup|authentication)\b/i, category: 'auth' },
174
- { pattern: /\b(?:payment|checkout|billing|stripe)\b/i, category: 'payments' },
175
- { pattern: /\b(?:notification|email|push\s+notification)\b/i, category: 'notifications' },
176
- ];
177
169
  /** Generates post-creation suggestions based on project state and spec description. Best-effort: never throws. */
178
- export async function generatePostCreationSuggestions(projectPath, description, knowledge) {
170
+ export function generatePostCreationSuggestions(_projectPath, description, knowledge) {
179
171
  const suggestions = [];
180
- // Item 1: Suggest generate_ci when no CI detected
181
- try {
182
- const ciResult = await detectCiCd(projectPath);
183
- if (ciResult.platform === null) {
184
- suggestions.push({
185
- tool: 'generate_planu_ci',
186
- reason: 'No CI/CD configuration detected. Run generate_planu_ci to set up automated testing and deployment.',
187
- });
188
- }
189
- }
190
- catch {
191
- // Best-effort: if detection fails, skip suggestion
192
- }
193
- // Item 2: Suggest version verification when description references technology stacks
194
172
  if (hasTechStackReferences(description)) {
195
173
  suggestions.push({
196
- tool: 'verify_versions',
174
+ tool: 'challenge_spec',
197
175
  reason: 'IMPORTANT: Before approving, verify all technology versions in this spec against official sources (npm registry, GitHub releases, Docker Hub, official docs). Outdated versions can cause security vulnerabilities and compatibility issues.',
198
176
  });
199
177
  }
200
- // Item 3: Warn about in-memory state anti-patterns in serverless environments
201
178
  if (isServerlessKnowledge(knowledge)) {
202
179
  suggestions.push({
203
- tool: 'scan_project',
180
+ tool: 'challenge_spec',
204
181
  reason: '[SERVERLESS WARNING] Module-level mutable state may reset on cold starts. Confirm the required state lifetime and storage strategy before implementation.',
205
182
  });
206
183
  }
207
- // Item 4: Suggest templates only when the user explicitly requests one.
208
- for (const { pattern, category } of TEMPLATE_PATTERNS) {
209
- if (hasAffirmedPattern(description, pattern) && explicitlyRequestsTemplate(description)) {
210
- suggestions.push({
211
- tool: 'apply_template',
212
- reason: `Description matches "${category}" pattern. Consider using an ${category} template.`,
213
- templateCategory: category,
214
- });
215
- }
216
- }
217
- // Item 4: Suggest committing progress with conventional commits
218
- suggestions.push({
219
- tool: 'manage_git',
220
- reason: 'Save progress with git after implementing: `git commit -m "feat(SPEC-XXX): implementation checkpoint"` — include the spec ID for traceability',
221
- });
222
- return suggestions;
223
- }
224
- function explicitlyRequestsTemplate(description) {
225
- return /\b(?:use|apply|start from|base (?:this|it) on)\s+(?:an?\s+)?(?:[\w-]+\s+)?template\b/i.test(description);
184
+ return Promise.resolve(suggestions);
226
185
  }
227
186
  /** Formats a structured post-creation suggestion for human-readable next steps. */
228
187
  export function formatPostCreationSuggestion(suggestion) {
229
- const templateSuffix = suggestion.templateCategory !== undefined ? ` (${suggestion.templateCategory})` : '';
230
- return `${suggestion.tool}${templateSuffix}: ${suggestion.reason}`;
188
+ return `${suggestion.tool}: ${suggestion.reason}`;
231
189
  }
232
190
  /**
233
191
  * SPEC-781: Run heavy analysis (contradiction detection, complexity advice) in a
@@ -1119,7 +1119,7 @@ async function prepareCreateSpecCandidate(initialParams) {
1119
1119
  content: [
1120
1120
  {
1121
1121
  type: 'text',
1122
- text: `💡 **Idea captured**: "${params.description}"\n\nThe description is too brief for a full spec. Use \`capture_idea\` to save it to the backlog, or provide more detail (>10 words) to create a spec.`,
1122
+ text: `💡 **Idea captured**: "${params.description}"\n\nThe description is too brief for a full spec. Provide more detail (>10 words) to create a spec.`,
1123
1123
  },
1124
1124
  ],
1125
1125
  });
@@ -51,12 +51,12 @@ const PROBLEM_TO_TOOL = [
51
51
  [/validat/i, 'validate', 'validate a spec'],
52
52
  [/spec|user stor/i, 'create_spec', 'create a spec/user story'],
53
53
  [/estimat/i, 'estimate', 'estimate effort and cost'],
54
- [/document|doc/i, 'generate_docs', 'generate documentation'],
55
- [/drift|diverge/i, 'detect_drift', 'detect spec drift'],
56
- [/schema|database|db/i, 'design_schema', 'design a database schema'],
57
- [/ui|interface|screen/i, 'define_ui_contract', 'define a UI contract'],
58
- [/execution|plan|roadmap/i, 'generate_execution_plan', 'generate an execution plan'],
59
- [/checklist/i, 'generate_checklist', 'generate a checklist'],
54
+ [/document|doc/i, 'create_spec', 'create a spec for the documentation change'],
55
+ [/drift|diverge/i, 'reconcile_spec', 'reconcile the spec with the implementation'],
56
+ [/schema|database|db/i, 'create_spec', 'create a spec for the data model change'],
57
+ [/ui|interface|screen/i, 'create_spec', 'create a spec for the UI change'],
58
+ [/execution|plan|roadmap/i, 'package_handoff', 'package the implementation handoff'],
59
+ [/checklist/i, 'check_readiness', 'check the readiness checklist of the spec'],
60
60
  ];
61
61
  function buildConcreteProblemResponse(description) {
62
62
  const match = PROBLEM_TO_TOOL.find(([re]) => re.test(description));
@@ -134,7 +134,7 @@ export function buildInitProjectResult(input) {
134
134
  skillsSkipped: input.skillsSkipped,
135
135
  skillsPendingInstall: input.skillsPendingInstall,
136
136
  skillInstallHint: input.skillsPendingInstall.length > 0
137
- ? `Run skill_install to install recommended skills: ${input.skillsPendingInstall.join(', ')}`
137
+ ? `Re-run init_project to install the recommended skills: ${input.skillsPendingInstall.join(', ')}`
138
138
  : null,
139
139
  planuConfig: input.planuConfigGenerated
140
140
  ? { generated: true, path: input.planuConfigPath }
@@ -194,7 +194,7 @@ export function buildInitProjectResult(input) {
194
194
  const framework = result.framework ?? 'no framework detected';
195
195
  const action = isUpdate ? 'updated' : 'initialized';
196
196
  const telemetryNote = input.telemetryOptInPrompt
197
- ? `\n\n---\n💡 **Help improve Planu** — run \`configure_telemetry\` with action=enable, then set a valid \`PLANU_TELEMETRY_ENDPOINT\` and secret \`PLANU_TELEMETRY_TOKEN\` to share anonymous usage stats (no paths, no emails, no personal data). You can opt out anytime.`
197
+ ? `\n\n---\n💡 **Help improve Planu** — set \`PLANU_TELEMETRY=on\` and \`PLANU_TELEMETRY_CONSENT_VERSION=1\` (both are required by \`isTelemetryEnabled\` in \`src/engine/telemetry/telemetry-store.ts:76-78\`), then set a valid \`PLANU_TELEMETRY_ENDPOINT\` and secret \`PLANU_TELEMETRY_TOKEN\` to share anonymous usage stats (no paths, no emails, no personal data). You can opt out anytime.`
198
198
  : '';
199
199
  const tokenTip = `\n\n💡 Token tip: Add CLAUDE_CODE_SUBAGENT_MODEL=haiku to your .env — makes all read-only subagents ` +
200
200
  `(search, grep, file reads) use Haiku instead of your session model (4–18x cheaper for those tasks).`;
@@ -224,9 +224,9 @@ export function buildInitProjectResult(input) {
224
224
  options: [
225
225
  {
226
226
  label: 'Yes, install now',
227
- description: 'Runs skill_install for each recommended skill automatically.',
227
+ description: 'Re-runs init_project so it installs each recommended skill.',
228
228
  },
229
- { label: 'Skip for now', description: 'You can install later with skill_install.' },
229
+ { label: 'Skip for now', description: 'You can install later by re-running init_project.' },
230
230
  ],
231
231
  });
232
232
  }
@@ -113,7 +113,7 @@ async function checkPendingDriftBanner(projectPath, signal) {
113
113
  const maxScore = Math.max(...pending.map((e) => e.driftScore));
114
114
  return {
115
115
  banner: `\n⚠️ Auto-drift alert: specs [${specIds}] may have drifted ` +
116
- `(score: ${maxScore.toFixed(2)}). Run detect_drift to review.`,
116
+ `(score: ${maxScore.toFixed(2)}). Run reconcile_spec to review.`,
117
117
  acknowledge: () => {
118
118
  /* v8 ignore start */
119
119
  void store.markAllShown().catch((err) => {
@@ -242,7 +242,7 @@ export async function handlePlanStatus(args, signal = getToolExecutionSignal())
242
242
  const sessionAgeMinutes = sessionState !== null ? computeSessionAgeMinutes(sessionState.savedAt) : null;
243
243
  const SESSION_TIP_THRESHOLD_MIN = 60;
244
244
  const sessionTip = sessionAgeMinutes !== null && sessionAgeMinutes > SESSION_TIP_THRESHOLD_MIN
245
- ? `Last checkpoint ${String(sessionAgeMinutes)}min ago — run session_handoff then start a fresh session to cut token costs`
245
+ ? `Last checkpoint ${String(sessionAgeMinutes)}min ago — run session_checkpoint then start a fresh session to cut token costs`
246
246
  : undefined;
247
247
  const tokenWasteThresholdMin = tokenWastePolicy?.context.staleSessionMinutes;
248
248
  const tokenWasteHint = tokenWasteThresholdMin !== undefined &&
@@ -25,6 +25,7 @@ import { handlePlanStatus } from '../status-handler.js';
25
25
  import { handleSessionCheckpoint } from '../session-checkpoint.js';
26
26
  import { handleGetJob, handleRestartJob } from '../jobs/handlers.js';
27
27
  import { handleFacilitate } from '../facilitate.js';
28
+ import { UpdateStatusEvidenceTransportSchema } from '../update-status/evidence-payload.js';
28
29
  const INIT_PROJECT_INPUT_SCHEMA = {
29
30
  projectPath: z
30
31
  .string()
@@ -479,7 +480,7 @@ const coreToolsRegistry = [
479
480
  description: 'Persist a host-LLM-synthesized spec.md body and retire the legacy files it replaces: ' +
480
481
  'each retired file/directory is backed up with a timestamped .bak copy, deleted, and ' +
481
482
  'git-untracked. Call this after synthesizing mergedBody from the legacyFiles listed in a ' +
482
- 'migrate_legacy_spec directive (from init_project, list_specs, or heal_spec_docs).',
483
+ 'migrate_legacy_spec directive (from init_project or list_specs).',
483
484
  schema: migrateLegacySpecInputSchema,
484
485
  handler: (args) => migrateLegacySpec(args),
485
486
  annotations: { readOnlyHint: false, destructiveHint: true, title: 'Migrate Legacy Spec' },
@@ -821,6 +822,7 @@ const coreToolsRegistry = [
821
822
  .boolean()
822
823
  .optional()
823
824
  .describe('SPEC-769: Force-approve a spec that scored below 70 on the readiness gate. Warnings are stored in spec.md frontmatter. Use when the LLM has explicitly confirmed the spec is ready despite a low readiness score.'),
825
+ evidence: UpdateStatusEvidenceTransportSchema.optional().describe('Optional. Evidence artifacts to persist into the handoff store before the gates run: discovery (approved), taskPlan (implementing), traceabilityMatrix, contractValidation, reviewFeedback (review → approved, reviewer.agent must be planu-spec-reviewer) and implementationReview (done, reviewer.agent must be planu-implementation-reviewer with a sessionId different from the implementer). Ignored under dry_run. Files are overwritten.'),
824
826
  },
825
827
  handler: async (args) => runWithTrustedLocalMcpContext(() => handleUpdateStatus(args)),
826
828
  wrap: 'tracked',
@@ -0,0 +1,180 @@
1
+ import { z } from 'zod';
2
+ import type { UpdateStatusEvidencePayload } from '../../types/evidence-gates.js';
3
+ export declare const UpdateStatusEvidencePayloadSchema: z.ZodObject<{
4
+ discovery: z.ZodOptional<z.ZodObject<{
5
+ version: z.ZodLiteral<1>;
6
+ provenance: z.ZodOptional<z.ZodObject<{
7
+ receiptId: z.ZodString;
8
+ artifactDigest: z.ZodString;
9
+ specId: z.ZodString;
10
+ issuerId: z.ZodString;
11
+ }, z.core.$strict>>;
12
+ rules: z.ZodArray<z.ZodString>;
13
+ examples: z.ZodArray<z.ZodObject<{
14
+ rule: z.ZodString;
15
+ example: z.ZodString;
16
+ }, z.core.$strict>>;
17
+ openQuestions: z.ZodArray<z.ZodObject<{
18
+ question: z.ZodString;
19
+ status: z.ZodEnum<{
20
+ open: "open";
21
+ out_of_scope: "out_of_scope";
22
+ resolved: "resolved";
23
+ }>;
24
+ resolution: z.ZodOptional<z.ZodString>;
25
+ }, z.core.$strict>>;
26
+ outOfScope: z.ZodArray<z.ZodString>;
27
+ glossary: z.ZodArray<z.ZodObject<{
28
+ term: z.ZodString;
29
+ meaning: z.ZodString;
30
+ }, z.core.$strict>>;
31
+ }, z.core.$strict>>;
32
+ taskPlan: z.ZodOptional<z.ZodObject<{
33
+ version: z.ZodLiteral<1>;
34
+ provenance: z.ZodOptional<z.ZodObject<{
35
+ receiptId: z.ZodString;
36
+ artifactDigest: z.ZodString;
37
+ specId: z.ZodString;
38
+ issuerId: z.ZodString;
39
+ }, z.core.$strict>>;
40
+ generatedBy: z.ZodOptional<z.ZodLiteral<"planu-evidence-skeleton">>;
41
+ tasks: z.ZodArray<z.ZodObject<{
42
+ id: z.ZodString;
43
+ title: z.ZodString;
44
+ acceptanceCriteria: z.ZodArray<z.ZodString>;
45
+ status: z.ZodEnum<{
46
+ doing: "doing";
47
+ done: "done";
48
+ pending: "pending";
49
+ }>;
50
+ }, z.core.$strict>>;
51
+ }, z.core.$strict>>;
52
+ traceabilityMatrix: z.ZodOptional<z.ZodObject<{
53
+ version: z.ZodLiteral<1>;
54
+ provenance: z.ZodOptional<z.ZodObject<{
55
+ receiptId: z.ZodString;
56
+ artifactDigest: z.ZodString;
57
+ specId: z.ZodString;
58
+ issuerId: z.ZodString;
59
+ }, z.core.$strict>>;
60
+ rows: z.ZodArray<z.ZodObject<{
61
+ acceptanceCriterion: z.ZodString;
62
+ scenario: z.ZodOptional<z.ZodString>;
63
+ testEvidence: z.ZodOptional<z.ZodArray<z.ZodString>>;
64
+ contractEvidence: z.ZodOptional<z.ZodArray<z.ZodString>>;
65
+ manualEvidence: z.ZodOptional<z.ZodString>;
66
+ changedFiles: z.ZodArray<z.ZodString>;
67
+ validationEvidence: z.ZodOptional<z.ZodString>;
68
+ reviewerEvidence: z.ZodOptional<z.ZodString>;
69
+ commandEvidence: z.ZodOptional<z.ZodObject<{
70
+ capability: z.ZodEnum<{
71
+ contract: "contract";
72
+ coverage: "coverage";
73
+ "fault-injection": "fault-injection";
74
+ lint: "lint";
75
+ migration: "migration";
76
+ native: "native";
77
+ reproducibility: "reproducibility";
78
+ security: "security";
79
+ "test-full": "test-full";
80
+ "test-related": "test-related";
81
+ typecheck: "typecheck";
82
+ website: "website";
83
+ }>;
84
+ command: z.ZodString;
85
+ scope: z.ZodArray<z.ZodString>;
86
+ relevantPaths: z.ZodOptional<z.ZodArray<z.ZodString>>;
87
+ evidenceKey: z.ZodString;
88
+ }, z.core.$strict>>;
89
+ }, z.core.$strict>>;
90
+ }, z.core.$strict>>;
91
+ contractValidation: z.ZodOptional<z.ZodObject<{
92
+ version: z.ZodLiteral<1>;
93
+ provenance: z.ZodOptional<z.ZodObject<{
94
+ receiptId: z.ZodString;
95
+ artifactDigest: z.ZodString;
96
+ specId: z.ZodString;
97
+ issuerId: z.ZodString;
98
+ }, z.core.$strict>>;
99
+ kind: z.ZodEnum<{
100
+ api: "api";
101
+ event: "event";
102
+ graphql: "graphql";
103
+ mcp: "mcp";
104
+ ui: "ui";
105
+ }>;
106
+ passed: z.ZodBoolean;
107
+ reportPath: z.ZodOptional<z.ZodString>;
108
+ summary: z.ZodOptional<z.ZodString>;
109
+ }, z.core.$strict>>;
110
+ reviewFeedback: z.ZodOptional<z.ZodObject<{
111
+ schema_version: z.ZodString;
112
+ specId: z.ZodString;
113
+ verdict: z.ZodEnum<{
114
+ approved: "approved";
115
+ "changes-requested": "changes-requested";
116
+ }>;
117
+ reviewer: z.ZodObject<{
118
+ kind: z.ZodEnum<{
119
+ automation: "automation";
120
+ human: "human";
121
+ "spec-review-agent": "spec-review-agent";
122
+ }>;
123
+ agent: z.ZodString;
124
+ verdict: z.ZodEnum<{
125
+ approved: "approved";
126
+ "changes-requested": "changes-requested";
127
+ }>;
128
+ }, z.core.$strip>;
129
+ blockers: z.ZodArray<z.ZodString>;
130
+ suggestions: z.ZodArray<z.ZodString>;
131
+ body: z.ZodString;
132
+ reviewedAt: z.ZodISODateTime;
133
+ }, z.core.$strip>>;
134
+ implementationReview: z.ZodOptional<z.ZodObject<{
135
+ schema_version: z.ZodString;
136
+ specId: z.ZodString;
137
+ verdict: z.ZodEnum<{
138
+ approved: "approved";
139
+ "changes-requested": "changes-requested";
140
+ }>;
141
+ reviewer: z.ZodObject<{
142
+ kind: z.ZodEnum<{
143
+ human: "human";
144
+ "implementation-review-agent": "implementation-review-agent";
145
+ }>;
146
+ agent: z.ZodString;
147
+ verdict: z.ZodEnum<{
148
+ approved: "approved";
149
+ "changes-requested": "changes-requested";
150
+ }>;
151
+ sessionId: z.ZodOptional<z.ZodString>;
152
+ }, z.core.$strip>;
153
+ blockers: z.ZodArray<z.ZodString>;
154
+ suggestions: z.ZodArray<z.ZodString>;
155
+ body: z.ZodString;
156
+ reviewedAt: z.ZodISODateTime;
157
+ }, z.core.$strip>>;
158
+ }, z.core.$strip>;
159
+ export declare const UpdateStatusEvidenceTransportSchema: z.ZodObject<{
160
+ discovery: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
161
+ taskPlan: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
162
+ traceabilityMatrix: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
163
+ contractValidation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
164
+ reviewFeedback: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
165
+ implementationReview: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
166
+ }, z.core.$strip>;
167
+ type PersistedEvidence = {
168
+ ok: true;
169
+ written: string[];
170
+ } | {
171
+ ok: false;
172
+ errors: string[];
173
+ };
174
+ export declare function persistEvidencePayload(args: {
175
+ projectId: string;
176
+ specId: string;
177
+ evidence: UpdateStatusEvidencePayload;
178
+ }): Promise<PersistedEvidence>;
179
+ export {};
180
+ //# sourceMappingURL=evidence-payload.d.ts.map
@@ -0,0 +1,76 @@
1
+ import { z } from 'zod';
2
+ import { ContractValidationSchema, DiscoverySchema, TaskPlanSchema, TraceabilityMatrixSchema, handoffEvidencePath, } from '../../engine/evidence-gates/artifact-reader.js';
3
+ import { appendArtifact } from '../../engine/handoff-artifacts/io.js';
4
+ import { ImplementationReviewV1Schema, ReviewFeedbackV1Schema, } from '../../engine/handoff-artifacts/schemas.js';
5
+ import { atomicWriteFile } from '../../engine/safety/atomic-write-file.js';
6
+ export const UpdateStatusEvidencePayloadSchema = z.object({
7
+ discovery: DiscoverySchema.optional().describe('discovery.json: rules, examples, openQuestions, outOfScope, glossary.'),
8
+ taskPlan: TaskPlanSchema.optional().describe('task-plan.json: tasks mapped to acceptance criteria.'),
9
+ traceabilityMatrix: TraceabilityMatrixSchema.optional().describe('traceability-matrix.json: one row per acceptance criterion.'),
10
+ contractValidation: ContractValidationSchema.optional().describe('contract-validation-<kind>.json; kind is one of api, graphql, event, ui, mcp.'),
11
+ reviewFeedback: ReviewFeedbackV1Schema.optional().describe('review_feedback.md written by planu-spec-reviewer.'),
12
+ implementationReview: ImplementationReviewV1Schema.optional().describe('implementation_review.json written by planu-implementation-reviewer.'),
13
+ });
14
+ function transportArtifact(description) {
15
+ return z.record(z.string(), z.unknown()).optional().describe(description);
16
+ }
17
+ export const UpdateStatusEvidenceTransportSchema = z.object({
18
+ discovery: transportArtifact('Keys: version (1), rules, examples, openQuestions, outOfScope, glossary.'),
19
+ taskPlan: transportArtifact('Keys: version (1), tasks[{id, title, acceptanceCriteria, status}].'),
20
+ traceabilityMatrix: transportArtifact('Keys: version (1), rows[{acceptanceCriterion, changedFiles}].'),
21
+ contractValidation: transportArtifact('Keys: version (1), kind (api|graphql|event|ui|mcp), passed.'),
22
+ reviewFeedback: transportArtifact('Keys: schema_version, specId, verdict, reviewer, blockers, suggestions, body, reviewedAt.'),
23
+ implementationReview: transportArtifact('Keys: schema_version, specId, verdict, reviewer, blockers, suggestions, body, reviewedAt.'),
24
+ });
25
+ export async function persistEvidencePayload(args) {
26
+ const parsed = UpdateStatusEvidencePayloadSchema.safeParse(args.evidence);
27
+ if (!parsed.success) {
28
+ return {
29
+ ok: false,
30
+ errors: parsed.error.issues.map((issue) => `${issue.path.join('.')}: ${issue.message}`),
31
+ };
32
+ }
33
+ const { projectId, specId } = args;
34
+ const evidence = parsed.data;
35
+ const written = [];
36
+ if (evidence.discovery !== undefined) {
37
+ const path = handoffEvidencePath(projectId, specId, 'discovery.json');
38
+ await atomicWriteFile(path, `${JSON.stringify(evidence.discovery, null, 2)}\n`);
39
+ written.push(path);
40
+ }
41
+ if (evidence.taskPlan !== undefined) {
42
+ const path = handoffEvidencePath(projectId, specId, 'task-plan.json');
43
+ await atomicWriteFile(path, `${JSON.stringify(evidence.taskPlan, null, 2)}\n`);
44
+ written.push(path);
45
+ }
46
+ if (evidence.traceabilityMatrix !== undefined) {
47
+ const path = handoffEvidencePath(projectId, specId, 'traceability-matrix.json');
48
+ await atomicWriteFile(path, `${JSON.stringify(evidence.traceabilityMatrix, null, 2)}\n`);
49
+ written.push(path);
50
+ }
51
+ if (evidence.contractValidation !== undefined) {
52
+ const path = handoffEvidencePath(projectId, specId, `contract-validation-${evidence.contractValidation.kind}.json`);
53
+ await atomicWriteFile(path, `${JSON.stringify(evidence.contractValidation, null, 2)}\n`);
54
+ written.push(path);
55
+ }
56
+ if (evidence.reviewFeedback !== undefined) {
57
+ const { path } = await appendArtifact({
58
+ projectId,
59
+ specId,
60
+ kind: 'review_feedback',
61
+ payload: evidence.reviewFeedback,
62
+ });
63
+ written.push(path);
64
+ }
65
+ if (evidence.implementationReview !== undefined) {
66
+ const { path } = await appendArtifact({
67
+ projectId,
68
+ specId,
69
+ kind: 'implementation_review',
70
+ payload: evidence.implementationReview,
71
+ });
72
+ written.push(path);
73
+ }
74
+ return { ok: true, written };
75
+ }
76
+ //# sourceMappingURL=evidence-payload.js.map
@@ -44,6 +44,7 @@ import { assertExecutionCanCommit } from '../../engine/execution/context.js';
44
44
  import { shouldSkipGateForExplicitLegacyHarness } from './gate-harness.js';
45
45
  import { assertValidationFreshnessBarrier, closeValidationFreshnessLease, } from '../../engine/validation/validation-freshness.js';
46
46
  import { currentReconciliationInvocationContext, reconcileImplementingSpec, } from '../../engine/lifecycle-reconciliation.js';
47
+ import { persistEvidencePayload } from './evidence-payload.js';
47
48
  const IMPLEMENTATION_REVIEW_DIGEST = /^sha256:[a-f0-9]{64}$/u;
48
49
  function lifecycleAuthorityError(code, message, fixHint) {
49
50
  return {
@@ -801,6 +802,17 @@ export async function handleUpdateStatus(params, server) {
801
802
  ? effectiveProjectPath
802
803
  : (knowledge?.projectPath ?? effectiveProjectPath)) || undefined;
803
804
  if (authorityRoute.route === 'reconcile') {
805
+ if (params.evidence !== undefined) {
806
+ return {
807
+ content: [
808
+ {
809
+ type: 'text',
810
+ text: 'Evidence payload is not accepted on the reconcile route: write the artifacts with update_status before reconciling.',
811
+ },
812
+ ],
813
+ isError: true,
814
+ };
815
+ }
804
816
  return reconcileImplementingSpec({
805
817
  input: params,
806
818
  projectId,
@@ -820,6 +832,24 @@ export async function handleUpdateStatus(params, server) {
820
832
  if (lockError) {
821
833
  return lockError;
822
834
  }
835
+ if (params.evidence !== undefined && params.dry_run !== true) {
836
+ const persisted = await persistEvidencePayload({
837
+ projectId,
838
+ specId,
839
+ evidence: params.evidence,
840
+ });
841
+ if (!persisted.ok) {
842
+ return {
843
+ content: [
844
+ {
845
+ type: 'text',
846
+ text: `Evidence payload rejected:\n${persisted.errors.map((error) => `- ${error}`).join('\n')}`,
847
+ },
848
+ ],
849
+ isError: true,
850
+ };
851
+ }
852
+ }
823
853
  // Dry-run checks availability without acquiring. Real mutations acquire only
824
854
  // around the compare-and-swap plus spec/store commit below.
825
855
  const isDryRun = params.dry_run === true;
@@ -657,7 +657,7 @@ export async function executeValidate(args, server, onProgress) {
657
657
  suggestions.push('Implementation incomplete. Review DoD checklist before marking as done.');
658
658
  }
659
659
  if (effectiveResult.missing.length > 0) {
660
- suggestions.push(`${effectiveResult.missing.length} criteria still missing. Run detect_drift to identify gaps.`);
660
+ suggestions.push(`${effectiveResult.missing.length} criteria still missing. Run reconcile_spec to record the gaps.`);
661
661
  }
662
662
  if (graphCoverage.gaps.length > 0) {
663
663
  suggestions.push(`${graphCoverage.gaps.length} graph-backed coverage gap(s) found without broad repository scan.`);
@@ -1,5 +1,6 @@
1
1
  import type { ValidationArtifactDigests, ValidationArtifactProvenance, ValidationReceipt } from './validation-receipt.js';
2
2
  import type { ValidationGateCapability } from './validation-evidence.js';
3
+ import type { ArtifactPayload } from './handoff-artifacts.js';
3
4
  export type EvidenceGateTransition = 'approved' | 'implementing' | 'done';
4
5
  export interface DiscoveryEvidence {
5
6
  version: 1;
@@ -61,6 +62,14 @@ export interface ContractValidationEvidence {
61
62
  reportPath?: string;
62
63
  summary?: string;
63
64
  }
65
+ export interface UpdateStatusEvidencePayload {
66
+ discovery?: DiscoveryEvidence;
67
+ taskPlan?: TaskPlanEvidence;
68
+ traceabilityMatrix?: TraceabilityMatrixEvidence;
69
+ contractValidation?: ContractValidationEvidence;
70
+ reviewFeedback?: ArtifactPayload<'review_feedback'>;
71
+ implementationReview?: ArtifactPayload<'implementation_review'>;
72
+ }
64
73
  export interface EvidenceArtifacts {
65
74
  discovery?: DiscoveryEvidence;
66
75
  taskPlan?: TaskPlanEvidence;
@@ -1,12 +1,3 @@
1
- export type CiCdPlatform = 'github-actions' | 'gitlab-ci' | 'circleci' | 'buildkite' | 'azure-devops' | 'jenkins' | 'drone' | 'woodpecker' | 'tekton' | 'travis-ci' | 'bitbucket-pipelines' | 'teamcity' | 'bamboo' | 'concourse' | 'harness';
2
- export interface CiCdDetection {
3
- platform: CiCdPlatform | null;
4
- configFile: string | null;
5
- multipleDetected: CiCdPlatform[];
6
- hasDeployStage: boolean;
7
- hasDependencyAudit: boolean;
8
- hasTestStage: boolean;
9
- hasLintStage: boolean;
10
- }
1
+ export {};
11
2
  /** SPEC-747: Input for retro-audit of frozen specs */
12
3
  //# sourceMappingURL=lifecycle.d.ts.map
@@ -3,6 +3,7 @@ import type { Actuals } from '../estimation.js';
3
3
  import type { GlobalConfig } from '../project/config-metrics.js';
4
4
  import type { StructuredErrorNextAction } from '../errors/structured-error.js';
5
5
  import type { Spec, SpecDiagram, SpecSplitSuggestion, ReconcileChange } from './core.js';
6
+ import type { UpdateStatusEvidencePayload } from '../evidence-gates.js';
6
7
  export interface ReconciliationInvocationContext {
7
8
  surface: 'local-mcp' | 'http' | 'dashboard' | 'direct' | 'unknown';
8
9
  }
@@ -100,6 +101,7 @@ export interface UpdateStatusInput {
100
101
  expectedImplementingTransitionId?: string;
101
102
  /** sha256: digest of validation-report.json; derived for done when omitted. */
102
103
  implementationReviewDigest?: string;
104
+ evidence?: UpdateStatusEvidencePayload;
103
105
  /**
104
106
  * SPEC-769: Force-approve a spec that scored below 70 on the readiness gate.
105
107
  * When true, the transition proceeds and qualityWarnings[] is written to spec.md frontmatter.
@@ -181,7 +183,6 @@ export interface ChallengeSpecInput {
181
183
  export interface PostCreationSuggestion {
182
184
  tool: string;
183
185
  reason: string;
184
- templateCategory?: string;
185
186
  }
186
187
  export interface CreateSpecResult {
187
188
  specId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planu/cli",
3
- "version": "5.7.22",
3
+ "version": "5.7.23",
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",
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.22",
5
+ "version": "5.7.23",
6
6
  "icon": "assets/plugin/icon.svg",
7
7
  "command": ["npx", "@planu/cli@latest"],
8
8
  "packageName": "@planu/cli",
@@ -28,9 +28,19 @@
28
28
  "get_job",
29
29
  "restart_job"
30
30
  ],
31
- "resources": ["planu://specs/list", "planu://specs/{id}", "planu://project/status", "planu://roadmap"],
32
- "prompts": ["create-spec-from-idea", "review-spec-readiness", "generate-implementation-plan"],
33
- "subagents": ["sdd-orchestrator", "spec-challenger", "test-generator"]
31
+ "resources": [
32
+ "planu://budget/status",
33
+ "planu://patterns",
34
+ "planu://process",
35
+ "planu://specs",
36
+ "planu://templates",
37
+ "planu://usage/stats",
38
+ "planu://velocity/report",
39
+ "planu://workspace/health",
40
+ "planu://workspace/overview"
41
+ ],
42
+ "prompts": ["create-feature", "implement-spec", "project-status", "review-spec"],
43
+ "subagents": ["planu-challenger", "planu-readiness-auditor", "planu-spec-implementer", "planu-validator"]
34
44
  },
35
45
  "compatibility": { "minimumHostVersion": "1.0.0", "requiredFeatures": ["mcp-tools", "file-editing"] },
36
46
  "repository": "https://github.com/planu-dev/planu",