@unbrained/pm-cli 2026.11.24 → 2026.11.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/dist/cli/error-guidance.js +5 -5
- package/dist/cli-bundle/bundle-manifest.json +1 -1
- package/dist/cli-bundle/chunks/{chunk-I2OJ5B4A.js → chunk-4FZH5BTV.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-YYT3MIRF.js → chunk-6OIHST4I.js} +1 -1
- package/dist/cli-bundle/chunks/{chunk-ZYCOM4MS.js → chunk-7EPYCU7U.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-TVIJ2VCU.js → chunk-BVJMVU4Z.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-23K6DQQY.js → chunk-C4KIZQHW.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-FXJYZBWV.js → chunk-CNUFU454.js} +40 -40
- package/dist/cli-bundle/chunks/{chunk-PQUBVRV5.js → chunk-CONBVY2O.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-HNKK2UG6.js → chunk-CZEMEPPQ.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-Z7MFVRDV.js → chunk-DF6A7C32.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-ZOX4SWRL.js → chunk-FHLOGAGA.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-FVY7U3SU.js +125 -0
- package/dist/cli-bundle/chunks/{chunk-VJSGUXGU.js → chunk-GBVF2ZB3.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-TKRY22SO.js → chunk-GZI7ZAB7.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-PW7U7WCE.js → chunk-K34FR5CO.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-D6PDUKUG.js → chunk-KHFUHGL3.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-DQDRA3SW.js → chunk-L6VS7F3R.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-LOX3VY4T.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-WWTPNIC2.js → chunk-LPW7S5KA.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-5DUP4AZA.js → chunk-MGJMQSN4.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-MXUSC5RS.js → chunk-OS5W4ZG2.js} +31 -31
- package/dist/cli-bundle/chunks/{chunk-37UDIJ2K.js → chunk-OWK2JL4I.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-SSALO4DB.js → chunk-SCIPT7WF.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-7X253M6Z.js → chunk-SX76UGEY.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-YW2HBHRO.js → chunk-VA4T37Q4.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-STOOTHZZ.js → chunk-WQOEVGLQ.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-XHCIOLJP.js +3 -0
- package/dist/cli-bundle/chunks/{chunk-XFADNMGD.js → chunk-XKWJONAO.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-YIGBEY7K.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-7VRFEURZ.js → chunk-ZBOQEZ2H.js} +25 -25
- package/dist/cli-bundle/chunks/{chunk-PLIUU37C.js → chunk-ZLICQPRG.js} +2 -2
- package/dist/cli-bundle/chunks/{field-option-collisions-W66HSWMK.js → field-option-collisions-QE65APSD.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-INDHJV6X.js} +2 -2
- package/dist/cli-bundle/chunks/item-transaction-LCKK4XXB.js +2 -0
- package/dist/cli-bundle/chunks/{mutation-actor-OKL3CQVX.js → mutation-actor-KU7BMLUN.js} +2 -2
- package/dist/cli-bundle/chunks/mutation-admission-3OMCTQD4.js +2 -0
- package/dist/cli-bundle/chunks/{register-list-query-3LBV6CS2.js → register-list-query-3GV3LBOT.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-72AGTMNE.js → register-mutation-GZLF47SX.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-XERFG2SH.js → register-operations-PBJZGCAL.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-W22L34Z4.js → register-setup-ZLJEF6NZ.js} +2 -2
- 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-3WIZBD4N.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-3Y5PTQ2F.js +27 -0
- package/dist/cli-bundle/focused-chunks/{chunk-XDBHD4CY.js → chunk-4LQL4EO6.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{chunk-RIE3SJSE.js → chunk-4SX2BN4V.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-B6BNHKUW.js → chunk-5RBC4WSE.js} +39 -39
- package/dist/cli-bundle/focused-chunks/chunk-7SSGTGZO.js +91 -0
- package/dist/cli-bundle/focused-chunks/{chunk-LMFIAQ2V.js → chunk-A4R57E4K.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-46MP7IZN.js → chunk-BOIMP2AR.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-GXP7Q4XM.js → chunk-BYQK5DGH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-C3FEDTSD.js +44 -0
- package/dist/cli-bundle/focused-chunks/{chunk-REFMQY47.js → chunk-IAOKVKWW.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-YD66IRSL.js → chunk-JOKRDFMQ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-HL47UQZJ.js → chunk-MB56Y4M6.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-A6VEMCRR.js → chunk-NGFDPEP7.js} +1 -1
- package/dist/cli-bundle/focused-chunks/{chunk-RIQUIHYU.js → chunk-OCKKIECS.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-24VRBNKE.js → chunk-PKX2EHE3.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-C7WHWI7K.js → chunk-SXC2EO3E.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-3ELVASVA.js → chunk-TQIKDFOD.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-OZOCEB2Q.js → chunk-TRL4JDWX.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-3OCDKITJ.js → chunk-UWWAVXG4.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-VMYVN36N.js +13 -0
- package/dist/cli-bundle/focused-chunks/{chunk-LMU7DDOA.js → chunk-VU2PH4PF.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-EUQGZPGO.js → chunk-WL2R7T5G.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-WVA5KOXF.js +3 -0
- package/dist/cli-bundle/focused-chunks/{chunk-RLO2HCZT.js → chunk-X4EWD6TL.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-SMMOZ3H3.js → chunk-XKLBTDJ7.js} +37 -37
- package/dist/cli-bundle/focused-chunks/{chunk-UVTUX54T.js → chunk-YYEWIKNI.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-Z7W2RQIB.js → chunk-ZLRRII55.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{field-option-collisions-UODPSV6W.js → field-option-collisions-5ROXGUME.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-KYMSQVZE.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{item-transaction-ZO72OINF.js → item-transaction-I4HLVHEJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{mutation-actor-PHVLKG4I.js → mutation-actor-GGOQKAE6.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{mutation-admission-ZSG5OECH.js → mutation-admission-OS36ZCMH.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-4ZFWJUKO.js} +2 -2
- package/dist/cli-bundle/main.js +18 -18
- 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 +61 -61
- 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/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/command-line.d.ts +1 -1
- package/dist/sdk/command-line.js +1 -1
- package/dist/sdk/context-intent-contracts.js +1 -1
- package/dist/sdk/governance/tracked-runtime-cache.js +1 -1
- 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/runtime-primitives.d.ts +1 -1
- package/docs/AGENT_GUIDE.md +2 -2
- package/docs/CONFIGURATION.md +1 -0
- package/docs/MUTATION_INTEGRITY.md +97 -8
- package/docs/SDK.md +40 -3
- 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-AWB5KBJS.js +0 -2
- package/dist/cli-bundle/chunks/chunk-I3BFCKZR.js +0 -2
- package/dist/cli-bundle/chunks/chunk-YOPTAIBD.js +0 -125
- 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/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-FDZPRJXJ.js +0 -27
- package/dist/cli-bundle/focused-chunks/chunk-Q2HY44LV.js +0 -13
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{b as K}from"./chunk-
|
|
1
|
+
import{b as K}from"./chunk-4SX2BN4V.js";import{a as X,b as R,c as h,d as z}from"./chunk-AIDL2ZNT.js";import{n as H,s as $,u as V,y as q}from"./chunk-MB56Y4M6.js";import{Gc as U,Q as L,W as E,dc as P,y as B}from"./chunk-XKLBTDJ7.js";import{t as W}from"./chunk-WVA5KOXF.js";import{A as v,C as S,E as F,F as G,I as N,z as _}from"./chunk-NGFDPEP7.js";import{access as ue,lstat as ee,readFile as T,realpath as w}from"node:fs/promises";import{constants as me}from"node:fs";import{execFile as pe}from"node:child_process";import c from"node:path";import{promisify as de}from"node:util";var ce="PM_SOURCE_CONTEXT_ACCESS",le="PM_ALLOW_SOURCE_CONTEXT_WRITES";function J(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}}var k=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 w(e);if(/(?:^|[\\/])bun-node-[^\\/]+[\\/]bun(?:\.exe)?$/iu.test(r))return;let{stdout:t}=await k(e,["--version"],{encoding:"utf8",windowsHide:!0,timeout:1e4});return t.trim()===n?r:void 0}async function ye(){let e=B(import.meta.url,["../../.."]),n=process.execPath,r=!1,t=await w(process.execPath),o=process.versions.bun,i=(process.env.PATH??"").split(c.delimiter).filter(s=>c.isAbsolute(s)).map(s=>c.join(s,o===void 0?c.basename(process.execPath):process.platform==="win32"?"bun.exe":"bun")),a=o===void 0?i:[process.env.npm_execpath??"",...i,t].filter(s=>c.isAbsolute(s)&&/^(?:bun|bun\.exe)$/iu.test(c.basename(s)));for(let s of a)try{if(await ue(s,me.X_OK),o!==void 0){let u=await we(s,o);if(u!==void 0){n=u,r=!0;break}continue}if(s!==t&&await w(s)===t){n=s;break}}catch{}if(o!==void 0&&!r)throw new v("Cannot install Bun merge drivers without a durable executable matching the current Bun version.",_.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(c.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=J(e.environment),i=!!(r&&t),a=n===void 0&&i&&(e.dryRun||o.source_writes_allowed);if(n!==void 0){let s=E(e.cwd,n);return{pm_root:s,workspace_start:s,source_coordinates_available:i,source_context_selected:!1,source_policy:o}}return a?{pm_root:c.resolve(t),workspace_start:c.resolve(r),source_coordinates_available:!0,source_context_selected:!0,source_policy:o}:{pm_root:i?E(e.cwd,".agents/pm"):E(e.cwd),workspace_start:e.cwd,source_coordinates_available:i,source_context_selected:!1,source_policy:o}}async function O(e){try{let{stdout:n}=await k("git",["rev-parse","--show-toplevel"],{cwd:e,env:h(),encoding:"utf8",windowsHide:!0,timeout:1e4});return await w(R(n))}catch{return null}}async function ne(e){let n=await O(e);if(n===null)throw new v("pm merge install requires a git repository (merge drivers are git configuration).",_.USAGE);return n}function M(e,n){return c.relative(e,n).split(c.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 O(e);if(o!==null&&o!==await w(n)){let i=await Promise.all([o,n].map(async a=>{let s=await k("git",["rev-parse","--path-format=absolute","--git-common-dir"],{cwd:a,env:h(),timeout:1e4});return w(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(c.basename(t.value))||c.basename(o.value)!=="cli.js"||c.basename(c.dirname(o.value))!=="dist"||!await S(t.value)||!await S(o.value))return!1;try{let i=c.dirname(c.dirname(o.value)),a=JSON.parse(await T(c.join(i,"package.json"),"utf8")),s=typeof a.bin=="string"?a.bin:a.bin?.pm;return await ve(i,r,a.version)?a.name==="@unbrained/pm-cli"&&s==="dist/cli.js":!1}catch{return!1}}function I(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 a=i===o,s=a?x:C,u=a?te:fe,p=e.indexOf(u,i+s.length),m=p===-1?e.length:p+u.length;n.push({start:i,end:m,closed:p!==-1,lines:e.slice(i+s.length,p===-1?m:p).split(`
|
|
2
2
|
`).map(l=>l.trim()).filter(Boolean)}),r=m}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=c.join(e,".gitattributes"),i=t?null:R((await k("git",["rev-parse","--absolute-git-dir"],{cwd:e,env:h(),encoding:"utf8",windowsHide:!0,timeout:1e4})).stdout),a=i===null?null:await P(i,he,120,"merge-fence",!1,!0,5e3);try{let s=await G(o)??"",u=[x,...r,te].join(`
|
|
3
3
|
`),p=oe(s),m=p.filter(d=>ie(d.lines,r,n));m.length===0&&n===".agents/pm"&&p.length===1&&p[0].lines.every(d=>!d.includes("/"))&&m.push(p[0]);let l;if(m.length>0){let d=m[0];l=s;for(let b of m.slice(1).reverse())l=`${l.slice(0,b.start)}${l.slice(b.end)}`;l=`${l.slice(0,d.start)}${u}${l.slice(d.end)}`}else{let d=s.trimEnd();l=`${d.length>0?`${d}
|
|
4
4
|
|
|
5
5
|
`:""}${u}
|
|
6
6
|
`}return l===s&&!(await ee(o)).isSymbolicLink()?{path:o,changed:!1}:(t||await N(o,l),{path:o,changed:!0})}finally{await a?.()}}function ae(e){let n=L(e,null);return[...new Set(Object.values(n.type_to_folder))].sort((r,t)=>r.localeCompare(t))}async function Z(e){try{return await w(e)}catch{return null}}function ke(e,n){let r=c.relative(e,n);return r===""||!c.isAbsolute(r)&&r.split(c.sep)[0]!==".."}async function xe(e){try{return(await ee(e)).isFile()?await T(e,"utf8"):null}catch{return null}}async function Ee(e){try{return await T(e,"utf8")}catch{return null}}async function Pe(e,n){let r=n===void 0?await O(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 $e(e){let n=e.topLevel===null?Ee:xe,r=e.trackerRoot;for(let t=0;e.topLevel!==null||t<8;t+=1){let o=await n(c.join(r,".gitattributes"));if(o!==null&&(o.includes(x)||o.includes(C)))return{directory:r,content:o};let i=c.dirname(r);if(i===r||e.topLevel!==null&&c.relative(e.topLevel,r)==="")return null;r=i}return null}async function et(e,n,r={}){let t=await Pe(c.resolve(e),r.gitWorkspaceRoot),o=t===null?null:await $e(t);if(t===null||o===null)return{status:"not_installed",missing_patterns:[],stale_patterns:[],schema_scope:"project"};let i=o.directory,a=o.content,s=c.join(i,".gitattributes"),u=M(i,t.trackerRoot),p=oe(a),m=I(u,n),l=p.filter(y=>ie(y.lines,m,u)),d=l.flatMap(y=>y.closed?y.lines:[]),b=new Set(d),f=new Set(m),j=m.filter(y=>!b.has(y)),D=d.filter(y=>!f.has(y));return{status:l.length!==1||!l[0].closed||j.length>0||D.length>0?"drift":"ok",path:s,missing_patterns:j,stale_patterns:D,schema_scope:"project"}}async function tt(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:a}=await k("git",["config","--get",o],{cwd:e,env:h(),encoding:"utf8",windowsHide:!0,timeout:1e4}),s=a.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 rt(e){let n;try{n=await ne(c.resolve(e))}catch{return{status:"no_git"}}let r=M(n,c.resolve(e)),t=await $(e),o=U(void 0,t.author_default),i=await P(e,ge,t.locks.ttl_seconds,o,!1,H(t).force_required_for_stale_lock,t.locks.wait_ms);try{let a=c.join(n,".gitattributes"),s;try{s=await T(a,"utf8")}catch(l){if(l instanceof Error&&"code"in l&&F(l))return{status:"not_installed",path:a};throw l}if(!s.includes(x)&&!s.includes(C))return{status:"not_installed",path:a};let u=await $(e),p=ae(u),m=await se(n,r,I(r,p),!1);return{status:m.changed?"refreshed":"unchanged",path:m.path}}finally{await i()}}async function nt(e,n){let r=_e({cwd:process.cwd(),explicitPath:n.path,dryRun:e.dryRun===!0,environment:process.env}),t=r.pm_root;await q(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 k("git",["rev-parse","--path-format=absolute","--git-common-dir"],{cwd:e,env:h(),timeout:1e4})).stdout.trim(),t=await P(r,"merge-driver-config",120,"merge-install",!1,!0,5e3);try{let o=await z(e),i;try{i=(await k("git",["config",o,"--null","--get-regexp","."],{cwd:e,env:h(),timeout:1e4})).stdout}catch(s){if(typeof s!="object"||s===null||!("code"in s)||s.code!==1)throw s;i=""}let a=new Map(i.split("\0").filter(Boolean).map(s=>{let u=s.indexOf(`
|
|
7
|
-
`);return[s.slice(0,u),s.slice(u+1)]}));for(let s of n)a.get(s.key)!==s.value&&await X(e,[o,s.key,s.value])}finally{await t()}}async function Te(e){let n=c.resolve(e.pmRoot),r=c.resolve(e.workspaceRoot),t=e.dryRun===!0,o,i;try{[o,i]=await Promise.all([w(n),w(r)])}catch(f){throw new v(`Cannot resolve tracker root ${n} or workspace root ${r}: ${String(f)}`,_.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 a=M(i,o);if(K(a))throw new v(`Tracker root ${n} is outside the git repository ${r}; there is nothing to configure for this repository.`,_.USAGE);let s=await $(o),u=ae(s),p=I(a,u),m=[],l=await ye(),d=e.preCommitHook===!0?await import("./settlement-hook-
|
|
8
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
`);return[s.slice(0,u),s.slice(u+1)]}));for(let s of n)a.get(s.key)!==s.value&&await X(e,[o,s.key,s.value])}finally{await t()}}async function Te(e){let n=c.resolve(e.pmRoot),r=c.resolve(e.workspaceRoot),t=e.dryRun===!0,o,i;try{[o,i]=await Promise.all([w(n),w(r)])}catch(f){throw new v(`Cannot resolve tracker root ${n} or workspace root ${r}: ${String(f)}`,_.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 a=M(i,o);if(K(a))throw new v(`Tracker root ${n} is outside the git repository ${r}; there is nothing to configure for this repository.`,_.USAGE);let s=await $(o),u=ae(s),p=I(a,u),m=[],l=await ye(),d=e.preCommitHook===!0?await import("./settlement-hook-4MGRERCT.js").then(async f=>({plan:await f.prepareMergeSettlementHook(i,`${l} --pm-path ${A(a||".")}`),write:f.writeMergeSettlementHook})):void 0;for(let f of re)m.push({key:`merge.${f.key}.name`,value:f.name}),m.push({key:`merge.${f.key}.driver`,value:`${l} merge driver ${f.artifact} "%O" "%A" "%B"${f.itemPath===void 0?"":` --item-path ${f.itemPath}`}`});if(!t)try{await Ce(i,m)}catch{throw new v(`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.`,_.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 b=await se(i,a,p,t);return d!==void 0&&!t&&await d.write(d.plan),{ok:!0,dry_run:t,workspace_root:i,pm_root:o,gitattributes:{path:b.path,changed:b.changed,patterns:p,schema_scope:"project"},git_config:m,...d===void 0?{}:{settlement_hook:{path:d.plan.path,changed:d.plan.changed}},guidance:["Commit .gitattributes so every branch and collaborator shares the merge mapping.",'git config is per-clone: each collaborator (and each fresh worktree/clone) runs "pm merge install" once.','After merging branches, run "pm merge reconcile --dry-run" to inspect the complete receipt and history repair, then apply "pm merge reconcile"; use --force only after explicitly accepting any discarded values.',"Custom item types registered later refresh this fence automatically (pm schema add-type/remove-type); rerun pm merge install only after out-of-band type-folder edits."],generated_at:W()}}import{execFile as Se}from"node:child_process";import{promisify as Re}from"node:util";var Ae=Re(Se);async function ut(e,n){if(n.length===0)return[];let r;try{let i=Ae("git",["check-ignore","--verbose","-z","--stdin"],{cwd:e,env:h(),timeout:1e4}),a=i.child.stdin;a!==null&&(a.on("error",()=>{i.child.kill()}),a.end(`${n.join("\0")}\0`)),{stdout:r}=await i}catch(i){if(typeof i=="object"&&i!==null&&"code"in i&&i.code===1)return[];throw new v("Git could not verify ignore rules for merge artifacts; no automatic settlement is safe until that check succeeds.",_.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 t=r.split("\0"),o=[];for(let i=0;i+3<t.length;i+=4){let[a,s,u,p]=t.slice(i,i+4);u.startsWith("!")||o.push({path:p,source:a,line:Number(s),pattern:u})}return o}export{ce as a,le as b,O as c,ae as d,et as e,tt as f,rt as g,nt as h,Te as i,ut as j};
|
|
8
|
+
//# sourceMappingURL=chunk-4LQL4EO6.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as h,E as u,z as p}from"./chunk-
|
|
1
|
+
import{A as h,E as u,z as p}from"./chunk-NGFDPEP7.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 h,E as u,z as p}from"./chunk-A6VEMCRR.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{R as a,x as b,N as c};
|
|
9
|
-
//# sourceMappingURL=chunk-
|
|
9
|
+
//# sourceMappingURL=chunk-4SX2BN4V.js.map
|