@planu/cli 5.7.14 → 5.7.16

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,35 @@
1
+ ## [5.7.16] - 2026-09-04
2
+
3
+ ### Bug Fixes
4
+ - fix(audit): give the advisories endpoint enough time before giving up
5
+ - fix(audit-security): narrow the [23] transport signature to the timeout message
6
+ - fix(audit-security): retry once and classify registry timeouts as noise
7
+ - fix(release): fail closed on empty remote main and require smoke/promotion effects (SPEC-1788)
8
+ - fix(release): mirror origin/main in the shared roll-forward sync instead of local main
9
+ - fix(release): fail closed on registry visibility and dedupe mirror-sync roll-forward (SPEC-1788)
10
+ - fix(release): roll forward and close the ledger for an already-public release (SPEC-1788)
11
+ - fix(release-ledger): preserve a pending entry's implementation commit on cascade replay (SPEC-1790)
12
+ - fix(status-store): self-heal recordStatusChange counters against spec directory count (SPEC-1789)
13
+ - fix(planu): re-restore SPEC-1786 implementation commit reverted by the SPEC-1787 rebase
14
+ - fix(cascade-hooks): verify captured HEAD commit and auto-commit on shipped reconciliation (SPEC-1787)
15
+ - fix(cascade): skip pending-release append for already-released specs (SPEC-1787)
16
+ - fix(planu): restore SPEC-1786 implementation commit overwritten by a replayed cascade
17
+ - fix(release): classify npm advisories timeout as environment noise (SPEC-1786)
18
+
19
+ ### Refactoring
20
+ - refactor(status-store): drop the spec-id comment from recordStatusChange
21
+ - refactor(cascade): extract isAlreadyShipped to satisfy the function-length lint budget (SPEC-1787)
22
+
23
+
24
+ ## [5.7.15] - 2026-09-03
25
+
26
+ ### Bug Fixes
27
+ - fix(docker): build from the Node toolchain only and drop orphaned native metadata (SPEC-1784)
28
+ - fix(validate): give the blast-radius integration pass a 600 s budget (SPEC-1782)
29
+ - fix(release): never republish an acknowledged version and accept the already-published 403 (SPEC-1782)
30
+ - fix(init-project): pin legacy npx @latest MCP entry on init (SPEC-1783)
31
+
32
+
1
33
  ## [5.7.14] - 2026-09-03
2
34
 
3
35
  ### Features
