@planu/cli 8.2.16 → 8.2.17
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 +8 -0
- package/README.md +2 -2
- package/dist/sdd-engine/cli.js +0 -0
- package/dist/sdd-engine/patch-sandbox.js +5 -13
- package/dist/sdd-engine/tools/workspace-tools.js +8 -3
- package/dist/sdd-engine/workspace-init.d.ts +3 -0
- package/dist/sdd-engine/workspace-init.js +197 -0
- package/package.json +31 -34
- package/templates/skills/reconciler.md +8 -0
- package/templates/skills/spec-architect.md +22 -5
- package/templates/skills/spec-executor.md +11 -0
- package/templates/skills/verification-auditor.md +20 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [8.2.17] - 2026-10-23
|
|
2
|
+
|
|
3
|
+
- guide planning toward one observable increment, reused contracts and executable task gates that can advance from RED to GREEN
|
|
4
|
+
- preserve meaningful tests and distinguish scoped static assertion review from implementation and release acceptance
|
|
5
|
+
- regenerate the nine known mirrors when an existing real .sdd/skills directory is initialized; reject unsafe init paths and preserve feature history
|
|
6
|
+
- retain paired skill-evaluation inputs, raw transcripts, process outcomes and independent evidence-cited quality reviews, including failed attempts
|
|
7
|
+
- keep the nine MCP tools, public schemas, dependencies, protected roots, locks, task order and verification controls unchanged
|
|
8
|
+
|
|
1
9
|
## [8.2.16] - 2026-10-22
|
|
2
10
|
|
|
3
11
|
- reject a MODIFY patch unless its search text occurs exactly once
|
package/README.md
CHANGED
|
@@ -177,7 +177,7 @@ MCP:
|
|
|
177
177
|
node dist/sdd-engine/cli.js
|
|
178
178
|
```
|
|
179
179
|
|
|
180
|
-
`pnpm eval:skills`
|
|
180
|
+
`pnpm eval:skills` evaluates planning, execution and test-integrity review in synthetic workspaces through the local `claude` CLI. Existing executor cases retain locked-task, File Manifest and check enforcement. The repository guide `docs/skill-quality-evaluation.md` defines the explicit paired operator protocol: eight subjects per reviewed attempt, frozen inputs, retained success/failure evidence and a separate independent quality assessment. These provider-spending evaluations require an operator launch; they are outside `pnpm check` and CI. Structural success and a scoped review do not certify production behavior.
|
|
181
181
|
|
|
182
182
|
---
|
|
183
183
|
|
|
@@ -194,7 +194,7 @@ See the [Planu Proprietary Free-Use License](LICENSE) and [planu.dev/license](ht
|
|
|
194
194
|
"mcpServers": {
|
|
195
195
|
"planu": {
|
|
196
196
|
"command": "npx",
|
|
197
|
-
"args": ["-y", "@planu/cli@8.2.
|
|
197
|
+
"args": ["-y", "@planu/cli@8.2.17"],
|
|
198
198
|
"cwd": ".",
|
|
199
199
|
"env": {
|
|
200
200
|
"PLANU_WORKSPACE": "."
|
package/dist/sdd-engine/cli.js
CHANGED
|
File without changes
|
|
@@ -90,9 +90,9 @@ export class PatchSandbox {
|
|
|
90
90
|
const sddRoot = path.resolve(workspacePath, '.sdd');
|
|
91
91
|
const gitRoot = path.resolve(workspacePath, '.git');
|
|
92
92
|
const legacySpecsRoot = path.resolve(workspacePath, 'planu', 'specs');
|
|
93
|
-
if (
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
if (isProtectedPrefix(normalizedTarget, '.sdd') ||
|
|
94
|
+
isProtectedPrefix(normalizedTarget, '.git') ||
|
|
95
|
+
isProtectedPrefix(normalizedTarget, 'planu/specs') ||
|
|
96
96
|
this.isWithin(sddRoot, fullPath) ||
|
|
97
97
|
this.isWithin(gitRoot, fullPath) ||
|
|
98
98
|
this.isWithin(legacySpecsRoot, fullPath)) {
|
|
@@ -303,17 +303,9 @@ function globMatches(pattern, target) {
|
|
|
303
303
|
}
|
|
304
304
|
return new RegExp(`^${globPatternToRegExpSource(posixPattern)}$`).test(posixTarget);
|
|
305
305
|
}
|
|
306
|
-
function
|
|
306
|
+
function isProtectedPrefix(relativePath, root) {
|
|
307
307
|
const posix = toPosixPath(relativePath);
|
|
308
|
-
return posix ===
|
|
309
|
-
}
|
|
310
|
-
function isGitPath(relativePath) {
|
|
311
|
-
const posix = toPosixPath(relativePath);
|
|
312
|
-
return posix === '.git' || posix.startsWith('.git/');
|
|
313
|
-
}
|
|
314
|
-
function isLegacySpecsPath(relativePath) {
|
|
315
|
-
const posix = toPosixPath(relativePath);
|
|
316
|
-
return posix === 'planu/specs' || posix.startsWith('planu/specs/');
|
|
308
|
+
return posix === root || posix.startsWith(`${root}/`);
|
|
317
309
|
}
|
|
318
310
|
function countOccurrences(haystack, needle) {
|
|
319
311
|
if (needle.length === 0) {
|
|
@@ -5,6 +5,7 @@ import { InitWorkspaceInputSchema, ListFeaturesInputSchema, CreateFeatureInputSc
|
|
|
5
5
|
import { TaskWindowManager } from '../task-window.js';
|
|
6
6
|
import { formatResult } from './format-result.js';
|
|
7
7
|
import { homeFallbackFailure } from '../workspace-root.js';
|
|
8
|
+
import { prepareProjectInitialization } from '../workspace-init.js';
|
|
8
9
|
import { writeLockedTrinity } from '../lock-integrity.js';
|
|
9
10
|
import { copyGlobalRules, installCursorGuard, installHostRulePack, installHostSkillPack, } from '../host-rule-pack.js';
|
|
10
11
|
const moduleDir = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -45,7 +46,11 @@ function registerInitTool(server, workspace) {
|
|
|
45
46
|
: resolved.sddDir;
|
|
46
47
|
const featuresDir = path.join(targetBase, 'features');
|
|
47
48
|
const skillsDir = path.join(targetBase, 'skills');
|
|
49
|
+
const refreshMirrors = args.scope === 'project'
|
|
50
|
+
? await prepareProjectInitialization(resolved.workspaceRoot)
|
|
51
|
+
: undefined;
|
|
48
52
|
await fs.mkdir(featuresDir, { recursive: true });
|
|
53
|
+
await refreshMirrors?.();
|
|
49
54
|
if (args.scope === 'global') {
|
|
50
55
|
await fs.mkdir(skillsDir, { recursive: true });
|
|
51
56
|
await copySkillTemplates(skillsDir);
|
|
@@ -279,9 +284,9 @@ async function collectFeatures(featuresDir, taskWindow, statusFilter) {
|
|
|
279
284
|
return result;
|
|
280
285
|
}
|
|
281
286
|
async function writeFeatureArtifacts(featDir, id, title) {
|
|
282
|
-
const initialSpec = `# Spec: ${title}\nFeature ID: ${id}\n\n##
|
|
283
|
-
const initialPlan = `# Plan: ${title}\nFeature ID: ${id}\n\n## Frozen Dependencies\n- (Frozen dependencies: zero new packages or dependencies allowed without architectural authorization)\n\n## File Manifest\n- CREATE: \n- MODIFY: \n- READ_ONLY: \n- DELETE: \n`;
|
|
284
|
-
const initialTasks = `# Tasks: ${title}\nFeature ID: ${id}\n\n- [ ] TASK-1:
|
|
287
|
+
const initialSpec = `# Spec: ${title}\nFeature ID: ${id}\n\n## Observable Outcome\n- Select the smallest useful user outcome and explain its observable demonstration.\n\n## Acceptance Behavior\n- Replace these instructions with concrete executable acceptance scenarios for the selected outcome. This scaffold is not ready to lock.\n\n## Out-of-Scope (Mandatory)\n- Explicitly list excluded modules, dependencies, behaviors and deferred user outcomes.\n\n## Contracts & Data Models\n- Reuse existing contracts by exact source reference. Define strict types only for affected boundaries; explain when no contract changes are needed.\n\n## Error Matrix\n| Trigger | Condition | Error Code | Status / Payload |\n|---|---|---|---|\n| Describe applicable trigger | Describe condition | Reuse or define the affected error | State observable behavior |\n`;
|
|
288
|
+
const initialPlan = `# Plan: ${title}\nFeature ID: ${id}\n\n## Increment Design\n- Identify only the necessary layers and existing components for the selected outcome.\n- Justify any new abstraction or foundational step against a current requirement; describe the first usable result.\n\n## Frozen Dependencies\n- (Frozen dependencies: zero new packages or dependencies allowed without architectural authorization)\n\n## File Manifest\n- CREATE: \n- MODIFY: \n- READ_ONLY: \n- DELETE: \n`;
|
|
289
|
+
const initialTasks = `# Tasks: ${title}\nFeature ID: ${id}\n\n- [ ] TASK-1: Deliver the first useful increment with an observable demonstration\n Verification: <executable test command>\n`;
|
|
285
290
|
await fs.writeFile(path.join(featDir, 'spec.md'), initialSpec, 'utf-8');
|
|
286
291
|
await fs.writeFile(path.join(featDir, 'plan.md'), initialPlan, 'utf-8');
|
|
287
292
|
await fs.writeFile(path.join(featDir, 'tasks.md'), initialTasks, 'utf-8');
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import * as fs from 'node:fs/promises';
|
|
2
|
+
import { constants } from 'node:fs';
|
|
3
|
+
import { randomUUID } from 'node:crypto';
|
|
4
|
+
import * as path from 'node:path';
|
|
5
|
+
const SKILL_NAMES = [
|
|
6
|
+
'git-janitor',
|
|
7
|
+
'legacy-sunset',
|
|
8
|
+
'lib-sync',
|
|
9
|
+
'preflight-guardian',
|
|
10
|
+
'reconciler',
|
|
11
|
+
'spec-architect',
|
|
12
|
+
'spec-executor',
|
|
13
|
+
'verification-auditor',
|
|
14
|
+
'visual-release-auditor',
|
|
15
|
+
];
|
|
16
|
+
function missing(error) {
|
|
17
|
+
return error instanceof Error && 'code' in error && error.code === 'ENOENT';
|
|
18
|
+
}
|
|
19
|
+
function unsafe(relative, code = 'EINVAL') {
|
|
20
|
+
return Object.assign(new Error(`Unsafe initialization path: ${relative}`), { code });
|
|
21
|
+
}
|
|
22
|
+
function containedPath(root, relative) {
|
|
23
|
+
const contained = path.relative(root, path.resolve(root, relative));
|
|
24
|
+
if (!contained ||
|
|
25
|
+
contained === '..' ||
|
|
26
|
+
contained.startsWith(`..${path.sep}`) ||
|
|
27
|
+
path.isAbsolute(contained)) {
|
|
28
|
+
throw unsafe(relative);
|
|
29
|
+
}
|
|
30
|
+
return contained;
|
|
31
|
+
}
|
|
32
|
+
// Walk from a resolved trust root. Missing paths are allowed; symlinks (including
|
|
33
|
+
// dangling links), incompatible types and hardlinked write targets are not.
|
|
34
|
+
async function inspectPath(root, relative, kind, writable = true) {
|
|
35
|
+
const parts = containedPath(root, relative).split(path.sep);
|
|
36
|
+
let current = root;
|
|
37
|
+
for (const [index, part] of parts.entries()) {
|
|
38
|
+
current = path.join(current, part);
|
|
39
|
+
let stat;
|
|
40
|
+
try {
|
|
41
|
+
stat = await fs.lstat(current);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
if (missing(error)) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
if (stat.isSymbolicLink()) {
|
|
50
|
+
throw unsafe(relative, 'ELOOP');
|
|
51
|
+
}
|
|
52
|
+
const directory = index < parts.length - 1 || kind === 'directory';
|
|
53
|
+
if (directory ? !stat.isDirectory() : !stat.isFile()) {
|
|
54
|
+
throw unsafe(relative, directory ? 'ENOTDIR' : 'EINVAL');
|
|
55
|
+
}
|
|
56
|
+
if (!directory && writable && stat.nlink !== 1) {
|
|
57
|
+
throw unsafe(relative);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
async function readRegular(file) {
|
|
63
|
+
const handle = await fs.open(file, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
64
|
+
try {
|
|
65
|
+
if (!(await handle.stat()).isFile()) {
|
|
66
|
+
throw unsafe(file);
|
|
67
|
+
}
|
|
68
|
+
return await handle.readFile();
|
|
69
|
+
}
|
|
70
|
+
finally {
|
|
71
|
+
await handle.close();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
async function readTemplates() {
|
|
75
|
+
const packageRoot = await fs.realpath(path.resolve(import.meta.dirname, '../..'));
|
|
76
|
+
const source = 'templates/skills';
|
|
77
|
+
await inspectPath(packageRoot, source, 'directory', false);
|
|
78
|
+
const names = SKILL_NAMES.map((name) => `${name}.md`);
|
|
79
|
+
const found = (await fs.readdir(path.join(packageRoot, source)))
|
|
80
|
+
.filter((name) => name.endsWith('.md'))
|
|
81
|
+
.sort();
|
|
82
|
+
if (JSON.stringify(found) !== JSON.stringify(names)) {
|
|
83
|
+
throw new Error('Unexpected cognitive skill template set');
|
|
84
|
+
}
|
|
85
|
+
// Validate every source before reading any; a missing or unsafe late role
|
|
86
|
+
// cannot leave a partially regenerated mirror.
|
|
87
|
+
for (const name of names) {
|
|
88
|
+
if (!(await inspectPath(packageRoot, path.join(source, name), 'file', false))) {
|
|
89
|
+
throw new Error(`Missing cognitive skill template: ${name}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const templates = [];
|
|
93
|
+
for (const name of names) {
|
|
94
|
+
templates.push({ name, content: await readRegular(path.join(packageRoot, source, name)) });
|
|
95
|
+
}
|
|
96
|
+
for (const relative of [
|
|
97
|
+
'templates/AGENTS.md',
|
|
98
|
+
'templates/host/planu-sdd.md',
|
|
99
|
+
'templates/cursor/planu-guard.mjs',
|
|
100
|
+
'templates/cursor/hooks.json',
|
|
101
|
+
]) {
|
|
102
|
+
const exists = await inspectPath(packageRoot, relative, 'file', false);
|
|
103
|
+
if (!exists && relative !== 'templates/host/planu-sdd.md') {
|
|
104
|
+
throw new Error(`Missing initialization template: ${relative}`);
|
|
105
|
+
}
|
|
106
|
+
if (exists) {
|
|
107
|
+
await readRegular(path.join(packageRoot, relative));
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return templates;
|
|
111
|
+
}
|
|
112
|
+
function projectTargets() {
|
|
113
|
+
const targets = [
|
|
114
|
+
{ relative: '.sdd/features', kind: 'directory' },
|
|
115
|
+
{ relative: '.sdd/skills', kind: 'directory' },
|
|
116
|
+
];
|
|
117
|
+
const files = [
|
|
118
|
+
'AGENTS.md',
|
|
119
|
+
'.cursor/rules/planu-sdd.mdc',
|
|
120
|
+
'.claude/rules/planu-sdd.md',
|
|
121
|
+
'.gemini/planu-sdd.md',
|
|
122
|
+
'.cursor/hooks/planu-guard.mjs',
|
|
123
|
+
'.cursor/hooks.json',
|
|
124
|
+
];
|
|
125
|
+
for (const name of SKILL_NAMES) {
|
|
126
|
+
for (const host of ['.claude', '.cursor', '.agents']) {
|
|
127
|
+
files.push(path.join(host, 'skills', `planu-${name}`, 'SKILL.md'));
|
|
128
|
+
}
|
|
129
|
+
files.push(path.join('.gemini', 'skills', `planu-${name}.md`));
|
|
130
|
+
}
|
|
131
|
+
return [...targets, ...files.map((relative) => ({ relative, kind: 'file' }))];
|
|
132
|
+
}
|
|
133
|
+
async function removeOwnedTemporary(root, temporary) {
|
|
134
|
+
if (!(await inspectPath(root, '.sdd/skills', 'directory'))) {
|
|
135
|
+
throw unsafe('.sdd/skills');
|
|
136
|
+
}
|
|
137
|
+
await fs.unlink(temporary);
|
|
138
|
+
}
|
|
139
|
+
async function replaceMirror(root, relative, content) {
|
|
140
|
+
if (!(await inspectPath(root, '.sdd/skills', 'directory'))) {
|
|
141
|
+
throw unsafe('.sdd/skills');
|
|
142
|
+
}
|
|
143
|
+
const exists = await inspectPath(root, relative, 'file');
|
|
144
|
+
const destination = path.join(root, relative);
|
|
145
|
+
if (exists && (await readRegular(destination)).equals(content)) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const temporary = path.join(path.dirname(destination), `.planu-${randomUUID()}.tmp`);
|
|
149
|
+
let owned = false;
|
|
150
|
+
try {
|
|
151
|
+
const handle = await fs.open(temporary, 'wx', 0o644);
|
|
152
|
+
owned = true;
|
|
153
|
+
try {
|
|
154
|
+
await handle.writeFile(content);
|
|
155
|
+
await handle.sync();
|
|
156
|
+
}
|
|
157
|
+
finally {
|
|
158
|
+
await handle.close();
|
|
159
|
+
}
|
|
160
|
+
// Recheck immediately before replacement. These checks do not promise an
|
|
161
|
+
// OS sandbox against hostile same-user concurrent directory replacement.
|
|
162
|
+
if (!(await inspectPath(root, '.sdd/skills', 'directory'))) {
|
|
163
|
+
throw unsafe('.sdd/skills');
|
|
164
|
+
}
|
|
165
|
+
await inspectPath(root, relative, 'file');
|
|
166
|
+
await fs.rename(temporary, destination);
|
|
167
|
+
owned = false;
|
|
168
|
+
}
|
|
169
|
+
finally {
|
|
170
|
+
if (owned) {
|
|
171
|
+
// Only remove this invocation's exclusive temporary inside a safe parent.
|
|
172
|
+
await removeOwnedTemporary(root, temporary);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/** Validate the complete project init write set before the caller writes anything. */
|
|
177
|
+
export async function prepareProjectInitialization(workspaceRoot) {
|
|
178
|
+
const root = await fs.realpath(workspaceRoot);
|
|
179
|
+
const templates = await readTemplates();
|
|
180
|
+
for (const target of projectTargets()) {
|
|
181
|
+
await inspectPath(root, target.relative, target.kind);
|
|
182
|
+
}
|
|
183
|
+
const mirrorExists = await inspectPath(root, '.sdd/skills', 'directory');
|
|
184
|
+
if (mirrorExists) {
|
|
185
|
+
for (const template of templates) {
|
|
186
|
+
await inspectPath(root, path.join('.sdd/skills', template.name), 'file');
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return async () => {
|
|
190
|
+
if (mirrorExists) {
|
|
191
|
+
for (const template of templates) {
|
|
192
|
+
await replaceMirror(root, path.join('.sdd/skills', template.name), template.content);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=workspace-init.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planu/cli",
|
|
3
|
-
"version": "8.2.
|
|
3
|
+
"version": "8.2.17",
|
|
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",
|
|
@@ -24,38 +24,6 @@
|
|
|
24
24
|
"engines": {
|
|
25
25
|
"node": ">=22.13.0"
|
|
26
26
|
},
|
|
27
|
-
"packageManager": "pnpm@12.11.2+sha512.25a51652a196785af5f28bda6dfe8dc582ebefa4ac1d180221ce1390231c5fb76637822ea4b6e4633ce74acdcb0a77f725af11bad38177fdeddaee818a955cb9",
|
|
28
|
-
"scripts": {
|
|
29
|
-
"check:tool-registration": "bash scripts/check-tool-registration.sh",
|
|
30
|
-
"check:skill-sync": "node scripts/check-skill-sync.mjs",
|
|
31
|
-
"build": "pnpm build:ts",
|
|
32
|
-
"build:ts": "pnpm clean && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
33
|
-
"dev": "tsc --watch",
|
|
34
|
-
"start": "node dist/sdd-engine/cli.js",
|
|
35
|
-
"eval:skills": "node scripts/eval-skills.mjs",
|
|
36
|
-
"clean": "rm -rf dist",
|
|
37
|
-
"lint": "eslint src/ tests/ --max-warnings 0 --cache --cache-strategy content --cache-location node_modules/.cache/eslint/",
|
|
38
|
-
"lint:gate": "eslint src/ tests/ --max-warnings 0",
|
|
39
|
-
"lint:fix": "eslint src/ tests/ --fix --max-warnings 0",
|
|
40
|
-
"format": "prettier --write 'src/**/*.ts' 'tests/**/*.test.ts'",
|
|
41
|
-
"format:check": "prettier --check --cache --cache-strategy content 'src/**/*.ts' 'tests/**/*.test.ts'",
|
|
42
|
-
"typecheck": "tsc --noEmit --incremental --tsBuildInfoFile node_modules/.cache/planu-typecheck.tsbuildinfo",
|
|
43
|
-
"test": "vitest run --maxWorkers=6",
|
|
44
|
-
"test:watch": "vitest",
|
|
45
|
-
"test:coverage": "vitest run --coverage --testTimeout=60000 --maxWorkers=6",
|
|
46
|
-
"check": "pnpm typecheck && pnpm lint:gate && pnpm format:check && pnpm check:destructive-ops && pnpm check:tool-registration && pnpm check:skill-sync && pnpm check:sdd-core",
|
|
47
|
-
"check:sdd-core": "node scripts/check-sdd-core-closure.mjs",
|
|
48
|
-
"check:destructive-ops": "bash scripts/check-no-automatic-destructive-ops.sh",
|
|
49
|
-
"check:deps:fresh": "node scripts/check-dependency-freshness.mjs",
|
|
50
|
-
"check:strict": "pnpm check && pnpm audit:deadcode && pnpm audit:circular && pnpm audit:types",
|
|
51
|
-
"audit:deadcode": "knip",
|
|
52
|
-
"audit:circular": "madge --circular --extensions ts --ts-config tsconfig.json src/",
|
|
53
|
-
"audit:types": "type-coverage --at-least 98 --ignore-catch --strict --ignore-files 'tests/**'",
|
|
54
|
-
"prepare": "husky || true",
|
|
55
|
-
"prepack": "pnpm build:ts && pnpm package:size",
|
|
56
|
-
"validate": "pnpm build && pnpm test && pnpm check:strict",
|
|
57
|
-
"package:size": "node scripts/check-package-size.mjs"
|
|
58
|
-
},
|
|
59
27
|
"lint-staged": {
|
|
60
28
|
"src/**/*.ts": [
|
|
61
29
|
"eslint --fix --max-warnings 0 --no-warn-ignored",
|
|
@@ -130,5 +98,34 @@
|
|
|
130
98
|
"typescript-eslint": "^8.72.0",
|
|
131
99
|
"vite": "^8.3.4",
|
|
132
100
|
"vitest": "^5.0.5"
|
|
101
|
+
},
|
|
102
|
+
"scripts": {
|
|
103
|
+
"check:tool-registration": "bash scripts/check-tool-registration.sh",
|
|
104
|
+
"check:skill-sync": "node scripts/check-skill-sync.mjs",
|
|
105
|
+
"build": "pnpm build:ts",
|
|
106
|
+
"build:ts": "pnpm clean && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
107
|
+
"dev": "tsc --watch",
|
|
108
|
+
"start": "node dist/sdd-engine/cli.js",
|
|
109
|
+
"eval:skills": "node scripts/eval-skills.mjs",
|
|
110
|
+
"clean": "rm -rf dist",
|
|
111
|
+
"lint": "eslint src/ tests/ --max-warnings 0 --cache --cache-strategy content --cache-location node_modules/.cache/eslint/",
|
|
112
|
+
"lint:gate": "eslint src/ tests/ --max-warnings 0",
|
|
113
|
+
"lint:fix": "eslint src/ tests/ --fix --max-warnings 0",
|
|
114
|
+
"format": "prettier --write 'src/**/*.ts' 'tests/**/*.test.ts'",
|
|
115
|
+
"format:check": "prettier --check --cache --cache-strategy content 'src/**/*.ts' 'tests/**/*.test.ts'",
|
|
116
|
+
"typecheck": "tsc --noEmit --incremental --tsBuildInfoFile node_modules/.cache/planu-typecheck.tsbuildinfo",
|
|
117
|
+
"test": "vitest run --maxWorkers=6",
|
|
118
|
+
"test:watch": "vitest",
|
|
119
|
+
"test:coverage": "vitest run --coverage --testTimeout=60000 --maxWorkers=6",
|
|
120
|
+
"check": "pnpm typecheck && pnpm lint:gate && pnpm format:check && pnpm check:destructive-ops && pnpm check:tool-registration && pnpm check:skill-sync && pnpm check:sdd-core",
|
|
121
|
+
"check:sdd-core": "node scripts/check-sdd-core-closure.mjs",
|
|
122
|
+
"check:destructive-ops": "bash scripts/check-no-automatic-destructive-ops.sh",
|
|
123
|
+
"check:deps:fresh": "node scripts/check-dependency-freshness.mjs",
|
|
124
|
+
"check:strict": "pnpm check && pnpm audit:deadcode && pnpm audit:circular && pnpm audit:types",
|
|
125
|
+
"audit:deadcode": "knip",
|
|
126
|
+
"audit:circular": "madge --circular --extensions ts --ts-config tsconfig.json src/",
|
|
127
|
+
"audit:types": "type-coverage --at-least 98 --ignore-catch --strict --ignore-files 'tests/**'",
|
|
128
|
+
"validate": "pnpm build && pnpm test && pnpm check:strict",
|
|
129
|
+
"package:size": "node scripts/check-package-size.mjs"
|
|
133
130
|
}
|
|
134
|
-
}
|
|
131
|
+
}
|
|
@@ -25,6 +25,14 @@ Your objective is to safely adapt `plan.md` and `tasks.md` when business require
|
|
|
25
25
|
4. **Language:**
|
|
26
26
|
- ALL updates to artifacts MUST be written entirely in Technical English.
|
|
27
27
|
|
|
28
|
+
## Current increment or deferred idea
|
|
29
|
+
|
|
30
|
+
- Classify each discovery as a correction necessary for the selected user outcome or a separate future outcome. Defer independent ideas in the existing backlog/source; do not silently expand the current feature.
|
|
31
|
+
- Preserve the smallest useful increment and its observable demonstration. Reuse unchanged contracts by exact source reference; describe only affected boundaries at the depth their risk requires.
|
|
32
|
+
- A necessary foundational step must explain the first usable result it enables. A preference for another abstraction or possible future requirement is not sufficient scope.
|
|
33
|
+
- Keep every pending task concrete and verifiable before lock/relock. Do not execute partially specified future tasks or omit acceptance, Error Matrix, Frozen Dependencies or File Manifest authority.
|
|
34
|
+
- Obtain approval before a changed locked contract is resealed. Preserve completed tasks and their evidence; new information never authorizes rewriting that history.
|
|
35
|
+
|
|
28
36
|
## Traceability and obsolescence gate
|
|
29
37
|
|
|
30
38
|
Before changing an unlocked plan, produce a matrix with one row per changed requirement:
|
|
@@ -7,7 +7,7 @@ target_tools: [sdd_create_feature, sdd_read_spec_artifact, sdd_lock_spec]
|
|
|
7
7
|
# SDD SPEC ARCHITECT DIRECTIVE (HIGH REASONING)
|
|
8
8
|
|
|
9
9
|
You act as the Staff Systems Architect and Lead Spec Designer.
|
|
10
|
-
Your objective is to
|
|
10
|
+
Your objective is to specify the smallest useful increment with deterministic, unambiguous acceptance behavior before implementation.
|
|
11
11
|
|
|
12
12
|
## CORE PRINCIPLES & LAWS
|
|
13
13
|
|
|
@@ -17,7 +17,8 @@ Your objective is to produce airtight, deterministic, and unambiguous specificat
|
|
|
17
17
|
|
|
18
18
|
2. **Strict Typed Contracts (Zero Loose Types):**
|
|
19
19
|
- No `any`, dynamic untyped objects, or vague comments.
|
|
20
|
-
-
|
|
20
|
+
- Reuse existing contracts by exact source reference. Define exact native types only at affected boundaries; do not duplicate an unchanged model to fill a section.
|
|
21
|
+
- Explain when no contract change is applicable. Keep the section and the Error Matrix substantive without inventing data fields, failures, HTTP statuses, or requirements.
|
|
21
22
|
|
|
22
23
|
3. **Deterministic Error Matrix:**
|
|
23
24
|
- Never write "handle errors appropriately".
|
|
@@ -33,16 +34,32 @@ Your objective is to produce airtight, deterministic, and unambiguous specificat
|
|
|
33
34
|
- `DELETE: path/to/file-or-directory` (exact path only; no globs)
|
|
34
35
|
- CREATE, MODIFY, and READ_ONLY may use `*` (one path segment) or `**` (many segments).
|
|
35
36
|
- `sdd_lock_spec` rejects incomplete trinities. Reseal after review with `relock: true` and `reason`.
|
|
36
|
-
-
|
|
37
|
+
- _Crucial Rule:_ The MCP server rejects any file edit not declared in this manifest (`ERR_FILE_OUT_OF_MANIFEST`).
|
|
37
38
|
|
|
38
39
|
5. **Atomic Linear Tasks in `tasks.md`:**
|
|
39
|
-
- Break the
|
|
40
|
+
- Break the selected increment into small, atomic, verifiable steps that contribute to its observable outcome. Internal tasks may be technical; small tasks alone do not establish a usable increment.
|
|
41
|
+
- The server runs each task's Verification and advances only on exit 0. Plan a command that succeeds when that task's own work is complete, using the files/state available at that point in the sequence.
|
|
42
|
+
- Verification contains literal executable syntax only. Put expected results, RED explanations and other prose in the task description, never as annotations appended to the command.
|
|
43
|
+
- Normally capture RED and implement the fix within one task that ends with a GREEN completion command. Do not put a necessarily failing test command before a later implementation task: the server cannot certify it or reach the fix.
|
|
44
|
+
- If a separate RED-only task is necessary, specify a checker that proves the intended acceptance failure, rejects syntax/setup/infrastructure errors and itself exits 0. Never ignore the result, use unconditional success or weaken assertions to advance.
|
|
45
|
+
- Before lock, inspect each literal command for syntax, working directory, available paths and successful progression after prior tasks. This is planning inspection; do not execute product code during architecture.
|
|
40
46
|
- Required format:
|
|
41
47
|
```markdown
|
|
42
48
|
- [ ] TASK-1: Describe atomic work
|
|
43
|
-
|
|
49
|
+
Verification: <executable test command>
|
|
44
50
|
```
|
|
45
51
|
|
|
52
|
+
## SELECT THE INCREMENT BEFORE STRUCTURE
|
|
53
|
+
|
|
54
|
+
- Name one smallest useful user outcome and its observable demonstration. Defer independent requested outcomes explicitly; use the existing backlog or source rather than creating a second planning system.
|
|
55
|
+
- Plan only the necessary layers for that outcome. A CLI command, backend capability or worker behavior can be useful without inventing a UI.
|
|
56
|
+
- Reuse the current architecture and components. Every new abstraction, dependency or preparatory layer needs a current acceptance requirement; anticipated future flexibility is insufficient.
|
|
57
|
+
- Foundational work is allowed when necessary, but explain why it is needed for this increment and identify the first demonstrable result it enables.
|
|
58
|
+
- Scale technical detail to changed boundaries and risk. Do not enforce arbitrary document lengths, line caps, task counts, architecture patterns or separate layers for their own sake.
|
|
59
|
+
- Preserve explicit authorization, isolation, concurrency, failure and rollback requirements where relevant; proportional planning never weakens a control.
|
|
60
|
+
- Every task in the locked feature must be concrete and verifiable. Do not freeze an entire speculative backlog or execute placeholders for later work.
|
|
61
|
+
- Resolve questions from current source and the user's requirements first. Ask only when a material unknown prevents a sound contract; never invent acceptance behavior.
|
|
62
|
+
|
|
46
63
|
## WORKFLOW
|
|
47
64
|
|
|
48
65
|
1. Initialize the feature using `sdd_create_feature(id, title)` with a `FEAT-*` id.
|
|
@@ -33,6 +33,17 @@ You do not make architectural decisions, you do not add dependencies, and you do
|
|
|
33
33
|
- Repeat from step 1 until `allCompleted` is true.
|
|
34
34
|
- Then adopt `git-janitor.md`.
|
|
35
35
|
|
|
36
|
+
## Small steps and early feedback
|
|
37
|
+
|
|
38
|
+
- Tie the active task to the selected user outcome. Make the smallest change needed for its current acceptance behavior, reusing existing contracts and components; do not add layers for hypothetical future work.
|
|
39
|
+
- For a behavior change, establish a meaningful regression before the fix when feasible. Record red and green commands, exit codes and relevant output, then inspect the actual scoped diff.
|
|
40
|
+
- If red evidence is unavailable, state the concrete reason and its evidence class, and provide an alternative substantive proof. A test that would pass without the fix is not regression evidence.
|
|
41
|
+
- Pure documentation, metadata and behavior-preserving refactors do not need fabricated red failures. Preserve their applicable static or before/after regression proof instead.
|
|
42
|
+
- Inspect changed tests as well as implementation. Do not delete assertions, add skips/focus, relax expected values or thresholds, or mock away the tested boundary just to obtain green output.
|
|
43
|
+
- Legitimate test corrections and refactors are allowed when their reason is tied to acceptance behavior and equivalent or stronger coverage is demonstrated. Tests are not immutable, but a changed test needs reviewable justification.
|
|
44
|
+
- Review each incremental diff before continuing. Stop for a scope, dependency or contract change that needs reconciliation; do not add a human approval prompt for every already-authorized microchange.
|
|
45
|
+
- Keep canonical task order, File Manifest authority and server-run Verification unchanged. A local green check does not replace task certification or independent acceptance review.
|
|
46
|
+
|
|
36
47
|
## ENTRY AND EXIT GATES
|
|
37
48
|
|
|
38
49
|
- Begin only after `preflight-guardian.md` returns `READY` for the named feature and active task.
|
|
@@ -16,9 +16,17 @@ You do not implement fixes while wearing this role. Your objective is to prove o
|
|
|
16
16
|
- Never infer approval from a green happy-path test, a task checkbox, or another agent's summary.
|
|
17
17
|
- Preserve unrelated user changes and report any path outside the File Manifest.
|
|
18
18
|
|
|
19
|
+
## Match the verdict to the requested scope
|
|
20
|
+
|
|
21
|
+
- Establish the property the requester asked you to review before choosing its proof. An explicitly static-only review of assertion preservation or a supplied patch can be decided from complete before/after bytes.
|
|
22
|
+
- If that requested static property is demonstrated, emit APPROVED for that property only. State the static evidence and explicitly leave runtime behavior, implementation acceptance and release unverified.
|
|
23
|
+
- Do not demand execution, a full feature trinity or release evidence to decide a narrower static property when those are outside the requested scope. Missing runtime alone is not a blocker for a demonstrated static property.
|
|
24
|
+
- Never use this scoped verdict to certify an implementation task, feature, runtime behavior or release. Those decisions retain every required executed verification and independent release gate. Missing evidence required by the actual requested scope still blocks approval.
|
|
25
|
+
|
|
19
26
|
## Evidence classes
|
|
20
27
|
|
|
21
28
|
Classify every claim as one of:
|
|
29
|
+
|
|
22
30
|
- `executed`: observed command, exit code, and relevant output from this verification.
|
|
23
31
|
- `static`: established by source, diff, configuration, or artifact inspection only.
|
|
24
32
|
- `reported`: supplied by another agent or requester and not reproduced.
|
|
@@ -29,6 +37,7 @@ Never present reported or environment-blocked evidence as executed.
|
|
|
29
37
|
## Acceptance mapping
|
|
30
38
|
|
|
31
39
|
For every acceptance criterion, record:
|
|
40
|
+
|
|
32
41
|
1. the implementation path and observable behavior;
|
|
33
42
|
2. the substantive test or inspection that proves it;
|
|
34
43
|
3. the command and exit code when executed;
|
|
@@ -37,6 +46,16 @@ For every acceptance criterion, record:
|
|
|
37
46
|
|
|
38
47
|
Count-only assertions, existence checks, snapshots without semantics, and tests that pass before the change do not prove behavior.
|
|
39
48
|
|
|
49
|
+
## Test-integrity review
|
|
50
|
+
|
|
51
|
+
- Compare before and after test code against the actual acceptance behavior, not only the final runner status.
|
|
52
|
+
- Look for removed assertions, skipped or focused tests, relaxed expected values or thresholds, and mocks replacing the boundary under test. Require a concrete acceptance-linked reason and substantive proof for each relevant change.
|
|
53
|
+
- Tests are not immutable. A justified correction, relocation or refactor can preserve or strengthen coverage; verify that assertions and the exercised boundary remain meaningful rather than rejecting every edited test.
|
|
54
|
+
- Inspect execution evidence: command, exit code, which tests actually ran, and whether a filter or skip excluded the acceptance case. An intentionally scoped check is not a full-suite result.
|
|
55
|
+
- For changed behavior, inspect the red and green witnesses when feasible and whether reverting the fix would make the regression fail. Missing red evidence needs an explicit reason and an alternative substantive proof.
|
|
56
|
+
- Pure documentation, metadata and behavior-preserving refactors need their applicable proof, not invented failing tests. Keep executed, static, reported and environment-blocked evidence distinct.
|
|
57
|
+
- Static assertion preservation is a scoped conclusion only; it does not certify runtime behavior or a release. A green command, a valid receipt or a task checkbox is insufficient when acceptance evidence is missing.
|
|
58
|
+
|
|
40
59
|
## Mandatory final checks
|
|
41
60
|
|
|
42
61
|
- Run the exact task verification commands when safe and available.
|
|
@@ -56,6 +75,7 @@ Count-only assertions, existence checks, snapshots without semantics, and tests
|
|
|
56
75
|
## Verdict
|
|
57
76
|
|
|
58
77
|
Emit exactly one verdict:
|
|
78
|
+
|
|
59
79
|
- `APPROVED`: every criterion has substantive evidence and no required gate remains.
|
|
60
80
|
- `CHANGES_REQUESTED`: a product, contract, scope, or proof defect is actionable in the repository.
|
|
61
81
|
- `BLOCKED`: required proof depends on unavailable authority or external state.
|