@unbrained/pm-cli 2026.11.1 → 2026.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +18 -0
  3. package/CONTRIBUTING.md +1 -1
  4. package/dist/cli/migration-gates.js +1 -1
  5. package/dist/cli-bundle/bundle-manifest.json +1 -1
  6. package/dist/cli-bundle/chunks/{chunk-TMPO4CTZ.js → chunk-3A4NVHYS.js} +2 -2
  7. package/dist/cli-bundle/chunks/{chunk-UUN3WNMQ.js → chunk-3ZQQVJT2.js} +3 -3
  8. package/dist/cli-bundle/chunks/{chunk-TYERATXH.js → chunk-4HW253W2.js} +2 -2
  9. package/dist/cli-bundle/chunks/{chunk-F3ECOBKA.js → chunk-4OELCF3O.js} +2 -2
  10. package/dist/cli-bundle/chunks/{chunk-2GK2IVU5.js → chunk-533L6D2N.js} +3 -3
  11. package/dist/cli-bundle/chunks/{chunk-NILQ2ZMV.js → chunk-ABFFRQRO.js} +2 -2
  12. package/dist/cli-bundle/chunks/chunk-BFZUJ5QP.js +115 -0
  13. package/dist/cli-bundle/chunks/{chunk-SBVX5CMV.js → chunk-D52QQ7LP.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-WFBYKDB2.js → chunk-DAZFCSDV.js} +2 -2
  15. package/dist/cli-bundle/chunks/{chunk-ICT6E4IW.js → chunk-EN27ZQSV.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-MRUA2Z43.js → chunk-GK2CHAT3.js} +2 -2
  17. package/dist/cli-bundle/chunks/{chunk-MTRIGD7M.js → chunk-HOGKWJU5.js} +42 -42
  18. package/dist/cli-bundle/chunks/{chunk-WX25MU4N.js → chunk-J3JM36EH.js} +3 -3
  19. package/dist/cli-bundle/chunks/{chunk-O56O7NIE.js → chunk-JRXD7SIL.js} +2 -2
  20. package/dist/cli-bundle/chunks/{chunk-5KW4WUAK.js → chunk-K46GDAKX.js} +2 -2
  21. package/dist/cli-bundle/chunks/{chunk-N45IXPCA.js → chunk-KJLGBLR3.js} +2 -2
  22. package/dist/cli-bundle/chunks/{chunk-UEEG47TU.js → chunk-NGRPD3ZO.js} +2 -2
  23. package/dist/cli-bundle/chunks/chunk-OJR2YGXF.js +31 -0
  24. package/dist/cli-bundle/chunks/chunk-QHHFXNSQ.js +3 -0
  25. package/dist/cli-bundle/chunks/{chunk-Y7CKVU56.js → chunk-RGHLQGEX.js} +2 -2
  26. package/dist/cli-bundle/chunks/{chunk-6PKWKVS6.js → chunk-VEOFWE32.js} +2 -2
  27. package/dist/cli-bundle/chunks/chunk-ZNWDYDFF.js +129 -0
  28. package/dist/cli-bundle/chunks/{indexed-receipt-blobs-KGMJVFH2.js → indexed-receipt-blobs-IEJ2QOW3.js} +2 -2
  29. package/dist/cli-bundle/chunks/item-transaction-JHPBH6N7.js +2 -0
  30. package/dist/cli-bundle/chunks/{mutation-admission-BOOCJPCU.js → mutation-admission-QUNQZCZ5.js} +2 -2
  31. package/dist/cli-bundle/chunks/{register-list-query-23OX36Q3.js → register-list-query-NZTK3AXA.js} +2 -2
  32. package/dist/cli-bundle/chunks/{register-mutation-JPJ5YNDX.js → register-mutation-2OFAMOVH.js} +2 -2
  33. package/dist/cli-bundle/chunks/{register-operations-IGR7ERY5.js → register-operations-RFMM5KZ6.js} +2 -2
  34. package/dist/cli-bundle/chunks/{register-setup-BMIFKZZP.js → register-setup-6B6Q7M5L.js} +2 -2
  35. package/dist/cli-bundle/chunks/{settlement-hook-YWSWFOZY.js → settlement-hook-UTCEZBFT.js} +2 -2
  36. package/dist/cli-bundle/chunks/{stage-ON7CYYPM.js → stage-VLI4OBVX.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/{chunk-5TWS5KOM.js → chunk-3UD6F2KQ.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/{chunk-5WCQFH6D.js → chunk-4NVPDZLX.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/{chunk-PAT6QF63.js → chunk-4UUE3YXZ.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/{chunk-2Y77HWIX.js → chunk-5UDDRPYR.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/{chunk-RPUDOJVB.js → chunk-745IDMTD.js} +2 -2
  42. package/dist/cli-bundle/focused-chunks/{chunk-3NYWMUX3.js → chunk-B6OOKKOX.js} +3 -3
  43. package/dist/cli-bundle/focused-chunks/{chunk-JCR32IAO.js → chunk-EJJWOFP5.js} +2 -2
  44. package/dist/cli-bundle/focused-chunks/chunk-FUGYXUUL.js +80 -0
  45. package/dist/cli-bundle/focused-chunks/{chunk-Z7GIVH6B.js → chunk-HMXVTWIV.js} +2 -2
  46. package/dist/cli-bundle/focused-chunks/{chunk-UQIBGLDR.js → chunk-I4Z2SCV5.js} +2 -2
  47. package/dist/cli-bundle/focused-chunks/chunk-JLN5CFYM.js +2 -0
  48. package/dist/cli-bundle/focused-chunks/chunk-K4FMZB4Y.js +23 -0
  49. package/dist/cli-bundle/focused-chunks/{chunk-DFUTCKUF.js → chunk-MQVBWFJF.js} +2 -2
  50. package/dist/cli-bundle/focused-chunks/{chunk-6GMYW42K.js → chunk-NJFMG3IK.js} +2 -2
  51. package/dist/cli-bundle/focused-chunks/{chunk-6OKPYCLU.js → chunk-PCCZ72C3.js} +54 -54
  52. package/dist/cli-bundle/focused-chunks/chunk-PF553UVP.js +44 -0
  53. package/dist/cli-bundle/focused-chunks/{chunk-VFQAZLKO.js → chunk-Q23K6WLV.js} +2 -2
  54. package/dist/cli-bundle/focused-chunks/{chunk-LVA76N27.js → chunk-QNXXOFLQ.js} +2 -2
  55. package/dist/cli-bundle/focused-chunks/{chunk-JLXGRDTG.js → chunk-QVFE5LIX.js} +3 -3
  56. package/dist/cli-bundle/focused-chunks/{chunk-VS2ZFPXD.js → chunk-RUCG6UWN.js} +2 -2
  57. package/dist/cli-bundle/focused-chunks/{chunk-WX2RVS2Y.js → chunk-SGWYNU7T.js} +2 -2
  58. package/dist/cli-bundle/focused-chunks/chunk-TGS5RXBY.js +26 -0
  59. package/dist/cli-bundle/focused-chunks/{chunk-AL7SOFUL.js → chunk-WD43E7RU.js} +2 -2
  60. package/dist/cli-bundle/focused-chunks/{chunk-GE755ODZ.js → chunk-YM4AMP7H.js} +2 -2
  61. package/dist/cli-bundle/focused-chunks/{indexed-receipt-blobs-KHWT44EK.js → indexed-receipt-blobs-FT3KF6VJ.js} +2 -2
  62. package/dist/cli-bundle/focused-chunks/{item-transaction-7VLPA2SU.js → item-transaction-F4SN7TXJ.js} +2 -2
  63. package/dist/cli-bundle/focused-chunks/{mutation-admission-2DH27R5Y.js → mutation-admission-7R2FXJ5O.js} +2 -2
  64. package/dist/cli-bundle/focused-chunks/{settlement-hook-SJV52ZTV.js → settlement-hook-KMIBD4F2.js} +2 -2
  65. package/dist/cli-bundle/focused-chunks/{stage-FYOBWQA7.js → stage-6B3O2GZ6.js} +2 -2
  66. package/dist/cli-bundle/main.js +24 -24
  67. package/dist/cli-bundle/sdk-authoring.js +1 -1
  68. package/dist/cli-bundle/sdk-contracts.js +1 -1
  69. package/dist/cli-bundle/sdk-core.js +1 -1
  70. package/dist/cli-bundle/sdk-governance.js +1 -1
  71. package/dist/cli-bundle/sdk-graph.js +1 -1
  72. package/dist/cli-bundle/sdk-merge.js +57 -57
  73. package/dist/cli-bundle/sdk-query.js +1 -1
  74. package/dist/cli-bundle/sdk-runtime.js +1 -1
  75. package/dist/cli-bundle/sdk-testing.js +1 -1
  76. package/dist/cli-bundle/sdk.js +9 -9
  77. package/dist/core/extensions/extension-types.d.ts +5 -0
  78. package/dist/core/extensions/extension-types.js +1 -1
  79. package/dist/core/item/parse.js +2 -2
  80. package/dist/core/lock/lock-confinement.d.ts +55 -0
  81. package/dist/core/lock/lock-confinement.js +2 -0
  82. package/dist/core/lock/lock-gc.js +1 -1
  83. package/dist/core/lock/lock.js +2 -2
  84. package/dist/core/shared/errors.d.ts +6 -0
  85. package/dist/core/shared/errors.js +1 -1
  86. package/dist/core/store/settings-sections.d.ts +61 -0
  87. package/dist/core/store/settings-sections.js +3 -0
  88. package/dist/core/store/settings-validator.d.ts +4 -0
  89. package/dist/core/store/settings-validator.js +1 -1
  90. package/dist/core/store/settings.d.ts +29 -2
  91. package/dist/core/store/settings.js +4 -3
  92. package/dist/core/telemetry/consent.js +2 -2
  93. package/dist/core/telemetry/runtime.js +2 -2
  94. package/dist/core/test/background-runs.js +3 -3
  95. package/dist/sdk/config.js +1 -1
  96. package/dist/sdk/extension-command-context.js +2 -2
  97. package/dist/sdk/generated/error-code-catalog-rows.d.ts +39 -0
  98. package/dist/sdk/generated/error-code-catalog-rows.js +2 -0
  99. package/dist/sdk/generated/generated-error-code-catalog-part-1.d.ts +3 -3
  100. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  101. package/dist/sdk/generated/generated-error-code-catalog-part-2.d.ts +3 -3
  102. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
  103. package/dist/sdk/generated-error-code-catalog.js +1 -1
  104. package/dist/sdk/mcp/discovery.js +1 -1
  105. package/dist/sdk/public-surface.json +1 -1
  106. package/dist/sdk/runtime-primitives.d.ts +2 -1
  107. package/dist/sdk/runtime-primitives.js +1 -1
  108. package/docs/AGENT_EVIDENCE_CONSISTENCY.md +10 -0
  109. package/docs/CONFIGURATION.md +9 -0
  110. package/docs/DEVELOPMENT_DEPENDENCY_SECURITY.md +9 -6
  111. package/docs/RELEASING.md +22 -2
  112. package/docs/SDK.md +28 -1
  113. package/docs/SDK_CONFIGURATION_SAFETY.md +55 -0
  114. package/docs/TESTING.md +2 -1
  115. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +12 -3
  116. package/marketplace.json +1 -1
  117. package/package.json +9 -3
  118. package/packages/pm-beads/package.json +1 -1
  119. package/packages/pm-calendar/package.json +1 -1
  120. package/packages/pm-command-kit/package.json +1 -1
  121. package/packages/pm-digital-twin/package.json +1 -1
  122. package/packages/pm-governance-audit/package.json +1 -1
  123. package/packages/pm-guide-shell/package.json +1 -1
  124. package/packages/pm-kanban/package.json +1 -1
  125. package/packages/pm-lifecycle-hooks/package.json +1 -1
  126. package/packages/pm-linked-test-adapters/package.json +1 -1
  127. package/packages/pm-search-advanced/package.json +1 -1
  128. package/packages/pm-templates/package.json +1 -1
  129. package/packages/pm-todos/package.json +1 -1
  130. package/packages/pm-vcs/package.json +1 -1
  131. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  132. package/plugins/pm-claude/package.json +1 -1
  133. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  134. package/plugins/pm-codex/package.json +1 -1
  135. package/plugins/pm-codex/plugin.json +1 -1
  136. package/runtime-dependencies.json +1 -1
  137. package/dist/cli-bundle/chunks/chunk-5WVE7XBS.js +0 -114
  138. package/dist/cli-bundle/chunks/chunk-E74BORFX.js +0 -128
  139. package/dist/cli-bundle/chunks/chunk-MP2DQJH2.js +0 -3
  140. package/dist/cli-bundle/chunks/chunk-O6TFUV6M.js +0 -31
  141. package/dist/cli-bundle/chunks/item-transaction-Q5S5YLEJ.js +0 -2
  142. package/dist/cli-bundle/focused-chunks/chunk-3Z53POXU.js +0 -2
  143. package/dist/cli-bundle/focused-chunks/chunk-7WJDRZOR.js +0 -22
  144. package/dist/cli-bundle/focused-chunks/chunk-CIQ6YWCW.js +0 -26
  145. package/dist/cli-bundle/focused-chunks/chunk-M22TI7LP.js +0 -79
  146. package/dist/cli-bundle/focused-chunks/chunk-SXZM4PSS.js +0 -44
@@ -1,4 +1,4 @@
1
- import{A as h,C as u,G as p}from"./chunk-WX25MU4N.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 h,C as u,G as p}from"./chunk-J3JM36EH.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 h,C as u,G as p}from"./chunk-WX25MU4N.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{d as a,f as b,R as c,k as d,G as e,S as f};
9
- //# sourceMappingURL=chunk-SBVX5CMV.js.map
9
+ //# sourceMappingURL=chunk-D52QQ7LP.js.map
@@ -1,2 +1,2 @@
1
- import{Oa as C,Qa as P,Sa as k,Ta as N,ca as _,da as R,lb as O}from"./chunk-E74BORFX.js";import{$h as x,Ea as c,Id as b,Ma as h,Mi as u,Sa as y,Yi as g,bi as D,ci as T,jf as E,ki as H,ld as p,oi as M}from"./chunk-5WVE7XBS.js";import{A as m,C as f,E as w}from"./chunk-WX25MU4N.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]="59842825-3a81-53f4-845d-db2257ec6286")}catch{}})();async function B(e){let t=h(process.cwd(),e);await g(t);let r=await u(t),s=c(r,p());return{pmRoot:t,settings:r,typeRegistry:s}}async function z(e,t,r,s){y(e,_(t));let o=await O(e,t,r.id_prefix,r.item_format,s);if(o)return{id:o.id,historyPath:y(e,o.id),located:o};let n=R(t,r.id_prefix),a=_(t),i=n===a?[n]:[n,a];for(let d of i){let l=y(e,d);if(await w(l))return{id:d,historyPath:l,located:null}}throw new f(`Item ${t} not found`,m.NOT_FOUND)}(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]="eb2e6046-156c-56ee-a03a-ecaa1cccfb45")}catch{}})();function ye(e,t){let r=M(e),s=e.length>0?e[e.length-1].after_hash:T(),o=t===void 0||r.item_hash_version===void 0?void 0:D(t,r.item_hash_version,b(e.at(-1)?.hash_algorithm)),n=t===void 0?void 0:o===void 0?x(t):o[Math.max(0,o.indexOf(s))],a=n===void 0?void 0:n===s,i=[...r.errors];return a===!1&&i.push("verify_failed:current_item_hash_mismatch"),{ok:i.length===0,entries:e.length,errors:i,latest_after_hash:e.length>0?e[e.length-1].after_hash:void 0,current_item_hash:n,current_matches_latest:a}}async function pe(e,t,r={}){let s=h(r.cwd??process.cwd(),r.pmRoot);await g(s);let o=await u(s),n=c(o,p()),a=await z(s,e,o,n.type_to_folder),i=await E(a.historyPath,a.id);if(i.length===0)throw new f(`No history exists for ${a.id}; point-in-time reads are unavailable.`,m.NOT_FOUND);let d=P(t,i),l=N(k(i,d.historyIndex),d),I=H(l,{schema:o.schema});if(I.metadata.id!==a.id)throw new f(`History target resolved to item ${I.metadata.id}, expected ${a.id}.`,m.GENERIC_FAILURE);let A=i[d.historyIndex],v=C(i,!0);return{document:I,reconstructed:!0,as_of_version:v===null?null:v+d.historyIndex+1,as_of_timestamp:A.ts,target:d,history_length:i.length}}(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]="e524f0ad-faad-5d89-b8f5-1283979919ad")}catch{}})();export{B as a,z as b,ye as c,pe as d};
2
- //# sourceMappingURL=chunk-WFBYKDB2.js.map
1
+ import{Oa as C,Qa as P,Sa as k,Ta as N,ca as _,da as R,lb as O}from"./chunk-ZNWDYDFF.js";import{$i as g,Ea as c,Id as b,Ma as h,Pi as u,Sa as y,ai as x,ci as D,di as T,kf as E,ld as p,li as H,pi as M}from"./chunk-BFZUJ5QP.js";import{A as m,C as f,E as w}from"./chunk-J3JM36EH.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]="59842825-3a81-53f4-845d-db2257ec6286")}catch{}})();async function B(e){let t=h(process.cwd(),e);await g(t);let r=await u(t),s=c(r,p());return{pmRoot:t,settings:r,typeRegistry:s}}async function z(e,t,r,s){y(e,_(t));let o=await O(e,t,r.id_prefix,r.item_format,s);if(o)return{id:o.id,historyPath:y(e,o.id),located:o};let n=R(t,r.id_prefix),a=_(t),i=n===a?[n]:[n,a];for(let d of i){let l=y(e,d);if(await w(l))return{id:d,historyPath:l,located:null}}throw new f(`Item ${t} not found`,m.NOT_FOUND)}(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]="eb2e6046-156c-56ee-a03a-ecaa1cccfb45")}catch{}})();function ye(e,t){let r=M(e),s=e.length>0?e[e.length-1].after_hash:T(),o=t===void 0||r.item_hash_version===void 0?void 0:D(t,r.item_hash_version,b(e.at(-1)?.hash_algorithm)),n=t===void 0?void 0:o===void 0?x(t):o[Math.max(0,o.indexOf(s))],a=n===void 0?void 0:n===s,i=[...r.errors];return a===!1&&i.push("verify_failed:current_item_hash_mismatch"),{ok:i.length===0,entries:e.length,errors:i,latest_after_hash:e.length>0?e[e.length-1].after_hash:void 0,current_item_hash:n,current_matches_latest:a}}async function pe(e,t,r={}){let s=h(r.cwd??process.cwd(),r.pmRoot);await g(s);let o=await u(s),n=c(o,p()),a=await z(s,e,o,n.type_to_folder),i=await E(a.historyPath,a.id);if(i.length===0)throw new f(`No history exists for ${a.id}; point-in-time reads are unavailable.`,m.NOT_FOUND);let d=P(t,i),l=N(k(i,d.historyIndex),d),I=H(l,{schema:o.schema});if(I.metadata.id!==a.id)throw new f(`History target resolved to item ${I.metadata.id}, expected ${a.id}.`,m.GENERIC_FAILURE);let A=i[d.historyIndex],v=C(i,!0);return{document:I,reconstructed:!0,as_of_version:v===null?null:v+d.historyIndex+1,as_of_timestamp:A.ts,target:d,history_length:i.length}}(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]="e524f0ad-faad-5d89-b8f5-1283979919ad")}catch{}})();export{B as a,z as b,ye as c,pe as d};
2
+ //# sourceMappingURL=chunk-DAZFCSDV.js.map
@@ -1,2 +1,2 @@
1
- import{Ue as h}from"./chunk-E74BORFX.js";import{$ as C,Bb as $,Cb as R,Hb as V,Hf as L,If as W,Jh as U,Qb as v,W as I,X as k,Y as F,Z as A,_ as g,cf as G,df as S,ec as B,fb as D,fc as z,t as N,u as p,w as E,x as M,y as w}from"./chunk-5WVE7XBS.js";import{A as y,C as _}from"./chunk-WX25MU4N.js";import{Command as ae}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]="df7f766c-1121-5712-b562-423d2cda95ce")}catch{}})();function nt(e){return new ae().name("pm").description("Universal, flexible, extensible, agent-optimized project management CLI for any project or programming language.").version(e).showHelpAfterError(!1).allowExcessArguments(!1).allowUnknownOption(!1).configureOutput({writeOut:t=>{U(t)},writeErr:()=>{}}).option("--json","Output JSON instead of TOON; mutations emit a flat receipt with top-level id/status/changed_field_count while reads use documented entity or collection envelopes").option("--lean","Omit null and empty containers from JSON output").option("--token-accounting","Attach a bounded per-section token-cost receipt to command output").option("--output-include <fields>","Retain comma-separated fields or sections in read output").option("--output-limit <count>","Bound rows in read output").option("--output-budget <tokens|unbounded>","Bound estimated tokens in read output or explicitly disable the default ceiling").option("--output-format <toon|json>","Select the result encoding for reads and mutations").option("--output-session <state>","Carry a JSON session budget and served-item ledger across read calls").option("--output-cursor <cursor>","Resume continuation_kind=output_cursor").option("--output-row-contract","Include row selectors, encoding metadata, and read-output receipts").option("--quiet","Suppress stdout output").option("--no-changed-fields","Omit the changed_fields array from mutation output (keeps changed_field_count)").option("--full-changed-fields","Restore the legacy full mutation envelope and changed_fields array").option("--id-only","Print only id and status for single-item mutation output").option("--pm-path <dir>","Explicit tracker storage path for this command (preferred over --path)").option("--path <dir>","Backward-compatible alias for --pm-path; this is the tracker storage path, not a workspace cwd").option("--no-extensions","Disable extension loading").option("--no-pager","Disable pager integration for help and long output").option("--explain","Render extended rationale and examples in help output").option("--all","Reveal every public command and compatibility alias").option("--profile","Print deterministic timing diagnostics").option("--author <id>","Override mutation author for this invocation").exitOverride()}(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]="8efedca0-725e-520f-ad06-825a0cccddaa")}catch{}})();var j=new Set(["append","claim","close","close-task","comments","copy","delete","deps","docs","files","focus","get","history","history-compact","history-redact","history-repair","learnings","notes","pause-task","release","restore","start-task","test","update"]),q=new Map([["files","discover"],["item","complete"]]),le=new Map([["append",1],["close",1],["close-task",1],["comments",1],["item complete",1],["learnings",1],["notes",1],["restore",1]]);function K(e){let t=p(e?.trim().toLowerCase()??"");return j.has(t)||q.has(t)}function ce(e,t,n){let o=j.has(n)?t+1:void 0,s=g(e.slice(t+1));if(s===void 0)return o;let r=t+1+s,a=`${n} ${e[r]}`,i=p(a);return i===a?n==="item"&&e[r]==="complete"?r+1:o:K(i)?P(e,r,i):void 0}function P(e,t,n){if(["history","context","ctx","update","close","item"].includes(n))return ce(e,t,n);let o=q.get(n);if(o===void 0)return t+1;let s=e[t+1]?.toLowerCase()===o;return t+(s?2:1)}function ue(e){let t=new Map;for(let n of h(e))for(let o of[n.flag,n.short,...n.aliases??[]])o&&t.set(o,n);return t}function de(e){let t=[];for(let n=0;n<e.length;n+=1){let o=e[n];if(o==="--")break;o==="--id"?(t.push({index:n,consumed:2,value:e[n+1]}),n+=1):o.startsWith("--id=")&&t.push({index:n,consumed:1,value:o.slice(5)})}return t}function fe(e,t,n){if(e.indexOf("=")>=0||t===void 0||t.startsWith("-"))return!1;let o=n.get(e);return o!==void 0&&o.value_type!=="boolean"}function pe(e,t,n,o,s){let r=0;for(let a=t;a<e.length;a+=1){let i=e[a];if(i==="--")break;if(i==="--id"){a+=1;continue}if(!i.startsWith("--id=")){if(!i.startsWith("-")){if(a<o)return!0;r+=1;continue}fe(i,e[a+1],s)&&(a+=1)}}return r>(le.get(p(n))??0)}function Y(e){let t=g(e),n=t===void 0?void 0:e[t]?.toLowerCase();if(n!=="context"&&n!=="ctx"&&!K(n))return{argv:[...e],changed:!1,conflict:!1};let o=P(e,t,n);if(o===void 0)return{argv:[...e],changed:!1,conflict:!1};let s=o>t+1?`${p(e.slice(t,o-1).join(" "))} ${e[o-1]}`:n,r=ue(s),a=de(e),i=a[0];if(!i||!i.value?.trim())return{argv:[...e],changed:!1,conflict:!1};if(a.length>1||pe(e,o,s,i.index,r))return{argv:[...e],changed:!1,conflict:!0,itemId:i.value};let l=[...e.slice(0,i.index),...e.slice(i.index+i.consumed)],c=g(l),u=P(l,c,n);return l.splice(u,0,i.value),{argv:l,changed:!0,conflict:!1,itemId:i.value}}(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]="7b271a35-800c-52bf-9368-0410e76b8d4e")}catch{}})();var me=new Set(["--output-include","--output-limit","--output-budget","--output-format","--output-session","--output-cursor"]),he=new Set(["toon","json"]);function ge(e,t,n){let o=e[t];if(k.has(o))return n.booleanFlags.add(o),1;let s=o.indexOf("="),r=s>0?o.slice(0,s):o;if(!I.has(r))return 1;let a=s>0?o.slice(s+1):void 0,i=a===void 0&&A(r,e[t+1]),l=a??(i?e[t+1]:void 0);return r==="--author"?n.author=l??"":typeof l=="string"&&l.length>0&&(me.has(r)?n.outputValues:n.pathValues).set(r,l),i?2:1}function be(e){return e.outputValues.get("--output-format")!=="toon"&&(e.booleanFlags.has("--json")||e.outputValues.get("--output-format")==="json"||e.pathValues.get("--format")?.trim().toLowerCase()==="json")}function ye(e){let t={booleanFlags:new Set,outputValues:new Map,pathValues:new Map},n=0;for(;n<e.length&&e[n]!=="--";)n+=ge(e,n,t);return{path:t.pathValues.get("--pm-path")??t.pathValues.get("--path"),noExtensions:t.booleanFlags.has("--no-extensions")||["history attest","history-attest"].includes(ee(e)??""),noPager:t.booleanFlags.has("--no-pager"),json:be(t),quiet:t.booleanFlags.has("--quiet"),lean:t.booleanFlags.has("--lean"),tokenAccounting:t.booleanFlags.has("--token-accounting"),...t.booleanFlags.has("--output-row-contract")?{outputRowContract:!0}:{},...t.outputValues.get("--output-include")===void 0?{}:{outputInclude:t.outputValues.get("--output-include")},...t.outputValues.get("--output-limit")===void 0?{}:{outputLimit:t.outputValues.get("--output-limit")},...t.outputValues.get("--output-budget")===void 0?{}:{outputBudget:t.outputValues.get("--output-budget")},...he.has(t.outputValues.get("--output-format"))?{outputFormat:t.outputValues.get("--output-format")}:{},...t.outputValues.get("--output-session")===void 0?{}:{outputSession:t.outputValues.get("--output-session")},...t.outputValues.get("--output-cursor")===void 0?{}:{outputCursor:t.outputValues.get("--output-cursor")},...t.author===""?{authorMissingValue:!0}:t.author!==void 0?{author:t.author}:{}}}function Z(e){let t=[],n=0;for(;n<e.length;){let o=e[n];if(o==="--")break;if(k.has(o)||o==="--profile"||o==="--id-only"||o==="--full-changed-fields"||o==="--explain"){n+=1;continue}if(I.has(o)){n+=A(o,e[n+1])?2:1;continue}if(F(o)){n+=1;continue}t.push(o),n+=1}return t}function _e(e){let t=Z(e);if(t[0]?.trim().toLowerCase()==="help"){let o=[];for(let s=1;s<t.length;s+=1){let r=t[s];if(r.startsWith("-"))break;o.push(r.trim().toLowerCase())}return{requested:!0,commandPathTokens:o}}if(t.findIndex(o=>o==="--help"||o==="-h")<0)return{requested:!1,commandPathTokens:[]};let n=[];for(let o of t){if(o.startsWith("-"))break;n.push(o.trim().toLowerCase())}return{requested:!0,commandPathTokens:n}}function T(e){return g(e)}function Ie(e){return C(e)}function we(e,t){return t.noPager?!0:process.stdout.isTTY===!0?!1:_e(e).requested}function bt(e){let t=["PAGER","MANPAGER","GIT_PAGER","LESS"],n=t.map(r=>process.env[r]),o=()=>{for(let[r,a]of t.entries()){let i=n[r];i===void 0?delete process.env[a]:process.env[a]=i}},s=ye(e);return we(e,s)&&(process.env.PAGER="cat",process.env.MANPAGER="cat",process.env.GIT_PAGER="cat",(typeof process.env.LESS!="string"||process.env.LESS.trim().length===0)&&(process.env.LESS="FRX")),o}var ke=new Set(["install","uninstall","explore","manage","doctor","adopt","adopt-all","activate","deactivate"]);function Ce(e){let t=T(e);if(t===void 0||e[t]!=="extension")return[...e];let n=e[t+1];if(!n||n.startsWith("-"))return[...e];if(!ke.has(n))return[...e];if(e.includes("--help")||e.includes("-h"))return[...e];let o=`--${n}`;return e.includes(o)?[...e]:[...e.slice(0,t+1),o,...e.slice(t+2)]}var ve=new Set(["pm","pm-cli"]);function Se(e,t){let n=T(e);if(n===void 0)return e;let o=e[n];return ve.has(o.trim().toLowerCase())?(t.push({from:o,to:[],reason:"executable_alias",confidence:"high"}),[...e.slice(0,n),...e.slice(n+1)]):e}function Te(e,t){let n=T(e);if(n!==void 0&&e[n]==="help"){let i=T(e.slice(n+1));n=i===void 0?void 0:n+1+i}if(n===void 0)return e;let o=e[n],s=M[o.trim().toLowerCase()];if(!s)return e;let r=s.split(" "),a=[...e.slice(0,n),...r,...e.slice(n+1)];return t.push({from:o,to:r,reason:"command_alias",confidence:"high"}),a}function x(e){return e.replace(/^--?/,"").replace(/_/g,"-").replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function X(e){return x(e).replace(/-/g,"")}function J(e,t,n){let o=e.get(t);if(o===void 0){e.set(t,n);return}o!==n&&e.set(t,null)}function xe(e){let t=[],n=o=>{typeof o=="string"&&o.startsWith("--")&&t.push(o)};n(e.flag);for(let o of e.aliases??[])n(o);return t}function Oe(e,t){let n=t??h(e),o=new Map,s=new Map,r=new Map,a=new Set;for(let i of n){let l=xe(i);if(l.length===0)continue;let c=`--${x(l[0])}`;for(let d of l)J(o,x(d),c),J(s,X(d),c);let u=X(c);r.has(c)||r.set(c,u),i.list===!0&&a.add(c)}return{canonicalByNormalized:o,canonicalByCompact:s,canonicalComparables:[...r.entries()].map(([i,l])=>({canonicalFlag:i,comparable:l})),listCanonicalFlags:a}}function H(e,t){let n=x(e),o=t.canonicalByNormalized.get(n);if(typeof o=="string")return{flag:o,reason:"flag_alias",confidence:"high"};let s=n.replace(/-/g,""),r=t.canonicalByCompact.get(s);if(typeof r=="string")return{flag:r,reason:"flag_alias",confidence:"high"};let a=s.length>=8?2:1,i=Number.POSITIVE_INFINITY,l,c=!1;for(let u of t.canonicalComparables){let d=v(s,u.comparable,a);if(d!==null){if(d<i){i=d,l=u.canonicalFlag,c=!1;continue}d===i&&l!==u.canonicalFlag&&(c=!0)}}return!l||c||!Number.isFinite(i)||i<=0?null:{flag:l,reason:"flag_typo",confidence:i>=2?"medium":"high"}}function yt(e){let t=[`${e}s`];return e.endsWith("y")&&e.length>1&&t.push(`${e.slice(0,-1)}ies`),t}function Ee(e,t=!1){if(t||e.includes("://"))return null;let n=e.match(/^([A-Za-z][A-Za-z0-9_-]{1,63})([:=])(.*)$/);if(!n)return null;let o=n[1],s=n[3];return s.length===0?null:{key:o,value:s}}function Ae(e,t,n=!1){if(n||!e.startsWith("--"))return{tokens:[e]};let o=e.indexOf("="),s=o>=0?e.slice(0,o):e,r=o>=0?e.slice(o+1):void 0,a=H(s,t);if(!a)return{tokens:[e]};let i=r===void 0?a.flag:`${a.flag}=${r}`;return i===e?{tokens:[e]}:{tokens:[i],event:{from:e,to:[i],reason:a.reason,confidence:a.confidence}}}function Le(e){let t=new Set,n=!1;for(let o=0;o<e.length;o+=1){if(n){t.add(o),n=!1;continue}let s=e[o];n=s==="--path"||s==="--pm-path"}return t}function Pe(e){if(!e.startsWith("--"))return null;let t=e.indexOf("=");return t<0?{flag:e}:{flag:e.slice(0,t),inlineValue:e.slice(t+1)}}function Ne(e,t,n){n.push(e[t]);let o=e[t+1];return typeof o=="string"&&o!=="--"?(n.push(o),t+2):t+1}function Me(e,t,n,o){if(n.inlineValue!==void 0)return{originalTokens:[e[t]],value:n.inlineValue,consumed:1};let s=[],r=t+1;for(;r<e.length&&e[r]!=="--"&&!e[r].startsWith("-")&&(s.length===0||o.has(n.flag));)s.push(e[r]),r+=1;let a=s.length===0?1:1+s.length;return{originalTokens:e.slice(t,t+a),value:s.length===0?void 0:s.join(","),consumed:a}}function Fe(e,t,n,o){let s=e.get(n);if(s){s.values.push(o.value),s.occurrences+=1;return}e.set(n,{outputIndex:t.length,originalTokens:o.originalTokens,values:[o.value],occurrences:1}),t.push(null)}function De(e,t){let n=[],o=[];for(let[s,r]of e){if(!(r.occurrences>=2||t.has(s)&&r.originalTokens.length>2)){o.push({outputIndex:r.outputIndex,tokens:r.originalTokens});continue}let a=`${s}=${r.values.join(",")}`;o.push({outputIndex:r.outputIndex,tokens:[a]}),n.push({from:`${s} (x${r.occurrences})`,to:[a],reason:"list_merge",confidence:"high"})}return{events:n,splices:o}}function $e(e,t){t.sort((n,o)=>o.outputIndex-n.outputIndex);for(let n of t)e.splice(n.outputIndex,1,...n.tokens)}function Re(e,t,n=new Set,o=new Set){if(t.size===0)return{argv:[...e],events:[]};let s=[],r=new Map,a=0;for(;a<e.length;){let c=e[a];if(c==="--"){s.push(...e.slice(a));break}if(n.has(c)){a=Ne(e,a,s);continue}let u=Pe(c);if(!u||!t.has(u.flag)){s.push(c),a+=1;continue}let d=Me(e,a,u,o);if(d.value===void 0){s.push(c),a+=d.consumed;continue}Fe(r,s,u.flag,{originalTokens:d.originalTokens,value:d.value}),a+=d.consumed}let{events:i,splices:l}=De(r,o);return $e(s,l),{argv:s,events:i}}var Q=new Map([["--add",new Set(["command","cmd","path"])],["--remove",new Set(["command","path"])]]);function Ve(e,t){if(e!=="test"||t.length<2)return!1;let n=t[t.length-1],o=t[t.length-2],s=Q.get(o);return s!==void 0&&s.has(n)}function Be(e,t,n){if(t!=="test")return e;let o=[],s=0;for(;s<e.length;){let r=e[s];if(r==="--")return o.push(...e.slice(s)),o;let a=Q.get(r),i=a?e[s+1]:void 0;if(!a||typeof i!="string"||!a.has(i)){o.push(r),s+=1;continue}let l=s+2;for(;l<e.length&&!e[l].startsWith("-");)l+=1;if(l-(s+2)!==1){o.push(r),s+=1;continue}let c=e[s+2],u=`${i}=${c}`;o.push(r,u),n.push({from:`${r} ${i} ${c}`,to:[r,u],reason:"bare_key_value",confidence:"high"}),s+=3}return o}function ze(e,t,n,o){let s=[],r=Le(e);for(let a=0;a<e.length;a+=1){let i=e[a];if(i==="--"){s.push(...e.slice(a));break}let l=r.has(a),c=s[s.length-1];if(i.startsWith("--")){let b=Ae(i,t,l);s.push(...b.tokens),b.event&&o.push(b.event);continue}let u=Ee(i,l);if(!u||typeof c=="string"&&c.startsWith("-")&&!c.includes("=")||["search","comments","notes","learnings"].includes(n)||Ve(n,s)){s.push(i);continue}let d=H(u.key,t);if(!d){s.push(i);continue}let m=u.value.startsWith("-")?[`${d.flag}=${u.value}`]:[d.flag,u.value];s.push(...m),o.push({from:i,to:m,reason:"bare_key_value",confidence:d.confidence})}return s}function Ge(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(n==="--")break;if(n==="--verify"){let o=e[t+1];if(o===void 0||o==="--")throw new _("history attest --verify requires a bundle file.",y.USAGE);e.splice(t,2,`--verify=${o}`)}else(I.has(n)||n==="--output"||n==="--hash-algorithm")&&(t+=1)}}function We(e,t){if(!e.some(o=>o==="--help"||o==="-h"))return;let n=new Set(h(t).flatMap(o=>[o.flag,...o.aliases??[],...o.short===void 0?[]:[o.short]]));for(let o=0;o<e.length;o+=1){let s=e[o];if(s==="--")break;s!=="--help"&&s!=="-h"||n.has(e[o-1])&&!k.has(e[o-1])&&(e[o-1]=s)}}function _t(e){let t=[],n=Se(e,t),o=Ce(n);(o.length!==n.length||o.some((b,re)=>b!==n[re]))&&t.push({from:n.join(" "),to:[...o],reason:"legacy_extension_action",confidence:"high"});let s=Te(o,t),r=Y(s);if(r.conflict)throw new _("Provide the item id either positionally or with --id, not both.",y.USAGE);r.changed&&t.push({from:`--id ${r.itemId}`,to:[r.itemId],reason:"item_id_alias",confidence:"high"});let a=Ie(r.argv),i=ee(r.argv),l=p(i??a??""),c=Oe(i??a),u=ze(r.argv,c,l,t),d=Be(u,l,t),m=Re(d,c.listCanonicalFlags,I,a==="create"?new Set(["--tags"]):new Set);for(let b of m.events)t.push(b);return We(m.argv,i??a),i==="history attest"&&Ge(m.argv),{argv:m.argv,commandName:a,trace:t}}function ee(e){let t=Z(e),n=t[0]?.trim().toLowerCase(),o=t[1]?.trim().toLowerCase(),s=N(t);return s?s.canonical:(n==="extension"||n==="package"||n==="packages")&&typeof o=="string"&&o.length>0&&!o.startsWith("-")?`${n} ${o}`:n}function It(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(n==="--")break;if(n==="--type"){let o=e[t+1];if(typeof o=="string"&&o.trim().length>0)return o.trim();continue}if(n.startsWith("--type=")){let o=n.slice(7).trim();if(o.length>0)return o}}}(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]="fb625cd9-f8a8-56cf-88ab-abef64051497")}catch{}})();function St(e){if(e===void 0)return()=>{};let t=e.trim();if(t.length===0)throw new _("--author requires a non-empty value.",y.USAGE,{code:"missing_required_argument",nextSteps:["Pass an explicit author identifier with --author <id>."]});let n=G();S(t);let o=!1;return()=>{o||(o=!0,n===void 0?S(void 0):S(n))}}(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]="d0e60f7e-e0a8-5ef4-9af7-4a1f102ccb7d")}catch{}})();var f=Object.freeze({clock:"PM_CLOCK",tickMs:"PM_CLOCK_TICK_MS",seed:"PM_SEED"});function O(e,t,n,o){return new _(e,y.USAGE,{code:"invalid_reproducible_process_environment",reason:t,field:n,required:`${f.clock} and ${f.seed}; ${f.tickMs} is optional`,nextSteps:[`Set ${f.clock} to an ISO-8601 instant with Z or a numeric UTC offset and ${f.seed} to a non-empty reproducibility seed.`,`Optionally set ${f.tickMs} to a non-negative integer; it defaults to 1.`,"Unset all three variables to retain normal wall-clock and cryptographic-random behavior."],recovery:{recovery_mode:"compact",provided_fields:o,missing_required_fields:t==="incomplete"?[f.clock,f.seed].filter(s=>!o.includes(s)):void 0}})}function Ue(e){let t=e[f.clock],n=e[f.tickMs],o=e[f.seed],s=[[f.clock,t],[f.tickMs,n],[f.seed,o]].filter(a=>a[1]!==void 0).map(([a])=>a);if(s.length===0)return;if(t===void 0||o===void 0)throw O("Reproducible process execution requires PM_CLOCK and PM_SEED together.","incomplete",t===void 0?f.clock:f.seed,s);if(o.trim().length===0)throw O(`${f.seed} must not be empty.`,"invalid_value",f.seed,s);if(!V(t))throw O(`${f.clock} must be a valid ISO-8601 instant with Z or a numeric UTC offset.`,"invalid_value",f.clock,s);let r=n===void 0?1:Number(n);if(n?.trim().length===0||!Number.isSafeInteger(r)||r<0)throw O(`${f.tickMs} must be a non-negative integer.`,"invalid_value",f.tickMs,s);return $({clock:t,seed:o,tickMs:r})}function je(e){let t=Ue(e);return t===void 0?n=>n():R(t)}async function Lt(e,t){return je(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]="682c27fa-94d8-529b-92fc-ac8a2eb7e138")}catch{}})();var te=new Set([...Object.values(B),...z,"--full","--brief","--compact","--summary","--fields","--section","--token-budget"]),ne=new Set(["--full-changed-fields","--no-changed-fields","--id-only"]);function zt(e,t){if(!["block","unblock"].includes(e)||t.includes(e)||!t.includes("update"))return;let n=new Set(h("update").map(o=>o.flag));if((e==="block"?["--blocked-by","--blocked-reason"]:["--unset","--unblock-note"]).every(o=>n.has(o)))return e==="block"?{examples:[["update","<item-id>","--blocked-by","<blocker-id>","--blocked-reason","<reason>"]],nextSteps:["Choose the actual item and blocker identifiers before running update. --blocked-by records the blocker field and its blocked_by relationship."]}:{examples:[["update","<item-id>","--unset","blocked-by","--unset","blocked-reason","--unblock-note","<note>"]],nextSteps:["Inspect the item's blockers before running update. --unset blocked-by removes the blocker field and all blocked_by relationships; --unset blocked-reason clears the stale reason. --unblock-note alone records a note and does not unblock the item.","If your project also uses a blocked lifecycle status, choose its appropriate next status separately with update --status."]}}function qe(e,t){let n=e.includes("="),o=n?e.slice(e.indexOf("=")+1):t;if(!(!o||o.startsWith("--")))return{consumed:n?1:2,replacement:["--from",o],conflicts:["--from"]}}var Ke=["--depth","--output-include","--fields","--section","--for"];function Ye(e){let t=L(p(e.trim().toLowerCase()));if(t===void 0)return;let n=h(t),o=n.flatMap(a=>[a.flag,...a.aliases??[]]),s=[...W(t).keys()].filter(a=>o.includes(`--${a}`)),r=[...n.find(a=>a.flag==="--depth")?.values??[]];if(!(s.length===0&&r.length===0))return{command:t,modes:s,depth_values:r,declared_flags:o}}function Gt(e){return[...e.depth_values.length>0?[`--depth ${e.depth_values.join("|")}`]:[],...e.modes.map(t=>`--${t}`)].join(", ")}function Xe(e,t,n,o){let s=Ye(e);if(s===void 0||s.declared_flags.includes(t))return;let r=[...Ke,...s.modes.map(i=>`--${i}`)].filter(i=>i!==t);if(t==="--depth"){let i=n.includes("="),l=(i?n.slice(n.indexOf("=")+1):o)?.trim().toLowerCase();if(!l)return;let c=i?1:2;return s.modes.includes(l)?{consumed:c,replacement:[`--${l}`],conflicts:r}:l==="standard"?{consumed:c,replacement:[],conflicts:r}:void 0}let a=t.slice(2);return n===t&&s.depth_values.includes(a)?{consumed:1,replacement:["--depth",a],conflicts:r}:void 0}function Je(e,t,n,o){return t==="--since"&&e==="activity"?qe(n,o):t==="--toon"&&n===t?{consumed:1,replacement:["--output-format","toon"],conflicts:["--json","--format","--output-format","--stream"]}:Xe(e,t,n,o)}function Ze(e){let t=g(e);if(t===void 0)return;let n=e[t].trim().toLowerCase(),o=`${n} ${e[t+1]?.trim().toLowerCase()??""}`,s=p(o);return s!==o.trim()?s:n==="ctx"?"context":p(n)}function Wt(e,t,n){let o=e==="ctx"?"context":p(e);if(L(o)===void 0||t.includes("--")||Ze(t)!==o)return;let s=n.split("=",1)[0],r=t.flatMap((d,m)=>d===s||d.startsWith(`${s}=`)?[m]:[]);if(r.length!==1)return;let a=r[0],i=Je(o,s,t[a],t[a+1]);if(!i)return;let{replacement:l,consumed:c,conflicts:u}=i;if(!t.some(d=>u.includes(d.split("=",1)[0])))return[...t.slice(0,a),...l,...t.slice(a+c)]}function oe(e){let t=e.split("=",1)[0].replaceAll("_","-");return te.has(t)||t.length>=5&&[...te].some(n=>n.startsWith(t))}function Ut(e,t){let n=e.split("=",1)[0].replaceAll("_","-");return oe(n)?!ne.has(t):ne.has(n)?!oe(t):!0}function se(e){return e.trim().match(/--[a-z0-9][a-z0-9_-]*/i)?.[0]?.replaceAll("_","-").toLowerCase()}function jt(e){if(!(!Array.isArray(e)||e.length===0))return C(e)}function He(e,t){let n=se(t);if(!n)return;let o=h(e).find(s=>s.flag===n||s.aliases?.includes(n));return o?o.value_type==="boolean"?null:`<${o.value_name??"value"}>`:"<value>"}function qt(e,t,n){let o=[...e],s=o.indexOf("--"),r=s<0?o.length:s;for(let a of n){let i=se(a);if(!i||o.slice(0,r).some(u=>u===i||u.startsWith(`${i}=`)))continue;let l=He(t,i),c=l?[i,l]:[i];o.splice(r,0,...c),r+=c.length}return o.length===e.length?void 0:D(o)}(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]="bd9a8d3b-bc6f-5309-a3fb-7e5f41ef9dab")}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]="12066389-daef-5fce-b7a6-0ecffa926d66")}catch{}})();function Qt(e,t){let n=e.trim().split(/\s+/u);if(!(n.length<2||t.includes(n.join(" "))))for(let o=1;o<n.length;o+=1){if(!t.includes(n.slice(0,o).join(" ")))return;let s=n.slice(o).join(" "),r=w(s),a=new Set(t.filter(i=>i===s||i.endsWith(` ${s}`)||i===r?.canonical).map(i=>w(i)?.canonical??i).filter(i=>t.includes(i)));if(a.size>0)return a.size===1?[...a][0]:void 0}}var Qe={add:["create","append"],fetch:["get"],inspect:["get","health"],log:["history","comments","notes"],ls:["list"],pause:["release"],read:["get"],remove:["delete"],rm:["delete"],show:["get"],start:["start-task"]};function ie(e,t){let n=e.trim().toLowerCase(),o=t.trim().toLowerCase();if(o.length===0)return Number.POSITIVE_INFINITY;let s=n.split(" "),r=Qe[o]?.indexOf(p(n));if(r!==void 0&&r>=0)return r;if(n===o)return 10;if(s.includes(o))return 11;if(s.some(l=>l.startsWith(o)))return 12;let a=o.length>=5?2:1,i=Number.POSITIVE_INFINITY;for(let l of s){let c=v(l,o,a);c!==null&&(i=Math.min(i,c))}return Number.isFinite(i)?20+i:n.includes(o)?30:Number.POSITIVE_INFINITY}function en(e,t){return e.map(n=>({path:n,score:ie(n,t)})).filter(n=>Number.isFinite(n.score)).sort((n,o)=>n.score!==o.score?n.score-o.score:n.path===o.path?0:n.path<o.path?-1:1).map(n=>n.path)}function tn(e,t,n){let o=new Set(t),s=E.filter(i=>i.lifecycle==="deprecated").slice().sort((i,l)=>l.alias.length-i.alias.length),r=[],a=e.flatMap(i=>{let l=s.find(u=>i===u.alias||i.startsWith(`${u.alias} `)),c=i;if(l){let u=i.slice(l.alias.length);if(!o.has(`${l.canonical}${u}`))return[];c=`${l.canonical_argv.join(" ")}${u}`}return n!==void 0&&ie(i,n)<10&&r.push(c),[c]});return[...new Set(r.length>0?r:a)]}export{nt as a,K as b,Y as c,ye as d,Z as e,_e as f,T as g,Ie as h,bt as i,Ce as j,yt as k,Re as l,Be as m,_t as n,It as o,St as p,f as q,Ue as r,je as s,Lt as t,zt as u,Ye as v,Gt as w,Wt as x,oe as y,Ut as z,jt as A,He as B,qt as C,Qt as D,ie as E,en as F,tn as G};
2
- //# sourceMappingURL=chunk-ICT6E4IW.js.map
1
+ import{Xe as h}from"./chunk-ZNWDYDFF.js";import{$ as C,Bb as $,Cb as R,Hb as V,If as L,Jf as W,Kh as U,Qb as v,W as I,X as k,Y as F,Z as A,_ as g,df as G,ec as B,ef as S,fb as D,fc as z,t as N,u as p,w as E,x as M,y as w}from"./chunk-BFZUJ5QP.js";import{A as y,C as _}from"./chunk-J3JM36EH.js";import{Command as ae}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]="df7f766c-1121-5712-b562-423d2cda95ce")}catch{}})();function nt(e){return new ae().name("pm").description("Universal, flexible, extensible, agent-optimized project management CLI for any project or programming language.").version(e).showHelpAfterError(!1).allowExcessArguments(!1).allowUnknownOption(!1).configureOutput({writeOut:t=>{U(t)},writeErr:()=>{}}).option("--json","Output JSON instead of TOON; mutations emit a flat receipt with top-level id/status/changed_field_count while reads use documented entity or collection envelopes").option("--lean","Omit null and empty containers from JSON output").option("--token-accounting","Attach a bounded per-section token-cost receipt to command output").option("--output-include <fields>","Retain comma-separated fields or sections in read output").option("--output-limit <count>","Bound rows in read output").option("--output-budget <tokens|unbounded>","Bound estimated tokens in read output or explicitly disable the default ceiling").option("--output-format <toon|json>","Select the result encoding for reads and mutations").option("--output-session <state>","Carry a JSON session budget and served-item ledger across read calls").option("--output-cursor <cursor>","Resume continuation_kind=output_cursor").option("--output-row-contract","Include row selectors, encoding metadata, and read-output receipts").option("--quiet","Suppress stdout output").option("--no-changed-fields","Omit the changed_fields array from mutation output (keeps changed_field_count)").option("--full-changed-fields","Restore the legacy full mutation envelope and changed_fields array").option("--id-only","Print only id and status for single-item mutation output").option("--pm-path <dir>","Explicit tracker storage path for this command (preferred over --path)").option("--path <dir>","Backward-compatible alias for --pm-path; this is the tracker storage path, not a workspace cwd").option("--no-extensions","Disable extension loading").option("--no-pager","Disable pager integration for help and long output").option("--explain","Render extended rationale and examples in help output").option("--all","Reveal every public command and compatibility alias").option("--profile","Print deterministic timing diagnostics").option("--author <id>","Override mutation author for this invocation").exitOverride()}(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]="8efedca0-725e-520f-ad06-825a0cccddaa")}catch{}})();var j=new Set(["append","claim","close","close-task","comments","copy","delete","deps","docs","files","focus","get","history","history-compact","history-redact","history-repair","learnings","notes","pause-task","release","restore","start-task","test","update"]),q=new Map([["files","discover"],["item","complete"]]),le=new Map([["append",1],["close",1],["close-task",1],["comments",1],["item complete",1],["learnings",1],["notes",1],["restore",1]]);function K(e){let t=p(e?.trim().toLowerCase()??"");return j.has(t)||q.has(t)}function ce(e,t,n){let o=j.has(n)?t+1:void 0,s=g(e.slice(t+1));if(s===void 0)return o;let r=t+1+s,a=`${n} ${e[r]}`,i=p(a);return i===a?n==="item"&&e[r]==="complete"?r+1:o:K(i)?P(e,r,i):void 0}function P(e,t,n){if(["history","context","ctx","update","close","item"].includes(n))return ce(e,t,n);let o=q.get(n);if(o===void 0)return t+1;let s=e[t+1]?.toLowerCase()===o;return t+(s?2:1)}function ue(e){let t=new Map;for(let n of h(e))for(let o of[n.flag,n.short,...n.aliases??[]])o&&t.set(o,n);return t}function de(e){let t=[];for(let n=0;n<e.length;n+=1){let o=e[n];if(o==="--")break;o==="--id"?(t.push({index:n,consumed:2,value:e[n+1]}),n+=1):o.startsWith("--id=")&&t.push({index:n,consumed:1,value:o.slice(5)})}return t}function fe(e,t,n){if(e.indexOf("=")>=0||t===void 0||t.startsWith("-"))return!1;let o=n.get(e);return o!==void 0&&o.value_type!=="boolean"}function pe(e,t,n,o,s){let r=0;for(let a=t;a<e.length;a+=1){let i=e[a];if(i==="--")break;if(i==="--id"){a+=1;continue}if(!i.startsWith("--id=")){if(!i.startsWith("-")){if(a<o)return!0;r+=1;continue}fe(i,e[a+1],s)&&(a+=1)}}return r>(le.get(p(n))??0)}function Y(e){let t=g(e),n=t===void 0?void 0:e[t]?.toLowerCase();if(n!=="context"&&n!=="ctx"&&!K(n))return{argv:[...e],changed:!1,conflict:!1};let o=P(e,t,n);if(o===void 0)return{argv:[...e],changed:!1,conflict:!1};let s=o>t+1?`${p(e.slice(t,o-1).join(" "))} ${e[o-1]}`:n,r=ue(s),a=de(e),i=a[0];if(!i||!i.value?.trim())return{argv:[...e],changed:!1,conflict:!1};if(a.length>1||pe(e,o,s,i.index,r))return{argv:[...e],changed:!1,conflict:!0,itemId:i.value};let l=[...e.slice(0,i.index),...e.slice(i.index+i.consumed)],c=g(l),u=P(l,c,n);return l.splice(u,0,i.value),{argv:l,changed:!0,conflict:!1,itemId:i.value}}(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]="7b271a35-800c-52bf-9368-0410e76b8d4e")}catch{}})();var me=new Set(["--output-include","--output-limit","--output-budget","--output-format","--output-session","--output-cursor"]),he=new Set(["toon","json"]);function ge(e,t,n){let o=e[t];if(k.has(o))return n.booleanFlags.add(o),1;let s=o.indexOf("="),r=s>0?o.slice(0,s):o;if(!I.has(r))return 1;let a=s>0?o.slice(s+1):void 0,i=a===void 0&&A(r,e[t+1]),l=a??(i?e[t+1]:void 0);return r==="--author"?n.author=l??"":typeof l=="string"&&l.length>0&&(me.has(r)?n.outputValues:n.pathValues).set(r,l),i?2:1}function be(e){return e.outputValues.get("--output-format")!=="toon"&&(e.booleanFlags.has("--json")||e.outputValues.get("--output-format")==="json"||e.pathValues.get("--format")?.trim().toLowerCase()==="json")}function ye(e){let t={booleanFlags:new Set,outputValues:new Map,pathValues:new Map},n=0;for(;n<e.length&&e[n]!=="--";)n+=ge(e,n,t);return{path:t.pathValues.get("--pm-path")??t.pathValues.get("--path"),noExtensions:t.booleanFlags.has("--no-extensions")||["history attest","history-attest"].includes(ee(e)??""),noPager:t.booleanFlags.has("--no-pager"),json:be(t),quiet:t.booleanFlags.has("--quiet"),lean:t.booleanFlags.has("--lean"),tokenAccounting:t.booleanFlags.has("--token-accounting"),...t.booleanFlags.has("--output-row-contract")?{outputRowContract:!0}:{},...t.outputValues.get("--output-include")===void 0?{}:{outputInclude:t.outputValues.get("--output-include")},...t.outputValues.get("--output-limit")===void 0?{}:{outputLimit:t.outputValues.get("--output-limit")},...t.outputValues.get("--output-budget")===void 0?{}:{outputBudget:t.outputValues.get("--output-budget")},...he.has(t.outputValues.get("--output-format"))?{outputFormat:t.outputValues.get("--output-format")}:{},...t.outputValues.get("--output-session")===void 0?{}:{outputSession:t.outputValues.get("--output-session")},...t.outputValues.get("--output-cursor")===void 0?{}:{outputCursor:t.outputValues.get("--output-cursor")},...t.author===""?{authorMissingValue:!0}:t.author!==void 0?{author:t.author}:{}}}function Z(e){let t=[],n=0;for(;n<e.length;){let o=e[n];if(o==="--")break;if(k.has(o)||o==="--profile"||o==="--id-only"||o==="--full-changed-fields"||o==="--explain"){n+=1;continue}if(I.has(o)){n+=A(o,e[n+1])?2:1;continue}if(F(o)){n+=1;continue}t.push(o),n+=1}return t}function _e(e){let t=Z(e);if(t[0]?.trim().toLowerCase()==="help"){let o=[];for(let s=1;s<t.length;s+=1){let r=t[s];if(r.startsWith("-"))break;o.push(r.trim().toLowerCase())}return{requested:!0,commandPathTokens:o}}if(t.findIndex(o=>o==="--help"||o==="-h")<0)return{requested:!1,commandPathTokens:[]};let n=[];for(let o of t){if(o.startsWith("-"))break;n.push(o.trim().toLowerCase())}return{requested:!0,commandPathTokens:n}}function T(e){return g(e)}function Ie(e){return C(e)}function we(e,t){return t.noPager?!0:process.stdout.isTTY===!0?!1:_e(e).requested}function bt(e){let t=["PAGER","MANPAGER","GIT_PAGER","LESS"],n=t.map(r=>process.env[r]),o=()=>{for(let[r,a]of t.entries()){let i=n[r];i===void 0?delete process.env[a]:process.env[a]=i}},s=ye(e);return we(e,s)&&(process.env.PAGER="cat",process.env.MANPAGER="cat",process.env.GIT_PAGER="cat",(typeof process.env.LESS!="string"||process.env.LESS.trim().length===0)&&(process.env.LESS="FRX")),o}var ke=new Set(["install","uninstall","explore","manage","doctor","adopt","adopt-all","activate","deactivate"]);function Ce(e){let t=T(e);if(t===void 0||e[t]!=="extension")return[...e];let n=e[t+1];if(!n||n.startsWith("-"))return[...e];if(!ke.has(n))return[...e];if(e.includes("--help")||e.includes("-h"))return[...e];let o=`--${n}`;return e.includes(o)?[...e]:[...e.slice(0,t+1),o,...e.slice(t+2)]}var ve=new Set(["pm","pm-cli"]);function Se(e,t){let n=T(e);if(n===void 0)return e;let o=e[n];return ve.has(o.trim().toLowerCase())?(t.push({from:o,to:[],reason:"executable_alias",confidence:"high"}),[...e.slice(0,n),...e.slice(n+1)]):e}function Te(e,t){let n=T(e);if(n!==void 0&&e[n]==="help"){let i=T(e.slice(n+1));n=i===void 0?void 0:n+1+i}if(n===void 0)return e;let o=e[n],s=M[o.trim().toLowerCase()];if(!s)return e;let r=s.split(" "),a=[...e.slice(0,n),...r,...e.slice(n+1)];return t.push({from:o,to:r,reason:"command_alias",confidence:"high"}),a}function x(e){return e.replace(/^--?/,"").replace(/_/g,"-").replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function X(e){return x(e).replace(/-/g,"")}function J(e,t,n){let o=e.get(t);if(o===void 0){e.set(t,n);return}o!==n&&e.set(t,null)}function xe(e){let t=[],n=o=>{typeof o=="string"&&o.startsWith("--")&&t.push(o)};n(e.flag);for(let o of e.aliases??[])n(o);return t}function Oe(e,t){let n=t??h(e),o=new Map,s=new Map,r=new Map,a=new Set;for(let i of n){let l=xe(i);if(l.length===0)continue;let c=`--${x(l[0])}`;for(let d of l)J(o,x(d),c),J(s,X(d),c);let u=X(c);r.has(c)||r.set(c,u),i.list===!0&&a.add(c)}return{canonicalByNormalized:o,canonicalByCompact:s,canonicalComparables:[...r.entries()].map(([i,l])=>({canonicalFlag:i,comparable:l})),listCanonicalFlags:a}}function H(e,t){let n=x(e),o=t.canonicalByNormalized.get(n);if(typeof o=="string")return{flag:o,reason:"flag_alias",confidence:"high"};let s=n.replace(/-/g,""),r=t.canonicalByCompact.get(s);if(typeof r=="string")return{flag:r,reason:"flag_alias",confidence:"high"};let a=s.length>=8?2:1,i=Number.POSITIVE_INFINITY,l,c=!1;for(let u of t.canonicalComparables){let d=v(s,u.comparable,a);if(d!==null){if(d<i){i=d,l=u.canonicalFlag,c=!1;continue}d===i&&l!==u.canonicalFlag&&(c=!0)}}return!l||c||!Number.isFinite(i)||i<=0?null:{flag:l,reason:"flag_typo",confidence:i>=2?"medium":"high"}}function yt(e){let t=[`${e}s`];return e.endsWith("y")&&e.length>1&&t.push(`${e.slice(0,-1)}ies`),t}function Ee(e,t=!1){if(t||e.includes("://"))return null;let n=e.match(/^([A-Za-z][A-Za-z0-9_-]{1,63})([:=])(.*)$/);if(!n)return null;let o=n[1],s=n[3];return s.length===0?null:{key:o,value:s}}function Ae(e,t,n=!1){if(n||!e.startsWith("--"))return{tokens:[e]};let o=e.indexOf("="),s=o>=0?e.slice(0,o):e,r=o>=0?e.slice(o+1):void 0,a=H(s,t);if(!a)return{tokens:[e]};let i=r===void 0?a.flag:`${a.flag}=${r}`;return i===e?{tokens:[e]}:{tokens:[i],event:{from:e,to:[i],reason:a.reason,confidence:a.confidence}}}function Le(e){let t=new Set,n=!1;for(let o=0;o<e.length;o+=1){if(n){t.add(o),n=!1;continue}let s=e[o];n=s==="--path"||s==="--pm-path"}return t}function Pe(e){if(!e.startsWith("--"))return null;let t=e.indexOf("=");return t<0?{flag:e}:{flag:e.slice(0,t),inlineValue:e.slice(t+1)}}function Ne(e,t,n){n.push(e[t]);let o=e[t+1];return typeof o=="string"&&o!=="--"?(n.push(o),t+2):t+1}function Me(e,t,n,o){if(n.inlineValue!==void 0)return{originalTokens:[e[t]],value:n.inlineValue,consumed:1};let s=[],r=t+1;for(;r<e.length&&e[r]!=="--"&&!e[r].startsWith("-")&&(s.length===0||o.has(n.flag));)s.push(e[r]),r+=1;let a=s.length===0?1:1+s.length;return{originalTokens:e.slice(t,t+a),value:s.length===0?void 0:s.join(","),consumed:a}}function Fe(e,t,n,o){let s=e.get(n);if(s){s.values.push(o.value),s.occurrences+=1;return}e.set(n,{outputIndex:t.length,originalTokens:o.originalTokens,values:[o.value],occurrences:1}),t.push(null)}function De(e,t){let n=[],o=[];for(let[s,r]of e){if(!(r.occurrences>=2||t.has(s)&&r.originalTokens.length>2)){o.push({outputIndex:r.outputIndex,tokens:r.originalTokens});continue}let a=`${s}=${r.values.join(",")}`;o.push({outputIndex:r.outputIndex,tokens:[a]}),n.push({from:`${s} (x${r.occurrences})`,to:[a],reason:"list_merge",confidence:"high"})}return{events:n,splices:o}}function $e(e,t){t.sort((n,o)=>o.outputIndex-n.outputIndex);for(let n of t)e.splice(n.outputIndex,1,...n.tokens)}function Re(e,t,n=new Set,o=new Set){if(t.size===0)return{argv:[...e],events:[]};let s=[],r=new Map,a=0;for(;a<e.length;){let c=e[a];if(c==="--"){s.push(...e.slice(a));break}if(n.has(c)){a=Ne(e,a,s);continue}let u=Pe(c);if(!u||!t.has(u.flag)){s.push(c),a+=1;continue}let d=Me(e,a,u,o);if(d.value===void 0){s.push(c),a+=d.consumed;continue}Fe(r,s,u.flag,{originalTokens:d.originalTokens,value:d.value}),a+=d.consumed}let{events:i,splices:l}=De(r,o);return $e(s,l),{argv:s,events:i}}var Q=new Map([["--add",new Set(["command","cmd","path"])],["--remove",new Set(["command","path"])]]);function Ve(e,t){if(e!=="test"||t.length<2)return!1;let n=t[t.length-1],o=t[t.length-2],s=Q.get(o);return s!==void 0&&s.has(n)}function Be(e,t,n){if(t!=="test")return e;let o=[],s=0;for(;s<e.length;){let r=e[s];if(r==="--")return o.push(...e.slice(s)),o;let a=Q.get(r),i=a?e[s+1]:void 0;if(!a||typeof i!="string"||!a.has(i)){o.push(r),s+=1;continue}let l=s+2;for(;l<e.length&&!e[l].startsWith("-");)l+=1;if(l-(s+2)!==1){o.push(r),s+=1;continue}let c=e[s+2],u=`${i}=${c}`;o.push(r,u),n.push({from:`${r} ${i} ${c}`,to:[r,u],reason:"bare_key_value",confidence:"high"}),s+=3}return o}function ze(e,t,n,o){let s=[],r=Le(e);for(let a=0;a<e.length;a+=1){let i=e[a];if(i==="--"){s.push(...e.slice(a));break}let l=r.has(a),c=s[s.length-1];if(i.startsWith("--")){let b=Ae(i,t,l);s.push(...b.tokens),b.event&&o.push(b.event);continue}let u=Ee(i,l);if(!u||typeof c=="string"&&c.startsWith("-")&&!c.includes("=")||["search","comments","notes","learnings"].includes(n)||Ve(n,s)){s.push(i);continue}let d=H(u.key,t);if(!d){s.push(i);continue}let m=u.value.startsWith("-")?[`${d.flag}=${u.value}`]:[d.flag,u.value];s.push(...m),o.push({from:i,to:m,reason:"bare_key_value",confidence:d.confidence})}return s}function Ge(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(n==="--")break;if(n==="--verify"){let o=e[t+1];if(o===void 0||o==="--")throw new _("history attest --verify requires a bundle file.",y.USAGE);e.splice(t,2,`--verify=${o}`)}else(I.has(n)||n==="--output"||n==="--hash-algorithm")&&(t+=1)}}function We(e,t){if(!e.some(o=>o==="--help"||o==="-h"))return;let n=new Set(h(t).flatMap(o=>[o.flag,...o.aliases??[],...o.short===void 0?[]:[o.short]]));for(let o=0;o<e.length;o+=1){let s=e[o];if(s==="--")break;s!=="--help"&&s!=="-h"||n.has(e[o-1])&&!k.has(e[o-1])&&(e[o-1]=s)}}function _t(e){let t=[],n=Se(e,t),o=Ce(n);(o.length!==n.length||o.some((b,re)=>b!==n[re]))&&t.push({from:n.join(" "),to:[...o],reason:"legacy_extension_action",confidence:"high"});let s=Te(o,t),r=Y(s);if(r.conflict)throw new _("Provide the item id either positionally or with --id, not both.",y.USAGE);r.changed&&t.push({from:`--id ${r.itemId}`,to:[r.itemId],reason:"item_id_alias",confidence:"high"});let a=Ie(r.argv),i=ee(r.argv),l=p(i??a??""),c=Oe(i??a),u=ze(r.argv,c,l,t),d=Be(u,l,t),m=Re(d,c.listCanonicalFlags,I,a==="create"?new Set(["--tags"]):new Set);for(let b of m.events)t.push(b);return We(m.argv,i??a),i==="history attest"&&Ge(m.argv),{argv:m.argv,commandName:a,trace:t}}function ee(e){let t=Z(e),n=t[0]?.trim().toLowerCase(),o=t[1]?.trim().toLowerCase(),s=N(t);return s?s.canonical:(n==="extension"||n==="package"||n==="packages")&&typeof o=="string"&&o.length>0&&!o.startsWith("-")?`${n} ${o}`:n}function It(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(n==="--")break;if(n==="--type"){let o=e[t+1];if(typeof o=="string"&&o.trim().length>0)return o.trim();continue}if(n.startsWith("--type=")){let o=n.slice(7).trim();if(o.length>0)return o}}}(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]="fb625cd9-f8a8-56cf-88ab-abef64051497")}catch{}})();function St(e){if(e===void 0)return()=>{};let t=e.trim();if(t.length===0)throw new _("--author requires a non-empty value.",y.USAGE,{code:"missing_required_argument",nextSteps:["Pass an explicit author identifier with --author <id>."]});let n=G();S(t);let o=!1;return()=>{o||(o=!0,n===void 0?S(void 0):S(n))}}(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]="d0e60f7e-e0a8-5ef4-9af7-4a1f102ccb7d")}catch{}})();var f=Object.freeze({clock:"PM_CLOCK",tickMs:"PM_CLOCK_TICK_MS",seed:"PM_SEED"});function O(e,t,n,o){return new _(e,y.USAGE,{code:"invalid_reproducible_process_environment",reason:t,field:n,required:`${f.clock} and ${f.seed}; ${f.tickMs} is optional`,nextSteps:[`Set ${f.clock} to an ISO-8601 instant with Z or a numeric UTC offset and ${f.seed} to a non-empty reproducibility seed.`,`Optionally set ${f.tickMs} to a non-negative integer; it defaults to 1.`,"Unset all three variables to retain normal wall-clock and cryptographic-random behavior."],recovery:{recovery_mode:"compact",provided_fields:o,missing_required_fields:t==="incomplete"?[f.clock,f.seed].filter(s=>!o.includes(s)):void 0}})}function Ue(e){let t=e[f.clock],n=e[f.tickMs],o=e[f.seed],s=[[f.clock,t],[f.tickMs,n],[f.seed,o]].filter(a=>a[1]!==void 0).map(([a])=>a);if(s.length===0)return;if(t===void 0||o===void 0)throw O("Reproducible process execution requires PM_CLOCK and PM_SEED together.","incomplete",t===void 0?f.clock:f.seed,s);if(o.trim().length===0)throw O(`${f.seed} must not be empty.`,"invalid_value",f.seed,s);if(!V(t))throw O(`${f.clock} must be a valid ISO-8601 instant with Z or a numeric UTC offset.`,"invalid_value",f.clock,s);let r=n===void 0?1:Number(n);if(n?.trim().length===0||!Number.isSafeInteger(r)||r<0)throw O(`${f.tickMs} must be a non-negative integer.`,"invalid_value",f.tickMs,s);return $({clock:t,seed:o,tickMs:r})}function je(e){let t=Ue(e);return t===void 0?n=>n():R(t)}async function Lt(e,t){return je(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]="682c27fa-94d8-529b-92fc-ac8a2eb7e138")}catch{}})();var te=new Set([...Object.values(B),...z,"--full","--brief","--compact","--summary","--fields","--section","--token-budget"]),ne=new Set(["--full-changed-fields","--no-changed-fields","--id-only"]);function zt(e,t){if(!["block","unblock"].includes(e)||t.includes(e)||!t.includes("update"))return;let n=new Set(h("update").map(o=>o.flag));if((e==="block"?["--blocked-by","--blocked-reason"]:["--unset","--unblock-note"]).every(o=>n.has(o)))return e==="block"?{examples:[["update","<item-id>","--blocked-by","<blocker-id>","--blocked-reason","<reason>"]],nextSteps:["Choose the actual item and blocker identifiers before running update. --blocked-by records the blocker field and its blocked_by relationship."]}:{examples:[["update","<item-id>","--unset","blocked-by","--unset","blocked-reason","--unblock-note","<note>"]],nextSteps:["Inspect the item's blockers before running update. --unset blocked-by removes the blocker field and all blocked_by relationships; --unset blocked-reason clears the stale reason. --unblock-note alone records a note and does not unblock the item.","If your project also uses a blocked lifecycle status, choose its appropriate next status separately with update --status."]}}function qe(e,t){let n=e.includes("="),o=n?e.slice(e.indexOf("=")+1):t;if(!(!o||o.startsWith("--")))return{consumed:n?1:2,replacement:["--from",o],conflicts:["--from"]}}var Ke=["--depth","--output-include","--fields","--section","--for"];function Ye(e){let t=L(p(e.trim().toLowerCase()));if(t===void 0)return;let n=h(t),o=n.flatMap(a=>[a.flag,...a.aliases??[]]),s=[...W(t).keys()].filter(a=>o.includes(`--${a}`)),r=[...n.find(a=>a.flag==="--depth")?.values??[]];if(!(s.length===0&&r.length===0))return{command:t,modes:s,depth_values:r,declared_flags:o}}function Gt(e){return[...e.depth_values.length>0?[`--depth ${e.depth_values.join("|")}`]:[],...e.modes.map(t=>`--${t}`)].join(", ")}function Xe(e,t,n,o){let s=Ye(e);if(s===void 0||s.declared_flags.includes(t))return;let r=[...Ke,...s.modes.map(i=>`--${i}`)].filter(i=>i!==t);if(t==="--depth"){let i=n.includes("="),l=(i?n.slice(n.indexOf("=")+1):o)?.trim().toLowerCase();if(!l)return;let c=i?1:2;return s.modes.includes(l)?{consumed:c,replacement:[`--${l}`],conflicts:r}:l==="standard"?{consumed:c,replacement:[],conflicts:r}:void 0}let a=t.slice(2);return n===t&&s.depth_values.includes(a)?{consumed:1,replacement:["--depth",a],conflicts:r}:void 0}function Je(e,t,n,o){return t==="--since"&&e==="activity"?qe(n,o):t==="--toon"&&n===t?{consumed:1,replacement:["--output-format","toon"],conflicts:["--json","--format","--output-format","--stream"]}:Xe(e,t,n,o)}function Ze(e){let t=g(e);if(t===void 0)return;let n=e[t].trim().toLowerCase(),o=`${n} ${e[t+1]?.trim().toLowerCase()??""}`,s=p(o);return s!==o.trim()?s:n==="ctx"?"context":p(n)}function Wt(e,t,n){let o=e==="ctx"?"context":p(e);if(L(o)===void 0||t.includes("--")||Ze(t)!==o)return;let s=n.split("=",1)[0],r=t.flatMap((d,m)=>d===s||d.startsWith(`${s}=`)?[m]:[]);if(r.length!==1)return;let a=r[0],i=Je(o,s,t[a],t[a+1]);if(!i)return;let{replacement:l,consumed:c,conflicts:u}=i;if(!t.some(d=>u.includes(d.split("=",1)[0])))return[...t.slice(0,a),...l,...t.slice(a+c)]}function oe(e){let t=e.split("=",1)[0].replaceAll("_","-");return te.has(t)||t.length>=5&&[...te].some(n=>n.startsWith(t))}function Ut(e,t){let n=e.split("=",1)[0].replaceAll("_","-");return oe(n)?!ne.has(t):ne.has(n)?!oe(t):!0}function se(e){return e.trim().match(/--[a-z0-9][a-z0-9_-]*/i)?.[0]?.replaceAll("_","-").toLowerCase()}function jt(e){if(!(!Array.isArray(e)||e.length===0))return C(e)}function He(e,t){let n=se(t);if(!n)return;let o=h(e).find(s=>s.flag===n||s.aliases?.includes(n));return o?o.value_type==="boolean"?null:`<${o.value_name??"value"}>`:"<value>"}function qt(e,t,n){let o=[...e],s=o.indexOf("--"),r=s<0?o.length:s;for(let a of n){let i=se(a);if(!i||o.slice(0,r).some(u=>u===i||u.startsWith(`${i}=`)))continue;let l=He(t,i),c=l?[i,l]:[i];o.splice(r,0,...c),r+=c.length}return o.length===e.length?void 0:D(o)}(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]="bd9a8d3b-bc6f-5309-a3fb-7e5f41ef9dab")}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]="12066389-daef-5fce-b7a6-0ecffa926d66")}catch{}})();function Qt(e,t){let n=e.trim().split(/\s+/u);if(!(n.length<2||t.includes(n.join(" "))))for(let o=1;o<n.length;o+=1){if(!t.includes(n.slice(0,o).join(" ")))return;let s=n.slice(o).join(" "),r=w(s),a=new Set(t.filter(i=>i===s||i.endsWith(` ${s}`)||i===r?.canonical).map(i=>w(i)?.canonical??i).filter(i=>t.includes(i)));if(a.size>0)return a.size===1?[...a][0]:void 0}}var Qe={add:["create","append"],fetch:["get"],inspect:["get","health"],log:["history","comments","notes"],ls:["list"],pause:["release"],read:["get"],remove:["delete"],rm:["delete"],show:["get"],start:["start-task"]};function ie(e,t){let n=e.trim().toLowerCase(),o=t.trim().toLowerCase();if(o.length===0)return Number.POSITIVE_INFINITY;let s=n.split(" "),r=Qe[o]?.indexOf(p(n));if(r!==void 0&&r>=0)return r;if(n===o)return 10;if(s.includes(o))return 11;if(s.some(l=>l.startsWith(o)))return 12;let a=o.length>=5?2:1,i=Number.POSITIVE_INFINITY;for(let l of s){let c=v(l,o,a);c!==null&&(i=Math.min(i,c))}return Number.isFinite(i)?20+i:n.includes(o)?30:Number.POSITIVE_INFINITY}function en(e,t){return e.map(n=>({path:n,score:ie(n,t)})).filter(n=>Number.isFinite(n.score)).sort((n,o)=>n.score!==o.score?n.score-o.score:n.path===o.path?0:n.path<o.path?-1:1).map(n=>n.path)}function tn(e,t,n){let o=new Set(t),s=E.filter(i=>i.lifecycle==="deprecated").slice().sort((i,l)=>l.alias.length-i.alias.length),r=[],a=e.flatMap(i=>{let l=s.find(u=>i===u.alias||i.startsWith(`${u.alias} `)),c=i;if(l){let u=i.slice(l.alias.length);if(!o.has(`${l.canonical}${u}`))return[];c=`${l.canonical_argv.join(" ")}${u}`}return n!==void 0&&ie(i,n)<10&&r.push(c),[c]});return[...new Set(r.length>0?r:a)]}export{nt as a,K as b,Y as c,ye as d,Z as e,_e as f,T as g,Ie as h,bt as i,Ce as j,yt as k,Re as l,Be as m,_t as n,It as o,St as p,f as q,Ue as r,je as s,Lt as t,zt as u,Ye as v,Gt as w,Wt as x,oe as y,Ut as z,jt as A,He as B,qt as C,Qt as D,ie as E,en as F,tn as G};
2
+ //# sourceMappingURL=chunk-EN27ZQSV.js.map
@@ -1,2 +1,2 @@
1
- import{b as a}from"./chunk-VS565KBX.js";import{A as l,C as d}from"./chunk-WX25MU4N.js";import{execFile as g}from"node:child_process";import{promisify as m}from"node:util";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new t.Error().stack;r&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[r]="e57ef62f-fd40-5a33-9816-e24d8dba4d1d")}catch{}})();var p=m(g);async function k(t,r){if(r.length===0)return[];let i;try{let e=p("git",["check-ignore","--verbose","-z","--stdin"],{cwd:t,env:a(),timeout:1e4}),n=e.child.stdin;n!==null&&(n.on("error",()=>{e.child.kill()}),n.end(`${r.join("\0")}\0`)),{stdout:i}=await e}catch(e){if(typeof e=="object"&&e!==null&&"code"in e&&e.code===1)return[];throw new d("Git could not verify ignore rules for merge artifacts; no automatic settlement is safe until that check succeeds.",l.CONFLICT,{code:"merge_settlement_review_required",reason:"ignore_check_unavailable",nextSteps:["Check Git configuration and ignore-file readability, then retry pm merge reconcile --stage --dry-run."]})}let o=i.split("\0"),c=[];for(let e=0;e+3<o.length;e+=4){let[n,f,s,u]=o.slice(e,e+4);s.startsWith("!")||c.push({path:u,source:n,line:Number(f),pattern:s})}return c}export{k as a};
2
- //# sourceMappingURL=chunk-MRUA2Z43.js.map
1
+ import{b as a}from"./chunk-VS565KBX.js";import{A as l,C as d}from"./chunk-J3JM36EH.js";import{execFile as g}from"node:child_process";import{promisify as m}from"node:util";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new t.Error().stack;r&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[r]="e57ef62f-fd40-5a33-9816-e24d8dba4d1d")}catch{}})();var p=m(g);async function k(t,r){if(r.length===0)return[];let i;try{let e=p("git",["check-ignore","--verbose","-z","--stdin"],{cwd:t,env:a(),timeout:1e4}),n=e.child.stdin;n!==null&&(n.on("error",()=>{e.child.kill()}),n.end(`${r.join("\0")}\0`)),{stdout:i}=await e}catch(e){if(typeof e=="object"&&e!==null&&"code"in e&&e.code===1)return[];throw new d("Git could not verify ignore rules for merge artifacts; no automatic settlement is safe until that check succeeds.",l.CONFLICT,{code:"merge_settlement_review_required",reason:"ignore_check_unavailable",nextSteps:["Check Git configuration and ignore-file readability, then retry pm merge reconcile --stage --dry-run."]})}let o=i.split("\0"),c=[];for(let e=0;e+3<o.length;e+=4){let[n,f,s,u]=o.slice(e,e+4);s.startsWith("!")||c.push({path:u,source:n,line:Number(f),pattern:s})}return c}export{k as a};
2
+ //# sourceMappingURL=chunk-GK2CHAT3.js.map