@planu/cli 7.1.4 → 7.1.5

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,8 @@
1
+ ## [7.1.5] - 2026-09-18
2
+
3
+ - list v6 `planu/specs` in `sdd_list_features` as `data.legacy` without bulk rewrite
4
+ - website lead/analytics buttons: consent status, honeypot rename, local `/api` mock
5
+
1
6
  ## [7.1.4] - 2026-09-18
2
7
 
3
8
  - public install is `npx -y @planu/cli@latest` (same as Claude/Codex): `cli`, `planu`, and `sdd-engine` bins always start MCP stdio
package/README.md CHANGED
@@ -72,6 +72,8 @@ sdd_init_workspace → sdd_create_feature → architect trinity → sdd_lock_spe
72
72
  4. **Execute:** `sdd_get_active_task` → `sdd_apply_file_patch` → `sdd_complete_task`.
73
73
  5. **Janitor:** prune local branches and orphaned worktrees.
74
74
 
75
+ Legacy `planu/specs/SPEC-*` files stay on disk. `sdd_list_features` returns them under `legacy` (id, path, archive/active/unknown, `migratedTo`) so the trace is never empty. They are not executable until migrated via `.sdd/skills/legacy-migrator.md` into `.sdd/features/FEAT-*`. There is no bulk rewrite of `done` specs.
76
+
75
77
  ### Canonical tools
76
78
 
77
79
  `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`
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- export type { ArtifactType, FilePermission, ErrorCode, SddErrorDetails, SddSuccess, SddFailure, SddResult, InitWorkspaceInput, ListFeaturesInput, CreateFeatureInput, LockSpecInput, ReadSpecArtifactInput, ReadFileSliceInput, GetActiveTaskInput, ApplyFilePatchInput, CompleteTaskInput, ParsedManifest, ActiveTaskDetails, ActiveTaskResult, CompleteTaskResult, FeatureSummary, } from '../types/sdd-engine.js';
2
+ export type { ArtifactType, FilePermission, ErrorCode, SddErrorDetails, SddSuccess, SddFailure, SddResult, InitWorkspaceInput, ListFeaturesInput, CreateFeatureInput, LockSpecInput, ReadSpecArtifactInput, ReadFileSliceInput, GetActiveTaskInput, ApplyFilePatchInput, CompleteTaskInput, ParsedManifest, ActiveTaskDetails, ActiveTaskResult, CompleteTaskResult, FeatureSummary, LegacySpecSummary, LegacyCatalogSummary, } from '../types/sdd-engine.js';
3
3
  export declare const FeatureIdSchema: z.ZodString;
