@unbrained/pm-cli 2026.11.1 → 2026.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +18 -0
  3. package/CONTRIBUTING.md +1 -1
  4. package/dist/cli/migration-gates.js +1 -1
  5. package/dist/cli-bundle/bundle-manifest.json +1 -1
  6. package/dist/cli-bundle/chunks/{chunk-TMPO4CTZ.js → chunk-3A4NVHYS.js} +2 -2
  7. package/dist/cli-bundle/chunks/{chunk-UUN3WNMQ.js → chunk-3ZQQVJT2.js} +3 -3
  8. package/dist/cli-bundle/chunks/{chunk-TYERATXH.js → chunk-4HW253W2.js} +2 -2
  9. package/dist/cli-bundle/chunks/{chunk-F3ECOBKA.js → chunk-4OELCF3O.js} +2 -2
  10. package/dist/cli-bundle/chunks/{chunk-2GK2IVU5.js → chunk-533L6D2N.js} +3 -3
  11. package/dist/cli-bundle/chunks/{chunk-NILQ2ZMV.js → chunk-ABFFRQRO.js} +2 -2
  12. package/dist/cli-bundle/chunks/chunk-BFZUJ5QP.js +115 -0
  13. package/dist/cli-bundle/chunks/{chunk-SBVX5CMV.js → chunk-D52QQ7LP.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-WFBYKDB2.js → chunk-DAZFCSDV.js} +2 -2
  15. package/dist/cli-bundle/chunks/{chunk-ICT6E4IW.js → chunk-EN27ZQSV.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-MRUA2Z43.js → chunk-GK2CHAT3.js} +2 -2
  17. package/dist/cli-bundle/chunks/{chunk-MTRIGD7M.js → chunk-HOGKWJU5.js} +42 -42
  18. package/dist/cli-bundle/chunks/{chunk-WX25MU4N.js → chunk-J3JM36EH.js} +3 -3
  19. package/dist/cli-bundle/chunks/{chunk-O56O7NIE.js → chunk-JRXD7SIL.js} +2 -2
  20. package/dist/cli-bundle/chunks/{chunk-5KW4WUAK.js → chunk-K46GDAKX.js} +2 -2
  21. package/dist/cli-bundle/chunks/{chunk-N45IXPCA.js → chunk-KJLGBLR3.js} +2 -2
  22. package/dist/cli-bundle/chunks/{chunk-UEEG47TU.js → chunk-NGRPD3ZO.js} +2 -2
  23. package/dist/cli-bundle/chunks/chunk-OJR2YGXF.js +31 -0
  24. package/dist/cli-bundle/chunks/chunk-QHHFXNSQ.js +3 -0
  25. package/dist/cli-bundle/chunks/{chunk-Y7CKVU56.js → chunk-RGHLQGEX.js} +2 -2
  26. package/dist/cli-bundle/chunks/{chunk-6PKWKVS6.js → chunk-VEOFWE32.js} +2 -2
  27. package/dist/cli-bundle/chunks/chunk-ZNWDYDFF.js +129 -0
  28. package/dist/cli-bundle/chunks/{indexed-receipt-blobs-KGMJVFH2.js → indexed-receipt-blobs-IEJ2QOW3.js} +2 -2
  29. package/dist/cli-bundle/chunks/item-transaction-JHPBH6N7.js +2 -0
  30. package/dist/cli-bundle/chunks/{mutation-admission-BOOCJPCU.js → mutation-admission-QUNQZCZ5.js} +2 -2
  31. package/dist/cli-bundle/chunks/{register-list-query-23OX36Q3.js → register-list-query-NZTK3AXA.js} +2 -2
  32. package/dist/cli-bundle/chunks/{register-mutation-JPJ5YNDX.js → register-mutation-2OFAMOVH.js} +2 -2
  33. package/dist/cli-bundle/chunks/{register-operations-IGR7ERY5.js → register-operations-RFMM5KZ6.js} +2 -2
  34. package/dist/cli-bundle/chunks/{register-setup-BMIFKZZP.js → register-setup-6B6Q7M5L.js} +2 -2
  35. package/dist/cli-bundle/chunks/{settlement-hook-YWSWFOZY.js → settlement-hook-UTCEZBFT.js} +2 -2
  36. package/dist/cli-bundle/chunks/{stage-ON7CYYPM.js → stage-VLI4OBVX.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/{chunk-5TWS5KOM.js → chunk-3UD6F2KQ.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/{chunk-5WCQFH6D.js → chunk-4NVPDZLX.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/{chunk-PAT6QF63.js → chunk-4UUE3YXZ.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/{chunk-2Y77HWIX.js → chunk-5UDDRPYR.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/{chunk-RPUDOJVB.js → chunk-745IDMTD.js} +2 -2
  42. package/dist/cli-bundle/focused-chunks/{chunk-3NYWMUX3.js → chunk-B6OOKKOX.js} +3 -3
  43. package/dist/cli-bundle/focused-chunks/{chunk-JCR32IAO.js → chunk-EJJWOFP5.js} +2 -2
  44. package/dist/cli-bundle/focused-chunks/chunk-FUGYXUUL.js +80 -0
  45. package/dist/cli-bundle/focused-chunks/{chunk-Z7GIVH6B.js → chunk-HMXVTWIV.js} +2 -2
  46. package/dist/cli-bundle/focused-chunks/{chunk-UQIBGLDR.js → chunk-I4Z2SCV5.js} +2 -2
  47. package/dist/cli-bundle/focused-chunks/chunk-JLN5CFYM.js +2 -0
  48. package/dist/cli-bundle/focused-chunks/chunk-K4FMZB4Y.js +23 -0
  49. package/dist/cli-bundle/focused-chunks/{chunk-DFUTCKUF.js → chunk-MQVBWFJF.js} +2 -2
  50. package/dist/cli-bundle/focused-chunks/{chunk-6GMYW42K.js → chunk-NJFMG3IK.js} +2 -2
  51. package/dist/cli-bundle/focused-chunks/{chunk-6OKPYCLU.js → chunk-PCCZ72C3.js} +54 -54
  52. package/dist/cli-bundle/focused-chunks/chunk-PF553UVP.js +44 -0
  53. package/dist/cli-bundle/focused-chunks/{chunk-VFQAZLKO.js → chunk-Q23K6WLV.js} +2 -2
  54. package/dist/cli-bundle/focused-chunks/{chunk-LVA76N27.js → chunk-QNXXOFLQ.js} +2 -2
  55. package/dist/cli-bundle/focused-chunks/{chunk-JLXGRDTG.js → chunk-QVFE5LIX.js} +3 -3
  56. package/dist/cli-bundle/focused-chunks/{chunk-VS2ZFPXD.js → chunk-RUCG6UWN.js} +2 -2
  57. package/dist/cli-bundle/focused-chunks/{chunk-WX2RVS2Y.js → chunk-SGWYNU7T.js} +2 -2
  58. package/dist/cli-bundle/focused-chunks/chunk-TGS5RXBY.js +26 -0
  59. package/dist/cli-bundle/focused-chunks/{chunk-AL7SOFUL.js → chunk-WD43E7RU.js} +2 -2
  60. package/dist/cli-bundle/focused-chunks/{chunk-GE755ODZ.js → chunk-YM4AMP7H.js} +2 -2
  61. package/dist/cli-bundle/focused-chunks/{indexed-receipt-blobs-KHWT44EK.js → indexed-receipt-blobs-FT3KF6VJ.js} +2 -2
  62. package/dist/cli-bundle/focused-chunks/{item-transaction-7VLPA2SU.js → item-transaction-F4SN7TXJ.js} +2 -2
  63. package/dist/cli-bundle/focused-chunks/{mutation-admission-2DH27R5Y.js → mutation-admission-7R2FXJ5O.js} +2 -2
  64. package/dist/cli-bundle/focused-chunks/{settlement-hook-SJV52ZTV.js → settlement-hook-KMIBD4F2.js} +2 -2
  65. package/dist/cli-bundle/focused-chunks/{stage-FYOBWQA7.js → stage-6B3O2GZ6.js} +2 -2
  66. package/dist/cli-bundle/main.js +24 -24
  67. package/dist/cli-bundle/sdk-authoring.js +1 -1
  68. package/dist/cli-bundle/sdk-contracts.js +1 -1
  69. package/dist/cli-bundle/sdk-core.js +1 -1
  70. package/dist/cli-bundle/sdk-governance.js +1 -1
  71. package/dist/cli-bundle/sdk-graph.js +1 -1
  72. package/dist/cli-bundle/sdk-merge.js +57 -57
  73. package/dist/cli-bundle/sdk-query.js +1 -1
  74. package/dist/cli-bundle/sdk-runtime.js +1 -1
  75. package/dist/cli-bundle/sdk-testing.js +1 -1
  76. package/dist/cli-bundle/sdk.js +9 -9
  77. package/dist/core/extensions/extension-types.d.ts +5 -0
  78. package/dist/core/extensions/extension-types.js +1 -1
  79. package/dist/core/item/parse.js +2 -2
  80. package/dist/core/lock/lock-confinement.d.ts +55 -0
  81. package/dist/core/lock/lock-confinement.js +2 -0
  82. package/dist/core/lock/lock-gc.js +1 -1
  83. package/dist/core/lock/lock.js +2 -2
  84. package/dist/core/shared/errors.d.ts +6 -0
  85. package/dist/core/shared/errors.js +1 -1
  86. package/dist/core/store/settings-sections.d.ts +61 -0
  87. package/dist/core/store/settings-sections.js +3 -0
  88. package/dist/core/store/settings-validator.d.ts +4 -0
  89. package/dist/core/store/settings-validator.js +1 -1
  90. package/dist/core/store/settings.d.ts +29 -2
  91. package/dist/core/store/settings.js +4 -3
  92. package/dist/core/telemetry/consent.js +2 -2
  93. package/dist/core/telemetry/runtime.js +2 -2
  94. package/dist/core/test/background-runs.js +3 -3
  95. package/dist/sdk/config.js +1 -1
  96. package/dist/sdk/extension-command-context.js +2 -2
  97. package/dist/sdk/generated/error-code-catalog-rows.d.ts +39 -0
  98. package/dist/sdk/generated/error-code-catalog-rows.js +2 -0
  99. package/dist/sdk/generated/generated-error-code-catalog-part-1.d.ts +3 -3
  100. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  101. package/dist/sdk/generated/generated-error-code-catalog-part-2.d.ts +3 -3
  102. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
  103. package/dist/sdk/generated-error-code-catalog.js +1 -1
  104. package/dist/sdk/mcp/discovery.js +1 -1
  105. package/dist/sdk/public-surface.json +1 -1
  106. package/dist/sdk/runtime-primitives.d.ts +2 -1
  107. package/dist/sdk/runtime-primitives.js +1 -1
  108. package/docs/AGENT_EVIDENCE_CONSISTENCY.md +10 -0
  109. package/docs/CONFIGURATION.md +9 -0
  110. package/docs/DEVELOPMENT_DEPENDENCY_SECURITY.md +9 -6
  111. package/docs/RELEASING.md +22 -2
  112. package/docs/SDK.md +28 -1
  113. package/docs/SDK_CONFIGURATION_SAFETY.md +55 -0
  114. package/docs/TESTING.md +2 -1
  115. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +12 -3
  116. package/marketplace.json +1 -1
  117. package/package.json +9 -3
  118. package/packages/pm-beads/package.json +1 -1
  119. package/packages/pm-calendar/package.json +1 -1
  120. package/packages/pm-command-kit/package.json +1 -1
  121. package/packages/pm-digital-twin/package.json +1 -1
  122. package/packages/pm-governance-audit/package.json +1 -1
  123. package/packages/pm-guide-shell/package.json +1 -1
  124. package/packages/pm-kanban/package.json +1 -1
  125. package/packages/pm-lifecycle-hooks/package.json +1 -1
  126. package/packages/pm-linked-test-adapters/package.json +1 -1
  127. package/packages/pm-search-advanced/package.json +1 -1
  128. package/packages/pm-templates/package.json +1 -1
  129. package/packages/pm-todos/package.json +1 -1
  130. package/packages/pm-vcs/package.json +1 -1
  131. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  132. package/plugins/pm-claude/package.json +1 -1
  133. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  134. package/plugins/pm-codex/package.json +1 -1
  135. package/plugins/pm-codex/plugin.json +1 -1
  136. package/runtime-dependencies.json +1 -1
  137. package/dist/cli-bundle/chunks/chunk-5WVE7XBS.js +0 -114
  138. package/dist/cli-bundle/chunks/chunk-E74BORFX.js +0 -128
  139. package/dist/cli-bundle/chunks/chunk-MP2DQJH2.js +0 -3
  140. package/dist/cli-bundle/chunks/chunk-O6TFUV6M.js +0 -31
  141. package/dist/cli-bundle/chunks/item-transaction-Q5S5YLEJ.js +0 -2
  142. package/dist/cli-bundle/focused-chunks/chunk-3Z53POXU.js +0 -2
  143. package/dist/cli-bundle/focused-chunks/chunk-7WJDRZOR.js +0 -22
  144. package/dist/cli-bundle/focused-chunks/chunk-CIQ6YWCW.js +0 -26
  145. package/dist/cli-bundle/focused-chunks/chunk-M22TI7LP.js +0 -79
  146. package/dist/cli-bundle/focused-chunks/chunk-SXZM4PSS.js +0 -44
@@ -1,2 +1,2 @@
1
- import{a as se}from"./chunk-NILQ2ZMV.js";import"./chunk-DEZPZOQ7.js";import{Ad as re,Bd as C,Ec as U,Fc as $,Gc as H,Hc as W,Hd as ie,Ic as j,Jb as N,Jc as G,Kc as B,Mc as I,Nc as z,Oc as Y,Pb as q,Pc as K,Qc as X,Rc as Q,Sb as J,Tc as Z,Uc as ee,Xa as F,ga as M,nd as te,qd as ae,rb as V,sd as ne,zd as oe}from"./chunk-O6TFUV6M.js";import"./chunk-F3ECOBKA.js";import"./chunk-Y7CKVU56.js";import"./chunk-UUN3WNMQ.js";import"./chunk-WFBYKDB2.js";import{$f as O,Ag as y,M as x,ag as P,bg as L,fg as c,ig as f,jg as i,kg as g}from"./chunk-E74BORFX.js";import"./chunk-SPPHDVZE.js";import"./chunk-MRUA2Z43.js";import"./chunk-2GK2IVU5.js";import"./chunk-IB7UB5TE.js";import{Ma as v,Mh as s,Mi as _,Nh as d,hf as R,qd as A,y as T,z as E}from"./chunk-5WVE7XBS.js";import"./chunk-SBVX5CMV.js";import"./chunk-VS565KBX.js";import{A as u,C as p}from"./chunk-WX25MU4N.js";import"./chunk-XAWE4EAK.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]="c3d9f24a-7089-5d60-ab12-93d03b86da80")}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"]]),ke=new Set(["higher","lower","target"]),ve=[...le.keys()].sort((e,t)=>e.localeCompare(t)).join(", ");function xe(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(a=>typeof a=="string"):e==="direction"&&ke.has(t)}function ce(e){if(e===void 0)return{};let t;try{t=JSON.parse(e)}catch(a){throw new p(`--analytics must be valid JSON: ${String(a)}`,u.USAGE)}if(t===null||typeof t!="object"||Array.isArray(t))throw new p("--analytics must be a JSON object.",u.USAGE);for(let[a,n]of Object.entries(t)){let o=le.get(a);if(!xe(o,n))throw new p(o===void 0?`Unknown --analytics field "${a}". Accepted fields: ${ve}.`:`--analytics field "${a}" must be ${o.replace("_"," ")}.`,u.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]="dcd8c925-34ee-5faa-9132-1be43961c749")}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]="29db968f-30ad-5f3c-bf95-e33be18614c6")}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]="524ade8e-33d6-5353-b01d-c7baddc956e8")}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]="02e10fe1-c111-5c09-8dbe-a67f2b97f0d0")}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]="3d4a8db3-8a53-50b4-a96c-1affff2207a3")}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]="d008ca8f-41bf-54fb-9b56-bc1d4af9f226")}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]="de197522-9007-5e21-8f9c-06cbf63707d1")}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]="a5e0162a-bbf1-50fe-8912-a820de155e90")}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]="9ee008b9-3751-5794-8d01-1f6d3123d6cd")}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]="b6fa277d-ccf2-5413-95d5-0790283203d5")}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]="2d59e10e-c85b-542a-8859-b20a08e809fa")}catch{}})();var de=(e,t)=>N(e,t,{runUpdate:(a,n,o)=>se(a,n,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]="3952425a-adce-59dd-84b6-97ac571eaa73")}catch{}})();async function Ae(e,t,a,n,o){let r=c(o),l=e==="run",m=e==="verdicts",h=e==="presets"||e==="apply",k=e==="promote",b=await q({action:e,...l||m||h||k?{}:{kind:t},id:l||m||k?a??t:a,preset:h?a??t:void 0,definition:i(n,"definition"),trigger:i(n,"trigger"),tree:i(n,"tree"),gate:i(n,"gate"),limit:i(n,"limit"),dry_run:n.dryRun===!0,fullChangedFields:r.fullChangedFields,idOnly:r.idOnly,author:i(n,"author"),message:i(n,"message"),owner:i(n,"owner"),apply:n.apply===!0,enforcement:i(n,"enforcement")},r);s(b,r),typeof b=="object"&&b!==null&&"exit_code"in b&&b.exit_code===1&&(process.exitCode=1)}function ue(e){e.command("assurance").argument("<action>","Action; inspect `pm contracts --command assurance`").argument("[kind]","Declaration kind or run gate id").argument("[id]","Declaration/gate id").description("Manage SDK-owned assurance contracts.").option("--definition <json>","Put declaration JSON").option("--trigger <value>","Gate trigger").option("--tree <value>","Revision identity").option("--gate <id>","Verdict gate filter").option("--limit <number>","Verdict limit").option("--dry-run","Evaluate without recording").option("--author <value>","Mutation author").option("--message <value>","Mutation rationale").option("--owner <item-id>","Preset/derivation owner").option("--apply","Persist derived proposals").option("--enforcement <level>","Promote to warn or block").action(Ae)}(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]="ceafed0d-5fd4-5a90-a4f3-bf0600e64bf9")}catch{}})();function _e(e,t){let a=e?.trim().toLowerCase(),n=t?.trim().toLowerCase();if(a===void 0||a.length===0)return n;if(a==="local-analytics")return n&&n.length>0?n:"status";if(n!==void 0&&n.length>0)throw x({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 a}function Ie(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 fe(e,t){if(e.background===!0){if(e.run!==!0)throw new p("--background requires --run",u.USAGE);if(e.acknowledgeLinkedTests===!0)throw new p("--background cannot be combined with --acknowledge-linked-tests; acknowledgement is a non-executing foreground operation",u.USAGE);if(e.update!==void 0||e.updateIndex!==void 0||e.setJson!==void 0||t.addValues.length>0||t.addJsonValues.length>0||t.removeValues.length>0||t.removeIndexValues.length>0)throw new p("--background does not support --add/--add-json/--remove/--remove-index or metadata edits; update linked tests first, then run in background",u.USAGE)}}async function Ce(e,t,a,n){let o=await C({kind:"test",commandArgs:O(e,{...t,add:n.addValues,addJson:n.addJsonValues,remove:n.removeValues,removeIndex:n.removeIndexValues}),targetId:e,author:typeof t.author=="string"?t.author:void 0,noExtensions:a.noExtensions===!0},a);s(o,a)}function De(e){return{update:typeof e.update=="string"?e.update:void 0,updateIndex:typeof e.updateIndex=="string"||typeof e.updateIndex=="number"?e.updateIndex:void 0,setJson:typeof e.setJson=="string"?e.setJson:void 0}}function D(e,t){return{add:t.addValues,addJson:t.addJsonValues,remove:t.removeValues,removeIndex:t.removeIndexValues,...De(e),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,workspaceContext:typeof e.workspaceContext=="string"?e.workspaceContext:void 0,overrideLinkedWorkspaceContext:!!e.overrideLinkedWorkspaceContext,allowUntrustedLinkedTests:!!e.allowUntrustedLinkedTests,acknowledgeLinkedTests:!!e.acknowledgeLinkedTests,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}}var qt={buildRunTestOptions:D,buildRunTestAllOptions:pe,runWorkspacePositionAction:ye,validateBackgroundTestOptions:fe};async function Se(e,t,a,n){let o=await oe(e,D(t,n),a);(t.update!==void 0||t.updateIndex!==void 0||t.setJson!==void 0||n.addValues.length>0||n.addJsonValues.length>0||n.removeValues.length>0||t.run===!0||n.removeIndexValues.length>0)&&await y(a,o),s(o,a),(o.run_results.some(r=>r.status==="failed"||r.status==="refused")||o.fail_on_skipped_triggered===!0)&&(process.exitCode=u.DEPENDENCY_FAILED)}async function Te(e,t,a){let n=c(a),o=Date.now(),r=Ie(t);t.background===!0&&ne(e,D(t,r),n,v(process.cwd(),n.path),!0),fe(t,r),t.background===!0?await Ce(e,t,n,r):await Se(e,t,n,r),n.profile&&d(`profile:command=test took_ms=${Date.now()-o}`)}function w(e){let t=i(e,"author"),a=i(e,"assignee");if(t!==void 0&&a!==void 0&&t!==a)throw new p("Lifecycle ownership received conflicting --author and --assignee values; use one actor value for both aliases.",u.USAGE,{code:"conflicting_lifecycle_owner",examples:["pm claim pm-123","pm claim pm-123 --start","pm release pm-123"]});return{author:t??a,message:i(e,"message")}}async function Ee(e,t){let a=c(t),n=Date.now();if(e.background===!0){let r=await C({kind:"test-all",commandArgs:P(e),statusFilter:i(e,"status"),noExtensions:a.noExtensions===!0},a);s(r,a),a.profile&&d(`profile:command=test-all took_ms=${Date.now()-n}`);return}let o=await re(pe(e),a);await y(a,{ids:o.results.map(r=>r.id)}),s(o,a),(o.failed>0||o.fail_on_skipped_triggered===!0)&&(process.exitCode=u.DEPENDENCY_FAILED),a.profile&&d(`profile:command=test-all took_ms=${Date.now()-n}`)}function pe(e){return{status:i(e,"status"),limit:i(e,"limit"),offset:i(e,"offset"),timeout:i(e,"timeout"),progress:!!e.progress,envSet:Array.isArray(e.envSet)?e.envSet:[],envClear:Array.isArray(e.envClear)?e.envClear:[],sharedHostSafe:!!e.sharedHostSafe,pmContext:i(e,"pmContext"),overrideLinkedPmContext:!!e.overrideLinkedPmContext,workspaceContext:i(e,"workspaceContext"),overrideLinkedWorkspaceContext:!!e.overrideLinkedWorkspaceContext,allowUntrustedLinkedTests:!!e.allowUntrustedLinkedTests,failOnContextMismatch:!!e.failOnContextMismatch,failOnSkipped:!!e.failOnSkipped,failOnEmptyTestRun:!!e.failOnEmptyTestRun,requireAssertionsForPm:!!e.requireAssertionsForPm,checkContext:!!e.checkContext,autoPmContext:!!e.autoPmContext}}async function Re(e,t,a,n){let o=c(n),r=Date.now(),l=await ae({subcommand:_e(e,t),limit:i(a,"limit")},o);s(l,o),o.profile&&d(`profile:command=telemetry took_ms=${Date.now()-r}`)}async function Oe(e,t){let a=c(t),n=Date.now(),o=ce(i(e,"analytics")),r=await te(a,{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:i(e,"tagPrefix"),fieldUtilization:e.fieldUtilization===!0,...o});r.recorded_observations?.some(l=>l.changed)===!0&&await y(a,{ids:r.recorded_observations?.flatMap(l=>l.observation.item_id?[l.observation.item_id]:[])}),s(r,a),a.profile&&d(`profile:command=stats took_ms=${Date.now()-n}`)}async function Pe(e,t){let a=c(t),n=Date.now(),o=i(e,"threshold"),r=i(e,"limit"),l=await F(a,{...e.exhaustive===!0?{exhaustive:!0}:{},status:Array.isArray(e.status)&&e.status.length>0?e.status:void 0,since:i(e,"since"),...o===void 0?{}:{threshold:Number(o)},...r===void 0?{}:{limit:Number(r)}});s(l,a),a.profile&&d(`profile:command=duplicates took_ms=${Date.now()-n}`)}async function Le(e,t){let a=c(t),n=Date.now(),o=!!e.strictExit||!!e.failOnWarn,r=await V(a,{strictExit:o,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||o,skipVectors:!!e.skipVectors,skipIntegrity:!!e.skipIntegrity,skipDrift:!!e.skipDrift,full:!!e.full});s(r,a),o&&!r.ok&&(A({...r,exit_code:u.GENERIC_FAILURE,error_code:"health_findings",error_category:"validation",command_resolution:"health_findings",resolution_stage:"execute"}),process.exitCode=u.GENERIC_FAILURE),a.profile&&d(`profile:command=health took_ms=${Date.now()-n}`)}async function Me(e,t){let a=c(t),n=Date.now(),o=await de({checkMetadata:!!e.checkMetadata,metadataProfile:i(e,"metadataProfile"),checkResolution:!!e.checkResolution,checkCompleteness:!!e.checkCompleteness,checkLifecycle:!!e.checkLifecycle,checkStaleBlockers:!!e.checkStaleBlockers,dependencyCycleSeverity:i(e,"dependencyCycleSeverity"),parentCycleSeverity:i(e,"parentCycleSeverity"),checkFiles:!!e.checkFiles,checkCommandReferences:!!e.checkCommandReferences,scanMode:i(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},a);s(o,a),(e.strictExit||e.failOnWarn)&&(o.has_warnings||!o.ok)&&(A({...o,exit_code:u.GENERIC_FAILURE,error_code:"validation_findings",error_category:"validation",command_resolution:"validation_findings",resolution_stage:"execute"}),process.exitCode=u.GENERIC_FAILURE),a.profile&&d(`profile:command=validate took_ms=${Date.now()-n}`)}async function Fe(e,t){let a=c(t),n=Date.now(),o=await J(a,{dryRun:e.dryRun===!0,scope:Array.isArray(e.scope)?e.scope:[]});s(o,a),a.profile&&d(`profile:command=gc took_ms=${Date.now()-n}`)}async function Ve(e,t,a,n){let o=c(n),r=v(process.cwd(),o.path),l=e.trim().toLowerCase();if(!I.some(m=>m===l))throw x({command_path:"workspace snapshot",token:e,allowed:I,display_name:"workspace snapshot",token_kind:"action",examples:["pm workspace snapshot create before-migration","pm workspace snapshot restore before-migration"]});if(l==="list"){s(await K(r),o);return}if(l==="create"){s(await z(r,t===void 0?{}:{name:t}),o);return}if(t===void 0)throw new p(`pm workspace snapshot ${l} requires a snapshot name or fingerprint`,u.USAGE);if(l==="inspect"){s(await Y(r,t),o);return}if(l==="restore"){if(a.dryRun===!0){s(await X(r,t),o);return}let m=await _(r);s(await Q(r,t,{force:a.force===!0,author:R(i(a,"author"),m.author_default),message:i(a,"message"),lockTtlSeconds:m.locks.ttl_seconds,lockWaitMs:m.locks.wait_ms}),o);return}s(await Z(r,t),o)}async function ye(e,t){let a=c(t);s(await ee(a),a)}async function Ne(e,t){let a=c(t),n=Date.now(),o=await M({action:i(e,"action"),command:i(e,"command"),summary:!!e.summary,schemaOnly:!!e.schemaOnly,flagsOnly:!!e.flagsOnly,availabilityOnly:!!e.availabilityOnly,runtimeOnly:!!e.runtimeOnly||!!e.activeOnly,full:!!e.full},a);s(o,a),a.profile&&d(`profile:command=contracts took_ms=${Date.now()-n}`)}async function qe(e,t,a){let n=t.next===!0,o=t.start===!0;if(o&&e){await ge(e,t,a);return}$(e,n,o);let r=c(a),l=Date.now(),m={...w(t),ifAvailable:t.ifAvailable===!0,maxAttempts:t.maxAttempts,...o?{start:!0}:{}},h=n?await H(!!t.force,r,m,Je(t)):await U(e,!!t.force,r,m);await y(r,h),s(h,r),r.profile&&d(`profile:command=claim took_ms=${Date.now()-l}`)}function Je(e){return{type:i(e,"type"),tag:i(e,"tag"),priority:e.priority,assigneeFilter:i(e,"assigneeFilter"),parent:i(e,"parent"),sprint:i(e,"sprint"),release:i(e,"release"),includeDecisions:e.includeDecisions===!0,includeGates:e.includeGates===!0,includeContainers:e.includeContainers===!0,tokenBudget:e.tokenBudget??e.token_budget,explainRanking:e.explainRanking===!0||e.explain_ranking===!0}}async function Ue(e,t,a){if(t.pause===!0){await he(e,t,a);return}let n=c(a),o=Date.now(),r=await W(e,!!t.force,n,{...w(t),ownershipReleaseBypass:t.ownershipReleaseBypass===!0,handoff:t.handoff});await y(n,r),s(await L("release",[e],t,n,r),n),n.profile&&d(`profile:command=release took_ms=${Date.now()-o}`)}async function S(e){let t=c(e),a=T(e.name());!a||t.json||t.quiet||(await _(v(process.cwd(),t.path))).ux?.deprecation_hints&&d(E(a))}async function ge(e,t,a){await S(a);let n=c(a),o=Date.now(),r=await j(e,{...w(t),force:!!t.force,next:t.next===!0,ifAvailable:t.ifAvailable===!0},n);await y(n,r.update),s(r,n),n.profile&&d(`profile:command=start-task took_ms=${Date.now()-o}`)}async function he(e,t,a){await S(a);let n=c(a),o=Date.now(),r=await G(e,{...w(t),handoff:i(t,"handoff"),force:!!t.force},n);await y(n,r.release),s(r,n),n.profile&&d(`profile:command=pause-task took_ms=${Date.now()-o}`)}async function $e(e,t,a,n){await S(n);let o=c(n),r=Date.now(),l=await B(e,t,{...w(a),validateClose:i(a,"validateClose"),force:!!a.force},o);await y(o,l.release),s(l,o),o.profile&&d(`profile:command=close-task took_ms=${Date.now()-r}`)}function me(e){return e.option("--background","Run linked tests in managed background mode").option("--timeout <seconds>","Default run timeout in seconds (requires --run)").option("--progress","Emit stderr run progress (requires --run; automatic in TTY)").option("--env-set <value>","Set run environment (KEY=VALUE, repeatable)",f).option("--env-clear <value>","Clear run environment (NAME, repeatable)",f).option("--shared-host-safe","Apply additive shared-host-safe run defaults").option("--pm-context <mode>","PM test context: schema|tracker|auto|none (default: schema)").option("--override-linked-pm-context","Override stored context with --pm-context").option("--workspace-context <mode>","Source-workspace mode: source|isolated|snapshot (default: source)").option("--override-linked-workspace-context","Override stored context with --workspace-context").option("--allow-untrusted-linked-tests","Execute untrusted linked commands when project policy also permits it").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","Fail successful commands reporting zero executed tests").option("--require-assertions-for-pm","Require assertion metadata for linked PM command tests").option("--check-context","Check PM context before execution").option("--auto-pm-context","Route mismatched PM tracker reads through tracker context")}function Jt(e){ue(e);let t=e.command("test").argument("<id>","Item id").option("--add <value>","Add verified isolated test (CSV/markdown or stdin)",f).option("--add-json <value>","Add verified isolated test (JSON object/array or stdin)",f).option("--remove <value>","Remove exact command/path (command=<value>, path=<value>, or stdin -)",f).option("--remove-index <n>","Remove 1-based --list position (repeatable)",f).option("--list","List linked tests without mutating").option("--update <value>","Edit exact command or path=<value>").option("--update-index <n>","Edit current 1-based --list position").option("--set-json <value>","Metadata patch; null clears optional fields").option("--run","Run linked test commands").option("--match <value>","Run matching command/path substring").option("--only-index <n>","Run 1-based --list position").option("--only-last","Run most recently added test");t.option("--acknowledge-linked-tests","Trust current commands in this clone without execution"),me(t).option("--measure <value>","Record name=value[,unit=...][,threshold=...]; requires --run",f).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(Te);let a=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(a).action(Ee),e.command("test-runs-worker",{hidden:!0}).argument("<runId>","Background run id").description("Internal background worker command.").action(async(k,b,be)=>{let we=c(be);await ie(k,we)}),e.command("telemetry").argument("[namespace-or-subcommand]","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(Re),e.command("duplicates").description("Find duplicate clusters across all statuses.").option("--status <value>","Statuses (repeatable or comma-separated)",f,[]).option("--since <value>","Created at or after this time").option("--threshold <value>","Minimum similarity (0-1)").option("--limit <n>","Maximum clusters").option("--exhaustive","Score all pairs within the safety bound").action(Pe),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(Oe),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 and default to actionable summary output; use --full for complete details").option("--fail-on-warn","Alias for --strict-exit").action(Le),e.command("validate").description("Validate metadata, lifecycle policies, files, command references, and history.").option("--check-metadata","Run metadata completeness checks").option("--metadata-profile <value>","Metadata profile (core|strict|custom)").option("--check-resolution","Run closed-item resolution metadata checks").option("--check-completeness","Check declarative lifecycle field requirements").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 diagnostic ID lists").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 safe, deterministic field backfills").option("--dry-run","Preview planned --auto-fix/--prune-missing fixes without applying them").option("--fix-scope <scope>","Grant --auto-fix scopes (metadata, resolution, estimates, timestamps, lifecycle; comma-separated or repeatable). Default: metadata, resolution; other scopes require explicit opt-in",f).option("--prune-missing","Remove deleted-path file/doc links; preserves 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(Me),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",f).description("Delete optional cache artifacts by default (including expired lock debris) and show a summary.").action(Fe);let n=e.command("workspace").description("Inspect workspace state and snapshots.");n.command("position").description("Show merge and history readiness.").action(ye),n.command("snapshot").argument("<action>","Action: create, list, inspect, restore, delete").argument("[target]","Optional name for create; name or fingerprint otherwise").description("Manage 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(Ve),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(Ne);let o=e.command("claim").option("--start","Claim and start (id or --next)").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 another author's claim (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("--include-gates","Allow --next to claim outcome gates").option("--include-containers","Allow --next to claim containers with unfinished descendants").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(qe);g(o,"--assignee <value>","Alias for --author on lifecycle ownership commands"),g(o,"--token_budget <n>","Alias for --token-budget"),g(o,"--explain_ranking","Alias for --explain-ranking");let r=e.command("release").option("--pause","Use open status").option("--handoff <status>","Needs --message").argument("<id>","Item id").option("--author <value>","Author").option("--message <value>","Message").option("--force","Override ownership").description("Release ownership.").action(Ue);g(r,"--assignee <value>","Alias for --author on lifecycle ownership commands");let l=e.command("start-task",{hidden:!0}).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(ge);g(l,"--assignee <value>","Alias for --author on lifecycle ownership commands");let m=e.command("pause-task",{hidden:!0}).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(he);g(m,"--assignee <value>","Alias for --author on lifecycle ownership commands");let h=e.command("close-task",{hidden:!0}).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($e);g(h,"--assignee <value>","Alias for --author on lifecycle ownership commands")}export{qt as _testOnlyRegisterOperations,Jt as registerOperationCommands,$ as requireClaimTarget};
2
- //# sourceMappingURL=register-operations-IGR7ERY5.js.map
1
+ import{a as se}from"./chunk-ABFFRQRO.js";import"./chunk-DEZPZOQ7.js";import{Ad as re,Bd as C,Ec as U,Fc as $,Gc as H,Hc as W,Hd as ie,Ic as j,Jb as N,Jc as G,Kc as B,Mc as I,Nc as z,Oc as Y,Pb as q,Pc as K,Qc as X,Rc as Q,Sb as J,Tc as Z,Uc as ee,Xa as F,ga as M,nd as te,qd as ae,rb as V,sd as ne,zd as oe}from"./chunk-OJR2YGXF.js";import"./chunk-4OELCF3O.js";import"./chunk-RGHLQGEX.js";import"./chunk-3ZQQVJT2.js";import"./chunk-DAZFCSDV.js";import{Dg as y,M as x,cg as O,dg as P,eg as L,ig as c,lg as f,mg as i,ng as g}from"./chunk-ZNWDYDFF.js";import"./chunk-SPPHDVZE.js";import"./chunk-GK2CHAT3.js";import"./chunk-533L6D2N.js";import"./chunk-IB7UB5TE.js";import{Ma as v,Nh as s,Oh as d,Pi as _,if as R,qd as A,y as T,z as E}from"./chunk-BFZUJ5QP.js";import"./chunk-D52QQ7LP.js";import"./chunk-VS565KBX.js";import{A as u,C as p}from"./chunk-J3JM36EH.js";import"./chunk-XAWE4EAK.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]="c3d9f24a-7089-5d60-ab12-93d03b86da80")}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"]]),ke=new Set(["higher","lower","target"]),ve=[...le.keys()].sort((e,t)=>e.localeCompare(t)).join(", ");function xe(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(a=>typeof a=="string"):e==="direction"&&ke.has(t)}function ce(e){if(e===void 0)return{};let t;try{t=JSON.parse(e)}catch(a){throw new p(`--analytics must be valid JSON: ${String(a)}`,u.USAGE)}if(t===null||typeof t!="object"||Array.isArray(t))throw new p("--analytics must be a JSON object.",u.USAGE);for(let[a,n]of Object.entries(t)){let o=le.get(a);if(!xe(o,n))throw new p(o===void 0?`Unknown --analytics field "${a}". Accepted fields: ${ve}.`:`--analytics field "${a}" must be ${o.replace("_"," ")}.`,u.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]="dcd8c925-34ee-5faa-9132-1be43961c749")}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]="29db968f-30ad-5f3c-bf95-e33be18614c6")}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]="524ade8e-33d6-5353-b01d-c7baddc956e8")}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]="02e10fe1-c111-5c09-8dbe-a67f2b97f0d0")}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]="3d4a8db3-8a53-50b4-a96c-1affff2207a3")}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]="d008ca8f-41bf-54fb-9b56-bc1d4af9f226")}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]="de197522-9007-5e21-8f9c-06cbf63707d1")}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]="a5e0162a-bbf1-50fe-8912-a820de155e90")}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]="9ee008b9-3751-5794-8d01-1f6d3123d6cd")}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]="b6fa277d-ccf2-5413-95d5-0790283203d5")}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]="2d59e10e-c85b-542a-8859-b20a08e809fa")}catch{}})();var de=(e,t)=>N(e,t,{runUpdate:(a,n,o)=>se(a,n,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]="3952425a-adce-59dd-84b6-97ac571eaa73")}catch{}})();async function Ae(e,t,a,n,o){let r=c(o),l=e==="run",m=e==="verdicts",h=e==="presets"||e==="apply",k=e==="promote",b=await q({action:e,...l||m||h||k?{}:{kind:t},id:l||m||k?a??t:a,preset:h?a??t:void 0,definition:i(n,"definition"),trigger:i(n,"trigger"),tree:i(n,"tree"),gate:i(n,"gate"),limit:i(n,"limit"),dry_run:n.dryRun===!0,fullChangedFields:r.fullChangedFields,idOnly:r.idOnly,author:i(n,"author"),message:i(n,"message"),owner:i(n,"owner"),apply:n.apply===!0,enforcement:i(n,"enforcement")},r);s(b,r),typeof b=="object"&&b!==null&&"exit_code"in b&&b.exit_code===1&&(process.exitCode=1)}function ue(e){e.command("assurance").argument("<action>","Action; inspect `pm contracts --command assurance`").argument("[kind]","Declaration kind or run gate id").argument("[id]","Declaration/gate id").description("Manage SDK-owned assurance contracts.").option("--definition <json>","Put declaration JSON").option("--trigger <value>","Gate trigger").option("--tree <value>","Revision identity").option("--gate <id>","Verdict gate filter").option("--limit <number>","Verdict limit").option("--dry-run","Evaluate without recording").option("--author <value>","Mutation author").option("--message <value>","Mutation rationale").option("--owner <item-id>","Preset/derivation owner").option("--apply","Persist derived proposals").option("--enforcement <level>","Promote to warn or block").action(Ae)}(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]="ceafed0d-5fd4-5a90-a4f3-bf0600e64bf9")}catch{}})();function _e(e,t){let a=e?.trim().toLowerCase(),n=t?.trim().toLowerCase();if(a===void 0||a.length===0)return n;if(a==="local-analytics")return n&&n.length>0?n:"status";if(n!==void 0&&n.length>0)throw x({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 a}function Ie(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 fe(e,t){if(e.background===!0){if(e.run!==!0)throw new p("--background requires --run",u.USAGE);if(e.acknowledgeLinkedTests===!0)throw new p("--background cannot be combined with --acknowledge-linked-tests; acknowledgement is a non-executing foreground operation",u.USAGE);if(e.update!==void 0||e.updateIndex!==void 0||e.setJson!==void 0||t.addValues.length>0||t.addJsonValues.length>0||t.removeValues.length>0||t.removeIndexValues.length>0)throw new p("--background does not support --add/--add-json/--remove/--remove-index or metadata edits; update linked tests first, then run in background",u.USAGE)}}async function Ce(e,t,a,n){let o=await C({kind:"test",commandArgs:O(e,{...t,add:n.addValues,addJson:n.addJsonValues,remove:n.removeValues,removeIndex:n.removeIndexValues}),targetId:e,author:typeof t.author=="string"?t.author:void 0,noExtensions:a.noExtensions===!0},a);s(o,a)}function De(e){return{update:typeof e.update=="string"?e.update:void 0,updateIndex:typeof e.updateIndex=="string"||typeof e.updateIndex=="number"?e.updateIndex:void 0,setJson:typeof e.setJson=="string"?e.setJson:void 0}}function D(e,t){return{add:t.addValues,addJson:t.addJsonValues,remove:t.removeValues,removeIndex:t.removeIndexValues,...De(e),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,workspaceContext:typeof e.workspaceContext=="string"?e.workspaceContext:void 0,overrideLinkedWorkspaceContext:!!e.overrideLinkedWorkspaceContext,allowUntrustedLinkedTests:!!e.allowUntrustedLinkedTests,acknowledgeLinkedTests:!!e.acknowledgeLinkedTests,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}}var qt={buildRunTestOptions:D,buildRunTestAllOptions:pe,runWorkspacePositionAction:ye,validateBackgroundTestOptions:fe};async function Se(e,t,a,n){let o=await oe(e,D(t,n),a);(t.update!==void 0||t.updateIndex!==void 0||t.setJson!==void 0||n.addValues.length>0||n.addJsonValues.length>0||n.removeValues.length>0||t.run===!0||n.removeIndexValues.length>0)&&await y(a,o),s(o,a),(o.run_results.some(r=>r.status==="failed"||r.status==="refused")||o.fail_on_skipped_triggered===!0)&&(process.exitCode=u.DEPENDENCY_FAILED)}async function Te(e,t,a){let n=c(a),o=Date.now(),r=Ie(t);t.background===!0&&ne(e,D(t,r),n,v(process.cwd(),n.path),!0),fe(t,r),t.background===!0?await Ce(e,t,n,r):await Se(e,t,n,r),n.profile&&d(`profile:command=test took_ms=${Date.now()-o}`)}function w(e){let t=i(e,"author"),a=i(e,"assignee");if(t!==void 0&&a!==void 0&&t!==a)throw new p("Lifecycle ownership received conflicting --author and --assignee values; use one actor value for both aliases.",u.USAGE,{code:"conflicting_lifecycle_owner",examples:["pm claim pm-123","pm claim pm-123 --start","pm release pm-123"]});return{author:t??a,message:i(e,"message")}}async function Ee(e,t){let a=c(t),n=Date.now();if(e.background===!0){let r=await C({kind:"test-all",commandArgs:P(e),statusFilter:i(e,"status"),noExtensions:a.noExtensions===!0},a);s(r,a),a.profile&&d(`profile:command=test-all took_ms=${Date.now()-n}`);return}let o=await re(pe(e),a);await y(a,{ids:o.results.map(r=>r.id)}),s(o,a),(o.failed>0||o.fail_on_skipped_triggered===!0)&&(process.exitCode=u.DEPENDENCY_FAILED),a.profile&&d(`profile:command=test-all took_ms=${Date.now()-n}`)}function pe(e){return{status:i(e,"status"),limit:i(e,"limit"),offset:i(e,"offset"),timeout:i(e,"timeout"),progress:!!e.progress,envSet:Array.isArray(e.envSet)?e.envSet:[],envClear:Array.isArray(e.envClear)?e.envClear:[],sharedHostSafe:!!e.sharedHostSafe,pmContext:i(e,"pmContext"),overrideLinkedPmContext:!!e.overrideLinkedPmContext,workspaceContext:i(e,"workspaceContext"),overrideLinkedWorkspaceContext:!!e.overrideLinkedWorkspaceContext,allowUntrustedLinkedTests:!!e.allowUntrustedLinkedTests,failOnContextMismatch:!!e.failOnContextMismatch,failOnSkipped:!!e.failOnSkipped,failOnEmptyTestRun:!!e.failOnEmptyTestRun,requireAssertionsForPm:!!e.requireAssertionsForPm,checkContext:!!e.checkContext,autoPmContext:!!e.autoPmContext}}async function Re(e,t,a,n){let o=c(n),r=Date.now(),l=await ae({subcommand:_e(e,t),limit:i(a,"limit")},o);s(l,o),o.profile&&d(`profile:command=telemetry took_ms=${Date.now()-r}`)}async function Oe(e,t){let a=c(t),n=Date.now(),o=ce(i(e,"analytics")),r=await te(a,{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:i(e,"tagPrefix"),fieldUtilization:e.fieldUtilization===!0,...o});r.recorded_observations?.some(l=>l.changed)===!0&&await y(a,{ids:r.recorded_observations?.flatMap(l=>l.observation.item_id?[l.observation.item_id]:[])}),s(r,a),a.profile&&d(`profile:command=stats took_ms=${Date.now()-n}`)}async function Pe(e,t){let a=c(t),n=Date.now(),o=i(e,"threshold"),r=i(e,"limit"),l=await F(a,{...e.exhaustive===!0?{exhaustive:!0}:{},status:Array.isArray(e.status)&&e.status.length>0?e.status:void 0,since:i(e,"since"),...o===void 0?{}:{threshold:Number(o)},...r===void 0?{}:{limit:Number(r)}});s(l,a),a.profile&&d(`profile:command=duplicates took_ms=${Date.now()-n}`)}async function Le(e,t){let a=c(t),n=Date.now(),o=!!e.strictExit||!!e.failOnWarn,r=await V(a,{strictExit:o,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||o,skipVectors:!!e.skipVectors,skipIntegrity:!!e.skipIntegrity,skipDrift:!!e.skipDrift,full:!!e.full});s(r,a),o&&!r.ok&&(A({...r,exit_code:u.GENERIC_FAILURE,error_code:"health_findings",error_category:"validation",command_resolution:"health_findings",resolution_stage:"execute"}),process.exitCode=u.GENERIC_FAILURE),a.profile&&d(`profile:command=health took_ms=${Date.now()-n}`)}async function Me(e,t){let a=c(t),n=Date.now(),o=await de({checkMetadata:!!e.checkMetadata,metadataProfile:i(e,"metadataProfile"),checkResolution:!!e.checkResolution,checkCompleteness:!!e.checkCompleteness,checkLifecycle:!!e.checkLifecycle,checkStaleBlockers:!!e.checkStaleBlockers,dependencyCycleSeverity:i(e,"dependencyCycleSeverity"),parentCycleSeverity:i(e,"parentCycleSeverity"),checkFiles:!!e.checkFiles,checkCommandReferences:!!e.checkCommandReferences,scanMode:i(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},a);s(o,a),(e.strictExit||e.failOnWarn)&&(o.has_warnings||!o.ok)&&(A({...o,exit_code:u.GENERIC_FAILURE,error_code:"validation_findings",error_category:"validation",command_resolution:"validation_findings",resolution_stage:"execute"}),process.exitCode=u.GENERIC_FAILURE),a.profile&&d(`profile:command=validate took_ms=${Date.now()-n}`)}async function Fe(e,t){let a=c(t),n=Date.now(),o=await J(a,{dryRun:e.dryRun===!0,scope:Array.isArray(e.scope)?e.scope:[]});s(o,a),a.profile&&d(`profile:command=gc took_ms=${Date.now()-n}`)}async function Ve(e,t,a,n){let o=c(n),r=v(process.cwd(),o.path),l=e.trim().toLowerCase();if(!I.some(m=>m===l))throw x({command_path:"workspace snapshot",token:e,allowed:I,display_name:"workspace snapshot",token_kind:"action",examples:["pm workspace snapshot create before-migration","pm workspace snapshot restore before-migration"]});if(l==="list"){s(await K(r),o);return}if(l==="create"){s(await z(r,t===void 0?{}:{name:t}),o);return}if(t===void 0)throw new p(`pm workspace snapshot ${l} requires a snapshot name or fingerprint`,u.USAGE);if(l==="inspect"){s(await Y(r,t),o);return}if(l==="restore"){if(a.dryRun===!0){s(await X(r,t),o);return}let m=await _(r);s(await Q(r,t,{force:a.force===!0,author:R(i(a,"author"),m.author_default),message:i(a,"message"),lockTtlSeconds:m.locks.ttl_seconds,lockWaitMs:m.locks.wait_ms}),o);return}s(await Z(r,t),o)}async function ye(e,t){let a=c(t);s(await ee(a),a)}async function Ne(e,t){let a=c(t),n=Date.now(),o=await M({action:i(e,"action"),command:i(e,"command"),summary:!!e.summary,schemaOnly:!!e.schemaOnly,flagsOnly:!!e.flagsOnly,availabilityOnly:!!e.availabilityOnly,runtimeOnly:!!e.runtimeOnly||!!e.activeOnly,full:!!e.full},a);s(o,a),a.profile&&d(`profile:command=contracts took_ms=${Date.now()-n}`)}async function qe(e,t,a){let n=t.next===!0,o=t.start===!0;if(o&&e){await ge(e,t,a);return}$(e,n,o);let r=c(a),l=Date.now(),m={...w(t),ifAvailable:t.ifAvailable===!0,maxAttempts:t.maxAttempts,...o?{start:!0}:{}},h=n?await H(!!t.force,r,m,Je(t)):await U(e,!!t.force,r,m);await y(r,h),s(h,r),r.profile&&d(`profile:command=claim took_ms=${Date.now()-l}`)}function Je(e){return{type:i(e,"type"),tag:i(e,"tag"),priority:e.priority,assigneeFilter:i(e,"assigneeFilter"),parent:i(e,"parent"),sprint:i(e,"sprint"),release:i(e,"release"),includeDecisions:e.includeDecisions===!0,includeGates:e.includeGates===!0,includeContainers:e.includeContainers===!0,tokenBudget:e.tokenBudget??e.token_budget,explainRanking:e.explainRanking===!0||e.explain_ranking===!0}}async function Ue(e,t,a){if(t.pause===!0){await he(e,t,a);return}let n=c(a),o=Date.now(),r=await W(e,!!t.force,n,{...w(t),ownershipReleaseBypass:t.ownershipReleaseBypass===!0,handoff:t.handoff});await y(n,r),s(await L("release",[e],t,n,r),n),n.profile&&d(`profile:command=release took_ms=${Date.now()-o}`)}async function S(e){let t=c(e),a=T(e.name());!a||t.json||t.quiet||(await _(v(process.cwd(),t.path))).ux?.deprecation_hints&&d(E(a))}async function ge(e,t,a){await S(a);let n=c(a),o=Date.now(),r=await j(e,{...w(t),force:!!t.force,next:t.next===!0,ifAvailable:t.ifAvailable===!0},n);await y(n,r.update),s(r,n),n.profile&&d(`profile:command=start-task took_ms=${Date.now()-o}`)}async function he(e,t,a){await S(a);let n=c(a),o=Date.now(),r=await G(e,{...w(t),handoff:i(t,"handoff"),force:!!t.force},n);await y(n,r.release),s(r,n),n.profile&&d(`profile:command=pause-task took_ms=${Date.now()-o}`)}async function $e(e,t,a,n){await S(n);let o=c(n),r=Date.now(),l=await B(e,t,{...w(a),validateClose:i(a,"validateClose"),force:!!a.force},o);await y(o,l.release),s(l,o),o.profile&&d(`profile:command=close-task took_ms=${Date.now()-r}`)}function me(e){return e.option("--background","Run linked tests in managed background mode").option("--timeout <seconds>","Default run timeout in seconds (requires --run)").option("--progress","Emit stderr run progress (requires --run; automatic in TTY)").option("--env-set <value>","Set run environment (KEY=VALUE, repeatable)",f).option("--env-clear <value>","Clear run environment (NAME, repeatable)",f).option("--shared-host-safe","Apply additive shared-host-safe run defaults").option("--pm-context <mode>","PM test context: schema|tracker|auto|none (default: schema)").option("--override-linked-pm-context","Override stored context with --pm-context").option("--workspace-context <mode>","Source-workspace mode: source|isolated|snapshot (default: source)").option("--override-linked-workspace-context","Override stored context with --workspace-context").option("--allow-untrusted-linked-tests","Execute untrusted linked commands when project policy also permits it").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","Fail successful commands reporting zero executed tests").option("--require-assertions-for-pm","Require assertion metadata for linked PM command tests").option("--check-context","Check PM context before execution").option("--auto-pm-context","Route mismatched PM tracker reads through tracker context")}function Jt(e){ue(e);let t=e.command("test").argument("<id>","Item id").option("--add <value>","Add verified isolated test (CSV/markdown or stdin)",f).option("--add-json <value>","Add verified isolated test (JSON object/array or stdin)",f).option("--remove <value>","Remove exact command/path (command=<value>, path=<value>, or stdin -)",f).option("--remove-index <n>","Remove 1-based --list position (repeatable)",f).option("--list","List linked tests without mutating").option("--update <value>","Edit exact command or path=<value>").option("--update-index <n>","Edit current 1-based --list position").option("--set-json <value>","Metadata patch; null clears optional fields").option("--run","Run linked test commands").option("--match <value>","Run matching command/path substring").option("--only-index <n>","Run 1-based --list position").option("--only-last","Run most recently added test");t.option("--acknowledge-linked-tests","Trust current commands in this clone without execution"),me(t).option("--measure <value>","Record name=value[,unit=...][,threshold=...]; requires --run",f).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(Te);let a=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(a).action(Ee),e.command("test-runs-worker",{hidden:!0}).argument("<runId>","Background run id").description("Internal background worker command.").action(async(k,b,be)=>{let we=c(be);await ie(k,we)}),e.command("telemetry").argument("[namespace-or-subcommand]","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(Re),e.command("duplicates").description("Find duplicate clusters across all statuses.").option("--status <value>","Statuses (repeatable or comma-separated)",f,[]).option("--since <value>","Created at or after this time").option("--threshold <value>","Minimum similarity (0-1)").option("--limit <n>","Maximum clusters").option("--exhaustive","Score all pairs within the safety bound").action(Pe),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(Oe),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 and default to actionable summary output; use --full for complete details").option("--fail-on-warn","Alias for --strict-exit").action(Le),e.command("validate").description("Validate metadata, lifecycle policies, files, command references, and history.").option("--check-metadata","Run metadata completeness checks").option("--metadata-profile <value>","Metadata profile (core|strict|custom)").option("--check-resolution","Run closed-item resolution metadata checks").option("--check-completeness","Check declarative lifecycle field requirements").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 diagnostic ID lists").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 safe, deterministic field backfills").option("--dry-run","Preview planned --auto-fix/--prune-missing fixes without applying them").option("--fix-scope <scope>","Grant --auto-fix scopes (metadata, resolution, estimates, timestamps, lifecycle; comma-separated or repeatable). Default: metadata, resolution; other scopes require explicit opt-in",f).option("--prune-missing","Remove deleted-path file/doc links; preserves 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(Me),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",f).description("Delete optional cache artifacts by default (including expired lock debris) and show a summary.").action(Fe);let n=e.command("workspace").description("Inspect workspace state and snapshots.");n.command("position").description("Show merge and history readiness.").action(ye),n.command("snapshot").argument("<action>","Action: create, list, inspect, restore, delete").argument("[target]","Optional name for create; name or fingerprint otherwise").description("Manage 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(Ve),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(Ne);let o=e.command("claim").option("--start","Claim and start (id or --next)").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 another author's claim (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("--include-gates","Allow --next to claim outcome gates").option("--include-containers","Allow --next to claim containers with unfinished descendants").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(qe);g(o,"--assignee <value>","Alias for --author on lifecycle ownership commands"),g(o,"--token_budget <n>","Alias for --token-budget"),g(o,"--explain_ranking","Alias for --explain-ranking");let r=e.command("release").option("--pause","Use open status").option("--handoff <status>","Needs --message").argument("<id>","Item id").option("--author <value>","Author").option("--message <value>","Message").option("--force","Override ownership").description("Release ownership.").action(Ue);g(r,"--assignee <value>","Alias for --author on lifecycle ownership commands");let l=e.command("start-task",{hidden:!0}).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(ge);g(l,"--assignee <value>","Alias for --author on lifecycle ownership commands");let m=e.command("pause-task",{hidden:!0}).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(he);g(m,"--assignee <value>","Alias for --author on lifecycle ownership commands");let h=e.command("close-task",{hidden:!0}).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($e);g(h,"--assignee <value>","Alias for --author on lifecycle ownership commands")}export{qt as _testOnlyRegisterOperations,Jt as registerOperationCommands,$ as requireClaimTarget};
2
+ //# sourceMappingURL=register-operations-RFMM5KZ6.js.map
@@ -1,2 +1,2 @@
1
- import"./chunk-DEZPZOQ7.js";import{a as P}from"./chunk-UEEG47TU.js";import{g as j,i as T}from"./chunk-MP2DQJH2.js";import{Da as I,Ia as O,Ka as L,qa as R,ta as U}from"./chunk-Y7CKVU56.js";import"./chunk-WFBYKDB2.js";import{fg as b,ig as v}from"./chunk-E74BORFX.js";import"./chunk-2GK2IVU5.js";import"./chunk-IB7UB5TE.js";import{Jh as D,Ma as E,Mh as w,Mi as S,Nh as y,y as $,z as G}from"./chunk-5WVE7XBS.js";import"./chunk-SBVX5CMV.js";import"./chunk-VS565KBX.js";import{A as d,C as h}from"./chunk-WX25MU4N.js";import"./chunk-XAWE4EAK.js";import C from"node:fs/promises";import W from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="26ea7f42-d5f7-5ada-afd9-389dadc4d138")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0b0e08e0-f6e7-59c4-ac96-9f47b172727a")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d975120a-964e-5b19-ae10-8ba011ba9bf8")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="108609fa-51fc-5bd0-ac54-de2ad14a66c6")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b36466e6-5574-5509-909a-e8599f11664c")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e5e1e242-6864-5a72-adb9-0eda4c65a0c3")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d41d82cb-8b54-5b72-936e-217cde14c4b5")}catch{}})();var M={extension:"extension",package:void 0};async function _(e,t){if(!e)return;let o=$(e),i=b(t);await S(E(process.cwd(),i.path)).then(a=>a.ux.deprecation_hints)&&y(G(o))}var V={init:"init",install:"install",uninstall:"uninstall",explore:"explore",manage:"manage",describe:"describe",reload:"reload",doctor:"doctor",catalog:"catalog",adopt:"adopt","adopt-all":"adoptAll",activate:"activate",deactivate:"deactivate",migrate:"migrate"};function X(e){let t=e.capability,o=typeof t=="string"?[t]:Array.isArray(t)?t.filter(a=>typeof a=="string"):[],i=[...new Set(o.map(a=>a.trim().toLowerCase()).filter(a=>a.length>0))];if(i.length>1)throw new h(`Multiple scaffold capabilities cannot be combined yet: ${i.join(", ")}. Choose one capability per scaffold.`,d.USAGE);return i[0]}function A(e,t,o="extension"){let i={...e};t!==void 0&&(i[V[t]]=!0);let a=(...c)=>c.some(s=>i[s]===!0),r=(...c)=>{for(let s of c)if(typeof i[s]=="string")return i[s]};return{init:a("init"),scaffold:a("scaffold"),install:a("install"),uninstall:a("uninstall"),explore:a("explore","list"),manage:a("manage"),describe:a("describe"),markdown:a("markdown"),reload:a("reload"),doctor:a("doctor"),catalog:a("catalog"),adopt:a("adopt"),adoptAll:a("adoptAll","adopt_all","adopt-all"),activate:a("activate"),deactivate:a("deactivate"),migrate:a("migrate"),project:a("project"),local:a("local"),global:a("global"),gh:r("gh"),github:r("github"),ref:r("ref"),capability:X(e),declarative:a("declarative"),fields:r("fields"),detail:r("detail"),output:r("output"),trace:a("trace"),watch:a("watch"),runtimeProbe:a("runtimeProbe","runtime_probe","runtime-probe"),offline:a("offline"),fixManagedState:a("fixManagedState","fix_managed_state","fix-managed-state"),isolated:a("isolated"),ignoreGlobal:a("ignoreGlobal","ignore_global","ignore-global"),strictExit:a("strictExit","strict_exit","strict-exit"),failOnWarn:a("failOnWarn","fail_on_warn","fail-on-warn"),dryRun:a("dryRun","dry_run","dry-run"),vocabulary:o}}async function Y(e){let t=(await C.readdir(process.cwd())).filter(i=>!i.startsWith(".")).sort((i,a)=>i.localeCompare(a)),o=[...e].sort((i,a)=>i.localeCompare(a));return t.length===o.length&&t.every((i,a)=>i===o[a])}async function J(e){let t=(e??[]).map(o=>o.trim()).filter(o=>o.length>0);return t.length<=1?t.length===0?void 0:t:await Y(t)?["*"]:t}function H(e,t,o){let i=e.markdown===!0;if(o!==void 0&&o==="")throw new h("--output requires a non-empty file path.",d.USAGE);if(o!==void 0&&!i)throw new h("--output is only supported with --markdown describe output.",d.USAGE);if(i){if(t.json)throw new h("Cannot combine --json with --markdown.",d.USAGE);if(e.describe!==!0)throw new h("--markdown is only supported by the describe action.",d.USAGE)}}async function Q(e){let t=U(e.result.details,e.vocabulary);if(e.outputPath!==void 0){let o=W.resolve(e.outputPath);await C.mkdir(W.dirname(o),{recursive:!0}),await C.writeFile(o,t,"utf8")}if(!e.globalOptions.quiet){for(let o of e.result.warnings)y(`warning: ${o}`);e.outputPath===void 0&&D(t)}}function Z(e,t){let o=!!t.strictExit||!!t.failOnWarn;if(e.action!=="doctor"||!o)return;let i=e.details!==null&&typeof e.details=="object"?e.details:{},a=i.summary!==null&&typeof i.summary=="object"?i.summary:null,r=a&&typeof a.status=="string"?a.status:void 0;(e.warnings.length>0||r!==void 0&&r!=="ok")&&(process.exitCode=d.GENERIC_FAILURE)}async function g(e,t,o,i,a="extension"){let r=b(o),c=Date.now(),s=a==="extension"?"package":a;await _(M[a],o);let n=A(t,i,s),l=(typeof n.output=="string"?n.output:void 0)?.trim();H(n,r,l);let f=await I(e,n,r);n.markdown===!0?await Q({result:f,vocabulary:s,outputPath:l,globalOptions:r}):w(f,r),Z(f,n),f.ok===!1&&(process.exitCode=d.GENERIC_FAILURE),r.profile&&y(`profile:command=extension took_ms=${Date.now()-c}`)}function ee(e){return e.details!==null&&typeof e.details=="object"?e.details:{}}function te(e){return e instanceof h?{message:e.message,exit_code:e.exitCode,...e.context}:{message:e instanceof Error?e.message:String(e),exit_code:d.GENERIC_FAILURE}}async function oe(e,t,o){let i=[],a=[],r=d.GENERIC_FAILURE;for(let c of e)try{let s=await I(c,t,o),n=ee(s),l=Array.isArray(s.warnings)?s.warnings:[];a.push(...l);let f=s.ok===!0;i.push({target:c,ok:f,extension:n.extension,source:n.source,install_plan:n.install_plan,dry_run:n.dry_run,destination_path:n.destination_path,activated:n.activated,settings_changed:n.settings_changed,previous_state_preserved:n.previous_state_preserved,rollback:n.rollback,command_paths:n.command_paths,action_paths:n.action_paths,runtime_activation_status:n.runtime_activation_status,activation_diagnostics:n.activation_diagnostics,command_discovery:n.command_discovery,verification:n.verification,warnings:l,...f?{}:{error:{message:"Extension install returned ok=false without throwing an error.",exit_code:d.GENERIC_FAILURE,code:"extension_install_soft_failed"}}})}catch(s){let n=te(s),l=n.exit_code;typeof l=="number"&&r===d.GENERIC_FAILURE&&l!==d.GENERIC_FAILURE&&(r=l),i.push({target:c,ok:!1,error:n})}return{rows:i,warnings:a,failureExitCode:r}}async function z(e,t,o,i){let a=i==="extension"?"package":i;await _(M[i],o);let r=await J(e);if(r===void 0||r.length<=1){await g(r?.[0],t,o,"install",a);return}let c=b(o),s=Date.now(),n=A(t,"install",a);if(H(n,c,void 0),[n.gh,n.github].some(k=>typeof k=="string"&&k.trim().length>0))throw new h("Multiple install targets cannot be combined with --gh/--github. Install one GitHub source per command, or pass multiple explicit local, bundled, or npm: targets.",d.USAGE,{code:"multi_target_github_install_ambiguous",required:"Use exactly one positional target with --gh/--github, or omit --gh/--github when installing multiple targets.",examples:["pm package install --gh owner/repo","pm package install npm:pm-guide-shell pm-todos"]});let{rows:l,warnings:f,failureExitCode:m}=await oe(r,n,c),u=l.filter(k=>k.ok!==!0).length,K={ok:u===0,action:"install",scope:n.global===!0?"global":"project",installed_count:n.dryRun===!0?0:l.length-u,...n.dryRun===!0?{dry_run:!0,planned_count:l.length-u}:{},failed_count:u,targets:l,warnings:[...new Set(f)].sort((k,B)=>k.localeCompare(B))};w(K,c),u>0&&(process.exitCode=m),c.profile&&y(`profile:command=extension took_ms=${Date.now()-s}`)}function ae(e){return e.option("--project","Use project extension scope (default)").option("--local","Alias for --project").option("--global","Use global extension scope")}function x(e){return e.option("--project","Use project package scope (default)").option("--local","Alias for --project").option("--global","Use global package scope")}function p(e,t){return t==="package"?x(e):ae(e)}function N(e){return e.option("--dry-run","Plan CLI/package upgrades without running npm or reinstalling packages").option("--cli-only","Upgrade only the pm CLI/SDK npm package").option("--packages-only","Upgrade only managed pm packages").option("--repair","Force npm global reinstall when upgrading the pm CLI/SDK").option("--tag <value>","npm dist-tag/version for CLI and registry package upgrades").option("--package-name <value>","Override the CLI package name for self-upgrade testing")}async function q(e,t,o){let i=b(t),a=Date.now();o&&await _("upgrade",t);let r=await T(e,t.optsWithGlobals(),i);w(r,i),r.ok||(process.exitCode=d.GENERIC_FAILURE),i.profile&&y(`profile:command=package-upgrade took_ms=${Date.now()-a}`)}function F(e,t){let o=t==="package"?"package":"extension",i=t==="package"?"packages":"extensions",a=t,r=e.command(a,{hidden:t==="extension"}).argument("[target]",`${o[0].toUpperCase()}${o.slice(1)} source, name, or scaffold path`).option("--init",`Generate a starter ${o} scaffold at target path`).option("--scaffold","Alias for --init").option("--capability <kind>","Starter capability for --init (default: commands)",v).option("--install",`Install a ${o} source`).option("--dry-run","Preview install without writes or activation").option("--uninstall",`Uninstall an installed ${o}`).option("--explore",`List discovered ${i} in selected scope`).option("--list","Alias for --explore").option("--manage",`List managed ${i} and updates`).option("--offline","Skip remote freshness checks during manage").option("--describe",`Show surfaces registered by a loaded ${o}`).option("--markdown","Render describe as Markdown").option("--output <path>","Write Markdown to a file").option("--reload",`Reload ${i} without import cache`).option("--watch","Use watch mode with --reload").option("--doctor",`Run ${o} diagnostics`).option("--catalog",`List bundled first-party ${o} catalog metadata`).option("--adopt",`Adopt unmanaged ${o}`).option("--adopt-all",`Adopt all unmanaged ${i}`).option("--activate",`Activate a ${o} in selected scope settings`).option("--deactivate",`Deactivate a ${o} in selected scope settings`).option("--project",`Use project ${o} scope (default)`).option("--local","Alias for --project").option("--global",`Use global ${o} scope`).option("--gh <github-source>","Install from GitHub shorthand source (owner/repo[/path])").option("--github <github-source>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub install sources").option("--detail <mode>",`${o[0].toUpperCase()}${o.slice(1)} diagnostics detail mode (summary|deep)`).option("--trace","Include actionable registration traces in doctor deep diagnostics").option("--runtime-probe","Opt-in runtime activation probe for manage output parity").option("--fix-managed-state",`Adopt unmanaged ${i} before diagnostics/update checks`).option("--isolated",`Run doctor against project-scope ${i} only, ignoring global registrations`).option("--ignore-global","Alias for --isolated").option("--strict-exit","Return non-zero exit when doctor warnings are present (ok=false)").option("--fail-on-warn","Alias for --strict-exit (doctor)").description(t==="package"?"Manage package lifecycle in project or global scope.":"Manage extension lifecycle in project or global scope.").action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,void 0,t)});t==="package"&&(r.alias("packages"),r.option("--declarative","Scaffold the composeExtension blueprint starter (any capability)"));let c=r.command("init").alias("scaffold").argument("<target>","Scaffold target directory path").option("--capability <kind>",`Capability the starter targets (${R.join("|")}; default commands)`,v).description(t==="package"?"Generate a starter package scaffold with package metadata, manifest, and entrypoint.":"Generate a starter extension scaffold with manifest and entrypoint.");t==="package"&&c.option("--declarative","Scaffold the composeExtension blueprint starter (any capability)"),p(c,t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"init",t)}),p(r.command("install").option("--dry-run","Resolve sources and estimate copying without destination writes or activation").argument("[targets...]",`${o[0].toUpperCase()}${o.slice(1)} source (local path, bundled alias, npm: source, wildcard, or GitHub source)`).option("--gh <github-source>","Install from GitHub shorthand source (owner/repo[/path])").option("--github <github-source>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub install sources").description(`Install ${o} from local path, bundled alias, npm: source, wildcard, or GitHub source.`),t).action(async(s,n,l)=>{await z(s,l.optsWithGlobals(),l,t)}),p(r.command("uninstall").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Uninstall an installed ${o}.`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"uninstall",t)}),p(r.command("explore").description(`List discovered ${i} in selected scope.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"explore",t)}),p(r.command("inventory").argument("[name]",`${o[0].toUpperCase()}${o.slice(1)} name or directory to inspect`).description(`Read configured ${o} install and enablement state without activating extension code.`),t).action(async(s,n,l)=>{let f=b(l),m=l.optsWithGlobals();if(m.global===!0&&(m.project===!0||m.local===!0))throw new h("--global and --project/--local are mutually exclusive.",d.USAGE);let u=await P({pmRoot:E(process.cwd(),f.path),scope:m.global===!0?"global":"project",name:s});w(u,f),u.complete||(process.exitCode=d.GENERIC_FAILURE)}),p(r.command("manage").option("--offline","Skip remote freshness checks and report unknown update availability").option("--runtime-probe","Opt-in runtime activation probe for manage output parity").option("--fix-managed-state",`Adopt unmanaged ${i} before diagnostics/update checks`).description(`List managed ${i} with update-check metadata.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"manage",t)}),p(r.command("describe").argument("[target]",`${o[0].toUpperCase()}${o.slice(1)} name to describe (omit for every loaded ${o})`).option("--markdown","Render the surface map as a Markdown reference document instead of toon/json").option("--output <path>","Write Markdown output to a file (requires --markdown)").description(`Map every surface a loaded ${o} registers (commands, hooks, item types, providers, overrides, ...).`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"describe",t)}),p(r.command("reload").option("--watch","Use watch mode for repeated reload checks").description(`Reload ${i} with cache-busted module imports.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"reload",t)}),p(r.command("doctor").option("--detail <mode>",`Detail mode for ${o} diagnostics (summary|deep)`).option("--trace","Include actionable registration traces in doctor deep diagnostics").option("--fix-managed-state",`Adopt unmanaged ${i} before diagnostics/update checks`).option("--isolated",`Run doctor against project-scope ${i} only, ignoring global registrations`).option("--ignore-global","Alias for --isolated").option("--strict-exit","Return non-zero exit when doctor warnings are present (ok=false)").option("--fail-on-warn","Alias for --strict-exit (doctor)").description(`Run consolidated ${o} diagnostics (summary/deep modes).`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"doctor",t)}),p(r.command("catalog").alias("list").option("--fields <value>","Render compact comma-separated catalog fields, for example: alias,installed,install_command").description(`List bundled first-party ${o} catalog metadata.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"catalog",t)}),p(r.command("adopt").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).option("--gh <owner/repo[/path]>",`GitHub provenance shorthand for adopted ${o}`).option("--github <owner/repo[/path]>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub shorthand source").description(`Adopt an existing unmanaged ${o} into managed metadata.`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"adopt",t)}),p(r.command("adopt-all").description(`Adopt all unmanaged ${i} into managed metadata.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"adopt-all",t)}),p(r.command("migrate").option("--dry-run","Plan active migrations without invoking extension code").description(`Plan or apply active ${o} migrations with durable receipts.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"migrate",t)}),p(r.command("activate").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Activate a ${o} in selected scope settings.`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"activate",t)}),p(r.command("deactivate").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Deactivate a ${o} in selected scope settings.`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"deactivate",t)}),t==="package"&&N(x(r.command("upgrade").argument("[target]","Optional managed package name/source to upgrade; omit to upgrade pm CLI and all managed packages").description("Upgrade the pm CLI/SDK and refresh managed installable pm packages."))).action(async(s,n,l)=>{await q(s,l,!1)})}async function ie(e,t,o){let i=b(o),a=Date.now(),r=await L(e,i,{idPrefix:typeof t.idPrefix=="string"?t.idPrefix:void 0,preset:typeof t.preset=="string"?t.preset:void 0,defaults:t.defaults===!0||t.yes===!0,author:typeof t.author=="string"?t.author:void 0,agentGuidance:typeof t.agentGuidance=="string"?t.agentGuidance:void 0,typePreset:typeof t.typePreset=="string"?t.typePreset:void 0,withPackages:t.withPackages===!0,mergeFence:t.mergeFence!==!1,force:t.force===!0,workspace:typeof t.workspace=="string"?t.workspace:void 0}),c=t.verbose===!0||i.json===!0;w(c?r:O(r,!0),i),i.profile&&y(`profile:command=init took_ms=${Date.now()-a}`)}function ne(e,t,o,i){let a=e!==void 0&&new Set(["get","set","list","export"]).has(e);return{resolvedScope:a?"project":e??"project",resolvedAction:a?e:t??"list",resolvedKey:a?t:o,resolvedValue:a?o:i}}function re(e){return{criterion:Array.isArray(e.criterion)?e.criterion:[],format:typeof e.format=="string"?e.format:void 0,policy:typeof e.policy=="string"?e.policy:void 0,value:typeof e.value=="string"?e.value:void 0,clearCriteria:e.clearCriteria===!0,defaultDepth:typeof e.defaultDepth=="string"?e.defaultDepth:void 0,activityLimit:typeof e.activityLimit=="string"?e.activityLimit:void 0,staleThresholdDays:typeof e.staleThresholdDays=="string"?e.staleThresholdDays:void 0,sectionHierarchy:typeof e.sectionHierarchy=="string"?e.sectionHierarchy:void 0,sectionActivity:typeof e.sectionActivity=="string"?e.sectionActivity:void 0,sectionProgress:typeof e.sectionProgress=="string"?e.sectionProgress:void 0,sectionBlockers:typeof e.sectionBlockers=="string"?e.sectionBlockers:void 0,sectionFiles:typeof e.sectionFiles=="string"?e.sectionFiles:void 0,sectionWorkload:typeof e.sectionWorkload=="string"?e.sectionWorkload:void 0,sectionStaleness:typeof e.sectionStaleness=="string"?e.sectionStaleness:void 0,sectionTests:typeof e.sectionTests=="string"?e.sectionTests:void 0}}async function se(e,t,o,i,a,r){let c=b(r),s=Date.now(),{resolvedScope:n,resolvedAction:l,resolvedKey:f,resolvedValue:m}=ne(e,t,o,i),u=await j(n,l,f,re(a),c,typeof m=="string"?m:void 0);w(u,c),c.profile&&y(`profile:command=config took_ms=${Date.now()-s}`)}var Re={normalizeExtensionOptions:A};function Ue(e){e.command("init").argument("[prefix-or-path]","Optional id prefix, or path-like tracker target such as ./pm-sandbox").option("--prefix, --id-prefix <value>","Set the item ID prefix (alias for the positional prefix)").option("--preset <value>","Governance preset for new setups: minimal|default|strict").option("--defaults","Use non-interactive setup defaults without opening the wizard").option("-y, --yes","Alias for --defaults (non-interactive setup)").option("--author <value>","Set the default mutation author for this project").option("--agent-guidance <mode>","Agent guidance mode: ask|add|skip|status").option("--type-preset <name>","Register domain item types during init: agile|ops|research").option("--with-packages","Install all bundled first-party packages during initialization").option("--no-merge-fence","Skip automatic merge-driver installation for a fresh Git-backed tracker").option("--workspace <dir>","Initialize repository-local tracker storage at <dir>/.agents/pm").option("--force","Allow initializing tracker files directly in a directory that looks like a workspace root").option("--verbose","Include the full resolved settings tree in the output (default output is a concise summary)").description("Initialize pm storage and defaults for the current workspace or a path-like tracker target.").action(async(t,o,i)=>{await ie(t,o,i)}),e.command("config").argument("[scope]","Config scope: project|global, or action shorthand list|export|get|set for project scope").argument("[action]","Config action: get|set|list|export").argument("[key]","Config key for get|set; use `pm config project list` for the complete typed inventory, including mutation-guard-* policies").argument("[value]",'Optional value for set: routed to the right typed flag by key (e.g. config set telemetry-tracking off, config set item-format toon, config set definition-of-done "Tests pass"). Equivalent to --policy/--format/--criterion. context keys still require --default-depth/--section-* flags.').option("--criterion <text>","Criteria value for definition-of-done, metadata-required-fields, or lifecycle pattern keys (repeatable for set)",v).option("--clear-criteria","Clear criteria-list keys for config set operations").option("--format <value>","Item format for item-format key: toon").option("--policy <value>","Policy key values: history-missing-stream-policy=auto_create|strict_error; sprint-release-format-policy=warn|strict_error; parent-reference-policy=warn|strict_error; governance-preset=minimal|default|strict|custom; governance-ownership-enforcement=none|warn|strict; governance-create-mode-default=progressive|strict; governance-close-validation-default=off|warn|strict; governance-require-close-reason=enabled|disabled; governance-parent-reference-policy=warn|strict_error; governance-metadata-validation-profile=core|strict|custom; governance-force-required-for-stale-lock=enabled|disabled; governance-duplicate-detection-mode=off|advisory|strict; test-result-tracking=enabled|disabled; untrusted-linked-test-execution=enabled|disabled; telemetry-tracking=enabled|disabled").option("--value <value>","Typed nested setting value. Mutation guards: require-attributed-author=true|false, secret-guard=off|advise|block, stale-in-progress-hours=integer>=1. Kebab-case is preferred; underscore aliases remain accepted.").option("--default-depth <value>","Context default depth: brief|standard|deep").option("--activity-limit <n>","Context default activity limit").option("--stale-threshold-days <n>","Context staleness cutoff in days").option("--section-hierarchy <value>","Enable/disable context hierarchy section (true|false)").option("--section-activity <value>","Enable/disable context activity section (true|false)").option("--section-progress <value>","Enable/disable context progress section (true|false)").option("--section-blockers <value>","Enable/disable context blockers section (true|false)").option("--section-files <value>","Enable/disable context files section (true|false)").option("--section-workload <value>","Enable/disable context workload section (true|false)").option("--section-staleness <value>","Enable/disable context staleness section (true|false)").option("--section-tests <value>","Enable/disable context tests section (true|false)").description("Read or update pm settings for the current workspace or global profile.").action(async(t,o,i,a,r,c)=>{await se(t,o,i,a,r,c)}),F(e,"extension"),F(e,"package"),x(e.command("install",{hidden:!0}).option("--dry-run","Resolve sources and estimate copying without destination writes or activation").argument("[targets...]","Package source (local path, bundled alias, npm: source, wildcard, or GitHub source)").option("--gh <github-source>","Install from GitHub shorthand source (owner/repo[/path])").option("--github <github-source>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub install sources").description("Install a pm package into the project package scope by default.")).action(async(t,o,i)=>{await _("install",i),await z(t,i.optsWithGlobals(),i,"package")}),N(x(e.command("upgrade",{hidden:!0}).argument("[target]","Optional managed package name/source to upgrade; omit to upgrade pm CLI and all managed packages").description("Upgrade the pm CLI/SDK and refresh managed installable pm packages."))).action(async(t,o,i)=>{await q(t,i,!0)})}export{Re as _testOnlyRegisterSetup,Ue as registerSetupCommands};
2
- //# sourceMappingURL=register-setup-BMIFKZZP.js.map
1
+ import"./chunk-DEZPZOQ7.js";import{a as P}from"./chunk-NGRPD3ZO.js";import{g as j,i as T}from"./chunk-QHHFXNSQ.js";import{Da as I,Ia as O,Ka as L,qa as R,ta as U}from"./chunk-RGHLQGEX.js";import"./chunk-DAZFCSDV.js";import{ig as b,lg as v}from"./chunk-ZNWDYDFF.js";import"./chunk-533L6D2N.js";import"./chunk-IB7UB5TE.js";import{Kh as D,Ma as E,Nh as w,Oh as y,Pi as S,y as $,z as G}from"./chunk-BFZUJ5QP.js";import"./chunk-D52QQ7LP.js";import"./chunk-VS565KBX.js";import{A as d,C as h}from"./chunk-J3JM36EH.js";import"./chunk-XAWE4EAK.js";import C from"node:fs/promises";import W from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="26ea7f42-d5f7-5ada-afd9-389dadc4d138")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0b0e08e0-f6e7-59c4-ac96-9f47b172727a")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d975120a-964e-5b19-ae10-8ba011ba9bf8")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="108609fa-51fc-5bd0-ac54-de2ad14a66c6")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b36466e6-5574-5509-909a-e8599f11664c")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e5e1e242-6864-5a72-adb9-0eda4c65a0c3")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d41d82cb-8b54-5b72-936e-217cde14c4b5")}catch{}})();var M={extension:"extension",package:void 0};async function _(e,t){if(!e)return;let o=$(e),i=b(t);await S(E(process.cwd(),i.path)).then(a=>a.ux.deprecation_hints)&&y(G(o))}var V={init:"init",install:"install",uninstall:"uninstall",explore:"explore",manage:"manage",describe:"describe",reload:"reload",doctor:"doctor",catalog:"catalog",adopt:"adopt","adopt-all":"adoptAll",activate:"activate",deactivate:"deactivate",migrate:"migrate"};function X(e){let t=e.capability,o=typeof t=="string"?[t]:Array.isArray(t)?t.filter(a=>typeof a=="string"):[],i=[...new Set(o.map(a=>a.trim().toLowerCase()).filter(a=>a.length>0))];if(i.length>1)throw new h(`Multiple scaffold capabilities cannot be combined yet: ${i.join(", ")}. Choose one capability per scaffold.`,d.USAGE);return i[0]}function A(e,t,o="extension"){let i={...e};t!==void 0&&(i[V[t]]=!0);let a=(...c)=>c.some(s=>i[s]===!0),r=(...c)=>{for(let s of c)if(typeof i[s]=="string")return i[s]};return{init:a("init"),scaffold:a("scaffold"),install:a("install"),uninstall:a("uninstall"),explore:a("explore","list"),manage:a("manage"),describe:a("describe"),markdown:a("markdown"),reload:a("reload"),doctor:a("doctor"),catalog:a("catalog"),adopt:a("adopt"),adoptAll:a("adoptAll","adopt_all","adopt-all"),activate:a("activate"),deactivate:a("deactivate"),migrate:a("migrate"),project:a("project"),local:a("local"),global:a("global"),gh:r("gh"),github:r("github"),ref:r("ref"),capability:X(e),declarative:a("declarative"),fields:r("fields"),detail:r("detail"),output:r("output"),trace:a("trace"),watch:a("watch"),runtimeProbe:a("runtimeProbe","runtime_probe","runtime-probe"),offline:a("offline"),fixManagedState:a("fixManagedState","fix_managed_state","fix-managed-state"),isolated:a("isolated"),ignoreGlobal:a("ignoreGlobal","ignore_global","ignore-global"),strictExit:a("strictExit","strict_exit","strict-exit"),failOnWarn:a("failOnWarn","fail_on_warn","fail-on-warn"),dryRun:a("dryRun","dry_run","dry-run"),vocabulary:o}}async function Y(e){let t=(await C.readdir(process.cwd())).filter(i=>!i.startsWith(".")).sort((i,a)=>i.localeCompare(a)),o=[...e].sort((i,a)=>i.localeCompare(a));return t.length===o.length&&t.every((i,a)=>i===o[a])}async function J(e){let t=(e??[]).map(o=>o.trim()).filter(o=>o.length>0);return t.length<=1?t.length===0?void 0:t:await Y(t)?["*"]:t}function H(e,t,o){let i=e.markdown===!0;if(o!==void 0&&o==="")throw new h("--output requires a non-empty file path.",d.USAGE);if(o!==void 0&&!i)throw new h("--output is only supported with --markdown describe output.",d.USAGE);if(i){if(t.json)throw new h("Cannot combine --json with --markdown.",d.USAGE);if(e.describe!==!0)throw new h("--markdown is only supported by the describe action.",d.USAGE)}}async function Q(e){let t=U(e.result.details,e.vocabulary);if(e.outputPath!==void 0){let o=W.resolve(e.outputPath);await C.mkdir(W.dirname(o),{recursive:!0}),await C.writeFile(o,t,"utf8")}if(!e.globalOptions.quiet){for(let o of e.result.warnings)y(`warning: ${o}`);e.outputPath===void 0&&D(t)}}function Z(e,t){let o=!!t.strictExit||!!t.failOnWarn;if(e.action!=="doctor"||!o)return;let i=e.details!==null&&typeof e.details=="object"?e.details:{},a=i.summary!==null&&typeof i.summary=="object"?i.summary:null,r=a&&typeof a.status=="string"?a.status:void 0;(e.warnings.length>0||r!==void 0&&r!=="ok")&&(process.exitCode=d.GENERIC_FAILURE)}async function g(e,t,o,i,a="extension"){let r=b(o),c=Date.now(),s=a==="extension"?"package":a;await _(M[a],o);let n=A(t,i,s),l=(typeof n.output=="string"?n.output:void 0)?.trim();H(n,r,l);let f=await I(e,n,r);n.markdown===!0?await Q({result:f,vocabulary:s,outputPath:l,globalOptions:r}):w(f,r),Z(f,n),f.ok===!1&&(process.exitCode=d.GENERIC_FAILURE),r.profile&&y(`profile:command=extension took_ms=${Date.now()-c}`)}function ee(e){return e.details!==null&&typeof e.details=="object"?e.details:{}}function te(e){return e instanceof h?{message:e.message,exit_code:e.exitCode,...e.context}:{message:e instanceof Error?e.message:String(e),exit_code:d.GENERIC_FAILURE}}async function oe(e,t,o){let i=[],a=[],r=d.GENERIC_FAILURE;for(let c of e)try{let s=await I(c,t,o),n=ee(s),l=Array.isArray(s.warnings)?s.warnings:[];a.push(...l);let f=s.ok===!0;i.push({target:c,ok:f,extension:n.extension,source:n.source,install_plan:n.install_plan,dry_run:n.dry_run,destination_path:n.destination_path,activated:n.activated,settings_changed:n.settings_changed,previous_state_preserved:n.previous_state_preserved,rollback:n.rollback,command_paths:n.command_paths,action_paths:n.action_paths,runtime_activation_status:n.runtime_activation_status,activation_diagnostics:n.activation_diagnostics,command_discovery:n.command_discovery,verification:n.verification,warnings:l,...f?{}:{error:{message:"Extension install returned ok=false without throwing an error.",exit_code:d.GENERIC_FAILURE,code:"extension_install_soft_failed"}}})}catch(s){let n=te(s),l=n.exit_code;typeof l=="number"&&r===d.GENERIC_FAILURE&&l!==d.GENERIC_FAILURE&&(r=l),i.push({target:c,ok:!1,error:n})}return{rows:i,warnings:a,failureExitCode:r}}async function z(e,t,o,i){let a=i==="extension"?"package":i;await _(M[i],o);let r=await J(e);if(r===void 0||r.length<=1){await g(r?.[0],t,o,"install",a);return}let c=b(o),s=Date.now(),n=A(t,"install",a);if(H(n,c,void 0),[n.gh,n.github].some(k=>typeof k=="string"&&k.trim().length>0))throw new h("Multiple install targets cannot be combined with --gh/--github. Install one GitHub source per command, or pass multiple explicit local, bundled, or npm: targets.",d.USAGE,{code:"multi_target_github_install_ambiguous",required:"Use exactly one positional target with --gh/--github, or omit --gh/--github when installing multiple targets.",examples:["pm package install --gh owner/repo","pm package install npm:pm-guide-shell pm-todos"]});let{rows:l,warnings:f,failureExitCode:m}=await oe(r,n,c),u=l.filter(k=>k.ok!==!0).length,K={ok:u===0,action:"install",scope:n.global===!0?"global":"project",installed_count:n.dryRun===!0?0:l.length-u,...n.dryRun===!0?{dry_run:!0,planned_count:l.length-u}:{},failed_count:u,targets:l,warnings:[...new Set(f)].sort((k,B)=>k.localeCompare(B))};w(K,c),u>0&&(process.exitCode=m),c.profile&&y(`profile:command=extension took_ms=${Date.now()-s}`)}function ae(e){return e.option("--project","Use project extension scope (default)").option("--local","Alias for --project").option("--global","Use global extension scope")}function x(e){return e.option("--project","Use project package scope (default)").option("--local","Alias for --project").option("--global","Use global package scope")}function p(e,t){return t==="package"?x(e):ae(e)}function N(e){return e.option("--dry-run","Plan CLI/package upgrades without running npm or reinstalling packages").option("--cli-only","Upgrade only the pm CLI/SDK npm package").option("--packages-only","Upgrade only managed pm packages").option("--repair","Force npm global reinstall when upgrading the pm CLI/SDK").option("--tag <value>","npm dist-tag/version for CLI and registry package upgrades").option("--package-name <value>","Override the CLI package name for self-upgrade testing")}async function q(e,t,o){let i=b(t),a=Date.now();o&&await _("upgrade",t);let r=await T(e,t.optsWithGlobals(),i);w(r,i),r.ok||(process.exitCode=d.GENERIC_FAILURE),i.profile&&y(`profile:command=package-upgrade took_ms=${Date.now()-a}`)}function F(e,t){let o=t==="package"?"package":"extension",i=t==="package"?"packages":"extensions",a=t,r=e.command(a,{hidden:t==="extension"}).argument("[target]",`${o[0].toUpperCase()}${o.slice(1)} source, name, or scaffold path`).option("--init",`Generate a starter ${o} scaffold at target path`).option("--scaffold","Alias for --init").option("--capability <kind>","Starter capability for --init (default: commands)",v).option("--install",`Install a ${o} source`).option("--dry-run","Preview install without writes or activation").option("--uninstall",`Uninstall an installed ${o}`).option("--explore",`List discovered ${i} in selected scope`).option("--list","Alias for --explore").option("--manage",`List managed ${i} and updates`).option("--offline","Skip remote freshness checks during manage").option("--describe",`Show surfaces registered by a loaded ${o}`).option("--markdown","Render describe as Markdown").option("--output <path>","Write Markdown to a file").option("--reload",`Reload ${i} without import cache`).option("--watch","Use watch mode with --reload").option("--doctor",`Run ${o} diagnostics`).option("--catalog",`List bundled first-party ${o} catalog metadata`).option("--adopt",`Adopt unmanaged ${o}`).option("--adopt-all",`Adopt all unmanaged ${i}`).option("--activate",`Activate a ${o} in selected scope settings`).option("--deactivate",`Deactivate a ${o} in selected scope settings`).option("--project",`Use project ${o} scope (default)`).option("--local","Alias for --project").option("--global",`Use global ${o} scope`).option("--gh <github-source>","Install from GitHub shorthand source (owner/repo[/path])").option("--github <github-source>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub install sources").option("--detail <mode>",`${o[0].toUpperCase()}${o.slice(1)} diagnostics detail mode (summary|deep)`).option("--trace","Include actionable registration traces in doctor deep diagnostics").option("--runtime-probe","Opt-in runtime activation probe for manage output parity").option("--fix-managed-state",`Adopt unmanaged ${i} before diagnostics/update checks`).option("--isolated",`Run doctor against project-scope ${i} only, ignoring global registrations`).option("--ignore-global","Alias for --isolated").option("--strict-exit","Return non-zero exit when doctor warnings are present (ok=false)").option("--fail-on-warn","Alias for --strict-exit (doctor)").description(t==="package"?"Manage package lifecycle in project or global scope.":"Manage extension lifecycle in project or global scope.").action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,void 0,t)});t==="package"&&(r.alias("packages"),r.option("--declarative","Scaffold the composeExtension blueprint starter (any capability)"));let c=r.command("init").alias("scaffold").argument("<target>","Scaffold target directory path").option("--capability <kind>",`Capability the starter targets (${R.join("|")}; default commands)`,v).description(t==="package"?"Generate a starter package scaffold with package metadata, manifest, and entrypoint.":"Generate a starter extension scaffold with manifest and entrypoint.");t==="package"&&c.option("--declarative","Scaffold the composeExtension blueprint starter (any capability)"),p(c,t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"init",t)}),p(r.command("install").option("--dry-run","Resolve sources and estimate copying without destination writes or activation").argument("[targets...]",`${o[0].toUpperCase()}${o.slice(1)} source (local path, bundled alias, npm: source, wildcard, or GitHub source)`).option("--gh <github-source>","Install from GitHub shorthand source (owner/repo[/path])").option("--github <github-source>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub install sources").description(`Install ${o} from local path, bundled alias, npm: source, wildcard, or GitHub source.`),t).action(async(s,n,l)=>{await z(s,l.optsWithGlobals(),l,t)}),p(r.command("uninstall").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Uninstall an installed ${o}.`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"uninstall",t)}),p(r.command("explore").description(`List discovered ${i} in selected scope.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"explore",t)}),p(r.command("inventory").argument("[name]",`${o[0].toUpperCase()}${o.slice(1)} name or directory to inspect`).description(`Read configured ${o} install and enablement state without activating extension code.`),t).action(async(s,n,l)=>{let f=b(l),m=l.optsWithGlobals();if(m.global===!0&&(m.project===!0||m.local===!0))throw new h("--global and --project/--local are mutually exclusive.",d.USAGE);let u=await P({pmRoot:E(process.cwd(),f.path),scope:m.global===!0?"global":"project",name:s});w(u,f),u.complete||(process.exitCode=d.GENERIC_FAILURE)}),p(r.command("manage").option("--offline","Skip remote freshness checks and report unknown update availability").option("--runtime-probe","Opt-in runtime activation probe for manage output parity").option("--fix-managed-state",`Adopt unmanaged ${i} before diagnostics/update checks`).description(`List managed ${i} with update-check metadata.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"manage",t)}),p(r.command("describe").argument("[target]",`${o[0].toUpperCase()}${o.slice(1)} name to describe (omit for every loaded ${o})`).option("--markdown","Render the surface map as a Markdown reference document instead of toon/json").option("--output <path>","Write Markdown output to a file (requires --markdown)").description(`Map every surface a loaded ${o} registers (commands, hooks, item types, providers, overrides, ...).`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"describe",t)}),p(r.command("reload").option("--watch","Use watch mode for repeated reload checks").description(`Reload ${i} with cache-busted module imports.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"reload",t)}),p(r.command("doctor").option("--detail <mode>",`Detail mode for ${o} diagnostics (summary|deep)`).option("--trace","Include actionable registration traces in doctor deep diagnostics").option("--fix-managed-state",`Adopt unmanaged ${i} before diagnostics/update checks`).option("--isolated",`Run doctor against project-scope ${i} only, ignoring global registrations`).option("--ignore-global","Alias for --isolated").option("--strict-exit","Return non-zero exit when doctor warnings are present (ok=false)").option("--fail-on-warn","Alias for --strict-exit (doctor)").description(`Run consolidated ${o} diagnostics (summary/deep modes).`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"doctor",t)}),p(r.command("catalog").alias("list").option("--fields <value>","Render compact comma-separated catalog fields, for example: alias,installed,install_command").description(`List bundled first-party ${o} catalog metadata.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"catalog",t)}),p(r.command("adopt").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).option("--gh <owner/repo[/path]>",`GitHub provenance shorthand for adopted ${o}`).option("--github <owner/repo[/path]>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub shorthand source").description(`Adopt an existing unmanaged ${o} into managed metadata.`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"adopt",t)}),p(r.command("adopt-all").description(`Adopt all unmanaged ${i} into managed metadata.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"adopt-all",t)}),p(r.command("migrate").option("--dry-run","Plan active migrations without invoking extension code").description(`Plan or apply active ${o} migrations with durable receipts.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"migrate",t)}),p(r.command("activate").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Activate a ${o} in selected scope settings.`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"activate",t)}),p(r.command("deactivate").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Deactivate a ${o} in selected scope settings.`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"deactivate",t)}),t==="package"&&N(x(r.command("upgrade").argument("[target]","Optional managed package name/source to upgrade; omit to upgrade pm CLI and all managed packages").description("Upgrade the pm CLI/SDK and refresh managed installable pm packages."))).action(async(s,n,l)=>{await q(s,l,!1)})}async function ie(e,t,o){let i=b(o),a=Date.now(),r=await L(e,i,{idPrefix:typeof t.idPrefix=="string"?t.idPrefix:void 0,preset:typeof t.preset=="string"?t.preset:void 0,defaults:t.defaults===!0||t.yes===!0,author:typeof t.author=="string"?t.author:void 0,agentGuidance:typeof t.agentGuidance=="string"?t.agentGuidance:void 0,typePreset:typeof t.typePreset=="string"?t.typePreset:void 0,withPackages:t.withPackages===!0,mergeFence:t.mergeFence!==!1,force:t.force===!0,workspace:typeof t.workspace=="string"?t.workspace:void 0}),c=t.verbose===!0||i.json===!0;w(c?r:O(r,!0),i),i.profile&&y(`profile:command=init took_ms=${Date.now()-a}`)}function ne(e,t,o,i){let a=e!==void 0&&new Set(["get","set","list","export"]).has(e);return{resolvedScope:a?"project":e??"project",resolvedAction:a?e:t??"list",resolvedKey:a?t:o,resolvedValue:a?o:i}}function re(e){return{criterion:Array.isArray(e.criterion)?e.criterion:[],format:typeof e.format=="string"?e.format:void 0,policy:typeof e.policy=="string"?e.policy:void 0,value:typeof e.value=="string"?e.value:void 0,clearCriteria:e.clearCriteria===!0,defaultDepth:typeof e.defaultDepth=="string"?e.defaultDepth:void 0,activityLimit:typeof e.activityLimit=="string"?e.activityLimit:void 0,staleThresholdDays:typeof e.staleThresholdDays=="string"?e.staleThresholdDays:void 0,sectionHierarchy:typeof e.sectionHierarchy=="string"?e.sectionHierarchy:void 0,sectionActivity:typeof e.sectionActivity=="string"?e.sectionActivity:void 0,sectionProgress:typeof e.sectionProgress=="string"?e.sectionProgress:void 0,sectionBlockers:typeof e.sectionBlockers=="string"?e.sectionBlockers:void 0,sectionFiles:typeof e.sectionFiles=="string"?e.sectionFiles:void 0,sectionWorkload:typeof e.sectionWorkload=="string"?e.sectionWorkload:void 0,sectionStaleness:typeof e.sectionStaleness=="string"?e.sectionStaleness:void 0,sectionTests:typeof e.sectionTests=="string"?e.sectionTests:void 0}}async function se(e,t,o,i,a,r){let c=b(r),s=Date.now(),{resolvedScope:n,resolvedAction:l,resolvedKey:f,resolvedValue:m}=ne(e,t,o,i),u=await j(n,l,f,re(a),c,typeof m=="string"?m:void 0);w(u,c),c.profile&&y(`profile:command=config took_ms=${Date.now()-s}`)}var Re={normalizeExtensionOptions:A};function Ue(e){e.command("init").argument("[prefix-or-path]","Optional id prefix, or path-like tracker target such as ./pm-sandbox").option("--prefix, --id-prefix <value>","Set the item ID prefix (alias for the positional prefix)").option("--preset <value>","Governance preset for new setups: minimal|default|strict").option("--defaults","Use non-interactive setup defaults without opening the wizard").option("-y, --yes","Alias for --defaults (non-interactive setup)").option("--author <value>","Set the default mutation author for this project").option("--agent-guidance <mode>","Agent guidance mode: ask|add|skip|status").option("--type-preset <name>","Register domain item types during init: agile|ops|research").option("--with-packages","Install all bundled first-party packages during initialization").option("--no-merge-fence","Skip automatic merge-driver installation for a fresh Git-backed tracker").option("--workspace <dir>","Initialize repository-local tracker storage at <dir>/.agents/pm").option("--force","Allow initializing tracker files directly in a directory that looks like a workspace root").option("--verbose","Include the full resolved settings tree in the output (default output is a concise summary)").description("Initialize pm storage and defaults for the current workspace or a path-like tracker target.").action(async(t,o,i)=>{await ie(t,o,i)}),e.command("config").argument("[scope]","Config scope: project|global, or action shorthand list|export|get|set for project scope").argument("[action]","Config action: get|set|list|export").argument("[key]","Config key for get|set; use `pm config project list` for the complete typed inventory, including mutation-guard-* policies").argument("[value]",'Optional value for set: routed to the right typed flag by key (e.g. config set telemetry-tracking off, config set item-format toon, config set definition-of-done "Tests pass"). Equivalent to --policy/--format/--criterion. context keys still require --default-depth/--section-* flags.').option("--criterion <text>","Criteria value for definition-of-done, metadata-required-fields, or lifecycle pattern keys (repeatable for set)",v).option("--clear-criteria","Clear criteria-list keys for config set operations").option("--format <value>","Item format for item-format key: toon").option("--policy <value>","Policy key values: history-missing-stream-policy=auto_create|strict_error; sprint-release-format-policy=warn|strict_error; parent-reference-policy=warn|strict_error; governance-preset=minimal|default|strict|custom; governance-ownership-enforcement=none|warn|strict; governance-create-mode-default=progressive|strict; governance-close-validation-default=off|warn|strict; governance-require-close-reason=enabled|disabled; governance-parent-reference-policy=warn|strict_error; governance-metadata-validation-profile=core|strict|custom; governance-force-required-for-stale-lock=enabled|disabled; governance-duplicate-detection-mode=off|advisory|strict; test-result-tracking=enabled|disabled; untrusted-linked-test-execution=enabled|disabled; telemetry-tracking=enabled|disabled").option("--value <value>","Typed nested setting value. Mutation guards: require-attributed-author=true|false, secret-guard=off|advise|block, stale-in-progress-hours=integer>=1. Kebab-case is preferred; underscore aliases remain accepted.").option("--default-depth <value>","Context default depth: brief|standard|deep").option("--activity-limit <n>","Context default activity limit").option("--stale-threshold-days <n>","Context staleness cutoff in days").option("--section-hierarchy <value>","Enable/disable context hierarchy section (true|false)").option("--section-activity <value>","Enable/disable context activity section (true|false)").option("--section-progress <value>","Enable/disable context progress section (true|false)").option("--section-blockers <value>","Enable/disable context blockers section (true|false)").option("--section-files <value>","Enable/disable context files section (true|false)").option("--section-workload <value>","Enable/disable context workload section (true|false)").option("--section-staleness <value>","Enable/disable context staleness section (true|false)").option("--section-tests <value>","Enable/disable context tests section (true|false)").description("Read or update pm settings for the current workspace or global profile.").action(async(t,o,i,a,r,c)=>{await se(t,o,i,a,r,c)}),F(e,"extension"),F(e,"package"),x(e.command("install",{hidden:!0}).option("--dry-run","Resolve sources and estimate copying without destination writes or activation").argument("[targets...]","Package source (local path, bundled alias, npm: source, wildcard, or GitHub source)").option("--gh <github-source>","Install from GitHub shorthand source (owner/repo[/path])").option("--github <github-source>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub install sources").description("Install a pm package into the project package scope by default.")).action(async(t,o,i)=>{await _("install",i),await z(t,i.optsWithGlobals(),i,"package")}),N(x(e.command("upgrade",{hidden:!0}).argument("[target]","Optional managed package name/source to upgrade; omit to upgrade pm CLI and all managed packages").description("Upgrade the pm CLI/SDK and refresh managed installable pm packages."))).action(async(t,o,i)=>{await q(t,i,!0)})}export{Re as _testOnlyRegisterSetup,Ue as registerSetupCommands};
2
+ //# sourceMappingURL=register-setup-6B6Q7M5L.js.map
@@ -1,7 +1,7 @@
1
- import{b as d}from"./chunk-SPPHDVZE.js";import{b as l}from"./chunk-VS565KBX.js";import{A as s,C as m,G as c,K as p}from"./chunk-WX25MU4N.js";import"./chunk-XAWE4EAK.js";import{execFile as f}from"node:child_process";import{chmod as h,lstat as u}from"node:fs/promises";import{promisify as w}from"node:util";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="5b6eab08-f707-586f-bb05-484bd9160551")}catch{}})();var y=w(f),g=`#!/bin/sh
1
+ import{b as d}from"./chunk-SPPHDVZE.js";import{b as l}from"./chunk-VS565KBX.js";import{A as s,C as m,G as c,K as p}from"./chunk-J3JM36EH.js";import"./chunk-XAWE4EAK.js";import{execFile as f}from"node:child_process";import{chmod as h,lstat as u}from"node:fs/promises";import{promisify as w}from"node:util";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="5b6eab08-f707-586f-bb05-484bd9160551")}catch{}})();var y=w(f),g=`#!/bin/sh
2
2
  # pm-cli:lossless-merge-settlement:v1
