@planu/cli 8.1.1 → 8.1.2
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 +6 -0
- package/README.md +18 -6
- package/dist/sdd-engine/server.js +1 -1
- package/dist/sdd-engine/workspace-root.js +34 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [8.1.2] - 2026-09-21
|
|
2
|
+
|
|
3
|
+
- ignore unexpanded `${workspaceFolder}` and a `PLANU_WORKSPACE` equal to `$HOME` so Cursor/Windsurf interpolation stays per-project
|
|
4
|
+
- expand `~/...` in `PLANU_WORKSPACE` against `$HOME` (Cursor may interpolate `${workspaceFolder}` as a tilde path)
|
|
5
|
+
- document project MCP install for Cursor, Claude Code, Windsurf, and Codex
|
|
6
|
+
|
|
1
7
|
## [8.1.1] - 2026-09-21
|
|
2
8
|
|
|
3
9
|
- fail closed with `ERR_WORKSPACE_UNRESOLVED` when the resolved workspace is the user home directory without MCP roots or `PLANU_WORKSPACE`
|
package/README.md
CHANGED
|
@@ -25,20 +25,30 @@ Authentication is **not required**. Do not call `mcp_auth`.
|
|
|
25
25
|
|
|
26
26
|
## Installation
|
|
27
27
|
|
|
28
|
-
Paste this into Claude Code, Cursor, Codex, or any MCP client
|
|
28
|
+
Paste this into **Claude Code, Cursor, Windsurf, Codex, or any MCP client**. Prefer a **project** config (`.mcp.json` or `.cursor/mcp.json` in the repo you are editing) so the host can bind the open folder. A user-global server with no workspace interpolation will start in `$HOME` and fail closed.
|
|
29
29
|
|
|
30
30
|
```json
|
|
31
31
|
{
|
|
32
32
|
"mcpServers": {
|
|
33
33
|
"planu": {
|
|
34
34
|
"command": "npx",
|
|
35
|
-
"args": ["-y", "@planu/cli@latest"]
|
|
35
|
+
"args": ["-y", "@planu/cli@latest"],
|
|
36
|
+
"env": {
|
|
37
|
+
"PLANU_WORKSPACE": "${workspaceFolder}"
|
|
38
|
+
}
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
41
|
}
|
|
39
42
|
```
|
|
40
43
|
|
|
41
|
-
|
|
44
|
+
| Host | Where to put it | How the project is bound |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| Cursor | `.cursor/mcp.json` (project) or `~/.cursor/mcp.json` | `${workspaceFolder}` is interpolated into `PLANU_WORKSPACE` (absolute or `~/...`). Cursor user-global `cwd` is not reliable. |
|
|
47
|
+
| Claude Code | `.mcp.json` in the project, or Claude MCP settings | Process cwd is the launch directory; unexpanded `${workspaceFolder}` is ignored. |
|
|
48
|
+
| Windsurf | project MCP config (VS Code-compatible) | Use `${workspaceFolder}` the same way as Cursor. |
|
|
49
|
+
| Codex / other stdio | project MCP or the directory you launched from | Advertise MCP roots, or start the server with cwd = project. |
|
|
50
|
+
|
|
51
|
+
`npx @planu/cli` starts the MCP stdio server (`cli`, `planu`, and `sdd-engine` are the same binary). Each host restart resolves **latest** from npm.
|
|
42
52
|
|
|
43
53
|
Local development in this repo:
|
|
44
54
|
|
|
@@ -47,14 +57,16 @@ Local development in this repo:
|
|
|
47
57
|
"mcpServers": {
|
|
48
58
|
"planu": {
|
|
49
59
|
"command": "node",
|
|
50
|
-
"args": ["dist/sdd-engine/cli.js"],
|
|
51
|
-
"
|
|
60
|
+
"args": ["${workspaceFolder}/dist/sdd-engine/cli.js"],
|
|
61
|
+
"env": {
|
|
62
|
+
"PLANU_WORKSPACE": "${workspaceFolder}"
|
|
63
|
+
}
|
|
52
64
|
}
|
|
53
65
|
}
|
|
54
66
|
}
|
|
55
67
|
```
|
|
56
68
|
|
|
57
|
-
The published server asks the host for MCP roots and binds to the open project that owns `.sdd/`. If the process cwd is the user home directory
|
|
69
|
+
The published server asks the host for MCP roots and binds to the open project that owns `.sdd/`. Unexpanded `${workspaceFolder}` and a `PLANU_WORKSPACE` equal to `$HOME` are ignored. A `~/...` workspace path is expanded against `$HOME` so hosts that interpolate tildes still bind the open folder. If the process cwd is still the user home directory, project-scoped tools return `ERR_WORKSPACE_UNRESOLVED` instead of creating `.sdd` under `$HOME`. Do not set a shell-global `PLANU_WORKSPACE`. `pnpm start` runs the MCP server.
|
|
58
70
|
|
|
59
71
|
**Requirements:** Node.js >= 22.13.
|
|
60
72
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
|
-
import { dirname, join, resolve } from 'node:path';
|
|
2
|
+
import { dirname, join, resolve, sep } from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
const ERR_WORKSPACE_UNRESOLVED_MESSAGE = 'Resolved workspace is the user home directory without MCP roots or PLANU_WORKSPACE. Set the MCP server cwd to the project, advertise MCP roots, or set a per-process PLANU_WORKSPACE. Do not pin PLANU_WORKSPACE globally.';
|
|
5
5
|
export function parseMcpRootUri(uri) {
|
|
@@ -29,9 +29,9 @@ export function resolveSddWorkspace(input = {}) {
|
|
|
29
29
|
if (input.pinnedRoot?.trim()) {
|
|
30
30
|
return finish(resolve(input.pinnedRoot.trim()), 'pin');
|
|
31
31
|
}
|
|
32
|
-
const fromEnv = env
|
|
32
|
+
const fromEnv = usablePlanuWorkspaceEnv(env);
|
|
33
33
|
if (fromEnv) {
|
|
34
|
-
return finish(
|
|
34
|
+
return finish(fromEnv, 'env');
|
|
35
35
|
}
|
|
36
36
|
const mcpDirs = unique((input.mcpRootUris ?? [])
|
|
37
37
|
.map((uri) => parseMcpRootUri(uri))
|
|
@@ -96,6 +96,37 @@ function isHomeDirectory(dir, env) {
|
|
|
96
96
|
}
|
|
97
97
|
return resolve(dir) === resolve(home);
|
|
98
98
|
}
|
|
99
|
+
function usablePlanuWorkspaceEnv(env) {
|
|
100
|
+
const fromEnv = env.PLANU_WORKSPACE?.trim();
|
|
101
|
+
if (!fromEnv || fromEnv.includes('${')) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
const expanded = expandHomePrefix(fromEnv, env);
|
|
105
|
+
if (!expanded) {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
const resolved = resolve(expanded);
|
|
109
|
+
if (resolved.includes(`${sep}~${sep}`) || resolved.endsWith(`${sep}~`)) {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
if (isHomeDirectory(resolved, env)) {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
return resolved;
|
|
116
|
+
}
|
|
117
|
+
function expandHomePrefix(raw, env) {
|
|
118
|
+
if (raw === '~' || raw.startsWith('~/') || raw.startsWith('~\\')) {
|
|
119
|
+
const home = env.HOME?.trim() ?? env.USERPROFILE?.trim();
|
|
120
|
+
if (!home) {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
if (raw === '~') {
|
|
124
|
+
return home;
|
|
125
|
+
}
|
|
126
|
+
return join(home, raw.slice(2));
|
|
127
|
+
}
|
|
128
|
+
return raw;
|
|
129
|
+
}
|
|
99
130
|
function unique(values) {
|
|
100
131
|
const seen = new Set();
|
|
101
132
|
const out = [];
|