@unbrained/pm-cli 2026.5.24 → 2026.5.28

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 (246) hide show
  1. package/CHANGELOG.md +953 -522
  2. package/README.md +2 -10
  3. package/dist/cli/bootstrap-args.d.ts +18 -1
  4. package/dist/cli/bootstrap-args.js +143 -3
  5. package/dist/cli/bootstrap-args.js.map +1 -1
  6. package/dist/cli/commander-usage.js +134 -11
  7. package/dist/cli/commander-usage.js.map +1 -1
  8. package/dist/cli/commands/append.js +4 -3
  9. package/dist/cli/commands/append.js.map +1 -1
  10. package/dist/cli/commands/claim.js +5 -4
  11. package/dist/cli/commands/claim.js.map +1 -1
  12. package/dist/cli/commands/close.d.ts +3 -0
  13. package/dist/cli/commands/close.js +26 -3
  14. package/dist/cli/commands/close.js.map +1 -1
  15. package/dist/cli/commands/completion.d.ts +2 -2
  16. package/dist/cli/commands/completion.js +109 -56
  17. package/dist/cli/commands/completion.js.map +1 -1
  18. package/dist/cli/commands/config.d.ts +1 -1
  19. package/dist/cli/commands/config.js +82 -4
  20. package/dist/cli/commands/config.js.map +1 -1
  21. package/dist/cli/commands/create.js +7 -272
  22. package/dist/cli/commands/create.js.map +1 -1
  23. package/dist/cli/commands/delete.js +4 -3
  24. package/dist/cli/commands/delete.js.map +1 -1
  25. package/dist/cli/commands/docs.d.ts +1 -12
  26. package/dist/cli/commands/docs.js +8 -312
  27. package/dist/cli/commands/docs.js.map +1 -1
  28. package/dist/cli/commands/extension/bundled-catalog.d.ts +14 -0
  29. package/dist/cli/commands/extension/bundled-catalog.js +268 -0
  30. package/dist/cli/commands/extension/bundled-catalog.js.map +1 -0
  31. package/dist/cli/commands/extension/doctor.d.ts +31 -0
  32. package/dist/cli/commands/extension/doctor.js +345 -0
  33. package/dist/cli/commands/extension/doctor.js.map +1 -0
  34. package/dist/cli/commands/extension/install-sources.d.ts +37 -0
  35. package/dist/cli/commands/extension/install-sources.js +384 -0
  36. package/dist/cli/commands/extension/install-sources.js.map +1 -0
  37. package/dist/cli/commands/extension/managed-state.d.ts +48 -0
  38. package/dist/cli/commands/extension/managed-state.js +172 -0
  39. package/dist/cli/commands/extension/managed-state.js.map +1 -0
  40. package/dist/cli/commands/extension/scaffold.d.ts +14 -0
  41. package/dist/cli/commands/extension/scaffold.js +202 -0
  42. package/dist/cli/commands/extension/scaffold.js.map +1 -0
  43. package/dist/cli/commands/extension/shared.d.ts +14 -0
  44. package/dist/cli/commands/extension/shared.js +106 -0
  45. package/dist/cli/commands/extension/shared.js.map +1 -0
  46. package/dist/cli/commands/extension.d.ts +36 -68
  47. package/dist/cli/commands/extension.js +143 -1422
  48. package/dist/cli/commands/extension.js.map +1 -1
  49. package/dist/cli/commands/files.d.ts +1 -12
  50. package/dist/cli/commands/files.js +11 -308
  51. package/dist/cli/commands/files.js.map +1 -1
  52. package/dist/cli/commands/get.js +4 -3
  53. package/dist/cli/commands/get.js.map +1 -1
  54. package/dist/cli/commands/health.js +17 -3
  55. package/dist/cli/commands/health.js.map +1 -1
  56. package/dist/cli/commands/history-redact.js +23 -18
  57. package/dist/cli/commands/history-redact.js.map +1 -1
  58. package/dist/cli/commands/history-repair.js +24 -18
  59. package/dist/cli/commands/history-repair.js.map +1 -1
  60. package/dist/cli/commands/legacy-none-tokens.d.ts +3 -0
  61. package/dist/cli/commands/legacy-none-tokens.js +39 -0
  62. package/dist/cli/commands/legacy-none-tokens.js.map +1 -0
  63. package/dist/cli/commands/linked-artifacts.d.ts +96 -0
  64. package/dist/cli/commands/linked-artifacts.js +335 -0
  65. package/dist/cli/commands/linked-artifacts.js.map +1 -0
  66. package/dist/cli/commands/linked-test-parsers.d.ts +28 -0
  67. package/dist/cli/commands/linked-test-parsers.js +192 -0
  68. package/dist/cli/commands/linked-test-parsers.js.map +1 -0
  69. package/dist/cli/commands/list.js +19 -5
  70. package/dist/cli/commands/list.js.map +1 -1
  71. package/dist/cli/commands/normalize.js +4 -3
  72. package/dist/cli/commands/normalize.js.map +1 -1
  73. package/dist/cli/commands/plan.d.ts +5 -0
  74. package/dist/cli/commands/plan.js +56 -8
  75. package/dist/cli/commands/plan.js.map +1 -1
  76. package/dist/cli/commands/recurrence-parsers.d.ts +26 -0
  77. package/dist/cli/commands/recurrence-parsers.js +98 -0
  78. package/dist/cli/commands/recurrence-parsers.js.map +1 -0
  79. package/dist/cli/commands/restore.js +19 -8
  80. package/dist/cli/commands/restore.js.map +1 -1
  81. package/dist/cli/commands/search.js +5 -8
  82. package/dist/cli/commands/search.js.map +1 -1
  83. package/dist/cli/commands/test/linked-command-detection.d.ts +37 -0
  84. package/dist/cli/commands/test/linked-command-detection.js +200 -0
  85. package/dist/cli/commands/test/linked-command-detection.js.map +1 -0
  86. package/dist/cli/commands/test.d.ts +1 -2
  87. package/dist/cli/commands/test.js +8 -350
  88. package/dist/cli/commands/test.js.map +1 -1
  89. package/dist/cli/commands/update-many.js +4 -3
  90. package/dist/cli/commands/update-many.js.map +1 -1
  91. package/dist/cli/commands/update.js +83 -356
  92. package/dist/cli/commands/update.js.map +1 -1
  93. package/dist/cli/commands/validate.js +32 -12
  94. package/dist/cli/commands/validate.js.map +1 -1
  95. package/dist/cli/error-guidance.d.ts +1 -0
  96. package/dist/cli/error-guidance.js +6 -2
  97. package/dist/cli/error-guidance.js.map +1 -1
  98. package/dist/cli/main.d.ts +11 -0
  99. package/dist/cli/main.js +76 -28
  100. package/dist/cli/main.js.map +1 -1
  101. package/dist/cli/register-list-query.d.ts +4 -1
  102. package/dist/cli/register-list-query.js +242 -203
  103. package/dist/cli/register-list-query.js.map +1 -1
  104. package/dist/cli/register-mutation.js +73 -11
  105. package/dist/cli/register-mutation.js.map +1 -1
  106. package/dist/cli/register-operations.js +3 -3
  107. package/dist/cli/register-operations.js.map +1 -1
  108. package/dist/cli/register-setup.js +12 -7
  109. package/dist/cli/register-setup.js.map +1 -1
  110. package/dist/cli/registration-helpers.js +3 -2
  111. package/dist/cli/registration-helpers.js.map +1 -1
  112. package/dist/cli.js +4 -3
  113. package/dist/cli.js.map +1 -1
  114. package/dist/core/config/positional-value.d.ts +44 -0
  115. package/dist/core/config/positional-value.js +109 -0
  116. package/dist/core/config/positional-value.js.map +1 -0
  117. package/dist/core/extensions/extension-capability-aliases.d.ts +14 -0
  118. package/dist/core/extensions/extension-capability-aliases.js +159 -0
  119. package/dist/core/extensions/extension-capability-aliases.js.map +1 -0
  120. package/dist/core/extensions/extension-hook-runtime.d.ts +13 -0
  121. package/dist/core/extensions/extension-hook-runtime.js +414 -0
  122. package/dist/core/extensions/extension-hook-runtime.js.map +1 -0
  123. package/dist/core/extensions/extension-policy.d.ts +69 -0
  124. package/dist/core/extensions/extension-policy.js +481 -0
  125. package/dist/core/extensions/extension-policy.js.map +1 -0
  126. package/dist/core/extensions/extension-registries.d.ts +8 -0
  127. package/dist/core/extensions/extension-registries.js +52 -0
  128. package/dist/core/extensions/extension-registries.js.map +1 -0
  129. package/dist/core/extensions/extension-runtime-helpers.d.ts +6 -0
  130. package/dist/core/extensions/extension-runtime-helpers.js +29 -0
  131. package/dist/core/extensions/extension-runtime-helpers.js.map +1 -0
  132. package/dist/core/extensions/extension-types.d.ts +13 -39
  133. package/dist/core/extensions/extension-types.js +34 -2
  134. package/dist/core/extensions/extension-types.js.map +1 -1
  135. package/dist/core/extensions/index.d.ts +7 -0
  136. package/dist/core/extensions/index.js +11 -2
  137. package/dist/core/extensions/index.js.map +1 -1
  138. package/dist/core/extensions/loader.d.ts +4 -22
  139. package/dist/core/extensions/loader.js +22 -1139
  140. package/dist/core/extensions/loader.js.map +1 -1
  141. package/dist/core/history/drift-scan.d.ts +11 -0
  142. package/dist/core/history/drift-scan.js +114 -32
  143. package/dist/core/history/drift-scan.js.map +1 -1
  144. package/dist/core/history/history-rewrite.d.ts +43 -0
  145. package/dist/core/history/history-rewrite.js +48 -0
  146. package/dist/core/history/history-rewrite.js.map +1 -0
  147. package/dist/core/history/history.js +5 -4
  148. package/dist/core/history/history.js.map +1 -1
  149. package/dist/core/history/replay.js +4 -3
  150. package/dist/core/history/replay.js.map +1 -1
  151. package/dist/core/item/item-record.d.ts +19 -0
  152. package/dist/core/item/item-record.js +24 -0
  153. package/dist/core/item/item-record.js.map +1 -0
  154. package/dist/core/output/mutation-projection.d.ts +31 -0
  155. package/dist/core/output/mutation-projection.js +103 -0
  156. package/dist/core/output/mutation-projection.js.map +1 -0
  157. package/dist/core/output/output.d.ts +2 -0
  158. package/dist/core/output/output.js +5 -3
  159. package/dist/core/output/output.js.map +1 -1
  160. package/dist/core/schema/runtime-schema.js +8 -38
  161. package/dist/core/schema/runtime-schema.js.map +1 -1
  162. package/dist/core/search/vector-stores.js +46 -9
  163. package/dist/core/search/vector-stores.js.map +1 -1
  164. package/dist/core/sentry/helpers.d.ts +1 -1
  165. package/dist/core/sentry/helpers.js +20 -3
  166. package/dist/core/sentry/helpers.js.map +1 -1
  167. package/dist/core/shared/command-types.d.ts +1 -0
  168. package/dist/core/shared/command-types.js +2 -2
  169. package/dist/core/shared/command-types.js.map +1 -1
  170. package/dist/core/shared/constants.d.ts +10 -1
  171. package/dist/core/shared/constants.js +56 -58
  172. package/dist/core/shared/constants.js.map +1 -1
  173. package/dist/core/shared/levenshtein.js +23 -7
  174. package/dist/core/shared/levenshtein.js.map +1 -1
  175. package/dist/core/shared/primitives.d.ts +23 -0
  176. package/dist/core/shared/primitives.js +39 -2
  177. package/dist/core/shared/primitives.js.map +1 -1
  178. package/dist/core/store/front-matter-cache.d.ts +16 -2
  179. package/dist/core/store/front-matter-cache.js +99 -33
  180. package/dist/core/store/front-matter-cache.js.map +1 -1
  181. package/dist/core/store/item-store.js +8 -73
  182. package/dist/core/store/item-store.js.map +1 -1
  183. package/dist/mcp/server.js +76 -28
  184. package/dist/mcp/server.js.map +1 -1
  185. package/dist/sdk/cli-contracts/enum-contracts.d.ts +20 -0
  186. package/dist/sdk/cli-contracts/enum-contracts.js +156 -0
  187. package/dist/sdk/cli-contracts/enum-contracts.js.map +1 -0
  188. package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +14 -0
  189. package/dist/sdk/cli-contracts/tool-option-contracts.js +243 -0
  190. package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -0
  191. package/dist/sdk/cli-contracts/tool-parameter-tables.d.ts +11 -0
  192. package/dist/sdk/cli-contracts/tool-parameter-tables.js +901 -0
  193. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -0
  194. package/dist/sdk/cli-contracts.d.ts +11 -33
  195. package/dist/sdk/cli-contracts.js +30 -1356
  196. package/dist/sdk/cli-contracts.js.map +1 -1
  197. package/dist/sdk/package-import-adapters.d.ts +74 -0
  198. package/dist/sdk/package-import-adapters.js +186 -0
  199. package/dist/sdk/package-import-adapters.js.map +1 -0
  200. package/dist/sdk/package-runtime-options.d.ts +26 -0
  201. package/dist/sdk/package-runtime-options.js +71 -0
  202. package/dist/sdk/package-runtime-options.js.map +1 -0
  203. package/dist/sdk/runtime.d.ts +2 -0
  204. package/dist/sdk/runtime.js +4 -2
  205. package/dist/sdk/runtime.js.map +1 -1
  206. package/docs/AGENT_GUIDE.md +6 -10
  207. package/docs/CLAUDE_CODE_PLUGIN.md +5 -28
  208. package/docs/CODEX_PLUGIN.md +5 -5
  209. package/docs/COMMANDS.md +19 -3
  210. package/docs/CONFIGURATION.md +15 -0
  211. package/docs/EXTENSIONS.md +4 -63
  212. package/docs/RELEASING.md +4 -4
  213. package/marketplace.json +7 -3
  214. package/package.json +9 -6
  215. package/packages/pm-beads/extensions/beads/index.js +2 -49
  216. package/packages/pm-beads/extensions/beads/index.ts +2 -54
  217. package/packages/pm-beads/extensions/beads/runtime-loader.js +86 -0
  218. package/packages/pm-beads/extensions/beads/runtime-loader.ts +88 -0
  219. package/packages/pm-beads/extensions/beads/runtime.js +26 -115
  220. package/packages/pm-beads/extensions/beads/runtime.ts +33 -132
  221. package/packages/pm-calendar/extensions/calendar/index.js +47 -2
  222. package/packages/pm-calendar/extensions/calendar/index.ts +52 -2
  223. package/packages/pm-calendar/extensions/calendar/runtime.js +1 -0
  224. package/packages/pm-calendar/extensions/calendar/runtime.ts +1 -0
  225. package/packages/pm-governance-audit/extensions/governance-audit/runtime.js +14 -41
  226. package/packages/pm-governance-audit/extensions/governance-audit/runtime.ts +25 -41
  227. package/packages/pm-guide-shell/extensions/guide-shell/runtime.js +10 -50
  228. package/packages/pm-guide-shell/extensions/guide-shell/runtime.ts +17 -50
  229. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/runtime.js +8 -40
  230. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/runtime.ts +10 -40
  231. package/packages/pm-search-advanced/extensions/search-advanced/index.js +1 -1
  232. package/packages/pm-search-advanced/extensions/search-advanced/runtime.js +4 -37
  233. package/packages/pm-search-advanced/extensions/search-advanced/runtime.ts +6 -37
  234. package/packages/pm-todos/extensions/todos/index.js +3 -50
  235. package/packages/pm-todos/extensions/todos/index.ts +3 -55
  236. package/packages/pm-todos/extensions/todos/runtime-loader.js +86 -0
  237. package/packages/pm-todos/extensions/todos/runtime-loader.ts +88 -0
  238. package/packages/pm-todos/extensions/todos/runtime.js +24 -117
  239. package/packages/pm-todos/extensions/todos/runtime.ts +32 -129
  240. package/plugins/pm-claude/README.md +2 -2
  241. package/plugins/pm-claude/commands/pm-planner.md +1 -15
  242. package/plugins/pm-claude/scripts/pm-mcp-server.mjs +5 -2
  243. package/plugins/pm-claude/skills/pm-planner/SKILL.md +3 -21
  244. package/plugins/pm-codex/scripts/pm-mcp-server.mjs +15 -6
  245. package/plugins/pm-codex/skills/pm-native/SKILL.md +1 -13
  246. package/PRD.md +0 -1734
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Shared external-source import adapter primitives for bundled pm packages.
3
+ *
4
+ * The Beads (pm-beads) and Todos (pm-todos) importers map records from an
5
+ * external format into pm items. The field-by-field mapping is intentionally
6
+ * package-specific (different source schemas, type vocabularies, and timestamp
7
+ * rules), but a number of value-coercion helpers and the item write/commit
8
+ * sequence are behavior-identical across both adapters.
9
+ *
10
+ * These primitives are re-exported from the SDK runtime surface (`src/sdk/runtime.ts`),
11
+ * which is the only module bundled packages are permitted to import (they load it
12
+ * at runtime via `PM_CLI_PACKAGE_ROOT`). Centralizing them here removes copy-pasted
13
+ * helper bodies while keeping each package's explicit field mapping in the package.
14
+ */
15
+ import type { ItemDocument, ItemStatus, PmSettings } from "../types/index.js";
16
+ /**
17
+ * Returns the trimmed string when `value` is a non-empty string, else undefined.
18
+ */
19
+ export declare function toNonEmptyImportString(value: unknown): string | undefined;
20
+ /**
21
+ * Coerces a non-negative finite numeric estimate (number or numeric string).
22
+ */
23
+ export declare function toEstimatedMinutesValue(value: unknown): number | undefined;
24
+ /**
25
+ * Coerces a priority into the 0..4 range, defaulting to 2.
26
+ */
27
+ export declare function toImportPriority(value: unknown): 0 | 1 | 2 | 3 | 4;
28
+ /**
29
+ * Normalizes tags from an array of strings or a comma-separated string.
30
+ */
31
+ export declare function toImportTags(value: unknown): string[];
32
+ /**
33
+ * Maps a raw status value to a canonical pm status, defaulting to "open".
34
+ */
35
+ export declare function toImportStatus(value: unknown): ItemStatus;
36
+ /**
37
+ * Resolves the effective import author: explicit flag, PM_AUTHOR, then settings,
38
+ * falling back to "unknown".
39
+ */
40
+ export declare function selectImportAuthor(explicitAuthor: string | undefined, settingsAuthor: string): string;
41
+ /**
42
+ * Throws a NOT_FOUND PmCliError when the tracker has not been initialized.
43
+ */
44
+ export declare function ensureTrackerInitialized(pmRoot: string): Promise<void>;
45
+ /**
46
+ * Returns an empty item document used as the `before` state on import.
47
+ */
48
+ export declare function emptyImportedDocument(): ItemDocument;
49
+ export interface CommitImportedItemParams {
50
+ pmRoot: string;
51
+ id: string;
52
+ itemPath: string;
53
+ document: ItemDocument;
54
+ author: string;
55
+ message: string;
56
+ settings: PmSettings;
57
+ /** Warning prefix emitted on a lock conflict, e.g. "beads_import_lock_conflict". */
58
+ conflictWarningPrefix: string;
59
+ }
60
+ export type CommitImportedItemResult = {
61
+ committed: true;
62
+ writeWarnings: string[];
63
+ } | {
64
+ committed: false;
65
+ conflictWarning: string;
66
+ };
67
+ /**
68
+ * Performs the shared item write/commit sequence: acquire the per-item lock,
69
+ * atomically write the TOON document, append the import history entry, and run
70
+ * on-write hooks. On a lock CONFLICT it returns a `conflictWarning` (using the
71
+ * caller-supplied prefix) instead of throwing; any other error removes the
72
+ * partially written file and rethrows.
73
+ */
74
+ export declare function commitImportedItem(params: CommitImportedItemParams): Promise<CommitImportedItemResult>;
@@ -0,0 +1,186 @@
1
+ /**
2
+ * Shared external-source import adapter primitives for bundled pm packages.
3
+ *
4
+ * The Beads (pm-beads) and Todos (pm-todos) importers map records from an
5
+ * external format into pm items. The field-by-field mapping is intentionally
6
+ * package-specific (different source schemas, type vocabularies, and timestamp
7
+ * rules), but a number of value-coercion helpers and the item write/commit
8
+ * sequence are behavior-identical across both adapters.
9
+ *
10
+ * These primitives are re-exported from the SDK runtime surface (`src/sdk/runtime.ts`),
11
+ * which is the only module bundled packages are permitted to import (they load it
12
+ * at runtime via `PM_CLI_PACKAGE_ROOT`). Centralizing them here removes copy-pasted
13
+ * helper bodies while keeping each package's explicit field mapping in the package.
14
+ */
15
+
16
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="35a75913-7781-5119-9497-42f4316b14c6")}catch(e){}}();
17
+ import { appendHistoryEntry, createHistoryEntry } from "../core/history/history.js";
18
+ import { acquireLock } from "../core/lock/lock.js";
19
+ import { parseTags } from "../core/item/parse.js";
20
+ import { normalizeStatusInput } from "../core/item/status.js";
21
+ import { serializeItemDocument } from "../core/item/item-format.js";
22
+ import { getHistoryPath, getSettingsPath } from "../core/store/paths.js";
23
+ import { pathExists, removeFileIfExists, writeFileAtomic } from "../core/fs/fs-utils.js";
24
+ import { runActiveOnWriteHooks } from "../core/extensions/index.js";
25
+ import { EXIT_CODE } from "../core/shared/constants.js";
26
+ import { PmCliError } from "../core/shared/errors.js";
27
+ import { nowIso } from "../core/shared/time.js";
28
+ /**
29
+ * Returns the trimmed string when `value` is a non-empty string, else undefined.
30
+ */
31
+ export function toNonEmptyImportString(value) {
32
+ if (typeof value !== "string") {
33
+ return undefined;
34
+ }
35
+ const trimmed = value.trim();
36
+ return trimmed.length > 0 ? trimmed : undefined;
37
+ }
38
+ /**
39
+ * Coerces a non-negative finite numeric estimate (number or numeric string).
40
+ */
41
+ export function toEstimatedMinutesValue(value) {
42
+ if (typeof value === "number" && Number.isFinite(value) && value >= 0) {
43
+ return value;
44
+ }
45
+ if (typeof value === "string" && value.trim().length > 0) {
46
+ const parsed = Number(value);
47
+ if (Number.isFinite(parsed) && parsed >= 0) {
48
+ return parsed;
49
+ }
50
+ }
51
+ return undefined;
52
+ }
53
+ /**
54
+ * Coerces a priority into the 0..4 range, defaulting to 2.
55
+ */
56
+ export function toImportPriority(value) {
57
+ if (typeof value === "number" && Number.isInteger(value) && value >= 0 && value <= 4) {
58
+ return value;
59
+ }
60
+ if (typeof value === "string" && value.trim().length > 0) {
61
+ const parsed = Number(value);
62
+ if (Number.isInteger(parsed) && parsed >= 0 && parsed <= 4) {
63
+ return parsed;
64
+ }
65
+ }
66
+ return 2;
67
+ }
68
+ /**
69
+ * Normalizes tags from an array of strings or a comma-separated string.
70
+ */
71
+ export function toImportTags(value) {
72
+ if (Array.isArray(value)) {
73
+ const tags = value
74
+ .filter((entry) => typeof entry === "string")
75
+ .map((entry) => entry.trim().toLowerCase())
76
+ .filter((entry) => entry.length > 0);
77
+ return Array.from(new Set(tags)).sort((left, right) => left.localeCompare(right));
78
+ }
79
+ if (typeof value === "string") {
80
+ return parseTags(value);
81
+ }
82
+ return [];
83
+ }
84
+ /**
85
+ * Maps a raw status value to a canonical pm status, defaulting to "open".
86
+ */
87
+ export function toImportStatus(value) {
88
+ const normalized = toNonEmptyImportString(value);
89
+ if (normalized) {
90
+ const canonical = normalizeStatusInput(normalized);
91
+ if (canonical) {
92
+ return canonical;
93
+ }
94
+ }
95
+ return "open";
96
+ }
97
+ /**
98
+ * Resolves the effective import author: explicit flag, PM_AUTHOR, then settings,
99
+ * falling back to "unknown".
100
+ */
101
+ export function selectImportAuthor(explicitAuthor, settingsAuthor) {
102
+ const explicit = explicitAuthor?.trim();
103
+ if (explicit && explicit.length > 0) {
104
+ return explicit;
105
+ }
106
+ const envAuthor = process.env.PM_AUTHOR?.trim();
107
+ if (envAuthor && envAuthor.length > 0) {
108
+ return envAuthor;
109
+ }
110
+ const settings = settingsAuthor.trim();
111
+ return settings.length > 0 ? settings : "unknown";
112
+ }
113
+ /**
114
+ * Throws a NOT_FOUND PmCliError when the tracker has not been initialized.
115
+ */
116
+ export async function ensureTrackerInitialized(pmRoot) {
117
+ const exists = await pathExists(getSettingsPath(pmRoot));
118
+ if (!exists) {
119
+ throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
120
+ }
121
+ }
122
+ /**
123
+ * Returns an empty item document used as the `before` state on import.
124
+ */
125
+ export function emptyImportedDocument() {
126
+ return {
127
+ metadata: {},
128
+ body: "",
129
+ };
130
+ }
131
+ /**
132
+ * Performs the shared item write/commit sequence: acquire the per-item lock,
133
+ * atomically write the TOON document, append the import history entry, and run
134
+ * on-write hooks. On a lock CONFLICT it returns a `conflictWarning` (using the
135
+ * caller-supplied prefix) instead of throwing; any other error removes the
136
+ * partially written file and rethrows.
137
+ */
138
+ export async function commitImportedItem(params) {
139
+ const { pmRoot, id, itemPath, document, author, message, settings, conflictWarningPrefix } = params;
140
+ const historyPath = getHistoryPath(pmRoot, id);
141
+ try {
142
+ const releaseLock = await acquireLock(pmRoot, id, settings.locks.ttl_seconds, author);
143
+ try {
144
+ await writeFileAtomic(itemPath, serializeItemDocument(document, { format: "toon" }));
145
+ try {
146
+ const entry = createHistoryEntry({
147
+ nowIso: nowIso(),
148
+ author,
149
+ op: "import",
150
+ before: emptyImportedDocument(),
151
+ after: document,
152
+ message,
153
+ });
154
+ await appendHistoryEntry(historyPath, entry);
155
+ const writeWarnings = [
156
+ ...(await runActiveOnWriteHooks({
157
+ path: itemPath,
158
+ scope: "project",
159
+ op: "import",
160
+ })),
161
+ ...(await runActiveOnWriteHooks({
162
+ path: historyPath,
163
+ scope: "project",
164
+ op: "import:history",
165
+ })),
166
+ ];
167
+ return { committed: true, writeWarnings };
168
+ }
169
+ catch (error) {
170
+ await removeFileIfExists(itemPath);
171
+ throw error;
172
+ }
173
+ }
174
+ finally {
175
+ await releaseLock();
176
+ }
177
+ }
178
+ catch (error) {
179
+ if (error instanceof PmCliError && error.exitCode === EXIT_CODE.CONFLICT) {
180
+ return { committed: false, conflictWarning: `${conflictWarningPrefix}:${id}` };
181
+ }
182
+ throw error;
183
+ }
184
+ }
185
+ //# sourceMappingURL=package-import-adapters.js.map
186
+ //# debugId=35a75913-7781-5119-9497-42f4316b14c6
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-import-adapters.js","sources":["sdk/package-import-adapters.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Shared external-source import adapter primitives for bundled pm packages.\n *\n * The Beads (pm-beads) and Todos (pm-todos) importers map records from an\n * external format into pm items. The field-by-field mapping is intentionally\n * package-specific (different source schemas, type vocabularies, and timestamp\n * rules), but a number of value-coercion helpers and the item write/commit\n * sequence are behavior-identical across both adapters.\n *\n * These primitives are re-exported from the SDK runtime surface (`src/sdk/runtime.ts`),\n * which is the only module bundled packages are permitted to import (they load it\n * at runtime via `PM_CLI_PACKAGE_ROOT`). Centralizing them here removes copy-pasted\n * helper bodies while keeping each package's explicit field mapping in the package.\n */\n\nimport { appendHistoryEntry, createHistoryEntry } from \"../core/history/history.js\";\nimport { acquireLock } from \"../core/lock/lock.js\";\nimport { parseTags } from \"../core/item/parse.js\";\nimport { normalizeStatusInput } from \"../core/item/status.js\";\nimport { serializeItemDocument } from \"../core/item/item-format.js\";\nimport { getHistoryPath, getSettingsPath } from \"../core/store/paths.js\";\nimport { pathExists, removeFileIfExists, writeFileAtomic } from \"../core/fs/fs-utils.js\";\nimport { runActiveOnWriteHooks } from \"../core/extensions/index.js\";\nimport { EXIT_CODE } from \"../core/shared/constants.js\";\nimport { PmCliError } from \"../core/shared/errors.js\";\nimport { nowIso } from \"../core/shared/time.js\";\nimport type { ItemDocument, ItemMetadata, ItemStatus, PmSettings } from \"../types/index.js\";\n\n/**\n * Returns the trimmed string when `value` is a non-empty string, else undefined.\n */\nexport function toNonEmptyImportString(value: unknown): string | undefined {\n if (typeof value !== \"string\") {\n return undefined;\n }\n const trimmed = value.trim();\n return trimmed.length > 0 ? trimmed : undefined;\n}\n\n/**\n * Coerces a non-negative finite numeric estimate (number or numeric string).\n */\nexport function toEstimatedMinutesValue(value: unknown): number | undefined {\n if (typeof value === \"number\" && Number.isFinite(value) && value >= 0) {\n return value;\n }\n if (typeof value === \"string\" && value.trim().length > 0) {\n const parsed = Number(value);\n if (Number.isFinite(parsed) && parsed >= 0) {\n return parsed;\n }\n }\n return undefined;\n}\n\n/**\n * Coerces a priority into the 0..4 range, defaulting to 2.\n */\nexport function toImportPriority(value: unknown): 0 | 1 | 2 | 3 | 4 {\n if (typeof value === \"number\" && Number.isInteger(value) && value >= 0 && value <= 4) {\n return value as 0 | 1 | 2 | 3 | 4;\n }\n if (typeof value === \"string\" && value.trim().length > 0) {\n const parsed = Number(value);\n if (Number.isInteger(parsed) && parsed >= 0 && parsed <= 4) {\n return parsed as 0 | 1 | 2 | 3 | 4;\n }\n }\n return 2;\n}\n\n/**\n * Normalizes tags from an array of strings or a comma-separated string.\n */\nexport function toImportTags(value: unknown): string[] {\n if (Array.isArray(value)) {\n const tags = value\n .filter((entry): entry is string => typeof entry === \"string\")\n .map((entry) => entry.trim().toLowerCase())\n .filter((entry) => entry.length > 0);\n return Array.from(new Set(tags)).sort((left, right) => left.localeCompare(right));\n }\n if (typeof value === \"string\") {\n return parseTags(value);\n }\n return [];\n}\n\n/**\n * Maps a raw status value to a canonical pm status, defaulting to \"open\".\n */\nexport function toImportStatus(value: unknown): ItemStatus {\n const normalized = toNonEmptyImportString(value);\n if (normalized) {\n const canonical = normalizeStatusInput(normalized);\n if (canonical) {\n return canonical;\n }\n }\n return \"open\";\n}\n\n/**\n * Resolves the effective import author: explicit flag, PM_AUTHOR, then settings,\n * falling back to \"unknown\".\n */\nexport function selectImportAuthor(explicitAuthor: string | undefined, settingsAuthor: string): string {\n const explicit = explicitAuthor?.trim();\n if (explicit && explicit.length > 0) {\n return explicit;\n }\n const envAuthor = process.env.PM_AUTHOR?.trim();\n if (envAuthor && envAuthor.length > 0) {\n return envAuthor;\n }\n const settings = settingsAuthor.trim();\n return settings.length > 0 ? settings : \"unknown\";\n}\n\n/**\n * Throws a NOT_FOUND PmCliError when the tracker has not been initialized.\n */\nexport async function ensureTrackerInitialized(pmRoot: string): Promise<void> {\n const exists = await pathExists(getSettingsPath(pmRoot));\n if (!exists) {\n throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);\n }\n}\n\n/**\n * Returns an empty item document used as the `before` state on import.\n */\nexport function emptyImportedDocument(): ItemDocument {\n return {\n metadata: {} as ItemMetadata,\n body: \"\",\n };\n}\n\nexport interface CommitImportedItemParams {\n pmRoot: string;\n id: string;\n itemPath: string;\n document: ItemDocument;\n author: string;\n message: string;\n settings: PmSettings;\n /** Warning prefix emitted on a lock conflict, e.g. \"beads_import_lock_conflict\". */\n conflictWarningPrefix: string;\n}\n\nexport type CommitImportedItemResult =\n | { committed: true; writeWarnings: string[] }\n | { committed: false; conflictWarning: string };\n\n/**\n * Performs the shared item write/commit sequence: acquire the per-item lock,\n * atomically write the TOON document, append the import history entry, and run\n * on-write hooks. On a lock CONFLICT it returns a `conflictWarning` (using the\n * caller-supplied prefix) instead of throwing; any other error removes the\n * partially written file and rethrows.\n */\nexport async function commitImportedItem(\n params: CommitImportedItemParams,\n): Promise<CommitImportedItemResult> {\n const { pmRoot, id, itemPath, document, author, message, settings, conflictWarningPrefix } = params;\n const historyPath = getHistoryPath(pmRoot, id);\n try {\n const releaseLock = await acquireLock(pmRoot, id, settings.locks.ttl_seconds, author);\n try {\n await writeFileAtomic(itemPath, serializeItemDocument(document, { format: \"toon\" }));\n try {\n const entry = createHistoryEntry({\n nowIso: nowIso(),\n author,\n op: \"import\",\n before: emptyImportedDocument(),\n after: document,\n message,\n });\n await appendHistoryEntry(historyPath, entry);\n const writeWarnings = [\n ...(await runActiveOnWriteHooks({\n path: itemPath,\n scope: \"project\",\n op: \"import\",\n })),\n ...(await runActiveOnWriteHooks({\n path: historyPath,\n scope: \"project\",\n op: \"import:history\",\n })),\n ];\n return { committed: true, writeWarnings };\n } catch (error: unknown) {\n await removeFileIfExists(itemPath);\n throw error;\n }\n } finally {\n await releaseLock();\n }\n } catch (error: unknown) {\n if (error instanceof PmCliError && error.exitCode === EXIT_CODE.CONFLICT) {\n return { committed: false, conflictWarning: `${conflictWarningPrefix}:${id}` };\n }\n throw error;\n }\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;;;AAEH,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACpF,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzF,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,6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H,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,IAAI,KAAK,YAAY,UAAU,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ,EAAE,CAAC;YACzE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,eAAe,EAAE,GAAG,qBAAqB,IAAI,EAAE,EAAE,EAAE,CAAC;QACjF,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC","debugId":"35a75913-7781-5119-9497-42f4316b14c6"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Pure option-parsing helpers shared by bundled pm package runtimes.
3
+ *
4
+ * Bundled packages (pm-beads, pm-todos, pm-guide-shell, pm-governance-audit,
5
+ * pm-linked-test-adapters, pm-search-advanced, ...) are standalone-installable
6
+ * and may only depend on the public SDK runtime surface that they already load
7
+ * via `PM_CLI_PACKAGE_ROOT`. These helpers are dependency-free string/boolean
8
+ * coercion utilities; centralizing them here removes copy-pasted helper bodies
9
+ * from each package runtime while staying on the SDK surface those packages are
10
+ * permitted to import.
11
+ */
12
+ /**
13
+ * Returns the first non-empty string value found for `key` or any alias.
14
+ */
15
+ export declare function readStringOption(options: Record<string, unknown>, key: string, aliases?: string[]): string | undefined;
16
+ /**
17
+ * Coerces the first defined value found for `key` or any alias into a boolean.
18
+ *
19
+ * Accepts native booleans and the canonical truthy/falsy string literals; any
20
+ * other value is ignored so a later alias can still match.
21
+ */
22
+ export declare function readBooleanOption(options: Record<string, unknown>, key: string, aliases?: string[]): boolean | undefined;
23
+ /**
24
+ * Splits a comma-separated string option into trimmed, non-empty entries.
25
+ */
26
+ export declare function readCsvListOption(options: Record<string, unknown>, key: string, aliases?: string[]): string[];
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Pure option-parsing helpers shared by bundled pm package runtimes.
3
+ *
4
+ * Bundled packages (pm-beads, pm-todos, pm-guide-shell, pm-governance-audit,
5
+ * pm-linked-test-adapters, pm-search-advanced, ...) are standalone-installable
6
+ * and may only depend on the public SDK runtime surface that they already load
7
+ * via `PM_CLI_PACKAGE_ROOT`. These helpers are dependency-free string/boolean
8
+ * coercion utilities; centralizing them here removes copy-pasted helper bodies
9
+ * from each package runtime while staying on the SDK surface those packages are
10
+ * permitted to import.
11
+ */
12
+
13
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="73038184-28df-5df7-ad1e-0be2af421b92")}catch(e){}}();
14
+ const BOOLEAN_TRUE_VALUES = new Set(["true", "1", "yes", "on"]);
15
+ const BOOLEAN_FALSE_VALUES = new Set(["false", "0", "no", "off"]);
16
+ /**
17
+ * Returns the first non-empty string value found for `key` or any alias.
18
+ */
19
+ export function readStringOption(options, key, aliases = []) {
20
+ const keys = [key, ...aliases];
21
+ for (const candidate of keys) {
22
+ const value = options[candidate];
23
+ if (typeof value === "string" && value.trim().length > 0) {
24
+ return value.trim();
25
+ }
26
+ }
27
+ return undefined;
28
+ }
29
+ /**
30
+ * Coerces the first defined value found for `key` or any alias into a boolean.
31
+ *
32
+ * Accepts native booleans and the canonical truthy/falsy string literals; any
33
+ * other value is ignored so a later alias can still match.
34
+ */
35
+ export function readBooleanOption(options, key, aliases = []) {
36
+ const keys = [key, ...aliases];
37
+ for (const candidate of keys) {
38
+ const value = options[candidate];
39
+ if (value === undefined) {
40
+ continue;
41
+ }
42
+ if (typeof value === "boolean") {
43
+ return value;
44
+ }
45
+ if (typeof value === "string") {
46
+ const normalized = value.trim().toLowerCase();
47
+ if (BOOLEAN_TRUE_VALUES.has(normalized)) {
48
+ return true;
49
+ }
50
+ if (BOOLEAN_FALSE_VALUES.has(normalized)) {
51
+ return false;
52
+ }
53
+ }
54
+ }
55
+ return undefined;
56
+ }
57
+ /**
58
+ * Splits a comma-separated string option into trimmed, non-empty entries.
59
+ */
60
+ export function readCsvListOption(options, key, aliases = []) {
61
+ const value = readStringOption(options, key, aliases);
62
+ if (!value) {
63
+ return [];
64
+ }
65
+ return value
66
+ .split(",")
67
+ .map((entry) => entry.trim())
68
+ .filter((entry) => entry.length > 0);
69
+ }
70
+ //# sourceMappingURL=package-runtime-options.js.map
71
+ //# debugId=73038184-28df-5df7-ad1e-0be2af421b92
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-runtime-options.js","sources":["sdk/package-runtime-options.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Pure option-parsing helpers shared by bundled pm package runtimes.\n *\n * Bundled packages (pm-beads, pm-todos, pm-guide-shell, pm-governance-audit,\n * pm-linked-test-adapters, pm-search-advanced, ...) are standalone-installable\n * and may only depend on the public SDK runtime surface that they already load\n * via `PM_CLI_PACKAGE_ROOT`. These helpers are dependency-free string/boolean\n * coercion utilities; centralizing them here removes copy-pasted helper bodies\n * from each package runtime while staying on the SDK surface those packages are\n * permitted to import.\n */\n\nconst BOOLEAN_TRUE_VALUES = new Set([\"true\", \"1\", \"yes\", \"on\"]);\nconst BOOLEAN_FALSE_VALUES = new Set([\"false\", \"0\", \"no\", \"off\"]);\n\n/**\n * Returns the first non-empty string value found for `key` or any alias.\n */\nexport function readStringOption(\n options: Record<string, unknown>,\n key: string,\n aliases: string[] = [],\n): string | undefined {\n const keys = [key, ...aliases];\n for (const candidate of keys) {\n const value = options[candidate];\n if (typeof value === \"string\" && value.trim().length > 0) {\n return value.trim();\n }\n }\n return undefined;\n}\n\n/**\n * Coerces the first defined value found for `key` or any alias into a boolean.\n *\n * Accepts native booleans and the canonical truthy/falsy string literals; any\n * other value is ignored so a later alias can still match.\n */\nexport function readBooleanOption(\n options: Record<string, unknown>,\n key: string,\n aliases: string[] = [],\n): boolean | undefined {\n const keys = [key, ...aliases];\n for (const candidate of keys) {\n const value = options[candidate];\n if (value === undefined) {\n continue;\n }\n if (typeof value === \"boolean\") {\n return value;\n }\n if (typeof value === \"string\") {\n const normalized = value.trim().toLowerCase();\n if (BOOLEAN_TRUE_VALUES.has(normalized)) {\n return true;\n }\n if (BOOLEAN_FALSE_VALUES.has(normalized)) {\n return false;\n }\n }\n }\n return undefined;\n}\n\n/**\n * Splits a comma-separated string option into trimmed, non-empty entries.\n */\nexport function readCsvListOption(\n options: Record<string, unknown>,\n key: string,\n aliases: string[] = [],\n): string[] {\n const value = readStringOption(options, key, aliases);\n if (!value) {\n return [];\n }\n return value\n .split(\",\")\n .map((entry) => entry.trim())\n .filter((entry) => entry.length > 0);\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;;;AAEH,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;AAChE,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;AAElE;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAgC,EAChC,GAAW,EACX,UAAoB,EAAE;IAEtB,MAAM,IAAI,GAAG,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,CAAC;IAC/B,KAAK,MAAM,SAAS,IAAI,IAAI,EAAE,CAAC;QAC7B,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;QACjC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACzD,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;QACtB,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAAgC,EAChC,GAAW,EACX,UAAoB,EAAE;IAEtB,MAAM,IAAI,GAAG,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,CAAC;IAC/B,KAAK,MAAM,SAAS,IAAI,IAAI,EAAE,CAAC;QAC7B,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;QACjC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,SAAS;QACX,CAAC;QACD,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;YAC/B,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;YAC9C,IAAI,mBAAmB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;gBACxC,OAAO,IAAI,CAAC;YACd,CAAC;YACD,IAAI,oBAAoB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;gBACzC,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAAgC,EAChC,GAAW,EACX,UAAoB,EAAE;IAEtB,MAAM,KAAK,GAAG,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IACtD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,KAAK;SACT,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;SAC5B,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACzC,CAAC","debugId":"73038184-28df-5df7-ad1e-0be2af421b92"}
@@ -4,6 +4,8 @@ export { getActiveExtensionRegistrations, runActiveOnReadHooks, runActiveOnWrite
4
4
  export { pathExists, readFileIfExists, removeFileIfExists, writeFileAtomic } from "../core/fs/fs-utils.js";
5
5
  export { appendHistoryEntry, createHistoryEntry } from "../core/history/history.js";
6
6
  export { generateItemId, normalizeItemId, normalizeRawItemId } from "../core/item/id.js";
7
+ export { readBooleanOption, readCsvListOption, readStringOption } from "./package-runtime-options.js";
8
+ export { commitImportedItem, emptyImportedDocument, ensureTrackerInitialized, selectImportAuthor, toEstimatedMinutesValue, toImportPriority, toImportStatus, toImportTags, toNonEmptyImportString, type CommitImportedItemParams, type CommitImportedItemResult, } from "./package-import-adapters.js";
7
9
  export { canonicalDocument, normalizeFrontMatter, serializeItemDocument, splitFrontMatter, } from "../core/item/item-format.js";
8
10
  export { parseTags } from "../core/item/parse.js";
9
11
  export { normalizeStatusInput } from "../core/item/status.js";
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="052ef5fb-9ab2-5bb7-96b0-f07bab9251b6")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9dfba929-1fc6-569e-8311-91fc06f420bc")}catch(e){}}();
3
3
  import { activateExtensions, loadExtensions, } from "../core/extensions/index.js";
4
4
  import { resolveItemTypeRegistry } from "../core/item/type-registry.js";
5
5
  import { resolveRuntimeStatusRegistry } from "../core/schema/runtime-schema.js";
@@ -9,6 +9,8 @@ export { getActiveExtensionRegistrations, runActiveOnReadHooks, runActiveOnWrite
9
9
  export { pathExists, readFileIfExists, removeFileIfExists, writeFileAtomic } from "../core/fs/fs-utils.js";
10
10
  export { appendHistoryEntry, createHistoryEntry } from "../core/history/history.js";
11
11
  export { generateItemId, normalizeItemId, normalizeRawItemId } from "../core/item/id.js";
12
+ export { readBooleanOption, readCsvListOption, readStringOption } from "./package-runtime-options.js";
13
+ export { commitImportedItem, emptyImportedDocument, ensureTrackerInitialized, selectImportAuthor, toEstimatedMinutesValue, toImportPriority, toImportStatus, toImportTags, toNonEmptyImportString, } from "./package-import-adapters.js";
12
14
  export { canonicalDocument, normalizeFrontMatter, serializeItemDocument, splitFrontMatter, } from "../core/item/item-format.js";
13
15
  export { parseTags } from "../core/item/parse.js";
14
16
  export { normalizeStatusInput } from "../core/item/status.js";
@@ -71,4 +73,4 @@ async function loadWorkspaceExtensionRegistrations(pmRoot, settings, cwd) {
71
73
  return activationResult.registrations;
72
74
  }
73
75
  //# sourceMappingURL=runtime.js.map
74
- //# debugId=052ef5fb-9ab2-5bb7-96b0-f07bab9251b6
76
+ //# debugId=9dfba929-1fc6-569e-8311-91fc06f420bc
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.js","sources":["sdk/runtime.ts"],"sourceRoot":"/","sourcesContent":["import {\n activateExtensions,\n loadExtensions,\n type ExtensionRegistrationRegistry,\n} from \"../core/extensions/index.js\";\nimport type { GlobalOptions } from \"../core/shared/command-types.js\";\nimport { resolveItemTypeRegistry } from \"../core/item/type-registry.js\";\nimport { resolveRuntimeStatusRegistry } from \"../core/schema/runtime-schema.js\";\nimport { readSettings } from \"../core/store/settings.js\";\nimport {\n runContracts,\n type ContractsCommandOptions,\n type ContractsResult,\n} from \"../cli/commands/contracts.js\";\n\nexport {\n getActiveExtensionRegistrations,\n runActiveOnReadHooks,\n runActiveOnWriteHooks,\n} from \"../core/extensions/index.js\";\nexport { pathExists, readFileIfExists, removeFileIfExists, writeFileAtomic } from \"../core/fs/fs-utils.js\";\nexport { appendHistoryEntry, createHistoryEntry } from \"../core/history/history.js\";\nexport { generateItemId, normalizeItemId, normalizeRawItemId } from \"../core/item/id.js\";\nexport {\n canonicalDocument,\n normalizeFrontMatter,\n serializeItemDocument,\n splitFrontMatter,\n} from \"../core/item/item-format.js\";\nexport { parseTags } from \"../core/item/parse.js\";\nexport { normalizeStatusInput } from \"../core/item/status.js\";\nexport { resolveItemTypeRegistry } from \"../core/item/type-registry.js\";\nexport { acquireLock } from \"../core/lock/lock.js\";\nexport { resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry } from \"../core/schema/runtime-schema.js\";\nexport { EXIT_CODE } from \"../core/shared/constants.js\";\nexport { PmCliError } from \"../core/shared/errors.js\";\nexport { isTimestampLiteral, nowIso } from \"../core/shared/time.js\";\nexport { listAllFrontMatter, locateItem, readLocatedItem } from \"../core/store/item-store.js\";\nexport { getHistoryPath, getItemPath, getSettingsPath, resolvePmRoot } from \"../core/store/paths.js\";\nexport { readSettings } from \"../core/store/settings.js\";\nexport {\n renderCalendarMarkdown,\n resolveCalendarOutputFormat,\n runCalendar,\n type CalendarOptions,\n type CalendarResult,\n} from \"../cli/commands/calendar.js\";\nexport {\n renderGuideMarkdown,\n resolveGuideOutputFormat,\n runGuide,\n type GuideDepth,\n type GuideOptions,\n type GuideOutputFormat,\n type GuideResult,\n} from \"../cli/commands/guide.js\";\nexport { runCompletion, type CompletionResult, type CompletionShell } from \"../cli/commands/completion.js\";\nexport {\n runCommentsAudit,\n type CommentsAuditEntry,\n type CommentsAuditHistoryRow,\n type CommentsAuditOptions,\n type CommentsAuditResult,\n type CommentsAuditSummary,\n type CommentsAuditTypeSummary,\n} from \"../cli/commands/comments-audit.js\";\nexport {\n runDedupeAudit,\n type DedupeAuditCandidate,\n type DedupeAuditCluster,\n type DedupeAuditOptions,\n type DedupeAuditResult,\n} from \"../cli/commands/dedupe-audit.js\";\nexport { runNormalize, type NormalizeCommandOptions, type NormalizeResult } from \"../cli/commands/normalize.js\";\nexport { runReindex, type ReindexOptions, type ReindexResult } from \"../cli/commands/reindex.js\";\nexport { runSearch, type SearchOptions, type SearchResult } from \"../cli/commands/search.js\";\nexport {\n loadCreateTemplateOptions,\n runTemplatesList,\n runTemplatesSave,\n runTemplatesShow,\n type CreateTemplateOptions,\n type TemplatesListResult,\n type TemplatesSaveResult,\n type TemplatesShowResult,\n} from \"../cli/commands/templates.js\";\nexport {\n runTestRunsList,\n runTestRunsLogs,\n runTestRunsResume,\n runTestRunsStatus,\n runTestRunsStop,\n type TestRunsListCommandOptions,\n type TestRunsLogsCommandOptions,\n type TestRunsResumeCommandOptions,\n type TestRunsStopCommandOptions,\n} from \"../cli/commands/test-runs.js\";\nexport {\n CONFIDENCE_TEXT_VALUES,\n DEPENDENCY_KIND_VALUES,\n BUILTIN_ITEM_TYPE_VALUES,\n ISSUE_SEVERITY_VALUES,\n ITEM_TYPE_VALUES,\n RISK_VALUES,\n STATUS_VALUES,\n} from \"../types/index.js\";\nexport type { GlobalOptions } from \"../core/shared/command-types.js\";\nexport type {\n Dependency,\n ItemDocument,\n ItemMetadata,\n ItemStatus,\n ItemType,\n LinkedDoc,\n LinkedFile,\n LinkedTest,\n LogNote,\n PmSettings,\n} from \"../types/index.js\";\n\nexport interface GetContractsOptions extends ContractsCommandOptions {\n pmRoot?: string;\n cwd?: string;\n noExtensions?: boolean;\n quiet?: boolean;\n profile?: boolean;\n}\n\nexport interface WorkspaceContractsOptions {\n extensionRegistrations?: ExtensionRegistrationRegistry | null;\n noExtensions?: boolean;\n cwd?: string;\n}\n\nexport interface WorkspaceContracts {\n types: string[];\n statuses: string[];\n openStatus: string;\n closeStatus: string;\n canceledStatus: string;\n}\n\nexport async function getWorkspaceContracts(\n pmRoot: string,\n options: WorkspaceContractsOptions = {},\n): Promise<WorkspaceContracts> {\n const settings = await readSettings(pmRoot);\n const extensionRegistrations =\n options.extensionRegistrations ??\n (options.noExtensions === true ? null : await loadWorkspaceExtensionRegistrations(pmRoot, settings, options.cwd));\n const typeRegistry = resolveItemTypeRegistry(settings, extensionRegistrations);\n const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);\n\n return {\n types: [...typeRegistry.types],\n statuses: statusRegistry.definitions.map((definition) => definition.id),\n openStatus: statusRegistry.open_status,\n closeStatus: statusRegistry.close_status,\n canceledStatus: statusRegistry.canceled_status,\n };\n}\n\nexport async function getContracts(\n pmRootOrOptions?: string | GetContractsOptions,\n options: GetContractsOptions = {},\n): Promise<ContractsResult> {\n const resolvedOptions =\n typeof pmRootOrOptions === \"string\"\n ? { ...options, pmRoot: pmRootOrOptions }\n : (pmRootOrOptions ?? options);\n const global: GlobalOptions = {\n json: true,\n quiet: resolvedOptions.quiet ?? true,\n noExtensions: resolvedOptions.noExtensions ?? false,\n noPager: true,\n profile: resolvedOptions.profile ?? false,\n path: resolvedOptions.pmRoot,\n };\n\n return runContracts(resolvedOptions, global);\n}\n\nasync function loadWorkspaceExtensionRegistrations(\n pmRoot: string,\n settings: Awaited<ReturnType<typeof readSettings>>,\n cwd?: string,\n): Promise<ExtensionRegistrationRegistry | null> {\n const loadResult = await loadExtensions({\n pmRoot,\n settings,\n cwd: cwd ?? process.cwd(),\n noExtensions: false,\n });\n const activationResult = await activateExtensions(loadResult);\n return activationResult.registrations;\n}\n\nexport type { ContractsCommandOptions, ContractsResult };\n"],"names":[],"mappings":";;AAAA,OAAO,EACL,kBAAkB,EAClB,cAAc,GAEf,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EACL,YAAY,GAGb,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,+BAA+B,EAC/B,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC3G,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACzF,OAAO,EACL,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,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE;QACzC,CAAC,CAAC,CAAC,eAAe,IAAI,OAAO,CAAC,CAAC;IACnC,MAAM,MAAM,GAAkB;QAC5B,IAAI,EAAE,IAAI;QACV,KAAK,EAAE,eAAe,CAAC,KAAK,IAAI,IAAI;QACpC,YAAY,EAAE,eAAe,CAAC,YAAY,IAAI,KAAK;QACnD,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,eAAe,CAAC,OAAO,IAAI,KAAK;QACzC,IAAI,EAAE,eAAe,CAAC,MAAM;KAC7B,CAAC;IAEF,OAAO,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;AAC/C,CAAC;AAED,KAAK,UAAU,mCAAmC,CAChD,MAAc,EACd,QAAkD,EAClD,GAAY;IAEZ,MAAM,UAAU,GAAG,MAAM,cAAc,CAAC;QACtC,MAAM;QACN,QAAQ;QACR,GAAG,EAAE,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE;QACzB,YAAY,EAAE,KAAK;KACpB,CAAC,CAAC;IACH,MAAM,gBAAgB,GAAG,MAAM,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAC9D,OAAO,gBAAgB,CAAC,aAAa,CAAC;AACxC,CAAC","debugId":"052ef5fb-9ab2-5bb7-96b0-f07bab9251b6"}
1
+ {"version":3,"file":"runtime.js","sources":["sdk/runtime.ts"],"sourceRoot":"/","sourcesContent":["import {\n activateExtensions,\n loadExtensions,\n type ExtensionRegistrationRegistry,\n} from \"../core/extensions/index.js\";\nimport type { GlobalOptions } from \"../core/shared/command-types.js\";\nimport { resolveItemTypeRegistry } from \"../core/item/type-registry.js\";\nimport { resolveRuntimeStatusRegistry } from \"../core/schema/runtime-schema.js\";\nimport { readSettings } from \"../core/store/settings.js\";\nimport {\n runContracts,\n type ContractsCommandOptions,\n type ContractsResult,\n} from \"../cli/commands/contracts.js\";\n\nexport {\n getActiveExtensionRegistrations,\n runActiveOnReadHooks,\n runActiveOnWriteHooks,\n} from \"../core/extensions/index.js\";\nexport { pathExists, readFileIfExists, removeFileIfExists, writeFileAtomic } from \"../core/fs/fs-utils.js\";\nexport { appendHistoryEntry, createHistoryEntry } from \"../core/history/history.js\";\nexport { generateItemId, normalizeItemId, normalizeRawItemId } from \"../core/item/id.js\";\nexport { readBooleanOption, readCsvListOption, readStringOption } from \"./package-runtime-options.js\";\nexport {\n commitImportedItem,\n emptyImportedDocument,\n ensureTrackerInitialized,\n selectImportAuthor,\n toEstimatedMinutesValue,\n toImportPriority,\n toImportStatus,\n toImportTags,\n toNonEmptyImportString,\n type CommitImportedItemParams,\n type CommitImportedItemResult,\n} from \"./package-import-adapters.js\";\nexport {\n canonicalDocument,\n normalizeFrontMatter,\n serializeItemDocument,\n splitFrontMatter,\n} from \"../core/item/item-format.js\";\nexport { parseTags } from \"../core/item/parse.js\";\nexport { normalizeStatusInput } from \"../core/item/status.js\";\nexport { resolveItemTypeRegistry } from \"../core/item/type-registry.js\";\nexport { acquireLock } from \"../core/lock/lock.js\";\nexport { resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry } from \"../core/schema/runtime-schema.js\";\nexport { EXIT_CODE } from \"../core/shared/constants.js\";\nexport { PmCliError } from \"../core/shared/errors.js\";\nexport { isTimestampLiteral, nowIso } from \"../core/shared/time.js\";\nexport { listAllFrontMatter, locateItem, readLocatedItem } from \"../core/store/item-store.js\";\nexport { getHistoryPath, getItemPath, getSettingsPath, resolvePmRoot } from \"../core/store/paths.js\";\nexport { readSettings } from \"../core/store/settings.js\";\nexport {\n renderCalendarMarkdown,\n resolveCalendarOutputFormat,\n runCalendar,\n type CalendarOptions,\n type CalendarResult,\n} from \"../cli/commands/calendar.js\";\nexport {\n renderGuideMarkdown,\n resolveGuideOutputFormat,\n runGuide,\n type GuideDepth,\n type GuideOptions,\n type GuideOutputFormat,\n type GuideResult,\n} from \"../cli/commands/guide.js\";\nexport { runCompletion, type CompletionResult, type CompletionShell } from \"../cli/commands/completion.js\";\nexport {\n runCommentsAudit,\n type CommentsAuditEntry,\n type CommentsAuditHistoryRow,\n type CommentsAuditOptions,\n type CommentsAuditResult,\n type CommentsAuditSummary,\n type CommentsAuditTypeSummary,\n} from \"../cli/commands/comments-audit.js\";\nexport {\n runDedupeAudit,\n type DedupeAuditCandidate,\n type DedupeAuditCluster,\n type DedupeAuditOptions,\n type DedupeAuditResult,\n} from \"../cli/commands/dedupe-audit.js\";\nexport { runNormalize, type NormalizeCommandOptions, type NormalizeResult } from \"../cli/commands/normalize.js\";\nexport { runReindex, type ReindexOptions, type ReindexResult } from \"../cli/commands/reindex.js\";\nexport { runSearch, type SearchOptions, type SearchResult } from \"../cli/commands/search.js\";\nexport {\n loadCreateTemplateOptions,\n runTemplatesList,\n runTemplatesSave,\n runTemplatesShow,\n type CreateTemplateOptions,\n type TemplatesListResult,\n type TemplatesSaveResult,\n type TemplatesShowResult,\n} from \"../cli/commands/templates.js\";\nexport {\n runTestRunsList,\n runTestRunsLogs,\n runTestRunsResume,\n runTestRunsStatus,\n runTestRunsStop,\n type TestRunsListCommandOptions,\n type TestRunsLogsCommandOptions,\n type TestRunsResumeCommandOptions,\n type TestRunsStopCommandOptions,\n} from \"../cli/commands/test-runs.js\";\nexport {\n CONFIDENCE_TEXT_VALUES,\n DEPENDENCY_KIND_VALUES,\n BUILTIN_ITEM_TYPE_VALUES,\n ISSUE_SEVERITY_VALUES,\n ITEM_TYPE_VALUES,\n RISK_VALUES,\n STATUS_VALUES,\n} from \"../types/index.js\";\nexport type { GlobalOptions } from \"../core/shared/command-types.js\";\nexport type {\n Dependency,\n ItemDocument,\n ItemMetadata,\n ItemStatus,\n ItemType,\n LinkedDoc,\n LinkedFile,\n LinkedTest,\n LogNote,\n PmSettings,\n} from \"../types/index.js\";\n\nexport interface GetContractsOptions extends ContractsCommandOptions {\n pmRoot?: string;\n cwd?: string;\n noExtensions?: boolean;\n quiet?: boolean;\n profile?: boolean;\n}\n\nexport interface WorkspaceContractsOptions {\n extensionRegistrations?: ExtensionRegistrationRegistry | null;\n noExtensions?: boolean;\n cwd?: string;\n}\n\nexport interface WorkspaceContracts {\n types: string[];\n statuses: string[];\n openStatus: string;\n closeStatus: string;\n canceledStatus: string;\n}\n\nexport async function getWorkspaceContracts(\n pmRoot: string,\n options: WorkspaceContractsOptions = {},\n): Promise<WorkspaceContracts> {\n const settings = await readSettings(pmRoot);\n const extensionRegistrations =\n options.extensionRegistrations ??\n (options.noExtensions === true ? null : await loadWorkspaceExtensionRegistrations(pmRoot, settings, options.cwd));\n const typeRegistry = resolveItemTypeRegistry(settings, extensionRegistrations);\n const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);\n\n return {\n types: [...typeRegistry.types],\n statuses: statusRegistry.definitions.map((definition) => definition.id),\n openStatus: statusRegistry.open_status,\n closeStatus: statusRegistry.close_status,\n canceledStatus: statusRegistry.canceled_status,\n };\n}\n\nexport async function getContracts(\n pmRootOrOptions?: string | GetContractsOptions,\n options: GetContractsOptions = {},\n): Promise<ContractsResult> {\n const resolvedOptions =\n typeof pmRootOrOptions === \"string\"\n ? { ...options, pmRoot: pmRootOrOptions }\n : (pmRootOrOptions ?? options);\n const global: GlobalOptions = {\n json: true,\n quiet: resolvedOptions.quiet ?? true,\n noExtensions: resolvedOptions.noExtensions ?? false,\n noPager: true,\n profile: resolvedOptions.profile ?? false,\n path: resolvedOptions.pmRoot,\n };\n\n return runContracts(resolvedOptions, global);\n}\n\nasync function loadWorkspaceExtensionRegistrations(\n pmRoot: string,\n settings: Awaited<ReturnType<typeof readSettings>>,\n cwd?: string,\n): Promise<ExtensionRegistrationRegistry | null> {\n const loadResult = await loadExtensions({\n pmRoot,\n settings,\n cwd: cwd ?? process.cwd(),\n noExtensions: false,\n });\n const activationResult = await activateExtensions(loadResult);\n return activationResult.registrations;\n}\n\nexport type { ContractsCommandOptions, ContractsResult };\n"],"names":[],"mappings":";;AAAA,OAAO,EACL,kBAAkB,EAClB,cAAc,GAEf,MAAM,6BAA6B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C/C,CAAC;AAED,KAAK,UAAU,mCAAmC,CAChD,MAAc,EACd,QAAkD,EAClD,GAAY;IAEZ,MAAM,UAAU,GAAG,MAAM,cAAc,CAAC;QACtC,MAAM;QACN,QAAQ;QACR,GAAG,EAAE,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE;QACzB,YAAY,EAAE,KAAK;KACpB,CAAC,CAAC;IACH,MAAM,gBAAgB,GAAG,MAAM,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAC9D,OAAO,gBAAgB,CAAC,aAAa,CAAC;AACxC,CAAC","debugId":"9dfba929-1fc6-569e-8311-91fc06f420bc"}
@@ -46,6 +46,8 @@ pm create --create-mode progressive \
46
46
 