package/README.md CHANGED
@@ -4,7 +4,6 @@
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@planu/cli?color=blue&label=npm)](https://www.npmjs.com/package/@planu/cli)
6
6
  ![Node](https://img.shields.io/badge/node-%3E%3D22.13.0-green)
7
- ![Rust](https://img.shields.io/badge/core-rust-orange)
8
7
  ![License](https://img.shields.io/badge/license-proprietary-blue)
9
8
 
10
9
  **[Documentation](https://planu.dev)** · **[Español (Latinoamérica)](https://planu.dev/es)** · **[Español (España)](https://planu.dev/es-ES)** · **[Português](https://planu.dev/pt)**
@@ -13,11 +12,10 @@
13
12
 
14
13
  ## What is Planu?
15
14
 
16
- Planu is a Spec Driven Development stack for AI coding agents: an MCP server and local CLI that move work from a reviewed specification to validation evidence. Supported installations can use the bundled native Rust core for selected local hot paths.
15
+ Planu is a Spec Driven Development stack for AI coding agents: an MCP server and local CLI that move work from a reviewed specification to validation evidence.
17
16
 
18
17
  **Spec first, always.** No approved spec means no code. This eliminates vibe-coding debt at scale.
19
18
 
20
- - **Native Rust Engine** — accelerates supported project scanning, hashing, and extraction paths.
21
19
  - **Local change detection** — observes project changes without requiring a hosted configuration service.
22
20
  - **Unified Spec Format** — Requirements and technical details in a single, context-efficient `spec.md`.
23
21
  - **Atomic Integrity** — Indestructible writes and **Freeze-on-done** immutability (P0).
@@ -41,7 +39,7 @@ Add to your MCP client config (Claude Desktop: `~/Library/Application Support/Cl
41
39
  }
42
40
  ```
43
41
 
44
- **Requirements:** Node.js >= 22.13. The native Rust core is bundled and auto-detected for macOS (Intel/M1), Linux, and Windows.
42
+ **Requirements:** Node.js >= 22.13.
45
43
 
46
44
  **Upgrade safety:** stop every running Planu process before upgrading. Current releases use a single transactional SQLite lock authority with monotonic fencing; concurrent mixed-version execution is intentionally unsupported because older file-lock clients cannot participate in the same atomic protocol.
47
45
 
@@ -93,8 +91,7 @@ The external root follows the operating system's application-data convention and
93
91
 
94
92
  ```
95
93
  src/
96
- ├── engine/ # Hybrid Core: TS Business Logic + Rust Native Engine
97
- │ └── planu-core.node # High-performance native module
94
+ ├── engine/ # Business logic: estimator, analyzer, validator
98
95
  ├── tools/ # Canonical SDD MCP tools + internal workflow handlers
99
96
  ├── storage/ # Atomic persistence layer
100
97
  └── types/ # Strict TypeScript contracts
@@ -1 +1 @@
1
- {"schemaVersion":1,"commit":"d670004fb49b403f699139c7c2781e651ed0d04a"}
1
+ {"schemaVersion":1,"commit":"5af535ce75c63652afeaaa128d25102e161667d3"}
@@ -45,7 +45,7 @@
45
45
  "receiptPublicationDeadlineMs": 20000,
46
46
  "receiptCheckpointLogMaxBytes": 1048576,
47
47
  "receiptCheckpointResultMaxBytes": 4194304,
48
- "blastRadiusTimeoutMs": 300000
48
+ "blastRadiusTimeoutMs": 600000
49
49
  },
50
50
  "postCommit": {
51
51
  "defaultTaskTimeoutMs": 10000,
@@ -2,7 +2,7 @@
2
2
  // engine/autopilot/state-updater.ts — SPEC-459: Auto-update external project status on every status change
3
3
  // Fire-and-forget: never blocks the event pipeline, never throws to callers.
4
4
  // SPEC-753: File-lock applied to all writes; self-healing on corrupt reads.
5
- import { readFile } from 'node:fs/promises';
5
+ import { readFile, readdir } from 'node:fs/promises';
6
6
  import { join } from 'node:path';
7
7
  // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
8
8
  import { withStatusLock } from '../../storage/status-store/file-lock.js';
@@ -60,6 +60,54 @@ async function saveStatus(projectPath, status) {
60
60
  const filePath = getStatusPath(projectPath);
61
61
  await atomicStatusWrite(filePath, status);
62
62
  }
63
+ const SPEC_DIR_PREFIX = 'SPEC-';
64
+ async function countSpecDirectories(projectPath) {
65
+ const specsDir = join(projectPath, 'planu', 'specs');
66
+ try {
67
+ const entries = await readdir(specsDir, { withFileTypes: true });
68
+ return entries.filter((entry) => entry.isDirectory() && entry.name.startsWith(SPEC_DIR_PREFIX))
69
+ .length;
70
+ }
71
+ catch {
72
+ return undefined;
73
+ }
74
+ }
75
+ function countersAreConsistent(status, specDirCount) {
76
+ const bucketSum = Object.values(status.byStatus).reduce((a, b) => a + b, 0);
77
+ return (bucketSum === status.totalSpecs &&
78
+ (specDirCount === undefined || status.totalSpecs === specDirCount));
79
+ }
80
+ async function reconcileCounters(projectPath, incremental) {
81
+ const specDirCount = await countSpecDirectories(projectPath);
82
+ if (countersAreConsistent(incremental, specDirCount)) {
83
+ return incremental;
84
+ }
85
+ try {
86
+ const rebuilt = await rebuildStatusFromFrontmatters({ projectPath });
87
+ return {
88
+ ...incremental,
89
+ totalSpecs: rebuilt.totalSpecs,
90
+ byStatus: rebuilt.byStatus,
91
+ byType: rebuilt.byType,
92
+ version: rebuilt.version,
93
+ };
94
+ }
95
+ catch {
96
+ return incremental;
97
+ }
98
+ }
99
+ function applyIncrementalTransition(status, specId, fromStatus, toStatus) {
100
+ const byStatus = { ...status.byStatus };
101
+ if (fromStatus && byStatus[fromStatus] !== undefined) {
102
+ byStatus[fromStatus] = Math.max(0, (byStatus[fromStatus] ?? 0) - 1);
103
+ }
104
+ byStatus[toStatus] = (byStatus[toStatus] ?? 0) + 1;
105
+ const recentChanges = [
106
+ { specId, from: fromStatus, to: toStatus, at: new Date().toISOString() },
107
+ ...status.recentChanges,
108
+ ].slice(0, MAX_RECENT_CHANGES);
109
+ return { ...status, byStatus, recentChanges };
110
+ }
63
111
  /**
64
112
  * Record a spec status change and recalculate counts.
65
113
  * Called fire-and-forget from the autopilot event bus.
@@ -69,24 +117,10 @@ export async function recordStatusChange(projectPath, _projectId, specId, fromSt
69
117
  const filePath = getStatusPath(projectPath);
70
118
  try {
71
119
  await withStatusLock(filePath, async () => {
72
- const status = await loadStatus(projectPath);
73
- // Update byStatus counts
74
- if (fromStatus && status.byStatus[fromStatus] !== undefined) {
75
- status.byStatus[fromStatus] = Math.max(0, (status.byStatus[fromStatus] ?? 0) - 1);
76
- }
77
- status.byStatus[toStatus] = (status.byStatus[toStatus] ?? 0) + 1;
78
- // Add to recent changes
79
- status.recentChanges.unshift({
80
- specId,
81
- from: fromStatus,
82
- to: toStatus,
83
- at: new Date().toISOString(),
84
- });
85
- if (status.recentChanges.length > MAX_RECENT_CHANGES) {
86
- status.recentChanges = status.recentChanges.slice(0, MAX_RECENT_CHANGES);
87
- }
88
- status.updatedAt = new Date().toISOString();
89
- await saveStatus(projectPath, status);
120
+ const loaded = await loadStatus(projectPath);
121
+ const incremental = applyIncrementalTransition(loaded, specId, fromStatus, toStatus);
122
+ const reconciled = await reconcileCounters(projectPath, incremental);
123
+ await saveStatus(projectPath, { ...reconciled, updatedAt: new Date().toISOString() });
90
124
  });
91
125
  }
92
126
  catch {
@@ -68,6 +68,11 @@ export function reconcilePublishedPendingEntries(entries, release, isCommitReach
68
68
  }
69
69
  });
70
70
  }
71
+ function scheduleAutoCommit(projectPath) {
72
+ void import('../../git/planu-autocommit.js')
73
+ .then(({ planuAutoCommit }) => planuAutoCommit({ projectPath, reason: 'status-update' }))
74
+ .catch(() => undefined);
75
+ }
71
76
  async function captureHeadCommit(projectPath) {
72
77
  try {
73
78
  const { stdout } = await execFile('git', ['rev-parse', 'HEAD'], {
@@ -89,7 +94,7 @@ function extractReleasesField(parsedProject) {
89
94
  ? parsedProject.releases
90
95
  : undefined;
91
96
  }
92
- async function rewritePendingLedger(input) {
97
+ async function loadReconciledPendingList(input) {
93
98
  let pendingList = [];
94
99
  try {
95
100
  const raw = await readFile(input.projectJsonPath, 'utf-8');
@@ -101,7 +106,20 @@ async function rewritePendingLedger(input) {
101
106
  throw error instanceof Error ? error : new Error(String(error));
102
107
  }
103
108
  }
104
- pendingList = reconcilePublishedPendingEntries(pendingList, input.releaseInfo, input.isCommitReachable).filter((entry) => entry.specId !== input.specId);
109
+ return reconcilePublishedPendingEntries(pendingList, input.releaseInfo, input.isCommitReachable);
110
+ }
111
+ async function reconcileAndDropPendingLedgerEntry(input) {
112
+ const pendingList = (await loadReconciledPendingList(input)).filter((entry) => entry.specId !== input.specId);
113
+ await input.writePendingReleaseLedger(input.projectJsonPath, pendingList);
114
+ }
115
+ async function rewritePendingLedger(input) {
116
+ const reconciledList = await loadReconciledPendingList(input);
117
+ const existingEntry = reconciledList.find((entry) => entry.specId === input.specId);
118
+ if (existingEntry?.implementationCommit) {
119
+ await input.writePendingReleaseLedger(input.projectJsonPath, reconciledList);
120
+ return;
121
+ }
122
+ const pendingList = reconciledList.filter((entry) => entry.specId !== input.specId);
105
123
  pendingList.push({
106
124
  specId: input.specId,
107
125
  title: input.title,
@@ -110,6 +128,25 @@ async function rewritePendingLedger(input) {
110
128
  });
111
129
  await input.writePendingReleaseLedger(input.projectJsonPath, pendingList);
112
130
  }
131
+ function resolveDoneTransitionAt(spec) {
132
+ const history = spec?.statusHistory;
133
+ if (!history) {
134
+ return undefined;
135
+ }
136
+ for (let index = history.length - 1; index >= 0; index -= 1) {
137
+ const entry = history[index];
138
+ if (entry?.status === 'done') {
139
+ return Date.parse(entry.changedAt);
140
+ }
141
+ }
142
+ return undefined;
143
+ }
144
+ function isAlreadyShipped(spec, releaseInfo) {
145
+ const doneTransitionAt = resolveDoneTransitionAt(spec);
146
+ return (releaseInfo?.committedAt !== undefined &&
147
+ doneTransitionAt !== undefined &&
148
+ doneTransitionAt <= Date.parse(releaseInfo.committedAt));
149
+ }
113
150
  async function actuallyAppendReleasesPending(ctx, opts) {
114
151
  const { projectPath, projectId, specId } = ctx;
115
152
  if (!projectPath || ctx.newStatus !== 'done') {
@@ -137,6 +174,17 @@ async function actuallyAppendReleasesPending(ctx, opts) {
137
174
  await mkdir(planuDir, { recursive: true });
138
175
  const spec = await specStore.getSpec(projectId, specId);
139
176
  const releaseInfo = await resolveLatestReleaseTag(projectPath);
177
+ if (isAlreadyShipped(spec, releaseInfo)) {
178
+ await withPendingReleaseLock(projectJsonPath, { timeoutMs: 1_500, signal: opts.signal }, () => reconcileAndDropPendingLedgerEntry({
179
+ projectJsonPath,
180
+ specId,
181
+ releaseInfo,
182
+ isCommitReachable,
183
+ writePendingReleaseLedger,
184
+ }));
185
+ scheduleAutoCommit(projectPath);
186
+ return;
187
+ }
140
188
  const implementationCommit = await captureHeadCommit(projectPath);
141
189
  await withPendingReleaseLock(projectJsonPath, { timeoutMs: 1_500, signal: opts.signal }, () => rewritePendingLedger({
142
190
  projectJsonPath,
@@ -147,15 +195,7 @@ async function actuallyAppendReleasesPending(ctx, opts) {
147
195
  isCommitReachable,
148
196
  writePendingReleaseLedger,
149
197
  }));
150
- void (async () => {
151
- try {
152
- const { planuAutoCommit } = await import('../../git/planu-autocommit.js');
153
- await planuAutoCommit({ projectPath, reason: 'status-update' });
154
- }
155
- catch {
156
- /* best-effort */
157
- }
158
- })();
198
+ scheduleAutoCommit(projectPath);
159
199
  })()
160
200
  .then(() => {
161
201
  resolve();
@@ -17,6 +17,7 @@ export declare function isPlanuDirectlyConfigured(configPath: string, expectedVe
17
17
  * Does not overwrite unrelated keys.
18
18
  */
19
19
  export declare function injectDirectPlanuEntry(configPath: string, currentVersion: string, latestVersion: string): Promise<void>;
20
+ export declare function healLegacyLatestEntry(projectPath: string, version: string): Promise<boolean>;
20
21
  /**
21
22
  * Checks if a version gap exists and, if so, injects the direct Planu MCP entry.
22
23
  * Returns a structured result for the tool response.
@@ -5,6 +5,7 @@ import { readFile, writeFile } from 'node:fs/promises';
5
5
  import { join } from 'node:path';
6
6
  import { homedir } from 'node:os';
7
7
  import { buildPinnedEntry } from '../auto-updater/config-patcher.js';
8
+ import { detectInstallMethod } from '../auto-updater/config-detector.js';
8
9
  import { fileExistsByRead } from '../../core/shared/fs.js';
9
10
  // ---------------------------------------------------------------------------
10
11
  // Constants
@@ -95,6 +96,16 @@ export async function injectDirectPlanuEntry(configPath, currentVersion, latestV
95
96
  };
96
97
  await writeFile(configPath, JSON.stringify(updated, null, 2) + '\n', 'utf-8');
97
98
  }
99
+ export async function healLegacyLatestEntry(projectPath, version) {
100
+ const configPath = join(projectPath, '.mcp.json');
101
+ const config = await readJsonFile(configPath);
102
+ const planuEntry = config.mcpServers?.[PLANU_KEY];
103
+ if (planuEntry === undefined || detectInstallMethod(planuEntry) !== 'npx-latest') {
104
+ return false;
105
+ }
106
+ await injectDirectPlanuEntry(configPath, version, version);
107
+ return true;
108
+ }
98
109
  // ---------------------------------------------------------------------------
99
110
  // High-level orchestrator
100
111
  // ---------------------------------------------------------------------------
@@ -13,7 +13,8 @@ import { detectMissingAreas, buildRequestPrompt } from '../../engine/context-mer
13
13
  import { detectProjectPrivacyConfig, maybeGenerateEnvExample, buildBeginnerEnvGuide, } from './helpers.js';
14
14
  import { buildDefaultPrivacyConfig } from '../../engine/pii-detector.js';
15
15
  import { checkBundledVersionGap } from '../../engine/version-detector/bundled-version-checker.js';
16
- import { checkAndFixBundledVersion } from '../../engine/mcp-config/mcp-config-writer.js';
16
+ import { checkAndFixBundledVersion, healLegacyLatestEntry, } from '../../engine/mcp-config/mcp-config-writer.js';
17
+ import { planuVersion } from '../../config/version.js';
17
18
  import { buildInitProjectResult } from './result-builder.js';
18
19
  import { fetchRecommendedSkills } from '../suggest-tooling/skills-fetcher.js';
19
20
  import { autoCompleteSpecs } from '../git/auto-complete-ops.js';
@@ -223,6 +224,7 @@ export async function handleInitProject(params, server) {
223
224
  // SPEC-1699: Sweep runtime residue on every init_project run, including the
224
225
  // already-initialized early-return path below — not just the fresh-init path.
225
226
  scheduleHousekeepingSweeps(projectPath);
227
+ void healLegacyLatestEntry(projectPath, planuVersion()).catch(() => undefined);
226
228
  const authorizedMigrations = params.authorizedMigrations ?? [];
227
229
  if (isUpdate && authorizedMigrations.length === 0) {
228
230
  const reconciliation = await reconcilePortableSpecIndex(projectPath, projectId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planu/cli",
3
- "version": "5.7.14",
3
+ "version": "5.7.16",
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.14",
5
+ "version": "5.7.16",
6
6
  "icon": "assets/plugin/icon.svg",
7
7
  "command": ["npx", "@planu/cli@latest"],
8
8
  "packageName": "@planu/cli",
@@ -96,7 +96,16 @@ export async function resolveLatestReleaseTag(repoRoot) {
96
96
  maxBuffer: 16 * 1024,
97
97
  });
98
98
  const commit = stdout.trim();
99
- return commit ? { tag, commit, repoRoot } : null;
99
+ if (!commit) {
100
+ return null;
101
+ }
102
+ const { stdout: committedAtOutput } = await execFile(
103
+ 'git',
104
+ ['log', '-1', '--format=%cI', commit],
105
+ { cwd: repoRoot, timeout: 1_000, maxBuffer: 16 * 1024 },
106
+ );
107
+ const committedAt = committedAtOutput.trim();
108
+ return committedAt ? { tag, commit, repoRoot, committedAt } : null;
100
109
  } catch {
101
110
  return null;
102
111
  }