@unbrained/pm-cli 2026.9.25 → 2026.9.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/.agents/skills/README.md +1 -0
  2. package/.agents/skills/pm-developer/SKILL.md +3 -0
  3. package/.agents/skills/pm-test-audit/LICENSE.txt +21 -0
  4. package/.agents/skills/pm-test-audit/SKILL.md +103 -0
  5. package/.agents/skills/pm-test-audit/references/AUDIT.md +54 -0
  6. package/.agents/skills/pm-test-audit/references/CAMPAIGN.md +47 -0
  7. package/.claude-plugin/marketplace.json +2 -2
  8. package/CHANGELOG.md +28 -1
  9. package/dist/cli/commander-usage.js +2 -2
  10. package/dist/cli/error-guidance.js +1 -1
  11. package/dist/cli/main.js +2 -2
  12. package/dist/cli/register-list-query.js +2 -2
  13. package/dist/cli/register-setup.js +1 -1
  14. package/dist/cli/runtime/selection.d.ts +3 -1
  15. package/dist/cli/runtime/selection.js +1 -1
  16. package/dist/cli/schema/registration.js +2 -2
  17. package/dist/cli-bundle/bundle-manifest.json +155 -147
  18. package/dist/cli-bundle/chunks/chunk-3BTJ66CB.js +238 -0
  19. package/dist/cli-bundle/chunks/{chunk-5AP67ZXH.js → chunk-4SLLCDFL.js} +39 -39
  20. package/dist/cli-bundle/chunks/{chunk-GAU55CWI.js → chunk-4UPZLUT2.js} +7 -7
  21. package/dist/cli-bundle/chunks/{chunk-25KTCTBL.js → chunk-6OJVQ7SW.js} +2 -2
  22. package/dist/cli-bundle/chunks/{chunk-445ARBKY.js → chunk-7TAGYNFP.js} +2 -2
  23. package/dist/cli-bundle/chunks/{chunk-GOWZEBTH.js → chunk-AUS6USO4.js} +2 -2
  24. package/dist/cli-bundle/chunks/{chunk-YDIGMRLZ.js → chunk-IEP3VAT5.js} +2 -2
  25. package/dist/cli-bundle/chunks/{chunk-3IB4THWX.js → chunk-JX6WCCHL.js} +6 -6
  26. package/dist/cli-bundle/chunks/chunk-LC6WEA5U.js +2 -0
  27. package/dist/cli-bundle/chunks/{chunk-CZ3VJJEA.js → chunk-LKGQUZ5M.js} +2 -2
  28. package/dist/cli-bundle/chunks/{chunk-P7ZSJOWH.js → chunk-OKVDVERQ.js} +2 -2
  29. package/dist/cli-bundle/chunks/{chunk-COFQCKF4.js → chunk-TSF2LPIH.js} +2 -2
  30. package/dist/cli-bundle/chunks/{chunk-YABJDOOX.js → chunk-V5UGBYHN.js} +3 -3
  31. package/dist/cli-bundle/chunks/{register-list-query-IZ7ZVTDE.js → register-list-query-6PAJ4PBU.js} +4 -4
  32. package/dist/cli-bundle/chunks/{register-mutation-IPAZTFDZ.js → register-mutation-RZCXZXYS.js} +4 -4
  33. package/dist/cli-bundle/chunks/{register-operations-APN33LNI.js → register-operations-GK6VU2H2.js} +2 -2
  34. package/dist/cli-bundle/chunks/register-setup-ASEMNMBF.js +2 -0
  35. package/dist/cli-bundle/focused-chunks/{chunk-KRIHJH5U.js → chunk-6J2YCGSN.js} +5 -5
  36. package/dist/cli-bundle/focused-chunks/{chunk-XKH2FC5D.js → chunk-6UNKK3UH.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/{chunk-NRHTXBTI.js → chunk-DQ3MB7BO.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/{chunk-PMPFLA6X.js → chunk-E7LYK7V5.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/chunk-GZD4ZYIB.js +20 -0
  40. package/dist/cli-bundle/focused-chunks/chunk-KMPKKSA6.js +2 -0
  41. package/dist/cli-bundle/focused-chunks/{chunk-TLF6N56J.js → chunk-LBDWUHQD.js} +2 -2
  42. package/dist/cli-bundle/focused-chunks/{chunk-UIFVIE5F.js → chunk-MILJCOFJ.js} +2 -2
  43. package/dist/cli-bundle/focused-chunks/{chunk-MK5AKKHK.js → chunk-NETVXIH5.js} +2 -2
  44. package/dist/cli-bundle/focused-chunks/{chunk-Q355NPLH.js → chunk-NWRVNHAD.js} +2 -2
  45. package/dist/cli-bundle/focused-chunks/{chunk-IXNNMP2R.js → chunk-NZAG7OKB.js} +12 -12
  46. package/dist/cli-bundle/focused-chunks/{chunk-OY3VHCTX.js → chunk-OJKJFDIG.js} +2 -2
  47. package/dist/cli-bundle/focused-chunks/chunk-OJRX6G22.js +2 -0
  48. package/dist/cli-bundle/focused-chunks/{chunk-NVVB2HJC.js → chunk-PDVL7QYU.js} +16 -16
  49. package/dist/cli-bundle/focused-chunks/{chunk-O7MIBEMK.js → chunk-QO4MTAEA.js} +2 -2
  50. package/dist/cli-bundle/focused-chunks/{chunk-ABA3KRPY.js → chunk-SMADBUPL.js} +2 -2
  51. package/dist/cli-bundle/main.js +21 -21
  52. package/dist/cli-bundle/sdk-authoring.js +1 -1
  53. package/dist/cli-bundle/sdk-contracts.js +1 -1
  54. package/dist/cli-bundle/sdk-core.js +20 -20
  55. package/dist/cli-bundle/sdk-governance.js +1 -1
  56. package/dist/cli-bundle/sdk-graph.js +1 -1
  57. package/dist/cli-bundle/sdk-merge.js +46 -46
  58. package/dist/cli-bundle/sdk-query.js +1 -1
  59. package/dist/cli-bundle/sdk-runtime.js +1 -1
  60. package/dist/cli-bundle/sdk-testing.js +1 -1
  61. package/dist/cli-bundle/sdk.js +8 -8
  62. package/dist/core/search/embedding-batches.d.ts +47 -15
  63. package/dist/core/search/embedding-batches.js +1 -1
  64. package/dist/core/search/eval-thresholds.d.ts +14 -0
  65. package/dist/core/search/eval-thresholds.js +2 -0
  66. package/dist/core/search/eval.d.ts +4 -1
  67. package/dist/core/search/eval.js +1 -1
  68. package/dist/core/search/http-client.d.ts +7 -0
  69. package/dist/core/search/http-client.js +1 -1
  70. package/dist/sdk/agent-capability-contracts.js +1 -1
  71. package/dist/sdk/cli-contracts/command-aliases.js +1 -1
  72. package/dist/sdk/cli-contracts/grammar-contracts.js +1 -1
  73. package/dist/sdk/completion/shared.d.ts +1 -1
  74. package/dist/sdk/completion/shared.js +1 -1
  75. package/dist/sdk/eval.d.ts +19 -17
  76. package/dist/sdk/eval.js +1 -1
  77. package/dist/sdk/extension/static-inventory.d.ts +54 -0
  78. package/dist/sdk/extension/static-inventory.js +2 -0
  79. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  80. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
  81. package/dist/sdk/governance/reindex.d.ts +4 -1
  82. package/dist/sdk/governance/reindex.js +2 -2
  83. package/dist/sdk/guide-topics.js +1 -1
  84. package/dist/sdk/index.d.ts +1 -0
  85. package/dist/sdk/index.js +1 -1
  86. package/dist/sdk/public-surface.json +1 -1
  87. package/dist/sdk/query/complete-list.js +1 -1
  88. package/dist/sdk/query.d.ts +3 -0
  89. package/dist/sdk/query.js +1 -1
  90. package/dist/sdk/read-output/provenance.d.ts +20 -0
  91. package/dist/sdk/read-output/provenance.js +2 -0
  92. package/dist/sdk/read-output-contracts.js +1 -1
  93. package/dist/sdk/runtime/schema-preview.d.ts +2 -0
  94. package/dist/sdk/runtime/schema-preview.js +2 -0
  95. package/dist/sdk/runtime/schema.js +1 -1
  96. package/dist/sdk/runtime-input.js +1 -1
  97. package/dist/sdk/runtime-primitives.d.ts +2 -1
  98. package/dist/sdk/runtime-primitives.js +1 -1
  99. package/docs/CLI_GRAMMAR.md +31 -0
  100. package/docs/CODEX_PLUGIN.md +8 -0
  101. package/docs/EXTENSION_LIFECYCLE.md +18 -0
  102. package/docs/README.md +1 -0
  103. package/docs/RELEASING.md +51 -2
  104. package/docs/SEARCH_QUALITY.md +116 -0
  105. package/docs/agent-task-token-baseline.json +4 -4
  106. package/docs/generated/AGENT_CAPABILITY_ROUTING.md +1 -1
  107. package/docs/generated/AGENT_COMMAND_SURFACE.md +5 -1
  108. package/docs/generated/FLAG_LEXICON_BUDGETS.md +4 -0
  109. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +14 -7
  110. package/marketplace.json +2 -2
  111. package/package.json +2 -2
  112. package/packages/pm-beads/package.json +1 -1
  113. package/packages/pm-calendar/package.json +1 -1
  114. package/packages/pm-command-kit/package.json +1 -1
  115. package/packages/pm-digital-twin/package.json +1 -1
  116. package/packages/pm-governance-audit/package.json +1 -1
  117. package/packages/pm-guide-shell/package.json +1 -1
  118. package/packages/pm-kanban/package.json +1 -1
  119. package/packages/pm-lifecycle-hooks/package.json +1 -1
  120. package/packages/pm-linked-test-adapters/package.json +1 -1
  121. package/packages/pm-search-advanced/package.json +1 -1
  122. package/packages/pm-templates/package.json +1 -1
  123. package/packages/pm-todos/package.json +1 -1
  124. package/packages/pm-vcs/package.json +1 -1
  125. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  126. package/plugins/pm-claude/README.md +5 -1
  127. package/plugins/pm-claude/package.json +2 -2
  128. package/plugins/pm-claude/skills/pm-audit/SKILL.md +14 -103
  129. package/plugins/pm-claude/skills/pm-audit/agents/openai.yaml +4 -0
  130. package/plugins/pm-claude/skills/pm-developer/SKILL.md +20 -143
  131. package/plugins/pm-claude/skills/pm-developer/agents/openai.yaml +4 -0
  132. package/plugins/pm-claude/skills/pm-planner/SKILL.md +16 -167
  133. package/plugins/pm-claude/skills/pm-planner/agents/openai.yaml +4 -0
  134. package/plugins/pm-claude/skills/pm-release/SKILL.md +18 -102
  135. package/plugins/pm-claude/skills/pm-release/agents/openai.yaml +4 -0
  136. package/plugins/pm-claude/skills/pm-workflow/SKILL.md +25 -156
  137. package/plugins/pm-claude/skills/pm-workflow/agents/openai.yaml +4 -0
  138. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  139. package/plugins/pm-codex/README.md +10 -2
  140. package/plugins/pm-codex/mcp.json +11 -0
  141. package/plugins/pm-codex/package.json +2 -2
  142. package/plugins/pm-codex/plugin.json +45 -0
  143. package/plugins/pm-codex/skills/pm-audit/SKILL.md +21 -0
  144. package/plugins/pm-codex/skills/pm-audit/agents/openai.yaml +4 -0
  145. package/plugins/pm-codex/skills/pm-auditor/SKILL.md +5 -40
  146. package/plugins/pm-codex/skills/pm-auditor/agents/openai.yaml +3 -5
  147. package/plugins/pm-codex/skills/pm-developer/SKILL.md +26 -0
  148. package/plugins/pm-codex/skills/pm-developer/agents/openai.yaml +4 -0
  149. package/plugins/pm-codex/skills/pm-native/SKILL.md +7 -87
  150. package/plugins/pm-codex/skills/pm-native/agents/openai.yaml +3 -5
  151. package/plugins/pm-codex/skills/pm-planner/SKILL.md +22 -0
  152. package/plugins/pm-codex/skills/pm-planner/agents/openai.yaml +4 -0
  153. package/plugins/pm-codex/skills/pm-release/SKILL.md +17 -38
  154. package/plugins/pm-codex/skills/pm-release/agents/openai.yaml +2 -4
  155. package/plugins/pm-codex/skills/pm-workflow/SKILL.md +39 -0
  156. package/plugins/pm-codex/skills/pm-workflow/agents/openai.yaml +4 -0
  157. package/dist/cli-bundle/chunks/chunk-JDHWZYZU.js +0 -238
  158. package/dist/cli-bundle/chunks/register-setup-HPHIKG5U.js +0 -2
  159. package/dist/cli-bundle/focused-chunks/chunk-HQPTDJLF.js +0 -2
  160. package/dist/cli-bundle/focused-chunks/chunk-V2X37U6J.js +0 -2
  161. package/dist/cli-bundle/focused-chunks/chunk-Y2M4QLAA.js +0 -20
@@ -1,2 +1,2 @@
1
- !(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="033b7bbd-f219-583f-a43c-42ffdf535d9d")}catch(e2){}})();import{BUILTIN_ITEM_TYPE_VALUES,STATUS_VALUES}from"../../types/index.js";import{listPmCommandsForTier,resolvePmCommandVisibilityTier}from"../agent-capability-contracts.js";import{AGGREGATE_FLAG_CONTRACTS,APPEND_FLAG_CONTRACTS,CALENDAR_FLAG_CONTRACTS,CLOSE_MANY_FLAG_CONTRACTS,COMPLETION_FLAG_CONTRACTS,CONTEXT_FLAG_CONTRACTS,CONTRACTS_FLAG_CONTRACTS,COPY_FLAG_CONTRACTS,CREATE_FLAG_CONTRACTS,DEPS_FLAG_CONTRACTS,DUPLICATES_FLAG_CONTRACTS,EVENTS_FLAG_CONTRACTS,EXTENSION_FLAG_CONTRACTS,FOCUS_FLAG_CONTRACTS,GET_FLAG_CONTRACTS,GLOBAL_FLAG_CONTRACTS,GRAPH_FLAG_CONTRACTS,GUIDE_FLAG_CONTRACTS,HEALTH_FLAG_CONTRACTS,HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS,HISTORY_FLAG_CONTRACTS,INIT_FLAG_CONTRACTS,LIST_FILTER_FLAG_CONTRACTS,MEET_FLAG_CONTRACTS,NEXT_FLAG_CONTRACTS,PACKAGE_FLAG_CONTRACTS,PLAN_FLAG_CONTRACTS,PM_COMMAND_ALIAS_CONTRACTS,PM_NAMESPACED_COMMAND_ALIASES,REMIND_FLAG_CONTRACTS,SEARCH_FLAG_CONTRACTS,STATS_FLAG_CONTRACTS,UPDATE_FLAG_CONTRACTS,UPDATE_MANY_FLAG_CONTRACTS,UPGRADE_FLAG_CONTRACTS,resolvePmCommandOperation,resolveSubcommandFlagContractsForCommand,toCompletionFlagString}from"../cli-contracts.js";import{GLOBAL_VALUE_CONSUMING_FLAGS}from"../cli-contracts/bootstrap-command-scanner.js";import{WORKFLOW_POLICY_ACTIONS}from"../cli-contracts/enum-contracts.js";import{PM_COMMAND_DESTINATION_CONTRACTS}from"../cli-contracts/grammar-contracts.js";import{enrichCliFlagInvocationContracts}from"../flag-invocation-contracts.js";import{listGuideTopicIds}from"../guide-topics.js";const DEFAULT_ITEM_TYPES=[...BUILTIN_ITEM_TYPE_VALUES];const DEFAULT_STATUS_VALUES=[...STATUS_VALUES];const HIDDEN_COMMAND_ALIASES=new Set(PM_COMMAND_ALIAS_CONTRACTS.filter(contract=>contract.hidden).map(contract=>contract.alias));const ALL_COMMANDS=listPmCommandsForTier("full").filter(command=>!command.includes(" ")&&!HIDDEN_COMMAND_ALIASES.has(command));const LIST_FLAGS=toCompletionFlagString(LIST_FILTER_FLAG_CONTRACTS);const AGGREGATE_FLAGS=toCompletionFlagString(AGGREGATE_FLAG_CONTRACTS);const APPEND_FLAGS=toCompletionFlagString(APPEND_FLAG_CONTRACTS);const COPY_FLAGS=toCompletionFlagString(COPY_FLAG_CONTRACTS);const RESTORE_INVOCATIONS=enrichCliFlagInvocationContracts("restore",resolveSubcommandFlagContractsForCommand("restore"));const ATTEST_INVOCATIONS=enrichCliFlagInvocationContracts("history-attest",resolveSubcommandFlagContractsForCommand("history-attest"));const FOCUS_FLAGS=toCompletionFlagString(FOCUS_FLAG_CONTRACTS);const MEET_FLAGS=toCompletionFlagString(MEET_FLAG_CONTRACTS);const REMIND_FLAGS=toCompletionFlagString(REMIND_FLAG_CONTRACTS);const CREATE_FLAGS=toCompletionFlagString(CREATE_FLAG_CONTRACTS);const GET_FLAGS=toCompletionFlagString(GET_FLAG_CONTRACTS);const UPDATE_FLAGS=toCompletionFlagString(UPDATE_FLAG_CONTRACTS);const UPDATE_MANY_FLAGS=toCompletionFlagString(UPDATE_MANY_FLAG_CONTRACTS);const CLOSE_MANY_FLAGS=toCompletionFlagString(CLOSE_MANY_FLAG_CONTRACTS);const NAMESPACE_NOUNS=[...new Set(PM_NAMESPACED_COMMAND_ALIASES.map(entry=>entry.canonical_argv[0]))];const NAMESPACE_PREFIXES=[...new Set(PM_NAMESPACED_COMMAND_ALIASES.flatMap(entry=>entry.canonical_argv.slice(0,-1).map((_,index)=>entry.canonical_argv.slice(0,index+1).join(" "))))];const PACKAGE_NAMESPACE_OPERATIONS=new Set(PM_COMMAND_DESTINATION_CONTRACTS.filter(entry=>entry.disposition==="package_owned").map(entry=>resolvePmCommandOperation(entry.command)));const HISTORY_COMPLETION_ALIASES=PM_NAMESPACED_COMMAND_ALIASES.filter(entry=>entry.canonical_argv[0]==="history");const HISTORY_LEAVES=HISTORY_COMPLETION_ALIASES.map(entry=>entry.canonical_argv[1]).join(" ");function completionNamespaceLeaves(runtime){const available=new Set((runtime.namespace_commands??[]).map(resolvePmCommandOperation));const aliases=PM_NAMESPACED_COMMAND_ALIASES.filter(entry=>resolvePmCommandVisibilityTier(entry.canonical)!=="internal"&&(!PACKAGE_NAMESPACE_OPERATIONS.has(entry.alias)||available.has(entry.alias)));return Object.fromEntries(NAMESPACE_PREFIXES.map(prefix=>[prefix,[...new Set(aliases.filter(entry=>entry.canonical.startsWith(`${prefix} `)).map(entry=>entry.canonical_argv[prefix.split(" ").length]))].join(" ")]))}const HISTORY_OPERATION_FLAGS=HISTORY_COMPLETION_ALIASES.map(entry=>({...entry,flags:toCompletionFlagString(resolveSubcommandFlagContractsForCommand(entry.alias))}));const HISTORY_FLAGS=toCompletionFlagString(HISTORY_FLAG_CONTRACTS);const HISTORY_AUTHOR_ACKNOWLEDGE_FLAGS=toCompletionFlagString(HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS,false);const EVENTS_FLAGS=toCompletionFlagString(EVENTS_FLAG_CONTRACTS);const CALENDAR_FLAGS=toCompletionFlagString(CALENDAR_FLAG_CONTRACTS);const CONTEXT_FLAGS=toCompletionFlagString(CONTEXT_FLAG_CONTRACTS);const NEXT_FLAGS=toCompletionFlagString(NEXT_FLAG_CONTRACTS);const DEPS_FLAGS=toCompletionFlagString(DEPS_FLAG_CONTRACTS);const DUPLICATES_FLAGS=toCompletionFlagString(DUPLICATES_FLAG_CONTRACTS);const GRAPH_FLAGS=toCompletionFlagString(GRAPH_FLAG_CONTRACTS);const GUIDE_FLAGS=toCompletionFlagString(GUIDE_FLAG_CONTRACTS);const SEARCH_FLAGS=toCompletionFlagString(SEARCH_FLAG_CONTRACTS);const STATS_FLAGS=toCompletionFlagString(STATS_FLAG_CONTRACTS);const HEALTH_FLAGS=toCompletionFlagString(HEALTH_FLAG_CONTRACTS);const INIT_FLAGS=toCompletionFlagString(INIT_FLAG_CONTRACTS);const CONTRACTS_FLAGS=toCompletionFlagString(CONTRACTS_FLAG_CONTRACTS);const PLAN_FLAGS=toCompletionFlagString(PLAN_FLAG_CONTRACTS);const SCHEMA_SUBCOMMAND_CHOICES=`${WORKFLOW_POLICY_ACTIONS.join(" ")} list show show-status add-type remove-type add-status remove-status add-field remove-field list-fields show-field apply-preset rename-type rename-field remap-status`;const PLAN_SUBCOMMANDS_LIST="create show add-step update-step complete-step block-step reorder-step remove-step link unlink decision discovery validation resume approve materialize";const COMPLETION_FLAGS=toCompletionFlagString(COMPLETION_FLAG_CONTRACTS);const COMPLETION_SHELL_CHOICES=`${COMPLETION_FLAGS} bash zsh fish`;const GUIDE_TOPIC_CHOICES=joinCompletionValues(listGuideTopicIds());const EXTENSION_LIFECYCLE_ACTIONS="init scaffold install uninstall explore manage describe reload doctor catalog adopt adopt-all activate deactivate migrate";const PACKAGE_LIFECYCLE_ACTIONS=`${EXTENSION_LIFECYCLE_ACTIONS} upgrade`;const EXTENSION_LIFECYCLE_FLAGS=toCompletionFlagString(EXTENSION_FLAG_CONTRACTS);const PACKAGE_LIFECYCLE_FLAGS=toCompletionFlagString(PACKAGE_FLAG_CONTRACTS);const UPGRADE_FLAGS=toCompletionFlagString(UPGRADE_FLAG_CONTRACTS);const MUTATION_FLAGS="--author --message --force --json --quiet --no-changed-fields --id-only --pm-path --path --no-extensions --no-pager --profile --help";const DELETE_MUTATION_FLAGS="--dry-run --author --message --force --json --quiet --no-changed-fields --id-only --pm-path --path --no-extensions --no-pager --profile --help";const CLOSE_MUTATION_FLAGS=toCompletionFlagString(resolveSubcommandFlagContractsForCommand("close"));const CLOSE_TASK_MUTATION_FLAGS=toCompletionFlagString(resolveSubcommandFlagContractsForCommand("close-task"));const RELEASE_MUTATION_FLAGS=toCompletionFlagString(resolveSubcommandFlagContractsForCommand("release"));const CLAIM_MUTATION_FLAGS=toCompletionFlagString(resolveSubcommandFlagContractsForCommand("claim"));const COMMAND_COMPLETION_DESCRIPTIONS=[["init","Initialize pm storage for the current workspace"],["config","Read or update pm settings"],["package","Manage package lifecycle operations"],["packages","Alias for package"],["create","Create a new project management item"],["item","Manage item evidence, links, tests, and duplication"],["copy","Copy an existing item to a new ID"],["focus","Set/clear/show the session focused parent for new items"],["list","List active items with optional filters"],["aggregate","Aggregate grouped item counts and numeric stats for governance queries"],["duplicates","Find bounded duplicate clusters across lifecycle statuses"],["guide","Browse local progressive-disclosure guides"],["calendar","Show calendar views for deadlines and reminders"],["cal","Alias for calendar"],["context","Show a token-efficient project context snapshot"],["ctx","Alias for context"],["get","Show item details by ID"],["next","Recommend the next actionable (unblocked, ready) work item"],["search","Search items with keyword, semantic, or hybrid modes"],["reindex","Rebuild search artifacts"],["history","Show item history entries"],["history-compact","Compact history streams into a synthetic baseline + retained tail"],["history-redact","Redact sensitive literals/patterns and recompute history hashes"],["history-repair","Re-anchor a drifted history chain so pm health/validate report ok"],["schema","Manage custom item types and statuses in .agents/pm/schema/*.json"],["profile","List, show, apply, and lint project profiles (archetype schema/config/template/package bundles)"],["plan","Agent-optimized Plan item workflow (create/show/add-step/update-step/complete-step/link/approve/materialize)"],["activity","Show recent activity across items"],["restore","Restore an item to an earlier state"],["update","Update item fields and metadata"],["update-many","Bulk-update matched items with dry-run and rollback checkpoints"],["close","Close an item (reason requirement follows governance settings)"],["close-many","Bulk-close matched items with an optional shared reason and rollback checkpoint"],["delete","Delete an item and record the change"],["append","Append text to an item body"],["comments","List or add comments for an item"],["notes","List or add notes for an item"],["learnings","List or add learnings for an item"],["files","Manage linked files"],["docs","Manage linked docs"],["deps","Show dependency relationships for an item"],["graph","Bounded graph traversal, analytics, and governance-audit queries"],["test","Manage linked tests and optionally run them"],["test-all","Run linked tests across matching items"],["test-runs","Manage background linked-test runs"],["stats","Show project tracker statistics"],["health","Show project tracker health checks"],["validate","Run standalone validation checks"],["gc","Clean optional cache artifacts"],["contracts","Show machine-readable command and schema contracts"],["claim","Claim an item for active work"],["release","Release the active claim for an item"],["start-task","Lifecycle alias to claim and set in_progress"],["pause-task","Lifecycle alias to reopen and release claim"],["close-task","Lifecycle alias to close and release claim"],["meet","Shortcut to create a Meeting with scheduling defaults"],["event","Shortcut to create an Event with scheduling defaults"],["remind","Shortcut to create a Reminder from a point in time"],["templates","Manage reusable create templates"],["completion","Generate shell completion"],["help","Display help for a command"]];const GLOBAL_FLAGS=GLOBAL_FLAG_CONTRACTS.flatMap(entry=>[entry.short,entry.flag,...entry.aliases??[]]).filter(value=>Boolean(value)).join(" ");const GLOBAL_COMPLETION_VALUE_PATTERNS=[...GLOBAL_VALUE_CONSUMING_FLAGS].join("|");const GLOBAL_COMPLETION_INLINE_PATTERNS=[...GLOBAL_VALUE_CONSUMING_FLAGS].map(flag=>`${flag}=*`).join("|");const GLOBAL_COMPLETION_SWITCH_PATTERNS=[...GLOBAL_FLAGS.split(" ").filter(flag=>!GLOBAL_VALUE_CONSUMING_FLAGS.has(flag)),"-h","-V"].join("|");function joinCompletionValues(values){return[...new Set(values.map(value=>value.trim()).filter(value=>value.length>0))].sort((left,right)=>left.localeCompare(right)).join(" ")}function joinCompletionValuesInOrder(values){return[...new Set(values.map(value=>value.trim()).filter(value=>value.length>0))].join(" ")}function shellDoubleQuote(value){return value.replaceAll("\\","\\\\").replaceAll('"','\\"').replaceAll("$","\\$").replaceAll("`","\\`")}function completionTypeValues(itemTypes,runtime){return joinCompletionValuesInOrder(itemTypes.length>0?itemTypes:runtime.item_types??DEFAULT_ITEM_TYPES)}function completionStatusValues(runtime){return joinCompletionValues(runtime.statuses??DEFAULT_STATUS_VALUES)}function mergeFlagStrings(baseFlags,runtimeFlags){const merged=[...baseFlags.split(/\s+/u).filter(value=>value.length>0),...runtimeFlags??[]];return joinCompletionValues(merged)}function normalizeRuntimeCompletionFlags(runtimeFlags){const normalized=(runtimeFlags??[]).map(value=>value.trim()).filter(value=>value.startsWith("--")&&value.length>2).map(value=>`--${value.slice(2).replaceAll("_","-")}`);return[...new Set(normalized)].sort((left,right)=>left.localeCompare(right))}export{AGGREGATE_FLAGS,ALL_COMMANDS,APPEND_FLAGS,ATTEST_INVOCATIONS,CALENDAR_FLAGS,CLAIM_MUTATION_FLAGS,CLOSE_MANY_FLAGS,CLOSE_MUTATION_FLAGS,CLOSE_TASK_MUTATION_FLAGS,COMMAND_COMPLETION_DESCRIPTIONS,COMPLETION_SHELL_CHOICES,CONTEXT_FLAGS,CONTRACTS_FLAGS,COPY_FLAGS,CREATE_FLAGS,DELETE_MUTATION_FLAGS,DEPS_FLAGS,DUPLICATES_FLAGS,EVENTS_FLAGS,EXTENSION_LIFECYCLE_ACTIONS,EXTENSION_LIFECYCLE_FLAGS,FOCUS_FLAGS,GET_FLAGS,GLOBAL_COMPLETION_INLINE_PATTERNS,GLOBAL_COMPLETION_SWITCH_PATTERNS,GLOBAL_COMPLETION_VALUE_PATTERNS,GLOBAL_FLAGS,GRAPH_FLAGS,GUIDE_FLAGS,GUIDE_TOPIC_CHOICES,HEALTH_FLAGS,HIDDEN_COMMAND_ALIASES,HISTORY_AUTHOR_ACKNOWLEDGE_FLAGS,HISTORY_FLAGS,HISTORY_LEAVES,HISTORY_OPERATION_FLAGS,INIT_FLAGS,LIST_FLAGS,MEET_FLAGS,MUTATION_FLAGS,NAMESPACE_NOUNS,NAMESPACE_PREFIXES,NEXT_FLAGS,PACKAGE_LIFECYCLE_ACTIONS,PACKAGE_LIFECYCLE_FLAGS,PLAN_FLAGS,PLAN_SUBCOMMANDS_LIST,RELEASE_MUTATION_FLAGS,REMIND_FLAGS,RESTORE_INVOCATIONS,SCHEMA_SUBCOMMAND_CHOICES,SEARCH_FLAGS,STATS_FLAGS,UPDATE_FLAGS,UPDATE_MANY_FLAGS,UPGRADE_FLAGS,completionNamespaceLeaves,completionStatusValues,completionTypeValues,joinCompletionValues,mergeFlagStrings,normalizeRuntimeCompletionFlags,shellDoubleQuote};
1
+ !(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="be171aef-09e7-5f87-9605-1d47ca665440")}catch(e2){}})();import{BUILTIN_ITEM_TYPE_VALUES,STATUS_VALUES}from"../../types/index.js";import{listPmCommandsForTier,resolvePmCommandVisibilityTier}from"../agent-capability-contracts.js";import{AGGREGATE_FLAG_CONTRACTS,APPEND_FLAG_CONTRACTS,CALENDAR_FLAG_CONTRACTS,CLOSE_MANY_FLAG_CONTRACTS,COMPLETION_FLAG_CONTRACTS,CONTEXT_FLAG_CONTRACTS,CONTRACTS_FLAG_CONTRACTS,COPY_FLAG_CONTRACTS,CREATE_FLAG_CONTRACTS,DEPS_FLAG_CONTRACTS,DUPLICATES_FLAG_CONTRACTS,EVENTS_FLAG_CONTRACTS,EXTENSION_FLAG_CONTRACTS,FOCUS_FLAG_CONTRACTS,GET_FLAG_CONTRACTS,GLOBAL_FLAG_CONTRACTS,GRAPH_FLAG_CONTRACTS,GUIDE_FLAG_CONTRACTS,HEALTH_FLAG_CONTRACTS,HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS,HISTORY_FLAG_CONTRACTS,INIT_FLAG_CONTRACTS,LIST_FILTER_FLAG_CONTRACTS,MEET_FLAG_CONTRACTS,NEXT_FLAG_CONTRACTS,PACKAGE_FLAG_CONTRACTS,PLAN_FLAG_CONTRACTS,PM_COMMAND_ALIAS_CONTRACTS,PM_NAMESPACED_COMMAND_ALIASES,REMIND_FLAG_CONTRACTS,SEARCH_FLAG_CONTRACTS,STATS_FLAG_CONTRACTS,UPDATE_FLAG_CONTRACTS,UPDATE_MANY_FLAG_CONTRACTS,UPGRADE_FLAG_CONTRACTS,resolvePmCommandOperation,resolveSubcommandFlagContractsForCommand,toCompletionFlagString}from"../cli-contracts.js";import{GLOBAL_VALUE_CONSUMING_FLAGS}from"../cli-contracts/bootstrap-command-scanner.js";import{WORKFLOW_POLICY_ACTIONS}from"../cli-contracts/enum-contracts.js";import{PM_COMMAND_DESTINATION_CONTRACTS}from"../cli-contracts/grammar-contracts.js";import{enrichCliFlagInvocationContracts}from"../flag-invocation-contracts.js";import{listGuideTopicIds}from"../guide-topics.js";const DEFAULT_ITEM_TYPES=[...BUILTIN_ITEM_TYPE_VALUES];const DEFAULT_STATUS_VALUES=[...STATUS_VALUES];const HIDDEN_COMMAND_ALIASES=new Set(PM_COMMAND_ALIAS_CONTRACTS.filter(contract=>contract.hidden).map(contract=>contract.alias));const ALL_COMMANDS=listPmCommandsForTier("full").filter(command=>!command.includes(" ")&&!HIDDEN_COMMAND_ALIASES.has(command));const LIST_FLAGS=toCompletionFlagString(LIST_FILTER_FLAG_CONTRACTS);const AGGREGATE_FLAGS=toCompletionFlagString(AGGREGATE_FLAG_CONTRACTS);const APPEND_FLAGS=toCompletionFlagString(APPEND_FLAG_CONTRACTS);const COPY_FLAGS=toCompletionFlagString(COPY_FLAG_CONTRACTS);const RESTORE_INVOCATIONS=enrichCliFlagInvocationContracts("restore",resolveSubcommandFlagContractsForCommand("restore"));const ATTEST_INVOCATIONS=enrichCliFlagInvocationContracts("history-attest",resolveSubcommandFlagContractsForCommand("history-attest"));const FOCUS_FLAGS=toCompletionFlagString(FOCUS_FLAG_CONTRACTS);const MEET_FLAGS=toCompletionFlagString(MEET_FLAG_CONTRACTS);const REMIND_FLAGS=toCompletionFlagString(REMIND_FLAG_CONTRACTS);const CREATE_FLAGS=toCompletionFlagString(CREATE_FLAG_CONTRACTS);const GET_FLAGS=toCompletionFlagString(GET_FLAG_CONTRACTS);const UPDATE_FLAGS=toCompletionFlagString(UPDATE_FLAG_CONTRACTS);const UPDATE_MANY_FLAGS=toCompletionFlagString(UPDATE_MANY_FLAG_CONTRACTS);const CLOSE_MANY_FLAGS=toCompletionFlagString(CLOSE_MANY_FLAG_CONTRACTS);const NAMESPACE_NOUNS=[...new Set(PM_NAMESPACED_COMMAND_ALIASES.map(entry=>entry.canonical_argv[0]))];const NAMESPACE_PREFIXES=[...new Set(PM_NAMESPACED_COMMAND_ALIASES.flatMap(entry=>entry.canonical_argv.slice(0,-1).map((_,index)=>entry.canonical_argv.slice(0,index+1).join(" "))))];const PACKAGE_NAMESPACE_OPERATIONS=new Set(PM_COMMAND_DESTINATION_CONTRACTS.filter(entry=>entry.disposition==="package_owned").map(entry=>resolvePmCommandOperation(entry.command)));const HISTORY_COMPLETION_ALIASES=PM_NAMESPACED_COMMAND_ALIASES.filter(entry=>entry.canonical_argv[0]==="history");const HISTORY_LEAVES=HISTORY_COMPLETION_ALIASES.map(entry=>entry.canonical_argv[1]).join(" ");function completionNamespaceLeaves(runtime){const available=new Set((runtime.namespace_commands??[]).map(resolvePmCommandOperation));const aliases=PM_NAMESPACED_COMMAND_ALIASES.filter(entry=>resolvePmCommandVisibilityTier(entry.canonical)!=="internal"&&(!PACKAGE_NAMESPACE_OPERATIONS.has(entry.alias)||available.has(entry.alias)));return Object.fromEntries(NAMESPACE_PREFIXES.map(prefix=>[prefix,[...new Set(aliases.filter(entry=>entry.canonical.startsWith(`${prefix} `)).map(entry=>entry.canonical_argv[prefix.split(" ").length]))].join(" ")]))}const HISTORY_OPERATION_FLAGS=HISTORY_COMPLETION_ALIASES.map(entry=>({...entry,flags:toCompletionFlagString(resolveSubcommandFlagContractsForCommand(entry.alias))}));const HISTORY_FLAGS=toCompletionFlagString(HISTORY_FLAG_CONTRACTS);const HISTORY_AUTHOR_ACKNOWLEDGE_FLAGS=toCompletionFlagString(HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS,false);const EVENTS_FLAGS=toCompletionFlagString(EVENTS_FLAG_CONTRACTS);const CALENDAR_FLAGS=toCompletionFlagString(CALENDAR_FLAG_CONTRACTS);const CONTEXT_FLAGS=toCompletionFlagString(CONTEXT_FLAG_CONTRACTS);const NEXT_FLAGS=toCompletionFlagString(NEXT_FLAG_CONTRACTS);const DEPS_FLAGS=toCompletionFlagString(DEPS_FLAG_CONTRACTS);const DUPLICATES_FLAGS=toCompletionFlagString(DUPLICATES_FLAG_CONTRACTS);const GRAPH_FLAGS=toCompletionFlagString(GRAPH_FLAG_CONTRACTS);const GUIDE_FLAGS=toCompletionFlagString(GUIDE_FLAG_CONTRACTS);const SEARCH_FLAGS=toCompletionFlagString(SEARCH_FLAG_CONTRACTS);const STATS_FLAGS=toCompletionFlagString(STATS_FLAG_CONTRACTS);const HEALTH_FLAGS=toCompletionFlagString(HEALTH_FLAG_CONTRACTS);const INIT_FLAGS=toCompletionFlagString(INIT_FLAG_CONTRACTS);const CONTRACTS_FLAGS=toCompletionFlagString(CONTRACTS_FLAG_CONTRACTS);const PLAN_FLAGS=toCompletionFlagString(PLAN_FLAG_CONTRACTS);const SCHEMA_SUBCOMMAND_CHOICES=`${WORKFLOW_POLICY_ACTIONS.join(" ")} list show show-status add-type remove-type add-status remove-status add-field remove-field list-fields show-field apply-preset rename-type rename-field remap-status`;const PLAN_SUBCOMMANDS_LIST="create show add-step update-step complete-step block-step reorder-step remove-step link unlink decision discovery validation resume approve materialize";const COMPLETION_FLAGS=toCompletionFlagString(COMPLETION_FLAG_CONTRACTS);const COMPLETION_SHELL_CHOICES=`${COMPLETION_FLAGS} bash zsh fish`;const GUIDE_TOPIC_CHOICES=joinCompletionValues(listGuideTopicIds());const EXTENSION_LIFECYCLE_ACTIONS="init scaffold install uninstall explore manage describe reload doctor catalog adopt adopt-all activate deactivate migrate";const PACKAGE_LIFECYCLE_ACTIONS=`${EXTENSION_LIFECYCLE_ACTIONS} upgrade`;const EXTENSION_LIFECYCLE_FLAGS=toCompletionFlagString(EXTENSION_FLAG_CONTRACTS);const PACKAGE_LIFECYCLE_FLAGS=toCompletionFlagString(PACKAGE_FLAG_CONTRACTS);const UPGRADE_FLAGS=toCompletionFlagString(UPGRADE_FLAG_CONTRACTS);const MUTATION_FLAGS="--author --message --force --json --quiet --no-changed-fields --id-only --pm-path --path --no-extensions --no-pager --profile --help";const DELETE_MUTATION_FLAGS="--dry-run --author --message --force --json --quiet --no-changed-fields --id-only --pm-path --path --no-extensions --no-pager --profile --help";const CLOSE_MUTATION_FLAGS=toCompletionFlagString(resolveSubcommandFlagContractsForCommand("close"));const CLOSE_TASK_MUTATION_FLAGS=toCompletionFlagString(resolveSubcommandFlagContractsForCommand("close-task"));const RELEASE_MUTATION_FLAGS=toCompletionFlagString(resolveSubcommandFlagContractsForCommand("release"));const CLAIM_MUTATION_FLAGS=toCompletionFlagString(resolveSubcommandFlagContractsForCommand("claim"));const COMMAND_COMPLETION_DESCRIPTIONS=[["workspace","Workspace initialization, customization, state and snapshots"],["init","Initialize pm storage for the current workspace"],["config","Read or update pm settings"],["package","Manage package lifecycle operations"],["packages","Alias for package"],["create","Create a new project management item"],["item","Manage item evidence, links, tests, and duplication"],["copy","Copy an existing item to a new ID"],["focus","Set/clear/show the session focused parent for new items"],["list","List active items with optional filters"],["aggregate","Aggregate grouped item counts and numeric stats for governance queries"],["duplicates","Find bounded duplicate clusters across lifecycle statuses"],["guide","Browse local progressive-disclosure guides"],["calendar","Show calendar views for deadlines and reminders"],["cal","Alias for calendar"],["context","Show a token-efficient project context snapshot"],["ctx","Alias for context"],["get","Show item details by ID"],["next","Recommend the next actionable (unblocked, ready) work item"],["search","Search items with keyword, semantic, or hybrid modes"],["reindex","Rebuild search artifacts"],["history","Show item history entries"],["history-compact","Compact history streams into a synthetic baseline + retained tail"],["history-redact","Redact sensitive literals/patterns and recompute history hashes"],["history-repair","Re-anchor a drifted history chain so pm health/validate report ok"],["schema","Manage custom item types and statuses in .agents/pm/schema/*.json"],["profile","List, show, apply, and lint project profiles (archetype schema/config/template/package bundles)"],["plan","Agent-optimized Plan item workflow (create/show/add-step/update-step/complete-step/link/approve/materialize)"],["activity","Show recent activity across items"],["restore","Restore an item to an earlier state"],["update","Update item fields and metadata"],["update-many","Bulk-update matched items with dry-run and rollback checkpoints"],["close","Close an item (reason requirement follows governance settings)"],["close-many","Bulk-close matched items with an optional shared reason and rollback checkpoint"],["delete","Delete an item and record the change"],["append","Append text to an item body"],["comments","List or add comments for an item"],["notes","List or add notes for an item"],["learnings","List or add learnings for an item"],["files","Manage linked files"],["docs","Manage linked docs"],["deps","Show dependency relationships for an item"],["graph","Bounded graph traversal, analytics, and governance-audit queries"],["test","Manage linked tests and optionally run them"],["test-all","Run linked tests across matching items"],["test-runs","Manage background linked-test runs"],["stats","Show project tracker statistics"],["health","Show project tracker health checks"],["validate","Run standalone validation checks"],["gc","Clean optional cache artifacts"],["contracts","Show machine-readable command and schema contracts"],["claim","Claim an item for active work"],["release","Release the active claim for an item"],["start-task","Lifecycle alias to claim and set in_progress"],["pause-task","Lifecycle alias to reopen and release claim"],["close-task","Lifecycle alias to close and release claim"],["meet","Shortcut to create a Meeting with scheduling defaults"],["event","Shortcut to create an Event with scheduling defaults"],["remind","Shortcut to create a Reminder from a point in time"],["templates","Manage reusable create templates"],["completion","Generate shell completion"],["help","Display help for a command"]];const GLOBAL_FLAGS=GLOBAL_FLAG_CONTRACTS.flatMap(entry=>[entry.short,entry.flag,...entry.aliases??[]]).filter(value=>Boolean(value)).join(" ");const GLOBAL_COMPLETION_VALUE_PATTERNS=[...GLOBAL_VALUE_CONSUMING_FLAGS].join("|");const GLOBAL_COMPLETION_INLINE_PATTERNS=[...GLOBAL_VALUE_CONSUMING_FLAGS].map(flag=>`${flag}=*`).join("|");const GLOBAL_COMPLETION_SWITCH_PATTERNS=[...GLOBAL_FLAGS.split(" ").filter(flag=>!GLOBAL_VALUE_CONSUMING_FLAGS.has(flag)),"-h","-V"].join("|");function joinCompletionValues(values){return[...new Set(values.map(value=>value.trim()).filter(value=>value.length>0))].sort((left,right)=>left.localeCompare(right)).join(" ")}function joinCompletionValuesInOrder(values){return[...new Set(values.map(value=>value.trim()).filter(value=>value.length>0))].join(" ")}function shellDoubleQuote(value){return value.replaceAll("\\","\\\\").replaceAll('"','\\"').replaceAll("$","\\$").replaceAll("`","\\`")}function completionTypeValues(itemTypes,runtime){return joinCompletionValuesInOrder(itemTypes.length>0?itemTypes:runtime.item_types??DEFAULT_ITEM_TYPES)}function completionStatusValues(runtime){return joinCompletionValues(runtime.statuses??DEFAULT_STATUS_VALUES)}function mergeFlagStrings(baseFlags,runtimeFlags){const merged=[...baseFlags.split(/\s+/u).filter(value=>value.length>0),...runtimeFlags??[]];return joinCompletionValues(merged)}function normalizeRuntimeCompletionFlags(runtimeFlags){const normalized=(runtimeFlags??[]).map(value=>value.trim()).filter(value=>value.startsWith("--")&&value.length>2).map(value=>`--${value.slice(2).replaceAll("_","-")}`);return[...new Set(normalized)].sort((left,right)=>left.localeCompare(right))}export{AGGREGATE_FLAGS,ALL_COMMANDS,APPEND_FLAGS,ATTEST_INVOCATIONS,CALENDAR_FLAGS,CLAIM_MUTATION_FLAGS,CLOSE_MANY_FLAGS,CLOSE_MUTATION_FLAGS,CLOSE_TASK_MUTATION_FLAGS,COMMAND_COMPLETION_DESCRIPTIONS,COMPLETION_SHELL_CHOICES,CONTEXT_FLAGS,CONTRACTS_FLAGS,COPY_FLAGS,CREATE_FLAGS,DELETE_MUTATION_FLAGS,DEPS_FLAGS,DUPLICATES_FLAGS,EVENTS_FLAGS,EXTENSION_LIFECYCLE_ACTIONS,EXTENSION_LIFECYCLE_FLAGS,FOCUS_FLAGS,GET_FLAGS,GLOBAL_COMPLETION_INLINE_PATTERNS,GLOBAL_COMPLETION_SWITCH_PATTERNS,GLOBAL_COMPLETION_VALUE_PATTERNS,GLOBAL_FLAGS,GRAPH_FLAGS,GUIDE_FLAGS,GUIDE_TOPIC_CHOICES,HEALTH_FLAGS,HIDDEN_COMMAND_ALIASES,HISTORY_AUTHOR_ACKNOWLEDGE_FLAGS,HISTORY_FLAGS,HISTORY_LEAVES,HISTORY_OPERATION_FLAGS,INIT_FLAGS,LIST_FLAGS,MEET_FLAGS,MUTATION_FLAGS,NAMESPACE_NOUNS,NAMESPACE_PREFIXES,NEXT_FLAGS,PACKAGE_LIFECYCLE_ACTIONS,PACKAGE_LIFECYCLE_FLAGS,PLAN_FLAGS,PLAN_SUBCOMMANDS_LIST,RELEASE_MUTATION_FLAGS,REMIND_FLAGS,RESTORE_INVOCATIONS,SCHEMA_SUBCOMMAND_CHOICES,SEARCH_FLAGS,STATS_FLAGS,UPDATE_FLAGS,UPDATE_MANY_FLAGS,UPGRADE_FLAGS,completionNamespaceLeaves,completionStatusValues,completionTypeValues,joinCompletionValues,mergeFlagStrings,normalizeRuntimeCompletionFlags,shellDoubleQuote};
2
2
  //# sourceMappingURL=shared.js.map
