@unbrained/pm-cli 2026.11.30 → 2026.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/dist/cli/commander-usage.js +10 -10
- package/dist/cli/error-guidance.js +5 -5
- package/dist/cli/extension-command-help.js +6 -6
- package/dist/cli/help-json-payload.js +7 -7
- package/dist/cli/main.js +5 -5
- package/dist/cli/register-list-query.js +10 -10
- package/dist/cli/register-mutation.js +3 -3
- package/dist/cli/runtime/invocation-command-path.js +2 -0
- package/dist/cli/runtime/read-output-mutation-retry.js +1 -1
- package/dist/cli-bundle/bundle-manifest.json +1 -1
- package/dist/cli-bundle/chunks/{chunk-DCWGM7CY.js → chunk-3HKPVOAN.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-Z7YL2SUM.js → chunk-3KEMIPKG.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-IGEFPHV7.js → chunk-4YQMQOUO.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-TX74QJ4W.js → chunk-4YYFY33T.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-A5ZEMOVR.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-5PNOVDVO.js → chunk-AHV3CSQG.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-AJLU6KLW.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-KCVSSONY.js → chunk-C6WM6ZN4.js} +3 -3
- package/dist/cli-bundle/chunks/chunk-CBUC4X7Q.js +127 -0
- package/dist/cli-bundle/chunks/{chunk-47ZS6RPL.js → chunk-CWPR234D.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-I4SPJQQI.js +3 -0
- package/dist/cli-bundle/chunks/{chunk-Q4VZSMUL.js → chunk-L2ZSSMYY.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-NHBG5ET3.js → chunk-MZZ4ZJ5Z.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-CCKM5YQM.js → chunk-NA6D75V5.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-NRQCBUYD.js +113 -0
- package/dist/cli-bundle/chunks/{chunk-YVTALIN3.js → chunk-OBPO6V7H.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-NZSXWIX7.js → chunk-OKEJ4U2I.js} +7 -7
- package/dist/cli-bundle/chunks/{chunk-KXTKLDKD.js → chunk-OXC5KBIQ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-HXQ3OHQR.js → chunk-PCDTWL6V.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-FECZV72T.js → chunk-Q6GLSAJY.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-AOTI76Q6.js → chunk-Q6K7HWZ7.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-QDV7S2QS.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-2SBTXR6C.js → chunk-SY5C3U32.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-WFYE34TO.js → chunk-U7RBJGLF.js} +23 -23
- package/dist/cli-bundle/chunks/chunk-WSEIEDEK.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-FR7ULTM4.js → chunk-XME6GIFQ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-TY55UX6M.js → chunk-YSVOXCYH.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-ZA5NS3PL.js → chunk-ZL6J6JYT.js} +6 -6
- package/dist/cli-bundle/chunks/{field-option-collisions-2F2Z7R7B.js → field-option-collisions-BBGTV7AD.js} +2 -2
- package/dist/cli-bundle/chunks/item-revision-3LENTXYF.js +2 -0
- package/dist/cli-bundle/chunks/item-transaction-66RDV7PH.js +2 -0
- package/dist/cli-bundle/chunks/{linked-resource-value-list-WXPPYUVQ.js → linked-resource-value-list-E2DX52LY.js} +2 -2
- package/dist/cli-bundle/chunks/{mutation-actor-UK3QNEEB.js → mutation-actor-NHN33ITJ.js} +2 -2
- package/dist/cli-bundle/chunks/{mutation-admission-UTDYPFWP.js → mutation-admission-PGKJTCG6.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-DRA3CWHI.js → register-list-query-7S5QWDTI.js} +11 -11
- package/dist/cli-bundle/chunks/{register-mutation-WO74VLEQ.js → register-mutation-2F6JUBST.js} +5 -5
- package/dist/cli-bundle/chunks/{register-operations-CRBKH7WN.js → register-operations-ET3UKPYK.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-6V6NQB5C.js → register-setup-I63QTFCU.js} +2 -2
- package/dist/cli-bundle/chunks/{stage-DYEHGASU.js → stage-4ZCF74G4.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-RQYVX2T6.js → chunk-2DGKVXFT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-2UWKU2BQ.js +3 -0
- package/dist/cli-bundle/focused-chunks/{chunk-UQJ4PY2Y.js → chunk-4SCFAWAW.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-7G7JIXLL.js → chunk-6BKT6XQN.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-6IY5CVGJ.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-7A6SEZEY.js +4 -0
- package/dist/cli-bundle/focused-chunks/{chunk-IJ3T3W4U.js → chunk-BHNBPCHP.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-LWBZ7UGG.js → chunk-EQCQTYKO.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-FM5WQ6ZU.js → chunk-HTDYNY4L.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-L357ZAES.js → chunk-JPZGC3W4.js} +5 -5
- package/dist/cli-bundle/focused-chunks/{chunk-62AMZMR4.js → chunk-KNBGHCIP.js} +3 -3
- package/dist/cli-bundle/focused-chunks/chunk-N64AC5G6.js +100 -0
- package/dist/cli-bundle/focused-chunks/{chunk-IIVDBAJM.js → chunk-OG57ESZK.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-MZNV26XE.js → chunk-P2H3GTJK.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-TQQO42C2.js → chunk-PT7RT3T6.js} +26 -26
- package/dist/cli-bundle/focused-chunks/chunk-QZRYGYTI.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-A3DORTXS.js → chunk-SQ72CVUH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-SQMOF65W.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-T3ILWAEV.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-SXC3NVZI.js → chunk-TR22GU7M.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-M57KDG7I.js → chunk-TXTPAFHJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-VK3IE3TS.js +29 -0
- package/dist/cli-bundle/focused-chunks/{chunk-NJTKGBSK.js → chunk-VQIC3UZB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-U35K7FSE.js → chunk-W4JMV7GF.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{field-option-collisions-7TG7STO7.js → field-option-collisions-2C6DLUC4.js} +2 -2
- package/dist/cli-bundle/focused-chunks/item-revision-723XCQPS.js +2 -0
- package/dist/cli-bundle/focused-chunks/{item-transaction-2IC2MLML.js → item-transaction-2K4SFLJ7.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{mutation-actor-LJVF2HVD.js → mutation-actor-DJMZUIZI.js} +2 -2
- package/dist/cli-bundle/focused-chunks/mutation-admission-SDWQVVHN.js +2 -0
- package/dist/cli-bundle/focused-chunks/{stage-MWR73LTZ.js → stage-QBZIK3T5.js} +2 -2
- package/dist/cli-bundle/main.js +27 -27
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +1 -1
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +61 -61
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +2 -2
- package/dist/core/extensions/reserved-host-flags.js +1 -1
- package/dist/core/shared/secret-rules.d.ts +86 -12
- package/dist/core/shared/secret-rules.js +7 -5
- package/dist/sdk/cli-bootstrap.js +1 -1
- package/dist/sdk/cli-contracts/flag-contracts.d.ts +50 -0
- package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +3 -1
- package/dist/sdk/cli-contracts/runtime-contracts.js +1 -1
- package/dist/sdk/extension/command-options.js +1 -1
- package/dist/sdk/lifecycle/expect-hash-admission.d.ts +15 -0
- package/dist/sdk/lifecycle/expect-hash-admission.js +2 -0
- package/dist/sdk/lifecycle/item-revision.d.ts +4 -1
- package/dist/sdk/lifecycle/item-revision.js +1 -1
- package/dist/sdk/mutation-guard.js +1 -1
- package/dist/sdk/output-contracts.js +1 -1
- package/dist/sdk/output-projection.d.ts +1 -1
- package/dist/sdk/output-projection.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query/aggregate.js +1 -1
- package/dist/sdk/query/context.js +1 -1
- package/dist/sdk/query/list.js +1 -1
- package/dist/sdk/query/next.js +1 -1
- package/dist/sdk/query/search-contracts.js +1 -1
- package/dist/sdk/read-output/surfaces.js +1 -1
- package/dist/sdk/read-output-budget.d.ts +1 -1
- package/dist/sdk/read-output-budget.js +1 -1
- package/dist/sdk/read-output-contracts.js +1 -1
- package/dist/sdk/read-output-rows.js +1 -1
- package/docs/COMMANDS.md +37 -0
- package/docs/MUTATION_INTEGRITY.md +226 -10
- package/docs/SDK.md +16 -6
- package/docs/agent-task-token-baseline.json +1 -1
- 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-3TXEWHQX.js +0 -125
- package/dist/cli-bundle/chunks/chunk-JPJNJHQW.js +0 -2
- package/dist/cli-bundle/chunks/chunk-NVYDPNQP.js +0 -2
- package/dist/cli-bundle/chunks/chunk-SJWIPGZW.js +0 -113
- package/dist/cli-bundle/chunks/chunk-USBTXMKS.js +0 -2
- package/dist/cli-bundle/chunks/chunk-VCXQ6A35.js +0 -3
- package/dist/cli-bundle/chunks/chunk-YPMNXG2C.js +0 -2
- package/dist/cli-bundle/chunks/item-revision-UAF6L47R.js +0 -2
- package/dist/cli-bundle/chunks/item-transaction-RJECL53Y.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-2UUBS4BG.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-4ER3VMST.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-4YBMHMBJ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-HXM7K6VH.js +0 -100
- package/dist/cli-bundle/focused-chunks/chunk-NGHT2LNG.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-P55AZPFN.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-WAP3DF4B.js +0 -27
- package/dist/cli-bundle/focused-chunks/chunk-XR745UGE.js +0 -4
- package/dist/cli-bundle/focused-chunks/item-revision-J7EUGCHR.js +0 -2
- package/dist/cli-bundle/focused-chunks/mutation-admission-SLFAUONA.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as y}from"./chunk-BWOVFE5B.js";import{a as A,g as Y,j as B,n as b,q as V,z as G}from"./chunk-2UWKU2BQ.js";import{z as q}from"./chunk-JFICNN4T.js";import{m as I}from"./chunk-IRYNVGKH.js";var ht=["id","title","status","type","priority","parent","updated_at"],Tt=["id","status","type","title"],At={list:"brief","list-all":"full","list-draft":"full","list-open":"brief","list-in-progress":"brief","list-blocked":"brief","list-closed":"brief","list-canceled":"full"},ke=["tree_depth","tree_parent","tree_children","tree_title"];function xe(e=[]){return[...new Set([...I,"body",...ke,...e])].flatMap(a=>[a,`item.${a}`]).sort()}function yt(e=[]){return xe(e).filter(a=>!a.startsWith("item."))}var be=["brief","standard","deep"],W=[...be,"full"],J=["brief","standard","deep"],Se=["body","item_hash","linked","claim_state","children","schedule","blockers"],Ne=["linked.files","linked.tests","linked.docs"],Oe=["claim_state.claimed","claim_state.assignee","claim_state.last_claim","claim_state.last_release"],Ee=["schedule.deadline","schedule.start_at","schedule.end_at","schedule.location","schedule.reminders","schedule.events"];function Ct(e=[]){return[...[...new Set([...I,...e,"notes_count","tests_count","collection_counts"])].flatMap(t=>[t,`item.${t}`]),...Se,...Ne,...Oe,...Ee].sort()}var kt=["id","title","status","type","priority","updated_at","score","matched_fields"],we=["score","matched_fields","highlights"],K=["id","title","description","type","status","priority","tags","created_at","updated_at","deadline","assignee","author","estimated_minutes","acceptance_criteria","dependencies","comments","notes","learnings","reminders","events","files","tests","docs","close_reason","parent","reviewer","risk","confidence","sprint","release","blocked_by","blocked_reason","reporter","severity","environment","repro_steps","resolution","expected_result","actual_result","affected_version","fixed_version","component","regression","customer_impact","definition_of_ready","order","rank","goal","objective","value","impact","outcome","why_now","plan"];function xt(e=[]){let a=[...new Set(e)];return[...we,...K,...K.map(t=>`item.${t}`),...a,...a.map(t=>`item.${t}`)].sort()}var D=["item","list","context","search","graph","history","workspace","package","ops","plan","contracts","help"],Le=["acknowledge","activate","add","adopt","adopt-all","catalog","compact","complete","create","deactivate","delete","describe","doctor","edit","explore","import","init","inspect","install","list","manage","migrate","mutate","read","redact","reload","remove","reopen","repair","restore","run","show","uninstall","upgrade","verify"];function s(e,a,t,l={}){return{name:e,required:t,variadic:l.variadic===!0,value_kind:a,polymorphic:l.polymorphic===!0}}function Z(e){let a=e.replaceAll("-"," ");return`${a.charAt(0).toUpperCase()}${a.slice(1)}`}var c=s("id","item_id",!0),C=s("id","item_id",!1),k=s("text","string",!1),x=s("plan-id","item_id",!0),Q=s("step","string",!0),Re=["--acceptance-criteria","--actual-result","--affected-version","--assignee","--blocked-by","--blocked-reason","--blocks","--body","--claim","--comment","--component","--confidence","--create-mode","--customer-impact","--deadline","--definition-of-ready","--description","--doc","--environment","--estimate","--event","--expected-result","--fixed-version","--file","--from-search","--goal","--harness","--impact","--learning","--message","--mode","--note","--objective","--order","--outcome","--parent","--priority","--rank","--related","--release","--reminder","--reporter","--repro-steps","--resolution","--resume-context","--reviewer","--risk","--scope","--severity","--sprint","--status","--step","--step-blocked-reason","--step-body","--step-evidence","--step-owner","--step-replacement","--step-status","--step-title","--tags","--template","--test","--title","--type-option","--unblock-note","--value","--why-now"],P=["--allow-multiple-active","--depends-on","--file","--force","--message","--step-blocked-reason","--step-body","--step-evidence","--step-owner","--step-status","--step-title","--test"],Fe={"update-step":"Update one declared Plan step.","complete-step":"Complete one declared Plan step.","block-step":"Block one declared Plan step.","remove-step":"Remove one declared Plan step.",link:"Link one dependency to a declared Plan step.",unlink:"Unlink one dependency from a declared Plan step."},h=[{command:"plan create",parent:"plan",action:"create",slots:[s("title","string",!1,{polymorphic:!0})],accepted_flags:Re,description:"Create a Plan item and optionally seed its ordered steps.",example:'pm plan create --title "Refactor lock retry"'},{command:"plan show",parent:"plan",action:"show",slots:[x],accepted_flags:["--depth","--fields"],description:"Read one Plan item with a bounded plan projection.",example:"pm plan show pm-a1b2 --depth standard"},{command:"plan add-step",parent:"plan",action:"add-step",slots:[x],accepted_flags:P,description:"Append one ordered step to a Plan item.",example:'pm plan add-step pm-a1b2 --step-title "Run tests"'},...Object.entries(Fe).map(([e,a])=>({command:`plan ${e}`,parent:"plan",action:e,slots:[x,Q],accepted_flags:P,description:a,example:`pm plan ${e} pm-a1b2 plan-step-001`})),{command:"plan reorder-step",parent:"plan",action:"reorder-step",slots:[x,Q,s("new-order","integer",!0)],accepted_flags:["--force","--message"],description:"Move one Plan step to a declared integer order.",example:"pm plan reorder-step pm-a1b2 plan-step-001 2"},...["decision","discovery","validation","resume","approve","materialize"].map(e=>({command:`plan ${e}`,parent:"plan",action:e,slots:[x],accepted_flags:P,description:`${Z(e)} for one Plan item.`,example:`pm plan ${e} pm-a1b2`})),...["list","show","put","remove"].map(e=>({command:`assurance ${e}`,parent:"assurance",action:e,slots:[s("kind","string",!0),...e==="list"?[]:[s("id","string",!0)]],accepted_flags:e==="put"?["--author","--definition","--message"]:e==="remove"?["--author","--message"]:[],description:`${Z(e)} assurance declarations by kind.`,example:e==="list"?"pm assurance list measurement":`pm assurance ${e} measurement example-id`})),{command:"assurance run",parent:"assurance",action:"run",slots:[s("gate-id","string",!0)],accepted_flags:["--dry-run","--trigger","--tree"],description:"Evaluate one assurance gate for a lifecycle trigger.",example:"pm assurance run tracker-context-quality --trigger ci --dry-run"},{command:"assurance verdicts",parent:"assurance",action:"verdicts",slots:[s("gate-id","string",!1)],accepted_flags:["--gate","--limit"],description:"List bounded assurance verdict history.",example:"pm assurance verdicts --limit 20"},...["presets","apply"].map(e=>({command:`assurance ${e}`,parent:"assurance",action:e,slots:[s("preset","string",e==="apply")],accepted_flags:["--author","--message","--owner"],description:e==="apply"?"Apply one assurance adoption preset.":"List available assurance adoption presets.",example:e==="apply"?"pm assurance apply software-delivery --owner <pm-item-id>":"pm assurance presets"})),{command:"assurance derive",parent:"assurance",action:"derive",slots:[],accepted_flags:["--apply","--author","--message","--owner"],description:"Derive assurance proposals from current project context.",example:"pm assurance derive --owner pm-a1b2"},{command:"assurance promote",parent:"assurance",action:"promote",slots:[s("assertion-id","string",!0)],accepted_flags:["--author","--enforcement","--message"],description:"Promote one assertion into a warning or blocking gate.",example:"pm assurance promote assertion-id --enforcement warn"},{command:"assurance risk",parent:"assurance",action:"risk",slots:[],accepted_flags:["--definition"],description:"Analyze bounded defect-recurrence risk for a proposed change.",example:`pm assurance risk --definition '{"policy":{"version":1,"evidence_epoch":"2026-01-01T00:00:00.000Z","families":[]},"change":{"files":[]}}'`},{command:"assurance lineages",parent:"assurance",action:"lineages",slots:[],accepted_flags:["--definition"],description:"Measure all recorded recurrence lineages with bounded evidence rows.",example:`pm assurance lineages --definition '{"policy":{"version":1,"evidence_epoch":"2026-01-01T00:00:00.000Z","families":[]}}'`},{command:"workspace position",parent:"workspace",action:"position",slots:[],accepted_flags:[],description:"Read bounded merge-fence, receipt, history-drift, and next-action readiness.",example:"pm workspace position"},{command:"workspace snapshot create",parent:"workspace snapshot",action:"create",slots:[s("name","string",!1)],accepted_flags:[],description:"Capture authoritative tracker state as an immutable snapshot.",example:"pm workspace snapshot create before-migration"},{command:"workspace snapshot list",parent:"workspace snapshot",action:"list",slots:[],accepted_flags:[],description:"List immutable workspace snapshots and named references.",example:"pm workspace snapshot list"},{command:"workspace snapshot inspect",parent:"workspace snapshot",action:"inspect",slots:[s("target","string",!0)],accepted_flags:[],description:"Inspect one workspace snapshot target.",example:"pm workspace snapshot inspect before-migration"},{command:"workspace snapshot restore",parent:"workspace snapshot",action:"restore",slots:[s("target","string",!0)],accepted_flags:["--author","--dry-run","--force","--message"],description:"Restore an immutable workspace snapshot with explicit recovery controls.",example:"pm workspace snapshot restore before-migration --dry-run"},{command:"workspace snapshot delete",parent:"workspace snapshot",action:"delete",slots:[s("target","string",!0)],accepted_flags:[],description:"Delete one workspace snapshot target.",example:"pm workspace snapshot delete before-migration"}],Ie=[...h].sort((e,a)=>a.command.length-e.command.length),te=new Map([["append",[c,k]],["assurance",[s("action","action",!0),s("kind","string",!1),s("id","string",!1)]],["beads import",[s("file","string",!1)]],["cal",[s("view","string",!1,{polymorphic:!0})]],["calendar",[s("view","string",!1,{polymorphic:!0})]],["changelog corrections",[s("action","string",!0)]],["changelog export",[s("file","string",!1)]],["changelog milestone create",[s("name","string",!0)]],["claim",[C]],["close",[c,k]],["close-task",[c,s("reason","string",!1)]],["comments",[c,k]],["completion",[s("shell","string",!1)]],["config",[s("scope","string",!1,{polymorphic:!0}),s("action","action",!1),s("key","string",!1),s("value","string",!1,{polymorphic:!0})]],["copy",[c]],["create",[s("type-or-title","string",!1,{polymorphic:!0}),s("title","string",!1)]],["delete",[c]],["deps",[c]],["docs",[c]],["event",[s("title","string",!0)]],["files",[c]],["files discover",[c]],["files lookup",[s("paths","string",!0,{variadic:!0})]],["focus",[C]],["get",[c]],["graph",[s("subcommand","action",!0),C,s("target","item_id",!1)]],["guide",[s("topic","string",!1)]],["history",[c]],["history-compact",[C]],["history-redact",[c]],["history-repair",[C]],["init",[s("prefix-or-path","string",!1,{polymorphic:!0})]],["item complete",[c,s("reason","string",!1)]],["item reopen",[c,s("reason","string",!0)]],["learnings",[c,k]],["meet",[s("title","string",!0)]],["merge",[s("subcommand","action",!0),s("artifact","string",!1),s("base","string",!1),s("ours","string",!1),s("theirs","string",!1)]],["notes",[c,k]],["package",[s("target","string",!1,{polymorphic:!0})]],["extension inventory",[s("name","string",!1)]],["extension list",[s("name","string",!1)]],["package list",[s("name","string",!1)]],["package inventory",[s("name","string",!1)]],["package scaffold",[s("target","string",!0)]],["package upgrade",[s("target","string",!1)]],["packages",[s("target","string",!1,{polymorphic:!0})]],["packages list",[s("name","string",!1)]],["packages inventory",[s("name","string",!1)]],["packages scaffold",[s("target","string",!0)]],["packages upgrade",[s("target","string",!1)]],["pause-task",[c]],["plan",[s("subcommand","action",!0),s("id","item_id",!1,{polymorphic:!0}),s("step","string",!1),s("new-order","integer",!1)]],["profile",[s("subcommand","action",!0),s("name","string",!1)]],["release",[c]],["remind",[s("title","string",!0)]],["restore",[c,s("target","string",!0)]],["schema",[s("subcommand","action",!0),s("name","string",!1)]],["search-advanced",[s("keywords","string",!0,{variadic:!0})]],["search",[s("keywords","string",!0,{variadic:!0})]],["start-task",[c]],["templates save",[s("name","string",!0)]],["templates show",[s("name","string",!0)]],["telemetry",[s("namespace-or-subcommand","action",!1,{polymorphic:!0}),s("subcommand","action",!1)]],["test",[c]],["test-runs-worker",[s("runId","string",!0)]],["update",[c]],["workspace snapshot",[s("action","action",!0),s("target","string",!1)]],...["activate","adopt","deactivate","init","uninstall"].flatMap(e=>["extension","package","packages"].map(a=>[`${a} ${e}`,[s("target","string",!0)]])),...["describe"].flatMap(e=>["extension","package","packages"].map(a=>[`${a} ${e}`,[s("target","string",!1)]])),...["install"].flatMap(e=>["extension","package","packages"].map(a=>[`${a} ${e}`,[s("targets","string",!1,{variadic:!0})]])),["vcs abandon",[c]],["vcs create",[s("title","string",!0)]],["vcs merge",[c]],["vcs propose",[c]],["vcs ref-create",[s("name","string",!0)]],["vcs show",[c]]]);function v(e){return e.trim().toLowerCase().replace(/\s+/gu," ")}function Nt(e){let a=v(e),t=M.find(n=>n.command===a);if(t)return t;let l=V(a)?.canonical;if(l)return M.find(n=>n.command===l)}function Ge(e){let a=v(e);return Ie.find(t=>t.command===a||a.startsWith(`${t.command} `))}function Ot(e){return`Applicable flags: ${e.length>0?e.join(", "):"none"}.`}function i(e,a,t,l,n){return n.map(r=>({command:r,noun:e,target:a,disposition:t,owner:l}))}var O=[...i("item","item","target_noun","pm-pbyu",["item","item complete","item mutate","item reopen"]),...i("item","item","consolidation","pm-yql1",["append","close-many","close-task","comments","copy","delete","deps","docs","files","learnings","notes","pause-task","start-task","test","update-many"]),...["claim","close","create","get","release","update"].map(e=>({command:e,noun:"item",target:e,disposition:"keep_as_is",owner:"pm-pbyu",reason:"Permanent high-frequency item operations retain concise root spellings under the accepted hot-path grammar policy."})),...i("item","item files","target_noun","pm-yql1",["files discover","files lookup","item files discover","item files lookup"]),...i("item","item test worker","consolidation","pm-lp4j",["test-runs-worker"]),...i("list","list","target_noun","pm-pfqi",["list"]),...i("list","list --group-by","consolidation","pm-xkgq",["aggregate"]),...i("context","context","target_noun","pm-pbyu",["context"]),...i("context","context","consolidation","pm-kcs4",["ctx","focus","next"]),...i("context","context next","consolidation","pm-kcs4",["ctx next"]),...i("context","context focus","consolidation","pm-kcs4",["ctx focus"]),...i("search","search","target_noun","pm-pbyu",["search"]),...i("search","search","package_owned","package:search-advanced",["reindex","search-advanced"]),...i("item","item duplicates","consolidation","pm-fmy9ih",["duplicates"]),...i("item","item duplicates","package_owned","pm-fmy9ih",["dedupe-audit","dedupe-merge","comments-audit"]),...i("graph","graph","target_noun","pm-pbyu",["graph"]),...i("history","history","target_noun","pm-pbyu",["history"]),...i("history","history attest","target_noun","pm-3z0k",["history attest"]),...i("history","history attest","consolidation","pm-3z0k",["history-attest"]),...Y.flatMap(({alias:e,canonical:a})=>[...i("history",a,"target_noun","pm-tqel",[a]),...i("history",a,"consolidation","pm-tqel",[e])]),...i("history","history","consolidation","pm-tqel",["events","merge"]),...i("history","history acknowledge","consolidation","pm-djyvbk",["history-author-acknowledge"]),...i("history","history","package_owned","package:builtin-vcs-exemplar",["vcs abandon","vcs create","vcs log","vcs merge","vcs propose","vcs ref-create","vcs show"]),...i("workspace","workspace","target_noun","pm-pbyu",["workspace","workspace position","workspace snapshot","workspace snapshot create","workspace snapshot delete","workspace snapshot inspect","workspace snapshot list","workspace snapshot restore"]),...i("workspace","workspace init","consolidation","pm-npr3",["init"]),...i("package","package","target_noun","pm-pbyu",["package","package activate","package adopt","package adopt-all","package catalog","package deactivate","package describe","package doctor","package explore","package init","package install","package inventory","package list","package manage","package migrate","package reload","package scaffold","package uninstall","package upgrade"]),...i("package","package","consolidation","pm-tnud",["extension activate","extension adopt","extension adopt-all","extension catalog","extension deactivate","extension describe","extension doctor","extension explore","extension init","extension install","extension inventory","extension list","extension manage","extension migrate","extension reload","extension uninstall","packages","packages activate","packages adopt","packages adopt-all","packages catalog","packages deactivate","packages describe","packages doctor","packages explore","packages init","packages install","packages inventory","packages list","packages manage","packages migrate","packages reload","packages scaffold","packages uninstall","packages upgrade"]),...i("package","package","package_owned","package:beads",["beads import"]),...i("package","package","package_owned","package:pm-changelog",["changelog audit","changelog contracts","changelog corrections","changelog drift","changelog export","changelog generate","changelog milestone create","changelog upgrades"]),...i("package","package calendar","package_owned","pm-o3fh",["cal","calendar","event","meet","remind"]),...i("ops","ops","target_noun","pm-6apl",["ops"]),...i("ops","ops normalize","package_owned","package:pm-governance-audit",["normalize"]),...i("ops","ops","consolidation","pm-6apl",["eval","gc","health","stats","telemetry","test-all","validate"]),...i("workspace","workspace","consolidation","pm-npr3",["config","profile","schema"]),...["assurance",...h.filter(({parent:e})=>e==="assurance").map(({command:e})=>e)].map(e=>({command:e,noun:"ops",target:e,disposition:"keep_as_is",owner:"pm-djyvbk",reason:"Assurance manages durable measurement, assertion, gate, and verdict data; retain its established domain surface independently of operational diagnostics."})),...i("plan","plan","target_noun","pm-pbyu",["plan"]),...i("plan","plan","target_noun","pm-2tan",h.filter(({parent:e})=>e==="plan").map(({command:e})=>e)),...i("contracts","contracts","target_noun","pm-pbyu",["contracts"]),...i("help","help","target_noun","pm-pbyu",["help"]),...i("workspace","templates","package_owned","package:builtin-templates",["templates","templates list","templates save","templates show"]),...i("help","help","package_owned","package:builtin-guide-shell",["completion","completion-statuses","completion-tags","completion-types","guide"])].flatMap(e=>{let a=B.find(l=>l.alias===e.command);if(!a)return[e];let t=D.find(l=>l===a.canonical_argv[0])??e.noun;return[{...e,noun:t,target:a.canonical,owner:a.owner},{...e,command:a.canonical,noun:t,target:a.canonical,owner:a.owner,disposition:e.disposition==="package_owned"?"package_owned":"target_noun"}]}),M=[...new Set(O.map(({command:e})=>e))].map(e=>({command:e,slots:Ge(e)?.slots??te.get(b(e))??[]})),N={nouns:D,shared_verbs:Le,scope_before_verb:!0,visible_top_level_ceiling:69,ceiling_raise_requires_pm_item:!0,positional_shape_budget:21};function ee(e,a){let t=new Set(a);return[...new Set(e)].filter(l=>!t.has(l)).map(l=>({code:"positional_signature_mismatch",command:l,detail:`Positional signature ${l} has no destination declaration.`}))}function Pe(e){return e.map(({required:a,variadic:t,value_kind:l,polymorphic:n})=>`${a?"r":"o"}:${t?"v":"s"}:${l}:${n?"p":"m"}`).join("|")}function S(e){return e.map(({name:a,required:t,variadic:l,value_kind:n,polymorphic:r})=>`${a}:${t?"r":"o"}:${l?"v":"s"}:${n}:${r?"p":"m"}`).join("|")}function ae(e,a){let t=new Map;for(let{command:l}of e){let n=v(l);t.set(n,(t.get(n)??0)+1)}return[...t.entries()].filter(([,l])=>l>1).map(([l,n])=>({code:"positional_signature_mismatch",command:l,detail:`${n} ${a} positional signatures exist for ${l}; exactly one is required.`}))}function Et(e,a={}){let t=a.declared??M,l=a.positionalShapeBudget??N.positional_shape_budget,n=new Map(t.map(o=>[v(o.command),o])),r=new Map(e.map(o=>[v(o.command),o])),f=[...ae(t,"declared"),...ae(e,"observed"),...a.declared===void 0?[...ee(te.keys(),O.map(({command:o})=>o)),...ee(h.map(({command:o})=>o),O.map(({command:o})=>o))]:[]];for(let o of n.values()){let d=v(o.command),g=r.get(d);g?S(g.slots)!==S(o.slots)&&f.push({code:"positional_signature_mismatch",command:o.command,detail:`Observed positional signature for ${o.command} differs from its declared SDK contract: observed=${S(g.slots)||"<none>"}; declared=${S(o.slots)||"<none>"}.`}):f.push({code:"missing_observed_signature",command:o.command,detail:`No observed positional signature exists for ${o.command}.`})}for(let o of r.values())n.has(v(o.command))||f.push({code:"stale_observed_signature",command:o.command,detail:`Observed positional signature ${o.command} has no declaration.`});let p=new Set(t.map(({slots:o})=>Pe(o))).size;return p>l&&f.push({code:"positional_shape_budget_exceeded",command:"*",detail:`Distinct positional shape count ${p} exceeds budget ${l}.`}),f.sort((o,d)=>o.command!==d.command?o.command.localeCompare(d.command):o.code.localeCompare(d.code)),{ok:f.length===0,declared_command_count:t.length,observed_command_count:e.length,positional_shape_count:p,positional_shape_budget:l,findings:f}}function Me(e,a,t){return e.flatMap(l=>{let n=a.get(l)??[];if(n.length===0){let f=l.indexOf(" "),p=f===-1?l:l.slice(0,f);return[{code:"missing_destination",spelling:l,message:`Command \`${l}\` has no destination census row.`,nearest_target:t.has(p)?p:`ops ${l}`}]}let r=n.length>1?[{code:"duplicate_destination",spelling:l,message:`Command \`${l}\` has ${n.length} destination rows.`,nearest_target:n[0].target}]:[];return n.reduce((f,p)=>(p.disposition==="keep_as_is"&&(p.reason?.trim().length??0)===0&&f.push({code:"missing_destination",spelling:l,message:`Command \`${l}\` is kept as-is without a documented reason.`,nearest_target:p.target}),t.has(p.noun)||f.push({code:"unknown_noun",spelling:l,message:`Command \`${l}\` names undeclared noun \`${p.noun}\`.`,nearest_target:p.target}),f),r)})}function De(e,a){return a.filter(t=>t.disposition!=="package_owned"&&!e.has(t.command)).map(t=>({code:"stale_destination",spelling:t.command,message:`Destination row \`${t.command}\` is absent from live contracts.`,nearest_target:t.target}))}function $e(e,a){return e.filter(t=>!a.has(t.canonical)).map(t=>({code:"alias_target_missing",spelling:t.alias,message:`Alias \`${t.alias}\` targets missing canonical command \`${t.canonical}\`.`,nearest_target:t.canonical_argv.join(" ")}))}function wt(e,a=[],t=O){let l=[...new Set(e.map(g=>g.trim()))].filter(g=>g.length>0).sort((g,m)=>g.localeCompare(m)),n=new Set(l),r=new Set(D),f=new Map;for(let g of t){let m=f.get(g.command)??[];m.push(g),f.set(g.command,m)}let p=[...Me(l,f,r),...De(n,t),...$e(a.filter(g=>n.has(g.alias)||!(f.get(g.canonical)??[]).some(m=>m.disposition==="package_owned")),n)],o=new Set(a.filter(g=>g.hidden).map(g=>g.alias)),d=new Set(l.filter(g=>!g.includes(" ")&&!o.has(g)&&!(f.get(g)??[]).some(m=>m.disposition==="package_owned"))).size;return d>N.visible_top_level_ceiling&&p.push({code:"visible_surface_ceiling_exceeded",spelling:String(d),message:`Visible non-package top-level command count ${d} exceeds ceiling ${N.visible_top_level_ceiling}.`,nearest_target:"Declare the noun placement and tracked waiver before raising the ceiling."}),{ok:p.length===0,command_count:l.length,destination_count:t.length,hidden_alias_count:a.filter(g=>g.hidden).length,visible_top_level_count:d,visible_top_level_ceiling:N.visible_top_level_ceiling,findings:p}}function T(e){return[...new Set(Array.from(e,a=>a.trim()).filter(a=>a.length>0))]}function w(e){return e.startsWith("--")?`--${e.slice(2).replaceAll("_","-")}`:e}function H(e){let a=new Map;for(let t of e){let l=w(t.flag),n=a.get(l)??new Set;t.flag!==l&&n.add(t.flag);for(let r of t.aliases??[])r!==l&&n.add(r);a.set(l,n)}return e.map(t=>{let l=w(t.flag);if(t.flag!==l)return t;let n=T([...t.aliases??[],...a.get(l)]).filter(r=>r!==l);return n.length===0?t:{...t,aliases:n}})}function Ht(e){let a=H(e),t=new Set(a.map(l=>l.flag));return a.filter(l=>{let n=w(l.flag);return l.flag===n||!t.has(n)})}var j=A.map(e=>({flag:e.flag,reservation_scope:"inherited",...e.aliases?{aliases:[...e.aliases]}:{},...e.value_name?{value_name:e.value_name}:{},...e.repeatable===!0?{repeatable:!0}:{}})),Ue=new Set(["package","packages","extension"].flatMap(e=>[`${e} inventory`,`${e} list`])),He=new Set(["meet","event","remind","search-advanced","dedupe-audit","dedupe-merge","comments-audit","cal","calendar","completion","completion-statuses","completion-tags","completion-types","guide","reindex","normalize","templates","templates list","templates save","templates show","test-runs","test-runs list","test-runs status","test-runs logs","test-runs stop","test-runs resume"]),je=new Set(["item","ops"]);function jt(e){let a=F(e);return U(e)&&!He.has(a)&&!je.has(a)}function z(e,a=[]){let t=e.value_name??e.discovery_value_name,l=T([...e.aliases??[],...a]);return{flag:e.flag,...e.short===void 0?{}:{short:e.short},reservation_scope:"inherited",owner:"host",...l.length>0?{aliases:l}:{},value_arity:t===void 0?"none":"required",...t===void 0?{}:{value_name:t},...e.repeatable===!0?{repeatable:!0}:{}}}function zt(e={}){return A.filter(a=>a.extension_command_availability===void 0||a.extension_command_availability==="read_output"&&e.readOutput===!0).map(a=>z(a))}function Xt(e,a=[],t={}){let l=F(e),n=G(l)!==void 0,r=!n&&G(l,{catalog:!0})!==void 0,f=new Set(a),p=_t(l).find(o=>o.flag==="--output-format"&&o.aliases?.includes("--format"))?.aliases??[];return A.filter(o=>(o.extension_command_availability!=="read_output"||n||r)&&(o.flag!=="--expect-hash"||t.expectHashAdmissible===!0)&&![o.flag,...o.aliases??[]].some(d=>f.has(d))).map(o=>{let d=z(o,o.flag==="--output-format"?p:[]);return r&&o.extension_command_availability==="read_output"?{...d,description:"Applies only with --catalog, which reads the package catalog."}:d}).concat(ze(l,f))}function ze(e,a){let t=A.find(l=>l.flag==="--output-budget");return Ue.has(e)&&t!==void 0&&!a.has(t.flag)?[{...z(t),values:["unbounded"],description:"Only unbounded is accepted: the inventory cannot trim rows to fit."}]:[]}function qt(e){return e.flatMap(a=>[a.flag,a.short,...a.aliases??[]].filter(t=>typeof t=="string"))}var Yt=[...j,{flag:"--version",value_type:"boolean",reservation_scope:"root_only"},{flag:"--all",value_type:"boolean",reservation_scope:"root_only",description:"Expand root help to every command."},{flag:"--explain",value_type:"boolean",reservation_scope:"root_only",description:"Expand root help with command guidance."}],ie=[{flag:"--filter-reviewer-missing"},{flag:"--filter-risk-missing"},{flag:"--filter-confidence-missing"},{flag:"--filter-sprint-missing"},{flag:"--filter-release-missing"},{flag:"--has-notes"},{flag:"--no-notes"},{flag:"--has-learnings"},{flag:"--no-learnings"},{flag:"--has-files"},{flag:"--no-files"},{flag:"--filter-files-missing"},{flag:"--has-docs"},{flag:"--no-docs"},{flag:"--filter-docs-missing"},{flag:"--has-tests"},{flag:"--no-tests"},{flag:"--has-comments"},{flag:"--no-comments"},{flag:"--has-deps"},{flag:"--no-deps"},{flag:"--has-body"},{flag:"--empty-body"},{flag:"--has-linked-command"},{flag:"--no-linked-command"}],ge=[{flag:"--filter-reviewer-missing"},{flag:"--filter-risk-missing"},{flag:"--filter-confidence-missing"},{flag:"--filter-sprint-missing"},{flag:"--filter-release-missing"},{flag:"--filter-has-notes"},{flag:"--filter-no-notes"},{flag:"--filter-has-learnings"},{flag:"--filter-no-learnings"},{flag:"--filter-has-files"},{flag:"--filter-no-files"},{flag:"--filter-has-docs"},{flag:"--filter-no-docs"},{flag:"--filter-has-tests"},{flag:"--filter-no-tests"},{flag:"--filter-has-comments"},{flag:"--filter-no-comments"},{flag:"--filter-has-deps"},{flag:"--filter-no-deps"},{flag:"--filter-has-body"},{flag:"--filter-empty-body"},{flag:"--filter-has-linked-command"},{flag:"--filter-no-linked-command"},{flag:"--ids",list:!0},{flag:"--limit"},{flag:"--offset"}],$=X([{flag:"--for",value_name:"intent"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--status",list:!0},{flag:"--all",value_type:"boolean"},{flag:"--type",list:!0},{flag:"--tag",aliases:["--tags"],list:!0},{flag:"--priority",list:!0},{flag:"--deadline-before"},{flag:"--deadline-after"},{flag:"--today"},{flag:"--recent"},{flag:"--updated-after"},{flag:"--updated-before"},{flag:"--created-after"},{flag:"--created-before"},{flag:"--ids",list:!0},{flag:"--assignee",list:!0},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--parent"},{flag:"--sprint",list:!0},{flag:"--release",list:!0},{flag:"--filter-ac-missing"},{flag:"--filter-estimates-missing",aliases:["--filter-estimate-missing"]},{flag:"--filter-resolution-missing"},{flag:"--filter-metadata-missing"},...ie,{flag:"--limit"},{flag:"--offset"},{flag:"--after"},{flag:"--no-truncate"},{flag:"--compact"},{flag:"--brief"},{flag:"--full"},{flag:"--fields",list:!0},{flag:"--sort"},{flag:"--order"},{flag:"--tree"},{flag:"--tree-depth"},{flag:"--tree_depth"},{flag:"--include-body"},{flag:"--strict-read"},{flag:"--format"},{flag:"--stream"}],new Set(["--limit","--token-budget","--offset","--after","--no-truncate","--compact","--brief","--full","--fields","--include-body","--strict-read"])),Xe=[{flag:"--group-by",list:!0},{flag:"--set-mode"},{flag:"--limit"},{flag:"--after"},{flag:"--count"},{flag:"--completion"},{flag:"--sum"},{flag:"--avg"},{flag:"--include-unparented"},{flag:"--include_unparented"},{flag:"--status",list:!0},{flag:"--type",list:!0},{flag:"--tag",list:!0},{flag:"--priority",list:!0},{flag:"--deadline-before"},{flag:"--deadline-after"},{flag:"--assignee",list:!0},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--parent"},{flag:"--sprint",list:!0},{flag:"--release",list:!0}],qe=[{flag:"--id",value_name:"item-id"},{flag:"--add",aliases:["--comment","--body","--text"]},{flag:"--stdin"},{flag:"--file"},{flag:"--edit"},{flag:"--delete"},{flag:"--expect-at"},{flag:"--limit"},{flag:"--full-history"},{flag:"--if-absent",value_type:"boolean"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];function X(e,a){return e.map(t=>a.has(t.flag)?{...t,cursor_semantics:"presentation"}:t)}var Ye=[{flag:"--id",value_name:"item-id"},{flag:"--add",aliases:["--note","--text"]},{flag:"--add-json"},{flag:"--stdin"},{flag:"--file"},{flag:"--edit"},{flag:"--delete"},{flag:"--expect-at"},{flag:"--limit"},{flag:"--since"},{flag:"--event-type"},{flag:"--include-meta"},{flag:"--full-history"},{flag:"--if-absent",value_type:"boolean"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],Be=[{flag:"--id",value_name:"item-id"},{flag:"--add",aliases:["--learning","--text"]},{flag:"--stdin"},{flag:"--file"},{flag:"--edit"},{flag:"--delete"},{flag:"--expect-at"},{flag:"--limit"},{flag:"--full-history"},{flag:"--if-absent",value_type:"boolean"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],Ve=[{flag:"--id",value_name:"item-id"},{flag:"--add"},{flag:"--add-glob"},{flag:"--remove"},{flag:"--migrate"},{flag:"--note"},{flag:"--note-conflict",value_name:"mode",values:["refuse","replace","append"],default:"refuse"},{flag:"--list"},{flag:"--append-stable"},{flag:"--validate-paths"},{flag:"--full-history"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],Ke=[{flag:"--id",value_name:"item-id"},{flag:"--apply",value_type:"boolean"},{flag:"--note"},{flag:"--append-stable",value_type:"boolean"},{flag:"--author"},{flag:"--message"},{flag:"--force",value_type:"boolean"}],We=[{flag:"--scope",value_name:"scope",values:["project","global"]},{flag:"--limit",value_name:"n",value_type:"number"},{flag:"--offset",value_name:"n",value_type:"number"},{flag:"--no-truncate",value_type:"boolean"},{flag:"--strict-read",value_type:"boolean"},{flag:"--explain",value_type:"boolean"},{flag:"--lines",value_name:"start:end"},{flag:"--decision-depth",value_name:"n",value_type:"number"}],Je=[{flag:"--id",value_name:"item-id"},{flag:"--add"},{flag:"--add-glob"},{flag:"--remove"},{flag:"--migrate"},{flag:"--note"},{flag:"--note-conflict",value_name:"mode",values:["refuse","replace","append"],default:"refuse"},{flag:"--list"},{flag:"--validate-paths"},{flag:"--full-history"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],Ze=[{flag:"--id",value_name:"item-id"},{flag:"--limit"},{flag:"--order",value_name:"value",value_type:"string"},{flag:"--compact"},{flag:"--full"},{flag:"--provenance"},{flag:"--provenance-summary"},{flag:"--harness",repeatable:!0},{flag:"--agent-instance",repeatable:!0},{flag:"--provenance-filter",repeatable:!0},{flag:"--diff"},{flag:"--field"},{flag:"--verify"},{flag:"--strict-exit"},{flag:"--fail-on-warn"},{flag:"--format"}],Qe=[{flag:"--dry-run"},{flag:"--pre-commit-hook",value_type:"boolean"},{flag:"--stage",value_type:"boolean"},{flag:"--message"},{flag:"--force"},{flag:"--include-reconciled"},{flag:"--output"},{flag:"--item-path"},{flag:"--prefer"}],ea=[{flag:"--id",value_name:"item-id"},{flag:"--literal"},{flag:"--regex"},{flag:"--replacement"},{flag:"--dry-run"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],aa=[{flag:"--id",value_name:"item-id"},{flag:"--all"},{flag:"--dry-run"},{flag:"--normalize-provenance"},{flag:"--salvage-tail",value_type:"boolean"},{flag:"--append-only",value_type:"boolean"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],ta=[{flag:"--event",repeatable:!0},{flag:"--all-actionable"},{flag:"--dry-run"},{flag:"--plan-fingerprint"},{flag:"--limit",value_type:"number"},{flag:"--attributed-author",aliases:["--attributed_author"]},{flag:"--reviewer"},{flag:"--reason"}],la=[{flag:"--id",value_name:"item-id"},{flag:"--before"},{flag:"--ids",list:!0},{flag:"--all-over",value_type:"number"},{flag:"--closed"},{flag:"--all-streams"},{flag:"--min-entries",value_type:"number"},{flag:"--dry-run"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],sa=[{flag:"--verify",value_name:"file",value_type:"string"},{flag:"--output",value_name:"file",value_type:"string"},{flag:"--hash-algorithm",value_name:"name",value_type:"string"}],na=[{flag:"--definition",value_name:"json"},{flag:"--policy",value_name:"id"},{flag:"--message",value_name:"value"},{flag:"--description"},{flag:"--default-status",aliases:["--default_status"]},{flag:"--folder"},{flag:"--alias"},{flag:"--role"},{flag:"--order"},{flag:"--type"},{flag:"--commands"},{flag:"--cli-flag"},{flag:"--required"},{flag:"--required-on-create"},{flag:"--no-allow-unset"},{flag:"--required-types"},{flag:"--infer"},{flag:"--min-count"},{flag:"--apply",value_type:"boolean"},{flag:"--to"},{flag:"--migration-id",aliases:["--migration_id"]},{flag:"--dry-run"},{flag:"--author"},{flag:"--force"}],oa=[{flag:"--dry-run"},{flag:"--author"},{flag:"--force"}],fe=[{flag:"--title"},{flag:"--description"},{flag:"--scope"},{flag:"--parent"},{flag:"--inherit-focus",value_type:"boolean",default:!0},{flag:"--no-inherit-focus",value_type:"boolean"},{flag:"--related"},{flag:"--blocks"},{flag:"--blocked-by",aliases:["--blocked_by"]},{flag:"--harness"},{flag:"--mode"},{flag:"--resume-context",aliases:["--resume_context"]},{flag:"--tags",aliases:["--tag"],list:!0},{flag:"--priority"},{flag:"--status",short:"-s"},{flag:"--create-mode",aliases:["--create_mode"]},{flag:"--deadline"},{flag:"--estimate",aliases:["--estimated-minutes","--estimated_minutes"]},{flag:"--acceptance-criteria",aliases:["--acceptance_criteria","--ac"],repeatable:!0},{flag:"--definition-of-ready",aliases:["--definition_of_ready"]},{flag:"--order"},{flag:"--rank"},{flag:"--goal"},{flag:"--objective"},{flag:"--value"},{flag:"--impact"},{flag:"--outcome"},{flag:"--why-now",aliases:["--why_now"]},{flag:"--assignee"},{flag:"--reviewer"},{flag:"--risk"},{flag:"--confidence"},{flag:"--sprint"},{flag:"--release"},{flag:"--blocked-reason",aliases:["--blocked_reason"]},{flag:"--unblock-note",aliases:["--unblock_note"]},{flag:"--reporter"},{flag:"--severity"},{flag:"--environment"},{flag:"--repro-steps",aliases:["--repro_steps"]},{flag:"--resolution"},{flag:"--expected-result",aliases:["--expected_result","--expected"]},{flag:"--actual-result",aliases:["--actual_result","--actual"]},{flag:"--affected-version",aliases:["--affected_version"]},{flag:"--fixed-version",aliases:["--fixed_version"]},{flag:"--component"},{flag:"--regression"},{flag:"--customer-impact",aliases:["--customer_impact"]},{flag:"--comment",repeatable:!0},{flag:"--note",repeatable:!0},{flag:"--learning",repeatable:!0},{flag:"--reminder",repeatable:!0},{flag:"--event",repeatable:!0},{flag:"--type-option",aliases:["--type_option"],repeatable:!0},{flag:"--body"},{flag:"--claim"},{flag:"--from-search",aliases:["--from_search"]},{flag:"--template"},{flag:"--step-title",aliases:["--step_title"]},{flag:"--step"},{flag:"--step-body",aliases:["--step_body"]},{flag:"--step-owner",aliases:["--step_owner"]},{flag:"--step-status",aliases:["--step_status"]},{flag:"--step-evidence",aliases:["--step_evidence"]},{flag:"--step-blocked-reason",aliases:["--step_blocked_reason"]},{flag:"--step-replacement",aliases:["--step_replacement"]},{flag:"--depends-on",aliases:["--depends_on"]},{flag:"--link"},{flag:"--link-kind",aliases:["--link_kind"]},{flag:"--link-note",aliases:["--link_note"]},{flag:"--promote-to-item-dep",aliases:["--promote_to_item_dep"]},{flag:"--allow-multiple-active",aliases:["--allow_multiple_active"]},{flag:"--file"},{flag:"--test"},{flag:"--doc"},{flag:"--decision-text",aliases:["--decision_text","--decision"]},{flag:"--decision-rationale",aliases:["--decision_rationale"]},{flag:"--decision-evidence",aliases:["--decision_evidence"]},{flag:"--discovery-text",aliases:["--discovery_text","--discovery"]},{flag:"--validation-text",aliases:["--validation_text","--validation"]},{flag:"--validation-command",aliases:["--validation_command"]},{flag:"--validation-expected",aliases:["--validation_expected"]},{flag:"--depth",values:J},{flag:"--field"},{flag:"--fields",list:!0},{flag:"--steps"},{flag:"--materialize-type",aliases:["--materialize_type"]},{flag:"--materialize-parent",aliases:["--materialize_parent"]},{flag:"--materialize-tags",aliases:["--materialize_tags"]},{flag:"--author"},{flag:"--message"},{flag:"--force"}],ra=[{flag:"--id-prefix",aliases:["--prefix"]},{flag:"--preset"},{flag:"--type-preset"},{flag:"--defaults",short:"-y",aliases:["--yes"]},{flag:"--author"},{flag:"--agent-guidance"},{flag:"--with-packages"},{flag:"--no-merge-fence"},{flag:"--workspace"},{flag:"--force"},{flag:"--verbose"}],ia=[{flag:"--value",value_name:"value"},{flag:"--criterion"},{flag:"--clear-criteria"},{flag:"--format"},{flag:"--policy"},{flag:"--default-depth"},{flag:"--activity-limit"},{flag:"--stale-threshold-days"},{flag:"--section-hierarchy"},{flag:"--section-activity"},{flag:"--section-progress"},{flag:"--section-blockers"},{flag:"--section-files"},{flag:"--section-workload"},{flag:"--section-staleness"},{flag:"--section-tests"}],ce=[{flag:"--dry-run"},{flag:"--init"},{flag:"--scaffold"},{flag:"--capability"},{flag:"--install"},{flag:"--uninstall"},{flag:"--explore"},{flag:"--list"},{flag:"--manage"},{flag:"--offline",value_type:"boolean"},{flag:"--describe"},{flag:"--markdown"},{flag:"--output"},{flag:"--reload"},{flag:"--watch"},{flag:"--doctor"},{flag:"--catalog"},{flag:"--adopt"},{flag:"--adopt-all"},{flag:"--activate"},{flag:"--deactivate"},{flag:"--project"},{flag:"--local"},{flag:"--global"},{flag:"--gh"},{flag:"--github"},{flag:"--ref"},{flag:"--detail"},{flag:"--trace"},{flag:"--runtime-probe"},{flag:"--fix-managed-state"},{flag:"--isolated"},{flag:"--ignore-global"},{flag:"--strict-exit"},{flag:"--fail-on-warn"}],u=[{flag:"--project"},{flag:"--local"},{flag:"--global"}],pe=[...u,{flag:"--capability"}],le=[...ce,{flag:"--declarative"}],ga=[...pe,{flag:"--declarative"}],fa=[{flag:"--dry-run"},{flag:"--project"},{flag:"--local"},{flag:"--global"},{flag:"--gh"},{flag:"--github"},{flag:"--ref"}],ca=u,R={flag:"--fields",list:!0},pa=[...u,R],se=[...u,R],da=[...u,{flag:"--markdown"},{flag:"--output"}],ua=u,ma=u,_a=u,va=[...u,{flag:"--dry-run"}],ha=[...u,{flag:"--offline",value_type:"boolean"},{flag:"--runtime-probe"},{flag:"--fix-managed-state"},R],Ta=[...u,{flag:"--watch"}],Aa=[...u,{flag:"--detail"},{flag:"--trace"},{flag:"--fix-managed-state"},{flag:"--isolated"},{flag:"--ignore-global"},{flag:"--strict-exit"},{flag:"--fail-on-warn"}],ya=[...u,R],Ca=[...u,{flag:"--gh"},{flag:"--github"},{flag:"--ref"}],ka=[{flag:"--dry-run"},{flag:"--project"},{flag:"--local"},{flag:"--global"},{flag:"--gh"},{flag:"--github"},{flag:"--ref"}],de=[{flag:"--dry-run"},{flag:"--cli-only"},{flag:"--packages-only"},{flag:"--project"},{flag:"--local"},{flag:"--global"},{flag:"--repair"},{flag:"--tag"},{flag:"--package-name"}],Bt=[{flag:"--mode"},{flag:"--progress"}],xa=[{flag:"--release-assignment",value_type:"boolean"},{flag:"--id",value_name:"item-id"},{flag:"--reason",short:"-r",value_name:"value"},{flag:"--close-reason",value_name:"value"},{flag:"--completed-at",value_name:"value"},{flag:"--duplicate-of",short:"-d",value_name:"value"},{flag:"--author",value_name:"value"},{flag:"--message",short:"-m",value_name:"value"},{flag:"--validate-close",value_name:"off|warn|strict"},{flag:"--resolution",value_name:"value"},{flag:"--expected-result",aliases:["--expected_result","--expected"],value_name:"value"},{flag:"--actual-result",aliases:["--actual_result","--actual"],value_name:"value"},{flag:"--force",value_type:"boolean"}],ba=[{flag:"--filter-status",list:!0},{flag:"--filter-type"},{flag:"--filter-tag"},{flag:"--filter-priority"},{flag:"--filter-deadline-before"},{flag:"--filter-deadline-after"},{flag:"--filter-updated-after"},{flag:"--filter-updated-before"},{flag:"--filter-created-after"},{flag:"--filter-created-before"},{flag:"--filter-assignee"},{flag:"--filter-assignee-filter"},{flag:"--filter-assignee_filter"},{flag:"--filter-parent"},{flag:"--filter-sprint"},{flag:"--filter-release"},...ge,{flag:"--reason"},{flag:"--completed-at"},{flag:"--resolution"},{flag:"--expected-result",aliases:["--expected_result","--expected"]},{flag:"--actual-result",aliases:["--actual_result","--actual"]},{flag:"--validate-close"},{flag:"--author"},{flag:"--message"},{flag:"--force"},{flag:"--dry-run"},{flag:"--rollback"},{flag:"--no-checkpoint"}],Sa=[{flag:"--id",value_name:"item-id"},{flag:"--body",short:"-b"},{flag:"--text"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],Na=[{flag:"--start",value_type:"boolean"},{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--force"},{flag:"--if-available"},{flag:"--takeover-stale"},{flag:"--next"},{flag:"--type"},{flag:"--tag"},{flag:"--priority"},{flag:"--assignee-filter"},{flag:"--parent"},{flag:"--sprint"},{flag:"--release"},{flag:"--max-attempts"},{flag:"--include-decisions"},{flag:"--include-gates"},{flag:"--include-containers"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--explain-ranking",aliases:["--explain_ranking"]}],Oa=[{flag:"--id",value_name:"item-id"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],Ea=[{flag:"--id",value_name:"item-id"},{flag:"--dry-run"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],wa=[{flag:"--pause",value_type:"boolean"},{flag:"--handoff",value_name:"status"},{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--force"}],La=[{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--force"},{flag:"--takeover-stale"}],Ra=[{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--force"}],Fa=[{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--validate-close",value_name:"off|warn|strict"},{flag:"--force"}],ue=[{flag:"--parent"},{flag:"--allow-missing-parent"},{flag:"--tags"},{flag:"--priority"},{flag:"--body"},{flag:"--description"},{flag:"--author"},{flag:"--message"}],me=[{flag:"--start"},{flag:"--duration"},{flag:"--end"},{flag:"--location"},{flag:"--timezone"},{flag:"--all-day"},...ue],Ia=me,Ga=[{flag:"--at"},{flag:"--text"},...ue],Pa=[{flag:"--list"},{flag:"--id",value_name:"item-id"},{flag:"--add"},{flag:"--add-json"},{flag:"--remove"},{flag:"--remove-index",repeatable:!0},{flag:"--update"},{flag:"--update-index"},{flag:"--set-json"},{flag:"--run"},{flag:"--match"},{flag:"--only-index"},{flag:"--only-last"},{flag:"--full-history"},{flag:"--background"},{flag:"--timeout"},{flag:"--progress"},{flag:"--env-set"},{flag:"--env-clear"},{flag:"--shared-host-safe"},{flag:"--pm-context"},{flag:"--override-linked-pm-context"},{flag:"--workspace-context"},{flag:"--override-linked-workspace-context"},{flag:"--allow-untrusted-linked-tests"},{flag:"--acknowledge-linked-tests"},{flag:"--fail-on-context-mismatch"},{flag:"--fail-on-skipped"},{flag:"--fail-on-empty-test-run"},{flag:"--require-assertions-for-pm"},{flag:"--check-context"},{flag:"--full-output"},{flag:"--auto-pm-context"},{flag:"--measure",list:!0,description:"Record numeric measurement evidence; requires --run and an executed linked command."},{flag:"--metric-below"},{flag:"--metric-diff"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],Ma=[{flag:"--status"},{flag:"--limit"},{flag:"--offset"},{flag:"--background"},{flag:"--timeout"},{flag:"--progress"},{flag:"--env-set"},{flag:"--env-clear"},{flag:"--shared-host-safe"},{flag:"--pm-context"},{flag:"--override-linked-pm-context"},{flag:"--workspace-context"},{flag:"--override-linked-workspace-context"},{flag:"--allow-untrusted-linked-tests"},{flag:"--fail-on-context-mismatch"},{flag:"--fail-on-skipped"},{flag:"--fail-on-empty-test-run"},{flag:"--require-assertions-for-pm"},{flag:"--check-context"},{flag:"--full-output"},{flag:"--auto-pm-context"}],Da=[{flag:"--limit"}],Vt=[{flag:"--status"},{flag:"--limit"},{flag:"--stream"},{flag:"--tail"},{flag:"--force"},{flag:"--author"}],$a=[{flag:"--dry-run"},{flag:"--scope"}],Ua=[{flag:"--include-empty"},{flag:"--storage"},{flag:"--metadata-coverage"},{flag:"--field-utilization"},{flag:"--by-assignee"},{flag:"--by-tag"},{flag:"--by-priority"},{flag:"--tag-prefix"},{flag:"--analytics"}],Ha=[{flag:"--exhaustive",value_type:"boolean"},{flag:"--status",repeatable:!0,list:!0},{flag:"--since"},{flag:"--threshold"},{flag:"--limit"}],ja=[{flag:"--strict-directories"},{flag:"--require-merge-drivers"},{flag:"--strict-exit"},{flag:"--fail-on-warn"},{flag:"--check-only"},{flag:"--check-telemetry"},{flag:"--no-refresh"},{flag:"--refresh-vectors"},{flag:"--verbose-stale-items"},{flag:"--verbose-author-events"},{flag:"--brief"},{flag:"--summary"},{flag:"--skip-vectors"},{flag:"--skip-integrity"},{flag:"--skip-drift"},{flag:"--full"}],za=[{flag:"--check-completeness",value_type:"boolean"},{flag:"--check-metadata"},{flag:"--metadata-profile"},{flag:"--check-resolution"},{flag:"--check-lifecycle"},{flag:"--check-stale-blockers"},{flag:"--dependency-cycle-severity"},{flag:"--parent-cycle-severity"},{flag:"--check-files"},{flag:"--scan-mode"},{flag:"--include-pm-internals"},{flag:"--verbose-file-lists"},{flag:"--verbose-diagnostics"},{flag:"--all-affected-ids"},{flag:"--strict-exit"},{flag:"--fail-on-warn"},{flag:"--fix-hints"},{flag:"--auto-fix"},{flag:"--dry-run"},{flag:"--fix-scope"},{flag:"--prune-missing"},{flag:"--check-history-drift"},{flag:"--check-command-references"},{flag:"--check-storage-integrity"},{flag:"--counts"},{flag:"--full"}],_e=[{flag:"--definition",value_name:"json"},{flag:"--trigger",value_name:"value"},{flag:"--tree",value_name:"value"},{flag:"--gate",value_name:"id"},{flag:"--limit",value_name:"number"},{flag:"--dry-run"},{flag:"--author",value_name:"value"},{flag:"--message",value_name:"value"},{flag:"--owner",value_name:"item-id"},{flag:"--apply",value_type:"boolean"},{flag:"--enforcement",value_name:"level"}],ve=[{flag:"--assignee"},{flag:"--parent"},{flag:"--allow-missing-parent"},{flag:"--allow-unresolved-deps"},{flag:"--reviewer"},{flag:"--risk"},{flag:"--confidence"},{flag:"--sprint"},{flag:"--release"},{flag:"--blocked-by"},{flag:"--blocked-reason"},{flag:"--unblock-note"},{flag:"--reporter"},{flag:"--severity"},{flag:"--environment"},{flag:"--repro-steps"},{flag:"--resolution"},{flag:"--expected-result"},{flag:"--actual-result"},{flag:"--affected-version"},{flag:"--fixed-version"}],he=[{flag:"--component"},{flag:"--regression"},{flag:"--customer-impact"},{flag:"--customer_impact"},{flag:"--definition-of-ready"},{flag:"--definition_of_ready"},{flag:"--order"},{flag:"--rank"},{flag:"--goal"},{flag:"--objective"},{flag:"--value"},{flag:"--impact"},{flag:"--outcome"},{flag:"--why-now"},{flag:"--why_now"}],Te=[{short:"-p",flag:"--priority"},{flag:"--type"},{flag:"--tags",aliases:["--tag"],list:!0},{flag:"--add-tags",aliases:["--add_tags"]},{flag:"--remove-tags",aliases:["--remove_tags"]},{flag:"--deadline"},{flag:"--estimate"},{flag:"--estimated-minutes"},{flag:"--estimated_minutes"},{flag:"--acceptance-criteria"},{flag:"--acceptance_criteria"},{flag:"--ac"},{flag:"--add-ac",aliases:["--add_ac"]},{flag:"--remove-ac",aliases:["--remove_ac"]}],ne=[{flag:"--inherit-focus",value_type:"boolean",default:!0},{flag:"--no-inherit-focus",value_type:"boolean"},{flag:"--stdin-json"},{short:"-t",flag:"--title"},{flag:"--id"},{short:"-d",flag:"--description"},{flag:"--type"},{flag:"--template"},{flag:"--create-mode"},{flag:"--create_mode"},{flag:"--defer",repeatable:!0},{flag:"--defer-reason",aliases:["--defer_reason"]},{flag:"--schedule-preset"},{flag:"--schedule_preset"},{short:"-s",flag:"--status"},{flag:"--close-reason"},{flag:"--close_reason"},{flag:"--completed-at"},{flag:"--completed_at"},{short:"-p",flag:"--priority"},{flag:"--tags",aliases:["--tag"],list:!0},{flag:"--add-tags",aliases:["--add_tags"]},{short:"-b",flag:"--body",value_name:"value"},{flag:"--body-file"},{flag:"--deadline"},{flag:"--estimate"},{flag:"--estimated-minutes"},{flag:"--estimated_minutes"},{flag:"--acceptance-criteria"},{flag:"--acceptance_criteria"},{flag:"--ac"},{flag:"--author"},{flag:"--message"},...ve,...he,{flag:"--blocked_by"},{flag:"--blocked_reason"},{flag:"--unblock_note"},{flag:"--repro_steps"},{flag:"--expected_result"},{flag:"--actual_result"},{flag:"--expected"},{flag:"--actual"},{flag:"--affected_version"},{flag:"--fixed_version"},{flag:"--dep"},{flag:"--type-option"},{flag:"--type_option"},{flag:"--field"},{flag:"--reminder"},{flag:"--event"},{flag:"--comment"},{flag:"--note"},{flag:"--learning"},{flag:"--file",aliases:["--linked-file"]},{flag:"--test",aliases:["--linked-test"]},{flag:"--doc"},{flag:"--unset",repeatable:!0},{flag:"--clear-deps"},{flag:"--clear-comments"},{flag:"--clear-notes"},{flag:"--clear-learnings"},{flag:"--clear-files"},{flag:"--clear-tests"},{flag:"--clear-docs"},{flag:"--clear-reminders"},{flag:"--clear-events"},{flag:"--clear-type-options"},{flag:"--allow-duplicate",value_type:"boolean"}],Xa=[{flag:"--transaction-id",value_name:"value"},{flag:"--stdin-json"},{flag:"--from",value_name:"path"},{flag:"--upsert-key",value_name:"field"},{flag:"--dry-run"},{flag:"--create-compensation",value_name:"mode"},{flag:"--lock-ttl-seconds",value_name:"n"},{flag:"--lock-wait-ms",value_name:"n"},{flag:"--author",value_name:"value"}],qa=[{flag:"--id",value_name:"item-id"},{flag:"--transaction-id",value_name:"value",required:!0},{flag:"--reason",value_name:"value"},{flag:"--file",value_name:"value",repeatable:!0},{flag:"--doc",value_name:"value",repeatable:!0},{flag:"--test",value_name:"value",repeatable:!0},{flag:"--comment",value_name:"value",repeatable:!0},{flag:"--note",value_name:"value",repeatable:!0},{flag:"--learning",value_name:"value",repeatable:!0},{flag:"--resolution",value_name:"value"},{flag:"--expected-result",value_name:"value"},{flag:"--actual-result",value_name:"value"},{flag:"--completed-at",value_name:"value"},{flag:"--validate-close",value_name:"off|warn|strict"},{flag:"--lock-ttl-seconds",value_name:"n"},{flag:"--lock-wait-ms",value_name:"n"},{flag:"--dry-run"},{flag:"--force"},{flag:"--author",value_name:"value"}],Ya=[{flag:"--id",value_name:"item-id"},{flag:"--status",value_name:"open|in_progress"},{flag:"--expected-result",value_name:"value",aliases:["--expected"]},{flag:"--message",value_name:"value"},{flag:"--force"},{flag:"--author",value_name:"value"}],Ba=[{flag:"--id",value_name:"item-id"},{flag:"--title",value_name:"value"},{flag:"--author",value_name:"value"},{flag:"--message",value_name:"value"},{flag:"--allow-duplicate",value_type:"boolean"}],Va=[{flag:"--id",value_name:"item-id"},{flag:"--clear"}],Ka=[{flag:"--id",value_name:"item-id"},{flag:"--stdin-json"},{short:"-t",flag:"--title"},{short:"-d",flag:"--description"},{short:"-b",flag:"--body"},{flag:"--body-file"},{short:"-s",flag:"--status"},{flag:"--close-reason"},{flag:"--close_reason"},{flag:"--completed-at"},...Te,...ve,{flag:"--fixed_version"},...he,{flag:"--author"},{flag:"--message"},{flag:"--blocked_by"},{flag:"--blocked_reason"},{flag:"--unblock_note"},{flag:"--repro_steps"},{flag:"--expected_result"},{flag:"--actual_result"},{flag:"--expected"},{flag:"--actual"},{flag:"--affected_version"},{flag:"--dep"},{flag:"--dep-remove"},{flag:"--dep_remove"},{flag:"--replace-deps"},{flag:"--replace-tests"},{flag:"--replace-files"},{flag:"--replace-docs"},{flag:"--comment"},{flag:"--note"},{flag:"--learning"},{flag:"--file",aliases:["--linked-file"]},{flag:"--test",aliases:["--linked-test"]},{flag:"--doc"},{flag:"--reminder"},{flag:"--event"},{flag:"--type-option"},{flag:"--type_option"},{flag:"--field"},{flag:"--unset",repeatable:!0},{flag:"--clear-deps"},{flag:"--clear-comments"},{flag:"--clear-notes"},{flag:"--clear-learnings"},{flag:"--clear-files"},{flag:"--clear-tests"},{flag:"--clear-docs"},{flag:"--clear-reminders"},{flag:"--clear-events"},{flag:"--clear-type-options"},{flag:"--force"}],Wa=[{flag:"--status",short:"-s"},{flag:"--assignee"},{flag:"--parent"},{flag:"--blocked-by",aliases:["--blocked_by"]},{flag:"--blocked-reason",aliases:["--blocked_reason"]},{flag:"--unblock-note",aliases:["--unblock_note"]},{flag:"--filter-status",list:!0},{flag:"--filter-type",list:!0},{flag:"--filter-tag",list:!0},{flag:"--filter-priority",list:!0},{flag:"--filter-deadline-before"},{flag:"--filter-deadline-after"},{flag:"--filter-updated-after"},{flag:"--filter-updated-before"},{flag:"--filter-created-after"},{flag:"--filter-created-before"},{flag:"--filter-assignee",list:!0},{flag:"--filter-assignee-filter"},{flag:"--filter-assignee_filter"},{flag:"--filter-parent"},{flag:"--filter-sprint",list:!0},{flag:"--filter-release",list:!0},{flag:"--filter-ac-missing"},{flag:"--filter-estimates-missing",aliases:["--filter-estimate-missing"]},{flag:"--filter-resolution-missing"},{flag:"--filter-metadata-missing"},...ge,{flag:"--dry-run"},{flag:"--rollback"},{flag:"--no-checkpoint"},{short:"-t",flag:"--title"},{short:"-d",flag:"--description"},{short:"-b",flag:"--body"},...Te,{flag:"--definition-of-ready"},{flag:"--definition_of_ready"},{flag:"--order"},{flag:"--rank"},{flag:"--goal"},{flag:"--objective"},{flag:"--value"},{flag:"--impact"},{flag:"--outcome"},{flag:"--why-now"},{flag:"--why_now"},{flag:"--reviewer"},{flag:"--risk"},{flag:"--confidence"},{flag:"--sprint"},{flag:"--release"},{flag:"--reporter"},{flag:"--severity"},{flag:"--environment"},{flag:"--repro-steps"},{flag:"--repro_steps"},{flag:"--resolution"},{flag:"--expected-result"},{flag:"--expected_result"},{flag:"--expected"},{flag:"--actual-result"},{flag:"--actual_result"},{flag:"--actual"},{flag:"--affected-version"},{flag:"--affected_version"},{flag:"--fixed-version"},{flag:"--fixed_version"},{flag:"--component"},{flag:"--regression"},{flag:"--customer-impact"},{flag:"--customer_impact"},{flag:"--allow-unresolved-deps"},{flag:"--dep"},{flag:"--dep-remove"},{flag:"--dep_remove"},{flag:"--replace-deps"},{flag:"--replace-tests"},{flag:"--replace-files"},{flag:"--replace-docs"},{flag:"--comment"},{flag:"--note"},{flag:"--learning"},{flag:"--file"},{flag:"--test"},{flag:"--doc"},{flag:"--reminder"},{flag:"--event"},{flag:"--type-option"},{flag:"--type_option"},{flag:"--unset",repeatable:!0},{flag:"--clear-deps"},{flag:"--clear-comments"},{flag:"--clear-notes"},{flag:"--clear-learnings"},{flag:"--clear-files"},{flag:"--clear-tests"},{flag:"--clear-docs"},{flag:"--clear-reminders"},{flag:"--clear-events"},{flag:"--clear-type-options"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],oe=[{flag:"--view"},{flag:"--date"},{flag:"--from"},{flag:"--to"},{flag:"--past"},{flag:"--full-period"},{flag:"--full_period"},{flag:"--type"},{flag:"--tag"},{flag:"--priority"},{flag:"--status"},{flag:"--assignee"},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--sprint"},{flag:"--release"},{flag:"--include"},{flag:"--recurrence-lookahead-days"},{flag:"--recurrence-lookback-days"},{flag:"--occurrence-limit"},{flag:"--limit"},{flag:"--after",cursor_semantics:"presentation"},{flag:"--format"}],Ja=[{flag:"--id"},{flag:"--op"},{flag:"--author"},{flag:"--from"},{flag:"--to"},{flag:"--limit"},{flag:"--after",cursor_semantics:"presentation"},{flag:"--unbounded"},{flag:"--compact"},{flag:"--raw"},{flag:"--full"},{flag:"--provenance"},{flag:"--provenance-summary"},{flag:"--harness",repeatable:!0},{flag:"--agent-instance",repeatable:!0},{flag:"--provenance-filter",repeatable:!0},{flag:"--stream"}],Za=[{flag:"--verify"},{flag:"--since"},{flag:"--type",repeatable:!0},{flag:"--author",repeatable:!0},{flag:"--item",repeatable:!0},{flag:"--limit",value_type:"number"},{flag:"--cursor-mode",value_name:"batch|row"},{flag:"--full"},{flag:"--provenance"},{flag:"--provenance-summary"},{flag:"--harness",repeatable:!0},{flag:"--agent-instance",repeatable:!0},{flag:"--provenance-filter",repeatable:!0},{flag:"--follow"},{flag:"--interval-ms",value_type:"number"}],re=X([{flag:"--for",value_name:"intent"},{flag:"--date"},{flag:"--from"},{flag:"--to"},{flag:"--past"},{flag:"--type"},{flag:"--tag"},{flag:"--priority"},{flag:"--assignee"},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--sprint"},{flag:"--release"},{flag:"--parent"},{flag:"--limit",aliases:["--max-items"]},{flag:"--after"},{flag:"--format"},{flag:"--depth",values:q},{flag:"--fields",list:!0},{flag:"--section"},{flag:"--activity-limit"},{flag:"--stale-threshold"},{flag:"--explain-ranking"},{flag:"--explain_ranking"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--no-extension-health"},{flag:"--no-tags"}],new Set(["--limit","--after","--format","--fields","--section","--activity-limit","--stale-threshold","--explain-ranking","--explain_ranking","--no-extension-health","--no-tags"])),Qa=[{flag:"--id",value_name:"item-id"},{flag:"--for",value_name:"intent"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--depth",values:W},{flag:"--full",value_type:"boolean"},{flag:"--fields",list:!0},{flag:"--at"},{flag:"--tree"},{flag:"--tree-depth"},{flag:"--tree_depth"},{flag:"--format"}],et=[{flag:"--list"},{flag:"--format"},{flag:"--depth"}],at=[{flag:"--id",value_name:"item-id"},{flag:"--format"},{flag:"--max-depth"},{flag:"--collapse"},{flag:"--summary"},{flag:"--full"},{flag:"--node-limit"},{flag:"--edge-limit"},{flag:"--token-budget"},{flag:"--cursor"},{flag:"--direction"},{flag:"--kind",list:!0}],tt=[{flag:"--kind",list:!0},{flag:"--max-depth",description:`Maximum traversal depth; paths default to ${y.path_depth}.`},{flag:"--limit",description:`Maximum rows per collection; default ${y.rows}. Use --full to remove the row cap.`},{flag:"--after"},{flag:"--direction"},{flag:"--max-paths",description:`Maximum enumerated paths; default ${y.paths}.`},{flag:"--sample",description:`Maximum evidence examples per audit finding; default ${y.samples}.`},{flag:"--exempt-isolate",list:!0},{flag:"--exempt-isolate-type",list:!0},{flag:"--save-baseline"},{flag:"--rebuild"},{flag:"--clear"},{flag:"--summary"},{flag:"--full"}],lt=[{flag:"--mode"},{flag:"--k"},{flag:"--fail-under"},{flag:"--queries"},{flag:"--format"}],_=[{flag:"--dry-run"},{flag:"--force"},{flag:"--author"},{flag:"--message"}],Ae=[],st=[{flag:"--include-decisions"},{flag:"--include-gates"},{flag:"--include-containers"},{flag:"--for",value_name:"intent"},{flag:"--type"},{flag:"--tag"},{flag:"--priority"},{flag:"--assignee"},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--sprint"},{flag:"--release"},{flag:"--parent"},{flag:"--limit"},{flag:"--blocked-limit"},{flag:"--blocked_limit"},{flag:"--ready-only"},{flag:"--ready_only"},{flag:"--format"},{flag:"--explain-ranking"},{flag:"--explain_ranking"},{flag:"--token-budget",aliases:["--token_budget"]}],nt=X([{flag:"--for",value_name:"intent"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--mode"},{flag:"--semantic"},{flag:"--hybrid"},{flag:"--match-mode"},{flag:"--min-score"},{flag:"--count"},{flag:"--semantic-weight"},{flag:"--include-linked"},{flag:"--title-exact"},{flag:"--phrase-exact"},{flag:"--highlight"},{flag:"--compact"},{flag:"--full"},{flag:"--fields",list:!0},{flag:"--format"},{flag:"--limit"},{flag:"--after"},{flag:"--status",list:!0},{flag:"--type",list:!0},{flag:"--tag",aliases:["--tags"],list:!0},{flag:"--priority",list:!0},{flag:"--deadline-before"},{flag:"--deadline-after"},{flag:"--updated-after"},{flag:"--updated-before"},{flag:"--created-after"},{flag:"--created-before"},{flag:"--assignee",list:!0},{flag:"--sprint",list:!0},{flag:"--release",list:!0},{flag:"--parent"},...ie],new Set(["--highlight","--compact","--full","--fields","--format","--limit","--token-budget","--after"])),ot=[{flag:"--action"},{flag:"--command"},{flag:"--summary"},{flag:"--schema-only"},{flag:"--flags-only"},{flag:"--availability-only"},{flag:"--runtime-only"},{flag:"--active-only"},{flag:"--full"}],rt=[{flag:"--eager-tags"}];function Kt(e){let a=new Set,t=[];for(let l of e){let n=(l.aliases??[]).join(","),r=`${l.flag}|${l.short??""}|${n}`;a.has(r)||(a.add(r),t.push(l))}return t}function E(e,a=!1){let t=new Map;for(let l of[...j,...e]){let n=w(l.flag),r=t.get(n),{aliases:f,...p}=l,o=T([...f??[],...l.flag===n?[]:[l.flag]]).filter(m=>m!==n),d={...p,flag:n,...o.length>0?{aliases:o}:{}},g=T([...r?.aliases??[],...d.aliases??[]]);t.set(n,r===void 0?d:{...r,...d,...g.length>0?{aliases:g}:{}})}if(a&&e.length>0&&!t.has("--format")){let l=t.get("--output-format");t.set("--output-format",{...l,aliases:[...l.aliases??[],"--format"]})}return H([...t.values()])}var it=["list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled"],gt=$.filter(e=>e.flag!=="--status"&&e.flag!=="--all");function L(e){let a=new Map;for(let t of e)for(let l of[t.flag,...t.aliases??[]]){let n=a.get(l)??[];n.push(t),a.set(l,n)}return a}var ft=L(fe),ct=L(_e),pt=new Map([["assurance",ct],["plan",ft],["workspace",L(Ae)],["workspace snapshot",L(_)]]);function dt(e=h){return e.map(({command:a,parent:t,accepted_flags:l})=>{let n=pt.get(t);if(!n)throw new Error(`Positional action ${a} has no flag-contract index for ${t}.`);let r=l.map(f=>{let p=n.get(f)??[];if(p.length!==1)throw new Error(`Positional action ${a} accepted flag ${f} does not resolve to exactly one ${t} flag contract.`);return p[0]});return[a,r]})}var ut=dt(),ye=new Map([["list",$],["list-all",$],...it.map(e=>[e,gt]),["templates",ne],["cal",oe],["ctx",re],["test-runs-worker",[]],["init",ra],["config",ia],["extension",ce],["package",le],["packages",le],["install",ka],["upgrade",de],["create",ne],["item",[]],["item mutate",Xa],["item complete",qa],["item reopen",Ya],["copy",Ba],["focus",Va],["aggregate",Xe],["calendar",oe],["context",re],["get",Qa],["guide",et],["search",nt],["next",st],["eval",lt],["workspace",_],["workspace position",Ae],["workspace snapshot",_],["workspace snapshot create",_],["workspace snapshot list",_],["workspace snapshot inspect",_],["workspace snapshot restore",_],["workspace snapshot delete",_],["history",Ze],["history-redact",ea],["history-repair",aa],["history-author-acknowledge",ta],["history-compact",la],["history-attest",sa],["merge",Qe],["schema",na],["profile",oa],["plan",fe],["activity",Ja],["events",Za],["restore",Oa],["update",Ka],["update-many",Wa],["close",xa],["close-many",ba],["delete",Ea],["append",Sa],["comments",qe],["notes",Ye],["learnings",Be],["files",Ve],["files discover",Ke],["files lookup",We],["docs",Je],["deps",at],["graph",tt],["test",Pa],["test-all",Ma],["telemetry",Da],["health",ja],["assurance",_e],...ut,["validate",za],["gc",$a],["stats",Ua],["duplicates",Ha],["contracts",ot],["completion",rt],["claim",Na],["release",wa],["start-task",La],["pause-task",Ra],["close-task",Fa],["meet",me],["event",Ia],["remind",Ga]]),Ce=new Map([["install",fa],["uninstall",ca],["explore",pa],["manage",ha],["describe",da],["reload",Ta],["doctor",Aa],["catalog",ya],["inventory",se],["list",se],["adopt",Ca],["adopt-all",ua],["activate",ma],["deactivate",_a],["migrate",va]]);function F(e){return typeof e!="string"?"":b(e.trim().toLowerCase())}function U(e){let a=F(e);if(ye.has(a))return!0;let[t,l,...n]=a.split(/\s+/),r=t==="package"||t==="packages";return(t==="extension"||r)&&l!==void 0&&n.length===0&&(l==="init"||l==="scaffold"||r&&l==="upgrade"||Ce.has(l))}function mt(e,a){return a==="init"||a==="scaffold"?e==="extension"?pe:ga:Ce.get(a)??[]}function _t(e){let a=F(e);if(a.length===0)return E([]);let[t,l,...n]=a.split(/\s+/);if((t==="extension"||t==="package"||t==="packages")&&l!==void 0&&n.length===0)return(t==="package"||t==="packages")&&l==="upgrade"?E(de,!0):E(mt(t,l),U(a));let r=ye.get(a)??[];return E(r,U(a))}function Wt(e,a=!0){let l=H(e).flatMap(r=>[r.short,r.flag,...r.aliases??[]]).filter(r=>!!r),n=a?[...l,...j.flatMap(r=>[r.short,r.flag,...r.aliases??[]]).filter(r=>!!r)]:l;return T(n).join(" ")}export{T as a,ht as b,Tt as c,At as d,xe as e,yt as f,be as g,W as h,J as i,Ct as j,kt as k,xt as l,D as m,Le as n,h as o,Nt as p,Ge as q,Ot as r,O as s,M as t,N as u,ee as v,Pe as w,S as x,Et as y,wt as z,H as A,Ht as B,j as C,Ue as D,He as E,jt as F,zt as G,Xt as H,qt as I,Yt as J,$ as K,Xe as L,qe as M,Ye as N,Be as O,Ve as P,Ke as Q,We as R,Je as S,Ze as T,Qe as U,ea as V,aa as W,ta as X,la as Y,sa as Z,na as _,oa as $,fe as aa,ra as ba,ia as ca,ce as da,u as ea,pe as fa,le as ga,ga as ha,fa as ia,ca as ja,pa as ka,se as la,da as ma,ua as na,ma as oa,_a as pa,va as qa,ha as ra,Ta as sa,Aa as ta,ya as ua,Ca as va,ka as wa,de as xa,Bt as ya,xa as za,ba as Aa,Sa as Ba,Na as Ca,Oa as Da,Ea,wa as Fa,La as Ga,Ra as Ha,Fa as Ia,me as Ja,Ia as Ka,Ga as La,Pa as Ma,Ma as Na,Da as Oa,Vt as Pa,$a as Qa,Ua as Ra,Ha as Sa,ja as Ta,za as Ua,_e as Va,ne as Wa,Xa,qa as Ya,Ya as Za,Ba as _a,Va as $a,Ka as ab,Wa as bb,oe as cb,Ja as db,Za as eb,re as fb,Qa as gb,et as hb,at as ib,tt as jb,lt as kb,_ as lb,st as mb,nt as nb,ot as ob,rt as pb,Kt as qb,dt as rb,ut as sb,U as tb,_t as ub,Wt as vb};
|
|
2
|
+
//# sourceMappingURL=chunk-QZRYGYTI.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{K as Qu,v as te,z as Ms}from"./chunk-7G7JIXLL.js";import{a as js,d as Hs,e as om,f as Us,g as sm}from"./chunk-KPASZGBL.js";import{a as ji,b as hr}from"./chunk-IIP6LZ5E.js";import{h as gm,j as ym}from"./chunk-P55AZPFN.js";import{c as Dt,d as Cn,e as $n,f as Tn,g as cm,j as _m}from"./chunk-IIVDBAJM.js";import{a as am}from"./chunk-XR6MLUVW.js";import{a as hs,c as di,d as li,e as cl,g as dl,h as gs,i as ys,j as vl,k as hn,l as _n,m as kl,n as bl,o as ws}from"./chunk-LWBZ7UGG.js";import{g as lu,h as uu,i as As}from"./chunk-4YBMHMBJ.js";import{a as Ds}from"./chunk-K53OIT5J.js";import{H as iu,I as Ai,J as ou,K as Rs,M as su,N as au,P as cu,Q as du,R as Ii,_ as Ci}from"./chunk-U35K7FSE.js";import{K as hm}from"./chunk-NJTKGBSK.js";import{A as Ve,B as I,C as Hi,D as dm,E as On,F as zs,G as lm,H as um,I as be,J as _r,K as Ui,L as mm,M as Pn,N as pm,Q as fm,Z as Ws,w as nm,y as im}from"./chunk-XR745UGE.js";import{a as Fs,b as rm}from"./chunk-RQYVX2T6.js";import{$a as Ps,A as ur,Aa as pr,B as pu,C as fu,Ca as $s,D as mr,Ga as Mu,Ha as Fu,Hb as Yu,Ia as ju,Ja as Hu,Ka as Mi,M as hu,Ma as Uu,Na as zu,Oa as Wu,Pa as Kt,Pb as Xu,Qa as qu,Qb as Zu,R as _u,Ra as Rn,Sa as Gu,Ta as Ts,Ua as An,Va as Bu,Wa as Vu,Xa as Ju,Ya as Os,Za as Ku,_a as In,a as il,ab as Ls,b as mn,ba as gu,c as _s,ca as yu,d as ol,da as wu,e as sl,f as pt,g as ui,ga as Oi,h as al,i as Tt,rb as Ns,v as $i,xa as Li,ya as Eu,z as mu,za as Cs}from"./chunk-WAP3DF4B.js";import{d as fr,f as Fi,m as em,p as tm}from"./chunk-UQJ4PY2Y.js";import{A as Ni,C as Lu,D as _e,E as ge,F as Nu,G as Di,H as ht,I as _t,M as Du,N as gt,a as Ti,c as vu,j as Ru,k as Au,m as Iu,n as Cu,o as Nt,p as $u,q as Tu,u as Ou,v as Pu}from"./chunk-M57KDG7I.js";import{a as re,b as bn,c as ku,d as Is,e as xn,f as Sn,g as En,h as bu,i as xu,l as Be,q as Su,r as T,s as Pi,x as ie}from"./chunk-MZNV26XE.js";import{$a as xl,A as Re,Ab as Pt,B as et,Bb as Tl,Bc as We,C as qd,Cb as Ol,Cc as xs,Da as Bt,E as X,Ec as wn,Ed as Zl,Fc as gi,Gc as ft,Gd as Si,H as Gd,Hb as Pl,Hc as ke,Hd as Ql,Ib as Ll,Ic as cr,Id as eu,Jc as Wl,Kb as Nl,Kc as ql,Kd as tu,Lb as Dl,Lc as Gl,M as ci,Ma as fs,Mb as se,Mc as Bl,N as Xd,Nc as Vl,O as us,Oa as un,Oc as yi,P as ms,Pc as Jt,Q as ps,Qa as nt,Qc as wi,S as Zd,Sa as rt,Sd as U,T as Qd,W as el,Wc as Jl,Wd as Y,Xc as dr,Yc as vn,Zc as qe,_d as Ge,a as Ld,ad as kn,ae as nu,ba as nl,bd as vi,be as Ei,cb as ve,cd as Kl,d as Nd,db as vs,dd as ki,e as Dd,eb as pi,fb as ar,fd as Yl,gb as Rl,ge as ru,h as dn,hb as fi,hd as bi,ib as Al,kb as hi,lb as _i,me as Ri,nb as Il,nc as q,oc as Ml,od as Ss,pd as Es,q as zd,qc as Fl,qd as Xl,rb as Cl,rc as jl,sb as $l,sc as ze,t as Wd,tc as Hl,ua as rl,uc as Ul,v as ds,vb as Le,vc as ks,wc as zl,xc as bs,yd as lr,zc as Lt,zd as xi}from"./chunk-HXM7K6VH.js";import{B as yn,C as K,K as El,c as A,d as ls,e as Ce,p as tl,u as $,v as Sl,w as gn,x as Ot,y as Vt}from"./chunk-NGHT2LNG.js";import{e as Vd,f as Jd,g as W,l as sr,n as M,o as tt,p as ai,q as ln,s as Kd,t as mt,v as Yd}from"./chunk-26P6C6OO.js";import{E as Bd,G as ce,I as ll,J as pn,K as fn,L as ul,M as ml,N as pl,O as fl,P as we,T as hl,V as $e,W as _l,X as gl,Z as Te,ba as he,ca as yl,da as mi,fa as wl,i as cs}from"./chunk-JFICNN4T.js";import{A as g,B as or,C as P,D as Qe,E as H,F as B,J as ee,a as ii,d as oi,p as Md,r as Fd,t as jd,v as Hd,w as si,x as Ud,y as $t,z as y}from"./chunk-IRYNVGKH.js";var L=class extends TypeError{constructor(t){super(t),this.name="AssuranceMutationRefusalError"}},Ae=class extends TypeError{context;constructor(t,n={}){super(t),this.name="AssuranceEvaluationRefusalError",this.context=n}},it=class extends TypeError{measurement_id;source_kind;field;check;constructor(t,n){super(t),this.name="AssuranceSourceResolutionError",this.measurement_id=n.measurement_id,this.source_kind=n.source_kind,this.field=n.field,this.check=n.check}};async function Ln(e){try{return await e()}catch(t){throw t instanceof L?new g(t.message,y.USAGE,{code:"invalid_argument_value",reason:"assurance_mutation_refused"}):t}}async function qs(e){try{return await e()}catch(t){throw t instanceof Ae?new g(t.message,y.USAGE,{code:"invalid_argument_value",reason:"assurance_evaluation_refused",...t.context}):t}}import{createHash as pv}from"node:crypto";import fv from"node:path";var vm=1,Yt=["pre-commit","pre-push","pre-merge","ci","pre-release","post-release","scheduled","on-claim","on-close"],Gs=["items","dependency_kind","prose_edge_gap","graph","validate","health","history","links","provider","derived"],hv=["ceiling","floor","equals","zero","monotone_nondecreasing","monotone_nonincreasing","subset_of"],_v=/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/,zi=30,Wi=5e3,km=4,gv=50;function yt(e,t){if(!_v.test(e))throw new L(`${t} must be a stable lowercase id`)}function yv(e,t){if(!Number.isFinite(e)||e<0)throw new L(`${t} must be a finite non-negative number`)}function yr(e){let t=hv.filter(i=>e[i]!==void 0);if(t.length!==1)throw new L(`assertion ${e.id} must declare exactly one polarity`);let n=t[0],r=e[n];return{polarity:n,value:n==="zero"?0:r}}function Vs(e,t){return A(e)===A(t)}function bm(e,t){if(t.polarity==="equals")return Vs(e,t.value);if(t.polarity==="subset_of"){if(!Array.isArray(e)||!Array.isArray(t.value))return!1;let r=t.value;return e.every(i=>r.includes(i))}if(typeof e!="number")return!1;let n=t.value;return t.polarity==="ceiling"||t.polarity==="monotone_nonincreasing"?e<=n:t.polarity==="floor"||t.polarity==="monotone_nondecreasing"?e>=n:e===0}function xm(e){let t=yr(e),n=e.negative_control.cases;return n.some(r=>r.expected==="pass")&&n.some(r=>r.expected==="fail")&&n.every(r=>bm(r.observed,t)===(r.expected==="pass"))}function wv(e,t){if(e.polarity!==t.polarity)return!0;if(typeof e.value=="number"&&typeof t.value=="number")return e.polarity==="ceiling"||e.polarity==="monotone_nonincreasing"?t.value>e.value:e.polarity==="floor"||e.polarity==="monotone_nondecreasing"?t.value<e.value:t.value!==e.value;if(e.polarity==="subset_of"){let n=e.value,r=t.value;return!Array.isArray(n)||!Array.isArray(r)||r.some(i=>!n.includes(i))}return!Vs(e.value,t.value)}function vv(e,t){if(e.measurement_id!==t.measurement_id||e.owner_item_id!==t.owner_item_id||A(e.scope)!==A(t.scope))return!0;let n={observe:0,warn:1,block:2},r=(e.lifetime??"hold")==="hold"&&(t.lifetime??"hold")==="retire";return wv(yr(e),yr(t))||n[t.enforcement]<n[e.enforcement]||r}function kv(e){if(e.state!==void 0&&!(e.state==="present"||e.state==="missing"))throw new L("items source state must be present or missing");let t=Object.hasOwn(e,"equals"),n=e.state!==void 0,r=Number(t)+Number(n);if(e.field!==void 0&&r!==1)throw new L("items source with field requires exactly one of equals or state");if(e.field===void 0&&r!==0)throw new L("items source equals/state requires field")}function bv(e){if(typeof e.dependency_kind!="string"||e.dependency_kind.trim().length===0)throw new L("dependency_kind source requires dependency_kind");if([e.source_kind,e.source_kind_prefix,e.source_kind_state].filter(n=>n!==void 0).length>1)throw new L("dependency_kind source accepts at most one source_kind predicate");if(e.source_kind!==void 0&&e.source_kind.trim().length===0||e.source_kind_prefix!==void 0&&e.source_kind_prefix.trim().length===0)throw new L("dependency_kind source provenance values must not be empty");if(e.source_kind_state!==void 0&&e.source_kind_state!=="present"&&e.source_kind_state!=="missing")throw new L("dependency_kind source source_kind_state must be present or missing")}function xv(e){if(e.sample_limit!==void 0&&(!Number.isInteger(e.sample_limit)||e.sample_limit<1))throw new L("prose_edge_gap sample_limit must be a positive integer");for(let t of e.exemptions??[]){if(typeof t.holder_id!="string"||t.holder_id.trim().length===0||typeof t.reason!="string"||t.reason.trim().length===0)throw new L("prose_edge_gap exemptions require holder_id and reason");if(t.target_id!==void 0&&t.target_id.trim().length===0||t.text_contains!==void 0&&t.text_contains.trim().length===0)throw new L("prose_edge_gap exemption selectors must not be empty")}}function Js(e){yt(e.id,"measurement.id"),e.max_cost!==void 0&&yv(e.max_cost,"measurement.max_cost");let t=e.source;if(Object.prototype.toString.call(t)!=="[object Object]")throw new L(`measurement.source.kind must be one of ${Gs.join(", ")}`);let n=Reflect.get(t,"kind");if(!Gs.includes(n))throw new L(`measurement.source.kind must be one of ${Gs.join(", ")}`);let r=t;if(r.kind==="items"&&kv(r),r.kind==="dependency_kind"&&bv(r),r.kind==="prose_edge_gap"&&xv(r),(r.kind==="graph"||r.kind==="validate"||r.kind==="health")&&(typeof r.field!="string"||r.field.trim().length===0))throw new L(`${r.kind} source requires field`);return r.kind==="provider"&&(yt(r.provider,"provider source provider"),yt(r.key,"provider source key")),e}function Ks(e){if(yt(e.id,"assertion.id"),yt(e.measurement_id,"assertion.measurement_id"),typeof e.owner_item_id!="string"||e.owner_item_id.trim().length===0)throw new L("assertion.owner_item_id is required");let t=yr(e);if(typeof t.value=="number"&&!Number.isFinite(t.value))throw new L(`assertion.${t.polarity} must be a finite number`);if(e.lifetime==="retire"&&(typeof e.retire_reason!="string"||e.retire_reason.trim().length===0))throw new L("retired assertion requires retire_reason");e.scope.kind==="filter"&&yt(e.scope.measurement_id,"assertion.scope.measurement_id");let n=e.negative_control?.cases;if(!Array.isArray(n)||!n.some(r=>r.expected==="pass")||!n.some(r=>r.expected==="fail"))throw new L("assertion negative control requires pass and fail cases");if(!xm(e))throw new L(`assertion ${e.id} negative control does not prove its bound`);return e}function Sv(e){if(!Array.isArray(e.allowed_providers))throw new L("gate provider_policy.allowed_providers must be an array");for(let t of e.allowed_providers)yt(t,"gate.provider_policy.allowed_provider");if(typeof e.triggers!="object"||e.triggers===null||Array.isArray(e.triggers))throw new L("gate provider_policy.triggers must be an object");for(let[t,n]of Object.entries(e.triggers)){if(!Yt.includes(t))throw new L(`gate provider policy has unknown trigger ${t}`);if(typeof n!="object"||n===null||!["low","medium","high"].includes(n.max_cost_class)||typeof n.allow_network!="boolean")throw new L(`gate provider policy trigger ${t} is invalid`)}}function Sm(e){if(yt(e.id,"gate.id"),!Array.isArray(e.assertion_ids))throw new L("gate.assertion_ids is required and must be an array");if(e.assertion_ids.length===0)throw new L("gate requires at least one assertion");for(let t of e.assertion_ids)yt(t,"gate.assertion_id");if(!Array.isArray(e.triggers))throw new L(`gate.triggers is required and must be an array of ${Yt.join(", ")}`);if(e.triggers.length===0)throw new L("gate requires at least one trigger");for(let t of e.triggers)if(!Yt.includes(t))throw new L(`gate trigger must be one of ${Yt.join(", ")}`);return e.provider_policy&&Sv(e.provider_policy),e}function Nn(e){if(e.version!==vm)throw new L(`unsupported assurance document version ${String(e.version)}`);let t=new Set;for(let r of e.measurements){if(Js(r),t.has(`measurement:${r.id}`))throw new L(`duplicate measurement ${r.id}`);t.add(`measurement:${r.id}`)}for(let r of e.assertions){if(Ks(r),t.has(`assertion:${r.id}`))throw new L(`duplicate assertion ${r.id}`);t.add(`assertion:${r.id}`)}for(let r of e.gates){Sm(r);let i=r.assertion_ids.filter(o=>!e.assertions.some(s=>s.id===o));if(i.length>0)throw new L(`gate ${r.id} references missing assertions: ${i.join(", ")}`);if(t.has(`gate:${r.id}`))throw new L(`duplicate gate ${r.id}`);t.add(`gate:${r.id}`)}let n=new Set(e.measurements.map(r=>r.id));for(let[r,i]of Em(e))if(!n.has(r))throw new L(`${i.join(", ")} references missing measurement ${r}`);return e}function Ys(e,t){if("measurement"in e){t.push(e.measurement);return}if("operator"in e)for(let n of e.operands)Ys(n,t)}function Em(e){let t=new Map,n=(r,i)=>{let o=t.get(r)??[];o.push(i),t.set(r,o)};for(let r of e.assertions)n(r.measurement_id,`assertion ${r.id}`),r.scope.kind==="filter"&&n(r.scope.measurement_id,`assertion ${r.id} scope`);for(let r of e.measurements){if(r.source.kind!=="derived")continue;let i=[];Ys(r.source.expression,i);for(let o of i)n(o,`derived measurement ${r.id}`)}return t}function Ev(e,t){let n=e.assertion_ids.flatMap(o=>{let s=t.assertions.find(a=>a.id===o);return[s.measurement_id,...s.scope.kind==="filter"?[s.scope.measurement_id]:[]]}),r=new Set,i=new Set;for(;n.length>0;){let o=n.pop();if(r.has(o))continue;r.add(o);let s=t.measurements.find(a=>a.id===o);s.source.kind==="provider"?i.add(s.source.provider):s.source.kind==="derived"&&Ys(s.source.expression,n)}return i}function wr(){return{version:vm,measurements:[],assertions:[],gates:[]}}function Rv(e,t){let n=t.items.filter(r=>(e.statuses===void 0||e.statuses.includes(r.status))&&(e.types===void 0||e.types.includes(r.type))&&(e.tags===void 0||e.tags.every(i=>r.tags?.includes(i)))&&(e.field===void 0||(()=>{let i=r[e.field];if(e.state!==void 0){let o=i==null||i===""||Array.isArray(i)&&i.length===0;return e.state==="missing"?o:!o}return Vs(i,e.equals)})()));return{value:n.length,population_size:t.items.length,cost:t.items.length,contributors:n.map(r=>r.id)}}function Av(e,t){return e.source_kind!==void 0?t?.toLowerCase()===e.source_kind.trim().toLowerCase():e.source_kind_prefix!==void 0?t?.toLowerCase().startsWith(e.source_kind_prefix.trim().toLowerCase())===!0:e.source_kind_state==="present"?t!==void 0&&t.length>0:e.source_kind_state==="missing"?t===void 0||t.length===0:!0}function Iv(e,t){let n=[],r=ds(e.dependency_kind)??e.dependency_kind.trim().toLowerCase();for(let i of t.items)for(let o of i.dependencies??[]){let s=ds(o.kind)??o.kind.trim().toLowerCase(),a=o.source_kind?.trim();s===r&&Av(e,a)&&n.push(`${i.id}->${o.id}${a?`@${a}`:""}`)}return{value:n.length,population_size:t.items.length,cost:t.items.length,contributors:n}}function Cv(e){let t=[e.description,e.body].filter(n=>typeof n=="string").map(n=>n.trim()).filter(Boolean);for(let n of["comments","notes","learnings"]){let r=e[n];if(Array.isArray(r)){for(let i of r)if(typeof i=="string")t.push(i);else if(typeof i=="object"&&i!==null){let o=Reflect.get(i,"text");typeof o=="string"&&t.push(o)}}}return t}function $v(e,t,n,r){return e.some(i=>i.holder_id.trim().toLowerCase()===t.toLowerCase()&&(i.target_id===void 0||i.target_id.trim().toLowerCase()===n.toLowerCase())&&(i.text_contains===void 0||r.toLowerCase().includes(i.text_contains.trim().toLowerCase())))}function Bs(e,t){return[e.toLowerCase(),t.toLowerCase()].sort().join("\0")}function Tv(e){let t=new Map,n=new Set,r=[],i=/(?<![\w-])[a-z0-9]+(?:-+[a-z0-9]+)+(?![\w-])/giu,o=0;for(let s of e){t.set(s.id.toLowerCase(),s.id);for(let a of s.dependencies??[])n.add(Bs(s.id,a.id));for(let a of[s.parent,s.blocked_by])typeof a=="string"&&n.add(Bs(s.id,a));for(let a of Cv(s)){let c=[...a.matchAll(i)].map(d=>d[0]);o+=c.length,r.push({holder_id:s.id,segment:a,mentioned_ids:c})}}return{canonical_ids:t,linked_pairs:n,prose_mentions:r,mention_count:o}}function Ov(e,t){let n=Tv(t.items),r=new Map;for(let s of n.prose_mentions){let a=s.mentioned_ids.map(d=>n.canonical_ids.get(d.toLowerCase())).filter(d=>d!==void 0&&d!==s.holder_id),c=[...new Set(a)];for(let d of c){let l=Bs(s.holder_id,d);if(n.linked_pairs.has(l)||$v(e.exemptions??[],s.holder_id,d,s.segment))continue;let u=c.some(m=>m!==d);r.get(l)?.explicit===!0&&!u||r.set(l,{contributor:`${s.holder_id}->${d}|subject=${u?"explicit":"implicit"}`,explicit:u})}}let i=[...r.values()],o=i.map(s=>s.contributor).sort();return{value:o.length,population_size:n.canonical_ids.size,cost:t.items.length+n.linked_pairs.size+n.mention_count,contributors:o.slice(0,e.sample_limit??25),partitions:{explicit_subject:i.filter(s=>s.explicit).length,implicit_subject:i.filter(s=>!s.explicit).length}}}function Pv(e,t){return{value:t.history.filter(r=>(e.op===void 0||r.op===e.op)&&(e.author===void 0||r.author===e.author)&&(e.harness===void 0||r.agent_harness===e.harness)&&(e.model===void 0||r.agent_model===e.model)).length,population_size:t.history.length,cost:t.history.length}}function Lv(e,t){let n=t.items.filter(r=>{let i=r[e.link],o=Array.isArray(i)&&i.length>0;return e.state==="present"?o:!o});return{value:n.length,population_size:t.items.length,cost:t.items.length,contributors:n.map(r=>r.id)}}function Nv(e,t){let n=e.source;return n.kind==="items"?Rv(n,t):n.kind==="dependency_kind"?Iv(n,t):n.kind==="prose_edge_gap"?Ov(n,t):n.kind==="history"?Pv(n,t):n.kind==="links"?Lv(n,t):null}function Rm(e,t){return e.reduce((n,r)=>({units:n.units+r.units,items_scanned:n.items_scanned+r.items_scanned,history_entries:n.history_entries+r.history_entries,provider_calls:n.provider_calls+r.provider_calls,duration_ms:t}),{units:0,items_scanned:0,history_entries:0,provider_calls:0,duration_ms:t})}function Dv(e,t){if(t.length===0)throw new TypeError(`derived ${e} requires operands`);if(e==="add")return t.reduce((n,r)=>n+r,0);if(e==="subtract")return t.slice(1).reduce((n,r)=>n-r,t[0]);if(e==="multiply")return t.reduce((n,r)=>n*r,1);if(e==="divide"){if(t.slice(1).includes(0))throw new TypeError("derived divide cannot divide by zero");return t.slice(1).reduce((n,r)=>n/r,t[0])}return e==="min"?Math.min(...t):Math.max(...t)}async function Am(e,t,n){let r=new Array(e.length),i=0,o=Array.from({length:Math.min(t,e.length)},async()=>{for(;i<e.length;){let s=i;i+=1,r[s]=await n(e[s],s)}});return await Promise.all(o),r}async function Im(e,t,n,r,i){if("literal"in e)return{value:e.literal,costs:[],population_size:0,contributors:[]};if("measurement"in e){let s=n.find(d=>d.id===e.measurement);if(!s)throw new TypeError(`derived measurement references missing ${e.measurement}`);let a=await Cm(s,t,n,r,i);if(typeof a.value!="number")throw new TypeError(`derived measurement ${s.id} is not numeric`);let c=i.charged.has(s.id)?[]:[a.cost];return i.charged.add(s.id),{value:a.value,costs:c,population_size:a.population_size,contributors:a.contributors}}let o=await Am(e.operands,km,s=>Im(s,t,n,r,i));return{value:Dv(e.operator,o.map(s=>s.value)),costs:o.flatMap(s=>s.costs),population_size:Math.max(0,...o.map(s=>s.population_size)),contributors:[...new Set(o.flatMap(s=>s.contributors))]}}async function Mv(e,t,n,r,i){Js(e);let o=Date.now(),s,a=[],c=0;if(e.source.kind==="derived"){let u=await Im(e.source.expression,t,n,[...r,e.id],i);s={value:u.value,population_size:u.population_size,cost:0,contributors:u.contributors},a=u.costs}else{let u=Nv(e,t);u!==null?s=u:(s=await t.external(e.source),c=1)}let d={units:s.cost,items_scanned:e.source.kind==="items"||e.source.kind==="dependency_kind"||e.source.kind==="prose_edge_gap"||e.source.kind==="links"?t.items.length:0,history_entries:e.source.kind==="history"?t.history.length:0,provider_calls:c,duration_ms:Date.now()-o},l=Rm([...a,d],Date.now()-o);if(e.max_cost!==void 0&&l.units>e.max_cost)throw new Ae(`measurement ${e.id} exceeded cost ceiling ${e.max_cost} with ${l.units}`);return{id:e.id,definition_fingerprint:`sha256:${pv("sha256").update(A(e)).digest("hex")}`,value:s.value,population_size:s.population_size,cost:l,contributors:s.contributors??[],...s.partitions?{partitions:s.partitions}:{}}}function Cm(e,t,n,r,i){if(r.includes(e.id))throw new TypeError(`derived measurement cycle: ${[...r,e.id].join(" -> ")}`);let o=i.cache.get(e.id);if(o)return o;let s=Mv(e,t,n,r,i).catch(a=>{if(a instanceof it&&a.measurement_id===void 0){let c={measurement_id:e.id,source_kind:a.source_kind,field:a.field,...a.check?{check:a.check}:{}},d=new it(a.message,c);throw d.cause=a,d}throw a});return i.cache.set(e.id,s),s}async function Xs(e,t,n=[e]){return Cm(e,t,n,[],{cache:new Map,charged:new Set})}function Fv(e,t){return typeof e!="number"||typeof t.value!="number"?null:t.polarity==="ceiling"||t.polarity==="monotone_nonincreasing"?t.value-e:(t.polarity==="floor"||t.polarity==="monotone_nondecreasing",e-t.value)}function jv(e,t,n={}){Ks(e);let r=yr(e),i=e.lifetime==="retire"&&n.owner_terminal===!0;return{assertion_id:e.id,measurement_id:e.measurement_id,measurement_definition_fingerprint:t.definition_fingerprint,scope:e.scope,population_size:t.population_size,observed:t.value,bound:r,distance:Fv(t.value,r),verdict:i?"retired":bm(t.value,r)?"pass":"fail",enforcement:e.enforcement,negative_control_proven:xm(e),cost:t.cost,contributors:t.contributors,...t.partitions?{partitions:t.partitions}:{}}}function Hv(e,t,n,r){let i=Ev(e,t);if(i.size===0)return;let o=e.provider_policy,s=o?.triggers[r];if(!o||!s)throw new Ae(`assurance gate ${e.id} refuses provider execution at trigger ${r} without an explicit provider policy`);let a=new Set(o.allowed_providers),c={low:0,medium:1,high:2};for(let d of i){if(!a.has(d))throw new Ae(`assurance gate ${e.id} refuses provider ${d}`);let l=n.provider_capabilities?.[d];if(!l)throw new Ae(`assurance provider ${d} has no declared capabilities`);if(c[l.cost_class]>c[s.max_cost_class])throw new Ae(`assurance gate ${e.id} refuses ${l.cost_class}-cost provider ${d} at trigger ${r}`);if(l.network&&!s.allow_network)throw new Ae(`assurance gate ${e.id} refuses network provider ${d} at trigger ${r}`)}}async function wm(e,t,n,r,i){try{return await Xs(n,r,i)}catch(o){if(o instanceof it){let s=o.check?` check ${o.check}`:"",a=o.measurement_id??n.id,c=new Ae(`assurance gate ${e} assertion ${t} measurement ${a} source ${o.source_kind}${s} field ${o.field} could not resolve: ${o.message}`,{gate_id:e,assertion_id:t,measurement_id:a,source_kind:o.source_kind,field:o.field,...o.check?{check:o.check}:{}});throw c.cause=o,c}throw o}}async function $m(e,t,n,r){Nn(t);let i=t.gates.find(c=>c.id===e);if(!i)throw new Ae(`assurance gate ${e} not found`);if(!i.triggers.includes(r.trigger))throw new Ae(`assurance gate ${e} does not declare trigger ${r.trigger}`);Hv(i,t,n,r.trigger);let o=await Am(i.assertion_ids,km,async c=>{let d=t.assertions.find(f=>f.id===c),l=t.measurements.find(f=>f.id===d.measurement_id),u=n;if(d.scope.kind==="active"){let f=new Set(n.terminal_statuses??["closed","canceled"]);u={...n,items:n.items.filter(h=>!f.has(h.status))}}else if(d.scope.kind==="filter"){let f=d.scope.measurement_id,h=t.measurements.find(v=>v.id===f),_=await wm(i.id,d.id,h,n,t.measurements),w=new Set(_.contributors);u={...n,items:n.items.filter(v=>w.has(v.id))}}let m=n.items.find(f=>f.id===d.owner_item_id),p=m!==void 0&&new Set(n.terminal_statuses??["closed","canceled"]).has(m.status);return jv(d,await wm(i.id,d.id,l,u,t.measurements),{owner_terminal:p})}),s=o.some(c=>c.verdict==="fail"&&c.enforcement==="block"),a=o.some(c=>c.verdict==="fail"&&c.enforcement==="warn");return{gate_id:i.id,tree_id:n.tree_id,trigger:r.trigger,dry_run:r.dry_run===!0,evaluated_at:new Date().toISOString(),verdict:s?"block":a?"warn":"pass",exit_code:s?1:0,assertions:o,assertions_total:o.length,row_contract:{row_keys:["assertions"],jq_selector:".assertions[]"},cost:Rm(o.map(c=>c.cost),Math.max(0,...o.map(c=>c.cost.duration_ms)))}}function qi(e){return fv.join(e,"assurance.json")}async function Tm(e){let t=await B(qi(e));return t===null?wr():Gi(t)}function Gi(e){try{return Nn(JSON.parse(e))}catch(t){throw new g("The assurance registry is invalid. Repair or restore .agents/pm/assurance.json and retry.",y.GENERIC_FAILURE,{code:"assurance_registry_invalid",reason:String(t),nextSteps:["Restore a valid assurance.json from version control or repair its declaration references.","Run pm assurance list measurement after the repair."]})}}function Bi(e,t){return t==="measurement"?e.measurements:t==="assertion"?e.assertions:e.gates}function Uv(e,t){e==="measurement"?Js(t):e==="assertion"?Ks(t):Sm(t)}async function vr(e,t){let n=structuredClone(Bi(await Tm(e),t));return{items:n,count:n.length,row_contract:{row_keys:["items"],jq_selector:".items[]"}}}async function Om(e,t,n){let r=Bi(await Tm(e),t).find(i=>i.id===n);if(!r)throw new Ae(`assurance ${t} ${n} not found`);return structuredClone(r)}async function Vi(e,t,n,r={}){Uv(t,n);let i=await T(e),o=q(r.author,i.author_default),s=await Sn({pmRoot:e,filePath:qi(e),op:`assurance:${t}:put`,author:o,message:r.message,lockTtlSeconds:zi,lockWaitMs:Wi,mutate:a=>{let c=a===null?wr():Gi(a),d=Bi(c,t),l=d.findIndex(m=>m.id===n.id),u=l<0?"created":"updated";if(t==="assertion"&&l>=0&&vv(d[l],n)){let m=n.authorization_decision;if(!m||!r.authorized_decision_ids?.includes(m))throw new L(`loosening assertion ${n.id} requires a verified authorization_decision`)}return l<0?d.push(structuredClone(n)):d[l]=structuredClone(n),Nn(c),{raw:`${JSON.stringify(c,null,2)}
|
|
1
|
+
import{K as Qu,v as te,z as Ms}from"./chunk-6BKT6XQN.js";import{a as js,d as Hs,e as om,f as Us,g as sm}from"./chunk-KPASZGBL.js";import{a as ji,b as hr}from"./chunk-IIP6LZ5E.js";import{i as gm,k as ym}from"./chunk-T3ILWAEV.js";import{c as Dt,d as Cn,e as $n,f as Tn,g as cm,j as _m}from"./chunk-OG57ESZK.js";import{a as am}from"./chunk-XR6MLUVW.js";import{a as hs,c as di,d as li,e as cl,g as dl,h as gs,i as ys,j as vl,k as hn,l as _n,m as kl,n as bl,o as ws}from"./chunk-EQCQTYKO.js";import{g as lu,h as uu,i as As}from"./chunk-SQMOF65W.js";import{a as Ds}from"./chunk-K53OIT5J.js";import{H as iu,I as Ai,J as ou,K as Rs,M as su,N as au,P as cu,Q as du,R as Ii,_ as Ci}from"./chunk-W4JMV7GF.js";import{K as hm}from"./chunk-VQIC3UZB.js";import{A as Ve,B as I,C as Hi,D as dm,E as On,F as zs,G as lm,H as um,I as be,J as _r,K as Ui,L as mm,M as Pn,N as pm,Q as fm,Z as Ws,w as nm,y as im}from"./chunk-7A6SEZEY.js";import{a as Fs,b as rm}from"./chunk-2DGKVXFT.js";import{$a as Ps,A as ur,Aa as pr,B as pu,C as fu,Ca as $s,D as mr,Ga as Mu,Ha as Fu,Hb as Yu,Ia as ju,Ja as Hu,Ka as Mi,M as hu,Ma as Uu,Na as zu,Oa as Wu,Pa as Kt,Pb as Xu,Qa as qu,Qb as Zu,R as _u,Ra as Rn,Sa as Gu,Ta as Ts,Ua as An,Va as Bu,Wa as Vu,Xa as Ju,Ya as Os,Za as Ku,_a as In,a as il,ab as Ls,b as mn,ba as gu,c as _s,ca as yu,d as ol,da as wu,e as sl,f as pt,g as ui,ga as Oi,h as al,i as Tt,rb as Ns,v as $i,xa as Li,ya as Eu,z as mu,za as Cs}from"./chunk-VK3IE3TS.js";import{d as fr,f as Fi,m as em,p as tm}from"./chunk-4SCFAWAW.js";import{A as Ni,C as Lu,D as _e,E as ge,F as Nu,G as Di,H as ht,I as _t,M as Du,N as gt,a as Ti,c as vu,j as Ru,k as Au,m as Iu,n as Cu,o as Nt,p as $u,q as Tu,u as Ou,v as Pu}from"./chunk-TXTPAFHJ.js";import{a as re,b as bn,c as ku,d as Is,e as xn,f as Sn,g as En,h as bu,i as xu,l as Be,q as Su,r as T,s as Pi,x as ie}from"./chunk-P2H3GTJK.js";import{$c as kn,$d as nu,A as Re,Ab as Tl,Ac as We,B as et,Bb as Ol,Bc as xs,C as qd,Ca as Bt,Dc as wn,Dd as Zl,E as X,Ec as gi,Fc as ft,Fd as Si,Gb as Pl,Gc as ke,Gd as Ql,H as Gd,Hb as Ll,Hc as cr,Hd as eu,Ic as Wl,Jb as Nl,Jc as ql,Jd as tu,Kb as Dl,Kc as Gl,La as fs,Lb as se,Lc as Bl,M as ci,Mc as Vl,N as Xd,Na as un,Nc as yi,O as us,Oc as Jt,P as ms,Pa as nt,Pc as wi,Q as ps,Ra as rt,Rd as U,S as Zd,T as Qd,Vc as Jl,Vd as Y,W as el,Wc as dr,Xc as vn,Yc as qe,Zd as Ge,_a as xl,a as Ld,ad as vi,ae as Ei,ba as nl,bb as ve,bd as Kl,cb as vs,cd as ki,d as Nd,db as pi,e as Dd,eb as ar,ed as Yl,fb as Rl,fe as ru,gb as fi,gd as bi,h as dn,hb as Al,jb as hi,kb as _i,le as Ri,mb as Il,mc as q,nc as Ml,nd as Ss,od as Es,pc as Fl,pd as Xl,q as zd,qb as Cl,qc as jl,rb as $l,rc as ze,sc as Hl,t as Wd,ta as rl,tc as Ul,ub as Le,uc as ks,v as ds,vc as zl,wc as bs,xd as lr,yc as Lt,yd as xi,zb as Pt}from"./chunk-N64AC5G6.js";import{E as $,F as Sl,G as gn,H as Ot,I as Vt,L as yn,M as K,U as El,c as A,d as ls,e as Ce,p as tl}from"./chunk-2UWKU2BQ.js";import{e as Vd,f as Jd,g as W,l as sr,n as M,o as tt,p as ai,q as ln,s as Kd,t as mt,v as Yd}from"./chunk-26P6C6OO.js";import{E as Bd,G as ce,I as ll,J as pn,K as fn,L as ul,M as ml,N as pl,O as fl,P as we,T as hl,V as $e,W as _l,X as gl,Z as Te,ba as he,ca as yl,da as mi,fa as wl,i as cs}from"./chunk-JFICNN4T.js";import{A as g,B as or,C as P,D as Qe,E as H,F as B,J as ee,a as ii,d as oi,p as Md,r as Fd,t as jd,v as Hd,w as si,x as Ud,y as $t,z as y}from"./chunk-IRYNVGKH.js";var L=class extends TypeError{constructor(t){super(t),this.name="AssuranceMutationRefusalError"}},Ae=class extends TypeError{context;constructor(t,n={}){super(t),this.name="AssuranceEvaluationRefusalError",this.context=n}},it=class extends TypeError{measurement_id;source_kind;field;check;constructor(t,n){super(t),this.name="AssuranceSourceResolutionError",this.measurement_id=n.measurement_id,this.source_kind=n.source_kind,this.field=n.field,this.check=n.check}};async function Ln(e){try{return await e()}catch(t){throw t instanceof L?new g(t.message,y.USAGE,{code:"invalid_argument_value",reason:"assurance_mutation_refused"}):t}}async function qs(e){try{return await e()}catch(t){throw t instanceof Ae?new g(t.message,y.USAGE,{code:"invalid_argument_value",reason:"assurance_evaluation_refused",...t.context}):t}}import{createHash as pv}from"node:crypto";import fv from"node:path";var vm=1,Yt=["pre-commit","pre-push","pre-merge","ci","pre-release","post-release","scheduled","on-claim","on-close"],Gs=["items","dependency_kind","prose_edge_gap","graph","validate","health","history","links","provider","derived"],hv=["ceiling","floor","equals","zero","monotone_nondecreasing","monotone_nonincreasing","subset_of"],_v=/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/,zi=30,Wi=5e3,km=4,gv=50;function yt(e,t){if(!_v.test(e))throw new L(`${t} must be a stable lowercase id`)}function yv(e,t){if(!Number.isFinite(e)||e<0)throw new L(`${t} must be a finite non-negative number`)}function yr(e){let t=hv.filter(i=>e[i]!==void 0);if(t.length!==1)throw new L(`assertion ${e.id} must declare exactly one polarity`);let n=t[0],r=e[n];return{polarity:n,value:n==="zero"?0:r}}function Vs(e,t){return A(e)===A(t)}function bm(e,t){if(t.polarity==="equals")return Vs(e,t.value);if(t.polarity==="subset_of"){if(!Array.isArray(e)||!Array.isArray(t.value))return!1;let r=t.value;return e.every(i=>r.includes(i))}if(typeof e!="number")return!1;let n=t.value;return t.polarity==="ceiling"||t.polarity==="monotone_nonincreasing"?e<=n:t.polarity==="floor"||t.polarity==="monotone_nondecreasing"?e>=n:e===0}function xm(e){let t=yr(e),n=e.negative_control.cases;return n.some(r=>r.expected==="pass")&&n.some(r=>r.expected==="fail")&&n.every(r=>bm(r.observed,t)===(r.expected==="pass"))}function wv(e,t){if(e.polarity!==t.polarity)return!0;if(typeof e.value=="number"&&typeof t.value=="number")return e.polarity==="ceiling"||e.polarity==="monotone_nonincreasing"?t.value>e.value:e.polarity==="floor"||e.polarity==="monotone_nondecreasing"?t.value<e.value:t.value!==e.value;if(e.polarity==="subset_of"){let n=e.value,r=t.value;return!Array.isArray(n)||!Array.isArray(r)||r.some(i=>!n.includes(i))}return!Vs(e.value,t.value)}function vv(e,t){if(e.measurement_id!==t.measurement_id||e.owner_item_id!==t.owner_item_id||A(e.scope)!==A(t.scope))return!0;let n={observe:0,warn:1,block:2},r=(e.lifetime??"hold")==="hold"&&(t.lifetime??"hold")==="retire";return wv(yr(e),yr(t))||n[t.enforcement]<n[e.enforcement]||r}function kv(e){if(e.state!==void 0&&!(e.state==="present"||e.state==="missing"))throw new L("items source state must be present or missing");let t=Object.hasOwn(e,"equals"),n=e.state!==void 0,r=Number(t)+Number(n);if(e.field!==void 0&&r!==1)throw new L("items source with field requires exactly one of equals or state");if(e.field===void 0&&r!==0)throw new L("items source equals/state requires field")}function bv(e){if(typeof e.dependency_kind!="string"||e.dependency_kind.trim().length===0)throw new L("dependency_kind source requires dependency_kind");if([e.source_kind,e.source_kind_prefix,e.source_kind_state].filter(n=>n!==void 0).length>1)throw new L("dependency_kind source accepts at most one source_kind predicate");if(e.source_kind!==void 0&&e.source_kind.trim().length===0||e.source_kind_prefix!==void 0&&e.source_kind_prefix.trim().length===0)throw new L("dependency_kind source provenance values must not be empty");if(e.source_kind_state!==void 0&&e.source_kind_state!=="present"&&e.source_kind_state!=="missing")throw new L("dependency_kind source source_kind_state must be present or missing")}function xv(e){if(e.sample_limit!==void 0&&(!Number.isInteger(e.sample_limit)||e.sample_limit<1))throw new L("prose_edge_gap sample_limit must be a positive integer");for(let t of e.exemptions??[]){if(typeof t.holder_id!="string"||t.holder_id.trim().length===0||typeof t.reason!="string"||t.reason.trim().length===0)throw new L("prose_edge_gap exemptions require holder_id and reason");if(t.target_id!==void 0&&t.target_id.trim().length===0||t.text_contains!==void 0&&t.text_contains.trim().length===0)throw new L("prose_edge_gap exemption selectors must not be empty")}}function Js(e){yt(e.id,"measurement.id"),e.max_cost!==void 0&&yv(e.max_cost,"measurement.max_cost");let t=e.source;if(Object.prototype.toString.call(t)!=="[object Object]")throw new L(`measurement.source.kind must be one of ${Gs.join(", ")}`);let n=Reflect.get(t,"kind");if(!Gs.includes(n))throw new L(`measurement.source.kind must be one of ${Gs.join(", ")}`);let r=t;if(r.kind==="items"&&kv(r),r.kind==="dependency_kind"&&bv(r),r.kind==="prose_edge_gap"&&xv(r),(r.kind==="graph"||r.kind==="validate"||r.kind==="health")&&(typeof r.field!="string"||r.field.trim().length===0))throw new L(`${r.kind} source requires field`);return r.kind==="provider"&&(yt(r.provider,"provider source provider"),yt(r.key,"provider source key")),e}function Ks(e){if(yt(e.id,"assertion.id"),yt(e.measurement_id,"assertion.measurement_id"),typeof e.owner_item_id!="string"||e.owner_item_id.trim().length===0)throw new L("assertion.owner_item_id is required");let t=yr(e);if(typeof t.value=="number"&&!Number.isFinite(t.value))throw new L(`assertion.${t.polarity} must be a finite number`);if(e.lifetime==="retire"&&(typeof e.retire_reason!="string"||e.retire_reason.trim().length===0))throw new L("retired assertion requires retire_reason");e.scope.kind==="filter"&&yt(e.scope.measurement_id,"assertion.scope.measurement_id");let n=e.negative_control?.cases;if(!Array.isArray(n)||!n.some(r=>r.expected==="pass")||!n.some(r=>r.expected==="fail"))throw new L("assertion negative control requires pass and fail cases");if(!xm(e))throw new L(`assertion ${e.id} negative control does not prove its bound`);return e}function Sv(e){if(!Array.isArray(e.allowed_providers))throw new L("gate provider_policy.allowed_providers must be an array");for(let t of e.allowed_providers)yt(t,"gate.provider_policy.allowed_provider");if(typeof e.triggers!="object"||e.triggers===null||Array.isArray(e.triggers))throw new L("gate provider_policy.triggers must be an object");for(let[t,n]of Object.entries(e.triggers)){if(!Yt.includes(t))throw new L(`gate provider policy has unknown trigger ${t}`);if(typeof n!="object"||n===null||!["low","medium","high"].includes(n.max_cost_class)||typeof n.allow_network!="boolean")throw new L(`gate provider policy trigger ${t} is invalid`)}}function Sm(e){if(yt(e.id,"gate.id"),!Array.isArray(e.assertion_ids))throw new L("gate.assertion_ids is required and must be an array");if(e.assertion_ids.length===0)throw new L("gate requires at least one assertion");for(let t of e.assertion_ids)yt(t,"gate.assertion_id");if(!Array.isArray(e.triggers))throw new L(`gate.triggers is required and must be an array of ${Yt.join(", ")}`);if(e.triggers.length===0)throw new L("gate requires at least one trigger");for(let t of e.triggers)if(!Yt.includes(t))throw new L(`gate trigger must be one of ${Yt.join(", ")}`);return e.provider_policy&&Sv(e.provider_policy),e}function Nn(e){if(e.version!==vm)throw new L(`unsupported assurance document version ${String(e.version)}`);let t=new Set;for(let r of e.measurements){if(Js(r),t.has(`measurement:${r.id}`))throw new L(`duplicate measurement ${r.id}`);t.add(`measurement:${r.id}`)}for(let r of e.assertions){if(Ks(r),t.has(`assertion:${r.id}`))throw new L(`duplicate assertion ${r.id}`);t.add(`assertion:${r.id}`)}for(let r of e.gates){Sm(r);let i=r.assertion_ids.filter(o=>!e.assertions.some(s=>s.id===o));if(i.length>0)throw new L(`gate ${r.id} references missing assertions: ${i.join(", ")}`);if(t.has(`gate:${r.id}`))throw new L(`duplicate gate ${r.id}`);t.add(`gate:${r.id}`)}let n=new Set(e.measurements.map(r=>r.id));for(let[r,i]of Em(e))if(!n.has(r))throw new L(`${i.join(", ")} references missing measurement ${r}`);return e}function Ys(e,t){if("measurement"in e){t.push(e.measurement);return}if("operator"in e)for(let n of e.operands)Ys(n,t)}function Em(e){let t=new Map,n=(r,i)=>{let o=t.get(r)??[];o.push(i),t.set(r,o)};for(let r of e.assertions)n(r.measurement_id,`assertion ${r.id}`),r.scope.kind==="filter"&&n(r.scope.measurement_id,`assertion ${r.id} scope`);for(let r of e.measurements){if(r.source.kind!=="derived")continue;let i=[];Ys(r.source.expression,i);for(let o of i)n(o,`derived measurement ${r.id}`)}return t}function Ev(e,t){let n=e.assertion_ids.flatMap(o=>{let s=t.assertions.find(a=>a.id===o);return[s.measurement_id,...s.scope.kind==="filter"?[s.scope.measurement_id]:[]]}),r=new Set,i=new Set;for(;n.length>0;){let o=n.pop();if(r.has(o))continue;r.add(o);let s=t.measurements.find(a=>a.id===o);s.source.kind==="provider"?i.add(s.source.provider):s.source.kind==="derived"&&Ys(s.source.expression,n)}return i}function wr(){return{version:vm,measurements:[],assertions:[],gates:[]}}function Rv(e,t){let n=t.items.filter(r=>(e.statuses===void 0||e.statuses.includes(r.status))&&(e.types===void 0||e.types.includes(r.type))&&(e.tags===void 0||e.tags.every(i=>r.tags?.includes(i)))&&(e.field===void 0||(()=>{let i=r[e.field];if(e.state!==void 0){let o=i==null||i===""||Array.isArray(i)&&i.length===0;return e.state==="missing"?o:!o}return Vs(i,e.equals)})()));return{value:n.length,population_size:t.items.length,cost:t.items.length,contributors:n.map(r=>r.id)}}function Av(e,t){return e.source_kind!==void 0?t?.toLowerCase()===e.source_kind.trim().toLowerCase():e.source_kind_prefix!==void 0?t?.toLowerCase().startsWith(e.source_kind_prefix.trim().toLowerCase())===!0:e.source_kind_state==="present"?t!==void 0&&t.length>0:e.source_kind_state==="missing"?t===void 0||t.length===0:!0}function Iv(e,t){let n=[],r=ds(e.dependency_kind)??e.dependency_kind.trim().toLowerCase();for(let i of t.items)for(let o of i.dependencies??[]){let s=ds(o.kind)??o.kind.trim().toLowerCase(),a=o.source_kind?.trim();s===r&&Av(e,a)&&n.push(`${i.id}->${o.id}${a?`@${a}`:""}`)}return{value:n.length,population_size:t.items.length,cost:t.items.length,contributors:n}}function Cv(e){let t=[e.description,e.body].filter(n=>typeof n=="string").map(n=>n.trim()).filter(Boolean);for(let n of["comments","notes","learnings"]){let r=e[n];if(Array.isArray(r)){for(let i of r)if(typeof i=="string")t.push(i);else if(typeof i=="object"&&i!==null){let o=Reflect.get(i,"text");typeof o=="string"&&t.push(o)}}}return t}function $v(e,t,n,r){return e.some(i=>i.holder_id.trim().toLowerCase()===t.toLowerCase()&&(i.target_id===void 0||i.target_id.trim().toLowerCase()===n.toLowerCase())&&(i.text_contains===void 0||r.toLowerCase().includes(i.text_contains.trim().toLowerCase())))}function Bs(e,t){return[e.toLowerCase(),t.toLowerCase()].sort().join("\0")}function Tv(e){let t=new Map,n=new Set,r=[],i=/(?<![\w-])[a-z0-9]+(?:-+[a-z0-9]+)+(?![\w-])/giu,o=0;for(let s of e){t.set(s.id.toLowerCase(),s.id);for(let a of s.dependencies??[])n.add(Bs(s.id,a.id));for(let a of[s.parent,s.blocked_by])typeof a=="string"&&n.add(Bs(s.id,a));for(let a of Cv(s)){let c=[...a.matchAll(i)].map(d=>d[0]);o+=c.length,r.push({holder_id:s.id,segment:a,mentioned_ids:c})}}return{canonical_ids:t,linked_pairs:n,prose_mentions:r,mention_count:o}}function Ov(e,t){let n=Tv(t.items),r=new Map;for(let s of n.prose_mentions){let a=s.mentioned_ids.map(d=>n.canonical_ids.get(d.toLowerCase())).filter(d=>d!==void 0&&d!==s.holder_id),c=[...new Set(a)];for(let d of c){let l=Bs(s.holder_id,d);if(n.linked_pairs.has(l)||$v(e.exemptions??[],s.holder_id,d,s.segment))continue;let u=c.some(m=>m!==d);r.get(l)?.explicit===!0&&!u||r.set(l,{contributor:`${s.holder_id}->${d}|subject=${u?"explicit":"implicit"}`,explicit:u})}}let i=[...r.values()],o=i.map(s=>s.contributor).sort();return{value:o.length,population_size:n.canonical_ids.size,cost:t.items.length+n.linked_pairs.size+n.mention_count,contributors:o.slice(0,e.sample_limit??25),partitions:{explicit_subject:i.filter(s=>s.explicit).length,implicit_subject:i.filter(s=>!s.explicit).length}}}function Pv(e,t){return{value:t.history.filter(r=>(e.op===void 0||r.op===e.op)&&(e.author===void 0||r.author===e.author)&&(e.harness===void 0||r.agent_harness===e.harness)&&(e.model===void 0||r.agent_model===e.model)).length,population_size:t.history.length,cost:t.history.length}}function Lv(e,t){let n=t.items.filter(r=>{let i=r[e.link],o=Array.isArray(i)&&i.length>0;return e.state==="present"?o:!o});return{value:n.length,population_size:t.items.length,cost:t.items.length,contributors:n.map(r=>r.id)}}function Nv(e,t){let n=e.source;return n.kind==="items"?Rv(n,t):n.kind==="dependency_kind"?Iv(n,t):n.kind==="prose_edge_gap"?Ov(n,t):n.kind==="history"?Pv(n,t):n.kind==="links"?Lv(n,t):null}function Rm(e,t){return e.reduce((n,r)=>({units:n.units+r.units,items_scanned:n.items_scanned+r.items_scanned,history_entries:n.history_entries+r.history_entries,provider_calls:n.provider_calls+r.provider_calls,duration_ms:t}),{units:0,items_scanned:0,history_entries:0,provider_calls:0,duration_ms:t})}function Dv(e,t){if(t.length===0)throw new TypeError(`derived ${e} requires operands`);if(e==="add")return t.reduce((n,r)=>n+r,0);if(e==="subtract")return t.slice(1).reduce((n,r)=>n-r,t[0]);if(e==="multiply")return t.reduce((n,r)=>n*r,1);if(e==="divide"){if(t.slice(1).includes(0))throw new TypeError("derived divide cannot divide by zero");return t.slice(1).reduce((n,r)=>n/r,t[0])}return e==="min"?Math.min(...t):Math.max(...t)}async function Am(e,t,n){let r=new Array(e.length),i=0,o=Array.from({length:Math.min(t,e.length)},async()=>{for(;i<e.length;){let s=i;i+=1,r[s]=await n(e[s],s)}});return await Promise.all(o),r}async function Im(e,t,n,r,i){if("literal"in e)return{value:e.literal,costs:[],population_size:0,contributors:[]};if("measurement"in e){let s=n.find(d=>d.id===e.measurement);if(!s)throw new TypeError(`derived measurement references missing ${e.measurement}`);let a=await Cm(s,t,n,r,i);if(typeof a.value!="number")throw new TypeError(`derived measurement ${s.id} is not numeric`);let c=i.charged.has(s.id)?[]:[a.cost];return i.charged.add(s.id),{value:a.value,costs:c,population_size:a.population_size,contributors:a.contributors}}let o=await Am(e.operands,km,s=>Im(s,t,n,r,i));return{value:Dv(e.operator,o.map(s=>s.value)),costs:o.flatMap(s=>s.costs),population_size:Math.max(0,...o.map(s=>s.population_size)),contributors:[...new Set(o.flatMap(s=>s.contributors))]}}async function Mv(e,t,n,r,i){Js(e);let o=Date.now(),s,a=[],c=0;if(e.source.kind==="derived"){let u=await Im(e.source.expression,t,n,[...r,e.id],i);s={value:u.value,population_size:u.population_size,cost:0,contributors:u.contributors},a=u.costs}else{let u=Nv(e,t);u!==null?s=u:(s=await t.external(e.source),c=1)}let d={units:s.cost,items_scanned:e.source.kind==="items"||e.source.kind==="dependency_kind"||e.source.kind==="prose_edge_gap"||e.source.kind==="links"?t.items.length:0,history_entries:e.source.kind==="history"?t.history.length:0,provider_calls:c,duration_ms:Date.now()-o},l=Rm([...a,d],Date.now()-o);if(e.max_cost!==void 0&&l.units>e.max_cost)throw new Ae(`measurement ${e.id} exceeded cost ceiling ${e.max_cost} with ${l.units}`);return{id:e.id,definition_fingerprint:`sha256:${pv("sha256").update(A(e)).digest("hex")}`,value:s.value,population_size:s.population_size,cost:l,contributors:s.contributors??[],...s.partitions?{partitions:s.partitions}:{}}}function Cm(e,t,n,r,i){if(r.includes(e.id))throw new TypeError(`derived measurement cycle: ${[...r,e.id].join(" -> ")}`);let o=i.cache.get(e.id);if(o)return o;let s=Mv(e,t,n,r,i).catch(a=>{if(a instanceof it&&a.measurement_id===void 0){let c={measurement_id:e.id,source_kind:a.source_kind,field:a.field,...a.check?{check:a.check}:{}},d=new it(a.message,c);throw d.cause=a,d}throw a});return i.cache.set(e.id,s),s}async function Xs(e,t,n=[e]){return Cm(e,t,n,[],{cache:new Map,charged:new Set})}function Fv(e,t){return typeof e!="number"||typeof t.value!="number"?null:t.polarity==="ceiling"||t.polarity==="monotone_nonincreasing"?t.value-e:(t.polarity==="floor"||t.polarity==="monotone_nondecreasing",e-t.value)}function jv(e,t,n={}){Ks(e);let r=yr(e),i=e.lifetime==="retire"&&n.owner_terminal===!0;return{assertion_id:e.id,measurement_id:e.measurement_id,measurement_definition_fingerprint:t.definition_fingerprint,scope:e.scope,population_size:t.population_size,observed:t.value,bound:r,distance:Fv(t.value,r),verdict:i?"retired":bm(t.value,r)?"pass":"fail",enforcement:e.enforcement,negative_control_proven:xm(e),cost:t.cost,contributors:t.contributors,...t.partitions?{partitions:t.partitions}:{}}}function Hv(e,t,n,r){let i=Ev(e,t);if(i.size===0)return;let o=e.provider_policy,s=o?.triggers[r];if(!o||!s)throw new Ae(`assurance gate ${e.id} refuses provider execution at trigger ${r} without an explicit provider policy`);let a=new Set(o.allowed_providers),c={low:0,medium:1,high:2};for(let d of i){if(!a.has(d))throw new Ae(`assurance gate ${e.id} refuses provider ${d}`);let l=n.provider_capabilities?.[d];if(!l)throw new Ae(`assurance provider ${d} has no declared capabilities`);if(c[l.cost_class]>c[s.max_cost_class])throw new Ae(`assurance gate ${e.id} refuses ${l.cost_class}-cost provider ${d} at trigger ${r}`);if(l.network&&!s.allow_network)throw new Ae(`assurance gate ${e.id} refuses network provider ${d} at trigger ${r}`)}}async function wm(e,t,n,r,i){try{return await Xs(n,r,i)}catch(o){if(o instanceof it){let s=o.check?` check ${o.check}`:"",a=o.measurement_id??n.id,c=new Ae(`assurance gate ${e} assertion ${t} measurement ${a} source ${o.source_kind}${s} field ${o.field} could not resolve: ${o.message}`,{gate_id:e,assertion_id:t,measurement_id:a,source_kind:o.source_kind,field:o.field,...o.check?{check:o.check}:{}});throw c.cause=o,c}throw o}}async function $m(e,t,n,r){Nn(t);let i=t.gates.find(c=>c.id===e);if(!i)throw new Ae(`assurance gate ${e} not found`);if(!i.triggers.includes(r.trigger))throw new Ae(`assurance gate ${e} does not declare trigger ${r.trigger}`);Hv(i,t,n,r.trigger);let o=await Am(i.assertion_ids,km,async c=>{let d=t.assertions.find(f=>f.id===c),l=t.measurements.find(f=>f.id===d.measurement_id),u=n;if(d.scope.kind==="active"){let f=new Set(n.terminal_statuses??["closed","canceled"]);u={...n,items:n.items.filter(h=>!f.has(h.status))}}else if(d.scope.kind==="filter"){let f=d.scope.measurement_id,h=t.measurements.find(v=>v.id===f),_=await wm(i.id,d.id,h,n,t.measurements),w=new Set(_.contributors);u={...n,items:n.items.filter(v=>w.has(v.id))}}let m=n.items.find(f=>f.id===d.owner_item_id),p=m!==void 0&&new Set(n.terminal_statuses??["closed","canceled"]).has(m.status);return jv(d,await wm(i.id,d.id,l,u,t.measurements),{owner_terminal:p})}),s=o.some(c=>c.verdict==="fail"&&c.enforcement==="block"),a=o.some(c=>c.verdict==="fail"&&c.enforcement==="warn");return{gate_id:i.id,tree_id:n.tree_id,trigger:r.trigger,dry_run:r.dry_run===!0,evaluated_at:new Date().toISOString(),verdict:s?"block":a?"warn":"pass",exit_code:s?1:0,assertions:o,assertions_total:o.length,row_contract:{row_keys:["assertions"],jq_selector:".assertions[]"},cost:Rm(o.map(c=>c.cost),Math.max(0,...o.map(c=>c.cost.duration_ms)))}}function qi(e){return fv.join(e,"assurance.json")}async function Tm(e){let t=await B(qi(e));return t===null?wr():Gi(t)}function Gi(e){try{return Nn(JSON.parse(e))}catch(t){throw new g("The assurance registry is invalid. Repair or restore .agents/pm/assurance.json and retry.",y.GENERIC_FAILURE,{code:"assurance_registry_invalid",reason:String(t),nextSteps:["Restore a valid assurance.json from version control or repair its declaration references.","Run pm assurance list measurement after the repair."]})}}function Bi(e,t){return t==="measurement"?e.measurements:t==="assertion"?e.assertions:e.gates}function Uv(e,t){e==="measurement"?Js(t):e==="assertion"?Ks(t):Sm(t)}async function vr(e,t){let n=structuredClone(Bi(await Tm(e),t));return{items:n,count:n.length,row_contract:{row_keys:["items"],jq_selector:".items[]"}}}async function Om(e,t,n){let r=Bi(await Tm(e),t).find(i=>i.id===n);if(!r)throw new Ae(`assurance ${t} ${n} not found`);return structuredClone(r)}async function Vi(e,t,n,r={}){Uv(t,n);let i=await T(e),o=q(r.author,i.author_default),s=await Sn({pmRoot:e,filePath:qi(e),op:`assurance:${t}:put`,author:o,message:r.message,lockTtlSeconds:zi,lockWaitMs:Wi,mutate:a=>{let c=a===null?wr():Gi(a),d=Bi(c,t),l=d.findIndex(m=>m.id===n.id),u=l<0?"created":"updated";if(t==="assertion"&&l>=0&&vv(d[l],n)){let m=n.authorization_decision;if(!m||!r.authorized_decision_ids?.includes(m))throw new L(`loosening assertion ${n.id} requires a verified authorization_decision`)}return l<0?d.push(structuredClone(n)):d[l]=structuredClone(n),Nn(c),{raw:`${JSON.stringify(c,null,2)}
|
|
2
2
|
`,result:{changed:!0,action:u,kind:t,id:n.id}}}});return{...s.result,changed:s.changed}}async function Zs(e,t,n={}){let r=wr();r.measurements=structuredClone(t.measurements),r.assertions=structuredClone(t.assertions),r.gates=structuredClone(t.gates),Nn(r);let i=await T(e),o=q(n.author,i.author_default),s=await Sn({pmRoot:e,filePath:qi(e),op:"assurance:bundle:apply",author:o,message:n.message,lockTtlSeconds:zi,lockWaitMs:Wi,mutate:a=>{let c=a===null?wr():Gi(a),d=[],l=[],u=(m,p,f)=>{for(let h of p){let _=m.find(w=>w.id===h.id);if(!_){m.push(structuredClone(h)),d.push(`${f}:${h.id}`);continue}if(A(_)!==A(h))throw new L(`assurance bundle refuses to replace divergent ${f} ${h.id}`);l.push(`${f}:${h.id}`)}};return u(c.measurements,r.measurements,"measurement"),u(c.assertions,r.assertions,"assertion"),u(c.gates,r.gates,"gate"),Nn(c),{raw:`${JSON.stringify(c,null,2)}
|
|
3
3
|
`,result:{changed:d.length>0,created_ids:d,unchanged_ids:l}}}});return{...s.result,changed:s.changed}}async function Pm(e,t,n,r={}){let i=await T(e),o=q(r.author,i.author_default),s=await Sn({pmRoot:e,filePath:qi(e),op:`assurance:${t}:remove`,author:o,message:r.message,lockTtlSeconds:zi,lockWaitMs:Wi,mutate:a=>{let c=a===null?wr():Gi(a);if(t==="measurement"){let u=Em(c).get(n);if(u&&u.length>0)throw new L(`assurance measurement ${n} is referenced by ${u.join(", ")}`)}if(t==="assertion"&&c.gates.some(u=>u.assertion_ids.includes(n)))throw new L(`assurance assertion ${n} is referenced by gate`);let d=Bi(c,t),l=d.findIndex(u=>u.id===n);if(l<0)throw new L(`assurance ${t} ${n} not found`);return d.splice(l,1),Nn(c),{raw:`${JSON.stringify(c,null,2)}
|
|
4
4
|
`,result:{changed:!0,action:"removed",kind:t,id:n}}}});return{...s.result,changed:s.changed}}async function Lm(e,t,n={}){if(t.dry_run)throw new TypeError("dry-run assurance verdicts are not persisted");let r=await T(e);await xn({pmRoot:e,op:"assurance:gate:verdict",author:q(n.author,r.author_default),context:{assurance_verdict:t},message:n.message??`Assurance gate ${t.gate_id} returned ${t.verdict}`,lockTtlSeconds:zi,lockWaitMs:Wi})}async function Nm(e,t={}){let n=t.limit??gv;if(!Number.isInteger(n)||n<1||n>1e3)throw new TypeError(`assurance verdict limit must be an integer from 1 through ${1e3}`);return(await ze(bn(e),re)).reverse().filter(i=>i.op==="assurance:gate:verdict").map(i=>i.context?.assurance_verdict).filter(i=>typeof i=="object"&&i!==null&&"gate_id"in i).filter(i=>t.gate_id===void 0||i.gate_id===t.gate_id).slice(0,n)}import{AsyncLocalStorage as zv}from"node:async_hooks";import Dm from"node:path";var Mm=new zv;function Fm(e,t){return Mm.run({...e,pmRoot:Dm.resolve(e.pmRoot)},t)}function PL(e,t){let n=Mm.getStore();return n!==void 0&&n.pmRoot===Dm.resolve(e)&&n.transactionId===t?n.step:void 0}import{mkdir as Wv,readFile as qv}from"node:fs/promises";import Hm from"node:path";import{createHash as Gv}from"node:crypto";var Qs=class extends Error{constructor(t="Workspace transaction interrupted"){super(t),this.name="WorkspaceTransactionInterruptedError"}},Um="sdk-workspace-transaction",zm=/^[a-zA-Z0-9._-]+$/,Wm=30,qm=3e3;function ia(e,t){if(typeof e!="string")throw new TypeError(`${t} must be a string`);let n=e.trim();if(!n||!zm.test(n))throw new TypeError(`${t} must match [a-zA-Z0-9._-]+`);return n}function ea(e,t){if(typeof e!="string")throw new TypeError(`${t} must be a string`);let n=e.trim();if(!n)throw new TypeError(`${t} must be non-empty`);return n}function oa(e){return{pmRoot:ea(e.pmRoot,"Transaction pmRoot"),transactionId:ia(e.transactionId,"Transaction id"),author:ea(e.author,"Transaction author")}}function Ki(e,t,n){let r=e??t;if(!Number.isInteger(r)||r<=0)throw new TypeError(`${n} must be a positive integer`);return r}function Gm(e,t){return Hm.join(e,"transactions","sdk",`${t}.json`)}async function ot(e,t){t.updatedAt=$();let n=Gm(e,t.transactionId);await Wv(Hm.dirname(n),{recursive:!0}),await ee(n,`${JSON.stringify(t,null,2)}
|
|
@@ -74,4 +74,4 @@ ${o}`,y.GENERIC_FAILURE)}}function is(e){return typeof e.tag=="string"&&e.tag.tr
|
|
|
74
74
|
`);de(e.progressEnabled,"writing keyword artifacts"),await ee(t,`${JSON.stringify(e.manifest,null,2)}
|
|
75
75
|
`),await ee(n,`${i}
|
|
76
76
|
`);let o=[];if(e.mode!=="keyword")try{de(e.progressEnabled,"writing vectorization status ledger"),await Bu(e.pmRoot,e.vectorizationLedgerEntries,e.vectorizationEmbeddingMetadata)}catch(s){o.push(`search_vectorization_status_ledger_write_failed:${s instanceof Error?s.message:String(s)}`)}return o}async function q2(e,t){let n=XP(e.mode),r=YP(e),i=e.full===!0;de(r,`start mode=${n}`);let o=M(process.cwd(),t.path);await ie(o);let s=Li(await T(o)).settings,a=null;try{a=await se(o,Eu,s.locks.ttl_seconds,q(void 0,"pm-reindex"),!1,s.governance.force_required_for_stale_lock,s.locks.wait_ms)}catch(c){throw c instanceof g&&c.exitCode===y.CONFLICT?new g("Another pm reindex run is already active for this project. Wait for it to finish before starting a new keyword, semantic, or hybrid reindex.",y.CONFLICT,{code:"reindex_already_running",type:"urn:pm-cli:error:reindex_already_running",why:"Semantic reindex can be expensive and duplicate runs compete for the same local embedding model and vector store.",nextSteps:["Check active pm reindex processes before starting another reindex.","Rerun with --progress when you need non-interactive visibility."]}):c}try{let c=eL(s),d=tL(s),l=aL({requestedMode:n,pmRoot:o,settings:s,extensionEmbedding:c,extensionVectorAdapter:d}),u=n;de(r,"loading item corpus");let m=await cL({pmRoot:o,settings:s}),p=m.warnings,{documentCandidates:f,metadataDocuments:h}=m;de(r,`loaded_items=${h.length}`);let _=$(),w=sL(u,_,h),v=ni.join(o,Cd),k=ni.join(o,$d),x=u==="keyword"?await Od(o,f,s.schema,p):h,E=[],R={},S=null,b=oL(u);if(u==="keyword"&&await dL({pmRoot:o,settings:s,forceFullSemantic:i,extensionEmbedding:c,reindexWarnings:p}),u!=="keyword"){let C=await _L({pmRoot:o,settings:s,requestedMode:n,activeEmbeddingProvider:l.activeEmbeddingProvider,activeVectorStore:l.activeVectorStore,extensionEmbedding:c,extensionVectorAdapter:d,documentCandidates:f,metadataDocuments:h,documentsForKeywordArtifacts:x,forceFullSemantic:i,reindexWarnings:p,semanticWarnings:E,semanticSummary:b,progressEnabled:r});x=C.documentsForKeywordArtifacts,R=C.vectorizationLedgerEntries,S=C.vectorizationEmbeddingMetadata}let D=await gL({pmRoot:o,mode:u,manifest:w,documentsForKeywordArtifacts:x,settings:s,vectorizationLedgerEntries:R,vectorizationEmbeddingMetadata:S,progressEnabled:r}),F=[...await Y({path:v,scope:"project",op:"reindex:manifest"}),...await Y({path:k,scope:"project",op:"reindex:embeddings"}),...await Ei({mode:u,total_items:h.length})];return de(r,"done"),{ok:!0,mode:u,total_items:h.length,semantic:b,artifacts:{manifest:Cd,embeddings:$d},warnings:[...p,...E,...D,...F],generated_at:_}}finally{await a?.()}}export{L as a,Ae as b,it as c,Ln as d,qs as e,vm as f,Yt as g,Gs as h,vv as i,Js as j,Ks as k,Sm as l,Nn as m,wr as n,Xs as o,jv as p,$m as q,vr as r,Om as s,Vi as t,Zs as u,Pm as v,Lm as w,Nm as x,PL as y,oa as z,Jm as A,BL as B,ek as C,VL as D,nk as E,YL as F,Zm as G,ok as H,fN as I,dx as J,KM as K,YM as L,XM as M,Or as N,ZM as O,QM as P,eF as Q,tF as R,nF as S,rF as T,iF as U,oF as V,sF as W,aF as X,cF as Y,$h as Z,ec as _,RD as $,zp as aa,dk as ba,ip as ca,IN as da,Sr as ea,CN as fa,_k as ga,gk as ha,$N as ia,yk as ja,O0 as ka,Ty as la,Z0 as ma,Ny as na,NN as oa,up as pa,My as qa,YG as ra,XG as sa,Er as ta,Qi as ua,pp as va,fp as wa,hp as xa,_p as ya,vp as za,ua as Aa,bp as Ba,Ep as Ca,Rp as Da,Mk as Ea,Ip as Fa,Ht as Ga,o1 as Ha,s1 as Ia,a1 as Ja,c1 as Ka,_1 as La,H_ as Ma,Oo as Na,j1 as Oa,Et as Pa,K_ as Qa,H1 as Ra,U1 as Sa,$I as Ta,LI as Ua,eg as Va,jk as Wa,pa as Xa,Vr as Ya,pW as Za,fW as _a,to as $a,no as ab,Gg as bb,Eq as cb,Bg as db,Jg as eb,Kg as fb,Zg as gb,ey as hb,gT as ib,yT as jb,rB as kb,iB as lb,oB as mb,sB as nb,Hy as ob,vT as pb,zy as qb,Bo as rb,qy as sb,Gy as tb,By as ub,bT as vb,ST as wb,RT as xb,aB as yb,AT as zb,id as Ab,od as Bb,yB as Cb,wB as Db,vB as Eb,rO as Fb,FV as Gb,Pw as Hb,Zr as Ib,Dw as Jb,Mw as Kb,Fw as Lb,kd as Mb,mP as Nb,kJ as Ob,qJ as Pb,QJ as Qb,Qw as Rb,ev as Sb,tv as Tb,x2 as Ub,D2 as Vb,M2 as Wb,F2 as Xb,q2 as Yb};
|
|
77
|
-
//# sourceMappingURL=chunk-
|
|
77
|
+
//# sourceMappingURL=chunk-SQ72CVUH.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{J as u,ub as h}from"./chunk-QZRYGYTI.js";import{$ as F,W as r,X as A,aa as w}from"./chunk-2UWKU2BQ.js";import{H as y,S as k,da as d}from"./chunk-JFICNN4T.js";import{A as f,m as _,z as c}from"./chunk-IRYNVGKH.js";function S(e){return e.trim().toLowerCase().replace(/^-+/u,"")}function v(e){let n=S(e),i=w({key:n,cli_flag:n,cli_aliases:[]});return[...new Set([...i,F(n)])]}var $=new Set(_.filter(e=>!y.has(e))),E={flag:"--help",short:"-h"},C=new Map;function b(e){let n=C.get(e);if(n===void 0){let i=new Map,o=new Map;for(let l of[...h(e),...u,E]){for(let t of[l.flag,...l.aliases??[]].flatMap(v))i.has(t)||i.set(t,l.flag);l.short!==void 0&&!o.has(l.short)&&o.set(l.short,l.flag)}n={long:i,short:o},C.set(e,n)}return n}function D(e,n){return r(e)?n.short.get(e.trim()):v(e).map(i=>n.long.get(i)).find(i=>i!==void 0)}function p(e){let n=[];for(let i of e){let o=a=>r(a)?a.trim():S(a),l=[...new Set([i.cli_flag,...i.cli_aliases].map(o))],t=o(i.key);for(let a of i.commands)n.push(...T(i.key,l,l.includes(t)?void 0:t,a.replaceAll("_","-")))}return n.sort((i,o)=>i.field.localeCompare(o.field)||i.command.localeCompare(o.command)||i.option.localeCompare(o.option))}function T(e,n,i,o){let l=b(o),t=new Map;for(let a of i===void 0?n:[...n,i]){if($.has(e)&&a.replaceAll("-","_")===e)continue;let s=D(a,l);s===void 0||t.has(s)||a===i&&s===E.flag||t.set(s,{field:e,command:o,field_flag:r(a)?a:`--${a.replaceAll("_","-")}`,option:s})}return[...t.values()]}function I(e){return p([{key:e.key,cli_flag:e.cliFlag??e.key.replaceAll("_","-"),cli_aliases:e.cliAliases,commands:e.commands}])}function g(e){return e.flatMap(n=>[...new Set([n.cli_flag,...n.cli_aliases])].flatMap(i=>{let o=A(i);return o===void 0?[]:[{field:n.key,spelling:i,reason:o}]}))}function M(e,n){return[...O(e.key,n?.cliFlag,n?.aliases),...g([{key:e.key,cli_flag:e.cliFlag??e.key.replaceAll("_","-"),cli_aliases:e.cliAliases}])]}function L(e){return`${JSON.stringify(e.spelling)} ${e.reason}`}function R(e){return`${e.field_flag} shadows built-in ${e.option} on pm ${e.command}`}function q(e,n){let i=d(e).definitions,o=p(i),l=g(i),t=l.length===0?{details:{},warnings:[]}:{details:{schema_field_flag_invalid_count:l.length,schema_field_flag_invalid:l.slice(0,n),schema_field_flag_invalid_truncated:l.length>n,schema_field_flag_invalid_fix_hint:"Re-register the field with one flag and one spelling per alias: pm schema add-field <key> --cli-flag <flag> --alias <alias>. A short alias is one dash and one character. Edit a field defined inline in settings.json there."},warnings:[`validate_schema_field_flag_invalid:${l.length}`]};return o.length===0?t:{details:{...t.details,schema_field_option_collision_count:o.length,schema_field_option_collisions:o.slice(0,n),schema_field_option_collisions_truncated:o.length>n,schema_field_option_collision_fix_hint:"Rename a file-backed field without losing item values: pm schema rename-field <key> --to <new-key>. For a colliding flag, alias or command list, re-register the same key: pm schema add-field <key> --cli-flag <flag> --commands <commands>. Edit a field defined inline in settings.json there."},warnings:[...t.warnings,`validate_schema_field_option_collision:${o.length}`]}}function z(e,n){m(e.key,M(e,n)),x(e.key,e.commands,I(e))}function O(e,n,i){return[n,...Array.isArray(i)?i:[]].filter(o=>typeof o=="string"&&k(o).length===0).map(o=>({field:e,spelling:o,reason:"is empty"}))}function H(e){m(e.key,O(e.key,e.cli_flag,e.cli_aliases));let n=d({fields:[e]}).definitions;m(e.key,g(n)),x(e.key,n.flatMap(i=>i.commands),p(n))}function m(e,n){if(n.length!==0)throw new f(`Cannot define custom field "${e}": flag ${n.map(L).join("; ")}. The command it is registered for could not register it as one option.`,c.USAGE,{code:"schema_field_flag_invalid",field:e,flag:n[0].spelling,required:"Each custom field flag and alias must be one option spelling: a long name without spaces, pipes, commas, '=' or brackets, or a short flag of one dash and one character.",nextSteps:[`Pass one spelling per --alias, for example pm schema add-field ${e} --alias <first> --alias <second>.`]})}function x(e,n,i){if(i.length===0)return;let o={key:e,commands:n},l=new Set(i.map(a=>a.command)),t=o.commands.filter(a=>!l.has(a.replaceAll("_","-")));throw new f(`Cannot define custom field "${o.key}": ${i.map(R).join("; ")}. The built-in option would stop working for that command.`,c.USAGE,{code:"schema_field_option_collision",field:o.key,flag:i[0].option,required:"A custom field's key, flag and aliases must differ from every built-in option of each command it is registered for.",nextSteps:[`Rename the field with a project-specific prefix, for example pm schema add-field project_${o.key}.`,...t.length>0?[`Or register "${o.key}" only where its option is free: --commands ${t.join(",")}.`]:[]]})}export{p as a,I as b,g as c,M as d,L as e,R as f,q as g,z as h,H as i};
|
|
2
|
+
//# sourceMappingURL=chunk-SQMOF65W.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as B,c as Y}from"./chunk-2DGKVXFT.js";import{jb as z}from"./chunk-VK3IE3TS.js";import{D as S}from"./chunk-QZRYGYTI.js";import{D as G,E as V,K as W,U as j}from"./chunk-TXTPAFHJ.js";import{r as q}from"./chunk-P2H3GTJK.js";import{Rd as F,dd as b,ia as y,jd as f,kd as O,ld as _,md as H,nd as k,qd as L,ra as A,rc as N,rd as M,sd as P,td as D,ud as U,vd as $,wd as l}from"./chunk-N64AC5G6.js";import{N as C,O as T}from"./chunk-2UWKU2BQ.js";import{g as I,n as R,t as E}from"./chunk-26P6C6OO.js";import{A as d,y as w,z as p}from"./chunk-IRYNVGKH.js";var J=new Set(y),ne=new Set(["files lookup","item files lookup"]);function x(e){let i=e.trim().replace(/^packages(?=\s|$)/u,"package").replace(/\s+/gu,"-");return J.has(i)?i:e}function g(e){let i=e.trim().replace(/\s+/gu," ");if(S.has(i)||ne.has(i))return!1;let t=x(e);return!(J.has(t)&&(!z(t)||t==="deps")&&!A.has(t))}var K="item_revision_conflict",oe=10,X=/^[0-9a-f]{64}$/u;function m(e,i){return new d(`Invalid expected revision ${JSON.stringify(e)}: ${i}.`,p.USAGE,{code:"expect_hash_invalid",value:e,required:"Pass the 64-character item_hash from pm get <id> --json, optionally as <id>=<item_hash>.",examples:["--expect-hash <item_hash>","--expect-hash pm-a1b2=<item_hash>"]})}function Q(e){let i=typeof e=="string"?e.trim().toLowerCase():"";if(!X.test(i))throw m(String(e),"the revision is not a 64-character hexadecimal item_hash");return i}function re(e){return(e===void 0?[]:typeof e=="string"?[e]:e).flatMap(t=>{if(typeof t!="string")throw m(String(t),"expected a string");let n=t.split(",").map(o=>o.trim()).filter(o=>o.length>0);if(n.length===0)throw m(t,"the value is empty");let r=o=>T(t)===t?o:C;return n.map(o=>{let c=o.lastIndexOf("="),s=c===-1?void 0:o.slice(0,c).trim();if(s!==void 0&&s.length===0)throw m(r(o),"the item id before = is empty");let a=c===-1?o:o.slice(c+1);if(!X.test(a.trim().toLowerCase()))throw m(r(a),"the revision is not a 64-character hexadecimal item_hash");let h=Q(a);return s===void 0?{itemHash:h}:{id:s,itemHash:h}})})}async function Z(e,i){let t=await q(e),n=I(t,F()).type_to_folder,r=await G(e,i,t.id_prefix,t.item_format,n);if(r){let{document:o}=await V(r,{schema:t.schema});if(o.metadata.id!==await Y(r.itemPath,r.id))throw new d(`Item file ${r.id} embeds the id ${o.metadata.id}; no revision can be bound to an item whose identity is in conflict.`,p.CONFLICT,{code:"item_identity_conflict",item_id:r.id,required:`Repair ${r.id}'s identity first (pm validate reports it; pm restore ${r.id} <version> recovers a recorded state), then read its item_hash again.`});return{id:o.metadata.id,document:o}}try{return{id:(await B(e,i,t,n)).id,document:w}}catch{throw await W(e,i,t.id_prefix,n)}}function v(e){return R(e.cwd??process.cwd(),e.pmRoot)}async function Me(e,i={}){let t=await Z(v(i),e);return{id:t.id,item_hash:b(t.document)}}async function ee(e,i,t){let n=[];for(let r of i){let o=r.id??t;if(o===void 0||o.trim().length===0)throw new d("A bare expected revision needs an item to bind to.",p.USAGE,{code:"expect_hash_target_required",required:"This command has no single item argument; name each target as --expect-hash <id>=<item_hash>.",examples:["--expect-hash pm-a1b2=<item_hash>"]});n.push({id:(await Z(e,o)).id,itemHash:r.itemHash})}return n}function se(e){return[...new Set(e.patch.map(i=>{let t=i.path.split("/");return String(t[1]==="metadata"?t[2]:t[1])}))].sort()}async function ce(e,i,t){let n;try{n=await N(E(e,i),i)}catch{return}let r=-1;for(let s=n.length-1;s>=0;s-=1){let a=n[s];if(a.after_hash===t){r=s+1;break}if(a.before_hash===t){r=s;break}}if(r===-1)return{expected_revision_recorded:!1,changes_since:[],changes_since_omitted:0};let o=n.slice(r),c=o.slice(-oe);return{expected_revision_recorded:!0,changes_since:c.map(s=>({ts:s.ts,op:s.op,author:s.author,fields:se(s)})),changes_since_omitted:o.length-c.length}}async function Pe(e,i){if(!u(e))return{};let t=await te(e,i);return{error_code:K,expected_revision:String(t.context.expected_revision),current_revision:String(t.context.current_revision),details:t.context.details}}function u(e){return j(e)&&e.context.code===K}function De(e){let i=e.find(t=>u(t));if(i!==void 0)throw i}function Ue(){return new d("--expect-hash cannot guard an invocation an extension override rewrote: which item it writes is not provable.",p.USAGE,{code:"expect_hash_invocation_rewritten",required:"Run the command without the rewriting extension (--no-extensions), or drop --expect-hash.",why:"An extension parser or preflight override changed this invocation's tracker or arguments, and final dispatch, the extension SDK client and the guard do not share one rewritten view."})}function ae(e,i){if(i===void 0||!u(e)||typeof e.context.item_id!="string"||U(e))return e;let t=e.context.reason===M;if(!t&&e.context.reason!==L)return e;let n=$(l(e,new d(e.message,e.exitCode,{...e.context,...P(e.context.item_id,t,i)})));return n.stack=e.stack,n}async function te(e,i,t){if(!D(e,i))return e;let n=ae(e,t);if(!u(n)||n.context.details!==void 0)return n;let r=n.context.item_id,o=n.context.expected_revision;if(typeof r!="string"||typeof o!="string")return n;let c;try{c=await ce(i,r,o)}catch{return n}if(c===void 0)return n;let s={expected_revision_recorded:c.expected_revision_recorded,changes_since:c.changes_since.map(h=>({ts:h.ts,op:h.op,author:h.author,fields:[...h.fields]})),changes_since_omitted:c.changes_since_omitted},a=l(n,new d(n.message,n.exitCode,{...n.context,details:s}));return a.stack=n.stack,a}async function ie(e,i,t){try{return{result:await O(e,i),...H(e)}}catch(n){throw e.pmRoot===void 0?n:await te(n,e.pmRoot,t)}}function de(e){return e.cwd===void 0&&e.pmRoot===void 0?void 0:{scopeArgs:["--pm-path",v(e)]}}async function $e(e,i,t={}){return ie(await he(e,t),i,de(t))}async function he(e,i={}){let t=v(i),n=e.map(({id:o,itemHash:c})=>({id:o,itemHash:Q(c)})),r=f();return _(r,t,await ee(t,n)),r}function Fe(e){let i=k(e);return i===void 0||i.length>0}function pe(e){return`expect_hash_unchecked:${e}:no_locked_write_reached_this_item`}function me(e,i={}){let t=x(e);if(!g(e))throw ue(t);if((t==="test"||t==="test-all")&&i.background===!0)throw new d(`--expect-hash cannot guard ${t} --background: the worker runs in another process.`,p.USAGE,{code:"expect_hash_background_unsupported",required:`Run ${t} in the foreground to guard its result recording, or drop --expect-hash for a background run.`})}function ue(e){return new d(`--expect-hash guards item writes, and ${e} is not a mutation.`,p.USAGE,{code:"expect_hash_requires_mutation",required:"Use --expect-hash (MCP/SDK expectHash) only on a command or action that writes items."})}function fe(e,i){if(i.length===0||typeof e!="object"||e===null||Array.isArray(e))return e;let t=e,n=Array.isArray(t.warnings)?t.warnings:[];return{...t,warnings:[...n,...i.map(pe)]}}async function qe(e){let i=e.expectHash;if(i!==void 0&&typeof i!="string"&&!(Array.isArray(i)&&i.every(o=>typeof o=="string")))throw m(JSON.stringify(i)??String(i),"expected a string or an array of strings");let t=re(i);if(t.length===0)return e.run();me(e.action,{background:e.background===!0||e.options?.background===!0});let n=f();_(n,e.pmRoot,await ee(e.pmRoot,t,e.defaultId));let r=await ie(n,e.run,e.invocation);return fe(r.result,r.unchecked)}export{g as a,K as b,oe as c,Q as d,re as e,Me as f,ee as g,ce as h,Pe as i,u as j,De as k,Ue as l,ae as m,te as n,ie as o,$e as p,he as q,Fe as r,pe as s,me as t,ue as u,qe as v};
|
|
2
|
+
//# sourceMappingURL=chunk-T3ILWAEV.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ca as R}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{ca as R}from"./chunk-W4JMV7GF.js";import{ub as r}from"./chunk-QZRYGYTI.js";import{Ne as S,Oe as N,Qe as E,ia as a}from"./chunk-N64AC5G6.js";var u=new Set(["--author","--expect-hash","--follow","--help","--lean","--token-accounting","--output-include","--output-limit","--output-budget","--output-format","--output-session","--output-cursor","--output-row-contract","--no-changed-fields","--no-extensions","--no-pager","--pm-path","--profile","--quiet","--interval-ms"]),I=new Set([...S,...N]),p=new Set(["--brief","--format","--full","--full-changed-fields","--id-only","--no-truncate","--stream"]),P=new Set(["--body-file","--file","--stdin-json"]),m=new Set(["--global","--local","--project"]),d=new Set(["--activity-limit","--default-depth","--section-activity","--section-blockers","--section-files","--section-hierarchy","--section-progress","--section-staleness","--section-tests","--section-workload","--stale-threshold-days"]),f=new Set(["action","fullChangedFields","idOnly","path","pmExecutable","timeoutMs"]),M=new Set(["configAction","id","name","query","reason","subcommand","target","text"]),G={assurance:{id:"<id>",kind:"<kind>",preset:"[kind]|[id]",subcommand:"<action>"},event:{title:"<title>"},files:{lookupPath:"lookup <path...>"},meet:{title:"<title>"},"item-reopen":{id:"<id>",reason:"<reason>"},merge:{subcommand:"<subcommand>"},remind:{title:"<title>"},workspace:{name:"<name>",subcommand:"snapshot",snapshotAction:"<snapshot-action>",target:"<target>"}},F={append:{"--text":"body"},assurance:{"--tree":"treeId","--owner":"owner","--apply":"apply","--enforcement":"enforcement"},init:{"--id-prefix":"idPrefix","--no-merge-fence":"mergeFence","--workspace":"workspace"},create:{"--no-inherit-focus":"inheritFocus","--ac":"acceptanceCriteria","--estimated-minutes":"estimate","--file":"linkedFile","--test":"linkedTest","--expected":"expectedResult","--actual":"actualResult"},plan:{"--no-inherit-focus":"inheritFocus"},update:{"--ac":"acceptanceCriteria","--estimated-minutes":"estimate","--file":"linkedFile","--test":"linkedTest","--expected":"expectedResult","--actual":"actualResult"},"update-many":{"--ac":"acceptanceCriteria","--estimated-minutes":"estimate","--file":"linkedFile","--test":"linkedTest","--expected":"expectedResult","--actual":"actualResult"},files:{"--note":"addNote","--note-conflict":"noteConflict","--full-history":"full"},docs:{"--note":"addNote","--note-conflict":"noteConflict","--full-history":"full"},test:{"--full-history":"full"},comments:{"--full-history":"full"},notes:{"--file":"text","--full-history":"full"},learnings:{"--file":"text","--full-history":"full"},gc:{"--scope":"gcScope"},contracts:{"--action":"contractAction"},schema:{"--no-allow-unset":"allowUnset","--type":"fieldTypeScope"},"history-author-acknowledge":{"--event":"historyEvent","--all-actionable":"allActionable"},"extension-init":{"--capability":"capability"},"package-init":{"--capability":"capability"},"extension-install":{"--gh":"github"},"package-install":{"--gh":"github"},"extension-adopt":{"--gh":"github"},"package-adopt":{"--gh":"github"},extension:{"--gh":"github","--scaffold":"init"},package:{"--gh":"github","--scaffold":"init"},install:{"--gh":"github"}},D={"--pm-path":"path"},c={stats:{"--analytics":["measurements","metric","measurementLimit","observe","improvementDirection","measurementSource","measurementItem","measurementRevision","author","message","provenanceCoverage","fleetAttribution","since","eventLimit","minimumSample"]}};function h(T){return T.startsWith("extension-")?`extension ${T.slice(10)}`:T.startsWith("package-")?`package ${T.slice(8)}`:T.startsWith("item-")?`item ${T.slice(5)}`:T}function l(T,e){let t=F[T]?.[e]??D[e];return t!==void 0?t:e.replace(/^--/,"").replaceAll("_","-").replace(/-([a-z])/g,(O,_)=>_.toUpperCase())}function g(T){let e=new Set;return T.filter(({flag:t})=>!t.startsWith("--")||e.has(t)?!1:(e.add(t),!0))}function U(T,e){return e.find(({aliases:t})=>t?.includes(T))?.flag}function y(T,e,t,O){let _=c[T]?.[e.flag];if(_!==void 0&&_.every(A=>O.has(A)))return{surface:"cli",input:e.flag,counterpart:_[0],disposition:"shared",reason:"The validated CLI JSON object fans out across strict SDK parameters."};let i=l(T,e.flag);if(O.has(i))return{surface:"cli",input:e.flag,counterpart:i,disposition:"shared",reason:"The CLI flag maps directly to a strict SDK action parameter."};let C=U(e.flag,t);if(C!==void 0){let A=l(T,C);if(O.has(A))return{surface:"cli",input:e.flag,counterpart:A,disposition:"compatibility_alias",reason:`Compatibility spelling for ${C}.`}}return u.has(e.flag)?{surface:"cli",input:e.flag,disposition:"cli_transport",reason:"CLI process transport is supplied by the in-process SDK host."}:p.has(e.flag)?{surface:"cli",input:e.flag,disposition:"cli_presentation",reason:"CLI rendering or mutation projection does not alter the SDK result envelope."}:P.has(e.flag)?{surface:"cli",input:e.flag,disposition:"cli_adapter",reason:"Local file or stdin adaptation is a CLI boundary concern."}:d.has(e.flag)?{surface:"cli",input:e.flag,counterpart:"key",disposition:"compatibility_alias",reason:"CLI config shorthand normalizes to the SDK configAction/key/value contract."}:m.has(e.flag)?{surface:"cli",input:e.flag,counterpart:"scope",disposition:"cli_scope_selector",reason:"Mutually exclusive CLI scope switches normalize to the SDK scope parameter."}:{surface:"cli",input:e.flag,counterpart:i,disposition:"unclassified",reason:"The CLI flag has no strict SDK parameter or approved boundary classification."}}function b(T,e,t){let O=Object.entries(c[T]??{}).find(([C,A])=>A.includes(e)&&t.some(({input:o,disposition:s})=>o===C&&s==="shared"));if(O!==void 0)return{surface:"sdk",input:e,counterpart:O[0],disposition:"shared",reason:"The strict SDK parameter is reachable through the validated CLI JSON object."};let _=t.find(({counterpart:C,disposition:A})=>C===e&&(A==="shared"||A==="compatibility_alias"||A==="cli_scope_selector"));if(_!==void 0)return{surface:"sdk",input:e,counterpart:_.input,disposition:"shared",reason:"The strict SDK parameter is reachable from the CLI contract."};let i=G[T]?.[e];return i!==void 0?{surface:"sdk",input:e,counterpart:i,disposition:"shared",reason:"The strict SDK parameter maps to a canonical CLI positional argument."}:f.has(e)?{surface:"sdk",input:e,disposition:"sdk_transport",reason:"The SDK host supplies in-process transport and workspace selection."}:M.has(e)?{surface:"sdk",input:e,disposition:"cli_positional",reason:"The CLI accepts this SDK parameter as a positional command argument."}:{surface:"sdk",input:e,disposition:"sdk_native",reason:"The typed SDK exposes this structured input without a canonical CLI long flag."}}function x(T={}){let e=T.actions??a,t=T.resolveFlags??r,O=T.resolveParameters??R;return e.map(_=>{let i=h(_),C=g(t(i)).filter(({flag:n})=>E(_)!==void 0||!I.has(n)),A=new Set(O(_)??[]),o=C.map(n=>y(_,n,C,A)),s=[...A].sort((n,L)=>n.localeCompare(L)).map(n=>b(_,n,o));return{action:_,command:i,cli:o,sdk:s,unclassified:[...o,...s].filter(({disposition:n})=>n==="unclassified")}})}export{x as a};
|
|
2
|
+
//# sourceMappingURL=chunk-TR22GU7M.js.map
|