@unbrained/pm-cli 2026.11.19 → 2026.11.21

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 (181) hide show
  1. package/.agents/skills/pm-sdk/SKILL.md +1 -1
  2. package/.agents/skills/pm-test-audit/SKILL.md +1 -1
  3. package/.claude-plugin/marketplace.json +1 -1
  4. package/AGENTS.md +1 -1
  5. package/CONTRIBUTING.md +2 -1
  6. package/dist/cli/error-guidance.js +2 -2
  7. package/dist/cli/register-list-query.js +2 -2
  8. package/dist/cli/runtime/refusal-credential-redaction.js +1 -1
  9. package/dist/cli-bundle/bundle-manifest.json +1 -1
  10. package/dist/cli-bundle/chunks/chunk-2DXRTIC6.js +21 -0
  11. package/dist/cli-bundle/chunks/{chunk-AGPFANRX.js → chunk-5647LU3A.js} +4 -4
  12. package/dist/cli-bundle/chunks/{chunk-CR5GC3VO.js → chunk-6QLEXRUG.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-XPBPGDFW.js → chunk-AHQB7W2H.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-4FNMPZ7Y.js → chunk-BKSVHOWI.js} +2 -2
  15. package/dist/cli-bundle/chunks/{chunk-GQCMICAL.js → chunk-CASX6SFI.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-NMVPQTZI.js → chunk-CIKGG34F.js} +2 -2
  17. package/dist/cli-bundle/chunks/{chunk-IQKCRLQP.js → chunk-D6ILFXZY.js} +2 -2
  18. package/dist/cli-bundle/chunks/{chunk-AOV5HG3Y.js → chunk-IUIOTAF6.js} +4 -4
  19. package/dist/cli-bundle/chunks/{chunk-PRVT7ITI.js → chunk-JVGRFU5H.js} +2 -2
  20. package/dist/cli-bundle/chunks/chunk-KQIZ34SF.js +3 -0
  21. package/dist/cli-bundle/chunks/{chunk-IUTN67EB.js → chunk-KVBIMFUG.js} +2 -2
  22. package/dist/cli-bundle/chunks/chunk-LQBWLNZJ.js +3 -0
  23. package/dist/cli-bundle/chunks/{chunk-AMHD7WIV.js → chunk-NCFCBKIP.js} +2 -2
  24. package/dist/cli-bundle/chunks/{chunk-M76BEWTT.js → chunk-NT5AKFE5.js} +30 -30
  25. package/dist/cli-bundle/chunks/chunk-PJXKA4QU.js +125 -0
  26. package/dist/cli-bundle/chunks/{chunk-2UTJ5QIE.js → chunk-RMIRNYRG.js} +2 -2
  27. package/dist/cli-bundle/chunks/{chunk-CNMGGAZO.js → chunk-RULHZRFN.js} +2 -2
  28. package/dist/cli-bundle/chunks/{chunk-O7IFAJ76.js → chunk-S6HB3WL2.js} +2 -2
  29. package/dist/cli-bundle/chunks/{chunk-CTOE26W4.js → chunk-SA4BNP3Q.js} +2 -2
  30. package/dist/cli-bundle/chunks/{chunk-Z5LHCEXG.js → chunk-SRVTCYAU.js} +2 -2
  31. package/dist/cli-bundle/chunks/{chunk-N2CPCFSN.js → chunk-WELSVDPU.js} +2 -2
  32. package/dist/cli-bundle/chunks/{chunk-P4A5RFLX.js → chunk-XHJ3H5PL.js} +2 -2
  33. package/dist/cli-bundle/chunks/{chunk-Q32Q3LRH.js → chunk-XWHJIRNV.js} +2 -2
  34. package/dist/cli-bundle/chunks/chunk-YJEBK7HU.js +8 -0
  35. package/dist/cli-bundle/chunks/chunk-YKJKQ7DM.js +115 -0
  36. package/dist/cli-bundle/chunks/{chunk-Y4LXVPA5.js → chunk-YMUSRWV4.js} +2 -2
  37. package/dist/cli-bundle/chunks/{chunk-HQYIKAC6.js → chunk-YR2KEBHP.js} +2 -2
  38. package/dist/cli-bundle/chunks/{indexed-receipt-blobs-ELEMA7IW.js → indexed-receipt-blobs-ITTXIN4K.js} +2 -2
  39. package/dist/cli-bundle/chunks/{item-revision-YJKGOYBR.js → item-revision-R5SZPJZ5.js} +2 -2
  40. package/dist/cli-bundle/chunks/item-transaction-7DFCG73I.js +2 -0
  41. package/dist/cli-bundle/chunks/{mutation-actor-DDYJW5B4.js → mutation-actor-3TG636XG.js} +2 -2
  42. package/dist/cli-bundle/chunks/{mutation-admission-JLMQJ2M5.js → mutation-admission-LICSDNNO.js} +2 -2
  43. package/dist/cli-bundle/chunks/{register-list-query-4AXLLXK7.js → register-list-query-SPGPS3OS.js} +10 -10
  44. package/dist/cli-bundle/chunks/{register-mutation-FJIXGGF4.js → register-mutation-WWVECKFQ.js} +2 -2
  45. package/dist/cli-bundle/chunks/{register-operations-W4E2KEMA.js → register-operations-L6HFJNWD.js} +2 -2
  46. package/dist/cli-bundle/chunks/{register-setup-RYRIBNSN.js → register-setup-K7UFG5TD.js} +2 -2
  47. package/dist/cli-bundle/chunks/{settlement-hook-E5LHZ4RD.js → settlement-hook-BXN5LEQD.js} +2 -2
  48. package/dist/cli-bundle/chunks/{stage-XGWW3T64.js → stage-57KH3KAC.js} +2 -2
  49. package/dist/cli-bundle/focused-chunks/{chunk-IXYBN6D2.js → chunk-3IRCYJI5.js} +3 -3
  50. package/dist/cli-bundle/focused-chunks/{chunk-DH4DHL6V.js → chunk-3V53UBHN.js} +2 -2
  51. package/dist/cli-bundle/focused-chunks/{chunk-2XULTI5B.js → chunk-532WZV65.js} +2 -2
  52. package/dist/cli-bundle/focused-chunks/{chunk-ZFUZ4YYN.js → chunk-7A4QWNZX.js} +2 -2
  53. package/dist/cli-bundle/focused-chunks/chunk-CR7CGEB2.js +3 -0
  54. package/dist/cli-bundle/focused-chunks/chunk-CU2BRAOX.js +2 -0
  55. package/dist/cli-bundle/focused-chunks/{chunk-7RF2YPZ5.js → chunk-CWWKRI5P.js} +2 -2
  56. package/dist/cli-bundle/focused-chunks/{chunk-ICEHI4SN.js → chunk-HGFNL5XI.js} +2 -2
  57. package/dist/cli-bundle/focused-chunks/chunk-IQK5NPMG.js +13 -0
  58. package/dist/cli-bundle/focused-chunks/{chunk-OF4UM5B6.js → chunk-J63D6QST.js} +2 -2
  59. package/dist/cli-bundle/focused-chunks/{chunk-OAIAZHRG.js → chunk-JMQJBZQ5.js} +2 -2
  60. package/dist/cli-bundle/focused-chunks/{chunk-4S7I342K.js → chunk-LNHUE4VV.js} +2 -2
  61. package/dist/cli-bundle/focused-chunks/{chunk-MTBC32ZR.js → chunk-MKM5NKD7.js} +2 -2
  62. package/dist/cli-bundle/focused-chunks/{chunk-EZXLY6S4.js → chunk-NP72ZDXE.js} +2 -2
  63. package/dist/cli-bundle/focused-chunks/chunk-OSLQD5VH.js +102 -0
  64. package/dist/cli-bundle/focused-chunks/{chunk-OPY43DNJ.js → chunk-QGKLRXP7.js} +2 -2
  65. package/dist/cli-bundle/focused-chunks/{chunk-77CDWGBW.js → chunk-QSJW6NSQ.js} +53 -53
  66. package/dist/cli-bundle/focused-chunks/{chunk-7Z2NYAK4.js → chunk-RPE6IX26.js} +2 -2
  67. package/dist/cli-bundle/focused-chunks/chunk-SRDQSA6M.js +91 -0
  68. package/dist/cli-bundle/focused-chunks/{chunk-D72EQN7Z.js → chunk-UOC6257J.js} +2 -2
  69. package/dist/cli-bundle/focused-chunks/{chunk-FPPYE6CY.js → chunk-URJ2E6AS.js} +2 -2
  70. package/dist/cli-bundle/focused-chunks/chunk-WXMI4AV5.js +8 -0
  71. package/dist/cli-bundle/focused-chunks/{chunk-N64BUB63.js → chunk-XCJSHNXK.js} +2 -2
  72. package/dist/cli-bundle/focused-chunks/{chunk-GAOWBALE.js → chunk-XQQSSKJI.js} +5 -5
  73. package/dist/cli-bundle/focused-chunks/{chunk-XS2YZCT5.js → chunk-YOAYY3HE.js} +2 -2
  74. package/dist/cli-bundle/focused-chunks/{indexed-receipt-blobs-ZTRFCPH7.js → indexed-receipt-blobs-AF4U3F3D.js} +2 -2
  75. package/dist/cli-bundle/focused-chunks/{item-revision-32HFGFYG.js → item-revision-3V3UIP5X.js} +2 -2
  76. package/dist/cli-bundle/focused-chunks/{item-transaction-C4VW3SHX.js → item-transaction-HLBW7B3J.js} +2 -2
  77. package/dist/cli-bundle/focused-chunks/{mutation-actor-2SVBO324.js → mutation-actor-62HKR5IO.js} +2 -2
  78. package/dist/cli-bundle/focused-chunks/{mutation-admission-PNK6ORZR.js → mutation-admission-X4PF2SG3.js} +2 -2
  79. package/dist/cli-bundle/focused-chunks/{settlement-hook-OUBUN45C.js → settlement-hook-ARYCZQY4.js} +2 -2
  80. package/dist/cli-bundle/focused-chunks/{stage-LVAGKCEE.js → stage-O7T7CXBB.js} +2 -2
  81. package/dist/cli-bundle/main.js +25 -25
  82. package/dist/cli-bundle/sdk-authoring.js +1 -1
  83. package/dist/cli-bundle/sdk-contracts.js +1 -1
  84. package/dist/cli-bundle/sdk-core.js +1 -1
  85. package/dist/cli-bundle/sdk-governance.js +1 -1
  86. package/dist/cli-bundle/sdk-graph.js +1 -1
  87. package/dist/cli-bundle/sdk-merge.js +58 -57
  88. package/dist/cli-bundle/sdk-query.js +1 -1
  89. package/dist/cli-bundle/sdk-runtime.js +1 -1
  90. package/dist/cli-bundle/sdk-testing.js +1 -1
  91. package/dist/cli-bundle/sdk.js +11 -11
  92. package/dist/core/extensions/index.d.ts +2 -0
  93. package/dist/core/extensions/index.js +1 -1
  94. package/dist/core/fs/file-glob.js +1 -1
  95. package/dist/core/fs/fs-utils.d.ts +3 -1
  96. package/dist/core/fs/fs-utils.js +1 -1
  97. package/dist/core/history/history-stream-policy.js +1 -1
  98. package/dist/core/history/read.d.ts +11 -1
  99. package/dist/core/history/read.js +1 -1
  100. package/dist/core/history/stream-summary.d.ts +129 -0
  101. package/dist/core/history/stream-summary.js +3 -0
  102. package/dist/core/shared/errors.d.ts +8 -0
  103. package/dist/core/shared/errors.js +1 -1
  104. package/dist/core/shared/text-normalization.d.ts +9 -0
  105. package/dist/core/shared/text-normalization.js +1 -1
  106. package/dist/core/shared/url-credentials.js +1 -1
  107. package/dist/sdk/cli-contracts/registration-helpers.js +2 -2
  108. package/dist/sdk/context-intent-contracts.js +1 -1
  109. package/dist/sdk/governance/gc.js +1 -1
  110. package/dist/sdk/governance/health-merge-evidence.js +1 -1
  111. package/dist/sdk/governance/validate.js +1 -1
  112. package/dist/sdk/governance/workspace-position.js +1 -1
  113. package/dist/sdk/history-provenance.js +1 -1
  114. package/dist/sdk/index.d.ts +1 -1
  115. package/dist/sdk/index.js +1 -1
  116. package/dist/sdk/merge/index.d.ts +1 -1
  117. package/dist/sdk/merge/index.js +1 -1
  118. package/dist/sdk/merge/install.d.ts +20 -6
  119. package/dist/sdk/merge/install.js +3 -3
  120. package/dist/sdk/merge/worktree-config.js +2 -1
  121. package/dist/sdk/public-surface.json +1 -1
  122. package/dist/sdk/query/activity.d.ts +67 -5
  123. package/dist/sdk/query/activity.js +1 -1
  124. package/dist/sdk/query/context.d.ts +13 -3
  125. package/dist/sdk/query/context.js +2 -2
  126. package/dist/sdk/query.d.ts +1 -1
  127. package/dist/sdk/query.js +1 -1
  128. package/dist/sdk/read-output/continuation.d.ts +9 -3
  129. package/dist/sdk/read-output/continuation.js +1 -1
  130. package/dist/sdk/read-output-budget.d.ts +44 -3
  131. package/dist/sdk/read-output-budget.js +1 -1
  132. package/dist/sdk/read-output-contracts.js +1 -1
  133. package/docs/COMMANDS.md +56 -2
  134. package/docs/MERGE_SAFETY.md +8 -0
  135. package/docs/MUTATION_INTEGRITY.md +3 -1
  136. package/docs/PERFORMANCE.md +17 -2
  137. package/docs/README.md +6 -4
  138. package/docs/READ_OUTPUT_CONTRACTS.md +16 -1
  139. package/docs/SDK.md +25 -1
  140. package/docs/TESTING.md +8 -697
  141. package/docs/WORKSPACE_POSITION_AND_LIFECYCLE.md +1 -1
  142. package/marketplace.json +1 -1
  143. package/package.json +6 -2
  144. package/packages/pm-beads/package.json +1 -1
  145. package/packages/pm-calendar/package.json +1 -1
  146. package/packages/pm-command-kit/package.json +1 -1
  147. package/packages/pm-digital-twin/package.json +1 -1
  148. package/packages/pm-governance-audit/package.json +1 -1
  149. package/packages/pm-guide-shell/package.json +1 -1
  150. package/packages/pm-kanban/package.json +1 -1
  151. package/packages/pm-lifecycle-hooks/package.json +1 -1
  152. package/packages/pm-linked-test-adapters/package.json +1 -1
  153. package/packages/pm-search-advanced/package.json +1 -1
  154. package/packages/pm-templates/package.json +1 -1
  155. package/packages/pm-todos/package.json +1 -1
  156. package/packages/pm-vcs/package.json +1 -1
  157. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  158. package/plugins/pm-claude/package.json +1 -1
  159. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  160. package/plugins/pm-codex/package.json +1 -1
  161. package/plugins/pm-codex/plugin.json +1 -1
  162. package/runtime-dependencies.json +1 -1
  163. package/dist/cli-bundle/chunks/chunk-5OFMWP3Q.js +0 -3
  164. package/dist/cli-bundle/chunks/chunk-723PMYNX.js +0 -125
  165. package/dist/cli-bundle/chunks/chunk-7UUPLMCU.js +0 -115
  166. package/dist/cli-bundle/chunks/chunk-H64BNM4A.js +0 -8
  167. package/dist/cli-bundle/chunks/chunk-OESI2ETD.js +0 -20
  168. package/dist/cli-bundle/chunks/chunk-VS565KBX.js +0 -2
  169. package/dist/cli-bundle/chunks/item-transaction-K4YZ7GWR.js +0 -2
  170. package/dist/cli-bundle/focused-chunks/chunk-5JVB42Z7.js +0 -8
  171. package/dist/cli-bundle/focused-chunks/chunk-7A4VIRIU.js +0 -2
  172. package/dist/cli-bundle/focused-chunks/chunk-A2CLYPDA.js +0 -102
  173. package/dist/cli-bundle/focused-chunks/chunk-FOA7XKWP.js +0 -2
  174. package/dist/cli-bundle/focused-chunks/chunk-HO2YUD4P.js +0 -91
  175. package/dist/cli-bundle/focused-chunks/chunk-P4TG4VMJ.js +0 -12
  176. package/docs/MCP_2026_07_28_CONFORMANCE.md +0 -41
  177. package/docs/QUALITY_EVIDENCE.md +0 -130
  178. package/docs/generated/FLAG_LEXICON_BUDGETS.md +0 -117
  179. package/docs/performance/cli-transport-overhead.md +0 -51
  180. package/docs/performance/runner-qualification.md +0 -36
  181. package/docs/performance/sdk-entrypoint-import-costs.md +0 -32
