@unbrained/pm-cli 2026.5.30 → 2026.5.31

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 (228) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/cli/commands/calendar.js +81 -9
  3. package/dist/cli/commands/calendar.js.map +1 -1
  4. package/dist/cli/commands/create.js +34 -4
  5. package/dist/cli/commands/create.js.map +1 -1
  6. package/dist/cli/commands/extension/install-sources.d.ts +2 -0
  7. package/dist/cli/commands/extension/install-sources.js +11 -4
  8. package/dist/cli/commands/extension/install-sources.js.map +1 -1
  9. package/dist/cli/commands/reindex.js +3 -3
  10. package/dist/cli/commands/reindex.js.map +1 -1
  11. package/dist/cli/commands/search.d.ts +17 -0
  12. package/dist/cli/commands/search.js +40 -10
  13. package/dist/cli/commands/search.js.map +1 -1
  14. package/dist/cli/register-list-query.js +9 -11
  15. package/dist/cli/register-list-query.js.map +1 -1
  16. package/dist/cli/register-mutation.js +20 -22
  17. package/dist/cli/register-mutation.js.map +1 -1
  18. package/dist/cli/register-operations.js +32 -25
  19. package/dist/cli/register-operations.js.map +1 -1
  20. package/dist/cli/register-setup.js +6 -8
  21. package/dist/cli/register-setup.js.map +1 -1
  22. package/dist/cli/registration-helpers.js +6 -3
  23. package/dist/cli/registration-helpers.js.map +1 -1
  24. package/dist/cli/search-refresh.d.ts +2 -0
  25. package/dist/cli/search-refresh.js +13 -0
  26. package/dist/cli/search-refresh.js.map +1 -0
  27. package/dist/cli-bundle/chunks/activity-OWYSUZOY.js +17 -0
  28. package/dist/cli-bundle/chunks/activity-OWYSUZOY.js.map +7 -0
  29. package/dist/cli-bundle/chunks/aggregate-ADUOSFRO.js +209 -0
  30. package/dist/cli-bundle/chunks/aggregate-ADUOSFRO.js.map +7 -0
  31. package/dist/cli-bundle/chunks/append-JD2DETU7.js +73 -0
  32. package/dist/cli-bundle/chunks/append-JD2DETU7.js.map +7 -0
  33. package/dist/cli-bundle/chunks/chunk-3HUE7XOF.js +27 -0
  34. package/dist/cli-bundle/chunks/chunk-3HUE7XOF.js.map +7 -0
  35. package/dist/cli-bundle/chunks/chunk-3M73P3G6.js +1636 -0
  36. package/dist/cli-bundle/chunks/chunk-3M73P3G6.js.map +7 -0
  37. package/dist/cli-bundle/chunks/chunk-4AEZR5EJ.js +189 -0
  38. package/dist/cli-bundle/chunks/chunk-4AEZR5EJ.js.map +7 -0
  39. package/dist/cli-bundle/chunks/chunk-5HSEP75M.js +330 -0
  40. package/dist/cli-bundle/chunks/chunk-5HSEP75M.js.map +7 -0
  41. package/dist/cli-bundle/chunks/chunk-6HT2F4TK.js +1770 -0
  42. package/dist/cli-bundle/chunks/chunk-6HT2F4TK.js.map +7 -0
  43. package/dist/cli-bundle/chunks/chunk-6YCV7WSL.js +552 -0
  44. package/dist/cli-bundle/chunks/chunk-6YCV7WSL.js.map +7 -0
  45. package/dist/cli-bundle/chunks/chunk-7Y53ZJIQ.js +202 -0
  46. package/dist/cli-bundle/chunks/chunk-7Y53ZJIQ.js.map +7 -0
  47. package/dist/cli-bundle/chunks/chunk-A7E7PUVX.js +157 -0
  48. package/dist/cli-bundle/chunks/chunk-A7E7PUVX.js.map +7 -0
  49. package/dist/cli-bundle/chunks/chunk-AKOOMO3T.js +90 -0
  50. package/dist/cli-bundle/chunks/chunk-AKOOMO3T.js.map +7 -0
  51. package/dist/cli-bundle/chunks/chunk-BUPWJ3IJ.js +950 -0
  52. package/dist/cli-bundle/chunks/chunk-BUPWJ3IJ.js.map +7 -0
  53. package/dist/cli-bundle/chunks/chunk-CEFIVZPG.js +79 -0
  54. package/dist/cli-bundle/chunks/chunk-CEFIVZPG.js.map +7 -0
  55. package/dist/cli-bundle/chunks/chunk-D7AOMPRH.js +349 -0
  56. package/dist/cli-bundle/chunks/chunk-D7AOMPRH.js.map +7 -0
  57. package/dist/cli-bundle/chunks/chunk-EAOG77HM.js +56 -0
  58. package/dist/cli-bundle/chunks/chunk-EAOG77HM.js.map +7 -0
  59. package/dist/cli-bundle/chunks/chunk-EGUGFSNX.js +47 -0
  60. package/dist/cli-bundle/chunks/chunk-EGUGFSNX.js.map +7 -0
  61. package/dist/cli-bundle/chunks/chunk-FM26RGSU.js +56 -0
  62. package/dist/cli-bundle/chunks/chunk-FM26RGSU.js.map +7 -0
  63. package/dist/cli-bundle/chunks/chunk-FQE6XZDB.js +435 -0
  64. package/dist/cli-bundle/chunks/chunk-FQE6XZDB.js.map +7 -0
  65. package/dist/cli-bundle/chunks/chunk-G57E5D7T.js +185 -0
  66. package/dist/cli-bundle/chunks/chunk-G57E5D7T.js.map +7 -0
  67. package/dist/cli-bundle/chunks/chunk-GN7IJPCD.js +3621 -0
  68. package/dist/cli-bundle/chunks/chunk-GN7IJPCD.js.map +7 -0
  69. package/dist/cli-bundle/chunks/chunk-JFWUHHS2.js +233 -0
  70. package/dist/cli-bundle/chunks/chunk-JFWUHHS2.js.map +7 -0
  71. package/dist/cli-bundle/chunks/chunk-JTWRXG4B.js +1861 -0
  72. package/dist/cli-bundle/chunks/chunk-JTWRXG4B.js.map +7 -0
  73. package/dist/cli-bundle/chunks/chunk-JULRTHJQ.js +648 -0
  74. package/dist/cli-bundle/chunks/chunk-JULRTHJQ.js.map +7 -0
  75. package/dist/cli-bundle/chunks/{chunk-PB2YU2E3.js → chunk-KBQY3YG5.js} +28 -70
  76. package/dist/cli-bundle/chunks/chunk-KBQY3YG5.js.map +7 -0
  77. package/dist/cli-bundle/chunks/chunk-L2FXEKDB.js +185 -0
  78. package/dist/cli-bundle/chunks/chunk-L2FXEKDB.js.map +7 -0
  79. package/dist/cli-bundle/chunks/chunk-LRBOHPUE.js +189 -0
  80. package/dist/cli-bundle/chunks/chunk-LRBOHPUE.js.map +7 -0
  81. package/dist/cli-bundle/chunks/chunk-LSXGH6NE.js +5153 -0
  82. package/dist/cli-bundle/chunks/chunk-LSXGH6NE.js.map +7 -0
  83. package/dist/cli-bundle/chunks/chunk-MD7K4JYF.js +1345 -0
  84. package/dist/cli-bundle/chunks/chunk-MD7K4JYF.js.map +7 -0
  85. package/dist/cli-bundle/chunks/chunk-NGN7UV5K.js +341 -0
  86. package/dist/cli-bundle/chunks/chunk-NGN7UV5K.js.map +7 -0
  87. package/dist/cli-bundle/chunks/chunk-O7IWB35H.js +18 -0
  88. package/dist/cli-bundle/chunks/chunk-O7IWB35H.js.map +7 -0
  89. package/dist/cli-bundle/chunks/chunk-OGZEG5TT.js +2929 -0
  90. package/dist/cli-bundle/chunks/chunk-OGZEG5TT.js.map +7 -0
  91. package/dist/cli-bundle/chunks/{chunk-RJONRNXN.js → chunk-P53TN6IA.js} +22 -30
  92. package/dist/cli-bundle/chunks/chunk-P53TN6IA.js.map +7 -0
  93. package/dist/cli-bundle/chunks/chunk-PVNQLCIS.js +176 -0
  94. package/dist/cli-bundle/chunks/chunk-PVNQLCIS.js.map +7 -0
  95. package/dist/cli-bundle/chunks/chunk-PXUAZUUY.js +1680 -0
  96. package/dist/cli-bundle/chunks/chunk-PXUAZUUY.js.map +7 -0
  97. package/dist/cli-bundle/chunks/chunk-QAJBIGRA.js +20 -0
  98. package/dist/cli-bundle/chunks/chunk-QAJBIGRA.js.map +7 -0
  99. package/dist/cli-bundle/chunks/chunk-SEXQN4KL.js +60 -0
  100. package/dist/cli-bundle/chunks/chunk-SEXQN4KL.js.map +7 -0
  101. package/dist/cli-bundle/chunks/chunk-U7FMKRXH.js +362 -0
  102. package/dist/cli-bundle/chunks/chunk-U7FMKRXH.js.map +7 -0
  103. package/dist/cli-bundle/chunks/chunk-VGICHR7D.js +141 -0
  104. package/dist/cli-bundle/chunks/chunk-VGICHR7D.js.map +7 -0
  105. package/dist/cli-bundle/chunks/chunk-WDPXDQFG.js +632 -0
  106. package/dist/cli-bundle/chunks/chunk-WDPXDQFG.js.map +7 -0
  107. package/dist/cli-bundle/chunks/chunk-WJ2NAC37.js +252 -0
  108. package/dist/cli-bundle/chunks/chunk-WJ2NAC37.js.map +7 -0
  109. package/dist/cli-bundle/chunks/claim-EE4TKKCV.js +133 -0
  110. package/dist/cli-bundle/chunks/claim-EE4TKKCV.js.map +7 -0
  111. package/dist/cli-bundle/chunks/close-XY4CSAYF.js +14 -0
  112. package/dist/cli-bundle/chunks/close-XY4CSAYF.js.map +7 -0
  113. package/dist/cli-bundle/chunks/comments-AAKJQ6LW.js +104 -0
  114. package/dist/cli-bundle/chunks/comments-AAKJQ6LW.js.map +7 -0
  115. package/dist/cli-bundle/chunks/config-V3FZOKLI.js +1577 -0
  116. package/dist/cli-bundle/chunks/config-V3FZOKLI.js.map +7 -0
  117. package/dist/cli-bundle/chunks/context-RZ5QPNJB.js +1458 -0
  118. package/dist/cli-bundle/chunks/context-RZ5QPNJB.js.map +7 -0
  119. package/dist/cli-bundle/chunks/contracts-YLMH33VU.js +1245 -0
  120. package/dist/cli-bundle/chunks/contracts-YLMH33VU.js.map +7 -0
  121. package/dist/cli-bundle/chunks/create-PZVHRIZQ.js +28 -0
  122. package/dist/cli-bundle/chunks/create-PZVHRIZQ.js.map +7 -0
  123. package/dist/cli-bundle/chunks/delete-RHCTEORS.js +59 -0
  124. package/dist/cli-bundle/chunks/delete-RHCTEORS.js.map +7 -0
  125. package/dist/cli-bundle/chunks/deps-MZYCMLAO.js +229 -0
  126. package/dist/cli-bundle/chunks/deps-MZYCMLAO.js.map +7 -0
  127. package/dist/cli-bundle/chunks/docs-FXXUCZYU.js +35 -0
  128. package/dist/cli-bundle/chunks/docs-FXXUCZYU.js.map +7 -0
  129. package/dist/cli-bundle/chunks/extension-B4WL7BQU.js +25 -0
  130. package/dist/cli-bundle/chunks/extension-B4WL7BQU.js.map +7 -0
  131. package/dist/cli-bundle/chunks/files-WVOX67PE.js +286 -0
  132. package/dist/cli-bundle/chunks/files-WVOX67PE.js.map +7 -0
  133. package/dist/cli-bundle/chunks/gc-JWNF66EC.js +181 -0
  134. package/dist/cli-bundle/chunks/gc-JWNF66EC.js.map +7 -0
  135. package/dist/cli-bundle/chunks/get-LTK3HOCQ.js +198 -0
  136. package/dist/cli-bundle/chunks/get-LTK3HOCQ.js.map +7 -0
  137. package/dist/cli-bundle/chunks/health-TCWL55KM.js +1233 -0
  138. package/dist/cli-bundle/chunks/health-TCWL55KM.js.map +7 -0
  139. package/dist/cli-bundle/chunks/history-A2JUDXUE.js +21 -0
  140. package/dist/cli-bundle/chunks/history-A2JUDXUE.js.map +7 -0
  141. package/dist/cli-bundle/chunks/history-redact-ED6RFCPL.js +20 -0
  142. package/dist/cli-bundle/chunks/history-redact-ED6RFCPL.js.map +7 -0
  143. package/dist/cli-bundle/chunks/history-repair-ZWSTDRH2.js +198 -0
  144. package/dist/cli-bundle/chunks/history-repair-ZWSTDRH2.js.map +7 -0
  145. package/dist/cli-bundle/chunks/init-M2WUB4YH.js +16 -0
  146. package/dist/cli-bundle/chunks/init-M2WUB4YH.js.map +7 -0
  147. package/dist/cli-bundle/chunks/learnings-NXTWE3FR.js +48 -0
  148. package/dist/cli-bundle/chunks/learnings-NXTWE3FR.js.map +7 -0
  149. package/dist/cli-bundle/chunks/list-OGWQPC26.js +20 -0
  150. package/dist/cli-bundle/chunks/list-OGWQPC26.js.map +7 -0
  151. package/dist/cli-bundle/chunks/notes-DFS5ZGOO.js +48 -0
  152. package/dist/cli-bundle/chunks/notes-DFS5ZGOO.js.map +7 -0
  153. package/dist/cli-bundle/chunks/plan-67AB2PLM.js +1175 -0
  154. package/dist/cli-bundle/chunks/plan-67AB2PLM.js.map +7 -0
  155. package/dist/cli-bundle/chunks/{register-list-query-EIVQ5FMR.js → register-list-query-UP3VRUFS.js} +24 -15
  156. package/dist/cli-bundle/chunks/register-list-query-UP3VRUFS.js.map +7 -0
  157. package/dist/cli-bundle/chunks/{register-mutation-RSZNPSGI.js → register-mutation-YWSBF545.js} +38 -28
  158. package/dist/cli-bundle/chunks/register-mutation-YWSBF545.js.map +7 -0
  159. package/dist/cli-bundle/chunks/{register-operations-APUSYDMR.js → register-operations-3BDTGSDH.js} +49 -30
  160. package/dist/cli-bundle/chunks/register-operations-3BDTGSDH.js.map +7 -0
  161. package/dist/cli-bundle/chunks/{register-setup-OZOKSMPJ.js → register-setup-V56GDRUS.js} +21 -12
  162. package/dist/cli-bundle/chunks/register-setup-V56GDRUS.js.map +7 -0
  163. package/dist/cli-bundle/chunks/restore-MB2ISME7.js +18 -0
  164. package/dist/cli-bundle/chunks/restore-MB2ISME7.js.map +7 -0
  165. package/dist/cli-bundle/chunks/schema-Q622KC46.js +119 -0
  166. package/dist/cli-bundle/chunks/schema-Q622KC46.js.map +7 -0
  167. package/dist/cli-bundle/chunks/search-HENBL456.js +1135 -0
  168. package/dist/cli-bundle/chunks/search-HENBL456.js.map +7 -0
  169. package/dist/cli-bundle/chunks/stats-N6H3YP2F.js +124 -0
  170. package/dist/cli-bundle/chunks/stats-N6H3YP2F.js.map +7 -0
  171. package/dist/cli-bundle/chunks/test-VNBDRJ4Z.js +32 -0
  172. package/dist/cli-bundle/chunks/test-VNBDRJ4Z.js.map +7 -0
  173. package/dist/cli-bundle/chunks/test-all-G2AZOHXI.js +332 -0
  174. package/dist/cli-bundle/chunks/test-all-G2AZOHXI.js.map +7 -0
  175. package/dist/cli-bundle/chunks/test-runs-GX5HTPSF.js +939 -0
  176. package/dist/cli-bundle/chunks/test-runs-GX5HTPSF.js.map +7 -0
  177. package/dist/cli-bundle/chunks/update-H6SCWNMA.js +22 -0
  178. package/dist/cli-bundle/chunks/update-H6SCWNMA.js.map +7 -0
  179. package/dist/cli-bundle/chunks/update-many-46HRSP2Q.js +676 -0
  180. package/dist/cli-bundle/chunks/update-many-46HRSP2Q.js.map +7 -0
  181. package/dist/cli-bundle/chunks/upgrade-H5HHM5UV.js +271 -0
  182. package/dist/cli-bundle/chunks/upgrade-H5HHM5UV.js.map +7 -0
  183. package/dist/cli-bundle/chunks/validate-TMCVKIGZ.js +1110 -0
  184. package/dist/cli-bundle/chunks/validate-TMCVKIGZ.js.map +7 -0
  185. package/dist/cli-bundle/main.js +146 -90
  186. package/dist/cli-bundle/main.js.map +4 -4
  187. package/dist/core/item/item-type-definition.js +6 -2
  188. package/dist/core/item/item-type-definition.js.map +1 -1
  189. package/dist/core/item/type-registry.d.ts +4 -0
  190. package/dist/core/item/type-registry.js +10 -2
  191. package/dist/core/item/type-registry.js.map +1 -1
  192. package/dist/core/search/background-refresh.d.ts +53 -0
  193. package/dist/core/search/background-refresh.js +286 -0
  194. package/dist/core/search/background-refresh.js.map +1 -0
  195. package/dist/core/search/cache.d.ts +20 -1
  196. package/dist/core/search/cache.js +33 -4
  197. package/dist/core/search/cache.js.map +1 -1
  198. package/dist/core/search/vector-stores.js +7 -3
  199. package/dist/core/search/vector-stores.js.map +1 -1
  200. package/dist/core/shared/constants.d.ts +2 -2
  201. package/dist/core/shared/constants.js +2 -3
  202. package/dist/core/shared/constants.js.map +1 -1
  203. package/dist/core/store/item-format-migration.js +25 -15
  204. package/dist/core/store/item-format-migration.js.map +1 -1
  205. package/dist/core/store/settings-validator.js +6 -2
  206. package/dist/core/store/settings-validator.js.map +1 -1
  207. package/dist/core/telemetry/runtime.d.ts +10 -0
  208. package/dist/core/telemetry/runtime.js +86 -2
  209. package/dist/core/telemetry/runtime.js.map +1 -1
  210. package/dist/sdk/cli-contracts/tool-parameter-tables.js +4 -4
  211. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  212. package/dist/sdk/cli-contracts.js +26 -5
  213. package/dist/sdk/cli-contracts.js.map +1 -1
  214. package/dist/types.d.ts +7 -1
  215. package/dist/types.js +2 -2
  216. package/dist/types.js.map +1 -1
  217. package/docs/RELEASING.md +1 -1
  218. package/package.json +1 -2
  219. package/dist/cli-bundle/chunks/chunk-PB2YU2E3.js.map +0 -7
  220. package/dist/cli-bundle/chunks/chunk-RJONRNXN.js.map +0 -7
  221. package/dist/cli-bundle/chunks/chunk-SW5BMMCU.js +0 -13864
  222. package/dist/cli-bundle/chunks/chunk-SW5BMMCU.js.map +0 -7
  223. package/dist/cli-bundle/chunks/commands-XJ4TJ5UN.js +0 -24225
  224. package/dist/cli-bundle/chunks/commands-XJ4TJ5UN.js.map +0 -7
  225. package/dist/cli-bundle/chunks/register-list-query-EIVQ5FMR.js.map +0 -7
  226. package/dist/cli-bundle/chunks/register-mutation-RSZNPSGI.js.map +0 -7
  227. package/dist/cli-bundle/chunks/register-operations-APUSYDMR.js.map +0 -7
  228. package/dist/cli-bundle/chunks/register-setup-OZOKSMPJ.js.map +0 -7
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../../cli/commands/plan.ts"],
4
+ "sourcesContent": ["import { pathExists } from \"../../core/fs/fs-utils.js\";\nimport { getActiveExtensionRegistrations } from \"../../core/extensions/index.js\";\nimport { resolveItemTypeRegistry, resolveTypeName } from \"../../core/item/type-registry.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { splitCommaList } from \"../../core/shared/split-comma-list.js\";\nimport { nowIso } from \"../../core/shared/time.js\";\nimport { locateItem, mutateItem, readLocatedItem } from \"../../core/store/item-store.js\";\nimport { getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\nimport type {\n DependencyKind,\n ItemDocument,\n ItemMetadata,\n PlanDecision,\n PlanDiscovery,\n PlanHarness,\n PlanMode,\n PlanStep,\n PlanStepDoc,\n PlanStepFile,\n PlanStepLink,\n PlanStepLinkKind,\n PlanStepStatus,\n PlanStepTest,\n PlanValidationCheck,\n} from \"../../types/index.js\";\nimport {\n PLAN_HARNESS_VALUES,\n PLAN_MODE_VALUES,\n PLAN_STEP_LINK_KIND_VALUES,\n PLAN_STEP_STATUS_VALUES,\n} from \"../../types/index.js\";\nimport { runCreate, type CreateCommandOptions, type CreateResult } from \"./create.js\";\n\nexport const PLAN_SUBCOMMANDS = [\n \"create\",\n \"show\",\n \"add-step\",\n \"update-step\",\n \"complete-step\",\n \"block-step\",\n \"reorder-step\",\n \"remove-step\",\n \"link\",\n \"unlink\",\n \"decision\",\n \"discovery\",\n \"validation\",\n \"resume\",\n \"approve\",\n \"materialize\",\n] as const;\nexport type PlanSubcommand = (typeof PLAN_SUBCOMMANDS)[number];\n\nexport const PLAN_SHOW_DEPTH_VALUES = [\"brief\", \"standard\", \"deep\"] as const;\nexport type PlanShowDepth = (typeof PLAN_SHOW_DEPTH_VALUES)[number];\n\nexport interface PlanCommandOptions {\n title?: string;\n description?: string;\n scope?: string;\n parent?: string;\n related?: string | string[];\n blocks?: string | string[];\n blockedBy?: string | string[];\n harness?: string;\n mode?: string;\n resumeContext?: string;\n tags?: string;\n priority?: string;\n body?: string;\n claim?: boolean;\n fromSearch?: string;\n stepTitle?: string;\n stepBody?: string;\n stepOwner?: string;\n stepStatus?: string;\n stepEvidence?: string;\n stepBlockedReason?: string;\n stepReplacement?: string;\n dependsOn?: string | string[];\n link?: string | string[];\n linkKind?: string;\n linkNote?: string;\n promoteToItemDep?: boolean;\n allowMultipleActive?: boolean;\n file?: string | string[];\n test?: string | string[];\n doc?: string | string[];\n decisionText?: string;\n decision?: string;\n decisionRationale?: string;\n decisionEvidence?: string;\n discoveryText?: string;\n discovery?: string;\n validationText?: string;\n validation?: string;\n validationCommand?: string;\n validationExpected?: string;\n depth?: string;\n fields?: string;\n steps?: string;\n materializeType?: string;\n materializeParent?: string;\n materializeTags?: string;\n author?: string;\n message?: string;\n force?: boolean;\n}\n\nexport interface PlanCommandResult {\n action: PlanSubcommand;\n plan: PlanResultPlan;\n step?: PlanStep;\n current_step?: PlanStep | undefined;\n next_actions?: string[];\n materialized?: { id: string; type: string; from_step: string }[];\n // pm-fl0c #10 (2026-05-28): steps that pm plan materialize intentionally\n // skipped (already-completed or already-materialized via an `implements`\n // link). Surfacing these makes `--steps all` idempotent without users\n // having to read history to find out what was done.\n materialize_skipped?: { from_step: string; reason: \"already_completed\" | \"already_materialized\"; existing_id?: string }[];\n warnings: string[];\n generated_at: string;\n}\n\nexport interface PlanResultPlan {\n id: string;\n title: string;\n status: string;\n mode: PlanMode;\n scope?: string;\n harness?: PlanHarness;\n parent?: string;\n resume_context?: string;\n steps_summary: PlanStepSummary;\n current_step?: { id: string; order: number; title: string; status: PlanStepStatus } | undefined;\n blocked_steps?: { id: string; order: number; title: string; blocked_reason?: string }[];\n steps?: PlanStep[];\n decisions?: PlanDecision[];\n discoveries?: PlanDiscovery[];\n validation?: PlanValidationCheck[];\n linked_items?: { id: string; kind: DependencyKind }[];\n}\n\nexport interface PlanStepSummary {\n total: number;\n pending: number;\n in_progress: number;\n blocked: number;\n completed: number;\n skipped: number;\n superseded: number;\n}\n\nconst STEP_ID_PREFIX = \"plan-step-\";\nconst DEFAULT_PLAN_MODE: PlanMode = \"draft\";\n\nfunction resolveAuthor(candidate: string | undefined, fallback: string): string {\n const resolved = candidate ?? process.env.PM_AUTHOR ?? fallback;\n const trimmed = resolved.trim();\n return trimmed.length > 0 ? trimmed : \"unknown\";\n}\n\nfunction toArray(value: string | string[] | undefined): string[] {\n if (Array.isArray(value)) return value.flatMap((entry) => splitCommaList(entry, { unique: false }));\n if (typeof value === \"string\" && value.trim().length > 0) {\n return splitCommaList(value, { unique: false });\n }\n return [];\n}\n\nfunction toSpecArray(value: string | string[] | undefined): string[] {\n if (Array.isArray(value)) return value.map((entry) => entry.trim()).filter(Boolean);\n if (typeof value === \"string\" && value.trim().length > 0) return [value.trim()];\n return [];\n}\n\nfunction asPlanMode(value: string | undefined, fallback: PlanMode = DEFAULT_PLAN_MODE): PlanMode {\n if (value === undefined) return fallback;\n const normalized = value.trim().toLowerCase();\n const found = PLAN_MODE_VALUES.find((entry) => entry === normalized);\n if (!found) {\n throw new PmCliError(\n `Invalid plan mode \"${value}\". Allowed: ${PLAN_MODE_VALUES.join(\", \")}`,\n EXIT_CODE.USAGE,\n );\n }\n return found;\n}\n\nfunction asStepStatus(value: string | undefined, fallback: PlanStepStatus = \"pending\"): PlanStepStatus {\n if (value === undefined) return fallback;\n const normalized = value.trim().toLowerCase();\n const found = PLAN_STEP_STATUS_VALUES.find((entry) => entry === normalized);\n if (!found) {\n throw new PmCliError(\n `Invalid step status \"${value}\". Allowed: ${PLAN_STEP_STATUS_VALUES.join(\", \")}`,\n EXIT_CODE.USAGE,\n );\n }\n return found;\n}\n\nfunction asLinkKind(value: string | undefined, fallback: PlanStepLinkKind = \"related\"): PlanStepLinkKind {\n if (value === undefined) return fallback;\n const normalized = value.trim().toLowerCase();\n const found = PLAN_STEP_LINK_KIND_VALUES.find((entry) => entry === normalized);\n if (!found) {\n throw new PmCliError(\n `Invalid step link kind \"${value}\". Allowed: ${PLAN_STEP_LINK_KIND_VALUES.join(\", \")}`,\n EXIT_CODE.USAGE,\n );\n }\n return found;\n}\n\nfunction asHarness(value: string | undefined): PlanHarness | undefined {\n if (value === undefined) return undefined;\n const normalized = value.trim().toLowerCase();\n if (normalized.length === 0) return undefined;\n const found = PLAN_HARNESS_VALUES.find((entry) => entry === normalized);\n if (!found) {\n throw new PmCliError(\n `Invalid plan harness \"${value}\". Allowed: ${PLAN_HARNESS_VALUES.join(\", \")}`,\n EXIT_CODE.USAGE,\n );\n }\n return found;\n}\n\nfunction asDepth(value: string | undefined): PlanShowDepth {\n if (value === undefined) return \"brief\";\n const normalized = value.trim().toLowerCase();\n const found = PLAN_SHOW_DEPTH_VALUES.find((entry) => entry === normalized);\n if (!found) {\n throw new PmCliError(\n `Invalid --depth \"${value}\". Allowed: ${PLAN_SHOW_DEPTH_VALUES.join(\", \")}`,\n EXIT_CODE.USAGE,\n );\n }\n return found;\n}\n\nfunction parsePlanFields(raw: string | undefined): string[] | null {\n if (raw === undefined) {\n return null;\n }\n const fields = raw\n .split(\",\")\n .map((entry) => entry.trim())\n .filter((entry) => entry.length > 0);\n if (fields.length === 0) {\n throw new PmCliError(\"Plan --fields requires a comma-separated list of plan field names\", EXIT_CODE.USAGE);\n }\n return fields;\n}\n\nconst PLAN_FIELD_KEYS = new Set<keyof PlanResultPlan>([\n \"id\",\n \"title\",\n \"status\",\n \"mode\",\n \"scope\",\n \"harness\",\n \"parent\",\n \"resume_context\",\n \"steps_summary\",\n \"current_step\",\n \"blocked_steps\",\n \"steps\",\n \"decisions\",\n \"discoveries\",\n \"validation\",\n \"linked_items\",\n]);\n\nfunction projectPlanForFields(plan: PlanResultPlan, fields: string[]): PlanResultPlan {\n const source = plan as unknown as Record<string, unknown>;\n const projected: Record<string, unknown> = {};\n const unknownFields: string[] = [];\n for (const field of fields) {\n const normalized = field.startsWith(\"plan.\") ? field.slice(\"plan.\".length) : field;\n if (normalized.length === 0) {\n continue;\n }\n if (!PLAN_FIELD_KEYS.has(normalized as keyof PlanResultPlan)) {\n unknownFields.push(field);\n continue;\n }\n if (Object.prototype.hasOwnProperty.call(source, normalized)) {\n projected[normalized] = source[normalized];\n }\n }\n if (unknownFields.length > 0) {\n throw new PmCliError(`Unknown Plan --fields value(s): ${unknownFields.join(\", \")}`, EXIT_CODE.USAGE, {\n nextSteps: [\n `Use --fields ${[...PLAN_FIELD_KEYS].join(\",\")}`,\n \"Run pm plan show <id> --depth brief for compact default fields.\",\n ],\n recovery: {\n provided_fields: unknownFields,\n suggested_retry: `pm plan show <id> --fields ${[...PLAN_FIELD_KEYS].join(\",\")}`,\n },\n });\n }\n return projected as unknown as PlanResultPlan;\n}\n\nfunction parsePairList(raw: string, label: string): Record<string, string> {\n const out: Record<string, string> = {};\n for (const entry of raw.split(\",\")) {\n const trimmed = entry.trim();\n if (trimmed.length === 0) continue;\n const equalsIndex = trimmed.indexOf(\"=\");\n if (equalsIndex <= 0) {\n throw new PmCliError(`Invalid ${label} entry \"${trimmed}\"; expected key=value`, EXIT_CODE.USAGE);\n }\n out[trimmed.slice(0, equalsIndex).trim().toLowerCase()] = trimmed.slice(equalsIndex + 1).trim();\n }\n return out;\n}\n\nfunction parseStepFile(spec: string): PlanStepFile {\n const fields = parsePairList(spec, \"--file\");\n if (!fields.path) {\n throw new PmCliError(\"--file requires path=<value>\", EXIT_CODE.USAGE);\n }\n const file: PlanStepFile = { path: fields.path };\n if (fields.scope === \"global\" || fields.scope === \"project\") file.scope = fields.scope;\n if (fields.note) file.note = fields.note;\n return file;\n}\n\nfunction parseStepTest(spec: string): PlanStepTest {\n const fields = parsePairList(spec, \"--test\");\n if (!fields.command && !fields.path) {\n throw new PmCliError(\"--test requires at least command=<value> or path=<value>\", EXIT_CODE.USAGE);\n }\n const test: PlanStepTest = {};\n if (fields.command) test.command = fields.command;\n if (fields.path) test.path = fields.path;\n if (fields.note) test.note = fields.note;\n return test;\n}\n\nfunction parseStepDoc(spec: string): PlanStepDoc {\n const fields = parsePairList(spec, \"--doc\");\n if (!fields.path) {\n throw new PmCliError(\"--doc requires path=<value>\", EXIT_CODE.USAGE);\n }\n const doc: PlanStepDoc = { path: fields.path };\n if (fields.scope === \"global\" || fields.scope === \"project\") doc.scope = fields.scope;\n if (fields.note) doc.note = fields.note;\n return doc;\n}\n\nfunction summarizeSteps(steps: PlanStep[]): PlanStepSummary {\n const summary: PlanStepSummary = {\n total: steps.length,\n pending: 0,\n in_progress: 0,\n blocked: 0,\n completed: 0,\n skipped: 0,\n superseded: 0,\n };\n for (const step of steps) {\n summary[step.status] += 1;\n }\n return summary;\n}\n\nfunction newStepId(existing: PlanStep[]): string {\n const used = new Set(existing.map((step) => step.id));\n for (let cursor = existing.length + 1; cursor < existing.length + 1024; cursor += 1) {\n const candidate = `${STEP_ID_PREFIX}${String(cursor).padStart(3, \"0\")}`;\n if (!used.has(candidate)) return candidate;\n }\n /* c8 ignore next -- step id allocation only fails if 1024 consecutive ids are taken. */\n throw new PmCliError(\"Could not allocate step id (limit reached)\", EXIT_CODE.GENERIC_FAILURE);\n}\n\nfunction resolveStepRef(steps: PlanStep[], ref: string): PlanStep {\n const trimmed = ref.trim();\n if (trimmed.length === 0) {\n throw new PmCliError(\"Step reference cannot be empty\", EXIT_CODE.USAGE);\n }\n const direct = steps.find((step) => step.id === trimmed);\n if (direct) return direct;\n if (/^\\d+$/.test(trimmed)) {\n const order = Number.parseInt(trimmed, 10);\n const byOrder = steps.find((step) => step.order === order);\n if (byOrder) return byOrder;\n }\n throw new PmCliError(`Step \"${ref}\" not found in plan`, EXIT_CODE.NOT_FOUND);\n}\n\ninterface MaterializeTargetResolution {\n targets: PlanStep[];\n skipped: { from_step: string; reason: \"already_completed\" | \"already_materialized\"; existing_id?: string }[];\n}\n\n// pm-fl0c #10 (2026-05-28): skip steps whose status is \"completed\" and steps\n// that already have an `implements` link from a prior materialize run, so\n// `pm plan materialize --steps all` is idempotent and never re-creates fresh\n// Tasks for work already tracked. Explicit step refs are still allowed\n// through (the user asked by ID) but the skip-reason is recorded.\nfunction classifyMaterializeSkip(\n step: PlanStep,\n): { reason: \"already_completed\" | \"already_materialized\"; existing_id?: string } | undefined {\n if (step.status === \"completed\") {\n return { reason: \"already_completed\" };\n }\n const existingImplements = (step.linked_items ?? []).find((link) => link.kind === \"implements\");\n if (existingImplements) {\n return { reason: \"already_materialized\", existing_id: existingImplements.id };\n }\n return undefined;\n}\n\nfunction resolveMaterializeTargets(steps: PlanStep[], refs: string[]): MaterializeTargetResolution {\n const allRefs = refs.filter((ref) => ref.trim().toLowerCase() === \"all\");\n const targets: PlanStep[] = [];\n const skipped: { from_step: string; reason: \"already_completed\" | \"already_materialized\"; existing_id?: string }[] = [];\n if (allRefs.length > 0) {\n if (refs.length > allRefs.length) {\n throw new PmCliError(\"pm plan materialize --steps all cannot be combined with other step refs\", EXIT_CODE.USAGE);\n }\n for (const step of steps.slice().sort((left, right) => left.order - right.order)) {\n const skip = classifyMaterializeSkip(step);\n if (skip) {\n skipped.push({ from_step: step.id, ...skip });\n continue;\n }\n targets.push(step);\n }\n return { targets, skipped };\n }\n const seen = new Set<string>();\n for (const ref of refs) {\n const step = resolveStepRef(steps, ref);\n if (seen.has(step.id)) continue;\n seen.add(step.id);\n const skip = classifyMaterializeSkip(step);\n if (skip) {\n skipped.push({ from_step: step.id, ...skip });\n continue;\n }\n targets.push(step);\n }\n return { targets, skipped };\n}\n\nfunction resolvePlanLogText(kind: \"decision\" | \"discovery\" | \"validation\", options: PlanCommandOptions): string | undefined {\n const canonical =\n kind === \"decision\"\n ? options.decisionText\n : kind === \"discovery\"\n ? options.discoveryText\n : options.validationText;\n const shorthand =\n kind === \"decision\"\n ? options.decision\n : kind === \"discovery\"\n ? options.discovery\n : options.validation;\n return canonical?.trim() || shorthand?.trim() || undefined;\n}\n\nfunction findCurrentStep(steps: PlanStep[]): PlanStep | undefined {\n return steps.find((step) => step.status === \"in_progress\")\n ?? steps.find((step) => step.status === \"pending\");\n}\n\nfunction blockedSteps(steps: PlanStep[]): { id: string; order: number; title: string; blocked_reason?: string }[] {\n return steps\n .filter((step) => step.status === \"blocked\")\n .map((step) => ({ id: step.id, order: step.order, title: step.title, blocked_reason: step.blocked_reason }));\n}\n\nfunction projectPlan(item: ItemMetadata, depth: PlanShowDepth = \"brief\"): PlanResultPlan {\n const steps = (item.plan_steps ?? []).slice().sort((left, right) => left.order - right.order);\n const summary = summarizeSteps(steps);\n const current = findCurrentStep(steps);\n const projection: PlanResultPlan = {\n id: item.id,\n title: item.title,\n status: item.status,\n mode: (item.plan_mode ?? DEFAULT_PLAN_MODE) as PlanMode,\n scope: item.plan_scope,\n harness: item.plan_harness,\n parent: item.parent,\n resume_context: item.plan_resume_context,\n steps_summary: summary,\n current_step: current\n ? { id: current.id, order: current.order, title: current.title, status: current.status }\n : undefined,\n blocked_steps: blockedSteps(steps),\n linked_items: (item.dependencies ?? []).map((dep) => ({ id: dep.id, kind: dep.kind })),\n };\n if (depth === \"standard\" || depth === \"deep\") {\n projection.steps = steps;\n }\n if (depth === \"deep\") {\n projection.decisions = item.plan_decisions ?? [];\n projection.discoveries = item.plan_discoveries ?? [];\n projection.validation = item.plan_validation ?? [];\n }\n return projection;\n}\n\nfunction nextActionsFor(planId: string, plan: PlanResultPlan): string[] {\n const tips: string[] = [];\n if (plan.steps_summary.total === 0) {\n tips.push(`pm plan add-step ${planId} --step-title \"First step\"`);\n }\n if (plan.current_step) {\n tips.push(\n `pm plan update-step ${planId} ${plan.current_step.id} --step-status in_progress`,\n `pm plan complete-step ${planId} ${plan.current_step.id} --step-evidence \"...\"`,\n );\n }\n if (plan.steps_summary.blocked > 0) {\n tips.push(`pm plan show ${planId} --depth standard`);\n }\n if (plan.mode === \"draft\" || plan.mode === \"research\") {\n tips.push(`pm plan approve ${planId} --message \"ready to execute\"`);\n }\n if (plan.steps_summary.completed === plan.steps_summary.total && plan.steps_summary.total > 0) {\n tips.push(`pm close ${planId} \"plan complete\"`);\n }\n return tips;\n}\n\nfunction ensurePlanItem(item: ItemMetadata): void {\n const normalizedType = (item.type ?? \"\").trim().toLowerCase();\n if (normalizedType !== \"plan\") {\n throw new PmCliError(\n `Item ${item.id} is type ${item.type}; pm plan commands require type=Plan. Use pm plan create or pm create --type Plan first.`,\n EXIT_CODE.USAGE,\n {\n code: \"wrong_item_type\",\n required: \"Use pm plan commands only with items whose type is Plan.\",\n why: \"Plan commands read and mutate Plan-specific step, decision, discovery, and validation fields.\",\n examples: [\n `pm get ${item.id} --depth brief`,\n 'pm plan create --title \"Execution plan\" --scope \"<goal>\"',\n ],\n },\n );\n }\n}\n\ninterface PlanWriteContext {\n pmRoot: string;\n settings: Awaited<ReturnType<typeof readSettings>>;\n}\n\nasync function loadContext(global: GlobalOptions): Promise<PlanWriteContext> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);\n }\n const settings = await readSettings(pmRoot);\n return { pmRoot, settings };\n}\n\nasync function readPlanItem(ctx: PlanWriteContext, id: string): Promise<{ document: ItemDocument; itemId: string }> {\n const typeRegistry = resolveItemTypeRegistry(ctx.settings, getActiveExtensionRegistrations());\n const located = await locateItem(ctx.pmRoot, id, ctx.settings.id_prefix, ctx.settings.item_format, typeRegistry.type_to_folder);\n if (!located) {\n throw new PmCliError(`Plan ${id} not found`, EXIT_CODE.NOT_FOUND);\n }\n const loaded = await readLocatedItem(located, { schema: ctx.settings.schema });\n ensurePlanItem(loaded.document.metadata);\n return { document: loaded.document, itemId: located.id };\n}\n\nasync function planCreate(\n options: PlanCommandOptions,\n global: GlobalOptions,\n ctx: PlanWriteContext,\n): Promise<PlanCommandResult> {\n const title = options.title?.trim();\n if (!title) {\n throw new PmCliError(\"pm plan create requires --title\", EXIT_CODE.USAGE, {\n code: \"missing_required_option\",\n examples: ['pm plan create --title \"Refactor lock retry\" --scope pm-a1b2'],\n });\n }\n const mode = asPlanMode(options.mode, DEFAULT_PLAN_MODE);\n const harness = asHarness(options.harness);\n const fromSearch = options.fromSearch?.trim();\n\n const related = toArray(options.related);\n const blocks = toArray(options.blocks);\n const blockedBy = toArray(options.blockedBy);\n\n const deps: string[] = [];\n if (options.parent) {\n deps.push(`id=${options.parent.trim()},kind=parent`);\n }\n for (const ref of related) deps.push(`id=${ref},kind=related`);\n for (const ref of blocks) deps.push(`id=${ref},kind=blocks`);\n for (const ref of blockedBy) deps.push(`id=${ref},kind=blocked_by`);\n\n const description = options.description?.trim() ?? options.scope?.trim() ?? title;\n const createOptions: CreateCommandOptions = {\n title,\n description,\n type: \"Plan\",\n body: options.body,\n tags: options.tags,\n priority: options.priority,\n parent: options.parent,\n dep: deps.length > 0 ? deps : undefined,\n author: options.author,\n message: options.message ?? (fromSearch ? `plan create (search: ${fromSearch})` : `plan create`),\n };\n\n const createResult: CreateResult = await runCreate(createOptions, global);\n\n // The create command stores type_options. To use real metadata keys, run a follow-up mutate.\n const seedResult = await mutateItem({\n pmRoot: ctx.pmRoot,\n settings: ctx.settings,\n id: createResult.item.id,\n op: \"plan_create_metadata\",\n author: resolveAuthor(options.author, ctx.settings.author_default),\n message: \"seed plan metadata\",\n mutate(doc) {\n const changed: string[] = [];\n doc.metadata.plan_mode = mode;\n changed.push(\"plan_mode\");\n if (harness) {\n doc.metadata.plan_harness = harness;\n changed.push(\"plan_harness\");\n }\n if (options.scope?.trim()) {\n doc.metadata.plan_scope = options.scope.trim();\n changed.push(\"plan_scope\");\n }\n if (options.resumeContext?.trim()) {\n doc.metadata.plan_resume_context = options.resumeContext.trim();\n changed.push(\"plan_resume_context\");\n }\n doc.metadata.plan_steps = doc.metadata.plan_steps ?? [];\n return { changedFields: changed };\n },\n });\n\n let finalMetadata: ItemMetadata = seedResult.item as unknown as ItemMetadata;\n let initialStep: PlanStep | undefined;\n const initialValidationText = options.validationText?.trim();\n const initialValidationCommand = options.validationCommand?.trim();\n const initialValidationExpected = options.validationExpected?.trim();\n const initialValidation =\n initialValidationText || initialValidationCommand || initialValidationExpected\n ? ({\n text: initialValidationText || initialValidationCommand || \"Validation check\",\n command: initialValidationCommand || undefined,\n expected: initialValidationExpected || undefined,\n } satisfies PlanValidationCheck)\n : undefined;\n if (options.stepTitle?.trim()) {\n const status = asStepStatus(options.stepStatus, \"pending\");\n const linkedItems = buildLinkInputs(options, \"depends_on\");\n const files = toSpecArray(options.file).map(parseStepFile);\n const tests = toSpecArray(options.test).map(parseStepTest);\n const docs = toSpecArray(options.doc).map(parseStepDoc);\n const now = nowIso();\n initialStep = {\n id: \"plan-step-001\",\n order: 1,\n title: options.stepTitle.trim(),\n body: options.stepBody?.trim() || undefined,\n status,\n owner: options.stepOwner?.trim() || undefined,\n evidence: options.stepEvidence?.trim() || undefined,\n blocked_reason: status === \"blocked\" ? options.stepBlockedReason?.trim() || \"\" : undefined,\n linked_items: linkedItems.length > 0 ? linkedItems : undefined,\n files: files.length > 0 ? files : undefined,\n tests: tests.length > 0 ? tests : undefined,\n docs: docs.length > 0 ? docs : undefined,\n created_at: now,\n updated_at: now,\n completed_at: status === \"completed\" ? now : undefined,\n };\n const stepped = await mutateItem({\n pmRoot: ctx.pmRoot,\n settings: ctx.settings,\n id: createResult.item.id,\n op: \"plan_create_initial_step\",\n author: resolveAuthor(options.author, ctx.settings.author_default),\n message: `plan create initial step \"${initialStep.title}\"`,\n mutate(doc) {\n ensurePlanItem(doc.metadata);\n doc.metadata.plan_steps = [initialStep as PlanStep];\n if (initialValidation) {\n doc.metadata.plan_validation = [...(doc.metadata.plan_validation ?? []), initialValidation];\n }\n return { changedFields: initialValidation ? [\"plan_steps\", \"plan_validation\"] : [\"plan_steps\"] };\n },\n });\n finalMetadata = stepped.item as unknown as ItemMetadata;\n } else if (initialValidation) {\n const validated = await mutateItem({\n pmRoot: ctx.pmRoot,\n settings: ctx.settings,\n id: createResult.item.id,\n op: \"plan_create_initial_validation\",\n author: resolveAuthor(options.author, ctx.settings.author_default),\n message: \"plan create initial validation\",\n mutate(doc) {\n ensurePlanItem(doc.metadata);\n doc.metadata.plan_validation = [...(doc.metadata.plan_validation ?? []), initialValidation];\n return { changedFields: [\"plan_validation\"] };\n },\n });\n finalMetadata = validated.item as unknown as ItemMetadata;\n } else if (\n options.stepBody?.trim() ||\n options.stepOwner?.trim() ||\n options.stepStatus?.trim() ||\n options.stepEvidence?.trim() ||\n options.stepBlockedReason?.trim() ||\n options.stepReplacement?.trim() ||\n toArray(options.dependsOn).length > 0 ||\n toArray(options.link).length > 0 ||\n toSpecArray(options.file).length > 0 ||\n toSpecArray(options.test).length > 0 ||\n toSpecArray(options.doc).length > 0\n ) {\n throw new PmCliError(\"pm plan create step options require --step-title\", EXIT_CODE.USAGE, {\n code: \"missing_required_option\",\n examples: ['pm plan create --title \"Execution plan\" --step-title \"Read the code\"'],\n });\n }\n if (options.claim) {\n const claimed = await mutateItem({\n pmRoot: ctx.pmRoot,\n settings: ctx.settings,\n id: createResult.item.id,\n op: \"claim\",\n author: resolveAuthor(options.author, ctx.settings.author_default),\n message: \"plan claim by author\",\n mutate(doc) {\n doc.metadata.assignee = resolveAuthor(options.author, ctx.settings.author_default);\n return { changedFields: [\"assignee\"] };\n },\n });\n finalMetadata = claimed.item as unknown as ItemMetadata;\n }\n\n const plan = projectPlan(finalMetadata, \"brief\");\n return {\n action: \"create\",\n plan,\n step: initialStep,\n next_actions: nextActionsFor(createResult.item.id, plan),\n warnings: [...createResult.warnings],\n generated_at: nowIso(),\n };\n}\n\nasync function planShow(\n id: string,\n options: PlanCommandOptions,\n ctx: PlanWriteContext,\n): Promise<PlanCommandResult> {\n const depth = asDepth(options.depth);\n const fields = parsePlanFields(options.fields);\n const { document, itemId } = await readPlanItem(ctx, id);\n const fullPlan = projectPlan(document.metadata, fields === null ? depth : \"deep\");\n const plan = fields === null ? fullPlan : projectPlanForFields(fullPlan, fields);\n return {\n action: \"show\",\n plan,\n next_actions: nextActionsFor(itemId, fullPlan),\n warnings: [],\n generated_at: nowIso(),\n };\n}\n\ninterface MutateStepArgs {\n id: string;\n options: PlanCommandOptions;\n ctx: PlanWriteContext;\n op: string;\n message: string;\n mutator(steps: PlanStep[], doc: ItemDocument): { changedSteps: string[]; current?: PlanStep; resultStep?: PlanStep };\n}\n\nasync function mutatePlanSteps(args: MutateStepArgs): Promise<{ document: ItemDocument; resultStep?: PlanStep; itemId: string }> {\n const author = resolveAuthor(args.options.author, args.ctx.settings.author_default);\n let resultStep: PlanStep | undefined;\n const result = await mutateItem({\n pmRoot: args.ctx.pmRoot,\n settings: args.ctx.settings,\n id: args.id,\n op: args.op,\n author,\n message: args.options.message ?? args.message,\n force: args.options.force,\n mutate(doc) {\n ensurePlanItem(doc.metadata);\n const steps = (doc.metadata.plan_steps ?? []).slice();\n const before = JSON.stringify(steps);\n const outcome = args.mutator(steps, doc);\n resultStep = outcome.resultStep;\n const sorted = steps\n .slice()\n .sort((left, right) => left.order - right.order)\n .map((step, index) => ({ ...step, order: index + 1 }));\n doc.metadata.plan_steps = sorted;\n const after = JSON.stringify(sorted);\n const changedFields = before === after ? [] : [\"plan_steps\"];\n if (changedFields.length === 0 && outcome.changedSteps.length === 0) {\n return { changedFields: [] };\n }\n return { changedFields: changedFields.length > 0 ? changedFields : [\"plan_steps\"] };\n },\n });\n return {\n document: { metadata: result.item as unknown as ItemMetadata, body: result.body },\n resultStep,\n itemId: result.item.id,\n };\n}\n\nasync function planAddStep(\n id: string,\n options: PlanCommandOptions,\n ctx: PlanWriteContext,\n): Promise<PlanCommandResult> {\n const title = options.stepTitle?.trim();\n if (!title) {\n throw new PmCliError(\"pm plan add-step requires --step-title\", EXIT_CODE.USAGE);\n }\n const status = asStepStatus(options.stepStatus, \"pending\");\n const allowMultipleActive = options.allowMultipleActive === true;\n\n const linkedItems = buildLinkInputs(options, \"depends_on\");\n\n const files = toSpecArray(options.file).map(parseStepFile);\n const tests = toSpecArray(options.test).map(parseStepTest);\n const docs = toSpecArray(options.doc).map(parseStepDoc);\n\n const { document, resultStep, itemId } = await mutatePlanSteps({\n id,\n options,\n ctx,\n op: \"plan_add_step\",\n message: `plan add-step \"${title}\"`,\n mutator(steps) {\n const order = steps.length + 1;\n if (status === \"in_progress\" && !allowMultipleActive) {\n for (const step of steps) {\n if (step.status === \"in_progress\") {\n throw new PmCliError(\n `Plan already has step ${step.id} in_progress. Pass --allow-multiple-active or update that step first.`,\n EXIT_CODE.CONFLICT,\n );\n }\n }\n }\n const now = nowIso();\n const step: PlanStep = {\n id: newStepId(steps),\n order,\n title,\n body: options.stepBody?.trim() || undefined,\n status,\n owner: options.stepOwner?.trim() || undefined,\n evidence: options.stepEvidence?.trim() || undefined,\n blocked_reason: status === \"blocked\" ? options.stepBlockedReason?.trim() || \"\" : undefined,\n linked_items: linkedItems.length > 0 ? linkedItems : undefined,\n files: files.length > 0 ? files : undefined,\n tests: tests.length > 0 ? tests : undefined,\n docs: docs.length > 0 ? docs : undefined,\n created_at: now,\n updated_at: now,\n completed_at: status === \"completed\" ? now : undefined,\n };\n steps.push(step);\n return { changedSteps: [step.id], resultStep: step };\n },\n });\n\n const plan = projectPlan(document.metadata, \"standard\");\n return {\n action: \"add-step\",\n plan,\n step: resultStep,\n next_actions: nextActionsFor(itemId, plan),\n warnings: [],\n generated_at: nowIso(),\n };\n}\n\nfunction buildLinkInputs(options: PlanCommandOptions, fallbackKind: PlanStepLinkKind): PlanStepLink[] {\n const dependsOn = toArray(options.dependsOn).map((id) => ({ id, kind: fallbackKind } as PlanStepLink));\n const related = toArray(options.related).map((id) => ({ id, kind: \"related\" } as PlanStepLink));\n const blocks = toArray(options.blocks).map((id) => ({ id, kind: \"blocks\" } as PlanStepLink));\n const blockedBy = toArray(options.blockedBy).map((id) => ({ id, kind: \"blocked_by\" } as PlanStepLink));\n const explicit = toArray(options.link);\n const explicitKind = asLinkKind(options.linkKind, fallbackKind);\n const note = options.linkNote?.trim();\n const explicitLinks = explicit.map((id) => {\n const link: PlanStepLink = { id, kind: explicitKind };\n if (note) link.note = note;\n return link;\n });\n return [...dependsOn, ...related, ...blocks, ...blockedBy, ...explicitLinks];\n}\n\nasync function planUpdateStep(\n id: string,\n options: PlanCommandOptions,\n ctx: PlanWriteContext,\n args: { stepRef: string; finalStatus?: PlanStepStatus; op: string; allowMultipleActive?: boolean },\n): Promise<PlanCommandResult> {\n const { document, resultStep, itemId } = await mutatePlanSteps({\n id,\n options,\n ctx,\n op: args.op,\n message: options.message ?? `${args.op} ${args.stepRef}`,\n mutator(steps, doc) {\n const step = resolveStepRef(steps, args.stepRef);\n const now = nowIso();\n const desiredStatus = args.finalStatus ?? asStepStatus(options.stepStatus, step.status);\n if (desiredStatus === \"in_progress\" && step.status !== \"in_progress\" && !options.allowMultipleActive && !args.allowMultipleActive) {\n for (const other of steps) {\n if (other.id !== step.id && other.status === \"in_progress\") {\n throw new PmCliError(\n `Plan already has step ${other.id} in_progress. Pass --allow-multiple-active or update that step first.`,\n EXIT_CODE.CONFLICT,\n );\n }\n }\n }\n if (desiredStatus === \"blocked\" && !options.stepBlockedReason?.trim() && !step.blocked_reason) {\n throw new PmCliError(\n \"Blocking a step requires --step-blocked-reason or an already-recorded blocked_reason.\",\n EXIT_CODE.USAGE,\n );\n }\n if (options.stepTitle?.trim()) step.title = options.stepTitle.trim();\n if (options.stepBody !== undefined) step.body = options.stepBody.trim() || undefined;\n if (options.stepOwner !== undefined) step.owner = options.stepOwner.trim() || undefined;\n if (options.stepEvidence !== undefined) step.evidence = options.stepEvidence.trim() || undefined;\n if (options.stepBlockedReason !== undefined) step.blocked_reason = options.stepBlockedReason.trim() || undefined;\n if (options.stepReplacement !== undefined) step.superseded_by = options.stepReplacement.trim() || undefined;\n step.status = desiredStatus;\n step.updated_at = now;\n if (desiredStatus === \"completed\" && !step.completed_at) {\n step.completed_at = now;\n } else if (desiredStatus !== \"completed\") {\n step.completed_at = undefined;\n }\n doc.metadata.updated_at = now;\n return { changedSteps: [step.id], resultStep: step };\n },\n });\n const plan = projectPlan(document.metadata, \"standard\");\n return {\n action: args.op === \"plan_complete_step\" ? \"complete-step\" : args.op === \"plan_block_step\" ? \"block-step\" : \"update-step\",\n plan,\n step: resultStep,\n next_actions: nextActionsFor(itemId, plan),\n warnings: [],\n generated_at: nowIso(),\n };\n}\n\nasync function planReorderStep(\n id: string,\n options: PlanCommandOptions,\n ctx: PlanWriteContext,\n stepRef: string,\n newOrder: number,\n): Promise<PlanCommandResult> {\n const { document, itemId } = await mutatePlanSteps({\n id,\n options,\n ctx,\n op: \"plan_reorder_step\",\n message: options.message ?? `plan reorder-step ${stepRef} -> ${newOrder}`,\n mutator(steps) {\n const step = resolveStepRef(steps, stepRef);\n const filtered = steps.filter((entry) => entry.id !== step.id);\n const clamped = Math.max(1, Math.min(newOrder, filtered.length + 1));\n filtered.splice(clamped - 1, 0, step);\n filtered.forEach((entry, index) => {\n entry.order = index + 1;\n entry.updated_at = nowIso();\n });\n steps.length = 0;\n steps.push(...filtered);\n return { changedSteps: [step.id], resultStep: step };\n },\n });\n const plan = projectPlan(document.metadata, \"standard\");\n return {\n action: \"reorder-step\",\n plan,\n next_actions: nextActionsFor(itemId, plan),\n warnings: [],\n generated_at: nowIso(),\n };\n}\n\nasync function planRemoveStep(\n id: string,\n options: PlanCommandOptions,\n ctx: PlanWriteContext,\n stepRef: string,\n): Promise<PlanCommandResult> {\n const { document, itemId } = await mutatePlanSteps({\n id,\n options,\n ctx,\n op: \"plan_remove_step\",\n message: options.message ?? `plan remove-step ${stepRef}`,\n mutator(steps) {\n const step = resolveStepRef(steps, stepRef);\n const remaining = steps.filter((entry) => entry.id !== step.id);\n remaining.forEach((entry, index) => {\n entry.order = index + 1;\n });\n steps.length = 0;\n steps.push(...remaining);\n return { changedSteps: [step.id] };\n },\n });\n const plan = projectPlan(document.metadata, \"standard\");\n return {\n action: \"remove-step\",\n plan,\n next_actions: nextActionsFor(itemId, plan),\n warnings: [],\n generated_at: nowIso(),\n };\n}\n\nasync function planLink(\n id: string,\n options: PlanCommandOptions,\n ctx: PlanWriteContext,\n stepRef: string,\n): Promise<PlanCommandResult> {\n const newLinks = buildLinkInputs(options, asLinkKind(options.linkKind, \"related\"));\n if (newLinks.length === 0) {\n throw new PmCliError(\"pm plan link requires at least one --link/--related/--blocks/--blocked-by/--depends-on id\", EXIT_CODE.USAGE);\n }\n const promoteToItemDep = options.promoteToItemDep === true;\n const { document, itemId, resultStep } = await mutatePlanSteps({\n id,\n options,\n ctx,\n op: \"plan_link_step\",\n message: options.message ?? `plan link ${stepRef}`,\n mutator(steps, doc) {\n const step = resolveStepRef(steps, stepRef);\n const existing = step.linked_items ?? [];\n const dedupKey = (link: PlanStepLink) => `${link.kind}:${link.id}`;\n const seen = new Set(existing.map(dedupKey));\n for (const link of newLinks) {\n const key = dedupKey(link);\n if (seen.has(key)) continue;\n existing.push(link);\n seen.add(key);\n }\n step.linked_items = existing;\n step.updated_at = nowIso();\n if (promoteToItemDep) {\n const deps = doc.metadata.dependencies ?? [];\n const depKey = (dep: { id: string; kind: string }) => `${dep.kind}:${dep.id}`;\n const seenDeps = new Set(deps.map(depKey));\n for (const link of newLinks) {\n const candidate = {\n id: link.id,\n kind: link.kind as DependencyKind,\n created_at: nowIso(),\n author: resolveAuthor(options.author, ctx.settings.author_default),\n };\n if (seenDeps.has(depKey(candidate))) continue;\n deps.push(candidate);\n seenDeps.add(depKey(candidate));\n }\n doc.metadata.dependencies = deps;\n }\n return { changedSteps: [step.id], resultStep: step };\n },\n });\n const plan = projectPlan(document.metadata, \"standard\");\n return {\n action: \"link\",\n plan,\n step: resultStep,\n next_actions: nextActionsFor(itemId, plan),\n warnings: [],\n generated_at: nowIso(),\n };\n}\n\nasync function planUnlink(\n id: string,\n options: PlanCommandOptions,\n ctx: PlanWriteContext,\n stepRef: string,\n): Promise<PlanCommandResult> {\n const removeIds = toArray(options.link);\n if (removeIds.length === 0) {\n throw new PmCliError(\"pm plan unlink requires --link <id> to remove\", EXIT_CODE.USAGE);\n }\n const { document, itemId, resultStep } = await mutatePlanSteps({\n id,\n options,\n ctx,\n op: \"plan_unlink_step\",\n message: options.message ?? `plan unlink ${stepRef}`,\n mutator(steps) {\n const step = resolveStepRef(steps, stepRef);\n const filtered = (step.linked_items ?? []).filter((link) => !removeIds.includes(link.id));\n step.linked_items = filtered.length > 0 ? filtered : undefined;\n step.updated_at = nowIso();\n return { changedSteps: [step.id], resultStep: step };\n },\n });\n const plan = projectPlan(document.metadata, \"standard\");\n return {\n action: \"unlink\",\n plan,\n step: resultStep,\n next_actions: nextActionsFor(itemId, plan),\n warnings: [],\n generated_at: nowIso(),\n };\n}\n\nasync function planAppendLog(\n id: string,\n options: PlanCommandOptions,\n ctx: PlanWriteContext,\n kind: \"decision\" | \"discovery\" | \"validation\",\n): Promise<PlanCommandResult> {\n const logText = resolvePlanLogText(kind, options);\n if (!logText) {\n const canonical = `--${kind}-text`;\n const shorthand = `--${kind}`;\n throw new PmCliError(`pm plan ${kind} requires ${canonical}`, EXIT_CODE.USAGE, {\n code: \"missing_required_option\",\n examples: [\n `pm plan ${kind} <plan-id> ${canonical} \"...\"`,\n `pm plan ${kind} <plan-id> ${shorthand} \"...\"`,\n ],\n recovery: {\n suggested_retry: `pm plan ${kind} <plan-id> ${canonical} <value>`,\n },\n });\n }\n const author = resolveAuthor(options.author, ctx.settings.author_default);\n const { document, itemId } = await mutatePlanSteps({\n id,\n options,\n ctx,\n op: `plan_append_${kind}`,\n message: options.message ?? `plan ${kind} append`,\n mutator(_steps, doc) {\n const now = nowIso();\n if (kind === \"decision\") {\n const list = doc.metadata.plan_decisions ?? [];\n list.push({\n ts: now,\n author,\n decision: logText,\n rationale: options.decisionRationale?.trim() || undefined,\n evidence: options.decisionEvidence?.trim() || undefined,\n });\n doc.metadata.plan_decisions = list;\n return { changedSteps: [] };\n }\n if (kind === \"discovery\") {\n const list = doc.metadata.plan_discoveries ?? [];\n list.push({ ts: now, author, text: logText });\n doc.metadata.plan_discoveries = list;\n return { changedSteps: [] };\n }\n const list = doc.metadata.plan_validation ?? [];\n list.push({\n text: logText,\n command: options.validationCommand?.trim() || undefined,\n expected: options.validationExpected?.trim() || undefined,\n });\n doc.metadata.plan_validation = list;\n return { changedSteps: [] };\n },\n });\n const plan = projectPlan(document.metadata, \"deep\");\n return {\n action: kind,\n plan,\n next_actions: nextActionsFor(itemId, plan),\n warnings: [],\n generated_at: nowIso(),\n };\n}\n\nasync function planResume(\n id: string,\n options: PlanCommandOptions,\n ctx: PlanWriteContext,\n): Promise<PlanCommandResult> {\n const text = options.resumeContext?.trim();\n if (!text) {\n throw new PmCliError(\"pm plan resume requires --resume-context <text>\", EXIT_CODE.USAGE);\n }\n const { document, itemId } = await mutatePlanSteps({\n id,\n options,\n ctx,\n op: \"plan_resume\",\n message: options.message ?? \"plan resume context update\",\n mutator(_steps, doc) {\n doc.metadata.plan_resume_context = text;\n return { changedSteps: [] };\n },\n });\n const plan = projectPlan(document.metadata, \"brief\");\n return {\n action: \"resume\",\n plan,\n next_actions: nextActionsFor(itemId, plan),\n warnings: [],\n generated_at: nowIso(),\n };\n}\n\nasync function planApprove(\n id: string,\n options: PlanCommandOptions,\n ctx: PlanWriteContext,\n): Promise<PlanCommandResult> {\n const mode = asPlanMode(options.mode ?? \"approved\", \"approved\");\n const { document, itemId } = await mutatePlanSteps({\n id,\n options,\n ctx,\n op: \"plan_approve\",\n message: options.message ?? `plan approve mode=${mode}`,\n mutator(_steps, doc) {\n doc.metadata.plan_mode = mode;\n return { changedSteps: [] };\n },\n });\n const plan = projectPlan(document.metadata, \"brief\");\n return {\n action: \"approve\",\n plan,\n next_actions: nextActionsFor(itemId, plan),\n warnings: [],\n generated_at: nowIso(),\n };\n}\n\nasync function planMaterialize(\n id: string,\n options: PlanCommandOptions,\n ctx: PlanWriteContext,\n): Promise<PlanCommandResult> {\n const stepRefs = toArray(options.steps);\n if (stepRefs.length === 0) {\n throw new PmCliError(\"pm plan materialize requires --steps <ids|orders|all>\", EXIT_CODE.USAGE);\n }\n const targetType = options.materializeType?.trim() || \"Task\";\n const typeRegistry = resolveItemTypeRegistry(ctx.settings, getActiveExtensionRegistrations());\n const resolvedTypeName = resolveTypeName(targetType, typeRegistry);\n if (!resolvedTypeName) {\n throw new PmCliError(`Invalid --materialize-type \"${targetType}\"`, EXIT_CODE.USAGE);\n }\n const parent = options.materializeParent?.trim() || id;\n const tags = options.materializeTags;\n\n const planRead = await readPlanItem(ctx, id);\n const steps = (planRead.document.metadata.plan_steps ?? []).slice();\n const { targets, skipped: materializeSkipped } = resolveMaterializeTargets(steps, stepRefs);\n if (targets.length === 0) {\n if (materializeSkipped.length > 0) {\n // PR #78 / Gemini medium follow-up: when every selected step was\n // already materialized or completed, return a successful no-op\n // result (exit 0) instead of throwing NOT_FOUND. This makes\n // `pm plan materialize --steps all` truly idempotent for CI/agent\n // workflows; the skip reasons + warnings still surface what was\n // intentionally not redone.\n const plan = projectPlan(planRead.document.metadata, \"standard\");\n return {\n action: \"materialize\",\n plan,\n materialized: [],\n materialize_skipped: materializeSkipped,\n next_actions: nextActionsFor(planRead.itemId, plan),\n warnings: materializeSkipped.map(\n (entry) =>\n `plan_materialize_skipped:${entry.from_step}:${entry.reason}${entry.existing_id ? `:${entry.existing_id}` : \"\"}`,\n ),\n generated_at: nowIso(),\n };\n }\n throw new PmCliError(\"No matching plan steps found for --steps\", EXIT_CODE.NOT_FOUND);\n }\n\n const materialized: { id: string; type: string; from_step: string }[] = [];\n for (const step of targets) {\n const deps = [\n `id=${parent},kind=parent`,\n `id=${planRead.itemId},kind=discovered_from`,\n ];\n for (const link of step.linked_items ?? []) {\n const realKind: DependencyKind =\n link.kind === \"blocked_by\" || link.kind === \"blocks\" || link.kind === \"related\" || link.kind === \"discovered_from\"\n ? link.kind\n : \"related\";\n deps.push(`id=${link.id},kind=${realKind}`);\n }\n const created = await runCreate(\n {\n title: step.title,\n description: step.body?.trim() || step.title,\n type: resolvedTypeName,\n parent,\n tags,\n author: options.author,\n message: options.message ?? `materialized from plan ${planRead.itemId} step ${step.id}`,\n dep: deps,\n },\n ctx.settings ? { ...({} as GlobalOptions), path: ctx.pmRoot } as GlobalOptions : ({} as GlobalOptions),\n );\n materialized.push({ id: created.item.id, type: resolvedTypeName, from_step: step.id });\n }\n\n const { document, itemId } = await mutatePlanSteps({\n id,\n options,\n ctx,\n op: \"plan_materialize\",\n message: options.message ?? `plan materialize ${stepRefs.join(\",\")}`,\n mutator(currentSteps, doc) {\n for (const target of targets) {\n const matched = materialized.find((entry) => entry.from_step === target.id);\n if (!matched) continue;\n const step = currentSteps.find((entry) => entry.id === target.id);\n if (!step) continue;\n const links = step.linked_items ?? [];\n links.push({ id: matched.id, kind: \"implements\", note: `materialized as ${matched.type}` });\n step.linked_items = links;\n step.updated_at = nowIso();\n }\n return { changedSteps: targets.map((entry) => entry.id) };\n },\n });\n const plan = projectPlan(document.metadata, \"standard\");\n return {\n action: \"materialize\",\n plan,\n materialized,\n ...(materializeSkipped.length > 0 ? { materialize_skipped: materializeSkipped } : {}),\n next_actions: nextActionsFor(itemId, plan),\n warnings: materializeSkipped.map(\n (entry) =>\n `plan_materialize_skipped:${entry.from_step}:${entry.reason}${entry.existing_id ? `:${entry.existing_id}` : \"\"}`,\n ),\n generated_at: nowIso(),\n };\n}\n\nexport interface PlanDispatchInput {\n subcommand: PlanSubcommand;\n id?: string;\n stepRef?: string;\n reorderTo?: number;\n options: PlanCommandOptions;\n global: GlobalOptions;\n}\n\nexport async function runPlan(input: PlanDispatchInput): Promise<PlanCommandResult> {\n const ctx = await loadContext(input.global);\n switch (input.subcommand) {\n case \"create\":\n return planCreate(input.options, input.global, ctx);\n case \"show\":\n if (!input.id) throw new PmCliError(\"pm plan show requires a plan id\", EXIT_CODE.USAGE);\n return planShow(input.id, input.options, ctx);\n case \"add-step\":\n if (!input.id) throw new PmCliError(\"pm plan add-step requires a plan id\", EXIT_CODE.USAGE);\n return planAddStep(input.id, input.options, ctx);\n case \"update-step\":\n if (!input.id || !input.stepRef) throw new PmCliError(\"pm plan update-step requires <plan-id> <step>\", EXIT_CODE.USAGE);\n return planUpdateStep(input.id, input.options, ctx, { stepRef: input.stepRef, op: \"plan_update_step\" });\n case \"complete-step\":\n if (!input.id || !input.stepRef) throw new PmCliError(\"pm plan complete-step requires <plan-id> <step>\", EXIT_CODE.USAGE);\n return planUpdateStep(input.id, input.options, ctx, { stepRef: input.stepRef, finalStatus: \"completed\", op: \"plan_complete_step\" });\n case \"block-step\":\n if (!input.id || !input.stepRef) throw new PmCliError(\"pm plan block-step requires <plan-id> <step>\", EXIT_CODE.USAGE);\n return planUpdateStep(input.id, input.options, ctx, { stepRef: input.stepRef, finalStatus: \"blocked\", op: \"plan_block_step\" });\n case \"reorder-step\":\n if (!input.id || !input.stepRef || input.reorderTo === undefined)\n throw new PmCliError(\"pm plan reorder-step requires <plan-id> <step> <new-order>\", EXIT_CODE.USAGE);\n return planReorderStep(input.id, input.options, ctx, input.stepRef, input.reorderTo);\n case \"remove-step\":\n if (!input.id || !input.stepRef) throw new PmCliError(\"pm plan remove-step requires <plan-id> <step>\", EXIT_CODE.USAGE);\n return planRemoveStep(input.id, input.options, ctx, input.stepRef);\n case \"link\":\n if (!input.id || !input.stepRef) throw new PmCliError(\"pm plan link requires <plan-id> <step>\", EXIT_CODE.USAGE);\n return planLink(input.id, input.options, ctx, input.stepRef);\n case \"unlink\":\n if (!input.id || !input.stepRef) throw new PmCliError(\"pm plan unlink requires <plan-id> <step>\", EXIT_CODE.USAGE);\n return planUnlink(input.id, input.options, ctx, input.stepRef);\n case \"decision\":\n if (!input.id) throw new PmCliError(\"pm plan decision requires a plan id\", EXIT_CODE.USAGE);\n return planAppendLog(input.id, input.options, ctx, \"decision\");\n case \"discovery\":\n if (!input.id) throw new PmCliError(\"pm plan discovery requires a plan id\", EXIT_CODE.USAGE);\n return planAppendLog(input.id, input.options, ctx, \"discovery\");\n case \"validation\":\n if (!input.id) throw new PmCliError(\"pm plan validation requires a plan id\", EXIT_CODE.USAGE);\n return planAppendLog(input.id, input.options, ctx, \"validation\");\n case \"resume\":\n if (!input.id) throw new PmCliError(\"pm plan resume requires a plan id\", EXIT_CODE.USAGE);\n return planResume(input.id, input.options, ctx);\n case \"approve\":\n if (!input.id) throw new PmCliError(\"pm plan approve requires a plan id\", EXIT_CODE.USAGE);\n return planApprove(input.id, input.options, ctx);\n case \"materialize\":\n if (!input.id) throw new PmCliError(\"pm plan materialize requires a plan id\", EXIT_CODE.USAGE);\n return planMaterialize(input.id, input.options, ctx);\n default:\n throw new PmCliError(`Unknown pm plan subcommand \"${input.subcommand}\"`, EXIT_CODE.USAGE);\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCO,IAAM,mBAAmB;EAC9B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAIK,IAAM,yBAAyB,CAAC,SAAS,YAAY,MAAM;AAqGlE,IAAM,iBAAiB;AACvB,IAAM,oBAA8B;AAEpC,SAAS,cAAc,WAA+B,UAAgB;AACpE,QAAM,WAAW,aAAa,QAAQ,IAAI,aAAa;AACvD,QAAM,UAAU,SAAS,KAAI;AAC7B,SAAO,QAAQ,SAAS,IAAI,UAAU;AACxC;AAEA,SAAS,QAAQ,OAAoC;AACnD,MAAI,MAAM,QAAQ,KAAK;AAAG,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,IAAI,MAAM,SAAS,GAAG;IACrD;AACE,YAAM,IAAI,WAAW,+BAA+B,MAAM,UAAU,KAAK,UAAU,KAAK;EAC5F;AACF;",
6
+ "names": ["global", "step", "list", "plan"]
7
+ }
@@ -1,5 +1,4 @@
1
1
  import {
2
- createLazyModule,
3
2
  getGlobalOptions,
4
3
  normalizeActivityOptions,
5
4
  normalizeAggregateOptions,
@@ -10,25 +9,35 @@ import {
10
9
  printActivityJsonStream,
11
10
  printListJsonStream,
12
11
  resolveActivityStreamMode
13
- } from "./chunk-RJONRNXN.js";
12
+ } from "./chunk-P53TN6IA.js";
13
+ import "./chunk-GN7IJPCD.js";
14
+ import "./chunk-6HT2F4TK.js";
14
15
  import {
15
- EXIT_CODE,
16
- PmCliError,
17
16
  printError,
18
17
  printResult,
19
18
  writeStdout
20
- } from "./chunk-SW5BMMCU.js";
19
+ } from "./chunk-5HSEP75M.js";
20
+ import "./chunk-EGUGFSNX.js";
21
+ import "./chunk-BUPWJ3IJ.js";
22
+ import "./chunk-4AEZR5EJ.js";
23
+ import "./chunk-CEFIVZPG.js";
24
+ import "./chunk-MD7K4JYF.js";
25
+ import "./chunk-WDPXDQFG.js";
26
+ import "./chunk-PVNQLCIS.js";
27
+ import {
28
+ EXIT_CODE,
29
+ PmCliError
30
+ } from "./chunk-LSXGH6NE.js";
21
31
 
