@unbrained/pm-cli 2026.8.27 → 2026.8.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +25 -1
  3. package/dist/cli/error-guidance.js +61 -7
  4. package/dist/cli/register-annotations.js +58 -41
  5. package/dist/cli-bundle/bundle-manifest.json +121 -121
  6. package/dist/cli-bundle/chunks/{chunk-SH6P7FXI.js → chunk-BY2FQ2NI.js} +2 -2
  7. package/dist/cli-bundle/chunks/{chunk-TNX6HC54.js → chunk-E73FDIWT.js} +2 -2
  8. package/dist/cli-bundle/chunks/{chunk-SHMDY36D.js → chunk-FEVBFFCQ.js} +2 -2
  9. package/dist/cli-bundle/chunks/{chunk-CVBBGWW5.js → chunk-M7OXRQE3.js} +10 -6
  10. package/dist/cli-bundle/chunks/{chunk-R4ETAOJC.js → chunk-NBCBFVZI.js} +2 -2
  11. package/dist/cli-bundle/chunks/{chunk-SKXLJIEK.js → chunk-NTXZHRKA.js} +45 -45
  12. package/dist/cli-bundle/chunks/{chunk-52EKTW6V.js → chunk-QE6WQXFO.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-MFNTKMTI.js → chunk-TIQ6AMH2.js} +2 -2
  14. package/dist/cli-bundle/chunks/chunk-X2RROGZE.js +2 -0
  15. package/dist/cli-bundle/chunks/{chunk-OS27HHBN.js → chunk-XRVVYRRO.js} +28 -28
  16. package/dist/cli-bundle/chunks/{chunk-3OO3W6FW.js → chunk-XWEQGHHG.js} +2 -2
  17. package/dist/cli-bundle/chunks/{register-list-query-EUWM6VII.js → register-list-query-J35ZPQQ5.js} +2 -2
  18. package/dist/cli-bundle/chunks/{register-mutation-FD4HSAVU.js → register-mutation-J6XJJOGU.js} +4 -4
  19. package/dist/cli-bundle/chunks/{register-operations-HRMNFEC3.js → register-operations-AE3JEMFT.js} +2 -2
  20. package/dist/cli-bundle/chunks/{register-setup-33GNICLX.js → register-setup-OQERLLWE.js} +2 -2
  21. package/dist/cli-bundle/focused-chunks/{chunk-4BR5UU52.js → chunk-4ZDRZYYJ.js} +41 -41
  22. package/dist/cli-bundle/focused-chunks/{chunk-MXTYGECH.js → chunk-AHAM2HAU.js} +2 -2
  23. package/dist/cli-bundle/focused-chunks/{chunk-SUBSWYW3.js → chunk-JZYPPMXF.js} +2 -2
  24. package/dist/cli-bundle/focused-chunks/chunk-LLNTHF5X.js +2 -0
  25. package/dist/cli-bundle/focused-chunks/chunk-LYFWQMVC.js +2 -0
  26. package/dist/cli-bundle/focused-chunks/{chunk-EKX37ZHA.js → chunk-THEPQMLX.js} +2 -2
  27. package/dist/cli-bundle/focused-chunks/chunk-YJLDHJOD.js +2 -0
  28. package/dist/cli-bundle/main.js +14 -14
  29. package/dist/cli-bundle/sdk-authoring.js +1 -1
  30. package/dist/cli-bundle/sdk-contracts.js +2 -2
  31. package/dist/cli-bundle/sdk-core.js +26 -26
  32. package/dist/cli-bundle/sdk-governance.js +1 -1
  33. package/dist/cli-bundle/sdk-merge.js +20 -20
  34. package/dist/cli-bundle/sdk-query.js +1 -1
  35. package/dist/cli-bundle/sdk-runtime.js +1 -1
  36. package/dist/cli-bundle/sdk-testing.js +1 -1
  37. package/dist/cli-bundle/sdk.js +10 -10
  38. package/dist/mcp/tool-definitions.js +5 -5
  39. package/dist/sdk/agent/command-recovery.js +3 -3
  40. package/dist/sdk/agent/task-transcript-contracts.d.ts +52 -0
  41. package/dist/sdk/agent/task-transcript-contracts.js +198 -0
  42. package/dist/sdk/annotations.d.ts +5 -2
  43. package/dist/sdk/annotations.js +66 -36
  44. package/dist/sdk/cli-bootstrap.d.ts +2 -8
  45. package/dist/sdk/cli-bootstrap.js +7 -67
  46. package/dist/sdk/cli-contracts/bootstrap-command-scanner.d.ts +23 -0
  47. package/dist/sdk/cli-contracts/bootstrap-command-scanner.js +80 -0
  48. package/dist/sdk/cli-contracts/flag-contracts.js +5 -2
  49. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +5 -5
  50. package/dist/sdk/cli-contracts/tool-parameter-tables.js +15 -2
  51. package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
  52. package/dist/sdk/cli-contracts/tool-schema.js +16 -3
  53. package/dist/sdk/comments.d.ts +4 -0
  54. package/dist/sdk/comments.js +2 -2
  55. package/dist/sdk/completion.js +9 -5
  56. package/dist/sdk/contracts.d.ts +1 -0
  57. package/dist/sdk/contracts.js +3 -2
  58. package/dist/sdk/extension/install-sources.d.ts +13 -0
  59. package/dist/sdk/extension/install-sources.js +62 -30
  60. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +26 -2
  61. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +26 -14
  62. package/dist/sdk/index.d.ts +1 -0
  63. package/dist/sdk/index.js +3 -2
  64. package/dist/sdk/learnings.d.ts +4 -0
  65. package/dist/sdk/learnings.js +7 -4
  66. package/dist/sdk/lifecycle/close.js +4 -3
  67. package/dist/sdk/notes.d.ts +4 -0
  68. package/dist/sdk/notes.js +2 -2
  69. package/dist/sdk/runtime-input.js +5 -2
  70. package/dist/sdk/runtime.d.ts +6 -6
  71. package/dist/sdk/runtime.js +8 -8
  72. package/docs/COMMANDS.md +4 -3
  73. package/docs/OUTPUT_TOKEN_ACCOUNTING.md +20 -7
  74. package/docs/RELEASING.md +9 -1
  75. package/docs/SDK.md +12 -0
  76. package/docs/SDK_CONTEXT_INTEGRITY.md +12 -1
  77. package/docs/SDK_RUNTIME_BOUNDARIES.md +10 -0
  78. package/docs/TESTING.md +6 -2
  79. package/docs/agent-task-token-baseline.json +97 -11
  80. package/docs/agent-task-transcripts.json +211 -0
  81. package/docs/generated/FLAG_LEXICON_BUDGETS.md +3 -3
  82. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +6 -3
  83. package/docs/performance/cli-transport-overhead.md +10 -2
  84. package/marketplace.json +2 -2
  85. package/package.json +2 -2
  86. package/packages/pm-beads/package.json +1 -1
  87. package/packages/pm-calendar/package.json +1 -1
  88. package/packages/pm-command-kit/package.json +1 -1
  89. package/packages/pm-digital-twin/package.json +1 -1
  90. package/packages/pm-governance-audit/package.json +1 -1
  91. package/packages/pm-guide-shell/package.json +1 -1
  92. package/packages/pm-kanban/package.json +1 -1
  93. package/packages/pm-lifecycle-hooks/package.json +1 -1
  94. package/packages/pm-linked-test-adapters/package.json +1 -1
  95. package/packages/pm-search-advanced/package.json +1 -1
  96. package/packages/pm-templates/package.json +1 -1
  97. package/packages/pm-todos/package.json +1 -1
  98. package/packages/pm-vcs/package.json +1 -1
  99. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  100. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  101. package/sdk/public-surface.json +197 -25
  102. package/dist/cli-bundle/chunks/chunk-QTO7USTH.js +0 -2
  103. package/dist/cli-bundle/focused-chunks/chunk-2AGZ5BRT.js +0 -2
  104. package/dist/cli-bundle/focused-chunks/chunk-AQ5IYEZZ.js +0 -2
  105. package/dist/cli-bundle/focused-chunks/chunk-YHWHX6YY.js +0 -2
