@unbrained/pm-cli 2026.8.4 → 2026.8.5
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 +2 -2
- package/CHANGELOG.md +39 -13
- package/dist/cli/error-guidance.js +4 -4
- package/dist/cli/register-structured-mutation.d.ts +2 -0
- package/dist/cli/register-structured-mutation.js +124 -12
- package/dist/cli-bundle/bundle-manifest.json +407 -407
- package/dist/cli-bundle/chunks/append-VXXGOXSG.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-QVO3VTA4.js → chunk-2WFXWAYX.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-NM5G7RLU.js → chunk-3FTILRJ2.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-VH2EAGUG.js → chunk-42E7YPLG.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-RB65T4RX.js → chunk-43HQQI6S.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-J4EPW4GT.js → chunk-45G53IU4.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-PQXEB7W4.js → chunk-4VN6GS4U.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-4YUBDMQM.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-D2MBVMVE.js → chunk-54FNT7U2.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-NRDKVOUE.js → chunk-5ZBOIPGP.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-3XZYTRPC.js → chunk-6MSQJOTG.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-GOICHIX4.js → chunk-7A5OT5J2.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-HTYC76A4.js → chunk-7C4PTJG6.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-BKMZTZYL.js → chunk-A62CYISG.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-5H47J5FG.js → chunk-BPELKUQD.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-HE3DZFN4.js → chunk-BXQLRKWF.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-BLINBTMX.js → chunk-CSI3WS5I.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-KH4GVBMC.js → chunk-DXDREUXT.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-KIKLF2W4.js → chunk-E2RKBKWB.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-377OOXUF.js → chunk-EGJ4JTUG.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-SULWTPQO.js → chunk-FPBQHMFT.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-V5K52PYW.js → chunk-GE4KCSZP.js} +35 -35
- package/dist/cli-bundle/chunks/{chunk-NPUJ7OLK.js → chunk-HNFD72UK.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-QMWUL66F.js → chunk-HWRRMBJO.js} +5 -5
- package/dist/cli-bundle/chunks/chunk-L3AZOELJ.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-CGY5I2GO.js → chunk-LKDGK44W.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-LN2WFEU4.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-ZSH4GNBH.js → chunk-M72BKL5Q.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-HQ2WU7OY.js → chunk-MHK6LIWE.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-H6FITE7D.js → chunk-NE5VRDAI.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-NY4T3JWN.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-DCJ6CM6F.js → chunk-OMXVBQ2N.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-OPVH7SKD.js +8 -0
- package/dist/cli-bundle/chunks/{chunk-CU5ENFNP.js → chunk-OTHLDSFP.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-NH35JNK5.js → chunk-PMXJEU3F.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-SVDH5CHC.js → chunk-Q35VBGOQ.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-5PZGZMPG.js → chunk-R546TPDE.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-Q5F6OI7C.js → chunk-RKAVWO3O.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-JMKVCQSE.js → chunk-SSF4PIUR.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-PA5XRN2A.js → chunk-UN66FZRO.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-FQ4EFFDU.js → chunk-UP7DTVMD.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-NFF3JAQR.js → chunk-UZBWIUYD.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-2POYGY53.js → chunk-V3774P7D.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-B5ZLCD5Z.js → chunk-V3EUXXOF.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-6S7I3UKV.js → chunk-VCKLFEUN.js} +19 -19
- package/dist/cli-bundle/chunks/{chunk-PYYPQLHC.js → chunk-VN5VITU3.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-WRL4KNDL.js +20 -0
- package/dist/cli-bundle/chunks/{chunk-UJHUR3LZ.js → chunk-XCEZYMNI.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-JDPKBV5P.js → chunk-YEWNL576.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-OB7TRZ2G.js → chunk-YSO3YFZ4.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-UVZREFZU.js → chunk-ZYHOB3SN.js} +2 -2
- package/dist/cli-bundle/chunks/close-VZ3OQPN5.js +2 -0
- package/dist/cli-bundle/chunks/close-many-SB4TI27P.js +2 -0
- package/dist/cli-bundle/chunks/comments-BIF3Q4KY.js +2 -0
- package/dist/cli-bundle/chunks/copy-6AI5Z57X.js +2 -0
- package/dist/cli-bundle/chunks/{create-RLLCBCXM.js → create-XLKTXTUF.js} +2 -2
- package/dist/cli-bundle/chunks/delete-ZY2VHQTP.js +2 -0
- package/dist/cli-bundle/chunks/{deps-J4ONTF4X.js → deps-ITTY3GIC.js} +2 -2
- package/dist/cli-bundle/chunks/{docs-YL2DJ4WD.js → docs-W4OSRTYR.js} +2 -2
- package/dist/cli-bundle/chunks/{files-NGNAIYKK.js → files-EOK4AZI4.js} +2 -2
- package/dist/cli-bundle/chunks/focus-DLBNWL7L.js +2 -0
- package/dist/cli-bundle/chunks/{history-compact-HW62K5XP.js → history-compact-7UGTMLL3.js} +2 -2
- package/dist/cli-bundle/chunks/{history-redact-HVBKUJOW.js → history-redact-4DZRMD6Z.js} +2 -2
- package/dist/cli-bundle/chunks/{history-repair-OPNBH5JJ.js → history-repair-UPOSZW5R.js} +2 -2
- package/dist/cli-bundle/chunks/{learnings-F36PZXT6.js → learnings-GMRNCBS3.js} +2 -2
- package/dist/cli-bundle/chunks/{profile-N3XMWBM7.js → profile-2MUUMHRE.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-BKGHBI7Y.js → register-list-query-LR3SQ5ZF.js} +2 -2
- package/dist/cli-bundle/chunks/register-mutation-SUOHFVWM.js +20 -0
- package/dist/cli-bundle/chunks/register-operations-ARRRKOVN.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-KWV6UD77.js → register-setup-O6AYP6NP.js} +2 -2
- package/dist/cli-bundle/chunks/restore-ZVCVHTB5.js +2 -0
- package/dist/cli-bundle/chunks/{schema-4PJQMGUY.js → schema-FJ4EA3XF.js} +2 -2
- package/dist/cli-bundle/chunks/update-YHV52CSS.js +2 -0
- package/dist/cli-bundle/chunks/update-many-M6YHVNXM.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-7J5TUBUJ.js +153 -0
- package/dist/cli-bundle/focused-chunks/{chunk-ONIX2KKW.js → chunk-A7BJ5SS6.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-B7LJWAZE.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-QM2BIVK7.js → chunk-BIMTMOS7.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{chunk-BOGRY7M6.js → chunk-FGKY4MBE.js} +10 -10
- package/dist/cli-bundle/focused-chunks/chunk-G6ETT4QK.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-C2QSL62X.js → chunk-GJ2TG2CW.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-RO5BQFG3.js → chunk-IPWSFADF.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-UFCPSWIL.js → chunk-MJ7HWSFK.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-2VIIXOAD.js → chunk-N5XU5UVK.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-PG2RIZBX.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-OYTK4VNH.js → chunk-PIMMYG7Q.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-K37BB4JL.js → chunk-QVHKCI4T.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-SQXVGHMH.js → chunk-RUR5I3TK.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-SV3O7TSH.js +8 -0
- package/dist/cli-bundle/focused-chunks/{chunk-L6A4NVQC.js → chunk-UIL2M2NA.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-WVGJAD7L.js → chunk-VLYOEYML.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-W7BJEWHX.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-DQ4PLKEE.js → chunk-WEM2E2PE.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-WVIVUWVL.js +5 -0
- package/dist/cli-bundle/focused-chunks/chunk-Y4LDYLLT.js +2 -0
- package/dist/cli-bundle/main.js +4 -4
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +28 -28
- 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 +1 -1
- 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 +1 -1
- package/dist/core/extensions/loader.js +5 -2
- package/dist/core/item/item-format.js +14 -20
- package/dist/core/shared/constants.js +3 -2
- package/dist/core/store/item-store.js +2 -2
- package/dist/core/store/settings.js +2 -2
- package/dist/mcp/server.js +12 -6
- package/dist/mcp/tool-definitions.js +14 -7
- package/dist/sdk/cli-contracts/agent-output-contracts.d.ts +18 -18
- package/dist/sdk/cli-contracts/agent-output-contracts.js +51 -23
- package/dist/sdk/cli-contracts/commander-mutation-options.js +26 -2
- package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
- package/dist/sdk/cli-contracts/flag-contracts.js +28 -2
- package/dist/sdk/cli-contracts/registration-helpers.js +4 -2
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +10 -2
- package/dist/sdk/cli-contracts/runtime-contracts.js +20 -5
- package/dist/sdk/cli-contracts/tool-schema.js +4 -2
- package/dist/sdk/cli-contracts.d.ts +2 -2
- package/dist/sdk/cli-contracts.js +4 -4
- package/dist/sdk/cli-program.js +3 -3
- package/dist/sdk/contracts.d.ts +1 -0
- package/dist/sdk/contracts.js +3 -2
- package/dist/sdk/dependency-provenance.d.ts +2 -0
- package/dist/sdk/dependency-provenance.js +7 -3
- package/dist/sdk/error-code-catalog.d.ts +23 -0
- package/dist/sdk/error-code-catalog.js +25 -5
- package/dist/sdk/generated-error-code-catalog.js +499 -3
- package/dist/sdk/graph/governance.js +3 -3
- package/dist/sdk/graph/remediation.js +3 -3
- package/dist/sdk/graph/run.js +4 -8
- package/dist/sdk/index.d.ts +2 -1
- package/dist/sdk/index.js +4 -3
- package/dist/sdk/item-transaction.d.ts +51 -6
- package/dist/sdk/item-transaction.js +132 -22
- package/dist/sdk/lifecycle/create.d.ts +4 -0
- package/dist/sdk/lifecycle/create.js +26 -10
- package/dist/sdk/lifecycle-policy.d.ts +9 -0
- package/dist/sdk/lifecycle-policy.js +22 -9
- package/dist/sdk/merge/driver.js +6 -3
- package/dist/sdk/output-contracts.d.ts +67 -0
- package/dist/sdk/output-contracts.js +173 -0
- package/dist/sdk/package-import-adapters.js +2 -2
- package/dist/sdk/structured-mutations.d.ts +23 -0
- package/dist/sdk/structured-mutations.js +219 -10
- package/dist/sdk/workspace-snapshot.js +58 -12
- package/dist/sdk/workspace.js +30 -4
- package/docs/COMMANDS.md +40 -10
- package/docs/EXTENSIONS.md +1 -1
- package/docs/MERGE_SAFETY.md +2 -0
- package/docs/PR_REVIEW_LOOP.md +10 -4
- package/docs/README.md +22 -22
- package/docs/RELEASING.md +3 -3
- package/docs/SCRIPTING.md +32 -9
- package/docs/SDK.md +91 -11
- package/docs/SELF_DESCRIBING_CONTEXT_CONTRACTS.md +13 -0
- package/docs/TESTING.md +25 -0
- package/docs/examples/sdk-contract-consumer/README.md +11 -1
- package/docs/examples/sdk-contract-consumer/package.json +2 -1
- package/docs/examples/sdk-contract-consumer/parse-receipt.mjs +22 -0
- package/marketplace.json +2 -2
- package/package.json +3 -2
- package/packages/pm-beads/package.json +1 -1
- 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/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-codex/.codex-plugin/plugin.json +1 -1
- package/sdk/public-surface.json +292 -14
- package/dist/cli-bundle/chunks/append-DHBRLHHS.js +0 -2
- package/dist/cli-bundle/chunks/chunk-2INN52SU.js +0 -8
- package/dist/cli-bundle/chunks/chunk-6RSK4IFN.js +0 -20
- package/dist/cli-bundle/chunks/chunk-ASJJKA57.js +0 -2
- package/dist/cli-bundle/chunks/chunk-IYAVULRN.js +0 -2
- package/dist/cli-bundle/chunks/chunk-RRQBHQOV.js +0 -2
- package/dist/cli-bundle/chunks/chunk-XBLOD5TZ.js +0 -2
- package/dist/cli-bundle/chunks/close-VLHNN6YB.js +0 -2
- package/dist/cli-bundle/chunks/close-many-LSJNZKU6.js +0 -2
- package/dist/cli-bundle/chunks/comments-AAIA6A6X.js +0 -2
- package/dist/cli-bundle/chunks/copy-Z7YMLEHN.js +0 -2
- package/dist/cli-bundle/chunks/delete-KNOHHQJM.js +0 -2
- package/dist/cli-bundle/chunks/focus-LFRCGALV.js +0 -2
- package/dist/cli-bundle/chunks/register-mutation-GU3DCECN.js +0 -20
- package/dist/cli-bundle/chunks/register-operations-PTWH727R.js +0 -2
- package/dist/cli-bundle/chunks/restore-4HZSLILR.js +0 -2
- package/dist/cli-bundle/chunks/update-E6LPS5IV.js +0 -2
- package/dist/cli-bundle/chunks/update-many-OSIC6KRO.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-5MTKO7TV.js +0 -153
- package/dist/cli-bundle/focused-chunks/chunk-6GIZK7VQ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-AOP2WIZZ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-CL75YW32.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-E7OFMWGT.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-I5F5UK3Q.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-T5TSY36R.js +0 -5
- package/dist/cli-bundle/focused-chunks/chunk-VT6BF2IX.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as oe,b as ae,c as de}from"./chunk-FQ4EFFDU.js";import{c as ie}from"./chunk-HE3DZFN4.js";import{f as se}from"./chunk-JDPKBV5P.js";import{q as H,r as W,v as Y,w as Q}from"./chunk-BKMZTZYL.js";import{A as c,Af as J,C as f,Da as v,Ea as T,Ef as Z,Gf as ee,La as j,Lf as te,Mf as ne,Nc as G,Nf as re,Oa as B,Pc as $,R as O,Rd as z,Sd as q,T as h,Td as M,U as x,V as C,Wd as V,b as D,cd as A,lc as U,v as N,xc as P,yf as X}from"./chunk-V5K52PYW.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="eb044a23-d43b-5e9c-9ae7-4ac91b5e587a")}catch{}})();function L(t,e="--limit"){if(t===void 0)return;let n=String(t).trim(),r=n.length===0?Number.NaN:Number(n);if(!Number.isInteger(r)||r<0)throw new f(`${e} must be a non-negative integer`,c.USAGE);return r}function le(t,e="--priority"){if(t===void 0)return;let n=String(t).trim(),r=n.length===0?Number.NaN:Number(n);if(!Number.isInteger(r)||r<0||r>4)throw new f(`${e} filter must be 0..4`,c.USAGE);return r}function qt(t,e,n="--type"){if(t===void 0)return;let r=T(t,e);if(!r)throw new f(`${n} filter must be one of ${e.types.join("|")}`,c.USAGE);return r}(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="1035bd62-b012-5249-bd53-31b39f21b2d3")}catch{}})();function k(t,e){if(t===void 0)return;let n=[],r="";for(let o=0;o<t.length;o+=1){let l=t[o];if(l==="\\"){let d=t[o+1];if(d===","||d==="\\"){r+=d,o+=1;continue}r+=l;continue}if(l===","){n.push(r),r="";continue}r+=l}n.push(r);let s=n.map(o=>o.trim());if(s.some(o=>o.length===0))throw new f(`${e.label} requires at least one non-empty value`,c.USAGE);let i=s.map(o=>e.normalize?.(o)??o);return[...new Set(i)]}function b(t,e){let n=k(t,e);return n===void 0?void 0:new Set(n)}function ue(t,e,n="--type"){let r=k(t,{label:n});if(r===void 0)return;let s=r.map(i=>{let o=T(i,e);if(!o)throw new f(`${n} filter token "${i}" must be one of ${e.types.join("|")}`,c.USAGE);return o});return new Set(s)}function ce(t,e="--priority"){let n=k(t,{label:e});if(n!==void 0)return new Set(n.map(r=>le(r,e)))}(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="03824e4b-562b-5e12-a89a-9dd091ae7fd3")}catch{}})();var _=["notes","learnings","files","docs","tests","comments","deps","body","linked_command"];function g(t){return Array.isArray(t)&&t.length>0}function je(t){return typeof t=="string"&&t.trim().length>0}function Be(t){return Array.isArray(t)?t.some(e=>{if(typeof e!="object"||e===null)return!1;let n=e.command;return typeof n=="string"&&n.trim().length>0}):!1}function me(t,e){switch(e){case"notes":return g(t.notes);case"learnings":return g(t.learnings);case"files":return g(t.files);case"docs":return g(t.docs);case"tests":return g(t.tests);case"comments":return g(t.comments);case"deps":return g(t.dependencies);case"body":return je(t.body);case"linked_command":return Be(t.tests)}}function ye(t){return _.some(e=>t[e]!==void 0)}function pe(t,e){for(let n of _){let r=e[n];if(r===void 0)continue;let s=me(t,n);if(r==="present"&&!s||r==="absent"&&s)return!1}return!0}function ge(t){return _.some(e=>e!=="body"&&t[e]!==void 0)}function _e(t){return t.body!==void 0}function fe(t,e){return e===0?100:Math.round(t/e*1e3)/10}function Ue(){let t={};for(let e of _)t[e]={present:0,total:0,percent:100};return t}function Zt(t){let e=Ue(),n=t.length;for(let o of t)for(let l of _)me(o,l)&&(e[l].present+=1);for(let o of _)e[o].total=n,e[o].percent=fe(e[o].present,n);let r=e.body,s=n-r.present,i={present:s,total:n,percent:fe(s,n)};return{total_items:n,fields:e,body_populated:r,empty_body:i}}(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="ec0c4c57-e3c2-54b3-bcf4-b4ab3b1d964e")}catch{}})();var Pe=t=>({acMissing:t.filterAcMissing===!0,estimatesMissing:t.filterEstimatesMissing===!0,resolutionMissing:t.filterResolutionMissing===!0,metadataMissing:t.filterMetadataMissing===!0,reviewerMissing:t.filterReviewerMissing===!0,riskMissing:t.filterRiskMissing===!0,confidenceMissing:t.filterConfidenceMissing===!0,sprintMissing:t.filterSprintMissing===!0,releaseMissing:t.filterReleaseMissing===!0}),he=[{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"}],Ke=t=>{let e=he.find(n=>t[n.presentKey]===!0&&t[n.absentKey]===!0);if(e)throw new f(`Cannot combine ${e.presentFlag} with ${e.absentFlag} for the same field.`,c.USAGE);return Object.fromEntries(he.flatMap(n=>t[n.presentKey]===!0?[[n.field,"present"]]:t[n.absentKey]===!0?[[n.field,"absent"]]:[]))},be=["priority","deadline","updated_at","created_at","title","parent"],Fe=["asc","desc"],Ge=["id","title","status","type","priority","parent","updated_at"],$e=["id","status","type","title"],An={list:"brief","list-all":"full","list-draft":"full","list-open":"brief","list-in-progress":"brief","list-blocked":"brief","list-closed":"full","list-canceled":"full"},ze=["tree_depth","tree_parent","tree_children","tree_title"],we=new Set(Z);function qe(t,e,n){let r=t.filter(o=>o.startsWith("item_list_item_read_failed:")).length,s=t.filter(o=>o.startsWith("item_list_directory_read_failed:")).length,i={status:e?"unchecked":r+s>0?"partial":"complete",unreadable_item_count:r,unreadable_directory_count:s};if(n&&i.status==="partial")throw new f(`List source is incomplete: ${r} item document(s) and ${s} item directory/directories could not be read.`,c.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 i}function Ve(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&Object.keys(t).length>0}var He=[{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"}],We=[{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 Te(t,e){for(let n of He)e[n.key]===!0&&(t[n.summaryKey]=!0)}function Ae(t,e){for(let n of We)e[n.key]===!0&&(t[n.summaryKey]=!0)}function Ye(t,e,n){for(let r of n){let s=e[r.optionKey];s!==void 0&&(t[r.summaryKey]=r.normalize?r.normalize(s):s)}}function Qe(t){let e={};return Te(e,t),e}function Xe(t){let e={};return Ae(e,t),e}var Je=[{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"}],Ze=[{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"}],et=[{key:"filterAcMissing",summaryKey:"filter_ac_missing"},{key:"filterEstimatesMissing",summaryKey:"filter_estimates_missing"},{key:"filterResolutionMissing",summaryKey:"filter_resolution_missing"},{key:"filterMetadataMissing",summaryKey:"filter_metadata_missing"}],tt="-7d";function nt(t){let{filtersStatus:e,options:n,treeEnabled:r,treeDepth:s,sortField:i,sortOrder:o,runtimeFieldFilters:l}=t,d={};return e!==null&&(d.status=e),n.dependencyBlocked===!0&&(d.blocked_semantics="status_or_dependency"),Ye(d,n,Je),Ie(d,n),n.filterAcMissing===!0&&(d.filter_ac_missing=!0),n.filterEstimatesMissing===!0&&(d.filter_estimates_missing=!0),n.filterResolutionMissing===!0&&(d.filter_resolution_missing=!0),n.filterMetadataMissing===!0&&(d.filter_metadata_missing=!0),Ae(d,n),Te(d,n),n.limit!==void 0&&(d.limit=n.limit),n.offset!==void 0&&(d.offset=n.offset),n.includeBody===!0&&(d.include_body=!0),n.fields!==void 0&&(d.fields=n.fields),r&&(d.tree=!0,s!==void 0&&(d.tree_depth=s)),i!==void 0&&(d.sort=i,d.order=o),Ve(l)&&(d.runtime_filters=l),d}function Le(t,e,n){let r=A(t.status,n),s=A(e.status,n);if(r!==s)return r?1:-1;let i=t.priority-e.priority;if(i!==0)return i;let o=h(e.updated_at,t.updated_at);return o!==0?o:(t.id??"").localeCompare(e.id??"")}function rt(t,e){return[...t].sort((n,r)=>Le(n,r,e))}function Se(t,e){if(t!==void 0)return C(t,new Date,e)}function F(t,e){if(t==null)return;let n=String(t).trim();if(n.length!==0)return C(n,new Date,e)}function st(t){let e=t.updatedAfter!=null&&String(t.updatedAfter).trim().length>0;if([t.today===!0,t.recent===!0,e].filter(r=>r).length>1)throw new f("Choose only one updated_at window: --today, --recent, or --updated-after.",c.USAGE);if(t.today===!0){let r=new Date;return r.setHours(0,0,0,0),r.toISOString()}return t.recent===!0?F(tt,"recent"):F(t.updatedAfter,"updated-after")}function Ie(t,e){e.today===!0&&(t.today=!0),e.recent===!0&&(t.recent=!0)}function it(t){if(t==null)return;let e=String(t).trim();if(e.length===0)throw new f("--ids requires at least one non-empty item ID",c.USAGE);let n=e.split(",").map(r=>r.trim()).filter(r=>r.length>0);if(n.length===0)throw new f("--ids requires at least one non-empty item ID",c.USAGE);return new Set(n)}function Ce(t){if(t===void 0)return;let e=String(t).trim(),n=e.length===0?Number.NaN:Number(e);if(!Number.isInteger(n)||n<0)throw new f("Offset filter must be a non-negative integer",c.USAGE);return n}function ot(t){if(t===void 0)return;let e=t.split(",").map(n=>n.trim()).filter(n=>n.length>0);if(e.length===0)throw new f("List --fields requires a comma-separated list of field names",c.USAGE);return[...new Set(e)]}function at(t){let e=t.compact===!0,n=t.brief===!0,r=t.full===!0,s=ot(t.fields);if(Number(e)+Number(n)+Number(r)+ +(s!==void 0)>1)throw new f("List projection options are mutually exclusive. Use one of --compact, --brief, --full, or --fields.",c.USAGE);return r?{mode:"full",fields:[]}:n?{mode:"brief",fields:[...$e]}:e?{mode:"compact",fields:[...Ge]}:s?{mode:"fields",fields:s}:{mode:"full",fields:[]}}function S(t){return t.startsWith("item.")?t.slice(5):t}function dt(t,e){if(t.mode!=="fields")return;let n=new Set([...N,"body",...ze,...e]),r=t.fields.filter(s=>!n.has(S(s)));if(r.length>0)throw new f(`Unknown list --fields value(s): ${r.join(", ")}`,c.USAGE,{code:"unknown_field_projection",examples:["pm list-open --fields id,title,status,type,updated_at","pm list --fields id,title,parent,priority --limit 10","pm list-all --fields id,title,body --limit 5"]})}var lt=new Map([["updated","updated_at"],["update","updated_at"],["modified","updated_at"],["created","created_at"],["create","created_at"]]);function ut(t){if(t===void 0)return;let e=t.trim().toLowerCase(),n=lt.get(e);if(n)return n;if(!be.includes(e))throw new f(`Sort field must be one of ${be.join("|")} (aliases: updated->updated_at, created->created_at)`,c.USAGE);return e}function ct(t){if(t===void 0)return;let e=t.trim().toLowerCase();if(!Fe.includes(e))throw new f(`Sort order must be one of ${Fe.join("|")}`,c.USAGE);return e}function ft(t){return L(t,"--tree-depth")}function mt(t){if(t===void 0)return;let e=t.trim().toLowerCase();if(!e)throw new f("Assignee filter must be one of assigned|unassigned",c.USAGE);if(e!=="assigned"&&e!=="unassigned")throw new f(`Invalid assignee filter "${t}". Allowed: assigned|unassigned`,c.USAGE);return e}function Ee(t,e){return W(t,e,{strict:!0})}function Me(t){return b(t,{label:"--tag",normalize:e=>e.toLowerCase()})}function yt(t,e,n){let r=Me(e);if(r===void 0)return;let s=new Set(t.flatMap(o=>o.tags.map(l=>l.trim().toLowerCase()))),i=[...r].filter(o=>!s.has(o));i.length>0&&n.push(`unknown_tags:${i.join(",")}`)}function pt(t,e){if(t&&[...t].some(n=>n.toLowerCase()==="none"||n.toLowerCase()==="null"))throw new f('--assignee no longer accepts "none" or "null". Use --assignee-filter unassigned.',c.USAGE);if(t!==void 0&&e==="unassigned")throw new f("Cannot combine --assignee with --assignee-filter unassigned",c.USAGE)}function gt(t,e,n,r){let s=b(e.assignee,{label:"--assignee"}),i=mt(e.assigneeFilter);pt(s,i);let o=Pe(e),l=Ke(e);return{idsFilter:it(e.ids),statusSet:t&&t.length>0?new Set(t):void 0,excludeTerminal:e.excludeTerminal===!0,typeFilter:ue(e.type,n),tagFilters:Me(e.tag),priorityFilter:ce(e.priority),deadlineBefore:Se(e.deadlineBefore,"deadline-before"),deadlineAfter:Se(e.deadlineAfter,"deadline-after"),updatedAfter:st(e),updatedBefore:F(e.updatedBefore,"updated-before"),createdAfter:F(e.createdAfter,"created-after"),createdBefore:F(e.createdBefore,"created-before"),assigneeFilter:s,assigneeModeFilter:i,parentFilter:e.parent?.trim(),treeEnabled:e.tree===!0,sprintFilter:b(e.sprint,{label:"--sprint"}),releaseFilter:b(e.release,{label:"--release"}),missingMetadataFilters:o,missingMetadataActive:ae(o),lifecycleClassifier:oe(r),contentFieldFilters:l,contentFiltersActive:ye(l)}}function _t(t,e,n){return ht(t,e,n)&&bt(t,e)&&Ft(t,e)&&St(t,e)}function ht(t,e,n){return e.idsFilter&&!e.idsFilter.has(t.id)||e.statusSet&&!e.statusSet.has(t.status)||e.excludeTerminal&&A(t.status,n)||e.typeFilter&&!e.typeFilter.has(t.type)||e.tagFilters&&![...e.tagFilters].some(r=>(t.tags??[]).some(s=>s.trim().toLowerCase()===r))?!1:e.priorityFilter===void 0||e.priorityFilter.has(t.priority)}function bt(t,e){return x(t,e)}function Ft(t,e){return e.assigneeModeFilter==="assigned"&&!t.assignee||e.assigneeModeFilter==="unassigned"&&t.assignee?!1:e.assigneeFilter===void 0||t.assignee!==void 0&&e.assigneeFilter.has(t.assignee)}function St(t,e){return e.parentFilter!==void 0&&!e.treeEnabled&&t.parent!==e.parentFilter||e.sprintFilter!==void 0&&(t.sprint===void 0||!e.sprintFilter.has(t.sprint))?!1:e.releaseFilter===void 0||t.release!==void 0&&e.releaseFilter.has(t.release)}function Et(t,e,n,r){return!(!_t(t,e,n)||e.missingMetadataActive&&!de(t,e.missingMetadataFilters,e.lifecycleClassifier)||e.contentFiltersActive&&!pe(t,e.contentFieldFilters)||!Q(t,r))}function Kt(t,e,n,r,s,i){let o=gt(e,n,r,s);return t.filter(l=>Et(l,o,s,i))}function I(t){if(typeof t!="string")return;let e=t.trim();return e.length>0?e:void 0}function wt(t,e,n){let r=t,s=typeof r.title=="string"?r.title:"",i=I(typeof r.parent=="string"?r.parent:void 0)??null;return{...t,tree_depth:e,tree_parent:i,tree_children:n,tree_title:`${" ".repeat(e)}${s}`}}function Tt(t,e,n){let r=new Map,s=new Map;for(let a of t){r.set(a.id,a);let m=I(a.parent);if(!m)continue;let u=s.get(m);u?u.push(a):s.set(m,[a])}let i=e?[...s.get(e)??[]]:t.filter(a=>{let m=I(a.parent);return!m||!r.has(m)}),o=[],l=new Set,d=(a,m)=>{if(l.has(a.id))return;l.add(a.id);let u=s.get(a.id)??[];if(o.push(wt(a,m,u.length)),!(n!==void 0&&m>=n))for(let p of u)d(p,m+1)};for(let a of i)d(a,0);return o}function At(t,e){return t===e?0:t===null?1:e===null?-1:t.localeCompare(e)}function Lt(t,e){return t===e?0:t===null?1:e===null?-1:h(t,e)}function It(t,e,n){switch(n){case"priority":return t.priority-e.priority;case"deadline":return Lt(t.deadline??null,e.deadline??null);case"updated_at":return h(t.updated_at,e.updated_at);case"created_at":return h(t.created_at,e.created_at);case"title":return(t.title??"").localeCompare(e.title??"");case"parent":return At(t.parent??null,e.parent??null);default:return 0}}function Ct(t,e,n,r){return e?[...t].sort((s,i)=>{let o=It(s,i,e);if(o!==0)return n==="desc"?-o:o;let l=Le(s,i,r);return n==="desc"?-l:l}):rt(t,r)}function Mt(t,e,n=!1){let r=S(e.trim());if(r.length===0)return null;let s=t;return n&&r==="title"&&typeof s.tree_title=="string"?s.tree_title:Object.prototype.hasOwnProperty.call(s,r)?s[r]??null:null}function ke(t,e,n=!1){return e.mode==="full"?t:t.map(r=>{let s={};for(let i of e.fields)s[i]=Mt(r,i,n);return s})}function kt(t){let e=[];for(let n of t)e.push(n.metadata_key);return e}function Rt(t,e){if(t.noTruncate!==!0)return L(t.limit)??(e>=1e4?20:void 0)}function Dt(t,e,n){return e.after===void 0?Ce(e.offset)??0:V(t,e.after,n,r=>r.id)}function Re(t,e,n){return{...t!==void 0?{applied_limit:t}:{},has_more:e,truncated:e,next_cursor:n??null}}async function Nt(t,e){let n=j(process.cwd(),e.path);if(!await D(B(n)))throw new f(`Tracker is not initialized at ${n}. Run pm init first.`,c.NOT_FOUND);let r=await X(n),s=G(r.schema),i=$(r.schema),o=at(t);return dt(o,kt(i.definitions)),{pmRoot:n,settings:r,statusRegistry:s,runtimeFieldFilters:Y(t,i,"list"),typeRegistry:v(r,U()),projection:o}}async function Ot(t,e,n){let r=e.projection.fields.some(d=>S(d)==="body"),s=e.projection.mode==="full"||e.projection.fields.some(d=>we.has(S(d))),i=Ke(t),o=ge(i),l=_e(i);return t.includeBody||r||l?await re(e.pmRoot,e.settings.item_format,e.typeRegistry.type_to_folder,n,e.settings.schema):s||o?await te(e.pmRoot,e.settings.item_format,e.typeRegistry.type_to_folder,n,e.settings.schema):await ne(e.pmRoot,e.settings.item_format,e.typeRegistry.type_to_folder,n,e.settings.schema)}function xt(t){let e=ut(t.sort),n=ct(t.order)??"asc",r=t.tree===!0;if(!r&&t.treeDepth!==void 0)throw new f("List --tree-depth requires --tree",c.USAGE);if(!e&&t.order!==void 0)throw new f("List --order requires --sort",c.USAGE);return{sortField:e,sortOrder:n,treeEnabled:r,treeDepth:r?ft(t.treeDepth):void 0,parentRoot:r?I(t.parent):void 0}}function vt(t,e,n){let r=Ee(e.status,n),s=r??Ee(t,n),i=H(e.status),o=r||i?{...e,excludeTerminal:!1}:e,l=i?"all":s===void 0?o.excludeTerminal===!0?null:"all":s.length===1?s[0]:s;return{resolvedStatus:s,explicitAllStatuses:i,effectiveOptions:o,filtersStatus:l}}function jt(t,e,n,r,s){if(e.after!==void 0&&e.offset!==void 0)throw new f("List --after cannot be combined with --offset.",c.USAGE);let i=Rt(e,t.length),o=Dt(t,e,s),l=i===void 0?t.slice(o):t.slice(o,o+i),d=ke(l,n,r),a=t.length,m=l.length>0&&o+l.length<a,u=m&&l.length>0?M(s,l[l.length-1].id,o+l.length-1):void 0;return{projected:d,totalMatched:a,pageExtras:Re(i,m,u)}}function De(t,e,n){return q("list",{status:t,options:z(e,se),sort:n.sortField??"default",order:n.sortOrder,tree:n.treeEnabled,tree_depth:n.treeDepth??null})}async function Bt(t){let{options:e,runtime:n,statusSelection:r,ordering:s}=t,i=new Set(["status","limit","offset","compact","brief","full","fields","format","stream","includeBody","excludeTerminal","noTruncate"]),o=[n.projection.mode==="full",n.projection.fields.some(K=>{let y=S(K);return y==="body"||we.has(y)})].includes(!0);if([e.limit===void 0,e.after!==void 0,e.noTruncate===!0,e.includeBody===!0,e.dependencyBlocked===!0,e.strictRead===!0,s.treeEnabled,s.sortField!==void 0,o,P(),Object.keys(n.runtimeFieldFilters).length>0,Object.entries(e).some(([K,y])=>y!==void 0&&!i.has(K))].includes(!0))return null;let d=await ee(n.pmRoot,[...new Set(Object.values(n.typeRegistry.type_to_folder))]);if(!d)return null;let a=L(e.limit),m=Ce(e.offset)??0,u=await J({pmRoot:n.pmRoot,expectedSourceCursor:d.source_cursor,query:{statuses:r.resolvedStatus,excludeStatuses:r.resolvedStatus===void 0&&r.effectiveOptions.excludeTerminal===!0?[...n.statusRegistry.terminal_statuses]:void 0,terminalStatuses:[...n.statusRegistry.terminal_statuses],limit:a,offset:m}});if(!u)return null;let p=u.items.length>0&&m+u.items.length<u.total,E=p?M(De(r.filtersStatus,e,s),u.items.at(-1).id,m+u.items.length-1):void 0;return{projected:ke(u.items,n.projection,!1),totalMatched:u.total,pageExtras:Re(a,p,E)}}function Ut(t){let{filtersStatus:e,options:n,noTruncate:r,treeEnabled:s,treeDepth:i,sortField:o,sortOrder:l,runtimeFieldFilters:d}=t,a={};e!==null&&(a.status=e),n.dependencyBlocked===!0&&(a.blocked_semantics="status_or_dependency");let m=n;for(let u of Ze){let p=m[u.optionKey];p!=null&&(a[u.summaryKey]=p)}for(let u of et)m[u.key]===!0&&(a[u.summaryKey]=!0);return Object.assign(a,Xe(n),Qe(n)),Ie(a,n),r&&(a.no_truncate=!0),s&&(a.tree=!0,i!==void 0&&(a.tree_depth=i)),o!==void 0&&(a.sort=o,a.order=l),a.runtime_filters=d,a}async function Ln(t,e,n){let r=await Nt(e,n),s=[],i=xt(e),o=vt(t,e,r.statusRegistry),l=e.noTruncate===!0,d=await Bt({options:e,runtime:r,statusSelection:o,ordering:i}),a=d;if(!a){let y=await Ot(e,r,s);yt(y,e.tag,s);let w=Kt(y,o.resolvedStatus,o.effectiveOptions,r.typeRegistry,r.statusRegistry,r.runtimeFieldFilters),Ne=e.dependencyBlocked===!0?(()=>{let xe=ie(y,r.statusRegistry);return w.filter(ve=>xe.has(ve.id.trim().toLowerCase()))})():w,R=Ct(Ne,i.sortField,i.sortOrder,r.statusRegistry),Oe=i.treeEnabled?Tt(R,i.parentRoot,i.treeDepth):R;a=jt(Oe,e,r.projection,i.treeEnabled,De(o.filtersStatus,e,i))}let m=O(),u=[...new Set(s)].sort((y,w)=>y.localeCompare(w)),p=qe(u,d!==null,e.strictRead===!0),E=r.projection.mode==="full"?null:[...r.projection.fields];if(r.projection.mode==="compact"&&e.compact===!0){let y=nt({filtersStatus:o.filtersStatus,options:e,treeEnabled:i.treeEnabled,treeDepth:i.treeDepth,sortField:i.sortField,sortOrder:i.sortOrder,runtimeFieldFilters:r.runtimeFieldFilters});return{items:a.projected,count:a.projected.length,total:a.totalMatched,...a.pageExtras,completeness:p,filters:y,projection:{mode:"compact",fields:E},...u.length>0?{warnings:u}:{}}}return{items:a.projected,count:a.projected.length,total:a.totalMatched,...a.pageExtras,completeness:p,filters:Ut({filtersStatus:o.filtersStatus,options:e,noTruncate:l,treeEnabled:i.treeEnabled,treeDepth:i.treeDepth,sortField:i.sortField,sortOrder:i.sortOrder,runtimeFieldFilters:r.runtimeFieldFilters}),projection:{mode:r.projection.mode,fields:E},sorting:{sort:i.sortField??"default",order:i.sortField?i.sortOrder:"asc"},now:m,...u.length>0?{warnings:u}:{}}}export{L as a,le as b,qt as c,k as d,b as e,ue as f,ce as g,ye as h,pe as i,Zt as j,Pe as k,Ke as l,be as m,Fe as n,Ge as o,$e as p,An as q,Ye as r,Qe as s,Xe as t,Ln as u};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as oe,b as ae,c as de}from"./chunk-UP7DTVMD.js";import{c as ie}from"./chunk-BXQLRKWF.js";import{f as se}from"./chunk-YEWNL576.js";import{q as H,r as W,v as Y,w as Q}from"./chunk-A62CYISG.js";import{A as c,Af as X,C as f,Cf as J,Da as v,Ea as T,Gf as Z,If as ee,La as j,Nc as G,Nf as te,Oa as B,Of as ne,Pc as $,Pf as re,R as O,Rd as z,Sd as q,T as h,Td as M,U as x,V as C,Wd as V,b as D,cd as A,lc as U,v as N,xc as P}from"./chunk-GE4KCSZP.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="eb044a23-d43b-5e9c-9ae7-4ac91b5e587a")}catch{}})();function L(t,e="--limit"){if(t===void 0)return;let n=String(t).trim(),r=n.length===0?Number.NaN:Number(n);if(!Number.isInteger(r)||r<0)throw new f(`${e} must be a non-negative integer`,c.USAGE);return r}function le(t,e="--priority"){if(t===void 0)return;let n=String(t).trim(),r=n.length===0?Number.NaN:Number(n);if(!Number.isInteger(r)||r<0||r>4)throw new f(`${e} filter must be 0..4`,c.USAGE);return r}function qt(t,e,n="--type"){if(t===void 0)return;let r=T(t,e);if(!r)throw new f(`${n} filter must be one of ${e.types.join("|")}`,c.USAGE);return r}(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="1035bd62-b012-5249-bd53-31b39f21b2d3")}catch{}})();function k(t,e){if(t===void 0)return;let n=[],r="";for(let o=0;o<t.length;o+=1){let l=t[o];if(l==="\\"){let d=t[o+1];if(d===","||d==="\\"){r+=d,o+=1;continue}r+=l;continue}if(l===","){n.push(r),r="";continue}r+=l}n.push(r);let s=n.map(o=>o.trim());if(s.some(o=>o.length===0))throw new f(`${e.label} requires at least one non-empty value`,c.USAGE);let i=s.map(o=>e.normalize?.(o)??o);return[...new Set(i)]}function b(t,e){let n=k(t,e);return n===void 0?void 0:new Set(n)}function ue(t,e,n="--type"){let r=k(t,{label:n});if(r===void 0)return;let s=r.map(i=>{let o=T(i,e);if(!o)throw new f(`${n} filter token "${i}" must be one of ${e.types.join("|")}`,c.USAGE);return o});return new Set(s)}function ce(t,e="--priority"){let n=k(t,{label:e});if(n!==void 0)return new Set(n.map(r=>le(r,e)))}(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="03824e4b-562b-5e12-a89a-9dd091ae7fd3")}catch{}})();var _=["notes","learnings","files","docs","tests","comments","deps","body","linked_command"];function g(t){return Array.isArray(t)&&t.length>0}function je(t){return typeof t=="string"&&t.trim().length>0}function Be(t){return Array.isArray(t)?t.some(e=>{if(typeof e!="object"||e===null)return!1;let n=e.command;return typeof n=="string"&&n.trim().length>0}):!1}function me(t,e){switch(e){case"notes":return g(t.notes);case"learnings":return g(t.learnings);case"files":return g(t.files);case"docs":return g(t.docs);case"tests":return g(t.tests);case"comments":return g(t.comments);case"deps":return g(t.dependencies);case"body":return je(t.body);case"linked_command":return Be(t.tests)}}function ye(t){return _.some(e=>t[e]!==void 0)}function pe(t,e){for(let n of _){let r=e[n];if(r===void 0)continue;let s=me(t,n);if(r==="present"&&!s||r==="absent"&&s)return!1}return!0}function ge(t){return _.some(e=>e!=="body"&&t[e]!==void 0)}function _e(t){return t.body!==void 0}function fe(t,e){return e===0?100:Math.round(t/e*1e3)/10}function Ue(){let t={};for(let e of _)t[e]={present:0,total:0,percent:100};return t}function Zt(t){let e=Ue(),n=t.length;for(let o of t)for(let l of _)me(o,l)&&(e[l].present+=1);for(let o of _)e[o].total=n,e[o].percent=fe(e[o].present,n);let r=e.body,s=n-r.present,i={present:s,total:n,percent:fe(s,n)};return{total_items:n,fields:e,body_populated:r,empty_body:i}}(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="ec0c4c57-e3c2-54b3-bcf4-b4ab3b1d964e")}catch{}})();var Pe=t=>({acMissing:t.filterAcMissing===!0,estimatesMissing:t.filterEstimatesMissing===!0,resolutionMissing:t.filterResolutionMissing===!0,metadataMissing:t.filterMetadataMissing===!0,reviewerMissing:t.filterReviewerMissing===!0,riskMissing:t.filterRiskMissing===!0,confidenceMissing:t.filterConfidenceMissing===!0,sprintMissing:t.filterSprintMissing===!0,releaseMissing:t.filterReleaseMissing===!0}),he=[{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"}],Ke=t=>{let e=he.find(n=>t[n.presentKey]===!0&&t[n.absentKey]===!0);if(e)throw new f(`Cannot combine ${e.presentFlag} with ${e.absentFlag} for the same field.`,c.USAGE);return Object.fromEntries(he.flatMap(n=>t[n.presentKey]===!0?[[n.field,"present"]]:t[n.absentKey]===!0?[[n.field,"absent"]]:[]))},be=["priority","deadline","updated_at","created_at","title","parent"],Fe=["asc","desc"],Ge=["id","title","status","type","priority","parent","updated_at"],$e=["id","status","type","title"],An={list:"brief","list-all":"full","list-draft":"full","list-open":"brief","list-in-progress":"brief","list-blocked":"brief","list-closed":"full","list-canceled":"full"},ze=["tree_depth","tree_parent","tree_children","tree_title"],we=new Set(Z);function qe(t,e,n){let r=t.filter(o=>o.startsWith("item_list_item_read_failed:")).length,s=t.filter(o=>o.startsWith("item_list_directory_read_failed:")).length,i={status:e?"unchecked":r+s>0?"partial":"complete",unreadable_item_count:r,unreadable_directory_count:s};if(n&&i.status==="partial")throw new f(`List source is incomplete: ${r} item document(s) and ${s} item directory/directories could not be read.`,c.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 i}function Ve(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&Object.keys(t).length>0}var He=[{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"}],We=[{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 Te(t,e){for(let n of He)e[n.key]===!0&&(t[n.summaryKey]=!0)}function Ae(t,e){for(let n of We)e[n.key]===!0&&(t[n.summaryKey]=!0)}function Ye(t,e,n){for(let r of n){let s=e[r.optionKey];s!==void 0&&(t[r.summaryKey]=r.normalize?r.normalize(s):s)}}function Qe(t){let e={};return Te(e,t),e}function Xe(t){let e={};return Ae(e,t),e}var Je=[{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"}],Ze=[{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"}],et=[{key:"filterAcMissing",summaryKey:"filter_ac_missing"},{key:"filterEstimatesMissing",summaryKey:"filter_estimates_missing"},{key:"filterResolutionMissing",summaryKey:"filter_resolution_missing"},{key:"filterMetadataMissing",summaryKey:"filter_metadata_missing"}],tt="-7d";function nt(t){let{filtersStatus:e,options:n,treeEnabled:r,treeDepth:s,sortField:i,sortOrder:o,runtimeFieldFilters:l}=t,d={};return e!==null&&(d.status=e),n.dependencyBlocked===!0&&(d.blocked_semantics="status_or_dependency"),Ye(d,n,Je),Ie(d,n),n.filterAcMissing===!0&&(d.filter_ac_missing=!0),n.filterEstimatesMissing===!0&&(d.filter_estimates_missing=!0),n.filterResolutionMissing===!0&&(d.filter_resolution_missing=!0),n.filterMetadataMissing===!0&&(d.filter_metadata_missing=!0),Ae(d,n),Te(d,n),n.limit!==void 0&&(d.limit=n.limit),n.offset!==void 0&&(d.offset=n.offset),n.includeBody===!0&&(d.include_body=!0),n.fields!==void 0&&(d.fields=n.fields),r&&(d.tree=!0,s!==void 0&&(d.tree_depth=s)),i!==void 0&&(d.sort=i,d.order=o),Ve(l)&&(d.runtime_filters=l),d}function Le(t,e,n){let r=A(t.status,n),s=A(e.status,n);if(r!==s)return r?1:-1;let i=t.priority-e.priority;if(i!==0)return i;let o=h(e.updated_at,t.updated_at);return o!==0?o:(t.id??"").localeCompare(e.id??"")}function rt(t,e){return[...t].sort((n,r)=>Le(n,r,e))}function Se(t,e){if(t!==void 0)return C(t,new Date,e)}function F(t,e){if(t==null)return;let n=String(t).trim();if(n.length!==0)return C(n,new Date,e)}function st(t){let e=t.updatedAfter!=null&&String(t.updatedAfter).trim().length>0;if([t.today===!0,t.recent===!0,e].filter(r=>r).length>1)throw new f("Choose only one updated_at window: --today, --recent, or --updated-after.",c.USAGE);if(t.today===!0){let r=new Date;return r.setHours(0,0,0,0),r.toISOString()}return t.recent===!0?F(tt,"recent"):F(t.updatedAfter,"updated-after")}function Ie(t,e){e.today===!0&&(t.today=!0),e.recent===!0&&(t.recent=!0)}function it(t){if(t==null)return;let e=String(t).trim();if(e.length===0)throw new f("--ids requires at least one non-empty item ID",c.USAGE);let n=e.split(",").map(r=>r.trim()).filter(r=>r.length>0);if(n.length===0)throw new f("--ids requires at least one non-empty item ID",c.USAGE);return new Set(n)}function Ce(t){if(t===void 0)return;let e=String(t).trim(),n=e.length===0?Number.NaN:Number(e);if(!Number.isInteger(n)||n<0)throw new f("Offset filter must be a non-negative integer",c.USAGE);return n}function ot(t){if(t===void 0)return;let e=t.split(",").map(n=>n.trim()).filter(n=>n.length>0);if(e.length===0)throw new f("List --fields requires a comma-separated list of field names",c.USAGE);return[...new Set(e)]}function at(t){let e=t.compact===!0,n=t.brief===!0,r=t.full===!0,s=ot(t.fields);if(Number(e)+Number(n)+Number(r)+ +(s!==void 0)>1)throw new f("List projection options are mutually exclusive. Use one of --compact, --brief, --full, or --fields.",c.USAGE);return r?{mode:"full",fields:[]}:n?{mode:"brief",fields:[...$e]}:e?{mode:"compact",fields:[...Ge]}:s?{mode:"fields",fields:s}:{mode:"full",fields:[]}}function S(t){return t.startsWith("item.")?t.slice(5):t}function dt(t,e){if(t.mode!=="fields")return;let n=new Set([...N,"body",...ze,...e]),r=t.fields.filter(s=>!n.has(S(s)));if(r.length>0)throw new f(`Unknown list --fields value(s): ${r.join(", ")}`,c.USAGE,{code:"unknown_field_projection",examples:["pm list-open --fields id,title,status,type,updated_at","pm list --fields id,title,parent,priority --limit 10","pm list-all --fields id,title,body --limit 5"]})}var lt=new Map([["updated","updated_at"],["update","updated_at"],["modified","updated_at"],["created","created_at"],["create","created_at"]]);function ut(t){if(t===void 0)return;let e=t.trim().toLowerCase(),n=lt.get(e);if(n)return n;if(!be.includes(e))throw new f(`Sort field must be one of ${be.join("|")} (aliases: updated->updated_at, created->created_at)`,c.USAGE);return e}function ct(t){if(t===void 0)return;let e=t.trim().toLowerCase();if(!Fe.includes(e))throw new f(`Sort order must be one of ${Fe.join("|")}`,c.USAGE);return e}function ft(t){return L(t,"--tree-depth")}function mt(t){if(t===void 0)return;let e=t.trim().toLowerCase();if(!e)throw new f("Assignee filter must be one of assigned|unassigned",c.USAGE);if(e!=="assigned"&&e!=="unassigned")throw new f(`Invalid assignee filter "${t}". Allowed: assigned|unassigned`,c.USAGE);return e}function Ee(t,e){return W(t,e,{strict:!0})}function Me(t){return b(t,{label:"--tag",normalize:e=>e.toLowerCase()})}function yt(t,e,n){let r=Me(e);if(r===void 0)return;let s=new Set(t.flatMap(o=>o.tags.map(l=>l.trim().toLowerCase()))),i=[...r].filter(o=>!s.has(o));i.length>0&&n.push(`unknown_tags:${i.join(",")}`)}function pt(t,e){if(t&&[...t].some(n=>n.toLowerCase()==="none"||n.toLowerCase()==="null"))throw new f('--assignee no longer accepts "none" or "null". Use --assignee-filter unassigned.',c.USAGE);if(t!==void 0&&e==="unassigned")throw new f("Cannot combine --assignee with --assignee-filter unassigned",c.USAGE)}function gt(t,e,n,r){let s=b(e.assignee,{label:"--assignee"}),i=mt(e.assigneeFilter);pt(s,i);let o=Pe(e),l=Ke(e);return{idsFilter:it(e.ids),statusSet:t&&t.length>0?new Set(t):void 0,excludeTerminal:e.excludeTerminal===!0,typeFilter:ue(e.type,n),tagFilters:Me(e.tag),priorityFilter:ce(e.priority),deadlineBefore:Se(e.deadlineBefore,"deadline-before"),deadlineAfter:Se(e.deadlineAfter,"deadline-after"),updatedAfter:st(e),updatedBefore:F(e.updatedBefore,"updated-before"),createdAfter:F(e.createdAfter,"created-after"),createdBefore:F(e.createdBefore,"created-before"),assigneeFilter:s,assigneeModeFilter:i,parentFilter:e.parent?.trim(),treeEnabled:e.tree===!0,sprintFilter:b(e.sprint,{label:"--sprint"}),releaseFilter:b(e.release,{label:"--release"}),missingMetadataFilters:o,missingMetadataActive:ae(o),lifecycleClassifier:oe(r),contentFieldFilters:l,contentFiltersActive:ye(l)}}function _t(t,e,n){return ht(t,e,n)&&bt(t,e)&&Ft(t,e)&&St(t,e)}function ht(t,e,n){return e.idsFilter&&!e.idsFilter.has(t.id)||e.statusSet&&!e.statusSet.has(t.status)||e.excludeTerminal&&A(t.status,n)||e.typeFilter&&!e.typeFilter.has(t.type)||e.tagFilters&&![...e.tagFilters].some(r=>(t.tags??[]).some(s=>s.trim().toLowerCase()===r))?!1:e.priorityFilter===void 0||e.priorityFilter.has(t.priority)}function bt(t,e){return x(t,e)}function Ft(t,e){return e.assigneeModeFilter==="assigned"&&!t.assignee||e.assigneeModeFilter==="unassigned"&&t.assignee?!1:e.assigneeFilter===void 0||t.assignee!==void 0&&e.assigneeFilter.has(t.assignee)}function St(t,e){return e.parentFilter!==void 0&&!e.treeEnabled&&t.parent!==e.parentFilter||e.sprintFilter!==void 0&&(t.sprint===void 0||!e.sprintFilter.has(t.sprint))?!1:e.releaseFilter===void 0||t.release!==void 0&&e.releaseFilter.has(t.release)}function Et(t,e,n,r){return!(!_t(t,e,n)||e.missingMetadataActive&&!de(t,e.missingMetadataFilters,e.lifecycleClassifier)||e.contentFiltersActive&&!pe(t,e.contentFieldFilters)||!Q(t,r))}function Kt(t,e,n,r,s,i){let o=gt(e,n,r,s);return t.filter(l=>Et(l,o,s,i))}function I(t){if(typeof t!="string")return;let e=t.trim();return e.length>0?e:void 0}function wt(t,e,n){let r=t,s=typeof r.title=="string"?r.title:"",i=I(typeof r.parent=="string"?r.parent:void 0)??null;return{...t,tree_depth:e,tree_parent:i,tree_children:n,tree_title:`${" ".repeat(e)}${s}`}}function Tt(t,e,n){let r=new Map,s=new Map;for(let a of t){r.set(a.id,a);let m=I(a.parent);if(!m)continue;let u=s.get(m);u?u.push(a):s.set(m,[a])}let i=e?[...s.get(e)??[]]:t.filter(a=>{let m=I(a.parent);return!m||!r.has(m)}),o=[],l=new Set,d=(a,m)=>{if(l.has(a.id))return;l.add(a.id);let u=s.get(a.id)??[];if(o.push(wt(a,m,u.length)),!(n!==void 0&&m>=n))for(let p of u)d(p,m+1)};for(let a of i)d(a,0);return o}function At(t,e){return t===e?0:t===null?1:e===null?-1:t.localeCompare(e)}function Lt(t,e){return t===e?0:t===null?1:e===null?-1:h(t,e)}function It(t,e,n){switch(n){case"priority":return t.priority-e.priority;case"deadline":return Lt(t.deadline??null,e.deadline??null);case"updated_at":return h(t.updated_at,e.updated_at);case"created_at":return h(t.created_at,e.created_at);case"title":return(t.title??"").localeCompare(e.title??"");case"parent":return At(t.parent??null,e.parent??null);default:return 0}}function Ct(t,e,n,r){return e?[...t].sort((s,i)=>{let o=It(s,i,e);if(o!==0)return n==="desc"?-o:o;let l=Le(s,i,r);return n==="desc"?-l:l}):rt(t,r)}function Mt(t,e,n=!1){let r=S(e.trim());if(r.length===0)return null;let s=t;return n&&r==="title"&&typeof s.tree_title=="string"?s.tree_title:Object.prototype.hasOwnProperty.call(s,r)?s[r]??null:null}function ke(t,e,n=!1){return e.mode==="full"?t:t.map(r=>{let s={};for(let i of e.fields)s[i]=Mt(r,i,n);return s})}function kt(t){let e=[];for(let n of t)e.push(n.metadata_key);return e}function Rt(t,e){if(t.noTruncate!==!0)return L(t.limit)??(e>=1e4?20:void 0)}function Dt(t,e,n){return e.after===void 0?Ce(e.offset)??0:V(t,e.after,n,r=>r.id)}function Re(t,e,n){return{...t!==void 0?{applied_limit:t}:{},has_more:e,truncated:e,next_cursor:n??null}}async function Nt(t,e){let n=j(process.cwd(),e.path);if(!await D(B(n)))throw new f(`Tracker is not initialized at ${n}. Run pm init first.`,c.NOT_FOUND);let r=await X(n),s=G(r.schema),i=$(r.schema),o=at(t);return dt(o,kt(i.definitions)),{pmRoot:n,settings:r,statusRegistry:s,runtimeFieldFilters:Y(t,i,"list"),typeRegistry:v(r,U()),projection:o}}async function Ot(t,e,n){let r=e.projection.fields.some(d=>S(d)==="body"),s=e.projection.mode==="full"||e.projection.fields.some(d=>we.has(S(d))),i=Ke(t),o=ge(i),l=_e(i);return t.includeBody||r||l?await re(e.pmRoot,e.settings.item_format,e.typeRegistry.type_to_folder,n,e.settings.schema):s||o?await te(e.pmRoot,e.settings.item_format,e.typeRegistry.type_to_folder,n,e.settings.schema):await ne(e.pmRoot,e.settings.item_format,e.typeRegistry.type_to_folder,n,e.settings.schema)}function xt(t){let e=ut(t.sort),n=ct(t.order)??"asc",r=t.tree===!0;if(!r&&t.treeDepth!==void 0)throw new f("List --tree-depth requires --tree",c.USAGE);if(!e&&t.order!==void 0)throw new f("List --order requires --sort",c.USAGE);return{sortField:e,sortOrder:n,treeEnabled:r,treeDepth:r?ft(t.treeDepth):void 0,parentRoot:r?I(t.parent):void 0}}function vt(t,e,n){let r=Ee(e.status,n),s=r??Ee(t,n),i=H(e.status),o=r||i?{...e,excludeTerminal:!1}:e,l=i?"all":s===void 0?o.excludeTerminal===!0?null:"all":s.length===1?s[0]:s;return{resolvedStatus:s,explicitAllStatuses:i,effectiveOptions:o,filtersStatus:l}}function jt(t,e,n,r,s){if(e.after!==void 0&&e.offset!==void 0)throw new f("List --after cannot be combined with --offset.",c.USAGE);let i=Rt(e,t.length),o=Dt(t,e,s),l=i===void 0?t.slice(o):t.slice(o,o+i),d=ke(l,n,r),a=t.length,m=l.length>0&&o+l.length<a,u=m&&l.length>0?M(s,l[l.length-1].id,o+l.length-1):void 0;return{projected:d,totalMatched:a,pageExtras:Re(i,m,u)}}function De(t,e,n){return q("list",{status:t,options:z(e,se),sort:n.sortField??"default",order:n.sortOrder,tree:n.treeEnabled,tree_depth:n.treeDepth??null})}async function Bt(t){let{options:e,runtime:n,statusSelection:r,ordering:s}=t,i=new Set(["status","limit","offset","compact","brief","full","fields","format","stream","includeBody","excludeTerminal","noTruncate"]),o=[n.projection.mode==="full",n.projection.fields.some(K=>{let y=S(K);return y==="body"||we.has(y)})].includes(!0);if([e.limit===void 0,e.after!==void 0,e.noTruncate===!0,e.includeBody===!0,e.dependencyBlocked===!0,e.strictRead===!0,s.treeEnabled,s.sortField!==void 0,o,P(),Object.keys(n.runtimeFieldFilters).length>0,Object.entries(e).some(([K,y])=>y!==void 0&&!i.has(K))].includes(!0))return null;let d=await ee(n.pmRoot,[...new Set(Object.values(n.typeRegistry.type_to_folder))]);if(!d)return null;let a=L(e.limit),m=Ce(e.offset)??0,u=await J({pmRoot:n.pmRoot,expectedSourceCursor:d.source_cursor,query:{statuses:r.resolvedStatus,excludeStatuses:r.resolvedStatus===void 0&&r.effectiveOptions.excludeTerminal===!0?[...n.statusRegistry.terminal_statuses]:void 0,terminalStatuses:[...n.statusRegistry.terminal_statuses],limit:a,offset:m}});if(!u)return null;let p=u.items.length>0&&m+u.items.length<u.total,E=p?M(De(r.filtersStatus,e,s),u.items.at(-1).id,m+u.items.length-1):void 0;return{projected:ke(u.items,n.projection,!1),totalMatched:u.total,pageExtras:Re(a,p,E)}}function Ut(t){let{filtersStatus:e,options:n,noTruncate:r,treeEnabled:s,treeDepth:i,sortField:o,sortOrder:l,runtimeFieldFilters:d}=t,a={};e!==null&&(a.status=e),n.dependencyBlocked===!0&&(a.blocked_semantics="status_or_dependency");let m=n;for(let u of Ze){let p=m[u.optionKey];p!=null&&(a[u.summaryKey]=p)}for(let u of et)m[u.key]===!0&&(a[u.summaryKey]=!0);return Object.assign(a,Xe(n),Qe(n)),Ie(a,n),r&&(a.no_truncate=!0),s&&(a.tree=!0,i!==void 0&&(a.tree_depth=i)),o!==void 0&&(a.sort=o,a.order=l),a.runtime_filters=d,a}async function Ln(t,e,n){let r=await Nt(e,n),s=[],i=xt(e),o=vt(t,e,r.statusRegistry),l=e.noTruncate===!0,d=await Bt({options:e,runtime:r,statusSelection:o,ordering:i}),a=d;if(!a){let y=await Ot(e,r,s);yt(y,e.tag,s);let w=Kt(y,o.resolvedStatus,o.effectiveOptions,r.typeRegistry,r.statusRegistry,r.runtimeFieldFilters),Ne=e.dependencyBlocked===!0?(()=>{let xe=ie(y,r.statusRegistry);return w.filter(ve=>xe.has(ve.id.trim().toLowerCase()))})():w,R=Ct(Ne,i.sortField,i.sortOrder,r.statusRegistry),Oe=i.treeEnabled?Tt(R,i.parentRoot,i.treeDepth):R;a=jt(Oe,e,r.projection,i.treeEnabled,De(o.filtersStatus,e,i))}let m=O(),u=[...new Set(s)].sort((y,w)=>y.localeCompare(w)),p=qe(u,d!==null,e.strictRead===!0),E=r.projection.mode==="full"?null:[...r.projection.fields];if(r.projection.mode==="compact"&&e.compact===!0){let y=nt({filtersStatus:o.filtersStatus,options:e,treeEnabled:i.treeEnabled,treeDepth:i.treeDepth,sortField:i.sortField,sortOrder:i.sortOrder,runtimeFieldFilters:r.runtimeFieldFilters});return{items:a.projected,count:a.projected.length,total:a.totalMatched,...a.pageExtras,completeness:p,filters:y,projection:{mode:"compact",fields:E},...u.length>0?{warnings:u}:{}}}return{items:a.projected,count:a.projected.length,total:a.totalMatched,...a.pageExtras,completeness:p,filters:Ut({filtersStatus:o.filtersStatus,options:e,noTruncate:l,treeEnabled:i.treeEnabled,treeDepth:i.treeDepth,sortField:i.sortField,sortOrder:i.sortOrder,runtimeFieldFilters:r.runtimeFieldFilters}),projection:{mode:r.projection.mode,fields:E},sorting:{sort:i.sortField??"default",order:i.sortField?i.sortOrder:"asc"},now:m,...u.length>0?{warnings:u}:{}}}export{L as a,le as b,qt as c,k as d,b as e,ue as f,ce as g,ye as h,pe as i,Zt as j,Pe as k,Ke as l,be as m,Fe as n,Ge as o,$e as p,An as q,Ye as r,Qe as s,Xe as t,Ln as u};
|
|
2
|
+
//# sourceMappingURL=chunk-RKAVWO3O.js.map
|