@planu/cli 8.2.14 → 8.2.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,17 @@
1
+ ## [8.2.16] - 2026-10-22
2
+
3
+ - reject a MODIFY patch unless its search text occurs exactly once
4
+ - keep reads inside the real workspace and return a capped JSON slice
5
+ - return the active-task card, name missing lock sections, and cap verification failures
6
+ - stop copying the parent process environment into the verification shell
7
+
8
+ ## [8.2.15] - 2026-10-22
9
+
10
+ - state that Planu does not upload the project, that npx contacts the npm registry, and that the source is not published
11
+ - publish the proprietary license at planu.dev/license and describe the local package in the privacy notice
12
+ - show a project .mcp.json pinned to the package version, and keep @latest for individual installs
13
+ - remove the dead github.com/planu-dev/planu link from live package metadata
14
+
1
15
  ## [8.2.14] - 2026-10-21
2
16
 
3
17
  - retain the default 180-second verification limit and nine-tool contract; allow an operator-reviewed startup-only grant for one exact task, up to 600 seconds on Darwin/Linux
package/README.md CHANGED
@@ -34,7 +34,7 @@ Claude Code users can install Planu as a plugin instead of hand-editing `.mcp.js
34
34
  /plugin install planu@planu
35
35
  ```
36
36
 
37
- This registers the same `npx -y @planu/cli@latest` server. The plugin also ships `planu-guard` hooks: while a locked feature has an unchecked task, native `Write`/`Edit` inside the workspace is denied in favor of `sdd_apply_file_patch`; `git ... --no-verify` is denied; and session start re-injects the active task. Disable them with the plugin manager.
37
+ This registers the same `npx -y @planu/cli@latest` server. `planu-dev/planu` is not a public source repository. Use a project `.mcp.json` and do not point the server at `$HOME`. The plugin also ships `planu-guard` hooks: while a locked feature has an unchecked task, native `Write`/`Edit` inside the workspace is denied in favor of `sdd_apply_file_patch`; `git ... --no-verify` is denied; and session start re-injects the active task. Disable them with the plugin manager.
38
38
 
39
39
  ### Codex plugin
40
40
 
@@ -183,8 +183,23 @@ node dist/sdd-engine/cli.js
183
183
 
184
184
  ## Reporting bugs
185
185
 
186
- Report a bug at https://planu.dev/report. The form takes a summary, details, the Planu version, the host, and an optional contact email. The engine itself sends nothing.
186
+ Report a bug at https://planu.dev/report. The form takes a summary, details, the Planu version, the host, and an optional contact email. The engine itself sends nothing. npx still contacts the npm registry. The CLI does not upload the workspace.
187
187
 
188
188
  ## License
189
189
 
