@unbrained/pm-cli 2026.8.7 → 2026.8.8
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 +35 -0
- package/dist/cli/main.js +4 -3
- package/dist/cli/register-annotations.d.ts +11 -0
- package/dist/cli/register-annotations.js +195 -0
- package/dist/cli/register-history-author.js +7 -30
- package/dist/cli/register-mutation.js +25 -206
- package/dist/cli/runtime-compatibility-boundary.d.ts +17 -0
- package/dist/cli/runtime-compatibility-boundary.js +43 -0
- package/dist/cli-bundle/bundle-manifest.json +155 -691
- package/dist/cli-bundle/chunks/chunk-2ZMXX3Q6.js +2068 -0
- package/dist/cli-bundle/chunks/chunk-ALDHXLPS.js +3 -0
- package/dist/cli-bundle/chunks/chunk-CBLA33YK.js +8 -0
- package/dist/cli-bundle/chunks/chunk-GKA54IJM.js +5 -0
- package/dist/cli-bundle/chunks/chunk-KRY7SRUO.js +2 -0
- package/dist/cli-bundle/chunks/chunk-MNJ4NNSY.js +26 -0
- package/dist/cli-bundle/chunks/chunk-NUXRRNAB.js +77 -0
- package/dist/cli-bundle/chunks/chunk-OJPCFDDY.js +13 -0
- package/dist/cli-bundle/chunks/chunk-PFSD3DAN.js +194 -0
- package/dist/cli-bundle/chunks/chunk-QWRRFYK3.js +2 -0
- package/dist/cli-bundle/chunks/chunk-SQ7QZFQ6.js +2 -0
- package/dist/cli-bundle/chunks/{register-list-query-FJZCJ67O.js → register-list-query-WFZAMJHZ.js} +8 -8
- package/dist/cli-bundle/chunks/register-mutation-SOKKOTHQ.js +20 -0
- package/dist/cli-bundle/chunks/register-operations-5XQETS6E.js +2 -0
- package/dist/cli-bundle/chunks/register-setup-2HL5ZHMK.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-54EU2UVO.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-VZFU2R4M.js → chunk-5FLBTZJQ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-5GJ57YKN.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-HNL6IFGS.js → chunk-ANTMGYLI.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-CMDS3KYT.js +14 -0
- package/dist/cli-bundle/focused-chunks/{chunk-NBJKQP4S.js → chunk-DMKOMTTY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-CIXVQPB7.js → chunk-F5B3HBEZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-R2LEMEV5.js → chunk-FI6DWU2M.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-3K4XV2BF.js → chunk-FNOKJG6N.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-RW5IYD4J.js → chunk-FPDYXZBK.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-QHRTT7WT.js → chunk-GWI6YIKJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-MHMTKV5V.js → chunk-HCUC62AB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-MOTJFQ3F.js → chunk-HGNKPSCB.js} +12 -12
- package/dist/cli-bundle/focused-chunks/{chunk-4VJQTS3P.js → chunk-IAS7PMLG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-TIKDBG4D.js → chunk-PL2EYDJK.js} +27 -27
- package/dist/cli-bundle/focused-chunks/chunk-SM2PJGP3.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-RPNYG5MO.js → chunk-TCSAPH33.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-U646T7Z6.js +18 -0
- package/dist/cli-bundle/focused-chunks/chunk-YKPE4PPY.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-YZEZAPJK.js → chunk-YSAHYUXX.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-73JUDYXT.js → chunk-ZOLDTUU7.js} +2 -2
- package/dist/cli-bundle/main.js +13 -13
- 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 +38 -38
- 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 +2 -1
- package/dist/cli.js +14 -4
- package/dist/core/output/output.js +9 -2
- package/dist/core/sentry/helpers.d.ts +10 -0
- package/dist/core/sentry/helpers.js +59 -4
- package/dist/core/shared/constants.d.ts +2 -0
- package/dist/core/shared/constants.js +4 -2
- package/dist/sdk/annotations.d.ts +40 -0
- package/dist/sdk/annotations.js +61 -9
- package/dist/sdk/author-attribution.d.ts +12 -0
- package/dist/sdk/author-attribution.js +73 -11
- package/dist/sdk/cli-contracts/command-exit-contracts.d.ts +118 -0
- package/dist/sdk/cli-contracts/command-exit-contracts.js +152 -0
- package/dist/sdk/cli-contracts/completeness.js +5 -3
- package/dist/sdk/cli-contracts/flag-contracts.js +5 -2
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +11 -0
- package/dist/sdk/cli-contracts/runtime-contracts.js +29 -2
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +15 -2
- package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
- package/dist/sdk/cli-contracts/tool-schema.js +6 -3
- package/dist/sdk/comments.d.ts +7 -0
- package/dist/sdk/comments.js +2 -2
- package/dist/sdk/completion.js +9 -5
- package/dist/sdk/contracts.d.ts +1 -0
- package/dist/sdk/contracts.js +3 -2
- package/dist/sdk/environment/host-environment-errors.d.ts +27 -0
- package/dist/sdk/environment/host-environment-errors.js +124 -0
- package/dist/sdk/environment/project-runtime-compatibility.d.ts +65 -0
- package/dist/sdk/environment/project-runtime-compatibility.js +385 -0
- package/dist/sdk/environment/source-context.d.ts +23 -0
- package/dist/sdk/environment/source-context.js +29 -0
- package/dist/sdk/error-code-catalog.d.ts +6 -0
- package/dist/sdk/error-code-catalog.js +62 -8
- package/dist/sdk/generated-error-code-catalog.js +629 -3
- package/dist/sdk/governance/health.d.ts +11 -3
- package/dist/sdk/governance/health.js +5 -5
- package/dist/sdk/index.d.ts +7 -3
- package/dist/sdk/index.js +9 -5
- package/dist/sdk/learnings.d.ts +15 -0
- package/dist/sdk/learnings.js +2 -2
- package/dist/sdk/lifecycle/close-many.d.ts +6 -1
- package/dist/sdk/lifecycle/close-many.js +43 -5
- package/dist/sdk/lifecycle/update-many.d.ts +2 -1
- package/dist/sdk/lifecycle/update-many.js +29 -5
- package/dist/sdk/merge/index.d.ts +1 -1
- package/dist/sdk/merge/index.js +3 -3
- package/dist/sdk/merge/install.d.ts +21 -0
- package/dist/sdk/merge/install.js +50 -20
- package/dist/sdk/notes.d.ts +7 -0
- package/dist/sdk/notes.js +2 -2
- package/dist/sdk/read-output-contracts.js +83 -4
- package/dist/sdk/runtime.d.ts +1 -1
- package/dist/sdk/runtime.js +9 -25
- package/dist/sdk/test/execution.js +4 -2
- package/dist/sdk/test/parsers.js +5 -2
- package/dist/sdk/workspace-snapshot.d.ts +9 -0
- package/dist/sdk/workspace-snapshot.js +48 -16
- package/docs/AGENT_RUNTIME_PRIMITIVES.md +11 -4
- package/docs/README.md +1 -0
- package/docs/RELEASING.md +27 -2
- package/docs/SCRIPTING.md +27 -1
- package/docs/SDK_CONTEXT_INTEGRITY.md +66 -0
- package/docs/SDK_RUNTIME_BOUNDARIES.md +58 -0
- package/docs/SELF_DESCRIBING_CONTEXT_CONTRACTS.md +13 -0
- package/docs/TESTING.md +17 -0
- package/marketplace.json +2 -2
- package/package.json +5 -3
- 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 +529 -34
- package/dist/cli-bundle/chunks/append-7BXBFDGD.js +0 -2
- package/dist/cli-bundle/chunks/chunk-2AXF3VSK.js +0 -2
- package/dist/cli-bundle/chunks/chunk-2XS43CCV.js +0 -2
- package/dist/cli-bundle/chunks/chunk-3A6KWB72.js +0 -8
- package/dist/cli-bundle/chunks/chunk-3ISTDB42.js +0 -8
- package/dist/cli-bundle/chunks/chunk-4MTI7XOV.js +0 -5
- package/dist/cli-bundle/chunks/chunk-6BX5UDCN.js +0 -3
- package/dist/cli-bundle/chunks/chunk-6QPO7KLR.js +0 -2
- package/dist/cli-bundle/chunks/chunk-7MXHZHSQ.js +0 -5
- package/dist/cli-bundle/chunks/chunk-7ZPMJW4U.js +0 -2
- package/dist/cli-bundle/chunks/chunk-A6KGKEWT.js +0 -2
- package/dist/cli-bundle/chunks/chunk-AGYNSNCI.js +0 -2
- package/dist/cli-bundle/chunks/chunk-B4H7FEFH.js +0 -5
- package/dist/cli-bundle/chunks/chunk-B4KLBBMN.js +0 -2
- package/dist/cli-bundle/chunks/chunk-BXCSXK4J.js +0 -2
- package/dist/cli-bundle/chunks/chunk-CALJHNBL.js +0 -23
- package/dist/cli-bundle/chunks/chunk-CFIGP5LY.js +0 -2
- package/dist/cli-bundle/chunks/chunk-CHOQ2VAW.js +0 -2
- package/dist/cli-bundle/chunks/chunk-CS6MRHG7.js +0 -2
- package/dist/cli-bundle/chunks/chunk-CUGNQQKH.js +0 -2
- package/dist/cli-bundle/chunks/chunk-D4FPS43D.js +0 -164
- package/dist/cli-bundle/chunks/chunk-E2ZSLTOP.js +0 -2
- package/dist/cli-bundle/chunks/chunk-FB7G2HY2.js +0 -2
- package/dist/cli-bundle/chunks/chunk-H5Y5YE6A.js +0 -2
- package/dist/cli-bundle/chunks/chunk-H5Y6UV6E.js +0 -2
- package/dist/cli-bundle/chunks/chunk-H7KGWPDF.js +0 -2
- package/dist/cli-bundle/chunks/chunk-HFSD77TQ.js +0 -2
- package/dist/cli-bundle/chunks/chunk-HX2GTA6L.js +0 -2
- package/dist/cli-bundle/chunks/chunk-J2IEKAVR.js +0 -2
- package/dist/cli-bundle/chunks/chunk-JC6FKIFM.js +0 -2
- package/dist/cli-bundle/chunks/chunk-K44PYFXH.js +0 -2
- package/dist/cli-bundle/chunks/chunk-K4KGEEBT.js +0 -2
- package/dist/cli-bundle/chunks/chunk-KFLK5TRH.js +0 -21
- package/dist/cli-bundle/chunks/chunk-KL6IEBV2.js +0 -2
- package/dist/cli-bundle/chunks/chunk-KWQZDZSS.js +0 -2
- package/dist/cli-bundle/chunks/chunk-KZ4X3DGU.js +0 -3
- package/dist/cli-bundle/chunks/chunk-LD77HJMQ.js +0 -13
- package/dist/cli-bundle/chunks/chunk-LEPJJ6QC.js +0 -2
- package/dist/cli-bundle/chunks/chunk-ME2JJ4LA.js +0 -3
- package/dist/cli-bundle/chunks/chunk-NE5VRDAI.js +0 -2
- package/dist/cli-bundle/chunks/chunk-NFLJ3FHD.js +0 -2
- package/dist/cli-bundle/chunks/chunk-NG6OXIBR.js +0 -19
- package/dist/cli-bundle/chunks/chunk-NYIGHWQY.js +0 -8
- package/dist/cli-bundle/chunks/chunk-NZ75GNSA.js +0 -2
- package/dist/cli-bundle/chunks/chunk-PCJWJNC2.js +0 -2
- package/dist/cli-bundle/chunks/chunk-PD3225AM.js +0 -2
- package/dist/cli-bundle/chunks/chunk-PDEGKG7P.js +0 -2
- package/dist/cli-bundle/chunks/chunk-PIE5HBNA.js +0 -2
- package/dist/cli-bundle/chunks/chunk-PW2H7YJR.js +0 -56
- package/dist/cli-bundle/chunks/chunk-RSIC5OPE.js +0 -2
- package/dist/cli-bundle/chunks/chunk-TPKN3S7S.js +0 -2
- package/dist/cli-bundle/chunks/chunk-TPXAXTCO.js +0 -2
- package/dist/cli-bundle/chunks/chunk-UFWUJO4V.js +0 -2
- package/dist/cli-bundle/chunks/chunk-UQLZQVFW.js +0 -55
- package/dist/cli-bundle/chunks/chunk-VT3Z5G7D.js +0 -2
- package/dist/cli-bundle/chunks/chunk-WOD3WWUN.js +0 -2
- package/dist/cli-bundle/chunks/chunk-WSJEIGJF.js +0 -3
- package/dist/cli-bundle/chunks/chunk-WYNUU7ZW.js +0 -2008
- package/dist/cli-bundle/chunks/chunk-YGPNCCXZ.js +0 -2
- package/dist/cli-bundle/chunks/close-CMY3BAUG.js +0 -2
- package/dist/cli-bundle/chunks/close-many-SA4XZCTK.js +0 -2
- package/dist/cli-bundle/chunks/comments-EZ556ZD3.js +0 -2
- package/dist/cli-bundle/chunks/copy-ZSGPA52X.js +0 -2
- package/dist/cli-bundle/chunks/create-I5DVV4YG.js +0 -2
- package/dist/cli-bundle/chunks/delete-RL3JACSW.js +0 -2
- package/dist/cli-bundle/chunks/deps-S7UBCECS.js +0 -2
- package/dist/cli-bundle/chunks/docs-ZZNVBBYO.js +0 -2
- package/dist/cli-bundle/chunks/files-27C337VT.js +0 -2
- package/dist/cli-bundle/chunks/focus-5Z2SG7LU.js +0 -2
- package/dist/cli-bundle/chunks/history-compact-HJQK67CZ.js +0 -2
- package/dist/cli-bundle/chunks/history-redact-PWC6PDWA.js +0 -2
- package/dist/cli-bundle/chunks/history-repair-N3CY4WBF.js +0 -2
- package/dist/cli-bundle/chunks/learnings-4FH23XDT.js +0 -2
- package/dist/cli-bundle/chunks/profile-5Y5XXH5N.js +0 -2
- package/dist/cli-bundle/chunks/register-mutation-YGYPW3BL.js +0 -20
- package/dist/cli-bundle/chunks/register-operations-WMDSUMQF.js +0 -2
- package/dist/cli-bundle/chunks/register-setup-DL7FFABC.js +0 -2
- package/dist/cli-bundle/chunks/restore-6KYBV5BY.js +0 -2
- package/dist/cli-bundle/chunks/schema-EQGKBYXJ.js +0 -2
- package/dist/cli-bundle/chunks/update-QVTYOD6I.js +0 -2
- package/dist/cli-bundle/chunks/update-many-DJSBU525.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-2ECLECMK.js +0 -12
- package/dist/cli-bundle/focused-chunks/chunk-4EX25PXM.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-DLTS3IHM.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-DQ6FKGL3.js +0 -14
- package/dist/cli-bundle/focused-chunks/chunk-JLG2C4EQ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZJIMJHDB.js +0 -2
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(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]="13c02696-29a7-598e-888a-3502fd88bfbe")}catch{}})();
|
|
2
|
-
//# sourceMappingURL=chunk-E2ZSLTOP.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ab1153b1-2d91-58a5-9b4a-1d9c5f35a54a")}catch{}})();var a=["status","type","tag","priority","deadlineBefore","deadlineAfter","updatedAfter","updatedBefore","createdAfter","createdBefore","ids","assignee","assigneeFilter","parent","sprint","release"],o=["filterAcMissing","filterEstimatesMissing","filterResolutionMissing","filterMetadataMissing","filterReviewerMissing","filterRiskMissing","filterConfidenceMissing","filterSprintMissing","filterReleaseMissing","hasNotes","hasLearnings","hasFiles","hasDocs","hasTests","hasComments","hasDeps","hasBody","hasLinkedCommand","noNotes","noLearnings","noFiles","noDocs","noTests","noComments","noDeps","emptyBody","noLinkedCommand"];function r(e){return e!=null&&(typeof e!="string"||e.split(",").some(n=>n.trim().length>0))}function l(e,n,i={}){let t=i.includePagination!==!1;return[n,...a.map(s=>e?.[s]),...t?[e?.limit,e?.offset]:[]].some(r)||o.some(s=>e?.[s]===!0)}function g(e){return{type:e.type,tag:e.tag,priority:e.priority,deadlineBefore:e.deadlineBefore,deadlineAfter:e.deadlineAfter,assignee:e.assignee,assigneeFilter:e.assigneeFilter,parent:e.parent,sprint:e.sprint,release:e.release}}export{l as a,g as b};
|
|
2
|
-
//# sourceMappingURL=chunk-FB7G2HY2.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{bd as u,cd as p}from"./chunk-D4FPS43D.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]="bf429f76-9722-5e34-a5f0-6ced8d1ed667")}catch{}})();var D="blocked_by",B="no-active-blocker";function d(e){return e.trim().toLowerCase()}function b(e){let t=new Set,n=typeof e.blocked_by=="string"?e.blocked_by.trim():"";n.length>0&&n.toLowerCase()!==B&&t.add(n);for(let o of e.dependencies??[])o.kind===D&&typeof o.id=="string"&&o.id.trim().length>0&&o.id.trim().toLowerCase()!==B&&t.add(o.id.trim());return[...t].sort((o,c)=>o.localeCompare(c))}function k(e,t,n){return b(e).map(o=>{let c=t.get(d(o));return c?{id:o,title:c.title,status:c.status,resolved:p(c.status,n)}:{id:o,title:null,status:null,resolved:!1}})}function C(e,t){let n=new Map(e.map(s=>[d(s.id),s])),o=new Set([...I(t),...t.blocked_statuses]),c=new Set;for(let s of e){let l=u(s.status,t);if(!o.has(l))continue;(t.blocked_statuses.has(l)||k(s,n,t).some(a=>!a.resolved))&&c.add(d(s.id))}return c}function I(e){return e.active_statuses.size>0?e.active_statuses:new Set([e.open_status])}function E(e,t,n){let o=[d(e)],c=new Set;for(;o.length>0;){let s=o.pop();if(!c.has(s)){c.add(s);for(let l of t.get(s)??[]){if(!p(l.status,n))return!0;o.push(d(l.id))}}}return!1}function T(e){let t=new Map,n=new Map,o=new Map;for(let c of e){t.set(d(c.id),c);let s=typeof c.parent=="string"?c.parent.trim():"";if(s.length>0){let l=d(s),i=n.get(l)??[];i.push(c),n.set(l,i)}for(let l of b(c)){let i=d(l),a=o.get(i)??[];a.push(c.id),o.set(i,a)}}return{itemsById:t,childrenByParent:n,blockedByReverse:o}}function x(e,t,n){let{itemsById:o,childrenByParent:c,blockedByReverse:s}=T(t),l=new Set([...I(n),...n.blocked_statuses]),i=new Set(t.filter(r=>!p(r.status,n)).map(r=>d(r.id))),a=[],y=[],m=0,h=0;for(let r of e){if(!l.has(u(r.status,n)))continue;if(m+=1,E(r.id,c,n)){h+=1;continue}let w=k(r,o,n).filter(f=>!f.resolved),v=(s.get(d(r.id))??[]).filter(f=>i.has(d(f))).sort((f,S)=>f.localeCompare(S)),_={item:r,open_blockers:w,unblocks:v},g=n.blocked_statuses.has(u(r.status,n));w.length===0&&!g?a.push(_):y.push(_)}return{ready:a,blocked:y,active_count:m,container_count:h}}(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]="9184e723-8269-5e45-8c6a-52fd02da60e6")}catch{}})();export{b as a,k as b,C as c,x as d};
|
|
2
|
-
//# sourceMappingURL=chunk-H5Y5YE6A.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as T}from"./chunk-K4KGEEBT.js";import{f as F,i as I}from"./chunk-NYIGHWQY.js";import{A as s,C as o,Da as _,La as g,Nf as N,Oa as U,R as E,Yf as O,Zf as k,b as K,dg as x,lc as C,zd as G}from"./chunk-D4FPS43D.js";import{readFile as L}from"node:fs/promises";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="eeb7b433-094b-5c4f-bc81-d4988ac297b4")}catch{}})();function P(e,n){if(typeof e=="object"&&e!==null&&"format"in e&&e.format==="json")throw new o(`Structured context events are append-only and cannot be ${n}.`,s.USAGE,{code:"structured_event_immutable"})}function V(e,n){return n===void 0?e:n===0?[]:e.slice(Math.max(0,e.length-n))}function p(e,n){let r=e[n];return Array.isArray(r)?r:[]}function se(e,n={}){let r=e.trim();if(!r)return"";let t=/^(?:[-*+]\s*)?text\s*[:=]/i.exec(r);if(n.stripPlainTextPrefix===!0&&t&&!r.startsWith("```"))return r.slice(t[0].length).trim()||r;if(!(/^(?:[-*+]\s*)?text\s*[:=]/im.test(r)||r.startsWith("```")))return r;try{let i=F(r,"--add");return Object.keys(i).map(m=>m.trim().toLowerCase()).some(m=>m!=="text")?r:i.text?.trim()||r}catch{return r}}function j(e){return typeof e=="object"&&e!==null&&"code"in e}async function H(e,n){if(+(e.add!==void 0)+ +(e.stdin===!0)+ +(typeof e.file=="string")>1)throw new o(`Specify ${n} text using only one input source: --add, --stdin, or --file`,s.USAGE);let t=I();if(e.add!==void 0)return{value:await t.resolveValue(e.add,"--add")??"",rawValue:e.add,emptyFlag:"--add"};if(e.stdin===!0)return{value:await t.resolveValue("-","--stdin")??"",emptyFlag:"--stdin"};if(typeof e.file!="string")return;let a=e.file.trim();if(!a)throw new o("--file path cannot be empty",s.USAGE);try{return{value:await L(a,"utf8"),emptyFlag:"--file"}}catch(i){if(j(i)&&i.code==="ENOENT")throw new o(`--file path not found: ${a}`,s.USAGE);let w=i instanceof Error?i.message:String(i);throw new o(`Failed to read --file path "${a}": ${w}`,s.USAGE)}}async function de(e,n){if(e.edit!==void 0&&e.delete!==void 0)throw new o("Specify only one of --edit or --delete",s.USAGE);if(e.delete!==void 0){if(e.add!==void 0||e.stdin===!0||typeof e.file=="string")throw new o("--delete cannot be combined with replacement text",s.USAGE);if(!Number.isInteger(e.delete)||e.delete<1)throw new o("--delete must be a positive integer",s.USAGE);return{mode:"delete",index:e.delete}}if(e.edit!==void 0&&(!Number.isInteger(e.edit)||e.edit<1))throw new o("--edit must be a positive integer",s.USAGE);let r=await H(e,n);if(e.edit!==void 0){if(!r)throw new o("--edit requires replacement text from --add, --stdin, or --file",s.USAGE);return{mode:"edit",index:e.edit,...r}}return r?{mode:"add",...r}:{mode:"list"}}function v(e,n){throw e instanceof o&&e.exitCode===s.CONFLICT&&e.message.includes("is assigned to")&&e.message.includes("Use --force to override")?new o(e.message,e.exitCode,{code:"ownership_conflict",required:n.required,examples:n.examples,nextSteps:n.nextSteps}):e}function M(e){return e==="comments"?"--stdin":"--add -"}function z(e,n){if((n.input.emptyFlag??"--add")!=="--add")return;let t=e.trim();if(!/^-{1,2}[A-Za-z][\w-]*(?:=.*)?$/.test(t))return;let a=M(n.collectionKey),i=n.input.mode==="edit"?`pm ${n.collectionKey} <id> --edit <index>`:`pm ${n.collectionKey} <id>`;throw new o(`--add value "${t}" looks like an option, not annotation text. Use ${a} to read stdin, or use text=${t} for literal dash-leading text.`,s.USAGE,{code:"annotation_flag_like_value",required:`Use ${a} for stdin input, pass plain text, or use text=${t} when the text really starts with "-".`,examples:[`${i} ${a}`,`${i} --add text=${t}`]})}function W(e,n){if(e.input.mode!=="list"||n.message===void 0)return;let r=e.collectionKey.replace(/s$/,"");throw new o(`--message labels a ${r} mutation but does not provide ${r} text. Pass text positionally or with --add, --stdin, or --file.`,s.USAGE,{code:"annotation_message_without_text",required:`Provide ${r} text through a content source; --message only annotates the history entry of a mutation.`,examples:[`pm ${e.collectionKey} <id> --add "text" --message "why"`,`pm ${e.collectionKey} <id> ${M(e.collectionKey)}`]})}async function le(e,n,r,t){W(t,n);let a=g(process.cwd(),r.path);if(!await K(U(a)))throw new o(`Tracker is not initialized at ${a}. Run pm init first.`,s.NOT_FOUND);let i=await N(a),w=_(i,C()),y=T(n.limit);if(t.input.mode==="list"){let d=await O(a,e,i.id_prefix,i.item_format,w.type_to_folder);if(!d)throw new o(`Item ${e} not found`,s.NOT_FOUND);let l=await k(d,{schema:i.schema}),f=p(l.document.metadata,t.collectionKey);return b(d.id,t.collectionKey,f,y,n.includeMeta===!0)}let m=G(n.author,i.author_default);if(t.input.mode==="delete"){let d=t.deleteOp??t.op,l;try{l=await x({pmRoot:a,settings:i,id:e,op:d,author:m,message:n.message,force:n.force,bypassAssigneeConflict:t.bypassOwnershipConflict,mutate(u){let c=p(u.metadata,t.collectionKey),h=R(t.input.index,c.length,t.collectionKey);return P(c[h],"deleted"),c.splice(h,1),u.metadata[t.collectionKey]=c,{changedFields:[t.collectionKey]}}})}catch(u){v(u,t.conflictGuidance)}let f=p(l.item,t.collectionKey);return b(l.item.id,t.collectionKey,f,y,n.includeMeta===!0)}let D=t.input.rawValue??t.input.value??"";z(D,t);let $=t.parseText(t.input.value??"");if(!$.trim())throw new o(`${t.input.emptyFlag??"--add"} text cannot be empty`,s.USAGE);if(t.input.mode==="edit"){let d=t.editOp??t.op,l;try{l=await x({pmRoot:a,settings:i,id:e,op:d,author:m,message:n.message,force:n.force,bypassAssigneeConflict:t.bypassOwnershipConflict,mutate(u){let c=p(u.metadata,t.collectionKey),h=R(t.input.index,c.length,t.collectionKey),S=c[h];return P(S,"edited"),c[h]={...S,text:$,edited_at:E()},u.metadata[t.collectionKey]=c,{changedFields:[t.collectionKey]}}})}catch(u){v(u,t.conflictGuidance)}let f=p(l.item,t.collectionKey);return b(l.item.id,t.collectionKey,f,y,n.includeMeta===!0)}let A;try{A=await x({pmRoot:a,settings:i,id:e,op:t.op,author:m,message:n.message,force:n.force,bypassAssigneeConflict:t.bypassOwnershipConflict,mutate(d){let l=p(d.metadata,t.collectionKey),f={created_at:E(),author:m,text:$};return l.push(t.createEntry(f)),d.metadata[t.collectionKey]=l,{changedFields:[t.collectionKey]}}})}catch(d){v(d,t.conflictGuidance)}let q=p(A.item,t.collectionKey);return b(A.item.id,t.collectionKey,q,y,n.includeMeta===!0)}function R(e,n,r){if(e===void 0||!Number.isInteger(e)||e<1||e>n){let t=r.replace(/s$/,""),a=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,i=n===1?`1 ${t}`:`${n} ${r}`;throw new o(`${a} index ${e??"(missing)"} out of range (item has ${i})`,s.USAGE)}return e-1}function b(e,n,r,t,a){let i=V(r,t);return{id:e,[n]:i,count:i.length,...a?{total_count:r.length,returned_count:i.length,has_more:i.length<r.length,...t!==void 0?{limit:t}:{}}:{}}}export{V as a,p as b,se as c,j as d,de as e,v as f,le as g,R as h};
|
|
2
|
-
//# sourceMappingURL=chunk-H5Y6UV6E.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{E as i}from"./chunk-D4FPS43D.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5b7b3eaf-a792-5f44-9981-8c82ce511070")}catch{}})();function M(e,n){let t=e.trim().toLowerCase();return n.alias_to_id.get(t)??t}function B(e){return{isTerminal(n){return e.terminal_statuses.has(M(n,e))},classify(n){let t=M(n,e);return e.terminal_canceled_statuses.has(t)?"canceled":e.terminal_statuses.has(t)?"closed":e.blocked_statuses.has(t)?"blocked":e.draft_statuses.has(t)?"draft":t===e.open_status?"open":e.active_statuses.has(t)?"in_progress":"other"}}}function p(e){return i(e.acceptance_criteria)===void 0}function d(e){return!Number.isFinite(e.estimated_minutes)}function m(e,n){return n.isTerminal(e.status)?i(e.resolution)===void 0:!1}function x(e){return i(e.reviewer)===void 0}function k(e){return i(e.risk)===void 0}function w(e){return typeof e.confidence=="number"?!Number.isFinite(e.confidence):i(e.confidence)===void 0}function v(e){return i(e.sprint)===void 0}function E(e){return i(e.release)===void 0}function R(e){return!!(e.acMissing||e.estimatesMissing||e.resolutionMissing||e.reviewerMissing||e.riskMissing||e.confidenceMissing||e.sprintMissing||e.releaseMissing||e.metadataMissing)}function C(e,n,t){return[[n.acMissing,p(e)],[n.estimatesMissing,d(e)],[n.resolutionMissing,m(e,t)],[n.reviewerMissing,x(e)],[n.riskMissing,k(e)],[n.confidenceMissing,w(e)],[n.sprintMissing,v(e)],[n.releaseMissing,E(e)]].every(([s,o])=>s!==!0||o)}function F(e,n){return p(e)||d(e)||m(e,n)}function U(e,n,t){return R(n)?!(!C(e,n,t)||n.metadataMissing&&!F(e,t)):!0}var g=["acceptance_criteria","estimated_minutes","resolution","tags","parent"];function A(e,n){switch(n){case"acceptance_criteria":return!p(e);case"estimated_minutes":return!d(e);case"resolution":return i(e.resolution)!==void 0;case"tags":return Array.isArray(e.tags)&&e.tags.length>0;default:return i(e.parent)!==void 0}}function D(e,n,t){return n==="resolution"?t.isTerminal(e.status):!0}function I(e,n){return n===0?100:Math.round(e/n*1e3)/10}function b(){let e={};for(let n of g)e[n]={present:0,applicable:0,percent:100};return e}function _(e,n,t){for(let r of g){if(!D(n,r,t))continue;let s=e[r];s.applicable+=1,A(n,r)&&(s.present+=1)}}function h(e){for(let n of g){let t=e[n];t.percent=I(t.present,t.applicable)}}function G(e,n){let t=b(),r={};for(let s of e){_(t,s,n);let o=r[s.type]??(r[s.type]=b());_(o,s,n)}h(t);for(let s of Object.values(r))h(s);return{overall:t,by_type:r}}var L={assignee:"(unassigned)",priority:"(no priority)",tag:"(untagged)",parent:"(unparented)",type:"(untyped)",status:"(no status)"};function T(e){return L[e]}function P(){return{open:0,in_progress:0,blocked:0,draft:0,closed:0,canceled:0,other:0}}function O(e,n,t){switch(n){case"assignee":return[i(e.assignee)??null];case"parent":return[i(e.parent)??null];case"type":return[i(e.type)??null];case"status":return[i(e.status)??null];case"priority":return[typeof e.priority=="number"?`P${e.priority}`:null];default:{let r=t.tagPrefix?.trim(),o=(Array.isArray(e.tags)?e.tags:[]).filter(c=>typeof c=="string"&&c.length>0&&(!r||c.startsWith(r)));return o.length>0?o:[null]}}}function K(e,n,t,r={}){let s=new Map,o=0;for(let a of e){o+=1;let u=t.classify(a.status);for(let l of O(a,n,r)){let y=l??"\0empty",f=s.get(y);f||(f={label:l??T(n),key:l,buckets:P(),total:0},s.set(y,f)),f.buckets[u]+=1,f.total+=1}}let c=[...s.values()].sort((a,u)=>u.total!==a.total?u.total-a.total:a.key===null?1:u.key===null?-1:a.label.localeCompare(u.label));return{dimension:n,rows:c,total_items:o}}export{B as a,R as b,U as c,G as d,K as e};
|
|
2
|
-
//# sourceMappingURL=chunk-H7KGWPDF.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Af as w,Ra as g,d as _,hf as H,tf as v,zf as u}from"./chunk-D4FPS43D.js";import l from"node:fs/promises";import{createHash as N}from"node:crypto";import S from"node:path";(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]="90364096-b94c-591c-9024-e697fa9322a5")}catch{}})();var b=3,F="history-drift-cache.json";function D(t){return S.join(t,"runtime",F)}async function T(t){try{let e=await l.readFile(D(t),"utf8"),n=JSON.parse(e);return n.version!==b||typeof n.entries!="object"||n.entries===null?null:n}catch{return null}}function p(t,e){return typeof t=="object"&&t!==null&&"code"in t&&t.code===e}async function j(t,e,n,i,r){let h=w(t),s;try{s=await l.stat(h)}catch(y){return p(y,"ENOENT")||r.unreadableStreams.push(u),!1}let c=r.missingStreams.length,o=await M({itemId:u,historyPath:h,stat:s,cached:e[u],verifyCacheHitByContent:i,accumulator:r});return o.verification?(o.verification.chainOk||r.chainMismatches.push(u),n[u]={mtime_ms:s.mtimeMs,ctime_ms:s.ctimeMs,size:s.size,content_hash:o.verification.contentHash,latest_after_hash:o.verification.latestAfterHash,chain_ok:o.verification.chainOk},o.cacheDirty):(r.missingStreams.splice(c),o.cacheDirty)}function k(t){return N("sha256").update(t).digest("hex")}async function z(t){let e=await l.readFile(t,"utf8");return k(e)}async function V(t){let e=await l.readFile(t,"utf8"),n=k(e);if(e.trim().length===0)return null;let i=[],r=null;for(let h of e.split(/\r?\n/)){let s=h.trim();if(s.length===0)continue;let c=JSON.parse(s);if(typeof c.after_hash!="string"||c.after_hash.trim().length===0)throw new Error("missing after_hash");i.push(c),r=c.after_hash}return r?{latestAfterHash:r,chainOk:v(i).ok,contentHash:n}:null}function x(t,e){return t!==void 0&&t.mtime_ms===e.mtimeMs&&t.ctime_ms===e.ctimeMs&&t.size===e.size}async function C(t,e,n){try{let i=await V(e);return i||(n.missingStreams.push(t),null)}catch{return n.unreadableStreams.push(t),null}}async function M(t){let e=typeof t.cached?.content_hash=="string"&&t.cached.content_hash.length>0?t.cached.content_hash:void 0;if(!(x(t.cached,t.stat)&&e!==void 0&&t.cached!==void 0)||!t.cached)return{verification:await C(t.itemId,t.historyPath,t.accumulator),cacheDirty:!0};let i;if(t.verifyCacheHitByContent)try{i=await z(t.historyPath)}catch{return t.accumulator.unreadableStreams.push(t.itemId),{verification:null,cacheDirty:!1}}else i=e;return!t.verifyCacheHitByContent||i===e?{verification:{latestAfterHash:t.cached.latest_after_hash,chainOk:t.cached.chain_ok,contentHash:i},cacheDirty:!1}:{verification:await C(t.itemId,t.historyPath,t.accumulator),cacheDirty:!0}}async function G(t,e,n={}){let i={missingStreams:[],unreadableStreams:[],hashMismatches:[],chainMismatches:[]},h=(await T(t))?.entries??{},s={},c=!1,o=n.cacheHitVerification!=="metadata";for(let a of e){let m=g(t,a.id),d;try{d=await l.stat(m)}catch(P){p(P,"ENOENT")?i.missingStreams.push(a.id):i.unreadableStreams.push(a.id);continue}let E=h[a.id],f=await M({itemId:a.id,historyPath:m,stat:d,cached:E,verifyCacheHitByContent:o,accumulator:i});if(c||=f.cacheDirty,!f.verification)continue;f.verification.chainOk||i.chainMismatches.push(a.id),s[a.id]={mtime_ms:d.mtimeMs,ctime_ms:d.ctimeMs,size:d.size,content_hash:f.verification.contentHash,latest_after_hash:f.verification.latestAfterHash,chain_ok:f.verification.chainOk};let{body:I,...A}=a;H({metadata:A,body:I})!==f.verification.latestAfterHash&&i.hashMismatches.push(a.id)}let y=await j(t,h,s,o,i);if(c||=y,c||Object.keys(h).length!==Object.keys(s).length){let a=D(t);try{await l.mkdir(S.dirname(a),{recursive:!0}),await _(a,JSON.stringify({version:b,entries:s}))}catch{}}let O=[...new Set([...i.missingStreams,...i.unreadableStreams,...i.hashMismatches,...i.chainMismatches])].sort((a,m)=>a.localeCompare(m));return{...i,driftedItems:O}}export{G as a};
|
|
2
|
-
//# sourceMappingURL=chunk-HFSD77TQ.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as m,d as p,g as w}from"./chunk-H5Y6UV6E.js";import{i as f}from"./chunk-NYIGHWQY.js";import{A as i,C as s}from"./chunk-D4FPS43D.js";import{readFile as y}from"node:fs/promises";(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]="500e83b0-28a8-58b1-a625-2d81eb245eb4")}catch{}})();async function c(e,t){let d=e.add!==void 0,a=e.stdin===!0,o=typeof e.file=="string",l=Number(d)+Number(a)+Number(o);if(l===0)return;if(l>1)throw new s("Specify comment text using only one input source: --add, --stdin, or --file",i.USAGE);if(d)return{value:await t.resolveValue(e.add,"--add")??"",emptyFlag:"--add"};if(a)return{value:await t.resolveValue("-","--stdin")??"",emptyFlag:"--stdin"};let n=e.file.trim();if(!n)throw new s("--file path cannot be empty",i.USAGE);try{return{value:await y(n,"utf8"),emptyFlag:"--file"}}catch(r){if(p(r)&&r.code==="ENOENT")throw new s(`--file path not found: ${n}`,i.USAGE);let u=r instanceof Error?r.message:String(r);throw new s(`Failed to read --file path "${n}": ${u}`,i.USAGE)}}async function h(e,t){let d=e.edit,a=e.delete,o=d!==void 0,l=a!==void 0;if(o&&l)throw new s("Specify only one of --edit or --delete",i.USAGE);if(d!==void 0&&(!Number.isInteger(d)||d<1))throw new s("--edit must be a positive integer",i.USAGE);if(a!==void 0&&(!Number.isInteger(a)||a<1))throw new s("--delete must be a positive integer",i.USAGE);if(l){if(await c(e,t)!==void 0)throw new s("--delete does not take comment text",i.USAGE);return{mode:"delete",index:a}}if(o){let u=await c(e,t);if(u===void 0)throw new s("--edit requires replacement text via positional [text], --add, --stdin, or --file",i.USAGE);return{mode:"edit",index:d,value:u.value,emptyFlag:u.emptyFlag}}let n=await c(e,t);return n===void 0?{mode:"list"}:{mode:n.emptyFlag==="--add"?"add":n.emptyFlag==="--stdin"?"stdin":"file",value:n.value,emptyFlag:n.emptyFlag}}async function x(e,t,d){let a=f(),o=await h(t,a),l=o.mode==="add"||o.mode==="edit",n=o.value??"";return w(e,t,d,{input:{...o,rawValue:t.add??n,value:l?m(n,{stripPlainTextPrefix:!0}):n},collectionKey:"comments",op:"comment_add",editOp:"comment_edit",deleteOp:"comment_delete",parseText:r=>r,createEntry:r=>r,bypassOwnershipConflict:!!(o.mode==="add"&&t.ownershipAppendBypass),conflictGuidance:{required:"For an approved append-only handoff on another owner's item, use the package-provided ownership bypass before considering --force.",examples:['pm comments pm-a1b2 --add "review note" --author "reviewer" --force'],nextSteps:["Use an installed package's narrow append-only ownership bypass when available.","Use --force only when an ownership override is explicitly approved."]}})}export{x as a};
|
|
2
|
-
//# sourceMappingURL=chunk-HX2GTA6L.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{h as _,l as Q,m as Y,o as ee,p as te}from"./chunk-WSJEIGJF.js";import{A as m,C as h,Da as P,La as T,Ma as $,Nf as D,Oa as L,Qf as G,Vf as V,Y as E,Yf as H,Zf as X,_f as B,b as I,dg as J,lc as z,xc as W,zd as Z}from"./chunk-D4FPS43D.js";import oe from"node:fs/promises";import p from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="5e45d0f1-a1a7-50ea-a9a3-ec6283d3471d")}catch{}})();var ne=32768;function b(e){return _(p.normalize(e))}async function v(e){try{return await oe.realpath(e)}catch{return p.resolve(e)}}function g(e,t){let c=p.isAbsolute(e.path)?p.resolve(e.path):p.resolve(t,e.path);return`${b(c)}::${e.scope}`}function R(e,t,c){if(typeof e=="string"){let n=e.trim();n.length>0&&c.push({field:t,value:n});return}if(Array.isArray(e)){e.forEach((n,s)=>R(n,`${t}[${s}]`,c));return}if(typeof e=="object"&&e!==null)for(let[n,s]of Object.entries(e))R(s,t?`${t}.${n}`:n,c)}function se(e){let t=[];return R(e.metadata,"metadata",t),R(e.body,"body",t),t}function ae(e){let t=e.trim();return t=t.replace(/^[`"'<([{]+/u,""),t=t.replace(/[`"'>)\]},;!?]+$/u,""),t=t.replace(/[.]+$/u,""),t=t.replace(/:(?:\d+)(?::\d+)?$/u,""),t=t.replace(/[.]+$/u,""),t}function ie(e){let t=[],c=/(?:[A-Za-z]:[\\/]|\/)[^\s"'`<>()[\]{},;]+/gu,n=/(?:\.{1,2}[\\/])?(?:(?:[A-Za-z0-9_.@-]+[\\/])+[A-Za-z0-9_.@-]+|[A-Za-z0-9_.@-]+\.[A-Za-z0-9][A-Za-z0-9._-]*)/gu;for(let s of e){let l=new Set,a=s.value.slice(0,ne);for(let[i,r]of[[c,s.value],[n,a]]){i.lastIndex=0;for(let o of r.matchAll(i)){let d=ae(o[0]);!d||l.has(d)||(l.add(d),t.push({field:s.field,value:d}))}}}return t}async function re(e,t,c=t){let n=p.isAbsolute(e)?p.resolve(e):p.resolve(c,e),s;try{s=await oe.stat(n)}catch{return}if(!s.isFile())return;let[l,a]=await Promise.all([v(t),v(n)]);if(E(l,a)){let i=p.relative(l,a);return!i||i.startsWith("..")||p.isAbsolute(i)?void 0:{path:b(i),scope:"project"}}return{path:b(n),scope:"global"}}async function ce(e,t,c=t){let n=new Set((e.metadata.files??[]).map(r=>g(r,t))),s=new Map,l=ie(se(e)),a=new Map;await Promise.all([...new Set(l.map(r=>r.value))].map(async r=>{a.set(r,await re(r,t,c))}));let i=l.map(r=>({reference:r,resolved:a.get(r.value)}));for(let{reference:r,resolved:o}of i){if(!o)continue;let d=g(o,t),f=s.get(d)??{path:o.path,scope:o.scope,sourceFields:new Set,originalPaths:new Set,sourceCount:0};f.sourceFields.add(r.field),f.originalPaths.add(r.value),f.sourceCount+=1,s.set(d,f)}return[...s.entries()].map(([r,o])=>({path:o.path,scope:o.scope,status:n.has(r)?"already_linked":"addable",source_count:o.sourceCount,source_fields:[...o.sourceFields].sort((d,f)=>d.localeCompare(f)),original_paths:[...o.originalPaths].sort((d,f)=>d.localeCompare(f))})).sort((r,o)=>{let d=r.status.localeCompare(o.status);if(d!==0)return d;let f=r.path.localeCompare(o.path);return f!==0?f:r.scope.localeCompare(o.scope)})}var $e={relativeReferenceScanMaxChars:ne,normalizeCandidatePathForOutput:b,realpathForContainment:v,linkedFileResolvedKey:g,collectTextReferences:R,collectItemTextReferences:se,cleanupPathToken:ae,extractRawPathReferences:ie,resolveDiscoveredFile:re,discoverReferencedFiles:ce};async function Le(e,t,c){let n=await ee(e,t,c,{metadataKey:"files",op:"files_add",bareNoun:"file",supportsAppendStable:!0});return te(n,"files")}async function me(e,t){let c=await v(t),n=await Promise.all(e.map(async l=>{let a=l.trim();if(!a)throw new h("Files lookup paths must not be empty.",m.USAGE);if(!p.isAbsolute(a))return _(a);let i=await v(a);return E(c,i)?_(p.relative(c,i)):_(i)})),s=[...new Set(n)].sort((l,a)=>l.localeCompare(a));if(s.length===0)throw new h("Files lookup requires at least one path.",m.USAGE);return s}function he(e){for(let[n,s]of[["limit",e.limit],["offset",e.offset]])if(s!==void 0&&(!Number.isInteger(s)||s<0))throw new h(`Files lookup ${n} must be a non-negative integer.`,m.USAGE);let{offset:t=0,limit:c=50}=e;return{offset:Math.max(0,Math.floor(t)),limit:e.noTruncate?void 0:Math.max(0,Math.floor(c))}}function le(e){return{id:e.id,title:e.title,type:e.type,status:e.status,priority:e.priority,updated_at:e.updated_at}}async function ge(e){if([e.strictRead,e.noTruncate,W()].includes(!0))return null;let t=await V(e.pmRoot,[...new Set(Object.values(e.typeToFolder))]);return t?G({pmRoot:e.pmRoot,expectedSourceCursor:t.source_cursor,paths:e.paths,scope:e.scope,limit:e.limit,offset:e.offset}):null}async function ye(e){let t=[],n=(await B(e.pmRoot,e.settings.item_format,e.typeToFolder,t,e.settings.schema)).map(a=>({item:a,files:(a.files??[]).filter(i=>e.paths.includes(_(i.path))&&(e.scope===void 0||i.scope===e.scope)).sort((i,r)=>{let o=i.path.localeCompare(r.path);return o===0?i.scope.localeCompare(r.scope):o})})).filter(a=>a.files.length>0).sort((a,i)=>{let r=a.item.priority-i.item.priority;if(r!==0)return r;let o=i.item.updated_at.localeCompare(a.item.updated_at);return o===0?a.item.id.localeCompare(i.item.id):o}),s=t.filter(a=>/^item_list_(?:item|directory)_read_failed:/u.test(a));if(e.strictRead&&s.length>0)throw new h(`Files lookup could not read every item: ${s.join("; ")}`,m.GENERIC_FAILURE);let l=n.slice(e.offset,e.limit===void 0?void 0:e.offset+e.limit);return{paths:e.paths,total:n.length,count:l.length,offset:e.offset,limit:e.limit??null,has_more:e.offset+l.length<n.length,truncated:e.offset+l.length<n.length,completeness:{status:s.length===0?"complete":"partial",source:"source_scan"},warnings:t,matches:l.map(a=>({item:le(a.item),files:a.files}))}}async function ze(e,t){let c=T(process.cwd(),t.path),n=$(c);if(!await I(L(c)))throw new h(`Tracker is not initialized at ${c}. Run pm init first.`,m.NOT_FOUND);let s=await me(e.paths,n),l=await D(c),a=P(l,z()),{offset:i,limit:r}=he(e),o=await ge({pmRoot:c,typeToFolder:a.type_to_folder,paths:s,scope:e.scope,limit:r,offset:i,strictRead:e.strictRead===!0,noTruncate:e.noTruncate===!0});return o?{paths:s,total:o.total,count:o.matches.length,offset:i,limit:r,has_more:i+o.matches.length<o.total,truncated:i+o.matches.length<o.total,completeness:{status:"unchecked",source:"index"},warnings:[],matches:o.matches.map(d=>({item:le(d.item),files:d.files}))}:ye({pmRoot:c,settings:l,typeToFolder:a.type_to_folder,paths:s,scope:e.scope,limit:r,offset:i,strictRead:e.strictRead===!0})}async function De(e,t,c){let n=T(process.cwd(),c.path),s=$(n);if(!await I(L(n)))throw new h(`Tracker is not initialized at ${n}. Run pm init first.`,m.NOT_FOUND);let l=await D(n),a=P(l,z()),i=await H(n,e,l.id_prefix,l.item_format,a.type_to_folder);if(!i)throw new h(`Item ${e} not found`,m.NOT_FOUND);let r=await X(i,{schema:l.schema}),o=await ce(r.document,s,process.cwd()),d=o.filter(u=>u.status==="addable"),f=o.filter(u=>u.status==="already_linked"),O=t.apply===!0,de=t.note?.trim()||"discovered from item text";if(!O||d.length===0){let u=r.document.metadata.files??[];return{id:i.id,files:u,changed:!1,apply:O,count:u.length,candidate_count:o.length,addable_count:d.length,added_count:0,skipped_existing_count:f.length,candidates:o,added:[],skipped_existing:f}}let ue=Z(t.author,l.author_default),A=d.map(u=>({path:u.path,scope:u.scope,note:de})),y=[],x=new Set,M=await J({pmRoot:n,settings:l,id:e,op:"files_discover",author:ue,message:t.message??"Discover referenced file links",force:t.force,mutate(u){let w=[...u.metadata.files??[]],U=new Set(w.map(S=>g(S,s)));y=[],x.clear();for(let[S,C]of A.entries()){let q=g(C,s);U.has(q)||(w.push(C),U.add(q),y.push(C),x.add(S))}let j=Y(w),K=t.appendStable?j:Q(j);return K.length>0?u.metadata.files=K:delete u.metadata.files,{changedFields:y.length>0?["files"]:[],warnings:y.length!==A.length?[`files_discover_skipped_existing:${A.length-y.length}`]:[]}}}),k=M.item.files??[],fe=new Set(y.map(u=>g(u,s))),F=k.filter(u=>fe.has(g(u,s))),pe=d.filter((u,w)=>!x.has(w)),N=[...f,...pe];return{id:M.item.id,files:k,changed:F.length>0,apply:!0,count:k.length,candidate_count:o.length,addable_count:d.length,added_count:F.length,skipped_existing_count:N.length,candidates:o,added:F,skipped_existing:N}}export{$e as a,Le as b,ze as c,De as d};
|
|
2
|
-
//# sourceMappingURL=chunk-J2IEKAVR.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(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]="288a7da9-888b-527d-88fb-4711917cec5b")}catch{}})();var a=e=>{let t='"',n=0;for(let r of e){if(r==="\\"){n+=1;continue}t+="\\".repeat(r==='"'?n*2+1:n),t+=r,n=0}return`${t}${"\\".repeat(n*2)}"`},c=(e,t=process.platform)=>(t==="win32"?/^[A-Za-z0-9._:/\\@=-]+$/:/^[A-Za-z0-9._:/@=-]+$/).test(e)?e:t==="win32"?a(e):`"${e.replace(/(["\\$`])/g,"\\$1")}"`,i=(e,t=process.platform)=>{let n=e.map(r=>c(r,t)).join(" ");return n.length>0?`pm ${n}`:"pm"},d=new Set(["--literal","--regex","--replacement"]);function f(e){if(!e.includes("history-redact"))return[...e];let t=[],n=!1;for(let r of e){if(n&&!r.startsWith("-")){t.push("[redacted]"),n=!1;continue}n=!1;let s=r.indexOf("="),o=s>=0?r.slice(0,s):r;if(!d.has(o)){t.push(r);continue}if(s>=0){t.push(`${o}=[redacted]`);continue}t.push(o),n=!0}return t}export{a,c as b,i as c,f as d};
|
|
2
|
-
//# sourceMappingURL=chunk-JC6FKIFM.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as ne,b as ie,c as se,d as P,e as C}from"./chunk-PD3225AM.js";import{A as f,Ad as G,C as h,Da as N,Gf as Z,Hf as ee,La as S,Nf as te,Oa as $,Pa as W,R as A,Ra as b,Uf as oe,Wf as re,Yf as F,Zf as O,b as R,bg as ae,c as v,d as p,hd as B,id as M,jf as X,kf as J,lc as j,of as K,pf as Q,qc as z,qf as T,rc as k,uc as x,vc as U,wf as V,yf as Y,zd as q}from"./chunk-D4FPS43D.js";import Re from"fast-json-patch";import L from"node:fs/promises";(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]="353be665-9f67-5d0e-99c9-6bbb7e927e0b")}catch{}})();function ce(e,t){return ie(e,t,{errorSubject:"restore",allowFutureTimestamp:!0})}function de(e){let t=P(e,e.length-1);return Object.keys(t.metadata).length===0?{metadata:{},body:t.body}:M(K(t))}async function le(e,t,a,d){let r=await F(e,t,a.id_prefix,a.item_format,d);if(r){let c=b(e,r.id),m=await V({pmRoot:e,settings:a,itemId:r.id,commandLabel:"restore"});return{id:r.id,historyPath:c,located:r,historyPolicyWarnings:m.warnings}}let o=ee(t,a.id_prefix),i=Z(t),n=o===i?[o]:[o,i];for(let c of n){let m=b(e,c);if(await R(m))return{id:c,historyPath:m,located:null,historyPolicyWarnings:[]}}throw new h(`Item ${t} not found`,f.NOT_FOUND)}function fe(e,t){let a=T(e),d=T(t),r=Re.compare(a,d),o=new Set;for(let i of r){if(i.path==="/body"||i.path.startsWith("/body/")){o.add("body");continue}let n=i.path.replace(/^\/(?:metadata|front_matter)\/?/,"").split("/")[0];o.add(n.replaceAll("~1","/").replaceAll("~0","~"))}return Array.from(o).sort((i,n)=>i.localeCompare(n))}async function ve(e){if(await v(e.subject.historyPath)!==e.historyRawBeforeLock)throw new h(`History for ${e.resolvedId} changed while waiting for lock; retry restore.`,f.CONFLICT);let a=await F(e.pmRoot,e.resolvedId,e.settings.id_prefix,e.settings.item_format,e.typeToFolder),d=a?await O(a,{schema:e.settings.schema}):null;if((d?.raw??null)!==e.currentItemRawBeforeLock)throw new h(`Item ${e.resolvedId} changed while waiting for lock; retry restore.`,f.CONFLICT);return{loadedItemUnderLock:d,existingItemPath:a?.itemPath??null}}function be(e,t){return e?{document:e.document,originalRaw:e.raw}:{document:de(t),originalRaw:null}}function ke(e){let t=e.document.metadata.assignee?.trim();if(!(t&&t!==e.author&&!e.force))return[];if(e.enforcement==="strict")throw new h(`Item ${e.resolvedId} is assigned to ${t}. Use --force to override.`,f.CONFLICT);return e.enforcement==="warn"?[`ownership_warning:assignee_conflict:${e.resolvedId}:${t}`]:[]}async function xe(e){if(e.existingItemPath&&e.resolvedOriginalRaw!==null&&e.restoredItemPath!==e.existingItemPath){await p(e.existingItemPath,e.resolvedOriginalRaw),await L.rm(e.restoredItemPath,{force:!0});return}if(e.existingItemPath&&e.resolvedOriginalRaw!==null){await p(e.existingItemPath,e.resolvedOriginalRaw);return}await L.rm(e.restoredItemPath,{force:!0})}async function Te(e){return[...await x({path:e.restoredItemPath,scope:"project",op:"restore",item_id:e.after.metadata.id,item_type:e.after.metadata.type,before:e.before,after:e.after,changed_fields:["restored"]}),...await x({path:e.historyPath,scope:"project",op:"restore:history",item_id:e.after.metadata.id,item_type:e.after.metadata.type,before:e.before,after:e.after,changed_fields:["restored"]})]}async function He(e,t,a,d){let r=S(process.cwd(),d.path);if(!await R($(r)))throw new h(`Tracker is not initialized at ${r}. Run pm init first.`,f.NOT_FOUND);let o=await te(r),i=N(o,j()),n=await le(r,e,o,i.type_to_folder),c=n.id,m=await v(n.historyPath),y=await G(n.historyPath,c);if(y.length===0)throw new h(`No history exists for ${c}; restore is unavailable.`,f.NOT_FOUND);let u=ce(t,y),he=C(P(y,u.historyIndex),u),s=Q(he,{schema:o.schema});if(s.metadata.id!==c)throw new h(`Restore target resolved to item ${s.metadata.id}, expected ${c}.`,f.GENERIC_FAILURE);let me=(n.located?await O(n.located,{schema:o.schema}):null)?.raw??null,_=q(a.author,o.author_default),ue=await Y(r,c,o.locks.ttl_seconds,_,!!a.force,o.governance.force_required_for_stale_lock,o.locks.wait_ms);try{let{loadedItemUnderLock:ye,existingItemPath:w}=await ve({pmRoot:r,resolvedId:c,subject:n,settings:o,typeToFolder:i.type_to_folder,historyRawBeforeLock:m,currentItemRawBeforeLock:me}),D="toon",l=be(ye,y),we=ke({document:l.document,author:_,force:a.force,enforcement:o.governance.ownership_enforcement,resolvedId:c}),g=fe(l.document,s);await U({pm_root:r,operation:"restore",before:l.document,after:s,changed_fields:g,sdk:ae({pmRoot:r,settings:o,typeToFolder:i.type_to_folder})});let ge=B(s,{format:D,schema:o.schema}),I=W(r,s.metadata.type,c,D,i.type_to_folder),Ie=await oe(r,_),E=[];try{await p(I,ge),w&&I!==w&&await L.rm(w);let pe=X({nowIso:A(),author:_,op:"restore",before:l.document,after:s,message:a.message});try{await J(n.historyPath,pe)}catch(Pe){throw await xe({existingItemPath:w,resolvedOriginalRaw:l.originalRaw,restoredItemPath:I}),Pe}E=await re({pmRoot:r,preferredFormat:o.item_format,typeToFolder:i.type_to_folder,schema:o.schema,itemPath:I,previousItemPath:w??void 0,document:s})}finally{await Ie()}let _e=await Te({restoredItemPath:I,historyPath:n.historyPath,before:l.document,after:s});z({id:s.metadata.id,op:"restore",item_type:s.metadata.type,previous_status:l.document.metadata.status,status:s.metadata.status,previous:k(l.document.metadata,g),current:k(s.metadata,g),changed_fields:g});let H=y[u.historyIndex];return{item:s.metadata,restored_from:{kind:u.kind,target:u.raw,history_index:u.historyIndex+1,entry_ts:H.ts,entry_op:H.op},changed_fields:g,warnings:[...n.historyPolicyWarnings,...we,...E,..._e]}}finally{await ue()}}var Ae={applyHistoryPatch:se,changedFields:fe,ensureMaterializedRestoreTarget:C,ensureReplayTarget:ce,extractPatchFailureContext:ne,replayCurrentDocument:de,replayToTarget:P,resolveRestoreSubject:le};export{He as a,Ae as b};
|
|
2
|
-
//# sourceMappingURL=chunk-K44PYFXH.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{A as i,C as t}from"./chunk-D4FPS43D.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b9581c92-5e8a-589d-9681-d4d014e6902b")}catch{}})();function f(e,n="--limit"){if(e===void 0)return;let r=Number(e);if(!Number.isFinite(r)||r<0)throw new t(`${n} must be a non-negative number`,i.USAGE);return Math.floor(r)}export{f as a};
|
|
2
|
-
//# sourceMappingURL=chunk-K4KGEEBT.js.map
|