@unbrained/pm-cli 2026.11.2 → 2026.11.4
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/CHANGELOG.md +24 -0
- package/dist/cli/error-guidance.d.ts +23 -35
- package/dist/cli/error-guidance.js +4 -3
- package/dist/cli/expected-revisions.d.ts +55 -0
- package/dist/cli/expected-revisions.js +2 -0
- package/dist/cli/main.js +2 -2
- package/dist/cli/runtime/field-route-retry.d.ts +15 -0
- package/dist/cli/runtime/field-route-retry.js +2 -0
- package/dist/cli/runtime/invocation-options.js +1 -1
- package/dist/cli-bundle/bundle-manifest.json +1 -1
- package/dist/cli-bundle/chunks/{chunk-3A4NVHYS.js → chunk-2GW662DP.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-3OXQGGRD.js +115 -0
- package/dist/cli-bundle/chunks/chunk-5BVZ32G7.js +2 -0
- package/dist/cli-bundle/chunks/chunk-5S6RT5LX.js +9 -0
- package/dist/cli-bundle/chunks/chunk-5Z6LWFDL.js +31 -0
- package/dist/cli-bundle/chunks/{chunk-RGHLQGEX.js → chunk-6T2V3UIK.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-JRXD7SIL.js → chunk-7PGNAHNW.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-7RCI7AAA.js +20 -0
- package/dist/cli-bundle/chunks/chunk-AQ5UHHQS.js +2 -0
- package/dist/cli-bundle/chunks/chunk-BK2XAQVC.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-ABFFRQRO.js → chunk-BRIPGUAO.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-BWAXA6S4.js +6 -0
- package/dist/cli-bundle/chunks/{chunk-HOGKWJU5.js → chunk-CERNIZLB.js} +66 -66
- package/dist/cli-bundle/chunks/chunk-DSCFJTHB.js +122 -0
- package/dist/cli-bundle/chunks/{chunk-VEOFWE32.js → chunk-L4BKTPJ6.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-NGRPD3ZO.js → chunk-NPEDFOVQ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-J3JM36EH.js → chunk-O4ZLEN4T.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-533L6D2N.js → chunk-ODMJ3HIB.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-KJLGBLR3.js → chunk-QN7VCOUU.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-QQHMNUZT.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-D52QQ7LP.js → chunk-RSAN2YUU.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-SRDO2NJU.js +2 -0
- package/dist/cli-bundle/chunks/chunk-T56MB6SF.js +2 -0
- package/dist/cli-bundle/chunks/chunk-TX2W6G37.js +3 -0
- package/dist/cli-bundle/chunks/{chunk-GK2CHAT3.js → chunk-UJMQP2HP.js} +2 -2
- package/dist/cli-bundle/chunks/{indexed-receipt-blobs-IEJ2QOW3.js → indexed-receipt-blobs-I6RQGD6Y.js} +2 -2
- package/dist/cli-bundle/chunks/item-revision-UAZOBP2Q.js +2 -0
- package/dist/cli-bundle/chunks/item-transaction-N5F4LXYV.js +2 -0
- package/dist/cli-bundle/chunks/mutation-admission-QZQI2NN5.js +2 -0
- package/dist/cli-bundle/chunks/{register-list-query-NZTK3AXA.js → register-list-query-P3NOKQUA.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-2OFAMOVH.js → register-mutation-A6I5K5N6.js} +2 -2
- package/dist/cli-bundle/chunks/register-operations-SPKB3TNM.js +2 -0
- package/dist/cli-bundle/chunks/register-setup-ZZRHJ4IS.js +2 -0
- package/dist/cli-bundle/chunks/{settlement-hook-UTCEZBFT.js → settlement-hook-JHXLUBEN.js} +2 -2
- package/dist/cli-bundle/chunks/{stage-VLI4OBVX.js → stage-L3T725DS.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-5NGNO54M.js +44 -0
- package/dist/cli-bundle/focused-chunks/{chunk-PCCZ72C3.js → chunk-A2246ZM7.js} +54 -54
- package/dist/cli-bundle/focused-chunks/chunk-B6U44WPW.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-BAW3DGQO.js +91 -0
- package/dist/cli-bundle/focused-chunks/chunk-BHNY3KPJ.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-C3O6JJPO.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-745IDMTD.js → chunk-C7UX2ZI3.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-CBG67HUP.js +23 -0
- package/dist/cli-bundle/focused-chunks/{chunk-NJFMG3IK.js → chunk-CO2DNPH7.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-CXTDEQ3N.js +8 -0
- package/dist/cli-bundle/focused-chunks/chunk-FEPE2CE4.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-FFO7RBLN.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-QNXXOFLQ.js → chunk-FXFDVM5O.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-QVFE5LIX.js → chunk-G6ERMFJ5.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-I5LGPUWH.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-MQVBWFJF.js → chunk-IDAYTYNN.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-J3YOATXR.js +80 -0
- package/dist/cli-bundle/focused-chunks/{chunk-3UD6F2KQ.js → chunk-J6FDCAMH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-J7M52SCZ.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-JQS7TYQ6.js +12 -0
- package/dist/cli-bundle/focused-chunks/chunk-MEJKELWC.js +26 -0
- package/dist/cli-bundle/focused-chunks/chunk-PMKR4MJI.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-PNPYQDHU.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-Q4OIRSKL.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-I4Z2SCV5.js → chunk-QEVJ3Y67.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-Q23K6WLV.js → chunk-SDLIUZEL.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-TFYTTDAK.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-W3CSX6GI.js +3 -0
- package/dist/cli-bundle/focused-chunks/{chunk-B6OOKKOX.js → chunk-Y5GOUUYJ.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{indexed-receipt-blobs-FT3KF6VJ.js → indexed-receipt-blobs-7XGVHYAO.js} +2 -2
- package/dist/cli-bundle/focused-chunks/item-revision-L6GVT42D.js +2 -0
- package/dist/cli-bundle/focused-chunks/item-transaction-GYGP264N.js +2 -0
- package/dist/cli-bundle/focused-chunks/mutation-admission-UWTH56OD.js +2 -0
- package/dist/cli-bundle/focused-chunks/{settlement-hook-KMIBD4F2.js → settlement-hook-H56537UV.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{stage-6B3O2GZ6.js → stage-WRSNJ7VI.js} +2 -2
- package/dist/cli-bundle/main.js +30 -29
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +5 -5
- 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 +57 -57
- 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 +11 -11
- package/dist/core/config/positional-value.d.ts +1 -1
- package/dist/core/config/positional-value.js +1 -1
- package/dist/core/extensions/extension-hook-runtime.js +1 -1
- package/dist/core/extensions/item-fields.d.ts +1 -1
- package/dist/core/extensions/item-fields.js +1 -1
- package/dist/core/extensions/reserved-host-flags.js +1 -1
- package/dist/core/history/history-rewrite.js +1 -1
- package/dist/core/schema/runtime-field-values.d.ts +30 -0
- package/dist/core/schema/runtime-field-values.js +1 -1
- package/dist/core/sentry/helpers.js +1 -1
- package/dist/core/sentry/instrument.js +1 -1
- package/dist/core/shared/command-types.d.ts +7 -0
- package/dist/core/shared/error-details.d.ts +98 -0
- package/dist/core/shared/error-details.js +2 -0
- package/dist/core/shared/errors.d.ts +37 -0
- package/dist/core/shared/errors.js +1 -1
- package/dist/core/store/item-mutation-precondition.d.ts +70 -6
- package/dist/core/store/item-mutation-precondition.js +1 -1
- package/dist/core/store/item-store.js +1 -1
- package/dist/core/store/settings-validator.js +1 -1
- package/dist/core/store/settings.js +1 -1
- package/dist/mcp/server.js +2 -2
- package/dist/sdk/cli-contracts/bootstrap-command-scanner.js +1 -1
- package/dist/sdk/cli-contracts/completeness.js +1 -1
- package/dist/sdk/cli-contracts/enum-contracts.d.ts +11 -0
- package/dist/sdk/cli-contracts/enum-contracts.js +1 -1
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -1
- package/dist/sdk/cli-contracts/registration-helpers.js +1 -1
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
- package/dist/sdk/cli-contracts/tool-schema.js +1 -1
- package/dist/sdk/cli-program.js +1 -1
- package/dist/sdk/config.d.ts +1 -1
- package/dist/sdk/config.js +1 -1
- package/dist/sdk/environment/project-runtime-compatibility.js +1 -1
- package/dist/sdk/errors.d.ts +6 -2
- package/dist/sdk/errors.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/validate.js +1 -1
- package/dist/sdk/history/salvage.js +3 -3
- package/dist/sdk/history-compact.d.ts +7 -1
- package/dist/sdk/history-compact.js +1 -1
- package/dist/sdk/history-repair.d.ts +2 -1
- package/dist/sdk/history-repair.js +1 -1
- package/dist/sdk/index.d.ts +4 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/lifecycle/checkpoint-rollback.d.ts +10 -2
- package/dist/sdk/lifecycle/checkpoint-rollback.js +1 -1
- package/dist/sdk/lifecycle/claim.js +1 -1
- package/dist/sdk/lifecycle/close-many.d.ts +11 -2
- package/dist/sdk/lifecycle/close-many.js +1 -1
- package/dist/sdk/lifecycle/close.d.ts +15 -0
- package/dist/sdk/lifecycle/close.js +1 -1
- package/dist/sdk/lifecycle/core-field-recovery.d.ts +26 -0
- package/dist/sdk/lifecycle/core-field-recovery.js +1 -1
- package/dist/sdk/lifecycle/create.js +1 -1
- package/dist/sdk/lifecycle/item-revision.d.ts +162 -0
- package/dist/sdk/lifecycle/item-revision.js +2 -0
- package/dist/sdk/lifecycle/restore.js +1 -1
- package/dist/sdk/lifecycle/start-blockers.d.ts +52 -0
- package/dist/sdk/lifecycle/start-blockers.js +2 -0
- package/dist/sdk/lifecycle/task-composition.d.ts +11 -0
- package/dist/sdk/lifecycle/task-composition.js +1 -1
- package/dist/sdk/lifecycle/update-many.d.ts +11 -2
- package/dist/sdk/lifecycle/update-many.js +1 -1
- package/dist/sdk/lifecycle/update.js +2 -2
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query/declared-blockers.d.ts +16 -0
- package/dist/sdk/query/declared-blockers.js +2 -0
- package/dist/sdk/query/get.d.ts +7 -0
- package/dist/sdk/query/get.js +1 -1
- package/dist/sdk/query/projection-contracts.js +1 -1
- package/dist/sdk/runtime-input.d.ts +12 -0
- package/dist/sdk/runtime-input.js +1 -1
- package/dist/sdk/runtime.d.ts +11 -1
- package/dist/sdk/runtime.js +1 -1
- package/dist/sdk/structured-mutations.js +1 -1
- package/dist/sdk/test/batch.js +2 -2
- package/dist/sdk/test/entry.d.ts +5 -0
- package/dist/sdk/test/entry.js +2 -2
- package/dist/sdk/test/execution.d.ts +1 -2
- package/dist/sdk/test/execution.js +2 -2
- package/dist/sdk/test/linked-command-detection.d.ts +10 -0
- package/dist/sdk/test/linked-command-detection.js +1 -1
- package/dist/sdk/test/update.d.ts +2 -0
- package/dist/sdk/test/update.js +1 -1
- package/dist/sdk/workspace-transaction.d.ts +17 -6
- package/dist/sdk/workspace-transaction.js +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/types.js +1 -1
- package/docs/COMMANDS.md +91 -0
- package/docs/CONFIGURATION.md +1 -0
- package/docs/EXTENSIONS.md +2 -2
- package/docs/LINKED_TEST_EDITS.md +38 -5
- package/docs/SDK.md +185 -1
- package/docs/agent-task-token-baseline.json +1 -1
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +111 -111
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +15 -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-3ZQQVJT2.js +0 -20
- package/dist/cli-bundle/chunks/chunk-4HW253W2.js +0 -2
- package/dist/cli-bundle/chunks/chunk-4OELCF3O.js +0 -2
- package/dist/cli-bundle/chunks/chunk-BFZUJ5QP.js +0 -115
- package/dist/cli-bundle/chunks/chunk-DAZFCSDV.js +0 -2
- package/dist/cli-bundle/chunks/chunk-EN27ZQSV.js +0 -2
- package/dist/cli-bundle/chunks/chunk-K46GDAKX.js +0 -6
- package/dist/cli-bundle/chunks/chunk-OJR2YGXF.js +0 -31
- package/dist/cli-bundle/chunks/chunk-QHHFXNSQ.js +0 -3
- package/dist/cli-bundle/chunks/chunk-ZNWDYDFF.js +0 -129
- package/dist/cli-bundle/chunks/item-transaction-JHPBH6N7.js +0 -2
- package/dist/cli-bundle/chunks/mutation-admission-QUNQZCZ5.js +0 -2
- package/dist/cli-bundle/chunks/register-operations-RFMM5KZ6.js +0 -2
- package/dist/cli-bundle/chunks/register-setup-6B6Q7M5L.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-4NVPDZLX.js +0 -12
- package/dist/cli-bundle/focused-chunks/chunk-4UUE3YXZ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-5UDDRPYR.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-AK2CI2GI.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-EJJWOFP5.js +0 -91
- package/dist/cli-bundle/focused-chunks/chunk-FUGYXUUL.js +0 -80
- package/dist/cli-bundle/focused-chunks/chunk-HMXVTWIV.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-JLN5CFYM.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-K4FMZB4Y.js +0 -23
- package/dist/cli-bundle/focused-chunks/chunk-PF553UVP.js +0 -44
- package/dist/cli-bundle/focused-chunks/chunk-RUCG6UWN.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-SGWYNU7T.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-TGS5RXBY.js +0 -26
- package/dist/cli-bundle/focused-chunks/chunk-WD43E7RU.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-YM4AMP7H.js +0 -2
- package/dist/cli-bundle/focused-chunks/item-transaction-F4SN7TXJ.js +0 -2
- package/dist/cli-bundle/focused-chunks/mutation-admission-7R2FXJ5O.js +0 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{b as K}from"./chunk-
|
|
1
|
+
import{b as K}from"./chunk-IDAYTYNN.js";import{ab as H,fa as U,fb as P,hb as L,kb as V}from"./chunk-J3YOATXR.js";import{Qd as W,_ as G,de as $,ra as B,xa as E}from"./chunk-MEJKELWC.js";import{a as X,b as y,c as q}from"./chunk-FOA7XKWP.js";import{A as v,C as S,E as j,F,I as N,z as w}from"./chunk-G6ERMFJ5.js";import{access as le,readFile as A,realpath as _}from"node:fs/promises";import{constants as ue}from"node:fs";import{execFile as me}from"node:child_process";import c from"node:path";import{promisify as de}from"node:util";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="6d1f8e03-97b4-5d83-b85c-e47f39c07d48")}catch{}})();var se="PM_SOURCE_CONTEXT_ACCESS",ce="PM_ALLOW_SOURCE_CONTEXT_WRITES";function z(e){let r=e[se],i=r===void 0||r.trim().toLowerCase()==="write"?"write":"read_only",t=i==="read_only"&&e[ce]?.trim()==="1";return{access:i,write_override_applied:t,source_writes_allowed:i==="write"||t}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="b1828465-0619-514c-8956-2a81dea9efbc")}catch{}})();var k=de(me),T="# pm-cli:merge-drivers:start",pe="# pm-cli:merge-drivers:end",x="# pm-cli:merge-drivers:v2:start",Q="# pm-cli:merge-drivers:v2:end",fe="merge-fence",ge="merge-attributes";function R(e){return`'${e.replaceAll("'",`'"'"'`)}'`}async function he(e,r){let i=await _(e);if(/(?:^|[\\/])bun-node-[^\\/]+[\\/]bun(?:\.exe)?$/iu.test(i))return;let{stdout:t}=await k(e,["--version"],{encoding:"utf8",windowsHide:!0,timeout:1e4});return t.trim()===r?i:void 0}async function ye(){let e=G(import.meta.url,["../../.."]),r=process.execPath,i=!1,t=await _(process.execPath),o=process.versions.bun,n=(process.env.PATH??"").split(c.delimiter).filter(a=>c.isAbsolute(a)).map(a=>c.join(a,o===void 0?c.basename(process.execPath):process.platform==="win32"?"bun.exe":"bun")),s=o===void 0?n:[process.env.npm_execpath??"",...n,t].filter(a=>c.isAbsolute(a)&&/^(?:bun|bun\.exe)$/iu.test(c.basename(a)));for(let a of s)try{if(await le(a,ue.X_OK),o!==void 0){let d=await he(a,o);if(d!==void 0){r=d,i=!0;break}continue}if(a!==t&&await _(a)===t){r=a;break}}catch{}if(o!==void 0&&!i)throw new v("Cannot install Bun merge drivers without a durable executable matching the current Bun version.",w.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`${R(r)} ${R(c.join(e,"dist","cli.js"))}`}var Z=[{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 we(e){let r=e.explicitPath?.trim(),i=e.environment.PM_SOURCE_WORKSPACE_ROOT?.trim(),t=e.environment.PM_SOURCE_PM_PATH?.trim(),o=z(e.environment),n=!!(i&&t),s=r===void 0&&n&&(e.dryRun||o.source_writes_allowed);if(r!==void 0){let a=E(e.cwd,r);return{pm_root:a,workspace_start:a,source_coordinates_available:n,source_context_selected:!1,source_policy:o}}return s?{pm_root:c.resolve(t),workspace_start:c.resolve(i),source_coordinates_available:!0,source_context_selected:!0,source_policy:o}:{pm_root:n?E(e.cwd,".agents/pm"):E(e.cwd),workspace_start:e.cwd,source_coordinates_available:n,source_context_selected:!1,source_policy:o}}async function ee(e){try{let{stdout:r}=await k("git",["rev-parse","--show-toplevel"],{cwd:e,env:y(),encoding:"utf8",windowsHide:!0,timeout:1e4});return await _(r.trim())}catch{return null}}async function te(e){let r=await ee(e);if(r===null)throw new v("pm merge install requires a git repository (merge drivers are git configuration).",w.USAGE);return r}function I(e,r){return c.relative(e,r).split(c.sep).join("/")}function J(e){return e.replace(/[\\*?[\]!]/gu,"\\$&")}function h(e){return`"${e.replaceAll("\\","\\\\").replaceAll('"','\\"')}"`}function Y(e,r){if(e[r]!=="'")return null;let i="";for(let t=r+1;t<e.length;t+=1){if(e.startsWith(`'"'"'`,t)){i+="'",t+=4;continue}if(e[t]==="'")return{value:i,nextOffset:t+1};i+=e[t]}return null}async function ve(e,r,i){if(L(r).filter(o=>o.constraint==="exact").some(o=>o.version!==i))return!1;let t=await ee(e);if(t!==null&&t!==await _(r)){let o=await Promise.all([t,r].map(async n=>{let s=await k("git",["rev-parse","--path-format=absolute","--git-common-dir"],{cwd:n,env:y(),timeout:1e4});return _(s.stdout.trim())}));if(o[0]===o[1])return!1}return!0}async function _e(e,r,i){let t=Y(e,0);if(t===null||e[t.nextOffset]!==" ")return!1;let o=Y(e,t.nextOffset+1);if(o===null||e.slice(o.nextOffset)!==r||!/^(?: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 n=c.dirname(c.dirname(o.value)),s=JSON.parse(await A(c.join(n,"package.json"),"utf8")),a=typeof s.bin=="string"?s.bin:s.bin?.pm;return await ve(n,i,s.version)?s.name==="@unbrained/pm-cli"&&a==="dist/cli.js":!1}catch{return!1}}function O(e,r){let i=e.length>0?`${J(e)}/`:"",t=[`${h(`${i}**/*.toon`)} merge=pm-item-toon`,`${h(`${i}**/*.md`)} merge=pm-item-markdown`];for(let o of r){let n=J(o);t.push(`${h(`${i}${n}/*.toon`)} merge=pm-item-toon`),t.push(`${h(`${i}${n}/*.md`)} merge=pm-item-markdown`)}return t.push(`${h(`${i}**/*.jsonl`)} merge=pm-relationship`),t.push(`${h(`${i}history/*.jsonl`)} merge=pm-history`),t.push(`${h(`${i}settings.json`)} merge=pm-json`),t.push(`${h(`${i}**/*.json`)} merge=pm-json`),t.push(`${h(`${i}extensions/**`)} merge=text`),t.push(`${h(`${i}extensions/.managed-extensions.json`)} merge=pm-json`),t}function re(e){let r=[],i=0;for(;i<e.length;){let t=e.indexOf(T,i),o=e.indexOf(x,i),n=t===-1?o:o===-1?t:Math.min(t,o);if(n===-1)break;let s=n===o,a=s?x:T,d=s?Q:pe,u=e.indexOf(d,n+a.length),m=u===-1?e.length:u+d.length;r.push({start:n,end:m,closed:u!==-1,lines:e.slice(n+a.length,u===-1?m:u).split(`
|
|
2
2
|
`).map(l=>l.trim()).filter(Boolean)}),i=m}return r}function ie(e,r,i){let t=new Set(r),o=h(i.length>0?`${i}/`:"").slice(0,-1);return e.some(n=>t.has(n)||n.startsWith(o)&&/^[^/]+\/\*\.(?:toon|md)" merge=pm-item-(?:toon|markdown)$/u.test(n.slice(o.length)))}async function ne(e,r,i,t){let o=c.join(e,".gitattributes"),n=t?null:(await k("git",["rev-parse","--absolute-git-dir"],{cwd:e,env:y(),encoding:"utf8",windowsHide:!0,timeout:1e4})).stdout.trim(),s=n===null?null:await $(n,ge,120,"merge-fence",!1,!0,5e3);try{let a=await F(o)??"",d=[x,...i,Q].join(`
|
|
3
3
|
`),u=re(a),m=u.filter(p=>ie(p.lines,i,r));m.length===0&&r===".agents/pm"&&u.length===1&&u[0].lines.every(p=>!p.includes("/"))&&m.push(u[0]);let l;if(m.length>0){let p=m[0];l=a;for(let b of m.slice(1).reverse())l=`${l.slice(0,b.start)}${l.slice(b.end)}`;l=`${l.slice(0,p.start)}${d}${l.slice(p.end)}`}else{let p=a.trimEnd();l=`${p.length>0?`${p}
|
|
4
4
|
|
|
5
5
|
`:""}${d}
|
|
6
6
|
`}return l===a?{path:o,changed:!1}:(t||await N(o,l),{path:o,changed:!0})}finally{await s?.()}}function oe(e){let r=B(e,null);return[...new Set(Object.values(r.type_to_folder))].sort((i,t)=>i.localeCompare(t))}async function qe(e,r){let i=c.resolve(e),t=null,o="",n=i;for(let g=0;g<8;g+=1){let ae=c.join(n,".gitattributes");try{let C=await A(ae,"utf8");if(C.includes(x)||C.includes(T)){t=n,o=C;break}}catch{}let D=c.dirname(n);if(D===n)break;n=D}if(t===null)return{status:"not_installed",missing_patterns:[],stale_patterns:[],schema_scope:"project"};let s=c.join(t,".gitattributes"),a=I(t,i),d=re(o),u=O(a,r),m=d.filter(g=>ie(g.lines,u,a)),l=m.flatMap(g=>g.closed?g.lines:[]),p=new Set(l),b=new Set(u),f=u.filter(g=>!p.has(g)),M=l.filter(g=>!b.has(g));return{status:m.length!==1||!m[0].closed||f.length>0||M.length>0?"drift":"ok",path:s,missing_patterns:f,stale_patterns:M,schema_scope:"project"}}async function ze(e){let r=[],i=[];for(let t of Z){let o=`merge.${t.key}.driver`,n=` merge driver ${t.artifact} "%O" "%A" "%B"${t.itemPath===void 0?"":` --item-path ${t.itemPath}`}`;try{let{stdout:s}=await k("git",["config","--get",o],{cwd:e,env:y(),encoding:"utf8",windowsHide:!0,timeout:1e4}),a=s.trim();await _e(a,n,e)||i.push(o)}catch{r.push(o)}}return{status:r.length>0?"missing":i.length>0?"drift":"ok",missing_keys:r,drifted_keys:i}}async function Je(e){let r;try{r=await te(c.resolve(e))}catch{return{status:"no_git"}}let i=I(r,c.resolve(e)),t=await P(e),o=U(void 0,t.author_default),n=await $(e,fe,t.locks.ttl_seconds,o,!1,H(t).force_required_for_stale_lock,t.locks.wait_ms);try{let s=c.join(r,".gitattributes"),a;try{a=await A(s,"utf8")}catch(l){if(l instanceof Error&&"code"in l&&j(l))return{status:"not_installed",path:s};throw l}if(!a.includes(x)&&!a.includes(T))return{status:"not_installed",path:s};let d=await P(e),u=oe(d),m=await ne(r,i,O(i,u),!1);return{status:m.changed?"refreshed":"unchanged",path:m.path}}finally{await n()}}async function Ye(e,r){let i=we({cwd:process.cwd(),explicitPath:r.path,dryRun:e.dryRun===!0,environment:process.env}),t=i.pm_root;await V(t);let o=await te(i.workspace_start);return ke({pmRoot:t,workspaceRoot:o,dryRun:e.dryRun===!0,preCommitHook:e.preCommitHook===!0})}async function be(e,r){let i=(await k("git",["rev-parse","--path-format=absolute","--git-common-dir"],{cwd:e,env:y(),timeout:1e4})).stdout.trim(),t=await $(i,"merge-driver-config",120,"merge-install",!1,!0,5e3);try{let o=await q(e),n;try{n=(await k("git",["config",o,"--null","--get-regexp","."],{cwd:e,env:y(),timeout:1e4})).stdout}catch(a){if(typeof a!="object"||a===null||!("code"in a)||a.code!==1)throw a;n=""}let s=new Map(n.split("\0").filter(Boolean).map(a=>{let d=a.indexOf(`
|
|
7
|
-
`);return[a.slice(0,d),a.slice(d+1)]}));for(let a of r)s.get(a.key)!==a.value&&await X(e,[o,a.key,a.value])}finally{await t()}}async function ke(e){let r=c.resolve(e.pmRoot),i=c.resolve(e.workspaceRoot),t=e.dryRun===!0,o,n;try{[o,n]=await Promise.all([_(r),_(i)])}catch(f){throw new v(`Cannot resolve tracker root ${r} or workspace root ${i}: ${String(f)}`,w.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 s=I(n,o);if(K(s))throw new v(`Tracker root ${r} is outside the git repository ${i}; there is nothing to configure for this repository.`,w.USAGE);let a=await P(o),d=oe(a),u=O(s,d),m=[],l=await ye(),p=e.preCommitHook===!0?await import("./settlement-hook-
|
|
8
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
`);return[a.slice(0,d),a.slice(d+1)]}));for(let a of r)s.get(a.key)!==a.value&&await X(e,[o,a.key,a.value])}finally{await t()}}async function ke(e){let r=c.resolve(e.pmRoot),i=c.resolve(e.workspaceRoot),t=e.dryRun===!0,o,n;try{[o,n]=await Promise.all([_(r),_(i)])}catch(f){throw new v(`Cannot resolve tracker root ${r} or workspace root ${i}: ${String(f)}`,w.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 s=I(n,o);if(K(s))throw new v(`Tracker root ${r} is outside the git repository ${i}; there is nothing to configure for this repository.`,w.USAGE);let a=await P(o),d=oe(a),u=O(s,d),m=[],l=await ye(),p=e.preCommitHook===!0?await import("./settlement-hook-H56537UV.js").then(async f=>({plan:await f.prepareMergeSettlementHook(n,`${l} --pm-path ${R(s||".")}`),write:f.writeMergeSettlementHook})):void 0;for(let f of Z)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 be(n,m)}catch{throw new v(`Cannot install repository-local merge drivers in ${n}. Ensure the repository Git config is writable and no other Git process holds its lock, then retry.`,w.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 ne(n,s,u,t);return p!==void 0&&!t&&await p.write(p.plan),{ok:!0,dry_run:t,workspace_root:n,pm_root:o,gitattributes:{path:b.path,changed:b.changed,patterns:u,schema_scope:"project"},git_config:m,...p===void 0?{}:{settlement_hook:{path:p.plan.path,changed:p.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 xe}from"node:child_process";import{promisify as Ee}from"node:util";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="e57ef62f-fd40-5a33-9816-e24d8dba4d1d")}catch{}})();var $e=Ee(xe);async function nt(e,r){if(r.length===0)return[];let i;try{let n=$e("git",["check-ignore","--verbose","-z","--stdin"],{cwd:e,env:y(),timeout:1e4}),s=n.child.stdin;s!==null&&(s.on("error",()=>{n.child.kill()}),s.end(`${r.join("\0")}\0`)),{stdout:i}=await n}catch(n){if(typeof n=="object"&&n!==null&&"code"in n&&n.code===1)return[];throw new v("Git could not verify ignore rules for merge artifacts; no automatic settlement is safe until that check succeeds.",w.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=i.split("\0"),o=[];for(let n=0;n+3<t.length;n+=4){let[s,a,d,u]=t.slice(n,n+4);d.startsWith("!")||o.push({path:u,source:s,line:Number(a),pattern:d})}return o}export{se as a,ce as b,ee as c,oe as d,qe as e,ze as f,Je as g,Ye as h,ke as i,nt as j};
|
|
8
|
+
//# sourceMappingURL=chunk-Y5GOUUYJ.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as E}from"./chunk-
|
|
1
|
+
import{b as E}from"./chunk-IDAYTYNN.js";import{b as I}from"./chunk-FOA7XKWP.js";import"./chunk-G6ERMFJ5.js";import{execFile as O}from"node:child_process";import{realpath as v}from"node:fs/promises";import b from"node:path";import{promisify as M}from"node:util";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new n.Error().stack;o&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[o]="5d2c2c37-5ff2-5dab-84f1-55a7fa8d5a27")}catch{}})();var w=M(O),x="[a-f0-9]{40}(?:[a-f0-9]{24})?",N=new RegExp(`^100(?:644|755) (${x}) 0$`,"u"),R=new RegExp(`^(${x}) blob (\\d+)$`,"u");async function _(n,o,a){let t=w("git",n,{...a,encoding:"buffer"}),e=t.child.stdin;return e!==null&&(e.on("error",()=>{t.child.kill()}),e.end(`${o.join(`
|
|
2
2
|
`)}
|
|
3
3
|
`)),(await t).stdout}function B(n,o){let a=new Map;for(let t of n.split("\0")){let e=t.indexOf(" "),i=t.slice(e+1),r=N.exec(t.slice(0,e));r!==null&&o.has(i)&&a.set(i,r[1])}return a}function D(n,o,a){let t=[],e=[],i=0;for(let r of n.trimEnd().split(/\r?\n/u)){let s=R.exec(r);if(s===null||!o.has(s[1]))continue;let c=Number(s[2]);!Number.isSafeInteger(c)||c>a||(e.length>0&&i+c+128>a&&(t.push(e),e=[],i=0),e.push({id:s[1],size:c}),i+=c+128)}return e.length>0&&t.push(e),t}function S(n,o,a){let t=0;for(let{id:e,size:i}of o){let r=n.indexOf(10,t)+1;if(r===0||n.subarray(t,r-1).toString("ascii")!==`${e} blob ${i}`||n[r+i]!==10)throw new Error("Invalid indexed receipt batch framing");a.set(e,n.subarray(r,r+i).toString("utf8")),t=r+i+1}if(t!==n.length)throw new Error("Unexpected indexed receipt batch data")}async function k(n,o,a,t,e,i={}){let r=I();r.GIT_NO_REPLACE_OBJECTS="1",e===void 0&&process.env.GIT_INDEX_FILE!==void 0&&(r.GIT_INDEX_FILE=b.resolve(process.env.GIT_INDEX_FILE));let s={cwd:n,env:r,windowsHide:!0,timeout:1e4,maxBuffer:t+256};try{let c=(await w("git",["rev-parse","--show-toplevel"],{...s,encoding:"utf8"})).stdout.trim(),[g,y]=await Promise.all([v(c),v(e??o)]),d=b.relative(g,e===void 0?y:b.resolve(e)).replaceAll("\\","/");if(E(d))return new Map;s.cwd=g;let m=new Map(a.map(f=>[`${d}/${f}`,f])),T=(await w("git",["ls-files","--stage","-z","--",`:(literal)${d}/`],{...s,encoding:"utf8"})).stdout,p=B(T,new Set(m.keys()));if(p.size===0)return new Map;let u=new Set(p.values()),$=(await _(["cat-file","--batch-check"],[...u],s)).toString("utf8"),l=new Map;for(let f of D($,u,t))S(await _(["cat-file","--batch"],f.map(h=>h.id),s),f,l);if(i.failOnReadError&&l.size!==u.size)throw new Error("Unable to read every indexed receipt blob");return new Map([...p].filter(([,f])=>l.has(f)).map(([f,h])=>[m.get(f),l.get(h)]))}catch(c){if(i.failOnReadError)throw c;return new Map}}export{k as readIndexedReceiptBlobs};
|
|
4
|
-
//# sourceMappingURL=indexed-receipt-blobs-
|
|
4
|
+
//# sourceMappingURL=indexed-receipt-blobs-7XGVHYAO.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as e,b as f,c as g,d as h,e as i,f as j,g as k,h as l,i as m,j as n,k as o,l as p,m as q,n as r,o as s,p as t,q as u,r as v,s as w}from"./chunk-PNPYQDHU.js";import"./chunk-B6U44WPW.js";import"./chunk-CBG67HUP.js";import"./chunk-CO2DNPH7.js";import"./chunk-TFYTTDAK.js";import"./chunk-GHQVM6K6.js";import{u as a,v as b,w as c,x as d}from"./chunk-BAW3DGQO.js";import"./chunk-J3YOATXR.js";import"./chunk-FFO7RBLN.js";import"./chunk-SDLIUZEL.js";import"./chunk-4PW5XWVI.js";import"./chunk-C3O6JJPO.js";import"./chunk-MEJKELWC.js";import"./chunk-G6ERMFJ5.js";export{f as ITEM_REVISION_CONFLICT_CHANGE_LIMIT,e as ITEM_REVISION_CONFLICT_CODE,u as assertExpectHashAdmissible,s as bindExpectedItemRevisions,c as bindItemRevisionScope,a as createItemRevisionScope,k as describeItemRevisionChanges,w as dispatchWithExpectedItemRevisions,p as enrichItemRevisionConflict,o as expectHashInvocationRewrittenError,v as expectHashRequiresMutationError,m as isItemRevisionConflict,l as itemRevisionConflictRowFields,d as itemRevisionScopeReceipt,t as itemRevisionUncheckedWarning,g as normalizeExpectedItemHash,h as parseExpectHashSpecs,i as readItemRevision,j as resolveExpectedItemRevisions,q as runWithBoundItemRevisionScope,b as runWithItemRevisionScope,n as throwFirstItemRevisionConflict,r as withExpectedItemRevisions};
|
|
2
|
+
//# sourceMappingURL=item-revision-L6GVT42D.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{B as ke,C as Me,E as W,H as Re,J as Ie,K as Ce,M as Ne,a as Oe,p as J}from"./chunk-5NGNO54M.js";import"./chunk-J6FDCAMH.js";import"./chunk-FEPE2CE4.js";import{A as Ae,B as L,C as Te,y as k,z as K}from"./chunk-A2246ZM7.js";import"./chunk-PNPYQDHU.js";import"./chunk-Y5GOUUYJ.js";import"./chunk-IDAYTYNN.js";import"./chunk-PMKR4MJI.js";import"./chunk-FXFDVM5O.js";import"./chunk-SVOOGGAK.js";import"./chunk-Q4OIRSKL.js";import{N as we,Q as ge}from"./chunk-W3CSX6GI.js";import"./chunk-CXTDEQ3N.js";import"./chunk-C7UX2ZI3.js";import{Ea as $e}from"./chunk-JQS7TYQ6.js";import"./chunk-J7M52SCZ.js";import"./chunk-B6U44WPW.js";import{w as x}from"./chunk-CBG67HUP.js";import"./chunk-CO2DNPH7.js";import{fa as pe,la as le}from"./chunk-QEVJ3Y67.js";import"./chunk-BHNY3KPJ.js";import"./chunk-TFYTTDAK.js";import"./chunk-GHQVM6K6.js";import{Q as Ee,h as q,t as $}from"./chunk-BAW3DGQO.js";import{$a as Se,I as ve,Xa as _e,fb as be,ha as S,sa as T,wa as G}from"./chunk-J3YOATXR.js";import"./chunk-FFO7RBLN.js";import{c as me,e as F,f as fe,i as he}from"./chunk-SDLIUZEL.js";import"./chunk-4PW5XWVI.js";import"./chunk-I5LGPUWH.js";import"./chunk-C3O6JJPO.js";import{Ga as ue,ra as D,vc as ye,wc as P,ya as de}from"./chunk-MEJKELWC.js";import"./chunk-EGN2HFRU.js";import"./chunk-FOA7XKWP.js";import{A as l,E as j,G as ce,H as O,l as oe,q as E,s as ae,x as se,z as m}from"./chunk-G6ERMFJ5.js";import X from"node:crypto";import{constants as V}from"node:fs";import{cp as nt,lstat as Fe,mkdir as rt,mkdtemp as Pe,open as it,readdir as ot,realpath as xe,rm as Ge,stat as Z,writeFile as qe}from"node:fs/promises";import{tmpdir as Ke}from"node:os";import d from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="01728cbc-2037-50d2-8318-5f106714b8da")}catch{}})();var He=new Set(["id","title","description","type","status","priority","tags","body","deadline","estimated_minutes","acceptance_criteria","definition_of_ready","order","rank","assignee",...oe,"affected_version","fixed_version","component","regression","customer_impact","close_reason","completed_at","dependencies","comments","notes","learnings","files","tests","docs","reminders","events","type_options"]);(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6456f85b-e076-5048-9c21-03d477267259")}catch{}})();function z(e,t,r){let n=e?.estimatedMinutes;if(!(n===void 0||typeof n=="string"))throw new l(`Mutation ${r+1} ${t} option "estimatedMinutes" must be a string.`,m.USAGE,{code:"mutation_option_value_invalid",required:'Pass estimatedMinutes as a string, for example "45", in raw mutation options.',why:"Raw options use the create/update command option types; item documents accept numeric estimated_minutes instead.",nextSteps:["Quote the estimatedMinutes value or use an item document with numeric estimated_minutes, then retry the transaction."]})}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a17df3f5-aee8-5734-b1ce-b643482be3a7")}catch{}})();var Xe=["op","id","reason","options","unique","match"],Ze=[...Xe,"ref"],en=[...Ze,"item"];var je="[a-z][a-z0-9._-]{0,63}",tn=new RegExp(`^${je}$`,"u"),nn=new RegExp(`(^|,)id=@(${je})(?=,|$)`,"gu"),Ue=e=>e.slice(2).replaceAll(/-([a-z])/gu,(t,r)=>r.toUpperCase());var Qe=new Set(["created_at","updated_at","closed_at","version","format_version","path","author","collection_counts","notes_count","tests_count"]),rn=new Set([...Qe,"completed_at","id"]),on={create:we.map(e=>e.target),update:ge.map(e=>e.target),close:pe.map(e=>Ue(e.flag)).filter(e=>e!=="reason"),release:le.map(e=>Ue(e.flag))};function et(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function tt(e,t){return e<t?-1:+(e!==t)}function B(e){return Array.isArray(e)?e.map(B):et(e)?Object.fromEntries(Object.entries(e).sort(([t],[r])=>tt(t,r)).map(([t,r])=>[t,B(r)])):e}function v(e){return typeof e=="string"?e.trim():JSON.stringify(B(e))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="49806fc6-ff49-5b67-9b3f-c182ace00c20")}catch{}})();async function at(e,t){if(!Se(e))return{schema:F(t.schema),typeDefinitionsFromFile:[]};let r=await gt(e,t.schema);return{schema:r.schema,typeDefinitionsFromFile:r.type_definitions_from_file??[]}}async function st(e,t,r,n){let i=D({...t,item_types:{...t.item_types,definitions:[...t.item_types?.definitions??[],...r.typeDefinitionsFromFile]}},P());return(await Ee(e,t.item_format,i.type_to_folder,void 0,r.schema)).flatMap(a=>{let o=a[n];return o==null?[]:[{id:a.id,value:o}]})}function Q(e){let t=new Map,r=async n=>{let i=await be(e),a=await at(e,i),o=new Map;for(let s of await st(e,i,a,n)){let c=v(s.value);o.set(c,[...o.get(c)??[],s.id])}return o};return{lookup(n){let i=t.get(n)??r(n);return t.set(n,i),i},async recordCreate(n){for(let[i,a]of t){let o=n[i];if(o==null)continue;let s=await a,c=v(o);s.set(c,[...s.get(c)??[],String(n.id)])}},invalidate(){t.clear()}}}async function ct(e,t){let r=v(t.value),n=(await e.lookup(t.key)).get(r)??[];if(n.length!==0)throw new l(`Upsert key "${t.key}" value ${JSON.stringify(r)} now matches existing item ${n.join(", ")}; the plan was resolved before it existed.`,m.CONFLICT,{code:"upsert_key_conflict",required:"Re-plan the document so the row updates the existing item instead of creating a duplicate.",why:"Keyed upsert is resolved before the writer lock, so every remaining create is re-checked under the lock; concurrent imports therefore cannot create two items for one key value.",nextSteps:["Re-run pm item mutate with the same document and --upsert-key; the re-plan turns the row into an update of the existing item.","Inspect the existing item first when its content should win over the document row."]})}function dt(e,t,r){let n=e.metadata[r.key],i=v(r.value);if(v(n)!==i)throw new l(`Item ${t} no longer carries upsert key "${r.key}" value ${JSON.stringify(i)}; the plan selected it before the key changed.`,m.CONFLICT,{code:"upsert_match_changed",required:"Re-plan the document so the row is resolved against the current key values.",why:"Keyed upsert selects its target before the writer lock, so the update re-reads the key under the lock instead of updating a mismatched item blindly.",nextSteps:["Re-run pm item mutate with the same document and --upsert-key; the re-plan creates or re-targets the row from the current key values."]})}function De(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;let t=e;return typeof t.key=="string"&&t.key.trim().length>0&&t.value!==void 0&&t.value!==null}function C(e,t){let r={...e,...t};return e===void 0?r:x(e,r)}async function g(e,t){try{let r=(await J(t,{},{pmRoot:e})).item;return{id:r.id,closedAt:r.closed_at,updatedAt:r.updated_at,assignee:r.assignee,claimPrincipal:r.claim_principal}}catch(r){if(r instanceof l&&r.exitCode===m.NOT_FOUND)return;throw r}}function ee(e,t){let r=e.id.replaceAll(/[^a-zA-Z0-9._-]/gu,"_"),n=X.createHash("sha256").update(ue(e)).digest("hex").slice(0,12);return`${t+1}-${e.op}-${r}-${n}`}function ut(e,t){let r=e.id.replaceAll(/[^a-zA-Z0-9._-]/gu,"_");return`${t+1}-${e.op}-${r}`}function h(e,t,r){return`bulk-item-transaction ${e} ${t} ${r}`}async function A(e,t,r,n){let i=await S(d.join(e,"history",`${t}.jsonl`),t),a=h(r,n,"apply"),o=h(r,n,"compensate");for(let s=i.length-1;s>=0;s-=1){let c=i[s].message;if(c===a)return!0;if(c===o)return!1}return!1}async function te(e,t){let r=await g(e,t.id);if(r?.updatedAt===void 0)throw new l(`Bulk ${t.op} target ${t.id} does not exist or has no restorable version`,m.NOT_FOUND);let n=await S(d.join(e,"history",`${r.id}.jsonl`),r.id);if(n.length===0)throw new l(`Bulk ${t.op} target ${t.id} has no restorable history`,m.NOT_FOUND);return{target_updated_at:r.updatedAt,target_version:String(q(n)+n.length),target_history_hash:T(n),target_history_length:n.length}}function b(e,t,r){return new l(`Transaction ${e.transactionId} cannot safely compensate incomplete step ${r}; review item ${t} history before recovery.`,m.CONFLICT,{code:"transaction_partial_mutation",item_id:t,required:"Reconcile the item's partial or intervening changes before resuming this transaction.",why:"The retained history does not prove exclusive ownership of the changes to undo. The journal remains compensating instead of claiming a rollback or overwriting another writer.",nextSteps:[`Run pm history ${t} and inspect this transaction's retained compensation data before explicitly restoring or reconciling the item.`]})}function Le(e,t){let r=`bulk-item-transaction ${t} `;return[e.message,e.context?.item_transaction_step].some(n=>typeof n=="string"&&n.startsWith(r))}function pt(e,t,r){let{expectedHistory:n,length:i,version:a}=t;if(T(e)===n)return!1;if(typeof i!="number"||!Number.isSafeInteger(i)||i<1||T(e.slice(0,i))!==n||a!==String(q(e)+i))throw b(r,r.itemId,r.stepId);let o=h(r.transactionId,r.stepId,"apply"),s=e.slice(i),c=p=>p.message===o||p.context?.item_transaction_step===o,u=h(r.transactionId,r.stepId,"compensate");if(s.filter(p=>c(p)||p.message===u).at(-1)?.message===u)return!1;let f=s.filter(c);if(f.length===0)return!1;let _=e.at(-1).after_hash===f.at(-1).after_hash&&s.every(p=>Le(p,r.transactionId));if(f.length!==s.length&&!_)throw b(r,r.itemId,r.stepId);return!0}async function N(e,t,r,n){let i=n!==null&&typeof n=="object"&&!Array.isArray(n)?n:void 0;if(i===void 0||typeof i.target_updated_at!="string")return;let a=i.target_updated_at,o=await g(e.pmRoot,t);if(o===void 0)return;let s=await S(d.join(e.pmRoot,"history",`${o.id}.jsonl`),o.id),c=i.target_history_hash;if(typeof c=="string"){if(!pt(s,{expectedHistory:c,length:i.target_history_length,version:i.target_version},{...e,itemId:o.id,stepId:r}))return}else{if(o.updatedAt===a)return;if(!await A(e.pmRoot,o.id,e.transactionId,r))throw b(e,o.id,r)}let u=()=>Ce(t,typeof i.target_version=="string"?i.target_version:a,{force:!0,author:e.author,message:h(e.transactionId,r,"compensate")},{pmRoot:e.pmRoot});await $({pmRoot:e.pmRoot,id:o.id,validate:f=>{if(G(f)!==s.at(-1).after_hash)throw b(e,o.id,r)}},u)}function Je(e,t,r){return{id:r,async inspect(){let n=await g(e.pmRoot,t.id);if(n===void 0)return{state:"pending"};if(n.closedAt!==void 0){let i=await S(d.join(e.pmRoot,"history",`${n.id}.jsonl`),n.id),a=`Compensated: interrupted bulk transaction ${e.transactionId}`;if(i.filter(o=>o.op==="close").at(-1)?.patch.some(o=>o.op==="add"||o.op==="replace"?o.path==="/metadata/close_reason"&&o.value===a:!1)??!1)throw new l(`Created item ${n.id} remains closed by transaction compensation; explicitly reopen or reconcile it before retrying.`,m.CONFLICT,{code:"transaction_create_compensated",item_id:n.id,required:"Review the compensated item and explicitly reopen it before retrying the same document.",why:"This item's latest closure belongs to transaction compensation. Automatically reopening it could overwrite later lifecycle decisions.",nextSteps:[`Run pm item reopen ${n.id} "Retry compensated creation" after reviewing its history, then retry the transaction.`]})}return{state:"applied",result:{id:n.id,op:"create"}}},async apply(){t.unique!==void 0&&await ct(e.uniqueIndex,t.unique);let n=await ke(C(t.options,{author:e.author,id:t.id,message:h(e.transactionId,r,"apply")}),{pmRoot:e.pmRoot}),i=n.item;return e.onCreateWarnings?.(String(i.id),n.warnings),await e.uniqueIndex.recordCreate(i),{id:String(i.id),op:"create"}},async compensate(){await lt(e,t.id,r)}}}async function lt(e,t,r){let n=await g(e.pmRoot,t);if(n===void 0||e.createCompensation==="close"&&n.closedAt!==void 0)return;let i=await S(d.join(e.pmRoot,"history",`${n.id}.jsonl`),n.id),a=h(e.transactionId,r,"apply"),o=h(e.transactionId,r,"compensate"),s=i.filter(c=>c.message===a||c.message===o).at(-1);if(s?.message!==o){if(s===void 0||!i.every(c=>Le(c,e.transactionId)))throw b(e,n.id,r);await $({pmRoot:e.pmRoot,id:n.id,validate:c=>{if(G(c)!==i.at(-1).after_hash)throw b(e,n.id,r)}},async()=>{let c={force:!0,author:e.author,message:o};e.createCompensation==="delete"?await Ie(t,c,{pmRoot:e.pmRoot}):await W(t,`Compensated: interrupted bulk transaction ${e.transactionId}`,c,{pmRoot:e.pmRoot})})}}function mt(e,t,r){return{id:r,compensatePending:!0,async inspect(){let n=await g(e.pmRoot,t.id);return n===void 0?{state:"pending"}:await A(e.pmRoot,n.id,e.transactionId,r)?{state:"applied",result:{id:n.id,op:"update"}}:{state:"pending"}},async prepareCompensation(){return te(e.pmRoot,t)},async apply(){let n=()=>Me(t.id,C(t.options,{author:e.author,message:h(e.transactionId,r,"apply")}),{pmRoot:e.pmRoot}),i=t.match,a=i,o=(await $({pmRoot:e.pmRoot,id:String((await J(t.id,{},{pmRoot:e.pmRoot})).item.id),validate:s=>{a!==void 0&&dt(s,t.id,a)},committed:s=>{i!==void 0&&(a={key:i.key,value:structuredClone(s.metadata[i.key])})},historyContext:{item_transaction_step:h(e.transactionId,r,"apply")}},n)).item;return e.uniqueIndex.invalidate(),{id:String(o.id),op:"update"}},async compensate(n){await N(e,t.id,r,n)}}}function ft(e,t,r){return{id:r,async inspect(){let n=await g(e.pmRoot,t.id);return n===void 0?{state:"pending"}:await A(e.pmRoot,n.id,e.transactionId,r)?{state:"applied",result:{id:n.id,op:"close"}}:n.closedAt===void 0?{state:"pending"}:{state:"applied",result:{id:n.id,op:"close"}}},async prepareCompensation(){return te(e.pmRoot,t)},async apply(){let n=(await W(t.id,t.reason,C(t.options,{author:e.author,message:h(e.transactionId,r,"apply")}),{pmRoot:e.pmRoot})).item;return e.uniqueIndex.invalidate(),{id:String(n.id),op:"close"}},async compensate(n){await N(e,t.id,r,n)}}}function ht(e,t,r){return{id:r,async inspect(){let n=await g(e.pmRoot,t.id);return n===void 0?{state:"pending"}:await A(e.pmRoot,n.id,e.transactionId,r)?{state:"applied",result:{id:n.id,op:"release"}}:n.assignee!==void 0||n.claimPrincipal!==void 0?{state:"pending"}:{state:"applied",result:{id:n.id,op:"release"}}},async prepareCompensation(){return te(e.pmRoot,t)},async apply(){let n=(await Re(t.id,C(t.options,{author:e.author,message:h(e.transactionId,r,"apply")}),{pmRoot:e.pmRoot})).item;return e.uniqueIndex.invalidate(),{id:String(n.id),op:"release"}},async compensate(n){await N(e,t.id,r,n)}}}function ne(e,t,r){let n=ee(t,r);switch(t.op){case"create":return Je(e,t,n);case"update":return mt(e,t,n);case"close":return ft(e,t,n);case"release":return ht(e,t,n)}}function yt(e,t){if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(`Bulk mutation ${t+1} must be an object`);if(!["create","update","close","release"].includes(e.op))throw new TypeError(`Bulk mutation ${t+1} op must be create, update, close, or release`);if(typeof e.id!="string"||e.id.trim().length===0)throw new TypeError(`Bulk mutation ${t+1} requires a non-empty id`);if(e.op==="close"&&(typeof e.reason!="string"||e.reason.trim().length===0))throw new TypeError(`Bulk close mutation ${t+1} requires a non-empty reason`);if(e.op==="create"&&e.unique!==void 0&&!De(e.unique))throw new TypeError(`Bulk create mutation ${t+1} unique must be an object with a non-empty key and a value`);if(e.op==="update"&&e.match!==void 0&&!De(e.match))throw new TypeError(`Bulk update mutation ${t+1} match must be an object with a non-empty key and a value`);z(e.options,e.op,t)}function We(e){if(e.length===0)throw new TypeError("Bulk item transaction requires at least one mutation");let t=new Map;for(let[r,n]of e.entries()){if(yt(n,r),n.op!=="create"||n.unique===void 0)continue;let{key:i,value:a}=n.unique,o=t.get(i)??new Map,s=v(a),c=o.get(s);if(c!==void 0)throw new l(`Bulk create mutations ${c+1} and ${r+1} share the upsert key value ${JSON.stringify(s)} for "${i}".`,m.USAGE,{code:"upsert_key_duplicate",required:"Each create must carry a distinct unique key value within one batch.",why:"Direct SDK batches must preserve the same uniqueness invariant as planned document rows."});o.set(s,r),t.set(i,o)}}function ze(e){let t=[...e];return We(t),t.map(r=>{let n=structuredClone(r);return r.options!==void 0&&n.options!==void 0&&x(r.options,n.options),n})}function Be(e,t=""){return e===null||typeof e!="object"?[]:Object.entries(e).flatMap(([r,n])=>{let i=`${t}/${r.replaceAll("~","~0").replaceAll("/","~1")}`;return/^(created_at|updated_at|closed_at|completed_at|timestamp)$/u.test(r)?[i]:Be(n,i)})}async function Y(e,t,r){try{return await r()}catch(n){throw n instanceof l?new l(n.message,n.exitCode,{...n.context,transaction_operation:{index:t,op:e.op,id:e.id}}):n}}function Ve(e,t,r,n){let i=d.relative(e,t),a=i.split(d.sep);return a[0]==="extensions"&&a[2]==="node_modules"&&!n.some(o=>i===o||i.startsWith(`${o}${d.sep}`)||o.startsWith(`${i}${d.sep}`))?!1:["locks","runtime","search"].includes(i.split(d.sep)[0])?n.some(o=>i===o||i.startsWith(`${o}${d.sep}`)||o.startsWith(`${i}${d.sep}`)):i===""||r===void 0||r.some(o=>i===o||i.startsWith(`${o}${d.sep}`)||o.startsWith(`${i}${d.sep}`))}async function R(e,t){let r=await Fe(t);if(r.isSymbolicLink())await Z(t);else if(r.isDirectory()||r.isFile())return r;throw O(d.relative(e,t))}async function wt(e,t){let r=await it(t,V.O_RDONLY|V.O_NOFOLLOW|V.O_NONBLOCK);try{let n=await r.stat();if(!n.isFile())throw O(d.relative(e,t));let i=X.createHash("sha256");if(n.size>0)for await(let a of r.createReadStream({highWaterMark:64*1024,end:n.size-1,autoClose:!1}))i.update(a);return i.digest()}finally{await r.close()}}async function H(e,t,r){let n=X.createHash("sha256");async function i(a){for(let o of(await ot(a)).sort()){let s=d.join(a,o);Ve(e,s,t,r)&&((await R(e,s)).isDirectory()?await i(s):(n.update(JSON.stringify(d.relative(e,s))),n.update(await wt(e,s))))}}return await i(e),n.digest("hex")}function M(){return new l("Tracker changed while preparing the transaction preview; retry against stable state.",m.CONFLICT,{code:"transaction_preview_snapshot_changed"})}async function re(e){if(!j(e))return!1;let t=e.path;if(typeof t!="string")return!1;let r=d.resolve(t),n=r;for(;;)try{let i=await Fe(n);return n!==r&&i.isDirectory()}catch(i){if(!j(i))return!1;let a=d.dirname(n);if(a===n)return!1;n=a}}async function I(e,t){let r=d.join(e,t);try{let n=e;for(let i of t.split(d.sep).slice(0,-1))n=d.join(n,i),await R(e,n);if(!(await R(e,r)).isFile())throw O(t);return await ce(r,O(t))}catch(n){if(await re(n))return;throw n}}async function Ye(e,t,r,n){let i=F(r);for(let[a,o]of Object.entries(i.files)){let s=d.relative(e,fe(e,o,me[a]));if(s===""||!d.resolve(e,s).startsWith(d.join(e,d.sep)))throw new l("Transaction preview requires schema files inside the selected tracker root; relocate the configured schema file before retrying.",m.USAGE,{code:"transaction_preview_external_schema",field:`schema.files.${a}`});i.files[a]=s;let c=await I(e,s);if(n?.set(s,c),c!==void 0){let u=d.join(t,s);await rt(d.dirname(u),{recursive:!0}),await qe(u,c)}}return he(t,i)}async function gt(e,t){await Z(e);let r=await Pe(d.join(Ke(),"pm-schema-plan-"));try{let n=await xe(e);return await Ye(n,d.join(r,"configuration"),t)}catch(n){throw await re(n)?M():n}finally{await Ge(r,{recursive:!0,force:!0})}}async function vt(e,t,r){let n=new Map,i=await I(e,E);n.set(E,i);let a;try{a=JSON.parse(i??"null")}catch{a=null}let o=_e(a),s=o.success?o.data:void 0,c=await Ye(e,t,s?.schema,n),u=c.schema,f=d.relative(e,ve(e));n.set(f,await I(e,f));let _=D({...se,item_types:{definitions:[...s?.item_types?.definitions??[],...c.type_definitions_from_file??[]]}},r),p=de(e)===e?[...ae.filter(Boolean),E,Oe,"transactions",..._.folders,...n.keys()].map(w=>d.normalize(w)):void 0,y=s===void 0?void 0:JSON.stringify({...a,schema:{...s.schema,files:u.files}});return{configuration:n,ownedPaths:p,stagedSettings:y,registryFolders:_.folders}}async function _t(e,t,r){await Z(e);try{let n=await xe(e),i=await vt(n,d.join(d.dirname(t),"configuration"),r),a=[...i.configuration.keys(),...i.registryFolders].map(u=>d.normalize(u)),o=await H(n,i.ownedPaths,a);await nt(n,t,{recursive:!0,dereference:!1,filter:async u=>Ve(n,u,i.ownedPaths,a)?(await R(n,u),!0):!1});let[s,c]=await Promise.all([H(n,i.ownedPaths,a),H(t,i.ownedPaths,a)]);if(o!==s||o!==c)throw M();for(let[u,f]of i.configuration)if(await I(t,u)!==f)throw M();i.stagedSettings!==void 0&&await qe(d.join(t,E),i.stagedSettings)}catch(n){throw await re(n)?M():n}}async function jn(e){let t=k(e),r=ze(e.mutations),n=P(),i=await Pe(d.join(Ke(),"pm-transaction-preview-")),a=d.join(i,"tracker");try{await _t(t.pmRoot,a,n);let o=!1,s=[],c=[],u=new Set;return await Ne({path:a,noExtensions:!0},async()=>{ye(n);let f={...t,pmRoot:a,createCompensation:"close",uniqueIndex:Q(a)},_=r.map((p,y)=>{let w=ne({...f,onCreateWarnings:(U,ie)=>{ie.length>0&&s.push({index:y,id:U,op:"create",warnings:ie})}},p,y);return{...w,inspect:()=>Y(p,y,()=>w.inspect()),prepareCompensation:()=>Y(p,y,async()=>w.prepareCompensation?.()),apply:()=>Y(p,y,async()=>{let U=await w.apply();return u.add(y),U})}});if(await K({...t,pmRoot:a,steps:_,onTransition:({transition:p})=>{p==="committed"&&(o=!0)}}),o)for(let[p,y]of r.entries()){let w=(await $e(y.id,{path:a},{full:!0})).item;c.push({index:p,id:String(w.id),op:y.op,execution:u.has(p)?"applied":"adopted",item:w,commit_time_fields:Be(w)})}}),{records:c,validated:o,state:o?"staged_snapshot":"replayed_committed_plan",warnings:s,unresolved_commit_constraints:["concurrent_tracker_changes","extension_mutation_guards_and_hooks","derived_extension_dependencies_excluded","generated_timestamps_and_provenance"]}}finally{await Ge(i,{recursive:!0,force:!0})}}async function St(e){let t=k(e),r=ze(e.mutations),n=e.createCompensation??"close";if(!["close","delete"].includes(n))throw new TypeError("Bulk item transaction createCompensation must be close or delete");let i={...t,createCompensation:n,uniqueIndex:Q(t.pmRoot)},a=await K({...t,steps:r.map((s,c)=>ne(i,s,c)),recoveryData:JSON.parse(JSON.stringify({kind:"item-mutations-v1",mutations:r,createCompensation:n})),...e.lockTtlSeconds===void 0?{}:{lockTtlSeconds:e.lockTtlSeconds},...e.lockWaitMs===void 0?{}:{lockWaitMs:e.lockWaitMs},...e.onTransition===void 0?{}:{onTransition:e.onTransition}}),o={};for(let[s,c]of r.entries()){let u=ee(c,s),f=a.results[u];o[ut(c,s)]=f}return{transactionId:a.transactionId,status:"committed",recovered:a.recovered,results:o}}function bt(e){let t=[];return e.evidence!==void 0&&Object.keys(e.evidence).length>0&&t.push({op:"update",id:e.id,options:e.evidence}),t.push({op:"close",id:e.id,reason:e.reason,...e.closeOptions===void 0?{}:{options:e.closeOptions}},{op:"release",id:e.id,...e.releaseOptions===void 0?{}:{options:e.releaseOptions}}),t}function Dn(e){return St({pmRoot:e.pmRoot,transactionId:e.transactionId,author:e.author,mutations:bt(e),...e.lockTtlSeconds===void 0?{}:{lockTtlSeconds:e.lockTtlSeconds},...e.lockWaitMs===void 0?{}:{lockWaitMs:e.lockWaitMs},...e.onTransition===void 0?{}:{onTransition:e.onTransition}})}var Fn={buildCreateStep:Je,bulkHistoryMarker:h,compensateByRestore:N,deriveStepId:ee,isUpdateMarkerApplied:A,readItemSnapshot:g};async function Pn(e,t){let r=await Ae(e,t);return r===void 0?void 0:{journal:r,planDigest:L(r)}}function Et(e,t){let r=t.recoveryData;if(r===null||typeof r!="object"||Array.isArray(r)||r.kind!=="item-mutations-v1"||!Array.isArray(r.mutations)||!["close","delete"].includes(String(r.createCompensation)))throw new l("Transaction has no supported item recovery plan",m.CONFLICT,{code:"transaction_recovery_plan_missing",required:"Resume with the original plan and its original adapter.",why:"Legacy or foreign journals cannot safely reconstruct item compensation."});let n=r.mutations;We(n);let i={...e,createCompensation:r.createCompensation,uniqueIndex:Q(e.pmRoot)};return n.map((a,o)=>ne(i,a,o))}async function xn(e){let t=k(e),r=await Te({...e,...t,resolveSteps:n=>Et({...e,...t},n)});return{journal:r,planDigest:L(r)}}export{Fn as _testOnlyItemTransaction,xn as abandonItemTransaction,bt as buildItemCompletionMutations,Dn as commitItemCompletion,St as commitItemMutations,st as listUpsertKeyCandidates,gt as loadGuardedRuntimeSchema,jn as previewItemMutations,Pn as readItemTransaction,at as resolveTransactionSchema};
|
|
2
|
+
//# sourceMappingURL=item-transaction-GYGP264N.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{g as E,l as N}from"./chunk-PMKR4MJI.js";import"./chunk-Q4OIRSKL.js";import{N as y,Q as C}from"./chunk-W3CSX6GI.js";import"./chunk-CBG67HUP.js";import"./chunk-CO2DNPH7.js";import{Ca as h,Ia as w}from"./chunk-QEVJ3Y67.js";import"./chunk-BAW3DGQO.js";import{fb as A,k as R}from"./chunk-J3YOATXR.js";import"./chunk-FFO7RBLN.js";import{l as T,m as O}from"./chunk-SDLIUZEL.js";import"./chunk-4PW5XWVI.js";import"./chunk-I5LGPUWH.js";import"./chunk-C3O6JJPO.js";import{a as g,xa as _}from"./chunk-MEJKELWC.js";import{A as f}from"./chunk-G6ERMFJ5.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="d19ff816-7570-5e8a-a4de-ad2ca48f0df0")}catch{}})();function b(t,o,r,a=!1){let d=[...r].map(n=>({candidate:n,distance:g(o,n,3)})).filter(n=>n.distance!==null).sort((n,i)=>n.distance-i.distance||n.candidate.localeCompare(i.candidate))[0]?.candidate,s=a?`Put mutation fields under options (options.${o}).`:d?`Did you mean "${d}"?`:"Use the declared command options or the field option for registered item fields.";throw new f(`Unknown ${t} ${a?"argument":"option"} "${o}". ${s} No changes were made.`,2,{code:"invalid_argument_value",reason:"unknown_mutation_option",changed:!1,field:o,required:s,nextSteps:[s]})}async function j(t,o,r,a,d){if(E(o))return;let s=t==="create"?y:C,n=(t==="create"?h:w).map(({flag:e})=>e.slice(2).replace(/-([a-z])/gu,(m,v)=>v.toUpperCase())),i=new Set([...s.flatMap(e=>[e.target,...e.keys]),...n]),l=["outputInclude","outputLimit","outputBudget","outputFormat","outputSession","outputCursor"];for(let e of["author","message","force","fullChangedFields","idOnly",...l])i.add(e);let S=new Set(["action","options","path","cwd","author","force","noExtensions","no_extensions","fullChangedFields","idOnly",...l,...d,...t==="update"?["id"]:[]]);for(let e of Object.keys(o))S.has(e)||b(t,e,i,i.has(e));let u=o.options;if(u!==void 0&&!N(u))throw new f("Mutation options must be an object. No changes were made.",2,{code:"invalid_argument_value",changed:!1});let c=[...new Set([...Object.keys(u??{}),...Object.keys(r)])].filter(e=>!i.has(e));if(c.length===0)return;let p=T((await A(_(process.cwd(),a))).schema).command_to_fields.get(t)??[];for(let e of p)i.add(O(e));for(let e of c)p.some(m=>R({[e]:!0},m)===!0)||b(t,e,i)}export{j as assertNativeMutationOptions};
|
|
2
|
+
//# sourceMappingURL=mutation-admission-UWTH56OD.js.map
|
package/dist/cli-bundle/focused-chunks/{settlement-hook-KMIBD4F2.js → settlement-hook-H56537UV.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{b as d}from"./chunk-EGN2HFRU.js";import{b as l}from"./chunk-FOA7XKWP.js";import{A as m,E as c,I as p,z as s}from"./chunk-
|
|
1
|
+
import{b as d}from"./chunk-EGN2HFRU.js";import{b as l}from"./chunk-FOA7XKWP.js";import{A as m,E as c,I as p,z as s}from"./chunk-G6ERMFJ5.js";import{execFile as f}from"node:child_process";import{chmod as h,lstat as u}from"node:fs/promises";import{promisify as w}from"node:util";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="5b6eab08-f707-586f-bb05-484bd9160551")}catch{}})();var y=w(f),g=`#!/bin/sh
|
|
2
2
|
# pm-cli:lossless-merge-settlement:v1
|
|
3
3
|
`;async function I(e,t){let r=(await y("git",["rev-parse","--path-format=absolute","--git-path","hooks/pre-commit"],{cwd:e,env:l(),timeout:1e4})).stdout.trim(),o,i=!1;try{o=await d(r,65536)??"",i=process.platform==="win32"||((await u(r)).mode&73)!==0}catch(a){if(!c(a))throw a}if(o!==void 0&&!o.startsWith(g))throw new m("The pre-commit hook already exists and is not owned by pm; it was preserved.",s.CONFLICT,{code:"merge_settlement_hook_conflict",recovery:{suggested_retry:"pm merge install --dry-run"},nextSteps:["Integrate pm merge reconcile --stage into your existing hook after reviewing its policy, or keep manual settlement. pm never replaces an existing unowned hook."]});let n=`${g}merge_head=$(git rev-parse --git-path MERGE_HEAD) || exit 1
|
|
4
4
|
[ -f "$merge_head" ] || exit 0
|
|
5
5
|
exec ${t} merge reconcile --stage
|
|
6
6
|
`;return{path:r,changed:o!==n||!i,content:n}}async function H(e){e.changed&&(await p(e.path,e.content),await h(e.path,493))}export{I as prepareMergeSettlementHook,H as writeMergeSettlementHook};
|
|
7
|
-
//# sourceMappingURL=settlement-hook-
|
|
7
|
+
//# sourceMappingURL=settlement-hook-H56537UV.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as w,j as y}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=stage-
|
|
1
|
+
import{c as w,j as y}from"./chunk-Y5GOUUYJ.js";import{b as g}from"./chunk-IDAYTYNN.js";import"./chunk-GHQVM6K6.js";import"./chunk-J3YOATXR.js";import"./chunk-SDLIUZEL.js";import"./chunk-4PW5XWVI.js";import{xa as h}from"./chunk-MEJKELWC.js";import{b as u}from"./chunk-FOA7XKWP.js";import{A as f,z as d}from"./chunk-G6ERMFJ5.js";import{execFile as _}from"node:child_process";import{realpath as b}from"node:fs/promises";import l from"node:path";import{promisify as x}from"node:util";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="7f4b2fc8-c9c6-51ff-a345-b76b8abdacf4")}catch{}})();var R=x(_);function c(e){return new f(`Automatic merge settlement refused: ${e}`,d.CONFLICT,{code:"merge_settlement_review_required",recovery:{suggested_retry:"pm merge reconcile --dry-run"},nextSteps:["Inspect receipts, repair streams and Git changes. Resolve competing values or unrelated drift explicitly, then run pm merge reconcile and stage the reviewed artifacts manually."]})}async function $(e){let t=process.env.GIT_INDEX_FILE;if(t===void 0)return;let a=(await e(["rev-parse","--path-format=absolute","--git-path","index"])).stdout.trim();if(l.resolve(t)!==l.resolve(a))throw c("an alternate Git index requires explicit manual settlement")}async function I(e,t){if(t.length===0)return[];let a=t.map(s=>`:(literal)${s}`),o=new Set((await e(["ls-files","--cached","-z","--",...a])).stdout.split("\0")),i=t.filter(s=>!o.has(s)).map(s=>`:(literal)${s}`);if(i.length>0&&(await e(["diff","--cached","--name-only","--diff-filter=D","-z","--",...i])).stdout.length>0)throw c("a receipt has a staged deletion that requires explicit review");return i}async function G(e){let{git:t,preview:a,paths:o,newReceiptPathspecs:i}=e,s=!1;try{i.length>0&&(s=!0,await t(["add","--",...i]));let n=await e.apply();if(!n.ok||JSON.stringify(n.receipts.summaries)!==JSON.stringify(a.receipts.summaries)||n.repair.streams.some(p=>!a.repair.streams.some(m=>m.id===p.id)))throw c("reconciliation changed or did not finish; inspect the audit artifacts before staging");return o.length>0&&await t(["add","--",...o.map(p=>`:(literal)${p}`)]),{...n,staged_paths:o,guidance:["Lossless reconciliation artifacts are staged for the merge commit. Review git diff --cached before committing."]}}catch(n){throw s&&await t(["reset","--quiet","--",...i]),n}}function k(e){if(e.repair.totals.failed>0||e.receipts.missing_history_references_after>0||e.receipts.summaries.some(t=>t.conflict_fields.length>0)||e.repair.streams.some(t=>t.merge_receipt_proof?.trusted!==!0)||e.validation.checks.some(t=>t.name!=="history_drift"&&t.status!=="ok"))throw c("only fully authenticated receipt-backed repairs without discarded values can be staged")}async function S(e){try{return{...e,path:await b(h(process.cwd(),e.path))}}catch{throw c("the tracker root cannot be resolved")}}async function F(e){let{preview:t}=e;k(t);let{path:a}=await S(e.global),o=await w(a);if(o===null)throw c("a Git workspace is required");let i=r=>R("git",r,{cwd:o,env:u(),timeout:1e4});if(await $(i),(await i(["ls-files","--unmerged","-z"])).stdout.length>0)throw c("Git still has unresolved paths");let s=[...new Set([...[...new Set([...t.repair.streams.map(r=>r.id),...t.receipts.summaries.map(r=>r.item_id)])].map(r=>l.join(a,"history",`${r}.jsonl`)),...t.receipts.summaries.map(r=>l.join(a,"merge-receipts",`${r.receipt_id}.json`))])].map(r=>l.relative(o,r).replaceAll("\\","/"));if(s.some(g))throw c("reconciliation artifacts must belong to this Git workspace");let n=await y(o,s);if(n.length>0)throw new f(`Automatic merge settlement refused: required artifacts are ignored by Git: ${n.map(r=>`${r.path} (${r.source}:${r.line}: ${r.pattern})`).join(", ")}. Remove or narrow the owning ignore rules because merge receipts must travel with the commit.`,d.CONFLICT,{code:"merge_settlement_review_required",reason:"ignored_merge_artifacts",paths:n.map(r=>r.path),nextSteps:["Remove or narrow the named ignore rules, preserve receipt and history files, then retry pm merge reconcile --stage --dry-run before applying pm merge reconcile --stage. Do not force-add ignored proof as a substitute for fixing the shared policy."]});let p=s.map(r=>`:(literal)${r}`),m=t.receipts.summaries.map(r=>l.relative(o,l.join(a,"merge-receipts",`${r.receipt_id}.json`)).replaceAll("\\","/"));if(p.length>0)try{await i(["diff","--quiet","--",...p])}catch{throw c("reconciliation paths have unstaged edits or Git cannot verify their index state")}let v=await I(i,m);return e.dryRun?{...t,staged_paths:[]}:G({...e,git:i,paths:s,newReceiptPathspecs:v})}export{S as resolveMergeSettlementGlobal,F as stageLosslessMergeReconciliation};
|
|
2
|
+
//# sourceMappingURL=stage-WRSNJ7VI.js.map
|