@unbrained/pm-cli 2026.3.9 → 2026.3.12

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/AGENTS.md CHANGED
@@ -19,6 +19,11 @@ This document defines how coding agents must use `pm` for planning, execution, a
19
19
  - Refresh the global CLI from this repository for maintainer runs:
20
20
  - Run `npm install -g .` from repository root.
21
21
  - Verify availability with `pm --version` before mutation commands.
22
+ - Run baseline runtime/build sanity checks before mutation commands:
23
+ - `PM_CMD --version`
24
+ - `node -v`
25
+ - `pnpm -v`
26
+ - `pnpm build` (if configured)
22
27
  - For real repository tracking, do not override `PM_PATH`.
23
28
  - For tests only, always use sandboxed `PM_PATH` and `PM_GLOBAL_PATH` (or `node scripts/run-tests.mjs ...`).
24
29
 
@@ -26,6 +31,15 @@ This document defines how coding agents must use `pm` for planning, execution, a
26
31
 
27
32
  ### Step A - Pick next work
28
33
 
34
+ Before creating any new `pm` item, always check for an existing relevant item first.
35
+
36
+ - Search and list existing items before `pm create`:
37
+ - `pm search "<keywords>" --limit 10`
38
+ - `pm list-open --limit 20`
39
+ - `pm list-in-progress --limit 20`
40
+ - If a relevant item already exists, reuse it, update it, or claim it instead of creating a new one.
41
+ - Never create duplicate `pm` items for the same work.
42
+
29
43
  Use one of:
30
44
 
31
45
  - `pm list-in-progress --limit 20`
@@ -279,7 +293,7 @@ For `create` and `update`, use camelCase wrapper parameters for the canonical CL
279
293
  "component": "none",
280
294
  "regression": "none",
281
295
  "customerImpact": "none",
282
- "definitionOfReady": "Extension loading contract is clarified in docs.",
296
+ "definitionOfReady": "Extension loading behavior is clarified in docs.",
283
297
  "order": 1,
284
298
  "goal": "Release-hardening",
285
299
  "objective": "Ship deterministic extension loading",
@@ -293,7 +307,7 @@ For `create` and `update`, use camelCase wrapper parameters for the canonical CL
293
307
  "learning": ["none"],
294
308
  "linkedFile": ["path=src/core/extensions/loader.ts,scope=project,note=planned implementation file"],
295
309
  "linkedTest": ["command=node scripts/run-tests.mjs test,scope=project,timeout_seconds=240,note=sandbox-safe regression"],
296
- "doc": ["path=PRD.md,scope=project,note=authoritative contract"]
310
+ "doc": ["path=docs/ARCHITECTURE.md,scope=project,note=implementation reference"]
297
311
  }