47
47
  Priority accepts either numeric `0..4` or named aliases `critical`, `high`, `medium`, `low`, and `minimal`.
48
48
 
49
+ Repeated singular/plural list flags accumulate, so `--tag a --tag b` is equivalent to `--tags a,b` (same for `--status` and `--fields` on read commands). You no longer have to pre-join values into one comma list.
50
+
49
51
  Create hierarchy from broad to narrow: `Epic` -> `Feature` -> `Task` or `Issue`. Use `--parent <id>` for child items.
50
52
 
51
53
  3. **Claim**
@@ -108,21 +110,15 @@ pm release <item-id>
108
110
  | Materialize plan steps | `pm plan materialize <plan-id> --steps plan-step-002 --materialize-type Task` |
109
111
  | Dependencies | `pm deps <id> --format tree` |
110
112
  | Local docs routing | `pm install guide-shell --project`, then `pm guide <topic>` |
113
+ | Compact mutation echo | `pm --no-changed-fields create "..."` (drops the redundant `changed_fields` array, keeps `changed_field_count`) |
111
114
 
112
115
  Default TOON output is preferred for model-readable loops. Use `--json` only when strict parsing is needed.
113
116
 
114
- ## Guide Routing for Agents
117
+ Over MCP the mutation tools (`pm_create`/`pm_update`/`pm_close`, and `pm_run` for `append`/`update-many`) are already compact by default: they return `changed_field_count` instead of the full `changed_fields` array. Pass `options.full=true` only when you need the explicit field-level delta.
115
118
 