@@ -0,0 +1,2 @@
1
+ import{C as p,E as m,Fe as F,Fg as D,O,P as L,T as N,ba as y,kf as v,qm as g,se as P,te as w}from"./chunk-XWEQGHHG.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]="ae031bac-f5a1-5762-9c58-0410b8f1f86d")}catch{}})();var f=Object.freeze({clock:"PM_CLOCK",tickMs:"PM_CLOCK_TICK_MS",seed:"PM_SEED"});function I(e,t,n,o){return new m(e,p.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(i=>!o.includes(i)):void 0}})}function K(e){let t=e[f.clock],n=e[f.tickMs],o=e[f.seed],i=[[f.clock,t],[f.tickMs,n],[f.seed,o]].filter(r=>r[1]!==void 0).map(([r])=>r);if(i.length===0)return;if(t===void 0||o===void 0)throw I("Reproducible process execution requires PM_CLOCK and PM_SEED together.","incomplete",t===void 0?f.clock:f.seed,i);if(o.trim().length===0)throw I(`${f.seed} must not be empty.`,"invalid_value",f.seed,i);if(!N(t))throw I(`${f.clock} must be a valid ISO-8601 instant with Z or a numeric UTC offset.`,"invalid_value",f.clock,i);let s=n===void 0?1:Number(n);if(n?.trim().length===0||!Number.isSafeInteger(s)||s<0)throw I(`${f.tickMs} must be a non-negative integer.`,"invalid_value",f.tickMs,i);return O({clock:t,seed:o,tickMs:s})}function Y(e){let t=K(e);return t===void 0?n=>n():L(t)}async function $e(e,t){return Y(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]="271cf7c1-f84b-5f59-aa13-ed8cb4ee232f")}catch{}})();var B=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"]),T=new Map([["files","discover"],["item","complete"]]),X=new Set(["--author","--output-budget","--output-format","--output-include","--output-limit","--output-session","--path","--pm-path"]),Z=new Map([["append",1],["close",1],["close-task",1],["comments",1],["item complete",1],["learnings",1],["notes",1],["restore",1]]);function H(e){let t=e?.trim().toLowerCase()??"";return B.has(t)||T.has(t)}function M(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(n==="--")return;if(X.has(n)){t+=1;continue}if(!n.startsWith("-"))return t}}function V(e,t,n){let o=T.get(n);if(o===void 0)return t+1;let i=e[t+1]?.toLowerCase()===o;if(!(!i&&!B.has(n)))return t+(i?2:1)}function J(e){let t=new Map;for(let n of g(e))for(let o of[n.flag,n.short,...n.aliases??[]])o&&t.set(o,n);return t}function Q(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 ee(e,t,n){if(e.indexOf("=")>=0||t===void 0||t.startsWith("-"))return!1;let i=n.get(e);return i!==void 0&&i.value_type!=="boolean"}function te(e,t,n,o,i){let s=0;for(let r=t;r<e.length;r+=1){let a=e[r];if(a==="--")break;if(a==="--id"){r+=1;continue}if(!a.startsWith("--id=")){if(!a.startsWith("-")){if(r<o)return!0;s+=1;continue}ee(a,e[r+1],i)&&(r+=1)}}return s>(Z.get(n)??0)}function R(e){let t=M(e),n=t===void 0?void 0:e[t]?.toLowerCase();if(!H(n))return{argv:[...e],changed:!1,conflict:!1};let o=T.get(n)===e[t+1]?.toLowerCase()?`${n} ${e[t+1]?.toLowerCase()}`:n,i=J(o),s=Q(e),r=s[0];if(!r||!r.value?.trim())return{argv:[...e],changed:!1,conflict:!1};let a=V(e,t,n);if(a===void 0)return{argv:[...e],changed:!1,conflict:!1};if(s.length>1||te(e,a,o,r.index,i))return{argv:[...e],changed:!1,conflict:!0,itemId:r.value};let u=[...e.slice(0,r.index),...e.slice(r.index+r.consumed)],c=M(u),l=V(u,c,n);return u.splice(l,0,r.value),{argv:u,changed:!0,conflict:!1,itemId:r.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]="9d04e30a-caf5-59b4-8853-9df39c1728aa")}catch{}})();var b=new Set(["--pm-path","--path","--author","--output-include","--output-limit","--output-budget","--output-format","--output-session","--output-cursor"]),x=new Set(["--no-extensions","--no-pager","--json","--quiet","--lean","--token-accounting","--output-row-contract","--all"]);function E(e){let t=e.indexOf("=");return t>0&&b.has(e.slice(0,t))}function _(e,t){return typeof t!="string"?!1:e==="--path"||e==="--pm-path"||!t.startsWith("-")}function S(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(n==="--")return;if(b.has(n)){t+=_(n,e[t+1])?1:0;continue}if(!(E(n)||x.has(n)||n==="--profile"||n==="--id-only"||n==="--explain")&&!n.startsWith("-"))return t}}function C(e){let t=S(e);return t===void 0?void 0:e[t].trim().toLowerCase()}(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]="3d35c0f5-e1b8-5fd8-8fd7-c754a21784a1")}catch{}})();var ne=new Set(["--output-include","--output-limit","--output-budget","--output-format","--output-session","--output-cursor"]);function oe(e,t,n){let o=e[t];if(x.has(o))return n.booleanFlags.add(o),1;let i=o.indexOf("="),s=i>0?o.slice(0,i):o;if(!b.has(s))return 1;let r=i>0?o.slice(i+1):void 0,a=r===void 0&&_(s,e[t+1]),u=r??(a?e[t+1]:void 0);return s==="--author"?n.author=u??"":typeof u=="string"&&u.length>0&&(ne.has(s)?n.outputValues:n.pathValues).set(s,u),a?2:1}function ie(e){let t={booleanFlags:new Set,outputValues:new Map,pathValues:new Map},n=0;for(;n<e.length&&e[n]!=="--";)n+=oe(e,n,t);return{path:t.pathValues.get("--pm-path")??t.pathValues.get("--path"),noExtensions:t.booleanFlags.has("--no-extensions"),noPager:t.booleanFlags.has("--no-pager"),json:t.booleanFlags.has("--json"),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")},...t.outputValues.get("--output-format")==="toon"||t.outputValues.get("--output-format")==="json"?{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 G(e){let t=[],n=0;for(;n<e.length;){let o=e[n];if(o==="--")break;if(x.has(o)||o==="--profile"||o==="--id-only"||o==="--full-changed-fields"||o==="--explain"){n+=1;continue}if(b.has(o)){n+=_(o,e[n+1])?2:1;continue}if(E(o)){n+=1;continue}t.push(o),n+=1}return t}function se(e){let t=G(e);if(t[0]?.trim().toLowerCase()==="help"){let s=[];for(let r=1;r<t.length;r+=1){let a=t[r];if(a.startsWith("-"))break;s.push(a.trim().toLowerCase())}return{requested:!0,commandPathTokens:s}}if(t.findIndex(s=>s==="--help"||s==="-h")<0)return{requested:!1,commandPathTokens:[]};let i=[];for(let s of t){if(s.startsWith("-"))break;i.push(s.trim().toLowerCase())}return{requested:!0,commandPathTokens:i}}function A(e){return S(e)}function re(e){return C(e)}function ae(e,t){return t.noPager?!0:process.stdout.isTTY===!0?!1:se(e).requested}function et(e){let t=["PAGER","MANPAGER","GIT_PAGER","LESS"],n=t.map(s=>process.env[s]),o=()=>{for(let[s,r]of t.entries()){let a=n[s];a===void 0?delete process.env[r]:process.env[r]=a}},i=ie(e);return ae(e,i)&&(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 ue=new Set(["install","uninstall","explore","manage","doctor","adopt","adopt-all","activate","deactivate"]);function ce(e){let t=A(e);if(t===void 0||e[t]!=="extension")return[...e];let n=e[t+1];if(!n||n.startsWith("-"))return[...e];if(!ue.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 le=new Set(["pm","pm-cli"]);function de(e,t){let n=A(e);if(n===void 0)return e;let o=e[n];return le.has(o.trim().toLowerCase())?(t.push({from:o,to:[],reason:"executable_alias",confidence:"high"}),[...e.slice(0,n),...e.slice(n+1)]):e}function fe(e,t){let n=A(e);if(n===void 0)return e;let o=e[n],i=v[o.trim().toLowerCase()];if(!i)return e;let s=[...e];return s[n]=i,t.push({from:o,to:[i],reason:"command_alias",confidence:"high"}),s}function k(e){return e.replace(/^--?/,"").replace(/_/g,"-").replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function $(e){return k(e).replace(/-/g,"")}function z(e,t,n){let o=e.get(t);if(o===void 0){e.set(t,n);return}o!==n&&e.set(t,null)}function pe(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 me(e,t){let n=t??g(e),o=new Map,i=new Map,s=new Map,r=new Set;for(let a of n){let u=pe(a);if(u.length===0)continue;let c=`--${k(u[0])}`;for(let d of u)z(o,k(d),c),z(i,$(d),c);let l=$(c);s.has(c)||s.set(c,l),a.list===!0&&r.add(c)}return{canonicalByNormalized:o,canonicalByCompact:i,canonicalComparables:[...s.entries()].map(([a,u])=>({canonicalFlag:a,comparable:u})),listCanonicalFlags:r}}function W(e,t){let n=k(e),o=t.canonicalByNormalized.get(n);if(typeof o=="string")return{flag:o,reason:"flag_alias",confidence:"high"};let i=n.replace(/-/g,""),s=t.canonicalByCompact.get(i);if(typeof s=="string")return{flag:s,reason:"flag_alias",confidence:"high"};let r=i.length>=8?2:1,a=Number.POSITIVE_INFINITY,u,c=!1;for(let l of t.canonicalComparables){let d=y(i,l.comparable,r);if(d!==null){if(d<a){a=d,u=l.canonicalFlag,c=!1;continue}d===a&&u!==l.canonicalFlag&&(c=!0)}}return!u||c||!Number.isFinite(a)||a<=0?null:{flag:u,reason:"flag_typo",confidence:a>=2?"medium":"high"}}function tt(e){let t=[`${e}s`];return e.endsWith("y")&&e.length>1&&t.push(`${e.slice(0,-1)}ies`),t}function he(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],i=n[3];return i.length===0?null:{key:o,value:i}}function ge(e,t,n=!1){if(n||!e.startsWith("--"))return{tokens:[e]};let o=e.indexOf("="),i=o>=0?e.slice(0,o):e,s=o>=0?e.slice(o+1):void 0,r=W(i,t);if(!r)return{tokens:[e]};let a=s===void 0?r.flag:`${r.flag}=${s}`;return a===e?{tokens:[e]}:{tokens:[a],event:{from:e,to:[a],reason:r.reason,confidence:r.confidence}}}function be(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 i=e[o];n=i==="--path"||i==="--pm-path"}return t}function ye(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 we(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 Ie(e,t,n,o){if(n.inlineValue!==void 0)return{originalTokens:[e[t]],value:n.inlineValue,consumed:1};let i=[],s=t+1;for(;s<e.length&&e[s]!=="--"&&!e[s].startsWith("-")&&(i.length===0||o.has(n.flag));)i.push(e[s]),s+=1;let r=i.length===0?1:1+i.length;return{originalTokens:e.slice(t,t+r),value:i.length===0?void 0:i.join(","),consumed:r}}function xe(e,t,n,o){let i=e.get(n);if(i){i.values.push(o.value),i.occurrences+=1;return}e.set(n,{outputIndex:t.length,originalTokens:o.originalTokens,values:[o.value],occurrences:1}),t.push(null)}function _e(e,t){let n=[],o=[];for(let[i,s]of e){if(!(s.occurrences>=2||t.has(i)&&s.originalTokens.length>2)){o.push({outputIndex:s.outputIndex,tokens:s.originalTokens});continue}let a=`${i}=${s.values.join(",")}`;o.push({outputIndex:s.outputIndex,tokens:[a]}),n.push({from:`${i} (x${s.occurrences})`,to:[a],reason:"list_merge",confidence:"high"})}return{events:n,splices:o}}function Ce(e,t){t.sort((n,o)=>o.outputIndex-n.outputIndex);for(let n of t)e.splice(n.outputIndex,1,...n.tokens)}function ke(e,t,n=new Set,o=new Set){if(t.size===0)return{argv:[...e],events:[]};let i=[],s=new Map,r=0;for(;r<e.length;){let c=e[r];if(c==="--"){i.push(...e.slice(r));break}if(n.has(c)){r=we(e,r,i);continue}let l=ye(c);if(!l||!t.has(l.flag)){i.push(c),r+=1;continue}let d=Ie(e,r,l,o);if(d.value===void 0){i.push(c),r+=d.consumed;continue}xe(s,i,l.flag,{originalTokens:d.originalTokens,value:d.value}),r+=d.consumed}let{events:a,splices:u}=_e(s,o);return Ce(i,u),{argv:i,events:a}}var U=new Map([["--add",new Set(["command","cmd","path"])],["--remove",new Set(["command","path"])]]);function Te(e,t){if(e!=="test"||t.length<2)return!1;let n=t[t.length-1],o=t[t.length-2],i=U.get(o);return i!==void 0&&i.has(n)}function Ee(e,t){return e==="search"||Te(e,t)}function Se(e,t,n){if(t!=="test")return e;let o=[],i=0;for(;i<e.length;){let s=e[i];if(s==="--")return o.push(...e.slice(i)),o;let r=U.get(s),a=r?e[i+1]:void 0;if(!r||typeof a!="string"||!r.has(a)){o.push(s),i+=1;continue}let u=i+2;for(;u<e.length&&!e[u].startsWith("-");)u+=1;if(u-(i+2)!==1){o.push(s),i+=1;continue}let c=e[i+2],l=`${a}=${c}`;o.push(s,l),n.push({from:`${s} ${a} ${c}`,to:[s,l],reason:"bare_key_value",confidence:"high"}),i+=3}return o}function Ae(e,t,n,o){let i=[],s=be(e);for(let r=0;r<e.length;r+=1){let a=e[r];if(a==="--"){i.push(...e.slice(r));break}let u=s.has(r),c=i[i.length-1];if(a.startsWith("--")){let d=ge(a,t,u);i.push(...d.tokens),d.event&&o.push(d.event);continue}let l=he(a,u);if(l&&!(typeof c=="string"&&c.startsWith("-"))&&!Ee(n,i)){let d=W(l.key,t);if(d){let h=[d.flag,l.value];i.push(...h),o.push({from:a,to:h,reason:"bare_key_value",confidence:d.confidence});continue}}i.push(a)}return i}function nt(e){let t=[],n=de(e,t),o=ce(n);(o.length!==n.length||o.some((h,j)=>h!==n[j]))&&t.push({from:n.join(" "),to:[...o],reason:"legacy_extension_action",confidence:"high"});let i=fe(o,t),s=R(i);if(s.conflict)throw new m("Provide the item id either positionally or with --id, not both.",p.USAGE);s.changed&&t.push({from:`--id ${s.itemId}`,to:[s.itemId],reason:"item_id_alias",confidence:"high"});let r=re(s.argv),a=Oe(s.argv),u=me(a??r),c=Ae(s.argv,u,r,t),l=Se(c,r,t),d=ke(l,u.listCanonicalFlags,b,r==="create"?new Set(["--tags"]):new Set);for(let h of d.events)t.push(h);return{argv:d.argv,commandName:r,trace:t}}function Oe(e){let t=G(e),n=t[0]?.trim().toLowerCase(),o=t[1]?.trim().toLowerCase();return(n==="extension"||n==="package"||n==="packages")&&typeof o=="string"&&o.length>0&&!o.startsWith("-")?`${n} ${o}`:n}function ot(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]="6084a18e-ccda-57f9-a7d8-45572799c021")}catch{}})();function q(e){return e.trim().match(/--[a-z0-9][a-z0-9_-]*/i)?.[0]?.replaceAll("_","-").toLowerCase()}function ut(e){if(!(!Array.isArray(e)||e.length===0))return C(e)}function Le(e,t){let n=q(t);if(!n)return;let o=g(e).find(i=>i.flag===n||i.aliases?.includes(n));return o?o.value_type==="boolean"?null:`<${o.value_name??"value"}>`:"<value>"}function ct(e,t,n){let o=[...e],i=o.indexOf("--"),s=i<0?o.length:i;for(let r of n){let a=q(r);if(!a||o.slice(0,s).some(l=>l===a||l.startsWith(`${a}=`)))continue;let u=Le(t,a),c=u?[a,u]:[a];o.splice(s,0,...c),s+=c.length}return o.length===e.length?void 0:F(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]="d82065d1-488d-523e-9df2-a30056f29603")}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]="5810cf1d-fc9a-597b-a47e-a914009fadfa")}catch{}})();function gt(e){return e instanceof m||e instanceof Error?e.message:"Unknown failure"}function Ne(e){if(typeof e!="object"||e===null||!("exitCode"in e))return;let t=e.exitCode;return typeof t=="number"&&Number.isFinite(t)?t:void 0}function Pe(e){let t=Math.trunc(e);return t>p.SUCCESS?t:p.GENERIC_FAILURE}function bt(e){return typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"&&e.code.startsWith("commander.")}function yt(e,t){if(e instanceof Error)return e;let n=new Error(t),o=Ne(e);return o!==void 0&&(n.exitCode=Pe(o)),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]="8f7cca3d-9b19-53b4-a510-5290aaf75e12")}catch{}})();function Ct(e){if(e===void 0)return()=>{};let t=e.trim();if(t.length===0)throw new m("--author requires a non-empty value.",p.USAGE,{code:"missing_required_argument",nextSteps:["Pass an explicit author identifier with --author <id>."]});let n=P();w(t);let o=!1;return()=>{o||(o=!0,n===void 0?w(void 0):w(n))}}import{Command as Fe}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]="31e820a7-aa60-5e37-846d-c62b81b47587")}catch{}})();function St(e){return new Fe().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=>{D(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 read-output encoding").option("--output-session <state>","Carry a JSON session budget and served-item ledger across read calls").option("--output-cursor <cursor>","Resume a budget-compacted declared row collection").option("--output-row-contract","Include the machine-readable row selector and TOON encoding contract").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]="71e5a870-f62f-5252-b4e9-e1a42e36009f")}catch{}})();var ve={add:["create","append"],fetch:["get"],inspect:["get","health"],log:["history","comments","notes"],ls:["list"],pause:["release"],read:["get"],remove:["delete"],rm:["delete"],show:["get"]};function De(e,t){let n=e.trim().toLowerCase(),o=t.trim().toLowerCase();if(o.length===0)return Number.POSITIVE_INFINITY;let i=n.split(" "),s=ve[o]?.indexOf(n);if(s!==void 0&&s>=0)return s;if(n===o)return 10;if(i.includes(o))return 11;if(i.some(u=>u.startsWith(o)))return 12;let r=o.length>=5?2:1,a=Number.POSITIVE_INFINITY;for(let u of i){let c=y(u,o,r);c!==null&&(a=Math.min(a,c))}return Number.isFinite(a)?20+a:n.includes(o)?30:Number.POSITIVE_INFINITY}function Lt(e,t){return e.map(n=>({path:n,score:De(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)}export{f as a,K as b,Y as c,$e as d,H as e,R as f,C as g,ie as h,G as i,se as j,A as k,re as l,et as m,ce as n,tt as o,ke as p,Se as q,nt as r,ot as s,ut as t,Le as u,ct as v,gt as w,Ne as x,Pe as y,bt as z,yt as A,Ct as B,St as C,De as D,Lt as E};
2
+ //# sourceMappingURL=chunk-X2RROGZE.js.map