@planu/cli 7.1.0 → 7.1.1
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/README.md +60 -67
- package/dist/sdd-engine/canonical-tools.d.ts +2 -0
- package/dist/sdd-engine/canonical-tools.js +12 -0
- package/dist/sdd-engine/contracts.d.ts +1 -0
- package/dist/sdd-engine/contracts.js +1 -0
- package/dist/sdd-engine/index.d.ts +2 -0
- package/dist/sdd-engine/index.js +2 -0
- package/dist/sdd-engine/lock-integrity.d.ts +3 -0
- package/dist/sdd-engine/lock-integrity.js +52 -0
- package/dist/sdd-engine/server.js +14 -5
- package/dist/sdd-engine/task-window.js +16 -0
- package/dist/sdd-engine/tools/execution-tools.js +6 -7
- package/dist/sdd-engine/tools/format-result.d.ts +1 -2
- package/dist/sdd-engine/tools/workspace-tools.js +6 -4
- package/dist/sdd-engine/workspace-root.d.ts +2 -0
- package/dist/sdd-engine/workspace-root.js +20 -0
- package/dist/types/sdd-engine.d.ts +19 -1
- package/package.json +30 -50
- package/templates/AGENTS.md +35 -0
- package/templates/en/hu.md +58 -0
- package/templates/es/hu.md +58 -0
- package/templates/postmortem.md +37 -0
- package/templates/pt/hu.md +58 -0
- package/templates/skills/git-janitor.md +21 -0
- package/templates/skills/legacy-migrator.md +29 -0
- package/templates/skills/lib-sync.md +38 -0
- package/templates/skills/reconciler.md +26 -0
- package/templates/skills/spec-architect.md +48 -0
- package/templates/skills/spec-executor.md +32 -0
- package/dist/types/common/primitives.d.ts +0 -42
- package/dist/types/common/primitives.js +0 -2
- package/scripts/check-reliability-policies.mjs +0 -504
- package/scripts/lib/portable-paths.mjs +0 -55
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Planu
|
|
2
2
|
|
|
3
|
-
**The high-performance SDD
|
|
3
|
+
**The high-performance SDD Engine for AI coding agents.**
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@planu/cli)
|
|
6
6
|