116
- Use `pm guide` as the local progressive-disclosure router after installing the optional `guide-shell` package:
119
+ ## Guide Routing for Agents
117
120
 
118
- ```bash
119
- pm install guide-shell --project
120
- pm guide
121
- pm guide quickstart
122
- pm guide commands --depth standard
123
- pm guide skills --depth deep --format markdown
124
- pm guide release --json
125
- ```
121
+ Use the canonical [guide topic map](README.md#guide-topic-map) when local in-CLI documentation routing is useful.
126
122
 
127
123
  ## Ownership Rules
128
124
 
@@ -42,32 +42,9 @@ pm-cli/ (repo root)
42
42
 
43
43
  The MCP server itself lives at `src/mcp/server.ts` (compiled to `dist/mcp/server.js`) and is bundled with the npm package as the `pm-mcp` binary.
44
44
 
45
- ## MCP Server Tools
46
-
47
- The server exposes 18 native tools that call pm library functions directly:
48
-
49
- | Tool | pm Operation | Key Args |
50
- |------|-------------|----------|
51
- | `pm_context` | `pm context` | `options.limit`, `options.depth` |
52
- | `pm_search` | `pm search` | `query` (required), `options.limit` |
53
- | `pm_list` | `pm list` | `options.status`, `options.type`, `options.limit` |
54
- | `pm_get` | `pm get` | `id` (required) |
55
- | `pm_create` | `pm create` | `options.title`, `options.description`, `options.type` |
56
- | `pm_update` | `pm update` | `id` (required), `options.*` |
57
- | `pm_claim` | `pm claim` | `id` (required), `force` |
58
- | `pm_release` | `pm release` | `id` (required), `force` |
59
- | `pm_close` | `pm close` | `id` (required), `reason` (required) |
60
- | `pm_comments` | `pm comments` | `id` (required), `options.add` |
61
- | `pm_files` | `pm files` | `id` (required), `options.add`, `options.remove` |
62
- | `pm_docs` | `pm docs` | `id` (required), `options.add`, `options.remove` |
63
- | `pm_test` | `pm test` | `id` (required), `options.add`, `options.run` |
64
- | `pm_validate` | `pm validate` | `options.checkResolution`, `options.checkFiles` |
65
- | `pm_health` | `pm health` | `options.checkOnly` |
66
- | `pm_contracts` | `pm contracts` | `options.command`, `options.json` |
67
- | `pm_plan` | `pm plan` | `options.subcommand`, `id`, `stepRef` |
68
- | `pm_run` | any pm action | `action` (required), `id`, `query`, `reason`, `options.*` |
69
-
70
- All tools accept `cwd` (workspace directory), `path` (pm data root override), and `author` (mutation author).
45
+ ## Capability Inventory
46
+
47
+ The canonical user-facing inventory for MCP tools, slash commands, skills, subagents, and `pm_run` actions lives in [`plugins/pm-claude/README.md`](../plugins/pm-claude/README.md). This page focuses on architecture, launcher behavior, and smoke-test expectations so capability counts do not drift between docs.
71
48
 
72
49
  ## Installation Methods
73
50
 
@@ -80,7 +57,7 @@ Add the pm-cli GitHub repo as a marketplace source, then install:
80
57
  /plugin install pm-claude@pm
81
58
  ```
82
59
 
83
- This clones the repo, reads `.claude-plugin/marketplace.json` at the root, installs the plugin from `./plugins/pm-claude/`, and configures the MCP server, 5 skills, 9 slash commands, and the session hook automatically.
60
+ This clones the repo, reads `.claude-plugin/marketplace.json` at the root, installs the plugin from `./plugins/pm-claude/`, and configures the MCP server, skills, slash commands, subagents, and the session hook automatically.
84
61
 
85
62
  ### 2. Global MCP via Claude Code CLI (MCP tools only)
86
63
 
@@ -146,7 +123,7 @@ node scripts/smoke-claude-plugin.mjs
146
123
  pnpm smoke:claude-plugin
147
124
  ```
148
125
 
149
- Verifies: file structure (23 files), manifest name consistency, MCP initialize, 18 tools present, full workflow (init → create → claim → update → link files/docs/tests → get → context → search → validate → health), and session-start hook.
126
+ Verifies: plugin file structure, manifest name consistency, MCP initialize, 18 tools present, full workflow (init → create → claim → update → link files/docs/tests → get → context → search → validate → health), and session-start hook.
150
127
 
151
128
  ### MCP server smoke test
152
129
 
@@ -12,11 +12,11 @@ Restart Codex and install **pm CLI** from the `pm CLI Local` marketplace.
12
12
 
13
13
  ## What It Provides
14
14
 
15
- - `pm-mcp` MCP server for structured pm operations without invoking the `pm` shell command
16
- - narrow tools for common loops: context, search, list, get, create, update, claim, release, close, comments, files, docs, tests, validate, health, contracts, and guide
17
- - `pm_run` for the rest of the pm surface, including calendar, activity, aggregate, dedupe-audit, normalize, reindex, extensions, templates, history, stats, gc, and test-runs controls
18
- - skills for native tracking, audits, and release workflows
19
- - command prompts for start, close, and audit flows
15
+ The canonical tool, skill, command, and safety inventory lives in the plugin README:
16
+
17
+ - [pm CLI Codex Plugin](../plugins/pm-codex/README.md)
18
+
19
+ Keep this page as the public docs router so the MCP tool/action list has one maintained source.
20
20
 
21
21
  ## Native MCP Notes
22
22