@unbrained/pm-cli 2026.9.26 → 2026.9.27

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.
Files changed (130) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +16 -0
  3. package/dist/cli/commander-usage.js +2 -2
  4. package/dist/cli/error-guidance.js +1 -1
  5. package/dist/cli/main.js +2 -2
  6. package/dist/cli/register-setup.js +1 -1
  7. package/dist/cli/runtime/selection.d.ts +3 -1
  8. package/dist/cli/runtime/selection.js +1 -1
  9. package/dist/cli-bundle/bundle-manifest.json +160 -152
  10. package/dist/cli-bundle/chunks/{chunk-IYN4MJ2C.js → chunk-3BTJ66CB.js} +56 -56
  11. package/dist/cli-bundle/chunks/{chunk-FOTXRNY6.js → chunk-4SLLCDFL.js} +39 -39
  12. package/dist/cli-bundle/chunks/{chunk-GRWPZR7F.js → chunk-4UPZLUT2.js} +7 -7
  13. package/dist/cli-bundle/chunks/{chunk-U55RYT3I.js → chunk-6OJVQ7SW.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-TYJXMT3Q.js → chunk-7TAGYNFP.js} +2 -2
  15. package/dist/cli-bundle/chunks/{chunk-QQD3VRMZ.js → chunk-AUS6USO4.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-4ODHIX7N.js → chunk-IEP3VAT5.js} +2 -2
  17. package/dist/cli-bundle/chunks/{chunk-HTHTX6E6.js → chunk-JX6WCCHL.js} +2 -2
  18. package/dist/cli-bundle/chunks/chunk-LC6WEA5U.js +2 -0
  19. package/dist/cli-bundle/chunks/{chunk-VMO4P5MX.js → chunk-LKGQUZ5M.js} +2 -2
  20. package/dist/cli-bundle/chunks/{chunk-TC74K7SS.js → chunk-OKVDVERQ.js} +2 -2
  21. package/dist/cli-bundle/chunks/{chunk-SZQCHJI4.js → chunk-TSF2LPIH.js} +2 -2
  22. package/dist/cli-bundle/chunks/{chunk-MJWKR7YA.js → chunk-V5UGBYHN.js} +3 -3
  23. package/dist/cli-bundle/chunks/{register-list-query-426QTRET.js → register-list-query-6PAJ4PBU.js} +2 -2
  24. package/dist/cli-bundle/chunks/{register-mutation-FLI3HHMP.js → register-mutation-RZCXZXYS.js} +2 -2
  25. package/dist/cli-bundle/chunks/{register-operations-TP7ZG4MK.js → register-operations-GK6VU2H2.js} +2 -2
  26. package/dist/cli-bundle/chunks/register-setup-ASEMNMBF.js +2 -0
  27. package/dist/cli-bundle/focused-chunks/{chunk-H3BI4EDO.js → chunk-6J2YCGSN.js} +3 -3
  28. package/dist/cli-bundle/focused-chunks/{chunk-XKH2FC5D.js → chunk-6UNKK3UH.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/{chunk-NRHTXBTI.js → chunk-DQ3MB7BO.js} +2 -2
  30. package/dist/cli-bundle/focused-chunks/{chunk-PMPFLA6X.js → chunk-E7LYK7V5.js} +2 -2
  31. package/dist/cli-bundle/focused-chunks/{chunk-25BBHWMH.js → chunk-GZD4ZYIB.js} +2 -2
  32. package/dist/cli-bundle/focused-chunks/chunk-KMPKKSA6.js +2 -0
  33. package/dist/cli-bundle/focused-chunks/{chunk-TLF6N56J.js → chunk-LBDWUHQD.js} +2 -2
  34. package/dist/cli-bundle/focused-chunks/{chunk-UIFVIE5F.js → chunk-MILJCOFJ.js} +2 -2
  35. package/dist/cli-bundle/focused-chunks/{chunk-MK5AKKHK.js → chunk-NETVXIH5.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/{chunk-Q355NPLH.js → chunk-NWRVNHAD.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/{chunk-XVBWZTU2.js → chunk-NZAG7OKB.js} +12 -12
  38. package/dist/cli-bundle/focused-chunks/{chunk-OY3VHCTX.js → chunk-OJKJFDIG.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/chunk-OJRX6G22.js +2 -0
  40. package/dist/cli-bundle/focused-chunks/{chunk-NVVB2HJC.js → chunk-PDVL7QYU.js} +16 -16
  41. package/dist/cli-bundle/focused-chunks/{chunk-O7MIBEMK.js → chunk-QO4MTAEA.js} +2 -2
  42. package/dist/cli-bundle/focused-chunks/{chunk-ABA3KRPY.js → chunk-SMADBUPL.js} +2 -2
  43. package/dist/cli-bundle/main.js +21 -21
  44. package/dist/cli-bundle/sdk-authoring.js +1 -1
  45. package/dist/cli-bundle/sdk-contracts.js +1 -1
  46. package/dist/cli-bundle/sdk-core.js +2 -2
  47. package/dist/cli-bundle/sdk-governance.js +1 -1
  48. package/dist/cli-bundle/sdk-graph.js +1 -1
  49. package/dist/cli-bundle/sdk-merge.js +23 -23
  50. package/dist/cli-bundle/sdk-query.js +1 -1
  51. package/dist/cli-bundle/sdk-runtime.js +1 -1
  52. package/dist/cli-bundle/sdk-testing.js +1 -1
  53. package/dist/cli-bundle/sdk.js +8 -8
  54. package/dist/sdk/agent-capability-contracts.js +1 -1
  55. package/dist/sdk/cli-contracts/command-aliases.js +1 -1
  56. package/dist/sdk/cli-contracts/grammar-contracts.js +1 -1
  57. package/dist/sdk/completion/shared.d.ts +1 -1
  58. package/dist/sdk/completion/shared.js +1 -1
  59. package/dist/sdk/extension/static-inventory.d.ts +54 -0
  60. package/dist/sdk/extension/static-inventory.js +2 -0
  61. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  62. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
  63. package/dist/sdk/guide-topics.js +1 -1
  64. package/dist/sdk/index.d.ts +1 -0
  65. package/dist/sdk/index.js +1 -1
  66. package/dist/sdk/public-surface.json +1 -1
  67. package/dist/sdk/query/complete-list.js +1 -1
  68. package/dist/sdk/read-output/provenance.d.ts +20 -0
  69. package/dist/sdk/read-output/provenance.js +2 -0
  70. package/dist/sdk/read-output-contracts.js +1 -1
  71. package/dist/sdk/runtime-input.js +1 -1
  72. package/docs/CLI_GRAMMAR.md +31 -0
  73. package/docs/CODEX_PLUGIN.md +8 -0
  74. package/docs/EXTENSION_LIFECYCLE.md +18 -0
  75. package/docs/RELEASING.md +46 -1
  76. package/docs/agent-task-token-baseline.json +4 -4
  77. package/docs/generated/AGENT_CAPABILITY_ROUTING.md +1 -1
  78. package/docs/generated/AGENT_COMMAND_SURFACE.md +5 -1
  79. package/docs/generated/FLAG_LEXICON_BUDGETS.md +4 -0
  80. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +14 -7
  81. package/marketplace.json +2 -2
  82. package/package.json +2 -2
  83. package/packages/pm-beads/package.json +1 -1
  84. package/packages/pm-calendar/package.json +1 -1
  85. package/packages/pm-command-kit/package.json +1 -1
  86. package/packages/pm-digital-twin/package.json +1 -1
  87. package/packages/pm-governance-audit/package.json +1 -1
  88. package/packages/pm-guide-shell/package.json +1 -1
  89. package/packages/pm-kanban/package.json +1 -1
  90. package/packages/pm-lifecycle-hooks/package.json +1 -1
  91. package/packages/pm-linked-test-adapters/package.json +1 -1
  92. package/packages/pm-search-advanced/package.json +1 -1
  93. package/packages/pm-templates/package.json +1 -1
  94. package/packages/pm-todos/package.json +1 -1
  95. package/packages/pm-vcs/package.json +1 -1
  96. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  97. package/plugins/pm-claude/README.md +5 -1
  98. package/plugins/pm-claude/package.json +2 -2
  99. package/plugins/pm-claude/skills/pm-audit/SKILL.md +14 -103
  100. package/plugins/pm-claude/skills/pm-audit/agents/openai.yaml +4 -0
  101. package/plugins/pm-claude/skills/pm-developer/SKILL.md +20 -143
  102. package/plugins/pm-claude/skills/pm-developer/agents/openai.yaml +4 -0
  103. package/plugins/pm-claude/skills/pm-planner/SKILL.md +16 -167
  104. package/plugins/pm-claude/skills/pm-planner/agents/openai.yaml +4 -0
  105. package/plugins/pm-claude/skills/pm-release/SKILL.md +18 -102
  106. package/plugins/pm-claude/skills/pm-release/agents/openai.yaml +4 -0
  107. package/plugins/pm-claude/skills/pm-workflow/SKILL.md +25 -156
  108. package/plugins/pm-claude/skills/pm-workflow/agents/openai.yaml +4 -0
  109. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  110. package/plugins/pm-codex/README.md +10 -2
  111. package/plugins/pm-codex/mcp.json +11 -0
  112. package/plugins/pm-codex/package.json +2 -2
  113. package/plugins/pm-codex/plugin.json +45 -0
  114. package/plugins/pm-codex/skills/pm-audit/SKILL.md +21 -0
  115. package/plugins/pm-codex/skills/pm-audit/agents/openai.yaml +4 -0
  116. package/plugins/pm-codex/skills/pm-auditor/SKILL.md +5 -40
  117. package/plugins/pm-codex/skills/pm-auditor/agents/openai.yaml +3 -5
  118. package/plugins/pm-codex/skills/pm-developer/SKILL.md +26 -0
  119. package/plugins/pm-codex/skills/pm-developer/agents/openai.yaml +4 -0
  120. package/plugins/pm-codex/skills/pm-native/SKILL.md +7 -87
  121. package/plugins/pm-codex/skills/pm-native/agents/openai.yaml +3 -5
  122. package/plugins/pm-codex/skills/pm-planner/SKILL.md +22 -0
  123. package/plugins/pm-codex/skills/pm-planner/agents/openai.yaml +4 -0
  124. package/plugins/pm-codex/skills/pm-release/SKILL.md +17 -38
  125. package/plugins/pm-codex/skills/pm-release/agents/openai.yaml +2 -4
  126. package/plugins/pm-codex/skills/pm-workflow/SKILL.md +39 -0
  127. package/plugins/pm-codex/skills/pm-workflow/agents/openai.yaml +4 -0
  128. package/dist/cli-bundle/chunks/register-setup-574SIVQZ.js +0 -2
  129. package/dist/cli-bundle/focused-chunks/chunk-HNHMK5JI.js +0 -2
  130. package/dist/cli-bundle/focused-chunks/chunk-HQPTDJLF.js +0 -2
@@ -1,2 +1,2 @@
1
- !(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="235bac43-67ba-5fad-9ec2-e392aeb7feda")}catch(e2){}})();import{PM_CORE_COMMAND_NAMES}from"./cli-contracts/enum-contracts.js";import{PM_COMMAND_ALIAS_CONTRACTS,PM_NAMESPACED_COMMAND_ALIASES,resolvePmCommandOperation}from"./cli-contracts/command-aliases.js";const CORE_COMMANDS=new Set(["claim","close","context","create","get","help","init","list","next","plan","release","search","update","validate"]);const STANDARD_COMMANDS=new Set(["append","comments","config","contracts","deps","docs","events","files","focus","graph","health","history","learnings","list-all","list-blocked","list-closed","list-in-progress","list-open","notes","profile","schema","test"]);const COMMANDS_BY_FAMILY=Object.freeze({workspace:new Set(["config","gc","health","init","merge","profile","schema","telemetry","workspace"]),intake:new Set(["copy","create","focus","item","restore"]),context:new Set(["activity","aggregate","context","ctx","duplicates","eval","get","help","list","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","next","search","stats"]),lifecycle:new Set(["claim","close","close-many","close-task","delete","pause-task","item-reopen","release","start-task","update","update-many"]),evidence:new Set(["append","comments","docs","events","files","history","history-attest","history-author-acknowledge","history-compact","history-redact","history-repair","learnings","notes"]),graph:new Set(["deps","graph","plan"]),quality:new Set(["assurance","contracts","test","test-all","validate"]),automation:new Set(["event","meet","remind"])});const EXTENSION_COMMANDS=new Set(["extension","install","package","packages","upgrade"]);function resolvePmCommandCapabilityFamily(command){const normalized=resolvePmCommandOperation(command.trim().toLowerCase());if(normalized==="ops")return"quality";for(const[family,commands]of Object.entries(COMMANDS_BY_FAMILY)){if(commands.has(normalized))return family}return EXTENSION_COMMANDS.has(normalized)?"extensions":"internal"}const PM_COMMAND_CAPABILITY_CONTRACTS=Object.freeze([...PM_CORE_COMMAND_NAMES.flatMap(command=>command==="item"?["item","item-reopen"]:[command,...PM_NAMESPACED_COMMAND_ALIASES.filter(alias=>alias.alias===command).map(alias=>alias.canonical)]).map(command=>({command,tier:CORE_COMMANDS.has(resolvePmCommandOperation(command))?"core":STANDARD_COMMANDS.has(resolvePmCommandOperation(command))?"standard":"full",family:resolvePmCommandCapabilityFamily(command)})),{command:"ops",tier:"core",family:"quality"},{command:"completion-statuses",tier:"internal",family:"internal"},{command:"completion-tags",tier:"internal",family:"internal"},{command:"completion-types",tier:"internal",family:"internal"},{command:"test-runs-worker",tier:"internal",family:"internal"},{command:"item test worker",tier:"internal",family:"internal"}]);const PM_COMMAND_VISIBILITY_CONTRACTS=PM_COMMAND_CAPABILITY_CONTRACTS;const PM_CORE_HELP_BUDGET=Object.freeze({max_lines:50,max_utf8_bytes:6e3});const PM_CORE_HELP_OPTION_FLAGS=Object.freeze(["-V, --version","--all","--json","--output-include <fields>","--output-limit <count>","--output-budget <tokens|unbounded>","--output-cursor <cursor>","--pm-path <dir>","--no-extensions","--no-pager","--explain","-h, --help"]);function measurePmCoreHelp(text){const lines=text===""?0:text.split(/\r?\n/).length;const utf8Bytes=Buffer.byteLength(text,"utf8");return{lines,utf8_bytes:utf8Bytes,within_budget:lines<=PM_CORE_HELP_BUDGET.max_lines&&utf8Bytes<=PM_CORE_HELP_BUDGET.max_utf8_bytes}}const TIER_ORDER={core:0,standard:1,full:2,internal:3};const COMMAND_TIER_BY_NAME=new Map(PM_COMMAND_VISIBILITY_CONTRACTS.map(({command,tier})=>[command,tier]));function resolvePmCommandVisibilityTier(command,extensionTier="standard"){return COMMAND_TIER_BY_NAME.get(command.trim().toLowerCase())??COMMAND_TIER_BY_NAME.get(resolvePmCommandOperation(command.trim().toLowerCase()))??extensionTier}function listPmCommandsForTier(tier){return listPmCommandsForTierFromContracts(tier,PM_COMMAND_CAPABILITY_CONTRACTS)}function listPmCommandsForTierFromContracts(tier,contracts){const maximum=TIER_ORDER[tier];return contracts.filter(entry=>entry.tier!=="internal"&&TIER_ORDER[entry.tier]<=maximum).map(entry=>entry.command)}function listPmCommandsForFamily(family){return listPmCommandsForFamilyFromContracts(family,PM_COMMAND_CAPABILITY_CONTRACTS)}function listPmCommandsForFamilyFromContracts(family,contracts){return contracts.filter(entry=>entry.family===family).map(entry=>entry.command)}const CAPABILITY_FAMILY_ORDER=["workspace","intake","context","lifecycle","evidence","graph","quality","automation","extensions","internal"];const CAPABILITY_ROUTING_EXCLUDED_ALIASES=new Set([...PM_COMMAND_ALIAS_CONTRACTS.filter(alias=>alias.hidden).map(alias=>alias.alias),"ctx","extension","install","item-reopen","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","packages","upgrade"]);function listPmCommandCapabilityGroups(contracts=PM_COMMAND_CAPABILITY_CONTRACTS){return CAPABILITY_FAMILY_ORDER.map(family=>({family,commands:listPmCommandsForFamilyFromContracts(family,contracts).filter(command=>contracts.find(entry=>entry.command===command)?.tier!=="internal"&&!CAPABILITY_ROUTING_EXCLUDED_ALIASES.has(command))})).filter(({commands})=>commands.length>0)}const PM_MCP_TOOL_COMMAND_CONTRACTS=Object.freeze({pm_append:"append",pm_claim:"claim",pm_close:"close",pm_comments:"comments",pm_config:"config",pm_context:"context",pm_contracts:"contracts",pm_copy:"copy",pm_create:"create",pm_deps:"deps",pm_discover:"help",pm_docs:"docs",pm_events:"history",pm_files:"files",pm_focus:"focus",pm_get:"get",pm_graph:"graph",pm_health:"health",pm_learnings:"learnings",pm_list:"list",pm_mutate:"update",pm_next:"next",pm_notes:"notes",pm_plan:"plan",pm_profile:"profile",pm_release:"release",pm_run:"package",pm_schema:"schema",pm_search:"search",pm_test:"test",pm_update:"update",pm_validate:"validate"});function listPmMcpToolsForProfile(availableTools,profile){return listPmMcpToolsForProfileFromContracts(availableTools,profile,PM_COMMAND_CAPABILITY_CONTRACTS)}function listPmMcpToolsForProfileFromContracts(availableTools,profile,contracts){if(profile==="full")return[...availableTools];const visibleCommands=new Set(listPmCommandsForTierFromContracts(profile,contracts));return availableTools.filter(tool=>{const command=PM_MCP_TOOL_COMMAND_CONTRACTS[tool];return command!==void 0&&visibleCommands.has(command)})}const PM_MCP_RESOURCE_CONTRACTS=Object.freeze([{uri:"pm://workspace/context",name:"Workspace context",description:"Bounded project context for orientation, including active hierarchy and progress.",mimeType:"application/json"},{uri:"pm://workspace/focus",name:"Active focus",description:"The session focus that supplies the default create parent.",mimeType:"application/json"},{uri:"pm://workspace/claims",name:"Active claims",description:"Bounded in-progress work and active ownership context.",mimeType:"application/json"},{uri:"pm://workspace/agent-guide",name:"Agent guidance",description:"Repository-local AGENTS.md instructions, bounded for safe host attachment.",mimeType:"text/markdown"}]);const PM_MCP_PROMPT_CONTRACTS=Object.freeze([{name:"orient",description:"Build bounded live context, search all statuses, and select canonical work without creating duplicates.",arguments:[{name:"request",description:"The user's requested outcome or topic.",required:true},{name:"scope",description:"Optional bounded workspace or subsystem scope.",required:false}],template:"Orient to the live pm workspace for: {{request}}. Scope hint: {{scope}}. Read context, search all statuses, inspect full metadata for relevant items, and select canonical lineage before any mutation."},{name:"claim-and-start",description:"Claim one canonical item and begin implementation with linked context.",arguments:[{name:"id",description:"Canonical pm item id.",required:true}],template:"Read {{id}} in full, claim it, set it in_progress, then implement only its acceptance scope while linking files, docs, tests, and evidence."},{name:"record-evidence-and-close",description:"Record exact verification evidence, close the item, and release ownership.",arguments:[{name:"id",description:"Canonical pm item id.",required:true},{name:"evidence",description:"Exact verification and outcome evidence.",required:true}],template:"For {{id}}, record this evidence: {{evidence}}. Verify linked tests, close only if acceptance is met, then release the claim."}]);function renderPmCommandVisibilityMarkdown(){return renderPmCommandVisibilityMarkdownFromContracts(PM_COMMAND_CAPABILITY_CONTRACTS)}function renderPmCommandVisibilityMarkdownFromContracts(contracts){const rows=contracts.map(({command,tier,family})=>`| \`${command}\` | ${tier} | ${family} |`);return["# Generated agent command surface","","This file is generated from `PM_COMMAND_CAPABILITY_CONTRACTS`. Do not edit it manually.","","| Command | Minimum visibility tier | Capability family |","| --- | --- | --- |",...rows,""].join("\n")}function renderPmCapabilityRoutingMarkdown(contracts=PM_COMMAND_CAPABILITY_CONTRACTS){const rows=listPmCommandCapabilityGroups(contracts).map(({family,commands})=>`| ${family} | ${commands.map(command=>`\`${command}\``).join(", ")} |`);return["# Generated agent capability routing","","Tracker: `pm-kxci8x`.","","This file is generated from `PM_COMMAND_CAPABILITY_CONTRACTS`. Do not edit it manually.","","| Capability family | Commands |","| --- | --- |",...rows,""].join("\n")}export{PM_COMMAND_CAPABILITY_CONTRACTS,PM_COMMAND_VISIBILITY_CONTRACTS,PM_CORE_HELP_BUDGET,PM_CORE_HELP_OPTION_FLAGS,PM_MCP_PROMPT_CONTRACTS,PM_MCP_RESOURCE_CONTRACTS,PM_MCP_TOOL_COMMAND_CONTRACTS,listPmCommandCapabilityGroups,listPmCommandsForFamily,listPmCommandsForFamilyFromContracts,listPmCommandsForTier,listPmCommandsForTierFromContracts,listPmMcpToolsForProfile,listPmMcpToolsForProfileFromContracts,measurePmCoreHelp,renderPmCapabilityRoutingMarkdown,renderPmCommandVisibilityMarkdown,renderPmCommandVisibilityMarkdownFromContracts,resolvePmCommandCapabilityFamily,resolvePmCommandVisibilityTier};
1
+ !(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e8c34bbe-eab3-5dcf-9436-410c9c69feee")}catch(e2){}})();import{PM_CORE_COMMAND_NAMES}from"./cli-contracts/enum-contracts.js";import{PM_COMMAND_ALIAS_CONTRACTS,PM_NAMESPACED_COMMAND_ALIASES,resolvePmCommandOperation}from"./cli-contracts/command-aliases.js";const CORE_COMMANDS=new Set(["claim","close","context","create","get","help","init","list","next","plan","release","search","update","validate","workspace"]);const STANDARD_COMMANDS=new Set(["append","comments","config","contracts","deps","docs","events","files","focus","graph","health","history","learnings","list-all","list-blocked","list-closed","list-in-progress","list-open","notes","profile","schema","test"]);const COMMANDS_BY_FAMILY=Object.freeze({workspace:new Set(["config","gc","health","init","merge","profile","schema","telemetry","workspace"]),intake:new Set(["copy","create","focus","item","restore"]),context:new Set(["activity","aggregate","context","ctx","duplicates","eval","get","help","list","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","next","search","stats"]),lifecycle:new Set(["claim","close","close-many","close-task","delete","pause-task","item-reopen","release","start-task","update","update-many"]),evidence:new Set(["append","comments","docs","events","files","history","history-attest","history-author-acknowledge","history-compact","history-redact","history-repair","learnings","notes"]),graph:new Set(["deps","graph","plan"]),quality:new Set(["assurance","contracts","test","test-all","validate"]),automation:new Set(["event","meet","remind"])});const EXTENSION_COMMANDS=new Set(["extension","install","package","packages","upgrade"]);function resolvePmCommandCapabilityFamily(command){const normalized=resolvePmCommandOperation(command.trim().toLowerCase());if(normalized==="ops")return"quality";for(const[family,commands]of Object.entries(COMMANDS_BY_FAMILY)){if(commands.has(normalized))return family}return EXTENSION_COMMANDS.has(normalized)?"extensions":"internal"}const PM_COMMAND_CAPABILITY_CONTRACTS=Object.freeze([...PM_CORE_COMMAND_NAMES.flatMap(command=>command==="item"?["item","item-reopen"]:[command,...PM_NAMESPACED_COMMAND_ALIASES.filter(alias=>alias.alias===command).map(alias=>alias.canonical)]).map(command=>({command,tier:CORE_COMMANDS.has(resolvePmCommandOperation(command))?"core":STANDARD_COMMANDS.has(resolvePmCommandOperation(command))?"standard":"full",family:resolvePmCommandCapabilityFamily(command)})),{command:"ops",tier:"core",family:"quality"},{command:"completion-statuses",tier:"internal",family:"internal"},{command:"completion-tags",tier:"internal",family:"internal"},{command:"completion-types",tier:"internal",family:"internal"},{command:"test-runs-worker",tier:"internal",family:"internal"},{command:"item test worker",tier:"internal",family:"internal"}]);const PM_COMMAND_VISIBILITY_CONTRACTS=PM_COMMAND_CAPABILITY_CONTRACTS;const PM_CORE_HELP_BUDGET=Object.freeze({max_lines:50,max_utf8_bytes:6e3});const PM_CORE_HELP_OPTION_FLAGS=Object.freeze(["-V, --version","--all","--json","--output-include <fields>","--output-limit <count>","--output-budget <tokens|unbounded>","--output-cursor <cursor>","--pm-path <dir>","--no-extensions","--no-pager","--explain","-h, --help"]);function measurePmCoreHelp(text){const lines=text===""?0:text.split(/\r?\n/).length;const utf8Bytes=Buffer.byteLength(text,"utf8");return{lines,utf8_bytes:utf8Bytes,within_budget:lines<=PM_CORE_HELP_BUDGET.max_lines&&utf8Bytes<=PM_CORE_HELP_BUDGET.max_utf8_bytes}}const TIER_ORDER={core:0,standard:1,full:2,internal:3};const COMMAND_TIER_BY_NAME=new Map(PM_COMMAND_VISIBILITY_CONTRACTS.map(({command,tier})=>[command,tier]));function resolvePmCommandVisibilityTier(command,extensionTier="standard"){return COMMAND_TIER_BY_NAME.get(command.trim().toLowerCase())??COMMAND_TIER_BY_NAME.get(resolvePmCommandOperation(command.trim().toLowerCase()))??extensionTier}function listPmCommandsForTier(tier){return listPmCommandsForTierFromContracts(tier,PM_COMMAND_CAPABILITY_CONTRACTS)}function listPmCommandsForTierFromContracts(tier,contracts){const maximum=TIER_ORDER[tier];return contracts.filter(entry=>entry.tier!=="internal"&&TIER_ORDER[entry.tier]<=maximum).map(entry=>entry.command)}function listPmCommandsForFamily(family){return listPmCommandsForFamilyFromContracts(family,PM_COMMAND_CAPABILITY_CONTRACTS)}function listPmCommandsForFamilyFromContracts(family,contracts){return contracts.filter(entry=>entry.family===family).map(entry=>entry.command)}const CAPABILITY_FAMILY_ORDER=["workspace","intake","context","lifecycle","evidence","graph","quality","automation","extensions","internal"];const CAPABILITY_ROUTING_EXCLUDED_ALIASES=new Set([...PM_COMMAND_ALIAS_CONTRACTS.filter(alias=>alias.hidden).map(alias=>alias.alias),"ctx","extension","install","item-reopen","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","packages","upgrade"]);function listPmCommandCapabilityGroups(contracts=PM_COMMAND_CAPABILITY_CONTRACTS){return CAPABILITY_FAMILY_ORDER.map(family=>({family,commands:listPmCommandsForFamilyFromContracts(family,contracts).filter(command=>contracts.find(entry=>entry.command===command)?.tier!=="internal"&&!CAPABILITY_ROUTING_EXCLUDED_ALIASES.has(command))})).filter(({commands})=>commands.length>0)}const PM_MCP_TOOL_COMMAND_CONTRACTS=Object.freeze({pm_append:"append",pm_claim:"claim",pm_close:"close",pm_comments:"comments",pm_config:"config",pm_context:"context",pm_contracts:"contracts",pm_copy:"copy",pm_create:"create",pm_deps:"deps",pm_discover:"help",pm_docs:"docs",pm_events:"history",pm_files:"files",pm_focus:"focus",pm_get:"get",pm_graph:"graph",pm_health:"health",pm_learnings:"learnings",pm_list:"list",pm_mutate:"update",pm_next:"next",pm_notes:"notes",pm_plan:"plan",pm_profile:"profile",pm_release:"release",pm_run:"package",pm_schema:"schema",pm_search:"search",pm_test:"test",pm_update:"update",pm_validate:"validate"});function listPmMcpToolsForProfile(availableTools,profile){return listPmMcpToolsForProfileFromContracts(availableTools,profile,PM_COMMAND_CAPABILITY_CONTRACTS)}function listPmMcpToolsForProfileFromContracts(availableTools,profile,contracts){if(profile==="full")return[...availableTools];const visibleCommands=new Set(listPmCommandsForTierFromContracts(profile,contracts));return availableTools.filter(tool=>{const command=PM_MCP_TOOL_COMMAND_CONTRACTS[tool];return command!==void 0&&visibleCommands.has(command)})}const PM_MCP_RESOURCE_CONTRACTS=Object.freeze([{uri:"pm://workspace/context",name:"Workspace context",description:"Bounded project context for orientation, including active hierarchy and progress.",mimeType:"application/json"},{uri:"pm://workspace/focus",name:"Active focus",description:"The session focus that supplies the default create parent.",mimeType:"application/json"},{uri:"pm://workspace/claims",name:"Active claims",description:"Bounded in-progress work and active ownership context.",mimeType:"application/json"},{uri:"pm://workspace/agent-guide",name:"Agent guidance",description:"Repository-local AGENTS.md instructions, bounded for safe host attachment.",mimeType:"text/markdown"}]);const PM_MCP_PROMPT_CONTRACTS=Object.freeze([{name:"orient",description:"Build bounded live context, search all statuses, and select canonical work without creating duplicates.",arguments:[{name:"request",description:"The user's requested outcome or topic.",required:true},{name:"scope",description:"Optional bounded workspace or subsystem scope.",required:false}],template:"Orient to the live pm workspace for: {{request}}. Scope hint: {{scope}}. Read context, search all statuses, inspect full metadata for relevant items, and select canonical lineage before any mutation."},{name:"claim-and-start",description:"Claim one canonical item and begin implementation with linked context.",arguments:[{name:"id",description:"Canonical pm item id.",required:true}],template:"Read {{id}} in full, claim it, set it in_progress, then implement only its acceptance scope while linking files, docs, tests, and evidence."},{name:"record-evidence-and-close",description:"Record exact verification evidence, close the item, and release ownership.",arguments:[{name:"id",description:"Canonical pm item id.",required:true},{name:"evidence",description:"Exact verification and outcome evidence.",required:true}],template:"For {{id}}, record this evidence: {{evidence}}. Verify linked tests, close only if acceptance is met, then release the claim."}]);function renderPmCommandVisibilityMarkdown(){return renderPmCommandVisibilityMarkdownFromContracts(PM_COMMAND_CAPABILITY_CONTRACTS)}function renderPmCommandVisibilityMarkdownFromContracts(contracts){const rows=contracts.map(({command,tier,family})=>`| \`${command}\` | ${tier} | ${family} |`);return["# Generated agent command surface","","This file is generated from `PM_COMMAND_CAPABILITY_CONTRACTS`. Do not edit it manually.","","| Command | Minimum visibility tier | Capability family |","| --- | --- | --- |",...rows,""].join("\n")}function renderPmCapabilityRoutingMarkdown(contracts=PM_COMMAND_CAPABILITY_CONTRACTS){const rows=listPmCommandCapabilityGroups(contracts).map(({family,commands})=>`| ${family} | ${commands.map(command=>`\`${command}\``).join(", ")} |`);return["# Generated agent capability routing","","Tracker: `pm-kxci8x`.","","This file is generated from `PM_COMMAND_CAPABILITY_CONTRACTS`. Do not edit it manually.","","| Capability family | Commands |","| --- | --- |",...rows,""].join("\n")}export{PM_COMMAND_CAPABILITY_CONTRACTS,PM_COMMAND_VISIBILITY_CONTRACTS,PM_CORE_HELP_BUDGET,PM_CORE_HELP_OPTION_FLAGS,PM_MCP_PROMPT_CONTRACTS,PM_MCP_RESOURCE_CONTRACTS,PM_MCP_TOOL_COMMAND_CONTRACTS,listPmCommandCapabilityGroups,listPmCommandsForFamily,listPmCommandsForFamilyFromContracts,listPmCommandsForTier,listPmCommandsForTierFromContracts,listPmMcpToolsForProfile,listPmMcpToolsForProfileFromContracts,measurePmCoreHelp,renderPmCapabilityRoutingMarkdown,renderPmCommandVisibilityMarkdown,renderPmCommandVisibilityMarkdownFromContracts,resolvePmCommandCapabilityFamily,resolvePmCommandVisibilityTier};
2
2
  //# sourceMappingURL=agent-capability-contracts.js.map
@@ -1,2 +1,2 @@
1
- !(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c7018240-2680-597f-9e71-e4b3f46ef91d")}catch(e2){}})();const PM_HISTORY_COMMAND_ALIASES=[["history-redact","history redact"],["history-repair","history repair"],["history-compact","history compact"],["activity","history activity"],["restore","history restore"]].map(([alias,canonical])=>({alias,canonical,canonical_argv:canonical.split(" "),lifecycle:"permanent",hidden:true,registration:"commander",owner:"pm-tqel"}));const PM_CONTEXT_OPS_COMMAND_ALIASES=[...["next","focus"].map(alias=>({alias,canonical:`context ${alias}`,owner:"pm-kcs4"})),...["stats","health","validate","gc","telemetry","eval","test-all"].map(alias=>({alias,canonical:`ops ${alias}`,owner:"pm-6apl"})),...["normalize","reindex"].map(alias=>({alias,canonical:`ops ${alias}`,owner:"pm-3i9q8g"})),{alias:"events",canonical:"history events",owner:"pm-3i9q8g"}].map(entry=>({...entry,canonical_argv:entry.canonical.split(" "),lifecycle:"permanent",hidden:true,registration:"bootstrap"}));const PM_BULK_LIFECYCLE_COMMAND_ALIASES=[["update-many","update many"],["close-many","close many"],["delete","close delete"]].map(([alias,canonical])=>({alias,canonical,canonical_argv:canonical.split(" "),lifecycle:"permanent",hidden:true,registration:"bootstrap",owner:"pm-ik19"}));const PM_RELOCATED_COMMAND_ALIASES=[...PM_CONTEXT_OPS_COMMAND_ALIASES,...PM_BULK_LIFECYCLE_COMMAND_ALIASES,...[...["comments","notes","learnings","files","docs","deps","append","test"].map(facet=>[facet,`item ${facet}`,"pm-yql1"]),["test-runs-worker","item test worker","pm-lp4j"],...["statuses","tags","types"].map(facet=>[`completion-${facet}`,`completion ${facet}`,"pm-szdc"]),["history-author-acknowledge","history acknowledge","pm-djyvbk"],["copy","item copy","pm-m6g87m"],["merge","workspace merge","pm-m6g87m"],["duplicates","item duplicates","pm-fmy9ih"],["dedupe-audit","item duplicates audit","pm-fmy9ih"],["dedupe-merge","item duplicates merge","pm-fmy9ih"],["comments-audit","item audit-comments","pm-fmy9ih"],["search-advanced","search advanced","pm-wfskfn"],...["meet","event","remind"].map(command=>[command,`calendar ${command}`,"pm-o3fh"])].map(([alias,canonical,owner])=>({alias,canonical,canonical_argv:canonical.split(" "),lifecycle:"permanent",hidden:true,registration:"bootstrap",owner}))];const PM_NAMESPACED_COMMAND_ALIASES=[{alias:"history-attest",canonical:"history attest",canonical_argv:["history","attest"],lifecycle:"permanent",hidden:true,registration:"commander",owner:"pm-3z0k"},...PM_HISTORY_COMMAND_ALIASES,...PM_RELOCATED_COMMAND_ALIASES,...["discover","lookup"].map(action=>({alias:`files ${action}`,canonical:`item files ${action}`,canonical_argv:["item","files",action],lifecycle:"permanent",hidden:true,registration:"bootstrap",owner:"pm-yql1"}))];function findPmNamespacedCommand(tokens){let matched;for(const alias of PM_NAMESPACED_COMMAND_ALIASES){if(alias.canonical_argv.length<=(matched?.canonical_argv.length??0))continue;if(alias.canonical_argv.every((token,index)=>token===(index===0&&tokens[index]==="ctx"?"context":tokens[index])))matched=alias}return matched}function resolvePmCommandOperation(command){const normalized=command.trim().replace(/\s+/gu," ");return PM_NAMESPACED_COMMAND_ALIASES.find(alias=>alias.canonical===normalized.replace(/^ctx /u,"context "))?.alias??normalized}function resolvePmHistoryOperation(command){return resolvePmCommandOperation(command)}const PM_COMMAND_ALIAS_CONTRACTS=[...PM_NAMESPACED_COMMAND_ALIASES,...[["ctx","context"],["packages","package"]].map(([alias,canonical])=>({alias,canonical,canonical_argv:[canonical],lifecycle:"permanent",hidden:false,registration:"commander",owner:"pm-pbyu"})),...[["start-task","claim","--start"],["pause-task","release","--pause"],["close-task","close","--release-assignment"]].map(([alias,canonical,flag])=>({alias,canonical,canonical_argv:[canonical,flag],lifecycle:"deprecated",hidden:true,registration:"commander",owner:"pm-eq4x"})),{alias:"tests",canonical:"item test",canonical_argv:["item","test"],lifecycle:"permanent",hidden:false,registration:"bootstrap",owner:"pm-u4t9gp"},...[["fetch","get"],["read","get"],["show","get"],["view","get"],["comment","comments"],["note","notes"],["learning","learnings"]].map(([alias,canonical])=>({alias,canonical:["comments","notes","learnings"].includes(canonical)?`item ${canonical}`:canonical,canonical_argv:["comments","notes","learnings"].includes(canonical)?["item",canonical]:[canonical],lifecycle:"permanent",hidden:false,registration:"bootstrap",owner:"pm-pbyu"})),...[["extension list","extension catalog"],["extension scaffold","extension init"],["package list","package catalog"],["package scaffold","package init"],["packages list","packages catalog"],["packages scaffold","packages init"]].map(([alias,canonical])=>({alias,canonical,canonical_argv:canonical.split(" "),lifecycle:"permanent",hidden:false,registration:"commander",owner:"pm-ya7x55"})),{alias:"list-all",canonical:"list",canonical_argv:["list","--all"],lifecycle:"deprecated",hidden:true,registration:"commander",owner:"pm-pfqi"},...[["list-draft","draft"],["list-open","open"],["list-in-progress","in_progress"],["list-blocked","blocked"],["list-closed","closed"],["list-canceled","canceled"]].map(([alias,status])=>({alias,canonical:"list",canonical_argv:["list","--status",status],lifecycle:"deprecated",hidden:true,registration:"commander",owner:"pm-pfqi"})),...[["extension","package"],["install","package install"],["upgrade","package upgrade"]].map(([alias,canonical])=>({alias,canonical,canonical_argv:canonical.split(" "),lifecycle:"deprecated",hidden:true,registration:"commander",owner:"pm-tnud"}))];const EXECUTABLE_COMMAND_ALIASES=Object.fromEntries(PM_COMMAND_ALIAS_CONTRACTS.filter(contract=>contract.registration==="bootstrap").map(contract=>[contract.alias,contract.canonical]));function resolvePmCommandAlias(alias){const normalized=alias.trim().toLowerCase();return PM_COMMAND_ALIAS_CONTRACTS.find(contract=>contract.alias===normalized)}function renderPmCommandAliasMigrationHint(contract){return`Deprecated command \`${contract.alias}\`; use \`pm ${contract.canonical_argv.join(" ")}\`.`}export{EXECUTABLE_COMMAND_ALIASES,PM_BULK_LIFECYCLE_COMMAND_ALIASES,PM_COMMAND_ALIAS_CONTRACTS,PM_CONTEXT_OPS_COMMAND_ALIASES,PM_HISTORY_COMMAND_ALIASES,PM_NAMESPACED_COMMAND_ALIASES,PM_RELOCATED_COMMAND_ALIASES,findPmNamespacedCommand,renderPmCommandAliasMigrationHint,resolvePmCommandAlias,resolvePmCommandOperation,resolvePmHistoryOperation};
1
+ !(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c42420db-459b-5ce7-a9b5-e6d44873253a")}catch(e2){}})();const PM_HISTORY_COMMAND_ALIASES=[["history-redact","history redact"],["history-repair","history repair"],["history-compact","history compact"],["activity","history activity"],["restore","history restore"]].map(([alias,canonical])=>({alias,canonical,canonical_argv:canonical.split(" "),lifecycle:"permanent",hidden:true,registration:"commander",owner:"pm-tqel"}));const PM_CONTEXT_OPS_COMMAND_ALIASES=[...["next","focus"].map(alias=>({alias,canonical:`context ${alias}`,owner:"pm-kcs4"})),...["stats","health","validate","gc","telemetry","eval","test-all"].map(alias=>({alias,canonical:`ops ${alias}`,owner:"pm-6apl"})),...["normalize","reindex"].map(alias=>({alias,canonical:`ops ${alias}`,owner:"pm-3i9q8g"})),{alias:"events",canonical:"history events",owner:"pm-3i9q8g"}].map(entry=>({...entry,canonical_argv:entry.canonical.split(" "),lifecycle:"permanent",hidden:true,registration:"bootstrap"}));const PM_BULK_LIFECYCLE_COMMAND_ALIASES=[["update-many","update many"],["close-many","close many"],["delete","close delete"]].map(([alias,canonical])=>({alias,canonical,canonical_argv:canonical.split(" "),lifecycle:"permanent",hidden:true,registration:"bootstrap",owner:"pm-ik19"}));const PM_RELOCATED_COMMAND_ALIASES=[...PM_CONTEXT_OPS_COMMAND_ALIASES,...PM_BULK_LIFECYCLE_COMMAND_ALIASES,...["init","config","schema","profile"].map(alias=>({alias,canonical:`workspace ${alias}`,canonical_argv:["workspace",alias],lifecycle:"permanent",hidden:true,registration:"bootstrap",owner:"pm-npr3"})),...[...["comments","notes","learnings","files","docs","deps","append","test"].map(facet=>[facet,`item ${facet}`,"pm-yql1"]),["test-runs-worker","item test worker","pm-lp4j"],...["statuses","tags","types"].map(facet=>[`completion-${facet}`,`completion ${facet}`,"pm-szdc"]),["history-author-acknowledge","history acknowledge","pm-djyvbk"],["copy","item copy","pm-m6g87m"],["merge","workspace merge","pm-m6g87m"],["duplicates","item duplicates","pm-fmy9ih"],["dedupe-audit","item duplicates audit","pm-fmy9ih"],["dedupe-merge","item duplicates merge","pm-fmy9ih"],["comments-audit","item audit-comments","pm-fmy9ih"],["search-advanced","search advanced","pm-wfskfn"],...["meet","event","remind"].map(command=>[command,`calendar ${command}`,"pm-o3fh"])].map(([alias,canonical,owner])=>({alias,canonical,canonical_argv:canonical.split(" "),lifecycle:"permanent",hidden:true,registration:"bootstrap",owner}))];const PM_NAMESPACED_COMMAND_ALIASES=[{alias:"history-attest",canonical:"history attest",canonical_argv:["history","attest"],lifecycle:"permanent",hidden:true,registration:"commander",owner:"pm-3z0k"},...PM_HISTORY_COMMAND_ALIASES,...PM_RELOCATED_COMMAND_ALIASES,...["discover","lookup"].map(action=>({alias:`files ${action}`,canonical:`item files ${action}`,canonical_argv:["item","files",action],lifecycle:"permanent",hidden:true,registration:"bootstrap",owner:"pm-yql1"}))];function findPmNamespacedCommand(tokens){let matched;for(const alias of PM_NAMESPACED_COMMAND_ALIASES){if(alias.canonical_argv.length<=(matched?.canonical_argv.length??0))continue;if(alias.canonical_argv.every((token,index)=>token===(index===0&&tokens[index]==="ctx"?"context":tokens[index])))matched=alias}return matched}function resolvePmCommandOperation(command){const normalized=command.trim().replace(/\s+/gu," ");return PM_NAMESPACED_COMMAND_ALIASES.find(alias=>alias.canonical===normalized.replace(/^ctx /u,"context "))?.alias??normalized}function resolvePmHistoryOperation(command){return resolvePmCommandOperation(command)}const PM_COMMAND_ALIAS_CONTRACTS=[...PM_NAMESPACED_COMMAND_ALIASES,...[["ctx","context"],["packages","package"]].map(([alias,canonical])=>({alias,canonical,canonical_argv:[canonical],lifecycle:"permanent",hidden:false,registration:"commander",owner:"pm-pbyu"})),...[["start-task","claim","--start"],["pause-task","release","--pause"],["close-task","close","--release-assignment"]].map(([alias,canonical,flag])=>({alias,canonical,canonical_argv:[canonical,flag],lifecycle:"deprecated",hidden:true,registration:"commander",owner:"pm-eq4x"})),{alias:"tests",canonical:"item test",canonical_argv:["item","test"],lifecycle:"permanent",hidden:false,registration:"bootstrap",owner:"pm-u4t9gp"},...[["fetch","get"],["read","get"],["show","get"],["view","get"],["comment","comments"],["note","notes"],["learning","learnings"]].map(([alias,canonical])=>({alias,canonical:["comments","notes","learnings"].includes(canonical)?`item ${canonical}`:canonical,canonical_argv:["comments","notes","learnings"].includes(canonical)?["item",canonical]:[canonical],lifecycle:"permanent",hidden:false,registration:"bootstrap",owner:"pm-pbyu"})),...[["extension list","extension catalog"],["extension scaffold","extension init"],["package list","package catalog"],["package scaffold","package init"],["packages list","packages catalog"],["packages scaffold","packages init"]].map(([alias,canonical])=>({alias,canonical,canonical_argv:canonical.split(" "),lifecycle:"permanent",hidden:false,registration:"commander",owner:"pm-ya7x55"})),{alias:"list-all",canonical:"list",canonical_argv:["list","--all"],lifecycle:"deprecated",hidden:true,registration:"commander",owner:"pm-pfqi"},...[["list-draft","draft"],["list-open","open"],["list-in-progress","in_progress"],["list-blocked","blocked"],["list-closed","closed"],["list-canceled","canceled"]].map(([alias,status])=>({alias,canonical:"list",canonical_argv:["list","--status",status],lifecycle:"deprecated",hidden:true,registration:"commander",owner:"pm-pfqi"})),...[["extension","package"],["install","package install"],["upgrade","package upgrade"]].map(([alias,canonical])=>({alias,canonical,canonical_argv:canonical.split(" "),lifecycle:"deprecated",hidden:true,registration:"commander",owner:"pm-tnud"}))];const EXECUTABLE_COMMAND_ALIASES=Object.fromEntries(PM_COMMAND_ALIAS_CONTRACTS.filter(contract=>contract.registration==="bootstrap").map(contract=>[contract.alias,contract.canonical]));function resolvePmCommandAlias(alias){const normalized=alias.trim().toLowerCase();return PM_COMMAND_ALIAS_CONTRACTS.find(contract=>contract.alias===normalized)}function renderPmCommandAliasMigrationHint(contract){return`Deprecated command \`${contract.alias}\`; use \`pm ${contract.canonical_argv.join(" ")}\`.`}export{EXECUTABLE_COMMAND_ALIASES,PM_BULK_LIFECYCLE_COMMAND_ALIASES,PM_COMMAND_ALIAS_CONTRACTS,PM_CONTEXT_OPS_COMMAND_ALIASES,PM_HISTORY_COMMAND_ALIASES,PM_NAMESPACED_COMMAND_ALIASES,PM_RELOCATED_COMMAND_ALIASES,findPmNamespacedCommand,renderPmCommandAliasMigrationHint,resolvePmCommandAlias,resolvePmCommandOperation,resolvePmHistoryOperation};
2
2
  //# sourceMappingURL=command-aliases.js.map
@@ -1,2 +1,2 @@
1
- !(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="733ce7b1-de7b-53b9-83bb-deefd930d8ec")}catch(e2){}})();import{resolvePmCommandAlias,PM_HISTORY_COMMAND_ALIASES,PM_RELOCATED_COMMAND_ALIASES,resolvePmHistoryOperation}from"./command-aliases.js";const PM_CLI_GRAMMAR_NOUNS=["item","list","context","search","graph","history","workspace","package","ops","plan","contracts","help"];const PM_CLI_SHARED_VERBS=["acknowledge","activate","add","adopt","adopt-all","catalog","compact","complete","create","deactivate","delete","describe","doctor","edit","explore","import","init","inspect","install","list","manage","migrate","mutate","read","redact","reload","remove","reopen","repair","restore","run","show","uninstall","upgrade","verify"];function positionalSlot(name,valueKind,required,options={}){return{name,required,variadic:options.variadic===true,value_kind:valueKind,polymorphic:options.polymorphic===true}}function positionalActionVerb(action){const phrase=action.replaceAll("-"," ");return`${phrase.charAt(0).toUpperCase()}${phrase.slice(1)}`}const ITEM_ID=positionalSlot("id","item_id",true);const OPTIONAL_ITEM_ID=positionalSlot("id","item_id",false);const OPTIONAL_TEXT=positionalSlot("text","string",false);const PLAN_ITEM_ID=positionalSlot("plan-id","item_id",true);const PLAN_STEP=positionalSlot("step","string",true);const PLAN_CREATE_FLAGS=["--acceptance-criteria","--actual-result","--affected-version","--assignee","--blocked-by","--blocked-reason","--blocks","--body","--claim","--comment","--component","--confidence","--create-mode","--customer-impact","--deadline","--definition-of-ready","--description","--doc","--environment","--estimate","--event","--expected-result","--fixed-version","--file","--from-search","--goal","--harness","--impact","--learning","--message","--mode","--note","--objective","--order","--outcome","--parent","--priority","--rank","--related","--release","--reminder","--reporter","--repro-steps","--resolution","--resume-context","--reviewer","--risk","--scope","--severity","--sprint","--status","--step","--step-blocked-reason","--step-body","--step-evidence","--step-owner","--step-replacement","--step-status","--step-title","--tags","--template","--test","--title","--type-option","--unblock-note","--value","--why-now"];const PLAN_STEP_FLAGS=["--allow-multiple-active","--depends-on","--file","--force","--message","--step-blocked-reason","--step-body","--step-evidence","--step-owner","--step-status","--step-title","--test"];const PLAN_STEP_ACTION_DESCRIPTIONS={"update-step":"Update one declared Plan step.","complete-step":"Complete one declared Plan step.","block-step":"Block one declared Plan step.","remove-step":"Remove one declared Plan step.",link:"Link one dependency to a declared Plan step.",unlink:"Unlink one dependency from a declared Plan step."};const PM_POSITIONAL_ACTION_CONTRACTS=[{command:"plan create",parent:"plan",action:"create",slots:[positionalSlot("title","string",false,{polymorphic:true})],accepted_flags:PLAN_CREATE_FLAGS,description:"Create a Plan item and optionally seed its ordered steps.",example:'pm plan create --title "Refactor lock retry"'},{command:"plan show",parent:"plan",action:"show",slots:[PLAN_ITEM_ID],accepted_flags:["--depth","--fields"],description:"Read one Plan item with a bounded plan projection.",example:"pm plan show pm-a1b2 --depth standard"},{command:"plan add-step",parent:"plan",action:"add-step",slots:[PLAN_ITEM_ID],accepted_flags:PLAN_STEP_FLAGS,description:"Append one ordered step to a Plan item.",example:'pm plan add-step pm-a1b2 --step-title "Run tests"'},...Object.entries(PLAN_STEP_ACTION_DESCRIPTIONS).map(([action,description])=>({command:`plan ${action}`,parent:"plan",action,slots:[PLAN_ITEM_ID,PLAN_STEP],accepted_flags:PLAN_STEP_FLAGS,description,example:`pm plan ${action} pm-a1b2 plan-step-001`})),{command:"plan reorder-step",parent:"plan",action:"reorder-step",slots:[PLAN_ITEM_ID,PLAN_STEP,positionalSlot("new-order","integer",true)],accepted_flags:["--force","--message"],description:"Move one Plan step to a declared integer order.",example:"pm plan reorder-step pm-a1b2 plan-step-001 2"},...["decision","discovery","validation","resume","approve","materialize"].map(action=>({command:`plan ${action}`,parent:"plan",action,slots:[PLAN_ITEM_ID],accepted_flags:PLAN_STEP_FLAGS,description:`${positionalActionVerb(action)} for one Plan item.`,example:`pm plan ${action} pm-a1b2`})),...["list","show","put","remove"].map(action=>({command:`assurance ${action}`,parent:"assurance",action,slots:[positionalSlot("kind","string",true),...action==="list"?[]:[positionalSlot("id","string",true)]],accepted_flags:action==="put"?["--author","--definition","--message"]:action==="remove"?["--author","--message"]:[],description:`${positionalActionVerb(action)} assurance declarations by kind.`,example:action==="list"?"pm assurance list measurement":`pm assurance ${action} measurement example-id`})),{command:"assurance run",parent:"assurance",action:"run",slots:[positionalSlot("gate-id","string",true)],accepted_flags:["--dry-run","--trigger","--tree"],description:"Evaluate one assurance gate for a lifecycle trigger.",example:"pm assurance run tracker-context-quality --trigger ci --dry-run"},{command:"assurance verdicts",parent:"assurance",action:"verdicts",slots:[positionalSlot("gate-id","string",false)],accepted_flags:["--gate","--limit"],description:"List bounded assurance verdict history.",example:"pm assurance verdicts --limit 20"},...["presets","apply"].map(action=>({command:`assurance ${action}`,parent:"assurance",action,slots:[positionalSlot("preset","string",action==="apply")],accepted_flags:["--author","--message","--owner"],description:action==="apply"?"Apply one assurance adoption preset.":"List available assurance adoption presets.",example:action==="apply"?"pm assurance apply software-delivery --owner <pm-item-id>":"pm assurance presets"})),{command:"assurance derive",parent:"assurance",action:"derive",slots:[],accepted_flags:["--apply","--author","--message","--owner"],description:"Derive assurance proposals from current project context.",example:"pm assurance derive --owner pm-a1b2"},{command:"assurance promote",parent:"assurance",action:"promote",slots:[positionalSlot("assertion-id","string",true)],accepted_flags:["--author","--enforcement","--message"],description:"Promote one assertion into a warning or blocking gate.",example:"pm assurance promote assertion-id --enforcement warn"},{command:"assurance risk",parent:"assurance",action:"risk",slots:[],accepted_flags:["--definition"],description:"Analyze bounded defect-recurrence risk for a proposed change.",example:`pm assurance risk --definition '{"change":{"files":[]}}'`},{command:"assurance lineages",parent:"assurance",action:"lineages",slots:[],accepted_flags:["--definition"],description:"Measure all recorded recurrence lineages with bounded evidence rows.",example:`pm assurance lineages --definition '{"policy":{"version":1,"evidence_epoch":"2026-01-01T00:00:00.000Z","families":[]}}'`},{command:"workspace position",parent:"workspace",action:"position",slots:[],accepted_flags:[],description:"Read bounded merge-fence, receipt, history-drift, and next-action readiness.",example:"pm workspace position"},{command:"workspace snapshot create",parent:"workspace snapshot",action:"create",slots:[positionalSlot("name","string",false)],accepted_flags:[],description:"Capture authoritative tracker state as an immutable snapshot.",example:"pm workspace snapshot create before-migration"},{command:"workspace snapshot list",parent:"workspace snapshot",action:"list",slots:[],accepted_flags:[],description:"List immutable workspace snapshots and named references.",example:"pm workspace snapshot list"},{command:"workspace snapshot inspect",parent:"workspace snapshot",action:"inspect",slots:[positionalSlot("target","string",true)],accepted_flags:[],description:"Inspect one workspace snapshot target.",example:"pm workspace snapshot inspect before-migration"},{command:"workspace snapshot restore",parent:"workspace snapshot",action:"restore",slots:[positionalSlot("target","string",true)],accepted_flags:["--author","--dry-run","--force","--message"],description:"Restore an immutable workspace snapshot with explicit recovery controls.",example:"pm workspace snapshot restore before-migration --dry-run"},{command:"workspace snapshot delete",parent:"workspace snapshot",action:"delete",slots:[positionalSlot("target","string",true)],accepted_flags:[],description:"Delete one workspace snapshot target.",example:"pm workspace snapshot delete before-migration"}];const POSITIONAL_ACTION_CONTRACTS_BY_SPECIFICITY=[...PM_POSITIONAL_ACTION_CONTRACTS].sort((left,right)=>right.command.length-left.command.length);const EXPLICIT_POSITIONAL_SLOTS=new Map([["append",[ITEM_ID,OPTIONAL_TEXT]],["assurance",[positionalSlot("action","action",true),positionalSlot("kind","string",false),positionalSlot("id","string",false)]],["beads import",[positionalSlot("file","string",false)]],["changelog export",[positionalSlot("file","string",false)]],["claim",[OPTIONAL_ITEM_ID]],["close",[ITEM_ID,OPTIONAL_TEXT]],["close-task",[ITEM_ID,positionalSlot("reason","string",false)]],["comments",[ITEM_ID,OPTIONAL_TEXT]],["completion",[positionalSlot("shell","string",false)]],["config",[positionalSlot("scope","string",false,{polymorphic:true}),positionalSlot("action","action",false),positionalSlot("key","string",false),positionalSlot("value","string",false,{polymorphic:true})]],["copy",[ITEM_ID]],["create",[positionalSlot("type-or-title","string",false,{polymorphic:true}),positionalSlot("title","string",false)]],["delete",[ITEM_ID]],["deps",[ITEM_ID]],["docs",[ITEM_ID]],["event",[positionalSlot("title","string",true)]],["files",[ITEM_ID]],["files discover",[ITEM_ID]],["files lookup",[positionalSlot("paths","string",true,{variadic:true})]],["focus",[OPTIONAL_ITEM_ID]],["get",[ITEM_ID]],["graph",[positionalSlot("subcommand","action",true),OPTIONAL_ITEM_ID,positionalSlot("target","item_id",false)]],["guide",[positionalSlot("topic","string",false)]],["history",[ITEM_ID]],["history-compact",[OPTIONAL_ITEM_ID]],["history-redact",[ITEM_ID]],["history-repair",[OPTIONAL_ITEM_ID]],["init",[positionalSlot("prefix-or-path","string",false,{polymorphic:true})]],["item complete",[ITEM_ID,positionalSlot("reason","string",false)]],["item reopen",[ITEM_ID,positionalSlot("reason","string",true)]],["learnings",[ITEM_ID,OPTIONAL_TEXT]],["meet",[positionalSlot("title","string",true)]],["merge",[positionalSlot("subcommand","action",true),positionalSlot("artifact","string",false),positionalSlot("base","string",false),positionalSlot("ours","string",false),positionalSlot("theirs","string",false)]],["notes",[ITEM_ID,OPTIONAL_TEXT]],["package",[positionalSlot("target","string",false,{polymorphic:true})]],["package list",[]],["package scaffold",[positionalSlot("target","string",true)]],["package upgrade",[positionalSlot("target","string",false)]],["packages",[positionalSlot("target","string",false,{polymorphic:true})]],["packages list",[]],["packages scaffold",[positionalSlot("target","string",true)]],["packages upgrade",[positionalSlot("target","string",false)]],["pause-task",[ITEM_ID]],["plan",[positionalSlot("subcommand","action",true),positionalSlot("id","item_id",false,{polymorphic:true}),positionalSlot("step","string",false),positionalSlot("new-order","integer",false)]],["profile",[positionalSlot("subcommand","action",true),positionalSlot("name","string",false)]],["release",[ITEM_ID]],["remind",[positionalSlot("title","string",true)]],["restore",[ITEM_ID,positionalSlot("target","string",true)]],["schema",[positionalSlot("subcommand","action",true),positionalSlot("name","string",false)]],["search-advanced",[positionalSlot("keywords","string",true,{variadic:true})]],["search",[positionalSlot("keywords","string",true,{variadic:true})]],["start-task",[ITEM_ID]],["telemetry",[positionalSlot("namespace-or-subcommand","action",false,{polymorphic:true}),positionalSlot("subcommand","action",false)]],["test",[ITEM_ID]],["test-runs-worker",[positionalSlot("runId","string",true)]],["update",[ITEM_ID]],["workspace snapshot",[positionalSlot("action","action",true),positionalSlot("target","string",false)]],...["activate","adopt","deactivate","init","uninstall"].flatMap(action=>["extension","package","packages"].map(root=>[`${root} ${action}`,[positionalSlot("target","string",true)]])),...["describe"].flatMap(action=>["extension","package","packages"].map(root=>[`${root} ${action}`,[positionalSlot("target","string",false)]])),...["install"].flatMap(action=>["extension","package","packages"].map(root=>[`${root} ${action}`,[positionalSlot("targets","string",false,{variadic:true})]])),["vcs abandon",[ITEM_ID]],["vcs create",[positionalSlot("title","string",true)]],["vcs merge",[ITEM_ID]],["vcs propose",[ITEM_ID]],["vcs ref-create",[positionalSlot("name","string",true)]],["vcs show",[ITEM_ID]]]);function normalizePositionalCommandPath(command){return command.trim().toLowerCase().replace(/\s+/gu," ")}function resolvePmCommandPositionalContract(command){const normalized=normalizePositionalCommandPath(command);const direct=PM_COMMAND_POSITIONAL_CONTRACTS.find(contract=>contract.command===normalized);if(direct)return direct;const canonical=resolvePmCommandAlias(normalized)?.canonical;if(!canonical)return void 0;return PM_COMMAND_POSITIONAL_CONTRACTS.find(contract=>contract.command===canonical)}function resolvePmPositionalActionContract(command){const normalized=normalizePositionalCommandPath(command);return POSITIONAL_ACTION_CONTRACTS_BY_SPECIFICITY.find(contract=>contract.command===normalized||normalized.startsWith(`${contract.command} `))}function formatPmPositionalActionFlagTip(acceptedFlags){return`Applicable flags: ${acceptedFlags.length>0?acceptedFlags.join(", "):"none"}.`}function destinationRows(noun,target,disposition,owner,commands){return commands.map(command=>({command,noun,target,disposition,owner}))}const PM_COMMAND_DESTINATION_CONTRACTS=[...destinationRows("item","item","target_noun","pm-pbyu",["item","item complete","item mutate","item reopen"]),...destinationRows("item","item","consolidation","pm-yql1",["append","close-many","close-task","comments","copy","delete","deps","docs","files","learnings","notes","pause-task","start-task","test","update-many"]),...["claim","close","create","get","release","update"].map(command=>({command,noun:"item",target:command,disposition:"keep_as_is",owner:"pm-pbyu",reason:"Permanent high-frequency item operations retain concise root spellings under the accepted hot-path grammar policy."})),...destinationRows("item","item files","target_noun","pm-yql1",["files discover","files lookup","item files discover","item files lookup"]),...destinationRows("item","item test worker","consolidation","pm-lp4j",["test-runs-worker"]),...destinationRows("list","list","target_noun","pm-pfqi",["list"]),...destinationRows("list","list --group-by","consolidation","pm-xkgq",["aggregate"]),...destinationRows("context","context","target_noun","pm-pbyu",["context"]),...destinationRows("context","context","consolidation","pm-kcs4",["ctx","focus","next"]),...destinationRows("context","context next","consolidation","pm-kcs4",["ctx next"]),...destinationRows("context","context focus","consolidation","pm-kcs4",["ctx focus"]),...destinationRows("search","search","target_noun","pm-pbyu",["search"]),...destinationRows("search","search","package_owned","package:search-advanced",["reindex","search-advanced"]),...destinationRows("item","item duplicates","consolidation","pm-fmy9ih",["duplicates"]),...destinationRows("item","item duplicates","package_owned","pm-fmy9ih",["dedupe-audit","dedupe-merge","comments-audit"]),...destinationRows("graph","graph","target_noun","pm-pbyu",["graph"]),...destinationRows("history","history","target_noun","pm-pbyu",["history"]),...destinationRows("history","history attest","target_noun","pm-3z0k",["history attest"]),...destinationRows("history","history attest","consolidation","pm-3z0k",["history-attest"]),...PM_HISTORY_COMMAND_ALIASES.flatMap(({alias,canonical})=>[...destinationRows("history",canonical,"target_noun","pm-tqel",[canonical]),...destinationRows("history",canonical,"consolidation","pm-tqel",[alias])]),...destinationRows("history","history","consolidation","pm-tqel",["events","merge"]),...destinationRows("history","history acknowledge","consolidation","pm-djyvbk",["history-author-acknowledge"]),...destinationRows("history","history","package_owned","package:builtin-vcs-exemplar",["vcs abandon","vcs create","vcs log","vcs merge","vcs propose","vcs ref-create","vcs show"]),...destinationRows("workspace","workspace","target_noun","pm-pbyu",["workspace","workspace position","workspace snapshot","workspace snapshot create","workspace snapshot delete","workspace snapshot inspect","workspace snapshot list","workspace snapshot restore"]),...destinationRows("workspace","workspace init","consolidation","pm-npr3",["init"]),...destinationRows("package","package","target_noun","pm-pbyu",["package","package activate","package adopt","package adopt-all","package catalog","package deactivate","package describe","package doctor","package explore","package init","package install","package list","package manage","package migrate","package reload","package scaffold","package uninstall","package upgrade"]),...destinationRows("package","package","consolidation","pm-tnud",["extension activate","extension adopt","extension adopt-all","extension catalog","extension deactivate","extension describe","extension doctor","extension explore","extension init","extension install","extension manage","extension migrate","extension reload","extension uninstall","packages","packages activate","packages adopt","packages adopt-all","packages catalog","packages deactivate","packages describe","packages doctor","packages explore","packages init","packages install","packages list","packages manage","packages migrate","packages reload","packages scaffold","packages uninstall","packages upgrade"]),...destinationRows("package","package","package_owned","package:beads",["beads import"]),...destinationRows("package","package","package_owned","package:pm-changelog",["changelog export","changelog generate"]),...destinationRows("package","package calendar","package_owned","pm-o3fh",["event","meet","remind"]),...destinationRows("ops","ops","target_noun","pm-6apl",["ops"]),...destinationRows("ops","ops normalize","package_owned","package:pm-governance-audit",["normalize"]),...destinationRows("ops","ops","consolidation","pm-6apl",["eval","gc","health","stats","telemetry","test-all","validate"]),...destinationRows("ops","ops","consolidation","pm-npr3",["config","profile","schema"]),...["assurance",...PM_POSITIONAL_ACTION_CONTRACTS.filter(({parent})=>parent==="assurance").map(({command})=>command)].map(command=>({command,noun:"ops",target:command,disposition:"keep_as_is",owner:"pm-djyvbk",reason:"Assurance manages durable measurement, assertion, gate, and verdict data; retain its established domain surface independently of operational diagnostics."})),...destinationRows("plan","plan","target_noun","pm-pbyu",["plan"]),...destinationRows("plan","plan","target_noun","pm-2tan",PM_POSITIONAL_ACTION_CONTRACTS.filter(({parent})=>parent==="plan").map(({command})=>command)),...destinationRows("contracts","contracts","target_noun","pm-pbyu",["contracts"]),...destinationRows("help","help","target_noun","pm-pbyu",["help"]),...destinationRows("help","help","package_owned","package:builtin-guide-shell",["completion","completion-statuses","completion-tags","completion-types","guide"])].flatMap(entry=>{const alias=PM_RELOCATED_COMMAND_ALIASES.find(candidate=>candidate.alias===entry.command);if(!alias)return[entry];const noun=PM_CLI_GRAMMAR_NOUNS.find(candidate=>candidate===alias.canonical_argv[0])??entry.noun;return[{...entry,noun,target:alias.canonical,owner:alias.owner},{...entry,command:alias.canonical,noun,target:alias.canonical,owner:alias.owner,disposition:entry.disposition==="package_owned"?"package_owned":"target_noun"}]});const PM_COMMAND_POSITIONAL_CONTRACTS=[...new Set(PM_COMMAND_DESTINATION_CONTRACTS.map(({command})=>command))].map(command=>({command,slots:resolvePmPositionalActionContract(command)?.slots??EXPLICIT_POSITIONAL_SLOTS.get(resolvePmHistoryOperation(command))??[]}));const PM_CLI_GRAMMAR_CONTRACT={nouns:PM_CLI_GRAMMAR_NOUNS,shared_verbs:PM_CLI_SHARED_VERBS,scope_before_verb:true,visible_top_level_ceiling:69,ceiling_raise_requires_pm_item:true,positional_shape_budget:21};function verifyExplicitPositionalSlotCensus(explicitCommands,destinationCommands){const destinations=new Set(destinationCommands);return[...new Set(explicitCommands)].filter(command=>!destinations.has(command)).map(command=>({code:"positional_signature_mismatch",command,detail:`Positional signature ${command} has no destination declaration.`}))}function positionalShapeKey(slots){return slots.map(({required,variadic,value_kind:valueKind,polymorphic})=>`${required?"r":"o"}:${variadic?"v":"s"}:${valueKind}:${polymorphic?"p":"m"}`).join("|")}function positionalSignatureKey(slots){return slots.map(({name,required,variadic,value_kind:valueKind,polymorphic})=>`${name}:${required?"r":"o"}:${variadic?"v":"s"}:${valueKind}:${polymorphic?"p":"m"}`).join("|")}function duplicatePositionalSignatureFindings(contracts,surface){const counts=new Map;for(const{command}of contracts){const normalized=normalizePositionalCommandPath(command);counts.set(normalized,(counts.get(normalized)??0)+1)}return[...counts.entries()].filter(([,count])=>count>1).map(([command,count])=>({code:"positional_signature_mismatch",command,detail:`${count} ${surface} positional signatures exist for ${command}; exactly one is required.`}))}function verifyPmCommandPositionalContracts(observed,options={}){const declared=options.declared??PM_COMMAND_POSITIONAL_CONTRACTS;const positionalShapeBudget=options.positionalShapeBudget??PM_CLI_GRAMMAR_CONTRACT.positional_shape_budget;const declaredByCommand=new Map(declared.map(contract=>[normalizePositionalCommandPath(contract.command),contract]));const observedByCommand=new Map(observed.map(contract=>[normalizePositionalCommandPath(contract.command),contract]));const findings=[...duplicatePositionalSignatureFindings(declared,"declared"),...duplicatePositionalSignatureFindings(observed,"observed"),...options.declared===void 0?[...verifyExplicitPositionalSlotCensus(EXPLICIT_POSITIONAL_SLOTS.keys(),PM_COMMAND_DESTINATION_CONTRACTS.map(({command})=>command)),...verifyExplicitPositionalSlotCensus(PM_POSITIONAL_ACTION_CONTRACTS.map(({command})=>command),PM_COMMAND_DESTINATION_CONTRACTS.map(({command})=>command))]:[]];for(const contract of declaredByCommand.values()){const normalizedCommand=normalizePositionalCommandPath(contract.command);const actual=observedByCommand.get(normalizedCommand);if(!actual){findings.push({code:"missing_observed_signature",command:contract.command,detail:`No observed positional signature exists for ${contract.command}.`})}else if(positionalSignatureKey(actual.slots)!==positionalSignatureKey(contract.slots)){findings.push({code:"positional_signature_mismatch",command:contract.command,detail:`Observed positional signature for ${contract.command} differs from its declared SDK contract: observed=${positionalSignatureKey(actual.slots)||"<none>"}; declared=${positionalSignatureKey(contract.slots)||"<none>"}.`})}}for(const contract of observedByCommand.values()){if(!declaredByCommand.has(normalizePositionalCommandPath(contract.command))){findings.push({code:"stale_observed_signature",command:contract.command,detail:`Observed positional signature ${contract.command} has no declaration.`})}}const positionalShapeCount=new Set(declared.map(({slots})=>positionalShapeKey(slots))).size;if(positionalShapeCount>positionalShapeBudget){findings.push({code:"positional_shape_budget_exceeded",command:"*",detail:`Distinct positional shape count ${positionalShapeCount} exceeds budget ${positionalShapeBudget}.`})}findings.sort((left,right)=>left.command!==right.command?left.command.localeCompare(right.command):left.code.localeCompare(right.code));return{ok:findings.length===0,declared_command_count:declared.length,observed_command_count:observed.length,positional_shape_count:positionalShapeCount,positional_shape_budget:positionalShapeBudget,findings}}function validateCommandDestinations(commands,destinationsByCommand,nounSet){return commands.flatMap(command=>{const destinations=destinationsByCommand.get(command)??[];if(destinations.length===0){const separatorIndex=command.indexOf(" ");const root=separatorIndex===-1?command:command.slice(0,separatorIndex);return[{code:"missing_destination",spelling:command,message:`Command \`${command}\` has no destination census row.`,nearest_target:nounSet.has(root)?root:`ops ${command}`}]}const duplicateFinding=destinations.length>1?[{code:"duplicate_destination",spelling:command,message:`Command \`${command}\` has ${destinations.length} destination rows.`,nearest_target:destinations[0].target}]:[];return destinations.reduce((findings,destination)=>{if(destination.disposition==="keep_as_is"&&(destination.reason?.trim().length??0)===0){findings.push({code:"missing_destination",spelling:command,message:`Command \`${command}\` is kept as-is without a documented reason.`,nearest_target:destination.target})}if(!nounSet.has(destination.noun)){findings.push({code:"unknown_noun",spelling:command,message:`Command \`${command}\` names undeclared noun \`${destination.noun}\`.`,nearest_target:destination.target})}return findings},duplicateFinding)})}function validateDestinationCensus(commandSet,destinations){return destinations.filter(destination=>destination.disposition!=="package_owned"&&!commandSet.has(destination.command)).map(destination=>({code:"stale_destination",spelling:destination.command,message:`Destination row \`${destination.command}\` is absent from live contracts.`,nearest_target:destination.target}))}function validateAliasTargets(aliases,commandSet){return aliases.filter(alias=>!commandSet.has(alias.canonical)).map(alias=>({code:"alias_target_missing",spelling:alias.alias,message:`Alias \`${alias.alias}\` targets missing canonical command \`${alias.canonical}\`.`,nearest_target:alias.canonical_argv.join(" ")}))}function verifyPmCliGrammar(commands,aliases=[],destinations=PM_COMMAND_DESTINATION_CONTRACTS){const normalizedCommands=[...new Set(commands.map(command=>command.trim()))].filter(command=>command.length>0).sort((left,right)=>left.localeCompare(right));const commandSet=new Set(normalizedCommands);const nounSet=new Set(PM_CLI_GRAMMAR_NOUNS);const destinationsByCommand=new Map;for(const destination of destinations){const entries=destinationsByCommand.get(destination.command)??[];entries.push(destination);destinationsByCommand.set(destination.command,entries)}const findings=[...validateCommandDestinations(normalizedCommands,destinationsByCommand,nounSet),...validateDestinationCensus(commandSet,destinations),...validateAliasTargets(aliases.filter(alias=>commandSet.has(alias.alias)||!(destinationsByCommand.get(alias.canonical)??[]).some(destination=>destination.disposition==="package_owned")),commandSet)];const hiddenAliasNames=new Set(aliases.filter(alias=>alias.hidden).map(alias=>alias.alias));const visibleTopLevelCount=new Set(normalizedCommands.filter(command=>!command.includes(" ")&&!hiddenAliasNames.has(command)&&!(destinationsByCommand.get(command)??[]).some(destination=>destination.disposition==="package_owned"))).size;if(visibleTopLevelCount>PM_CLI_GRAMMAR_CONTRACT.visible_top_level_ceiling){findings.push({code:"visible_surface_ceiling_exceeded",spelling:String(visibleTopLevelCount),message:`Visible non-package top-level command count ${visibleTopLevelCount} exceeds ceiling ${PM_CLI_GRAMMAR_CONTRACT.visible_top_level_ceiling}.`,nearest_target:"Declare the noun placement and tracked waiver before raising the ceiling."})}return{ok:findings.length===0,command_count:normalizedCommands.length,destination_count:destinations.length,hidden_alias_count:aliases.filter(alias=>alias.hidden).length,visible_top_level_count:visibleTopLevelCount,visible_top_level_ceiling:PM_CLI_GRAMMAR_CONTRACT.visible_top_level_ceiling,findings}}export{PM_CLI_GRAMMAR_CONTRACT,PM_CLI_GRAMMAR_NOUNS,PM_CLI_SHARED_VERBS,PM_COMMAND_DESTINATION_CONTRACTS,PM_COMMAND_POSITIONAL_CONTRACTS,PM_POSITIONAL_ACTION_CONTRACTS,formatPmPositionalActionFlagTip,positionalShapeKey,positionalSignatureKey,resolvePmCommandPositionalContract,resolvePmPositionalActionContract,verifyExplicitPositionalSlotCensus,verifyPmCliGrammar,verifyPmCommandPositionalContracts};
1
+ !(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d78f489d-2ce1-5806-a17e-0c6c049ad0f0")}catch(e2){}})();import{resolvePmCommandAlias,PM_HISTORY_COMMAND_ALIASES,PM_RELOCATED_COMMAND_ALIASES,resolvePmHistoryOperation}from"./command-aliases.js";const PM_CLI_GRAMMAR_NOUNS=["item","list","context","search","graph","history","workspace","package","ops","plan","contracts","help"];const PM_CLI_SHARED_VERBS=["acknowledge","activate","add","adopt","adopt-all","catalog","compact","complete","create","deactivate","delete","describe","doctor","edit","explore","import","init","inspect","install","list","manage","migrate","mutate","read","redact","reload","remove","reopen","repair","restore","run","show","uninstall","upgrade","verify"];function positionalSlot(name,valueKind,required,options={}){return{name,required,variadic:options.variadic===true,value_kind:valueKind,polymorphic:options.polymorphic===true}}function positionalActionVerb(action){const phrase=action.replaceAll("-"," ");return`${phrase.charAt(0).toUpperCase()}${phrase.slice(1)}`}const ITEM_ID=positionalSlot("id","item_id",true);const OPTIONAL_ITEM_ID=positionalSlot("id","item_id",false);const OPTIONAL_TEXT=positionalSlot("text","string",false);const PLAN_ITEM_ID=positionalSlot("plan-id","item_id",true);const PLAN_STEP=positionalSlot("step","string",true);const PLAN_CREATE_FLAGS=["--acceptance-criteria","--actual-result","--affected-version","--assignee","--blocked-by","--blocked-reason","--blocks","--body","--claim","--comment","--component","--confidence","--create-mode","--customer-impact","--deadline","--definition-of-ready","--description","--doc","--environment","--estimate","--event","--expected-result","--fixed-version","--file","--from-search","--goal","--harness","--impact","--learning","--message","--mode","--note","--objective","--order","--outcome","--parent","--priority","--rank","--related","--release","--reminder","--reporter","--repro-steps","--resolution","--resume-context","--reviewer","--risk","--scope","--severity","--sprint","--status","--step","--step-blocked-reason","--step-body","--step-evidence","--step-owner","--step-replacement","--step-status","--step-title","--tags","--template","--test","--title","--type-option","--unblock-note","--value","--why-now"];const PLAN_STEP_FLAGS=["--allow-multiple-active","--depends-on","--file","--force","--message","--step-blocked-reason","--step-body","--step-evidence","--step-owner","--step-status","--step-title","--test"];const PLAN_STEP_ACTION_DESCRIPTIONS={"update-step":"Update one declared Plan step.","complete-step":"Complete one declared Plan step.","block-step":"Block one declared Plan step.","remove-step":"Remove one declared Plan step.",link:"Link one dependency to a declared Plan step.",unlink:"Unlink one dependency from a declared Plan step."};const PM_POSITIONAL_ACTION_CONTRACTS=[{command:"plan create",parent:"plan",action:"create",slots:[positionalSlot("title","string",false,{polymorphic:true})],accepted_flags:PLAN_CREATE_FLAGS,description:"Create a Plan item and optionally seed its ordered steps.",example:'pm plan create --title "Refactor lock retry"'},{command:"plan show",parent:"plan",action:"show",slots:[PLAN_ITEM_ID],accepted_flags:["--depth","--fields"],description:"Read one Plan item with a bounded plan projection.",example:"pm plan show pm-a1b2 --depth standard"},{command:"plan add-step",parent:"plan",action:"add-step",slots:[PLAN_ITEM_ID],accepted_flags:PLAN_STEP_FLAGS,description:"Append one ordered step to a Plan item.",example:'pm plan add-step pm-a1b2 --step-title "Run tests"'},...Object.entries(PLAN_STEP_ACTION_DESCRIPTIONS).map(([action,description])=>({command:`plan ${action}`,parent:"plan",action,slots:[PLAN_ITEM_ID,PLAN_STEP],accepted_flags:PLAN_STEP_FLAGS,description,example:`pm plan ${action} pm-a1b2 plan-step-001`})),{command:"plan reorder-step",parent:"plan",action:"reorder-step",slots:[PLAN_ITEM_ID,PLAN_STEP,positionalSlot("new-order","integer",true)],accepted_flags:["--force","--message"],description:"Move one Plan step to a declared integer order.",example:"pm plan reorder-step pm-a1b2 plan-step-001 2"},...["decision","discovery","validation","resume","approve","materialize"].map(action=>({command:`plan ${action}`,parent:"plan",action,slots:[PLAN_ITEM_ID],accepted_flags:PLAN_STEP_FLAGS,description:`${positionalActionVerb(action)} for one Plan item.`,example:`pm plan ${action} pm-a1b2`})),...["list","show","put","remove"].map(action=>({command:`assurance ${action}`,parent:"assurance",action,slots:[positionalSlot("kind","string",true),...action==="list"?[]:[positionalSlot("id","string",true)]],accepted_flags:action==="put"?["--author","--definition","--message"]:action==="remove"?["--author","--message"]:[],description:`${positionalActionVerb(action)} assurance declarations by kind.`,example:action==="list"?"pm assurance list measurement":`pm assurance ${action} measurement example-id`})),{command:"assurance run",parent:"assurance",action:"run",slots:[positionalSlot("gate-id","string",true)],accepted_flags:["--dry-run","--trigger","--tree"],description:"Evaluate one assurance gate for a lifecycle trigger.",example:"pm assurance run tracker-context-quality --trigger ci --dry-run"},{command:"assurance verdicts",parent:"assurance",action:"verdicts",slots:[positionalSlot("gate-id","string",false)],accepted_flags:["--gate","--limit"],description:"List bounded assurance verdict history.",example:"pm assurance verdicts --limit 20"},...["presets","apply"].map(action=>({command:`assurance ${action}`,parent:"assurance",action,slots:[positionalSlot("preset","string",action==="apply")],accepted_flags:["--author","--message","--owner"],description:action==="apply"?"Apply one assurance adoption preset.":"List available assurance adoption presets.",example:action==="apply"?"pm assurance apply software-delivery --owner <pm-item-id>":"pm assurance presets"})),{command:"assurance derive",parent:"assurance",action:"derive",slots:[],accepted_flags:["--apply","--author","--message","--owner"],description:"Derive assurance proposals from current project context.",example:"pm assurance derive --owner pm-a1b2"},{command:"assurance promote",parent:"assurance",action:"promote",slots:[positionalSlot("assertion-id","string",true)],accepted_flags:["--author","--enforcement","--message"],description:"Promote one assertion into a warning or blocking gate.",example:"pm assurance promote assertion-id --enforcement warn"},{command:"assurance risk",parent:"assurance",action:"risk",slots:[],accepted_flags:["--definition"],description:"Analyze bounded defect-recurrence risk for a proposed change.",example:`pm assurance risk --definition '{"change":{"files":[]}}'`},{command:"assurance lineages",parent:"assurance",action:"lineages",slots:[],accepted_flags:["--definition"],description:"Measure all recorded recurrence lineages with bounded evidence rows.",example:`pm assurance lineages --definition '{"policy":{"version":1,"evidence_epoch":"2026-01-01T00:00:00.000Z","families":[]}}'`},{command:"workspace position",parent:"workspace",action:"position",slots:[],accepted_flags:[],description:"Read bounded merge-fence, receipt, history-drift, and next-action readiness.",example:"pm workspace position"},{command:"workspace snapshot create",parent:"workspace snapshot",action:"create",slots:[positionalSlot("name","string",false)],accepted_flags:[],description:"Capture authoritative tracker state as an immutable snapshot.",example:"pm workspace snapshot create before-migration"},{command:"workspace snapshot list",parent:"workspace snapshot",action:"list",slots:[],accepted_flags:[],description:"List immutable workspace snapshots and named references.",example:"pm workspace snapshot list"},{command:"workspace snapshot inspect",parent:"workspace snapshot",action:"inspect",slots:[positionalSlot("target","string",true)],accepted_flags:[],description:"Inspect one workspace snapshot target.",example:"pm workspace snapshot inspect before-migration"},{command:"workspace snapshot restore",parent:"workspace snapshot",action:"restore",slots:[positionalSlot("target","string",true)],accepted_flags:["--author","--dry-run","--force","--message"],description:"Restore an immutable workspace snapshot with explicit recovery controls.",example:"pm workspace snapshot restore before-migration --dry-run"},{command:"workspace snapshot delete",parent:"workspace snapshot",action:"delete",slots:[positionalSlot("target","string",true)],accepted_flags:[],description:"Delete one workspace snapshot target.",example:"pm workspace snapshot delete before-migration"}];const POSITIONAL_ACTION_CONTRACTS_BY_SPECIFICITY=[...PM_POSITIONAL_ACTION_CONTRACTS].sort((left,right)=>right.command.length-left.command.length);const EXPLICIT_POSITIONAL_SLOTS=new Map([["append",[ITEM_ID,OPTIONAL_TEXT]],["assurance",[positionalSlot("action","action",true),positionalSlot("kind","string",false),positionalSlot("id","string",false)]],["beads import",[positionalSlot("file","string",false)]],["changelog export",[positionalSlot("file","string",false)]],["claim",[OPTIONAL_ITEM_ID]],["close",[ITEM_ID,OPTIONAL_TEXT]],["close-task",[ITEM_ID,positionalSlot("reason","string",false)]],["comments",[ITEM_ID,OPTIONAL_TEXT]],["completion",[positionalSlot("shell","string",false)]],["config",[positionalSlot("scope","string",false,{polymorphic:true}),positionalSlot("action","action",false),positionalSlot("key","string",false),positionalSlot("value","string",false,{polymorphic:true})]],["copy",[ITEM_ID]],["create",[positionalSlot("type-or-title","string",false,{polymorphic:true}),positionalSlot("title","string",false)]],["delete",[ITEM_ID]],["deps",[ITEM_ID]],["docs",[ITEM_ID]],["event",[positionalSlot("title","string",true)]],["files",[ITEM_ID]],["files discover",[ITEM_ID]],["files lookup",[positionalSlot("paths","string",true,{variadic:true})]],["focus",[OPTIONAL_ITEM_ID]],["get",[ITEM_ID]],["graph",[positionalSlot("subcommand","action",true),OPTIONAL_ITEM_ID,positionalSlot("target","item_id",false)]],["guide",[positionalSlot("topic","string",false)]],["history",[ITEM_ID]],["history-compact",[OPTIONAL_ITEM_ID]],["history-redact",[ITEM_ID]],["history-repair",[OPTIONAL_ITEM_ID]],["init",[positionalSlot("prefix-or-path","string",false,{polymorphic:true})]],["item complete",[ITEM_ID,positionalSlot("reason","string",false)]],["item reopen",[ITEM_ID,positionalSlot("reason","string",true)]],["learnings",[ITEM_ID,OPTIONAL_TEXT]],["meet",[positionalSlot("title","string",true)]],["merge",[positionalSlot("subcommand","action",true),positionalSlot("artifact","string",false),positionalSlot("base","string",false),positionalSlot("ours","string",false),positionalSlot("theirs","string",false)]],["notes",[ITEM_ID,OPTIONAL_TEXT]],["package",[positionalSlot("target","string",false,{polymorphic:true})]],["package list",[]],["package inventory",[positionalSlot("name","string",false)]],["package scaffold",[positionalSlot("target","string",true)]],["package upgrade",[positionalSlot("target","string",false)]],["packages",[positionalSlot("target","string",false,{polymorphic:true})]],["packages list",[]],["packages inventory",[positionalSlot("name","string",false)]],["packages scaffold",[positionalSlot("target","string",true)]],["packages upgrade",[positionalSlot("target","string",false)]],["pause-task",[ITEM_ID]],["plan",[positionalSlot("subcommand","action",true),positionalSlot("id","item_id",false,{polymorphic:true}),positionalSlot("step","string",false),positionalSlot("new-order","integer",false)]],["profile",[positionalSlot("subcommand","action",true),positionalSlot("name","string",false)]],["release",[ITEM_ID]],["remind",[positionalSlot("title","string",true)]],["restore",[ITEM_ID,positionalSlot("target","string",true)]],["schema",[positionalSlot("subcommand","action",true),positionalSlot("name","string",false)]],["search-advanced",[positionalSlot("keywords","string",true,{variadic:true})]],["search",[positionalSlot("keywords","string",true,{variadic:true})]],["start-task",[ITEM_ID]],["templates save",[positionalSlot("name","string",true)]],["templates show",[positionalSlot("name","string",true)]],["telemetry",[positionalSlot("namespace-or-subcommand","action",false,{polymorphic:true}),positionalSlot("subcommand","action",false)]],["test",[ITEM_ID]],["test-runs-worker",[positionalSlot("runId","string",true)]],["update",[ITEM_ID]],["workspace snapshot",[positionalSlot("action","action",true),positionalSlot("target","string",false)]],...["activate","adopt","deactivate","init","uninstall"].flatMap(action=>["extension","package","packages"].map(root=>[`${root} ${action}`,[positionalSlot("target","string",true)]])),...["describe"].flatMap(action=>["extension","package","packages"].map(root=>[`${root} ${action}`,[positionalSlot("target","string",false)]])),...["install"].flatMap(action=>["extension","package","packages"].map(root=>[`${root} ${action}`,[positionalSlot("targets","string",false,{variadic:true})]])),["vcs abandon",[ITEM_ID]],["vcs create",[positionalSlot("title","string",true)]],["vcs merge",[ITEM_ID]],["vcs propose",[ITEM_ID]],["vcs ref-create",[positionalSlot("name","string",true)]],["vcs show",[ITEM_ID]]]);function normalizePositionalCommandPath(command){return command.trim().toLowerCase().replace(/\s+/gu," ")}function resolvePmCommandPositionalContract(command){const normalized=normalizePositionalCommandPath(command);const direct=PM_COMMAND_POSITIONAL_CONTRACTS.find(contract=>contract.command===normalized);if(direct)return direct;const canonical=resolvePmCommandAlias(normalized)?.canonical;if(!canonical)return void 0;return PM_COMMAND_POSITIONAL_CONTRACTS.find(contract=>contract.command===canonical)}function resolvePmPositionalActionContract(command){const normalized=normalizePositionalCommandPath(command);return POSITIONAL_ACTION_CONTRACTS_BY_SPECIFICITY.find(contract=>contract.command===normalized||normalized.startsWith(`${contract.command} `))}function formatPmPositionalActionFlagTip(acceptedFlags){return`Applicable flags: ${acceptedFlags.length>0?acceptedFlags.join(", "):"none"}.`}function destinationRows(noun,target,disposition,owner,commands){return commands.map(command=>({command,noun,target,disposition,owner}))}const PM_COMMAND_DESTINATION_CONTRACTS=[...destinationRows("item","item","target_noun","pm-pbyu",["item","item complete","item mutate","item reopen"]),...destinationRows("item","item","consolidation","pm-yql1",["append","close-many","close-task","comments","copy","delete","deps","docs","files","learnings","notes","pause-task","start-task","test","update-many"]),...["claim","close","create","get","release","update"].map(command=>({command,noun:"item",target:command,disposition:"keep_as_is",owner:"pm-pbyu",reason:"Permanent high-frequency item operations retain concise root spellings under the accepted hot-path grammar policy."})),...destinationRows("item","item files","target_noun","pm-yql1",["files discover","files lookup","item files discover","item files lookup"]),...destinationRows("item","item test worker","consolidation","pm-lp4j",["test-runs-worker"]),...destinationRows("list","list","target_noun","pm-pfqi",["list"]),...destinationRows("list","list --group-by","consolidation","pm-xkgq",["aggregate"]),...destinationRows("context","context","target_noun","pm-pbyu",["context"]),...destinationRows("context","context","consolidation","pm-kcs4",["ctx","focus","next"]),...destinationRows("context","context next","consolidation","pm-kcs4",["ctx next"]),...destinationRows("context","context focus","consolidation","pm-kcs4",["ctx focus"]),...destinationRows("search","search","target_noun","pm-pbyu",["search"]),...destinationRows("search","search","package_owned","package:search-advanced",["reindex","search-advanced"]),...destinationRows("item","item duplicates","consolidation","pm-fmy9ih",["duplicates"]),...destinationRows("item","item duplicates","package_owned","pm-fmy9ih",["dedupe-audit","dedupe-merge","comments-audit"]),...destinationRows("graph","graph","target_noun","pm-pbyu",["graph"]),...destinationRows("history","history","target_noun","pm-pbyu",["history"]),...destinationRows("history","history attest","target_noun","pm-3z0k",["history attest"]),...destinationRows("history","history attest","consolidation","pm-3z0k",["history-attest"]),...PM_HISTORY_COMMAND_ALIASES.flatMap(({alias,canonical})=>[...destinationRows("history",canonical,"target_noun","pm-tqel",[canonical]),...destinationRows("history",canonical,"consolidation","pm-tqel",[alias])]),...destinationRows("history","history","consolidation","pm-tqel",["events","merge"]),...destinationRows("history","history acknowledge","consolidation","pm-djyvbk",["history-author-acknowledge"]),...destinationRows("history","history","package_owned","package:builtin-vcs-exemplar",["vcs abandon","vcs create","vcs log","vcs merge","vcs propose","vcs ref-create","vcs show"]),...destinationRows("workspace","workspace","target_noun","pm-pbyu",["workspace","workspace position","workspace snapshot","workspace snapshot create","workspace snapshot delete","workspace snapshot inspect","workspace snapshot list","workspace snapshot restore"]),...destinationRows("workspace","workspace init","consolidation","pm-npr3",["init"]),...destinationRows("package","package","target_noun","pm-pbyu",["package","package activate","package adopt","package adopt-all","package catalog","package deactivate","package describe","package doctor","package explore","package init","package install","package inventory","package list","package manage","package migrate","package reload","package scaffold","package uninstall","package upgrade"]),...destinationRows("package","package","consolidation","pm-tnud",["extension activate","extension adopt","extension adopt-all","extension catalog","extension deactivate","extension describe","extension doctor","extension explore","extension init","extension install","extension manage","extension migrate","extension reload","extension uninstall","packages","packages activate","packages adopt","packages adopt-all","packages catalog","packages deactivate","packages describe","packages doctor","packages explore","packages init","packages install","packages inventory","packages list","packages manage","packages migrate","packages reload","packages scaffold","packages uninstall","packages upgrade"]),...destinationRows("package","package","package_owned","package:beads",["beads import"]),...destinationRows("package","package","package_owned","package:pm-changelog",["changelog export","changelog generate"]),...destinationRows("package","package calendar","package_owned","pm-o3fh",["event","meet","remind"]),...destinationRows("ops","ops","target_noun","pm-6apl",["ops"]),...destinationRows("ops","ops normalize","package_owned","package:pm-governance-audit",["normalize"]),...destinationRows("ops","ops","consolidation","pm-6apl",["eval","gc","health","stats","telemetry","test-all","validate"]),...destinationRows("workspace","workspace","consolidation","pm-npr3",["config","profile","schema"]),...["assurance",...PM_POSITIONAL_ACTION_CONTRACTS.filter(({parent})=>parent==="assurance").map(({command})=>command)].map(command=>({command,noun:"ops",target:command,disposition:"keep_as_is",owner:"pm-djyvbk",reason:"Assurance manages durable measurement, assertion, gate, and verdict data; retain its established domain surface independently of operational diagnostics."})),...destinationRows("plan","plan","target_noun","pm-pbyu",["plan"]),...destinationRows("plan","plan","target_noun","pm-2tan",PM_POSITIONAL_ACTION_CONTRACTS.filter(({parent})=>parent==="plan").map(({command})=>command)),...destinationRows("contracts","contracts","target_noun","pm-pbyu",["contracts"]),...destinationRows("help","help","target_noun","pm-pbyu",["help"]),...destinationRows("workspace","templates","package_owned","package:builtin-templates",["templates","templates list","templates save","templates show"]),...destinationRows("help","help","package_owned","package:builtin-guide-shell",["completion","completion-statuses","completion-tags","completion-types","guide"])].flatMap(entry=>{const alias=PM_RELOCATED_COMMAND_ALIASES.find(candidate=>candidate.alias===entry.command);if(!alias)return[entry];const noun=PM_CLI_GRAMMAR_NOUNS.find(candidate=>candidate===alias.canonical_argv[0])??entry.noun;return[{...entry,noun,target:alias.canonical,owner:alias.owner},{...entry,command:alias.canonical,noun,target:alias.canonical,owner:alias.owner,disposition:entry.disposition==="package_owned"?"package_owned":"target_noun"}]});const PM_COMMAND_POSITIONAL_CONTRACTS=[...new Set(PM_COMMAND_DESTINATION_CONTRACTS.map(({command})=>command))].map(command=>({command,slots:resolvePmPositionalActionContract(command)?.slots??EXPLICIT_POSITIONAL_SLOTS.get(resolvePmHistoryOperation(command))??[]}));const PM_CLI_GRAMMAR_CONTRACT={nouns:PM_CLI_GRAMMAR_NOUNS,shared_verbs:PM_CLI_SHARED_VERBS,scope_before_verb:true,visible_top_level_ceiling:69,ceiling_raise_requires_pm_item:true,positional_shape_budget:21};function verifyExplicitPositionalSlotCensus(explicitCommands,destinationCommands){const destinations=new Set(destinationCommands);return[...new Set(explicitCommands)].filter(command=>!destinations.has(command)).map(command=>({code:"positional_signature_mismatch",command,detail:`Positional signature ${command} has no destination declaration.`}))}function positionalShapeKey(slots){return slots.map(({required,variadic,value_kind:valueKind,polymorphic})=>`${required?"r":"o"}:${variadic?"v":"s"}:${valueKind}:${polymorphic?"p":"m"}`).join("|")}function positionalSignatureKey(slots){return slots.map(({name,required,variadic,value_kind:valueKind,polymorphic})=>`${name}:${required?"r":"o"}:${variadic?"v":"s"}:${valueKind}:${polymorphic?"p":"m"}`).join("|")}function duplicatePositionalSignatureFindings(contracts,surface){const counts=new Map;for(const{command}of contracts){const normalized=normalizePositionalCommandPath(command);counts.set(normalized,(counts.get(normalized)??0)+1)}return[...counts.entries()].filter(([,count])=>count>1).map(([command,count])=>({code:"positional_signature_mismatch",command,detail:`${count} ${surface} positional signatures exist for ${command}; exactly one is required.`}))}function verifyPmCommandPositionalContracts(observed,options={}){const declared=options.declared??PM_COMMAND_POSITIONAL_CONTRACTS;const positionalShapeBudget=options.positionalShapeBudget??PM_CLI_GRAMMAR_CONTRACT.positional_shape_budget;const declaredByCommand=new Map(declared.map(contract=>[normalizePositionalCommandPath(contract.command),contract]));const observedByCommand=new Map(observed.map(contract=>[normalizePositionalCommandPath(contract.command),contract]));const findings=[...duplicatePositionalSignatureFindings(declared,"declared"),...duplicatePositionalSignatureFindings(observed,"observed"),...options.declared===void 0?[...verifyExplicitPositionalSlotCensus(EXPLICIT_POSITIONAL_SLOTS.keys(),PM_COMMAND_DESTINATION_CONTRACTS.map(({command})=>command)),...verifyExplicitPositionalSlotCensus(PM_POSITIONAL_ACTION_CONTRACTS.map(({command})=>command),PM_COMMAND_DESTINATION_CONTRACTS.map(({command})=>command))]:[]];for(const contract of declaredByCommand.values()){const normalizedCommand=normalizePositionalCommandPath(contract.command);const actual=observedByCommand.get(normalizedCommand);if(!actual){findings.push({code:"missing_observed_signature",command:contract.command,detail:`No observed positional signature exists for ${contract.command}.`})}else if(positionalSignatureKey(actual.slots)!==positionalSignatureKey(contract.slots)){findings.push({code:"positional_signature_mismatch",command:contract.command,detail:`Observed positional signature for ${contract.command} differs from its declared SDK contract: observed=${positionalSignatureKey(actual.slots)||"<none>"}; declared=${positionalSignatureKey(contract.slots)||"<none>"}.`})}}for(const contract of observedByCommand.values()){if(!declaredByCommand.has(normalizePositionalCommandPath(contract.command))){findings.push({code:"stale_observed_signature",command:contract.command,detail:`Observed positional signature ${contract.command} has no declaration.`})}}const positionalShapeCount=new Set(declared.map(({slots})=>positionalShapeKey(slots))).size;if(positionalShapeCount>positionalShapeBudget){findings.push({code:"positional_shape_budget_exceeded",command:"*",detail:`Distinct positional shape count ${positionalShapeCount} exceeds budget ${positionalShapeBudget}.`})}findings.sort((left,right)=>left.command!==right.command?left.command.localeCompare(right.command):left.code.localeCompare(right.code));return{ok:findings.length===0,declared_command_count:declared.length,observed_command_count:observed.length,positional_shape_count:positionalShapeCount,positional_shape_budget:positionalShapeBudget,findings}}function validateCommandDestinations(commands,destinationsByCommand,nounSet){return commands.flatMap(command=>{const destinations=destinationsByCommand.get(command)??[];if(destinations.length===0){const separatorIndex=command.indexOf(" ");const root=separatorIndex===-1?command:command.slice(0,separatorIndex);return[{code:"missing_destination",spelling:command,message:`Command \`${command}\` has no destination census row.`,nearest_target:nounSet.has(root)?root:`ops ${command}`}]}const duplicateFinding=destinations.length>1?[{code:"duplicate_destination",spelling:command,message:`Command \`${command}\` has ${destinations.length} destination rows.`,nearest_target:destinations[0].target}]:[];return destinations.reduce((findings,destination)=>{if(destination.disposition==="keep_as_is"&&(destination.reason?.trim().length??0)===0){findings.push({code:"missing_destination",spelling:command,message:`Command \`${command}\` is kept as-is without a documented reason.`,nearest_target:destination.target})}if(!nounSet.has(destination.noun)){findings.push({code:"unknown_noun",spelling:command,message:`Command \`${command}\` names undeclared noun \`${destination.noun}\`.`,nearest_target:destination.target})}return findings},duplicateFinding)})}function validateDestinationCensus(commandSet,destinations){return destinations.filter(destination=>destination.disposition!=="package_owned"&&!commandSet.has(destination.command)).map(destination=>({code:"stale_destination",spelling:destination.command,message:`Destination row \`${destination.command}\` is absent from live contracts.`,nearest_target:destination.target}))}function validateAliasTargets(aliases,commandSet){return aliases.filter(alias=>!commandSet.has(alias.canonical)).map(alias=>({code:"alias_target_missing",spelling:alias.alias,message:`Alias \`${alias.alias}\` targets missing canonical command \`${alias.canonical}\`.`,nearest_target:alias.canonical_argv.join(" ")}))}function verifyPmCliGrammar(commands,aliases=[],destinations=PM_COMMAND_DESTINATION_CONTRACTS){const normalizedCommands=[...new Set(commands.map(command=>command.trim()))].filter(command=>command.length>0).sort((left,right)=>left.localeCompare(right));const commandSet=new Set(normalizedCommands);const nounSet=new Set(PM_CLI_GRAMMAR_NOUNS);const destinationsByCommand=new Map;for(const destination of destinations){const entries=destinationsByCommand.get(destination.command)??[];entries.push(destination);destinationsByCommand.set(destination.command,entries)}const findings=[...validateCommandDestinations(normalizedCommands,destinationsByCommand,nounSet),...validateDestinationCensus(commandSet,destinations),...validateAliasTargets(aliases.filter(alias=>commandSet.has(alias.alias)||!(destinationsByCommand.get(alias.canonical)??[]).some(destination=>destination.disposition==="package_owned")),commandSet)];const hiddenAliasNames=new Set(aliases.filter(alias=>alias.hidden).map(alias=>alias.alias));const visibleTopLevelCount=new Set(normalizedCommands.filter(command=>!command.includes(" ")&&!hiddenAliasNames.has(command)&&!(destinationsByCommand.get(command)??[]).some(destination=>destination.disposition==="package_owned"))).size;if(visibleTopLevelCount>PM_CLI_GRAMMAR_CONTRACT.visible_top_level_ceiling){findings.push({code:"visible_surface_ceiling_exceeded",spelling:String(visibleTopLevelCount),message:`Visible non-package top-level command count ${visibleTopLevelCount} exceeds ceiling ${PM_CLI_GRAMMAR_CONTRACT.visible_top_level_ceiling}.`,nearest_target:"Declare the noun placement and tracked waiver before raising the ceiling."})}return{ok:findings.length===0,command_count:normalizedCommands.length,destination_count:destinations.length,hidden_alias_count:aliases.filter(alias=>alias.hidden).length,visible_top_level_count:visibleTopLevelCount,visible_top_level_ceiling:PM_CLI_GRAMMAR_CONTRACT.visible_top_level_ceiling,findings}}export{PM_CLI_GRAMMAR_CONTRACT,PM_CLI_GRAMMAR_NOUNS,PM_CLI_SHARED_VERBS,PM_COMMAND_DESTINATION_CONTRACTS,PM_COMMAND_POSITIONAL_CONTRACTS,PM_POSITIONAL_ACTION_CONTRACTS,formatPmPositionalActionFlagTip,positionalShapeKey,positionalSignatureKey,resolvePmCommandPositionalContract,resolvePmPositionalActionContract,verifyExplicitPositionalSlotCensus,verifyPmCliGrammar,verifyPmCommandPositionalContracts};
2
2
  //# sourceMappingURL=grammar-contracts.js.map
@@ -83,7 +83,7 @@ declare const CLOSE_MUTATION_FLAGS: string;
83
83
  declare const CLOSE_TASK_MUTATION_FLAGS: string;
84
84
  declare const RELEASE_MUTATION_FLAGS: string;
85
85
  declare const CLAIM_MUTATION_FLAGS: string;
86
- declare const COMMAND_COMPLETION_DESCRIPTIONS: readonly [readonly ["init", "Initialize pm storage for the current workspace"], readonly ["config", "Read or update pm settings"], readonly ["package", "Manage package lifecycle operations"], readonly ["packages", "Alias for package"], readonly ["create", "Create a new project management item"], readonly ["item", "Manage item evidence, links, tests, and duplication"], readonly ["copy", "Copy an existing item to a new ID"], readonly ["focus", "Set/clear/show the session focused parent for new items"], readonly ["list", "List active items with optional filters"], readonly ["aggregate", "Aggregate grouped item counts and numeric stats for governance queries"], readonly ["duplicates", "Find bounded duplicate clusters across lifecycle statuses"], readonly ["guide", "Browse local progressive-disclosure guides"], readonly ["calendar", "Show calendar views for deadlines and reminders"], readonly ["cal", "Alias for calendar"], readonly ["context", "Show a token-efficient project context snapshot"], readonly ["ctx", "Alias for context"], readonly ["get", "Show item details by ID"], readonly ["next", "Recommend the next actionable (unblocked, ready) work item"], readonly ["search", "Search items with keyword, semantic, or hybrid modes"], readonly ["reindex", "Rebuild search artifacts"], readonly ["history", "Show item history entries"], readonly ["history-compact", "Compact history streams into a synthetic baseline + retained tail"], readonly ["history-redact", "Redact sensitive literals/patterns and recompute history hashes"], readonly ["history-repair", "Re-anchor a drifted history chain so pm health/validate report ok"], readonly ["schema", "Manage custom item types and statuses in .agents/pm/schema/*.json"], readonly ["profile", "List, show, apply, and lint project profiles (archetype schema/config/template/package bundles)"], readonly ["plan", "Agent-optimized Plan item workflow (create/show/add-step/update-step/complete-step/link/approve/materialize)"], readonly ["activity", "Show recent activity across items"], readonly ["restore", "Restore an item to an earlier state"], readonly ["update", "Update item fields and metadata"], readonly ["update-many", "Bulk-update matched items with dry-run and rollback checkpoints"], readonly ["close", "Close an item (reason requirement follows governance settings)"], readonly ["close-many", "Bulk-close matched items with an optional shared reason and rollback checkpoint"], readonly ["delete", "Delete an item and record the change"], readonly ["append", "Append text to an item body"], readonly ["comments", "List or add comments for an item"], readonly ["notes", "List or add notes for an item"], readonly ["learnings", "List or add learnings for an item"], readonly ["files", "Manage linked files"], readonly ["docs", "Manage linked docs"], readonly ["deps", "Show dependency relationships for an item"], readonly ["graph", "Bounded graph traversal, analytics, and governance-audit queries"], readonly ["test", "Manage linked tests and optionally run them"], readonly ["test-all", "Run linked tests across matching items"], readonly ["test-runs", "Manage background linked-test runs"], readonly ["stats", "Show project tracker statistics"], readonly ["health", "Show project tracker health checks"], readonly ["validate", "Run standalone validation checks"], readonly ["gc", "Clean optional cache artifacts"], readonly ["contracts", "Show machine-readable command and schema contracts"], readonly ["claim", "Claim an item for active work"], readonly ["release", "Release the active claim for an item"], readonly ["start-task", "Lifecycle alias to claim and set in_progress"], readonly ["pause-task", "Lifecycle alias to reopen and release claim"], readonly ["close-task", "Lifecycle alias to close and release claim"], readonly ["meet", "Shortcut to create a Meeting with scheduling defaults"], readonly ["event", "Shortcut to create an Event with scheduling defaults"], readonly ["remind", "Shortcut to create a Reminder from a point in time"], readonly ["templates", "Manage reusable create templates"], readonly ["completion", "Generate shell completion"], readonly ["help", "Display help for a command"]];
86
+ declare const COMMAND_COMPLETION_DESCRIPTIONS: readonly [readonly ["workspace", "Workspace initialization, customization, state and snapshots"], readonly ["init", "Initialize pm storage for the current workspace"], readonly ["config", "Read or update pm settings"], readonly ["package", "Manage package lifecycle operations"], readonly ["packages", "Alias for package"], readonly ["create", "Create a new project management item"], readonly ["item", "Manage item evidence, links, tests, and duplication"], readonly ["copy", "Copy an existing item to a new ID"], readonly ["focus", "Set/clear/show the session focused parent for new items"], readonly ["list", "List active items with optional filters"], readonly ["aggregate", "Aggregate grouped item counts and numeric stats for governance queries"], readonly ["duplicates", "Find bounded duplicate clusters across lifecycle statuses"], readonly ["guide", "Browse local progressive-disclosure guides"], readonly ["calendar", "Show calendar views for deadlines and reminders"], readonly ["cal", "Alias for calendar"], readonly ["context", "Show a token-efficient project context snapshot"], readonly ["ctx", "Alias for context"], readonly ["get", "Show item details by ID"], readonly ["next", "Recommend the next actionable (unblocked, ready) work item"], readonly ["search", "Search items with keyword, semantic, or hybrid modes"], readonly ["reindex", "Rebuild search artifacts"], readonly ["history", "Show item history entries"], readonly ["history-compact", "Compact history streams into a synthetic baseline + retained tail"], readonly ["history-redact", "Redact sensitive literals/patterns and recompute history hashes"], readonly ["history-repair", "Re-anchor a drifted history chain so pm health/validate report ok"], readonly ["schema", "Manage custom item types and statuses in .agents/pm/schema/*.json"], readonly ["profile", "List, show, apply, and lint project profiles (archetype schema/config/template/package bundles)"], readonly ["plan", "Agent-optimized Plan item workflow (create/show/add-step/update-step/complete-step/link/approve/materialize)"], readonly ["activity", "Show recent activity across items"], readonly ["restore", "Restore an item to an earlier state"], readonly ["update", "Update item fields and metadata"], readonly ["update-many", "Bulk-update matched items with dry-run and rollback checkpoints"], readonly ["close", "Close an item (reason requirement follows governance settings)"], readonly ["close-many", "Bulk-close matched items with an optional shared reason and rollback checkpoint"], readonly ["delete", "Delete an item and record the change"], readonly ["append", "Append text to an item body"], readonly ["comments", "List or add comments for an item"], readonly ["notes", "List or add notes for an item"], readonly ["learnings", "List or add learnings for an item"], readonly ["files", "Manage linked files"], readonly ["docs", "Manage linked docs"], readonly ["deps", "Show dependency relationships for an item"], readonly ["graph", "Bounded graph traversal, analytics, and governance-audit queries"], readonly ["test", "Manage linked tests and optionally run them"], readonly ["test-all", "Run linked tests across matching items"], readonly ["test-runs", "Manage background linked-test runs"], readonly ["stats", "Show project tracker statistics"], readonly ["health", "Show project tracker health checks"], readonly ["validate", "Run standalone validation checks"], readonly ["gc", "Clean optional cache artifacts"], readonly ["contracts", "Show machine-readable command and schema contracts"], readonly ["claim", "Claim an item for active work"], readonly ["release", "Release the active claim for an item"], readonly ["start-task", "Lifecycle alias to claim and set in_progress"], readonly ["pause-task", "Lifecycle alias to reopen and release claim"], readonly ["close-task", "Lifecycle alias to close and release claim"], readonly ["meet", "Shortcut to create a Meeting with scheduling defaults"], readonly ["event", "Shortcut to create an Event with scheduling defaults"], readonly ["remind", "Shortcut to create a Reminder from a point in time"], readonly ["templates", "Manage reusable create templates"], readonly ["completion", "Generate shell completion"], readonly ["help", "Display help for a command"]];
87
87
  declare const GLOBAL_FLAGS: string;
88
88
  declare const GLOBAL_COMPLETION_VALUE_PATTERNS: string;
89
89
  declare const GLOBAL_COMPLETION_INLINE_PATTERNS: string;
@@ -1,2 +1,2 @@
1
- !(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="033b7bbd-f219-583f-a43c-42ffdf535d9d")}catch(e2){}})();import{BUILTIN_ITEM_TYPE_VALUES,STATUS_VALUES}from"../../types/index.js";import{listPmCommandsForTier,resolvePmCommandVisibilityTier}from"../agent-capability-contracts.js";import{AGGREGATE_FLAG_CONTRACTS,APPEND_FLAG_CONTRACTS,CALENDAR_FLAG_CONTRACTS,CLOSE_MANY_FLAG_CONTRACTS,COMPLETION_FLAG_CONTRACTS,CONTEXT_FLAG_CONTRACTS,CONTRACTS_FLAG_CONTRACTS,COPY_FLAG_CONTRACTS,CREATE_FLAG_CONTRACTS,DEPS_FLAG_CONTRACTS,DUPLICATES_FLAG_CONTRACTS,EVENTS_FLAG_CONTRACTS,EXTENSION_FLAG_CONTRACTS,FOCUS_FLAG_CONTRACTS,GET_FLAG_CONTRACTS,GLOBAL_FLAG_CONTRACTS,GRAPH_FLAG_CONTRACTS,GUIDE_FLAG_CONTRACTS,HEALTH_FLAG_CONTRACTS,HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS,HISTORY_FLAG_CONTRACTS,INIT_FLAG_CONTRACTS,LIST_FILTER_FLAG_CONTRACTS,MEET_FLAG_CONTRACTS,NEXT_FLAG_CONTRACTS,PACKAGE_FLAG_CONTRACTS,PLAN_FLAG_CONTRACTS,PM_COMMAND_ALIAS_CONTRACTS,PM_NAMESPACED_COMMAND_ALIASES,REMIND_FLAG_CONTRACTS,SEARCH_FLAG_CONTRACTS,STATS_FLAG_CONTRACTS,UPDATE_FLAG_CONTRACTS,UPDATE_MANY_FLAG_CONTRACTS,UPGRADE_FLAG_CONTRACTS,resolvePmCommandOperation,resolveSubcommandFlagContractsForCommand,toCompletionFlagString}from"../cli-contracts.js";import{GLOBAL_VALUE_CONSUMING_FLAGS}from"../cli-contracts/bootstrap-command-scanner.js";import{WORKFLOW_POLICY_ACTIONS}from"../cli-contracts/enum-contracts.js";import{PM_COMMAND_DESTINATION_CONTRACTS}from"../cli-contracts/grammar-contracts.js";import{enrichCliFlagInvocationContracts}from"../flag-invocation-contracts.js";import{listGuideTopicIds}from"../guide-topics.js";const DEFAULT_ITEM_TYPES=[...BUILTIN_ITEM_TYPE_VALUES];const DEFAULT_STATUS_VALUES=[...STATUS_VALUES];const HIDDEN_COMMAND_ALIASES=new Set(PM_COMMAND_ALIAS_CONTRACTS.filter(contract=>contract.hidden).map(contract=>contract.alias));const ALL_COMMANDS=listPmCommandsForTier("full").filter(command=>!command.includes(" ")&&!HIDDEN_COMMAND_ALIASES.has(command));const LIST_FLAGS=toCompletionFlagString(LIST_FILTER_FLAG_CONTRACTS);const AGGREGATE_FLAGS=toCompletionFlagString(AGGREGATE_FLAG_CONTRACTS);const APPEND_FLAGS=toCompletionFlagString(APPEND_FLAG_CONTRACTS);const COPY_FLAGS=toCompletionFlagString(COPY_FLAG_CONTRACTS);const RESTORE_INVOCATIONS=enrichCliFlagInvocationContracts("restore",resolveSubcommandFlagContractsForCommand("restore"));const ATTEST_INVOCATIONS=enrichCliFlagInvocationContracts("history-attest",resolveSubcommandFlagContractsForCommand("history-attest"));const FOCUS_FLAGS=toCompletionFlagString(FOCUS_FLAG_CONTRACTS);const MEET_FLAGS=toCompletionFlagString(MEET_FLAG_CONTRACTS);const REMIND_FLAGS=toCompletionFlagString(REMIND_FLAG_CONTRACTS);const CREATE_FLAGS=toCompletionFlagString(CREATE_FLAG_CONTRACTS);const GET_FLAGS=toCompletionFlagString(GET_FLAG_CONTRACTS);const UPDATE_FLAGS=toCompletionFlagString(UPDATE_FLAG_CONTRACTS);const UPDATE_MANY_FLAGS=toCompletionFlagString(UPDATE_MANY_FLAG_CONTRACTS);const CLOSE_MANY_FLAGS=toCompletionFlagString(CLOSE_MANY_FLAG_CONTRACTS);const NAMESPACE_NOUNS=[...new Set(PM_NAMESPACED_COMMAND_ALIASES.map(entry=>entry.canonical_argv[0]))];const NAMESPACE_PREFIXES=[...new Set(PM_NAMESPACED_COMMAND_ALIASES.flatMap(entry=>entry.canonical_argv.slice(0,-1).map((_,index)=>entry.canonical_argv.slice(0,index+1).join(" "))))];const PACKAGE_NAMESPACE_OPERATIONS=new Set(PM_COMMAND_DESTINATION_CONTRACTS.filter(entry=>entry.disposition==="package_owned").map(entry=>resolvePmCommandOperation(entry.command)));const HISTORY_COMPLETION_ALIASES=PM_NAMESPACED_COMMAND_ALIASES.filter(entry=>entry.canonical_argv[0]==="history");const HISTORY_LEAVES=HISTORY_COMPLETION_ALIASES.map(entry=>entry.canonical_argv[1]).join(" ");function completionNamespaceLeaves(runtime){const available=new Set((runtime.namespace_commands??[]).map(resolvePmCommandOperation));const aliases=PM_NAMESPACED_COMMAND_ALIASES.filter(entry=>resolvePmCommandVisibilityTier(entry.canonical)!=="internal"&&(!PACKAGE_NAMESPACE_OPERATIONS.has(entry.alias)||available.has(entry.alias)));return Object.fromEntries(NAMESPACE_PREFIXES.map(prefix=>[prefix,[...new Set(aliases.filter(entry=>entry.canonical.startsWith(`${prefix} `)).map(entry=>entry.canonical_argv[prefix.split(" ").length]))].join(" ")]))}const HISTORY_OPERATION_FLAGS=HISTORY_COMPLETION_ALIASES.map(entry=>({...entry,flags:toCompletionFlagString(resolveSubcommandFlagContractsForCommand(entry.alias))}));const HISTORY_FLAGS=toCompletionFlagString(HISTORY_FLAG_CONTRACTS);const HISTORY_AUTHOR_ACKNOWLEDGE_FLAGS=toCompletionFlagString(HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS,false);const EVENTS_FLAGS=toCompletionFlagString(EVENTS_FLAG_CONTRACTS);const CALENDAR_FLAGS=toCompletionFlagString(CALENDAR_FLAG_CONTRACTS);const CONTEXT_FLAGS=toCompletionFlagString(CONTEXT_FLAG_CONTRACTS);const NEXT_FLAGS=toCompletionFlagString(NEXT_FLAG_CONTRACTS);const DEPS_FLAGS=toCompletionFlagString(DEPS_FLAG_CONTRACTS);const DUPLICATES_FLAGS=toCompletionFlagString(DUPLICATES_FLAG_CONTRACTS);const GRAPH_FLAGS=toCompletionFlagString(GRAPH_FLAG_CONTRACTS);const GUIDE_FLAGS=toCompletionFlagString(GUIDE_FLAG_CONTRACTS);const SEARCH_FLAGS=toCompletionFlagString(SEARCH_FLAG_CONTRACTS);const STATS_FLAGS=toCompletionFlagString(STATS_FLAG_CONTRACTS);const HEALTH_FLAGS=toCompletionFlagString(HEALTH_FLAG_CONTRACTS);const INIT_FLAGS=toCompletionFlagString(INIT_FLAG_CONTRACTS);const CONTRACTS_FLAGS=toCompletionFlagString(CONTRACTS_FLAG_CONTRACTS);const PLAN_FLAGS=toCompletionFlagString(PLAN_FLAG_CONTRACTS);const SCHEMA_SUBCOMMAND_CHOICES=`${WORKFLOW_POLICY_ACTIONS.join(" ")} list show show-status add-type remove-type add-status remove-status add-field remove-field list-fields show-field apply-preset rename-type rename-field remap-status`;const PLAN_SUBCOMMANDS_LIST="create show add-step update-step complete-step block-step reorder-step remove-step link unlink decision discovery validation resume approve materialize";const COMPLETION_FLAGS=toCompletionFlagString(COMPLETION_FLAG_CONTRACTS);const COMPLETION_SHELL_CHOICES=`${COMPLETION_FLAGS} bash zsh fish`;const GUIDE_TOPIC_CHOICES=joinCompletionValues(listGuideTopicIds());const EXTENSION_LIFECYCLE_ACTIONS="init scaffold install uninstall explore manage describe reload doctor catalog adopt adopt-all activate deactivate migrate";const PACKAGE_LIFECYCLE_ACTIONS=`${EXTENSION_LIFECYCLE_ACTIONS} upgrade`;const EXTENSION_LIFECYCLE_FLAGS=toCompletionFlagString(EXTENSION_FLAG_CONTRACTS);const PACKAGE_LIFECYCLE_FLAGS=toCompletionFlagString(PACKAGE_FLAG_CONTRACTS);const UPGRADE_FLAGS=toCompletionFlagString(UPGRADE_FLAG_CONTRACTS);const MUTATION_FLAGS="--author --message --force --json --quiet --no-changed-fields --id-only --pm-path --path --no-extensions --no-pager --profile --help";const DELETE_MUTATION_FLAGS="--dry-run --author --message --force --json --quiet --no-changed-fields --id-only --pm-path --path --no-extensions --no-pager --profile --help";const CLOSE_MUTATION_FLAGS=toCompletionFlagString(resolveSubcommandFlagContractsForCommand("close"));const CLOSE_TASK_MUTATION_FLAGS=toCompletionFlagString(resolveSubcommandFlagContractsForCommand("close-task"));const RELEASE_MUTATION_FLAGS=toCompletionFlagString(resolveSubcommandFlagContractsForCommand("release"));const CLAIM_MUTATION_FLAGS=toCompletionFlagString(resolveSubcommandFlagContractsForCommand("claim"));const COMMAND_COMPLETION_DESCRIPTIONS=[["init","Initialize pm storage for the current workspace"],["config","Read or update pm settings"],["package","Manage package lifecycle operations"],["packages","Alias for package"],["create","Create a new project management item"],["item","Manage item evidence, links, tests, and duplication"],["copy","Copy an existing item to a new ID"],["focus","Set/clear/show the session focused parent for new items"],["list","List active items with optional filters"],["aggregate","Aggregate grouped item counts and numeric stats for governance queries"],["duplicates","Find bounded duplicate clusters across lifecycle statuses"],["guide","Browse local progressive-disclosure guides"],["calendar","Show calendar views for deadlines and reminders"],["cal","Alias for calendar"],["context","Show a token-efficient project context snapshot"],["ctx","Alias for context"],["get","Show item details by ID"],["next","Recommend the next actionable (unblocked, ready) work item"],["search","Search items with keyword, semantic, or hybrid modes"],["reindex","Rebuild search artifacts"],["history","Show item history entries"],["history-compact","Compact history streams into a synthetic baseline + retained tail"],["history-redact","Redact sensitive literals/patterns and recompute history hashes"],["history-repair","Re-anchor a drifted history chain so pm health/validate report ok"],["schema","Manage custom item types and statuses in .agents/pm/schema/*.json"],["profile","List, show, apply, and lint project profiles (archetype schema/config/template/package bundles)"],["plan","Agent-optimized Plan item workflow (create/show/add-step/update-step/complete-step/link/approve/materialize)"],["activity","Show recent activity across items"],["restore","Restore an item to an earlier state"],["update","Update item fields and metadata"],["update-many","Bulk-update matched items with dry-run and rollback checkpoints"],["close","Close an item (reason requirement follows governance settings)"],["close-many","Bulk-close matched items with an optional shared reason and rollback checkpoint"],["delete","Delete an item and record the change"],["append","Append text to an item body"],["comments","List or add comments for an item"],["notes","List or add notes for an item"],["learnings","List or add learnings for an item"],["files","Manage linked files"],["docs","Manage linked docs"],["deps","Show dependency relationships for an item"],["graph","Bounded graph traversal, analytics, and governance-audit queries"],["test","Manage linked tests and optionally run them"],["test-all","Run linked tests across matching items"],["test-runs","Manage background linked-test runs"],["stats","Show project tracker statistics"],["health","Show project tracker health checks"],["validate","Run standalone validation checks"],["gc","Clean optional cache artifacts"],["contracts","Show machine-readable command and schema contracts"],["claim","Claim an item for active work"],["release","Release the active claim for an item"],["start-task","Lifecycle alias to claim and set in_progress"],["pause-task","Lifecycle alias to reopen and release claim"],["close-task","Lifecycle alias to close and release claim"],["meet","Shortcut to create a Meeting with scheduling defaults"],["event","Shortcut to create an Event with scheduling defaults"],["remind","Shortcut to create a Reminder from a point in time"],["templates","Manage reusable create templates"],["completion","Generate shell completion"],["help","Display help for a command"]];const GLOBAL_FLAGS=GLOBAL_FLAG_CONTRACTS.flatMap(entry=>[entry.short,entry.flag,...entry.aliases??[]]).filter(value=>Boolean(value)).join(" ");const GLOBAL_COMPLETION_VALUE_PATTERNS=[...GLOBAL_VALUE_CONSUMING_FLAGS].join("|");const GLOBAL_COMPLETION_INLINE_PATTERNS=[...GLOBAL_VALUE_CONSUMING_FLAGS].map(flag=>`${flag}=*`).join("|");const GLOBAL_COMPLETION_SWITCH_PATTERNS=[...GLOBAL_FLAGS.split(" ").filter(flag=>!GLOBAL_VALUE_CONSUMING_FLAGS.has(flag)),"-h","-V"].join("|");function joinCompletionValues(values){return[...new Set(values.map(value=>value.trim()).filter(value=>value.length>0))].sort((left,right)=>left.localeCompare(right)).join(" ")}function joinCompletionValuesInOrder(values){return[...new Set(values.map(value=>value.trim()).filter(value=>value.length>0))].join(" ")}function shellDoubleQuote(value){return value.replaceAll("\\","\\\\").replaceAll('"','\\"').replaceAll("$","\\$").replaceAll("`","\\`")}function completionTypeValues(itemTypes,runtime){return joinCompletionValuesInOrder(itemTypes.length>0?itemTypes:runtime.item_types??DEFAULT_ITEM_TYPES)}function completionStatusValues(runtime){return joinCompletionValues(runtime.statuses??DEFAULT_STATUS_VALUES)}function mergeFlagStrings(baseFlags,runtimeFlags){const merged=[...baseFlags.split(/\s+/u).filter(value=>value.length>0),...runtimeFlags??[]];return joinCompletionValues(merged)}function normalizeRuntimeCompletionFlags(runtimeFlags){const normalized=(runtimeFlags??[]).map(value=>value.trim()).filter(value=>value.startsWith("--")&&value.length>2).map(value=>`--${value.slice(2).replaceAll("_","-")}`);return[...new Set(normalized)].sort((left,right)=>left.localeCompare(right))}export{AGGREGATE_FLAGS,ALL_COMMANDS,APPEND_FLAGS,ATTEST_INVOCATIONS,CALENDAR_FLAGS,CLAIM_MUTATION_FLAGS,CLOSE_MANY_FLAGS,CLOSE_MUTATION_FLAGS,CLOSE_TASK_MUTATION_FLAGS,COMMAND_COMPLETION_DESCRIPTIONS,COMPLETION_SHELL_CHOICES,CONTEXT_FLAGS,CONTRACTS_FLAGS,COPY_FLAGS,CREATE_FLAGS,DELETE_MUTATION_FLAGS,DEPS_FLAGS,DUPLICATES_FLAGS,EVENTS_FLAGS,EXTENSION_LIFECYCLE_ACTIONS,EXTENSION_LIFECYCLE_FLAGS,FOCUS_FLAGS,GET_FLAGS,GLOBAL_COMPLETION_INLINE_PATTERNS,GLOBAL_COMPLETION_SWITCH_PATTERNS,GLOBAL_COMPLETION_VALUE_PATTERNS,GLOBAL_FLAGS,GRAPH_FLAGS,GUIDE_FLAGS,GUIDE_TOPIC_CHOICES,HEALTH_FLAGS,HIDDEN_COMMAND_ALIASES,HISTORY_AUTHOR_ACKNOWLEDGE_FLAGS,HISTORY_FLAGS,HISTORY_LEAVES,HISTORY_OPERATION_FLAGS,INIT_FLAGS,LIST_FLAGS,MEET_FLAGS,MUTATION_FLAGS,NAMESPACE_NOUNS,NAMESPACE_PREFIXES,NEXT_FLAGS,PACKAGE_LIFECYCLE_ACTIONS,PACKAGE_LIFECYCLE_FLAGS,PLAN_FLAGS,PLAN_SUBCOMMANDS_LIST,RELEASE_MUTATION_FLAGS,REMIND_FLAGS,RESTORE_INVOCATIONS,SCHEMA_SUBCOMMAND_CHOICES,SEARCH_FLAGS,STATS_FLAGS,UPDATE_FLAGS,UPDATE_MANY_FLAGS,UPGRADE_FLAGS,completionNamespaceLeaves,completionStatusValues,completionTypeValues,joinCompletionValues,mergeFlagStrings,normalizeRuntimeCompletionFlags,shellDoubleQuote};
1
+ !(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="be171aef-09e7-5f87-9605-1d47ca665440")}catch(e2){}})();import{BUILTIN_ITEM_TYPE_VALUES,STATUS_VALUES}from"../../types/index.js";import{listPmCommandsForTier,resolvePmCommandVisibilityTier}from"../agent-capability-contracts.js";import{AGGREGATE_FLAG_CONTRACTS,APPEND_FLAG_CONTRACTS,CALENDAR_FLAG_CONTRACTS,CLOSE_MANY_FLAG_CONTRACTS,COMPLETION_FLAG_CONTRACTS,CONTEXT_FLAG_CONTRACTS,CONTRACTS_FLAG_CONTRACTS,COPY_FLAG_CONTRACTS,CREATE_FLAG_CONTRACTS,DEPS_FLAG_CONTRACTS,DUPLICATES_FLAG_CONTRACTS,EVENTS_FLAG_CONTRACTS,EXTENSION_FLAG_CONTRACTS,FOCUS_FLAG_CONTRACTS,GET_FLAG_CONTRACTS,GLOBAL_FLAG_CONTRACTS,GRAPH_FLAG_CONTRACTS,GUIDE_FLAG_CONTRACTS,HEALTH_FLAG_CONTRACTS,HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS,HISTORY_FLAG_CONTRACTS,INIT_FLAG_CONTRACTS,LIST_FILTER_FLAG_CONTRACTS,MEET_FLAG_CONTRACTS,NEXT_FLAG_CONTRACTS,PACKAGE_FLAG_CONTRACTS,PLAN_FLAG_CONTRACTS,PM_COMMAND_ALIAS_CONTRACTS,PM_NAMESPACED_COMMAND_ALIASES,REMIND_FLAG_CONTRACTS,SEARCH_FLAG_CONTRACTS,STATS_FLAG_CONTRACTS,UPDATE_FLAG_CONTRACTS,UPDATE_MANY_FLAG_CONTRACTS,UPGRADE_FLAG_CONTRACTS,resolvePmCommandOperation,resolveSubcommandFlagContractsForCommand,toCompletionFlagString}from"../cli-contracts.js";import{GLOBAL_VALUE_CONSUMING_FLAGS}from"../cli-contracts/bootstrap-command-scanner.js";import{WORKFLOW_POLICY_ACTIONS}from"../cli-contracts/enum-contracts.js";import{PM_COMMAND_DESTINATION_CONTRACTS}from"../cli-contracts/grammar-contracts.js";import{enrichCliFlagInvocationContracts}from"../flag-invocation-contracts.js";import{listGuideTopicIds}from"../guide-topics.js";const DEFAULT_ITEM_TYPES=[...BUILTIN_ITEM_TYPE_VALUES];const DEFAULT_STATUS_VALUES=[...STATUS_VALUES];const HIDDEN_COMMAND_ALIASES=new Set(PM_COMMAND_ALIAS_CONTRACTS.filter(contract=>contract.hidden).map(contract=>contract.alias));const ALL_COMMANDS=listPmCommandsForTier("full").filter(command=>!command.includes(" ")&&!HIDDEN_COMMAND_ALIASES.has(command));const LIST_FLAGS=toCompletionFlagString(LIST_FILTER_FLAG_CONTRACTS);const AGGREGATE_FLAGS=toCompletionFlagString(AGGREGATE_FLAG_CONTRACTS);const APPEND_FLAGS=toCompletionFlagString(APPEND_FLAG_CONTRACTS);const COPY_FLAGS=toCompletionFlagString(COPY_FLAG_CONTRACTS);const RESTORE_INVOCATIONS=enrichCliFlagInvocationContracts("restore",resolveSubcommandFlagContractsForCommand("restore"));const ATTEST_INVOCATIONS=enrichCliFlagInvocationContracts("history-attest",resolveSubcommandFlagContractsForCommand("history-attest"));const FOCUS_FLAGS=toCompletionFlagString(FOCUS_FLAG_CONTRACTS);const MEET_FLAGS=toCompletionFlagString(MEET_FLAG_CONTRACTS);const REMIND_FLAGS=toCompletionFlagString(REMIND_FLAG_CONTRACTS);const CREATE_FLAGS=toCompletionFlagString(CREATE_FLAG_CONTRACTS);const GET_FLAGS=toCompletionFlagString(GET_FLAG_CONTRACTS);const UPDATE_FLAGS=toCompletionFlagString(UPDATE_FLAG_CONTRACTS);const UPDATE_MANY_FLAGS=toCompletionFlagString(UPDATE_MANY_FLAG_CONTRACTS);const CLOSE_MANY_FLAGS=toCompletionFlagString(CLOSE_MANY_FLAG_CONTRACTS);const NAMESPACE_NOUNS=[...new Set(PM_NAMESPACED_COMMAND_ALIASES.map(entry=>entry.canonical_argv[0]))];const NAMESPACE_PREFIXES=[...new Set(PM_NAMESPACED_COMMAND_ALIASES.flatMap(entry=>entry.canonical_argv.slice(0,-1).map((_,index)=>entry.canonical_argv.slice(0,index+1).join(" "))))];const PACKAGE_NAMESPACE_OPERATIONS=new Set(PM_COMMAND_DESTINATION_CONTRACTS.filter(entry=>entry.disposition==="package_owned").map(entry=>resolvePmCommandOperation(entry.command)));const HISTORY_COMPLETION_ALIASES=PM_NAMESPACED_COMMAND_ALIASES.filter(entry=>entry.canonical_argv[0]==="history");const HISTORY_LEAVES=HISTORY_COMPLETION_ALIASES.map(entry=>entry.canonical_argv[1]).join(" ");function completionNamespaceLeaves(runtime){const available=new Set((runtime.namespace_commands??[]).map(resolvePmCommandOperation));const aliases=PM_NAMESPACED_COMMAND_ALIASES.filter(entry=>resolvePmCommandVisibilityTier(entry.canonical)!=="internal"&&(!PACKAGE_NAMESPACE_OPERATIONS.has(entry.alias)||available.has(entry.alias)));return Object.fromEntries(NAMESPACE_PREFIXES.map(prefix=>[prefix,[...new Set(aliases.filter(entry=>entry.canonical.startsWith(`${prefix} `)).map(entry=>entry.canonical_argv[prefix.split(" ").length]))].join(" ")]))}const HISTORY_OPERATION_FLAGS=HISTORY_COMPLETION_ALIASES.map(entry=>({...entry,flags:toCompletionFlagString(resolveSubcommandFlagContractsForCommand(entry.alias))}));const HISTORY_FLAGS=toCompletionFlagString(HISTORY_FLAG_CONTRACTS);const HISTORY_AUTHOR_ACKNOWLEDGE_FLAGS=toCompletionFlagString(HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS,false);const EVENTS_FLAGS=toCompletionFlagString(EVENTS_FLAG_CONTRACTS);const CALENDAR_FLAGS=toCompletionFlagString(CALENDAR_FLAG_CONTRACTS);const CONTEXT_FLAGS=toCompletionFlagString(CONTEXT_FLAG_CONTRACTS);const NEXT_FLAGS=toCompletionFlagString(NEXT_FLAG_CONTRACTS);const DEPS_FLAGS=toCompletionFlagString(DEPS_FLAG_CONTRACTS);const DUPLICATES_FLAGS=toCompletionFlagString(DUPLICATES_FLAG_CONTRACTS);const GRAPH_FLAGS=toCompletionFlagString(GRAPH_FLAG_CONTRACTS);const GUIDE_FLAGS=toCompletionFlagString(GUIDE_FLAG_CONTRACTS);const SEARCH_FLAGS=toCompletionFlagString(SEARCH_FLAG_CONTRACTS);const STATS_FLAGS=toCompletionFlagString(STATS_FLAG_CONTRACTS);const HEALTH_FLAGS=toCompletionFlagString(HEALTH_FLAG_CONTRACTS);const INIT_FLAGS=toCompletionFlagString(INIT_FLAG_CONTRACTS);const CONTRACTS_FLAGS=toCompletionFlagString(CONTRACTS_FLAG_CONTRACTS);const PLAN_FLAGS=toCompletionFlagString(PLAN_FLAG_CONTRACTS);const SCHEMA_SUBCOMMAND_CHOICES=`${WORKFLOW_POLICY_ACTIONS.join(" ")} list show show-status add-type remove-type add-status remove-status add-field remove-field list-fields show-field apply-preset rename-type rename-field remap-status`;const PLAN_SUBCOMMANDS_LIST="create show add-step update-step complete-step block-step reorder-step remove-step link unlink decision discovery validation resume approve materialize";const COMPLETION_FLAGS=toCompletionFlagString(COMPLETION_FLAG_CONTRACTS);const COMPLETION_SHELL_CHOICES=`${COMPLETION_FLAGS} bash zsh fish`;const GUIDE_TOPIC_CHOICES=joinCompletionValues(listGuideTopicIds());const EXTENSION_LIFECYCLE_ACTIONS="init scaffold install uninstall explore manage describe reload doctor catalog adopt adopt-all activate deactivate migrate";const PACKAGE_LIFECYCLE_ACTIONS=`${EXTENSION_LIFECYCLE_ACTIONS} upgrade`;const EXTENSION_LIFECYCLE_FLAGS=toCompletionFlagString(EXTENSION_FLAG_CONTRACTS);const PACKAGE_LIFECYCLE_FLAGS=toCompletionFlagString(PACKAGE_FLAG_CONTRACTS);const UPGRADE_FLAGS=toCompletionFlagString(UPGRADE_FLAG_CONTRACTS);const MUTATION_FLAGS="--author --message --force --json --quiet --no-changed-fields --id-only --pm-path --path --no-extensions --no-pager --profile --help";const DELETE_MUTATION_FLAGS="--dry-run --author --message --force --json --quiet --no-changed-fields --id-only --pm-path --path --no-extensions --no-pager --profile --help";const CLOSE_MUTATION_FLAGS=toCompletionFlagString(resolveSubcommandFlagContractsForCommand("close"));const CLOSE_TASK_MUTATION_FLAGS=toCompletionFlagString(resolveSubcommandFlagContractsForCommand("close-task"));const RELEASE_MUTATION_FLAGS=toCompletionFlagString(resolveSubcommandFlagContractsForCommand("release"));const CLAIM_MUTATION_FLAGS=toCompletionFlagString(resolveSubcommandFlagContractsForCommand("claim"));const COMMAND_COMPLETION_DESCRIPTIONS=[["workspace","Workspace initialization, customization, state and snapshots"],["init","Initialize pm storage for the current workspace"],["config","Read or update pm settings"],["package","Manage package lifecycle operations"],["packages","Alias for package"],["create","Create a new project management item"],["item","Manage item evidence, links, tests, and duplication"],["copy","Copy an existing item to a new ID"],["focus","Set/clear/show the session focused parent for new items"],["list","List active items with optional filters"],["aggregate","Aggregate grouped item counts and numeric stats for governance queries"],["duplicates","Find bounded duplicate clusters across lifecycle statuses"],["guide","Browse local progressive-disclosure guides"],["calendar","Show calendar views for deadlines and reminders"],["cal","Alias for calendar"],["context","Show a token-efficient project context snapshot"],["ctx","Alias for context"],["get","Show item details by ID"],["next","Recommend the next actionable (unblocked, ready) work item"],["search","Search items with keyword, semantic, or hybrid modes"],["reindex","Rebuild search artifacts"],["history","Show item history entries"],["history-compact","Compact history streams into a synthetic baseline + retained tail"],["history-redact","Redact sensitive literals/patterns and recompute history hashes"],["history-repair","Re-anchor a drifted history chain so pm health/validate report ok"],["schema","Manage custom item types and statuses in .agents/pm/schema/*.json"],["profile","List, show, apply, and lint project profiles (archetype schema/config/template/package bundles)"],["plan","Agent-optimized Plan item workflow (create/show/add-step/update-step/complete-step/link/approve/materialize)"],["activity","Show recent activity across items"],["restore","Restore an item to an earlier state"],["update","Update item fields and metadata"],["update-many","Bulk-update matched items with dry-run and rollback checkpoints"],["close","Close an item (reason requirement follows governance settings)"],["close-many","Bulk-close matched items with an optional shared reason and rollback checkpoint"],["delete","Delete an item and record the change"],["append","Append text to an item body"],["comments","List or add comments for an item"],["notes","List or add notes for an item"],["learnings","List or add learnings for an item"],["files","Manage linked files"],["docs","Manage linked docs"],["deps","Show dependency relationships for an item"],["graph","Bounded graph traversal, analytics, and governance-audit queries"],["test","Manage linked tests and optionally run them"],["test-all","Run linked tests across matching items"],["test-runs","Manage background linked-test runs"],["stats","Show project tracker statistics"],["health","Show project tracker health checks"],["validate","Run standalone validation checks"],["gc","Clean optional cache artifacts"],["contracts","Show machine-readable command and schema contracts"],["claim","Claim an item for active work"],["release","Release the active claim for an item"],["start-task","Lifecycle alias to claim and set in_progress"],["pause-task","Lifecycle alias to reopen and release claim"],["close-task","Lifecycle alias to close and release claim"],["meet","Shortcut to create a Meeting with scheduling defaults"],["event","Shortcut to create an Event with scheduling defaults"],["remind","Shortcut to create a Reminder from a point in time"],["templates","Manage reusable create templates"],["completion","Generate shell completion"],["help","Display help for a command"]];const GLOBAL_FLAGS=GLOBAL_FLAG_CONTRACTS.flatMap(entry=>[entry.short,entry.flag,...entry.aliases??[]]).filter(value=>Boolean(value)).join(" ");const GLOBAL_COMPLETION_VALUE_PATTERNS=[...GLOBAL_VALUE_CONSUMING_FLAGS].join("|");const GLOBAL_COMPLETION_INLINE_PATTERNS=[...GLOBAL_VALUE_CONSUMING_FLAGS].map(flag=>`${flag}=*`).join("|");const GLOBAL_COMPLETION_SWITCH_PATTERNS=[...GLOBAL_FLAGS.split(" ").filter(flag=>!GLOBAL_VALUE_CONSUMING_FLAGS.has(flag)),"-h","-V"].join("|");function joinCompletionValues(values){return[...new Set(values.map(value=>value.trim()).filter(value=>value.length>0))].sort((left,right)=>left.localeCompare(right)).join(" ")}function joinCompletionValuesInOrder(values){return[...new Set(values.map(value=>value.trim()).filter(value=>value.length>0))].join(" ")}function shellDoubleQuote(value){return value.replaceAll("\\","\\\\").replaceAll('"','\\"').replaceAll("$","\\$").replaceAll("`","\\`")}function completionTypeValues(itemTypes,runtime){return joinCompletionValuesInOrder(itemTypes.length>0?itemTypes:runtime.item_types??DEFAULT_ITEM_TYPES)}function completionStatusValues(runtime){return joinCompletionValues(runtime.statuses??DEFAULT_STATUS_VALUES)}function mergeFlagStrings(baseFlags,runtimeFlags){const merged=[...baseFlags.split(/\s+/u).filter(value=>value.length>0),...runtimeFlags??[]];return joinCompletionValues(merged)}function normalizeRuntimeCompletionFlags(runtimeFlags){const normalized=(runtimeFlags??[]).map(value=>value.trim()).filter(value=>value.startsWith("--")&&value.length>2).map(value=>`--${value.slice(2).replaceAll("_","-")}`);return[...new Set(normalized)].sort((left,right)=>left.localeCompare(right))}export{AGGREGATE_FLAGS,ALL_COMMANDS,APPEND_FLAGS,ATTEST_INVOCATIONS,CALENDAR_FLAGS,CLAIM_MUTATION_FLAGS,CLOSE_MANY_FLAGS,CLOSE_MUTATION_FLAGS,CLOSE_TASK_MUTATION_FLAGS,COMMAND_COMPLETION_DESCRIPTIONS,COMPLETION_SHELL_CHOICES,CONTEXT_FLAGS,CONTRACTS_FLAGS,COPY_FLAGS,CREATE_FLAGS,DELETE_MUTATION_FLAGS,DEPS_FLAGS,DUPLICATES_FLAGS,EVENTS_FLAGS,EXTENSION_LIFECYCLE_ACTIONS,EXTENSION_LIFECYCLE_FLAGS,FOCUS_FLAGS,GET_FLAGS,GLOBAL_COMPLETION_INLINE_PATTERNS,GLOBAL_COMPLETION_SWITCH_PATTERNS,GLOBAL_COMPLETION_VALUE_PATTERNS,GLOBAL_FLAGS,GRAPH_FLAGS,GUIDE_FLAGS,GUIDE_TOPIC_CHOICES,HEALTH_FLAGS,HIDDEN_COMMAND_ALIASES,HISTORY_AUTHOR_ACKNOWLEDGE_FLAGS,HISTORY_FLAGS,HISTORY_LEAVES,HISTORY_OPERATION_FLAGS,INIT_FLAGS,LIST_FLAGS,MEET_FLAGS,MUTATION_FLAGS,NAMESPACE_NOUNS,NAMESPACE_PREFIXES,NEXT_FLAGS,PACKAGE_LIFECYCLE_ACTIONS,PACKAGE_LIFECYCLE_FLAGS,PLAN_FLAGS,PLAN_SUBCOMMANDS_LIST,RELEASE_MUTATION_FLAGS,REMIND_FLAGS,RESTORE_INVOCATIONS,SCHEMA_SUBCOMMAND_CHOICES,SEARCH_FLAGS,STATS_FLAGS,UPDATE_FLAGS,UPDATE_MANY_FLAGS,UPGRADE_FLAGS,completionNamespaceLeaves,completionStatusValues,completionTypeValues,joinCompletionValues,mergeFlagStrings,normalizeRuntimeCompletionFlags,shellDoubleQuote};
2
2
  //# sourceMappingURL=shared.js.map