4
4
  export declare const ArtifactTypeSchema: z.ZodEnum<{
5
5
  plan: "plan";
@@ -0,0 +1,11 @@
1
+ import type { LegacyCatalogSummary, LegacySpecSummary } from '../types/sdd-engine.js';
2
+ export declare function classifyLegacyStatus(status: string | null): LegacySpecSummary['lifecycle'];
3
+ export declare function parseLegacyFrontmatter(content: string): {
4
+ id: string | null;
5
+ title: string | null;
6
+ status: string | null;
7
+ migratedTo: string | null;
8
+ };
9
+ export declare function inferredFeatId(legacyId: string): string;
10
+ export declare function collectLegacyCatalog(workspaceRoot: string, sddDir: string): Promise<LegacyCatalogSummary>;
11
+ //# sourceMappingURL=legacy-catalog.d.ts.map
@@ -0,0 +1,112 @@
1
+ import * as fs from 'node:fs/promises';
2
+ import * as path from 'node:path';
3
+ const LEGACY_SPEC_ROOTS = ['planu/specs', 'legacy-specs'];
4
+ const ARCHIVE_STATUSES = new Set(['done', 'completed', 'complete', 'discarded']);
5
+ const ACTIVE_STATUSES = new Set([
6
+ 'implementing',
7
+ 'approved',
8
+ 'review',
9
+ 'validating',
10
+ 'draft',
11
+ 'planning',
12
+ ]);
13
+ export function classifyLegacyStatus(status) {
14
+ if (!status) {
15
+ return 'unknown';
16
+ }
17
+ const normalized = status.trim().toLowerCase();
18
+ if (ARCHIVE_STATUSES.has(normalized)) {
19
+ return 'archive';
20
+ }
21
+ if (ACTIVE_STATUSES.has(normalized)) {
22
+ return 'active';
23
+ }
24
+ return 'unknown';
25
+ }
26
+ export function parseLegacyFrontmatter(content) {
27
+ const head = content.slice(0, 4000);
28
+ const fence = /^---\r?\n([\s\S]*?)\r?\n---/.exec(head);
29
+ const block = head.startsWith('---') ? (fence?.[1] ?? head) : head;
30
+ return {
31
+ id: matchField(block, 'id'),
32
+ title: matchField(block, 'title'),
33
+ status: matchField(block, 'status'),
34
+ migratedTo: matchField(block, 'sdd_migrated_to'),
35
+ };
36
+ }
37
+ export function inferredFeatId(legacyId) {
38
+ return `FEAT-${legacyId}`;
39
+ }
40
+ export async function collectLegacyCatalog(workspaceRoot, sddDir) {
41
+ const specs = [];
42
+ const seen = new Set();
43
+ for (const relativeRoot of LEGACY_SPEC_ROOTS) {
44
+ const absRoot = path.join(workspaceRoot, relativeRoot);
45
+ const folders = await listSpecFolders(absRoot);
46
+ for (const folder of folders) {
47
+ const specPath = path.join(folder, 'spec.md');
48
+ let content;
49
+ try {
50
+ content = await fs.readFile(specPath, 'utf-8');
51
+ }
52
+ catch {
53
+ continue;
54
+ }
55
+ const meta = parseLegacyFrontmatter(content);
56
+ const folderName = path.basename(folder);
57
+ const idMatch = /^SPEC[-_]\d+/i.exec(folderName);
58
+ const id = meta.id ?? idMatch?.[0]?.toUpperCase() ?? folderName;
59
+ if (seen.has(id)) {
60
+ continue;
61
+ }
62
+ seen.add(id);
63
+ const featAlias = inferredFeatId(id);
64
+ const featExists = await pathExists(path.join(sddDir, 'features', featAlias));
65
+ specs.push({
66
+ id,
67
+ title: meta.title ?? folderName,
68
+ lifecycle: classifyLegacyStatus(meta.status),
69
+ legacyStatus: meta.status,
70
+ path: path.relative(workspaceRoot, specPath).split(path.sep).join('/'),
71
+ migratedTo: meta.migratedTo ?? (featExists ? featAlias : null),
72
+ });
73
+ }
74
+ }
75
+ specs.sort((a, b) => a.id.localeCompare(b.id));
76
+ return {
77
+ total: specs.length,
78
+ active: specs.filter((spec) => spec.lifecycle === 'active').length,
79
+ archive: specs.filter((spec) => spec.lifecycle === 'archive').length,
80
+ unknown: specs.filter((spec) => spec.lifecycle === 'unknown').length,
81
+ specs,
82
+ };
83
+ }
84
+ function matchField(block, key) {
85
+ const match = new RegExp(`^${key}:\\s*(.+)$`, 'im').exec(block);
86
+ if (!match?.[1]) {
87
+ return null;
88
+ }
89
+ return match[1].trim().replace(/^['"]|['"]$/g, '') || null;
90
+ }
91
+ async function listSpecFolders(absRoot) {
92
+ const found = [];
93
+ try {
94
+ const entries = await fs.readdir(absRoot, { withFileTypes: true });
95
+ for (const entry of entries) {
96
+ if (entry.isDirectory()) {
97
+ found.push(path.join(absRoot, entry.name));
98
+ }
99
+ }
100
+ }
101
+ catch {
102
+ return [];
103
+ }
104
+ return found;
105
+ }
106
+ async function pathExists(target) {
107
+ return fs
108
+ .access(target)
109
+ .then(() => true)
110
+ .catch(() => false);
111
+ }
112
+ //# sourceMappingURL=legacy-catalog.js.map
@@ -5,7 +5,7 @@ import { resolveSddWorkspaceRoot } from './workspace-root.js';
5
5
  export function createUltralightSddServer(workspaceRoot) {
6
6
  const server = new McpServer({
7
7
  name: 'sdd-engine',
8
- version: '7.1.4',
8
+ version: '7.1.5',
9
9
  }, {
10
10
  capabilities: {
11
11
  tools: {},
@@ -6,10 +6,11 @@ const moduleDir = path.dirname(fileURLToPath(import.meta.url));
6
6
  import { InitWorkspaceInputSchema, ListFeaturesInputSchema, CreateFeatureInputSchema, LockSpecInputSchema, } from '../contracts.js';
7
7
  import { TaskWindowManager } from '../task-window.js';
8
8
  import { formatResult } from './format-result.js';
9
+ import { collectLegacyCatalog } from '../legacy-catalog.js';
9
10
  export function registerWorkspaceTools(server, sddDir, workspaceRoot) {
10
11
  const taskWindow = new TaskWindowManager();
11
12
  registerInitTool(server, sddDir, workspaceRoot);
12
- registerListTool(server, sddDir, taskWindow);
13
+ registerListTool(server, sddDir, workspaceRoot, taskWindow);
13
14
  registerCreateTool(server, sddDir);
14
15
  registerLockTool(server, sddDir);
15
16
  }
@@ -32,17 +33,22 @@ function registerInitTool(server, sddDir, workspaceRoot) {
32
33
  });
33
34
  });
34
35
  }
35
- function registerListTool(server, sddDir, taskWindow) {
36
+ function registerListTool(server, sddDir, workspaceRoot, taskWindow) {
36
37
  server.registerTool('sdd_list_features', {
37
- description: 'Lists all features in .sdd/ directory along with their locking and progress status.',
38
+ description: 'Lists v7 FEAT-* features and a read-only catalog of legacy planu/specs SPEC-* (trace only; not executable until migrated).',
38
39
  inputSchema: ListFeaturesInputSchema.shape,
39
40
  }, async (rawArgs) => {
40
41
  const args = ListFeaturesInputSchema.parse(rawArgs);
41
42
  const featuresDir = path.join(sddDir, 'features');
42
43
  const featuresList = await collectFeatures(featuresDir, taskWindow, args.status_filter);
44
+ const legacy = await collectLegacyCatalog(workspaceRoot, sddDir);
43
45
  return formatResult({
44
46
  success: true,
45
- data: { total: featuresList.length, features: featuresList },
47
+ data: {
48
+ total: featuresList.length,
49
+ features: featuresList,
50
+ legacy,
51
+ },
46
52
  });
47
53
  });
48
54
  }
@@ -88,6 +88,21 @@ export interface FeatureSummary {
88
88
  status: 'planning' | 'executing' | 'done';
89
89
  locked: boolean;
90
90
  }
91
+ export interface LegacySpecSummary {
92
+ id: string;
93
+ title: string;
94
+ lifecycle: 'active' | 'archive' | 'unknown';
95
+ legacyStatus: string | null;
96
+ path: string;
97
+ migratedTo: string | null;
98
+ }
99
+ export interface LegacyCatalogSummary {
100
+ total: number;
101
+ active: number;
102
+ archive: number;
103
+ unknown: number;
104
+ specs: LegacySpecSummary[];
105
+ }
91
106
  export interface SddLockFile {
92
107
  specHash?: string;
93
108
  planHash?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planu/cli",
3
- "version": "7.1.4",
3
+ "version": "7.1.5",
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",
@@ -6,24 +6,69 @@ role: Spec Fragmentation Specialist
6
6
  # SDD LEGACY MIGRATOR DIRECTIVE
7
7
 
8
8
  You act as a Specification Fragmentation Specialist.
9
- Your objective is to read old, monolithic specifications and refactor them into the modern SDD Engine format (The Holy Trinity: `spec.md`, `plan.md`, `tasks.md`).
9
+ Old Planu v6 specs (`planu/specs/SPEC-*`, `legacy-specs/SPEC-*`) stay on disk. `sdd_list_features` returns them in `data.legacy` (id, path, lifecycle, `migratedTo`). They are **not** executable. `sdd_lock_spec` / `sdd_apply_file_patch` still require a `FEAT-*` trinity.
10
10
 
11
- ## RULES FOR MIGRATION
11
+ Read a legacy spec with `sdd_read_file_slice` using `legacy.specs[].path`. Then follow this skill to create `FEAT-SPEC-{n}` and stamp `sdd_migrated_to`.
12
12
 
13
- 1. **Information Preservation:**
14
- - Ensure all critical constraints, edge cases, and business logic from the monolithic spec are captured.
15
- - Do not hallucinate new requirements; only restructure the existing ones.
13
+ There is no MCP tool `migrate_spec`. Migration is cognitive: read the old artifact, emit a Holy Trinity, lock it.
16
14
 
17
- 2. **Target Format:**
18
- - **`spec.md`:** Focus on pure requirements, out-of-scope boundaries, strict typed contracts, and the error matrix.
19
- - **`plan.md`:** Focus on architectural decisions, frozen dependencies, and the exhaustive file manifest (CREATE, MODIFY, READ_ONLY).
20
- - **`tasks.md`:** Translate implicit steps into explicit, atomic, verifiable tasks with checkboxes (`- [ ] TASK-N: ...`).
15
+ ## Do not bulk-convert the archive
21
16
 
22
- 3. **Language:**
23
- - ALL generated artifacts MUST be written entirely in Technical English.
17
+ A host app may have hundreds of `SPEC-*` files. Most are finished history. Copying every `done` spec into `.sdd/features/` creates empty locked features and noise.
24
18
 
25
- 4. **Workflow:**
26
- - Read the legacy spec thoroughly.
27
- - Run `sdd_create_feature` with a `FEAT-*` id to initialize the target structure.
28
- - Populate `spec.md`, `plan.md`, and `tasks.md` following the SDD Engine standards.
29
- - Verify the migration (five architect laws) and then lock with `sdd_lock_spec`. Do not lock an empty skeleton.
19
+ Triage first, migrate only what still governs work.
20
+
21
+ ### Inventory (run in the target repo)
22
+
23
+ Count `status:` in each `planu/specs/**/spec.md` (or `legacy-specs/**/spec.md`). Bucket:
24
+
25
+ | Bucket | Typical v6 `status` | Action |
26
+ |---|---|---|
27
+ | Archive | `done`, `completed`, `complete`, `discarded` | Keep the folder. Do not create a `FEAT-*` unless the work is being reopened. |
28
+ | Active | `implementing`, `approved`, `review`, `validating`, `draft` | Migrate one spec at a time before more product code. |
29
+ | Unknown | missing `status` | Open the file. If the code already shipped, archive. If work remains, treat as Active. |
30
+
31
+ Never invent requirements. If the old spec is too thin to lock, mark it archive or rewrite as a **new** `FEAT-*` with the user, not as a fake migration.
32
+
33
+ ## ID mapping
34
+
35
+ - Legacy id `SPEC-1047` stays on disk as history.
36
+ - v7 id MUST be `FEAT-*` (example: `FEAT-SPEC-1047` or `FEAT-PAYMENTS-1047`).
37
+ - Put `Legacy-Spec: SPEC-1047` plus the old path in the new `spec.md` frontmatter or header so the two remain traceable.
38
+ - After a successful lock, add to the **old** spec (do not rewrite its body):
39
+
40
+ ```yaml
41
+ sdd_migrated_to: FEAT-SPEC-1047
42
+ sdd_migrated_at: <ISO date>
43
+ ```
44
+
45
+ ## One-spec workflow (mandatory order)
46
+
47
+ 1. Adopt this skill. Adopt `spec-architect.md` for quality of the new trinity.
48
+ 2. `sdd_init_workspace` if `.sdd/` is missing (`scope: project`).
49
+ 3. Read the entire legacy `spec.md` (and `technical.md` / `progress.md` if they still exist).
50
+ 4. `sdd_create_feature` with the `FEAT-*` id and the legacy title.
51
+ 5. Rewrite into:
52
+ - `spec.md` — BDD, Out-of-Scope, typed contracts, error matrix, `Legacy-Spec` pointer.
53
+ - `plan.md` — decisions, frozen dependencies, exhaustive File Manifest (`CREATE` / `MODIFY` / `READ_ONLY`).
54
+ - `tasks.md` — atomic `- [ ] TASK-N:` lines with `Verification:` commands. Check off only work that is already true in the tree.
55
+ 6. If the legacy spec is already implemented, tasks may all be `[x]` **only** when each verification command still passes. Otherwise leave remaining work `[ ]`.
56
+ 7. Five architect laws in `spec-architect.md` must hold. Do not lock an empty skeleton.
57
+ 8. `sdd_lock_spec`.
58
+ 9. Stamp `sdd_migrated_to` on the old spec.
59
+ 10. Continue execution with `spec-executor.md` if tasks remain. Do not use native Write during execution.
60
+
61
+ Language: Technical English in all new SDD artifacts.
62
+
63
+ ## Preservation rules
64
+
65
+ - Copy constraints, edge cases, and error behavior. Do not add product scope.
66
+ - Out-of-Scope is mandatory even if the old spec never had it.
67
+ - File Manifest must match the real tree (paths that no longer exist are not `MODIFY`).
68
+ - Leave `planu/specs/` in place. v7 does not delete or import that directory.
69
+
70
+ ## Host notes (CONKER-scale)
71
+
72
+ Typical shape: majority `done` = archive; tens of `implementing`/`approved`/`draft` = the real queue; a large `status`-less set = triage, not a dump into `.sdd`.
73
+
74
+ New work in that repo starts with `sdd_create_feature`, never with a new `planu/specs/SPEC-*`.