@unbrained/pm-cli 2026.11.26 → 2026.11.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/dist/cli-bundle/bundle-manifest.json +1 -1
- package/dist/cli-bundle/chunks/{chunk-BITDGTAX.js → chunk-2YD2AERA.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-54AQJTUH.js +3 -0
- package/dist/cli-bundle/chunks/chunk-56DKWGHE.js +2 -0
- package/dist/cli-bundle/chunks/chunk-56GUDMXN.js +113 -0
- package/dist/cli-bundle/chunks/chunk-5ECCMDSU.js +2 -0
- package/dist/cli-bundle/chunks/chunk-6RBD2AKU.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-PQSEEVOA.js → chunk-C4O5TZY3.js} +46 -46
- package/dist/cli-bundle/chunks/chunk-CATRDGAB.js +125 -0
- package/dist/cli-bundle/chunks/{chunk-5FY2VHRF.js → chunk-CDUV7DFD.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-CTM26LUE.js +4 -0
- package/dist/cli-bundle/chunks/chunk-D3I5AHNN.js +2 -0
- package/dist/cli-bundle/chunks/chunk-E2LQ6LCJ.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-B2GM6KOM.js → chunk-FG4TNQQM.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-JQYPSABI.js +2 -0
- package/dist/cli-bundle/chunks/chunk-LMDIKSDZ.js +9 -0
- package/dist/cli-bundle/chunks/chunk-LRGYV6QQ.js +2 -0
- package/dist/cli-bundle/chunks/chunk-MO6PPUI6.js +2 -0
- package/dist/cli-bundle/chunks/chunk-O2SWNEBW.js +8 -0
- package/dist/cli-bundle/chunks/{chunk-5AAIRHNE.js → chunk-O2WNNIKK.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-LNZKNVMT.js → chunk-OFIYA3PI.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-DYL2N3OC.js → chunk-Q6BGQRCB.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-RGE3XW3A.js +2 -0
- package/dist/cli-bundle/chunks/chunk-SP6CDM6B.js +31 -0
- package/dist/cli-bundle/chunks/{chunk-T3GJPXIZ.js → chunk-T7RZPIOB.js} +14 -14
- package/dist/cli-bundle/chunks/{chunk-MNFCJNQA.js → chunk-T7UTG56V.js} +4 -4
- package/dist/cli-bundle/chunks/chunk-TWRUA2NH.js +3 -0
- package/dist/cli-bundle/chunks/chunk-WKDKBS4P.js +4 -0
- package/dist/cli-bundle/chunks/chunk-YEMFOKFG.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-ZDL45VTB.js → chunk-YLS2N4SN.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-FWBR3OW7.js → chunk-ZXERHBMA.js} +2 -2
- package/dist/cli-bundle/chunks/field-definition-losses-JFMMMVTV.js +2 -0
- package/dist/cli-bundle/chunks/field-option-collisions-G4LQ2646.js +2 -0
- package/dist/cli-bundle/{focused-chunks/item-revision-RPTXN7WW.js → chunks/item-revision-O7L3AA2W.js} +2 -2
- package/dist/cli-bundle/chunks/item-transaction-4XC74ULD.js +2 -0
- package/dist/cli-bundle/chunks/mutation-actor-A45DFDEO.js +2 -0
- package/dist/cli-bundle/chunks/mutation-admission-SIUIMAEO.js +2 -0
- package/dist/cli-bundle/chunks/{register-list-query-EKSCZWEZ.js → register-list-query-FCPGG2UT.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-ZIAOKKUJ.js → register-mutation-VD3JX23I.js} +2 -2
- package/dist/cli-bundle/chunks/register-operations-KHJD4GFZ.js +2 -0
- package/dist/cli-bundle/chunks/register-setup-EWAZZWPL.js +2 -0
- package/dist/cli-bundle/chunks/runtime-schema-3RAXYNG5.js +2 -0
- package/dist/cli-bundle/chunks/{settlement-hook-ESAAEBRM.js → settlement-hook-KWBOSRDZ.js} +2 -2
- package/dist/cli-bundle/chunks/stage-UIDZMTE5.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-5MZXU6HB.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-64DSKZJN.js +100 -0
- package/dist/cli-bundle/focused-chunks/{chunk-YSZZSV6M.js → chunk-7EKKUYN5.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-7P6OGPEG.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-A5B43EWU.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-AHCOSTL7.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-CQLOYNJY.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-E4C6T3NL.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-3GQRWIT5.js → chunk-HCWDMFWA.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-GQBWI4KA.js → chunk-J4V3J5MC.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-JD45Y2BR.js +91 -0
- package/dist/cli-bundle/focused-chunks/chunk-KMGI5GZP.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-MSLRDKWL.js +4 -0
- package/dist/cli-bundle/focused-chunks/chunk-O33WUEAF.js +3 -0
- package/dist/cli-bundle/focused-chunks/{chunk-QNWNUQSJ.js → chunk-OEMI52ZS.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-AAB3ZR7Z.js → chunk-Q6JCMFGU.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-RBOWKXFV.js +8 -0
- package/dist/cli-bundle/focused-chunks/chunk-TF57RHS2.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-TNVLDU7Z.js → chunk-VNU3IFBL.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-X5ZVPFK7.js +4 -0
- package/dist/cli-bundle/focused-chunks/chunk-XVCMYFQU.js +27 -0
- package/dist/cli-bundle/focused-chunks/{chunk-RDELKGLS.js → chunk-Y7EC2L2G.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{chunk-FQWKESMI.js → chunk-YC3PFFDE.js} +56 -56
- package/dist/cli-bundle/focused-chunks/{chunk-QSRXF6XS.js → chunk-YX75PQFO.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-KEZ4VXYD.js → chunk-Z4FWJGQG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZHHFOQSL.js +44 -0
- package/dist/cli-bundle/focused-chunks/chunk-ZUAPUBJK.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-NXUFVQ33.js → chunk-ZYHGQIQ7.js} +2 -2
- package/dist/cli-bundle/focused-chunks/field-definition-losses-NUZO3JCP.js +2 -0
- package/dist/cli-bundle/focused-chunks/field-option-collisions-63YQ2J3N.js +2 -0
- package/dist/cli-bundle/focused-chunks/item-revision-PV5O6F5Y.js +2 -0
- package/dist/cli-bundle/focused-chunks/item-transaction-S5QXBGAT.js +2 -0
- package/dist/cli-bundle/{chunks/mutation-actor-HGG47KXV.js → focused-chunks/mutation-actor-2AAUJG2Z.js} +2 -2
- package/dist/cli-bundle/focused-chunks/mutation-admission-X7HHNERR.js +2 -0
- package/dist/cli-bundle/focused-chunks/runtime-schema-5J2ONRNV.js +2 -0
- package/dist/cli-bundle/focused-chunks/stage-56RYPMBK.js +2 -0
- package/dist/cli-bundle/main.js +2 -2
- 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 +1 -1
- 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 +63 -63
- 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 -2
- package/dist/core/extensions/index.js +1 -1
- package/dist/core/extensions/item-fields.d.ts +15 -1
- package/dist/core/extensions/item-fields.js +1 -1
- package/dist/core/extensions/loader.js +1 -1
- package/dist/core/profile/profile-lint.js +1 -1
- package/dist/core/schema/runtime-schema.d.ts +20 -1
- package/dist/core/schema/runtime-schema.js +2 -2
- package/dist/core/shared/command-line.d.ts +2 -2
- package/dist/core/shared/command-line.js +1 -1
- package/dist/core/shared/secret-rules.js +5 -5
- package/dist/sdk/agent/refusal-reachability.d.ts +1 -1
- package/dist/sdk/extension/command-options.d.ts +8 -0
- package/dist/sdk/extension/command-options.js +1 -1
- package/dist/sdk/extension-command-context.js +2 -2
- package/dist/sdk/governance/validate.js +1 -1
- package/dist/sdk/lifecycle/create.js +1 -1
- package/dist/sdk/lifecycle/update.js +2 -2
- package/dist/sdk/profile.js +1 -1
- package/dist/sdk/read-output-contracts.js +1 -1
- package/dist/sdk/schema/field-definition-losses.js +2 -0
- package/dist/sdk/schema/field-option-collisions.js +1 -1
- package/dist/sdk/schema.js +2 -2
- package/docs/COMMANDS.md +1 -1
- package/docs/CONFIGURATION.md +3 -1
- package/docs/EXTENSIONS.md +1 -1
- package/docs/MUTATION_INTEGRITY.md +47 -0
- package/docs/SDK.md +3 -1
- package/docs/SDK_AUDITED_MUTATIONS.md +12 -3
- package/marketplace.json +1 -1
- package/package.json +1 -1
- 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-claude/package.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +1 -1
- package/plugins/pm-codex/plugin.json +1 -1
- package/runtime-dependencies.json +1 -1
- package/dist/cli-bundle/chunks/chunk-5BPDT7G2.js +0 -2
- package/dist/cli-bundle/chunks/chunk-7F3UFYZA.js +0 -2
- package/dist/cli-bundle/chunks/chunk-CBBKXTJG.js +0 -2
- package/dist/cli-bundle/chunks/chunk-DUJSME77.js +0 -3
- package/dist/cli-bundle/chunks/chunk-GQXK4KKH.js +0 -31
- package/dist/cli-bundle/chunks/chunk-HOLQZ56F.js +0 -8
- package/dist/cli-bundle/chunks/chunk-HTGN24XM.js +0 -3
- package/dist/cli-bundle/chunks/chunk-IGW3RVJC.js +0 -3
- package/dist/cli-bundle/chunks/chunk-KCRRTJ4X.js +0 -125
- package/dist/cli-bundle/chunks/chunk-KES4VHU4.js +0 -2
- package/dist/cli-bundle/chunks/chunk-NDS4MXZX.js +0 -2
- package/dist/cli-bundle/chunks/chunk-QMM46SJM.js +0 -4
- package/dist/cli-bundle/chunks/chunk-RFK3ERYX.js +0 -2
- package/dist/cli-bundle/chunks/chunk-SX76UGEY.js +0 -3
- package/dist/cli-bundle/chunks/chunk-WZOJSHJT.js +0 -113
- package/dist/cli-bundle/chunks/chunk-XRCE4QNL.js +0 -9
- package/dist/cli-bundle/chunks/field-option-collisions-CGRJEAPQ.js +0 -2
- package/dist/cli-bundle/chunks/item-revision-FGDR5NSF.js +0 -2
- package/dist/cli-bundle/chunks/item-transaction-C3KAMEYO.js +0 -2
- package/dist/cli-bundle/chunks/mutation-admission-LLHIRY6O.js +0 -2
- package/dist/cli-bundle/chunks/register-operations-ECVBZ5FM.js +0 -2
- package/dist/cli-bundle/chunks/register-setup-3QYD5H4H.js +0 -2
- package/dist/cli-bundle/chunks/runtime-schema-Y4SHTEXL.js +0 -2
- package/dist/cli-bundle/chunks/stage-RSCSUYEJ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-3BR5NWQI.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-AVLB4L7M.js +0 -44
- package/dist/cli-bundle/focused-chunks/chunk-FW5Q26HA.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-IWEGGRRD.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-JUG3BAZZ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-NSFS3VWP.js +0 -100
- package/dist/cli-bundle/focused-chunks/chunk-OCKKIECS.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-R6QFPHWW.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-RFJ3MEFP.js +0 -27
- package/dist/cli-bundle/focused-chunks/chunk-RMJKVQYE.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-UA2JNKMY.js +0 -4
- package/dist/cli-bundle/focused-chunks/chunk-VV2QF5IE.js +0 -91
- package/dist/cli-bundle/focused-chunks/chunk-WHHFPATO.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-YNRW2FWB.js +0 -2
- package/dist/cli-bundle/focused-chunks/field-option-collisions-WV6GPYYP.js +0 -2
- package/dist/cli-bundle/focused-chunks/item-transaction-A6MVNPT7.js +0 -2
- package/dist/cli-bundle/focused-chunks/mutation-actor-6ZVW6OME.js +0 -2
- package/dist/cli-bundle/focused-chunks/mutation-admission-2DA4CINP.js +0 -2
- package/dist/cli-bundle/focused-chunks/runtime-schema-YXPYDD2C.js +0 -2
- package/dist/cli-bundle/focused-chunks/stage-RG3PKST7.js +0 -2
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{b as ye}from"./chunk-NDS4MXZX.js";import{Dd as I,Ed as w,Nc as ge,oc as Ie,pc as xe,qb as k,rb as b,xb as _e}from"./chunk-KCRRTJ4X.js";import{v as he}from"./chunk-XRCE4QNL.js";import{Dh as pe,H as Y,P as j,Pf as ie,V as X,Wf as B,X as J,Xf as re,Yf as N,Zf as se,_f as ce,ba as Q,bg as ae,cg as de,dg as le,eg as ue,fg as fe,gg as me,ha as Z,hg as T,kb as y,lb as v,rg as h,sc as oe,y as V}from"./chunk-WZOJSHJT.js";import{y as ee,z as te}from"./chunk-DUJSME77.js";import{O as ne}from"./chunk-SX76UGEY.js";import{A as m,C as u,z as W}from"./chunk-6OIHST4I.js";import{readdir as Ke}from"node:fs/promises";import H from"node:path";function O(e,o){return(o===void 0?void 0:J(e,o))?.execution_role??j[e.trim().toLowerCase()]??"agent"}var L="blocked_by",we="blocks",De=Object.freeze([L,we]),A="no-active-blocker";function d(e){return e.trim().toLowerCase()}function E(e,o){return o?`external:${e}`:`local:${d(e)}`}function _(e){let o=new Map,t=typeof e.blocked_by=="string"?e.blocked_by.trim():"";if(t.length>0&&d(t)!==A){let n=I(t);o.set(E(t,n),n?t:d(t))}for(let n of e.dependencies??[]){let i=typeof n.id=="string"?n.id.trim():"";if(h(n.kind)===L&&i.length>0&&d(i)!==A){let r=I(i)||w(n.source_kind);o.set(E(i,r),r?i:d(i))}}return[...o.values()].sort((n,i)=>n.localeCompare(i))}function C(e){let o=new Map;for(let t of e){let n=d(t.id);n.length!==0&&o.set(n,new Set(_(t)))}for(let t of e){let n=d(t.id);if(n.length!==0)for(let i of t.dependencies??[]){let r=h(i.kind)===we&&typeof i.id=="string"?d(i.id):"";if(r.length===0||r===A)continue;let s=o.get(r)??new Set;s.add(n),o.set(r,s)}}return new Map([...o].map(([t,n])=>[t,[...n].sort((i,r)=>i.localeCompare(r))]))}function ve(e,o){let t=d(e.id);return t.length>0?C(o).get(t)??_(e):_(e)}function D(e,o,t,n){let i=e,r=typeof i.id=="string"?n?.get(d(i.id))??ve(i,[...o.values()]):_(e),s=new Set((e.dependencies??[]).filter(c=>h(c.kind)===L&&w(c.source_kind)&&typeof c.id=="string"&&c.id.trim().length>0).map(c=>E(c.id.trim(),!0)));return r.map(c=>{if(I(c)||s.has(E(c,!0)))return{id:c,title:null,status:null,resolved:!1,external:!0,...typeof e.updated_at=="string"?{blocked_since:e.updated_at}:{},resolver:null};let a=o.get(d(c));return a?{id:c,title:a.title,status:a.status,resolved:v(a.status,t)}:{id:c,title:null,status:null,resolved:!1}})}function M(e,o,t){return D(e,o,t)}function Me(e,o){let t=new Map(e.map(s=>[d(s.id),s])),n=C(e),i=new Set([...ke(o),...o.blocked_statuses]),r=new Set;for(let s of e){let c=y(s.status,o);if(!i.has(c))continue;(o.blocked_statuses.has(c)||D(s,t,o,n).some(l=>!l.resolved))&&r.add(d(s.id))}return r}function He(e,o,t={},n){let i=[...e.ready,...e.decisions,...e.gates];t.includeContainers===!0&&i.push(...e.containers.filter(s=>s.open_blockers.length===0&&!o.blocked_statuses.has(y(s.item.status,o))));let r={ready:[],decisions:[],gates:[]};for(let s of i){let c=O(s.item.type,n);c==="human"&&t.includeDecisions!==!0?r.decisions.push(s):c==="gate"&&t.includeGates!==!0?r.gates.push(s):r.ready.push(s)}return r}function ke(e){return e.active_statuses.size>0?e.active_statuses:new Set([e.open_status])}function Pe(e,o,t){let n=[d(e)],i=new Set;for(;n.length>0;){let r=n.pop();if(!i.has(r)){i.add(r);for(let s of o.get(r)??[]){if(!v(s.status,t))return!0;n.push(d(s.id))}}}return!1}function $e(e){let o=new Map,t=new Map,n=new Map,i=C(e);for(let r of e){o.set(d(r.id),r);let s=typeof r.parent=="string"?r.parent.trim():"";if(s.length>0){let c=d(s),a=t.get(c)??[];a.push(r),t.set(c,a)}for(let c of i.get(d(r.id))){let a=d(c),l=n.get(a)??[];l.push(r.id),n.set(a,l)}}return{itemsById:o,childrenByParent:t,blockedByReverse:n,blockerIdsByItem:i}}function Fe(e,o,t,n){let{itemsById:i,childrenByParent:r,blockedByReverse:s,blockerIdsByItem:c}=$e(o),a=new Set([...ke(t),...t.blocked_statuses]),l=new Set(o.filter(f=>!v(f.status,t)).map(f=>d(f.id))),F=[],K=[],S=[],U=[],G=[],q=0;for(let f of e){if(!a.has(y(f.status,t)))continue;q+=1;let z=D(f,i,t,c).filter(p=>!p.resolved),Ae=(s.get(d(f.id))??[]).filter(p=>l.has(d(p))).sort((p,Le)=>p.localeCompare(Le)),g={item:f,open_blockers:z,unblocks:Ae};if(Pe(f.id,r,t)){S.push(g);continue}let Oe=t.blocked_statuses.has(y(f.status,t));if(z.length===0&&!Oe){let p=O(f.type,n);p==="human"?U.push(g):p==="gate"?G.push(g):F.push(g)}else K.push(g)}return{ready:F,blocked:K,containers:S,decisions:U,gates:G,active_count:q,container_count:S.length}}function Ue(e,o){let t=new Map;for(let n of e){let i=n.external?n.id:o.get(n.id.toLowerCase())?.id??n.id;t.set(n.external?`external:${i}`:`local:${i.toLowerCase()}`,{...n,id:i})}return[...t.values()]}async function P(e,o){let t=H.basename(e),i=(await Ke(H.dirname(e)).catch(r=>{throw Ie("Cannot verify the blocker's physical file identity",{exitCode:m.GENERIC_FAILURE,context:{code:"blocker_identity_read_failed",required:"Restore access to the blocker item directory, then retry the item read."},cause:r})})).filter(r=>r.toLowerCase()===t.toLowerCase()).sort((r,s)=>+(s===t)-+(r===t)||r.localeCompare(s)).map(r=>H.parse(r).name)[0];if(i===void 0)throw new u(`Blocker canonical file disappeared during identity verification: ${o}`,m.CONFLICT,{code:"item_identity_conflict",required:"Restore the canonical blocker file and validate storage integrity before retrying the item read."});return i}async function pt(e){let o=_(e.metadata);if(o.length===0)return[];let t=new Map([e.metadata.blocked_by,...(e.metadata.dependencies??[]).filter(i=>h(i.kind)==="blocked_by").map(i=>i.id)].filter(i=>typeof i=="string").map(i=>[i.trim().toLowerCase(),i.trim()])),n=new Map;for(let i of o){if(I(i)||!/^(?!\.{1,2}$)[^/\\:\0]+$/u.test(i)||e.metadata.dependencies?.some(c=>c.id.trim()===i&&h(c.kind)==="blocked_by"&&w(c.source_kind)))continue;let r=await k(e.pmRoot,t.get(i),e.settings.id_prefix,e.settings.item_format,e.typeToFolder);if(r===null)continue;let s=await b(r,{schema:e.settings.schema});if(r.id=await P(r.itemPath,r.id),s.document.metadata.id!==r.id)throw new u(`Blocker identity differs from its canonical file: ${r.id}`,m.CONFLICT,{code:"item_identity_conflict",required:"Restore the canonical blocker identity and validate storage integrity before retrying the item read."});n.set(i.toLowerCase(),s.document.metadata)}return Ue(M({blocked_by:e.metadata.blocked_by,dependencies:e.metadata.dependencies,updated_at:e.metadata.updated_at},n,ne(e.settings.schema)),n)}var Ee="item_revision_conflict",Ge=10,Ce=/^[0-9a-f]{64}$/u;function x(e,o){return new u(`Invalid expected revision ${JSON.stringify(e)}: ${o}.`,m.USAGE,{code:"expect_hash_invalid",value:e,required:"Pass the 64-character item_hash from pm get <id> --json, optionally as <id>=<item_hash>.",examples:["--expect-hash <item_hash>","--expect-hash pm-a1b2=<item_hash>"]})}function Re(e){let o=typeof e=="string"?e.trim().toLowerCase():"";if(!Ce.test(o))throw x(String(e),"the revision is not a 64-character hexadecimal item_hash");return o}function qe(e){return(e===void 0?[]:typeof e=="string"?[e]:e).flatMap(t=>{if(typeof t!="string")throw x(String(t),"expected a string");let n=t.split(",").map(r=>r.trim()).filter(r=>r.length>0);if(n.length===0)throw x(t,"the value is empty");let i=r=>te(t)===t?r:ee;return n.map(r=>{let s=r.lastIndexOf("="),c=s===-1?void 0:r.slice(0,s).trim();if(c!==void 0&&c.length===0)throw x(i(r),"the item id before = is empty");let a=s===-1?r:r.slice(s+1);if(!Ce.test(a.trim().toLowerCase()))throw x(i(a),"the revision is not a 64-character hexadecimal item_hash");let l=Re(a);return c===void 0?{itemHash:l}:{id:c,itemHash:l}})})}async function Se(e,o){let t=await he(e),n=X(t,pe()).type_to_folder,i=await k(e,o,t.id_prefix,t.item_format,n);if(i){let{document:r}=await b(i,{schema:t.schema});if(r.metadata.id!==await P(i.itemPath,i.id))throw new u(`Item file ${i.id} embeds the id ${r.metadata.id}; no revision can be bound to an item whose identity is in conflict.`,m.CONFLICT,{code:"item_identity_conflict",item_id:i.id,required:`Repair ${i.id}'s identity first (pm validate reports it; pm restore ${i.id} <version> recovers a recorded state), then read its item_hash again.`});return{id:r.metadata.id,document:r}}try{return{id:(await ye(e,o,t,n)).id,document:W}}catch{throw await _e(e,o,t.id_prefix,n)}}function $(e){return Q(e.cwd??process.cwd(),e.pmRoot)}async function Ot(e,o={}){let t=await Se($(o),e);return{id:t.id,item_hash:ie(t.document)}}async function Be(e,o,t){let n=[];for(let i of o){let r=i.id??t;if(r===void 0||r.trim().length===0)throw new u("A bare expected revision needs an item to bind to.",m.USAGE,{code:"expect_hash_target_required",required:"This command has no single item argument; name each target as --expect-hash <id>=<item_hash>.",examples:["--expect-hash pm-a1b2=<item_hash>"]});n.push({id:(await Se(e,r)).id,itemHash:i.itemHash})}return n}function ze(e){return[...new Set(e.patch.map(o=>{let t=o.path.split("/");return String(t[1]==="metadata"?t[2]:t[1])}))].sort()}async function We(e,o,t){let n;try{n=await oe(Z(e,o),o)}catch{return}let i=-1;for(let c=n.length-1;c>=0;c-=1){let a=n[c];if(a.after_hash===t){i=c+1;break}if(a.before_hash===t){i=c;break}}if(i===-1)return{expected_revision_recorded:!1,changes_since:[],changes_since_omitted:0};let r=n.slice(i),s=r.slice(-Ge);return{expected_revision_recorded:!0,changes_since:s.map(c=>({ts:c.ts,op:c.op,author:c.author,fields:ze(c)})),changes_since_omitted:r.length-s.length}}async function Lt(e,o){if(!R(e))return{};let t=await Ne(e,o);return{error_code:Ee,expected_revision:String(t.context.expected_revision),current_revision:String(t.context.current_revision),details:t.context.details}}function R(e){return xe(e)&&e.context.code===Ee}function Dt(e){let o=e.find(t=>R(t));if(o!==void 0)throw o}function Mt(){return new u("--expect-hash cannot guard an invocation an extension override rewrote: which item it writes is not provable.",m.USAGE,{code:"expect_hash_invocation_rewritten",required:"Run the command without the rewriting extension (--no-extensions), or drop --expect-hash.",why:"An extension parser or preflight override changed this invocation's tracker or arguments, and final dispatch, the extension SDK client and the guard do not share one rewritten view."})}function Ve(e,o){if(o===void 0||!R(e)||typeof e.context.item_id!="string"||fe(e))return e;let t=e.context.reason===de;if(!t&&e.context.reason!==ae)return e;let n=me(T(e,new u(e.message,e.exitCode,{...e.context,...le(e.context.item_id,t,o)})));return n.stack=e.stack,n}async function Ne(e,o,t){if(!ue(e,o))return e;let n=Ve(e,t);if(!R(n)||n.context.details!==void 0)return n;let i=n.context.item_id,r=n.context.expected_revision;if(typeof i!="string"||typeof r!="string")return n;let s;try{s=await We(o,i,r)}catch{return n}if(s===void 0)return n;let c={expected_revision_recorded:s.expected_revision_recorded,changes_since:s.changes_since.map(l=>({ts:l.ts,op:l.op,author:l.author,fields:[...l.fields]})),changes_since_omitted:s.changes_since_omitted},a=T(n,new u(n.message,n.exitCode,{...n.context,details:c}));return a.stack=n.stack,a}async function Te(e,o,t){try{return{result:await re(e,o),...se(e)}}catch(n){throw e.pmRoot===void 0?n:await Ne(n,e.pmRoot,t)}}function Ye(e){return e.cwd===void 0&&e.pmRoot===void 0?void 0:{scopeArgs:["--pm-path",$(e)]}}async function Ht(e,o,t={}){return Te(await je(e,t),o,Ye(t))}async function je(e,o={}){let t=$(o),n=e.map(({id:r,itemHash:s})=>({id:r,itemHash:Re(s)})),i=B();return N(i,t,await Be(t,n)),i}function Pt(e){let o=ce(e);return o===void 0||o.length>0}function Xe(e){return`expect_hash_unchecked:${e}:no_locked_write_reached_this_item`}var be=new Set(V);function Je(e,o={}){let t=e.trim().replace(/\s+/gu,"-"),n=be.has(t)?t:e;if(be.has(n)&&(!ge(n)||n==="deps")&&!Y.has(n))throw Qe(n);if((n==="test"||n==="test-all")&&o.background===!0)throw new u(`--expect-hash cannot guard ${n} --background: the worker runs in another process.`,m.USAGE,{code:"expect_hash_background_unsupported",required:`Run ${n} in the foreground to guard its result recording, or drop --expect-hash for a background run.`})}function Qe(e){return new u(`--expect-hash guards item writes, and ${e} is not a mutation.`,m.USAGE,{code:"expect_hash_requires_mutation",required:"Use --expect-hash (MCP/SDK expectHash) only on a command or action that writes items."})}function Ze(e,o){if(o.length===0||typeof e!="object"||e===null||Array.isArray(e))return e;let t=e,n=Array.isArray(t.warnings)?t.warnings:[];return{...t,warnings:[...n,...o.map(Xe)]}}async function $t(e){let o=e.expectHash;if(o!==void 0&&typeof o!="string"&&!(Array.isArray(o)&&o.every(r=>typeof r=="string")))throw x(JSON.stringify(o)??String(o),"expected a string or an array of strings");let t=qe(o);if(t.length===0)return e.run();Je(e.action,{background:e.background===!0||e.options?.background===!0});let n=B();N(n,e.pmRoot,await Be(e.pmRoot,t,e.defaultId));let i=await Te(n,e.run,e.invocation);return Ze(i.result,i.unchecked)}export{O as a,De as b,_ as c,C as d,ve as e,M as f,Me as g,He as h,Fe as i,pt as j,Ee as k,Ge as l,Re as m,qe as n,Ot as o,Be as p,We as q,Lt as r,R as s,Dt as t,Mt as u,Ve as v,Ne as w,Te as x,Ht as y,je as z,Pt as A,Xe as B,Je as C,Qe as D,$t as E};
|
|
2
|
-
//# sourceMappingURL=chunk-KES4VHU4.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{ja as s,ka as u,qb as g}from"./chunk-KCRRTJ4X.js";import{I as x,v as h}from"./chunk-XRCE4QNL.js";import{Dh as w,V as I,ba as y,ha as i}from"./chunk-WZOJSHJT.js";import{A as d,C as p,E as l}from"./chunk-6OIHST4I.js";async function D(r){let t=y(process.cwd(),r);await x(t);let o=await h(t),a=I(o,w());return{pmRoot:t,settings:o,typeRegistry:a}}async function S(r,t,o,a){i(r,s(t));let e=await g(r,t,o.id_prefix,o.item_format,a);if(e)return{id:e.id,historyPath:i(r,e.id),located:e};let m=u(t,o.id_prefix),n=s(t),v=m===n?[m]:[m,n];for(let c of v){let f=i(r,c);if(await l(f))return{id:c,historyPath:f,located:null}}throw new p(`Item ${t} not found`,d.NOT_FOUND)}export{D as a,S as b};
|
|
2
|
-
//# sourceMappingURL=chunk-NDS4MXZX.js.map
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{b as ne}from"./chunk-NDS4MXZX.js";import{Va as K,Xa as Q,Za as Z,_a as ee}from"./chunk-KCRRTJ4X.js";import{I as te,v as Y}from"./chunk-XRCE4QNL.js";import{Ag as X,Dc as G,Dh as J,Hc as H,Nb as z,Ng as W,Pf as j,Rf as V,Sf as B,V as $,ab as F,ba as D,hh as q,sc as P,ta as U}from"./chunk-WZOJSHJT.js";import{O as L,Q as y}from"./chunk-DUJSME77.js";import{A as c,C as u,E as k,G as E,K as C}from"./chunk-6OIHST4I.js";function ft(t,e){let n=H(t),r=t.length>0?t[t.length-1].after_hash:B(),i=e===void 0||n.item_hash_version===void 0?void 0:V(e,n.item_hash_version,F(t.at(-1)?.hash_algorithm)),a=e===void 0?void 0:i===void 0?j(e):i[Math.max(0,i.indexOf(r))],o=a===void 0?void 0:a===r,s=[...n.errors];return o===!1&&s.push("verify_failed:current_item_hash_mismatch"),{ok:s.length===0,entries:t.length,errors:s,latest_after_hash:t.length>0?t[t.length-1].after_hash:void 0,current_item_hash:a,current_matches_latest:o}}async function _t(t,e,n={}){let r=D(n.cwd??process.cwd(),n.pmRoot);await te(r);let i=await Y(r),a=$(i,J()),o=await ne(r,t,i,a.type_to_folder),s=await P(o.historyPath,o.id);if(s.length===0)throw new u(`No history exists for ${o.id}; point-in-time reads are unavailable.`,c.NOT_FOUND);let p=Q(e,s),x=ee(Z(s,p.historyIndex),p),f=G(x,{schema:i.schema});if(f.metadata.id!==o.id)throw new u(`History target resolved to item ${f.metadata.id}, expected ${o.id}.`,c.GENERIC_FAILURE);let _=s[p.historyIndex],m=K(s,!0);return{document:f,reconstructed:!0,as_of_version:m===null?null:m+p.historyIndex+1,as_of_timestamp:_.ts,target:p,history_length:s.length}}import re from"node:fs/promises";import S from"node:path";function ie(t){return[...new Set(t.map(e=>e.trim()).filter(e=>e.length>0))].sort((e,n)=>e.localeCompare(n))}function l(t){return t.trim().toLowerCase()}function Dt(t){let e=t.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-"),n=0;for(;e[n]==="-";)n+=1;let r=e.length;for(;r>n&&e[r-1]==="-";)r-=1;let i=e.slice(n,r);if(i.length===0)throw new u("Extension manifest name must resolve to a non-empty directory name.",c.USAGE);if(i==="."||i==="..")throw new u('Extension manifest name must not resolve to "." or "..".',c.USAGE);return i}function ye(t){return W(t)}async function ge(t){try{let e=JSON.parse(await re.readFile(S.join(t,"package.json"),"utf8")),n=typeof e.name=="string"&&/^(?:@[a-z0-9._~-]+\/)?[a-z0-9._~-]+$/iu.test(e.name)?e.name:void 0;return{...n?{package_name:n}:{},has_build_script:["build","prepare","prepack"].some(r=>typeof e.scripts?.[r]=="string")}}catch{return{has_build_script:!1}}}async function Ee(t,e,n){if(n.source_kind!=="github"||typeof n.source_root!="string")return new u(`Extension entry file is missing at "${e}".`,c.USAGE);let r=await ge(n.source_root),i=r.package_name?`pm package install npm:${r.package_name}`:void 0,a=n.source_input??n.source_root;return new u(`Extension entry "${t.entry}" is absent from GitHub source "${a}". pm package install copies GitHub repositories without running package scripts${r.has_build_script?", and this package declares a build or publish script":""}. ${i?`Try "${i}" if the package is published, or install a locally built directory.`:"Build the source locally and install that directory, or use its published npm: package."}`,c.USAGE,{code:"github_source_entry_unbuilt",required:"Use a GitHub tree with committed runtime output, a published npm artifact, or a locally built source directory.",why:"GitHub installation is a source copy and never executes untrusted package build scripts.",examples:i?[i,`pm package install ${n.source_root}`]:[`pm package install ${n.source_root}`],nextSteps:i?[`Retry with ${i}.`,"Or build the repository locally, then install its directory."]:["Build the repository locally, then install its directory.","If it is published, retry with pm package install npm:<package-name>."],recovery:{attempted_command:`pm install ${a}`,normalized_args:["install",a],...i?{next_best_command:i}:{}}})}async function Ut(t,e={}){let n=S.join(t,"manifest.json");if(!await k(n))throw new u(`Extension manifest is missing at "${n}".`,c.USAGE);let r;try{r=JSON.parse(await re.readFile(n,"utf8"))}catch(o){throw new u(`Failed to parse extension manifest at "${n}": ${ve(o)}`,c.USAGE)}let i=ye(r);if(!i)throw new u(`Extension manifest at "${n}" is invalid.`,c.USAGE);let a=S.resolve(t,i.entry);if(!U(t,a))throw new u(`Extension entry "${i.entry}" resolves outside extension directory "${t}".`,c.USAGE);if(!await k(a))throw await Ee(i,a,e);if(!await q(t,a))throw new u(`Extension entry "${i.entry}" resolves outside extension directory after symlink resolution.`,c.USAGE);return{directory:t,manifest_path:n,entry_path:a,manifest:i}}function ve(t){return t instanceof Error?t.message:String(t)}import A from"node:fs/promises";import be from"node:path";var we=".managed-extensions.json",v=1;function b(t){return be.join(t,we)}function xe(){return{version:v,updated_at:y(),entries:[]}}function M(t){return[...t].sort((e,n)=>{let r=e.scope.localeCompare(n.scope);if(r!==0)return r;let i=e.name.localeCompare(n.name);return i!==0?i:e.directory.localeCompare(n.directory)})}function Xt(t,e){return t.kind!==e.kind||t.input!==e.input||t.location!==e.location?!1:t.kind==="npm"&&e.kind==="npm"?t.package===e.package&&t.version===e.version:t.kind==="github"&&e.kind==="github"?t.repository===e.repository&&t.ref===e.ref&&t.subpath===e.subpath&&t.commit===e.commit:t.kind==="builtin"&&e.kind==="builtin"?t.name===e.name:!0}function d(t){return typeof t=="string"?t:void 0}var ke=/^(?:npm_registry|github_remote)_lookup_timed_out$/u;function Se(t,e){let n=d(e);return n===void 0||t.kind!=="github"||n.trim().length===0||/^[a-z0-9_]+$/u.test(n.trim())?n:"github_remote_lookup_failed"}function ae(t){return typeof t=="string"&&ke.test(t.trim())}function Ae(t,e){return ae(t)&&typeof e=="number"&&Number.isSafeInteger(e)&&e>0?{update_check_timeout_ms:e}:{}}function Me(t){return typeof t.name=="string"&&t.name.trim().length>0&&typeof t.directory=="string"&&t.directory.trim().length>0&&(t.scope==="project"||t.scope==="global")&&typeof t.manifest_version=="string"&&typeof t.manifest_entry=="string"&&Array.isArray(t.capabilities)&&t.capabilities.every(e=>typeof e=="string")&&typeof t.installed_at=="string"&&typeof t.updated_at=="string"}function Ie(t){if(typeof t!="object"||t===null)return null;let e=t;return e.kind!=="local"&&e.kind!=="github"&&e.kind!=="npm"&&e.kind!=="builtin"||typeof e.input!="string"||typeof e.location!="string"?null:{kind:e.kind,input:e.input,location:e.location,name:d(e.name),package:d(e.package),version:d(e.version),repository:d(e.repository),owner:d(e.owner),repo:d(e.repo),ref:d(e.ref),subpath:d(e.subpath),commit:d(e.commit)}}function Ne(t){if(typeof t!="object"||t===null)return null;let e=t;if(!Me(e))return null;let n=Ie(e.source);if(!n)return null;let r=X(e.contributions);return r===null?null:{name:e.name.trim(),directory:e.directory.trim(),scope:e.scope,manifest_version:e.manifest_version,manifest_entry:e.manifest_entry,capabilities:ie(e.capabilities),contributions:r,installed_at:e.installed_at,updated_at:e.updated_at,source:n,last_update_check_at:d(e.last_update_check_at),last_update_remote_commit:d(e.last_update_remote_commit),last_update_remote_version:d(e.last_update_remote_version),update_available:ae(e.update_error)?null:typeof e.update_available=="boolean"||e.update_available===null?e.update_available:void 0,update_error:Se(n,e.update_error),...Ae(e.update_error,e.update_check_timeout_ms)}}function I(t){if(typeof t!="object"||t===null)return null;let e=t;if(e.version!==v||!Array.isArray(e.entries))return null;let n=[];for(let r of e.entries){let i=Ne(r);i&&n.push(i)}return{version:v,updated_at:d(e.updated_at)??y(),entries:M(n)}}async function Wt(t){let e=b(t),n=xe();try{let r=await A.readFile(e,"utf8"),i=JSON.parse(r),a=I(i);if(!a)throw new u(`Managed extension state file "${e}" has an invalid schema. Repair or remove it before mutating extension state.`,c.GENERIC_FAILURE);return{path:e,state:a,warnings:[]}}catch(r){if(r instanceof u)throw r;if(typeof r=="object"&&r!==null&&"code"in r&&E(r))return{path:e,state:n,warnings:[]};throw new u(`Managed extension state file "${e}" could not be read. Repair or remove it before mutating extension state.`,c.GENERIC_FAILURE)}}async function Oe(t,e){let n=b(t),r={version:v,updated_at:y(),entries:M(e.entries)};await A.mkdir(t,{recursive:!0}),await A.writeFile(n,`${JSON.stringify(r,null,2)}
|
|
2
|
-
`,"utf8")}function Te(t,e){let n=t.entries.filter(r=>l(r.name)!==l(e.name)&&l(r.directory)!==l(e.directory));return n.push(e),{...t,updated_at:y(),entries:M(n)}}async function qt(t,e,n,r){let i=e.entries.find(o=>l(o.name)===l(n));if(!i)return e;let a=Te(e,{...i,contributions:r});return await Oe(t,a),a}import oe from"npm-package-arg";import N from"semver";var Re=new Set(["tag","version","range"]);function Ce(t){try{let e=oe(t),n=e.subSpec;return e.type==="alias"?n?.type:e.type}catch{return}}function O(t){if(t.kind!=="npm")return!1;let e=t.input.startsWith("npm:")?t.input.slice(4).trim():t.input.trim(),n=Ce(e);return n!==void 0&&Re.has(n)}function T(t){try{return oe.resolve("pm-version-probe",t).type==="version"}catch{return!1}}function se(t,e){let n=N.parse(t,{loose:!0}),r=N.parse(e,{loose:!0});return n===null||r===null?t!==e:N.gt(n,r)}import{constants as ce}from"node:fs";import w from"node:fs/promises";import h from"node:path";var $e="extension-update-observations.json",de=1,De=64*1024,Ue=16*1024*1024,le=1024*1024,Le=300*1e3,ue=2e3;function pe(t){return h.join(t,"runtime",$e)}var me=256;function g(t,e){let n=t[e];return typeof n=="string"&&n.length>0&&n.length<=me?n:void 0}function Fe(t){let e=Date.parse(t);return Number.isFinite(e)&&e<=Date.now()+Le}function ze(t){return t.remote_version===void 0||t.remote_version===null?null:g(t,"remote_version")}function Pe(t){if(typeof t!="object"||t===null||Array.isArray(t))return;let e=t,n=g(e,"name"),r=g(e,"installed_version"),i=g(e,"installed_updated_at"),a=g(e,"checked_at"),o=ze(e);if(!(n===void 0||r===void 0||i===void 0||o===void 0)&&!(a===void 0||!Fe(a)||typeof e.update_available!="boolean"))return{name:n,installed_version:r,installed_updated_at:i,remote_version:o,update_available:e.update_available,checked_at:a}}var Ge=".stale-cleanup",He=64*1024;async function je(t){try{let e=await w.lstat(t);return!e.isFile()||e.size>He}catch{return!1}}async function fe(t){try{return!(await w.lstat(t)).isDirectory()}catch{return!1}}async function Ve(t){let e=pe(t);try{if(await fe(h.dirname(e)))return[];let n=await _e(e,le);if(n===void 0)return[];let r=JSON.parse(n),i=typeof r=="object"&&r!==null?r:{};return(i.version===de&&Array.isArray(i.observations)?i.observations:[]).flatMap(o=>Pe(o)??[])}catch{return[]}}function Be(t=ce,e=!1){return t.O_RDONLY|(e?0:t.O_NOFOLLOW??0)|(t.O_NONBLOCK??0)}async function _e(t,e,n={}){if(n.followLinks!==!0&&!(await w.lstat(t)).isFile())return;let r=await w.open(t,Be(ce,n.followLinks===!0));try{if(!(await r.stat()).isFile())return;let i=Buffer.alloc(Math.min(De,e+1)),a=[],o=0;for(;o<=e;){let{bytesRead:s}=await r.read(i,0,Math.min(i.length,e+1-o),o);if(s===0)break;a.push(Buffer.from(i.subarray(0,s))),o+=s}return o>e?void 0:Buffer.concat(a,o).toString("utf8")}finally{await r.close()}}function Xe(t){return t.flatMap(e=>typeof e.last_update_check_at=="string"&&e.update_error===void 0&&typeof e.update_available=="boolean"&&(e.source.kind==="github"||O(e.source))&&[e.name,e.manifest_version,e.updated_at,e.last_update_remote_version??""].every(n=>n.length<=me)?[{name:e.name,installed_version:e.manifest_version,installed_updated_at:e.updated_at,remote_version:e.last_update_remote_version??e.last_update_remote_commit?.slice(0,12)??null,update_available:e.update_available,checked_at:e.last_update_check_at}]:[]).sort((e,n)=>e.name.localeCompare(n.name))}async function We(t){let e;try{e=await _e(b(t),Ue,{followLinks:!0})}catch(n){return E(n)?[]:void 0}if(e!==void 0)try{let n=JSON.parse(e),r=I(n),i=n.entries;return r!==null&&Array.isArray(i)&&i.length===r.entries.length?r.entries:void 0}catch{return}}function R(t){let e=new Map;for(let n of t){let r=`${l(n.name)}\0${n.installed_version}\0${n.installed_updated_at}`,i=e.get(r);(i===void 0||Date.parse(i.checked_at)<=Date.parse(n.checked_at))&&e.set(r,n)}return[...e.values()]}function qe(t,e){return l(t.name)===l(e.name)&&t.installed_version===e.manifest_version&&t.installed_updated_at===e.updated_at}async function Je(t,e,n){if(n.length===0)return;let r=pe(t),i=async()=>{if(await fe(h.dirname(r)))throw new Error(`${h.dirname(r)} is not a directory`)};await i();let a=h.join(t,"locks","extension-update-observations.lock");for(let s of[a,h.join(`${a}${Ge}`,"owner.json")])if(await je(s))throw new Error("update observation lock metadata is not a small regular file");let o=await z(t,"extension-update-observations",30,"pm package manage",!1,!1,ue,{maxWaitMs:ue});try{await i();let s=[...await Ve(t),...n],p=await We(e),x=(p===void 0?R(s):p.flatMap(_=>R(s.filter(m=>qe(m,_)&&he(m,_.source))))).sort((_,m)=>_.name.localeCompare(m.name)),f=`${JSON.stringify({version:de,observations:x},null,2)}
|
|
3
|
-
`;if(Buffer.byteLength(f,"utf8")>le)throw new Error("update observation record exceeds its size limit");await o.fence(()=>C(r,f))}finally{await o.release()}}async function dn(t,e,n,r){if(!(r||L()))try{await Je(t,e,Xe(n));return}catch(i){let a=i?.context?.code;return typeof a=="string"&&a.length>0?`extension_update_observation_write_failed:${a}`:"extension_update_observation_write_failed"}}function ln(t,e){if(typeof e.version!="string"||e.updated_at===void 0)return;let n=l(e.name);return R(t.filter(r=>l(r.name)===n&&r.installed_version===e.version&&r.installed_updated_at===e.updated_at&&he(r,e.source)))[0]}function Ye(t,e){let n=e?.trim().toLowerCase(),r=t.remote_version?.toLowerCase();return!n||r===void 0||!/^[0-9a-f]{7,40}$/u.test(r)?!1:n.startsWith(r)!==t.update_available}function he(t,e){return e===void 0?!0:e.kind==="github"?Ye(t,e.commit):O(e)?typeof e.version=="string"&&T(e.version)&&t.remote_version!==null&&T(t.remote_version)&&se(t.remote_version,e.version)===t.update_available:t.update_available===!1}function pn(t){return t?.update_available===!0?t.remote_version??"available":null}export{ft as a,_t as b,ie as c,l as d,Dt as e,ye as f,Ut as g,b as h,M as i,Xt as j,I as k,Wt as l,Oe as m,Te as n,qt as o,O as p,se as q,Ve as r,_e as s,We as t,dn as u,ln as v,pn as w};
|
|
4
|
-
//# sourceMappingURL=chunk-QMM46SJM.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{E as V,H as P,n as x,o as C}from"./chunk-6OIHST4I.js";import H from"node:path";import{link as te,mkdir as re,mkdtemp as ne,open as se,rm as oe,writeFile as ie}from"node:fs/promises";import R from"node:path";var ae=new Set(["EPERM","ENOTSUP","EOPNOTSUPP","ENOSYS"]),O=class extends Error{code;constructor(t,r){super(`The filesystem cannot publish a file by hard link (${t}).`,{cause:r}),this.name="AtomicLinkUnsupportedError",this.code=t}};async function le(e,t){let r=await se(e,"wx");try{await r.writeFile(t,"utf8"),await r.sync()}finally{await r.close()}}async function z(e,t,r={}){let n=R.dirname(e);await re(n,{recursive:!0});let s=await ne(R.join(n,".pm-seed-")),i=R.join(s,"value");try{await(r.sync===!0?le(i,t):ie(i,t,"utf8"));try{return await te(i,e),!0}catch(l){let a=l.code??"";if(a==="EEXIST")return!1;throw ae.has(a)?new O(a,l):l}}finally{await oe(s,{recursive:!0,force:!0}).catch(()=>{})}}var ce=["Epic","Feature","Task","Chore","Issue","Decision","Event","Reminder","Milestone","Meeting","Plan"],Ke=ce,j=["draft","open","in_progress","blocked","closed","canceled"],v=["draft","active","blocked","terminal","terminal_done","terminal_canceled","default_open","default_close","default_cancel"],K=["string","number","boolean","string_array","array","object"],W=["create","update","update_many","list","search","calendar","context"],q=["allow","warn","reject"],We=["blocks","parent","child","parent_child","child_of","related","related_to","discovered_from","blocked_by","incident_from","epic","implements","recurs_from","supersedes","task","verifies"],qe=["project","global"],Ye=["low","medium","high","critical"],He=["low","medium","high","critical"],Ge=["low","medium","high"];var Xe=["minimal","default","strict","custom"],$e=["none","warn","strict"],Be=["progressive","strict"],Je=["off","warn","strict"],Qe=["off","warn","strict"],Ze=["off","warn","strict"];var et=["daily","weekly","monthly","yearly"],de=["mon","tue","wed","thu","fri","sat","sun"];function tt(e){return de.indexOf(e)}var rt=["draft","research","review","approved","executing","paused","completed","superseded"],nt=["pending","in_progress","completed","blocked","skipped","superseded"],st=["codex","claude-code","cursor","generic"],ot=["related","blocks","blocked_by","depends_on","discovered_from","implements","recurs_from","verifies","supersedes"],it=["brief","standard","deep","full"],at=["hierarchy","activity","progress","recently_created","unparented","blockers","files","workload","staleness","tests"];function Y(e){let t=Math.ceil(e.size/2);for(let r of e.keys()){if(t===0)return;e.delete(r),t-=1}}var ue=2e3,L=new Map;function A(e){if(typeof e!="string")return"";let t=L.get(e);if(t!==void 0)return t;let r=e.trim().toLowerCase().replaceAll(/[\s-]+/g,"_");return L.size>=ue&&Y(L),L.set(e,r),r}var p=Object.freeze({types:"schema/types.json",statuses:"schema/statuses.json",fields:"schema/fields.json",workflows:"schema/workflows.json"}),$=C,D=x,fe=["create","update"],_e=new Set(v),pe=new Set(K),me=new Set(W),ye=new Set(q),Ee=new Set(["string","number","boolean","array","object"]),Se=16;function B(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Ae=[e=>e.type===void 0||typeof e.type=="string"&&Ee.has(e.type),e=>!Object.hasOwn(e,"const")||U(e.const),e=>e.enum===void 0||Array.isArray(e.enum)&&e.enum.every(t=>U(t)),e=>e.min_length===void 0||Number.isInteger(e.min_length)&&e.min_length>=0,e=>e.min_items===void 0||Number.isInteger(e.min_items)&&e.min_items>=0,e=>e.format===void 0||e.format==="date-time",e=>e.required===void 0||Array.isArray(e.required)&&e.required.every(t=>typeof t=="string"&&t.length>0),e=>e.additional_properties===void 0||typeof e.additional_properties=="boolean",e=>e.properties===void 0||B(e.properties),e=>e.one_of===void 0||Array.isArray(e.one_of)&&e.one_of.length>0];function U(e,t=new Set){if(e===null||typeof e=="string"||typeof e=="boolean")return!0;if(typeof e=="number")return Number.isFinite(e);if(typeof e!="object"||t.has(e))return!1;t.add(e);let r=Array.isArray(e)?e.every(n=>U(n,t)):Object.values(e).every(n=>U(n,t));return t.delete(e),r}function I(e,t=0,r=new Set){if(!B(e)||t>Se||r.has(e))return;r.add(e);let n=e,s=n.type,i=n.enum,l=n.one_of,a=n.properties,o=n.items,d=n.required,u=n.min_length,c=n.min_items,m=n.format,E=n.additional_properties;if(!Ae.every(_=>_(n))){r.delete(e);return}let w=a===void 0?void 0:Object.fromEntries(Object.entries(a).map(([_,F])=>[_,I(F,t+1,r)])),T=o===void 0?void 0:I(o,t+1,r),h=l===void 0?void 0:l.map(_=>I(_,t+1,r));if([...Object.values(w??{}),...o===void 0?[]:[T],...h??[]].some(_=>_===void 0)){r.delete(e);return}return r.delete(e),Object.fromEntries(Object.entries({type:s,const:Object.hasOwn(n,"const")?n.const:void 0,enum:i,min_length:u,min_items:c,format:m,properties:w,required:d===void 0?void 0:[...new Set(d)],additional_properties:E,items:T,one_of:h}).filter(([,_])=>_!==void 0))}function N(e){let t=Array.isArray(e)?e:[];return[...new Set(t.map(r=>typeof r=="string"?r.trim():"").filter(r=>r.length>0))].sort((r,n)=>r.localeCompare(n))}function f(e){if(typeof e!="string"||e.length===0)return;let t=A(e);return t.length>0?t:void 0}function we(e){return e.startsWith("--")?e.slice(2):e}function G(e){return typeof e=="string"?we(e.trim().toLowerCase().replaceAll(/[\s_]+/g,"-")):""}function J(e){return e.replaceAll("_","-")}function Te(e){let t=e.replaceAll(/[^A-Za-z0-9]+/g," ").trim().split(/\s+/).filter(s=>s.length>0).map(s=>s.toLowerCase());if(t.length===0)return e;let[r,...n]=t;return`${r}${n.map(s=>`${s.slice(0,1).toUpperCase()}${s.slice(1)}`).join("")}`}function b(e,t){let r=f(e.id);if(!r)return null;let n=[...new Set(N(e.aliases).map(A).filter(a=>a.length>0))].sort((a,o)=>a.localeCompare(o)),s=N(e.roles).filter(a=>_e.has(a)),i=e.description?.trim(),l=typeof e.order=="number"&&Number.isFinite(e.order)?e.order:t;return{id:r,aliases:n,roles:s,description:i&&i.length>0?i:void 0,order:l}}function he(e){return{draft_status:f(e?.draft_status),open_status:f(e?.open_status),in_progress_status:f(e?.in_progress_status),blocked_status:f(e?.blocked_status),close_status:f(e?.close_status),canceled_status:f(e?.canceled_status)}}function Q(e,t){if(!Array.isArray(t)||t.length!==2)return;let r=A(t[0]),n=A(t[1]);r.length===0||n.length===0||e.pairs.some(s=>s[0]===r&&s[1]===n)||e.pairs.push([r,n])}function ke(e){let t=typeof e?.type=="string"?e.type.trim():"";if(t.length===0||!Array.isArray(e?.allowed_transitions))return null;let r={type:t,pairs:[],denyAll:e.allowed_transitions.length===0};for(let n of e.allowed_transitions)Q(r,n);return{typeKey:t.toLowerCase(),record:r}}function Ne(e){if(!Array.isArray(e)||e.length===0)return;let t=new Map;for(let n of e){let s=ke(n);if(s===null)continue;let i=t.get(s.typeKey)??s.record;i.denyAll||=s.record.denyAll;for(let l of s.record.pairs)Q(i,l);t.set(s.typeKey,i)}let r=[];for(let n of t.values())(n.pairs.length>0||n.denyAll)&&r.push({type:n.type,allowed_transitions:n.pairs});return r.sort((n,s)=>n.type.localeCompare(s.type)),r.length>0?r:void 0}function Z(e){let t=A(e.key??"");if(!t)return null;let r=A(e.metadata_key??e.front_matter_key??t),n=G(e.cli_flag??J(t));if(!n)return null;let s=N(e.cli_aliases).map(c=>G(c)).filter(c=>c.length>0&&c!==n),i=typeof e.type=="string"?e.type.trim().toLowerCase():"string",l=pe.has(i)?i:"string",a=(()=>{let c=N(e.commands).filter(m=>me.has(m));return c.length>0?c:[...fe]})(),o=e.description?.trim(),d=N(e.required_types),u=e.value_schema===void 0?void 0:I(e.value_schema);return e.value_schema!==void 0&&u===void 0?null:{key:t,metadata_key:r,cli_flag:n,cli_aliases:s,description:o&&o.length>0?o:void 0,type:l,commands:a,repeatable:[e.repeatable===!0,l==="string_array"].includes(!0),required:e.required===!0,required_on_create:e.required_on_create===!0,required_types:d,allow_unset:e.allow_unset!==!1,value_schema:u}}function ge(e){let t=new Map;for(let[n,s]of e.entries()){let i=b(s,n);i&&t.set(i.id,i)}let r=X([...t.values()]);return r.length>0?r:X(D.map((n,s)=>b(n,s)).filter(n=>n!==null))}function X(e){return e.sort((t,r)=>t.order===r.order?t.id.localeCompare(r.id):t.order-r.order)}function Le(e){let t=new Map;for(let r of e??[]){let n=Z(r);n&&t.set(n.key,n)}return[...t.values()].sort((r,n)=>r.key.localeCompare(n.key))}function Ie(e){return{id:e.id,aliases:e.aliases.length>0?[...e.aliases]:void 0,roles:e.roles.length>0?[...e.roles]:void 0,description:e.description,order:e.order}}function Ue(e){return{key:e.key,metadata_key:e.metadata_key!==e.key?e.metadata_key:void 0,cli_flag:e.cli_flag!==J(e.key)?e.cli_flag:void 0,cli_aliases:e.cli_aliases.length>0?[...e.cli_aliases]:void 0,description:e.description,type:e.type,commands:[...e.commands],repeatable:e.repeatable===!0?!0:void 0,required:e.required===!0?!0:void 0,required_on_create:e.required_on_create===!0?!0:void 0,required_types:e.required_types.length>0?[...e.required_types]:void 0,allow_unset:e.allow_unset===!1?!1:void 0,value_schema:e.value_schema}}function Fe(e){let t=typeof e=="string"?e.trim().toLowerCase():"allow";return ye.has(t)?t:"allow"}function g(e){let t={...p,...e?.files},r=e?.statuses&&e.statuses.length>0?e.statuses:D,n=ge(r),s=Le(e?.fields);return{version:typeof e?.version=="number"&&Number.isFinite(e.version)?Math.floor(e.version):1,files:t,statuses:n.map(Ie),fields:s.map(Ue),workflow:{...$,...he(e?.workflow)},type_workflows:Ne(e?.type_workflows),unknown_field_policy:Fe(e?.unknown_field_policy)}}function Re(e,t,r){try{return JSON.parse(e)}catch{r.push(t);return}}function Oe(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.definitions))return t.definitions;if(typeof t.item_types=="object"&&t.item_types!==null){let r=t.item_types;if(Array.isArray(r.definitions))return r.definitions}}function be(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.statuses))return t.statuses;if(Array.isArray(t.definitions))return t.definitions}function De(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.fields))return t.fields;if(Array.isArray(t.definitions))return t.definitions}function Me(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e;return typeof t.workflow=="object"&&t.workflow!==null&&!Array.isArray(t.workflow)?t.workflow:typeof t.workflows=="object"&&t.workflows!==null&&!Array.isArray(t.workflows)?t.workflows:t}function xe(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e;if(Array.isArray(t.type_workflows))return t.type_workflows}function y(e,t,r){let n=t?.trim()||r;return H.isAbsolute(n)?n:H.join(e,n)}function wt(e,t){return y(e,t.files.types,p.types)}async function Tt(e,t){let r=g(t),n=[{path:y(e,r.files.types,p.types),seed:{definitions:[]}},{path:y(e,r.files.statuses,p.statuses),seed:{statuses:D}},{path:y(e,r.files.fields,p.fields),seed:{fields:[]}},{path:y(e,r.files.workflows,p.workflows),seed:{workflow:$}}],s=[];for(let i of n)await V(i.path)||await z(i.path,`${JSON.stringify(i.seed,null,2)}
|
|
2
|
-
`)&&s.push(i.path);return{created_paths:s}}async function ht(e,t){let r=g(t),n=[],s=y(e,r.files.types,p.types),i=y(e,r.files.statuses,p.statuses),l=y(e,r.files.fields,p.fields),a=y(e,r.files.workflows,p.workflows),o,d,u,c,m,E=async(F,ee)=>{let M=await P(F);if(M!==null)return Re(M,ee,n)},w=await E(s,"runtime_schema_types_invalid_json");w!==void 0&&(o=Oe(w),o===void 0&&n.push("runtime_schema_types_invalid_shape"));let T=await E(i,"runtime_schema_statuses_invalid_json");T!==void 0&&(d=be(T),d===void 0&&n.push("runtime_schema_statuses_invalid_shape"));let h=await E(l,"runtime_schema_fields_invalid_json");h!==void 0&&(u=De(h),u===void 0&&n.push("runtime_schema_fields_invalid_shape"));let S=await E(a,"runtime_schema_workflows_invalid_json");return S!==void 0&&(c=Me(S),c===void 0&&n.push("runtime_schema_workflows_invalid_shape"),m=xe(S)),{schema:g({...r,statuses:[...r.statuses,...d??[]],fields:[...r.fields,...u??[]],workflow:{...r.workflow,...c},type_workflows:[...r.type_workflows??[],...m??[]]}),type_definitions_from_file:o,warnings:n,created_paths:[]}}function k(e,t,r,n=!1){let i=r.map(a=>f(a)).filter(a=>typeof a=="string").find(a=>e.some(o=>o.id===a));if(n&&i!==void 0)return i;let l=e.find(a=>a.roles.includes(t));return l!==void 0?l.id:i??e[0]?.id}function Ce(e){let t=new Map,r=new Map;for(let n of e){r.set(n.id,n),t.set(n.id,n.id),t.set(n.id.replaceAll("_","-"),n.id),t.set(n.id.replaceAll("_"," "),n.id);for(let s of n.aliases)t.set(s,n.id),t.set(s.replaceAll("_","-"),n.id),t.set(s.replaceAll("_"," "),n.id)}return{aliasToId:t,byId:r}}function Ve(e){let t={activeStatuses:new Set,blockedStatuses:new Set,draftStatuses:new Set,terminalCanceledStatuses:new Set,terminalDoneStatuses:new Set,terminalStatuses:new Set};for(let r of e){let n=new Set(r.roles);(n.has("terminal")||n.has("terminal_done")||n.has("terminal_canceled"))&&t.terminalStatuses.add(r.id),n.has("terminal_done")&&t.terminalDoneStatuses.add(r.id),n.has("terminal_canceled")&&t.terminalCanceledStatuses.add(r.id),n.has("active")&&t.activeStatuses.add(r.id),n.has("blocked")&&t.blockedStatuses.add(r.id),n.has("draft")&&t.draftStatuses.add(r.id)}return t}function kt(e){let t=g(e),r=t.statuses.map((S,_)=>b(S,_)).filter(S=>S!==null),{aliasToId:n,byId:s}=Ce(r),{activeStatuses:i,blockedStatuses:l,draftStatuses:a,terminalCanceledStatuses:o,terminalDoneStatuses:d,terminalStatuses:u}=Ve(r),c=t.workflow,m=f(c.open_status)??k(r,"default_open",["open","in_progress",j[0]]),E=f(c.in_progress_status)??k(r,"active",["in_progress","in-progress",m],!0),w=f(c.blocked_status)??k(r,"blocked",["blocked"]),T=f(c.close_status)??k(r,"default_close",["closed","done","complete"]),h=f(c.canceled_status)??k(r,"default_cancel",["canceled","cancelled"]);return{definitions:r,by_id:s,alias_to_id:n,terminal_statuses:u,terminal_done_statuses:d,terminal_canceled_statuses:o,active_statuses:i,blocked_statuses:l,draft_statuses:a,open_status:m,in_progress_status:E,blocked_status:w,close_status:T,canceled_status:h}}function Pe(e,t){let r=A(e);if(r)return t.alias_to_id.get(r)}function Nt(e){let t=g(e),r=new Map,n=t.fields.map(o=>Z(o)).filter(o=>o!==null);for(let o of n)r.set(o.key,o);let s=[...r.values()].sort((o,d)=>o.key.localeCompare(d.key)),i=new Map,l=new Map,a=new Map;for(let o of s){i.set(o.key,o),l.set(o.cli_flag,o);for(let d of o.cli_aliases)l.set(d,o);for(let d of o.commands){let u=a.get(d)??[];u.push(o),a.set(d,u)}}for(let[o,d]of a.entries())d.sort((u,c)=>u.key.localeCompare(c.key)),a.set(o,d);return{definitions:s,by_key:i,by_cli_token:l,command_to_fields:a}}function gt(e){return Te(e.key)}function Lt(e,t){let r=Pe(e,t);return r?t.terminal_statuses.has(r):!1}export{ce as a,Ke as b,j as c,v as d,K as e,W as f,q as g,We as h,qe as i,Ye as j,He as k,Ge as l,Xe as m,$e as n,Be as o,Je as p,Qe as q,Ze as r,et as s,de as t,tt as u,rt as v,nt as w,st as x,ot as y,it as z,at as A,O as B,z as C,Y as D,A as E,p as F,$ as G,D as H,G as I,g as J,y as K,wt as L,Tt as M,ht as N,kt as O,Pe as P,Nt as Q,gt as R,Lt as S};
|
|
3
|
-
//# sourceMappingURL=chunk-SX76UGEY.js.map
|