@unbrained/pm-cli 2026.8.12 → 2026.8.13

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 (173) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +22 -0
  3. package/dist/cli/error-guidance.js +4 -8
  4. package/dist/cli/main.js +3 -2
  5. package/dist/cli/register-assurance.js +28 -17
  6. package/dist/cli-bundle/bundle-manifest.json +161 -161
  7. package/dist/cli-bundle/chunks/chunk-3ZMOWAFM.js +2 -0
  8. package/dist/cli-bundle/chunks/chunk-DEDU3DG7.js +196 -0
  9. package/dist/cli-bundle/chunks/chunk-DL5M5J3V.js +13 -0
  10. package/dist/cli-bundle/chunks/chunk-F7FJYGK3.js +8 -0
  11. package/dist/cli-bundle/chunks/{chunk-RBTK5EZV.js → chunk-HIUZVCMN.js} +2 -2
  12. package/dist/cli-bundle/chunks/chunk-IMGIN7R6.js +2 -0
  13. package/dist/cli-bundle/chunks/{chunk-WLAHPSOX.js → chunk-Q47C67TQ.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-BM5YJ2UW.js → chunk-QGTUPEU5.js} +52 -52
  15. package/dist/cli-bundle/chunks/chunk-TF3TPKPR.js +34 -0
  16. package/dist/cli-bundle/chunks/{chunk-KOQMGCTA.js → chunk-YLBAPY22.js} +50 -50
  17. package/dist/cli-bundle/chunks/{register-list-query-XPCJRUUD.js → register-list-query-4HIZ7EA3.js} +2 -2
  18. package/dist/cli-bundle/chunks/{register-mutation-4RJCBKRS.js → register-mutation-W64FZ5HN.js} +2 -2
  19. package/dist/cli-bundle/chunks/register-operations-C44ET7R5.js +2 -0
  20. package/dist/cli-bundle/chunks/{register-setup-LLHAKP2V.js → register-setup-634MFRXU.js} +2 -2
  21. package/dist/cli-bundle/focused-chunks/chunk-27N23W6M.js +31 -0
  22. package/dist/cli-bundle/focused-chunks/{chunk-YIAXMC3T.js → chunk-2JP7W7GO.js} +2 -2
  23. package/dist/cli-bundle/focused-chunks/chunk-2RI2FESN.js +4 -0
  24. package/dist/cli-bundle/focused-chunks/chunk-3BNVU6LC.js +8 -0
  25. package/dist/cli-bundle/focused-chunks/{chunk-KHM2CS2C.js → chunk-3DJSGWVB.js} +2 -2
  26. package/dist/cli-bundle/focused-chunks/{chunk-2DALMVF7.js → chunk-6MLIRBLV.js} +2 -2
  27. package/dist/cli-bundle/focused-chunks/chunk-6XYLENDV.js +155 -0
  28. package/dist/cli-bundle/focused-chunks/chunk-CP4K4WFS.js +2 -0
  29. package/dist/cli-bundle/focused-chunks/{chunk-RWPAWUOT.js → chunk-E3AVJ655.js} +2 -2
  30. package/dist/cli-bundle/focused-chunks/{chunk-5TAGTDRE.js → chunk-EBTNSFYE.js} +2 -2
  31. package/dist/cli-bundle/focused-chunks/{chunk-KPSXVBDV.js → chunk-HC2OL2H2.js} +2 -2
  32. package/dist/cli-bundle/focused-chunks/{chunk-GQW4BPUT.js → chunk-I75MANL7.js} +2 -2
  33. package/dist/cli-bundle/focused-chunks/{chunk-ZMGWAYH7.js → chunk-IIS2FRKL.js} +2 -2
  34. package/dist/cli-bundle/focused-chunks/chunk-NFHFZH2Z.js +2 -0
  35. package/dist/cli-bundle/focused-chunks/chunk-OGC4XSBC.js +17 -0
  36. package/dist/cli-bundle/focused-chunks/{chunk-JAFRIWVF.js → chunk-OOYYKQWX.js} +4 -4
  37. package/dist/cli-bundle/focused-chunks/{chunk-KTLOKKCQ.js → chunk-PKPOZXLL.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/chunk-QDZUABWL.js +2 -0
  39. package/dist/cli-bundle/focused-chunks/chunk-QQX5TDFT.js +16 -0
  40. package/dist/cli-bundle/focused-chunks/{chunk-NYLOUPOB.js → chunk-TEZIXMTH.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/chunk-WEH6NSL6.js +18 -0
  42. package/dist/cli-bundle/main.js +13 -13
  43. package/dist/cli-bundle/sdk-authoring.js +1 -1
  44. package/dist/cli-bundle/sdk-contracts.js +1 -1
  45. package/dist/cli-bundle/sdk-core.js +42 -41
  46. package/dist/cli-bundle/sdk-governance.js +1 -1
  47. package/dist/cli-bundle/sdk-graph.js +1 -1
  48. package/dist/cli-bundle/sdk-merge.js +1 -1
  49. package/dist/cli-bundle/sdk-query.js +1 -1
  50. package/dist/cli-bundle/sdk-runtime.js +1 -1
  51. package/dist/cli-bundle/sdk-testing.js +1 -1
  52. package/dist/cli-bundle/sdk.js +2 -2
  53. package/dist/core/checkpoint/checkpoint-gc.js +7 -12
  54. package/dist/core/extensions/activation-summary-markdown.js +5 -4
  55. package/dist/core/extensions/activation-summary.d.ts +2 -0
  56. package/dist/core/extensions/activation-summary.js +6 -2
  57. package/dist/core/extensions/capability-usage.d.ts +1 -1
  58. package/dist/core/extensions/capability-usage.js +4 -3
  59. package/dist/core/extensions/contribution-inventory.d.ts +1 -0
  60. package/dist/core/extensions/contribution-inventory.js +6 -2
  61. package/dist/core/extensions/extension-registries.js +3 -2
  62. package/dist/core/extensions/extension-types.d.ts +83 -1
  63. package/dist/core/extensions/extension-types.js +3 -2
  64. package/dist/core/extensions/loader.d.ts +2 -8
  65. package/dist/core/extensions/loader.js +53 -144
  66. package/dist/core/extensions/registration-values.d.ts +43 -0
  67. package/dist/core/extensions/registration-values.js +210 -0
  68. package/dist/core/extensions/runtime-registrations.d.ts +3 -1
  69. package/dist/core/extensions/runtime-registrations.js +12 -2
  70. package/dist/core/fs/fs-utils.d.ts +2 -0
  71. package/dist/core/fs/fs-utils.js +7 -3
  72. package/dist/core/history/drift-cache.js +4 -3
  73. package/dist/core/history/drift-scan.js +5 -11
  74. package/dist/core/lock/lock-gc.js +8 -13
  75. package/dist/core/lock/lock.js +5 -4
  76. package/dist/core/search/vector-stores.js +6 -11
  77. package/dist/core/store/item-metadata-cache.js +4 -4
  78. package/dist/core/telemetry/runtime.d.ts +6 -0
  79. package/dist/core/telemetry/runtime.js +101 -30
  80. package/dist/sdk/agent/command-recovery.d.ts +2 -0
  81. package/dist/sdk/agent/command-recovery.js +10 -2
  82. package/dist/sdk/annotations.js +4 -4
  83. package/dist/sdk/cli-contracts/completeness.js +9 -3
  84. package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
  85. package/dist/sdk/cli-contracts/flag-contracts.js +6 -3
  86. package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +32 -0
  87. package/dist/sdk/cli-contracts/schemas/assurance-definition.js +25 -2
  88. package/dist/sdk/cli-contracts/tool-parameter-tables.js +35 -5
  89. package/dist/sdk/cli-contracts/tool-schema.js +17 -2
  90. package/dist/sdk/comments.js +4 -3
  91. package/dist/sdk/compile-cache.js +4 -3
  92. package/dist/sdk/compose.d.ts +3 -1
  93. package/dist/sdk/compose.js +16 -2
  94. package/dist/sdk/context-signal-store.js +4 -3
  95. package/dist/sdk/extension/install-runtime.js +4 -4
  96. package/dist/sdk/extension/managed-state.js +4 -3
  97. package/dist/sdk/extension-contracts.d.ts +1 -1
  98. package/dist/sdk/flag-invocation-contracts.js +5 -6
  99. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +14 -2
  100. package/dist/sdk/governance/assurance-action.d.ts +27 -3
  101. package/dist/sdk/governance/assurance-action.js +112 -28
  102. package/dist/sdk/governance/assurance-mutation-error.d.ts +7 -0
  103. package/dist/sdk/governance/assurance-mutation-error.js +25 -2
  104. package/dist/sdk/governance/assurance-presets.d.ts +54 -0
  105. package/dist/sdk/governance/assurance-presets.js +136 -0
  106. package/dist/sdk/governance/assurance-runtime.d.ts +4 -0
  107. package/dist/sdk/governance/assurance-runtime.js +109 -8
  108. package/dist/sdk/governance/assurance.d.ts +39 -0
  109. package/dist/sdk/governance/assurance.js +143 -4
  110. package/dist/sdk/governance/gc.js +5 -11
  111. package/dist/sdk/governance/health.js +5 -5
  112. package/dist/sdk/governance/validate.js +4 -4
  113. package/dist/sdk/graph/durable-cache.js +61 -3
  114. package/dist/sdk/graph/governance-contracts.d.ts +12 -0
  115. package/dist/sdk/graph/governance-contracts.js +27 -0
  116. package/dist/sdk/graph/governance.d.ts +30 -2
  117. package/dist/sdk/graph/governance.js +124 -5
  118. package/dist/sdk/guide.js +4 -4
  119. package/dist/sdk/index.d.ts +2 -1
  120. package/dist/sdk/index.js +4 -3
  121. package/dist/sdk/linked-artifacts.d.ts +2 -0
  122. package/dist/sdk/linked-artifacts.js +29 -4
  123. package/dist/sdk/merge/install.js +5 -4
  124. package/dist/sdk/query/activity.js +4 -3
  125. package/dist/sdk/relationship-history.js +5 -5
  126. package/dist/sdk/schema-migration.js +4 -4
  127. package/dist/sdk/test/execution.js +4 -4
  128. package/dist/sdk/workspace-memory.js +4 -4
  129. package/dist/sdk/workspace-snapshot.js +8 -14
  130. package/dist/sdk/workspace-transaction-gc.js +4 -9
  131. package/dist/sdk/workspace-transaction.js +4 -4
  132. package/dist/sdk/workspace.js +4 -3
  133. package/docs/ASSURANCE.md +154 -3
  134. package/docs/CONFIGURATION.md +2 -0
  135. package/docs/EXTENSIONS.md +11 -12
  136. package/docs/RELATIONSHIP_GRAPH.md +15 -0
  137. package/docs/SDK.md +17 -3
  138. package/docs/TESTING.md +24 -15
  139. package/marketplace.json +2 -2
  140. package/package.json +3 -3
  141. package/packages/pm-beads/package.json +1 -1
  142. package/packages/pm-calendar/package.json +1 -1
  143. package/packages/pm-command-kit/package.json +1 -1
  144. package/packages/pm-digital-twin/package.json +1 -1
  145. package/packages/pm-governance-audit/package.json +1 -1
  146. package/packages/pm-guide-shell/package.json +1 -1
  147. package/packages/pm-kanban/package.json +1 -1
  148. package/packages/pm-lifecycle-hooks/package.json +1 -1
  149. package/packages/pm-linked-test-adapters/package.json +1 -1
  150. package/packages/pm-search-advanced/package.json +1 -1
  151. package/packages/pm-templates/package.json +1 -1
  152. package/packages/pm-todos/package.json +1 -1
  153. package/packages/pm-vcs/package.json +1 -1
  154. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  155. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  156. package/sdk/public-surface.json +183 -33
  157. package/dist/cli-bundle/chunks/chunk-3PS7X6GS.js +0 -8
  158. package/dist/cli-bundle/chunks/chunk-7KL6KMWF.js +0 -13
  159. package/dist/cli-bundle/chunks/chunk-D55A5AEN.js +0 -33
  160. package/dist/cli-bundle/chunks/chunk-KIKDWECH.js +0 -196
  161. package/dist/cli-bundle/chunks/chunk-R76342NV.js +0 -2
  162. package/dist/cli-bundle/chunks/chunk-VLUQOIDT.js +0 -2
  163. package/dist/cli-bundle/chunks/register-operations-2OGISOVR.js +0 -2
  164. package/dist/cli-bundle/focused-chunks/chunk-5OQIMELN.js +0 -155
  165. package/dist/cli-bundle/focused-chunks/chunk-ECADZMVC.js +0 -18
  166. package/dist/cli-bundle/focused-chunks/chunk-EJGXRA6B.js +0 -2
  167. package/dist/cli-bundle/focused-chunks/chunk-FFGSZCPK.js +0 -16
  168. package/dist/cli-bundle/focused-chunks/chunk-ISKOBJCM.js +0 -2
  169. package/dist/cli-bundle/focused-chunks/chunk-LGYK3NUF.js +0 -8
  170. package/dist/cli-bundle/focused-chunks/chunk-NBLUKITQ.js +0 -4
  171. package/dist/cli-bundle/focused-chunks/chunk-Q4T463SD.js +0 -31
  172. package/dist/cli-bundle/focused-chunks/chunk-QVZVY53N.js +0 -2
  173. package/dist/cli-bundle/focused-chunks/chunk-UTEWXDEQ.js +0 -17
@@ -1,2 +0,0 @@
1
- import{k as S}from"./chunk-KOQMGCTA.js";import{B as f,D as h,Ei as E,Kd as C,Ld as y,Rk as m,_ as b,tf as k}from"./chunk-KIKDWECH.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]="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 Ne(e){return e instanceof h||e instanceof Error?e.message:"Unknown failure"}function W(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 G(e){let t=Math.trunc(e);return t>f.SUCCESS?t:f.GENERIC_FAILURE}function Pe(e){return typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"&&e.code.startsWith("commander.")}function De(e,t){if(e instanceof Error)return e;let n=new Error(t),o=W(e);return o!==void 0&&(n.exitCode=G(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]="271cf7c1-f84b-5f59-aa13-ed8cb4ee232f")}catch{}})();var O=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"]),x=new Map([["files","discover"],["item","complete"]]),$=new Set(["--author","--output-budget","--output-format","--output-include","--output-limit","--output-session","--path","--pm-path"]),R=new Map([["append",1],["close",1],["close-task",1],["comments",1],["item complete",1],["learnings",1],["notes",1],["restore",1]]);function U(e){let t=e?.trim().toLowerCase()??"";return O.has(t)||x.has(t)}function A(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(n==="--")return;if($.has(n)){t+=1;continue}if(!n.startsWith("-"))return t}}function L(e,t,n){let o=x.get(n);if(o===void 0)return t+1;let s=e[t+1]?.toLowerCase()===o;if(!(!s&&!O.has(n)))return t+(s?2:1)}function q(e){let t=new Map;for(let n of m(e))for(let o of[n.flag,n.short,...n.aliases??[]])o&&t.set(o,n);return t}function j(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 K(e,t,n){if(e.indexOf("=")>=0||t===void 0||t.startsWith("-"))return!1;let s=n.get(e);return s!==void 0&&s.value_type!=="boolean"}function Y(e,t,n,o,s){let i=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;i+=1;continue}K(a,e[r+1],s)&&(r+=1)}}return i>(R.get(n)??0)}function F(e){let t=A(e),n=t===void 0?void 0:e[t]?.toLowerCase();if(!U(n))return{argv:[...e],changed:!1,conflict:!1};let o=x.get(n)===e[t+1]?.toLowerCase()?`${n} ${e[t+1]?.toLowerCase()}`:n,s=q(o),i=j(e),r=i[0];if(!r||!r.value?.trim())return{argv:[...e],changed:!1,conflict:!1};let a=L(e,t,n);if(a===void 0)return{argv:[...e],changed:!1,conflict:!1};if(i.length>1||Y(e,a,o,r.index,s))return{argv:[...e],changed:!1,conflict:!0,itemId:r.value};let u=[...e.slice(0,r.index),...e.slice(r.index+r.consumed)],c=A(u),l=L(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]="7b3209a8-8580-542c-9e80-21d04df3f61f")}catch{}})();var g=new Set(["--pm-path","--path","--author","--output-include","--output-limit","--output-budget","--output-format","--output-session"]),X=new Set(["--output-include","--output-limit","--output-budget","--output-format","--output-session"]),D=e=>{let t=e.indexOf("=");return t>0&&g.has(e.slice(0,t))},_=(e,t)=>typeof t!="string"?!1:e==="--path"||e==="--pm-path"||!t.startsWith("-"),T=new Set(["--no-extensions","--no-pager","--json","--quiet","--lean","--token-accounting","--output-row-contract"]);function J(e,t,n){let o=e[t];if(T.has(o))return n.booleanFlags.add(o),1;let s=o.indexOf("="),i=s>0?o.slice(0,s):o;if(!g.has(i))return 1;let r=s>0?o.slice(s+1):void 0,a=r===void 0&&_(i,e[t+1]),u=r??(a?e[t+1]:void 0);return i==="--author"?n.author=u??"":typeof u=="string"&&u.length>0&&(X.has(i)?n.outputValues:n.pathValues).set(i,u),a?2:1}function Z(e){let t={booleanFlags:new Set,outputValues:new Map,pathValues:new Map},n=0;for(;n<e.length&&e[n]!=="--";)n+=J(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.author===""?{authorMissingValue:!0}:t.author!==void 0?{author:t.author}:{}}}function V(e){let t=[],n=0;for(;n<e.length;){let o=e[n];if(o==="--")break;if(T.has(o)||o==="--profile"||o==="--id-only"||o==="--full-changed-fields"||o==="--explain"){n+=1;continue}if(g.has(o)){n+=_(o,e[n+1])?2:1;continue}if(D(o)){n+=1;continue}t.push(o),n+=1}return t}function H(e){let t=V(e);if(t[0]?.trim().toLowerCase()==="help"){let i=[];for(let r=1;r<t.length;r+=1){let a=t[r];if(a.startsWith("-"))break;i.push(a.trim().toLowerCase())}return{requested:!0,commandPathTokens:i}}if(t.findIndex(i=>i==="--help"||i==="-h")<0)return{requested:!1,commandPathTokens:[]};let s=[];for(let i of t){if(i.startsWith("-"))break;s.push(i.trim().toLowerCase())}return{requested:!0,commandPathTokens:s}}function I(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(n==="--")return;if(g.has(n)){t+=_(n,e[t+1])?1:0;continue}if(!(D(n)||T.has(n)||n==="--profile"||n==="--id-only"||n==="--explain")&&!n.startsWith("-"))return t}}function Q(e){let t=I(e);return t===void 0?void 0:e[t].trim().toLowerCase()}function ee(e,t){return t.noPager?!0:process.stdout.isTTY===!0?!1:H(e).requested}function Re(e){let t=["PAGER","MANPAGER","GIT_PAGER","LESS"],n=t.map(i=>process.env[i]),o=()=>{for(let[i,r]of t.entries()){let a=n[i];a===void 0?delete process.env[r]:process.env[r]=a}},s=Z(e);return ee(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 te=new Set(["install","uninstall","explore","manage","doctor","adopt","adopt-all","activate","deactivate"]);function ne(e){let t=I(e);if(t===void 0||e[t]!=="extension")return[...e];let n=e[t+1];if(!n||n.startsWith("-"))return[...e];if(!te.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 oe=new Set(["pm","pm-cli"]);function se(e,t){let n=I(e);if(n===void 0)return e;let o=e[n];return oe.has(o.trim().toLowerCase())?(t.push({from:o,to:[],reason:"executable_alias",confidence:"high"}),[...e.slice(0,n),...e.slice(n+1)]):e}function ie(e,t){let n=I(e);if(n===void 0)return e;let o=e[n],s=E[o.trim().toLowerCase()];if(!s)return e;let i=[...e];return i[n]=s,t.push({from:o,to:[s],reason:"command_alias",confidence:"high"}),i}function w(e){return e.replace(/^--?/,"").replace(/_/g,"-").replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function N(e){return w(e).replace(/-/g,"")}function P(e,t,n){let o=e.get(t);if(o===void 0){e.set(t,n);return}o!==n&&e.set(t,null)}function re(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 ae(e,t){let n=t??m(e),o=new Map,s=new Map,i=new Map,r=new Set;for(let a of n){let u=re(a);if(u.length===0)continue;let c=`--${w(u[0])}`;for(let d of u)P(o,w(d),c),P(s,N(d),c);let l=N(c);i.has(c)||i.set(c,l),a.list===!0&&r.add(c)}return{canonicalByNormalized:o,canonicalByCompact:s,canonicalComparables:[...i.entries()].map(([a,u])=>({canonicalFlag:a,comparable:u})),listCanonicalFlags:r}}function M(e,t){let n=w(e),o=t.canonicalByNormalized.get(n);if(typeof o=="string")return{flag:o,reason:"flag_alias",confidence:"high"};let s=n.replace(/-/g,""),i=t.canonicalByCompact.get(s);if(typeof i=="string")return{flag:i,reason:"flag_alias",confidence:"high"};let r=s.length>=8?2:1,a=Number.POSITIVE_INFINITY,u,c=!1;for(let l of t.canonicalComparables){let d=b(s,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 Ue(e){let t=[`${e}s`];return e.endsWith("y")&&e.length>1&&t.push(`${e.slice(0,-1)}ies`),t}function ue(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 ce(e,t,n=!1){if(n||!e.startsWith("--"))return{tokens:[e]};let o=e.indexOf("="),s=o>=0?e.slice(0,o):e,i=o>=0?e.slice(o+1):void 0,r=M(s,t);if(!r)return{tokens:[e]};let a=i===void 0?r.flag:`${r.flag}=${i}`;return a===e?{tokens:[e]}:{tokens:[a],event:{from:e,to:[a],reason:r.reason,confidence:r.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 de(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 fe(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 pe(e,t,n,o){if(n.inlineValue!==void 0)return{originalTokens:[e[t]],value:n.inlineValue,consumed:1};let s=[],i=t+1;for(;i<e.length&&e[i]!=="--"&&!e[i].startsWith("-")&&(s.length===0||o.has(n.flag));)s.push(e[i]),i+=1;let r=s.length===0?1:1+s.length;return{originalTokens:e.slice(t,t+r),value:s.length===0?void 0:s.join(","),consumed:r}}function he(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 me(e,t){let n=[],o=[];for(let[s,i]of e){if(!(i.occurrences>=2||t.has(s)&&i.originalTokens.length>2)){o.push({outputIndex:i.outputIndex,tokens:i.originalTokens});continue}let a=`${s}=${i.values.join(",")}`;o.push({outputIndex:i.outputIndex,tokens:[a]}),n.push({from:`${s} (x${i.occurrences})`,to:[a],reason:"list_merge",confidence:"high"})}return{events:n,splices:o}}function ge(e,t){t.sort((n,o)=>o.outputIndex-n.outputIndex);for(let n of t)e.splice(n.outputIndex,1,...n.tokens)}function be(e,t,n=new Set,o=new Set){if(t.size===0)return{argv:[...e],events:[]};let s=[],i=new Map,r=0;for(;r<e.length;){let c=e[r];if(c==="--"){s.push(...e.slice(r));break}if(n.has(c)){r=fe(e,r,s);continue}let l=de(c);if(!l||!t.has(l.flag)){s.push(c),r+=1;continue}let d=pe(e,r,l,o);if(d.value===void 0){s.push(c),r+=d.consumed;continue}he(i,s,l.flag,{originalTokens:d.originalTokens,value:d.value}),r+=d.consumed}let{events:a,splices:u}=me(i,o);return ge(s,u),{argv:s,events:a}}var v=new Map([["--add",new Set(["command","cmd","path"])],["--remove",new Set(["command","path"])]]);function ye(e,t){if(e!=="test"||t.length<2)return!1;let n=t[t.length-1],o=t[t.length-2],s=v.get(o);return s!==void 0&&s.has(n)}function we(e,t){return e==="search"||ye(e,t)}function Ie(e,t,n){if(t!=="test")return e;let o=[],s=0;for(;s<e.length;){let i=e[s];if(i==="--")return o.push(...e.slice(s)),o;let r=v.get(i),a=r?e[s+1]:void 0;if(!r||typeof a!="string"||!r.has(a)){o.push(i),s+=1;continue}let u=s+2;for(;u<e.length&&!e[u].startsWith("-");)u+=1;if(u-(s+2)!==1){o.push(i),s+=1;continue}let c=e[s+2],l=`${a}=${c}`;o.push(i,l),n.push({from:`${i} ${a} ${c}`,to:[i,l],reason:"bare_key_value",confidence:"high"}),s+=3}return o}function xe(e,t,n,o){let s=[],i=le(e);for(let r=0;r<e.length;r+=1){let a=e[r];if(a==="--"){s.push(...e.slice(r));break}let u=i.has(r),c=s[s.length-1];if(a.startsWith("--")){let d=ce(a,t,u);s.push(...d.tokens),d.event&&o.push(d.event);continue}let l=ue(a,u);if(l&&!(typeof c=="string"&&c.startsWith("-"))&&!we(n,s)){let d=M(l.key,t);if(d){let p=[d.flag,l.value];s.push(...p),o.push({from:a,to:p,reason:"bare_key_value",confidence:d.confidence});continue}}s.push(a)}return s}function qe(e){let t=[],n=se(e,t),o=ne(n);(o.length!==n.length||o.some((p,z)=>p!==n[z]))&&t.push({from:n.join(" "),to:[...o],reason:"legacy_extension_action",confidence:"high"});let s=ie(o,t),i=F(s);if(i.conflict)throw new h("Provide the item id either positionally or with --id, not both.",f.USAGE);i.changed&&t.push({from:`--id ${i.itemId}`,to:[i.itemId],reason:"item_id_alias",confidence:"high"});let r=Q(i.argv),a=_e(i.argv),u=ae(a??r),c=xe(i.argv,u,r,t),l=Ie(c,r,t),d=be(l,u.listCanonicalFlags,g,r==="create"?new Set(["--tags"]):new Set);for(let p of d.events)t.push(p);return{argv:d.argv,commandName:r,trace:t}}function _e(e){let t=V(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 je(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]="8f7cca3d-9b19-53b4-a510-5290aaf75e12")}catch{}})();function Ze(e){if(e===void 0)return()=>{};let t=e.trim();if(t.length===0)throw new h("--author requires a non-empty value.",f.USAGE,{code:"missing_required_argument",nextSteps:["Pass an explicit author identifier with --author <id>."]});let n=C();y(t);let o=!1;return()=>{o||(o=!0,n===void 0?y(void 0):y(n))}}import{Command as Te}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]="b799c7c2-21b8-5c19-8565-7166e6f06a90")}catch{}})();function tt(e){return new Te().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=>{k(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>","Bound estimated tokens in read output").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-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("--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 Ce={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 ke(e,t){let n=e.trim().toLowerCase(),o=t.trim().toLowerCase();if(o.length===0)return Number.POSITIVE_INFINITY;let s=n.split(" "),i=Ce[o]?.indexOf(n);if(i!==void 0&&i>=0)return i;if(n===o)return 10;if(s.includes(o))return 11;if(s.some(u=>u.startsWith(o)))return 12;let r=o.length>=5?2:1,a=Number.POSITIVE_INFINITY;for(let u of s){let c=b(u,o,r);c!==null&&(a=Math.min(a,c))}return Number.isFinite(a)?20+a:n.includes(o)?30:Number.POSITIVE_INFINITY}function st(e,t){return e.map(n=>({path:n,score:ke(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(){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]="ab87f46c-c9b4-51d1-a712-fbce7c79fca9")}catch{}})();function B(e){return e.trim().match(/--[a-z0-9][a-z0-9_-]*/i)?.[0]?.replaceAll("_","-").toLowerCase()}function Ee(e,t){let n=B(t);if(!n)return;let o=m(e).find(s=>s.flag===n||s.aliases?.includes(n));return o?o.value_type==="boolean"?null:`<${o.value_name??"value"}>`:"<value>"}function ut(e,t,n){let o=[...e],s=o.indexOf("--"),i=s<0?o.length:s;for(let r of n){let a=B(r);if(!a||o.slice(0,i).some(l=>l===a||l.startsWith(`${a}=`)))continue;let u=Ee(t,a),c=u?[a,u]:[a];o.splice(i,0,...c),i+=c.length}return o.length===e.length?void 0:S(o)}export{Ne as a,W as b,G as c,Pe as d,De as e,U as f,F as g,Z as h,V as i,H as j,I as k,Q as l,Re as m,ne as n,Ue as o,be as p,Ie as q,qe as r,je as s,Ze as t,tt as u,ke as v,st as w,Ee as x,ut as y};
2
- //# sourceMappingURL=chunk-R76342NV.js.map
@@ -1,2 +0,0 @@
1
- import{$b as B,Wb as z,Xb as K,Yb as S,bb as P,bc as F,cc as L}from"./chunk-BM5YJ2UW.js";import{b as x}from"./chunk-KOQMGCTA.js";import{B as c,D as d,Gb as k,Oi as D,Qd as N,Ri as G,_ as $,_j as j,cg as C,eg as U,ek as v,v as O}from"./chunk-KIKDWECH.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]="687855bf-7432-5691-a809-1f0406b5d8a8")}catch{}})();import ie from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="07876c03-63a8-5c69-9c6c-c3446076a382")}catch{}})();var b=["op","id","reason","options"],J=[...b,"ref"],W=["schema_version","mutations"],Q="[a-z][a-z0-9._-]{0,63}",Y=new RegExp(`^${Q}$`,"u"),ee=new RegExp(`(^|,)id=@(${Q})(?=,|$)`,"gu"),q=e=>e.slice(2).replaceAll(/-([a-z])/gu,(t,n)=>n.toUpperCase()),E=["item","linked","schedule","claim_state","children","omission_receipt","row_contract","context_intent"],te=new Set(["created_at","updated_at","closed_at","version","format_version","path","author","collection_counts","notes_count","tests_count"]),se=new Set([...te,"completed_at","id"]),_=new Set(["id","title","description","type","status","priority","tags","body","deadline","estimated_minutes","acceptance_criteria","definition_of_ready","order","rank","assignee",...O,"affected_version","fixed_version","component","regression","customer_impact","close_reason","completed_at","dependencies","comments","notes","learnings","files","tests","docs","reminders","events","type_options"]),V={create:D.map(e=>e.target),update:G.map(e=>e.target),close:j.map(e=>q(e.flag)).filter(e=>e!=="reason"),release:v.map(e=>q(e.flag))};function lt(e){let t={},n=e.createCompensation;if(n!==void 0){if(n!=="close"&&n!=="delete")throw new d("createCompensation must be close or delete.",c.USAGE);t.createCompensation=n}for(let r of["lockTtlSeconds","lockWaitMs"]){let o=e[r];if(o===void 0)continue;let i=typeof o=="number"||typeof o=="string"&&o.trim().length>0?Number(o):Number.NaN;if(!Number.isSafeInteger(i)||i<=0)throw new d(`${r} must be a positive safe integer.`,c.USAGE);t[r]=i}return t}function p(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function g(e,t){let n=Math.max(1,Math.min(3,Math.floor(e.length/4)+1)),r;for(let o of t){let i=$(e,o,n);i!==null&&(r===void 0||i<r.distance)&&(r={key:o,distance:i})}return r?.key}function y(e,t,n){let r=g(t,n);return new d(r===void 0?`${e} does not recognize key "${t}". Allowed keys: ${n.join(", ")}.`:`${e} does not recognize key "${t}". Did you mean "${r}"?`,c.USAGE,{code:"stdin_json_unknown_key",required:`Use documented ${e} keys only.`,why:"Strict structured input prevents silent typos from creating incomplete or unintended mutations.",nextSteps:[r===void 0?`Remove or correct "${t}".`:`Replace "${t}" with "${r}".`]})}function R(e,t){try{return JSON.parse(e)}catch(n){let r=n instanceof Error?n.message:String(n);throw new d(`${t} must be valid JSON: ${r}`,c.USAGE,{code:"stdin_json_invalid",required:`Pipe one valid JSON ${t.toLowerCase()} into stdin.`,why:"Structured mutation input must parse deterministically before any tracker write begins."})}}function ae(e,t){if(!p(e))throw new d(`Mutation ${t+1} must be an object.`,c.USAGE);for(let n of Object.keys(e))if(!b.includes(n))throw y(`mutation ${t+1}`,n,b);return e}function ce(e,t,n){if(e!==void 0){if(!p(e))throw new d(`Mutation ${n+1} options must be an object.`,c.USAGE);for(let r of Object.keys(e))if(!V[t].includes(r))throw y(`mutation ${n+1} ${t} options`,r,V[t]);return e}}function de(e,t){let n=ae(e,t),{op:r,id:o,reason:i}=n;if(r!=="create"&&r!=="update"&&r!=="close"&&r!=="release")throw new d(`Mutation ${t+1} op must be create, update, close, or release.`,c.USAGE);let s=ce(n.options,r,t);if(typeof o!="string"||o.trim().length===0)throw new d(`Mutation ${t+1} requires a non-empty id.`,c.USAGE);let a=o.trim();if(r==="close"){if(typeof i!="string"||i.trim().length===0)throw new d(`Mutation ${t+1} close requires a non-empty reason.`,c.USAGE);return{op:r,id:a,reason:i.trim(),...s===void 0?{}:{options:s}}}if(r==="release")return{op:r,id:a,...s===void 0?{}:{options:s}};if(!p(s))throw new d(`Mutation ${t+1} ${r} requires an options object.`,c.USAGE);return{op:r,id:a,options:s}}function ne(e){let t=R(e,"Mutation batch"),n=Array.isArray(t)?t:p(t)&&Array.isArray(t.mutations)?t.mutations:void 0;if(n===void 0||n.length===0)throw new d("Mutation batch must be a non-empty JSON array or an object with a non-empty mutations array.",c.USAGE);return n.map((r,o)=>de(r,o))}function ue(e,t,n){let r=ie.createHash("sha256").update(e).update("\0").update(t).digest("hex"),o=BigInt(`0x${r.slice(0,16)}`).toString(36).padStart(13,"0").slice(-12);return`${C(n)}${o}`}function H(e,t){if(typeof e!="string"||!e.startsWith("@"))return e;let n=e.slice(1),r=t[n];if(r===void 0)throw new d(`Unknown mutation reference "${e}".`,c.USAGE);return r}function X(e,t){if(typeof e!="string")return e;let n=e.replace(ee,(r,o,i)=>{let s=t[i];if(s===void 0)throw new d(`Unknown mutation reference "@${i}".`,c.USAGE);return`${o}id=${s}`});if(/(^|,)id=@/u.test(n))throw new d(`Malformed mutation reference in dependency "${e}".`,c.USAGE);return n}function pe(e){return typeof e!="string"?[]:e.startsWith("@")?[e.slice(1)]:[...e.matchAll(ee)].map(t=>t[1]).filter(t=>t!==void 0)}function fe(e){let t=new Map;for(let i of e){if(i.op!=="create"||typeof i.ref!="string")continue;let s=p(i.options)?i.options:{},a=Array.isArray(s.dep)?s.dep:s.dep===void 0?[]:[s.dep];t.set(i.ref,[s.parent,s.blockedBy,...a].flatMap(pe))}let n=new Set,r=new Set,o=i=>{if(n.has(i))throw new d(`Mutation reference cycle includes "@${i}".`,c.USAGE);if(!r.has(i)){n.add(i);for(let s of t.get(i))t.has(s)&&o(s);n.delete(i),r.add(i)}};for(let i of t.keys())o(i)}function le(e){let t=R(e,"Mutation document"),n=Array.isArray(t)?{schema_version:1,mutations:t}:t;if(!p(n))throw new d("Mutation document must be a JSON array or object.",c.USAGE);for(let r of Object.keys(n))if(!W.includes(r))throw y("mutation document",r,W);if(n.schema_version!==void 0&&n.schema_version!==1)throw new d("Mutation document schema_version must be 1.",c.USAGE);if(!Array.isArray(n.mutations)||n.mutations.length===0)throw new d("Mutation document requires a non-empty mutations array.",c.USAGE);return n.mutations.map((r,o)=>{if(!p(r))throw new d(`Mutation ${o+1} must be an object.`,c.USAGE);for(let i of Object.keys(r))if(!J.includes(i))throw y(`mutation ${o+1}`,i,J);return{...r}})}function me(e,t){let n=Object.create(null);for(let[r,o]of e.entries())if(o.ref!==void 0){if(o.op!=="create")throw new d(`Mutation ${r+1} ref is only valid for create operations.`,c.USAGE);if(typeof o.ref!="string"||!Y.test(o.ref))throw new d(`Mutation ${r+1} ref must match ${Y.source}.`,c.USAGE);if(n[o.ref]!==void 0)throw new d(`Duplicate mutation ref "${o.ref}".`,c.USAGE);n[o.ref]=typeof o.id=="string"&&o.id.trim().length>0?U(o.id,t.idPrefix):ue(t.transactionId,o.ref,t.idPrefix)}return n}function mt(e,t){let n=le(e),r=me(n,t);fe(n);let o=n.map(a=>{let u={...a},m=typeof u.ref=="string"?u.ref:void 0;if(delete u.ref,m!==void 0?u.id=r[m]:u.id=H(u.id,r),p(u.options)){let f={...u.options};for(let w of["parent","blockedBy"])f[w]!==void 0&&(f[w]=H(f[w],r));Array.isArray(f.dep)?f.dep=f.dep.map(w=>X(w,r)):f.dep!==void 0&&(f.dep=X(f.dep,r)),u.options=f}return u}),i=ne(JSON.stringify(o)),s=i.filter(a=>a.op==="create").map(a=>a.id);if(new Set(s).size!==s.length)throw new d("Duplicate resolved create id in mutation document.",c.USAGE);return{schema_version:1,mutations:i,references:r}}function re(e,t){return t.filter(n=>e[n]!==void 0&&e[n]!==null).map(n=>{let r=String(e[n]);return`${n}=${/[",\n\r\\]/u.test(r)?JSON.stringify(r):r}`}).join(",")}function ye(e,t,n){if(e!==void 0){if(!Array.isArray(e)||!e.every(p))throw new d(`${n} must be an array of objects.`,c.USAGE);return e.map(r=>re(r,t))}}function he(e,t){return e==="tags"&&Array.isArray(t)&&t.every(n=>typeof n=="string")?JSON.stringify(t):typeof t=="number"||typeof t=="boolean"?String(t):t}function Z(e,t,n=!1){let r=[["dependencies","dep",["id","kind","created_at","author","source_kind"]],["comments","comment",["text","created_at","author"]],["notes","note",["text","created_at","author"]],["learnings","learning",["text","created_at","author"]],["files","file",["path","scope","note"]],["tests","test",["command","scope","timeout_seconds"]],["docs","doc",["path","scope","note"]],["reminders","reminder",["at","text","created_at"]],["events","event",["start_at","end_at","title","location"]],["type_options","typeOption",["key","value"]]];for(let[o,i,s]of r){let a=t[o],u=ye(n&&["comments","notes","learnings"].includes(o)&&Array.isArray(a)?a.filter(m=>!p(m)||m.created_at===void 0):a,s,o);u!==void 0&&u.length>0&&(e[i]=u)}}function we(e,t){for(let n of Object.keys(e)){if(t){if(!E.includes(n))throw y("item envelope",n,E);continue}if(!_.has(n)&&g(n,[..._])===void 0&&g(n,E)==="item")throw y("item envelope",n,E)}}function _e(e){let t=Object.hasOwn(e,"item");we(e,t);let n=t?e.item:e;if(!p(n))throw new d("Item document item must be an object.",c.USAGE);return{item:n,...t&&p(e.linked)?{linked:e.linked}:{}}}function Ee(e,t,n,r){if(!(r==="update"?se:te).has(t)){if(!_.has(t)){if(g(t,[..._])!==void 0)throw y("item document",t,[..._]);let s=Array.isArray(e.field)?e.field:[];s.push(re({key:t,value:typeof n=="string"?n:JSON.stringify(n)},["key","value"])),e.field=s;return}["dependencies","comments","notes","learnings","files","tests","docs","reminders","events","type_options"].includes(t)||(e[t.replaceAll(/_([a-z])/gu,(i,s)=>s.toUpperCase())]=he(t,n))}}function yt(e,t,n={}){let r=R(e,"Item document");if(!p(r))throw new d("Item document must be a JSON object.",c.USAGE);let{item:o,linked:i}=_e(r),s={};for(let[a,u]of Object.entries(o))Ee(s,a,u,t);return Z(s,o,t==="update"),i!==void 0&&Z(s,i),{...s,...Object.fromEntries(Object.entries(n).filter(([,a])=>a!==void 0)),stdinJson:void 0}}function ht(e){return ne(JSON.stringify(e))}import ge from"node:crypto";import Ae from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ed638747-7a72-5332-87fc-c82088457b91")}catch{}})();async function l(e,t){try{let r=(await P(t,{},{pmRoot:e})).item;return{id:r.id,closedAt:r.closed_at,updatedAt:r.updated_at,assignee:r.assignee,claimPrincipal:r.claim_principal}}catch(n){if(n instanceof d&&n.exitCode===c.NOT_FOUND)return;throw n}}function I(e,t){let n=e.id.replaceAll(/[^a-zA-Z0-9._-]/gu,"_"),r=ge.createHash("sha256").update(k(e)).digest("hex").slice(0,12);return`${t+1}-${e.op}-${n}-${r}`}function Te(e,t){let n=e.id.replaceAll(/[^a-zA-Z0-9._-]/gu,"_");return`${t+1}-${e.op}-${n}`}function h(e,t,n){return`bulk-item-transaction ${e} ${t} ${n}`}async function A(e,t,n,r){let o=await N(Ae.join(e,"history",`${t}.jsonl`),t),i=h(n,r,"apply"),s=h(n,r,"compensate");for(let a=o.length-1;a>=0;a-=1){let u=o[a].message;if(u===i)return!0;if(u===s)return!1}return!1}async function M(e,t){let n=await l(e,t.id);if(n?.updatedAt===void 0)throw new d(`Bulk ${t.op} target ${t.id} does not exist or has no restorable version`,c.NOT_FOUND);return{target_updated_at:n.updatedAt}}async function T(e,t,n,r){let o=r!==null&&typeof r=="object"&&!Array.isArray(r)?r.target_updated_at:void 0;typeof o=="string"&&await l(e.pmRoot,t)!==void 0&&await L(t,o,{force:!0,author:e.author,message:h(e.transactionId,n,"compensate")},{pmRoot:e.pmRoot})}function oe(e,t,n){return{id:n,async inspect(){let r=await l(e.pmRoot,t.id);return r===void 0?{state:"pending"}:{state:"applied",result:{id:r.id,op:"create"}}},async apply(){let o=(await z({...t.options,author:e.author,id:t.id},{pmRoot:e.pmRoot})).item;return{id:String(o.id),op:"create"}},async compensate(){let r=await l(e.pmRoot,t.id);if(r!==void 0){if(e.createCompensation==="delete"){await F(t.id,{force:!0,author:e.author,message:`Compensate interrupted bulk transaction ${e.transactionId}`},{pmRoot:e.pmRoot});return}r.closedAt===void 0&&await S(t.id,`Compensated: interrupted bulk transaction ${e.transactionId}`,{force:!0,author:e.author},{pmRoot:e.pmRoot})}}}}function Se(e,t,n){return{id:n,async inspect(){let r=await l(e.pmRoot,t.id);return r===void 0?{state:"pending"}:await A(e.pmRoot,r.id,e.transactionId,n)?{state:"applied",result:{id:r.id,op:"update"}}:{state:"pending"}},async prepareCompensation(){return M(e.pmRoot,t)},async apply(){let o=(await K(t.id,{...t.options,author:e.author,message:h(e.transactionId,n,"apply")},{pmRoot:e.pmRoot})).item;return{id:String(o.id),op:"update"}},async compensate(r){await T(e,t.id,n,r)}}}function be(e,t,n){return{id:n,async inspect(){let r=await l(e.pmRoot,t.id);return r===void 0?{state:"pending"}:await A(e.pmRoot,r.id,e.transactionId,n)?{state:"applied",result:{id:r.id,op:"close"}}:r.closedAt===void 0?{state:"pending"}:{state:"applied",result:{id:r.id,op:"close"}}},async prepareCompensation(){return M(e.pmRoot,t)},async apply(){let o=(await S(t.id,t.reason,{...t.options,author:e.author,message:h(e.transactionId,n,"apply")},{pmRoot:e.pmRoot})).item;return{id:String(o.id),op:"close"}},async compensate(r){await T(e,t.id,n,r)}}}function Re(e,t,n){return{id:n,async inspect(){let r=await l(e.pmRoot,t.id);return r===void 0?{state:"pending"}:await A(e.pmRoot,r.id,e.transactionId,n)?{state:"applied",result:{id:r.id,op:"release"}}:r.assignee!==void 0||r.claimPrincipal!==void 0?{state:"pending"}:{state:"applied",result:{id:r.id,op:"release"}}},async prepareCompensation(){return M(e.pmRoot,t)},async apply(){let o=(await B(t.id,{...t.options,author:e.author,message:h(e.transactionId,n,"apply")},{pmRoot:e.pmRoot})).item;return{id:String(o.id),op:"release"}},async compensate(r){await T(e,t.id,n,r)}}}function Ie(e,t,n){let r=I(t,n);switch(t.op){case"create":return oe(e,t,r);case"update":return Se(e,t,r);case"close":return be(e,t,r);case"release":return Re(e,t,r)}}function Me(e,t){if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(`Bulk mutation ${t+1} must be an object`);if(!["create","update","close","release"].includes(e.op))throw new TypeError(`Bulk mutation ${t+1} op must be create, update, close, or release`);if(typeof e.id!="string"||e.id.trim().length===0)throw new TypeError(`Bulk mutation ${t+1} requires a non-empty id`);if(e.op==="close"&&(typeof e.reason!="string"||e.reason.trim().length===0))throw new TypeError(`Bulk close mutation ${t+1} requires a non-empty reason`)}async function Oe(e){let t=[...e.mutations];if(t.length===0)throw new TypeError("Bulk item transaction requires at least one mutation");for(let[s,a]of t.entries())Me(a,s);let n=e.createCompensation??"close";if(!["close","delete"].includes(n))throw new TypeError("Bulk item transaction createCompensation must be close or delete");let r={pmRoot:e.pmRoot,author:e.author,transactionId:e.transactionId,createCompensation:n},o=await x({pmRoot:e.pmRoot,transactionId:e.transactionId,author:e.author,steps:t.map((s,a)=>Ie(r,s,a)),...e.lockTtlSeconds===void 0?{}:{lockTtlSeconds:e.lockTtlSeconds},...e.lockWaitMs===void 0?{}:{lockWaitMs:e.lockWaitMs},...e.onTransition===void 0?{}:{onTransition:e.onTransition}}),i={};for(let[s,a]of t.entries()){let u=I(a,s),m=o.results[u];i[Te(a,s)]=m}return{transactionId:o.transactionId,status:"committed",recovered:o.recovered,results:i}}function $e(e){let t=[];return e.evidence!==void 0&&Object.keys(e.evidence).length>0&&t.push({op:"update",id:e.id,options:e.evidence}),t.push({op:"close",id:e.id,reason:e.reason,...e.closeOptions===void 0?{}:{options:e.closeOptions}},{op:"release",id:e.id,...e.releaseOptions===void 0?{}:{options:e.releaseOptions}}),t}function It(e){return Oe({pmRoot:e.pmRoot,transactionId:e.transactionId,author:e.author,mutations:$e(e),...e.lockTtlSeconds===void 0?{}:{lockTtlSeconds:e.lockTtlSeconds},...e.lockWaitMs===void 0?{}:{lockWaitMs:e.lockWaitMs},...e.onTransition===void 0?{}:{onTransition:e.onTransition}})}var Mt={buildCreateStep:oe,bulkHistoryMarker:h,compensateByRestore:T,deriveStepId:I,isUpdateMarkerApplied:A,readItemSnapshot:l};export{lt as a,ne as b,mt as c,yt as d,ht as e,Oe as f,$e as g,It as h,Mt as i};
2
- //# sourceMappingURL=chunk-VLUQOIDT.js.map
@@ -1,2 +0,0 @@
1
- import"./chunk-QWRRFYK3.js";import{$a as H,Ba as V,Da as N,Ea as $,Fa as U,Hb as x,Jb as j,Kb as J,Kc as te,Lb as z,Lc as ne,Mb as G,Nc as ae,Rb as W,Sa as E,Sb as Y,Ta as q,Tb as K,Tc as oe,Ua as D,Ub as X,Uc as ie,Vb as Q,Vc as re,Wc as B,Xb as Z,aa as L,ad as se,rc as ee}from"./chunk-D55A5AEN.js";import"./chunk-KOQMGCTA.js";import"./chunk-7KL6KMWF.js";import"./chunk-WYRZZ5ZE.js";import{B as m,D as h,El as p,Pd as O,Qa as _,Wc as R,Zg as I,aa as S,dl as P,hl as c,kl as b,ll as s,ml as w,ol as M,pl as F,tc as C,vf as l,wf as d}from"./chunk-KIKDWECH.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]="13159f49-7756-58b8-ac32-7ddd571e7d09")}catch{}})();var le=new Map([["measurements","boolean"],["metric","string"],["measurementLimit","number"],["observe","string_array"],["direction","direction"],["measurementSource","string"],["measurementItem","string"],["measurementRevision","string"],["author","string"],["message","string"],["provenanceCoverage","boolean"],["fleetAttribution","boolean"],["since","string"],["eventLimit","number"],["minimumSample","number"]]),pe=new Set(["higher","lower","target"]),ye=[...le.keys()].sort((e,t)=>e.localeCompare(t)).join(", ");function ge(e,t){return e==="boolean"?typeof t=="boolean":e==="string"?typeof t=="string":e==="number"?typeof t=="number":e==="string_array"?Array.isArray(t)&&t.every(n=>typeof n=="string"):e==="direction"&&pe.has(t)}function ce(e){if(e===void 0)return{};let t;try{t=JSON.parse(e)}catch(n){throw new h(`--analytics must be valid JSON: ${String(n)}`,m.USAGE)}if(t===null||typeof t!="object"||Array.isArray(t))throw new h("--analytics must be a JSON object.",m.USAGE);for(let[n,a]of Object.entries(t)){let o=le.get(n);if(!ge(o,a))throw new h(o===void 0?`Unknown --analytics field "${n}". Accepted fields: ${ye}.`:`--analytics field "${n}" must be ${o.replace("_"," ")}.`,m.USAGE)}return 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]="eee25545-a7e9-54be-abc0-dbccc9b41e74")}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]="b0095f00-00bd-5b28-933c-b63a1711a73d")}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]="99355d20-090b-503e-8079-b858291938e3")}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]="35276f20-abc5-54e2-8251-35971f1fcb4f")}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]="8fa4af33-ba9f-5a19-a359-c64143287b5d")}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]="52c4154e-2761-5230-942c-6ac5e83a830c")}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]="c3fceb32-e0b9-5690-8653-4c699f865c0f")}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]="1e42a508-5568-522f-843d-61febc0bad27")}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]="43769e60-ed80-521d-9375-c28ee5b0ac06")}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]="3f1deb3b-e341-533a-a349-eca48f347600")}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]="91a42861-f8cb-575b-8596-53870f6275c6")}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]="c85956ff-383f-5482-96a9-0ef38949859c")}catch{}})();var de=(e,t)=>V(e,t,{runUpdate:(n,a,o)=>x(n,a,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]="1adbac08-0950-55be-82bf-cc4dc7b6ad18")}catch{}})();async function he(e,t,n,a,o){let i=c(o),r=e==="run",u=e==="verdicts",f=await U({action:e,...r||u?{}:{kind:t},id:r||u?n??t:n,definition:s(a,"definition"),trigger:s(a,"trigger"),tree:s(a,"tree"),gate:s(a,"gate"),limit:s(a,"limit"),dry_run:a.dryRun===!0,fullChangedFields:i.fullChangedFields,idOnly:i.idOnly,author:s(a,"author"),message:s(a,"message")},i);l(f,i),typeof f=="object"&&f!==null&&"exit_code"in f&&f.exit_code===1&&(process.exitCode=1)}function ue(e){e.command("assurance").argument("<action>",`Action: ${N.join(", ")}`).argument("[kind]",`Declaration kind: ${$.join(", ")}; for run this may be the gate id`).argument("[id]","Declaration or gate id").description("Declare and evaluate SDK-owned project assurance contracts.").option("--definition <json>","JSON declaration for put").option("--trigger <value>","Gate lifecycle trigger").option("--tree <value>","Commit, tree, or snapshot identity being judged").option("--gate <id>","Filter verdict history by gate id").option("--limit <number>","Maximum newest verdicts returned").option("--dry-run","Evaluate a gate without appending a verdict").option("--author <value>","Mutation author override").option("--message <value>","Audited mutation rationale").action(he)}(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]="7796ea07-0de7-5db8-a3b5-a8021ceebc69")}catch{}})();function be(e,t){let n=e?.trim().toLowerCase(),a=t?.trim().toLowerCase();if(n===void 0||n.length===0)return a;if(n==="local-analytics")return a&&a.length>0?a:"status";if(a!==void 0&&a.length>0)throw S({command_path:"telemetry",token:`${e} ${t}`,allowed:["status","flush","stats","clear","local-analytics"],token_kind:"path",examples:["pm telemetry stats --limit 10","pm telemetry local-analytics status --json"]});return n}function we(e){return{addValues:Array.isArray(e.add)?e.add:[],addJsonValues:Array.isArray(e.addJson)?e.addJson:[],removeValues:Array.isArray(e.remove)?e.remove:[],removeIndexValues:Array.isArray(e.removeIndex)?e.removeIndex:[]}}function ke(e,t){if(e.background===!0){if(e.run!==!0)throw new h("--background requires --run",m.USAGE);if(t.addValues.length>0||t.addJsonValues.length>0||t.removeValues.length>0||t.removeIndexValues.length>0)throw new h("--background does not support --add/--add-json/--remove/--remove-index; update linked tests first, then run in background",m.USAGE)}}async function ve(e,t,n,a){let o=await B({kind:"test",commandArgs:M(e,{...t,add:a.addValues,addJson:a.addJsonValues,remove:a.removeValues,removeIndex:a.removeIndexValues}),targetId:e,author:typeof t.author=="string"?t.author:void 0,noExtensions:n.noExtensions===!0},n);l(o,n)}function xe(e,t){return{add:t.addValues,addJson:t.addJsonValues,remove:t.removeValues,removeIndex:t.removeIndexValues,list:!!e.list,run:!!e.run,match:typeof e.match=="string"?e.match:void 0,onlyIndex:typeof e.onlyIndex=="string"||typeof e.onlyIndex=="number"?e.onlyIndex:void 0,onlyLast:!!e.onlyLast,timeout:typeof e.timeout=="string"?e.timeout:void 0,progress:!!e.progress,envSet:Array.isArray(e.envSet)?e.envSet:[],envClear:Array.isArray(e.envClear)?e.envClear:[],sharedHostSafe:!!e.sharedHostSafe,pmContext:typeof e.pmContext=="string"?e.pmContext:void 0,overrideLinkedPmContext:!!e.overrideLinkedPmContext,failOnContextMismatch:!!e.failOnContextMismatch,failOnSkipped:!!e.failOnSkipped,failOnEmptyTestRun:!!e.failOnEmptyTestRun,requireAssertionsForPm:!!e.requireAssertionsForPm,checkContext:!!e.checkContext,autoPmContext:!!e.autoPmContext,author:typeof e.author=="string"?e.author:void 0,message:typeof e.message=="string"?e.message:void 0,force:!!e.force,measure:Array.isArray(e.measure)?e.measure:[],metricBelow:typeof e.metricBelow=="string"?e.metricBelow:void 0,metricDiff:typeof e.metricDiff=="string"?e.metricDiff:void 0}}async function Ae(e,t,n,a){let o=await oe(e,xe(t,a),n);(a.addValues.length>0||a.addJsonValues.length>0||a.removeValues.length>0||t.run===!0||a.removeIndexValues.length>0)&&await p(n,o),l(o,n),(o.run_results.some(i=>i.status==="failed")||o.fail_on_skipped_triggered===!0)&&(process.exitCode=m.DEPENDENCY_FAILED)}async function _e(e,t,n){let a=c(n),o=Date.now(),i=we(t);ke(t,i),t.background===!0?await ve(e,t,a,i):await Ae(e,t,a,i),a.profile&&d(`profile:command=test took_ms=${Date.now()-o}`)}function A(e){let t=s(e,"author"),n=s(e,"assignee");if(t!==void 0&&n!==void 0&&t!==n)throw new h("Lifecycle ownership received conflicting --author and --assignee values; use one actor value for both aliases.",m.USAGE,{code:"conflicting_lifecycle_owner",examples:["pm claim pm-123","pm start-task pm-123","pm release pm-123"]});return{author:t??n,message:s(e,"message")}}async function Ie(e,t){let n=c(t),a=Date.now();if(e.background===!0){let r=await B({kind:"test-all",commandArgs:F(e),statusFilter:s(e,"status"),noExtensions:n.noExtensions===!0},n);l(r,n),n.profile&&d(`profile:command=test-all took_ms=${Date.now()-a}`);return}let i=await ie({status:s(e,"status"),limit:s(e,"limit"),offset:s(e,"offset"),timeout:s(e,"timeout"),progress:!!e.progress,envSet:Array.isArray(e.envSet)?e.envSet:[],envClear:Array.isArray(e.envClear)?e.envClear:[],sharedHostSafe:!!e.sharedHostSafe,pmContext:s(e,"pmContext"),overrideLinkedPmContext:!!e.overrideLinkedPmContext,failOnContextMismatch:!!e.failOnContextMismatch,failOnSkipped:!!e.failOnSkipped,failOnEmptyTestRun:!!e.failOnEmptyTestRun,requireAssertionsForPm:!!e.requireAssertionsForPm,checkContext:!!e.checkContext,autoPmContext:!!e.autoPmContext},n);await p(n,{ids:i.results.map(r=>r.id)}),l(i,n),(i.failed>0||i.fail_on_skipped_triggered===!0)&&(process.exitCode=m.DEPENDENCY_FAILED),n.profile&&d(`profile:command=test-all took_ms=${Date.now()-a}`)}async function De(e,t,n,a){let o=c(a),i=Date.now(),r=await ae({subcommand:be(e,t),limit:s(n,"limit")},o);l(r,o),o.profile&&d(`profile:command=telemetry took_ms=${Date.now()-i}`)}async function Se(e,t){let n=c(t),a=Date.now(),o=ce(s(e,"analytics")),i=await te(n,{includeEmpty:e.includeEmpty===!0,storage:e.storage===!0,metadataCoverage:e.metadataCoverage===!0,byAssignee:e.byAssignee===!0,byTag:e.byTag===!0,byPriority:e.byPriority===!0,tagPrefix:s(e,"tagPrefix"),fieldUtilization:e.fieldUtilization===!0,...o});i.recorded_observations?.some(r=>r.changed)===!0&&await p(n,{ids:i.recorded_observations?.flatMap(r=>r.observation.item_id?[r.observation.item_id]:[])}),l(i,n),n.profile&&d(`profile:command=stats took_ms=${Date.now()-a}`)}async function Ce(e,t){let n=c(t),a=Date.now(),o=s(e,"threshold"),i=s(e,"limit"),r=await ne(n,{status:Array.isArray(e.status)&&e.status.length>0?e.status:void 0,since:s(e,"since"),...o===void 0?{}:{threshold:Number(o)},...i===void 0?{}:{limit:Number(i)}});l(r,n),n.profile&&d(`profile:command=duplicates took_ms=${Date.now()-a}`)}async function Re(e,t){let n=c(t),a=Date.now(),o=await L(n,{strictDirectories:!!e.strictDirectories,requireMergeDrivers:!!e.requireMergeDrivers,checkOnly:!!e.checkOnly,checkTelemetry:!!e.checkTelemetry,noRefresh:!!e.noRefresh,refreshVectors:!!e.refreshVectors,verboseStaleItems:!!e.verboseStaleItems,verboseAuthorEvents:!!e.verboseAuthorEvents,brief:!!e.brief,summary:!!e.summary,skipVectors:!!e.skipVectors,skipIntegrity:!!e.skipIntegrity,skipDrift:!!e.skipDrift,full:!!e.full});l(o,n),(e.strictExit||e.failOnWarn)&&!o.ok&&(C({...o,exit_code:m.GENERIC_FAILURE,error_code:"health_findings",error_category:"validation",command_resolution:"health_findings",resolution_stage:"execute"}),process.exitCode=m.GENERIC_FAILURE),n.profile&&d(`profile:command=health took_ms=${Date.now()-a}`)}async function Ee(e,t){let n=c(t),a=Date.now(),o=await de({checkMetadata:!!e.checkMetadata,metadataProfile:s(e,"metadataProfile"),checkResolution:!!e.checkResolution,checkLifecycle:!!e.checkLifecycle,checkStaleBlockers:!!e.checkStaleBlockers,dependencyCycleSeverity:s(e,"dependencyCycleSeverity"),parentCycleSeverity:s(e,"parentCycleSeverity"),checkFiles:!!e.checkFiles,checkCommandReferences:!!e.checkCommandReferences,scanMode:s(e,"scanMode"),includePmInternals:!!e.includePmInternals,verboseFileLists:!!e.verboseFileLists,verboseDiagnostics:!!e.verboseDiagnostics,allAffectedIds:!!e.allAffectedIds,checkHistoryDrift:!!e.checkHistoryDrift,checkStorageIntegrity:!!e.checkStorageIntegrity,fixHints:!!e.fixHints,autoFix:!!e.autoFix,dryRun:!!e.dryRun,fixScope:Array.isArray(e.fixScope)?e.fixScope:void 0,pruneMissing:!!e.pruneMissing,counts:!!e.counts,full:!!e.full},n);l(o,n),(e.strictExit||e.failOnWarn)&&(o.has_warnings||!o.ok)&&(C({...o,exit_code:m.GENERIC_FAILURE,error_code:"validation_findings",error_category:"validation",command_resolution:"validation_findings",resolution_stage:"execute"}),process.exitCode=m.GENERIC_FAILURE),n.profile&&d(`profile:command=validate took_ms=${Date.now()-a}`)}async function Be(e,t){let n=c(t),a=Date.now(),o=await j(n,{dryRun:e.dryRun===!0,scope:Array.isArray(e.scope)?e.scope:[]});l(o,n),n.profile&&d(`profile:command=gc took_ms=${Date.now()-a}`)}async function Te(e,t,n,a){let o=c(a),i=_(process.cwd(),o.path),r=e.trim().toLowerCase();if(!["create","list","inspect","restore","delete"].includes(r))throw S({command_path:"workspace snapshot",token:e,allowed:["create","list","inspect","restore","delete"],display_name:"workspace snapshot",token_kind:"action",examples:["pm workspace snapshot create before-migration","pm workspace snapshot restore before-migration"]});if(r==="list"){l(await K(i),o);return}if(r==="create"){l(await W(i,t===void 0?{}:{name:t}),o);return}if(t===void 0)throw new h(`pm workspace snapshot ${r} requires a snapshot name or fingerprint`,m.USAGE);if(r==="inspect"){l(await Y(i,t),o);return}if(r==="restore"){if(n.dryRun===!0){l(await X(i,t),o);return}let u=await I(i);l(await Q(i,t,{force:n.force===!0,author:O(s(n,"author"),u.author_default),message:s(n,"message"),lockTtlSeconds:u.locks.ttl_seconds,lockWaitMs:u.locks.wait_ms}),o);return}l(await Z(i,t),o)}async function Oe(e,t){let n=c(t),a=Date.now(),o=await ee({action:s(e,"action"),command:s(e,"command"),summary:!!e.summary,schemaOnly:!!e.schemaOnly,flagsOnly:!!e.flagsOnly,availabilityOnly:!!e.availabilityOnly,runtimeOnly:!!e.runtimeOnly||!!e.activeOnly,full:!!e.full},n);l(o,n),n.profile&&d(`profile:command=contracts took_ms=${Date.now()-a}`)}async function Pe(e,t,n){let a=c(n),o=Date.now(),i={...A(t),ifAvailable:t.ifAvailable===!0,maxAttempts:t.maxAttempts};Me(e,t.next===!0);let r=t.next===!0?await q(!!t.force,a,i,{type:typeof t.type=="string"?t.type:void 0,tag:typeof t.tag=="string"?t.tag:void 0,priority:t.priority,assigneeFilter:typeof t.assigneeFilter=="string"?t.assigneeFilter:void 0,parent:typeof t.parent=="string"?t.parent:void 0,sprint:typeof t.sprint=="string"?t.sprint:void 0,release:typeof t.release=="string"?t.release:void 0,includeDecisions:t.includeDecisions===!0,tokenBudget:t.tokenBudget??t.token_budget,explainRanking:t.explainRanking===!0||t.explain_ranking===!0}):await E(e,!!t.force,a,i);await p(a,r),l(r,a),a.profile&&d(`profile:command=claim took_ms=${Date.now()-o}`)}function Me(e,t){if(!t&&!e)throw new h("Specify an item id or pass --next",m.USAGE);if(t&&e)throw new h("Specify either an item id or --next, not both",m.USAGE)}async function Fe(e,t,n){let a=c(n),o=Date.now(),i=await D(e,!!t.force,a,{...A(t),ownershipReleaseBypass:t.ownershipReleaseBypass===!0});await p(a,i),l(await P("release",[e],t,a,i),a),a.profile&&d(`profile:command=release took_ms=${Date.now()-o}`)}async function Le(e,t,n){let a=c(n),o=Date.now(),i=_(process.cwd(),a.path),r=await I(i),u=R(r.schema),f=re(u),g=!!t.force,k=A(t),v=await E(e,g,a,k);await p(a,v);let T=await x(e,{...k,status:f,force:g},a);await p(a,T),l({id:e,action:"start_task",claim:v,update:T},a),a.profile&&d(`profile:command=start-task took_ms=${Date.now()-o}`)}async function Ve(e,t,n){let a=c(n),o=Date.now(),i=_(process.cwd(),a.path),r=await I(i),u=R(r.schema),f=!!t.force,g=A(t),k=await x(e,{...g,status:u.open_status,force:f},a);await p(a,k);let v=await D(e,f,a,g);await p(a,v),l({id:e,action:"pause_task",update:k,release:v},a),a.profile&&d(`profile:command=pause-task took_ms=${Date.now()-o}`)}async function Ne(e,t,n,a){let o=c(a),i=Date.now(),r=!!n.force,u=A(n),f=await H(e,t,{...u,validateClose:s(n,"validateClose"),force:r},o);await p(o,f);let g=await D(e,r,o,u);await p(o,g),l({id:e,action:"close_task",close:f,release:g},o),o.profile&&d(`profile:command=close-task took_ms=${Date.now()-i}`)}function me(e){return e.option("--background","Run linked tests in managed background mode").option("--timeout <seconds>","Default run timeout in seconds").option("--progress","Emit linked-test progress to stderr (always shown in TTY, opt-in for non-TTY)").option("--env-set <value>","Set environment variable(s) for linked-test runs (KEY=VALUE, repeatable)",b).option("--env-clear <value>","Clear environment variable(s) for linked-test runs (NAME, repeatable)",b).option("--shared-host-safe","Apply additive shared-host-safe runtime defaults for linked-test runs").option("--pm-context <mode>","PM linked-test context mode: schema|tracker|auto (default: schema)").option("--override-linked-pm-context","Force run-level --pm-context to override per-linked-test pm_context_mode metadata").option("--fail-on-context-mismatch","Fail linked PM commands when context item counts differ").option("--fail-on-skipped","Treat skipped linked tests as dependency failures").option("--fail-on-empty-test-run","Treat successful linked-test commands that report zero executed tests as failures").option("--require-assertions-for-pm","Require assertion metadata for linked PM command tests").option("--check-context","Preflight linked PM command context diagnostics before executing commands").option("--auto-pm-context","Auto-remediate PM tracker-read context mismatches by routing those linked commands through tracker context")}function Nt(e){ue(e);let t=e.command("test").argument("<id>","Item id").option("--add <value>","Add linked test entry (CSV/markdown pairs or - for stdin)",b).option("--add-json <value>","Add linked test entry from JSON object/array (or - for stdin)",b).option("--remove <value>","Remove linked test entry by exact command/path (command=<value> and path=<value> preserve commas and equals signs; or - for stdin)",b).option("--remove-index <n>","Remove the 1-based linked-test index from --list order (repeatable)",b).option("--list","List linked tests without mutating").option("--run","Run linked test commands").option("--match <value>","Run only linked tests whose command/path contains this substring").option("--only-index <n>","Run only the 1-based linked-test index from --list order").option("--only-last","Run only the most recently added linked test");me(t).option("--measure <value>","Record name=value[,unit=...][,threshold=...] evidence; repeatable",b).option("--metric-below <value>","Return evidence below name=value").option("--metric-diff <name>","Diff the latest two values").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").description("Manage tests linked to an item and optionally run them.").action(_e);let n=e.command("test-all").description("Run linked tests across matching items.").option("--status <value>","Filter items by status before running tests").option("--limit <n>","Limit matching items before running linked tests").option("--offset <n>","Skip matching items before running linked tests");me(n).action(Ie),e.command("test-runs-worker",{hidden:!0}).argument("<runId>","Background run id").description("Internal background worker command.").action(async(f,g,k)=>{let v=c(k);await se(f,v)}),e.command("telemetry").argument("[namespaceOrSubcommand]","Telemetry subcommand: status, flush, stats, clear (default: status)").argument("[subcommand]","Compatibility alias target for local-analytics: status, flush, stats, clear").option("--limit <n>","Maximum command groups returned by telemetry stats").description("Inspect and manage local telemetry queue/runtime state.").action(De),e.command("duplicates").description("Find existing duplicate clusters across all statuses without creating an item.").option("--status <value>","Lifecycle status to include (repeatable or comma-separated)",b,[]).option("--since <value>","Only inspect items created at or after this time").option("--threshold <value>","Minimum similarity score from 0 through 1").option("--limit <n>","Maximum duplicate clusters to return").action(Ce),e.command("stats").description("Show project tracker statistics.").option("--include-empty","Restore zero-count registered item-type and lifecycle-status buckets").option("--storage","Include aggregate history-stream storage metrics (total streams/lines/bytes, largest + deepest streams, oldest/newest entries)").option("--metadata-coverage","Include metadata coverage % (acceptance_criteria, estimated_minutes, resolution, tags, parent) overall and by type").option("--by-assignee","Include a lifecycle-bucketed item breakdown grouped by assignee").option("--by-tag","Include a lifecycle-bucketed item breakdown grouped by tag").option("--by-priority","Include a lifecycle-bucketed item breakdown grouped by priority").option("--tag-prefix <value>","With --by-tag: only count tags starting with this prefix (e.g. domain:)").option("--field-utilization","Report content-field utilization rates (notes/learnings/files/docs/tests/comments/deps/body) for governance analysis").option("--analytics <json>","Improvement ledger/history analytics JSON").action(Se),e.command("health").description("Show project tracker health checks.").option("--strict-directories","Treat optional item-type directories as required failures").option("--require-merge-drivers","Treat absent clone-local merge drivers as a required health failure").option("--check-only","Run read-only health diagnostics without refreshing vectors").option("--check-telemetry","Probe telemetry endpoint health and include network diagnostics").option("--no-refresh","Disable automatic vector refresh attempts during health checks").option("--refresh-vectors","Explicitly enable vector refresh attempts during health checks").option("--verbose-stale-items","Include full stale vectorization ID lists in health output").option("--verbose-author-events","Include every actionable unknown-author event coordinate for review or disposition").option("--brief","Emit compact health details for low-token agent checks").option("--summary","Emit one-line-style health status with check names and warning count").option("--skip-vectors","Skip vectorization check for a faster run").option("--skip-integrity","Skip item/history file integrity check for a faster run").option("--skip-drift","Skip history drift hash check for a faster run").option("--full","Run all checks including slow integrity, drift, and vectorization checks").option("--strict-exit","Return non-zero exit when health is not ok (advisory telemetry warnings are excluded; see warnings[])").option("--fail-on-warn","Alias for --strict-exit").action(Re),e.command("validate").description("Run standalone metadata, resolution, lifecycle, files, linked-command reference, and history drift validation checks.").option("--check-metadata","Run metadata completeness checks").option("--metadata-profile <value>","Select metadata validation profile for --check-metadata (core|strict|custom)").option("--check-resolution","Run closed-item resolution metadata checks").option("--check-lifecycle","Run active-item lifecycle governance drift checks").option("--check-stale-blockers","Include stale blocker-pattern diagnostics in lifecycle checks").option("--dependency-cycle-severity <value>","Set dependency-cycle warning policy for lifecycle checks (off|warn|error)").option("--parent-cycle-severity <value>","Set parent-hierarchy cycle warning policy for lifecycle checks (off|warn|error)").option("--check-files","Run linked-file and orphaned-file checks").option("--check-command-references","Run linked-command PM-ID reference checks").option("--scan-mode <value>","Select file candidate scan mode for --check-files (default|tracked-all|tracked-all-strict)").option("--include-pm-internals","Include PM storage internals in tracked-all candidate scans").option("--verbose-file-lists","Include full file-path lists for validate --check-files details").option("--verbose-diagnostics","Include full validate diagnostic ID lists instead of compact summaries").option("--all-affected-ids","Emit complete missing_* affected-ID lists with no truncation (implied by --json)").option("--strict-exit","Return non-zero exit when validation warnings are present").option("--fail-on-warn","Alias for --strict-exit").option("--fix-hints","Add a machine-executable fix_hints[] of pm commands to each failing check's details").option("--auto-fix","Apply the safe, deterministic subset of fix-hint remediations (field backfills) automatically").option("--dry-run","Preview planned --auto-fix/--prune-missing fixes without applying them").option("--fix-scope <scope>","Grant --auto-fix scopes (metadata, resolution, lifecycle; comma-separated or repeatable). Default: metadata, resolution; lifecycle must be named explicitly",b).option("--prune-missing","Remove stale linked-file/doc LINKS whose paths classified as deleted (never touches real files)").option("--check-history-drift","Run item/history hash drift checks").option("--check-storage-integrity","Run the post-merge storage-integrity check (unreadable items, history conflict markers, resurrected deletes, unparseable config/schema)").option("--counts","Keep validation counts and totals while omitting per-item diagnostic arrays").option("--full","Return the complete validation diagnostic projection").action(Ee),e.command("gc").option("--dry-run","Preview cleanup targets without deleting files; without this flag, pm gc deletes matched artifacts").option("--scope <value>","Limit cleanup to one or more scopes (comma-separated or repeatable): index, embeddings, runtime, locks, checkpoints, transactions",b).description("Delete optional cache artifacts by default (including expired lock debris) and show a summary.").action(Be),e.command("workspace").description("Manage portable workspace-level SDK primitives.").command("snapshot").argument("<action>","Snapshot action: create, list, inspect, restore, delete").argument("[target]","Optional name for create; name or fingerprint otherwise").description("Create, inspect, list, restore, or delete content-addressed tracker snapshots.").option("--dry-run","Preview restore file, item, stream, and history-entry impact without mutating state").option("--force","Explicitly confirm a whole-workspace snapshot restore").option("--author <value>","Actor recorded on the restore audit event").option("--message <value>","Human-readable restore rationale").action(Te),e.command("contracts").description("Show machine-readable command and schema contracts for agents.").option("--action <value>","Filter tool schema branches to a specific action").option("--command <value>","Scope contracts output to one CLI command (narrow-by-default)").option("--summary","Return one command+intent row per top-level command for cheap agent bootstrap").option("--schema-only","Return schema-focused output only").option("--flags-only","Return command flag contracts only").option("--availability-only","Return action availability surface only").option("--runtime-only","Include only actions invocable in the current runtime").option("--active-only","Alias for --runtime-only").option("--full","Include full schema and command-flag surfaces (large; default brief output omits heavy sections for unfiltered queries)").action(Oe);let a=e.command("claim").argument("[id]","Item id (omit with --next)").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force claim override").option("--if-available","Skip silently when the item is already claimed by another author (returns skipped=true)").option("--next","Atomically claim the next caller-available actionable item").option("--type <value>","Filter --next candidates by type").option("--tag <value>","Filter --next candidates by tag").option("--priority <value>","Filter --next candidates by priority").option("--assignee-filter <value>","Filter --next candidates: assigned|unassigned").option("--parent <id>","Scope --next candidates to a subtree").option("--sprint <value>","Filter --next candidates by sprint").option("--release <value>","Filter --next candidates by release").option("--max-attempts <n>","Bound the --next candidate walk (default 10; maximum 100)").option("--include-decisions","Allow --next to claim human-gated Decision items").option("--token-budget <n>","Bound the estimated tokens used to rank --next candidates").option("--explain-ranking","Include ranking provenance for --next selection").description("Claim an item for active work.").action(Pe);w(a,"--assignee <value>","Alias for --author on lifecycle ownership commands"),w(a,"--token_budget <n>","Alias for --token-budget"),w(a,"--explain_ranking","Alias for --explain-ranking");let o=e.command("release").argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force release override").description("Release an item's active claim.").action(Fe);w(o,"--assignee <value>","Alias for --author on lifecycle ownership commands");let i=e.command("start-task").argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership or terminal override when required").description("Lifecycle alias: claim an item and move it to in_progress.").action(Le);w(i,"--assignee <value>","Alias for --author on lifecycle ownership commands");let r=e.command("pause-task").argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override when required").description("Lifecycle alias: move an item to open and release its claim.").action(Ve);w(r,"--assignee <value>","Alias for --author on lifecycle ownership commands");let u=e.command("close-task").argument("<id>","Item id").argument("[reason]","Close reason text").option("--author <value>","Mutation author").option("--message <value>","History message").option("--validate-close <value>","Close-time validation mode: off|warn|strict").option("--force","Force ownership or terminal override when required").description("Lifecycle alias: close an item and release assignment metadata.").action(Ne);w(u,"--assignee <value>","Alias for --author on lifecycle ownership commands"),$e(e)}function y(e){return typeof e=="string"?e:void 0}function fe(e){return{parent:y(e.parent),allowMissingParent:e.allowMissingParent===!0?!0:void 0,tags:y(e.tags),priority:y(e.priority),body:y(e.body),description:y(e.description),author:y(e.author),message:y(e.message)}}function $e(e){for(let{name:t,describe:n}of[{name:"meet",describe:"Shortcut: create a Meeting with a start time and duration."},{name:"event",describe:"Shortcut: create an Event with a start time and duration."}])e.command(t).argument("<title>","Item title").option("--start <when>","Start time (ISO, 'now', or relative like +1h/+2d); defaults to now").option("--duration <span>","Duration from start (relative like 1h/2d); defaults to 1h when --end is omitted").option("--end <when>","End time (ISO or relative); overrides --duration").option("--location <value>","Location").option("--timezone <value>","IANA timezone (for example America/New_York)").option("--all-day","Mark as an all-day event").option("--parent <id>","Parent item id").option("--allow-missing-parent","Permit a parent id that does not exist yet").option("--tags <list>","Comma-separated tags").option("--priority <value>","Priority").option("--body <text>","Body/markdown content").option("--description <text>","Short description").option("--author <value>","Mutation author").option("--message <value>","History message").description(n).action(async(a,o,i)=>{let r=c(i),u=Date.now(),g=await(t==="meet"?J:z)(a,{...fe(o),start:y(o.start),duration:y(o.duration),end:y(o.end),location:y(o.location),timezone:y(o.timezone),allDay:o.allDay===!0?!0:void 0},r);await p(r,g),l(g,r),r.profile&&d(`profile:command=${t} took_ms=${Date.now()-u}`)});e.command("remind").argument("<title>","Item title").option("--at <when>","Reminder time (ISO, 'now', or relative like +2d); defaults to +1d").option("--text <value>","Reminder text; defaults to the title").option("--parent <id>","Parent item id").option("--allow-missing-parent","Permit a parent id that does not exist yet").option("--tags <list>","Comma-separated tags").option("--priority <value>","Priority").option("--body <text>","Body/markdown content").option("--description <text>","Short description").option("--author <value>","Mutation author").option("--message <value>","History message").description("Shortcut: create a Reminder from a single point in time.").action(async(t,n,a)=>{let o=c(a),i=Date.now(),r=await G(t,{...fe(n),at:y(n.at),text:y(n.text)},o);await p(o,r),l(r,o),o.profile&&d(`profile:command=remind took_ms=${Date.now()-i}`)})}export{Nt as registerOperationCommands,Me as requireClaimTarget};
2
- //# sourceMappingURL=register-operations-2OGISOVR.js.map