@unbrained/pm-cli 2026.8.12 → 2026.8.14
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 +2 -2
- package/CHANGELOG.md +162 -111
- package/dist/cli/error-guidance.js +4 -8
- package/dist/cli/main.js +40 -3
- package/dist/cli/register-assurance.js +28 -17
- package/dist/cli-bundle/bundle-manifest.json +141 -173
- package/dist/cli-bundle/chunks/chunk-BBOFSVAK.js +197 -0
- package/dist/cli-bundle/chunks/chunk-BFALV3YP.js +5 -0
- package/dist/cli-bundle/chunks/{chunk-WLAHPSOX.js → chunk-FIW4P64F.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-BM5YJ2UW.js → chunk-G5JUB66K.js} +52 -52
- package/dist/cli-bundle/chunks/chunk-SBRKH6OR.js +2 -0
- package/dist/cli-bundle/chunks/chunk-TMJ7URWS.js +13 -0
- package/dist/cli-bundle/chunks/chunk-TXMEUUUY.js +8 -0
- package/dist/cli-bundle/chunks/{chunk-KOQMGCTA.js → chunk-XAVMOK6B.js} +50 -50
- package/dist/cli-bundle/chunks/chunk-YAMTJL6Y.js +34 -0
- package/dist/cli-bundle/chunks/chunk-YSVSMJ2B.js +2 -0
- package/dist/cli-bundle/chunks/{register-list-query-XPCJRUUD.js → register-list-query-T3EHHNNV.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-4RJCBKRS.js → register-mutation-E27WCLSZ.js} +2 -2
- package/dist/cli-bundle/chunks/register-operations-4R6I7CPY.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-LLHAKP2V.js → register-setup-3YXZ444E.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-JAFRIWVF.js → chunk-4DQ2YERC.js} +4 -4
- package/dist/cli-bundle/focused-chunks/chunk-F43TT2QQ.js +8 -0
- package/dist/cli-bundle/focused-chunks/chunk-K7RWWOAG.js +4 -0
- package/dist/cli-bundle/focused-chunks/chunk-KFSZ3BP6.js +16 -0
- package/dist/cli-bundle/focused-chunks/{chunk-KHM2CS2C.js → chunk-KSEDUWVZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-KYUQGTSB.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-ZMGWAYH7.js → chunk-LZ4MV3RH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-PGXJQLCT.js +155 -0
- package/dist/cli-bundle/focused-chunks/{chunk-RWPAWUOT.js → chunk-PPFGQDSI.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-Q4YY3XNF.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-QK753U3U.js +46 -0
- package/dist/cli-bundle/focused-chunks/chunk-QUMB2J27.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-SM7MTG27.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-GQW4BPUT.js → chunk-WCVE2NIG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-XDNAW5OI.js +18 -0
- package/dist/cli-bundle/focused-chunks/{chunk-YIAXMC3T.js → chunk-YOOI3UZX.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZM6TZVHC.js +2 -0
- package/dist/cli-bundle/main.js +13 -13
- 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 +45 -41
- 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 +109 -1
- 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/checkpoint/checkpoint-gc.js +7 -12
- package/dist/core/extensions/activation-summary-markdown.js +5 -4
- package/dist/core/extensions/activation-summary.d.ts +2 -0
- package/dist/core/extensions/activation-summary.js +6 -2
- package/dist/core/extensions/capability-usage.d.ts +1 -1
- package/dist/core/extensions/capability-usage.js +4 -3
- package/dist/core/extensions/contribution-inventory.d.ts +1 -0
- package/dist/core/extensions/contribution-inventory.js +6 -2
- package/dist/core/extensions/extension-registries.js +3 -2
- package/dist/core/extensions/extension-types.d.ts +83 -1
- package/dist/core/extensions/extension-types.js +3 -2
- package/dist/core/extensions/loader.d.ts +2 -8
- package/dist/core/extensions/loader.js +53 -144
- package/dist/core/extensions/registration-values.d.ts +43 -0
- package/dist/core/extensions/registration-values.js +210 -0
- package/dist/core/extensions/runtime-registrations.d.ts +3 -1
- package/dist/core/extensions/runtime-registrations.js +12 -2
- package/dist/core/fs/fs-utils.d.ts +2 -0
- package/dist/core/fs/fs-utils.js +7 -3
- package/dist/core/history/drift-cache.js +4 -3
- package/dist/core/history/drift-scan.d.ts +6 -0
- package/dist/core/history/drift-scan.js +76 -58
- package/dist/core/history/workspace-history.d.ts +59 -0
- package/dist/core/history/workspace-history.js +197 -10
- package/dist/core/lock/lock-gc.js +8 -13
- package/dist/core/lock/lock.js +5 -4
- package/dist/core/output/output.js +12 -4
- package/dist/core/search/vector-stores.js +6 -11
- package/dist/core/store/item-metadata-cache.js +4 -4
- package/dist/core/telemetry/runtime.d.ts +6 -0
- package/dist/core/telemetry/runtime.js +101 -30
- package/dist/sdk/agent/command-recovery.d.ts +2 -0
- package/dist/sdk/agent/command-recovery.js +10 -2
- package/dist/sdk/annotations.js +4 -4
- package/dist/sdk/cli-contracts/completeness.js +9 -3
- package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts/flag-contracts.js +6 -3
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +6 -1
- package/dist/sdk/cli-contracts/runtime-contracts.js +155 -60
- package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +32 -0
- package/dist/sdk/cli-contracts/schemas/assurance-definition.js +25 -2
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +35 -5
- package/dist/sdk/cli-contracts/tool-schema.js +17 -2
- package/dist/sdk/cli-program.js +3 -3
- package/dist/sdk/comments.js +4 -3
- package/dist/sdk/compile-cache.js +4 -3
- package/dist/sdk/compose.d.ts +3 -1
- package/dist/sdk/compose.js +16 -2
- package/dist/sdk/context-relevance.js +12 -4
- package/dist/sdk/context-signal-store.js +4 -3
- package/dist/sdk/extension/install-runtime.js +4 -4
- package/dist/sdk/extension/managed-state.js +4 -3
- package/dist/sdk/extension-contracts.d.ts +1 -1
- package/dist/sdk/flag-invocation-contracts.js +5 -6
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +14 -2
- package/dist/sdk/governance/assurance-action.d.ts +27 -3
- package/dist/sdk/governance/assurance-action.js +112 -28
- package/dist/sdk/governance/assurance-mutation-error.d.ts +7 -0
- package/dist/sdk/governance/assurance-mutation-error.js +25 -2
- package/dist/sdk/governance/assurance-presets.d.ts +54 -0
- package/dist/sdk/governance/assurance-presets.js +136 -0
- package/dist/sdk/governance/assurance-runtime.d.ts +4 -0
- package/dist/sdk/governance/assurance-runtime.js +109 -8
- package/dist/sdk/governance/assurance.d.ts +39 -0
- package/dist/sdk/governance/assurance.js +145 -6
- package/dist/sdk/governance/gc.js +5 -11
- package/dist/sdk/governance/health.js +18 -6
- package/dist/sdk/governance/validate-history-drift.d.ts +7 -0
- package/dist/sdk/governance/validate-history-drift.js +68 -0
- package/dist/sdk/governance/validate.js +6 -48
- package/dist/sdk/graph/assembly.d.ts +23 -0
- package/dist/sdk/graph/assembly.js +54 -2
- package/dist/sdk/graph/durable-cache.js +91 -3
- package/dist/sdk/graph/governance-contracts.d.ts +12 -0
- package/dist/sdk/graph/governance-contracts.js +29 -0
- package/dist/sdk/graph/governance.d.ts +51 -3
- package/dist/sdk/graph/governance.js +216 -35
- package/dist/sdk/graph/index.d.ts +2 -2
- package/dist/sdk/graph/index.js +4 -4
- package/dist/sdk/graph/mutation-advisory.js +15 -7
- package/dist/sdk/graph/remediation.js +12 -2
- package/dist/sdk/guide.js +4 -4
- package/dist/sdk/history-read.d.ts +8 -0
- package/dist/sdk/history-read.js +2 -2
- package/dist/sdk/index.d.ts +3 -2
- package/dist/sdk/index.js +5 -4
- package/dist/sdk/linked-artifacts.d.ts +2 -0
- package/dist/sdk/linked-artifacts.js +29 -4
- package/dist/sdk/merge/install.js +5 -4
- package/dist/sdk/query/activity.js +4 -3
- package/dist/sdk/query/history.js +20 -3
- package/dist/sdk/read-output-budget.d.ts +2 -0
- package/dist/sdk/read-output-budget.js +12 -5
- package/dist/sdk/read-output-contracts.d.ts +61 -5
- package/dist/sdk/read-output-contracts.js +210 -28
- package/dist/sdk/read-output-rows.d.ts +11 -0
- package/dist/sdk/read-output-rows.js +47 -2
- package/dist/sdk/relationship-history.js +5 -5
- package/dist/sdk/runtime-primitives.d.ts +1 -1
- package/dist/sdk/runtime-primitives.js +3 -3
- package/dist/sdk/runtime.js +5 -3
- package/dist/sdk/schema-migration.js +4 -4
- package/dist/sdk/test/execution.js +4 -4
- package/dist/sdk/workspace-memory.js +4 -4
- package/dist/sdk/workspace-snapshot.js +8 -14
- package/dist/sdk/workspace-transaction-gc.js +4 -9
- package/dist/sdk/workspace-transaction.js +4 -4
- package/dist/sdk/workspace.js +4 -3
- package/docs/ASSURANCE.md +163 -3
- package/docs/COMMANDS.md +31 -2
- package/docs/CONFIGURATION.md +2 -0
- package/docs/EXTENSIONS.md +11 -12
- package/docs/READ_OUTPUT_CONTRACTS.md +44 -8
- package/docs/RELATIONSHIP_GRAPH.md +34 -4
- package/docs/SDK.md +29 -8
- package/docs/SDK_CONTEXT_INTEGRITY.md +32 -1
- package/docs/TESTING.md +47 -16
- package/docs/performance/sdk-entrypoint-import-costs.md +20 -13
- package/marketplace.json +2 -2
- package/package.json +6 -6
- package/packages/pm-beads/extensions/beads/index.ts +1 -0
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/extensions/calendar/index.ts +1 -0
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/extensions/digital-twin/index.ts +7 -0
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/extensions/governance-audit/index.ts +4 -0
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/extensions/guide-shell/index.ts +5 -0
- 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/extensions/linked-test-adapters/index.ts +6 -0
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/extensions/search-advanced/index.ts +2 -0
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/extensions/templates/index.ts +4 -0
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/extensions/todos/index.ts +2 -0
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/extensions/vcs/index.ts +7 -0
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/scripts/bundle-cli.mjs +17 -4
- package/sdk/public-surface.json +390 -60
- package/dist/cli-bundle/chunks/chunk-3PS7X6GS.js +0 -8
- package/dist/cli-bundle/chunks/chunk-7KL6KMWF.js +0 -13
- package/dist/cli-bundle/chunks/chunk-D55A5AEN.js +0 -33
- package/dist/cli-bundle/chunks/chunk-KIKDWECH.js +0 -196
- package/dist/cli-bundle/chunks/chunk-R76342NV.js +0 -2
- package/dist/cli-bundle/chunks/chunk-RBTK5EZV.js +0 -5
- package/dist/cli-bundle/chunks/chunk-VLUQOIDT.js +0 -2
- package/dist/cli-bundle/chunks/register-operations-2OGISOVR.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-2DALMVF7.js +0 -5
- package/dist/cli-bundle/focused-chunks/chunk-5OQIMELN.js +0 -155
- package/dist/cli-bundle/focused-chunks/chunk-5TAGTDRE.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-ECADZMVC.js +0 -18
- package/dist/cli-bundle/focused-chunks/chunk-EJGXRA6B.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-FFGSZCPK.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-ISKOBJCM.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-KPSXVBDV.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-KTLOKKCQ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-LGYK3NUF.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-NBLUKITQ.js +0 -4
- package/dist/cli-bundle/focused-chunks/chunk-NYLOUPOB.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-Q4T463SD.js +0 -31
- package/dist/cli-bundle/focused-chunks/chunk-QVZVY53N.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-UTEWXDEQ.js +0 -17
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./chunk-QWRRFYK3.js";import{$a as $,$b as W,$c as ne,Ja as V,Na as N,Pb as x,Rb as q,Sb as H,Sc as Z,Tb as J,Tc as ee,Ub as z,Vc as te,Zb as G,_a as B,_b as j,ab as D,ac as Y,ad as ae,bc as K,bd as oe,cd as E,dc as X,ha as L,hb as U,id as re,zc as Q}from"./chunk-YAMTJL6Y.js";import"./chunk-XAVMOK6B.js";import"./chunk-TMJ7URWS.js";import"./chunk-WYRZZ5ZE.js";import{C as m,Cf as l,Df as d,E as b,Ol as p,Ra as _,Sd as O,Zc as R,ba as S,hh as I,nl as P,rl as c,ul as w,vc as C,vl as s,wl as k,yl as M,zl as F}from"./chunk-BBOFSVAK.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="13159f49-7756-58b8-ac32-7ddd571e7d09")}catch{}})();var ie=new Map([["measurements","boolean"],["metric","string"],["measurementLimit","number"],["observe","string_array"],["direction","direction"],["measurementSource","string"],["measurementItem","string"],["measurementRevision","string"],["author","string"],["message","string"],["provenanceCoverage","boolean"],["fleetAttribution","boolean"],["since","string"],["eventLimit","number"],["minimumSample","number"]]),me=new Set(["higher","lower","target"]),fe=[...ie.keys()].sort((e,t)=>e.localeCompare(t)).join(", ");function pe(e,t){return e==="boolean"?typeof t=="boolean":e==="string"?typeof t=="string":e==="number"?typeof t=="number":e==="string_array"?Array.isArray(t)&&t.every(n=>typeof n=="string"):e==="direction"&&me.has(t)}function se(e){if(e===void 0)return{};let t;try{t=JSON.parse(e)}catch(n){throw new b(`--analytics must be valid JSON: ${String(n)}`,m.USAGE)}if(t===null||typeof t!="object"||Array.isArray(t))throw new b("--analytics must be a JSON object.",m.USAGE);for(let[n,a]of Object.entries(t)){let o=ie.get(n);if(!pe(o,a))throw new b(o===void 0?`Unknown --analytics field "${n}". Accepted fields: ${fe}.`:`--analytics field "${n}" must be ${o.replace("_"," ")}.`,m.USAGE)}return t}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="eee25545-a7e9-54be-abc0-dbccc9b41e74")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b0095f00-00bd-5b28-933c-b63a1711a73d")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="99355d20-090b-503e-8079-b858291938e3")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="35276f20-abc5-54e2-8251-35971f1fcb4f")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="8fa4af33-ba9f-5a19-a359-c64143287b5d")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="52c4154e-2761-5230-942c-6ac5e83a830c")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c3fceb32-e0b9-5690-8653-4c699f865c0f")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1e42a508-5568-522f-843d-61febc0bad27")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="43769e60-ed80-521d-9375-c28ee5b0ac06")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3f1deb3b-e341-533a-a349-eca48f347600")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="91a42861-f8cb-575b-8596-53870f6275c6")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c85956ff-383f-5482-96a9-0ef38949859c")}catch{}})();var le=(e,t)=>V(e,t,{runUpdate:(n,a,o)=>x(n,a,o)});(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="41d01430-1e95-5f09-9a2f-7e7f8fad8184")}catch{}})();async function ye(e,t,n,a,o){let r=c(o),i=e==="run",u=e==="verdicts",g=e==="presets"||e==="apply",f=e==="promote",h=await N({action:e,...i||u||g||f?{}:{kind:t},id:i||u||f?n??t:n,preset:g?n??t:void 0,definition:s(a,"definition"),trigger:s(a,"trigger"),tree:s(a,"tree"),gate:s(a,"gate"),limit:s(a,"limit"),dry_run:a.dryRun===!0,fullChangedFields:r.fullChangedFields,idOnly:r.idOnly,author:s(a,"author"),message:s(a,"message"),owner:s(a,"owner"),apply:a.apply===!0,enforcement:s(a,"enforcement")},r);l(h,r),typeof h=="object"&&h!==null&&"exit_code"in h&&h.exit_code===1&&(process.exitCode=1)}function ce(e){e.command("assurance").argument("<action>","Action; inspect `pm contracts --command assurance`").argument("[kind]","Declaration kind or run gate id").argument("[id]","Declaration/gate id").description("Manage SDK-owned assurance contracts.").option("--definition <json>","Put declaration JSON").option("--trigger <value>","Gate trigger").option("--tree <value>","Revision identity").option("--gate <id>","Verdict gate filter").option("--limit <number>","Verdict limit").option("--dry-run","Evaluate without recording").option("--author <value>","Mutation author").option("--message <value>","Mutation rationale").option("--owner <item-id>","Preset/derivation owner").option("--apply","Persist derived proposals").option("--enforcement <level>","Promote to warn or block").action(ye)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="7796ea07-0de7-5db8-a3b5-a8021ceebc69")}catch{}})();function ge(e,t){let n=e?.trim().toLowerCase(),a=t?.trim().toLowerCase();if(n===void 0||n.length===0)return a;if(n==="local-analytics")return a&&a.length>0?a:"status";if(a!==void 0&&a.length>0)throw S({command_path:"telemetry",token:`${e} ${t}`,allowed:["status","flush","stats","clear","local-analytics"],token_kind:"path",examples:["pm telemetry stats --limit 10","pm telemetry local-analytics status --json"]});return n}function he(e){return{addValues:Array.isArray(e.add)?e.add:[],addJsonValues:Array.isArray(e.addJson)?e.addJson:[],removeValues:Array.isArray(e.remove)?e.remove:[],removeIndexValues:Array.isArray(e.removeIndex)?e.removeIndex:[]}}function be(e,t){if(e.background===!0){if(e.run!==!0)throw new b("--background requires --run",m.USAGE);if(t.addValues.length>0||t.addJsonValues.length>0||t.removeValues.length>0||t.removeIndexValues.length>0)throw new b("--background does not support --add/--add-json/--remove/--remove-index; update linked tests first, then run in background",m.USAGE)}}async function we(e,t,n,a){let o=await E({kind:"test",commandArgs:M(e,{...t,add:a.addValues,addJson:a.addJsonValues,remove:a.removeValues,removeIndex:a.removeIndexValues}),targetId:e,author:typeof t.author=="string"?t.author:void 0,noExtensions:n.noExtensions===!0},n);l(o,n)}function ke(e,t){return{add:t.addValues,addJson:t.addJsonValues,remove:t.removeValues,removeIndex:t.removeIndexValues,list:!!e.list,run:!!e.run,match:typeof e.match=="string"?e.match:void 0,onlyIndex:typeof e.onlyIndex=="string"||typeof e.onlyIndex=="number"?e.onlyIndex:void 0,onlyLast:!!e.onlyLast,timeout:typeof e.timeout=="string"?e.timeout:void 0,progress:!!e.progress,envSet:Array.isArray(e.envSet)?e.envSet:[],envClear:Array.isArray(e.envClear)?e.envClear:[],sharedHostSafe:!!e.sharedHostSafe,pmContext:typeof e.pmContext=="string"?e.pmContext:void 0,overrideLinkedPmContext:!!e.overrideLinkedPmContext,failOnContextMismatch:!!e.failOnContextMismatch,failOnSkipped:!!e.failOnSkipped,failOnEmptyTestRun:!!e.failOnEmptyTestRun,requireAssertionsForPm:!!e.requireAssertionsForPm,checkContext:!!e.checkContext,autoPmContext:!!e.autoPmContext,author:typeof e.author=="string"?e.author:void 0,message:typeof e.message=="string"?e.message:void 0,force:!!e.force,measure:Array.isArray(e.measure)?e.measure:[],metricBelow:typeof e.metricBelow=="string"?e.metricBelow:void 0,metricDiff:typeof e.metricDiff=="string"?e.metricDiff:void 0}}async function ve(e,t,n,a){let o=await ne(e,ke(t,a),n);(a.addValues.length>0||a.addJsonValues.length>0||a.removeValues.length>0||t.run===!0||a.removeIndexValues.length>0)&&await p(n,o),l(o,n),(o.run_results.some(r=>r.status==="failed")||o.fail_on_skipped_triggered===!0)&&(process.exitCode=m.DEPENDENCY_FAILED)}async function xe(e,t,n){let a=c(n),o=Date.now(),r=he(t);be(t,r),t.background===!0?await we(e,t,a,r):await ve(e,t,a,r),a.profile&&d(`profile:command=test took_ms=${Date.now()-o}`)}function A(e){let t=s(e,"author"),n=s(e,"assignee");if(t!==void 0&&n!==void 0&&t!==n)throw new b("Lifecycle ownership received conflicting --author and --assignee values; use one actor value for both aliases.",m.USAGE,{code:"conflicting_lifecycle_owner",examples:["pm claim pm-123","pm start-task pm-123","pm release pm-123"]});return{author:t??n,message:s(e,"message")}}async function Ae(e,t){let n=c(t),a=Date.now();if(e.background===!0){let i=await E({kind:"test-all",commandArgs:F(e),statusFilter:s(e,"status"),noExtensions:n.noExtensions===!0},n);l(i,n),n.profile&&d(`profile:command=test-all took_ms=${Date.now()-a}`);return}let r=await ae({status:s(e,"status"),limit:s(e,"limit"),offset:s(e,"offset"),timeout:s(e,"timeout"),progress:!!e.progress,envSet:Array.isArray(e.envSet)?e.envSet:[],envClear:Array.isArray(e.envClear)?e.envClear:[],sharedHostSafe:!!e.sharedHostSafe,pmContext:s(e,"pmContext"),overrideLinkedPmContext:!!e.overrideLinkedPmContext,failOnContextMismatch:!!e.failOnContextMismatch,failOnSkipped:!!e.failOnSkipped,failOnEmptyTestRun:!!e.failOnEmptyTestRun,requireAssertionsForPm:!!e.requireAssertionsForPm,checkContext:!!e.checkContext,autoPmContext:!!e.autoPmContext},n);await p(n,{ids:r.results.map(i=>i.id)}),l(r,n),(r.failed>0||r.fail_on_skipped_triggered===!0)&&(process.exitCode=m.DEPENDENCY_FAILED),n.profile&&d(`profile:command=test-all took_ms=${Date.now()-a}`)}async function _e(e,t,n,a){let o=c(a),r=Date.now(),i=await te({subcommand:ge(e,t),limit:s(n,"limit")},o);l(i,o),o.profile&&d(`profile:command=telemetry took_ms=${Date.now()-r}`)}async function Ie(e,t){let n=c(t),a=Date.now(),o=se(s(e,"analytics")),r=await Z(n,{includeEmpty:e.includeEmpty===!0,storage:e.storage===!0,metadataCoverage:e.metadataCoverage===!0,byAssignee:e.byAssignee===!0,byTag:e.byTag===!0,byPriority:e.byPriority===!0,tagPrefix:s(e,"tagPrefix"),fieldUtilization:e.fieldUtilization===!0,...o});r.recorded_observations?.some(i=>i.changed)===!0&&await p(n,{ids:r.recorded_observations?.flatMap(i=>i.observation.item_id?[i.observation.item_id]:[])}),l(r,n),n.profile&&d(`profile:command=stats took_ms=${Date.now()-a}`)}async function De(e,t){let n=c(t),a=Date.now(),o=s(e,"threshold"),r=s(e,"limit"),i=await ee(n,{status:Array.isArray(e.status)&&e.status.length>0?e.status:void 0,since:s(e,"since"),...o===void 0?{}:{threshold:Number(o)},...r===void 0?{}:{limit:Number(r)}});l(i,n),n.profile&&d(`profile:command=duplicates took_ms=${Date.now()-a}`)}async function Se(e,t){let n=c(t),a=Date.now(),o=await L(n,{strictDirectories:!!e.strictDirectories,requireMergeDrivers:!!e.requireMergeDrivers,checkOnly:!!e.checkOnly,checkTelemetry:!!e.checkTelemetry,noRefresh:!!e.noRefresh,refreshVectors:!!e.refreshVectors,verboseStaleItems:!!e.verboseStaleItems,verboseAuthorEvents:!!e.verboseAuthorEvents,brief:!!e.brief,summary:!!e.summary,skipVectors:!!e.skipVectors,skipIntegrity:!!e.skipIntegrity,skipDrift:!!e.skipDrift,full:!!e.full});l(o,n),(e.strictExit||e.failOnWarn)&&!o.ok&&(C({...o,exit_code:m.GENERIC_FAILURE,error_code:"health_findings",error_category:"validation",command_resolution:"health_findings",resolution_stage:"execute"}),process.exitCode=m.GENERIC_FAILURE),n.profile&&d(`profile:command=health took_ms=${Date.now()-a}`)}async function Ce(e,t){let n=c(t),a=Date.now(),o=await le({checkMetadata:!!e.checkMetadata,metadataProfile:s(e,"metadataProfile"),checkResolution:!!e.checkResolution,checkLifecycle:!!e.checkLifecycle,checkStaleBlockers:!!e.checkStaleBlockers,dependencyCycleSeverity:s(e,"dependencyCycleSeverity"),parentCycleSeverity:s(e,"parentCycleSeverity"),checkFiles:!!e.checkFiles,checkCommandReferences:!!e.checkCommandReferences,scanMode:s(e,"scanMode"),includePmInternals:!!e.includePmInternals,verboseFileLists:!!e.verboseFileLists,verboseDiagnostics:!!e.verboseDiagnostics,allAffectedIds:!!e.allAffectedIds,checkHistoryDrift:!!e.checkHistoryDrift,checkStorageIntegrity:!!e.checkStorageIntegrity,fixHints:!!e.fixHints,autoFix:!!e.autoFix,dryRun:!!e.dryRun,fixScope:Array.isArray(e.fixScope)?e.fixScope:void 0,pruneMissing:!!e.pruneMissing,counts:!!e.counts,full:!!e.full},n);l(o,n),(e.strictExit||e.failOnWarn)&&(o.has_warnings||!o.ok)&&(C({...o,exit_code:m.GENERIC_FAILURE,error_code:"validation_findings",error_category:"validation",command_resolution:"validation_findings",resolution_stage:"execute"}),process.exitCode=m.GENERIC_FAILURE),n.profile&&d(`profile:command=validate took_ms=${Date.now()-a}`)}async function Re(e,t){let n=c(t),a=Date.now(),o=await q(n,{dryRun:e.dryRun===!0,scope:Array.isArray(e.scope)?e.scope:[]});l(o,n),n.profile&&d(`profile:command=gc took_ms=${Date.now()-a}`)}async function Be(e,t,n,a){let o=c(a),r=_(process.cwd(),o.path),i=e.trim().toLowerCase();if(!["create","list","inspect","restore","delete"].includes(i))throw S({command_path:"workspace snapshot",token:e,allowed:["create","list","inspect","restore","delete"],display_name:"workspace snapshot",token_kind:"action",examples:["pm workspace snapshot create before-migration","pm workspace snapshot restore before-migration"]});if(i==="list"){l(await W(r),o);return}if(i==="create"){l(await G(r,t===void 0?{}:{name:t}),o);return}if(t===void 0)throw new b(`pm workspace snapshot ${i} requires a snapshot name or fingerprint`,m.USAGE);if(i==="inspect"){l(await j(r,t),o);return}if(i==="restore"){if(n.dryRun===!0){l(await Y(r,t),o);return}let u=await I(r);l(await K(r,t,{force:n.force===!0,author:O(s(n,"author"),u.author_default),message:s(n,"message"),lockTtlSeconds:u.locks.ttl_seconds,lockWaitMs:u.locks.wait_ms}),o);return}l(await X(r,t),o)}async function Ee(e,t){let n=c(t),a=Date.now(),o=await Q({action:s(e,"action"),command:s(e,"command"),summary:!!e.summary,schemaOnly:!!e.schemaOnly,flagsOnly:!!e.flagsOnly,availabilityOnly:!!e.availabilityOnly,runtimeOnly:!!e.runtimeOnly||!!e.activeOnly,full:!!e.full},n);l(o,n),n.profile&&d(`profile:command=contracts took_ms=${Date.now()-a}`)}async function Te(e,t,n){let a=c(n),o=Date.now(),r={...A(t),ifAvailable:t.ifAvailable===!0,maxAttempts:t.maxAttempts};Oe(e,t.next===!0);let i=t.next===!0?await $(!!t.force,a,r,{type:typeof t.type=="string"?t.type:void 0,tag:typeof t.tag=="string"?t.tag:void 0,priority:t.priority,assigneeFilter:typeof t.assigneeFilter=="string"?t.assigneeFilter:void 0,parent:typeof t.parent=="string"?t.parent:void 0,sprint:typeof t.sprint=="string"?t.sprint:void 0,release:typeof t.release=="string"?t.release:void 0,includeDecisions:t.includeDecisions===!0,tokenBudget:t.tokenBudget??t.token_budget,explainRanking:t.explainRanking===!0||t.explain_ranking===!0}):await B(e,!!t.force,a,r);await p(a,i),l(i,a),a.profile&&d(`profile:command=claim took_ms=${Date.now()-o}`)}function Oe(e,t){if(!t&&!e)throw new b("Specify an item id or pass --next",m.USAGE);if(t&&e)throw new b("Specify either an item id or --next, not both",m.USAGE)}async function Pe(e,t,n){let a=c(n),o=Date.now(),r=await D(e,!!t.force,a,{...A(t),ownershipReleaseBypass:t.ownershipReleaseBypass===!0});await p(a,r),l(await P("release",[e],t,a,r),a),a.profile&&d(`profile:command=release took_ms=${Date.now()-o}`)}async function Me(e,t,n){let a=c(n),o=Date.now(),r=_(process.cwd(),a.path),i=await I(r),u=R(i.schema),g=oe(u),f=!!t.force,h=A(t),v=await B(e,f,a,h);await p(a,v);let T=await x(e,{...h,status:g,force:f},a);await p(a,T),l({id:e,action:"start_task",claim:v,update:T},a),a.profile&&d(`profile:command=start-task took_ms=${Date.now()-o}`)}async function Fe(e,t,n){let a=c(n),o=Date.now(),r=_(process.cwd(),a.path),i=await I(r),u=R(i.schema),g=!!t.force,f=A(t),h=await x(e,{...f,status:u.open_status,force:g},a);await p(a,h);let v=await D(e,g,a,f);await p(a,v),l({id:e,action:"pause_task",update:h,release:v},a),a.profile&&d(`profile:command=pause-task took_ms=${Date.now()-o}`)}async function Le(e,t,n,a){let o=c(a),r=Date.now(),i=!!n.force,u=A(n),g=await U(e,t,{...u,validateClose:s(n,"validateClose"),force:i},o);await p(o,g);let f=await D(e,i,o,u);await p(o,f),l({id:e,action:"close_task",close:g,release:f},o),o.profile&&d(`profile:command=close-task took_ms=${Date.now()-r}`)}function de(e){return e.option("--background","Run linked tests in managed background mode").option("--timeout <seconds>","Default run timeout in seconds").option("--progress","Emit linked-test progress to stderr (always shown in TTY, opt-in for non-TTY)").option("--env-set <value>","Set environment variable(s) for linked-test runs (KEY=VALUE, repeatable)",w).option("--env-clear <value>","Clear environment variable(s) for linked-test runs (NAME, repeatable)",w).option("--shared-host-safe","Apply additive shared-host-safe runtime defaults for linked-test runs").option("--pm-context <mode>","PM linked-test context mode: schema|tracker|auto (default: schema)").option("--override-linked-pm-context","Force run-level --pm-context to override per-linked-test pm_context_mode metadata").option("--fail-on-context-mismatch","Fail linked PM commands when context item counts differ").option("--fail-on-skipped","Treat skipped linked tests as dependency failures").option("--fail-on-empty-test-run","Treat successful linked-test commands that report zero executed tests as failures").option("--require-assertions-for-pm","Require assertion metadata for linked PM command tests").option("--check-context","Preflight linked PM command context diagnostics before executing commands").option("--auto-pm-context","Auto-remediate PM tracker-read context mismatches by routing those linked commands through tracker context")}function Lt(e){ce(e);let t=e.command("test").argument("<id>","Item id").option("--add <value>","Add linked test entry (CSV/markdown pairs or - for stdin)",w).option("--add-json <value>","Add linked test entry from JSON object/array (or - for stdin)",w).option("--remove <value>","Remove linked test entry by exact command/path (command=<value> and path=<value> preserve commas and equals signs; or - for stdin)",w).option("--remove-index <n>","Remove the 1-based linked-test index from --list order (repeatable)",w).option("--list","List linked tests without mutating").option("--run","Run linked test commands").option("--match <value>","Run only linked tests whose command/path contains this substring").option("--only-index <n>","Run only the 1-based linked-test index from --list order").option("--only-last","Run only the most recently added linked test");de(t).option("--measure <value>","Record name=value[,unit=...][,threshold=...] evidence; repeatable",w).option("--metric-below <value>","Return evidence below name=value").option("--metric-diff <name>","Diff the latest two values").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").description("Manage tests linked to an item and optionally run them.").action(xe);let n=e.command("test-all").description("Run linked tests across matching items.").option("--status <value>","Filter items by status before running tests").option("--limit <n>","Limit matching items before running linked tests").option("--offset <n>","Skip matching items before running linked tests");de(n).action(Ae),e.command("test-runs-worker",{hidden:!0}).argument("<runId>","Background run id").description("Internal background worker command.").action(async(g,f,h)=>{let v=c(h);await re(g,v)}),e.command("telemetry").argument("[namespaceOrSubcommand]","Telemetry subcommand: status, flush, stats, clear (default: status)").argument("[subcommand]","Compatibility alias target for local-analytics: status, flush, stats, clear").option("--limit <n>","Maximum command groups returned by telemetry stats").description("Inspect and manage local telemetry queue/runtime state.").action(_e),e.command("duplicates").description("Find existing duplicate clusters across all statuses without creating an item.").option("--status <value>","Lifecycle status to include (repeatable or comma-separated)",w,[]).option("--since <value>","Only inspect items created at or after this time").option("--threshold <value>","Minimum similarity score from 0 through 1").option("--limit <n>","Maximum duplicate clusters to return").action(De),e.command("stats").description("Show project tracker statistics.").option("--include-empty","Restore zero-count registered item-type and lifecycle-status buckets").option("--storage","Include aggregate history-stream storage metrics (total streams/lines/bytes, largest + deepest streams, oldest/newest entries)").option("--metadata-coverage","Include metadata coverage % (acceptance_criteria, estimated_minutes, resolution, tags, parent) overall and by type").option("--by-assignee","Include a lifecycle-bucketed item breakdown grouped by assignee").option("--by-tag","Include a lifecycle-bucketed item breakdown grouped by tag").option("--by-priority","Include a lifecycle-bucketed item breakdown grouped by priority").option("--tag-prefix <value>","With --by-tag: only count tags starting with this prefix (e.g. domain:)").option("--field-utilization","Report content-field utilization rates (notes/learnings/files/docs/tests/comments/deps/body) for governance analysis").option("--analytics <json>","Improvement ledger/history analytics JSON").action(Ie),e.command("health").description("Show project tracker health checks.").option("--strict-directories","Treat optional item-type directories as required failures").option("--require-merge-drivers","Treat absent clone-local merge drivers as a required health failure").option("--check-only","Run read-only health diagnostics without refreshing vectors").option("--check-telemetry","Probe telemetry endpoint health and include network diagnostics").option("--no-refresh","Disable automatic vector refresh attempts during health checks").option("--refresh-vectors","Explicitly enable vector refresh attempts during health checks").option("--verbose-stale-items","Include full stale vectorization ID lists in health output").option("--verbose-author-events","Include every actionable unknown-author event coordinate for review or disposition").option("--brief","Emit compact health details for low-token agent checks").option("--summary","Emit one-line-style health status with check names and warning count").option("--skip-vectors","Skip vectorization check for a faster run").option("--skip-integrity","Skip item/history file integrity check for a faster run").option("--skip-drift","Skip history drift hash check for a faster run").option("--full","Run all checks including slow integrity, drift, and vectorization checks").option("--strict-exit","Return non-zero exit when health is not ok (advisory telemetry warnings are excluded; see warnings[])").option("--fail-on-warn","Alias for --strict-exit").action(Se),e.command("validate").description("Run standalone metadata, resolution, lifecycle, files, linked-command reference, and history drift validation checks.").option("--check-metadata","Run metadata completeness checks").option("--metadata-profile <value>","Select metadata validation profile for --check-metadata (core|strict|custom)").option("--check-resolution","Run closed-item resolution metadata checks").option("--check-lifecycle","Run active-item lifecycle governance drift checks").option("--check-stale-blockers","Include stale blocker-pattern diagnostics in lifecycle checks").option("--dependency-cycle-severity <value>","Set dependency-cycle warning policy for lifecycle checks (off|warn|error)").option("--parent-cycle-severity <value>","Set parent-hierarchy cycle warning policy for lifecycle checks (off|warn|error)").option("--check-files","Run linked-file and orphaned-file checks").option("--check-command-references","Run linked-command PM-ID reference checks").option("--scan-mode <value>","Select file candidate scan mode for --check-files (default|tracked-all|tracked-all-strict)").option("--include-pm-internals","Include PM storage internals in tracked-all candidate scans").option("--verbose-file-lists","Include full file-path lists for validate --check-files details").option("--verbose-diagnostics","Include full validate diagnostic ID lists instead of compact summaries").option("--all-affected-ids","Emit complete missing_* affected-ID lists with no truncation (implied by --json)").option("--strict-exit","Return non-zero exit when validation warnings are present").option("--fail-on-warn","Alias for --strict-exit").option("--fix-hints","Add a machine-executable fix_hints[] of pm commands to each failing check's details").option("--auto-fix","Apply the safe, deterministic subset of fix-hint remediations (field backfills) automatically").option("--dry-run","Preview planned --auto-fix/--prune-missing fixes without applying them").option("--fix-scope <scope>","Grant --auto-fix scopes (metadata, resolution, lifecycle; comma-separated or repeatable). Default: metadata, resolution; lifecycle must be named explicitly",w).option("--prune-missing","Remove stale linked-file/doc LINKS whose paths classified as deleted (never touches real files)").option("--check-history-drift","Run item/history hash drift checks").option("--check-storage-integrity","Run the post-merge storage-integrity check (unreadable items, history conflict markers, resurrected deletes, unparseable config/schema)").option("--counts","Keep validation counts and totals while omitting per-item diagnostic arrays").option("--full","Return the complete validation diagnostic projection").action(Ce),e.command("gc").option("--dry-run","Preview cleanup targets without deleting files; without this flag, pm gc deletes matched artifacts").option("--scope <value>","Limit cleanup to one or more scopes (comma-separated or repeatable): index, embeddings, runtime, locks, checkpoints, transactions",w).description("Delete optional cache artifacts by default (including expired lock debris) and show a summary.").action(Re),e.command("workspace").description("Manage portable workspace-level SDK primitives.").command("snapshot").argument("<action>","Snapshot action: create, list, inspect, restore, delete").argument("[target]","Optional name for create; name or fingerprint otherwise").description("Create, inspect, list, restore, or delete content-addressed tracker snapshots.").option("--dry-run","Preview restore file, item, stream, and history-entry impact without mutating state").option("--force","Explicitly confirm a whole-workspace snapshot restore").option("--author <value>","Actor recorded on the restore audit event").option("--message <value>","Human-readable restore rationale").action(Be),e.command("contracts").description("Show machine-readable command and schema contracts for agents.").option("--action <value>","Filter tool schema branches to a specific action").option("--command <value>","Scope contracts output to one CLI command (narrow-by-default)").option("--summary","Return one command+intent row per top-level command for cheap agent bootstrap").option("--schema-only","Return schema-focused output only").option("--flags-only","Return command flag contracts only").option("--availability-only","Return action availability surface only").option("--runtime-only","Include only actions invocable in the current runtime").option("--active-only","Alias for --runtime-only").option("--full","Include full schema and command-flag surfaces (large; default brief output omits heavy sections for unfiltered queries)").action(Ee);let a=e.command("claim").argument("[id]","Item id (omit with --next)").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force claim override").option("--if-available","Skip silently when the item is already claimed by another author (returns skipped=true)").option("--next","Atomically claim the next caller-available actionable item").option("--type <value>","Filter --next candidates by type").option("--tag <value>","Filter --next candidates by tag").option("--priority <value>","Filter --next candidates by priority").option("--assignee-filter <value>","Filter --next candidates: assigned|unassigned").option("--parent <id>","Scope --next candidates to a subtree").option("--sprint <value>","Filter --next candidates by sprint").option("--release <value>","Filter --next candidates by release").option("--max-attempts <n>","Bound the --next candidate walk (default 10; maximum 100)").option("--include-decisions","Allow --next to claim human-gated Decision items").option("--token-budget <n>","Bound the estimated tokens used to rank --next candidates").option("--explain-ranking","Include ranking provenance for --next selection").description("Claim an item for active work.").action(Te);k(a,"--assignee <value>","Alias for --author on lifecycle ownership commands"),k(a,"--token_budget <n>","Alias for --token-budget"),k(a,"--explain_ranking","Alias for --explain-ranking");let o=e.command("release").argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force release override").description("Release an item's active claim.").action(Pe);k(o,"--assignee <value>","Alias for --author on lifecycle ownership commands");let r=e.command("start-task").argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership or terminal override when required").description("Lifecycle alias: claim an item and move it to in_progress.").action(Me);k(r,"--assignee <value>","Alias for --author on lifecycle ownership commands");let i=e.command("pause-task").argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override when required").description("Lifecycle alias: move an item to open and release its claim.").action(Fe);k(i,"--assignee <value>","Alias for --author on lifecycle ownership commands");let u=e.command("close-task").argument("<id>","Item id").argument("[reason]","Close reason text").option("--author <value>","Mutation author").option("--message <value>","History message").option("--validate-close <value>","Close-time validation mode: off|warn|strict").option("--force","Force ownership or terminal override when required").description("Lifecycle alias: close an item and release assignment metadata.").action(Le);k(u,"--assignee <value>","Alias for --author on lifecycle ownership commands"),Ve(e)}function y(e){return typeof e=="string"?e:void 0}function ue(e){return{parent:y(e.parent),allowMissingParent:e.allowMissingParent===!0?!0:void 0,tags:y(e.tags),priority:y(e.priority),body:y(e.body),description:y(e.description),author:y(e.author),message:y(e.message)}}function Ve(e){for(let{name:t,describe:n}of[{name:"meet",describe:"Shortcut: create a Meeting with a start time and duration."},{name:"event",describe:"Shortcut: create an Event with a start time and duration."}])e.command(t).argument("<title>","Item title").option("--start <when>","Start time (ISO, 'now', or relative like +1h/+2d); defaults to now").option("--duration <span>","Duration from start (relative like 1h/2d); defaults to 1h when --end is omitted").option("--end <when>","End time (ISO or relative); overrides --duration").option("--location <value>","Location").option("--timezone <value>","IANA timezone (for example America/New_York)").option("--all-day","Mark as an all-day event").option("--parent <id>","Parent item id").option("--allow-missing-parent","Permit a parent id that does not exist yet").option("--tags <list>","Comma-separated tags").option("--priority <value>","Priority").option("--body <text>","Body/markdown content").option("--description <text>","Short description").option("--author <value>","Mutation author").option("--message <value>","History message").description(n).action(async(a,o,r)=>{let i=c(r),u=Date.now(),f=await(t==="meet"?H:J)(a,{...ue(o),start:y(o.start),duration:y(o.duration),end:y(o.end),location:y(o.location),timezone:y(o.timezone),allDay:o.allDay===!0?!0:void 0},i);await p(i,f),l(f,i),i.profile&&d(`profile:command=${t} took_ms=${Date.now()-u}`)});e.command("remind").argument("<title>","Item title").option("--at <when>","Reminder time (ISO, 'now', or relative like +2d); defaults to +1d").option("--text <value>","Reminder text; defaults to the title").option("--parent <id>","Parent item id").option("--allow-missing-parent","Permit a parent id that does not exist yet").option("--tags <list>","Comma-separated tags").option("--priority <value>","Priority").option("--body <text>","Body/markdown content").option("--description <text>","Short description").option("--author <value>","Mutation author").option("--message <value>","History message").description("Shortcut: create a Reminder from a single point in time.").action(async(t,n,a)=>{let o=c(a),r=Date.now(),i=await z(t,{...ue(n),at:y(n.at),text:y(n.text)},o);await p(o,i),l(i,o),o.profile&&d(`profile:command=remind took_ms=${Date.now()-r}`)})}export{Lt as registerOperationCommands,Oe as requireClaimTarget};
|
|
2
|
+
//# sourceMappingURL=register-operations-4R6I7CPY.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as R,f as O}from"./chunk-WLAHPSOX.js";import{Aa as U,Ka as C,Oa as j,Qa as T,xa as I}from"./chunk-KOQMGCTA.js";import"./chunk-WYRZZ5ZE.js";import{B as d,D as b,hl as v,kl as E,tf as S,vf as _,wf as y}from"./chunk-KIKDWECH.js";import A from"node:fs/promises";import L from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="054789eb-fabe-5042-8166-19961f30ebf1")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3e4ba524-10cf-58e7-81ea-f48f30ca1250")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="defd826a-ac9b-54e4-b2a3-00d022090a10")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="4344c493-be53-584f-b25d-4b41bfee5079")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="08f5b31f-c756-577c-94e8-7b4268ba12ab")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="59c52ff5-9763-5244-bed3-146a547c3551")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d498a64c-9680-52a9-981d-4ce86949784d")}catch{}})();var z={init:"init",install:"install",uninstall:"uninstall",explore:"explore",manage:"manage",describe:"describe",reload:"reload",doctor:"doctor",catalog:"catalog",adopt:"adopt","adopt-all":"adoptAll",activate:"activate",deactivate:"deactivate",migrate:"migrate"};function H(e){let t=e.capability,o=typeof t=="string"?[t]:Array.isArray(t)?t.filter(i=>typeof i=="string"):[],a=[...new Set(o.map(i=>i.trim().toLowerCase()).filter(i=>i.length>0))];if(a.length>1)throw new b(`Multiple scaffold capabilities cannot be combined yet: ${a.join(", ")}. Choose one capability per scaffold.`,d.USAGE);return a[0]}function G(e,t,o="extension"){let a={...e};t!==void 0&&(a[z[t]]=!0);let i=(...c)=>c.some(r=>a[r]===!0),n=(...c)=>{for(let r of c)if(typeof a[r]=="string")return a[r]};return{init:i("init"),scaffold:i("scaffold"),install:i("install"),uninstall:i("uninstall"),explore:i("explore","list"),manage:i("manage"),describe:i("describe"),markdown:i("markdown"),reload:i("reload"),doctor:i("doctor"),catalog:i("catalog"),adopt:i("adopt"),adoptAll:i("adoptAll","adopt_all","adopt-all"),activate:i("activate"),deactivate:i("deactivate"),migrate:i("migrate"),project:i("project"),local:i("local"),global:i("global"),gh:n("gh"),github:n("github"),ref:n("ref"),capability:H(e),declarative:i("declarative"),fields:n("fields"),detail:n("detail"),output:n("output"),trace:i("trace"),watch:i("watch"),runtimeProbe:i("runtimeProbe","runtime_probe","runtime-probe"),fixManagedState:i("fixManagedState","fix_managed_state","fix-managed-state"),isolated:i("isolated"),ignoreGlobal:i("ignoreGlobal","ignore_global","ignore-global"),strictExit:i("strictExit","strict_exit","strict-exit"),failOnWarn:i("failOnWarn","fail_on_warn","fail-on-warn"),dryRun:i("dryRun","dry_run","dry-run"),vocabulary:o}}async function N(e){let t=(await A.readdir(process.cwd())).filter(a=>!a.startsWith(".")).sort((a,i)=>a.localeCompare(i)),o=[...e].sort((a,i)=>a.localeCompare(i));return t.length===o.length&&t.every((a,i)=>a===o[i])}async function q(e){let t=(e??[]).map(o=>o.trim()).filter(o=>o.length>0);return t.length<=1?t.length===0?void 0:t:await N(t)?["*"]:t}function P(e,t,o){let a=e.markdown===!0;if(o!==void 0&&o==="")throw new b("--output requires a non-empty file path.",d.USAGE);if(o!==void 0&&!a)throw new b("--output is only supported with --markdown describe output.",d.USAGE);if(a){if(t.json)throw new b("Cannot combine --json with --markdown.",d.USAGE);if(e.describe!==!0)throw new b("--markdown is only supported by the describe action.",d.USAGE)}}async function B(e){let t=U(e.result.details,e.vocabulary);if(e.outputPath!==void 0){let o=L.resolve(e.outputPath);await A.mkdir(L.dirname(o),{recursive:!0}),await A.writeFile(o,t,"utf8")}if(!e.globalOptions.quiet){for(let o of e.result.warnings)y(`warning: ${o}`);e.outputPath===void 0&&S(t)}}function K(e,t){let o=!!t.strictExit||!!t.failOnWarn;if(e.action!=="doctor"||!o)return;let a=e.details!==null&&typeof e.details=="object"?e.details:{},i=a.summary!==null&&typeof a.summary=="object"?a.summary:null,n=i&&typeof i.status=="string"?i.status:void 0;(e.warnings.length>0||n!==void 0&&n!=="ok")&&(process.exitCode=d.GENERIC_FAILURE)}async function p(e,t,o,a,i="extension"){let n=v(o),c=Date.now(),r=G(t,a,i),s=(typeof r.output=="string"?r.output:void 0)?.trim();P(r,n,s);let m=await C(e,r,n);r.markdown===!0?await B({result:m,vocabulary:i,outputPath:s,globalOptions:n}):_(m,n),K(m,r),m.ok===!1&&(process.exitCode=d.GENERIC_FAILURE),n.profile&&y(`profile:command=extension took_ms=${Date.now()-c}`)}function V(e){return e.details!==null&&typeof e.details=="object"?e.details:{}}function X(e){return e instanceof b?{message:e.message,exit_code:e.exitCode,...e.context}:{message:e instanceof Error?e.message:String(e),exit_code:d.GENERIC_FAILURE}}async function F(e,t,o,a){let i=await q(e);if(i===void 0||i.length<=1){await p(i?.[0],t,o,"install",a);return}let n=v(o),c=Date.now(),r=G(t,"install",a);if(P(r,n,void 0),[r.gh,r.github].some(g=>typeof g=="string"&&g.trim().length>0))throw new b("Multiple install targets cannot be combined with --gh/--github. Install one GitHub source per command, or pass multiple explicit local, bundled, or npm: targets.",d.USAGE,{code:"multi_target_github_install_ambiguous",required:"Use exactly one positional target with --gh/--github, or omit --gh/--github when installing multiple targets.",examples:["pm install --gh owner/repo","pm install npm:pm-guide-shell pm-todos"]});let s=[],m=[],w=d.GENERIC_FAILURE;for(let g of i)try{let h=await C(g,r,n),f=V(h),x=Array.isArray(h.warnings)?h.warnings:[];m.push(...x);let D=h.ok===!0;s.push({target:g,ok:D,extension:f.extension,source:f.source,destination_path:f.destination_path,activated:f.activated,settings_changed:f.settings_changed,command_paths:f.command_paths,action_paths:f.action_paths,runtime_activation_status:f.runtime_activation_status,activation_diagnostics:f.activation_diagnostics,command_discovery:f.command_discovery,verification:f.verification,warnings:x,...D?{}:{error:{message:"Extension install returned ok=false without throwing an error.",exit_code:d.GENERIC_FAILURE,code:"extension_install_soft_failed"}}})}catch(h){let f=X(h),x=f.exit_code;typeof x=="number"&&w===d.GENERIC_FAILURE&&x!==d.GENERIC_FAILURE&&(w=x),s.push({target:g,ok:!1,error:f})}let k=s.filter(g=>g.ok!==!0).length,M={ok:k===0,action:"install",scope:r.global===!0?"global":"project",installed_count:s.length-k,failed_count:k,targets:s,warnings:[...new Set(m)].sort((g,h)=>g.localeCompare(h))};_(M,n),k>0&&(process.exitCode=w),n.profile&&y(`profile:command=extension took_ms=${Date.now()-c}`)}function Y(e){return e.option("--project","Use project extension scope (default)").option("--local","Alias for --project").option("--global","Use global extension scope")}function $(e){return e.option("--project","Use project package scope (default)").option("--local","Alias for --project").option("--global","Use global package scope")}function u(e,t){return t==="package"?$(e):Y(e)}function W(e,t){let o=t==="package"?"package":"extension",a=t==="package"?"packages":"extensions",i=t,n=e.command(i).argument("[target]",`${o[0].toUpperCase()}${o.slice(1)} source/name or scaffold target path (for --init/--scaffold)`).option("--init",`Generate a starter ${o} scaffold at target path`).option("--scaffold","Alias for --init").option("--capability <kind>",`Capability the --init starter targets (${I.join("|")}; default commands)`,E).option("--install",`Install ${o} from local path, bundled alias, npm: source, wildcard, or GitHub source`).option("--uninstall",`Uninstall an installed ${o}`).option("--explore",`List discovered ${a} in selected scope`).option("--list","Alias for --explore").option("--manage",`List managed ${a} with update-check metadata`).option("--describe",`Map every surface a loaded ${o} registers (optionally one by name)`).option("--markdown","Render describe output as a Markdown reference document (describe only)").option("--output <path>","Write describe Markdown to a file (requires --markdown)").option("--reload",`Reload ${a} with cache-busted module imports`).option("--watch","Use watch mode with --reload").option("--doctor",`Run consolidated ${o} diagnostics (summary/deep modes)`).option("--catalog",`List bundled first-party ${o} catalog metadata`).option("--adopt",`Adopt an existing unmanaged ${o} into managed metadata`).option("--adopt-all",`Adopt all unmanaged ${a} into managed metadata`).option("--activate",`Activate a ${o} in selected scope settings`).option("--deactivate",`Deactivate a ${o} in selected scope settings`).option("--project",`Use project ${o} scope (default)`).option("--local","Alias for --project").option("--global",`Use global ${o} scope`).option("--gh <github-source>","Install from GitHub shorthand source (owner/repo[/path])").option("--github <github-source>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub install sources").option("--detail <mode>",`${o[0].toUpperCase()}${o.slice(1)} diagnostics detail mode (summary|deep)`).option("--trace","Include actionable registration traces in doctor deep diagnostics").option("--runtime-probe","Opt-in runtime activation probe for manage output parity").option("--fix-managed-state",`Adopt unmanaged ${a} before diagnostics/update checks`).option("--isolated",`Run doctor against project-scope ${a} only, ignoring global registrations`).option("--ignore-global","Alias for --isolated").option("--strict-exit","Return non-zero exit when doctor warnings are present (ok=false)").option("--fail-on-warn","Alias for --strict-exit (doctor)").description(t==="package"?"Manage package lifecycle operations for project or global scope. Backward-compatible with extension packages.":"Manage extension lifecycle operations for project or global scope.").action(async(r,l,s)=>{await p(r,s.optsWithGlobals(),s,void 0,t)});t==="package"&&(n.alias("packages"),n.option("--declarative","Scaffold the composeExtension blueprint starter (any capability)"));let c=n.command("init").alias("scaffold").argument("<target>","Scaffold target directory path").option("--capability <kind>",`Capability the starter targets (${I.join("|")}; default commands)`,E).description(t==="package"?"Generate a starter package scaffold with package metadata, manifest, and entrypoint.":"Generate a starter extension scaffold with manifest and entrypoint.");t==="package"&&c.option("--declarative","Scaffold the composeExtension blueprint starter (any capability)"),u(c,t).action(async(r,l,s)=>{await p(r,s.optsWithGlobals(),s,"init",t)}),u(n.command("install").argument("[targets...]",`${o[0].toUpperCase()}${o.slice(1)} source (local path, bundled alias, npm: source, wildcard, or GitHub source)`).option("--gh <github-source>","Install from GitHub shorthand source (owner/repo[/path])").option("--github <github-source>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub install sources").description(`Install ${o} from local path, bundled alias, npm: source, wildcard, or GitHub source.`),t).action(async(r,l,s)=>{await F(r,s.optsWithGlobals(),s,t)}),u(n.command("uninstall").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Uninstall an installed ${o}.`),t).action(async(r,l,s)=>{await p(r,s.optsWithGlobals(),s,"uninstall",t)}),u(n.command("explore").description(`List discovered ${a} in selected scope.`),t).action(async(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"explore",t)}),u(n.command("manage").option("--runtime-probe","Opt-in runtime activation probe for manage output parity").option("--fix-managed-state",`Adopt unmanaged ${a} before diagnostics/update checks`).description(`List managed ${a} with update-check metadata.`),t).action(async(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"manage",t)}),u(n.command("describe").argument("[target]",`${o[0].toUpperCase()}${o.slice(1)} name to describe (omit for every loaded ${o})`).option("--markdown","Render the surface map as a Markdown reference document instead of toon/json").option("--output <path>","Write Markdown output to a file (requires --markdown)").description(`Map every surface a loaded ${o} registers (commands, hooks, item types, providers, overrides, ...).`),t).action(async(r,l,s)=>{await p(r,s.optsWithGlobals(),s,"describe",t)}),u(n.command("reload").option("--watch","Use watch mode for repeated reload checks").description(`Reload ${a} with cache-busted module imports.`),t).action(async(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"reload",t)}),u(n.command("doctor").option("--detail <mode>",`Detail mode for ${o} diagnostics (summary|deep)`).option("--trace","Include actionable registration traces in doctor deep diagnostics").option("--fix-managed-state",`Adopt unmanaged ${a} before diagnostics/update checks`).option("--isolated",`Run doctor against project-scope ${a} only, ignoring global registrations`).option("--ignore-global","Alias for --isolated").option("--strict-exit","Return non-zero exit when doctor warnings are present (ok=false)").option("--fail-on-warn","Alias for --strict-exit (doctor)").description(`Run consolidated ${o} diagnostics (summary/deep modes).`),t).action(async(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"doctor",t)}),u(n.command("catalog").alias("list").option("--fields <value>","Render compact comma-separated catalog fields, for example: alias,installed,install_command").description(`List bundled first-party ${o} catalog metadata.`),t).action(async(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"catalog",t)}),u(n.command("adopt").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).option("--gh <owner/repo[/path]>",`GitHub provenance shorthand for adopted ${o}`).option("--github <owner/repo[/path]>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub shorthand source").description(`Adopt an existing unmanaged ${o} into managed metadata.`),t).action(async(r,l,s)=>{await p(r,s.optsWithGlobals(),s,"adopt",t)}),u(n.command("adopt-all").description(`Adopt all unmanaged ${a} into managed metadata.`),t).action(async(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"adopt-all",t)}),u(n.command("migrate").option("--dry-run","Plan active migrations without invoking extension code").description(`Plan or apply active ${o} migrations with durable receipts.`),t).action(async(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"migrate",t)}),u(n.command("activate").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Activate a ${o} in selected scope settings.`),t).action(async(r,l,s)=>{await p(r,s.optsWithGlobals(),s,"activate",t)}),u(n.command("deactivate").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Deactivate a ${o} in selected scope settings.`),t).action(async(r,l,s)=>{await p(r,s.optsWithGlobals(),s,"deactivate",t)})}async function J(e,t,o){let a=v(o),i=Date.now(),n=await T(e,a,{idPrefix:typeof t.idPrefix=="string"?t.idPrefix:void 0,preset:typeof t.preset=="string"?t.preset:void 0,defaults:t.defaults===!0||t.yes===!0,author:typeof t.author=="string"?t.author:void 0,agentGuidance:typeof t.agentGuidance=="string"?t.agentGuidance:void 0,typePreset:typeof t.typePreset=="string"?t.typePreset:void 0,withPackages:t.withPackages===!0,mergeFence:t.mergeFence!==!1,force:t.force===!0,workspace:typeof t.workspace=="string"?t.workspace:void 0}),r=t.verbose===!0||a.json===!0;_(r?n:j(n),a),a.profile&&y(`profile:command=init took_ms=${Date.now()-i}`)}function Q(e,t,o,a){let n=e!==void 0&&new Set(["get","set","list","export"]).has(e);return{resolvedScope:n?"project":e??"project",resolvedAction:n?e:t??"list",resolvedKey:n?t:o,resolvedValue:n?o:a}}function Z(e){return{criterion:Array.isArray(e.criterion)?e.criterion:[],format:typeof e.format=="string"?e.format:void 0,policy:typeof e.policy=="string"?e.policy:void 0,value:typeof e.value=="string"?e.value:void 0,clearCriteria:e.clearCriteria===!0,defaultDepth:typeof e.defaultDepth=="string"?e.defaultDepth:void 0,activityLimit:typeof e.activityLimit=="string"?e.activityLimit:void 0,staleThresholdDays:typeof e.staleThresholdDays=="string"?e.staleThresholdDays:void 0,sectionHierarchy:typeof e.sectionHierarchy=="string"?e.sectionHierarchy:void 0,sectionActivity:typeof e.sectionActivity=="string"?e.sectionActivity:void 0,sectionProgress:typeof e.sectionProgress=="string"?e.sectionProgress:void 0,sectionBlockers:typeof e.sectionBlockers=="string"?e.sectionBlockers:void 0,sectionFiles:typeof e.sectionFiles=="string"?e.sectionFiles:void 0,sectionWorkload:typeof e.sectionWorkload=="string"?e.sectionWorkload:void 0,sectionStaleness:typeof e.sectionStaleness=="string"?e.sectionStaleness:void 0,sectionTests:typeof e.sectionTests=="string"?e.sectionTests:void 0}}async function ee(e,t,o,a,i,n){let c=v(n),r=Date.now(),{resolvedScope:l,resolvedAction:s,resolvedKey:m,resolvedValue:w}=Q(e,t,o,a),k=await O(l,s,m,Z(i),c,typeof w=="string"?w:void 0);_(k,c),c.profile&&y(`profile:command=config took_ms=${Date.now()-r}`)}var ve={normalizeExtensionOptions:G};function Ee(e){e.command("init").argument("[prefix-or-path]","Optional id prefix, or path-like tracker target such as ./pm-sandbox").option("--prefix, --id-prefix <value>","Set the item ID prefix (alias for the positional prefix)").option("--preset <value>","Governance preset for new setups: minimal|default|strict").option("--defaults","Use non-interactive setup defaults without opening the wizard").option("-y, --yes","Alias for --defaults (non-interactive setup)").option("--author <value>","Set the default mutation author for this project").option("--agent-guidance <mode>","Agent guidance mode: ask|add|skip|status").option("--type-preset <name>","Register domain item types during init: agile|ops|research").option("--with-packages","Install all bundled first-party packages during initialization").option("--no-merge-fence","Skip automatic merge-driver installation for a fresh Git-backed tracker").option("--workspace <dir>","Initialize repository-local tracker storage at <dir>/.agents/pm").option("--force","Allow initializing tracker files directly in a directory that looks like a workspace root").option("--verbose","Include the full resolved settings tree in the output (default output is a concise summary)").description("Initialize pm storage and defaults for the current workspace or a path-like tracker target.").action(async(t,o,a)=>{await J(t,o,a)}),e.command("config").argument("[scope]","Config scope: project|global, or action shorthand list|export|get|set for project scope").argument("[action]","Config action: get|set|list|export").argument("[key]","Config key for get|set; use `pm config project list` for the complete typed inventory, including mutation-guard-* policies").argument("[value]",'Optional value for set: routed to the right typed flag by key (e.g. config set telemetry-tracking off, config set item-format toon, config set definition-of-done "Tests pass"). Equivalent to --policy/--format/--criterion. context keys still require --default-depth/--section-* flags.').option("--criterion <text>","Criteria value for definition-of-done, metadata-required-fields, or lifecycle pattern keys (repeatable for set)",E).option("--clear-criteria","Clear criteria-list keys for config set operations").option("--format <value>","Item format for item-format key: toon").option("--policy <value>","Policy key values: history-missing-stream-policy=auto_create|strict_error; sprint-release-format-policy=warn|strict_error; parent-reference-policy=warn|strict_error; governance-preset=minimal|default|strict|custom; governance-ownership-enforcement=none|warn|strict; governance-create-mode-default=progressive|strict; governance-close-validation-default=off|warn|strict; governance-require-close-reason=enabled|disabled; governance-parent-reference-policy=warn|strict_error; governance-metadata-validation-profile=core|strict|custom; governance-force-required-for-stale-lock=enabled|disabled; governance-duplicate-detection-mode=off|advisory|strict; test-result-tracking=enabled|disabled; telemetry-tracking=enabled|disabled").option("--value <value>","Typed nested setting value. Mutation guards: require-attributed-author=true|false, secret-guard=off|advise|block, stale-in-progress-hours=integer>=1. Kebab-case is preferred; underscore aliases remain accepted.").option("--default-depth <value>","Context default depth: brief|standard|deep").option("--activity-limit <n>","Context default activity limit").option("--stale-threshold-days <n>","Context staleness cutoff in days").option("--section-hierarchy <value>","Enable/disable context hierarchy section (true|false)").option("--section-activity <value>","Enable/disable context activity section (true|false)").option("--section-progress <value>","Enable/disable context progress section (true|false)").option("--section-blockers <value>","Enable/disable context blockers section (true|false)").option("--section-files <value>","Enable/disable context files section (true|false)").option("--section-workload <value>","Enable/disable context workload section (true|false)").option("--section-staleness <value>","Enable/disable context staleness section (true|false)").option("--section-tests <value>","Enable/disable context tests section (true|false)").description("Read or update pm settings for the current workspace or global profile.").action(async(t,o,a,i,n,c)=>{await ee(t,o,a,i,n,c)}),W(e,"extension"),W(e,"package"),$(e.command("install").argument("[targets...]","Package source (local path, bundled alias, npm: source, wildcard, or GitHub source)").option("--gh <github-source>","Install from GitHub shorthand source (owner/repo[/path])").option("--github <github-source>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub install sources").description("Install a pm package into the project package scope by default.")).action(async(t,o,a)=>{await F(t,a.optsWithGlobals(),a,"package")}),$(e.command("upgrade").argument("[target]","Optional managed package name/source to upgrade; omit to upgrade pm CLI and all managed packages").option("--dry-run","Plan CLI/package upgrades without running npm or reinstalling packages").option("--cli-only","Upgrade only the pm CLI/SDK npm package").option("--packages-only","Upgrade only managed pm packages").option("--repair","Force npm global reinstall when upgrading the pm CLI/SDK").option("--tag <value>","npm dist-tag/version for CLI and registry package upgrades").option("--package-name <value>","Override the CLI package name for self-upgrade testing").description("Upgrade the pm CLI/SDK and refresh managed installable pm packages.")).action(async(t,o,a)=>{let i=v(a),n=Date.now(),c=await R(t,a.opts(),i);_(c,i),c.ok||(process.exitCode=d.GENERIC_FAILURE),i.profile&&y(`profile:command=upgrade took_ms=${Date.now()-n}`)})}export{ve as _testOnlyRegisterSetup,Ee as registerSetupCommands};
|
|
2
|
-
//# sourceMappingURL=register-setup-
|
|
1
|
+
import{a as R,f as O}from"./chunk-FIW4P64F.js";import{Aa as U,Ka as C,Oa as j,Qa as T,xa as I}from"./chunk-XAVMOK6B.js";import"./chunk-WYRZZ5ZE.js";import{Af as S,C as d,Cf as _,Df as y,E as b,rl as v,ul as E}from"./chunk-BBOFSVAK.js";import A from"node:fs/promises";import L from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="054789eb-fabe-5042-8166-19961f30ebf1")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3e4ba524-10cf-58e7-81ea-f48f30ca1250")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="defd826a-ac9b-54e4-b2a3-00d022090a10")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="4344c493-be53-584f-b25d-4b41bfee5079")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="08f5b31f-c756-577c-94e8-7b4268ba12ab")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="59c52ff5-9763-5244-bed3-146a547c3551")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d498a64c-9680-52a9-981d-4ce86949784d")}catch{}})();var z={init:"init",install:"install",uninstall:"uninstall",explore:"explore",manage:"manage",describe:"describe",reload:"reload",doctor:"doctor",catalog:"catalog",adopt:"adopt","adopt-all":"adoptAll",activate:"activate",deactivate:"deactivate",migrate:"migrate"};function H(e){let t=e.capability,o=typeof t=="string"?[t]:Array.isArray(t)?t.filter(i=>typeof i=="string"):[],a=[...new Set(o.map(i=>i.trim().toLowerCase()).filter(i=>i.length>0))];if(a.length>1)throw new b(`Multiple scaffold capabilities cannot be combined yet: ${a.join(", ")}. Choose one capability per scaffold.`,d.USAGE);return a[0]}function G(e,t,o="extension"){let a={...e};t!==void 0&&(a[z[t]]=!0);let i=(...c)=>c.some(r=>a[r]===!0),n=(...c)=>{for(let r of c)if(typeof a[r]=="string")return a[r]};return{init:i("init"),scaffold:i("scaffold"),install:i("install"),uninstall:i("uninstall"),explore:i("explore","list"),manage:i("manage"),describe:i("describe"),markdown:i("markdown"),reload:i("reload"),doctor:i("doctor"),catalog:i("catalog"),adopt:i("adopt"),adoptAll:i("adoptAll","adopt_all","adopt-all"),activate:i("activate"),deactivate:i("deactivate"),migrate:i("migrate"),project:i("project"),local:i("local"),global:i("global"),gh:n("gh"),github:n("github"),ref:n("ref"),capability:H(e),declarative:i("declarative"),fields:n("fields"),detail:n("detail"),output:n("output"),trace:i("trace"),watch:i("watch"),runtimeProbe:i("runtimeProbe","runtime_probe","runtime-probe"),fixManagedState:i("fixManagedState","fix_managed_state","fix-managed-state"),isolated:i("isolated"),ignoreGlobal:i("ignoreGlobal","ignore_global","ignore-global"),strictExit:i("strictExit","strict_exit","strict-exit"),failOnWarn:i("failOnWarn","fail_on_warn","fail-on-warn"),dryRun:i("dryRun","dry_run","dry-run"),vocabulary:o}}async function N(e){let t=(await A.readdir(process.cwd())).filter(a=>!a.startsWith(".")).sort((a,i)=>a.localeCompare(i)),o=[...e].sort((a,i)=>a.localeCompare(i));return t.length===o.length&&t.every((a,i)=>a===o[i])}async function q(e){let t=(e??[]).map(o=>o.trim()).filter(o=>o.length>0);return t.length<=1?t.length===0?void 0:t:await N(t)?["*"]:t}function P(e,t,o){let a=e.markdown===!0;if(o!==void 0&&o==="")throw new b("--output requires a non-empty file path.",d.USAGE);if(o!==void 0&&!a)throw new b("--output is only supported with --markdown describe output.",d.USAGE);if(a){if(t.json)throw new b("Cannot combine --json with --markdown.",d.USAGE);if(e.describe!==!0)throw new b("--markdown is only supported by the describe action.",d.USAGE)}}async function B(e){let t=U(e.result.details,e.vocabulary);if(e.outputPath!==void 0){let o=L.resolve(e.outputPath);await A.mkdir(L.dirname(o),{recursive:!0}),await A.writeFile(o,t,"utf8")}if(!e.globalOptions.quiet){for(let o of e.result.warnings)y(`warning: ${o}`);e.outputPath===void 0&&S(t)}}function K(e,t){let o=!!t.strictExit||!!t.failOnWarn;if(e.action!=="doctor"||!o)return;let a=e.details!==null&&typeof e.details=="object"?e.details:{},i=a.summary!==null&&typeof a.summary=="object"?a.summary:null,n=i&&typeof i.status=="string"?i.status:void 0;(e.warnings.length>0||n!==void 0&&n!=="ok")&&(process.exitCode=d.GENERIC_FAILURE)}async function p(e,t,o,a,i="extension"){let n=v(o),c=Date.now(),r=G(t,a,i),s=(typeof r.output=="string"?r.output:void 0)?.trim();P(r,n,s);let m=await C(e,r,n);r.markdown===!0?await B({result:m,vocabulary:i,outputPath:s,globalOptions:n}):_(m,n),K(m,r),m.ok===!1&&(process.exitCode=d.GENERIC_FAILURE),n.profile&&y(`profile:command=extension took_ms=${Date.now()-c}`)}function V(e){return e.details!==null&&typeof e.details=="object"?e.details:{}}function X(e){return e instanceof b?{message:e.message,exit_code:e.exitCode,...e.context}:{message:e instanceof Error?e.message:String(e),exit_code:d.GENERIC_FAILURE}}async function F(e,t,o,a){let i=await q(e);if(i===void 0||i.length<=1){await p(i?.[0],t,o,"install",a);return}let n=v(o),c=Date.now(),r=G(t,"install",a);if(P(r,n,void 0),[r.gh,r.github].some(g=>typeof g=="string"&&g.trim().length>0))throw new b("Multiple install targets cannot be combined with --gh/--github. Install one GitHub source per command, or pass multiple explicit local, bundled, or npm: targets.",d.USAGE,{code:"multi_target_github_install_ambiguous",required:"Use exactly one positional target with --gh/--github, or omit --gh/--github when installing multiple targets.",examples:["pm install --gh owner/repo","pm install npm:pm-guide-shell pm-todos"]});let s=[],m=[],w=d.GENERIC_FAILURE;for(let g of i)try{let h=await C(g,r,n),f=V(h),x=Array.isArray(h.warnings)?h.warnings:[];m.push(...x);let D=h.ok===!0;s.push({target:g,ok:D,extension:f.extension,source:f.source,destination_path:f.destination_path,activated:f.activated,settings_changed:f.settings_changed,command_paths:f.command_paths,action_paths:f.action_paths,runtime_activation_status:f.runtime_activation_status,activation_diagnostics:f.activation_diagnostics,command_discovery:f.command_discovery,verification:f.verification,warnings:x,...D?{}:{error:{message:"Extension install returned ok=false without throwing an error.",exit_code:d.GENERIC_FAILURE,code:"extension_install_soft_failed"}}})}catch(h){let f=X(h),x=f.exit_code;typeof x=="number"&&w===d.GENERIC_FAILURE&&x!==d.GENERIC_FAILURE&&(w=x),s.push({target:g,ok:!1,error:f})}let k=s.filter(g=>g.ok!==!0).length,M={ok:k===0,action:"install",scope:r.global===!0?"global":"project",installed_count:s.length-k,failed_count:k,targets:s,warnings:[...new Set(m)].sort((g,h)=>g.localeCompare(h))};_(M,n),k>0&&(process.exitCode=w),n.profile&&y(`profile:command=extension took_ms=${Date.now()-c}`)}function Y(e){return e.option("--project","Use project extension scope (default)").option("--local","Alias for --project").option("--global","Use global extension scope")}function $(e){return e.option("--project","Use project package scope (default)").option("--local","Alias for --project").option("--global","Use global package scope")}function u(e,t){return t==="package"?$(e):Y(e)}function W(e,t){let o=t==="package"?"package":"extension",a=t==="package"?"packages":"extensions",i=t,n=e.command(i).argument("[target]",`${o[0].toUpperCase()}${o.slice(1)} source/name or scaffold target path (for --init/--scaffold)`).option("--init",`Generate a starter ${o} scaffold at target path`).option("--scaffold","Alias for --init").option("--capability <kind>",`Capability the --init starter targets (${I.join("|")}; default commands)`,E).option("--install",`Install ${o} from local path, bundled alias, npm: source, wildcard, or GitHub source`).option("--uninstall",`Uninstall an installed ${o}`).option("--explore",`List discovered ${a} in selected scope`).option("--list","Alias for --explore").option("--manage",`List managed ${a} with update-check metadata`).option("--describe",`Map every surface a loaded ${o} registers (optionally one by name)`).option("--markdown","Render describe output as a Markdown reference document (describe only)").option("--output <path>","Write describe Markdown to a file (requires --markdown)").option("--reload",`Reload ${a} with cache-busted module imports`).option("--watch","Use watch mode with --reload").option("--doctor",`Run consolidated ${o} diagnostics (summary/deep modes)`).option("--catalog",`List bundled first-party ${o} catalog metadata`).option("--adopt",`Adopt an existing unmanaged ${o} into managed metadata`).option("--adopt-all",`Adopt all unmanaged ${a} into managed metadata`).option("--activate",`Activate a ${o} in selected scope settings`).option("--deactivate",`Deactivate a ${o} in selected scope settings`).option("--project",`Use project ${o} scope (default)`).option("--local","Alias for --project").option("--global",`Use global ${o} scope`).option("--gh <github-source>","Install from GitHub shorthand source (owner/repo[/path])").option("--github <github-source>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub install sources").option("--detail <mode>",`${o[0].toUpperCase()}${o.slice(1)} diagnostics detail mode (summary|deep)`).option("--trace","Include actionable registration traces in doctor deep diagnostics").option("--runtime-probe","Opt-in runtime activation probe for manage output parity").option("--fix-managed-state",`Adopt unmanaged ${a} before diagnostics/update checks`).option("--isolated",`Run doctor against project-scope ${a} only, ignoring global registrations`).option("--ignore-global","Alias for --isolated").option("--strict-exit","Return non-zero exit when doctor warnings are present (ok=false)").option("--fail-on-warn","Alias for --strict-exit (doctor)").description(t==="package"?"Manage package lifecycle operations for project or global scope. Backward-compatible with extension packages.":"Manage extension lifecycle operations for project or global scope.").action(async(r,l,s)=>{await p(r,s.optsWithGlobals(),s,void 0,t)});t==="package"&&(n.alias("packages"),n.option("--declarative","Scaffold the composeExtension blueprint starter (any capability)"));let c=n.command("init").alias("scaffold").argument("<target>","Scaffold target directory path").option("--capability <kind>",`Capability the starter targets (${I.join("|")}; default commands)`,E).description(t==="package"?"Generate a starter package scaffold with package metadata, manifest, and entrypoint.":"Generate a starter extension scaffold with manifest and entrypoint.");t==="package"&&c.option("--declarative","Scaffold the composeExtension blueprint starter (any capability)"),u(c,t).action(async(r,l,s)=>{await p(r,s.optsWithGlobals(),s,"init",t)}),u(n.command("install").argument("[targets...]",`${o[0].toUpperCase()}${o.slice(1)} source (local path, bundled alias, npm: source, wildcard, or GitHub source)`).option("--gh <github-source>","Install from GitHub shorthand source (owner/repo[/path])").option("--github <github-source>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub install sources").description(`Install ${o} from local path, bundled alias, npm: source, wildcard, or GitHub source.`),t).action(async(r,l,s)=>{await F(r,s.optsWithGlobals(),s,t)}),u(n.command("uninstall").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Uninstall an installed ${o}.`),t).action(async(r,l,s)=>{await p(r,s.optsWithGlobals(),s,"uninstall",t)}),u(n.command("explore").description(`List discovered ${a} in selected scope.`),t).action(async(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"explore",t)}),u(n.command("manage").option("--runtime-probe","Opt-in runtime activation probe for manage output parity").option("--fix-managed-state",`Adopt unmanaged ${a} before diagnostics/update checks`).description(`List managed ${a} with update-check metadata.`),t).action(async(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"manage",t)}),u(n.command("describe").argument("[target]",`${o[0].toUpperCase()}${o.slice(1)} name to describe (omit for every loaded ${o})`).option("--markdown","Render the surface map as a Markdown reference document instead of toon/json").option("--output <path>","Write Markdown output to a file (requires --markdown)").description(`Map every surface a loaded ${o} registers (commands, hooks, item types, providers, overrides, ...).`),t).action(async(r,l,s)=>{await p(r,s.optsWithGlobals(),s,"describe",t)}),u(n.command("reload").option("--watch","Use watch mode for repeated reload checks").description(`Reload ${a} with cache-busted module imports.`),t).action(async(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"reload",t)}),u(n.command("doctor").option("--detail <mode>",`Detail mode for ${o} diagnostics (summary|deep)`).option("--trace","Include actionable registration traces in doctor deep diagnostics").option("--fix-managed-state",`Adopt unmanaged ${a} before diagnostics/update checks`).option("--isolated",`Run doctor against project-scope ${a} only, ignoring global registrations`).option("--ignore-global","Alias for --isolated").option("--strict-exit","Return non-zero exit when doctor warnings are present (ok=false)").option("--fail-on-warn","Alias for --strict-exit (doctor)").description(`Run consolidated ${o} diagnostics (summary/deep modes).`),t).action(async(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"doctor",t)}),u(n.command("catalog").alias("list").option("--fields <value>","Render compact comma-separated catalog fields, for example: alias,installed,install_command").description(`List bundled first-party ${o} catalog metadata.`),t).action(async(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"catalog",t)}),u(n.command("adopt").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).option("--gh <owner/repo[/path]>",`GitHub provenance shorthand for adopted ${o}`).option("--github <owner/repo[/path]>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub shorthand source").description(`Adopt an existing unmanaged ${o} into managed metadata.`),t).action(async(r,l,s)=>{await p(r,s.optsWithGlobals(),s,"adopt",t)}),u(n.command("adopt-all").description(`Adopt all unmanaged ${a} into managed metadata.`),t).action(async(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"adopt-all",t)}),u(n.command("migrate").option("--dry-run","Plan active migrations without invoking extension code").description(`Plan or apply active ${o} migrations with durable receipts.`),t).action(async(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"migrate",t)}),u(n.command("activate").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Activate a ${o} in selected scope settings.`),t).action(async(r,l,s)=>{await p(r,s.optsWithGlobals(),s,"activate",t)}),u(n.command("deactivate").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Deactivate a ${o} in selected scope settings.`),t).action(async(r,l,s)=>{await p(r,s.optsWithGlobals(),s,"deactivate",t)})}async function J(e,t,o){let a=v(o),i=Date.now(),n=await T(e,a,{idPrefix:typeof t.idPrefix=="string"?t.idPrefix:void 0,preset:typeof t.preset=="string"?t.preset:void 0,defaults:t.defaults===!0||t.yes===!0,author:typeof t.author=="string"?t.author:void 0,agentGuidance:typeof t.agentGuidance=="string"?t.agentGuidance:void 0,typePreset:typeof t.typePreset=="string"?t.typePreset:void 0,withPackages:t.withPackages===!0,mergeFence:t.mergeFence!==!1,force:t.force===!0,workspace:typeof t.workspace=="string"?t.workspace:void 0}),r=t.verbose===!0||a.json===!0;_(r?n:j(n),a),a.profile&&y(`profile:command=init took_ms=${Date.now()-i}`)}function Q(e,t,o,a){let n=e!==void 0&&new Set(["get","set","list","export"]).has(e);return{resolvedScope:n?"project":e??"project",resolvedAction:n?e:t??"list",resolvedKey:n?t:o,resolvedValue:n?o:a}}function Z(e){return{criterion:Array.isArray(e.criterion)?e.criterion:[],format:typeof e.format=="string"?e.format:void 0,policy:typeof e.policy=="string"?e.policy:void 0,value:typeof e.value=="string"?e.value:void 0,clearCriteria:e.clearCriteria===!0,defaultDepth:typeof e.defaultDepth=="string"?e.defaultDepth:void 0,activityLimit:typeof e.activityLimit=="string"?e.activityLimit:void 0,staleThresholdDays:typeof e.staleThresholdDays=="string"?e.staleThresholdDays:void 0,sectionHierarchy:typeof e.sectionHierarchy=="string"?e.sectionHierarchy:void 0,sectionActivity:typeof e.sectionActivity=="string"?e.sectionActivity:void 0,sectionProgress:typeof e.sectionProgress=="string"?e.sectionProgress:void 0,sectionBlockers:typeof e.sectionBlockers=="string"?e.sectionBlockers:void 0,sectionFiles:typeof e.sectionFiles=="string"?e.sectionFiles:void 0,sectionWorkload:typeof e.sectionWorkload=="string"?e.sectionWorkload:void 0,sectionStaleness:typeof e.sectionStaleness=="string"?e.sectionStaleness:void 0,sectionTests:typeof e.sectionTests=="string"?e.sectionTests:void 0}}async function ee(e,t,o,a,i,n){let c=v(n),r=Date.now(),{resolvedScope:l,resolvedAction:s,resolvedKey:m,resolvedValue:w}=Q(e,t,o,a),k=await O(l,s,m,Z(i),c,typeof w=="string"?w:void 0);_(k,c),c.profile&&y(`profile:command=config took_ms=${Date.now()-r}`)}var ve={normalizeExtensionOptions:G};function Ee(e){e.command("init").argument("[prefix-or-path]","Optional id prefix, or path-like tracker target such as ./pm-sandbox").option("--prefix, --id-prefix <value>","Set the item ID prefix (alias for the positional prefix)").option("--preset <value>","Governance preset for new setups: minimal|default|strict").option("--defaults","Use non-interactive setup defaults without opening the wizard").option("-y, --yes","Alias for --defaults (non-interactive setup)").option("--author <value>","Set the default mutation author for this project").option("--agent-guidance <mode>","Agent guidance mode: ask|add|skip|status").option("--type-preset <name>","Register domain item types during init: agile|ops|research").option("--with-packages","Install all bundled first-party packages during initialization").option("--no-merge-fence","Skip automatic merge-driver installation for a fresh Git-backed tracker").option("--workspace <dir>","Initialize repository-local tracker storage at <dir>/.agents/pm").option("--force","Allow initializing tracker files directly in a directory that looks like a workspace root").option("--verbose","Include the full resolved settings tree in the output (default output is a concise summary)").description("Initialize pm storage and defaults for the current workspace or a path-like tracker target.").action(async(t,o,a)=>{await J(t,o,a)}),e.command("config").argument("[scope]","Config scope: project|global, or action shorthand list|export|get|set for project scope").argument("[action]","Config action: get|set|list|export").argument("[key]","Config key for get|set; use `pm config project list` for the complete typed inventory, including mutation-guard-* policies").argument("[value]",'Optional value for set: routed to the right typed flag by key (e.g. config set telemetry-tracking off, config set item-format toon, config set definition-of-done "Tests pass"). Equivalent to --policy/--format/--criterion. context keys still require --default-depth/--section-* flags.').option("--criterion <text>","Criteria value for definition-of-done, metadata-required-fields, or lifecycle pattern keys (repeatable for set)",E).option("--clear-criteria","Clear criteria-list keys for config set operations").option("--format <value>","Item format for item-format key: toon").option("--policy <value>","Policy key values: history-missing-stream-policy=auto_create|strict_error; sprint-release-format-policy=warn|strict_error; parent-reference-policy=warn|strict_error; governance-preset=minimal|default|strict|custom; governance-ownership-enforcement=none|warn|strict; governance-create-mode-default=progressive|strict; governance-close-validation-default=off|warn|strict; governance-require-close-reason=enabled|disabled; governance-parent-reference-policy=warn|strict_error; governance-metadata-validation-profile=core|strict|custom; governance-force-required-for-stale-lock=enabled|disabled; governance-duplicate-detection-mode=off|advisory|strict; test-result-tracking=enabled|disabled; telemetry-tracking=enabled|disabled").option("--value <value>","Typed nested setting value. Mutation guards: require-attributed-author=true|false, secret-guard=off|advise|block, stale-in-progress-hours=integer>=1. Kebab-case is preferred; underscore aliases remain accepted.").option("--default-depth <value>","Context default depth: brief|standard|deep").option("--activity-limit <n>","Context default activity limit").option("--stale-threshold-days <n>","Context staleness cutoff in days").option("--section-hierarchy <value>","Enable/disable context hierarchy section (true|false)").option("--section-activity <value>","Enable/disable context activity section (true|false)").option("--section-progress <value>","Enable/disable context progress section (true|false)").option("--section-blockers <value>","Enable/disable context blockers section (true|false)").option("--section-files <value>","Enable/disable context files section (true|false)").option("--section-workload <value>","Enable/disable context workload section (true|false)").option("--section-staleness <value>","Enable/disable context staleness section (true|false)").option("--section-tests <value>","Enable/disable context tests section (true|false)").description("Read or update pm settings for the current workspace or global profile.").action(async(t,o,a,i,n,c)=>{await ee(t,o,a,i,n,c)}),W(e,"extension"),W(e,"package"),$(e.command("install").argument("[targets...]","Package source (local path, bundled alias, npm: source, wildcard, or GitHub source)").option("--gh <github-source>","Install from GitHub shorthand source (owner/repo[/path])").option("--github <github-source>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub install sources").description("Install a pm package into the project package scope by default.")).action(async(t,o,a)=>{await F(t,a.optsWithGlobals(),a,"package")}),$(e.command("upgrade").argument("[target]","Optional managed package name/source to upgrade; omit to upgrade pm CLI and all managed packages").option("--dry-run","Plan CLI/package upgrades without running npm or reinstalling packages").option("--cli-only","Upgrade only the pm CLI/SDK npm package").option("--packages-only","Upgrade only managed pm packages").option("--repair","Force npm global reinstall when upgrading the pm CLI/SDK").option("--tag <value>","npm dist-tag/version for CLI and registry package upgrades").option("--package-name <value>","Override the CLI package name for self-upgrade testing").description("Upgrade the pm CLI/SDK and refresh managed installable pm packages.")).action(async(t,o,a)=>{let i=v(a),n=Date.now(),c=await R(t,a.opts(),i);_(c,i),c.ok||(process.exitCode=d.GENERIC_FAILURE),i.profile&&y(`profile:command=upgrade took_ms=${Date.now()-n}`)})}export{ve as _testOnlyRegisterSetup,Ee as registerSetupCommands};
|
|
2
|
+
//# sourceMappingURL=register-setup-3YXZ444E.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import{c as x}from"./chunk-PPFGQDSI.js";import{Ja as a,La as w,p as m,w as T}from"./chunk-K7RWWOAG.js";import{S as v,Y as f,Z as u,o as _,p as b,q as E}from"./chunk-Q4YY3XNF.js";import C from"node:fs/promises";import p from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6fc24a7c-a359-51fd-a432-4c8037d10e9e")}catch{}})();var z=["extensions","docs","examples","assets","prompts"],R=Object.freeze({extensions:Object.freeze([".agents/pm/extensions","extensions",".custom/pm-extensions",".custom/pm-extension"]),docs:Object.freeze(["docs","documentation"]),examples:Object.freeze(["examples","docs/examples"]),assets:Object.freeze(["assets",".agents/pm/assets"]),prompts:Object.freeze(["prompts",".agents/pm/prompts"])});function q(e){return z.includes(e)}function G(e,t){if(t==null)return[];let r=Array.isArray(t)?t:[t],n=[];for(let i of r){if(typeof i!="string"||i.trim().length===0)throw new u(`Package manifest field pm.${e} must contain string paths.`,f.USAGE);n.push(i.trim())}return[...new Set(n)].sort((i,o)=>i.localeCompare(o))}function J(e){if(e==null)return{};if(typeof e!="object"||Array.isArray(e))throw new u("Package manifest field pm must be an object.",f.USAGE);let t={},r=e;for(let[n,i]of Object.entries(r)){if(!q(n))continue;let o=G(n,i);o.length>0&&(t[n]=o)}return t}function c(e,t){let r=e[t];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function S(e){if(!Array.isArray(e))return;let t=e.map(r=>typeof r=="string"?r.trim():"").filter(r=>r.length>0);return t.length>0?[...new Set(t)].sort((r,n)=>r.localeCompare(n)):void 0}function I(e){if(typeof e=="string"&&e.trim().length>0)return e.trim();if(typeof e=="object"&&e!==null&&!Array.isArray(e)){let t=e.url;return typeof t=="string"&&t.trim().length>0?t.trim():void 0}}function K(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e,r={docs:c(t,"docs"),npm:c(t,"npm"),repository:c(t,"repository"),report:c(t,"report")};return Object.values(r).some(n=>typeof n=="string")?r:void 0}function V(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e,r={image:c(t,"image"),video:c(t,"video")};return Object.values(r).some(n=>typeof n=="string")?r:void 0}function Y(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e,r={display_name:c(t,"display_name")??c(t,"displayName"),category:c(t,"category"),summary:c(t,"summary"),links:K(t.links),media:V(t.media),tags:S(t.tags)};return Object.values(r).some(n=>n!==void 0)?r:void 0}async function B(e){let t=p.join(e,"package.json");if(!await m(t))return{source:"convention",resources:{}};let r;try{r=JSON.parse(await C.readFile(t,"utf8"))}catch(d){throw new u(`Failed to parse package manifest at "${t}": ${String(d)}`,f.USAGE)}if(typeof r!="object"||r===null||Array.isArray(r))throw new u(`Package manifest at "${t}" must be a JSON object.`,f.USAGE);let n=r,i=n.pm,o=i!=null,s=typeof i=="object"&&i!==null&&!Array.isArray(i)?i:{};return{source:o?"pm":"convention",package_json_path:t,package_name:typeof n.name=="string"?n.name:void 0,package_version:typeof n.version=="string"?n.version:void 0,package_private:n.private===!0,package_description:typeof n.description=="string"?n.description:void 0,package_keywords:S(n.keywords),package_homepage:typeof n.homepage=="string"?n.homepage:void 0,package_repository_url:I(n.repository),package_bugs_url:I(n.bugs),aliases:S(s.aliases),resources:J(i),catalog:Y(s.catalog)}}async function j(e){if(!await m(e))return[];let t=await C.readdir(e,{withFileTypes:!0}),r=[];for(let n of t){if(!n.isDirectory())continue;let i=p.join(e,n.name);await m(p.join(i,"manifest.json"))&&r.push(i)}return r.sort((n,i)=>n.localeCompare(i))}async function _e(e){if(await m(p.join(e,"manifest.json")))return[e];let r=(await B(e)).resources.extensions??[],n=new Set;for(let i of r){if(i.includes("*")||i.startsWith("!"))throw new u(`Package extension entry "${i}" uses a glob/exclusion pattern. pm package installs currently require concrete extension paths or directories.`,f.USAGE);let o=p.resolve(e,i);if(!T(e,o))throw new u(`Package extension entry "${i}" resolves outside package root.`,f.USAGE);if(await m(p.join(o,"manifest.json"))){n.add(o);continue}for(let s of await j(o))n.add(s)}if(r.length===0)for(let i of R.extensions)for(let o of await j(p.join(e,i)))n.add(o);return[...n].sort((i,o)=>i.localeCompare(o))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="48c3e62a-8085-5215-a692-4c03792022ce")}catch{}})();var D=1,A=6,$=[["commands","Commands"],["command_overrides","Command overrides"],["flag_commands","Flag commands"],["item_types","Item types"],["item_fields","Item fields"],["migrations","Migrations"],["profiles","Profiles"],["importers","Importers"],["exporters","Exporters"],["search_providers","Search providers"],["vector_store_adapters","Vector store adapters"],["assurance_providers","Assurance measurement providers"],["hooks","Lifecycle hooks"],["parser_overrides","Parser overrides"],["service_overrides","Service overrides"],["renderer_overrides","Renderer overrides"]];function k(e){return"#".repeat(e)}function F(e){if(!e.includes("`"))return`\`${e}\``;let t=0,r=0;for(let o of e)r=o==="`"?r+1:0,t=Math.max(t,r);let n="`".repeat(t+1),i=e.startsWith("`")||e.endsWith("`")?" ":"";return`${n}${i}${e}${i}${n}`}function W(e){return e.length===0?"Capabilities: _none registered_":`Capabilities: ${e.map(F).join(", ")}`}function H(e,t,r){let n=[`${k(t)} ${e}`,""];return r.length===0?(n.push("_None._",""),n):(n.push(...r.map(i=>`- ${F(i)}`),""),n)}function X(e,t,r){return e===0&&!r?[]:[`${k(t)} Preflight overrides`,"",e>0?`- ${e} registered (this surface carries no per-entry identifier)`:"_None._",""]}function Ee(e,t={}){let r=t.headingLevel??2;if(!Number.isInteger(r)||r<D||r>A)throw new RangeError(`headingLevel must be an integer in [${D}, ${A}], received ${String(t.headingLevel)}`);let n=Math.min(r+1,A),i=t.includeEmpty===!0,o=t.title??"Extension surfaces",s=[`${k(r)} ${o}`,""];(i||e.capabilities.length>0)&&s.push(W(e.capabilities),"");for(let[l,y]of $){let g=e[l]??[];g.length===0&&!i||s.push(...H(y,n,g))}return s.push(...X(e.preflight_overrides,n,i)),!(e.preflight_overrides>0||$.some(([l])=>(e[l]?.length??0)>0))&&!i&&s.push("_This extension registers no surfaces._",""),`${s.join(`
|
|
2
2
|
`).trimEnd()}
|
|
3
|
-
`}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e3f016bb-8add-5765-bb1a-a7b22423f8d1")}catch{}})();var Q=["agile","ops","research"],Z={agile:[{name:"Story",description:"User-facing outcome or capability slice expressed from a stakeholder perspective.",defaultStatus:"open",folder:"stories",aliases:["user-story"]},{name:"Spike",description:"Time-boxed investigation used to reduce uncertainty before implementation.",defaultStatus:"open",folder:"spikes",aliases:["research-spike"]}],ops:[{name:"Incident",description:"Operational disruption, degradation, or support escalation with recovery tracking.",defaultStatus:"open",folder:"incidents",aliases:["outage"]},{name:"Runbook",description:"Repeatable operational procedure, diagnostic path, or response playbook.",defaultStatus:"open",folder:"runbooks",aliases:["playbook"]}],research:[{name:"Experiment",description:"Validated-learning activity with hypothesis, method, and outcome tracking.",defaultStatus:"open",folder:"experiments",aliases:["study"]},{name:"Hypothesis",description:"Testable claim or assumption that should be supported, rejected, or refined.",defaultStatus:"open",folder:"hypotheses",aliases:["assumption"]}]};function ke(e){if(e===void 0)return;let t=e.trim().toLowerCase().replaceAll("-","_");if(t.length===0)throw new Error("Type preset name must not be empty.");if(t==="agile"||t==="ops"||t==="research")return t;throw new Error(`Invalid type preset "${e}". Allowed: ${Q.join(", ")}.`)}function
|
|
3
|
+
`}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e3f016bb-8add-5765-bb1a-a7b22423f8d1")}catch{}})();var Q=["agile","ops","research"],Z={agile:[{name:"Story",description:"User-facing outcome or capability slice expressed from a stakeholder perspective.",defaultStatus:"open",folder:"stories",aliases:["user-story"]},{name:"Spike",description:"Time-boxed investigation used to reduce uncertainty before implementation.",defaultStatus:"open",folder:"spikes",aliases:["research-spike"]}],ops:[{name:"Incident",description:"Operational disruption, degradation, or support escalation with recovery tracking.",defaultStatus:"open",folder:"incidents",aliases:["outage"]},{name:"Runbook",description:"Repeatable operational procedure, diagnostic path, or response playbook.",defaultStatus:"open",folder:"runbooks",aliases:["playbook"]}],research:[{name:"Experiment",description:"Validated-learning activity with hypothesis, method, and outcome tracking.",defaultStatus:"open",folder:"experiments",aliases:["study"]},{name:"Hypothesis",description:"Testable claim or assumption that should be supported, rejected, or refined.",defaultStatus:"open",folder:"hypotheses",aliases:["assumption"]}]};function ke(e){if(e===void 0)return;let t=e.trim().toLowerCase().replaceAll("-","_");if(t.length===0)throw new Error("Type preset name must not be empty.");if(t==="agile"||t==="ops"||t==="research")return t;throw new Error(`Invalid type preset "${e}". Allowed: ${Q.join(", ")}.`)}function ve(e){return Z[e].map(t=>x(t))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="575b0c3a-9ce1-504f-a24e-d8854e898f17")}catch{}})();var ee=new Set(b),te=new Set(E),N=new Set([...v.filter(e=>e!=="severity"),"id","title","type","status","priority","tags","assignee","parent","description","body","created_at","updated_at","closed_at","completed_at","author","deadline","estimate","sprint","release","risk","confidence","reviewer","resolution","expected","actual"]),ne=["create","update"];function P(e){if(typeof e!="string")return"";let t=e.trim().toLowerCase().replaceAll(/[\s_]+/g,"-");return t.startsWith("--")?t.slice(2):t}function O(e){return e.replaceAll("_","-")}function re(e,t){let r=new Set;for(let n of e){let i=P(n);i.length>0&&i!==t&&r.add(i)}return[...r].sort((n,i)=>n.localeCompare(i))}function ie(e){let t=new Set;for(let r of e??[]){let n=r.trim();n.length>0&&t.add(n)}return[...t].sort((r,n)=>r.localeCompare(n))}function oe(e){let t=new Set,r=[];for(let n of e??[]){let i=n.trim().toLowerCase();if(i.length!==0){if(!te.has(i))throw new Error(`Invalid field command "${n}". Allowed: ${E.join(", ")}.`);t.has(i)||(t.add(i),r.push(i))}}return e===void 0||r.length===0?[...ne]:r}function je(e){let t=a(e.key);if(t.length===0)throw new Error("Field key must not be empty.");if(N.has(t))throw new Error(`Cannot define custom field "${t}": custom schema field "${t}" collides with built-in item metadata "${t}". Rename the custom field with a project-specific prefix. Reserved fields: ${[...N].sort((g,U)=>g.localeCompare(U)).join(", ")}.`);let r=typeof e.type=="string"&&e.type.trim().length>0?e.type.trim().toLowerCase():"string";if(!ee.has(r))throw new Error(`Invalid field type "${e.type}". Allowed: ${b.join(", ")}.`);let n=r,i=oe(e.commands),o=P(e.cliFlag),s=o.length>0&&o!==O(t)?o:void 0,d=s??O(t),l=re(e.aliases??[],d),y=e.description?.trim();return{key:t,type:n,commands:i,description:y&&y.length>0?y:void 0,cliFlag:s,cliAliases:l,required:e.required===!0,requiredOnCreate:e.requiredOnCreate===!0,allowUnset:e.allowUnset!==!1,requiredTypes:ie(e.requiredTypes)}}function se(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.fields))return t.fields;if(Array.isArray(t.definitions))return t.definitions}function ae(e){let t=se(e);if(!t)return[];let r=[];for(let n of t){if(typeof n!="object"||n===null||Array.isArray(n))continue;let i=n;typeof i.key!="string"||i.key.trim().length===0||r.push(i)}return r}function Ce(e){if(e==null||e.trim().length===0)return{fields:[]};let t;try{t=JSON.parse(e)}catch{throw new Error("schema/fields.json contains invalid JSON.")}return{fields:ae(t)}}function De(e){return`${JSON.stringify({fields:e.fields},null,2)}
|
|
4
4
|
`}function $e(e,t){let r=e.fields.find(s=>a(s.key)===t.key),n=r!==void 0,i=e.fields.filter(s=>a(s.key)!==t.key),o={...r,key:t.key,type:t.type,commands:[...t.commands]};return L(o,"description",t.description),L(o,"cli_flag",t.cliFlag),t.cliAliases.length>0?o.cli_aliases=[...t.cliAliases]:delete o.cli_aliases,M(o,"required",t.required),M(o,"required_on_create",t.requiredOnCreate),t.allowUnset===!1?o.allow_unset=!1:delete o.allow_unset,t.requiredTypes.length>0?o.required_types=[...t.requiredTypes]:delete o.required_types,i.push(o),i.sort((s,d)=>a(s.key).localeCompare(a(d.key))),{file:{fields:i},definition:o,replaced:n}}function Fe(e,t){let r=a(t);if(r.length===0)throw new Error("Field key must not be empty.");let n=[],i=e.fields.filter(o=>a(o.key)===r?(n.push(o),!1):!0);return n.length===0?{file:{fields:i},removed:!1}:{file:{fields:i},removed:!0,definition:n[0]}}function L(e,t,r){let n=e;r!==void 0&&r.length>0?n[t]=r:delete n[t]}function M(e,t,r){let n=e;r?n[t]=!0:delete n[t]}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3eac0218-43c9-5bd2-8eaf-589d02d2c8ad")}catch{}})();var de=new Set(_),h=new Set(w.map(e=>a(e.id)).filter(e=>e.length>0));function le(e){let t=new Set;for(let r of e){let n=a(r);n.length>0&&t.add(n)}return[...t].sort((r,n)=>r.localeCompare(n))}function Ue(e){let t=a(e.id);if(t.length===0)throw new Error("Status id must not be empty.");if(h.has(t))throw new Error(`Cannot add-status the built-in status "${t}". Built-in statuses are reserved: ${[...h].join(", ")}.`);let r;if(e.roles!==void 0){r=[];let s=new Set;for(let d of e.roles){let l=typeof d=="string"?d.trim().toLowerCase():"";if(l.length!==0){if(!de.has(l))throw new Error(`Invalid status role "${d}". Allowed roles: ${_.join(", ")}.`);s.has(l)||(s.add(l),r.push(l))}}}let n=e.aliases===void 0?void 0:le(e.aliases).filter(s=>s!==t),i=e.description?.trim(),o=typeof e.order=="number"&&Number.isFinite(e.order)?Math.trunc(e.order):void 0;return{id:t,roles:r,aliases:n,description:i&&i.length>0?i:void 0,order:o}}function ce(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.statuses))return t.statuses;if(Array.isArray(t.definitions))return t.definitions}function fe(e){let t=ce(e);if(!t)return[];let r=[];for(let n of t){if(typeof n!="object"||n===null||Array.isArray(n))continue;let i=n;typeof i.id!="string"||i.id.trim().length===0||r.push(i)}return r}function ze(e){if(e==null||e.trim().length===0)return{statuses:[]};let t;try{t=JSON.parse(e)}catch{throw new Error("schema/statuses.json contains invalid JSON.")}return{statuses:fe(t)}}function Re(e){return`${JSON.stringify({statuses:e.statuses},null,2)}
|
|
5
|
-
`}function qe(e,t,r){let n=e.statuses.slice(),i=n.findIndex(d=>a(d.id)===t.id),o=i>=0?n[i]:r,s={...o,id:t.id};return t.roles!==void 0&&(t.roles.length>0?s.roles=[...t.roles]:s.roles!==void 0&&delete s.roles),t.aliases!==void 0&&(t.aliases.length>0?s.aliases=[...t.aliases]:s.aliases!==void 0&&delete s.aliases),t.description!==void 0&&(s.description=t.description),t.order!==void 0&&(s.order=t.order),i>=0?n[i]=s:n.push(s),{file:{statuses:n},definition:s,replaced:o!==void 0}}function Ge(e,t){let r=a(t);if(r.length===0)throw new Error("Status id must not be empty.");if(h.has(r))throw new Error(`Cannot remove built-in status "${r}". Built-in statuses are reserved: ${[...h].join(", ")}.`);let n=e.statuses.slice(),i=n.findIndex(s=>a(s.id)===r);if(i<0)return{file:{statuses:n},removed:!1};let[o]=n.splice(i,1);return{file:{statuses:n},removed:!0,definition:o}}function Je(e,t){let r=[e.id,...e.aliases??[]];for(let n of r){let i=a(n);if(i.length===0)continue;let o=t.get(i);if(o!==void 0&&o!==e.id)throw new Error(`Status token "${i}" already belongs to status "${o}". Choose a different id/alias to avoid shadowing it.`)}}export{z as a,R as b,B as c,_e as d,Q as e,Z as f,ke as g,
|
|
6
|
-
//# sourceMappingURL=chunk-
|
|
5
|
+
`}function qe(e,t,r){let n=e.statuses.slice(),i=n.findIndex(d=>a(d.id)===t.id),o=i>=0?n[i]:r,s={...o,id:t.id};return t.roles!==void 0&&(t.roles.length>0?s.roles=[...t.roles]:s.roles!==void 0&&delete s.roles),t.aliases!==void 0&&(t.aliases.length>0?s.aliases=[...t.aliases]:s.aliases!==void 0&&delete s.aliases),t.description!==void 0&&(s.description=t.description),t.order!==void 0&&(s.order=t.order),i>=0?n[i]=s:n.push(s),{file:{statuses:n},definition:s,replaced:o!==void 0}}function Ge(e,t){let r=a(t);if(r.length===0)throw new Error("Status id must not be empty.");if(h.has(r))throw new Error(`Cannot remove built-in status "${r}". Built-in statuses are reserved: ${[...h].join(", ")}.`);let n=e.statuses.slice(),i=n.findIndex(s=>a(s.id)===r);if(i<0)return{file:{statuses:n},removed:!1};let[o]=n.splice(i,1);return{file:{statuses:n},removed:!0,definition:o}}function Je(e,t){let r=[e.id,...e.aliases??[]];for(let n of r){let i=a(n);if(i.length===0)continue;let o=t.get(i);if(o!==void 0&&o!==e.id)throw new Error(`Status token "${i}" already belongs to status "${o}". Choose a different id/alias to avoid shadowing it.`)}}export{z as a,R as b,B as c,_e as d,Q as e,Z as f,ke as g,ve as h,je as i,Ce as j,De as k,$e as l,Fe as m,h as n,Ue as o,ze as p,Re as q,qe as r,Ge as s,Je as t,Ee as u};
|
|
6
|
+
//# sourceMappingURL=chunk-4DQ2YERC.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{d as kt,e as N,g as Fe,h as xt,j as $}from"./chunk-SM7MTG27.js";import{Z as de,Za as ce,ka as R,l as oe,ob as bt,pb as wt,rb as ae,ta as Pe,xb as vt}from"./chunk-PGXJQLCT.js";import{F as Q,L as Z,O as ee,Ra as ne,da as E,ia as te,p as Y,r as $e,s as q,t as B,v as gt}from"./chunk-K7RWWOAG.js";import{b as se,d as je,f as A,g as ie,h as ht,i as mt,j as yt,k as _t}from"./chunk-ZM6TZVHC.js";import{Ha as re,Y as w,Z as v,aa as U,la as Me}from"./chunk-Q4YY3XNF.js";import{constants as z}from"node:fs";import{lstat as Et,mkdir as qe,open as Tt}from"node:fs/promises";import C from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bb5dfa6f-b60f-55f2-ae17-3dbcaaff1b47")}catch{}})();function Ge(e,t){if(typeof e!="string"||e.trim().length===0)throw new TypeError(`Relationship event ${t} must be non-empty`);return e.trim()}function Be(e,t){let r=t.require(e.kind),n=r.direction==="undirected"?[e.source,e.target].sort().join("\0"):`${e.source}\0${e.target}`;return`${r.kind}\0${n}`}function Sn(e){return Object.freeze({...e,...e.payload===void 0?{}:{payload:Object.freeze(structuredClone(e.payload))}})}function Rn(e,t,r,n){let s=r.require(e.kind),i=n.outgoingOne.get(`${s.kind}\0${e.source}`);if(i!==void 0&&i!==t)throw new TypeError(`Relationship outgoing cardinality exceeded for ${s.kind}`);let o=n.incomingOne.get(`${s.kind}\0${e.target}`);if(o!==void 0&&o!==t)throw new TypeError(`Relationship incoming cardinality exceeded for ${s.kind}`);let d=Be(e,r),c=n.identities.get(d);if(c!==void 0&&c!==t)throw new TypeError(`Relationship edge already active: ${d}`)}function Dn(e){let t=new Map;for(let r of e)r.action==="remove"?t.delete(r.relationshipId):t.set(r.relationshipId,r.edge);return t}function On(e,t,r){if(e.expectedVersion!==void 0&&e.expectedVersion!==t)throw new TypeError(`Relationship event version conflict: expected ${e.expectedVersion}, current ${t}`);let n=Ge(e.eventId,"eventId");if(r.has(n))throw new TypeError(`Relationship event already exists: ${n}`);if(e.action!=="add"&&e.action!=="remove"&&e.action!=="supersede")throw new TypeError(`Unknown relationship event action: ${e.action}`);if(!Number.isFinite(Date.parse(e.timestamp)))throw new TypeError("Relationship event timestamp must be valid");return{eventId:n,relationshipId:Ge(e.relationshipId,"relationshipId"),author:Ge(e.author,"author"),timestamp:new Date(e.timestamp).toISOString()}}function Ln(e,t,r,n,s,i){let o=r.has(t);if(e.action==="add"&&o)throw new TypeError(`Relationship is already active: ${t}`);if(e.action!=="add"&&!o)throw new TypeError(`Relationship is not active: ${t}`);if(e.action==="remove")return;if(!e.edge)throw new TypeError(`Relationship ${e.action} event requires an edge`);let d=typeof e.edge.source=="string"?e.edge.source.trim():"",c=typeof e.edge.target=="string"?e.edge.target.trim():"";if(!n.has(d)||!n.has(c))throw new TypeError(`Relationship endpoint not found: ${d} -> ${c}`);let a=new te([d,c],[e.edge],s).edges()[0];return Rn(a,t,s,i),Sn(a)}var Ue=class{#e;#n;#r=[];#i=new Set;#t=new Map;#s={identities:new Map,outgoingOne:new Map,incomingOne:new Map};constructor(t,r={}){this.#e=new Set([...t].filter(n=>typeof n=="string").map(n=>n.trim()).filter(Boolean)),this.#n=r.registry??E()}get version(){return this.#r.length}events(){return Object.freeze([...this.#r])}*stream(t={}){let r=t.fromVersion??1,n=t.toVersion??this.version,s=t.batchSize??100;if(!Number.isInteger(r)||r<1)throw new TypeError("Relationship event stream fromVersion must be positive");if(!Number.isInteger(n)||n<0||n>this.version)throw new TypeError(`Relationship event stream toVersion out of range: ${n}`);if(!Number.isInteger(s)||s<1)throw new TypeError("Relationship event stream batchSize must be positive");if(r>n+1)throw new TypeError("Relationship event stream fromVersion exceeds the selected prefix");for(let i=r-1;i<n;i+=s)yield Object.freeze(this.#r.slice(i,Math.min(i+s,n)))}project(t,r,n={}){if(typeof r!="function")throw new TypeError("Relationship event projection requires a reducer");let s=t,i=0,o;for(let d of this.stream({...n,batchSize:256}))for(let c of d)s=r(s,c),i+=1,o=c;return Object.freeze({state:s,version:o?.sequence??Math.max(0,(n.fromVersion??1)-1),processed:i,...o===void 0?{}:{asOf:o.timestamp}})}#o(t,r){let n=this.#n.require(r.kind);this.#s.identities.set(Be(r,this.#n),t),n.outgoing==="one"&&this.#s.outgoingOne.set(`${n.kind}\0${r.source}`,t),n.incoming==="one"&&this.#s.incomingOne.set(`${n.kind}\0${r.target}`,t)}#d(t){let r=this.#n.require(t.kind);this.#s.identities.delete(Be(t,this.#n)),r.outgoing==="one"&&this.#s.outgoingOne.delete(`${r.kind}\0${t.source}`),r.incoming==="one"&&this.#s.incomingOne.delete(`${r.kind}\0${t.target}`)}append(t){let r=On(t,this.version,this.#i),n=this.#t.get(r.relationshipId),s=Ln(t,r.relationshipId,this.#t,this.#e,this.#n,this.#s),i=Object.freeze({eventId:r.eventId,relationshipId:r.relationshipId,action:t.action,...s===void 0?{}:{edge:s},author:r.author,timestamp:r.timestamp,...t.reason?.trim()?{reason:t.reason.trim()}:{},sequence:this.version+1});return this.#r.push(i),this.#i.add(r.eventId),n&&this.#d(n),t.action==="remove"?this.#t.delete(r.relationshipId):(this.#t.set(r.relationshipId,s),this.#o(r.relationshipId,s)),i}snapshot(t={}){if(t.atVersion!==void 0&&t.atTimestamp!==void 0)throw new TypeError("Relationship snapshot accepts one target");let r;if(t.atTimestamp!==void 0){let i=Date.parse(t.atTimestamp);if(!Number.isFinite(i))throw new TypeError("Relationship snapshot timestamp must be valid");r=this.#r.filter(o=>Date.parse(o.timestamp)<=i)}else{let i=t.atVersion??this.version;if(!Number.isInteger(i)||i<0||i>this.version)throw new TypeError(`Relationship snapshot version out of range: ${i}`);r=this.#r.slice(0,i)}let n=Dn(r),s=new te(this.#e,n.values(),this.#n);return Object.freeze({version:r.at(-1)?.sequence??0,...r.at(-1)?{asOf:r.at(-1).timestamp}:{},edges:s.edges(),graph:s})}page(t){if(!Number.isInteger(t.limit)||t.limit<1)throw new TypeError("Relationship event page limit must be positive");let r=A("relationship-events",{order:"append-sequence"}),n=t.cursor===void 0?this.version:Number(ht(t.cursor,r).snapshot);if(!Number.isSafeInteger(n)||n<0||n>this.version)throw new TypeError("Relationship event cursor snapshot version is invalid");let s=_t(this.#r.slice(0,n),{cursor:t.cursor,fingerprint:r,limit:t.limit,readId:i=>i.eventId,snapshot:String(n)});return{version:n,events:s.rows,hasMore:s.has_more,...s.next_cursor?{nextCursor:s.next_cursor}:{}}}},An="relationship-event-store",Ct=z.O_NOFOLLOW;function ue(e){return de(e,An,30,`relationship-store:${process.pid}`,!1,!1,3e3)}async function D(e,t="relationships/events.jsonl"){let r=C.resolve(e),n=C.resolve(r,t),s=C.relative(r,n);if(s.length===0)throw new TypeError("Relationship event path must name a file within the tracker root");if(s===".."||s.startsWith(`..${C.sep}`)||C.isAbsolute(s))throw new TypeError("Relationship event path must stay within the tracker root");if(await qe(r,{recursive:!0}),(await Et(r)).isSymbolicLink())throw new TypeError("Relationship event tracker root must not be a symbolic link");let o=r;for(let d of s.split(C.sep)){o=C.join(o,d);try{if((await Et(o)).isSymbolicLink())throw new TypeError("Relationship event path must not contain symbolic links")}catch(c){if($e(c))break;throw c}}return n}async function le(e,t,r){let n=new Ue(t,{registry:r}),s,i;try{i=await Tt(e,z.O_RDONLY|Ct),s=await i.readFile("utf8")}catch(d){if($e(d))return{log:n,raw:""};throw d}finally{await i?.close()}let o=s.split(`
|
|
2
|
+
`);for(let d=0;d<o.length;d+=1){let c=o[d].trim();if(!c)continue;let a;try{a=JSON.parse(c)}catch{throw new TypeError(`Invalid relationship event JSONL at line ${d+1}`)}if(a.sequence!==n.version+1)throw new TypeError(`Invalid relationship event sequence at line ${d+1}`);n.append({eventId:a.eventId,relationshipId:a.relationshipId,action:a.action,...a.edge===void 0?{}:{edge:a.edge},author:a.author,timestamp:a.timestamp,...a.reason===void 0?{}:{reason:a.reason},expectedVersion:n.version})}return{log:n,raw:s}}function Nn(e,t,r,n){let s=Date.parse(t.timestamp),i;return t.action!=="remove"&&t.edge!==void 0&&(i=new te(r,[t.edge],n).edges()[0]),e.eventId===t.eventId.trim()&&e.relationshipId===t.relationshipId.trim()&&e.action===t.action&&e.author===t.author.trim()&&Number.isFinite(s)&&e.timestamp===new Date(s).toISOString()&&e.reason===(t.reason?.trim()||void 0)&&U(e.edge)===U(i)}var It=class e{#e;#n;#r;#i;#t;constructor(t,r,n,s){this.#e=t.pmRoot,this.#n=r,this.#r=t.registry,this.#i=n,this.#t=s}static async open(t){let r=Object.freeze([...t.nodes]),n=await D(t.pmRoot,t.relativePath),s=await ue(t.pmRoot);try{await D(t.pmRoot,n);let{log:i}=await le(n,r,t.registry);return new e(t,r,n,i)}finally{await s()}}get path(){return this.#i}async currentVersion(){return this.#t=await this.#s(),this.#t.version}async append(t){let r=await ue(this.#e);try{let n=await D(this.#e,this.#i),{log:s}=await le(n,this.#n,this.#r),i=s.append(t);await qe(C.dirname(n),{recursive:!0}),await D(this.#e,n);let o=await Tt(n,z.O_APPEND|z.O_CREAT|z.O_WRONLY|Ct);try{await o.appendFile(`${JSON.stringify(i)}
|
|
3
|
+
`,"utf8")}finally{await o.close()}return this.#t=s,i}finally{await r()}}async appendBatch(t,r={}){let n=await ue(this.#e);try{let s=await D(this.#e,this.#i),{log:i,raw:o}=await le(s,this.#n,this.#r),d=i.version,c=new Map(i.events().map(f=>[f.eventId,f])),a=[],u=[];for(let f of t){let l=f.eventId.trim(),p=c.get(l);if(p!==void 0){if(r.existingEventPolicy==="skip_identical"&&Nn(p,f,this.#n,this.#r)){u.push(p.eventId);continue}if(r.existingEventPolicy==="skip_identical")throw new TypeError(`Relationship event id collision with different content: ${l}`)}let g=i.append(f);c.set(g.eventId,g),a.push(g)}if(a.length>0){let f=o.length===0||o.endsWith(`
|
|
4
|
+
`)?o:`${o}
|
|
5
|
+
`;await qe(C.dirname(s),{recursive:!0}),await D(this.#e,s),await B(s,`${f}${a.map(l=>JSON.stringify(l)).join(`
|
|
6
|
+
`)}
|
|
7
|
+
`)}return this.#t=i,Object.freeze({version_before:d,version_after:i.version,appended:Object.freeze(a),skipped_event_ids:Object.freeze(u)})}finally{await n()}}async snapshot(t={}){return this.#t=await this.#s(),this.#t.snapshot(t)}async page(t){return this.#t=await this.#s(),this.#t.page(t)}async*stream(t={}){this.#t=await this.#s(),yield*this.#t.stream(t)}async project(t,r,n={}){return this.#t=await this.#s(),this.#t.project(t,r,n)}async#s(){let t=await ue(this.#e);try{let r=await D(this.#e,this.#i);return(await le(r,this.#n,this.#r)).log}finally{await t()}}};(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3a33af50-3d2c-57bb-884a-4d5394599ba2")}catch{}})();function $n(e,t,r,n,s,i){if(e.seen.has(t))return"skip";if(e.cursorFound&&e.affected.length>=i)return"truncate";e.seen.add(t),e.parents.set(t,r.id);let o=r.depth+1;return e.queue.push({id:t,depth:o}),e.cursorFound?(e.affected.push({id:t,distance:o,path:Un(n,t,e.parents)}),"continue"):(e.cursorFound=t===s,"skip")}function Mn(e,t,r,n){let s=A("graph impact",{root:e,direction:r,kinds:[...t.kinds??[]].sort(),max_depth:Number.isFinite(n)?n:"unbounded"});return{fingerprint:s,after:t.after===void 0?void 0:mt(t.after,s)}}function K(e,t,r){e.get(t).add(r)}function pe(e){return new Map(e.map(t=>[t,new Set]))}function Rt(e){for(let t of e)t.sort();return e.sort((t,r)=>r.length-t.length||t[0].localeCompare(r[0]))}function fe(e){if(Array.isArray(e))return e.map(r=>fe(r));if(e===null||typeof e!="object")return e;let t=e.toJSON;return typeof t=="function"?fe(t.call(e)):Object.fromEntries(Object.entries(e).sort(([r],[n])=>r.localeCompare(n)).map(([r,n])=>[r,fe(n)]))}function St(e){return JSON.stringify(fe(e))}function jn(e,t,r,n){let s=[{id:e,expanded:!1}];for(;s.length>0;){let i=s.pop();if(i.expanded){n.push(i.id);continue}if(r.has(i.id))continue;r.add(i.id),s.push({id:i.id,expanded:!0});let o=[...t.get(i.id)].sort().reverse();for(let d of o)r.has(d)||s.push({id:d,expanded:!1})}}function Pn(e,t){let r=new Set,n=[];for(let s of e)r.has(s)||jn(s,t,r,n);return n}function Fn(e,t){let r=new Set,n=[];for(let s of[...e].reverse()){if(r.has(s))continue;let i=[],o=[s];for(r.add(s);o.length>0;){let d=o.pop();i.push(d);for(let c of t.get(d))r.has(c)||(r.add(c),o.push(c))}n.push(i)}return Rt(n)}function Dt(e,t){let r=pe(e);for(let[n,s]of t)for(let i of s)K(r,i,n);return Fn(Pn(e,t),r)}function Gn(e,t){let r=pe(e.nodes());for(let n of e.edges()){let s=t.require(n.kind);if(!s.ordering)continue;let i=(s.precedence??"source_before_target")==="source_before_target";K(r,i?n.source:n.target,i?n.target:n.source)}return r}function qn(e,t){let r=new Map(e.map(i=>[i,0]));for(let i of t.values())for(let o of i)r.set(o,r.get(o)+1);let n=e.filter(i=>r.get(i)===0).sort(),s=[];for(;n.length>0;){s.push(n);let i=[];for(let o of n)for(let d of t.get(o)){let c=r.get(d)-1;r.set(d,c),c===0&&i.push(d)}n=i.sort()}return s}function Bn(e,t){let r=new Map(e.map(o=>[o,0])),n=new Map;for(let o of e)for(let d of t.get(o)){if(!r.has(d))continue;let c=r.get(o)+1,a=n.get(d);(c>r.get(d)||c===r.get(d)&&(a===void 0||o.localeCompare(a)<0))&&(r.set(d,c),n.set(d,o))}let s=[...e].sort((o,d)=>r.get(d)-r.get(o)||o.localeCompare(d))[0],i=s===void 0?[]:[s];for(;i[0]!==void 0&&n.has(i[0]);)i.unshift(n.get(i[0]));return{depth:Object.fromEntries(r),path:i}}function Un(e,t,r){let n=[t],s=t;for(;s!==e;)s=r.get(s),n.push(s);return n.reverse()}function ge(e,t={}){let r=t.registry??E(),n=[...e.nodes()],s=Gn(e,r),i=qn(n,s),o=i.flat(),d=o.length===n.length,c=d?[]:Dt(n,s).filter(u=>u.length>1||s.get(u[0]).has(u[0])),a=Bn(o,s);return{exact:!0,acyclic:d,order:o,layers:i,frontier:i[0]??[],depth:a.depth,criticalPath:a.path,criticalPathLength:Math.max(0,a.path.length-1),cycles:c,provenance:{algorithm:"kahn-longest-path",edgeFamily:"ordering"}}}function Ot(e,t,r={}){let n=r.direction??"outgoing",s=r.maxDepth??Number.POSITIVE_INFINITY,i=r.limit??Number.POSITIVE_INFINITY,{fingerprint:o,after:d}=Mn(t,r,n,s),c={queue:[{id:t,depth:0}],seen:new Set([t]),parents:new Map,affected:[],cursorFound:d===void 0||d===t},a=0,u=0,f=!1,l=!1;e:for(let p=0;p<c.queue.length;p+=1){r.signal?.throwIfAborted();let g=c.queue[p];a+=1;let h=e.adjacency(g.id,{direction:n,kinds:r.kinds,signal:r.signal});if(u+=h.meta.inspectedEdges,g.depth>=s){h.value.some(y=>!c.seen.has(y))&&(f=!0);continue}for(let y of h.value)if($n(c,y,g,t,d,i)==="truncate"){f=!0,l=!0;break e}}if(!c.cursorFound)throw new TypeError(`Unknown impact cursor item: ${d}`);return{root:t,affected:c.affected,exact:!0,truncated:f,...l?{nextCursor:ie(o,c.affected.at(-1)?.id??t)}:{},cost:{visitedNodes:a,inspectedEdges:u}}}function Lt(e){let t=[...e.nodes()],r=pe(t),n=pe(t);for(let c of e.edges())K(r,c.source,c.target),K(r,c.target,c.source),K(n,c.source,c.target);let s=[],i=new Set;for(let c of t){if(i.has(c))continue;let a=[],u=[c];for(i.add(c);u.length>0;){let f=u.pop();a.push(f);for(let l of r.get(f))i.has(l)||(i.add(l),u.push(l))}s.push(a)}let o=t.map(c=>({id:c,degree:r.get(c).size})),d=Math.max(0,...o.map(({degree:c})=>c));return{components:Rt(s),stronglyConnected:Dt(t,n),orphans:o.filter(({degree:c})=>c===0).map(({id:c})=>c),hubs:o.filter(({degree:c})=>c>0&&c===d),exact:!0,provenance:{algorithm:"component-degree",edgeFamily:"all"}}}function Ei(e,t){let r=new Map(e.edges.map(s=>[St(s),s])),n=new Map(t.edges.map(s=>[St(s),s]));return{fromVersion:e.version,toVersion:t.version,added:[...n].filter(([s])=>!r.has(s)).map(([,s])=>s),removed:[...r].filter(([s])=>!n.has(s)).map(([,s])=>s),unchangedCount:[...r.keys()].filter(s=>n.has(s)).length,exact:!0}}import{createHash as zn}from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="dea35fb9-9f9f-56ce-afc0-f4dc993012c3")}catch{}})();var Kn=64,Wn=8;function Vn(e,t){let r=(e.dependencies??[]).map(n=>{if(typeof n!="object"||n===null)return"";let s=n;return`${typeof s.kind=="string"?s.kind:"related"}:${typeof s.id=="string"?s.id:""}`}).sort().join(",");return[e.id,e.title,e.status,t(e.status)?"1":"0",typeof e.type=="string"?e.type.trim():"",e.parent??"",e.blocked_by??"",r].join("\0")}function he(e,t=n=>n==="closed"||n==="canceled",r=E()){let n=e.filter(i=>typeof i?.id=="string"&&i.id.trim().length>0).map(i=>Vn(i,t)).sort(),s=r.list().map(i=>U(i)).sort();return zn("sha256").update(n.join("")).update("").update(s.join("")).digest("hex")}function At(e,t,r){let n=t??r;if(!Number.isInteger(n)||n<1)throw new TypeError(`Invalid ${e} bound: ${String(t)}`);return n}var ze=class{#e=new Map;#n;#r;constructor(t={}){this.#n=At("maxResultsPerWorkspace",t.maxResultsPerWorkspace,Kn),this.#r=At("maxWorkspaces",t.maxWorkspaces,Wn)}lookup(t,r,n){let s=this.#e.get(t),i=!0;(s===void 0||s.fingerprint!==r)&&(s={fingerprint:r,assembly:n(),results:new Map},i=!1,!this.#e.has(t)&&this.#e.size>=this.#r&&this.#e.delete(this.#e.keys().next().value)),this.#e.delete(t),this.#e.set(t,s);let o=s,d=this.#n;return{assembly:o.assembly,assemblyReused:i,fingerprint:r,memoize(c,a){let u=o.results.get(c);if(u!==void 0||o.results.has(c))return o.results.delete(c),o.results.set(c,u),{value:structuredClone(u),reused:!0};let f=a();return o.results.size>=d&&o.results.delete(o.results.keys().next().value),o.results.set(c,structuredClone(f)),{value:f,reused:!1}}}}clear(){this.#e.clear()}},Nt=new ze;function me(){return Nt}function Ri(){Nt.clear()}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="31a800f7-1374-5e7c-ad23-ae3d8ebcebe0")}catch{}})();var Hn=["prerequisite","dependent","ancestor","descendant","provenance","related"],Jn=new TextEncoder;function Ke(e,t,r){let n=e??t;if(!Number.isInteger(n)||n<1)throw new TypeError(`Relationship context ${r} must be positive`);return n}function ye(e){return Math.max(1,Math.ceil(Jn.encode(JSON.stringify(e)).byteLength/4))}function We(e,t,r){let n=r.resolve(e.kind);if(n?.ordering){let i=(n.precedence??"source_before_target")==="source_before_target"?e.source:e.target;return t===i?"prerequisite":"dependent"}if(n?.hierarchy){let i=(n.hierarchyDirection??"source_parent")==="source_parent"?e.source:e.target;return t===i?"ancestor":"descendant"}return e.kind==="discovered_from"||e.kind==="incident_from"?"provenance":"related"}function Xn(e,t,r,n){let s=e.filter(i=>i.source===t&&i.target===r||i.target===t&&i.source===r).map(i=>We(i,r,n));return[...new Set(s)].sort()}function Yn(e){return Hn.find(t=>e.includes(t))}function Qn(e,t,r,n){let s=n.direction??"both",i=n.maxDepth??3;if(!Number.isInteger(i)||i<0)throw new TypeError("Relationship context maxDepth must be non-negative");let o=new Set([t]),d=[{id:t,distance:0}],c=[],a=0,u=!1;for(let f=0;f<d.length;f+=1){n.signal?.throwIfAborted();let l=d[f];if(l.distance>=i&&u)continue;let p=e.neighborEdges(l.id,{direction:s,kinds:n.kinds,signal:n.signal});if(a+=p.meta.inspectedEdges,l.distance>=i){p.value.some(g=>!o.has(g.id))&&(u=!0);continue}for(let{id:g,edge:h}of p.value){if(o.has(g))continue;o.add(g);let y={id:g,distance:l.distance+1,via:l.id,role:We(h,g,r)};c.push(y),d.push(y)}}return c.sort((f,l)=>f.distance-l.distance||f.id.localeCompare(l.id)),{rows:c,visitedNodes:d.length,inspectedEdges:a,depthTruncated:u}}function Zn(e,t,r,n){let s={prerequisite:0,dependent:0,ancestor:0,descendant:0,provenance:0,related:0},i=e.neighborEdges(t,{direction:n.direction??"both",kinds:n.kinds,signal:n.signal}).value;for(let{id:o,edge:d}of i)s[We(d,o,r)]+=1;return{directEdges:s,directTotal:i.length,rootEdges:i.map(({edge:o})=>o)}}function er(e){let t=[],r=e.initialTokens;for(let n of e.candidates){if(t.length>=e.nodeLimit)break;let s=n.distance===1?Xn(e.rootEdges,e.rootId,n.id,e.registry):[],i={...e.details.get(n.id)??{id:n.id},distance:n.distance,role:s.length>0?Yn(s):n.role,via:n.via,reasons:s.length>0?s:[`${n.role} via ${n.via} (depth ${n.distance})`]},o=ye(i);if(r+o>e.tokenBudget)break;t.push(i),r+=o}if(e.candidates.length>0&&t.length===0)throw new TypeError("Relationship context tokenBudget cannot fit one node");return{nodes:t,usedTokens:r}}function tr(e){let t=e.options.kinds?new Set(e.options.kinds.map(i=>e.registry.require(i).kind)):void 0,r=e.graph.edges().filter(i=>{if(!e.included.has(i.source)||!e.included.has(i.target))return!1;if(t===void 0||t.has(i.kind))return!0;let o=e.registry.resolve(i.kind)?.inverse;return o!==void 0&&t.has(o)}),n=[],s=e.initialTokens;for(let i of r){if(n.length>=e.edgeLimit)break;let o=ye(i);if(s+o>e.tokenBudget)break;n.push(i),s+=o}return{edges:n,usedTokens:s,candidateCount:r.length}}function $t(e,t,r,n={}){if(!e.nodes().includes(t))throw new TypeError(`Relationship node not found: ${t}`);let s=Ke(n.nodeLimit,20,"nodeLimit"),i=Ke(n.edgeLimit,40,"edgeLimit"),o=Ke(n.tokenBudget,1200,"tokenBudget"),d=n.registry??E(),c=new Map(r.map(L=>[L.id,L])),a=c.get(t)??{id:t},{evidence:u=[],...f}=a,l=[...u],p=Qn(e,t,d,n),{rootEdges:g,...h}=Zn(e,t,d,n),y=A("relationship-context",{rootId:t,direction:n.direction??"both",kinds:[...n.kinds??[]].sort(),maxDepth:n.maxDepth??3}),b=yt(p.rows,n.cursor,y,({id:L})=>L),m=p.rows.slice(b),_=ye(f)+ye(l);if(_>o)throw new TypeError("Relationship context tokenBudget cannot fit root and evidence");let T=er({candidates:m,details:c,rootEdges:g,rootId:t,registry:d,nodeLimit:s,tokenBudget:o,initialTokens:_}),{nodes:k}=T,J=new Set([t,...k.map(({id:L})=>L)]),F=tr({graph:e,included:J,options:n,registry:d,edgeLimit:i,tokenBudget:o,initialTokens:T.usedTokens}),{edges:G,usedTokens:Tn}=F,X=b+k.length,Ae=X<p.rows.length,ft=k.at(-1),Ne=F.candidateCount-G.length,pt=p.depthTruncated||Ae||Ne>0,Cn={rootId:t,...f.status===void 0?{}:{rootStatus:f.status},...h,discoveredNodes:p.rows.length,returnedNodes:k.length,returnedEdges:G.length,omittedNodes:p.rows.length-X,omittedEdges:Ne,evidenceCount:l.length,hasMore:Ae};return{root:f,summary:Cn,nodes:k,edges:G,evidence:l,meta:{exact:!0,truncated:pt,completeness:pt?"truncated":"complete",nodeLimit:s,edgeLimit:i,tokenBudget:o,usedTokens:Tn,visitedNodes:p.visitedNodes,inspectedEdges:p.inspectedEdges,omittedNodes:p.rows.length-X,omittedEdges:Ne,...Ae&&ft?{nextCursor:ie(y,ft.id,X-1)}:{}}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c0fb747e-1f9f-55c4-808b-b77d3a881f87")}catch{}})();var nr=5,rr=1e4,sr=8;function Ve(e,t){if(!Number.isFinite(t)||!Number.isInteger(t)||t<0)throw new TypeError(`Invalid path ${e} bound: ${String(t)}`)}function _e(e,t){return t.hierarchyDirection==="target_parent"?e.target:e.source}function W(e,t){return(t.precedence??"source_before_target")==="target_before_source"?e.target:e.source}function be(e,t){let r=W(e,t);return{predecessor:r,successor:r===e.source?e.target:e.source}}function ir(e,t,r){if(t===void 0)return;let n=e.registry(),s=new Set;for(let i of t){let o=n.require(i);if(!o[r])throw new TypeError(`Relationship kind ${o.kind} is not a ${r} kind`);s.add(o.kind)}return s}function or(e,t,r,n,s){let i=e.registry(),o=e.neighborEdges(t,{direction:"both",...r===void 0?{}:{kinds:[...r]}}),d=[],c=new Set;for(let a of o.value){let u=i.require(a.edge.kind);u[n]&&s(a,u,t)&&(c.has(a.id)||(c.add(a.id),d.push(a.id)))}return{neighbors:d,inspectedEdges:o.meta.inspectedEdges}}function dr(e,t,r,n,s,i){if(t>=r)return e.neighbors.some(o=>!i.seen.has(o))&&(i.truncated=!0),!1;for(let o of e.neighbors)if(!i.seen.has(o)){if(i.seen.add(o),i.queue.push({id:o,depth:t+1}),!i.resumed){o===s&&(i.resumed=!0);continue}if(i.value.length>=n)return i.truncated=!0,!0;i.value.push(o)}return!1}function we(e,t,r,n,s){if(!e.hasNode(t))throw new TypeError(`Relationship node not found: ${t}`);let i=ir(e,r.kinds,n),o=r.limit??Number.POSITIVE_INFINITY,d=r.maxDepth??Number.POSITIVE_INFINITY,c=r.after,a={seen:new Set([t]),value:[],queue:[{id:t,depth:0}],resumed:c===void 0,truncated:!1},u=0,f=0;for(let l=0;l<a.queue.length;l+=1){r.signal?.throwIfAborted();let p=a.queue[l];u+=1;let g=or(e,p.id,i,n,s);if(f+=g.inspectedEdges,dr(g,p.depth,d,o,c,a))break}if(!a.resumed)throw new TypeError(`Traversal cursor not found in sequence: ${c}`);return{value:a.value,meta:{visitedNodes:u,inspectedEdges:f,truncated:a.truncated,nextCursor:a.value.at(-1)}}}function Mt(e,t){if(!e.hasNode(t))throw new TypeError(`Relationship node not found: ${t}`)}function jt(e,t,r,n,s){let i=e.neighborEdges(t.nodes.at(-1),{direction:n,...r.kinds===void 0?{}:{kinds:r.kinds}});return s.inspectedEdges+=i.meta.inspectedEdges,i.value.filter(o=>!t.nodeSet.has(o.id))}function cr(e,t,r,n,s,i,o){for(let d of jt(e,t,n,s,o)){let c=[...t.nodes,d.id],a=new Set(t.nodeSet).add(d.id),u=[...t.edges,d.edge];if(d.id===r){if(o.value.push({nodes:c,edges:u,length:u.length}),o.value.length>=i)return!0}else o.queue.push({nodes:c,nodeSet:a,edges:u})}return!1}function Pt(e,t,r={}){return we(e,t,r,"hierarchy",(n,s)=>_e(n.edge,s)===n.id)}function Ft(e,t,r={}){return we(e,t,r,"hierarchy",(n,s,i)=>_e(n.edge,s)===i)}function Gt(e,t,r={}){return we(e,t,r,"ordering",(n,s)=>W(n.edge,s)===n.id)}function qt(e,t,r={}){return we(e,t,r,"ordering",(n,s,i)=>W(n.edge,s)===i)}function ar(e,t,r,n,s,i,o,d){let c={value:[],queue:[{nodes:[t],nodeSet:new Set([t]),edges:[]}],inspectedEdges:0},a=0,u=!1,f=s+1;for(let l=0;l<c.queue.length;l+=1){if(n.signal?.throwIfAborted(),c.value.length>=f||a>=i){u=!0;break}let p=c.queue[l];if(a+=1,p.edges.length>=o){jt(e,p,n,d,c).length>0&&(u=!0);continue}if(cr(e,p,r,n,d,f,c)){u=!0;break}}return{value:c.value.slice(0,s),meta:{visitedNodes:a,inspectedEdges:c.inspectedEdges,truncated:u}}}function Bt(e,t,r,n={}){Mt(e,t),Mt(e,r);let s=n.maxPaths??nr,i=n.maxVisitedPaths??rr,o=n.maxDepth??sr;Ve("maxPaths",s),Ve("maxVisitedPaths",i),Ve("maxDepth",o);let d=n.direction??"outgoing";n.signal?.throwIfAborted();for(let c of n.kinds??[])e.registry().require(c);return t===r?s===0?{value:[],meta:{visitedNodes:1,inspectedEdges:0,truncated:!0}}:{value:[{nodes:[t],edges:[],length:0}],meta:{visitedNodes:1,inspectedEdges:0,truncated:!1}}:ar(e,t,r,n,s,i,o,d)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="24898402-1568-5b05-9072-f89dd91f25a6")}catch{}})();var ur=16,lr=2,fr=8;function ve(e,t){if(!Number.isInteger(t)||t<1)throw new TypeError(`Invalid ${e} bound: ${String(t)}`)}function ke(e,t,r){let n=e.registry(),s=t===void 0?void 0:new Set(t.map(i=>n.require(i).kind));for(let i of e.edges()){if(i.source===i.target)continue;let o=n.require(i.kind);s!==void 0&&!(s.has(o.kind)||o.inverse!==void 0&&s.has(o.inverse))||r(i,o)}}function pr(e,t){let r=new Map;ke(e,t,n=>{Ut(r,n.source,n.target),Ut(r,n.target,n.source)});for(let n of r.values())n.sort();return r}function Ut(e,t,r){let n=e.get(t);n===void 0?e.set(t,[r]):n.push(r)}function gr(e,t){let r=new Map;for(let i of e){let o=t.get(i);r.set(o,(r.get(o)??0)+1)}let n,s=0;for(let[i,o]of r)(o>s||o===s&&i<n)&&(n=i,s=o);return n}function hr(e,t){let r=new Map;for(let[s,i]of e){let o=r.get(i);o===void 0?r.set(i,[s]):o.push(s)}let n=[];for(let s of r.values())s.length<t||(s.sort(),n.push({representative:s[0],size:s.length,members:s}));return n.sort((s,i)=>i.size-s.size||s.representative.localeCompare(i.representative))}function zt(e,t={}){let r=t.maxIterations??ur,n=t.minSize??lr;ve("maxIterations",r),ve("minSize",n);let s=pr(e,t.kinds),i=e.nodes(),o=new Map(i.map(f=>[f,f])),d=0,c=!1,a=0,u=0;for(;d<r&&!c;){t.signal?.throwIfAborted(),d+=1,c=!0;for(let f of i){a+=1;let l=s.get(f);if(l===void 0)continue;u+=l.length;let p=gr(l,o);p!==o.get(f)&&(o.set(f,p),c=!1)}}return{value:{communities:hr(o,n),iterations:d,converged:c},meta:{visitedNodes:a,inspectedEdges:u,truncated:!c}}}function xe(e){return e.direction==="directed"&&(e.ordering||e.hierarchy)}function Ee(e){return e.inverse!==void 0&&e.inverse<e.kind?e.inverse:e.kind}function Ie(e,t){return(t.hierarchy?_e(e,t):e.source===W(e,t)?e.target:e.source)===e.target?{from:e.source,to:e.target}:{from:e.target,to:e.source}}function mr(e,t){if(t===void 0)return;let r=e.registry(),n=new Set;for(let s of t){let i=r.require(s);if(!xe(i))throw new TypeError(`Relationship kind ${i.kind} is not a directed ordering or hierarchy kind`);n.add(Ee(i))}return n}function yr(e,t){let r=e.registry(),n=new Map;for(let s of e.edges()){let i=r.require(s.kind);if(!xe(i))continue;let o=Ee(i);if(t!==void 0&&!t.has(o))continue;let d=Ie(s,i);if(d.from===d.to)continue;let c=n.get(o);c===void 0&&(c={adjacency:new Map,records:[]},n.set(o,c));let a=c.adjacency.get(d.from);a===void 0?c.adjacency.set(d.from,new Set([d.to])):a.add(d.to),c.records.push({...d,edge:s})}return n}function _r(e){let t=new Map;for(let[r,n]of e.adjacency)t.set(r,[...n].sort());return t}function br(e,t,r,n){let s=[n];for(let i=r;i!==t;i=e.get(i))s.push(i);return s.push(t),s.reverse()}function wr(e,t,r,n,s,i){for(let o of e.get(r.id)??[])if(i.inspectedEdges+=1,!(r.depth===0&&o===t.to)&&!n.has(o)){if(n.set(o,r.id),o===t.to)return br(n,t.from,r.id,o);s.push({id:o,depth:r.depth+1})}}function vr(e,t,r,n){let s=new Map([[t.from,t.from]]),i=[{id:t.from,depth:0}];for(let o=0;o<i.length;o+=1){let d=i[o];if(n.visitedNodes+=1,d.depth>=r)continue;let c=wr(e,t,d,s,i,n);if(c!==void 0)return c}}function M(e,t={}){let r=t.maxDepth??fr;ve("maxDepth",r),t.limit!==void 0&&ve("limit",t.limit);let n=t.limit??Number.POSITIVE_INFINITY,s=mr(e,t.kinds),i=yr(e,s),o=[],d={visitedNodes:0,inspectedEdges:0},c=!1;e:for(let a of[...i.keys()].sort()){let u=i.get(a),f=_r(u);for(let l of u.records){t.signal?.throwIfAborted();let p=vr(f,l,r,d);if(p!==void 0){if(o.length>=n){c=!0;break e}o.push({edge:l.edge,witness:p})}}}return{value:o,meta:{visitedNodes:d.visitedNodes,inspectedEdges:d.inspectedEdges,truncated:c}}}function kr(e,t,r,n,s){let i=new Set,o=[];for(let d of r){if(d.id===e||i.has(d.id))continue;if(!s.seen.has(d.id)){if(t>=n){s.truncated=!0;continue}s.seen.add(d.id),s.queue.push({id:d.id,depth:t+1})}i.add(d.id),o.push(d.id);let c=s.predecessors.get(d.id);c===void 0&&(c=new Set,s.predecessors.set(d.id,c)),c.add(e)}return o}function xr(e,t,r){let n=r.direction??"outgoing",s=r.maxDepth??Number.POSITIVE_INFINITY,i=[],o=new Map,d={seen:new Set([t]),queue:[{id:t,depth:0}],predecessors:new Map,truncated:!1},c=0;for(let a=0;a<d.queue.length;a+=1){r.signal?.throwIfAborted();let{id:u,depth:f}=d.queue[a];i.push(u);let l=e.neighborEdges(u,{direction:n,...r.kinds===void 0?{}:{kinds:r.kinds}});c+=l.meta.inspectedEdges,o.set(u,kr(u,f,l.value,s,d))}return{order:i,successors:o,predecessors:d.predecessors,inspectedEdges:c,truncated:d.truncated}}function Er(e,t){let r=[],n=new Set([t]),s=[{id:t,index:0}];for(;s.length>0;){let i=s.at(-1),o=e.successors.get(i.id);if(i.index<o.length){let d=o[i.index];i.index+=1,n.has(d)||(n.add(d),s.push({id:d,index:0}))}else r.push(i.id),s.pop()}return r.reverse()}function Ir(e,t,r,n){let s=e,i=t;for(;s!==i;){for(;n.get(s)>n.get(i);)s=r.get(s);for(;n.get(i)>n.get(s);)i=r.get(i)}return s}function Tr(e,t,r){let n;for(let s of[...e].sort())t.has(s)&&(n=n===void 0?s:Ir(n,s,t,r));return n}function Cr(e,t,r,n,s){let i=new Map([[t,t]]),o=!0;for(;o;){o=!1;for(let d of r){if(s?.throwIfAborted(),d===t)continue;let c=Tr(e.predecessors.get(d),i,n);c!==void 0&&i.get(d)!==c&&(i.set(d,c),o=!0)}}return i}function Kt(e,t,r={}){if(!e.hasNode(t))throw new TypeError(`Relationship node not found: ${t}`);if(r.maxDepth!==void 0&&(!Number.isInteger(r.maxDepth)||r.maxDepth<0))throw new TypeError(`Invalid maxDepth bound: ${String(r.maxDepth)}`);let n=xr(e,t,r),s=Er(n,t),i=new Map(s.map((a,u)=>[a,u])),o=Cr(n,t,s,i,r.signal),d=new Map(s.map(a=>[a,1]));for(let a=s.length-1;a>=0;a-=1){let u=s[a];if(u===t)continue;let f=o.get(u);d.set(f,d.get(f)+d.get(u))}let c=s.filter(a=>a!==t).map(a=>({id:a,idom:o.get(a),dominatedCount:d.get(a)-1})).sort((a,u)=>u.dominatedCount-a.dominatedCount||a.id.localeCompare(u.id));return{value:{root:t,reachableCount:n.order.length,rows:c},meta:{visitedNodes:n.order.length,inspectedEdges:n.inspectedEdges,truncated:n.truncated}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="348c9246-2fb9-529e-b627-f60c901a6cf2")}catch{}})();function Wt(e){return Math.round(e*1e6)/1e6}function Vt(e,t,r){let n=e.get(t);n===void 0?e.set(t,new Set([r])):n.add(r)}function Ht(e,t){let r=new Map(e.nodes().map(s=>[s,new Set]));ke(e,t,s=>{r.get(s.source).add(s.target),r.get(s.target).add(s.source)});let n=new Map;for(let[s,i]of r)n.set(s,[...i].sort());return n}function Sr(e,t){let r=new Map,n=new Map;return ke(e,t,(s,i)=>{if(!i.ordering)return;let{predecessor:o,successor:d}=be(s,i);Vt(n,o,d),Vt(r,d,o)}),{incoming:r,outgoing:n}}function Rr(e,t,r){let n=new Map([[e,0]]),s=new Map([[e,1]]),i=new Map,o=[],d=[e],c=0,a=0;for(let u=0;u<d.length;u+=1){let f=d[u];r.visitedNodes+=1,o.push(f);let l=n.get(f);f!==e&&(c+=1,a+=l);for(let p of t.get(f))if(r.inspectedEdges+=1,n.has(p)||(n.set(p,l+1),d.push(p)),n.get(p)===l+1){s.set(p,(s.get(p)??0)+s.get(f));let g=i.get(p);g===void 0?i.set(p,[f]):g.push(f)}}return{stack:o,sigma:s,predecessors:i,reachableCount:c,distanceSum:a}}function Dr(e,t,r){let n=new Map;for(let s=e.stack.length-1;s>=0;s-=1){let i=e.stack[s],o=(1+(n.get(i)??0))/e.sigma.get(i);for(let d of e.predecessors.get(i)??[])n.set(d,(n.get(d)??0)+e.sigma.get(d)*o);i!==t&&r.set(i,(r.get(i)??0)+(n.get(i)??0))}}function Or(e,t){return t<=1||e.reachableCount===0?0:e.reachableCount/(t-1)*(e.reachableCount/e.distanceSum)}function Lr(e,t,r,n,s){return{id:e,degree:t.get(e).length,inDegree:r.incoming.get(e)?.size??0,outDegree:r.outgoing.get(e)?.size??0,betweenness:Wt((n.get(e)??0)/2),closeness:Wt(s.get(e))}}function Jt(e,t={}){let r=Ht(e,t.kinds),n=Sr(e,t.kinds),s=e.nodes(),i=new Map,o=new Map,d={visitedNodes:0,inspectedEdges:0};for(let u of s){t.signal?.throwIfAborted();let f=Rr(u,r,d);o.set(u,Or(f,s.length)),Dr(f,u,i)}let c=0;for(let u of r.values())c+=u.length;let a=s.map(u=>Lr(u,r,n,i,o)).sort((u,f)=>f.betweenness-u.betweenness||f.degree-u.degree||u.id.localeCompare(f.id));return{value:{nodeCount:s.length,edgeCount:c/2,rows:a},meta:{visitedNodes:d.visitedNodes,inspectedEdges:d.inspectedEdges,truncated:!1}}}function Ar(e,t){return e<=t?{source:e,target:t}:{source:t,target:e}}function Nr(e,t,r){let s=t.get(e.node)[e.neighborIndex];if(e.neighborIndex+=1,r.inspectedEdges+=1,s!==e.parent){if(r.discovery.has(s)){r.low.set(e.node,Math.min(r.low.get(e.node),r.discovery.get(s)));return}return e.children+=1,r.discovery.set(s,r.timer),r.low.set(s,r.timer),r.timer+=1,{node:s,parent:e.node,neighborIndex:0,children:0}}}function $r(e,t,r){if(e.parent===null){e.children>1&&r.articulation.add(e.node);return}let n=e.parent,s=r.low.get(e.node);r.low.set(n,Math.min(r.low.get(n),s)),n!==t&&s>=r.discovery.get(n)&&r.articulation.add(n),s>r.discovery.get(n)&&r.bridges.push(Ar(n,e.node))}function Mr(e,t,r,n){r.discovery.set(e,r.timer),r.low.set(e,r.timer),r.timer+=1;let s=[{node:e,parent:null,neighborIndex:0,children:0}];for(;s.length>0;){n?.throwIfAborted();let i=s.at(-1);if(i.neighborIndex<t.get(i.node).length){let o=Nr(i,t,r);o!==void 0&&s.push(o)}else $r(i,e,r),s.pop()}}function Te(e,t={}){let r=Ht(e,t.kinds),n={discovery:new Map,low:new Map,timer:0,articulation:new Set,bridges:[],inspectedEdges:0};for(let s of e.nodes())n.discovery.has(s)||Mr(s,r,n,t.signal);return{value:{articulationPoints:[...n.articulation].sort(),bridges:n.bridges.sort((s,i)=>s.source.localeCompare(i.source)||s.target.localeCompare(i.target))},meta:{visitedNodes:n.discovery.size,inspectedEdges:n.inspectedEdges,truncated:!1}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f155ac72-64eb-5316-b016-954abd48c0e7")}catch{}})();function jr(e){let t=e.registry(),r=new Map,n=new Set;for(let s of e.edges()){let i=t.require(s.kind);if(!i.ordering)continue;let{predecessor:o,successor:d}=be(s,i);if(n.add(o),n.add(d),o===d)continue;let c=r.get(o);c===void 0?r.set(o,new Set([d])):c.add(d)}return{forward:r,participants:n}}function Pr(e,t,r,n){if(e===void 0)return n;let s=n;for(let i of e)t.has(i)&&(s=Math.min(s,r.get(i)));return s}function Fr(e,t,r){let n=r-t;return{id:e,earliestStart:t,earliestFinish:t+1,latestStart:r,latestFinish:r+1,slack:n,critical:n===0}}function Gr(e,t,r,n,s){let i=new Map;for(let o=e.length-1;o>=0;o-=1){let d=e[o],c=Pr(t.forward.get(d),n,i,s);i.set(d,c-1)}return e.map(o=>Fr(o,r[o],i.get(o))).sort((o,d)=>o.slack-d.slack||o.earliestStart-d.earliestStart||o.id.localeCompare(d.id))}function Xt(e,t={}){t.signal?.throwIfAborted();let r=ge(e,{registry:e.registry()}),n=jr(e),s=new Set(r.order),i=r.order.filter(a=>n.participants.has(a)),o=i.reduce((a,u)=>Math.max(a,r.depth[u]+1),0),d=Gr(i,n,r.depth,s,o),c=d.length>0;return{exact:!0,acyclic:r.acyclic,makespan:o,scheduledCount:d.length,criticalPath:c?r.criticalPath:[],criticalPathLength:c?r.criticalPathLength:0,cycles:r.cycles,rows:d,provenance:{algorithm:"critical-path-method",edgeFamily:"ordering",weighting:"unit"}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bc561e73-75b8-5ea7-a18c-da70fb991b69")}catch{}})();var Ce=["missing_reference_active","missing_reference_terminal","legacy_no_blocker_sentinel","ordering_cycle","legacy_ordering_cycle","ordering_storage_contradiction","legacy_ordering_storage_contradiction","duplicate_edge","legacy_duplicate_edge","duplicate_dependency_row","legacy_duplicate_dependency_row","stale_lifecycle_block","isolated_active_node","sparse_active_node"];(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1955b7a4-385d-5a5d-8856-6db9f94814aa")}catch{}})();var qr=25,Br="milestone",Ur="outcome milestone:",zr=new Set(["discovered_from","incident_from","supersedes","verifies"]);function Qe(e){return zr.has(e)}var Yt={error:0,warning:1,info:2};function Qt(e){return new Set((e??[]).filter(t=>typeof t=="string").map(t=>t.trim().toLowerCase()))}function Xe(e,t,r,n,s,i,o,d){let c=[...s].sort((a,u)=>a.localeCompare(u));return{code:e,severity:t,policy:r,message:n(c.length),count:c.length,sample:c.slice(0,i),sample_truncated:c.length>i,remediation:o,...d===void 0?{}:{evidence:[...d].sort((a,u)=>a.localeCompare(u)).slice(0,i)}}}function Kr(e){let t=e.graph.registry(),r=new Map;for(let n of e.graph.edges()){let s=t.require(n.kind);if(!s.ordering)continue;let[i,o]=(s.precedence??"source_before_target")==="target_before_source"?[n.target,n.source]:[n.source,n.target],d=r.get(i);d?d.push(o):r.set(i,[o])}for(let n of r.values())n.sort((s,i)=>s.localeCompare(i));return r}function en(e,t){t.indexes.set(e,t.nextIndex),t.lowLinks.set(e,t.nextIndex),t.nextIndex+=1,t.stack.push(e),t.onStack.add(e)}function Wr(e,t,r,n){let s=r.get(e.node)??[];if(e.neighborIndex>=s.length)return!1;let i=s[e.neighborIndex];return e.neighborIndex+=1,n.indexes.has(i)?n.onStack.has(i)&&n.lowLinks.set(e.node,Math.min(n.lowLinks.get(e.node),n.indexes.get(i))):(en(i,n),t.push({node:i,neighborIndex:0})),!0}function Vr(e,t,r,n){t.pop();let s=t.at(-1);if(s&&n.lowLinks.set(s.node,Math.min(n.lowLinks.get(s.node),n.lowLinks.get(e.node))),n.lowLinks.get(e.node)!==n.indexes.get(e.node))return;let i=[];for(;;){let o=n.stack.pop();if(n.onStack.delete(o),i.push(o),o===e.node)break}(i.length>1||i.length===1&&r.get(i[0])?.includes(i[0]))&&n.components.push(i.sort((o,d)=>o.localeCompare(d)))}function Ze(e){let t={indexes:new Map,lowLinks:new Map,onStack:new Set,stack:[],components:[],nextIndex:0},r=[...e.keys()].sort((n,s)=>n.localeCompare(s));for(let n of r){if(t.indexes.has(n))continue;let s=[{node:n,neighborIndex:0}];for(en(n,t);s.length>0;){let i=s.at(-1);Wr(i,s,e,t)||Vr(i,s,e,t)}}return t.components.sort((n,s)=>n[0].localeCompare(s[0]))}function He(e){return`${e.holder_id} -> ${e.target_id} (${e.kind})`}function x(e,t,r,n,s,i,o,d){t.length!==0&&e.push(Xe(n,s,i,o,t,r,d))}function Hr(e,t,r){let n=[],s=[...e.dangling.active,...e.dangling.legacy_terminal].filter(i=>!i.no_active_blocker_sentinel);return x(n,s.filter(i=>!t(i.holder_status)).map(He),r,"missing_reference_active","error","Active items must not reference absent targets; missing prerequisites distort scheduling.",i=>`${i} active dangling reference(s) to absent items`,"Restore or re-create the referenced item, or remove/retype the reference on the holder."),x(n,s.filter(i=>t(i.holder_status)).map(He),r,"missing_reference_terminal","info","Terminal items may retain historical references, but absent targets remain unexplainable context.",i=>`${i} terminal dangling reference(s) to absent items`,"Leave as history debt or clean up in a dedicated changelog-safe closed-item batch."),x(n,e.dangling.no_active_blocker_sentinels.map(He),r,"legacy_no_blocker_sentinel","info","The pre-structured-dependency no-active-blocker sentinel is retired; real edges carry blocker state.",i=>`${i} legacy no-active-blocker sentinel reference(s)`,"Delete the sentinel reference; blocker state is derived from blocked_by edges."),n}function Ye(e,t){let r=t.get(e);return r?!r.terminal:!0}function Se(e){return`${e.holder_id} -> ${e.target_id} (blocked_by scalar + ${e.dependency_kind} dependency)`}function Jr(e,t){let r=[],n=[];for(let i of e.orderingContradictions??[])(i.legacy_terminal?n:r).push(Se(i));let s=[];return x(s,r,t,"ordering_storage_contradiction","error","A scalar blocker and same-target structured ordering row must not assert opposite precedence.",i=>`${i} active scalar-versus-structured ordering contradiction(s)`,"Remove the structured dependency row that points the holder before its scalar blocker, or replace both representations with one unambiguous ordering edge."),x(s,n,t,"legacy_ordering_storage_contradiction","info","Terminal scalar-versus-structured ordering contradictions are exact historical storage defects with no live scheduling effect.",i=>`${i} terminal scalar-versus-structured ordering contradiction(s)`,"Remove the contradictory blocks dependency row in a dedicated changelog-safe closed-item batch; preserve the scalar blocker as the historical precedence record."),s}function Xr(e,t,r,n){let s=[],i=Kr(e);for(let c of Ze(i)){let a=c.some(l=>Ye(l,t)),u=new Set(c.map(l=>l.toLowerCase())),f=(e.orderingContradictions??[]).filter(l=>u.has(l.holder_id.toLowerCase())&&u.has(l.target_id.toLowerCase())).map(Se);s.push(a?Xe("ordering_cycle","error","Order-bearing relationship kinds must stay acyclic; a cycle makes every member unschedulable.",l=>`execution-order cycle across ${l} item(s)`,c,n,"Remove or retype one ordering edge inside the cycle, or split the work so precedence is linear.",f.length===0?void 0:f):Xe("legacy_ordering_cycle","info","Ordering cycles between exclusively terminal items are historical contradictions with no scheduling effect.",l=>`terminal-only execution-order cycle across ${l} item(s)`,c,n,"Leave as history debt, or clean up in a dedicated changelog-safe closed-item batch; never repair closed items ad hoc.",f.length===0?void 0:f))}let o=new Map;for(let[c,a]of i)for(let u of a){let f=o.get(u);f?f.push(c):o.set(u,[c])}let d=[...t.values()].filter(c=>!c.missing&&!c.terminal&&r(c.status)&&!(o.get(c.id)??[]).some(a=>{let u=t.get(a);return u===void 0||!u.terminal})).map(c=>c.id);return x(s,d,n,"stale_lifecycle_block","warning","A blocked lifecycle status must be backed by at least one open ordering predecessor.",c=>`${c} status-blocked item(s) with no open blocker edge`,'Add a local blocker edge, declare an external blocker with --dep "id=<external-ref>,kind=blocked_by,source_kind=external", or move the item back to an active status.'),s}function Re(e){let t=e.edges.map(r=>r.kind).sort((r,n)=>r.localeCompare(n));return`${e.from} -> ${e.to} (${t.join(" + ")})`}function et(e){let t=e.graph.registry(),r=new Map;for(let s of e.graph.edges()){let i=t.require(s.kind);if(!xe(i))continue;let o=Ie(s,i);if(o.from===o.to)continue;let d=`${Ee(i)}::${o.from}::${o.to}`,c=r.get(d);c?c.edges.push(s):r.set(d,{...o,edges:[s]})}let n=[...r.values()].filter(s=>s.edges.length>=2);for(let s of n)s.edges.sort((i,o)=>i.kind.localeCompare(o.kind));return n.sort((s,i)=>s.from.localeCompare(i.from)||s.to.localeCompare(i.to))}function Yr(e,t,r){let n=[],s=[];for(let o of et(e))(Ye(o.from,t)||Ye(o.to,t)?n:s).push(Re(o));let i=[];return x(i,n,r,"duplicate_edge","info","One semantic relationship should be stored once; parallel same-family spellings (reciprocal inverse pairs included) add no information and skew degree metrics.",o=>`${o} duplicated relationship(s) between active endpoints`,"Remove all but one stored spelling of the relationship; keep the canonical direction the holder declared first."),x(i,s,r,"legacy_duplicate_edge","info","Duplicated spellings between exclusively terminal items are historical noise with no scheduling effect.",o=>`${o} duplicated relationship(s) between terminal endpoints`,"Leave as history debt or clean up in a dedicated changelog-safe closed-item batch."),i}function Qr(e,t){let r=[],n=[];for(let i of e.duplicateRows??[])(i.legacy_terminal?n:r).push(`${i.holder_id} -> ${i.target_id} (${i.kind} x${i.occurrences})`);let s=[];return x(s,r,t,"duplicate_dependency_row","warning","One dependency row must be stored once per holder; identical repeated rows are a storage-layer defect invisible to the assembled graph.",i=>`${i} exactly duplicated stored dependency row(s) on active holder(s)`,"Remove the repeated rows so the dependency is stored exactly once; graph semantics are unchanged."),x(s,n,t,"legacy_duplicate_dependency_row","info","Identical repeated dependency rows on terminal holders are historical storage noise with no scheduling effect.",i=>`${i} exactly duplicated stored dependency row(s) on terminal holder(s)`,"Leave as history debt or clean up in a dedicated changelog-safe closed-item batch."),s}function Zr(e,t){let r=new Map;for(let n of e.graph.edges()){t?.throwIfAborted();let s=e.graph.registry().require(n.kind),i;if(s.hierarchy?i=Ie(n,s):s.kind==="implements"&&(i={from:n.source,to:n.target}),i===void 0)continue;let o=r.get(i.to)??new Set;o.add(i.from),r.set(i.to,o)}return r}function es(e,t,r){let n=new Set(e),s=[...e].sort();for(let i=0;i<s.length;i+=1){r?.throwIfAborted();for(let o of[...t.get(s[i])??[]].sort())n.has(o)||(n.add(o),s.push(o))}return n}function ts(e,t,r,n){let s=0,i=0,o=0,d=0;for(let p of e.values())if(n?.throwIfAborted(),!t.has(p.id)&&!(p.missing||p.status==="external")){if(p.terminal){o+=1,r.has(p.id)&&(d+=1);continue}r.has(p.id)?s+=1:i+=1}let c=s+i,a=o-d,u=s+d,f=i+a,l=u+f;return{active_outcome_reachable_nodes:s,active_outcome_unreachable_nodes:i,active_outcome_reachability_basis_points:c===0?0:Math.floor(s*1e4/c),terminal_nodes:o,terminal_outcome_reachable_nodes:d,terminal_outcome_unreachable_nodes:a,terminal_outcome_reachability_basis_points:o===0?0:Math.floor(d*1e4/o),outcome_reachable_nodes:u,outcome_unreachable_nodes:f,outcome_reachability_basis_points:l===0?0:Math.floor(u*1e4/l)}}function ns(e,t,r){let n=new Set(e.details.filter(i=>i.type?.toLowerCase()===Br&&i.title.trim().toLowerCase().startsWith(Ur)).map(i=>i.id)),s=es(n,Zr(e,r),r);return{outcome_nodes:n.size,...ts(t,n,s,r)}}function rs(e,t,r,n,s){e.active+=1;let i=t.type??"(untyped)",o=e.byType.get(i);o||(o={active:0,isolated:0,degree_leq_one:0},e.byType.set(i,o)),o.active+=1,!(r>1)&&(e.degreeLeqOne+=1,o.degree_leq_one+=1,r===0&&(e.isolated+=1,o.isolated+=1),!(n.has(t.id.toLowerCase())||s.has(i.toLowerCase()))&&(r===0?e.isolates.push(t.id):e.sparse.push(t.id)))}function ss(e,t,r,n,s,i,o){let d={active:0,missing:0,isolated:0,degreeLeqOne:0,isolates:[],sparse:[],byType:new Map};for(let m of e.graph.nodes()){o?.throwIfAborted();let _=t.get(m);if(_){if(_.missing){d.missing+=1;continue}_.terminal||rs(d,_,e.graph.incidentEdges(m).length,r,n)}}let{isolates:c,sparse:a}=d,u=[];x(u,c,s,"isolated_active_node","warning","Active work should be reachable from the graph unless explicitly declared a valid isolate.",m=>`${m} active item(s) with no relationships`,"Link the item to its parent, prerequisite, or origin \u2014 or register it as an exempt isolate."),x(u,a,s,"sparse_active_node","info","Active items with a single edge often miss an honest semantic partner; sparse is not automatically defective.",m=>`${m} active item(s) with exactly one relationship`,"Investigate for an honest second edge (story->task, defect family, cross-epic complement); do not fabricate one.");let f=e.graph.edges().length,l=M(e.graph,{signal:o}).value,p=new Set(l.map(({edge:m})=>`${m.source.toLowerCase()}\0${m.target.toLowerCase()}\0${m.kind}`));for(let m of e.orderingContradictions??[])p.add(`${m.holder_id.toLowerCase()}\0${m.target_id.toLowerCase()}\0${m.dependency_kind}`);let g=Object.fromEntries(Object.entries(i).sort(([m],[_])=>m.localeCompare(_))),h=Object.entries(g).reduce((m,[_,T])=>m+(Qe(_)?T:0),0),y=Te(e.graph,{signal:o}).value,b=ns(e,t,o);return{findings:u,profile:{nodes:e.graph.nodes().length,recorded_nodes:e.details.filter(m=>m.status!=="missing"&&m.status!=="external").length,edges:f,informative_edges:f-p.size,redundant_edges:l.length,ordering_contradiction_edges:e.orderingContradictions?.length??0,edge_basis:"deduplicated_directed",edges_by_kind:g,edge_share_by_kind:Object.fromEntries(Object.entries(g).map(([m,_])=>[m,_/f])),semantic_edges:h,semantic_edge_share:f===0?0:h/f,active_nodes:d.active,missing_nodes:d.missing,isolated_active_nodes:d.isolated,degree_leq_one_active_nodes:d.degreeLeqOne,coverage_by_type:Object.fromEntries([...d.byType.entries()].sort(([m],[_])=>m<_?-1:1)),articulation_points:y.articulationPoints.length,bridge_edges:y.bridges.length,...b,finding_subjects_by_code:Object.fromEntries(Ce.map(m=>[m,0]))}}}function De(e,t={}){let r=t.isTerminal??(l=>l==="closed"||l==="canceled"),n=t.isBlocked??(l=>l==="blocked"),s=t.maxSampleSize??qr;if(!Number.isInteger(s)||s<1)throw new TypeError(`Invalid audit sample bound: ${String(t.maxSampleSize)}`);let i=Qt(t.exemptIsolates),o=Qt(t.isolateExemptTypes),d=new Map(e.details.map(l=>[l.id,{id:l.id,status:l.status,missing:e.missingIdSet.has(l.id.toLowerCase()),terminal:r(l.status),...l.type===void 0?{}:{type:l.type}}]));t.signal?.throwIfAborted();let c={};for(let l of e.graph.edges())c[l.kind]=(c[l.kind]??0)+1;let a=Hr(e,r,s);t.signal?.throwIfAborted(),a.push(...Jr(e,s)),t.signal?.throwIfAborted(),a.push(...Xr(e,d,n,s)),t.signal?.throwIfAborted(),a.push(...Yr(e,d,s),...Qr(e,s)),t.signal?.throwIfAborted();let u=ss(e,d,i,o,s,c,t.signal);a.push(...u.findings),a.sort((l,p)=>Yt[l.severity]-Yt[p.severity]||l.code.localeCompare(p.code)||l.sample[0].localeCompare(p.sample[0]));let f=u.profile.finding_subjects_by_code;for(let l of a)f[l.code]+=l.count;return{findings:a,profile:{...u.profile,finding_subjects_by_code:f}}}function Je(e,t){let r=[...new Set([...Object.keys(e),...Object.keys(t)])].sort(),n={};for(let s of r){let i=(t[s]??0)-(e[s]??0);i!==0&&(n[s]=i)}return n}function Zt(e){return e.profile.coverage_by_type??{}}function is(e,t){let r={},n=Zt(e),s=Zt(t),i=[...new Set([...Object.keys(n),...Object.keys(s)])].sort();for(let o of i){let d=Object.assign({active:0,isolated:0,degree_leq_one:0},n[o]),c=Object.assign({active:0,isolated:0,degree_leq_one:0},s[o]),a={active:c.active-d.active,isolated:c.isolated-d.isolated,degree_leq_one:c.degree_leq_one-d.degree_leq_one};Object.values(a).some(u=>u!==0)&&(r[o]=a)}return r}function tn(e,t){let r=is(e,t),{edge_share_by_kind:n={},semantic_edges:s=0,semantic_edge_share:i=0}=e.profile,{edge_share_by_kind:o={},semantic_edges:d=0,semantic_edge_share:c=0}=t.profile,a=e.profile.recorded_nodes??e.profile.nodes,u=t.profile.recorded_nodes??t.profile.nodes,f=e.profile.informative_edges??e.profile.edges,l=t.profile.informative_edges??t.profile.edges,p=e.profile.redundant_edges??0,g=t.profile.redundant_edges??0,h=e.profile.ordering_contradiction_edges??0,y=t.profile.ordering_contradiction_edges??0;return{baseline_saved_at:e.saved_at,same_snapshot:e.fingerprint===t.fingerprint,affected_subjects_by_code:Je(e.affected_subjects_by_code,t.affected_subjects_by_code),profile:{nodes:t.profile.nodes-e.profile.nodes,recorded_nodes:u-a,edges:t.profile.edges-e.profile.edges,informative_edges:l-f,redundant_edges:g-p,ordering_contradiction_edges:y-h,active_nodes:t.profile.active_nodes-e.profile.active_nodes,missing_nodes:t.profile.missing_nodes-e.profile.missing_nodes,isolated_active_nodes:t.profile.isolated_active_nodes-e.profile.isolated_active_nodes,degree_leq_one_active_nodes:t.profile.degree_leq_one_active_nodes-e.profile.degree_leq_one_active_nodes,edges_by_kind:Je(e.profile.edges_by_kind,t.profile.edges_by_kind),edge_share_by_kind:Je(n,o),semantic_edges:d-s,semantic_edge_share:c-i,coverage_by_type:r}}}import nn from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9e4aa41d-fca4-5e55-ab2b-d99f06d90ae2")}catch{}})();var rn=1,tt=500,os=64,ds="graph-durable-cache";function sn(e){return de(e,ds,30,`graph-cache:${process.pid}`,!1,!1,3e3)}function H(e){return nn.join(e,"runtime","graph-cache.json")}function on(e){return nn.join(e,"runtime","graph-audit-baseline.json")}function nt(e){if(e!==null)try{let t=JSON.parse(e);return typeof t!="object"||t===null||t.version!==rn||typeof t.fingerprint!="string"||typeof t.saved_at!="string"||typeof t.results!="object"||t.results===null||Array.isArray(t.results)?void 0:t}catch{return}}async function rt(e,t){let r=await q(H(e)),n=nt(r),s=n?.fingerprint===t;return{exists:r!==null,fresh:s,results:s?n.results:{}}}async function st(e,t,r,n,s){let i=await sn(e);try{let o=nt(await q(H(e))),d=o?.fingerprint===t?o.results:{};delete d[n],d[n]=s;let c=Object.keys(d);for(let a of c.slice(0,Math.max(0,c.length-os)))delete d[a];await B(H(e),JSON.stringify({version:rn,fingerprint:t,saved_at:new Date().toISOString(),results:d})),r.results=d}finally{await i()}}async function it(e){let t=await sn(e);try{await gt(H(e))}finally{await t()}}async function dn(e,t){let r=H(e),n=await q(r),s=nt(n);return s===void 0?{exists:n!==null,fresh:!1,entry_count:0}:{exists:!0,fresh:s.fingerprint===t,entry_count:Object.keys(s.results).length,fingerprint:s.fingerprint.slice(0,12),saved_at:s.saved_at,bytes:Buffer.byteLength(n,"utf8")}}function ot(e,t){return t||e>=tt}function Oe(e){return j(e)&&Object.values(e).every(O)}function j(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function O(e){return Number.isInteger(e)&&Number(e)>=0}function cn(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1}function V(e,t){return e===void 0||t(e)}function cs(e){return j(e)&&Object.values(e).every(cn)}function as(e){return j(e)?Object.values(e).every(t=>j(t)&&[t.active,t.isolated,t.degree_leq_one].every(O)):!1}function us(e,t,r){let n=["recorded_nodes","informative_edges","redundant_edges","ordering_contradiction_edges"],s=n.filter(o=>e[o]!==void 0).length;if(s!==0&&s!==n.length||!n.every(o=>V(e[o],O)))return;let i={recorded_nodes:e.recorded_nodes??t,informative_edges:e.informative_edges??r,redundant_edges:e.redundant_edges??0,ordering_contradiction_edges:e.ordering_contradiction_edges??0};return i.recorded_nodes<=t&&i.informative_edges<=r&&i.redundant_edges<=r&&i.ordering_contradiction_edges<=r?i:void 0}function ls(e,t,r){let n=[...t,...r,"finding_subjects_by_code"],s=n.filter(i=>e[i]!==void 0).length;return s!==0&&s!==n.length?!1:t.every(i=>V(e[i],O))&&r.every(i=>V(e[i],O)&&(e[i]===void 0||Number(e[i])<=1e4))&&V(e.finding_subjects_by_code,Oe)}function fs(e,t,r,n){let s=us(e,r,n);if(s===void 0)return;let i=["articulation_points","bridge_edges","outcome_nodes","active_outcome_reachable_nodes","active_outcome_unreachable_nodes","terminal_nodes","terminal_outcome_reachable_nodes","terminal_outcome_unreachable_nodes","outcome_reachable_nodes","outcome_unreachable_nodes"],o=["active_outcome_reachability_basis_points","terminal_outcome_reachability_basis_points","outcome_reachability_basis_points"];if(!ls(e,i,o)||e.edge_basis!==void 0&&e.edge_basis!=="deduplicated_directed")return;let d=Oe(e.finding_subjects_by_code)?e.finding_subjects_by_code:{};return{edge_basis:"deduplicated_directed",...s,...Object.fromEntries(i.map(c=>[c,e[c]??0])),...Object.fromEntries(o.map(c=>[c,e[c]??0])),finding_subjects_by_code:Object.fromEntries(Ce.map(c=>[c,d[c]??t[c]??0]))}}function ps(e,t,r,n,s){let i=[r,n,s],o=i.filter(a=>a!==void 0).length;if(o===0)return{edge_share_by_kind:{},semantic_edges:0,semantic_edge_share:0};if(o!==i.length||!cs(r)||!O(n)||!cn(s))return;let d=Object.entries(t);if(d.reduce((a,[,u])=>a+u,0)!==e||Object.keys(r).length!==d.length||d.some(([a,u])=>r[a]!==(e===0?0:u/e)))return;let c=d.reduce((a,[u,f])=>a+(Qe(u)?f:0),0);if(!(n!==c||s!==(e===0?0:c/e)))return{edge_share_by_kind:r,semantic_edges:n,semantic_edge_share:s}}function gs(e){if(e!==null)try{let t=JSON.parse(e);if(!j(t))return;let r=t,n=r.profile;if(typeof r.saved_at!="string"||typeof r.fingerprint!="string")return;let s=r.affected_subjects_by_code;if(!Oe(s)||!j(n)||![n.nodes,n.edges,n.active_nodes,n.missing_nodes,n.isolated_active_nodes,n.degree_leq_one_active_nodes].every(O)||!Oe(n.edges_by_kind)||!V(n.coverage_by_type,as))return;let i=ps(n.edges,n.edges_by_kind,n.edge_share_by_kind,n.semantic_edges,n.semantic_edge_share);if(i===void 0)return;let o=fs(n,s,n.nodes,n.edges);if(o===void 0)return;let{coverage_by_type:d={}}=n;return{...r,profile:{...n,...i,...o,coverage_by_type:d}}}catch{return}}async function an(e){return gs(await q(on(e)))}async function un(e,t){await B(on(e),JSON.stringify(t))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1eb0e2cb-084a-5a54-b41c-29dfdd6d2f34")}catch{}})();var hs={missing_reference_active:{op:"investigate",confidence:"medium",rationale:"Restore or re-create the referenced item, or remove/retype the reference on the active holder; the correct fix depends on why the target is absent."},missing_reference_terminal:{op:"waive",confidence:"high",rationale:"Terminal-holder reference to an absent item is historical debt; waive it or clean it up only in a dedicated changelog-safe closed-item batch."},legacy_no_blocker_sentinel:{op:"remove",confidence:"high",rationale:"The pre-structured-dependency no-active-blocker sentinel is retired and carries no information; blocker state derives from blocked_by edges."},ordering_cycle:{op:"investigate",confidence:"low",rationale:"Every cycle member is unschedulable until one ordering edge is removed or retyped; the planner never chooses which edge to cut."},legacy_ordering_cycle:{op:"waive",confidence:"high",rationale:"Terminal-only ordering cycles have no scheduling effect; repairing them would mutate closed history (changelog drag)."},ordering_storage_contradiction:{op:"remove",confidence:"high",rationale:"The structured ordering row asserts the opposite precedence from the same-target scalar blocker; remove that exact dependency row or replace both representations with one unambiguous edge."},legacy_ordering_storage_contradiction:{op:"remove",confidence:"high",rationale:"The terminal holder contains a proven contradictory structured ordering row; remove it in a dedicated changelog-safe batch while preserving the scalar blocker as history."},duplicate_edge:{op:"remove",confidence:"high",rationale:"Parallel same-family spellings state one relationship twice; remove all but one stored spelling, keeping the holder's canonical direction."},legacy_duplicate_edge:{op:"waive",confidence:"high",rationale:"Duplicated spellings between terminal items are historical noise; waive or batch changelog-safe cleanup."},duplicate_dependency_row:{op:"remove",confidence:"high",rationale:"The identical dependency row is stored more than once on the holder; drop the repeats so the row exists exactly once \u2014 graph semantics are unchanged."},legacy_duplicate_dependency_row:{op:"waive",confidence:"high",rationale:"Repeated identical rows on terminal holders are storage noise; waive or clean up only in a changelog-safe closed-item batch."},stale_lifecycle_block:{op:"investigate",confidence:"medium",rationale:`Add a local ordering edge, declare an external blocker with --dep "id=<external-ref>,kind=blocked_by,source_kind=external", or move the item back to an active status; only the holder's owner knows which is true.`},isolated_active_node:{op:"investigate",confidence:"medium",rationale:"Link the item to its parent, prerequisite, or origin \u2014 or register it as an explicitly exempt isolate; the audit never fabricates an edge."},sparse_active_node:{op:"investigate",confidence:"low",rationale:"Investigate for an honest second edge (story-to-task, defect family, cross-epic complement); sparse is not automatically defective."}};function ln(e){return`${e.source} -${e.kind}-> ${e.target}`}function ms(e){let[t,...r]=e.edges;return r.map(n=>({op:"remove",code:"duplicate_edge",subject:ln(n),rationale:"This stored spelling restates the kept canonical edge of the same semantic family; removing it leaves the relationship stated exactly once.",evidence:[`keep: ${ln(t)}`,`group: ${Re(e)}`],confidence:"high"}))}function ys(e,t){if(e.code==="duplicate_edge")return e.sample.flatMap(n=>ms(t.get(n)));let r=hs[e.code];return e.sample.map(n=>({op:r.op,code:e.code,subject:n,rationale:r.rationale,evidence:[e.policy],confidence:r.confidence}))}function fn(e,t={}){let{redundancyLimit:r,...n}=t,s=De(e,n),i=new Map(et(e).map(a=>[Re(a),a])),o=s.findings.flatMap(a=>ys(a,i)),d=s.findings.some(a=>a.sample_truncated);t.signal?.throwIfAborted();let c=M(e.graph,{limit:r??t.maxSampleSize??25,...t.signal===void 0?{}:{signal:t.signal}});for(let a of c.value)o.push({op:"remove",code:"redundant_edge",subject:`${a.edge.source} -> ${a.edge.target} (${a.edge.kind})`,rationale:"The stored edge is implied by a longer same-family witness path; shortcut edges are sometimes deliberate emphasis, so confirm intent before removing.",evidence:[`witness: ${a.witness.join(" -> ")}`],confidence:"medium"});return d=d||c.meta.truncated,{steps:o,report:s,truncated:d,cost:{visitedNodes:c.meta.visitedNodes,inspectedEdges:c.meta.inspectedEdges}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ee0547d9-ae0f-5762-8bff-e25f0a3cd4d5")}catch{}})();var _s=["tree","graph","context"],bs=["none","repeated"],ws=["outgoing","incoming","both"],vs=32,ks=200,xs=400,Es=16e3;function Is(e){let t=e?.trim().toLowerCase()??"tree";if(_s.includes(t))return t;throw new v(`Invalid --format value "${e}". Use "tree", "graph", or "context".`,w.USAGE)}function I(e,t){if(e===void 0)return;let r=typeof e=="number"?e:Number(e.trim());if(!Number.isInteger(r)||r<1)throw new v(`Invalid --${t} value "${e}". Use a positive integer.`,w.USAGE);return r}function Le(e){if(e===void 0)return;let t=typeof e=="number"?e:Number(e.trim());if(!Number.isInteger(t)||t<0)throw new v(`Invalid --max-depth value "${e}". Use a non-negative integer.`,w.USAGE);return t}function Ts(e){let t=e?.trim().toLowerCase()??"none";if(bs.includes(t))return t;throw new v(`Invalid --collapse value "${e}". Use "none" or "repeated".`,w.USAGE)}function ct(e){let t=e?.trim().toLowerCase()??"both";if(ws.includes(t))return t;throw new v(`Invalid --direction value "${e}". Use "outgoing", "incoming", or "both".`,w.USAGE)}function at(e,t=E()){if(e===void 0)return;let r=(Array.isArray(e)?e:[e]).flatMap(s=>s.split(",")).map(s=>s.trim()).filter(s=>s.length>0);if(r.length===0)return;let n=new Set;for(let s of r){let i=t.resolve(s);if(!i){let o=t.list().map(d=>d.kind).join(", ");throw new v(`Invalid --kind value "${s}". Registered kinds: ${o}.`,w.USAGE)}n.add(i.kind)}return[...n].sort()}function Cs(e){if(!e||e.length===0)return[];let t=e.map(({id:n,kind:s})=>({id:n.trim(),kind:s.trim().toLowerCase()})).sort((n,s)=>{let i=n.kind.localeCompare(s.kind);return i!==0?i:n.id.localeCompare(s.id)}),r=new Map;for(let n of t){let s=`${n.kind.toLowerCase()}::${n.id.toLowerCase()}`;r.has(s)||r.set(s,{id:n.id,kind:n.kind})}return[...r.values()]}function Ss(e){return{id:e.id,title:e.title,type:e.type,status:e.status,dependencies:Cs(e.dependencies)}}function Rs(e){return re(new TextEncoder().encode(JSON.stringify({...e,dependencies:void 0})).byteLength)}function Ds(e,t,r,n,s,i,o,d,c){for(let a of t.dependencies){let u=Math.max(1,Math.ceil(JSON.stringify({from:e.id,to:a.id,kind:a.kind}).length/3));if(d.nodes>=d.nodeLimit){e.truncated=!0,d.reasons.add("node_limit");break}if(d.edges>=d.edgeLimit){e.truncated=!0,d.reasons.add("edge_limit");break}if(d.estimatedTokens+u>=d.tokenBudget){e.truncated=!0,d.reasons.add("token_budget");break}d.edges+=1,d.estimatedTokens+=u,e.dependencies.push(gn(a.id,r,n,s,i,o,d,c+1,a.kind))}}function Os(e,t,r,n,s,i,o,d){return o.estimatedTokens>=o.tokenBudget&&t?.dependencies.length?(e.truncated=!0,o.reasons.add("token_budget"),!0):!t||e.cycle?!0:n!==void 0&&d>=n?(t.dependencies.length>0&&(e.truncated=!0,o.reasons.add("max_depth")),!0):s==="repeated"&&i.has(r)?(e.collapsed=!0,!0):!1}function gn(e,t,r,n,s,i,o,d=0,c){let a=e.trim().toLowerCase(),u=t.get(a),f={id:u?.id??e,title:u?.title,type:u?.type,status:u?.status,via:c,missing:!u,cycle:r.has(a),dependencies:[]};if(o.nodes+=1,o.estimatedTokens+=Rs(f),Os(f,u,a,n,s,i,o,d))return f;s==="repeated"&&i.add(a);let l=new Set(r);return l.add(a),Ds(f,u,t,l,n,s,i,o,d),f}function pn(e,t){return!e||e.missing&&!t.missing?t:{...e,title:e.title??t.title,type:e.type??t.type,status:e.status??t.status}}function Ls(e){let t=new Map,r=new Map,n=[e];for(;n.length>0;){let d=n.pop();t.set(d.id,pn(t.get(d.id),{id:d.id,title:d.title,type:d.type,status:d.status,missing:d.missing}));for(let c of d.dependencies){t.set(c.id,pn(t.get(c.id),{id:c.id,title:c.title,type:c.type,status:c.status,missing:c.missing}));let a=c.via??"related",u=`${d.id}::${c.id}::${a}`;r.has(u)||r.set(u,{from:d.id,to:c.id,kind:a}),c.cycle||n.push(c)}}let s=[...t.values()].sort((d,c)=>d.id.localeCompare(c.id)),i=[...r.values()].sort((d,c)=>{let a=d.from.localeCompare(c.from);if(a!==0)return a;let u=d.to.localeCompare(c.to);return u!==0?u:d.kind.localeCompare(c.kind)}),o=s.filter(d=>d.missing).map(d=>d.id);return{root_id:e.id,nodes:s,edges:i,missing_ids:o}}function hn(e,t,r){let n=new Set,s=new Set,i=new Set,o=new Set,d=[{id:e,depth:0}],c=0;for(;c<d.length;){let a=d[c++],u=a.id.trim().toLowerCase();n.add(u);let f=t.get(u);if(!f){i.add(u);continue}if(!(r!==void 0&&a.depth>=r)&&!o.has(u)){o.add(u);for(let l of f.dependencies)s.add(`${u}::${l.id.trim().toLowerCase()}::${l.kind}`),d.push({id:l.id,depth:a.depth+1})}}return{node_count:n.size,edge_count:s.size,edge_basis:"deduplicated_directed",missing_count:i.size}}function As(e,t=E()){let r=Le(e.maxDepth),n=I(e.nodeLimit,"node-limit"),s=I(e.edgeLimit,"edge-limit"),i=I(e.tokenBudget,"token-budget"),o=at(e.kind,t);return{direction:ct(e.direction),...o===void 0?{}:{kinds:o},...r===void 0?{}:{maxDepth:r},...n===void 0?{}:{nodeLimit:n},...s===void 0?{}:{edgeLimit:s},...i===void 0?{}:{tokenBudget:i},...e.cursor?.trim()?{cursor:e.cursor.trim()}:{}}}function Ns(e,t,r,n){return $t(e.graph,t,e.details.map(s=>s.id===t&&n.length>0?{...s,evidence:n}:s),r)}function dt(e,t,r,n){for(let s of r.slice(0,n)){let i=s?.trim();i&&e.push(`${t}:${i}`)}}async function $s(e,t,r,n){let s=await bt(e,t,r.id_prefix,r.item_format,n);if(!s)return[];let{document:i}=await wt(s,{schema:r.schema}),o=i.metadata,d=o.files??[],c=o.tests??[],a=o.docs??[],u=[["files",d.length],["tests",c.length],["docs",a.length],["comments",(o.comments??[]).length],["notes",(o.notes??[]).length],["learnings",(o.learnings??[]).length]];if(u.every(([,l])=>l===0))return[];let f=[`linked:${u.map(([l,p])=>`${l}=${p}`).join(",")}`];return dt(f,"file",d.map(l=>l.path),3),dt(f,"test",c.map(l=>l.command??l.path),2),dt(f,"doc",a.map(l=>l.path),2),f}function Ms(e){let{canonicalId:t,context:r,missingCount:n,missingReferences:s,referenceLimit:i,summaryOnly:o}=e;return{id:t,format:"context",node_count:r.nodes.length+1,edge_count:r.edges.length,edge_basis:"deduplicated_directed",missing_count:n,missing_scope:"traversal",missing_reference_count:s.length,...o?{}:{missing_references:s.slice(0,i),context:r}}}function js(e){let{row:t,missingReachableSet:r,packetIds:n,filteredKinds:s,registry:i}=e;if(t.no_active_blocker_sentinel||!r.has(t.target_id.trim().toLowerCase())||!n.has(t.holder_id))return!1;if(s===void 0)return!0;let o=i.resolve(t.kind);return o!==void 0&&(s.has(o.kind)||o.inverse!==void 0&&s.has(o.inverse))}function mn(e,t,r){let n;for(;;){let s=re(new TextEncoder().encode(Pe(je("deps",e),t)).byteLength);if(s===n)return s;r(s),n=s}}function Ps(e){return e instanceof TypeError&&e.message.startsWith("Relationship context tokenBudget cannot fit ")}function Fs(e){try{return Ns(e.assembly,e.canonicalId,{...e.contextOptions,...e.internalTokenBudget===void 0?{}:{tokenBudget:e.internalTokenBudget}},e.rootEvidence)}catch(t){if(e.smallestResult!==void 0&&Ps(t))return e.smallestResult;throw t}}function Gs(e){let{assembly:t,canonicalId:r,contextOptions:n,rootEvidence:s,summaryOnly:i,outputFormat:o,missingCount:d,missingReferences:c}=e,u=n.edgeLimit??40,f=n.tokenBudget,l,p;for(;;){let g=Fs({assembly:t,canonicalId:r,contextOptions:n,internalTokenBudget:f,rootEvidence:s,smallestResult:p});if("format"in g)return g;let h=g;l??=h.meta.tokenBudget,f??=l;let y=Ms({canonicalId:r,context:h,missingCount:d,missingReferences:c,referenceLimit:u,summaryOnly:i});if(p=y,i||(h.meta.tokenBudget=l,h.meta.usedTokens=mn(P(y,!1),o,_=>{h.meta.usedTokens=_}),h.meta.usedTokens<=l))return y;if(u>0){u-=1;continue}let b=f,m=b*l/h.meta.usedTokens;f=Math.min(b-1,Math.max(1,Math.floor(m*.9)))}}function qs(e){let{assembly:t,canonicalId:r,options:n,rootEvidence:s,summaryOnly:i,outputFormat:o}=e,d=As(n,t.graph.registry()),c=t.graph.closure(r,{direction:d.direction,...d.kinds===void 0?{}:{kinds:d.kinds},maxDepth:d.maxDepth??3}),a=c.value.filter(h=>t.missingIdSet.has(h.toLowerCase())),u=new Set(a.map(h=>h.toLowerCase())),f=t.graph.registry(),l=d.kinds?new Set(d.kinds.map(h=>f.require(h).kind)):void 0,p=new Set([r,...c.value]),g=[...t.dangling.active,...t.dangling.legacy_terminal].filter(h=>js({row:h,missingReachableSet:u,packetIds:p,filteredKinds:l,registry:f}));return Gs({assembly:t,canonicalId:r,contextOptions:d,rootEvidence:s,summaryOnly:i,outputFormat:o,missingCount:a.length,missingReferences:g})}function Bs(e){let t=[e],r;for(;t.length>0;){let n=t.pop();n.dependencies.length>0&&(r=n,t.push(...n.dependencies))}return r?(r.dependencies.pop(),r.truncated=!0,!0):!1}function Us(e,t,r,n,s,i,o){let d=s??vs,c=I(r.nodeLimit,"node-limit")??ks,a=I(r.edgeLimit,"edge-limit")??xs,u=I(r.tokenBudget,"token-budget")??Es,f={nodeLimit:c,edgeLimit:a,tokenBudget:u,nodes:0,edges:0,estimatedTokens:0,reasons:new Set},l=gn(e,n,new Set,d,t==="graph"?"repeated":i,new Set,f),p=hn(e,n,void 0),g;for(;;){let h=Ls(l),y=f.reasons.size===0?void 0:{reasons:[...f.reasons].sort(),limits:{max_depth:d,node_limit:c,edge_limit:a,token_budget:u},estimated_tokens:0,total_node_count:p.node_count,total_edge_count:p.edge_count,omitted_node_count:Math.max(0,p.node_count-h.nodes.length),omitted_edge_count:Math.max(0,p.edge_count-h.edges.length)},b={id:e,format:t,node_count:h.nodes.length,edge_count:h.edges.length,edge_basis:"deduplicated_directed",missing_count:h.missing_ids.length,...y?{truncation:y}:{}};if(g=t==="tree"?{...b,tree:l}:{...b,graph:h},(g.truncation===void 0?re(new TextEncoder().encode(Pe(je("deps",P(g,!1)),o)).byteLength):mn(P(g,!1),o,_=>{g.truncation.estimated_tokens=_}))<=u)return g;if(!Bs(l))return f.reasons.add("token_budget"),g;f.reasons.add("token_budget")}}function P(e,t,r={}){let n={name:e.format==="tree"?"dependency_tree":e.format==="graph"?"dependency_graph":"relationship_context",restore_with:"--full"};return{...e,legacy_alias_counts:r,projection:{mode:t?"summary":"full",declared_field_groups:[n],included_field_groups:t?[]:[n.name]}}}async function vo(e,t,r){let n=Z(process.cwd(),r.path);if(!await Y(ee(n)))throw new v(`Tracker is not initialized at ${n}. Run pm init first.`,w.NOT_FOUND);let s=Is(t.format),i=Le(t.maxDepth),o=Ts(t.collapse);se(t.summary===!0,t.full===!0,"--summary");let d=t.summary===!0,c=await ce(n),a=Q(c,oe()),u=await ae(n,c.item_format,a.type_to_folder,void 0,c.schema),f=ne(c.schema),l=new Map(u.map(g=>[g.id.trim().toLowerCase(),Ss(g)])),p=xt(u,g=>R(g,f));for(let g of[...p.active,...p.legacy_terminal]){let h=l.get(g.holder_id.trim().toLowerCase()),y=g.kind.trim().toLowerCase();h&&!h.dependencies.some(b=>b.id.trim().toLowerCase()===g.target_id.trim().toLowerCase()&&b.kind===y)&&h.dependencies.push({id:g.target_id,kind:y})}if(!l.has(e.trim().toLowerCase()))throw new v(`Item ${e} not found`,w.NOT_FOUND);if(s==="context"){let g=l.get(e.trim().toLowerCase()).id,h=d?[]:await $s(n,g,c,a.type_to_folder),y=_=>R(_,f),b=N(),m=me().lookup(n,he(u,y,b),()=>$(u,y,b));return P(qs({assembly:m.assembly,canonicalId:g,options:t,rootEvidence:h,summaryOnly:d,outputFormat:r.json===!0?"json":"toon"}),d,m.assembly.legacyAliasCounts)}return d?P({id:e,format:s,...hn(e,l,i)},!0,Object.fromEntries(Object.entries($(u,g=>R(g,f)).legacyAliasCounts))):P(Us(e,s,t,l,i,o,r.json===!0?"json":"toon"),!1,Object.fromEntries(Object.entries($(u,g=>R(g,f)).legacyAliasCounts)))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6c8bfb7a-687a-5fbb-b408-ffdbab1187a9")}catch{}})();var wn=new Set(["ancestors","descendants","predecessors","successors","paths","impact","dominators"]),S=10;function yn(e,t,r){return{...e,projection:{mode:t?"summary":"full",declared_field_groups:r===void 0?[]:[{name:r,restore_with:"--full"}],included_field_groups:r===void 0||t?[]:[r]}}}function _n(e){return e===void 0?[]:(Array.isArray(e)?e:[e]).flatMap(t=>t.split(",")).map(t=>t.trim()).filter(t=>t.length>0)}function zs(e,t,r){let n=e.trim().toLowerCase();if(!Me.includes(n))throw vt({command_path:"graph",token:n||"<empty>",allowed:Me});let s=n;if(wn.has(s)&&!t?.trim())throw new v(`graph ${s} requires an item id.`,w.USAGE);if(s==="paths"&&!r?.trim())throw new v("graph paths requires a source and a target item id.",w.USAGE);return s}function ut(e){throw e instanceof TypeError?new v(e.message,w.USAGE):e}function lt(e){return{truncated:e.truncated,cost:{visited_nodes:e.visitedNodes,inspected_edges:e.inspectedEdges}}}function bn(e,t){let r=t.trim().toLowerCase();for(let n of e.details)if(n.id.trim().toLowerCase()===r&&!e.missingIdSet.has(n.id.toLowerCase()))return n.id;throw new v(`Item ${t} not found`,w.NOT_FOUND)}function Ks(e,t,r){let n={ancestors:Pt,descendants:Ft,predecessors:Gt,successors:qt}[e],s;try{s=n(r.assembly.graph,t,{...r.kinds===void 0?{}:{kinds:r.kinds},...r.maxDepth===void 0?{}:{maxDepth:r.maxDepth},...r.limit===void 0?{}:{limit:r.limit},...r.after===void 0?{}:{after:r.after}})}catch(o){ut(o)}let i=lt(s.meta);return{subcommand:e,root:t,count:s.value.length,...i,...s.meta.nextCursor===void 0?{}:{next_cursor:s.meta.nextCursor},...r.summary?{}:{ids:s.value}}}function Ws(e,t,r){let n=Bt(r.assembly.graph,e,t,{direction:r.direction,...r.kinds===void 0?{}:{kinds:r.kinds},...r.maxDepth===void 0?{}:{maxDepth:r.maxDepth},...r.maxPaths===void 0?{}:{maxPaths:r.maxPaths}});return{subcommand:"paths",root:e,target:t,direction:r.direction,count:n.value.length,...lt(n.meta),...r.summary?{}:{paths:n.value.map(s=>({nodes:s.nodes,kinds:s.edges.map(i=>i.kind),length:s.length}))}}}function Vs(e,t){let r;try{r=Ot(t.assembly.graph,e,{direction:t.direction,...t.kinds===void 0?{}:{kinds:t.kinds},...t.maxDepth===void 0?{}:{maxDepth:t.maxDepth},...t.unbounded?{}:{limit:t.limit??S},...t.after===void 0?{}:{after:t.after}})}catch(n){ut(n)}return{subcommand:"impact",root:e,direction:t.direction,count:r.affected.length,truncated:r.truncated,...r.nextCursor===void 0?{}:{next_cursor:r.nextCursor},cost:{visited_nodes:r.cost.visitedNodes,inspected_edges:r.cost.inspectedEdges},...t.summary?{}:{affected:r.affected}}}function Hs(e){let t=e.assembly.graph,r=e.limit??S,n=ge(t,{registry:t.registry()}),s=Lt(t);return{subcommand:"analyze",node_count:t.nodes().length,edge_count:t.edges().length,edge_basis:"deduplicated_directed",sample_limit:r,execution:{acyclic:n.acyclic,ordered_node_count:n.order.length,layer_count:n.layers.length,frontier_count:n.frontier.length,critical_path_length:n.criticalPathLength,cycle_count:n.cycles.length,...e.summary?{}:{frontier:n.frontier.slice(0,r),critical_path:n.criticalPath.slice(0,r),cycles:n.cycles.slice(0,r)}},knowledge:{component_count:s.components.length,largest_component_size:s.components[0]?.length??0,orphan_count:s.orphans.length,...e.summary?{}:{orphans:s.orphans.slice(0,r),hubs:s.hubs.slice(0,r)}}}}function Js(e,t){let r=De(e.assembly,{isTerminal:t,...e.sample===void 0?{}:{maxSampleSize:e.sample},...e.exemptIsolates.length===0?{}:{exemptIsolates:e.exemptIsolates},...e.exemptIsolateTypes.length===0?{}:{isolateExemptTypes:e.exemptIsolateTypes}}),n={},s={},i={},o={};for(let d of r.findings)n[d.severity]=(n[d.severity]??0)+1,s[d.code]=(s[d.code]??0)+1,i[d.severity]=(i[d.severity]??0)+d.count,o[d.code]=(o[d.code]??0)+d.count;return{subcommand:"audit",finding_count:r.findings.length,findings_by_severity:n,findings_by_code:s,affected_subjects_by_severity:i,affected_subjects_by_code:o,profile:r.profile,legacy_alias_counts:e.assembly.legacyAliasCounts,...e.summary?{}:{findings:r.findings}}}function Xs(e){let t=e.limit??S,r={};e.kinds!==void 0&&(r.kinds=e.kinds);let n=zt(e.assembly.graph,r),s=n.value;return{subcommand:"communities",community_count:s.communities.length,largest_community_size:s.communities[0]?.size??0,iterations:s.iterations,converged:s.converged,truncated:!s.converged||s.communities.length>t,cost:{visited_nodes:n.meta.visitedNodes,inspected_edges:n.meta.inspectedEdges},...e.summary?{}:{communities:s.communities.slice(0,t).map(i=>({representative:i.representative,size:i.size,members:i.members.slice(0,t)}))}}}function Ys(e){let t;try{t=M(e.assembly.graph,{...e.kinds===void 0?{}:{kinds:e.kinds},...e.maxDepth===void 0?{}:{maxDepth:e.maxDepth},...e.limit===void 0?{}:{limit:e.limit}})}catch(r){ut(r)}return{subcommand:"redundancy",redundant_count:t.value.length,...lt(t.meta),...e.summary?{}:{redundant:t.value.map(r=>({source:r.edge.source,target:r.edge.target,kind:r.edge.kind,witness:r.witness}))}}}function Qs(e,t){let r=t.limit??S,n=Kt(t.assembly.graph,e,{direction:t.direction,...t.kinds===void 0?{}:{kinds:t.kinds},...t.maxDepth===void 0?{}:{maxDepth:t.maxDepth}}),s=n.value.rows.filter(i=>i.dominatedCount>0);return{subcommand:"dominators",root:e,direction:t.direction,reachable_count:n.value.reachableCount,bottleneck_count:s.length,truncated:n.meta.truncated||s.length>r,cost:{visited_nodes:n.meta.visitedNodes,inspected_edges:n.meta.inspectedEdges},...t.summary?{}:{bottlenecks:s.slice(0,r).map(i=>({id:i.id,idom:i.idom,dominated_count:i.dominatedCount}))}}}function Zs(e){let t=e.limit??S,r=Xt(e.assembly.graph),n=r.rows.filter(s=>s.critical).length;return{subcommand:"slack",acyclic:r.acyclic,makespan:r.makespan,scheduled_count:r.scheduledCount,critical_count:n,critical_path_length:r.criticalPathLength,cycle_count:r.cycles.length,truncated:r.rows.length>t,...e.summary?{}:{critical_path:r.criticalPath,rows:r.rows.slice(0,t).map(s=>({id:s.id,earliest_start:s.earliestStart,latest_start:s.latestStart,slack:s.slack,critical:s.critical}))}}}function ei(e){let t=e.limit??S,r=Jt(e.assembly.graph,e.kinds===void 0?{}:{kinds:e.kinds}),n=r.value;return{subcommand:"centrality",node_count:n.nodeCount,edge_count:n.edgeCount,edge_basis:"simple_undirected",truncated:n.rows.length>t,cost:{visited_nodes:r.meta.visitedNodes,inspected_edges:r.meta.inspectedEdges},...e.summary?{}:{rows:n.rows.slice(0,t).map(s=>({id:s.id,degree:s.degree,in_degree:s.inDegree,out_degree:s.outDegree,betweenness:s.betweenness,closeness:s.closeness}))}}}function ti(e){let t=e.limit??S,r=Te(e.assembly.graph,e.kinds===void 0?{}:{kinds:e.kinds}),{articulationPoints:n,bridges:s}=r.value;return{subcommand:"articulation",articulation_count:n.length,bridge_count:s.length,truncated:n.length>t||s.length>t,cost:{visited_nodes:r.meta.visitedNodes,inspected_edges:r.meta.inspectedEdges},...e.summary?{}:{articulation_points:n.slice(0,t),bridges:s.slice(0,t)}}}function ni(e,t){let r=e.limit??S,n=fn(e.assembly,{isTerminal:t,redundancyLimit:r,...e.sample===void 0?{}:{maxSampleSize:e.sample},...e.exemptIsolates.length===0?{}:{exemptIsolates:e.exemptIsolates},...e.exemptIsolateTypes.length===0?{}:{isolateExemptTypes:e.exemptIsolateTypes}}),s={},i={};for(let o of n.steps)s[o.op]=(s[o.op]??0)+1,i[o.code]=(i[o.code]??0)+1;return{subcommand:"plan",step_count:n.steps.length,steps_by_op:s,steps_by_code:i,finding_count:n.report.findings.length,truncated:n.truncated||n.steps.length>r,cost:{visited_nodes:n.cost.visitedNodes,inspected_edges:n.cost.inspectedEdges},...e.summary?{}:{steps:n.steps.slice(0,r)}}}function vn(e,t,r,n){return JSON.stringify({subcommand:e,root:t??null,target:r??null,kinds:n.kinds??null,maxDepth:n.maxDepth??null,limit:n.limit??null,after:n.after??null,direction:n.direction,maxPaths:n.maxPaths??null,sample:n.sample??null,exemptIsolates:[...new Set(n.exemptIsolates.map(s=>s.toLowerCase()))].sort(),exemptIsolateTypes:[...new Set(n.exemptIsolateTypes.map(s=>s.toLowerCase()))].sort(),summary:n.summary,unbounded:n.unbounded})}function kn(e,t,r,n,s){return e==="analyze"?Hs(n):e==="audit"?Js(n,s):e==="plan"?ni(n,s):e==="communities"?Xs(n):e==="redundancy"?Ys(n):e==="dominators"?Qs(t,n):e==="slack"?Zs(n):e==="centrality"?ei(n):e==="articulation"?ti(n):e==="paths"?Ws(t,r,n):e==="impact"?Vs(t,n):Ks(e,t,n)}function ri(e,t){if(e!=="index"&&(t.rebuild===!0||t.clear===!0))throw new v("--rebuild and --clear apply only to graph index.",w.USAGE);if(e!=="audit"&&t.saveBaseline===!0)throw new v("--save-baseline applies only to graph audit.",w.USAGE);if(e==="slack"&&t.kind!==void 0)throw new v("graph slack analyzes every ordering kind; --kind is not supported.",w.USAGE);if(t.rebuild===!0&&t.clear===!0)throw new v("graph index accepts either --rebuild or --clear, not both.",w.USAGE);if(e==="impact"&&t.full===!0&&t.limit!==void 0)throw new v("graph impact accepts either --full or --limit, not both.",w.USAGE)}async function si(e,t,r,n,s,i){let o="status";if(i.clear===!0&&(await it(e),o="cleared"),i.rebuild===!0){await it(e);let c=await rt(e,t),a={assembly:r.assembly,direction:"both",exemptIsolates:[],exemptIsolateTypes:[],saveBaseline:!1,summary:!0,unbounded:!1};for(let u of["analyze","audit"])await st(e,t,c,vn(u,void 0,void 0,a),kn(u,void 0,void 0,a,s));o="rebuilt"}let d=await dn(e,t);return{subcommand:"index",action:o,state:d.exists?d.fresh?"fresh":"stale":"absent",entry_count:d.entry_count,item_count:n,min_items_threshold:tt,persist_enabled:ot(n,d.exists),current_fingerprint:t.slice(0,12),...d.saved_at===void 0?{}:{saved_at:d.saved_at},...d.bytes===void 0?{}:{bytes:d.bytes}}}async function ii(e,t,r,n){let s={saved_at:new Date().toISOString(),fingerprint:t,affected_subjects_by_code:r.affected_subjects_by_code,profile:r.profile},i=await an(e);return n&&await un(e,s),i===void 0?r:{...r,baseline:tn(i,s)}}async function oi(e,t,r,n,s){try{await st(e,t,r,n,s)}catch{}}async function Vo(e,t,r,n,s){let i=zs(e,t,r);se(n.summary===!0,n.full===!0,"--summary");let o=Z(process.cwd(),s.path);if(!await Y(ee(o)))throw new v(`Tracker is not initialized at ${o}. Run pm init first.`,w.NOT_FOUND);let d=await ce(o),c=Q(d,oe()),a=await ae(o,d.item_format,c.type_to_folder,void 0,d.schema),u=ne(d.schema),f=G=>R(G,u);ri(i,n);let l=N(),p=at(n.kind,l),g=me().lookup(o,he(a,f,l),()=>$(a,f,l)),h={assembly:g.assembly,...p===void 0?{}:{kinds:p},maxDepth:Le(n.maxDepth),limit:I(n.limit,"limit"),after:n.after?.trim()||void 0,direction:ct(n.direction),maxPaths:I(n.maxPaths,"max-paths"),sample:I(n.sample,"sample"),exemptIsolates:_n(n.exemptIsolate),exemptIsolateTypes:_n(n.exemptIsolateType),saveBaseline:n.saveBaseline===!0,summary:n.summary===!0,unbounded:n.full===!0};if(i==="index")return yn(await si(o,g.fingerprint,h,a.length,f,n),!1);let y=wn.has(i)?bn(h.assembly,t):void 0,b=i==="paths"?bn(h.assembly,r):void 0,m=vn(i,y,b,h),_=await rt(o,g.fingerprint),T=_.results[m],k=g.memoize(m,()=>T!==void 0?structuredClone(T):kn(i,y,b,h,f)),J=ot(a.length,_.exists);!k.reused&&T===void 0&&J&&await oi(o,g.fingerprint,_,m,k.value);let F=k.value.subcommand==="audit"?await ii(o,g.fingerprint,k.value,h.saveBaseline):k.value;return F.cache={fingerprint:g.fingerprint.slice(0,12),assembly:g.assemblyReused?"hit":"miss",result:k.reused?"hit":"miss",durable:T!==void 0?"hit":J?"miss":"off"},yn(F,h.summary,"result_rows")}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="94e8b95b-35fa-5fc7-843a-481497e09b54")}catch{}})();function xn(e){return[...e].sort().join("\0")}function di(e,t,r){let n=e.successors.get(t);n?n.push(r):e.successors.set(t,[r]);let s=e.predecessors.get(r);s?s.push(t):e.predecessors.set(r,[t])}function En(e,t,r,n,s){let i=t.resolve(s);if(i?.ordering!==!0)return;let o=kt(n),d=o===void 0?void 0:e.canonicalIds.get(o.toLowerCase());if(d===void 0)return;let c=(i.precedence??"source_before_target")==="source_before_target";di(e,c?r:d,c?d:r)}function ci(e,t){let r={successors:new Map,predecessors:new Map,canonicalIds:new Map},n=e.filter(s=>typeof s?.id=="string"&&s.id.trim().length>0);for(let s of n){let i=s.id.trim();r.canonicalIds.set(i.toLowerCase(),i)}for(let s of n){let i=s.id.trim();En(r,t,i,s.blocked_by,"blocked_by");for(let o of s.dependencies??[])typeof o!="object"||o===null||En(r,t,i,o.id,typeof o.kind=="string"?o.kind:"related")}for(let s of[r.successors,r.predecessors])for(let i of s.values())i.sort();return r}function ai(e,t){let r=new Set([t]),n=[t];for(;n.length>0;){let s=n.pop();for(let i of[e.successors,e.predecessors])for(let o of i.get(s)??[])r.has(o)||(r.add(o),n.push(o))}return r}function ui(e,t){let r=new Map;for(let n of t){let s=(e.successors.get(n)??[]).filter(i=>t.has(i));s.length>0&&r.set(n,s)}return r}function In(e,t,r){let n=ci(e,t),s=n.canonicalIds.get(r.trim().toLowerCase());if(s===void 0)return{cycles:[],successors:new Map,canonical:r};let i=ui(n,ai(n,s));return{cycles:Ze(i).filter(o=>o.includes(s)),successors:i,canonical:s}}function li(e,t,r){let n=new Set(t),s=n.has(r)?r:t[0];if(e.get(s)?.includes(s))return[s,s];for(let i of e.get(s)??[]){if(!n.has(i))continue;let o=fi(e,n,s,i);if(o)return o}return[...t,t[0]]}function fi(e,t,r,n){let s=[[n]],i=new Set([r,n]);for(;s.length>0;){let o=s.shift(),d=o.at(-1);for(let c of e.get(d)??[]){if(c===r)return[r,...o,r];!t.has(c)||i.has(c)||(i.add(c),s.push([...o,c]))}}}function Yo(e,t,r){let n=N(),s=In(e,n,r),i=In(t,n,r),o=new Set(s.cycles.map(xn)),d=new Set(Fe(e,void 0,n).map(a=>`${a.holder_id.toLowerCase()}\0${a.target_id.toLowerCase()}\0${a.dependency_kind}`));return[...Fe(t,void 0,n).filter(a=>a.holder_id.toLowerCase()===r.trim().toLowerCase()&&!d.has(`${a.holder_id.toLowerCase()}\0${a.target_id.toLowerCase()}\0${a.dependency_kind}`)).map(a=>`ordering_storage_contradiction_created:${Se(a)}:remove_contradicting_dependency_row:run_pm_graph_audit`),...i.cycles.filter(a=>!o.has(xn(a))).map(a=>`ordering_cycle_created:${li(i.successors,a,i.canonical).join(" -> ")}:items_will_not_be_ready:run_pm_graph_audit`)]}export{Ue as a,It as b,ge as c,Ot as d,Lt as e,Ei as f,he as g,ze as h,me as i,Ri as j,$t as k,vo as l,Pt as m,Ft as n,Gt as o,qt as p,Bt as q,ke as r,zt as s,M as t,Kt as u,Jt as v,Te as w,Xt as x,Ze as y,Se as z,Re as A,et as B,De as C,tn as D,rn as E,tt as F,H as G,on as H,rt as I,st as J,it as K,dn as L,ot as M,an as N,un as O,fn as P,zs as Q,Vo as R,Yo as S};
|
|
8
|
+
//# sourceMappingURL=chunk-F43TT2QQ.js.map
|