@unbrained/pm-cli 2026.9.25 → 2026.9.26
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/.agents/skills/README.md +1 -0
- package/.agents/skills/pm-developer/SKILL.md +3 -0
- package/.agents/skills/pm-test-audit/LICENSE.txt +21 -0
- package/.agents/skills/pm-test-audit/SKILL.md +103 -0
- package/.agents/skills/pm-test-audit/references/AUDIT.md +54 -0
- package/.agents/skills/pm-test-audit/references/CAMPAIGN.md +47 -0
- package/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +12 -1
- package/dist/cli/register-list-query.js +2 -2
- package/dist/cli/schema/registration.js +2 -2
- package/dist/cli-bundle/bundle-manifest.json +111 -111
- package/dist/cli-bundle/chunks/{chunk-YDIGMRLZ.js → chunk-4ODHIX7N.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-5AP67ZXH.js → chunk-FOTXRNY6.js} +39 -39
- package/dist/cli-bundle/chunks/{chunk-GAU55CWI.js → chunk-GRWPZR7F.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-3IB4THWX.js → chunk-HTHTX6E6.js} +6 -6
- package/dist/cli-bundle/chunks/{chunk-JDHWZYZU.js → chunk-IYN4MJ2C.js} +73 -73
- package/dist/cli-bundle/chunks/{chunk-YABJDOOX.js → chunk-MJWKR7YA.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-GOWZEBTH.js → chunk-QQD3VRMZ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-COFQCKF4.js → chunk-SZQCHJI4.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-P7ZSJOWH.js → chunk-TC74K7SS.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-445ARBKY.js → chunk-TYJXMT3Q.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-25KTCTBL.js → chunk-U55RYT3I.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-CZ3VJJEA.js → chunk-VMO4P5MX.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-IZ7ZVTDE.js → register-list-query-426QTRET.js} +4 -4
- package/dist/cli-bundle/chunks/{register-mutation-IPAZTFDZ.js → register-mutation-FLI3HHMP.js} +4 -4
- package/dist/cli-bundle/chunks/{register-operations-APN33LNI.js → register-operations-TP7ZG4MK.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-HPHIKG5U.js → register-setup-574SIVQZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-25BBHWMH.js +20 -0
- package/dist/cli-bundle/focused-chunks/{chunk-KRIHJH5U.js → chunk-H3BI4EDO.js} +4 -4
- package/dist/cli-bundle/focused-chunks/chunk-HNHMK5JI.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-IXNNMP2R.js → chunk-XVBWZTU2.js} +11 -11
- package/dist/cli-bundle/main.js +2 -2
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +20 -20
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +45 -45
- 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 +8 -8
- package/dist/core/search/embedding-batches.d.ts +47 -15
- package/dist/core/search/embedding-batches.js +1 -1
- package/dist/core/search/eval-thresholds.d.ts +14 -0
- package/dist/core/search/eval-thresholds.js +2 -0
- package/dist/core/search/eval.d.ts +4 -1
- package/dist/core/search/eval.js +1 -1
- package/dist/core/search/http-client.d.ts +7 -0
- package/dist/core/search/http-client.js +1 -1
- package/dist/sdk/eval.d.ts +19 -17
- package/dist/sdk/eval.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
- package/dist/sdk/governance/reindex.d.ts +4 -1
- package/dist/sdk/governance/reindex.js +2 -2
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query.d.ts +3 -0
- package/dist/sdk/query.js +1 -1
- package/dist/sdk/runtime/schema-preview.d.ts +2 -0
- package/dist/sdk/runtime/schema-preview.js +2 -0
- package/dist/sdk/runtime/schema.js +1 -1
- package/dist/sdk/runtime-primitives.d.ts +2 -1
- package/dist/sdk/runtime-primitives.js +1 -1
- package/docs/README.md +1 -0
- package/docs/RELEASING.md +5 -1
- package/docs/SEARCH_QUALITY.md +116 -0
- package/marketplace.json +2 -2
- package/package.json +1 -1
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/package.json +2 -2
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-V2X37U6J.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-Y2M4QLAA.js +0 -20
package/dist/cli-bundle/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{B as Hi,D as zi,E as pn,a as Zt,b as re,c as en,d as tn,e as nn,f as on,g as vi,k as _i,n as z,o as G,p as E,q as Ue,r as k,s as ji,x as wt,y as Ui,z as qi}from"./chunks/chunk-
|
|
1
|
+
import{B as Hi,D as zi,E as pn,a as Zt,b as re,c as en,d as tn,e as nn,f as on,g as vi,k as _i,n as z,o as G,p as E,q as Ue,r as k,s as ji,x as wt,y as Ui,z as qi}from"./chunks/chunk-U55RYT3I.js";import{Wa as Li,f as mi,l as yi}from"./chunks/chunk-FOTXRNY6.js";import"./chunks/chunk-SZQCHJI4.js";import"./chunks/chunk-HTHTX6E6.js";import{F as $i,Mc as Fi,d as gt,g as Ri,h as Ii,i as B,j as Pi}from"./chunks/chunk-GRWPZR7F.js";import{Ea as Di,f as wi}from"./chunks/chunk-MJWKR7YA.js";import"./chunks/chunk-TYJXMT3Q.js";import"./chunks/chunk-DEZPZOQ7.js";import{Ac as Xo,Bc as ne,Cc as Qo,Co as ht,Dc as rt,Df as ie,Do as yt,Eb as jo,Ec as we,Ef as di,Eo as dn,Fc as oe,Ff as ve,Fo as je,Go as A,H as Do,Hf as Qt,Ho as Ni,I as No,Ic as Zo,If as w,Io as mn,Jc as at,L as Ie,Mi as dt,Nb as Uo,Ni as hi,Nk as bi,Ob as qo,Oe as oi,Ok as mt,Oo as L,P as Vt,Pa as Bt,Pc as Yt,Pe as ii,Pk as an,Qc as st,Qe as ri,Qk as sn,Rc as ei,Re as ai,Rk as Ne,Sa as te,Sc as ti,Se as si,Sk as ln,Tk as Ci,Ua as Fo,Ub as Ho,Uk as Me,Va as it,Wb as zo,Wg as pi,Xg as ui,Xk as xi,Ya as Kt,Yd as lt,Yk as ki,Za as Lo,Zn as Oi,_a as $,_n as ft,ad as S,ag as rn,ap as Mi,bb as V,bd as De,cm as pt,dh as ct,e as M,em as Le,fm as ut,g as he,h as T,hc as Go,ic as Pe,ii as fi,j as ee,ji as _e,jl as Fe,k as Wt,kc as $e,ki as D,l as ye,la as f,lc as Wo,li as gi,m as $o,ma as ot,ml as Ei,na as C,nf as li,oa as Mo,pl as Si,rf as ci,tb as Jt,uc as Vo,ul as cn,vc as Bo,vl as Ai,wc as Ko,wl as Ti,x as W,xc as Jo,yc as Z,ye as ni,zc as Yo,ze as Xt}from"./chunks/chunk-IYN4MJ2C.js";import{Command as So,CommanderError as ia}from"commander";(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]="1c4a4bc4-d26a-5f51-bac0-2a132dad1f56")}catch{}})();async function Gi(e,t){await Ai(e,{ok:t.ok,error:t.error,result:oe(),exit_code:t.exit_code,error_code:t.error_code,error_category:t.error_category,command_resolution:t.command_resolution,resolution_stage:t.resolution_stage})}async function Wi(e){if(process.env.PM_CONTEXT_USAGE_DISABLED==="1")return;let t;try{await li({pmRoot:e.pmRoot,result:oe()})}catch(o){t=o}let n=await D(e.pmRoot);if(await ci({pmRoot:e.pmRoot,author:ct(e.author,n.author_default),itemIds:e.itemIds,intent:e.intent}),t!==void 0)throw 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]="0429ff6a-ec0d-5c20-9fa7-0ed05b154523")}catch{}})();function j(e){return`--${e.replace(/^--?/,"").replace(/_/g,"-").replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`}function ae(e){if(!e.startsWith("--"))return;let t=e.includes("=")?e.slice(0,e.indexOf("=")):e;return j(t)}function K(e){let t=new Set,n=[];for(let o of e){let i=ae(o);i&&(t.has(i)||n.push(i),t.add(i))}return n}(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]="dacf3952-3ae1-57fa-840a-c8a43cf855a5")}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]="63db65f1-fdbe-513d-b71a-87490ec9b69e")}catch{}})();var Vi=new WeakMap;function _t(e,t){Vi.set(e,t)}function se(e){return Vi.get(e)}function Bi(e){return e.length>0?[e[0]]:[]}function Ma(e){let t=["","Intent:",` ${e.why}`],n=Bi(e.examples);return n.length>0&&(t.push("","Example:"),t.push(` ${n[0]}`)),t.push("","Need deeper rationale and more examples?"),t.push(" Re-run with --explain."),t.join(`
|
|
2
2
|
`)}function Fa(e){let t=["","Why use this command:",` ${e.why}`,"","Examples:",...e.examples.map(n=>` ${n}`)];return e.tips&&e.tips.length>0&&(t.push("","Tips:"),t.push(...e.tips.map(n=>` - ${n}`))),t.join(`
|
|
3
3
|
`)}function Ki(e,t){return t==="detailed"?Fa(e):Ma(e)}function N(e){return e.trim().toLowerCase().split(/\s+/).filter(t=>t.length>0).join(" ")}var La={cal:"calendar",ctx:"context"};function ja(e,t){return e.commands.find(n=>n.name()===t)??null}function Ua(e,t){let n=e;for(let o of t){let i=ja(n,o);if(!i)return null;n=i}return n}function un(e,t,n,o){let i=Ua(e,t.split(" ").filter(r=>r.length>0));i&&i.addHelpText("after",Ki(n,o))}function fn(e){return e.includes("--explain")?"detailed":"compact"}function ce(e){return e.includes("--all")||e.includes("--explain")}var le={ops:{why:"Groups workspace diagnostics, quality checks, and maintenance under one discoverable command.",examples:["pm ops health --summary","pm ops validate --check-history-drift","pm ops --help"]},init:{why:"Bootstraps tracker storage and settings so all other commands can run safely.",examples:["pm init","pm init acme","pm init ./pm-sandbox --defaults","pm init --preset minimal","pm init --agent-guidance add","pm init --defaults --with-packages"],tips:["Run this once per repository before create/list/update commands.","A path-like positional (`./dir`, `/tmp/dir`) initializes that tracker path; a plain word remains an id prefix.","Rewriting id prefix, governance preset, or default author on an existing tracker requires --force.","Use --preset for non-interactive automation; omit it in a TTY to use the setup wizard.","Use --agent-guidance add to inject compact AGENTS/CLAUDE workflow guidance, or --agent-guidance status to inspect missing guidance without modifying files.","Use --with-packages when agents need bundled commands such as calendar and templates available immediately."]},config:{why:"Reads or updates project/global settings such as definition-of-done, item format, telemetry, and policy toggles.",examples:["pm config project get definition-of-done",'pm config project set definition-of-done --criterion "tests pass"',"pm config project set item-format --format toon","pm config project set sprint-release-format-policy --policy strict_error","pm config project set governance-preset --policy minimal","pm config project set governance-ownership-enforcement --policy none","pm config project set test-result-tracking --policy enabled","pm config global set telemetry-tracking --policy disabled"]},extension:{why:"Compatibility command for package-backed runtime extension lifecycle operations across project or global scope.",examples:["pm install ./my-package --project","pm install '*' --project","pm package doctor --project --detail summary","pm package manage --global","pm package activate sample-ext --project","pm package deactivate sample-ext --project","pm package uninstall sample-ext --global","pm extension explore --project","pm extension manage --global","pm extension describe sample-ext --project","pm extension doctor --detail deep"],tips:["Prefer pm install and pm package in new user-facing automation.","Use pm extension when maintaining existing extension-specific scripts or debugging the compatibility runtime directly.","Bundled aliases beads and todos resolve to package-shipped extension sources.","Use --gh/--github shorthand for GitHub sources and --ref to pin a branch, tag, or ref.","Install updates settings activation state automatically unless extension allowlist mode is unchanged.","Use --adopt for single-extension adoption and --adopt-all to bulk-register unmanaged installs as managed without reinstalling.","Use --manage for concise triage summaries and remediation-oriented diagnostics alongside full extension details.","Use --describe to map exactly what each loaded extension registers (commands, hooks, item types, providers, overrides) in one call.","Use --doctor for consolidated diagnostics with warning codes, remediation hints, and optional deep detail payloads."]},package:{why:"Installs, explores, manages, diagnoses, adopts, activates, deactivates, and refreshes package-backed pm runtime extensions.",examples:["pm install npm:@scope/pm-package --project","pm package install ./my-package --project","pm package doctor --project --detail deep","pm package manage --project --runtime-probe","pm package describe --project","pm package activate sample-ext --project","pm upgrade --packages-only --dry-run"],tips:["Prefer package vocabulary for user-facing workflows; extension vocabulary remains available for compatibility.","Use pm package describe [name] to map every surface a package registers without reading its manifest or running diagnostics.","Use pm upgrade to refresh the CLI/SDK and managed packages from their recorded sources.","Use --dry-run before upgrade when automation needs a deterministic plan."]},"package init":{why:"Generates an installable starter pm package with package metadata and a root extension entrypoint.",examples:["pm package init ./my-package","pm package init ./my-hook-package --capability hooks","pm package init ./my-search-package --capability search","pm package init ./my-sync-package --capability importers","pm package init ./my-domain-package --capability schema","pm package init ./my-output-package --capability renderers","pm install ./my-sync-package --project","pm package doctor --project --detail summary"],tips:["Use --capability hooks for a starter after_command lifecycle reactor with runnable SDK testing coverage.","Use --capability search for a starter search provider/vector-store adapter with runnable SDK testing coverage.","Use --capability importers for paired import/export commands that move project context across systems.","Use --capability schema for a starter custom item type, field, and migration so pm models your project domain.","Use --capability renderers/parser/preflight/services for starter override surfaces (output renderer, parsed-option rewrite, pre-run gate decision, built-in service) \u2014 one runnable starter per SDK capability.","The generated package is local-install safe; add SDK runtime imports only after declaring dependencies and validating with package doctor.","Use package doctor after changes to verify activation, policy, and collision diagnostics."]},"package install":{why:"Installs pm packages from local paths, npm sources, GitHub sources, bundled aliases, or wildcard/all aliases.",examples:["pm package install ./my-package --project","pm install npm:pm-changelog --project","pm package install --github org/repo/packages/my-pm-package --ref main"],tips:["Prefer the top-level pm install alias in scripts when only installation is needed.","Run pm package manage or pm package doctor after installing external packages."]},"package doctor":{why:"Diagnoses package activation, policy, collision, and managed-state health for project or global package scopes.",examples:["pm package doctor --project --detail summary","pm package doctor --project --detail deep --trace","pm package doctor --project --isolated --detail deep --trace"],tips:["Use --isolated (alias --ignore-global) for hermetic project smoke tests that must ignore globally installed package registrations.","Set PM_GLOBAL_PATH for a whole subprocess suite when every pm invocation must avoid machine-local global package state: PM_GLOBAL_PATH=$(mktemp -d) pm package doctor --project --detail deep --trace.","Non-isolated project diagnostics include global registrations and emit remediation when global package state can affect the result."]},"package catalog":{why:"Lists bundled first-party package catalog metadata and compact field projections.",examples:["pm package catalog --project","pm package catalog --project --fields alias,installed,install_command","pm package list --project --fields alias,package_name,category"],tips:["Use --fields for low-token package discovery in agent loops.","External npm package discovery still belongs to npm search."]},"extension init":{why:"Generates an installable starter runtime extension with manifest and entrypoint files.",examples:["pm extension init ./my-extension","pm extension init ./my-hook-extension --capability hooks","pm extension init ./my-search-extension --capability search","pm extension init ./my-sync-extension --capability importers","pm extension init ./my-domain-extension --capability schema","pm extension init ./my-output-extension --capability renderers","pm extension --install --project ./my-sync-extension","pm extension --doctor --project --detail summary"],tips:["Use --capability hooks when the extension should react to command lifecycle events.","Use --capability search when the extension should register retrieval primitives.","Use --capability importers when the extension should register project-context import/export commands.","Use --capability schema when the extension should register custom item types, fields, and migrations.","Use --capability renderers/parser/preflight/services to override pm's output rendering, parsed options, pre-run gate, or a built-in service.","Use package init for new distributable package workflows; extension init is the compatibility-level runtime scaffold."]},"extension install":{why:"Installs a compatibility runtime extension from local, npm, GitHub, bundled alias, or wildcard sources.",examples:["pm extension install ./my-extension --project","pm extension --install --project ./my-extension","pm extension doctor --project --detail summary"],tips:["Prefer pm install or pm package install for new package-first automation."]},"extension doctor":{why:"Diagnoses compatibility extension activation, policy, collision, and managed-state health for project or global extension scopes.",examples:["pm extension doctor --project --detail summary","pm extension doctor --project --detail deep --trace","pm extension doctor --project --isolated --detail deep --trace"],tips:["Use --isolated (alias --ignore-global) for hermetic project smoke tests that must ignore globally installed extension registrations.","Set PM_GLOBAL_PATH for a whole subprocess suite when every pm invocation must avoid machine-local global extension state: PM_GLOBAL_PATH=$(mktemp -d) pm extension doctor --project --detail deep --trace.","Prefer pm package doctor in new package-first workflows."]},"extension catalog":{why:"Compatibility view of bundled package catalog metadata.",examples:["pm extension catalog --project","pm extension catalog --project --fields alias,installed,install_command"],tips:["Prefer pm package catalog in new user-facing workflows."]},install:{why:"Installs a pm package into project scope by default, using local, npm, GitHub, or bundled alias sources.",examples:["pm install '*' --project","pm install ./packages/pm-todos --project","pm install npm:@scope/pm-package --global","pm install --github org/repo/packages/my-pm-package --ref main"],tips:["Installed packages are recorded in managed state and can be inspected with pm package manage."]},upgrade:{why:"Updates the global pm CLI/SDK and refreshes managed pm packages from recorded install sources.",examples:["pm upgrade --dry-run","pm upgrade --packages-only --project","pm upgrade todos --dry-run","pm upgrade --cli-only --repair","pm upgrade --tag next --dry-run"],tips:["Omit target to include the CLI/SDK plus all managed packages in the selected scope.","Pass a target to refresh one managed package by name, directory, package name, or source.","Use --packages-only in repository automation when the global CLI should not be changed."]},create:{why:"Creates a new planning item with deterministic metadata and history.",examples:['pm create --title "Harden lock flow" --description "Improve stale lock handling" --type Task --status open --priority 1 --message "Create lock hardening task" --create-mode progressive','pm create --title "Weekly planning sync" --description "Recurring coordination meeting" --type Meeting --schedule-preset lightweight','pm create --title "Asset: Hero model" --description "Track playable model asset" --type Asset --status open --priority 1 --message "Create asset item" --type-option category=Character --dep "id=pm-epic01,kind=parent,created_at=now" --comment "created_at=now,text=Why this asset item exists." --note "created_at=now,text=Initial implementation note." --learning "created_at=now,text=Durable lesson placeholder." --file "path=src/assets/hero.glb,note=tracked asset" --test "command=node scripts/run-tests.mjs test,timeout_seconds=240" --doc "path=README.md,note=asset docs"'],tips:["Use --schedule-preset lightweight for Reminder/Meeting/Event when you want minimal required create inputs.","Use --type <value> to load type-aware policy guidance in --help output."]},focus:{why:"Sets a session focused item so new pm create items default their --parent to it (project management = context management).",examples:["pm focus pm-epic1","pm focus","pm focus --clear"],tips:["Focus is session-local (stored in .agents/pm/runtime/session.json, gitignored) \u2014 it never affects teammates.",'An explicit --parent on pm create always overrides the focused item; use --parent "" to create with no parent.',"A stale focused item produces the same missing-parent validation as an explicit stale --parent."]},update:{why:"Mutates existing item fields while preserving history and lock safety.",examples:['pm update pm-a1b2 --status in_progress --message "Start implementation"','pm update pm-a1b2 --unset close-reason --message "Clear stale close reason after reopen"','pm update pm-a1b2 --unset assignee --deadline +2d --message "Replan ownership and deadline"','pm update pm-a1b2 --body "Backfilled body text for legacy item" --message "Normalize missing body"'],tips:['Use "pm close <ID> <TEXT>" to close items instead of --status closed.',"When reopening from closed to a non-terminal status, update clears stale close_reason unless explicitly set via --close-reason.",'Use "pm append <ID> --body <text>" for additive notes; use update --body to replace body content.']},"update-many":{why:"Bulk-updates matched item sets with dry-run previews and rollback checkpoints for safe large-scale metadata changes.",examples:["pm update-many --filter-status open --status in_progress --dry-run",'pm update-many --filter-tag wave:7 --replace-tests --test "command=node scripts/run-tests.mjs test -- tests/core/history.spec.ts,timeout_seconds=240"','pm update-many --filter-tag governance --reviewer maintainer-review --message "Normalize reviewer metadata"',"pm update-many --rollback ckpt-abc123"],tips:["Use --dry-run first to inspect proposed changes before apply mode.","Linked-array mutation flags mirror pm update semantics (for example --replace-tests, --clear-files, and repeatable --doc/--note seeds).","Checkpoints are enabled by default for apply mode and can be restored with --rollback."]},"close-many":{why:"Bulk-closes matched items with a shared reason routed through full pm close semantics (close validation, active-child orphan checks, blocked-edge cleanup) plus dry-run previews and rollback checkpoints \u2014 unlike update-many --status closed, which bypasses close validation.",examples:['pm close-many --filter-sprint S-12 --reason "Sprint S-12 acceptance criteria met" --dry-run','pm close-many --filter-tag wave:7 --reason "Superseded by redesign" --validate-close warn','pm close-many --ids pm-a,pm-b,pm-c --reason "Closed in batch" --resolution "Verified by integration suite"',"pm close-many --rollback close-many-20260604-abc123"],tips:["At least one filter (--filter-* or --ids) is required so close-many never matches every item.","Already-terminal matches are skipped by default; pass --force to re-close them.","Use --dry-run to preview matches plus per-item skip reasons and active-child orphan warnings before applying.","Checkpoints are enabled by default for apply mode; restore with --rollback <checkpoint-id>."]},templates:{why:"Saves, lists, and inspects reusable create option bundles for repeatable workflows.",examples:['pm templates save triage-default --title "Triage item" --description "..." --type Task --status open --priority 2 --message "Seed triage template"',"pm templates list","pm templates show triage-default"],tips:["Template names are positional arguments (`pm templates save <name>` and `pm templates show <name>`), not --name flags.","Combine templates with explicit create flags; explicit flags always override template defaults."]},deps:{why:"Inspects an item dependency graph as a tree or graph payload to understand blockers and hierarchy links.",examples:["pm deps pm-a1b2","pm deps pm-a1b2 --format graph","pm deps pm-a1b2 --max-depth 2 --collapse repeated --summary"],tips:["Use --summary for lightweight counts when full graph payloads are unnecessary."]},list:{why:"Lists active items with deterministic filtering and ordering.",examples:["pm list --limit 20","pm list --type Task --priority 0 --tag release --status in_progress","pm list --compact --sort deadline --order asc","pm list --fields id,title,parent,type --sort parent --order asc"]},"list-all":{why:"Lists all item states (including terminal states) when you need full visibility.",examples:["pm list-all --limit 50","pm list-all --type Issue --include-body"]},"list-open":{why:"Shows work that is ready to claim and start.",examples:["pm list-open --priority 0 --limit 10"]},"list-in-progress":{why:"Tracks active execution and owner progress.",examples:["pm list-in-progress --priority 0 --limit 20"]},"list-blocked":{why:"Surfaces blocked work that needs intervention.",examples:["pm list-blocked --limit 20"]},"list-closed":{why:"Reviews completed work and closure outcomes.",examples:["pm list-closed --limit 20 --type Task"]},"list-canceled":{why:"Audits intentionally discontinued work.",examples:["pm list-canceled --limit 20"]},"list-draft":{why:"Finds incompletely defined items that need refinement before execution.",examples:["pm list-draft --limit 20"]},aggregate:{why:"Runs grouped aggregation queries for governance checks such as decomposition by parent/type or triage by status/priority.",examples:["pm aggregate --group-by parent,type --count","pm aggregate --group-by type,status --count","pm aggregate --group-by parent,type --count --status open --parent pm-feature01"],tips:["Current aggregate mode is grouped counts only, so pass --count explicitly."]},guide:{why:"Routes local progressive-disclosure documentation so agents can fetch only the context they need.",examples:["pm install guide-shell --project","pm guide","pm guide quickstart","pm guide commands --depth standard","pm guide skills --depth deep --format markdown","pm guide release --json"],tips:["Use brief depth for minimal token footprint, standard for excerpted docs, and deep for full local document rendering.","Use --list to force topic index output even when topic parsing is ambiguous."]},calendar:{why:"Provides deadline/reminder/event scheduling views for planning and coordination.",examples:["pm calendar","pm calendar --view agenda --from +0d --to +7d --tag release","pm calendar --view week --date 2026-04-06 --full-period --include deadlines,events","pm calendar --view month --tag release --format json"],tips:["Day/week/month views are anchored period windows; default mode clips the start to now unless --past or --full-period is set.","--full-period applies only to day/week/month views; use --from/--to to bound agenda windows."]},context:{why:"Builds an agent-optimized snapshot of critical active work plus near-term agenda context with progressive depth levels.",examples:["pm context","pm ctx --depth standard --limit 10","pm ctx --depth deep --tag release","pm ctx --section hierarchy --section progress --section blockers","pm context --depth standard --activity-limit 20 --stale-threshold 14d","pm context --from +0d --to +7d --format markdown --depth deep"],tips:["High-level focus contains Epics/Features and low-level focus contains Tasks/Issues/Chores/Decisions/Event/Reminder/Milestone/Meeting/Plan.","When no open or in-progress work exists, blocked items are shown as fallback context.","--depth brief (default) shows focus+agenda; standard adds hierarchy/activity/progress/workload; deep adds blockers/files/staleness/tests.","--section overrides --depth and selects specific sections: hierarchy, activity, progress, blockers, files, workload, staleness, tests.","Configure defaults via pm config project set context --default-depth standard --activity-limit 15."]},next:{why:"Answers 'what should I work on now?' with the highest-priority ready item, rationale, and ranked ready and blocked queues.",examples:["pm next","pm next --json","pm next --limit 3 --ready-only","pm next --parent pm-mpbb","pm next --tag release --format markdown"],tips:["Ready = active status, no open blockers, and no open children (a concrete leaf); the recommendation resumes in-progress work before starting new work.","An item is blocked when its scalar blocked_by or a blocked_by dependency points at a non-terminal item; the blocked list names the blockers to clear.","Containers (Epics/Features with open children) are never recommended directly \u2014 the actionable leaf beneath them is.","Use --parent to scope to one epic's subtree, or --ready-only to drop the blocked companion list for the tightest output."]},search:{why:"Finds relevant items by keyword, semantic, or hybrid retrieval modes.",examples:['pm search "lock stale retry" --mode keyword --limit 10','pm search "extension migration blockers" --mode hybrid --type Task --priority 0','pm search "Cross-Epic Realism Dependency Council" --mode keyword --title-exact'],tips:["Use --title-exact to require exact normalized title parity, or --phrase-exact to require full-phrase matches in item text fields.","Use --include-linked when linked docs/files/tests should influence scoring."]},eval:{why:"Measures search relevance against a curated golden-query set so retrieval regressions are caught, not guessed.",examples:["pm eval --json","pm eval --mode hybrid --k 10","pm eval --fail-under 0.6 --json","pm eval --queries ./my-eval.json --mode semantic"],tips:["Curate ground truth in <pmRoot>/search/eval-queries.json as an array of {query, relevant_ids, mode?} objects.","Wire --fail-under into CI to fail the build when aggregate nDCG@k drops below your baseline."]},reindex:{why:"Rebuilds search artifacts after large changes to item corpus or provider/vector config.",examples:["pm reindex --mode keyword","pm reindex --mode hybrid --progress --json"],tips:["Use --progress for non-interactive visibility during local embedding runs.","JSON output includes semantic stale/unchanged/embed/upsert counts so agents can gate long reindex work without parsing stderr."]},get:{why:"Shows details for one item by ID, with optional lower-token projections for agent loops.",examples:["pm get pm-a1b2","pm get pm-a1b2 --depth brief --json","pm get pm-a1b2 --fields id,title,status,parent,type --json","pm get pm-a1b2 --at 7 --fields id,title,status,body --json"],tips:["Default depth is standard for body plus linked artifacts without append-only logs; use brief for metadata-only checks or --full for complete history-heavy metadata.","Use --fields for the smallest deterministic item metadata payload when an agent only needs specific fields.","Schedule metadata is normalized under schedule; request schedule.start_at or schedule.location for narrow calendar reads.","Children are type-agnostic and include bounded deterministic samples plus continuation metadata when a parent has direct children.","Use --at <version|timestamp> for a verified read-only historical projection; reconstructed/as_of fields distinguish it from current state.","JSON output shape is { item, linked, claim_state, schedule, children }; body is nested at item.body (parity with list --include-body)."]},history:{why:"Inspects item mutation timeline and audit trail.",examples:["pm history pm-a1b2 --limit 20","pm history pm-a1b2 --full --verify"]},"history-compact":{why:"Compacts long history streams into a synthetic checkpoint while preserving replay integrity. Pass an item id for one stream, or a bulk selector (--ids/--all-over/--closed/--all-streams) to sweep many.",examples:["pm history-compact pm-a1b2 --dry-run",'pm history-compact pm-a1b2 --before 25 --message "Compact early history"',"pm history-compact --all-over 500 --dry-run","pm history-compact --closed","pm history-compact --ids pm-a1b2,pm-c3d4 --dry-run"]},activity:{why:"Reviews recent tracker-wide activity across items.",examples:["pm activity --limit 50","pm activity --full --id pm-a1b2 --limit 50","pm activity --id pm-a1b2 --op update --from -7d --to now","pm activity --json --stream rows --limit 200"],tips:["Use --stream with --json for line-delimited automation output; --from is inclusive and --to is exclusive."]},restore:{why:"Restores an item to a prior timestamp/version with history replay safety.",examples:['pm restore pm-a1b2 2026-04-01T00:00:00.000Z --message "Rollback to known-good state"']},close:{why:"Transitions work to terminal closed state with explicit rationale.",examples:['pm close pm-a1b2 "Done" --release-assignment --validate-close warn','pm close pm-a1b2 "Done" --validate-close','pm close pm-a1b2 "Done" --validate-close off','pm close pm-a1b2 "Done" --validate-close strict']},delete:{why:"Removes an item while preserving history evidence and lock/ownership checks.",examples:['pm delete pm-a1b2 --message "Remove duplicate item"']},append:{why:"Adds implementation notes to body without replacing existing content.",examples:['pm append pm-a1b2 --body "Implemented retry with bounded backoff." --message "Record implementation detail"']},comments:{why:"Adds or reviews lightweight status updates linked to an item.",examples:['pm comments pm-a1b2 "Verified fix on Linux and macOS"','pm comments pm-a1b2 --add "Verified fix on Linux and macOS"','printf "%s\\n" "## Verification" "- linux pass" "- mac pass" | pm comments pm-a1b2 --stdin',"pm comments pm-a1b2 --file docs/release-evidence.md",'pm comments pm-a1b2 --add "text: verification note with commas, key-like words, and parser details"','pm comments pm-a1b2 --add "Follow-up needed after review" --force',"pm comments pm-a1b2 --limit 10"],tips:["Use exactly one comment source at a time: positional [text], --add, --stdin, or --file.","Use --force when adding comments to items currently assigned to a different owner.","When --add payload resembles CSV-like key fragments (for example text=hello,scope:project), plain-text fallback is intentional; use explicit text=..., markdown text: ..., or stdin token - for structured intent."]},notes:{why:"Adds or reviews durable implementation notes linked to an item.",examples:['pm notes pm-a1b2 --add "Investigated parser edge case and documented fallback logic."','pm notes pm-a1b2 --add "text: parser rationale with commas, colons, and key-like wording"','pm notes pm-a1b2 --edit 1 --add "Corrected durable note"',"pm notes pm-a1b2 --delete 2","pm notes pm-a1b2 --limit 10"],tips:["CSV-like add payloads with extra key fragments are treated as plain text by design; use explicit text keys (text= or text:) when structured parsing is required."]},learnings:{why:"Adds or reviews post-implementation learnings for future work.",examples:['pm learnings pm-a1b2 --add "Avoid direct test-runner commands in linked tests; use sandbox runner."','pm learnings pm-a1b2 --add "text: lesson with commas, key-like words, and punctuation-safe context"',"pm learnings pm-a1b2 --edit 1 --file docs/corrected-learning.md","pm learnings pm-a1b2 --delete 2","pm learnings pm-a1b2 --limit 10"],tips:["If you intended structured parsing for a key-like payload, prefer explicit text=..., markdown text: ..., or stdin token -; ambiguous CSV-like forms intentionally remain plain text."]},files:{why:"Associates changed source files with tracker items for reproducibility.",examples:['pm files pm-a1b2 --add "path=src/cli/main.ts,note=help orchestration"','pm files pm-a1b2 --add src/cli/main.ts --note "help orchestration"',"pm files discover pm-a1b2",'pm files discover pm-a1b2 --apply --note "discovered from item text"']},docs:{why:"Associates relevant documentation paths with tracker items.",examples:['pm docs pm-a1b2 --add "path=README.md,note=user-facing command guidance"','pm docs pm-a1b2 --add README.md --note "user-facing command guidance"']},test:{why:"Links test commands/paths and optionally executes them for one item.",examples:['pm test pm-a1b2 --add "command=node scripts/run-tests.mjs test -- tests/unit/output.spec.ts,timeout_seconds=2400"','pm test pm-a1b2 --add "command=pm list-all --type Task --limit 200,assert_stdout_contains=count:,assert_stdout_regex=count:\\s+\\d+"','pm test pm-a1b2 --add "command=pm list-all --type Task --limit 200,pm_context_mode=auto"',"pm test pm-a1b2 --run --timeout 2400 --env-set PORT=0 --env-clear PLAYWRIGHT_BASE_URL --shared-host-safe --pm-context tracker --fail-on-context-mismatch --fail-on-skipped","pm test pm-a1b2 --run --timeout 2400 --pm-context auto","pm test pm-a1b2 --run --background --timeout 2400 --progress"]},"test-all":{why:"Runs linked tests in bulk for release/readiness sweeps.",examples:["pm test-all --status in_progress --limit 5 --offset 10 --timeout 2400","pm test-all --status closed --timeout 3600 --progress --env-set PORT=0 --shared-host-safe --fail-on-skipped","pm test-all --status in_progress --pm-context tracker --fail-on-context-mismatch --require-assertions-for-pm","pm test-all --status in_progress --pm-context auto --fail-on-context-mismatch","pm test-all --status in_progress --background --timeout 3600"]},"test-runs":{why:"Manages background linked-test runs with lifecycle controls and log/status inspection.",examples:["pm test-runs list --status running --limit 20","pm test-runs status tr-abc123","pm test-runs logs tr-abc123 --stream stderr --tail 200","pm test-runs stop tr-abc123","pm test-runs resume tr-abc123"]},stats:{why:"Reports tracker-level totals and distribution by type/status.",examples:["pm stats","pm stats --json"]},telemetry:{why:"Inspects and manages local telemetry queue/runtime state for observability diagnostics.",examples:["pm telemetry status","pm telemetry stats --limit 10","pm telemetry flush","pm telemetry clear"]},health:{why:"Validates tracker/runtime health including extension triage, migration, and integrity diagnostics.",examples:["pm health","pm health --check-only --summary --json","pm health --brief --json","pm health --no-refresh","pm health --refresh-vectors"]},validate:{why:"Runs standalone metadata, resolution, lifecycle (including dependency-cycle diagnostics), linked-file, linked-command reference, and history drift checks with default remediation hints for resolution gaps.",examples:["pm validate","pm validate --check-resolution --json","pm validate --check-lifecycle --dependency-cycle-severity error","pm validate --check-lifecycle --parent-cycle-severity error","pm validate --check-files --scan-mode tracked-all","pm validate --check-files --scan-mode tracked-all-strict --include-pm-internals","pm validate --check-command-references","pm validate --check-resolution --fail-on-warn --json"],tips:["Resolution-gap warnings include default `pm update <id> ...` remediation hint templates in check details."]},gc:{why:"Deletes optional cache artifacts by default to keep local tracker state tidy; use --dry-run to preview targets without deleting files.",examples:["pm gc --dry-run","pm gc"]},claim:{why:"Claims an item to signal active ownership and reduce conflicts.",examples:["pm claim pm-a1b2 --start",'pm claim pm-a1b2 --force --message "Take over terminal item"','pm claim pm-a1b2 --author "release-service" --message "Explicit non-agent identity override"'],tips:["Claim takeover for non-terminal items does not require --force; --force is reserved for terminal/lock overrides.","Harness identity is automatic; use --author only to assert an intentional external principal."]},release:{why:"Releases an active claim when paused, handed off, or completed.",examples:["pm release pm-a1b2 --pause"]},"start-task":{why:"Lifecycle alias that claims an item and sets status to in_progress.",examples:['pm start-task pm-a1b2 --message "Start implementation"']},"pause-task":{why:"Lifecycle alias that sets status to open and releases active assignment.",examples:['pm pause-task pm-a1b2 --message "Pause for dependency unblock"']},"close-task":{why:"Lifecycle alias that closes with reason text and clears assignment metadata.",examples:['pm close-task pm-a1b2 "All acceptance criteria met" --message "Close and handoff"']},meet:{why:"Shortcut to create a Meeting from friendly time flags (start/duration) without structured --event CSV.",examples:['pm meet "Sprint Planning" --start +1h --duration 1h','pm meet "1:1" --start 2026-07-01T15:00:00Z --end 2026-07-01T15:30:00Z --location "Room A"'],tips:["Start defaults to now and duration to 1h; pass --end to set an explicit end instead of --duration.","--duration accepts relative tokens (h/d/w/m where m is months) plus sub-hour forms like 30min or PT30M."]},event:{why:"Shortcut to create an Event from friendly time flags (start/duration) without structured --event CSV.",examples:['pm event "Release v2" --start 2026-07-01T10:00:00Z --duration 2h','pm event "Conference" --start 2026-08-01 --all-day'],tips:["Start defaults to now and duration to 1h; pass --end to set an explicit end instead of --duration.","--duration accepts relative tokens (h/d/w/m where m is months) plus sub-hour forms like 30min or PT30M."]},remind:{why:"Shortcut to create a Reminder from a single point in time without structured --reminder CSV.",examples:['pm remind "Review PR" --at +2d','pm remind "Follow up" --at 2026-07-01T09:00:00Z --text "Ping the team"'],tips:["The reminder time defaults to +1d and the reminder text defaults to the title."]},completion:{why:"Generates shell completion scripts for faster and more reliable command entry.",examples:["pm completion bash","pm completion zsh","pm completion fish","pm completion bash --eager-tags"],tips:["Default scripts resolve tag suggestions lazily at completion time; use --eager-tags to embed current tags directly."]},contracts:{why:"Exposes machine-readable CLI command and tool schema contracts for agent integrations.",examples:["pm contracts","pm contracts --command list --runtime-only","pm contracts --command update --flags-only","pm contracts --availability-only --runtime-only","pm contracts --action create","pm contracts --schema-only"],tips:["Use --command to narrow actions/schema to one CLI surface; combine with --flags-only or --availability-only for lighter payloads."]}};for(let{alias:e,canonical:t}of M){let n=le[e];n&&(le[t]={...n,examples:n.examples.map(o=>o.replace(`pm ${e}`,`pm ${t}`))})}var vt={why:"Provides deterministic project management workflows for humans and coding agents.",examples:["pm init","pm install guide-shell --project","pm list-open --limit 10",'pm create --title "..." --description "..." --type Task --status open --priority 1 --message "..." --create-mode progressive'],tips:["Use <command> --help for command-specific guidance and examples.","Install guide-shell before using pm guide for local docs and skills routing.","Use --json for machine parsing and integration flows.","Use --no-pager to force direct help output in CI and other non-interactive shells."]},Ji=ee.filter(e=>e.lifecycle==="deprecated");for(let e of Ji){let t=le[e.alias];le[e.alias]={...t,why:`Deprecated: use pm ${e.canonical_argv.join(" ")}. ${t.why}`}}for(let e of[vt,...Object.values(le)])e.examples=e.examples.map(t=>{for(let n of Ji){let o=n.alias.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=t.replaceAll(new RegExp(`\\bpm ${o}(?![\\w-])`,"g"),`pm ${n.canonical_argv.join(" ")}`)}return t});function qa(e){let t=N(e??"");return t?La[t]??t:""}function Ha(e){let t=qa(e);return t?le[t]??vt:vt}function Yi(e,t){let n=Ha(e);return{intent:n.why,examples:t==="detailed"?[...n.examples]:Bi(n.examples),tips:t==="detailed"?[...n.tips??[]]:[],detail_mode:t}}function za(){let e=ee.filter(({lifecycle:n})=>n==="permanent"),t=ee.filter(({lifecycle:n})=>n==="deprecated");return["","Command aliases:",...e.map(({alias:n,canonical_argv:o})=>` ${n} -> pm ${o.join(" ")}`),"","Deprecated aliases:",...t.map(n=>` ${n.alias} -> pm ${n.canonical_argv.join(" ")} (${$o(n)})`)].join(`
|
|
4
4
|
`)}function Ga(e,t,n,o){let i=new Set(Ri);e.configureHelp({visibleCommands(r){let a=t.visibleCommands(r);return n?a.filter(s=>(se(s)??B(s.name()))!=="internal"):r!==e?a:a.filter(s=>o.has(s))},visibleOptions(r){let a=t.visibleOptions(r);return r!==e||n?a:a.filter(s=>i.has(s.flags))}})}function Wa(e,t,n,o){let i=new Set(Pi("core")),r=e.createHelp();r.prepareContext({error:!1,helpWidth:80,outputHasColors:!1});let a=()=>`${r.formatHelp(e,r)}${o}
|
|
@@ -30,7 +30,7 @@ Extension command metadata:
|
|
|
30
30
|
`)}return process.exitCode=f.SUCCESS,!0}function Gl(e,t){let n=["","Type-aware option policies:"," pass --type <value> with --help to render required/disabled/hidden option policy details for that type.",` active type values: ${t.types.join("|")}`];return e==="create"&&n.push(" scheduling shortcut: use --schedule-preset lightweight for Reminder/Meeting/Event minimal create flows."),n.join(`
|
|
31
31
|
`)}function Wl(e,t){if(t.options.length===0){e.push(" type options: none");return}e.push(" type options:");for(let n of t.options){let o=n.required?" (required)":"",i=n.aliases??[];e.push(` - ${n.key}${o}`),e.push(` values: ${n.values.length>0?n.values.join("|"):"any non-empty string"}`),e.push(` aliases: ${i.length>0?i.join("|"):"none"}`),n.description&&n.description.trim().length>0&&e.push(` description: ${n.description.trim()}`)}}function Vl(e,t){let n=e==="create"?new Set(["title","type"]):new Set,o=new Set(n);if(e==="create")for(let i of[...t.required_create_fields,...t.required_create_repeatables])o.add(i);return{progressive:n,strict:o}}function Bl(e,t,n,o){let i=new Set(n),r=o.filter(l=>!i.has(l)),a=l=>l.length>0?l.map(d=>Bt("create",d)).join(", "):"none";e.push(` required in strict mode: ${a(r)}`);let s=r.map(Fi).filter(l=>l!==void 0);e.push(` explicit empty assertion: ${s.length>0?s.join(", "):"none"}`),["Reminder","Meeting","Event"].includes(t.name)&&(e.push(" schedule preset: --schedule-preset lightweight switches schedule artifacts to progressive required-option policy."),e.push(" strict parity remains available via --create-mode strict."))}function Kl(e,t,n){let o=Ui(n);if(!o)return Gl(e,t);let i=Fo(o,t);if(!i){let h=t.types.join("|");return["",`Type-aware option policies: type "${o}" is not in the active registry.`,` active type values: ${h}`].join(`
|
|
32
32
|
`)}let r=n.indexOf("--"),a=r<0?n:n.slice(0,r),s=a.findIndex(h=>h==="--create-mode"||h.startsWith("--create-mode=")),l=s<0?void 0:a[s]?.startsWith("--create-mode=")?a[s]?.slice(14):a[s+1],d=e==="create"&&l?.toLowerCase()==="strict",c=Vl(e,i),m=it(i,e,c.progressive),p=it(i,e,d?c.strict:c.progressive),u=h=>h.length>0?h.map(y=>Bt(e,y)).join(", "):"none",g=["",`Type-aware option policies for ${i.name}:`,` required: ${u(p.required)}`,` disabled: ${u(p.disabled)}`,` hidden: ${u(p.hidden)}`];if(e==="create"){let h=it(i,e,c.strict);Bl(g,i,m.required,h.required)}return Wl(g,i),p.errors.length>0&&g.push(` config errors: ${p.errors.join("; ")}`),g.join(`
|
|
33
|
-
`)}function Wr(e,t,n){let o=k(n);if(o!=="create"&&o!=="update")return;let i=We(e,o);i&&i.addHelpText("after",Kl(o,t,n))}(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]="840b471e-c996-57e2-b97c-3a84bd68f050")}catch{}})();function Jl(e,t){let n=Ie(e.id);return n||`migration-${String(t+1).padStart(3,"0")}`}function Yl(e){return Ie(e.status)?.toLowerCase()??"pending"}function Xl(e){return e.mandatory===!0}function Ql(e,t){let n=e.layer.localeCompare(t.layer);if(n!==0)return n;let o=e.name.localeCompare(t.name);return o!==0?o:e.id.localeCompare(t.id)}function Kr(e){let t=[];return e.forEach((n,o)=>{if(!Xl(n.definition))return;let i=Yl(n.definition);i!=="applied"&&t.push({layer:n.layer,name:n.name,id:Jl(n.definition,o),status:i})}),t.sort(Ql),t}function Vr(e){return Array.isArray(e)&&e.length>0}var Zl=new Set(["create","beads import","todos import"]),ec=new Set(["restore","update","close","delete","append","claim","release"]),tc=new Set(["comments","notes","learnings"]),nc=new Set(["files","docs","test"]),oc=new Set(["activate","add","add-field","add-status","add-type","apply","compact","create","deactivate","delete","disable","edit","enable","import","infer","install","materialize","migrate","redact","remove","remove-field","remove-status","remove-type","remap-status","rename-field","rename-type","repair","run","save","set","unset","update","upgrade"]);function Hn(e,t){let n=t.force===!0;return Zl.has(e)?{isMutation:!0,forceCapable:!1,forceRequested:!1}:ec.has(e)?{isMutation:!0,forceCapable:!0,forceRequested:n}:tc.has(e)?{isMutation:typeof t.add=="string",forceCapable:!0,forceRequested:n}:nc.has(e)?{isMutation:Vr(t.add)||Vr(t.remove),forceCapable:!0,forceRequested:n}:{isMutation:!1,forceCapable:!1,forceRequested:!1}}function ic(e,t,n){if(Hn(e,n).isMutation)return!0;let o=e.trim().toLowerCase();return ki(o)?["close-many","close-task","copy","delete","discover","focus","pause-task","start-task","update-many"].includes(o)?!0:t.some(i=>oc.has(i.trim().toLowerCase())):!1}function Br(e){return(e??"in_progress").trim().toLowerCase().replaceAll("-","_")}function rc(e,t,n){let o=t[0]?.trim().toLowerCase()??"";if(e.trim().toLowerCase()!=="schema"||!["rename-type","rename-field","remap-status"].includes(o))return;let i=[];if(Ie(t[1])||i.push("source"),Ie(n.to)||i.push("--to"),i.length!==0)throw new C(`Schema migration requires ${i.join(", ")}.`,f.USAGE,{code:"schema_migration_input_required",required:i.join(","),why:"Schema migrations require a source and target. A workspace-bound stable migration id is derived automatically when --migration-id is omitted.",recovery:{recovery_mode:"compact",missing_required_fields:i,suggested_flags:i.filter(r=>r.startsWith("--")),suggested_retry:`pm schema ${o} <source> --to <target>`}})}async function ac(e,t,n,o,i){if(e.trim().toLowerCase()!=="update"||typeof n.status!="string"||Br(n.status)!==Br(i.schema.workflow.in_progress_status))return;let r=t[0];if(!r)return;let a=te(i,ne()),s=await dt(o,r,i.id_prefix,i.item_format,a.type_to_folder);if(!s)return;let l=await hi(s,{schema:i.schema}),d=typeof n.assignee=="string"?n.assignee.trim():void 0;(d===void 0?l.document.metadata.assignee?.trim():!["","none","null","undefined"].includes(d.toLowerCase())&&d)||w(`warning:in_progress_item_unclaimed:${s.id}:claim_with=pm claim ${s.id}`)}async function zn(e,t,n,o,i){if(!ic(e,t,n)||(rc(e,t,n),!await W(V(i))))return;let r=await _e(i);o.json!==!0&&await ac(e,t,n,i,r.settings);let a=xi({author:ct(o.author,r.settings.author_default),payload:{command:e,args:t,options:n},settings:r.settings.mutation_guard,force:o.force===!0||n.force===!0});for(let s of a.warnings)w(`warning:${s}`)}function Jr(e,t,n){if(n.length===0)return;let o=Hn(e,t);if(!o.isMutation||o.forceCapable&&o.forceRequested)return;let i=n.map(a=>`extension_migration_blocking:${a.layer}:${a.name}:${a.id}:${a.status}`),r=o.forceCapable?"Re-run this command with --force to bypass.":"This command path does not support --force bypass.";throw new C(`Write command "${e}" blocked by unresolved mandatory extension migrations (${i.join(",")}). ${r}`,f.CONFLICT)}async function Gn(e,t,n,o){if(!Hn(e,t).isMutation||!o.enforce_item_format_gate&&!o.run_preflight_item_format_sync||!await W(V(n)))return;let{settings:r,metadata:a,warnings:s}=await _e(n);for(let l of s)w(`warning:${l}`);if(o.enforce_item_format_gate&&!a.has_explicit_item_format&&(fi(r),await gi(n,r,"item_format:auto_select_default")),o.run_preflight_item_format_sync){let l=te(r,ne());await Ei(n,r.item_format,"item_format:pre_mutation_sync",l.type_to_folder,r.schema)}}(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]="697f96fe-38a0-5530-b54b-22cb442c130f")}catch{}})();function Wn(e){let t=[];for(let n of e??[]){if(n.startsWith("-"))break;let o=_(n);o.length!==0&&t.push(o)}return t}function Ee(e){let t=_(e.commandPath??"");if(t.length===0)return[];let n=[t],o=t.split(" ").filter(i=>i.length>0);for(let i of Wn(e.commandArgs))o.push(...i.split(" ").filter(r=>r.length>0)),n.push(o.join(" "));return[...new Set(n.flatMap(i=>[i,T(i)]))]}function Vn(e,t){let n=_(e);if(n.length===0)return!1;let o=Ee(t);for(let i of o)if(i===n||i.startsWith(`${n} `))return!0;return t.allowCommandPrefixMatch===!0?o.some(i=>n.startsWith(`${i} `)):!1}function It(e){let t=e.activation?.commands;if(t)return t;let n=e.contributions;return n?[...O(n.commands),...O(n.command_handlers),...O(n.command_overrides),...O(n.flag_commands),...O(n.parser_overrides),...Yr(n.preflight_ownership),...Yr(n.renderer_ownership)]:[]}function O(e){return e??[]}function Yr(e){return O(e).flatMap(t=>t.commands)}function Ke(e){return new Set((e.capabilities??[]).map(t=>t.trim().toLowerCase()))}var Xr=new Set(["hooks","parser","preflight","renderers"]),Qr=new Set(["commands","schema","services","importers"]),sc=new Set(["reindex","search","search-advanced"]),lc=new Set(["--template"]);function ke(e,t){for(let n of t)if(e.has(n))return!0;return!1}function Bn(e){let t=_(e??"");if(t.length===0)return!1;let[n]=t.split(" ");return sc.has(n??t)}function Kn(e,t){for(let n of e.commandArgs??[]){if(!n.startsWith("--"))continue;let[o]=n.split("=",1);if(t.has(o))return!0}return!1}function Pt(e){return _(e.commandPath??"")==="create"&&Kn(e,lc)}function Jn(e){return e.some(t=>{let n=_(t);return n==="templates"||n.startsWith("templates ")})}function Rt(e,t){return e.some(n=>Vn(n,t))||Pt(t)&&Jn(e)}function Yn(e){return[O(e.hooks).length,(e.preflight_overrides??0)-O(e.preflight_ownership).length,O(e.item_types).length,O(e.item_fields).length,O(e.relationship_kinds).length,O(e.service_overrides).length,O(e.assurance_providers).length,O(e.renderer_overrides).length-O(e.renderer_ownership).length].some(n=>n>0)}function Xn(e,t){let n=e.activation?.commands??[];if(n.length>0)return Rt(n,t);let o=It(e);if(Rt(o,t)||Ke(e).has("search")&&Bn(t.commandPath))return!0;if(e.contributions)return Yn(e.contributions)}function $t(e,t){let n=Xn(e,t);if(n!==void 0)return n;let o=Ke(e);return!!(ke(o,Xr)||ke(o,Qr))}function Je(e,t){return e.effective.length===0?!1:Ye(t)!=="all"?e.effective.some(o=>$t(o,t)):e.effective.some(o=>{let i=Ke(o);return It(o).length>0||ke(i,Xr)||ke(i,Qr)||i.has("search")})}function Ye(e){if(_(e.commandPath??"").split(" ")[0]==="completion")return"all";let t=Ee(e).filter(i=>i.split(" ").every(r=>!r.startsWith("-"))).sort((i,r)=>r.length-i.length)[0]??_(e.commandPath??"");if(t.length===0)return"all";let n=Pt(e)?"--template":"";return`${e.allowCommandPrefixMatch===!0?"prefix":"exact"}:${t}:${n}`}function Qn(e){return Ye(e)==="all"?void 0:t=>$t(t,e)}function Se(e){let t=E(e);if(t.requested&&t.commandPathTokens.length>0){let[i,...r]=t.commandPathTokens;return{commandPath:i,commandArgs:r,allowCommandPrefixMatch:!0}}let n=G(e),o=n.findIndex(i=>i.trim().length>0&&!i.startsWith("-"));return o<0?{}:{commandPath:n[o],commandArgs:n.slice(o+1),allowCommandPrefixMatch:t.requested}}function Zn(e){let t=e.args.map(String);if(_(A(e))==="create"){let o=e.optsWithGlobals();typeof o.template=="string"&&o.template.trim().length>0&&t.push("--template")}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]="4584c97a-4e3c-551e-95a4-2f63a7fc152e")}catch{}})();var Dt=Symbol.for("pm.readOutputInvocationProvenance");function eo(e,t){let n=Reflect.get(e,Dt);n!==void 0&&Reflect.set(t,Dt,n)}function to(e,t,n){let o=ii(t,n);if(!o)return;let i=e;for(;i.parent;)i=i.parent;let r=i.rawArgs,a=new Set(K(r.slice(2))),s=oi.find(c=>c.command===o),l=Object.values(s.dimensions).flatMap(c=>c.legacy_aliases.flatMap(m=>a.has(m.flag)?[m.flag]:[])),d=Reflect.get(n,Dt);Reflect.set(n,Dt,{canonical_include_modes:d?.canonical_include_modes??[],explicit_legacy_aliases:l,cli_invocation_observed:!0}),eo(n,e)}function no(e,t,n,o){to(e,t,o);let i=n.outputInclude;if(i===void 0)return;let{selectors:r,modes:a}=si(t,i,o);if(t==="get"&&typeof o.fields=="string"&&e.setOptionValueWithSource("fields",o.fields,"cli"),a.length===0)return;eo(o,e);let s=ai(t);for(let d of a){let c=s.get(d),m=o[c];e.setOptionValueWithSource(c,m,"cli")}let l=r.length>0?r.join(","):void 0;l===void 0?delete n.outputInclude:n.outputInclude=l;for(let d=e;d;d=d.parent)d.setOptionValueWithSource("outputInclude",l,"cli");yt(e,n)}function cc(e){let t=e.optsWithGlobals(),n=A(e);if(T(n)===n)return t;let o=e.opts();for(let i=e.parent;i?.parent;i=i.parent)for(let r of Object.keys(i.opts()))!(r in o)&&i.getOptionValueSource(r)==="default"&&delete t[r];return t}function Ae(e,t,n=[]){let i={...cc(e)};eo(e,i),delete i.json,delete i.quiet,delete i.path,delete i.pmPath,delete i.noExtensions,delete i.extensions,delete i.profile,delete i.pager,delete i.changedFields,delete i.fullChangedFields,delete i.idOnly,delete i.lean,delete i.tokenAccounting,delete i.outputInclude,delete i.outputLimit,delete i.outputBudget,delete i.outputFormat,delete i.outputSession;let r=Lr(t);for(let[a,s]of Object.entries(r))i[a]===void 0&&(i[a]=s);if(n.length>0){let a=Nr(n),s=ft(A(e)).map(d=>({long:d.flag,short:d.short,aliases:d.aliases})),l={...r};for(let d of a)i[d]!==void 0&&(l[d]=i[d]);return jn(l,[...s,...n],A(e)),Fr(i,n,r)}return i}function Nt(e,t){let n=_(t);return n.length===0?[]:e.flags.filter(o=>T(_(o.target_command))===T(n)).flatMap(o=>o.flags)}function Xe(e,t,n){let o=Nt(e,t),i=[t],r=[];for(let a of n){if(a.startsWith("-"))break;i.push(a);let s=Nt(e,i.join(" "));s.length>0&&(r=s)}return r.length>0?r:o}function Mt(e){return e.arguments??[]}function Zr(e){let t=Mt(e).map(n=>{let o=n.variadic?`${n.name}...`:n.name;return n.required?`<${o}>`:`[${o}]`}).join(" ");return`pm ${e.command}${t?` ${t}`:""}`}function oo(e,t){if(!e)return!1;let n=_(t);return e.importers.some(o=>_(`${o.importer} import`)===n)||e.exporters.some(o=>_(`${o.exporter} export`)===n)}function io(e,t){let n=Mt(e),o=n.filter(l=>l.required).length,r=n.some(l=>l.variadic)?Number.POSITIVE_INFINITY:n.length,a=e.failure_hints??[],s=a.length>0?` ${a.join(" ")}`:"";if(t.length<o)throw new C(`Missing required argument for extension command '${e.command}'. Usage: ${Zr(e)}${s}`,f.USAGE);if(t.length>r){let l=t.slice(r).join(" ");throw new C(`Too many arguments for extension command '${e.command}': ${l}. Usage: ${Zr(e)}${s}`,f.USAGE)}}function dc(e){return`--${e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}`}function mc(e,t,n){if(n.length>0){jn(t,n,e.command);return}let o=Object.keys(t).filter(i=>t[i]!==void 0).sort();if(o.length!==0)throw new C(`Unknown option '${o.map(dc).join(", ")}' for extension command '${e.command}'. This command does not define extension flags.`,f.USAGE)}function ro(e,t,n,o){e&&(io(e,t),mc(e,n,o))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="4963b2d7-c720-51bb-a621-5f9d7e40b909")}catch{}})();var pc=new Set(["--version","-V"]),uc=new Set(["config","extension","init","install","package","packages","templates","upgrade"]),ao=new Set(["activity","aggregate","context","ctx","events","get","graph","history","list","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","search"]),ea=new Set(["append","close","close-many","comments","delete","deps","discover","docs","files","history-repair","history-redact","history-compact","learnings","notes","plan","restore","update","update-many","create"]),fc=new Set(["claim","close-task","contracts","duplicates","gc","health","pause-task","release","start-task","stats","test","test-all","test-runs","test-runs-worker","validate"]),gc=new Set(["claim","close-task","pause-task","release","start-task","test"]),Ft={setup:!0,listQuery:!0,mutation:!0,operation:!0},hc=new Set(["create","update","update-many","list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled","search","calendar","context","templates"]);function Qe(e){return e.some(t=>pc.has(t))}function so(e){if(Qe(e))return{setup:!1,listQuery:!1,mutation:!1,operation:!1};if(e.length===0||E(e).requested)return Ft;let t=k(e);if(!t)return Ft;let n=t.trim().toLowerCase(),o=G(e),i=he(o)?.alias;return M.some(r=>r.alias===i)?{...Ft,targetCommandName:i}:uc.has(n)?{setup:!0,listQuery:!1,mutation:!1,operation:!1,targetCommandName:n}:ao.has(n)?{setup:!1,listQuery:!0,mutation:!1,operation:!1,targetCommandName:n}:ea.has(n)?{setup:!1,listQuery:!1,mutation:!0,operation:!1,targetCommandName:n}:fc.has(n)?{setup:!1,listQuery:!1,mutation:!1,operation:!0,targetCommandName:n}:Ft}function lo(e){return e.length===0||E(e).requested||e.includes("--explain")&&k(e)===void 0}function co(e,t){return Qe(t)?!1:ce(t)||E(t).requested?!0:!!k(t)}function mo(e){if(Qe(e))return!1;let t=k(e);return t?hc.has(t):!1}function yc(e){let t=String(e.rawFrom??""),n=t.indexOf("="),o=n>=0?t.slice(0,n):t,i=e.normalizedTokens.map(d=>{let c=d.indexOf("=");return c>=0?d.slice(0,c):d}).find(d=>d==="--literal"||d==="--regex"||d==="--replacement"),r=i?e.argv.map(d=>{let c=d.indexOf("=");return(c>=0?d.slice(0,c):d)===o?c>=0?`${i}${d.slice(c)}`:i:d}):e.argv,a=De(r),s=i&&n>=0?`${o}=[redacted]`:t,l=i&&e.normalizedDisplay.includes("=")?`${i}=[redacted]`:e.normalizedDisplay;return{argv:a,normalizedDisplay:l,sourceDisplay:s}}function po(e){let t=e.commandName;if(!t)return;let n=e.trace.find(d=>d.reason==="flag_typo");if(!n)return;let o=Array.isArray(n.to)?n.to:[String(n.to??"")].filter(d=>d.length>0),i=o.length>0?o.join(" "):"the canonical flag",r=ea.has(t)||gc.has(t),a=r?"mutating_flag_typo_requires_retry":"flag_typo_requires_retry",s=r?"mutating option":"option",l=yc({argv:e.argv,normalizedDisplay:i,normalizedTokens:o,rawFrom:n.from});throw new C(`Refusing to auto-correct ${s} ${l.sourceDisplay} to ${l.normalizedDisplay}. Retry with the canonical flag so the command is explicit.`,f.USAGE,{code:a,examples:[S(l.argv)],nextSteps:["Retry the command with the canonical flag shown in examples."],recovery:{normalized_args:l.argv,suggested_retry:S(l.argv)}})}(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]="afcf2608-3360-5030-b5ea-b101df5829e7")}catch{}})();var wc=new Set(["success","nonexistent_command","invalid_option","missing_required_option","missing_required_argument","invalid_usage","validation_failed","health_findings","validation_findings","conflict","runtime_failed","unknown_failed"]),vc=new Set(["parse","preflight","execute","unknown"]),_c=new Set(["usage","validation","conflict","runtime","unknown"]);function pe(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="string"){let i=o.trim();if(i.length>0)return i}}}function uo(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="boolean")return o}}function Lt(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="number"&&Number.isFinite(o))return Math.max(0,Math.trunc(o))}}function fo(e){if(!e)return;let t=e.trim().toLowerCase();if(wc.has(t))return t}function go(e){if(!e)return;let t=e.trim().toLowerCase();if(vc.has(t))return t}function ho(e){if(!e)return;let t=e.trim().toLowerCase();if(_c.has(t))return t}function yo(e){let t=pe(e,"error","message");if(t)return t;let n=e?.warnings;if(Array.isArray(n)){let a=n.find(s=>typeof s=="string"&&s.trim().length>0);if(typeof a=="string")return a.trim()}if(uo(e,"fail_on_skipped_triggered","failOnSkippedTriggered"))return"linked_test_fail_on_skipped_triggered";let i=Lt(e,"failed");if(typeof i=="number"&&i>0)return`failed_runs:${i}`;let r=e?.run_results;if(Array.isArray(r)){let a=r.filter(s=>Vt(s)?.status==="failed").length;if(a>0)return`failed_runs:${a}`}}function wo(e,t){if(!e)return t===f.USAGE?"invalid_command_usage":t===f.NOT_FOUND?"item_not_found":t===f.CONFLICT?"lock_conflict":t===f.DEPENDENCY_FAILED?"dependency_failed":"command_failed"}function vo(){let e=Vt(oe()),t=typeof process.exitCode=="number"&&Number.isFinite(process.exitCode)?Math.max(0,Math.trunc(process.exitCode)):void 0,n=Lt(e,"exit_code","exitCode"),o=t??n??f.SUCCESS,i=$i(o),r=pe(e,"error_code","errorCode")??wo(i,o),a=ho(pe(e,"error_category","errorCategory"))??(i?void 0:ot(r)),s=i?void 0:yo(e)??`command_exit_${o}`,l=fo(pe(e,"command_resolution","commandResolution"))??mt({ok:i,errorCode:r,errorCategory:a}),d=go(pe(e,"resolution_stage","resolutionStage"))??"execute";return{ok:i,error:s,exit_code:o,error_code:r,error_category:a,command_resolution:l,resolution_stage: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]="55cf18ea-fea1-5b3e-b10f-46f67f7f482b")}catch{}})();var _o="PM_CLI_PACKAGE_ROOT";function bc(){return Do(import.meta.url,["../.."])}(typeof process.env[_o]!="string"||process.env[_o]?.trim().length===0)&&(process.env[_o]=bc());var Te=null,q=null;function Cc(e){Te=e}function xc(e){I=e}var Ze=null,ue=null,I=new Map,Ao=250,kc=new Set([f.USAGE,f.NOT_FOUND,f.CONFLICT]),Ec=new Set(["1","true","yes","on"]),Sc=Fe(()=>import("./chunks/register-setup-HPHIKG5U.js")),Ac=Fe(()=>import("./chunks/register-list-query-IZ7ZVTDE.js")),Tc=Fe(()=>import("./chunks/register-mutation-IPAZTFDZ.js")),Oc=Fe(()=>import("./chunks/register-operations-APN33LNI.js"));function Ut(e){return S(e)}function ra(e){let t=e.match(/--[a-zA-Z0-9][a-zA-Z0-9_-]*/g);if(!t||t.length===0)return;let n=[...new Set(t.map(o=>ae(o)??o))];return n.length>0?n:void 0}function Rc(e,t,n){if(n?.suggested_retry||e.includes("failed in extension handler (")||!/\b(?:missing|required|requires)\b/i.test(e))return;let o=K(t),i=new Set(o.map(c=>ae(c)??c)),r=ra(e),a=t.find(c=>v.commands.some(m=>m.name()===c)),s=a?v.commands.find(c=>c.name()===a):void 0,l=new Set([...v.options,...s?.options??[]].flatMap(c=>c.flags.split(/[ ,|]+/).map(m=>ae(m)).filter(m=>m!==void 0))),d=r?.filter(c=>{let m=ae(c)??c;return i.has(m)?!1:l.has(m)||$n(t,a,m,I)!==void 0});return d&&d.length>0?d:void 0}function Ic(e,t,n,o){if(o?.suggested_retry)return o.suggested_retry;let i=n?.[0],r=i?ae(i):void 0,a=e.find(p=>v.commands.some(u=>u.name()===p)),s=a?v.commands.find(p=>p.name()===a):void 0,l=r?s?.options.find(p=>p.flags.split(/[ ,|]+/).includes(r)):void 0,d=$n(e,a,r,I),c=r?l?.isBoolean()===!0||d===!1?[r]:[r,"<value>"]:[],m=r?Ut([...e,...c]):t;return m===t?void 0:m}function Pc(e){if(!e)return{};let t=["recovery_mode","missing_required_fields","suggested_flags","suggested_retry_args","allowed_values","candidate_commands","candidate_commands_total","candidate_commands_truncated","fallback_candidates","next_best_command"],n={};for(let o of t){let i=e[o];i!=null&&(n[o]=i)}return n}function $c(e){let t=e.existingRecovery;return{attempted_command:t?.attempted_command??e.attemptedCommand,normalized_args:t?.normalized_args??[...e.invocationArgv],provided_fields:t?.provided_fields??(e.providedFields.length>0?e.providedFields:void 0),missing:t?.missing??e.inferredMissing,...Pc(t),...e.suggestedRetry?{suggested_retry:e.suggestedRetry}:{}}}function aa(e,t,n){let o=De(t),i=G(o),r=Ue(i),[a,s]=r===void 0?[]:i.slice(r,r+2),l=o.includes("--explain"),d=e?.recovery,c=d&&(a==="history-redact"||a==="history"&&s==="redact")?{...d,...d.attempted_command?{attempted_command:Ut(o)}:{},...d.normalized_args?{normalized_args:[...o]}:{},...d.suggested_retry?{suggested_retry:Ut(o)}:{},...d.suggested_retry_args?{suggested_retry_args:[...o]}:{}}:d;if(c?.recovery_mode==="compact"&&!l)return{...e,recovery:c};let m=Ut(o),p=K(o),u=Rc(n,o,c),g=Ic(o,m,u,c),h=$c({invocationArgv:o,attemptedCommand:m,providedFields:p,inferredMissing:u,suggestedRetry:g,existingRecovery:c});return{...e,recovery:h}}async function tt(e){let t=q;q=null,await Gi(t,e);let n=Te;if(Te=null,!n){at();return}let o=[],i=Zo();try{await Wi({pmRoot:n.pmRoot,author:n.globalOptions.author,itemIds:e.ok?i?.map(r=>r.id)??[]:[],intent:n.commandName})}catch{o.push("context_usage_feedback_write_failed")}try{o.push(...await zo(n.hooks,{command:n.commandName,args:n.commandArgs,options:{...n.commandOptions},global:{...n.globalOptions},pm_root:n.pmRoot,ok:e.ok,error:e.error,result:oe(),affected:i}))}catch(r){o=[`afterCommand hooks failed: ${r instanceof Error?r.message:String(r)}`]}finally{at()}!n.globalOptions.json&&o.length>0&&w(`[pm] warning: afterCommand hook_warnings=${L(o)}`),n.profileEnabled&&o.length>0&&w(`profile:extensions hook_warnings=${L(o)}`)}async function sa(){await bi()}function la(e){return Ec.has((process.env[e]??"").trim().toLowerCase())}function ca(e){return la("PM_SENTRY_CAPTURE_EXPECTED_ERRORS")?!0:!kc.has(Math.trunc(e))}async function qt(e){return ca(e.exit_code)?(await sa(),Ci(e),!0):!1}async function da(e){let t=re(e.error),n=mr(t);e.bootstrapGlobal.json?w(JSON.stringify(cr(t,f.GENERIC_FAILURE),null,2)):w(t),process.exitCode=f.GENERIC_FAILURE;let o="runtime",i="runtime_failed";try{await sa(),ln(e.error);let r=await e.emitTelemetryCommandError({command:e.attemptedCommand,errorCode:n.code,errorMessage:n.detail,exitCode:f.GENERIC_FAILURE,options:{bootstrap_global_options:e.bootstrapGlobal},resolutionStage:"execute"});o=r.errorCategory,i=r.commandResolution,Ne(!1,t,{error_code:n.code,error_category:o,exit_code:f.GENERIC_FAILURE,command_resolution:i,resolution_stage:"execute"})}catch(r){e.bootstrapGlobal.json||w(`Failed to report error: ${re(r)}`)}try{await tt({ok:!1,error:t,exit_code:f.GENERIC_FAILURE,error_code:n.code,error_category:o,command_resolution:i,resolution_stage:"execute"})}catch(r){e.bootstrapGlobal.json||w(`Failed to run error hooks: ${re(r)}`)}try{await Me()}catch(r){e.bootstrapGlobal.json||w(`Failed to flush error reporting: ${re(r)}`)}}var Dc={create:"create",update:"update","update-many":"update_many",list:"list","list-all":"list","list-draft":"list","list-open":"list","list-in-progress":"list","list-blocked":"list","list-closed":"list","list-canceled":"list",search:"search",calendar:"calendar",context:"context","templates save":"create"},bo=new Map;function Co(e){return e==="number"?"number":e==="boolean"?"boolean":"string"}function ma(e,t){return e.options.some(n=>n.long===t)}function pa(e,t){return e.options.some(n=>n.short===t)}function xo(e,t,n,o){let i=t.trim();if(!i)return;let r=n.length>0?n:`Runtime schema field (${t})`;if(i.startsWith("-")&&!i.startsWith("--")){if(pa(e,i))return;if(o){e.option(`${i} <value>`,`${r} (repeatable)`,mn);return}e.option(`${i} <value>`,r);return}let a=i.startsWith("--")?i:`--${i}`;if(!ma(e,a)){if(o){e.option(`${a} <value>`,`${r} (repeatable)`,mn);return}e.option(`${a} <value>`,r)}}async function ua(e,t){let n=Dc[e];if(!n)return[];let o=`${t}:${n}`,i=bo.get(o);if(i)return i;if(!await W(V(t)))return bo.set(o,[]),[];let r=await D(t),s=(rn(r.schema).command_to_fields.get(n)??[]).flatMap(l=>[l.cli_flag,...l.cli_aliases].map(c=>({long:`--${c}`,type:Co(l.type),value_type:Co(l.type)})));return bo.set(o,s),s}async function fa(e,t){let n=z(t),o=$(process.cwd(),n.path);if(!await W(V(o)))return;let i=ue?.key===Ro(o)?ue.snapshot:null,r=i===null?await D(o):i.settings,a=rn(r.schema),s=[{path:"create",command:"create"},{path:"update",command:"update"},{path:"update-many",command:"update_many"},{path:"list",command:"list"},{path:"list-all",command:"list"},{path:"list-draft",command:"list"},{path:"list-open",command:"list"},{path:"list-in-progress",command:"list"},{path:"list-blocked",command:"list"},{path:"list-closed",command:"list"},{path:"list-canceled",command:"list"},{path:"search",command:"search"},{path:"calendar",command:"calendar"},{path:"context",command:"context"},{path:"templates save",command:"create"}];for(let l of s){let d=Q(e,l.path.split(" "));if(d)for(let c of a.command_to_fields.get(l.command)??[]){let m=c.description??"";xo(d,c.cli_flag,m,c.repeatable);for(let p of c.cli_aliases)xo(d,p,`Alias for --${c.cli_flag}`,c.repeatable)}}}async function To(e,t,n,o,i){let r=k(n);if(!(r!=="create"&&r!=="update"))try{let a=i??await D(t),s=te(a,o);Wr(e,s,n)}catch{}}function ko(){return{enforce_item_format_gate:!0,run_preflight_item_format_sync:!0,run_extension_migrations:!0,enforce_mandatory_migration_gate:!0}}function ga(e,t="all"){return t==="all"?`pm-root:${e}`:`pm-root:${e}:activation:${t}`}function Oo(e){return e.some(t=>t==="--profile")}function Ro(e){return`pm-root:${e}`}function Eo(e){for(let t of e)t.startsWith("settings_read_")&&w(`[pm] warning: ${t} \u2014 settings.json could not be loaded and pm fell back to defaults; run pm health for remediation.`)}function ha(e,t){e.profile&&(w(`profile:extensions loaded=${t.loadedCount} failed=${t.loadFailedCount} warnings=${t.loadWarnings.length} activation_failed=${t.activationFailedCount} hook_counts=before:${t.hooks.beforeCommand.length}|after:${t.hooks.afterCommand.length}|write:${t.hooks.onWrite.length}|read:${t.hooks.onRead.length}|index:${t.hooks.onIndex.length} command_overrides=${t.commands.overrides.length} command_handlers=${t.commands.handlers.length} parser_overrides=${t.parsers.overrides.length} preflight_overrides=${t.preflight.overrides.length} service_overrides=${t.services.overrides.length} renderer_overrides=${t.renderers.overrides.length}`),t.activationWarnings.length>0&&w(`profile:extensions activation_warnings=${L(t.activationWarnings)}`))}function Ht(e,t,n){if(!e)return;let o=_(n.commandPath??"")||"<none>";w(`profile:extensions activation=skipped command=${o} effective=${t.discovery.effective.length} warnings=${t.discovery.warnings.length} discovery_ms=${t.discoveryMs}`)}async function zt(e,t=_e){let n=Ro(e);if(ue?.key===n)return ue.snapshot;try{let o=Date.now(),{settings:i,warnings:r}=await t(e),a=await Go({pmRoot:e,settings:i,cwd:process.cwd(),noExtensions:!1}),s={pmRoot:e,settings:i,discovery:a,discoveryMs:Date.now()-o,settingsReadWarnings:[...r]};return ue={key:n,snapshot:s},s}catch{return ue={key:n,snapshot:null},null}}async function Oe(e,t,n=D){let o=t?Ye(t):"all",i=ga(e,o);if(Ze?.key===i)return Ze.snapshot;try{let r=await n(e),a=await Pe({pmRoot:e,settings:r,cwd:process.cwd(),noExtensions:!1,extensionFilter:t?Qn(t):void 0}),s=await $e({...a,loaded:a.loaded}),l=[...new Set(s.commands.handlers.map(u=>_(u.command)))].filter(u=>u.length>0).sort((u,g)=>u.localeCompare(g)),d=_r(s.registrations.flags),c=wr(s.commands.handlers,s.registrations.commands),m=Cr(l,s.registrations.commands,s.registrations.flags,c),p={hooks:s.hooks,commands:s.commands,parsers:s.parsers,preflight:s.preflight,services:s.services,renderers:s.renderers,registrations:s.registrations,pmRoot:e,settings:r,commandHandlers:l,commandFlagHelp:d,commandDescriptors:m,commandAliases:c,loadWarnings:[...a.warnings],activationWarnings:[...s.warnings],loadedCount:a.loaded.length,loadFailedCount:a.failed.length,activationFailedCount:s.failed.length,contextIntentPackages:a.loaded.map(({name:u,module:g})=>({name:u,module:g}))};return Ze={key:i,snapshot:p},p}catch{return Ze={key:i,snapshot:null},null}}async function ya(e){let t=je(e);if(t.noExtensions){let a=$(process.cwd(),t.path);return await W(V(a))&&Eo((await _e(a)).warnings),null}let n=$(process.cwd(),t.path),o=await zt(n);if(!o)return null;Eo(o.settingsReadWarnings);let i={commandPath:A(e),commandArgs:Zn(e)};if(!Je(o.discovery,i))return Ht(t.profile,o,i),null;let r=await Oe(n,i);return r?(ha(t,r),{hooks:r.hooks,commands:r.commands,parsers:r.parsers,preflight:r.preflight,services:r.services,renderers:r.renderers,registrations:r.registrations,pmRoot:n}):null}async function wa(e){let t=await Oe(e);return t?new Map(t.commandDescriptors):I}async function va(e,t){return(await wi({pmRoot:t,migrations:e,author:"pm-extension-migration"})).migrations.filter(o=>o.outcome==="failed").map(o=>`extension_migration_failed:${o.layer}:${o.extension}:${o.id}`)}function _a(e,t){let n=typeof t.author=="string"&&t.author.trim()?t.author.trim():"pm-extension";return yi(e,Li.forActiveExtensionHost({pmRoot:e,author:n}))}async function ba(e,t,n,o=[]){let i=A(e),r=Un(e.args.map(String),o),a={...t},s={...n},l=$(process.cwd(),n.path),d=await st({command:i,args:r,options:a,global:s,pm_root:l});n.profile&&d.warnings.length>0&&w(`profile:extensions parser_warnings=${L(d.warnings)}`),r=d.context.args,a=d.context.options,s=d.context.global,ro(I.get(_(i)),r,a,o),we(void 0),rt({command:i,args:r,options:{...a},global:{...s},pm_root:l});let c=await Yt({command:i,args:r,options:a,global:s,pm_root:l,sdk:_a(l,s)});if(s.profile&&c.warnings.length>0&&w(`profile:extensions command_handler_warnings=${L(c.warnings)}`),!c.handled){if(c.warnings.length>0){let m=c.warnings[0],p=c.errorMessage?.trim(),u=p?` ${p}`:"";throw new C(`Command "${i}" failed in extension handler (${m}).${u}`,f.GENERIC_FAILURE,{code:c.errorCode??"command_failed",nextSteps:c.remediation?[c.remediation]:void 0})}throw new C(`Command "${i}" is provided by extensions and is not currently available.`,f.NOT_FOUND)}return c.exitCode!==void 0&&(process.exitCode=c.exitCode),we(c.result),c.result}var ta=Symbol("pm.wrappedActionHandler");function Nc(e,t){let n=e[e.length-1];return n instanceof So?n:t}function na(e,t,n){e&&n.length>0&&w(`profile:extensions ${t}=${L(n)}`)}function Mc(e){let t=I.get(_(e.commandPath));if(!t||!oo(e.activeRegistrations,e.commandPath))return;let n=Mt(t).length===0?jr(e.commandArgs):Un(e.commandArgs,e.extensionFlagDefinitions);io(t,n)}function Fc(e,t,n){e.args=[...n],"_processArguments"in e&&typeof e._processArguments=="function"&&e._processArguments(),t.length>0&&Array.isArray(t[0])&&(t[0]=[...e.processedArgs])}function Ca(e){let t=n=>{let o=n;if(typeof o._actionHandler=="function"&&o[ta]!==!0){let i=o._actionHandler;o._actionHandler=async function(...a){let s=Nc(a,n),l=Date.now();dn(s);let d=je(s),c=T(A(s)),m=$(process.cwd(),d.path),p=s.args.map(String),u=ne(),g=u?Xe(u,c,p):[],h=await ua(c,m),y=Ae(s,p,[...g,...h]),x=await st({command:c,args:p,options:y,global:d,pm_root:m});na(d.profile,"parser_warnings",x.warnings),p=x.context.args,y=x.context.options,d=x.context.global,Mc({activeRegistrations:u,commandPath:c,commandArgs:p,extensionFlagDefinitions:g}),d=await Ni(d),yt(s,d),Fc(s,a,p),ht(s,y),we(void 0),rt({command:c,args:p,options:{...y},global:{...d},pm_root:m});let P=await Yt({command:c,args:p,options:y,global:d,pm_root:m,sdk:_a(m,d)});if(na(d.profile,"command_handler_warnings",P.warnings),P.handled){we(P.result),Qt(P.result,{...d,command:c,commandArgs:p,commandOptions:y,pmRoot:m}),d.profile&&w(`profile:command=${c} took_ms=${Date.now()-l}`);return}return await i.apply(this,a)},o[ta]=!0}for(let i of n.commands)t(i)};t(e)}async function jt(e){I=new Map,Z({overrides:[]}),e&&await To(e.rootProgram,e.pmRoot,e.invocationArgv,jo(),e.settings)}function Lc(e,t,n,o){if(t?.flags&&t.flags.length>0){Dn(e,t.flags);let i=Nn(e,t.flags);i&&e.addHelpText("after",i)}else n&&e.addHelpText("after",n);o&&e.addHelpText("after",o)}function xa(e,t,n){let o={core:0,standard:1,full:2,internal:3},i=(r,a)=>{let s=a.join(" "),l=[...n.entries()].filter(([c])=>c===s||c.startsWith(`${s} `)).map(([,c])=>c),d=l.length===0?"standard":l.reduce((c,m)=>o[m.tier]<o[c]?m.tier:c,"internal");_t(r,d);for(let c of r.commands)i(c,[...a,c.name()])};for(let r of e.commands)t.has(r.name())||i(r,[r.name()])}async function ka(e,t){let n=z(t),o=$(process.cwd(),n.path);if(n.noExtensions){await jt({rootProgram:e,pmRoot:o,invocationArgv:t});return}let i=await zt(o),r=Se(t);if(!i){await jt();return}if(!Je(i.discovery,r)){await jt({rootProgram:e,pmRoot:o,invocationArgv:t,settings:i.settings}),Ht(Oo(t),i,r);return}let a=await Oe(o,r);if(!a){await jt({rootProgram:e,pmRoot:o,invocationArgv:t,settings:i.settings});return}Z(a.services),I=new Map(a.commandDescriptors),await To(e,o,t,a.registrations,a.settings);let s=Ir(e,a.commandHandlers,a.commandDescriptors,a.commandAliases,c=>Pr(a.activationWarnings,w,c)),l=new Set(e.commands.map(c=>c.name())),d=c=>{let m=c.split(" ").filter(P=>P.length>0),p=a.commandDescriptors.get(c),u=Q(e,m),g=a.commandFlagHelp.get(c),h=p?Or(p):null;if(u){Lc(u,p,g,h);return}let y=Rr(e,m);p?.description&&y.description(p.description);let x=g;p&&(xr(y,p),p.flags.length>0&&(Dn(y,p.flags),x=Nn(y,p.flags)??void 0)),x&&y.addHelpText("after",x),h&&y.addHelpText("after",h),y.allowUnknownOption(!0).allowExcessArguments(!0).action(async(...P)=>{let H=P[P.length-1],F=H instanceof So?H:y,fe=je(F),Gt=Date.now(),nt=Xe(a.registrations,c,F.args.map(String)),Re=Ae(F,F.args.map(String),nt),ge=await ba(F,Re,fe,nt);await Mi(fe,ge),Qt(ge,{...fe,command:c,commandArgs:F.args.map(String),commandOptions:Re,pmRoot:o}),fe.profile&&w(`profile:command=${c} took_ms=${Date.now()-Gt}`)})};for(let c of s)d(c);xa(e,l,a.commandDescriptors)}var et=No(import.meta.url,["../.."])??"0.0.0",v=Zt(et);function Ea(e){e.hook("preAction",async(t,n)=>{Te=null,q=null,at(),dn(n);let o=n.optsWithGlobals(),i=je(n),r=T(A(n)),a=n.args.map(String),s=Ae(n,a),l={...i};ri(r,{...s,outputInclude:o.outputInclude,outputLimit:o.outputLimit,outputBudget:o.outputBudget,outputFormat:o.outputFormat,outputSession:o.outputSession,outputCursor:o.outputCursor}),no(n,r,l,s),await Si(r,l);let d=$(process.cwd(),i.path),c=await ya(n);if(!c){Te=Wo({commandName:r,commandArgs:a,commandOptions:s,globalOptions:l,pmRoot:d}),q=await cn({command:r,pm_version:et,args:a,options:s,global:l,pm_root:d}),an(r,a,s,{source_context:q?.source_context,source_context_source:q?.source_context_source}),sn(r),await Gn(r,s,d,ko()),await zn(r,a,s,l,d);return}Vo(c.hooks),Bo(c.commands),Ko(c.parsers),Jo(c.preflight),Z(c.services),Yo(c.renderers),Xo(c.registrations);let m=Xe(c.registrations,r,a);s=Ae(n,a,m),no(n,r,l,s);let p=await st({command:r,args:a,options:s,global:l,pm_root:c.pmRoot});l.profile&&p.warnings.length>0&&w(`profile:extensions parser_warnings=${L(p.warnings)}`),a=p.context.args,s=p.context.options,l=p.context.global,ht(n,s);let u=await ei({command:r,args:a,options:s,global:l,pm_root:c.pmRoot,decision:ko()});l.profile&&u.warnings.length>0&&w(`profile:extensions preflight_warnings=${L(u.warnings)}`),a=u.context.args,s=u.context.options,l=u.context.global,ht(n,s);let g=u.decision;await Gn(r,s,c.pmRoot,g),await zn(r,a,s,l,c.pmRoot);let h=g.run_extension_migrations?await va(c.registrations.migrations,c.pmRoot):[];l.profile&&h.length>0&&w(`profile:extensions migration_warnings=${L(h)}`);let y=Kr(c.registrations.migrations);Te={hooks:c.hooks,commandName:r,commandArgs:a,commandOptions:{...s},globalOptions:{...l},pmRoot:c.pmRoot,profileEnabled:!!l.profile,migrationBlockers:y},we(void 0),rt({command:r,args:a,options:{...s},global:{...l},pm_root:c.pmRoot}),q=await cn({command:r,pm_version:et,args:a,options:s,global:l,pm_root:c.pmRoot}),an(r,a,s,{source_context:q?.source_context,source_context_source:q?.source_context_source}),sn(r);let x=await Ho(c.hooks,{command:r,args:a,options:{...s},global:{...l},pm_root:c.pmRoot});l.profile&&x.length>0&&w(`profile:extensions hook_warnings=${L(x)}`),g.enforce_mandatory_migration_gate&&Jr(r,s,y)}),e.hook("postAction",async()=>{let t=vo();Ne(t.ok,t.error,{error_code:t.error_code,error_category:t.error_category,exit_code:t.exit_code,command_resolution:t.command_resolution,resolution_stage:t.resolution_stage}),await tt(t)})}Ea(v);var oa=Symbol("pmCliIdempotentTopLevelRegistration");function Sa(e){let t=e;if(t[oa])return;t[oa]=!0;let n=e.command.bind(e);e.command=((o,...i)=>{let r=o.split(/\s+/u)[0];return e.commands.some(a=>a.name()===r||a.aliases().includes(r))?new So(r):n(o,...i)})}async function jc(e,t){if(Sa(e),t.setup){let{registerSetupCommands:n}=await Sc();n(e)}if(t.listQuery){let{registerListQueryCommands:n}=await Ac(),o=typeof t.targetCommandName=="string"&&ao.has(t.targetCommandName)?new Set([t.targetCommandName]):void 0;n(e,o?{commandFilter:o}:void 0)}if(t.mutation){let{registerMutationCommands:n}=await Tc();n(e,{targetCommandName:t.targetCommandName})}if(t.operation){let{registerOperationCommands:n}=await Oc();n(e)}}function Uc(e){return async t=>{let n=ot(t.errorCode),o=mt({ok:!1,errorCode:t.errorCode,errorCategory:n});return await Ti({command:t.command,args:e.invocationArgv,options:t.options,global:e.bootstrapGlobal,pm_version:et,pm_root:e.bootstrapPmRoot,error_code:t.errorCode,error_message:t.errorMessage,exit_code:t.exitCode,error_category:n,command_resolution:o,resolution_stage:t.resolutionStage}),{errorCategory:n,commandResolution:o}}}async function Aa(e){if(e.bootstrapGlobal.noExtensions)return;let t=Se(e.invocationArgv),n=await zt(e.bootstrapPmRoot);if(n&&Je(n.discovery,t)){let o=await Oe(e.bootstrapPmRoot,t);Ta(o);return}n&&Ht(Oo(e.invocationArgv),n,t),Z({overrides:[]})}function Ta(e){if(!e){Z({overrides:[]});return}Z(e.services)}async function Io(e){Ne(!1,e.errorMessage,{error_code:e.classificationCode,error_category:e.errorCategory,exit_code:e.exitCode,command_resolution:e.commandResolution,resolution_stage:e.resolutionStage}),await tt({ok:!1,error:e.errorMessage,exit_code:e.exitCode,error_code:e.classificationCode,error_category:e.errorCategory,command_resolution:e.commandResolution,resolution_stage:e.resolutionStage})}async function Oa(){Ne(!0,void 0,{exit_code:f.SUCCESS,command_resolution:"success",resolution_stage:"parse"}),await tt({ok:!0,exit_code:f.SUCCESS,command_resolution:"success",resolution_stage:"parse"}),process.exitCode=f.SUCCESS}async function Ra(e,t){let n=typeof t=="number"&&Number.isFinite(t);if(!(e.error instanceof C)&&(nn(e.error)||!n))return!1;let o=re(e.error),i=e.error instanceof C?e.error.exitCode:tn(t),r=e.error instanceof C?e.error.context:void 0,a=aa(r,e.invocationArgv,o),s=sr(o,a),l=e.bootstrapGlobal.lean?xt(En(o,i,a)):En(o,i,a),d=e.jsonErrors?JSON.stringify(e.bootstrapGlobal.tokenAccounting?ie(l,u=>`${JSON.stringify(u,null,2)}
|
|
33
|
+
`)}function Wr(e,t,n){let o=k(n);if(o!=="create"&&o!=="update")return;let i=We(e,o);i&&i.addHelpText("after",Kl(o,t,n))}(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]="840b471e-c996-57e2-b97c-3a84bd68f050")}catch{}})();function Jl(e,t){let n=Ie(e.id);return n||`migration-${String(t+1).padStart(3,"0")}`}function Yl(e){return Ie(e.status)?.toLowerCase()??"pending"}function Xl(e){return e.mandatory===!0}function Ql(e,t){let n=e.layer.localeCompare(t.layer);if(n!==0)return n;let o=e.name.localeCompare(t.name);return o!==0?o:e.id.localeCompare(t.id)}function Kr(e){let t=[];return e.forEach((n,o)=>{if(!Xl(n.definition))return;let i=Yl(n.definition);i!=="applied"&&t.push({layer:n.layer,name:n.name,id:Jl(n.definition,o),status:i})}),t.sort(Ql),t}function Vr(e){return Array.isArray(e)&&e.length>0}var Zl=new Set(["create","beads import","todos import"]),ec=new Set(["restore","update","close","delete","append","claim","release"]),tc=new Set(["comments","notes","learnings"]),nc=new Set(["files","docs","test"]),oc=new Set(["activate","add","add-field","add-status","add-type","apply","compact","create","deactivate","delete","disable","edit","enable","import","infer","install","materialize","migrate","redact","remove","remove-field","remove-status","remove-type","remap-status","rename-field","rename-type","repair","run","save","set","unset","update","upgrade"]);function Hn(e,t){let n=t.force===!0;return Zl.has(e)?{isMutation:!0,forceCapable:!1,forceRequested:!1}:ec.has(e)?{isMutation:!0,forceCapable:!0,forceRequested:n}:tc.has(e)?{isMutation:typeof t.add=="string",forceCapable:!0,forceRequested:n}:nc.has(e)?{isMutation:Vr(t.add)||Vr(t.remove),forceCapable:!0,forceRequested:n}:{isMutation:!1,forceCapable:!1,forceRequested:!1}}function ic(e,t,n){if(Hn(e,n).isMutation)return!0;let o=e.trim().toLowerCase();return ki(o)?["close-many","close-task","copy","delete","discover","focus","pause-task","start-task","update-many"].includes(o)?!0:t.some(i=>oc.has(i.trim().toLowerCase())):!1}function Br(e){return(e??"in_progress").trim().toLowerCase().replaceAll("-","_")}function rc(e,t,n){let o=t[0]?.trim().toLowerCase()??"";if(e.trim().toLowerCase()!=="schema"||!["rename-type","rename-field","remap-status"].includes(o))return;let i=[];if(Ie(t[1])||i.push("source"),Ie(n.to)||i.push("--to"),i.length!==0)throw new C(`Schema migration requires ${i.join(", ")}.`,f.USAGE,{code:"schema_migration_input_required",required:i.join(","),why:"Schema migrations require a source and target. A workspace-bound stable migration id is derived automatically when --migration-id is omitted.",recovery:{recovery_mode:"compact",missing_required_fields:i,suggested_flags:i.filter(r=>r.startsWith("--")),suggested_retry:`pm schema ${o} <source> --to <target>`}})}async function ac(e,t,n,o,i){if(e.trim().toLowerCase()!=="update"||typeof n.status!="string"||Br(n.status)!==Br(i.schema.workflow.in_progress_status))return;let r=t[0];if(!r)return;let a=te(i,ne()),s=await dt(o,r,i.id_prefix,i.item_format,a.type_to_folder);if(!s)return;let l=await hi(s,{schema:i.schema}),d=typeof n.assignee=="string"?n.assignee.trim():void 0;(d===void 0?l.document.metadata.assignee?.trim():!["","none","null","undefined"].includes(d.toLowerCase())&&d)||w(`warning:in_progress_item_unclaimed:${s.id}:claim_with=pm claim ${s.id}`)}async function zn(e,t,n,o,i){if(!ic(e,t,n)||(rc(e,t,n),!await W(V(i))))return;let r=await _e(i);o.json!==!0&&await ac(e,t,n,i,r.settings);let a=xi({author:ct(o.author,r.settings.author_default),payload:{command:e,args:t,options:n},settings:r.settings.mutation_guard,force:o.force===!0||n.force===!0});for(let s of a.warnings)w(`warning:${s}`)}function Jr(e,t,n){if(n.length===0)return;let o=Hn(e,t);if(!o.isMutation||o.forceCapable&&o.forceRequested)return;let i=n.map(a=>`extension_migration_blocking:${a.layer}:${a.name}:${a.id}:${a.status}`),r=o.forceCapable?"Re-run this command with --force to bypass.":"This command path does not support --force bypass.";throw new C(`Write command "${e}" blocked by unresolved mandatory extension migrations (${i.join(",")}). ${r}`,f.CONFLICT)}async function Gn(e,t,n,o){if(!Hn(e,t).isMutation||!o.enforce_item_format_gate&&!o.run_preflight_item_format_sync||!await W(V(n)))return;let{settings:r,metadata:a,warnings:s}=await _e(n);for(let l of s)w(`warning:${l}`);if(o.enforce_item_format_gate&&!a.has_explicit_item_format&&(fi(r),await gi(n,r,"item_format:auto_select_default")),o.run_preflight_item_format_sync){let l=te(r,ne());await Ei(n,r.item_format,"item_format:pre_mutation_sync",l.type_to_folder,r.schema)}}(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]="697f96fe-38a0-5530-b54b-22cb442c130f")}catch{}})();function Wn(e){let t=[];for(let n of e??[]){if(n.startsWith("-"))break;let o=_(n);o.length!==0&&t.push(o)}return t}function Ee(e){let t=_(e.commandPath??"");if(t.length===0)return[];let n=[t],o=t.split(" ").filter(i=>i.length>0);for(let i of Wn(e.commandArgs))o.push(...i.split(" ").filter(r=>r.length>0)),n.push(o.join(" "));return[...new Set(n.flatMap(i=>[i,T(i)]))]}function Vn(e,t){let n=_(e);if(n.length===0)return!1;let o=Ee(t);for(let i of o)if(i===n||i.startsWith(`${n} `))return!0;return t.allowCommandPrefixMatch===!0?o.some(i=>n.startsWith(`${i} `)):!1}function It(e){let t=e.activation?.commands;if(t)return t;let n=e.contributions;return n?[...O(n.commands),...O(n.command_handlers),...O(n.command_overrides),...O(n.flag_commands),...O(n.parser_overrides),...Yr(n.preflight_ownership),...Yr(n.renderer_ownership)]:[]}function O(e){return e??[]}function Yr(e){return O(e).flatMap(t=>t.commands)}function Ke(e){return new Set((e.capabilities??[]).map(t=>t.trim().toLowerCase()))}var Xr=new Set(["hooks","parser","preflight","renderers"]),Qr=new Set(["commands","schema","services","importers"]),sc=new Set(["reindex","search","search-advanced"]),lc=new Set(["--template"]);function ke(e,t){for(let n of t)if(e.has(n))return!0;return!1}function Bn(e){let t=_(e??"");if(t.length===0)return!1;let[n]=t.split(" ");return sc.has(n??t)}function Kn(e,t){for(let n of e.commandArgs??[]){if(!n.startsWith("--"))continue;let[o]=n.split("=",1);if(t.has(o))return!0}return!1}function Pt(e){return _(e.commandPath??"")==="create"&&Kn(e,lc)}function Jn(e){return e.some(t=>{let n=_(t);return n==="templates"||n.startsWith("templates ")})}function Rt(e,t){return e.some(n=>Vn(n,t))||Pt(t)&&Jn(e)}function Yn(e){return[O(e.hooks).length,(e.preflight_overrides??0)-O(e.preflight_ownership).length,O(e.item_types).length,O(e.item_fields).length,O(e.relationship_kinds).length,O(e.service_overrides).length,O(e.assurance_providers).length,O(e.renderer_overrides).length-O(e.renderer_ownership).length].some(n=>n>0)}function Xn(e,t){let n=e.activation?.commands??[];if(n.length>0)return Rt(n,t);let o=It(e);if(Rt(o,t)||Ke(e).has("search")&&Bn(t.commandPath))return!0;if(e.contributions)return Yn(e.contributions)}function $t(e,t){let n=Xn(e,t);if(n!==void 0)return n;let o=Ke(e);return!!(ke(o,Xr)||ke(o,Qr))}function Je(e,t){return e.effective.length===0?!1:Ye(t)!=="all"?e.effective.some(o=>$t(o,t)):e.effective.some(o=>{let i=Ke(o);return It(o).length>0||ke(i,Xr)||ke(i,Qr)||i.has("search")})}function Ye(e){if(_(e.commandPath??"").split(" ")[0]==="completion")return"all";let t=Ee(e).filter(i=>i.split(" ").every(r=>!r.startsWith("-"))).sort((i,r)=>r.length-i.length)[0]??_(e.commandPath??"");if(t.length===0)return"all";let n=Pt(e)?"--template":"";return`${e.allowCommandPrefixMatch===!0?"prefix":"exact"}:${t}:${n}`}function Qn(e){return Ye(e)==="all"?void 0:t=>$t(t,e)}function Se(e){let t=E(e);if(t.requested&&t.commandPathTokens.length>0){let[i,...r]=t.commandPathTokens;return{commandPath:i,commandArgs:r,allowCommandPrefixMatch:!0}}let n=G(e),o=n.findIndex(i=>i.trim().length>0&&!i.startsWith("-"));return o<0?{}:{commandPath:n[o],commandArgs:n.slice(o+1),allowCommandPrefixMatch:t.requested}}function Zn(e){let t=e.args.map(String);if(_(A(e))==="create"){let o=e.optsWithGlobals();typeof o.template=="string"&&o.template.trim().length>0&&t.push("--template")}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]="4584c97a-4e3c-551e-95a4-2f63a7fc152e")}catch{}})();var Dt=Symbol.for("pm.readOutputInvocationProvenance");function eo(e,t){let n=Reflect.get(e,Dt);n!==void 0&&Reflect.set(t,Dt,n)}function to(e,t,n){let o=ii(t,n);if(!o)return;let i=e;for(;i.parent;)i=i.parent;let r=i.rawArgs,a=new Set(K(r.slice(2))),s=oi.find(c=>c.command===o),l=Object.values(s.dimensions).flatMap(c=>c.legacy_aliases.flatMap(m=>a.has(m.flag)?[m.flag]:[])),d=Reflect.get(n,Dt);Reflect.set(n,Dt,{canonical_include_modes:d?.canonical_include_modes??[],explicit_legacy_aliases:l,cli_invocation_observed:!0}),eo(n,e)}function no(e,t,n,o){to(e,t,o);let i=n.outputInclude;if(i===void 0)return;let{selectors:r,modes:a}=si(t,i,o);if(t==="get"&&typeof o.fields=="string"&&e.setOptionValueWithSource("fields",o.fields,"cli"),a.length===0)return;eo(o,e);let s=ai(t);for(let d of a){let c=s.get(d),m=o[c];e.setOptionValueWithSource(c,m,"cli")}let l=r.length>0?r.join(","):void 0;l===void 0?delete n.outputInclude:n.outputInclude=l;for(let d=e;d;d=d.parent)d.setOptionValueWithSource("outputInclude",l,"cli");yt(e,n)}function cc(e){let t=e.optsWithGlobals(),n=A(e);if(T(n)===n)return t;let o=e.opts();for(let i=e.parent;i?.parent;i=i.parent)for(let r of Object.keys(i.opts()))!(r in o)&&i.getOptionValueSource(r)==="default"&&delete t[r];return t}function Ae(e,t,n=[]){let i={...cc(e)};eo(e,i),delete i.json,delete i.quiet,delete i.path,delete i.pmPath,delete i.noExtensions,delete i.extensions,delete i.profile,delete i.pager,delete i.changedFields,delete i.fullChangedFields,delete i.idOnly,delete i.lean,delete i.tokenAccounting,delete i.outputInclude,delete i.outputLimit,delete i.outputBudget,delete i.outputFormat,delete i.outputSession;let r=Lr(t);for(let[a,s]of Object.entries(r))i[a]===void 0&&(i[a]=s);if(n.length>0){let a=Nr(n),s=ft(A(e)).map(d=>({long:d.flag,short:d.short,aliases:d.aliases})),l={...r};for(let d of a)i[d]!==void 0&&(l[d]=i[d]);return jn(l,[...s,...n],A(e)),Fr(i,n,r)}return i}function Nt(e,t){let n=_(t);return n.length===0?[]:e.flags.filter(o=>T(_(o.target_command))===T(n)).flatMap(o=>o.flags)}function Xe(e,t,n){let o=Nt(e,t),i=[t],r=[];for(let a of n){if(a.startsWith("-"))break;i.push(a);let s=Nt(e,i.join(" "));s.length>0&&(r=s)}return r.length>0?r:o}function Mt(e){return e.arguments??[]}function Zr(e){let t=Mt(e).map(n=>{let o=n.variadic?`${n.name}...`:n.name;return n.required?`<${o}>`:`[${o}]`}).join(" ");return`pm ${e.command}${t?` ${t}`:""}`}function oo(e,t){if(!e)return!1;let n=_(t);return e.importers.some(o=>_(`${o.importer} import`)===n)||e.exporters.some(o=>_(`${o.exporter} export`)===n)}function io(e,t){let n=Mt(e),o=n.filter(l=>l.required).length,r=n.some(l=>l.variadic)?Number.POSITIVE_INFINITY:n.length,a=e.failure_hints??[],s=a.length>0?` ${a.join(" ")}`:"";if(t.length<o)throw new C(`Missing required argument for extension command '${e.command}'. Usage: ${Zr(e)}${s}`,f.USAGE);if(t.length>r){let l=t.slice(r).join(" ");throw new C(`Too many arguments for extension command '${e.command}': ${l}. Usage: ${Zr(e)}${s}`,f.USAGE)}}function dc(e){return`--${e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}`}function mc(e,t,n){if(n.length>0){jn(t,n,e.command);return}let o=Object.keys(t).filter(i=>t[i]!==void 0).sort();if(o.length!==0)throw new C(`Unknown option '${o.map(dc).join(", ")}' for extension command '${e.command}'. This command does not define extension flags.`,f.USAGE)}function ro(e,t,n,o){e&&(io(e,t),mc(e,n,o))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="4963b2d7-c720-51bb-a621-5f9d7e40b909")}catch{}})();var pc=new Set(["--version","-V"]),uc=new Set(["config","extension","init","install","package","packages","templates","upgrade"]),ao=new Set(["activity","aggregate","context","ctx","events","get","graph","history","list","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","search"]),ea=new Set(["append","close","close-many","comments","delete","deps","discover","docs","files","history-repair","history-redact","history-compact","learnings","notes","plan","restore","update","update-many","create"]),fc=new Set(["claim","close-task","contracts","duplicates","gc","health","pause-task","release","start-task","stats","test","test-all","test-runs","test-runs-worker","validate"]),gc=new Set(["claim","close-task","pause-task","release","start-task","test"]),Ft={setup:!0,listQuery:!0,mutation:!0,operation:!0},hc=new Set(["create","update","update-many","list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled","search","calendar","context","templates"]);function Qe(e){return e.some(t=>pc.has(t))}function so(e){if(Qe(e))return{setup:!1,listQuery:!1,mutation:!1,operation:!1};if(e.length===0||E(e).requested)return Ft;let t=k(e);if(!t)return Ft;let n=t.trim().toLowerCase(),o=G(e),i=he(o)?.alias;return M.some(r=>r.alias===i)?{...Ft,targetCommandName:i}:uc.has(n)?{setup:!0,listQuery:!1,mutation:!1,operation:!1,targetCommandName:n}:ao.has(n)?{setup:!1,listQuery:!0,mutation:!1,operation:!1,targetCommandName:n}:ea.has(n)?{setup:!1,listQuery:!1,mutation:!0,operation:!1,targetCommandName:n}:fc.has(n)?{setup:!1,listQuery:!1,mutation:!1,operation:!0,targetCommandName:n}:Ft}function lo(e){return e.length===0||E(e).requested||e.includes("--explain")&&k(e)===void 0}function co(e,t){return Qe(t)?!1:ce(t)||E(t).requested?!0:!!k(t)}function mo(e){if(Qe(e))return!1;let t=k(e);return t?hc.has(t):!1}function yc(e){let t=String(e.rawFrom??""),n=t.indexOf("="),o=n>=0?t.slice(0,n):t,i=e.normalizedTokens.map(d=>{let c=d.indexOf("=");return c>=0?d.slice(0,c):d}).find(d=>d==="--literal"||d==="--regex"||d==="--replacement"),r=i?e.argv.map(d=>{let c=d.indexOf("=");return(c>=0?d.slice(0,c):d)===o?c>=0?`${i}${d.slice(c)}`:i:d}):e.argv,a=De(r),s=i&&n>=0?`${o}=[redacted]`:t,l=i&&e.normalizedDisplay.includes("=")?`${i}=[redacted]`:e.normalizedDisplay;return{argv:a,normalizedDisplay:l,sourceDisplay:s}}function po(e){let t=e.commandName;if(!t)return;let n=e.trace.find(d=>d.reason==="flag_typo");if(!n)return;let o=Array.isArray(n.to)?n.to:[String(n.to??"")].filter(d=>d.length>0),i=o.length>0?o.join(" "):"the canonical flag",r=ea.has(t)||gc.has(t),a=r?"mutating_flag_typo_requires_retry":"flag_typo_requires_retry",s=r?"mutating option":"option",l=yc({argv:e.argv,normalizedDisplay:i,normalizedTokens:o,rawFrom:n.from});throw new C(`Refusing to auto-correct ${s} ${l.sourceDisplay} to ${l.normalizedDisplay}. Retry with the canonical flag so the command is explicit.`,f.USAGE,{code:a,examples:[S(l.argv)],nextSteps:["Retry the command with the canonical flag shown in examples."],recovery:{normalized_args:l.argv,suggested_retry:S(l.argv)}})}(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]="afcf2608-3360-5030-b5ea-b101df5829e7")}catch{}})();var wc=new Set(["success","nonexistent_command","invalid_option","missing_required_option","missing_required_argument","invalid_usage","validation_failed","health_findings","validation_findings","conflict","runtime_failed","unknown_failed"]),vc=new Set(["parse","preflight","execute","unknown"]),_c=new Set(["usage","validation","conflict","runtime","unknown"]);function pe(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="string"){let i=o.trim();if(i.length>0)return i}}}function uo(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="boolean")return o}}function Lt(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="number"&&Number.isFinite(o))return Math.max(0,Math.trunc(o))}}function fo(e){if(!e)return;let t=e.trim().toLowerCase();if(wc.has(t))return t}function go(e){if(!e)return;let t=e.trim().toLowerCase();if(vc.has(t))return t}function ho(e){if(!e)return;let t=e.trim().toLowerCase();if(_c.has(t))return t}function yo(e){let t=pe(e,"error","message");if(t)return t;let n=e?.warnings;if(Array.isArray(n)){let a=n.find(s=>typeof s=="string"&&s.trim().length>0);if(typeof a=="string")return a.trim()}if(uo(e,"fail_on_skipped_triggered","failOnSkippedTriggered"))return"linked_test_fail_on_skipped_triggered";let i=Lt(e,"failed");if(typeof i=="number"&&i>0)return`failed_runs:${i}`;let r=e?.run_results;if(Array.isArray(r)){let a=r.filter(s=>Vt(s)?.status==="failed").length;if(a>0)return`failed_runs:${a}`}}function wo(e,t){if(!e)return t===f.USAGE?"invalid_command_usage":t===f.NOT_FOUND?"item_not_found":t===f.CONFLICT?"lock_conflict":t===f.DEPENDENCY_FAILED?"dependency_failed":"command_failed"}function vo(){let e=Vt(oe()),t=typeof process.exitCode=="number"&&Number.isFinite(process.exitCode)?Math.max(0,Math.trunc(process.exitCode)):void 0,n=Lt(e,"exit_code","exitCode"),o=t??n??f.SUCCESS,i=$i(o),r=pe(e,"error_code","errorCode")??wo(i,o),a=ho(pe(e,"error_category","errorCategory"))??(i?void 0:ot(r)),s=i?void 0:yo(e)??`command_exit_${o}`,l=fo(pe(e,"command_resolution","commandResolution"))??mt({ok:i,errorCode:r,errorCategory:a}),d=go(pe(e,"resolution_stage","resolutionStage"))??"execute";return{ok:i,error:s,exit_code:o,error_code:r,error_category:a,command_resolution:l,resolution_stage: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]="55cf18ea-fea1-5b3e-b10f-46f67f7f482b")}catch{}})();var _o="PM_CLI_PACKAGE_ROOT";function bc(){return Do(import.meta.url,["../.."])}(typeof process.env[_o]!="string"||process.env[_o]?.trim().length===0)&&(process.env[_o]=bc());var Te=null,q=null;function Cc(e){Te=e}function xc(e){I=e}var Ze=null,ue=null,I=new Map,Ao=250,kc=new Set([f.USAGE,f.NOT_FOUND,f.CONFLICT]),Ec=new Set(["1","true","yes","on"]),Sc=Fe(()=>import("./chunks/register-setup-574SIVQZ.js")),Ac=Fe(()=>import("./chunks/register-list-query-426QTRET.js")),Tc=Fe(()=>import("./chunks/register-mutation-FLI3HHMP.js")),Oc=Fe(()=>import("./chunks/register-operations-TP7ZG4MK.js"));function Ut(e){return S(e)}function ra(e){let t=e.match(/--[a-zA-Z0-9][a-zA-Z0-9_-]*/g);if(!t||t.length===0)return;let n=[...new Set(t.map(o=>ae(o)??o))];return n.length>0?n:void 0}function Rc(e,t,n){if(n?.suggested_retry||e.includes("failed in extension handler (")||!/\b(?:missing|required|requires)\b/i.test(e))return;let o=K(t),i=new Set(o.map(c=>ae(c)??c)),r=ra(e),a=t.find(c=>v.commands.some(m=>m.name()===c)),s=a?v.commands.find(c=>c.name()===a):void 0,l=new Set([...v.options,...s?.options??[]].flatMap(c=>c.flags.split(/[ ,|]+/).map(m=>ae(m)).filter(m=>m!==void 0))),d=r?.filter(c=>{let m=ae(c)??c;return i.has(m)?!1:l.has(m)||$n(t,a,m,I)!==void 0});return d&&d.length>0?d:void 0}function Ic(e,t,n,o){if(o?.suggested_retry)return o.suggested_retry;let i=n?.[0],r=i?ae(i):void 0,a=e.find(p=>v.commands.some(u=>u.name()===p)),s=a?v.commands.find(p=>p.name()===a):void 0,l=r?s?.options.find(p=>p.flags.split(/[ ,|]+/).includes(r)):void 0,d=$n(e,a,r,I),c=r?l?.isBoolean()===!0||d===!1?[r]:[r,"<value>"]:[],m=r?Ut([...e,...c]):t;return m===t?void 0:m}function Pc(e){if(!e)return{};let t=["recovery_mode","missing_required_fields","suggested_flags","suggested_retry_args","allowed_values","candidate_commands","candidate_commands_total","candidate_commands_truncated","fallback_candidates","next_best_command"],n={};for(let o of t){let i=e[o];i!=null&&(n[o]=i)}return n}function $c(e){let t=e.existingRecovery;return{attempted_command:t?.attempted_command??e.attemptedCommand,normalized_args:t?.normalized_args??[...e.invocationArgv],provided_fields:t?.provided_fields??(e.providedFields.length>0?e.providedFields:void 0),missing:t?.missing??e.inferredMissing,...Pc(t),...e.suggestedRetry?{suggested_retry:e.suggestedRetry}:{}}}function aa(e,t,n){let o=De(t),i=G(o),r=Ue(i),[a,s]=r===void 0?[]:i.slice(r,r+2),l=o.includes("--explain"),d=e?.recovery,c=d&&(a==="history-redact"||a==="history"&&s==="redact")?{...d,...d.attempted_command?{attempted_command:Ut(o)}:{},...d.normalized_args?{normalized_args:[...o]}:{},...d.suggested_retry?{suggested_retry:Ut(o)}:{},...d.suggested_retry_args?{suggested_retry_args:[...o]}:{}}:d;if(c?.recovery_mode==="compact"&&!l)return{...e,recovery:c};let m=Ut(o),p=K(o),u=Rc(n,o,c),g=Ic(o,m,u,c),h=$c({invocationArgv:o,attemptedCommand:m,providedFields:p,inferredMissing:u,suggestedRetry:g,existingRecovery:c});return{...e,recovery:h}}async function tt(e){let t=q;q=null,await Gi(t,e);let n=Te;if(Te=null,!n){at();return}let o=[],i=Zo();try{await Wi({pmRoot:n.pmRoot,author:n.globalOptions.author,itemIds:e.ok?i?.map(r=>r.id)??[]:[],intent:n.commandName})}catch{o.push("context_usage_feedback_write_failed")}try{o.push(...await zo(n.hooks,{command:n.commandName,args:n.commandArgs,options:{...n.commandOptions},global:{...n.globalOptions},pm_root:n.pmRoot,ok:e.ok,error:e.error,result:oe(),affected:i}))}catch(r){o=[`afterCommand hooks failed: ${r instanceof Error?r.message:String(r)}`]}finally{at()}!n.globalOptions.json&&o.length>0&&w(`[pm] warning: afterCommand hook_warnings=${L(o)}`),n.profileEnabled&&o.length>0&&w(`profile:extensions hook_warnings=${L(o)}`)}async function sa(){await bi()}function la(e){return Ec.has((process.env[e]??"").trim().toLowerCase())}function ca(e){return la("PM_SENTRY_CAPTURE_EXPECTED_ERRORS")?!0:!kc.has(Math.trunc(e))}async function qt(e){return ca(e.exit_code)?(await sa(),Ci(e),!0):!1}async function da(e){let t=re(e.error),n=mr(t);e.bootstrapGlobal.json?w(JSON.stringify(cr(t,f.GENERIC_FAILURE),null,2)):w(t),process.exitCode=f.GENERIC_FAILURE;let o="runtime",i="runtime_failed";try{await sa(),ln(e.error);let r=await e.emitTelemetryCommandError({command:e.attemptedCommand,errorCode:n.code,errorMessage:n.detail,exitCode:f.GENERIC_FAILURE,options:{bootstrap_global_options:e.bootstrapGlobal},resolutionStage:"execute"});o=r.errorCategory,i=r.commandResolution,Ne(!1,t,{error_code:n.code,error_category:o,exit_code:f.GENERIC_FAILURE,command_resolution:i,resolution_stage:"execute"})}catch(r){e.bootstrapGlobal.json||w(`Failed to report error: ${re(r)}`)}try{await tt({ok:!1,error:t,exit_code:f.GENERIC_FAILURE,error_code:n.code,error_category:o,command_resolution:i,resolution_stage:"execute"})}catch(r){e.bootstrapGlobal.json||w(`Failed to run error hooks: ${re(r)}`)}try{await Me()}catch(r){e.bootstrapGlobal.json||w(`Failed to flush error reporting: ${re(r)}`)}}var Dc={create:"create",update:"update","update-many":"update_many",list:"list","list-all":"list","list-draft":"list","list-open":"list","list-in-progress":"list","list-blocked":"list","list-closed":"list","list-canceled":"list",search:"search",calendar:"calendar",context:"context","templates save":"create"},bo=new Map;function Co(e){return e==="number"?"number":e==="boolean"?"boolean":"string"}function ma(e,t){return e.options.some(n=>n.long===t)}function pa(e,t){return e.options.some(n=>n.short===t)}function xo(e,t,n,o){let i=t.trim();if(!i)return;let r=n.length>0?n:`Runtime schema field (${t})`;if(i.startsWith("-")&&!i.startsWith("--")){if(pa(e,i))return;if(o){e.option(`${i} <value>`,`${r} (repeatable)`,mn);return}e.option(`${i} <value>`,r);return}let a=i.startsWith("--")?i:`--${i}`;if(!ma(e,a)){if(o){e.option(`${a} <value>`,`${r} (repeatable)`,mn);return}e.option(`${a} <value>`,r)}}async function ua(e,t){let n=Dc[e];if(!n)return[];let o=`${t}:${n}`,i=bo.get(o);if(i)return i;if(!await W(V(t)))return bo.set(o,[]),[];let r=await D(t),s=(rn(r.schema).command_to_fields.get(n)??[]).flatMap(l=>[l.cli_flag,...l.cli_aliases].map(c=>({long:`--${c}`,type:Co(l.type),value_type:Co(l.type)})));return bo.set(o,s),s}async function fa(e,t){let n=z(t),o=$(process.cwd(),n.path);if(!await W(V(o)))return;let i=ue?.key===Ro(o)?ue.snapshot:null,r=i===null?await D(o):i.settings,a=rn(r.schema),s=[{path:"create",command:"create"},{path:"update",command:"update"},{path:"update-many",command:"update_many"},{path:"list",command:"list"},{path:"list-all",command:"list"},{path:"list-draft",command:"list"},{path:"list-open",command:"list"},{path:"list-in-progress",command:"list"},{path:"list-blocked",command:"list"},{path:"list-closed",command:"list"},{path:"list-canceled",command:"list"},{path:"search",command:"search"},{path:"calendar",command:"calendar"},{path:"context",command:"context"},{path:"templates save",command:"create"}];for(let l of s){let d=Q(e,l.path.split(" "));if(d)for(let c of a.command_to_fields.get(l.command)??[]){let m=c.description??"";xo(d,c.cli_flag,m,c.repeatable);for(let p of c.cli_aliases)xo(d,p,`Alias for --${c.cli_flag}`,c.repeatable)}}}async function To(e,t,n,o,i){let r=k(n);if(!(r!=="create"&&r!=="update"))try{let a=i??await D(t),s=te(a,o);Wr(e,s,n)}catch{}}function ko(){return{enforce_item_format_gate:!0,run_preflight_item_format_sync:!0,run_extension_migrations:!0,enforce_mandatory_migration_gate:!0}}function ga(e,t="all"){return t==="all"?`pm-root:${e}`:`pm-root:${e}:activation:${t}`}function Oo(e){return e.some(t=>t==="--profile")}function Ro(e){return`pm-root:${e}`}function Eo(e){for(let t of e)t.startsWith("settings_read_")&&w(`[pm] warning: ${t} \u2014 settings.json could not be loaded and pm fell back to defaults; run pm health for remediation.`)}function ha(e,t){e.profile&&(w(`profile:extensions loaded=${t.loadedCount} failed=${t.loadFailedCount} warnings=${t.loadWarnings.length} activation_failed=${t.activationFailedCount} hook_counts=before:${t.hooks.beforeCommand.length}|after:${t.hooks.afterCommand.length}|write:${t.hooks.onWrite.length}|read:${t.hooks.onRead.length}|index:${t.hooks.onIndex.length} command_overrides=${t.commands.overrides.length} command_handlers=${t.commands.handlers.length} parser_overrides=${t.parsers.overrides.length} preflight_overrides=${t.preflight.overrides.length} service_overrides=${t.services.overrides.length} renderer_overrides=${t.renderers.overrides.length}`),t.activationWarnings.length>0&&w(`profile:extensions activation_warnings=${L(t.activationWarnings)}`))}function Ht(e,t,n){if(!e)return;let o=_(n.commandPath??"")||"<none>";w(`profile:extensions activation=skipped command=${o} effective=${t.discovery.effective.length} warnings=${t.discovery.warnings.length} discovery_ms=${t.discoveryMs}`)}async function zt(e,t=_e){let n=Ro(e);if(ue?.key===n)return ue.snapshot;try{let o=Date.now(),{settings:i,warnings:r}=await t(e),a=await Go({pmRoot:e,settings:i,cwd:process.cwd(),noExtensions:!1}),s={pmRoot:e,settings:i,discovery:a,discoveryMs:Date.now()-o,settingsReadWarnings:[...r]};return ue={key:n,snapshot:s},s}catch{return ue={key:n,snapshot:null},null}}async function Oe(e,t,n=D){let o=t?Ye(t):"all",i=ga(e,o);if(Ze?.key===i)return Ze.snapshot;try{let r=await n(e),a=await Pe({pmRoot:e,settings:r,cwd:process.cwd(),noExtensions:!1,extensionFilter:t?Qn(t):void 0}),s=await $e({...a,loaded:a.loaded}),l=[...new Set(s.commands.handlers.map(u=>_(u.command)))].filter(u=>u.length>0).sort((u,g)=>u.localeCompare(g)),d=_r(s.registrations.flags),c=wr(s.commands.handlers,s.registrations.commands),m=Cr(l,s.registrations.commands,s.registrations.flags,c),p={hooks:s.hooks,commands:s.commands,parsers:s.parsers,preflight:s.preflight,services:s.services,renderers:s.renderers,registrations:s.registrations,pmRoot:e,settings:r,commandHandlers:l,commandFlagHelp:d,commandDescriptors:m,commandAliases:c,loadWarnings:[...a.warnings],activationWarnings:[...s.warnings],loadedCount:a.loaded.length,loadFailedCount:a.failed.length,activationFailedCount:s.failed.length,contextIntentPackages:a.loaded.map(({name:u,module:g})=>({name:u,module:g}))};return Ze={key:i,snapshot:p},p}catch{return Ze={key:i,snapshot:null},null}}async function ya(e){let t=je(e);if(t.noExtensions){let a=$(process.cwd(),t.path);return await W(V(a))&&Eo((await _e(a)).warnings),null}let n=$(process.cwd(),t.path),o=await zt(n);if(!o)return null;Eo(o.settingsReadWarnings);let i={commandPath:A(e),commandArgs:Zn(e)};if(!Je(o.discovery,i))return Ht(t.profile,o,i),null;let r=await Oe(n,i);return r?(ha(t,r),{hooks:r.hooks,commands:r.commands,parsers:r.parsers,preflight:r.preflight,services:r.services,renderers:r.renderers,registrations:r.registrations,pmRoot:n}):null}async function wa(e){let t=await Oe(e);return t?new Map(t.commandDescriptors):I}async function va(e,t){return(await wi({pmRoot:t,migrations:e,author:"pm-extension-migration"})).migrations.filter(o=>o.outcome==="failed").map(o=>`extension_migration_failed:${o.layer}:${o.extension}:${o.id}`)}function _a(e,t){let n=typeof t.author=="string"&&t.author.trim()?t.author.trim():"pm-extension";return yi(e,Li.forActiveExtensionHost({pmRoot:e,author:n}))}async function ba(e,t,n,o=[]){let i=A(e),r=Un(e.args.map(String),o),a={...t},s={...n},l=$(process.cwd(),n.path),d=await st({command:i,args:r,options:a,global:s,pm_root:l});n.profile&&d.warnings.length>0&&w(`profile:extensions parser_warnings=${L(d.warnings)}`),r=d.context.args,a=d.context.options,s=d.context.global,ro(I.get(_(i)),r,a,o),we(void 0),rt({command:i,args:r,options:{...a},global:{...s},pm_root:l});let c=await Yt({command:i,args:r,options:a,global:s,pm_root:l,sdk:_a(l,s)});if(s.profile&&c.warnings.length>0&&w(`profile:extensions command_handler_warnings=${L(c.warnings)}`),!c.handled){if(c.warnings.length>0){let m=c.warnings[0],p=c.errorMessage?.trim(),u=p?` ${p}`:"";throw new C(`Command "${i}" failed in extension handler (${m}).${u}`,f.GENERIC_FAILURE,{code:c.errorCode??"command_failed",nextSteps:c.remediation?[c.remediation]:void 0})}throw new C(`Command "${i}" is provided by extensions and is not currently available.`,f.NOT_FOUND)}return c.exitCode!==void 0&&(process.exitCode=c.exitCode),we(c.result),c.result}var ta=Symbol("pm.wrappedActionHandler");function Nc(e,t){let n=e[e.length-1];return n instanceof So?n:t}function na(e,t,n){e&&n.length>0&&w(`profile:extensions ${t}=${L(n)}`)}function Mc(e){let t=I.get(_(e.commandPath));if(!t||!oo(e.activeRegistrations,e.commandPath))return;let n=Mt(t).length===0?jr(e.commandArgs):Un(e.commandArgs,e.extensionFlagDefinitions);io(t,n)}function Fc(e,t,n){e.args=[...n],"_processArguments"in e&&typeof e._processArguments=="function"&&e._processArguments(),t.length>0&&Array.isArray(t[0])&&(t[0]=[...e.processedArgs])}function Ca(e){let t=n=>{let o=n;if(typeof o._actionHandler=="function"&&o[ta]!==!0){let i=o._actionHandler;o._actionHandler=async function(...a){let s=Nc(a,n),l=Date.now();dn(s);let d=je(s),c=T(A(s)),m=$(process.cwd(),d.path),p=s.args.map(String),u=ne(),g=u?Xe(u,c,p):[],h=await ua(c,m),y=Ae(s,p,[...g,...h]),x=await st({command:c,args:p,options:y,global:d,pm_root:m});na(d.profile,"parser_warnings",x.warnings),p=x.context.args,y=x.context.options,d=x.context.global,Mc({activeRegistrations:u,commandPath:c,commandArgs:p,extensionFlagDefinitions:g}),d=await Ni(d),yt(s,d),Fc(s,a,p),ht(s,y),we(void 0),rt({command:c,args:p,options:{...y},global:{...d},pm_root:m});let P=await Yt({command:c,args:p,options:y,global:d,pm_root:m,sdk:_a(m,d)});if(na(d.profile,"command_handler_warnings",P.warnings),P.handled){we(P.result),Qt(P.result,{...d,command:c,commandArgs:p,commandOptions:y,pmRoot:m}),d.profile&&w(`profile:command=${c} took_ms=${Date.now()-l}`);return}return await i.apply(this,a)},o[ta]=!0}for(let i of n.commands)t(i)};t(e)}async function jt(e){I=new Map,Z({overrides:[]}),e&&await To(e.rootProgram,e.pmRoot,e.invocationArgv,jo(),e.settings)}function Lc(e,t,n,o){if(t?.flags&&t.flags.length>0){Dn(e,t.flags);let i=Nn(e,t.flags);i&&e.addHelpText("after",i)}else n&&e.addHelpText("after",n);o&&e.addHelpText("after",o)}function xa(e,t,n){let o={core:0,standard:1,full:2,internal:3},i=(r,a)=>{let s=a.join(" "),l=[...n.entries()].filter(([c])=>c===s||c.startsWith(`${s} `)).map(([,c])=>c),d=l.length===0?"standard":l.reduce((c,m)=>o[m.tier]<o[c]?m.tier:c,"internal");_t(r,d);for(let c of r.commands)i(c,[...a,c.name()])};for(let r of e.commands)t.has(r.name())||i(r,[r.name()])}async function ka(e,t){let n=z(t),o=$(process.cwd(),n.path);if(n.noExtensions){await jt({rootProgram:e,pmRoot:o,invocationArgv:t});return}let i=await zt(o),r=Se(t);if(!i){await jt();return}if(!Je(i.discovery,r)){await jt({rootProgram:e,pmRoot:o,invocationArgv:t,settings:i.settings}),Ht(Oo(t),i,r);return}let a=await Oe(o,r);if(!a){await jt({rootProgram:e,pmRoot:o,invocationArgv:t,settings:i.settings});return}Z(a.services),I=new Map(a.commandDescriptors),await To(e,o,t,a.registrations,a.settings);let s=Ir(e,a.commandHandlers,a.commandDescriptors,a.commandAliases,c=>Pr(a.activationWarnings,w,c)),l=new Set(e.commands.map(c=>c.name())),d=c=>{let m=c.split(" ").filter(P=>P.length>0),p=a.commandDescriptors.get(c),u=Q(e,m),g=a.commandFlagHelp.get(c),h=p?Or(p):null;if(u){Lc(u,p,g,h);return}let y=Rr(e,m);p?.description&&y.description(p.description);let x=g;p&&(xr(y,p),p.flags.length>0&&(Dn(y,p.flags),x=Nn(y,p.flags)??void 0)),x&&y.addHelpText("after",x),h&&y.addHelpText("after",h),y.allowUnknownOption(!0).allowExcessArguments(!0).action(async(...P)=>{let H=P[P.length-1],F=H instanceof So?H:y,fe=je(F),Gt=Date.now(),nt=Xe(a.registrations,c,F.args.map(String)),Re=Ae(F,F.args.map(String),nt),ge=await ba(F,Re,fe,nt);await Mi(fe,ge),Qt(ge,{...fe,command:c,commandArgs:F.args.map(String),commandOptions:Re,pmRoot:o}),fe.profile&&w(`profile:command=${c} took_ms=${Date.now()-Gt}`)})};for(let c of s)d(c);xa(e,l,a.commandDescriptors)}var et=No(import.meta.url,["../.."])??"0.0.0",v=Zt(et);function Ea(e){e.hook("preAction",async(t,n)=>{Te=null,q=null,at(),dn(n);let o=n.optsWithGlobals(),i=je(n),r=T(A(n)),a=n.args.map(String),s=Ae(n,a),l={...i};ri(r,{...s,outputInclude:o.outputInclude,outputLimit:o.outputLimit,outputBudget:o.outputBudget,outputFormat:o.outputFormat,outputSession:o.outputSession,outputCursor:o.outputCursor}),no(n,r,l,s),await Si(r,l);let d=$(process.cwd(),i.path),c=await ya(n);if(!c){Te=Wo({commandName:r,commandArgs:a,commandOptions:s,globalOptions:l,pmRoot:d}),q=await cn({command:r,pm_version:et,args:a,options:s,global:l,pm_root:d}),an(r,a,s,{source_context:q?.source_context,source_context_source:q?.source_context_source}),sn(r),await Gn(r,s,d,ko()),await zn(r,a,s,l,d);return}Vo(c.hooks),Bo(c.commands),Ko(c.parsers),Jo(c.preflight),Z(c.services),Yo(c.renderers),Xo(c.registrations);let m=Xe(c.registrations,r,a);s=Ae(n,a,m),no(n,r,l,s);let p=await st({command:r,args:a,options:s,global:l,pm_root:c.pmRoot});l.profile&&p.warnings.length>0&&w(`profile:extensions parser_warnings=${L(p.warnings)}`),a=p.context.args,s=p.context.options,l=p.context.global,ht(n,s);let u=await ei({command:r,args:a,options:s,global:l,pm_root:c.pmRoot,decision:ko()});l.profile&&u.warnings.length>0&&w(`profile:extensions preflight_warnings=${L(u.warnings)}`),a=u.context.args,s=u.context.options,l=u.context.global,ht(n,s);let g=u.decision;await Gn(r,s,c.pmRoot,g),await zn(r,a,s,l,c.pmRoot);let h=g.run_extension_migrations?await va(c.registrations.migrations,c.pmRoot):[];l.profile&&h.length>0&&w(`profile:extensions migration_warnings=${L(h)}`);let y=Kr(c.registrations.migrations);Te={hooks:c.hooks,commandName:r,commandArgs:a,commandOptions:{...s},globalOptions:{...l},pmRoot:c.pmRoot,profileEnabled:!!l.profile,migrationBlockers:y},we(void 0),rt({command:r,args:a,options:{...s},global:{...l},pm_root:c.pmRoot}),q=await cn({command:r,pm_version:et,args:a,options:s,global:l,pm_root:c.pmRoot}),an(r,a,s,{source_context:q?.source_context,source_context_source:q?.source_context_source}),sn(r);let x=await Ho(c.hooks,{command:r,args:a,options:{...s},global:{...l},pm_root:c.pmRoot});l.profile&&x.length>0&&w(`profile:extensions hook_warnings=${L(x)}`),g.enforce_mandatory_migration_gate&&Jr(r,s,y)}),e.hook("postAction",async()=>{let t=vo();Ne(t.ok,t.error,{error_code:t.error_code,error_category:t.error_category,exit_code:t.exit_code,command_resolution:t.command_resolution,resolution_stage:t.resolution_stage}),await tt(t)})}Ea(v);var oa=Symbol("pmCliIdempotentTopLevelRegistration");function Sa(e){let t=e;if(t[oa])return;t[oa]=!0;let n=e.command.bind(e);e.command=((o,...i)=>{let r=o.split(/\s+/u)[0];return e.commands.some(a=>a.name()===r||a.aliases().includes(r))?new So(r):n(o,...i)})}async function jc(e,t){if(Sa(e),t.setup){let{registerSetupCommands:n}=await Sc();n(e)}if(t.listQuery){let{registerListQueryCommands:n}=await Ac(),o=typeof t.targetCommandName=="string"&&ao.has(t.targetCommandName)?new Set([t.targetCommandName]):void 0;n(e,o?{commandFilter:o}:void 0)}if(t.mutation){let{registerMutationCommands:n}=await Tc();n(e,{targetCommandName:t.targetCommandName})}if(t.operation){let{registerOperationCommands:n}=await Oc();n(e)}}function Uc(e){return async t=>{let n=ot(t.errorCode),o=mt({ok:!1,errorCode:t.errorCode,errorCategory:n});return await Ti({command:t.command,args:e.invocationArgv,options:t.options,global:e.bootstrapGlobal,pm_version:et,pm_root:e.bootstrapPmRoot,error_code:t.errorCode,error_message:t.errorMessage,exit_code:t.exitCode,error_category:n,command_resolution:o,resolution_stage:t.resolutionStage}),{errorCategory:n,commandResolution:o}}}async function Aa(e){if(e.bootstrapGlobal.noExtensions)return;let t=Se(e.invocationArgv),n=await zt(e.bootstrapPmRoot);if(n&&Je(n.discovery,t)){let o=await Oe(e.bootstrapPmRoot,t);Ta(o);return}n&&Ht(Oo(e.invocationArgv),n,t),Z({overrides:[]})}function Ta(e){if(!e){Z({overrides:[]});return}Z(e.services)}async function Io(e){Ne(!1,e.errorMessage,{error_code:e.classificationCode,error_category:e.errorCategory,exit_code:e.exitCode,command_resolution:e.commandResolution,resolution_stage:e.resolutionStage}),await tt({ok:!1,error:e.errorMessage,exit_code:e.exitCode,error_code:e.classificationCode,error_category:e.errorCategory,command_resolution:e.commandResolution,resolution_stage:e.resolutionStage})}async function Oa(){Ne(!0,void 0,{exit_code:f.SUCCESS,command_resolution:"success",resolution_stage:"parse"}),await tt({ok:!0,exit_code:f.SUCCESS,command_resolution:"success",resolution_stage:"parse"}),process.exitCode=f.SUCCESS}async function Ra(e,t){let n=typeof t=="number"&&Number.isFinite(t);if(!(e.error instanceof C)&&(nn(e.error)||!n))return!1;let o=re(e.error),i=e.error instanceof C?e.error.exitCode:tn(t),r=e.error instanceof C?e.error.context:void 0,a=aa(r,e.invocationArgv,o),s=sr(o,a),l=e.bootstrapGlobal.lean?xt(En(o,i,a)):En(o,i,a),d=e.jsonErrors?JSON.stringify(e.bootstrapGlobal.tokenAccounting?ie(l,u=>`${JSON.stringify(u,null,2)}
|
|
34
34
|
`):l,null,2):ar(o,a);e.jsonErrors?ve(`${d}
|
|
35
35
|
`):w(d);let{errorCategory:c,commandResolution:m}=await e.emitTelemetryCommandError({command:e.attemptedCommand,errorCode:s.code,errorMessage:s.detail,exitCode:i,options:{bootstrap_global_options:e.bootstrapGlobal},resolutionStage:"execute"}),p=await qt({command:e.attemptedCommand,error_code:s.code,error_category:c,exit_code:i,error_message:s.detail,command_resolution:m,resolution_stage:"execute",source_context:q?.source_context});return await Io({errorMessage:o,exitCode:i,classificationCode:s.code,errorCategory:c,commandResolution:m,resolutionStage:"execute"}),p&&(ln(on(e.error,o)),await Me(Ao)),process.exitCode=i,!0}async function Ia(e,t){let n=T(E(e.invocationArgv).commandPathTokens.join(" "))||Tn(e.invocationArgv),o=`unknown command '${n}'`,i=$(process.cwd(),e.bootstrapGlobal.path),r=await wa(i),a=Se(e.invocationArgv),s=await qn(i,{},Ee(a)),l=await Ge({message:o},v,r,{failedExtensions:s}),d=Sn(l.message,l.commandName,l.allowedTypes,{unknownCommandExamples:l.unknownCommandExamples,unknownCommandNextSteps:l.unknownCommandNextSteps,attemptedCommand:l.attemptedCommand,normalizedInvocationArgs:l.normalizedInvocationArgs,providedOptionFlags:l.providedOptionFlags,unknownOptionSuggestions:l.unknownOptionSuggestions,suggestedRetryCommand:l.suggestedRetryCommand,failedExtensions:s}),{errorCategory:c,commandResolution:m}=await e.emitTelemetryCommandError({command:n,errorCode:d.code,errorMessage:d.detail,exitCode:f.USAGE,options:{bootstrap_global_options:e.bootstrapGlobal,commander_code:t??"commander.helpDisplayed"},resolutionStage:"parse"}),p=await qt({command:n,error_code:d.code,error_category:c,exit_code:f.USAGE,error_message:d.detail,command_resolution:m,resolution_stage:"parse"}),u=e.jsonErrors?await Pn({message:o},v,r,e.bootstrapGlobal.lean===!0,{failedExtensions:s}):await In({message:o},v,r,{failedExtensions:s}),g=An(u,e.jsonErrors,s);await Io({errorMessage:o,exitCode:f.USAGE,classificationCode:d.code,errorCategory:c,commandResolution:m,resolutionStage:"parse"}),e.jsonErrors?ve(`${g}
|
|
36
36
|
`):w(g),p&&await Me(Ao),process.exitCode=f.USAGE}async function Pa(e,t,n){if(!(t==="commander.helpDisplayed"||t==="commander.help"||t==="commander.helpCommand")&&!n.includes("(outputHelp)"))return!1;let i=E(e.invocationArgv);return i.requested&&!ze(v,i.commandPathTokens)?(await Ia(e,t),!0):(await Oa(),!0)}async function $a(e,t){let n=await Ge(e.error,v,I),o=Sn(n.message,n.commandName,n.allowedTypes,{unknownCommandExamples:n.unknownCommandExamples,unknownCommandNextSteps:n.unknownCommandNextSteps,attemptedCommand:n.attemptedCommand,normalizedInvocationArgs:n.normalizedInvocationArgs,providedOptionFlags:n.providedOptionFlags,unknownOptionSuggestions:n.unknownOptionSuggestions,suggestedRetryCommand:n.suggestedRetryCommand}),{errorCategory:i,commandResolution:r}=await e.emitTelemetryCommandError({command:e.attemptedCommand,errorCode:o.code,errorMessage:o.detail,exitCode:f.USAGE,options:{bootstrap_global_options:e.bootstrapGlobal,commander_code:t},resolutionStage:"parse"}),a=await qt({command:e.attemptedCommand,error_code:o.code,error_category:i,exit_code:f.USAGE,error_message:o.detail,command_resolution:r,resolution_stage:"parse",source_context:q?.source_context}),s=e.jsonErrors?await Pn(e.error,v,I,e.bootstrapGlobal.lean===!0):await In(e.error,v,I),l=await Ur(o.code,e.bootstrapPmRoot,{},Ee(Se(e.invocationArgv))),d=An(s,e.jsonErrors,l);await Io({errorMessage:n.message,exitCode:f.USAGE,classificationCode:o.code,errorCategory:i,commandResolution:r,resolutionStage:"parse"}),e.jsonErrors?ve(`${d}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as wi,b as xi,c as ki,d as k,e as $i,f as I,g as Ti,h as vi,i as Ci,j as Ei,k as ji,l as Oi,m as Si,n as Ai,o as P,p as Mi,q as F,u as N,v as Di,w as Ii,x as z,y as Pi,z as Fi}from"./focused-chunks/chunk-
|
|
1
|
+
import{a as wi,b as xi,c as ki,d as k,e as $i,f as I,g as Ti,h as vi,i as Ci,j as Ei,k as ji,l as Oi,m as Si,n as Ai,o as P,p as Mi,q as F,u as N,v as Di,w as Ii,x as z,y as Pi,z as Fi}from"./focused-chunks/chunk-HNHMK5JI.js";import{a as fi,b as _i,c as mi,d as gi,e as yi,f as bi,g as hi,h as Ni}from"./focused-chunks/chunk-NRHTXBTI.js";import{A as lo,L as ti,M as ri,N as oi,O as ii,P as ni,R as si,S as di,T as ai,U as ci,V as li,W as pi,X as ui,a as le,b as pe,c as ue,d as fe,e as _e,f as me,g as ge,h as ye,i as be,j as Kr,k as Xr,l as Yr,m as Hr,n as Vr,o as Wr,p as Qr,q as Zr,r as eo,s as to,t as ro,u as oo,v as io,w as no,x as so,y as ao,z as co}from"./focused-chunks/chunk-PMPFLA6X.js";import{c as R,d as L,f as q,h as G}from"./focused-chunks/chunk-UIFVIE5F.js";import{$ as Ct,$a as S,A as et,Aa as Zt,B as tt,Ba as er,C as rt,Ca as tr,D as ot,Da as rr,E as it,Ea as or,F as nt,Fa as ir,Ga as nr,H as st,Ha as sr,I as dt,Ia as dr,J as at,Ja as ar,K as ct,Ka as cr,L as lt,La as lr,M as pt,Ma as pr,N as ut,Na as ur,O as ft,Oa as fr,P as _t,Pa as _r,Q as mt,Qa as mr,R as gt,Ra as gr,S as yt,Sa as yr,T as bt,Ta as br,U as ht,Ua as hr,V as wt,Va as wr,W as xt,Wa as xr,X as kt,Xa as kr,Y as $t,Z as Tt,Za as $r,_ as vt,aa as Et,ab as A,b as Oe,ba as jt,bb as Tr,c as Se,ca as Ot,d as Ae,da as St,e as Me,ea as At,f as De,fa as Mt,g as Ie,ga as Dt,h as Pe,ha as It,i as Fe,ia as Pt,j as Ne,ja as Ft,k as ze,ka as Nt,l as Re,la as zt,m as Le,ma as Rt,n as qe,na as Lt,o as Ge,oa as qt,p as Be,pa as Gt,q as Ue,qa as Bt,r as Je,ra as Ut,s as Ke,sa as Jt,t as Xe,ta as Kt,u as Ye,ua as Xt,v as He,va as Yt,w as Ve,wa as Ht,x as We,xa as Vt,y as Qe,ya as Wt,z as Ze,za as Qt}from"./focused-chunks/chunk-HQPTDJLF.js";import{a as zi,b as Ri,c as Li,d as qi,e as Gi,f as Bi,g as Ui,h as Ji}from"./focused-chunks/chunk-HFAW3FJQ.js";import{$ as w,$b as Cr,Ad as Eo,Bb as he,Bd as jo,Cb as we,Cd as Oo,Db as xe,Dd as So,Eb as ke,Ed as Ao,Fb as j,Fd as Mo,Gb as $e,Gd as Do,Hb as _,Hd as Io,Ib as O,Id as Po,Jb as Te,Jd as Fo,Kb as ve,Kd as No,Lb as Ce,Ld as zo,Mb as Ee,Md as Ro,Nb as je,Nd as Lo,Od as qo,Pd as Go,Qd as Bo,Vc as M,Wc as D,_b as vr,ac as Er,bc as jr,cc as Or,dc as Sr,ec as Ar,gc as Mr,hc as Dr,ic as Ir,jc as Pr,kc as Fr,kd as po,lc as Nr,ld as uo,le as x,mc as zr,md as fo,me as Uo,nc as Rr,nd as _o,ne as Jo,oc as Lr,od as mo,oe as Ko,pc as qr,pd as go,pe as Xo,qc as Gr,qd as yo,qe as Yo,rc as Br,rd as bo,re as Ho,sc as Ur,sd as ho,se as Vo,tc as Jr,td as wo,te as Wo,ud as xo,ue as Qo,vd as ko,ve as Zo,wd as $o,xd as To,yd as vo,zd as Co,ze as ei}from"./focused-chunks/chunk-NVVB2HJC.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]="3bb9b0da-78ce-5793-96e2-2de27b8f18fa")}catch{}})();var m,V=Object.freeze({list:"list-item-projection","list-all":"list-item-projection","list-draft":"list-item-projection","list-open":"list-item-projection","list-in-progress":"list-item-projection","list-blocked":"list-item-projection","list-closed":"list-item-projection","list-canceled":"list-item-projection",get:"get-item-projection",graph:"graph-detail-projection",search:"search-result-projection",history:"history-entry-projection",events:"mutation-event-projection",activity:"activity-entry-projection",deps:"dependency-graph-projection",health:"health-diagnostic-projection",validate:"validation-diagnostic-projection",contracts:"contract-catalog-projection"});function W(e,t){if(t==="--limit")return"result-row-limit";if(t==="--node-limit")return"graph-node-limit";if(t==="--edge-limit")return"graph-edge-limit";if(t==="--output-limit")return"rendered-output-row-limit";if(t==="--output-budget")return"rendered-output-byte-budget";if(t==="--token-budget")return"context-intent-token-budget";if(t==="--full"){let i=V[_(e)];if(i===void 0)throw new Error(`Command ${e} exposes --full without a registered projection concept.`);return i}return t!=="--file"?t.slice(2):["create","update","update-many"].includes(_(e))?"linked-file-path":["comments","notes","learnings"].includes(_(e))?"entry-file-input":"plan-definition-file"}function g(){if(m!==void 0)return m;let t=F.filter(({command:o})=>S(o)).flatMap(({command:o,family:s})=>P(o,A(o)).map(a=>({command:o,family:s,concept:W(o,a.flag),flag:a.flag,aliases:Object.freeze([...a.aliases??[]]),value_kind:a.repeatable?"list":a.flag==="--limit"?"number":a.value_type}))),i=new Set(t.flatMap(o=>o.aliases.map(s=>`${o.command}:${s}`))),n=t.filter(o=>!i.has(`${o.command}:${o.flag}`)),r=new Map;for(let o of n){let s=r.get(o.concept)??new Set;s.add(o.value_kind),r.set(o.concept,s)}return m=Object.freeze(n.map(o=>Object.freeze({...o,concept:r.get(o.concept)?.size===1?o.concept:`${o.concept}@${o.command}`}))),m}function Vi(){return Object.freeze(g().map(e=>Object.freeze({command:e.command,canonical_flag:e.flag,accepted_spellings:Object.freeze([...new Set([e.flag,...e.aliases])].sort())})))}var B=Object.freeze({init:30,item:20,config:36,extension:54,package:55,packages:55,install:27,upgrade:29,create:100,copy:24,focus:22,list:86,"list-all":86,"list-draft":84,"list-open":84,"list-in-progress":84,"list-blocked":84,"list-closed":84,"list-canceled":84,aggregate:40,context:45,ctx:45,get:30,graph:34,search:78,duplicates:25,eval:25,next:38,history:35,events:33,"history-attest":23,"history-redact":27,"history-repair":27,"history-compact":30,"history-author-acknowledge":28,merge:27,schema:43,profile:22,activity:35,restore:23,update:105,"update-many":146,close:32,"close-many":72,delete:24,append:25,comments:31,notes:35,learnings:31,files:39,docs:30,deps:32,plan:109,test:53,"test-all":40,telemetry:21,stats:29,health:36,validate:46,assurance:30,gc:22,workspace:23,contracts:29,claim:39,release:24,"start-task":23,"pause-task":23,"close-task":24,meet:33,event:33,remind:29,"test-runs-worker":20}),U=Object.freeze({...B,...Object.fromEntries(j.flatMap(({alias:e,canonical:t})=>{let i=B[e];return i===void 0?[]:[[t,i]]}))});function J(){let e=new Map(Object.keys(U).map(t=>[t,0]));for(let{command:t}of g())e.set(t,Number(e.get(t))+1);return Object.freeze(Object.entries(U).map(([t,i])=>Object.freeze({command:t,current:Number(e.get(t)),maximum:i})))}function Q(e,t,i){for(let n of e)for(let r of n.aliases){let o=t.get(`${n.command}:${r}`);o===void 0||o.flag===n.flag||i.push({code:"alias_collision",command:n.command,detail:`${r} aliases ${n.flag} but is canonical for ${o.flag}.`})}}function Z(e,t,i){let n=new Set(t.map(({command:r})=>r));for(let r of e.keys())n.has(r)||i.push({code:"missing_budget",command:r,detail:`${r} has canonical flags but no persisted budget.`});for(let r of t){let o=e.get(r.command)??0;o===0&&i.push({code:"stale_budget",command:r.command,detail:`${r.command} has a persisted budget but no canonical flags.`}),!(o<=r.maximum)&&i.push({code:"budget_exceeded",command:r.command,detail:`${o} canonical flags exceed the ratcheted maximum ${r.maximum}.`})}}function ee(e,t,i){let n=new Map(e.map(r=>[`${r.command}:${r.flag}`,r]));for(let r of t){let o=`${r.command}:${r.canonical_flag}`,s=n.get(o);if(!s){i.push({code:"removed_canonical_spelling",command:r.command,detail:`${r.canonical_flag} disappeared from the executable spelling inventory.`});continue}let a=new Set([s.flag,...s.aliases]);for(let d of r.accepted_spellings)a.has(d)||i.push({code:"removed_compatibility_spelling",command:r.command,detail:`${d} no longer resolves to ${r.canonical_flag}.`})}}function Wi(e=g(),t=J(),i=[]){let n=[],r=new Map,o=new Map,s=new Map,a=new Map;for(let d of e){let c=`${d.command}:${d.flag}`;r.has(c)?n.push({code:"duplicate_canonical_flag",command:d.command,detail:`${d.flag} has more than one canonical row.`}):r.set(c,d),a.set(d.command,(a.get(d.command)??0)+1);let l=o.get(d.concept);l!==void 0&&l!==d.value_kind?n.push({code:"inconsistent_concept_kind",command:d.command,detail:`${d.concept} uses both ${l} and ${d.value_kind}.`}):o.set(d.concept,d.value_kind);let p=s.get(d.concept);p!==void 0&&p!==d.flag?n.push({code:"semantic_spelling_collision",command:d.command,detail:`${d.concept} is canonicalized by both ${p} and ${d.flag}.`}):s.set(d.concept,d.flag)}return Q(e,r,n),Z(a,t,n),ee(e,i,n),n.sort((d,c)=>d.command.localeCompare(c.command)||d.code.localeCompare(c.code)||d.detail.localeCompare(c.detail)),{ok:n.length===0,entry_count:e.length,budget_count:t.length,concept_count:new Set(e.map(({concept:d})=>d)).size,baseline_entry_count:i.length,findings:n}}function Qi(){let e=g(),t=J(),i=new Map(t.map(({command:r})=>[r,"unknown"]));for(let{command:r,family:o}of e)i.set(r,o);return["# Generated flag lexicon budgets","","This file is generated by `listPmFlagLexicon()`. Compatibility aliases do not consume canonical budget.","","| Command | Capability family | Canonical flags | Maximum |","| --- | --- | ---: | ---: |",...t.map(({command:r,current:o,maximum:s})=>{let a=i.get(r);return`| \`${r}\` | ${a} | ${o} | ${s} |`}),""].join(`
|
|
2
2
|
`)}(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]="4d2bee02-8003-578c-9d25-32755534f8ff")}catch{}})();var $=2,te=["self_reported","independent_transport"];function y(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function f(e,t){if(typeof e!="string"||e.trim().length===0)throw new TypeError(`${t} must be a non-empty string`);return e.trim()}function K(e,t,i=!1){if(!Array.isArray(e)||e.length===0)throw new TypeError(`${t} must be a non-empty string array`);return e.map((n,r)=>{let o=f(n,`${t}[${String(r)}]`);return i?n:o})}function T(e,t){return e===void 0?void 0:f(e,t)}function re(e,t){if(e===void 0)return;if(!y(e)||Object.keys(e).length===0)throw new TypeError(`${t} must be a non-empty object`);let i=Object.entries(e).map(([n,r])=>{if(n.length===0||n.split(".").some(o=>o.length===0))throw new TypeError(`${t} must use dot-separated own-property paths`);if(r!==null&&typeof r!="string"&&typeof r!="boolean"&&(typeof r!="number"||!Number.isFinite(r)))throw new TypeError(`${t} values must be JSON primitives`);return[n,r]});return Object.fromEntries(i)}function oe(e,t,i,n,r,o){if(n==="refusal"){if(k(i)||r===void 0||o===void 0)throw new TypeError(`${e} refusal steps require a non-success exit, error code, and refusal surface`);return}if(r!==void 0||o!==void 0)throw new TypeError(`${e} only refusal steps may declare expected_error_code or expected_refusal_surface`);let s=M(t);if(s===void 0)throw new TypeError(`${e}.args must identify a command after global flags`);let a=t[s].trim().toLowerCase();if(a==="history"){let l=D(t.slice(s+1));l!==void 0&&(a=O(`history ${l}`))}let d=I(a);if(!k(i)||i!==0&&!d?.exit_codes.some(l=>l===i))throw new TypeError(`${e} successful output must use exit code 0 or a command-declared successful effect exit`);let c=z(a).kind;if(n!==c)throw new TypeError(`${e} expected ${n}, but ${a} declares ${c}`)}function ie(e,t,i){if(!y(e))throw new TypeError(`tasks.${t}.steps[${String(i)}] must be an object`);let n=`tasks.${t}.steps[${String(i)}]`,r=f(e.id,`${n}.id`),o=K(e.args,`${n}.args`,!0),s=e.expected_exit_code;if(typeof s!="number"||!Number.isSafeInteger(s))throw new TypeError(`${n}.expected_exit_code must be a safe integer`);let a=e.expected_output_kind;if(a!=="refusal"&&!N.includes(a))throw new TypeError(`${n}.expected_output_kind is unsupported`);let d=a,c=e.expected_accounting_mode;if(!te.includes(c))throw new TypeError(`${n}.expected_accounting_mode is unsupported`);let l=c;if(l==="independent_transport"&&d!=="refusal")throw new TypeError(`${n} independent_transport accounting is supported only for refusal steps`);let p=K(e.required_fields,`${n}.required_fields`);if(p.some(Y=>Y.split(".").some(H=>H.length===0)))throw new TypeError(`${n}.required_fields must contain dot-separated own-property paths`);let C=re(e.expected_field_values,`${n}.expected_field_values`),b=T(e.expected_error_code,`${n}.expected_error_code`),h=T(e.expected_refusal_surface,`${n}.expected_refusal_surface`),E=T(e.recovery_for,`${n}.recovery_for`);return oe(n,o,s,d,b,h),{id:r,args:o,expected_exit_code:s,expected_output_kind:d,expected_accounting_mode:l,required_fields:p,...C?{expected_field_values:C}:{},...b?{expected_error_code:b}:{},...h?{expected_refusal_surface:h}:{},...E?{recovery_for:E}:{}}}function ne(e,t){if(!y(e))throw new TypeError(`tasks[${String(t)}] must be an object`);let i=f(e.id,`tasks[${String(t)}].id`),n=f(e.description,`tasks.${i}.description`);if(!Array.isArray(e.steps)||e.steps.length===0)throw new TypeError(`tasks.${i}.steps must be a non-empty array`);let r=e.steps.map((s,a)=>ie(s,i,a)),o=new Map;for(let s of r){if(o.has(s.id))throw new TypeError(`tasks.${i} contains duplicate step id ${s.id}`);if(s.recovery_for!==void 0&&(o.get(s.recovery_for)?.expected_output_kind!=="refusal"||s.expected_output_kind==="refusal"))throw new TypeError(`tasks.${i}.${s.id} recovery_for must reference an earlier refusal and declare successful output`);o.set(s.id,s)}if(r.at(-1)?.expected_output_kind==="refusal")throw new TypeError(`tasks.${i} completed task must terminate with successful output`);for(let s of r)if(s.expected_output_kind==="refusal"&&!r.some(a=>a.recovery_for===s.id))throw new TypeError(`tasks.${i}.${s.id} refusal must have a later successful recovery_for step`);return{id:i,description:n,steps:r}}function nn(e){if(!y(e))throw new TypeError("agent-task transcript corpus must be an object");if(e.version!==$)throw new TypeError(`agent-task transcript corpus version must be ${String($)}`);if(!Array.isArray(e.tasks)||e.tasks.length===0)throw new TypeError("agent-task transcript corpus tasks must be non-empty");let t=e.tasks.map((n,r)=>ne(n,r)),i=new Set;for(let n of t){if(i.has(n.id))throw new TypeError(`duplicate agent-task transcript id ${n.id}`);i.add(n.id)}return{version:$,tasks: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]="6ecdd8cf-3153-5ed9-abd4-e8a73da6662a")}catch{}})();function se(e){return[e.expected_error_code!==void 0&&e.error_code!==e.expected_error_code?{code:"error_code_mismatch",probe_id:e.probe_id,detail:`Expected error code ${e.expected_error_code}, received ${e.error_code??"<missing>"}.`}:void 0,e.expected_allowed_values!==void 0&&JSON.stringify([...e.allowed_values].sort())!==JSON.stringify([...e.expected_allowed_values].sort())?{code:"incomplete_allowed_values",probe_id:e.probe_id,detail:"The refusal's accepted domain differs from the SDK-owned domain contract."}:void 0,e.expected_suggested_retry_args!==void 0&&(e.suggested_retry_args?.length??0)===0?{code:"missing_suggested_retry_args",probe_id:e.probe_id,detail:"The refusal omitted shell-free suggested retry arguments."}:void 0,e.expected_suggested_retry_args!==void 0&&(e.suggested_retry_args?.length??0)>0&&JSON.stringify(e.suggested_retry_args)!==JSON.stringify(e.expected_suggested_retry_args)?{code:"suggested_retry_args_mismatch",probe_id:e.probe_id,detail:"The refusal's suggested retry arguments differ from the SDK-owned contract."}:void 0]}function de(e){return[e.exit_code!==w.USAGE?{code:"non_refusal_exit",probe_id:e.probe_id,detail:`${e.entrypoint} returned exit code ${e.exit_code}; a structured usage refusal must return ${w.USAGE}.`}:void 0,e.allowed_values_required!==!1&&e.allowed_values.length===0?{code:"missing_allowed_values",probe_id:e.probe_id,detail:"The refusal omitted its complete accepted value domain."}:void 0,e.allowed_values.includes(e.rejected_value)?{code:"accepted_rejected_value",probe_id:e.probe_id,detail:`${e.rejected_value} is both rejected and advertised as allowed.`}:void 0,e.suggested_retry.trim().length===0?{code:"missing_suggested_retry",probe_id:e.probe_id,detail:"The refusal omitted an executable suggested retry."}:void 0,e.retry_succeeded?void 0:{code:"retry_failed",probe_id:e.probe_id,detail:"The advertised suggested retry did not succeed."},...se(e)]}function an(e){let t=[],i=new Set,n=0;e.length===0&&t.push({code:"empty_corpus",probe_id:"corpus",detail:"At least one real refusal observation is required."});for(let r of e){if(i.has(r.probe_id)){t.push({code:"duplicate_probe",probe_id:r.probe_id,detail:`${r.probe_id} was supplied more than once.`});continue}i.add(r.probe_id);let o=t.length;for(let s of de(r))s!==void 0&&t.push(s);t.length===o&&(n+=1)}return t.sort((r,o)=>r.probe_id!==o.probe_id?r.probe_id.localeCompare(o.probe_id):r.code.localeCompare(o.code)),{ok:t.length===0,probe_count:i.size,closed_probe_count:n,closure_fraction:i.size===0?0:n/i.size,findings: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]="4b0b0999-9172-51f5-9645-bab74d30cb3d")}catch{}})();var X="not-a-declared-intent",u="not-a-declared-field";function ae(){let e={get:["pm-domain"],search:["Domain query"]},t=[...new Set(x.map(({command:o})=>o))].map(o=>{let s=x.filter(c=>c.command===o),a=s[0],d=e[a.command]??[];return{probe_id:`${a.command}-invalid-intent`,command:a.command,flag:"--for",rejected_value:X,refusal_args:[a.command,...d,"--for",X],allowed_values:s.map(({intent:c})=>c).sort(),suggested_retry_args:[a.command,...d,"--for",a.intent],error_code:"unknown_context_intent"}}),i=L(),n=Object.keys(R).map(o=>({probe_id:`${o}-invalid-field`,command:o,flag:"--fields",rejected_value:u,refusal_args:[o,"--fields",u],allowed_values:i,suggested_retry_args:[o,"--fields","id,title,status","--limit","10"],error_code:"unknown_field_projection"}));return[...t,...n,{probe_id:"get-invalid-field",command:"get",flag:"--fields",rejected_value:u,refusal_args:["get","pm-domain","--fields",u],allowed_values:q(),suggested_retry_args:["get","pm-domain","--fields","id,title,status"],error_code:"unknown_field_projection"},{probe_id:"list-mutually-exclusive-projection",command:"list",flag:"--projection",rejected_value:"--brief+--full",refusal_args:["list","--brief","--full"],allowed_values:[],suggested_retry_args:["list","--brief"],error_code:"projection_options_mutually_exclusive",allowed_values_required:!1},{probe_id:"get-mutually-exclusive-projection",command:"get",flag:"--projection",rejected_value:"--full+--fields",refusal_args:["get","pm-domain","--full","--fields","id"],allowed_values:[],suggested_retry_args:["get","pm-domain","--full"],error_code:"projection_options_mutually_exclusive",allowed_values_required:!1},{probe_id:"search-mutually-exclusive-projection",command:"search",flag:"--projection",rejected_value:"--full+--fields",refusal_args:["search","Domain query","--full","--fields","id"],allowed_values:[],suggested_retry_args:["search","Domain query","--full"],error_code:"projection_options_mutually_exclusive",allowed_values_required:!1},{probe_id:"package-upgrade-mutually-exclusive-modes",command:"package upgrade",flag:"--cli-only/--packages-only",rejected_value:"--cli-only+--packages-only",refusal_args:["package","upgrade","--cli-only","--packages-only","--dry-run"],allowed_values:[],suggested_retry_args:["package","upgrade","--packages-only","--dry-run"],error_code:"package_upgrade_modes_mutually_exclusive",allowed_values_required:!1},{probe_id:"search-invalid-field",command:"search",flag:"--fields",rejected_value:u,refusal_args:["search","Domain query","--fields",u],allowed_values:G(),suggested_retry_args:["search","Domain query","--fields","id,title,status,score"],error_code:"unknown_field_projection"}].sort((o,s)=>o.probe_id.localeCompare(s.probe_id))}function un(e,t){let i=ae().find(o=>o.command===e&&o.flag===t);if(!i)return"No stable core values are declared.";let n=i.allowed_values.filter(o=>!o.startsWith("item.")),r=t==="--fields"?" item.<field> aliases and configured runtime metadata fields are also accepted.":" Configured package and workspace intents may extend this domain.";return`Allowed core values: ${n.join("|")}.${r}`}(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]="5053cc84-63e5-50d3-9a4c-00c2a485ed69")}catch{}})();var v=[{probe_id:"tracker-root-missing",failure_kind:"missing_root",expected_error_code:"tracker_root_missing",expected_exit_code:3,recovery_kind:"initialize"},{probe_id:"tracker-root-settings-missing",failure_kind:"settings_missing",expected_error_code:"tracker_not_initialized",expected_exit_code:3,recovery_kind:"initialize"},{probe_id:"tracker-root-not-directory",failure_kind:"not_directory",expected_error_code:"tracker_root_not_directory",expected_exit_code:2,recovery_kind:"select_directory"},{probe_id:"tracker-root-unreadable",failure_kind:"unreadable_root",expected_error_code:"tracker_root_unreadable",expected_exit_code:1,recovery_kind:"repair_permissions"}];function _n(){return v.map(e=>({...e}))}function ce(e,t){let i=[];t.error_code!==e.expected_error_code&&i.push({code:"error_code_mismatch",probe_id:e.probe_id,detail:`Expected ${e.expected_error_code}, received ${t.error_code}.`}),t.exit_code!==e.expected_exit_code&&i.push({code:"exit_code_mismatch",probe_id:e.probe_id,detail:`Expected exit ${e.expected_exit_code}, received ${t.exit_code}.`}),t.recovery_kind!==e.recovery_kind&&i.push({code:"recovery_kind_mismatch",probe_id:e.probe_id,detail:`Expected ${e.recovery_kind}, received ${t.recovery_kind}.`});let n=t.suggested_retry_args.indexOf("init"),r=n===0||n===2&&t.suggested_retry_args[0]==="--pm-path"&&t.suggested_retry_args[1]?.length>0;return e.recovery_kind==="initialize"&&!r&&i.push({code:"missing_init_recovery",probe_id:e.probe_id,detail:"Missing and uninitialized roots must emit a tokenized init retry."}),(t.unsafe_init_recommended||e.recovery_kind!=="initialize"&&t.suggested_retry_args.includes("init"))&&i.push({code:"unsafe_init_recovery",probe_id:e.probe_id,detail:"A tracker root that cannot be initialized safely must not recommend initialization."}),t.retry_succeeded||i.push({code:"retry_failed",probe_id:e.probe_id,detail:"The emitted retry or safe alternate-root recovery did not execute successfully."}),i}function mn(e){let t=new Map(e.map(r=>[r.probe_id,r])),i=[],n=0;for(let r of v){let o=t.get(r.probe_id);if(o===void 0){i.push({code:"missing_probe",probe_id:r.probe_id,detail:"No runtime observation was supplied for this contract."});continue}let s=ce(r,o);i.push(...s),s.length===0&&(n+=1)}return i.sort((r,o)=>r.probe_id.localeCompare(o.probe_id)||r.code.localeCompare(o.code)),{ok:i.length===0,probe_count:v.length,closed_probe_count:n,findings:i}}(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]="0aafe4f4-d636-597e-b594-c0a32ebced38")}catch{}})();export{me as ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS,lr as ACTIVITY_FLAG_CONTRACTS,Ye as AGGREGATE_FLAG_CONTRACTS,It as APPEND_FLAG_CONTRACTS,er as ASSURANCE_FLAG_CONTRACTS,ue as CALENDAR_COMMANDER_STRING_OPTION_CONTRACTS,cr as CALENDAR_FLAG_CONTRACTS,Pt as CLAIM_FLAG_CONTRACTS,ii as CLOSE_ACTION_OPTION_KEYS,Mt as CLOSE_FLAG_CONTRACTS,Dt as CLOSE_MANY_FLAG_CONTRACTS,qt as CLOSE_TASK_FLAG_CONTRACTS,He as COMMENTS_FLAG_CONTRACTS,kr as COMPLETION_FLAG_CONTRACTS,lt as CONFIG_FLAG_CONTRACTS,fe as CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS,ur as CONTEXT_FLAG_CONTRACTS,xr as CONTRACTS_FLAG_CONTRACTS,nr as COPY_FLAG_CONTRACTS,fi as CREATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS,mi as CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS,_i as CREATE_COMMANDER_STRING_OPTION_CONTRACTS,tr as CREATE_FLAG_CONTRACTS,Nt as DELETE_FLAG_CONTRACTS,mr as DEPS_FLAG_CONTRACTS,Ze as DOCS_FLAG_CONTRACTS,Wt as DUPLICATES_FLAG_CONTRACTS,yr as EVAL_FLAG_CONTRACTS,pr as EVENTS_FLAG_CONTRACTS,Bt as EVENT_FLAG_CONTRACTS,ve as EXECUTABLE_COMMAND_ALIASES,xt as EXTENSION_ACTIVATE_FLAG_CONTRACTS,wt as EXTENSION_ADOPT_ALL_FLAG_CONTRACTS,jt as EXTENSION_ADOPT_FLAG_CONTRACTS,Et as EXTENSION_CATALOG_FLAG_CONTRACTS,kt as EXTENSION_DEACTIVATE_FLAG_CONTRACTS,ht as EXTENSION_DESCRIBE_FLAG_CONTRACTS,Ct as EXTENSION_DOCTOR_FLAG_CONTRACTS,bt as EXTENSION_EXPLORE_FLAG_CONTRACTS,pt as EXTENSION_FLAG_CONTRACTS,ft as EXTENSION_INIT_FLAG_CONTRACTS,gt as EXTENSION_INSTALL_FLAG_CONTRACTS,Tt as EXTENSION_MANAGE_FLAG_CONTRACTS,$t as EXTENSION_MIGRATE_FLAG_CONTRACTS,vt as EXTENSION_RELOAD_FLAG_CONTRACTS,ut as EXTENSION_SCOPE_FLAG_CONTRACTS,yt as EXTENSION_UNINSTALL_FLAG_CONTRACTS,Qe as FILES_FLAG_CONTRACTS,sr as FOCUS_FLAG_CONTRACTS,Ht as GC_FLAG_CONTRACTS,fr as GET_FLAG_CONTRACTS,Ke as GLOBAL_FLAG_CONTRACTS,gr as GRAPH_FLAG_CONTRACTS,je as GRAPH_QUERY_DEFAULTS,_r as GUIDE_FLAG_CONTRACTS,Qt as HEALTH_FLAG_CONTRACTS,it as HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS,nt as HISTORY_COMPACT_FLAG_CONTRACTS,et as HISTORY_FLAG_CONTRACTS,rt as HISTORY_REDACT_FLAG_CONTRACTS,ot as HISTORY_REPAIR_FLAG_CONTRACTS,ct as INIT_FLAG_CONTRACTS,Ot as INSTALL_FLAG_CONTRACTS,or as ITEM_COMPLETE_FLAG_CONTRACTS,rr as ITEM_MUTATE_FLAG_CONTRACTS,ir as ITEM_REOPEN_FLAG_CONTRACTS,We as LEARNINGS_FLAG_CONTRACTS,le as LIST_COMMANDER_STRING_OPTION_CONTRACTS,Xe as LIST_FILTER_FLAG_CONTRACTS,Gt as MEET_FLAG_CONTRACTS,tt as MERGE_FLAG_CONTRACTS,Mr as MERGE_SUBCOMMAND_VALUES,_e as NEXT_COMMANDER_STRING_OPTION_CONTRACTS,hr as NEXT_FLAG_CONTRACTS,Ve as NOTES_FLAG_CONTRACTS,_t as PACKAGE_FLAG_CONTRACTS,mt as PACKAGE_INIT_FLAG_CONTRACTS,Lt as PAUSE_TASK_FLAG_CONTRACTS,oi as PLAN_CREATE_METADATA_PARAMETER_KEYS,at as PLAN_FLAG_CONTRACTS,te as PM_AGENT_TASK_ACCOUNTING_MODES,$ as PM_AGENT_TASK_TRANSCRIPT_VERSION,xe as PM_BULK_LIFECYCLE_COMMAND_ALIASES,Ne as PM_CLI_GRAMMAR_CONTRACT,Oe as PM_CLI_GRAMMAR_NOUNS,Fr as PM_CLI_ONLY_TOOL_ACTION_WAIVERS,Se as PM_CLI_SHARED_VERBS,Te as PM_COMMAND_ALIAS_CONTRACTS,Pe as PM_COMMAND_DESTINATION_CONTRACTS,xi as PM_COMMAND_EXIT_CONTRACTS,wi as PM_COMMAND_EXIT_OUTCOME_CONTRACTS,ho as PM_COMMAND_OUTPUT_BUDGET_CONTRACTS,Ii as PM_COMMAND_OUTPUT_ENVELOPE_CONTRACTS,Fe as PM_COMMAND_POSITIONAL_CONTRACTS,x as PM_CONTEXT_INTENT_CONTRACTS,we as PM_CONTEXT_OPS_COMMAND_ALIASES,Ar as PM_CORE_COMMAND_NAMES,zr as PM_DEPRECATED_TOOL_ACTIONS,_o as PM_DIAGNOSTIC_DEGRADATION_STEPS,mo as PM_DIAGNOSTIC_OUTPUT_BUDGET_CONTRACTS,fo as PM_DIAGNOSTIC_OUTPUT_CLASSES,Rr as PM_DISCOVERABLE_TOOL_ACTIONS,Si as PM_ERROR_CODE_CATALOG,Ci as PM_ERROR_CODE_EXIT_CLASS_CONTRACTS,vr as PM_EXTENSION_CAPABILITY_CONTRACTS,Dr as PM_EXTENSION_PACKAGE_ACTION_SUBCOMMANDS,Er as PM_EXTENSION_POLICY_MODE_CONTRACTS,Sr as PM_EXTENSION_POLICY_SURFACE_CONTRACTS,Or as PM_EXTENSION_SANDBOX_PROFILE_CONTRACTS,Cr as PM_EXTENSION_SERVICE_NAME_CONTRACTS,jr as PM_EXTENSION_TRUST_MODE_CONTRACTS,Ni as PM_HISTORY_ATTESTATION_CONTRACT,he as PM_HISTORY_COMMAND_ALIASES,Li as PM_HISTORY_OPERATION_ALIASES,Gi as PM_HISTORY_OPERATION_CONTRACT,qi as PM_HISTORY_OPERATION_PATTERNS,Pr as PM_ITEM_ACTION_SUBCOMMANDS,zi as PM_ITEM_HISTORY_OPERATIONS,j as PM_NAMESPACED_COMMAND_ALIASES,uo as PM_OUTPUT_BUDGET_CLASSES,po as PM_OUTPUT_DEGRADATION_STEPS,N as PM_OUTPUT_ENVELOPE_KINDS,Ir as PM_PACKAGE_ONLY_ACTION_SUBCOMMANDS,Ae as PM_POSITIONAL_ACTION_CONTRACTS,pi as PM_PROVIDER_TOOL_PARAMETERS_SCHEMA,ci as PM_PROVIDER_TOOL_PARAMETERS_SCHEMA_VERSION,Mo as PM_READ_OUTPUT_COMPOSITION_OPTION_FLAGS,vo as PM_READ_OUTPUT_CONTINUATION_FINGERPRINT_POLICIES,Oo as PM_READ_OUTPUT_DIMENSIONS,Ao as PM_READ_OUTPUT_OPTION_FLAGS,So as PM_READ_OUTPUT_SURFACES,Do as PM_READ_OUTPUT_SURFACE_CONTRACTS,ke as PM_RELOCATED_COMMAND_ALIASES,ki as PM_SUCCESS_EXIT_CODES,Nr as PM_TOOL_ACTIONS,ni as PM_TOOL_ACTION_PARAMETER_CONTRACTS,li as PM_TOOL_PARAMETERS_SCHEMA,ai as PM_TOOL_PARAMETERS_SCHEMA_MAJOR,di as PM_TOOL_PARAMETERS_SCHEMA_VERSION,ti as PM_TOOL_RESERVED_CUSTOM_FIELD_PROPERTIES,Ri as PM_WORKSPACE_HISTORY_OPERATIONS,dt as PROFILE_FLAG_CONTRACTS,At as REINDEX_FLAG_CONTRACTS,zt as RELEASE_FLAG_CONTRACTS,Ut as REMIND_FLAG_CONTRACTS,Ft as RESTORE_FLAG_CONTRACTS,st as SCHEMA_FLAG_CONTRACTS,pe as SEARCH_COMMANDER_STRING_OPTION_CONTRACTS,wr as SEARCH_FLAG_CONTRACTS,Rt as START_TASK_FLAG_CONTRACTS,Vt as STATS_FLAG_CONTRACTS,Je as SUBCOMMAND_GLOBAL_FLAG_CONTRACTS,Xt as TELEMETRY_FLAG_CONTRACTS,Kt as TEST_ALL_FLAG_CONTRACTS,Jt as TEST_FLAG_CONTRACTS,Yt as TEST_RUNS_FLAG_CONTRACTS,so as TOOL_ACTIVITY_OPTION_CONTRACTS,Yr as TOOL_AGGREGATE_OPTION_CONTRACTS,ro as TOOL_BULK_MUTATION_FILTER_OPTION_CONTRACT_SOURCE,no as TOOL_CALENDAR_OPTION_CONTRACTS,io as TOOL_CLOSE_MANY_FILTER_OPTION_CONTRACTS,ao as TOOL_CONTEXT_OPTION_CONTRACTS,Zr as TOOL_CREATE_OPTION_CONTRACTS,Qr as TOOL_CREATE_OPTION_CONTRACT_SOURCE,co as TOOL_DEPS_OPTION_CONTRACTS,lo as TOOL_GRAPH_OPTION_CONTRACTS,Xr as TOOL_LIST_FILTER_OPTION_CONTRACTS,Hr as TOOL_SEARCH_FILTER_OPTION_CONTRACTS,Wr as TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACTS,Vr as TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACT_SOURCE,oo as TOOL_UPDATE_MANY_FILTER_OPTION_CONTRACTS,to as TOOL_UPDATE_OPTION_CONTRACTS,eo as TOOL_UPDATE_OPTION_CONTRACT_SOURCE,gi as UPDATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS,bi as UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS,yi as UPDATE_COMMANDER_STRING_OPTION_CONTRACTS,dr as UPDATE_FLAG_CONTRACTS,ar as UPDATE_MANY_FLAG_CONTRACTS,St as UPGRADE_FLAG_CONTRACTS,Zt as VALIDATE_FLAG_CONTRACTS,br as WORKSPACE_FLAG_CONTRACTS,ui as _testOnlyCliContracts,Ti as analyzePmCommandExitConformance,Lr as analyzePmToolActionParity,hi as analyzeSdkCliParameterCompleteness,Yo as applyContextIntentProjection,qo as applyReadOutputDimensions,No as applyReadOutputIncludeModes,Wo as attachContextIntentReceipt,Zo as attachOutputTokenAccounting,Qo as attachReadOutputContracts,si as buildPmActionToolInputSchema,Ue as compactFlagAliasContracts,Ko as composeContextIntentContracts,Vo as contextIntentRowId,yo as createPmCommandOutputBudget,Ho as decodeContextIntentCursor,jo as decodeReadOutputContinuationCursor,bo as definePmCommandOutputBudget,Di as definePmCommandOutputEnvelope,Ei as definePmErrorCodeCatalog,vi as derivePmBulkMutationEffect,Eo as encodeReadOutputContinuationCursor,Ai as enrichCliFlagInvocationContract,P as enrichCliFlagInvocationContracts,xo as estimatePmOutputTokens,$e as findPmNamespacedCommand,Ie as formatPmPositionalActionFlagTip,Uo as getActiveContextIntentContracts,S as hasSubcommandFlagContractsForCommand,go as inferPmOutputBudgetClass,Gr as isPmExtensionCapabilityContract,Ur as isPmExtensionPolicyModeContract,Jr as isPmExtensionPolicySurfaceContract,Br as isPmExtensionServiceNameContract,$i as isPmKnownExitCode,Pi as isPmMutationReceipt,k as isPmSuccessfulExitCode,qr as isPmToolAction,Go as isReadOutputBudgetExceeded,ae as listCoreClosedDomainContracts,J as listPmCommandFlagBudgets,g as listPmFlagLexicon,Vi as listPmFlagSpellingInventory,_n as listTrackerPreflightRecoveryContracts,Ji as normalizeHistoryOperationForWrite,zo as normalizeReadOutputIncludeModeOptions,Fi as parseMutationReceipt,nn as parsePmAgentTaskTranscriptCorpus,Re as positionalShapeKey,Le as positionalSignatureKey,$o as projectPmDiagnosticOutput,To as projectPmDiagnosticText,ge as readFirstStringFromCommanderOptions,ye as readFirstValueFromCommanderOptions,Co as readOutputCollectionFingerprint,Fo as readOutputIncludeModeOptions,be as readStringArrayFromCommanderOptions,un as renderPmClosedDomainHelp,Ee as renderPmCommandAliasMigrationHint,Qi as renderPmFlagLexiconMarkdown,Ui as requireHistoryOperation,ji as resolveCanonicalPmErrorCodeContract,Xo as resolveContextIntentContract,Bi as resolveHistoryOperation,Ce as resolvePmCommandAlias,I as resolvePmCommandExitContract,_ as resolvePmCommandOperation,wo as resolvePmCommandOutputBudget,z as resolvePmCommandOutputEnvelope,Me as resolvePmCommandPositionalContract,ko as resolvePmDiagnosticOutputBudget,Oi as resolvePmErrorCodeContract,W as resolvePmFlagSemanticConcept,O as resolvePmHistoryOperation,De as resolvePmPositionalActionContract,$r as resolvePmPositionalActionFlagContracts,ri as resolvePmToolCustomFieldCollision,Ro as resolveReadOutputDimensions,Bo as resolveReadOutputEncoding,ei as resolveReadOutputRecoveryBudget,Io as resolveReadOutputSurface,A as resolveSubcommandFlagContractsForCommand,Jo as runWithContextIntentContracts,an as scorePmRefusalClosure,mn as scoreTrackerPreflightRecoveryClosure,Lo as stabilizeReadOutputReceiptEstimates,Tr as toCompletionFlagString,Po as validateReadOutputOptions,Mi as verifyCliFlagInvocationParity,ze as verifyExplicitPositionalSlotCensus,Ge as verifyPmCliGrammar,qe as verifyPmCommandPositionalContracts,Wi as verifyPmFlagLexicon,Kr as verifyToolOptionCliParity,Be as withFlagAliasMetadata};
|
|
3
3
|
//# sourceMappingURL=sdk-contracts.js.map
|