@planu/cli 8.3.0 → 8.5.0

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +86 -2
  3. package/dist/sdd-engine/contracts.d.ts +13 -3
  4. package/dist/sdd-engine/contracts.js +48 -10
  5. package/dist/sdd-engine/feature-manifest.d.ts +2 -5
  6. package/dist/sdd-engine/feature-manifest.js +109 -184
  7. package/dist/sdd-engine/host-rule-pack.d.ts +5 -0
  8. package/dist/sdd-engine/host-rule-pack.js +106 -43
  9. package/dist/sdd-engine/host-skill-reader.d.ts +6 -0
  10. package/dist/sdd-engine/host-skill-reader.js +187 -0
  11. package/dist/sdd-engine/lock-integrity.d.ts +1 -0
  12. package/dist/sdd-engine/lock-integrity.js +25 -17
  13. package/dist/sdd-engine/receipt-assessment.d.ts +12 -0
  14. package/dist/sdd-engine/receipt-assessment.js +223 -0
  15. package/dist/sdd-engine/resume-history.d.ts +6 -0
  16. package/dist/sdd-engine/resume-history.js +117 -0
  17. package/dist/sdd-engine/resume-views.d.ts +9 -0
  18. package/dist/sdd-engine/resume-views.js +149 -0
  19. package/dist/sdd-engine/server.js +2 -4
  20. package/dist/sdd-engine/task-content.d.ts +18 -0
  21. package/dist/sdd-engine/task-content.js +36 -1
  22. package/dist/sdd-engine/task-window.d.ts +1 -0
  23. package/dist/sdd-engine/task-window.js +8 -1
  24. package/dist/sdd-engine/tools/compact-result.d.ts +6 -0
  25. package/dist/sdd-engine/tools/compact-result.js +66 -0
  26. package/dist/sdd-engine/tools/execution-tools.d.ts +1 -11
  27. package/dist/sdd-engine/tools/execution-tools.js +14 -32
  28. package/dist/sdd-engine/tools/workspace-tools.d.ts +1 -1
  29. package/dist/sdd-engine/tools/workspace-tools.js +17 -9
  30. package/dist/sdd-engine/tools.d.ts +2 -1
  31. package/dist/sdd-engine/tools.js +4 -2
  32. package/dist/sdd-engine/trinity-structure.d.ts +25 -0
  33. package/dist/sdd-engine/trinity-structure.js +317 -0
  34. package/dist/sdd-engine/verification-preflight.d.ts +11 -0
  35. package/dist/sdd-engine/verification-preflight.js +275 -0
  36. package/dist/sdd-engine/verification-receipts.d.ts +2 -10
  37. package/dist/sdd-engine/verification-receipts.js +2 -169
  38. package/dist/sdd-engine/workspace-root.d.ts +1 -0
  39. package/dist/sdd-engine/workspace-root.js +1 -0
  40. package/dist/types/completion.d.ts +9 -2
  41. package/dist/types/resume-views.d.ts +55 -0
  42. package/dist/types/resume-views.js +2 -0
  43. package/dist/types/sdd-engine.d.ts +78 -0
  44. package/package.json +1 -1
  45. package/templates/AGENTS.md +12 -0
  46. package/templates/host/planu-sdd.md +12 -0
@@ -51,6 +51,29 @@ export interface TaskBlock {
51
51
  lineIndex: number;
52
52
  lines: string[];
53
53
  }