3
3
  `;async function I(e,t){let r=(await y("git",["rev-parse","--path-format=absolute","--git-path","hooks/pre-commit"],{cwd:e,env:l(),timeout:1e4})).stdout.trim(),o,i=!1;try{o=await d(r,65536)??"",i=process.platform==="win32"||((await u(r)).mode&73)!==0}catch(a){if(!c(a))throw a}if(o!==void 0&&!o.startsWith(g))throw new m("The pre-commit hook already exists and is not owned by pm; it was preserved.",s.CONFLICT,{code:"merge_settlement_hook_conflict",recovery:{suggested_retry:"pm merge install --dry-run"},nextSteps:["Integrate pm merge reconcile --stage into your existing hook after reviewing its policy, or keep manual settlement. pm never replaces an existing unowned hook."]});let n=`${g}merge_head=$(git rev-parse --git-path MERGE_HEAD) || exit 1
4
4
  [ -f "$merge_head" ] || exit 0
5
5
  exec ${t} merge reconcile --stage
6
6
  `;return{path:r,changed:o!==n||!i,content:n}}async function H(e){e.changed&&(await p(e.path,e.content),await h(e.path,493))}export{I as prepareMergeSettlementHook,H as writeMergeSettlementHook};
7
- //# sourceMappingURL=settlement-hook-YWSWFOZY.js.map
7
+ //# sourceMappingURL=settlement-hook-UTCEZBFT.js.map
@@ -1,2 +1,2 @@
1
- import{a as y}from"./chunk-MRUA2Z43.js";import{i as w}from"./chunk-2GK2IVU5.js";import"./chunk-IB7UB5TE.js";import{Ma as h}from"./chunk-5WVE7XBS.js";import{d as g}from"./chunk-SBVX5CMV.js";import{b as u}from"./chunk-VS565KBX.js";import{A as d,C as f}from"./chunk-WX25MU4N.js";import"./chunk-XAWE4EAK.js";import{execFile as _}from"node:child_process";import{realpath as b}from"node:fs/promises";import l from"node:path";import{promisify as x}from"node:util";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="7f4b2fc8-c9c6-51ff-a345-b76b8abdacf4")}catch{}})();var R=x(_);function c(e){return new f(`Automatic merge settlement refused: ${e}`,d.CONFLICT,{code:"merge_settlement_review_required",recovery:{suggested_retry:"pm merge reconcile --dry-run"},nextSteps:["Inspect receipts, repair streams and Git changes. Resolve competing values or unrelated drift explicitly, then run pm merge reconcile and stage the reviewed artifacts manually."]})}async function $(e){let t=process.env.GIT_INDEX_FILE;if(t===void 0)return;let a=(await e(["rev-parse","--path-format=absolute","--git-path","index"])).stdout.trim();if(l.resolve(t)!==l.resolve(a))throw c("an alternate Git index requires explicit manual settlement")}async function I(e,t){if(t.length===0)return[];let a=t.map(s=>`:(literal)${s}`),o=new Set((await e(["ls-files","--cached","-z","--",...a])).stdout.split("\0")),i=t.filter(s=>!o.has(s)).map(s=>`:(literal)${s}`);if(i.length>0&&(await e(["diff","--cached","--name-only","--diff-filter=D","-z","--",...i])).stdout.length>0)throw c("a receipt has a staged deletion that requires explicit review");return i}async function G(e){let{git:t,preview:a,paths:o,newReceiptPathspecs:i}=e,s=!1;try{i.length>0&&(s=!0,await t(["add","--",...i]));let n=await e.apply();if(!n.ok||JSON.stringify(n.receipts.summaries)!==JSON.stringify(a.receipts.summaries)||n.repair.streams.some(p=>!a.repair.streams.some(m=>m.id===p.id)))throw c("reconciliation changed or did not finish; inspect the audit artifacts before staging");return o.length>0&&await t(["add","--",...o.map(p=>`:(literal)${p}`)]),{...n,staged_paths:o,guidance:["Lossless reconciliation artifacts are staged for the merge commit. Review git diff --cached before committing."]}}catch(n){throw s&&await t(["reset","--quiet","--",...i]),n}}function k(e){if(e.repair.totals.failed>0||e.receipts.missing_history_references_after>0||e.receipts.summaries.some(t=>t.conflict_fields.length>0)||e.repair.streams.some(t=>t.merge_receipt_proof?.trusted!==!0)||e.validation.checks.some(t=>t.name!=="history_drift"&&t.status!=="ok"))throw c("only fully authenticated receipt-backed repairs without discarded values can be staged")}async function S(e){try{return{...e,path:await b(h(process.cwd(),e.path))}}catch{throw c("the tracker root cannot be resolved")}}async function F(e){let{preview:t}=e;k(t);let{path:a}=await S(e.global),o=await w(a);if(o===null)throw c("a Git workspace is required");let i=r=>R("git",r,{cwd:o,env:u(),timeout:1e4});if(await $(i),(await i(["ls-files","--unmerged","-z"])).stdout.length>0)throw c("Git still has unresolved paths");let s=[...new Set([...[...new Set([...t.repair.streams.map(r=>r.id),...t.receipts.summaries.map(r=>r.item_id)])].map(r=>l.join(a,"history",`${r}.jsonl`)),...t.receipts.summaries.map(r=>l.join(a,"merge-receipts",`${r.receipt_id}.json`))])].map(r=>l.relative(o,r).replaceAll("\\","/"));if(s.some(g))throw c("reconciliation artifacts must belong to this Git workspace");let n=await y(o,s);if(n.length>0)throw new f(`Automatic merge settlement refused: required artifacts are ignored by Git: ${n.map(r=>`${r.path} (${r.source}:${r.line}: ${r.pattern})`).join(", ")}. Remove or narrow the owning ignore rules because merge receipts must travel with the commit.`,d.CONFLICT,{code:"merge_settlement_review_required",reason:"ignored_merge_artifacts",paths:n.map(r=>r.path),nextSteps:["Remove or narrow the named ignore rules, preserve receipt and history files, then retry pm merge reconcile --stage --dry-run before applying pm merge reconcile --stage. Do not force-add ignored proof as a substitute for fixing the shared policy."]});let p=s.map(r=>`:(literal)${r}`),m=t.receipts.summaries.map(r=>l.relative(o,l.join(a,"merge-receipts",`${r.receipt_id}.json`)).replaceAll("\\","/"));if(p.length>0)try{await i(["diff","--quiet","--",...p])}catch{throw c("reconciliation paths have unstaged edits or Git cannot verify their index state")}let v=await I(i,m);return e.dryRun?{...t,staged_paths:[]}:G({...e,git:i,paths:s,newReceiptPathspecs:v})}export{S as resolveMergeSettlementGlobal,F as stageLosslessMergeReconciliation};
2
- //# sourceMappingURL=stage-ON7CYYPM.js.map
1
+ import{a as y}from"./chunk-GK2CHAT3.js";import{i as w}from"./chunk-533L6D2N.js";import"./chunk-IB7UB5TE.js";import{Ma as h}from"./chunk-BFZUJ5QP.js";import{d as g}from"./chunk-D52QQ7LP.js";import{b as u}from"./chunk-VS565KBX.js";import{A as d,C as f}from"./chunk-J3JM36EH.js";import"./chunk-XAWE4EAK.js";import{execFile as _}from"node:child_process";import{realpath as b}from"node:fs/promises";import l from"node:path";import{promisify as x}from"node:util";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="7f4b2fc8-c9c6-51ff-a345-b76b8abdacf4")}catch{}})();var R=x(_);function c(e){return new f(`Automatic merge settlement refused: ${e}`,d.CONFLICT,{code:"merge_settlement_review_required",recovery:{suggested_retry:"pm merge reconcile --dry-run"},nextSteps:["Inspect receipts, repair streams and Git changes. Resolve competing values or unrelated drift explicitly, then run pm merge reconcile and stage the reviewed artifacts manually."]})}async function $(e){let t=process.env.GIT_INDEX_FILE;if(t===void 0)return;let a=(await e(["rev-parse","--path-format=absolute","--git-path","index"])).stdout.trim();if(l.resolve(t)!==l.resolve(a))throw c("an alternate Git index requires explicit manual settlement")}async function I(e,t){if(t.length===0)return[];let a=t.map(s=>`:(literal)${s}`),o=new Set((await e(["ls-files","--cached","-z","--",...a])).stdout.split("\0")),i=t.filter(s=>!o.has(s)).map(s=>`:(literal)${s}`);if(i.length>0&&(await e(["diff","--cached","--name-only","--diff-filter=D","-z","--",...i])).stdout.length>0)throw c("a receipt has a staged deletion that requires explicit review");return i}async function G(e){let{git:t,preview:a,paths:o,newReceiptPathspecs:i}=e,s=!1;try{i.length>0&&(s=!0,await t(["add","--",...i]));let n=await e.apply();if(!n.ok||JSON.stringify(n.receipts.summaries)!==JSON.stringify(a.receipts.summaries)||n.repair.streams.some(p=>!a.repair.streams.some(m=>m.id===p.id)))throw c("reconciliation changed or did not finish; inspect the audit artifacts before staging");return o.length>0&&await t(["add","--",...o.map(p=>`:(literal)${p}`)]),{...n,staged_paths:o,guidance:["Lossless reconciliation artifacts are staged for the merge commit. Review git diff --cached before committing."]}}catch(n){throw s&&await t(["reset","--quiet","--",...i]),n}}function k(e){if(e.repair.totals.failed>0||e.receipts.missing_history_references_after>0||e.receipts.summaries.some(t=>t.conflict_fields.length>0)||e.repair.streams.some(t=>t.merge_receipt_proof?.trusted!==!0)||e.validation.checks.some(t=>t.name!=="history_drift"&&t.status!=="ok"))throw c("only fully authenticated receipt-backed repairs without discarded values can be staged")}async function S(e){try{return{...e,path:await b(h(process.cwd(),e.path))}}catch{throw c("the tracker root cannot be resolved")}}async function F(e){let{preview:t}=e;k(t);let{path:a}=await S(e.global),o=await w(a);if(o===null)throw c("a Git workspace is required");let i=r=>R("git",r,{cwd:o,env:u(),timeout:1e4});if(await $(i),(await i(["ls-files","--unmerged","-z"])).stdout.length>0)throw c("Git still has unresolved paths");let s=[...new Set([...[...new Set([...t.repair.streams.map(r=>r.id),...t.receipts.summaries.map(r=>r.item_id)])].map(r=>l.join(a,"history",`${r}.jsonl`)),...t.receipts.summaries.map(r=>l.join(a,"merge-receipts",`${r.receipt_id}.json`))])].map(r=>l.relative(o,r).replaceAll("\\","/"));if(s.some(g))throw c("reconciliation artifacts must belong to this Git workspace");let n=await y(o,s);if(n.length>0)throw new f(`Automatic merge settlement refused: required artifacts are ignored by Git: ${n.map(r=>`${r.path} (${r.source}:${r.line}: ${r.pattern})`).join(", ")}. Remove or narrow the owning ignore rules because merge receipts must travel with the commit.`,d.CONFLICT,{code:"merge_settlement_review_required",reason:"ignored_merge_artifacts",paths:n.map(r=>r.path),nextSteps:["Remove or narrow the named ignore rules, preserve receipt and history files, then retry pm merge reconcile --stage --dry-run before applying pm merge reconcile --stage. Do not force-add ignored proof as a substitute for fixing the shared policy."]});let p=s.map(r=>`:(literal)${r}`),m=t.receipts.summaries.map(r=>l.relative(o,l.join(a,"merge-receipts",`${r.receipt_id}.json`)).replaceAll("\\","/"));if(p.length>0)try{await i(["diff","--quiet","--",...p])}catch{throw c("reconciliation paths have unstaged edits or Git cannot verify their index state")}let v=await I(i,m);return e.dryRun?{...t,staged_paths:[]}:G({...e,git:i,paths:s,newReceiptPathspecs:v})}export{S as resolveMergeSettlementGlobal,F as stageLosslessMergeReconciliation};
2
+ //# sourceMappingURL=stage-VLI4OBVX.js.map
@@ -1,4 +1,4 @@
1
- import{f as w,i as y,j,k as B,l as U,o as h,p as X,q as W,r as Y}from"./chunk-LVA76N27.js";import{U as H,a as $,b as D}from"./chunk-Z7GIVH6B.js";import{c as u,f as M,g as z,i as q}from"./chunk-6GMYW42K.js";import{Va as F,q as L,t as R}from"./chunk-UQIBGLDR.js";import{a as g,d as K}from"./chunk-VFQAZLKO.js";import{da as k,g as P}from"./chunk-CIQ6YWCW.js";import{a as N,e as O,f as x,g as A,i as C}from"./chunk-JLXGRDTG.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]="3ec1f825-59d1-5ce2-ac76-c628264bd8be")}catch{}})();var Ce=N,Pe=O,$e=C,De=x,Le=A;function G(e,t,n,r){let o=e.flag.slice(2).replace(/[-_]([a-z])/gu,(a,i)=>i.toUpperCase()),s=n.has(o);return{long:t,...r?{short:r}:{},description:e.description??`Standard pm ${e.flag} option.`,...e.required===!0?{required:!0}:{},...e.list===!0?{list:!0}:{},...e.repeatable===!0?{repeatable:!0}:{},value_type:s?"string":"boolean",...s?{value_name:e.value_name??"value"}:{}}}function Q(e,t=[]){let n=new Set(t.flatMap(o=>o.keys)),r=[];for(let o of L(e.map(s=>({...s})))){r.push(G(o,o.flag,n,o.short));for(let s of o.aliases??[])r.push(G(o,s,n))}return r}var Re=Q(R,$),Fe=Q(F,D);(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]="59d16a38-d6df-5695-96e3-28b6e384f76b")}catch{}})();var _=["agile","ops","research"],I={agile:{name:"agile",title:"Agile delivery",summary:"Story/Spike delivery with a review stage, story points, and acceptance ownership.",types:w.agile,statuses:[{id:"review",roles:["active"],aliases:["in-review"],description:"Work is implementation-complete and awaiting peer review."}],fields:[{key:"story_points",type:"number",commands:["create","update","list"],description:"Relative estimation size for a story or spike.",aliases:["points"]},{key:"acceptance_owner",type:"string",commands:["create","update","list"],description:"Stakeholder accountable for accepting the delivered story.",aliases:["acceptor"]}],workflows:[{type:"Story",allowed_transitions:[["open","in_progress"],["in_progress","review"],["review","in_progress"],["review","closed"],["in_progress","blocked"],["blocked","in_progress"]]}],config:[{key:"search_provider",value:"bm25",summary:"Offline BM25 lexical search works without an embedding service."},{key:"search_max_results",value:"20",summary:"Sprint-sized result cap for quick triage."}],templates:[{name:"story",options:{type:"Story",priority:"2",tags:"story",acceptanceCriteria:"Story delivers the stated user outcome with tests and docs updated.",body:`## As a
1
+ import{f as w,i as y,j,k as B,l as U,o as h,p as X,q as W,r as Y}from"./chunk-QNXXOFLQ.js";import{U as H,a as $,b as D}from"./chunk-HMXVTWIV.js";import{c as u,f as M,g as z,i as q}from"./chunk-NJFMG3IK.js";import{Va as F,q as L,t as R}from"./chunk-I4Z2SCV5.js";import{a as g,d as K}from"./chunk-Q23K6WLV.js";import{da as k,g as P}from"./chunk-TGS5RXBY.js";import{a as N,e as O,f as x,g as A,i as C}from"./chunk-QVFE5LIX.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]="3ec1f825-59d1-5ce2-ac76-c628264bd8be")}catch{}})();var Ce=N,Pe=O,$e=C,De=x,Le=A;function G(e,t,n,r){let o=e.flag.slice(2).replace(/[-_]([a-z])/gu,(a,i)=>i.toUpperCase()),s=n.has(o);return{long:t,...r?{short:r}:{},description:e.description??`Standard pm ${e.flag} option.`,...e.required===!0?{required:!0}:{},...e.list===!0?{list:!0}:{},...e.repeatable===!0?{repeatable:!0}:{},value_type:s?"string":"boolean",...s?{value_name:e.value_name??"value"}:{}}}function Q(e,t=[]){let n=new Set(t.flatMap(o=>o.keys)),r=[];for(let o of L(e.map(s=>({...s})))){r.push(G(o,o.flag,n,o.short));for(let s of o.aliases??[])r.push(G(o,s,n))}return r}var Re=Q(R,$),Fe=Q(F,D);(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]="59d16a38-d6df-5695-96e3-28b6e384f76b")}catch{}})();var _=["agile","ops","research"],I={agile:{name:"agile",title:"Agile delivery",summary:"Story/Spike delivery with a review stage, story points, and acceptance ownership.",types:w.agile,statuses:[{id:"review",roles:["active"],aliases:["in-review"],description:"Work is implementation-complete and awaiting peer review."}],fields:[{key:"story_points",type:"number",commands:["create","update","list"],description:"Relative estimation size for a story or spike.",aliases:["points"]},{key:"acceptance_owner",type:"string",commands:["create","update","list"],description:"Stakeholder accountable for accepting the delivered story.",aliases:["acceptor"]}],workflows:[{type:"Story",allowed_transitions:[["open","in_progress"],["in_progress","review"],["review","in_progress"],["review","closed"],["in_progress","blocked"],["blocked","in_progress"]]}],config:[{key:"search_provider",value:"bm25",summary:"Offline BM25 lexical search works without an embedding service."},{key:"search_max_results",value:"20",summary:"Sprint-sized result cap for quick triage."}],templates:[{name:"story",options:{type:"Story",priority:"2",tags:"story",acceptanceCriteria:"Story delivers the stated user outcome with tests and docs updated.",body:`## As a
2
2
 
