@unbrained/pm-cli 2026.10.28 → 2026.10.30
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 +18 -0
- package/dist/cli/commands/lifecycle/append.d.ts +4 -0
- package/dist/cli/commands/lifecycle/append.js +1 -1
- package/dist/cli/commands/lifecycle/create.d.ts +4 -0
- package/dist/cli/commands/lifecycle/create.js +1 -1
- package/dist/cli/commands/lifecycle/plan.d.ts +3 -0
- package/dist/cli/commands/lifecycle/plan.js +1 -1
- package/dist/cli/commands/lifecycle/update-many.d.ts +4 -0
- package/dist/cli/commands/lifecycle/update-many.js +1 -1
- package/dist/cli/commands/lifecycle/update.d.ts +4 -0
- package/dist/cli/commands/lifecycle/update.js +1 -1
- package/dist/cli/help-content.js +2 -2
- package/dist/cli/register-list-query.js +3 -3
- package/dist/cli-bundle/bundle-manifest.json +1 -1
- package/dist/cli-bundle/chunks/{chunk-XHONSCLJ.js → chunk-34MP7WKK.js} +3 -3
- package/dist/cli-bundle/chunks/chunk-42BHHNTL.js +128 -0
- package/dist/cli-bundle/chunks/{chunk-D6P6IBPN.js → chunk-4BQD5SW2.js} +46 -46
- package/dist/cli-bundle/chunks/{chunk-YYD5MNAV.js → chunk-EHBGHX55.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-DM3PICGU.js → chunk-GRABKNFL.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-I5O3XZOA.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-CXUQEZDX.js → chunk-LEIVUGDH.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-MVL27TAH.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-7V37RC2L.js → chunk-OH7WPD42.js} +35 -35
- package/dist/cli-bundle/chunks/chunk-OOD2A7AF.js +20 -0
- package/dist/cli-bundle/chunks/chunk-Q5V7P6NM.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-2J7I54MQ.js → chunk-QLPFYBXN.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-S2U7ECUJ.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-E5QBZ4HI.js → chunk-SA5NYLPE.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-YUBUNECD.js → chunk-UUQX3PFD.js} +57 -57
- package/dist/cli-bundle/chunks/chunk-VHLAVTJN.js +31 -0
- package/dist/cli-bundle/chunks/{chunk-DKLEDWVW.js → chunk-XAOVJG52.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-XPQ4RTSF.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-D3AIQZXF.js → chunk-Y6NC3X3E.js} +2 -2
- package/dist/cli-bundle/chunks/item-transaction-WIOBZW4E.js +2 -0
- package/dist/cli-bundle/chunks/{mutation-admission-GKDKHRTZ.js → mutation-admission-TRGAVS7N.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-MHJJUM6M.js → register-list-query-BH4F6M7Z.js} +6 -6
- package/dist/cli-bundle/chunks/register-mutation-5V2NANIS.js +20 -0
- package/dist/cli-bundle/chunks/register-operations-XSFRMUFX.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-WUZ2ZSMY.js → register-setup-QPWSVHFZ.js} +2 -2
- package/dist/cli-bundle/chunks/{stage-2FYJGGG3.js → stage-RTB6RAAO.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-2V6NMNYN.js +26 -0
- package/dist/cli-bundle/focused-chunks/{chunk-ML5JIUM6.js → chunk-3SRX77ES.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-YLVHHWHN.js → chunk-4PW5XWVI.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-Z26ZPQH6.js → chunk-ASHGXMX4.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{chunk-JTCGDODH.js → chunk-BCIUAEWX.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-7SZPZOIC.js → chunk-BPE6JTKL.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-LPWZERVD.js → chunk-CKBN2D42.js} +3 -3
- package/dist/cli-bundle/focused-chunks/chunk-FRFNGMAK.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-I642DXOT.js +22 -0
- package/dist/cli-bundle/focused-chunks/chunk-K7DKG5HM.js +91 -0
- package/dist/cli-bundle/focused-chunks/chunk-NMQBXU7N.js +44 -0
- package/dist/cli-bundle/focused-chunks/{chunk-6VDRAJYX.js → chunk-PGM3ENGZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-DRN4W3YJ.js → chunk-POJPJX64.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-B4ZQJEMT.js → chunk-QFNV4JTA.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-QUPGBO2L.js → chunk-QVJCQMZY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-R2TPPPVU.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-TUN4M757.js → chunk-RGQEJFXO.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ON5WFDCG.js → chunk-RKPUQDWF.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-RYEZSZJ7.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-4GN2ZPT5.js → chunk-S23ZUASN.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-R3EA3SDW.js → chunk-SAT7IAEB.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{chunk-I4X6AKOO.js → chunk-VFWCSQAG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-VJVJ2ZX2.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-C2GLO7HU.js → chunk-YQUZL2CK.js} +54 -54
- package/dist/cli-bundle/focused-chunks/{chunk-IQKLJFJE.js → chunk-YU7QOYYV.js} +18 -18
- package/dist/cli-bundle/focused-chunks/{indexed-receipt-blobs-5H6RMRTK.js → indexed-receipt-blobs-VK2363JB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/item-transaction-ZFDKJIP7.js +2 -0
- package/dist/cli-bundle/focused-chunks/{mutation-admission-TM3SVU2O.js → mutation-admission-7VUODEPJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{settlement-hook-LBVWWSCF.js → settlement-hook-OK6A7PG2.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{stage-7ZBRX2Q2.js → stage-S5RP5SZH.js} +2 -2
- package/dist/cli-bundle/main.js +3 -3
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +2 -2
- package/dist/cli-bundle/sdk-core.js +1 -43
- 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 +9 -9
- package/dist/core/history/operation-contract.d.ts +2 -2
- package/dist/core/history/operation-contract.js +1 -1
- package/dist/core/item/literal-mutation-input.d.ts +12 -0
- package/dist/core/item/literal-mutation-input.js +2 -0
- package/dist/core/item/parse.d.ts +2 -0
- package/dist/core/item/parse.js +2 -2
- package/dist/core/output/output.js +2 -2
- package/dist/core/store/item-store.js +1 -1
- package/dist/sdk/cli-contracts/flag-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/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/item-transaction.d.ts +33 -2
- package/dist/sdk/item-transaction.js +1 -1
- package/dist/sdk/lifecycle/append.js +1 -1
- package/dist/sdk/lifecycle/cli-input.d.ts +4 -0
- package/dist/sdk/lifecycle/cli-input.js +2 -0
- package/dist/sdk/lifecycle/create.js +1 -1
- package/dist/sdk/lifecycle/legacy-none-tokens.js +1 -1
- package/dist/sdk/lifecycle/reopen.js +1 -1
- package/dist/sdk/lifecycle/update-many.js +1 -1
- package/dist/sdk/lifecycle/update.js +2 -2
- package/dist/sdk/output/table-rows.d.ts +9 -1
- package/dist/sdk/output/table-rows.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query/history.d.ts +2 -0
- package/dist/sdk/query/history.js +1 -1
- package/dist/sdk/runtime/mutation-value-validation.d.ts +16 -0
- package/dist/sdk/runtime/mutation-value-validation.js +2 -0
- package/dist/sdk/runtime-input.js +1 -1
- package/dist/sdk/runtime-primitives.d.ts +1 -0
- package/dist/sdk/runtime-primitives.js +1 -1
- package/dist/sdk/runtime.d.ts +14 -0
- package/dist/sdk/runtime.js +1 -1
- package/dist/sdk/structured-mutations.js +1 -1
- package/dist/sdk/workspace-transaction-gc.js +1 -1
- package/dist/sdk/workspace-transaction.d.ts +54 -0
- package/dist/sdk/workspace-transaction.js +2 -2
- package/docs/COMMANDS.md +15 -10
- package/docs/OUTPUT_PROJECTION_CONTRACTS.md +24 -2
- package/docs/SDK.md +134 -9
- package/docs/TESTING.md +8 -0
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +1 -1
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +6 -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-4D25HF3V.js +0 -2
- package/dist/cli-bundle/chunks/chunk-AHVN4GHF.js +0 -31
- package/dist/cli-bundle/chunks/chunk-CS7QDSUX.js +0 -128
- package/dist/cli-bundle/chunks/chunk-JESLOJD7.js +0 -2
- package/dist/cli-bundle/chunks/chunk-PQLRKFPZ.js +0 -20
- package/dist/cli-bundle/chunks/chunk-SGFQQXFD.js +0 -2
- package/dist/cli-bundle/chunks/chunk-ZX3XMTZG.js +0 -2
- package/dist/cli-bundle/chunks/register-mutation-SN425O3R.js +0 -20
- package/dist/cli-bundle/chunks/register-operations-EYUIUGPW.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-3EHVI673.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-46WLWK73.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-6L4KKRK7.js +0 -26
- package/dist/cli-bundle/focused-chunks/chunk-BZSACRVX.js +0 -91
- package/dist/cli-bundle/focused-chunks/chunk-F6UQJJYB.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-L5GX2FGZ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-OASYSUOH.js +0 -22
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},f=new e.Error().stack;f&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[f]="841f6791-c2b4-51ea-8047-d27f51ffafb5")}catch{}})();
|
|
2
|
-
//# sourceMappingURL=chunk-SGFQQXFD.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as _e}from"./chunk-3KMYHYJV.js";import{$b as Le,Tb as Ge,Ub as qe,Wb as H,Zb as Ke,_a as Y,a as ve,ac as Je,wc as We}from"./chunk-YUBUNECD.js";import{ac as xe}from"./chunk-AHVN4GHF.js";import{b as Ce,c as B}from"./chunk-D6P6IBPN.js";import{Me as Fe,N as $e,Pe,_a as Ue,a as z,eb as Ne,g as ke,i as $,oc as De,qc as je,r as V}from"./chunk-CS7QDSUX.js";import{Bi as k,Db as we,Nc as ge,Oc as J,Pa as ye,Tg as Ae,Zh as O,ci as Me,hg as Ee,jg as W,kg as Se,ng as be,pa as L,qg as Te,rg as S,ri as Re,sh as M,tg as Ie,vi as Oe,ya as he}from"./chunk-7V37RC2L.js";import{A as u,C as d,G as K,I as fe,J as A,l as pe,q as I,t as le,y as me}from"./chunk-RZQNFHXO.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="4175f7f5-a689-5d05-982a-f92e21bc83e7")}catch{}})();import tt from"node:crypto";(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 b=new Set(["id","title","description","type","status","priority","tags","body","deadline","estimated_minutes","acceptance_criteria","definition_of_ready","order","rank","assignee",...pe,"affected_version","fixed_version","component","regression","customer_impact","close_reason","completed_at","dependencies","comments","notes","learnings","files","tests","docs","reminders","events","type_options"]);function C(e){if(e===void 0)return;let t=e.replace(/[A-Z]/gu,n=>`_${n.toLowerCase()}`);return b.has(t)?t: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]="6456f85b-e076-5048-9c21-03d477267259")}catch{}})();function U(e,t,n){let r=e?.estimatedMinutes;if(!(r===void 0||typeof r=="string"))throw new d(`Mutation ${n+1} ${t} option "estimatedMinutes" must be a string.`,u.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]="7b430d12-7a5b-52c2-9a6b-e4c33a39da76")}catch{}})();var X=["op","id","reason","options","unique","match"],Mt=[...X,"ref"],ze=[...Mt,"item"],Rt="mutate-",Ve="row-",Be=["schema_version","mutations"],nt="[a-z][a-z0-9._-]{0,63}",Ye=new RegExp(`^${nt}$`,"u"),rt=new RegExp(`(^|,)id=@(${nt})(?=,|$)`,"gu"),He=e=>e.slice(2).replaceAll(/-([a-z])/gu,(t,n)=>n.toUpperCase()),N=["item","linked","schedule","claim_state","children","omission_receipt","row_contract","context_intent"],it=new Set(["created_at","updated_at","closed_at","version","format_version","path","author","collection_counts","notes_count","tests_count"]),Ot=new Set([...it,"completed_at","id"]),ot={create:Fe.map(e=>e.target),update:Pe.map(e=>e.target),close:Ue.map(e=>He(e.flag)).filter(e=>e!=="reason"),release:Ne.map(e=>He(e.flag))};function at(e){let t=tt.createHash("sha256").update(e).digest("hex");return`${Rt}${t.slice(0,24)}`}function Ar(e){let t={},n=e.createCompensation;if(n!==void 0){if(n!=="close"&&n!=="delete")throw new d("createCompensation must be close or delete.",u.USAGE);t.createCompensation=n}for(let r of["lockTtlSeconds","lockWaitMs"]){let i=e[r];if(i===void 0)continue;let o=typeof i=="number"||typeof i=="string"&&i.trim().length>0?Number(i):Number.NaN;if(!Number.isSafeInteger(o)||o<=0)throw new d(`${r} must be a positive safe integer.`,u.USAGE);t[r]=o}return t}function h(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function D(e,t){let n=Math.max(1,Math.min(3,Math.floor(e.length/4)+1)),r;for(let i of t){let o=we(e,i,n);o!==null&&(r===void 0||o<r.distance)&&(r={key:i,distance:o})}return r?.key}function T(e,t,n){let r=D(t,n);return new d(r===void 0?`${e} does not recognize key "${t}". Allowed keys: ${n.join(", ")}.`:`${e} does not recognize key "${t}". Did you mean "${r}"?`,u.USAGE,{code:"stdin_json_unknown_key",required:`Use documented ${e} keys only.`,why:"Strict structured input prevents silent typos from creating incomplete or unintended mutations.",nextSteps:[r===void 0?`Remove or correct "${t}".`:`Replace "${t}" with "${r}".`]})}function ee(e,t){try{return JSON.parse(e)}catch(n){let r=n instanceof Error?n.message:String(n);throw new d(`${t} must be valid JSON: ${r}`,u.USAGE,{code:"stdin_json_invalid",required:`Pipe one valid JSON ${t.toLowerCase()} into stdin.`,why:"Structured mutation input must parse deterministically before any tracker write begins."})}}function kt(e,t){if(!h(e))throw new d(`Mutation ${t+1} must be an object.`,u.USAGE);for(let n of Object.keys(e))if(!X.includes(n))throw T(`mutation ${t+1}`,n,X);return e}function $t(e,t,n,r){if(e===void 0)return;if(!h(e))throw new d(`Mutation ${n+1} options must be an object.`,u.USAGE);let i=[...ot[t],...dt(t,r)];for(let o of Object.keys(e))if(!i.includes(o))throw T(`mutation ${n+1} ${t} options`,o,i);return U(e,t,n),e}function Xe(e,t,n,r){if(e===void 0)return;let i=r==="unique"?"create":"update";if(t!==i)throw new d(`Mutation ${n+1} ${r} is only valid for ${i} operations.`,u.USAGE);let o=h(e)&&typeof e.key=="string"?e.key.trim():"";if(!h(e)||o.length===0||e.value===void 0||e.value===null)throw new d(`Mutation ${n+1} ${r} must be an object with a non-empty key and a value.`,u.USAGE);return{key:o,value:e.value}}function Ct(e,t,n){let r=kt(e,t),{op:i,id:o,reason:a}=r;if(i!=="create"&&i!=="update"&&i!=="close"&&i!=="release")throw new d(`Mutation ${t+1} op must be create, update, close, or release.`,u.USAGE);let s=$t(r.options,i,t,n),c=Xe(r.unique,i,t,"unique"),l=Xe(r.match,i,t,"match");if(typeof o!="string"||o.trim().length===0)throw new d(`Mutation ${t+1} requires a non-empty id.`,u.USAGE);let p=o.trim();if(i==="close"){if(typeof a!="string"||a.trim().length===0)throw new d(`Mutation ${t+1} close requires a non-empty reason.`,u.USAGE);return{op:i,id:p,reason:a.trim(),...s===void 0?{}:{options:s}}}if(i==="release")return{op:i,id:p,...s===void 0?{}:{options:s}};if(!h(s))throw new d(`Mutation ${t+1} ${i} requires an options object.`,u.USAGE);return{op:i,id:p,options:s,...c===void 0?{}:{unique:c},...l===void 0?{}:{match:l}}}function st(e,t={}){let n=ee(e,"Mutation batch"),r=Array.isArray(n)?n:h(n)&&Array.isArray(n.mutations)?n.mutations:void 0;if(r===void 0||r.length===0)throw new d("Mutation batch must be a non-empty JSON array or an object with a non-empty mutations array.",u.USAGE);let i=t.runtimeFields??[];return r.map((o,a)=>{let s=Ct(o,a,i);return s.options!==void 0&&De(s.options),s})}function Ut(e,t,n){let r=tt.createHash("sha256").update(e).update("\0").update(t).digest("hex"),i=BigInt(`0x${r.slice(0,16)}`).toString(36).padStart(13,"0").slice(-12);return`${ke(n)}${i}`}function Ze(e,t){if(typeof e!="string"||!e.startsWith("@"))return e;let n=e.slice(1),r=t[n];if(r===void 0)throw new d(`Unknown mutation reference "${e}".`,u.USAGE);return r}function Qe(e,t){if(typeof e!="string")return e;let n=e.replace(rt,(r,i,o)=>{let a=t[o];if(a===void 0)throw new d(`Unknown mutation reference "@${o}".`,u.USAGE);return`${i}id=${a}`});if(/(^|,)id=@/u.test(n))throw new d(`Malformed mutation reference in dependency "${e}".`,u.USAGE);return n}function Nt(e){return typeof e!="string"?[]:e.startsWith("@")?[e.slice(1)]:[...e.matchAll(rt)].map(t=>t[1]).filter(t=>t!==void 0)}function Dt(e,t){let n=new Map;for(let[a,s]of e.entries()){let c=t[a];if(c===void 0)continue;let l=h(s.options)?s.options:{},p=Array.isArray(l.dep)?l.dep:l.dep===void 0?[]:[l.dep];n.set(c,[l.parent,l.blockedBy,...p].flatMap(Nt))}let r=new Set,i=new Set,o=a=>{if(r.has(a))throw new d(`Mutation reference cycle includes "@${a}".`,u.USAGE);if(!i.has(a)){r.add(a);for(let s of n.get(a))n.has(s)&&o(s);r.delete(a),i.add(a)}};for(let a of n.keys())o(a)}function jt(e){let t=e.split(/\r?\n/u).map((o,a)=>({line:o.trim(),number:a+1})).filter(o=>o.line.length>0);if(t.length<2)return null;let n=t.map(o=>{try{return{...o,ok:!0,value:JSON.parse(o.line)}}catch(a){return{...o,ok:!1,error:a}}}),r=n[0];if(!r.ok&&(r.line.startsWith("[")||r.line==="{"||n.at(-1).line==="}")||!n.some(o=>o.ok&&h(o.value)))return null;let i=[];for(let o of n){if(!o.ok)throw new d(`Mutation document line ${o.number} must be one valid JSON object: ${_e(o.error)}`,u.USAGE,{code:"stdin_json_invalid",required:"Provide one JSON object per line (JSON Lines), a JSON array, or a {schema_version, mutations} document.",why:"Structured mutation input must parse deterministically before any tracker write begins."});if(!h(o.value))throw new d(`Mutation document line ${o.number} must be a JSON object.`,u.USAGE);i.push(o.value)}return i}function Ft(e){return Object.hasOwn(e,"mutations")||Object.hasOwn(e,"schema_version")}function Pt(e){let t;try{t=ee(e,"Mutation document")}catch(n){let r=jt(e);if(r===null)throw n;return{schema_version:1,mutations:r}}return Array.isArray(t)?{schema_version:1,mutations:t}:h(t)&&!Ft(t)?{schema_version:1,mutations:[t]}:t}function xt(e,t){let n=Object.hasOwn(e,"op")?Gt(e,t):qt(e,t);if(n.op==="create"&&n.id===void 0&&h(n.item)&&n.item.id!==void 0){if(typeof n.item.id!="string")throw new d(`Mutation ${t+1} item id must be a string.`,u.USAGE);n.id=n.item.id}return n}function Gt(e,t){for(let n of Object.keys(e))if(!ze.includes(n))throw T(`mutation ${t+1}`,n,ze);if(e.item!==void 0&&e.op!=="create")throw new d(`Mutation ${t+1} item documents are only valid for create operations.`,u.USAGE);if(e.item!==void 0&&e.options!==void 0)throw new d(`Mutation ${t+1} must declare either item or options, not both.`,u.USAGE);return{...e}}function qt(e,t){let{ref:n,id:r,item:i,...o}=e,a=i!==void 0?i:o;if(i!==void 0&&Object.keys(o).length>0)throw new d(`Mutation ${t+1} must not mix item document keys with top-level fields.`,u.USAGE);if(!h(a))throw new d(`Mutation ${t+1} item document must be an object.`,u.USAGE);return{op:"create",...n===void 0?{}:{ref:n},...r===void 0?{}:{id:r},item:a}}function Kt(e){let t=Pt(e);if(!h(t))throw new d("Mutation document must be a JSON array or object.",u.USAGE);for(let n of Object.keys(t))if(!Be.includes(n))throw T("mutation document",n,Be);if(t.schema_version!==void 0&&t.schema_version!==1)throw new d("Mutation document schema_version must be 1.",u.USAGE);if(!Array.isArray(t.mutations)||t.mutations.length===0)throw new d("Mutation document requires a non-empty mutations array.",u.USAGE);return t.mutations.map((n,r)=>{if(!h(n))throw new d(`Mutation ${r+1} must be an object.`,u.USAGE);return xt(n,r)})}function Lt(e,t,n){let r=new Set(Object.values(pt(t,n,Object.create(null))));for(let i of t)i.op==="create"&&typeof i.id=="string"&&i.id.trim().length>0&&r.add($(i.id,n.idPrefix));return{...e,existing:e.existing.filter(i=>!r.has(i.id))}}function Jt(e){let t=new Set(e.map(n=>n.ref).filter(n=>typeof n=="string"));for(let[n,r]of e.entries()){if(r.op!=="create"||r.ref!==void 0||typeof r.id=="string"&&r.id.trim().length>0)continue;let i=`${Ve}${n+1}`;if(t.has(i))throw new d(`Mutation ${n+1} receives the synthesized ref "${i}", but another row declares that ref. Rename it or give mutation ${n+1} its own ref; ${Ve}<n> aliases are reserved for rows without one.`,u.USAGE);r.ref=i}}function ct(e,t,n){let r=on(JSON.stringify(e),t,{},n);return delete r.stdinJson,delete r.documentAnnotationSnapshot,r}function dt(e,t){return e!=="create"&&e!=="update"?[]:t.filter(n=>n.commands.includes(e)).map(n=>S(n))}function Wt(e,t){for(let n of e)h(n.item)&&(n.options=ct(n.item,"create",t),delete n.item)}function ut(e,t){return t.some(n=>n.metadata_key===e)?e:C(e)}function Z(e,t,n){let r=t.replaceAll(/_([a-z])/gu,(a,s)=>s.toUpperCase());if(h(e.item)){if(e.item[t]!==void 0)return e.item[t];if(ut(r,n)===t&&e.item[r]!==void 0)return e.item[r]}let i=h(e.options)?e.options:{},o=n.find(a=>a.metadata_key===t);return o!==void 0&&i[S(o)]!==void 0?i[S(o)]:i[t]!==void 0?i[t]:i[r]!==void 0?i[r]:(Array.isArray(i.field)?i.field:[]).map(String).find(a=>a.startsWith(`${t}=`))?.slice(t.length+1)}function zt(e,t){return e<t?-1:+(e!==t)}function Q(e){return Array.isArray(e)?e.map(Q):h(e)?Object.fromEntries(Object.entries(e).sort(([t],[n])=>zt(t,n)).map(([t,n])=>[t,Q(n)])):e}function _(e){return typeof e=="string"?e.trim():JSON.stringify(Q(e))}function Vt(e,t,n,r,i){let o=t.key.trim();if(o.length===0)throw new d("Upsert key must be a non-empty field name.",u.USAGE);let a=Bt(t.existing),s=new Map,c=new Set;for(let[l,p]of e.entries()){if(p.op!=="create")continue;let f=Yt(p,o,l,s,r),y=Ht(a.get(f)??[],o,f);if(y===void 0){p.unique={key:o,value:Z(p,o,r)};continue}let w=$(y,n);typeof p.ref=="string"&&(i[p.ref]=w),Xt(p,w,r,{key:o,value:Z(p,o,r)}),c.add(l)}return c}function Bt(e){let t=new Map;for(let n of e){if(n.value===void 0||n.value===null)continue;let r=_(n.value);t.set(r,[...t.get(r)??[],n.id])}return t}function Yt(e,t,n,r,i){let o=Z(e,t,i);if(o==null||o==="")throw new d(`Mutation ${n+1} is missing the upsert key "${t}".`,u.USAGE,{code:"upsert_key_missing",required:`Every create record must carry a non-empty "${t}" value when --upsert-key ${t} is set.`,why:"Keyed upsert identifies existing items by that field; a record without it cannot be matched or safely created."});let a=_(o),s=r.get(a);if(s!==void 0)throw new d(`Mutations ${s+1} and ${n+1} share the upsert key value ${JSON.stringify(a)} for "${t}".`,u.USAGE,{code:"upsert_key_duplicate",required:"Each record must carry a distinct upsert key value within one batch.",why:"Two records with the same key would race for the same existing item."});return r.set(a,n),a}function Ht(e,t,n){if(e.length>1)throw new d(`Upsert key "${t}" value ${JSON.stringify(n)} matches ${e.length} existing items: ${e.join(", ")}.`,u.CONFLICT,{code:"upsert_key_ambiguous",required:"Resolve the duplicate existing items or choose a key that is unique per item.",why:"An ambiguous key cannot select one item to update without guessing."});return e[0]}function Xt(e,t,n,r){let i=new Set([...ot.update,...dt("update",n)]),o=h(e.item)?ct(e.item,"update",n):Object.fromEntries(Object.entries(e.options).filter(([a])=>i.has(a)));delete e.item,delete e.ref,e.op="update",e.id=t,e.options=o,e.match=r}function pt(e,t,n){for(let[r,i]of e.entries())if(i.ref!==void 0){if(i.op!=="create")throw new d(`Mutation ${r+1} ref is only valid for create operations.`,u.USAGE);if(typeof i.ref!="string"||!Ye.test(i.ref))throw new d(`Mutation ${r+1} ref must match ${Ye.source}.`,u.USAGE);if(n[i.ref]!==void 0)throw new d(`Duplicate mutation ref "${i.ref}".`,u.USAGE);n[i.ref]=typeof i.id=="string"&&i.id.trim().length>0?$(i.id,t.idPrefix):Ut(t.transactionId,i.ref,t.idPrefix)}return n}function lt(e,t){let n=Kt(e);Jt(n);let r=n.map(p=>typeof p.ref=="string"?p.ref:void 0),i=Object.create(null),o=t.upsert===void 0?new Set:Vt(n,Lt(t.upsert,n,t),t.idPrefix,t.runtimeFields??[],i);Wt(n,t.runtimeFields??[]),pt(n,t,i),Dt(n,r);let a=n.map(p=>{let f={...p},y=typeof f.ref=="string"?f.ref:void 0;if(delete f.ref,y!==void 0?f.id=i[y]:f.id=Ze(f.id,i),h(f.options)){let w={...f.options};for(let g of["parent","blockedBy"])w[g]!==void 0&&(w[g]=Ze(w[g],i));Array.isArray(w.dep)?w.dep=w.dep.map(g=>Qe(g,i)):w.dep!==void 0&&(w.dep=Qe(w.dep,i)),f.options=w}return f}),s=st(JSON.stringify(a),{runtimeFields:t.runtimeFields??[]}),c=s.filter(p=>p.op==="create").map(p=>p.id);if(new Set(c).size!==c.length)throw new d("Duplicate resolved create id in mutation document.",u.USAGE);let l=s.map((p,f)=>{let y=r[f];return{index:f,...typeof y=="string"?{ref:y}:{},id:p.id,op:p.op,...o.has(f)?{upserted:!0}:{}}});return{schema_version:1,mutations:s,references:i,rows:l}}function Zt(e,t){return t.filter(n=>e[n]!==void 0&&e[n]!==null).map(n=>{let r=String(e[n]);return`${n}=${/[",\n\r\\]/u.test(r)?JSON.stringify(r):r}`}).join(",")}function Qt(e,t,n){if(e!==void 0){if(!Array.isArray(e)||!e.every(h))throw new d(`${n} must be an array of objects.`,u.USAGE);return e.map(r=>Zt(r,t))}}function en(e,t){return e==="tags"&&Array.isArray(t)&&t.every(n=>typeof n=="string")?JSON.stringify(t):typeof t=="number"||typeof t=="boolean"?String(t):t}function et(e,t,n=!1){for(let[r,i,o]of xe){let a=t[r],s=Qt(n&&["comments","notes","learnings"].includes(r)&&Array.isArray(a)?a.filter(c=>!h(c)||c.created_at===void 0):a,o,r);s!==void 0&&s.length>0&&(e[i]=s)}}function tn(e,t){for(let n of Object.keys(e)){if(t){if(!N.includes(n))throw T("item envelope",n,N);continue}if(!b.has(n)&&D(n,[...b])===void 0&&D(n,N)==="item")throw T("item envelope",n,N)}}function nn(e){let t=Object.hasOwn(e,"item");tn(e,t);let n=t?e.item:e;if(!h(n))throw new d("Item document item must be an object.",u.USAGE);return{item:n,...t&&h(e.linked)?{linked:e.linked}:{}}}function rn(e,t,n,r,i,o){if((r==="update"?Ot:it).has(t))return;let a=i.find(s=>s.metadata_key===t&&s.commands.includes(r));if(a!==void 0){let s=Ie(o,a);e[S(a)]=s!==void 0?s:a.type==="array"||a.type==="object"?JSON.stringify(n):n;return}if(!b.has(t)){if(D(t,[...b])!==void 0)throw T("item document",t,[...b]);let s=Array.isArray(e.field)?e.field:[];s.push(`${t}=${typeof n=="string"?n:JSON.stringify(n)}`),e.field=s;return}["dependencies","comments","notes","learnings","files","tests","docs","reminders","events","type_options"].includes(t)||(e[t.replaceAll(/_([a-z])/gu,(s,c)=>c.toUpperCase())]=en(t,n))}function on(e,t,n={},r=[]){let i=ee(e,"Item document");if(!h(i))throw new d("Item document must be a JSON object.",u.USAGE);let{item:o,linked:a}=nn(i),s={};for(let[c,l]of Object.entries(o)){let p=ut(c,r);p!==c&&Object.hasOwn(o,p)||rn(s,p,l,t,r,n)}if(et(s,o,t==="update"),a!==void 0&&et(s,a),t==="update"){let c=Object.fromEntries(["comments","notes","learnings"].filter(l=>Object.hasOwn(o,l)).map(l=>[l,o[l].filter(p=>h(p)&&p.created_at!==void 0)]));Object.keys(c).length>0&&(s.documentAnnotationSnapshot=c)}return{...s,...Object.fromEntries(Object.entries(n).filter(([,c])=>c!==void 0)),...Array.isArray(s.field)&&Array.isArray(n.field)?{field:[...s.field,...n.field]}:{},stdinJson:void 0}}function Mr(e){return st(JSON.stringify(e))}import ie from"node:crypto";import{constants as te}from"node:fs";import{cp as an,lstat as ft,mkdir as sn,mkdtemp as ht,open as cn,readdir as dn,realpath as yt,rm as wt,stat as oe,writeFile as gt}from"node:fs/promises";import{tmpdir as vt}from"node:os";import m 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]="4d215571-44e3-5ce8-9644-47e42dd4b23e")}catch{}})();async function ae(e,t){if(!Oe(e))return{schema:W(t.schema),typeDefinitionsFromFile:[]};let n=await _n(e,t.schema);return{schema:n.schema,typeDefinitionsFromFile:n.type_definitions_from_file??[]}}async function se(e,t,n,r){let i=L({...t,item_types:{...t.item_types,definitions:[...t.item_types?.definitions??[],...n.typeDefinitionsFromFile]}},J());return(await $e(e,t.item_format,i.type_to_folder,void 0,n.schema)).flatMap(o=>{let a=o[r];return a==null?[]:[{id:o.id,value:a}]})}function _t(e){let t=new Map,n=async r=>{let i=await k(e),o=await ae(e,i),a=new Map;for(let s of await se(e,i,o,r)){let c=_(s.value);a.set(c,[...a.get(c)??[],s.id])}return a};return{lookup(r){let i=t.get(r)??n(r);return t.set(r,i),i},async recordCreate(r){for(let[i,o]of t){let a=r[i];if(a==null)continue;let s=await o,c=_(a);s.set(c,[...s.get(c)??[],String(r.id)])}},invalidate(){t.clear()}}}async function un(e,t){let n=_(t.value),r=(await e.lookup(t.key)).get(n)??[];if(r.length!==0)throw new d(`Upsert key "${t.key}" value ${JSON.stringify(n)} now matches existing item ${r.join(", ")}; the plan was resolved before it existed.`,u.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 pn(e,t,n){let r=e.metadata[n.key],i=_(n.value);if(_(r)!==i)throw new d(`Item ${t} no longer carries upsert key "${n.key}" value ${JSON.stringify(i)}; the plan selected it before the key changed.`,u.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 mt(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 G(e,t){let n={...e,...t};return e===void 0?n:je(e,n)}async function E(e,t){try{let n=(await Y(t,{},{pmRoot:e})).item;return{id:n.id,closedAt:n.closed_at,updatedAt:n.updated_at,assignee:n.assignee,claimPrincipal:n.claim_principal}}catch(n){if(n instanceof d&&n.exitCode===u.NOT_FOUND)return;throw n}}function ce(e,t){let n=e.id.replaceAll(/[^a-zA-Z0-9._-]/gu,"_"),r=ie.createHash("sha256").update(ye(e)).digest("hex").slice(0,12);return`${t+1}-${e.op}-${n}-${r}`}function ln(e,t){let n=e.id.replaceAll(/[^a-zA-Z0-9._-]/gu,"_");return`${t+1}-${e.op}-${n}`}function v(e,t,n){return`bulk-item-transaction ${e} ${t} ${n}`}async function R(e,t,n,r){let i=await M(m.join(e,"history",`${t}.jsonl`),t),o=v(n,r,"apply"),a=v(n,r,"compensate");for(let s=i.length-1;s>=0;s-=1){let c=i[s].message;if(c===o)return!0;if(c===a)return!1}return!1}async function de(e,t){let n=await E(e,t.id);if(n?.updatedAt===void 0)throw new d(`Bulk ${t.op} target ${t.id} does not exist or has no restorable version`,u.NOT_FOUND);let r=await M(m.join(e,"history",`${n.id}.jsonl`),n.id);if(r.length===0)throw new d(`Bulk ${t.op} target ${t.id} has no restorable history`,u.NOT_FOUND);return{target_updated_at:n.updatedAt,target_version:String(z(r)+r.length),target_history_hash:O(r),target_history_length:r.length}}function F(e,t,n){return new d(`Transaction ${e.transactionId} cannot safely compensate incomplete step ${n}; review item ${t} history before recovery.`,u.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 mn(e,t){let n=`bulk-item-transaction ${t} `;return[e.message,e.context?.item_transaction_step].some(r=>typeof r=="string"&&r.startsWith(n))}function fn(e,t,n){let{expectedHistory:r,length:i,version:o}=t;if(O(e)===r)return!1;if(typeof i!="number"||!Number.isSafeInteger(i)||i<1||O(e.slice(0,i))!==r||o!==String(z(e)+i))throw F(n,n.itemId,n.stepId);let a=v(n.transactionId,n.stepId,"apply"),s=e.slice(i),c=y=>y.message===a||y.context?.item_transaction_step===a,l=v(n.transactionId,n.stepId,"compensate");if(s.filter(y=>c(y)||y.message===l).at(-1)?.message===l)return!1;let p=s.filter(c);if(p.length===0)return!1;let f=e.at(-1).after_hash===p.at(-1).after_hash&&s.every(y=>mn(y,n.transactionId));if(p.length!==s.length&&!f)throw F(n,n.itemId,n.stepId);return!0}async function q(e,t,n,r){let i=r!==null&&typeof r=="object"&&!Array.isArray(r)?r:void 0;if(i===void 0||typeof i.target_updated_at!="string")return;let o=i.target_updated_at,a=await E(e.pmRoot,t);if(a===void 0)return;let s=await M(m.join(e.pmRoot,"history",`${a.id}.jsonl`),a.id),c=i.target_history_hash;if(typeof c=="string"){if(!fn(s,{expectedHistory:c,length:i.target_history_length,version:i.target_version},{...e,itemId:a.id,stepId:n}))return}else{if(a.updatedAt===o)return;if(!await R(e.pmRoot,a.id,e.transactionId,n))throw F(e,a.id,n)}let l=()=>Je(t,typeof i.target_version=="string"?i.target_version:o,{force:!0,author:e.author,message:v(e.transactionId,n,"compensate")},{pmRoot:e.pmRoot});await V({pmRoot:e.pmRoot,id:a.id,validate:p=>{if(Me(p)!==s.at(-1).after_hash)throw F(e,a.id,n)}},l)}function Et(e,t,n){return{id:n,async inspect(){let r=await E(e.pmRoot,t.id);if(r===void 0)return{state:"pending"};if(r.closedAt!==void 0){let i=await M(m.join(e.pmRoot,"history",`${r.id}.jsonl`),r.id),o=`Compensated: interrupted bulk transaction ${e.transactionId}`;if(i.filter(a=>a.op==="close").at(-1)?.patch.some(a=>a.op==="add"||a.op==="replace"?a.path==="/metadata/close_reason"&&a.value===o:!1)??!1)throw new d(`Created item ${r.id} remains closed by transaction compensation; explicitly reopen or reconcile it before retrying.`,u.CONFLICT,{code:"transaction_create_compensated",item_id:r.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 ${r.id} "Retry compensated creation" after reviewing its history, then retry the transaction.`]})}return{state:"applied",result:{id:r.id,op:"create"}}},async apply(){t.unique!==void 0&&await un(e.uniqueIndex,t.unique);let r=await Ge(G(t.options,{author:e.author,id:t.id}),{pmRoot:e.pmRoot}),i=r.item;return e.onCreateWarnings?.(String(i.id),r.warnings),await e.uniqueIndex.recordCreate(i),{id:String(i.id),op:"create"}},async compensate(){let r=await E(e.pmRoot,t.id);if(r!==void 0){if(e.createCompensation==="delete"){await Le(t.id,{force:!0,author:e.author,message:`Compensate interrupted bulk transaction ${e.transactionId}`},{pmRoot:e.pmRoot});return}r.closedAt===void 0&&await H(t.id,`Compensated: interrupted bulk transaction ${e.transactionId}`,{force:!0,author:e.author},{pmRoot:e.pmRoot})}}}}function hn(e,t,n){return{id:n,compensatePending:!0,async inspect(){let r=await E(e.pmRoot,t.id);return r===void 0?{state:"pending"}:await R(e.pmRoot,r.id,e.transactionId,n)?{state:"applied",result:{id:r.id,op:"update"}}:{state:"pending"}},async prepareCompensation(){return de(e.pmRoot,t)},async apply(){let r=()=>qe(t.id,G(t.options,{author:e.author,message:v(e.transactionId,n,"apply")}),{pmRoot:e.pmRoot}),i=t.match,o=i,a=(await V({pmRoot:e.pmRoot,id:String((await Y(t.id,{},{pmRoot:e.pmRoot})).item.id),validate:s=>{o!==void 0&&pn(s,t.id,o)},committed:s=>{i!==void 0&&(o={key:i.key,value:structuredClone(s.metadata[i.key])})},historyContext:{item_transaction_step:v(e.transactionId,n,"apply")}},r)).item;return e.uniqueIndex.invalidate(),{id:String(a.id),op:"update"}},async compensate(r){await q(e,t.id,n,r)}}}function yn(e,t,n){return{id:n,async inspect(){let r=await E(e.pmRoot,t.id);return r===void 0?{state:"pending"}:await R(e.pmRoot,r.id,e.transactionId,n)?{state:"applied",result:{id:r.id,op:"close"}}:r.closedAt===void 0?{state:"pending"}:{state:"applied",result:{id:r.id,op:"close"}}},async prepareCompensation(){return de(e.pmRoot,t)},async apply(){let r=(await H(t.id,t.reason,G(t.options,{author:e.author,message:v(e.transactionId,n,"apply")}),{pmRoot:e.pmRoot})).item;return e.uniqueIndex.invalidate(),{id:String(r.id),op:"close"}},async compensate(r){await q(e,t.id,n,r)}}}function wn(e,t,n){return{id:n,async inspect(){let r=await E(e.pmRoot,t.id);return r===void 0?{state:"pending"}:await R(e.pmRoot,r.id,e.transactionId,n)?{state:"applied",result:{id:r.id,op:"release"}}:r.assignee!==void 0||r.claimPrincipal!==void 0?{state:"pending"}:{state:"applied",result:{id:r.id,op:"release"}}},async prepareCompensation(){return de(e.pmRoot,t)},async apply(){let r=(await Ke(t.id,G(t.options,{author:e.author,message:v(e.transactionId,n,"apply")}),{pmRoot:e.pmRoot})).item;return e.uniqueIndex.invalidate(),{id:String(r.id),op:"release"}},async compensate(r){await q(e,t.id,n,r)}}}function St(e,t,n){let r=ce(t,n);switch(t.op){case"create":return Et(e,t,r);case"update":return hn(e,t,r);case"close":return yn(e,t,r);case"release":return wn(e,t,r)}}function gn(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&&!mt(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&&!mt(e.match))throw new TypeError(`Bulk update mutation ${t+1} match must be an object with a non-empty key and a value`);U(e.options,e.op,t)}function bt(e){if(e.length===0)throw new TypeError("Bulk item transaction requires at least one mutation");let t=new Map;for(let[n,r]of e.entries()){if(gn(r,n),r.op!=="create"||r.unique===void 0)continue;let{key:i,value:o}=r.unique,a=t.get(i)??new Map,s=_(o),c=a.get(s);if(c!==void 0)throw new d(`Bulk create mutations ${c+1} and ${n+1} share the upsert key value ${JSON.stringify(s)} for "${i}".`,u.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."});a.set(s,n),t.set(i,a)}}async function ne(e,t,n){try{return await n()}catch(r){throw r instanceof d?new d(r.message,r.exitCode,{...r.context,transaction_operation:{index:t,op:e.op,id:e.id}}):r}}function Tt(e,t,n,r){let i=m.relative(e,t),o=i.split(m.sep);return o[0]==="extensions"&&o[2]==="node_modules"&&!r.some(a=>i===a||i.startsWith(`${a}${m.sep}`)||a.startsWith(`${i}${m.sep}`))?!1:["locks","runtime","search"].includes(i.split(m.sep)[0])?r.some(a=>i===a||i.startsWith(`${a}${m.sep}`)||a.startsWith(`${i}${m.sep}`)):i===""||n===void 0||n.some(a=>i===a||i.startsWith(`${a}${m.sep}`)||a.startsWith(`${i}${m.sep}`))}async function P(e,t){let n=await ft(t);if(n.isSymbolicLink())await oe(t);else if(n.isDirectory()||n.isFile())return n;throw A(m.relative(e,t))}async function vn(e,t){let n=await cn(t,te.O_RDONLY|te.O_NOFOLLOW|te.O_NONBLOCK);try{let r=await n.stat();if(!r.isFile())throw A(m.relative(e,t));let i=ie.createHash("sha256");if(r.size>0)for await(let o of n.createReadStream({highWaterMark:64*1024,end:r.size-1,autoClose:!1}))i.update(o);return i.digest()}finally{await n.close()}}async function re(e,t,n){let r=ie.createHash("sha256");async function i(o){for(let a of(await dn(o)).sort()){let s=m.join(o,a);Tt(e,s,t,n)&&((await P(e,s)).isDirectory()?await i(s):(r.update(JSON.stringify(m.relative(e,s))),r.update(await vn(e,s))))}}return await i(e),r.digest("hex")}function j(){return new d("Tracker changed while preparing the transaction preview; retry against stable state.",u.CONFLICT,{code:"transaction_preview_snapshot_changed"})}async function ue(e){if(!K(e))return!1;let t=e.path;if(typeof t!="string")return!1;let n=m.resolve(t),r=n;for(;;)try{let i=await ft(r);return r!==n&&i.isDirectory()}catch(i){if(!K(i))return!1;let o=m.dirname(r);if(o===r)return!1;r=o}}async function x(e,t){let n=m.join(e,t);try{let r=e;for(let i of t.split(m.sep).slice(0,-1))r=m.join(r,i),await P(e,r);if(!(await P(e,n)).isFile())throw A(t);return await fe(n,A(t))}catch(r){if(await ue(r))return;throw r}}async function It(e,t,n,r){let i=W(n);for(let[o,a]of Object.entries(i.files)){let s=m.relative(e,Se(e,a,Ee[o]));if(s===""||!m.resolve(e,s).startsWith(m.join(e,m.sep)))throw new d("Transaction preview requires schema files inside the selected tracker root; relocate the configured schema file before retrying.",u.USAGE,{code:"transaction_preview_external_schema",field:`schema.files.${o}`});i.files[o]=s;let c=await x(e,s);if(r?.set(s,c),c!==void 0){let l=m.join(t,s);await sn(m.dirname(l),{recursive:!0}),await gt(l,c)}}return be(t,i)}async function _n(e,t){await oe(e);let n=await ht(m.join(vt(),"pm-schema-plan-"));try{let r=await yt(e);return await It(r,m.join(n,"configuration"),t)}catch(r){throw await ue(r)?j():r}finally{await wt(n,{recursive:!0,force:!0})}}async function En(e,t,n){let r=new Map,i=await x(e,I);r.set(I,i);let o;try{o=JSON.parse(i??"null")}catch{o=null}let a=Re(o),s=a.success?a.data:void 0,c=await It(e,t,s?.schema,r),l=c.schema,p=m.relative(e,Ae(e));r.set(p,await x(e,p));let f=L({...me,item_types:{definitions:[...s?.item_types?.definitions??[],...c.type_definitions_from_file??[]]}},n),y=he(e)===e?[...le.filter(Boolean),I,ve,"transactions",...f.folders,...r.keys()].map(g=>m.normalize(g)):void 0,w=s===void 0?void 0:JSON.stringify({...o,schema:{...s.schema,files:l.files}});return{configuration:r,ownedPaths:y,stagedSettings:w,registryFolders:f.folders}}async function Sn(e,t,n){await oe(e);try{let r=await yt(e),i=await En(r,m.join(m.dirname(t),"configuration"),n),o=[...i.configuration.keys(),...i.registryFolders].map(l=>m.normalize(l)),a=await re(r,i.ownedPaths,o);await an(r,t,{recursive:!0,dereference:!1,filter:async l=>Tt(r,l,i.ownedPaths,o)?(await P(r,l),!0):!1});let[s,c]=await Promise.all([re(r,i.ownedPaths,o),re(t,i.ownedPaths,o)]);if(a!==s||a!==c)throw j();for(let[l,p]of i.configuration)if(await x(t,l)!==p)throw j();i.stagedSettings!==void 0&&await gt(m.join(t,I),i.stagedSettings)}catch(r){throw await ue(r)?j():r}}async function At(e){let t=Ce(e),n=[...e.mutations];bt(n);let r=J(),i=await ht(m.join(vt(),"pm-transaction-preview-")),o=m.join(i,"tracker");try{await Sn(t.pmRoot,o,r);let a=!1,s=[];return await We({path:o,noExtensions:!0},async()=>{ge(r);let c={...t,pmRoot:o,createCompensation:"close",uniqueIndex:_t(o)},l=n.map((p,f)=>{let y=St({...c,onCreateWarnings:(w,g)=>{g.length>0&&s.push({index:f,id:w,op:"create",warnings:g})}},p,f);return{...y,inspect:()=>ne(p,f,()=>y.inspect()),prepareCompensation:()=>ne(p,f,async()=>y.prepareCompensation?.()),apply:()=>ne(p,f,()=>y.apply())}});await B({...t,pmRoot:o,steps:l,onTransition:({transition:p})=>{p==="committed"&&(a=!0)}})}),{validated:a,state:a?"staged_snapshot":"replayed_committed_plan",warnings:s,unresolved_commit_constraints:["concurrent_tracker_changes","extension_mutation_guards_and_hooks","derived_extension_dependencies_excluded"]}}finally{await wt(i,{recursive:!0,force:!0})}}async function bn(e){let t=[...e.mutations];bt(t);let n=e.createCompensation??"close";if(!["close","delete"].includes(n))throw new TypeError("Bulk item transaction createCompensation must be close or delete");let r={pmRoot:e.pmRoot,author:e.author,transactionId:e.transactionId,createCompensation:n,uniqueIndex:_t(e.pmRoot)},i=await B({pmRoot:e.pmRoot,transactionId:e.transactionId,author:e.author,steps:t.map((a,s)=>St(r,a,s)),...e.lockTtlSeconds===void 0?{}:{lockTtlSeconds:e.lockTtlSeconds},...e.lockWaitMs===void 0?{}:{lockWaitMs:e.lockWaitMs},...e.onTransition===void 0?{}:{onTransition:e.onTransition}}),o={};for(let[a,s]of t.entries()){let c=ce(s,a),l=i.results[c];o[ln(s,a)]=l}return{transactionId:i.transactionId,status:"committed",recovered:i.recovered,results:o}}function Tn(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 ni(e){return bn({pmRoot:e.pmRoot,transactionId:e.transactionId,author:e.author,mutations:Tn(e),...e.lockTtlSeconds===void 0?{}:{lockTtlSeconds:e.lockTtlSeconds},...e.lockWaitMs===void 0?{}:{lockWaitMs:e.lockWaitMs},...e.onTransition===void 0?{}:{onTransition:e.onTransition}})}var ri={buildCreateStep:Et,bulkHistoryMarker:v,compensateByRestore:q,deriveStepId:ce,isUpdateMarkerApplied:R,readItemSnapshot: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]="3041c268-69c8-58e5-8a68-eaaa3c0dbd3b")}catch{}})();async function li(e){let{plan:t}=e,n=await At({pmRoot:e.pmRoot,author:e.author,transactionId:t.transaction_id,mutations:t.mutations}),r=new Map(n.warnings.map(o=>[o.index,o.warnings])),i=t.rows.map(o=>{let a={...o};delete a.warnings;let s=r.get(o.index);return s!==void 0&&(a.warnings=s),a});return{validation:n,rows:i}}async function mi(e){let t=e.upsertKey?.trim();if(t!==void 0&&t.length===0)throw new d("Upsert key must be a non-empty field name.",u.USAGE);let n=e.settings??await k(e.pmRoot),r=e.transactionId?.trim()??"",i=r.length>0?r:at(e.input),o=await ae(e.pmRoot,n),a=Te(o.schema).definitions,s=(a.find(l=>l.metadata_key===t)??a.find(l=>l.key===t||S(l)===t))?.metadata_key??C(t),c=s===void 0?void 0:{key:s,existing:await se(e.pmRoot,n,o,s)};return{...lt(e.input,{transactionId:i,idPrefix:n.id_prefix,runtimeFields:a,...c===void 0?{}:{upsert:c}}),transaction_id:i,transaction_id_source:r.length>0?"explicit":"derived",...c===void 0?{}:{upsert_key:c.key}}}export{at as a,Ar as b,st as c,_ as d,lt as e,on as f,Mr as g,ae as h,se as i,_n as j,At as k,bn as l,Tn as m,ni as n,ri as o,li as p,mi as q};
|
|
2
|
-
//# sourceMappingURL=chunk-ZX3XMTZG.js.map
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import{a as wt}from"./chunk-DM3PICGU.js";import"./chunk-SGFQQXFD.js";import"./chunk-DEZPZOQ7.js";import{b as le,f as St,k as At,l as kt,m as _t,n as xt,p as Ct,q as Dt}from"./chunk-ZX3XMTZG.js";import{a as he}from"./chunk-3KMYHYJV.js";import{$ as Kt,C as vt,D as ht,E as bt,V as Bt,W as jt,X as qt,Y as Vt,Z as zt,_ as Jt,aa as Wt,ba as Xt,ca as ae,da as ne,ea as re,r as ot,s as dt,t as ct,u as pt,v as te,w as oe,x as ie,y as ft,z as gt}from"./chunk-YUBUNECD.js";import"./chunk-DKLEDWVW.js";import"./chunk-XHONSCLJ.js";import{$a as lt,Hc as yt,Qa as at,Ya as nt,Zb as ee,_a as rt,ab as st,tc as ut,ya as tt,yc as mt}from"./chunk-AHVN4GHF.js";import"./chunk-JESLOJD7.js";import{$ as Ye,A as xe,B as Ce,C as De,D as Ie,E as Re,G as Te,H as Ee,I as Oe,J as Fe,K as Me,L as Pe,M as Ne,N as Le,O as $e,P as He,Q as Ue,R as Ge,S as Be,T as je,U as qe,V as Ve,W as ze,X as Je,Y as Ke,Z as We,_ as Xe,aa as Ze,ba as Qe,ca as et,x as H}from"./chunk-D6P6IBPN.js";import{sa as it,zb as Q}from"./chunk-PQLRKFPZ.js";import"./chunk-4D25HF3V.js";import{Kf as E,Lc as I,Me as W,Of as y,Pe as Ae,Rf as c,Sc as z,Sf as l,Tf as w,Uf as O,Vc as J,Vf as $,Wf as X,Xf as Y,Yf as _e,dc as we,hg as b,oc as V,pc as Se,vc as C,yf as ke,ze as K}from"./chunk-CS7QDSUX.js";import"./chunk-SPPHDVZE.js";import"./chunk-LWW4F4G2.js";import{o as Z}from"./chunk-CXUQEZDX.js";import"./chunk-IB7UB5TE.js";import{Bi as T,Cd as j,Mf as h,N as ye,Pf as f,Qf as v,Sa as ve,ga as ge,jb as B,qg as be,qh as q,xa as x}from"./chunk-7V37RC2L.js";import"./chunk-TH5KPAN4.js";import"./chunk-VS565KBX.js";import{A as p,C as u}from"./chunk-RZQNFHXO.js";import{a as fe}from"./chunk-XAWE4EAK.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="48b9050b-3290-55d6-82cc-b9d14cc33186")}catch{}})();(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]="f111051f-3880-5ff0-9138-5166cd8a93a9")}catch{}})();(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]="e599b2e9-fc63-5982-b7cf-ae208c127f62")}catch{}})();(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]="fd8685dd-856f-51b2-9bfa-f1df88acb070")}catch{}})();(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]="e972ba26-a7b8-5e91-9e63-21416be686eb")}catch{}})();(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]="a310e747-0cd7-5dff-b8a0-29d3c4ded9f3")}catch{}})();(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]="f27f4c13-4b15-5536-bc5a-b1f263fab5db")}catch{}})();(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]="529dd34d-5a81-504f-9641-28093d41d247")}catch{}})();(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]="6e6bec6b-9415-5f41-87e8-2d1248fba748")}catch{}})();(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]="fd91be06-efd5-5b43-895a-e47a1c144333")}catch{}})();(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]="5760feb1-435b-5b0e-b4ed-c22f6a955bed")}catch{}})();var F={};fe(F,{PROFILE_SUBCOMMANDS:()=>Bt,formatProfileApplyHuman:()=>Xt,formatProfileLintHuman:()=>Wt,formatProfileListHuman:()=>Jt,formatProfileShowHuman:()=>Kt,runProfileApply:()=>zt,runProfileLint:()=>Vt,runProfileList:()=>jt,runProfileShow:()=>qt});(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]="2d367793-8aa5-5a00-8c8c-60512a27f62a")}catch{}})();(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]="e8448334-e87d-5984-9e89-04e506e0a2a7")}catch{}})();(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]="12792dbc-d8ac-50aa-8ebd-bc68a70fa195")}catch{}})();async function se(e){typeof e.description=="string"&&e.description.trim()==="-"&&(e.description=await C().resolveValue(e.description,"--description")??"")}import{readFile as Yt}from"node:fs/promises";import Zt 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]="6154c844-0615-5c2a-ac12-48cb73783d53")}catch{}})();async function Qt(e,t,o,i){let a=y(i),r=o.expectedResult??o.expected,n=await ft(e,t,{status:typeof o.status=="string"?o.status:void 0,expectedResult:typeof r=="string"?r:void 0,author:typeof o.author=="string"?o.author:a.author,message:typeof o.message=="string"?o.message:void 0,force:o.force===!0},a);await b(a,n),f(n,a)}async function eo(e,t){let o=typeof e.from=="string"?e.from.trim():"";if(o.length>0&&o!=="-"){if(t.getOptionValueSource("stdinJson")==="cli")throw new u("pm item mutate cannot combine --from <path> with explicit --stdin-json. Select one input source.",p.USAGE);try{return await Yt(Zt.resolve(process.cwd(),o),"utf8")}catch(i){throw new u(`pm item mutate could not read --from ${o}: ${he(i)}`,p.USAGE,{code:"mutation_document_unreadable",required:"Pass a readable JSON, JSON Lines, or envelope document path, or `-` for stdin.",why:"The whole document must be available before any tracker write begins."})}}return await C().resolveValue("-","--stdin-json")??""}async function to(e,t){let o=y(t),i=await eo(e,t);if(i.trim().length===0)throw new u("pm item mutate requires a non-empty JSON batch on stdin or via --from <path>.",p.USAGE);if(e.transactionId!==void 0&&(typeof e.transactionId!="string"||e.transactionId.trim().length===0))throw new u("pm item mutate requires --transaction-id <value> to be non-empty when provided.",p.USAGE);let a=x(process.cwd(),o.path),r=await T(a),n=await Dt({pmRoot:a,input:i,settings:r,...typeof e.transactionId=="string"?{transactionId:e.transactionId}:{},...typeof e.upsertKey=="string"?{upsertKey:e.upsertKey}:{}}),{mutations:s,references:d,rows:m}=n,g=n.transaction_id,S={transaction_id:g,transaction_id_source:n.transaction_id_source,...n.upsert_key===void 0?{}:{upsert_key:n.upsert_key}},A=le(e),D=q(typeof e.author=="string"?e.author:o.author,r.author_default);if(e.dryRun===!0){let R=await Ct({pmRoot:a,author:D,plan:n});f({...S,dry_run:!0,validation:R.validation,mutation_count:s.length,mutations:s,references:d,rows:R.rows},o);return}let L=await kt({pmRoot:a,transactionId:g,author:D,mutations:s,...A});f({...L,...S,mutation_count:s.length,references:d,rows:m},o)}function oo(e,t){return typeof e=="string"&&e.trim().length>0?e.trim():typeof t=="string"?t.trim():""}async function io(e,t,o,i){let a=y(i),r=typeof o.transactionId=="string"?o.transactionId.trim():"";if(r.length===0)throw new u("pm item complete requires --transaction-id <value>.",p.USAGE);let n=oo(t,o.reason);if(n.length===0)throw new u("pm item complete requires a close reason.",p.USAGE);let s=Object.fromEntries(["file","doc","test","comment","note","learning"].filter(k=>o[k]!==void 0).map(k=>[k,o[k]])),d=o.force===!0,{lockTtlSeconds:m,lockWaitMs:g}=le(o),S={...typeof o.resolution=="string"?{resolution:o.resolution}:{},...typeof o.expectedResult=="string"?{expectedResult:o.expectedResult}:{},...typeof o.actualResult=="string"?{actualResult:o.actualResult}:{},...typeof o.completedAt=="string"?{completedAt:o.completedAt}:{},...typeof o.validateClose=="string"?{validateClose:o.validateClose}:{},...d?{force:!0}:{}},A={id:e,reason:n,...Object.keys(s).length===0?{}:{evidence:s},...Object.keys(S).length===0?{}:{closeOptions:S},...d?{releaseOptions:{force:!0}}:{}},D=x(process.cwd(),a.path),L=q(typeof o.author=="string"?o.author:a.author,(await T(D)).author_default);if(o.dryRun===!0){let k=_t(A),Gt=await At({pmRoot:D,transactionId:r,author:L,mutations:k});f({transaction_id:r,dry_run:!0,validation:Gt,mutation_count:k.length,mutations:k},a);return}let R=await xt({pmRoot:D,transactionId:r,author:L,...A,lockTtlSeconds:m,lockWaitMs:g});f({...R,mutation_count:Object.keys(R.results).length},a)}function It(e){let t=e.commands.find(o=>o.name()==="item")??e.command("item").description("Run item lifecycle operations.");t.command("reopen <id> <reason>").option("--status <value>","Active target status: open or in_progress").option("--expected-result <value>","Current active planning expectation; otherwise the receipt offers recovery").option("--expected <value>","Alias for --expected-result").option("--message <value>","Human-readable recurrence history message").option("--force","Override ownership or stale-lock conflicts").option("--author <value>","Mutation author").description("Reopen terminal work with recurrence evidence.").action(Qt),t.command("mutate").option("--transaction-id <value>","Stable idempotency key used to resume an interrupted batch; derived from the document when omitted").option("--stdin-json","Read the JSON mutation array from stdin",!0).option("--from <path>","Read the JSON, JSON Lines, or envelope document from a file (- for stdin)").option("--upsert-key <field>","Update the existing item whose field matches instead of creating a duplicate").option("--dry-run","Validate and preview the batch without writing").option("--create-compensation <mode>","Created-item compensation policy: close or delete","close").option("--lock-ttl-seconds <n>","Workspace transaction lock lifetime in seconds").option("--lock-wait-ms <n>","Maximum time to wait for the workspace transaction lock").option("--author <value>","Mutation author").description("Apply SDK-backed mutations atomically.").action(to),t.command("complete <id> [reason]").requiredOption("--transaction-id <value>","Stable idempotency key for the composed completion").option("--reason <value>","Close reason when omitted positionally").option("--file <value>","Linked file evidence",c).option("--doc <value>","Linked documentation evidence",c).option("--test <value>","Linked test evidence",c).option("--comment <value>","Evidence comment",c).option("--note <value>","Completion note",c).option("--learning <value>","Durable completion learning",c).option("--resolution <value>","Structured resolution evidence").option("--expected-result <value>","Expected result evidence").option("--actual-result <value>","Actual result evidence").option("--completed-at <value>","Actual completion time").option("--validate-close <mode>","Close validation: off, warn, or strict").option("--lock-ttl-seconds <n>","Workspace transaction lock lifetime in seconds").option("--lock-wait-ms <n>","Maximum time to wait for the workspace transaction lock").option("--dry-run","Validate and preview completion without writing").option("--force","Override lifecycle and ownership conflicts").option("--author <value>","Completion author").description("Close with evidence and release the claim.").action(io)}(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]="458845bd-2d07-59d5-b322-6ab634fcefa9")}catch{}})();async function ao(e,t){let o=y(t),i=Array.isArray(e.event)?e.event:[],a=await tt(x(process.cwd(),o.path),{historyEvent:i,allActionable:e.allActionable===!0,dryRun:e.dryRun===!0,planFingerprint:l(e,"planFingerprint"),limit:e.limit,attributedAuthor:l(e,"attributedAuthor"),reviewer:l(e,"reviewer"),reason:l(e,"reason")});f(a,o)}function Rt(e){e.command("history-author-acknowledge").option("--event <item-id:line>","Unknown-author event coordinate (repeatable)",c).option("--all-actionable","Select all actionable events").option("--dry-run","Preview a deterministic source-bound plan").option("--plan-fingerprint <sha256>","Apply the exact fingerprint returned by --dry-run").option("--limit <n>","Maximum coordinate rows returned in the plan").option("--attributed-author <value>","Reviewed principal attribution").option("--reviewer <value>","Disposition reviewer").option("--reason <value>","Review evidence").description("Append audited dispositions for immutable unknown-author events.").action(ao)}(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]="53ca90df-8382-5cc2-8906-8491afe5101a")}catch{}})();(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]="e2514244-d31d-5ee4-b037-b9101f9a24e1")}catch{}})();(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]="10a4ed4d-39d3-5b7b-87b1-4a6f95f0f2ab")}catch{}})();(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]="796e71dc-4693-50da-bbb8-57b19ff0af95")}catch{}})();(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]="e464e0e0-01a2-56c9-a05d-9b1b9dd6a6ee")}catch{}})();function de(e,t,o,i){if(t.trim().toLowerCase()!=="add"||!o?.trim())return;let a=l(i,"add")??l(i,"text")??l(i,"note")??l(i,"body")??l(i,"comment"),r=l(i,"file"),n=[e,o.trim()];a!==void 0?n.push("--add",a):i.stdin===!0?n.push("--stdin"):r!==void 0?n.push("--file",r):n.push("--add","-");let s=j(n),d=j([e,o.trim(),"--add","-"]);throw new u(`The positional token "add" was parsed as the item id, while "${o.trim()}" was parsed as annotation text. ${e} does not use an add subcommand.`,p.USAGE,{code:"annotation_transposed_subcommand",reason:"noun_verb_object_transposition",required:`Place the item id immediately after ${e}, then use --add for annotation text.`,examples:[...new Set([s,d])],recovery:{attempted_command:`pm ${e} add ${o.trim()}`,normalized_args:[e,"add",o.trim()],parsed_positionals:[{role:"transposed_subcommand",value:"add"},{role:"item_id",value:o.trim()}],suggested_retry:s}})}function Tt(e,t,o){let i=o.flatMap(a=>{let r=l(t,a);return r===void 0?[]:[{alias:a,value:r}]});if([...new Set(i.map(({value:a})=>a))].length>1)throw new u(`Specify ${e} text with one alias or the same value across aliases: ${i.map(({alias:a})=>`--${a}`).join(", ")}`,p.USAGE,{code:"annotation_alias_conflict"});return i[0]?.value}function no(e,t){let o=typeof t.edit=="number"?t.edit:void 0,i=typeof t.delete=="number"?t.delete:void 0,a=Tt("comment",t,["add","text","body","comment"]),r=typeof e=="string"?e:void 0,n=t.stdin===!0,s=l(t,"file");if(+(a!==void 0)+ +(r!==void 0)+Number(n)+ +(s!==void 0)>1)throw a!==void 0&&r!==void 0&&!n&&s===void 0?new u("Specify comment text either as positional [text] or with --add, not both",p.USAGE):new u("Specify comment text with exactly one source: positional [text], --add, --stdin, or --file",p.USAGE);let d=a??r;return{add:d,readFromStdin:n,readFromFile:s,editIndex:o,deleteIndex:i,isMutation:typeof d=="string"||n||s!==void 0||o!==void 0||i!==void 0}}function Et(e,t,o){let i=Tt(e,o,e==="note"?["add","text","note"]:["add","text"]),a=typeof t=="string"?t:void 0;if(i!==void 0&&a!==void 0)throw new u(`Specify ${e} text either as positional [text] or with --add, not both`,p.USAGE);let r=i??a,n=e==="note"?l(o,"addJson"):void 0,s=o.stdin===!0,d=l(o,"file"),m=typeof o.edit=="number"?o.edit:void 0,g=typeof o.delete=="number"?o.delete:void 0;return{add:r,addJson:n,readFromStdin:s,readFromFile:d,editIndex:m,deleteIndex:g,isMutation:typeof r=="string"||n!==void 0||s||d!==void 0||m!==void 0||g!==void 0}}async function ro(e,t,o,i){let a=y(i),r=Date.now();de("comments",e,t,o);let n=no(t,o),s=await ot(e,{add:n.add,stdin:n.readFromStdin,file:n.readFromFile,edit:n.editIndex,delete:n.deleteIndex,limit:l(o,"limit"),fullHistory:o.fullHistory===!0,ifAbsent:o.ifAbsent===!0,author:l(o,"author"),message:l(o,"message"),ownershipAppendBypass:o.ownershipAppendBypass===!0,force:!!o.force},a);n.isMutation&&s.changed!==!1&&await b(a,s),ce("comments",s,a,r)}async function lo(e,t,o,i){let a=y(i),r=Date.now();de("notes",e,t,o);let n=Et("note",t,o),s=await bt(e,{add:n.add,addJson:n.addJson,stdin:n.readFromStdin,file:n.readFromFile,edit:n.editIndex,delete:n.deleteIndex,limit:l(o,"limit"),since:l(o,"since"),eventType:l(o,"eventType"),includeMeta:o.includeMeta===!0,fullHistory:o.fullHistory===!0,ifAbsent:o.ifAbsent===!0,author:l(o,"author"),message:l(o,"message"),ownershipAppendBypass:o.ownershipAppendBypass===!0,force:!!o.force},a);n.isMutation&&s.changed!==!1&&await b(a,s),ce("notes",s,a,r)}async function so(e,t,o,i){let a=y(i),r=Date.now();de("learnings",e,t,o);let n=Et("learning",t,o),s=await dt(e,{add:n.add,stdin:n.readFromStdin,file:n.readFromFile,edit:n.editIndex,delete:n.deleteIndex,limit:l(o,"limit"),fullHistory:o.fullHistory===!0,ifAbsent:o.ifAbsent===!0,author:l(o,"author"),message:l(o,"message"),ownershipAppendBypass:o.ownershipAppendBypass===!0,force:!!o.force},a);n.isMutation&&s.changed!==!1&&await b(a,s),ce("learnings",s,a,r)}function ce(e,t,o,i){f(t,o),o.profile&&v(`profile:command=${e} took_ms=${Date.now()-i}`)}function Ot(e,t){let o=e.command("comments").argument("<id>","Item id").argument("[text]","Optional comment text shorthand (equivalent to --add)").option("--add <text>","Append comment text; use text=<value> for structured input or - for stdin").option("--stdin","Read comment text from stdin (supports multiline markdown)").option("--file <path>","Read comment text from a file or stdin (-)").option("--edit <index>","Replace one comment using positional text, --add, --stdin, or --file",t("--edit")).option("--delete <index>","Delete the comment at 1-based <index>",t("--delete")).option("--limit <n>","Return only latest n comments").option("--full-history","Return complete comment history instead of a bounded mutation receipt").option("--if-absent","Append only when resolved author and text are absent").option("--author [value]","Comment author; defaults to PM_AUTHOR or settings").option("--message <value>","History message").option("--force","Force ownership override").description("List, add, edit, or delete comments for an item.").action(ro);w(o,"--body <text>","Alias for --add",!1),w(o,"--text <text>","Alias for --add",!1),w(o,"--comment <text>","Alias for --add",!1);let i=e.command("notes").argument("<id>","Item id").argument("[text]","Optional note text shorthand for --add").option("--add <text>","Add a text note (- reads stdin)").option("--note <text>","Alias for --add").option("--add-json <json>","Append a JSON event").option("--stdin","Read note text from stdin").option("--file <path>","Read note from file or stdin (-)").option("--edit <index>","Replace a 1-based note using the selected text input",t("--edit")).option("--delete <index>","Delete the note at 1-based <index>",t("--delete")).option("--limit <n>","Return only latest n notes").option("--since <timestamp>","Filter JSON events from this ISO time").option("--event-type <value>","Filter JSON events by top-level type").option("--include-meta","Include count and truncation metadata").option("--full-history","Return complete note history instead of a bounded receipt").option("--if-absent","Append only when resolved author and text are absent").option("--author [value]","Author; defaults to PM_AUTHOR/settings").option("--message <value>","History message").option("--force","Force ownership override").description("Manage merge-safe text notes and JSON context events.").action(lo);w(i,"--text <text>","Alias for --add",!1);let a=e.command("learnings").argument("<id>","Item id").argument("[text]","Optional learning text shorthand for --add").option("--add <text>","Append learning text; use text=<value> or - for stdin").option("--stdin","Read learning text from stdin").option("--file <path>","Read learning text from a file or stdin (-)").option("--edit <index>","Replace one learning using positional text, --add, --stdin, or --file",t("--edit")).option("--delete <index>","Delete the learning at 1-based <index>",t("--delete")).option("--limit <n>","Return only latest n learnings").option("--full-history","Return complete learning history instead of a bounded receipt").option("--if-absent","Append only when resolved author and text are absent").option("--author [value]","Learning author (optional; falls back to PM_AUTHOR/settings)").option("--message <value>","History message").option("--force","Force ownership override").description("List, add, edit, or delete learnings for an item.").action(so);w(a,"--text <text>","Alias for --add",!1)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d861c49e-6054-54af-a733-069cd9238f8a")}catch{}})();function pe(e,t){return o=>{let i=Number(o);if(!Number.isInteger(i)||i<t)throw new u(`${e} must be an integer greater than or equal to ${t}.`,p.USAGE);return i}}async function co(e,t,o){let i=y(o);if(t.scope!==void 0&&t.scope!=="project"&&t.scope!=="global")throw new u("--scope must be either project or global.",p.USAGE);let a=await lt({paths:e,scope:t.scope,limit:typeof t.limit=="number"?t.limit:void 0,offset:typeof t.offset=="number"?t.offset:void 0,noTruncate:t.noTruncate===!0,strictRead:t.strictRead===!0,explain:t.explain===!0,lineRange:typeof t.lines=="string"?nt(t.lines):void 0,decisionDepth:typeof t.decisionDepth=="number"?t.decisionDepth:void 0},i);f(a,i)}function Ft(e){e.command("lookup").argument("<paths...>","Project-relative or absolute source paths").option("--scope <scope>","Restrict links to project or global scope").option("--limit <n>","Maximum referencing items to return",pe("--limit",1)).option("--offset <n>","Number of referencing items to skip",pe("--offset",0)).option("--no-truncate","Return every referencing item").option("--strict-read","Fail when any authoritative item cannot be read").option("--explain","Include ranked source-to-work rationale").option("--lines <start:end>","Attribute an inclusive source line range").option("--decision-depth <n>","Maximum governing-decision relationship depth",pe("--decision-depth",1)).description("Find and explain pm items that govern requested source paths.").action(co)}(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]="016842ad-f6e8-56a4-9b9f-f4eaf4c1be71")}catch{}})();var po=["add-","apply-","list-","remove-","show-"],uo=new Set(["field","fields","help","status","statuses","type","types"]);function ue(e){let t=e.trim(),o=t.toLowerCase();return o.length===0?!1:t[0]===o[0]||uo.has(o)||po.some(i=>o.startsWith(i))}function U(e){if(e!=null){if(typeof e=="number"){if(!Number.isInteger(e))throw new u("--order must be a finite integer.",p.USAGE);return e}if(typeof e=="string"){if(e.trim().length===0)return;let t=Number(e);if(!Number.isInteger(t))throw new u("--order must be a finite integer.",p.USAGE);return t}throw new u("--order must be a finite integer.",p.USAGE)}}(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]="7f9ea812-e170-5c91-a646-88286797d97d")}catch{}})();function M(e){if(Array.isArray(e))return e;if(typeof e=="string")return[e]}var P={};fe(P,{SCHEMA_SUBCOMMANDS:()=>De,_testOnlySchemaCommand:()=>et,formatSchemaAddFieldHuman:()=>Ke,formatSchemaAddStatusHuman:()=>je,formatSchemaAddTypeHuman:()=>Ge,formatSchemaApplyPresetHuman:()=>Ze,formatSchemaEvolutionMigrationHuman:()=>Ce,formatSchemaInferTypesHuman:()=>Qe,formatSchemaListFieldsHuman:()=>Xe,formatSchemaListHuman:()=>Ve,formatSchemaRemoveFieldHuman:()=>We,formatSchemaRemoveStatusHuman:()=>qe,formatSchemaRemoveTypeHuman:()=>Be,formatSchemaShowFieldHuman:()=>Ye,formatSchemaShowHuman:()=>ze,formatSchemaShowStatusHuman:()=>Je,runSchemaAddField:()=>Pe,runSchemaAddStatus:()=>Te,runSchemaAddType:()=>Ie,runSchemaApplyPreset:()=>He,runSchemaEvolutionMigration:()=>xe,runSchemaInferTypes:()=>Ue,runSchemaList:()=>Oe,runSchemaListFields:()=>Le,runSchemaRemoveField:()=>Ne,runSchemaRemoveStatus:()=>Ee,runSchemaRemoveType:()=>Re,runSchemaShow:()=>Fe,runSchemaShowField:()=>$e,runSchemaShowStatus:()=>Me,runWorkflowPolicyAction:()=>H});(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a4b4d693-ba4c-529a-a5d4-8f6c874830ad")}catch{}})();(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]="f3dbaad8-f73e-5d14-aeaa-aaf077a944f6")}catch{}})();function mo(e,t){let o=t.normalizedSubcommand;return o!=="rename-type"&&o!=="rename-field"&&o!=="remap-status"?null:e.runSchemaEvolutionMigration({kind:o,from:t.typeName,to:l(t.options,"to"),...o==="rename-field"&&typeof t.options.type=="string"?{type:t.options.type}:{}},{migrationId:l(t.options,"migrationId")??l(t.options,"migration_id"),dryRun:t.options.dryRun===!0,author:t.author,force:t.force},t.globalOptions)}function fo(e,t){let{normalizedSubcommand:o,typeName:i,globalOptions:a,author:r,force:n}=t;switch(o){case"list":return e.runSchemaList(a);case"show":return e.runSchemaShow(i,a);case"show-status":return e.runSchemaShowStatus(i,a);case"list-fields":return e.runSchemaListFields(a);case"show-field":return e.runSchemaShowField(i,a);case"remove-type":return e.runSchemaRemoveType(i,{author:r,force:n},a);case"remove-field":return e.runSchemaRemoveField(i,{author:r,force:n},a);case"remove-status":return e.runSchemaRemoveStatus(i,{author:r,force:n},a);case"apply-preset":return e.runSchemaApplyPreset(i,{author:r,force:n},a);default:return null}}async function yo(e,t){let{normalizedSubcommand:o,typeName:i,options:a,globalOptions:r}=t,{author:n,force:s,description:d}=t,m=mo(e,t);if(m)return m;let g=fo(e,t);if(g)return g;switch(o){case"add-field":return e.runSchemaAddField(i,{type:typeof a.type=="string"?a.type:void 0,commands:t.commands,description:d,cliFlag:typeof a.cliFlag=="string"?a.cliFlag:void 0,alias:t.aliases,required:!!a.required,requiredOnCreate:!!a.requiredOnCreate,allowUnset:a.allowUnset!==!1,requiredTypes:t.requiredTypes,author:n,force:s},r);case"add-status":return e.runSchemaAddStatus(i,{role:t.roles,alias:t.aliases,description:d,order:t.order,author:n,force:s},r);default:return a.infer===!0?e.runSchemaInferTypes({minCount:t.minCount,apply:!!a.apply,author:n,force:s},r):e.runSchemaAddType(i,{description:d,defaultStatus:t.defaultStatus,folder:typeof a.folder=="string"?a.folder:void 0,alias:t.aliases,author:n,force:s},r)}}function go(e,t){if("migration_id"in t){h(`${e.formatSchemaEvolutionMigrationHuman(t)}
|
|
2
|
-
`);return}switch(t.action){case"list":h(`${e.formatSchemaListHuman(t)}
|
|
3
|
-
`);return;case"show":h(`${e.formatSchemaShowHuman(t)}
|
|
4
|
-
`);return;case"show-status":h(`${e.formatSchemaShowStatusHuman(t)}
|
|
5
|
-
`);return;case"list-fields":h(`${e.formatSchemaListFieldsHuman(t)}
|
|
6
|
-
`);return;case"show-field":h(`${e.formatSchemaShowFieldHuman(t)}
|
|
7
|
-
`);return;case"remove-type":h(`${e.formatSchemaRemoveTypeHuman(t)}
|
|
8
|
-
`);break;case"remove-field":h(`${e.formatSchemaRemoveFieldHuman(t)}
|
|
9
|
-
`);break;case"apply-preset":h(`${e.formatSchemaApplyPresetHuman(t)}
|
|
10
|
-
`);break;case"infer-types":h(`${e.formatSchemaInferTypesHuman(t)}
|
|
11
|
-
`);break;case"add-field":h(`${e.formatSchemaAddFieldHuman(t)}
|
|
12
|
-
`);break;case"add-status":h(`${e.formatSchemaAddStatusHuman(t)}
|
|
13
|
-
`);break;case"remove-status":h(`${e.formatSchemaRemoveStatusHuman(t)}
|
|
14
|
-
`);break;default:h(`${e.formatSchemaAddTypeHuman(t)}
|
|
15
|
-
`);break}t.warnings.length>0&&v(`schema ${t.action} warnings: ${$(t.warnings)}`)}function Mt(e){if(Array.isArray(e))return e.flatMap(t=>t.split(",")).map(t=>t.trim()).filter(t=>t.length>0)}async function vo(e,t,o,i){let a=y(i),r=Date.now(),{SCHEMA_SUBCOMMANDS:n}=P,s=(e??"").trim().toLowerCase(),d=t;if(ho(s,n),!n.includes(s)&&d===void 0&&!ue(e)&&(d=e,s="add-type"),!n.includes(s))throw I({command_path:"schema",token:s,allowed:n});let m=ve.find(g=>g===s);if(we(s,o.dryRun===!0),m)f(await H(m,t,{definition:o.definition,policy:l(o,"policy"),message:l(o,"message"),author:l(o,"author"),dryRun:o.dryRun===!0},a),a);else{let g=await yo(P,{normalizedSubcommand:s,typeName:d,options:o,aliases:M(o.alias),roles:M(o.role),commands:Mt(o.commands),requiredTypes:Mt(o.requiredTypes),defaultStatus:l(o,"defaultStatus")??l(o,"default_status"),order:U(o.order),minCount:U(o.minCount),author:l(o,"author"),force:!!o.force,description:l(o,"description"),globalOptions:a});a.json===!0||a.defaultOutputFormat==="json"?f(g,a):a.quiet||go(P,g)}a.profile&&v(`profile:command=schema took_ms=${Date.now()-r}`)}function ho(e,t){if(!e)throw new u(`pm schema requires a subcommand. Allowed: ${t.join(", ")}`,p.USAGE,{code:"missing_required_argument",examples:["pm schema list","pm schema show Task","pm schema show-status open",'pm schema add-type Spike --description "Time-boxed investigation" --default-status open',"pm schema remove-type Spike","pm schema add-status review --role active --alias in_review","pm schema remove-status review","pm schema add-field severity_level --type string --commands create,update","pm schema list-fields","pm schema apply-preset agile","pm schema add-type --infer --min-count 10","pm schema rename-type Spike --to Experiment --migration-id spike-v2 --dry-run","pm schema rename-field severity --to impact --migration-id severity-v2","pm schema remap-status review --to verifying --migration-id review-v2"]})}function Pt(e){let t=e.command("schema").option("--definition <json>","Policy or proposed fields JSON").option("--policy <id>","Policy id for policy-approve").option("--message <text>","Audit rationale for a policy mutation").argument("[subcommand]","Required; schema verb (list/show, add/remove, rename/remap, policy-*), or custom type shorthand").argument("[name]","Definition/source name or item id; policy-mode: advise|refuse").option("--description <text>","Type, status, or field description").option("--default-status <status>","Default status for this type").option("--folder <dir>","Storage folder for items of this custom type").option("--alias <name>","Alias for the custom type, status, or field flag (repeatable, csv-friendly)",c).option("--role <value>","Lifecycle role for a custom status (repeatable): draft, active, blocked, terminal, terminal_done, terminal_canceled, default_open, default_close, default_cancel",c).option("--order <n>","Display/sort order for a custom status").optionsGroup("Field options (add-field):").option("--type <type>","Value type for a custom field (add-field): string, number, boolean, string_array, array, object").option("--commands <list>","Field commands (repeatable/csv): create, update, update_many, list, search, calendar, context",c).option("--cli-flag <flag>","Override the auto-derived CLI flag for a custom field (add-field)").option("--required","Mark a custom field as always required (add-field)").option("--required-on-create","Mark a custom field as required at create time (add-field)").option("--no-allow-unset","Disallow clearing a custom field via --unset (add-field)").option("--required-types <list>","Restrict a custom field's requirement to specific item types (add-field; repeatable, comma-friendly)",c).optionsGroup("Type inference and migration options:").option("--infer","Infer custom item types from title-prefix conventions (add-type; preview unless --apply)").option("--min-count <n>","Minimum items sharing a prefix for add-type --infer (default 10)").option("--apply","Register inferred types (add-type --infer); without it the command previews only").option("--to <name>","Target definition name for rename/remap migrations").option("--migration-id <id>","Stable idempotency key for a resumable schema migration").option("--dry-run","Preview rename/remap migrations and workflow-policy actions without writes").option("--author <value>","Mutation author").option("--force","Force ownership/lock override").description("Manage types, statuses, fields, presets, and workflow policies.");w(t,"--default_status <status>","Alias for --default-status",!1),w(t,"--migration_id <id>","Alias for --migration-id",!1),t.action(vo)}(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]="648325fa-04f5-5fd5-bad1-161cb0fdb790")}catch{}})();var bo=new Set(ye.map(e=>e.toLowerCase())),wo=new Set(ke.map(e=>e==="estimate"?"estimatedMinutes":e));async function So(e,t,o,i,a){switch(t){case"list":return e.runProfileList();case"show":return e.runProfileShow(o);case"lint":return e.runProfileLint(o);default:return e.runProfileApply(o,{dryRun:i.dryRun===!0,author:typeof i.author=="string"?i.author:void 0,force:i.force===!0},a)}}function Ao(e,t){switch(t.action){case"list":h(`${e.formatProfileListHuman(t)}
|
|
16
|
-
`);return;case"show":h(`${e.formatProfileShowHuman(t)}
|
|
17
|
-
`);return;case"lint":h(`${e.formatProfileLintHuman(t)}
|
|
18
|
-
`);return;default:h(`${e.formatProfileApplyHuman(t)}
|
|
19
|
-
`),t.warnings.length>0&&v(`profile apply warnings: ${$(t.warnings)}`);break}}function ko(e){return t=>{let o=Number(t);if(!Number.isInteger(o)||o<1)throw new u(`${e} must be a positive integer (1-based index).`,p.USAGE);return o}}function Nt(e,t){e.option("--filter-has-notes",`Select only items that have notes before ${t}`).option("--filter-no-notes",`Select only items that have no notes before ${t}`).option("--filter-has-learnings",`Select only items that have learnings before ${t}`).option("--filter-no-learnings",`Select only items that have no learnings before ${t}`).option("--filter-has-files",`Select only items that have linked files before ${t}`).option("--filter-no-files",`Select only items that have no linked files before ${t}`).option("--filter-has-docs",`Select only items that have linked docs before ${t}`).option("--filter-no-docs",`Select only items that have no linked docs before ${t}`).option("--filter-has-tests",`Select only items that have linked tests before ${t}`).option("--filter-no-tests",`Select only items that have no linked tests before ${t}`).option("--filter-has-comments",`Select only items that have comments before ${t}`).option("--filter-no-comments",`Select only items that have no comments before ${t}`).option("--filter-has-deps",`Select only items that have dependencies before ${t}`).option("--filter-no-deps",`Select only items that have no dependencies before ${t}`).option("--filter-has-body",`Select only items that have a non-empty body before ${t}`).option("--filter-empty-body",`Select only items with an empty body before ${t}`).option("--filter-has-linked-command",`Select only items whose linked tests carry a runnable command before ${t}`).option("--filter-no-linked-command",`Select only items whose linked tests carry no runnable command before ${t}`).option("--filter-reviewer-missing",`Select only items missing reviewer before ${t}`).option("--filter-risk-missing",`Select only items missing risk before ${t}`).option("--filter-confidence-missing",`Select only items missing confidence before ${t}`).option("--filter-sprint-missing",`Select only items missing sprint before ${t}`).option("--filter-release-missing",`Select only items missing release before ${t}`)}var _o=[["filterHasNotes","filterNoNotes","--filter-has-notes","--filter-no-notes"],["filterHasLearnings","filterNoLearnings","--filter-has-learnings","--filter-no-learnings"],["filterHasFiles","filterNoFiles","--filter-has-files","--filter-no-files"],["filterHasDocs","filterNoDocs","--filter-has-docs","--filter-no-docs"],["filterHasTests","filterNoTests","--filter-has-tests","--filter-no-tests"],["filterHasComments","filterNoComments","--filter-has-comments","--filter-no-comments"],["filterHasDeps","filterNoDeps","--filter-has-deps","--filter-no-deps"],["filterHasBody","filterEmptyBody","--filter-has-body","--filter-empty-body"],["filterHasLinkedCommand","filterNoLinkedCommand","--filter-has-linked-command","--filter-no-linked-command"]];function Lt(e){let t=o=>e[o]===!0?!0:void 0;for(let[o,i,a,r]of _o)if(e[o]===!0&&e[i]===!0)throw new u(`Cannot combine ${a} with ${r} for the same field.`,p.USAGE);return{filterReviewerMissing:t("filterReviewerMissing"),filterRiskMissing:t("filterRiskMissing"),filterConfidenceMissing:t("filterConfidenceMissing"),filterSprintMissing:t("filterSprintMissing"),filterReleaseMissing:t("filterReleaseMissing"),hasNotes:t("filterHasNotes"),hasLearnings:t("filterHasLearnings"),hasFiles:t("filterHasFiles"),hasDocs:t("filterHasDocs"),hasTests:t("filterHasTests"),hasComments:t("filterHasComments"),hasDeps:t("filterHasDeps"),hasBody:t("filterHasBody"),hasLinkedCommand:t("filterHasLinkedCommand"),noNotes:t("filterNoNotes"),noLearnings:t("filterNoLearnings"),noFiles:t("filterNoFiles"),noDocs:t("filterNoDocs"),noTests:t("filterNoTests"),noComments:t("filterNoComments"),noDeps:t("filterNoDeps"),emptyBody:t("filterEmptyBody"),noLinkedCommand:t("filterNoLinkedCommand")}}function me(e,t){for(let o of t){let i=[],a=e.args,r=n=>(e.args!==a&&(i.length=0,a=e.args),i.push(n),i);o.required?e.requiredOption(o.option,o.description):o.repeatable?e.option(o.option,o.description,r):e.option(o.option,o.description);for(let n of o.aliasOptions??[])K(o.option,n.option)?w(e,n.option,n.description,o.repeatable===!0,o.repeatable?r:void 0):o.repeatable?e.option(n.option,n.description,r):e.option(n.option,n.description)}}function xo(e){let t=o=>typeof e[o]=="string"?e[o]:void 0;return{type:t("filterType"),tag:t("filterTag"),priority:t("filterPriority"),deadlineBefore:t("filterDeadlineBefore"),deadlineAfter:t("filterDeadlineAfter"),updatedAfter:t("filterUpdatedAfter"),updatedBefore:t("filterUpdatedBefore"),createdAfter:t("filterCreatedAfter"),createdBefore:t("filterCreatedBefore"),ids:t("ids"),assignee:t("filterAssignee"),assigneeFilter:t("filterAssigneeFilter")??t("filterAssignee_filter"),parent:t("filterParent"),sprint:t("filterSprint"),release:t("filterRelease"),filterAcMissing:e.filterAcMissing===!0?!0:void 0,filterEstimatesMissing:e.filterEstimatesMissing===!0||e.filterEstimateMissing===!0?!0:void 0,filterResolutionMissing:e.filterResolutionMissing===!0?!0:void 0,filterMetadataMissing:e.filterMetadataMissing===!0?!0:void 0,...Lt(e),limit:t("limit"),offset:t("offset"),includeBody:!0}}function N(...e){for(let t of e)if(typeof t=="string")return t}function Co(e,t,o){if(!(e!=="many"||t!==void 0||o.title!==void 0||o.type!==void 0))throw new u("pm create many is not a command; bulk creation is pm item mutate.",p.USAGE,{code:"bulk_create_route",required:"Pipe a JSON array, JSON Lines, or {schema_version, mutations} document to pm item mutate, or pass --from <path>.",why:"pm item mutate commits every record in one workspace transaction with a replay-safe transaction id, so an interrupted or repeated import never duplicates items.",nextSteps:["pm item mutate --from items.jsonl --dry-run --json","pm item mutate --from items.jsonl --upsert-key external_id --json","pm guide lifecycle"],examples:["pm item mutate --from items.jsonl --json",`printf '%s\\n' '{"title":"First","type":"Task"}' '{"title":"Second","type":"Task"}' | pm item mutate --json`]})}function Do(e,t,o){return typeof t=="string"&&t.length>0?{positionalType:e,positionalTitle:t}:typeof e!="string"||e.length===0?{positionalType:void 0,positionalTitle:void 0}:typeof o.title=="string"&&o.title.trim().length>0&&o.type===void 0?{positionalType:e,positionalTitle:void 0}:{positionalType:void 0,positionalTitle:e}}function Io(e,t,o){if(e!==void 0||typeof t!="string"||t.length===0||o.title!==void 0||o.type!==void 0||!bo.has(t.trim().toLowerCase()))return;let i=t.trim();throw new u(`pm create needs a title \u2014 "${i}" looks like an item type, not a title. Use either: pm create ${i} "<title>" or pm create "<title>" --type ${i}.`,p.USAGE,{code:"create_positional_type_without_title",why:'Without this guard the single positional is used as the title and the type defaults to Task \u2014 so the command would silently create a Task literally titled "'+i+'".',examples:[`pm create ${i} "Wire up SSO for the agent harness"`,`pm create "Wire up SSO for the agent harness" --type ${i}`],nextSteps:[`Re-run with both type and title: pm create ${i} "<title>"`]})}var Ro=["body","bodyFile","description","dep","depRemove","comment","note","learning","file","test","doc","reminder","event","typeOption","field","ids"];function G(e){let t=Ro.flatMap(o=>{let i=e[o],a=typeof i=="string"&&i.trim()==="-"?1:Array.isArray(i)?i.filter(n=>typeof n=="string"&&n.trim()==="-").length:0,r=`--${o.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}`;return Array.from({length:a},()=>r)});if(e.stdinJson===!0&&t.unshift("--stdin-json"),t.length>1)throw new u(`Only one option may consume stdin per command invocation. Found: ${t.join(", ")}.`,p.USAGE)}function $t(e,t,o){let i=[];t&&i.push("body"),o&&i.push("description"),Se(e,i)}function Ht(e,t){return!t&&typeof e.description=="string"&&e.description.trim()==="-"}async function Ut(e,t,o,i){let a=await T(x(process.cwd(),i.path));return St(e,t,o,be(a.schema).definitions)}async function To(e,t,o,i){let a=y(i),r=Date.now();G(o);let n=o.stdinJson===!0;if(n){let A=await C().resolveValue("-","--stdin-json");o=await Ut(A??"","create",o,a)}Co(e,t,o);let s=Do(e,t,o);Io(s.positionalType,s.positionalTitle,o),typeof s.positionalType=="string"&&s.positionalType.length>0&&o.type===void 0&&(o.type=s.positionalType),typeof s.positionalTitle=="string"&&s.positionalTitle.length>0&&o.title===void 0&&(o.title=s.positionalTitle);let d=Ht(o,n);n||await se(o);let m=typeof o.bodyFile=="string";m&&(o.body=await J(String(o.bodyFile),o.body!==void 0?String(o.body):void 0),delete o.bodyFile);let g=X(o,{requireType:!1});$t(g,m,d),n&&V(g);let S=await ut(g,a);await b(a,S),f(S,a),a.profile&&v(`profile:command=create took_ms=${Date.now()-r}`)}function Eo(e){return{type:l(e,"filterType"),tag:l(e,"filterTag"),priority:l(e,"filterPriority"),deadlineBefore:l(e,"filterDeadlineBefore"),deadlineAfter:l(e,"filterDeadlineAfter"),updatedAfter:l(e,"filterUpdatedAfter"),updatedBefore:l(e,"filterUpdatedBefore"),createdAfter:l(e,"filterCreatedAfter"),createdBefore:l(e,"filterCreatedBefore"),ids:l(e,"ids"),assignee:l(e,"filterAssignee"),assigneeFilter:N(e.filterAssigneeFilter,e.filterAssignee_filter),parent:l(e,"filterParent"),sprint:l(e,"filterSprint"),release:l(e,"filterRelease"),...Lt(e),limit:l(e,"limit"),offset:l(e,"offset")}}async function Oo(e,t){let o=y(t),i=Date.now();G(e),e.ids=await z(l(e,"ids"));let a=await pt({status:l(e,"filterStatus"),list:Eo(e),reason:l(e,"reason"),completedAt:l(e,"completedAt"),resolution:l(e,"resolution"),expectedResult:N(e.expectedResult,e.expected_result,e.expected),actualResult:N(e.actualResult,e.actual_result,e.actual),validateClose:e.validateClose===!0?"warn":l(e,"validateClose"),author:l(e,"author"),message:l(e,"message"),force:!!e.force,dryRun:e.dryRun===!0?!0:void 0,rollback:l(e,"rollback"),checkpoint:e.checkpoint===!1?!1:void 0},o);await b(o,a),f(a,o),o.profile&&v(`profile:command=close-many took_ms=${Date.now()-i}`)}async function Fo(e,t){let o=y(t),i=Date.now();G(e),e.ids=await z(l(e,"ids"));let a=await ht({status:l(e,"filterStatus"),list:xo(e),update:Y(_e(e)),dryRun:e.dryRun===!0?!0:void 0,rollback:l(e,"rollback"),checkpoint:e.checkpoint===!1?!1:void 0},o);await b(o,a),f(await E("update-many",[],e,o,a),o),o.profile&&v(`profile:command=update-many took_ms=${Date.now()-i}`)}async function Mo(e,t,o,i){let a=y(i),r=Date.now(),n=typeof o.reason=="string"&&o.reason.trim().length>0&&o.reason||typeof o.closeReason=="string"&&o.closeReason.trim().length>0&&o.closeReason||void 0,s=typeof t=="string"&&t.length>0?t:n,d=await(o.releaseAssignment===!0?yt:ee)(e,s,{author:l(o,"author"),message:l(o,"message"),validateClose:o.validateClose===!0?"warn":l(o,"validateClose"),force:!!o.force,duplicateOf:l(o,"duplicateOf"),completedAt:l(o,"completedAt"),resolution:l(o,"resolution"),expectedResult:N(o.expectedResult,o.expected_result,o.expected),actualResult:N(o.actualResult,o.actual_result,o.actual)},a);await b(a,d),f(d,a),a.profile&&v(`profile:command=close took_ms=${Date.now()-r}`)}function Po(e){let t={...e},o=[["blocked_by","blockedBy"],["resume_context","resumeContext"],["from_search","fromSearch"],["step_title","stepTitle"],["step_body","stepBody"],["step_owner","stepOwner"],["step_status","stepStatus"],["step_evidence","stepEvidence"],["step_blocked_reason","stepBlockedReason"],["step_replacement","stepReplacement"],["depends_on","dependsOn"],["link_kind","linkKind"],["link_note","linkNote"],["promote_to_item_dep","promoteToItemDep"],["allow_multiple_active","allowMultipleActive"],["decision_text","decisionText"],["decision_rationale","decisionRationale"],["decision_evidence","decisionEvidence"],["discovery_text","discoveryText"],["validation_text","validationText"],["validation_command","validationCommand"],["validation_expected","validationExpected"],["materialize_type","materializeType"],["materialize_parent","materializeParent"],["materialize_tags","materializeTags"]];for(let[a,r]of o)t[a]!==void 0&&t[r]===void 0&&(t[r]=t[a]);let i=X(t,{requireType:!1});return i.blockedBy=t.blockedBy,i}function No(e,t){if(!e)throw new u(`pm plan requires a subcommand. Allowed: ${t.join(", ")}`,p.USAGE,{code:"missing_required_argument",examples:['pm plan create --title "Refactor lock retry"',"pm plan show pm-a1b2 --depth standard",'pm plan add-step pm-a1b2 --step-title "Read lock.ts"']});if(!t.includes(e))throw I({command_path:"plan",token:e,allowed:t,examples:e==="list"||e==="ls"?["pm list --type Plan","pm list --all --type Plan"]:void 0,retry_command:e==="list"||e==="ls"?"pm list --type Plan":void 0})}function Lo(e,t){if(e!=="reorder-step"||typeof t!="string")return;let o=Number.parseInt(t,10);if(!Number.isFinite(o))throw new u(`reorder-step requires an integer new order, got "${t}"`,p.USAGE);return o}async function $o(e,t,o,i,a,r){let n=y(r),s=Date.now(),d=(e??"").trim().toLowerCase();No(d,gt);let m=Po(a),g=Lo(d,i),S=d==="create"&&typeof t=="string"&&t.length>0&&m.title===void 0?void 0:t;S===void 0&&typeof t=="string"&&t.length>0&&(m.title=t);let A=await vt({subcommand:d,id:S,stepRef:o,reorderTo:g,options:m,global:n});await b(n,A),f(A,n),n.profile&&v(`profile:command=plan took_ms=${Date.now()-s}`)}async function Ho(e,t,o){if(e!==void 0)throw new u("merge reconcile takes no positional arguments.",p.USAGE);let i=await re({dryRun:t.dryRun===!0,force:t.force===!0,stage:t.stage===!0,message:typeof t.message=="string"?t.message:void 0,author:o.author},o);f(i,o),i.ok||(process.exitCode=p.GENERIC_FAILURE)}async function Uo(e,t,o,i,a,r){if(e===void 0||t===void 0||o===void 0||i===void 0)throw new u("merge driver requires <artifact> <base> <ours> <theirs> (git supplies %O %A %B). Example: pm merge driver history %O %A %B",p.USAGE);let n=await ne({artifact:e,basePath:t,oursPath:o,theirsPath:i,outputPath:typeof a.output=="string"?a.output:void 0,itemPath:typeof a.itemPath=="string"?a.itemPath:void 0,prefer:typeof a.prefer=="string"?a.prefer:void 0},r);f(n,r),n.ok||(process.exitCode=p.GENERIC_FAILURE)}async function Go(e,t,o,i,a,r,n){let s=y(n),d=Date.now();switch(e.trim().toLowerCase()){case"install":{if(t!==void 0)throw new u("merge install takes no positional arguments.",p.USAGE);let m=await Z({dryRun:r.dryRun===!0,preCommitHook:r.preCommitHook===!0},s);f(m,s);break}case"reconcile":await Ho(t,r,s);break;case"report":{if(t!==void 0)throw new u("merge report takes no positional arguments.",p.USAGE);let m=await Q({includeReconciled:r.includeReconciled===!0});f(m,s),m.ok||(process.exitCode=p.GENERIC_FAILURE);break}case"driver":await Uo(t,o,i,a,r,s);break;default:throw I({command_path:"merge",token:e,allowed:B,display_name:"merge"})}s.profile&&v(`profile:command=merge took_ms=${Date.now()-d}`)}async function Bo(e,t,o){let i=y(o),a=Date.now(),r=await te(e,{title:l(t,"title"),author:l(t,"author"),message:l(t,"message"),allowDuplicate:t.allowDuplicate===!0},i);await b(i,r),f(r,i),i.profile&&v(`profile:command=copy took_ms=${Date.now()-a}`)}async function jo(e,t,o){let i=y(o),a=Date.now(),r=await ie(e,{clear:t.clear===!0},i);f(r,i),i.profile&&v(`profile:command=focus took_ms=${Date.now()-a}`)}async function qo(e,t,o){let i=y(o),a=Date.now();G(t);let r=t.stdinJson===!0;if(r){let g=await C().resolveValue("-","--stdin-json");t=await Ut(g??"","update",t,i)}let n=Ht(t,r);r||await se(t);let s=typeof t.bodyFile=="string";s&&(t.body=await J(String(t.bodyFile),t.body!==void 0?String(t.body):void 0),delete t.bodyFile);let d=Y(t);$t(d,s,n),r&&V(d);let m=await mt(e,d,i);await b(i,m),f(await E("update",[e],t,i,m),i),i.profile&&v(`profile:command=update took_ms=${Date.now()-a}`)}async function Vo(e,t,o){let i=y(o),a=Date.now(),r=await oe(e,{author:l(t,"author"),message:l(t,"message"),force:!!t.force,dryRun:t.dryRun===!0},i);r.dry_run!==!0&&await b(i,r),f(r,i),i.profile&&v(`profile:command=delete took_ms=${Date.now()-a}`)}function zo(e,t){let o=l(t,"body"),i=l(t,"text"),a=typeof e=="string"?e:void 0;if([o,i,a].filter(n=>n!==void 0).length>1)throw new u("Specify append text with exactly one source: positional [text], --body, or --text",p.USAGE);let r=o??i??a;if(r===void 0)throw new u("Missing append text. Provide it as positional [text], --body <value>, or --text <value> (use - for stdin).",p.USAGE);return r}async function Jo(e,t,o,i){let a=y(i),r=Date.now(),n=await ct(e,{body:zo(t,o),author:l(o,"author"),message:l(o,"message"),force:!!o.force},a);await b(a,n),f(n,a),a.profile&&v(`profile:command=append took_ms=${Date.now()-r}`)}async function Ko(e,t,o,i){let a=y(i),r=Date.now(),{PROFILE_SUBCOMMANDS:n}=F,s=(e??"").trim().toLowerCase();if(!s)throw new u(`pm profile requires a subcommand. Allowed: ${n.join(", ")}`,p.USAGE,{code:"missing_required_argument",examples:["pm profile list","pm profile show agile","pm profile apply agile --dry-run","pm profile lint agile"]});if(!n.includes(s))throw I({command_path:"profile",token:s,allowed:n});let d=await So(F,s,t,o,a);a.json===!0||a.defaultOutputFormat==="json"?f(d,a):a.quiet||Ao(F,d),d.action==="lint"&&!d.ok&&(process.exitCode=p.GENERIC_FAILURE),a.profile&&v(`profile:command=profile took_ms=${Date.now()-r}`)}function _(e,t){return M(e[t])??[]}async function Wo(e,t,o){let i=y(o),a=Date.now(),r=_(t,"add"),n=_(t,"addGlob"),s=_(t,"remove"),d=_(t,"migrate"),m=await rt(e,{add:r,addGlob:n,remove:s,migrate:d,note:l(t,"note"),list:!!t.list,appendStable:!!t.appendStable,validatePaths:!!t.validatePaths,author:l(t,"author"),message:l(t,"message"),force:!!t.force},i);(r.length>0||n.length>0||s.length>0||d.length>0)&&await b(i,m),f(await E("files",[e],t,i,m),i),i.profile&&v(`profile:command=files took_ms=${Date.now()-a}`)}async function Xo(e,t,o){let i=y(o),a=Date.now(),r={...o.optsWithGlobals(),...t},n=await st(e,{apply:!!r.apply,note:l(r,"note"),appendStable:!!r.appendStable,author:l(r,"author"),message:l(r,"message"),force:!!r.force},i);n.changed&&await b(i,n),f(n,i),i.profile&&v(`profile:command=files.discover took_ms=${Date.now()-a}`)}async function Yo(e,t,o){let i=y(o),a=Date.now(),r=_(t,"add"),n=_(t,"addGlob"),s=_(t,"remove"),d=_(t,"migrate"),m=await at(e,{add:r,addGlob:n,remove:s,migrate:d,note:l(t,"note"),list:!!t.list,validatePaths:!!t.validatePaths,author:l(t,"author"),message:l(t,"message"),force:!!t.force},i);(r.length>0||n.length>0||s.length>0||d.length>0)&&await b(i,m),f(await E("docs",[e],t,i,m),i),i.profile&&v(`profile:command=docs took_ms=${Date.now()-a}`)}async function Zo(e,t,o){let i=y(o),a=Date.now(),r=await it(e,{format:t.format,maxDepth:l(t,"maxDepth"),collapse:t.collapse,summary:t.summary===!0,full:t.full===!0,nodeLimit:l(t,"nodeLimit"),edgeLimit:l(t,"edgeLimit"),tokenBudget:l(t,"tokenBudget"),cursor:l(t,"cursor"),direction:l(t,"direction"),...Array.isArray(t.kind)?{kind:t.kind}:{}},i);f(r,i),i.profile&&v(`profile:command=deps took_ms=${Date.now()-a}`)}function Ka(e,t={}){let o=e.command("create").argument("[type-or-title]",'Title, or type followed by title (e.g. task "Fix bug")').argument("[title]","Title following an item type").description("Create a new project management item.");if(me(o,W),o.option("--stdin-json","Item JSON from stdin; explicit flags override").option("--body-file <path>","Load body from a file or stdin (-); conflicts with --body").option("--clear-deps","Clear dependency entries").option("--clear-comments","Clear comments").option("--clear-notes","Clear notes").option("--clear-learnings","Clear learnings").option("--clear-files","Clear linked files").option("--clear-tests","Clear linked tests").option("--clear-docs","Clear linked docs").option("--clear-reminders","Clear reminders").option("--clear-events","Clear events").option("--clear-type-options","Clear type options").option("--allow-duplicate","Explicitly create even when strict similarity governance finds likely duplicates").option("--inherit-focus","Use saved focus as parent (CLI default; SDK/MCP opt in)",!0).option("--no-inherit-focus","Ignore saved focus; --unset parent also suppresses it").action(To),t.targetCommandName==="create")return;e.command("copy").argument("<id>","Source item id").option("--title <value>","Optional title override for the copied item").option("--author <value>","Mutation author").option("--message <value>","History message").option("--allow-duplicate","Explicitly copy even when strict similarity governance finds likely duplicates").description("Copy an item into a new item id while resetting lifecycle fields.").action(Bo),e.command("focus").argument("[id]","Item id to focus (omit to show current focus)").option("--clear","Clear the focused item").description("Set/clear/show the session focused item that new items default --parent to.").action(jo);let i=e.command("update").argument("<id>","Item id").description("Update item fields and metadata.");me(i,Ae),i.option("--stdin-json","Read a full item JSON document from stdin; explicit flags override document values").option("--body-file <path>","Load body from a file or stdin (-); conflicts with --body").option("--replace-deps","Atomically replace dependency entries with the provided --dep values").option("--replace-tests","Atomically replace linked test entries with the provided --test values").option("--replace-files","Atomically replace linked file entries with the provided --file values").option("--replace-docs","Atomically replace linked doc entries with the provided --doc values").option("--clear-deps","Clear dependency entries").option("--clear-comments","Clear comments").option("--clear-notes","Clear notes").option("--clear-learnings","Clear learnings").option("--clear-files","Clear linked files").option("--clear-tests","Clear linked tests").option("--clear-docs","Clear linked docs").option("--clear-reminders","Clear reminders").option("--clear-events","Clear events").option("--clear-type-options","Clear type options").option("--force","Force ownership override"),i.action(qo),It(e);let a=e.command("update-many").description("Bulk-update matched items with dry-run plans and rollback checkpoints.").option("--filter-status <value>","Filter by status before applying updates").option("--filter-type <value>","Filter by item type before applying updates").option("--filter-tag <value>","Filter by tag before applying updates").option("--filter-priority <value>","Filter by priority before applying updates").option("--filter-deadline-before <value>","Filter by deadline upper bound before applying updates").option("--filter-deadline-after <value>","Filter by deadline lower bound before applying updates").option("--filter-updated-after <value>","Filter by updated_at lower bound before applying updates (ISO/relative)").option("--filter-updated-before <value>","Filter by updated_at upper bound before applying updates (ISO/relative)").option("--filter-created-after <value>","Filter by created_at lower bound before applying updates (ISO/relative)").option("--filter-created-before <value>","Filter by created_at upper bound before applying updates (ISO/relative)").option("--filter-assignee <value>","Filter by assignee before applying updates").option("--filter-assignee-filter <value>","Filter assignee presence: assigned|unassigned before applying updates").option("--filter-parent <value>","Filter by parent item ID before applying updates").option("--filter-sprint <value>","Filter by sprint before applying updates").option("--filter-release <value>","Filter by release before applying updates").option("--filter-ac-missing","Select only items missing acceptance_criteria (bulk backfill)").option("--filter-estimates-missing","Select only items missing estimated_minutes (bulk backfill)").option("--filter-resolution-missing","Select only terminal items missing resolution (bulk backfill)").option("--filter-metadata-missing","Select only items missing any tracked metadata (AC, estimate, or resolution)");Nt(a,"applying updates"),a.option("--ids <value>","Explicit ID allowlist: comma/newline text, - stdin, or @path file").option("--limit <n>","Limit matched item count before apply/preview").option("--offset <n>","Skip first n matched rows before apply/preview").option("--dry-run","Preview per-item diffs and checkpoint intent without mutating").option("--rollback <value>","Rollback a prior update-many checkpoint ID").option("--no-checkpoint","Disable checkpoint creation during apply mode").option("--title, -t <value>","Set title").option("--description, -d <value>","Set description").option("--body, -b <value>","Set body (allow empty string)").option("--status, -s <value>","Set status (use close command for closed)").option("--priority, -p <value>","Set priority").option("--type <value>","Set type").option("--tags <value>","Set comma-separated tags (replaces existing). Use --add-tags / --remove-tags to mutate additively.").option("--add-tags <value>","Add tags additively without replacing existing (repeatable; CSV accepted)",c).option("--remove-tags <value>","Remove tags from the existing list (repeatable; CSV accepted)",c).option("--deadline <value>","Set deadline (ISO/date string or relative)").option("--estimate, --estimated-minutes <value>","Set estimated minutes").option("--acceptance-criteria <value>","Set acceptance criteria").option("--ac <value>","Alias for --acceptance-criteria").option("--add-ac <value>","Add one semicolon-free acceptance criterion without replacing the existing list (repeatable)",c).option("--remove-ac <value>","Remove one semicolon-free acceptance criterion by exact text match (repeatable)",c).option("--definition-of-ready <value>","Set definition of ready").option("--order <value>","Set planning order/rank integer").option("--rank <value>","Alias for --order").option("--goal <value>","Set goal identifier").option("--objective <value>","Set objective identifier").option("--value <value>","Set business value summary").option("--impact <value>","Set business impact summary").option("--outcome <value>","Set expected outcome summary").option("--why-now <value>","Set why-now rationale").option("--assignee <value>","Set assignee").option("--parent <value>","Set parent item ID").option("--reviewer <value>","Set reviewer").option("--risk <value>","Set risk level").option("--confidence <value>","Set confidence level").option("--sprint <value>","Set sprint identifier").option("--release <value>","Set release identifier").option("--blocked-by <value>","Set blocked-by item ID or reason").option("--blocked-reason <value>","Set blocked reason").option("--unblock-note <value>","Set unblock rationale note").option("--reporter <value>","Set issue reporter").option("--severity <value>","Set issue severity").option("--environment <value>","Set issue environment context").option("--repro-steps <value>","Set issue reproduction steps").option("--resolution <value>","Set issue resolution summary").option("--expected-result <value>","Set issue expected behavior").option("--expected <value>","Short alias for --expected-result").option("--actual-result <value>","Set issue observed behavior").option("--actual <value>","Short alias for --actual-result").option("--affected-version <value>","Set affected version identifier").option("--fixed-version <value>","Set fixed version identifier").option("--component <value>","Set issue component ownership").option("--regression [value]","Set regression marker; bare flag means true, or pass true|false|1|0").option("--customer-impact <value>","Set customer impact summary").option("--dep <value>","Add dependency entry id=<id>,kind=<kind>,author=<author>,created_at=<timestamp>",c).option("--dep-remove <value>","Remove dependency entries by id/kind/author/timestamp signature",c).option("--replace-deps","Atomically replace dependency entries with provided --dep values").option("--replace-tests","Atomically replace linked tests with provided --test values").option("--replace-files","Atomically replace linked files with provided --file values").option("--replace-docs","Atomically replace linked docs with provided --doc values").option("--comment <value>","Add comment seed author=<value>,created_at=<iso|now>,text=<value>",c).option("--note <value>","Add note seed author=<value>,created_at=<iso|now>,text=<value>",c).option("--learning <value>","Add learning seed author=<value>,created_at=<iso|now>,text=<value>",c).option("--file <value>","Add linked file path=<value>,scope=<project|global>,note=<text>",c).option("--test <value>","Add linked test command=<value>,path=<value>,scope=<project|global>",c).option("--doc <value>","Add linked doc path=<value>,scope=<project|global>,note=<text>",c).option("--reminder <value>","Add reminder entry at=<iso|relative>|date=<iso|relative>,text=<text>|title=<text>",c).option("--event <value>","Add event entry start=<iso|relative>,end=<iso|relative>,recur_*",c).option("--type-option <value>","Set type options key=value (repeatable)",c).option("--unset <field>","Clear scalar metadata field by name (repeatable)",c).option("--clear-deps","Clear dependency entries").option("--clear-comments","Clear comments").option("--clear-notes","Clear notes").option("--clear-learnings","Clear learnings").option("--clear-files","Clear linked files").option("--clear-tests","Clear linked tests").option("--clear-docs","Clear linked docs").option("--clear-reminders","Clear reminders").option("--clear-events","Clear events").option("--clear-type-options","Clear type options").option("--author <value>","Mutation author").option("--message <value>","Mutation message").option("--force","Force ownership override"),O(a,[["--filter-assignee_filter <value>","Alias for --filter-assignee-filter"],["--estimated_minutes <value>","Alias for --estimated-minutes"],["--acceptance_criteria <value>","Alias for --acceptance-criteria"],["--definition_of_ready <value>","Alias for --definition-of-ready"],["--why_now <value>","Alias for --why-now"],["--blocked_by <value>","Alias for --blocked-by"],["--blocked_reason <value>","Alias for --blocked-reason"],["--unblock_note <value>","Alias for --unblock-note"],["--repro_steps <value>","Alias for --repro-steps"],["--expected_result <value>","Alias for --expected-result"],["--actual_result <value>","Alias for --actual-result"],["--affected_version <value>","Alias for --affected-version"],["--fixed_version <value>","Alias for --fixed-version"],["--customer_impact <value>","Alias for --customer-impact"],["--filter-estimate-missing","Alias for --filter-estimates-missing"]],!1),O(a,[["--dep_remove <value>","Alias for --dep-remove"],["--type_option <value>","Alias for --type-option"],["--add_tags <value>","Alias for --add-tags"],["--remove_tags <value>","Alias for --remove-tags"],["--add_ac <value>","Alias for --add-ac"],["--remove_ac <value>","Alias for --remove-ac"]],!0),a.action(Fo);let r=e.command("close").option("--release-assignment","Release ownership after closure").argument("<id>","Item id").argument("[text]","Close reason text (alias: --reason)").option("-r, --reason <value>","Close reason text (alias for positional <text>)").option("--close-reason <value>","Close reason text (alias for positional <text>)").option("--completed-at <value>","Actual completion timestamp (ISO or relative), distinct from tracker close time").option("-d, --duplicate-of <id>","Close as a duplicate of the canonical item id and auto-fill duplicate closure metadata").option("--author <value>","Mutation author").option("-m, --message <value>","History message").option("--validate-close [mode]",'Validate closure metadata before close: "off", "warn", or "strict" (default: settings governance preset)').option("--resolution <value>","Closure resolution summary (checked by --validate-close strict)").option("--expected-result <value>","Expected outcome for closure validation").option("--expected <value>","Short alias for --expected-result").option("--actual-result <value>","Observed outcome for closure validation").option("--actual <value>","Short alias for --actual-result").option("--force","Force ownership override").description("Close an item. Close reason requirement follows governance.require_close_reason.");w(r,"--expected_result <value>","Alias for --expected-result",!1),w(r,"--actual_result <value>","Alias for --actual-result",!1),r.action(Mo);let n=e.command("close-many").description("Bulk-close matched items with a shared reason and full runClose semantics (dry-run + rollback checkpoint).").option("--filter-status <value>","Filter by status before closing").option("--filter-type <value>","Filter by item type before closing").option("--filter-tag <value>","Filter by tag before closing").option("--filter-priority <value>","Filter by priority before closing").option("--filter-deadline-before <value>","Filter by deadline upper bound before closing").option("--filter-deadline-after <value>","Filter by deadline lower bound before closing").option("--filter-updated-after <value>","Filter by updated_at lower bound before closing (ISO/relative)").option("--filter-updated-before <value>","Filter by updated_at upper bound before closing (ISO/relative)").option("--filter-created-after <value>","Filter by created_at lower bound before closing (ISO/relative)").option("--filter-created-before <value>","Filter by created_at upper bound before closing (ISO/relative)").option("--filter-assignee <value>","Filter by assignee before closing").option("--filter-assignee-filter <value>","Filter assignee presence: assigned|unassigned before closing").option("--filter-parent <value>","Filter by parent item ID before closing").option("--filter-sprint <value>","Filter by sprint before closing").option("--filter-release <value>","Filter by release before closing");Nt(n,"closing"),n.option("--ids <value>","Explicit ID allowlist: comma/newline text, - stdin, or @path file").option("--limit <n>","Limit matched item count before apply/preview").option("--offset <n>","Skip first n matched rows before apply/preview").option("--reason <value>","Shared close reason applied to matched items (required when governance.require_close_reason is enabled)").option("--completed-at <value>","Actual completion timestamp (ISO or relative) applied to every matched item").option("--resolution <value>","Shared closure resolution applied to every matched item (closure-validation field)").option("--expected-result <value>","Shared expected-result note (closure-validation field)").option("--expected <value>","Short alias for --expected-result").option("--actual-result <value>","Shared actual-result note (closure-validation field)").option("--actual <value>","Short alias for --actual-result").option("--validate-close [mode]",'Validate closure metadata per item: "off", "warn", or "strict" (default: settings governance preset)').option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Re-close already-terminal matches and override ownership").option("--dry-run","Preview matched items + per-item skip/active-child plan without mutating").option("--rollback <value>","Rollback a prior close-many checkpoint ID").option("--no-checkpoint","Disable checkpoint creation during apply mode"),w(n,"--filter-assignee_filter <value>","Alias for --filter-assignee-filter",!1),w(n,"--expected_result <value>","Alias for --expected-result",!1),w(n,"--actual_result <value>","Alias for --actual-result",!1),n.action(Oo),e.command("delete").argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").option("--dry-run","Preview the item file that would be deleted without mutating").description("Delete an item and record the change in history.").action(Vo),e.command("append").argument("<id>","Item id").argument("[text]","Body text; same as --body (- reads stdin)").option("--body <value>","Text to append to body (or - for stdin)").option("--text <value>","Alias for --body").option("--author <value>","Mutation author").option("--message <value>","Mutation message").option("--force","Force ownership override").description("Append text to an item's body. For concurrent writes, use pm notes.").action(Jo);let s=e.command("plan").description("Plan workflow: create, manage steps and dependencies, approve, and materialize.").argument("[subcommand]","Required; Plan subcommand: create|show|add-step|update-step|complete-step|block-step|reorder-step|remove-step|link|unlink|decision|discovery|validation|resume|approve|materialize").argument("[id]","Plan id (non-create); positional title for create").argument("[step]","Step reference: stable id (plan-step-001) or order integer").argument("[new-order]","New order integer for reorder-step").option("--title <value>","Plan title").option("--description <value>","Plan description").option("--scope <value>","Change or investigation scope").option("--parent <value>","Parent pm item id").option("--inherit-focus","Create under saved focus (CLI default)",!0).option("--no-inherit-focus","Create without saved focus").option("--related <value>","Related item ids (repeatable CSV)",c).option("--blocks <value>","Blocked item ids (repeatable CSV)",c).option("--blocked-by <value>","Blocking item ids (repeatable CSV)",c).option("--harness <value>","Plan harness provenance: codex|claude-code|cursor|generic").option("--mode <value>","Plan mode: draft|research|review|approved|executing|paused|completed|superseded").option("--resume-context <value>","Compact context summary for a future stateless agent").option("--tags <value>","Comma-separated tags").option("--priority <value>","Priority 0-4").option("--body <value>","Plan item body").option("--claim","Claim the plan on create for the author").option("--from-search <value>","Record the search query that led to plan creation").option("--template <value>","Seed plan steps from a built-in template: bug-investigation|feature-implementation|refactoring-sprint").option("--step-title <value>","Step title for add-step / update-step").option("--step <value>","Step title (repeatable on create: each --step appends an ordered step; elsewhere a single value aliases --step-title)",c).option("--step-body <value>","Step body text").option("--step-owner <value>","Step owner").option("--step-status <value>","Step status: pending|in_progress|completed|blocked|skipped|superseded").option("--step-evidence <value>","Step evidence text (used by update-step/complete-step)").option("--step-blocked-reason <value>","Step blocked reason (required when blocking)").option("--step-replacement <value>","Replacement reference for a superseded step").option("--depends-on <value>","Pm item ids the step depends on (repeatable, csv-friendly)",c).option("--link <value>","Pm item id to link (repeatable, csv-friendly)",c).option("--link-kind <value>",`Link kind: ${ge.join("|")}`).option("--link-note <value>","Optional note for the link").option("--promote-to-item-dep","Also add the linked id as a top-level item dependency when linking").option("--allow-multiple-active","Allow multiple steps to be in_progress at once").option("--file <value>","Step linked file path=<value>[,scope=project|global,note=<text>] (repeatable)",c).option("--test <value>","Step linked test command=<value>[,path=<value>,note=<text>] (repeatable)",c).option("--doc <value>","Step linked doc path=<value>[,scope=project|global,note=<text>] (repeatable)",c).option("--decision-text <value>","Decision log entry text").option("--decision <value>","Alias for --decision-text").option("--decision-rationale <value>","Decision log entry rationale").option("--decision-evidence <value>","Decision log entry evidence").option("--discovery-text <value>","Discovery log entry text").option("--discovery <value>","Alias for --discovery-text").option("--validation-text <value>","Validation log entry text").option("--validation <value>","Alias for --validation-text").option("--validation-command <value>","Validation log entry command").option("--validation-expected <value>","Validation log entry expected outcome").option("--depth <value>","Show depth: brief|standard|deep (default: brief)").option("--fields <value>","Comma-separated field projection for show output").option("--steps <value>","Comma-separated step ids/orders for materialize").option("--materialize-type <value>","Item type for materialized steps (default: Task)").option("--materialize-parent <value>","Parent item id for materialized children (default: the plan)").option("--materialize-tags <value>","Comma-separated tags for materialized children").option("--field <name=value>","Custom field value forwarded to every materialized child (repeatable)",c).option("--author <value>","Mutation author").option("--message <value>","Mutation message").option("--force","Force ownership override");me(s,W.filter(m=>wo.has(m.target))),O(s,[["--resume_context <value>","Alias for --resume-context"],["--from_search <value>","Alias for --from-search"],["--step_title <value>","Alias for --step-title"],["--step_body <value>","Alias for --step-body"],["--step_owner <value>","Alias for --step-owner"],["--step_status <value>","Alias for --step-status"],["--step_evidence <value>","Alias for --step-evidence"],["--step_blocked_reason <value>","Alias for --step-blocked-reason"],["--step_replacement <value>","Alias for --step-replacement"],["--link_kind <value>","Alias for --link-kind"],["--link_note <value>","Alias for --link-note"],["--promote_to_item_dep","Alias for --promote-to-item-dep"],["--allow_multiple_active","Alias for --allow-multiple-active"],["--decision_text <value>","Alias for --decision-text"],["--decision_rationale <value>","Alias for --decision-rationale"],["--decision_evidence <value>","Alias for --decision-evidence"],["--discovery_text <value>","Alias for --discovery-text"],["--validation_text <value>","Alias for --validation-text"],["--validation_command <value>","Alias for --validation-command"],["--validation_expected <value>","Alias for --validation-expected"],["--materialize_type <value>","Alias for --materialize-type"],["--materialize_parent <value>","Alias for --materialize-parent"],["--materialize_tags <value>","Alias for --materialize-tags"]],!1),O(s,[["--blocked_by <value>","Alias for --blocked-by"],["--depends_on <value>","Alias for --depends-on"]],!0),s.action($o),wt(e,!1),Rt(e),e.command("merge").argument("<subcommand>",`${B.join(" | ")}`).argument("[artifact]",`driver: ${ae.join(" | ")}`).argument("[base]","driver: ancestor file (%O)").argument("[ours]","driver: current file (%A)").argument("[theirs]","driver: incoming file (%B)").option("--dry-run","install/reconcile: preview").option("--pre-commit-hook","install: opt into merge settlement hook").option("--stage","reconcile: stage lossless audit evidence").option("--message <text>","reconcile: audit message").option("--force","reconcile: accept reviewed decisions").option("--include-reconciled","report: include settled receipts").option("--output <path>","driver: alternate output").option("--item-path <path>","driver: repository-relative path (%P)").option("--prefer <side>","driver: ours|theirs (default ours)").description("Manage tracker merges.").action(Go),Pt(e),e.command("profile").argument("[subcommand]","Required; Profile subcommand: list, show, apply, or lint").argument("[name]","Profile name for show/apply/lint: agile, ops, or research").option("--dry-run","Preview the apply diff without writing any files (apply)").option("--author <value>","Mutation author").option("--force","Force ownership/lock override").description("List, show, apply, and lint project profiles \u2014 archetype bundles of item types, statuses, fields, workflows, config, templates, and recommended packages.").action(Ko),Ot(e,ko);let d=e.command("files").description("Manage files linked to an item.");d.argument("<id>","Item id").option("--add <value>","Add linked file entry (CSV/markdown pairs or - for stdin)",c).option("--add-glob <value>","Add linked file entries from a glob (plain glob or pattern=<glob>,scope=<scope>,note=<text>; repeatable)",c).option("--remove <value>","Remove linked file by path only (path=<value>, path:<value>, plain path, or - for stdin); does not accept note=/scope= \u2014 record removal context with --message",c).option("--migrate <value>","Migrate linked file paths in-place (from=<prefix>,to=<prefix>; repeatable)",c).option("--note <value>","Note attached to every link added by --add/--add-glob in this invocation (embedded note= wins)").option("--list","List linked files without mutating").option("--append-stable","Preserve existing linked-file order and append new links without full-array resorting").option("--validate-paths","Validate linked file paths for existence and file shape").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").action(Wo),d.command("discover").argument("<id>","Item id").option("--apply","Add discovered missing files to the item").option("--note <value>","Note to attach to discovered file links").option("--append-stable","Preserve existing linked-file order and append discovered links without full-array resorting").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").description("Discover existing file paths referenced in item text and optionally link missing files.").action(Xo),Ft(d),e.command("docs").argument("<id>","Item id").option("--add <value>","Add linked doc entry (CSV/markdown pairs or - for stdin)",c).option("--add-glob <value>","Add linked doc entries from a glob (plain glob or pattern=<glob>,scope=<scope>,note=<text>; repeatable)",c).option("--remove <value>","Remove linked doc by path only (path=<value>, path:<value>, plain path, or - for stdin); does not accept note=/scope= \u2014 record removal context with --message",c).option("--migrate <value>","Migrate linked doc paths in-place (from=<prefix>,to=<prefix>; repeatable)",c).option("--note <value>","Note attached to every link added by --add/--add-glob in this invocation (embedded note= wins)").option("--list","List linked docs without mutating").option("--validate-paths","Validate linked doc paths for existence and file shape").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").description("Manage docs linked to an item.").action(Yo),e.command("deps").argument("<id>","Item id").option("--format <value>","Output format (tree, graph, or context)","tree").option("--max-depth <value>","Maximum dependency traversal depth (0 keeps only the root)").option("--collapse <value>","Collapse mode (none or repeated)","none").option("--summary","Return counts only without full tree/graph payload").option("--full","Return the complete dependency row projection").option("--node-limit <value>","Maximum nodes in context output").option("--edge-limit <value>","Maximum edges and missing-reference rows in context output").option("--token-budget <value>","Maximum estimated tokens in context output").option("--cursor <value>","Continue an equivalent context query").option("--direction <value>","Context traversal direction (outgoing, incoming, or both)").option("--kind <value>","Restrict context traversal to registered relationship kinds (repeatable or comma-separated)",c).description("Show dependency relationships for an item.").action(Zo)}export{ue as looksLikeSchemaSubcommandTypo,ko as parsePositiveIntOption,U as parseSchemaOrderOption,me as registerCommanderOptionContracts,Ka as registerMutationCommands};
|
|
20
|
-
//# sourceMappingURL=register-mutation-SN425O3R.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./chunk-SGFQQXFD.js";import"./chunk-DEZPZOQ7.js";import{Cc as $,Dc as G,Ec as H,Ed as ie,Fc as W,Gc as j,Hc as B,Jb as N,Jc as I,Kc as z,Lc as Y,Mc as K,Nc as X,Oc as Q,Pb as U,Qc as Z,Rc as ee,Sb as q,Xa as F,ga as M,kd as te,nd as ae,pd as ne,rb as V,wd as oe,xd as re,yc as J,yd as C}from"./chunk-AHVN4GHF.js";import"./chunk-JESLOJD7.js";import"./chunk-D6P6IBPN.js";import"./chunk-PQLRKFPZ.js";import"./chunk-4D25HF3V.js";import{If as O,Jf as P,Kf as L,Lc as _,Of as c,Rf as f,Sf as i,Tf as g,hg as y}from"./chunk-CS7QDSUX.js";import"./chunk-SPPHDVZE.js";import"./chunk-LWW4F4G2.js";import"./chunk-CXUQEZDX.js";import"./chunk-IB7UB5TE.js";import{Bi as A,Pf as l,Qf as u,Tc as x,k as T,l as E,qh as R,xa as v}from"./chunk-7V37RC2L.js";import"./chunk-TH5KPAN4.js";import"./chunk-VS565KBX.js";import{A as d,C as m}from"./chunk-RZQNFHXO.js";import"./chunk-XAWE4EAK.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c3d9f24a-7089-5d60-ab12-93d03b86da80")}catch{}})();var se=new Map([["measurements","boolean"],["metric","string"],["measurementLimit","number"],["observe","string_array"],["direction","direction"],["measurementSource","string"],["measurementItem","string"],["measurementRevision","string"],["author","string"],["message","string"],["provenanceCoverage","boolean"],["fleetAttribution","boolean"],["since","string"],["eventLimit","number"],["minimumSample","number"]]),ke=new Set(["higher","lower","target"]),ve=[...se.keys()].sort((e,t)=>e.localeCompare(t)).join(", ");function xe(e,t){return e==="boolean"?typeof t=="boolean":e==="string"?typeof t=="string":e==="number"?typeof t=="number":e==="string_array"?Array.isArray(t)&&t.every(a=>typeof a=="string"):e==="direction"&&ke.has(t)}function le(e){if(e===void 0)return{};let t;try{t=JSON.parse(e)}catch(a){throw new m(`--analytics must be valid JSON: ${String(a)}`,d.USAGE)}if(t===null||typeof t!="object"||Array.isArray(t))throw new m("--analytics must be a JSON object.",d.USAGE);for(let[a,n]of Object.entries(t)){let o=se.get(a);if(!xe(o,n))throw new m(o===void 0?`Unknown --analytics field "${a}". Accepted fields: ${ve}.`:`--analytics field "${a}" must be ${o.replace("_"," ")}.`,d.USAGE)}return t}(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]="dcd8c925-34ee-5faa-9132-1be43961c749")}catch{}})();(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]="29db968f-30ad-5f3c-bf95-e33be18614c6")}catch{}})();(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]="524ade8e-33d6-5353-b01d-c7baddc956e8")}catch{}})();(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]="02e10fe1-c111-5c09-8dbe-a67f2b97f0d0")}catch{}})();(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]="3d4a8db3-8a53-50b4-a96c-1affff2207a3")}catch{}})();(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]="d008ca8f-41bf-54fb-9b56-bc1d4af9f226")}catch{}})();(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]="de197522-9007-5e21-8f9c-06cbf63707d1")}catch{}})();(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]="a5e0162a-bbf1-50fe-8912-a820de155e90")}catch{}})();(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]="9ee008b9-3751-5794-8d01-1f6d3123d6cd")}catch{}})();(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]="b6fa277d-ccf2-5413-95d5-0790283203d5")}catch{}})();(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]="2d59e10e-c85b-542a-8859-b20a08e809fa")}catch{}})();var ce=(e,t)=>N(e,t,{runUpdate:(a,n,o)=>J(a,n,o)});(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]="3952425a-adce-59dd-84b6-97ac571eaa73")}catch{}})();async function Ae(e,t,a,n,o){let r=c(o),s=e==="run",p=e==="verdicts",w=e==="presets"||e==="apply",k=e==="promote",h=await U({action:e,...s||p||w||k?{}:{kind:t},id:s||p||k?a??t:a,preset:w?a??t:void 0,definition:i(n,"definition"),trigger:i(n,"trigger"),tree:i(n,"tree"),gate:i(n,"gate"),limit:i(n,"limit"),dry_run:n.dryRun===!0,fullChangedFields:r.fullChangedFields,idOnly:r.idOnly,author:i(n,"author"),message:i(n,"message"),owner:i(n,"owner"),apply:n.apply===!0,enforcement:i(n,"enforcement")},r);l(h,r),typeof h=="object"&&h!==null&&"exit_code"in h&&h.exit_code===1&&(process.exitCode=1)}function de(e){e.command("assurance").argument("<action>","Action; inspect `pm contracts --command assurance`").argument("[kind]","Declaration kind or run gate id").argument("[id]","Declaration/gate id").description("Manage SDK-owned assurance contracts.").option("--definition <json>","Put declaration JSON").option("--trigger <value>","Gate trigger").option("--tree <value>","Revision identity").option("--gate <id>","Verdict gate filter").option("--limit <number>","Verdict limit").option("--dry-run","Evaluate without recording").option("--author <value>","Mutation author").option("--message <value>","Mutation rationale").option("--owner <item-id>","Preset/derivation owner").option("--apply","Persist derived proposals").option("--enforcement <level>","Promote to warn or block").action(Ae)}(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]="a623e4b3-0b19-53e5-9953-df71495e8d2c")}catch{}})();function _e(e,t){let a=e?.trim().toLowerCase(),n=t?.trim().toLowerCase();if(a===void 0||a.length===0)return n;if(a==="local-analytics")return n&&n.length>0?n:"status";if(n!==void 0&&n.length>0)throw _({command_path:"telemetry",token:`${e} ${t}`,allowed:["status","flush","stats","clear","local-analytics"],token_kind:"path",examples:["pm telemetry stats --limit 10","pm telemetry local-analytics status --json"]});return a}function Ie(e){return{addValues:Array.isArray(e.add)?e.add:[],addJsonValues:Array.isArray(e.addJson)?e.addJson:[],removeValues:Array.isArray(e.remove)?e.remove:[],removeIndexValues:Array.isArray(e.removeIndex)?e.removeIndex:[]}}function fe(e,t){if(e.background===!0){if(e.run!==!0)throw new m("--background requires --run",d.USAGE);if(e.acknowledgeLinkedTests===!0)throw new m("--background cannot be combined with --acknowledge-linked-tests; acknowledgement is a non-executing foreground operation",d.USAGE);if(e.update!==void 0||e.updateIndex!==void 0||e.setJson!==void 0||t.addValues.length>0||t.addJsonValues.length>0||t.removeValues.length>0||t.removeIndexValues.length>0)throw new m("--background does not support --add/--add-json/--remove/--remove-index or metadata edits; update linked tests first, then run in background",d.USAGE)}}async function Ce(e,t,a,n){let o=await C({kind:"test",commandArgs:O(e,{...t,add:n.addValues,addJson:n.addJsonValues,remove:n.removeValues,removeIndex:n.removeIndexValues}),targetId:e,author:typeof t.author=="string"?t.author:void 0,noExtensions:a.noExtensions===!0},a);l(o,a)}function De(e){return{update:typeof e.update=="string"?e.update:void 0,updateIndex:typeof e.updateIndex=="string"||typeof e.updateIndex=="number"?e.updateIndex:void 0,setJson:typeof e.setJson=="string"?e.setJson:void 0}}function D(e,t){return{add:t.addValues,addJson:t.addJsonValues,remove:t.removeValues,removeIndex:t.removeIndexValues,...De(e),list:!!e.list,run:!!e.run,match:typeof e.match=="string"?e.match:void 0,onlyIndex:typeof e.onlyIndex=="string"||typeof e.onlyIndex=="number"?e.onlyIndex:void 0,onlyLast:!!e.onlyLast,timeout:typeof e.timeout=="string"?e.timeout:void 0,progress:!!e.progress,envSet:Array.isArray(e.envSet)?e.envSet:[],envClear:Array.isArray(e.envClear)?e.envClear:[],sharedHostSafe:!!e.sharedHostSafe,pmContext:typeof e.pmContext=="string"?e.pmContext:void 0,overrideLinkedPmContext:!!e.overrideLinkedPmContext,workspaceContext:typeof e.workspaceContext=="string"?e.workspaceContext:void 0,overrideLinkedWorkspaceContext:!!e.overrideLinkedWorkspaceContext,allowUntrustedLinkedTests:!!e.allowUntrustedLinkedTests,acknowledgeLinkedTests:!!e.acknowledgeLinkedTests,failOnContextMismatch:!!e.failOnContextMismatch,failOnSkipped:!!e.failOnSkipped,failOnEmptyTestRun:!!e.failOnEmptyTestRun,requireAssertionsForPm:!!e.requireAssertionsForPm,checkContext:!!e.checkContext,autoPmContext:!!e.autoPmContext,author:typeof e.author=="string"?e.author:void 0,message:typeof e.message=="string"?e.message:void 0,force:!!e.force,measure:Array.isArray(e.measure)?e.measure:[],metricBelow:typeof e.metricBelow=="string"?e.metricBelow:void 0,metricDiff:typeof e.metricDiff=="string"?e.metricDiff:void 0}}var Nt={buildRunTestOptions:D,buildRunTestAllOptions:pe,runWorkspacePositionAction:ye,validateBackgroundTestOptions:fe};async function Se(e,t,a,n){let o=await oe(e,D(t,n),a);(t.update!==void 0||t.updateIndex!==void 0||t.setJson!==void 0||n.addValues.length>0||n.addJsonValues.length>0||n.removeValues.length>0||t.run===!0||n.removeIndexValues.length>0)&&await y(a,o),l(o,a),(o.run_results.some(r=>r.status==="failed"||r.status==="refused")||o.fail_on_skipped_triggered===!0)&&(process.exitCode=d.DEPENDENCY_FAILED)}async function Te(e,t,a){let n=c(a),o=Date.now(),r=Ie(t);t.background===!0&&ne(e,D(t,r),n,v(process.cwd(),n.path),!0),fe(t,r),t.background===!0?await Ce(e,t,n,r):await Se(e,t,n,r),n.profile&&u(`profile:command=test took_ms=${Date.now()-o}`)}function b(e){let t=i(e,"author"),a=i(e,"assignee");if(t!==void 0&&a!==void 0&&t!==a)throw new m("Lifecycle ownership received conflicting --author and --assignee values; use one actor value for both aliases.",d.USAGE,{code:"conflicting_lifecycle_owner",examples:["pm claim pm-123","pm claim pm-123 --start","pm release pm-123"]});return{author:t??a,message:i(e,"message")}}async function Ee(e,t){let a=c(t),n=Date.now();if(e.background===!0){let r=await C({kind:"test-all",commandArgs:P(e),statusFilter:i(e,"status"),noExtensions:a.noExtensions===!0},a);l(r,a),a.profile&&u(`profile:command=test-all took_ms=${Date.now()-n}`);return}let o=await re(pe(e),a);await y(a,{ids:o.results.map(r=>r.id)}),l(o,a),(o.failed>0||o.fail_on_skipped_triggered===!0)&&(process.exitCode=d.DEPENDENCY_FAILED),a.profile&&u(`profile:command=test-all took_ms=${Date.now()-n}`)}function pe(e){return{status:i(e,"status"),limit:i(e,"limit"),offset:i(e,"offset"),timeout:i(e,"timeout"),progress:!!e.progress,envSet:Array.isArray(e.envSet)?e.envSet:[],envClear:Array.isArray(e.envClear)?e.envClear:[],sharedHostSafe:!!e.sharedHostSafe,pmContext:i(e,"pmContext"),overrideLinkedPmContext:!!e.overrideLinkedPmContext,workspaceContext:i(e,"workspaceContext"),overrideLinkedWorkspaceContext:!!e.overrideLinkedWorkspaceContext,allowUntrustedLinkedTests:!!e.allowUntrustedLinkedTests,failOnContextMismatch:!!e.failOnContextMismatch,failOnSkipped:!!e.failOnSkipped,failOnEmptyTestRun:!!e.failOnEmptyTestRun,requireAssertionsForPm:!!e.requireAssertionsForPm,checkContext:!!e.checkContext,autoPmContext:!!e.autoPmContext}}async function Re(e,t,a,n){let o=c(n),r=Date.now(),s=await ae({subcommand:_e(e,t),limit:i(a,"limit")},o);l(s,o),o.profile&&u(`profile:command=telemetry took_ms=${Date.now()-r}`)}async function Oe(e,t){let a=c(t),n=Date.now(),o=le(i(e,"analytics")),r=await te(a,{includeEmpty:e.includeEmpty===!0,storage:e.storage===!0,metadataCoverage:e.metadataCoverage===!0,byAssignee:e.byAssignee===!0,byTag:e.byTag===!0,byPriority:e.byPriority===!0,tagPrefix:i(e,"tagPrefix"),fieldUtilization:e.fieldUtilization===!0,...o});r.recorded_observations?.some(s=>s.changed)===!0&&await y(a,{ids:r.recorded_observations?.flatMap(s=>s.observation.item_id?[s.observation.item_id]:[])}),l(r,a),a.profile&&u(`profile:command=stats took_ms=${Date.now()-n}`)}async function Pe(e,t){let a=c(t),n=Date.now(),o=i(e,"threshold"),r=i(e,"limit"),s=await F(a,{...e.exhaustive===!0?{exhaustive:!0}:{},status:Array.isArray(e.status)&&e.status.length>0?e.status:void 0,since:i(e,"since"),...o===void 0?{}:{threshold:Number(o)},...r===void 0?{}:{limit:Number(r)}});l(s,a),a.profile&&u(`profile:command=duplicates took_ms=${Date.now()-n}`)}async function Le(e,t){let a=c(t),n=Date.now(),o=!!e.strictExit||!!e.failOnWarn,r=await V(a,{strictExit:o,strictDirectories:!!e.strictDirectories,requireMergeDrivers:!!e.requireMergeDrivers,checkOnly:!!e.checkOnly,checkTelemetry:!!e.checkTelemetry,noRefresh:!!e.noRefresh,refreshVectors:!!e.refreshVectors,verboseStaleItems:!!e.verboseStaleItems,verboseAuthorEvents:!!e.verboseAuthorEvents,brief:!!e.brief,summary:!!e.summary||o,skipVectors:!!e.skipVectors,skipIntegrity:!!e.skipIntegrity,skipDrift:!!e.skipDrift,full:!!e.full});l(r,a),o&&!r.ok&&(x({...r,exit_code:d.GENERIC_FAILURE,error_code:"health_findings",error_category:"validation",command_resolution:"health_findings",resolution_stage:"execute"}),process.exitCode=d.GENERIC_FAILURE),a.profile&&u(`profile:command=health took_ms=${Date.now()-n}`)}async function Me(e,t){let a=c(t),n=Date.now(),o=await ce({checkMetadata:!!e.checkMetadata,metadataProfile:i(e,"metadataProfile"),checkResolution:!!e.checkResolution,checkCompleteness:!!e.checkCompleteness,checkLifecycle:!!e.checkLifecycle,checkStaleBlockers:!!e.checkStaleBlockers,dependencyCycleSeverity:i(e,"dependencyCycleSeverity"),parentCycleSeverity:i(e,"parentCycleSeverity"),checkFiles:!!e.checkFiles,checkCommandReferences:!!e.checkCommandReferences,scanMode:i(e,"scanMode"),includePmInternals:!!e.includePmInternals,verboseFileLists:!!e.verboseFileLists,verboseDiagnostics:!!e.verboseDiagnostics,allAffectedIds:!!e.allAffectedIds,checkHistoryDrift:!!e.checkHistoryDrift,checkStorageIntegrity:!!e.checkStorageIntegrity,fixHints:!!e.fixHints,autoFix:!!e.autoFix,dryRun:!!e.dryRun,fixScope:Array.isArray(e.fixScope)?e.fixScope:void 0,pruneMissing:!!e.pruneMissing,counts:!!e.counts,full:!!e.full},a);l(o,a),(e.strictExit||e.failOnWarn)&&(o.has_warnings||!o.ok)&&(x({...o,exit_code:d.GENERIC_FAILURE,error_code:"validation_findings",error_category:"validation",command_resolution:"validation_findings",resolution_stage:"execute"}),process.exitCode=d.GENERIC_FAILURE),a.profile&&u(`profile:command=validate took_ms=${Date.now()-n}`)}async function Fe(e,t){let a=c(t),n=Date.now(),o=await q(a,{dryRun:e.dryRun===!0,scope:Array.isArray(e.scope)?e.scope:[]});l(o,a),a.profile&&u(`profile:command=gc took_ms=${Date.now()-n}`)}async function Ve(e,t,a,n){let o=c(n),r=v(process.cwd(),o.path),s=e.trim().toLowerCase();if(!I.some(p=>p===s))throw _({command_path:"workspace snapshot",token:e,allowed:I,display_name:"workspace snapshot",token_kind:"action",examples:["pm workspace snapshot create before-migration","pm workspace snapshot restore before-migration"]});if(s==="list"){l(await K(r),o);return}if(s==="create"){l(await z(r,t===void 0?{}:{name:t}),o);return}if(t===void 0)throw new m(`pm workspace snapshot ${s} requires a snapshot name or fingerprint`,d.USAGE);if(s==="inspect"){l(await Y(r,t),o);return}if(s==="restore"){if(a.dryRun===!0){l(await X(r,t),o);return}let p=await A(r);l(await Q(r,t,{force:a.force===!0,author:R(i(a,"author"),p.author_default),message:i(a,"message"),lockTtlSeconds:p.locks.ttl_seconds,lockWaitMs:p.locks.wait_ms}),o);return}l(await Z(r,t),o)}async function ye(e,t){let a=c(t);l(await ee(a),a)}async function Ne(e,t){let a=c(t),n=Date.now(),o=await M({action:i(e,"action"),command:i(e,"command"),summary:!!e.summary,schemaOnly:!!e.schemaOnly,flagsOnly:!!e.flagsOnly,availabilityOnly:!!e.availabilityOnly,runtimeOnly:!!e.runtimeOnly||!!e.activeOnly,full:!!e.full},a);l(o,a),a.profile&&u(`profile:command=contracts took_ms=${Date.now()-n}`)}async function Ue(e,t,a){if(t.start===!0){ue(e,!1),await ge(e,t,a);return}let n=c(a),o=Date.now(),r={...b(t),ifAvailable:t.ifAvailable===!0,maxAttempts:t.maxAttempts};ue(e,t.next===!0);let s=t.next===!0?await G(!!t.force,n,r,{type:typeof t.type=="string"?t.type:void 0,tag:typeof t.tag=="string"?t.tag:void 0,priority:t.priority,assigneeFilter:typeof t.assigneeFilter=="string"?t.assigneeFilter:void 0,parent:typeof t.parent=="string"?t.parent:void 0,sprint:typeof t.sprint=="string"?t.sprint:void 0,release:typeof t.release=="string"?t.release:void 0,includeDecisions:t.includeDecisions===!0,includeGates:t.includeGates===!0,includeContainers:t.includeContainers===!0,tokenBudget:t.tokenBudget??t.token_budget,explainRanking:t.explainRanking===!0||t.explain_ranking===!0}):await $(e,!!t.force,n,r);await y(n,s),l(s,n),n.profile&&u(`profile:command=claim took_ms=${Date.now()-o}`)}function ue(e,t){if(!t&&!e)throw new m("Specify an item id or pass --next",d.USAGE);if(t&&e)throw new m("Specify either an item id or --next, not both",d.USAGE)}async function qe(e,t,a){if(t.pause===!0){await he(e,t,a);return}let n=c(a),o=Date.now(),r=await H(e,!!t.force,n,{...b(t),ownershipReleaseBypass:t.ownershipReleaseBypass===!0,handoff:t.handoff});await y(n,r),l(await L("release",[e],t,n,r),n),n.profile&&u(`profile:command=release took_ms=${Date.now()-o}`)}async function S(e){let t=c(e),a=T(e.name());!a||t.json||t.quiet||(await A(v(process.cwd(),t.path))).ux?.deprecation_hints&&u(E(a))}async function ge(e,t,a){await S(a);let n=c(a),o=Date.now(),r=await W(e,{...b(t),force:!!t.force,next:t.next===!0,ifAvailable:t.ifAvailable===!0},n);await y(n,r.update),l(r,n),n.profile&&u(`profile:command=start-task took_ms=${Date.now()-o}`)}async function he(e,t,a){await S(a);let n=c(a),o=Date.now(),r=await j(e,{...b(t),handoff:i(t,"handoff"),force:!!t.force},n);await y(n,r.release),l(r,n),n.profile&&u(`profile:command=pause-task took_ms=${Date.now()-o}`)}async function Je(e,t,a,n){await S(n);let o=c(n),r=Date.now(),s=await B(e,t,{...b(a),validateClose:i(a,"validateClose"),force:!!a.force},o);await y(o,s.release),l(s,o),o.profile&&u(`profile:command=close-task took_ms=${Date.now()-r}`)}function me(e){return e.option("--background","Run linked tests in managed background mode").option("--timeout <seconds>","Default run timeout in seconds (requires --run)").option("--progress","Emit stderr run progress (requires --run; automatic in TTY)").option("--env-set <value>","Set run environment (KEY=VALUE, repeatable)",f).option("--env-clear <value>","Clear run environment (NAME, repeatable)",f).option("--shared-host-safe","Apply additive shared-host-safe run defaults").option("--pm-context <mode>","PM test context: schema|tracker|auto|none (default: schema)").option("--override-linked-pm-context","Override stored context with --pm-context").option("--workspace-context <mode>","Source-workspace mode: source|isolated|snapshot (default: source)").option("--override-linked-workspace-context","Override stored context with --workspace-context").option("--allow-untrusted-linked-tests","Execute untrusted linked commands when project policy also permits it").option("--fail-on-context-mismatch","Fail linked PM commands when context item counts differ").option("--fail-on-skipped","Treat skipped linked tests as dependency failures").option("--fail-on-empty-test-run","Fail successful commands reporting zero executed tests").option("--require-assertions-for-pm","Require assertion metadata for linked PM command tests").option("--check-context","Check PM context before execution").option("--auto-pm-context","Route mismatched PM tracker reads through tracker context")}function Ut(e){de(e);let t=e.command("test").argument("<id>","Item id").option("--add <value>","Add verified isolated test (CSV/markdown or stdin)",f).option("--add-json <value>","Add verified isolated test (JSON object/array or stdin)",f).option("--remove <value>","Remove exact command/path (command=<value>, path=<value>, or stdin -)",f).option("--remove-index <n>","Remove 1-based --list position (repeatable)",f).option("--list","List linked tests without mutating").option("--update <value>","Edit exact command or path=<value>").option("--update-index <n>","Edit current 1-based --list position").option("--set-json <value>","Metadata patch; null clears optional fields").option("--run","Run linked test commands").option("--match <value>","Run matching command/path substring").option("--only-index <n>","Run 1-based --list position").option("--only-last","Run most recently added test");t.option("--acknowledge-linked-tests","Trust current commands in this clone without execution"),me(t).option("--measure <value>","Record name=value[,unit=...][,threshold=...]; requires --run",f).option("--metric-below <value>","Return evidence below name=value").option("--metric-diff <name>","Diff the latest two values").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").description("Manage tests linked to an item and optionally run them.").action(Te);let a=e.command("test-all").description("Run linked tests across matching items.").option("--status <value>","Filter items by status before running tests").option("--limit <n>","Limit matching items before running linked tests").option("--offset <n>","Skip matching items before running linked tests");me(a).action(Ee),e.command("test-runs-worker",{hidden:!0}).argument("<runId>","Background run id").description("Internal background worker command.").action(async(k,h,be)=>{let we=c(be);await ie(k,we)}),e.command("telemetry").argument("[namespace-or-subcommand]","Telemetry subcommand: status, flush, stats, clear (default: status)").argument("[subcommand]","Compatibility alias target for local-analytics: status, flush, stats, clear").option("--limit <n>","Maximum command groups returned by telemetry stats").description("Inspect and manage local telemetry queue/runtime state.").action(Re),e.command("duplicates").description("Find duplicate clusters across all statuses.").option("--status <value>","Statuses (repeatable or comma-separated)",f,[]).option("--since <value>","Created at or after this time").option("--threshold <value>","Minimum similarity (0-1)").option("--limit <n>","Maximum clusters").option("--exhaustive","Score all pairs within the safety bound").action(Pe),e.command("stats").description("Show project tracker statistics.").option("--include-empty","Restore zero-count registered item-type and lifecycle-status buckets").option("--storage","Include aggregate history-stream storage metrics (total streams/lines/bytes, largest + deepest streams, oldest/newest entries)").option("--metadata-coverage","Include metadata coverage % (acceptance_criteria, estimated_minutes, resolution, tags, parent) overall and by type").option("--by-assignee","Include a lifecycle-bucketed item breakdown grouped by assignee").option("--by-tag","Include a lifecycle-bucketed item breakdown grouped by tag").option("--by-priority","Include a lifecycle-bucketed item breakdown grouped by priority").option("--tag-prefix <value>","With --by-tag: only count tags starting with this prefix (e.g. domain:)").option("--field-utilization","Report content-field utilization rates (notes/learnings/files/docs/tests/comments/deps/body) for governance analysis").option("--analytics <json>","Improvement ledger/history analytics JSON").action(Oe),e.command("health").description("Show project tracker health checks.").option("--strict-directories","Treat optional item-type directories as required failures").option("--require-merge-drivers","Treat absent clone-local merge drivers as a required health failure").option("--check-only","Run read-only health diagnostics without refreshing vectors").option("--check-telemetry","Probe telemetry endpoint health and include network diagnostics").option("--no-refresh","Disable automatic vector refresh attempts during health checks").option("--refresh-vectors","Explicitly enable vector refresh attempts during health checks").option("--verbose-stale-items","Include full stale vectorization ID lists in health output").option("--verbose-author-events","Include every actionable unknown-author event coordinate for review or disposition").option("--brief","Emit compact health details for low-token agent checks").option("--summary","Emit one-line-style health status with check names and warning count").option("--skip-vectors","Skip vectorization check for a faster run").option("--skip-integrity","Skip item/history file integrity check for a faster run").option("--skip-drift","Skip history drift hash check for a faster run").option("--full","Run all checks including slow integrity, drift, and vectorization checks").option("--strict-exit","Return non-zero exit when health is not ok and default to actionable summary output; use --full for complete details").option("--fail-on-warn","Alias for --strict-exit").action(Le),e.command("validate").description("Validate metadata, lifecycle policies, files, command references, and history.").option("--check-metadata","Run metadata completeness checks").option("--metadata-profile <value>","Metadata profile (core|strict|custom)").option("--check-resolution","Run closed-item resolution metadata checks").option("--check-completeness","Check declarative lifecycle field requirements").option("--check-lifecycle","Run active-item lifecycle governance drift checks").option("--check-stale-blockers","Include stale blocker-pattern diagnostics in lifecycle checks").option("--dependency-cycle-severity <value>","Set dependency-cycle warning policy for lifecycle checks (off|warn|error)").option("--parent-cycle-severity <value>","Set parent-hierarchy cycle warning policy for lifecycle checks (off|warn|error)").option("--check-files","Run linked-file and orphaned-file checks").option("--check-command-references","Run linked-command PM-ID reference checks").option("--scan-mode <value>","Select file candidate scan mode for --check-files (default|tracked-all|tracked-all-strict)").option("--include-pm-internals","Include PM storage internals in tracked-all candidate scans").option("--verbose-file-lists","Include full file-path lists for validate --check-files details").option("--verbose-diagnostics","Include full diagnostic ID lists").option("--all-affected-ids","Emit complete missing_* affected-ID lists with no truncation (implied by --json)").option("--strict-exit","Return non-zero exit when validation warnings are present").option("--fail-on-warn","Alias for --strict-exit").option("--fix-hints","Add a machine-executable fix_hints[] of pm commands to each failing check's details").option("--auto-fix","Apply safe, deterministic field backfills").option("--dry-run","Preview planned --auto-fix/--prune-missing fixes without applying them").option("--fix-scope <scope>","Grant --auto-fix scopes (metadata, resolution, estimates, timestamps, lifecycle; comma-separated or repeatable). Default: metadata, resolution; other scopes require explicit opt-in",f).option("--prune-missing","Remove deleted-path file/doc links; preserves real files").option("--check-history-drift","Run item/history hash drift checks").option("--check-storage-integrity","Run the post-merge storage-integrity check (unreadable items, history conflict markers, resurrected deletes, unparseable config/schema)").option("--counts","Keep validation counts and totals while omitting per-item diagnostic arrays").option("--full","Return the complete validation diagnostic projection").action(Me),e.command("gc").option("--dry-run","Preview cleanup targets without deleting files; without this flag, pm gc deletes matched artifacts").option("--scope <value>","Limit cleanup to one or more scopes (comma-separated or repeatable): index, embeddings, runtime, locks, checkpoints, transactions",f).description("Delete optional cache artifacts by default (including expired lock debris) and show a summary.").action(Fe);let n=e.command("workspace").description("Inspect workspace state and snapshots.");n.command("position").description("Show merge and history readiness.").action(ye),n.command("snapshot").argument("<action>","Action: create, list, inspect, restore, delete").argument("[target]","Optional name for create; name or fingerprint otherwise").description("Manage content-addressed tracker snapshots.").option("--dry-run","Preview restore file, item, stream, and history-entry impact without mutating state").option("--force","Explicitly confirm a whole-workspace snapshot restore").option("--author <value>","Actor recorded on the restore audit event").option("--message <value>","Human-readable restore rationale").action(Ve),e.command("contracts").description("Show machine-readable command and schema contracts for agents.").option("--action <value>","Filter tool schema branches to a specific action").option("--command <value>","Scope contracts output to one CLI command (narrow-by-default)").option("--summary","Return one command+intent row per top-level command for cheap agent bootstrap").option("--schema-only","Return schema-focused output only").option("--flags-only","Return command flag contracts only").option("--availability-only","Return action availability surface only").option("--runtime-only","Include only actions invocable in the current runtime").option("--active-only","Alias for --runtime-only").option("--full","Include full schema and command-flag surfaces (large; default brief output omits heavy sections for unfiltered queries)").action(Ne);let o=e.command("claim").option("--start","Claim and start an explicit item").argument("[id]","Item id (omit with --next)").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force claim override").option("--if-available","Skip another author's claim (skipped=true)").option("--next","Atomically claim the next caller-available actionable item").option("--type <value>","Filter --next candidates by type").option("--tag <value>","Filter --next candidates by tag").option("--priority <value>","Filter --next candidates by priority").option("--assignee-filter <value>","Filter --next candidates: assigned|unassigned").option("--parent <id>","Scope --next candidates to a subtree").option("--sprint <value>","Filter --next candidates by sprint").option("--release <value>","Filter --next candidates by release").option("--max-attempts <n>","Bound the --next candidate walk (default 10; maximum 100)").option("--include-decisions","Allow --next to claim human-gated Decision items").option("--include-gates","Allow --next to claim outcome gates").option("--include-containers","Allow --next to claim containers with unfinished descendants").option("--token-budget <n>","Bound the estimated tokens used to rank --next candidates").option("--explain-ranking","Include ranking provenance for --next selection").description("Claim an item for active work.").action(Ue);g(o,"--assignee <value>","Alias for --author on lifecycle ownership commands"),g(o,"--token_budget <n>","Alias for --token-budget"),g(o,"--explain_ranking","Alias for --explain-ranking");let r=e.command("release").option("--pause","Use open status").option("--handoff <status>","Needs --message").argument("<id>","Item id").option("--author <value>","Author").option("--message <value>","Message").option("--force","Override ownership").description("Release ownership.").action(qe);g(r,"--assignee <value>","Alias for --author on lifecycle ownership commands");let s=e.command("start-task",{hidden:!0}).argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership or terminal override when required").description("Lifecycle alias: claim an item and move it to in_progress.").action(ge);g(s,"--assignee <value>","Alias for --author on lifecycle ownership commands");let p=e.command("pause-task",{hidden:!0}).argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override when required").description("Lifecycle alias: move an item to open and release its claim.").action(he);g(p,"--assignee <value>","Alias for --author on lifecycle ownership commands");let w=e.command("close-task",{hidden:!0}).argument("<id>","Item id").argument("[reason]","Close reason text").option("--author <value>","Mutation author").option("--message <value>","History message").option("--validate-close <value>","Close-time validation mode: off|warn|strict").option("--force","Force ownership or terminal override when required").description("Lifecycle alias: close an item and release assignment metadata.").action(Je);g(w,"--assignee <value>","Alias for --author on lifecycle ownership commands")}export{Nt as _testOnlyRegisterOperations,Ut as registerOperationCommands,ue as requireClaimTarget};
|
|
2
|
-
//# sourceMappingURL=register-operations-EYUIUGPW.js.map
|