54
+ export type TrinityRule = 'out_of_scope' | 'error_matrix' | 'bdd' | 'frozen_dependencies' | 'manifest_path' | 'checkbox_task' | 'glob_delete' | 'protected_write' | 'receipt_policy_invalid' | 'artifact_missing' | 'artifact_unreadable';
55
+ export interface TrinityIssue {
56
+ artifact: 'spec.md' | 'plan.md' | 'tasks.md';
57
+ rule: TrinityRule;
58
+ line?: number;
59
+ }
60
+ export interface ManifestEntry {
61
+ rawPath: string;
62
+ permission: FilePermission;
63
+ line: number;
64
+ }
65
+ export interface PolicySourceFrame {
66
+ path: string;
67
+ root: boolean;
68
+ kind: 'object' | 'array';
69
+ indent: number;
70
+ nextArrayIndex: number;
71
+ }
72
+ export interface ReceiptPolicyText {
73
+ locations?: ReadonlyMap<string, number>;
74
+ text: string | null | undefined;
75
+ line?: number;
76
+ }
54
77
  export interface ReceiptSealFailure {
55
78
  ok: false;
56
79
  code: 'ERR_TRINITY_INCOMPLETE';
@@ -58,6 +81,7 @@ export interface ReceiptSealFailure {
58
81
  details: {
59
82
  reason: 'receipt_policy_invalid';
60
83
  taskId?: string;
84
+ issues: TrinityIssue[];
61
85
  };
62
86
  }
63
87
  export type VerificationReceipt = Omit<VerificationEvidence, 'gates'> & {
@@ -83,6 +107,30 @@ export type ReceiptSetResult = {
83
107
  reason: ReceiptRejectionReason;
84
108
  gateId?: string;
85
109
  };
110
+ export interface GateAssessment {
111
+ gateId: string;
112
+ state: 'receipt_valid' | 'receipt_missing' | 'receipt_rejected';
113
+ reason?: ReceiptRejectionReason;
114
+ }
115
+ export type PreflightBlockerReason = ReceiptRejectionReason | 'unlocked' | 'command_missing' | 'platform_unsupported' | 'receipt_input_unavailable' | 'receipt_observed_baseline_drift' | 'receipt_scoped_unsupported' | 'receipt_not_configured';
116
+ interface PreflightBlocker {
117
+ reason: PreflightBlockerReason;
118
+ }
119
+ export type PreflightAction = 'fix_inputs' | 'review_observed_drift' | 'obtain_receipts' | 'use_supported_runtime' | 'review_lock' | 'restore_verification' | 'attempt_integration' | 'none';
120
+ export interface VerificationPreflight {
121
+ version: 1;
122
+ taskId: string | null;
123
+ status: 'blocked' | 'ready_to_attempt' | 'not_applicable';
124
+ gates: GateAssessment[];
125
+ blockers: PreflightBlocker[];
126
+ integration: 'not_run';
127
+ nextAction: PreflightAction;
128
+ }
129
+ export interface ReceiptSetAssessment {
130
+ result: ReceiptSetResult;
131
+ gates: GateAssessment[];
132
+ blockers: PreflightBlocker[];
133
+ }
86
134
  export interface ReceiptTaskPolicy {
87
135
  taskId: string;
88
136
  gates: readonly VerificationGate[];
@@ -101,6 +149,7 @@ export type ReceiptPolicyResult = {
101
149
  } | {
102
150
  status: 'invalid';
103
151
  taskId?: string;
152
+ issue?: TrinityIssue;
104
153
  } | {
105
154
  status: 'ready';
106
155
  publicKey: KeyObject;
@@ -150,8 +199,15 @@ export interface ReadFileSliceInput {
150
199
  start_line: number;
151
200
  end_line: number;
152
201
  }
202
+ export interface RelockHistoryCursor {
203
+ snapshotSha256: string;
204
+ startIndex: number;
205
+ }
153
206
  export interface GetActiveTaskInput {
154
207
  feature_id: string;
208
+ view?: 'verification_preflight' | 'resume' | 'relock_history';
209
+ history_cursor?: RelockHistoryCursor;
210
+ verification_receipts?: Record<string, unknown>[];
155
211
  }
156
212
  export interface ApplyFilePatchInput {
157
213
  feature_id: string;
@@ -208,6 +264,7 @@ export interface ActiveTaskResult {
208
264
  permission: FilePermission;
209
265
  }[];
210
266
  verificationEvidence?: VerificationEvidence;
267
+ verificationPreflight?: VerificationPreflight;
211
268
  }
212
269
  export interface CompleteTaskResult {
213
270
  completedTaskId: string;
@@ -278,5 +335,26 @@ export interface ResolveSddWorkspaceInput {
278
335
  export interface SddWorkspaceHandle {
279
336
  resolve(): Promise<ResolvedSddWorkspace>;
280
337
  }
338
+ export type HostSkillReadCause = 'not_found' | 'access_denied' | 'unsafe_path' | 'invalid_content' | 'over_limit' | 'unstable' | 'read_failed';
339
+ export interface HostSkillIssue {
340
+ path: string;
341
+ status: 'missing' | 'different' | 'unreadable';
342
+ cause: HostSkillReadCause | 'content_mismatch';
343
+ }
344
+ export interface HostSkillDiagnostics {
345
+ version: 1;
346
+ bundledVersion: string;
347
+ baseline: 'available' | 'unavailable';
348
+ catalog: 'unverified';
349
+ issues: HostSkillIssue[];
350
+ nextAction: 'none' | 'review_project_setup' | 'inspect_unsafe_paths' | 'inspect_installation';
351
+ }
352
+ export type HostSkillReadResult = {
353
+ ok: true;
354
+ text: string;
355
+ } | {
356
+ ok: false;
357
+ cause: HostSkillReadCause;
358
+ };
281
359
  export {};
282
360
  //# sourceMappingURL=sdd-engine.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planu/cli",
3
- "version": "8.3.0",
3
+ "version": "8.5.0",
4
4
  "description": "Planu — MCP server for Spec Driven Development. Planning and file operations on macOS/Linux/Windows; automated verification requires macOS/Linux (POSIX).",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -7,6 +7,18 @@ Canonical contract: `PLANU_V8_MANIFESTO.txt`.
7
7
 
8
8
  After the local client has registered the MCP server and the intended project is open, use `sdd_list_features` to inspect setup. A setup request authorizes `sdd_init_workspace(scope="project")` in that identified project; connecting or inspecting alone does not. Use the default `force=false` to preserve an existing current AGENTS.md. Read `.agents/skills/planu-preflight-guardian/SKILL.md` and the matching role immediately with `sdd_read_file_slice` before feature work. Initialization installs nine roles in four host formats. Matching files do not prove that the host has loaded them: a host/session catalog reload may be required, separately from restarting the MCP server. Do not promise automatic compliance by every client or model. For tasks using the locked receipt policy, take the current challenge from sdd_get_active_task. Obtain gate evidence from the operator-controlled issuer and pass the signed receipts to sdd_complete_task. The server still runs the task integration command. A changed observed baseline requires reviewed resolution.
9
9
 
10
+ ## Read-only diagnostics
11
+
12
+ Use `sdd_list_features.hostSkills` to identify fixed installed role paths, causes and the bundled reference version. `catalog` stays `unverified` even when files match. An unavailable baseline requires inspecting the installation; unsafe paths require inspection before authorized setup. Project setup and client catalogue reload are explicit, separate actions.
13
+
14
+ For a rejected `sdd_lock_spec`, inspect `error.details.issues` for artifact, stable rule and optional 1-based original source line. Missing or ambiguous locations omit the line. Existing rejection codes and legacy details remain authoritative; rejection writes no lock. Do not automatically relock.
15
+
16
+ Before verification, request `sdd_get_active_task` with `view="verification_preflight"` and optional `verification_receipts`. Require `verificationPreflight.version=1`; older servers may ignore the view. Inspect per-gate states, aggregate blockers and `nextAction`. `ready_to_attempt` only permits attempting integration; runtime prerequisites and integration remain unverified. Preflight runs no command, consumes no grant, writes no artifact and issues no certificate. Keep the default task read and all nine tools unchanged.
17
+
18
+ To resume, request `sdd_get_active_task` with `view="resume"` and optional `verification_receipts`; require `data.resume.version=1` before using its task, progress, candidate, observed-input digests, gates, pending integration and `nextAction`. Then use the ordinary active-task read for its authorized body and File Manifest. Unsupplied evidence is pending; observed receipts are not certification. Neither compact view runs verification, writes artifacts or grants permission.
19
+
20
+ If `history` is null, follow `nextAction` without requesting history. If `history.firstCursor` is null, there are no records; do not request history. Otherwise use `view="relock_history"` with the checkpoint's `history.firstCursor` as `history_cursor`, then each `nextCursor`, to read at most eight descending records per page. `history_cursor` is accepted only with `view="relock_history"`. Stop when `nextCursor` is null. Require `data.relockHistory.version=1`; stale cursors require rereading the checkpoint. Each handler-produced compact result has exactly one text block of at most 8,192 UTF-8 bytes, without `structuredContent`; SDK validation before dispatch is a separate boundary. History digests reference the original unmodified lock; they do not attest historical actions. Preserve guards, locked authority and verification budgets.
21
+
10
22
  ## Delegation
11
23
 
12
24
  Delegate useful independent work within the active TASK through available native agents; keep trivial/dependent work sequential. Load the bounded protocol from `spec-executor.md` on demand; use `spec-architect.md` for workstream routing and `verification-auditor.md` for provenance checks. The parent alone applies canonical patches and certifies. Preserve all nine tools, lock, File Manifest, limits and protected-root controls; host capabilities grant no extra authority.
@@ -6,6 +6,18 @@ The only SDD contract is `.sdd/features/{FEAT-*}/spec.md`, `plan.md`, and `tasks
6
6
 
7
7
  After the local client has registered the MCP server and the intended project is open, use `sdd_list_features` to inspect setup. A setup request authorizes `sdd_init_workspace(scope="project")` in that identified project; connecting or inspecting alone does not. Use the default `force=false` to preserve an existing current AGENTS.md. Read `.agents/skills/planu-preflight-guardian/SKILL.md` and the matching role immediately with `sdd_read_file_slice` before feature work. Initialization installs nine roles in four host formats. Matching files do not prove that the host has loaded them: a host/session catalog reload may be required, separately from restarting the MCP server. Do not promise automatic compliance by every client or model.
8
8
 
9
+ ## Read-only diagnostics
10
+
11
+ Use `sdd_list_features.hostSkills` to identify fixed installed role paths, causes and the bundled reference version. `catalog` stays `unverified` even when files match. An unavailable baseline requires inspecting the installation; unsafe paths require inspection before authorized setup. Project setup and client catalogue reload are explicit, separate actions.
12
+
13
+ For a rejected `sdd_lock_spec`, inspect `error.details.issues` for artifact, stable rule and optional 1-based original source line. Missing or ambiguous locations omit the line. Existing rejection codes and legacy details remain authoritative; rejection writes no lock. Do not automatically relock.
14
+
15
+ Before verification, request `sdd_get_active_task` with `view="verification_preflight"` and optional `verification_receipts`. Require `verificationPreflight.version=1`; older servers may ignore the view. Inspect per-gate states, aggregate blockers and `nextAction`. `ready_to_attempt` only permits attempting integration; runtime prerequisites and integration remain unverified. Preflight runs no command, consumes no grant, writes no artifact and issues no certificate. Keep the default task read and all nine tools unchanged.
16
+
17
+ To resume, request `sdd_get_active_task` with `view="resume"` and optional `verification_receipts`; require `data.resume.version=1` before using its task, progress, candidate, observed-input digests, gates, pending integration and `nextAction`. Then use the ordinary active-task read for its authorized body and File Manifest. Unsupplied evidence is pending; observed receipts are not certification. Neither compact view runs verification, writes artifacts or grants permission.
18
+
19
+ If `history` is null, follow `nextAction` without requesting history. If `history.firstCursor` is null, there are no records; do not request history. Otherwise use `view="relock_history"` with the checkpoint's `history.firstCursor` as `history_cursor`, then each `nextCursor`, to read at most eight descending records per page. `history_cursor` is accepted only with `view="relock_history"`. Stop when `nextCursor` is null. Require `data.relockHistory.version=1`; stale cursors require rereading the checkpoint. Each handler-produced compact result has exactly one text block of at most 8,192 UTF-8 bytes, without `structuredContent`; SDK validation before dispatch is a separate boundary. History digests reference the original unmodified lock; they do not attest historical actions. Preserve guards, locked authority and verification budgets.
20
+
9
21
  ## Delegation
10
22
 
11
23
  Delegate useful independent work within the active TASK through available native agents; keep trivial/dependent work sequential. Load the bounded protocol from `spec-executor.md` on demand; use `spec-architect.md` for workstream routing and `verification-auditor.md` for provenance checks. The parent alone applies canonical patches and certifies. Preserve all nine tools, lock, File Manifest, limits and protected-root controls; host capabilities grant no extra authority.