@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
@@ -21,7 +21,7 @@ agent can rebuild the full situation from it alone.
21
21
  | ---- | ------------------------------------- | --------- | ------------------------------ |
22
22
  | 0 | This file | ~650 tok | Always. |
23
23
  | 1 | `pm context --limit 10` | ~2.1k | Orient in an existing project. |
24
- | 1 | `pm search "<terms>" --limit 10` | ~0.5-1k | Before creating anything. |
24
+ | 1 | `pm search "<terms>" --limit 10` | ~0.5-1k | Before creating anything; mode is resolved by `search.default_mode` (hybrid when semantic search is configured). |
25
25
  | 2 | `pm guide <topic> --depth brief` | ~0.6-1k | An unfamiliar family. |
26
26
  | 3 | `references/*.md` below | ~0.3-1k | Procedure detail. |
27
27
 
@@ -46,7 +46,7 @@ pm guide commands --depth brief
46
46
 
47
47
  ```bash
48
48
  pm context --limit 10
49
- pm search "<request keywords>" --limit 10
49
+ pm search "<request keywords>" --limit 10 # mode_source in the result tells you whether hybrid or keyword ran
50
50
  pm list --status open --limit 20 --brief
51
51
  # reuse if it exists; otherwise create with lineage
52
52
  pm create --create-mode progressive \
@@ -11,7 +11,7 @@ implementation starts with bounded context and expands only its active lineage.
11
11
 
12
12
  ```bash
13
13
  pm context --limit 10 --for orient
14
- pm search "<request keywords>" --limit 10
14
+ pm search "<request keywords>" --limit 10 # hybrid when semantic search is configured, keyword otherwise
15
15
  pm list --status open --limit 20
16
16
  pm list --status in_progress --limit 20
17
17
  pm list --all --no-truncate --full --include-body --strict-read --json
@@ -6,14 +6,14 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "Official marketplace for pm CLI — native git-based project management for Claude Code and AI coding agents.",
9
- "version": "2026.9.8"
9
+ "version": "2026.9.9"
10
10
  },