@@ -3,7 +3,7 @@ import type { GlobalOptions } from "../core/shared/command-types.js";
3
3
  export { EVAL_QUERY_SET_CONTRACT, EVAL_QUERY_SET_EXAMPLE, EVAL_QUERY_SET_SCHEMA_ID, parseEvalQuerySet, } from "../core/search/eval.js";
4
4
  /** Relative location (under the pm root) of the default golden-query set. A git-tracked, human-curated file so relevance ground truth lives alongside the tracker it evaluates. */
5
5
  export declare const DEFAULT_EVAL_QUERIES_RELATIVE_PATH: string;
6
- /** Documents the eval command options payload exchanged by command, SDK, and package integrations. */
6
+ /** Evaluation inputs shared by SDK hosts and the CLI adapter. */
7
7
  export interface EvalOptions {
8
8
  /** Default retrieval mode for queries that do not set their own (keyword|semantic|hybrid). */
9
9
  mode?: string;
@@ -18,41 +18,43 @@ export interface EvalOptions {
18
18
  }
19
19
  /** Per-query relevance report row emitted by {@link runEval}. */
20
20
  export interface EvalQueryReport {
21
- /** Value that configures or reports query for this contract. */
21
+ /** Original golden-query text used for retrieval. */
22
22
  query: string;
23
- /** Value that configures or reports mode for this contract. */
23
+ /** Resolved retrieval mode after applying query and run defaults. */
24
24
  mode: EvalSearchMode;
25
- /** Value that configures or reports relevant total for this contract. */
25
+ /** Number of unique items judged relevant to this query. */
26
26
  relevant_total: number;
27
- /** Value that configures or reports retrieved relevant for this contract. */
27
+ /** Relevant items found within the ranking cutoff. */
28
28
  retrieved_relevant: number;
29
- /** Value that configures or reports ndcg for this contract. */
29
+ /** Normalized discounted cumulative gain at the selected cutoff. */
30
30
  ndcg: number;
31
- /** Value that configures or reports mrr for this contract. */
31
+ /** Reciprocal rank of the first relevant result, or zero when absent. */
32
32
  mrr: number;
33
- /** Value that configures or reports precision for this contract. */
33
+ /** Fraction of positions at the selected cutoff containing relevant items. */
34
34
  precision: number;
35
- /** Value that configures or reports recall for this contract. */
35
+ /** Fraction of judged relevant items retrieved at the selected cutoff. */
36
36
  recall: number;
37
+ /** Failed per-query floors, compared against unrounded scores. */
38
+ violations?: string[];
37
39
  }
38
- /** Documents the eval result payload exchanged by command, SDK, and package integrations. */
40
+ /** Rounded ranking evidence and the verdict computed from unrounded metrics. */
39
41
  export interface EvalResult {
40
- /** Value that configures or reports k for this contract. */
42
+ /** Maximum ranking positions scored for each query. */
41
43
  k: number;
42
44
  /** Number of query entries represented by this result. */
43
45
  query_count: number;
44
- /** Value that configures or reports aggregate for this contract. */
46
+ /** Equal-weight macro averages across all evaluated queries. */
45
47
  aggregate: {
46
48
  ndcg: number;
47
49
  mrr: number;
48
50
  precision: number;
49
51
  recall: number;
50
52
  };
51
- /** Value that configures or reports queries for this contract. */
53
+ /** Individual query scores and any failed declared floors. */
52
54
  queries: EvalQueryReport[];
53
55
  /** Present only when `--fail-under` was supplied. */
54
56
  fail_under?: number;
55
- /** Whether the aggregate nDCG met the gate (always true when no gate is set). */
57
+ /** Whether every declared per-query floor and optional aggregate nDCG threshold passed. */
56
58
  passed: boolean;
57
59
  }
58
60
  /**
@@ -60,8 +62,8 @@ export interface EvalResult {
60
62
  * (default `<pmRoot>/search/eval-queries.json`, overridable via `--queries`),
61
63
  * runs each query through {@link runSearch} at the resolved mode, scores the
62
64
  * returned ranking with the nDCG/MRR/precision/recall metrics, and macro-averages
63
- * across queries. When `--fail-under` is supplied, `passed` reflects whether the
64
- * aggregate nDCG@k cleared the threshold; the CLI layer maps a failed gate to a
65
- * non-zero exit code.
65
+ * across queries. `passed` requires every declared per-query minimum and, when
66
+ * supplied, the aggregate `--fail-under` threshold. The CLI maps any failed
67
+ * threshold to a non-zero exit code.
66
68
  */
67
69
  export declare const runEval: (options: EvalOptions, global: GlobalOptions) => Promise<EvalResult>;
package/dist/sdk/eval.js CHANGED
@@ -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]="7f6cfdef-5456-5716-9067-8ccadf077f5f")}catch(e2){}})();import{assertInitializedTracker}from"./environment/tracker-preflight.js";import fs from"node:fs/promises";import path from"node:path";import{aggregateEvalMetrics,DEFAULT_EVAL_K,EVAL_QUERY_SET_EXAMPLE,EVAL_QUERY_SET_SCHEMA_ID,evaluateRanking,parseEvalQuerySet}from"../core/search/eval.js";import{EXIT_CODE}from"../core/shared/constants.js";import{PmCliError}from"../core/shared/errors.js";import{coercePositiveInteger}from"../core/shared/primitives.js";import{resolvePmRoot}from"../core/store/paths.js";import{runSearch}from"./query/search.js";import{EVAL_QUERY_SET_CONTRACT,EVAL_QUERY_SET_EXAMPLE as EVAL_QUERY_SET_EXAMPLE2,EVAL_QUERY_SET_SCHEMA_ID as EVAL_QUERY_SET_SCHEMA_ID2,parseEvalQuerySet as parseEvalQuerySet2}from"../core/search/eval.js";const DEFAULT_EVAL_QUERIES_RELATIVE_PATH=path.join("search","eval-queries.json");const EVAL_QUERY_SET_ERROR_CONTEXT={schema:EVAL_QUERY_SET_SCHEMA_ID,examples:[JSON.stringify(EVAL_QUERY_SET_EXAMPLE)],nextSteps:["Create a git-tracked golden-query JSON file that follows the schema, then re-run pm eval."]};const VALID_EVAL_MODES=new Set(["keyword","semantic","hybrid"]);const parseEvalMode=raw=>{if(raw===void 0){return"keyword"}const normalized=raw.trim().toLowerCase();if(!VALID_EVAL_MODES.has(normalized)){throw new PmCliError("Eval --mode must be one of keyword|semantic|hybrid",EXIT_CODE.USAGE)}return normalized};const parseEvalK=raw=>{if(raw===void 0||raw===""){return DEFAULT_EVAL_K}const parsed=coercePositiveInteger(raw);if(parsed===null){throw new PmCliError("Eval --k must be a positive integer",EXIT_CODE.USAGE)}return parsed};const parseFailUnder=raw=>{if(raw===void 0||raw===""){return void 0}const normalized=String(raw).trim();const parsed=Number(normalized);if([normalized.length===0,!Number.isFinite(parsed),parsed<0,parsed>1].includes(true)){throw new PmCliError("Eval --fail-under must be a number in the range [0, 1]",EXIT_CODE.USAGE)}return parsed};const roundMetric=value=>Math.round(value*1e4)/1e4;const readEvalQuerySetFile=async queriesPath=>{try{return await fs.readFile(queriesPath,"utf8")}catch{throw new PmCliError(`Eval query set not found at ${queriesPath}`,EXIT_CODE.NOT_FOUND,{...EVAL_QUERY_SET_ERROR_CONTEXT,examples:[`echo '${JSON.stringify(EVAL_QUERY_SET_EXAMPLE)}' > ${queriesPath}`,"pm eval --queries ./my-eval.json"]})}};const parseEvalQuerySetJson=(raw,queriesPath)=>{try{return JSON.parse(raw)}catch(error){throw new PmCliError(`Eval query set at ${queriesPath} is not valid JSON: ${error instanceof Error?error.message:String(error)}`,EXIT_CODE.USAGE,EVAL_QUERY_SET_ERROR_CONTEXT)}};const validateEvalQuerySet=parsed=>{try{return parseEvalQuerySet(parsed)}catch(error){throw new PmCliError(error instanceof Error?error.message:String(error),EXIT_CODE.USAGE,EVAL_QUERY_SET_ERROR_CONTEXT)}};const loadEvalQuerySet=async queriesPath=>validateEvalQuerySet(parseEvalQuerySetJson(await readEvalQuerySetFile(queriesPath),queriesPath));const resolveEvalQueriesPath=(pmRoot,queries)=>queries?path.resolve(process.cwd(),queries):path.join(pmRoot,DEFAULT_EVAL_QUERIES_RELATIVE_PATH);const evaluateEvalQuery=async(evalQuery,defaultMode,k,global2)=>{const mode=evalQuery.mode??defaultMode;const searchResult=await runSearch(evalQuery.query,{mode,limit:String(k),fields:"id"},global2);const rankedIds=searchResult.items.map(item=>item.id).filter(id=>typeof id==="string");const metrics=evaluateRanking(rankedIds,new Set(evalQuery.relevant_ids),k);return{metrics,report:{query:evalQuery.query,mode,relevant_total:metrics.relevant_total,retrieved_relevant:metrics.retrieved_relevant,ndcg:roundMetric(metrics.ndcg),mrr:roundMetric(metrics.mrr),precision:roundMetric(metrics.precision),recall:roundMetric(metrics.recall)}}};const buildEvalResult=(k,reports,rawMetrics,failUnder)=>{const aggregate=aggregateEvalMetrics(rawMetrics);return{k,query_count:reports.length,aggregate:{ndcg:roundMetric(aggregate.ndcg),mrr:roundMetric(aggregate.mrr),precision:roundMetric(aggregate.precision),recall:roundMetric(aggregate.recall)},queries:reports,...failUnder!==void 0?{fail_under:failUnder}:{},passed:failUnder===void 0||aggregate.ndcg>=failUnder}};const runEval=async(options,global2)=>{const pmRoot=resolvePmRoot(process.cwd(),global2.path);await assertInitializedTracker(pmRoot);const k=parseEvalK(options.k);const defaultMode=parseEvalMode(options.mode);const failUnder=parseFailUnder(options.failUnder);const queriesPath=resolveEvalQueriesPath(pmRoot,options.queries);const querySet=await loadEvalQuerySet(queriesPath);const reports=[];const rawMetrics=[];for(const evalQuery of querySet.queries){const{report,metrics}=await evaluateEvalQuery(evalQuery,defaultMode,k,global2);rawMetrics.push(metrics);reports.push(report)}return buildEvalResult(k,reports,rawMetrics,failUnder)};export{DEFAULT_EVAL_QUERIES_RELATIVE_PATH,EVAL_QUERY_SET_CONTRACT,EVAL_QUERY_SET_EXAMPLE2 as EVAL_QUERY_SET_EXAMPLE,EVAL_QUERY_SET_SCHEMA_ID2 as EVAL_QUERY_SET_SCHEMA_ID,parseEvalQuerySet2 as parseEvalQuerySet,runEval};
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]="d4020969-4ce5-5f87-ae41-f5a3dec0a197")}catch(e2){}})();import{evaluateMetricFloors}from"../core/search/eval-thresholds.js";import{assertInitializedTracker}from"./environment/tracker-preflight.js";import fs from"node:fs/promises";import path from"node:path";import{aggregateEvalMetrics,DEFAULT_EVAL_K,EVAL_QUERY_SET_EXAMPLE,EVAL_QUERY_SET_SCHEMA_ID,evaluateRanking,parseEvalQuerySet}from"../core/search/eval.js";import{EXIT_CODE}from"../core/shared/constants.js";import{PmCliError}from"../core/shared/errors.js";import{coercePositiveInteger}from"../core/shared/primitives.js";import{resolvePmRoot}from"../core/store/paths.js";import{runSearch}from"./query/search.js";import{EVAL_QUERY_SET_CONTRACT,EVAL_QUERY_SET_EXAMPLE as EVAL_QUERY_SET_EXAMPLE2,EVAL_QUERY_SET_SCHEMA_ID as EVAL_QUERY_SET_SCHEMA_ID2,parseEvalQuerySet as parseEvalQuerySet2}from"../core/search/eval.js";const DEFAULT_EVAL_QUERIES_RELATIVE_PATH=path.join("search","eval-queries.json");const EVAL_QUERY_SET_ERROR_CONTEXT={schema:EVAL_QUERY_SET_SCHEMA_ID,examples:[JSON.stringify(EVAL_QUERY_SET_EXAMPLE)],nextSteps:["Create a git-tracked golden-query JSON file that follows the schema, then re-run pm eval."]};const VALID_EVAL_MODES=new Set(["keyword","semantic","hybrid"]);const parseEvalMode=raw=>{if(raw===void 0){return"keyword"}const normalized=raw.trim().toLowerCase();if(!VALID_EVAL_MODES.has(normalized)){throw new PmCliError("Eval --mode must be one of keyword|semantic|hybrid",EXIT_CODE.USAGE)}return normalized};const parseEvalK=raw=>{if(raw===void 0||raw===""){return DEFAULT_EVAL_K}const parsed=coercePositiveInteger(raw);if(parsed===null){throw new PmCliError("Eval --k must be a positive integer",EXIT_CODE.USAGE)}return parsed};const parseFailUnder=raw=>{if(raw===void 0||raw===""){return void 0}const normalized=String(raw).trim();const parsed=Number(normalized);if([normalized.length===0,!Number.isFinite(parsed),parsed<0,parsed>1].includes(true)){throw new PmCliError("Eval --fail-under must be a number in the range [0, 1]",EXIT_CODE.USAGE)}return parsed};const roundMetric=value=>Math.round(value*1e4)/1e4;const readEvalQuerySetFile=async queriesPath=>{try{return await fs.readFile(queriesPath,"utf8")}catch{throw new PmCliError(`Eval query set not found at ${queriesPath}`,EXIT_CODE.NOT_FOUND,{...EVAL_QUERY_SET_ERROR_CONTEXT,examples:[`echo '${JSON.stringify(EVAL_QUERY_SET_EXAMPLE)}' > ${queriesPath}`,"pm eval --queries ./my-eval.json"]})}};const parseEvalQuerySetJson=(raw,queriesPath)=>{try{return JSON.parse(raw)}catch(error){throw new PmCliError(`Eval query set at ${queriesPath} is not valid JSON: ${error instanceof Error?error.message:String(error)}`,EXIT_CODE.USAGE,EVAL_QUERY_SET_ERROR_CONTEXT)}};const validateEvalQuerySet=parsed=>{try{return parseEvalQuerySet(parsed)}catch(error){throw new PmCliError(error instanceof Error?error.message:String(error),EXIT_CODE.USAGE,EVAL_QUERY_SET_ERROR_CONTEXT)}};const loadEvalQuerySet=async queriesPath=>validateEvalQuerySet(parseEvalQuerySetJson(await readEvalQuerySetFile(queriesPath),queriesPath));const evaluateEvalQuery=async(evalQuery,defaultMode,k,global2)=>{const mode=evalQuery.mode??defaultMode;const searchResult=await runSearch(evalQuery.query,{mode,limit:String(k),fields:"id"},global2);const rankedIds=searchResult.items.map(item=>item.id).filter(id=>typeof id==="string");const metrics=evaluateRanking(rankedIds,new Set(evalQuery.relevant_ids),k);return{metrics,report:{query:evalQuery.query,...evalQuery.minimum===void 0?{}:{violations:evaluateMetricFloors(metrics,evalQuery.minimum)},mode,relevant_total:metrics.relevant_total,retrieved_relevant:metrics.retrieved_relevant,ndcg:roundMetric(metrics.ndcg),mrr:roundMetric(metrics.mrr),precision:roundMetric(metrics.precision),recall:roundMetric(metrics.recall)}}};const buildEvalResult=(k,reports,rawMetrics,failUnder)=>{const aggregate=aggregateEvalMetrics(rawMetrics);return{k,query_count:reports.length,aggregate:{ndcg:roundMetric(aggregate.ndcg),mrr:roundMetric(aggregate.mrr),precision:roundMetric(aggregate.precision),recall:roundMetric(aggregate.recall)},queries:reports,...failUnder!==void 0?{fail_under:failUnder}:{},passed:(failUnder===void 0||aggregate.ndcg>=failUnder)&&reports.every(report=>(report.violations?.length??0)===0)}};const runEval=async(options,global2)=>{const pmRoot=resolvePmRoot(process.cwd(),global2.path);await assertInitializedTracker(pmRoot);const k=parseEvalK(options.k);const defaultMode=parseEvalMode(options.mode);const failUnder=parseFailUnder(options.failUnder);const queriesPath=options.queries?path.resolve(process.cwd(),options.queries):path.join(pmRoot,DEFAULT_EVAL_QUERIES_RELATIVE_PATH);const querySet=await loadEvalQuerySet(queriesPath);const reports=[];const rawMetrics=[];for(const evalQuery of querySet.queries){const{report,metrics}=await evaluateEvalQuery(evalQuery,defaultMode,k,global2);rawMetrics.push(metrics);reports.push(report)}return buildEvalResult(k,reports,rawMetrics,failUnder)};export{DEFAULT_EVAL_QUERIES_RELATIVE_PATH,EVAL_QUERY_SET_CONTRACT,EVAL_QUERY_SET_EXAMPLE2 as EVAL_QUERY_SET_EXAMPLE,EVAL_QUERY_SET_SCHEMA_ID2 as EVAL_QUERY_SET_SCHEMA_ID,parseEvalQuerySet2 as parseEvalQuerySet,runEval};
2
2
  //# sourceMappingURL=eval.js.map
