@unbrained/pm-cli 2026.9.8 → 2026.9.9

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 (144) hide show
  1. package/.agents/skills/pm-user/SKILL.md +2 -2
  2. package/.agents/skills/pm-user/references/ECOSYSTEM_PLANNING.md +1 -1
  3. package/.claude-plugin/marketplace.json +2 -2
  4. package/CHANGELOG.md +21 -2
  5. package/dist/cli/register-list-query.js +4 -4
  6. package/dist/cli/register-mutation.d.ts +0 -5
  7. package/dist/cli/register-mutation.js +2 -2
  8. package/dist/cli/register-operations.js +1 -1
  9. package/dist/cli-bundle/bundle-manifest.json +150 -150
  10. package/dist/cli-bundle/chunks/{chunk-G5ADGQ2D.js → chunk-3IPRM75M.js} +2 -2
  11. package/dist/cli-bundle/chunks/{chunk-LEZOUXG6.js → chunk-4VL5P22L.js} +2 -2
  12. package/dist/cli-bundle/chunks/chunk-AAFBV3U3.js +29 -0
  13. package/dist/cli-bundle/chunks/{chunk-XOD2PCB6.js → chunk-D3YVILJJ.js} +2 -2
  14. package/dist/cli-bundle/chunks/chunk-ECBLPN7B.js +3 -0
  15. package/dist/cli-bundle/chunks/chunk-J6ERHBV2.js +235 -0
  16. package/dist/cli-bundle/chunks/{chunk-RHSFOMHU.js → chunk-JUNJ5EKI.js} +2 -2
  17. package/dist/cli-bundle/chunks/{chunk-JAAEYHUA.js → chunk-L5RCDKQ2.js} +2 -2
  18. package/dist/cli-bundle/chunks/{chunk-FLDWYEND.js → chunk-OHNLSGGV.js} +62 -60
  19. package/dist/cli-bundle/chunks/chunk-WQKMSFBV.js +5 -0
  20. package/dist/cli-bundle/chunks/{chunk-DAM4CBBR.js → chunk-XZ6T7YPP.js} +72 -57
  21. package/dist/cli-bundle/chunks/{chunk-YVEQ2AMO.js → chunk-Z3XVXUVF.js} +2 -2
  22. package/dist/cli-bundle/chunks/{register-list-query-KSK3R63M.js → register-list-query-UIHRCS6D.js} +7 -7
  23. package/dist/cli-bundle/chunks/register-mutation-WHWMGRVX.js +20 -0
  24. package/dist/cli-bundle/chunks/register-operations-64YZYTC5.js +2 -0
  25. package/dist/cli-bundle/chunks/{register-setup-BQ5SVD4B.js → register-setup-PERI45EM.js} +2 -2
  26. package/dist/cli-bundle/focused-chunks/{chunk-KOOMJ54F.js → chunk-2W4XIYOB.js} +2 -2
  27. package/dist/cli-bundle/focused-chunks/chunk-2WSBXIGF.js +12 -0
  28. package/dist/cli-bundle/focused-chunks/{chunk-3WRPWLA7.js → chunk-5FHTCOHS.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/chunk-7N6DOREF.js +26 -0
  30. package/dist/cli-bundle/focused-chunks/{chunk-RMWES4M6.js → chunk-7PC4R5QB.js} +2 -2
  31. package/dist/cli-bundle/focused-chunks/{chunk-HJVARYM3.js → chunk-BUCJUZVG.js} +2 -2
  32. package/dist/cli-bundle/focused-chunks/chunk-FE3BABLJ.js +2 -0
  33. package/dist/cli-bundle/focused-chunks/chunk-IWITF53W.js +2 -0
  34. package/dist/cli-bundle/focused-chunks/{chunk-RXT4P5QH.js → chunk-OQUGRHKV.js} +2 -2
  35. package/dist/cli-bundle/focused-chunks/{chunk-OPFHFGDD.js → chunk-PNKIANFZ.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/{chunk-EE5QSM4Z.js → chunk-QQQ4SAUO.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/chunk-TTYXF5YD.js +177 -0
  38. package/dist/cli-bundle/focused-chunks/{chunk-7MBUII7U.js → chunk-XNR3DM6J.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/chunk-XSS3APUF.js +9 -0
  40. package/dist/cli-bundle/focused-chunks/{chunk-COPBO5HW.js → chunk-YCDQ2N23.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/{chunk-DUN4IXYN.js → chunk-YJUXGS57.js} +2 -2
  42. package/dist/cli-bundle/focused-chunks/chunk-ZTCE4UO6.js +58 -0
  43. package/dist/cli-bundle/main.js +2 -2
  44. package/dist/cli-bundle/sdk-authoring.js +1 -1
  45. package/dist/cli-bundle/sdk-contracts.js +2 -2
  46. package/dist/cli-bundle/sdk-core.js +37 -37
  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 +42 -42
  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 +9 -9
  54. package/dist/core/config/nested-settings.js +1 -1
  55. package/dist/core/policy/workflow-policy-schema.d.ts +312 -0
  56. package/dist/core/policy/workflow-policy-schema.js +2 -0
  57. package/dist/core/policy/workflow-policy-store.d.ts +24 -0
  58. package/dist/core/policy/workflow-policy-store.js +2 -0
  59. package/dist/core/policy/workflow-policy.d.ts +139 -0
  60. package/dist/core/policy/workflow-policy.js +2 -0
  61. package/dist/core/shared/constants.js +1 -1
  62. package/dist/core/store/item-store.js +1 -1
  63. package/dist/core/store/settings-validator.d.ts +1 -0
  64. package/dist/core/store/settings-validator.js +1 -1
  65. package/dist/core/store/settings.js +1 -1
  66. package/dist/mcp/tool-definitions.js +1 -1
  67. package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
  68. package/dist/sdk/cli-contracts/enum-contracts.js +1 -1
  69. package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
  70. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -1
  71. package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
  72. package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
  73. package/dist/sdk/cli-contracts/tool-schema.js +1 -1
  74. package/dist/sdk/completion.js +19 -4
  75. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  76. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
  77. package/dist/sdk/governance/validate.d.ts +3 -1
  78. package/dist/sdk/governance/validate.js +1 -1
  79. package/dist/sdk/governance/workflow-completeness.d.ts +32 -0
  80. package/dist/sdk/governance/workflow-completeness.js +2 -0
  81. package/dist/sdk/governance/workflow-policy.d.ts +47 -0
  82. package/dist/sdk/governance/workflow-policy.js +4 -0
  83. package/dist/sdk/governance.d.ts +1 -0
  84. package/dist/sdk/governance.js +1 -1
  85. package/dist/sdk/index.d.ts +0 -1
  86. package/dist/sdk/index.js +1 -1
  87. package/dist/sdk/lifecycle/create.js +1 -1
  88. package/dist/sdk/lifecycle/recurrence-parsers.d.ts +1 -1
  89. package/dist/sdk/lifecycle/recurrence-parsers.js +1 -1
  90. package/dist/sdk/lifecycle/restore.js +1 -1
  91. package/dist/sdk/lifecycle/update.js +1 -1
  92. package/dist/sdk/package-import-adapters.js +1 -1
  93. package/dist/sdk/public-surface.json +1 -1
  94. package/dist/sdk/query/search-contracts.d.ts +27 -0
  95. package/dist/sdk/query/search-contracts.js +1 -1
  96. package/dist/sdk/query/search.d.ts +6 -4
  97. package/dist/sdk/query/search.js +2 -2
  98. package/dist/sdk/read-output-contracts.d.ts +1 -1
  99. package/dist/sdk/read-output-contracts.js +1 -1
  100. package/dist/sdk/runtime-public-contracts.d.ts +2 -1
  101. package/dist/sdk/runtime.d.ts +4 -0
  102. package/dist/sdk/runtime.js +1 -1
  103. package/dist/sdk/schema.d.ts +2 -1
  104. package/dist/sdk/schema.js +1 -1
  105. package/dist/types.d.ts +4 -0
  106. package/dist/types.js +1 -1
  107. package/docs/COMMANDS.md +10 -0
  108. package/docs/CONFIGURATION.md +12 -1
  109. package/docs/README.md +1 -0
  110. package/docs/READ_OUTPUT_CONTRACTS.md +5 -0
  111. package/docs/TESTING.md +10 -0
  112. package/docs/WORKFLOW_POLICIES.md +129 -0
  113. package/docs/generated/FLAG_LEXICON_BUDGETS.md +2 -2
  114. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +9 -3
  115. package/marketplace.json +2 -2
  116. package/package.json +5 -5
  117. package/packages/pm-beads/package.json +1 -1
  118. package/packages/pm-calendar/package.json +1 -1
  119. package/packages/pm-command-kit/package.json +1 -1
  120. package/packages/pm-digital-twin/package.json +1 -1
  121. package/packages/pm-governance-audit/package.json +1 -1
  122. package/packages/pm-guide-shell/package.json +1 -1
  123. package/packages/pm-kanban/package.json +1 -1
  124. package/packages/pm-lifecycle-hooks/package.json +1 -1
  125. package/packages/pm-linked-test-adapters/package.json +1 -1
  126. package/packages/pm-search-advanced/package.json +1 -1
  127. package/packages/pm-templates/package.json +1 -1
  128. package/packages/pm-todos/package.json +1 -1
  129. package/packages/pm-vcs/package.json +1 -1
  130. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  131. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  132. package/dist/cli-bundle/chunks/chunk-3BZZA6A3.js +0 -5
  133. package/dist/cli-bundle/chunks/chunk-AMRDVX36.js +0 -235
  134. package/dist/cli-bundle/chunks/chunk-KR3RP4FH.js +0 -3
  135. package/dist/cli-bundle/chunks/chunk-QOEKOECV.js +0 -29
  136. package/dist/cli-bundle/chunks/register-mutation-IQ5C7U6O.js +0 -20
  137. package/dist/cli-bundle/chunks/register-operations-DWVHR2NC.js +0 -2
  138. package/dist/cli-bundle/focused-chunks/chunk-IAUOUGVR.js +0 -177
  139. package/dist/cli-bundle/focused-chunks/chunk-MZDXX7JY.js +0 -56
  140. package/dist/cli-bundle/focused-chunks/chunk-QHNETP77.js +0 -9
  141. package/dist/cli-bundle/focused-chunks/chunk-SDOL6FM2.js +0 -12
  142. package/dist/cli-bundle/focused-chunks/chunk-SQV4AAUC.js +0 -2
  143. package/dist/cli-bundle/focused-chunks/chunk-WE3IUNIW.js +0 -26
  144. package/dist/cli-bundle/focused-chunks/chunk-YALOUBWJ.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]="e9b0e5c7-2f21-53a1-8897-424d71b283ac")}catch(e2){}})();import{normalizeUniqueStringList}from"./string-lists.js";import{PM_TOOL_ACTIONS}from"./enum-contracts.js";import{TOOL_CREATE_OPTION_CONTRACTS,TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACTS,TOOL_UPDATE_OPTION_CONTRACTS,TOOL_UPDATE_MANY_FILTER_OPTION_CONTRACTS,TOOL_CONTEXT_OPTION_CONTRACTS,TOOL_ACTIVITY_OPTION_CONTRACTS,TOOL_LIST_FILTER_OPTION_CONTRACTS,TOOL_AGGREGATE_OPTION_CONTRACTS,TOOL_SEARCH_FILTER_OPTION_CONTRACTS,TOOL_CLOSE_MANY_FILTER_OPTION_CONTRACTS}from"./tool-option-contracts.js";import{PM_TOOL_PARAMETER_PROPERTIES,PM_TOOL_PARAMETER_METADATA,PM_TOOL_ACTION_SCOPED_PARAMETER_PROPERTIES,PM_TOOL_ACTION_SCOPED_PARAMETER_METADATA,PLAN_ACTION_PARAMETER_PROPERTIES,PLAN_ACTION_PARAMETER_METADATA}from"./tool-parameter-tables.js";import{toUniqueFlagContracts,withFlagAliasMetadata}from"./flag-contracts.js";import{resolveReadOutputSurface}from"../read-output-contracts.js";const PM_TOOL_GLOBAL_PARAMETER_KEYS=["json","quiet","profile","noExtensions","noPager","tokenAccounting","path","pmExecutable","timeoutMs"];const PM_TOOL_READ_OUTPUT_PARAMETER_KEYS=["outputInclude","outputLimit","outputBudget","outputFormat","outputSession","outputCursor","outputRowContract"];const PM_TOOL_RESERVED_CUSTOM_FIELD_PROPERTIES=new Set(["action","cwd","options",...Object.keys(PM_TOOL_PARAMETER_PROPERTIES).filter(property=>property!=="severity")]);function resolvePmToolCustomFieldCollision(field){const normalized=field.trim().toLowerCase();let property="";for(let index=0;index<normalized.length;index+=1){const character=normalized[index];if(character!=="-"&&character!=="_"){property+=character;continue}let nextIndex=index+1;while(normalized[nextIndex]==="-"||normalized[nextIndex]==="_"){nextIndex+=1}const nextCharacter=normalized[nextIndex];if(nextCharacter!==void 0&&(nextCharacter>="a"&&nextCharacter<="z"||nextCharacter>="0"&&nextCharacter<="9")){property+=nextCharacter.toUpperCase();index=nextIndex;continue}property+=normalized.slice(index,nextIndex);index=nextIndex-1}return PM_TOOL_RESERVED_CUSTOM_FIELD_PROPERTIES.has(property)?{field,property,owner:"mcp_tool_input",nested_path:`options.${property}`}:void 0}const PM_TOOL_ACTION_MUTATION_PARAMETER_KEYS={create:["fullChangedFields","idOnly"],copy:["fullChangedFields","idOnly"],update:["fullChangedFields","idOnly"],"item-reopen":["fullChangedFields","idOnly"],close:["fullChangedFields","idOnly"],claim:["fullChangedFields","idOnly"],restore:["fullChangedFields","idOnly"],append:["fullChangedFields"],"update-many":["fullChangedFields"],"close-many":["fullChangedFields"],assurance:["fullChangedFields","idOnly"]};const PLAN_CREATE_METADATA_PARAMETER_KEYS=["createMode","status","deadline","estimate","acceptanceCriteria","definitionOfReady","order","rank","goal","objective","value","impact","outcome","whyNow","assignee","reviewer","risk","confidence","sprint","release","blockedReason","unblockNote","reporter","severity","environment","reproSteps","resolution","expectedResult","actualResult","affectedVersion","fixedVersion","component","regression","customerImpact","comment","note","learning","reminder","event","typeOption"];const PM_TOOL_ACTION_NESTED_OPTION_COMPATIBILITY_KEYS=Object.freeze({"close-many":["list","expected_result","expected","actual_result","actual","validate_close","dry_run","checkpoint","no_checkpoint","filterAssignee_filter"],"update-many":["list","update","dry_run","checkpoint","no_checkpoint","filterAssignee_filter"],...Object.fromEntries(PM_TOOL_ACTIONS.filter(action=>action==="upgrade"||action==="install"||action==="extension"||action==="package"||action.startsWith("extension-")||action.startsWith("package-")).map(action=>[action,["project","local","global"]]))});function toSchemaKeyList(values){return normalizeUniqueStringList(values)}const CREATE_CONTRACT_PARAMETER_KEYS=toSchemaKeyList([...TOOL_CREATE_OPTION_CONTRACTS.map(entry=>entry.param),...TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACTS.map(entry=>entry.param),"assignee","closeReason","completedAt"]);const UPDATE_CONTRACT_PARAMETER_KEYS=toSchemaKeyList([...TOOL_UPDATE_OPTION_CONTRACTS.map(entry=>entry.param),...TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACTS.map(entry=>entry.param),"force"]);const UPDATE_MANY_CONTRACT_PARAMETER_KEYS=toSchemaKeyList([...TOOL_UPDATE_MANY_FILTER_OPTION_CONTRACTS.map(entry=>entry.param),...UPDATE_CONTRACT_PARAMETER_KEYS.filter(key=>key!=="allowMissingParent"&&key!=="completedAt"),"dryRun","rollback","noCheckpoint"]);const CLOSE_MANY_CONTRACT_PARAMETER_KEYS=toSchemaKeyList([...TOOL_CLOSE_MANY_FILTER_OPTION_CONTRACTS.map(entry=>entry.param),"reason","completedAt","resolution","expectedResult","actualResult","validateClose","dryRun","rollback","noCheckpoint","author","message","force"]);const CONTEXT_CONTRACT_PARAMETER_KEYS=toSchemaKeyList([...TOOL_CONTEXT_OPTION_CONTRACTS.map(entry=>entry.param),"past","section"]);const ACTIVITY_CONTRACT_PARAMETER_KEYS=toSchemaKeyList([...TOOL_ACTIVITY_OPTION_CONTRACTS.map(entry=>entry.param),"stream"]);const LIST_CONTRACT_PARAMETER_KEYS=toSchemaKeyList([...TOOL_LIST_FILTER_OPTION_CONTRACTS.map(entry=>entry.param),"all","includeBody","noTruncate","strictRead","compact","brief","full"]);const FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS=LIST_CONTRACT_PARAMETER_KEYS.filter(parameter=>parameter!=="all"&&parameter!=="status");const LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS=[[{property:"today",schema:{const:true}},{property:"recent",schema:{const:true}}],[{property:"today",schema:{const:true}},{property:"updatedAfter",schema:{type:"string",pattern:"\\S"}}],[{property:"recent",schema:{const:true}},{property:"updatedAfter",schema:{type:"string",pattern:"\\S"}}]];const CONTRACTS_PROJECTION_MUTUALLY_EXCLUSIVE_GROUPS=[[{property:"summary",schema:{const:true}},{property:"schemaOnly",schema:{const:true}}],[{property:"summary",schema:{const:true}},{property:"flagsOnly",schema:{const:true}}],[{property:"summary",schema:{const:true}},{property:"availabilityOnly",schema:{const:true}}],[{property:"schemaOnly",schema:{const:true}},{property:"flagsOnly",schema:{const:true}}],[{property:"schemaOnly",schema:{const:true}},{property:"availabilityOnly",schema:{const:true}}],[{property:"flagsOnly",schema:{const:true}},{property:"availabilityOnly",schema:{const:true}}]];const AGGREGATE_CONTRACT_PARAMETER_KEYS=toSchemaKeyList([...TOOL_AGGREGATE_OPTION_CONTRACTS.map(entry=>entry.param),"count","completion","includeUnparented"]);const SEARCH_CONTRACT_PARAMETER_KEYS=toSchemaKeyList(["query","keywords","mode","semantic","hybrid","includeLinked","titleExact","phraseExact","highlight","compact","full",...TOOL_SEARCH_FILTER_OPTION_CONTRACTS.map(entry=>entry.param)]);const NEXT_CONTRACT_PARAMETER_KEYS=toSchemaKeyList(["type","tag","priority","assignee","assigneeFilter","sprint","release","parent","limit","blockedLimit","readyOnly","format","includeDecisions","includeGates","includeContainers","tokenBudget","explainRanking"]);const AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS=["author","message","force"];const CLOSE_ACTION_OPTION_KEYS=["text","reason","closeReason","completedAt","duplicateOf","validateClose","resolution","expectedResult","actualResult"];const LIFECYCLE_AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS=["author","assignee","message","force"];const MANAGED_EXTENSION_PACKAGE_OPTION_KEYS=["dryRun","target","scope","capability","declarative","github","ref","init","install","uninstall","explore","manage","describe","markdown","output","reload","doctor","catalog","list","adopt","adoptAll","activate","deactivate","runtimeProbe","fixManagedState","isolated","ignoreGlobal","detail","trace","watch","strictExit","failOnWarn"];function managedLifecycleSchemaContracts(prefix){return{[`${prefix}-init`]:{required:["target"],optional:["scope","capability",...prefix==="package"?["declarative"]:[]]},[`${prefix}-install`]:{optional:["target","github","scope","ref","dryRun"],anyOfRequired:[["target"],["github"]]},[`${prefix}-uninstall`]:{required:["target"],optional:["scope"]},[`${prefix}-explore`]:{optional:["scope"]},[`${prefix}-manage`]:{optional:["scope","runtimeProbe","fixManagedState"]},[`${prefix}-describe`]:{optional:["target","scope","markdown","output"]},[`${prefix}-reload`]:{optional:["scope","watch"]},[`${prefix}-doctor`]:{optional:["scope","detail","trace","fixManagedState","isolated","ignoreGlobal","strictExit","failOnWarn"]},[`${prefix}-catalog`]:{optional:["scope","fields"]},[`${prefix}-adopt`]:{required:["target"],optional:["scope","github","ref"]},[`${prefix}-adopt-all`]:{optional:["scope"]},[`${prefix}-activate`]:{required:["target"],optional:["scope"]},[`${prefix}-deactivate`]:{required:["target"],optional:["scope"]},[prefix]:{optional:MANAGED_EXTENSION_PACKAGE_OPTION_KEYS,dependentAnyOfRequired:[{property:"dryRun",value:true,anyOfRequired:[["install","target"],["install","github"]]}],mutuallyExclusiveWhen:[[{property:"dryRun",schema:{const:true}},{property:"install",schema:{const:false}}]]}}}const SCHEDULING_ACTION_SCHEMA_CONTRACT={required:["title"],optional:["start","duration","end","location","timezone","allDay","parent","allowMissingParent","tags","priority","body","description","author","message"]};const UPGRADE_ACTION_SCHEMA_CONTRACT={optional:["target","scope","dryRun","cliOnly","packagesOnly","repair","tag","packageName"]};const PM_TOOL_ACTION_SCHEMA_CONTRACTS={init:{optional:["prefix","idPrefix","workspace","preset","typePreset","defaults","author","agentGuidance","withPackages","mergeFence","force","verbose"]},config:{required:["scope","configAction"],optional:["key","value","criterion","clearCriteria","format","policy"]},...managedLifecycleSchemaContracts("extension"),...managedLifecycleSchemaContracts("package"),"package-upgrade":UPGRADE_ACTION_SCHEMA_CONTRACT,install:{optional:["target","github","scope","ref","dryRun"],anyOfRequired:[["target"],["github"]]},upgrade:UPGRADE_ACTION_SCHEMA_CONTRACT,create:{required:["title","description","type","status","priority","message"],optional:CREATE_CONTRACT_PARAMETER_KEYS},copy:{required:["id"],optional:["title","author","message","allowDuplicate"]},focus:{optional:["id","clear"],mutuallyExclusive:[["id","clear"]]},list:{optional:LIST_CONTRACT_PARAMETER_KEYS,mutuallyExclusiveWhen:LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS},"list-all":{optional:LIST_CONTRACT_PARAMETER_KEYS,mutuallyExclusiveWhen:LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS},"list-draft":{optional:FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS,mutuallyExclusiveWhen:LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS},"list-open":{optional:FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS,mutuallyExclusiveWhen:LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS},"list-in-progress":{optional:FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS,mutuallyExclusiveWhen:LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS},"list-blocked":{optional:FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS,mutuallyExclusiveWhen:LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS},"list-closed":{optional:FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS,mutuallyExclusiveWhen:LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS},"list-canceled":{optional:FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS,mutuallyExclusiveWhen:LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS},aggregate:{optional:AGGREGATE_CONTRACT_PARAMETER_KEYS},guide:{optional:["list","format","depth"]},context:{optional:CONTEXT_CONTRACT_PARAMETER_KEYS},ctx:{optional:CONTEXT_CONTRACT_PARAMETER_KEYS},get:{required:["id"],optional:["for","tokenBudget","at","depth","full","fields","tree","treeDepth","format"]},search:{optional:SEARCH_CONTRACT_PARAMETER_KEYS,anyOfRequired:[["query"],["keywords"]]},eval:{optional:["mode","k","failUnder","queries","format"]},events:{optional:["since","type","author","item","limit","full","provenance","provenanceSummary","harness","agentInstance","provenanceFilter","cursorMode"]},merge:{required:["subcommand"],optional:["dryRun","author","message","force","includeReconciled","artifact","basePath","oursPath","theirsPath","output","outputPath","itemPath","prefer"]},workspace:{required:["subcommand"],optional:["snapshotAction","name","target","dryRun","force","author","message","lockTtlSeconds","lockWaitMs"],conditionalRequired:[{property:"subcommand",value:"snapshot",required:["snapshotAction"]}]},meet:SCHEDULING_ACTION_SCHEMA_CONTRACT,event:SCHEDULING_ACTION_SCHEMA_CONTRACT,remind:{required:["title"],optional:["at","text","parent","allowMissingParent","tags","priority","body","description","author","message"]},next:{optional:[...NEXT_CONTRACT_PARAMETER_KEYS,"for"]},reindex:{optional:["mode","progress"]},history:{required:["id"],optional:["limit","compact","full","provenance","provenanceSummary","harness","agentInstance","provenanceFilter","diff","verify","field","strictExit","failOnWarn","format"]},"history-redact":{required:["id"],optional:["literal","regex","replacement","dryRun",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],anyOfRequired:[["literal"],["regex"]]},"history-repair":{optional:["id","all","dryRun","normalizeProvenance","salvageTail",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],oneOfRequired:[["id"],["all"]],mutuallyExclusiveWhen:[[{property:"salvageTail",schema:{const:true}},{property:"all",schema:{const:true}}],[{property:"salvageTail",schema:{const:true}},{property:"normalizeProvenance",schema:{const:true}}]]},"history-author-acknowledge":{optional:["historyEvent","allActionable","dryRun","planFingerprint","limit","attributedAuthor","reviewer","reason"],oneOfRequired:[["historyEvent"],["allActionable"]]},"history-compact":{optional:["id","before","ids","allOver","closed","allStreams","minEntries","dryRun",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS]},schema:{required:["subcommand"],optional:["name","description","defaultStatus","folder","alias","role","order","fieldType","commands","cliFlag","required","requiredOnCreate","allowUnset","requiredTypes","typePreset","infer","minCount","apply","to","migrationId","fieldTypeScope","dryRun","author","force"],conditionalRequired:[{property:"subcommand",value:"show",required:["name"]},{property:"subcommand",value:"show-status",required:["name"]},{property:"subcommand",value:"add-type",required:["name"]},{property:"subcommand",value:"remove-type",required:["name"]},{property:"subcommand",value:"add-status",required:["name"]},{property:"subcommand",value:"remove-status",required:["name"]},{property:"subcommand",value:"add-field",required:["name"]},{property:"subcommand",value:"remove-field",required:["name"]},{property:"subcommand",value:"show-field",required:["name"]},{property:"subcommand",value:"rename-type",required:["name","to"]},{property:"subcommand",value:"rename-field",required:["name","to"]},{property:"subcommand",value:"remap-status",required:["name","to"]},{property:"subcommand",value:"apply-preset",required:["typePreset"]}]},profile:{required:["subcommand"],optional:["name","dryRun","author","force"],conditionalRequired:[{property:"subcommand",value:"show",required:["name"]},{property:"subcommand",value:"apply",required:["name"]},{property:"subcommand",value:"lint",required:["name"]}]},plan:{required:["subcommand"],optional:["id","stepRef","reorderTo","title","description","template","scope","parent","related","blocks","blockedBy","harness","mode","resumeContext","tags","priority",...PLAN_CREATE_METADATA_PARAMETER_KEYS,"body","claim","fromSearch","stepTitle","step","stepBody","stepOwner","stepStatus","stepEvidence","stepBlockedReason","stepReplacement","dependsOn","link","linkKind","linkNote","promoteToItemDep","allowMultipleActive","file","test","doc","decisionText","decision","decisionRationale","decisionEvidence","discoveryText","discovery","validationText","validation","validationCommand","validationExpected","depth","fields","steps","materializeType","materializeParent","materializeTags","field",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS]},activity:{optional:ACTIVITY_CONTRACT_PARAMETER_KEYS},restore:{required:["id","target"],optional:AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS},update:{required:["id"],optional:UPDATE_CONTRACT_PARAMETER_KEYS,mutuallyExclusive:[["acceptanceCriteria","addAc"],["acceptanceCriteria","removeAc"]]},"update-many":{optional:UPDATE_MANY_CONTRACT_PARAMETER_KEYS,mutuallyExclusive:[["acceptanceCriteria","addAc"],["acceptanceCriteria","removeAc"]]},close:{required:["id"],optional:[...CLOSE_ACTION_OPTION_KEYS,...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS]},"close-many":{optional:CLOSE_MANY_CONTRACT_PARAMETER_KEYS},delete:{required:["id"],optional:["dryRun",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS]},append:{required:["id","body"],optional:AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS},comments:{required:["id"],optional:["text","add","stdin","edit","delete","limit","full","ifAbsent",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],mutuallyExclusive:[["edit","ifAbsent"],["delete","ifAbsent"]]},notes:{required:["id"],optional:["text","add","addJson","stdin","edit","delete","limit","since","eventType","includeMeta","full","ifAbsent",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],mutuallyExclusive:[["addJson","add"],["addJson","stdin"],["addJson","file"],["addJson","edit"],["addJson","delete"],["edit","ifAbsent"],["delete","ifAbsent"]]},learnings:{required:["id"],optional:["text","add","stdin","edit","delete","limit","full","ifAbsent",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],mutuallyExclusive:[["edit","ifAbsent"],["delete","ifAbsent"]]},files:{required:[],optional:["id","add","addGlob","remove","migrate","list","addNote","discover","apply","discoveryNote","appendStable","validatePaths","lookupPath","scope","limit","offset","noTruncate","strictRead","explain","lines","decisionDepth",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],anyOfRequired:[["id"],["lookupPath"]],dependentAnyOfRequired:[{property:"addNote",anyOfRequired:[["add"],["addGlob"]]}]},docs:{required:["id"],optional:["add","addGlob","remove","migrate","addNote","list","validatePaths",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],dependentAnyOfRequired:[{property:"addNote",anyOfRequired:[["add"],["addGlob"]]}]},deps:{required:["id"],optional:["format","maxDepth","collapse","summary","full","nodeLimit","edgeLimit","tokenBudget","cursor","direction","kind"]},graph:{required:["subcommand"],optional:["id","target","kind","maxDepth","limit","after","direction","maxPaths","sample","exemptIsolate","exemptIsolateType","saveBaseline","rebuild","clear","summary","full"]},test:{required:["id"],optional:["list","add","addJson","remove","removeIndex","run","match","onlyIndex","onlyLast","background","timeout","progress","envSet","envClear","sharedHostSafe","pmContext","overrideLinkedPmContext","workspaceContext","overrideLinkedWorkspaceContext","allowUntrustedLinkedTests","acknowledgeLinkedTests","failOnContextMismatch","failOnSkipped","failOnEmptyTestRun","requireAssertionsForPm","checkContext","autoPmContext","measure","metricBelow","metricDiff",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],mutuallyExclusive:[["acknowledgeLinkedTests","run"],["acknowledgeLinkedTests","background"]]},"test-all":{optional:["status","limit","offset","background","timeout","progress","envSet","envClear","sharedHostSafe","pmContext","overrideLinkedPmContext","workspaceContext","overrideLinkedWorkspaceContext","allowUntrustedLinkedTests","failOnContextMismatch","failOnSkipped","failOnEmptyTestRun","requireAssertionsForPm","checkContext","autoPmContext"]},telemetry:{optional:["subcommand","limit"]},"test-runs-list":{optional:["status","limit"]},"test-runs-status":{required:["runId"]},"test-runs-logs":{required:["runId"],optional:["stream","tail"]},"test-runs-stop":{required:["runId"],optional:["force"]},"test-runs-resume":{required:["runId"],optional:["author"]},stats:{optional:["includeEmpty","storage","metadataCoverage","fieldUtilization","byAssignee","byTag","byPriority","tagPrefix","measurements","metric","measurementLimit","observe","improvementDirection","measurementSource","measurementItem","measurementRevision","author","message","provenanceCoverage","fleetAttribution","since","eventLimit","minimumSample"]},duplicates:{optional:["status","since","threshold","limit","exhaustive"]},health:{optional:["strictDirectories","requireMergeDrivers","strictExit","failOnWarn","checkOnly","checkTelemetry","noRefresh","refreshVectors","verboseStaleItems","verboseAuthorEvents","brief","summary","skipVectors","skipIntegrity","skipDrift","full"]},validate:{optional:["checkStorageIntegrity","checkMetadata","metadataProfile","checkResolution","checkLifecycle","checkStaleBlockers","dependencyCycleSeverity","parentCycleSeverity","checkFiles","scanMode","includePmInternals","verboseFileLists","verboseDiagnostics","allAffectedIds","strictExit","failOnWarn","fixHints","autoFix","dryRun","fixScope","pruneMissing","checkHistoryDrift","checkCommandReferences","counts","full"]},assurance:{required:["subcommand"],optional:["kind","id","definition","trigger","treeId","gate","limit","dryRun","author","message","preset","owner","apply","enforcement"],conditionalRequired:[{property:"subcommand",value:"list",required:["kind"]},{property:"subcommand",value:"show",required:["kind","id"]},{property:"subcommand",value:"put",required:["kind","id","definition"]},{property:"subcommand",value:"remove",required:["kind","id"]},{property:"subcommand",value:"run",required:["id","trigger"]},{property:"subcommand",value:"apply",required:["preset","owner"]},{property:"subcommand",value:"derive",required:["owner"]},{property:"subcommand",value:"risk",required:["definition"]},{property:"subcommand",value:"lineages",required:["definition"]},{property:"subcommand",value:"promote",required:["id","enforcement"]}],mutuallyExclusiveWhen:[[{property:"subcommand",schema:{const:"risk"}},{property:"definition",schema:{not:{required:["policy","change"]}}}],[{property:"subcommand",schema:{const:"lineages"}},{property:"definition",schema:{anyOf:[{required:["change"]},{not:{required:["policy"]}}]}}]]},gc:{optional:["dryRun","gcScope"]},contracts:{optional:["contractAction","command","summary","schemaOnly","flagsOnly","availabilityOnly","runtimeOnly","activeOnly","full"],mutuallyExclusiveWhen:CONTRACTS_PROJECTION_MUTUALLY_EXCLUSIVE_GROUPS},completion:{required:["shell"],optional:["eagerTags"]},claim:{optional:["id","next","ifAvailable","maxAttempts","includeDecisions",...NEXT_CONTRACT_PARAMETER_KEYS,...LIFECYCLE_AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],oneOfRequired:[["id"],["next"]]},release:{required:["id"],optional:LIFECYCLE_AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS},"start-task":{required:["id"],optional:LIFECYCLE_AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS},"pause-task":{required:["id"],optional:LIFECYCLE_AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS},"close-task":{required:["id"],optional:["text","validateClose",...LIFECYCLE_AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS]},"item-reopen":{required:["id","reason"],optional:["status","author","message","force"]}};const PM_TOOL_ACTION_PARAMETER_CONTRACTS=Object.freeze(Object.fromEntries(PM_TOOL_ACTIONS.map(action=>[action,PM_TOOL_ACTION_SCHEMA_CONTRACTS[action]])));function fallbackToolParameterDescription(key){return key.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").trim().replace(/^./,value=>value.toUpperCase()).concat(".")}function decorateToolParameterDefinition(key,definition){const baseDefinition=typeof definition==="object"&&definition!==null?{...definition}:{};const metadata=PM_TOOL_PARAMETER_METADATA[key];return{...baseDefinition,description:metadata?.description??fallbackToolParameterDescription(key),...metadata?.examples?{examples:metadata.examples}:{}}}function actionScopedToolParameterMetadata(action,key){if((action==="list"||action.startsWith("list-"))&&key==="all"){return{description:"Return items from every lifecycle status instead of the default active-status set."}}if(action==="plan"&&Object.prototype.hasOwnProperty.call(PLAN_ACTION_PARAMETER_METADATA,key)){return PLAN_ACTION_PARAMETER_METADATA[key]}const actionOverrides=PM_TOOL_ACTION_SCOPED_PARAMETER_METADATA[action];if(actionOverrides&&Object.prototype.hasOwnProperty.call(actionOverrides,key)){return actionOverrides[key]}return PM_TOOL_PARAMETER_METADATA[key]}function decorateActionScopedToolParameterDefinition(action,key,definition){const baseDefinition=typeof definition==="object"&&definition!==null?{...definition}:{};const metadata=actionScopedToolParameterMetadata(action,key);return{...baseDefinition,description:metadata?.description??fallbackToolParameterDescription(key),...metadata?.examples?{examples:metadata.examples}:{}}}function actionScopedToolParameterDefinition(action,key){const actionProperties=PM_TOOL_ACTION_SCOPED_PARAMETER_PROPERTIES[action];if(actionProperties&&Object.prototype.hasOwnProperty.call(actionProperties,key)){return actionProperties[key]}if(action==="plan"&&Object.prototype.hasOwnProperty.call(PLAN_ACTION_PARAMETER_PROPERTIES,key)){return PLAN_ACTION_PARAMETER_PROPERTIES[key]}if((action==="get"||action==="history"||action==="search")&&key==="format"){return{type:"string",enum:["json","toon"]}}return PM_TOOL_PARAMETER_PROPERTIES[key]}function buildActionScopedSchemaProperties(action,allowedKeys){const properties={action:{const:action,description:PM_TOOL_PARAMETER_METADATA.action?.description??"Tool action to execute."}};for(const key of allowedKeys){if(key==="action"){continue}const definition=actionScopedToolParameterDefinition(action,key);if(definition){properties[key]=decorateActionScopedToolParameterDefinition(action,key,definition)}}return properties}function buildOneOfSchemaEntries(action,oneOfRequiredGroups){const allOneOfFields=oneOfRequiredGroups.flat();return oneOfRequiredGroups.map(requiredFields=>{const otherFields=allOneOfFields.filter(field=>!requiredFields.includes(field));return{required:[...requiredFields],...otherFields.length>0?{not:{anyOf:otherFields.map(field=>({required:[field]}))}}:{},...action==="history-repair"&&requiredFields.includes("all")?{properties:{all:{const:true}}}:action==="claim"&&requiredFields.includes("next")?{properties:{next:{const:true}}}:{}}})}function schemaPropertyCondition(property,value){return{...value===void 0?{}:{properties:{[property]:{const:value}}},required:[property]}}function buildActionScopedAllOf(contract){const allOf=[];if(contract.conditionalRequired&&contract.conditionalRequired.length>0){for(const entry of contract.conditionalRequired){allOf.push({if:schemaPropertyCondition(entry.property,entry.value),then:{required:entry.required}})}}if(contract.dependentAnyOfRequired&&contract.dependentAnyOfRequired.length>0){for(const entry of contract.dependentAnyOfRequired){allOf.push({if:schemaPropertyCondition(entry.property,entry.value),then:{anyOf:entry.anyOfRequired.map(requiredFields=>({required:[...requiredFields]}))}})}}if(contract.mutuallyExclusive&&contract.mutuallyExclusive.length>0){for(const group of contract.mutuallyExclusive){allOf.push({not:{required:toSchemaKeyList(group)}})}}if(contract.mutuallyExclusiveWhen&&contract.mutuallyExclusiveWhen.length>0){for(const group of contract.mutuallyExclusiveWhen){allOf.push({not:{allOf:group.map(condition=>({properties:{[condition.property]:condition.schema},required:[condition.property]}))}})}}return allOf}function pmToolActionParameterKeys(action){if(!Object.prototype.hasOwnProperty.call(PM_TOOL_ACTION_SCHEMA_CONTRACTS,action)){return void 0}const contract=PM_TOOL_ACTION_SCHEMA_CONTRACTS[action];const mutationParameterKeys=PM_TOOL_ACTION_MUTATION_PARAMETER_KEYS[action]??[];return toSchemaKeyList(["action",...PM_TOOL_GLOBAL_PARAMETER_KEYS,...resolveReadOutputSurface(action)!==void 0?PM_TOOL_READ_OUTPUT_PARAMETER_KEYS:[],...mutationParameterKeys,...contract.required??[],...contract.optional??[]])}function pmToolActionNestedOptionKeys(action){const parameterKeys=pmToolActionParameterKeys(action);if(parameterKeys===void 0)return void 0;return toSchemaKeyList([...parameterKeys,...PM_TOOL_ACTION_NESTED_OPTION_COMPATIBILITY_KEYS[action]??[]])}function buildActionScopedToolSchema(action){const contract=PM_TOOL_ACTION_SCHEMA_CONTRACTS[action];const required=toSchemaKeyList(contract.required??[]);const allowedKeys=pmToolActionParameterKeys(action);const schema={type:"object",additionalProperties:false,required:["action",...required],title:`pm action "${action}" parameters`,properties:buildActionScopedSchemaProperties(action,allowedKeys)};if(contract.anyOfRequired&&contract.anyOfRequired.length>0){schema.anyOf=contract.anyOfRequired.map(requiredFields=>({required:[...requiredFields]}))}if(contract.oneOfRequired&&contract.oneOfRequired.length>0){schema.oneOf=buildOneOfSchemaEntries(action,contract.oneOfRequired)}const allOf=buildActionScopedAllOf(contract);if(allOf.length>0){schema.allOf=allOf}return schema}function buildPmActionToolInputSchema(action,options={}){const actionSchema=buildActionScopedToolSchema(action);const actionProperties={...actionSchema.properties};delete actionProperties.action;const conditionalBranches=[...actionSchema.anyOf??[],...actionSchema.oneOf??[]];const required=(options.required??actionSchema.required.map(String)).filter(key=>{if(key==="action")return false;if(options.required===void 0)return true;return!conditionalBranches.some(branch=>branch.required?.map(String).includes(key))});const schema={type:"object",additionalProperties:options.additionalProperties??true,properties:{...actionProperties,options:{type:"object",additionalProperties:true,description:"Advanced command options forwarded to the selected pm action."},...options.properties},required};if(actionSchema.anyOf!==void 0)schema.anyOf=actionSchema.anyOf;if(actionSchema.oneOf!==void 0)schema.oneOf=actionSchema.oneOf;if(actionSchema.allOf!==void 0)schema.allOf=actionSchema.allOf;return schema}function createLazyContractSchema(build){let value;const resolve=()=>value??=build();return new Proxy({},{get:(_target,prop)=>resolve()[prop],has:(_target,prop)=>prop in resolve(),ownKeys:()=>Reflect.ownKeys(resolve()),getOwnPropertyDescriptor:(_target,prop)=>{const descriptor=Reflect.getOwnPropertyDescriptor(resolve(),prop);if(descriptor){descriptor.configurable=true}return descriptor}})}const PM_TOOL_PARAMETERS_SCHEMA_VERSION="4.15.0";const PM_TOOL_PARAMETERS_SCHEMA_MAJOR=PM_TOOL_PARAMETERS_SCHEMA_VERSION.split(".")[0];const PM_PROVIDER_TOOL_PARAMETERS_SCHEMA_VERSION="1.7.0";const PM_TOOL_PARAMETERS_SCHEMA=createLazyContractSchema(()=>({$schema:"https://json-schema.org/draft/2020-12/schema",$id:`https://schema.unbrained.dev/pm-cli/tool-parameters-v${PM_TOOL_PARAMETERS_SCHEMA_MAJOR}.schema.json`,title:"pm-cli tool parameters (action-scoped strict schema)","x-schema-version":PM_TOOL_PARAMETERS_SCHEMA_VERSION,type:"object",oneOf:PM_TOOL_ACTIONS.map(action=>buildActionScopedToolSchema(action))}));function toProviderCompatibleParameterDefinition(key,definition){const decorated=decorateToolParameterDefinition(key,definition);if(typeof decorated.type==="string"){return decorated}const anyOf=Array.isArray(decorated.anyOf)?decorated.anyOf:[];const firstTypedVariant=anyOf.find(variant=>typeof variant.type==="string");if(firstTypedVariant){const{anyOf:_anyOf2,...rest2}=decorated;return{...firstTypedVariant,...rest2}}const{anyOf:_anyOf,...rest}=decorated;return{...rest,type:"string"}}function buildProviderCompatibleToolSchema(){const properties={action:{type:"string",description:PM_TOOL_PARAMETER_METADATA.action?.description??"Tool action to execute."},options:{type:"object",additionalProperties:true,description:"Advanced command options object forwarded to the selected pm action."}};for(const key of Object.keys(PM_TOOL_PARAMETER_PROPERTIES).sort()){properties[key]=toProviderCompatibleParameterDefinition(key,PM_TOOL_PARAMETER_PROPERTIES[key])}return{title:"pm-cli tool parameters (provider-compatible flat schema)","x-schema-version":PM_PROVIDER_TOOL_PARAMETERS_SCHEMA_VERSION,type:"object",additionalProperties:false,required:["action"],properties}}const PM_PROVIDER_TOOL_PARAMETERS_SCHEMA=createLazyContractSchema(buildProviderCompatibleToolSchema);const _testOnlyCliContracts={buildActionScopedToolSchema,buildProviderCompatibleToolSchema,decorateActionScopedToolParameterDefinition,decorateToolParameterDefinition,toolActionSchemaContracts:PM_TOOL_ACTION_SCHEMA_CONTRACTS,toolParameterMetadata:PM_TOOL_PARAMETER_METADATA,toProviderCompatibleParameterDefinition,toUniqueFlagContracts,withFlagAliasMetadata};export{CLOSE_ACTION_OPTION_KEYS,PLAN_CREATE_METADATA_PARAMETER_KEYS,PM_PROVIDER_TOOL_PARAMETERS_SCHEMA,PM_PROVIDER_TOOL_PARAMETERS_SCHEMA_VERSION,PM_TOOL_ACTION_PARAMETER_CONTRACTS,PM_TOOL_PARAMETERS_SCHEMA,PM_TOOL_PARAMETERS_SCHEMA_MAJOR,PM_TOOL_PARAMETERS_SCHEMA_VERSION,PM_TOOL_RESERVED_CUSTOM_FIELD_PROPERTIES,_testOnlyCliContracts,buildPmActionToolInputSchema,pmToolActionNestedOptionKeys,pmToolActionParameterKeys,resolvePmToolCustomFieldCollision};
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]="75c2f9b6-7145-58d8-9db0-58ba696bc6ab")}catch(e2){}})();import{normalizeUniqueStringList}from"./string-lists.js";import{PM_TOOL_ACTIONS}from"./enum-contracts.js";import{TOOL_CREATE_OPTION_CONTRACTS,TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACTS,TOOL_UPDATE_OPTION_CONTRACTS,TOOL_UPDATE_MANY_FILTER_OPTION_CONTRACTS,TOOL_CONTEXT_OPTION_CONTRACTS,TOOL_ACTIVITY_OPTION_CONTRACTS,TOOL_LIST_FILTER_OPTION_CONTRACTS,TOOL_AGGREGATE_OPTION_CONTRACTS,TOOL_SEARCH_FILTER_OPTION_CONTRACTS,TOOL_CLOSE_MANY_FILTER_OPTION_CONTRACTS}from"./tool-option-contracts.js";import{PM_TOOL_PARAMETER_PROPERTIES,PM_TOOL_PARAMETER_METADATA,PM_TOOL_ACTION_SCOPED_PARAMETER_PROPERTIES,PM_TOOL_ACTION_SCOPED_PARAMETER_METADATA,PLAN_ACTION_PARAMETER_PROPERTIES,PLAN_ACTION_PARAMETER_METADATA}from"./tool-parameter-tables.js";import{toUniqueFlagContracts,withFlagAliasMetadata}from"./flag-contracts.js";import{resolveReadOutputSurface}from"../read-output-contracts.js";const PM_TOOL_GLOBAL_PARAMETER_KEYS=["json","quiet","profile","noExtensions","noPager","tokenAccounting","path","pmExecutable","timeoutMs"];const PM_TOOL_READ_OUTPUT_PARAMETER_KEYS=["outputInclude","outputLimit","outputBudget","outputFormat","outputSession","outputCursor","outputRowContract"];const PM_TOOL_RESERVED_CUSTOM_FIELD_PROPERTIES=new Set(["action","cwd","options",...Object.keys(PM_TOOL_PARAMETER_PROPERTIES).filter(property=>property!=="severity")]);function resolvePmToolCustomFieldCollision(field){const normalized=field.trim().toLowerCase();let property="";for(let index=0;index<normalized.length;index+=1){const character=normalized[index];if(character!=="-"&&character!=="_"){property+=character;continue}let nextIndex=index+1;while(normalized[nextIndex]==="-"||normalized[nextIndex]==="_"){nextIndex+=1}const nextCharacter=normalized[nextIndex];if(nextCharacter!==void 0&&(nextCharacter>="a"&&nextCharacter<="z"||nextCharacter>="0"&&nextCharacter<="9")){property+=nextCharacter.toUpperCase();index=nextIndex;continue}property+=normalized.slice(index,nextIndex);index=nextIndex-1}return PM_TOOL_RESERVED_CUSTOM_FIELD_PROPERTIES.has(property)?{field,property,owner:"mcp_tool_input",nested_path:`options.${property}`}:void 0}const PM_TOOL_ACTION_MUTATION_PARAMETER_KEYS={create:["fullChangedFields","idOnly"],copy:["fullChangedFields","idOnly"],update:["fullChangedFields","idOnly"],"item-reopen":["fullChangedFields","idOnly"],close:["fullChangedFields","idOnly"],claim:["fullChangedFields","idOnly"],restore:["fullChangedFields","idOnly"],append:["fullChangedFields"],"update-many":["fullChangedFields"],"close-many":["fullChangedFields"],assurance:["fullChangedFields","idOnly"]};const PLAN_CREATE_METADATA_PARAMETER_KEYS=["createMode","status","deadline","estimate","acceptanceCriteria","definitionOfReady","order","rank","goal","objective","value","impact","outcome","whyNow","assignee","reviewer","risk","confidence","sprint","release","blockedReason","unblockNote","reporter","severity","environment","reproSteps","resolution","expectedResult","actualResult","affectedVersion","fixedVersion","component","regression","customerImpact","comment","note","learning","reminder","event","typeOption"];const PM_TOOL_ACTION_NESTED_OPTION_COMPATIBILITY_KEYS=Object.freeze({"close-many":["list","expected_result","expected","actual_result","actual","validate_close","dry_run","checkpoint","no_checkpoint","filterAssignee_filter"],"update-many":["list","update","dry_run","checkpoint","no_checkpoint","filterAssignee_filter"],...Object.fromEntries(PM_TOOL_ACTIONS.filter(action=>action==="upgrade"||action==="install"||action==="extension"||action==="package"||action.startsWith("extension-")||action.startsWith("package-")).map(action=>[action,["project","local","global"]]))});function toSchemaKeyList(values){return normalizeUniqueStringList(values)}const CREATE_CONTRACT_PARAMETER_KEYS=toSchemaKeyList([...TOOL_CREATE_OPTION_CONTRACTS.map(entry=>entry.param),...TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACTS.map(entry=>entry.param),"assignee","closeReason","completedAt"]);const UPDATE_CONTRACT_PARAMETER_KEYS=toSchemaKeyList([...TOOL_UPDATE_OPTION_CONTRACTS.map(entry=>entry.param),...TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACTS.map(entry=>entry.param),"force"]);const UPDATE_MANY_CONTRACT_PARAMETER_KEYS=toSchemaKeyList([...TOOL_UPDATE_MANY_FILTER_OPTION_CONTRACTS.map(entry=>entry.param),...UPDATE_CONTRACT_PARAMETER_KEYS.filter(key=>key!=="allowMissingParent"&&key!=="completedAt"),"dryRun","rollback","noCheckpoint"]);const CLOSE_MANY_CONTRACT_PARAMETER_KEYS=toSchemaKeyList([...TOOL_CLOSE_MANY_FILTER_OPTION_CONTRACTS.map(entry=>entry.param),"reason","completedAt","resolution","expectedResult","actualResult","validateClose","dryRun","rollback","noCheckpoint","author","message","force"]);const CONTEXT_CONTRACT_PARAMETER_KEYS=toSchemaKeyList([...TOOL_CONTEXT_OPTION_CONTRACTS.map(entry=>entry.param),"past","section"]);const ACTIVITY_CONTRACT_PARAMETER_KEYS=toSchemaKeyList([...TOOL_ACTIVITY_OPTION_CONTRACTS.map(entry=>entry.param),"stream"]);const LIST_CONTRACT_PARAMETER_KEYS=toSchemaKeyList([...TOOL_LIST_FILTER_OPTION_CONTRACTS.map(entry=>entry.param),"all","includeBody","noTruncate","strictRead","compact","brief","full"]);const FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS=LIST_CONTRACT_PARAMETER_KEYS.filter(parameter=>parameter!=="all"&&parameter!=="status");const LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS=[[{property:"today",schema:{const:true}},{property:"recent",schema:{const:true}}],[{property:"today",schema:{const:true}},{property:"updatedAfter",schema:{type:"string",pattern:"\\S"}}],[{property:"recent",schema:{const:true}},{property:"updatedAfter",schema:{type:"string",pattern:"\\S"}}]];const CONTRACTS_PROJECTION_MUTUALLY_EXCLUSIVE_GROUPS=[[{property:"summary",schema:{const:true}},{property:"schemaOnly",schema:{const:true}}],[{property:"summary",schema:{const:true}},{property:"flagsOnly",schema:{const:true}}],[{property:"summary",schema:{const:true}},{property:"availabilityOnly",schema:{const:true}}],[{property:"schemaOnly",schema:{const:true}},{property:"flagsOnly",schema:{const:true}}],[{property:"schemaOnly",schema:{const:true}},{property:"availabilityOnly",schema:{const:true}}],[{property:"flagsOnly",schema:{const:true}},{property:"availabilityOnly",schema:{const:true}}]];const AGGREGATE_CONTRACT_PARAMETER_KEYS=toSchemaKeyList([...TOOL_AGGREGATE_OPTION_CONTRACTS.map(entry=>entry.param),"count","completion","includeUnparented"]);const SEARCH_CONTRACT_PARAMETER_KEYS=toSchemaKeyList(["query","keywords","mode","semantic","hybrid","includeLinked","titleExact","phraseExact","highlight","compact","full",...TOOL_SEARCH_FILTER_OPTION_CONTRACTS.map(entry=>entry.param)]);const NEXT_CONTRACT_PARAMETER_KEYS=toSchemaKeyList(["type","tag","priority","assignee","assigneeFilter","sprint","release","parent","limit","blockedLimit","readyOnly","format","includeDecisions","includeGates","includeContainers","tokenBudget","explainRanking"]);const AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS=["author","message","force"];const CLOSE_ACTION_OPTION_KEYS=["text","reason","closeReason","completedAt","duplicateOf","validateClose","resolution","expectedResult","actualResult"];const LIFECYCLE_AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS=["author","assignee","message","force"];const MANAGED_EXTENSION_PACKAGE_OPTION_KEYS=["dryRun","target","scope","capability","declarative","github","ref","init","install","uninstall","explore","manage","describe","markdown","output","reload","doctor","catalog","list","adopt","adoptAll","activate","deactivate","runtimeProbe","fixManagedState","isolated","ignoreGlobal","detail","trace","watch","strictExit","failOnWarn"];function managedLifecycleSchemaContracts(prefix){return{[`${prefix}-init`]:{required:["target"],optional:["scope","capability",...prefix==="package"?["declarative"]:[]]},[`${prefix}-install`]:{optional:["target","github","scope","ref","dryRun"],anyOfRequired:[["target"],["github"]]},[`${prefix}-uninstall`]:{required:["target"],optional:["scope"]},[`${prefix}-explore`]:{optional:["scope"]},[`${prefix}-manage`]:{optional:["scope","runtimeProbe","fixManagedState"]},[`${prefix}-describe`]:{optional:["target","scope","markdown","output"]},[`${prefix}-reload`]:{optional:["scope","watch"]},[`${prefix}-doctor`]:{optional:["scope","detail","trace","fixManagedState","isolated","ignoreGlobal","strictExit","failOnWarn"]},[`${prefix}-catalog`]:{optional:["scope","fields"]},[`${prefix}-adopt`]:{required:["target"],optional:["scope","github","ref"]},[`${prefix}-adopt-all`]:{optional:["scope"]},[`${prefix}-activate`]:{required:["target"],optional:["scope"]},[`${prefix}-deactivate`]:{required:["target"],optional:["scope"]},[prefix]:{optional:MANAGED_EXTENSION_PACKAGE_OPTION_KEYS,dependentAnyOfRequired:[{property:"dryRun",value:true,anyOfRequired:[["install","target"],["install","github"]]}],mutuallyExclusiveWhen:[[{property:"dryRun",schema:{const:true}},{property:"install",schema:{const:false}}]]}}}const SCHEDULING_ACTION_SCHEMA_CONTRACT={required:["title"],optional:["start","duration","end","location","timezone","allDay","parent","allowMissingParent","tags","priority","body","description","author","message"]};const UPGRADE_ACTION_SCHEMA_CONTRACT={optional:["target","scope","dryRun","cliOnly","packagesOnly","repair","tag","packageName"]};const PM_TOOL_ACTION_SCHEMA_CONTRACTS={init:{optional:["prefix","idPrefix","workspace","preset","typePreset","defaults","author","agentGuidance","withPackages","mergeFence","force","verbose"]},config:{required:["scope","configAction"],optional:["key","value","criterion","clearCriteria","format","policy"]},...managedLifecycleSchemaContracts("extension"),...managedLifecycleSchemaContracts("package"),"package-upgrade":UPGRADE_ACTION_SCHEMA_CONTRACT,install:{optional:["target","github","scope","ref","dryRun"],anyOfRequired:[["target"],["github"]]},upgrade:UPGRADE_ACTION_SCHEMA_CONTRACT,create:{required:["title","description","type","status","priority","message"],optional:CREATE_CONTRACT_PARAMETER_KEYS},copy:{required:["id"],optional:["title","author","message","allowDuplicate"]},focus:{optional:["id","clear"],mutuallyExclusive:[["id","clear"]]},list:{optional:LIST_CONTRACT_PARAMETER_KEYS,mutuallyExclusiveWhen:LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS},"list-all":{optional:LIST_CONTRACT_PARAMETER_KEYS,mutuallyExclusiveWhen:LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS},"list-draft":{optional:FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS,mutuallyExclusiveWhen:LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS},"list-open":{optional:FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS,mutuallyExclusiveWhen:LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS},"list-in-progress":{optional:FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS,mutuallyExclusiveWhen:LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS},"list-blocked":{optional:FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS,mutuallyExclusiveWhen:LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS},"list-closed":{optional:FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS,mutuallyExclusiveWhen:LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS},"list-canceled":{optional:FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS,mutuallyExclusiveWhen:LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS},aggregate:{optional:AGGREGATE_CONTRACT_PARAMETER_KEYS},guide:{optional:["list","format","depth"]},context:{optional:CONTEXT_CONTRACT_PARAMETER_KEYS},ctx:{optional:CONTEXT_CONTRACT_PARAMETER_KEYS},get:{required:["id"],optional:["for","tokenBudget","at","depth","full","fields","tree","treeDepth","format"]},search:{optional:SEARCH_CONTRACT_PARAMETER_KEYS,anyOfRequired:[["query"],["keywords"]]},eval:{optional:["mode","k","failUnder","queries","format"]},events:{optional:["since","type","author","item","limit","full","provenance","provenanceSummary","harness","agentInstance","provenanceFilter","cursorMode"]},merge:{required:["subcommand"],optional:["dryRun","author","message","force","includeReconciled","artifact","basePath","oursPath","theirsPath","output","outputPath","itemPath","prefer"]},workspace:{required:["subcommand"],optional:["snapshotAction","name","target","dryRun","force","author","message","lockTtlSeconds","lockWaitMs"],conditionalRequired:[{property:"subcommand",value:"snapshot",required:["snapshotAction"]}]},meet:SCHEDULING_ACTION_SCHEMA_CONTRACT,event:SCHEDULING_ACTION_SCHEMA_CONTRACT,remind:{required:["title"],optional:["at","text","parent","allowMissingParent","tags","priority","body","description","author","message"]},next:{optional:[...NEXT_CONTRACT_PARAMETER_KEYS,"for"]},reindex:{optional:["mode","progress"]},history:{required:["id"],optional:["limit","compact","full","provenance","provenanceSummary","harness","agentInstance","provenanceFilter","diff","verify","field","strictExit","failOnWarn","format"]},"history-redact":{required:["id"],optional:["literal","regex","replacement","dryRun",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],anyOfRequired:[["literal"],["regex"]]},"history-repair":{optional:["id","all","dryRun","normalizeProvenance","salvageTail",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],oneOfRequired:[["id"],["all"]],mutuallyExclusiveWhen:[[{property:"salvageTail",schema:{const:true}},{property:"all",schema:{const:true}}],[{property:"salvageTail",schema:{const:true}},{property:"normalizeProvenance",schema:{const:true}}]]},"history-author-acknowledge":{optional:["historyEvent","allActionable","dryRun","planFingerprint","limit","attributedAuthor","reviewer","reason"],oneOfRequired:[["historyEvent"],["allActionable"]]},"history-compact":{optional:["id","before","ids","allOver","closed","allStreams","minEntries","dryRun",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS]},schema:{mutuallyExclusiveWhen:[[{property:"subcommand",schema:{const:"policy-mode"}},{property:"name",schema:{not:{enum:["advise","refuse"]}}}]],required:["subcommand"],optional:["definition","policy","message","name","description","defaultStatus","folder","alias","role","order","fieldType","commands","cliFlag","required","requiredOnCreate","allowUnset","requiredTypes","typePreset","infer","minCount","apply","to","migrationId","fieldTypeScope","dryRun","author","force"],conditionalRequired:[{property:"subcommand",value:"policy-put",required:["name","definition"]},{property:"subcommand",value:"policy-remove",required:["name"]},{property:"subcommand",value:"policy-mode",required:["name"]},{property:"subcommand",value:"policy-check",required:["name"]},{property:"subcommand",value:"policy-approve",required:["name","policy"]},{property:"subcommand",value:"show",required:["name"]},{property:"subcommand",value:"show-status",required:["name"]},{property:"subcommand",value:"add-type",required:["name"]},{property:"subcommand",value:"remove-type",required:["name"]},{property:"subcommand",value:"add-status",required:["name"]},{property:"subcommand",value:"remove-status",required:["name"]},{property:"subcommand",value:"add-field",required:["name"]},{property:"subcommand",value:"remove-field",required:["name"]},{property:"subcommand",value:"show-field",required:["name"]},{property:"subcommand",value:"rename-type",required:["name","to"]},{property:"subcommand",value:"rename-field",required:["name","to"]},{property:"subcommand",value:"remap-status",required:["name","to"]},{property:"subcommand",value:"apply-preset",required:["typePreset"]}]},profile:{required:["subcommand"],optional:["name","dryRun","author","force"],conditionalRequired:[{property:"subcommand",value:"show",required:["name"]},{property:"subcommand",value:"apply",required:["name"]},{property:"subcommand",value:"lint",required:["name"]}]},plan:{required:["subcommand"],optional:["id","stepRef","reorderTo","title","description","template","scope","parent","related","blocks","blockedBy","harness","mode","resumeContext","tags","priority",...PLAN_CREATE_METADATA_PARAMETER_KEYS,"body","claim","fromSearch","stepTitle","step","stepBody","stepOwner","stepStatus","stepEvidence","stepBlockedReason","stepReplacement","dependsOn","link","linkKind","linkNote","promoteToItemDep","allowMultipleActive","file","test","doc","decisionText","decision","decisionRationale","decisionEvidence","discoveryText","discovery","validationText","validation","validationCommand","validationExpected","depth","fields","steps","materializeType","materializeParent","materializeTags","field",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS]},activity:{optional:ACTIVITY_CONTRACT_PARAMETER_KEYS},restore:{required:["id","target"],optional:AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS},update:{required:["id"],optional:UPDATE_CONTRACT_PARAMETER_KEYS,mutuallyExclusive:[["acceptanceCriteria","addAc"],["acceptanceCriteria","removeAc"]]},"update-many":{optional:UPDATE_MANY_CONTRACT_PARAMETER_KEYS,mutuallyExclusive:[["acceptanceCriteria","addAc"],["acceptanceCriteria","removeAc"]]},close:{required:["id"],optional:[...CLOSE_ACTION_OPTION_KEYS,...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS]},"close-many":{optional:CLOSE_MANY_CONTRACT_PARAMETER_KEYS},delete:{required:["id"],optional:["dryRun",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS]},append:{required:["id","body"],optional:AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS},comments:{required:["id"],optional:["text","add","stdin","edit","delete","limit","full","ifAbsent",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],mutuallyExclusive:[["edit","ifAbsent"],["delete","ifAbsent"]]},notes:{required:["id"],optional:["text","add","addJson","stdin","edit","delete","limit","since","eventType","includeMeta","full","ifAbsent",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],mutuallyExclusive:[["addJson","add"],["addJson","stdin"],["addJson","file"],["addJson","edit"],["addJson","delete"],["edit","ifAbsent"],["delete","ifAbsent"]]},learnings:{required:["id"],optional:["text","add","stdin","edit","delete","limit","full","ifAbsent",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],mutuallyExclusive:[["edit","ifAbsent"],["delete","ifAbsent"]]},files:{required:[],optional:["id","add","addGlob","remove","migrate","list","addNote","discover","apply","discoveryNote","appendStable","validatePaths","lookupPath","scope","limit","offset","noTruncate","strictRead","explain","lines","decisionDepth",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],anyOfRequired:[["id"],["lookupPath"]],dependentAnyOfRequired:[{property:"addNote",anyOfRequired:[["add"],["addGlob"]]}]},docs:{required:["id"],optional:["add","addGlob","remove","migrate","addNote","list","validatePaths",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],dependentAnyOfRequired:[{property:"addNote",anyOfRequired:[["add"],["addGlob"]]}]},deps:{required:["id"],optional:["format","maxDepth","collapse","summary","full","nodeLimit","edgeLimit","tokenBudget","cursor","direction","kind"]},graph:{required:["subcommand"],optional:["id","target","kind","maxDepth","limit","after","direction","maxPaths","sample","exemptIsolate","exemptIsolateType","saveBaseline","rebuild","clear","summary","full"]},test:{required:["id"],optional:["list","add","addJson","remove","removeIndex","run","match","onlyIndex","onlyLast","background","timeout","progress","envSet","envClear","sharedHostSafe","pmContext","overrideLinkedPmContext","workspaceContext","overrideLinkedWorkspaceContext","allowUntrustedLinkedTests","acknowledgeLinkedTests","failOnContextMismatch","failOnSkipped","failOnEmptyTestRun","requireAssertionsForPm","checkContext","autoPmContext","measure","metricBelow","metricDiff",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],mutuallyExclusive:[["acknowledgeLinkedTests","run"],["acknowledgeLinkedTests","background"]]},"test-all":{optional:["status","limit","offset","background","timeout","progress","envSet","envClear","sharedHostSafe","pmContext","overrideLinkedPmContext","workspaceContext","overrideLinkedWorkspaceContext","allowUntrustedLinkedTests","failOnContextMismatch","failOnSkipped","failOnEmptyTestRun","requireAssertionsForPm","checkContext","autoPmContext"]},telemetry:{optional:["subcommand","limit"]},"test-runs-list":{optional:["status","limit"]},"test-runs-status":{required:["runId"]},"test-runs-logs":{required:["runId"],optional:["stream","tail"]},"test-runs-stop":{required:["runId"],optional:["force"]},"test-runs-resume":{required:["runId"],optional:["author"]},stats:{optional:["includeEmpty","storage","metadataCoverage","fieldUtilization","byAssignee","byTag","byPriority","tagPrefix","measurements","metric","measurementLimit","observe","improvementDirection","measurementSource","measurementItem","measurementRevision","author","message","provenanceCoverage","fleetAttribution","since","eventLimit","minimumSample"]},duplicates:{optional:["status","since","threshold","limit","exhaustive"]},health:{optional:["strictDirectories","requireMergeDrivers","strictExit","failOnWarn","checkOnly","checkTelemetry","noRefresh","refreshVectors","verboseStaleItems","verboseAuthorEvents","brief","summary","skipVectors","skipIntegrity","skipDrift","full"]},validate:{optional:["checkCompleteness","checkStorageIntegrity","checkMetadata","metadataProfile","checkResolution","checkLifecycle","checkStaleBlockers","dependencyCycleSeverity","parentCycleSeverity","checkFiles","scanMode","includePmInternals","verboseFileLists","verboseDiagnostics","allAffectedIds","strictExit","failOnWarn","fixHints","autoFix","dryRun","fixScope","pruneMissing","checkHistoryDrift","checkCommandReferences","counts","full"]},assurance:{required:["subcommand"],optional:["kind","id","definition","trigger","treeId","gate","limit","dryRun","author","message","preset","owner","apply","enforcement"],conditionalRequired:[{property:"subcommand",value:"list",required:["kind"]},{property:"subcommand",value:"show",required:["kind","id"]},{property:"subcommand",value:"put",required:["kind","id","definition"]},{property:"subcommand",value:"remove",required:["kind","id"]},{property:"subcommand",value:"run",required:["id","trigger"]},{property:"subcommand",value:"apply",required:["preset","owner"]},{property:"subcommand",value:"derive",required:["owner"]},{property:"subcommand",value:"risk",required:["definition"]},{property:"subcommand",value:"lineages",required:["definition"]},{property:"subcommand",value:"promote",required:["id","enforcement"]}],mutuallyExclusiveWhen:[[{property:"subcommand",schema:{const:"risk"}},{property:"definition",schema:{not:{required:["policy","change"]}}}],[{property:"subcommand",schema:{const:"lineages"}},{property:"definition",schema:{anyOf:[{required:["change"]},{not:{required:["policy"]}}]}}]]},gc:{optional:["dryRun","gcScope"]},contracts:{optional:["contractAction","command","summary","schemaOnly","flagsOnly","availabilityOnly","runtimeOnly","activeOnly","full"],mutuallyExclusiveWhen:CONTRACTS_PROJECTION_MUTUALLY_EXCLUSIVE_GROUPS},completion:{required:["shell"],optional:["eagerTags"]},claim:{optional:["id","next","ifAvailable","maxAttempts","includeDecisions",...NEXT_CONTRACT_PARAMETER_KEYS,...LIFECYCLE_AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],oneOfRequired:[["id"],["next"]]},release:{required:["id"],optional:LIFECYCLE_AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS},"start-task":{required:["id"],optional:LIFECYCLE_AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS},"pause-task":{required:["id"],optional:LIFECYCLE_AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS},"close-task":{required:["id"],optional:["text","validateClose",...LIFECYCLE_AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS]},"item-reopen":{required:["id","reason"],optional:["status","author","message","force"]}};const PM_TOOL_ACTION_PARAMETER_CONTRACTS=Object.freeze(Object.fromEntries(PM_TOOL_ACTIONS.map(action=>[action,PM_TOOL_ACTION_SCHEMA_CONTRACTS[action]])));function fallbackToolParameterDescription(key){return key.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").trim().replace(/^./,value=>value.toUpperCase()).concat(".")}function decorateToolParameterDefinition(key,definition){const baseDefinition=typeof definition==="object"&&definition!==null?{...definition}:{};const metadata=PM_TOOL_PARAMETER_METADATA[key];return{...baseDefinition,description:metadata?.description??fallbackToolParameterDescription(key),...metadata?.examples?{examples:metadata.examples}:{}}}function actionScopedToolParameterMetadata(action,key){if((action==="list"||action.startsWith("list-"))&&key==="all"){return{description:"Return items from every lifecycle status instead of the default active-status set."}}if(action==="plan"&&Object.prototype.hasOwnProperty.call(PLAN_ACTION_PARAMETER_METADATA,key)){return PLAN_ACTION_PARAMETER_METADATA[key]}const actionOverrides=PM_TOOL_ACTION_SCOPED_PARAMETER_METADATA[action];if(actionOverrides&&Object.prototype.hasOwnProperty.call(actionOverrides,key)){return actionOverrides[key]}return PM_TOOL_PARAMETER_METADATA[key]}function decorateActionScopedToolParameterDefinition(action,key,definition){const baseDefinition=typeof definition==="object"&&definition!==null?{...definition}:{};const metadata=actionScopedToolParameterMetadata(action,key);return{...baseDefinition,description:metadata?.description??fallbackToolParameterDescription(key),...metadata?.examples?{examples:metadata.examples}:{}}}function actionScopedToolParameterDefinition(action,key){const actionProperties=PM_TOOL_ACTION_SCOPED_PARAMETER_PROPERTIES[action];if(actionProperties&&Object.prototype.hasOwnProperty.call(actionProperties,key)){return actionProperties[key]}if(action==="plan"&&Object.prototype.hasOwnProperty.call(PLAN_ACTION_PARAMETER_PROPERTIES,key)){return PLAN_ACTION_PARAMETER_PROPERTIES[key]}if((action==="get"||action==="history"||action==="search")&&key==="format"){return{type:"string",enum:["json","toon"]}}return PM_TOOL_PARAMETER_PROPERTIES[key]}function buildActionScopedSchemaProperties(action,allowedKeys){const properties={action:{const:action,description:PM_TOOL_PARAMETER_METADATA.action?.description??"Tool action to execute."}};for(const key of allowedKeys){if(key==="action"){continue}const definition=actionScopedToolParameterDefinition(action,key);if(definition){properties[key]=decorateActionScopedToolParameterDefinition(action,key,definition)}}return properties}function buildOneOfSchemaEntries(action,oneOfRequiredGroups){const allOneOfFields=oneOfRequiredGroups.flat();return oneOfRequiredGroups.map(requiredFields=>{const otherFields=allOneOfFields.filter(field=>!requiredFields.includes(field));return{required:[...requiredFields],...otherFields.length>0?{not:{anyOf:otherFields.map(field=>({required:[field]}))}}:{},...action==="history-repair"&&requiredFields.includes("all")?{properties:{all:{const:true}}}:action==="claim"&&requiredFields.includes("next")?{properties:{next:{const:true}}}:{}}})}function schemaPropertyCondition(property,value){return{...value===void 0?{}:{properties:{[property]:{const:value}}},required:[property]}}function buildActionScopedAllOf(contract){const allOf=[];if(contract.conditionalRequired&&contract.conditionalRequired.length>0){for(const entry of contract.conditionalRequired){allOf.push({if:schemaPropertyCondition(entry.property,entry.value),then:{required:entry.required}})}}if(contract.dependentAnyOfRequired&&contract.dependentAnyOfRequired.length>0){for(const entry of contract.dependentAnyOfRequired){allOf.push({if:schemaPropertyCondition(entry.property,entry.value),then:{anyOf:entry.anyOfRequired.map(requiredFields=>({required:[...requiredFields]}))}})}}if(contract.mutuallyExclusive&&contract.mutuallyExclusive.length>0){for(const group of contract.mutuallyExclusive){allOf.push({not:{required:toSchemaKeyList(group)}})}}if(contract.mutuallyExclusiveWhen&&contract.mutuallyExclusiveWhen.length>0){for(const group of contract.mutuallyExclusiveWhen){allOf.push({not:{allOf:group.map(condition=>({properties:{[condition.property]:condition.schema},required:[condition.property]}))}})}}return allOf}function pmToolActionParameterKeys(action){if(!Object.prototype.hasOwnProperty.call(PM_TOOL_ACTION_SCHEMA_CONTRACTS,action)){return void 0}const contract=PM_TOOL_ACTION_SCHEMA_CONTRACTS[action];const mutationParameterKeys=PM_TOOL_ACTION_MUTATION_PARAMETER_KEYS[action]??[];return toSchemaKeyList(["action",...PM_TOOL_GLOBAL_PARAMETER_KEYS,...resolveReadOutputSurface(action)!==void 0?PM_TOOL_READ_OUTPUT_PARAMETER_KEYS:[],...mutationParameterKeys,...contract.required??[],...contract.optional??[]])}function pmToolActionNestedOptionKeys(action){const parameterKeys=pmToolActionParameterKeys(action);if(parameterKeys===void 0)return void 0;return toSchemaKeyList([...parameterKeys,...PM_TOOL_ACTION_NESTED_OPTION_COMPATIBILITY_KEYS[action]??[]])}function buildActionScopedToolSchema(action){const contract=PM_TOOL_ACTION_SCHEMA_CONTRACTS[action];const required=toSchemaKeyList(contract.required??[]);const allowedKeys=pmToolActionParameterKeys(action);const schema={type:"object",additionalProperties:false,required:["action",...required],title:`pm action "${action}" parameters`,properties:buildActionScopedSchemaProperties(action,allowedKeys)};if(contract.anyOfRequired&&contract.anyOfRequired.length>0){schema.anyOf=contract.anyOfRequired.map(requiredFields=>({required:[...requiredFields]}))}if(contract.oneOfRequired&&contract.oneOfRequired.length>0){schema.oneOf=buildOneOfSchemaEntries(action,contract.oneOfRequired)}const allOf=buildActionScopedAllOf(contract);if(allOf.length>0){schema.allOf=allOf}return schema}function buildPmActionToolInputSchema(action,options={}){const actionSchema=buildActionScopedToolSchema(action);const actionProperties={...actionSchema.properties};delete actionProperties.action;const conditionalBranches=[...actionSchema.anyOf??[],...actionSchema.oneOf??[]];const required=(options.required??actionSchema.required.map(String)).filter(key=>{if(key==="action")return false;if(options.required===void 0)return true;return!conditionalBranches.some(branch=>branch.required?.map(String).includes(key))});const schema={type:"object",additionalProperties:options.additionalProperties??true,properties:{...actionProperties,options:{type:"object",additionalProperties:true,description:"Advanced command options forwarded to the selected pm action."},...options.properties},required};if(actionSchema.anyOf!==void 0)schema.anyOf=actionSchema.anyOf;if(actionSchema.oneOf!==void 0)schema.oneOf=actionSchema.oneOf;if(actionSchema.allOf!==void 0)schema.allOf=actionSchema.allOf;return schema}function createLazyContractSchema(build){let value;const resolve=()=>value??=build();return new Proxy({},{get:(_target,prop)=>resolve()[prop],has:(_target,prop)=>prop in resolve(),ownKeys:()=>Reflect.ownKeys(resolve()),getOwnPropertyDescriptor:(_target,prop)=>{const descriptor=Reflect.getOwnPropertyDescriptor(resolve(),prop);if(descriptor){descriptor.configurable=true}return descriptor}})}const PM_TOOL_PARAMETERS_SCHEMA_VERSION="4.16.0";const PM_TOOL_PARAMETERS_SCHEMA_MAJOR=PM_TOOL_PARAMETERS_SCHEMA_VERSION.split(".")[0];const PM_PROVIDER_TOOL_PARAMETERS_SCHEMA_VERSION="1.7.0";const PM_TOOL_PARAMETERS_SCHEMA=createLazyContractSchema(()=>({$schema:"https://json-schema.org/draft/2020-12/schema",$id:`https://schema.unbrained.dev/pm-cli/tool-parameters-v${PM_TOOL_PARAMETERS_SCHEMA_MAJOR}.schema.json`,title:"pm-cli tool parameters (action-scoped strict schema)","x-schema-version":PM_TOOL_PARAMETERS_SCHEMA_VERSION,type:"object",oneOf:PM_TOOL_ACTIONS.map(action=>buildActionScopedToolSchema(action))}));function toProviderCompatibleParameterDefinition(key,definition){const decorated=decorateToolParameterDefinition(key,definition);if(typeof decorated.type==="string"){return decorated}const anyOf=Array.isArray(decorated.anyOf)?decorated.anyOf:[];const firstTypedVariant=anyOf.find(variant=>typeof variant.type==="string");if(firstTypedVariant){const{anyOf:_anyOf2,...rest2}=decorated;return{...firstTypedVariant,...rest2}}const{anyOf:_anyOf,...rest}=decorated;return{...rest,type:"string"}}function buildProviderCompatibleToolSchema(){const properties={action:{type:"string",description:PM_TOOL_PARAMETER_METADATA.action?.description??"Tool action to execute."},options:{type:"object",additionalProperties:true,description:"Advanced command options object forwarded to the selected pm action."}};for(const key of Object.keys(PM_TOOL_PARAMETER_PROPERTIES).sort()){properties[key]=toProviderCompatibleParameterDefinition(key,PM_TOOL_PARAMETER_PROPERTIES[key])}return{title:"pm-cli tool parameters (provider-compatible flat schema)","x-schema-version":PM_PROVIDER_TOOL_PARAMETERS_SCHEMA_VERSION,type:"object",additionalProperties:false,required:["action"],properties}}const PM_PROVIDER_TOOL_PARAMETERS_SCHEMA=createLazyContractSchema(buildProviderCompatibleToolSchema);const _testOnlyCliContracts={buildActionScopedToolSchema,buildProviderCompatibleToolSchema,decorateActionScopedToolParameterDefinition,decorateToolParameterDefinition,toolActionSchemaContracts:PM_TOOL_ACTION_SCHEMA_CONTRACTS,toolParameterMetadata:PM_TOOL_PARAMETER_METADATA,toProviderCompatibleParameterDefinition,toUniqueFlagContracts,withFlagAliasMetadata};export{CLOSE_ACTION_OPTION_KEYS,PLAN_CREATE_METADATA_PARAMETER_KEYS,PM_PROVIDER_TOOL_PARAMETERS_SCHEMA,PM_PROVIDER_TOOL_PARAMETERS_SCHEMA_VERSION,PM_TOOL_ACTION_PARAMETER_CONTRACTS,PM_TOOL_PARAMETERS_SCHEMA,PM_TOOL_PARAMETERS_SCHEMA_MAJOR,PM_TOOL_PARAMETERS_SCHEMA_VERSION,PM_TOOL_RESERVED_CUSTOM_FIELD_PROPERTIES,_testOnlyCliContracts,buildPmActionToolInputSchema,pmToolActionNestedOptionKeys,pmToolActionParameterKeys,resolvePmToolCustomFieldCollision};
2
2
  //# sourceMappingURL=tool-schema.js.map
@@ -1,4 +1,4 @@
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]="56fd6790-568a-5c97-ab94-4b645aaa3718")}catch(e2){}})();import{EXIT_CODE,PmCliError}from"./runtime-primitives.js";import{listPmCommandsForTier}from"./agent-capability-contracts.js";import{SCAFFOLD_CAPABILITIES}from"./extension/scaffold.js";import{AGGREGATE_FLAG_CONTRACTS,APPEND_FLAG_CONTRACTS,CALENDAR_FLAG_CONTRACTS,CLOSE_MANY_FLAG_CONTRACTS,COMPLETION_FLAG_CONTRACTS,CONTRACTS_FLAG_CONTRACTS,CONTEXT_FLAG_CONTRACTS,COPY_FLAG_CONTRACTS,FOCUS_FLAG_CONTRACTS,MEET_FLAG_CONTRACTS,REMIND_FLAG_CONTRACTS,CREATE_FLAG_CONTRACTS,DEPS_FLAG_CONTRACTS,DUPLICATES_FLAG_CONTRACTS,EXTENSION_FLAG_CONTRACTS,GRAPH_FLAG_CONTRACTS,GET_FLAG_CONTRACTS,GUIDE_FLAG_CONTRACTS,GLOBAL_FLAG_CONTRACTS,HEALTH_FLAG_CONTRACTS,HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS,HISTORY_FLAG_CONTRACTS,INIT_FLAG_CONTRACTS,LIST_FILTER_FLAG_CONTRACTS,NEXT_FLAG_CONTRACTS,PM_COMMAND_ALIAS_CONTRACTS,PM_HISTORY_COMMAND_ALIASES,resolveSubcommandFlagContractsForCommand,PACKAGE_FLAG_CONTRACTS,PLAN_FLAG_CONTRACTS,SEARCH_FLAG_CONTRACTS,STATS_FLAG_CONTRACTS,EVENTS_FLAG_CONTRACTS,UPDATE_FLAG_CONTRACTS,UPDATE_MANY_FLAG_CONTRACTS,UPGRADE_FLAG_CONTRACTS,toCompletionFlagString}from"./cli-contracts.js";import{BUILTIN_ITEM_TYPE_VALUES,STATUS_VALUES}from"../types/index.js";import{listGuideTopicIds}from"./guide-topics.js";import{enrichCliFlagInvocationContracts}from"./flag-invocation-contracts.js";import{GLOBAL_VALUE_CONSUMING_FLAGS}from"./cli-contracts/bootstrap-command-scanner.js";const VALID_SHELLS=["bash","zsh","fish"];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=>!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 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 HISTORY_LEAVES=PM_HISTORY_COMMAND_ALIASES.map(entry=>entry.canonical_argv[1]).join(" ");const HISTORY_OPERATION_FLAGS=PM_HISTORY_COMMAND_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 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="--author --message --validate-close --duplicate-of --force --json --quiet --no-changed-fields --id-only --pm-path --path --no-extensions --no-pager --profile --help";const RELEASE_MUTATION_FLAGS="--author --message --force --json --quiet --no-changed-fields --id-only --pm-path --path --no-extensions --no-pager --profile --help";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"],["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 FISH_COMMAND_DESCRIPTION_OVERRIDES=new Map([["calendar","Show deadline/reminder calendar views"],["schema","Inspect and manage runtime schema"],["profile","List, show, apply, and lint project profiles (archetype bundles)"],["plan","Agent-optimized Plan workflow (create/show/add-step/update-step/complete-step/link/approve/materialize)"],["start-task","Lifecycle alias to claim and set in-progress"]]);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))}function renderZshRuntimeFieldFlagSpecs(runtimeFlags){const normalized=normalizeRuntimeCompletionFlags(runtimeFlags);if(normalized.length===0){return""}return`${normalized.map(flag=>` '${flag}[Runtime schema field flag]:value' \\`).join("\n")}
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]="79ec64d0-27b8-514f-a983-64971ed3cf18")}catch(e2){}})();import{WORKFLOW_POLICY_ACTIONS}from"./cli-contracts/enum-contracts.js";import{EXIT_CODE,PmCliError}from"./runtime-primitives.js";import{listPmCommandsForTier}from"./agent-capability-contracts.js";import{SCAFFOLD_CAPABILITIES}from"./extension/scaffold.js";import{AGGREGATE_FLAG_CONTRACTS,APPEND_FLAG_CONTRACTS,CALENDAR_FLAG_CONTRACTS,CLOSE_MANY_FLAG_CONTRACTS,COMPLETION_FLAG_CONTRACTS,CONTRACTS_FLAG_CONTRACTS,CONTEXT_FLAG_CONTRACTS,COPY_FLAG_CONTRACTS,FOCUS_FLAG_CONTRACTS,MEET_FLAG_CONTRACTS,REMIND_FLAG_CONTRACTS,CREATE_FLAG_CONTRACTS,DEPS_FLAG_CONTRACTS,DUPLICATES_FLAG_CONTRACTS,EXTENSION_FLAG_CONTRACTS,GRAPH_FLAG_CONTRACTS,GET_FLAG_CONTRACTS,GUIDE_FLAG_CONTRACTS,GLOBAL_FLAG_CONTRACTS,HEALTH_FLAG_CONTRACTS,HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS,HISTORY_FLAG_CONTRACTS,INIT_FLAG_CONTRACTS,LIST_FILTER_FLAG_CONTRACTS,NEXT_FLAG_CONTRACTS,PM_COMMAND_ALIAS_CONTRACTS,PM_HISTORY_COMMAND_ALIASES,resolveSubcommandFlagContractsForCommand,PACKAGE_FLAG_CONTRACTS,PLAN_FLAG_CONTRACTS,SEARCH_FLAG_CONTRACTS,STATS_FLAG_CONTRACTS,EVENTS_FLAG_CONTRACTS,UPDATE_FLAG_CONTRACTS,UPDATE_MANY_FLAG_CONTRACTS,UPGRADE_FLAG_CONTRACTS,toCompletionFlagString}from"./cli-contracts.js";import{BUILTIN_ITEM_TYPE_VALUES,STATUS_VALUES}from"../types/index.js";import{listGuideTopicIds}from"./guide-topics.js";import{enrichCliFlagInvocationContracts}from"./flag-invocation-contracts.js";import{GLOBAL_VALUE_CONSUMING_FLAGS}from"./cli-contracts/bootstrap-command-scanner.js";const VALID_SHELLS=["bash","zsh","fish"];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=>!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 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 HISTORY_LEAVES=PM_HISTORY_COMMAND_ALIASES.map(entry=>entry.canonical_argv[1]).join(" ");const HISTORY_OPERATION_FLAGS=PM_HISTORY_COMMAND_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="--author --message --validate-close --duplicate-of --force --json --quiet --no-changed-fields --id-only --pm-path --path --no-extensions --no-pager --profile --help";const RELEASE_MUTATION_FLAGS="--author --message --force --json --quiet --no-changed-fields --id-only --pm-path --path --no-extensions --no-pager --profile --help";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"],["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 FISH_COMMAND_DESCRIPTION_OVERRIDES=new Map([["calendar","Show deadline/reminder calendar views"],["schema","Inspect and manage runtime schema"],["profile","List, show, apply, and lint project profiles (archetype bundles)"],["plan","Agent-optimized Plan workflow (create/show/add-step/update-step/complete-step/link/approve/materialize)"],["start-task","Lifecycle alias to claim and set in-progress"]]);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))}function renderZshRuntimeFieldFlagSpecs(runtimeFlags){const normalized=normalizeRuntimeCompletionFlags(runtimeFlags);if(normalized.length===0){return""}return`${normalized.map(flag=>` '${flag}[Runtime schema field flag]:value' \\`).join("\n")}
2
2
  `}function renderZshArgumentSpecs(specs,options={}){const trailingContinuation=options.trailingContinuation??true;const lastSpecIndex=specs.length-1;return specs.map((spec,index)=>` ${spec}${trailingContinuation||index!==lastSpecIndex?" \\":""}`).join("\n")}function renderZshCommandDescriptions(){return COMMAND_COMPLETION_DESCRIPTIONS.filter(([command])=>!HIDDEN_COMMAND_ALIASES.has(command)).map(([command,description])=>` '${command}:${description}'`).join("\n")}function renderFishCommandDescriptions(){return COMMAND_COMPLETION_DESCRIPTIONS.filter(([command])=>command!=="help"&&!HIDDEN_COMMAND_ALIASES.has(command)).map(([command,description])=>{const fishDescription=FISH_COMMAND_DESCRIPTION_OVERRIDES.get(command)??description;return`complete -c pm -n __pm_no_subcommand -a ${command.padEnd(16)} -d '${fishDescription}'`}).join("\n")}function renderZshPresenceFilterSpecs(options){const missingSpecs=["reviewer-missing[Select only items missing reviewer]","risk-missing[Select only items missing risk]","confidence-missing[Select only items missing confidence]","sprint-missing[Select only items missing sprint]","release-missing[Select only items missing release]"];const contentMissingAliasSpecs=options.includeContentMissingAliases===true?["files-missing[Alias for --no-files]","docs-missing[Alias for --no-docs]"]:[];const pairedSpecs=[["has-notes[Select only items that have notes]","no-notes[Select only items with no notes]"],["has-learnings[Select only items that have learnings]","no-learnings[Select only items with no learnings]"],["has-files[Select only items that have linked files]","no-files[Select only items with no linked files]"],["has-docs[Select only items that have linked docs]","no-docs[Select only items with no linked docs]"],["has-tests[Select only items that have linked tests]","no-tests[Select only items with no linked tests]"],["has-comments[Select only items that have comments]","no-comments[Select only items with no comments]"],["has-deps[Select only items that have dependencies]","no-deps[Select only items with no dependencies]"],["has-body[Select only items with non-empty body]","empty-body[Select only items with empty body]"],["has-linked-command[Select only items that have a linked command]","no-linked-command[Select only items with no linked command]"]];return renderZshArgumentSpecs([...[...missingSpecs,...contentMissingAliasSpecs].map(spec=>`'--${options.missingPrefix}${spec}'`),...pairedSpecs.flatMap(([positive,negative])=>[`'--${options.pairedPrefix}${positive}'`,`'--${options.pairedPrefix}${negative}'`])])}const ZSH_MUTATION_COLLECTION_ARGUMENT_SPECS=["'--comment[Comment seed author=<value>,created_at=<iso|now>,text=<value>]:comment'","'--note[Note seed author=<value>,created_at=<iso|now>,text=<value>]:note'","'--learning[Learning seed author=<value>,created_at=<iso|now>,text=<value>]:learning'","'--file[Linked file path=<value>,scope=<project|global>,note=<text>]:file'","'--test[Linked test command=<value>,path=<value>,scope=<project|global>]:test'","'--doc[Linked doc path=<value>,scope=<project|global>,note=<text>]:doc'","'--reminder[Reminder entry at=<iso|relative>|date=<iso|relative>,text=<text>|title=<text>]:reminder'","'--event[Event entry start=<iso|relative>,end=<iso|relative>,recur_*]:event'","'--type-option[Type option key=value or key=<name>,value=<value>]:type_option'","'--unset[Clear scalar metadata field by name]:field'","'--replace-files[Atomically replace linked files with provided --file values]'","'--replace-docs[Atomically replace linked docs with provided --doc values]'","'--clear-deps[Clear dependency entries]'","'--clear-comments[Clear comments]'","'--clear-notes[Clear notes]'","'--clear-learnings[Clear learnings]'","'--clear-files[Clear linked files]'","'--clear-tests[Clear linked tests]'","'--clear-docs[Clear linked docs]'","'--clear-reminders[Clear reminders]'","'--clear-events[Clear events]'","'--clear-type-options[Clear type options]'"];function renderZshScheduleItemSpecs(kind){const leadingSpecs=kind==="reminder"?["'--at[Reminder time (default +1d)]:at'","'--text[Reminder text (defaults to title)]:text'"]:["'--start[Start time (ISO, now, or relative)]:start'","'--duration[Duration from start (default 1h)]:duration'","'--end[End time (overrides --duration)]:end'","'--location[Location]:location'","'--timezone[IANA timezone]:timezone'","'--all-day[Mark as an all-day event]'"];return renderZshArgumentSpecs([...leadingSpecs,"'--parent[Parent item id]:parent'","'--allow-missing-parent[Permit a parent id that does not exist yet]'","'--tags[Comma-separated tags]:tags'","'(-p --priority)'{-p,--priority}'[Priority (0-4)]:(0 1 2 3 4)'","'(-b --body)'{-b,--body}'[Item body]:body'","'(-d --description)'{-d,--description}'[Short description]:description'","'--author[Mutation author]:author'","'--message[History message]:message'","'--json[Output JSON]'","'--quiet[Suppress stdout]'"],{trailingContinuation:false})}function renderZshBulkSelectionFilterSpecs(action,statusChoices,typeChoices,tagChoices){return renderZshArgumentSpecs([`'--filter-status[Filter by status before ${action}]:(${statusChoices})'`,`'--filter-type[Filter by type before ${action}]:(${typeChoices})'`,`'--filter-tag[Filter by tag before ${action}]:(${tagChoices})'`,`'--filter-priority[Filter by priority before ${action}]:(0 1 2 3 4)'`,"'--filter-deadline-before[Filter by deadline upper bound]:deadline'","'--filter-deadline-after[Filter by deadline lower bound]:deadline'","'--filter-updated-after[Filter by updated_at lower bound (ISO/relative)]:timestamp'","'--filter-updated-before[Filter by updated_at upper bound (ISO/relative)]:timestamp'","'--filter-created-after[Filter by created_at lower bound (ISO/relative)]:timestamp'","'--filter-created-before[Filter by created_at upper bound (ISO/relative)]:timestamp'",`'--filter-assignee[Filter by assignee before ${action}]:assignee'`,"'--filter-assignee-filter[Filter assignee presence]:(assigned unassigned)'","'--filter-parent[Filter by parent item ID]:parent'","'--filter-sprint[Filter by sprint]:sprint'","'--filter-release[Filter by release]:release'"])}function renderFishRuntimeFieldFlagSpecs(commands,runtimeFlags){const normalizedFlags=normalizeRuntimeCompletionFlags(runtimeFlags).map(flag=>flag.slice(2));if(commands.length===0||normalizedFlags.length===0){return""}const lines=[];for(const command of commands){for(const flag of normalizedFlags){lines.push(`complete -c pm -n '__fish_seen_subcommand_from ${command}' -l ${flag} -d 'Runtime schema field flag' -r`)}}return`${lines.join("\n")}
3
3
  `}function renderBashDynamicChoiceResolver(kind,command,fallback){const envKind=kind.toUpperCase();const cacheVar=`PM_COMPLETION_${envKind}_CACHE`;const cacheTsVar=`PM_COMPLETION_${envKind}_CACHE_TS`;const ttlVar=`PM_COMPLETION_${envKind}_TTL`;const escapedFallback=shellDoubleQuote(fallback);return[`_pm_completion_${kind}_choices() {`," local now ttl cache_ts resolved",' now="$(date +%s 2>/dev/null || echo 0)"',` ttl="\${${ttlVar}:-120}"`,` cache_ts="\${${cacheTsVar}:-0}"`,` if [[ -n "\${${cacheVar}:-}" && "$now" -ne 0 && $((now - cache_ts)) -lt "$ttl" ]]; then`,` printf '%s\\n' "$${cacheVar}"`," return 0"," fi",` resolved="$(pm ${command} 2>/dev/null)"`,' if [[ -z "$resolved" ]]; then',` resolved="${escapedFallback}"`," fi",` ${cacheVar}="$resolved"`,` ${cacheTsVar}="$now"`,` printf '%s\\n' "$${cacheVar}"`,"}"]}function renderZshDynamicChoiceResolver(kind,command,fallback){const envKind=kind.toUpperCase();const cacheVar=`PM_COMPLETION_${envKind}_CACHE`;const cacheTsVar=`PM_COMPLETION_${envKind}_CACHE_TS`;const ttlVar=`PM_COMPLETION_${envKind}_TTL`;const escapedFallback=shellDoubleQuote(fallback);return`
4
4
  _pm_${kind}_choices() {
@@ -43,7 +43,7 @@ function __pm_${kind}_choices
43
43
  set -gx PM_COMPLETION_${envKind}_CACHE_TS $now
44
44
  printf '%s\\n' $resolved
45
45
  end
46
- `}function generateBashScript(itemTypes=[],tags=[],eagerTagExpansion=false,runtime={}){const cmds=ALL_COMMANDS.join(" ");const useDynamicTypeExpansion=itemTypes.length===0;const typeValues=completionTypeValues(itemTypes,runtime);const statusValues=completionStatusValues(runtime);const tagValues=joinCompletionValues(tags);const listFlags=mergeFlagStrings(LIST_FLAGS,runtime.command_flags?.list);const createFlags=mergeFlagStrings(CREATE_FLAGS,runtime.command_flags?.create);const updateFlags=mergeFlagStrings(UPDATE_FLAGS,runtime.command_flags?.update);const updateManyFlags=mergeFlagStrings(UPDATE_MANY_FLAGS,runtime.command_flags?.["update-many"]);const searchFlags=mergeFlagStrings(SEARCH_FLAGS,runtime.command_flags?.search);const calendarFlags=mergeFlagStrings(CALENDAR_FLAGS,runtime.command_flags?.calendar);const contextFlags=mergeFlagStrings(CONTEXT_FLAGS,runtime.command_flags?.context);const useEagerTagExpansion=eagerTagExpansion||tags.length>0;const compgen=flags=>`$(compgen -W "${flags}" -- "$cur")`;return["# bash completion for pm",`# Source this file or add 'eval "$(pm completion bash)"' to ~/.bashrc`,"",...useDynamicTypeExpansion?[...renderBashDynamicChoiceResolver("type","completion-types",typeValues),""]:[],...renderBashDynamicChoiceResolver("status","completion-statuses",statusValues),"","_pm_completion() {"," local cur prev words cword"," _init_completion 2>/dev/null || {",' cur="${COMP_WORDS[COMP_CWORD]}"',' prev="${COMP_WORDS[COMP_CWORD-1]}"'," cword=$COMP_CWORD"," }",""," if [[ $cword -eq 1 ]]; then",` COMPREPLY=(${compgen(cmds)})`," return 0"," fi","",' if [[ "$prev" == "--type" ]]; then',useDynamicTypeExpansion?' COMPREPLY=($(compgen -W "$(_pm_completion_type_choices)" -- "$cur"))':` COMPREPLY=(${compgen(typeValues)})`," return 0"," fi","",' if [[ "$prev" == "--status" ]]; then',' COMPREPLY=($(compgen -W "$(_pm_completion_status_choices)" -- "$cur"))'," return 0"," fi","",...useEagerTagExpansion?[' if [[ ( "$prev" == "--tag" || "$prev" == "--tags" ) && ! ( ( "${COMP_WORDS[1]}" == "package" || "${COMP_WORDS[1]}" == "packages" ) && "${COMP_WORDS[2]}" == "upgrade" ) ]]; then',` COMPREPLY=(${compgen(tagValues)})`," return 0"," fi"]:[' if [[ ( "$prev" == "--tag" || "$prev" == "--tags" ) && ! ( ( "${COMP_WORDS[1]}" == "package" || "${COMP_WORDS[1]}" == "packages" ) && "${COMP_WORDS[2]}" == "upgrade" ) ]]; then'," local now ttl cache_ts tag_values",' now="$(date +%s 2>/dev/null || echo 0)"',' ttl="${PM_COMPLETION_TAG_TTL:-120}"',' cache_ts="${PM_COMPLETION_TAG_CACHE_TS:-0}"',' tag_values="${PM_COMPLETION_TAG_CACHE:-}"',' if [[ -z "$tag_values" || "$now" -eq 0 || $((now - cache_ts)) -ge "$ttl" ]]; then',' tag_values="$(pm completion-tags 2>/dev/null)"',' PM_COMPLETION_TAG_CACHE="$tag_values"',' PM_COMPLETION_TAG_CACHE_TS="$now"'," fi",' COMPREPLY=($(compgen -W "$tag_values" -- "$cur"))'," return 0"," fi"],"",' if [[ "$prev" == "--tag" && ( ( "${COMP_WORDS[1]}" == "package" || "${COMP_WORDS[1]}" == "packages" ) && "${COMP_WORDS[2]}" == "upgrade" ) ]]; then'," COMPREPLY=()"," return 0"," fi","",' local cmd="" word_index=1 word'," while (( word_index < cword )); do",' word="${COMP_WORDS[word_index]}"',' case "${word//_/-}" in',` ${GLOBAL_COMPLETION_VALUE_PATTERNS}) (( word_index += 2 )); continue ;;`,` ${GLOBAL_COMPLETION_INLINE_PATTERNS}|${GLOBAL_COMPLETION_SWITCH_PATTERNS}) (( word_index++ )); continue ;;`," --) break ;;"," esac",' if [[ -z "$cmd" ]]; then',' cmd="$word"',' [[ "$cmd" == "history" ]] || break'," else",' case "$word" in',...PM_HISTORY_COMMAND_ALIASES.map(entry=>` ${entry.canonical_argv[1]}) cmd="${entry.alias}" ;;`)," esac"," break"," fi"," (( word_index++ ))"," done",' case "$cmd" in',...HISTORY_OPERATION_FLAGS.flatMap(entry=>[` ${entry.alias})`,` COMPREPLY=(${compgen(entry.flags)})`," return 0"," ;;"])," list)",` COMPREPLY=(${compgen(listFlags)})`," ;;"," aggregate)",` COMPREPLY=(${compgen(AGGREGATE_FLAGS)})`," ;;"," duplicates)",` COMPREPLY=(${compgen(DUPLICATES_FLAGS)})`," ;;"," create)",` COMPREPLY=(${compgen(createFlags)})`," ;;"," copy)",` COMPREPLY=(${compgen(COPY_FLAGS)})`," ;;"," focus)",` COMPREPLY=(${compgen(FOCUS_FLAGS)})`," ;;"," update)",` COMPREPLY=(${compgen(updateFlags)})`," ;;"," update-many)",` COMPREPLY=(${compgen(updateManyFlags)})`," ;;"," calendar|cal)",` COMPREPLY=(${compgen(calendarFlags)})`," ;;"," context|ctx)",` COMPREPLY=(${compgen(contextFlags)})`," ;;"," next)",` COMPREPLY=(${compgen(NEXT_FLAGS)})`," ;;"," guide)",` COMPREPLY=(${compgen(`${GUIDE_FLAGS} ${GUIDE_TOPIC_CHOICES}`)})`," ;;"," search)",` COMPREPLY=(${compgen(searchFlags)})`," ;;"," reindex)",` COMPREPLY=(${compgen("--mode --progress --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," init)",` COMPREPLY=(${compgen(`${INIT_FLAGS} --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help`)})`," ;;"," config)",` COMPREPLY=(${compgen("--criterion --clear-criteria --format --policy --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," extension)",` COMPREPLY=(${compgen(`${EXTENSION_LIFECYCLE_ACTIONS} ${EXTENSION_LIFECYCLE_FLAGS}`)})`," ;;"," package|packages)",` COMPREPLY=(${compgen(`${PACKAGE_LIFECYCLE_ACTIONS} ${PACKAGE_LIFECYCLE_FLAGS} ${UPGRADE_FLAGS}`)})`," ;;"," comments)",` COMPREPLY=(${compgen("--add --body --stdin --file --edit --delete --limit --full-history --if-absent --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," notes)",` COMPREPLY=(${compgen("--add --add-json --stdin --file --edit --delete --limit --since --event-type --include-meta --full-history --if-absent --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," learnings)",` COMPREPLY=(${compgen("--add --stdin --file --edit --delete --limit --full-history --if-absent --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," files)",` COMPREPLY=(${compgen("discover lookup --add --add-glob --remove --migrate --list --apply --note --append-stable --validate-paths --scope --limit --offset --no-truncate --strict-read --explain --lines --decision-depth --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," docs)",` COMPREPLY=(${compgen("--add --add-glob --remove --migrate --note --validate-paths --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," append)",` COMPREPLY=(${compgen(APPEND_FLAGS)})`," ;;"," deps)",` COMPREPLY=(${compgen(DEPS_FLAGS)})`," ;;"," graph)",` COMPREPLY=(${compgen(`ancestors descendants predecessors successors paths impact analyze audit communities redundancy dominators slack centrality articulation plan index ${GRAPH_FLAGS}`)})`," ;;"," test)",` COMPREPLY=(${compgen("--add --add-json --remove --remove-index --list --run --match --only-index --only-last --background --timeout --progress --env-set --env-clear --shared-host-safe --pm-context --override-linked-pm-context --fail-on-context-mismatch --fail-on-skipped --fail-on-empty-test-run --require-assertions-for-pm --check-context --auto-pm-context --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," test-all)",` COMPREPLY=(${compgen("--status --limit --offset --background --timeout --progress --env-set --env-clear --shared-host-safe --pm-context --override-linked-pm-context --fail-on-context-mismatch --fail-on-skipped --fail-on-empty-test-run --require-assertions-for-pm --check-context --auto-pm-context --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," test-runs)",` COMPREPLY=(${compgen("list status logs stop resume --status --limit --stream --tail --force --author --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," validate)",` COMPREPLY=(${compgen("--check-metadata --metadata-profile --check-resolution --check-lifecycle --check-stale-blockers --dependency-cycle-severity --parent-cycle-severity --check-files --scan-mode --include-pm-internals --verbose-file-lists --verbose-diagnostics --all-affected-ids --strict-exit --fail-on-warn --fix-hints --auto-fix --dry-run --fix-scope --prune-missing --check-history-drift --check-command-references --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," health)",` COMPREPLY=(${compgen(HEALTH_FLAGS)})`," ;;"," history)"," if [[ $word_index -eq $cword ]]; then",` COMPREPLY=(${compgen(`${HISTORY_FLAGS} ${HISTORY_LEAVES}`)})`," else",` COMPREPLY=(${compgen(HISTORY_FLAGS)})`," fi"," ;;"," events)",` COMPREPLY=(${compgen(EVENTS_FLAGS)})`," ;;"," history-author-acknowledge)",` COMPREPLY=(${compgen(`${HISTORY_AUTHOR_ACKNOWLEDGE_FLAGS} --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help`)})`," ;;"," get)",` COMPREPLY=(${compgen(GET_FLAGS)})`," ;;"," schema)",` COMPREPLY=(${compgen("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 --description --default-status --folder --alias --role --order --type --commands --cli-flag --required --required-on-create --no-allow-unset --required-types --infer --min-count --apply --to --migration-id --dry-run --author --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," profile)",` COMPREPLY=(${compgen("list show apply lint agile ops research --dry-run --author --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," plan)",` COMPREPLY=(${compgen(`${PLAN_SUBCOMMANDS_LIST} ${PLAN_FLAGS}`)})`," ;;"," contracts)",` COMPREPLY=(${compgen(CONTRACTS_FLAGS)})`," ;;"," gc)",` COMPREPLY=(${compgen("--dry-run --scope --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," stats)",` COMPREPLY=(${compgen(STATS_FLAGS)})`," ;;"," close|close-task)",` COMPREPLY=(${compgen(CLOSE_MUTATION_FLAGS)})`," ;;"," close-many)",` COMPREPLY=(${compgen(CLOSE_MANY_FLAGS)})`," ;;"," release)",` COMPREPLY=(${compgen(RELEASE_MUTATION_FLAGS)})`," ;;"," delete)",` COMPREPLY=(${compgen(DELETE_MUTATION_FLAGS)})`," ;;"," claim|start-task|pause-task)",` COMPREPLY=(${compgen(MUTATION_FLAGS)})`," ;;"," meet|event)",` COMPREPLY=(${compgen(MEET_FLAGS)})`," ;;"," remind)",` COMPREPLY=(${compgen(REMIND_FLAGS)})`," ;;"," completion)",` COMPREPLY=(${compgen(COMPLETION_SHELL_CHOICES)})`," ;;"," templates)",` COMPREPLY=(${compgen("save list show")})`," ;;"," *)",` COMPREPLY=(${compgen(GLOBAL_FLAGS)})`," ;;"," esac",' if [[ "$cmd" == "comments" || "$cmd" == "notes" || "$cmd" == "learnings" ]]; then',` COMPREPLY+=(${compgen("--text")})`," fi"," return 0","}","","complete -F _pm_completion pm"].join("\n")}function generateZshScript(itemTypes=[],tags=[],eagerTagExpansion=false,runtime={}){const useDynamicTypeExpansion=itemTypes.length===0;const typeFallbackChoices=completionTypeValues(itemTypes,runtime);const statusFallbackChoices=completionStatusValues(runtime);const typeChoices=useDynamicTypeExpansion?'${(f)"$(_pm_type_choices)"}':typeFallbackChoices;const statusChoices='${(f)"$(_pm_status_choices)"}';const guideTopicChoices=GUIDE_TOPIC_CHOICES;const tagChoices=joinCompletionValues(tags);const useEagerTagExpansion=eagerTagExpansion||tags.length>0;const zshTagChoices=useEagerTagExpansion?tagChoices:'${(f)"$(_pm_tag_choices)"}';const zshListRuntimeFieldFlags=renderZshRuntimeFieldFlagSpecs(runtime.command_flags?.list);const zshCreateRuntimeFieldFlags=renderZshRuntimeFieldFlagSpecs(runtime.command_flags?.create);const zshSearchRuntimeFieldFlags=renderZshRuntimeFieldFlagSpecs(runtime.command_flags?.search);const zshCalendarRuntimeFieldFlags=renderZshRuntimeFieldFlagSpecs(runtime.command_flags?.calendar);const zshContextRuntimeFieldFlags=renderZshRuntimeFieldFlagSpecs(runtime.command_flags?.context);const zshPresenceFilterFlags=renderZshPresenceFilterSpecs({missingPrefix:"filter-",pairedPrefix:"",includeContentMissingAliases:true});const zshBulkPresenceFilterFlags=renderZshPresenceFilterSpecs({missingPrefix:"filter-",pairedPrefix:"filter-"});const zshMutationCollectionFlags=renderZshArgumentSpecs(ZSH_MUTATION_COLLECTION_ARGUMENT_SPECS);const dynamicTagResolver=useEagerTagExpansion?"":`
46
+ `}function generateBashScript(itemTypes=[],tags=[],eagerTagExpansion=false,runtime={}){const cmds=ALL_COMMANDS.join(" ");const useDynamicTypeExpansion=itemTypes.length===0;const typeValues=completionTypeValues(itemTypes,runtime);const statusValues=completionStatusValues(runtime);const tagValues=joinCompletionValues(tags);const listFlags=mergeFlagStrings(LIST_FLAGS,runtime.command_flags?.list);const createFlags=mergeFlagStrings(CREATE_FLAGS,runtime.command_flags?.create);const updateFlags=mergeFlagStrings(UPDATE_FLAGS,runtime.command_flags?.update);const updateManyFlags=mergeFlagStrings(UPDATE_MANY_FLAGS,runtime.command_flags?.["update-many"]);const searchFlags=mergeFlagStrings(SEARCH_FLAGS,runtime.command_flags?.search);const calendarFlags=mergeFlagStrings(CALENDAR_FLAGS,runtime.command_flags?.calendar);const contextFlags=mergeFlagStrings(CONTEXT_FLAGS,runtime.command_flags?.context);const useEagerTagExpansion=eagerTagExpansion||tags.length>0;const compgen=flags=>`$(compgen -W "${flags}" -- "$cur")`;return["# bash completion for pm",`# Source this file or add 'eval "$(pm completion bash)"' to ~/.bashrc`,"",...useDynamicTypeExpansion?[...renderBashDynamicChoiceResolver("type","completion-types",typeValues),""]:[],...renderBashDynamicChoiceResolver("status","completion-statuses",statusValues),"","_pm_completion() {"," local cur prev words cword"," _init_completion 2>/dev/null || {",' cur="${COMP_WORDS[COMP_CWORD]}"',' prev="${COMP_WORDS[COMP_CWORD-1]}"'," cword=$COMP_CWORD"," }",""," if [[ $cword -eq 1 ]]; then",` COMPREPLY=(${compgen(cmds)})`," return 0"," fi","",' if [[ "$prev" == "--type" ]]; then',useDynamicTypeExpansion?' COMPREPLY=($(compgen -W "$(_pm_completion_type_choices)" -- "$cur"))':` COMPREPLY=(${compgen(typeValues)})`," return 0"," fi","",' if [[ "$prev" == "--status" ]]; then',' COMPREPLY=($(compgen -W "$(_pm_completion_status_choices)" -- "$cur"))'," return 0"," fi","",...useEagerTagExpansion?[' if [[ ( "$prev" == "--tag" || "$prev" == "--tags" ) && ! ( ( "${COMP_WORDS[1]}" == "package" || "${COMP_WORDS[1]}" == "packages" ) && "${COMP_WORDS[2]}" == "upgrade" ) ]]; then',` COMPREPLY=(${compgen(tagValues)})`," return 0"," fi"]:[' if [[ ( "$prev" == "--tag" || "$prev" == "--tags" ) && ! ( ( "${COMP_WORDS[1]}" == "package" || "${COMP_WORDS[1]}" == "packages" ) && "${COMP_WORDS[2]}" == "upgrade" ) ]]; then'," local now ttl cache_ts tag_values",' now="$(date +%s 2>/dev/null || echo 0)"',' ttl="${PM_COMPLETION_TAG_TTL:-120}"',' cache_ts="${PM_COMPLETION_TAG_CACHE_TS:-0}"',' tag_values="${PM_COMPLETION_TAG_CACHE:-}"',' if [[ -z "$tag_values" || "$now" -eq 0 || $((now - cache_ts)) -ge "$ttl" ]]; then',' tag_values="$(pm completion-tags 2>/dev/null)"',' PM_COMPLETION_TAG_CACHE="$tag_values"',' PM_COMPLETION_TAG_CACHE_TS="$now"'," fi",' COMPREPLY=($(compgen -W "$tag_values" -- "$cur"))'," return 0"," fi"],"",' if [[ "$prev" == "--tag" && ( ( "${COMP_WORDS[1]}" == "package" || "${COMP_WORDS[1]}" == "packages" ) && "${COMP_WORDS[2]}" == "upgrade" ) ]]; then'," COMPREPLY=()"," return 0"," fi","",' local cmd="" word_index=1 word'," while (( word_index < cword )); do",' word="${COMP_WORDS[word_index]}"',' case "${word//_/-}" in',` ${GLOBAL_COMPLETION_VALUE_PATTERNS}) (( word_index += 2 )); continue ;;`,` ${GLOBAL_COMPLETION_INLINE_PATTERNS}|${GLOBAL_COMPLETION_SWITCH_PATTERNS}) (( word_index++ )); continue ;;`," --) break ;;"," esac",' if [[ -z "$cmd" ]]; then',' cmd="$word"',' [[ "$cmd" == "history" ]] || break'," else",' case "$word" in',...PM_HISTORY_COMMAND_ALIASES.map(entry=>` ${entry.canonical_argv[1]}) cmd="${entry.alias}" ;;`)," esac"," break"," fi"," (( word_index++ ))"," done",' case "$cmd" in',...HISTORY_OPERATION_FLAGS.flatMap(entry=>[` ${entry.alias})`,` COMPREPLY=(${compgen(entry.flags)})`," return 0"," ;;"])," list)",` COMPREPLY=(${compgen(listFlags)})`," ;;"," aggregate)",` COMPREPLY=(${compgen(AGGREGATE_FLAGS)})`," ;;"," duplicates)",` COMPREPLY=(${compgen(DUPLICATES_FLAGS)})`," ;;"," create)",` COMPREPLY=(${compgen(createFlags)})`," ;;"," copy)",` COMPREPLY=(${compgen(COPY_FLAGS)})`," ;;"," focus)",` COMPREPLY=(${compgen(FOCUS_FLAGS)})`," ;;"," update)",` COMPREPLY=(${compgen(updateFlags)})`," ;;"," update-many)",` COMPREPLY=(${compgen(updateManyFlags)})`," ;;"," calendar|cal)",` COMPREPLY=(${compgen(calendarFlags)})`," ;;"," context|ctx)",` COMPREPLY=(${compgen(contextFlags)})`," ;;"," next)",` COMPREPLY=(${compgen(NEXT_FLAGS)})`," ;;"," guide)",` COMPREPLY=(${compgen(`${GUIDE_FLAGS} ${GUIDE_TOPIC_CHOICES}`)})`," ;;"," search)",` COMPREPLY=(${compgen(searchFlags)})`," ;;"," reindex)",` COMPREPLY=(${compgen("--mode --progress --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," init)",` COMPREPLY=(${compgen(`${INIT_FLAGS} --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help`)})`," ;;"," config)",` COMPREPLY=(${compgen("--criterion --clear-criteria --format --policy --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," extension)",` COMPREPLY=(${compgen(`${EXTENSION_LIFECYCLE_ACTIONS} ${EXTENSION_LIFECYCLE_FLAGS}`)})`," ;;"," package|packages)",` COMPREPLY=(${compgen(`${PACKAGE_LIFECYCLE_ACTIONS} ${PACKAGE_LIFECYCLE_FLAGS} ${UPGRADE_FLAGS}`)})`," ;;"," comments)",` COMPREPLY=(${compgen("--add --body --stdin --file --edit --delete --limit --full-history --if-absent --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," notes)",` COMPREPLY=(${compgen("--add --add-json --stdin --file --edit --delete --limit --since --event-type --include-meta --full-history --if-absent --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," learnings)",` COMPREPLY=(${compgen("--add --stdin --file --edit --delete --limit --full-history --if-absent --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," files)",` COMPREPLY=(${compgen("discover lookup --add --add-glob --remove --migrate --list --apply --note --append-stable --validate-paths --scope --limit --offset --no-truncate --strict-read --explain --lines --decision-depth --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," docs)",` COMPREPLY=(${compgen("--add --add-glob --remove --migrate --note --validate-paths --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," append)",` COMPREPLY=(${compgen(APPEND_FLAGS)})`," ;;"," deps)",` COMPREPLY=(${compgen(DEPS_FLAGS)})`," ;;"," graph)",` COMPREPLY=(${compgen(`ancestors descendants predecessors successors paths impact analyze audit communities redundancy dominators slack centrality articulation plan index ${GRAPH_FLAGS}`)})`," ;;"," test)",` COMPREPLY=(${compgen("--add --add-json --remove --remove-index --list --run --match --only-index --only-last --background --timeout --progress --env-set --env-clear --shared-host-safe --pm-context --override-linked-pm-context --fail-on-context-mismatch --fail-on-skipped --fail-on-empty-test-run --require-assertions-for-pm --check-context --auto-pm-context --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," test-all)",` COMPREPLY=(${compgen("--status --limit --offset --background --timeout --progress --env-set --env-clear --shared-host-safe --pm-context --override-linked-pm-context --fail-on-context-mismatch --fail-on-skipped --fail-on-empty-test-run --require-assertions-for-pm --check-context --auto-pm-context --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," test-runs)",` COMPREPLY=(${compgen("list status logs stop resume --status --limit --stream --tail --force --author --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," validate)",` COMPREPLY=(${compgen("--check-completeness --check-metadata --metadata-profile --check-resolution --check-lifecycle --check-stale-blockers --dependency-cycle-severity --parent-cycle-severity --check-files --scan-mode --include-pm-internals --verbose-file-lists --verbose-diagnostics --all-affected-ids --strict-exit --fail-on-warn --fix-hints --auto-fix --dry-run --fix-scope --prune-missing --check-history-drift --check-command-references --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," health)",` COMPREPLY=(${compgen(HEALTH_FLAGS)})`," ;;"," history)"," if [[ $word_index -eq $cword ]]; then",` COMPREPLY=(${compgen(`${HISTORY_FLAGS} ${HISTORY_LEAVES}`)})`," else",` COMPREPLY=(${compgen(HISTORY_FLAGS)})`," fi"," ;;"," events)",` COMPREPLY=(${compgen(EVENTS_FLAGS)})`," ;;"," history-author-acknowledge)",` COMPREPLY=(${compgen(`${HISTORY_AUTHOR_ACKNOWLEDGE_FLAGS} --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help`)})`," ;;"," get)",` COMPREPLY=(${compgen(GET_FLAGS)})`," ;;"," schema)",' if [[ "$prev" == "policy-mode" ]]; then',` COMPREPLY=(${compgen("advise refuse")})`," return"," fi",` COMPREPLY=(${compgen(`${SCHEMA_SUBCOMMAND_CHOICES} --definition --policy --message --description --default-status --folder --alias --role --order --type --commands --cli-flag --required --required-on-create --no-allow-unset --required-types --infer --min-count --apply --to --migration-id --dry-run --author --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help`)})`," ;;"," profile)",` COMPREPLY=(${compgen("list show apply lint agile ops research --dry-run --author --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," plan)",` COMPREPLY=(${compgen(`${PLAN_SUBCOMMANDS_LIST} ${PLAN_FLAGS}`)})`," ;;"," contracts)",` COMPREPLY=(${compgen(CONTRACTS_FLAGS)})`," ;;"," gc)",` COMPREPLY=(${compgen("--dry-run --scope --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," stats)",` COMPREPLY=(${compgen(STATS_FLAGS)})`," ;;"," close|close-task)",` COMPREPLY=(${compgen(CLOSE_MUTATION_FLAGS)})`," ;;"," close-many)",` COMPREPLY=(${compgen(CLOSE_MANY_FLAGS)})`," ;;"," release)",` COMPREPLY=(${compgen(RELEASE_MUTATION_FLAGS)})`," ;;"," delete)",` COMPREPLY=(${compgen(DELETE_MUTATION_FLAGS)})`," ;;"," claim|start-task|pause-task)",` COMPREPLY=(${compgen(MUTATION_FLAGS)})`," ;;"," meet|event)",` COMPREPLY=(${compgen(MEET_FLAGS)})`," ;;"," remind)",` COMPREPLY=(${compgen(REMIND_FLAGS)})`," ;;"," completion)",` COMPREPLY=(${compgen(COMPLETION_SHELL_CHOICES)})`," ;;"," templates)",` COMPREPLY=(${compgen("save list show")})`," ;;"," *)",` COMPREPLY=(${compgen(GLOBAL_FLAGS)})`," ;;"," esac",' if [[ "$cmd" == "comments" || "$cmd" == "notes" || "$cmd" == "learnings" ]]; then',` COMPREPLY+=(${compgen("--text")})`," fi"," return 0","}","","complete -F _pm_completion pm"].join("\n")}function generateZshScript(itemTypes=[],tags=[],eagerTagExpansion=false,runtime={}){const useDynamicTypeExpansion=itemTypes.length===0;const typeFallbackChoices=completionTypeValues(itemTypes,runtime);const statusFallbackChoices=completionStatusValues(runtime);const typeChoices=useDynamicTypeExpansion?'${(f)"$(_pm_type_choices)"}':typeFallbackChoices;const statusChoices='${(f)"$(_pm_status_choices)"}';const guideTopicChoices=GUIDE_TOPIC_CHOICES;const tagChoices=joinCompletionValues(tags);const useEagerTagExpansion=eagerTagExpansion||tags.length>0;const zshTagChoices=useEagerTagExpansion?tagChoices:'${(f)"$(_pm_tag_choices)"}';const zshListRuntimeFieldFlags=renderZshRuntimeFieldFlagSpecs(runtime.command_flags?.list);const zshCreateRuntimeFieldFlags=renderZshRuntimeFieldFlagSpecs(runtime.command_flags?.create);const zshSearchRuntimeFieldFlags=renderZshRuntimeFieldFlagSpecs(runtime.command_flags?.search);const zshCalendarRuntimeFieldFlags=renderZshRuntimeFieldFlagSpecs(runtime.command_flags?.calendar);const zshContextRuntimeFieldFlags=renderZshRuntimeFieldFlagSpecs(runtime.command_flags?.context);const zshPresenceFilterFlags=renderZshPresenceFilterSpecs({missingPrefix:"filter-",pairedPrefix:"",includeContentMissingAliases:true});const zshBulkPresenceFilterFlags=renderZshPresenceFilterSpecs({missingPrefix:"filter-",pairedPrefix:"filter-"});const zshMutationCollectionFlags=renderZshArgumentSpecs(ZSH_MUTATION_COLLECTION_ARGUMENT_SPECS);const dynamicTagResolver=useEagerTagExpansion?"":`
47
47
  _pm_tag_choices() {
48
48
  local now ttl cache_ts
49
49
  now=\${EPOCHSECONDS:-0}
@@ -571,8 +571,16 @@ ${zshSearchRuntimeFieldFlags} '--json[Output JSON]' \\
571
571
  '--quiet[Suppress stdout]'
572
572
  ;;
573
573
  schema)
574
+ if [[ "\${words[CURRENT-1]}" == policy-mode ]]; then
575
+ compadd advise refuse
576
+ return
577
+ fi
574
578
  _arguments \\
575
- '1:subcommand:(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)' \\
579
+ '1:subcommand:(${SCHEMA_SUBCOMMAND_CHOICES})' \\
580
+ '--definition[Policy definition or proposed fields JSON]:json' \\
581
+ '--policy[Approval policy id]:id' \\
582
+ '--message[History rationale]:text' \\
583
+ '--dry-run[Preview schema changes]' \\
576
584
  '--description[Human description for the custom item type, status, or field]:text' \\
577
585
  '--default-status[Default status hint for the custom item type]:status' \\
578
586
  '--folder[Storage folder for items of this custom type]:dir' \\
@@ -968,6 +976,7 @@ ${renderZshArgumentSpecs(RESTORE_INVOCATIONS.map(flag=>`'${flag.flag}[${flag.des
968
976
  ;;
969
977
  validate)
970
978
  _arguments \\
979
+ '--check-completeness[Check declarative required fields]' \\
971
980
  '--check-metadata[Run metadata completeness checks]' \\
972
981
  '--metadata-profile[Select metadata validation profile for --check-metadata]:(core strict custom)' \\
973
982
  '--check-resolution[Run closed-item resolution metadata checks]' \\
@@ -1699,7 +1708,12 @@ complete -c pm -n '__pm_history_operation history-repair repair' -l dry-run -d '
1699
1708
  complete -c pm -n '__pm_history_operation history-repair repair' -l author -d 'Mutation author' -r
1700
1709
  complete -c pm -n '__pm_history_operation history-repair repair' -l message -d 'Audit history message' -r
1701
1710
  complete -c pm -n '__pm_history_operation history-repair repair' -l force -d 'Force ownership/lock override'
1702
- complete -c pm -n '__fish_seen_subcommand_from schema' -a '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' -d 'Schema subcommand'
1711
+ complete -c pm -n '__fish_seen_subcommand_from schema' -a '${SCHEMA_SUBCOMMAND_CHOICES}' -d 'Schema subcommand'
1712
+ complete -c pm -n '__fish_seen_subcommand_from schema; and __fish_seen_subcommand_from policy-mode' -a 'advise refuse' -d 'Policy enforcement'
1713
+ complete -c pm -n '__fish_seen_subcommand_from schema' -l definition -d 'Policy definition or proposed fields JSON' -r
1714
+ complete -c pm -n '__fish_seen_subcommand_from schema' -l policy -d 'Approval policy id' -r
1715
+ complete -c pm -n '__fish_seen_subcommand_from schema' -l message -d 'History rationale' -r
1716
+ complete -c pm -n '__fish_seen_subcommand_from schema' -l dry-run -d 'Preview schema changes'
1703
1717
  complete -c pm -n '__fish_seen_subcommand_from schema' -l description -d 'Human description for the custom item type, status, or field' -r
1704
1718
  complete -c pm -n '__fish_seen_subcommand_from schema' -l default-status -d 'Default status hint for the custom item type' -r
1705
1719
  complete -c pm -n '__fish_seen_subcommand_from schema' -l folder -d 'Storage folder for items of this custom type' -r
@@ -1986,6 +2000,7 @@ complete -c pm -n '__fish_seen_subcommand_from close-many' -l rollback
1986
2000
  complete -c pm -n '__fish_seen_subcommand_from close-many' -l no-checkpoint -d 'Disable checkpoint creation during apply mode'
1987
2001
 
1988
2002
  # validate flags
2003
+ complete -c pm -n '__fish_seen_subcommand_from validate' -l check-completeness -d 'Check declarative required fields'
1989
2004
  complete -c pm -n '__fish_seen_subcommand_from validate' -l check-metadata -d 'Run metadata completeness checks'
1990
2005
  complete -c pm -n '__fish_seen_subcommand_from validate' -l metadata-profile -d 'Select metadata validation profile for --check-metadata' -r -a 'core strict custom'
1991
2006
  complete -c pm -n '__fish_seen_subcommand_from validate' -l check-resolution -d 'Run closed-item resolution metadata checks'