11
11
  "plugins": [
12
12
  {
13
13
  "name": "pm-claude",
14
14
  "source": "./plugins/pm-claude",
15
15
  "description": "Native pm CLI integration for Claude Code — 28 MCP tools, 5 workflow skills, 14 slash commands, 4 subagents, hybrid TUI task tracking, session context injection, and coordination subagents for git-based project management without leaving Claude Code.",
16
- "version": "2026.9.8",
16
+ "version": "2026.9.9",
17
17
  "author": {
18
18
  "name": "unbrained",
19
19
  "url": "https://github.com/unbraind/pm-cli"
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## 2026.9.9 - 2026-09-09
4
+
5
+ ### Added
6
+
7
+ - Lifecycle field-completeness contract: each item type declares the fields required at each status transition, machine-checked by pm validate ([pm-htbetn](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/features/pm-htbetn.toon))
8
+ - Declarative policy engine: item-level transition, approval, and authorship rules declared as data and enforced consistently at the SDK layer ([pm-mj42og](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/features/pm-mj42og.toon))
9
+
10
+ ### Fixed
11
+
12
+ - Explain binding token budgets beside read-output alias migration hints ([pm-8kzfc4](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-8kzfc4.toon))
13
+ - Preserve dependency kind constraints in rendered enum errors ([pm-lk0qhn](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-lk0qhn.toon))
14
+ - pm search defaults to keyword on a workspace whose vector index is complete, so the shipped Ollama semantic default never reaches the default query path ([pm-n8a6e7](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-n8a6e7.toon))
15
+
16
+ ### Security
17
+
18
+ - GHSA-crvj-82cr-hjcx: Hono: Query parser reads parameters after the URL fragment, causing cache-key and proxy interpretation differentials ([pm-vnv467](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-vnv467.toon))
19
+ - GHSA-g6gw-c38x-mqfc: Hono: Unbounded dot-notation nesting in `parseBody()` can cause memory exhaustion ([pm-gxt0mx](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gxt0mx.toon))
20
+ - GHSA-gqvv-2mrq-wpjv: Hono: Incomplete fix for CVE-2026-39408: `toSSG()` still writes files outside the output directory ([pm-rc8708](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-rc8708.toon))
21
+
3
22
  ## 2026.9.8 - 2026-09-08
4
23
 
5
24
  ### Added
@@ -12,9 +31,9 @@
12
31
 
13
32
  ### Fixed
14
33
 
34
+ - GH-1218: expose local package copy scope and packed-install alternatives ([pm-5bsofk](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-5bsofk.toon))
15
35
  - GH-1219: report truthful package update coverage for skipped and failed checks ([pm-gf5zw8](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gf5zw8.toon))
16
36
  - Claim ownership response repeats full metadata despite the compact mutation contract ([pm-eqdo85](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-eqdo85.toon))
17
- - GH-1218: expose local package copy scope and packed-install alternatives ([pm-5bsofk](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-5bsofk.toon))
18
37
  - Reject repository-local test scratch roots before sandbox fixtures can mutate the real Git workspace ([pm-bukwmy](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-bukwmy.toon))
19
38
  - GH-1214: Bound complete item reads and isolate Git newline fixtures on Windows ([pm-hrhfgi](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-hrhfgi.toon))
20
39
  - GH-1216: Preserve diagnostic identity and sanitize short and bounded error text ([pm-m4uyyj](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-m4uyyj.toon))
@@ -213,9 +232,9 @@
213
232
 
214
233
  ### Other
215
234
 
235
+ - Close the jscpd/CodeFactor sensitivity gap: minTokens 115 misses low-token table clones the CodeFactor bot still files ([pm-xspd](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-xspd.toon))
216
236
  - Refresh @sentry/node 10.72 with packed SDK and release proof ([pm-mwhv33](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-mwhv33.toon))
217
237
  - Refresh compatible 2026-08-29 dependency releases ([pm-vwuidf](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-vwuidf.toon))
218
- - Close the jscpd/CodeFactor sensitivity gap: minTokens 115 misses low-token table clones the CodeFactor bot still files ([pm-xspd](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-xspd.toon))
219
238
 
220
239
  ## 2026.8.28 - 2026-08-28
221
240
 
@@ -1,11 +1,11 @@
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]="7f10283d-7b38-500c-9ad2-16c62ee336c1")}catch(e2){}})();import{EXIT_CODE,PmCliError,readSettings,renderRowsAsCsv,renderRowsAsTable,resolvePmRoot}from"../sdk/runtime-primitives.js";import{renderPmCommandAliasMigrationHint,resolvePmCommandAlias}from"../sdk/cli-contracts.js";import{EVAL_QUERY_SET_SCHEMA_ID}from"../sdk/eval.js";import{applyContextIntentProjection}from"../sdk/context-intent-contracts.js";import{renderPmClosedDomainHelp}from"../sdk/agent/closed-domain-contracts.js";import{serializeNdjsonRows,serializeNdjsonStream}from"../sdk/output.js";import{listMutationEvents,subscribeMutationEventBatches,subscribeMutationEvents}from"../sdk/mutation-events.js";import{registerHistoryActivityCommand}from"./register-history-activity.js";import{registerHistoryMaintenanceCommands}from"./register-history-maintenance.js";import{runAggregate}from"./commands/aggregate.js";import{renderContextMarkdown,runContext,resolveContextOutputFormat}from"./commands/context.js";import{runEval}from"./commands/eval.js";import{runGet}from"./commands/get.js";import{runGraph}from"./commands/graph.js";import{runHistory}from"./commands/history.js";import{runList}from"./commands/list.js";import{LIST_COMMAND_DEFAULT_PROJECTIONS}from"../sdk/query/list.js";import{renderNextMarkdown,runNext,resolveNextOutputFormat}from"./commands/next.js";import{runSearch}from"./commands/search.js";import{addHiddenOption,collect,getGlobalOptions,normalizeAggregateOptions,normalizeContextOptions,normalizeListOptions,normalizeNextOptions,normalizeSearchKeywordsInput,normalizeSearchOptions,printError,printListJsonStream,printResult,setActiveCommandResult,writeStdout}from"./registration-helpers.js";function shouldRegisterListQueryCommand(commandName,commandFilter){if(!commandFilter||commandFilter.size===0){return true}if(commandName==="context"){return commandFilter.has("context")||commandFilter.has("ctx")}return commandFilter.has(commandName)}function parseListFormat(rawFormat){if(rawFormat===void 0){return void 0}if(typeof rawFormat!=="string"){throw new PmCliError("List --format must be one of csv|table|json|ndjson|toon",EXIT_CODE.USAGE)}const normalized=rawFormat.trim().toLowerCase();if(normalized==="csv"||normalized==="table"||normalized==="json"||normalized==="ndjson"||normalized==="toon"){return normalized}throw new PmCliError("List --format must be one of csv|table|json|ndjson|toon",EXIT_CODE.USAGE)}function resolveReadCommandOutputFormat(commandLabel,rawFormat,globalOptions,allowNdjson=false){if(rawFormat===void 0){return globalOptions}if(typeof rawFormat!=="string"){throw new PmCliError(`${commandLabel} --format must be one of ${allowNdjson?"json|ndjson|toon":"json|toon"}`,EXIT_CODE.USAGE)}const normalized=rawFormat.trim().toLowerCase();if(normalized!=="json"&&(normalized!=="ndjson"||!allowNdjson)&&normalized!=="toon"){throw new PmCliError(`${commandLabel} --format must be one of ${allowNdjson?"json|ndjson|toon":"json|toon"}`,EXIT_CODE.USAGE)}if(globalOptions.json===true&&normalized==="toon"){throw new PmCliError(`${commandLabel} cannot combine --json with --format toon`,EXIT_CODE.USAGE)}return{...globalOptions,json:normalized==="json"||normalized==="ndjson"}}function applyDefaultListProjection(listOptions,commandName){if(LIST_COMMAND_DEFAULT_PROJECTIONS[commandName]==="brief"&&listOptions.includeBody!==true&&listOptions.compact!==true&&listOptions.brief!==true&&listOptions.full!==true&&listOptions.fields===void 0){listOptions.brief=true}}function registerContentAndGovernanceFilters(command){command.option("--has-notes","Show only items that have notes").option("--has-learnings","Show only items that have learnings").option("--has-files","Show only items that have linked files").option("--has-docs","Show only items that have linked docs").option("--has-tests","Show only items that have linked tests").option("--has-comments","Show only items that have comments").option("--has-deps","Show only items that have dependencies").option("--has-body","Show only items that have a non-empty body").option("--has-linked-command","Show only items whose linked tests carry a runnable command").option("--no-notes","Show only items that have no notes").option("--no-learnings","Show only items that have no learnings").option("--no-files","Show only items that have no linked files").option("--filter-files-missing","Alias for --no-files").option("--no-docs","Show only items that have no linked docs").option("--filter-docs-missing","Alias for --no-docs").option("--no-tests","Show only items that have no linked tests").option("--no-comments","Show only items that have no comments").option("--no-deps","Show only items that have no dependencies").option("--empty-body","Show only items with an empty body").option("--no-linked-command","Show only items whose linked tests carry no runnable command").option("--filter-reviewer-missing","Show only items missing reviewer").option("--filter-risk-missing","Show only items missing risk").option("--filter-confidence-missing","Show only items missing confidence").option("--filter-sprint-missing","Show only items missing sprint").option("--filter-release-missing","Show only items missing release")}const CANONICAL_LIST_STATUS_VARIANTS={draft:{name:"list-draft",dependencyBlocked:false},open:{name:"list-open",dependencyBlocked:false},in_progress:{name:"list-in-progress",dependencyBlocked:false},blocked:{name:"list-blocked",dependencyBlocked:true},closed:{name:"list-closed",dependencyBlocked:false},canceled:{name:"list-canceled",dependencyBlocked:false}};function resolveRegisteredListOutputContext(options,globalOptions){const streamMode=options.stream===true;const listFormat=parseListFormat(options.format);const tabular=listFormat==="csv"||listFormat==="table";const effectiveGlobal=listFormat==="json"||listFormat==="ndjson"||listFormat==="toon"?resolveReadCommandOutputFormat("List",options.format,globalOptions,true):globalOptions;if(streamMode&&!effectiveGlobal.json){throw new PmCliError("--stream requires --json output mode.",EXIT_CODE.USAGE)}if((tabular||listFormat==="ndjson")&&streamMode){throw new PmCliError("--format csv|table|ndjson cannot be combined with --stream.",EXIT_CODE.USAGE)}return{streamMode,listFormat,effectiveGlobal}}function renderRegisteredListResult(commandName,result,output){if(output.listFormat==="csv"||output.listFormat==="table"){setActiveCommandResult(result);const rows=result.items;const rendered=output.listFormat==="csv"?renderRowsAsCsv(rows):renderRowsAsTable(rows);if(!output.effectiveGlobal.quiet&&rendered.length>0){writeStdout(`${rendered}
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]="97243d51-f8e3-5996-85e9-49d7aac8e77c")}catch(e2){}})();import{EXIT_CODE,PmCliError,readSettings,renderRowsAsCsv,renderRowsAsTable,resolvePmRoot}from"../sdk/runtime-primitives.js";import{renderPmCommandAliasMigrationHint,resolvePmCommandAlias}from"../sdk/cli-contracts.js";import{EVAL_QUERY_SET_SCHEMA_ID}from"../sdk/eval.js";import{applyContextIntentProjection}from"../sdk/context-intent-contracts.js";import{renderPmClosedDomainHelp}from"../sdk/agent/closed-domain-contracts.js";import{serializeNdjsonRows,serializeNdjsonStream}from"../sdk/output.js";import{listMutationEvents,subscribeMutationEventBatches,subscribeMutationEvents}from"../sdk/mutation-events.js";import{registerHistoryActivityCommand}from"./register-history-activity.js";import{registerHistoryMaintenanceCommands}from"./register-history-maintenance.js";import{runAggregate}from"./commands/aggregate.js";import{renderContextMarkdown,runContext,resolveContextOutputFormat}from"./commands/context.js";import{runEval}from"./commands/eval.js";import{runGet}from"./commands/get.js";import{runGraph}from"./commands/graph.js";import{runHistory}from"./commands/history.js";import{runList}from"./commands/list.js";import{LIST_COMMAND_DEFAULT_PROJECTIONS}from"../sdk/query/list.js";import{renderNextMarkdown,runNext,resolveNextOutputFormat}from"./commands/next.js";import{runSearch}from"./commands/search.js";import{addHiddenOption,collect,getGlobalOptions,normalizeAggregateOptions,normalizeContextOptions,normalizeListOptions,normalizeNextOptions,normalizeSearchKeywordsInput,normalizeSearchOptions,printError,printListJsonStream,printResult,setActiveCommandResult,writeStdout}from"./registration-helpers.js";function shouldRegisterListQueryCommand(commandName,commandFilter){if(!commandFilter||commandFilter.size===0){return true}if(commandName==="context"){return commandFilter.has("context")||commandFilter.has("ctx")}return commandFilter.has(commandName)}function parseListFormat(rawFormat){if(rawFormat===void 0){return void 0}if(typeof rawFormat!=="string"){throw new PmCliError("List --format must be one of csv|table|json|ndjson|toon",EXIT_CODE.USAGE)}const normalized=rawFormat.trim().toLowerCase();if(normalized==="csv"||normalized==="table"||normalized==="json"||normalized==="ndjson"||normalized==="toon"){return normalized}throw new PmCliError("List --format must be one of csv|table|json|ndjson|toon",EXIT_CODE.USAGE)}function resolveReadCommandOutputFormat(commandLabel,rawFormat,globalOptions,allowNdjson=false){if(rawFormat===void 0){return globalOptions}if(typeof rawFormat!=="string"){throw new PmCliError(`${commandLabel} --format must be one of ${allowNdjson?"json|ndjson|toon":"json|toon"}`,EXIT_CODE.USAGE)}const normalized=rawFormat.trim().toLowerCase();if(normalized!=="json"&&(normalized!=="ndjson"||!allowNdjson)&&normalized!=="toon"){throw new PmCliError(`${commandLabel} --format must be one of ${allowNdjson?"json|ndjson|toon":"json|toon"}`,EXIT_CODE.USAGE)}if(globalOptions.json===true&&normalized==="toon"){throw new PmCliError(`${commandLabel} cannot combine --json with --format toon`,EXIT_CODE.USAGE)}return{...globalOptions,json:normalized==="json"||normalized==="ndjson"}}function applyDefaultListProjection(listOptions,commandName){if(LIST_COMMAND_DEFAULT_PROJECTIONS[commandName]==="brief"&&listOptions.includeBody!==true&&listOptions.compact!==true&&listOptions.brief!==true&&listOptions.full!==true&&listOptions.fields===void 0){listOptions.brief=true}}function registerContentAndGovernanceFilters(command){command.option("--has-notes","Show only items that have notes").option("--has-learnings","Show only items that have learnings").option("--has-files","Show only items that have linked files").option("--has-docs","Show only items that have linked docs").option("--has-tests","Show only items that have linked tests").option("--has-comments","Show only items that have comments").option("--has-deps","Show only items that have dependencies").option("--has-body","Show only items that have a non-empty body").option("--has-linked-command","Show only items whose linked tests carry a runnable command").option("--no-notes","Show only items that have no notes").option("--no-learnings","Show only items that have no learnings").option("--no-files","Show only items that have no linked files").option("--filter-files-missing","Alias for --no-files").option("--no-docs","Show only items that have no linked docs").option("--filter-docs-missing","Alias for --no-docs").option("--no-tests","Show only items that have no linked tests").option("--no-comments","Show only items that have no comments").option("--no-deps","Show only items that have no dependencies").option("--empty-body","Show only items with an empty body").option("--no-linked-command","Show only items whose linked tests carry no runnable command").option("--filter-reviewer-missing","Show only items missing reviewer").option("--filter-risk-missing","Show only items missing risk").option("--filter-confidence-missing","Show only items missing confidence").option("--filter-sprint-missing","Show only items missing sprint").option("--filter-release-missing","Show only items missing release")}const CANONICAL_LIST_STATUS_VARIANTS={draft:{name:"list-draft",dependencyBlocked:false},open:{name:"list-open",dependencyBlocked:false},in_progress:{name:"list-in-progress",dependencyBlocked:false},blocked:{name:"list-blocked",dependencyBlocked:true},closed:{name:"list-closed",dependencyBlocked:false},canceled:{name:"list-canceled",dependencyBlocked:false}};function resolveRegisteredListOutputContext(options,globalOptions){const streamMode=options.stream===true;const listFormat=parseListFormat(options.format);const tabular=listFormat==="csv"||listFormat==="table";const effectiveGlobal=listFormat==="json"||listFormat==="ndjson"||listFormat==="toon"?resolveReadCommandOutputFormat("List",options.format,globalOptions,true):globalOptions;if(streamMode&&!effectiveGlobal.json){throw new PmCliError("--stream requires --json output mode.",EXIT_CODE.USAGE)}if((tabular||listFormat==="ndjson")&&streamMode){throw new PmCliError("--format csv|table|ndjson cannot be combined with --stream.",EXIT_CODE.USAGE)}return{streamMode,listFormat,effectiveGlobal}}function renderRegisteredListResult(commandName,result,output){if(output.listFormat==="csv"||output.listFormat==="table"){setActiveCommandResult(result);const rows=result.items;const rendered=output.listFormat==="csv"?renderRowsAsCsv(rows):renderRowsAsTable(rows);if(!output.effectiveGlobal.quiet&&rendered.length>0){writeStdout(`${rendered}
2
2
  `)}}else if(output.listFormat==="ndjson"){setActiveCommandResult(result);const rendered=serializeNdjsonRows(result.items);if(!output.effectiveGlobal.quiet&&rendered.length>0){writeStdout(`${rendered}
3
- `)}}else if(output.streamMode){printListJsonStream(commandName,result,output.effectiveGlobal)}else{printResult(result,output.effectiveGlobal)}}async function runRegisteredListCommand(params){const parsedGlobalOptions=getGlobalOptions(params.actionCommand);const globalOptions=params.aliasContract?{...parsedGlobalOptions,command:params.aliasContract.canonical}:parsedGlobalOptions;const startedAt=Date.now();if(params.aliasContract?.lifecycle==="deprecated"){const deprecationHints=await readSettings(resolvePmRoot(process.cwd(),globalOptions.path)).then(settings=>settings.ux.deprecation_hints);if(deprecationHints){printError(renderPmCommandAliasMigrationHint(params.aliasContract))}}const intentOptions=applyContextIntentProjection("list",params.options);const listOptions=normalizeListOptions(intentOptions);const selection=resolveRegisteredListSelection(params,listOptions);const{effectiveName,effectiveStatus,effectiveDependencyBlocked,effectiveExcludeTerminal}=selection;applyDefaultListProjection(listOptions,effectiveName);Object.assign(listOptions,{projectionCommand:effectiveName});if(effectiveExcludeTerminal)listOptions.excludeTerminal=true;listOptions.dependencyBlocked=effectiveDependencyBlocked;const output=resolveRegisteredListOutputContext(intentOptions,globalOptions);const result=await runList(effectiveDependencyBlocked?void 0:effectiveStatus,listOptions,globalOptions);renderRegisteredListResult("list",result,output);if(globalOptions.profile){printError(`profile:command=list took_ms=${Date.now()-startedAt}`)}}function resolveRegisteredListSelection(params,listOptions){let effectiveName=params.name;let effectiveStatus=params.status;let effectiveDependencyBlocked=params.dependencyBlocked===true;let effectiveExcludeTerminal=params.excludeTerminal===true;const requestedStatus=listOptions.status?.trim().toLowerCase();const requestedVariant=params.name==="list"&&requestedStatus!==void 0?CANONICAL_LIST_STATUS_VARIANTS[requestedStatus]:void 0;if(params.name==="list"){if(params.options.all===true||requestedStatus==="all"){effectiveName="list-all";effectiveExcludeTerminal=false;listOptions.status=void 0}else if(requestedStatus!==void 0&&requestedVariant!==void 0){effectiveName=requestedVariant.name;effectiveStatus=requestedStatus;effectiveDependencyBlocked=requestedVariant.dependencyBlocked;effectiveExcludeTerminal=false;listOptions.status=void 0}}if(effectiveName==="list-open"||effectiveName==="list-in-progress"){listOptions.lifecycleBucket=effectiveName==="list-open"?"open":"in_progress";effectiveStatus=void 0}return{effectiveName,effectiveStatus,effectiveDependencyBlocked,effectiveExcludeTerminal}}function registerListCommand(program,descriptor){const{name,description,status,excludeTerminal,allowStatusFilter,dependencyBlocked,aliasContract}=descriptor;const command=program.command(name,{hidden:aliasContract?.hidden===true}).description(description);if(allowStatusFilter){command.option("--status <value>","Filter by status (repeatable or comma-separated; matches any; all selects every status)",collect)}if(name==="list"){command.option("--all","Include every lifecycle status")}command.option("--for <intent>",`Apply a declared context intent projection. ${renderPmClosedDomainHelp("list","--for")}`).option("--token-budget <n>","Override the selected intent's maximum estimated output tokens").option("--type <value>","Filter by item type (repeatable or comma-separated; matches any)",collect).option("--tag <value>","Filter by tag (repeatable or comma-separated; matches any)",collect).option("--priority <value>","Filter by priority (repeatable or comma-separated; matches any)",collect).option("--deadline-before <value>","Filter by deadline upper bound (ISO/date string or relative)").option("--deadline-after <value>","Filter by deadline lower bound (ISO/date string or relative)").option("--today","Filter to items updated since local midnight today").option("--recent","Filter to items updated in the last 7 days").option("--updated-after <value>",'Filter by updated_at lower bound: ISO timestamp or signed relative (e.g. "-2h"/"-7d" for the past). "Changed since my last window" \u2192 --updated-after <ISO>').option("--updated-before <value>","Filter by updated_at upper bound: ISO timestamp or signed relative (-2h/+1d)").option("--created-after <value>","Filter by created_at lower bound: ISO timestamp or signed relative (-2h/+1d)").option("--created-before <value>","Filter by created_at upper bound: ISO timestamp or signed relative (-2h/+1d)").option("--ids <value>","Filter by explicit item IDs (comma-separated or repeatable)").option("--assignee <value>","Filter by assignee",collect).option("--assignee-filter <value>","Filter assignee presence: assigned|unassigned").option("--parent <value>","Filter by parent item ID").option("--sprint <value>","Filter by sprint",collect).option("--release <value>","Filter by release",collect).option("--filter-ac-missing","Show only items missing acceptance_criteria").option("--filter-estimates-missing","Show only items missing estimated_minutes").option("--filter-resolution-missing","Show only terminal items missing resolution").option("--filter-metadata-missing","Show only items missing any tracked metadata (AC, estimate, or resolution)").option("--limit <n>","Limit returned item count").option("--offset <n>","Skip the first n matching rows before limit is applied").option("--after <cursor>","Continue after an opaque next_cursor from a previous list response").option("--no-truncate","Return every matched row after the explicit status and field filters").option("--include-body","Include item body in each returned list row").option("--strict-read","Fail closed if any item document or item directory cannot be read").option("--compact","Render compact list projection fields (mutually exclusive with --brief/--full/--fields)").option("--brief","Ultra-compact output: id, status, type, title only (agent-optimized, mutually exclusive with --compact/--full/--fields)").option("--full","Render full list projection fields (mutually exclusive with --compact/--brief/--fields)").option("--fields <value>",`Render custom comma-separated list fields (mutually exclusive with --compact/--brief/--full). ${renderPmClosedDomainHelp(name,"--fields")}`).option("--sort <value>","Sort field: priority|deadline|updated_at|created_at|title|parent (aliases: updated, created)").option("--order <value>","Sort order: asc|desc (requires --sort)").option("--tree","Render rows in parent/child tree order").option("--tree-depth <n>","Maximum recursion depth with --tree (0 keeps root rows only)").option("--format <value>","Output render mode: csv|table (human export) or json|ndjson|toon (machine output override)").option("--stream","Emit line-delimited JSON rows (requires --json)");registerContentAndGovernanceFilters(command);command.action(async(options,actionCommand)=>{await runRegisteredListCommand({name,status,excludeTerminal,dependencyBlocked,options,actionCommand,aliasContract})});addHiddenOption(command,"--tags <value>","Alias for --tag");addHiddenOption(command,"--assignee_filter <value>","Alias for --assignee-filter");addHiddenOption(command,"--tree_depth <n>","Alias for --tree-depth");addHiddenOption(command,"--token_budget <n>","Alias for --token-budget");addHiddenOption(command,"--filter-estimate-missing","Alias for --filter-estimates-missing")}async function runAggregateAction(options,command){const globalOptions=getGlobalOptions(command);const startedAt=Date.now();const result=await runAggregate(normalizeAggregateOptions(options),globalOptions);printResult(result,globalOptions);if(globalOptions.profile){printError(`profile:command=aggregate took_ms=${Date.now()-startedAt}`)}}async function runContextAction(options,actionCommand){const globalOptions=getGlobalOptions(actionCommand);const startedAt=Date.now();const normalized=normalizeContextOptions(applyContextIntentProjection("context",options));const result=await runContext(normalized,globalOptions);const outputFormat=resolveContextOutputFormat(normalized,globalOptions);if(outputFormat==="markdown"){if(!globalOptions.quiet){writeStdout(`${renderContextMarkdown(result)}
3
+ `)}}else if(output.streamMode){printListJsonStream(commandName,result,output.effectiveGlobal)}else{printResult(result,output.effectiveGlobal)}}async function runRegisteredListCommand(params){const parsedGlobalOptions=getGlobalOptions(params.actionCommand);const globalOptions=params.aliasContract?{...parsedGlobalOptions,command:params.aliasContract.canonical}:parsedGlobalOptions;const startedAt=Date.now();if(params.aliasContract?.lifecycle==="deprecated"){const deprecationHints=await readSettings(resolvePmRoot(process.cwd(),globalOptions.path)).then(settings=>settings.ux.deprecation_hints);if(deprecationHints){printError(renderPmCommandAliasMigrationHint(params.aliasContract))}}const intentOptions=applyContextIntentProjection("list",params.options);const listOptions=normalizeListOptions(intentOptions);const selection=resolveRegisteredListSelection(params,listOptions);const{effectiveName,effectiveStatus,effectiveDependencyBlocked,effectiveExcludeTerminal}=selection;applyDefaultListProjection(listOptions,effectiveName);Object.assign(listOptions,{projectionCommand:effectiveName});if(effectiveExcludeTerminal)listOptions.excludeTerminal=true;listOptions.dependencyBlocked=effectiveDependencyBlocked;const output=resolveRegisteredListOutputContext(intentOptions,globalOptions);const result=await runList(effectiveDependencyBlocked?void 0:effectiveStatus,listOptions,globalOptions);renderRegisteredListResult("list",result,output);if(globalOptions.profile){printError(`profile:command=list took_ms=${Date.now()-startedAt}`)}}function resolveRegisteredListSelection(params,listOptions){let effectiveName=params.name;let effectiveStatus=params.status;let effectiveDependencyBlocked=params.dependencyBlocked===true;let effectiveExcludeTerminal=params.excludeTerminal===true;const requestedStatus=listOptions.status?.trim().toLowerCase();const requestedVariant=params.name==="list"&&requestedStatus!==void 0?CANONICAL_LIST_STATUS_VARIANTS[requestedStatus]:void 0;if(params.name==="list"){if(params.options.all===true||requestedStatus==="all"){effectiveName="list-all";effectiveExcludeTerminal=false;listOptions.status=void 0}else if(requestedStatus!==void 0&&requestedVariant!==void 0){effectiveName=requestedVariant.name;effectiveStatus=requestedStatus;effectiveDependencyBlocked=requestedVariant.dependencyBlocked;effectiveExcludeTerminal=false;listOptions.status=void 0}}if(effectiveName==="list-open"||effectiveName==="list-in-progress"){listOptions.lifecycleBucket=effectiveName==="list-open"?"open":"in_progress";effectiveStatus=void 0}return{effectiveName,effectiveStatus,effectiveDependencyBlocked,effectiveExcludeTerminal}}function registerListCommand(program,descriptor){const{name,description,status,excludeTerminal,allowStatusFilter,dependencyBlocked,aliasContract}=descriptor;const command=program.command(name,{hidden:aliasContract?.hidden===true}).description(description);if(allowStatusFilter){command.option("--status <value>","Filter by status (repeatable or comma-separated; matches any; all selects every status)",collect)}if(name==="list"){command.option("--all","Include every lifecycle status")}command.option("--for <intent>",`Apply a declared context intent projection. ${renderPmClosedDomainHelp("list","--for")}`).option("--token-budget <n>","Override the selected intent's maximum estimated output tokens").option("--type <value>","Filter by item type (repeatable or comma-separated; matches any)",collect).option("--tag <value>","Filter by tag (repeatable or comma-separated; matches any)",collect).option("--priority <value>","Filter by priority (repeatable or comma-separated; matches any)",collect).option("--deadline-before <value>","Filter by deadline upper bound (ISO/date string or relative)").option("--deadline-after <value>","Filter by deadline lower bound (ISO/date string or relative)").option("--today","Filter to items updated since local midnight today").option("--recent","Filter to items updated in the last 7 days").option("--updated-after <value>","Updated since ISO timestamp or signed relative (-2h/-7d for past); use last-window ISO").option("--updated-before <value>","Filter by updated_at upper bound: ISO timestamp or signed relative (-2h/+1d)").option("--created-after <value>","Filter by created_at lower bound: ISO timestamp or signed relative (-2h/+1d)").option("--created-before <value>","Filter by created_at upper bound: ISO timestamp or signed relative (-2h/+1d)").option("--ids <value>","Filter by explicit item IDs (comma-separated or repeatable)").option("--assignee <value>","Filter by assignee",collect).option("--assignee-filter <value>","Filter assignee presence: assigned|unassigned").option("--parent <value>","Filter by parent item ID").option("--sprint <value>","Filter by sprint",collect).option("--release <value>","Filter by release",collect).option("--filter-ac-missing","Show only items missing acceptance_criteria").option("--filter-estimates-missing","Show only items missing estimated_minutes").option("--filter-resolution-missing","Show only terminal items missing resolution").option("--filter-metadata-missing","Show only items missing any tracked metadata (AC, estimate, or resolution)").option("--limit <n>","Alias for --output-limit; --output-budget may cap rows").option("--offset <n>","Skip the first n matching rows before limit is applied").option("--after <cursor>","Continue after an opaque next_cursor from a previous list response").option("--no-truncate","Return every matched row after the explicit status and field filters").option("--include-body","Include item body in each returned list row").option("--strict-read","Fail closed if any item document or item directory cannot be read").option("--compact","Render compact list projection fields (mutually exclusive with --brief/--full/--fields)").option("--brief","Ultra-compact output: id, status, type, title only (agent-optimized, mutually exclusive with --compact/--full/--fields)").option("--full","Render full list projection fields (mutually exclusive with --compact/--brief/--fields)").option("--fields <value>",`Render custom comma-separated list fields (mutually exclusive with --compact/--brief/--full). ${renderPmClosedDomainHelp(name,"--fields")}`).option("--sort <value>","Sort field: priority|deadline|updated_at|created_at|title|parent (aliases: updated, created)").option("--order <value>","Sort order: asc|desc (requires --sort)").option("--tree","Render rows in parent/child tree order").option("--tree-depth <n>","Maximum recursion depth with --tree (0 keeps root rows only)").option("--format <value>","Output render mode: csv|table (human export) or json|ndjson|toon (machine output override)").option("--stream","Emit line-delimited JSON rows (requires --json)");registerContentAndGovernanceFilters(command);command.action(async(options,actionCommand)=>{await runRegisteredListCommand({name,status,excludeTerminal,dependencyBlocked,options,actionCommand,aliasContract})});addHiddenOption(command,"--tags <value>","Alias for --tag");addHiddenOption(command,"--assignee_filter <value>","Alias for --assignee-filter");addHiddenOption(command,"--tree_depth <n>","Alias for --tree-depth");addHiddenOption(command,"--token_budget <n>","Alias for --token-budget");addHiddenOption(command,"--filter-estimate-missing","Alias for --filter-estimates-missing")}async function runAggregateAction(options,command){const globalOptions=getGlobalOptions(command);const startedAt=Date.now();const result=await runAggregate(normalizeAggregateOptions(options),globalOptions);printResult(result,globalOptions);if(globalOptions.profile){printError(`profile:command=aggregate took_ms=${Date.now()-startedAt}`)}}async function runContextAction(options,actionCommand){const globalOptions=getGlobalOptions(actionCommand);const startedAt=Date.now();const normalized=normalizeContextOptions(applyContextIntentProjection("context",options));const result=await runContext(normalized,globalOptions);const outputFormat=resolveContextOutputFormat(normalized,globalOptions);if(outputFormat==="markdown"){if(!globalOptions.quiet){writeStdout(`${renderContextMarkdown(result)}
4
4
  `)}}else if(outputFormat==="ndjson"){setActiveCommandResult(result);const rendered=serializeNdjsonRows([...result.high_level,...result.low_level,...result.blocked_fallback]);if(!globalOptions.quiet&&rendered.length>0){writeStdout(`${rendered}
5
5
  `)}}else{printResult(result,{...globalOptions,json:outputFormat==="json"})}if(globalOptions.profile){printError(`profile:command=context took_ms=${Date.now()-startedAt}`)}}async function runNextAction(options,actionCommand){const globalOptions=getGlobalOptions(actionCommand);const startedAt=Date.now();const nextOptions=normalizeNextOptions(applyContextIntentProjection("next",options));const result=await runNext(nextOptions,globalOptions);const outputFormat=resolveNextOutputFormat(nextOptions,globalOptions);if(outputFormat==="markdown"){if(!globalOptions.quiet){writeStdout(`${renderNextMarkdown(result)}
6
- `)}}else{printResult(result,{...globalOptions,json:outputFormat==="json"})}if(globalOptions.profile){printError(`profile:command=next took_ms=${Date.now()-startedAt}`)}}async function runSearchAction(keywords,options,command){const globalOptions=getGlobalOptions(command);const startedAt=Date.now();const query=normalizeSearchKeywordsInput(keywords);const intentOptions=applyContextIntentProjection("search",options,[query]);const searchOptions=normalizeSearchOptions(intentOptions);const result=await runSearch(query,{...searchOptions,mode:typeof searchOptions.mode==="string"&&searchOptions.mode.trim().length>0?searchOptions.mode:"keyword"},globalOptions);const outputFormat=typeof intentOptions.format==="string"?intentOptions.format.trim().toLowerCase():void 0;const effectiveGlobal=resolveReadCommandOutputFormat("Search",intentOptions.format,globalOptions,true);if(outputFormat==="ndjson"){setActiveCommandResult(result);const rendered=serializeNdjsonRows(result.items);if(!effectiveGlobal.quiet&&rendered.length>0){writeStdout(`${rendered}
6
+ `)}}else{printResult(result,{...globalOptions,json:outputFormat==="json"})}if(globalOptions.profile){printError(`profile:command=next took_ms=${Date.now()-startedAt}`)}}async function runSearchAction(keywords,options,command){const globalOptions=getGlobalOptions(command);const startedAt=Date.now();const query=normalizeSearchKeywordsInput(keywords);const intentOptions=applyContextIntentProjection("search",options,[query]);const searchOptions=normalizeSearchOptions(intentOptions);const result=await runSearch(query,searchOptions,globalOptions);const outputFormat=typeof intentOptions.format==="string"?intentOptions.format.trim().toLowerCase():void 0;const effectiveGlobal=resolveReadCommandOutputFormat("Search",intentOptions.format,globalOptions,true);if(outputFormat==="ndjson"){setActiveCommandResult(result);const rendered=serializeNdjsonRows(result.items);if(!effectiveGlobal.quiet&&rendered.length>0){writeStdout(`${rendered}
7
7
  `)}}else{printResult(result,effectiveGlobal)}if(globalOptions.profile){printError(`profile:command=search took_ms=${Date.now()-startedAt}`)}}async function runEvalAction(options,command){const globalOptions=getGlobalOptions(command);const startedAt=Date.now();const result=await runEval({mode:typeof options.mode==="string"?options.mode:void 0,k:typeof options.k==="string"?options.k:void 0,failUnder:typeof options.failUnder==="string"?options.failUnder:void 0,queries:typeof options.queries==="string"?options.queries:void 0,format:typeof options.format==="string"?options.format:void 0},globalOptions);printResult(result,resolveReadCommandOutputFormat("Eval",options.format,globalOptions));if(globalOptions.profile){printError(`profile:command=eval took_ms=${Date.now()-startedAt}`)}if(!result.passed){throw new PmCliError(`Eval gate failed: aggregate nDCG@${result.k} ${result.aggregate.ndcg} is below --fail-under ${result.fail_under}`,EXIT_CODE.GENERIC_FAILURE)}}async function runGetAction(id,options,command){const globalOptions=getGlobalOptions(command);const startedAt=Date.now();const intentOptions=applyContextIntentProjection("get",options,[id]);const result=await runGet(id,globalOptions,{depth:typeof intentOptions.depth==="string"?intentOptions.depth:void 0,fields:typeof intentOptions.fields==="string"?intentOptions.fields:void 0,full:Boolean(intentOptions.full),tree:intentOptions.tree===true,treeDepth:typeof intentOptions.treeDepth==="string"?intentOptions.treeDepth:typeof intentOptions.tree_depth==="string"?intentOptions.tree_depth:void 0,at:typeof intentOptions.at==="string"?intentOptions.at:void 0});printResult(result,resolveReadCommandOutputFormat("Get",intentOptions.format,globalOptions));if(globalOptions.profile){printError(`profile:command=get took_ms=${Date.now()-startedAt}`)}}async function runHistoryAction(id,options,command){const globalOptions=getGlobalOptions(command);const startedAt=Date.now();if([options.compact,options.raw,options.full,options.provenance].filter(value=>value===true).length>1){throw new PmCliError("History projection options are mutually exclusive. Use --compact, --provenance, or --full.",EXIT_CODE.USAGE)}const field=typeof options.field==="string"?options.field:void 0;const strictExit=Boolean(options.strictExit)||Boolean(options.failOnWarn);if(strictExit&&!options.verify){throw new PmCliError("--strict-exit requires --verify (it gates on the verification result).",EXIT_CODE.USAGE)}const result=await runHistory(id,{limit:typeof options.limit==="string"?options.limit:void 0,compact:options.full===true||options.provenance===true?false:true,provenance:options.provenance===true,provenanceSummary:options.provenanceSummary===true,harness:readRepeatableStringOption(options,"harness"),agentInstance:readRepeatableStringOption(options,"agentInstance"),provenanceFilter:readRepeatableStringOption(options,"provenanceFilter"),diff:Boolean(options.diff)||field!==void 0,field,verify:Boolean(options.verify)},globalOptions);printResult(result,resolveReadCommandOutputFormat("History",options.format,globalOptions));if(strictExit&&result.verification&&!result.verification.ok){process.exitCode=EXIT_CODE.GENERIC_FAILURE}if(globalOptions.profile){printError(`profile:command=history took_ms=${Date.now()-startedAt}`)}}function readRepeatableStringOption(options,key){const value=options[key];return Array.isArray(value)?value:void 0}function buildMutationEventOptions(options,pmRoot){const harness=readRepeatableStringOption(options,"harness");const agentInstance=readRepeatableStringOption(options,"agentInstance");const provenanceFilter=readRepeatableStringOption(options,"provenanceFilter");const rawCursorMode=typeof options.cursorMode==="string"?options.cursorMode:void 0;if(rawCursorMode!==void 0&&rawCursorMode!=="batch"&&rawCursorMode!=="row"){throw new PmCliError("Events --cursor-mode must be batch or row.",EXIT_CODE.USAGE,{code:"invalid_event_cursor_mode"})}const cursorMode=rawCursorMode;return{pmRoot,since:typeof options.since==="string"?options.since:void 0,type:readRepeatableStringOption(options,"type"),author:readRepeatableStringOption(options,"author"),item:readRepeatableStringOption(options,"item"),limit:typeof options.limit==="string"?Number(options.limit):void 0,full:options.full===true,...options.provenance===true?{provenance:true}:{},...options.provenanceSummary===true?{provenanceSummary:true}:{},...harness===void 0?{}:{harness},...agentInstance===void 0?{}:{agentInstance},...provenanceFilter===void 0?{}:{provenanceFilter},cursorMode}}async function followMutationEvents(eventOptions,options,quiet){if(options.provenanceSummary===true){throw new PmCliError("Events --provenance-summary is bounded to one page and cannot be combined with --follow.",EXIT_CODE.USAGE)}const intervalMs=typeof options.intervalMs==="string"?Number(options.intervalMs):void 0;if(eventOptions.cursorMode==="row"){for await(const event of subscribeMutationEvents({...eventOptions,intervalMs})){if(!quiet){writeStdout(`${JSON.stringify(event)}
8
8
  `)}}return}for await(const page of subscribeMutationEventBatches({...eventOptions,intervalMs})){if(!quiet){writeStdout(`${serializeNdjsonStream(page.events,{count:page.count,has_more:page.has_more,next_cursor:page.next_cursor??null,source:page.source,heartbeat:page.count===0})}
9
9
  `)}}}function renderMutationEventPage(page){if(page.cursor_mode==="row"){return serializeNdjsonRows(page.events)}return serializeNdjsonStream(page.events,{count:page.count,has_more:page.has_more,next_cursor:page.next_cursor??null,source:page.source,...page.provenance_summary===void 0?{}:{provenance_summary:page.provenance_summary}})}async function runEventsAction(options,command){const globalOptions=getGlobalOptions(command);const startedAt=Date.now();const eventOptions=buildMutationEventOptions(options,globalOptions.path);if(options.follow===true){await followMutationEvents(eventOptions,options,globalOptions.quiet===true);return}const page=await listMutationEvents(eventOptions);setActiveCommandResult(page);if(globalOptions.json){printResult(page,globalOptions);if(globalOptions.profile){printError(`profile:command=events took_ms=${Date.now()-startedAt}`)}return}const rendered=renderMutationEventPage(page);if(!globalOptions.quiet&&rendered.length>0){writeStdout(`${rendered}
10
- `)}if(globalOptions.profile){printError(`profile:command=events took_ms=${Date.now()-startedAt}`)}}async function runGraphAction(subcommand,id,target,options,command){const globalOptions=getGlobalOptions(command);const startedAt=Date.now();const result=await runGraph(subcommand,id,target,{...Array.isArray(options.kind)?{kind:options.kind}:{},maxDepth:typeof options.maxDepth==="string"?options.maxDepth:void 0,limit:typeof options.limit==="string"?options.limit:void 0,after:typeof options.after==="string"?options.after:void 0,direction:typeof options.direction==="string"?options.direction:void 0,maxPaths:typeof options.maxPaths==="string"?options.maxPaths:void 0,sample:typeof options.sample==="string"?options.sample:void 0,...Array.isArray(options.exemptIsolate)?{exemptIsolate:options.exemptIsolate}:{},...Array.isArray(options.exemptIsolateType)?{exemptIsolateType:options.exemptIsolateType}:{},saveBaseline:options.saveBaseline===true,rebuild:options.rebuild===true,clear:options.clear===true,summary:options.summary===true,full:options.full===true},globalOptions);printResult(result,globalOptions);if(globalOptions.profile){printError(`profile:command=graph took_ms=${Date.now()-startedAt}`)}}function registerListQueryCommands(program,options){const commandFilter=options?.commandFilter;const shouldRegister=commandName=>shouldRegisterListQueryCommand(commandName,commandFilter);const listCommandDescriptors=[{name:"list",description:"List active items with optional lifecycle-status and project filters.",excludeTerminal:true,allowStatusFilter:true},{name:"list-all",description:"List all items with optional filters.",excludeTerminal:false,allowStatusFilter:true},{name:"list-draft",description:"List draft items with optional filters.",status:"draft"},{name:"list-open",description:"List open items with optional filters.",status:"open",excludeTerminal:false,allowStatusFilter:false},{name:"list-in-progress",description:"List in-progress items with optional filters.",status:"in_progress",excludeTerminal:false,allowStatusFilter:false},{name:"list-blocked",description:"List blocked items (blocked status or open blocked_by dependencies, matching pm next) with optional filters.",dependencyBlocked:true,excludeTerminal:false,allowStatusFilter:false},{name:"list-closed",description:"List closed items with optional filters.",status:"closed"},{name:"list-canceled",description:"List canceled items with optional filters.",status:"canceled"}];for(const descriptor of listCommandDescriptors){if(shouldRegister(descriptor.name)){const aliasContract=resolvePmCommandAlias(descriptor.name);registerListCommand(program,{...descriptor,...aliasContract?.registration==="commander"?{aliasContract}:{}})}}if(shouldRegister("aggregate")){const aggregateCommand=program.command("aggregate").description("Group item counts and numeric measures.").option("--set-mode <value>","Set grouping: element (default)|tuple").option("--limit <value>","Group page size (default: 50)").option("--after <value>","Continue with next_after cursor").option("--group-by <value>","Fields: parent,type,priority,status,assignee,tags,sprint,release (comma-separated)").option("--count","Counts (default)").option("--completion","Status counts and completion_pct").option("--sum <field>","Group numeric sum").option("--avg <field>","Group numeric average").option("--include-unparented","Keep unparented group").option("--status <value>","Item status").option("--type <value>","Item type").option("--tag <value>","Filter by tag").option("--priority <value>","Filter by priority").option("--deadline-before <value>","Latest deadline (ISO/date or relative)").option("--deadline-after <value>","Earliest deadline (ISO/date or relative)").option("--assignee <value>","Filter by assignee").option("--assignee-filter <value>","Assignee presence: assigned|unassigned").option("--parent <value>","Parent ID").option("--sprint <value>","Filter by sprint").option("--release <value>","Filter by release");addHiddenOption(aggregateCommand,"--include_unparented","Alias for --include-unparented");addHiddenOption(aggregateCommand,"--assignee_filter <value>","Alias for --assignee-filter");aggregateCommand.action(runAggregateAction)}if(shouldRegister("context")){const contextCommand=program.command("context").alias("ctx").description("Show a token-efficient project context snapshot for next-work decisions.").option("--for <intent>",`Apply a declared context intent projection. ${renderPmClosedDomainHelp("context","--for")}`).option("--date <value>","Anchor date/time for agenda window calculations (ISO/date string or relative)").option("--from <value>","Agenda lower bound (ISO/date string or relative)").option("--to <value>","Agenda upper bound (ISO/date string or relative)").option("--past","Include past agenda entries in bounded windows").option("--type <value>","Filter by item type").option("--tag <value>","Filter by tag").option("--priority <value>","Filter by priority").option("--assignee <value>","Filter by assignee").option("--assignee-filter <value>","Filter assignee presence: assigned|unassigned").option("--sprint <value>","Filter by sprint").option("--release <value>","Filter by release").option("--parent <id>","Scope the snapshot to one item's subtree (the item plus all descendants)").option("--limit <n>","Limit focus and agenda rows per section").option("--after <cursor>","Continue ranked focus after a next_cursor from a previous context response").option("--format <value>","Context output format override: markdown|toon|json|ndjson").option("--depth <value>","Context depth: brief|standard|deep|full (full = every section, no per-section cap)").option("--section <value...>","Include specific sections (repeatable; overrides --depth)").option("--fields <value>","Project focus rows to a comma-separated field subset (e.g. id,title,priority)").option("--activity-limit <n>","Limit recent activity entries (default: settings or 10)").option("--stale-threshold <value>","Staleness cutoff in days (e.g. 7 or 7d; default: settings or 7)").option("--explain-ranking","Include the scorer model, per-signal contributions, and ranked candidate ids").option("--token-budget <n>","Maximum estimated tokens spent on ranked focus rows").option("--no-extension-health","Omit the installed extension health summary").option("--no-tags","Omit tag arrays from context focus rows");addHiddenOption(contextCommand,"--assignee_filter <value>","Alias for --assignee-filter");addHiddenOption(contextCommand,"--max-items <n>","Alias for --limit");addHiddenOption(contextCommand,"--explain_ranking","Alias for --explain-ranking");addHiddenOption(contextCommand,"--token_budget <n>","Alias for --token-budget");contextCommand.action(runContextAction)}if(shouldRegister("next")){const nextCommand=program.command("next").description("Recommend the next actionable (unblocked, ready) work item with rationale + blocked companion.").option("--for <intent>",`Apply a declared context intent projection. ${renderPmClosedDomainHelp("next","--for")}`).option("--type <value>","Filter candidate items by type").option("--tag <value>","Filter candidate items by tag").option("--priority <value>","Filter candidate items by priority").option("--assignee <value>","Filter candidate items by assignee").option("--assignee-filter <value>","Filter assignee presence: assigned|unassigned").option("--sprint <value>","Filter candidate items by sprint").option("--release <value>","Filter candidate items by release").option("--parent <id>","Scope to one item's subtree (the item plus all descendants)").option("--limit <n>","Limit ready rows (default: 5; non-positive falls back to default)").option("--blocked-limit <n>","Limit blocked rows (default: same as --limit)").option("--ready-only","Omit the blocked companion list").option("--include-decisions","Include human-gated Decision items in the claimable ready queue").option("--include-gates","Include outcome gates in the ready queue").option("--include-containers","Include containers with unfinished descendants in the ready queue").option("--format <value>","Next output format override: markdown|toon|json").option("--explain-ranking","Include the scorer model, per-signal contributions, and ranked ready ids").option("--token-budget <n>","Maximum estimated tokens spent on the ranked ready queue");addHiddenOption(nextCommand,"--assignee_filter <value>","Alias for --assignee-filter");addHiddenOption(nextCommand,"--blocked_limit <n>","Alias for --blocked-limit");addHiddenOption(nextCommand,"--ready_only","Alias for --ready-only");addHiddenOption(nextCommand,"--explain_ranking","Alias for --explain-ranking");addHiddenOption(nextCommand,"--token_budget <n>","Alias for --token-budget");nextCommand.action(runNextAction)}if(shouldRegister("search")){const searchCommand=program.command("search").argument("<keywords...>","Keyword query tokens").description("Search items with keyword, semantic, or hybrid retrieval. Inline field:value tokens (tag:/status:/type:/priority:) in the query are parsed as filters, e.g. 'auth tag:area:search status:open'.").option("--for <intent>",`Apply a declared context intent projection. ${renderPmClosedDomainHelp("search","--for")}`).option("--token-budget <n>","Override the selected intent's maximum estimated output tokens").option("--mode <value>","Search mode: keyword|semantic|hybrid (default: keyword)").option("--semantic","Shorthand for --mode semantic").option("--hybrid","Shorthand for --mode hybrid").option("--match-mode <value>","Token match mode: and|or|exact (default: or with all-terms ranking bonus; and = hard-require every token; exact = exact phrase)").option("--min-score <value>","Per-query minimum score threshold (finite number >= 0); overrides settings search.score_threshold for this query only").option("--count","Return only the count of matching items (post-filter/threshold, pre-limit); skips hit rows").option("--semantic-weight <value>","Override hybrid semantic weight for this query (0..1); invalid values fall back to settings").option("--include-linked","Include linked files, docs, and tests in the searchable corpus").option("--title-exact","Require exact normalized title match for the full query string").option("--phrase-exact","Require exact normalized phrase match in searchable text").option("--highlight","Emit per-field matched-text snippets (wrapped in \xAB\u2026\xBB) on each hit; off by default").option("--status <value>","Filter by status before query (all, open/closed/canceled aliases, or configured status id; CSV)").option("--type <value>","Filter by item type").option("--tag <value>","Filter by tag").option("--priority <value>","Filter by priority").option("--deadline-before <value>","Filter by deadline upper bound (ISO/date string or relative)").option("--deadline-after <value>","Filter by deadline lower bound (ISO/date string or relative)").option("--updated-after <value>",'Filter by updated_at lower bound: ISO timestamp or signed relative (e.g. "-2h"/"-7d" for the past)').option("--updated-before <value>","Filter by updated_at upper bound: ISO timestamp or signed relative (-2h/+1d)").option("--created-after <value>","Filter by created_at lower bound: ISO timestamp or signed relative (-2h/+1d)").option("--created-before <value>","Filter by created_at upper bound: ISO timestamp or signed relative (-2h/+1d)").option("--assignee <value>","Filter by assignee").option("--sprint <value>","Filter by sprint").option("--release <value>","Filter by release").option("--parent <value>","Filter by parent item ID").option("--compact","Render compact search hits (default; mutually exclusive with --full/--fields)").option("--full","Render full search hits with nested item payloads (mutually exclusive with --compact/--fields)").option("--fields <value>",`Render custom comma-separated search hit fields (mutually exclusive with --compact/--full). ${renderPmClosedDomainHelp("search","--fields")}`).option("--format <value>","Search output format override: json|ndjson|toon").option("--limit <n>","Limit returned item count").option("--after <cursor>","Continue after an opaque next_cursor from a previous search response");registerContentAndGovernanceFilters(searchCommand);searchCommand.action(runSearchAction);addHiddenOption(searchCommand,"--tags <value>","Alias for --tag");addHiddenOption(searchCommand,"--token_budget <n>","Alias for --token-budget")}if(shouldRegister("eval")){program.command("eval").description("Evaluate search relevance against a curated golden-query set: reports nDCG@k, MRR@k, precision@k, and recall@k per query plus the macro average. Use --fail-under as a CI gate.").option("--mode <value>","Default retrieval mode for queries without their own: keyword|semantic|hybrid (default: keyword)").option("--k <n>","Metric cutoff @k (positive integer; default: 10)").option("--fail-under <value>","Exit non-zero when aggregate nDCG@k falls below this threshold (0..1); CI gate").option("--queries <path>",`Query JSON (${EVAL_QUERY_SET_SCHEMA_ID}); default: search/eval-queries.json; errors show an example`).option("--format <value>","Eval output format override: json|toon").action(runEvalAction)}if(shouldRegister("get")){const getCommand=program.command("get").argument("<id>","Item id").option("--for <intent>",`Apply a declared context intent projection. ${renderPmClosedDomainHelp("get","--for")}`).option("--token-budget <n>","Override the selected intent's maximum estimated output tokens").option("--depth <value>","Detail depth: brief|standard|deep|full (full aliases deep; default: standard)").option("--full","Explicit full item read; equivalent to --depth deep (mutually exclusive with --depth/--fields)").option("--fields <value>",`Render custom comma-separated item metadata fields. ${renderPmClosedDomainHelp("get","--fields")}`).option("--tree","Include descendants rooted at the requested item").option("--tree-depth <n>","Maximum subtree depth for --tree descendants").option("--at <version-or-timestamp>","Reconstruct a verified historical item state without mutating it").option("--format <value>","Get output format override: json|toon").description("Show item details by ID.").action(runGetAction);addHiddenOption(getCommand,"--tree_depth <n>","Alias for --tree-depth");addHiddenOption(getCommand,"--token_budget <n>","Alias for --token-budget")}if(shouldRegister("history")){const historyCommand=program.command("history").enablePositionalOptions().argument("<id>","Item id").option("--limit <n>","Latest n entries").option("--compact","Show index, timestamp, op, author, patch count, and fields").option("--full","Full entries with JSON Patches").option("--provenance","Show authors and provenance without patches").option("--provenance-summary","Count provenance completeness").option("--harness <value>","Filter by recorded/resolved harness (repeatable)",collect).option("--agent-instance <value>","Filter agent instance (repeatable)",collect).option("--provenance-filter <dimension=value>","Filter by an exact declared provenance value (repeatable)",collect).option("--diff","Replay per-entry before/after field diffs").option("--field <name>","Filter changed field; implies --diff").option("--verify","Verify the full hash chain and replay").option("--strict-exit","With --verify, fail on integrity errors").option("--fail-on-warn","Alias for --strict-exit").option("--format <value>","Output: json|toon").description("Show item history entries.").action(runHistoryAction);registerHistoryMaintenanceCommands(historyCommand,true);registerHistoryActivityCommand(historyCommand.command("activity"))}if(shouldRegister("events")){program.command("events").option("--since <cursor-or-timestamp>","Resume strictly after a durable cursor, or include events from an ISO timestamp").option("--type <value>","Filter by mutation operation (repeatable or comma-separated)",collect).option("--author <value>","Filter by mutation author (repeatable or comma-separated)",collect).option("--item <value>","Filter by item or workspace stream id (repeatable or comma-separated)",collect).option("--limit <n>","Return at most 1,000 events (default: 100)").option("--cursor-mode <mode>","Cursor framing: batch emits one terminal trailer (default); row preserves one cursor per event").option("--full","Include each complete authoritative history entry").option("--provenance","Include patch-free author, harness, instance, and extensible provenance").option("--provenance-summary","Include bounded provenance completeness counts").option("--harness <value>","Filter by recorded or vocabulary-resolved harness (repeatable)",collect).option("--agent-instance <value>","Filter by privacy-safe agent instance (repeatable)",collect).option("--provenance-filter <dimension=value>","Filter by an exact declared provenance value (repeatable)",collect).option("--follow","Continue emitting committed events as newline-delimited JSON").option("--interval-ms <n>","Empty-read delay while following (minimum: 10ms; default: 250ms)").description("Emit cursor-resumable committed mutation facts as newline-delimited JSON.").action(runEventsAction)}if(shouldRegister("activity")){registerHistoryActivityCommand(program.command("activity",{hidden:true}))}if(shouldRegister("graph")){program.command("graph").argument("<subcommand>","Graph query (ancestors, descendants, predecessors, successors, paths, impact, analyze, audit, communities, redundancy, dominators, slack, centrality, articulation, plan, index)").argument("[id]","Root item id (traversals, paths, impact, and dominators)").argument("[target]","Target item id (paths only)").option("--kind <value>","Restrict traversal to registered relationship kinds (repeatable or comma-separated)",collect).option("--max-depth <value>","Maximum traversal depth (non-negative integer)").option("--limit <value>","Maximum returned rows per bounded collection").option("--after <value>","Resume a traversal after this previously returned node id").option("--direction <value>","Edge orientation for paths/impact (outgoing, incoming, or both)").option("--max-paths <value>","Maximum enumerated paths (paths only)").option("--sample <value>","Maximum evidence sample entries per audit finding (audit only)").option("--exempt-isolate <value>","Item ids treated as explicitly valid isolates by the audit (repeatable or comma-separated)",collect).option("--exempt-isolate-type <value>","Item types whose active isolates are policy-valid for the audit (repeatable or comma-separated)",collect).option("--save-baseline","Persist the audit census as the change-since-baseline comparison point (audit only)").option("--rebuild","Rebuild and warm the durable graph index (index only)").option("--clear","Delete the durable graph index (index only)").option("--summary","Return counts-first envelopes without row collections").option("--full","Return the complete graph row projection").description("Bounded workspace relationship-graph queries, analytics, and governance audit.").action(runGraphAction)}}const _testOnlyRegisterListQuery={resolveReadCommandOutputFormat,parseListFormat};export{_testOnlyRegisterListQuery,registerListQueryCommands};
10
+ `)}if(globalOptions.profile){printError(`profile:command=events took_ms=${Date.now()-startedAt}`)}}async function runGraphAction(subcommand,id,target,options,command){const globalOptions=getGlobalOptions(command);const startedAt=Date.now();const result=await runGraph(subcommand,id,target,{...Array.isArray(options.kind)?{kind:options.kind}:{},maxDepth:typeof options.maxDepth==="string"?options.maxDepth:void 0,limit:typeof options.limit==="string"?options.limit:void 0,after:typeof options.after==="string"?options.after:void 0,direction:typeof options.direction==="string"?options.direction:void 0,maxPaths:typeof options.maxPaths==="string"?options.maxPaths:void 0,sample:typeof options.sample==="string"?options.sample:void 0,...Array.isArray(options.exemptIsolate)?{exemptIsolate:options.exemptIsolate}:{},...Array.isArray(options.exemptIsolateType)?{exemptIsolateType:options.exemptIsolateType}:{},saveBaseline:options.saveBaseline===true,rebuild:options.rebuild===true,clear:options.clear===true,summary:options.summary===true,full:options.full===true},globalOptions);printResult(result,globalOptions);if(globalOptions.profile){printError(`profile:command=graph took_ms=${Date.now()-startedAt}`)}}function registerListQueryCommands(program,options){const commandFilter=options?.commandFilter;const shouldRegister=commandName=>shouldRegisterListQueryCommand(commandName,commandFilter);const listCommandDescriptors=[{name:"list",description:"List active items with optional lifecycle-status and project filters.",excludeTerminal:true,allowStatusFilter:true},{name:"list-all",description:"List all items with optional filters.",excludeTerminal:false,allowStatusFilter:true},{name:"list-draft",description:"List draft items with optional filters.",status:"draft"},{name:"list-open",description:"List open items with optional filters.",status:"open",excludeTerminal:false,allowStatusFilter:false},{name:"list-in-progress",description:"List in-progress items with optional filters.",status:"in_progress",excludeTerminal:false,allowStatusFilter:false},{name:"list-blocked",description:"List blocked items (blocked status or open blocked_by dependencies, matching pm next) with optional filters.",dependencyBlocked:true,excludeTerminal:false,allowStatusFilter:false},{name:"list-closed",description:"List closed items with optional filters.",status:"closed"},{name:"list-canceled",description:"List canceled items with optional filters.",status:"canceled"}];for(const descriptor of listCommandDescriptors){if(shouldRegister(descriptor.name)){const aliasContract=resolvePmCommandAlias(descriptor.name);registerListCommand(program,{...descriptor,...aliasContract?.registration==="commander"?{aliasContract}:{}})}}if(shouldRegister("aggregate")){const aggregateCommand=program.command("aggregate").description("Group item counts and numeric measures.").option("--set-mode <value>","Set grouping: element (default)|tuple").option("--limit <value>","Group page size (default: 50)").option("--after <value>","Continue with next_after cursor").option("--group-by <value>","Fields: parent,type,priority,status,assignee,tags,sprint,release (comma-separated)").option("--count","Counts (default)").option("--completion","Status counts and completion_pct").option("--sum <field>","Group numeric sum").option("--avg <field>","Group numeric average").option("--include-unparented","Keep unparented group").option("--status <value>","Item status").option("--type <value>","Item type").option("--tag <value>","Filter by tag").option("--priority <value>","Filter by priority").option("--deadline-before <value>","Latest deadline (ISO/date or relative)").option("--deadline-after <value>","Earliest deadline (ISO/date or relative)").option("--assignee <value>","Filter by assignee").option("--assignee-filter <value>","Assignee presence: assigned|unassigned").option("--parent <value>","Parent ID").option("--sprint <value>","Filter by sprint").option("--release <value>","Filter by release");addHiddenOption(aggregateCommand,"--include_unparented","Alias for --include-unparented");addHiddenOption(aggregateCommand,"--assignee_filter <value>","Alias for --assignee-filter");aggregateCommand.action(runAggregateAction)}if(shouldRegister("context")){const contextCommand=program.command("context").alias("ctx").description("Show a token-efficient project context snapshot for next-work decisions.").option("--for <intent>",`Apply a declared context intent projection. ${renderPmClosedDomainHelp("context","--for")}`).option("--date <value>","Anchor date/time for agenda window calculations (ISO/date string or relative)").option("--from <value>","Agenda lower bound (ISO/date string or relative)").option("--to <value>","Agenda upper bound (ISO/date string or relative)").option("--past","Include past agenda entries in bounded windows").option("--type <value>","Filter by item type").option("--tag <value>","Filter by tag").option("--priority <value>","Filter by priority").option("--assignee <value>","Filter by assignee").option("--assignee-filter <value>","Filter assignee presence: assigned|unassigned").option("--sprint <value>","Filter by sprint").option("--release <value>","Filter by release").option("--parent <id>","Scope the snapshot to one item's subtree (the item plus all descendants)").option("--limit <n>","Limit focus and agenda rows per section").option("--after <cursor>","Continue ranked focus after a next_cursor from a previous context response").option("--format <value>","Context output format override: markdown|toon|json|ndjson").option("--depth <value>","Context depth: brief|standard|deep|full (full = every section, no per-section cap)").option("--section <value...>","Include specific sections (repeatable; overrides --depth)").option("--fields <value>","Project focus rows to a comma-separated field subset (e.g. id,title,priority)").option("--activity-limit <n>","Limit recent activity entries (default: settings or 10)").option("--stale-threshold <value>","Staleness cutoff in days (e.g. 7 or 7d; default: settings or 7)").option("--explain-ranking","Include the scorer model, per-signal contributions, and ranked candidate ids").option("--token-budget <n>","Maximum estimated tokens spent on ranked focus rows").option("--no-extension-health","Omit the installed extension health summary").option("--no-tags","Omit tag arrays from context focus rows");addHiddenOption(contextCommand,"--assignee_filter <value>","Alias for --assignee-filter");addHiddenOption(contextCommand,"--max-items <n>","Alias for --limit");addHiddenOption(contextCommand,"--explain_ranking","Alias for --explain-ranking");addHiddenOption(contextCommand,"--token_budget <n>","Alias for --token-budget");contextCommand.action(runContextAction)}if(shouldRegister("next")){const nextCommand=program.command("next").description("Recommend the next actionable (unblocked, ready) work item with rationale + blocked companion.").option("--for <intent>",`Apply a declared context intent projection. ${renderPmClosedDomainHelp("next","--for")}`).option("--type <value>","Filter candidate items by type").option("--tag <value>","Filter candidate items by tag").option("--priority <value>","Filter candidate items by priority").option("--assignee <value>","Filter candidate items by assignee").option("--assignee-filter <value>","Filter assignee presence: assigned|unassigned").option("--sprint <value>","Filter candidate items by sprint").option("--release <value>","Filter candidate items by release").option("--parent <id>","Scope to one item's subtree (the item plus all descendants)").option("--limit <n>","Limit ready rows (default: 5; non-positive falls back to default)").option("--blocked-limit <n>","Limit blocked rows (default: same as --limit)").option("--ready-only","Omit the blocked companion list").option("--include-decisions","Include human-gated Decision items in the claimable ready queue").option("--include-gates","Include outcome gates in the ready queue").option("--include-containers","Include containers with unfinished descendants in the ready queue").option("--format <value>","Next output format override: markdown|toon|json").option("--explain-ranking","Include the scorer model, per-signal contributions, and ranked ready ids").option("--token-budget <n>","Maximum estimated tokens spent on the ranked ready queue");addHiddenOption(nextCommand,"--assignee_filter <value>","Alias for --assignee-filter");addHiddenOption(nextCommand,"--blocked_limit <n>","Alias for --blocked-limit");addHiddenOption(nextCommand,"--ready_only","Alias for --ready-only");addHiddenOption(nextCommand,"--explain_ranking","Alias for --explain-ranking");addHiddenOption(nextCommand,"--token_budget <n>","Alias for --token-budget");nextCommand.action(runNextAction)}if(shouldRegister("search")){const searchCommand=program.command("search").argument("<keywords...>","Keyword query tokens").description("Search items with keyword, semantic, or hybrid retrieval. Inline field:value tokens (tag:/status:/type:/priority:) in the query are parsed as filters, e.g. 'auth tag:area:search status:open'.").option("--for <intent>",`Apply a declared context intent projection. ${renderPmClosedDomainHelp("search","--for")}`).option("--token-budget <n>","Override the selected intent's maximum estimated output tokens").option("--mode <value>","Search mode: keyword|semantic|hybrid (default: auto)").option("--semantic","Shorthand for --mode semantic").option("--hybrid","Shorthand for --mode hybrid").option("--match-mode <value>","Token match mode: and|or|exact (default: or with all-terms ranking bonus; and = hard-require every token; exact = exact phrase)").option("--min-score <value>","Per-query minimum score threshold (finite number >= 0); overrides settings search.score_threshold for this query only").option("--count","Return only the count of matching items (post-filter/threshold, pre-limit); skips hit rows").option("--semantic-weight <value>","Override hybrid semantic weight for this query (0..1); invalid values fall back to settings").option("--include-linked","Include linked files, docs, and tests in the searchable corpus").option("--title-exact","Require exact normalized title match for the full query string").option("--phrase-exact","Require exact normalized phrase match in searchable text").option("--highlight","Emit per-field matched-text snippets (wrapped in \xAB\u2026\xBB) on each hit; off by default").option("--status <value>","Filter by status before query (all, open/closed/canceled aliases, or configured status id; CSV)").option("--type <value>","Filter by item type").option("--tag <value>","Filter by tag").option("--priority <value>","Filter by priority").option("--deadline-before <value>","Filter by deadline upper bound (ISO/date string or relative)").option("--deadline-after <value>","Filter by deadline lower bound (ISO/date string or relative)").option("--updated-after <value>",'Filter by updated_at lower bound: ISO timestamp or signed relative (e.g. "-2h"/"-7d" for the past)').option("--updated-before <value>","Filter by updated_at upper bound: ISO timestamp or signed relative (-2h/+1d)").option("--created-after <value>","Filter by created_at lower bound: ISO timestamp or signed relative (-2h/+1d)").option("--created-before <value>","Filter by created_at upper bound: ISO timestamp or signed relative (-2h/+1d)").option("--assignee <value>","Filter by assignee").option("--sprint <value>","Filter by sprint").option("--release <value>","Filter by release").option("--parent <value>","Filter by parent item ID").option("--compact","Render compact search hits (default; mutually exclusive with --full/--fields)").option("--full","Render full search hits with nested item payloads (mutually exclusive with --compact/--fields)").option("--fields <value>",`Render custom comma-separated search hit fields (mutually exclusive with --compact/--full). ${renderPmClosedDomainHelp("search","--fields")}`).option("--format <value>","Search output format override: json|ndjson|toon").option("--limit <n>","Limit returned item count").option("--after <cursor>","Continue after an opaque next_cursor from a previous search response");registerContentAndGovernanceFilters(searchCommand);searchCommand.action(runSearchAction);addHiddenOption(searchCommand,"--tags <value>","Alias for --tag");addHiddenOption(searchCommand,"--token_budget <n>","Alias for --token-budget")}if(shouldRegister("eval")){program.command("eval").description("Evaluate search relevance against a curated golden-query set: reports nDCG@k, MRR@k, precision@k, and recall@k per query plus the macro average. Use --fail-under as a CI gate.").option("--mode <value>","Default retrieval mode for queries without their own: keyword|semantic|hybrid (default: keyword)").option("--k <n>","Metric cutoff @k (positive integer; default: 10)").option("--fail-under <value>","Exit non-zero when aggregate nDCG@k falls below this threshold (0..1); CI gate").option("--queries <path>",`Query JSON (${EVAL_QUERY_SET_SCHEMA_ID}); default: search/eval-queries.json; errors show an example`).option("--format <value>","Eval output format override: json|toon").action(runEvalAction)}if(shouldRegister("get")){const getCommand=program.command("get").argument("<id>","Item id").option("--for <intent>",`Apply a declared context intent projection. ${renderPmClosedDomainHelp("get","--for")}`).option("--token-budget <n>","Override the selected intent's maximum estimated output tokens").option("--depth <value>","Detail depth: brief|standard|deep|full (full aliases deep; default: standard)").option("--full","Explicit full item read; equivalent to --depth deep (mutually exclusive with --depth/--fields)").option("--fields <value>",`Render custom comma-separated item metadata fields. ${renderPmClosedDomainHelp("get","--fields")}`).option("--tree","Include descendants rooted at the requested item").option("--tree-depth <n>","Maximum subtree depth for --tree descendants").option("--at <version-or-timestamp>","Reconstruct a verified historical item state without mutating it").option("--format <value>","Get output format override: json|toon").description("Show item details by ID.").action(runGetAction);addHiddenOption(getCommand,"--tree_depth <n>","Alias for --tree-depth");addHiddenOption(getCommand,"--token_budget <n>","Alias for --token-budget")}if(shouldRegister("history")){const historyCommand=program.command("history").enablePositionalOptions().argument("<id>","Item id").option("--limit <n>","Latest n entries").option("--compact","Show index, timestamp, op, author, patch count, and fields").option("--full","Full entries with JSON Patches").option("--provenance","Show authors and provenance without patches").option("--provenance-summary","Count provenance completeness").option("--harness <value>","Filter by recorded/resolved harness (repeatable)",collect).option("--agent-instance <value>","Filter agent instance (repeatable)",collect).option("--provenance-filter <dimension=value>","Filter by an exact declared provenance value (repeatable)",collect).option("--diff","Replay per-entry before/after field diffs").option("--field <name>","Filter changed field; implies --diff").option("--verify","Verify the full hash chain and replay").option("--strict-exit","With --verify, fail on integrity errors").option("--fail-on-warn","Alias for --strict-exit").option("--format <value>","Output: json|toon").description("Show item history entries.").action(runHistoryAction);registerHistoryMaintenanceCommands(historyCommand,true);registerHistoryActivityCommand(historyCommand.command("activity"))}if(shouldRegister("events")){program.command("events").option("--since <cursor-or-timestamp>","Resume strictly after a durable cursor, or include events from an ISO timestamp").option("--type <value>","Filter by mutation operation (repeatable or comma-separated)",collect).option("--author <value>","Filter by mutation author (repeatable or comma-separated)",collect).option("--item <value>","Filter by item or workspace stream id (repeatable or comma-separated)",collect).option("--limit <n>","Return at most 1,000 events (default: 100)").option("--cursor-mode <mode>","Cursor framing: batch emits one terminal trailer (default); row preserves one cursor per event").option("--full","Include each complete authoritative history entry").option("--provenance","Include patch-free author, harness, instance, and extensible provenance").option("--provenance-summary","Include bounded provenance completeness counts").option("--harness <value>","Filter by recorded or vocabulary-resolved harness (repeatable)",collect).option("--agent-instance <value>","Filter by privacy-safe agent instance (repeatable)",collect).option("--provenance-filter <dimension=value>","Filter by an exact declared provenance value (repeatable)",collect).option("--follow","Continue emitting committed events as newline-delimited JSON").option("--interval-ms <n>","Empty-read delay while following (minimum: 10ms; default: 250ms)").description("Emit cursor-resumable committed mutation facts as newline-delimited JSON.").action(runEventsAction)}if(shouldRegister("activity")){registerHistoryActivityCommand(program.command("activity",{hidden:true}))}if(shouldRegister("graph")){program.command("graph").argument("<subcommand>","Graph query (ancestors, descendants, predecessors, successors, paths, impact, analyze, audit, communities, redundancy, dominators, slack, centrality, articulation, plan, index)").argument("[id]","Root item id (traversals, paths, impact, and dominators)").argument("[target]","Target item id (paths only)").option("--kind <value>","Restrict traversal to registered relationship kinds (repeatable or comma-separated)",collect).option("--max-depth <value>","Maximum traversal depth (non-negative integer)").option("--limit <value>","Maximum returned rows per bounded collection").option("--after <value>","Resume a traversal after this previously returned node id").option("--direction <value>","Edge orientation for paths/impact (outgoing, incoming, or both)").option("--max-paths <value>","Maximum enumerated paths (paths only)").option("--sample <value>","Maximum evidence sample entries per audit finding (audit only)").option("--exempt-isolate <value>","Item ids treated as explicitly valid isolates by the audit (repeatable or comma-separated)",collect).option("--exempt-isolate-type <value>","Item types whose active isolates are policy-valid for the audit (repeatable or comma-separated)",collect).option("--save-baseline","Persist the audit census as the change-since-baseline comparison point (audit only)").option("--rebuild","Rebuild and warm the durable graph index (index only)").option("--clear","Delete the durable graph index (index only)").option("--summary","Return counts-first envelopes without row collections").option("--full","Return the complete graph row projection").description("Bounded workspace relationship-graph queries, analytics, and governance audit.").action(runGraphAction)}}const _testOnlyRegisterListQuery={resolveReadCommandOutputFormat,parseListFormat};export{_testOnlyRegisterListQuery,registerListQueryCommands};
11
11
  //# sourceMappingURL=register-list-query.js.map
@@ -1,8 +1,3 @@
1
- /**
2
- * @module cli/register-mutation
3
- *
4
- * Provides CLI runtime support for Register Mutation.
5
- */
6
1
  import type { Command } from "commander";
7
2
  import { type CommanderOptionRegistrationContract } from "../sdk/cli-contracts.js";
8
3
  export { looksLikeSchemaSubcommandTypo, parseSchemaOrderOption, } from "./schema-registration-helpers.js";