@@ -0,0 +1,54 @@
1
+ /** One read failure or malformed document that prevents a complete inventory. */
2
+ export interface StaticExtensionInventoryError {
3
+ /** Stable machine-readable reason. */
4
+ code: "settings_invalid" | "settings_unreadable" | "managed_state_invalid" | "managed_state_unreadable" | "extensions_unreadable" | "manifest_invalid" | "manifest_unreadable";
5
+ /** File or directory whose read failed. */
6
+ path: string;
7
+ }
8
+ /** A configured package; runtime activation has deliberately not been tested. */
9
+ export interface StaticExtensionInventoryEntry {
10
+ /** Manifest name, or directory name when the manifest is malformed. */
11
+ name: string;
12
+ /** Extension directory basename. */
13
+ directory: string | null;
14
+ /** Selected storage scope. */
15
+ scope: "project" | "global";
16
+ /** Whether an installed directory was found. */
17
+ installed: boolean;
18
+ /** Installed, disabled, absent, or unreadable manifest outcome. */
19
+ status: "installed" | "inactive" | "absent" | "malformed_manifest";
20
+ /** Effective configured state; null when settings cannot be trusted. */
21
+ configured_enabled: boolean | null;
22
+ /** Whether managed metadata identifies this install; null when that metadata is invalid. */
23
+ managed: boolean | null;
24
+ /** Runtime state is never inferred from configuration. */
25
+ runtime_active: null;
26
+ /** Manifest version when available. */
27
+ version?: string;
28
+ }
29
+ /** A read-only inventory with explicit completeness and source receipts. */
30
+ export interface StaticExtensionInventoryResult {
31
+ /** Selected storage scope. */
32
+ scope: "project" | "global";
33
+ /** False if any source could not be read or parsed completely. */
34
+ complete: boolean;
35
+ /** Status of the two configuration sources. */
36
+ settings_status: "ok" | "absent" | "invalid" | "unreadable";
37
+ /** Status of the managed install metadata. */
38
+ managed_state_status: "ok" | "absent" | "invalid" | "unreadable";
39
+ /** Installed entries, or one absent entry for a missing requested name. */
40
+ extensions: StaticExtensionInventoryEntry[];
41
+ /** Every failure that affected completeness. */
42
+ errors: StaticExtensionInventoryError[];
43
+ }
44
+ /** Read configured extension state through filesystem reads only. */
45
+ export declare function inspectStaticExtensionInventory(options: {
46
+ /** Tracker root for the project scope. */
47
+ pmRoot: string;
48
+ /** Storage scope; project is the default. */
49
+ scope?: "project" | "global";
50
+ /** Optional name or directory to inspect, including absent installs. */
51
+ name?: string;
52
+ /** Base directory used to resolve the global PM root. */
53
+ cwd?: string;
54
+ }): Promise<StaticExtensionInventoryResult>;
@@ -0,0 +1,2 @@
1
+ !(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1dead22c-ea8e-5a98-bc73-8de82bbb4dcc")}catch(e2){}})();import fs from"node:fs/promises";import path from"node:path";import{resolveGlobalPmRoot}from"../../core/store/paths.js";import{normalizeManagedState}from"./managed-state.js";import{normalizeExtensionNameForMatch,normalizeStringList,parseExtensionManifest}from"./shared.js";function isMissing(error){return typeof error==="object"&&error!==null&&"code"in error&&error.code==="ENOENT"}function isTrustedSourceStatus(status){return status!=="invalid"&&status!=="unreadable"}function parseEnablement(raw){const parsed=JSON.parse(raw);if(typeof parsed!=="object"||parsed===null||Array.isArray(parsed))throw new SyntaxError("Invalid settings object");const configured=parsed.extensions;if(configured===void 0)return{enabled:[],disabled:[]};if(typeof configured!=="object"||configured===null||Array.isArray(configured))throw new SyntaxError("Invalid extensions settings");const value=configured;if(value.enabled!==void 0&&(!Array.isArray(value.enabled)||!value.enabled.every(entry=>typeof entry==="string"))||value.disabled!==void 0&&(!Array.isArray(value.disabled)||!value.disabled.every(entry=>typeof entry==="string"))){throw new SyntaxError("Invalid extension enablement lists")}return{enabled:value.enabled??[],disabled:value.disabled??[]}}async function readEnablement(settingsPath){let raw;try{raw=await fs.readFile(settingsPath,"utf8")}catch(error){if(isMissing(error))return{status:"absent",enabled:[],disabled:[]};return{status:"unreadable",enabled:[],disabled:[],error:{code:"settings_unreadable",path:settingsPath}}}try{return{status:"ok",...parseEnablement(raw)}}catch{return{status:"invalid",enabled:[],disabled:[],error:{code:"settings_invalid",path:settingsPath}}}}async function readManagedRecords(managedPath){let raw;try{raw=await fs.readFile(managedPath,"utf8")}catch(error){if(isMissing(error))return{status:"absent",entries:[]};return{status:"unreadable",entries:[],error:{code:"managed_state_unreadable",path:managedPath}}}try{const parsed=JSON.parse(raw);const normalized=normalizeManagedState(parsed);if(!normalized||typeof parsed!=="object"||parsed===null||!Array.isArray(parsed.entries)||normalized.entries.length!==parsed.entries.length){throw new SyntaxError("Invalid managed extension state")}return{status:"ok",entries:normalized.entries}}catch{return{status:"invalid",entries:[],error:{code:"managed_state_invalid",path:managedPath}}}}async function readExtensionDirectories(extensionsRoot){try{const directories=(await fs.readdir(extensionsRoot,{withFileTypes:true})).filter(entry=>entry.isDirectory()).map(entry=>entry.name).sort((left,right)=>left.localeCompare(right));return{directories}}catch(error){if(isMissing(error))return{directories:[]};return{directories:[],error:{code:"extensions_unreadable",path:extensionsRoot}}}}async function readManifest(manifestPath){let raw;try{raw=await fs.readFile(manifestPath,"utf8")}catch(error){if(isMissing(error)){return{manifest:null,error:{code:"manifest_invalid",path:manifestPath}}}return{manifest:null,error:{code:"manifest_unreadable",path:manifestPath}}}try{const manifest=parseExtensionManifest(JSON.parse(raw));return manifest?{manifest}:{manifest:null,error:{code:"manifest_invalid",path:manifestPath}}}catch{return{manifest:null,error:{code:"manifest_invalid",path:manifestPath}}}}function projectConfiguredEntry(input){const name=input.manifest?.name??input.directory;const enabled=new Set(normalizeStringList(input.settings.enabled));const disabled=new Set(normalizeStringList(input.settings.disabled));const configuredEnabled=!isTrustedSourceStatus(input.settings.status)||!input.manifest?null:!disabled.has(name)&&(enabled.size===0||enabled.has(name));const managed=!isTrustedSourceStatus(input.managed.status)?null:input.managed.entries.some(entry=>normalizeExtensionNameForMatch(entry.name)===normalizeExtensionNameForMatch(name)||normalizeExtensionNameForMatch(entry.directory)===normalizeExtensionNameForMatch(input.directory));return{name,directory:input.directory,scope:input.scope,installed:true,status:input.manifest?configuredEnabled===false?"inactive":"installed":"malformed_manifest",configured_enabled:configuredEnabled,managed,runtime_active:null,...input.manifest?{version:input.manifest.version}:{}}}async function inspectStaticExtensionInventory(options){const scope=options.scope??"project";const selectedRoot=scope==="global"?resolveGlobalPmRoot(options.cwd??process.cwd()):options.pmRoot;const extensionsRoot=path.join(selectedRoot,"extensions");const settings=await readEnablement(path.join(selectedRoot,"settings.json"));const managed=await readManagedRecords(path.join(extensionsRoot,".managed-extensions.json"));const listed=await readExtensionDirectories(extensionsRoot);const errors=[];for(const source of[settings,managed,listed]){if(source.error)errors.push(source.error)}const requested=options.name?.trim();const extensions=[];for(const directory of listed.directories){const manifestPath=path.join(extensionsRoot,directory,"manifest.json");const inspected=await readManifest(manifestPath);if(inspected.error)errors.push(inspected.error);const entry=projectConfiguredEntry({directory,scope,manifest:inspected.manifest,settings,managed});if(requested&&![entry.name,directory].some(value=>normalizeExtensionNameForMatch(value)===normalizeExtensionNameForMatch(requested))){continue}extensions.push(entry)}if(requested&&extensions.length===0&&errors.every(error=>error.code!=="extensions_unreadable")){extensions.push({name:requested,directory:null,scope,installed:false,status:"absent",configured_enabled:isTrustedSourceStatus(settings.status)?false:null,managed:isTrustedSourceStatus(managed.status)?false:null,runtime_active:null})}return{scope,complete:errors.length===0,settings_status:settings.status,managed_state_status:managed.status,extensions,errors}}export{inspectStaticExtensionInventory};
2
+ //# sourceMappingURL=static-inventory.js.map