@planu/cli 5.7.15 → 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,26 @@
|
|
|
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
|
+
|
|
1
24
|
## [5.7.15] - 2026-09-03
|
|
2
25
|
|
|
3
26
|
### Bug Fixes
|
package/dist/.planu-build.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"schemaVersion":1,"commit":"
|
|
1
|
+
{"schemaVersion":1,"commit":"5af535ce75c63652afeaaa128d25102e161667d3"}
|
|
@@ -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
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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();
|
package/package.json
CHANGED
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.
|
|
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
|
-
|
|
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
|
}
|