@planu/cli 5.5.3 → 5.6.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 (84) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/.planu-build.json +1 -1
  3. package/dist/engine/autopilot/bootstrap.js +1 -1
  4. package/dist/engine/cascade-hooks/core/append-releases.js +22 -12
  5. package/dist/engine/detection-utils.d.ts +1 -0
  6. package/dist/engine/detection-utils.js +33 -0
  7. package/dist/engine/doc-generator/portal/index.d.ts +1 -1
  8. package/dist/engine/doc-generator/portal/index.js +1 -1
  9. package/dist/engine/doc-generator/portal/portal-regenerator.d.ts +8 -3
  10. package/dist/engine/doc-generator/portal/portal-regenerator.js +16 -7
  11. package/dist/engine/evidence-gates/evidence-autofill.d.ts +1 -1
  12. package/dist/engine/evidence-gates/evidence-autofill.js +1 -1
  13. package/dist/engine/framework-detector.js +8 -6
  14. package/dist/engine/housekeeping/history-log.d.ts +1 -0
  15. package/dist/engine/housekeeping/history-log.js +58 -3
  16. package/dist/engine/housekeeping/index.d.ts +2 -1
  17. package/dist/engine/housekeeping/index.js +2 -1
  18. package/dist/engine/housekeeping/runtime-residue-sweep.d.ts +9 -0
  19. package/dist/engine/housekeeping/runtime-residue-sweep.js +57 -0
  20. package/dist/engine/next-spec-resolver/orchestration-planner.js +1 -1
  21. package/dist/engine/next-spec-resolver/session-writer.js +1 -1
  22. package/dist/engine/project-graph/cache.js +23 -3
  23. package/dist/engine/readiness-checker.js +1 -1
  24. package/dist/engine/sdd-flow/checkpoints.js +29 -2
  25. package/dist/engine/session/checkpoint-writer.d.ts +1 -1
  26. package/dist/engine/session/checkpoint-writer.js +6 -5
  27. package/dist/engine/session-state/writer.js +4 -3
  28. package/dist/engine/spec-format/lean-spec-generator.js +1 -1
  29. package/dist/engine/spec-migrator/planu-canonical-policy.d.ts +8 -1
  30. package/dist/engine/spec-migrator/planu-canonical-policy.js +14 -13
  31. package/dist/engine/spec-migrator/strict-planu-cleanup.js +28 -3
  32. package/dist/engine/universal-rules/rules/planu-release-policy.js +1 -1
  33. package/dist/engine/validator/spec-compliance-runner.js +45 -0
  34. package/dist/hosts/claude-code/ux/mcp-resources.js +7 -23
  35. package/dist/resources/specs.js +12 -33
  36. package/dist/storage/current-project.d.ts +3 -0
  37. package/dist/storage/current-project.js +21 -0
  38. package/dist/storage/index.d.ts +1 -0
  39. package/dist/storage/index.js +1 -0
  40. package/dist/storage/migrations/canonical-storage.js +5 -0
  41. package/dist/storage/retention.d.ts +14 -0
  42. package/dist/storage/retention.js +279 -0
  43. package/dist/storage/spec-index.d.ts +23 -0
  44. package/dist/storage/spec-index.js +123 -0
  45. package/dist/storage/spec-store.d.ts +8 -3
  46. package/dist/storage/spec-store.js +76 -6
  47. package/dist/storage/storage-catalog.js +3 -3
  48. package/dist/storage/storage-layout.d.ts +8 -0
  49. package/dist/storage/storage-layout.js +9 -0
  50. package/dist/storage/transition-log.js +2 -0
  51. package/dist/tools/challenge-spec.js +10 -9
  52. package/dist/tools/create-spec.js +10 -0
  53. package/dist/tools/execute-sdd-flow.js +11 -2
  54. package/dist/tools/export-spec.js +2 -1
  55. package/dist/tools/force-status-analytics.js +2 -1
  56. package/dist/tools/generate-docs-site.js +2 -1
  57. package/dist/tools/generate-proposal.js +6 -2
  58. package/dist/tools/init-project/claude-md-generator.js +19 -2
  59. package/dist/tools/init-project/conventions-writer.d.ts +5 -2
  60. package/dist/tools/init-project/conventions-writer.js +18 -13
  61. package/dist/tools/init-project/git-setup.js +9 -0
  62. package/dist/tools/init-project/handler.js +9 -1
  63. package/dist/tools/init-project/legacy-root-migration.d.ts +15 -0
  64. package/dist/tools/init-project/legacy-root-migration.js +213 -0
  65. package/dist/tools/init-project/runtime-residue.d.ts +2 -0
  66. package/dist/tools/init-project/runtime-residue.js +11 -0
  67. package/dist/tools/session-checkpoint.js +1 -1
  68. package/dist/tools/update-status/index.js +7 -1
  69. package/dist/tools/update-status-actions.d.ts +7 -1
  70. package/dist/tools/update-status-actions.js +10 -2
  71. package/dist/types/housekeeping.d.ts +4 -0
  72. package/dist/types/index.d.ts +1 -0
  73. package/dist/types/index.js +1 -0
  74. package/dist/types/retention.d.ts +12 -0
  75. package/dist/types/retention.js +3 -0
  76. package/dist/types/spec/core.d.ts +7 -0
  77. package/dist/types/spec/index-cache.d.ts +25 -0
  78. package/dist/types/spec/index-cache.js +3 -0
  79. package/dist/types/spec/index.d.ts +1 -0
  80. package/dist/types/spec/index.js +1 -0
  81. package/dist/types/spec-format.d.ts +1 -0
  82. package/package.json +1 -1
  83. package/planu-plugin.json +1 -1
  84. package/scripts/lib/pending-release-file.mjs +20 -4
