@unbrained/pm-cli 2026.8.31 → 2026.9.2

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 (108) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/AGENTS.md +15 -13
  3. package/CHANGELOG.md +33 -6
  4. package/README.md +3 -3
  5. package/dist/cli/commands/merge.d.ts +1 -1
  6. package/dist/cli/commands/merge.js +3 -3
  7. package/dist/cli/register-mutation.js +8 -5
  8. package/dist/cli-bundle/bundle-manifest.json +129 -129
  9. package/dist/cli-bundle/chunks/{chunk-52JXYSDW.js → chunk-3WICXLVT.js} +2 -2
  10. package/dist/cli-bundle/chunks/{chunk-JIFYOJF7.js → chunk-DTGWEL23.js} +2 -2
  11. package/dist/cli-bundle/chunks/{chunk-SXMHPK4V.js → chunk-FZ4Z2J4F.js} +4 -4
  12. package/dist/cli-bundle/chunks/chunk-GOACULJW.js +13 -0
  13. package/dist/cli-bundle/chunks/{chunk-NW6LV3TU.js → chunk-NOPL37X4.js} +64 -64
  14. package/dist/cli-bundle/chunks/{chunk-OUGDA7NR.js → chunk-T6H5BZCP.js} +2 -2
  15. package/dist/cli-bundle/chunks/{chunk-IEFJ3ZEB.js → chunk-TAG4VC22.js} +4 -4
  16. package/dist/cli-bundle/chunks/{chunk-MWIN6OH2.js → chunk-UDW64J2W.js} +2 -2
  17. package/dist/cli-bundle/chunks/{chunk-5DH5XCJL.js → chunk-X4RCGLTX.js} +2 -2
  18. package/dist/cli-bundle/chunks/{chunk-QZCIBZR3.js → chunk-Y7VOMSZT.js} +2 -2
  19. package/dist/cli-bundle/chunks/chunk-ZLJIFSOE.js +35 -0
  20. package/dist/cli-bundle/chunks/{register-list-query-7C7DKZ2U.js → register-list-query-XYNX4ASQ.js} +2 -2
  21. package/dist/cli-bundle/chunks/register-mutation-WFQ7MJTX.js +20 -0
  22. package/dist/cli-bundle/chunks/{register-operations-IIMA5OKO.js → register-operations-JVTI7JPP.js} +2 -2
  23. package/dist/cli-bundle/chunks/{register-setup-52H36QCB.js → register-setup-KVNC5KPL.js} +2 -2
  24. package/dist/cli-bundle/focused-chunks/{chunk-VJ7EFMFL.js → chunk-242AXYB2.js} +2 -2
  25. package/dist/cli-bundle/focused-chunks/chunk-7VATS5QY.js +16 -0
  26. package/dist/cli-bundle/focused-chunks/{chunk-FOMZ6NG5.js → chunk-MKHG3T76.js} +2 -2
  27. package/dist/cli-bundle/focused-chunks/{chunk-JCOOAUHK.js → chunk-O67VDLOT.js} +48 -48
  28. package/dist/cli-bundle/focused-chunks/{chunk-UN34D63M.js → chunk-PF3E6Q36.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/{chunk-APN4QN6R.js → chunk-RMRCQPWU.js} +2 -2
  30. package/dist/cli-bundle/focused-chunks/{chunk-BPWJ4QM5.js → chunk-S4U5CN5Q.js} +2 -2
  31. package/dist/cli-bundle/focused-chunks/chunk-T2LXXSOD.js +158 -0
  32. package/dist/cli-bundle/main.js +2 -2
  33. package/dist/cli-bundle/sdk-contracts.js +1 -1
  34. package/dist/cli-bundle/sdk-core.js +25 -25
  35. package/dist/cli-bundle/sdk-governance.js +1 -1
  36. package/dist/cli-bundle/sdk-graph.js +1 -1
  37. package/dist/cli-bundle/sdk-merge.js +32 -32
  38. package/dist/cli-bundle/sdk-query.js +1 -1
  39. package/dist/cli-bundle/sdk-runtime.js +1 -1
  40. package/dist/cli-bundle/sdk-testing.js +1 -1
  41. package/dist/cli-bundle/sdk.js +10 -10
  42. package/dist/core/diagnostics/remediation.js +9 -4
  43. package/dist/core/history/drift-scan.js +6 -6
  44. package/dist/core/history/history.d.ts +6 -0
  45. package/dist/core/history/history.js +47 -5
  46. package/dist/core/history/replay.d.ts +12 -1
  47. package/dist/core/history/replay.js +60 -39
  48. package/dist/mcp/server.d.ts +2 -2
  49. package/dist/mcp/server.js +78 -15
  50. package/dist/mcp/tool-definitions.js +56 -2
  51. package/dist/sdk/agent-capability-contracts.js +4 -2
  52. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +14 -2
  53. package/dist/sdk/governance/health.js +77 -11
  54. package/dist/sdk/governance/validate.js +4 -2
  55. package/dist/sdk/history-read.js +14 -6
  56. package/dist/sdk/history-repair.js +17 -10
  57. package/dist/sdk/index.d.ts +1 -0
  58. package/dist/sdk/index.js +3 -2
  59. package/dist/sdk/init-agent-guidance.js +4 -4
  60. package/dist/sdk/lifecycle/update.js +23 -10
  61. package/dist/sdk/mcp/discovery.d.ts +152 -0
  62. package/dist/sdk/mcp/discovery.js +495 -0
  63. package/dist/sdk/merge/index.d.ts +1 -1
  64. package/dist/sdk/merge/index.js +3 -3
  65. package/dist/sdk/merge/receipts.d.ts +51 -1
  66. package/dist/sdk/merge/receipts.js +146 -35
  67. package/dist/sdk/merge/three-way.d.ts +3 -1
  68. package/dist/sdk/merge/three-way.js +9 -7
  69. package/dist/sdk/runtime-extended-actions.js +4 -4
  70. package/docs/AGENT_GUIDE.md +11 -3
  71. package/docs/ARCHITECTURE.md +5 -0
  72. package/docs/CLAUDE_CODE_PLUGIN.md +2 -2
  73. package/docs/CONTEXT_RECOVERY_PRIMITIVES.md +24 -6
  74. package/docs/MCP_2026_07_28.md +9 -5
  75. package/docs/MCP_CAPABILITY_SURFACES.md +7 -1
  76. package/docs/MCP_REMOTE_TRANSPORT_SECURITY.md +11 -1
  77. package/docs/MERGE_SAFETY.md +44 -2
  78. package/docs/OUTPUT_TOKEN_ACCOUNTING.md +5 -3
  79. package/docs/PROGRESSIVE_TOOL_DISCOVERY.md +42 -0
  80. package/docs/README.md +1 -0
  81. package/docs/agent-task-token-baseline.json +157 -3
  82. package/docs/agent-task-transcripts.json +143 -0
  83. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +4 -3
  84. package/docs/performance/cli-transport-overhead.md +8 -6
  85. package/marketplace.json +2 -2
  86. package/package.json +2 -2
  87. package/packages/pm-beads/package.json +1 -1
  88. package/packages/pm-calendar/package.json +1 -1
  89. package/packages/pm-command-kit/package.json +1 -1
  90. package/packages/pm-digital-twin/package.json +1 -1
  91. package/packages/pm-governance-audit/package.json +1 -1
  92. package/packages/pm-guide-shell/package.json +1 -1
  93. package/packages/pm-kanban/package.json +1 -1
  94. package/packages/pm-lifecycle-hooks/package.json +1 -1
  95. package/packages/pm-linked-test-adapters/package.json +1 -1
  96. package/packages/pm-search-advanced/package.json +1 -1
  97. package/packages/pm-templates/package.json +1 -1
  98. package/packages/pm-todos/package.json +1 -1
  99. package/packages/pm-vcs/package.json +1 -1
  100. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  101. package/plugins/pm-claude/README.md +4 -3
  102. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  103. package/sdk/public-surface.json +168 -2
  104. package/dist/cli-bundle/chunks/chunk-2XVV45NJ.js +0 -35
  105. package/dist/cli-bundle/chunks/chunk-3FCSFWZT.js +0 -13
  106. package/dist/cli-bundle/chunks/register-mutation-OI4BJLUX.js +0 -20
  107. package/dist/cli-bundle/focused-chunks/chunk-BMD42PUG.js +0 -158
  108. package/dist/cli-bundle/focused-chunks/chunk-EUTABA4M.js +0 -16
@@ -1,20 +0,0 @@
1
- import{a as me,c as Xe,d as ye,f as Ye,g as Ze,h as Qe}from"./chunk-OUGDA7NR.js";import{B as He,C as ie,D as Be,E as Ue,F as Ge,G as qe,H as ze,I as Je,L as Ke,M as ae,N as re,O as se,V as le,W as de,X as ue,ma as Vt,na as zt,oa as Jt,pa as Kt,qa as Wt,ra as Xt,sa as Yt,ta as Zt,ua as Qt,va as ce,xa as pe,ya as fe,za as We}from"./chunk-SXMHPK4V.js";import"./chunk-QZCIBZR3.js";import"./chunk-5DH5XCJL.js";import"./chunk-QWRRFYK3.js";import{Nb as Le,Qa as Fe,Ra as Me,Ta as Pe,Ua as $e,Va as Ne,ga as Oe,qa as ee,sa as te,sc as je,ta as oe,ua as ne,wc as Ve}from"./chunk-2XVV45NJ.js";import{$ as Ot,I as ft,J as mt,K as yt,L as gt,M as ht,N as vt,O as bt,P as wt,Q as kt,R as At,S as St,T as _t,U as xt,V as Ct,W as Dt,X as Rt,Y as It,Z as Tt,_ as Et,aa as Ft,ba as Mt,ca as Pt,da as $t,ea as Nt,fa as Ht,ga as Lt,ha as Bt,ia as Ut,ja as Gt,ka as qt,la as jt,w as Q}from"./chunk-IEFJ3ZEB.js";import{aa as Te,i as W}from"./chunk-3FCSFWZT.js";import"./chunk-WYRZZ5ZE.js";import{C as c,Dj as J,E as m,Ej as De,Ga as xe,Gm as F,He as q,Hg as k,Jg as f,Kg as h,Km as y,Nm as u,Om as s,Pm as A,Qm as M,Tm as X,Um as Y,Vh as pt,Vm as Z,Wa as O,Wm as Ee,Zj as K,a as Se,ak as Re,da as E,ei as z,fn as w,id as U,jd as Ce,la as _e,pd as D,th as V,ud as H,wm as Ie,xf as j,ze as G}from"./chunk-NW6LV3TU.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="8bc9436f-c101-583d-ae42-02d51b5eb027")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d79c73c8-07a5-5a39-aca5-4058264684d6")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f439176a-7297-5235-b96a-3e393af8602b")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="51b91e68-4bd6-521d-926e-e3b03f4b4956")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e8b566c3-db93-54d7-a917-38bf317cb575")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d9bb2d77-9ea1-51f9-a186-a2c222a6fbb3")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="41658a2a-e730-5c0c-9783-70b30ee9b2fc")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="890d56e2-d85f-5d29-90b3-1d832210ea09")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2fa91bad-9a89-5c42-8b0f-dbcd2728c563")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="13a390ed-dac6-51bc-aeee-17f601e73282")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c916e9b2-d840-585e-b7e2-120b677c7498")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f3dbfd7a-f028-5927-b62d-2f078389f06d")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="49eb11f2-6d0e-59e6-9b7d-3a1515229879")}catch{}})();var P={};Se(P,{PROFILE_SUBCOMMANDS:()=>Vt,formatProfileApplyHuman:()=>Qt,formatProfileLintHuman:()=>Zt,formatProfileListHuman:()=>Xt,formatProfileShowHuman:()=>Yt,runProfileApply:()=>Wt,runProfileLint:()=>Kt,runProfileList:()=>zt,runProfileShow:()=>Jt});(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="faf8a076-fe77-5017-b570-a49e7031ee0d")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bb095de1-0784-5659-9d73-91fd0a033c7d")}catch{}})();var $={};Se($,{SCHEMA_SUBCOMMANDS:()=>gt,_testOnlySchemaCommand:()=>jt,buildInvalidTypeHint:()=>pt,ensureTypeFolderScaffold:()=>bt,formatSchemaAddFieldHuman:()=>Ht,formatSchemaAddStatusHuman:()=>Ft,formatSchemaAddTypeHuman:()=>Et,formatSchemaApplyPresetHuman:()=>Gt,formatSchemaEvolutionMigrationHuman:()=>yt,formatSchemaInferTypesHuman:()=>qt,formatSchemaListFieldsHuman:()=>Bt,formatSchemaListHuman:()=>Pt,formatSchemaRemoveFieldHuman:()=>Lt,formatSchemaRemoveStatusHuman:()=>Mt,formatSchemaRemoveTypeHuman:()=>Ot,formatSchemaShowFieldHuman:()=>Ut,formatSchemaShowHuman:()=>$t,formatSchemaShowStatusHuman:()=>Nt,planSchemaEvolutionMigration:()=>ft,runSchemaAddField:()=>xt,runSchemaAddStatus:()=>wt,runSchemaAddType:()=>ht,runSchemaApplyPreset:()=>It,runSchemaEvolutionMigration:()=>mt,runSchemaInferTypes:()=>Tt,runSchemaList:()=>At,runSchemaListFields:()=>Dt,runSchemaRemoveField:()=>Ct,runSchemaRemoveStatus:()=>kt,runSchemaRemoveType:()=>vt,runSchemaShow:()=>St,runSchemaShowField:()=>Rt,runSchemaShowStatus:()=>_t});(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="926afd8a-6d7c-503f-a82f-0ef1f4d66c85")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="8052e529-7849-58b1-8ff2-94be44af3ca9")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c55461f3-15d7-51f4-9e41-f71ce693b7b8")}catch{}})();async function ge(e){typeof e.description=="string"&&e.description.trim()==="-"&&(e.description=await D().resolveValue(e.description,"--description")??"")}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3b23ded4-a821-5ff0-8783-927875d0457b")}catch{}})();async function eo(e,t,o,n){let i=y(n),r=await We(e,t,{status:typeof o.status=="string"?o.status:void 0,author:typeof o.author=="string"?o.author:i.author,message:typeof o.message=="string"?o.message:void 0,force:o.force===!0},i);await w(i,r),f(r,i)}async function to(e,t){let o=y(t),n=await D().resolveValue("-","--stdin-json");if(n===void 0||n.trim().length===0)throw new m("pm item mutate requires a non-empty JSON batch on stdin.",c.USAGE);let i=typeof e.transactionId=="string"?e.transactionId.trim():"";if(i.length===0)throw new m("pm item mutate requires --transaction-id <value>.",c.USAGE);let r=O(process.cwd(),o.path),a=await z(r),l=Xe(n,{transactionId:i,idPrefix:a.id_prefix}),{mutations:d,references:p}=l,v=me(e);if(e.dryRun===!0){f({transaction_id:i,dry_run:!0,mutation_count:d.length,mutations:d,references:p},o);return}let b=await Ye({pmRoot:r,transactionId:i,author:G(typeof e.author=="string"?e.author:o.author,a.author_default),mutations:d,...v});f({...b,mutation_count:d.length,references:p},o)}function oo(e,t){return typeof e=="string"&&e.trim().length>0?e.trim():typeof t=="string"?t.trim():""}async function no(e,t,o,n){let i=y(n),r=typeof o.transactionId=="string"?o.transactionId.trim():"";if(r.length===0)throw new m("pm item complete requires --transaction-id <value>.",c.USAGE);let a=oo(t,o.reason);if(a.length===0)throw new m("pm item complete requires a close reason.",c.USAGE);let d=Object.fromEntries(["file","doc","test","comment","note","learning"].filter(_=>o[_]!==void 0).map(_=>[_,o[_]])),p=o.force===!0,{lockTtlSeconds:v,lockWaitMs:b}=me(o),g={...typeof o.resolution=="string"?{resolution:o.resolution}:{},...typeof o.expectedResult=="string"?{expectedResult:o.expectedResult}:{},...typeof o.actualResult=="string"?{actualResult:o.actualResult}:{},...typeof o.completedAt=="string"?{completedAt:o.completedAt}:{},...typeof o.validateClose=="string"?{validateClose:o.validateClose}:{},...p?{force:!0}:{}},R={id:e,reason:a,...Object.keys(d).length===0?{}:{evidence:d},...Object.keys(g).length===0?{}:{closeOptions:g},...p?{releaseOptions:{force:!0}}:{}};if(o.dryRun===!0){let _=Ze(R);f({transaction_id:r,dry_run:!0,mutation_count:_.length,mutations:_},i);return}let S=O(process.cwd(),i.path),I=await Qe({pmRoot:S,transactionId:r,author:G(typeof o.author=="string"?o.author:i.author,(await z(S)).author_default),...R,lockTtlSeconds:v,lockWaitMs:b});f({...I,mutation_count:Object.keys(I.results).length},i)}function et(e){let t=e.commands.find(o=>o.name()==="item")??e.command("item").description("Run item lifecycle operations.");t.command("reopen <id> <reason>").option("--status <value>","Active target status: open or in_progress").option("--message <value>","Human-readable recurrence history message").option("--force","Override ownership or stale-lock conflicts").option("--author <value>","Mutation author").description("Reopen terminal work with recurrence evidence.").action(eo),t.command("mutate").requiredOption("--transaction-id <value>","Stable idempotency key used to resume an interrupted batch").option("--stdin-json","Read the JSON mutation array from stdin",!0).option("--dry-run","Validate and preview the batch without writing").option("--create-compensation <mode>","Created-item compensation policy: close or delete","close").option("--lock-ttl-seconds <n>","Workspace transaction lock lifetime in seconds").option("--lock-wait-ms <n>","Maximum time to wait for the workspace transaction lock").option("--author <value>","Mutation author").description("Apply SDK-backed mutations atomically.").action(to),t.command("complete <id> [reason]").requiredOption("--transaction-id <value>","Stable idempotency key for the composed completion").option("--reason <value>","Close reason when omitted positionally").option("--file <value>","Linked file evidence",u).option("--doc <value>","Linked documentation evidence",u).option("--test <value>","Linked test evidence",u).option("--comment <value>","Evidence comment",u).option("--note <value>","Completion note",u).option("--learning <value>","Durable completion learning",u).option("--resolution <value>","Structured resolution evidence").option("--expected-result <value>","Expected result evidence").option("--actual-result <value>","Actual result evidence").option("--completed-at <value>","Actual completion time").option("--validate-close <mode>","Close validation: off, warn, or strict").option("--lock-ttl-seconds <n>","Workspace transaction lock lifetime in seconds").option("--lock-wait-ms <n>","Maximum time to wait for the workspace transaction lock").option("--dry-run","Validate and preview completion without writing").option("--force","Override lifecycle and ownership conflicts").option("--author <value>","Completion author").description("Close with evidence and release the claim.").action(no)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2745d577-4f6c-5b9e-b54a-e1451e022d63")}catch{}})();async function io(e,t){let o=y(t),n=Array.isArray(e.event)?e.event:[],i=await Oe(O(process.cwd(),o.path),{historyEvent:n,allActionable:e.allActionable===!0,dryRun:e.dryRun===!0,planFingerprint:s(e,"planFingerprint"),limit:e.limit,attributedAuthor:s(e,"attributedAuthor"),reviewer:s(e,"reviewer"),reason:s(e,"reason")});f(i,o)}function tt(e){e.command("history-author-acknowledge").option("--event <item-id:line>","Unknown-author event coordinate (repeatable)",u).option("--all-actionable","Select all actionable events").option("--dry-run","Preview a deterministic source-bound plan").option("--plan-fingerprint <sha256>","Apply the exact fingerprint returned by --dry-run").option("--limit <n>","Maximum coordinate rows returned in the plan").option("--attributed-author <value>","Reviewed principal attribution").option("--reviewer <value>","Disposition reviewer").option("--reason <value>","Review evidence").description("Append audited dispositions for immutable unknown-author events.").action(io)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d436d524-7827-5ca7-8542-dd579813fae1")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2d8a7e66-16e7-552f-b6d8-4cfbfb519a30")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6bbab815-17b8-5f27-8842-41d6132488b2")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="8166a37c-7673-5ad4-a042-28ca34d65aa4")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="775518a4-ff3e-5a54-8fbd-b2c4863e23db")}catch{}})();function he(e,t,o,n){if(t.trim().toLowerCase()!=="add"||!o?.trim())return;let i=s(n,"add")??s(n,"text")??s(n,"note")??s(n,"body")??s(n,"comment"),r=s(n,"file"),a=[e,o.trim()];i!==void 0?a.push("--add",i):n.stdin===!0?a.push("--stdin"):r!==void 0?a.push("--file",r):a.push("--add","-");let l=q(a),d=q([e,o.trim(),"--add","-"]);throw new m(`The positional token "add" was parsed as the item id, while "${o.trim()}" was parsed as annotation text. ${e} does not use an add subcommand.`,c.USAGE,{code:"annotation_transposed_subcommand",reason:"noun_verb_object_transposition",required:`Place the item id immediately after ${e}, then use --add for annotation text.`,examples:[...new Set([l,d])],recovery:{attempted_command:`pm ${e} add ${o.trim()}`,normalized_args:[e,"add",o.trim()],parsed_positionals:[{role:"transposed_subcommand",value:"add"},{role:"item_id",value:o.trim()}],suggested_retry:l}})}function ot(e,t,o){let n=o.flatMap(r=>{let a=s(t,r);return a===void 0?[]:[{alias:r,value:a}]});if([...new Set(n.map(({value:r})=>r))].length>1)throw new m(`Specify ${e} text with one alias or the same value across aliases: ${n.map(({alias:r})=>`--${r}`).join(", ")}`,c.USAGE,{code:"annotation_alias_conflict"});return n[0]?.value}function ao(e,t){let o=typeof t.edit=="number"?t.edit:void 0,n=typeof t.delete=="number"?t.delete:void 0,i=ot("comment",t,["add","text","body","comment"]),r=typeof e=="string"?e:void 0,a=t.stdin===!0,l=s(t,"file");if(+(i!==void 0)+ +(r!==void 0)+Number(a)+ +(l!==void 0)>1)throw i!==void 0&&r!==void 0&&!a&&l===void 0?new m("Specify comment text either as positional [text] or with --add, not both",c.USAGE):new m("Specify comment text with exactly one source: positional [text], --add, --stdin, or --file",c.USAGE);let p=i??r;return{add:p,readFromStdin:a,readFromFile:l,editIndex:o,deleteIndex:n,isMutation:typeof p=="string"||a||l!==void 0||o!==void 0||n!==void 0}}function nt(e,t,o){let n=ot(e,o,e==="note"?["add","text","note"]:["add","text"]),i=typeof t=="string"?t:void 0;if(n!==void 0&&i!==void 0)throw new m(`Specify ${e} text either as positional [text] or with --add, not both`,c.USAGE);let r=n??i,a=e==="note"?s(o,"addJson"):void 0,l=o.stdin===!0,d=s(o,"file"),p=typeof o.edit=="number"?o.edit:void 0,v=typeof o.delete=="number"?o.delete:void 0;return{add:r,addJson:a,readFromStdin:l,readFromFile:d,editIndex:p,deleteIndex:v,isMutation:typeof r=="string"||a!==void 0||l||d!==void 0||p!==void 0||v!==void 0}}async function ro(e,t,o,n){let i=y(n),r=Date.now();he("comments",e,t,o);let a=ao(t,o),l=await Ue(e,{add:a.add,stdin:a.readFromStdin,file:a.readFromFile,edit:a.editIndex,delete:a.deleteIndex,limit:s(o,"limit"),fullHistory:o.fullHistory===!0,ifAbsent:o.ifAbsent===!0,author:s(o,"author"),message:s(o,"message"),ownershipAppendBypass:o.ownershipAppendBypass===!0,force:!!o.force},i);a.isMutation&&l.changed!==!1&&await w(i,l),ve("comments",l,i,r)}async function so(e,t,o,n){let i=y(n),r=Date.now();he("notes",e,t,o);let a=nt("note",t,o),l=await qe(e,{add:a.add,addJson:a.addJson,stdin:a.readFromStdin,file:a.readFromFile,edit:a.editIndex,delete:a.deleteIndex,limit:s(o,"limit"),since:s(o,"since"),eventType:s(o,"eventType"),includeMeta:o.includeMeta===!0,fullHistory:o.fullHistory===!0,ifAbsent:o.ifAbsent===!0,author:s(o,"author"),message:s(o,"message"),ownershipAppendBypass:o.ownershipAppendBypass===!0,force:!!o.force},i);a.isMutation&&l.changed!==!1&&await w(i,l),ve("notes",l,i,r)}async function lo(e,t,o,n){let i=y(n),r=Date.now();he("learnings",e,t,o);let a=nt("learning",t,o),l=await Ge(e,{add:a.add,stdin:a.readFromStdin,file:a.readFromFile,edit:a.editIndex,delete:a.deleteIndex,limit:s(o,"limit"),fullHistory:o.fullHistory===!0,ifAbsent:o.ifAbsent===!0,author:s(o,"author"),message:s(o,"message"),ownershipAppendBypass:o.ownershipAppendBypass===!0,force:!!o.force},i);a.isMutation&&l.changed!==!1&&await w(i,l),ve("learnings",l,i,r)}function ve(e,t,o,n){f(t,o),o.profile&&h(`profile:command=${e} took_ms=${Date.now()-n}`)}function it(e,t){let o=e.command("comments").argument("<id>","Item id").argument("[text]","Optional comment text shorthand (equivalent to --add)").option("--add <text>","Append comment text; use text=<value> for structured input or - for stdin").option("--stdin","Read comment text from stdin (supports multiline markdown)").option("--file <path>","Read comment text from a file or stdin (-)").option("--edit <index>","Replace one comment using positional text, --add, --stdin, or --file",t("--edit")).option("--delete <index>","Delete the comment at 1-based <index>",t("--delete")).option("--limit <n>","Return only latest n comments").option("--full-history","Return complete comment history instead of a bounded mutation receipt").option("--if-absent","Append only when resolved author and text are absent").option("--author [value]","Comment author; defaults to PM_AUTHOR or settings").option("--message <value>","History message").option("--force","Force ownership override").description("List, add, edit, or delete comments for an item.").action(ro);A(o,"--body <text>","Alias for --add",!1),A(o,"--text <text>","Alias for --add",!1),A(o,"--comment <text>","Alias for --add",!1);let n=e.command("notes").argument("<id>","Item id").argument("[text]","Optional note text shorthand for --add").option("--add <text>","Add a text note (- reads stdin)").option("--note <text>","Alias for --add").option("--add-json <json>","Append a JSON event").option("--stdin","Read note text from stdin").option("--file <path>","Read note from file or stdin (-)").option("--edit <index>","Replace a 1-based note using the selected text input",t("--edit")).option("--delete <index>","Delete the note at 1-based <index>",t("--delete")).option("--limit <n>","Return only latest n notes").option("--since <timestamp>","Filter JSON events from this ISO time").option("--event-type <value>","Filter JSON events by top-level type").option("--include-meta","Include count and truncation metadata").option("--full-history","Return complete note history instead of a bounded receipt").option("--if-absent","Append only when resolved author and text are absent").option("--author [value]","Author; defaults to PM_AUTHOR/settings").option("--message <value>","History message").option("--force","Force ownership override").description("Manage merge-safe text notes and JSON context events.").action(so);A(n,"--text <text>","Alias for --add",!1);let i=e.command("learnings").argument("<id>","Item id").argument("[text]","Optional learning text shorthand for --add").option("--add <text>","Append learning text; use text=<value> or - for stdin").option("--stdin","Read learning text from stdin").option("--file <path>","Read learning text from a file or stdin (-)").option("--edit <index>","Replace one learning using positional text, --add, --stdin, or --file",t("--edit")).option("--delete <index>","Delete the learning at 1-based <index>",t("--delete")).option("--limit <n>","Return only latest n learnings").option("--full-history","Return complete learning history instead of a bounded receipt").option("--if-absent","Append only when resolved author and text are absent").option("--author [value]","Learning author (optional; falls back to PM_AUTHOR/settings)").option("--message <value>","History message").option("--force","Force ownership override").description("List, add, edit, or delete learnings for an item.").action(lo);A(i,"--text <text>","Alias for --add",!1)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="452f6689-f5bd-5398-915b-52ce7e2fd55e")}catch{}})();function be(e,t){return o=>{let n=Number(o);if(!Number.isInteger(n)||n<t)throw new m(`${e} must be an integer greater than or equal to ${t}.`,c.USAGE);return n}}async function uo(e,t,o){let n=y(o);if(t.scope!==void 0&&t.scope!=="project"&&t.scope!=="global")throw new m("--scope must be either project or global.",c.USAGE);let i=await $e({paths:e,scope:t.scope,limit:typeof t.limit=="number"?t.limit:void 0,offset:typeof t.offset=="number"?t.offset:void 0,noTruncate:t.noTruncate===!0,strictRead:t.strictRead===!0,explain:t.explain===!0,lineRange:typeof t.lines=="string"?Me(t.lines):void 0,decisionDepth:typeof t.decisionDepth=="number"?t.decisionDepth:void 0},n);f(i,n)}function at(e){e.command("lookup").argument("<paths...>","Project-relative or absolute source paths").option("--scope <scope>","Restrict links to project or global scope").option("--limit <n>","Maximum referencing items to return",be("--limit",1)).option("--offset <n>","Number of referencing items to skip",be("--offset",0)).option("--no-truncate","Return every referencing item").option("--strict-read","Fail when any authoritative item cannot be read").option("--explain","Include ranked source-to-work rationale").option("--lines <start:end>","Attribute an inclusive source line range").option("--decision-depth <n>","Maximum governing-decision relationship depth",be("--decision-depth",1)).description("Find and explain pm items that govern requested source paths.").action(uo)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2e6b30ea-5891-578a-9e6c-a612aa26361f")}catch{}})();var co=["add-","apply-","list-","remove-","show-"],po=new Set(["field","fields","help","status","statuses","type","types"]);function we(e){let t=e.trim(),o=t.toLowerCase();return o.length===0?!1:t[0]===o[0]||po.has(o)||co.some(n=>o.startsWith(n))}function L(e){if(e!=null){if(typeof e=="number"){if(!Number.isInteger(e))throw new m("--order must be a finite integer.",c.USAGE);return e}if(typeof e=="string"){if(e.trim().length===0)return;let t=Number(e);if(!Number.isInteger(t))throw new m("--order must be a finite integer.",c.USAGE);return t}throw new m("--order must be a finite integer.",c.USAGE)}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="28a59fb9-80bc-5e2a-b926-1bb227c103c6")}catch{}})();var fo=new Set(_e.map(e=>e.toLowerCase())),mo=new Set(Ie.map(e=>e==="estimate"?"estimatedMinutes":e));function yo(e,t){let o=t.normalizedSubcommand;return o!=="rename-type"&&o!=="rename-field"&&o!=="remap-status"?null:e.runSchemaEvolutionMigration({kind:o,from:t.typeName,to:s(t.options,"to"),...o==="rename-field"&&typeof t.options.type=="string"?{type:t.options.type}:{}},{migrationId:s(t.options,"migrationId")??s(t.options,"migration_id"),dryRun:t.options.dryRun===!0,author:t.author,force:t.force},t.globalOptions)}function go(e,t){let{normalizedSubcommand:o,typeName:n,globalOptions:i,author:r,force:a}=t;switch(o){case"list":return e.runSchemaList(i);case"show":return e.runSchemaShow(n,i);case"show-status":return e.runSchemaShowStatus(n,i);case"list-fields":return e.runSchemaListFields(i);case"show-field":return e.runSchemaShowField(n,i);case"remove-type":return e.runSchemaRemoveType(n,{author:r,force:a},i);case"remove-field":return e.runSchemaRemoveField(n,{author:r,force:a},i);case"remove-status":return e.runSchemaRemoveStatus(n,{author:r,force:a},i);case"apply-preset":return e.runSchemaApplyPreset(n,{author:r,force:a},i);default:return null}}async function ho(e,t){let{normalizedSubcommand:o,typeName:n,options:i,globalOptions:r}=t,{author:a,force:l,description:d}=t,p=yo(e,t);if(p)return p;let v=go(e,t);if(v)return v;switch(o){case"add-field":return e.runSchemaAddField(n,{type:typeof i.type=="string"?i.type:void 0,commands:t.commands,description:d,cliFlag:typeof i.cliFlag=="string"?i.cliFlag:void 0,alias:t.aliases,required:!!i.required,requiredOnCreate:!!i.requiredOnCreate,allowUnset:i.allowUnset!==!1,requiredTypes:t.requiredTypes,author:a,force:l},r);case"add-status":return e.runSchemaAddStatus(n,{role:t.roles,alias:t.aliases,description:d,order:t.order,author:a,force:l},r);default:return i.infer===!0?e.runSchemaInferTypes({minCount:t.minCount,apply:!!i.apply,author:a,force:l},r):e.runSchemaAddType(n,{description:d,defaultStatus:t.defaultStatus,folder:typeof i.folder=="string"?i.folder:void 0,alias:t.aliases,author:a,force:l},r)}}function vo(e,t){if("migration_id"in t){k(`${e.formatSchemaEvolutionMigrationHuman(t)}
2
- `);return}switch(t.action){case"list":k(`${e.formatSchemaListHuman(t)}
3
- `);return;case"show":k(`${e.formatSchemaShowHuman(t)}
4
- `);return;case"show-status":k(`${e.formatSchemaShowStatusHuman(t)}
5
- `);return;case"list-fields":k(`${e.formatSchemaListFieldsHuman(t)}
6
- `);return;case"show-field":k(`${e.formatSchemaShowFieldHuman(t)}
7
- `);return;case"remove-type":k(`${e.formatSchemaRemoveTypeHuman(t)}
8
- `);break;case"remove-field":k(`${e.formatSchemaRemoveFieldHuman(t)}
9
- `);break;case"apply-preset":k(`${e.formatSchemaApplyPresetHuman(t)}
10
- `);break;case"infer-types":k(`${e.formatSchemaInferTypesHuman(t)}
11
- `);break;case"add-field":k(`${e.formatSchemaAddFieldHuman(t)}
12
- `);break;case"add-status":k(`${e.formatSchemaAddStatusHuman(t)}
13
- `);break;case"remove-status":k(`${e.formatSchemaRemoveStatusHuman(t)}
14
- `);break;default:k(`${e.formatSchemaAddTypeHuman(t)}
15
- `);break}t.warnings.length>0&&h(`schema ${t.action} warnings: ${X(t.warnings)}`)}async function bo(e,t,o,n,i){switch(t){case"list":return e.runProfileList();case"show":return e.runProfileShow(o);case"lint":return e.runProfileLint(o);default:return e.runProfileApply(o,{dryRun:n.dryRun===!0,author:typeof n.author=="string"?n.author:void 0,force:n.force===!0},i)}}function wo(e,t){switch(t.action){case"list":k(`${e.formatProfileListHuman(t)}
16
- `);return;case"show":k(`${e.formatProfileShowHuman(t)}
17
- `);return;case"lint":k(`${e.formatProfileLintHuman(t)}
18
- `);return;default:k(`${e.formatProfileApplyHuman(t)}
19
- `),t.warnings.length>0&&h(`profile apply warnings: ${X(t.warnings)}`);break}}function ko(e){return t=>{let o=Number(t);if(!Number.isInteger(o)||o<1)throw new m(`${e} must be a positive integer (1-based index).`,c.USAGE);return o}}function rt(e,t){e.option("--filter-has-notes",`Select only items that have notes before ${t}`).option("--filter-no-notes",`Select only items that have no notes before ${t}`).option("--filter-has-learnings",`Select only items that have learnings before ${t}`).option("--filter-no-learnings",`Select only items that have no learnings before ${t}`).option("--filter-has-files",`Select only items that have linked files before ${t}`).option("--filter-no-files",`Select only items that have no linked files before ${t}`).option("--filter-has-docs",`Select only items that have linked docs before ${t}`).option("--filter-no-docs",`Select only items that have no linked docs before ${t}`).option("--filter-has-tests",`Select only items that have linked tests before ${t}`).option("--filter-no-tests",`Select only items that have no linked tests before ${t}`).option("--filter-has-comments",`Select only items that have comments before ${t}`).option("--filter-no-comments",`Select only items that have no comments before ${t}`).option("--filter-has-deps",`Select only items that have dependencies before ${t}`).option("--filter-no-deps",`Select only items that have no dependencies before ${t}`).option("--filter-has-body",`Select only items that have a non-empty body before ${t}`).option("--filter-empty-body",`Select only items with an empty body before ${t}`).option("--filter-has-linked-command",`Select only items whose linked tests carry a runnable command before ${t}`).option("--filter-no-linked-command",`Select only items whose linked tests carry no runnable command before ${t}`).option("--filter-reviewer-missing",`Select only items missing reviewer before ${t}`).option("--filter-risk-missing",`Select only items missing risk before ${t}`).option("--filter-confidence-missing",`Select only items missing confidence before ${t}`).option("--filter-sprint-missing",`Select only items missing sprint before ${t}`).option("--filter-release-missing",`Select only items missing release before ${t}`)}var Ao=[["filterHasNotes","filterNoNotes","--filter-has-notes","--filter-no-notes"],["filterHasLearnings","filterNoLearnings","--filter-has-learnings","--filter-no-learnings"],["filterHasFiles","filterNoFiles","--filter-has-files","--filter-no-files"],["filterHasDocs","filterNoDocs","--filter-has-docs","--filter-no-docs"],["filterHasTests","filterNoTests","--filter-has-tests","--filter-no-tests"],["filterHasComments","filterNoComments","--filter-has-comments","--filter-no-comments"],["filterHasDeps","filterNoDeps","--filter-has-deps","--filter-no-deps"],["filterHasBody","filterEmptyBody","--filter-has-body","--filter-empty-body"],["filterHasLinkedCommand","filterNoLinkedCommand","--filter-has-linked-command","--filter-no-linked-command"]];function dt(e){let t=o=>e[o]===!0?!0:void 0;for(let[o,n,i,r]of Ao)if(e[o]===!0&&e[n]===!0)throw new m(`Cannot combine ${i} with ${r} for the same field.`,c.USAGE);return{filterReviewerMissing:t("filterReviewerMissing"),filterRiskMissing:t("filterRiskMissing"),filterConfidenceMissing:t("filterConfidenceMissing"),filterSprintMissing:t("filterSprintMissing"),filterReleaseMissing:t("filterReleaseMissing"),hasNotes:t("filterHasNotes"),hasLearnings:t("filterHasLearnings"),hasFiles:t("filterHasFiles"),hasDocs:t("filterHasDocs"),hasTests:t("filterHasTests"),hasComments:t("filterHasComments"),hasDeps:t("filterHasDeps"),hasBody:t("filterHasBody"),hasLinkedCommand:t("filterHasLinkedCommand"),noNotes:t("filterNoNotes"),noLearnings:t("filterNoLearnings"),noFiles:t("filterNoFiles"),noDocs:t("filterNoDocs"),noTests:t("filterNoTests"),noComments:t("filterNoComments"),noDeps:t("filterNoDeps"),emptyBody:t("filterEmptyBody"),noLinkedCommand:t("filterNoLinkedCommand")}}function ke(e,t){for(let o of t){let n=[],i=e.args,r=a=>(e.args!==i&&(n.length=0,i=e.args),n.push(a),n);o.required?e.requiredOption(o.option,o.description):o.repeatable?e.option(o.option,o.description,r):e.option(o.option,o.description);for(let a of o.aliasOptions??[])J(o.option,a.option)?A(e,a.option,a.description,o.repeatable===!0,o.repeatable?r:void 0):o.repeatable?e.option(a.option,a.description,r):e.option(a.option,a.description)}}function So(e){let t=o=>typeof e[o]=="string"?e[o]:void 0;return{type:t("filterType"),tag:t("filterTag"),priority:t("filterPriority"),deadlineBefore:t("filterDeadlineBefore"),deadlineAfter:t("filterDeadlineAfter"),updatedAfter:t("filterUpdatedAfter"),updatedBefore:t("filterUpdatedBefore"),createdAfter:t("filterCreatedAfter"),createdBefore:t("filterCreatedBefore"),ids:t("ids"),assignee:t("filterAssignee"),assigneeFilter:t("filterAssigneeFilter")??t("filterAssignee_filter"),parent:t("filterParent"),sprint:t("filterSprint"),release:t("filterRelease"),filterAcMissing:e.filterAcMissing===!0?!0:void 0,filterEstimatesMissing:e.filterEstimatesMissing===!0||e.filterEstimateMissing===!0?!0:void 0,filterResolutionMissing:e.filterResolutionMissing===!0?!0:void 0,filterMetadataMissing:e.filterMetadataMissing===!0?!0:void 0,...dt(e),limit:t("limit"),offset:t("offset"),includeBody:!0}}function T(...e){for(let t of e)if(typeof t=="string")return t}function Ae(e){if(Array.isArray(e))return e;if(typeof e=="string")return[e]}function _o(e,t,o){return typeof t=="string"&&t.length>0?{positionalType:e,positionalTitle:t}:typeof e!="string"||e.length===0?{positionalType:void 0,positionalTitle:void 0}:typeof o.title=="string"&&o.title.trim().length>0&&o.type===void 0?{positionalType:e,positionalTitle:void 0}:{positionalType:void 0,positionalTitle:e}}function xo(e,t,o){if(e!==void 0||typeof t!="string"||t.length===0||o.title!==void 0||o.type!==void 0||!fo.has(t.trim().toLowerCase()))return;let n=t.trim();throw new m(`pm create needs a title \u2014 "${n}" looks like an item type, not a title. Use either: pm create ${n} "<title>" or pm create "<title>" --type ${n}.`,c.USAGE,{code:"create_positional_type_without_title",why:'Without this guard the single positional is used as the title and the type defaults to Task \u2014 so the command would silently create a Task literally titled "'+n+'".',examples:[`pm create ${n} "Wire up SSO for the agent harness"`,`pm create "Wire up SSO for the agent harness" --type ${n}`],nextSteps:[`Re-run with both type and title: pm create ${n} "<title>"`]})}var Co=["body","bodyFile","description","dep","depRemove","comment","note","learning","file","test","doc","reminder","event","typeOption","field","ids"];function B(e){let t=Co.flatMap(o=>{let n=e[o],i=typeof n=="string"&&n.trim()==="-"?1:Array.isArray(n)?n.filter(a=>typeof a=="string"&&a.trim()==="-").length:0,r=`--${o.replace(/[A-Z]/g,a=>`-${a.toLowerCase()}`)}`;return Array.from({length:i},()=>r)});if(e.stdinJson===!0&&t.unshift("--stdin-json"),t.length>1)throw new m(`Only one option may consume stdin per command invocation. Found: ${t.join(", ")}.`,c.USAGE)}function ut(e,t,o){let n=[];t&&n.push("body"),o&&n.push("description"),Ce(e,n)}function ct(e,t){return!t&&typeof e.description=="string"&&e.description.trim()==="-"}async function Do(e,t,o,n){let i=y(n),r=Date.now();B(o);let a=o.stdinJson===!0;if(a){let g=await D().resolveValue("-","--stdin-json");o=ye(g??"","create",o)}let l=_o(e,t,o);xo(l.positionalType,l.positionalTitle,o),typeof l.positionalType=="string"&&l.positionalType.length>0&&o.type===void 0&&(o.type=l.positionalType),typeof l.positionalTitle=="string"&&l.positionalTitle.length>0&&o.title===void 0&&(o.title=l.positionalTitle);let d=ct(o,a);a||await ge(o);let p=typeof o.bodyFile=="string";p&&(o.body=await V(String(o.bodyFile),o.body!==void 0?String(o.body):void 0),delete o.bodyFile);let v=Y(o,{requireType:!1});ut(v,p,d),a&&U(v);let b=await je(v,i);await w(i,b),f(b,i),i.profile&&h(`profile:command=create took_ms=${Date.now()-r}`)}function Ro(e){return{type:s(e,"filterType"),tag:s(e,"filterTag"),priority:s(e,"filterPriority"),deadlineBefore:s(e,"filterDeadlineBefore"),deadlineAfter:s(e,"filterDeadlineAfter"),updatedAfter:s(e,"filterUpdatedAfter"),updatedBefore:s(e,"filterUpdatedBefore"),createdAfter:s(e,"filterCreatedAfter"),createdBefore:s(e,"filterCreatedBefore"),ids:s(e,"ids"),assignee:s(e,"filterAssignee"),assigneeFilter:T(e.filterAssigneeFilter,e.filterAssignee_filter),parent:s(e,"filterParent"),sprint:s(e,"filterSprint"),release:s(e,"filterRelease"),...dt(e),limit:s(e,"limit"),offset:s(e,"offset")}}async function Io(e,t){let o=y(t),n=Date.now();B(e),e.ids=await H(s(e,"ids"));let i=await Be({status:s(e,"filterStatus"),list:Ro(e),reason:s(e,"reason"),completedAt:s(e,"completedAt"),resolution:s(e,"resolution"),expectedResult:T(e.expectedResult,e.expected_result,e.expected),actualResult:T(e.actualResult,e.actual_result,e.actual),validateClose:e.validateClose===!0?"warn":s(e,"validateClose"),author:s(e,"author"),message:s(e,"message"),force:!!e.force,dryRun:e.dryRun===!0?!0:void 0,rollback:s(e,"rollback"),checkpoint:e.checkpoint===!1?!1:void 0},o);await w(o,i),f(i,o),o.profile&&h(`profile:command=close-many took_ms=${Date.now()-n}`)}async function To(e,t){let o=y(t),n=Date.now();B(e),e.ids=await H(s(e,"ids"));let i=await ze({status:s(e,"filterStatus"),list:So(e),update:Z(Ee(e)),dryRun:e.dryRun===!0?!0:void 0,rollback:s(e,"rollback"),checkpoint:e.checkpoint===!1?!1:void 0},o);await w(o,i),f(await F("update-many",[],e,o,i),o),o.profile&&h(`profile:command=update-many took_ms=${Date.now()-n}`)}async function Eo(e,t,o,n){let i=y(n),r=Date.now(),a=typeof o.reason=="string"&&o.reason.trim().length>0&&o.reason||typeof o.closeReason=="string"&&o.closeReason.trim().length>0&&o.closeReason||void 0,l=typeof t=="string"&&t.length>0?t:a,d=await Le(e,l,{author:s(o,"author"),message:s(o,"message"),validateClose:o.validateClose===!0?"warn":s(o,"validateClose"),force:!!o.force,duplicateOf:s(o,"duplicateOf"),completedAt:s(o,"completedAt"),resolution:s(o,"resolution"),expectedResult:T(o.expectedResult,o.expected_result,o.expected),actualResult:T(o.actualResult,o.actual_result,o.actual)},i);await w(i,d),f(d,i),i.profile&&h(`profile:command=close took_ms=${Date.now()-r}`)}function Oo(e){let t={...e},o=[["blocked_by","blockedBy"],["resume_context","resumeContext"],["from_search","fromSearch"],["step_title","stepTitle"],["step_body","stepBody"],["step_owner","stepOwner"],["step_status","stepStatus"],["step_evidence","stepEvidence"],["step_blocked_reason","stepBlockedReason"],["step_replacement","stepReplacement"],["depends_on","dependsOn"],["link_kind","linkKind"],["link_note","linkNote"],["promote_to_item_dep","promoteToItemDep"],["allow_multiple_active","allowMultipleActive"],["decision_text","decisionText"],["decision_rationale","decisionRationale"],["decision_evidence","decisionEvidence"],["discovery_text","discoveryText"],["validation_text","validationText"],["validation_command","validationCommand"],["validation_expected","validationExpected"],["materialize_type","materializeType"],["materialize_parent","materializeParent"],["materialize_tags","materializeTags"]];for(let[i,r]of o)t[i]!==void 0&&t[r]===void 0&&(t[r]=t[i]);let n=Y(t,{requireType:!1});return n.blockedBy=t.blockedBy,n}function Fo(e,t){if(!e)throw new m(`pm plan requires a subcommand. Allowed: ${t.join(", ")}`,c.USAGE,{code:"missing_required_argument",examples:['pm plan create --title "Refactor lock retry"',"pm plan show pm-a1b2 --depth standard",'pm plan add-step pm-a1b2 --step-title "Read lock.ts"']});if(t.includes(e))return;throw E({command_path:"plan",token:e,allowed:t,examples:e==="list"||e==="ls"?["pm list --type Plan","pm list-all --type Plan"]:void 0,retry_command:e==="list"||e==="ls"?"pm list --type Plan":void 0})}function Mo(e,t){if(e!=="reorder-step"||typeof t!="string")return;let o=Number.parseInt(t,10);if(!Number.isFinite(o))throw new m(`reorder-step requires an integer new order, got "${t}"`,c.USAGE);return o}async function Po(e,t,o,n,i,r){let a=y(r),l=Date.now(),d=(e??"").trim().toLowerCase();Fo(d,Je);let p=Oo(i),v=Mo(d,n),b=d==="create"&&typeof t=="string"&&t.length>0&&p.title===void 0?void 0:t;b===void 0&&typeof t=="string"&&t.length>0&&(p.title=t);let g=await Ke({subcommand:d,id:b,stepRef:o,reorderTo:v,options:p,global:a});await w(a,g),f(g,a),a.profile&&h(`profile:command=plan took_ms=${Date.now()-l}`)}function st(e,t){if(typeof e=="string"){if(!/^\d+$/.test(e.trim()))throw new m(`history-compact ${t} must be a non-negative integer.`,c.USAGE);return Number.parseInt(e,10)}}async function $o(e,t,o){if(e!==void 0)throw new m("merge reconcile takes no positional arguments.",c.USAGE);let n=await ue({dryRun:t.dryRun===!0,force:t.force===!0,message:typeof t.message=="string"?t.message:void 0,author:o.author},o);f(n,o),n.ok||(process.exitCode=c.GENERIC_FAILURE)}async function No(e,t,o,n,i,r){if(e===void 0||t===void 0||o===void 0||n===void 0)throw new m("merge driver requires <artifact> <base> <ours> <theirs> (git supplies %O %A %B). Example: pm merge driver history %O %A %B",c.USAGE);let a=await de({artifact:e,basePath:t,oursPath:o,theirsPath:n,outputPath:typeof i.output=="string"?i.output:void 0,itemPath:typeof i.itemPath=="string"?i.itemPath:void 0,prefer:typeof i.prefer=="string"?i.prefer:void 0},r);f(a,r),a.ok||(process.exitCode=c.GENERIC_FAILURE)}async function Ho(e,t,o,n,i,r,a){let l=y(a),d=Date.now();switch(e.trim().toLowerCase()){case"install":{if(t!==void 0)throw new m("merge install takes no positional arguments.",c.USAGE);let v=await Q({dryRun:r.dryRun===!0},l);f(v,l);break}case"reconcile":await $o(t,r,l);break;case"report":{if(t!==void 0)throw new m("merge report takes no positional arguments.",c.USAGE);f(await ee({includeReconciled:r.includeReconciled===!0}),l);break}case"driver":await No(t,o,n,i,r,l);break;default:throw E({command_path:"merge",token:e,allowed:j,display_name:"merge"})}l.profile&&h(`profile:command=merge took_ms=${Date.now()-d}`)}async function Lo(e,t,o){let n=y(o),i=Date.now(),r=await H(s(t,"ids")),a=r===void 0?void 0:De(r),l=st(t.allOver,"--all-over"),d=st(t.minEntries,"--min-entries");if(t.closed===!0&&t.allStreams===!0)throw new m("history-compact: --closed and --all-streams are mutually exclusive; pick one lifecycle scope.",c.USAGE);let p=t.closed===!0?"closed":t.allStreams===!0?"all-streams":void 0;if((a!==void 0||l!==void 0||p!==void 0)&&typeof t.before=="string")throw new m("history-compact: --before applies only in single-id mode (bulk mode always compacts full streams).",c.USAGE);if(pe(e,{ids:a,allOver:l,scope:p}),e===void 0){let b=await fe({ids:a,scope:p,allOver:l,minEntries:d,dryRun:t.dryRun===!0,author:s(t,"author"),message:s(t,"message"),force:!!t.force},n);f(b,n),b.totals.items_errored>0&&(process.exitCode=c.GENERIC_FAILURE)}else{let b=await ce(e,{before:s(t,"before"),dryRun:t.dryRun===!0,author:s(t,"author"),message:s(t,"message"),force:!!t.force},n);f(b,n)}n.profile&&h(`profile:command=history-compact took_ms=${Date.now()-i}`)}function lt(e){if(Array.isArray(e))return e.flatMap(t=>t.split(",")).map(t=>t.trim()).filter(t=>t.length>0)}async function Bo(e,t,o,n){let i=y(n),r=Date.now(),{SCHEMA_SUBCOMMANDS:a}=$,l=(e??"").trim().toLowerCase(),d=t;if(Uo(l,a),!a.includes(l)&&d===void 0&&!we(e)&&(d=e,l="add-type"),!a.includes(l))throw E({command_path:"schema",token:l,allowed:a});let p=await ho($,{normalizedSubcommand:l,typeName:d,options:o,aliases:Ae(o.alias),roles:Ae(o.role),commands:lt(o.commands),requiredTypes:lt(o.requiredTypes),defaultStatus:T(o.defaultStatus,o.default_status),order:L(o.order),minCount:L(o.minCount),author:s(o,"author"),force:!!o.force,description:s(o,"description"),globalOptions:i});i.json===!0||i.defaultOutputFormat==="json"?f(p,i):i.quiet||vo($,p),i.profile&&h(`profile:command=schema took_ms=${Date.now()-r}`)}function Uo(e,t){if(!e)throw new m(`pm schema requires a subcommand. Allowed: ${t.join(", ")}`,c.USAGE,{code:"missing_required_argument",examples:["pm schema list","pm schema show Task","pm schema show-status open",'pm schema add-type Spike --description "Time-boxed investigation" --default-status open',"pm schema remove-type Spike","pm schema add-status review --role active --alias in_review","pm schema remove-status review","pm schema add-field severity_level --type string --commands create,update","pm schema list-fields","pm schema apply-preset agile","pm schema add-type --infer --min-count 10","pm schema rename-type Spike --to Experiment --migration-id spike-v2 --dry-run","pm schema rename-field severity --to impact --migration-id severity-v2","pm schema remap-status review --to verifying --migration-id review-v2"]})}async function Go(e,t,o){let n=y(o),i=Date.now(),r=await ae(e,{title:s(t,"title"),author:s(t,"author"),message:s(t,"message"),allowDuplicate:t.allowDuplicate===!0},n);await w(n,r),f(r,n),n.profile&&h(`profile:command=copy took_ms=${Date.now()-i}`)}async function qo(e,t,o){let n=y(o),i=Date.now(),r=await se(e,{clear:t.clear===!0},n);f(r,n),n.profile&&h(`profile:command=focus took_ms=${Date.now()-i}`)}async function jo(e,t,o){let n=y(o),i=Date.now();B(t);let r=t.stdinJson===!0;if(r){let v=await D().resolveValue("-","--stdin-json");t=ye(v??"","update",t)}let a=ct(t,r);r||await ge(t);let l=typeof t.bodyFile=="string";l&&(t.body=await V(String(t.bodyFile),t.body!==void 0?String(t.body):void 0),delete t.bodyFile);let d=Z(t);ut(d,l,a),r&&U(d);let p=await Ve(e,d,n);await w(n,p),f(await F("update",[e],t,n,p),n),n.profile&&h(`profile:command=update took_ms=${Date.now()-i}`)}async function Vo(e,t,o){let n=y(o),i=Date.now(),r=await re(e,{author:s(t,"author"),message:s(t,"message"),force:!!t.force,dryRun:t.dryRun===!0},n);r.dry_run!==!0&&await w(n,r),f(r,n),n.profile&&h(`profile:command=delete took_ms=${Date.now()-i}`)}function zo(e,t){let o=s(t,"body"),n=s(t,"text"),i=typeof e=="string"?e:void 0;if([o,n,i].filter(l=>l!==void 0).length>1)throw new m("Specify append text with exactly one source: positional [text], --body, or --text",c.USAGE);let a=o??n??i;if(a===void 0)throw new m("Missing append text. Provide it as positional [text], --body <value>, or --text <value> (use - for stdin).",c.USAGE);return a}async function Jo(e,t,o,n){let i=y(n),r=Date.now(),a=await He(e,{body:zo(t,o),author:s(o,"author"),message:s(o,"message"),force:!!o.force},i);await w(i,a),f(a,i),i.profile&&h(`profile:command=append took_ms=${Date.now()-r}`)}async function Ko(e,t,o,n){let i=y(n),r=Date.now(),a=await ie(e,t,{author:s(o,"author"),message:s(o,"message"),force:!!o.force},i);await w(i,a),f(a,i),i.profile&&h(`profile:command=restore took_ms=${Date.now()-r}`)}async function Wo(e,t,o,n){let i=y(n),r=Date.now(),{PROFILE_SUBCOMMANDS:a}=P,l=(e??"").trim().toLowerCase();if(!l)throw new m(`pm profile requires a subcommand. Allowed: ${a.join(", ")}`,c.USAGE,{code:"missing_required_argument",examples:["pm profile list","pm profile show agile","pm profile apply agile --dry-run","pm profile lint agile"]});if(!a.includes(l))throw E({command_path:"profile",token:l,allowed:a});let d=await bo(P,l,t,o,i);i.json===!0||i.defaultOutputFormat==="json"?f(d,i):i.quiet||wo(P,d),d.action==="lint"&&!d.ok&&(process.exitCode=c.GENERIC_FAILURE),i.profile&&h(`profile:command=profile took_ms=${Date.now()-r}`)}function C(e,t){return Ae(e[t])??[]}async function Xo(e,t,o){let n=y(o),i=Date.now(),r=C(t,"add"),a=C(t,"addGlob"),l=C(t,"remove"),d=C(t,"migrate"),p=await Pe(e,{add:r,addGlob:a,remove:l,migrate:d,note:s(t,"note"),list:!!t.list,appendStable:!!t.appendStable,validatePaths:!!t.validatePaths,author:s(t,"author"),message:s(t,"message"),force:!!t.force},n);(r.length>0||a.length>0||l.length>0||d.length>0)&&await w(n,p),f(await F("files",[e],t,n,p),n),n.profile&&h(`profile:command=files took_ms=${Date.now()-i}`)}async function Yo(e,t,o){let n=y(o),i=Date.now(),r={...o.optsWithGlobals(),...t},a=await Ne(e,{apply:!!r.apply,note:s(r,"note"),appendStable:!!r.appendStable,author:s(r,"author"),message:s(r,"message"),force:!!r.force},n);a.changed&&await w(n,a),f(a,n),n.profile&&h(`profile:command=files.discover took_ms=${Date.now()-i}`)}async function Zo(e,t,o){let n=y(o),i=Date.now(),r=C(t,"add"),a=C(t,"addGlob"),l=C(t,"remove"),d=C(t,"migrate"),p=await Fe(e,{add:r,addGlob:a,remove:l,migrate:d,note:s(t,"note"),list:!!t.list,validatePaths:!!t.validatePaths,author:s(t,"author"),message:s(t,"message"),force:!!t.force},n);(r.length>0||a.length>0||l.length>0||d.length>0)&&await w(n,p),f(await F("docs",[e],t,n,p),n),n.profile&&h(`profile:command=docs took_ms=${Date.now()-i}`)}async function Qo(e,t,o){let n=y(o),i=Date.now(),r=await Te(e,{format:t.format,maxDepth:s(t,"maxDepth"),collapse:t.collapse,summary:t.summary===!0,full:t.full===!0,nodeLimit:s(t,"nodeLimit"),edgeLimit:s(t,"edgeLimit"),tokenBudget:s(t,"tokenBudget"),cursor:s(t,"cursor"),direction:s(t,"direction"),...Array.isArray(t.kind)?{kind:t.kind}:{}},n);f(r,n),n.profile&&h(`profile:command=deps took_ms=${Date.now()-i}`)}function Wi(e,t={}){let o=e.command("create").argument("[type-or-title]",'Item title, or item type when a title follows (e.g. `pm create task "Fix bug"`)').argument("[title]","Item title when the first argument is an item type").description("Create a new project management item.");if(ke(o,K),o.option("--stdin-json","Read a full item JSON document from stdin; explicit flags override document values").option("--body-file <path>","Load body from a file or stdin (-); conflicts with --body").option("--clear-deps","Clear dependency entries").option("--clear-comments","Clear comments").option("--clear-notes","Clear notes").option("--clear-learnings","Clear learnings").option("--clear-files","Clear linked files").option("--clear-tests","Clear linked tests").option("--clear-docs","Clear linked docs").option("--clear-reminders","Clear reminders").option("--clear-events","Clear events").option("--clear-type-options","Clear type options").option("--allow-duplicate","Explicitly create even when strict similarity governance finds likely duplicates").action(Do),t.targetCommandName==="create")return;e.command("copy").argument("<id>","Source item id").option("--title <value>","Optional title override for the copied item").option("--author <value>","Mutation author").option("--message <value>","History message").option("--allow-duplicate","Explicitly copy even when strict similarity governance finds likely duplicates").description("Copy an item into a new item id while resetting lifecycle fields.").action(Go),e.command("focus").argument("[id]","Item id to focus (omit to show current focus)").option("--clear","Clear the focused item").description("Set/clear/show the session focused item that new items default --parent to.").action(qo);let n=e.command("update").argument("<id>","Item id").description("Update item fields and metadata.");ke(n,Re),n.option("--stdin-json","Read a full item JSON document from stdin; explicit flags override document values").option("--body-file <path>","Load body from a file or stdin (-); conflicts with --body").option("--replace-deps","Atomically replace dependency entries with the provided --dep values").option("--replace-tests","Atomically replace linked test entries with the provided --test values").option("--replace-files","Atomically replace linked file entries with the provided --file values").option("--replace-docs","Atomically replace linked doc entries with the provided --doc values").option("--clear-deps","Clear dependency entries").option("--clear-comments","Clear comments").option("--clear-notes","Clear notes").option("--clear-learnings","Clear learnings").option("--clear-files","Clear linked files").option("--clear-tests","Clear linked tests").option("--clear-docs","Clear linked docs").option("--clear-reminders","Clear reminders").option("--clear-events","Clear events").option("--clear-type-options","Clear type options").option("--force","Force ownership override"),n.action(jo),et(e);let i=e.command("update-many").description("Bulk-update matched items with dry-run plans and rollback checkpoints.").option("--filter-status <value>","Filter by status before applying updates").option("--filter-type <value>","Filter by item type before applying updates").option("--filter-tag <value>","Filter by tag before applying updates").option("--filter-priority <value>","Filter by priority before applying updates").option("--filter-deadline-before <value>","Filter by deadline upper bound before applying updates").option("--filter-deadline-after <value>","Filter by deadline lower bound before applying updates").option("--filter-updated-after <value>","Filter by updated_at lower bound before applying updates (ISO/relative)").option("--filter-updated-before <value>","Filter by updated_at upper bound before applying updates (ISO/relative)").option("--filter-created-after <value>","Filter by created_at lower bound before applying updates (ISO/relative)").option("--filter-created-before <value>","Filter by created_at upper bound before applying updates (ISO/relative)").option("--filter-assignee <value>","Filter by assignee before applying updates").option("--filter-assignee-filter <value>","Filter assignee presence: assigned|unassigned before applying updates").option("--filter-parent <value>","Filter by parent item ID before applying updates").option("--filter-sprint <value>","Filter by sprint before applying updates").option("--filter-release <value>","Filter by release before applying updates").option("--filter-ac-missing","Select only items missing acceptance_criteria (bulk backfill)").option("--filter-estimates-missing","Select only items missing estimated_minutes (bulk backfill)").option("--filter-resolution-missing","Select only terminal items missing resolution (bulk backfill)").option("--filter-metadata-missing","Select only items missing any tracked metadata (AC, estimate, or resolution)");rt(i,"applying updates"),i.option("--ids <value>","Explicit ID allowlist: comma/newline text, - stdin, or @path file").option("--limit <n>","Limit matched item count before apply/preview").option("--offset <n>","Skip first n matched rows before apply/preview").option("--dry-run","Preview per-item diffs and checkpoint intent without mutating").option("--rollback <value>","Rollback a prior update-many checkpoint ID").option("--no-checkpoint","Disable checkpoint creation during apply mode").option("--title, -t <value>","Set title").option("--description, -d <value>","Set description").option("--body, -b <value>","Set body (allow empty string)").option("--status, -s <value>","Set status (use close command for closed)").option("--priority, -p <value>","Set priority").option("--type <value>","Set type").option("--tags <value>","Set comma-separated tags (replaces existing). Use --add-tags / --remove-tags to mutate additively.").option("--add-tags <value>","Add tags additively without replacing existing (repeatable; CSV accepted)",u).option("--remove-tags <value>","Remove tags from the existing list (repeatable; CSV accepted)",u).option("--deadline <value>","Set deadline (ISO/date string or relative)").option("--estimate, --estimated-minutes <value>","Set estimated minutes").option("--acceptance-criteria <value>","Set acceptance criteria").option("--ac <value>","Alias for --acceptance-criteria").option("--add-ac <value>","Add one semicolon-free acceptance criterion without replacing the existing list (repeatable)",u).option("--remove-ac <value>","Remove one semicolon-free acceptance criterion by exact text match (repeatable)",u).option("--definition-of-ready <value>","Set definition of ready").option("--order <value>","Set planning order/rank integer").option("--rank <value>","Alias for --order").option("--goal <value>","Set goal identifier").option("--objective <value>","Set objective identifier").option("--value <value>","Set business value summary").option("--impact <value>","Set business impact summary").option("--outcome <value>","Set expected outcome summary").option("--why-now <value>","Set why-now rationale").option("--assignee <value>","Set assignee").option("--parent <value>","Set parent item ID").option("--reviewer <value>","Set reviewer").option("--risk <value>","Set risk level").option("--confidence <value>","Set confidence level").option("--sprint <value>","Set sprint identifier").option("--release <value>","Set release identifier").option("--blocked-by <value>","Set blocked-by item ID or reason").option("--blocked-reason <value>","Set blocked reason").option("--unblock-note <value>","Set unblock rationale note").option("--reporter <value>","Set issue reporter").option("--severity <value>","Set issue severity").option("--environment <value>","Set issue environment context").option("--repro-steps <value>","Set issue reproduction steps").option("--resolution <value>","Set issue resolution summary").option("--expected-result <value>","Set issue expected behavior").option("--expected <value>","Short alias for --expected-result").option("--actual-result <value>","Set issue observed behavior").option("--actual <value>","Short alias for --actual-result").option("--affected-version <value>","Set affected version identifier").option("--fixed-version <value>","Set fixed version identifier").option("--component <value>","Set issue component ownership").option("--regression [value]","Set regression marker; bare flag means true, or pass true|false|1|0").option("--customer-impact <value>","Set customer impact summary").option("--dep <value>","Add dependency entry id=<id>,kind=<kind>,author=<author>,created_at=<timestamp>",u).option("--dep-remove <value>","Remove dependency entries by id/kind/author/timestamp signature",u).option("--replace-deps","Atomically replace dependency entries with provided --dep values").option("--replace-tests","Atomically replace linked tests with provided --test values").option("--replace-files","Atomically replace linked files with provided --file values").option("--replace-docs","Atomically replace linked docs with provided --doc values").option("--comment <value>","Add comment seed author=<value>,created_at=<iso|now>,text=<value>",u).option("--note <value>","Add note seed author=<value>,created_at=<iso|now>,text=<value>",u).option("--learning <value>","Add learning seed author=<value>,created_at=<iso|now>,text=<value>",u).option("--file <value>","Add linked file path=<value>,scope=<project|global>,note=<text>",u).option("--test <value>","Add linked test command=<value>,path=<value>,scope=<project|global>",u).option("--doc <value>","Add linked doc path=<value>,scope=<project|global>,note=<text>",u).option("--reminder <value>","Add reminder entry at=<iso|relative>|date=<iso|relative>,text=<text>|title=<text>",u).option("--event <value>","Add event entry start=<iso|relative>,end=<iso|relative>,recur_*",u).option("--type-option <value>","Set type options key=value (repeatable)",u).option("--unset <field>","Clear scalar metadata field by name (repeatable)",u).option("--clear-deps","Clear dependency entries").option("--clear-comments","Clear comments").option("--clear-notes","Clear notes").option("--clear-learnings","Clear learnings").option("--clear-files","Clear linked files").option("--clear-tests","Clear linked tests").option("--clear-docs","Clear linked docs").option("--clear-reminders","Clear reminders").option("--clear-events","Clear events").option("--clear-type-options","Clear type options").option("--author <value>","Mutation author").option("--message <value>","Mutation message").option("--force","Force ownership override"),M(i,[["--filter-assignee_filter <value>","Alias for --filter-assignee-filter"],["--estimated_minutes <value>","Alias for --estimated-minutes"],["--acceptance_criteria <value>","Alias for --acceptance-criteria"],["--definition_of_ready <value>","Alias for --definition-of-ready"],["--why_now <value>","Alias for --why-now"],["--blocked_by <value>","Alias for --blocked-by"],["--blocked_reason <value>","Alias for --blocked-reason"],["--unblock_note <value>","Alias for --unblock-note"],["--repro_steps <value>","Alias for --repro-steps"],["--expected_result <value>","Alias for --expected-result"],["--actual_result <value>","Alias for --actual-result"],["--affected_version <value>","Alias for --affected-version"],["--fixed_version <value>","Alias for --fixed-version"],["--customer_impact <value>","Alias for --customer-impact"],["--filter-estimate-missing","Alias for --filter-estimates-missing"]],!1),M(i,[["--dep_remove <value>","Alias for --dep-remove"],["--type_option <value>","Alias for --type-option"],["--add_tags <value>","Alias for --add-tags"],["--remove_tags <value>","Alias for --remove-tags"],["--add_ac <value>","Alias for --add-ac"],["--remove_ac <value>","Alias for --remove-ac"]],!0),i.action(To);let r=e.command("close").argument("<id>","Item id").argument("[text]","Close reason text (alias: --reason)").option("-r, --reason <value>","Close reason text (alias for positional <text>)").option("--close-reason <value>","Close reason text (alias for positional <text>)").option("--completed-at <value>","Actual completion timestamp (ISO or relative), distinct from tracker close time").option("-d, --duplicate-of <id>","Close as a duplicate of the canonical item id and auto-fill duplicate closure metadata").option("--author <value>","Mutation author").option("-m, --message <value>","History message").option("--validate-close [mode]",'Validate closure metadata before close: "off", "warn", or "strict" (default: settings governance preset)').option("--resolution <value>","Set the closure resolution summary inline (same field --validate-close strict checks; previously required a prior pm update)").option("--expected-result <value>","Set the expected-result note inline (closure validation field)").option("--expected <value>","Short alias for --expected-result").option("--actual-result <value>","Set the actual-result note inline (closure validation field)").option("--actual <value>","Short alias for --actual-result").option("--force","Force ownership override").description("Close an item. Close reason requirement follows governance.require_close_reason.");A(r,"--expected_result <value>","Alias for --expected-result",!1),A(r,"--actual_result <value>","Alias for --actual-result",!1),r.action(Eo);let a=e.command("close-many").description("Bulk-close matched items with a shared reason and full runClose semantics (dry-run + rollback checkpoint).").option("--filter-status <value>","Filter by status before closing").option("--filter-type <value>","Filter by item type before closing").option("--filter-tag <value>","Filter by tag before closing").option("--filter-priority <value>","Filter by priority before closing").option("--filter-deadline-before <value>","Filter by deadline upper bound before closing").option("--filter-deadline-after <value>","Filter by deadline lower bound before closing").option("--filter-updated-after <value>","Filter by updated_at lower bound before closing (ISO/relative)").option("--filter-updated-before <value>","Filter by updated_at upper bound before closing (ISO/relative)").option("--filter-created-after <value>","Filter by created_at lower bound before closing (ISO/relative)").option("--filter-created-before <value>","Filter by created_at upper bound before closing (ISO/relative)").option("--filter-assignee <value>","Filter by assignee before closing").option("--filter-assignee-filter <value>","Filter assignee presence: assigned|unassigned before closing").option("--filter-parent <value>","Filter by parent item ID before closing").option("--filter-sprint <value>","Filter by sprint before closing").option("--filter-release <value>","Filter by release before closing");rt(a,"closing"),a.option("--ids <value>","Explicit ID allowlist: comma/newline text, - stdin, or @path file").option("--limit <n>","Limit matched item count before apply/preview").option("--offset <n>","Skip first n matched rows before apply/preview").option("--reason <value>","Shared close reason applied to matched items (required when governance.require_close_reason is enabled)").option("--completed-at <value>","Actual completion timestamp (ISO or relative) applied to every matched item").option("--resolution <value>","Shared closure resolution applied to every matched item (closure-validation field)").option("--expected-result <value>","Shared expected-result note (closure-validation field)").option("--expected <value>","Short alias for --expected-result").option("--actual-result <value>","Shared actual-result note (closure-validation field)").option("--actual <value>","Short alias for --actual-result").option("--validate-close [mode]",'Validate closure metadata per item: "off", "warn", or "strict" (default: settings governance preset)').option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Re-close already-terminal matches and override ownership").option("--dry-run","Preview matched items + per-item skip/active-child plan without mutating").option("--rollback <value>","Rollback a prior close-many checkpoint ID").option("--no-checkpoint","Disable checkpoint creation during apply mode"),A(a,"--filter-assignee_filter <value>","Alias for --filter-assignee-filter",!1),A(a,"--expected_result <value>","Alias for --expected-result",!1),A(a,"--actual_result <value>","Alias for --actual-result",!1),a.action(Io),e.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(Vo),e.command("append").argument("<id>","Item id").argument("[text]","Body text; same as --body (- reads stdin)").option("--body <value>","Text to append to body (or - for stdin)").option("--text <value>","Alias for --body").option("--author <value>","Mutation author").option("--message <value>","Mutation message").option("--force","Force ownership override").description("Append text to an item's body. For concurrent writes, use pm notes.").action(Jo),e.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(Ko);let l=e.command("plan").description("Agent-optimized Plan item workflow: create, manage steps, link dependencies, approve, and materialize.").argument("[subcommand]","Required; Plan subcommand: create|show|add-step|update-step|complete-step|block-step|reorder-step|remove-step|link|unlink|decision|discovery|validation|resume|approve|materialize").argument("[id]","Plan id (required for non-create subcommands); for create this may be the positional title").argument("[step]","Step reference: stable id (plan-step-001) or order integer").argument("[new-order]","New order integer for reorder-step").option("--title <value>","Plan title").option("--description <value>","Plan description").option("--scope <value>","Short scope statement of the target change or investigation").option("--parent <value>","Parent pm item id").option("--related <value>","Related pm item ids (repeatable, csv-friendly)",u).option("--blocks <value>","Pm item ids this plan blocks (repeatable, csv-friendly)",u).option("--blocked-by <value>","Pm item ids that block this plan (repeatable, csv-friendly)",u).option("--harness <value>","Plan harness provenance: codex|claude-code|cursor|generic").option("--mode <value>","Plan mode: draft|research|review|approved|executing|paused|completed|superseded").option("--resume-context <value>","Compact context summary for a future stateless agent").option("--tags <value>","Comma-separated tags").option("--priority <value>","Priority 0-4").option("--body <value>","Plan item body").option("--claim","Claim the plan on create for the author").option("--from-search <value>","Record the search query that led to plan creation").option("--template <value>","Seed plan steps from a built-in template: bug-investigation|feature-implementation|refactoring-sprint").option("--step-title <value>","Step title for add-step / update-step").option("--step <value>","Step title (repeatable on create: each --step appends an ordered step; elsewhere a single value aliases --step-title)",u).option("--step-body <value>","Step body text").option("--step-owner <value>","Step owner").option("--step-status <value>","Step status: pending|in_progress|completed|blocked|skipped|superseded").option("--step-evidence <value>","Step evidence text (used by update-step/complete-step)").option("--step-blocked-reason <value>","Step blocked reason (required when blocking)").option("--step-replacement <value>","Replacement reference for a superseded step").option("--depends-on <value>","Pm item ids the step depends on (repeatable, csv-friendly)",u).option("--link <value>","Pm item id to link (repeatable, csv-friendly)",u).option("--link-kind <value>",`Link kind: ${xe.join("|")}`).option("--link-note <value>","Optional note for the link").option("--promote-to-item-dep","Also add the linked id as a top-level item dependency when linking").option("--allow-multiple-active","Allow multiple steps to be in_progress at once").option("--file <value>","Step linked file path=<value>[,scope=project|global,note=<text>] (repeatable)",u).option("--test <value>","Step linked test command=<value>[,path=<value>,note=<text>] (repeatable)",u).option("--doc <value>","Step linked doc path=<value>[,scope=project|global,note=<text>] (repeatable)",u).option("--decision-text <value>","Decision log entry text").option("--decision <value>","Alias for --decision-text").option("--decision-rationale <value>","Decision log entry rationale").option("--decision-evidence <value>","Decision log entry evidence").option("--discovery-text <value>","Discovery log entry text").option("--discovery <value>","Alias for --discovery-text").option("--validation-text <value>","Validation log entry text").option("--validation <value>","Alias for --validation-text").option("--validation-command <value>","Validation log entry command").option("--validation-expected <value>","Validation log entry expected outcome").option("--depth <value>","Show depth: brief|standard|deep (default: brief)").option("--fields <value>","Comma-separated field projection for show output").option("--steps <value>","Comma-separated step ids/orders for materialize").option("--materialize-type <value>","Item type for materialized steps (default: Task)").option("--materialize-parent <value>","Parent item id for materialized children (default: the plan)").option("--materialize-tags <value>","Comma-separated tags for materialized children").option("--field <name=value>","Custom field value forwarded to every materialized child (repeatable)",u).option("--author <value>","Mutation author").option("--message <value>","Mutation message").option("--force","Force ownership override");ke(l,K.filter(b=>mo.has(b.target))),M(l,[["--resume_context <value>","Alias for --resume-context"],["--from_search <value>","Alias for --from-search"],["--step_title <value>","Alias for --step-title"],["--step_body <value>","Alias for --step-body"],["--step_owner <value>","Alias for --step-owner"],["--step_status <value>","Alias for --step-status"],["--step_evidence <value>","Alias for --step-evidence"],["--step_blocked_reason <value>","Alias for --step-blocked-reason"],["--step_replacement <value>","Alias for --step-replacement"],["--link_kind <value>","Alias for --link-kind"],["--link_note <value>","Alias for --link-note"],["--promote_to_item_dep","Alias for --promote-to-item-dep"],["--allow_multiple_active","Alias for --allow-multiple-active"],["--decision_text <value>","Alias for --decision-text"],["--decision_rationale <value>","Alias for --decision-rationale"],["--decision_evidence <value>","Alias for --decision-evidence"],["--discovery_text <value>","Alias for --discovery-text"],["--validation_text <value>","Alias for --validation-text"],["--validation_command <value>","Alias for --validation-command"],["--validation_expected <value>","Alias for --validation-expected"],["--materialize_type <value>","Alias for --materialize-type"],["--materialize_parent <value>","Alias for --materialize-parent"],["--materialize_tags <value>","Alias for --materialize-tags"]],!1),M(l,[["--blocked_by <value>","Alias for --blocked-by"],["--depends_on <value>","Alias for --depends-on"]],!0),l.action(Po),e.command("history-redact").argument("<id>","Item id").option("--literal <value>","Literal string to redact (repeatable)",u).option("--regex <value>","Regex pattern to redact (repeatable; accepts /pattern/flags or raw pattern)",u).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(b,g,R)=>{let S=y(R),I=Date.now(),_=Array.isArray(g.literal)?g.literal:void 0,N=Array.isArray(g.regex)?g.regex:void 0,x=await W(b,{literal:_,regex:N,replacement:typeof g.replacement=="string"?g.replacement:void 0,dryRun:g.dryRun===!0,author:typeof g.author=="string"?g.author:void 0,message:typeof g.message=="string"?g.message:void 0,force:!!g.force},S);x.changed&&!x.dry_run&&await w(S,x),f(x,S),S.profile&&h(`profile:command=history-redact took_ms=${Date.now()-I}`)}),e.command("history-repair").argument("[id]","Item id (omit with --all)").option("--all","Scan every stream for drift and repair each drifted stream in one audited pass").option("--dry-run","Preview the re-anchor impact without writing the history file").option("--normalize-provenance","Remove invalid provenance; return aggregate-only evidence").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. Use --all to repair every drifted stream.").action(async(b,g,R)=>{let S=y(R),I=Date.now(),_=g.all===!0;oe(b,_);let N={dryRun:g.dryRun===!0,author:typeof g.author=="string"?g.author:void 0,message:typeof g.message=="string"?g.message:void 0,force:!!g.force,normalizeProvenance:g.normalizeProvenance===!0};if(_){let x=await ne(N,S);f(x,S),x.totals.failed>0&&(process.exitCode=c.GENERIC_FAILURE)}else{let x=await te(b,N,S);f(x,S)}S.profile&&h(`profile:command=history-repair took_ms=${Date.now()-I}`)}),tt(e),e.command("history-compact").argument("[id]","Item id (omit when using a bulk selector)").option("--before <value>","Compact entries strictly before this version number or ISO timestamp (single-id mode only)").option("--ids <value>","Bulk IDs: comma/newline text, - stdin, or @path file").option("--all-over <n>","Bulk: compact every stream with more than N entries").option("--closed","Bulk: compact only closed (terminal) items' streams").option("--all-streams","Bulk: compact every history stream regardless of lifecycle state").option("--min-entries <n>","Bulk: skip streams with at most N entries (already compact; default 3)").option("--dry-run","Preview compaction impact without writing the history file").option("--author <value>","Mutation author").option("--message <value>","Audit history message for the compaction marker entry").option("--force","Force ownership/lock override").description("Compact item history streams into a synthetic baseline plus retained tail entries. Pass an item id for one stream, or a bulk selector (--ids/--all-over/--closed/--all-streams) to compact many.").action(Lo),e.command("merge").argument("<subcommand>",`Merge subcommand: ${j.join(", ")}`).argument("[artifact]",`driver only: artifact class to merge (${le.join(", ")})`).argument("[base]","driver only: common-ancestor file path (git %O)").argument("[ours]","driver only: current-branch file path (git %A)").argument("[theirs]","driver only: other-branch file path (git %B)").option("--dry-run","install/reconcile: preview changes without writing").option("--message <text>","reconcile only: audit message recorded on repaired history streams").option("--force","reconcile only: permit the underlying audited history ownership override").option("--include-reconciled","report only: include clone-local receipts already recorded in history").option("--output <path>","driver only: write the merged content to this path instead of the ours path").option("--item-path <path>","driver only: original repository-relative path supplied by git as %P").option("--prefer <side>","driver only: side that wins unresolvable conflicts (ours|theirs; default ours)").description("Install merge drivers, reconcile or report post-merge history, or run a field-aware driver.").action(Ho);let d=e.command("schema").argument("[subcommand]","Required; Schema subcommand: list, show, show-status, add/remove type/status/field, rename-type, rename-field, remap-status, or a custom item type name shorthand").argument("[name]","Definition name, or source name for rename/remap migrations").option("--description <text>","Human description for the custom item type, status, or field").option("--default-status <status>","Default status hint recorded for the custom item type").option("--folder <dir>","Storage folder for items of this custom type").option("--alias <name>","Alias for the custom type, status, or field flag (repeatable, csv-friendly)",u).option("--role <value>","Lifecycle role for a custom status (repeatable): draft, active, blocked, terminal, terminal_done, terminal_canceled, default_open, default_close, default_cancel",u).option("--order <n>","Display/sort order for a custom status").option("--type <type>","Value type for a custom field (add-field): string, number, boolean, string_array, array, object").option("--commands <list>","Commands a custom field is wired onto (add-field; repeatable, comma-friendly): create, update, update_many, list, search, calendar, context",u).option("--cli-flag <flag>","Override the auto-derived CLI flag for a custom field (add-field)").option("--required","Mark a custom field as always required (add-field)").option("--required-on-create","Mark a custom field as required at create time (add-field)").option("--no-allow-unset","Disallow clearing a custom field via --unset (add-field)").option("--required-types <list>","Restrict a custom field's requirement to specific item types (add-field; repeatable, comma-friendly)",u).option("--infer","Infer custom item types from title-prefix conventions (add-type; preview unless --apply)").option("--min-count <n>","Minimum items sharing a prefix for add-type --infer (default 10)").option("--apply","Register inferred types (add-type --infer); without it the command previews only").option("--to <name>","Target definition name for rename/remap migrations").option("--migration-id <id>","Stable idempotency key for a resumable schema migration").option("--dry-run","Plan a schema migration without writing schema, items, or history").option("--author <value>","Mutation author").option("--force","Force ownership/lock override").description("Inspect and manage config-driven runtime schema (types, statuses, fields, presets).");A(d,"--default_status <status>","Alias for --default-status",!1),A(d,"--migration_id <id>","Alias for --migration-id",!1),d.action(Bo),e.command("profile").argument("[subcommand]","Required; Profile subcommand: list, show, apply, or lint").argument("[name]","Profile name for show/apply/lint: agile, ops, or research").option("--dry-run","Preview the apply diff without writing any files (apply)").option("--author <value>","Mutation author").option("--force","Force ownership/lock override").description("List, show, apply, and lint project profiles \u2014 archetype bundles of item types, statuses, fields, workflows, config, templates, and recommended packages.").action(Wo),it(e,ko);let v=e.command("files").description("Manage files linked to an item.");v.argument("<id>","Item id").option("--add <value>","Add linked file entry (CSV/markdown pairs or - for stdin)",u).option("--add-glob <value>","Add linked file entries from a glob (plain glob or pattern=<glob>,scope=<scope>,note=<text>; repeatable)",u).option("--remove <value>","Remove linked file by path only (path=<value>, path:<value>, plain path, or - for stdin); does not accept note=/scope= \u2014 record removal context with --message",u).option("--migrate <value>","Migrate linked file paths in-place (from=<prefix>,to=<prefix>; repeatable)",u).option("--note <value>","Note attached to every link added by --add/--add-glob in this invocation (embedded note= wins)").option("--list","List linked files without mutating").option("--append-stable","Preserve existing linked-file order and append new links without full-array resorting").option("--validate-paths","Validate linked file paths for existence and file shape").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").action(Xo),v.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(Yo),at(v),e.command("docs").argument("<id>","Item id").option("--add <value>","Add linked doc entry (CSV/markdown pairs or - for stdin)",u).option("--add-glob <value>","Add linked doc entries from a glob (plain glob or pattern=<glob>,scope=<scope>,note=<text>; repeatable)",u).option("--remove <value>","Remove linked doc by path only (path=<value>, path:<value>, plain path, or - for stdin); does not accept note=/scope= \u2014 record removal context with --message",u).option("--migrate <value>","Migrate linked doc paths in-place (from=<prefix>,to=<prefix>; repeatable)",u).option("--note <value>","Note attached to every link added by --add/--add-glob in this invocation (embedded note= wins)").option("--list","List linked docs without mutating").option("--validate-paths","Validate linked doc paths for existence and file shape").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").description("Manage docs linked to an item.").action(Zo),e.command("deps").argument("<id>","Item id").option("--format <value>","Output format (tree, graph, or context)","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").option("--full","Return the complete dependency row projection").option("--node-limit <value>","Maximum nodes in context output").option("--edge-limit <value>","Maximum edges and missing-reference rows in context output").option("--token-budget <value>","Maximum estimated tokens in context output").option("--cursor <value>","Continue an equivalent context query").option("--direction <value>","Context traversal direction (outgoing, incoming, or both)").option("--kind <value>","Restrict context traversal to registered relationship kinds (repeatable or comma-separated)",u).description("Show dependency relationships for an item.").action(Qo)}export{we as looksLikeSchemaSubcommandTypo,ko as parsePositiveIntOption,L as parseSchemaOrderOption,ke as registerCommanderOptionContracts,Wi as registerMutationCommands};
20
- //# sourceMappingURL=register-mutation-OI4BJLUX.js.map