@unbrained/pm-cli 2026.7.17 → 2026.7.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +13 -0
- package/dist/cli/commands/close.d.ts +1 -1
- package/dist/cli/commands/close.js +3 -3
- package/dist/cli/commands/close.js.map +1 -1
- package/dist/cli/commands/completion.js +47 -5
- package/dist/cli/commands/completion.js.map +1 -1
- package/dist/cli/commands/context.d.ts +2 -2
- package/dist/cli/commands/context.js +42 -28
- package/dist/cli/commands/context.js.map +1 -1
- package/dist/cli/commands/contracts.js +5 -3
- package/dist/cli/commands/contracts.js.map +1 -1
- package/dist/cli/commands/graph.d.ts +7 -0
- package/dist/cli/commands/graph.js +11 -0
- package/dist/cli/commands/graph.js.map +1 -0
- package/dist/cli/commands/index.d.ts +1 -0
- package/dist/cli/commands/index.js +3 -2
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/next.d.ts +1 -1
- package/dist/cli/commands/next.js +3 -3
- package/dist/cli/commands/next.js.map +1 -1
- package/dist/cli/main.js +3 -2
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/register-list-query.js +49 -7
- package/dist/cli/register-list-query.js.map +1 -1
- package/dist/cli/register-mutation.js +7 -3
- package/dist/cli/register-mutation.js.map +1 -1
- package/dist/cli-bundle/bundle-manifest.json +157 -149
- package/dist/cli-bundle/chunks/{chunk-N7I2DGLP.js → chunk-35FHWD4C.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-37V5MXAU.js.map → chunk-35FHWD4C.js.map} +1 -7
- package/dist/cli-bundle/chunks/{chunk-MSGETE6I.js → chunk-3CUQZNQ6.js} +67 -509
- package/dist/cli-bundle/chunks/chunk-3CUQZNQ6.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-3QDR6ZLU.js +800 -0
- package/dist/cli-bundle/chunks/chunk-3QDR6ZLU.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-QNUAZYGW.js → chunk-43UMFKCK.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-HF63SBLC.js → chunk-6VHUGVNP.js} +39 -16
- package/dist/cli-bundle/chunks/chunk-6VHUGVNP.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-B6SH2YNN.js → chunk-7R6UIHYY.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-NCAFUBJX.js → chunk-7UCY6DR5.js} +183 -12
- package/dist/cli-bundle/chunks/chunk-7UCY6DR5.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-23TCGBRK.js → chunk-ADXDCAKP.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-7LTCLTRG.js → chunk-AXRT7K5V.js} +16 -3
- package/dist/cli-bundle/chunks/chunk-AXRT7K5V.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-P56LKFQX.js → chunk-BDA35QG5.js} +34 -4
- package/dist/cli-bundle/chunks/chunk-BDA35QG5.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-2MPMKJF2.js → chunk-DHNG452T.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-AFSV5HBB.js → chunk-E4FXM2XB.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-QKVVV6QO.js → chunk-EWIT5WIC.js} +3 -3
- package/dist/cli-bundle/chunks/chunk-EX7OQT3Y.js +783 -0
- package/dist/cli-bundle/chunks/chunk-EX7OQT3Y.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-LLODAQMP.js → chunk-F3VC3GOV.js} +41 -18
- package/dist/cli-bundle/chunks/chunk-F3VC3GOV.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-S46R2M3W.js → chunk-GKPCTQYG.js} +1709 -5
- package/dist/cli-bundle/chunks/chunk-GKPCTQYG.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-HXVHBERL.js → chunk-HPAYDSR2.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-XNPMDSQQ.js → chunk-HYTOJW2Q.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-V3VBXQQV.js → chunk-I3INI567.js} +516 -429
- package/dist/cli-bundle/chunks/chunk-I3INI567.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-V7MP6YTN.js → chunk-IL5SPRMH.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-YQCWK2MB.js → chunk-L5BTTDU5.js} +68 -503
- package/dist/cli-bundle/chunks/chunk-L5BTTDU5.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-SIJV365F.js → chunk-NCVT6XEL.js} +17 -4
- package/dist/cli-bundle/chunks/chunk-NCVT6XEL.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-DCC2AQBD.js → chunk-OGVTB5VO.js} +32 -31
- package/dist/cli-bundle/chunks/chunk-OGVTB5VO.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-6XAZB6SE.js → chunk-QPGQNLPI.js} +1660 -7
- package/dist/cli-bundle/chunks/chunk-QPGQNLPI.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-KOEZCHRF.js → chunk-QRZNCRNA.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-G6KM4YKY.js → chunk-RXPQ5Q23.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-7CTQ7WW5.js → chunk-SIPOACV5.js} +514 -427
- package/dist/cli-bundle/chunks/chunk-SIPOACV5.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-XYJK6GIQ.js → chunk-TGBTLGPX.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-37V5MXAU.js → chunk-TLWJP5BF.js} +3 -3
- package/dist/cli-bundle/chunks/chunk-TLWJP5BF.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-3D4YVTNG.js → chunk-TZAE66GQ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-S6FF7VW6.js → chunk-WQXRZMFN.js} +187 -16
- package/dist/cli-bundle/chunks/chunk-WQXRZMFN.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-SPFZV2GR.js → chunk-XPUTSGJU.js} +32 -31
- package/dist/cli-bundle/chunks/chunk-XPUTSGJU.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-CFSUNEL7.js → chunk-XWBD6DSR.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-MNV226E4.js → chunk-XWYQ2LT4.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-I7GY4X6Y.js → chunk-YFE7JHX3.js} +26 -5
- package/dist/cli-bundle/chunks/chunk-YFE7JHX3.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-FZGM3PNA.js → chunk-YIIIAKCE.js} +2 -2
- package/dist/cli-bundle/chunks/{close-BEP7MHF3.js → close-GPD7DTJV.js} +3 -3
- package/dist/cli-bundle/chunks/{close-Y6QFUJQN.js → close-X3CF6FQP.js} +3 -3
- package/dist/cli-bundle/chunks/{close-many-JJFW7KTT.js → close-many-J7A5EHOQ.js} +5 -5
- package/dist/cli-bundle/chunks/{close-many-QJ6FKJUE.js → close-many-NQLYGPYW.js} +5 -5
- package/dist/cli-bundle/chunks/{deps-EVTOQMKW.js → deps-MQ4ZIGZB.js} +13 -4
- package/dist/cli-bundle/chunks/{deps-5NC4IZH7.js → deps-NIIKXLPB.js} +13 -4
- package/dist/cli-bundle/chunks/{profile-U2B6Y7GE.js → profile-AVCIIZID.js} +3 -3
- package/dist/cli-bundle/chunks/{profile-AGUKS52S.js → profile-LFYO3HHX.js} +3 -3
- package/dist/cli-bundle/chunks/{register-list-query-A5KRJ5J2.js → register-list-query-MZUF2EEC.js} +41 -13
- package/dist/cli-bundle/chunks/register-list-query-MZUF2EEC.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-list-query-NEYP3TXO.js → register-list-query-UKMF55FT.js} +40 -12
- package/dist/cli-bundle/chunks/register-list-query-UKMF55FT.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-mutation-6LOPBAHC.js → register-mutation-2PBW2GEX.js} +15 -13
- package/dist/cli-bundle/chunks/register-mutation-2PBW2GEX.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-mutation-GCZOALNJ.js → register-mutation-T6RVNJC4.js} +14 -12
- package/dist/cli-bundle/chunks/{register-mutation-GCZOALNJ.js.map → register-mutation-T6RVNJC4.js.map} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-6ZZIF27A.js → register-operations-KHZYR6MG.js} +11 -11
- package/dist/cli-bundle/chunks/{register-operations-REDIAEGI.js → register-operations-WPQ2LWZJ.js} +11 -11
- package/dist/cli-bundle/chunks/{register-setup-J3JS2ZVT.js → register-setup-PGDNOXDQ.js} +5 -5
- package/dist/cli-bundle/chunks/{register-setup-BHPMN5SK.js → register-setup-TDN7WAO6.js} +5 -5
- package/dist/cli-bundle/chunks/{update-SA6AG23P.js → update-SQYZA3ZW.js} +4 -4
- package/dist/cli-bundle/chunks/{update-PQQHLYCC.js → update-XZJYS5X7.js} +4 -4
- package/dist/cli-bundle/chunks/{update-many-RQVTFJPD.js → update-many-R24B3GBK.js} +6 -6
- package/dist/cli-bundle/chunks/{update-many-TV3L3KBX.js → update-many-WQ3R3J6N.js} +6 -6
- package/dist/cli-bundle/main.js +25 -9
- package/dist/cli-bundle/main.js.map +2 -2
- package/dist/cli-bundle/sdk-runtime.js +19 -16
- package/dist/cli-bundle/sdk.js +95 -305
- package/dist/cli-bundle/sdk.js.map +4 -4
- package/dist/core/item/actionability.d.ts +12 -0
- package/dist/core/item/actionability.js +39 -4
- package/dist/core/item/actionability.js.map +1 -1
- package/dist/core/sentry/instrument.d.ts +11 -0
- package/dist/core/sentry/instrument.js +21 -2
- package/dist/core/sentry/instrument.js.map +1 -1
- package/dist/mcp/server.d.ts +16 -18
- package/dist/mcp/server.js +84 -31
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tool-definitions.js +17 -4
- package/dist/mcp/tool-definitions.js.map +1 -1
- package/dist/sdk/actionability.d.ts +10 -0
- package/dist/sdk/actionability.js +14 -0
- package/dist/sdk/actionability.js.map +1 -0
- package/dist/sdk/cli-contracts/enum-contracts.d.ts +6 -2
- package/dist/sdk/cli-contracts/enum-contracts.js +19 -2
- package/dist/sdk/cli-contracts/enum-contracts.js.map +1 -1
- package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
- package/dist/sdk/cli-contracts/flag-contracts.js +21 -2
- package/dist/sdk/cli-contracts/flag-contracts.js.map +1 -1
- package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +2 -0
- package/dist/sdk/cli-contracts/tool-option-contracts.js +16 -2
- package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +80 -3
- package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
- package/dist/sdk/cli-contracts/tool-schema.d.ts +20 -0
- package/dist/sdk/cli-contracts/tool-schema.js +97 -9
- package/dist/sdk/cli-contracts/tool-schema.js.map +1 -1
- package/dist/sdk/cli-contracts.d.ts +2 -2
- package/dist/sdk/cli-contracts.js +4 -4
- package/dist/sdk/cli-contracts.js.map +1 -1
- package/dist/sdk/dependencies.d.ts +42 -53
- package/dist/sdk/dependencies.js +177 -125
- package/dist/sdk/dependencies.js.map +1 -1
- package/dist/sdk/governance/validate.js +3 -3
- package/dist/sdk/governance/validate.js.map +1 -1
- package/dist/sdk/graph/analytics.d.ts +124 -0
- package/dist/sdk/graph/analytics.js +464 -0
- package/dist/sdk/graph/analytics.js.map +1 -0
- package/dist/sdk/graph/assembly.d.ts +97 -0
- package/dist/sdk/graph/assembly.js +146 -0
- package/dist/sdk/graph/assembly.js.map +1 -0
- package/dist/sdk/graph/cache.d.ts +66 -0
- package/dist/sdk/graph/cache.js +148 -0
- package/dist/sdk/graph/cache.js.map +1 -0
- package/dist/sdk/graph/governance.d.ts +108 -0
- package/dist/sdk/graph/governance.js +360 -0
- package/dist/sdk/graph/governance.js.map +1 -0
- package/dist/sdk/graph/index.d.ts +16 -0
- package/dist/sdk/graph/index.js +20 -0
- package/dist/sdk/graph/index.js.map +1 -0
- package/dist/sdk/graph/remediation.d.ts +52 -0
- package/dist/sdk/graph/remediation.js +148 -0
- package/dist/sdk/graph/remediation.js.map +1 -0
- package/dist/sdk/graph/run.d.ts +295 -0
- package/dist/sdk/graph/run.js +468 -0
- package/dist/sdk/graph/run.js.map +1 -0
- package/dist/sdk/graph/traversal.d.ts +77 -0
- package/dist/sdk/graph/traversal.js +262 -0
- package/dist/sdk/graph/traversal.js.map +1 -0
- package/dist/sdk/index.d.ts +4 -2
- package/dist/sdk/index.js +6 -4
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/query/list.d.ts +8 -0
- package/dist/sdk/query/list.js +19 -3
- package/dist/sdk/query/list.js.map +1 -1
- package/dist/sdk/relationship-context.d.ts +42 -0
- package/dist/sdk/relationship-context.js +99 -20
- package/dist/sdk/relationship-context.js.map +1 -1
- package/dist/sdk/relationships.d.ts +13 -0
- package/dist/sdk/relationships.js +30 -2
- package/dist/sdk/relationships.js.map +1 -1
- package/dist/sdk/runtime-input.d.ts +41 -0
- package/dist/sdk/runtime-input.js +422 -2
- package/dist/sdk/runtime-input.js.map +1 -1
- package/dist/sdk/runtime.d.ts +12 -23
- package/dist/sdk/runtime.js +19 -371
- package/dist/sdk/runtime.js.map +1 -1
- package/dist/sdk/test/linked-command-detection.js +12 -3
- package/dist/sdk/test/linked-command-detection.js.map +1 -1
- package/docs/AGENT_GUIDE.md +1 -0
- package/docs/COMMANDS.md +19 -1
- package/docs/RELATIONSHIP_GRAPH.md +99 -3
- package/docs/SDK.md +17 -3
- package/marketplace.json +2 -2
- package/package.json +1 -1
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/dist/cli-bundle/chunks/chunk-6XAZB6SE.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-7CTQ7WW5.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-7LTCLTRG.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-DCC2AQBD.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-HF63SBLC.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-I7GY4X6Y.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-LLODAQMP.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-MSGETE6I.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-N7I2DGLP.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-NCAFUBJX.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-P56LKFQX.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-S46R2M3W.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-S6FF7VW6.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-SIJV365F.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-SPFZV2GR.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-V3VBXQQV.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-YQCWK2MB.js.map +0 -1
- package/dist/cli-bundle/chunks/register-list-query-A5KRJ5J2.js.map +0 -1
- package/dist/cli-bundle/chunks/register-list-query-NEYP3TXO.js.map +0 -7
- package/dist/cli-bundle/chunks/register-mutation-6LOPBAHC.js.map +0 -1
- /package/dist/cli-bundle/chunks/{chunk-QNUAZYGW.js.map → chunk-43UMFKCK.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-B6SH2YNN.js.map → chunk-7R6UIHYY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-23TCGBRK.js.map → chunk-ADXDCAKP.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-2MPMKJF2.js.map → chunk-DHNG452T.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-AFSV5HBB.js.map → chunk-E4FXM2XB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-QKVVV6QO.js.map → chunk-EWIT5WIC.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-HXVHBERL.js.map → chunk-HPAYDSR2.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-XNPMDSQQ.js.map → chunk-HYTOJW2Q.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-V7MP6YTN.js.map → chunk-IL5SPRMH.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-KOEZCHRF.js.map → chunk-QRZNCRNA.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-G6KM4YKY.js.map → chunk-RXPQ5Q23.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-XYJK6GIQ.js.map → chunk-TGBTLGPX.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-3D4YVTNG.js.map → chunk-TZAE66GQ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-CFSUNEL7.js.map → chunk-XWBD6DSR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-MNV226E4.js.map → chunk-XWYQ2LT4.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-FZGM3PNA.js.map → chunk-YIIIAKCE.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-BEP7MHF3.js.map → close-GPD7DTJV.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-Y6QFUJQN.js.map → close-X3CF6FQP.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-many-JJFW7KTT.js.map → close-many-J7A5EHOQ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-many-QJ6FKJUE.js.map → close-many-NQLYGPYW.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{deps-EVTOQMKW.js.map → deps-MQ4ZIGZB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{deps-5NC4IZH7.js.map → deps-NIIKXLPB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{profile-U2B6Y7GE.js.map → profile-AVCIIZID.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{profile-AGUKS52S.js.map → profile-LFYO3HHX.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{register-operations-6ZZIF27A.js.map → register-operations-KHZYR6MG.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{register-operations-REDIAEGI.js.map → register-operations-WPQ2LWZJ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{register-setup-J3JS2ZVT.js.map → register-setup-PGDNOXDQ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{register-setup-BHPMN5SK.js.map → register-setup-TDN7WAO6.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-SA6AG23P.js.map → update-SQYZA3ZW.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-PQQHLYCC.js.map → update-XZJYS5X7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-many-RQVTFJPD.js.map → update-many-R24B3GBK.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-many-TV3L3KBX.js.map → update-many-WQ3R3J6N.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../sdk/relationships.ts","../../../../../../../../sdk/relationship-context.ts","../../../../../../../../sdk/dependencies.ts"],"sourcesContent":["/**\n * @module sdk/relationships\n *\n * Provides the dependency-free relationship ontology and bounded graph-query\n * kernel shared by the SDK, CLI, MCP adapters, extensions, and non-PM apps.\n */\nimport type { Dependency, ItemMetadata } from \"../types/index.js\";\n\n/** Direction exposed by a relationship kind. */\nexport type RelationshipDirection = \"directed\" | \"undirected\";\n/** Cardinality constraint applied independently to outgoing and incoming edges. */\nexport type RelationshipCardinality = \"one\" | \"many\";\n/** Lifecycle policy for a relationship kind. */\nexport type RelationshipLifecycle = \"persistent\" | \"supersedable\" | \"ephemeral\";\n/** Direction in which an ordering edge contributes to execution precedence. */\nexport type RelationshipPrecedence =\n | \"source_before_target\"\n | \"target_before_source\";\n/** Endpoint that represents the structural parent for hierarchy kinds. */\nexport type RelationshipHierarchyDirection = \"source_parent\" | \"target_parent\";\n\n/** Versioned semantic definition for a built-in or application-defined edge kind. */\nexport interface RelationshipKindDefinition {\n /** Canonical, case-insensitive kind identifier. */\n kind: string;\n /** Whether traversing source to target has distinct meaning from the reverse. */\n direction: RelationshipDirection;\n /** Optional canonical kind used when traversing a directed edge in reverse. */\n inverse?: string;\n /** Whether the kind participates in execution-order cycle checks. */\n ordering: boolean;\n /** Execution direction for ordering kinds; defaults to source before target. */\n precedence?: RelationshipPrecedence;\n /** Whether the kind contributes to structural ancestry. */\n hierarchy: boolean;\n /** Endpoint that represents the parent; defaults to source for custom kinds. */\n hierarchyDirection?: RelationshipHierarchyDirection;\n /** Maximum logical outgoing edges of this kind from one node. */\n outgoing: RelationshipCardinality;\n /** Maximum logical incoming edges of this kind to one node. */\n incoming: RelationshipCardinality;\n /** Edge replacement and retention behavior. */\n lifecycle: RelationshipLifecycle;\n /** JSON Schema for optional application-owned payloads. */\n payloadSchema?: Readonly<Record<string, unknown>>;\n /** Legacy spellings normalized to this definition. */\n aliases?: readonly string[];\n /** Compatibility version of this semantic contract. */\n compatibilityVersion: number;\n /** Whether source and target may be the same node. */\n allowSelf: boolean;\n}\n\n/** One normalized relationship edge indexed by the graph kernel. */\nexport interface RelationshipEdge {\n /** Source node identifier. */\n source: string;\n /** Target node identifier. */\n target: string;\n /** Canonical relationship kind. */\n kind: string;\n /** Optional creation timestamp retained from storage. */\n createdAt?: string;\n /** Optional author retained from storage. */\n author?: string;\n /** Optional application-owned edge payload. */\n payload?: Readonly<Record<string, unknown>>;\n}\n\n/** Direction used by adjacency, closure, and path traversal. */\nexport type RelationshipTraversalDirection = \"outgoing\" | \"incoming\" | \"both\";\n\n/** Shared bounded-query controls. */\nexport interface RelationshipQueryOptions {\n /** Edge kinds to traverse after alias normalization. */\n kinds?: readonly string[];\n /** Traversal direction relative to each visited node. */\n direction?: RelationshipTraversalDirection;\n /** Maximum number of returned nodes, excluding the starting node. */\n limit?: number;\n /** Maximum traversal depth. */\n maxDepth?: number;\n /** Abort signal checked throughout traversal. */\n signal?: AbortSignal;\n}\n\n/** Cost and truncation metadata returned by every graph query. */\nexport interface RelationshipQueryMeta {\n /** Number of nodes removed from the traversal frontier. */\n visitedNodes: number;\n /** Number of candidate edges inspected. */\n inspectedEdges: number;\n /** Whether a configured bound stopped traversal. */\n truncated: boolean;\n /** Deterministic continuation cursor for the final returned node. */\n nextCursor?: string;\n}\n\n/** Generic bounded graph query result. */\nexport interface RelationshipQueryResult<T> {\n /** Deterministically ordered query value. */\n value: T;\n /** Explicit query work and truncation metadata. */\n meta: RelationshipQueryMeta;\n}\n\n/** Induced subgraph returned by bounded traversal. */\nexport interface RelationshipSubgraph {\n /** Deterministically ordered node identifiers. */\n nodes: string[];\n /** Deterministically ordered edges whose endpoints are both present. */\n edges: RelationshipEdge[];\n}\n\nconst BUILTIN_RELATIONSHIP_KINDS: readonly RelationshipKindDefinition[] = [\n {\n kind: \"blocked_by\",\n direction: \"directed\",\n inverse: \"blocks\",\n ordering: true,\n precedence: \"target_before_source\",\n hierarchy: false,\n outgoing: \"many\",\n incoming: \"many\",\n lifecycle: \"persistent\",\n aliases: [\"depends_on\"],\n compatibilityVersion: 1,\n allowSelf: false,\n },\n {\n kind: \"blocks\",\n direction: \"directed\",\n inverse: \"blocked_by\",\n ordering: true,\n precedence: \"source_before_target\",\n hierarchy: false,\n outgoing: \"many\",\n incoming: \"many\",\n lifecycle: \"persistent\",\n compatibilityVersion: 1,\n allowSelf: false,\n },\n {\n kind: \"parent\",\n direction: \"directed\",\n inverse: \"child\",\n ordering: false,\n hierarchy: true,\n hierarchyDirection: \"target_parent\",\n outgoing: \"one\",\n incoming: \"many\",\n lifecycle: \"supersedable\",\n aliases: [\"child_of\", \"epic\"],\n compatibilityVersion: 1,\n allowSelf: false,\n },\n {\n kind: \"child\",\n direction: \"directed\",\n inverse: \"parent\",\n ordering: false,\n hierarchy: true,\n hierarchyDirection: \"source_parent\",\n outgoing: \"many\",\n incoming: \"one\",\n lifecycle: \"supersedable\",\n aliases: [\"parent_child\", \"task\"],\n compatibilityVersion: 1,\n allowSelf: false,\n },\n {\n kind: \"related\",\n direction: \"undirected\",\n ordering: false,\n hierarchy: false,\n outgoing: \"many\",\n incoming: \"many\",\n lifecycle: \"persistent\",\n aliases: [\"related_to\"],\n compatibilityVersion: 1,\n allowSelf: false,\n },\n {\n kind: \"discovered_from\",\n direction: \"directed\",\n ordering: false,\n hierarchy: false,\n outgoing: \"many\",\n incoming: \"many\",\n lifecycle: \"persistent\",\n compatibilityVersion: 1,\n allowSelf: false,\n },\n {\n kind: \"incident_from\",\n direction: \"directed\",\n ordering: false,\n hierarchy: false,\n outgoing: \"many\",\n incoming: \"many\",\n lifecycle: \"persistent\",\n compatibilityVersion: 1,\n allowSelf: false,\n },\n {\n kind: \"supersedes\",\n direction: \"directed\",\n ordering: false,\n hierarchy: false,\n outgoing: \"many\",\n incoming: \"many\",\n lifecycle: \"supersedable\",\n compatibilityVersion: 1,\n allowSelf: false,\n },\n] as const;\n\nfunction normalizeKind(kind: string): string {\n return kind.trim().toLowerCase().replaceAll(\"-\", \"_\");\n}\n\nfunction normalizeInverseKind(inverse: string | undefined): string | undefined {\n if (inverse === undefined) return undefined;\n const normalized = normalizeKind(inverse);\n if (!/^[a-z][a-z0-9_]*$/.test(normalized))\n throw new TypeError(`Invalid inverse relationship kind: ${inverse}`);\n return normalized;\n}\n\nfunction freezeValue(value: unknown, visited = new Set<object>()): unknown {\n if (value === null || typeof value !== \"object\") return value;\n if (visited.has(value)) return value;\n visited.add(value);\n if (Array.isArray(value)) {\n for (const entry of value) freezeValue(entry, visited);\n return Object.freeze(value);\n }\n for (const entry of Object.values(value)) freezeValue(entry, visited);\n return Object.freeze(value);\n}\n\nfunction assertRelationshipPrecedence(\n definition: RelationshipKindDefinition,\n kind: string,\n): void {\n if (\n definition.precedence !== undefined &&\n definition.precedence !== \"source_before_target\" &&\n definition.precedence !== \"target_before_source\"\n )\n throw new TypeError(`Invalid relationship precedence for ${kind}`);\n if (!definition.ordering && definition.precedence !== undefined)\n throw new TypeError(\n `Non-ordering relationship kind cannot declare precedence: ${kind}`,\n );\n}\n\nfunction assertRelationshipHierarchyDirection(\n definition: RelationshipKindDefinition,\n kind: string,\n): void {\n if (\n definition.hierarchyDirection !== undefined &&\n definition.hierarchyDirection !== \"source_parent\" &&\n definition.hierarchyDirection !== \"target_parent\"\n )\n throw new TypeError(`Invalid relationship hierarchy direction for ${kind}`);\n if (!definition.hierarchy && definition.hierarchyDirection !== undefined)\n throw new TypeError(\n `Non-hierarchy relationship kind cannot declare hierarchy direction: ${kind}`,\n );\n}\n\n/** Mutable registry with immutable snapshots and collision-safe extension registration. */\nexport class RelationshipKindRegistry {\n readonly #definitions = new Map<string, RelationshipKindDefinition>();\n readonly #aliases = new Map<string, string>();\n\n /** Create a registry initialized with the stable built-in ontology by default. */\n public constructor(\n definitions: readonly RelationshipKindDefinition[] = BUILTIN_RELATIONSHIP_KINDS,\n ) {\n for (const definition of definitions) this.register(definition);\n }\n\n /** Register one definition after validating its identifier, version, and aliases. */\n public register(definition: RelationshipKindDefinition): this {\n const kind = normalizeKind(definition.kind);\n if (!/^[a-z][a-z0-9_]*$/.test(kind))\n throw new TypeError(`Invalid relationship kind: ${definition.kind}`);\n if (\n !Number.isInteger(definition.compatibilityVersion) ||\n definition.compatibilityVersion < 1\n )\n throw new TypeError(`Invalid compatibility version for ${kind}`);\n assertRelationshipPrecedence(definition, kind);\n assertRelationshipHierarchyDirection(definition, kind);\n if (this.#definitions.has(kind) || this.#aliases.has(kind))\n throw new TypeError(`Relationship kind already registered: ${kind}`);\n const inverse = normalizeInverseKind(definition.inverse);\n const aliases = [\n ...new Set((definition.aliases ?? []).map(normalizeKind)),\n ].sort();\n for (const alias of aliases) {\n if (!/^[a-z][a-z0-9_]*$/.test(alias))\n throw new TypeError(`Invalid relationship alias: ${alias}`);\n if (\n alias === kind ||\n this.#definitions.has(alias) ||\n this.#aliases.has(alias)\n )\n throw new TypeError(`Relationship alias already registered: ${alias}`);\n }\n const normalized = Object.freeze({\n ...definition,\n kind,\n inverse,\n aliases: Object.freeze(aliases),\n payloadSchema: definition.payloadSchema\n ? (freezeValue(structuredClone(definition.payloadSchema)) as Readonly<\n Record<string, unknown>\n >)\n : undefined,\n });\n this.#definitions.set(kind, normalized);\n for (const alias of aliases) this.#aliases.set(alias, kind);\n return this;\n }\n\n /** Resolve a canonical kind or compatibility alias. */\n public resolve(kind: unknown): RelationshipKindDefinition | undefined {\n if (typeof kind !== \"string\") return undefined;\n const normalized = normalizeKind(kind);\n return this.#definitions.get(this.#aliases.get(normalized) ?? normalized);\n }\n\n /** Resolve a kind or throw a precise error suitable for command adapters. */\n public require(kind: string): RelationshipKindDefinition {\n const definition = this.resolve(kind);\n if (!definition) throw new TypeError(`Unknown relationship kind: ${kind}`);\n return definition;\n }\n\n /** Return a deterministic immutable registry snapshot. */\n public list(): readonly RelationshipKindDefinition[] {\n return Object.freeze(\n [...this.#definitions.values()].sort((left, right) =>\n left.kind.localeCompare(right.kind),\n ),\n );\n }\n}\n\n/** Create a registry containing the built-in relationship ontology. */\nexport function createRelationshipKindRegistry(): RelationshipKindRegistry {\n return new RelationshipKindRegistry();\n}\n\nconst defaultRegistry = createRelationshipKindRegistry();\n\n/** Report whether a kind participates in execution-order cycle detection. */\nexport function isOrderingRelationshipKind(\n kind: string,\n registry: RelationshipKindRegistry = defaultRegistry,\n): boolean {\n return registry.resolve(kind)?.ordering === true;\n}\n\nfunction compareEdges(left: RelationshipEdge, right: RelationshipEdge): number {\n return (\n left.source.localeCompare(right.source) ||\n left.target.localeCompare(right.target) ||\n left.kind.localeCompare(right.kind)\n );\n}\n\nfunction normalizeRelationshipEdge(\n candidate: RelationshipEdge,\n nodes: ReadonlySet<string>,\n registry: RelationshipKindRegistry,\n): { edge: RelationshipEdge; identity: string } {\n const source =\n typeof candidate.source === \"string\" ? candidate.source.trim() : \"\";\n const target =\n typeof candidate.target === \"string\" ? candidate.target.trim() : \"\";\n const definition = registry.require(candidate.kind);\n if (!nodes.has(source) || !nodes.has(target))\n throw new TypeError(\n `Relationship endpoint not found: ${source} -> ${target}`,\n );\n if (source === target && !definition.allowSelf)\n throw new TypeError(\n `Self relationship is not allowed for ${definition.kind}`,\n );\n const edge = Object.freeze({\n ...candidate,\n source,\n target,\n kind: definition.kind,\n });\n const endpoints =\n definition.direction === \"undirected\"\n ? [source, target].sort().join(\"\\u0000\")\n : `${source}\\u0000${target}`;\n return { edge, identity: `${definition.kind}\\u0000${endpoints}` };\n}\n\nfunction appendIndexedEdge(\n index: Map<string, RelationshipEdge[]>,\n node: string,\n edge: RelationshipEdge,\n): void {\n const indexed = index.get(node);\n if (indexed) indexed.push(edge);\n else index.set(node, [edge]);\n}\n\nfunction normalizeNodeId(value: unknown): string {\n return typeof value === \"string\" ? value.trim() : \"\";\n}\n\nfunction resolveExistingNodeId(\n value: unknown,\n ids: ReadonlySet<string>,\n): string | undefined {\n const id = normalizeNodeId(value);\n return id && ids.has(id) ? id : undefined;\n}\n\nfunction reconstructPath(\n source: string,\n target: string,\n parents: ReadonlyMap<string, string>,\n): string[] {\n const path = [target];\n let cursor = target;\n while (cursor !== source) {\n cursor = parents.get(cursor)!;\n path.push(cursor);\n }\n return path.reverse();\n}\n\n/** Build an immutable, deterministic in-memory relationship index. */\nexport class RelationshipGraph {\n readonly #registry: RelationshipKindRegistry;\n readonly #nodes: Set<string>;\n readonly #nodeSnapshot: readonly string[];\n readonly #edges: readonly RelationshipEdge[];\n readonly #outgoing = new Map<string, RelationshipEdge[]>();\n readonly #incoming = new Map<string, RelationshipEdge[]>();\n\n /** Validate and index nodes and edges without reading tracker storage. */\n public constructor(\n nodes: Iterable<string>,\n edges: Iterable<RelationshipEdge>,\n registry: RelationshipKindRegistry = defaultRegistry,\n ) {\n this.#registry = registry;\n this.#nodes = new Set(\n [...nodes]\n .filter((id): id is string => typeof id === \"string\")\n .map((id) => id.trim())\n .filter(Boolean),\n );\n this.#nodeSnapshot = Object.freeze([...this.#nodes].sort());\n const deduped = new Map<string, RelationshipEdge>();\n for (const candidate of edges) {\n const { edge, identity } = normalizeRelationshipEdge(\n candidate,\n this.#nodes,\n registry,\n );\n deduped.set(identity, edge);\n }\n this.#edges = Object.freeze([...deduped.values()].sort(compareEdges));\n for (const edge of this.#edges) {\n appendIndexedEdge(this.#outgoing, edge.source, edge);\n appendIndexedEdge(this.#incoming, edge.target, edge);\n if (registry.require(edge.kind).direction === \"undirected\") {\n appendIndexedEdge(this.#outgoing, edge.target, edge);\n appendIndexedEdge(this.#incoming, edge.source, edge);\n }\n }\n }\n\n /** Build the graph directly from item metadata, including hierarchy and legacy blocker fields. */\n public static fromItems(\n items: readonly Pick<\n ItemMetadata,\n \"id\" | \"parent\" | \"blocked_by\" | \"dependencies\"\n >[],\n registry: RelationshipKindRegistry = defaultRegistry,\n ): RelationshipGraph {\n const ids = new Set(\n items.map((item) => normalizeNodeId(item.id)).filter(Boolean),\n );\n const edges: RelationshipEdge[] = [];\n for (const item of items) {\n const source = normalizeNodeId(item.id);\n if (!source) continue;\n const parent = resolveExistingNodeId(item.parent, ids);\n if (parent) edges.push({ source, target: parent, kind: \"parent\" });\n const blockedBy = resolveExistingNodeId(item.blocked_by, ids);\n if (blockedBy)\n edges.push({\n source,\n target: blockedBy,\n kind: \"blocked_by\",\n });\n for (const dependency of item.dependencies ?? []) {\n const dependencyId = resolveExistingNodeId(dependency.id, ids);\n if (dependencyId && registry.resolve(dependency.kind))\n edges.push({\n source,\n target: dependencyId,\n kind: dependency.kind,\n createdAt: dependency.created_at,\n author: dependency.author,\n });\n }\n }\n return new RelationshipGraph(ids, edges, registry);\n }\n\n /** Return the deterministic immutable edge snapshot. */\n public edges(): readonly RelationshipEdge[] {\n return this.#edges;\n }\n\n /** Return the deterministic immutable edges incident to one node. */\n public incidentEdges(id: string): readonly RelationshipEdge[] {\n this.#assertNode(id);\n // Preserve empty fallbacks for legacy indexes and JSON-derived graph state.\n const outgoing = this.#outgoing.get(id) ?? [];\n const incoming = this.#incoming.get(id) ?? [];\n if (outgoing.length === 0) return Object.freeze([...incoming]);\n if (incoming.length === 0) return Object.freeze([...outgoing]);\n const edges: RelationshipEdge[] = [];\n let outgoingIndex = 0;\n let incomingIndex = 0;\n while (outgoingIndex < outgoing.length || incomingIndex < incoming.length) {\n const outgoingEdge = outgoing[outgoingIndex];\n const incomingEdge = incoming[incomingIndex];\n const edge =\n outgoingEdge === undefined\n ? incomingEdge!\n : incomingEdge === undefined ||\n compareEdges(outgoingEdge, incomingEdge) <= 0\n ? outgoingEdge\n : incomingEdge;\n if (edges.at(-1) !== edge) edges.push(edge);\n if (outgoingEdge === edge) outgoingIndex += 1;\n if (incomingEdge === edge) incomingIndex += 1;\n }\n return Object.freeze(edges);\n }\n\n /** Return the deterministic immutable node snapshot. */\n public nodes(): readonly string[] {\n return this.#nodeSnapshot;\n }\n\n #assertNode(id: string): void {\n if (!this.#nodes.has(id))\n throw new TypeError(`Relationship node not found: ${id}`);\n }\n\n #matchesKinds(\n edge: RelationshipEdge,\n kinds: ReadonlySet<string> | undefined,\n ): boolean {\n if (!kinds) return true;\n const definition = this.#registry.require(edge.kind);\n return (\n kinds.has(edge.kind) ||\n (definition.inverse !== undefined && kinds.has(definition.inverse))\n );\n }\n\n #neighbors(\n id: string,\n direction: RelationshipTraversalDirection,\n kinds: ReadonlySet<string> | undefined,\n ): { id: string; edge: RelationshipEdge }[] {\n const candidates = [\n ...(direction === \"incoming\" ? [] : (this.#outgoing.get(id) ?? [])),\n ...(direction === \"outgoing\" ? [] : (this.#incoming.get(id) ?? [])),\n ];\n return [...new Set(candidates)]\n .filter((edge) => this.#matchesKinds(edge, kinds))\n .map((edge) => ({\n id: edge.source === id ? edge.target : edge.source,\n edge,\n }))\n .sort(\n (left, right) =>\n left.id.localeCompare(right.id) ||\n compareEdges(left.edge, right.edge),\n );\n }\n\n /** Return one-hop adjacent node identifiers. */\n public adjacency(\n id: string,\n options: RelationshipQueryOptions = {},\n ): RelationshipQueryResult<string[]> {\n this.#assertNode(id);\n options.signal?.throwIfAborted();\n const kinds = options.kinds\n ? new Set(options.kinds.map((kind) => this.#registry.require(kind).kind))\n : undefined;\n const rows = this.#neighbors(id, options.direction ?? \"outgoing\", kinds);\n const limit = options.limit ?? Number.POSITIVE_INFINITY;\n const uniqueNeighbors = [...new Set(rows.map((row) => row.id))];\n const value = uniqueNeighbors.slice(0, limit);\n return {\n value,\n meta: {\n visitedNodes: 1,\n inspectedEdges: rows.length,\n truncated: value.length < uniqueNeighbors.length,\n nextCursor: value.at(-1),\n },\n };\n }\n\n /** Return bounded transitive closure in breadth-first discovery order. */\n public closure(\n id: string,\n options: RelationshipQueryOptions = {},\n ): RelationshipQueryResult<string[]> {\n this.#assertNode(id);\n const kinds = options.kinds\n ? new Set(options.kinds.map((kind) => this.#registry.require(kind).kind))\n : undefined;\n const direction = options.direction ?? \"outgoing\";\n const limit = options.limit ?? Number.POSITIVE_INFINITY;\n const maxDepth = options.maxDepth ?? Number.POSITIVE_INFINITY;\n const seen = new Set([id]);\n const value: string[] = [];\n const queue = [{ id, depth: 0 }];\n let visitedNodes = 0;\n let inspectedEdges = 0;\n let truncated = false;\n traversal: for (let index = 0; index < queue.length; index += 1) {\n options.signal?.throwIfAborted();\n const current = queue[index]!;\n visitedNodes += 1;\n const neighbors = this.#neighbors(current.id, direction, kinds);\n inspectedEdges += neighbors.length;\n if (current.depth >= maxDepth) {\n if (neighbors.some((neighbor) => !seen.has(neighbor.id)))\n truncated = true;\n continue;\n }\n for (const neighbor of neighbors) {\n if (seen.has(neighbor.id)) continue;\n if (value.length >= limit) {\n truncated = true;\n break traversal;\n }\n seen.add(neighbor.id);\n value.push(neighbor.id);\n queue.push({ id: neighbor.id, depth: current.depth + 1 });\n }\n }\n return {\n value,\n meta: {\n visitedNodes,\n inspectedEdges,\n truncated,\n nextCursor: value.at(-1),\n },\n };\n }\n\n /** Return a deterministic shortest path, or an empty array when disconnected. */\n public shortestPath(\n source: string,\n target: string,\n options: RelationshipQueryOptions = {},\n ): RelationshipQueryResult<string[]> {\n this.#assertNode(source);\n this.#assertNode(target);\n if (source === target)\n return {\n value: [source],\n meta: { visitedNodes: 1, inspectedEdges: 0, truncated: false },\n };\n const kinds = options.kinds\n ? new Set(options.kinds.map((kind) => this.#registry.require(kind).kind))\n : undefined;\n const direction = options.direction ?? \"outgoing\";\n const maxDepth = options.maxDepth ?? Number.POSITIVE_INFINITY;\n const queue = [{ id: source, depth: 0 }];\n const parents = new Map<string, string>();\n const seen = new Set([source]);\n let visitedNodes = 0;\n let inspectedEdges = 0;\n let truncated = false;\n for (let index = 0; index < queue.length; index += 1) {\n options.signal?.throwIfAborted();\n const current = queue[index]!;\n visitedNodes += 1;\n const neighbors = this.#neighbors(current.id, direction, kinds);\n inspectedEdges += neighbors.length;\n if (current.depth >= maxDepth) {\n if (neighbors.some((neighbor) => !seen.has(neighbor.id)))\n truncated = true;\n continue;\n }\n for (const neighbor of neighbors) {\n if (seen.has(neighbor.id)) continue;\n parents.set(neighbor.id, current.id);\n if (neighbor.id === target)\n return {\n value: reconstructPath(source, target, parents),\n meta: { visitedNodes, inspectedEdges, truncated: false },\n };\n seen.add(neighbor.id);\n queue.push({ id: neighbor.id, depth: current.depth + 1 });\n }\n }\n return {\n value: [],\n meta: { visitedNodes, inspectedEdges, truncated },\n };\n }\n\n /** Return the induced subgraph over a bounded closure including the root. */\n public subgraph(\n id: string,\n options: RelationshipQueryOptions = {},\n ): RelationshipQueryResult<RelationshipSubgraph> {\n const closure = this.closure(id, options);\n const nodes = [id, ...closure.value].sort();\n const included = new Set(nodes);\n const kinds = options.kinds\n ? new Set(options.kinds.map((kind) => this.#registry.require(kind).kind))\n : undefined;\n const edges = new Set<RelationshipEdge>();\n for (const node of nodes) {\n for (const edge of this.#outgoing.get(node) ?? []) {\n if (\n included.has(edge.source) &&\n included.has(edge.target) &&\n this.#matchesKinds(edge, kinds)\n )\n edges.add(edge);\n }\n }\n return {\n value: {\n nodes,\n edges: [...edges].sort(compareEdges),\n },\n meta: closure.meta,\n };\n }\n}\n\n/** Convert one stored dependency into the public relationship edge contract. */\nexport function dependencyToRelationship(\n source: string,\n dependency: Dependency,\n registry: RelationshipKindRegistry = defaultRegistry,\n): RelationshipEdge {\n return {\n source,\n target: dependency.id,\n kind: registry.require(dependency.kind).kind,\n createdAt: dependency.created_at,\n author: dependency.author,\n };\n}\n","/**\n * @module sdk/relationship-context\n *\n * Assembles one explainable, cursorable, token-bounded relationship context\n * packet for agents, custom tools, and presentation-layer adapters.\n */\nimport {\n createQueryFingerprint,\n encodeQueryCursor,\n resolveQueryCursorStart,\n} from \"./pagination.js\";\nimport {\n RelationshipGraph,\n RelationshipKindRegistry,\n createRelationshipKindRegistry,\n type RelationshipEdge,\n type RelationshipTraversalDirection,\n} from \"./relationships.js\";\n\n/** Caller-owned compact node details joined into graph context. */\nexport interface RelationshipContextNodeDetails {\n /** Stable graph node identifier. */\n id: string;\n /** Optional display title. */\n title?: string;\n /** Optional lifecycle status. */\n status?: string;\n /** Optional evidence pointers such as files, tests, or history ids. */\n evidence?: readonly string[];\n}\n\n/** One selected graph-context node with explainable inclusion. */\nexport interface RelationshipContextNode extends RelationshipContextNodeDetails {\n /** Shortest bounded distance from the root. */\n distance: number;\n /** Concise deterministic reasons the node was selected. */\n reasons: string[];\n}\n\n/** Controls for bounded graph-context assembly. */\nexport interface RelationshipContextOptions {\n /** Traversal direction relative to each visited node. */\n direction?: RelationshipTraversalDirection;\n /** Optional registered kind filter. */\n kinds?: readonly string[];\n /** Maximum traversal depth. */\n maxDepth?: number;\n /** Maximum nodes returned in this page. */\n nodeLimit?: number;\n /** Maximum edges returned in this page. */\n edgeLimit?: number;\n /** Maximum estimated output tokens charged to rows and edges. */\n tokenBudget?: number;\n /** Opaque continuation from an equivalent query. */\n cursor?: string;\n /** Registry used to explain custom relationship semantics. */\n registry?: RelationshipKindRegistry;\n /** Abort signal checked during traversal. */\n signal?: AbortSignal;\n}\n\n/** Explainable graph context packet. */\nexport interface RelationshipContextResult {\n /** Root node details. */\n root: RelationshipContextNodeDetails;\n /** Bounded related-node page. */\n nodes: RelationshipContextNode[];\n /** Bounded edges whose endpoints are present in the packet. */\n edges: RelationshipEdge[];\n /** Root evidence pointers promoted for immediate consumption. */\n evidence: string[];\n /** Completeness, continuation, and cost envelope. */\n meta: {\n exact: true;\n truncated: boolean;\n nodeLimit: number;\n edgeLimit: number;\n tokenBudget: number;\n usedTokens: number;\n visitedNodes: number;\n inspectedEdges: number;\n omittedNodes: number;\n omittedEdges: number;\n nextCursor?: string;\n };\n}\n\ninterface DiscoveredNode {\n id: string;\n distance: number;\n}\n\nconst tokenEncoder = new TextEncoder();\n\nfunction positiveInteger(\n value: number | undefined,\n fallback: number,\n field: string,\n): number {\n const resolved = value ?? fallback;\n if (!Number.isInteger(resolved) || resolved < 1)\n throw new TypeError(`Relationship context ${field} must be positive`);\n return resolved;\n}\n\nfunction estimateTokens(value: unknown): number {\n return Math.max(\n 1,\n Math.ceil(tokenEncoder.encode(JSON.stringify(value)).byteLength / 4),\n );\n}\n\nfunction explainDirectEdge(\n edge: RelationshipEdge,\n root: string,\n node: string,\n registry: RelationshipKindRegistry,\n): string {\n const definition = registry.require(edge.kind);\n if (definition.ordering) {\n // Legacy and JSON-parsed definitions may predate explicit precedence.\n const sourceFirst =\n (definition.precedence ?? \"source_before_target\") ===\n \"source_before_target\";\n const before = sourceFirst ? edge.source : edge.target;\n return node === before ? \"prerequisite\" : \"dependent\";\n }\n if (definition.hierarchy) {\n // Legacy and JSON-parsed definitions may predate explicit hierarchy direction.\n const sourceIsParent =\n (definition.hierarchyDirection ?? \"source_parent\") === \"source_parent\";\n const parent = sourceIsParent ? edge.source : edge.target;\n return node === parent ? \"ancestor\" : \"descendant\";\n }\n if (edge.kind === \"discovered_from\" || edge.kind === \"incident_from\")\n return \"provenance\";\n return \"related\";\n}\n\nfunction directReasons(\n rootEdges: readonly RelationshipEdge[],\n root: string,\n node: string,\n registry: RelationshipKindRegistry,\n): string[] {\n const reasons = rootEdges\n .filter(\n (edge) =>\n (edge.source === root && edge.target === node) ||\n (edge.target === root && edge.source === node),\n )\n .map((edge) => explainDirectEdge(edge, root, node, registry));\n return [...new Set(reasons)].sort();\n}\n\nfunction discoverNodes(\n graph: RelationshipGraph,\n root: string,\n options: RelationshipContextOptions,\n): {\n rows: DiscoveredNode[];\n visitedNodes: number;\n inspectedEdges: number;\n depthTruncated: boolean;\n} {\n const direction = options.direction ?? \"both\";\n const maxDepth = options.maxDepth ?? 3;\n if (!Number.isInteger(maxDepth) || maxDepth < 0)\n throw new TypeError(\"Relationship context maxDepth must be non-negative\");\n const seen = new Set([root]);\n const queue = [{ id: root, distance: 0 }];\n const rows: DiscoveredNode[] = [];\n let inspectedEdges = 0;\n let depthTruncated = false;\n for (let index = 0; index < queue.length; index += 1) {\n options.signal?.throwIfAborted();\n const current = queue[index]!;\n if (current.distance >= maxDepth && depthTruncated) continue;\n const adjacent = graph.adjacency(current.id, {\n direction,\n kinds: options.kinds,\n signal: options.signal,\n });\n inspectedEdges += adjacent.meta.inspectedEdges;\n if (current.distance >= maxDepth) {\n if (adjacent.value.some((id) => !seen.has(id))) depthTruncated = true;\n continue;\n }\n for (const id of adjacent.value) {\n if (seen.has(id)) continue;\n seen.add(id);\n const row = { id, distance: current.distance + 1 };\n rows.push(row);\n queue.push(row);\n }\n }\n rows.sort(\n (left, right) =>\n left.distance - right.distance || left.id.localeCompare(right.id),\n );\n return {\n rows,\n visitedNodes: queue.length,\n inspectedEdges,\n depthTruncated,\n };\n}\n\nfunction selectContextNodes(params: {\n candidates: readonly DiscoveredNode[];\n details: ReadonlyMap<string, RelationshipContextNodeDetails>;\n graph: RelationshipGraph;\n rootId: string;\n registry: RelationshipKindRegistry;\n nodeLimit: number;\n tokenBudget: number;\n initialTokens: number;\n}): { nodes: RelationshipContextNode[]; usedTokens: number } {\n const nodes: RelationshipContextNode[] = [];\n let usedTokens = params.initialTokens;\n const rootEdges = params.graph.incidentEdges(params.rootId);\n for (const candidate of params.candidates) {\n if (nodes.length >= params.nodeLimit) break;\n const node: RelationshipContextNode = {\n ...(params.details.get(candidate.id) ?? { id: candidate.id }),\n distance: candidate.distance,\n reasons:\n candidate.distance === 1\n ? directReasons(\n rootEdges,\n params.rootId,\n candidate.id,\n params.registry,\n )\n : [`reachable at depth ${candidate.distance}`],\n };\n const cost = estimateTokens(node);\n if (usedTokens + cost > params.tokenBudget) break;\n nodes.push(node);\n usedTokens += cost;\n }\n if (params.candidates.length > 0 && nodes.length === 0)\n throw new TypeError(\"Relationship context tokenBudget cannot fit one node\");\n return { nodes, usedTokens };\n}\n\nfunction selectContextEdges(params: {\n graph: RelationshipGraph;\n included: ReadonlySet<string>;\n edgeLimit: number;\n tokenBudget: number;\n initialTokens: number;\n}): {\n edges: RelationshipEdge[];\n usedTokens: number;\n candidateCount: number;\n} {\n const candidates = params.graph\n .edges()\n .filter(\n (edge) =>\n params.included.has(edge.source) && params.included.has(edge.target),\n );\n const edges: RelationshipEdge[] = [];\n let usedTokens = params.initialTokens;\n for (const edge of candidates) {\n if (edges.length >= params.edgeLimit) break;\n const cost = estimateTokens(edge);\n if (usedTokens + cost > params.tokenBudget) break;\n edges.push(edge);\n usedTokens += cost;\n }\n return { edges, usedTokens, candidateCount: candidates.length };\n}\n\n/** Build one deterministic bounded graph-context packet with continuation. */\nexport function buildRelationshipContext(\n graph: RelationshipGraph,\n rootId: string,\n details: readonly RelationshipContextNodeDetails[],\n options: RelationshipContextOptions = {},\n): RelationshipContextResult {\n if (!graph.nodes().includes(rootId))\n throw new TypeError(`Relationship node not found: ${rootId}`);\n const nodeLimit = positiveInteger(options.nodeLimit, 20, \"nodeLimit\");\n const edgeLimit = positiveInteger(options.edgeLimit, 40, \"edgeLimit\");\n const tokenBudget = positiveInteger(options.tokenBudget, 1200, \"tokenBudget\");\n const registry = options.registry ?? createRelationshipKindRegistry();\n const byId = new Map(details.map((detail) => [detail.id, detail]));\n const rootDetails: RelationshipContextNodeDetails = byId.get(rootId) ?? {\n id: rootId,\n };\n const { evidence: rootEvidence = [], ...root } = rootDetails;\n const evidence = [...rootEvidence];\n const discovery = discoverNodes(graph, rootId, options);\n const fingerprint = createQueryFingerprint(\"relationship-context\", {\n rootId,\n direction: options.direction ?? \"both\",\n kinds: [...(options.kinds ?? [])].sort(),\n maxDepth: options.maxDepth ?? 3,\n });\n const pageStart = resolveQueryCursorStart(\n discovery.rows,\n options.cursor,\n fingerprint,\n ({ id }) => id,\n );\n const candidates = discovery.rows.slice(pageStart);\n const initialTokens = estimateTokens(root) + estimateTokens(evidence);\n if (initialTokens > tokenBudget)\n throw new TypeError(\n \"Relationship context tokenBudget cannot fit root and evidence\",\n );\n const nodeSelection = selectContextNodes({\n candidates,\n details: byId,\n graph,\n rootId,\n registry,\n nodeLimit,\n tokenBudget,\n initialTokens,\n });\n const { nodes } = nodeSelection;\n\n const included = new Set([rootId, ...nodes.map(({ id }) => id)]);\n const edgeSelection = selectContextEdges({\n graph,\n included,\n edgeLimit,\n tokenBudget,\n initialTokens: nodeSelection.usedTokens,\n });\n const { edges, usedTokens } = edgeSelection;\n\n const consumed = pageStart + nodes.length;\n const hasMoreNodes = consumed < discovery.rows.length;\n const lastNode = nodes.at(-1);\n const omittedEdges = edgeSelection.candidateCount - edges.length;\n const truncated =\n discovery.depthTruncated || hasMoreNodes || omittedEdges > 0;\n return {\n root,\n nodes,\n edges,\n evidence,\n meta: {\n exact: true,\n truncated,\n nodeLimit,\n edgeLimit,\n tokenBudget,\n usedTokens,\n visitedNodes: discovery.visitedNodes,\n inspectedEdges: discovery.inspectedEdges,\n omittedNodes: discovery.rows.length - consumed,\n omittedEdges,\n ...(hasMoreNodes && lastNode\n ? {\n nextCursor: encodeQueryCursor(\n fingerprint,\n lastNode.id,\n consumed - 1,\n ),\n }\n : {}),\n },\n };\n}\n","/**\n * @module sdk/dependencies\n *\n * Implements the pm deps command surface and its agent-facing runtime behavior.\n */\nimport { getActiveExtensionRegistrations } from \"../core/extensions/index.js\";\nimport { pathExists } from \"../core/fs/fs-utils.js\";\nimport { resolveItemTypeRegistry } from \"../core/item/type-registry.js\";\nimport { isTerminalStatus } from \"../core/item/status.js\";\nimport { resolveRuntimeStatusRegistry } from \"../core/schema/runtime-schema.js\";\nimport { EXIT_CODE } from \"../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../core/shared/command-types.js\";\nimport { PmCliError } from \"../core/shared/errors.js\";\nimport { listAllItemMetadataLight } from \"../core/store/item-store.js\";\nimport { getSettingsPath, resolvePmRoot } from \"../core/store/paths.js\";\nimport { readSettings } from \"../core/store/settings.js\";\nimport type {\n Dependency,\n ItemMetadata,\n ItemStatus,\n ItemType,\n} from \"../types/index.js\";\nimport {\n buildRelationshipContext,\n type RelationshipContextResult,\n} from \"./relationship-context.js\";\nimport { RelationshipGraph } from \"./relationships.js\";\n\n/** Supported values accepted by the deps format contract. */\nexport const DEPS_FORMAT_VALUES = [\"tree\", \"graph\", \"context\"] as const;\n/** Restricts deps format values accepted by command, SDK, and storage contracts. */\nexport type DepsFormat = (typeof DEPS_FORMAT_VALUES)[number];\n/** Supported values accepted by the deps collapse contract. */\nexport const DEPS_COLLAPSE_VALUES = [\"none\", \"repeated\"] as const;\n/** Restricts deps collapse mode values accepted by command, SDK, and storage contracts. */\nexport type DepsCollapseMode = (typeof DEPS_COLLAPSE_VALUES)[number];\n\n/** Documents the deps command options payload exchanged by command, SDK, and package integrations. */\nexport interface DepsCommandOptions {\n /** Value that configures or reports format for this contract. */\n format?: string;\n /** Value that configures or reports max depth for this contract. */\n maxDepth?: string | number;\n /** Value that configures or reports collapse for this contract. */\n collapse?: string;\n /** Value that configures or reports summary for this contract. */\n summary?: boolean;\n /** Maximum graph-context nodes returned. */\n nodeLimit?: string | number;\n /** Maximum graph-context edges returned. */\n edgeLimit?: string | number;\n /** Maximum estimated graph-context output tokens. */\n tokenBudget?: string | number;\n /** Opaque continuation cursor for graph-context output. */\n cursor?: string;\n}\n\ninterface IndexedItem {\n id: string;\n title: string;\n type: ItemType;\n status: ItemStatus;\n dependencies: IndexedDependency[];\n}\n\ninterface IndexedDependency {\n id: string;\n kind: string;\n}\n\n/** Minimal item shape inspected by dependency-reference governance. */\nexport interface DependencyReferenceHolder {\n /** Stable item identifier. */\n id: string;\n /** Lifecycle status used to separate actionable work from historical debt. */\n status: ItemStatus;\n /** Optional hierarchy parent reference. */\n parent?: string;\n /** Optional legacy scalar blocker reference. */\n blocked_by?: string;\n /** Structured dependency edges. */\n dependencies?: Dependency[];\n}\n\n/** Storage surface that contributed a normalized dependency reference. */\nexport type DependencyReferenceSource = \"parent\" | \"blocked_by\" | \"dependency\";\n\n/** One normalized dependency reference whose target is absent from the tracker. */\nexport interface DanglingDependencyReference {\n /** Item that owns the reference. */\n holder_id: string;\n /** Missing referenced item id or legacy sentinel. */\n target_id: string;\n /** Relationship field or dependency kind. */\n kind: string;\n /** Storage surface that owns the reference and determines its remediation. */\n source: DependencyReferenceSource;\n /** Current lifecycle status of the holder. */\n holder_status: ItemStatus;\n /** Whether the holder is terminal and therefore historical, non-actionable debt. */\n legacy_terminal: boolean;\n /** Whether the target is the pre-structured-dependency `no-active-blocker` sentinel. */\n no_active_blocker_sentinel: boolean;\n}\n\n/** Actionable and historical partitions returned by dependency-reference governance. */\nexport interface DanglingDependencyReferenceSummary {\n /** Missing references held by active items; these may affect scheduling and should gate validation. */\n active: DanglingDependencyReference[];\n /** Missing references held only by terminal items; retained as informational history debt. */\n legacy_terminal: DanglingDependencyReference[];\n /** Legacy sentinel rows across active and terminal holders, called out separately from typo-like ids. */\n no_active_blocker_sentinels: DanglingDependencyReference[];\n}\n\n/** Normalize a decoded reference target and reject empty legacy placeholders. */\nfunction normalizeDependencyReferenceTarget(target: unknown): string | undefined {\n if (typeof target !== \"string\") return undefined;\n const normalized = target.trim();\n if (!normalized || [\"none\", \"null\", \"n/a\", \"na\"].includes(normalized.toLowerCase())) return undefined;\n return normalized;\n}\n\n/** Normalize a graph target while removing the historical no-blocker marker. */\nfunction normalizeDependencyGraphTarget(target: unknown): string | undefined {\n const normalized = normalizeDependencyReferenceTarget(target);\n return normalized?.toLowerCase() === \"no-active-blocker\" ? undefined : normalized;\n}\n\n/**\n * Classify missing hierarchy and dependency targets without mutating their holders.\n *\n * Consumers provide the workspace's terminal-status predicate so custom lifecycle\n * schemas receive the same active-versus-historical behavior as the built-in\n * closed/canceled statuses.\n */\nexport function collectDanglingDependencyReferences(\n items: readonly DependencyReferenceHolder[],\n isTerminal: (status: ItemStatus) => boolean = (status) =>\n status === \"closed\" || status === \"canceled\",\n): DanglingDependencyReferenceSummary {\n const knownIds = new Set(items.map((item) => item.id.trim().toLowerCase()));\n const rows = new Map<string, DanglingDependencyReference>();\n const addReference = (\n item: DependencyReferenceHolder,\n target: unknown,\n kind: string,\n source: DependencyReferenceSource,\n ): void => {\n const normalized = normalizeDependencyReferenceTarget(target);\n if (!normalized || knownIds.has(normalized.toLowerCase())) {\n return;\n }\n const row: DanglingDependencyReference = {\n holder_id: item.id,\n target_id: normalized,\n kind,\n source,\n holder_status: item.status,\n legacy_terminal: isTerminal(item.status),\n no_active_blocker_sentinel:\n normalized.toLowerCase() === \"no-active-blocker\",\n };\n rows.set(\n `${row.holder_id}::${row.target_id}::${row.kind}::${row.source}`,\n row,\n );\n };\n for (const item of items) {\n addReference(item, item.parent, \"parent\", \"parent\");\n addReference(item, item.blocked_by, \"blocked_by\", \"blocked_by\");\n for (const dependency of item.dependencies ?? []) {\n // Public SDK callers may supply legacy or JSON-decoded payloads that do\n // not yet satisfy the current structured dependency contract.\n if (typeof dependency !== \"object\" || dependency === null) {\n continue;\n }\n const legacyDependency = dependency as Partial<Dependency>;\n addReference(\n item,\n legacyDependency.id,\n typeof legacyDependency.kind === \"string\"\n ? legacyDependency.kind\n : \"related\",\n \"dependency\",\n );\n }\n }\n const sorted = [...rows.values()].sort(\n (left, right) =>\n left.holder_id.localeCompare(right.holder_id) ||\n left.target_id.localeCompare(right.target_id) ||\n left.kind.localeCompare(right.kind) ||\n left.source.localeCompare(right.source),\n );\n const legacyTerminal = sorted.filter((row) => row.legacy_terminal);\n return {\n active: sorted.filter((row) => !row.legacy_terminal),\n legacy_terminal: legacyTerminal,\n no_active_blocker_sentinels: sorted.filter(\n (row) => row.no_active_blocker_sentinel,\n ),\n };\n}\n\n/** Return unique real missing targets while excluding the legacy no-blocker sentinel. */\nfunction collectMissingDependencyTargetIds(\n dangling: DanglingDependencyReferenceSummary,\n): string[] {\n const targets = new Map<string, string>();\n for (const reference of [...dangling.active, ...dangling.legacy_terminal]) {\n if (reference.no_active_blocker_sentinel) continue;\n const target = reference.target_id.trim();\n const key = target.toLowerCase();\n if (!targets.has(key)) targets.set(key, target);\n }\n return [...targets.values()].sort((left, right) => left.localeCompare(right));\n}\n\n/** Documents the deps tree node payload exchanged by command, SDK, and package integrations. */\nexport interface DepsTreeNode {\n /** Stable identifier used to reference this record across commands and storage. */\n id: string;\n /** Value that configures or reports title for this contract. */\n title?: string;\n /** Schema type that determines the shape and validation rules for this value. */\n type?: ItemType;\n /** Lifecycle state reported for status. */\n status?: ItemStatus;\n /** Value that configures or reports via for this contract. */\n via?: string;\n /** Value that configures or reports missing for this contract. */\n missing: boolean;\n /** Value that configures or reports cycle for this contract. */\n cycle: boolean;\n /** Value that configures or reports truncated for this contract. */\n truncated?: boolean;\n /** Value that configures or reports collapsed for this contract. */\n collapsed?: boolean;\n /** Value that configures or reports dependencies for this contract. */\n dependencies: DepsTreeNode[];\n}\n\n/** Documents the deps graph node payload exchanged by command, SDK, and package integrations. */\nexport interface DepsGraphNode {\n /** Stable identifier used to reference this record across commands and storage. */\n id: string;\n /** Value that configures or reports title for this contract. */\n title?: string;\n /** Schema type that determines the shape and validation rules for this value. */\n type?: ItemType;\n /** Lifecycle state reported for status. */\n status?: ItemStatus;\n /** Value that configures or reports missing for this contract. */\n missing: boolean;\n}\n\n/** Documents the deps graph edge payload exchanged by command, SDK, and package integrations. */\nexport interface DepsGraphEdge {\n /** Value that configures or reports from for this contract. */\n from: string;\n /** Value that configures or reports to for this contract. */\n to: string;\n /** Value that configures or reports kind for this contract. */\n kind: string;\n}\n\n/** Documents the deps graph result payload exchanged by command, SDK, and package integrations. */\nexport interface DepsGraphResult {\n /** Value that configures or reports root id for this contract. */\n root_id: string;\n /** Value that configures or reports nodes for this contract. */\n nodes: DepsGraphNode[];\n /** Value that configures or reports edges for this contract. */\n edges: DepsGraphEdge[];\n /** Value that configures or reports missing ids for this contract. */\n missing_ids: string[];\n}\n\n/** Documents the deps result payload exchanged by command, SDK, and package integrations. */\nexport interface DepsResult {\n /** Stable identifier used to reference this record across commands and storage. */\n id: string;\n /** Value that configures or reports format for this contract. */\n format: DepsFormat;\n /** Number of node entries represented by this result. */\n node_count: number;\n /** Number of edge entries represented by this result. */\n edge_count: number;\n /** Number of missing entries represented by this result. */\n missing_count: number;\n /** Value that configures or reports tree for this contract. */\n tree?: DepsTreeNode;\n /** Value that configures or reports graph for this contract. */\n graph?: DepsGraphResult;\n /** Explainable bounded graph-context projection. */\n context?: RelationshipContextResult;\n}\n\nfunction parseFormat(raw: string | undefined): DepsFormat {\n const candidate = raw?.trim().toLowerCase() ?? \"tree\";\n if ((DEPS_FORMAT_VALUES as readonly string[]).includes(candidate)) {\n return candidate as DepsFormat;\n }\n throw new PmCliError(\n `Invalid --format value \"${raw}\". Use \"tree\", \"graph\", or \"context\".`,\n EXIT_CODE.USAGE,\n );\n}\n\nfunction parsePositiveInteger(raw: string | number | undefined, flag: string): number | undefined {\n if (raw === undefined) return undefined;\n const value = typeof raw === \"number\" ? raw : Number(raw.trim());\n if (!Number.isInteger(value) || value < 1)\n throw new PmCliError(`Invalid --${flag} value \"${raw}\". Use a positive integer.`, EXIT_CODE.USAGE);\n return value;\n}\n\nfunction parseMaxDepth(raw: string | number | undefined): number | undefined {\n if (raw === undefined) {\n return undefined;\n }\n const normalized = typeof raw === \"number\" ? raw : Number(raw.trim());\n if (!Number.isInteger(normalized) || normalized < 0) {\n throw new PmCliError(\n `Invalid --max-depth value \"${raw}\". Use a non-negative integer.`,\n EXIT_CODE.USAGE,\n );\n }\n return normalized;\n}\n\nfunction parseCollapse(raw: string | undefined): DepsCollapseMode {\n const candidate = raw?.trim().toLowerCase() ?? \"none\";\n if ((DEPS_COLLAPSE_VALUES as readonly string[]).includes(candidate)) {\n return candidate as DepsCollapseMode;\n }\n throw new PmCliError(\n `Invalid --collapse value \"${raw}\". Use \"none\" or \"repeated\".`,\n EXIT_CODE.USAGE,\n );\n}\n\nfunction normalizeDependencies(\n dependencies: Dependency[] | undefined,\n): IndexedDependency[] {\n if (!dependencies || dependencies.length === 0) {\n return [];\n }\n const sorted = dependencies.map(({ id, kind }) => ({\n id: id.trim(),\n kind: kind.trim().toLowerCase(),\n })).sort((left, right) => {\n const byKind = left.kind.localeCompare(right.kind);\n if (byKind !== 0) return byKind;\n return left.id.localeCompare(right.id);\n });\n const deduped = new Map<string, IndexedDependency>();\n for (const dependency of sorted) {\n const key = `${dependency.kind.toLowerCase()}::${dependency.id.toLowerCase()}`;\n if (!deduped.has(key)) {\n deduped.set(key, { id: dependency.id, kind: dependency.kind });\n }\n }\n return [...deduped.values()];\n}\n\nfunction toIndexedItem(item: ItemMetadata): IndexedItem {\n return {\n id: item.id,\n title: item.title,\n type: item.type,\n status: item.status,\n dependencies: normalizeDependencies(item.dependencies),\n };\n}\n\nfunction toTreeNode(\n id: string,\n index: Map<string, IndexedItem>,\n lineage: Set<string>,\n maxDepth: number | undefined,\n collapse: DepsCollapseMode,\n expanded: Set<string>,\n depth = 0,\n via?: string,\n): DepsTreeNode {\n const lookupId = id.trim().toLowerCase();\n const item = index.get(lookupId);\n const baseNode: DepsTreeNode = {\n id: item?.id ?? id,\n title: item?.title,\n type: item?.type,\n status: item?.status,\n via,\n missing: !item,\n cycle: lineage.has(lookupId),\n dependencies: [],\n };\n if (!item || baseNode.cycle) {\n return baseNode;\n }\n if (maxDepth !== undefined && depth >= maxDepth) {\n if (item.dependencies.length > 0) {\n baseNode.truncated = true;\n }\n return baseNode;\n }\n if (collapse === \"repeated\" && expanded.has(lookupId)) {\n baseNode.collapsed = true;\n return baseNode;\n }\n if (collapse === \"repeated\") {\n expanded.add(lookupId);\n }\n const nextLineage = new Set(lineage);\n nextLineage.add(lookupId);\n baseNode.dependencies = item.dependencies.map((dependency) =>\n toTreeNode(\n dependency.id,\n index,\n nextLineage,\n maxDepth,\n collapse,\n expanded,\n depth + 1,\n dependency.kind,\n ),\n );\n return baseNode;\n}\n\nfunction mergeGraphNode(\n existing: DepsGraphNode | undefined,\n candidate: DepsGraphNode,\n): DepsGraphNode {\n if (!existing) {\n return candidate;\n }\n /* c8 ignore start -- defensive: mixed missing/non-missing duplicates only occur in malformed synthetic trees. */\n if (existing.missing && !candidate.missing) return candidate;\n /* c8 ignore stop */\n return {\n ...existing,\n title: existing.title ?? candidate.title,\n type: existing.type ?? candidate.type,\n status: existing.status ?? candidate.status,\n };\n}\n\nfunction toGraph(root: DepsTreeNode): DepsGraphResult {\n const nodesById = new Map<string, DepsGraphNode>();\n const edgesByKey = new Map<string, DepsGraphEdge>();\n\n const visit = (node: DepsTreeNode): void => {\n nodesById.set(\n node.id,\n mergeGraphNode(nodesById.get(node.id), {\n id: node.id,\n title: node.title,\n type: node.type,\n status: node.status,\n missing: node.missing,\n }),\n );\n for (const child of node.dependencies) {\n nodesById.set(\n child.id,\n mergeGraphNode(nodesById.get(child.id), {\n id: child.id,\n title: child.title,\n type: child.type,\n status: child.status,\n missing: child.missing,\n }),\n );\n /* c8 ignore start -- legacy malformed dependency payloads may omit kind/via. */\n const relationKind = child.via ?? \"related\";\n const edgeKey = `${node.id}::${child.id}::${relationKind}`;\n if (!edgesByKey.has(edgeKey)) {\n edgesByKey.set(edgeKey, {\n from: node.id,\n to: child.id,\n kind: relationKind,\n });\n }\n /* c8 ignore stop */\n if (!child.cycle) {\n visit(child);\n }\n }\n };\n\n visit(root);\n\n const nodes = [...nodesById.values()].sort((left, right) =>\n left.id.localeCompare(right.id),\n );\n const edges = [...edgesByKey.values()].sort((left, right) => {\n const byFrom = left.from.localeCompare(right.from);\n if (byFrom !== 0) return byFrom;\n const byTo = left.to.localeCompare(right.to);\n if (byTo !== 0) return byTo;\n return left.kind.localeCompare(right.kind);\n });\n const missingIds = nodes\n .filter((node) => node.missing)\n .map((node) => node.id);\n return {\n root_id: root.id,\n nodes,\n edges,\n missing_ids: missingIds,\n };\n}\n\n/** Count a dependency result without allocating its potentially exponential tree payload. */\nfunction countDependencyGraph(\n rootId: string,\n index: Map<string, IndexedItem>,\n maxDepth: number | undefined,\n): Pick<DepsResult, \"node_count\" | \"edge_count\" | \"missing_count\"> {\n const nodeIds = new Set<string>();\n const edgeKeys = new Set<string>();\n const missingIds = new Set<string>();\n const expanded = new Set<string>();\n const pending = [{ id: rootId, depth: 0 }];\n let pendingIndex = 0;\n while (pendingIndex < pending.length) {\n const current = pending[pendingIndex++]!;\n const lookupId = current.id.trim().toLowerCase();\n nodeIds.add(lookupId);\n const item = index.get(lookupId);\n if (!item) {\n missingIds.add(lookupId);\n continue;\n }\n if (maxDepth !== undefined && current.depth >= maxDepth) {\n continue;\n }\n if (expanded.has(lookupId)) {\n continue;\n }\n expanded.add(lookupId);\n for (const dependency of item.dependencies) {\n edgeKeys.add(\n `${lookupId}::${dependency.id.trim().toLowerCase()}::${dependency.kind}`,\n );\n pending.push({ id: dependency.id, depth: current.depth + 1 });\n }\n }\n return {\n node_count: nodeIds.size,\n edge_count: edgeKeys.size,\n missing_count: missingIds.size,\n };\n}\n\n/** Build the SDK-backed bounded relationship-context projection for deps. */\nexport function buildDepsRelationshipContext(\n rootId: string,\n items: readonly ItemMetadata[],\n options: Pick<DepsCommandOptions, \"maxDepth\" | \"nodeLimit\" | \"edgeLimit\" | \"tokenBudget\" | \"cursor\">,\n): RelationshipContextResult {\n const maxDepth = parseMaxDepth(options.maxDepth);\n const nodeLimit = parsePositiveInteger(options.nodeLimit, \"node-limit\");\n const edgeLimit = parsePositiveInteger(options.edgeLimit, \"edge-limit\");\n const tokenBudget = parsePositiveInteger(options.tokenBudget, \"token-budget\");\n const canonicalIds = new Map(items.map((item) => [item.id.trim().toLowerCase(), item.id.trim()]));\n const dangling = collectDanglingDependencyReferences(items);\n const missingIds = collectMissingDependencyTargetIds(dangling);\n const graphItems = items.map((item) => {\n const parent = normalizeDependencyGraphTarget(item.parent);\n const blocker = normalizeDependencyGraphTarget(item.blocked_by);\n const dependencies = (item.dependencies ?? []).flatMap((rawDependency) => {\n if (typeof rawDependency !== \"object\" || rawDependency === null) return [];\n const dependency = rawDependency as Partial<Dependency>;\n const target = normalizeDependencyGraphTarget(dependency.id);\n if (!target) return [];\n return [{\n id: canonicalIds.get(target.toLowerCase()) ?? target,\n kind: typeof dependency.kind === \"string\" ? dependency.kind : \"related\",\n }];\n });\n return {\n id: item.id,\n ...(parent ? { parent: canonicalIds.get(parent.toLowerCase()) ?? parent } : {}),\n ...(blocker ? { blocked_by: canonicalIds.get(blocker.toLowerCase()) ?? blocker } : {}),\n dependencies,\n };\n });\n return buildRelationshipContext(\n RelationshipGraph.fromItems([...graphItems, ...missingIds.map((id) => ({ id }))]),\n rootId,\n [\n ...items.map((item) => ({ id: item.id, title: item.title, status: item.status })),\n ...missingIds.map((id) => ({ id, title: `[missing] ${id}`, status: \"missing\" })),\n ],\n {\n ...(maxDepth === undefined ? {} : { maxDepth }),\n ...(nodeLimit === undefined ? {} : { nodeLimit }),\n ...(edgeLimit === undefined ? {} : { edgeLimit }),\n ...(tokenBudget === undefined ? {} : { tokenBudget }),\n ...(options.cursor?.trim() ? { cursor: options.cursor.trim() } : {}),\n },\n );\n}\n\n/** Implements run deps for the public runtime surface of this module. */\nexport async function runDeps(\n id: string,\n options: DepsCommandOptions,\n global: GlobalOptions,\n): Promise<DepsResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(\n `Tracker is not initialized at ${pmRoot}. Run pm init first.`,\n EXIT_CODE.NOT_FOUND,\n );\n }\n const format = parseFormat(options.format);\n const maxDepth = parseMaxDepth(options.maxDepth);\n const collapse = parseCollapse(options.collapse);\n const summaryOnly = options.summary === true;\n const settings = await readSettings(pmRoot);\n const typeRegistry = resolveItemTypeRegistry(\n settings,\n getActiveExtensionRegistrations(),\n );\n const items = await listAllItemMetadataLight(\n pmRoot,\n settings.item_format,\n typeRegistry.type_to_folder,\n undefined,\n settings.schema,\n );\n const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);\n const index = new Map(\n items.map((item) => [item.id.trim().toLowerCase(), toIndexedItem(item)]),\n );\n const dangling = collectDanglingDependencyReferences(\n items,\n (status) => isTerminalStatus(status, statusRegistry),\n );\n for (const reference of [...dangling.active, ...dangling.legacy_terminal]) {\n const holder = index.get(reference.holder_id.trim().toLowerCase());\n const referenceKind = reference.kind.trim().toLowerCase();\n if (\n holder &&\n !holder.dependencies.some(\n (dependency) =>\n dependency.id.trim().toLowerCase() === reference.target_id.trim().toLowerCase() &&\n dependency.kind === referenceKind,\n )\n ) {\n holder.dependencies.push({ id: reference.target_id, kind: referenceKind });\n }\n }\n if (!index.has(id.trim().toLowerCase())) {\n throw new PmCliError(`Item ${id} not found`, EXIT_CODE.NOT_FOUND);\n }\n\n if (format === \"context\") {\n const canonicalId = index.get(id.trim().toLowerCase())!.id;\n const context = buildDepsRelationshipContext(canonicalId, items, options);\n return {\n id: canonicalId,\n format,\n node_count: context.nodes.length + 1,\n edge_count: context.edges.length,\n missing_count: collectMissingDependencyTargetIds(dangling).length,\n ...(summaryOnly ? {} : { context }),\n };\n }\n\n if (summaryOnly) {\n return {\n id,\n format,\n ...countDependencyGraph(id, index, maxDepth),\n };\n }\n\n const tree = toTreeNode(\n id,\n index,\n new Set<string>(),\n maxDepth,\n collapse,\n new Set<string>(),\n );\n const graph = toGraph(tree);\n const baseResult = {\n id,\n format,\n node_count: graph.nodes.length,\n edge_count: graph.edges.length,\n missing_count: graph.missing_ids.length,\n };\n if (format === \"tree\") {\n return {\n ...baseResult,\n tree,\n };\n }\n return {\n ...baseResult,\n graph,\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAkHA,IAAM,6BAAoE;EACxE;IACE,MAAM;IACN,WAAW;IACX,SAAS;IACT,UAAU;IACV,YAAY;IACZ,WAAW;IACX,UAAU;IACV,UAAU;IACV,WAAW;IACX,SAAS,CAAC,YAAY;IACtB,sBAAsB;IACtB,WAAW;;EAEb;IACE,MAAM;IACN,WAAW;IACX,SAAS;IACT,UAAU;IACV,YAAY;IACZ,WAAW;IACX,UAAU;IACV,UAAU;IACV,WAAW;IACX,sBAAsB;IACtB,WAAW;;EAEb;IACE,MAAM;IACN,WAAW;IACX,SAAS;IACT,UAAU;IACV,WAAW;IACX,oBAAoB;IACpB,UAAU;IACV,UAAU;IACV,WAAW;IACX,SAAS,CAAC,YAAY,MAAM;IAC5B,sBAAsB;IACtB,WAAW;;EAEb;IACE,MAAM;IACN,WAAW;IACX,SAAS;IACT,UAAU;IACV,WAAW;IACX,oBAAoB;IACpB,UAAU;IACV,UAAU;IACV,WAAW;IACX,SAAS,CAAC,gBAAgB,MAAM;IAChC,sBAAsB;IACtB,WAAW;;EAEb;IACE,MAAM;IACN,WAAW;IACX,UAAU;IACV,WAAW;IACX,UAAU;IACV,UAAU;IACV,WAAW;IACX,SAAS,CAAC,YAAY;IACtB,sBAAsB;IACtB,WAAW;;EAEb;IACE,MAAM;IACN,WAAW;IACX,UAAU;IACV,WAAW;IACX,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AAI,GAAG,KAAI,EAAG,YAAW,CAAE,GAAG;AACvC,UAAM,IAAI,WAAW,QAAQ,EAAE,cAAc,UAAU,SAAS;EAClE;AAEA,MAAI,WAAW,WAAW;AACxB,UAAM,cAAc,MAAM,IAAI,GAAG,KAAI,EAAG,YAAW,CAAE,EAAG;AACxD,UAAM,UAAU,6BAA6B,aAAa,OAAO,OAAO;AACxE,WAAO;MACL,IAAI;MACJ;MACA,YAAY,QAAQ,MAAM,SAAS;MACnC,YAAY,QAAQ,MAAM;MAC1B,eAAe,kCAAkC,QAAQ,EAAE;MAC3D,GAAI,cAAc,CAAA,IAAK,EAAE,QAAO;;EAEpC;AAEA,MAAI,aAAa;AACf,WAAO;MACL;MACA;MACA,GAAG,qBAAqB,IAAI,OAAO,QAAQ;;EAE/C;AAEA,QAAM,OAAO,WACX,IACA,OACA,oBAAI,IAAG,GACP,UACA,UACA,oBAAI,IAAG,CAAU;AAEnB,QAAM,QAAQ,QAAQ,IAAI;AAC1B,QAAM,aAAa;IACjB;IACA;IACA,YAAY,MAAM,MAAM;IACxB,YAAY,MAAM,MAAM;IACxB,eAAe,MAAM,YAAY;;AAEnC,MAAI,WAAW,QAAQ;AACrB,WAAO;MACL,GAAG;MACH;;EAEJ;AACA,SAAO;IACL,GAAG;IACH;;AAEJ","debugId":"fd394844-de95-5cab-9dd6-7c4ef4e52320"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../core/output/tabular.ts","../../../../../../../../cli/register-list-query.ts"],"sourcesContent":["/**\n * @module core/output/tabular\n *\n * Renders projected item rows as CSV or fixed-width text tables for human\n * export. These are presentation-only modes (GH-154): agents continue to read\n * the structured `--json`/TOON output, while humans piping `pm list` into a\n * spreadsheet or terminal get a directly consumable shape.\n */\n\n/** A projected row: a flat map of column name to scalar/collection cell value. */\nexport type TabularRow = Record<string, unknown>;\n\n/** Collects the ordered union of column names across every row, preserving the order in which each key is first encountered so the rendered columns mirror the projection field order rather than an arbitrary object-key order. */\nfunction resolveColumns(rows: TabularRow[]): string[] {\n const columns: string[] = [];\n const seen = new Set<string>();\n for (const row of rows) {\n for (const key of Object.keys(row)) {\n if (!seen.has(key)) {\n seen.add(key);\n columns.push(key);\n }\n }\n }\n return columns;\n}\n\n/** Converts a single cell value to its flat string form. Arrays join with `;` (spreadsheet-friendly and unambiguous against the CSV `,` delimiter), objects serialize to compact JSON, and null/undefined render as an empty cell. */\nfunction renderCell(value: unknown): string {\n if (value === null || value === undefined) {\n return \"\";\n }\n if (Array.isArray(value)) {\n return value.map((entry) => renderCell(entry)).join(\";\");\n }\n if (typeof value === \"object\") {\n return JSON.stringify(value);\n }\n return String(value);\n}\n\n/** Escapes a CSV field per RFC 4180: values containing the delimiter, a quote, or a line break are wrapped in double quotes with embedded quotes doubled. */\nfunction escapeCsvField(value: string): string {\n if (/[\",\\r\\n]/.test(value)) {\n return `\"${value.replace(/\"/g, '\"\"')}\"`;\n }\n return value;\n}\n\n/** Renders rows as RFC 4180 CSV with a header row of column names. Returns an empty string when there are no rows so callers emit nothing rather than a stray blank line. */\nexport function renderRowsAsCsv(rows: TabularRow[]): string {\n if (rows.length === 0) {\n return \"\";\n }\n const columns = resolveColumns(rows);\n const lines = [columns.map((column) => escapeCsvField(column)).join(\",\")];\n for (const row of rows) {\n lines.push(\n columns\n .map((column) => escapeCsvField(renderCell(row[column])))\n .join(\",\"),\n );\n }\n return lines.join(\"\\n\");\n}\n\n/** Renders rows as a fixed-width text table: a header row, a dashed separator, and one padded row per item. Columns are widened to fit their widest cell so the output stays aligned in a monospace terminal. Returns an empty string when there are no rows. */\nexport function renderRowsAsTable(rows: TabularRow[]): string {\n if (rows.length === 0) {\n return \"\";\n }\n const columns = resolveColumns(rows);\n const cells = rows.map((row) =>\n columns.map((column) => renderCell(row[column])),\n );\n const widths = columns.map((column, index) =>\n Math.max(column.length, ...cells.map((rowCells) => rowCells[index].length)),\n );\n const pad = (value: string, index: number): string =>\n value.padEnd(widths[index]);\n const lines = [\n columns.map((column, index) => pad(column, index)).join(\" | \"),\n ];\n lines.push(widths.map((width) => \"-\".repeat(width)).join(\"-+-\"));\n for (const rowCells of cells) {\n lines.push(rowCells.map((value, index) => pad(value, index)).join(\" | \"));\n }\n return lines.join(\"\\n\");\n}\n","/**\n * @module cli/register-list-query\n *\n * Provides CLI runtime support for Register List Query.\n */\nimport type { Command } from \"commander\";\nimport { EXIT_CODE } from \"../core/shared/constants.js\";\nimport { PmCliError } from \"../core/shared/errors.js\";\nimport { renderRowsAsCsv, renderRowsAsTable } from \"../core/output/tabular.js\";\nimport { runActivity } from \"./commands/activity.js\";\nimport { runAggregate } from \"./commands/aggregate.js\";\nimport {\n renderContextMarkdown,\n runContext,\n resolveContextOutputFormat,\n} from \"./commands/context.js\";\nimport { runEval } from \"./commands/eval.js\";\nimport { runGet } from \"./commands/get.js\";\nimport { runHistory } from \"./commands/history.js\";\nimport { runList } from \"./commands/list.js\";\nimport {\n renderNextMarkdown,\n runNext,\n resolveNextOutputFormat,\n} from \"./commands/next.js\";\nimport { runSearch } from \"./commands/search.js\";\nimport type { ItemStatus } from \"../types/index.js\";\nimport {\n addHiddenOption,\n getGlobalOptions,\n normalizeAggregateOptions,\n normalizeActivityOptions,\n normalizeContextOptions,\n normalizeListOptions,\n normalizeNextOptions,\n normalizeSearchKeywordsInput,\n normalizeSearchOptions,\n printActivityJsonStream,\n printError,\n printListJsonStream,\n printResult,\n resolveActivityStreamMode,\n writeStdout,\n} from \"./registration-helpers.js\";\n\n/** Documents the register list query commands options payload exchanged by command, SDK, and package integrations. */\nexport interface RegisterListQueryCommandsOptions {\n /** Value that configures or reports command filter for this contract. */\n commandFilter?: Set<string>;\n}\n\nfunction shouldRegisterListQueryCommand(\n commandName: string,\n commandFilter?: Set<string>,\n): boolean {\n if (!commandFilter || commandFilter.size === 0) {\n return true;\n }\n if (commandName === \"context\") {\n return commandFilter.has(\"context\") || commandFilter.has(\"ctx\");\n }\n return commandFilter.has(commandName);\n}\n\ntype ReadCommandOutputFormat = \"json\" | \"toon\";\n\ntype ListOutputFormat = \"csv\" | \"table\" | \"json\" | \"toon\";\n\n/** Parses the `pm list --format` value into a supported render mode. csv/table are human export modes; json/toon override the machine output format. Returns undefined when no `--format` was supplied so the global output format applies. */\nfunction parseListFormat(rawFormat: unknown): ListOutputFormat | undefined {\n if (rawFormat === undefined) {\n return undefined;\n }\n if (typeof rawFormat !== \"string\") {\n throw new PmCliError(\n \"List --format must be one of csv|table|json|toon\",\n EXIT_CODE.USAGE,\n );\n }\n const normalized = rawFormat.trim().toLowerCase();\n if (\n normalized === \"csv\" ||\n normalized === \"table\" ||\n normalized === \"json\" ||\n normalized === \"toon\"\n ) {\n return normalized;\n }\n throw new PmCliError(\n \"List --format must be one of csv|table|json|toon\",\n EXIT_CODE.USAGE,\n );\n}\n\nfunction resolveReadCommandOutputFormat(\n commandLabel: string,\n rawFormat: unknown,\n globalOptions: ReturnType<typeof getGlobalOptions>,\n): ReturnType<typeof getGlobalOptions> {\n if (rawFormat === undefined) {\n return globalOptions;\n }\n if (typeof rawFormat !== \"string\") {\n throw new PmCliError(\n `${commandLabel} --format must be one of json|toon`,\n EXIT_CODE.USAGE,\n );\n }\n const normalized = rawFormat.trim().toLowerCase() as ReadCommandOutputFormat;\n if (normalized !== \"json\" && normalized !== \"toon\") {\n throw new PmCliError(\n `${commandLabel} --format must be one of json|toon`,\n EXIT_CODE.USAGE,\n );\n }\n if (globalOptions.json === true && normalized === \"toon\") {\n throw new PmCliError(\n `${commandLabel} cannot combine --json with --format toon`,\n EXIT_CODE.USAGE,\n );\n }\n return {\n ...globalOptions,\n json: normalized === \"json\",\n };\n}\n\nfunction applyDefaultBriefListMode(\n listOptions: ReturnType<typeof normalizeListOptions>,\n defaultBrief: boolean | undefined,\n): void {\n if (\n defaultBrief === true &&\n listOptions.includeBody !== true &&\n listOptions.compact !== true &&\n listOptions.brief !== true &&\n listOptions.full !== true &&\n listOptions.fields === undefined\n ) {\n listOptions.brief = true;\n }\n}\n\nfunction registerContentAndGovernanceFilters(command: Command): void {\n command\n .option(\"--has-notes\", \"Show only items that have notes\")\n .option(\"--has-learnings\", \"Show only items that have learnings\")\n .option(\"--has-files\", \"Show only items that have linked files\")\n .option(\"--has-docs\", \"Show only items that have linked docs\")\n .option(\"--has-tests\", \"Show only items that have linked tests\")\n .option(\"--has-comments\", \"Show only items that have comments\")\n .option(\"--has-deps\", \"Show only items that have dependencies\")\n .option(\"--has-body\", \"Show only items that have a non-empty body\")\n .option(\n \"--has-linked-command\",\n \"Show only items whose linked tests carry a runnable command\",\n )\n .option(\"--no-notes\", \"Show only items that have no notes\")\n .option(\"--no-learnings\", \"Show only items that have no learnings\")\n .option(\"--no-files\", \"Show only items that have no linked files\")\n .option(\"--filter-files-missing\", \"Alias for --no-files\")\n .option(\"--no-docs\", \"Show only items that have no linked docs\")\n .option(\"--filter-docs-missing\", \"Alias for --no-docs\")\n .option(\"--no-tests\", \"Show only items that have no linked tests\")\n .option(\"--no-comments\", \"Show only items that have no comments\")\n .option(\"--no-deps\", \"Show only items that have no dependencies\")\n .option(\"--empty-body\", \"Show only items with an empty body\")\n .option(\n \"--no-linked-command\",\n \"Show only items whose linked tests carry no runnable command\",\n )\n .option(\"--filter-reviewer-missing\", \"Show only items missing reviewer\")\n .option(\"--filter-risk-missing\", \"Show only items missing risk\")\n .option(\"--filter-confidence-missing\", \"Show only items missing confidence\")\n .option(\"--filter-sprint-missing\", \"Show only items missing sprint\")\n .option(\"--filter-release-missing\", \"Show only items missing release\");\n}\n\nasync function runRegisteredListCommand(params: {\n name: string;\n status?: ItemStatus;\n excludeTerminal?: boolean;\n defaultBrief?: boolean;\n options: Record<string, unknown>;\n actionCommand: Command;\n}): Promise<void> {\n const globalOptions = getGlobalOptions(params.actionCommand);\n const startedAt = Date.now();\n const listOptions = normalizeListOptions(params.options);\n applyDefaultBriefListMode(listOptions, params.defaultBrief);\n if (params.excludeTerminal) listOptions.excludeTerminal = true;\n const result = await runList(params.status, listOptions, globalOptions);\n const streamMode = params.options.stream === true;\n const listFormat = parseListFormat(params.options.format);\n const tabular = listFormat === \"csv\" || listFormat === \"table\";\n const effectiveGlobal =\n listFormat === \"json\" || listFormat === \"toon\"\n ? resolveReadCommandOutputFormat(\n \"List\",\n params.options.format,\n globalOptions,\n )\n : globalOptions;\n if (streamMode && !effectiveGlobal.json) {\n throw new PmCliError(\n \"--stream requires --json output mode.\",\n EXIT_CODE.USAGE,\n );\n }\n if (tabular && streamMode) {\n throw new PmCliError(\n \"--format csv|table cannot be combined with --stream (line-delimited JSON).\",\n EXIT_CODE.USAGE,\n );\n }\n if (tabular) {\n const rows = result.items as Array<Record<string, unknown>>;\n const rendered =\n listFormat === \"csv\" ? renderRowsAsCsv(rows) : renderRowsAsTable(rows);\n if (!effectiveGlobal.quiet && rendered.length > 0) {\n writeStdout(`${rendered}\\n`);\n }\n } else if (streamMode) {\n printListJsonStream(params.name, result, effectiveGlobal);\n } else {\n printResult(result, effectiveGlobal);\n }\n if (globalOptions.profile) {\n printError(\n `profile:command=${params.name} took_ms=${Date.now() - startedAt}`,\n );\n }\n}\n\ninterface ListCommandDescriptor {\n name: string;\n description: string;\n status?: ItemStatus;\n excludeTerminal?: boolean;\n allowStatusFilter?: boolean;\n defaultBrief?: boolean;\n}\n\nfunction registerListCommand(\n program: Command,\n descriptor: ListCommandDescriptor,\n): void {\n const {\n name,\n description,\n status,\n excludeTerminal,\n allowStatusFilter,\n defaultBrief,\n } = descriptor;\n const command = program.command(name).description(description);\n if (allowStatusFilter) {\n command.option(\n \"--status <value>\",\n \"Filter by status (use all for no status restriction)\",\n );\n }\n command\n .option(\"--type <value>\", \"Filter by item type\")\n .option(\"--tag <value>\", \"Filter by tag\")\n .option(\"--priority <value>\", \"Filter by priority\")\n .option(\n \"--deadline-before <value>\",\n \"Filter by deadline upper bound (ISO/date string or relative)\",\n )\n .option(\n \"--deadline-after <value>\",\n \"Filter by deadline lower bound (ISO/date string or relative)\",\n )\n .option(\"--today\", \"Filter to items updated since local midnight today\")\n .option(\"--recent\", \"Filter to items updated in the last 7 days\")\n .option(\n \"--updated-after <value>\",\n 'Filter by updated_at lower bound: ISO timestamp or signed relative (e.g. \"-2h\"/\"-7d\" for the past). \"Changed since my last window\" → --updated-after <ISO>',\n )\n .option(\n \"--updated-before <value>\",\n \"Filter by updated_at upper bound: ISO timestamp or signed relative (-2h/+1d)\",\n )\n .option(\n \"--created-after <value>\",\n \"Filter by created_at lower bound: ISO timestamp or signed relative (-2h/+1d)\",\n )\n .option(\n \"--created-before <value>\",\n \"Filter by created_at upper bound: ISO timestamp or signed relative (-2h/+1d)\",\n )\n .option(\n \"--ids <value>\",\n \"Filter by explicit item IDs (comma-separated or repeatable)\",\n )\n .option(\"--assignee <value>\", \"Filter by assignee\")\n .option(\n \"--assignee-filter <value>\",\n \"Filter assignee presence: assigned|unassigned\",\n )\n .option(\"--parent <value>\", \"Filter by parent item ID\")\n .option(\"--sprint <value>\", \"Filter by sprint\")\n .option(\"--release <value>\", \"Filter by release\")\n .option(\n \"--filter-ac-missing\",\n \"Show only items missing acceptance_criteria\",\n )\n .option(\n \"--filter-estimates-missing\",\n \"Show only items missing estimated_minutes\",\n )\n .option(\n \"--filter-resolution-missing\",\n \"Show only terminal items missing resolution\",\n )\n .option(\n \"--filter-metadata-missing\",\n \"Show only items missing any tracked metadata (AC, estimate, or resolution)\",\n )\n .option(\"--limit <n>\", \"Limit returned item count\")\n .option(\n \"--offset <n>\",\n \"Skip the first n matching rows before limit is applied\",\n )\n .option(\n \"--after <cursor>\",\n \"Continue after an opaque next_cursor from a previous list response\",\n )\n .option(\n \"--no-truncate\",\n \"Return every matched row, overriding any --limit (alias: --all)\",\n )\n .option(\"--include-body\", \"Include item body in each returned list row\")\n .option(\n \"--compact\",\n \"Render compact list projection fields (mutually exclusive with --brief/--full/--fields)\",\n )\n .option(\n \"--brief\",\n \"Ultra-compact output: id, status, type, title only (agent-optimized, mutually exclusive with --compact/--full/--fields)\",\n )\n .option(\n \"--full\",\n \"Render full list projection fields (mutually exclusive with --compact/--brief/--fields)\",\n )\n .option(\n \"--fields <value>\",\n \"Render custom comma-separated list fields (mutually exclusive with --compact/--brief/--full; valid: --fields id,title)\",\n )\n .option(\n \"--sort <value>\",\n \"Sort field: priority|deadline|updated_at|created_at|title|parent (aliases: updated, created)\",\n )\n .option(\"--order <value>\", \"Sort order: asc|desc (requires --sort)\")\n .option(\"--tree\", \"Render rows in parent/child tree order\")\n .option(\n \"--tree-depth <n>\",\n \"Maximum recursion depth with --tree (0 keeps root rows only)\",\n )\n .option(\n \"--format <value>\",\n \"Output render mode: csv|table (human export) or json|toon (machine output override)\",\n )\n .option(\"--stream\", \"Emit line-delimited JSON rows (requires --json)\");\n registerContentAndGovernanceFilters(command);\n command.action(async (options: Record<string, unknown>, actionCommand) => {\n await runRegisteredListCommand({\n name,\n status,\n excludeTerminal,\n defaultBrief,\n options,\n actionCommand,\n });\n });\n // Positive alias for --no-truncate (Commander stores the negation as truncate=false).\n addHiddenOption(command, \"--all\", \"Alias for --no-truncate\");\n // Hidden pure snake_case underscore-duplicate alias (kept parse-functional).\n addHiddenOption(command, \"--tags <value>\", \"Alias for --tag\");\n addHiddenOption(\n command,\n \"--assignee_filter <value>\",\n \"Alias for --assignee-filter\",\n );\n addHiddenOption(command, \"--tree_depth <n>\", \"Alias for --tree-depth\");\n // Singular alias so `--filter-estimate-missing` works (matches update-many spelling).\n addHiddenOption(\n command,\n \"--filter-estimate-missing\",\n \"Alias for --filter-estimates-missing\",\n );\n}\n\nasync function runAggregateAction(\n options: Record<string, unknown>,\n command: Command,\n): Promise<void> {\n const globalOptions = getGlobalOptions(command);\n const startedAt = Date.now();\n const result = await runAggregate(\n normalizeAggregateOptions(options),\n globalOptions,\n );\n printResult(result, globalOptions);\n if (globalOptions.profile) {\n printError(`profile:command=aggregate took_ms=${Date.now() - startedAt}`);\n }\n}\n\nasync function runContextAction(\n options: Record<string, unknown>,\n actionCommand: Command,\n): Promise<void> {\n const globalOptions = getGlobalOptions(actionCommand);\n const startedAt = Date.now();\n const normalized = normalizeContextOptions(options);\n const result = await runContext(normalized, globalOptions);\n const outputFormat = resolveContextOutputFormat(normalized, globalOptions);\n if (outputFormat === \"markdown\") {\n if (!globalOptions.quiet) {\n writeStdout(`${renderContextMarkdown(result)}\\n`);\n }\n } else {\n printResult(result, {\n ...globalOptions,\n json: outputFormat === \"json\",\n });\n }\n if (globalOptions.profile) {\n printError(`profile:command=context took_ms=${Date.now() - startedAt}`);\n }\n}\n\nasync function runNextAction(\n options: Record<string, unknown>,\n actionCommand: Command,\n): Promise<void> {\n const globalOptions = getGlobalOptions(actionCommand);\n const startedAt = Date.now();\n const nextOptions = normalizeNextOptions(options);\n const result = await runNext(nextOptions, globalOptions);\n const outputFormat = resolveNextOutputFormat(nextOptions, globalOptions);\n if (outputFormat === \"markdown\") {\n if (!globalOptions.quiet) {\n writeStdout(`${renderNextMarkdown(result)}\\n`);\n }\n } else {\n printResult(result, { ...globalOptions, json: outputFormat === \"json\" });\n }\n if (globalOptions.profile) {\n printError(`profile:command=next took_ms=${Date.now() - startedAt}`);\n }\n}\n\nasync function runSearchAction(\n keywords: string[],\n options: Record<string, unknown>,\n command: Command,\n): Promise<void> {\n const globalOptions = getGlobalOptions(command);\n const startedAt = Date.now();\n const searchOptions = normalizeSearchOptions(options);\n const result = await runSearch(\n normalizeSearchKeywordsInput(keywords),\n {\n ...searchOptions,\n mode:\n typeof searchOptions.mode === \"string\" &&\n searchOptions.mode.trim().length > 0\n ? searchOptions.mode\n : \"keyword\",\n },\n globalOptions,\n );\n printResult(\n result,\n resolveReadCommandOutputFormat(\"Search\", options.format, globalOptions),\n );\n if (globalOptions.profile) {\n printError(`profile:command=search took_ms=${Date.now() - startedAt}`);\n }\n}\n\nasync function runEvalAction(\n options: Record<string, unknown>,\n command: Command,\n): Promise<void> {\n const globalOptions = getGlobalOptions(command);\n const startedAt = Date.now();\n const result = await runEval(\n {\n mode: typeof options.mode === \"string\" ? options.mode : undefined,\n k: typeof options.k === \"string\" ? options.k : undefined,\n failUnder:\n typeof options.failUnder === \"string\" ? options.failUnder : undefined,\n queries:\n typeof options.queries === \"string\" ? options.queries : undefined,\n format: typeof options.format === \"string\" ? options.format : undefined,\n },\n globalOptions,\n );\n printResult(\n result,\n resolveReadCommandOutputFormat(\"Eval\", options.format, globalOptions),\n );\n if (globalOptions.profile) {\n printError(`profile:command=eval took_ms=${Date.now() - startedAt}`);\n }\n if (!result.passed) {\n throw new PmCliError(\n `Eval gate failed: aggregate nDCG@${result.k} ${result.aggregate.ndcg} is below --fail-under ${result.fail_under}`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n}\n\nasync function runGetAction(\n id: string,\n options: Record<string, unknown>,\n command: Command,\n): Promise<void> {\n const globalOptions = getGlobalOptions(command);\n const startedAt = Date.now();\n const result = await runGet(id, globalOptions, {\n depth: typeof options.depth === \"string\" ? options.depth : undefined,\n fields: typeof options.fields === \"string\" ? options.fields : undefined,\n full: Boolean(options.full),\n tree: options.tree === true,\n treeDepth:\n typeof options.treeDepth === \"string\"\n ? options.treeDepth\n : typeof options.tree_depth === \"string\"\n ? options.tree_depth\n : undefined,\n at: typeof options.at === \"string\" ? options.at : undefined,\n });\n printResult(\n result,\n resolveReadCommandOutputFormat(\"Get\", options.format, globalOptions),\n );\n if (globalOptions.profile) {\n printError(`profile:command=get took_ms=${Date.now() - startedAt}`);\n }\n}\n\nasync function runHistoryAction(\n id: string,\n options: Record<string, unknown>,\n command: Command,\n): Promise<void> {\n const globalOptions = getGlobalOptions(command);\n const startedAt = Date.now();\n if (options.compact === true && options.full === true) {\n throw new PmCliError(\n \"History projection options are mutually exclusive. Use either --compact or --full.\",\n EXIT_CODE.USAGE,\n );\n }\n const field = typeof options.field === \"string\" ? options.field : undefined;\n const result = await runHistory(\n id,\n {\n limit: typeof options.limit === \"string\" ? options.limit : undefined,\n compact: options.full === true ? false : true,\n diff: Boolean(options.diff) || field !== undefined,\n field,\n verify: Boolean(options.verify),\n },\n globalOptions,\n );\n printResult(\n result,\n resolveReadCommandOutputFormat(\"History\", options.format, globalOptions),\n );\n if (globalOptions.profile) {\n printError(`profile:command=history took_ms=${Date.now() - startedAt}`);\n }\n}\n\nasync function runActivityAction(\n options: Record<string, unknown>,\n command: Command,\n): Promise<void> {\n const globalOptions = getGlobalOptions(command);\n const startedAt = Date.now();\n if (options.compact === true && options.full === true) {\n throw new PmCliError(\n \"Activity projection options are mutually exclusive. Use either --compact or --full.\",\n EXIT_CODE.USAGE,\n );\n }\n const normalized = normalizeActivityOptions(options);\n const result = await runActivity(normalized, globalOptions);\n const streamMode = resolveActivityStreamMode(options.stream);\n if (streamMode && !globalOptions.json) {\n throw new PmCliError(\n \"--stream requires --json output mode.\",\n EXIT_CODE.USAGE,\n );\n }\n if (streamMode) {\n printActivityJsonStream(result, normalized, globalOptions);\n } else {\n printResult(result, globalOptions);\n }\n if (globalOptions.profile) {\n printError(`profile:command=activity took_ms=${Date.now() - startedAt}`);\n }\n}\n\n/** Implements register list query commands for the public runtime surface of this module. */\nexport function registerListQueryCommands(\n program: Command,\n options?: RegisterListQueryCommandsOptions,\n): void {\n const commandFilter = options?.commandFilter;\n const shouldRegister = (commandName: string): boolean =>\n shouldRegisterListQueryCommand(commandName, commandFilter);\n const listCommandDescriptors: ListCommandDescriptor[] = [\n {\n name: \"list\",\n description: \"List active items with optional filters.\",\n excludeTerminal: true,\n allowStatusFilter: true,\n defaultBrief: true,\n },\n {\n name: \"list-all\",\n description: \"List all items with optional filters.\",\n excludeTerminal: false,\n allowStatusFilter: true,\n },\n {\n name: \"list-draft\",\n description: \"List draft items with optional filters.\",\n status: \"draft\",\n },\n {\n name: \"list-open\",\n description: \"List open items with optional filters.\",\n status: \"open\",\n excludeTerminal: false,\n allowStatusFilter: false,\n defaultBrief: true,\n },\n {\n name: \"list-in-progress\",\n description: \"List in-progress items with optional filters.\",\n status: \"in_progress\",\n excludeTerminal: false,\n allowStatusFilter: false,\n defaultBrief: true,\n },\n {\n name: \"list-blocked\",\n description: \"List blocked items with optional filters.\",\n status: \"blocked\",\n excludeTerminal: false,\n allowStatusFilter: false,\n defaultBrief: true,\n },\n {\n name: \"list-closed\",\n description: \"List closed items with optional filters.\",\n status: \"closed\",\n },\n {\n name: \"list-canceled\",\n description: \"List canceled items with optional filters.\",\n status: \"canceled\",\n },\n ];\n for (const descriptor of listCommandDescriptors) {\n if (shouldRegister(descriptor.name)) {\n registerListCommand(program, descriptor);\n }\n }\n\n if (shouldRegister(\"aggregate\")) {\n const aggregateCommand = program\n .command(\"aggregate\")\n .description(\"Aggregate grouped item counts for governance queries.\")\n .option(\n \"--group-by <value>\",\n \"Comma-separated group-by fields (supported: parent,type,priority,status,assignee,tags,sprint,release)\",\n )\n .option(\"--count\", \"Return grouped counts (default behavior)\")\n .option(\n \"--completion\",\n \"Add open/in_progress/closed/other counts and completion_pct per group\",\n )\n .option(\"--sum <field>\", \"Sum a numeric field per group\")\n .option(\"--avg <field>\", \"Average a numeric field per group\")\n .option(\n \"--include-unparented\",\n \"Include unparented rows when grouping by parent\",\n )\n .option(\"--status <value>\", \"Filter by item status\")\n .option(\"--type <value>\", \"Filter by item type\")\n .option(\"--tag <value>\", \"Filter by tag\")\n .option(\"--priority <value>\", \"Filter by priority\")\n .option(\n \"--deadline-before <value>\",\n \"Filter by deadline upper bound (ISO/date string or relative)\",\n )\n .option(\n \"--deadline-after <value>\",\n \"Filter by deadline lower bound (ISO/date string or relative)\",\n )\n .option(\"--assignee <value>\", \"Filter by assignee\")\n .option(\n \"--assignee-filter <value>\",\n \"Filter assignee presence: assigned|unassigned\",\n )\n .option(\"--parent <value>\", \"Filter by parent item ID\")\n .option(\"--sprint <value>\", \"Filter by sprint\")\n .option(\"--release <value>\", \"Filter by release\");\n // Hidden pure snake_case underscore-duplicate aliases (kept parse-functional).\n addHiddenOption(\n aggregateCommand,\n \"--include_unparented\",\n \"Alias for --include-unparented\",\n );\n addHiddenOption(\n aggregateCommand,\n \"--assignee_filter <value>\",\n \"Alias for --assignee-filter\",\n );\n aggregateCommand.action(runAggregateAction);\n }\n\n if (shouldRegister(\"context\")) {\n const contextCommand = program\n .command(\"context\")\n .alias(\"ctx\")\n .description(\n \"Show a token-efficient project context snapshot for next-work decisions.\",\n )\n .option(\n \"--date <value>\",\n \"Anchor date/time for agenda window calculations (ISO/date string or relative)\",\n )\n .option(\n \"--from <value>\",\n \"Agenda lower bound (ISO/date string or relative)\",\n )\n .option(\n \"--to <value>\",\n \"Agenda upper bound (ISO/date string or relative)\",\n )\n .option(\"--past\", \"Include past agenda entries in bounded windows\")\n .option(\"--type <value>\", \"Filter by item type\")\n .option(\"--tag <value>\", \"Filter by tag\")\n .option(\"--priority <value>\", \"Filter by priority\")\n .option(\"--assignee <value>\", \"Filter by assignee\")\n .option(\n \"--assignee-filter <value>\",\n \"Filter assignee presence: assigned|unassigned\",\n )\n .option(\"--sprint <value>\", \"Filter by sprint\")\n .option(\"--release <value>\", \"Filter by release\")\n .option(\n \"--parent <id>\",\n \"Scope the snapshot to one item's subtree (the item plus all descendants)\",\n )\n .option(\"--limit <n>\", \"Limit focus and agenda rows per section\")\n .option(\n \"--after <cursor>\",\n \"Continue ranked focus after a next_cursor from a previous context response\",\n )\n .option(\n \"--format <value>\",\n \"Context output format override: markdown|toon|json\",\n )\n .option(\n \"--depth <value>\",\n \"Context depth: brief|standard|deep|full (full = every section, no per-section cap)\",\n )\n .option(\n \"--section <value...>\",\n \"Include specific sections (repeatable; overrides --depth)\",\n )\n .option(\n \"--fields <value>\",\n \"Project focus rows to a comma-separated field subset (e.g. id,title,priority)\",\n )\n .option(\n \"--activity-limit <n>\",\n \"Limit recent activity entries (default: settings or 10)\",\n )\n .option(\n \"--stale-threshold <value>\",\n \"Staleness cutoff in days (e.g. 7 or 7d; default: settings or 7)\",\n )\n .option(\n \"--explain-ranking\",\n \"Include the scorer model, per-signal contributions, and ranked candidate ids\",\n );\n // Hidden pure snake_case underscore-duplicate alias (kept parse-functional).\n addHiddenOption(\n contextCommand,\n \"--assignee_filter <value>\",\n \"Alias for --assignee-filter\",\n );\n addHiddenOption(contextCommand, \"--max-items <n>\", \"Alias for --limit\");\n addHiddenOption(\n contextCommand,\n \"--explain_ranking\",\n \"Alias for --explain-ranking\",\n );\n contextCommand.action(runContextAction);\n }\n\n if (shouldRegister(\"next\")) {\n const nextCommand = program\n .command(\"next\")\n .description(\n \"Recommend the next actionable (unblocked, ready) work item with rationale + blocked companion.\",\n )\n .option(\"--type <value>\", \"Filter candidate items by type\")\n .option(\"--tag <value>\", \"Filter candidate items by tag\")\n .option(\"--priority <value>\", \"Filter candidate items by priority\")\n .option(\"--assignee <value>\", \"Filter candidate items by assignee\")\n .option(\n \"--assignee-filter <value>\",\n \"Filter assignee presence: assigned|unassigned\",\n )\n .option(\"--sprint <value>\", \"Filter candidate items by sprint\")\n .option(\"--release <value>\", \"Filter candidate items by release\")\n .option(\n \"--parent <id>\",\n \"Scope to one item's subtree (the item plus all descendants)\",\n )\n .option(\n \"--limit <n>\",\n \"Limit ready rows (default: 5; non-positive falls back to default)\",\n )\n .option(\n \"--blocked-limit <n>\",\n \"Limit blocked rows (default: same as --limit)\",\n )\n .option(\"--ready-only\", \"Omit the blocked companion list\")\n .option(\n \"--include-decisions\",\n \"Include human-gated Decision items in the claimable ready queue\",\n )\n .option(\n \"--format <value>\",\n \"Next output format override: markdown|toon|json\",\n )\n .option(\n \"--explain-ranking\",\n \"Include the scorer model, per-signal contributions, and ranked ready ids\",\n );\n addHiddenOption(\n nextCommand,\n \"--assignee_filter <value>\",\n \"Alias for --assignee-filter\",\n );\n addHiddenOption(\n nextCommand,\n \"--blocked_limit <n>\",\n \"Alias for --blocked-limit\",\n );\n addHiddenOption(nextCommand, \"--ready_only\", \"Alias for --ready-only\");\n addHiddenOption(\n nextCommand,\n \"--explain_ranking\",\n \"Alias for --explain-ranking\",\n );\n nextCommand.action(runNextAction);\n }\n\n if (shouldRegister(\"search\")) {\n const searchCommand = program\n .command(\"search\")\n .argument(\"<keywords...>\", \"Keyword query tokens\")\n .description(\n \"Search items with keyword, semantic, or hybrid retrieval. Inline field:value tokens \" +\n \"(tag:/status:/type:/priority:) in the query are parsed as filters, e.g. 'auth tag:area:search status:open'.\",\n )\n .option(\n \"--mode <value>\",\n \"Search mode: keyword|semantic|hybrid (default: keyword)\",\n )\n .option(\"--semantic\", \"Shorthand for --mode semantic\")\n .option(\"--hybrid\", \"Shorthand for --mode hybrid\")\n .option(\n \"--match-mode <value>\",\n \"Token match mode: and|or|exact (default: or with all-terms ranking bonus; and = hard-require every token; exact = exact phrase)\",\n )\n .option(\n \"--min-score <value>\",\n \"Per-query minimum score threshold (finite number >= 0); overrides settings search.score_threshold for this query only\",\n )\n .option(\n \"--count\",\n \"Return only the count of matching items (post-filter/threshold, pre-limit); skips hit rows\",\n )\n .option(\n \"--semantic-weight <value>\",\n \"Override hybrid semantic weight for this query (0..1); invalid values fall back to settings\",\n )\n .option(\n \"--include-linked\",\n \"Include linked files, docs, and tests in the searchable corpus\",\n )\n .option(\n \"--title-exact\",\n \"Require exact normalized title match for the full query string\",\n )\n .option(\n \"--phrase-exact\",\n \"Require exact normalized phrase match in searchable text\",\n )\n .option(\n \"--highlight\",\n \"Emit per-field matched-text snippets (wrapped in «…») on each hit; off by default\",\n )\n .option(\n \"--status <value>\",\n \"Filter by status before query (all, open/closed/canceled aliases, or configured status id; CSV)\",\n )\n .option(\"--type <value>\", \"Filter by item type\")\n .option(\"--tag <value>\", \"Filter by tag\")\n .option(\"--priority <value>\", \"Filter by priority\")\n .option(\n \"--deadline-before <value>\",\n \"Filter by deadline upper bound (ISO/date string or relative)\",\n )\n .option(\n \"--deadline-after <value>\",\n \"Filter by deadline lower bound (ISO/date string or relative)\",\n )\n .option(\n \"--updated-after <value>\",\n 'Filter by updated_at lower bound: ISO timestamp or signed relative (e.g. \"-2h\"/\"-7d\" for the past)',\n )\n .option(\n \"--updated-before <value>\",\n \"Filter by updated_at upper bound: ISO timestamp or signed relative (-2h/+1d)\",\n )\n .option(\n \"--created-after <value>\",\n \"Filter by created_at lower bound: ISO timestamp or signed relative (-2h/+1d)\",\n )\n .option(\n \"--created-before <value>\",\n \"Filter by created_at upper bound: ISO timestamp or signed relative (-2h/+1d)\",\n )\n .option(\"--assignee <value>\", \"Filter by assignee\")\n .option(\"--sprint <value>\", \"Filter by sprint\")\n .option(\"--release <value>\", \"Filter by release\")\n .option(\"--parent <value>\", \"Filter by parent item ID\")\n .option(\n \"--compact\",\n \"Render compact search hits (default; mutually exclusive with --full/--fields)\",\n )\n .option(\n \"--full\",\n \"Render full search hits with nested item payloads (mutually exclusive with --compact/--fields)\",\n )\n .option(\n \"--fields <value>\",\n \"Render custom comma-separated search hit fields (mutually exclusive with --compact/--full; valid: --fields id,title,score; invalid: --full --fields id,title)\",\n )\n .option(\"--format <value>\", \"Search output format override: json|toon\")\n .option(\"--limit <n>\", \"Limit returned item count\")\n .option(\n \"--after <cursor>\",\n \"Continue after an opaque next_cursor from a previous search response\",\n );\n registerContentAndGovernanceFilters(searchCommand);\n searchCommand.action(runSearchAction);\n addHiddenOption(searchCommand, \"--tags <value>\", \"Alias for --tag\");\n }\n\n if (shouldRegister(\"eval\")) {\n program\n .command(\"eval\")\n .description(\n \"Evaluate search relevance against a curated golden-query set: reports nDCG@k, MRR@k, \" +\n \"precision@k, and recall@k per query plus the macro average. Use --fail-under as a CI gate.\",\n )\n .option(\n \"--mode <value>\",\n \"Default retrieval mode for queries without their own: keyword|semantic|hybrid (default: keyword)\",\n )\n .option(\"--k <n>\", \"Metric cutoff @k (positive integer; default: 10)\")\n .option(\n \"--fail-under <value>\",\n \"Exit non-zero when aggregate nDCG@k falls below this threshold (0..1); CI gate\",\n )\n .option(\n \"--queries <path>\",\n \"Path to the golden-query JSON file (default: <pmRoot>/search/eval-queries.json)\",\n )\n .option(\"--format <value>\", \"Eval output format override: json|toon\")\n .action(runEvalAction);\n }\n\n if (shouldRegister(\"get\")) {\n const getCommand = program\n .command(\"get\")\n .argument(\"<id>\", \"Item id\")\n .option(\n \"--depth <value>\",\n \"Detail depth: brief|standard|deep|full (full aliases deep; default: standard)\",\n )\n .option(\n \"--full\",\n \"Explicit full item read; equivalent to --depth deep (mutually exclusive with --depth/--fields)\",\n )\n .option(\n \"--fields <value>\",\n \"Render custom comma-separated item metadata fields (for example: --fields id,title,status,parent,type)\",\n )\n .option(\"--tree\", \"Include descendants rooted at the requested item\")\n .option(\n \"--tree-depth <n>\",\n \"Maximum subtree depth for --tree descendants\",\n )\n .option(\n \"--at <version-or-timestamp>\",\n \"Reconstruct a verified historical item state without mutating it\",\n )\n .option(\"--format <value>\", \"Get output format override: json|toon\")\n .description(\"Show item details by ID.\")\n .action(runGetAction);\n addHiddenOption(getCommand, \"--tree_depth <n>\", \"Alias for --tree-depth\");\n }\n\n if (shouldRegister(\"history\")) {\n program\n .command(\"history\")\n .argument(\"<id>\", \"Item id\")\n .option(\"--limit <n>\", \"Return only the latest n history entries\")\n .option(\n \"--compact\",\n \"Condensed output: show entry index, timestamp, op, author, patch count, and changed fields\",\n )\n .option(\"--full\", \"Show full history entries with JSON Patch payloads\")\n .option(\n \"--diff\",\n \"Include per-entry field-level before/after value diffs computed by replaying the history chain\",\n )\n .option(\n \"--field <name>\",\n \"With --diff, show only entries that changed this field (implies --diff)\",\n )\n .option(\n \"--verify\",\n \"Verify hash chain and replay integrity for the full history stream\",\n )\n .option(\"--format <value>\", \"History output format override: json|toon\")\n .description(\"Show item history entries.\")\n .action(runHistoryAction);\n }\n\n if (shouldRegister(\"activity\")) {\n program\n .command(\"activity\")\n .option(\"--id <value>\", \"Filter by item ID\")\n .option(\"--op <value>\", \"Filter by history operation\")\n .option(\"--author <value>\", \"Filter by history author\")\n .option(\n \"--from <value>\",\n \"Lower timestamp bound (ISO/date string or relative)\",\n )\n .option(\n \"--to <value>\",\n \"Upper timestamp bound (ISO/date string or relative)\",\n )\n .option(\"--limit <n>\", \"Return only the latest n activity entries\")\n .option(\n \"--compact\",\n \"Condensed output: show only id, op, ts, author, msg per entry\",\n )\n .option(\"--full\", \"Show full activity entries with JSON Patch payloads\")\n .option(\n \"--stream [mode]\",\n \"Emit line-delimited JSON rows (requires --json). Optional mode: rows|ndjson|jsonl\",\n )\n .description(\"Show recent activity across items.\")\n .action(runActivityAction);\n }\n}\n\n/** Public contract for test only register list query, shared by SDK and presentation-layer consumers. */\nexport const _testOnlyRegisterListQuery = {\n resolveReadCommandOutputFormat,\n parseListFormat,\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,SAAS,eAAe,MAAkB;AACxC,QAAM,UAAoB,CAAA;AAC1B,QAAM,OAAO,oBAAI,IAAG;AACpB,aAAW,OAAO,MAAM;AACtB,eAAW,OAAO,OAAO,KAAK,GAAG,GAAG;AAClC,UAAI,CAAC,KAAK,IAAI,GAAG,GAAG;AAClB,aAAK,IAAI,GAAG;AACZ,gBAAQ,KAAK,GAAG;MAClB;IACF;EACF;AACA,SAAO;AACT;AAGA,SAAS,WAAW,OAAc;AAChC,MAAI,UAAU,QAAQ,UAAU,QAAW;AACzC,WAAO;EACT;AACA,MAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,WAAO,MAAM,IAAI,CAAC,UAAU,WAAW,KAAK,CAAC,EAAE,KAAK,GAAG;EACzD;AACA,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO,KAAK,UAAU,KAAK;EAC7B;AACA,SAAO,OAAO,KAAK;AACrB;AAGA,SAAS,eAAe,OAAa;AACnC,MAAI,WAAW,KAAK,KAAK,GAAG;AAC1B,WAAO,IAAI,MAAM,QAAQ,MAAM,IAAI,CAAC;EACtC;AACA,SAAO;AACT;AAGM,SAAU,gBAAgB,MAAkB;AAChD,MAAI,KAAK,WAAW,GAAG;AACrB,WAAO;EACT;AACA,QAAM,UAAU,eAAe,IAAI;AACnC,QAAM,QAAQ,CAAC,QAAQ,IAAI,CAAC,WAAW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e94-8ee5-64ad8d1f64bf"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../../../../core/output/tabular.ts", "../../../../../../../../cli/register-list-query.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * @module core/output/tabular\n *\n * Renders projected item rows as CSV or fixed-width text tables for human\n * export. These are presentation-only modes (GH-154): agents continue to read\n * the structured `--json`/TOON output, while humans piping `pm list` into a\n * spreadsheet or terminal get a directly consumable shape.\n */\n\n/** A projected row: a flat map of column name to scalar/collection cell value. */\nexport type TabularRow = Record<string, unknown>;\n\n/** Collects the ordered union of column names across every row, preserving the order in which each key is first encountered so the rendered columns mirror the projection field order rather than an arbitrary object-key order. */\nfunction resolveColumns(rows: TabularRow[]): string[] {\n const columns: string[] = [];\n const seen = new Set<string>();\n for (const row of rows) {\n for (const key of Object.keys(row)) {\n if (!seen.has(key)) {\n seen.add(key);\n columns.push(key);\n }\n }\n }\n return columns;\n}\n\n/** Converts a single cell value to its flat string form. Arrays join with `;` (spreadsheet-friendly and unambiguous against the CSV `,` delimiter), objects serialize to compact JSON, and null/undefined render as an empty cell. */\nfunction renderCell(value: unknown): string {\n if (value === null || value === undefined) {\n return \"\";\n }\n if (Array.isArray(value)) {\n return value.map((entry) => renderCell(entry)).join(\";\");\n }\n if (typeof value === \"object\") {\n return JSON.stringify(value);\n }\n return String(value);\n}\n\n/** Escapes a CSV field per RFC 4180: values containing the delimiter, a quote, or a line break are wrapped in double quotes with embedded quotes doubled. */\nfunction escapeCsvField(value: string): string {\n if (/[\",\\r\\n]/.test(value)) {\n return `\"${value.replace(/\"/g, '\"\"')}\"`;\n }\n return value;\n}\n\n/** Renders rows as RFC 4180 CSV with a header row of column names. Returns an empty string when there are no rows so callers emit nothing rather than a stray blank line. */\nexport function renderRowsAsCsv(rows: TabularRow[]): string {\n if (rows.length === 0) {\n return \"\";\n }\n const columns = resolveColumns(rows);\n const lines = [columns.map((column) => escapeCsvField(column)).join(\",\")];\n for (const row of rows) {\n lines.push(\n columns\n .map((column) => escapeCsvField(renderCell(row[column])))\n .join(\",\"),\n );\n }\n return lines.join(\"\\n\");\n}\n\n/** Renders rows as a fixed-width text table: a header row, a dashed separator, and one padded row per item. Columns are widened to fit their widest cell so the output stays aligned in a monospace terminal. Returns an empty string when there are no rows. */\nexport function renderRowsAsTable(rows: TabularRow[]): string {\n if (rows.length === 0) {\n return \"\";\n }\n const columns = resolveColumns(rows);\n const cells = rows.map((row) =>\n columns.map((column) => renderCell(row[column])),\n );\n const widths = columns.map((column, index) =>\n Math.max(column.length, ...cells.map((rowCells) => rowCells[index].length)),\n );\n const pad = (value: string, index: number): string =>\n value.padEnd(widths[index]);\n const lines = [\n columns.map((column, index) => pad(column, index)).join(\" | \"),\n ];\n lines.push(widths.map((width) => \"-\".repeat(width)).join(\"-+-\"));\n for (const rowCells of cells) {\n lines.push(rowCells.map((value, index) => pad(value, index)).join(\" | \"));\n }\n return lines.join(\"\\n\");\n}\n", "/**\n * @module cli/register-list-query\n *\n * Provides CLI runtime support for Register List Query.\n */\nimport type { Command } from \"commander\";\nimport { EXIT_CODE } from \"../core/shared/constants.js\";\nimport { PmCliError } from \"../core/shared/errors.js\";\nimport { renderRowsAsCsv, renderRowsAsTable } from \"../core/output/tabular.js\";\nimport { runActivity } from \"./commands/activity.js\";\nimport { runAggregate } from \"./commands/aggregate.js\";\nimport {\n renderContextMarkdown,\n runContext,\n resolveContextOutputFormat,\n} from \"./commands/context.js\";\nimport { runEval } from \"./commands/eval.js\";\nimport { runGet } from \"./commands/get.js\";\nimport { runHistory } from \"./commands/history.js\";\nimport { runList } from \"./commands/list.js\";\nimport {\n renderNextMarkdown,\n runNext,\n resolveNextOutputFormat,\n} from \"./commands/next.js\";\nimport { runSearch } from \"./commands/search.js\";\nimport type { ItemStatus } from \"../types/index.js\";\nimport {\n addHiddenOption,\n getGlobalOptions,\n normalizeAggregateOptions,\n normalizeActivityOptions,\n normalizeContextOptions,\n normalizeListOptions,\n normalizeNextOptions,\n normalizeSearchKeywordsInput,\n normalizeSearchOptions,\n printActivityJsonStream,\n printError,\n printListJsonStream,\n printResult,\n resolveActivityStreamMode,\n writeStdout,\n} from \"./registration-helpers.js\";\n\n/** Documents the register list query commands options payload exchanged by command, SDK, and package integrations. */\nexport interface RegisterListQueryCommandsOptions {\n /** Value that configures or reports command filter for this contract. */\n commandFilter?: Set<string>;\n}\n\nfunction shouldRegisterListQueryCommand(\n commandName: string,\n commandFilter?: Set<string>,\n): boolean {\n if (!commandFilter || commandFilter.size === 0) {\n return true;\n }\n if (commandName === \"context\") {\n return commandFilter.has(\"context\") || commandFilter.has(\"ctx\");\n }\n return commandFilter.has(commandName);\n}\n\ntype ReadCommandOutputFormat = \"json\" | \"toon\";\n\ntype ListOutputFormat = \"csv\" | \"table\" | \"json\" | \"toon\";\n\n/** Parses the `pm list --format` value into a supported render mode. csv/table are human export modes; json/toon override the machine output format. Returns undefined when no `--format` was supplied so the global output format applies. */\nfunction parseListFormat(rawFormat: unknown): ListOutputFormat | undefined {\n if (rawFormat === undefined) {\n return undefined;\n }\n if (typeof rawFormat !== \"string\") {\n throw new PmCliError(\n \"List --format must be one of csv|table|json|toon\",\n EXIT_CODE.USAGE,\n );\n }\n const normalized = rawFormat.trim().toLowerCase();\n if (\n normalized === \"csv\" ||\n normalized === \"table\" ||\n normalized === \"json\" ||\n normalized === \"toon\"\n ) {\n return normalized;\n }\n throw new PmCliError(\n \"List --format must be one of csv|table|json|toon\",\n EXIT_CODE.USAGE,\n );\n}\n\nfunction resolveReadCommandOutputFormat(\n commandLabel: string,\n rawFormat: unknown,\n globalOptions: ReturnType<typeof getGlobalOptions>,\n): ReturnType<typeof getGlobalOptions> {\n if (rawFormat === undefined) {\n return globalOptions;\n }\n if (typeof rawFormat !== \"string\") {\n throw new PmCliError(\n `${commandLabel} --format must be one of json|toon`,\n EXIT_CODE.USAGE,\n );\n }\n const normalized = rawFormat.trim().toLowerCase() as ReadCommandOutputFormat;\n if (normalized !== \"json\" && normalized !== \"toon\") {\n throw new PmCliError(\n `${commandLabel} --format must be one of json|toon`,\n EXIT_CODE.USAGE,\n );\n }\n if (globalOptions.json === true && normalized === \"toon\") {\n throw new PmCliError(\n `${commandLabel} cannot combine --json with --format toon`,\n EXIT_CODE.USAGE,\n );\n }\n return {\n ...globalOptions,\n json: normalized === \"json\",\n };\n}\n\nfunction applyDefaultBriefListMode(\n listOptions: ReturnType<typeof normalizeListOptions>,\n defaultBrief: boolean | undefined,\n): void {\n if (\n defaultBrief === true &&\n listOptions.includeBody !== true &&\n listOptions.compact !== true &&\n listOptions.brief !== true &&\n listOptions.full !== true &&\n listOptions.fields === undefined\n ) {\n listOptions.brief = true;\n }\n}\n\nfunction registerContentAndGovernanceFilters(command: Command): void {\n command\n .option(\"--has-notes\", \"Show only items that have notes\")\n .option(\"--has-learnings\", \"Show only items that have learnings\")\n .option(\"--has-files\", \"Show only items that have linked files\")\n .option(\"--has-docs\", \"Show only items that have linked docs\")\n .option(\"--has-tests\", \"Show only items that have linked tests\")\n .option(\"--has-comments\", \"Show only items that have comments\")\n .option(\"--has-deps\", \"Show only items that have dependencies\")\n .option(\"--has-body\", \"Show only items that have a non-empty body\")\n .option(\n \"--has-linked-command\",\n \"Show only items whose linked tests carry a runnable command\",\n )\n .option(\"--no-notes\", \"Show only items that have no notes\")\n .option(\"--no-learnings\", \"Show only items that have no learnings\")\n .option(\"--no-files\", \"Show only items that have no linked files\")\n .option(\"--filter-files-missing\", \"Alias for --no-files\")\n .option(\"--no-docs\", \"Show only items that have no linked docs\")\n .option(\"--filter-docs-missing\", \"Alias for --no-docs\")\n .option(\"--no-tests\", \"Show only items that have no linked tests\")\n .option(\"--no-comments\", \"Show only items that have no comments\")\n .option(\"--no-deps\", \"Show only items that have no dependencies\")\n .option(\"--empty-body\", \"Show only items with an empty body\")\n .option(\n \"--no-linked-command\",\n \"Show only items whose linked tests carry no runnable command\",\n )\n .option(\"--filter-reviewer-missing\", \"Show only items missing reviewer\")\n .option(\"--filter-risk-missing\", \"Show only items missing risk\")\n .option(\"--filter-confidence-missing\", \"Show only items missing confidence\")\n .option(\"--filter-sprint-missing\", \"Show only items missing sprint\")\n .option(\"--filter-release-missing\", \"Show only items missing release\");\n}\n\nasync function runRegisteredListCommand(params: {\n name: string;\n status?: ItemStatus;\n excludeTerminal?: boolean;\n defaultBrief?: boolean;\n options: Record<string, unknown>;\n actionCommand: Command;\n}): Promise<void> {\n const globalOptions = getGlobalOptions(params.actionCommand);\n const startedAt = Date.now();\n const listOptions = normalizeListOptions(params.options);\n applyDefaultBriefListMode(listOptions, params.defaultBrief);\n if (params.excludeTerminal) listOptions.excludeTerminal = true;\n const result = await runList(params.status, listOptions, globalOptions);\n const streamMode = params.options.stream === true;\n const listFormat = parseListFormat(params.options.format);\n const tabular = listFormat === \"csv\" || listFormat === \"table\";\n const effectiveGlobal =\n listFormat === \"json\" || listFormat === \"toon\"\n ? resolveReadCommandOutputFormat(\n \"List\",\n params.options.format,\n globalOptions,\n )\n : globalOptions;\n if (streamMode && !effectiveGlobal.json) {\n throw new PmCliError(\n \"--stream requires --json output mode.\",\n EXIT_CODE.USAGE,\n );\n }\n if (tabular && streamMode) {\n throw new PmCliError(\n \"--format csv|table cannot be combined with --stream (line-delimited JSON).\",\n EXIT_CODE.USAGE,\n );\n }\n if (tabular) {\n const rows = result.items as Array<Record<string, unknown>>;\n const rendered =\n listFormat === \"csv\" ? renderRowsAsCsv(rows) : renderRowsAsTable(rows);\n if (!effectiveGlobal.quiet && rendered.length > 0) {\n writeStdout(`${rendered}\\n`);\n }\n } else if (streamMode) {\n printListJsonStream(params.name, result, effectiveGlobal);\n } else {\n printResult(result, effectiveGlobal);\n }\n if (globalOptions.profile) {\n printError(\n `profile:command=${params.name} took_ms=${Date.now() - startedAt}`,\n );\n }\n}\n\ninterface ListCommandDescriptor {\n name: string;\n description: string;\n status?: ItemStatus;\n excludeTerminal?: boolean;\n allowStatusFilter?: boolean;\n defaultBrief?: boolean;\n}\n\nfunction registerListCommand(\n program: Command,\n descriptor: ListCommandDescriptor,\n): void {\n const {\n name,\n description,\n status,\n excludeTerminal,\n allowStatusFilter,\n defaultBrief,\n } = descriptor;\n const command = program.command(name).description(description);\n if (allowStatusFilter) {\n command.option(\n \"--status <value>\",\n \"Filter by status (use all for no status restriction)\",\n );\n }\n command\n .option(\"--type <value>\", \"Filter by item type\")\n .option(\"--tag <value>\", \"Filter by tag\")\n .option(\"--priority <value>\", \"Filter by priority\")\n .option(\n \"--deadline-before <value>\",\n \"Filter by deadline upper bound (ISO/date string or relative)\",\n )\n .option(\n \"--deadline-after <value>\",\n \"Filter by deadline lower bound (ISO/date string or relative)\",\n )\n .option(\"--today\", \"Filter to items updated since local midnight today\")\n .option(\"--recent\", \"Filter to items updated in the last 7 days\")\n .option(\n \"--updated-after <value>\",\n 'Filter by updated_at lower bound: ISO timestamp or signed relative (e.g. \"-2h\"/\"-7d\" for the past). \"Changed since my last window\" → --updated-after <ISO>',\n )\n .option(\n \"--updated-before <value>\",\n \"Filter by updated_at upper bound: ISO timestamp or signed relative (-2h/+1d)\",\n )\n .option(\n \"--created-after <value>\",\n \"Filter by created_at lower bound: ISO timestamp or signed relative (-2h/+1d)\",\n )\n .option(\n \"--created-before <value>\",\n \"Filter by created_at upper bound: ISO timestamp or signed relative (-2h/+1d)\",\n )\n .option(\n \"--ids <value>\",\n \"Filter by explicit item IDs (comma-separated or repeatable)\",\n )\n .option(\"--assignee <value>\", \"Filter by assignee\")\n .option(\n \"--assignee-filter <value>\",\n \"Filter assignee presence: assigned|unassigned\",\n )\n .option(\"--parent <value>\", \"Filter by parent item ID\")\n .option(\"--sprint <value>\", \"Filter by sprint\")\n .option(\"--release <value>\", \"Filter by release\")\n .option(\n \"--filter-ac-missing\",\n \"Show only items missing acceptance_criteria\",\n )\n .option(\n \"--filter-estimates-missing\",\n \"Show only items missing estimated_minutes\",\n )\n .option(\n \"--filter-resolution-missing\",\n \"Show only terminal items missing resolution\",\n )\n .option(\n \"--filter-metadata-missing\",\n \"Show only items missing any tracked metadata (AC, estimate, or resolution)\",\n )\n .option(\"--limit <n>\", \"Limit returned item count\")\n .option(\n \"--offset <n>\",\n \"Skip the first n matching rows before limit is applied\",\n )\n .option(\n \"--after <cursor>\",\n \"Continue after an opaque next_cursor from a previous list response\",\n )\n .option(\n \"--no-truncate\",\n \"Return every matched row, overriding any --limit (alias: --all)\",\n )\n .option(\"--include-body\", \"Include item body in each returned list row\")\n .option(\n \"--compact\",\n \"Render compact list projection fields (mutually exclusive with --brief/--full/--fields)\",\n )\n .option(\n \"--brief\",\n \"Ultra-compact output: id, status, type, title only (agent-optimized, mutually exclusive with --compact/--full/--fields)\",\n )\n .option(\n \"--full\",\n \"Render full list projection fields (mutually exclusive with --compact/--brief/--fields)\",\n )\n .option(\n \"--fields <value>\",\n \"Render custom comma-separated list fields (mutually exclusive with --compact/--brief/--full; valid: --fields id,title)\",\n )\n .option(\n \"--sort <value>\",\n \"Sort field: priority|deadline|updated_at|created_at|title|parent (aliases: updated, created)\",\n )\n .option(\"--order <value>\", \"Sort order: asc|desc (requires --sort)\")\n .option(\"--tree\", \"Render rows in parent/child tree order\")\n .option(\n \"--tree-depth <n>\",\n \"Maximum recursion depth with --tree (0 keeps root rows only)\",\n )\n .option(\n \"--format <value>\",\n \"Output render mode: csv|table (human export) or json|toon (machine output override)\",\n )\n .option(\"--stream\", \"Emit line-delimited JSON rows (requires --json)\");\n registerContentAndGovernanceFilters(command);\n command.action(async (options: Record<string, unknown>, actionCommand) => {\n await runRegisteredListCommand({\n name,\n status,\n excludeTerminal,\n defaultBrief,\n options,\n actionCommand,\n });\n });\n // Positive alias for --no-truncate (Commander stores the negation as truncate=false).\n addHiddenOption(command, \"--all\", \"Alias for --no-truncate\");\n // Hidden pure snake_case underscore-duplicate alias (kept parse-functional).\n addHiddenOption(command, \"--tags <value>\", \"Alias for --tag\");\n addHiddenOption(\n command,\n \"--assignee_filter <value>\",\n \"Alias for --assignee-filter\",\n );\n addHiddenOption(command, \"--tree_depth <n>\", \"Alias for --tree-depth\");\n // Singular alias so `--filter-estimate-missing` works (matches update-many spelling).\n addHiddenOption(\n command,\n \"--filter-estimate-missing\",\n \"Alias for --filter-estimates-missing\",\n );\n}\n\nasync function runAggregateAction(\n options: Record<string, unknown>,\n command: Command,\n): Promise<void> {\n const globalOptions = getGlobalOptions(command);\n const startedAt = Date.now();\n const result = await runAggregate(\n normalizeAggregateOptions(options),\n globalOptions,\n );\n printResult(result, globalOptions);\n if (globalOptions.profile) {\n printError(`profile:command=aggregate took_ms=${Date.now() - startedAt}`);\n }\n}\n\nasync function runContextAction(\n options: Record<string, unknown>,\n actionCommand: Command,\n): Promise<void> {\n const globalOptions = getGlobalOptions(actionCommand);\n const startedAt = Date.now();\n const normalized = normalizeContextOptions(options);\n const result = await runContext(normalized, globalOptions);\n const outputFormat = resolveContextOutputFormat(normalized, globalOptions);\n if (outputFormat === \"markdown\") {\n if (!globalOptions.quiet) {\n writeStdout(`${renderContextMarkdown(result)}\\n`);\n }\n } else {\n printResult(result, {\n ...globalOptions,\n json: outputFormat === \"json\",\n });\n }\n if (globalOptions.profile) {\n printError(`profile:command=context took_ms=${Date.now() - startedAt}`);\n }\n}\n\nasync function runNextAction(\n options: Record<string, unknown>,\n actionCommand: Command,\n): Promise<void> {\n const globalOptions = getGlobalOptions(actionCommand);\n const startedAt = Date.now();\n const nextOptions = normalizeNextOptions(options);\n const result = await runNext(nextOptions, globalOptions);\n const outputFormat = resolveNextOutputFormat(nextOptions, globalOptions);\n if (outputFormat === \"markdown\") {\n if (!globalOptions.quiet) {\n writeStdout(`${renderNextMarkdown(result)}\\n`);\n }\n } else {\n printResult(result, { ...globalOptions, json: outputFormat === \"json\" });\n }\n if (globalOptions.profile) {\n printError(`profile:command=next took_ms=${Date.now() - startedAt}`);\n }\n}\n\nasync function runSearchAction(\n keywords: string[],\n options: Record<string, unknown>,\n command: Command,\n): Promise<void> {\n const globalOptions = getGlobalOptions(command);\n const startedAt = Date.now();\n const searchOptions = normalizeSearchOptions(options);\n const result = await runSearch(\n normalizeSearchKeywordsInput(keywords),\n {\n ...searchOptions,\n mode:\n typeof searchOptions.mode === \"string\" &&\n searchOptions.mode.trim().length > 0\n ? searchOptions.mode\n : \"keyword\",\n },\n globalOptions,\n );\n printResult(\n result,\n resolveReadCommandOutputFormat(\"Search\", options.format, globalOptions),\n );\n if (globalOptions.profile) {\n printError(`profile:command=search took_ms=${Date.now() - startedAt}`);\n }\n}\n\nasync function runEvalAction(\n options: Record<string, unknown>,\n command: Command,\n): Promise<void> {\n const globalOptions = getGlobalOptions(command);\n const startedAt = Date.now();\n const result = await runEval(\n {\n mode: typeof options.mode === \"string\" ? options.mode : undefined,\n k: typeof options.k === \"string\" ? options.k : undefined,\n failUnder:\n typeof options.failUnder === \"string\" ? options.failUnder : undefined,\n queries:\n typeof options.queries === \"string\" ? options.queries : undefined,\n format: typeof options.format === \"string\" ? options.format : undefined,\n },\n globalOptions,\n );\n printResult(\n result,\n resolveReadCommandOutputFormat(\"Eval\", options.format, globalOptions),\n );\n if (globalOptions.profile) {\n printError(`profile:command=eval took_ms=${Date.now() - startedAt}`);\n }\n if (!result.passed) {\n throw new PmCliError(\n `Eval gate failed: aggregate nDCG@${result.k} ${result.aggregate.ndcg} is below --fail-under ${result.fail_under}`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n}\n\nasync function runGetAction(\n id: string,\n options: Record<string, unknown>,\n command: Command,\n): Promise<void> {\n const globalOptions = getGlobalOptions(command);\n const startedAt = Date.now();\n const result = await runGet(id, globalOptions, {\n depth: typeof options.depth === \"string\" ? options.depth : undefined,\n fields: typeof options.fields === \"string\" ? options.fields : undefined,\n full: Boolean(options.full),\n tree: options.tree === true,\n treeDepth:\n typeof options.treeDepth === \"string\"\n ? options.treeDepth\n : typeof options.tree_depth === \"string\"\n ? options.tree_depth\n : undefined,\n at: typeof options.at === \"string\" ? options.at : undefined,\n });\n printResult(\n result,\n resolveReadCommandOutputFormat(\"Get\", options.format, globalOptions),\n );\n if (globalOptions.profile) {\n printError(`profile:command=get took_ms=${Date.now() - startedAt}`);\n }\n}\n\nasync function runHistoryAction(\n id: string,\n options: Record<string, unknown>,\n command: Command,\n): Promise<void> {\n const globalOptions = getGlobalOptions(command);\n const startedAt = Date.now();\n if (options.compact === true && options.full === true) {\n throw new PmCliError(\n \"History projection options are mutually exclusive. Use either --compact or --full.\",\n EXIT_CODE.USAGE,\n );\n }\n const field = typeof options.field === \"string\" ? options.field : undefined;\n const result = await runHistory(\n id,\n {\n limit: typeof options.limit === \"string\" ? options.limit : undefined,\n compact: options.full === true ? false : true,\n diff: Boolean(options.diff) || field !== undefined,\n field,\n verify: Boolean(options.verify),\n },\n globalOptions,\n );\n printResult(\n result,\n resolveReadCommandOutputFormat(\"History\", options.format, globalOptions),\n );\n if (globalOptions.profile) {\n printError(`profile:command=history took_ms=${Date.now() - startedAt}`);\n }\n}\n\nasync function runActivityAction(\n options: Record<string, unknown>,\n command: Command,\n): Promise<void> {\n const globalOptions = getGlobalOptions(command);\n const startedAt = Date.now();\n if (options.compact === true && options.full === true) {\n throw new PmCliError(\n \"Activity projection options are mutually exclusive. Use either --compact or --full.\",\n EXIT_CODE.USAGE,\n );\n }\n const normalized = normalizeActivityOptions(options);\n const result = await runActivity(normalized, globalOptions);\n const streamMode = resolveActivityStreamMode(options.stream);\n if (streamMode && !globalOptions.json) {\n throw new PmCliError(\n \"--stream requires --json output mode.\",\n EXIT_CODE.USAGE,\n );\n }\n if (streamMode) {\n printActivityJsonStream(result, normalized, globalOptions);\n } else {\n printResult(result, globalOptions);\n }\n if (globalOptions.profile) {\n printError(`profile:command=activity took_ms=${Date.now() - startedAt}`);\n }\n}\n\n/** Implements register list query commands for the public runtime surface of this module. */\nexport function registerListQueryCommands(\n program: Command,\n options?: RegisterListQueryCommandsOptions,\n): void {\n const commandFilter = options?.commandFilter;\n const shouldRegister = (commandName: string): boolean =>\n shouldRegisterListQueryCommand(commandName, commandFilter);\n const listCommandDescriptors: ListCommandDescriptor[] = [\n {\n name: \"list\",\n description: \"List active items with optional filters.\",\n excludeTerminal: true,\n allowStatusFilter: true,\n defaultBrief: true,\n },\n {\n name: \"list-all\",\n description: \"List all items with optional filters.\",\n excludeTerminal: false,\n allowStatusFilter: true,\n },\n {\n name: \"list-draft\",\n description: \"List draft items with optional filters.\",\n status: \"draft\",\n },\n {\n name: \"list-open\",\n description: \"List open items with optional filters.\",\n status: \"open\",\n excludeTerminal: false,\n allowStatusFilter: false,\n defaultBrief: true,\n },\n {\n name: \"list-in-progress\",\n description: \"List in-progress items with optional filters.\",\n status: \"in_progress\",\n excludeTerminal: false,\n allowStatusFilter: false,\n defaultBrief: true,\n },\n {\n name: \"list-blocked\",\n description: \"List blocked items with optional filters.\",\n status: \"blocked\",\n excludeTerminal: false,\n allowStatusFilter: false,\n defaultBrief: true,\n },\n {\n name: \"list-closed\",\n description: \"List closed items with optional filters.\",\n status: \"closed\",\n },\n {\n name: \"list-canceled\",\n description: \"List canceled items with optional filters.\",\n status: \"canceled\",\n },\n ];\n for (const descriptor of listCommandDescriptors) {\n if (shouldRegister(descriptor.name)) {\n registerListCommand(program, descriptor);\n }\n }\n\n if (shouldRegister(\"aggregate\")) {\n const aggregateCommand = program\n .command(\"aggregate\")\n .description(\"Aggregate grouped item counts for governance queries.\")\n .option(\n \"--group-by <value>\",\n \"Comma-separated group-by fields (supported: parent,type,priority,status,assignee,tags,sprint,release)\",\n )\n .option(\"--count\", \"Return grouped counts (default behavior)\")\n .option(\n \"--completion\",\n \"Add open/in_progress/closed/other counts and completion_pct per group\",\n )\n .option(\"--sum <field>\", \"Sum a numeric field per group\")\n .option(\"--avg <field>\", \"Average a numeric field per group\")\n .option(\n \"--include-unparented\",\n \"Include unparented rows when grouping by parent\",\n )\n .option(\"--status <value>\", \"Filter by item status\")\n .option(\"--type <value>\", \"Filter by item type\")\n .option(\"--tag <value>\", \"Filter by tag\")\n .option(\"--priority <value>\", \"Filter by priority\")\n .option(\n \"--deadline-before <value>\",\n \"Filter by deadline upper bound (ISO/date string or relative)\",\n )\n .option(\n \"--deadline-after <value>\",\n \"Filter by deadline lower bound (ISO/date string or relative)\",\n )\n .option(\"--assignee <value>\", \"Filter by assignee\")\n .option(\n \"--assignee-filter <value>\",\n \"Filter assignee presence: assigned|unassigned\",\n )\n .option(\"--parent <value>\", \"Filter by parent item ID\")\n .option(\"--sprint <value>\", \"Filter by sprint\")\n .option(\"--release <value>\", \"Filter by release\");\n // Hidden pure snake_case underscore-duplicate aliases (kept parse-functional).\n addHiddenOption(\n aggregateCommand,\n \"--include_unparented\",\n \"Alias for --include-unparented\",\n );\n addHiddenOption(\n aggregateCommand,\n \"--assignee_filter <value>\",\n \"Alias for --assignee-filter\",\n );\n aggregateCommand.action(runAggregateAction);\n }\n\n if (shouldRegister(\"context\")) {\n const contextCommand = program\n .command(\"context\")\n .alias(\"ctx\")\n .description(\n \"Show a token-efficient project context snapshot for next-work decisions.\",\n )\n .option(\n \"--date <value>\",\n \"Anchor date/time for agenda window calculations (ISO/date string or relative)\",\n )\n .option(\n \"--from <value>\",\n \"Agenda lower bound (ISO/date string or relative)\",\n )\n .option(\n \"--to <value>\",\n \"Agenda upper bound (ISO/date string or relative)\",\n )\n .option(\"--past\", \"Include past agenda entries in bounded windows\")\n .option(\"--type <value>\", \"Filter by item type\")\n .option(\"--tag <value>\", \"Filter by tag\")\n .option(\"--priority <value>\", \"Filter by priority\")\n .option(\"--assignee <value>\", \"Filter by assignee\")\n .option(\n \"--assignee-filter <value>\",\n \"Filter assignee presence: assigned|unassigned\",\n )\n .option(\"--sprint <value>\", \"Filter by sprint\")\n .option(\"--release <value>\", \"Filter by release\")\n .option(\n \"--parent <id>\",\n \"Scope the snapshot to one item's subtree (the item plus all descendants)\",\n )\n .option(\"--limit <n>\", \"Limit focus and agenda rows per section\")\n .option(\n \"--after <cursor>\",\n \"Continue ranked focus after a next_cursor from a previous context response\",\n )\n .option(\n \"--format <value>\",\n \"Context output format override: markdown|toon|json\",\n )\n .option(\n \"--depth <value>\",\n \"Context depth: brief|standard|deep|full (full = every section, no per-section cap)\",\n )\n .option(\n \"--section <value...>\",\n \"Include specific sections (repeatable; overrides --depth)\",\n )\n .option(\n \"--fields <value>\",\n \"Project focus rows to a comma-separated field subset (e.g. id,title,priority)\",\n )\n .option(\n \"--activity-limit <n>\",\n \"Limit recent activity entries (default: settings or 10)\",\n )\n .option(\n \"--stale-threshold <value>\",\n \"Staleness cutoff in days (e.g. 7 or 7d; default: settings or 7)\",\n )\n .option(\n \"--explain-ranking\",\n \"Include the scorer model, per-signal contributions, and ranked candidate ids\",\n );\n // Hidden pure snake_case underscore-duplicate alias (kept parse-functional).\n addHiddenOption(\n contextCommand,\n \"--assignee_filter <value>\",\n \"Alias for --assignee-filter\",\n );\n addHiddenOption(contextCommand, \"--max-items <n>\", \"Alias for --limit\");\n addHiddenOption(\n contextCommand,\n \"--explain_ranking\",\n \"Alias for --explain-ranking\",\n );\n contextCommand.action(runContextAction);\n }\n\n if (shouldRegister(\"next\")) {\n const nextCommand = program\n .command(\"next\")\n .description(\n \"Recommend the next actionable (unblocked, ready) work item with rationale + blocked companion.\",\n )\n .option(\"--type <value>\", \"Filter candidate items by type\")\n .option(\"--tag <value>\", \"Filter candidate items by tag\")\n .option(\"--priority <value>\", \"Filter candidate items by priority\")\n .option(\"--assignee <value>\", \"Filter candidate items by assignee\")\n .option(\n \"--assignee-filter <value>\",\n \"Filter assignee presence: assigned|unassigned\",\n )\n .option(\"--sprint <value>\", \"Filter candidate items by sprint\")\n .option(\"--release <value>\", \"Filter candidate items by release\")\n .option(\n \"--parent <id>\",\n \"Scope to one item's subtree (the item plus all descendants)\",\n )\n .option(\n \"--limit <n>\",\n \"Limit ready rows (default: 5; non-positive falls back to default)\",\n )\n .option(\n \"--blocked-limit <n>\",\n \"Limit blocked rows (default: same as --limit)\",\n )\n .option(\"--ready-only\", \"Omit the blocked companion list\")\n .option(\n \"--include-decisions\",\n \"Include human-gated Decision items in the claimable ready queue\",\n )\n .option(\n \"--format <value>\",\n \"Next output format override: markdown|toon|json\",\n )\n .option(\n \"--explain-ranking\",\n \"Include the scorer model, per-signal contributions, and ranked ready ids\",\n );\n addHiddenOption(\n nextCommand,\n \"--assignee_filter <value>\",\n \"Alias for --assignee-filter\",\n );\n addHiddenOption(\n nextCommand,\n \"--blocked_limit <n>\",\n \"Alias for --blocked-limit\",\n );\n addHiddenOption(nextCommand, \"--ready_only\", \"Alias for --ready-only\");\n addHiddenOption(\n nextCommand,\n \"--explain_ranking\",\n \"Alias for --explain-ranking\",\n );\n nextCommand.action(runNextAction);\n }\n\n if (shouldRegister(\"search\")) {\n const searchCommand = program\n .command(\"search\")\n .argument(\"<keywords...>\", \"Keyword query tokens\")\n .description(\n \"Search items with keyword, semantic, or hybrid retrieval. Inline field:value tokens \" +\n \"(tag:/status:/type:/priority:) in the query are parsed as filters, e.g. 'auth tag:area:search status:open'.\",\n )\n .option(\n \"--mode <value>\",\n \"Search mode: keyword|semantic|hybrid (default: keyword)\",\n )\n .option(\"--semantic\", \"Shorthand for --mode semantic\")\n .option(\"--hybrid\", \"Shorthand for --mode hybrid\")\n .option(\n \"--match-mode <value>\",\n \"Token match mode: and|or|exact (default: or with all-terms ranking bonus; and = hard-require every token; exact = exact phrase)\",\n )\n .option(\n \"--min-score <value>\",\n \"Per-query minimum score threshold (finite number >= 0); overrides settings search.score_threshold for this query only\",\n )\n .option(\n \"--count\",\n \"Return only the count of matching items (post-filter/threshold, pre-limit); skips hit rows\",\n )\n .option(\n \"--semantic-weight <value>\",\n \"Override hybrid semantic weight for this query (0..1); invalid values fall back to settings\",\n )\n .option(\n \"--include-linked\",\n \"Include linked files, docs, and tests in the searchable corpus\",\n )\n .option(\n \"--title-exact\",\n \"Require exact normalized title match for the full query string\",\n )\n .option(\n \"--phrase-exact\",\n \"Require exact normalized phrase match in searchable text\",\n )\n .option(\n \"--highlight\",\n \"Emit per-field matched-text snippets (wrapped in «…») on each hit; off by default\",\n )\n .option(\n \"--status <value>\",\n \"Filter by status before query (all, open/closed/canceled aliases, or configured status id; CSV)\",\n )\n .option(\"--type <value>\", \"Filter by item type\")\n .option(\"--tag <value>\", \"Filter by tag\")\n .option(\"--priority <value>\", \"Filter by priority\")\n .option(\n \"--deadline-before <value>\",\n \"Filter by deadline upper bound (ISO/date string or relative)\",\n )\n .option(\n \"--deadline-after <value>\",\n \"Filter by deadline lower bound (ISO/date string or relative)\",\n )\n .option(\n \"--updated-after <value>\",\n 'Filter by updated_at lower bound: ISO timestamp or signed relative (e.g. \"-2h\"/\"-7d\" for the past)',\n )\n .option(\n \"--updated-before <value>\",\n \"Filter by updated_at upper bound: ISO timestamp or signed relative (-2h/+1d)\",\n )\n .option(\n \"--created-after <value>\",\n \"Filter by created_at lower bound: ISO timestamp or signed relative (-2h/+1d)\",\n )\n .option(\n \"--created-before <value>\",\n \"Filter by created_at upper bound: ISO timestamp or signed relative (-2h/+1d)\",\n )\n .option(\"--assignee <value>\", \"Filter by assignee\")\n .option(\"--sprint <value>\", \"Filter by sprint\")\n .option(\"--release <value>\", \"Filter by release\")\n .option(\"--parent <value>\", \"Filter by parent item ID\")\n .option(\n \"--compact\",\n \"Render compact search hits (default; mutually exclusive with --full/--fields)\",\n )\n .option(\n \"--full\",\n \"Render full search hits with nested item payloads (mutually exclusive with --compact/--fields)\",\n )\n .option(\n \"--fields <value>\",\n \"Render custom comma-separated search hit fields (mutually exclusive with --compact/--full; valid: --fields id,title,score; invalid: --full --fields id,title)\",\n )\n .option(\"--format <value>\", \"Search output format override: json|toon\")\n .option(\"--limit <n>\", \"Limit returned item count\")\n .option(\n \"--after <cursor>\",\n \"Continue after an opaque next_cursor from a previous search response\",\n );\n registerContentAndGovernanceFilters(searchCommand);\n searchCommand.action(runSearchAction);\n addHiddenOption(searchCommand, \"--tags <value>\", \"Alias for --tag\");\n }\n\n if (shouldRegister(\"eval\")) {\n program\n .command(\"eval\")\n .description(\n \"Evaluate search relevance against a curated golden-query set: reports nDCG@k, MRR@k, \" +\n \"precision@k, and recall@k per query plus the macro average. Use --fail-under as a CI gate.\",\n )\n .option(\n \"--mode <value>\",\n \"Default retrieval mode for queries without their own: keyword|semantic|hybrid (default: keyword)\",\n )\n .option(\"--k <n>\", \"Metric cutoff @k (positive integer; default: 10)\")\n .option(\n \"--fail-under <value>\",\n \"Exit non-zero when aggregate nDCG@k falls below this threshold (0..1); CI gate\",\n )\n .option(\n \"--queries <path>\",\n \"Path to the golden-query JSON file (default: <pmRoot>/search/eval-queries.json)\",\n )\n .option(\"--format <value>\", \"Eval output format override: json|toon\")\n .action(runEvalAction);\n }\n\n if (shouldRegister(\"get\")) {\n const getCommand = program\n .command(\"get\")\n .argument(\"<id>\", \"Item id\")\n .option(\n \"--depth <value>\",\n \"Detail depth: brief|standard|deep|full (full aliases deep; default: standard)\",\n )\n .option(\n \"--full\",\n \"Explicit full item read; equivalent to --depth deep (mutually exclusive with --depth/--fields)\",\n )\n .option(\n \"--fields <value>\",\n \"Render custom comma-separated item metadata fields (for example: --fields id,title,status,parent,type)\",\n )\n .option(\"--tree\", \"Include descendants rooted at the requested item\")\n .option(\n \"--tree-depth <n>\",\n \"Maximum subtree depth for --tree descendants\",\n )\n .option(\n \"--at <version-or-timestamp>\",\n \"Reconstruct a verified historical item state without mutating it\",\n )\n .option(\"--format <value>\", \"Get output format override: json|toon\")\n .description(\"Show item details by ID.\")\n .action(runGetAction);\n addHiddenOption(getCommand, \"--tree_depth <n>\", \"Alias for --tree-depth\");\n }\n\n if (shouldRegister(\"history\")) {\n program\n .command(\"history\")\n .argument(\"<id>\", \"Item id\")\n .option(\"--limit <n>\", \"Return only the latest n history entries\")\n .option(\n \"--compact\",\n \"Condensed output: show entry index, timestamp, op, author, patch count, and changed fields\",\n )\n .option(\"--full\", \"Show full history entries with JSON Patch payloads\")\n .option(\n \"--diff\",\n \"Include per-entry field-level before/after value diffs computed by replaying the history chain\",\n )\n .option(\n \"--field <name>\",\n \"With --diff, show only entries that changed this field (implies --diff)\",\n )\n .option(\n \"--verify\",\n \"Verify hash chain and replay integrity for the full history stream\",\n )\n .option(\"--format <value>\", \"History output format override: json|toon\")\n .description(\"Show item history entries.\")\n .action(runHistoryAction);\n }\n\n if (shouldRegister(\"activity\")) {\n program\n .command(\"activity\")\n .option(\"--id <value>\", \"Filter by item ID\")\n .option(\"--op <value>\", \"Filter by history operation\")\n .option(\"--author <value>\", \"Filter by history author\")\n .option(\n \"--from <value>\",\n \"Lower timestamp bound (ISO/date string or relative)\",\n )\n .option(\n \"--to <value>\",\n \"Upper timestamp bound (ISO/date string or relative)\",\n )\n .option(\"--limit <n>\", \"Return only the latest n activity entries\")\n .option(\n \"--compact\",\n \"Condensed output: show only id, op, ts, author, msg per entry\",\n )\n .option(\"--full\", \"Show full activity entries with JSON Patch payloads\")\n .option(\n \"--stream [mode]\",\n \"Emit line-delimited JSON rows (requires --json). Optional mode: rows|ndjson|jsonl\",\n )\n .description(\"Show recent activity across items.\")\n .action(runActivityAction);\n }\n}\n\n/** Public contract for test only register list query, shared by SDK and presentation-layer consumers. */\nexport const _testOnlyRegisterListQuery = {\n resolveReadCommandOutputFormat,\n parseListFormat,\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,SAAS,eAAe,MAAkB;AACxC,QAAM,UAAoB,CAAA;AAC1B,QAAM,OAAO,oBAAI,IAAG;AACpB,aAAW,OAAO,MAAM;AACtB,eAAW,OAAO,OAAO,KAAK,GAAG,GAAG;AAClC,UAAI,CAAC,KAAK,IAAI,GAAG,GAAG;AAClB,aAAK,IAAI,GAAG;AACZ,gBAAQ,KAAK,GAAG;MAClB;IACF;EACF;AACA,SAAO;AACT;AAGA,SAAS,WAAW,OAAc;AAChC,MAAI,UAAU,QAAQ,UAAU,QAAW;AACzC,WAAO;EACT;AACA,MAAI,MAAM,QAAQ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