298
312
  ```
299
313
 
package/PRD.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # pm-cli Product Requirements Document (PRD)
2
2
 
3
- Status: Draft v1 (authoritative for implementation)
3
+ Status: Draft v1 (planning reference; pm data and runtime behavior are authoritative)
4
4
  Project: `pm` / `pm-cli`
5
5
  Last Updated: 2026-02-19
6
6
 
@@ -39,9 +39,9 @@ Existing trackers either rely on hosted backends, store state in non-diff-friend
39
39
  - No required database for core tracker (file-backed core is mandatory).
40
40
  - Export to Beads is not required in v1 (import only).
41
41
 
42
- ## 4) Authoritative Inputs and Design Findings
42
+ ## 4) Reference Inputs and Design Findings
43
43
 
44
- ### 4.1 Local authoritative references analyzed
44
+ ### 4.1 Local reference inputs analyzed
45
45
 
46
46
  1. `todos.ts` (local Pi extension implementation)
47
47
  2. `.beads/issues.jsonl` (local Beads-style JSONL data)
@@ -396,7 +396,7 @@ Unset optional fields are omitted.
396
396
  ],
397
397
  "tests": [
398
398
  {
399
- "command": "pnpm test history",
399
+ "command": "node scripts/run-tests.mjs test -- tests/unit/history-command.spec.ts",
400
400
  "scope": "project",
401
401
  "timeout_seconds": 90
402
402
  }
@@ -739,7 +739,7 @@ All commands return deterministic top-level objects (TOON by default, JSON with
739
739
  | `pm get <ID>` | normalized id | `{ item, body, linked: { files, tests, docs } }` |
740
740
  | `pm search <keywords>` | keyword query + optional mode/include-linked/limit filters | `{ query, mode, items, count, filters, now }` |
741
741
  | `pm reindex` | optional `--mode` (`keyword|semantic|hybrid` baseline) | `{ ok, mode, total_items, artifacts, warnings, generated_at }` |
742
- | `pm beads import --file <path?>` | optional Beads JSONL source path (defaults to `.beads/issues.jsonl`) | `{ ok, source, imported, skipped, ids, warnings }` |
742
+ | `pm beads import [--file <path\|->] [--preserve-source-ids]` | optional Beads JSONL source path (`.beads/issues.jsonl` auto-discovered first, then `issues.jsonl`; implicit `sync_base.jsonl` fallback is refused as unsafe) | `{ ok, source, imported, skipped, ids, warnings }` |
743
743
  | `pm todos import --folder <path?>` | optional todos markdown source folder (defaults to `.pi/todos`); preserves canonical optional `ItemFrontMatter` metadata when present and applies deterministic defaults for missing PM fields | `{ ok, folder, imported, skipped, ids, warnings }` |
744
744
  | `pm todos export --folder <path?>` | optional todos markdown destination folder (defaults to `.pi/todos`) | `{ ok, folder, exported, ids, warnings }` |
745
745
  | `pm create ...` | required title + schema flags | `{ item, changed_fields, warnings }` |
@@ -1013,7 +1013,7 @@ export interface ExtensionApi {
1013
1013
 
1014
1014
  Command:
1015
1015
 
1016
- - `pm beads import [--file <path>]`
1016
+ - `pm beads import [--file <path>|-] [--preserve-source-ids]`
1017
1017
 
1018
1018
  Current baseline status (release-hardening):
1019
1019
 
@@ -1023,9 +1023,10 @@ Behavior:
1023
1023
 
1024
1024
  - Parse Beads JSONL records.
1025
1025
  - Map Beads fields to PM schema.
1026
- - Preserve IDs and timestamps where possible.
1026
+ - Preserve IDs and timestamps where possible, including Beads-only compatibility metadata such as `source_type`, `source_owner`, `source_kind`, `design`, `external_ref`, and `closed_at`.
1027
1027
  - Append history with `op: "import"`.
1028
- - Default input path is `.beads/issues.jsonl` when `--file` is not provided.
1028
+ - When `--file` is not provided, auto-discover `.beads/issues.jsonl` first and then `issues.jsonl`; implicit fallback to `sync_base.jsonl` is refused because it may be partial.
1029
+ - `--preserve-source-ids` preserves explicit Beads item IDs verbatim instead of rewriting them to the tracker prefix.
1029
1030
  - Invalid JSONL lines or duplicate IDs are skipped with deterministic warnings.
1030
1031
 
1031
1032
  ### B) todos.ts import/export
@@ -1363,7 +1364,7 @@ Checklist:
1363
1364
 
1364
1365
  - [x] CI matrix finalized (ubuntu/macos/windows Node 20, ubuntu Node 22, ubuntu Node 24)
1365
1366
  - [x] fixture corpus for restore/import/search
1366
- - [x] command help and README examples validated in tests
1367
+ - [x] command help and pm-data-driven runtime checks validated in tests
1367
1368
  - [x] repository layout refactor (`src/cli`, `src/core`, `src/types`)
1368
1369
  - [x] sandboxed integration harness (`withTempPmPath`)
1369
1370
  - [x] sandboxed pm-runner (`scripts/run-tests.mjs`) for `pm test` and `pm test-all` safety
@@ -1376,7 +1377,7 @@ Checklist:
1376
1377
  Definition of Done:
1377
1378
 
1378
1379
  - All required commands and tests passing
1379
- - docs and behavior aligned with this PRD
1380
+ - pm data, runtime behavior, and user-facing docs kept coherent
1380
1381
 
1381
1382
  ## 22) Open Assumptions and Clarifications Captured
1382
1383