@@ -1,2 +1,2 @@
1
- import"./chunk-DEZPZOQ7.js";import{a as W}from"./chunk-NMVPQTZI.js";import{g as T,i as P}from"./chunk-XPBPGDFW.js";import{Ea as I,Ja as O,La as j,ra as U,ua as L}from"./chunk-2UTJ5QIE.js";import"./chunk-H64BNM4A.js";import"./chunk-Y4LXVPA5.js";import"./chunk-AMHD7WIV.js";import{Cc as b,Fc as v}from"./chunk-AOV5HG3Y.js";import"./chunk-Z5LHCEXG.js";import"./chunk-IB7UB5TE.js";import{X as S}from"./chunk-723PMYNX.js";import{v as R}from"./chunk-CR5GC3VO.js";import{$g as w,A as G,Sa as E,Wg as D,ah as y,z as $}from"./chunk-7UUPLMCU.js";import"./chunk-VS565KBX.js";import{A as d,C as h}from"./chunk-5OFMWP3Q.js";import"./chunk-XAWE4EAK.js";import C from"node:fs/promises";import F from"node:path";(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]="26ea7f42-d5f7-5ada-afd9-389dadc4d138")}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]="0b0e08e0-f6e7-59c4-ac96-9f47b172727a")}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]="d975120a-964e-5b19-ae10-8ba011ba9bf8")}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]="108609fa-51fc-5bd0-ac54-de2ad14a66c6")}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]="b36466e6-5574-5509-909a-e8599f11664c")}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]="e5e1e242-6864-5a72-adb9-0eda4c65a0c3")}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]="7462433c-f34c-5b30-a676-a296dc3e3428")}catch{}})();var H={extension:"extension",package:void 0};async function _(e,t){if(!e)return;let o=$(e),i=b(t);await R(E(process.cwd(),i.path)).then(a=>a.ux.deprecation_hints)&&y(G(o))}var X={init:"init",install:"install",uninstall:"uninstall",explore:"explore",manage:"manage",describe:"describe",reload:"reload",doctor:"doctor",catalog:"catalog",adopt:"adopt","adopt-all":"adoptAll",activate:"activate",deactivate:"deactivate",migrate:"migrate"};function Y(e){let t=e.capability,o=typeof t=="string"?[t]:Array.isArray(t)?t.filter(a=>typeof a=="string"):[],i=[...new Set(o.map(a=>a.trim().toLowerCase()).filter(a=>a.length>0))];if(i.length>1)throw new h(`Multiple scaffold capabilities cannot be combined yet: ${i.join(", ")}. Choose one capability per scaffold.`,d.USAGE);return i[0]}function A(e,t,o="extension"){let i={...e};t!==void 0&&(i[X[t]]=!0);let a=(...c)=>c.some(s=>i[s]===!0),r=(...c)=>{for(let s of c)if(typeof i[s]=="string")return i[s]};return{init:a("init"),scaffold:a("scaffold"),install:a("install"),uninstall:a("uninstall"),explore:a("explore","list"),manage:a("manage"),describe:a("describe"),markdown:a("markdown"),reload:a("reload"),doctor:a("doctor"),catalog:a("catalog"),adopt:a("adopt"),adoptAll:a("adoptAll","adopt_all","adopt-all"),activate:a("activate"),deactivate:a("deactivate"),migrate:a("migrate"),project:a("project"),local:a("local"),global:a("global"),gh:r("gh"),github:r("github"),ref:r("ref"),capability:Y(e),declarative:a("declarative"),fields:r("fields"),detail:r("detail"),output:r("output"),trace:a("trace"),watch:a("watch"),runtimeProbe:a("runtimeProbe","runtime_probe","runtime-probe"),offline:a("offline"),fixManagedState:a("fixManagedState","fix_managed_state","fix-managed-state"),isolated:a("isolated"),ignoreGlobal:a("ignoreGlobal","ignore_global","ignore-global"),strictExit:a("strictExit","strict_exit","strict-exit"),failOnWarn:a("failOnWarn","fail_on_warn","fail-on-warn"),dryRun:a("dryRun","dry_run","dry-run"),vocabulary:o}}async function J(e){let t=(await C.readdir(process.cwd())).filter(i=>!i.startsWith(".")).sort((i,a)=>i.localeCompare(a)),o=[...e].sort((i,a)=>i.localeCompare(a));return t.length===o.length&&t.every((i,a)=>i===o[a])}async function Q(e){let t=(e??[]).map(o=>o.trim()).filter(o=>o.length>0);return t.length<=1?t.length===0?void 0:t:await J(t)?["*"]:t}function z(e,t,o){let i=e.markdown===!0;if(o!==void 0&&o==="")throw new h("--output requires a non-empty file path.",d.USAGE);if(o!==void 0&&!i)throw new h("--output is only supported with --markdown describe output.",d.USAGE);if(i){if(t.json)throw new h("Cannot combine --json with --markdown.",d.USAGE);if(e.describe!==!0)throw new h("--markdown is only supported by the describe action.",d.USAGE)}}async function Z(e){let t=L(e.result.details,e.vocabulary);if(e.outputPath!==void 0){let o=F.resolve(e.outputPath);await C.mkdir(F.dirname(o),{recursive:!0}),await C.writeFile(o,t,"utf8")}if(!e.globalOptions.quiet){for(let o of e.result.warnings)y(`warning: ${o}`);e.outputPath===void 0&&D(t)}}function ee(e,t){let o=!!t.strictExit||!!t.failOnWarn;if(e.action!=="doctor"||!o)return;let i=e.details!==null&&typeof e.details=="object"?e.details:{},a=i.summary!==null&&typeof i.summary=="object"?i.summary:null,r=a&&typeof a.status=="string"?a.status:void 0;(e.warnings.length>0||r!==void 0&&r!=="ok")&&(process.exitCode=d.GENERIC_FAILURE)}async function g(e,t,o,i,a="extension"){let r=b(o),c=Date.now(),s=a==="extension"?"package":a;await _(H[a],o);let n=A(t,i,s),l=(typeof n.output=="string"?n.output:void 0)?.trim();z(n,r,l);let u=await I(e,n,r);n.markdown===!0?await Z({result:u,vocabulary:s,outputPath:l,globalOptions:r}):w(u,r),ee(u,n),u.ok===!1&&(process.exitCode=d.GENERIC_FAILURE),r.profile&&y(`profile:command=extension took_ms=${Date.now()-c}`)}function te(e){return e.details!==null&&typeof e.details=="object"?e.details:{}}function oe(e){return e instanceof h?{message:e.message,exit_code:e.exitCode,...e.context}:{message:e instanceof Error?e.message:String(e),exit_code:d.GENERIC_FAILURE}}async function ae(e,t,o){let i=[],a=[],r=d.GENERIC_FAILURE;for(let c of e)try{let s=await I(c,t,o),n=te(s),l=Array.isArray(s.warnings)?s.warnings:[];a.push(...l);let u=s.ok===!0;i.push({target:c,ok:u,extension:n.extension,source:n.source,install_plan:n.install_plan,dry_run:n.dry_run,destination_path:n.destination_path,activated:n.activated,settings_changed:n.settings_changed,previous_state_preserved:n.previous_state_preserved,rollback:n.rollback,command_paths:n.command_paths,action_paths:n.action_paths,runtime_activation_status:n.runtime_activation_status,activation_diagnostics:n.activation_diagnostics,command_discovery:n.command_discovery,verification:n.verification,warnings:l,...u?{}:{error:{message:"Extension install returned ok=false without throwing an error.",exit_code:d.GENERIC_FAILURE,code:"extension_install_soft_failed"}}})}catch(s){let n=oe(s),l=n.exit_code;typeof l=="number"&&r===d.GENERIC_FAILURE&&l!==d.GENERIC_FAILURE&&(r=l),i.push({target:c,ok:!1,error:n})}return{rows:i,warnings:a,failureExitCode:r}}async function N(e,t,o,i){let a=i==="extension"?"package":i;await _(H[i],o);let r=await Q(e);if(r===void 0||r.length<=1){await g(r?.[0],t,o,"install",a);return}let c=b(o),s=Date.now(),n=A(t,"install",a);if(z(n,c,void 0),[n.gh,n.github].some(k=>typeof k=="string"&&k.trim().length>0))throw new h("Multiple install targets cannot be combined with --gh/--github. Install one GitHub source per command, or pass multiple explicit local, bundled, or npm: targets.",d.USAGE,{code:"multi_target_github_install_ambiguous",required:"Use exactly one positional target with --gh/--github, or omit --gh/--github when installing multiple targets.",examples:["pm package install --gh owner/repo","pm package install npm:pm-guide-shell pm-todos"]});let{rows:l,warnings:u,failureExitCode:m}=await ae(r,n,c),f=l.filter(k=>k.ok!==!0).length,B={ok:f===0,action:"install",scope:n.global===!0?"global":"project",installed_count:n.dryRun===!0?0:l.length-f,...n.dryRun===!0?{dry_run:!0,planned_count:l.length-f}:{},failed_count:f,targets:l,warnings:[...new Set(u)].sort((k,V)=>k.localeCompare(V))};w(B,c),f>0&&(process.exitCode=m),c.profile&&y(`profile:command=extension took_ms=${Date.now()-s}`)}function ie(e){return e.option("--project","Use project extension scope (default)").option("--local","Alias for --project").option("--global","Use global extension scope")}function x(e){return e.option("--project","Use project package scope (default)").option("--local","Alias for --project").option("--global","Use global package scope")}function p(e,t){return t==="package"?x(e):ie(e)}function q(e){return e.option("--dry-run","Plan CLI/package upgrades without running npm or reinstalling packages").option("--cli-only","Upgrade only the pm CLI/SDK npm package").option("--packages-only","Upgrade only managed pm packages").option("--repair","Force npm global reinstall when upgrading the pm CLI/SDK").option("--tag <value>","npm dist-tag/version for CLI and registry package upgrades").option("--package-name <value>","Override the CLI package name for self-upgrade testing")}async function K(e,t,o){let i=b(t),a=Date.now();o&&await _("upgrade",t);let r=await P(e,t.optsWithGlobals(),i);w(r,i),r.ok||(process.exitCode=d.GENERIC_FAILURE),i.profile&&y(`profile:command=package-upgrade took_ms=${Date.now()-a}`)}function M(e,t){let o=t==="package"?"package":"extension",i=t==="package"?"packages":"extensions",a=t,r=e.command(a,{hidden:t==="extension"}).argument("[target]",`${o[0].toUpperCase()}${o.slice(1)} source, name, or scaffold path`).option("--init",`Generate a starter ${o} scaffold at target path`).option("--scaffold","Alias for --init").option("--capability <kind>","Starter capability for --init (default: commands)",v).option("--install",`Install a ${o} source`).option("--dry-run","Preview install without writes or activation").option("--uninstall",`Uninstall an installed ${o}`).option("--explore",`List discovered ${i} in selected scope`).option("--list","Alias for --explore").option("--manage",`List managed ${i} and updates`).option("--offline","Skip remote freshness checks during manage").option("--describe",`Show surfaces registered by a loaded ${o}`).option("--markdown","Render describe as Markdown").option("--output <path>","Write Markdown to a file").option("--reload",`Reload ${i} without import cache`).option("--watch","Use watch mode with --reload").option("--doctor",`Run ${o} diagnostics`).option("--catalog",`List bundled first-party ${o} catalog metadata`).option("--adopt",`Adopt unmanaged ${o}`).option("--adopt-all",`Adopt all unmanaged ${i}`).option("--activate",`Activate a ${o} in selected scope settings`).option("--deactivate",`Deactivate a ${o} in selected scope settings`).option("--project",`Use project ${o} scope (default)`).option("--local","Alias for --project").option("--global",`Use global ${o} scope`).option("--gh <github-source>","Install from GitHub shorthand source (owner/repo[/path])").option("--github <github-source>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub install sources").option("--detail <mode>",`${o[0].toUpperCase()}${o.slice(1)} diagnostics detail mode (summary|deep)`).option("--trace","Include actionable registration traces in doctor deep diagnostics").option("--runtime-probe","Opt-in runtime activation probe for manage output parity").option("--fix-managed-state",`Adopt unmanaged ${i} before diagnostics/update checks`).option("--isolated",`Run doctor against project-scope ${i} only, ignoring global registrations`).option("--ignore-global","Alias for --isolated").option("--strict-exit","Return non-zero exit when doctor warnings are present (ok=false)").option("--fail-on-warn","Alias for --strict-exit (doctor)").description(t==="package"?"Manage package lifecycle in project or global scope.":"Manage extension lifecycle in project or global scope.").action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,void 0,t)});t==="package"&&(r.alias("packages"),r.option("--declarative","Scaffold the composeExtension blueprint starter (any capability)"));let c=r.command("init").alias("scaffold").argument("<target>","Scaffold target directory path").option("--capability <kind>",`Capability the starter targets (${U.join("|")}; default commands)`,v).description(t==="package"?"Generate a starter package scaffold with package metadata, manifest, and entrypoint.":"Generate a starter extension scaffold with manifest and entrypoint.");t==="package"&&c.option("--declarative","Scaffold the composeExtension blueprint starter (any capability)"),p(c,t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"init",t)}),p(r.command("install").option("--dry-run","Resolve sources and estimate copying without destination writes or activation").argument("[targets...]",`${o[0].toUpperCase()}${o.slice(1)} source (local path, bundled alias, npm: source, wildcard, or GitHub source)`).option("--gh <github-source>","Install from GitHub shorthand source (owner/repo[/path])").option("--github <github-source>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub install sources").description(`Install ${o} from local path, bundled alias, npm: source, wildcard, or GitHub source.`),t).action(async(s,n,l)=>{await N(s,l.optsWithGlobals(),l,t)}),p(r.command("uninstall").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Uninstall an installed ${o}.`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"uninstall",t)}),p(r.command("explore").description(`List discovered ${i} in selected scope.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"explore",t)}),p(r.command("inventory").argument("[name]",`${o[0].toUpperCase()}${o.slice(1)} name or directory to inspect`).description(`Read configured ${o} install and enablement state without activating extension code.`),t).action(async(s,n,l)=>{let u=b(l),m=l.optsWithGlobals();if(m.global===!0&&(m.project===!0||m.local===!0))throw new h("--global and --project/--local are mutually exclusive.",d.USAGE);let f=await W({pmRoot:E(process.cwd(),u.path),scope:m.global===!0?"global":"project",name:s});w(f,u),f.complete||(process.exitCode=d.GENERIC_FAILURE)}),p(r.command("manage").option("--offline","Skip remote freshness checks and report unknown update availability").option("--runtime-probe","Opt-in runtime activation probe for manage output parity").option("--fix-managed-state",`Adopt unmanaged ${i} before diagnostics/update checks`).description(`List managed ${i} with update-check metadata.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"manage",t)}),p(r.command("describe").argument("[target]",`${o[0].toUpperCase()}${o.slice(1)} name to describe (omit for every loaded ${o})`).option("--markdown","Render the surface map as a Markdown reference document instead of toon/json").option("--output <path>","Write Markdown output to a file (requires --markdown)").description(`Map every surface a loaded ${o} registers (commands, hooks, item types, providers, overrides, ...).`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"describe",t)}),p(r.command("reload").option("--watch","Use watch mode for repeated reload checks").description(`Reload ${i} with cache-busted module imports.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"reload",t)}),p(r.command("doctor").option("--detail <mode>",`Detail mode for ${o} diagnostics (summary|deep)`).option("--trace","Include actionable registration traces in doctor deep diagnostics").option("--fix-managed-state",`Adopt unmanaged ${i} before diagnostics/update checks`).option("--isolated",`Run doctor against project-scope ${i} only, ignoring global registrations`).option("--ignore-global","Alias for --isolated").option("--strict-exit","Return non-zero exit when doctor warnings are present (ok=false)").option("--fail-on-warn","Alias for --strict-exit (doctor)").description(`Run consolidated ${o} diagnostics (summary/deep modes).`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"doctor",t)}),p(r.command("catalog").alias("list").option("--fields <value>","Render compact comma-separated catalog fields, for example: alias,installed,install_command").description(`List bundled first-party ${o} catalog metadata.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"catalog",t)}),p(r.command("adopt").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).option("--gh <owner/repo[/path]>",`GitHub provenance shorthand for adopted ${o}`).option("--github <owner/repo[/path]>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub shorthand source").description(`Adopt an existing unmanaged ${o} into managed metadata.`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"adopt",t)}),p(r.command("adopt-all").description(`Adopt all unmanaged ${i} into managed metadata.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"adopt-all",t)}),p(r.command("migrate").option("--dry-run","Plan active migrations without invoking extension code").description(`Plan or apply active ${o} migrations with durable receipts.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"migrate",t)}),p(r.command("activate").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Activate a ${o} in selected scope settings.`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"activate",t)}),p(r.command("deactivate").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Deactivate a ${o} in selected scope settings.`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"deactivate",t)}),t==="package"&&q(x(r.command("upgrade").argument("[target]","Optional managed package name/source to upgrade; omit to upgrade pm CLI and all managed packages").description("Upgrade the pm CLI/SDK and refresh managed installable pm packages."))).action(async(s,n,l)=>{await K(s,l,!1)})}async function ne(e,t,o){let i=b(o),a=Date.now(),r=await j(e,i,{idPrefix:typeof t.idPrefix=="string"?t.idPrefix:void 0,preset:typeof t.preset=="string"?t.preset:void 0,defaults:t.defaults===!0||t.yes===!0,author:typeof t.author=="string"?t.author:void 0,agentGuidance:typeof t.agentGuidance=="string"?t.agentGuidance:void 0,typePreset:typeof t.typePreset=="string"?t.typePreset:void 0,withPackages:t.withPackages===!0,mergeFence:t.mergeFence!==!1,force:t.force===!0,workspace:typeof t.workspace=="string"?t.workspace:void 0}),c=t.verbose===!0||i.json===!0;w(c?r:O(r,!0),i),i.profile&&y(`profile:command=init took_ms=${Date.now()-a}`)}function re(e,t,o,i){let a=e!==void 0&&new Set(["get","set","list","export"]).has(e);return{resolvedScope:a?S(t):e??"project",resolvedAction:a?e:t??"list",resolvedKey:a?t:o,resolvedValue:a?o:i}}function se(e){return{criterion:Array.isArray(e.criterion)?e.criterion:[],format:typeof e.format=="string"?e.format:void 0,policy:typeof e.policy=="string"?e.policy:void 0,value:typeof e.value=="string"?e.value:void 0,clearCriteria:e.clearCriteria===!0,defaultDepth:typeof e.defaultDepth=="string"?e.defaultDepth:void 0,activityLimit:typeof e.activityLimit=="string"?e.activityLimit:void 0,staleThresholdDays:typeof e.staleThresholdDays=="string"?e.staleThresholdDays:void 0,sectionHierarchy:typeof e.sectionHierarchy=="string"?e.sectionHierarchy:void 0,sectionActivity:typeof e.sectionActivity=="string"?e.sectionActivity:void 0,sectionProgress:typeof e.sectionProgress=="string"?e.sectionProgress:void 0,sectionBlockers:typeof e.sectionBlockers=="string"?e.sectionBlockers:void 0,sectionFiles:typeof e.sectionFiles=="string"?e.sectionFiles:void 0,sectionWorkload:typeof e.sectionWorkload=="string"?e.sectionWorkload:void 0,sectionStaleness:typeof e.sectionStaleness=="string"?e.sectionStaleness:void 0,sectionTests:typeof e.sectionTests=="string"?e.sectionTests:void 0}}async function le(e,t,o,i,a,r){let c=b(r),s=Date.now(),{resolvedScope:n,resolvedAction:l,resolvedKey:u,resolvedValue:m}=re(e,t,o,i),f=await T(n,l,u,se(a),c,typeof m=="string"?m:void 0);w(f,c),c.profile&&y(`profile:command=config took_ms=${Date.now()-s}`)}var Ue={normalizeExtensionOptions:A};function Le(e){e.command("init").argument("[prefix-or-path]","Optional id prefix, or path-like tracker target such as ./pm-sandbox").option("--prefix, --id-prefix <value>","Set the item ID prefix (alias for the positional prefix)").option("--preset <value>","Governance preset for new setups: minimal|default|strict").option("--defaults","Use non-interactive setup defaults without opening the wizard").option("-y, --yes","Alias for --defaults (non-interactive setup)").option("--author <value>","Set the default mutation author for this project").option("--agent-guidance <mode>","Agent guidance mode: ask|add|skip|status").option("--type-preset <name>","Register domain item types during init: agile|ops|research").option("--with-packages","Install all bundled first-party packages during initialization").option("--no-merge-fence","Skip automatic merge-driver installation for a fresh Git-backed tracker").option("--workspace <dir>","Initialize repository-local tracker storage at <dir>/.agents/pm").option("--force","Allow initializing tracker files directly in a directory that looks like a workspace root").option("--verbose","Include the full resolved settings tree in the output (default output is a concise summary)").description("Initialize pm storage and defaults for the current workspace or a path-like tracker target.").action(async(t,o,i)=>{await ne(t,o,i)}),e.command("config").argument("[scope]","Config scope: project|global, or action shorthand list|export|get|set for project scope").argument("[action]","Config action: get|set|list|export").argument("[key]","Config key for get|set; use `pm config project list` for the complete typed inventory, including mutation-guard-* policies").argument("[value]","Value for set, validated by key. Dotted leaves accept values (e.g. context.default_depth deep); the context group takes --default-depth/--section-* flags.").option("--criterion <text>","Criteria value for definition-of-done, metadata-required-fields, or lifecycle pattern keys (repeatable for set)",v).option("--clear-criteria","Clear criteria-list keys for config set operations").option("--format <value>","Item format for item-format key: toon").option("--policy <value>","Policy key values: history-missing-stream-policy=auto_create|strict_error; sprint-release-format-policy=warn|strict_error; parent-reference-policy=warn|strict_error; governance-preset=minimal|default|strict|custom; governance-ownership-enforcement=none|warn|strict; governance-create-mode-default=progressive|strict; governance-close-validation-default=off|warn|strict; governance-require-close-reason=enabled|disabled; governance-parent-reference-policy=warn|strict_error; governance-metadata-validation-profile=core|strict|custom; governance-force-required-for-stale-lock=enabled|disabled; governance-duplicate-detection-mode=off|advisory|strict; test-result-tracking=enabled|disabled; untrusted-linked-test-execution=enabled|disabled; telemetry-tracking=enabled|disabled").option("--value <value>","Typed nested setting value. Mutation guards: require-attributed-author=true|false, secret-guard=off|advise|block, stale-in-progress-hours=integer>=1. Kebab-case is preferred; underscore aliases remain accepted.").option("--default-depth <value>","Context default depth: brief|standard|deep|full").option("--activity-limit <n>","Context default activity limit").option("--stale-threshold-days <n>","Context staleness cutoff in days").option("--section-hierarchy <value>","Enable/disable context hierarchy section (true|false)").option("--section-activity <value>","Enable/disable context activity section (true|false)").option("--section-progress <value>","Enable/disable context progress section (true|false)").option("--section-blockers <value>","Enable/disable context blockers section (true|false)").option("--section-files <value>","Enable/disable context files section (true|false)").option("--section-workload <value>","Enable/disable context workload section (true|false)").option("--section-staleness <value>","Enable/disable context staleness section (true|false)").option("--section-tests <value>","Enable/disable context tests section (true|false)").description("Read or update pm settings for the current workspace or global profile.").action(async(t,o,i,a,r,c)=>{await le(t,o,i,a,r,c)}),M(e,"extension"),M(e,"package"),x(e.command("install",{hidden:!0}).option("--dry-run","Resolve sources and estimate copying without destination writes or activation").argument("[targets...]","Package source (local path, bundled alias, npm: source, wildcard, or GitHub source)").option("--gh <github-source>","Install from GitHub shorthand source (owner/repo[/path])").option("--github <github-source>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub install sources").description("Install a pm package into the project package scope by default.")).action(async(t,o,i)=>{await _("install",i),await N(t,i.optsWithGlobals(),i,"package")}),q(x(e.command("upgrade",{hidden:!0}).argument("[target]","Optional managed package name/source to upgrade; omit to upgrade pm CLI and all managed packages").description("Upgrade the pm CLI/SDK and refresh managed installable pm packages."))).action(async(t,o,i)=>{await K(t,i,!0)})}export{Ue as _testOnlyRegisterSetup,Le as registerSetupCommands};
2
- //# sourceMappingURL=register-setup-RYRIBNSN.js.map
1
+ import"./chunk-DEZPZOQ7.js";import{a as W}from"./chunk-CIKGG34F.js";import{g as T,i as P}from"./chunk-AHQB7W2H.js";import{Ea as I,Ja as O,La as j,ra as U,ua as L}from"./chunk-RMIRNYRG.js";import"./chunk-YJEBK7HU.js";import"./chunk-YMUSRWV4.js";import"./chunk-NCFCBKIP.js";import{Cc as b,Fc as v}from"./chunk-IUIOTAF6.js";import"./chunk-SRVTCYAU.js";import"./chunk-IB7UB5TE.js";import{X as S}from"./chunk-PJXKA4QU.js";import{v as R}from"./chunk-6QLEXRUG.js";import{A as G,Sa as E,Xg as D,ah as w,bh as y,z as $}from"./chunk-YKJKQ7DM.js";import"./chunk-LQBWLNZJ.js";import{A as d,C as h}from"./chunk-KQIZ34SF.js";import"./chunk-XAWE4EAK.js";import C from"node:fs/promises";import F from"node:path";(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]="26ea7f42-d5f7-5ada-afd9-389dadc4d138")}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]="0b0e08e0-f6e7-59c4-ac96-9f47b172727a")}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]="d975120a-964e-5b19-ae10-8ba011ba9bf8")}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]="108609fa-51fc-5bd0-ac54-de2ad14a66c6")}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]="b36466e6-5574-5509-909a-e8599f11664c")}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]="e5e1e242-6864-5a72-adb9-0eda4c65a0c3")}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]="7462433c-f34c-5b30-a676-a296dc3e3428")}catch{}})();var H={extension:"extension",package:void 0};async function _(e,t){if(!e)return;let o=$(e),i=b(t);await R(E(process.cwd(),i.path)).then(a=>a.ux.deprecation_hints)&&y(G(o))}var X={init:"init",install:"install",uninstall:"uninstall",explore:"explore",manage:"manage",describe:"describe",reload:"reload",doctor:"doctor",catalog:"catalog",adopt:"adopt","adopt-all":"adoptAll",activate:"activate",deactivate:"deactivate",migrate:"migrate"};function Y(e){let t=e.capability,o=typeof t=="string"?[t]:Array.isArray(t)?t.filter(a=>typeof a=="string"):[],i=[...new Set(o.map(a=>a.trim().toLowerCase()).filter(a=>a.length>0))];if(i.length>1)throw new h(`Multiple scaffold capabilities cannot be combined yet: ${i.join(", ")}. Choose one capability per scaffold.`,d.USAGE);return i[0]}function A(e,t,o="extension"){let i={...e};t!==void 0&&(i[X[t]]=!0);let a=(...c)=>c.some(s=>i[s]===!0),r=(...c)=>{for(let s of c)if(typeof i[s]=="string")return i[s]};return{init:a("init"),scaffold:a("scaffold"),install:a("install"),uninstall:a("uninstall"),explore:a("explore","list"),manage:a("manage"),describe:a("describe"),markdown:a("markdown"),reload:a("reload"),doctor:a("doctor"),catalog:a("catalog"),adopt:a("adopt"),adoptAll:a("adoptAll","adopt_all","adopt-all"),activate:a("activate"),deactivate:a("deactivate"),migrate:a("migrate"),project:a("project"),local:a("local"),global:a("global"),gh:r("gh"),github:r("github"),ref:r("ref"),capability:Y(e),declarative:a("declarative"),fields:r("fields"),detail:r("detail"),output:r("output"),trace:a("trace"),watch:a("watch"),runtimeProbe:a("runtimeProbe","runtime_probe","runtime-probe"),offline:a("offline"),fixManagedState:a("fixManagedState","fix_managed_state","fix-managed-state"),isolated:a("isolated"),ignoreGlobal:a("ignoreGlobal","ignore_global","ignore-global"),strictExit:a("strictExit","strict_exit","strict-exit"),failOnWarn:a("failOnWarn","fail_on_warn","fail-on-warn"),dryRun:a("dryRun","dry_run","dry-run"),vocabulary:o}}async function J(e){let t=(await C.readdir(process.cwd())).filter(i=>!i.startsWith(".")).sort((i,a)=>i.localeCompare(a)),o=[...e].sort((i,a)=>i.localeCompare(a));return t.length===o.length&&t.every((i,a)=>i===o[a])}async function Q(e){let t=(e??[]).map(o=>o.trim()).filter(o=>o.length>0);return t.length<=1?t.length===0?void 0:t:await J(t)?["*"]:t}function z(e,t,o){let i=e.markdown===!0;if(o!==void 0&&o==="")throw new h("--output requires a non-empty file path.",d.USAGE);if(o!==void 0&&!i)throw new h("--output is only supported with --markdown describe output.",d.USAGE);if(i){if(t.json)throw new h("Cannot combine --json with --markdown.",d.USAGE);if(e.describe!==!0)throw new h("--markdown is only supported by the describe action.",d.USAGE)}}async function Z(e){let t=L(e.result.details,e.vocabulary);if(e.outputPath!==void 0){let o=F.resolve(e.outputPath);await C.mkdir(F.dirname(o),{recursive:!0}),await C.writeFile(o,t,"utf8")}if(!e.globalOptions.quiet){for(let o of e.result.warnings)y(`warning: ${o}`);e.outputPath===void 0&&D(t)}}function ee(e,t){let o=!!t.strictExit||!!t.failOnWarn;if(e.action!=="doctor"||!o)return;let i=e.details!==null&&typeof e.details=="object"?e.details:{},a=i.summary!==null&&typeof i.summary=="object"?i.summary:null,r=a&&typeof a.status=="string"?a.status:void 0;(e.warnings.length>0||r!==void 0&&r!=="ok")&&(process.exitCode=d.GENERIC_FAILURE)}async function g(e,t,o,i,a="extension"){let r=b(o),c=Date.now(),s=a==="extension"?"package":a;await _(H[a],o);let n=A(t,i,s),l=(typeof n.output=="string"?n.output:void 0)?.trim();z(n,r,l);let u=await I(e,n,r);n.markdown===!0?await Z({result:u,vocabulary:s,outputPath:l,globalOptions:r}):w(u,r),ee(u,n),u.ok===!1&&(process.exitCode=d.GENERIC_FAILURE),r.profile&&y(`profile:command=extension took_ms=${Date.now()-c}`)}function te(e){return e.details!==null&&typeof e.details=="object"?e.details:{}}function oe(e){return e instanceof h?{message:e.message,exit_code:e.exitCode,...e.context}:{message:e instanceof Error?e.message:String(e),exit_code:d.GENERIC_FAILURE}}async function ae(e,t,o){let i=[],a=[],r=d.GENERIC_FAILURE;for(let c of e)try{let s=await I(c,t,o),n=te(s),l=Array.isArray(s.warnings)?s.warnings:[];a.push(...l);let u=s.ok===!0;i.push({target:c,ok:u,extension:n.extension,source:n.source,install_plan:n.install_plan,dry_run:n.dry_run,destination_path:n.destination_path,activated:n.activated,settings_changed:n.settings_changed,previous_state_preserved:n.previous_state_preserved,rollback:n.rollback,command_paths:n.command_paths,action_paths:n.action_paths,runtime_activation_status:n.runtime_activation_status,activation_diagnostics:n.activation_diagnostics,command_discovery:n.command_discovery,verification:n.verification,warnings:l,...u?{}:{error:{message:"Extension install returned ok=false without throwing an error.",exit_code:d.GENERIC_FAILURE,code:"extension_install_soft_failed"}}})}catch(s){let n=oe(s),l=n.exit_code;typeof l=="number"&&r===d.GENERIC_FAILURE&&l!==d.GENERIC_FAILURE&&(r=l),i.push({target:c,ok:!1,error:n})}return{rows:i,warnings:a,failureExitCode:r}}async function N(e,t,o,i){let a=i==="extension"?"package":i;await _(H[i],o);let r=await Q(e);if(r===void 0||r.length<=1){await g(r?.[0],t,o,"install",a);return}let c=b(o),s=Date.now(),n=A(t,"install",a);if(z(n,c,void 0),[n.gh,n.github].some(k=>typeof k=="string"&&k.trim().length>0))throw new h("Multiple install targets cannot be combined with --gh/--github. Install one GitHub source per command, or pass multiple explicit local, bundled, or npm: targets.",d.USAGE,{code:"multi_target_github_install_ambiguous",required:"Use exactly one positional target with --gh/--github, or omit --gh/--github when installing multiple targets.",examples:["pm package install --gh owner/repo","pm package install npm:pm-guide-shell pm-todos"]});let{rows:l,warnings:u,failureExitCode:m}=await ae(r,n,c),f=l.filter(k=>k.ok!==!0).length,B={ok:f===0,action:"install",scope:n.global===!0?"global":"project",installed_count:n.dryRun===!0?0:l.length-f,...n.dryRun===!0?{dry_run:!0,planned_count:l.length-f}:{},failed_count:f,targets:l,warnings:[...new Set(u)].sort((k,V)=>k.localeCompare(V))};w(B,c),f>0&&(process.exitCode=m),c.profile&&y(`profile:command=extension took_ms=${Date.now()-s}`)}function ie(e){return e.option("--project","Use project extension scope (default)").option("--local","Alias for --project").option("--global","Use global extension scope")}function x(e){return e.option("--project","Use project package scope (default)").option("--local","Alias for --project").option("--global","Use global package scope")}function p(e,t){return t==="package"?x(e):ie(e)}function q(e){return e.option("--dry-run","Plan CLI/package upgrades without running npm or reinstalling packages").option("--cli-only","Upgrade only the pm CLI/SDK npm package").option("--packages-only","Upgrade only managed pm packages").option("--repair","Force npm global reinstall when upgrading the pm CLI/SDK").option("--tag <value>","npm dist-tag/version for CLI and registry package upgrades").option("--package-name <value>","Override the CLI package name for self-upgrade testing")}async function K(e,t,o){let i=b(t),a=Date.now();o&&await _("upgrade",t);let r=await P(e,t.optsWithGlobals(),i);w(r,i),r.ok||(process.exitCode=d.GENERIC_FAILURE),i.profile&&y(`profile:command=package-upgrade took_ms=${Date.now()-a}`)}function M(e,t){let o=t==="package"?"package":"extension",i=t==="package"?"packages":"extensions",a=t,r=e.command(a,{hidden:t==="extension"}).argument("[target]",`${o[0].toUpperCase()}${o.slice(1)} source, name, or scaffold path`).option("--init",`Generate a starter ${o} scaffold at target path`).option("--scaffold","Alias for --init").option("--capability <kind>","Starter capability for --init (default: commands)",v).option("--install",`Install a ${o} source`).option("--dry-run","Preview install without writes or activation").option("--uninstall",`Uninstall an installed ${o}`).option("--explore",`List discovered ${i} in selected scope`).option("--list","Alias for --explore").option("--manage",`List managed ${i} and updates`).option("--offline","Skip remote freshness checks during manage").option("--describe",`Show surfaces registered by a loaded ${o}`).option("--markdown","Render describe as Markdown").option("--output <path>","Write Markdown to a file").option("--reload",`Reload ${i} without import cache`).option("--watch","Use watch mode with --reload").option("--doctor",`Run ${o} diagnostics`).option("--catalog",`List bundled first-party ${o} catalog metadata`).option("--adopt",`Adopt unmanaged ${o}`).option("--adopt-all",`Adopt all unmanaged ${i}`).option("--activate",`Activate a ${o} in selected scope settings`).option("--deactivate",`Deactivate a ${o} in selected scope settings`).option("--project",`Use project ${o} scope (default)`).option("--local","Alias for --project").option("--global",`Use global ${o} scope`).option("--gh <github-source>","Install from GitHub shorthand source (owner/repo[/path])").option("--github <github-source>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub install sources").option("--detail <mode>",`${o[0].toUpperCase()}${o.slice(1)} diagnostics detail mode (summary|deep)`).option("--trace","Include actionable registration traces in doctor deep diagnostics").option("--runtime-probe","Opt-in runtime activation probe for manage output parity").option("--fix-managed-state",`Adopt unmanaged ${i} before diagnostics/update checks`).option("--isolated",`Run doctor against project-scope ${i} only, ignoring global registrations`).option("--ignore-global","Alias for --isolated").option("--strict-exit","Return non-zero exit when doctor warnings are present (ok=false)").option("--fail-on-warn","Alias for --strict-exit (doctor)").description(t==="package"?"Manage package lifecycle in project or global scope.":"Manage extension lifecycle in project or global scope.").action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,void 0,t)});t==="package"&&(r.alias("packages"),r.option("--declarative","Scaffold the composeExtension blueprint starter (any capability)"));let c=r.command("init").alias("scaffold").argument("<target>","Scaffold target directory path").option("--capability <kind>",`Capability the starter targets (${U.join("|")}; default commands)`,v).description(t==="package"?"Generate a starter package scaffold with package metadata, manifest, and entrypoint.":"Generate a starter extension scaffold with manifest and entrypoint.");t==="package"&&c.option("--declarative","Scaffold the composeExtension blueprint starter (any capability)"),p(c,t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"init",t)}),p(r.command("install").option("--dry-run","Resolve sources and estimate copying without destination writes or activation").argument("[targets...]",`${o[0].toUpperCase()}${o.slice(1)} source (local path, bundled alias, npm: source, wildcard, or GitHub source)`).option("--gh <github-source>","Install from GitHub shorthand source (owner/repo[/path])").option("--github <github-source>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub install sources").description(`Install ${o} from local path, bundled alias, npm: source, wildcard, or GitHub source.`),t).action(async(s,n,l)=>{await N(s,l.optsWithGlobals(),l,t)}),p(r.command("uninstall").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Uninstall an installed ${o}.`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"uninstall",t)}),p(r.command("explore").description(`List discovered ${i} in selected scope.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"explore",t)}),p(r.command("inventory").argument("[name]",`${o[0].toUpperCase()}${o.slice(1)} name or directory to inspect`).description(`Read configured ${o} install and enablement state without activating extension code.`),t).action(async(s,n,l)=>{let u=b(l),m=l.optsWithGlobals();if(m.global===!0&&(m.project===!0||m.local===!0))throw new h("--global and --project/--local are mutually exclusive.",d.USAGE);let f=await W({pmRoot:E(process.cwd(),u.path),scope:m.global===!0?"global":"project",name:s});w(f,u),f.complete||(process.exitCode=d.GENERIC_FAILURE)}),p(r.command("manage").option("--offline","Skip remote freshness checks and report unknown update availability").option("--runtime-probe","Opt-in runtime activation probe for manage output parity").option("--fix-managed-state",`Adopt unmanaged ${i} before diagnostics/update checks`).description(`List managed ${i} with update-check metadata.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"manage",t)}),p(r.command("describe").argument("[target]",`${o[0].toUpperCase()}${o.slice(1)} name to describe (omit for every loaded ${o})`).option("--markdown","Render the surface map as a Markdown reference document instead of toon/json").option("--output <path>","Write Markdown output to a file (requires --markdown)").description(`Map every surface a loaded ${o} registers (commands, hooks, item types, providers, overrides, ...).`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"describe",t)}),p(r.command("reload").option("--watch","Use watch mode for repeated reload checks").description(`Reload ${i} with cache-busted module imports.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"reload",t)}),p(r.command("doctor").option("--detail <mode>",`Detail mode for ${o} diagnostics (summary|deep)`).option("--trace","Include actionable registration traces in doctor deep diagnostics").option("--fix-managed-state",`Adopt unmanaged ${i} before diagnostics/update checks`).option("--isolated",`Run doctor against project-scope ${i} only, ignoring global registrations`).option("--ignore-global","Alias for --isolated").option("--strict-exit","Return non-zero exit when doctor warnings are present (ok=false)").option("--fail-on-warn","Alias for --strict-exit (doctor)").description(`Run consolidated ${o} diagnostics (summary/deep modes).`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"doctor",t)}),p(r.command("catalog").alias("list").option("--fields <value>","Render compact comma-separated catalog fields, for example: alias,installed,install_command").description(`List bundled first-party ${o} catalog metadata.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"catalog",t)}),p(r.command("adopt").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).option("--gh <owner/repo[/path]>",`GitHub provenance shorthand for adopted ${o}`).option("--github <owner/repo[/path]>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub shorthand source").description(`Adopt an existing unmanaged ${o} into managed metadata.`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"adopt",t)}),p(r.command("adopt-all").description(`Adopt all unmanaged ${i} into managed metadata.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"adopt-all",t)}),p(r.command("migrate").option("--dry-run","Plan active migrations without invoking extension code").description(`Plan or apply active ${o} migrations with durable receipts.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"migrate",t)}),p(r.command("activate").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Activate a ${o} in selected scope settings.`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"activate",t)}),p(r.command("deactivate").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Deactivate a ${o} in selected scope settings.`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"deactivate",t)}),t==="package"&&q(x(r.command("upgrade").argument("[target]","Optional managed package name/source to upgrade; omit to upgrade pm CLI and all managed packages").description("Upgrade the pm CLI/SDK and refresh managed installable pm packages."))).action(async(s,n,l)=>{await K(s,l,!1)})}async function ne(e,t,o){let i=b(o),a=Date.now(),r=await j(e,i,{idPrefix:typeof t.idPrefix=="string"?t.idPrefix:void 0,preset:typeof t.preset=="string"?t.preset:void 0,defaults:t.defaults===!0||t.yes===!0,author:typeof t.author=="string"?t.author:void 0,agentGuidance:typeof t.agentGuidance=="string"?t.agentGuidance:void 0,typePreset:typeof t.typePreset=="string"?t.typePreset:void 0,withPackages:t.withPackages===!0,mergeFence:t.mergeFence!==!1,force:t.force===!0,workspace:typeof t.workspace=="string"?t.workspace:void 0}),c=t.verbose===!0||i.json===!0;w(c?r:O(r,!0),i),i.profile&&y(`profile:command=init took_ms=${Date.now()-a}`)}function re(e,t,o,i){let a=e!==void 0&&new Set(["get","set","list","export"]).has(e);return{resolvedScope:a?S(t):e??"project",resolvedAction:a?e:t??"list",resolvedKey:a?t:o,resolvedValue:a?o:i}}function se(e){return{criterion:Array.isArray(e.criterion)?e.criterion:[],format:typeof e.format=="string"?e.format:void 0,policy:typeof e.policy=="string"?e.policy:void 0,value:typeof e.value=="string"?e.value:void 0,clearCriteria:e.clearCriteria===!0,defaultDepth:typeof e.defaultDepth=="string"?e.defaultDepth:void 0,activityLimit:typeof e.activityLimit=="string"?e.activityLimit:void 0,staleThresholdDays:typeof e.staleThresholdDays=="string"?e.staleThresholdDays:void 0,sectionHierarchy:typeof e.sectionHierarchy=="string"?e.sectionHierarchy:void 0,sectionActivity:typeof e.sectionActivity=="string"?e.sectionActivity:void 0,sectionProgress:typeof e.sectionProgress=="string"?e.sectionProgress:void 0,sectionBlockers:typeof e.sectionBlockers=="string"?e.sectionBlockers:void 0,sectionFiles:typeof e.sectionFiles=="string"?e.sectionFiles:void 0,sectionWorkload:typeof e.sectionWorkload=="string"?e.sectionWorkload:void 0,sectionStaleness:typeof e.sectionStaleness=="string"?e.sectionStaleness:void 0,sectionTests:typeof e.sectionTests=="string"?e.sectionTests:void 0}}async function le(e,t,o,i,a,r){let c=b(r),s=Date.now(),{resolvedScope:n,resolvedAction:l,resolvedKey:u,resolvedValue:m}=re(e,t,o,i),f=await T(n,l,u,se(a),c,typeof m=="string"?m:void 0);w(f,c),c.profile&&y(`profile:command=config took_ms=${Date.now()-s}`)}var Ue={normalizeExtensionOptions:A};function Le(e){e.command("init").argument("[prefix-or-path]","Optional id prefix, or path-like tracker target such as ./pm-sandbox").option("--prefix, --id-prefix <value>","Set the item ID prefix (alias for the positional prefix)").option("--preset <value>","Governance preset for new setups: minimal|default|strict").option("--defaults","Use non-interactive setup defaults without opening the wizard").option("-y, --yes","Alias for --defaults (non-interactive setup)").option("--author <value>","Set the default mutation author for this project").option("--agent-guidance <mode>","Agent guidance mode: ask|add|skip|status").option("--type-preset <name>","Register domain item types during init: agile|ops|research").option("--with-packages","Install all bundled first-party packages during initialization").option("--no-merge-fence","Skip automatic merge-driver installation for a fresh Git-backed tracker").option("--workspace <dir>","Initialize repository-local tracker storage at <dir>/.agents/pm").option("--force","Allow initializing tracker files directly in a directory that looks like a workspace root").option("--verbose","Include the full resolved settings tree in the output (default output is a concise summary)").description("Initialize pm storage and defaults for the current workspace or a path-like tracker target.").action(async(t,o,i)=>{await ne(t,o,i)}),e.command("config").argument("[scope]","Config scope: project|global, or action shorthand list|export|get|set for project scope").argument("[action]","Config action: get|set|list|export").argument("[key]","Config key for get|set; use `pm config project list` for the complete typed inventory, including mutation-guard-* policies").argument("[value]","Value for set, validated by key. Dotted leaves accept values (e.g. context.default_depth deep); the context group takes --default-depth/--section-* flags.").option("--criterion <text>","Criteria value for definition-of-done, metadata-required-fields, or lifecycle pattern keys (repeatable for set)",v).option("--clear-criteria","Clear criteria-list keys for config set operations").option("--format <value>","Item format for item-format key: toon").option("--policy <value>","Policy key values: history-missing-stream-policy=auto_create|strict_error; sprint-release-format-policy=warn|strict_error; parent-reference-policy=warn|strict_error; governance-preset=minimal|default|strict|custom; governance-ownership-enforcement=none|warn|strict; governance-create-mode-default=progressive|strict; governance-close-validation-default=off|warn|strict; governance-require-close-reason=enabled|disabled; governance-parent-reference-policy=warn|strict_error; governance-metadata-validation-profile=core|strict|custom; governance-force-required-for-stale-lock=enabled|disabled; governance-duplicate-detection-mode=off|advisory|strict; test-result-tracking=enabled|disabled; untrusted-linked-test-execution=enabled|disabled; telemetry-tracking=enabled|disabled").option("--value <value>","Typed nested setting value. Mutation guards: require-attributed-author=true|false, secret-guard=off|advise|block, stale-in-progress-hours=integer>=1. Kebab-case is preferred; underscore aliases remain accepted.").option("--default-depth <value>","Context default depth: brief|standard|deep|full").option("--activity-limit <n>","Context default activity limit").option("--stale-threshold-days <n>","Context staleness cutoff in days").option("--section-hierarchy <value>","Enable/disable context hierarchy section (true|false)").option("--section-activity <value>","Enable/disable context activity section (true|false)").option("--section-progress <value>","Enable/disable context progress section (true|false)").option("--section-blockers <value>","Enable/disable context blockers section (true|false)").option("--section-files <value>","Enable/disable context files section (true|false)").option("--section-workload <value>","Enable/disable context workload section (true|false)").option("--section-staleness <value>","Enable/disable context staleness section (true|false)").option("--section-tests <value>","Enable/disable context tests section (true|false)").description("Read or update pm settings for the current workspace or global profile.").action(async(t,o,i,a,r,c)=>{await le(t,o,i,a,r,c)}),M(e,"extension"),M(e,"package"),x(e.command("install",{hidden:!0}).option("--dry-run","Resolve sources and estimate copying without destination writes or activation").argument("[targets...]","Package source (local path, bundled alias, npm: source, wildcard, or GitHub source)").option("--gh <github-source>","Install from GitHub shorthand source (owner/repo[/path])").option("--github <github-source>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub install sources").description("Install a pm package into the project package scope by default.")).action(async(t,o,i)=>{await _("install",i),await N(t,i.optsWithGlobals(),i,"package")}),q(x(e.command("upgrade",{hidden:!0}).argument("[target]","Optional managed package name/source to upgrade; omit to upgrade pm CLI and all managed packages").description("Upgrade the pm CLI/SDK and refresh managed installable pm packages."))).action(async(t,o,i)=>{await K(t,i,!0)})}export{Ue as _testOnlyRegisterSetup,Le as registerSetupCommands};
2
+ //# sourceMappingURL=register-setup-K7UFG5TD.js.map
@@ -1,7 +1,7 @@
1
- import{b as l}from"./chunk-VS565KBX.js";import{b as d}from"./chunk-SPPHDVZE.js";import{A as s,C as m,G as c,K as p}from"./chunk-5OFMWP3Q.js";import"./chunk-XAWE4EAK.js";import{execFile as f}from"node:child_process";import{chmod as h,lstat as u}from"node:fs/promises";import{promisify as w}from"node:util";(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]="5b6eab08-f707-586f-bb05-484bd9160551")}catch{}})();var y=w(f),g=`#!/bin/sh
1
+ import{c as l}from"./chunk-LQBWLNZJ.js";import{b as d}from"./chunk-SPPHDVZE.js";import{A as s,C as m,G as c,K as p}from"./chunk-KQIZ34SF.js";import"./chunk-XAWE4EAK.js";import{execFile as f}from"node:child_process";import{chmod as h,lstat as u}from"node:fs/promises";import{promisify as w}from"node:util";(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]="5b6eab08-f707-586f-bb05-484bd9160551")}catch{}})();var y=w(f),g=`#!/bin/sh
2
2
  # pm-cli:lossless-merge-settlement:v1
