@unbrained/pm-cli 2026.11.24 → 2026.11.26
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/commander-usage.js +9 -9
- package/dist/cli/error-guidance.js +5 -5
- package/dist/cli/help-content.js +4 -4
- package/dist/cli/register-setup.js +1 -1
- package/dist/cli/runtime/selection.js +1 -1
- package/dist/cli-bundle/bundle-manifest.json +1 -1
- package/dist/cli-bundle/chunks/{chunk-WWTPNIC2.js → chunk-5AAIRHNE.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-5BPDT7G2.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-ZYCOM4MS.js → chunk-5FY2VHRF.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-YYT3MIRF.js → chunk-6OIHST4I.js} +1 -1
- package/dist/cli-bundle/chunks/chunk-7F3UFYZA.js +2 -0
- package/dist/cli-bundle/chunks/chunk-B2GM6KOM.js +2 -0
- package/dist/cli-bundle/chunks/chunk-BITDGTAX.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-DQDRA3SW.js → chunk-CBBKXTJG.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-DUJSME77.js +3 -0
- package/dist/cli-bundle/chunks/{chunk-37UDIJ2K.js → chunk-DYL2N3OC.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-VJSGUXGU.js → chunk-FWBR3OW7.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-GQXK4KKH.js +31 -0
- package/dist/cli-bundle/chunks/{chunk-ZOX4SWRL.js → chunk-HOLQZ56F.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-HTGN24XM.js +3 -0
- package/dist/cli-bundle/chunks/{chunk-PW7U7WCE.js → chunk-IGW3RVJC.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-KCRRTJ4X.js +125 -0
- package/dist/cli-bundle/chunks/{chunk-Z7MFVRDV.js → chunk-KES4VHU4.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-D6PDUKUG.js → chunk-KHFUHGL3.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-HNKK2UG6.js → chunk-LNZKNVMT.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-5DUP4AZA.js → chunk-MGJMQSN4.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-MNFCJNQA.js +35 -0
- package/dist/cli-bundle/chunks/{chunk-PQUBVRV5.js → chunk-NDS4MXZX.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-TVIJ2VCU.js → chunk-PQSEEVOA.js} +6 -6
- package/dist/cli-bundle/chunks/chunk-QMM46SJM.js +4 -0
- package/dist/cli-bundle/chunks/chunk-RFK3ERYX.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-7X253M6Z.js → chunk-SX76UGEY.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-T3GJPXIZ.js +69 -0
- package/dist/cli-bundle/chunks/{chunk-FXJYZBWV.js → chunk-WZOJSHJT.js} +40 -40
- package/dist/cli-bundle/chunks/{chunk-23K6DQQY.js → chunk-XRCE4QNL.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-SSALO4DB.js → chunk-ZDL45VTB.js} +2 -2
- package/dist/cli-bundle/chunks/{field-option-collisions-W66HSWMK.js → field-option-collisions-CGRJEAPQ.js} +2 -2
- package/dist/cli-bundle/chunks/{indexed-receipt-blobs-BPYKN5Q7.js → indexed-receipt-blobs-H3MMNXXG.js} +2 -2
- package/dist/cli-bundle/chunks/{item-revision-D3LSBNIR.js → item-revision-FGDR5NSF.js} +2 -2
- package/dist/cli-bundle/chunks/item-transaction-C3KAMEYO.js +2 -0
- package/dist/cli-bundle/chunks/{mutation-actor-OKL3CQVX.js → mutation-actor-HGG47KXV.js} +2 -2
- package/dist/cli-bundle/chunks/mutation-admission-LLHIRY6O.js +2 -0
- package/dist/cli-bundle/chunks/{register-list-query-3LBV6CS2.js → register-list-query-EKSCZWEZ.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-72AGTMNE.js → register-mutation-ZIAOKKUJ.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-XERFG2SH.js → register-operations-ECVBZ5FM.js} +2 -2
- package/dist/cli-bundle/chunks/register-setup-3QYD5H4H.js +2 -0
- package/dist/cli-bundle/chunks/{runtime-schema-JP2KBHBY.js → runtime-schema-Y4SHTEXL.js} +2 -2
- package/dist/cli-bundle/chunks/{settlement-hook-6MR32OOC.js → settlement-hook-ESAAEBRM.js} +2 -2
- package/dist/cli-bundle/chunks/{stage-T2LKWN7C.js → stage-RSCSUYEJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-LMU7DDOA.js → chunk-3BR5NWQI.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-46MP7IZN.js → chunk-3GQRWIT5.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-RIE3SJSE.js → chunk-4SX2BN4V.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-RLO2HCZT.js → chunk-AAB3ZR7Z.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-AVLB4L7M.js +44 -0
- package/dist/cli-bundle/focused-chunks/{chunk-B6BNHKUW.js → chunk-FQWKESMI.js} +58 -59
- package/dist/cli-bundle/focused-chunks/{chunk-GXP7Q4XM.js → chunk-FW5Q26HA.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-GQBWI4KA.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-3ELVASVA.js → chunk-IWEGGRRD.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-Z7W2RQIB.js → chunk-JUG3BAZZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-KEZ4VXYD.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-A6VEMCRR.js → chunk-NGFDPEP7.js} +1 -1
- package/dist/cli-bundle/focused-chunks/{chunk-SMMOZ3H3.js → chunk-NSFS3VWP.js} +37 -37
- package/dist/cli-bundle/focused-chunks/{chunk-OZOCEB2Q.js → chunk-NXUFVQ33.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-RIQUIHYU.js → chunk-OCKKIECS.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-UVTUX54T.js → chunk-QNWNUQSJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-QSRXF6XS.js +15 -0
- package/dist/cli-bundle/focused-chunks/chunk-R6QFPHWW.js +3 -0
- package/dist/cli-bundle/focused-chunks/{chunk-24VRBNKE.js → chunk-RDELKGLS.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-RFJ3MEFP.js +27 -0
- package/dist/cli-bundle/focused-chunks/{chunk-C7WHWI7K.js → chunk-RMJKVQYE.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-3OCDKITJ.js → chunk-TNVLDU7Z.js} +3 -3
- package/dist/cli-bundle/focused-chunks/chunk-UA2JNKMY.js +4 -0
- package/dist/cli-bundle/focused-chunks/chunk-VV2QF5IE.js +91 -0
- package/dist/cli-bundle/focused-chunks/{chunk-HL47UQZJ.js → chunk-WHHFPATO.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-YD66IRSL.js → chunk-YNRW2FWB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-XDBHD4CY.js → chunk-YSZZSV6M.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{field-option-collisions-UODPSV6W.js → field-option-collisions-WV6GPYYP.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{indexed-receipt-blobs-EGEJMG3G.js → indexed-receipt-blobs-PG2VJ3MB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{item-revision-QH7RNBX4.js → item-revision-RPTXN7WW.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{item-transaction-ZO72OINF.js → item-transaction-A6MVNPT7.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{mutation-actor-PHVLKG4I.js → mutation-actor-6ZVW6OME.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{mutation-admission-ZSG5OECH.js → mutation-admission-2DA4CINP.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{runtime-schema-6RQMIDTN.js → runtime-schema-YXPYDD2C.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{settlement-hook-FMLGKG7J.js → settlement-hook-4MGRERCT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{stage-AQMKRVX4.js → stage-RG3PKST7.js} +2 -2
- package/dist/cli-bundle/main.js +26 -26
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +4 -4
- 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 +12 -12
- package/dist/core/reproducibility/context.d.ts +2 -0
- package/dist/core/reproducibility/context.js +1 -1
- package/dist/core/shared/command-line.d.ts +54 -4
- package/dist/core/shared/command-line.js +1 -1
- package/dist/core/shared/errors.d.ts +9 -0
- package/dist/core/shared/secret-rules.js +5 -5
- package/dist/core/shared/url-credentials.d.ts +16 -3
- package/dist/core/shared/url-credentials.js +1 -1
- package/dist/core/store/item-store.d.ts +26 -4
- package/dist/core/store/item-store.js +1 -1
- package/dist/sdk/cli-bootstrap.d.ts +17 -0
- package/dist/sdk/cli-bootstrap.js +1 -1
- package/dist/sdk/cli-contracts/command-aliases.js +1 -1
- package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
- package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
- package/dist/sdk/cli-contracts/grammar-contracts.js +1 -1
- package/dist/sdk/cli-contracts/runtime-contracts.js +1 -1
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
- package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
- package/dist/sdk/cli-contracts/tool-schema.js +1 -1
- package/dist/sdk/cli-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts.js +1 -1
- package/dist/sdk/command-line.d.ts +1 -1
- package/dist/sdk/command-line.js +1 -1
- package/dist/sdk/completion/shared.d.ts +1 -1
- package/dist/sdk/completion/shared.js +1 -1
- package/dist/sdk/context-intent-contracts.js +1 -1
- package/dist/sdk/extension/bundled-catalog.js +1 -1
- package/dist/sdk/extension/install-sources.js +5 -5
- package/dist/sdk/extension/listing-fields.d.ts +15 -0
- package/dist/sdk/extension/listing-fields.js +2 -0
- package/dist/sdk/extension/managed-update-status.js +1 -1
- package/dist/sdk/extension/npm-spec.d.ts +18 -0
- package/dist/sdk/extension/npm-spec.js +2 -0
- package/dist/sdk/extension/static-inventory.d.ts +53 -1
- package/dist/sdk/extension/static-inventory.js +1 -1
- package/dist/sdk/extension/update-check.js +1 -1
- package/dist/sdk/extension/update-observations.js +3 -0
- package/dist/sdk/extension/upgrade-hints.js +2 -0
- package/dist/sdk/extension.d.ts +2 -0
- package/dist/sdk/extension.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
- package/dist/sdk/governance/tracked-runtime-cache.js +1 -1
- package/dist/sdk/governance/upgrade.d.ts +7 -2
- package/dist/sdk/governance/upgrade.js +2 -2
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/lifecycle/claim.d.ts +21 -1
- package/dist/sdk/lifecycle/claim.js +1 -1
- package/dist/sdk/lifecycle/task-composition.js +1 -1
- package/dist/sdk/ownership-source.d.ts +15 -1
- package/dist/sdk/ownership-source.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query/context.d.ts +20 -7
- package/dist/sdk/query/context.js +4 -2
- package/dist/sdk/runtime-input.js +1 -1
- package/dist/sdk/runtime-primitives.d.ts +1 -1
- package/dist/sdk/testing.d.ts +20 -2
- package/docs/AGENT_GUIDE.md +2 -2
- package/docs/COMMANDS.md +19 -1
- package/docs/CONFIGURATION.md +1 -0
- package/docs/DIAGNOSTIC_OUTPUT_CONTRACTS.md +6 -0
- package/docs/EXTENSION_LIFECYCLE.md +72 -2
- package/docs/MUTATION_INTEGRITY.md +97 -8
- package/docs/SDK.md +61 -5
- package/docs/WORKSPACE_POSITION_AND_LIFECYCLE.md +17 -4
- 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-7IROAPWI.js +0 -3
- package/dist/cli-bundle/chunks/chunk-7VRFEURZ.js +0 -33
- package/dist/cli-bundle/chunks/chunk-AWB5KBJS.js +0 -2
- package/dist/cli-bundle/chunks/chunk-I2OJ5B4A.js +0 -2
- package/dist/cli-bundle/chunks/chunk-I3BFCKZR.js +0 -2
- package/dist/cli-bundle/chunks/chunk-MXUSC5RS.js +0 -31
- package/dist/cli-bundle/chunks/chunk-PLIUU37C.js +0 -3
- package/dist/cli-bundle/chunks/chunk-STOOTHZZ.js +0 -2
- package/dist/cli-bundle/chunks/chunk-TKRY22SO.js +0 -2
- package/dist/cli-bundle/chunks/chunk-XFADNMGD.js +0 -2
- package/dist/cli-bundle/chunks/chunk-YOPTAIBD.js +0 -125
- package/dist/cli-bundle/chunks/chunk-YW2HBHRO.js +0 -70
- package/dist/cli-bundle/chunks/item-transaction-M6NTBYH3.js +0 -2
- package/dist/cli-bundle/chunks/mutation-admission-EKPEOZMF.js +0 -2
- package/dist/cli-bundle/chunks/register-setup-W22L34Z4.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-3GT4A3ZN.js +0 -44
- package/dist/cli-bundle/focused-chunks/chunk-3Z7MCUJM.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-5LDBS6MS.js +0 -91
- package/dist/cli-bundle/focused-chunks/chunk-EUQGZPGO.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-FDZPRJXJ.js +0 -27
- package/dist/cli-bundle/focused-chunks/chunk-LMFIAQ2V.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-Q2HY44LV.js +0 -13
- package/dist/cli-bundle/focused-chunks/chunk-REFMQY47.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as ye}from"./chunk-PQUBVRV5.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-YOPTAIBD.js";import{v as he}from"./chunk-23K6DQQY.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-FXJYZBWV.js";import{t as ee,u as te}from"./chunk-7IROAPWI.js";import{O as ne}from"./chunk-7X253M6Z.js";import{A as m,C as u,z as W}from"./chunk-YYT3MIRF.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-
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import{A as p,C as h,G as u}from"./chunk-
|
|
1
|
+
import{A as p,C as h,G as u}from"./chunk-6OIHST4I.js";import{readFile as $,realpath as _,stat as G,writeFile as k}from"node:fs/promises";import l from"node:path";var f="# pm-cli:runtime-cache:start",g="# pm-cli:runtime-cache:end",E=".agents/pm";async function d(n){let e=l.resolve(n),t=[];for(;;)try{let i=await _(e);if(!(await G(i)).isDirectory())throw Object.assign(new Error("Initialization path ancestry must be a directory."),{code:"ENOTDIR"});return l.join(i,...t)}catch(i){if(!u(i)||l.dirname(e)===e)throw i;t.unshift(l.basename(e)),e=l.dirname(e)}}var R=["runtime/","search/","locks/","transactions/","checkpoints/"],T=["search/eval-queries.json"];async function w(n){try{return await n()}catch(e){throw e instanceof Error&&"code"in e&&typeof e.code=="string"&&["EACCES","EPERM","EROFS"].includes(e.code)?new h("The workspace .gitignore is not writable.",p.GENERIC_FAILURE,{code:"init_gitignore_unwritable",reason:e.code.toLowerCase(),required:"Grant the current user read and write access to the workspace .gitignore before initialization.",why:"pm init must publish its managed runtime-cache ignore fence without replacing unrelated entries.",nextSteps:["Grant read and write access to the workspace .gitignore and rerun pm init.","If the workspace is intentionally read-only, initialize pm in a writable workspace or clone."]}):e}}function I(n){let e=n.split(l.sep).join("/").replace(/^\.\/+/,""),t=e.length;for(;t>0&&e[t-1]==="/";)t-=1;return e.slice(0,t)}function x(n){let e=n.replaceAll("\\","/");return l.isAbsolute(n)||e===".."||e.startsWith("../")}function b(n=E){let e=I(n);if(/[\r\n]/u.test(e))throw new h("A tracker path containing a line break cannot be represented safely in .gitignore.",p.USAGE,{code:"invalid_argument_value",required:"a tracker path without line breaks",nextSteps:["Choose a tracker path without carriage returns or newlines and rerun pm init."]});let t=e.replace(/[\\*?[\]#! \t]/gu,"\\$&");return[f,...R.map(i=>i==="search/"?`${t}/${i}*`:`${t}/${i}`),...T.map(i=>`!${t}/${i}`),g].join(`
|
|
2
2
|
`)}function y(n,e,t){let i=e.replace(/[\\*?[\]#! \t]/gu,"\\$&"),o=[...new Set([e,i])].flatMap(s=>R.flatMap(c=>[`${s}/${c}`,`!${s}/${c}`])),a=[],r=!1;for(let s of n)o.some(c=>s.startsWith(c))?(r||a.push(...t),r=!0):a.push(s);return r||a.push(...t),a}function O(n){let e=[],t=-1,i=0,o=0;for(let a of n.split(`
|
|
3
3
|
`)){let r=a.endsWith("\r")?a.slice(0,-1):a;r===f?(t=o,i=o+a.length+1):r===g&&t>=0&&(e.push({index:t,end:o+r.length,lines:n.slice(i,o).split(/\r?\n/u).filter(s=>s.length>0)}),t=-1),o+=a.length+1}return e}function P(n,e){let t=n.includes(`\r
|
|
4
4
|
`)?`\r
|
|
@@ -6,4 +6,4 @@ import{A as p,C as h,G as u}from"./chunk-YYT3MIRF.js";import{readFile as $,realp
|
|
|
6
6
|
`,i=b(e).split(`
|
|
7
7
|
`).slice(1,-1),o=O(n),a=o.flatMap(c=>c.lines),r=[f,...y(a,e,i),g].join(t);if(o.length===0){let c=n.length===0?"":n.endsWith(`
|
|
8
8
|
`)?t:`${t}${t}`;return`${n}${c}${r}${t}`}let s=n;for(let[c,m]of[...o.entries()].reverse())s=`${s.slice(0,m.index)}${c===0?r:""}${s.slice(m.end)}`;return s}async function N(n,e={}){let t=l.join(n,".gitignore"),i=E;if(e.pmRoot!==void 0){let r=I(l.relative(await d(n),await d(e.pmRoot)));if(x(r))return{path:t,changed:!1};i=r}let o="";try{o=await w(()=>$(t,"utf8"))}catch(r){if(!(r instanceof Error&&"code"in r&&u(r)))throw r}let a=P(o,i);return a===o?{path:t,changed:!1}:(await w(()=>k(t,a,"utf8")),{path:t,changed:!0})}export{f as a,g as b,R as c,x as d,b as e,N as f};
|
|
9
|
-
//# sourceMappingURL=chunk-
|
|
9
|
+
//# sourceMappingURL=chunk-KHFUHGL3.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{d as q}from"./chunk-
|
|
1
|
+
import{d as q}from"./chunk-KHFUHGL3.js";import{a as X,b as R,c as _,d as J}from"./chunk-AA52P34H.js";import{A as V,I as K,p as H,v as E}from"./chunk-XRCE4QNL.js";import{Mb as $,V as B,ba as P,nc as W,wg as U}from"./chunk-WZOJSHJT.js";import{Q as L}from"./chunk-DUJSME77.js";import{A as b,C as k,E as S,G as F,H as G,K as N}from"./chunk-6OIHST4I.js";var ce="PM_SOURCE_CONTEXT_ACCESS",le="PM_ALLOW_SOURCE_CONTEXT_WRITES";function z(e){let n=e[ce],r=n===void 0||n.trim().toLowerCase()==="write"?"write":"read_only",t=r==="read_only"&&e[le]?.trim()==="1";return{access:r,write_override_applied:t,source_writes_allowed:r==="write"||t}}import{access as ue,lstat as ee,readFile as T,realpath as h}from"node:fs/promises";import{constants as me}from"node:fs";import{execFile as pe}from"node:child_process";import a from"node:path";import{promisify as de}from"node:util";var v=de(pe),C="# pm-cli:merge-drivers:start",fe="# pm-cli:merge-drivers:end",x="# pm-cli:merge-drivers:v2:start",te="# pm-cli:merge-drivers:v2:end",ge="merge-fence",he="merge-attributes";function A(e){return`'${e.replaceAll("'",`'"'"'`)}'`}async function we(e,n){let r=await h(e);if(/(?:^|[\\/])bun-node-[^\\/]+[\\/]bun(?:\.exe)?$/iu.test(r))return;let{stdout:t}=await v(e,["--version"],{encoding:"utf8",windowsHide:!0,timeout:1e4});return t.trim()===n?r:void 0}async function ye(){let e=U(import.meta.url,["../../.."]),n=process.execPath,r=!1,t=await h(process.execPath),o=process.versions.bun,i=(process.env.PATH??"").split(a.delimiter).filter(s=>a.isAbsolute(s)).map(s=>a.join(s,o===void 0?a.basename(process.execPath):process.platform==="win32"?"bun.exe":"bun")),c=o===void 0?i:[process.env.npm_execpath??"",...i,t].filter(s=>a.isAbsolute(s)&&/^(?:bun|bun\.exe)$/iu.test(a.basename(s)));for(let s of c)try{if(await ue(s,me.X_OK),o!==void 0){let p=await we(s,o);if(p!==void 0){n=p,r=!0;break}continue}if(s!==t&&await h(s)===t){n=s;break}}catch{}if(o!==void 0&&!r)throw new k("Cannot install Bun merge drivers without a durable executable matching the current Bun version.",b.DEPENDENCY_FAILED,{code:"merge_bun_launcher_unavailable",why:"The current Bun process may be a temporary bunx launcher that Git cannot reuse after this command exits.",nextSteps:["Run with a durable version-matched Bun executable, expose one on an absolute PATH entry, or invoke pm through a Bun runner that publishes an absolute npm_execpath.","Retry pm merge install, then check pm health --strict-exit before merging branches."]});return`${A(n)} ${A(a.join(e,"dist","cli.js"))}`}var re=[{key:"pm-item-toon",name:"pm field-aware TOON item document merge",artifact:"item",itemPath:"%P"},{key:"pm-item-markdown",name:"pm field-aware JSON-markdown item document merge",artifact:"item",itemPath:"%P"},{key:"pm-history",name:"pm append-only history stream merge",artifact:"history",itemPath:void 0},{key:"pm-relationship",name:"pm append-only relationship event store merge",artifact:"relationship",itemPath:void 0},{key:"pm-json",name:"pm key-level JSON config merge",artifact:"json",itemPath:void 0}];function _e(e){let n=e.explicitPath?.trim(),r=e.environment.PM_SOURCE_WORKSPACE_ROOT?.trim(),t=e.environment.PM_SOURCE_PM_PATH?.trim(),o=z(e.environment),i=!!(r&&t),c=n===void 0&&i&&(e.dryRun||o.source_writes_allowed);if(n!==void 0){let s=P(e.cwd,n);return{pm_root:s,workspace_start:s,source_coordinates_available:i,source_context_selected:!1,source_policy:o}}return c?{pm_root:a.resolve(t),workspace_start:a.resolve(r),source_coordinates_available:!0,source_context_selected:!0,source_policy:o}:{pm_root:i?P(e.cwd,".agents/pm"):P(e.cwd),workspace_start:e.cwd,source_coordinates_available:i,source_context_selected:!1,source_policy:o}}async function M(e){try{let{stdout:n}=await v("git",["rev-parse","--show-toplevel"],{cwd:e,env:_(),encoding:"utf8",windowsHide:!0,timeout:1e4});return await h(R(n))}catch{return null}}async function ne(e){let n=await M(e);if(n===null)throw new k("pm merge install requires a git repository (merge drivers are git configuration).",b.USAGE);return n}function O(e,n){return a.relative(e,n).split(a.sep).join("/")}function Y(e){return e.replace(/[\\*?[\]!]/gu,"\\$&")}function g(e){return`"${e.replaceAll("\\","\\\\").replaceAll('"','\\"')}"`}function Q(e,n){if(e[n]!=="'")return null;let r="";for(let t=n+1;t<e.length;t+=1){if(e.startsWith(`'"'"'`,t)){r+="'",t+=4;continue}if(e[t]==="'")return{value:r,nextOffset:t+1};r+=e[t]}return null}async function ve(e,n,r){if(V(n).filter(i=>i.constraint==="exact").some(i=>i.version!==r))return!1;let o=await M(e);if(o!==null&&o!==await h(n)){let i=await Promise.all([o,n].map(async c=>{let s=await v("git",["rev-parse","--path-format=absolute","--git-common-dir"],{cwd:c,env:_(),timeout:1e4});return h(s.stdout.trim())}));if(i[0]===i[1])return!1}return!0}async function be(e,n,r){let t=Q(e,0);if(t===null||e[t.nextOffset]!==" ")return!1;let o=Q(e,t.nextOffset+1);if(o===null||e.slice(o.nextOffset)!==n||!/^(?:node|bun)(?:\.exe)?$/iu.test(a.basename(t.value))||a.basename(o.value)!=="cli.js"||a.basename(a.dirname(o.value))!=="dist"||!await S(t.value)||!await S(o.value))return!1;try{let i=a.dirname(a.dirname(o.value)),c=JSON.parse(await T(a.join(i,"package.json"),"utf8")),s=typeof c.bin=="string"?c.bin:c.bin?.pm;return await ve(i,r,c.version)?c.name==="@unbrained/pm-cli"&&s==="dist/cli.js":!1}catch{return!1}}function j(e,n){let r=e.length>0?`${Y(e)}/`:"",t=[`${g(`${r}**/*.toon`)} merge=pm-item-toon`,`${g(`${r}**/*.md`)} merge=pm-item-markdown`];for(let o of n){let i=Y(o);t.push(`${g(`${r}${i}/*.toon`)} merge=pm-item-toon`),t.push(`${g(`${r}${i}/*.md`)} merge=pm-item-markdown`)}return t.push(`${g(`${r}**/*.jsonl`)} merge=pm-relationship`),t.push(`${g(`${r}history/*.jsonl`)} merge=pm-history`),t.push(`${g(`${r}settings.json`)} merge=pm-json`),t.push(`${g(`${r}**/*.json`)} merge=pm-json`),t.push(`${g(`${r}extensions/**`)} merge=text`),t.push(`${g(`${r}extensions/.managed-extensions.json`)} merge=pm-json`),t}function oe(e){let n=[],r=0;for(;r<e.length;){let t=e.indexOf(C,r),o=e.indexOf(x,r),i=t===-1?o:o===-1?t:Math.min(t,o);if(i===-1)break;let c=i===o,s=c?x:C,p=c?te:fe,d=e.indexOf(p,i+s.length),u=d===-1?e.length:d+p.length;n.push({start:i,end:u,closed:d!==-1,lines:e.slice(i+s.length,d===-1?u:d).split(`
|
|
2
2
|
`).map(l=>l.trim()).filter(Boolean)}),r=u}return n}function ie(e,n,r){let t=new Set(n),o=g(r.length>0?`${r}/`:"").slice(0,-1);return e.some(i=>t.has(i)||i.startsWith(o)&&/^[^/]+\/\*\.(?:toon|md)" merge=pm-item-(?:toon|markdown)$/u.test(i.slice(o.length)))}async function se(e,n,r,t){let o=a.join(e,".gitattributes"),i=t?null:R((await v("git",["rev-parse","--absolute-git-dir"],{cwd:e,env:_(),encoding:"utf8",windowsHide:!0,timeout:1e4})).stdout),c=i===null?null:await $(i,he,120,"merge-fence",!1,!0,5e3);try{let s=await G(o)??"",p=[x,...r,te].join(`
|
|
3
3
|
`),d=oe(s),u=d.filter(m=>ie(m.lines,r,n));u.length===0&&n===".agents/pm"&&d.length===1&&d[0].lines.every(m=>!m.includes("/"))&&u.push(d[0]);let l;if(u.length>0){let m=u[0];l=s;for(let y of u.slice(1).reverse())l=`${l.slice(0,y.start)}${l.slice(y.end)}`;l=`${l.slice(0,m.start)}${p}${l.slice(m.end)}`}else{let m=s.trimEnd();l=`${m.length>0?`${m}
|
|
4
4
|
|
|
5
5
|
`:""}${p}
|
|
6
6
|
`}return l===s&&!(await ee(o)).isSymbolicLink()?{path:o,changed:!1}:(t||await N(o,l),{path:o,changed:!0})}finally{await c?.()}}function ae(e){let n=B(e,null);return[...new Set(Object.values(n.type_to_folder))].sort((r,t)=>r.localeCompare(t))}async function Z(e){try{return await h(e)}catch{return null}}function ke(e,n){let r=a.relative(e,n);return r===""||!a.isAbsolute(r)&&r.split(a.sep)[0]!==".."}async function xe(e){try{return(await ee(e)).isFile()?await T(e,"utf8"):null}catch{return null}}async function Pe(e){try{return await T(e,"utf8")}catch{return null}}async function $e(e,n){let r=n===void 0?await M(e):n;if(r===null)return{trackerRoot:e,topLevel:null};let[t,o]=await Promise.all([Z(e),Z(r)]);return t===null||o===null||!ke(o,t)?null:{trackerRoot:t,topLevel:o}}async function Ee(e){let n=e.topLevel===null?Pe:xe,r=e.trackerRoot;for(let t=0;e.topLevel!==null||t<8;t+=1){let o=await n(a.join(r,".gitattributes"));if(o!==null&&(o.includes(x)||o.includes(C)))return{directory:r,content:o};let i=a.dirname(r);if(i===r||e.topLevel!==null&&a.relative(e.topLevel,r)==="")return null;r=i}return null}async function Ye(e,n,r={}){let t=await $e(a.resolve(e),r.gitWorkspaceRoot),o=t===null?null:await Ee(t);if(t===null||o===null)return{status:"not_installed",missing_patterns:[],stale_patterns:[],schema_scope:"project"};let i=o.directory,c=o.content,s=a.join(i,".gitattributes"),p=O(i,t.trackerRoot),d=oe(c),u=j(p,n),l=d.filter(w=>ie(w.lines,u,p)),m=l.flatMap(w=>w.closed?w.lines:[]),y=new Set(m),f=new Set(u),I=u.filter(w=>!y.has(w)),D=m.filter(w=>!f.has(w));return{status:l.length!==1||!l[0].closed||I.length>0||D.length>0?"drift":"ok",path:s,missing_patterns:I,stale_patterns:D,schema_scope:"project"}}async function Qe(e){let n=[],r=[];for(let t of re){let o=`merge.${t.key}.driver`,i=` merge driver ${t.artifact} "%O" "%A" "%B"${t.itemPath===void 0?"":` --item-path ${t.itemPath}`}`;try{let{stdout:c}=await v("git",["config","--get",o],{cwd:e,env:_(),encoding:"utf8",windowsHide:!0,timeout:1e4}),s=c.trim();await be(s,i,e)||r.push(o)}catch{n.push(o)}}return{status:n.length>0?"missing":r.length>0?"drift":"ok",missing_keys:n,drifted_keys:r}}async function Ze(e){let n;try{n=await ne(a.resolve(e))}catch{return{status:"no_git"}}let r=O(n,a.resolve(e)),t=await E(e),o=W(void 0,t.author_default),i=await $(e,ge,t.locks.ttl_seconds,o,!1,H(t).force_required_for_stale_lock,t.locks.wait_ms);try{let c=a.join(n,".gitattributes"),s;try{s=await T(c,"utf8")}catch(l){if(l instanceof Error&&"code"in l&&F(l))return{status:"not_installed",path:c};throw l}if(!s.includes(x)&&!s.includes(C))return{status:"not_installed",path:c};let p=await E(e),d=ae(p),u=await se(n,r,j(r,d),!1);return{status:u.changed?"refreshed":"unchanged",path:u.path}}finally{await i()}}async function et(e,n){let r=_e({cwd:process.cwd(),explicitPath:n.path,dryRun:e.dryRun===!0,environment:process.env}),t=r.pm_root;await K(t);let o=await ne(r.workspace_start);return Te({pmRoot:t,workspaceRoot:o,dryRun:e.dryRun===!0,preCommitHook:e.preCommitHook===!0})}async function Ce(e,n){let r=(await v("git",["rev-parse","--path-format=absolute","--git-common-dir"],{cwd:e,env:_(),timeout:1e4})).stdout.trim(),t=await $(r,"merge-driver-config",120,"merge-install",!1,!0,5e3);try{let o=await J(e),i;try{i=(await v("git",["config",o,"--null","--get-regexp","."],{cwd:e,env:_(),timeout:1e4})).stdout}catch(s){if(typeof s!="object"||s===null||!("code"in s)||s.code!==1)throw s;i=""}let c=new Map(i.split("\0").filter(Boolean).map(s=>{let p=s.indexOf(`
|
|
7
|
-
`);return[s.slice(0,p),s.slice(p+1)]}));for(let s of n)c.get(s.key)!==s.value&&await X(e,[o,s.key,s.value])}finally{await t()}}async function Te(e){let n=a.resolve(e.pmRoot),r=a.resolve(e.workspaceRoot),t=e.dryRun===!0,o,i;try{[o,i]=await Promise.all([h(n),h(r)])}catch(f){throw new k(`Cannot resolve tracker root ${n} or workspace root ${r}: ${String(f)}`,b.NOT_FOUND,{code:"merge_root_not_found",nextSteps:["Initialize the tracker and ensure both paths are accessible.",'Retry "pm merge install" from the repository workspace.']})}let c=O(i,o);if(q(c))throw new k(`Tracker root ${n} is outside the git repository ${r}; there is nothing to configure for this repository.`,b.USAGE);let s=await E(o),p=ae(s),d=j(c,p),u=[],l=await ye(),m=e.preCommitHook===!0?await import("./settlement-hook-
|
|
8
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
`);return[s.slice(0,p),s.slice(p+1)]}));for(let s of n)c.get(s.key)!==s.value&&await X(e,[o,s.key,s.value])}finally{await t()}}async function Te(e){let n=a.resolve(e.pmRoot),r=a.resolve(e.workspaceRoot),t=e.dryRun===!0,o,i;try{[o,i]=await Promise.all([h(n),h(r)])}catch(f){throw new k(`Cannot resolve tracker root ${n} or workspace root ${r}: ${String(f)}`,b.NOT_FOUND,{code:"merge_root_not_found",nextSteps:["Initialize the tracker and ensure both paths are accessible.",'Retry "pm merge install" from the repository workspace.']})}let c=O(i,o);if(q(c))throw new k(`Tracker root ${n} is outside the git repository ${r}; there is nothing to configure for this repository.`,b.USAGE);let s=await E(o),p=ae(s),d=j(c,p),u=[],l=await ye(),m=e.preCommitHook===!0?await import("./settlement-hook-ESAAEBRM.js").then(async f=>({plan:await f.prepareMergeSettlementHook(i,`${l} --pm-path ${A(c||".")}`),write:f.writeMergeSettlementHook})):void 0;for(let f of re)u.push({key:`merge.${f.key}.name`,value:f.name}),u.push({key:`merge.${f.key}.driver`,value:`${l} merge driver ${f.artifact} "%O" "%A" "%B"${f.itemPath===void 0?"":` --item-path ${f.itemPath}`}`});if(!t)try{await Ce(i,u)}catch{throw new k(`Cannot install repository-local merge drivers in ${i}. Ensure the repository Git config is writable and no other Git process holds its lock, then retry.`,b.DEPENDENCY_FAILED,{code:"merge_git_config_unwritable",why:"pm merge install must persist clone-local driver commands before publishing their shared .gitattributes mappings.",nextSteps:["Make the repository Git config writable or wait for the process holding its lock to finish.",'Retry "pm merge install"; the operation is idempotent.','Use "pm merge install --dry-run --json" when the workspace is intentionally read-only.']})}let y=await se(i,c,d,t);return m!==void 0&&!t&&await m.write(m.plan),{ok:!0,dry_run:t,workspace_root:i,pm_root:o,gitattributes:{path:y.path,changed:y.changed,patterns:d,schema_scope:"project"},git_config:u,...m===void 0?{}:{settlement_hook:{path:m.plan.path,changed:m.plan.changed}},guidance:["Commit .gitattributes so every branch and collaborator shares the merge mapping.",'git config is per-clone: each collaborator (and each fresh worktree/clone) runs "pm merge install" once.','After merging branches, run "pm merge reconcile --dry-run" to inspect the complete receipt and history repair, then apply "pm merge reconcile"; use --force only after explicitly accepting any discarded values.',"Custom item types registered later refresh this fence automatically (pm schema add-type/remove-type); rerun pm merge install only after out-of-band type-folder edits."],generated_at:L()}}export{ce as a,le as b,z as c,C as d,fe as e,x as f,te as g,_e as h,M as i,j,ae as k,Ye as l,Qe as m,Ze as n,et as o,Te as p};
|
|
8
|
+
//# sourceMappingURL=chunk-LNZKNVMT.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as a}from"./chunk-AA52P34H.js";import{A as s,C as l}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as a}from"./chunk-AA52P34H.js";import{A as s,C as l}from"./chunk-6OIHST4I.js";import{execFile as u}from"node:child_process";import{promisify as g}from"node:util";var p=g(u);async function b(m,r){if(r.length===0)return[];let i;try{let e=p("git",["check-ignore","--verbose","-z","--stdin"],{cwd:m,env:a(),timeout:1e4}),t=e.child.stdin;t!==null&&(t.on("error",()=>{e.child.kill()}),t.end(`${r.join("\0")}\0`)),{stdout:i}=await e}catch(e){if(typeof e=="object"&&e!==null&&"code"in e&&e.code===1)return[];throw new l("Git could not verify ignore rules for merge artifacts; no automatic settlement is safe until that check succeeds.",s.CONFLICT,{code:"merge_settlement_review_required",reason:"ignore_check_unavailable",nextSteps:["Check Git configuration and ignore-file readability, then retry pm merge reconcile --stage --dry-run."]})}let n=i.split("\0"),o=[];for(let e=0;e+3<n.length;e+=4){let[t,d,c,f]=n.slice(e,e+4);c.startsWith("!")||o.push({path:f,source:t,line:Number(d),pattern:c})}return o}export{b as a};
|
|
2
|
+
//# sourceMappingURL=chunk-MGJMQSN4.js.map
|