@@ -0,0 +1,54 @@
1
+ /** One read failure or malformed document that prevents a complete inventory. */
2
+ export interface StaticExtensionInventoryError {
3
+ /** Stable machine-readable reason. */
4
+ code: "settings_invalid" | "settings_unreadable" | "managed_state_invalid" | "managed_state_unreadable" | "extensions_unreadable" | "manifest_invalid" | "manifest_unreadable";
5
+ /** File or directory whose read failed. */
6
+ path: string;
7
+ }
8
+ /** A configured package; runtime activation has deliberately not been tested. */
9
+ export interface StaticExtensionInventoryEntry {
10
+ /** Manifest name, or directory name when the manifest is malformed. */
11
+ name: string;
12
+ /** Extension directory basename. */
13
+ directory: string | null;
14
+ /** Selected storage scope. */
15
+ scope: "project" | "global";
16
+ /** Whether an installed directory was found. */
17
+ installed: boolean;
18
+ /** Installed, disabled, absent, or unreadable manifest outcome. */
19
+ status: "installed" | "inactive" | "absent" | "malformed_manifest";
20
+ /** Effective configured state; null when settings cannot be trusted. */
21
+ configured_enabled: boolean | null;
22
+ /** Whether managed metadata identifies this install; null when that metadata is invalid. */
23
+ managed: boolean | null;
24
+ /** Runtime state is never inferred from configuration. */
25
+ runtime_active: null;
26
+ /** Manifest version when available. */
27
+ version?: string;
28
+ }
29
+ /** A read-only inventory with explicit completeness and source receipts. */
30
+ export interface StaticExtensionInventoryResult {
31
+ /** Selected storage scope. */
32
+ scope: "project" | "global";
33
+ /** False if any source could not be read or parsed completely. */
34
+ complete: boolean;
35
+ /** Status of the two configuration sources. */
36
+ settings_status: "ok" | "absent" | "invalid" | "unreadable";
37
+ /** Status of the managed install metadata. */
38
+ managed_state_status: "ok" | "absent" | "invalid" | "unreadable";
39
+ /** Installed entries, or one absent entry for a missing requested name. */
40
+ extensions: StaticExtensionInventoryEntry[];
41
+ /** Every failure that affected completeness. */
42
+ errors: StaticExtensionInventoryError[];
43
+ }
44
+ /** Read configured extension state through filesystem reads only. */
45
+ export declare function inspectStaticExtensionInventory(options: {
46
+ /** Tracker root for the project scope. */
47
+ pmRoot: string;
48
+ /** Storage scope; project is the default. */
49
+ scope?: "project" | "global";
50
+ /** Optional name or directory to inspect, including absent installs. */
51
+ name?: string;
52
+ /** Base directory used to resolve the global PM root. */
53
+ cwd?: string;
54
+ }): Promise<StaticExtensionInventoryResult>;
@@ -0,0 +1,2 @@
1
+ !(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1dead22c-ea8e-5a98-bc73-8de82bbb4dcc")}catch(e2){}})();import fs from"node:fs/promises";import path from"node:path";import{resolveGlobalPmRoot}from"../../core/store/paths.js";import{normalizeManagedState}from"./managed-state.js";import{normalizeExtensionNameForMatch,normalizeStringList,parseExtensionManifest}from"./shared.js";function isMissing(error){return typeof error==="object"&&error!==null&&"code"in error&&error.code==="ENOENT"}function isTrustedSourceStatus(status){return status!=="invalid"&&status!=="unreadable"}function parseEnablement(raw){const parsed=JSON.parse(raw);if(typeof parsed!=="object"||parsed===null||Array.isArray(parsed))throw new SyntaxError("Invalid settings object");const configured=parsed.extensions;if(configured===void 0)return{enabled:[],disabled:[]};if(typeof configured!=="object"||configured===null||Array.isArray(configured))throw new SyntaxError("Invalid extensions settings");const value=configured;if(value.enabled!==void 0&&(!Array.isArray(value.enabled)||!value.enabled.every(entry=>typeof entry==="string"))||value.disabled!==void 0&&(!Array.isArray(value.disabled)||!value.disabled.every(entry=>typeof entry==="string"))){throw new SyntaxError("Invalid extension enablement lists")}return{enabled:value.enabled??[],disabled:value.disabled??[]}}async function readEnablement(settingsPath){let raw;try{raw=await fs.readFile(settingsPath,"utf8")}catch(error){if(isMissing(error))return{status:"absent",enabled:[],disabled:[]};return{status:"unreadable",enabled:[],disabled:[],error:{code:"settings_unreadable",path:settingsPath}}}try{return{status:"ok",...parseEnablement(raw)}}catch{return{status:"invalid",enabled:[],disabled:[],error:{code:"settings_invalid",path:settingsPath}}}}async function readManagedRecords(managedPath){let raw;try{raw=await fs.readFile(managedPath,"utf8")}catch(error){if(isMissing(error))return{status:"absent",entries:[]};return{status:"unreadable",entries:[],error:{code:"managed_state_unreadable",path:managedPath}}}try{const parsed=JSON.parse(raw);const normalized=normalizeManagedState(parsed);if(!normalized||typeof parsed!=="object"||parsed===null||!Array.isArray(parsed.entries)||normalized.entries.length!==parsed.entries.length){throw new SyntaxError("Invalid managed extension state")}return{status:"ok",entries:normalized.entries}}catch{return{status:"invalid",entries:[],error:{code:"managed_state_invalid",path:managedPath}}}}async function readExtensionDirectories(extensionsRoot){try{const directories=(await fs.readdir(extensionsRoot,{withFileTypes:true})).filter(entry=>entry.isDirectory()).map(entry=>entry.name).sort((left,right)=>left.localeCompare(right));return{directories}}catch(error){if(isMissing(error))return{directories:[]};return{directories:[],error:{code:"extensions_unreadable",path:extensionsRoot}}}}async function readManifest(manifestPath){let raw;try{raw=await fs.readFile(manifestPath,"utf8")}catch(error){if(isMissing(error)){return{manifest:null,error:{code:"manifest_invalid",path:manifestPath}}}return{manifest:null,error:{code:"manifest_unreadable",path:manifestPath}}}try{const manifest=parseExtensionManifest(JSON.parse(raw));return manifest?{manifest}:{manifest:null,error:{code:"manifest_invalid",path:manifestPath}}}catch{return{manifest:null,error:{code:"manifest_invalid",path:manifestPath}}}}function projectConfiguredEntry(input){const name=input.manifest?.name??input.directory;const enabled=new Set(normalizeStringList(input.settings.enabled));const disabled=new Set(normalizeStringList(input.settings.disabled));const configuredEnabled=!isTrustedSourceStatus(input.settings.status)||!input.manifest?null:!disabled.has(name)&&(enabled.size===0||enabled.has(name));const managed=!isTrustedSourceStatus(input.managed.status)?null:input.managed.entries.some(entry=>normalizeExtensionNameForMatch(entry.name)===normalizeExtensionNameForMatch(name)||normalizeExtensionNameForMatch(entry.directory)===normalizeExtensionNameForMatch(input.directory));return{name,directory:input.directory,scope:input.scope,installed:true,status:input.manifest?configuredEnabled===false?"inactive":"installed":"malformed_manifest",configured_enabled:configuredEnabled,managed,runtime_active:null,...input.manifest?{version:input.manifest.version}:{}}}async function inspectStaticExtensionInventory(options){const scope=options.scope??"project";const selectedRoot=scope==="global"?resolveGlobalPmRoot(options.cwd??process.cwd()):options.pmRoot;const extensionsRoot=path.join(selectedRoot,"extensions");const settings=await readEnablement(path.join(selectedRoot,"settings.json"));const managed=await readManagedRecords(path.join(extensionsRoot,".managed-extensions.json"));const listed=await readExtensionDirectories(extensionsRoot);const errors=[];for(const source of[settings,managed,listed]){if(source.error)errors.push(source.error)}const requested=options.name?.trim();const extensions=[];for(const directory of listed.directories){const manifestPath=path.join(extensionsRoot,directory,"manifest.json");const inspected=await readManifest(manifestPath);if(inspected.error)errors.push(inspected.error);const entry=projectConfiguredEntry({directory,scope,manifest:inspected.manifest,settings,managed});if(requested&&![entry.name,directory].some(value=>normalizeExtensionNameForMatch(value)===normalizeExtensionNameForMatch(requested))){continue}extensions.push(entry)}if(requested&&extensions.length===0&&errors.every(error=>error.code!=="extensions_unreadable")){extensions.push({name:requested,directory:null,scope,installed:false,status:"absent",configured_enabled:isTrustedSourceStatus(settings.status)?false:null,managed:isTrustedSourceStatus(managed.status)?false:null,runtime_active:null})}return{scope,complete:errors.length===0,settings_status:settings.status,managed_state_status:managed.status,extensions,errors}}export{inspectStaticExtensionInventory};
2
+ //# sourceMappingURL=static-inventory.js.map