|
|
@@ -8,93 +8,90 @@
|
|
|
8
8
|
|
|
9
9
|
## What is Planu?
|
|
10
10
|
|
|
11
|
-
Planu is a
|
|
11
|
+
Planu v7 is a **thin MCP sandbox + cognitive skills** stack for Spec Driven Development. It does not restore the legacy 160-tool Node.js gate machine. Canonical design: [`PLANU_V7_MANIFESTO.txt`](PLANU_V7_MANIFESTO.txt).
|
|
12
12
|
|
|
13
|
-
**Spec first, always.** No
|
|
13
|
+
**Spec first, always.** No locked trinity means no product code.
|
|
14
14
|
|
|
15
|
-
- **
|
|
16
|
-
- **
|
|
17
|
-
- **
|
|
18
|
-
- **
|
|
19
|
-
- **
|
|
15
|
+
- **The Holy Trinity** — `.sdd/features/{FEAT-*}/[spec.md, plan.md, tasks.md]`
|
|
16
|
+
- **Zero-Freedom Execution** — mutations go through `sdd_apply_file_patch`; the File Manifest is the sandbox
|
|
17
|
+
- **Single Task Window** — `sdd_get_active_task` + `sdd_read_file_slice`
|
|
18
|
+
- **9 Canonical MCP Tools** — listed below
|
|
19
|
+
- **Cognitive gates** — `.sdd/skills/` personas replace `challenge_spec` / `check_readiness` / `validate`
|
|
20
|
+
- **Git Hygiene** — `git-janitor.md` skill (the server does not mutate Git)
|
|
21
|
+
|
|
22
|
+
Authentication is **not required**. Do not call `mcp_auth`.
|
|
20
23
|
|
|
21
24
|
---
|
|
22
25
|
|
|
23
26
|
## Installation
|
|
24
27
|
|
|
25
|
-
|
|
28
|
+
The published binary is `sdd-engine` (not a default `npx @planu/cli` no-arg process). Use:
|
|
26
29
|
|
|
27
30
|
```json
|
|
28
31
|
{
|
|
29
32
|
"mcpServers": {
|
|
30
33
|
"planu": {
|
|
31
34
|
"command": "npx",
|
|
32
|
-
"args": ["-y", "@planu/cli@latest"]
|
|
35
|
+
"args": ["-y", "-p", "@planu/cli@latest", "sdd-engine"]
|
|
33
36
|
}
|
|
34
37
|
}
|
|
35
38
|
}
|
|
36
39
|
```
|
|
37
40
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
**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.
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## The SDD Lifecycle
|
|
41
|
+
Local development in this repo:
|
|
45
42
|
|
|
46
|
-
```
|
|
47
|
-
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"mcpServers": {
|
|
46
|
+
"planu": {
|
|
47
|
+
"command": "node",
|
|
48
|
+
"args": ["dist/sdd-engine/server.js"],
|
|
49
|
+
"cwd": "/absolute/path/to/sdd-mcp-server"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
48
53
|
```
|
|
49
54
|
|
|
50
|
-
|
|
55
|
+
Set `cwd` to the project that owns `.sdd/`, or set `PLANU_WORKSPACE` to that absolute path. The server also walks up from cwd until it finds `.sdd/`. A home-directory cwd with no ancestor `.sdd` will not see repo features. `pnpm start` / `dist/index.js` does **not** start the MCP server.
|
|
51
56
|
|
|
52
|
-
|
|
53
|
-
persists the immutable version snapshot required by the SDD contract. Validation,
|
|
54
|
-
review evidence, handoff packaging, and status transitions remain explicit and auditable.
|
|
57
|
+
**Requirements:** Node.js >= 22.13.
|
|
55
58
|
|
|
56
59
|
---
|
|
57
60
|
|
|
58
|
-
##
|
|
61
|
+
## The SDD Lifecycle (v7)
|
|
59
62
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
```
|
|
63
|
-
planu/specs/SPEC-001-auth/
|
|
64
|
-
└── spec.md # Requirements, technical contract, criteria, and lifecycle status
|
|
63
|
+
```text
|
|
64
|
+
sdd_init_workspace → sdd_create_feature → architect trinity → sdd_lock_spec → execute tasks → git-janitor
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
1. **Initialize:** `sdd_init_workspace` writes `.sdd/` and copies `AGENTS.md` plus skills.
|
|
68
|
+
2. **Architect:** Adopt `spec-architect.md`. Feature ids are `FEAT-*` (`SPEC-001` is rejected).
|
|
69
|
+
3. **Lock:** `sdd_lock_spec` hashes spec/plan. Do not lock an empty skeleton (cognitive rule).
|
|
70
|
+
4. **Execute:** `sdd_get_active_task` → `sdd_apply_file_patch` → `sdd_complete_task`.
|
|
71
|
+
5. **Janitor:** prune local branches and orphaned worktrees.
|
|
72
|
+
|
|
73
|
+
### Canonical tools
|
|
68
74
|
|
|
69
|
-
|
|
70
|
-
|---|---|---|
|
|
71
|
-
| `discovery.json` | Rules, examples, open questions, scope boundaries, and glossary used before approval | Created/reviewed before `approved` |
|
|
72
|
-
| `task-plan.json` | Implementation tasks mapped to acceptance criteria | Required before `implementing` |
|
|
73
|
-
| `traceability-matrix.json` | Links every criterion to changed files and test/review evidence | Required before `done` |
|
|
74
|
-
| `contract-validation-*.json` | API, GraphQL, event, UI, or MCP contract results when applicable | Produced during validation |
|
|
75
|
-
| validation receipts and logs | Immutable result identity plus content-addressed command output | Persisted after validation |
|
|
76
|
-
| durable jobs | Local execution state, progress, cancellation, deadlines, and terminal outcome | Persisted in the runtime database across process restarts |
|
|
75
|
+
`sdd_init_workspace`, `sdd_list_features`, `sdd_create_feature`, `sdd_lock_spec`, `sdd_read_spec_artifact`, `sdd_read_file_slice`, `sdd_get_active_task`, `sdd_apply_file_patch`, `sdd_complete_task`
|
|
77
76
|
|
|
78
|
-
|
|
77
|
+
Deleted: `create_spec`, `challenge_spec`, `check_readiness`, `validate`, `planu_status`, `update_status`, `init_project`, `package_handoff`.
|
|
79
78
|
|
|
80
79
|
---
|
|
81
80
|
|
|
82
81
|
## Architecture
|
|
83
82
|
|
|
84
|
-
```
|
|
83
|
+
```text
|
|
85
84
|
src/
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
├──
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
├── specs/{spec}/spec.md # Canonical specifications
|
|
97
|
-
└── project.json # Portable logical project identity
|
|
85
|
+
└── sdd-engine/ # ultralight execution core
|
|
86
|
+
|
|
87
|
+
.sdd/ # project-local SDD storage
|
|
88
|
+
├── features/
|
|
89
|
+
│ └── FEAT-HEALTH-001/
|
|
90
|
+
│ ├── spec.md
|
|
91
|
+
│ ├── plan.md
|
|
92
|
+
│ ├── tasks.md
|
|
93
|
+
│ └── .lock
|
|
94
|
+
└── skills/ # architect, executor, janitor, reconciler, migrator
|
|
98
95
|
```
|
|
99
96
|
|
|
100
97
|
---
|
|
@@ -102,25 +99,21 @@ planu/ # Portable, version-controlled project contract
|
|
|
102
99
|
## Development
|
|
103
100
|
|
|
104
101
|
```bash
|
|
105
|
-
pnpm install
|
|
106
|
-
pnpm build
|
|
107
|
-
pnpm
|
|
108
|
-
pnpm
|
|
109
|
-
pnpm test
|
|
110
|
-
|
|
111
|
-
|
|
102
|
+
pnpm install
|
|
103
|
+
pnpm build
|
|
104
|
+
pnpm typecheck
|
|
105
|
+
pnpm lint
|
|
106
|
+
pnpm test tests/sdd-engine
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
MCP:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
node dist/sdd-engine/server.js
|
|
112
113
|
```
|
|
113
114
|
|
|
114
115
|
---
|
|
115
116
|
|
|
116
117
|
## License
|
|
117
118
|
|
|
118
|
-
Planu is proprietary, free-use software. The official unmodified package may be
|
|
119
|
-
installed and executed without payment for commercial and non-commercial work,
|
|
120
|
-
with unlimited users and instances. Internal copies needed for npm caches, CI,
|
|
121
|
-
containers, deployment, and backups are permitted. The repository and
|
|
122
|
-
TypeScript implementation sources remain private; modification, repackaging,
|
|
123
|
-
derived builds, and public redistribution are restricted. Distributed
|
|
124
|
-
JavaScript remains readable and is not represented as secret.
|
|
125
|
-
|
|
126
119
|
See the [Planu Proprietary Free-Use License](LICENSE) for the complete terms.
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const CANONICAL_SDD_TOOL_NAMES: readonly ['sdd_init_workspace', 'sdd_list_features', 'sdd_create_feature', 'sdd_lock_spec', 'sdd_read_spec_artifact', 'sdd_read_file_slice', 'sdd_get_active_task', 'sdd_apply_file_patch', 'sdd_complete_task'];
|
|
2
|
+
//# sourceMappingURL=canonical-tools.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const CANONICAL_SDD_TOOL_NAMES = [
|
|
2
|
+
'sdd_init_workspace',
|
|
3
|
+
'sdd_list_features',
|
|
4
|
+
'sdd_create_feature',
|
|
5
|
+
'sdd_lock_spec',
|
|
6
|
+
'sdd_read_spec_artifact',
|
|
7
|
+
'sdd_read_file_slice',
|
|
8
|
+
'sdd_get_active_task',
|
|
9
|
+
'sdd_apply_file_patch',
|
|
10
|
+
'sdd_complete_task',
|
|
11
|
+
];
|
|
12
|
+
//# sourceMappingURL=canonical-tools.js.map
|
|
@@ -20,6 +20,7 @@ export declare const ErrorCodeSchema: z.ZodEnum<{
|
|
|
20
20
|
ERR_PATCH_FAILED: "ERR_PATCH_FAILED";
|
|
21
21
|
ERR_PERMISSION_VIOLATION: "ERR_PERMISSION_VIOLATION";
|
|
22
22
|
ERR_SPEC_ALREADY_LOCKED: "ERR_SPEC_ALREADY_LOCKED";
|
|
23
|
+
ERR_SPEC_DRIFT: "ERR_SPEC_DRIFT";
|
|
23
24
|
ERR_SPEC_NOT_LOCKED: "ERR_SPEC_NOT_LOCKED";
|
|
24
25
|
ERR_TASK_NOT_FOUND: "ERR_TASK_NOT_FOUND";
|
|
25
26
|
ERR_TASK_OUT_OF_SEQUENCE: "ERR_TASK_OUT_OF_SEQUENCE";
|
package/dist/sdd-engine/index.js
CHANGED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import * as fs from 'node:fs/promises';
|
|
3
|
+
import * as path from 'node:path';
|
|
4
|
+
export async function verifyLockedTrinity(featDir) {
|
|
5
|
+
const lockPath = path.join(featDir, '.lock');
|
|
6
|
+
let raw;
|
|
7
|
+
try {
|
|
8
|
+
raw = await fs.readFile(lockPath, 'utf-8');
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return {
|
|
12
|
+
ok: false,
|
|
13
|
+
code: 'ERR_SPEC_NOT_LOCKED',
|
|
14
|
+
message: `Feature spec at '${featDir}' must be locked before execution.`,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
let lock;
|
|
18
|
+
try {
|
|
19
|
+
lock = JSON.parse(raw);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return {
|
|
23
|
+
ok: false,
|
|
24
|
+
code: 'ERR_SPEC_DRIFT',
|
|
25
|
+
message: `Lock file for '${featDir}' is not valid JSON.`,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
let specContent;
|
|
29
|
+
let planContent;
|
|
30
|
+
try {
|
|
31
|
+
specContent = await fs.readFile(path.join(featDir, 'spec.md'), 'utf-8');
|
|
32
|
+
planContent = await fs.readFile(path.join(featDir, 'plan.md'), 'utf-8');
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return {
|
|
36
|
+
ok: false,
|
|
37
|
+
code: 'ERR_FEATURE_NOT_FOUND',
|
|
38
|
+
message: `Failed to read locked artifacts at '${featDir}'.`,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const specHash = createHash('sha256').update(specContent).digest('hex');
|
|
42
|
+
const planHash = createHash('sha256').update(planContent).digest('hex');
|
|
43
|
+
if (specHash !== lock.specHash || planHash !== lock.planHash) {
|
|
44
|
+
return {
|
|
45
|
+
ok: false,
|
|
46
|
+
code: 'ERR_SPEC_DRIFT',
|
|
47
|
+
message: 'Locked spec.md or plan.md changed after sdd_lock_spec. Re-lock is required.',
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
return { ok: true };
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=lock-integrity.js.map
|
|
@@ -1,27 +1,36 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { resolve } from 'node:path';
|
|
2
4
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
5
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
6
|
import { registerUltralightSddTools } from './tools.js';
|
|
7
|
+
import { resolveSddWorkspaceRoot } from './workspace-root.js';
|
|
5
8
|
export function createUltralightSddServer(workspaceRoot) {
|
|
6
9
|
const server = new McpServer({
|
|
7
10
|
name: 'sdd-engine',
|
|
8
|
-
version: '
|
|
11
|
+
version: '7.1.1',
|
|
9
12
|
}, {
|
|
10
13
|
capabilities: {
|
|
11
14
|
tools: {},
|
|
12
15
|
},
|
|
13
|
-
instructions: 'SDD Engine:
|
|
16
|
+
instructions: 'SDD Engine v7: state arbiter, File Manifest sandbox, and single-task context window for Spec-Driven Development.',
|
|
14
17
|
});
|
|
15
18
|
registerUltralightSddTools(server, workspaceRoot);
|
|
16
19
|
return server;
|
|
17
20
|
}
|
|
18
21
|
export async function runServer() {
|
|
19
|
-
const server = createUltralightSddServer(
|
|
22
|
+
const server = createUltralightSddServer(resolveSddWorkspaceRoot());
|
|
20
23
|
const transport = new StdioServerTransport();
|
|
21
24
|
await server.connect(transport);
|
|
22
25
|
}
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
function isDirectInvocation() {
|
|
27
|
+
const entry = process.argv[1];
|
|
28
|
+
if (!entry) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
return resolve(entry) === fileURLToPath(import.meta.url);
|
|
32
|
+
}
|
|
33
|
+
if (isDirectInvocation()) {
|
|
25
34
|
runServer().catch((err) => {
|
|
26
35
|
process.stderr.write(`[SDD-Engine] Fatal error: ${String(err)}\n`);
|
|
27
36
|
process.exit(1);
|
|
@@ -113,6 +113,22 @@ export class TaskWindowManager {
|
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
115
|
const lines = content.split('\n');
|
|
116
|
+
const active = await this.getActiveTask(tasksFilePath);
|
|
117
|
+
if (!active.success) {
|
|
118
|
+
return active;
|
|
119
|
+
}
|
|
120
|
+
const activeId = active.data.activeTask?.taskId;
|
|
121
|
+
if (activeId?.toUpperCase() !== taskId.toUpperCase()) {
|
|
122
|
+
return {
|
|
123
|
+
success: false,
|
|
124
|
+
error: {
|
|
125
|
+
code: 'ERR_TASK_OUT_OF_SEQUENCE',
|
|
126
|
+
message: `Task '${taskId}' is not active or was already completed.`,
|
|
127
|
+
trigger: 'sdd_complete_task',
|
|
128
|
+
details: { requestedTaskId: taskId, activeTaskId: activeId ?? null },
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
}
|
|
116
132
|
const cleanOutput = verificationOutput.trim().replace(/\s+/g, ' ').slice(0, 120);
|
|
117
133
|
const regexExact = new RegExp(`^(\\s*[-*]\\s*\\[)[\\s/](\\]\\s*(?:${taskId}\\b|.*\\b${taskId}\\b.*))`, 'i');
|
|
118
134
|
let taskFound = false;
|
|
@@ -2,6 +2,7 @@ import * as fs from 'node:fs/promises';
|
|
|
2
2
|
import * as path from 'node:path';
|
|
3
3
|
import { ReadSpecArtifactInputSchema, ReadFileSliceInputSchema, GetActiveTaskInputSchema, ApplyFilePatchInputSchema, CompleteTaskInputSchema, } from '../contracts.js';
|
|
4
4
|
import { formatResult } from './format-result.js';
|
|
5
|
+
import { verifyLockedTrinity } from '../lock-integrity.js';
|
|
5
6
|
export function registerExecutionTools(server, sddDir, workspaceRoot, patchSandbox, taskWindow) {
|
|
6
7
|
registerReadArtifactTool(server, sddDir);
|
|
7
8
|
registerReadFileSliceTool(server, workspaceRoot);
|
|
@@ -116,16 +117,14 @@ async function executeReadFileSlice(workspaceRoot, relPath, startLine, endLine)
|
|
|
116
117
|
}
|
|
117
118
|
async function executeApplyPatch(sddDir, patchSandbox, args) {
|
|
118
119
|
const featDir = path.join(sddDir, 'features', args.feature_id);
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
.then(() => true)
|
|
122
|
-
.catch(() => false);
|
|
123
|
-
if (!lockExists) {
|
|
120
|
+
const lockCheck = await verifyLockedTrinity(featDir);
|
|
121
|
+
if (!lockCheck.ok) {
|
|
124
122
|
return formatResult({
|
|
125
123
|
success: false,
|
|
126
124
|
error: {
|
|
127
|
-
code: 'ERR_SPEC_NOT_LOCKED',
|
|
128
|
-
message:
|
|
125
|
+
code: lockCheck.code ?? 'ERR_SPEC_NOT_LOCKED',
|
|
126
|
+
message: lockCheck.message ??
|
|
127
|
+
`Feature spec for '${args.feature_id}' must be locked before applying patches.`,
|
|
129
128
|
trigger: 'sdd_apply_file_patch',
|
|
130
129
|
},
|
|
131
130
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { SddResult } from '../../types/sdd-engine.js';
|
|
2
|
-
import type { ToolResult } from '../../types/common/primitives.js';
|
|
1
|
+
import type { SddResult, ToolResult } from '../../types/sdd-engine.js';
|
|
3
2
|
export declare function formatResult<T>(result: SddResult<T>): ToolResult;
|
|
4
3
|
//# sourceMappingURL=format-result.d.ts.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as fs from 'node:fs/promises';
|
|
2
2
|
import * as path from 'node:path';
|
|
3
3
|
import { createHash } from 'node:crypto';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
const moduleDir = path.dirname(fileURLToPath(import.meta.url));
|
|
4
6
|
import { InitWorkspaceInputSchema, ListFeaturesInputSchema, CreateFeatureInputSchema, LockSpecInputSchema, } from '../contracts.js';
|
|
5
7
|
import { TaskWindowManager } from '../task-window.js';
|
|
6
8
|
import { formatResult } from './format-result.js';
|
|
@@ -22,7 +24,7 @@ function registerInitTool(server, sddDir, workspaceRoot) {
|
|
|
22
24
|
const skillsDir = path.join(targetBase, 'skills');
|
|
23
25
|
await fs.mkdir(featuresDir, { recursive: true });
|
|
24
26
|
await fs.mkdir(skillsDir, { recursive: true });
|
|
25
|
-
await copySkillTemplates(
|
|
27
|
+
await copySkillTemplates(skillsDir);
|
|
26
28
|
await copyGlobalRules(workspaceRoot);
|
|
27
29
|
return formatResult({
|
|
28
30
|
success: true,
|
|
@@ -85,8 +87,8 @@ function registerLockTool(server, sddDir) {
|
|
|
85
87
|
return executeLockSpec(featDir, args.feature_id);
|
|
86
88
|
});
|
|
87
89
|
}
|
|
88
|
-
async function copySkillTemplates(
|
|
89
|
-
const sourceSkillsDir = path.resolve(
|
|
90
|
+
async function copySkillTemplates(skillsDir) {
|
|
91
|
+
const sourceSkillsDir = path.resolve(moduleDir, '..', '..', '..', 'templates', 'skills');
|
|
90
92
|
try {
|
|
91
93
|
const files = await fs.readdir(sourceSkillsDir);
|
|
92
94
|
for (const file of files) {
|
|
@@ -102,7 +104,7 @@ async function copySkillTemplates(workspaceRoot, skillsDir) {
|
|
|
102
104
|
}
|
|
103
105
|
}
|
|
104
106
|
async function copyGlobalRules(workspaceRoot) {
|
|
105
|
-
const sourcePath = path.resolve(
|
|
107
|
+
const sourcePath = path.resolve(moduleDir, '..', '..', '..', 'templates', 'AGENTS.md');
|
|
106
108
|
const targetPath = path.resolve(workspaceRoot, 'AGENTS.md');
|
|
107
109
|
try {
|
|
108
110
|
const content = await fs.readFile(sourcePath, 'utf-8');
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { dirname, join, resolve } from 'node:path';
|
|
3
|
+
export function resolveSddWorkspaceRoot(startDir = process.cwd(), env = process.env) {
|
|
4
|
+
const fromEnv = env.PLANU_WORKSPACE?.trim();
|
|
5
|
+
if (fromEnv) {
|
|
6
|
+
return resolve(fromEnv);
|
|
7
|
+
}
|
|
8
|
+
let dir = resolve(startDir);
|
|
9
|
+
for (;;) {
|
|
10
|
+
if (existsSync(join(dir, '.sdd'))) {
|
|
11
|
+
return dir;
|
|
12
|
+
}
|
|
13
|
+
const parent = dirname(dir);
|
|
14
|
+
if (parent === dir) {
|
|
15
|
+
return resolve(startDir);
|
|
16
|
+
}
|
|
17
|
+
dir = parent;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=workspace-root.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type ArtifactType = 'spec' | 'plan' | 'tasks';
|
|
2
2
|
export type FilePermission = 'CREATE' | 'MODIFY' | 'READ_ONLY';
|
|
3
|
-
export type ErrorCode = 'ERR_FEATURE_NOT_FOUND' | 'ERR_FEATURE_ALREADY_EXISTS' | 'ERR_SPEC_NOT_LOCKED' | 'ERR_SPEC_ALREADY_LOCKED' | 'ERR_TASK_OUT_OF_SEQUENCE' | 'ERR_TASK_NOT_FOUND' | 'ERR_FILE_OUT_OF_MANIFEST' | 'ERR_PERMISSION_VIOLATION' | 'ERR_PATCH_FAILED' | 'ERR_INVALID_ARTIFACT' | 'ERR_INVALID_SLICE';
|
|
3
|
+
export type ErrorCode = 'ERR_FEATURE_NOT_FOUND' | 'ERR_FEATURE_ALREADY_EXISTS' | 'ERR_SPEC_NOT_LOCKED' | 'ERR_SPEC_ALREADY_LOCKED' | 'ERR_SPEC_DRIFT' | 'ERR_TASK_OUT_OF_SEQUENCE' | 'ERR_TASK_NOT_FOUND' | 'ERR_FILE_OUT_OF_MANIFEST' | 'ERR_PERMISSION_VIOLATION' | 'ERR_PATCH_FAILED' | 'ERR_INVALID_ARTIFACT' | 'ERR_INVALID_SLICE';
|
|
4
4
|
export interface SddErrorDetails {
|
|
5
5
|
code: ErrorCode;
|
|
6
6
|
message: string;
|
|
@@ -88,4 +88,22 @@ export interface FeatureSummary {
|
|
|
88
88
|
status: 'planning' | 'executing' | 'done';
|
|
89
89
|
locked: boolean;
|
|
90
90
|
}
|
|
91
|
+
export interface SddLockFile {
|
|
92
|
+
specHash?: string;
|
|
93
|
+
planHash?: string;
|
|
94
|
+
}
|
|
95
|
+
export interface LockIntegrityResult {
|
|
96
|
+
ok: boolean;
|
|
97
|
+
code?: ErrorCode;
|
|
98
|
+
message?: string;
|
|
99
|
+
}
|
|
100
|
+
export interface ToolResult {
|
|
101
|
+
[key: string]: unknown;
|
|
102
|
+
content: {
|
|
103
|
+
type: 'text';
|
|
104
|
+
text: string;
|
|
105
|
+
}[];
|
|
106
|
+
structuredContent?: Record<string, unknown>;
|
|
107
|
+
isError?: boolean;
|
|
108
|
+
}
|
|
91
109
|
//# sourceMappingURL=sdd-engine.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planu/cli",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.1",
|
|
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",
|
|
@@ -13,10 +13,8 @@
|
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"dist/",
|
|
16
|
+
"templates/",
|
|
16
17
|
"!dist/**/*.map",
|
|
17
|
-
"scripts/lib/portable-paths.mjs",
|
|
18
|
-
"src/i18n/messages/",
|
|
19
|
-
"scripts/check-reliability-policies.mjs",
|
|
20
18
|
"README.md",
|
|
21
19
|
"CHANGELOG.md",
|
|
22
20
|
"LICENSE"
|
|
@@ -24,49 +22,6 @@
|
|
|
24
22
|
"engines": {
|
|
25
23
|
"node": ">=22.13.0"
|
|
26
24
|
},
|
|
27
|
-
"packageManager": "pnpm@11.9.0+sha512.bd682d5d03fe525ef7c9fd6780c6884d1e756ac4c9c9fe00c538782824310dcf90e3ddc4f53835f06dfaebd5085e41855e0bcbb3b60de2ac5bbab89e5036f03b",
|
|
28
|
-
"scripts": {
|
|
29
|
-
"check:tool-registration": "bash scripts/check-tool-registration.sh",
|
|
30
|
-
"generate:host-tool-registry": "node scripts/generate-host-tool-registry.mjs",
|
|
31
|
-
"build": "pnpm build:ts",
|
|
32
|
-
"build:ts": "pnpm clean && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && node scripts/copy-runtime-assets.mjs",
|
|
33
|
-
"dev": "tsc --watch",
|
|
34
|
-
"start": "node dist/index.js",
|
|
35
|
-
"clean": "rm -rf dist",
|
|
36
|
-
"lint": "eslint src/ tests/ --max-warnings 0 --cache --cache-strategy content --cache-location node_modules/.cache/eslint/",
|
|
37
|
-
"lint:gate": "eslint src/ tests/ --max-warnings 0",
|
|
38
|
-
"lint:fix": "eslint src/ tests/ --fix --max-warnings 0",
|
|
39
|
-
"format": "prettier --write 'src/**/*.ts' 'tests/**/*.test.ts'",
|
|
40
|
-
"format:check": "prettier --check --cache --cache-strategy content 'src/**/*.ts' 'tests/**/*.test.ts'",
|
|
41
|
-
"typecheck": "tsc --noEmit --incremental --tsBuildInfoFile node_modules/.cache/planu-typecheck.tsbuildinfo",
|
|
42
|
-
"typecheck:compat": "tsc6 --noEmit",
|
|
43
|
-
"verify:typescript-migration": "node scripts/verify-typescript-migration.mjs",
|
|
44
|
-
"test": "vitest run --maxWorkers=6",
|
|
45
|
-
"test:watch": "vitest",
|
|
46
|
-
"test:coverage": "vitest run --coverage --testTimeout=60000 --maxWorkers=6",
|
|
47
|
-
"test:integration": "vitest run tests/integration",
|
|
48
|
-
"check": "pnpm typecheck && pnpm lint:gate && pnpm format:check && pnpm check:destructive-ops && pnpm check:tool-registration && pnpm check:sdd-core",
|
|
49
|
-
"check:sdd-core": "node scripts/check-sdd-core-closure.mjs",
|
|
50
|
-
"measure:sdd-core": "node scripts/measure-sdd-core.mjs --baseline tests/fixtures/sdd-core-baseline.json --measure-current",
|
|
51
|
-
"check:destructive-ops": "bash scripts/check-no-automatic-destructive-ops.sh",
|
|
52
|
-
"check:deps:fresh": "node scripts/check-dependency-freshness.mjs",
|
|
53
|
-
"check:website-facts": "node scripts/check-website-facts.mjs",
|
|
54
|
-
"generate:donation-qr": "node website/scripts/generate-donation-qr.mjs",
|
|
55
|
-
"check:donation-qr": "node website/scripts/generate-donation-qr.mjs --check",
|
|
56
|
-
"check:strict": "pnpm check && pnpm generate:host-tool-registry -- --check && node scripts/prune-dead-exports.mjs --check && pnpm audit:deadcode && pnpm audit:circular && pnpm audit:types",
|
|
57
|
-
"check:preflight": "pnpm check:deps:fresh && pnpm check && pnpm check:website-facts && pnpm test:contracts && pnpm measure:sdd-core && pnpm build",
|
|
58
|
-
"test:contracts": "node scripts/test-contracts.mjs",
|
|
59
|
-
"test:migrations": "vitest run tests/storage/corruption-contract.test.ts tests/integration/runtime-storage.test.ts tests/integration/canonical-storage-migration.test.ts tests/storage/sdd-core-migration.test.ts",
|
|
60
|
-
"test:fault-injection": "vitest run tests/integration/durable-job-runtime.test.ts tests/integration/idempotent-operations.test.ts tests/storage/sdd-core-migration.test.ts",
|
|
61
|
-
"audit:deadcode": "knip",
|
|
62
|
-
"audit:circular": "madge --circular --extensions ts --ts-config tsconfig.json src/",
|
|
63
|
-
"audit:types": "type-coverage --at-least 98 --ignore-catch --strict --ignore-files 'tests/**'",
|
|
64
|
-
"prepare": "husky || true",
|
|
65
|
-
"prepack": "pnpm build:ts && pnpm package:size",
|
|
66
|
-
"validate": "pnpm build && pnpm verify:typescript-migration",
|
|
67
|
-
"validate:full": "pnpm check:preflight && pnpm test:coverage",
|
|
68
|
-
"package:size": "node scripts/check-package-size.mjs"
|
|
69
|
-
},
|
|
70
25
|
"lint-staged": {
|
|
71
26
|
"src/**/*.ts": [
|
|
72
27
|
"eslint --fix --max-warnings 0 --no-warn-ignored",
|
|
@@ -115,8 +70,6 @@
|
|
|
115
70
|
"license": "SEE LICENSE IN LICENSE",
|
|
116
71
|
"dependencies": {
|
|
117
72
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
118
|
-
"glob": "^13.0.6",
|
|
119
|
-
"yaml": "2.9.1",
|
|
120
73
|
"zod": "^4.6.2"
|
|
121
74
|
},
|
|
122
75
|
"devDependencies": {
|
|
@@ -146,5 +99,32 @@
|
|
|
146
99
|
"typescript-eslint": "^8.70.0",
|
|
147
100
|
"vite": "^8.3.0",
|
|
148
101
|
"vitest": "^5.0.0"
|
|
102
|
+
},
|
|
103
|
+
"scripts": {
|
|
104
|
+
"check:tool-registration": "bash scripts/check-tool-registration.sh",
|
|
105
|
+
"build": "pnpm build:ts",
|
|
106
|
+
"build:ts": "pnpm clean && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && node scripts/copy-runtime-assets.mjs",
|
|
107
|
+
"dev": "tsc --watch",
|
|
108
|
+
"start": "node dist/sdd-engine/server.js",
|
|
109
|
+
"clean": "rm -rf dist",
|
|
110
|
+
"lint": "eslint src/ tests/ --max-warnings 0 --cache --cache-strategy content --cache-location node_modules/.cache/eslint/",
|
|
111
|
+
"lint:gate": "eslint src/ tests/ --max-warnings 0",
|
|
112
|
+
"lint:fix": "eslint src/ tests/ --fix --max-warnings 0",
|
|
113
|
+
"format": "prettier --write 'src/**/*.ts' 'tests/**/*.test.ts'",
|
|
114
|
+
"format:check": "prettier --check --cache --cache-strategy content 'src/**/*.ts' 'tests/**/*.test.ts'",
|
|
115
|
+
"typecheck": "tsc --noEmit --incremental --tsBuildInfoFile node_modules/.cache/planu-typecheck.tsbuildinfo",
|
|
116
|
+
"test": "vitest run --maxWorkers=6",
|
|
117
|
+
"test:watch": "vitest",
|
|
118
|
+
"test:coverage": "vitest run --coverage --testTimeout=60000 --maxWorkers=6",
|
|
119
|
+
"check": "pnpm typecheck && pnpm lint:gate && pnpm format:check && pnpm check:destructive-ops && pnpm check:tool-registration && pnpm check:sdd-core",
|
|
120
|
+
"check:sdd-core": "node scripts/check-sdd-core-closure.mjs",
|
|
121
|
+
"check:destructive-ops": "bash scripts/check-no-automatic-destructive-ops.sh",
|
|
122
|
+
"check:deps:fresh": "node scripts/check-dependency-freshness.mjs",
|
|
123
|
+
"check:strict": "pnpm check && pnpm audit:deadcode && pnpm audit:circular && pnpm audit:types",
|
|
124
|
+
"audit:deadcode": "knip",
|
|
125
|
+
"audit:circular": "madge --circular --extensions ts --ts-config tsconfig.json src/",
|
|
126
|
+
"audit:types": "type-coverage --at-least 98 --ignore-catch --strict --ignore-files 'tests/**'",
|
|
127
|
+
"validate": "pnpm build && pnpm test && pnpm check:strict",
|
|
128
|
+
"package:size": "node scripts/check-package-size.mjs"
|
|
149
129
|
}
|
|
150
|
-
}
|
|
130
|
+
}
|