3
3
  ## I want
4
4
 
@@ -23,4 +23,4 @@ import{f as w,i as y,j,k as B,l as U,o as h,p as X,q as W,r as Y}from"./chunk-LV
23
23
 
24
24
  ## Conclusion
25
25
  `}}],packages:[{spec:"search-advanced",reason:"Semantic retrieval over experiments and findings."},{spec:"templates",reason:"Consistent experiment and hypothesis scaffolds."},{spec:"beads",reason:"Import structured prior work into the tracker."}]}};function ne(e){if(e===void 0)return;let t=p(e);if(t.length===0)throw new Error("Profile name must not be empty.");if(_.includes(t))return t;throw new Error(`Invalid profile "${e}". Allowed: ${_.join(", ")}.`)}function qe(e){let t=ne(e);if(t===void 0)throw new Error(`Profile name is required. Allowed: ${_.join(", ")}.`);return I[t]}function je(){return _.map(e=>I[e])}function p(e){return e.trim().toLowerCase().replaceAll("-","_")}function J(e){return e.map(t=>t.definition.name).join(", ")}function re(e=[]){let t=_.map(s=>({definition:I[s],source:"builtin"})),n=new Set(_.map(s=>p(s))),r=new Set(n),o=[];for(let s of e){let a=p(s.profile.name);if(n.has(a)){o.push(`Extension "${s.name}" profile "${s.profile.name}" uses a name reserved by a built-in archetype and was ignored.`);continue}if(r.has(a)){o.push(`Profile "${s.profile.name}" from extension "${s.name}" duplicates an already-registered profile and was ignored.`);continue}r.add(a),t.push({definition:s.profile,source:"extension",package:s.name})}return{profiles:t,warnings:o}}function Be(e,t=[]){let{profiles:n,warnings:r}=re(t);if(typeof e!="string"||e.trim().length===0)throw new Error(`Profile name is required. Allowed: ${J(n)}.`);let o=p(e),s=n.find(a=>p(a.definition.name)===o);if(s===void 0)throw new Error(`Invalid profile "${e}". Allowed: ${J(n)}.`);return{resolved:s,warnings:r}}(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]="ab26bcb3-fb2a-5f2f-96e7-7965787b924e")}catch{}})();function oe(e){return{types:e.types.length,statuses:e.statuses.length,fields:e.fields.length,workflows:e.workflows.length,config:e.config.length,templates:e.templates.length,packages:e.packages.length}}function Ye(e){return{name:e.name,title:e.title,summary:e.summary,composition:oe(e),types:e.types.map(t=>S(()=>u(t).name,()=>String(t.name??""))),statuses:e.statuses.map(t=>S(()=>h(t).id,()=>String(t.id??""))),fields:e.fields.map(t=>S(()=>y(t).key,()=>String(t.key??""))),workflows:e.workflows.map(t=>t.type),config:e.config.map(t=>`${t.key}=${t.value}`),templates:e.templates.map(t=>t.name),packages:e.packages.map(t=>({spec:t.spec,reason:t.reason}))}}function S(e,t){try{return e()}catch{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]="499ff311-4667-5035-8fb2-4854ee7ecdd7")}catch{}})();var se=[{key:"context_next_ranking_policy",path:"context.next_ranking_policy",kind:"string",choices:["priority_floor","weighted"],summary:"Ready-queue order for pm next with the built-in scorer: priority_floor (resume in-progress work, then priority tiers, relevance within a tier) or weighted (blended relevance order). An extension context_relevance scorer keeps its own order."},{key:"search_provider",path:"search.provider",kind:"string",summary:"Search embedding provider name (e.g. openai, ollama, or an extension provider)."},{key:"search_default_mode",path:"search.default_mode",kind:"string",choices:["auto","keyword","semantic","hybrid"],summary:"Mode a bare pm search runs in: auto (hybrid when semantic search is explicitly configured and runnable, else keyword), or a pinned keyword, semantic, or hybrid."},{key:"search_mutation_refresh_policy",path:"search.mutation_refresh_policy",kind:"string",choices:["cache_only","semantic_configured","semantic_auto"],summary:"Mutation-time search refresh policy: cache_only, semantic_configured, or semantic_auto."},{key:"search_query_expansion_enabled",path:"search.query_expansion.enabled",kind:"boolean",summary:"Enable or disable query expansion for semantic/hybrid search."},{key:"search_query_expansion_provider",path:"search.query_expansion.provider",kind:"string",summary:"Query expansion provider name (built-in openai/ollama or extension provider)."},{key:"search_rerank_enabled",path:"search.rerank.enabled",kind:"boolean",summary:"Enable or disable post-retrieval reranking for hybrid search."},{key:"search_rerank_model",path:"search.rerank.model",kind:"string",summary:"Rerank model name override used by built-in providers."},{key:"search_rerank_top_k",path:"search.rerank.top_k",kind:"integer",min:1,summary:"Number of top hybrid candidates to rerank when rerank is enabled."},{key:"search_embedding_model",path:"search.embedding_model",kind:"string",summary:"Default embedding model name (overrides provider-specific model when set)."},{key:"search_embedding_corpus_max_characters",path:"search.embedding_corpus_max_characters",kind:"integer",min:1,summary:"Maximum semantic corpus characters per item before truncation."},{key:"search_embedding_batch_size",path:"search.embedding_batch_size",kind:"integer",min:1,summary:"Number of items embedded per request batch."},{key:"search_embedding_timeout_ms",path:"search.embedding_timeout_ms",kind:"integer",min:1,summary:"Per-request embedding timeout in milliseconds."},{key:"search_score_threshold",path:"search.score_threshold",kind:"number",summary:"Minimum score for a hit to be returned (0 keeps all matches)."},{key:"search_hybrid_semantic_weight",path:"search.hybrid_semantic_weight",kind:"ratio",summary:"Hybrid mode semantic weight in [0, 1] (1-weight goes to keyword)."},{key:"search_max_results",path:"search.max_results",kind:"integer",min:1,summary:"Default upper bound on search hits when --limit is not supplied."},{key:"search_bm25_k1",path:"search.bm25.k1",kind:"number",min:0,summary:"Offline BM25 term-frequency saturation (k1); higher saturates repeated terms slower (default 1.2)."},{key:"search_bm25_b",path:"search.bm25.b",kind:"ratio",summary:"Offline BM25 document-length normalization (b) in [0, 1]; 0 disables, 1 fully normalizes (default 0.75)."},{key:"openai_base_url",path:"providers.openai.base_url",kind:"string",summary:"OpenAI-compatible API base URL (LM Studio/vLLM also use this)."},{key:"openai_api_key",path:"providers.openai.api_key",kind:"string",summary:"OpenAI-compatible API key."},{key:"openai_model",path:"providers.openai.model",kind:"string",summary:"OpenAI-compatible embedding model name."},{key:"ollama_base_url",path:"providers.ollama.base_url",kind:"string",summary:"Ollama API base URL (typically http://localhost:11434)."},{key:"ollama_model",path:"providers.ollama.model",kind:"string",summary:"Ollama embedding model name (e.g. nomic-embed-text)."},{key:"vector_store_adapter",path:"vector_store.adapter",kind:"string",summary:"Vector store adapter name (lancedb, qdrant, or an extension adapter)."},{key:"vector_store_collection_name",path:"vector_store.collection_name",kind:"string",non_empty:!0,summary:"Vector collection/table name shared by Qdrant and LanceDB adapters."},{key:"qdrant_url",path:"vector_store.qdrant.url",kind:"string",summary:"Qdrant HTTP API URL."},{key:"qdrant_api_key",path:"vector_store.qdrant.api_key",kind:"string",summary:"Qdrant API key (empty if running unauthenticated)."},{key:"lancedb_path",path:"vector_store.lancedb.path",kind:"string",summary:"LanceDB storage path (relative to pm root or absolute)."},{key:"id_prefix",path:"id_prefix",kind:"string",non_empty:!0,summary:'Prefix for generated item IDs (e.g. "pm" produces pm-xxxx).'},{key:"author_default",path:"author_default",kind:"string",non_empty:!0,summary:"Default author recorded on mutations when --author is not supplied."},{key:"agent_identity_probes_enabled",path:"agent_identity.probes_enabled",kind:"boolean",summary:"Allow privacy-bounded local harness provenance probes; no network or subprocess access is permitted."},{key:"mutation_guard_require_attributed_author",path:"mutation_guard.require_attributed_author",kind:"boolean",summary:"Reject mutations whose effective author resolves to unknown."},{key:"mutation_guard_secret_guard",path:"mutation_guard.secret_guard",kind:"string",choices:["off","advise","block"],summary:"Detect credential-shaped mutation content: off, advise, or block."},{key:"mutation_guard_stale_in_progress_hours",path:"mutation_guard.stale_in_progress_hours",kind:"integer",min:1,summary:"Age threshold for unclaimed in-progress work surfaced by health."},{key:"governance_duplicate_detection_mode",path:"governance.duplicate_detection_mode",kind:"string",choices:["off","advisory","strict"],summary:"Create/copy duplicate governance: off, advisory, or strict explicit-bypass enforcement."},{key:"governance_duplicate_detection_threshold",path:"governance.duplicate_detection_threshold",kind:"ratio",summary:"Minimum shared similarity score in [0, 1] for create/copy duplicate governance."},{key:"governance_duplicate_detection_limit",path:"governance.duplicate_detection_limit",kind:"integer",min:0,max:20,summary:"Maximum likely duplicates returned by create/copy governance (0-20)."},{key:"output_default_format",path:"output.default_format",kind:"string",choices:["toon","json"],summary:"Default output format for commands that support it: toon or json."},{key:"ux_deprecation_hints",path:"ux.deprecation_hints",kind:"boolean",summary:"Emit one stderr migration hint for deprecated command aliases."},{key:"locks_ttl_seconds",path:"locks.ttl_seconds",kind:"integer",min:1,summary:"Claim/lock time-to-live in seconds before a stale lock can be reclaimed."},{key:"locks_wait_ms",path:"locks.wait_ms",kind:"integer",min:0,summary:"Wait budget in milliseconds before a contended lock fails with lock_conflict; item-store mutations, restore and the hierarchy lock treat it as a no-progress window that each observed owner handoff restarts (120 s total cap), other locks as a fixed total; 0 fails fast. PM_LOCK_WAIT_MS overrides per invocation."},{key:"ids_token_length",path:"ids.token_length",kind:"integer",min:4,max:12,summary:"Random base36 token length for newly minted item ids (4-12, default 4). Raise it to shrink cross-branch id collision odds in concurrent multi-agent workflows (pm-pibw)."},{key:"checkpoints_retention_days",path:"checkpoints.retention_days",kind:"integer",min:1,summary:"Age in days above which pm gc --scope checkpoints prunes bulk-mutation rollback checkpoints."},{key:"schema_unknown_field_policy",path:"schema.unknown_field_policy",kind:"string",choices:["allow","warn","reject"],summary:"How item I/O handles metadata keys not in the field registry: allow, warn, or reject."},{key:"history_compact_policy_enabled",path:"history.compact_policy.enabled",kind:"boolean",summary:"Enable the history-compaction advisory: pm health warns on over-threshold streams."},{key:"history_compact_policy_max_entries",path:"history.compact_policy.max_entries",kind:"integer",min:1,summary:"Entry count above which a history stream is flagged (and the default pm history-compact --all-over threshold)."},{key:"history_compact_policy_trigger",path:"history.compact_policy.trigger",kind:"string",choices:["health_warn","auto"],summary:"History-compaction policy intent: health_warn (advisory only) or auto (scheduled sweeps expected)."}],ae=new Map(se.flatMap(e=>[[e.key,e],[e.path.toLowerCase().replaceAll("-","_"),e]]));function b(e){if(typeof e!="string")return;let t=e.trim().toLowerCase().replaceAll("-","_");if(t.length!==0)return ae.get(t)}function ie(e,t){let n=t.trim().toLowerCase();return n==="true"||n==="1"||n==="yes"||n==="on"?{ok:!0,parsed:{descriptor:e,value:!0}}:n==="false"||n==="0"||n==="no"||n==="off"?{ok:!0,parsed:{descriptor:e,value:!1}}:{ok:!1,error:{message:`Config set ${e.key} requires a boolean value (true|false), got "${t}"`}}}function le(e,t,n){return e.non_empty===!0&&n.length===0?{ok:!1,error:{message:`Config set ${e.key} requires a non-empty value`}}:e.choices&&!e.choices.includes(n)?{ok:!1,error:{message:`Config set ${e.key} must be one of ${e.choices.join("|")}, got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function de(e,t,n){if(n.length===0)return{ok:!1,error:{message:`Config set ${e.key} requires a non-empty value`}};let r=Number(n);return Number.isFinite(r)?{ok:!0,value:r}:{ok:!1,error:{message:`Config set ${e.key} requires a finite number, got "${t}"`}}}function ce(e,t,n){return!Number.isInteger(n)||n<0?{ok:!1,error:{message:`Config set ${e.key} requires a non-negative integer, got "${t}"`}}:e.min!==void 0&&n<e.min?{ok:!1,error:{message:`Config set ${e.key} requires an integer >= ${e.min}, got "${t}" (the runtime silently ignores 0 here and falls back to the default)`}}:e.max!==void 0&&n>e.max?{ok:!1,error:{message:`Config set ${e.key} requires an integer <= ${e.max}, got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function me(e,t,n){return n<0||n>1?{ok:!1,error:{message:`Config set ${e.key} requires a number in [0, 1], got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function pe(e,t,n){return e.min!==void 0&&n<e.min?{ok:!1,error:{message:`Config set ${e.key} requires a number >= ${e.min}, got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function v(e,t){if(typeof t!="string")return{ok:!1,error:{message:`Config set ${e.key} requires a string value`}};let n=t.trim();if(e.kind==="boolean")return ie(e,t);if(e.kind==="string")return le(e,t,n);let r=de(e,t,n);return r.ok?e.kind==="integer"?ce(e,t,r.value):e.kind==="ratio"?me(e,t,r.value):pe(e,t,r.value):{ok:!1,error:r.error}}function V(e,t){let n=t.path.split("."),r=e;for(let o of n){if(typeof r!="object"||r===null)return null;let s=Object.getOwnPropertyDescriptor(r,o);if(!s||!Object.hasOwn(s,"value"))return null;r=s.value}return typeof r=="string"||typeof r=="number"||typeof r=="boolean"?r:null}function Ge(e,t,n){let r=t.path.split(".");if(r.some(a=>a.length===0||["__proto__","constructor","prototype"].includes(a)))throw new Error("Unsafe settings path");let o=e;for(let a=0;a<r.length-1;a+=1){let i=r[a],d=Object.getOwnPropertyDescriptor(o,i)?.value;if(typeof d!="object"||d===null||Array.isArray(d)){let c={};Object.defineProperty(o,i,{value:c,writable:!0,enumerable:!0,configurable:!0}),o=c}else o=d}let s=r[r.length-1];return Object.getOwnPropertyDescriptor(o,s)?.value===n?!1:(Object.defineProperty(o,s,{value:n,writable:!0,enumerable:!0,configurable:!0}),!0)}(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]="0b04624c-2096-55dc-9dde-b8c76ead72d6")}catch{}})();var it=["profile","types","statuses","fields","workflows","config","templates","packages"],lt=["profile_name_empty","profile_name_not_normalized","profile_title_empty","profile_summary_empty","type_invalid","type_duplicate","status_invalid","status_duplicate","field_invalid","field_duplicate","field_mcp_input_collision","workflow_type_empty","workflow_type_unknown","workflow_duplicate_type","workflow_transition_malformed","workflow_status_unknown","config_key_unknown","config_value_invalid","config_duplicate","template_type_unknown","package_spec_empty"],ue=new Set(K.flatMap(e=>[g(e.id),...(e.aliases??[]).map(t=>g(t))]).filter(e=>e.length>0)),Z=new Set(P.map(e=>e.toLowerCase()));function ye(e,t){e.name.trim().length===0?t.push({severity:"error",code:"profile_name_empty",dimension:"profile",message:"Profile name must not be empty; profile resolution requires a non-blank name."}):e.name!==p(e.name)&&t.push({severity:"warning",code:"profile_name_not_normalized",dimension:"profile",target:e.name,message:`Profile name "${e.name}" is not in canonical form; resolution folds it to "${p(e.name)}" (lowercase, hyphens as underscores).`}),e.title.trim().length===0&&t.push({severity:"warning",code:"profile_title_empty",dimension:"profile",message:"Profile title is empty; list and show surfaces will render a blank title."}),e.summary.trim().length===0&&t.push({severity:"warning",code:"profile_summary_empty",dimension:"profile",message:"Profile summary is empty; list and show surfaces will render a blank archetype description."})}function he(e,t){let n=new Set,r=new Set;for(let[o,s]of e.types.entries()){let a;try{a=u(s).name}catch(d){t.push({severity:"error",code:"type_invalid",dimension:"types",target:typeof s.name=="string"?s.name:`#${o}`,message:k(d)});continue}let i=a.toLowerCase();if(r.has(i)){t.push({severity:"error",code:"type_duplicate",dimension:"types",target:a,message:`Item type "${a}" is declared more than once; the later definition silently overwrites the earlier upsert.`});continue}r.add(i),n.add(i)}return n}function fe(e,t){let n=new Set,r=new Set;for(let[o,s]of e.statuses.entries()){let a;try{a=h(s)}catch(i){t.push({severity:"error",code:"status_invalid",dimension:"statuses",target:typeof s.id=="string"?s.id:`#${o}`,message:k(i)});continue}if(r.has(a.id)){t.push({severity:"error",code:"status_duplicate",dimension:"statuses",target:a.id,message:`Status "${a.id}" is declared more than once; the later definition silently overwrites the earlier upsert.`});continue}r.add(a.id),n.add(a.id);for(let i of a.aliases??[])n.add(g(i))}return n}function ge(e,t){let n=new Set;for(let[r,o]of e.fields.entries()){let s;try{s=y(o).key}catch(i){t.push({severity:"error",code:"field_invalid",dimension:"fields",target:typeof o.key=="string"?o.key:`#${r}`,message:k(i)});continue}if(n.has(s)){t.push({severity:"error",code:"field_duplicate",dimension:"fields",target:s,message:`Field "${s}" is declared more than once; the later definition silently overwrites the earlier upsert.`});continue}n.add(s);let a=H(s);a&&t.push({severity:"warning",code:"field_mcp_input_collision",dimension:"fields",target:s,message:`Field "${s}" collides with canonical MCP property "${a.property}" owned by ${a.owner}; callers must pass the custom value through ${a.nested_path}.`})}}function _e(e,t,n,r){let o=new Set;for(let[s,a]of e.workflows.entries()){let i=a.type.trim().toLowerCase();if(i.length===0){r.push({severity:"error",code:"workflow_type_empty",dimension:"workflows",target:`#${s}`,message:"Workflow has an empty type; the workflow resolver drops entries without a type."});continue}let d=o.has(i);o.add(i),d?r.push({severity:"warning",code:"workflow_duplicate_type",dimension:"workflows",target:a.type,message:`Workflow type "${a.type}" is declared more than once; the later transition set wins.`}):!Z.has(i)&&!t.has(i)&&r.push({severity:"warning",code:"workflow_type_unknown",dimension:"workflows",target:a.type,message:`Workflow governs type "${a.type}" which is neither a built-in type nor declared by this profile; it has no effect unless that type already exists.`});let c=new Set;for(let l of a.allowed_transitions){let m=g(l[0]),T=g(l[1]);if(m.length===0||T.length===0){r.push({severity:"error",code:"workflow_transition_malformed",dimension:"workflows",target:a.type,message:`Workflow "${a.type}" has a transition with an empty status; the workflow resolver silently drops it.`});continue}for(let f of[m,T])ue.has(f)||n.has(f)||c.has(f)||(c.add(f),r.push({severity:"warning",code:"workflow_status_unknown",dimension:"workflows",target:f,message:`Workflow "${a.type}" references status "${f}" which is neither a built-in status nor declared by this profile; transitions to or from it are unreachable.`}))}}}function ke(e,t){let n=new Set;for(let r of e.config){let o=b(r.key);if(o===void 0){t.push({severity:"error",code:"config_key_unknown",dimension:"config",target:r.key,message:`Config knob "${r.key}" is not a recognized setting; apply rejects it with a usage error.`});continue}n.has(o.key)?t.push({severity:"error",code:"config_duplicate",dimension:"config",target:o.key,message:`Config knob "${o.key}" is set more than once; the later value silently overwrites the earlier one.`}):n.add(o.key);let s=v(o,r.value);s.ok||t.push({severity:"error",code:"config_value_invalid",dimension:"config",target:r.key,message:s.error.message})}}function we(e,t,n){for(let r of e.templates){let o=r.options.type;if(typeof o!="string"||o.trim().length===0)continue;let s=o.trim().toLowerCase();!Z.has(s)&&!t.has(s)&&n.push({severity:"warning",code:"template_type_unknown",dimension:"templates",target:r.name,message:`Template "${r.name}" creates type "${o}" which is neither a built-in type nor declared by this profile.`})}}function be(e,t){for(let[n,r]of e.packages.entries())r.spec.trim().length===0&&t.push({severity:"warning",code:"package_spec_empty",dimension:"packages",target:`#${n}`,message:"Package recommendation has an empty spec; it cannot be surfaced as an install hint."})}function dt(e){let t=[];ye(e,t);let n=he(e,t),r=fe(e,t);ge(e,t),_e(e,n,r,t),ke(e,t),we(e,n,t),be(e,t);let o=t.filter(a=>a.severity==="error").length,s=t.length-o;return{profile:e.name,ok:o===0,findings:t,errorCount:o,warningCount:s}}(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]="be2b507d-2797-570c-b211-46d950edcbde")}catch{}})();function E(e,t,n,r,o){let s=e,a=[];for(let i of t){let d=r(s),c=o(s,i),l=r(c.file);s=c.file;let m=d===l?"unchanged":c.replaced?"update":"add";a.push({key:n(i),status:m})}return{file:s,changes:a,changed:a.some(i=>i.status!=="unchanged")}}function ee(e){return JSON.stringify(e.map(t=>t.join("\0")).sort())}function ve(e,t){let n=e.map(o=>({...o})),r=[];for(let o of t){let s=n.findIndex(i=>i.type===o.type),a={type:o.type,allowed_transitions:o.allowed_transitions};s<0?(n.push(a),r.push({type:o.type,status:"add"})):ee(n[s].allowed_transitions)===ee(o.allowed_transitions)?r.push({type:o.type,status:"unchanged"}):(n[s]=a,r.push({type:o.type,status:"update"}))}return{changes:r,result:n,changed:r.some(o=>o.status!=="unchanged")}}function Ie(e,t){let n=[];for(let r of e.config){let o=b(r.key);if(o===void 0)throw new Error(`Profile "${e.name}" references unknown config key "${r.key}".`);let s=v(o,r.value);if(!s.ok)throw new Error(`Profile "${e.name}" config ${r.key}: ${s.error.message}`);let a=V(t,o),i=a===null?"add":a===s.parsed.value?"unchanged":"update";n.push({key:o.key,path:o.path,value:s.parsed.value,status:i})}return{changes:n,changed:n.some(r=>r.status!=="unchanged")}}function te(e){let t=Object.entries(e).sort(([n],[r])=>n.localeCompare(r));return JSON.stringify(t)}function Se(e,t){let n=[];for(let r of e.templates){let o=t.get(r.name),s;o===void 0?s="add":te(o)===te(r.options)?s="unchanged":s="update",n.push({name:r.name,options:r.options,status:s})}return{changes:n,changed:n.some(r=>r.status!=="unchanged")}}function ht(e,t){let n=E(M(t.typesRaw),e.types,l=>u(l).name,q,(l,m)=>z(l,u(m))),r=E(X(t.statusesRaw),e.statuses,l=>h(l).id,W,(l,m)=>Y(l,h(m))),o=E(j(t.fieldsRaw),e.fields,l=>y(l).key,B,(l,m)=>U(l,y(m))),s=ve(t.workflows,e.workflows),a=Ie(e,t.settings),i=Se(e,t.templates),d=e.packages.map(l=>({spec:l.spec,reason:l.reason,status:t.installedPackages.has(l.spec)?"installed":"recommended"})),c=n.changed||r.changed||o.changed||s.changed||a.changed||i.changed;return{profile:{name:e.name,title:e.title,summary:e.summary},types:n,statuses:r,fields:o,workflows:s,config:a,templates:i,packages:d,changed:c}}export{Ce as a,Pe as b,$e as c,De as d,Le as e,Q as f,Re as g,Fe as h,_ as i,I as j,ne as k,qe as l,je as m,re as n,Be as o,oe as p,Ye as q,se as r,b as s,v as t,V as u,Ge as v,it as w,lt as x,dt as y,ht as z};
26
- //# sourceMappingURL=chunk-5TWS5KOM.js.map
26
+ //# sourceMappingURL=chunk-3UD6F2KQ.js.map