@@ -146,4 +146,8 @@ export interface HousekeepingHistoryEntry {
146
146
  prevSha: string;
147
147
  sha256: string;
148
148
  }
149
+ export interface RuntimeResidueSweepResult {
150
+ /** Absolute paths of every legacy runtime artifact removed from planu/. */
151
+ removed: string[];
152
+ }
149
153
  //# sourceMappingURL=housekeeping.d.ts.map
@@ -293,5 +293,6 @@ export * from './host-tool-filter.js';
293
293
  export * from './reconcile.js';
294
294
  export * from './release-pipeline.js';
295
295
  export * from './network-policy.js';
296
+ export * from './retention.js';
296
297
  export type { VerifiedImplementationReviewResult, VerifiedImplementationReviewOk, VerifiedImplementationReviewErr, ImplementationReviewRejectionReason, } from './handoff-artifacts.js';
297
298
  //# sourceMappingURL=index.d.ts.map
@@ -304,4 +304,5 @@ export * from './reconcile.js';
304
304
  // SPEC-1012: Release spec closer types
305
305
  export * from './release-pipeline.js';
306
306
  export * from './network-policy.js';
307
+ export * from './retention.js';
307
308
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,12 @@
1
+ export interface RetentionResult {
2
+ readonly freedBytes: number;
3
+ readonly removedPaths: readonly string[];
4
+ }
5
+ export type RetentionKind = 'transition-log' | 'graph-cache' | 'spec-store-backup' | 'idempotency' | 'snapshot' | 'spec-artifacts';
6
+ export interface EnforceRetentionInput {
7
+ readonly kind: RetentionKind;
8
+ readonly path: string;
9
+ readonly protectedPaths?: readonly string[];
10
+ readonly specId?: string;
11
+ }
12
+ //# sourceMappingURL=retention.d.ts.map
@@ -0,0 +1,3 @@
1
+ // types/retention.ts — SPEC-1697: retention budgets for runtime storage artifacts
2
+ export {};
3
+ //# sourceMappingURL=retention.js.map
@@ -139,6 +139,13 @@ export interface Spec {
139
139
  * Contains failure scenarios, addressed count, and overall risk.
140
140
  */
141
141
  challengeReport?: ChallengeReport;
142
+ /**
143
+ * SPEC-1699: sha256 digest of the spec.md content this record's title was
144
+ * last synced from. Absent or mismatched against the current spec.md means
145
+ * the record is stale and is refreshed on the next read that supplies a
146
+ * canonicalRoot (see spec-store.ts refreshSpecFromDisk).
147
+ */
148
+ contentDigest?: string;
142
149
  }
143
150
  /** SPEC-964: Result of running challenge_spec on a spec. */