22
32
  // dist/cli/register-list-query.js
23
33
  import { Option } from "commander";
24
34
  !(function() {
25
35
  try {
26
36
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
27
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "2bf175c5-e4a0-59d7-a9ac-41b6dd354d6d");
37
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "febfb5c7-e10b-58e9-ac9b-d2bcd0c25b57");
28
38
  } catch (e2) {
29
39
  }
30
40
  })();
31
- var loadListQueryCommandsModule = createLazyModule(() => import("./commands-XJ4TJ5UN.js"));
32
41
  function shouldRegisterListQueryCommand(commandName, commandFilter) {
33
42
  if (!commandFilter || commandFilter.size === 0) {
34
43
  return true;
@@ -58,7 +67,7 @@ function registerListQueryCommands(program, options) {
58
67
  }
59
68
  if (excludeTerminal)
60
69
  listOptions.excludeTerminal = true;
61
- const { runList } = await loadListQueryCommandsModule();
70
+ const { runList } = await import("./list-OGWQPC26.js");
62
71
  const result = await runList(status, listOptions, globalOptions);
63
72
  const streamMode = options2.stream === true;
64
73
  if (streamMode && !globalOptions.json) {
@@ -106,7 +115,7 @@ function registerListQueryCommands(program, options) {
106
115
  aggregateCommand.action(async (options2, command) => {
107
116
  const globalOptions = getGlobalOptions(command);
108
117
  const startedAt = Date.now();
109
- const { runAggregate } = await loadListQueryCommandsModule();
118
+ const { runAggregate } = await import("./aggregate-ADUOSFRO.js");
110
119
  const result = await runAggregate(normalizeAggregateOptions(options2), globalOptions);
111
120
  printResult(result, globalOptions);
112
121
  if (globalOptions.profile) {
@@ -121,7 +130,7 @@ function registerListQueryCommands(program, options) {
121
130
  const globalOptions = getGlobalOptions(actionCommand);
122
131
  const startedAt = Date.now();
123
132
  const normalized = normalizeContextOptions(options2);
124
- const commands = await loadListQueryCommandsModule();
133
+ const commands = await import("./context-RZ5QPNJB.js");
125
134
  const result = await commands.runContext(normalized, globalOptions);
126
135
  const outputFormat = commands.resolveContextOutputFormat(normalized, globalOptions);
127
136
  if (outputFormat === "markdown") {
@@ -144,7 +153,7 @@ function registerListQueryCommands(program, options) {
144
153
  program.command("search").argument("<keywords...>", "Keyword query tokens").description("Search items with keyword, semantic, or hybrid retrieval.").option("--mode <value>", "Search mode: keyword|semantic|hybrid (default: keyword)").option("--semantic", "Shorthand for --mode semantic").option("--hybrid", "Shorthand for --mode hybrid").option("--include-linked", "Include linked files, docs, and tests in the searchable corpus").option("--title-exact", "Require exact normalized title match for the full query string").option("--phrase-exact", "Require exact normalized phrase match in searchable text").option("--type <value>", "Filter by item type").option("--tag <value>", "Filter by tag").option("--priority <value>", "Filter by priority").option("--deadline-before <value>", "Filter by deadline upper bound (ISO/date string or relative)").option("--deadline-after <value>", "Filter by deadline lower bound (ISO/date string or relative)").option("--compact", "Render compact search hits (default; mutually exclusive with --full/--fields)").option("--full", "Render full search hits with nested item payloads (mutually exclusive with --compact/--fields)").option("--fields <value>", "Render custom comma-separated search hit fields (mutually exclusive with --compact/--full; valid: --fields id,title,score; invalid: --full --fields id,title)").option("--limit <n>", "Limit returned item count").action(async (keywords, options2, command) => {
145
154
  const globalOptions = getGlobalOptions(command);
146
155
  const startedAt = Date.now();
147
- const { runSearch } = await loadListQueryCommandsModule();
156
+ const { runSearch } = await import("./search-HENBL456.js");
148
157
  const searchOptions = normalizeSearchOptions(options2);
149
158
  const result = await runSearch(normalizeSearchKeywordsInput(keywords), {
150
159
  ...searchOptions,
@@ -160,7 +169,7 @@ function registerListQueryCommands(program, options) {
160
169
  program.command("get").argument("<id>", "Item id").option("--depth <value>", "Detail depth: brief|standard|deep|full (full aliases deep; default: deep)").option("--full", "Explicit full item read; equivalent to --depth deep (mutually exclusive with --depth/--fields)").option("--fields <value>", "Render custom comma-separated item metadata fields (for example: --fields id,title,status,parent,type)").description("Show item details by ID.").action(async (id, options2, command) => {
161
170
  const globalOptions = getGlobalOptions(command);
162
171
  const startedAt = Date.now();
163
- const { runGet } = await loadListQueryCommandsModule();
172
+ const { runGet } = await import("./get-LTK3HOCQ.js");
164
173
  const result = await runGet(id, globalOptions, {
165
174
  depth: typeof options2.depth === "string" ? options2.depth : void 0,
166
175
  fields: typeof options2.fields === "string" ? options2.fields : void 0,
@@ -179,7 +188,7 @@ function registerListQueryCommands(program, options) {
179
188
  if (options2.compact === true && options2.full === true) {
180
189
  throw new PmCliError("History projection options are mutually exclusive. Use either --compact or --full.", EXIT_CODE.USAGE);
181
190
  }
182
- const { runHistory } = await loadListQueryCommandsModule();
191
+ const { runHistory } = await import("./history-A2JUDXUE.js");
183
192
  const result = await runHistory(id, {
184
193
  limit: typeof options2.limit === "string" ? options2.limit : void 0,
185
194
  compact: options2.full === true ? false : true,
@@ -200,7 +209,7 @@ function registerListQueryCommands(program, options) {
200
209
  throw new PmCliError("Activity projection options are mutually exclusive. Use either --compact or --full.", EXIT_CODE.USAGE);
201
210
  }
202
211
  const normalized = normalizeActivityOptions(options2);
203
- const { runActivity } = await loadListQueryCommandsModule();
212
+ const { runActivity } = await import("./activity-OWYSUZOY.js");
204
213
  const result = await runActivity(normalized, globalOptions);
205
214
  const streamMode = resolveActivityStreamMode(options2.stream);
206
215
  if (streamMode && !globalOptions.json) {
@@ -220,4 +229,4 @@ function registerListQueryCommands(program, options) {
220
229
  export {
221
230
  registerListQueryCommands
222
231
  };
223
- //# sourceMappingURL=register-list-query-EIVQ5FMR.js.map
232
+ //# sourceMappingURL=register-list-query-UP3VRUFS.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../../cli/register-list-query.ts"],
4
+ "sourcesContent": ["import { Option, type Command } from \"commander\";\nimport { EXIT_CODE } from \"../core/shared/constants.js\";\nimport { PmCliError } from \"../core/shared/errors.js\";\nimport type { ItemStatus } from \"../types/index.js\";\nimport {\n getGlobalOptions,\n normalizeAggregateOptions,\n normalizeActivityOptions,\n normalizeContextOptions,\n normalizeListOptions,\n normalizeSearchKeywordsInput,\n normalizeSearchOptions,\n printActivityJsonStream,\n printError,\n printListJsonStream,\n printResult,\n resolveActivityStreamMode,\n writeStdout,\n} from \"./registration-helpers.js\";\n\n\n\nexport interface RegisterListQueryCommandsOptions {\n commandFilter?: Set<string>;\n}\n\nfunction shouldRegisterListQueryCommand(commandName: string, commandFilter?: Set<string>): boolean {\n if (!commandFilter || commandFilter.size === 0) {\n return true;\n }\n if (commandName === \"context\") {\n return commandFilter.has(\"context\") || commandFilter.has(\"ctx\");\n }\n return commandFilter.has(commandName);\n}\n\nexport function registerListQueryCommands(program: Command, options?: RegisterListQueryCommandsOptions): void {\n const commandFilter = options?.commandFilter;\n const shouldRegister = (commandName: string): boolean => shouldRegisterListQueryCommand(commandName, commandFilter);\n // Register a flag and hide it from --help text while keeping it functional as\n // a parse-time alias. Used for pure snake_case underscore-duplicate aliases\n // (e.g. --assignee_filter for --assignee-filter) so they no longer bloat\n // --help output. The option still appears in command.options, so JSON help\n // and completion are unchanged.\n function addHiddenOption(command: Command, flags: string, description: string): void {\n command.addOption(new Option(flags, description).hideHelp());\n }\n\n function registerListCommand(\n name: string,\n description: string,\n status?: ItemStatus,\n excludeTerminal?: boolean,\n allowStatusFilter?: boolean,\n defaultBrief?: boolean,\n ): void {\n const command = program.command(name).description(description);\n if (allowStatusFilter) {\n command.option(\"--status <value>\", \"Filter by status\");\n }\n command\n .option(\"--type <value>\", \"Filter by item type\")\n .option(\"--tag <value>\", \"Filter by tag\")\n .option(\"--priority <value>\", \"Filter by priority\")\n .option(\"--deadline-before <value>\", \"Filter by deadline upper bound (ISO/date string or relative)\")\n .option(\"--deadline-after <value>\", \"Filter by deadline lower bound (ISO/date string or relative)\")\n .option(\"--assignee <value>\", \"Filter by assignee\")\n .option(\"--assignee-filter <value>\", \"Filter assignee presence: assigned|unassigned\")\n .option(\"--parent <value>\", \"Filter by parent item ID\")\n .option(\"--sprint <value>\", \"Filter by sprint\")\n .option(\"--release <value>\", \"Filter by release\")\n .option(\"--limit <n>\", \"Limit returned item count\")\n .option(\"--offset <n>\", \"Skip the first n matching rows before limit is applied\")\n .option(\"--include-body\", \"Include item body in each returned list row\")\n .option(\"--compact\", \"Render compact list projection fields (mutually exclusive with --brief/--full/--fields)\")\n .option(\"--brief\", \"Ultra-compact output: id, status, type, title only (agent-optimized, mutually exclusive with --compact/--full/--fields)\")\n .option(\"--full\", \"Render full list projection fields (mutually exclusive with --compact/--brief/--fields)\")\n .option(\n \"--fields <value>\",\n \"Render custom comma-separated list fields (mutually exclusive with --compact/--brief/--full; valid: --fields id,title)\",\n )\n .option(\"--sort <value>\", \"Sort field: priority|deadline|updated_at|created_at|title|parent (aliases: updated, created)\")\n .option(\"--order <value>\", \"Sort order: asc|desc (requires --sort)\")\n .option(\"--stream\", \"Emit line-delimited JSON rows (requires --json)\")\n .action(async (options: Record<string, unknown>, actionCommand) => {\n const globalOptions = getGlobalOptions(actionCommand);\n const startedAt = Date.now();\n const listOptions = normalizeListOptions(options);\n if (\n defaultBrief === true &&\n listOptions.includeBody !== true &&\n listOptions.compact !== true &&\n listOptions.brief !== true &&\n listOptions.full !== true &&\n listOptions.fields === undefined\n ) {\n listOptions.brief = true;\n }\n if (excludeTerminal) listOptions.excludeTerminal = true;\n const { runList } = await import(\"./commands/list.js\");\n const result = await runList(status, listOptions, globalOptions);\n const streamMode = options.stream === true;\n if (streamMode && !globalOptions.json) {\n throw new PmCliError(\"--stream requires --json output mode.\", EXIT_CODE.USAGE);\n }\n if (streamMode) {\n printListJsonStream(name, result, globalOptions);\n } else {\n printResult(result, globalOptions);\n }\n if (globalOptions.profile) {\n printError(`profile:command=${name} took_ms=${Date.now() - startedAt}`);\n }\n });\n // Hidden pure snake_case underscore-duplicate alias (kept parse-functional).\n addHiddenOption(command, \"--assignee_filter <value>\", \"Alias for --assignee-filter\");\n }\n\n if (shouldRegister(\"list\")) {\n registerListCommand(\"list\", \"List active items with optional filters.\", undefined, true, true, true);\n }\n if (shouldRegister(\"list-all\")) {\n registerListCommand(\"list-all\", \"List all items with optional filters.\", undefined, false, true);\n }\n if (shouldRegister(\"list-draft\")) {\n registerListCommand(\"list-draft\", \"List draft items with optional filters.\", \"draft\");\n }\n if (shouldRegister(\"list-open\")) {\n registerListCommand(\"list-open\", \"List open items with optional filters.\", \"open\", false, false, true);\n }\n if (shouldRegister(\"list-in-progress\")) {\n registerListCommand(\"list-in-progress\", \"List in-progress items with optional filters.\", \"in_progress\", false, false, true);\n }\n if (shouldRegister(\"list-blocked\")) {\n registerListCommand(\"list-blocked\", \"List blocked items with optional filters.\", \"blocked\");\n }\n if (shouldRegister(\"list-closed\")) {\n registerListCommand(\"list-closed\", \"List closed items with optional filters.\", \"closed\");\n }\n if (shouldRegister(\"list-canceled\")) {\n registerListCommand(\"list-canceled\", \"List canceled items with optional filters.\", \"canceled\");\n }\n\n if (shouldRegister(\"aggregate\")) {\n const aggregateCommand = program\n .command(\"aggregate\")\n .description(\"Aggregate grouped item counts for governance queries.\")\n .option(\n \"--group-by <value>\",\n \"Comma-separated group-by fields (supported: parent,type,priority,status,assignee,tags,sprint,release)\",\n )\n .option(\"--count\", \"Return grouped counts (default behavior)\")\n .option(\"--include-unparented\", \"Include unparented rows when grouping by parent\")\n .option(\"--status <value>\", \"Filter by item status\")\n .option(\"--type <value>\", \"Filter by item type\")\n .option(\"--tag <value>\", \"Filter by tag\")\n .option(\"--priority <value>\", \"Filter by priority\")\n .option(\"--deadline-before <value>\", \"Filter by deadline upper bound (ISO/date string or relative)\")\n .option(\"--deadline-after <value>\", \"Filter by deadline lower bound (ISO/date string or relative)\")\n .option(\"--assignee <value>\", \"Filter by assignee\")\n .option(\"--assignee-filter <value>\", \"Filter assignee presence: assigned|unassigned\")\n .option(\"--parent <value>\", \"Filter by parent item ID\")\n .option(\"--sprint <value>\", \"Filter by sprint\")\n .option(\"--release <value>\", \"Filter by release\");\n // Hidden pure snake_case underscore-duplicate aliases (kept parse-functional).\n addHiddenOption(aggregateCommand, \"--include_unparented\", \"Alias for --include-unparented\");\n addHiddenOption(aggregateCommand, \"--assignee_filter <value>\", \"Alias for --assignee-filter\");\n aggregateCommand\n .action(async (options: Record<string, unknown>, command) => {\n const globalOptions = getGlobalOptions(command);\n const startedAt = Date.now();\n const { runAggregate } = await import(\"./commands/aggregate.js\");\n const result = await runAggregate(normalizeAggregateOptions(options), globalOptions);\n printResult(result, globalOptions);\n if (globalOptions.profile) {\n printError(`profile:command=aggregate took_ms=${Date.now() - startedAt}`);\n }\n });\n }\n\n if (shouldRegister(\"context\")) {\n const contextCommand = program\n .command(\"context\")\n .alias(\"ctx\")\n .description(\"Show a token-efficient project context snapshot for next-work decisions.\")\n .option(\"--date <value>\", \"Anchor date/time for agenda window calculations (ISO/date string or relative)\")\n .option(\"--from <value>\", \"Agenda lower bound (ISO/date string or relative)\")\n .option(\"--to <value>\", \"Agenda upper bound (ISO/date string or relative)\")\n .option(\"--past\", \"Include past agenda entries in bounded windows\")\n .option(\"--type <value>\", \"Filter by item type\")\n .option(\"--tag <value>\", \"Filter by tag\")\n .option(\"--priority <value>\", \"Filter by priority\")\n .option(\"--assignee <value>\", \"Filter by assignee\")\n .option(\"--assignee-filter <value>\", \"Filter assignee presence: assigned|unassigned\")\n .option(\"--sprint <value>\", \"Filter by sprint\")\n .option(\"--release <value>\", \"Filter by release\")\n .option(\"--limit <n>\", \"Limit focus and agenda rows per section\")\n .option(\"--format <value>\", \"Context output format override: markdown|toon|json\")\n .option(\"--depth <value>\", \"Context depth: brief|standard|deep (default: settings or brief)\")\n .option(\"--section <value...>\", \"Include specific sections (repeatable; overrides --depth)\")\n .option(\"--activity-limit <n>\", \"Limit recent activity entries (default: settings or 10)\")\n .option(\"--stale-threshold <value>\", \"Staleness cutoff in days (e.g. 7 or 7d; default: settings or 7)\");\n // Hidden pure snake_case underscore-duplicate alias (kept parse-functional).\n addHiddenOption(contextCommand, \"--assignee_filter <value>\", \"Alias for --assignee-filter\");\n contextCommand\n .action(async (options: Record<string, unknown>, actionCommand) => {\n const globalOptions = getGlobalOptions(actionCommand);\n const startedAt = Date.now();\n const normalized = normalizeContextOptions(options);\n const commands = await import(\"./commands/context.js\");\n const result = await commands.runContext(normalized, globalOptions);\n const outputFormat = commands.resolveContextOutputFormat(normalized, globalOptions);\n if (outputFormat === \"markdown\") {\n if (!globalOptions.quiet) {\n writeStdout(`${commands.renderContextMarkdown(result)}\\n`);\n }\n } else {\n printResult(result, {\n ...globalOptions,\n json: outputFormat === \"json\",\n });\n }\n if (globalOptions.profile) {\n printError(`profile:command=context took_ms=${Date.now() - startedAt}`);\n }\n });\n }\n\n if (shouldRegister(\"search\")) {\n program\n .command(\"search\")\n .argument(\"<keywords...>\", \"Keyword query tokens\")\n .description(\"Search items with keyword, semantic, or hybrid retrieval.\")\n .option(\"--mode <value>\", \"Search mode: keyword|semantic|hybrid (default: keyword)\")\n .option(\"--semantic\", \"Shorthand for --mode semantic\")\n .option(\"--hybrid\", \"Shorthand for --mode hybrid\")\n .option(\"--include-linked\", \"Include linked files, docs, and tests in the searchable corpus\")\n .option(\"--title-exact\", \"Require exact normalized title match for the full query string\")\n .option(\"--phrase-exact\", \"Require exact normalized phrase match in searchable text\")\n .option(\"--type <value>\", \"Filter by item type\")\n .option(\"--tag <value>\", \"Filter by tag\")\n .option(\"--priority <value>\", \"Filter by priority\")\n .option(\"--deadline-before <value>\", \"Filter by deadline upper bound (ISO/date string or relative)\")\n .option(\"--deadline-after <value>\", \"Filter by deadline lower bound (ISO/date string or relative)\")\n .option(\"--compact\", \"Render compact search hits (default; mutually exclusive with --full/--fields)\")\n .option(\"--full\", \"Render full search hits with nested item payloads (mutually exclusive with --compact/--fields)\")\n .option(\n \"--fields <value>\",\n \"Render custom comma-separated search hit fields (mutually exclusive with --compact/--full; valid: --fields id,title,score; invalid: --full --fields id,title)\",\n )\n .option(\"--limit <n>\", \"Limit returned item count\")\n .action(async (keywords: string[], options: Record<string, unknown>, command) => {\n const globalOptions = getGlobalOptions(command);\n const startedAt = Date.now();\n const { runSearch } = await import(\"./commands/search.js\");\n const searchOptions = normalizeSearchOptions(options);\n const result = await runSearch(\n normalizeSearchKeywordsInput(keywords),\n {\n ...searchOptions,\n mode:\n typeof searchOptions.mode === \"string\" && searchOptions.mode.trim().length > 0\n ? searchOptions.mode\n : \"keyword\",\n },\n globalOptions,\n );\n printResult(result, globalOptions);\n if (globalOptions.profile) {\n printError(`profile:command=search took_ms=${Date.now() - startedAt}`);\n }\n });\n }\n\n if (shouldRegister(\"get\")) {\n program\n .command(\"get\")\n .argument(\"<id>\", \"Item id\")\n .option(\"--depth <value>\", \"Detail depth: brief|standard|deep|full (full aliases deep; default: deep)\")\n .option(\"--full\", \"Explicit full item read; equivalent to --depth deep (mutually exclusive with --depth/--fields)\")\n .option(\"--fields <value>\", \"Render custom comma-separated item metadata fields (for example: --fields id,title,status,parent,type)\")\n .description(\"Show item details by ID.\")\n .action(async (id: string, options: Record<string, unknown>, command) => {\n const globalOptions = getGlobalOptions(command);\n const startedAt = Date.now();\n const { runGet } = await import(\"./commands/get.js\");\n const result = await runGet(\n id,\n globalOptions,\n {\n depth: typeof options.depth === \"string\" ? options.depth : undefined,\n fields: typeof options.fields === \"string\" ? options.fields : undefined,\n full: Boolean(options.full),\n },\n );\n printResult(result, globalOptions);\n if (globalOptions.profile) {\n printError(`profile:command=get took_ms=${Date.now() - startedAt}`);\n }\n });\n }\n\n if (shouldRegister(\"history\")) {\n program\n .command(\"history\")\n .argument(\"<id>\", \"Item id\")\n .option(\"--limit <n>\", \"Return only the latest n history entries\")\n .option(\"--compact\", \"Condensed output: show entry index, timestamp, op, author, patch count, and changed fields\")\n .option(\"--full\", \"Show full history entries with JSON Patch payloads\")\n .option(\"--diff\", \"Include per-entry changed field summaries from history patches\")\n .option(\"--verify\", \"Verify hash chain and replay integrity for the full history stream\")\n .description(\"Show item history entries.\")\n .action(async (id: string, options: Record<string, unknown>, command) => {\n const globalOptions = getGlobalOptions(command);\n const startedAt = Date.now();\n if (options.compact === true && options.full === true) {\n throw new PmCliError(\"History projection options are mutually exclusive. Use either --compact or --full.\", EXIT_CODE.USAGE);\n }\n const { runHistory } = await import(\"./commands/history.js\");\n const result = await runHistory(\n id,\n {\n limit: typeof options.limit === \"string\" ? options.limit : undefined,\n compact: options.full === true ? false : true,\n diff: Boolean(options.diff),\n verify: Boolean(options.verify),\n },\n globalOptions,\n );\n printResult(result, globalOptions);\n if (globalOptions.profile) {\n printError(`profile:command=history took_ms=${Date.now() - startedAt}`);\n }\n });\n }\n\n if (shouldRegister(\"activity\")) {\n program\n .command(\"activity\")\n .option(\"--id <value>\", \"Filter by item ID\")\n .option(\"--op <value>\", \"Filter by history operation\")\n .option(\"--author <value>\", \"Filter by history author\")\n .option(\"--from <value>\", \"Lower timestamp bound (ISO/date string or relative)\")\n .option(\"--to <value>\", \"Upper timestamp bound (ISO/date string or relative)\")\n .option(\"--limit <n>\", \"Return only the latest n activity entries\")\n .option(\"--compact\", \"Condensed output: show only id, op, ts, author, msg per entry\")\n .option(\"--full\", \"Show full activity entries with JSON Patch payloads\")\n .option(\"--stream [mode]\", \"Emit line-delimited JSON rows (requires --json). Optional mode: rows|ndjson|jsonl\")\n .description(\"Show recent activity across items.\")\n .action(async (options: Record<string, unknown>, command) => {\n const globalOptions = getGlobalOptions(command);\n const startedAt = Date.now();\n if (options.compact === true && options.full === true) {\n throw new PmCliError(\"Activity projection options are mutually exclusive. Use either --compact or --full.\", EXIT_CODE.USAGE);\n }\n const normalized = normalizeActivityOptions(options);\n const { runActivity } = await import(\"./commands/activity.js\");\n const result = await runActivity(normalized, globalOptions);\n const streamMode = resolveActivityStreamMode(options.stream);\n if (streamMode && !globalOptions.json) {\n throw new PmCliError(\"--stream requires --json output mode.\", EXIT_CODE.USAGE);\n }\n if (streamMode) {\n printActivityJsonStream(result, normalized, globalOptions);\n } else {\n printResult(result, globalOptions);\n }\n if (globalOptions.profile) {\n printError(`profile:command=activity took_ms=${Date.now() - startedAt}`);\n }\n });\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,cAA4B;;;;;;;;AA0BrC,SAAS,+BAA+B,aAAqB,eAA2B;AACtF,MAAI,CAAC,iBAAiB,cAAc,SAAS,GAAG;AAC9C,WAAO;EACT;AACA,MAAI,gBAAgB,WAAW;AAC7B,WAAO,cAAc,IAAI,SAAS,KAAK,cAAc,IAAI,KAAK;EAChE;AACA,SAAO,cAAc,IAAI,WAAW;AACtC;AAEM,SAAU,0BAA0B,SAAkB,SAA0C;AACpG,QAAM,gBAAgB,SAAS;AAC/B,QAAM,iBAAiB,CAAC,g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D,cAAM,IAAI,WAAW,uFAAuF,UAAU,KAAK;MAC7H;AACA,YAAM,aAAa,yBAAyBA,QAAO;AACnD,YAAM,EAAE,YAAW,IAAK,MAAM,OAAO,wBAAwB;AAC7D,YAAM,SAAS,MAAM,YAAY,YAAY,aAAa;AAC1D,YAAM,aAAa,0BAA0BA,SAAQ,MAAM;AAC3D,UAAI,cAAc,CAAC,cAAc,MAAM;AACrC,cAAM,IAAI,WAAW,yCAAyC,UAAU,KAAK;MAC/E;AACA,UAAI,YAAY;AACd,gCAAwB,QAAQ,YAAY,aAAa;MAC3D,OAAO;AACL,oBAAY,QAAQ,aAAa;MACnC;AACA,UAAI,cAAc,SAAS;AACzB,mBAAW,oCAAoC,KAAK,IAAG,IAAK,SAAS,EAAE;MACzE;IACF,CAAC;EACL;AACF;",
6
+ "names": ["options"]
7
+ }
@@ -1,23 +1,34 @@
1
1
  import {
2
2
  collect,
3
- createLazyModule,
4
3
  extractUpdateManyMutationOptionSource,
5
4
  formatHookWarnings,
6
5
  getGlobalOptions,
7
6
  invalidateSearchCachesForMutation,
8
7
  normalizeCreateOptions,
9
8
  normalizeUpdateOptions
10
- } from "./chunk-RJONRNXN.js";
9
+ } from "./chunk-P53TN6IA.js";
11
10
  import {
12
- BUILTIN_ITEM_TYPE_VALUES,
13
11
  CREATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS,
14
- EXIT_CODE,
15
- PmCliError,
16
- UPDATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS,
12
+ UPDATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS
13
+ } from "./chunk-GN7IJPCD.js";
14
+ import "./chunk-6HT2F4TK.js";
15
+ import {
17
16
  printError,
18
17
  printResult,
19
18
  writeStdout
20
- } from "./chunk-SW5BMMCU.js";
19
+ } from "./chunk-5HSEP75M.js";
20
+ import "./chunk-EGUGFSNX.js";
21
+ import "./chunk-BUPWJ3IJ.js";
22
+ import "./chunk-4AEZR5EJ.js";
23
+ import "./chunk-CEFIVZPG.js";
24
+ import "./chunk-MD7K4JYF.js";
25
+ import "./chunk-WDPXDQFG.js";
26
+ import "./chunk-PVNQLCIS.js";
27
+ import {
28
+ BUILTIN_ITEM_TYPE_VALUES,
29
+ EXIT_CODE,
30
+ PmCliError
31
+ } from "./chunk-LSXGH6NE.js";
21
32
 
22
33
  // dist/cli/register-mutation.js
23
34
  import { Option } from "commander";
@@ -57,12 +68,11 @@ function isPureSnakeCaseAlias(canonicalFlagSpec, aliasFlagSpec) {
57
68
  !(function() {
58
69
  try {
59
70
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
60
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "1c5454e2-e849-5b5f-b7a1-2681e8a90eac");
71
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "b543912f-51ff-52d3-8834-ad927ad85fe4");
61
72
  } catch (e2) {
62
73
  }
63
74
  })();
64
75
  var BUILTIN_TYPE_NAME_LOOKUP = new Set(BUILTIN_ITEM_TYPE_VALUES.map((value) => value.toLowerCase()));
65
- var loadMutationCommandsModule = createLazyModule(() => import("./commands-XJ4TJ5UN.js"));
66
76
  function addHiddenOption(command, flags, description, repeatable) {
67
77
  const option = new Option(flags, description).hideHelp();
68
78
  if (repeatable) {
@@ -125,7 +135,7 @@ function registerMutationCommands(program) {
125
135
  options.title = positionalTitle;
126
136
  }
127
137
  const normalized = normalizeCreateOptions(options, { requireType: false });
128
- const { runCreate } = await loadMutationCommandsModule();
138
+ const { runCreate } = await import("./create-PZVHRIZQ.js");
129
139
  const result = await runCreate(normalized, globalOptions);
130
140
  await invalidateSearchCachesForMutation(globalOptions, result);
131
141
  printResult(result, globalOptions);
@@ -141,7 +151,7 @@ function registerMutationCommands(program) {
141
151
  updateCommand.action(async (id, options, command) => {
142
152
  const globalOptions = getGlobalOptions(command);
143
153
  const startedAt = Date.now();
144
- const { runUpdate } = await loadMutationCommandsModule();
154
+ const { runUpdate } = await import("./update-H6SCWNMA.js");
145
155
  const result = await runUpdate(id, normalizeUpdateOptions(options), globalOptions);
146
156
  await invalidateSearchCachesForMutation(globalOptions, result);
147
157
  printResult(result, globalOptions);
@@ -181,7 +191,7 @@ function registerMutationCommands(program) {
181
191
  updateManyCommand.action(async (options, command) => {
182
192
  const globalOptions = getGlobalOptions(command);
183
193
  const startedAt = Date.now();
184
- const { runUpdateMany } = await loadMutationCommandsModule();
194
+ const { runUpdateMany } = await import("./update-many-46HRSP2Q.js");
185
195
  const result = await runUpdateMany({
186
196
  status: typeof options.filterStatus === "string" ? options.filterStatus : void 0,
187
197
  list: {
@@ -216,7 +226,7 @@ function registerMutationCommands(program) {
216
226
  closeCommand.action(async (id, text, options, command) => {
217
227
  const globalOptions = getGlobalOptions(command);
218
228
  const startedAt = Date.now();
219
- const { runClose } = await loadMutationCommandsModule();
229
+ const { runClose } = await import("./close-XY4CSAYF.js");
220
230
  const reasonFromOption = typeof options.reason === "string" && options.reason.trim().length > 0 && options.reason || typeof options.closeReason === "string" && options.closeReason.trim().length > 0 && options.closeReason || void 0;
221
231
  const resolvedText = typeof text === "string" && text.length > 0 ? text : reasonFromOption;
222
232
  if (typeof resolvedText !== "string" || resolvedText.length === 0) {
@@ -258,7 +268,7 @@ function registerMutationCommands(program) {
258
268
  program.command("delete").argument("<id>", "Item id").option("--author <value>", "Mutation author").option("--message <value>", "History message").option("--force", "Force ownership override").option("--dry-run", "Preview the item file that would be deleted without mutating").description("Delete an item and record the change in history.").action(async (id, options, command) => {
259
269
  const globalOptions = getGlobalOptions(command);
260
270
  const startedAt = Date.now();
261
- const { runDelete } = await loadMutationCommandsModule();
271
+ const { runDelete } = await import("./delete-RHCTEORS.js");
262
272
  const result = await runDelete(id, {
263
273
  author: typeof options.author === "string" ? options.author : void 0,
264
274
  message: typeof options.message === "string" ? options.message : void 0,
@@ -287,7 +297,7 @@ function registerMutationCommands(program) {
287
297
  if (resolvedBody === void 0) {
288
298
  throw new PmCliError("Missing append text. Provide it as positional [text], --body <value>, or --text <value> (use - for stdin).", EXIT_CODE.USAGE);
289
299
  }
290
- const { runAppend } = await loadMutationCommandsModule();
300
+ const { runAppend } = await import("./append-JD2DETU7.js");
291
301
  const result = await runAppend(id, {
292
302
  body: resolvedBody,
293
303
  author: typeof options.author === "string" ? options.author : void 0,
@@ -303,7 +313,7 @@ function registerMutationCommands(program) {
303
313
  program.command("restore").argument("<id>", "Item id").argument("<target>", "Restore target timestamp or version number").option("--author <value>", "Mutation author").option("--message <value>", "History message").option("--force", "Force ownership/lock override").description("Restore an item to an earlier timestamp or version.").action(async (id, target, options, command) => {
304
314
  const globalOptions = getGlobalOptions(command);
305
315
  const startedAt = Date.now();
306
- const { runRestore } = await loadMutationCommandsModule();
316
+ const { runRestore } = await import("./restore-MB2ISME7.js");
307
317
  const result = await runRestore(id, target, {
308
318
  author: typeof options.author === "string" ? options.author : void 0,
309
319
  message: typeof options.message === "string" ? options.message : void 0,
@@ -352,7 +362,7 @@ function registerMutationCommands(program) {
352
362
  planCommand.action(async (subcommand, id, stepRef, reorderToken, options, command) => {
353
363
  const globalOptions = getGlobalOptions(command);
354
364
  const startedAt = Date.now();
355
- const { runPlan, PLAN_SUBCOMMANDS } = await loadMutationCommandsModule();
365
+ const { runPlan, PLAN_SUBCOMMANDS } = await import("./plan-67AB2PLM.js");
356
366
  const normalizedSubcommand = (subcommand ?? "").trim().toLowerCase();
357
367
  if (!normalizedSubcommand) {
358
368
  throw new PmCliError(`pm plan requires a subcommand. Allowed: ${PLAN_SUBCOMMANDS.join(", ")}`, EXIT_CODE.USAGE, {
@@ -433,7 +443,7 @@ function registerMutationCommands(program) {
433
443
  program.command("history-redact").argument("<id>", "Item id").option("--literal <value>", "Literal string to redact (repeatable)", collect).option("--regex <value>", "Regex pattern to redact (repeatable; accepts /pattern/flags or raw pattern)", collect).option("--replacement <value>", 'Replacement string (default: "[redacted]")').option("--dry-run", "Preview redaction impact without writing item/history files").option("--author <value>", "Mutation author").option("--message <value>", "Audit history message for the redaction marker entry").option("--force", "Force ownership/lock override").description("Redact sensitive literals/patterns from an item history stream and recompute hashes.").action(async (id, options, command) => {
434
444
  const globalOptions = getGlobalOptions(command);
435
445
  const startedAt = Date.now();
436
- const { runHistoryRedact } = await loadMutationCommandsModule();
446
+ const { runHistoryRedact } = await import("./history-redact-ED6RFCPL.js");
437
447
  const literal = Array.isArray(options.literal) ? options.literal : void 0;
438
448
  const regex = Array.isArray(options.regex) ? options.regex : void 0;
439
449
  const result = await runHistoryRedact(id, {
@@ -456,7 +466,7 @@ function registerMutationCommands(program) {
456
466
  program.command("history-repair").argument("<id>", "Item id").option("--dry-run", "Preview the re-anchor impact without writing the history file").option("--author <value>", "Mutation author").option("--message <value>", "Audit history message for the repair marker entry").option("--force", "Force ownership/lock override").description("Re-anchor a drifted item history chain (recompute hashes, reconcile with the on-disk item) and record an audit marker.").action(async (id, options, command) => {
457
467
  const globalOptions = getGlobalOptions(command);
458
468
  const startedAt = Date.now();
459
- const { runHistoryRepair } = await loadMutationCommandsModule();
469
+ const { runHistoryRepair } = await import("./history-repair-ZWSTDRH2.js");
460
470
  const result = await runHistoryRepair(id, {
461
471
  dryRun: options.dryRun === true,
462
472
  author: typeof options.author === "string" ? options.author : void 0,
@@ -473,7 +483,7 @@ function registerMutationCommands(program) {
473
483
  schemaCommand.action(async (subcommand, name, options, command) => {
474
484
  const globalOptions = getGlobalOptions(command);
475
485
  const startedAt = Date.now();
476
- const { runSchemaAddType, formatSchemaAddTypeHuman, SCHEMA_SUBCOMMANDS } = await loadMutationCommandsModule();
486
+ const { runSchemaAddType, formatSchemaAddTypeHuman, SCHEMA_SUBCOMMANDS } = await import("./schema-Q622KC46.js");
477
487
  let normalizedSubcommand = (subcommand ?? "").trim().toLowerCase();
478
488
  let typeName = name;
479
489
  if (!normalizedSubcommand) {
@@ -531,7 +541,7 @@ function registerMutationCommands(program) {
531
541
  throw new PmCliError("Specify comment text with exactly one source: positional [text], --add, --stdin, or --file", EXIT_CODE.USAGE);
532
542
  }
533
543
  const add = addFromOption ?? addFromPositional;
534
- const { runComments } = await loadMutationCommandsModule();
544
+ const { runComments } = await import("./comments-AAKJQ6LW.js");
535
545
  const result = await runComments(id, {
536
546
  add,
537
547
  stdin: readFromStdin,
@@ -559,7 +569,7 @@ function registerMutationCommands(program) {
559
569
  throw new PmCliError("Specify note text either as positional [text] or with --add, not both", EXIT_CODE.USAGE);
560
570
  }
561
571
  const add = addFromOption ?? addFromPositional;
562
- const { runNotes } = await loadMutationCommandsModule();
572
+ const { runNotes } = await import("./notes-DFS5ZGOO.js");
563
573
  const result = await runNotes(id, {
564
574
  add,
565
575
  limit: typeof options.limit === "string" ? options.limit : void 0,
@@ -585,7 +595,7 @@ function registerMutationCommands(program) {
585
595
  throw new PmCliError("Specify learning text either as positional [text] or with --add, not both", EXIT_CODE.USAGE);
586
596
  }
587
597
  const add = addFromOption ?? addFromPositional;
588
- const { runLearnings } = await loadMutationCommandsModule();
598
+ const { runLearnings } = await import("./learnings-NXTWE3FR.js");
589
599
  const result = await runLearnings(id, {
590
600
  add,
591
601
  limit: typeof options.limit === "string" ? options.limit : void 0,
@@ -610,7 +620,7 @@ function registerMutationCommands(program) {
610
620
  const addGlobValues = Array.isArray(options.addGlob) ? options.addGlob : [];
611
621
  const removeValues = Array.isArray(options.remove) ? options.remove : [];
612
622
  const migrateValues = Array.isArray(options.migrate) ? options.migrate : [];
613
- const { runFiles } = await loadMutationCommandsModule();
623
+ const { runFiles } = await import("./files-WVOX67PE.js");
614
624
  const result = await runFiles(id, {
615
625
  add: addValues,
616
626
  addGlob: addGlobValues,
@@ -635,7 +645,7 @@ function registerMutationCommands(program) {
635
645
  filesCommand.command("discover").argument("<id>", "Item id").option("--apply", "Add discovered missing files to the item").option("--note <value>", "Note to attach to discovered file links").option("--append-stable", "Preserve existing linked-file order and append discovered links without full-array resorting").option("--author <value>", "Mutation author").option("--message <value>", "History message").option("--force", "Force ownership override").description("Discover existing file paths referenced in item text and optionally link missing files.").action(async (id, options, command) => {
636
646
  const globalOptions = getGlobalOptions(command);
637
647
  const startedAt = Date.now();
638
- const { runFilesDiscover } = await loadMutationCommandsModule();
648
+ const { runFilesDiscover } = await import("./files-WVOX67PE.js");
639
649
  const result = await runFilesDiscover(id, {
640
650
  apply: Boolean(options.apply),
641
651
  note: typeof options.note === "string" ? options.note : void 0,
@@ -659,7 +669,7 @@ function registerMutationCommands(program) {
659
669
  const addGlobValues = Array.isArray(options.addGlob) ? options.addGlob : [];
660
670
  const removeValues = Array.isArray(options.remove) ? options.remove : [];
661
671
  const migrateValues = Array.isArray(options.migrate) ? options.migrate : [];
662
- const { runDocs } = await loadMutationCommandsModule();
672
+ const { runDocs } = await import("./docs-FXXUCZYU.js");
663
673
  const result = await runDocs(id, {
664
674
  add: addValues,
665
675
  addGlob: addGlobValues,
@@ -683,7 +693,7 @@ function registerMutationCommands(program) {
683
693
  program.command("deps").argument("<id>", "Item id").option("--format <value>", "Output format (tree or graph)", "tree").option("--max-depth <value>", "Maximum dependency traversal depth (0 keeps only the root)").option("--collapse <value>", "Collapse mode (none or repeated)", "none").option("--summary", "Return counts only without full tree/graph payload").description("Show dependency relationships for an item.").action(async (id, options, command) => {
684
694
  const globalOptions = getGlobalOptions(command);
685
695
  const startedAt = Date.now();
686
- const { runDeps } = await loadMutationCommandsModule();
696
+ const { runDeps } = await import("./deps-MZYCMLAO.js");
687
697
  const result = await runDeps(id, {
688
698
  format: typeof options.format === "string" ? options.format : void 0,
689
699
  maxDepth: typeof options.maxDepth === "string" ? options.maxDepth : void 0,
@@ -699,4 +709,4 @@ function registerMutationCommands(program) {
699
709
  export {
700
710
  registerMutationCommands
701
711
  };
702
- //# sourceMappingURL=register-mutation-RSZNPSGI.js.map
712
+ //# sourceMappingURL=register-mutation-YWSBF545.js.map