190
- See the [Planu Proprietary Free-Use License](LICENSE) for the complete terms.
190
+ See the [Planu Proprietary Free-Use License](LICENSE) and [planu.dev/license](https://planu.dev/license/) for the complete terms. Individuals use `@planu/cli@latest`, which asks npm for the current release on every start. Teams pin one version in a project `.mcp.json`. The home page renders that pin from the package version.
191
+
192
+ ```json
193
+ {
194
+ "mcpServers": {
195
+ "planu": {
196
+ "command": "npx",
197
+ "args": ["-y", "@planu/cli@8.2.16"],
198
+ "cwd": ".",
199
+ "env": {
200
+ "PLANU_WORKSPACE": "."
201
+ }
202
+ }
203
+ }
204
+ }
205
+ ```
@@ -78,6 +78,6 @@ export declare const ApplyFilePatchInputSchema: z.ZodObject<{
78
78
  export declare const CompleteTaskInputSchema: z.ZodObject<{
79
79
  feature_id: z.ZodString;
80
80
  task_id: z.ZodString;
81
- verification_output: z.ZodString;
81
+ verification_output: z.ZodOptional<z.ZodString>;
82
82
  }, z.core.$strip>;
83
83
  //# sourceMappingURL=contracts.d.ts.map
@@ -61,6 +61,6 @@ export const ApplyFilePatchInputSchema = z.object({
61
61
  export const CompleteTaskInputSchema = z.object({
62
62
  feature_id: FeatureIdSchema,
63
63
  task_id: z.string().min(1),
64
- verification_output: z.string().min(1),
64
+ verification_output: z.string().min(1).optional(),
65
65
  });
66
66
  //# sourceMappingURL=contracts.js.map
@@ -1,4 +1,4 @@
1
- import type { ErrorCode, LockIntegrityResult, ParsedManifest } from '../types/sdd-engine.js';
1
+ import type { ErrorCode, FilePermission, LockIntegrityResult, ParsedManifest } from '../types/sdd-engine.js';
2
2
  export declare function hashArtifact(content: string): string;
3
3
  export declare function verifyLockedTrinity(featDir: string): Promise<LockIntegrityResult>;
4
4
  export declare function parseManifestContent(content: string): ParsedManifest;
@@ -13,5 +13,17 @@ export declare function writeLockedTrinity(featDir: string, featureId: string, r
13
13
  ok: false;
14
14
  code: ErrorCode;
15
15
  message: string;
16
+ details?: {
17
+ missing: string[];
18
+ };
16
19
  }>;
20
+ export declare function executionCard(featDir: string): Promise<{
21
+ locked: boolean;
22
+ trinity: 'ready' | 'unlocked' | 'drift';
23
+ manifest: {
24
+ path: string;
25
+ permission: FilePermission;
26
+ }[];
27
+ }>;
28
+ export declare function scopedVerificationEnvironment(): NodeJS.ProcessEnv;
17
29
  //# sourceMappingURL=lock-integrity.d.ts.map
@@ -7,12 +7,27 @@ export function hashArtifact(content) {
7
7
  return createHash('sha256').update(content).digest('hex');
8
8
  }
9
9
  function assessTrinityCompleteness(specContent, planContent, tasksContent) {
10
- const specOk = hasHeading(specContent, 'Out-of-Scope') &&
11
- hasHeading(specContent, 'Error Matrix') &&
12
- BDD_KEYWORDS.every((keyword) => keyword.test(specContent));
13
- const planOk = hasHeading(planContent, 'Frozen Dependencies') && hasHeading(planContent, 'File Manifest');
10
+ const missing = [];
11
+ if (!hasHeading(specContent, 'Out-of-Scope')) {
12
+ missing.push('out_of_scope');
13
+ }
14
+ if (!hasHeading(specContent, 'Error Matrix')) {
15
+ missing.push('error_matrix');
16
+ }
17
+ if (!BDD_KEYWORDS.every((keyword) => keyword.test(specContent))) {
18
+ missing.push('bdd');
19
+ }
20
+ if (!hasHeading(planContent, 'Frozen Dependencies')) {
21
+ missing.push('frozen_dependencies');
22
+ }
14
23
  const hasTask = tasksContent.split('\n').some((line) => CHECKBOX_TASK.test(line.trim()));
15
24
  const manifest = scanManifest(planContent);
25
+ if (!manifest.hasPath) {
26
+ missing.push('manifest_path');
27
+ }
28
+ if (!hasTask) {
29
+ missing.push('checkbox_task');
30
+ }
16
31
  if (manifest.globDelete) {
17
32
  return {
18
33
  ok: false,
@@ -27,13 +42,14 @@ function assessTrinityCompleteness(specContent, planContent, tasksContent) {
27
42
  message: `File Manifest cannot grant writes on protected root path '${manifest.protectedWrite}' (.sdd, .git, planu/specs).`,
28
43
  };
29
44
  }
30
- if (specOk && planOk && hasTask && manifest.hasPath) {
45
+ if (missing.length === 0) {
31
46
  return { ok: true };
32
47
  }
33
48
  return {
34
49
  ok: false,
35
50
  code: 'ERR_TRINITY_INCOMPLETE',
36
51
  message: 'Lock requires Out-of-Scope, Error Matrix, GIVEN/WHEN/THEN acceptance criteria, Frozen Dependencies, a File Manifest path, and at least one checkbox task.',
52
+ details: { missing },
37
53
  };
38
54
  }
39
55
  export async function verifyLockedTrinity(featDir) {
@@ -80,25 +96,30 @@ export async function verifyLockedTrinity(featDir) {
80
96
  message: 'Locked spec.md or plan.md changed after sdd_lock_spec. Re-lock is required.',
81
97
  };
82
98
  }
83
- if (lock.tasksHash) {
84
- let tasksContent;
85
- try {
86
- tasksContent = await fs.readFile(path.join(featDir, 'tasks.md'), 'utf-8');
87
- }
88
- catch {
89
- return {
90
- ok: false,
91
- code: 'ERR_SPEC_DRIFT',
92
- message: 'Locked tasks.md is missing after sdd_lock_spec. Re-lock is required.',
93
- };
94
- }
95
- if (hashArtifact(tasksContent) !== lock.tasksHash) {
96
- return {
97
- ok: false,
98
- code: 'ERR_SPEC_DRIFT',
99
- message: 'Locked tasks.md changed after sdd_lock_spec. Re-lock is required.',
100
- };
101
- }
99
+ if (!lock.tasksHash) {
100
+ return {
101
+ ok: false,
102
+ code: 'ERR_SPEC_DRIFT',
103
+ message: 'Locked tasks.md hash is missing after sdd_lock_spec. Re-lock is required.',
104
+ };
105
+ }
106
+ let tasksContent;
107
+ try {
108
+ tasksContent = await fs.readFile(path.join(featDir, 'tasks.md'), 'utf-8');
109
+ }
110
+ catch {
111
+ return {
112
+ ok: false,
113
+ code: 'ERR_SPEC_DRIFT',
114
+ message: 'Locked tasks.md is missing after sdd_lock_spec. Re-lock is required.',
115
+ };
116
+ }
117
+ if (hashArtifact(tasksContent) !== lock.tasksHash) {
118
+ return {
119
+ ok: false,
120
+ code: 'ERR_SPEC_DRIFT',
121
+ message: 'Locked tasks.md changed after sdd_lock_spec. Re-lock is required.',
122
+ };
102
123
  }
103
124
  return { ok: true };
104
125
  }
@@ -209,7 +230,12 @@ async function sealTrinityArtifacts(featDir, featureId, lockPath, lockExists, re
209
230
  }
210
231
  const completeness = assessTrinityCompleteness(specContent, planContent, tasksContent);
211
232
  if (!completeness.ok) {
212
- return { ok: false, code: completeness.code, message: completeness.message };
233
+ return {
234
+ ok: false,
235
+ code: completeness.code,
236
+ message: completeness.message,
237
+ ...(completeness.details ? { details: completeness.details } : {}),
238
+ };
213
239
  }
214
240
  let previous;
215
241
  if (lockExists) {
@@ -244,4 +270,28 @@ async function sealTrinityArtifacts(featDir, featureId, lockPath, lockExists, re
244
270
  await fs.writeFile(lockPath, JSON.stringify(lockFile, null, 2), 'utf-8');
245
271
  return { ok: true, specHash, planHash, tasksHash, relocked: relock };
246
272
  }
273
+ export async function executionCard(featDir) {
274
+ const plan = await fs.readFile(path.join(featDir, 'plan.md'), 'utf8').catch(() => '');
275
+ const entries = [...parseManifestContent(plan).allowedFiles.entries()];
276
+ const manifest = entries.map(([filePath, permission]) => ({ path: filePath, permission }));
277
+ const integrity = await verifyLockedTrinity(featDir);
278
+ if (integrity.ok) {
279
+ return { locked: true, trinity: 'ready', manifest };
280
+ }
281
+ if (integrity.code === 'ERR_SPEC_NOT_LOCKED') {
282
+ return { locked: false, trinity: 'unlocked', manifest };
283
+ }
284
+ return { locked: true, trinity: 'drift', manifest };
285
+ }
286
+ export function scopedVerificationEnvironment() {
287
+ const env = {};
288
+ const names = 'PATH,HOME,TMPDIR,TMP,TEMP,LANG,LC_ALL,LC_CTYPE,SystemRoot,ComSpec,PATHEXT';
289
+ for (const key of names.split(',')) {
290
+ const value = process.env[key];
291
+ if (value !== undefined) {
292
+ env[key] = value;
293
+ }
294
+ }
295
+ return env;
296
+ }
247
297
  //# sourceMappingURL=lock-integrity.js.map
@@ -238,19 +238,19 @@ export class PatchSandbox {
238
238
  },
239
239
  };
240
240
  }
241
- if (searchContent && !existingContent.includes(searchContent)) {
241
+ const matchCount = countOccurrences(existingContent, searchContent);
242
+ if (matchCount !== 1) {
242
243
  return {
243
244
  success: false,
244
245
  error: {
245
246
  code: 'ERR_PATCH_FAILED',
246
- message: `Exact 'search_content' block was not found in '${normalizedTarget}'.`,
247
+ message: `MODIFY search_content must occur exactly once in '${normalizedTarget}'.`,
247
248
  trigger: 'sdd_apply_file_patch',
249
+ details: { matchCount, requestedPath: normalizedTarget },
248
250
  },
249
251
  };
250
252
  }
251
- const updatedContent = searchContent
252
- ? existingContent.replace(searchContent, () => replaceContent)
253
- : replaceContent;
253
+ const updatedContent = existingContent.replace(searchContent, () => replaceContent);
254
254
  try {
255
255
  await fs.writeFile(fullPath, updatedContent, 'utf-8');
256
256
  return {
@@ -315,6 +315,22 @@ function isLegacySpecsPath(relativePath) {
315
315
  const posix = toPosixPath(relativePath);
316
316
  return posix === 'planu/specs' || posix.startsWith('planu/specs/');
317
317
  }
318
+ function countOccurrences(haystack, needle) {
319
+ if (needle.length === 0) {
320
+ return 0;
321
+ }
322
+ let count = 0;
323
+ let from = 0;
324
+ while (from <= haystack.length) {
325
+ const at = haystack.indexOf(needle, from);
326
+ if (at < 0) {
327
+ return count;
328
+ }
329
+ count += 1;
330
+ from = at + needle.length;
331
+ }
332
+ return count;
333
+ }
318
334
  function globPatternToRegExpSource(pattern) {
319
335
  let source = '';
320
336
  for (let i = 0; i < pattern.length; i++) {
@@ -3,7 +3,8 @@ import * as fs from 'node:fs/promises';
3
3
  import * as path from 'node:path';
4
4
  import { ScopedVerificationCoordinator } from './verification-runner.js';
5
5
  import { persistScopedCompletionFiles, scopedVerificationEnvironment, } from './verification-policy.js';
6
- import { hashArtifact } from './lock-integrity.js';
6
+ import { executionCard, hashArtifact } from './lock-integrity.js';
7
+ const UNLOCKED_CARD = { locked: false, trinity: 'unlocked', manifest: [] };
7
8
  export class TaskWindowManager {
8
9
  scopedPolicy;
9
10
  scoped;
@@ -64,19 +65,24 @@ export class TaskWindowManager {
64
65
  },
65
66
  };
66
67
  }
67
- return this.activeTaskFromContent(content);
68
+ const built = this.activeTaskFromContent(content);
69
+ if (!built.success) {
70
+ return built;
71
+ }
72
+ const card = await executionCard(path.dirname(tasksFilePath));
73
+ return { success: true, data: { ...built.data, ...card } };
68
74
  }
69
75
  buildActiveTaskResult(acc) {
70
76
  if (acc.totalTasks === 0) {
71
77
  return {
72
78
  success: true,
73
- data: { activeTask: null, allCompleted: false, status: 'NO_TASKS' },
79
+ data: { activeTask: null, allCompleted: false, status: 'NO_TASKS', ...UNLOCKED_CARD },
74
80
  };
75
81
  }
76
82
  if (acc.activeTaskIndex === -1 || acc.completedTasks === acc.totalTasks) {
77
83
  return {
78
84
  success: true,
79
- data: { activeTask: null, allCompleted: true, status: 'ALL_COMPLETED' },
85
+ data: { activeTask: null, allCompleted: true, status: 'ALL_COMPLETED', ...UNLOCKED_CARD },
80
86
  };
81
87
  }
82
88
  return {
@@ -86,12 +92,14 @@ export class TaskWindowManager {
86
92
  taskId: acc.activeTaskId,
87
93
  taskTitle: acc.activeTaskTitle,
88
94
  fullTaskMarkdown: acc.activeTaskLines.join('\n').trim(),
95
+ verificationCommand: verificationCommand(acc.activeTaskLines.join('\n')),
89
96
  taskIndex: acc.activeTaskIndex,
90
97
  totalTasks: acc.totalTasks,
91
98
  completedTasks: acc.completedTasks,
92
99
  },
93
100
  allCompleted: false,
94
101
  status: 'IN_PROGRESS',
102
+ ...UNLOCKED_CARD,
95
103
  },
96
104
  };
97
105
  }
@@ -176,7 +184,7 @@ export class TaskWindowManager {
176
184
  if (command === null) {
177
185
  return verificationMissing();
178
186
  }
179
- const run = await runVerification(workspaceRoot, command, this.scopedPolicy ? scopedVerificationEnvironment() : undefined);
187
+ const run = await runVerification(workspaceRoot, command, scopedVerificationEnvironment());
180
188
  if (!run.ok) {
181
189
  return verificationFailed(run);
182
190
  }
@@ -240,13 +248,14 @@ function verificationMissing() {
240
248
  };
241
249
  }
242
250
  function verificationFailed(run) {
251
+ const exitCode = run.exitCode ?? 1;
243
252
  return {
244
253
  success: false,
245
254
  error: {
246
255
  code: 'ERR_VERIFICATION_FAILED',
247
- message: run.output.trim() || `Verification command exited ${String(run.exitCode)}.`,
256
+ message: `Verification command exited ${String(exitCode)}.`,
248
257
  trigger: 'sdd_complete_task',
249
- details: { exitCode: run.exitCode },
258
+ details: { exitCode, outputTail: run.output.slice(-2000) },
250
259
  },
251
260
  };
252
261
  }
@@ -2,5 +2,16 @@ import type { VerificationPolicy } from '../../types/verification.js';
2
2
  import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
3
  import { TaskWindowManager } from '../task-window.js';
4
4
  import type { SddWorkspaceHandle } from '../../types/sdd-engine.js';
5
+ export declare function sliceNumberedSource(fileData: string, startLine: number, endLine: number): {
6
+ ok: true;
7
+ totalLines: number;
8
+ startLine: number;
9
+ endLine: number;
10
+ truncated: boolean;
11
+ text: string;
12
+ } | {
13
+ ok: false;
14
+ totalLines: number;
15
+ };
5
16
  export declare function registerExecutionTools(server: McpServer, workspace: SddWorkspaceHandle, policy?: VerificationPolicy): TaskWindowManager;
6
17
  //# sourceMappingURL=execution-tools.d.ts.map
@@ -1,11 +1,38 @@
1
- import * as fs from 'node:fs/promises';
2
1
  import * as path from 'node:path';
3
2
  import { ReadSpecArtifactInputSchema, ReadFileSliceInputSchema, GetActiveTaskInputSchema, ApplyFilePatchInputSchema, CompleteTaskInputSchema, } from '../contracts.js';
4
3
  import { PatchSandbox } from '../patch-sandbox.js';
5
4
  import { TaskWindowManager } from '../task-window.js';
6
5
  import { formatResult } from './format-result.js';
7
6
  import { verifyLockedTrinity } from '../lock-integrity.js';
8
- import { homeFallbackFailure } from '../workspace-root.js';
7
+ import { homeFallbackFailure, readTextInsideWorkspace } from '../workspace-root.js';
8
+ const SLICE_LINE_CAP = 200;
9
+ function sourceLines(fileData) {
10
+ if (fileData.length === 0) {
11
+ return [];
12
+ }
13
+ const parts = fileData.split('\n');
14
+ if (fileData.endsWith('\n')) {
15
+ parts.pop();
16
+ }
17
+ return parts;
18
+ }
19
+ export function sliceNumberedSource(fileData, startLine, endLine) {
20
+ const lines = sourceLines(fileData);
21
+ if (startLine > lines.length) {
22
+ return { ok: false, totalLines: lines.length };
23
+ }
24
+ const requestedEnd = Math.min(endLine, lines.length);
25
+ const cappedEnd = Math.min(requestedEnd, startLine + SLICE_LINE_CAP - 1);
26
+ const slice = lines.slice(startLine - 1, cappedEnd);
27
+ return {
28
+ ok: true,
29
+ totalLines: lines.length,
30
+ startLine,
31
+ endLine: cappedEnd,
32
+ truncated: cappedEnd < requestedEnd,
33
+ text: slice.map((content, index) => `${startLine + index}: ${content}`).join('\n'),
34
+ };
35
+ }
9
36
  export function registerExecutionTools(server, workspace, policy) {
10
37
  const taskWindow = new TaskWindowManager(policy);
11
38
  registerReadArtifactTool(server, workspace);
@@ -27,20 +54,20 @@ function registerReadArtifactTool(server, workspace) {
27
54
  return formatResult(homeError);
28
55
  }
29
56
  const targetPath = path.join(resolved.sddDir, 'features', args.feature_id, `${args.artifact}.md`);
30
- try {
31
- const text = await fs.readFile(targetPath, 'utf-8');
32
- return { content: [{ type: 'text', text }] };
33
- }
34
- catch {
57
+ const read = await readTextInsideWorkspace(resolved.workspaceRoot, targetPath);
58
+ if (!read.ok) {
35
59
  return formatResult({
36
60
  success: false,
37
61
  error: {
38
- code: 'ERR_INVALID_ARTIFACT',
39
- message: `Could not read '${args.artifact}.md' for feature '${args.feature_id}'.`,
62
+ code: read.reason === 'outside' ? 'ERR_PERMISSION_VIOLATION' : 'ERR_INVALID_ARTIFACT',
63
+ message: read.reason === 'outside'
64
+ ? 'Access denied outside workspace boundaries.'
65
+ : `Could not read '${args.artifact}.md' for feature '${args.feature_id}'.`,
40
66
  trigger: 'sdd_read_spec_artifact',
41
67
  },
42
68
  });
43
69
  }
70
+ return { content: [{ type: 'text', text: read.text }] };
44
71
  });
45
72
  }
46
73
  function registerReadFileSliceTool(server, workspace) {
@@ -105,51 +132,56 @@ function registerCompleteTaskTool(server, workspace, taskWindow) {
105
132
  return lockError;
106
133
  }
107
134
  const tasksPath = path.join(featDir, 'tasks.md');
108
- const result = await taskWindow.completeTask(tasksPath, args.task_id, resolved.workspaceRoot, args.verification_output, extra.signal);
135
+ const result = await taskWindow.completeTask(tasksPath, args.task_id, resolved.workspaceRoot, args.verification_output ?? '', extra.signal);
109
136
  return formatResult(result);
110
137
  });
111
138
  }
112
139
  async function executeReadFileSlice(workspaceRoot, relPath, startLine, endLine) {
113
- const targetFullPath = path.resolve(workspaceRoot, path.normalize(relPath));
114
- if (!targetFullPath.startsWith(path.resolve(workspaceRoot))) {
140
+ if (startLine > endLine || startLine < 1) {
115
141
  return formatResult({
116
142
  success: false,
117
143
  error: {
118
- code: 'ERR_PERMISSION_VIOLATION',
119
- message: 'Access denied outside workspace boundaries.',
144
+ code: 'ERR_INVALID_SLICE',
145
+ message: `Invalid line range: ${startLine} to ${endLine}.`,
120
146
  trigger: 'sdd_read_file_slice',
121
147
  },
122
148
  });
123
149
  }
124
- if (startLine > endLine || startLine < 1) {
150
+ const read = await readTextInsideWorkspace(workspaceRoot, path.resolve(workspaceRoot, path.normalize(relPath)));
151
+ if (!read.ok) {
125
152
  return formatResult({
126
153
  success: false,
127
154
  error: {
128
- code: 'ERR_INVALID_SLICE',
129
- message: `Invalid line range: ${startLine} to ${endLine}.`,
155
+ code: read.reason === 'outside' ? 'ERR_PERMISSION_VIOLATION' : 'ERR_INVALID_SLICE',
156
+ message: read.reason === 'outside'
157
+ ? 'Access denied outside workspace boundaries.'
158
+ : `Failed to read '${relPath}'.`,
130
159
  trigger: 'sdd_read_file_slice',
131
160
  },
132
161
  });
133
162
  }
134
- try {
135
- const fileData = await fs.readFile(targetFullPath, 'utf-8');
136
- const lines = fileData.split('\n');
137
- const effectiveStart = Math.min(startLine, lines.length);
138
- const effectiveEnd = Math.min(endLine, lines.length);
139
- const sliceLines = lines.slice(effectiveStart - 1, effectiveEnd);
140
- const text = sliceLines.map((content, idx) => `${effectiveStart + idx}: ${content}`).join('\n');
141
- return { content: [{ type: 'text', text }] };
142
- }
143
- catch (err) {
163
+ const sliced = sliceNumberedSource(read.text, startLine, endLine);
164
+ if (!sliced.ok) {
144
165
  return formatResult({
145
166
  success: false,
146
167
  error: {
147
168
  code: 'ERR_INVALID_SLICE',
148
- message: `Failed to read '${relPath}': ${err instanceof Error ? err.message : String(err)}`,
169
+ message: `Invalid line range: ${startLine} to ${endLine}.`,
149
170
  trigger: 'sdd_read_file_slice',
171
+ details: { totalLines: sliced.totalLines },
150
172
  },
151
173
  });
152
174
  }
175
+ return formatResult({
176
+ success: true,
177
+ data: {
178
+ totalLines: sliced.totalLines,
179
+ startLine: sliced.startLine,
180
+ endLine: sliced.endLine,
181
+ truncated: sliced.truncated,
182
+ text: sliced.text,
183
+ },
184
+ });
153
185
  }
154
186
  async function requireLockedTrinity(featDir, trigger) {
155
187
  const lockCheck = await verifyLockedTrinity(featDir);
@@ -249,7 +249,7 @@ async function collectFeatures(featuresDir, taskWindow, statusFilter) {
249
249
  try {
250
250
  const entries = await fs.readdir(featuresDir, { withFileTypes: true });
251
251
  for (const entry of entries) {
252
- if (!entry.isDirectory()) {
252
+ if (!entry.isDirectory() || !/^FEAT[-_][A-Z0-9_-]+$/u.test(entry.name)) {
253
253
  continue;
254
254
  }
255
255
  const featId = entry.name;
@@ -259,13 +259,17 @@ async function collectFeatures(featuresDir, taskWindow, statusFilter) {
259
259
  .then(() => true)
260
260
  .catch(() => false);
261
261
  let status = 'planning';
262
+ let activeTaskId = null;
263
+ const tasksPath = path.join(featPath, 'tasks.md');
264
+ const taskRes = await taskWindow.getActiveTask(tasksPath);
262
265
  if (lockExists) {
263
- const tasksPath = path.join(featPath, 'tasks.md');
264
- const taskRes = await taskWindow.getActiveTask(tasksPath);
265
266
  status = taskRes.success && taskRes.data.allCompleted ? 'done' : 'executing';
266
267
  }
268
+ if (taskRes.success) {
269
+ activeTaskId = taskRes.data.activeTask?.taskId ?? null;
270
+ }
267
271
  if (!statusFilter || statusFilter === 'all' || statusFilter === status) {
268
- result.push({ id: featId, status, locked: lockExists });
272
+ result.push({ id: featId, status, locked: lockExists, activeTaskId });
269
273
  }
270
274
  }
271
275
  }
@@ -287,7 +291,12 @@ async function executeLockSpec(featDir, featureId, relock, reason) {
287
291
  if (!outcome.ok) {
288
292
  return formatResult({
289
293
  success: false,
290
- error: { code: outcome.code, message: outcome.message, trigger: 'sdd_lock_spec' },
294
+ error: {
295
+ code: outcome.code,
296
+ message: outcome.message,
297
+ trigger: 'sdd_lock_spec',
298
+ ...(outcome.details ? { details: outcome.details } : {}),
299
+ },
291
300
  });
292
301
  }
293
302
  return formatResult({
@@ -10,7 +10,7 @@ export declare function revalidateScopedVerificationSnapshot(policy: ScopedPolic
10
10
  export declare function uncertainCompletion(): SddFailure;
11
11
  export declare function persistScopedCompletionFiles(policy: ScopedPolicy, snapshot: ScopedVerificationSnapshot, writtenTasks: string, signal: AbortSignal): Promise<SddResult<null>>;
12
12
  export declare function scopedFeaturePathFailure(policy: ScopedPolicy): Promise<SddFailure | null>;
13
- export declare function scopedVerificationEnvironment(): NodeJS.ProcessEnv;
13
+ export { scopedVerificationEnvironment } from './lock-integrity.js';
14
14
  export declare function scopedFailure(details: Record<string, unknown>): SddFailure;
15
15
  export declare function cancelledVerification(signal: AbortSignal): SddFailure | null;
16
16
  //# sourceMappingURL=verification-policy.d.ts.map
@@ -312,11 +312,7 @@ export async function scopedFeaturePathFailure(policy) {
312
312
  return snapshotFailure(true);
313
313
  }
314
314
  }
315
- export function scopedVerificationEnvironment() {
316
- const env = { ...process.env };
317
- delete env.PLANU_VERIFICATION_TIMEOUT_POLICY;
318
- return env;
319
- }
315
+ export { scopedVerificationEnvironment } from './lock-integrity.js';
320
316
  export function scopedFailure(details) {
321
317
  return {
322
318
  success: false,
@@ -4,4 +4,11 @@ export declare function resolveSddWorkspaceRoot(startDir?: string, env?: NodeJS.
4
4
  export declare function resolveSddWorkspace(input?: ResolveSddWorkspaceInput): ResolvedSddWorkspace;
5
5
  export declare function isHomeFallbackWorkspace(resolved: ResolvedSddWorkspace, env?: NodeJS.ProcessEnv): boolean;
6
6
  export declare function homeFallbackFailure(resolved: ResolvedSddWorkspace, trigger: string, env?: NodeJS.ProcessEnv): SddFailure | null;
7
+ export declare function readTextInsideWorkspace(workspaceRoot: string, absolutePath: string): Promise<{
8
+ ok: true;
9
+ text: string;
10
+ } | {
11
+ ok: false;
12
+ reason: 'outside' | 'missing';
13
+ }>;
7
14
  //# sourceMappingURL=workspace-root.d.ts.map
@@ -1,4 +1,5 @@
1
1
  import { existsSync } from 'node:fs';
2
+ import { readFile, realpath } from 'node:fs/promises';
2
3
  import { dirname, join, resolve, sep } from 'node:path';
3
4
  import { fileURLToPath } from 'node:url';
4
5
  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.';
@@ -127,6 +128,33 @@ function expandHomePrefix(raw, env) {
127
128
  }
128
129
  return raw;
129
130
  }
131
+ export async function readTextInsideWorkspace(workspaceRoot, absolutePath) {
132
+ let root;
133
+ try {
134
+ root = await realpath(workspaceRoot);
135
+ }
136
+ catch {
137
+ return { ok: false, reason: 'outside' };
138
+ }
139
+ const target = resolve(absolutePath);
140
+ const boundary = root.endsWith(sep) ? root : `${root}${sep}`;
141
+ let realTarget;
142
+ try {
143
+ realTarget = await realpath(target);
144
+ }
145
+ catch {
146
+ return { ok: false, reason: 'missing' };
147
+ }
148
+ if (realTarget !== root && !realTarget.startsWith(boundary)) {
149
+ return { ok: false, reason: 'outside' };
150
+ }
151
+ try {
152
+ return { ok: true, text: await readFile(realTarget, 'utf8') };
153
+ }
154
+ catch {
155
+ return { ok: false, reason: 'missing' };
156
+ }
157
+ }
130
158
  function unique(values) {
131
159
  const seen = new Set();
132
160
  const out = [];
@@ -53,7 +53,7 @@ export interface ApplyFilePatchInput {
53
53
  export interface CompleteTaskInput {
54
54
  feature_id: string;
55
55
  task_id: string;
56
- verification_output: string;
56
+ verification_output?: string;
57
57
  }
58
58
  export interface ParsedManifest {
59
59
  allowedFiles: Map<string, FilePermission>;
@@ -67,6 +67,7 @@ export interface ActiveTaskDetails {
67
67
  taskId: string;
68
68
  taskTitle: string;
69
69
  fullTaskMarkdown: string;
70
+ verificationCommand: string | null;
70
71
  taskIndex: number;
71
72
  totalTasks: number;
72
73
  completedTasks: number;
@@ -75,6 +76,12 @@ export interface ActiveTaskResult {
75
76
  activeTask: ActiveTaskDetails | null;
76
77
  allCompleted: boolean;
77
78
  status: 'IN_PROGRESS' | 'ALL_COMPLETED' | 'NO_TASKS';
79
+ locked: boolean;
80
+ trinity: 'ready' | 'unlocked' | 'drift';
81
+ manifest: {
82
+ path: string;
83
+ permission: FilePermission;
84
+ }[];
78
85
  }
79
86
  export interface CompleteTaskResult {
80
87
  completedTaskId: string;
@@ -94,6 +101,7 @@ export interface FeatureSummary {
94
101
  id: string;
95
102
  status: 'planning' | 'executing' | 'done';
96
103
  locked: boolean;
104
+ activeTaskId: string | null;
97
105
  }
98
106
  export interface RelockRecord {
99
107
  lockedAt: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planu/cli",
3
- "version": "8.2.14",
3
+ "version": "8.2.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",
@@ -73,12 +73,8 @@
73
73
  "access": "public"
74
74
  },
75
75
  "homepage": "https://planu.dev",
76
- "repository": {
77
- "type": "git",
78
- "url": "git+https://github.com/planu-dev/planu.git"
79
- },
80
76
  "bugs": {
81
- "url": "https://github.com/planu-dev/planu/issues"
77
+ "url": "https://planu.dev/report"
82
78
  },
83
79
  "funding": {
84
80
  "type": "individual",