144
151
  export interface ChallengeReport {
@@ -0,0 +1,25 @@
1
+ /** One spec's fields as parsed from its canonical spec.md, plus a content digest. */
2
+ export interface SpecIndexRecord {
3
+ readonly id: string;
4
+ readonly title: string;
5
+ readonly status: string;
6
+ readonly type: string;
7
+ readonly target: string;
8
+ readonly scope: string;
9
+ readonly difficulty: number | null;
10
+ readonly risk: string;
11
+ readonly createdAt: string | null;
12
+ readonly updatedAt: string;
13
+ readonly specPath: string;
14
+ readonly digest: string;
15
+ /** GIVEN/WHEN/THEN acceptance-criteria lines parsed from the spec.md body. */
16
+ readonly scenarios: readonly string[];
17
+ /** `TEST:` marker contents parsed from the spec.md body. */
18
+ readonly tests: readonly string[];
19
+ }
20
+ /** Regenerable cache persisted at planu/.runtime/index.json. spec.md is authoritative. */
21
+ export interface SpecIndex {
22
+ readonly generatedAt: string;
23
+ readonly specs: Readonly<Record<string, SpecIndexRecord>>;
24
+ }
25
+ //# sourceMappingURL=index-cache.d.ts.map
@@ -0,0 +1,3 @@
1
+ // Planu — Regenerable spec.md read-index types (SPEC-1699)
2
+ export {};
3
+ //# sourceMappingURL=index-cache.js.map
@@ -6,4 +6,5 @@ export * from './agent.js';
6
6
  export * from './repair.js';
7
7
  export * from './health-score.js';
8
8
  export * from './versioning.js';
9
+ export * from './index-cache.js';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -8,4 +8,5 @@ export * from './agent.js';
8
8
  export * from './repair.js';
9
9
  export * from './health-score.js';
10
10
  export * from './versioning.js';
11
+ export * from './index-cache.js';
11
12
  //# sourceMappingURL=index.js.map
@@ -72,6 +72,7 @@ export interface PlanuCanonicalPathPolicy {
72
72
  readonly canonicalSpecFiles: readonly string[];
73
73
  readonly canonicalSpecDirs: readonly string[];
74
74
  readonly forbiddenHostAssetRootDirs: readonly string[];
75
+ readonly runtimeHomeDir: string;
75
76
  readonly generatedRuntimePatterns: readonly string[];
76
77
  readonly legacyMergeBeforeDeleteFiles: readonly string[];
77
78
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planu/cli",
3
- "version": "5.5.3",
3
+ "version": "5.6.0",
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.5.3",
5
+ "version": "5.6.0",
6
6
  "icon": "assets/plugin/icon.svg",
7
7
  "command": ["npx", "@planu/cli@latest"],
8
8
  "packageName": "@planu/cli",
@@ -116,15 +116,31 @@ export function isCommitReachable(repoRoot, commit, ontoCommit) {
116
116
  throw new Error(`git merge-base --is-ancestor exited with status ${String(result.status)}`);
117
117
  }
118
118
 
119
- export async function writePendingReleaseLedger(pendingPath, entries) {
120
- const temporaryPath = `${pendingPath}.${process.pid}.${Date.now()}.tmp`;
119
+ async function readJsonObject(path) {
121
120
  try {
122
- await writeFile(temporaryPath, `${JSON.stringify(entries, null, 2)}\n`, {
121
+ const parsed = JSON.parse(await readFile(path, 'utf8'));
122
+ return parsed !== null && typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : {};
123
+ } catch (error) {
124
+ if (error?.code === 'ENOENT') return {};
125
+ throw error;
126
+ }
127
+ }
128
+
129
+ /**
130
+ * SPEC-1699: writes `entries` into the `releases` field of the committed
131
+ * planu/project.json, preserving every other field already on disk.
132
+ */
133
+ export async function writePendingReleaseLedger(projectJsonPath, entries) {
134
+ const project = await readJsonObject(projectJsonPath);
135
+ const nextProject = { ...project, releases: entries };
136
+ const temporaryPath = `${projectJsonPath}.${process.pid}.${Date.now()}.tmp`;
137
+ try {
138
+ await writeFile(temporaryPath, `${JSON.stringify(nextProject, null, 2)}\n`, {
123
139
  encoding: 'utf8',
124
140
  flag: 'wx',
125
141
  mode: 0o644,
126
142
  });
127
- await rename(temporaryPath, pendingPath);
143
+ await rename(temporaryPath, projectJsonPath);
128
144
  } catch (error) {
129
145
  await rm(temporaryPath, { force: true });
130
146
  throw error;