@unbrained/pm-cli 2026.10.24 → 2026.10.25
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.
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +20 -0
- package/dist/cli/error-guidance.js +2 -2
- package/dist/cli/extension-command-help.js +2 -2
- package/dist/cli/register-history-activity.js +1 -1
- package/dist/cli-bundle/bundle-manifest.json +1 -1
- package/dist/cli-bundle/chunks/{chunk-R7KWBFM2.js → chunk-3CYXE6BV.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-444VPGQT.js +20 -0
- package/dist/cli-bundle/chunks/{chunk-YEI4N4A6.js → chunk-4GD6QOP6.js} +21 -21
- package/dist/cli-bundle/chunks/{chunk-HZNFNETE.js → chunk-5ZPT67NJ.js} +6 -6
- package/dist/cli-bundle/chunks/{chunk-KGZGXC7T.js → chunk-7C3GCLOO.js} +29 -29
- package/dist/cli-bundle/chunks/{chunk-3VI4XDP2.js → chunk-7T3H24HN.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-MA7SNKYK.js → chunk-EYCVAAIP.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-CDR5ES7Q.js → chunk-FNZT4BTE.js} +38 -34
- package/dist/cli-bundle/chunks/{chunk-CNEUJHA4.js → chunk-HMJSFWHK.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-ZDVTXLA6.js → chunk-LNKPH2DD.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-Z62RXNHW.js → chunk-MVJGGCGQ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-3S5FLCG7.js → chunk-O3ZTGRIH.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-FASDGYQC.js → chunk-RD6UW3MW.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-UY5UHI4I.js → chunk-RLXK2S7P.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-URZB3USE.js → chunk-RQKDANP7.js} +42 -42
- package/dist/cli-bundle/chunks/chunk-TLMXSYJA.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-4PNAUT2E.js → chunk-UI3FD3DW.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-VSSHB6XI.js → chunk-VAEB6IUQ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-TZYQ4JDZ.js → chunk-XYLBOXSH.js} +6 -6
- package/dist/cli-bundle/chunks/{chunk-CSE47ZAN.js → chunk-YCCGZHOR.js} +2 -2
- package/dist/cli-bundle/chunks/{indexed-receipt-blobs-XANVELIV.js → indexed-receipt-blobs-47I6KKDO.js} +2 -2
- package/dist/cli-bundle/chunks/{mutation-admission-NVTBZ7DH.js → mutation-admission-747C6IUR.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-2FE6K7FQ.js → register-list-query-COST6KRV.js} +3 -3
- package/dist/cli-bundle/chunks/{register-mutation-KZXQUZUH.js → register-mutation-JZVVJUHY.js} +2 -2
- package/dist/cli-bundle/chunks/register-operations-S4LKLUBJ.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-P3VLCTDY.js → register-setup-3ITZXPOL.js} +2 -2
- package/dist/cli-bundle/chunks/{settlement-hook-YUVCO65H.js → settlement-hook-5IVCF6ZY.js} +2 -2
- package/dist/cli-bundle/chunks/stage-3UUIYROS.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-JYXA4JIP.js → chunk-22727JYL.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-RVUGTIIU.js → chunk-3FM75SBJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-RSEGFZTY.js → chunk-3M5FZCMC.js} +54 -54
- package/dist/cli-bundle/focused-chunks/{chunk-BUZ2Z4P3.js → chunk-46KDJH3K.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-5LBZR6YW.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-SHUPX6G2.js → chunk-74KC7FUQ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-77NU7NPN.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-NX7TVNUM.js → chunk-7DEZT4JN.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ES2NGVHZ.js → chunk-B5JOVH5F.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-HMYDUEQK.js +8 -0
- package/dist/cli-bundle/focused-chunks/chunk-IVLIUPVV.js +12 -0
- package/dist/cli-bundle/focused-chunks/{chunk-X5YRJMAY.js → chunk-KIIGME23.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-IUAYTD2S.js → chunk-LWJ2X75I.js} +24 -24
- package/dist/cli-bundle/focused-chunks/{chunk-SBJ2IKTH.js → chunk-MT5TYMEU.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-7RQOFHMH.js → chunk-NC5HUGHU.js} +3 -3
- package/dist/cli-bundle/focused-chunks/chunk-NI5SG2M2.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-ZMWLV2CE.js → chunk-QH5KMIYZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-POLMFGPQ.js → chunk-U6HXIF6G.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-6HJCSHBG.js → chunk-URWYYJ7K.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-5MKNVJCM.js → chunk-W7MCCFYV.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-AGCEWJ27.js → chunk-WMPDY5ZU.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-R536272H.js → chunk-Y4JHHY24.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-TAHSXKAT.js → chunk-ZYCOMRFT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{indexed-receipt-blobs-FVOA3XMI.js → indexed-receipt-blobs-YCLN2ZZG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{mutation-admission-PB6YFY7S.js → mutation-admission-BQBQXILV.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{settlement-hook-2VXEB6PP.js → settlement-hook-XVS6P2XI.js} +2 -2
- package/dist/cli-bundle/focused-chunks/stage-VSIL4MTZ.js +2 -0
- package/dist/cli-bundle/main.js +19 -19
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +2 -2
- package/dist/cli-bundle/sdk-core.js +15 -15
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +55 -56
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +3 -3
- package/dist/core/diagnostics/remediation.js +1 -1
- package/dist/core/shared/errors.d.ts +13 -0
- package/dist/core/shared/errors.js +1 -1
- package/dist/core/store/settings.js +2 -2
- package/dist/sdk/agent/command-recovery.js +1 -1
- package/dist/sdk/cli-contracts/commander-types.js +1 -1
- package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
- package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -1
- package/dist/sdk/cli-contracts/grammar-contracts.js +1 -1
- package/dist/sdk/cli-contracts/registration-helpers.d.ts +2 -0
- package/dist/sdk/cli-contracts/registration-helpers.js +2 -2
- package/dist/sdk/cli-contracts/runtime-contracts.js +1 -1
- package/dist/sdk/cli-contracts/tool-option-contracts.js +1 -1
- package/dist/sdk/completion/fish.js +3 -1
- package/dist/sdk/completion/zsh.js +3 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
- package/dist/sdk/governance/health-merge-evidence.d.ts +5 -0
- package/dist/sdk/governance/health-merge-evidence.js +1 -1
- package/dist/sdk/governance/health.js +1 -1
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/merge/history-scalar-rebase.d.ts +9 -0
- package/dist/sdk/merge/history-scalar-rebase.js +2 -0
- package/dist/sdk/merge/ignored-artifacts.d.ts +13 -0
- package/dist/sdk/merge/ignored-artifacts.js +2 -0
- package/dist/sdk/merge/stage.js +1 -1
- package/dist/sdk/merge/three-way.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query/activity.d.ts +14 -2
- package/dist/sdk/query/activity.js +1 -1
- package/dist/sdk/query/calendar.d.ts +16 -0
- package/dist/sdk/query/calendar.js +3 -3
- package/dist/sdk/query/context.js +2 -2
- package/dist/sdk/query/get.js +1 -1
- package/dist/sdk/query/list.js +1 -1
- package/dist/sdk/query/search-contracts.js +1 -1
- package/dist/sdk/query/window-pagination.d.ts +20 -0
- package/dist/sdk/query/window-pagination.js +2 -0
- package/dist/sdk/read-output-contracts.js +1 -1
- package/dist/sdk/runtime.d.ts +1 -1
- package/dist/sdk/runtime.js +1 -1
- package/dist/sdk/schema-migration.js +2 -2
- package/dist/sdk/templates.d.ts +7 -1
- package/dist/sdk/templates.js +2 -2
- package/docs/COMMANDS.md +19 -1
- package/docs/EXTENSIONS.md +1 -1
- package/docs/MERGE_SAFETY.md +28 -0
- package/docs/SDK.md +85 -6
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +2 -2
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +5 -3
- package/marketplace.json +1 -1
- package/package.json +1 -1
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/extensions/calendar/index.ts +6 -0
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/extensions/templates/runtime.ts +3 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/package.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +1 -1
- package/plugins/pm-codex/plugin.json +1 -1
- package/runtime-dependencies.json +1 -1
- package/dist/cli-bundle/chunks/chunk-VPMQEVU6.js +0 -20
- package/dist/cli-bundle/chunks/register-operations-BOCBWNKJ.js +0 -2
- package/dist/cli-bundle/chunks/stage-WRDTMCCF.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-3QYTS4OY.js +0 -12
- package/dist/cli-bundle/focused-chunks/chunk-CEEOWDB7.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-GXAXDPD4.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-NFFPNMTH.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-XTYEASIY.js +0 -2
- package/dist/cli-bundle/focused-chunks/stage-MQE4PFWT.js +0 -2
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{b as K}from"./chunk-R536272H.js";import{Wa as H,_a as P,aa as W,ab as L,db as V}from"./chunk-IUAYTD2S.js";import{Kd as $,Z as G,qa as B,wa as E,wd as U}from"./chunk-7RQOFHMH.js";import{a as X,b as v,c as q}from"./chunk-FOA7XKWP.js";import{B as S,D as j,E as N,H as F,y as b,z as k}from"./chunk-BUZ2Z4P3.js";import{access as le,readFile as A,realpath as w}from"node:fs/promises";import{constants as me}from"node:fs";import{execFile as ue}from"node:child_process";import c from"node:path";import{promisify as de}from"node:util";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="6d1f8e03-97b4-5d83-b85c-e47f39c07d48")}catch{}})();var se="PM_SOURCE_CONTEXT_ACCESS",ce="PM_ALLOW_SOURCE_CONTEXT_WRITES";function J(e){let r=e[se],i=r===void 0||r.trim().toLowerCase()==="write"?"write":"read_only",t=i==="read_only"&&e[ce]?.trim()==="1";return{access:i,write_override_applied:t,source_writes_allowed:i==="write"||t}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="b1828465-0619-514c-8956-2a81dea9efbc")}catch{}})();var _=de(ue),T="# pm-cli:merge-drivers:start",pe="# pm-cli:merge-drivers:end",x="# pm-cli:merge-drivers:v2:start",Q="# pm-cli:merge-drivers:v2:end",fe="merge-fence",ge="merge-attributes";function R(e){return`'${e.replaceAll("'",`'"'"'`)}'`}async function he(e,r){let i=await w(e);if(/(?:^|[\\/])bun-node-[^\\/]+[\\/]bun(?:\.exe)?$/iu.test(i))return;let{stdout:t}=await _(e,["--version"],{encoding:"utf8",windowsHide:!0,timeout:1e4});return t.trim()===r?i:void 0}async function we(){let e=G(import.meta.url,["../../.."]),r=process.execPath,i=!1,t=await w(process.execPath),o=process.versions.bun,a=(process.env.PATH??"").split(c.delimiter).filter(n=>c.isAbsolute(n)).map(n=>c.join(n,o===void 0?c.basename(process.execPath):process.platform==="win32"?"bun.exe":"bun")),s=o===void 0?a:[process.env.npm_execpath??"",...a,t].filter(n=>c.isAbsolute(n)&&/^(?:bun|bun\.exe)$/iu.test(c.basename(n)));for(let n of s)try{if(await le(n,me.X_OK),o!==void 0){let p=await he(n,o);if(p!==void 0){r=p,i=!0;break}continue}if(n!==t&&await w(n)===t){r=n;break}}catch{}if(o!==void 0&&!i)throw new k("Cannot install Bun merge drivers without a durable executable matching the current Bun version.",b.DEPENDENCY_FAILED,{code:"merge_bun_launcher_unavailable",why:"The current Bun process may be a temporary bunx launcher that Git cannot reuse after this command exits.",nextSteps:["Run with a durable version-matched Bun executable, expose one on an absolute PATH entry, or invoke pm through a Bun runner that publishes an absolute npm_execpath.","Retry pm merge install, then check pm health --strict-exit before merging branches."]});return`${R(r)} ${R(c.join(e,"dist","cli.js"))}`}var Z=[{key:"pm-item-toon",name:"pm field-aware TOON item document merge",artifact:"item",itemPath:"%P"},{key:"pm-item-markdown",name:"pm field-aware JSON-markdown item document merge",artifact:"item",itemPath:"%P"},{key:"pm-history",name:"pm append-only history stream merge",artifact:"history",itemPath:void 0},{key:"pm-relationship",name:"pm append-only relationship event store merge",artifact:"relationship",itemPath:void 0},{key:"pm-json",name:"pm key-level JSON config merge",artifact:"json",itemPath:void 0}];function ye(e){let r=e.explicitPath?.trim(),i=e.environment.PM_SOURCE_WORKSPACE_ROOT?.trim(),t=e.environment.PM_SOURCE_PM_PATH?.trim(),o=J(e.environment),a=!!(i&&t),s=r===void 0&&a&&(e.dryRun||o.source_writes_allowed);if(r!==void 0){let n=E(e.cwd,r);return{pm_root:n,workspace_start:n,source_coordinates_available:a,source_context_selected:!1,source_policy:o}}return s?{pm_root:c.resolve(t),workspace_start:c.resolve(i),source_coordinates_available:!0,source_context_selected:!0,source_policy:o}:{pm_root:a?E(e.cwd,".agents/pm"):E(e.cwd),workspace_start:e.cwd,source_coordinates_available:a,source_context_selected:!1,source_policy:o}}async function ee(e){try{let{stdout:r}=await _("git",["rev-parse","--show-toplevel"],{cwd:e,env:v(),encoding:"utf8",windowsHide:!0,timeout:1e4});return await w(r.trim())}catch{return null}}async function te(e){let r=await ee(e);if(r===null)throw new k("pm merge install requires a git repository (merge drivers are git configuration).",b.USAGE);return r}function O(e,r){return c.relative(e,r).split(c.sep).join("/")}function z(e){return e.replace(/[\\*?[\]!]/gu,"\\$&")}function h(e){return`"${e.replaceAll("\\","\\\\").replaceAll('"','\\"')}"`}function Y(e,r){if(e[r]!=="'")return null;let i="";for(let t=r+1;t<e.length;t+=1){if(e.startsWith(`'"'"'`,t)){i+="'",t+=4;continue}if(e[t]==="'")return{value:i,nextOffset:t+1};i+=e[t]}return null}async function ve(e,r,i){if(L(r).filter(o=>o.constraint==="exact").some(o=>o.version!==i))return!1;let t=await ee(e);if(t!==null&&t!==await w(r)){let o=await Promise.all([t,r].map(async a=>{let s=await _("git",["rev-parse","--path-format=absolute","--git-common-dir"],{cwd:a,env:v(),timeout:1e4});return w(s.stdout.trim())}));if(o[0]===o[1])return!1}return!0}async function _e(e,r,i){let t=Y(e,0);if(t===null||e[t.nextOffset]!==" ")return!1;let o=Y(e,t.nextOffset+1);if(o===null||e.slice(o.nextOffset)!==r||!/^(?:node|bun)(?:\.exe)?$/iu.test(c.basename(t.value))||c.basename(o.value)!=="cli.js"||c.basename(c.dirname(o.value))!=="dist"||!await S(t.value)||!await S(o.value))return!1;try{let a=c.dirname(c.dirname(o.value)),s=JSON.parse(await A(c.join(a,"package.json"),"utf8")),n=typeof s.bin=="string"?s.bin:s.bin?.pm;return await ve(a,i,s.version)?s.name==="@unbrained/pm-cli"&&n==="dist/cli.js":!1}catch{return!1}}function M(e,r){let i=e.length>0?`${z(e)}/`:"",t=[`${h(`${i}**/*.toon`)} merge=pm-item-toon`,`${h(`${i}**/*.md`)} merge=pm-item-markdown`];for(let o of r){let a=z(o);t.push(`${h(`${i}${a}/*.toon`)} merge=pm-item-toon`),t.push(`${h(`${i}${a}/*.md`)} merge=pm-item-markdown`)}return t.push(`${h(`${i}**/*.jsonl`)} merge=pm-relationship`),t.push(`${h(`${i}history/*.jsonl`)} merge=pm-history`),t.push(`${h(`${i}settings.json`)} merge=pm-json`),t.push(`${h(`${i}**/*.json`)} merge=pm-json`),t.push(`${h(`${i}extensions/**`)} merge=text`),t.push(`${h(`${i}extensions/.managed-extensions.json`)} merge=pm-json`),t}function re(e){let r=[],i=0;for(;i<e.length;){let t=e.indexOf(T,i),o=e.indexOf(x,i),a=t===-1?o:o===-1?t:Math.min(t,o);if(a===-1)break;let s=a===o,n=s?x:T,p=s?Q:pe,u=e.indexOf(p,a+n.length),m=u===-1?e.length:u+p.length;r.push({start:a,end:m,closed:u!==-1,lines:e.slice(a+n.length,u===-1?m:u).split(`
|
|
2
|
-
`).map(l=>l.trim()).filter(Boolean)}),i=m}return r}function ie(e,r,i){let t=new Set(r),o=h(i.length>0?`${i}/`:"").slice(0,-1);return e.some(a=>t.has(a)||a.startsWith(o)&&/^[^/]+\/\*\.(?:toon|md)" merge=pm-item-(?:toon|markdown)$/u.test(a.slice(o.length)))}async function oe(e,r,i,t){let o=c.join(e,".gitattributes"),a=t?null:(await _("git",["rev-parse","--absolute-git-dir"],{cwd:e,env:v(),encoding:"utf8",windowsHide:!0,timeout:1e4})).stdout.trim(),s=a===null?null:await $(a,ge,120,"merge-fence",!1,!0,5e3);try{let n=await N(o)??"",p=[x,...i,Q].join(`
|
|
3
|
-
`),u=re(n),m=u.filter(d=>ie(d.lines,i,r));m.length===0&&r===".agents/pm"&&u.length===1&&u[0].lines.every(d=>!d.includes("/"))&&m.push(u[0]);let l;if(m.length>0){let d=m[0];l=n;for(let y of m.slice(1).reverse())l=`${l.slice(0,y.start)}${l.slice(y.end)}`;l=`${l.slice(0,d.start)}${p}${l.slice(d.end)}`}else{let d=n.trimEnd();l=`${d.length>0?`${d}
|
|
4
|
-
|
|
5
|
-
`:""}${p}
|
|
6
|
-
`}return l===n?{path:o,changed:!1}:(t||await F(o,l),{path:o,changed:!0})}finally{await s?.()}}function ne(e){let r=B(e,null);return[...new Set(Object.values(r.type_to_folder))].sort((i,t)=>i.localeCompare(t))}async function Ve(e,r){let i=c.resolve(e),t=null,o="",a=i;for(let g=0;g<8;g+=1){let ae=c.join(a,".gitattributes");try{let C=await A(ae,"utf8");if(C.includes(x)||C.includes(T)){t=a,o=C;break}}catch{}let D=c.dirname(a);if(D===a)break;a=D}if(t===null)return{status:"not_installed",missing_patterns:[],stale_patterns:[],schema_scope:"project"};let s=c.join(t,".gitattributes"),n=O(t,i),p=re(o),u=M(n,r),m=p.filter(g=>ie(g.lines,u,n)),l=m.flatMap(g=>g.closed?g.lines:[]),d=new Set(l),y=new Set(u),f=u.filter(g=>!d.has(g)),I=l.filter(g=>!y.has(g));return{status:m.length!==1||!m[0].closed||f.length>0||I.length>0?"drift":"ok",path:s,missing_patterns:f,stale_patterns:I,schema_scope:"project"}}async function Ke(e){let r=[],i=[];for(let t of Z){let o=`merge.${t.key}.driver`,a=` merge driver ${t.artifact} "%O" "%A" "%B"${t.itemPath===void 0?"":` --item-path ${t.itemPath}`}`;try{let{stdout:s}=await _("git",["config","--get",o],{cwd:e,env:v(),encoding:"utf8",windowsHide:!0,timeout:1e4}),n=s.trim();await _e(n,a,e)||i.push(o)}catch{r.push(o)}}return{status:r.length>0?"missing":i.length>0?"drift":"ok",missing_keys:r,drifted_keys:i}}async function Xe(e){let r;try{r=await te(c.resolve(e))}catch{return{status:"no_git"}}let i=O(r,c.resolve(e)),t=await P(e),o=W(void 0,t.author_default),a=await $(e,fe,t.locks.ttl_seconds,o,!1,H(t).force_required_for_stale_lock,t.locks.wait_ms);try{let s=c.join(r,".gitattributes"),n;try{n=await A(s,"utf8")}catch(l){if(l instanceof Error&&"code"in l&&j(l))return{status:"not_installed",path:s};throw l}if(!n.includes(x)&&!n.includes(T))return{status:"not_installed",path:s};let p=await P(e),u=ne(p),m=await oe(r,i,M(i,u),!1);return{status:m.changed?"refreshed":"unchanged",path:m.path}}finally{await a()}}async function qe(e,r){let i=ye({cwd:process.cwd(),explicitPath:r.path,dryRun:e.dryRun===!0,environment:process.env}),t=i.pm_root;await V(t);let o=await te(i.workspace_start);return ke({pmRoot:t,workspaceRoot:o,dryRun:e.dryRun===!0,preCommitHook:e.preCommitHook===!0})}async function be(e,r){let i=(await _("git",["rev-parse","--path-format=absolute","--git-common-dir"],{cwd:e,env:v(),timeout:1e4})).stdout.trim(),t=await $(i,"merge-driver-config",120,"merge-install",!1,!0,5e3);try{let o=await q(e),a;try{a=(await _("git",["config",o,"--null","--get-regexp","."],{cwd:e,env:v(),timeout:1e4})).stdout}catch(n){if(typeof n!="object"||n===null||!("code"in n)||n.code!==1)throw n;a=""}let s=new Map(a.split("\0").filter(Boolean).map(n=>{let p=n.indexOf(`
|
|
7
|
-
`);return[n.slice(0,p),n.slice(p+1)]}));for(let n of r)s.get(n.key)!==n.value&&await X(e,[o,n.key,n.value])}finally{await t()}}async function ke(e){let r=c.resolve(e.pmRoot),i=c.resolve(e.workspaceRoot),t=e.dryRun===!0,o,a;try{[o,a]=await Promise.all([w(r),w(i)])}catch(f){throw new k(`Cannot resolve tracker root ${r} or workspace root ${i}: ${String(f)}`,b.NOT_FOUND,{code:"merge_root_not_found",nextSteps:["Initialize the tracker and ensure both paths are accessible.",'Retry "pm merge install" from the repository workspace.']})}let s=O(a,o);if(K(s))throw new k(`Tracker root ${r} is outside the git repository ${i}; there is nothing to configure for this repository.`,b.USAGE);let n=await P(o),p=ne(n),u=M(s,p),m=[],l=await we(),d=e.preCommitHook===!0?await import("./settlement-hook-2VXEB6PP.js").then(async f=>({plan:await f.prepareMergeSettlementHook(a,`${l} --pm-path ${R(s||".")}`),write:f.writeMergeSettlementHook})):void 0;for(let f of Z)m.push({key:`merge.${f.key}.name`,value:f.name}),m.push({key:`merge.${f.key}.driver`,value:`${l} merge driver ${f.artifact} "%O" "%A" "%B"${f.itemPath===void 0?"":` --item-path ${f.itemPath}`}`});if(!t)try{await be(a,m)}catch{throw new k(`Cannot install repository-local merge drivers in ${a}. Ensure the repository Git config is writable and no other Git process holds its lock, then retry.`,b.DEPENDENCY_FAILED,{code:"merge_git_config_unwritable",why:"pm merge install must persist clone-local driver commands before publishing their shared .gitattributes mappings.",nextSteps:["Make the repository Git config writable or wait for the process holding its lock to finish.",'Retry "pm merge install"; the operation is idempotent.','Use "pm merge install --dry-run --json" when the workspace is intentionally read-only.']})}let y=await oe(a,s,u,t);return d!==void 0&&!t&&await d.write(d.plan),{ok:!0,dry_run:t,workspace_root:a,pm_root:o,gitattributes:{path:y.path,changed:y.changed,patterns:u,schema_scope:"project"},git_config:m,...d===void 0?{}:{settlement_hook:{path:d.plan.path,changed:d.plan.changed}},guidance:["Commit .gitattributes so every branch and collaborator shares the merge mapping.",'git config is per-clone: each collaborator (and each fresh worktree/clone) runs "pm merge install" once.','After merging branches, run "pm merge reconcile --dry-run" to inspect the complete receipt and history repair, then apply "pm merge reconcile"; use --force only after explicitly accepting any discarded values.',"Custom item types registered later refresh this fence automatically (pm schema add-type/remove-type); rerun pm merge install only after out-of-band type-folder edits."],generated_at:U()}}export{se as a,ce as b,ee as c,ne as d,Ve as e,Ke as f,Xe as g,qe as h,ke as i};
|
|
8
|
-
//# sourceMappingURL=chunk-CEEOWDB7.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as T}from"./chunk-AK2CI2GI.js";import{$a as b,H as D,Ua as $,Xa as U,cb as z}from"./chunk-7RQOFHMH.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="32173550-b687-53ee-b51e-f66ab42958fd")}catch{}})();var F=["item","list","context","search","graph","history","workspace","package","ops","plan","contracts","help"],ue=["acknowledge","activate","add","adopt","adopt-all","catalog","compact","complete","create","deactivate","delete","describe","doctor","edit","explore","import","init","inspect","install","list","manage","migrate","mutate","read","redact","reload","remove","reopen","repair","restore","run","show","uninstall","upgrade","verify"];function s(e,a,l,t={}){return{name:e,required:l,variadic:t.variadic===!0,value_kind:a,polymorphic:t.polymorphic===!0}}function j(e){let a=e.replaceAll("-"," ");return`${a.charAt(0).toUpperCase()}${a.slice(1)}`}var g=s("id","item_id",!0),y=s("id","item_id",!1),A=s("text","string",!1),k=s("plan-id","item_id",!0),X=s("step","string",!0),_e=["--acceptance-criteria","--actual-result","--affected-version","--assignee","--blocked-by","--blocked-reason","--blocks","--body","--claim","--comment","--component","--confidence","--create-mode","--customer-impact","--deadline","--definition-of-ready","--description","--doc","--environment","--estimate","--event","--expected-result","--fixed-version","--file","--from-search","--goal","--harness","--impact","--learning","--message","--mode","--note","--objective","--order","--outcome","--parent","--priority","--rank","--related","--release","--reminder","--reporter","--repro-steps","--resolution","--resume-context","--reviewer","--risk","--scope","--severity","--sprint","--status","--step","--step-blocked-reason","--step-body","--step-evidence","--step-owner","--step-replacement","--step-status","--step-title","--tags","--template","--test","--title","--type-option","--unblock-note","--value","--why-now"],E=["--allow-multiple-active","--depends-on","--file","--force","--message","--step-blocked-reason","--step-body","--step-evidence","--step-owner","--step-status","--step-title","--test"],ve={"update-step":"Update one declared Plan step.","complete-step":"Complete one declared Plan step.","block-step":"Block one declared Plan step.","remove-step":"Remove one declared Plan step.",link:"Link one dependency to a declared Plan step.",unlink:"Unlink one dependency from a declared Plan step."},h=[{command:"plan create",parent:"plan",action:"create",slots:[s("title","string",!1,{polymorphic:!0})],accepted_flags:_e,description:"Create a Plan item and optionally seed its ordered steps.",example:'pm plan create --title "Refactor lock retry"'},{command:"plan show",parent:"plan",action:"show",slots:[k],accepted_flags:["--depth","--fields"],description:"Read one Plan item with a bounded plan projection.",example:"pm plan show pm-a1b2 --depth standard"},{command:"plan add-step",parent:"plan",action:"add-step",slots:[k],accepted_flags:E,description:"Append one ordered step to a Plan item.",example:'pm plan add-step pm-a1b2 --step-title "Run tests"'},...Object.entries(ve).map(([e,a])=>({command:`plan ${e}`,parent:"plan",action:e,slots:[k,X],accepted_flags:E,description:a,example:`pm plan ${e} pm-a1b2 plan-step-001`})),{command:"plan reorder-step",parent:"plan",action:"reorder-step",slots:[k,X,s("new-order","integer",!0)],accepted_flags:["--force","--message"],description:"Move one Plan step to a declared integer order.",example:"pm plan reorder-step pm-a1b2 plan-step-001 2"},...["decision","discovery","validation","resume","approve","materialize"].map(e=>({command:`plan ${e}`,parent:"plan",action:e,slots:[k],accepted_flags:E,description:`${j(e)} for one Plan item.`,example:`pm plan ${e} pm-a1b2`})),...["list","show","put","remove"].map(e=>({command:`assurance ${e}`,parent:"assurance",action:e,slots:[s("kind","string",!0),...e==="list"?[]:[s("id","string",!0)]],accepted_flags:e==="put"?["--author","--definition","--message"]:e==="remove"?["--author","--message"]:[],description:`${j(e)} assurance declarations by kind.`,example:e==="list"?"pm assurance list measurement":`pm assurance ${e} measurement example-id`})),{command:"assurance run",parent:"assurance",action:"run",slots:[s("gate-id","string",!0)],accepted_flags:["--dry-run","--trigger","--tree"],description:"Evaluate one assurance gate for a lifecycle trigger.",example:"pm assurance run tracker-context-quality --trigger ci --dry-run"},{command:"assurance verdicts",parent:"assurance",action:"verdicts",slots:[s("gate-id","string",!1)],accepted_flags:["--gate","--limit"],description:"List bounded assurance verdict history.",example:"pm assurance verdicts --limit 20"},...["presets","apply"].map(e=>({command:`assurance ${e}`,parent:"assurance",action:e,slots:[s("preset","string",e==="apply")],accepted_flags:["--author","--message","--owner"],description:e==="apply"?"Apply one assurance adoption preset.":"List available assurance adoption presets.",example:e==="apply"?"pm assurance apply software-delivery --owner <pm-item-id>":"pm assurance presets"})),{command:"assurance derive",parent:"assurance",action:"derive",slots:[],accepted_flags:["--apply","--author","--message","--owner"],description:"Derive assurance proposals from current project context.",example:"pm assurance derive --owner pm-a1b2"},{command:"assurance promote",parent:"assurance",action:"promote",slots:[s("assertion-id","string",!0)],accepted_flags:["--author","--enforcement","--message"],description:"Promote one assertion into a warning or blocking gate.",example:"pm assurance promote assertion-id --enforcement warn"},{command:"assurance risk",parent:"assurance",action:"risk",slots:[],accepted_flags:["--definition"],description:"Analyze bounded defect-recurrence risk for a proposed change.",example:`pm assurance risk --definition '{"policy":{"version":1,"evidence_epoch":"2026-01-01T00:00:00.000Z","families":[]},"change":{"files":[]}}'`},{command:"assurance lineages",parent:"assurance",action:"lineages",slots:[],accepted_flags:["--definition"],description:"Measure all recorded recurrence lineages with bounded evidence rows.",example:`pm assurance lineages --definition '{"policy":{"version":1,"evidence_epoch":"2026-01-01T00:00:00.000Z","families":[]}}'`},{command:"workspace position",parent:"workspace",action:"position",slots:[],accepted_flags:[],description:"Read bounded merge-fence, receipt, history-drift, and next-action readiness.",example:"pm workspace position"},{command:"workspace snapshot create",parent:"workspace snapshot",action:"create",slots:[s("name","string",!1)],accepted_flags:[],description:"Capture authoritative tracker state as an immutable snapshot.",example:"pm workspace snapshot create before-migration"},{command:"workspace snapshot list",parent:"workspace snapshot",action:"list",slots:[],accepted_flags:[],description:"List immutable workspace snapshots and named references.",example:"pm workspace snapshot list"},{command:"workspace snapshot inspect",parent:"workspace snapshot",action:"inspect",slots:[s("target","string",!0)],accepted_flags:[],description:"Inspect one workspace snapshot target.",example:"pm workspace snapshot inspect before-migration"},{command:"workspace snapshot restore",parent:"workspace snapshot",action:"restore",slots:[s("target","string",!0)],accepted_flags:["--author","--dry-run","--force","--message"],description:"Restore an immutable workspace snapshot with explicit recovery controls.",example:"pm workspace snapshot restore before-migration --dry-run"},{command:"workspace snapshot delete",parent:"workspace snapshot",action:"delete",slots:[s("target","string",!0)],accepted_flags:[],description:"Delete one workspace snapshot target.",example:"pm workspace snapshot delete before-migration"}],he=[...h].sort((e,a)=>a.command.length-e.command.length),Y=new Map([["append",[g,A]],["assurance",[s("action","action",!0),s("kind","string",!1),s("id","string",!1)]],["beads import",[s("file","string",!1)]],["cal",[s("view","string",!1,{polymorphic:!0})]],["calendar",[s("view","string",!1,{polymorphic:!0})]],["changelog export",[s("file","string",!1)]],["changelog milestone create",[s("name","string",!0)]],["claim",[y]],["close",[g,A]],["close-task",[g,s("reason","string",!1)]],["comments",[g,A]],["completion",[s("shell","string",!1)]],["config",[s("scope","string",!1,{polymorphic:!0}),s("action","action",!1),s("key","string",!1),s("value","string",!1,{polymorphic:!0})]],["copy",[g]],["create",[s("type-or-title","string",!1,{polymorphic:!0}),s("title","string",!1)]],["delete",[g]],["deps",[g]],["docs",[g]],["event",[s("title","string",!0)]],["files",[g]],["files discover",[g]],["files lookup",[s("paths","string",!0,{variadic:!0})]],["focus",[y]],["get",[g]],["graph",[s("subcommand","action",!0),y,s("target","item_id",!1)]],["guide",[s("topic","string",!1)]],["history",[g]],["history-compact",[y]],["history-redact",[g]],["history-repair",[y]],["init",[s("prefix-or-path","string",!1,{polymorphic:!0})]],["item complete",[g,s("reason","string",!1)]],["item reopen",[g,s("reason","string",!0)]],["learnings",[g,A]],["meet",[s("title","string",!0)]],["merge",[s("subcommand","action",!0),s("artifact","string",!1),s("base","string",!1),s("ours","string",!1),s("theirs","string",!1)]],["notes",[g,A]],["package",[s("target","string",!1,{polymorphic:!0})]],["package list",[]],["package inventory",[s("name","string",!1)]],["package scaffold",[s("target","string",!0)]],["package upgrade",[s("target","string",!1)]],["packages",[s("target","string",!1,{polymorphic:!0})]],["packages list",[]],["packages inventory",[s("name","string",!1)]],["packages scaffold",[s("target","string",!0)]],["packages upgrade",[s("target","string",!1)]],["pause-task",[g]],["plan",[s("subcommand","action",!0),s("id","item_id",!1,{polymorphic:!0}),s("step","string",!1),s("new-order","integer",!1)]],["profile",[s("subcommand","action",!0),s("name","string",!1)]],["release",[g]],["remind",[s("title","string",!0)]],["restore",[g,s("target","string",!0)]],["schema",[s("subcommand","action",!0),s("name","string",!1)]],["search-advanced",[s("keywords","string",!0,{variadic:!0})]],["search",[s("keywords","string",!0,{variadic:!0})]],["start-task",[g]],["templates save",[s("name","string",!0)]],["templates show",[s("name","string",!0)]],["telemetry",[s("namespace-or-subcommand","action",!1,{polymorphic:!0}),s("subcommand","action",!1)]],["test",[g]],["test-runs-worker",[s("runId","string",!0)]],["update",[g]],["workspace snapshot",[s("action","action",!0),s("target","string",!1)]],...["activate","adopt","deactivate","init","uninstall"].flatMap(e=>["extension","package","packages"].map(a=>[`${a} ${e}`,[s("target","string",!0)]])),...["describe"].flatMap(e=>["extension","package","packages"].map(a=>[`${a} ${e}`,[s("target","string",!1)]])),...["install"].flatMap(e=>["extension","package","packages"].map(a=>[`${a} ${e}`,[s("targets","string",!1,{variadic:!0})]])),["vcs abandon",[g]],["vcs create",[s("title","string",!0)]],["vcs merge",[g]],["vcs propose",[g]],["vcs ref-create",[s("name","string",!0)]],["vcs show",[g]]]);function v(e){return e.trim().toLowerCase().replace(/\s+/gu," ")}function Ka(e){let a=v(e),l=R.find(i=>i.command===a);if(l)return l;let t=z(a)?.canonical;if(t)return R.find(i=>i.command===t)}function Te(e){let a=v(e);return he.find(l=>l.command===a||a.startsWith(`${l.command} `))}function Va(e){return`Applicable flags: ${e.length>0?e.join(", "):"none"}.`}function n(e,a,l,t,i){return i.map(f=>({command:f,noun:e,target:a,disposition:l,owner:t}))}var N=[...n("item","item","target_noun","pm-pbyu",["item","item complete","item mutate","item reopen"]),...n("item","item","consolidation","pm-yql1",["append","close-many","close-task","comments","copy","delete","deps","docs","files","learnings","notes","pause-task","start-task","test","update-many"]),...["claim","close","create","get","release","update"].map(e=>({command:e,noun:"item",target:e,disposition:"keep_as_is",owner:"pm-pbyu",reason:"Permanent high-frequency item operations retain concise root spellings under the accepted hot-path grammar policy."})),...n("item","item files","target_noun","pm-yql1",["files discover","files lookup","item files discover","item files lookup"]),...n("item","item test worker","consolidation","pm-lp4j",["test-runs-worker"]),...n("list","list","target_noun","pm-pfqi",["list"]),...n("list","list --group-by","consolidation","pm-xkgq",["aggregate"]),...n("context","context","target_noun","pm-pbyu",["context"]),...n("context","context","consolidation","pm-kcs4",["ctx","focus","next"]),...n("context","context next","consolidation","pm-kcs4",["ctx next"]),...n("context","context focus","consolidation","pm-kcs4",["ctx focus"]),...n("search","search","target_noun","pm-pbyu",["search"]),...n("search","search","package_owned","package:search-advanced",["reindex","search-advanced"]),...n("item","item duplicates","consolidation","pm-fmy9ih",["duplicates"]),...n("item","item duplicates","package_owned","pm-fmy9ih",["dedupe-audit","dedupe-merge","comments-audit"]),...n("graph","graph","target_noun","pm-pbyu",["graph"]),...n("history","history","target_noun","pm-pbyu",["history"]),...n("history","history attest","target_noun","pm-3z0k",["history attest"]),...n("history","history attest","consolidation","pm-3z0k",["history-attest"]),...$.flatMap(({alias:e,canonical:a})=>[...n("history",a,"target_noun","pm-tqel",[a]),...n("history",a,"consolidation","pm-tqel",[e])]),...n("history","history","consolidation","pm-tqel",["events","merge"]),...n("history","history acknowledge","consolidation","pm-djyvbk",["history-author-acknowledge"]),...n("history","history","package_owned","package:builtin-vcs-exemplar",["vcs abandon","vcs create","vcs log","vcs merge","vcs propose","vcs ref-create","vcs show"]),...n("workspace","workspace","target_noun","pm-pbyu",["workspace","workspace position","workspace snapshot","workspace snapshot create","workspace snapshot delete","workspace snapshot inspect","workspace snapshot list","workspace snapshot restore"]),...n("workspace","workspace init","consolidation","pm-npr3",["init"]),...n("package","package","target_noun","pm-pbyu",["package","package activate","package adopt","package adopt-all","package catalog","package deactivate","package describe","package doctor","package explore","package init","package install","package inventory","package list","package manage","package migrate","package reload","package scaffold","package uninstall","package upgrade"]),...n("package","package","consolidation","pm-tnud",["extension activate","extension adopt","extension adopt-all","extension catalog","extension deactivate","extension describe","extension doctor","extension explore","extension init","extension install","extension manage","extension migrate","extension reload","extension uninstall","packages","packages activate","packages adopt","packages adopt-all","packages catalog","packages deactivate","packages describe","packages doctor","packages explore","packages init","packages install","packages inventory","packages list","packages manage","packages migrate","packages reload","packages scaffold","packages uninstall","packages upgrade"]),...n("package","package","package_owned","package:beads",["beads import"]),...n("package","package","package_owned","package:pm-changelog",["changelog audit","changelog export","changelog generate","changelog milestone create"]),...n("package","package calendar","package_owned","pm-o3fh",["cal","calendar","event","meet","remind"]),...n("ops","ops","target_noun","pm-6apl",["ops"]),...n("ops","ops normalize","package_owned","package:pm-governance-audit",["normalize"]),...n("ops","ops","consolidation","pm-6apl",["eval","gc","health","stats","telemetry","test-all","validate"]),...n("workspace","workspace","consolidation","pm-npr3",["config","profile","schema"]),...["assurance",...h.filter(({parent:e})=>e==="assurance").map(({command:e})=>e)].map(e=>({command:e,noun:"ops",target:e,disposition:"keep_as_is",owner:"pm-djyvbk",reason:"Assurance manages durable measurement, assertion, gate, and verdict data; retain its established domain surface independently of operational diagnostics."})),...n("plan","plan","target_noun","pm-pbyu",["plan"]),...n("plan","plan","target_noun","pm-2tan",h.filter(({parent:e})=>e==="plan").map(({command:e})=>e)),...n("contracts","contracts","target_noun","pm-pbyu",["contracts"]),...n("help","help","target_noun","pm-pbyu",["help"]),...n("workspace","templates","package_owned","package:builtin-templates",["templates","templates list","templates save","templates show"]),...n("help","help","package_owned","package:builtin-guide-shell",["completion","completion-statuses","completion-tags","completion-types","guide"])].flatMap(e=>{let a=U.find(t=>t.alias===e.command);if(!a)return[e];let l=F.find(t=>t===a.canonical_argv[0])??e.noun;return[{...e,noun:l,target:a.canonical,owner:a.owner},{...e,command:a.canonical,noun:l,target:a.canonical,owner:a.owner,disposition:e.disposition==="package_owned"?"package_owned":"target_noun"}]}),R=[...new Set(N.map(({command:e})=>e))].map(e=>({command:e,slots:Te(e)?.slots??Y.get(b(e))??[]})),w={nouns:F,shared_verbs:ue,scope_before_verb:!0,visible_top_level_ceiling:69,ceiling_raise_requires_pm_item:!0,positional_shape_budget:21};function q(e,a){let l=new Set(a);return[...new Set(e)].filter(t=>!l.has(t)).map(t=>({code:"positional_signature_mismatch",command:t,detail:`Positional signature ${t} has no destination declaration.`}))}function ye(e){return e.map(({required:a,variadic:l,value_kind:t,polymorphic:i})=>`${a?"r":"o"}:${l?"v":"s"}:${t}:${i?"p":"m"}`).join("|")}function S(e){return e.map(({name:a,required:l,variadic:t,value_kind:i,polymorphic:f})=>`${a}:${l?"r":"o"}:${t?"v":"s"}:${i}:${f?"p":"m"}`).join("|")}function H(e,a){let l=new Map;for(let{command:t}of e){let i=v(t);l.set(i,(l.get(i)??0)+1)}return[...l.entries()].filter(([,t])=>t>1).map(([t,i])=>({code:"positional_signature_mismatch",command:t,detail:`${i} ${a} positional signatures exist for ${t}; exactly one is required.`}))}function Wa(e,a={}){let l=a.declared??R,t=a.positionalShapeBudget??w.positional_shape_budget,i=new Map(l.map(o=>[v(o.command),o])),f=new Map(e.map(o=>[v(o.command),o])),c=[...H(l,"declared"),...H(e,"observed"),...a.declared===void 0?[...q(Y.keys(),N.map(({command:o})=>o)),...q(h.map(({command:o})=>o),N.map(({command:o})=>o))]:[]];for(let o of i.values()){let d=v(o.command),r=f.get(d);r?S(r.slots)!==S(o.slots)&&c.push({code:"positional_signature_mismatch",command:o.command,detail:`Observed positional signature for ${o.command} differs from its declared SDK contract: observed=${S(r.slots)||"<none>"}; declared=${S(o.slots)||"<none>"}.`}):c.push({code:"missing_observed_signature",command:o.command,detail:`No observed positional signature exists for ${o.command}.`})}for(let o of f.values())i.has(v(o.command))||c.push({code:"stale_observed_signature",command:o.command,detail:`Observed positional signature ${o.command} has no declaration.`});let p=new Set(l.map(({slots:o})=>ye(o))).size;return p>t&&c.push({code:"positional_shape_budget_exceeded",command:"*",detail:`Distinct positional shape count ${p} exceeds budget ${t}.`}),c.sort((o,d)=>o.command!==d.command?o.command.localeCompare(d.command):o.code.localeCompare(d.code)),{ok:c.length===0,declared_command_count:l.length,observed_command_count:e.length,positional_shape_count:p,positional_shape_budget:t,findings:c}}function Ae(e,a,l){return e.flatMap(t=>{let i=a.get(t)??[];if(i.length===0){let c=t.indexOf(" "),p=c===-1?t:t.slice(0,c);return[{code:"missing_destination",spelling:t,message:`Command \`${t}\` has no destination census row.`,nearest_target:l.has(p)?p:`ops ${t}`}]}let f=i.length>1?[{code:"duplicate_destination",spelling:t,message:`Command \`${t}\` has ${i.length} destination rows.`,nearest_target:i[0].target}]:[];return i.reduce((c,p)=>(p.disposition==="keep_as_is"&&(p.reason?.trim().length??0)===0&&c.push({code:"missing_destination",spelling:t,message:`Command \`${t}\` is kept as-is without a documented reason.`,nearest_target:p.target}),l.has(p.noun)||c.push({code:"unknown_noun",spelling:t,message:`Command \`${t}\` names undeclared noun \`${p.noun}\`.`,nearest_target:p.target}),c),f)})}function ke(e,a){return a.filter(l=>l.disposition!=="package_owned"&&!e.has(l.command)).map(l=>({code:"stale_destination",spelling:l.command,message:`Destination row \`${l.command}\` is absent from live contracts.`,nearest_target:l.target}))}function Ce(e,a){return e.filter(l=>!a.has(l.canonical)).map(l=>({code:"alias_target_missing",spelling:l.alias,message:`Alias \`${l.alias}\` targets missing canonical command \`${l.canonical}\`.`,nearest_target:l.canonical_argv.join(" ")}))}function Za(e,a=[],l=N){let t=[...new Set(e.map(r=>r.trim()))].filter(r=>r.length>0).sort((r,u)=>r.localeCompare(u)),i=new Set(t),f=new Set(F),c=new Map;for(let r of l){let u=c.get(r.command)??[];u.push(r),c.set(r.command,u)}let p=[...Ae(t,c,f),...ke(i,l),...Ce(a.filter(r=>i.has(r.alias)||!(c.get(r.canonical)??[]).some(u=>u.disposition==="package_owned")),i)],o=new Set(a.filter(r=>r.hidden).map(r=>r.alias)),d=new Set(t.filter(r=>!r.includes(" ")&&!o.has(r)&&!(c.get(r)??[]).some(u=>u.disposition==="package_owned"))).size;return d>w.visible_top_level_ceiling&&p.push({code:"visible_surface_ceiling_exceeded",spelling:String(d),message:`Visible non-package top-level command count ${d} exceeds ceiling ${w.visible_top_level_ceiling}.`,nearest_target:"Declare the noun placement and tracked waiver before raising the ceiling."}),{ok:p.length===0,command_count:t.length,destination_count:l.length,hidden_alias_count:a.filter(r=>r.hidden).length,visible_top_level_count:d,visible_top_level_ceiling:w.visible_top_level_ceiling,findings:p}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="4e1e3ef4-cdf3-5d4c-88fe-d23f6fc171d1")}catch{}})();function C(e){return[...new Set(Array.from(e,a=>a.trim()).filter(a=>a.length>0))]}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="a549c8eb-3aaf-5f1f-8399-3f31408fde57")}catch{}})();function x(e){return e.startsWith("--")?`--${e.slice(2).replaceAll("_","-")}`:e}function G(e){let a=new Map;for(let l of e){let t=x(l.flag),i=a.get(t)??new Set;l.flag!==t&&i.add(l.flag);for(let f of l.aliases??[])f!==t&&i.add(f);a.set(t,i)}return e.map(l=>{let t=x(l.flag);if(l.flag!==t)return l;let i=C([...l.aliases??[],...a.get(t)]).filter(f=>f!==t);return i.length===0?l:{...l,aliases:i}})}function il(e){let a=G(e),l=new Set(a.map(t=>t.flag));return a.filter(t=>{let i=x(t.flag);return t.flag===i||!l.has(i)})}var P=D.map(e=>({flag:e.flag,reservation_scope:"inherited",...e.aliases?{aliases:[...e.aliases]}:{},...e.value_name?{value_name:e.value_name}:{}})),nl=[...P,{flag:"--version",value_type:"boolean",reservation_scope:"root_only"},{flag:"--all",value_type:"boolean",reservation_scope:"root_only",description:"Expand root help to every command."},{flag:"--explain",value_type:"boolean",reservation_scope:"root_only",description:"Expand root help with command guidance."}],J=[{flag:"--filter-reviewer-missing"},{flag:"--filter-risk-missing"},{flag:"--filter-confidence-missing"},{flag:"--filter-sprint-missing"},{flag:"--filter-release-missing"},{flag:"--has-notes"},{flag:"--no-notes"},{flag:"--has-learnings"},{flag:"--no-learnings"},{flag:"--has-files"},{flag:"--no-files"},{flag:"--filter-files-missing"},{flag:"--has-docs"},{flag:"--no-docs"},{flag:"--filter-docs-missing"},{flag:"--has-tests"},{flag:"--no-tests"},{flag:"--has-comments"},{flag:"--no-comments"},{flag:"--has-deps"},{flag:"--no-deps"},{flag:"--has-body"},{flag:"--empty-body"},{flag:"--has-linked-command"},{flag:"--no-linked-command"}],ee=[{flag:"--filter-reviewer-missing"},{flag:"--filter-risk-missing"},{flag:"--filter-confidence-missing"},{flag:"--filter-sprint-missing"},{flag:"--filter-release-missing"},{flag:"--filter-has-notes"},{flag:"--filter-no-notes"},{flag:"--filter-has-learnings"},{flag:"--filter-no-learnings"},{flag:"--filter-has-files"},{flag:"--filter-no-files"},{flag:"--filter-has-docs"},{flag:"--filter-no-docs"},{flag:"--filter-has-tests"},{flag:"--filter-no-tests"},{flag:"--filter-has-comments"},{flag:"--filter-no-comments"},{flag:"--filter-has-deps"},{flag:"--filter-no-deps"},{flag:"--filter-has-body"},{flag:"--filter-empty-body"},{flag:"--filter-has-linked-command"},{flag:"--filter-no-linked-command"},{flag:"--ids",list:!0},{flag:"--limit"},{flag:"--offset"}],I=M([{flag:"--for",value_name:"intent"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--status",list:!0},{flag:"--all",value_type:"boolean"},{flag:"--type",list:!0},{flag:"--tag",aliases:["--tags"],list:!0},{flag:"--priority",list:!0},{flag:"--deadline-before"},{flag:"--deadline-after"},{flag:"--today"},{flag:"--recent"},{flag:"--updated-after"},{flag:"--updated-before"},{flag:"--created-after"},{flag:"--created-before"},{flag:"--ids",list:!0},{flag:"--assignee",list:!0},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--parent"},{flag:"--sprint",list:!0},{flag:"--release",list:!0},{flag:"--filter-ac-missing"},{flag:"--filter-estimates-missing",aliases:["--filter-estimate-missing"]},{flag:"--filter-resolution-missing"},{flag:"--filter-metadata-missing"},...J,{flag:"--limit"},{flag:"--offset"},{flag:"--after"},{flag:"--no-truncate"},{flag:"--compact"},{flag:"--brief"},{flag:"--full"},{flag:"--fields",list:!0},{flag:"--sort"},{flag:"--order"},{flag:"--tree"},{flag:"--tree-depth"},{flag:"--tree_depth"},{flag:"--include-body"},{flag:"--strict-read"},{flag:"--format"},{flag:"--stream"}],new Set(["--limit","--token-budget","--offset","--after","--no-truncate","--compact","--brief","--full","--fields","--include-body","--strict-read"])),be=[{flag:"--group-by",list:!0},{flag:"--set-mode"},{flag:"--limit"},{flag:"--after"},{flag:"--count"},{flag:"--completion"},{flag:"--sum"},{flag:"--avg"},{flag:"--include-unparented"},{flag:"--include_unparented"},{flag:"--status",list:!0},{flag:"--type",list:!0},{flag:"--tag",list:!0},{flag:"--priority",list:!0},{flag:"--deadline-before"},{flag:"--deadline-after"},{flag:"--assignee",list:!0},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--parent"},{flag:"--sprint",list:!0},{flag:"--release",list:!0}],Se=[{flag:"--id",value_name:"item-id"},{flag:"--add",aliases:["--comment","--body","--text"]},{flag:"--stdin"},{flag:"--file"},{flag:"--edit"},{flag:"--delete"},{flag:"--limit"},{flag:"--full-history"},{flag:"--if-absent",value_type:"boolean"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];function M(e,a){return e.map(l=>a.has(l.flag)?{...l,cursor_semantics:"presentation"}:l)}var we=[{flag:"--id",value_name:"item-id"},{flag:"--add",aliases:["--note","--text"]},{flag:"--add-json"},{flag:"--stdin"},{flag:"--file"},{flag:"--edit"},{flag:"--delete"},{flag:"--limit"},{flag:"--since"},{flag:"--event-type"},{flag:"--include-meta"},{flag:"--full-history"},{flag:"--if-absent",value_type:"boolean"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],Ne=[{flag:"--id",value_name:"item-id"},{flag:"--add",aliases:["--learning","--text"]},{flag:"--stdin"},{flag:"--file"},{flag:"--edit"},{flag:"--delete"},{flag:"--limit"},{flag:"--full-history"},{flag:"--if-absent",value_type:"boolean"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],Oe=[{flag:"--id",value_name:"item-id"},{flag:"--add"},{flag:"--add-glob"},{flag:"--remove"},{flag:"--migrate"},{flag:"--note"},{flag:"--list"},{flag:"--append-stable"},{flag:"--validate-paths"},{flag:"--scope"},{flag:"--limit"},{flag:"--offset"},{flag:"--no-truncate"},{flag:"--strict-read"},{flag:"--explain"},{flag:"--lines",value_name:"start:end"},{flag:"--decision-depth",value_name:"n",value_type:"number"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],xe=[{flag:"--id",value_name:"item-id"},{flag:"--add"},{flag:"--add-glob"},{flag:"--remove"},{flag:"--migrate"},{flag:"--note"},{flag:"--list"},{flag:"--validate-paths"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],Le=[{flag:"--id",value_name:"item-id"},{flag:"--limit"},{flag:"--compact"},{flag:"--full"},{flag:"--provenance"},{flag:"--provenance-summary"},{flag:"--harness",repeatable:!0},{flag:"--agent-instance",repeatable:!0},{flag:"--provenance-filter",repeatable:!0},{flag:"--diff"},{flag:"--field"},{flag:"--verify"},{flag:"--strict-exit"},{flag:"--fail-on-warn"},{flag:"--format"}],Ee=[{flag:"--dry-run"},{flag:"--pre-commit-hook",value_type:"boolean"},{flag:"--stage",value_type:"boolean"},{flag:"--message"},{flag:"--force"},{flag:"--include-reconciled"},{flag:"--output"},{flag:"--item-path"},{flag:"--prefer"}],Re=[{flag:"--id",value_name:"item-id"},{flag:"--literal"},{flag:"--regex"},{flag:"--replacement"},{flag:"--dry-run"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],Fe=[{flag:"--id",value_name:"item-id"},{flag:"--all"},{flag:"--dry-run"},{flag:"--normalize-provenance"},{flag:"--salvage-tail",value_type:"boolean"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],Ie=[{flag:"--event",repeatable:!0},{flag:"--all-actionable"},{flag:"--dry-run"},{flag:"--plan-fingerprint"},{flag:"--limit",value_type:"number"},{flag:"--attributed-author",aliases:["--attributed_author"]},{flag:"--reviewer"},{flag:"--reason"}],Ge=[{flag:"--id",value_name:"item-id"},{flag:"--before"},{flag:"--ids",list:!0},{flag:"--all-over",value_type:"number"},{flag:"--closed"},{flag:"--all-streams"},{flag:"--min-entries",value_type:"number"},{flag:"--dry-run"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],Pe=[{flag:"--verify",value_name:"file",value_type:"string"},{flag:"--output",value_name:"file",value_type:"string"},{flag:"--hash-algorithm",value_name:"name",value_type:"string"}],Me=[{flag:"--definition",value_name:"json"},{flag:"--policy",value_name:"id"},{flag:"--message",value_name:"value"},{flag:"--description"},{flag:"--default-status",aliases:["--default_status"]},{flag:"--folder"},{flag:"--alias"},{flag:"--role"},{flag:"--order"},{flag:"--type"},{flag:"--commands"},{flag:"--cli-flag"},{flag:"--required"},{flag:"--required-on-create"},{flag:"--no-allow-unset"},{flag:"--required-types"},{flag:"--infer"},{flag:"--min-count"},{flag:"--apply",value_type:"boolean"},{flag:"--to"},{flag:"--migration-id",aliases:["--migration_id"]},{flag:"--dry-run"},{flag:"--author"},{flag:"--force"}],De=[{flag:"--dry-run"},{flag:"--author"},{flag:"--force"}],ae=[{flag:"--title"},{flag:"--description"},{flag:"--scope"},{flag:"--parent"},{flag:"--related"},{flag:"--blocks"},{flag:"--blocked-by",aliases:["--blocked_by"]},{flag:"--harness"},{flag:"--mode"},{flag:"--resume-context",aliases:["--resume_context"]},{flag:"--tags",aliases:["--tag"],list:!0},{flag:"--priority"},{flag:"--status",short:"-s"},{flag:"--create-mode",aliases:["--create_mode"]},{flag:"--deadline"},{flag:"--estimate",aliases:["--estimated-minutes","--estimated_minutes"]},{flag:"--acceptance-criteria",aliases:["--acceptance_criteria","--ac"],repeatable:!0},{flag:"--definition-of-ready",aliases:["--definition_of_ready"]},{flag:"--order"},{flag:"--rank"},{flag:"--goal"},{flag:"--objective"},{flag:"--value"},{flag:"--impact"},{flag:"--outcome"},{flag:"--why-now",aliases:["--why_now"]},{flag:"--assignee"},{flag:"--reviewer"},{flag:"--risk"},{flag:"--confidence"},{flag:"--sprint"},{flag:"--release"},{flag:"--blocked-reason",aliases:["--blocked_reason"]},{flag:"--unblock-note",aliases:["--unblock_note"]},{flag:"--reporter"},{flag:"--severity"},{flag:"--environment"},{flag:"--repro-steps",aliases:["--repro_steps"]},{flag:"--resolution"},{flag:"--expected-result",aliases:["--expected_result","--expected"]},{flag:"--actual-result",aliases:["--actual_result","--actual"]},{flag:"--affected-version",aliases:["--affected_version"]},{flag:"--fixed-version",aliases:["--fixed_version"]},{flag:"--component"},{flag:"--regression"},{flag:"--customer-impact",aliases:["--customer_impact"]},{flag:"--comment",repeatable:!0},{flag:"--note",repeatable:!0},{flag:"--learning",repeatable:!0},{flag:"--reminder",repeatable:!0},{flag:"--event",repeatable:!0},{flag:"--type-option",aliases:["--type_option"],repeatable:!0},{flag:"--body"},{flag:"--claim"},{flag:"--from-search",aliases:["--from_search"]},{flag:"--template"},{flag:"--step-title",aliases:["--step_title"]},{flag:"--step"},{flag:"--step-body",aliases:["--step_body"]},{flag:"--step-owner",aliases:["--step_owner"]},{flag:"--step-status",aliases:["--step_status"]},{flag:"--step-evidence",aliases:["--step_evidence"]},{flag:"--step-blocked-reason",aliases:["--step_blocked_reason"]},{flag:"--step-replacement",aliases:["--step_replacement"]},{flag:"--depends-on",aliases:["--depends_on"]},{flag:"--link"},{flag:"--link-kind",aliases:["--link_kind"]},{flag:"--link-note",aliases:["--link_note"]},{flag:"--promote-to-item-dep",aliases:["--promote_to_item_dep"]},{flag:"--allow-multiple-active",aliases:["--allow_multiple_active"]},{flag:"--file"},{flag:"--test"},{flag:"--doc"},{flag:"--decision-text",aliases:["--decision_text","--decision"]},{flag:"--decision-rationale",aliases:["--decision_rationale"]},{flag:"--decision-evidence",aliases:["--decision_evidence"]},{flag:"--discovery-text",aliases:["--discovery_text","--discovery"]},{flag:"--validation-text",aliases:["--validation_text","--validation"]},{flag:"--validation-command",aliases:["--validation_command"]},{flag:"--validation-expected",aliases:["--validation_expected"]},{flag:"--depth"},{flag:"--field"},{flag:"--fields",list:!0},{flag:"--steps"},{flag:"--materialize-type",aliases:["--materialize_type"]},{flag:"--materialize-parent",aliases:["--materialize_parent"]},{flag:"--materialize-tags",aliases:["--materialize_tags"]},{flag:"--author"},{flag:"--message"},{flag:"--force"}],$e=[{flag:"--id-prefix",aliases:["--prefix"]},{flag:"--preset"},{flag:"--type-preset"},{flag:"--defaults",short:"-y",aliases:["--yes"]},{flag:"--author"},{flag:"--agent-guidance"},{flag:"--with-packages"},{flag:"--no-merge-fence"},{flag:"--workspace"},{flag:"--force"},{flag:"--verbose"}],Ue=[{flag:"--value",value_name:"value"},{flag:"--criterion"},{flag:"--clear-criteria"},{flag:"--format"},{flag:"--policy"},{flag:"--default-depth"},{flag:"--activity-limit"},{flag:"--stale-threshold-days"},{flag:"--section-hierarchy"},{flag:"--section-activity"},{flag:"--section-progress"},{flag:"--section-blockers"},{flag:"--section-files"},{flag:"--section-workload"},{flag:"--section-staleness"},{flag:"--section-tests"}],le=[{flag:"--dry-run"},{flag:"--init"},{flag:"--scaffold"},{flag:"--capability"},{flag:"--install"},{flag:"--uninstall"},{flag:"--explore"},{flag:"--list"},{flag:"--manage"},{flag:"--offline",value_type:"boolean"},{flag:"--describe"},{flag:"--markdown"},{flag:"--output"},{flag:"--reload"},{flag:"--watch"},{flag:"--doctor"},{flag:"--catalog"},{flag:"--adopt"},{flag:"--adopt-all"},{flag:"--activate"},{flag:"--deactivate"},{flag:"--project"},{flag:"--local"},{flag:"--global"},{flag:"--gh"},{flag:"--github"},{flag:"--ref"},{flag:"--detail"},{flag:"--trace"},{flag:"--runtime-probe"},{flag:"--fix-managed-state"},{flag:"--isolated"},{flag:"--ignore-global"},{flag:"--strict-exit"},{flag:"--fail-on-warn"}],m=[{flag:"--project"},{flag:"--local"},{flag:"--global"}],te=[...m,{flag:"--capability"}],B=[...le,{flag:"--declarative"}],ze=[...te,{flag:"--declarative"}],je=[{flag:"--dry-run"},{flag:"--project"},{flag:"--local"},{flag:"--global"},{flag:"--gh"},{flag:"--github"},{flag:"--ref"}],Xe=m,qe=m,He=[...m,{flag:"--markdown"},{flag:"--output"}],Ye=m,Be=m,Ke=m,Ve=[...m,{flag:"--dry-run"}],We=[...m,{flag:"--offline",value_type:"boolean"},{flag:"--runtime-probe"},{flag:"--fix-managed-state"}],Ze=[...m,{flag:"--watch"}],Qe=[...m,{flag:"--detail"},{flag:"--trace"},{flag:"--fix-managed-state"},{flag:"--isolated"},{flag:"--ignore-global"},{flag:"--strict-exit"},{flag:"--fail-on-warn"}],K=[...m,{flag:"--fields",list:!0}],Je=[...m,{flag:"--gh"},{flag:"--github"},{flag:"--ref"}],ea=[{flag:"--dry-run"},{flag:"--project"},{flag:"--local"},{flag:"--global"},{flag:"--gh"},{flag:"--github"},{flag:"--ref"}],se=[{flag:"--dry-run"},{flag:"--cli-only"},{flag:"--packages-only"},{flag:"--project"},{flag:"--local"},{flag:"--global"},{flag:"--repair"},{flag:"--tag"},{flag:"--package-name"}],ol=[{flag:"--mode"},{flag:"--progress"}],aa=[{flag:"--release-assignment",value_type:"boolean"},{flag:"--id",value_name:"item-id"},{flag:"--reason",value_name:"value"},{flag:"--close-reason",value_name:"value"},{flag:"--completed-at",value_name:"value"},{flag:"--duplicate-of",value_name:"value"},{flag:"--author",value_name:"value"},{flag:"--message",value_name:"value"},{flag:"--validate-close",value_name:"off|warn|strict"},{flag:"--resolution",value_name:"value"},{flag:"--expected-result",aliases:["--expected_result","--expected"],value_name:"value"},{flag:"--actual-result",aliases:["--actual_result","--actual"],value_name:"value"},{flag:"--force",value_type:"boolean"}],la=[{flag:"--filter-status",list:!0},{flag:"--filter-type"},{flag:"--filter-tag"},{flag:"--filter-priority"},{flag:"--filter-deadline-before"},{flag:"--filter-deadline-after"},{flag:"--filter-updated-after"},{flag:"--filter-updated-before"},{flag:"--filter-created-after"},{flag:"--filter-created-before"},{flag:"--filter-assignee"},{flag:"--filter-assignee-filter"},{flag:"--filter-assignee_filter"},{flag:"--filter-parent"},{flag:"--filter-sprint"},{flag:"--filter-release"},...ee,{flag:"--reason"},{flag:"--completed-at"},{flag:"--resolution"},{flag:"--expected-result",aliases:["--expected_result","--expected"]},{flag:"--actual-result",aliases:["--actual_result","--actual"]},{flag:"--validate-close"},{flag:"--author"},{flag:"--message"},{flag:"--force"},{flag:"--dry-run"},{flag:"--rollback"},{flag:"--no-checkpoint"}],ta=[{flag:"--id",value_name:"item-id"},{flag:"--body",short:"-b"},{flag:"--text"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],sa=[{flag:"--start",value_type:"boolean"},{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--force"},{flag:"--if-available"},{flag:"--next"},{flag:"--type"},{flag:"--tag"},{flag:"--priority"},{flag:"--assignee-filter"},{flag:"--parent"},{flag:"--sprint"},{flag:"--release"},{flag:"--max-attempts"},{flag:"--include-decisions"},{flag:"--include-gates"},{flag:"--include-containers"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--explain-ranking",aliases:["--explain_ranking"]}],ia=[{flag:"--id",value_name:"item-id"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],na=[{flag:"--id",value_name:"item-id"},{flag:"--dry-run"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],oa=[{flag:"--pause",value_type:"boolean"},{flag:"--handoff",value_name:"status"},{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--force"}],ra=[{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--force"}],ga=[{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--force"}],fa=[{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--validate-close",value_name:"off|warn|strict"},{flag:"--force"}],ie=[{flag:"--parent"},{flag:"--allow-missing-parent"},{flag:"--tags"},{flag:"--priority"},{flag:"--body"},{flag:"--description"},{flag:"--author"},{flag:"--message"}],ne=[{flag:"--start"},{flag:"--duration"},{flag:"--end"},{flag:"--location"},{flag:"--timezone"},{flag:"--all-day"},...ie],ca=ne,pa=[{flag:"--at"},{flag:"--text"},...ie],da=[{flag:"--list"},{flag:"--id",value_name:"item-id"},{flag:"--add"},{flag:"--add-json"},{flag:"--remove"},{flag:"--remove-index",repeatable:!0},{flag:"--update"},{flag:"--update-index"},{flag:"--set-json"},{flag:"--run"},{flag:"--match"},{flag:"--only-index"},{flag:"--only-last"},{flag:"--background"},{flag:"--timeout"},{flag:"--progress"},{flag:"--env-set"},{flag:"--env-clear"},{flag:"--shared-host-safe"},{flag:"--pm-context"},{flag:"--override-linked-pm-context"},{flag:"--workspace-context"},{flag:"--override-linked-workspace-context"},{flag:"--allow-untrusted-linked-tests"},{flag:"--acknowledge-linked-tests"},{flag:"--fail-on-context-mismatch"},{flag:"--fail-on-skipped"},{flag:"--fail-on-empty-test-run"},{flag:"--require-assertions-for-pm"},{flag:"--check-context"},{flag:"--auto-pm-context"},{flag:"--measure",list:!0,description:"Record numeric measurement evidence; requires --run and an executed linked command."},{flag:"--metric-below"},{flag:"--metric-diff"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],ma=[{flag:"--status"},{flag:"--limit"},{flag:"--offset"},{flag:"--background"},{flag:"--timeout"},{flag:"--progress"},{flag:"--env-set"},{flag:"--env-clear"},{flag:"--shared-host-safe"},{flag:"--pm-context"},{flag:"--override-linked-pm-context"},{flag:"--workspace-context"},{flag:"--override-linked-workspace-context"},{flag:"--allow-untrusted-linked-tests"},{flag:"--fail-on-context-mismatch"},{flag:"--fail-on-skipped"},{flag:"--fail-on-empty-test-run"},{flag:"--require-assertions-for-pm"},{flag:"--check-context"},{flag:"--auto-pm-context"}],ua=[{flag:"--limit"}],rl=[{flag:"--status"},{flag:"--limit"},{flag:"--stream"},{flag:"--tail"},{flag:"--force"},{flag:"--author"}],_a=[{flag:"--dry-run"},{flag:"--scope"}],va=[{flag:"--include-empty"},{flag:"--storage"},{flag:"--metadata-coverage"},{flag:"--field-utilization"},{flag:"--by-assignee"},{flag:"--by-tag"},{flag:"--by-priority"},{flag:"--tag-prefix"},{flag:"--analytics"}],ha=[{flag:"--exhaustive",value_type:"boolean"},{flag:"--status",repeatable:!0,list:!0},{flag:"--since"},{flag:"--threshold"},{flag:"--limit"}],Ta=[{flag:"--strict-directories"},{flag:"--require-merge-drivers"},{flag:"--strict-exit"},{flag:"--fail-on-warn"},{flag:"--check-only"},{flag:"--check-telemetry"},{flag:"--no-refresh"},{flag:"--refresh-vectors"},{flag:"--verbose-stale-items"},{flag:"--verbose-author-events"},{flag:"--brief"},{flag:"--summary"},{flag:"--skip-vectors"},{flag:"--skip-integrity"},{flag:"--skip-drift"},{flag:"--full"}],ya=[{flag:"--check-completeness",value_type:"boolean"},{flag:"--check-metadata"},{flag:"--metadata-profile"},{flag:"--check-resolution"},{flag:"--check-lifecycle"},{flag:"--check-stale-blockers"},{flag:"--dependency-cycle-severity"},{flag:"--parent-cycle-severity"},{flag:"--check-files"},{flag:"--scan-mode"},{flag:"--include-pm-internals"},{flag:"--verbose-file-lists"},{flag:"--verbose-diagnostics"},{flag:"--all-affected-ids"},{flag:"--strict-exit"},{flag:"--fail-on-warn"},{flag:"--fix-hints"},{flag:"--auto-fix"},{flag:"--dry-run"},{flag:"--fix-scope"},{flag:"--prune-missing"},{flag:"--check-history-drift"},{flag:"--check-command-references"},{flag:"--check-storage-integrity"},{flag:"--counts"},{flag:"--full"}],oe=[{flag:"--definition",value_name:"json"},{flag:"--trigger",value_name:"value"},{flag:"--tree",value_name:"value"},{flag:"--gate",value_name:"id"},{flag:"--limit",value_name:"number"},{flag:"--dry-run"},{flag:"--author",value_name:"value"},{flag:"--message",value_name:"value"},{flag:"--owner",value_name:"item-id"},{flag:"--apply",value_type:"boolean"},{flag:"--enforcement",value_name:"level"}],re=[{flag:"--assignee"},{flag:"--parent"},{flag:"--allow-missing-parent"},{flag:"--allow-unresolved-deps"},{flag:"--reviewer"},{flag:"--risk"},{flag:"--confidence"},{flag:"--sprint"},{flag:"--release"},{flag:"--blocked-by"},{flag:"--blocked-reason"},{flag:"--unblock-note"},{flag:"--reporter"},{flag:"--severity"},{flag:"--environment"},{flag:"--repro-steps"},{flag:"--resolution"},{flag:"--expected-result"},{flag:"--actual-result"},{flag:"--affected-version"},{flag:"--fixed-version"}],ge=[{flag:"--component"},{flag:"--regression"},{flag:"--customer-impact"},{flag:"--customer_impact"},{flag:"--definition-of-ready"},{flag:"--definition_of_ready"},{flag:"--order"},{flag:"--rank"},{flag:"--goal"},{flag:"--objective"},{flag:"--value"},{flag:"--impact"},{flag:"--outcome"},{flag:"--why-now"},{flag:"--why_now"}],fe=[{short:"-p",flag:"--priority"},{flag:"--type"},{flag:"--tags",aliases:["--tag"],list:!0},{flag:"--add-tags",aliases:["--add_tags"]},{flag:"--remove-tags",aliases:["--remove_tags"]},{flag:"--deadline"},{flag:"--estimate"},{flag:"--estimated-minutes"},{flag:"--estimated_minutes"},{flag:"--acceptance-criteria"},{flag:"--acceptance_criteria"},{flag:"--ac"},{flag:"--add-ac",aliases:["--add_ac"]},{flag:"--remove-ac",aliases:["--remove_ac"]}],V=[{flag:"--stdin-json"},{short:"-t",flag:"--title"},{flag:"--id"},{short:"-d",flag:"--description"},{flag:"--type"},{flag:"--template"},{flag:"--create-mode"},{flag:"--create_mode"},{flag:"--schedule-preset"},{flag:"--schedule_preset"},{short:"-s",flag:"--status"},{flag:"--close-reason"},{flag:"--close_reason"},{flag:"--completed-at"},{flag:"--completed_at"},{short:"-p",flag:"--priority"},{flag:"--tags",aliases:["--tag"],list:!0},{flag:"--add-tags",aliases:["--add_tags"]},{short:"-b",flag:"--body",value_name:"value"},{flag:"--body-file"},{flag:"--deadline"},{flag:"--estimate"},{flag:"--estimated-minutes"},{flag:"--estimated_minutes"},{flag:"--acceptance-criteria"},{flag:"--acceptance_criteria"},{flag:"--ac"},{flag:"--author"},{flag:"--message"},...re,...ge,{flag:"--blocked_by"},{flag:"--blocked_reason"},{flag:"--unblock_note"},{flag:"--repro_steps"},{flag:"--expected_result"},{flag:"--actual_result"},{flag:"--expected"},{flag:"--actual"},{flag:"--affected_version"},{flag:"--fixed_version"},{flag:"--dep"},{flag:"--type-option"},{flag:"--type_option"},{flag:"--field"},{flag:"--reminder"},{flag:"--event"},{flag:"--comment"},{flag:"--note"},{flag:"--learning"},{flag:"--file",aliases:["--linked-file"]},{flag:"--test",aliases:["--linked-test"]},{flag:"--doc"},{flag:"--unset"},{flag:"--clear-deps"},{flag:"--clear-comments"},{flag:"--clear-notes"},{flag:"--clear-learnings"},{flag:"--clear-files"},{flag:"--clear-tests"},{flag:"--clear-docs"},{flag:"--clear-reminders"},{flag:"--clear-events"},{flag:"--clear-type-options"},{flag:"--allow-duplicate",value_type:"boolean"}],Aa=[{flag:"--transaction-id",value_name:"value"},{flag:"--stdin-json"},{flag:"--from",value_name:"path"},{flag:"--upsert-key",value_name:"field"},{flag:"--dry-run"},{flag:"--create-compensation",value_name:"mode"},{flag:"--lock-ttl-seconds",value_name:"n"},{flag:"--lock-wait-ms",value_name:"n"},{flag:"--author",value_name:"value"}],ka=[{flag:"--id",value_name:"item-id"},{flag:"--transaction-id",value_name:"value",required:!0},{flag:"--reason",value_name:"value"},{flag:"--file",value_name:"value",repeatable:!0},{flag:"--doc",value_name:"value",repeatable:!0},{flag:"--test",value_name:"value",repeatable:!0},{flag:"--comment",value_name:"value",repeatable:!0},{flag:"--note",value_name:"value",repeatable:!0},{flag:"--learning",value_name:"value",repeatable:!0},{flag:"--resolution",value_name:"value"},{flag:"--expected-result",value_name:"value"},{flag:"--actual-result",value_name:"value"},{flag:"--completed-at",value_name:"value"},{flag:"--validate-close",value_name:"off|warn|strict"},{flag:"--lock-ttl-seconds",value_name:"n"},{flag:"--lock-wait-ms",value_name:"n"},{flag:"--dry-run"},{flag:"--force"},{flag:"--author",value_name:"value"}],Ca=[{flag:"--id",value_name:"item-id"},{flag:"--status",value_name:"open|in_progress"},{flag:"--expected-result",value_name:"value",aliases:["--expected"]},{flag:"--message",value_name:"value"},{flag:"--force"},{flag:"--author",value_name:"value"}],ba=[{flag:"--id",value_name:"item-id"},{flag:"--title",value_name:"value"},{flag:"--author",value_name:"value"},{flag:"--message",value_name:"value"},{flag:"--allow-duplicate",value_type:"boolean"}],Sa=[{flag:"--id",value_name:"item-id"},{flag:"--clear"}],wa=[{flag:"--id",value_name:"item-id"},{flag:"--stdin-json"},{short:"-t",flag:"--title"},{short:"-d",flag:"--description"},{short:"-b",flag:"--body"},{flag:"--body-file"},{short:"-s",flag:"--status"},{flag:"--close-reason"},{flag:"--close_reason"},{flag:"--completed-at"},...fe,...re,{flag:"--fixed_version"},...ge,{flag:"--author"},{flag:"--message"},{flag:"--blocked_by"},{flag:"--blocked_reason"},{flag:"--unblock_note"},{flag:"--repro_steps"},{flag:"--expected_result"},{flag:"--actual_result"},{flag:"--expected"},{flag:"--actual"},{flag:"--affected_version"},{flag:"--dep"},{flag:"--dep-remove"},{flag:"--dep_remove"},{flag:"--replace-deps"},{flag:"--replace-tests"},{flag:"--replace-files"},{flag:"--replace-docs"},{flag:"--comment"},{flag:"--note"},{flag:"--learning"},{flag:"--file",aliases:["--linked-file"]},{flag:"--test",aliases:["--linked-test"]},{flag:"--doc"},{flag:"--reminder"},{flag:"--event"},{flag:"--type-option"},{flag:"--type_option"},{flag:"--field"},{flag:"--unset"},{flag:"--clear-deps"},{flag:"--clear-comments"},{flag:"--clear-notes"},{flag:"--clear-learnings"},{flag:"--clear-files"},{flag:"--clear-tests"},{flag:"--clear-docs"},{flag:"--clear-reminders"},{flag:"--clear-events"},{flag:"--clear-type-options"},{flag:"--force"}],Na=[{flag:"--status",short:"-s"},{flag:"--assignee"},{flag:"--parent"},{flag:"--blocked-by",aliases:["--blocked_by"]},{flag:"--blocked-reason",aliases:["--blocked_reason"]},{flag:"--unblock-note",aliases:["--unblock_note"]},{flag:"--filter-status",list:!0},{flag:"--filter-type",list:!0},{flag:"--filter-tag",list:!0},{flag:"--filter-priority",list:!0},{flag:"--filter-deadline-before"},{flag:"--filter-deadline-after"},{flag:"--filter-updated-after"},{flag:"--filter-updated-before"},{flag:"--filter-created-after"},{flag:"--filter-created-before"},{flag:"--filter-assignee",list:!0},{flag:"--filter-assignee-filter"},{flag:"--filter-assignee_filter"},{flag:"--filter-parent"},{flag:"--filter-sprint",list:!0},{flag:"--filter-release",list:!0},{flag:"--filter-ac-missing"},{flag:"--filter-estimates-missing",aliases:["--filter-estimate-missing"]},{flag:"--filter-resolution-missing"},{flag:"--filter-metadata-missing"},...ee,{flag:"--dry-run"},{flag:"--rollback"},{flag:"--no-checkpoint"},{short:"-t",flag:"--title"},{short:"-d",flag:"--description"},{short:"-b",flag:"--body"},...fe,{flag:"--definition-of-ready"},{flag:"--definition_of_ready"},{flag:"--order"},{flag:"--rank"},{flag:"--goal"},{flag:"--objective"},{flag:"--value"},{flag:"--impact"},{flag:"--outcome"},{flag:"--why-now"},{flag:"--why_now"},{flag:"--reviewer"},{flag:"--risk"},{flag:"--confidence"},{flag:"--sprint"},{flag:"--release"},{flag:"--reporter"},{flag:"--severity"},{flag:"--environment"},{flag:"--repro-steps"},{flag:"--repro_steps"},{flag:"--resolution"},{flag:"--expected-result"},{flag:"--expected_result"},{flag:"--expected"},{flag:"--actual-result"},{flag:"--actual_result"},{flag:"--actual"},{flag:"--affected-version"},{flag:"--affected_version"},{flag:"--fixed-version"},{flag:"--fixed_version"},{flag:"--component"},{flag:"--regression"},{flag:"--customer-impact"},{flag:"--customer_impact"},{flag:"--allow-unresolved-deps"},{flag:"--dep"},{flag:"--dep-remove"},{flag:"--dep_remove"},{flag:"--replace-deps"},{flag:"--replace-tests"},{flag:"--replace-files"},{flag:"--replace-docs"},{flag:"--comment"},{flag:"--note"},{flag:"--learning"},{flag:"--file"},{flag:"--test"},{flag:"--doc"},{flag:"--reminder"},{flag:"--event"},{flag:"--type-option"},{flag:"--type_option"},{flag:"--unset"},{flag:"--clear-deps"},{flag:"--clear-comments"},{flag:"--clear-notes"},{flag:"--clear-learnings"},{flag:"--clear-files"},{flag:"--clear-tests"},{flag:"--clear-docs"},{flag:"--clear-reminders"},{flag:"--clear-events"},{flag:"--clear-type-options"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],W=[{flag:"--view"},{flag:"--date"},{flag:"--from"},{flag:"--to"},{flag:"--past"},{flag:"--full-period"},{flag:"--full_period"},{flag:"--type"},{flag:"--tag"},{flag:"--priority"},{flag:"--status"},{flag:"--assignee"},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--sprint"},{flag:"--release"},{flag:"--include"},{flag:"--recurrence-lookahead-days"},{flag:"--recurrence-lookback-days"},{flag:"--occurrence-limit"},{flag:"--limit"},{flag:"--format"}],Oa=[{flag:"--id"},{flag:"--op"},{flag:"--author"},{flag:"--from"},{flag:"--to"},{flag:"--limit"},{flag:"--unbounded"},{flag:"--compact"},{flag:"--raw"},{flag:"--full"},{flag:"--provenance"},{flag:"--provenance-summary"},{flag:"--harness",repeatable:!0},{flag:"--agent-instance",repeatable:!0},{flag:"--provenance-filter",repeatable:!0},{flag:"--stream"}],xa=[{flag:"--since"},{flag:"--type",repeatable:!0},{flag:"--author",repeatable:!0},{flag:"--item",repeatable:!0},{flag:"--limit",value_type:"number"},{flag:"--cursor-mode",value_name:"batch|row"},{flag:"--full"},{flag:"--provenance"},{flag:"--provenance-summary"},{flag:"--harness",repeatable:!0},{flag:"--agent-instance",repeatable:!0},{flag:"--provenance-filter",repeatable:!0},{flag:"--follow"},{flag:"--interval-ms",value_type:"number"}],Z=M([{flag:"--for",value_name:"intent"},{flag:"--date"},{flag:"--from"},{flag:"--to"},{flag:"--past"},{flag:"--type"},{flag:"--tag"},{flag:"--priority"},{flag:"--assignee"},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--sprint"},{flag:"--release"},{flag:"--parent"},{flag:"--limit",aliases:["--max-items"]},{flag:"--after"},{flag:"--format"},{flag:"--depth"},{flag:"--fields",list:!0},{flag:"--section"},{flag:"--activity-limit"},{flag:"--stale-threshold"},{flag:"--explain-ranking"},{flag:"--explain_ranking"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--no-extension-health"},{flag:"--no-tags"}],new Set(["--limit","--after","--format","--fields","--section","--activity-limit","--stale-threshold","--explain-ranking","--explain_ranking","--no-extension-health","--no-tags"])),La=[{flag:"--id",value_name:"item-id"},{flag:"--for",value_name:"intent"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--depth"},{flag:"--full",value_type:"boolean"},{flag:"--fields",list:!0},{flag:"--at"},{flag:"--tree"},{flag:"--tree-depth"},{flag:"--tree_depth"},{flag:"--format"}],Ea=[{flag:"--list"},{flag:"--format"},{flag:"--depth"}],Ra=[{flag:"--id",value_name:"item-id"},{flag:"--format"},{flag:"--max-depth"},{flag:"--collapse"},{flag:"--summary"},{flag:"--full"},{flag:"--node-limit"},{flag:"--edge-limit"},{flag:"--token-budget"},{flag:"--cursor"},{flag:"--direction"},{flag:"--kind",list:!0}],Fa=[{flag:"--kind",list:!0},{flag:"--max-depth",description:`Maximum traversal depth; paths default to ${T.path_depth}.`},{flag:"--limit",description:`Maximum rows per collection; default ${T.rows}. Use --full to remove the row cap.`},{flag:"--after"},{flag:"--direction"},{flag:"--max-paths",description:`Maximum enumerated paths; default ${T.paths}.`},{flag:"--sample",description:`Maximum evidence examples per audit finding; default ${T.samples}.`},{flag:"--exempt-isolate",list:!0},{flag:"--exempt-isolate-type",list:!0},{flag:"--save-baseline"},{flag:"--rebuild"},{flag:"--clear"},{flag:"--summary"},{flag:"--full"}],Ia=[{flag:"--mode"},{flag:"--k"},{flag:"--fail-under"},{flag:"--queries"},{flag:"--format"}],_=[{flag:"--dry-run"},{flag:"--force"},{flag:"--author"},{flag:"--message"}],ce=[],Ga=[{flag:"--include-decisions"},{flag:"--include-gates"},{flag:"--include-containers"},{flag:"--for",value_name:"intent"},{flag:"--type"},{flag:"--tag"},{flag:"--priority"},{flag:"--assignee"},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--sprint"},{flag:"--release"},{flag:"--parent"},{flag:"--limit"},{flag:"--blocked-limit"},{flag:"--blocked_limit"},{flag:"--ready-only"},{flag:"--ready_only"},{flag:"--format"},{flag:"--explain-ranking"},{flag:"--explain_ranking"},{flag:"--token-budget",aliases:["--token_budget"]}],Pa=M([{flag:"--for",value_name:"intent"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--mode"},{flag:"--semantic"},{flag:"--hybrid"},{flag:"--match-mode"},{flag:"--min-score"},{flag:"--count"},{flag:"--semantic-weight"},{flag:"--include-linked"},{flag:"--title-exact"},{flag:"--phrase-exact"},{flag:"--highlight"},{flag:"--compact"},{flag:"--full"},{flag:"--fields",list:!0},{flag:"--format"},{flag:"--limit"},{flag:"--after"},{flag:"--status",list:!0},{flag:"--type",list:!0},{flag:"--tag",aliases:["--tags"],list:!0},{flag:"--priority",list:!0},{flag:"--deadline-before"},{flag:"--deadline-after"},{flag:"--updated-after"},{flag:"--updated-before"},{flag:"--created-after"},{flag:"--created-before"},{flag:"--assignee",list:!0},{flag:"--sprint",list:!0},{flag:"--release",list:!0},{flag:"--parent"},...J],new Set(["--highlight","--compact","--full","--fields","--format","--limit","--token-budget","--after"])),Ma=[{flag:"--action"},{flag:"--command"},{flag:"--summary"},{flag:"--schema-only"},{flag:"--flags-only"},{flag:"--availability-only"},{flag:"--runtime-only"},{flag:"--active-only"},{flag:"--full"}],Da=[{flag:"--eager-tags"}];function gl(e){let a=new Set,l=[];for(let t of e){let i=(t.aliases??[]).join(","),f=`${t.flag}|${t.short??""}|${i}`;a.has(f)||(a.add(f),l.push(t))}return l}function O(e,a=!1){let l=new Map;for(let t of[...P,...e]){let i=x(t.flag),f=l.get(i),{aliases:c,...p}=t,o=C([...c??[],...t.flag===i?[]:[t.flag]]).filter(u=>u!==i),d={...p,flag:i,...o.length>0?{aliases:o}:{}},r=C([...f?.aliases??[],...d.aliases??[]]);l.set(i,f===void 0?d:{...f,...d,...r.length>0?{aliases:r}:{}})}if(a&&e.length>0&&!l.has("--format")){let t=l.get("--output-format");l.set("--output-format",{...t,aliases:[...t.aliases??[],"--format"]})}return G([...l.values()])}var $a=["list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled"],Ua=I.filter(e=>e.flag!=="--status"&&e.flag!=="--all");function L(e){let a=new Map;for(let l of e)for(let t of[l.flag,...l.aliases??[]]){let i=a.get(t)??[];i.push(l),a.set(t,i)}return a}var za=L(ae),ja=L(oe),Xa=new Map([["assurance",ja],["plan",za],["workspace",L(ce)],["workspace snapshot",L(_)]]);function qa(e=h){return e.map(({command:a,parent:l,accepted_flags:t})=>{let i=Xa.get(l);if(!i)throw new Error(`Positional action ${a} has no flag-contract index for ${l}.`);let f=t.map(c=>{let p=i.get(c)??[];if(p.length!==1)throw new Error(`Positional action ${a} accepted flag ${c} does not resolve to exactly one ${l} flag contract.`);return p[0]});return[a,f]})}var Ha=qa(),pe=new Map([["list",I],["list-all",I],...$a.map(e=>[e,Ua]),["templates",V],["cal",W],["ctx",Z],["test-runs-worker",[]],["init",$e],["config",Ue],["extension",le],["package",B],["packages",B],["install",ea],["upgrade",se],["create",V],["item",[]],["item mutate",Aa],["item complete",ka],["item reopen",Ca],["copy",ba],["focus",Sa],["aggregate",be],["calendar",W],["context",Z],["get",La],["guide",Ea],["search",Pa],["next",Ga],["eval",Ia],["workspace",_],["workspace position",ce],["workspace snapshot",_],["workspace snapshot create",_],["workspace snapshot list",_],["workspace snapshot inspect",_],["workspace snapshot restore",_],["workspace snapshot delete",_],["history",Le],["history-redact",Re],["history-repair",Fe],["history-author-acknowledge",Ie],["history-compact",Ge],["history-attest",Pe],["merge",Ee],["schema",Me],["profile",De],["plan",ae],["activity",Oa],["events",xa],["restore",ia],["update",wa],["update-many",Na],["close",aa],["close-many",la],["delete",na],["append",ta],["comments",Se],["notes",we],["learnings",Ne],["files",Oe],["docs",xe],["deps",Ra],["graph",Fa],["test",da],["test-all",ma],["telemetry",ua],["health",Ta],["assurance",oe],...Ha,["validate",ya],["gc",_a],["stats",va],["duplicates",ha],["contracts",Ma],["completion",Da],["claim",sa],["release",oa],["start-task",ra],["pause-task",ga],["close-task",fa],["meet",ne],["event",ca],["remind",pa]]),de=new Map([["install",je],["uninstall",Xe],["explore",qe],["manage",We],["describe",He],["reload",Ze],["doctor",Qe],["catalog",K],["list",K],["adopt",Je],["adopt-all",Ye],["activate",Be],["deactivate",Ke],["migrate",Ve]]);function me(e){return typeof e!="string"?"":b(e.trim().toLowerCase())}function Q(e){let a=me(e);if(pe.has(a))return!0;let[l,t,...i]=a.split(/\s+/);return(l==="extension"||l==="package"||l==="packages")&&t!==void 0&&i.length===0&&(t==="init"||t==="scaffold"||de.has(t))}function Ya(e,a){return a==="init"||a==="scaffold"?e==="extension"?te:ze:de.get(a)??[]}function fl(e){let a=me(e);if(a.length===0)return O([]);let[l,t,...i]=a.split(/\s+/);if((l==="extension"||l==="package"||l==="packages")&&t!==void 0&&i.length===0)return(l==="package"||l==="packages")&&t==="upgrade"?O(se,!0):O(Ya(l,t),Q(a));let f=pe.get(a)??[];return O(f,Q(a))}function cl(e,a=!0){let l=G(e).flatMap(i=>[i.short,i.flag,...i.aliases??[]]).filter(i=>!!i),t=a?[...l,...P.flatMap(i=>[i.short,i.flag,...i.aliases??[]]).filter(i=>!!i)]:l;return C(t).join(" ")}export{C as a,F as b,ue as c,h as d,Ka as e,Te as f,Va as g,N as h,R as i,w as j,q as k,ye as l,S as m,Wa as n,Za as o,G as p,il as q,P as r,nl as s,I as t,be as u,Se as v,we as w,Ne as x,Oe as y,xe as z,Le as A,Ee as B,Re as C,Fe as D,Ie as E,Ge as F,Pe as G,Me as H,De as I,ae as J,$e as K,Ue as L,le as M,m as N,te as O,B as P,ze as Q,je as R,Xe as S,qe as T,He as U,Ye as V,Be as W,Ke as X,Ve as Y,We as Z,Ze as _,Qe as $,K as aa,Je as ba,ea as ca,se as da,ol as ea,aa as fa,la as ga,ta as ha,sa as ia,ia as ja,na as ka,oa as la,ra as ma,ga as na,fa as oa,ne as pa,ca as qa,pa as ra,da as sa,ma as ta,ua,rl as va,_a as wa,va as xa,ha as ya,Ta as za,ya as Aa,oe as Ba,V as Ca,Aa as Da,ka as Ea,Ca as Fa,ba as Ga,Sa as Ha,wa as Ia,Na as Ja,W as Ka,Oa as La,xa as Ma,Z as Na,La as Oa,Ea as Pa,Ra as Qa,Fa as Ra,Ia as Sa,_ as Ta,Ga as Ua,Pa as Va,Ma as Wa,Da as Xa,gl as Ya,qa as Za,Ha as _a,Q as $a,fl as ab,cl as bb};
|
|
2
|
-
//# sourceMappingURL=chunk-GXAXDPD4.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Ia as X,Ja as Y,Ka as Q,La as J,V as De,W as ke,Z as Ke,_ as xe}from"./chunk-AGCEWJ27.js";import{t as pe}from"./chunk-GXAXDPD4.js";import{g as ze,m as He,n as qe,q as Ve}from"./chunk-6HJCSHBG.js";import{A as D,D as Be,G as Ge,H as k,I as $e,e as q,f as Re,h as Oe,i as Ne,k as Pe,l as Ue,u as V,w as W,y as je}from"./chunk-ZMWLV2CE.js";import{Ba as Me,Fa as Ae,_a as w,ca as Ee,d as ve,db as C,r as Fe,ra as Te,sa as Ce,t as T,ta as Le}from"./chunk-IUAYTD2S.js";import{j as A,l as ye}from"./chunk-JYXA4JIP.js";import{Ad as R,Bd as Se,Ca as N,Cd as G,Dc as _e,aa as h,ge as $,he as z,ic as E,je as H,md as he,nd as be,od as B,pc as ge,qa as I,ra as O,sd as we,wa as b,wd as Ie}from"./chunk-7RQOFHMH.js";import{B as fe,y as m,z as f}from"./chunk-BUZ2Z4P3.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]="738a98bc-eaf0-578d-88e3-1c5f83c8894b")}catch{}})();function P(e,t="--limit"){if(e===void 0)return;let r=String(e).trim(),i=r.length===0?Number.NaN:Number(r);if(!Number.isInteger(i)||i<0)throw new f(`${t} must be a non-negative integer`,m.USAGE);return i}function We(e,t="--priority"){if(e===void 0)return;let r=String(e).trim(),i=r.length===0?Number.NaN:Number(r);if(!Number.isInteger(i)||i<0||i>4)throw new f(`${t} filter must be 0..4`,m.USAGE);return i}function si(e,t,r="--type"){if(e===void 0)return;let i=O(e,t);if(!i)throw new f(`${r} filter must be one of ${t.types.join("|")}`,m.USAGE);return i}(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]="75ecca0c-fac8-5a9b-9043-c65731daad4a")}catch{}})();function Z(e,t){if(e===void 0)return;let r=[],i="";for(let o=0;o<e.length;o+=1){let a=e[o];if(a==="\\"){let l=e[o+1];if(l===","||l==="\\"){i+=l,o+=1;continue}i+=a;continue}if(a===","){r.push(i),i="";continue}i+=a}r.push(i);let n=r.map(o=>o.trim());if(n.some(o=>o.length===0))throw new f(`${t.label} requires at least one non-empty value`,m.USAGE);let s=n.map(o=>t.normalize?.(o)??o);return[...new Set(s)]}function K(e,t){let r=Z(e,t);return r===void 0?void 0:new Set(r)}function Xe(e,t,r="--type"){let i=Z(e,{label:r});if(i===void 0)return;let n=i.map(s=>{let o=O(s,t);if(!o)throw new f(`${r} filter token "${s}" must be one of ${t.types.join("|")}`,m.USAGE);return o});return new Set(n)}function Ye(e,t="--priority"){let r=Z(e,{label:t});if(r!==void 0)return new Set(r.map(i=>We(i,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]="f9d73d74-7c4e-5ea9-b34c-c984b4c15ab3")}catch{}})();function Qe(e,t){let r=e.trim().toLowerCase();return t.alias_to_id.get(r)??r}function tt(e){return{isTerminal(t){return e.terminal_statuses.has(Qe(t,e))},classify(t){let r=Qe(t,e);return e.terminal_canceled_statuses.has(r)?"canceled":e.terminal_statuses.has(r)?"closed":e.blocked_statuses.has(r)?"blocked":e.draft_statuses.has(r)?"draft":r===e.open_status?"open":e.active_statuses.has(r)?"in_progress":"other"}}}function ee(e){return h(e.acceptance_criteria)===void 0}function te(e){return!Number.isFinite(e.estimated_minutes)}function rt(e,t){return t.isTerminal(e.status)?h(e.resolution)===void 0:!1}function Yt(e){return h(e.reviewer)===void 0}function Qt(e){return h(e.risk)===void 0}function Jt(e){return typeof e.confidence=="number"?!Number.isFinite(e.confidence):h(e.confidence)===void 0}function Zt(e){return h(e.sprint)===void 0}function er(e){return h(e.release)===void 0}function re(e){return!!(e.acMissing||e.estimatesMissing||e.resolutionMissing||e.reviewerMissing||e.riskMissing||e.confidenceMissing||e.sprintMissing||e.releaseMissing||e.metadataMissing)}function tr(e,t,r){return[[t.acMissing,ee(e)],[t.estimatesMissing,te(e)],[t.resolutionMissing,rt(e,r)],[t.reviewerMissing,Yt(e)],[t.riskMissing,Qt(e)],[t.confidenceMissing,Jt(e)],[t.sprintMissing,Zt(e)],[t.releaseMissing,er(e)]].every(([i,n])=>i!==!0||n)}function rr(e,t){return ee(e)||te(e)||rt(e,t)}function it(e,t,r){return re(t)?!(!tr(e,t,r)||t.metadataMissing&&!rr(e,r)):!0}var ie=["acceptance_criteria","estimated_minutes","resolution","tags","parent"];function ir(e,t){switch(t){case"acceptance_criteria":return!ee(e);case"estimated_minutes":return!te(e);case"resolution":return h(e.resolution)!==void 0;case"tags":return Array.isArray(e.tags)&&e.tags.length>0;default:return h(e.parent)!==void 0}}function nr(e,t,r){return t==="resolution"?r.isTerminal(e.status):!0}function sr(e,t){return t===0?100:Math.round(e/t*1e3)/10}function Je(){let e={};for(let t of ie)e[t]={present:0,applicable:0,percent:100};return e}function Ze(e,t,r){for(let i of ie){if(!nr(t,i,r))continue;let n=e[i];n.applicable+=1,ir(t,i)&&(n.present+=1)}}function et(e){for(let t of ie){let r=e[t];r.percent=sr(r.present,r.applicable)}}function fi(e,t){let r=Je(),i={};for(let n of e){Ze(r,n,t);let s=i[n.type]??(i[n.type]=Je());Ze(s,n,t)}et(r);for(let n of Object.values(i))et(n);return{overall:r,by_type:i}}var or={assignee:"(unassigned)",priority:"(no priority)",tag:"(untagged)",parent:"(unparented)",type:"(untyped)",status:"(no status)"};function ar(e){return or[e]}function lr(){return{open:0,in_progress:0,blocked:0,draft:0,closed:0,canceled:0,other:0}}function dr(e,t,r){switch(t){case"assignee":return[h(e.assignee)??null];case"parent":return[h(e.parent)??null];case"type":return[h(e.type)??null];case"status":return[h(e.status)??null];case"priority":return[typeof e.priority=="number"?`P${e.priority}`:null];default:{let i=r.tagPrefix?.trim(),n=(Array.isArray(e.tags)?e.tags:[]).filter(s=>typeof s=="string"&&s.length>0&&(!i||s.startsWith(i)));return n.length>0?n:[null]}}}function pi(e,t,r,i={}){let n=new Map,s=0;for(let a of e){s+=1;let l=r.classify(a.status);for(let d of dr(a,t,i)){let c=d??"\0empty",u=n.get(c);u||(u={label:d??ar(t),key:d,buckets:lr(),total:0},n.set(c,u)),u.buckets[l]+=1,u.total+=1}}let o=[...n.values()].sort((a,l)=>l.total!==a.total?l.total-a.total:a.key===null?1:l.key===null?-1:a.label.localeCompare(l.label));return{dimension:t,rows:o,total_items: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]="67f9184e-08b6-5f21-9f92-e60974adbf1e")}catch{}})();var L=["notes","learnings","files","docs","tests","comments","deps","body","linked_command"];function F(e){return Array.isArray(e)&&e.length>0}function cr(e){return typeof e=="string"&&e.trim().length>0}function ur(e){return Array.isArray(e)?e.some(t=>{if(typeof t!="object"||t===null)return!1;let r=t.command;return typeof r=="string"&&r.trim().length>0}):!1}function st(e,t){switch(t){case"notes":return F(e.notes);case"learnings":return F(e.learnings);case"files":return F(e.files);case"docs":return F(e.docs);case"tests":return F(e.tests);case"comments":return F(e.comments);case"deps":return F(e.dependencies);case"body":return cr(e.body);case"linked_command":return ur(e.tests)}}function ot(e){return L.some(t=>e[t]!==void 0)}function at(e,t){for(let r of L){let i=t[r];if(i===void 0)continue;let n=st(e,r);if(i==="present"&&!n||i==="absent"&&n)return!1}return!0}function lt(e){return L.some(t=>t!=="body"&&e[t]!==void 0)}function dt(e){return e.body!==void 0}function nt(e,t){return t===0?100:Math.round(e/t*1e3)/10}function mr(){let e={};for(let t of L)e[t]={present:0,total:0,percent:100};return e}function gi(e){let t=mr(),r=e.length;for(let o of e)for(let a of L)st(o,a)&&(t[a].present+=1);for(let o of L)t[o].total=r,t[o].percent=nt(t[o].present,r);let i=t.body,n=r-i.present,s={present:n,total:r,percent:nt(n,r)};return{total_items:r,fields:t,body_populated:i,empty_body: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]="0479845d-dd41-5604-a026-6733bb595236")}catch{}})();var yt=e=>({acMissing:e.filterAcMissing===!0,estimatesMissing:e.filterEstimatesMissing===!0,resolutionMissing:e.filterResolutionMissing===!0,metadataMissing:e.filterMetadataMissing===!0,reviewerMissing:e.filterReviewerMissing===!0,riskMissing:e.filterRiskMissing===!0,confidenceMissing:e.filterConfidenceMissing===!0,sprintMissing:e.filterSprintMissing===!0,releaseMissing:e.filterReleaseMissing===!0}),ct=[{field:"notes",presentKey:"hasNotes",absentKey:"noNotes",presentFlag:"--has-notes",absentFlag:"--no-notes"},{field:"learnings",presentKey:"hasLearnings",absentKey:"noLearnings",presentFlag:"--has-learnings",absentFlag:"--no-learnings"},{field:"files",presentKey:"hasFiles",absentKey:"noFiles",presentFlag:"--has-files",absentFlag:"--no-files"},{field:"docs",presentKey:"hasDocs",absentKey:"noDocs",presentFlag:"--has-docs",absentFlag:"--no-docs"},{field:"tests",presentKey:"hasTests",absentKey:"noTests",presentFlag:"--has-tests",absentFlag:"--no-tests"},{field:"comments",presentKey:"hasComments",absentKey:"noComments",presentFlag:"--has-comments",absentFlag:"--no-comments"},{field:"deps",presentKey:"hasDeps",absentKey:"noDeps",presentFlag:"--has-deps",absentFlag:"--no-deps"},{field:"body",presentKey:"hasBody",absentKey:"emptyBody",presentFlag:"--has-body",absentFlag:"--empty-body"},{field:"linked_command",presentKey:"hasLinkedCommand",absentKey:"noLinkedCommand",presentFlag:"--has-linked-command",absentFlag:"--no-linked-command"}],se=e=>{let t=ct.find(r=>e[r.presentKey]===!0&&e[r.absentKey]===!0);if(t)throw new f(`Cannot combine ${t.presentFlag} with ${t.absentFlag} for the same field.`,m.USAGE);return Object.fromEntries(ct.flatMap(r=>e[r.presentKey]===!0?[[r.field,"present"]]:e[r.absentKey]===!0?[[r.field,"absent"]]:[]))},ut=["priority","deadline","updated_at","created_at","title","parent"],mt=["asc","desc"],gt=new Set(je);function fr(e,t,r){let i=e.filter(o=>o.startsWith("item_list_item_read_failed:")).length,n=e.filter(o=>o.startsWith("item_list_directory_read_failed:")).length,s={status:t?"unchecked":i+n>0?"partial":"complete",unreadable_item_count:i,unreadable_directory_count:n};if(r&&s.status==="partial")throw new f(`List source is incomplete: ${i} item document(s) and ${n} item directory/directories could not be read.`,m.GENERIC_FAILURE,{code:"list_source_incomplete",why:"Strict list reads fail closed so agents and SDK consumers never treat an omitted item as a complete workspace.",nextSteps:["Run pm validate --check-storage-integrity to locate unreadable tracker artifacts.","Repair the reported files or align the installed decoder version, then retry."]});return s}function pr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&Object.keys(e).length>0}var yr=[{key:"hasNotes",summaryKey:"has_notes"},{key:"hasLearnings",summaryKey:"has_learnings"},{key:"hasFiles",summaryKey:"has_files"},{key:"hasDocs",summaryKey:"has_docs"},{key:"hasTests",summaryKey:"has_tests"},{key:"hasComments",summaryKey:"has_comments"},{key:"hasDeps",summaryKey:"has_deps"},{key:"hasBody",summaryKey:"has_body"},{key:"hasLinkedCommand",summaryKey:"has_linked_command"},{key:"noNotes",summaryKey:"no_notes"},{key:"noLearnings",summaryKey:"no_learnings"},{key:"noFiles",summaryKey:"no_files"},{key:"noDocs",summaryKey:"no_docs"},{key:"noTests",summaryKey:"no_tests"},{key:"noComments",summaryKey:"no_comments"},{key:"noDeps",summaryKey:"no_deps"},{key:"emptyBody",summaryKey:"empty_body"},{key:"noLinkedCommand",summaryKey:"no_linked_command"}],gr=[{key:"filterReviewerMissing",summaryKey:"filter_reviewer_missing"},{key:"filterRiskMissing",summaryKey:"filter_risk_missing"},{key:"filterConfidenceMissing",summaryKey:"filter_confidence_missing"},{key:"filterSprintMissing",summaryKey:"filter_sprint_missing"},{key:"filterReleaseMissing",summaryKey:"filter_release_missing"}];function _t(e,t){for(let r of yr)t[r.key]===!0&&(e[r.summaryKey]=!0)}function ht(e,t){for(let r of gr)t[r.key]===!0&&(e[r.summaryKey]=!0)}function _r(e,t,r){for(let i of r){let n=t[i.optionKey];n!==void 0&&(e[i.summaryKey]=i.normalize?i.normalize(n):n)}}function bt(e){let t={};return _t(t,e),t}function wt(e){let t={};return ht(t,e),t}var hr=[{optionKey:"type",summaryKey:"type"},{optionKey:"tag",summaryKey:"tag"},{optionKey:"priority",summaryKey:"priority"},{optionKey:"deadlineBefore",summaryKey:"deadline_before"},{optionKey:"deadlineAfter",summaryKey:"deadline_after"},{optionKey:"updatedAfter",summaryKey:"updated_after"},{optionKey:"updatedBefore",summaryKey:"updated_before"},{optionKey:"createdAfter",summaryKey:"created_after"},{optionKey:"createdBefore",summaryKey:"created_before"},{optionKey:"ids",summaryKey:"ids"},{optionKey:"assignee",summaryKey:"assignee"},{optionKey:"assigneeFilter",summaryKey:"assignee_filter"},{optionKey:"parent",summaryKey:"parent"},{optionKey:"sprint",summaryKey:"sprint"},{optionKey:"release",summaryKey:"release"}],br=[{optionKey:"type",summaryKey:"type"},{optionKey:"tag",summaryKey:"tag"},{optionKey:"priority",summaryKey:"priority"},{optionKey:"deadlineBefore",summaryKey:"deadline_before"},{optionKey:"deadlineAfter",summaryKey:"deadline_after"},{optionKey:"updatedAfter",summaryKey:"updated_after"},{optionKey:"updatedBefore",summaryKey:"updated_before"},{optionKey:"createdAfter",summaryKey:"created_after"},{optionKey:"createdBefore",summaryKey:"created_before"},{optionKey:"ids",summaryKey:"ids"},{optionKey:"assignee",summaryKey:"assignee"},{optionKey:"assigneeFilter",summaryKey:"assignee_filter"},{optionKey:"parent",summaryKey:"parent"},{optionKey:"sprint",summaryKey:"sprint"},{optionKey:"release",summaryKey:"release"},{optionKey:"limit",summaryKey:"limit"},{optionKey:"offset",summaryKey:"offset"},{optionKey:"includeBody",summaryKey:"include_body"},{optionKey:"compact",summaryKey:"compact"},{optionKey:"fields",summaryKey:"fields"}],wr=[{key:"filterAcMissing",summaryKey:"filter_ac_missing"},{key:"filterEstimatesMissing",summaryKey:"filter_estimates_missing"},{key:"filterResolutionMissing",summaryKey:"filter_resolution_missing"},{key:"filterMetadataMissing",summaryKey:"filter_metadata_missing"}],Ir="-7d";function It(e){let{filtersStatus:t,options:r,treeEnabled:i,treeDepth:n,sortField:s,sortOrder:o,runtimeFieldFilters:a}=e,l={};return t!==null&&(l.status=t),r.dependencyBlocked===!0&&(l.blocked_semantics="status_or_dependency"),_r(l,r,hr),vt(l,r),r.filterAcMissing===!0&&(l.filter_ac_missing=!0),r.filterEstimatesMissing===!0&&(l.filter_estimates_missing=!0),r.filterResolutionMissing===!0&&(l.filter_resolution_missing=!0),r.filterMetadataMissing===!0&&(l.filter_metadata_missing=!0),ht(l,r),_t(l,r),r.limit!==void 0&&(l.limit=r.limit),r.offset!==void 0&&(l.offset=r.offset),r.includeBody===!0&&(l.include_body=!0),r.fields!==void 0&&(l.fields=r.fields),i&&(l.tree=!0,n!==void 0&&(l.tree_depth=n)),s!==void 0&&(l.sort=s,l.order=o),pr(a)&&(l.runtime_filters=a),l}function oe(e,t,r){let i=T(e.status,r),n=T(t.status,r);if(i!==n)return i?1:-1;let s=e.priority-t.priority;if(s!==0)return s;let o=R(t.updated_at,e.updated_at);return o!==0?o:(e.id??"").localeCompare(t.id??"")}function Sr(e,t){return[...e].sort((r,i)=>oe(r,i,t))}function ft(e,t){if(e!==void 0)return G(e,new Date,t)}function x(e,t){if(e==null)return;let r=String(e).trim();if(r.length!==0)return G(r,new Date,t)}function St(e){let t=e.updatedAfter!=null&&String(e.updatedAfter).trim().length>0;if([e.today===!0,e.recent===!0,t].filter(r=>r).length>1)throw new f("Choose only one updated_at window: --today, --recent, or --updated-after.",m.USAGE);if(e.today===!0){let r=new Date;return r.setHours(0,0,0,0),r.toISOString()}return e.recent===!0?x(Ir,"recent"):x(e.updatedAfter,"updated-after")}function vt(e,t){t.today===!0&&(e.today=!0),t.recent===!0&&(e.recent=!0)}function Ft(e){if(e==null)return;let t=String(e).trim();if(t.length===0)throw new f("--ids requires at least one non-empty item ID",m.USAGE);let r=t.split(",").map(i=>i.trim()).filter(i=>i.length>0);if(r.length===0)throw new f("--ids requires at least one non-empty item ID",m.USAGE);return new Set(r)}function ae(e){if(e===void 0)return;let t=String(e).trim(),r=t.length===0?Number.NaN:Number(t);if(!Number.isInteger(r)||r<0)throw new f("Offset filter must be a non-negative integer",m.USAGE);return r}function Et(e){if(e===void 0)return;let t=e.split(",").map(r=>r.trim()).filter(r=>r.length>0);if(t.length===0)throw new f("List --fields requires a comma-separated list of field names",m.USAGE);return[...new Set(t)]}function Tt(e,t=e.projectionCommand??"list"){let r=e.compact===!0,i=e.brief===!0,n=e.full===!0,s=Et(e.fields);if(Number(r)+Number(i)+Number(n)+ +(s!==void 0)>1)throw new f("List projection options are mutually exclusive. Use one of --compact, --brief, --full, or --fields.",m.USAGE,{code:"projection_options_mutually_exclusive",recovery:{suggested_retry:`pm ${t} --brief`,suggested_retry_args:[t,"--brief"]}});if(n)return{mode:"full",fields:[]};if(i){let o=le(e.sort);return{mode:"brief",fields:[...new Set([...z,o??"priority"])]}}return r?{mode:"compact",fields:[...$]}:s?{mode:"fields",fields:[...new Set(s.map(o=>v(o)))]}:{mode:"full",fields:[]}}function v(e){return e.startsWith("item.")?e.slice(5):e}function vr(e,t,r){if(e.mode!=="fields")return;let i=H(t),n=new Set(i.map(o=>v(o))),s=e.fields.filter(o=>!n.has(v(o)));if(s.length>0){let o=[r,"--fields",e.fields.filter(a=>!s.includes(a)).join(",")||"id,title,status"];throw new f(`Unknown list --fields value(s): ${s.join(", ")}`,m.USAGE,{code:"unknown_field_projection",examples:["pm list --status open --fields id,title,status","pm list --fields id,title,parent,priority --limit 10","pm list --all --fields id,title,body --limit 5"],recovery:{allowed_values:i,suggested_retry:_e(o),suggested_retry_args:o}})}}var Fr=new Map([["updated","updated_at"],["update","updated_at"],["modified","updated_at"],["created","created_at"],["create","created_at"]]);function le(e){if(e===void 0)return;let t=e.trim().toLowerCase(),r=Fr.get(t);if(r)return r;if(!ut.includes(t))throw new f(`Sort field must be one of ${ut.join("|")} (aliases: updated->updated_at, created->created_at)`,m.USAGE);return t}function Ct(e){if(e===void 0)return;let t=e.trim().toLowerCase();if(!mt.includes(t))throw new f(`Sort order must be one of ${mt.join("|")}`,m.USAGE);return t}function Er(e){return P(e,"--tree-depth")}function Lt(e){if(e===void 0)return;let t=e.trim().toLowerCase();if(!t)throw new f("Assignee filter must be one of assigned|unassigned",m.USAGE);if(t!=="assigned"&&t!=="unassigned")throw new f(`Invalid assignee filter "${e}". Allowed: assigned|unassigned`,m.USAGE);return t}function pt(e,t){return ke(e,t,{strict:!0})}function Mt(e){return K(e,{label:"--tag",normalize:t=>t.toLowerCase()})}function Tr(e,t,r){let i=Mt(t);if(i===void 0)return;let n=new Set(e.flatMap(o=>o.tags.map(a=>a.trim().toLowerCase()))),s=[...i].filter(o=>!n.has(o));s.length>0&&r.push(`unknown_tags:${s.join(",")}`)}function Cr(e,t){if(e&&[...e].some(r=>r.toLowerCase()==="none"||r.toLowerCase()==="null"))throw new f('--assignee no longer accepts "none" or "null". Use --assignee-filter unassigned.',m.USAGE);if(e!==void 0&&t==="unassigned")throw new f("Cannot combine --assignee with --assignee-filter unassigned",m.USAGE)}function Lr(e,t,r,i){let n=K(t.assignee,{label:"--assignee"}),s=Lt(t.assigneeFilter);Cr(n,s);let o=yt(t),a=se(t);return{idsFilter:Ft(t.ids),statusSet:e&&e.length>0?new Set(e):void 0,excludeTerminal:t.excludeTerminal===!0,typeFilter:Xe(t.type,r),tagFilters:Mt(t.tag),priorityFilter:Ye(t.priority),deadlineBefore:ft(t.deadlineBefore,"deadline-before"),deadlineAfter:ft(t.deadlineAfter,"deadline-after"),updatedAfter:St(t),updatedBefore:x(t.updatedBefore,"updated-before"),createdAfter:x(t.createdAfter,"created-after"),createdBefore:x(t.createdBefore,"created-before"),assigneeFilter:n,assigneeModeFilter:s,parentFilter:t.parent?.trim(),treeEnabled:t.tree===!0,sprintFilter:K(t.sprint,{label:"--sprint"}),releaseFilter:K(t.release,{label:"--release"}),missingMetadataFilters:o,missingMetadataActive:re(o),lifecycleClassifier:tt(i),contentFieldFilters:a,contentFiltersActive:ot(a)}}function Mr(e,t,r){return t.idsFilter&&!t.idsFilter.has(e.id)||t.statusSet&&!t.statusSet.has(e.status)||t.excludeTerminal&&T(e.status,r)||t.typeFilter&&!t.typeFilter.has(e.type)||t.tagFilters&&![...t.tagFilters].some(i=>(e.tags??[]).some(n=>n.trim().toLowerCase()===i))?!1:t.priorityFilter===void 0||t.priorityFilter.has(e.priority)}function Ar(e,t){return Se(e,t)}function Rr(e,t){return t.assigneeModeFilter==="assigned"&&!e.assignee||t.assigneeModeFilter==="unassigned"&&e.assignee?!1:t.assigneeFilter===void 0||e.assignee!==void 0&&t.assigneeFilter.has(e.assignee)}function Dr(e,t,r){let i=e.parent?.trim().toLowerCase(),n=[...new Set([...r?.get(e.id.trim().toLowerCase())??[],...i?[i]:[]])];return t.parentFilter!==void 0&&!t.treeEnabled&&!n.includes(t.parentFilter.trim().toLowerCase())||t.sprintFilter!==void 0&&(e.sprint===void 0||!t.sprintFilter.has(e.sprint))?!1:t.releaseFilter===void 0||e.release!==void 0&&t.releaseFilter.has(e.release)}function kr(e,t,r,i,n){return!(!Mr(e,t,r)||!Ar(e,t)||!Rr(e,t)||!Dr(e,t,n)||t.missingMetadataActive&&!it(e,t.missingMetadataFilters,t.lifecycleClassifier)||t.contentFiltersActive&&!at(e,t.contentFieldFilters)||!xe(e,i))}function At(e,t,r,i,n,s,o){let a=Lr(t,r,i,n);return e.filter(l=>kr(l,a,n,s,o))}function M(e){if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function ne(e,t,r,i){let n=e,s=typeof n.title=="string"?n.title:"",o=i??M(typeof n.parent=="string"?n.parent:void 0)??null;return{...e,tree_depth:t,tree_parent:o,tree_children:r,tree_title:`${" ".repeat(t)}${s}`}}function Kr(e,t){let r=new Map,i=new Map;for(let n of e){let s=n.id.trim().toLowerCase();r.set(s,n);let o=t?t.parents_by_child.get(s)??[]:[M(n.parent)?.toLowerCase()].filter(a=>a!==void 0);for(let a of o){let l=i.get(a)??[];l.push(n),i.set(a,l)}}return{byId:r,childrenByParent:i}}function xr(e,t,r,i,n){return t?[...i.get(t.toLowerCase())??[]]:e.filter(s=>(n?n.parents_by_child.get(s.id.trim().toLowerCase())??[]:[M(s.parent)?.toLowerCase()].filter(o=>o!==void 0)).every(o=>!r.has(o)))}function Rt(e,t,r,i,n=e){let{byId:s,childrenByParent:o}=Kr(e,i),a=xr(e,t,s,o,i),l=[],d=new Set,c=new Map(n.map(p=>[p.id.trim().toLowerCase(),p.id.trim()])),u=[...a].reverse().map(p=>({node:p,depth:0,parentId:t===void 0?void 0:c.get(t.trim().toLowerCase())??t.trim()}));for(;u.length>0;){let{node:p,depth:y,parentId:g}=u.pop(),_=p.id.trim().toLowerCase();if(d.has(_))continue;d.add(_);let S=o.get(_)??[];if(l.push(ne(p,y,S.length,g)),!(r!==void 0&&y>=r))for(let j of[...S].reverse())u.push({node:j,depth:y+1,parentId:c.get(_)})}if(t===void 0&&r===void 0)for(let p of e){let y=p.id.trim().toLowerCase();d.has(y)||(d.add(y),l.push(ne(p,0,o.get(y)?.length??0)))}return l}function Dt(e,t){return e===t?0:e===null?1:t===null?-1:e.localeCompare(t)}function kt(e,t){return e===t?0:e===null?1:t===null?-1:R(e,t)}function Kt(e,t,r){switch(r){case"priority":return e.priority-t.priority;case"deadline":return kt(e.deadline??null,t.deadline??null);case"updated_at":return R(e.updated_at,t.updated_at);case"created_at":return R(e.created_at,t.created_at);case"title":return(e.title??"").localeCompare(t.title??"");case"parent":return Dt(e.parent??null,t.parent??null);default:return 0}}function xt(e,t,r,i){return t?[...e].sort((n,s)=>{let o=Kt(n,s,t);if(o!==0)return r==="desc"?-o:o;let a=oe(n,s,i);return r==="desc"?-a:a}):Sr(e,i)}function Ot(e,t,r=!1){let i=v(t.trim());if(i.length===0)return null;let n=e;return r&&i==="title"&&typeof n.tree_title=="string"?n.tree_title:Object.prototype.hasOwnProperty.call(n,i)?n[i]??null:null}function de(e,t,r=!1){return t.mode==="full"?e:e.map(i=>{let n={};for(let s of t.fields)n[s]=Ot(i,s,r);return n})}function Nt(e){let t=[];for(let r of e)t.push(r.metadata_key);return t}function Pt(e,t){let r=P(e.limit);if(r!==void 0)return r;if(e.noTruncate!==!0)return t>=1e4?20:void 0}function Or(e,t,r){return t.after===void 0?ae(t.offset)??0:we(e,t.after,r,i=>i.id)}function Ut(e,t,r){return{...e!==void 0?{applied_limit:e}:{},has_more:t,truncated:t,next_cursor:r??null}}async function Nr(e,t){let r=b(process.cwd(),t.path);await C(r);let i=await w(r),n=A(i.schema),s=ye(i.schema),o=e.projectionCommand??"list",a=Tt(e,o);return vr(a,Nt(s.definitions),o),{pmRoot:r,settings:i,statusRegistry:n,runtimeFieldFilters:Ke(e,s,"list"),typeRegistry:I(i,E()),projection:a}}async function Pr(e,t,r){let i=t.projection.fields.some(l=>v(l)==="body"),n=t.projection.mode==="full"||t.projection.fields.some(l=>gt.has(v(l))),s=se(e),o=lt(s),a=dt(s);return e.includeBody||i||a?await $e(t.pmRoot,t.settings.item_format,t.typeRegistry.type_to_folder,r,t.settings.schema):n||o?await Ge(t.pmRoot,t.settings.item_format,t.typeRegistry.type_to_folder,r,t.settings.schema):await k(t.pmRoot,t.settings.item_format,t.typeRegistry.type_to_folder,r,t.settings.schema)}function Ur(e){let t=le(e.sort),r=Ct(e.order)??"asc",i=e.tree===!0;if(!i&&e.treeDepth!==void 0)throw new f("List --tree-depth requires --tree",m.USAGE);if(!t&&e.order!==void 0)throw new f("List --order requires --sort",m.USAGE);return{sortField:t,sortOrder:r,treeEnabled:i,treeDepth:i?Er(e.treeDepth):void 0,parentRoot:i?M(e.parent):void 0}}function jr(e,t,r){let i=pt(t.status,r),n;t.lifecycleBucket==="in_progress"?n=[r.in_progress_status]:t.lifecycleBucket==="open"&&(n=[...r.active_statuses].filter(d=>d!==r.in_progress_status).sort((d,c)=>d.localeCompare(c)));let s=i??n??pt(e,r),o=De(t.status),a=i||o?{...t,excludeTerminal:!1}:t,l="all";return o?l="all":i!==void 0?l=i.length===1?i[0]:i:t.lifecycleBucket!==void 0?l=t.lifecycleBucket:s!==void 0?l=s.length===1?s[0]:s:a.excludeTerminal===!0&&(l=null),{resolvedStatus:s,explicitAllStatuses:o,effectiveOptions:a,filtersStatus:l}}function Br(e,t,r,i,n){if(t.after!==void 0&&t.offset!==void 0)throw new f("List --after cannot be combined with --offset.",m.USAGE);let s=Pt(t,e.length),o=Or(e,t,n),a=s===void 0?e.slice(o):e.slice(o,o+s),l=de(a,r,i),d=e.length,c=a.length>0&&o+a.length<d,u=c&&a.length>0?B(n,a[a.length-1].id,o+a.length-1):void 0;return{projected:l,totalMatched:d,pageExtras:Ut(s,c,u)}}function jt(e,t,r,i){return be("list",{pmRoot:i,status:e,options:he(t,pe),sort:r.sortField??"default",order:r.sortOrder,tree:r.treeEnabled,tree_depth:r.treeDepth??null})}async function Gr(e){let{options:t,runtime:r,statusSelection:i,ordering:n}=e,s=new Set(["status","limit","offset","compact","brief","full","fields","format","stream","includeBody","excludeTerminal","dependencyBlocked","lifecycleBucket","noTruncate","projectionCommand","truncate","notes","learnings","files","docs","tests","comments","deps","linkedCommand"]),o=[r.projection.mode==="full",r.projection.fields.some(y=>{let g=v(y);return g==="body"||gt.has(g)})].includes(!0);if([t.limit===void 0,t.after!==void 0,t.noTruncate===!0,t.includeBody===!0,t.dependencyBlocked===!0,t.strictRead===!0,n.treeEnabled,n.sortField!==void 0,o,ge(),Object.keys(r.runtimeFieldFilters).length>0,Object.entries(t).some(([y,g])=>g!==void 0&&!s.has(y))].includes(!0))return null;let a=await D(r.pmRoot,[...new Set(Object.values(r.typeRegistry.type_to_folder))]);if(!a)return null;let l=P(t.limit),d=ae(t.offset)??0,c=await V({pmRoot:r.pmRoot,expectedSourceCursor:a.source_cursor,query:{statuses:i.resolvedStatus,excludeStatuses:i.resolvedStatus===void 0&&i.effectiveOptions.excludeTerminal===!0?[...r.statusRegistry.terminal_statuses]:void 0,terminalStatuses:[...r.statusRegistry.terminal_statuses],limit:l,offset:d}});if(!c)return null;let u=c.items.length>0&&d+c.items.length<c.total,p=u?B(jt(i.filtersStatus,t,n,r.pmRoot),c.items.at(-1).id,d+c.items.length-1):void 0;return{projected:de(c.items,r.projection,!1),totalMatched:c.total,pageExtras:Ut(l,u,p)}}function $r(e){let{filtersStatus:t,options:r,noTruncate:i,treeEnabled:n,treeDepth:s,sortField:o,sortOrder:a,runtimeFieldFilters:l}=e,d={};t!==null&&(d.status=t),r.dependencyBlocked===!0&&(d.blocked_semantics="status_or_dependency");let c=r;for(let u of br){let p=c[u.optionKey];p!=null&&(d[u.summaryKey]=p)}for(let u of wr)c[u.key]===!0&&(d[u.summaryKey]=!0);return Object.assign(d,wt(r),bt(r)),vt(d,r),i&&(d.no_truncate=!0),r.strictRead===!0&&(d.strict_read=!0),n&&(d.tree=!0,s!==void 0&&(d.tree_depth=s)),o!==void 0&&(d.sort=o,d.order=a),d.runtime_filters=l,d}async function Wi(e,t,r){let i=await Nr(t,r),n=[],s=Ur(t),o=jr(e,t,i.statusRegistry),a=t.noTruncate===!0,l=await Gr({options:t,runtime:i,statusSelection:o,ordering:s}),d=l;if(!d){let g=await Pr(t,i,n),_=s.treeEnabled||M(t.parent)!==void 0?Ve(qe(g,He())):void 0;Tr(g,t.tag,n);let S=At(g,o.resolvedStatus,o.effectiveOptions,i.typeRegistry,i.statusRegistry,i.runtimeFieldFilters,_?.parents_by_child),j=t.dependencyBlocked===!0?(()=>{let Wt=ze(g,i.statusRegistry);return S.filter(Xt=>Wt.has(Xt.id.trim().toLowerCase()))})():S,me=xt(j,s.sortField,s.sortOrder,i.statusRegistry),Vt=s.treeEnabled?Rt(me,s.parentRoot,s.treeDepth,_,g):me;d=Br(Vt,t,i.projection,s.treeEnabled,jt(o.filtersStatus,t,s,i.pmRoot))}let c=Ie(),u=[...new Set(n)].sort((g,_)=>g.localeCompare(_)),p=fr(u,l!==null,t.strictRead===!0),y=i.projection.mode==="full"?null:[...i.projection.fields];if(i.projection.mode==="compact"&&t.compact===!0){let g=It({filtersStatus:o.filtersStatus,options:t,treeEnabled:s.treeEnabled,treeDepth:s.treeDepth,sortField:s.sortField,sortOrder:s.sortOrder,runtimeFieldFilters:i.runtimeFieldFilters});return{items:d.projected,count:d.projected.length,total:d.totalMatched,...d.pageExtras,completeness:p,filters:g,projection:{mode:"compact",fields:y},...u.length>0?{warnings:u}:{}}}return{items:d.projected,count:d.projected.length,total:d.totalMatched,...d.pageExtras,completeness:p,filters:$r({filtersStatus:o.filtersStatus,options:t,noTruncate:a,treeEnabled:s.treeEnabled,treeDepth:s.treeDepth,sortField:s.sortField,sortOrder:s.sortOrder,runtimeFieldFilters:i.runtimeFieldFilters}),projection:{mode:i.projection.mode,fields:y},sorting:{sort:s.sortField??"default",order:s.sortField?s.sortOrder:"asc",...s.sortField===void 0&&!s.treeEnabled?{effective_keys:[["status_registry:nonterminal_before_terminal","asc"],["priority","asc"],["updated_at","desc"],["id","asc"]]}:{}},now:c,...u.length>0?{warnings:u}:{}}}var Xi={applyFilters:At,buildCompactListFilterSummary:It,buildContentFilterEcho:bt,buildGovernanceMissingFilterEcho:wt,resolveContentFieldFilters:se,resolveMissingMetadataFilters:yt,compareBySortField:Kt,compareDefaultSort:oe,compareNullableString:Dt,compareNullableTimestamp:kt,normalizeProjectionField:v,parseAssigneeFilter:Lt,parseFieldSelectors:Et,parseIdsFilter:Ft,parseOffset:ae,parseProjectionConfig:Tt,resolveListUpdatedAfter:St,resolveListPageLimit:Pt,parseSortField:le,parseSortOrder:Ct,orderItemsAsTree:Rt,projectListItems:de,readListFieldValue:Ot,runtimeMetadataKeysForProjection:Nt,sortItems:xt,trimNonEmpty:M,withTreeMetadata:ne};(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="59842825-3a81-53f4-845d-db2257ec6286")}catch{}})();async function dn(e){let t=b(process.cwd(),e);await C(t);let r=await w(t),i=I(r,E());return{pmRoot:t,settings:r,typeRegistry:i}}async function Bt(e,t,r,i){N(e,q(t));let n=await Be(e,t,r.id_prefix,r.item_format,i);if(n)return{id:n.id,historyPath:N(e,n.id),located:n};let s=Re(t,r.id_prefix),o=q(t),a=s===o?[s]:[s,o];for(let l of a){let d=N(e,l);if(await fe(d))return{id:l,historyPath:d,located:null}}throw new f(`Item ${t} not found`,m.NOT_FOUND)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="eb2e6046-156c-56ee-a03a-ecaa1cccfb45")}catch{}})();function Mn(e,t){let r=Ae(e),i=e.length>0?e[e.length-1].after_hash:Le(),n=t===void 0||r.item_hash_version===void 0?void 0:Ce(t,r.item_hash_version,ve(e.at(-1)?.hash_algorithm)),s=t===void 0?void 0:n===void 0?Te(t):n[Math.max(0,n.indexOf(i))],o=s===void 0?void 0:s===i,a=[...r.errors];return o===!1&&a.push("verify_failed:current_item_hash_mismatch"),{ok:a.length===0,entries:e.length,errors:a,latest_after_hash:e.length>0?e[e.length-1].after_hash:void 0,current_item_hash:s,current_matches_latest:o}}async function An(e,t,r={}){let i=b(r.cwd??process.cwd(),r.pmRoot);await C(i);let n=await w(i),s=I(n,E()),o=await Bt(i,e,n,s.type_to_folder),a=await Ee(o.historyPath,o.id);if(a.length===0)throw new f(`No history exists for ${o.id}; point-in-time reads are unavailable.`,m.NOT_FOUND);let l=Ne(t,a),d=Ue(Pe(a,l.historyIndex),l),c=Me(d,{schema:n.schema});if(c.metadata.id!==o.id)throw new f(`History target resolved to item ${c.metadata.id}, expected ${o.id}.`,m.GENERIC_FAILURE);let u=a[l.historyIndex],p=Oe(a,!0);return{document:c,reconstructed:!0,as_of_version:p===null?null:p+l.historyIndex+1,as_of_timestamp:u.ts,target:l,history_length:a.length}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e524f0ad-faad-5d89-b8f5-1283979919ad")}catch{}})();(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]="67d97df8-6551-52ed-9307-8b573a087831")}catch{}})();var U=1e6;function ce(e,t=U,r=.8,i=!1){let n=new Set,s=(c,u)=>{if(n.add(`${c}:${u}`),n.size>t)throw new f(`Duplicate sweep exceeded ${t} candidate pairs; narrow it with statuses or since.`,m.CONFLICT,{code:"duplicate_sweep_cost_limit",required:"Narrow the duplicate query or increase its similarity threshold. No partial result was returned."})};if(i||r===0){for(let c=0;c<e.length;c+=1)for(let u=0;u<c;u+=1)s(u,c);return n}let o=new Map;for(let{prepared:c}of e)for(let u of c.tokens)o.set(u,(o.get(u)??0)+1);let a=new Map,l=new Map,d=new Map;for(let[c,{prepared:u}]of e.entries()){let p=[...u.tokens].sort((_,S)=>o.get(_)-o.get(S)||_.localeCompare(S)),y=p.length-Math.ceil(r*p.length-1e-12)+1,g=[{index:a,keys:[u.normalized],lengthFilter:!1},{index:l,keys:r<=.99?u.issueCodes:[],lengthFilter:!1},{index:d,keys:p.length===0?[""]:p.slice(0,y),lengthFilter:!0}];for(let _ of g)zr(e,c,_,r,s)}return n}function zr(e,t,r,i,n){let s=e[t].prepared.tokens.length;for(let o of r.keys){let a=r.index.get(o)??[];for(let l of a){let d=e[l].prepared.tokens.length;r.lengthFilter&&Math.min(d,s)/Math.max(d,s)+1e-12<i||n(l,t)}a.push(t),r.index.set(o,a)}}(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]="a5f450bd-8970-5b1b-8250-b76b7818e6e1")}catch{}})();var Hr=3,Gt=20,qr=.8,Vr=100,$t=1e3;function is(e){return e===void 0?[]:[`likely_duplicates:${e.result.items.map(t=>t.id).join(",")}`,`likely_duplicate_recovery:${e.recovery.action}:${e.recovery.item_id}`]}async function Wr(e,t){let r=e.items[0],i=b(t.cwd??process.cwd(),t.pmRoot),n=A((await w(i)).schema);return T(r.status,n)?{action:"reopen",item_id:r.id,command:`pm item reopen ${r.id} "<recurrence reason>"`,args:["item","reopen",r.id,"<recurrence reason>"]}:{action:"reuse",item_id:r.id,command:`pm get ${r.id} --full`,args:["get",r.id,"--full"]}}function ue(e){let t=e.limit??Hr,r=e.threshold??qr;if(!Number.isSafeInteger(t)||t<0||t>Gt)throw new f(`Similarity limit must be an integer from 0 to ${Gt}.`,m.USAGE);if(!Number.isFinite(r)||r<0||r>1)throw new f("Similarity threshold must be a number from 0 to 1.",m.USAGE);return{limit:t,threshold:r}}function zt(e){let t=e.limit??Vr;if(!Number.isSafeInteger(t)||t<0||t>$t)throw new f(`Duplicate cluster limit must be an integer from 0 to ${$t}.`,m.USAGE);let r=e.since===void 0?void 0:new Date(e.since);if(r&&Number.isNaN(r.getTime()))throw new f("Duplicate cluster --since must be a valid ISO timestamp.",m.USAGE);return{limit:t,since:r}}async function Xr(e,t){let r=b(e.cwd??process.cwd(),e.pmRoot),i=await w(r),n=I(i),s=e.statuses?.map(u=>u.trim().toLowerCase()).filter(Boolean);if(e.statuses!==void 0&&s?.length===0)throw new f("Duplicate cluster statuses must include at least one lifecycle status or all.",m.USAGE);let o=A(i.schema),a=s?.map(u=>{if(u==="all")return u;let p=Fe(u,o);if(!p)throw new f(`Unknown duplicate-cluster status "${u}". Allowed: all, ${o.definitions.map(y=>y.id).join(", ")}.`,m.USAGE);return p}),l=a?.includes("all")===!0;if(l&&a?.some(u=>u!=="all"))throw new f('The "all" status cannot be combined with other statuses.',m.USAGE);let d=l?void 0:a,c=d?new Set(d):void 0;return{items:(await k(r,i.item_format,n.type_to_folder,void 0,i.schema)).filter(u=>(!c||c.has(u.status))&&(!t||new Date(u.created_at).getTime()>=t.getTime())),statuses:d}}var ns={buildDuplicateClusters:qt,collectDuplicateCandidatePairs:ce,createDuplicateUnionFind:Ht};function Ht(e){let t=Array.from({length:e},(r,i)=>i);return{parent:t,findRoot:r=>{let i=r;for(;t[i]!==i;)i=t[i];for(;t[r]!==r;){let n=t[r];t[r]=i,r=n}return i}}}function Yr(e,t,r,i){let n=[];for(let s of t){let[o,a]=s.split(":").map(u=>Number.parseInt(u,10)),l=J(e[o].prepared,e[a].prepared);if(l.score<r)continue;let d=i.findRoot(o),c=i.findRoot(a);d!==c&&(i.parent[c]=d),n.push({left_id:e[o].item.id,right_id:e[a].item.id,...l})}return n}function qt(e,t,r,i){let n=new Map;for(let a of e.keys()){let l=r.findRoot(a),d=n.get(l)??[];d.push(a),n.set(l,d)}let s=new Map(e.map(({item:a},l)=>[a.id,r.findRoot(l)])),o=new Map;for(let a of t){let l=s.get(a.left_id),d=o.get(l)??[];d.push(a),o.set(l,d)}return[...n.values()].filter(a=>a.length>1).map(a=>{let l=(o.get(r.findRoot(a[0]))??[]).sort((d,c)=>c.score-d.score||d.left_id.localeCompare(c.left_id)||d.right_id.localeCompare(c.right_id));return{id:e[a[0]].item.id,items:a.map(d=>{let c=e[d].item;return{id:c.id,title:c.title,status:c.status,type:c.type}}),matches:l,max_score:l[0]?.score??0}}).sort((a,l)=>l.max_score-a.max_score||a.id.localeCompare(l.id)).slice(0,i)}function Qr(e,t,r,i,n){return t.filter(s=>!r.has(s.id)).map(s=>({id:s.id,title:s.title,status:s.status,type:s.type,...Q(e,s.title)})).filter(s=>s.score>=i).sort((s,o)=>o.score-s.score||s.id.localeCompare(o.id)).slice(0,n)}async function Jr(e,t={}){let r=e.title.trim();if(r.length===0)throw new f("Similarity candidate title must not be empty.",m.USAGE);let{limit:i,threshold:n}=ue(t),s=b(t.cwd??process.cwd(),t.pmRoot),o=await w(s),a=I(o),l=await D(s,Object.values(a.type_to_folder)),d=X(r),c=l&&d.length>0?await W({pmRoot:s,expectedSourceCursor:l.source_cursor,query:d.map(y=>`"${y.replaceAll('"','""')}"`).join(" OR "),limit:Math.max(i*10,50)}):null,u=c===null?await k(s,o.item_format,a.type_to_folder,void 0,o.schema):c.items,p=Qr(r,u,new Set(e.excludeIds??[]),n,i);return{items:p,count:p.length,threshold:n,source:c?"persistent_index":"metadata_fallback"}}function Zr(e,t={}){let{threshold:r}=ue({...t,limit:void 0}),{limit:i}=zt(t),n=new Set;for(let c of e){if(!c.id.trim()||n.has(c.id))throw new f("Duplicate analysis requires unique non-empty item ids.",m.USAGE);n.add(c.id)}let s=[...e].sort((c,u)=>c.id.localeCompare(u.id)).map(c=>({item:c,prepared:Y(c.title)})),o=ce(s,U,r,t.exhaustive===!0),a=Ht(s.length),l=Yr(s,o,r,a),d=qt(s,l,a,i);return{clusters:d,count:d.length,threshold:r,cost:{item_count:s.length,algorithm:t.exhaustive===!0||r===0?"exhaustive":"prefix_exact",possible_pairs:s.length*(s.length-1)/2,pair_limit:U,recall_guarantee:"exact",candidate_pairs:o.size,scored_pairs:o.size}}}async function ss(e={}){ue({...e,limit:void 0});let{since:t}=zt(e),{items:r,statuses:i}=await Xr(e,t);return{...Zr(r,e),source:"metadata_scan",filters:{statuses:i??null,since:e.since??null}}}async function os(e,t){if(t.mode==="off")return;let r=await Jr(e,t);if(r.count===0)return;let i=await Wr(r,t),n=t.mode==="strict"&&t.allowDuplicate===!0;if(t.mode==="strict"&&!n){let s=r.items.map(a=>`${a.id} (${a.status}): ${a.title}`).join("; "),o=i.action==="reopen"?"Reopen the canonical item":"Reuse the canonical item";throw new f(`Likely duplicate item(s) found: ${s}. ${o} or pass --allow-duplicate with explicit intent.`,m.CONFLICT,{code:"likely_duplicate",required:`${o}, or explicitly acknowledge the duplicate with --allow-duplicate.`,recovery:{suggested_flags:["--allow-duplicate"],suggested_retry:i.command,suggested_retry_args:i.args}})}return{mode:t.mode,bypassed:n,result:r,recovery:i}}(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]="f091d0c3-f2a7-5d76-8656-4aebe82e9798")}catch{}})();function ls(e,t){let r=t??{};return e.filter(i=>r[i.id]!==i.updated_at).map(i=>i.id).sort((i,n)=>i.localeCompare(n))}export{P as a,We as b,si as c,Z as d,K as e,Xe as f,Ye as g,tt as h,re as i,it as j,fi as k,pi as l,ot as m,at as n,gi as o,yt as p,se as q,ut as r,mt as s,_r as t,bt as u,wt as v,Wi as w,Xi as x,dn as y,Bt as z,Mn as A,An as B,is as C,ns as D,Jr as E,Zr as F,ss as G,os as H,ls as I};
|
|
2
|
-
//# sourceMappingURL=chunk-NFFPNMTH.js.map
|