3
3
  `;async function I(e,t){let r=(await y("git",["rev-parse","--path-format=absolute","--git-path","hooks/pre-commit"],{cwd:e,env:l(),timeout:1e4})).stdout.trim(),o,i=!1;try{o=await d(r,65536)??"",i=process.platform==="win32"||((await u(r)).mode&73)!==0}catch(a){if(!c(a))throw a}if(o!==void 0&&!o.startsWith(g))throw new m("The pre-commit hook already exists and is not owned by pm; it was preserved.",s.CONFLICT,{code:"merge_settlement_hook_conflict",recovery:{suggested_retry:"pm merge install --dry-run"},nextSteps:["Integrate pm merge reconcile --stage into your existing hook after reviewing its policy, or keep manual settlement. pm never replaces an existing unowned hook."]});let n=`${g}merge_head=$(git rev-parse --git-path MERGE_HEAD) || exit 1
4
4
  [ -f "$merge_head" ] || exit 0
5
5
  exec ${t} merge reconcile --stage
6
6
  `;return{path:r,changed:o!==n||!i,content:n}}async function H(e){e.changed&&(await p(e.path,e.content),await h(e.path,493))}export{I as prepareMergeSettlementHook,H as writeMergeSettlementHook};
7
- //# sourceMappingURL=settlement-hook-E5LHZ4RD.js.map
7
+ //# sourceMappingURL=settlement-hook-BXN5LEQD.js.map
@@ -1,2 +1,2 @@
1
- import{a as y}from"./chunk-HQYIKAC6.js";import{i as w}from"./chunk-H64BNM4A.js";import{d as g}from"./chunk-Y4LXVPA5.js";import"./chunk-IB7UB5TE.js";import"./chunk-CR5GC3VO.js";import{Sa as h}from"./chunk-7UUPLMCU.js";import{b as u}from"./chunk-VS565KBX.js";import{A as d,C as f}from"./chunk-5OFMWP3Q.js";import"./chunk-XAWE4EAK.js";import{execFile as _}from"node:child_process";import{realpath as b}from"node:fs/promises";import l from"node:path";import{promisify as x}from"node:util";(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]="7f4b2fc8-c9c6-51ff-a345-b76b8abdacf4")}catch{}})();var R=x(_);function c(e){return new f(`Automatic merge settlement refused: ${e}`,d.CONFLICT,{code:"merge_settlement_review_required",recovery:{suggested_retry:"pm merge reconcile --dry-run"},nextSteps:["Inspect receipts, repair streams and Git changes. Resolve competing values or unrelated drift explicitly, then run pm merge reconcile and stage the reviewed artifacts manually."]})}async function $(e){let t=process.env.GIT_INDEX_FILE;if(t===void 0)return;let a=(await e(["rev-parse","--path-format=absolute","--git-path","index"])).stdout.trim();if(l.resolve(t)!==l.resolve(a))throw c("an alternate Git index requires explicit manual settlement")}async function I(e,t){if(t.length===0)return[];let a=t.map(s=>`:(literal)${s}`),o=new Set((await e(["ls-files","--cached","-z","--",...a])).stdout.split("\0")),i=t.filter(s=>!o.has(s)).map(s=>`:(literal)${s}`);if(i.length>0&&(await e(["diff","--cached","--name-only","--diff-filter=D","-z","--",...i])).stdout.length>0)throw c("a receipt has a staged deletion that requires explicit review");return i}async function G(e){let{git:t,preview:a,paths:o,newReceiptPathspecs:i}=e,s=!1;try{i.length>0&&(s=!0,await t(["add","--",...i]));let n=await e.apply();if(!n.ok||JSON.stringify(n.receipts.summaries)!==JSON.stringify(a.receipts.summaries)||n.repair.streams.some(p=>!a.repair.streams.some(m=>m.id===p.id)))throw c("reconciliation changed or did not finish; inspect the audit artifacts before staging");return o.length>0&&await t(["add","--",...o.map(p=>`:(literal)${p}`)]),{...n,staged_paths:o,guidance:["Lossless reconciliation artifacts are staged for the merge commit. Review git diff --cached before committing."]}}catch(n){throw s&&await t(["reset","--quiet","--",...i]),n}}function k(e){if(e.repair.totals.failed>0||e.receipts.missing_history_references_after>0||e.receipts.summaries.some(t=>t.conflict_fields.length>0)||e.repair.streams.some(t=>t.merge_receipt_proof?.trusted!==!0)||e.validation.checks.some(t=>t.name!=="history_drift"&&t.status!=="ok"))throw c("only fully authenticated receipt-backed repairs without discarded values can be staged")}async function S(e){try{return{...e,path:await b(h(process.cwd(),e.path))}}catch{throw c("the tracker root cannot be resolved")}}async function F(e){let{preview:t}=e;k(t);let{path:a}=await S(e.global),o=await w(a);if(o===null)throw c("a Git workspace is required");let i=r=>R("git",r,{cwd:o,env:u(),timeout:1e4});if(await $(i),(await i(["ls-files","--unmerged","-z"])).stdout.length>0)throw c("Git still has unresolved paths");let s=[...new Set([...[...new Set([...t.repair.streams.map(r=>r.id),...t.receipts.summaries.map(r=>r.item_id)])].map(r=>l.join(a,"history",`${r}.jsonl`)),...t.receipts.summaries.map(r=>l.join(a,"merge-receipts",`${r.receipt_id}.json`))])].map(r=>l.relative(o,r).replaceAll("\\","/"));if(s.some(g))throw c("reconciliation artifacts must belong to this Git workspace");let n=await y(o,s);if(n.length>0)throw new f(`Automatic merge settlement refused: required artifacts are ignored by Git: ${n.map(r=>`${r.path} (${r.source}:${r.line}: ${r.pattern})`).join(", ")}. Remove or narrow the owning ignore rules because merge receipts must travel with the commit.`,d.CONFLICT,{code:"merge_settlement_review_required",reason:"ignored_merge_artifacts",paths:n.map(r=>r.path),nextSteps:["Remove or narrow the named ignore rules, preserve receipt and history files, then retry pm merge reconcile --stage --dry-run before applying pm merge reconcile --stage. Do not force-add ignored proof as a substitute for fixing the shared policy."]});let p=s.map(r=>`:(literal)${r}`),m=t.receipts.summaries.map(r=>l.relative(o,l.join(a,"merge-receipts",`${r.receipt_id}.json`)).replaceAll("\\","/"));if(p.length>0)try{await i(["diff","--quiet","--",...p])}catch{throw c("reconciliation paths have unstaged edits or Git cannot verify their index state")}let v=await I(i,m);return e.dryRun?{...t,staged_paths:[]}:G({...e,git:i,paths:s,newReceiptPathspecs:v})}export{S as resolveMergeSettlementGlobal,F as stageLosslessMergeReconciliation};
2
- //# sourceMappingURL=stage-XGWW3T64.js.map
1
+ import{a as y}from"./chunk-YR2KEBHP.js";import{i as w}from"./chunk-YJEBK7HU.js";import{d as g}from"./chunk-YMUSRWV4.js";import"./chunk-IB7UB5TE.js";import"./chunk-6QLEXRUG.js";import{Sa as h}from"./chunk-YKJKQ7DM.js";import{c as u}from"./chunk-LQBWLNZJ.js";import{A as d,C as f}from"./chunk-KQIZ34SF.js";import"./chunk-XAWE4EAK.js";import{execFile as _}from"node:child_process";import{realpath as b}from"node:fs/promises";import l from"node:path";import{promisify as x}from"node:util";(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]="7f4b2fc8-c9c6-51ff-a345-b76b8abdacf4")}catch{}})();var R=x(_);function c(e){return new f(`Automatic merge settlement refused: ${e}`,d.CONFLICT,{code:"merge_settlement_review_required",recovery:{suggested_retry:"pm merge reconcile --dry-run"},nextSteps:["Inspect receipts, repair streams and Git changes. Resolve competing values or unrelated drift explicitly, then run pm merge reconcile and stage the reviewed artifacts manually."]})}async function $(e){let t=process.env.GIT_INDEX_FILE;if(t===void 0)return;let a=(await e(["rev-parse","--path-format=absolute","--git-path","index"])).stdout.trim();if(l.resolve(t)!==l.resolve(a))throw c("an alternate Git index requires explicit manual settlement")}async function I(e,t){if(t.length===0)return[];let a=t.map(s=>`:(literal)${s}`),o=new Set((await e(["ls-files","--cached","-z","--",...a])).stdout.split("\0")),i=t.filter(s=>!o.has(s)).map(s=>`:(literal)${s}`);if(i.length>0&&(await e(["diff","--cached","--name-only","--diff-filter=D","-z","--",...i])).stdout.length>0)throw c("a receipt has a staged deletion that requires explicit review");return i}async function G(e){let{git:t,preview:a,paths:o,newReceiptPathspecs:i}=e,s=!1;try{i.length>0&&(s=!0,await t(["add","--",...i]));let n=await e.apply();if(!n.ok||JSON.stringify(n.receipts.summaries)!==JSON.stringify(a.receipts.summaries)||n.repair.streams.some(p=>!a.repair.streams.some(m=>m.id===p.id)))throw c("reconciliation changed or did not finish; inspect the audit artifacts before staging");return o.length>0&&await t(["add","--",...o.map(p=>`:(literal)${p}`)]),{...n,staged_paths:o,guidance:["Lossless reconciliation artifacts are staged for the merge commit. Review git diff --cached before committing."]}}catch(n){throw s&&await t(["reset","--quiet","--",...i]),n}}function k(e){if(e.repair.totals.failed>0||e.receipts.missing_history_references_after>0||e.receipts.summaries.some(t=>t.conflict_fields.length>0)||e.repair.streams.some(t=>t.merge_receipt_proof?.trusted!==!0)||e.validation.checks.some(t=>t.name!=="history_drift"&&t.status!=="ok"))throw c("only fully authenticated receipt-backed repairs without discarded values can be staged")}async function S(e){try{return{...e,path:await b(h(process.cwd(),e.path))}}catch{throw c("the tracker root cannot be resolved")}}async function F(e){let{preview:t}=e;k(t);let{path:a}=await S(e.global),o=await w(a);if(o===null)throw c("a Git workspace is required");let i=r=>R("git",r,{cwd:o,env:u(),timeout:1e4});if(await $(i),(await i(["ls-files","--unmerged","-z"])).stdout.length>0)throw c("Git still has unresolved paths");let s=[...new Set([...[...new Set([...t.repair.streams.map(r=>r.id),...t.receipts.summaries.map(r=>r.item_id)])].map(r=>l.join(a,"history",`${r}.jsonl`)),...t.receipts.summaries.map(r=>l.join(a,"merge-receipts",`${r.receipt_id}.json`))])].map(r=>l.relative(o,r).replaceAll("\\","/"));if(s.some(g))throw c("reconciliation artifacts must belong to this Git workspace");let n=await y(o,s);if(n.length>0)throw new f(`Automatic merge settlement refused: required artifacts are ignored by Git: ${n.map(r=>`${r.path} (${r.source}:${r.line}: ${r.pattern})`).join(", ")}. Remove or narrow the owning ignore rules because merge receipts must travel with the commit.`,d.CONFLICT,{code:"merge_settlement_review_required",reason:"ignored_merge_artifacts",paths:n.map(r=>r.path),nextSteps:["Remove or narrow the named ignore rules, preserve receipt and history files, then retry pm merge reconcile --stage --dry-run before applying pm merge reconcile --stage. Do not force-add ignored proof as a substitute for fixing the shared policy."]});let p=s.map(r=>`:(literal)${r}`),m=t.receipts.summaries.map(r=>l.relative(o,l.join(a,"merge-receipts",`${r.receipt_id}.json`)).replaceAll("\\","/"));if(p.length>0)try{await i(["diff","--quiet","--",...p])}catch{throw c("reconciliation paths have unstaged edits or Git cannot verify their index state")}let v=await I(i,m);return e.dryRun?{...t,staged_paths:[]}:G({...e,git:i,paths:s,newReceiptPathspecs:v})}export{S as resolveMergeSettlementGlobal,F as stageLosslessMergeReconciliation};
2
+ //# sourceMappingURL=stage-57KH3KAC.js.map
@@ -1,3 +1,3 @@
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]="1c260d1a-70ec-5133-b017-bb0399aea52e")}catch{}})();var b=["commands","renderers","hooks","schema","importers","search","parser","preflight","services"],x=2,v=Object.freeze({migration:"schema",validation:"schema"}),F=Object.freeze({version:2,capabilities:[...b],legacy_aliases:{...v}}),M=["off","warn","enforce"],P=["off","warn","enforce"],U=["none","restricted","strict"],Y=["block","warn"],q=["commands.override","commands.handler","hooks.beforecommand","hooks.beforemutation","hooks.aftercommand","hooks.onwrite","hooks.onread","hooks.onindex","schema.flags","schema.itemfields","schema.itemtypes","schema.relationshipkinds","schema.migrations","schema.profiles","parser.override","preflight.override","services.override","renderers.override","importers.importer","importers.exporter","search.provider","search.vectorstore","services.assuranceprovider"],W=["output_format","error_format","help_format","lock_acquire","lock_release","history_append","item_store_write","item_store_delete","context_relevance","command_result"];function m(){return{mode:"off",trust_mode:"off",require_provenance:!1,trusted_extensions:[],default_sandbox_profile:"none",allowed_extensions:[],blocked_extensions:[],allowed_capabilities:[],blocked_capabilities:[],allowed_surfaces:[],blocked_surfaces:[],allowed_commands:[],blocked_commands:[],allowed_actions:[],blocked_actions:[],allowed_services:[],blocked_services:[],extension_overrides:[]}}(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]="58db2e8f-05e5-5ffc-a8dd-a73966142f47")}catch{}})();var E=["goal","objective","value","impact","outcome","why_now","parent","reviewer","risk","confidence","sprint","release","blocked_by","blocked_reason","unblock_note","reporter","severity","environment","repro_steps","resolution","expected_result","actual_result"],T=["id","title","description","type","pm_format_version","source_type","type_options","status","priority","tags","created_at","updated_at","deadline","reminders","events","closed_at","completed_at","assignee","claim_principal","source_owner","author","estimated_minutes","acceptance_criteria","deferred_fields","design","external_ref","definition_of_ready","order",...E,"affected_version","fixed_version","component","regression","customer_impact","dependencies","comments","notes","learnings","files","tests","test_runs","docs","close_reason","duplicate_of","plan_mode","plan_scope","plan_harness","plan_resume_context","plan_validation","plan_decisions","plan_discoveries","plan_steps"],k=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]="426ae308-83c5-5c99-bb0d-c63e9c890570")}catch{}})();var I=Object.freeze([{id:"draft",roles:["draft"]},{id:"open",roles:["active","default_open"]},{id:"in_progress",aliases:["in-progress"],roles:["active"]},{id:"blocked",roles:["blocked"]},{id:"closed",roles:["terminal","terminal_done","default_close"]},{id:"canceled",aliases:["cancelled"],roles:["terminal","terminal_canceled","default_cancel"]}]),O=Object.freeze({draft_status:"draft",open_status:"open",in_progress_status:"in_progress",blocked_status:"blocked",close_status:"closed",canceled_status:"canceled"}),G=".agents/pm",z="settings.json";var N=["","epics","features","tasks","chores","issues","schema","history","search","extensions","locks"],A=["decisions","events","reminders","milestones","meetings","plans"],$=[...N,...A],V={Epic:"epics",Feature:"features",Task:"tasks",Chore:"chores",Issue:"issues",Decision:"decisions",Event:"events",Reminder:"reminders",Milestone:"milestones",Meeting:"meetings",Plan:"plans"},D={minimal:{ownership_enforcement:"none",create_mode_default:"progressive",close_validation_default:"off",require_close_reason:!0,parent_reference:"strict_error",metadata_profile:"core",force_required_for_stale_lock:!1,duplicate_detection_mode:"off",duplicate_detection_threshold:.8,duplicate_detection_limit:3},default:{ownership_enforcement:"warn",create_mode_default:"progressive",close_validation_default:"warn",require_close_reason:!0,parent_reference:"strict_error",metadata_profile:"core",force_required_for_stale_lock:!0,duplicate_detection_mode:"strict",duplicate_detection_threshold:.8,duplicate_detection_limit:3},strict:{ownership_enforcement:"strict",create_mode_default:"strict",close_validation_default:"strict",require_close_reason:!0,parent_reference:"strict_error",metadata_profile:"strict",force_required_for_stale_lock:!0,duplicate_detection_mode:"strict",duplicate_detection_threshold:.8,duplicate_detection_limit:3}},S=["no active blocker","ready for planned execution sequencing","work completed","work is closed"],f={blocked_reason:["no active blocker because work is closed","work is closed"],resolution:["closed with implementation evidence","closed with verification evidence","work completed and recorded","work is closed"],actual_result:["closed and recorded","work completed","work completed and recorded"]};function h(e){return e?[...e]:void 0}var J={version:1,id_prefix:"pm-",ids:{token_length:4},author_default:"",agent_identity:{probes_enabled:!0,identity_vocabulary:{version:1,aliases:{}},harness_signals:[]},mutation_guard:{require_attributed_author:!1,secret_guard:"advise",stale_in_progress_hours:72},item_format:"toon",locks:{ttl_seconds:1800,wait_ms:3e3},checkpoints:{retention_days:14},output:{default_format:"toon"},ux:{deprecation_hints:!0},history:{missing_stream:"auto_create",compact_policy:{enabled:!1,max_entries:500,trigger:"health_warn"}},validation:{sprint_release_format:"warn",parent_reference:"warn",metadata_profile:"core",metadata_required_fields:[],lifecycle_stale_blocker_reason_patterns:[...S],lifecycle_closure_like_blocked_reason_patterns:[...f.blocked_reason],lifecycle_closure_like_resolution_patterns:[...f.resolution],lifecycle_closure_like_actual_result_patterns:[...f.actual_result],estimate_defaults_by_type:{}},governance:{preset:"minimal",...D.minimal},workflow:{definition_of_done:[]},testing:{record_results_to_items:!1,allow_untrusted_linked_tests:!1},telemetry:{enabled:!0,first_run_prompt_completed:!1,capture_level:"redacted",endpoint:"https://pm-cli.unbrained.dev/v1/events",installation_id:"",retention_days:365},agent_guidance:{prompt_completed:!1,declined:!1,declined_at:"",template_version:1,last_checked_files:[]},item_types:{definitions:[]},schema:{version:1,files:{types:"schema/types.json",statuses:"schema/statuses.json",fields:"schema/fields.json",workflows:"schema/workflows.json"},statuses:I.map(e=>({...e,aliases:h(e.aliases),roles:h(e.roles)})),fields:[],workflow:{...O},unknown_field_policy:"allow"},extensions:{enabled:[],disabled:[],policy:m()},search:{score_threshold:0,hybrid_semantic_weight:.7,max_results:50,embedding_model:"",embedding_batch_size:32,embedding_timeout_ms:3e4,scanner_max_batch_retries:3,provider:"",default_mode:"auto",mutation_refresh_policy:"semantic_configured",query_expansion:{enabled:!1,provider:""},rerank:{enabled:!1,model:"",top_k:20}},providers:{openai:{base_url:"",api_key:"",model:""},ollama:{base_url:"",model:""}},context:{default_depth:"brief",activity_limit:10,stale_threshold_days:7,next_ranking_policy:"priority_floor",sections:{hierarchy:!0,activity:!0,progress:!0,recently_created:!0,unparented:!0,blockers:!0,files:!0,workload:!0,staleness:!0,tests:!0}},vector_store:{adapter:"",collection_name:"pm_items",qdrant:{url:"",api_key:""},lancedb:{path:""}}},Q={metadata:{},body:""},y={SUCCESS:0,GENERIC_FAILURE:1,USAGE:2,NOT_FOUND:3,CONFLICT:4,DEPENDENCY_FAILED:5,NO_EFFECT:6,PARTIAL_EFFECT:7},Z=Object.freeze({unknown_command:"usage",unknown_option:"usage",missing_required_option:"usage",missing_required_argument:"usage",invalid_command_usage:"usage",linked_test_value_not_quoted:"usage",invalid_argument_value:"validation",health_findings:"validation",validation_findings:"validation",close_through_update:"validation",no_update_fields:"validation",unsupported_update_option:"validation",tracker_not_initialized:"validation",item_not_found:"validation",ownership_conflict:"conflict",lock_conflict:"conflict",terminal_state_conflict:"conflict",dependency_failed:"runtime",init_gitignore_unwritable:"runtime",merge_git_config_unwritable:"runtime",command_failed:"runtime",unknown_error:"runtime"});(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]="b53d44a2-e6b5-566e-b6d6-c530b78646e2")}catch{}})();var u=class extends Error{exitCode;code;context;constructor(t,i,o={}){super(t),this.name="PmCliError",this.exitCode=i,this.context=o,this.code=o.code}};import*as r from"node:fs/promises";import{constants as p}from"node:fs";import c from"node:path";import R from"node:crypto";(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]="3792f1fd-ed9d-5252-887d-e4517a55fb9c")}catch{}})();var C=[10,25,50,100];async function w(e){await r.mkdir(e,{recursive:!0})}async function ne(e){try{return await r.access(e),!0}catch{return!1}}function g(e){return L(e)||l(e,"ENOTDIR")}function L(e){return l(e,"ENOENT")}async function ae(e){try{return await r.readFile(e,"utf8")}catch(t){if(g(t))return null;throw t}}async function le(e,t){let i=await r.open(e,p.O_RDONLY|p.O_NOFOLLOW|p.O_NONBLOCK);try{if(!(await i.stat()).isFile())throw t;return await i.readFile("utf8")}finally{await i.close()}}function ce(e){let t=e?.replaceAll(c.sep,"/"),i=t!==void 0&&!c.posix.isAbsolute(t)&&!c.win32.isAbsolute(t)&&!t.split("/").includes(".."),o=i?t.split("/")[0]:void 0,s={"settings.json":"settings",runtime:"runtime",schema:"schema",history:"history",transactions:"transactions"},n=o===void 0?"tracker_storage":Object.hasOwn(s,o)?s[o]:"tracker_storage",d=i&&t.length>0&&t.length<=160&&t.split("/").every(a=>a!=="."&&/^[a-zA-Z0-9_.-]+$/u.test(a)),_=d?t:`${n} (entry name redacted)`;return new u(`Transaction preview requires regular files and directories. Inspect ${_} relative to the selected tracker root.`,y.USAGE,{code:"transaction_preview_non_regular_file",preview_storage:{storage_area:n,...d?{relative_entry:t}:{},entry_redacted:!d},required:"regular files and directories within the configured tracker storage",why:"Preview does not follow linked entries or read special files.",nextSteps:[`Inspect ${_} within the selected tracker for links, directories used as files, or special files; do not follow link targets.`,"Restore the intended regular files and directories, then retry the original dry-run command."]})}async function de(e,t,i={}){let o=c.dirname(e);i.createParentDirectories!==!1&&await w(o);let s=c.join(o,`.${c.basename(e)}.${process.pid}.${Date.now()}.${R.randomBytes(4).toString("hex")}.tmp`);await r.writeFile(s,t,"utf8");try{await r.rename(s,e)}catch(n){if(process.platform==="win32"&&(l(n,"EPERM")||l(n,"EBUSY"))){let d=n;for(let _ of C){await new Promise(a=>setTimeout(a,_));try{await r.rename(s,e);return}catch(a){if(d=a,!l(a,"EPERM")&&!l(a,"EBUSY"))break}}try{await r.unlink(s)}catch{}throw d}if(l(n,"EXDEV")){try{await r.copyFile(s,e)}finally{try{await r.unlink(s)}catch{}}return}try{await r.unlink(s)}catch{}throw n}}async function _e(e,t){let i=c.dirname(e);await w(i);let o=await r.open(e,"a");try{await o.writeFile(`${t}
2
- `,"utf8")}finally{await o.close()}}async function ue(e){try{await r.unlink(e)}catch(t){if(!g(t))throw t}}function l(e,t){return typeof e=="object"&&e!==null&&"code"in e&&e.code===t}export{b as a,x as b,v as c,F as d,M as e,P as f,U as g,Y as h,q as i,W as j,m as k,E as l,k as m,I as n,O as o,G as p,z as q,N as r,$ as s,V as t,D as u,S as v,f as w,J as x,Q as y,y as z,u as A,w as B,ne as C,g as D,L as E,ae as F,le as G,ce as H,de as I,_e as J,ue as K};
3
- //# sourceMappingURL=chunk-IXYBN6D2.js.map
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]="1c260d1a-70ec-5133-b017-bb0399aea52e")}catch{}})();var v=["commands","renderers","hooks","schema","importers","search","parser","preflight","services"],F=2,T=Object.freeze({migration:"schema",validation:"schema"}),M=Object.freeze({version:2,capabilities:[...v],legacy_aliases:{...T}}),P=["off","warn","enforce"],U=["off","warn","enforce"],Y=["none","restricted","strict"],q=["block","warn"],W=["commands.override","commands.handler","hooks.beforecommand","hooks.beforemutation","hooks.aftercommand","hooks.onwrite","hooks.onread","hooks.onindex","schema.flags","schema.itemfields","schema.itemtypes","schema.relationshipkinds","schema.migrations","schema.profiles","parser.override","preflight.override","services.override","renderers.override","importers.importer","importers.exporter","search.provider","search.vectorstore","services.assuranceprovider"],X=["output_format","error_format","help_format","lock_acquire","lock_release","history_append","item_store_write","item_store_delete","context_relevance","command_result"];function E(){return{mode:"off",trust_mode:"off",require_provenance:!1,trusted_extensions:[],default_sandbox_profile:"none",allowed_extensions:[],blocked_extensions:[],allowed_capabilities:[],blocked_capabilities:[],allowed_surfaces:[],blocked_surfaces:[],allowed_commands:[],blocked_commands:[],allowed_actions:[],blocked_actions:[],allowed_services:[],blocked_services:[],extension_overrides:[]}}(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]="58db2e8f-05e5-5ffc-a8dd-a73966142f47")}catch{}})();var h=["goal","objective","value","impact","outcome","why_now","parent","reviewer","risk","confidence","sprint","release","blocked_by","blocked_reason","unblock_note","reporter","severity","environment","repro_steps","resolution","expected_result","actual_result"],k=["id","title","description","type","pm_format_version","source_type","type_options","status","priority","tags","created_at","updated_at","deadline","reminders","events","closed_at","completed_at","assignee","claim_principal","source_owner","author","estimated_minutes","acceptance_criteria","deferred_fields","design","external_ref","definition_of_ready","order",...h,"affected_version","fixed_version","component","regression","customer_impact","dependencies","comments","notes","learnings","files","tests","test_runs","docs","close_reason","duplicate_of","plan_mode","plan_scope","plan_harness","plan_resume_context","plan_validation","plan_decisions","plan_discoveries","plan_steps"],I=k;(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]="426ae308-83c5-5c99-bb0d-c63e9c890570")}catch{}})();var O=Object.freeze([{id:"draft",roles:["draft"]},{id:"open",roles:["active","default_open"]},{id:"in_progress",aliases:["in-progress"],roles:["active"]},{id:"blocked",roles:["blocked"]},{id:"closed",roles:["terminal","terminal_done","default_close"]},{id:"canceled",aliases:["cancelled"],roles:["terminal","terminal_canceled","default_cancel"]}]),N=Object.freeze({draft_status:"draft",open_status:"open",in_progress_status:"in_progress",blocked_status:"blocked",close_status:"closed",canceled_status:"canceled"}),z=".agents/pm",$="settings.json";var A=["","epics","features","tasks","chores","issues","schema","history","search","extensions","locks"],D=["decisions","events","reminders","milestones","meetings","plans"],V=[...A,...D],Q={Epic:"epics",Feature:"features",Task:"tasks",Chore:"chores",Issue:"issues",Decision:"decisions",Event:"events",Reminder:"reminders",Milestone:"milestones",Meeting:"meetings",Plan:"plans"},S={minimal:{ownership_enforcement:"none",create_mode_default:"progressive",close_validation_default:"off",require_close_reason:!0,parent_reference:"strict_error",metadata_profile:"core",force_required_for_stale_lock:!1,duplicate_detection_mode:"off",duplicate_detection_threshold:.8,duplicate_detection_limit:3},default:{ownership_enforcement:"warn",create_mode_default:"progressive",close_validation_default:"warn",require_close_reason:!0,parent_reference:"strict_error",metadata_profile:"core",force_required_for_stale_lock:!0,duplicate_detection_mode:"strict",duplicate_detection_threshold:.8,duplicate_detection_limit:3},strict:{ownership_enforcement:"strict",create_mode_default:"strict",close_validation_default:"strict",require_close_reason:!0,parent_reference:"strict_error",metadata_profile:"strict",force_required_for_stale_lock:!0,duplicate_detection_mode:"strict",duplicate_detection_threshold:.8,duplicate_detection_limit:3}},R=["no active blocker","ready for planned execution sequencing","work completed","work is closed"],p={blocked_reason:["no active blocker because work is closed","work is closed"],resolution:["closed with implementation evidence","closed with verification evidence","work completed and recorded","work is closed"],actual_result:["closed and recorded","work completed","work completed and recorded"]};function w(e){return e?[...e]:void 0}var J={version:1,id_prefix:"pm-",ids:{token_length:4},author_default:"",agent_identity:{probes_enabled:!0,identity_vocabulary:{version:1,aliases:{}},harness_signals:[]},mutation_guard:{require_attributed_author:!1,secret_guard:"advise",stale_in_progress_hours:72},item_format:"toon",locks:{ttl_seconds:1800,wait_ms:3e3},checkpoints:{retention_days:14},output:{default_format:"toon"},ux:{deprecation_hints:!0},history:{missing_stream:"auto_create",compact_policy:{enabled:!1,max_entries:500,trigger:"health_warn"}},validation:{sprint_release_format:"warn",parent_reference:"warn",metadata_profile:"core",metadata_required_fields:[],lifecycle_stale_blocker_reason_patterns:[...R],lifecycle_closure_like_blocked_reason_patterns:[...p.blocked_reason],lifecycle_closure_like_resolution_patterns:[...p.resolution],lifecycle_closure_like_actual_result_patterns:[...p.actual_result],estimate_defaults_by_type:{}},governance:{preset:"minimal",...S.minimal},workflow:{definition_of_done:[]},testing:{record_results_to_items:!1,allow_untrusted_linked_tests:!1},telemetry:{enabled:!0,first_run_prompt_completed:!1,capture_level:"redacted",endpoint:"https://pm-cli.unbrained.dev/v1/events",installation_id:"",retention_days:365},agent_guidance:{prompt_completed:!1,declined:!1,declined_at:"",template_version:1,last_checked_files:[]},item_types:{definitions:[]},schema:{version:1,files:{types:"schema/types.json",statuses:"schema/statuses.json",fields:"schema/fields.json",workflows:"schema/workflows.json"},statuses:O.map(e=>({...e,aliases:w(e.aliases),roles:w(e.roles)})),fields:[],workflow:{...N},unknown_field_policy:"allow"},extensions:{enabled:[],disabled:[],policy:E()},search:{score_threshold:0,hybrid_semantic_weight:.7,max_results:50,embedding_model:"",embedding_batch_size:32,embedding_timeout_ms:3e4,scanner_max_batch_retries:3,provider:"",default_mode:"auto",mutation_refresh_policy:"semantic_configured",query_expansion:{enabled:!1,provider:""},rerank:{enabled:!1,model:"",top_k:20}},providers:{openai:{base_url:"",api_key:"",model:""},ollama:{base_url:"",model:""}},context:{default_depth:"brief",activity_limit:10,stale_threshold_days:7,next_ranking_policy:"priority_floor",sections:{hierarchy:!0,activity:!0,progress:!0,recently_created:!0,unparented:!0,blockers:!0,files:!0,workload:!0,staleness:!0,tests:!0}},vector_store:{adapter:"",collection_name:"pm_items",qdrant:{url:"",api_key:""},lancedb:{path:""}}},Z={metadata:{},body:""},y={SUCCESS:0,GENERIC_FAILURE:1,USAGE:2,NOT_FOUND:3,CONFLICT:4,DEPENDENCY_FAILED:5,NO_EFFECT:6,PARTIAL_EFFECT:7},H=Object.freeze({unknown_command:"usage",unknown_option:"usage",missing_required_option:"usage",missing_required_argument:"usage",invalid_command_usage:"usage",linked_test_value_not_quoted:"usage",invalid_argument_value:"validation",health_findings:"validation",validation_findings:"validation",close_through_update:"validation",no_update_fields:"validation",unsupported_update_option:"validation",tracker_not_initialized:"validation",item_not_found:"validation",ownership_conflict:"conflict",lock_conflict:"conflict",terminal_state_conflict:"conflict",dependency_failed:"runtime",init_gitignore_unwritable:"runtime",merge_git_config_unwritable:"runtime",command_failed:"runtime",unknown_error:"runtime"});(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]="745f8a29-e1f9-574c-bf67-70f564b0415b")}catch{}})();var f=class extends Error{exitCode;code;context;constructor(t,r,i={}){super(t),this.name="PmCliError",this.exitCode=r,this.context=i,this.code=i.code}};import*as o from"node:fs/promises";import{constants as m}from"node:fs";import c from"node:path";import C from"node:crypto";(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]="af07b34f-9e45-561f-aa8c-2415ee4a46b9")}catch{}})();var L=[10,25,50,100];async function g(e){await o.mkdir(e,{recursive:!0})}async function ae(e){try{return await o.access(e),!0}catch{return!1}}function b(e){return x(e)||l(e,"ENOTDIR")}function x(e){return l(e,"ENOENT")}async function le(e){try{return await o.readFile(e,"utf8")}catch(t){if(b(t))return null;throw t}}async function ce(e,t){let r=await o.open(e,m.O_RDONLY|m.O_NOFOLLOW|m.O_NONBLOCK);try{if(!(await r.stat()).isFile())throw t;return await r.readFile("utf8")}finally{await r.close()}}function de(e){let t=e?.replaceAll(c.sep,"/"),r=t!==void 0&&!c.posix.isAbsolute(t)&&!c.win32.isAbsolute(t)&&!t.split("/").includes(".."),i=r?t.split("/")[0]:void 0,n={"settings.json":"settings",runtime:"runtime",schema:"schema",history:"history",transactions:"transactions"},s=i===void 0?"tracker_storage":Object.hasOwn(n,i)?n[i]:"tracker_storage",d=r&&t.length>0&&t.length<=160&&t.split("/").every(a=>a!=="."&&/^[a-zA-Z0-9_.-]+$/u.test(a)),_=d?t:`${s} (entry name redacted)`;return new f(`Transaction preview requires regular files and directories. Inspect ${_} relative to the selected tracker root.`,y.USAGE,{code:"transaction_preview_non_regular_file",preview_storage:{storage_area:s,...d?{relative_entry:t}:{},entry_redacted:!d},required:"regular files and directories within the configured tracker storage",why:"Preview does not follow linked entries or read special files.",nextSteps:[`Inspect ${_} within the selected tracker for links, directories used as files, or special files; do not follow link targets.`,"Restore the intended regular files and directories, then retry the original dry-run command."]})}async function u(e){try{await o.unlink(e)}catch{}}async function _e(e,t,r={}){let i=c.dirname(e);r.createParentDirectories!==!1&&await g(i);let n=c.join(i,`.${c.basename(e)}.${process.pid}.${Date.now()}.${C.randomBytes(4).toString("hex")}.tmp`);try{await o.writeFile(n,t,r.mode===void 0?"utf8":{encoding:"utf8",mode:r.mode})}catch(s){throw await u(n),s}try{await o.rename(n,e)}catch(s){if(process.platform==="win32"&&(l(s,"EPERM")||l(s,"EBUSY"))){let d=s;for(let _ of L){await new Promise(a=>setTimeout(a,_));try{await o.rename(n,e);return}catch(a){if(d=a,!l(a,"EPERM")&&!l(a,"EBUSY"))break}}throw await u(n),d}if(l(s,"EXDEV")){try{await o.copyFile(n,e)}finally{await u(n)}return}throw await u(n),s}}async function fe(e,t){let r=c.dirname(e);await g(r);let i=await o.open(e,"a");try{await i.writeFile(`${t}
2
+ `,"utf8")}finally{await i.close()}}async function ue(e){try{await o.unlink(e)}catch(t){if(!b(t))throw t}}function l(e,t){return typeof e=="object"&&e!==null&&"code"in e&&e.code===t}export{v as a,F as b,T as c,M as d,P as e,U as f,Y as g,q as h,W as i,X as j,E as k,h as l,I as m,O as n,N as o,z as p,$ as q,A as r,V as s,Q as t,S as u,R as v,p as w,J as x,Z as y,y as z,f as A,g as B,ae as C,b as D,x as E,le as F,ce as G,de as H,_e as I,fe as J,ue as K};
3
+ //# sourceMappingURL=chunk-3IRCYJI5.js.map
@@ -1,4 +1,4 @@
1
- import{A as u,E as p,z as h}from"./chunk-IXYBN6D2.js";import{readFile as b,realpath as y,stat as _,writeFile as $}from"node:fs/promises";import l from"node:path";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new n.Error().stack;e&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[e]="38df9536-d87a-52ac-958d-091a17c9da9c")}catch{}})();var d="# pm-cli:runtime-cache:start",f="# pm-cli:runtime-cache:end",E=".agents/pm";async function m(n){let e=l.resolve(n),t=[];for(;;)try{let i=await y(e);if(!(await _(i)).isDirectory())throw Object.assign(new Error("Initialization path ancestry must be a directory."),{code:"ENOTDIR"});return l.join(i,...t)}catch(i){if(!p(i)||l.dirname(e)===e)throw i;t.unshift(l.basename(e)),e=l.dirname(e)}}var R=["runtime/","search/","locks/","transactions/","checkpoints/"],T=["search/eval-queries.json"];async function w(n){try{return await n()}catch(e){throw e instanceof Error&&"code"in e&&typeof e.code=="string"&&["EACCES","EPERM","EROFS"].includes(e.code)?new u("The workspace .gitignore is not writable.",h.GENERIC_FAILURE,{code:"init_gitignore_unwritable",reason:e.code.toLowerCase(),required:"Grant the current user read and write access to the workspace .gitignore before initialization.",why:"pm init must publish its managed runtime-cache ignore fence without replacing unrelated entries.",nextSteps:["Grant read and write access to the workspace .gitignore and rerun pm init.","If the workspace is intentionally read-only, initialize pm in a writable workspace or clone."]}):e}}function I(n){let e=n.split(l.sep).join("/").replace(/^\.\/+/,""),t=e.length;for(;t>0&&e[t-1]==="/";)t-=1;return e.slice(0,t)}function k(n){let e=n.replaceAll("\\","/");return l.isAbsolute(n)||e===".."||e.startsWith("../")}function G(n=E){let e=I(n);if(/[\r\n]/u.test(e))throw new u("A tracker path containing a line break cannot be represented safely in .gitignore.",h.USAGE,{code:"invalid_argument_value",required:"a tracker path without line breaks",nextSteps:["Choose a tracker path without carriage returns or newlines and rerun pm init."]});let t=e.replace(/[\\*?[\]#! \t]/gu,"\\$&");return[d,...R.map(i=>i==="search/"?`${t}/${i}*`:`${t}/${i}`),...T.map(i=>`!${t}/${i}`),f].join(`
1
+ import{A as u,E as p,z as h}from"./chunk-3IRCYJI5.js";import{readFile as b,realpath as y,stat as _,writeFile as $}from"node:fs/promises";import l from"node:path";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new n.Error().stack;e&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[e]="38df9536-d87a-52ac-958d-091a17c9da9c")}catch{}})();var d="# pm-cli:runtime-cache:start",f="# pm-cli:runtime-cache:end",E=".agents/pm";async function m(n){let e=l.resolve(n),t=[];for(;;)try{let i=await y(e);if(!(await _(i)).isDirectory())throw Object.assign(new Error("Initialization path ancestry must be a directory."),{code:"ENOTDIR"});return l.join(i,...t)}catch(i){if(!p(i)||l.dirname(e)===e)throw i;t.unshift(l.basename(e)),e=l.dirname(e)}}var R=["runtime/","search/","locks/","transactions/","checkpoints/"],T=["search/eval-queries.json"];async function w(n){try{return await n()}catch(e){throw e instanceof Error&&"code"in e&&typeof e.code=="string"&&["EACCES","EPERM","EROFS"].includes(e.code)?new u("The workspace .gitignore is not writable.",h.GENERIC_FAILURE,{code:"init_gitignore_unwritable",reason:e.code.toLowerCase(),required:"Grant the current user read and write access to the workspace .gitignore before initialization.",why:"pm init must publish its managed runtime-cache ignore fence without replacing unrelated entries.",nextSteps:["Grant read and write access to the workspace .gitignore and rerun pm init.","If the workspace is intentionally read-only, initialize pm in a writable workspace or clone."]}):e}}function I(n){let e=n.split(l.sep).join("/").replace(/^\.\/+/,""),t=e.length;for(;t>0&&e[t-1]==="/";)t-=1;return e.slice(0,t)}function k(n){let e=n.replaceAll("\\","/");return l.isAbsolute(n)||e===".."||e.startsWith("../")}function G(n=E){let e=I(n);if(/[\r\n]/u.test(e))throw new u("A tracker path containing a line break cannot be represented safely in .gitignore.",h.USAGE,{code:"invalid_argument_value",required:"a tracker path without line breaks",nextSteps:["Choose a tracker path without carriage returns or newlines and rerun pm init."]});let t=e.replace(/[\\*?[\]#! \t]/gu,"\\$&");return[d,...R.map(i=>i==="search/"?`${t}/${i}*`:`${t}/${i}`),...T.map(i=>`!${t}/${i}`),f].join(`
2
2
  `)}function O(n,e,t){let i=e.replace(/[\\*?[\]#! \t]/gu,"\\$&"),o=[...new Set([e,i])].flatMap(s=>R.flatMap(c=>[`${s}/${c}`,`!${s}/${c}`])),a=[],r=!1;for(let s of n)o.some(c=>s.startsWith(c))?(r||a.push(...t),r=!0):a.push(s);return r||a.push(...t),a}function P(n){let e=[],t=-1,i=0,o=0;for(let a of n.split(`
3
3
  `)){let r=a.endsWith("\r")?a.slice(0,-1):a;r===d?(t=o,i=o+a.length+1):r===f&&t>=0&&(e.push({index:t,end:o+r.length,lines:n.slice(i,o).split(/\r?\n/u).filter(s=>s.length>0)}),t=-1),o+=a.length+1}return e}function v(n,e){let t=n.includes(`\r
4
4
  `)?`\r
@@ -6,4 +6,4 @@ import{A as u,E as p,z as h}from"./chunk-IXYBN6D2.js";import{readFile as b,realp
6
6
  `,i=G(e).split(`
7
7
  `).slice(1,-1),o=P(n),a=o.flatMap(c=>c.lines),r=[d,...O(a,e,i),f].join(t);if(o.length===0){let c=n.length===0?"":n.endsWith(`
8
8
  `)?t:`${t}${t}`;return`${n}${c}${r}${t}`}let s=n;for(let[c,g]of[...o.entries()].reverse())s=`${s.slice(0,g.index)}${c===0?r:""}${s.slice(g.end)}`;return s}async function S(n,e={}){let t=l.join(n,".gitignore"),i=E;if(e.pmRoot!==void 0){let r=I(l.relative(await m(n),await m(e.pmRoot)));if(k(r))return{path:t,changed:!1};i=r}let o="";try{o=await w(()=>b(t,"utf8"))}catch(r){if(!(r instanceof Error&&"code"in r&&p(r)))throw r}let a=v(o,i);return a===o?{path:t,changed:!1}:(await w(()=>$(t,a,"utf8")),{path:t,changed:!0})}export{R as a,k as b,S as c};
9
- //# sourceMappingURL=chunk-DH4DHL6V.js.map
9
+ //# sourceMappingURL=chunk-3V53UBHN.js.map
@@ -1,2 +1,2 @@
1
- import{S as b,T as B,U as j,V as I,W as G,X as V,Y as M,a as se,ba as F,g as L,i as W,o as R,q as P,s as U}from"./chunk-FPPYE6CY.js";import{E as le,F as ce,H as v,I as de,W as H,fa as Z,o as D,oa as ue,p as X}from"./chunk-N64BUB63.js";import{ja as O}from"./chunk-A2CLYPDA.js";import{A as p,z as f}from"./chunk-IXYBN6D2.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]="202cbe4e-7d36-5b12-be9d-d35608a6b36d")}catch{}})();var Ie=new Set(["none","null"]);function Tt(e={}){return[{optionKey:"dep",clearFlagKey:"clearDeps",valueFlag:"--dep",clearFlag:"--clear-deps",...e.depDisableFlagKey===void 0?{}:{disableFlagKey:e.depDisableFlagKey}},{optionKey:"comment",clearFlagKey:"clearComments",valueFlag:"--comment",clearFlag:"--clear-comments"},{optionKey:"note",clearFlagKey:"clearNotes",valueFlag:"--note",clearFlag:"--clear-notes"},{optionKey:"learning",clearFlagKey:"clearLearnings",valueFlag:"--learning",clearFlag:"--clear-learnings"},{optionKey:"file",clearFlagKey:"clearFiles",valueFlag:"--file",clearFlag:"--clear-files",...e.fileDisableFlagKey===void 0?{}:{disableFlagKey:e.fileDisableFlagKey}},{optionKey:"test",clearFlagKey:"clearTests",valueFlag:"--test",clearFlag:"--clear-tests",...e.testDisableFlagKey===void 0?{}:{disableFlagKey:e.testDisableFlagKey}},{optionKey:"doc",clearFlagKey:"clearDocs",valueFlag:"--doc",clearFlag:"--clear-docs",...e.docDisableFlagKey===void 0?{}:{disableFlagKey:e.docDisableFlagKey}},{optionKey:"reminder",clearFlagKey:"clearReminders",valueFlag:"--reminder",clearFlag:"--clear-reminders"},{optionKey:"event",clearFlagKey:"clearEvents",valueFlag:"--event",clearFlag:"--clear-events"},{optionKey:"typeOption",clearFlagKey:"clearTypeOptions",valueFlag:"--type-option",clearFlag:"--clear-type-options"}]}function N(e){return e===void 0?!1:Ie.has(e.trim().toLowerCase())}function Ct(e,t,r){if(!N(e))return;let n=r?` ${r}`:"";throw new p(`${t} no longer accepts "none" or "null".${n}`.trim(),f.USAGE)}function St(e,t,r){if(!e||e.length===0||X(e)||!e.some(o=>N(o)))return;let n=r?` ${r}`:"";throw new p(`${t} no longer accepts "none" or "null".${n}`.trim(),f.USAGE)}function Rt(e,t){for(let r of t){let n=e[r.optionKey];if(!Array.isArray(n)||n.length===0)continue;if(!n.every(a=>typeof a=="string"))throw new p(`${r.valueFlag} entries must be strings.`,f.USAGE);if(X(n))continue;let o=n;if(o.some(a=>N(a))){if(o.filter(a=>!N(a)).length>0)throw new p(`Cannot mix legacy clear token "none"/"null" with concrete ${r.valueFlag} entries. Use ${r.clearFlag} to clear or provide explicit entries.`,f.USAGE);e[r.optionKey]=void 0,e[r.clearFlagKey]=!0,r.disableFlagKey&&(e[r.disableFlagKey]=!1)}}return e}(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]="5146346c-df7b-5011-9d55-c59a7ff88f29")}catch{}})();var Me=["close_reason","close-reason"],fe=[{canonical:"tags",aliases:["tags"],optionKey:"tags",metadataKey:"tags"}],pe=[{canonical:"deadline",aliases:["deadline"],optionKey:"deadline",metadataKey:"deadline"},{canonical:"estimate",aliases:["estimate","estimated_minutes","estimated-minutes"],optionKey:"estimatedMinutes",metadataKey:"estimated_minutes"},{canonical:"acceptance-criteria",aliases:["acceptance_criteria","acceptance-criteria","ac"],optionKey:"acceptanceCriteria",metadataKey:"acceptance_criteria"},{canonical:"definition-of-ready",aliases:["definition_of_ready","definition-of-ready"],optionKey:"definitionOfReady",metadataKey:"definition_of_ready"},{canonical:"order",aliases:["order","rank"],optionKey:"order",metadataKey:"order"},{canonical:"goal",aliases:["goal"],optionKey:"goal",metadataKey:"goal"},{canonical:"objective",aliases:["objective"],optionKey:"objective",metadataKey:"objective"},{canonical:"value",aliases:["value"],optionKey:"value",metadataKey:"value"},{canonical:"impact",aliases:["impact"],optionKey:"impact",metadataKey:"impact"},{canonical:"outcome",aliases:["outcome"],optionKey:"outcome",metadataKey:"outcome"},{canonical:"why-now",aliases:["why_now","why-now"],optionKey:"whyNow",metadataKey:"why_now"}],Fe=[...fe,...pe],ye=[{canonical:"assignee",aliases:["assignee"],optionKey:"assignee",metadataKey:"assignee"},{canonical:"parent",aliases:["parent"],optionKey:"parent",metadataKey:"parent"},{canonical:"reviewer",aliases:["reviewer"],optionKey:"reviewer",metadataKey:"reviewer"},{canonical:"risk",aliases:["risk"],optionKey:"risk",metadataKey:"risk"},{canonical:"confidence",aliases:["confidence"],optionKey:"confidence",metadataKey:"confidence"},{canonical:"sprint",aliases:["sprint"],optionKey:"sprint",metadataKey:"sprint"},{canonical:"release",aliases:["release"],optionKey:"release",metadataKey:"release"},{canonical:"blocked-by",aliases:["blocked_by","blocked-by"],optionKey:"blockedBy",metadataKey:"blocked_by"},{canonical:"blocked-reason",aliases:["blocked_reason","blocked-reason"],optionKey:"blockedReason",metadataKey:"blocked_reason"},{canonical:"unblock-note",aliases:["unblock_note","unblock-note"],optionKey:"unblockNote",metadataKey:"unblock_note"},{canonical:"reporter",aliases:["reporter"],optionKey:"reporter",metadataKey:"reporter"},{canonical:"severity",aliases:["severity"],optionKey:"severity",metadataKey:"severity"},{canonical:"environment",aliases:["environment"],optionKey:"environment",metadataKey:"environment"},{canonical:"repro-steps",aliases:["repro_steps","repro-steps"],optionKey:"reproSteps",metadataKey:"repro_steps"},{canonical:"resolution",aliases:["resolution"],optionKey:"resolution",metadataKey:"resolution"},{canonical:"expected-result",aliases:["expected_result","expected-result"],optionKey:"expectedResult",metadataKey:"expected_result"},{canonical:"actual-result",aliases:["actual_result","actual-result"],optionKey:"actualResult",metadataKey:"actual_result"},{canonical:"affected-version",aliases:["affected_version","affected-version"],optionKey:"affectedVersion",metadataKey:"affected_version"},{canonical:"fixed-version",aliases:["fixed_version","fixed-version"],optionKey:"fixedVersion",metadataKey:"fixed_version"},{canonical:"component",aliases:["component"],optionKey:"component",metadataKey:"component"},{canonical:"regression",aliases:["regression"],optionKey:"regression",metadataKey:"regression"},{canonical:"customer-impact",aliases:["customer_impact","customer-impact"],optionKey:"customerImpact",metadataKey:"customer_impact"}],ee=[...Fe,{canonical:"author",aliases:["author"],optionKey:"author",metadataKey:"author"},...ye],De=[...fe,{canonical:"close-reason",aliases:Me,optionKey:"closeReason",metadataKey:"close_reason"},...pe,...ye],Ke=new Set(["none","null","-"]);function me(e){return e==="create"?ee:De}function $(e,t){let r=t.unset;if(r!==void 0&&typeof r!="string"&&!Array.isArray(r))return;let n=[];for(let o of me(e))o.optionKey==="author"||!Object.hasOwn(t,o.optionKey)||t[o.optionKey]!==null||(Reflect.deleteProperty(t,o.optionKey),n.push(o.canonical));n.length!==0&&(t.unset=[...r===void 0?[]:typeof r=="string"?[r]:r,...n])}function Q(e){return typeof e=="string"&&Ke.has(e.trim().toLowerCase())}function wt(e,t,r,n){return r?me(e).flatMap(o=>{let a=t[o.optionKey],i=n[o.metadataKey];return Q(a)&&(Q(i)||Array.isArray(i)&&i.some(Q))?[`literal_sentinel_stored:${o.canonical}:${a.trim()}`]:[]}):[]}function xe(e,t){return e.flatMap(r=>r.includes(",")&&t(r)?[r]:r.split(","))}function Le(e){let t=new Set,r=new Set;if(!e.raw||e.raw.length===0)return{metadataKeys:t,optionKeys:r};let n=xe(e.raw,o=>e.resolveDefinition(o.trim().toLowerCase())!==void 0);for(let o of n){let a=o.trim().toLowerCase();if(!a)throw new p("--unset values must not be empty; name each field once, for example --unset parent,release",f.USAGE);if(N(a))throw new p('--unset no longer accepts "none" or "null". Specify concrete field names such as --unset deadline',f.USAGE);let i=e.resolveDefinition(a);if(!i)throw new p(`Unsupported --unset field "${o}". Supported fields: ${e.supportedFields}`,f.USAGE);t.add(i.metadataKey),r.add(i.optionKey)}return{metadataKeys:t,optionKeys:r}}function Pe(e,t,r){let n=e.trim().toLowerCase();if(!r)return;let o=r.command_to_fields?.get(t)??[];for(let a of o){if(a.allow_unset===!1)continue;let i=new Set;if(typeof a.key=="string"&&a.key.length>0&&i.add(a.key.toLowerCase()),typeof a.metadata_key=="string"&&a.metadata_key.length>0&&i.add(a.metadata_key.toLowerCase()),typeof a.cli_flag=="string"&&a.cli_flag.length>0&&(i.add(a.cli_flag.replaceAll("-","_").toLowerCase()),i.add(a.cli_flag.toLowerCase())),Array.isArray(a.cli_aliases))for(let l of a.cli_aliases)typeof l!="string"||l.length===0||(i.add(l.replaceAll("-","_").toLowerCase()),i.add(l.toLowerCase()));if(i.has(n))return{optionKey:a.key,metadataKey:a.metadata_key}}}var Ue=(()=>{let e=new Map;for(let t of ee)for(let r of t.aliases)e.set(r,{optionKey:t.optionKey,metadataKey:t.metadataKey});return e})(),Be=ee.map(e=>e.canonical).sort((e,t)=>e.localeCompare(t)).join(", ");function kt(e,t){return Le({raw:e,supportedFields:Be,resolveDefinition:r=>Ue.get(r)??Pe(r,"create",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]="837a5c2d-6447-5696-b0de-32641cde14cd")}catch{}})();var je={create:'client.create({ type: "Task", title: "Example", createMode: "progressive" })',update:'client.update(id, { estimatedMinutes: "45", force: false })',append:'client.append(id, "Body text")',reopen:'client.reopen(id, "The work recurred", { expectedResult: "Verified recovery" })'};function E(e,t,r){let n=`${e} ${t} must be ${r}.`;throw new p(n,f.USAGE,{code:"invalid_argument_value",reason:"invalid_mutation_option_value",field:t,changed:!1,required:n,examples:[je[e]]})}function K(e,t,r){typeof e!="string"&&E(t,r,"a string")}function te(e,t){(e===null||typeof e!="object"||Array.isArray(e))&&E(t,"options","an object")}function ge(e,t){(e==="append"||e==="update")&&t.id!==void 0&&K(t.id,e,"id"),e==="item-reopen"&&(t.id!==void 0&&K(t.id,"reopen","id"),t.reason!==void 0&&K(t.reason,"reopen","reason"),t.options!==void 0&&Ge(t.options))}function Gt(e){te(e,"append");for(let t of["body","author","message"])e[t]!==void 0&&K(e[t],"append",t);e.force!==void 0&&typeof e.force!="boolean"&&E("append","force","a boolean")}function Ge(e){te(e,"reopen");for(let t of F["item-reopen"].optional){let r=e[t];r!==void 0&&(O(Reflect.get(b,t)).type==="boolean"?typeof r!="boolean"&&E("reopen",t,"a boolean"):K(r,"reopen",t))}}function Ve(e,t){return e?t?"a string or string array":"a string array":"a string"}function He(e,t,r,n,o,a){r===void 0||typeof r=="string"&&(!o||a)||n==="priority"&&typeof r=="number"&&Number.isFinite(r)||o&&Array.isArray(r)&&Array.from(r).every(i=>typeof i=="string")||E(e,t,Ve(o,a))}function $e(e,t,r){let n=e==="create"?P:U;for(let{param:o}of[...n,...R,{param:"force"}]){if(O(Reflect.get(b,o)).type!=="boolean")continue;let a=r.find(i=>i.keys.includes(o))?.keys??[o];for(let i of a)t[i]!==void 0&&typeof t[i]!="boolean"&&E(e,i,"a boolean")}}function re(e,t,r=!0,n=!1){let o=e==="create"?B:G;for(let{target:a,keys:i,repeatable:l}of o)if(O(Reflect.get(b,a)).type!=="boolean")for(let y of i){let S=n&&y!==a,h=l===!0&&(a!=="acceptanceCriteria"||S);He(e,y,t[y],a,h,r||S)}$e(e,t,o)}function Vt(e,t){te(t,e);let r=le(t),n=D(r);return n||$(e,r),re(e,r,!1,n),r}import{Option as ur}from"commander";(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]="96013340-cb63-5e96-a1b0-b810100ab080")}catch{}})();function A(e,t,r){if(typeof r!="string")return;let n=r.trim();n.length!==0&&e.push(t,n)}function m(e,t,r){r===!0&&e.push(t)}function T(e,t,r){if(Array.isArray(r))for(let n of r){if(typeof n!="string")continue;let o=n.trim();o.length!==0&&e.push(t,o)}}function ze(e,t){let r=["test",e,"--run","--json","--progress"];return T(r,"--add",t.add),T(r,"--add-json",t.addJson),T(r,"--remove",t.remove),T(r,"--remove-index",Array.isArray(t.removeIndex)?t.removeIndex.map(n=>typeof n=="number"?String(n):n):t.removeIndex),A(r,"--match",t.match),A(r,"--only-index",typeof t.onlyIndex=="number"?String(t.onlyIndex):t.onlyIndex),m(r,"--only-last",t.onlyLast),m(r,"--full-history",t.fullHistory),T(r,"--measure",t.measure),A(r,"--metric-below",t.metricBelow),A(r,"--metric-diff",t.metricDiff),qe(r,t),A(r,"--author",t.author),A(r,"--message",t.message),m(r,"--force",t.force),r}function qe(e,t){A(e,"--timeout",t.timeout),T(e,"--env-set",t.envSet),T(e,"--env-clear",t.envClear),m(e,"--shared-host-safe",t.sharedHostSafe),A(e,"--pm-context",t.pmContext),m(e,"--override-linked-pm-context",t.overrideLinkedPmContext),A(e,"--workspace-context",t.workspaceContext),m(e,"--override-linked-workspace-context",t.overrideLinkedWorkspaceContext),m(e,"--allow-untrusted-linked-tests",t.allowUntrustedLinkedTests),m(e,"--fail-on-context-mismatch",t.failOnContextMismatch),m(e,"--fail-on-skipped",t.failOnSkipped),m(e,"--fail-on-empty-test-run",t.failOnEmptyTestRun),m(e,"--require-assertions-for-pm",t.requireAssertionsForPm),m(e,"--check-context",t.checkContext),m(e,"--full-output",t.fullOutput),m(e,"--auto-pm-context",t.autoPmContext)}(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]="e9ccd0e6-fb99-5650-b819-ee03bf99a863")}catch{}})();function he(e,t){let r=[],n=new Set;for(let o of t.keys){if(!Object.hasOwn(e,o))continue;let a=e[o];if(a!=null){if(typeof a=="string"){r.push(a);continue}if(!Array.isArray(a)||!a.every(i=>typeof i=="string"))return;n.has(a)||(n.add(a),r.push(...a))}}return r.length>0?r.join("; "):void 0}function C(e,t){return e.find(r=>r.target===t)??{target:t,keys:[t]}}function s(e,t){return e[t]===!0?!0:void 0}function _(e,t){return e[t]===!1?!0:void 0}function z(e,t){return t.some(r=>e[r]===!0)?!0:void 0}function ne(e,t){for(let[r,n]of Object.entries(t))r==="__proto__"||r==="constructor"||r==="prototype"||Object.hasOwn(e,r)||(e[r]=n)}function Ae(e,t={}){let r=i=>L(e,C(j,i)),n=i=>W(e,C(I,i)),o=r("type");if(t.requireType!==!1&&o===void 0)throw new p("Missing required option --type <value>. Why required: create resolves runtime schema fields/workflow from item type. Retry: add --type <built-in or configured custom type> (example: --type Task).",f.USAGE);let a={title:r("title"),description:r("description"),type:o,template:r("template"),createMode:r("createMode"),defer:n("defer"),deferReason:r("deferReason"),schedulePreset:r("schedulePreset"),status:r("status"),closeReason:r("closeReason"),completedAt:r("completedAt"),priority:r("priority"),tags:r("tags"),addTags:n("addTags"),body:r("body"),deadline:r("deadline"),estimatedMinutes:r("estimatedMinutes"),acceptanceCriteria:he(e,C(I,"acceptanceCriteria")),definitionOfReady:r("definitionOfReady"),order:r("order"),rank:r("rank"),goal:r("goal"),objective:r("objective"),value:r("value"),impact:r("impact"),outcome:r("outcome"),whyNow:r("whyNow"),author:r("author"),message:r("message"),assignee:r("assignee"),parent:r("parent"),inheritFocus:e.inheritFocus,allowMissingParent:z(e,["allowMissingParent","allow_missing_parent"])===!0,allowUnresolvedDeps:z(e,["allowUnresolvedDeps","allow_unresolved_deps"])===!0,allowDuplicate:s(e,"allowDuplicate")===!0,reviewer:r("reviewer"),risk:r("risk"),confidence:r("confidence"),sprint:r("sprint"),release:r("release"),blockedBy:r("blockedBy"),blockedReason:r("blockedReason"),unblockNote:r("unblockNote"),reporter:r("reporter"),severity:r("severity"),environment:r("environment"),reproSteps:r("reproSteps"),resolution:r("resolution"),expectedResult:r("expectedResult"),actualResult:r("actualResult"),affectedVersion:r("affectedVersion"),fixedVersion:r("fixedVersion"),component:r("component"),regression:e.regression===!0?"true":r("regression"),customerImpact:r("customerImpact"),dep:n("dep"),comment:n("comment"),note:n("note"),learning:n("learning"),file:n("file"),test:n("test"),doc:n("doc"),reminder:n("reminder"),event:n("event"),typeOption:n("typeOption"),field:n("field"),unset:n("unset"),clearDeps:s(e,"clearDeps"),clearComments:s(e,"clearComments"),clearNotes:s(e,"clearNotes"),clearLearnings:s(e,"clearLearnings"),clearFiles:s(e,"clearFiles"),clearTests:s(e,"clearTests"),clearDocs:s(e,"clearDocs"),clearReminders:s(e,"clearReminders"),clearEvents:s(e,"clearEvents"),clearTypeOptions:s(e,"clearTypeOptions")};return ne(a,e),v(e,a)}function _e(e){let t=o=>L(e,C(V,o)),r=o=>W(e,C(M,o)),n={title:t("title"),description:t("description"),body:t("body"),status:t("status"),closeReason:t("closeReason"),priority:t("priority"),type:t("type"),tags:t("tags"),addTags:r("addTags"),removeTags:r("removeTags"),deadline:t("deadline"),estimatedMinutes:t("estimatedMinutes"),acceptanceCriteria:he(e,C(M,"acceptanceCriteria")),addAc:r("addAc"),removeAc:r("removeAc"),definitionOfReady:t("definitionOfReady"),order:t("order"),rank:t("rank"),goal:t("goal"),objective:t("objective"),value:t("value"),impact:t("impact"),outcome:t("outcome"),whyNow:t("whyNow"),author:t("author"),message:t("message"),force:!!e.force,ownershipMetadataBypass:e.ownershipMetadataBypass===!0?!0:void 0,ownershipDependencyBypass:e.ownershipDependencyBypass===!0?!0:void 0,assignee:t("assignee"),parent:t("parent"),allowUnresolvedDeps:z(e,["allowUnresolvedDeps","allow_unresolved_deps"])===!0,reviewer:t("reviewer"),risk:t("risk"),confidence:t("confidence"),sprint:t("sprint"),release:t("release"),blockedBy:t("blockedBy"),blockedReason:t("blockedReason"),unblockNote:t("unblockNote"),reporter:t("reporter"),severity:t("severity"),environment:t("environment"),reproSteps:t("reproSteps"),resolution:t("resolution"),expectedResult:t("expectedResult"),actualResult:t("actualResult"),affectedVersion:t("affectedVersion"),fixedVersion:t("fixedVersion"),component:t("component"),regression:e.regression===!0?"true":t("regression"),customerImpact:t("customerImpact"),dep:r("dep"),depRemove:r("depRemove"),replaceDeps:s(e,"replaceDeps"),replaceTests:s(e,"replaceTests"),replaceFiles:s(e,"replaceFiles"),replaceDocs:s(e,"replaceDocs"),comment:r("comment"),note:r("note"),learning:r("learning"),file:r("file"),test:r("test"),doc:r("doc"),reminder:r("reminder"),event:r("event"),typeOption:r("typeOption"),field:r("field"),unset:r("unset"),clearDeps:s(e,"clearDeps"),clearComments:s(e,"clearComments"),clearNotes:s(e,"clearNotes"),clearLearnings:s(e,"clearLearnings"),clearFiles:s(e,"clearFiles"),clearTests:s(e,"clearTests"),clearDocs:s(e,"clearDocs"),clearReminders:s(e,"clearReminders"),clearEvents:s(e,"clearEvents"),clearTypeOptions:s(e,"clearTypeOptions")};return ne(n,e),v(e,n)}function d(e,t){let r=C(se,t),n=L(e,r);if(n!==void 0)return n;for(let o of r.keys){let a=e[o];if(Array.isArray(a)){let i=a.filter(l=>typeof l=="string");if(i.length>0)return i.join(",")}if(t==="ids"&&typeof a=="string")return a;if(typeof a=="number"&&Number.isFinite(a))return String(a)}}function Ye(e){let t=s(e,"filterFilesMissing"),r=s(e,"filterDocsMissing");return{filterReviewerMissing:s(e,"filterReviewerMissing"),filterRiskMissing:s(e,"filterRiskMissing"),filterConfidenceMissing:s(e,"filterConfidenceMissing"),filterSprintMissing:s(e,"filterSprintMissing"),filterReleaseMissing:s(e,"filterReleaseMissing"),hasNotes:s(e,"hasNotes"),hasLearnings:s(e,"hasLearnings"),hasFiles:s(e,"hasFiles"),hasDocs:s(e,"hasDocs"),hasTests:s(e,"hasTests"),hasComments:s(e,"hasComments"),hasDeps:s(e,"hasDeps"),hasBody:s(e,"hasBody"),hasLinkedCommand:s(e,"hasLinkedCommand"),noNotes:_(e,"notes"),noLearnings:_(e,"learnings"),noFiles:_(e,"files")??t,filterFilesMissing:t,noDocs:_(e,"docs")??r,filterDocsMissing:r,noTests:_(e,"tests"),noComments:_(e,"comments"),noDeps:_(e,"deps"),emptyBody:s(e,"emptyBody"),noLinkedCommand:_(e,"linkedCommand")}}function ve(e){let t={status:d(e,"status"),type:d(e,"type"),tag:d(e,"tag"),priority:d(e,"priority"),deadlineBefore:d(e,"deadlineBefore"),deadlineAfter:d(e,"deadlineAfter"),updatedAfter:d(e,"updatedAfter"),updatedBefore:d(e,"updatedBefore"),createdAfter:d(e,"createdAfter"),createdBefore:d(e,"createdBefore"),today:s(e,"today"),recent:s(e,"recent"),ids:d(e,"ids"),assignee:d(e,"assignee"),assigneeFilter:d(e,"assigneeFilter"),parent:d(e,"parent"),sprint:d(e,"sprint"),release:d(e,"release"),limit:d(e,"limit"),offset:d(e,"offset"),noTruncate:_(e,"truncate"),includeBody:s(e,"includeBody"),strictRead:s(e,"strictRead"),compact:s(e,"compact"),brief:s(e,"brief"),full:s(e,"full"),fields:d(e,"fields"),sort:d(e,"sort"),order:d(e,"order"),tree:s(e,"tree"),treeDepth:d(e,"treeDepth"),filterAcMissing:s(e,"filterAcMissing"),filterEstimatesMissing:z(e,["filterEstimatesMissing","filterEstimateMissing"]),filterResolutionMissing:s(e,"filterResolutionMissing"),filterMetadataMissing:s(e,"filterMetadataMissing"),...Ye(e)};return ne(t,e),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]="63a51994-4328-5a65-938c-d0de377ac338")}catch{}})();var Je=Symbol("pm.mcp-mutation-transport"),We=new Set(["create","update","append"]),J={create:{parameters:P,aliases:B,strings:j,repeatables:I},update:{parameters:U,aliases:G,strings:V,repeatables:M}},Xe=new Set(["activity","aggregate","context","contracts","deps","files-discover","files-lookup","get","graph","health","history","history-attest","list","next","search","stats","telemetry","validate"]);function x(e){return Je in e}function Y(e,t){return x(e)?ce(t):v(e,t)}function Mr(e,t,r=[]){let n=v(e,{...e,...t});for(let o of r)Reflect.deleteProperty(n,o);return n}function c(e,t){let r=e[t];return typeof r=="string"&&r.trim().length>0?r:void 0}function u(e,t){let r=e[t];return typeof r=="string"?r.trim().length>0?r:void 0:typeof r=="number"&&Number.isFinite(r)?String(r):void 0}function Fr(e,t){let r=e[t];return typeof r=="string"?r:typeof r=="number"&&Number.isFinite(r)?String(r):void 0}function g(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Dr(e,t){if(typeof e=="number"){if(!Number.isInteger(e))throw new p(`${t} must be a finite integer.`,f.USAGE);return e}if(typeof e=="string"&&e.trim().length>0){let r=Number(e);if(!Number.isInteger(r))throw new p(`${t} must be a finite integer.`,f.USAGE);return r}}function Kr(e,t){return typeof e.limit=="number"&&Number.isFinite(e.limit)?e.limit:typeof t.limit=="number"&&Number.isFinite(t.limit)?t.limit:c(e,"limit")??c(t,"limit")}function xr(e){let t=c(e,"outputFormat");return{json:!0,quiet:!0,author:c(e,"author"),path:c(e,"path"),noExtensions:e.noExtensions===!0||e.no_extensions===!0,noPager:!0,outputInclude:c(e,"outputInclude"),outputLimit:u(e,"outputLimit"),outputBudget:u(e,"outputBudget"),outputSession:c(e,"outputSession"),outputCursor:c(e,"outputCursor"),outputFormat:t==="json"||t==="toon"?t:void 0}}var Ce=new Set(["tags","blockedBy","blocked_by","skills","fields"]),Se=new Set(["comment","note","learning","reminder","event","dep","depRemove","dep_remove","file","doc","test","unset","addGlob","add_glob","migrate","envSet","env_set","envClear","env_clear"]),Ze=new Set([...Se].filter(e=>e!=="file")),Qe=new Set(["files","files-discover","docs","test","test-all"]),oe=new Set(["comments","notes","learnings"]);function et(e,t){if(!(!oe.has(e)||!Object.prototype.hasOwnProperty.call(t,"file")))throw new p(`MCP ${e} does not accept options.file. Pass annotation text in options.add instead.`,f.USAGE,{code:"mcp_annotation_file_unavailable",required:"Pass annotation text as JSON data; MCP annotation actions cannot read server-local files."})}var tt=new Set(["claim","release","start-task","pause-task","close-task"]),Re={history:["order"],"history-attest":["verify","output","hashAlgorithm"],list:["status","type","tag","priority","limit","offset"],search:["mode","status","type","tag","priority","limit"],create:["title","type","status","description","body","priority","tags","parent","createMode","create_mode","allowMissingParent","allowDuplicate","inheritFocus"],update:["parent","allowMissingParent","completedAt"],copy:["allowDuplicate"],close:["duplicateOf","completedAt","releaseAssignment"],claim:["start","next","ifAvailable","takeoverStale"],"start-task":["takeoverStale"],release:["pause","handoff"],comments:["ifAbsent"],notes:["ifAbsent"],learnings:["ifAbsent"],extension:["dryRun","offline"],package:["dryRun","offline"],install:["dryRun"],upgrade:["scope","dryRun","cliOnly","packagesOnly","repair","tag","packageName"],append:["body"]},rt=new Set(["context","get","list","next","search","comments","notes","learnings","files","docs","test"]),nt=new Set(["query","keywords","id","text"]);function at(e){return rt.has(e)?F[e].optional.filter(t=>!nt.has(t)):[]}var it=new Set(["claim","start-task","comments","notes","learnings","files","docs","test"]);function ot(e,t){if(!it.has(e??""))return t;let r={...t};for(let n of F[e].optional){let o=n.replace(/[A-Z]/gu,a=>`_${a.toLowerCase()}`);o===n||r[o]===void 0||(r[n]??=r[o],delete r[o])}return r}function st(e,t,r){if(!oe.has(e??""))return r;let n=r,o=n.text??t.text;if(o===void 0)return n;if(n.add!==void 0&&n.add!==o){let i=e.replace(/s$/u,"");throw new p(`Specify ${i} text either as text or with add, not both.`,f.USAGE,{code:"annotation_text_source_conflict",field:"text",required:`Pass the ${i} text once: text and add are the same source.`})}let a={...n,add:o};return delete a.text,a}function lt(e,t){let r=t.replace(/[A-Z]/gu,n=>`_${n.toLowerCase()}`);return e[t]!==void 0||e[r]!==void 0}function ct(e){return[...Re[e]??[],...at(e),...be]}var be=["outputInclude","outputLimit","outputBudget","outputFormat","outputSession","outputCursor"];function Ne(e,t=""){let r={},n=Qe.has(t),o=t==="files"||t==="files-discover"||t==="docs",a=oe.has(t)?Ze:Se;for(let[i,l]of Object.entries(e)){if(Array.isArray(l)&&Ce.has(i)){r[i]=l.join(",");continue}if(i==="note"&&o){r[i]=l;continue}if(typeof l=="string"&&a.has(i)){r[i]=[l];continue}if(typeof l=="string"&&n&&(i==="add"||i==="remove")){r[i]=[l];continue}r[i]=l}return Object.assign(r,Object.fromEntries(Object.getOwnPropertySymbols(e).map(i=>[i,Reflect.get(e,i)]))),r}function dt(e,t,r){let n=c(e,"author");return n!==void 0?n:r!==void 0&&tt.has(r)?c(e,"assignee")??c(t,"assignee"):void 0}function ut(e,t){return t!==void 0&&e.author===void 0?{...e,author:t}:e}function ft(e,t,r){let n={},o=J[e],a=new Set([...o.parameters.map(({param:i})=>i),...R.map(({param:i})=>i),...Re[e],...be,"force"]);for(let i of a){let l=o.aliases.find(y=>y.keys.includes(i))?.keys??[i];t[i]===void 0||l.some(y=>r[y]!==void 0)||(n[i]=t[i])}return n}function w(e,t){throw new p(`Invalid MCP ${e} value for "${t}". No changes were made.`,f.USAGE,{code:"invalid_argument_value",reason:"invalid_mutation_option_value",changed:!1,field:t,required:`Provide valid ${e} field values and an options object; inspect the pm_${e} input schema for supported types.`})}function pt(e,t,r){let n=J[e],o=[...n.parameters,...R,{param:"force"}];for(let{param:a}of o){if(O(b[a]).type!=="boolean")continue;let i=(n.aliases.find(l=>l.keys.includes(a))?.keys??[a]).find(l=>r[l]!==void 0&&typeof r[l]!="boolean");i!==void 0&&w(e,i)}for(let a of["idOnly","fullChangedFields"])t[a]!==void 0&&typeof t[a]!="boolean"&&w(e,a)}function yt(e,t,r){t.options!==void 0&&!g(t.options)&&w(e,"options"),pt(e,t,r);for(let i of Ce){let l=r[i];Array.isArray(l)&&l.some(y=>typeof y!="string")&&w(e,i)}let n=ke(r,e),o=J[e];for(let{keys:i,target:l}of o.strings)i.some(y=>r[y]!==void 0)&&n[l]===void 0&&w(e,l);let a=o.repeatables.flatMap(({keys:i})=>i).find(i=>{let l=r[i];return l!==void 0&&typeof l!="string"&&(!Array.isArray(l)||l.some(y=>typeof y!="string"))});return a!==void 0&&w(e,a),n}function mt(e,t,r,n,o){let a=(t==="create"||t==="update")&&x(e),i={...a?ft(t,e,n):r,...n};if((t==="create"||t==="update")&&!a){let l=g(e.options)&&D(e.options);l||$(t,i),re(t,i,!0,l)}return a?yt(t,e,i):o?Ne(i,t):i}function gt(e,t){return!We.has(e??"")||D(t)?t:ue(t)}function Lr(e,t,{nativeAction:r=!0}={}){ge(t,e);let n=g(e.options)?e.options:void 0,o=O(e.options),a={},i=h=>{lt(o,h)||e[h]===void 0||(a[h]=e[h])};for(let h of ct(t??""))i(h);t!==void 0&&x(e)&&et(t,o);let l=st(t,e,ot(t,mt(e,t,a,o,r)));if(t==="history-attest"&&x(e)&&(l.output!==void 0||typeof l.verify=="string"))throw new p("MCP history attest does not accept server-local proof paths. Export the returned JSON bundle and pass that JSON object as verify.",f.USAGE);let y=x(e)?e:n??e,S=Y(y,ut(l,dt(e,l,t)));return gt(t,S)}function Pr(e){if(e.addNote===void 0)return e;let t={...e};return t.note===void 0&&typeof t.addNote=="string"&&(t.note=t.addNote),delete t.addNote,t}function Ur(e){let t={...e};return t.discoveryNote!==void 0&&t.note===void 0&&typeof t.discoveryNote=="string"&&(t.note=t.discoveryNote),delete t.discover,delete t.discoveryNote,t}function ht(e){let t=[],r=!0;for(let n of e.trim().toLowerCase()){if(n>="a"&&n<="z"||n>="0"&&n<="9"){t.push(n),r=!1;continue}r||(t.push("-"),r=!0)}return t.at(-1)==="-"&&t.pop(),t.join("")}function Br(e){return!Xe.has(ht(e))}function jr(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean).join(" ")}function At(e){return Array.isArray(e)?e.map(t=>String(t)).filter(t=>t.length>0):[]}function Gr(e,t){let r=new Set(["action","args","author","cwd","fullChangedFields","id","options","path","query","reason","target"]),n={};for(let[a,i]of Object.entries(e))r.has(a)||(n[a]=i);let o={...n,...t};return delete o.args,delete o.author,o}function Vr(e,t){let r=Y(t??{},{...t});return{changedFields:e.fullChangedFields===!0?"full":"compact",idOnly:e.idOnly===!0,runnerOptions:r}}function ie(e){return{type:u(e,"filterType"),tag:u(e,"filterTag"),priority:u(e,"filterPriority"),deadlineBefore:u(e,"filterDeadlineBefore"),deadlineAfter:u(e,"filterDeadlineAfter"),updatedAfter:u(e,"filterUpdatedAfter"),updatedBefore:u(e,"filterUpdatedBefore"),createdAfter:u(e,"filterCreatedAfter"),createdBefore:u(e,"filterCreatedBefore"),ids:Z(e.ids),assignee:u(e,"filterAssignee"),assigneeFilter:u(e,"filterAssigneeFilter")??u(e,"filterAssignee_filter"),parent:u(e,"filterParent"),sprint:u(e,"filterSprint"),release:u(e,"filterRelease"),limit:u(e,"limit"),offset:u(e,"offset")}}function ae(e){if(typeof e=="string"&&e.trim().length>0)return e;if(Array.isArray(e))return At(e)}function q(e){if(typeof e=="number"&&Number.isFinite(e)||typeof e=="string"&&e.trim().length>0)return e}function Hr(e){let t=ae(e.kind),r=ae(e.exemptIsolate),n=ae(e.exemptIsolateType);return{...t===void 0?{}:{kind:t},maxDepth:q(e.maxDepth),limit:q(e.limit),after:c(e,"after"),direction:c(e,"direction"),maxPaths:q(e.maxPaths),sample:q(e.sample),...r===void 0?{}:{exemptIsolate:r},...n===void 0?{}:{exemptIsolateType:n},saveBaseline:e.saveBaseline===!0,rebuild:e.rebuild===!0,clear:e.clear===!0,summary:e.summary===!0,...e.full===!0?{full:!0}:{}}}function Ee(e){let t=ve(e);return e.ids!==void 0&&(t.ids=Z(e.ids)),t}function $r(e){return{status:c(e,"filterStatus"),list:g(e.list)?Ee(e.list):ie(e),reason:c(e,"reason"),completedAt:c(e,"completedAt")??c(e,"completed_at"),resolution:c(e,"resolution"),expectedResult:c(e,"expectedResult")??c(e,"expected_result")??c(e,"expected"),actualResult:c(e,"actualResult")??c(e,"actual_result")??c(e,"actual"),validateClose:c(e,"validateClose")??c(e,"validate_close"),author:c(e,"author"),message:c(e,"message"),force:e.force===!0?!0:void 0,dryRun:e.dryRun===!0||e.dry_run===!0?!0:void 0,rollback:H(e.rollback),checkpoint:e.checkpoint===!1||e.noCheckpoint===!0||e.no_checkpoint===!0?!1:void 0}}var _t=new Set(["filterStatus","filterType","filterTag","filterPriority","filterDeadlineBefore","filterDeadlineAfter","filterUpdatedAfter","filterUpdatedBefore","filterCreatedAfter","filterCreatedBefore","filterAssignee","filterAssigneeFilter","filterAssignee_filter","filterParent","filterSprint","filterRelease","ids","list","update","limit","offset","dryRun","dry_run","rollback","checkpoint","noCheckpoint","no_checkpoint"]);function Oe(e){let t={};for(let[r,n]of Object.entries(e))_t.has(r)||(t[r]=n);return we(t)}function we(e){return ke(e,"update")}function ke(e,t){let r=Ne(e,t),n=J[t],o=new Set([...n.parameters,...R].filter(({booleanish:a})=>a===!0).map(({param:a})=>a));for(let{keys:a}of n.repeatables)for(let i of a)typeof r[i]=="string"&&(r[i]=[r[i]]);for(let a of n.strings)for(let i of a.keys){let l=r[i];(typeof l=="number"&&Number.isFinite(l)||l===!1&&o.has(i))&&(r[i]=String(l))}return t==="create"?{...Ae(r,{requireType:!1})}:_e(r)}function zr(e){if(g(e.list)||g(e.update)){let t=g(e.update)?e.update:Oe(e),r=Y(e,we(t));return{status:u(e,"filterStatus"),list:g(e.list)?Ee(e.list):ie(e),update:de(t,r),dryRun:e.dryRun===!0||e.dry_run===!0?!0:void 0,rollback:H(e.rollback),checkpoint:e.checkpoint===!1||e.noCheckpoint===!0||e.no_checkpoint===!0?!1:void 0}}return{status:u(e,"filterStatus"),list:ie(e),update:Y(e,Oe(e)),dryRun:e.dryRun===!0||e.dry_run===!0?!0:void 0,rollback:H(e.rollback),checkpoint:e.checkpoint===!1||e.noCheckpoint===!0||e.no_checkpoint===!0?!1:void 0}}function Te(e){return"expectHash"in e||"expect_hash"in e}function qr(e){if(!Te(e)&&!(g(e.options)&&Te(e.options)))return{expectHash:void 0,dispatchArgs:e};let{expectHash:t,expect_hash:r,...n}=e,o=g(n.options)?n.options:{},{expectHash:a,expect_hash:i,...l}=o,y=[t,r,a,i].filter(k=>k!==void 0),S=y.length>1?y.flatMap(k=>Array.isArray(k)?k:[k]):y[0],h=v(e,"options"in n?{...n,options:g(n.options)?v(n.options,l):n.options}:n);return{expectHash:S,dispatchArgs:h}}export{Tt as a,N as b,Ct as c,St as d,Rt as e,Me as f,ee as g,De as h,wt as i,xe as j,Le as k,Pe as l,kt as m,K as n,te as o,Gt as p,Ge as q,Vt as r,ze as s,x as t,Mr as u,c as v,u as w,Fr as x,g as y,Dr as z,Kr as A,xr as B,Re as C,Ne as D,Lr as E,Pr as F,Ur as G,ht as H,Br as I,jr as J,At as K,Gr as L,Vr as M,ie as N,Hr as O,$r as P,we as Q,zr as R,qr as S};
2
- //# sourceMappingURL=chunk-2XULTI5B.js.map
1
+ import{S as b,T as B,U as j,V as I,W as G,X as V,Y as M,a as se,ba as F,g as L,i as W,o as R,q as P,s as U}from"./chunk-URJ2E6AS.js";import{E as le,F as ce,H as v,I as de,W as H,fa as Z,o as D,oa as ue,p as X}from"./chunk-XCJSHNXK.js";import{ja as O}from"./chunk-OSLQD5VH.js";import{A as p,z as f}from"./chunk-3IRCYJI5.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]="202cbe4e-7d36-5b12-be9d-d35608a6b36d")}catch{}})();var Ie=new Set(["none","null"]);function Tt(e={}){return[{optionKey:"dep",clearFlagKey:"clearDeps",valueFlag:"--dep",clearFlag:"--clear-deps",...e.depDisableFlagKey===void 0?{}:{disableFlagKey:e.depDisableFlagKey}},{optionKey:"comment",clearFlagKey:"clearComments",valueFlag:"--comment",clearFlag:"--clear-comments"},{optionKey:"note",clearFlagKey:"clearNotes",valueFlag:"--note",clearFlag:"--clear-notes"},{optionKey:"learning",clearFlagKey:"clearLearnings",valueFlag:"--learning",clearFlag:"--clear-learnings"},{optionKey:"file",clearFlagKey:"clearFiles",valueFlag:"--file",clearFlag:"--clear-files",...e.fileDisableFlagKey===void 0?{}:{disableFlagKey:e.fileDisableFlagKey}},{optionKey:"test",clearFlagKey:"clearTests",valueFlag:"--test",clearFlag:"--clear-tests",...e.testDisableFlagKey===void 0?{}:{disableFlagKey:e.testDisableFlagKey}},{optionKey:"doc",clearFlagKey:"clearDocs",valueFlag:"--doc",clearFlag:"--clear-docs",...e.docDisableFlagKey===void 0?{}:{disableFlagKey:e.docDisableFlagKey}},{optionKey:"reminder",clearFlagKey:"clearReminders",valueFlag:"--reminder",clearFlag:"--clear-reminders"},{optionKey:"event",clearFlagKey:"clearEvents",valueFlag:"--event",clearFlag:"--clear-events"},{optionKey:"typeOption",clearFlagKey:"clearTypeOptions",valueFlag:"--type-option",clearFlag:"--clear-type-options"}]}function N(e){return e===void 0?!1:Ie.has(e.trim().toLowerCase())}function Ct(e,t,r){if(!N(e))return;let n=r?` ${r}`:"";throw new p(`${t} no longer accepts "none" or "null".${n}`.trim(),f.USAGE)}function St(e,t,r){if(!e||e.length===0||X(e)||!e.some(o=>N(o)))return;let n=r?` ${r}`:"";throw new p(`${t} no longer accepts "none" or "null".${n}`.trim(),f.USAGE)}function Rt(e,t){for(let r of t){let n=e[r.optionKey];if(!Array.isArray(n)||n.length===0)continue;if(!n.every(a=>typeof a=="string"))throw new p(`${r.valueFlag} entries must be strings.`,f.USAGE);if(X(n))continue;let o=n;if(o.some(a=>N(a))){if(o.filter(a=>!N(a)).length>0)throw new p(`Cannot mix legacy clear token "none"/"null" with concrete ${r.valueFlag} entries. Use ${r.clearFlag} to clear or provide explicit entries.`,f.USAGE);e[r.optionKey]=void 0,e[r.clearFlagKey]=!0,r.disableFlagKey&&(e[r.disableFlagKey]=!1)}}return e}(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]="5146346c-df7b-5011-9d55-c59a7ff88f29")}catch{}})();var Me=["close_reason","close-reason"],fe=[{canonical:"tags",aliases:["tags"],optionKey:"tags",metadataKey:"tags"}],pe=[{canonical:"deadline",aliases:["deadline"],optionKey:"deadline",metadataKey:"deadline"},{canonical:"estimate",aliases:["estimate","estimated_minutes","estimated-minutes"],optionKey:"estimatedMinutes",metadataKey:"estimated_minutes"},{canonical:"acceptance-criteria",aliases:["acceptance_criteria","acceptance-criteria","ac"],optionKey:"acceptanceCriteria",metadataKey:"acceptance_criteria"},{canonical:"definition-of-ready",aliases:["definition_of_ready","definition-of-ready"],optionKey:"definitionOfReady",metadataKey:"definition_of_ready"},{canonical:"order",aliases:["order","rank"],optionKey:"order",metadataKey:"order"},{canonical:"goal",aliases:["goal"],optionKey:"goal",metadataKey:"goal"},{canonical:"objective",aliases:["objective"],optionKey:"objective",metadataKey:"objective"},{canonical:"value",aliases:["value"],optionKey:"value",metadataKey:"value"},{canonical:"impact",aliases:["impact"],optionKey:"impact",metadataKey:"impact"},{canonical:"outcome",aliases:["outcome"],optionKey:"outcome",metadataKey:"outcome"},{canonical:"why-now",aliases:["why_now","why-now"],optionKey:"whyNow",metadataKey:"why_now"}],Fe=[...fe,...pe],ye=[{canonical:"assignee",aliases:["assignee"],optionKey:"assignee",metadataKey:"assignee"},{canonical:"parent",aliases:["parent"],optionKey:"parent",metadataKey:"parent"},{canonical:"reviewer",aliases:["reviewer"],optionKey:"reviewer",metadataKey:"reviewer"},{canonical:"risk",aliases:["risk"],optionKey:"risk",metadataKey:"risk"},{canonical:"confidence",aliases:["confidence"],optionKey:"confidence",metadataKey:"confidence"},{canonical:"sprint",aliases:["sprint"],optionKey:"sprint",metadataKey:"sprint"},{canonical:"release",aliases:["release"],optionKey:"release",metadataKey:"release"},{canonical:"blocked-by",aliases:["blocked_by","blocked-by"],optionKey:"blockedBy",metadataKey:"blocked_by"},{canonical:"blocked-reason",aliases:["blocked_reason","blocked-reason"],optionKey:"blockedReason",metadataKey:"blocked_reason"},{canonical:"unblock-note",aliases:["unblock_note","unblock-note"],optionKey:"unblockNote",metadataKey:"unblock_note"},{canonical:"reporter",aliases:["reporter"],optionKey:"reporter",metadataKey:"reporter"},{canonical:"severity",aliases:["severity"],optionKey:"severity",metadataKey:"severity"},{canonical:"environment",aliases:["environment"],optionKey:"environment",metadataKey:"environment"},{canonical:"repro-steps",aliases:["repro_steps","repro-steps"],optionKey:"reproSteps",metadataKey:"repro_steps"},{canonical:"resolution",aliases:["resolution"],optionKey:"resolution",metadataKey:"resolution"},{canonical:"expected-result",aliases:["expected_result","expected-result"],optionKey:"expectedResult",metadataKey:"expected_result"},{canonical:"actual-result",aliases:["actual_result","actual-result"],optionKey:"actualResult",metadataKey:"actual_result"},{canonical:"affected-version",aliases:["affected_version","affected-version"],optionKey:"affectedVersion",metadataKey:"affected_version"},{canonical:"fixed-version",aliases:["fixed_version","fixed-version"],optionKey:"fixedVersion",metadataKey:"fixed_version"},{canonical:"component",aliases:["component"],optionKey:"component",metadataKey:"component"},{canonical:"regression",aliases:["regression"],optionKey:"regression",metadataKey:"regression"},{canonical:"customer-impact",aliases:["customer_impact","customer-impact"],optionKey:"customerImpact",metadataKey:"customer_impact"}],ee=[...Fe,{canonical:"author",aliases:["author"],optionKey:"author",metadataKey:"author"},...ye],De=[...fe,{canonical:"close-reason",aliases:Me,optionKey:"closeReason",metadataKey:"close_reason"},...pe,...ye],Ke=new Set(["none","null","-"]);function me(e){return e==="create"?ee:De}function $(e,t){let r=t.unset;if(r!==void 0&&typeof r!="string"&&!Array.isArray(r))return;let n=[];for(let o of me(e))o.optionKey==="author"||!Object.hasOwn(t,o.optionKey)||t[o.optionKey]!==null||(Reflect.deleteProperty(t,o.optionKey),n.push(o.canonical));n.length!==0&&(t.unset=[...r===void 0?[]:typeof r=="string"?[r]:r,...n])}function Q(e){return typeof e=="string"&&Ke.has(e.trim().toLowerCase())}function wt(e,t,r,n){return r?me(e).flatMap(o=>{let a=t[o.optionKey],i=n[o.metadataKey];return Q(a)&&(Q(i)||Array.isArray(i)&&i.some(Q))?[`literal_sentinel_stored:${o.canonical}:${a.trim()}`]:[]}):[]}function xe(e,t){return e.flatMap(r=>r.includes(",")&&t(r)?[r]:r.split(","))}function Le(e){let t=new Set,r=new Set;if(!e.raw||e.raw.length===0)return{metadataKeys:t,optionKeys:r};let n=xe(e.raw,o=>e.resolveDefinition(o.trim().toLowerCase())!==void 0);for(let o of n){let a=o.trim().toLowerCase();if(!a)throw new p("--unset values must not be empty; name each field once, for example --unset parent,release",f.USAGE);if(N(a))throw new p('--unset no longer accepts "none" or "null". Specify concrete field names such as --unset deadline',f.USAGE);let i=e.resolveDefinition(a);if(!i)throw new p(`Unsupported --unset field "${o}". Supported fields: ${e.supportedFields}`,f.USAGE);t.add(i.metadataKey),r.add(i.optionKey)}return{metadataKeys:t,optionKeys:r}}function Pe(e,t,r){let n=e.trim().toLowerCase();if(!r)return;let o=r.command_to_fields?.get(t)??[];for(let a of o){if(a.allow_unset===!1)continue;let i=new Set;if(typeof a.key=="string"&&a.key.length>0&&i.add(a.key.toLowerCase()),typeof a.metadata_key=="string"&&a.metadata_key.length>0&&i.add(a.metadata_key.toLowerCase()),typeof a.cli_flag=="string"&&a.cli_flag.length>0&&(i.add(a.cli_flag.replaceAll("-","_").toLowerCase()),i.add(a.cli_flag.toLowerCase())),Array.isArray(a.cli_aliases))for(let l of a.cli_aliases)typeof l!="string"||l.length===0||(i.add(l.replaceAll("-","_").toLowerCase()),i.add(l.toLowerCase()));if(i.has(n))return{optionKey:a.key,metadataKey:a.metadata_key}}}var Ue=(()=>{let e=new Map;for(let t of ee)for(let r of t.aliases)e.set(r,{optionKey:t.optionKey,metadataKey:t.metadataKey});return e})(),Be=ee.map(e=>e.canonical).sort((e,t)=>e.localeCompare(t)).join(", ");function kt(e,t){return Le({raw:e,supportedFields:Be,resolveDefinition:r=>Ue.get(r)??Pe(r,"create",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]="837a5c2d-6447-5696-b0de-32641cde14cd")}catch{}})();var je={create:'client.create({ type: "Task", title: "Example", createMode: "progressive" })',update:'client.update(id, { estimatedMinutes: "45", force: false })',append:'client.append(id, "Body text")',reopen:'client.reopen(id, "The work recurred", { expectedResult: "Verified recovery" })'};function E(e,t,r){let n=`${e} ${t} must be ${r}.`;throw new p(n,f.USAGE,{code:"invalid_argument_value",reason:"invalid_mutation_option_value",field:t,changed:!1,required:n,examples:[je[e]]})}function K(e,t,r){typeof e!="string"&&E(t,r,"a string")}function te(e,t){(e===null||typeof e!="object"||Array.isArray(e))&&E(t,"options","an object")}function ge(e,t){(e==="append"||e==="update")&&t.id!==void 0&&K(t.id,e,"id"),e==="item-reopen"&&(t.id!==void 0&&K(t.id,"reopen","id"),t.reason!==void 0&&K(t.reason,"reopen","reason"),t.options!==void 0&&Ge(t.options))}function Gt(e){te(e,"append");for(let t of["body","author","message"])e[t]!==void 0&&K(e[t],"append",t);e.force!==void 0&&typeof e.force!="boolean"&&E("append","force","a boolean")}function Ge(e){te(e,"reopen");for(let t of F["item-reopen"].optional){let r=e[t];r!==void 0&&(O(Reflect.get(b,t)).type==="boolean"?typeof r!="boolean"&&E("reopen",t,"a boolean"):K(r,"reopen",t))}}function Ve(e,t){return e?t?"a string or string array":"a string array":"a string"}function He(e,t,r,n,o,a){r===void 0||typeof r=="string"&&(!o||a)||n==="priority"&&typeof r=="number"&&Number.isFinite(r)||o&&Array.isArray(r)&&Array.from(r).every(i=>typeof i=="string")||E(e,t,Ve(o,a))}function $e(e,t,r){let n=e==="create"?P:U;for(let{param:o}of[...n,...R,{param:"force"}]){if(O(Reflect.get(b,o)).type!=="boolean")continue;let a=r.find(i=>i.keys.includes(o))?.keys??[o];for(let i of a)t[i]!==void 0&&typeof t[i]!="boolean"&&E(e,i,"a boolean")}}function re(e,t,r=!0,n=!1){let o=e==="create"?B:G;for(let{target:a,keys:i,repeatable:l}of o)if(O(Reflect.get(b,a)).type!=="boolean")for(let y of i){let S=n&&y!==a,h=l===!0&&(a!=="acceptanceCriteria"||S);He(e,y,t[y],a,h,r||S)}$e(e,t,o)}function Vt(e,t){te(t,e);let r=le(t),n=D(r);return n||$(e,r),re(e,r,!1,n),r}import{Option as ur}from"commander";(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]="96013340-cb63-5e96-a1b0-b810100ab080")}catch{}})();function A(e,t,r){if(typeof r!="string")return;let n=r.trim();n.length!==0&&e.push(t,n)}function m(e,t,r){r===!0&&e.push(t)}function T(e,t,r){if(Array.isArray(r))for(let n of r){if(typeof n!="string")continue;let o=n.trim();o.length!==0&&e.push(t,o)}}function ze(e,t){let r=["test",e,"--run","--json","--progress"];return T(r,"--add",t.add),T(r,"--add-json",t.addJson),T(r,"--remove",t.remove),T(r,"--remove-index",Array.isArray(t.removeIndex)?t.removeIndex.map(n=>typeof n=="number"?String(n):n):t.removeIndex),A(r,"--match",t.match),A(r,"--only-index",typeof t.onlyIndex=="number"?String(t.onlyIndex):t.onlyIndex),m(r,"--only-last",t.onlyLast),m(r,"--full-history",t.fullHistory),T(r,"--measure",t.measure),A(r,"--metric-below",t.metricBelow),A(r,"--metric-diff",t.metricDiff),qe(r,t),A(r,"--author",t.author),A(r,"--message",t.message),m(r,"--force",t.force),r}function qe(e,t){A(e,"--timeout",t.timeout),T(e,"--env-set",t.envSet),T(e,"--env-clear",t.envClear),m(e,"--shared-host-safe",t.sharedHostSafe),A(e,"--pm-context",t.pmContext),m(e,"--override-linked-pm-context",t.overrideLinkedPmContext),A(e,"--workspace-context",t.workspaceContext),m(e,"--override-linked-workspace-context",t.overrideLinkedWorkspaceContext),m(e,"--allow-untrusted-linked-tests",t.allowUntrustedLinkedTests),m(e,"--fail-on-context-mismatch",t.failOnContextMismatch),m(e,"--fail-on-skipped",t.failOnSkipped),m(e,"--fail-on-empty-test-run",t.failOnEmptyTestRun),m(e,"--require-assertions-for-pm",t.requireAssertionsForPm),m(e,"--check-context",t.checkContext),m(e,"--full-output",t.fullOutput),m(e,"--auto-pm-context",t.autoPmContext)}(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]="19a688d6-a99b-5159-841e-c73597447c7f")}catch{}})();function he(e,t){let r=[],n=new Set;for(let o of t.keys){if(!Object.hasOwn(e,o))continue;let a=e[o];if(a!=null){if(typeof a=="string"){r.push(a);continue}if(!Array.isArray(a)||!a.every(i=>typeof i=="string"))return;n.has(a)||(n.add(a),r.push(...a))}}return r.length>0?r.join("; "):void 0}function C(e,t){return e.find(r=>r.target===t)??{target:t,keys:[t]}}function s(e,t){return e[t]===!0?!0:void 0}function _(e,t){return e[t]===!1?!0:void 0}function z(e,t){return t.some(r=>e[r]===!0)?!0:void 0}function ne(e,t){for(let[r,n]of Object.entries(t))r==="__proto__"||r==="constructor"||r==="prototype"||Object.hasOwn(e,r)||(e[r]=n)}function Ae(e,t={}){let r=i=>L(e,C(j,i)),n=i=>W(e,C(I,i)),o=r("type");if(t.requireType!==!1&&o===void 0)throw new p("Missing required option --type <value>. Why required: create resolves runtime schema fields/workflow from item type. Retry: add --type <built-in or configured custom type> (example: --type Task).",f.USAGE);let a={title:r("title"),description:r("description"),type:o,template:r("template"),createMode:r("createMode"),defer:n("defer"),deferReason:r("deferReason"),schedulePreset:r("schedulePreset"),status:r("status"),closeReason:r("closeReason"),completedAt:r("completedAt"),priority:r("priority"),tags:r("tags"),addTags:n("addTags"),body:r("body"),deadline:r("deadline"),estimatedMinutes:r("estimatedMinutes"),acceptanceCriteria:he(e,C(I,"acceptanceCriteria")),definitionOfReady:r("definitionOfReady"),order:r("order"),rank:r("rank"),goal:r("goal"),objective:r("objective"),value:r("value"),impact:r("impact"),outcome:r("outcome"),whyNow:r("whyNow"),author:r("author"),message:r("message"),assignee:r("assignee"),parent:r("parent"),inheritFocus:e.inheritFocus,allowMissingParent:z(e,["allowMissingParent","allow_missing_parent"])===!0,allowUnresolvedDeps:z(e,["allowUnresolvedDeps","allow_unresolved_deps"])===!0,allowDuplicate:s(e,"allowDuplicate")===!0,reviewer:r("reviewer"),risk:r("risk"),confidence:r("confidence"),sprint:r("sprint"),release:r("release"),blockedBy:r("blockedBy"),blockedReason:r("blockedReason"),unblockNote:r("unblockNote"),reporter:r("reporter"),severity:r("severity"),environment:r("environment"),reproSteps:r("reproSteps"),resolution:r("resolution"),expectedResult:r("expectedResult"),actualResult:r("actualResult"),affectedVersion:r("affectedVersion"),fixedVersion:r("fixedVersion"),component:r("component"),regression:e.regression===!0?"true":r("regression"),customerImpact:r("customerImpact"),dep:n("dep"),comment:n("comment"),note:n("note"),learning:n("learning"),file:n("file"),test:n("test"),doc:n("doc"),reminder:n("reminder"),event:n("event"),typeOption:n("typeOption"),field:n("field"),unset:n("unset"),clearDeps:s(e,"clearDeps"),clearComments:s(e,"clearComments"),clearNotes:s(e,"clearNotes"),clearLearnings:s(e,"clearLearnings"),clearFiles:s(e,"clearFiles"),clearTests:s(e,"clearTests"),clearDocs:s(e,"clearDocs"),clearReminders:s(e,"clearReminders"),clearEvents:s(e,"clearEvents"),clearTypeOptions:s(e,"clearTypeOptions")};return ne(a,e),v(e,a)}function _e(e){let t=o=>L(e,C(V,o)),r=o=>W(e,C(M,o)),n={title:t("title"),description:t("description"),body:t("body"),status:t("status"),closeReason:t("closeReason"),priority:t("priority"),type:t("type"),tags:t("tags"),addTags:r("addTags"),removeTags:r("removeTags"),deadline:t("deadline"),estimatedMinutes:t("estimatedMinutes"),acceptanceCriteria:he(e,C(M,"acceptanceCriteria")),addAc:r("addAc"),removeAc:r("removeAc"),definitionOfReady:t("definitionOfReady"),order:t("order"),rank:t("rank"),goal:t("goal"),objective:t("objective"),value:t("value"),impact:t("impact"),outcome:t("outcome"),whyNow:t("whyNow"),author:t("author"),message:t("message"),force:!!e.force,ownershipMetadataBypass:e.ownershipMetadataBypass===!0?!0:void 0,ownershipDependencyBypass:e.ownershipDependencyBypass===!0?!0:void 0,assignee:t("assignee"),parent:t("parent"),allowUnresolvedDeps:z(e,["allowUnresolvedDeps","allow_unresolved_deps"])===!0,reviewer:t("reviewer"),risk:t("risk"),confidence:t("confidence"),sprint:t("sprint"),release:t("release"),blockedBy:t("blockedBy"),blockedReason:t("blockedReason"),unblockNote:t("unblockNote"),reporter:t("reporter"),severity:t("severity"),environment:t("environment"),reproSteps:t("reproSteps"),resolution:t("resolution"),expectedResult:t("expectedResult"),actualResult:t("actualResult"),affectedVersion:t("affectedVersion"),fixedVersion:t("fixedVersion"),component:t("component"),regression:e.regression===!0?"true":t("regression"),customerImpact:t("customerImpact"),dep:r("dep"),depRemove:r("depRemove"),replaceDeps:s(e,"replaceDeps"),replaceTests:s(e,"replaceTests"),replaceFiles:s(e,"replaceFiles"),replaceDocs:s(e,"replaceDocs"),comment:r("comment"),note:r("note"),learning:r("learning"),file:r("file"),test:r("test"),doc:r("doc"),reminder:r("reminder"),event:r("event"),typeOption:r("typeOption"),field:r("field"),unset:r("unset"),clearDeps:s(e,"clearDeps"),clearComments:s(e,"clearComments"),clearNotes:s(e,"clearNotes"),clearLearnings:s(e,"clearLearnings"),clearFiles:s(e,"clearFiles"),clearTests:s(e,"clearTests"),clearDocs:s(e,"clearDocs"),clearReminders:s(e,"clearReminders"),clearEvents:s(e,"clearEvents"),clearTypeOptions:s(e,"clearTypeOptions")};return ne(n,e),v(e,n)}function d(e,t){let r=C(se,t),n=L(e,r);if(n!==void 0)return n;for(let o of r.keys){let a=e[o];if(Array.isArray(a)){let i=a.filter(l=>typeof l=="string");if(i.length>0)return i.join(",")}if(t==="ids"&&typeof a=="string")return a;if(typeof a=="number"&&Number.isFinite(a))return String(a)}}function Ye(e){let t=s(e,"filterFilesMissing"),r=s(e,"filterDocsMissing");return{filterReviewerMissing:s(e,"filterReviewerMissing"),filterRiskMissing:s(e,"filterRiskMissing"),filterConfidenceMissing:s(e,"filterConfidenceMissing"),filterSprintMissing:s(e,"filterSprintMissing"),filterReleaseMissing:s(e,"filterReleaseMissing"),hasNotes:s(e,"hasNotes"),hasLearnings:s(e,"hasLearnings"),hasFiles:s(e,"hasFiles"),hasDocs:s(e,"hasDocs"),hasTests:s(e,"hasTests"),hasComments:s(e,"hasComments"),hasDeps:s(e,"hasDeps"),hasBody:s(e,"hasBody"),hasLinkedCommand:s(e,"hasLinkedCommand"),noNotes:_(e,"notes"),noLearnings:_(e,"learnings"),noFiles:_(e,"files")??t,filterFilesMissing:t,noDocs:_(e,"docs")??r,filterDocsMissing:r,noTests:_(e,"tests"),noComments:_(e,"comments"),noDeps:_(e,"deps"),emptyBody:s(e,"emptyBody"),noLinkedCommand:_(e,"linkedCommand")}}function ve(e){let t={status:d(e,"status"),type:d(e,"type"),tag:d(e,"tag"),priority:d(e,"priority"),deadlineBefore:d(e,"deadlineBefore"),deadlineAfter:d(e,"deadlineAfter"),updatedAfter:d(e,"updatedAfter"),updatedBefore:d(e,"updatedBefore"),createdAfter:d(e,"createdAfter"),createdBefore:d(e,"createdBefore"),today:s(e,"today"),recent:s(e,"recent"),ids:d(e,"ids"),assignee:d(e,"assignee"),assigneeFilter:d(e,"assigneeFilter"),parent:d(e,"parent"),sprint:d(e,"sprint"),release:d(e,"release"),limit:d(e,"limit"),offset:d(e,"offset"),noTruncate:_(e,"truncate"),includeBody:s(e,"includeBody"),strictRead:s(e,"strictRead"),compact:s(e,"compact"),brief:s(e,"brief"),full:s(e,"full"),fields:d(e,"fields"),sort:d(e,"sort"),order:d(e,"order"),tree:s(e,"tree"),treeDepth:d(e,"treeDepth"),filterAcMissing:s(e,"filterAcMissing"),filterEstimatesMissing:z(e,["filterEstimatesMissing","filterEstimateMissing"]),filterResolutionMissing:s(e,"filterResolutionMissing"),filterMetadataMissing:s(e,"filterMetadataMissing"),...Ye(e)};return ne(t,e),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]="63a51994-4328-5a65-938c-d0de377ac338")}catch{}})();var Je=Symbol("pm.mcp-mutation-transport"),We=new Set(["create","update","append"]),J={create:{parameters:P,aliases:B,strings:j,repeatables:I},update:{parameters:U,aliases:G,strings:V,repeatables:M}},Xe=new Set(["activity","aggregate","context","contracts","deps","files-discover","files-lookup","get","graph","health","history","history-attest","list","next","search","stats","telemetry","validate"]);function x(e){return Je in e}function Y(e,t){return x(e)?ce(t):v(e,t)}function Mr(e,t,r=[]){let n=v(e,{...e,...t});for(let o of r)Reflect.deleteProperty(n,o);return n}function c(e,t){let r=e[t];return typeof r=="string"&&r.trim().length>0?r:void 0}function u(e,t){let r=e[t];return typeof r=="string"?r.trim().length>0?r:void 0:typeof r=="number"&&Number.isFinite(r)?String(r):void 0}function Fr(e,t){let r=e[t];return typeof r=="string"?r:typeof r=="number"&&Number.isFinite(r)?String(r):void 0}function g(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Dr(e,t){if(typeof e=="number"){if(!Number.isInteger(e))throw new p(`${t} must be a finite integer.`,f.USAGE);return e}if(typeof e=="string"&&e.trim().length>0){let r=Number(e);if(!Number.isInteger(r))throw new p(`${t} must be a finite integer.`,f.USAGE);return r}}function Kr(e,t){return typeof e.limit=="number"&&Number.isFinite(e.limit)?e.limit:typeof t.limit=="number"&&Number.isFinite(t.limit)?t.limit:c(e,"limit")??c(t,"limit")}function xr(e){let t=c(e,"outputFormat");return{json:!0,quiet:!0,author:c(e,"author"),path:c(e,"path"),noExtensions:e.noExtensions===!0||e.no_extensions===!0,noPager:!0,outputInclude:c(e,"outputInclude"),outputLimit:u(e,"outputLimit"),outputBudget:u(e,"outputBudget"),outputSession:c(e,"outputSession"),outputCursor:c(e,"outputCursor"),outputFormat:t==="json"||t==="toon"?t:void 0}}var Ce=new Set(["tags","blockedBy","blocked_by","skills","fields"]),Se=new Set(["comment","note","learning","reminder","event","dep","depRemove","dep_remove","file","doc","test","unset","addGlob","add_glob","migrate","envSet","env_set","envClear","env_clear"]),Ze=new Set([...Se].filter(e=>e!=="file")),Qe=new Set(["files","files-discover","docs","test","test-all"]),oe=new Set(["comments","notes","learnings"]);function et(e,t){if(!(!oe.has(e)||!Object.prototype.hasOwnProperty.call(t,"file")))throw new p(`MCP ${e} does not accept options.file. Pass annotation text in options.add instead.`,f.USAGE,{code:"mcp_annotation_file_unavailable",required:"Pass annotation text as JSON data; MCP annotation actions cannot read server-local files."})}var tt=new Set(["claim","release","start-task","pause-task","close-task"]),Re={history:["order"],"history-attest":["verify","output","hashAlgorithm"],list:["status","type","tag","priority","limit","offset"],search:["mode","status","type","tag","priority","limit"],create:["title","type","status","description","body","priority","tags","parent","createMode","create_mode","allowMissingParent","allowDuplicate","inheritFocus"],update:["parent","allowMissingParent","completedAt"],copy:["allowDuplicate"],close:["duplicateOf","completedAt","releaseAssignment"],claim:["start","next","ifAvailable","takeoverStale"],"start-task":["takeoverStale"],release:["pause","handoff"],comments:["ifAbsent"],notes:["ifAbsent"],learnings:["ifAbsent"],extension:["dryRun","offline"],package:["dryRun","offline"],install:["dryRun"],upgrade:["scope","dryRun","cliOnly","packagesOnly","repair","tag","packageName"],append:["body"]},rt=new Set(["context","get","list","next","search","comments","notes","learnings","files","docs","test"]),nt=new Set(["query","keywords","id","text"]);function at(e){return rt.has(e)?F[e].optional.filter(t=>!nt.has(t)):[]}var it=new Set(["claim","start-task","comments","notes","learnings","files","docs","test"]);function ot(e,t){if(!it.has(e??""))return t;let r={...t};for(let n of F[e].optional){let o=n.replace(/[A-Z]/gu,a=>`_${a.toLowerCase()}`);o===n||r[o]===void 0||(r[n]??=r[o],delete r[o])}return r}function st(e,t,r){if(!oe.has(e??""))return r;let n=r,o=n.text??t.text;if(o===void 0)return n;if(n.add!==void 0&&n.add!==o){let i=e.replace(/s$/u,"");throw new p(`Specify ${i} text either as text or with add, not both.`,f.USAGE,{code:"annotation_text_source_conflict",field:"text",required:`Pass the ${i} text once: text and add are the same source.`})}let a={...n,add:o};return delete a.text,a}function lt(e,t){let r=t.replace(/[A-Z]/gu,n=>`_${n.toLowerCase()}`);return e[t]!==void 0||e[r]!==void 0}function ct(e){return[...Re[e]??[],...at(e),...be]}var be=["outputInclude","outputLimit","outputBudget","outputFormat","outputSession","outputCursor"];function Ne(e,t=""){let r={},n=Qe.has(t),o=t==="files"||t==="files-discover"||t==="docs",a=oe.has(t)?Ze:Se;for(let[i,l]of Object.entries(e)){if(Array.isArray(l)&&Ce.has(i)){r[i]=l.join(",");continue}if(i==="note"&&o){r[i]=l;continue}if(typeof l=="string"&&a.has(i)){r[i]=[l];continue}if(typeof l=="string"&&n&&(i==="add"||i==="remove")){r[i]=[l];continue}r[i]=l}return Object.assign(r,Object.fromEntries(Object.getOwnPropertySymbols(e).map(i=>[i,Reflect.get(e,i)]))),r}function dt(e,t,r){let n=c(e,"author");return n!==void 0?n:r!==void 0&&tt.has(r)?c(e,"assignee")??c(t,"assignee"):void 0}function ut(e,t){return t!==void 0&&e.author===void 0?{...e,author:t}:e}function ft(e,t,r){let n={},o=J[e],a=new Set([...o.parameters.map(({param:i})=>i),...R.map(({param:i})=>i),...Re[e],...be,"force"]);for(let i of a){let l=o.aliases.find(y=>y.keys.includes(i))?.keys??[i];t[i]===void 0||l.some(y=>r[y]!==void 0)||(n[i]=t[i])}return n}function w(e,t){throw new p(`Invalid MCP ${e} value for "${t}". No changes were made.`,f.USAGE,{code:"invalid_argument_value",reason:"invalid_mutation_option_value",changed:!1,field:t,required:`Provide valid ${e} field values and an options object; inspect the pm_${e} input schema for supported types.`})}function pt(e,t,r){let n=J[e],o=[...n.parameters,...R,{param:"force"}];for(let{param:a}of o){if(O(b[a]).type!=="boolean")continue;let i=(n.aliases.find(l=>l.keys.includes(a))?.keys??[a]).find(l=>r[l]!==void 0&&typeof r[l]!="boolean");i!==void 0&&w(e,i)}for(let a of["idOnly","fullChangedFields"])t[a]!==void 0&&typeof t[a]!="boolean"&&w(e,a)}function yt(e,t,r){t.options!==void 0&&!g(t.options)&&w(e,"options"),pt(e,t,r);for(let i of Ce){let l=r[i];Array.isArray(l)&&l.some(y=>typeof y!="string")&&w(e,i)}let n=ke(r,e),o=J[e];for(let{keys:i,target:l}of o.strings)i.some(y=>r[y]!==void 0)&&n[l]===void 0&&w(e,l);let a=o.repeatables.flatMap(({keys:i})=>i).find(i=>{let l=r[i];return l!==void 0&&typeof l!="string"&&(!Array.isArray(l)||l.some(y=>typeof y!="string"))});return a!==void 0&&w(e,a),n}function mt(e,t,r,n,o){let a=(t==="create"||t==="update")&&x(e),i={...a?ft(t,e,n):r,...n};if((t==="create"||t==="update")&&!a){let l=g(e.options)&&D(e.options);l||$(t,i),re(t,i,!0,l)}return a?yt(t,e,i):o?Ne(i,t):i}function gt(e,t){return!We.has(e??"")||D(t)?t:ue(t)}function Lr(e,t,{nativeAction:r=!0}={}){ge(t,e);let n=g(e.options)?e.options:void 0,o=O(e.options),a={},i=h=>{lt(o,h)||e[h]===void 0||(a[h]=e[h])};for(let h of ct(t??""))i(h);t!==void 0&&x(e)&&et(t,o);let l=st(t,e,ot(t,mt(e,t,a,o,r)));if(t==="history-attest"&&x(e)&&(l.output!==void 0||typeof l.verify=="string"))throw new p("MCP history attest does not accept server-local proof paths. Export the returned JSON bundle and pass that JSON object as verify.",f.USAGE);let y=x(e)?e:n??e,S=Y(y,ut(l,dt(e,l,t)));return gt(t,S)}function Pr(e){if(e.addNote===void 0)return e;let t={...e};return t.note===void 0&&typeof t.addNote=="string"&&(t.note=t.addNote),delete t.addNote,t}function Ur(e){let t={...e};return t.discoveryNote!==void 0&&t.note===void 0&&typeof t.discoveryNote=="string"&&(t.note=t.discoveryNote),delete t.discover,delete t.discoveryNote,t}function ht(e){let t=[],r=!0;for(let n of e.trim().toLowerCase()){if(n>="a"&&n<="z"||n>="0"&&n<="9"){t.push(n),r=!1;continue}r||(t.push("-"),r=!0)}return t.at(-1)==="-"&&t.pop(),t.join("")}function Br(e){return!Xe.has(ht(e))}function jr(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean).join(" ")}function At(e){return Array.isArray(e)?e.map(t=>String(t)).filter(t=>t.length>0):[]}function Gr(e,t){let r=new Set(["action","args","author","cwd","fullChangedFields","id","options","path","query","reason","target"]),n={};for(let[a,i]of Object.entries(e))r.has(a)||(n[a]=i);let o={...n,...t};return delete o.args,delete o.author,o}function Vr(e,t){let r=Y(t??{},{...t});return{changedFields:e.fullChangedFields===!0?"full":"compact",idOnly:e.idOnly===!0,runnerOptions:r}}function ie(e){return{type:u(e,"filterType"),tag:u(e,"filterTag"),priority:u(e,"filterPriority"),deadlineBefore:u(e,"filterDeadlineBefore"),deadlineAfter:u(e,"filterDeadlineAfter"),updatedAfter:u(e,"filterUpdatedAfter"),updatedBefore:u(e,"filterUpdatedBefore"),createdAfter:u(e,"filterCreatedAfter"),createdBefore:u(e,"filterCreatedBefore"),ids:Z(e.ids),assignee:u(e,"filterAssignee"),assigneeFilter:u(e,"filterAssigneeFilter")??u(e,"filterAssignee_filter"),parent:u(e,"filterParent"),sprint:u(e,"filterSprint"),release:u(e,"filterRelease"),limit:u(e,"limit"),offset:u(e,"offset")}}function ae(e){if(typeof e=="string"&&e.trim().length>0)return e;if(Array.isArray(e))return At(e)}function q(e){if(typeof e=="number"&&Number.isFinite(e)||typeof e=="string"&&e.trim().length>0)return e}function Hr(e){let t=ae(e.kind),r=ae(e.exemptIsolate),n=ae(e.exemptIsolateType);return{...t===void 0?{}:{kind:t},maxDepth:q(e.maxDepth),limit:q(e.limit),after:c(e,"after"),direction:c(e,"direction"),maxPaths:q(e.maxPaths),sample:q(e.sample),...r===void 0?{}:{exemptIsolate:r},...n===void 0?{}:{exemptIsolateType:n},saveBaseline:e.saveBaseline===!0,rebuild:e.rebuild===!0,clear:e.clear===!0,summary:e.summary===!0,...e.full===!0?{full:!0}:{}}}function Ee(e){let t=ve(e);return e.ids!==void 0&&(t.ids=Z(e.ids)),t}function $r(e){return{status:c(e,"filterStatus"),list:g(e.list)?Ee(e.list):ie(e),reason:c(e,"reason"),completedAt:c(e,"completedAt")??c(e,"completed_at"),resolution:c(e,"resolution"),expectedResult:c(e,"expectedResult")??c(e,"expected_result")??c(e,"expected"),actualResult:c(e,"actualResult")??c(e,"actual_result")??c(e,"actual"),validateClose:c(e,"validateClose")??c(e,"validate_close"),author:c(e,"author"),message:c(e,"message"),force:e.force===!0?!0:void 0,dryRun:e.dryRun===!0||e.dry_run===!0?!0:void 0,rollback:H(e.rollback),checkpoint:e.checkpoint===!1||e.noCheckpoint===!0||e.no_checkpoint===!0?!1:void 0}}var _t=new Set(["filterStatus","filterType","filterTag","filterPriority","filterDeadlineBefore","filterDeadlineAfter","filterUpdatedAfter","filterUpdatedBefore","filterCreatedAfter","filterCreatedBefore","filterAssignee","filterAssigneeFilter","filterAssignee_filter","filterParent","filterSprint","filterRelease","ids","list","update","limit","offset","dryRun","dry_run","rollback","checkpoint","noCheckpoint","no_checkpoint"]);function Oe(e){let t={};for(let[r,n]of Object.entries(e))_t.has(r)||(t[r]=n);return we(t)}function we(e){return ke(e,"update")}function ke(e,t){let r=Ne(e,t),n=J[t],o=new Set([...n.parameters,...R].filter(({booleanish:a})=>a===!0).map(({param:a})=>a));for(let{keys:a}of n.repeatables)for(let i of a)typeof r[i]=="string"&&(r[i]=[r[i]]);for(let a of n.strings)for(let i of a.keys){let l=r[i];(typeof l=="number"&&Number.isFinite(l)||l===!1&&o.has(i))&&(r[i]=String(l))}return t==="create"?{...Ae(r,{requireType:!1})}:_e(r)}function zr(e){if(g(e.list)||g(e.update)){let t=g(e.update)?e.update:Oe(e),r=Y(e,we(t));return{status:u(e,"filterStatus"),list:g(e.list)?Ee(e.list):ie(e),update:de(t,r),dryRun:e.dryRun===!0||e.dry_run===!0?!0:void 0,rollback:H(e.rollback),checkpoint:e.checkpoint===!1||e.noCheckpoint===!0||e.no_checkpoint===!0?!1:void 0}}return{status:u(e,"filterStatus"),list:ie(e),update:Y(e,Oe(e)),dryRun:e.dryRun===!0||e.dry_run===!0?!0:void 0,rollback:H(e.rollback),checkpoint:e.checkpoint===!1||e.noCheckpoint===!0||e.no_checkpoint===!0?!1:void 0}}function Te(e){return"expectHash"in e||"expect_hash"in e}function qr(e){if(!Te(e)&&!(g(e.options)&&Te(e.options)))return{expectHash:void 0,dispatchArgs:e};let{expectHash:t,expect_hash:r,...n}=e,o=g(n.options)?n.options:{},{expectHash:a,expect_hash:i,...l}=o,y=[t,r,a,i].filter(k=>k!==void 0),S=y.length>1?y.flatMap(k=>Array.isArray(k)?k:[k]):y[0],h=v(e,"options"in n?{...n,options:g(n.options)?v(n.options,l):n.options}:n);return{expectHash:S,dispatchArgs:h}}export{Tt as a,N as b,Ct as c,St as d,Rt as e,Me as f,ee as g,De as h,wt as i,xe as j,Le as k,Pe as l,kt as m,K as n,te as o,Gt as p,Ge as q,Vt as r,ze as s,x as t,Mr as u,c as v,u as w,Fr as x,g as y,Dr as z,Kr as A,xr as B,Re as C,Ne as D,Lr as E,Pr as F,Ur as G,ht as H,Br as I,jr as J,At as K,Gr as L,Vr as M,ie as N,Hr as O,$r as P,we as Q,zr as R,qr as S};
2
+ //# sourceMappingURL=chunk-532WZV65.js.map
@@ -1,8 +1,8 @@
1
- import{r as q,s as V}from"./chunk-XS2YZCT5.js";import{d as m,j as M,l as k}from"./chunk-7Z2NYAK4.js";import{Ga as O,Md as N,T as x,Wg as D,Y as g,Zg as j,ah as z}from"./chunk-A2CLYPDA.js";import{A as C,E as _,I as L,z as S}from"./chunk-IXYBN6D2.js";import{constants as p}from"node:fs";import{lstat as A,mkdir as I,open as P}from"node:fs/promises";import h from"node:path";(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new i.Error().stack;e&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[e]="5434ff6f-95af-5983-88cb-fd360d95cb9e")}catch{}})();function E(i,e){if(typeof i!="string"||i.trim().length===0)throw new TypeError(`Relationship event ${e} must be non-empty`);return i.trim()}function $(i,e){let t=e.require(i.kind),n=t.direction==="undirected"?[i.source,i.target].sort().join("\0"):`${i.source}\0${i.target}`;return`${t.kind}\0${n}`}function Q(i){return Object.freeze({...i,...i.payload===void 0?{}:{payload:Object.freeze(structuredClone(i.payload))}})}function U(i,e,t,n){let r=t.require(i.kind),o=n.outgoingOne.get(`${r.kind}\0${i.source}`);if(o!==void 0&&o!==e)throw new TypeError(`Relationship outgoing cardinality exceeded for ${r.kind}`);let s=n.incomingOne.get(`${r.kind}\0${i.target}`);if(s!==void 0&&s!==e)throw new TypeError(`Relationship incoming cardinality exceeded for ${r.kind}`);let c=$(i,t),a=n.identities.get(c);if(a!==void 0&&a!==e)throw new TypeError(`Relationship edge already active: ${c}`)}function Y(i){let e=new Map;for(let t of i)t.action==="remove"?e.delete(t.relationshipId):e.set(t.relationshipId,t.edge);return e}function X(i,e,t){if(i.expectedVersion!==void 0&&i.expectedVersion!==e)throw new TypeError(`Relationship event version conflict: expected ${i.expectedVersion}, current ${e}`);let n=E(i.eventId,"eventId");if(t.has(n))throw new TypeError(`Relationship event already exists: ${n}`);if(i.action!=="add"&&i.action!=="remove"&&i.action!=="supersede")throw new TypeError(`Unknown relationship event action: ${i.action}`);if(!Number.isFinite(Date.parse(i.timestamp)))throw new TypeError("Relationship event timestamp must be valid");return{eventId:n,relationshipId:E(i.relationshipId,"relationshipId"),author:E(i.author,"author"),timestamp:new Date(i.timestamp).toISOString()}}function Z(i,e,t,n,r,o){let s=t.has(e);if(i.action==="add"&&s)throw new TypeError(`Relationship is already active: ${e}`);if(i.action!=="add"&&!s)throw new TypeError(`Relationship is not active: ${e}`);if(i.action==="remove")return;if(!i.edge)throw new TypeError(`Relationship ${i.action} event requires an edge`);let c=typeof i.edge.source=="string"?i.edge.source.trim():"",a=typeof i.edge.target=="string"?i.edge.target.trim():"";if(!n.has(c)||!n.has(a))throw new TypeError(`Relationship endpoint not found: ${c} -> ${a}`);let d=new g([c,a],[i.edge],r).edges()[0];return U(d,e,r,o),Q(d)}var T=class{#t;#i;#n=[];#o=new Set;#e=new Map;#r={identities:new Map,outgoingOne:new Map,incomingOne:new Map};constructor(e,t={}){this.#t=new Set([...e].filter(n=>typeof n=="string").map(n=>n.trim()).filter(Boolean)),this.#i=t.registry??x()}get version(){return this.#n.length}events(){return Object.freeze([...this.#n])}*stream(e={}){let t=e.fromVersion??1,n=e.toVersion??this.version,r=e.batchSize??100;if(!Number.isInteger(t)||t<1)throw new TypeError("Relationship event stream fromVersion must be positive");if(!Number.isInteger(n)||n<0||n>this.version)throw new TypeError(`Relationship event stream toVersion out of range: ${n}`);if(!Number.isInteger(r)||r<1)throw new TypeError("Relationship event stream batchSize must be positive");if(t>n+1)throw new TypeError("Relationship event stream fromVersion exceeds the selected prefix");for(let o=t-1;o<n;o+=r)yield Object.freeze(this.#n.slice(o,Math.min(o+r,n)))}project(e,t,n={}){if(typeof t!="function")throw new TypeError("Relationship event projection requires a reducer");let r=e,o=0,s;for(let c of this.stream({...n,batchSize:256}))for(let a of c)r=t(r,a),o+=1,s=a;return Object.freeze({state:r,version:s?.sequence??Math.max(0,(n.fromVersion??1)-1),processed:o,...s===void 0?{}:{asOf:s.timestamp}})}#s(e,t){let n=this.#i.require(t.kind);this.#r.identities.set($(t,this.#i),e),n.outgoing==="one"&&this.#r.outgoingOne.set(`${n.kind}\0${t.source}`,e),n.incoming==="one"&&this.#r.incomingOne.set(`${n.kind}\0${t.target}`,e)}#a(e){let t=this.#i.require(e.kind);this.#r.identities.delete($(e,this.#i)),t.outgoing==="one"&&this.#r.outgoingOne.delete(`${t.kind}\0${e.source}`),t.incoming==="one"&&this.#r.incomingOne.delete(`${t.kind}\0${e.target}`)}append(e){let t=X(e,this.version,this.#o),n=this.#e.get(t.relationshipId),r=Z(e,t.relationshipId,this.#e,this.#t,this.#i,this.#r),o=Object.freeze({eventId:t.eventId,relationshipId:t.relationshipId,action:e.action,...r===void 0?{}:{edge:r},author:t.author,timestamp:t.timestamp,...e.reason?.trim()?{reason:e.reason.trim()}:{},sequence:this.version+1});return this.#n.push(o),this.#o.add(t.eventId),n&&this.#a(n),e.action==="remove"?this.#e.delete(t.relationshipId):(this.#e.set(t.relationshipId,r),this.#s(t.relationshipId,r)),o}snapshot(e={}){if(e.atVersion!==void 0&&e.atTimestamp!==void 0)throw new TypeError("Relationship snapshot accepts one target");let t;if(e.atTimestamp!==void 0){let o=Date.parse(e.atTimestamp);if(!Number.isFinite(o))throw new TypeError("Relationship snapshot timestamp must be valid");t=this.#n.filter(s=>Date.parse(s.timestamp)<=o)}else{let o=e.atVersion??this.version;if(!Number.isInteger(o)||o<0||o>this.version)throw new TypeError(`Relationship snapshot version out of range: ${o}`);t=this.#n.slice(0,o)}let n=Y(t),r=new g(this.#t,n.values(),this.#i);return Object.freeze({version:t.at(-1)?.sequence??0,...t.at(-1)?{asOf:t.at(-1).timestamp}:{},edges:r.edges(),graph:r})}page(e){if(!Number.isInteger(e.limit)||e.limit<1)throw new TypeError("Relationship event page limit must be positive");let t=D("relationship-events",{order:"append-sequence"}),n=e.cursor===void 0?this.version:Number(j(e.cursor,t).snapshot);if(!Number.isSafeInteger(n)||n<0||n>this.version)throw new TypeError("Relationship event cursor snapshot version is invalid");let r=z(this.#n.slice(0,n),{cursor:e.cursor,fingerprint:t,limit:e.limit,readId:o=>o.eventId,snapshot:String(n)});return{version:n,events:r.rows,hasMore:r.has_more,...r.next_cursor?{nextCursor:r.next_cursor}:{}}}},ee="relationship-event-store",W=p.O_NOFOLLOW;function w(i){return N(i,ee,30,`relationship-store:${process.pid}`,!1,!1,3e3)}async function f(i,e="relationships/events.jsonl"){let t=h.resolve(i),n=h.resolve(t,e),r=h.relative(t,n);if(r.length===0)throw new TypeError("Relationship event path must name a file within the tracker root");if(r===".."||r.startsWith(`..${h.sep}`)||h.isAbsolute(r))throw new TypeError("Relationship event path must stay within the tracker root");if(await I(t,{recursive:!0}),(await A(t)).isSymbolicLink())throw new TypeError("Relationship event tracker root must not be a symbolic link");let o=t;for(let s of r.split(h.sep)){o=h.join(o,s);try{if((await A(o)).isSymbolicLink())throw new TypeError("Relationship event path must not contain symbolic links")}catch(c){if(_(c))break;throw c}}return n}async function y(i,e,t){let n=new T(e,{registry:t}),r,o;try{o=await P(i,p.O_RDONLY|W),r=await o.readFile("utf8")}catch(c){if(_(c))return{log:n,raw:""};throw c}finally{await o?.close()}let s=r.split(`
1
+ import{r as q,s as V}from"./chunk-YOAYY3HE.js";import{d as m,j as M,l as k}from"./chunk-RPE6IX26.js";import{$g as j,Ga as O,Md as N,T as x,Y as g,Yg as D,ch as z}from"./chunk-OSLQD5VH.js";import{A as C,E as _,I as L,z as S}from"./chunk-3IRCYJI5.js";import{constants as p}from"node:fs";import{lstat as A,mkdir as I,open as P}from"node:fs/promises";import h from"node:path";(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new i.Error().stack;e&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[e]="5434ff6f-95af-5983-88cb-fd360d95cb9e")}catch{}})();function E(i,e){if(typeof i!="string"||i.trim().length===0)throw new TypeError(`Relationship event ${e} must be non-empty`);return i.trim()}function $(i,e){let t=e.require(i.kind),n=t.direction==="undirected"?[i.source,i.target].sort().join("\0"):`${i.source}\0${i.target}`;return`${t.kind}\0${n}`}function Q(i){return Object.freeze({...i,...i.payload===void 0?{}:{payload:Object.freeze(structuredClone(i.payload))}})}function U(i,e,t,n){let r=t.require(i.kind),o=n.outgoingOne.get(`${r.kind}\0${i.source}`);if(o!==void 0&&o!==e)throw new TypeError(`Relationship outgoing cardinality exceeded for ${r.kind}`);let s=n.incomingOne.get(`${r.kind}\0${i.target}`);if(s!==void 0&&s!==e)throw new TypeError(`Relationship incoming cardinality exceeded for ${r.kind}`);let c=$(i,t),a=n.identities.get(c);if(a!==void 0&&a!==e)throw new TypeError(`Relationship edge already active: ${c}`)}function Y(i){let e=new Map;for(let t of i)t.action==="remove"?e.delete(t.relationshipId):e.set(t.relationshipId,t.edge);return e}function X(i,e,t){if(i.expectedVersion!==void 0&&i.expectedVersion!==e)throw new TypeError(`Relationship event version conflict: expected ${i.expectedVersion}, current ${e}`);let n=E(i.eventId,"eventId");if(t.has(n))throw new TypeError(`Relationship event already exists: ${n}`);if(i.action!=="add"&&i.action!=="remove"&&i.action!=="supersede")throw new TypeError(`Unknown relationship event action: ${i.action}`);if(!Number.isFinite(Date.parse(i.timestamp)))throw new TypeError("Relationship event timestamp must be valid");return{eventId:n,relationshipId:E(i.relationshipId,"relationshipId"),author:E(i.author,"author"),timestamp:new Date(i.timestamp).toISOString()}}function Z(i,e,t,n,r,o){let s=t.has(e);if(i.action==="add"&&s)throw new TypeError(`Relationship is already active: ${e}`);if(i.action!=="add"&&!s)throw new TypeError(`Relationship is not active: ${e}`);if(i.action==="remove")return;if(!i.edge)throw new TypeError(`Relationship ${i.action} event requires an edge`);let c=typeof i.edge.source=="string"?i.edge.source.trim():"",a=typeof i.edge.target=="string"?i.edge.target.trim():"";if(!n.has(c)||!n.has(a))throw new TypeError(`Relationship endpoint not found: ${c} -> ${a}`);let d=new g([c,a],[i.edge],r).edges()[0];return U(d,e,r,o),Q(d)}var T=class{#t;#i;#n=[];#o=new Set;#e=new Map;#r={identities:new Map,outgoingOne:new Map,incomingOne:new Map};constructor(e,t={}){this.#t=new Set([...e].filter(n=>typeof n=="string").map(n=>n.trim()).filter(Boolean)),this.#i=t.registry??x()}get version(){return this.#n.length}events(){return Object.freeze([...this.#n])}*stream(e={}){let t=e.fromVersion??1,n=e.toVersion??this.version,r=e.batchSize??100;if(!Number.isInteger(t)||t<1)throw new TypeError("Relationship event stream fromVersion must be positive");if(!Number.isInteger(n)||n<0||n>this.version)throw new TypeError(`Relationship event stream toVersion out of range: ${n}`);if(!Number.isInteger(r)||r<1)throw new TypeError("Relationship event stream batchSize must be positive");if(t>n+1)throw new TypeError("Relationship event stream fromVersion exceeds the selected prefix");for(let o=t-1;o<n;o+=r)yield Object.freeze(this.#n.slice(o,Math.min(o+r,n)))}project(e,t,n={}){if(typeof t!="function")throw new TypeError("Relationship event projection requires a reducer");let r=e,o=0,s;for(let c of this.stream({...n,batchSize:256}))for(let a of c)r=t(r,a),o+=1,s=a;return Object.freeze({state:r,version:s?.sequence??Math.max(0,(n.fromVersion??1)-1),processed:o,...s===void 0?{}:{asOf:s.timestamp}})}#s(e,t){let n=this.#i.require(t.kind);this.#r.identities.set($(t,this.#i),e),n.outgoing==="one"&&this.#r.outgoingOne.set(`${n.kind}\0${t.source}`,e),n.incoming==="one"&&this.#r.incomingOne.set(`${n.kind}\0${t.target}`,e)}#a(e){let t=this.#i.require(e.kind);this.#r.identities.delete($(e,this.#i)),t.outgoing==="one"&&this.#r.outgoingOne.delete(`${t.kind}\0${e.source}`),t.incoming==="one"&&this.#r.incomingOne.delete(`${t.kind}\0${e.target}`)}append(e){let t=X(e,this.version,this.#o),n=this.#e.get(t.relationshipId),r=Z(e,t.relationshipId,this.#e,this.#t,this.#i,this.#r),o=Object.freeze({eventId:t.eventId,relationshipId:t.relationshipId,action:e.action,...r===void 0?{}:{edge:r},author:t.author,timestamp:t.timestamp,...e.reason?.trim()?{reason:e.reason.trim()}:{},sequence:this.version+1});return this.#n.push(o),this.#o.add(t.eventId),n&&this.#a(n),e.action==="remove"?this.#e.delete(t.relationshipId):(this.#e.set(t.relationshipId,r),this.#s(t.relationshipId,r)),o}snapshot(e={}){if(e.atVersion!==void 0&&e.atTimestamp!==void 0)throw new TypeError("Relationship snapshot accepts one target");let t;if(e.atTimestamp!==void 0){let o=Date.parse(e.atTimestamp);if(!Number.isFinite(o))throw new TypeError("Relationship snapshot timestamp must be valid");t=this.#n.filter(s=>Date.parse(s.timestamp)<=o)}else{let o=e.atVersion??this.version;if(!Number.isInteger(o)||o<0||o>this.version)throw new TypeError(`Relationship snapshot version out of range: ${o}`);t=this.#n.slice(0,o)}let n=Y(t),r=new g(this.#t,n.values(),this.#i);return Object.freeze({version:t.at(-1)?.sequence??0,...t.at(-1)?{asOf:t.at(-1).timestamp}:{},edges:r.edges(),graph:r})}page(e){if(!Number.isInteger(e.limit)||e.limit<1)throw new TypeError("Relationship event page limit must be positive");let t=D("relationship-events",{order:"append-sequence"}),n=e.cursor===void 0?this.version:Number(j(e.cursor,t).snapshot);if(!Number.isSafeInteger(n)||n<0||n>this.version)throw new TypeError("Relationship event cursor snapshot version is invalid");let r=z(this.#n.slice(0,n),{cursor:e.cursor,fingerprint:t,limit:e.limit,readId:o=>o.eventId,snapshot:String(n)});return{version:n,events:r.rows,hasMore:r.has_more,...r.next_cursor?{nextCursor:r.next_cursor}:{}}}},ee="relationship-event-store",W=p.O_NOFOLLOW;function w(i){return N(i,ee,30,`relationship-store:${process.pid}`,!1,!1,3e3)}async function f(i,e="relationships/events.jsonl"){let t=h.resolve(i),n=h.resolve(t,e),r=h.relative(t,n);if(r.length===0)throw new TypeError("Relationship event path must name a file within the tracker root");if(r===".."||r.startsWith(`..${h.sep}`)||h.isAbsolute(r))throw new TypeError("Relationship event path must stay within the tracker root");if(await I(t,{recursive:!0}),(await A(t)).isSymbolicLink())throw new TypeError("Relationship event tracker root must not be a symbolic link");let o=t;for(let s of r.split(h.sep)){o=h.join(o,s);try{if((await A(o)).isSymbolicLink())throw new TypeError("Relationship event path must not contain symbolic links")}catch(c){if(_(c))break;throw c}}return n}async function y(i,e,t){let n=new T(e,{registry:t}),r,o;try{o=await P(i,p.O_RDONLY|W),r=await o.readFile("utf8")}catch(c){if(_(c))return{log:n,raw:""};throw c}finally{await o?.close()}let s=r.split(`
2
2
  `);for(let c=0;c<s.length;c+=1){let a=s[c].trim();if(!a)continue;let d;try{d=JSON.parse(a)}catch{throw new TypeError(`Invalid relationship event JSONL at line ${c+1}`)}if(d.sequence!==n.version+1)throw new TypeError(`Invalid relationship event sequence at line ${c+1}`);n.append({eventId:d.eventId,relationshipId:d.relationshipId,action:d.action,...d.edge===void 0?{}:{edge:d.edge},author:d.author,timestamp:d.timestamp,...d.reason===void 0?{}:{reason:d.reason},expectedVersion:n.version})}return{log:n,raw:r}}function te(i,e,t,n){let r=Date.parse(e.timestamp),o;return e.action!=="remove"&&e.edge!==void 0&&(o=new g(t,[e.edge],n).edges()[0]),i.eventId===e.eventId.trim()&&i.relationshipId===e.relationshipId.trim()&&i.action===e.action&&i.author===e.author.trim()&&Number.isFinite(r)&&i.timestamp===new Date(r).toISOString()&&i.reason===(e.reason?.trim()||void 0)&&O(i.edge)===O(o)}var F=class i{#t;#i;#n;#o;#e;constructor(e,t,n,r){this.#t=e.pmRoot,this.#i=t,this.#n=e.registry,this.#o=n,this.#e=r}static async open(e){let t=Object.freeze([...e.nodes]),n=await f(e.pmRoot,e.relativePath),r=await w(e.pmRoot);try{await f(e.pmRoot,n);let{log:o}=await y(n,t,e.registry);return new i(e,t,n,o)}finally{await r()}}get path(){return this.#o}async currentVersion(){return this.#e=await this.#r(),this.#e.version}async append(e){let t=await w(this.#t);try{let n=await f(this.#t,this.#o),{log:r}=await y(n,this.#i,this.#n),o=r.append(e);await I(h.dirname(n),{recursive:!0}),await f(this.#t,n);let s=await P(n,p.O_APPEND|p.O_CREAT|p.O_WRONLY|W);try{await s.appendFile(`${JSON.stringify(o)}
3
3
  `,"utf8")}finally{await s.close()}return this.#e=r,o}finally{await t()}}async appendBatch(e,t={}){let n=await w(this.#t);try{let r=await f(this.#t,this.#o),{log:o,raw:s}=await y(r,this.#i,this.#n),c=o.version,a=new Map(o.events().map(l=>[l.eventId,l])),d=[],R=[];for(let l of e){let u=l.eventId.trim(),v=a.get(u);if(v!==void 0){if(t.existingEventPolicy==="skip_identical"&&te(v,l,this.#i,this.#n)){R.push(v.eventId);continue}if(t.existingEventPolicy==="skip_identical")throw new TypeError(`Relationship event id collision with different content: ${u}`)}let b=o.append(l);a.set(b.eventId,b),d.push(b)}if(d.length>0){let l=s.length===0||s.endsWith(`
4
4
  `)?s:`${s}
5
5
  `;await I(h.dirname(r),{recursive:!0}),await f(this.#t,r),await L(r,`${l}${d.map(u=>JSON.stringify(u)).join(`
6
6
  `)}
7
7
  `)}return this.#e=o,Object.freeze({version_before:c,version_after:o.version,appended:Object.freeze(d),skipped_event_ids:Object.freeze(R)})}finally{await n()}}async snapshot(e={}){return this.#e=await this.#r(),this.#e.snapshot(e)}async page(e){return this.#e=await this.#r(),this.#e.page(e)}async*stream(e={}){this.#e=await this.#r(),yield*this.#e.stream(e)}async project(e,t,n={}){return this.#e=await this.#r(),this.#e.project(e,t,n)}async#r(){let e=await w(this.#t);try{let t=await f(this.#t,this.#o);return(await y(t,this.#i,this.#n)).log}finally{await e()}}};(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new i.Error().stack;e&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[e]="73852fdf-f072-51ab-9449-d7922712eeb4")}catch{}})();function K(i){return[...i].sort().join("\0")}function ie(i,e,t){let n=i.successors.get(e);n?n.push(t):i.successors.set(e,[t]);let r=i.predecessors.get(t);r?r.push(e):i.predecessors.set(t,[e])}function G(i,e,t,n,r){let o=e.resolve(r);if(o?.ordering!==!0)return;let s=M(n),c=s===void 0?void 0:i.canonicalIds.get(s.toLowerCase());if(c===void 0)return;let a=(o.precedence??"source_before_target")==="source_before_target";ie(i,a?t:c,a?c:t)}function ne(i,e){let t={successors:new Map,predecessors:new Map,canonicalIds:new Map},n=i.filter(r=>typeof r?.id=="string"&&r.id.trim().length>0);for(let r of n){let o=r.id.trim();t.canonicalIds.set(o.toLowerCase(),o)}for(let r of n){let o=r.id.trim();G(t,e,o,r.blocked_by,"blocked_by");for(let s of r.dependencies??[])typeof s!="object"||s===null||G(t,e,o,s.id,typeof s.kind=="string"?s.kind:"related")}for(let r of[t.successors,t.predecessors])for(let o of r.values())o.sort();return t}function re(i,e){let t=new Set([e]),n=[e];for(;n.length>0;){let r=n.pop();for(let o of[i.successors,i.predecessors])for(let s of o.get(r)??[])t.has(s)||(t.add(s),n.push(s))}return t}function oe(i,e){let t=new Map;for(let n of e){let r=(i.successors.get(n)??[]).filter(o=>e.has(o));r.length>0&&t.set(n,r)}return t}function H(i,e,t){let n=ne(i,e),r=n.canonicalIds.get(t.trim().toLowerCase());if(r===void 0)return{cycles:[],successors:new Map,canonical:t};let o=oe(n,re(n,r));return{cycles:q(o).filter(s=>s.includes(r)),successors:o,canonical:r}}function se(i,e,t){let n=new Set(e),r=n.has(t)?t:e[0];if(i.get(r)?.includes(r))return[r,r];for(let o of i.get(r)??[]){if(!n.has(o))continue;let s=ae(i,n,r,o);if(s)return s}return[...e,e[0]]}function ae(i,e,t,n){let r=[[n]],o=new Set([t,n]);for(;r.length>0;){let s=r.shift(),c=s.at(-1);for(let a of i.get(c)??[]){if(a===t)return[t,...s,t];!e.has(a)||o.has(a)||(o.add(a),r.push([...s,a]))}}}function ve(i,e,t){let n=m(),r=H(i,n,t),o=H(e,n,t),s=new Set(r.cycles.map(K)),c=new Set(k(i,void 0,n).map(a=>`${a.holder_id.toLowerCase()}\0${a.target_id.toLowerCase()}\0${a.dependency_kind}`));return[...k(e,void 0,n).filter(a=>a.holder_id.toLowerCase()===t.trim().toLowerCase()&&!c.has(`${a.holder_id.toLowerCase()}\0${a.target_id.toLowerCase()}\0${a.dependency_kind}`)).map(a=>`ordering_storage_contradiction_created:${V(a)}:remove_contradicting_dependency_row:run_pm_graph_audit`),...o.cycles.filter(a=>!s.has(K(a))).map(a=>`ordering_cycle_created:${se(o.successors,a,o.canonical).join(" -> ")}:items_will_not_be_ready:run_pm_graph_audit`)]}(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new i.Error().stack;e&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[e]="5f2ca18e-450d-5b6e-9e07-7bbf080764f9")}catch{}})();function Ee(i,e){let t=e.resolve(i);return t?.hierarchy===!0||t?.outgoing==="one"||t?.incoming==="one"}function J(i,e,t,n,r){let o=JSON.stringify([e,t,n]),s=i.get(o);s===void 0&&(s={kind:e,direction:t,node_id:n,endpoints:new Set},i.set(o,s)),s.endpoints.add(r)}function B(i,e){let t=new Map;for(let n of i)for(let r of n.dependencies??[]){let o=e.resolve(r.kind);o===void 0||o.hierarchy||(o.outgoing==="one"&&J(t,o.kind,"outgoing",n.id,r.id),o.incoming==="one"&&J(t,o.kind,"incoming",r.id,n.id))}return t}function Ie(i,e,t=m()){let n=B(i,t),r=B(e,t);for(let o of[...r.keys()].sort()){let s=r.get(o);if(s.endpoints.size<=1)continue;let c=n.get(o);if(![...s.endpoints].every(a=>c?.endpoints.has(a)))throw new C(`Relationship ${s.kind} permits only one ${s.direction} endpoint for ${s.node_id}.`,S.USAGE,{code:"dependency_cardinality_created",field:"dependencies",value:s.kind,relationship_cardinality:{kind:s.kind,direction:s.direction,node_id:s.node_id,endpoint_ids:[...s.endpoints].sort()},required:"The final dependency set must satisfy the active relationship kind's one-edge cardinality.",nextSteps:["Drop extra --dep seeds, or remove conflicting rows with update --dep-remove before adding another edge.","Choose another kind only when its declared semantics match the intended relationship."]})}}export{T as a,F as b,ve as c,Ee as d,Ie as e};
8
- //# sourceMappingURL=chunk-ZFUZ4YYN.js.map
8
+ //# sourceMappingURL=chunk-7A4QWNZX.js.map