@unbrained/pm-cli 2026.10.14 → 2026.10.15
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 +1 -1
- package/CHANGELOG.md +54 -2
- package/dist/cli/after-command-context-usage.d.ts +7 -7
- package/dist/cli/argv-utils.d.ts +4 -4
- package/dist/cli/bundle-integrity.d.ts +16 -16
- package/dist/cli/command-namespaces.d.ts +1 -1
- package/dist/cli/commander-usage.d.ts +34 -34
- package/dist/cli/commands/governance/validate.d.ts +1 -1
- package/dist/cli/commands/history/history-compact.d.ts +1 -1
- package/dist/cli/commands/history/history-redact.d.ts +1 -1
- package/dist/cli/commands/history/history-repair.d.ts +1 -1
- package/dist/cli/commands/history/restore.d.ts +1 -1
- package/dist/cli/commands/lifecycle/close.d.ts +1 -1
- package/dist/cli/commands/lifecycle/copy.d.ts +1 -1
- package/dist/cli/commands/lifecycle/delete.d.ts +1 -1
- package/dist/cli/commands/lifecycle/focus.d.ts +1 -1
- package/dist/cli/commands/query/get.d.ts +1 -1
- package/dist/cli/commands/workspace/merge.d.ts +1 -1
- package/dist/cli/commands/workspace/schema.d.ts +1 -1
- package/dist/cli/context-intent-invocation.d.ts +1 -1
- package/dist/cli/description-stdin.d.ts +1 -1
- package/dist/cli/error-guidance.d.ts +119 -119
- package/dist/cli/extension-command-help.d.ts +64 -64
- package/dist/cli/extension-command-help.js +2 -2
- package/dist/cli/extension-command-options.d.ts +16 -16
- package/dist/cli/extension-recovery.d.ts +13 -13
- package/dist/cli/help-content.d.ts +22 -22
- package/dist/cli/help-content.js +2 -2
- package/dist/cli/help-json-payload.d.ts +45 -45
- package/dist/cli/invocation-profile.d.ts +5 -5
- package/dist/cli/main.d.ts +217 -217
- package/dist/cli/migration-gates.d.ts +24 -24
- package/dist/cli/option-values.d.ts +1 -1
- package/dist/cli/public.d.ts +1 -1
- package/dist/cli/register-annotations.d.ts +2 -2
- package/dist/cli/register-assurance.d.ts +1 -1
- package/dist/cli/register-files-lookup.d.ts +1 -1
- package/dist/cli/register-history-activity.d.ts +1 -1
- package/dist/cli/register-history-author.d.ts +1 -1
- package/dist/cli/register-history-maintenance.d.ts +1 -1
- package/dist/cli/register-list-query.d.ts +7 -7
- package/dist/cli/register-list-query.js +3 -3
- package/dist/cli/register-mutation-options.d.ts +1 -1
- package/dist/cli/register-mutation.d.ts +4 -4
- package/dist/cli/register-operations.d.ts +75 -75
- package/dist/cli/register-setup.d.ts +4 -4
- package/dist/cli/register-structured-mutation.d.ts +8 -8
- package/dist/cli/runtime/activation.d.ts +23 -23
- package/dist/cli/runtime/invocation-options.d.ts +12 -12
- package/dist/cli/runtime/projection-retry.d.ts +1 -1
- package/dist/cli/runtime/selection.d.ts +16 -16
- package/dist/cli/runtime/telemetry-outcome.d.ts +11 -11
- package/dist/cli/runtime-compatibility-boundary.d.ts +7 -7
- package/dist/cli/schema/registration.d.ts +1 -1
- package/dist/cli/schema-registration-helpers.d.ts +2 -2
- package/dist/cli/stats-analytics-json.d.ts +1 -1
- package/dist/cli-bundle/bundle-manifest.json +1 -1
- package/dist/cli-bundle/chunks/{chunk-5LU6PWA4.js → chunk-52EZH2QQ.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-7OEGNA4X.js +20 -0
- package/dist/cli-bundle/chunks/{chunk-LKESCZEN.js → chunk-7VHINXZP.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-EMEEHV2Y.js +2 -0
- package/dist/cli-bundle/chunks/chunk-JGKTOBVB.js +6 -0
- package/dist/cli-bundle/chunks/{chunk-PP3BVMFL.js → chunk-JSUJWIHQ.js} +30 -30
- package/dist/cli-bundle/chunks/{chunk-MAT4AP7P.js → chunk-LNKLQYBG.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-LE4IEHDG.js → chunk-N56CAQBU.js} +63 -64
- package/dist/cli-bundle/chunks/{chunk-3S5SEMEB.js → chunk-NC3QVGDD.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-2UKKO45F.js → chunk-RJ5N44WY.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-LOSRTNNP.js → chunk-VIMQCFCK.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-JTF6VMXH.js → chunk-WBBW3WQX.js} +4 -4
- package/dist/cli-bundle/chunks/chunk-X2H6UR26.js +236 -0
- package/dist/cli-bundle/chunks/{register-list-query-GBLTOQQL.js → register-list-query-FKKFQ66D.js} +7 -7
- package/dist/cli-bundle/chunks/{register-mutation-TNRHNK4N.js → register-mutation-EWMMVZJB.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-J3WXP3MA.js → register-operations-GEQ2H7PS.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-HLSKKU4V.js → register-setup-PSJTQBBO.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-4UA7KY4V.js → chunk-3RNUMVK4.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-BUAGNTLG.js → chunk-4KQFMOM7.js} +6 -6
- package/dist/cli-bundle/focused-chunks/{chunk-QIU4Y3AB.js → chunk-52I2SNKJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-Y5A4XOSK.js → chunk-5KRACGBK.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-HNRI2KBT.js → chunk-5OO54BIV.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-LKWDWER4.js → chunk-5TBAVZDR.js} +14 -14
- package/dist/cli-bundle/focused-chunks/{chunk-RHQCQTZA.js → chunk-FQKPOZKS.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-IGBSAHCA.js → chunk-H3P77KVU.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-HTA3TNC3.js +26 -0
- package/dist/cli-bundle/focused-chunks/{chunk-23ACMPGB.js → chunk-JKBH7YGX.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-AULVKHYX.js → chunk-KIIFVULU.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ESOW6PH4.js → chunk-N6FUKTZS.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-PDYE7QDX.js +166 -0
- package/dist/cli-bundle/focused-chunks/{chunk-KSMQEB3V.js → chunk-Q4VNCTR2.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-YJNKISEI.js → chunk-THYQR3ON.js} +61 -62
- package/dist/cli-bundle/focused-chunks/{chunk-ELQNEJDA.js → chunk-TYLG5VEB.js} +2 -2
- package/dist/cli-bundle/main.js +26 -26
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +2 -2
- package/dist/cli-bundle/sdk-core.js +22 -22
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +51 -51
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +7 -7
- package/dist/cli.d.ts +9 -9
- package/dist/core/checkpoint/checkpoint-gc.d.ts +17 -17
- package/dist/core/checkpoint/mutation-checkpoint.d.ts +26 -26
- package/dist/core/config/nested-settings.d.ts +20 -20
- package/dist/core/config/positional-value.d.ts +9 -9
- package/dist/core/diagnostics/remediation.d.ts +7 -7
- package/dist/core/extensions/activation-summary-markdown.d.ts +4 -4
- package/dist/core/extensions/activation-summary.d.ts +30 -30
- package/dist/core/extensions/activation-transaction.d.ts +9 -9
- package/dist/core/extensions/capability-usage.d.ts +25 -25
- package/dist/core/extensions/command-hook-context.d.ts +15 -15
- package/dist/core/extensions/command-metadata-contract.d.ts +1 -1
- package/dist/core/extensions/command-visibility-tier.d.ts +1 -1
- package/dist/core/extensions/contribution-inventory.d.ts +24 -24
- package/dist/core/extensions/exporter-output-contract.d.ts +4 -4
- package/dist/core/extensions/extension-candidate.d.ts +14 -14
- package/dist/core/extensions/extension-capability-aliases.d.ts +14 -14
- package/dist/core/extensions/extension-hook-runtime.d.ts +14 -14
- package/dist/core/extensions/extension-policy.d.ts +62 -62
- package/dist/core/extensions/extension-registries.d.ts +8 -8
- package/dist/core/extensions/extension-runtime-helpers.d.ts +5 -5
- package/dist/core/extensions/extension-types.d.ts +702 -702
- package/dist/core/extensions/flag-definition-validation.d.ts +11 -11
- package/dist/core/extensions/flag-value-types.d.ts +16 -4
- package/dist/core/extensions/flag-value-types.js +1 -1
- package/dist/core/extensions/index.d.ts +34 -34
- package/dist/core/extensions/item-field-types.d.ts +3 -3
- package/dist/core/extensions/item-fields.d.ts +6 -6
- package/dist/core/extensions/loader.d.ts +66 -66
- package/dist/core/extensions/manifest-parser.d.ts +1 -1
- package/dist/core/extensions/manifest-schema.d.ts +13 -13
- package/dist/core/extensions/module-graph-snapshot.d.ts +5 -5
- package/dist/core/extensions/preflight-ownership.d.ts +3 -3
- package/dist/core/extensions/read-output-contract.d.ts +2 -2
- package/dist/core/extensions/registration-contracts.d.ts +12 -12
- package/dist/core/extensions/registration-validation.d.ts +6 -6
- package/dist/core/extensions/registration-values.d.ts +19 -19
- package/dist/core/extensions/reserved-host-flags.d.ts +5 -5
- package/dist/core/extensions/runtime-registrations.d.ts +6 -6
- package/dist/core/extensions/service-ownership.d.ts +1 -1
- package/dist/core/extensions/version-compat.d.ts +9 -9
- package/dist/core/fs/atomic-create.d.ts +1 -1
- package/dist/core/fs/fs-utils.d.ts +12 -12
- package/dist/core/fs/host-environment-errors.d.ts +10 -10
- package/dist/core/fs/path-utils.d.ts +1 -1
- package/dist/core/governance/content-fields.d.ts +25 -25
- package/dist/core/governance/issue-codes.d.ts +16 -16
- package/dist/core/governance/metadata-coverage.d.ts +64 -64
- package/dist/core/history/digest.d.ts +5 -5
- package/dist/core/history/drift-cache.d.ts +2 -2
- package/dist/core/history/drift-scan.d.ts +18 -18
- package/dist/core/history/event-classification.d.ts +4 -4
- package/dist/core/history/event-index.d.ts +33 -33
- package/dist/core/history/history-compact-bulk.d.ts +12 -12
- package/dist/core/history/history-diff.d.ts +15 -15
- package/dist/core/history/history-rewrite.d.ts +43 -43
- package/dist/core/history/history-storage-stats.d.ts +20 -20
- package/dist/core/history/history-stream-policy.d.ts +12 -12
- package/dist/core/history/history.d.ts +45 -45
- package/dist/core/history/identity.d.ts +4 -4
- package/dist/core/history/operation-contract.d.ts +17 -17
- package/dist/core/history/projection.d.ts +16 -16
- package/dist/core/history/read.d.ts +4 -4
- package/dist/core/history/replay.d.ts +47 -47
- package/dist/core/history/tombstone.d.ts +1 -1
- package/dist/core/history/version-address.d.ts +2 -2
- package/dist/core/history/workspace-history.d.ts +72 -72
- package/dist/core/io/body-file.d.ts +2 -2
- package/dist/core/io/bulk-ids-input.d.ts +7 -7
- package/dist/core/item/actionability.d.ts +30 -30
- package/dist/core/item/dependency-reference.d.ts +2 -2
- package/dist/core/item/id.d.ts +9 -9
- package/dist/core/item/item-format-version.d.ts +17 -15
- package/dist/core/item/item-format-version.js +1 -1
- package/dist/core/item/item-format.d.ts +54 -54
- package/dist/core/item/item-record.d.ts +1 -1
- package/dist/core/item/item-type-definition.d.ts +11 -11
- package/dist/core/item/parent-reference-policy.d.ts +6 -6
- package/dist/core/item/parse.d.ts +37 -37
- package/dist/core/item/plan-lifecycle.d.ts +4 -4
- package/dist/core/item/priority.d.ts +3 -3
- package/dist/core/item/sprint-release-format.d.ts +4 -4
- package/dist/core/item/status-filter.d.ts +5 -5
- package/dist/core/item/status.d.ts +3 -3
- package/dist/core/item/toon-decode.d.ts +10 -10
- package/dist/core/item/type-registry.d.ts +35 -35
- package/dist/core/item/type-synonyms.d.ts +2 -2
- package/dist/core/lock/lock-gc.d.ts +28 -28
- package/dist/core/lock/lock.d.ts +53 -53
- package/dist/core/output/mutation-projection.d.ts +4 -4
- package/dist/core/output/output-control.d.ts +4 -4
- package/dist/core/output/output.d.ts +30 -30
- package/dist/core/output/query-summary.d.ts +5 -5
- package/dist/core/output/tabular.d.ts +3 -3
- package/dist/core/packages/manifest.d.ts +30 -30
- package/dist/core/packages/root.d.ts +4 -4
- package/dist/core/policy/workflow-policy-schema.d.ts +291 -291
- package/dist/core/policy/workflow-policy-store.d.ts +15 -15
- package/dist/core/policy/workflow-policy.d.ts +56 -56
- package/dist/core/profile/profile-describe.d.ts +22 -22
- package/dist/core/profile/profile-lint.d.ts +13 -13
- package/dist/core/profile/profile-plan.d.ts +45 -45
- package/dist/core/profile/profile-presets.d.ts +36 -36
- package/dist/core/reproducibility/context.d.ts +9 -9
- package/dist/core/schema/fields-file.d.ts +35 -35
- package/dist/core/schema/item-types-file.d.ts +29 -29
- package/dist/core/schema/runtime-field-filters.d.ts +3 -3
- package/dist/core/schema/runtime-field-values.d.ts +7 -7
- package/dist/core/schema/runtime-schema.d.ts +59 -59
- package/dist/core/schema/status-defs-file.d.ts +29 -29
- package/dist/core/schema/status-token.d.ts +1 -1
- package/dist/core/schema/type-inference.d.ts +10 -10
- package/dist/core/schema/type-presets.d.ts +5 -5
- package/dist/core/schema/type-workflows.d.ts +14 -14
- package/dist/core/search/background-refresh.d.ts +12 -12
- package/dist/core/search/bm25.d.ts +16 -16
- package/dist/core/search/cache.d.ts +34 -34
- package/dist/core/search/corpus.d.ts +17 -17
- package/dist/core/search/embedding-batches.d.ts +25 -25
- package/dist/core/search/eval-thresholds.d.ts +4 -4
- package/dist/core/search/eval.d.ts +40 -40
- package/dist/core/search/http-client.d.ts +24 -24
- package/dist/core/search/providers.d.ts +30 -30
- package/dist/core/search/relevance.d.ts +17 -17
- package/dist/core/search/semantic-defaults.d.ts +5 -5
- package/dist/core/search/staleness.d.ts +3 -3
- package/dist/core/search/vector-stores.d.ts +51 -51
- package/dist/core/search/vectorization-metadata.d.ts +9 -9
- package/dist/core/sentry/helpers.d.ts +27 -27
- package/dist/core/sentry/instrument.d.ts +51 -51
- package/dist/core/sentry/instrument.js +1 -1
- package/dist/core/sentry/sensitive-assignments.d.ts +9 -0
- package/dist/core/sentry/sensitive-assignments.js +2 -0
- package/dist/core/session/session-state.d.ts +37 -37
- package/dist/core/shared/agent-session-context.d.ts +14 -14
- package/dist/core/shared/author.d.ts +89 -89
- package/dist/core/shared/command-line.d.ts +3 -3
- package/dist/core/shared/command-types.d.ts +20 -20
- package/dist/core/shared/conflict-markers.d.ts +5 -5
- package/dist/core/shared/constants.d.ts +30 -30
- package/dist/core/shared/errors.d.ts +100 -100
- package/dist/core/shared/html-entity-decode.d.ts +2 -2
- package/dist/core/shared/item-metadata-contract.d.ts +2 -2
- package/dist/core/shared/lazy-module.d.ts +1 -1
- package/dist/core/shared/levenshtein.d.ts +1 -1
- package/dist/core/shared/memo.d.ts +1 -1
- package/dist/core/shared/numeric-parsers.d.ts +1 -1
- package/dist/core/shared/option-alias-visibility.d.ts +3 -3
- package/dist/core/shared/primitives.d.ts +13 -13
- package/dist/core/shared/secret-rules.d.ts +92 -92
- package/dist/core/shared/serial-queue.d.ts +6 -6
- package/dist/core/shared/serialization.d.ts +4 -4
- package/dist/core/shared/split-comma-list.d.ts +4 -4
- package/dist/core/shared/text-normalization.d.ts +3 -3
- package/dist/core/shared/time.d.ts +27 -27
- package/dist/core/store/item-format-migration.d.ts +7 -7
- package/dist/core/store/item-metadata-cache.d.ts +30 -30
- package/dist/core/store/item-metadata-query-index.d.ts +66 -66
- package/dist/core/store/item-metadata-read-work.d.ts +6 -6
- package/dist/core/store/item-store.d.ts +123 -123
- package/dist/core/store/item-store.js +1 -1
- package/dist/core/store/paths.d.ts +27 -27
- package/dist/core/store/settings-concurrency.d.ts +1 -1
- package/dist/core/store/settings-read-cache.d.ts +11 -11
- package/dist/core/store/settings-validator.d.ts +117 -117
- package/dist/core/store/settings.d.ts +84 -84
- package/dist/core/store/sqlite-runtime.d.ts +2 -2
- package/dist/core/store/tracker-preflight.d.ts +3 -3
- package/dist/core/telemetry/consent.d.ts +1 -1
- package/dist/core/telemetry/observability.d.ts +16 -16
- package/dist/core/telemetry/policy.d.ts +7 -7
- package/dist/core/telemetry/read-sampling.d.ts +1 -1
- package/dist/core/telemetry/runtime.d.ts +275 -275
- package/dist/core/test/background-runs.d.ts +123 -123
- package/dist/core/test/item-test-run-tracking.d.ts +10 -10
- package/dist/core/test/run-selectors.d.ts +12 -12
- package/dist/core/validate/estimate-defaults.d.ts +3 -3
- package/dist/core/validate/fix-planning.d.ts +36 -36
- package/dist/core/validate/linked-artifact-reference.d.ts +1 -1
- package/dist/core/validate/missing-by-type.d.ts +3 -3
- package/dist/core/validate/missing-link-owners.d.ts +17 -17
- package/dist/core/validate/stale-file-classification.d.ts +6 -6
- package/dist/mcp/http-server.d.ts +26 -26
- package/dist/mcp/legacy-adapter.d.ts +18 -18
- package/dist/mcp/runtime-capabilities.d.ts +18 -18
- package/dist/mcp/server.d.ts +73 -73
- package/dist/mcp/tool-definitions.d.ts +27 -27
- package/dist/sdk/actionability.d.ts +1 -1
- package/dist/sdk/agent/closed-domain-contracts.d.ts +11 -11
- package/dist/sdk/agent/command-recovery.d.ts +5 -5
- package/dist/sdk/agent/command-suggestions.d.ts +4 -4
- package/dist/sdk/agent/create-option-policy.d.ts +2 -2
- package/dist/sdk/agent/identity-config.d.ts +18 -18
- package/dist/sdk/agent/item-addressing.d.ts +6 -6
- package/dist/sdk/agent/refusal-closure-census.d.ts +26 -26
- package/dist/sdk/agent/refusal-closure.d.ts +22 -22
- package/dist/sdk/agent/refusal-corpus-contracts.d.ts +26 -26
- package/dist/sdk/agent/refusal-reachability.d.ts +65 -65
- package/dist/sdk/agent/subcommand-recovery.d.ts +20 -20
- package/dist/sdk/agent/task-transcript-contracts.d.ts +18 -18
- package/dist/sdk/agent/tracker-preflight-contracts.d.ts +21 -21
- package/dist/sdk/agent-capability-contracts.d.ts +41 -41
- package/dist/sdk/agent-session-context.d.ts +1 -1
- package/dist/sdk/annotations.d.ts +74 -74
- package/dist/sdk/author-attribution.d.ts +47 -47
- package/dist/sdk/authoring.d.ts +9 -9
- package/dist/sdk/cli-bootstrap.d.ts +65 -65
- package/dist/sdk/cli-contracts/agent-output-contracts.d.ts +56 -56
- package/dist/sdk/cli-contracts/bootstrap-command-scanner.d.ts +6 -6
- package/dist/sdk/cli-contracts/command-aliases.d.ts +19 -19
- package/dist/sdk/cli-contracts/command-exit-contracts.d.ts +66 -66
- package/dist/sdk/cli-contracts/commander-mutation-options.d.ts +7 -7
- package/dist/sdk/cli-contracts/commander-types.d.ts +18 -18
- package/dist/sdk/cli-contracts/completeness.d.ts +14 -14
- package/dist/sdk/cli-contracts/enum-contracts.d.ts +28 -28
- package/dist/sdk/cli-contracts/flag-contracts.d.ts +114 -112
- package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.d.ts +27 -27
- package/dist/sdk/cli-contracts/grammar-contracts.d.ts +61 -61
- package/dist/sdk/cli-contracts/registration-helpers.d.ts +56 -56
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +250 -250
- package/dist/sdk/cli-contracts/runtime-contracts.js +1 -1
- package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +678 -678
- package/dist/sdk/cli-contracts/string-lists.d.ts +1 -1
- package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +564 -564
- package/dist/sdk/cli-contracts/tool-parameter-tables.d.ts +13 -13
- package/dist/sdk/cli-contracts/tool-schema.d.ts +54 -54
- package/dist/sdk/cli-contracts/typed-action-inputs.d.ts +20 -20
- package/dist/sdk/cli-contracts.d.ts +15 -15
- package/dist/sdk/cli-program.d.ts +1 -1
- package/dist/sdk/cli-program.js +1 -1
- package/dist/sdk/command-line.d.ts +3 -3
- package/dist/sdk/comments.d.ts +24 -24
- package/dist/sdk/compile-cache.d.ts +4 -4
- package/dist/sdk/completion/bash.d.ts +1 -1
- package/dist/sdk/completion/fish.d.ts +1 -1
- package/dist/sdk/completion/shared.d.ts +74 -74
- package/dist/sdk/completion/zsh.d.ts +1 -1
- package/dist/sdk/completion.d.ts +3 -3
- package/dist/sdk/compose.d.ts +94 -94
- package/dist/sdk/config.d.ts +105 -105
- package/dist/sdk/context/recency.d.ts +1 -1
- package/dist/sdk/context/semantic-session-attribution.d.ts +23 -23
- package/dist/sdk/context/usage-egress.d.ts +1 -1
- package/dist/sdk/context/usage-ledger.d.ts +18 -18
- package/dist/sdk/context-intent-contracts.d.ts +37 -37
- package/dist/sdk/context-intent-runtime.d.ts +10 -10
- package/dist/sdk/context-packing.d.ts +44 -44
- package/dist/sdk/context-relevance.d.ts +110 -110
- package/dist/sdk/context-signal-store.d.ts +52 -52
- package/dist/sdk/context-usage.d.ts +78 -78
- package/dist/sdk/contracts.d.ts +2 -1
- package/dist/sdk/contracts.js +1 -1
- package/dist/sdk/core-governance.d.ts +5 -5
- package/dist/sdk/core.d.ts +8 -8
- package/dist/sdk/corpus-shape.d.ts +60 -60
- package/dist/sdk/define.d.ts +36 -36
- package/dist/sdk/dependencies.d.ts +70 -70
- package/dist/sdk/dependency-flag-validation.d.ts +17 -17
- package/dist/sdk/dependency-provenance.d.ts +22 -22
- package/dist/sdk/docs.d.ts +17 -17
- package/dist/sdk/duplicates.d.ts +14 -14
- package/dist/sdk/environment/agent-environment.d.ts +118 -118
- package/dist/sdk/environment/host-environment-errors.d.ts +1 -1
- package/dist/sdk/environment/project-runtime-compatibility.d.ts +42 -40
- package/dist/sdk/environment/project-runtime-compatibility.js +2 -2
- package/dist/sdk/environment/source-context.d.ts +4 -4
- package/dist/sdk/environment/tracker-preflight.d.ts +1 -1
- package/dist/sdk/error-code-catalog.d.ts +33 -33
- package/dist/sdk/error-runtime.d.ts +5 -5
- package/dist/sdk/errors.d.ts +17 -17
- package/dist/sdk/eval.d.ts +27 -27
- package/dist/sdk/extension/author-manifest.d.ts +9 -9
- package/dist/sdk/extension/bundled-catalog.d.ts +18 -18
- package/dist/sdk/extension/concurrency.d.ts +1 -1
- package/dist/sdk/extension/copy-scope.d.ts +1 -1
- package/dist/sdk/extension/custom-field-collisions.d.ts +1 -1
- package/dist/sdk/extension/describe.d.ts +21 -21
- package/dist/sdk/extension/doctor.d.ts +46 -46
- package/dist/sdk/extension/install-plan.d.ts +32 -32
- package/dist/sdk/extension/install-receipts.d.ts +4 -4
- package/dist/sdk/extension/install-runtime.d.ts +12 -12
- package/dist/sdk/extension/install-snapshot.d.ts +10 -10
- package/dist/sdk/extension/install-sources.d.ts +106 -106
- package/dist/sdk/extension/managed-state.d.ts +42 -42
- package/dist/sdk/extension/managed-update-status.d.ts +1 -1
- package/dist/sdk/extension/migrations.d.ts +48 -48
- package/dist/sdk/extension/output-ownership.d.ts +19 -19
- package/dist/sdk/extension/runtime-summary.d.ts +7 -7
- package/dist/sdk/extension/scaffold.d.ts +15 -15
- package/dist/sdk/extension/shared.d.ts +16 -16
- package/dist/sdk/extension/source-resolution.d.ts +16 -16
- package/dist/sdk/extension/static-inventory.d.ts +23 -23
- package/dist/sdk/extension/update-check.d.ts +9 -9
- package/dist/sdk/extension-command-context.d.ts +1 -1
- package/dist/sdk/extension-contracts.d.ts +10 -10
- package/dist/sdk/extension.d.ts +221 -221
- package/dist/sdk/files.d.ts +101 -101
- package/dist/sdk/flag-invocation-contracts.d.ts +25 -25
- package/dist/sdk/flag-invocation-contracts.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-1.d.ts +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-2.d.ts +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
- package/dist/sdk/generated-error-code-catalog.d.ts +1 -1
- package/dist/sdk/governance/artifact-ledgers.d.ts +19 -19
- package/dist/sdk/governance/assurance-action-contracts.d.ts +1 -1
- package/dist/sdk/governance/assurance-action.d.ts +46 -46
- package/dist/sdk/governance/assurance-mutation-error.d.ts +20 -20
- package/dist/sdk/governance/assurance-presets.d.ts +25 -25
- package/dist/sdk/governance/assurance-runtime.d.ts +10 -10
- package/dist/sdk/governance/assurance.d.ts +204 -204
- package/dist/sdk/governance/boundary-fixtures.d.ts +32 -32
- package/dist/sdk/governance/closure-timestamps.d.ts +10 -10
- package/dist/sdk/governance/coverage-assurance.d.ts +7 -7
- package/dist/sdk/governance/defect-recurrence-coverage.d.ts +40 -40
- package/dist/sdk/governance/defect-recurrence-graph.d.ts +11 -11
- package/dist/sdk/governance/defect-recurrence-signals.d.ts +1 -1
- package/dist/sdk/governance/defect-recurrence.d.ts +97 -97
- package/dist/sdk/governance/extension-host-version.d.ts +9 -9
- package/dist/sdk/governance/gc.d.ts +26 -26
- package/dist/sdk/governance/health-merge-evidence.d.ts +8 -8
- package/dist/sdk/governance/health.d.ts +172 -172
- package/dist/sdk/governance/health.js +1 -1
- package/dist/sdk/governance/hierarchy-validation.d.ts +16 -16
- package/dist/sdk/governance/linked-file-report.d.ts +15 -15
- package/dist/sdk/governance/merge-receipt-history.d.ts +24 -24
- package/dist/sdk/governance/provenance-health.d.ts +35 -35
- package/dist/sdk/governance/reindex.d.ts +102 -102
- package/dist/sdk/governance/reliability.d.ts +29 -29
- package/dist/sdk/governance/stale-work.d.ts +13 -13
- package/dist/sdk/governance/status-role-diagnostics.d.ts +8 -8
- package/dist/sdk/governance/storage-integrity.d.ts +28 -28
- package/dist/sdk/governance/tracked-runtime-cache.d.ts +7 -7
- package/dist/sdk/governance/upgrade.d.ts +77 -77
- package/dist/sdk/governance/validate-history-drift.d.ts +3 -3
- package/dist/sdk/governance/validate-item-reader.d.ts +9 -9
- package/dist/sdk/governance/validate-normalization.d.ts +4 -4
- package/dist/sdk/governance/validate.d.ts +176 -176
- package/dist/sdk/governance/validate.js +1 -1
- package/dist/sdk/governance/workflow-completeness.d.ts +15 -15
- package/dist/sdk/governance/workflow-policy.d.ts +18 -18
- package/dist/sdk/governance/workspace-position.d.ts +40 -40
- package/dist/sdk/governance.d.ts +2 -2
- package/dist/sdk/graph/adapter.d.ts +45 -45
- package/dist/sdk/graph/analytics.d.ts +36 -36
- package/dist/sdk/graph/assembly.d.ts +51 -51
- package/dist/sdk/graph/cache.d.ts +19 -19
- package/dist/sdk/graph/cardinality-integrity.d.ts +4 -4
- package/dist/sdk/graph/centrality.d.ts +20 -20
- package/dist/sdk/graph/conformance.d.ts +21 -21
- package/dist/sdk/graph/deadline-scheduling.d.ts +30 -30
- package/dist/sdk/graph/durable-cache.d.ts +22 -22
- package/dist/sdk/graph/governance-contracts.d.ts +1 -1
- package/dist/sdk/graph/governance.d.ts +92 -92
- package/dist/sdk/graph/hierarchy-integrity.d.ts +32 -32
- package/dist/sdk/graph/index.d.ts +15 -15
- package/dist/sdk/graph/lifecycle-coverage.d.ts +12 -12
- package/dist/sdk/graph/mutation-advisory.d.ts +15 -15
- package/dist/sdk/graph/query-contracts.d.ts +6 -6
- package/dist/sdk/graph/remediation.d.ts +15 -15
- package/dist/sdk/graph/run.d.ts +203 -203
- package/dist/sdk/graph/scheduling.d.ts +21 -21
- package/dist/sdk/graph/traversal.d.ts +18 -18
- package/dist/sdk/graph/workspace-relationship-kind-registry.d.ts +1 -1
- package/dist/sdk/guide-topics.d.ts +19 -19
- package/dist/sdk/guide.d.ts +43 -43
- package/dist/sdk/history/attestation-command.d.ts +8 -8
- package/dist/sdk/history/attestation-contract.d.ts +43 -43
- package/dist/sdk/history/attestation-scan.d.ts +4 -4
- package/dist/sdk/history/attestation.d.ts +4 -4
- package/dist/sdk/history/maintenance.d.ts +25 -25
- package/dist/sdk/history/salvage.d.ts +19 -19
- package/dist/sdk/history/subject.d.ts +8 -8
- package/dist/sdk/history-analytics.d.ts +64 -64
- package/dist/sdk/history-compact.d.ts +67 -67
- package/dist/sdk/history-mcp.d.ts +7 -7
- package/dist/sdk/history-provenance.d.ts +40 -40
- package/dist/sdk/history-read.d.ts +24 -24
- package/dist/sdk/history-redact.d.ts +68 -68
- package/dist/sdk/history-repair.d.ts +92 -92
- package/dist/sdk/improvement-ledger-validation.d.ts +1 -1
- package/dist/sdk/improvement-ledger.d.ts +62 -62
- package/dist/sdk/index.d.ts +69 -69
- package/dist/sdk/init-agent-guidance.d.ts +68 -68
- package/dist/sdk/init.d.ts +117 -117
- package/dist/sdk/invocation-author.d.ts +1 -1
- package/dist/sdk/item-children.d.ts +15 -15
- package/dist/sdk/item-metadata-index.d.ts +2 -2
- package/dist/sdk/item-schedule.d.ts +9 -9
- package/dist/sdk/item-transaction.d.ts +73 -73
- package/dist/sdk/learnings.d.ts +23 -23
- package/dist/sdk/lifecycle/append.d.ts +8 -8
- package/dist/sdk/lifecycle/claim.d.ts +38 -38
- package/dist/sdk/lifecycle/close-many.d.ts +71 -71
- package/dist/sdk/lifecycle/close.d.ts +18 -18
- package/dist/sdk/lifecycle/copy.d.ts +10 -10
- package/dist/sdk/lifecycle/core-field-recovery.d.ts +1 -1
- package/dist/sdk/lifecycle/create.d.ts +88 -88
- package/dist/sdk/lifecycle/delete.d.ts +15 -15
- package/dist/sdk/lifecycle/event-validation-messages.d.ts +1 -1
- package/dist/sdk/lifecycle/focus.d.ts +6 -6
- package/dist/sdk/lifecycle/hierarchy-mutation-lock.d.ts +6 -6
- package/dist/sdk/lifecycle/legacy-none-tokens.d.ts +35 -35
- package/dist/sdk/lifecycle/lifecycle-transitions.d.ts +3 -3
- package/dist/sdk/lifecycle/mcp-actions.d.ts +10 -10
- package/dist/sdk/lifecycle/metadata-normalizers.d.ts +4 -4
- package/dist/sdk/lifecycle/mutation-command-options.d.ts +58 -58
- package/dist/sdk/lifecycle/mutation-facet-contracts.d.ts +1 -1
- package/dist/sdk/lifecycle/plan-mutation-receipt.d.ts +24 -24
- package/dist/sdk/lifecycle/plan.d.ts +127 -127
- package/dist/sdk/lifecycle/recurrence-parsers.d.ts +5 -5
- package/dist/sdk/lifecycle/reopen.d.ts +15 -15
- package/dist/sdk/lifecycle/repeatable-metadata-parsers.d.ts +7 -7
- package/dist/sdk/lifecycle/restore.d.ts +34 -34
- package/dist/sdk/lifecycle/restore.js +1 -1
- package/dist/sdk/lifecycle/shared-unset-fields.d.ts +20 -20
- package/dist/sdk/lifecycle/task-composition.d.ts +7 -7
- package/dist/sdk/lifecycle/update-many.d.ts +61 -61
- package/dist/sdk/lifecycle/update.d.ts +120 -120
- package/dist/sdk/lifecycle-completion.d.ts +14 -14
- package/dist/sdk/lifecycle-policy.d.ts +31 -31
- package/dist/sdk/linked-artifacts.d.ts +58 -58
- package/dist/sdk/mcp/apps.d.ts +28 -28
- package/dist/sdk/mcp/authorization.d.ts +66 -66
- package/dist/sdk/mcp/discovery.d.ts +67 -67
- package/dist/sdk/mcp/interactions.d.ts +49 -49
- package/dist/sdk/mcp/protocol.d.ts +63 -63
- package/dist/sdk/mcp/skills.d.ts +62 -62
- package/dist/sdk/mcp/subscriptions.d.ts +26 -26
- package/dist/sdk/mcp/tasks.d.ts +51 -51
- package/dist/sdk/mcp/transport.d.ts +17 -17
- package/dist/sdk/merge/abandoned-receipts.d.ts +8 -8
- package/dist/sdk/merge/driver.d.ts +38 -38
- package/dist/sdk/merge/index.d.ts +5 -5
- package/dist/sdk/merge/install.d.ts +48 -48
- package/dist/sdk/merge/receipt-file-boundary.d.ts +6 -6
- package/dist/sdk/merge/receipt-operation.d.ts +6 -6
- package/dist/sdk/merge/receipt-schema.d.ts +11 -11
- package/dist/sdk/merge/receipts.d.ts +111 -111
- package/dist/sdk/merge/reconcile.d.ts +20 -20
- package/dist/sdk/merge/three-way.d.ts +50 -50
- package/dist/sdk/merge/three-way.js +2 -2
- package/dist/sdk/merge/worktree-config.d.ts +3 -3
- package/dist/sdk/mutation-events.d.ts +62 -62
- package/dist/sdk/mutation-guard.d.ts +134 -134
- package/dist/sdk/notes.d.ts +28 -28
- package/dist/sdk/output/table-rows.d.ts +6 -6
- package/dist/sdk/output-contracts.d.ts +26 -26
- package/dist/sdk/output-projection.d.ts +108 -108
- package/dist/sdk/output-token-accounting.d.ts +18 -18
- package/dist/sdk/output.d.ts +18 -18
- package/dist/sdk/ownership-source.d.ts +1 -1
- package/dist/sdk/package-import-adapters.d.ts +51 -51
- package/dist/sdk/package-migrations.d.ts +3 -3
- package/dist/sdk/package-runtime-options.d.ts +3 -3
- package/dist/sdk/pagination.d.ts +28 -28
- package/dist/sdk/pagination.js +1 -1
- package/dist/sdk/profile.d.ts +72 -72
- package/dist/sdk/provenance.d.ts +37 -37
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query/activity.d.ts +84 -84
- package/dist/sdk/query/aggregate.d.ts +109 -109
- package/dist/sdk/query/calendar.d.ts +95 -95
- package/dist/sdk/query/complete-list.d.ts +35 -35
- package/dist/sdk/query/context.d.ts +300 -300
- package/dist/sdk/query/duplicate-candidates.d.ts +3 -3
- package/dist/sdk/query/get.d.ts +54 -54
- package/dist/sdk/query/history.d.ts +38 -38
- package/dist/sdk/query/item-filter-options.d.ts +41 -41
- package/dist/sdk/query/light-metadata.d.ts +1 -1
- package/dist/sdk/query/list-filter-shared.d.ts +4 -4
- package/dist/sdk/query/list.d.ts +167 -167
- package/dist/sdk/query/list.js +1 -1
- package/dist/sdk/query/multi-value-filters.d.ts +6 -6
- package/dist/sdk/query/next-ready-budget.d.ts +8 -8
- package/dist/sdk/query/next.d.ts +94 -94
- package/dist/sdk/query/parsers.d.ts +3 -3
- package/dist/sdk/query/projection-contracts.d.ts +18 -18
- package/dist/sdk/query/search/corpus.d.ts +15 -15
- package/dist/sdk/query/search/filters.d.ts +15 -15
- package/dist/sdk/query/search/input.d.ts +8 -8
- package/dist/sdk/query/search/lexical.d.ts +10 -10
- package/dist/sdk/query/search/response.d.ts +22 -22
- package/dist/sdk/query/search/semantic.d.ts +133 -133
- package/dist/sdk/query/search/types.d.ts +65 -65
- package/dist/sdk/query/search-contracts.d.ts +53 -53
- package/dist/sdk/query/search-pagination.d.ts +21 -21
- package/dist/sdk/query/search-rendering.d.ts +30 -30
- package/dist/sdk/query/search.d.ts +60 -60
- package/dist/sdk/query/workspace-contracts.d.ts +2 -2
- package/dist/sdk/query.d.ts +6 -6
- package/dist/sdk/read-output/continuation.d.ts +11 -11
- package/dist/sdk/read-output/extension.d.ts +3 -3
- package/dist/sdk/read-output/options.d.ts +7 -7
- package/dist/sdk/read-output/provenance.d.ts +6 -6
- package/dist/sdk/read-output-budget.d.ts +11 -11
- package/dist/sdk/read-output-contracts.d.ts +112 -112
- package/dist/sdk/read-output-contracts.js +1 -1
- package/dist/sdk/read-output-rows.d.ts +15 -15
- package/dist/sdk/read-output-session.d.ts +29 -29
- package/dist/sdk/relationship-analytics.d.ts +46 -46
- package/dist/sdk/relationship-context.d.ts +48 -48
- package/dist/sdk/relationship-history.d.ts +59 -59
- package/dist/sdk/relationship-kinds/contract.d.ts +18 -18
- package/dist/sdk/relationship-migration.d.ts +14 -14
- package/dist/sdk/relationships.d.ts +46 -46
- package/dist/sdk/reproducibility/process.d.ts +9 -9
- package/dist/sdk/runtime/actions.d.ts +1 -1
- package/dist/sdk/runtime/context.d.ts +15 -15
- package/dist/sdk/runtime/schema-preview.d.ts +1 -1
- package/dist/sdk/runtime/schema.d.ts +1 -1
- package/dist/sdk/runtime-action-aliases.d.ts +3 -3
- package/dist/sdk/runtime-extended-actions.d.ts +9 -9
- package/dist/sdk/runtime-input.d.ts +29 -29
- package/dist/sdk/runtime-primitives.d.ts +53 -53
- package/dist/sdk/runtime-primitives.js +1 -1
- package/dist/sdk/runtime-public-contracts.d.ts +46 -46
- package/dist/sdk/runtime-stats-options.d.ts +1 -1
- package/dist/sdk/runtime.d.ts +374 -374
- package/dist/sdk/scheduling-shortcuts.d.ts +19 -19
- package/dist/sdk/schema-migration.d.ts +79 -79
- package/dist/sdk/schema.d.ts +224 -224
- package/dist/sdk/search-refresh-worker.d.ts +1 -1
- package/dist/sdk/similarity-scoring.d.ts +10 -10
- package/dist/sdk/similarity.d.ts +73 -73
- package/dist/sdk/start-task-status.d.ts +1 -1
- package/dist/sdk/stats.d.ts +72 -72
- package/dist/sdk/structured-mutations.d.ts +13 -13
- package/dist/sdk/telemetry-flush.d.ts +1 -1
- package/dist/sdk/telemetry.d.ts +32 -32
- package/dist/sdk/templates.d.ts +35 -35
- package/dist/sdk/test/batch.d.ts +50 -50
- package/dist/sdk/test/command-args.d.ts +2 -2
- package/dist/sdk/test/entry.d.ts +4 -4
- package/dist/sdk/test/execution-receipts.d.ts +5 -5
- package/dist/sdk/test/execution.d.ts +247 -247
- package/dist/sdk/test/json-path.d.ts +4 -4
- package/dist/sdk/test/linked-command-detection.d.ts +36 -36
- package/dist/sdk/test/measurements.d.ts +10 -10
- package/dist/sdk/test/parsers.d.ts +18 -18
- package/dist/sdk/test/prerequisites.d.ts +3 -3
- package/dist/sdk/test/runs.d.ts +43 -43
- package/dist/sdk/test/trust.d.ts +15 -15
- package/dist/sdk/test/update.d.ts +23 -23
- package/dist/sdk/test/workspace-snapshot.d.ts +1 -1
- package/dist/sdk/testing.d.ts +248 -248
- package/dist/sdk/traceability/runtime-files-lookup.d.ts +1 -1
- package/dist/sdk/traceability/source-traceability.d.ts +50 -50
- package/dist/sdk/workspace-contracts-cache.d.ts +2 -2
- package/dist/sdk/workspace-contracts.d.ts +20 -20
- package/dist/sdk/workspace-memory.d.ts +42 -42
- package/dist/sdk/workspace-recipe.d.ts +9 -9
- package/dist/sdk/workspace-snapshot.d.ts +60 -60
- package/dist/sdk/workspace-transaction-gc.d.ts +17 -17
- package/dist/sdk/workspace-transaction.d.ts +26 -26
- package/dist/sdk/workspace.d.ts +9 -9
- package/dist/types.d.ts +540 -540
- package/docs/COMMANDS.md +11 -2
- package/docs/EXTENSION_AUTHOR_CONTRACTS.md +18 -4
- package/docs/LINKED_TEST_EDITS.md +15 -0
- package/docs/RELEASING.md +2 -0
- package/docs/TESTING.md +21 -1
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +4 -3
- package/marketplace.json +1 -1
- package/package.json +3 -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-digital-twin/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/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/package.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +1 -1
- package/plugins/pm-codex/plugin.json +1 -1
- package/runtime-dependencies.json +1 -1
- package/scripts/finalize-build.mjs +9 -3
- package/dist/cli-bundle/chunks/chunk-66BZVFIK.js +0 -6
- package/dist/cli-bundle/chunks/chunk-IDEHMKYZ.js +0 -235
- package/dist/cli-bundle/chunks/chunk-UNQZGMJL.js +0 -20
- package/dist/cli-bundle/chunks/chunk-YXRAYL7H.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-JDVZF75H.js +0 -165
- package/dist/cli-bundle/focused-chunks/chunk-WIXZF5SS.js +0 -26
package/dist/cli-bundle/main.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import{A as
|
|
2
|
-
`)}function
|
|
3
|
-
`)}function wi(e,t){return t==="detailed"?ys(e):hs(e)}function D(e){return e.trim().toLowerCase().split(/\s+/).filter(t=>t.length>0).join(" ")}var _s={cal:"calendar",ctx:"context"};function ws(e,t){return e.commands.find(n=>n.name()===t)??null}function vs(e,t){let n=e;for(let o of t){let a=ws(n,o);if(!a)return null;n=a}return n}function vn(e,t,n,o){let a=vs(e,t.split(" ").filter(i=>i.length>0));a&&a.addHelpText("after",wi(n,o))}function bn(e){return e.includes("--explain")?"detailed":"compact"}function oe(e){return e.includes("--all")||e.includes("--explain")}var ge={"item reopen":{why:"Reopens recurring work while archiving earlier closure evidence and declaring its current planning outcome.",examples:['pm item reopen pm-a1b2 "The failure recurred" --expected-result "The recurrence regression passes"'],tips:["Without --expected-result, follow recovery.suggested_retry_args to restore current planning before claiming the item."]},ops:{why:"Groups workspace diagnostics, quality checks, and maintenance under one discoverable command.",examples:["pm ops health --summary","pm ops validate --check-history-drift","pm ops --help"]},init:{why:"Bootstraps tracker storage and settings so all other commands can run safely.",examples:["pm init","pm init acme","pm init ./pm-sandbox --defaults","pm init --preset minimal","pm init --agent-guidance add","pm init --defaults --with-packages"],tips:["Run this once per repository before create/list/update commands.","A path-like positional (`./dir`, `/tmp/dir`) initializes that tracker path; a plain word remains an id prefix.","Rewriting id prefix, governance preset, or default author on an existing tracker requires --force.","Use --preset for non-interactive automation; omit it in a TTY to use the setup wizard.","Use --agent-guidance add to inject compact AGENTS/CLAUDE workflow guidance, or --agent-guidance status to inspect missing guidance without modifying files.","Use --with-packages when agents need bundled commands such as calendar and templates available immediately."]},config:{why:"Reads or updates project/global settings such as definition-of-done, item format, telemetry, and policy toggles.",examples:["pm config project get definition-of-done",'pm config project set definition-of-done --criterion "tests pass"',"pm config project set item-format --format toon","pm config project set sprint-release-format-policy --policy strict_error","pm config project set governance-preset --policy minimal","pm config project set governance-ownership-enforcement --policy none","pm config project set test-result-tracking --policy enabled","pm config global set telemetry-tracking --policy disabled"]},extension:{why:"Compatibility command for package-backed runtime extension lifecycle operations across project or global scope.",examples:["pm install ./my-package --project","pm install '*' --project","pm package doctor --project --detail summary","pm package manage --global","pm package activate sample-ext --project","pm package deactivate sample-ext --project","pm package uninstall sample-ext --global","pm extension explore --project","pm extension manage --global","pm extension describe sample-ext --project","pm extension doctor --detail deep"],tips:["Prefer pm install and pm package in new user-facing automation.","Use pm extension when maintaining existing extension-specific scripts or debugging the compatibility runtime directly.","Bundled aliases beads and todos resolve to package-shipped extension sources.","Use --gh/--github shorthand for GitHub sources and --ref to pin a branch, tag, or ref.","Install updates settings activation state automatically unless extension allowlist mode is unchanged.","Use --adopt for single-extension adoption and --adopt-all to bulk-register unmanaged installs as managed without reinstalling.","Use --manage for concise triage summaries and remediation-oriented diagnostics alongside full extension details.","Use --describe to map exactly what each loaded extension registers (commands, hooks, item types, providers, overrides) in one call.","Use --doctor for consolidated diagnostics with warning codes, remediation hints, and optional deep detail payloads."]},package:{why:"Installs, explores, manages, diagnoses, adopts, activates, deactivates, and refreshes package-backed pm runtime extensions.",examples:["pm install npm:@scope/pm-package --project","pm package install ./my-package --project","pm package doctor --project --detail deep","pm package manage --project --runtime-probe","pm package describe --project","pm package activate sample-ext --project","pm upgrade --packages-only --dry-run"],tips:["Prefer package vocabulary for user-facing workflows; extension vocabulary remains available for compatibility.","Use pm package describe [name] to map every surface a package registers without reading its manifest or running diagnostics.","Use pm upgrade to refresh the CLI/SDK and managed packages from their recorded sources.","Use --dry-run before upgrade when automation needs a deterministic plan."]},"package init":{why:"Generates an installable starter pm package with package metadata and a root extension entrypoint.",examples:["pm package init ./my-package","pm package init ./my-hook-package --capability hooks","pm package init ./my-search-package --capability search","pm package init ./my-sync-package --capability importers","pm package init ./my-domain-package --capability schema","pm package init ./my-output-package --capability renderers","pm install ./my-sync-package --project","pm package doctor --project --detail summary"],tips:["Use --capability hooks for a starter after_command lifecycle reactor with runnable SDK testing coverage.","Use --capability search for a starter search provider/vector-store adapter with runnable SDK testing coverage.","Use --capability importers for paired import/export commands that move project context across systems.","Use --capability schema for a starter custom item type, field, and migration so pm models your project domain.","Use --capability renderers/parser/preflight/services for starter override surfaces (output renderer, parsed-option rewrite, pre-run gate decision, built-in service) \u2014 one runnable starter per SDK capability.","The generated package is local-install safe; add SDK runtime imports only after declaring dependencies and validating with package doctor.","Use package doctor after changes to verify activation, policy, and collision diagnostics."]},"package install":{why:"Installs pm packages from local paths, npm sources, GitHub sources, bundled aliases, or wildcard/all aliases.",examples:["pm package install ./my-package --project","pm install npm:pm-changelog --project","pm package install --github org/repo/packages/my-pm-package --ref main"],tips:["Prefer the top-level pm install alias in scripts when only installation is needed.","Run pm package manage or pm package doctor after installing external packages."]},"package doctor":{why:"Diagnoses package activation, policy, collision, and managed-state health for project or global package scopes.",examples:["pm package doctor --project --detail summary","pm package doctor --project --detail deep --trace","pm package doctor --project --isolated --detail deep --trace"],tips:["Use --isolated (alias --ignore-global) for hermetic project smoke tests that must ignore globally installed package registrations.","Set PM_GLOBAL_PATH for a whole subprocess suite when every pm invocation must avoid machine-local global package state: PM_GLOBAL_PATH=$(mktemp -d) pm package doctor --project --detail deep --trace.","Non-isolated project diagnostics include global registrations and emit remediation when global package state can affect the result."]},"package catalog":{why:"Lists bundled first-party package catalog metadata and compact field projections.",examples:["pm package catalog --project","pm package catalog --project --fields alias,installed,install_command","pm package list --project --fields alias,package_name,category"],tips:["Use --fields for low-token package discovery in agent loops.","External npm package discovery still belongs to npm search."]},"extension init":{why:"Generates an installable starter runtime extension with manifest and entrypoint files.",examples:["pm extension init ./my-extension","pm extension init ./my-hook-extension --capability hooks","pm extension init ./my-search-extension --capability search","pm extension init ./my-sync-extension --capability importers","pm extension init ./my-domain-extension --capability schema","pm extension init ./my-output-extension --capability renderers","pm extension --install --project ./my-sync-extension","pm extension --doctor --project --detail summary"],tips:["Use --capability hooks when the extension should react to command lifecycle events.","Use --capability search when the extension should register retrieval primitives.","Use --capability importers when the extension should register project-context import/export commands.","Use --capability schema when the extension should register custom item types, fields, and migrations.","Use --capability renderers/parser/preflight/services to override pm's output rendering, parsed options, pre-run gate, or a built-in service.","Use package init for new distributable package workflows; extension init is the compatibility-level runtime scaffold."]},"extension install":{why:"Installs a compatibility runtime extension from local, npm, GitHub, bundled alias, or wildcard sources.",examples:["pm extension install ./my-extension --project","pm extension --install --project ./my-extension","pm extension doctor --project --detail summary"],tips:["Prefer pm install or pm package install for new package-first automation."]},"extension doctor":{why:"Diagnoses compatibility extension activation, policy, collision, and managed-state health for project or global extension scopes.",examples:["pm extension doctor --project --detail summary","pm extension doctor --project --detail deep --trace","pm extension doctor --project --isolated --detail deep --trace"],tips:["Use --isolated (alias --ignore-global) for hermetic project smoke tests that must ignore globally installed extension registrations.","Set PM_GLOBAL_PATH for a whole subprocess suite when every pm invocation must avoid machine-local global extension state: PM_GLOBAL_PATH=$(mktemp -d) pm extension doctor --project --detail deep --trace.","Prefer pm package doctor in new package-first workflows."]},"extension catalog":{why:"Compatibility view of bundled package catalog metadata.",examples:["pm extension catalog --project","pm extension catalog --project --fields alias,installed,install_command"],tips:["Prefer pm package catalog in new user-facing workflows."]},install:{why:"Installs a pm package into project scope by default, using local, npm, GitHub, or bundled alias sources.",examples:["pm install '*' --project","pm install ./packages/pm-todos --project","pm install npm:@scope/pm-package --global","pm install --github org/repo/packages/my-pm-package --ref main"],tips:["Installed packages are recorded in managed state and can be inspected with pm package manage."]},upgrade:{why:"Updates the global pm CLI/SDK and refreshes managed pm packages from recorded install sources.",examples:["pm upgrade --dry-run","pm upgrade --packages-only --project","pm upgrade todos --dry-run","pm upgrade --cli-only --repair","pm upgrade --tag next --dry-run"],tips:["Omit target to include the CLI/SDK plus all managed packages in the selected scope.","Pass a target to refresh one managed package by name, directory, package name, or source.","Use --packages-only in repository automation when the global CLI should not be changed."]},create:{why:"Creates a new planning item with deterministic metadata and history.",examples:['pm create --title "Harden lock flow" --description "Improve stale lock handling" --type Task --status open --priority 1 --message "Create lock hardening task" --create-mode progressive','pm create --title "Weekly planning sync" --description "Recurring coordination meeting" --type Meeting --schedule-preset lightweight','pm create --title "Asset: Hero model" --description "Track playable model asset" --type Asset --status open --priority 1 --message "Create asset item" --type-option category=Character --dep "id=pm-epic01,kind=parent,created_at=now" --comment "created_at=now,text=Why this asset item exists." --note "created_at=now,text=Initial implementation note." --learning "created_at=now,text=Durable lesson placeholder." --file "path=src/assets/hero.glb,note=tracked asset" --test "command=node scripts/run-tests.mjs test,timeout_seconds=240" --doc "path=README.md,note=asset docs"'],tips:["Use --schedule-preset lightweight for Reminder/Meeting/Event when you want minimal required create inputs.","Use --type <value> to load type-aware policy guidance in --help output."]},focus:{why:"Sets a session focused item so new pm create items default their --parent to it (project management = context management).",examples:["pm focus pm-epic1","pm focus","pm focus --clear"],tips:["Focus is session-local (stored in .agents/pm/runtime/session.json, gitignored) \u2014 it never affects teammates.",'An explicit --parent on pm create always overrides the focused item; use --parent "" to create with no parent.',"A stale focused item produces the same missing-parent validation as an explicit stale --parent."]},update:{why:"Mutates existing item fields while preserving history and lock safety.",examples:['pm update pm-a1b2 --status in_progress --message "Start implementation"','pm update pm-a1b2 --unset close-reason --message "Clear stale close reason after reopen"','pm update pm-a1b2 --unset assignee --deadline +2d --message "Replan ownership and deadline"','pm update pm-a1b2 --body "Backfilled body text for legacy item" --message "Normalize missing body"'],tips:['Use "pm close <ID> <TEXT>" to close items instead of --status closed.',"When reopening from closed to a non-terminal status, update clears stale close_reason unless explicitly set via --close-reason.",'Use "pm append <ID> --body <text>" for additive notes; use update --body to replace body content.']},"update-many":{why:"Bulk-updates matched item sets with dry-run previews and rollback checkpoints for safe large-scale metadata changes.",examples:["pm update-many --filter-status open --status in_progress --dry-run",'pm update-many --filter-tag wave:7 --replace-tests --test "command=node scripts/run-tests.mjs test -- tests/core/history.spec.ts,timeout_seconds=240"','pm update-many --filter-tag governance --reviewer maintainer-review --message "Normalize reviewer metadata"',"pm update-many --rollback ckpt-abc123"],tips:["Use --dry-run first to inspect proposed changes before apply mode.","Linked-array mutation flags mirror pm update semantics (for example --replace-tests, --clear-files, and repeatable --doc/--note seeds).","Checkpoints are enabled by default for apply mode and can be restored with --rollback."]},"close-many":{why:"Bulk-closes matched items with a shared reason routed through full pm close semantics (close validation, active-child orphan checks, blocked-edge cleanup) plus dry-run previews and rollback checkpoints \u2014 unlike update-many --status closed, which bypasses close validation.",examples:['pm close-many --filter-sprint S-12 --reason "Sprint S-12 acceptance criteria met" --dry-run','pm close-many --filter-tag wave:7 --reason "Superseded by redesign" --validate-close warn','pm close-many --ids pm-a,pm-b,pm-c --reason "Closed in batch" --resolution "Verified by integration suite"',"pm close-many --rollback close-many-20260604-abc123"],tips:["At least one filter (--filter-* or --ids) is required so close-many never matches every item.","Already-terminal matches are skipped by default; pass --force to re-close them.","Use --dry-run to preview matches plus per-item skip reasons and active-child orphan warnings before applying.","Checkpoints are enabled by default for apply mode; restore with --rollback <checkpoint-id>."]},templates:{why:"Saves, lists, and inspects reusable create option bundles for repeatable workflows.",examples:['pm templates save triage-default --title "Triage item" --description "..." --type Task --status open --priority 2 --message "Seed triage template"',"pm templates list","pm templates show triage-default"],tips:["Template names are positional arguments (`pm templates save <name>` and `pm templates show <name>`), not --name flags.","Combine templates with explicit create flags; explicit flags always override template defaults."]},deps:{why:"Inspects an item dependency graph as a tree or graph payload to understand blockers and hierarchy links.",examples:["pm deps pm-a1b2","pm deps pm-a1b2 --format graph","pm deps pm-a1b2 --max-depth 2 --collapse repeated --summary"],tips:["Use --summary for lightweight counts when full graph payloads are unnecessary."]},list:{why:"Lists active items with deterministic filtering and ordering.",examples:["pm list --limit 20","pm list --type Task --priority 0 --tag release --status in_progress","pm list --compact --sort deadline --order asc","pm list --fields id,title,parent,type --sort parent --order asc"]},"list-all":{why:"Lists all item states (including terminal states) when you need full visibility.",examples:["pm list-all --limit 50","pm list-all --type Issue --include-body"]},"list-open":{why:"Shows work that is ready to claim and start.",examples:["pm list-open --priority 0 --limit 10"]},"list-in-progress":{why:"Tracks active execution and owner progress.",examples:["pm list-in-progress --priority 0 --limit 20"]},"list-blocked":{why:"Surfaces blocked work that needs intervention.",examples:["pm list-blocked --limit 20"]},"list-closed":{why:"Reviews completed work and closure outcomes.",examples:["pm list-closed --limit 20 --type Task"]},"list-canceled":{why:"Audits intentionally discontinued work.",examples:["pm list-canceled --limit 20"]},"list-draft":{why:"Finds incompletely defined items that need refinement before execution.",examples:["pm list-draft --limit 20"]},aggregate:{why:"Runs grouped aggregation queries for governance checks such as decomposition by parent/type or triage by status/priority.",examples:["pm aggregate --group-by parent,type --count","pm aggregate --group-by type,status --count","pm aggregate --group-by parent,type --count --status open --parent pm-feature01"],tips:["Current aggregate mode is grouped counts only, so pass --count explicitly."]},guide:{why:"Routes local progressive-disclosure documentation so agents can fetch only the context they need.",examples:["pm install guide-shell --project","pm guide","pm guide quickstart","pm guide commands --depth standard","pm guide skills --depth deep --format markdown","pm guide release --json"],tips:["Use brief depth for minimal token footprint, standard for excerpted docs, and deep for full local document rendering.","Use --list to force topic index output even when topic parsing is ambiguous."]},calendar:{why:"Provides deadline/reminder/event scheduling views for planning and coordination.",examples:["pm calendar","pm calendar --view agenda --from +0d --to +7d --tag release","pm calendar --view week --date 2026-04-06 --full-period --include deadlines,events","pm calendar --view month --tag release --format json"],tips:["Day/week/month views are anchored period windows; default mode clips the start to now unless --past or --full-period is set.","--full-period applies only to day/week/month views; use --from/--to to bound agenda windows."]},context:{why:"Builds an agent-optimized snapshot of critical active work plus near-term agenda context with progressive depth levels.",examples:["pm context","pm ctx --depth standard --limit 10","pm ctx --depth deep --tag release","pm ctx --section hierarchy --section progress --section blockers","pm context --depth standard --activity-limit 20 --stale-threshold 14d","pm context --from +0d --to +7d --format markdown --depth deep"],tips:["High-level focus contains Epics/Features and low-level focus contains Tasks/Issues/Chores/Decisions/Event/Reminder/Milestone/Meeting/Plan.","When no open or in-progress work exists, blocked items are shown as fallback context.","--depth brief (default) shows focus+agenda; standard adds hierarchy/activity/progress/workload; deep adds blockers/files/staleness/tests.","--section overrides --depth and selects specific sections: hierarchy, activity, progress, blockers, files, workload, staleness, tests.","Configure defaults via pm config project set context --default-depth standard --activity-limit 15."]},next:{why:"Answers 'what should I work on now?' with the highest-priority ready item, rationale, and ranked ready and blocked queues.",examples:["pm next","pm next --json","pm next --limit 3 --ready-only","pm next --parent pm-mpbb","pm next --tag release --format markdown"],tips:["Ready = active status, no open blockers, and no open children (a concrete leaf); the recommendation resumes in-progress work before starting new work.","An item is blocked when its scalar blocked_by or a blocked_by dependency points at a non-terminal item; the blocked list names the blockers to clear.","Containers (Epics/Features with open children) are never recommended directly \u2014 the actionable leaf beneath them is.","Use --parent to scope to one epic's subtree, or --ready-only to drop the blocked companion list for the tightest output."]},search:{why:"Finds relevant items by keyword, semantic, or hybrid retrieval modes.",examples:['pm search "lock stale retry" --mode keyword --limit 10','pm search "extension migration blockers" --mode hybrid --type Task --priority 0','pm search "Cross-Epic Realism Dependency Council" --mode keyword --title-exact'],tips:["Use --title-exact to require exact normalized title parity, or --phrase-exact to require full-phrase matches in item text fields.","Use --include-linked when linked docs/files/tests should influence scoring."]},eval:{why:"Measures search relevance against a curated golden-query set so retrieval regressions are caught, not guessed.",examples:["pm eval --json","pm eval --mode hybrid --k 10","pm eval --fail-under 0.6 --json","pm eval --queries ./my-eval.json --mode semantic"],tips:["Curate ground truth in <pmRoot>/search/eval-queries.json as an array of {query, relevant_ids, mode?} objects.","Wire --fail-under into CI to fail the build when aggregate nDCG@k drops below your baseline."]},reindex:{why:"Rebuilds search artifacts after large changes to item corpus or provider/vector config.",examples:["pm reindex --mode keyword","pm reindex --mode hybrid --progress --json"],tips:["Use --progress for non-interactive visibility during local embedding runs.","JSON output includes semantic stale/unchanged/embed/upsert counts so agents can gate long reindex work without parsing stderr."]},get:{why:"Shows details for one item by ID, with optional lower-token projections for agent loops.",examples:["pm get pm-a1b2","pm get pm-a1b2 --depth brief --json","pm get pm-a1b2 --fields id,title,status,parent,type --json","pm get pm-a1b2 --at 7 --fields id,title,status,body --json"],tips:["Default depth is standard for body plus linked artifacts without append-only logs; use brief for metadata-only checks or --full for complete history-heavy metadata.","Use --fields for the smallest deterministic item metadata payload when an agent only needs specific fields.","Schedule metadata is normalized under schedule; request schedule.start_at or schedule.location for narrow calendar reads.","Children are type-agnostic and include bounded deterministic samples plus continuation metadata when a parent has direct children.","Use --at <version|timestamp> for a verified read-only historical projection; reconstructed/as_of fields distinguish it from current state.","JSON output shape is { item, linked, claim_state, schedule, children }; body is nested at item.body (parity with list --include-body)."]},history:{why:"Inspects item mutation timeline and audit trail.",examples:["pm history pm-a1b2 --limit 20","pm history pm-a1b2 --full --verify"]},"history-compact":{why:"Compacts long history streams into a synthetic checkpoint while preserving replay integrity. Pass an item id for one stream, or a bulk selector (--ids/--all-over/--closed/--all-streams) to sweep many.",examples:["pm history-compact pm-a1b2 --dry-run",'pm history-compact pm-a1b2 --before 25 --message "Compact early history"',"pm history-compact --all-over 500 --dry-run","pm history-compact --closed","pm history-compact --ids pm-a1b2,pm-c3d4 --dry-run"]},activity:{why:"Reviews recent tracker-wide activity across items.",examples:["pm activity --limit 50","pm activity --full --id pm-a1b2 --limit 50","pm activity --id pm-a1b2 --op update --from -7d --to now","pm activity --json --stream rows --limit 200"],tips:["Use --stream with --json for line-delimited automation output; --from is inclusive and --to is exclusive."]},restore:{why:"Restores an item to a prior timestamp/version with history replay safety.",examples:['pm restore pm-a1b2 2026-04-01T00:00:00.000Z --message "Rollback to known-good state"']},close:{why:"Transitions work to terminal closed state with explicit rationale.",examples:['pm close pm-a1b2 "Done" --release-assignment --validate-close warn','pm close pm-a1b2 "Done" --validate-close','pm close pm-a1b2 "Done" --validate-close off','pm close pm-a1b2 "Done" --validate-close strict']},delete:{why:"Removes an item while preserving history evidence and lock/ownership checks.",examples:['pm delete pm-a1b2 --message "Remove duplicate item"']},append:{why:"Adds implementation notes to body without replacing existing content.",examples:['pm append pm-a1b2 --body "Implemented retry with bounded backoff." --message "Record implementation detail"']},comments:{why:"Adds or reviews lightweight status updates linked to an item.",examples:['pm comments pm-a1b2 "Verified fix on Linux and macOS"','pm comments pm-a1b2 --add "Verified fix on Linux and macOS"','printf "%s\\n" "## Verification" "- linux pass" "- mac pass" | pm comments pm-a1b2 --stdin',"pm comments pm-a1b2 --file docs/release-evidence.md",'pm comments pm-a1b2 --add "text: verification note with commas, key-like words, and parser details"','pm comments pm-a1b2 --add "Follow-up needed after review" --force',"pm comments pm-a1b2 --limit 10"],tips:["Use exactly one comment source at a time: positional [text], --add, --stdin, or --file.","Use --force when adding comments to items currently assigned to a different owner.","When --add payload resembles CSV-like key fragments (for example text=hello,scope:project), plain-text fallback is intentional; use explicit text=..., markdown text: ..., or stdin token - for structured intent."]},notes:{why:"Adds or reviews durable implementation notes linked to an item.",examples:['pm notes pm-a1b2 --add "Investigated parser edge case and documented fallback logic."','pm notes pm-a1b2 --add "text: parser rationale with commas, colons, and key-like wording"','pm notes pm-a1b2 --edit 1 --add "Corrected durable note"',"pm notes pm-a1b2 --delete 2","pm notes pm-a1b2 --limit 10"],tips:["CSV-like add payloads with extra key fragments are treated as plain text by design; use explicit text keys (text= or text:) when structured parsing is required."]},learnings:{why:"Adds or reviews post-implementation learnings for future work.",examples:['pm learnings pm-a1b2 --add "Avoid direct test-runner commands in linked tests; use sandbox runner."','pm learnings pm-a1b2 --add "text: lesson with commas, key-like words, and punctuation-safe context"',"pm learnings pm-a1b2 --edit 1 --file docs/corrected-learning.md","pm learnings pm-a1b2 --delete 2","pm learnings pm-a1b2 --limit 10"],tips:["If you intended structured parsing for a key-like payload, prefer explicit text=..., markdown text: ..., or stdin token -; ambiguous CSV-like forms intentionally remain plain text."]},files:{why:"Associates changed source files with tracker items for reproducibility.",examples:['pm files pm-a1b2 --add "path=src/cli/main.ts,note=help orchestration"','pm files pm-a1b2 --add src/cli/main.ts --note "help orchestration"',"pm files discover pm-a1b2",'pm files discover pm-a1b2 --apply --note "discovered from item text"']},docs:{why:"Associates relevant documentation paths with tracker items.",examples:['pm docs pm-a1b2 --add "path=README.md,note=user-facing command guidance"','pm docs pm-a1b2 --add README.md --note "user-facing command guidance"']},test:{why:"Links test commands/paths and optionally executes them for one item.",examples:['pm test pm-a1b2 --add "command=node scripts/run-tests.mjs test -- tests/unit/output.spec.ts,timeout_seconds=2400"','pm test pm-a1b2 --add "command=pm list-all --type Task --limit 200,assert_stdout_contains=count:,assert_stdout_regex=count:\\s+\\d+"','pm test pm-a1b2 --add "command=pm list-all --type Task --limit 200,pm_context_mode=auto"',"pm test pm-a1b2 --run --timeout 2400 --env-set PORT=0 --env-clear PLAYWRIGHT_BASE_URL --shared-host-safe --pm-context tracker --fail-on-context-mismatch --fail-on-skipped","pm test pm-a1b2 --run --timeout 2400 --pm-context auto","pm test pm-a1b2 --run --background --timeout 2400 --progress"]},"test-all":{why:"Runs linked tests in bulk for release/readiness sweeps.",examples:["pm test-all --status in_progress --limit 5 --offset 10 --timeout 2400","pm test-all --status closed --timeout 3600 --progress --env-set PORT=0 --shared-host-safe --fail-on-skipped","pm test-all --status in_progress --pm-context tracker --fail-on-context-mismatch --require-assertions-for-pm","pm test-all --status in_progress --pm-context auto --fail-on-context-mismatch","pm test-all --status in_progress --background --timeout 3600"]},"test-runs":{why:"Manages background linked-test runs with lifecycle controls and log/status inspection.",examples:["pm test-runs list --status running --limit 20","pm test-runs status tr-abc123","pm test-runs logs tr-abc123 --stream stderr --tail 200","pm test-runs stop tr-abc123","pm test-runs resume tr-abc123"]},stats:{why:"Reports tracker-level totals and distribution by type/status.",examples:["pm stats","pm stats --json"]},telemetry:{why:"Inspects and manages local telemetry queue/runtime state for observability diagnostics.",examples:["pm telemetry status","pm telemetry stats --limit 10","pm telemetry flush","pm telemetry clear"]},health:{why:"Validates tracker/runtime health including extension triage, migration, and integrity diagnostics.",examples:["pm health","pm health --check-only --summary --json","pm health --brief --json","pm health --no-refresh","pm health --refresh-vectors"]},validate:{why:"Runs standalone metadata, resolution, lifecycle (including dependency-cycle diagnostics), linked-file, linked-command reference, and history drift checks with default remediation hints for resolution gaps.",examples:["pm validate","pm validate --check-resolution --json","pm validate --check-lifecycle --dependency-cycle-severity error","pm validate --check-lifecycle --parent-cycle-severity error","pm validate --check-files --scan-mode tracked-all","pm validate --check-files --scan-mode tracked-all-strict --include-pm-internals","pm validate --check-command-references","pm validate --check-resolution --fail-on-warn --json"],tips:["Resolution-gap warnings include default `pm update <id> ...` remediation hint templates in check details."]},gc:{why:"Deletes optional cache artifacts by default to keep local tracker state tidy; use --dry-run to preview targets without deleting files.",examples:["pm gc --dry-run","pm gc"]},claim:{why:"Claims an item to signal active ownership and reduce conflicts.",examples:["pm claim pm-a1b2 --start",'pm claim pm-a1b2 --force --message "Take over terminal item"','pm claim pm-a1b2 --author "release-service" --message "Explicit non-agent identity override"'],tips:["Claim takeover for non-terminal items does not require --force; --force is reserved for terminal/lock overrides.","Harness identity is automatic; use --author only to assert an intentional external principal."]},release:{why:"Releases an active claim when paused, handed off, or completed.",examples:["pm release pm-a1b2 --pause"]},"start-task":{why:"Lifecycle alias that claims an item and sets status to in_progress.",examples:['pm start-task pm-a1b2 --message "Start implementation"']},"pause-task":{why:"Lifecycle alias that sets status to open and releases active assignment.",examples:['pm pause-task pm-a1b2 --message "Pause for dependency unblock"']},"close-task":{why:"Lifecycle alias that closes with reason text and clears assignment metadata.",examples:['pm close-task pm-a1b2 "All acceptance criteria met" --message "Close and handoff"']},meet:{why:"Shortcut to create a Meeting from friendly time flags (start/duration) without structured --event CSV.",examples:['pm meet "Sprint Planning" --start +1h --duration 1h','pm meet "1:1" --start 2026-07-01T15:00:00Z --end 2026-07-01T15:30:00Z --location "Room A"'],tips:["Start defaults to now and duration to 1h; pass --end to set an explicit end instead of --duration.","--duration accepts relative tokens (h/d/w/m where m is months) plus sub-hour forms like 30min or PT30M."]},event:{why:"Shortcut to create an Event from friendly time flags (start/duration) without structured --event CSV.",examples:['pm event "Release v2" --start 2026-07-01T10:00:00Z --duration 2h','pm event "Conference" --start 2026-08-01 --all-day'],tips:["Start defaults to now and duration to 1h; pass --end to set an explicit end instead of --duration.","--duration accepts relative tokens (h/d/w/m where m is months) plus sub-hour forms like 30min or PT30M."]},remind:{why:"Shortcut to create a Reminder from a single point in time without structured --reminder CSV.",examples:['pm remind "Review PR" --at +2d','pm remind "Follow up" --at 2026-07-01T09:00:00Z --text "Ping the team"'],tips:["The reminder time defaults to +1d and the reminder text defaults to the title."]},completion:{why:"Generates shell completion scripts for faster and more reliable command entry.",examples:["pm completion bash","pm completion zsh","pm completion fish","pm completion bash --eager-tags"],tips:["Default scripts resolve tag suggestions lazily at completion time; use --eager-tags to embed current tags directly."]},contracts:{why:"Exposes machine-readable CLI command and tool schema contracts for agent integrations.",examples:["pm contracts","pm contracts --command list --runtime-only","pm contracts --command update --flags-only","pm contracts --availability-only --runtime-only","pm contracts --action create","pm contracts --schema-only"],tips:["Use --command to narrow actions/schema to one CLI surface; combine with --flags-only or --availability-only for lighter payloads."]}};for(let{alias:e,canonical:t}of R){let n=ge[e];n&&(ge[t]={...n,examples:n.examples.map(o=>o.replace(`pm ${e}`,`pm ${t}`))})}var Ee={why:"Provides deterministic project management workflows for humans and coding agents.",examples:["pm init","pm install guide-shell --project","pm list-open --limit 10",'pm create --title "..." --description "..." --type Task --status open --priority 1 --message "..." --create-mode progressive'],tips:["Use <command> --help for command-specific guidance and examples.","Install guide-shell before using pm guide for local docs and skills routing.","Use --json for machine parsing and integration flows.","Use --no-pager to force direct help output in CI and other non-interactive shells."]},vi=W.filter(e=>e.lifecycle==="deprecated");for(let e of vi){let t=ge[e.alias];ge[e.alias]={...t,why:`Deprecated: use pm ${e.canonical_argv.join(" ")}. ${t.why}`}}for(let e of[Ee,...Object.values(ge)])e.examples=e.examples.map(t=>{for(let n of vi){let o=n.alias.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=t.replaceAll(new RegExp(`\\bpm ${o}(?![\\w-])`,"g"),`pm ${n.canonical_argv.join(" ")}`)}return t});function bs(e){let t=D(e??"");return t?_s[t]??t:""}function Cn(e){let t=bs(e);return t?ge[t]??Ee:Ee}function bi(e,t){let n=Cn(e);return{intent:n.why,examples:t==="detailed"?[...n.examples]:_i(n.examples),tips:t==="detailed"?[...n.tips??[]]:[],detail_mode:t}}function Cs(){let e=W.filter(({lifecycle:n})=>n==="permanent"),t=W.filter(({lifecycle:n})=>n==="deprecated");return["","Command aliases:",...e.map(({alias:n,canonical_argv:o})=>` ${n} -> pm ${o.join(" ")}`),"","Deprecated aliases:",...t.map(n=>` ${n.alias} -> pm ${n.canonical_argv.join(" ")} (${Vo(n)})`)].join(`
|
|
4
|
-
`)}function
|
|
5
|
-
`,s=t.visibleCommands(e);for(let l of s)
|
|
6
|
-
`)}function Oi(e,t){return t.transactionOperation!==void 0&&(e.transaction_operation=t.transactionOperation),t.tombstone!==void 0&&(e.tombstone=t.tombstone,e.item_id=t.itemId),Ss(t)&&(e.why=t.why),t.examples&&t.examples.length>0&&(e.examples=t.examples),t.nextSteps&&t.nextSteps.length>0&&(e.next_steps=t.nextSteps),t.verificationErrors&&t.verificationErrors.length>0&&(e.verification_errors=t.verificationErrors),t.flag!==void 0&&(e.flag=t.flag),t.value!==void 0&&(e.value=t.value),t.unmatchedSelectors!==void 0&&(e.unmatched_selectors=t.unmatchedSelectors),t.availableDependencies!==void 0&&(e.available_dependencies=t.availableDependencies),t.recovery&&(e.recovery=t.recovery),e}function Ps(e,t){if(e.flag)return e.flag;let n=o=>{let a=o.split("=",1)[0];return N([a]).length>0&&!["--help","--no-changed-fields","--version"].includes(a)&&t.some(i=>i===a||i.startsWith(`${a}=`))};return[...`${e.title} ${e.happened}`.matchAll(/--[A-Za-z0-9][A-Za-z0-9_-]*/gu)].map(o=>o[0]).find(o=>n(o))}function $s(e,t,n){if(e.value!==void 0)return e.value;if(e.flag===void 0&&n){let o=t.find(i=>i===n||i.startsWith(`${n}=`));if(o?.startsWith(`${n}=`))return o.slice(n.length+1);let a=t.indexOf(n);return t[a+1]}}function Ns(e,t){if(e.policyViolations?.length)return{surface:`policy:${e.policyViolations.map(s=>s.policy_id).join(",")}`,policies:e.policyViolations,policy_violation_count:e.policyViolationCount,missing_fields:[...new Set(e.policyViolations.flatMap(s=>s.missing_fields))],exit_code:t};let n=N(e.recovery?.normalized_args??[]),o=q(n),a=o?[o.alias,...n.slice(o.canonical_argv.length)]:n,i=Ps(e,a),r=$s(e,a,i);return{surface:i??e.recovery?.missing?.[0]??yn(a)??"command",...r!==void 0?{rejected_value:r}:{},...e.recovery?.allowed_values?.length?{legal_domain:e.recovery.allowed_values}:{},exit_code:t}}function Ds(e,t){return Oi({type:e.type,code:e.code,title:e.title,detail:e.happened,required:e.required,exit_code:t,refusal:Ns(e,t)},e)}function Tn(e,t){let n=e.recovery,o=!!n?.suggested_retry||!!n?.suggested_retry_args?.length||!!n?.allowed_values?.length||!!n?.candidate_commands?.length||!!e.nextSteps?.length;return fa(Ds(e,t),{diagnosticClass:o?"recovery_bundle":"error"})}function On(e){return Oi({type:e.type,code:e.code,title:e.title,detail:e.happened,required:e.required},e)}function Ot(e){return e.replace(/\(outputHelp\)/g,"").trim()}function Ms(e){let t=e.toLowerCase();return t.includes("cannot find module")||t.includes("cannot find package")||t.includes("err_module_not_found")||t.includes("module_not_found")}function ye(e){if(!Array.isArray(e))return;let t=e.map(n=>n.trim()).filter(n=>n.length>0);return t.length>0?t:void 0}function Ei(e){let t=new Set,n=[];for(let o of e)t.has(o)||(t.add(o),n.push(o));return n}function Fs(e){return yn(e?.normalized_args)}function Ls(e){let t=e.match(/\bmust be one of:?\s+([A-Za-z0-9_.|,\- ]+)/i);return t?t[1].split(/[|,]/).map(n=>n.trim()).filter(n=>/^[A-Za-z0-9_.-]+$/.test(n)):[]}function js(e,t){let n=e?.normalized_args,o=e?.provided_fields,a=t[0];if(!(!Array.isArray(n)||!Array.isArray(o)||!a))for(let i of o){let r=n.findIndex(s=>s===i);if(r>=0&&r<n.length-1&&!n[r+1]?.startsWith("-")){let s=[...n];return s[r+1]=a,x(s)}}}function Us(e){let t=e.split(/\r?\n/)[0].trim();if(t.length!==0)return t.length<=120?t:`${t.slice(0,117)}...`}function At(e,t){return typeof e=="string"&&e.trim().length>0?e.trim():t}function qs(e,t){if(e.flag!==void 0)return e.flag;if(e.field===void 0)return;let n=e.field.startsWith("--")?e.field:`--${e.field.replaceAll(/([A-Z])([A-Z][a-z])/gu,"$1-$2").replaceAll(/([a-z0-9])([A-Z])/gu,"$1-$2").replaceAll("_","-").toLowerCase()}`;return t?.normalized_args?.some(o=>o===n||o.startsWith(`${n}=`))?n:void 0}function ae(e,t,n){if(!n)return e;let o=Ot(t),a=At(n.code,e.code),i=At(n.type,Ai(a)),r=ye(n.examples)??e.examples,s=ye(n.nextSteps)??e.nextSteps,l=ye(n.verification_errors)??e.verificationErrors,c=e.code==="command_failed"&&n.code?Us(o):void 0,d=Ae(n.recovery),m=d&&e.recovery?Ae({...e.recovery,...d}):d??e.recovery;return{...e,code:a,type:i,title:c??e.title,happened:o.length>0?o:e.happened,required:At(n.required,e.required),why:At(n.why,e.why),examples:r,nextSteps:s,verificationErrors:l,policyViolations:n.policy_violations,policyViolationCount:n.policy_violation_count,flag:qs(n,m)??e.flag,value:n.value??e.value,unmatchedSelectors:n.unmatched_selectors,itemId:n.item_id,transactionOperation:n.transaction_operation,tombstone:n.tombstone,availableDependencies:n.available_dependencies,recovery:m}}function Hs(e,t,n){let o=t.match(/^Tracker is not initialized at (.+)\. (?:Run pm init first|Tracker root does not exist\. Run pm init first)\.$/);if(!o)return null;let a=o[1],i=Xo(process.cwd(),a);return ae(C(i?{code:"tracker_not_initialized",title:"Tracker exists at a custom path",happened:`pm did not find initialized metadata at ${a}, but found a tracker at ${i}.`,required:"Select the existing tracker root explicitly.",why:"Implicit discovery checks the default .agents/pm layout and ancestor root-layout trackers, while custom nested roots require an explicit path.",examples:[`pm --pm-path ${i} <command>`,`PM_PATH=${i} pm <command>`],nextSteps:[`Re-run with "--pm-path ${i}" or export PM_PATH=${i}.`]}:{code:"tracker_not_initialized",title:"Tracker is not initialized",happened:`pm data path does not contain initialized tracker metadata (${o[1]}).`,required:"Select an existing tracker with --pm-path/PM_PATH, or initialize the default .agents/pm storage.",why:"Most commands require settings in an explicitly selected root, an ancestor root-layout tracker, or the default .agents/pm directory.",examples:["pm init","pm init acme"],nextSteps:['Run "pm init", then rerun your original command.']}),e,n)}function zs(e,t,n){let o=t.match(/^Item ([^ ]+) not found$/);if(!o)return null;let a=o[1],i=/^(undefined|null|<.*>|\[.*\]|{.*}|)$/.test(a),r=i?`The item ID "${a}" looks like a placeholder or unresolved variable. Ensure the ID argument is resolved before calling pm.`:`No item with id "${a}" exists in the active tracker scope.`;return ae(C({code:"item_not_found",title:"Item ID not found",flag:"id",value:a,happened:r,required:"Use an existing item ID from current tracker data.",why:"Mutation and read commands operate only on known IDs.",examples:["pm list --status open --limit 20",'pm search "<keyword>" --limit 10'],nextSteps:i?["Check that the variable holding the item ID is defined before passing it to pm.",'Use "pm list --status open --limit 20" to find valid IDs.']:["Confirm the active --path/PM_PATH scope, then retry with a valid id."]}),e,n)}function Gs(e,t,n){return!t.includes("is assigned to")||!t.includes("Use --force to override")?null:ae(C({code:"ownership_conflict",title:"Ownership conflict",happened:t,required:"Run as the assigned owner, claim the item when appropriate, or use --force only for an approved override.",why:"Ownership checks prevent accidental concurrent mutations on claimed items and protect against conflicting writes.",examples:["pm claim pm-a1b2","pm update pm-a1b2 --status in_progress --force"],nextSteps:["Use --force for approved systematic metadata updates performed by leads or maintainers.","Use --force when correcting known stale metadata after coordinating ownership changes.",'For non-terminal reassignment, prefer "pm claim <ID>" before running other mutations.']}),e,n)}function Ws(e,t,n){return t.includes("is locked")?ae(C({code:"lock_conflict",title:"Lock conflict",happened:t,required:"Wait for lock release, or use --force where supported if lock is stale and safe to override.",why:"Locking protects item files from concurrent write races.",examples:["pm update pm-a1b2 --status in_progress --force"]}),e,n):null}function Vs(e,t,n){let o=t.match(/^Missing required option /),a=t.match(/^Missing required options /);if(!o&&!a)return null;let i=!!a,r=i?null:t.replace(/^Missing required option\s+/,"").trim(),s=r??"",l=r?`Pass ${r} with a valid value before running the command.`:"Provide the required option for this command invocation.";return ae(C({code:"missing_required_option",title:i?"Missing required options":`Missing required option ${s}`,happened:t,required:i?"Provide every required option for this command invocation.":l,why:"Required options define command intent and enforce deterministic write contracts.",examples:['pm create --title "Task title" --description "Task details" --type Task --create-mode progressive','pm create --title "Task title" --description "Task details" --type Task --status open --priority 1 --message "Create task" --dep "id=pm-epic01,kind=parent,created_at=now" --comment "created_at=now,text=Why this task exists." --note "created_at=now,text=Initial implementation note." --learning "created_at=now,text=Durable lesson placeholder." --file "path=src/example.ts,scope=project" --test "command=node scripts/run-tests.mjs test,scope=project,timeout_seconds=240" --doc "path=README.md,scope=project"'],nextSteps:['Run "pm <command> --help" to view required and recommended flags.',"For staged triage without placeholder linkage values, use --create-mode progressive."]}),e,n)}function Bs(e,t,n){return t.startsWith("No update flags provided")?ae(C({code:"no_update_fields",title:"No update fields supplied",happened:"The update command was called without any field-changing flags.",required:"Provide at least one field-changing flag such as --status, --priority, --title, --tags, --description, or --body. Use --message only to label a real mutation.",why:"pm update mutates existing item fields; no-op invocations are rejected to avoid ambiguous history.",examples:['pm update pm-a1b2 --status in_progress --message "Start implementation"','pm update pm-a1b2 --description "Clarified implementation scope" --message "Clarify task intent"','pm append pm-a1b2 --body "Detailed progress notes" --message "Append progress notes"'],nextSteps:["Choose the item field you intend to change, then pair that change with --message for history context.","Use pm comments, pm notes, pm learnings, or pm append when you only need to add narrative context."]}),e,n):null}function Ks(e,t,n){if(!t.startsWith("Invalid ")&&!t.includes(" must be ")&&!t.includes(" requires "))return null;let o=Ae(n?.recovery),a=Fs(o),i=a?`pm ${a} --help`:"pm <command> --help",r=Ls(t),s=Ae({...o,allowed_values:o?.allowed_values??r}),l=js(o,r),c=l?[l,i]:[i,"pm contracts --command <command> --flags-only --json"],d=r.length>0?[`Allowed values: ${r.join("|")}`,`Run "${i}" to confirm command-specific constraints.`]:["Check allowed values in command help, then rerun with corrected input."];return ae(C({code:"invalid_argument_value",title:"Invalid argument value",happened:t,required:"Use values that match documented command constraints.",why:"Validation protects data consistency and deterministic behavior across commands.",examples:c,nextSteps:d,recovery:s}),e,n)}function Rn(e,t){let n=Ot(e);return(Hs(e,n,t)??zs(e,n,t)??Gs(e,n,t)??Ws(e,n,t)??Vs(e,n,t)??Bs(e,n,t)??Ks(e,n,t))||ae(C({code:"command_failed",title:"Command failed",happened:n,required:"Adjust command input or tracker state and retry.",why:"pm enforces explicit, deterministic contracts for data and command semantics.",examples:["pm --help","pm <command> --help"]}),e,t)}function Js(e,t,n){return e==="create"&&t.startsWith("--type")?[`pm create --title "Example title" --description "Example description" --type ${n.split("|")[0]||"Task"} --status open --priority 1 --message "Create item" --create-mode progressive`]:e==="update"?['pm update pm-a1b2 --status in_progress --message "Start implementation"']:[`pm ${e??"<command>"} --help`]}function Ys(e){let t=e.trim();return t.match(/--[A-Za-z0-9][A-Za-z0-9_-]*/)?.[0]??t}function Xs(e){if(!(!Array.isArray(e)||e.length===0))return x(e)}function In(e){if(!Array.isArray(e))return;let t=e.map(n=>n.trim()).filter(n=>n.length>0);return t.length>0?t:void 0}function U(e,t={}){let n=In(e?.providedOptionFlags),o=Array.isArray(e?.normalizedInvocationArgs)&&e?.normalizedInvocationArgs.length>0?e.normalizedInvocationArgs:void 0,a=typeof e?.attemptedCommand=="string"?e.attemptedCommand:Xs(o),i=typeof e?.suggestedRetryCommand=="string"?e.suggestedRetryCommand:void 0;return Ae({attempted_command:a,normalized_args:o,provided_fields:n,suggested_retry:i,suggested_retry_args:e?.suggestedRetryArgs,...t})}function An(e,t){return!t||e.includes(t)?e:[...e,t]}var Zs=new Set(["--add","--add-json","--remove"]),Qs=new Set(["command","cmd","path"]);function el(e){if(Array.isArray(e))for(let t of e){if(!t.startsWith("--"))continue;let n=t.indexOf("="),o=n>=0?t.slice(0,n):t;if(Zs.has(o))return o}}function tl(e){if(!Array.isArray(e))return;let t=e.indexOf("test");if(t<0)return;let n=e[t+1];if(!(typeof n!="string"||n.startsWith("-")))for(let o=t+2;o<e.length;o+=1){let a=e[o];if(a!=="--add"&&a!=="--remove")continue;let i=e[o+1];if(typeof i!="string"||!Qs.has(i))return;let r=[];for(let c=o+2;c<e.length;c+=1){let d=e[c];if(d.startsWith("--")&&d.length>2)break;r.push(d)}if(r.length<2)return;let s=`${i}=${r.join(" ")}`,l=[...e.slice(0,o+1),s,...e.slice(o+2+r.length)];return x(l)}}function nl(e,t,n,o){let a=e.match(/required option '([^']+)' not specified/);if(!a)return null;let i=Ys(a[1]),r=i.startsWith("--type"),s=o?.suggestedRetryCommand,l=In(o?.providedOptionFlags),c=[i],d=Js(t,i,n),m=s?An(d,s):d,p=r?[`Allowed type values: ${n}`,`Run "pm ${t??"create"} --help --type <value>" for type-aware policy details.`]:[`Run "pm ${t??"<command>"} --help" for required option guidance.`],u=s?An(p,`Replay with preserved arguments: ${s}`):p,f=l&&l.length>0?An(u,`Already provided options: ${l.join(", ")}`):u;return C({code:"missing_required_option",title:`Missing required option ${i}`,happened:`Commander rejected the command because ${i} was not provided.`,required:`Pass ${i} with a valid value before running the command.`,why:r?"--type selects item contract and policy routing, including required/disabled option rules.":"Required flags define mandatory command intent and prevent ambiguous execution.",examples:m,nextSteps:f,recovery:U(o,{missing:c})})}function ol(e,t,n){let o=e.match(/missing required argument '([^']+)'/);if(!o)return null;let a=o[1];return C({code:"missing_required_argument",title:`Missing required argument ${a}`,happened:`Command invocation omitted positional argument ${a}.`,required:`Provide ${a} in the expected command position.`,why:"Positional arguments identify the target entity or action context for the command.",examples:[`pm ${t??"<command>"} --help`],recovery:U(n,{missing:[a]})})}function al(e,t,n){return C({code:"unsupported_update_option",title:`Unsupported option ${e} for update`,happened:`pm update does not accept ${e} for linked artifact mutations.`,required:"Use dedicated linked-artifact commands instead of pm update for files/docs changes.",why:"pm update manages scalar item metadata, while linked files/docs are managed by pm files and pm docs.",examples:['pm files pm-a1b2 --add "path=src/cli/main.ts,scope=project,note=implementation surface"','pm docs pm-a1b2 --add "path=README.md,scope=project,note=user-facing contract"'],nextSteps:['Run "pm files --help" and "pm docs --help" for add/remove payload formats.'],recovery:U(t,{suggested_flags:n})})}var il={declared_elsewhere:"Use an option declared on this path, or move the declared option to one of its accepting command paths.",declared_on_path:"Use the option with the value and syntax declared by this command path.",declared_nowhere:"Use a declared option on this command path; this spelling exists nowhere in the command lexicon."};function rl(e){let t=ye(e.unknownOptionOtherCommands)??[];return{otherCommands:t,optionScope:e.unknownOptionScope??(t.length>0?"declared_elsewhere":"declared_nowhere"),candidateTotal:e.unknownOptionOtherCommandsTotal??t.length}}function sl(e,t,n,o,a){let i=o.otherCommands.slice(0,3),r=o.candidateTotal-i.length,s=r>0?` and ${String(r)} more command path(s)`:"";return["Run command help to confirm the exact option contracts for this command path.",n.length?`Nearest supported options: ${n.join(", ")}`:void 0,i.length?`${e} is accepted by ${i.join(", ")}${s}. Inspect those command contracts only if you intended a different operation.`:void 0,o.optionScope==="declared_nowhere"?`${e} is not declared on any command path. Use a nearest supported option on ${t??"the attempted command"}, or inspect that command's help.`:void 0,a?`Replay with suggested correction: ${a}`:void 0].filter(l=>typeof l=="string")}function ll(e,t){if(["--dry-run","--check","--check-only","--plan","--preview"].includes(t.split("=",1)[0]))return{};if(e.suggestedRetryCommand!==void 0)return{retryCommand:e.suggestedRetryCommand};if(li(t))return{};let n=e.normalizedInvocationArgs;if(n===void 0)return{};if(n.filter(i=>i===t||i.startsWith(`${t}=`)).length!==1)return{};let o=n.findIndex(i=>i===t||i.startsWith(`${t}=`));if(o<0||n.includes("--")||!n[o]?.includes("=")&&o!==n.length-1&&n[o+1]?.startsWith("-")!==!0)return{};let a=N(n.filter((i,r)=>r!==o));return{retryCommand:x(a),suggestedRetryArgs:a}}function cl(e,t,n){let o=e.match(/unknown option '([^']+)'/);if(!o)return null;let a=n??{},i=o[1],r=In(a.unknownOptionSuggestions)??[],{retryCommand:s,suggestedRetryArgs:l}=ll(a,i);if(t==="update"&&(i==="--file"||i==="--doc"))return al(i,n,r);let c=rl(a),d=sl(i,t,r,c,s);["--dry-run","--check","--check-only","--plan","--preview"].includes(i.split("=",1)[0])&&d.push("The requested preview is unavailable on this path. Inspect the item with a read-only command or use a command that declares this option; do not replay this mutation without preview intent.");let m=[s,t?`pm ${H(t)?.canonical??t} --help`:"pm --help --all"].filter(p=>typeof p=="string");return C({code:"unknown_option",title:`Unknown option ${i}`,happened:`Commander does not recognize option ${i} for this command path.`,required:il[c.optionScope],why:"Option contracts are command-specific and intentionally validated.",flag:i,value:i,examples:m,nextSteps:d,recovery:U(n,{suggested_flags:r.length>0?r:void 0,suggested_retry:s,suggested_retry_args:l,candidate_commands:c.otherCommands,candidate_commands_total:c.candidateTotal||void 0,candidate_commands_truncated:a.unknownOptionOtherCommandsTruncated,option_scope:c.optionScope})})}function dl(e,t,n,o,a){let i=`"${e}" is provided by the ${t.packageName} package. Install it with: ${t.installCommand}`,r=o.filter(s=>!s.endsWith(`: ${t.installCommand}`));return C({code:"unknown_command",title:`Unknown command ${e}`,happened:`pm does not expose command path "${e}" in current runtime configuration. It is shipped by the optional ${t.packageName} package.`,required:`Install the ${t.packageName} package, or use a valid command name or subcommand path.`,why:"Command registry includes core commands plus active extension command handlers; package-provided commands appear only after the package is installed.",examples:Ei([t.installCommand,...n]),nextSteps:Ei([i,...r]),recovery:U(a)})}function ml(e,t){let n=e.match(/unknown command '([^']+)'/);if(!n)return null;let o=n[1],a=ye(t?.unknownCommandExamples),i=ye(t?.unknownCommandNextSteps),r=Ts(o),s=a??["pm --help"],l=i??["Verify spelling and active extensions, then rerun."],c=new Set(t?.failedExtensions?.map(m=>m.name.trim().toLowerCase())),d=r?.packageName.replace(/^@unbrained\/pm-/,"").toLowerCase();return r&&(!d||!c.has(d))?dl(o,r,s,l,t):C({code:"unknown_command",title:`Unknown command ${o}`,happened:`pm does not expose command path "${o}" in current runtime configuration.`,required:"Use a valid command name or subcommand path.",why:"Command registry includes core commands plus active extension command handlers.",examples:s,nextSteps:l,recovery:U(t)})}function pl(e){let t=e?.unknownSubcommandPath?.trim(),n=e?.unknownSubcommandToken?.trim(),o=ye(e?.unknownSubcommandAllowedValues);if(!t||!n||!o)return null;let a=e?.suggestedRetryCommand;return C({code:"unknown_subcommand",title:`Unknown ${t} subcommand ${n}`,value:n,happened:`The positional token sequence "${n}" is not a declared ${t} subcommand.`,required:`Use one of: ${o.join(", ")}.`,why:"Subcommands are single positional tokens; multi-word action names use hyphens.",examples:[...a?[a]:[],`pm ${H(t)?.canonical??t} --help`],nextSteps:a?[`Retry with the declared hyphenated action: ${a}`]:["Choose one value from recovery.allowed_values."],recovery:U(e,{allowed_values:o,suggested_retry:a})})}function ul(e,t,n){if(!/too many arguments/i.test(e)||t!=="test")return null;let o=n?.normalizedInvocationArgs,a=el(o);if(!a)return null;let i=tl(o);return C({code:"linked_test_value_not_quoted",title:`Linked-test ${a} value must be one argument`,happened:`Commander saw extra positional tokens after the item id \u2014 usually a ${a} value containing spaces (for example a command with " -- ") that the shell split into multiple tokens.`,required:`Quote the whole ${a} value as a single argument. Accepted forms: --add "command=npm test -- parser", --add command "npm test -- parser" (two-token form with the value quoted), or --add-json for complex commands.`,why:"The shell splits unquoted values before pm can see them, so pm cannot reassemble the intended command unambiguously.",examples:[...i?[i]:[],'pm test pm-a1b2 --add "command=npm test -- parser"','pm test pm-a1b2 --add command "npm test -- parser"',`pm test pm-a1b2 --add-json '{"command":"npm test -- parser"}'`],nextSteps:[...i?[`Replay with the value re-joined into one argument: ${i}`]:[],"Prefer --add-json for commands containing commas, equals signs, or quotes.",'Run "pm test --help" for linked-test entry contracts.'],recovery:U(n,i?{suggested_retry:i}:{})})}var fl=new Set(["comments","docs","files","learnings","notes","test"]);function gl(e,t,n){if(!/too many arguments/i.test(e)||!fl.has(t??""))return null;let o=n?.normalizedInvocationArgs??[],a=o.findIndex(c=>c===t),i=o[a+1],r=o[a+2],s=n?.verifiedCollectionItemId?.trim();if(i?.toLowerCase()!=="add"||!r||r.startsWith("-")||!s||s.toLowerCase()!==r.toLowerCase())return null;let l=`pm ${t} ${s} --add <value>`;return C({code:"collection_transposed_subcommand",title:`Transposed ${t} add syntax`,happened:`The positional token "add" occupied the item-id role and "${s}" occupied the next positional role. pm ${t} does not use an add subcommand.`,required:`Place the item id immediately after ${t}, then use --add for the value.`,why:"Collection mutations use object-first grammar: pm <collection> <item-id> --add <value>.",examples:[l,`pm ${t} --help`],recovery:U(n,{parsed_positionals:[{role:"transposed_subcommand",value:i},{role:"item_id",value:s}],suggested_retry:l})})}var hl=new Set(["--activity-limit","--assignee","--assignee-filter","--date","--depth","--fields","--format","--from","--limit","--parent","--path","--pm-path","--priority","--release","--section","--sprint","--stale-threshold","--tag","--to","--type"]),Si=new Set(["context","ctx"]);function yl(e,t,n){if(!/too many arguments/i.test(e)||!Si.has(t??""))return null;let o=n?.normalizedInvocationArgs??[],a=o.findIndex(c=>Si.has(c)),i=a===-1?1:a+1,r=e.match(/got \d+:\s*(\S+)/i),s=r?r[1].replace(/\.$/,""):void 0;if(s===void 0){let c=!1;for(let d of o.slice(i)){if(c){c=!1;continue}let m=d.split("=")[0];if(hl.has(m)){c=!d.includes("=");continue}if(!d.startsWith("-")){s=d;break}}}if(!s)return null;let l=`pm get ${s}`;return C({code:"context_takes_no_item_argument",title:"pm context takes no item argument",happened:`pm context renders a workspace-level snapshot and received the positional argument "${s}".`,required:`Use ${l} for one item's full details, or pm context --parent ${s} to scope the snapshot to that item's subtree.`,why:"Item-level detail (pm get) and workspace-level context (pm context) are separate projections.",examples:[l,`pm context --parent ${s}`],recovery:U(n,{suggested_retry:l})})}function Pn(e,t,n,o){let a=Ot(e);return(nl(a,t,n,o)??ol(a,t,o)??cl(a,t,o)??ml(a,o)??pl(o)??gl(a,t,o)??ul(a,t,o)??yl(a,t,o))||C({code:"invalid_command_usage",title:"Invalid command usage",happened:a,required:"Use the command with valid arguments and options.",why:"Commander validates CLI contracts before execution.",examples:["pm --help",`pm ${t??"<command>"} --help`],recovery:U(o)})}function Ri(e,t){let n=Rn(e,t);return(t?.code==="tracker_root_missing"||t?.code==="tracker_not_initialized")&&n.title==="Tracker is not initialized"&&n.recovery?.suggested_retry_args?[`Error: ${n.title}`,`Run: ${x(n.recovery.suggested_retry_args)}`,"Use --json for full recovery details."].join(`
|
|
7
|
-
`):
|
|
1
|
+
import{A as la,B as hn,D as ca,E as da,G as ma,H as yn,a as an,b as de,c as rn,d as sn,e as ln,f as cn,i as M,j as D,k as A,l as K,m as k,n as Ii,s as He,t as Pi,u as Mi,y as Fi,z as sa}from"./chunks/chunk-EMEEHV2Y.js";import{Ta as ra,f as Ci,i as Ti}from"./chunks/chunk-WBBW3WQX.js";import"./chunks/chunk-RJ5N44WY.js";import"./chunks/chunk-JGKTOBVB.js";import{F as ea,Kd as aa,Pc as ia,b as Yi,d as vt,g as Xi,h as Zi,i as J,j as Qi}from"./chunks/chunk-JSUJWIHQ.js";import{g as Oi,za as ta}from"./chunks/chunk-N56CAQBU.js";import"./chunks/chunk-7OEGNA4X.js";import"./chunks/chunk-DEZPZOQ7.js";import{$a as Zt,$c as oi,$d as x,$n as ze,Ac as ee,Ae as ui,Al as Ri,Be as nn,Bi as be,Bl as ne,Bn as Li,Cf as vi,Ci as P,Cn as mn,Dc as Zo,Dd as tn,Di as Si,Dl as $i,Dn as wt,Ec as dt,Ed as ut,El as Di,En as ji,Fc as Qo,Fd as mi,Fj as yt,Fn as Ui,Gd as pi,Gl as Ni,Gn as qi,Hj as Ue,Hn as Hi,Ic as ei,Ij as _t,In as pn,Jn as zi,Kc as ti,Kn as Ce,Kp as oa,Me as fi,Nb as Me,Ne as gi,Nn as Gi,Oe as hi,Of as ce,On as Wi,Pe as yi,Qe as _i,R as g,Rf as bi,S as lt,Sa as Xt,Sf as ve,T as b,Uf as on,Uj as qe,V,Va as re,Vf as _,Xa as Ko,Xc as ni,Ya as ct,Yc as Fe,_c as Le,ab as Jo,ae as je,bb as S,co as Vi,db as Yo,e as R,eb as B,fa as Wo,fo as Bi,g as q,ga as Vo,h as I,hc as Qt,id as ii,j as W,ja as Ne,jd as ai,k as Jt,kd as ri,kh as xi,ko as un,l as H,ld as si,lh as ki,lo as Ki,m as Go,md as te,mo as Ji,mp as bt,na as Yt,nd as li,np as Ct,od as en,op as fn,pd as se,pp as Ge,qd as ci,qj as ht,qp as E,ra as Bo,rd as mt,rj as Ai,rp as na,sc as Xo,sd as we,sp as gn,td as le,th as ft,ug as dn,wd as di,wi as gt,wp as L,xd as pt,yf as wi,yi as Ei}from"./chunks/chunk-X2H6UR26.js";import{Command as $o,CommanderError as $r}from"commander";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="50318c14-8c1c-50f3-95d0-fd9ea3f0bb69")}catch{}})();function j(e){return`--${e.replace(/^--?/,"").replace(/_/g,"-").replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`}function me(e){if(!e.startsWith("--"))return;let t=e.includes("=")?e.slice(0,e.indexOf("=")):e;return j(t)}function Y(e){let t=new Set,n=[];for(let o of e){let i=me(o);i&&(t.has(i)||n.push(i),t.add(i))}return n}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0b95b409-ef2c-59da-a628-16a2cb4f0ea6")}catch{}})();var _n=new Set(["--fields","--output-include","--depth","--for","--token-budget"]),xt=new Set(["--full","--brief","--compact"]);function ps(e,t){return!!(e.flag==="--pm-path"||e.value_name||e.list||e.value_type==="number"||e.value_type==="string"||t.has(e.flag))}function us(e){let t=ne(k([...e])),n=new Set([...$i,...Di,...Ni].flatMap(r=>r.keys.map(s=>`--${s.replace(/[A-Z]/g,l=>`-${l.toLowerCase()}`)}`))),o=new Map([...qe,...t].flatMap(r=>[r.flag,...r.aliases??[]].map(s=>[s,r.flag]))),i=new Map([...qe,...t].flatMap(r=>[r.flag,...r.aliases??[]].map(s=>[s,ps(r,n)])));for(let r of _n)i.set(r,!0);for(let r of xt)i.set(r,!1);let a=new Map;for(let r=0;r<e.length;r+=1){let s=e[r];if(s==="--")break;if(!s.startsWith("-"))continue;let l=s.split("=")[0];if(!i.has(l)&&!s.includes("="))return;a.set(r,o.get(l)??l),i.get(l)&&!s.includes("=")&&(r+=1)}return a}function pa(e,t,n){let o=new Set;for(let[i,a]of t)n.has(a)&&(o.add(i),_n.has(a)&&!e[i].includes("=")&&o.add(i+1));return e.filter((i,a)=>!o.has(a))}function fs(e,t){let n=t.find(i=>xt.has(i));if(n===void 0)return;let o=[...new Set(e.values())].filter(i=>xt.has(i));return o.length===1?o[0]:n}function ua(e,t,n){if(!n||!["unknown_field_projection","projection_options_mutually_exclusive"].includes(t??""))return n;let o=n.suggested_retry_args,i={...n,suggested_retry:void 0,suggested_retry_args:void 0};if(!o)return i;let a=us(e);if(!a)return i;let r;if(t==="unknown_field_projection"){let s=o.indexOf("--fields");if(s<0||o[s+1]===void 0)return i;let l=[...a].find(([c,d])=>d==="--fields")?.[0]??-1;if(l<0)return i;r=pa(e,a,new Set(["--fields"])),r.splice(l,0,"--fields",o[s+1])}else{let s=fs(a,o);if(s===void 0||![...a.values()].includes(s))return i;let l=new Set([..._n,...xt].filter(c=>c!==s));r=pa(e,a,l)}return{...n,suggested_retry:x(r),suggested_retry_args:r}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="afa4a7a0-d9de-529d-92dd-3e9704ea00d2")}catch{}})();async function fa(e,t){await Ki(e,{ok:t.ok,error:t.error,result:le(),exit_code:t.exit_code,error_code:t.error_code,error_category:t.error_category,command_resolution:t.command_resolution,resolution_stage:t.resolution_stage})}async function ga(e){if(process.env.PM_CONTEXT_USAGE_DISABLED==="1")return;let t;try{await wi({pmRoot:e.pmRoot,result:le()})}catch(o){t=o}let n=await P(e.pmRoot);if(await vi({pmRoot:e.pmRoot,author:ft(e.author,n.author_default),itemIds:e.itemIds,intent:e.intent}),t!==void 0)throw t}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="dacf3952-3ae1-57fa-840a-c8a43cf855a5")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="197ced7a-f930-58a2-9c4e-8dc2cd912784")}catch{}})();var ha=new WeakMap;function kt(e,t){ha.set(e,t)}function pe(e){return ha.get(e)}function ya(e){return e.length>0?[e[0]]:[]}function gs(e){let t=["","Intent:",` ${e.why}`],n=ya(e.examples);return n.length>0&&(t.push("","Example:"),t.push(` ${n[0]}`)),t.push("","Need deeper rationale and more examples?"),t.push(" Re-run with --explain."),t.join(`
|
|
2
|
+
`)}function hs(e){let t=["","Why use this command:",` ${e.why}`,"","Examples:",...e.examples.map(n=>` ${n}`)];return e.tips&&e.tips.length>0&&(t.push("","Tips:"),t.push(...e.tips.map(n=>` - ${n}`))),t.join(`
|
|
3
|
+
`)}function _a(e,t){return t==="detailed"?hs(e):gs(e)}function N(e){return e.trim().toLowerCase().split(/\s+/).filter(t=>t.length>0).join(" ")}var ys={cal:"calendar",ctx:"context"};function _s(e,t){return e.commands.find(n=>n.name()===t)??null}function ws(e,t){let n=e;for(let o of t){let i=_s(n,o);if(!i)return null;n=i}return n}function wn(e,t,n,o){let i=ws(e,t.split(" ").filter(a=>a.length>0));i&&i.addHelpText("after",_a(n,o))}function vn(e){return e.includes("--explain")?"detailed":"compact"}function oe(e){return e.includes("--all")||e.includes("--explain")}var ue={"item reopen":{why:"Reopens recurring work while archiving earlier closure evidence and declaring its current planning outcome.",examples:['pm item reopen pm-a1b2 "The failure recurred" --expected-result "The recurrence regression passes"'],tips:["Without --expected-result, follow recovery.suggested_retry_args to restore current planning before claiming the item."]},ops:{why:"Groups workspace diagnostics, quality checks, and maintenance under one discoverable command.",examples:["pm ops health --summary","pm ops validate --check-history-drift","pm ops --help"]},init:{why:"Bootstraps tracker storage and settings so all other commands can run safely.",examples:["pm init","pm init acme","pm init ./pm-sandbox --defaults","pm init --preset minimal","pm init --agent-guidance add","pm init --defaults --with-packages"],tips:["Run this once per repository before create/list/update commands.","A path-like positional (`./dir`, `/tmp/dir`) initializes that tracker path; a plain word remains an id prefix.","Rewriting id prefix, governance preset, or default author on an existing tracker requires --force.","Use --preset for non-interactive automation; omit it in a TTY to use the setup wizard.","Use --agent-guidance add to inject compact AGENTS/CLAUDE workflow guidance, or --agent-guidance status to inspect missing guidance without modifying files.","Use --with-packages when agents need bundled commands such as calendar and templates available immediately."]},config:{why:"Reads or updates project/global settings such as definition-of-done, item format, telemetry, and policy toggles.",examples:["pm config project get definition-of-done",'pm config project set definition-of-done --criterion "tests pass"',"pm config project set item-format --format toon","pm config project set sprint-release-format-policy --policy strict_error","pm config project set governance-preset --policy minimal","pm config project set governance-ownership-enforcement --policy none","pm config project set test-result-tracking --policy enabled","pm config global set telemetry-tracking --policy disabled"]},extension:{why:"Compatibility command for package-backed runtime extension lifecycle operations across project or global scope.",examples:["pm install ./my-package --project","pm install '*' --project","pm package doctor --project --detail summary","pm package manage --global","pm package activate sample-ext --project","pm package deactivate sample-ext --project","pm package uninstall sample-ext --global","pm extension explore --project","pm extension manage --global","pm extension describe sample-ext --project","pm extension doctor --detail deep"],tips:["Prefer pm install and pm package in new user-facing automation.","Use pm extension when maintaining existing extension-specific scripts or debugging the compatibility runtime directly.","Bundled aliases beads and todos resolve to package-shipped extension sources.","Use --gh/--github shorthand for GitHub sources and --ref to pin a branch, tag, or ref.","Install updates settings activation state automatically unless extension allowlist mode is unchanged.","Use --adopt for single-extension adoption and --adopt-all to bulk-register unmanaged installs as managed without reinstalling.","Use --manage for concise triage summaries and remediation-oriented diagnostics alongside full extension details.","Use --describe to map exactly what each loaded extension registers (commands, hooks, item types, providers, overrides) in one call.","Use --doctor for consolidated diagnostics with warning codes, remediation hints, and optional deep detail payloads."]},package:{why:"Installs, explores, manages, diagnoses, adopts, activates, deactivates, and refreshes package-backed pm runtime extensions.",examples:["pm install npm:@scope/pm-package --project","pm package install ./my-package --project","pm package doctor --project --detail deep","pm package manage --project --runtime-probe","pm package describe --project","pm package activate sample-ext --project","pm upgrade --packages-only --dry-run"],tips:["Prefer package vocabulary for user-facing workflows; extension vocabulary remains available for compatibility.","Use pm package describe [name] to map every surface a package registers without reading its manifest or running diagnostics.","Use pm upgrade to refresh the CLI/SDK and managed packages from their recorded sources.","Use --dry-run before upgrade when automation needs a deterministic plan."]},"package init":{why:"Generates an installable starter pm package with package metadata and a root extension entrypoint.",examples:["pm package init ./my-package","pm package init ./my-hook-package --capability hooks","pm package init ./my-search-package --capability search","pm package init ./my-sync-package --capability importers","pm package init ./my-domain-package --capability schema","pm package init ./my-output-package --capability renderers","pm install ./my-sync-package --project","pm package doctor --project --detail summary"],tips:["Use --capability hooks for a starter after_command lifecycle reactor with runnable SDK testing coverage.","Use --capability search for a starter search provider/vector-store adapter with runnable SDK testing coverage.","Use --capability importers for paired import/export commands that move project context across systems.","Use --capability schema for a starter custom item type, field, and migration so pm models your project domain.","Use --capability renderers/parser/preflight/services for starter override surfaces (output renderer, parsed-option rewrite, pre-run gate decision, built-in service) \u2014 one runnable starter per SDK capability.","The generated package is local-install safe; add SDK runtime imports only after declaring dependencies and validating with package doctor.","Use package doctor after changes to verify activation, policy, and collision diagnostics."]},"package install":{why:"Installs pm packages from local paths, npm sources, GitHub sources, bundled aliases, or wildcard/all aliases.",examples:["pm package install ./my-package --project","pm install npm:pm-changelog --project","pm package install --github org/repo/packages/my-pm-package --ref main"],tips:["Prefer the top-level pm install alias in scripts when only installation is needed.","Run pm package manage or pm package doctor after installing external packages."]},"package doctor":{why:"Diagnoses package activation, policy, collision, and managed-state health for project or global package scopes.",examples:["pm package doctor --project --detail summary","pm package doctor --project --detail deep --trace","pm package doctor --project --isolated --detail deep --trace"],tips:["Use --isolated (alias --ignore-global) for hermetic project smoke tests that must ignore globally installed package registrations.","Set PM_GLOBAL_PATH for a whole subprocess suite when every pm invocation must avoid machine-local global package state: PM_GLOBAL_PATH=$(mktemp -d) pm package doctor --project --detail deep --trace.","Non-isolated project diagnostics include global registrations and emit remediation when global package state can affect the result."]},"package catalog":{why:"Lists bundled first-party package catalog metadata and compact field projections.",examples:["pm package catalog --project","pm package catalog --project --fields alias,installed,install_command","pm package list --project --fields alias,package_name,category"],tips:["Use --fields for low-token package discovery in agent loops.","External npm package discovery still belongs to npm search."]},"extension init":{why:"Generates an installable starter runtime extension with manifest and entrypoint files.",examples:["pm extension init ./my-extension","pm extension init ./my-hook-extension --capability hooks","pm extension init ./my-search-extension --capability search","pm extension init ./my-sync-extension --capability importers","pm extension init ./my-domain-extension --capability schema","pm extension init ./my-output-extension --capability renderers","pm extension --install --project ./my-sync-extension","pm extension --doctor --project --detail summary"],tips:["Use --capability hooks when the extension should react to command lifecycle events.","Use --capability search when the extension should register retrieval primitives.","Use --capability importers when the extension should register project-context import/export commands.","Use --capability schema when the extension should register custom item types, fields, and migrations.","Use --capability renderers/parser/preflight/services to override pm's output rendering, parsed options, pre-run gate, or a built-in service.","Use package init for new distributable package workflows; extension init is the compatibility-level runtime scaffold."]},"extension install":{why:"Installs a compatibility runtime extension from local, npm, GitHub, bundled alias, or wildcard sources.",examples:["pm extension install ./my-extension --project","pm extension --install --project ./my-extension","pm extension doctor --project --detail summary"],tips:["Prefer pm install or pm package install for new package-first automation."]},"extension doctor":{why:"Diagnoses compatibility extension activation, policy, collision, and managed-state health for project or global extension scopes.",examples:["pm extension doctor --project --detail summary","pm extension doctor --project --detail deep --trace","pm extension doctor --project --isolated --detail deep --trace"],tips:["Use --isolated (alias --ignore-global) for hermetic project smoke tests that must ignore globally installed extension registrations.","Set PM_GLOBAL_PATH for a whole subprocess suite when every pm invocation must avoid machine-local global extension state: PM_GLOBAL_PATH=$(mktemp -d) pm extension doctor --project --detail deep --trace.","Prefer pm package doctor in new package-first workflows."]},"extension catalog":{why:"Compatibility view of bundled package catalog metadata.",examples:["pm extension catalog --project","pm extension catalog --project --fields alias,installed,install_command"],tips:["Prefer pm package catalog in new user-facing workflows."]},install:{why:"Installs a pm package into project scope by default, using local, npm, GitHub, or bundled alias sources.",examples:["pm install '*' --project","pm install ./packages/pm-todos --project","pm install npm:@scope/pm-package --global","pm install --github org/repo/packages/my-pm-package --ref main"],tips:["Installed packages are recorded in managed state and can be inspected with pm package manage."]},upgrade:{why:"Updates the global pm CLI/SDK and refreshes managed pm packages from recorded install sources.",examples:["pm upgrade --dry-run","pm upgrade --packages-only --project","pm upgrade todos --dry-run","pm upgrade --cli-only --repair","pm upgrade --tag next --dry-run"],tips:["Omit target to include the CLI/SDK plus all managed packages in the selected scope.","Pass a target to refresh one managed package by name, directory, package name, or source.","Use --packages-only in repository automation when the global CLI should not be changed."]},create:{why:"Creates a new planning item with deterministic metadata and history.",examples:['pm create --title "Harden lock flow" --description "Improve stale lock handling" --type Task --status open --priority 1 --message "Create lock hardening task" --create-mode progressive','pm create --title "Weekly planning sync" --description "Recurring coordination meeting" --type Meeting --schedule-preset lightweight','pm create --title "Asset: Hero model" --description "Track playable model asset" --type Asset --status open --priority 1 --message "Create asset item" --type-option category=Character --dep "id=pm-epic01,kind=parent,created_at=now" --comment "created_at=now,text=Why this asset item exists." --note "created_at=now,text=Initial implementation note." --learning "created_at=now,text=Durable lesson placeholder." --file "path=src/assets/hero.glb,note=tracked asset" --test "command=node scripts/run-tests.mjs test,timeout_seconds=240" --doc "path=README.md,note=asset docs"'],tips:["Use --schedule-preset lightweight for Reminder/Meeting/Event when you want minimal required create inputs.","Use --type <value> to load type-aware policy guidance in --help output."]},focus:{why:"Sets a session focused item so new pm create items default their --parent to it (project management = context management).",examples:["pm focus pm-epic1","pm focus","pm focus --clear"],tips:["Focus is session-local (stored in .agents/pm/runtime/session.json, gitignored) \u2014 it never affects teammates.",'An explicit --parent on pm create always overrides the focused item; use --parent "" to create with no parent.',"A stale focused item produces the same missing-parent validation as an explicit stale --parent."]},update:{why:"Mutates existing item fields while preserving history and lock safety.",examples:['pm update pm-a1b2 --status in_progress --message "Start implementation"','pm update pm-a1b2 --unset close-reason --message "Clear stale close reason after reopen"','pm update pm-a1b2 --unset assignee --deadline +2d --message "Replan ownership and deadline"','pm update pm-a1b2 --body "Backfilled body text for legacy item" --message "Normalize missing body"'],tips:['Use "pm close <ID> <TEXT>" to close items instead of --status closed.',"When reopening from closed to a non-terminal status, update clears stale close_reason unless explicitly set via --close-reason.",'Use "pm append <ID> --body <text>" for additive notes; use update --body to replace body content.']},"update-many":{why:"Bulk-updates matched item sets with dry-run previews and rollback checkpoints for safe large-scale metadata changes.",examples:["pm update-many --filter-status open --status in_progress --dry-run",'pm update-many --filter-tag wave:7 --replace-tests --test "command=node scripts/run-tests.mjs test -- tests/core/history.spec.ts,timeout_seconds=240"','pm update-many --filter-tag governance --reviewer maintainer-review --message "Normalize reviewer metadata"',"pm update-many --rollback ckpt-abc123"],tips:["Use --dry-run first to inspect proposed changes before apply mode.","Linked-array mutation flags mirror pm update semantics (for example --replace-tests, --clear-files, and repeatable --doc/--note seeds).","Checkpoints are enabled by default for apply mode and can be restored with --rollback."]},"close-many":{why:"Bulk-closes matched items with a shared reason routed through full pm close semantics (close validation, active-child orphan checks, blocked-edge cleanup) plus dry-run previews and rollback checkpoints \u2014 unlike update-many --status closed, which bypasses close validation.",examples:['pm close-many --filter-sprint S-12 --reason "Sprint S-12 acceptance criteria met" --dry-run','pm close-many --filter-tag wave:7 --reason "Superseded by redesign" --validate-close warn','pm close-many --ids pm-a,pm-b,pm-c --reason "Closed in batch" --resolution "Verified by integration suite"',"pm close-many --rollback close-many-20260604-abc123"],tips:["At least one filter (--filter-* or --ids) is required so close-many never matches every item.","Already-terminal matches are skipped by default; pass --force to re-close them.","Use --dry-run to preview matches plus per-item skip reasons and active-child orphan warnings before applying.","Checkpoints are enabled by default for apply mode; restore with --rollback <checkpoint-id>."]},templates:{why:"Saves, lists, and inspects reusable create option bundles for repeatable workflows.",examples:['pm templates save triage-default --title "Triage item" --description "..." --type Task --status open --priority 2 --message "Seed triage template"',"pm templates list","pm templates show triage-default"],tips:["Template names are positional arguments (`pm templates save <name>` and `pm templates show <name>`), not --name flags.","Combine templates with explicit create flags; explicit flags always override template defaults."]},deps:{why:"Inspects an item dependency graph as a tree or graph payload to understand blockers and hierarchy links.",examples:["pm deps pm-a1b2","pm deps pm-a1b2 --format graph","pm deps pm-a1b2 --max-depth 2 --collapse repeated --summary"],tips:["Use --summary for lightweight counts when full graph payloads are unnecessary."]},list:{why:"Lists active items with deterministic filtering and ordering.",examples:["pm list --limit 20","pm list --type Task --priority 0 --tag release --status in_progress","pm list --compact --sort deadline --order asc","pm list --fields id,title,parent,type --sort parent --order asc"]},"list-all":{why:"Lists all item states (including terminal states) when you need full visibility.",examples:["pm list-all --limit 50","pm list-all --type Issue --include-body"]},"list-open":{why:"Shows work that is ready to claim and start.",examples:["pm list-open --priority 0 --limit 10"]},"list-in-progress":{why:"Tracks active execution and owner progress.",examples:["pm list-in-progress --priority 0 --limit 20"]},"list-blocked":{why:"Surfaces blocked work that needs intervention.",examples:["pm list-blocked --limit 20"]},"list-closed":{why:"Reviews completed work and closure outcomes.",examples:["pm list-closed --limit 20 --type Task"]},"list-canceled":{why:"Audits intentionally discontinued work.",examples:["pm list-canceled --limit 20"]},"list-draft":{why:"Finds incompletely defined items that need refinement before execution.",examples:["pm list-draft --limit 20"]},aggregate:{why:"Runs grouped aggregation queries for governance checks such as decomposition by parent/type or triage by status/priority.",examples:["pm aggregate --group-by parent,type --count","pm aggregate --group-by type,status --count","pm aggregate --group-by parent,type --count --status open --parent pm-feature01"],tips:["Current aggregate mode is grouped counts only, so pass --count explicitly."]},guide:{why:"Routes local progressive-disclosure documentation so agents can fetch only the context they need.",examples:["pm install guide-shell --project","pm guide","pm guide quickstart","pm guide commands --depth standard","pm guide skills --depth deep --format markdown","pm guide release --json"],tips:["Use brief depth for minimal token footprint, standard for excerpted docs, and deep for full local document rendering.","Use --list to force topic index output even when topic parsing is ambiguous."]},calendar:{why:"Provides deadline/reminder/event scheduling views for planning and coordination.",examples:["pm calendar","pm calendar --view agenda --from +0d --to +7d --tag release","pm calendar --view week --date 2026-04-06 --full-period --include deadlines,events","pm calendar --view month --tag release --format json"],tips:["Day/week/month views are anchored period windows; default mode clips the start to now unless --past or --full-period is set.","--full-period applies only to day/week/month views; use --from/--to to bound agenda windows."]},context:{why:"Builds an agent-optimized snapshot of critical active work plus near-term agenda context with progressive depth levels.",examples:["pm context","pm ctx --depth standard --limit 10","pm ctx --depth deep --tag release","pm ctx --section hierarchy --section progress --section blockers","pm context --depth standard --activity-limit 20 --stale-threshold 14d","pm context --from +0d --to +7d --format markdown --depth deep"],tips:["High-level focus contains Epics/Features and low-level focus contains Tasks/Issues/Chores/Decisions/Event/Reminder/Milestone/Meeting/Plan.","When no open or in-progress work exists, blocked items are shown as fallback context.","--depth brief (default) shows focus+agenda; standard adds hierarchy/activity/progress/workload; deep adds blockers/files/staleness/tests.","--section overrides --depth and selects specific sections: hierarchy, activity, progress, blockers, files, workload, staleness, tests.","Configure defaults via pm config project set context --default-depth standard --activity-limit 15."]},next:{why:"Answers 'what should I work on now?' with the highest-priority ready item, rationale, and ranked ready and blocked queues.",examples:["pm next","pm next --json","pm next --limit 3 --ready-only","pm next --parent pm-mpbb","pm next --tag release --format markdown"],tips:["Ready = active status, no open blockers, and no open children (a concrete leaf); the recommendation resumes in-progress work before starting new work.","An item is blocked when its scalar blocked_by or a blocked_by dependency points at a non-terminal item; the blocked list names the blockers to clear.","Containers (Epics/Features with open children) are never recommended directly \u2014 the actionable leaf beneath them is.","Use --parent to scope to one epic's subtree, or --ready-only to drop the blocked companion list for the tightest output."]},search:{why:"Finds relevant items by keyword, semantic, or hybrid retrieval modes.",examples:['pm search "lock stale retry" --mode keyword --limit 10','pm search "extension migration blockers" --mode hybrid --type Task --priority 0','pm search "Cross-Epic Realism Dependency Council" --mode keyword --title-exact'],tips:["Use --title-exact to require exact normalized title parity, or --phrase-exact to require full-phrase matches in item text fields.","Use --include-linked when linked docs/files/tests should influence scoring."]},eval:{why:"Measures search relevance against a curated golden-query set so retrieval regressions are caught, not guessed.",examples:["pm eval --json","pm eval --mode hybrid --k 10","pm eval --fail-under 0.6 --json","pm eval --queries ./my-eval.json --mode semantic"],tips:["Curate ground truth in <pmRoot>/search/eval-queries.json as an array of {query, relevant_ids, mode?} objects.","Wire --fail-under into CI to fail the build when aggregate nDCG@k drops below your baseline."]},reindex:{why:"Rebuilds search artifacts after large changes to item corpus or provider/vector config.",examples:["pm reindex --mode keyword","pm reindex --mode hybrid --progress --json"],tips:["Use --progress for non-interactive visibility during local embedding runs.","JSON output includes semantic stale/unchanged/embed/upsert counts so agents can gate long reindex work without parsing stderr."]},get:{why:"Shows details for one item by ID, with optional lower-token projections for agent loops.",examples:["pm get pm-a1b2","pm get pm-a1b2 --depth brief --json","pm get pm-a1b2 --fields id,title,status,parent,type --json","pm get pm-a1b2 --at 7 --fields id,title,status,body --json"],tips:["Default depth is standard for body plus linked artifacts without append-only logs; use brief for metadata-only checks or --full for complete history-heavy metadata.","Use --fields for the smallest deterministic item metadata payload when an agent only needs specific fields.","Schedule metadata is normalized under schedule; request schedule.start_at or schedule.location for narrow calendar reads.","Children are type-agnostic and include bounded deterministic samples plus continuation metadata when a parent has direct children.","Use --at <version|timestamp> for a verified read-only historical projection; reconstructed/as_of fields distinguish it from current state.","JSON output shape is { item, linked, claim_state, schedule, children }; body is nested at item.body (parity with list --include-body)."]},history:{why:"Inspects item mutation timeline and audit trail.",examples:["pm history pm-a1b2 --limit 20","pm history pm-a1b2 --full --verify"]},"history-compact":{why:"Compacts long history streams into a synthetic checkpoint while preserving replay integrity. Pass an item id for one stream, or a bulk selector (--ids/--all-over/--closed/--all-streams) to sweep many.",examples:["pm history-compact pm-a1b2 --dry-run",'pm history-compact pm-a1b2 --before 25 --message "Compact early history"',"pm history-compact --all-over 500 --dry-run","pm history-compact --closed","pm history-compact --ids pm-a1b2,pm-c3d4 --dry-run"]},activity:{why:"Reviews recent tracker-wide activity across items.",examples:["pm activity --limit 50","pm activity --full --id pm-a1b2 --limit 50","pm activity --id pm-a1b2 --op update --from -7d --to now","pm activity --json --stream rows --limit 200"],tips:["Use --stream with --json for line-delimited automation output; --from is inclusive and --to is exclusive."]},restore:{why:"Restores an item to a prior timestamp/version with history replay safety.",examples:['pm restore pm-a1b2 2026-04-01T00:00:00.000Z --message "Rollback to known-good state"']},close:{why:"Transitions work to terminal closed state with explicit rationale.",examples:['pm close pm-a1b2 "Done" --release-assignment --validate-close warn','pm close pm-a1b2 "Done" --validate-close','pm close pm-a1b2 "Done" --validate-close off','pm close pm-a1b2 "Done" --validate-close strict']},delete:{why:"Removes an item while preserving history evidence and lock/ownership checks.",examples:['pm delete pm-a1b2 --message "Remove duplicate item"']},append:{why:"Adds implementation notes to body without replacing existing content.",examples:['pm append pm-a1b2 --body "Implemented retry with bounded backoff." --message "Record implementation detail"']},comments:{why:"Adds or reviews lightweight status updates linked to an item.",examples:['pm comments pm-a1b2 "Verified fix on Linux and macOS"','pm comments pm-a1b2 --add "Verified fix on Linux and macOS"','printf "%s\\n" "## Verification" "- linux pass" "- mac pass" | pm comments pm-a1b2 --stdin',"pm comments pm-a1b2 --file docs/release-evidence.md",'pm comments pm-a1b2 --add "text: verification note with commas, key-like words, and parser details"','pm comments pm-a1b2 --add "Follow-up needed after review" --force',"pm comments pm-a1b2 --limit 10"],tips:["Use exactly one comment source at a time: positional [text], --add, --stdin, or --file.","Use --force when adding comments to items currently assigned to a different owner.","When --add payload resembles CSV-like key fragments (for example text=hello,scope:project), plain-text fallback is intentional; use explicit text=..., markdown text: ..., or stdin token - for structured intent."]},notes:{why:"Adds or reviews durable implementation notes linked to an item.",examples:['pm notes pm-a1b2 --add "Investigated parser edge case and documented fallback logic."','pm notes pm-a1b2 --add "text: parser rationale with commas, colons, and key-like wording"','pm notes pm-a1b2 --edit 1 --add "Corrected durable note"',"pm notes pm-a1b2 --delete 2","pm notes pm-a1b2 --limit 10"],tips:["CSV-like add payloads with extra key fragments are treated as plain text by design; use explicit text keys (text= or text:) when structured parsing is required."]},learnings:{why:"Adds or reviews post-implementation learnings for future work.",examples:['pm learnings pm-a1b2 --add "Avoid direct test-runner commands in linked tests; use sandbox runner."','pm learnings pm-a1b2 --add "text: lesson with commas, key-like words, and punctuation-safe context"',"pm learnings pm-a1b2 --edit 1 --file docs/corrected-learning.md","pm learnings pm-a1b2 --delete 2","pm learnings pm-a1b2 --limit 10"],tips:["If you intended structured parsing for a key-like payload, prefer explicit text=..., markdown text: ..., or stdin token -; ambiguous CSV-like forms intentionally remain plain text."]},files:{why:"Associates changed source files with tracker items for reproducibility.",examples:['pm files pm-a1b2 --add "path=src/cli/main.ts,note=help orchestration"','pm files pm-a1b2 --add src/cli/main.ts --note "help orchestration"',"pm files discover pm-a1b2",'pm files discover pm-a1b2 --apply --note "discovered from item text"']},docs:{why:"Associates relevant documentation paths with tracker items.",examples:['pm docs pm-a1b2 --add "path=README.md,note=user-facing command guidance"','pm docs pm-a1b2 --add README.md --note "user-facing command guidance"']},test:{why:"Links test commands/paths and optionally executes them for one item.",examples:['pm test pm-a1b2 --add "command=node scripts/run-tests.mjs test -- tests/unit/output.spec.ts,timeout_seconds=2400"','pm test pm-a1b2 --add "command=pm list-all --type Task --limit 200,assert_stdout_contains=count:,assert_stdout_regex=count:\\s+\\d+"','pm test pm-a1b2 --add "command=pm list-all --type Task --limit 200,pm_context_mode=auto"',"pm test pm-a1b2 --run --timeout 2400 --env-set PORT=0 --env-clear PLAYWRIGHT_BASE_URL --shared-host-safe --pm-context tracker --fail-on-context-mismatch --fail-on-skipped","pm test pm-a1b2 --run --timeout 2400 --pm-context auto","pm test pm-a1b2 --run --background --timeout 2400 --progress"]},"test-all":{why:"Runs linked tests in bulk for release/readiness sweeps.",examples:["pm test-all --status in_progress --limit 5 --offset 10 --timeout 2400","pm test-all --status closed --timeout 3600 --progress --env-set PORT=0 --shared-host-safe --fail-on-skipped","pm test-all --status in_progress --pm-context tracker --fail-on-context-mismatch --require-assertions-for-pm","pm test-all --status in_progress --pm-context auto --fail-on-context-mismatch","pm test-all --status in_progress --background --timeout 3600"]},"test-runs":{why:"Manages background linked-test runs with lifecycle controls and log/status inspection.",examples:["pm test-runs list --status running --limit 20","pm test-runs status tr-abc123","pm test-runs logs tr-abc123 --stream stderr --tail 200","pm test-runs stop tr-abc123","pm test-runs resume tr-abc123"]},stats:{why:"Reports tracker-level totals and distribution by type/status.",examples:["pm stats","pm stats --json"]},telemetry:{why:"Inspects and manages local telemetry queue/runtime state for observability diagnostics.",examples:["pm telemetry status","pm telemetry stats --limit 10","pm telemetry flush","pm telemetry clear"]},health:{why:"Validates tracker/runtime health including extension triage, migration, and integrity diagnostics.",examples:["pm health","pm health --check-only --summary --json","pm health --brief --json","pm health --no-refresh","pm health --refresh-vectors"]},validate:{why:"Runs standalone metadata, resolution, lifecycle (including dependency-cycle diagnostics), linked-file, linked-command reference, and history drift checks with default remediation hints for resolution gaps.",examples:["pm validate","pm validate --check-resolution --json","pm validate --check-lifecycle --dependency-cycle-severity error","pm validate --check-lifecycle --parent-cycle-severity error","pm validate --check-files --scan-mode tracked-all","pm validate --check-files --scan-mode tracked-all-strict --include-pm-internals","pm validate --check-command-references","pm validate --check-resolution --fail-on-warn --json"],tips:["Resolution-gap warnings include default `pm update <id> ...` remediation hint templates in check details."]},gc:{why:"Deletes optional cache artifacts by default to keep local tracker state tidy; use --dry-run to preview targets without deleting files.",examples:["pm gc --dry-run","pm gc"]},claim:{why:"Claims an item to signal active ownership and reduce conflicts.",examples:["pm claim pm-a1b2 --start",'pm claim pm-a1b2 --force --message "Take over terminal item"','pm claim pm-a1b2 --author "release-service" --message "Explicit non-agent identity override"'],tips:["Claim takeover for non-terminal items does not require --force; --force is reserved for terminal/lock overrides.","Harness identity is automatic; use --author only to assert an intentional external principal."]},release:{why:"Releases an active claim when paused, handed off, or completed.",examples:["pm release pm-a1b2 --pause"]},"start-task":{why:"Lifecycle alias that claims an item and sets status to in_progress.",examples:['pm start-task pm-a1b2 --message "Start implementation"']},"pause-task":{why:"Lifecycle alias that sets status to open and releases active assignment.",examples:['pm pause-task pm-a1b2 --message "Pause for dependency unblock"']},"close-task":{why:"Lifecycle alias that closes with reason text and clears assignment metadata.",examples:['pm close-task pm-a1b2 "All acceptance criteria met" --message "Close and handoff"']},meet:{why:"Shortcut to create a Meeting from friendly time flags (start/duration) without structured --event CSV.",examples:['pm meet "Sprint Planning" --start +1h --duration 1h','pm meet "1:1" --start 2026-07-01T15:00:00Z --end 2026-07-01T15:30:00Z --location "Room A"'],tips:["Start defaults to now and duration to 1h; pass --end to set an explicit end instead of --duration.","--duration accepts relative tokens (h/d/w/m where m is months) plus sub-hour forms like 30min or PT30M."]},event:{why:"Shortcut to create an Event from friendly time flags (start/duration) without structured --event CSV.",examples:['pm event "Release v2" --start 2026-07-01T10:00:00Z --duration 2h','pm event "Conference" --start 2026-08-01 --all-day'],tips:["Start defaults to now and duration to 1h; pass --end to set an explicit end instead of --duration.","--duration accepts relative tokens (h/d/w/m where m is months) plus sub-hour forms like 30min or PT30M."]},remind:{why:"Shortcut to create a Reminder from a single point in time without structured --reminder CSV.",examples:['pm remind "Review PR" --at +2d','pm remind "Follow up" --at 2026-07-01T09:00:00Z --text "Ping the team"'],tips:["The reminder time defaults to +1d and the reminder text defaults to the title."]},completion:{why:"Generates shell completion scripts for faster and more reliable command entry.",examples:["pm completion bash","pm completion zsh","pm completion fish","pm completion bash --eager-tags"],tips:["Default scripts resolve tag suggestions lazily at completion time; use --eager-tags to embed current tags directly."]},contracts:{why:"Exposes machine-readable CLI command and tool schema contracts for agent integrations.",examples:["pm contracts","pm contracts --command list --runtime-only","pm contracts --command update --flags-only","pm contracts --availability-only --runtime-only","pm contracts --action create","pm contracts --schema-only"],tips:["Use --command to narrow actions/schema to one CLI surface; combine with --flags-only or --availability-only for lighter payloads."]}};for(let{alias:e,canonical:t}of R){let n=ue[e];n&&(ue[t]={...n,examples:n.examples.map(o=>o.replace(`pm ${e}`,`pm ${t}`))})}var xe={why:"Provides deterministic project management workflows for humans and coding agents.",examples:["pm init","pm install guide-shell --project","pm list-open --limit 10",'pm create --title "..." --description "..." --type Task --status open --priority 1 --message "..." --create-mode progressive'],tips:["Use <command> --help for command-specific guidance and examples.","Install guide-shell before using pm guide for local docs and skills routing.","Use --json for machine parsing and integration flows.","Use --no-pager to force direct help output in CI and other non-interactive shells."]},wa=W.filter(e=>e.lifecycle==="deprecated");for(let e of wa){let t=ue[e.alias];ue[e.alias]={...t,why:`Deprecated: use pm ${e.canonical_argv.join(" ")}. ${t.why}`}}for(let e of[xe,...Object.values(ue)])e.examples=e.examples.map(t=>{for(let n of wa){let o=n.alias.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=t.replaceAll(new RegExp(`\\bpm ${o}(?![\\w-])`,"g"),`pm ${n.canonical_argv.join(" ")}`)}return t});function vs(e){let t=N(e??"");return t?ys[t]??t:""}function bn(e){let t=vs(e);return t?ue[t]??xe:xe}function va(e,t){let n=bn(e);return{intent:n.why,examples:t==="detailed"?[...n.examples]:ya(n.examples),tips:t==="detailed"?[...n.tips??[]]:[],detail_mode:t}}function bs(){let e=W.filter(({lifecycle:n})=>n==="permanent"),t=W.filter(({lifecycle:n})=>n==="deprecated");return["","Command aliases:",...e.map(({alias:n,canonical_argv:o})=>` ${n} -> pm ${o.join(" ")}`),"","Deprecated aliases:",...t.map(n=>` ${n.alias} -> pm ${n.canonical_argv.join(" ")} (${Go(n)})`)].join(`
|
|
4
|
+
`)}function Cs(e,t,n,o){let i=new Set(Xi);e.configureHelp({visibleCommands(r){let s=t.visibleCommands(r);return n?s.filter(l=>(pe(l)??J(l.name()))!=="internal"):r!==e?s:s.filter(l=>o.has(l))},visibleOptions(r){let s=t.visibleOptions(r);return r!==e||n?s:s.filter(l=>i.has(l.flags))}});let a=e.options.filter(r=>r.long==="--output-cursor");for(let r of e.commands.flatMap(s=>[s,...s.commands]))["list","search","context"].includes(r.name())&&r.configureHelp({visibleOptions:s=>[...t.visibleOptions(s),...a]})}function xs(e,t,n,o){let i=new Set(Qi("core")),a=e.createHelp();a.prepareContext({error:!1,helpWidth:80,outputHasColors:!1});let r=()=>`${a.formatHelp(e,a)}${o}
|
|
5
|
+
`,s=t.visibleCommands(e);for(let l of s)pe(l)===void 0&&(l.name()==="help"||i.has(l.name()))&&n.add(l);for(let l of s)pe(l)==="core"&&(n.add(l),Zi(r()).within_budget||n.delete(l))}function ba(e,t=process.argv.slice(2)){let n=e.createHelp(),o=oe(t),i=new Set;Cs(e,n,o,i);let a=vn(t),r=_a(xe,a);e.addHelpText("after",r),o&&e.addHelpText("after",bs()),xs(e,n,i,r);for(let[d,m]of Object.entries(ue))wn(e,d,m,a);let s=N(A(t).commandPathTokens.join(" ")),l=Ue(s);if(l){wn(e,l.parent,{why:l.description,examples:[l.example],tips:[`Action path: pm ${l.command}`,_t(l.accepted_flags)]},a);return}let c=yt.filter(({parent:d})=>d===s);c.length>0&&wn(e,s,{why:`Dispatches one declared positional action: ${c.map(({action:d})=>d).join("|")}.`,examples:c.map(({example:d})=>d),tips:[`Inspect one action directly with pm ${s} <action> --help --json.`]},a)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2efeb172-b440-5df6-ad48-4c54087835e0")}catch{}})();function Cn(e,t=!1){e.commands.some(n=>n.name()==="ops")||e.command("ops").description("Discover workspace diagnostics and maintenance operations.");for(let{alias:n,canonical:o,canonical_argv:i}of R){if(t&&!R.some(c=>c.canonical.startsWith(`${o} `)))continue;let a=e.commands.findIndex(c=>c.name()===n);if(a<0)continue;let r=e.commands[a],s=e;for(let c of i.slice(0,-1))s!==e&&s.enablePositionalOptions(),s=s.commands.find(d=>d.name()===c)??s.command(c).description(`Discover ${c} operations.`);let l=i[i.length-1];if(s.commands.some(c=>c.name()===l))throw new Error(`Cannot install canonical command ${o}: destination already exists.`);e.commands.splice(a,1),r.name(l),kt(r,J(o)),s.enablePositionalOptions(),s.addCommand(r)}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="48b7663a-0077-53cc-bc90-d5345eebfe95")}catch{}})();function At(e){let{why:t,title:n,...o}=e;return o}var ks=new Set(["unknown_command","unknown_option","missing_required_option","missing_required_argument","invalid_argument_value","invalid_command_usage","command_failed"]);function Es(e){return!e.why||e.recovery?.recovery_mode==="compact"?!1:!ks.has(e.code)}function Sa(e){return`urn:pm-cli:error:${e}`}function C(e){return{...e,type:Sa(e.code)}}var ke={packageName:"@unbrained/pm-guide-shell",installCommand:"pm install guide-shell"},Ca={packageName:"@unbrained/pm-calendar",installCommand:"pm install calendar"},xa={packageName:"@unbrained/pm-search-advanced",installCommand:"pm install search-advanced"},Et={packageName:"@unbrained/pm-governance-audit",installCommand:"pm install audit"},Ss={guide:ke,shell:ke,completion:ke,"completion-statuses":ke,"completion-tags":ke,"completion-types":ke,templates:{packageName:"@unbrained/pm-templates",installCommand:"pm install templates"},calendar:Ca,cal:Ca,reindex:xa,"search-advanced":xa,"test-runs":{packageName:"@unbrained/pm-linked-test-adapters",installCommand:"pm install linked-test-adapters"},"comments-audit":Et,"dedupe-audit":Et,"dedupe-merge":Et,normalize:Et};function As(e){let t=e.trim().split(/\s+/)[0]?.toLowerCase();if(t)return Ss[t]}function xn(e,t){return t.length===0?[]:[e,...t.map(n=>` - ${n}`)]}function Ts(e){if(!Array.isArray(e))return;let t=e.filter(n=>typeof n=="string").map(n=>n.trim()).filter(n=>n.length>0);return t.length>0?t:void 0}function Os(e){if(!Array.isArray(e))return;let t=e.map(n=>({source:typeof n?.source=="string"?n.source.trim():"",command:typeof n?.command=="string"?n.command.trim():"",reason:typeof n?.reason=="string"?n.reason.trim():""})).filter(n=>n.source.length>0&&n.command.length>0&&n.reason.length>0);return t.length>0?t:void 0}function kn(e,t,n){typeof n=="string"&&n.trim().length>0&&(e[t]=n.trim())}function X(e,t,n){if(t==="parsed_positionals"){if(!Array.isArray(n))return;let i=n.map(a=>({role:typeof a?.role=="string"?a.role.trim():"",value:typeof a?.value=="string"?a.value.trim():""})).filter(a=>a.role.length>0&&a.value.length>0);i.length>0&&(e.parsed_positionals=i);return}let o=Ts(n);o&&(e[t]=o)}function Ee(e){if(!e||typeof e!="object")return;let t={};e.recovery_mode==="compact"&&(t.recovery_mode="compact"),kn(t,"attempted_command",e.attempted_command),X(t,"normalized_args",e.normalized_args),X(t,"parsed_positionals",e.parsed_positionals),X(t,"provided_fields",e.provided_fields),X(t,"missing",e.missing),X(t,"missing_required_fields",e.missing_required_fields),X(t,"suggested_flags",e.suggested_flags),X(t,"allowed_values",e.allowed_values),X(t,"candidate_commands",e.candidate_commands),typeof e.candidate_commands_total=="number"&&Number.isSafeInteger(e.candidate_commands_total)&&e.candidate_commands_total>=0&&(t.candidate_commands_total=e.candidate_commands_total),e.candidate_commands_truncated===!0&&(t.candidate_commands_truncated=!0),(e.option_scope==="declared_on_path"||e.option_scope==="declared_elsewhere"||e.option_scope==="declared_nowhere")&&(t.option_scope=e.option_scope),kn(t,"suggested_retry",e.suggested_retry),X(t,"suggested_retry_args",e.suggested_retry_args),typeof e.retry_after_ms=="number"&&Number.isSafeInteger(e.retry_after_ms)&&e.retry_after_ms>=0&&(t.retry_after_ms=e.retry_after_ms);let n=Os(e.fallback_candidates);return n&&(t.fallback_candidates=n),kn(t,"next_best_command",e.next_best_command),Object.keys(t).length>0?t:void 0}function En(e,t,n){n&&e.push(` ${t}: ${n}`)}function fe(e,t,n,o){n&&n.length>0&&e.push(` ${t}: ${n.join(o)}`)}function Rs(e){let t=Ee(e);if(!t)return[];let n=["Recovery bundle:"];if(En(n,"suggested_retry",t.suggested_retry),En(n,"attempted_command",t.attempted_command),fe(n,"normalized_args",t.attempted_command?void 0:t.normalized_args," "),t.parsed_positionals&&t.parsed_positionals.length>0){n.push(" parsed_positionals:");for(let o of t.parsed_positionals)n.push(` - ${o.role}: ${o.value}`)}if(fe(n,"provided_fields",t.provided_fields,", "),fe(n,"missing",t.missing,", "),fe(n,"missing_required_fields",t.missing_required_fields,", "),fe(n,"suggested_flags",t.suggested_flags,", "),fe(n,"allowed_values",t.allowed_values,", "),fe(n,"candidate_commands",t.candidate_commands,", "),typeof t.candidate_commands_total=="number"&&n.push(` candidate_commands_total: ${String(t.candidate_commands_total)}`),t.candidate_commands_truncated===!0&&n.push(" candidate_commands_truncated: true"),t.option_scope!==void 0&&n.push(` option_scope: ${t.option_scope}`),typeof t.retry_after_ms=="number"&&n.push(` retry_after_ms: ${t.retry_after_ms}`),En(n,"next_best_command",t.next_best_command),t.fallback_candidates&&t.fallback_candidates.length>0){n.push(" fallback_candidates:");for(let o of t.fallback_candidates)n.push(` - ${o.source}: ${o.command} (${o.reason})`)}return n}function Aa(e){let t=[`Error: ${e.title}`,"","What is required:",` ${e.required}`];e.nextSteps&&e.nextSteps.length>0&&(t.push(""),t.push(...xn("Next steps:",e.nextSteps))),t.push("","What happened:",` ${e.happened}`),e.why&&(t.push("","Why:"),t.push(` ${e.why}`)),e.examples&&e.examples.length>0&&(t.push(""),t.push(...xn("Examples:",e.examples))),e.verificationErrors&&e.verificationErrors.length>0&&(t.push(""),t.push(...xn("Verification errors:",e.verificationErrors)));let n=Rs(e.recovery);return n.length>0&&(t.push(""),t.push(...n)),t.join(`
|
|
6
|
+
`)}function Ta(e,t){return t.transactionOperation!==void 0&&(e.transaction_operation=t.transactionOperation),t.tombstone!==void 0&&(e.tombstone=t.tombstone,e.item_id=t.itemId),Es(t)&&(e.why=t.why),t.examples&&t.examples.length>0&&(e.examples=t.examples),t.nextSteps&&t.nextSteps.length>0&&(e.next_steps=t.nextSteps),t.verificationErrors&&t.verificationErrors.length>0&&(e.verification_errors=t.verificationErrors),t.flag!==void 0&&(e.flag=t.flag),t.value!==void 0&&(e.value=t.value),t.unmatchedSelectors!==void 0&&(e.unmatched_selectors=t.unmatchedSelectors),t.availableDependencies!==void 0&&(e.available_dependencies=t.availableDependencies),t.recovery&&(e.recovery=t.recovery),e}function Is(e,t){if(e.flag)return e.flag;let n=o=>{let i=o.split("=",1)[0];return D([i]).length>0&&!["--help","--no-changed-fields","--version"].includes(i)&&t.some(a=>a===i||a.startsWith(`${i}=`))};return[...`${e.title} ${e.happened}`.matchAll(/--[A-Za-z0-9][A-Za-z0-9_-]*/gu)].map(o=>o[0]).find(o=>n(o))}function Ps(e,t,n){if(e.value!==void 0)return e.value;if(e.flag===void 0&&n){let o=t.find(a=>a===n||a.startsWith(`${n}=`));if(o?.startsWith(`${n}=`))return o.slice(n.length+1);let i=t.indexOf(n);return t[i+1]}}function $s(e,t){if(e.policyViolations?.length)return{surface:`policy:${e.policyViolations.map(s=>s.policy_id).join(",")}`,policies:e.policyViolations,policy_violation_count:e.policyViolationCount,missing_fields:[...new Set(e.policyViolations.flatMap(s=>s.missing_fields))],exit_code:t};let n=D(e.recovery?.normalized_args??[]),o=q(n),i=o?[o.alias,...n.slice(o.canonical_argv.length)]:n,a=Is(e,i),r=Ps(e,i,a);return{surface:a??e.recovery?.missing?.[0]??hn(i)??"command",...r!==void 0?{rejected_value:r}:{},...e.recovery?.allowed_values?.length?{legal_domain:e.recovery.allowed_values}:{},exit_code:t}}function Ds(e,t){return Ta({type:e.type,code:e.code,title:e.title,detail:e.happened,required:e.required,exit_code:t,refusal:$s(e,t)},e)}function An(e,t){let n=e.recovery,o=!!n?.suggested_retry||!!n?.suggested_retry_args?.length||!!n?.allowed_values?.length||!!n?.candidate_commands?.length||!!e.nextSteps?.length;return ui(Ds(e,t),{diagnosticClass:o?"recovery_bundle":"error"})}function Tn(e){return Ta({type:e.type,code:e.code,title:e.title,detail:e.happened,required:e.required},e)}function Tt(e){return e.replace(/\(outputHelp\)/g,"").trim()}function Ns(e){let t=e.toLowerCase();return t.includes("cannot find module")||t.includes("cannot find package")||t.includes("err_module_not_found")||t.includes("module_not_found")}function ge(e){if(!Array.isArray(e))return;let t=e.map(n=>n.trim()).filter(n=>n.length>0);return t.length>0?t:void 0}function ka(e){let t=new Set,n=[];for(let o of e)t.has(o)||(t.add(o),n.push(o));return n}function Ms(e){return hn(e?.normalized_args)}function Fs(e){let t=e.match(/\bmust be one of:?\s+([A-Za-z0-9_.|,\- ]+)/i);return t?t[1].split(/[|,]/).map(n=>n.trim()).filter(n=>/^[A-Za-z0-9_.-]+$/.test(n)):[]}function Ls(e,t){let n=e?.normalized_args,o=e?.provided_fields,i=t[0];if(!(!Array.isArray(n)||!Array.isArray(o)||!i))for(let a of o){let r=n.findIndex(s=>s===a);if(r>=0&&r<n.length-1&&!n[r+1]?.startsWith("-")){let s=[...n];return s[r+1]=i,x(s)}}}function js(e){let t=e.split(/\r?\n/)[0].trim();if(t.length!==0)return t.length<=120?t:`${t.slice(0,117)}...`}function St(e,t){return typeof e=="string"&&e.trim().length>0?e.trim():t}function Us(e,t){if(e.flag!==void 0)return e.flag;if(e.field===void 0)return;let n=e.field.startsWith("--")?e.field:`--${e.field.replaceAll(/([A-Z])([A-Z][a-z])/gu,"$1-$2").replaceAll(/([a-z0-9])([A-Z])/gu,"$1-$2").replaceAll("_","-").toLowerCase()}`;return t?.normalized_args?.some(o=>o===n||o.startsWith(`${n}=`))?n:void 0}function ie(e,t,n){if(!n)return e;let o=Tt(t),i=St(n.code,e.code),a=St(n.type,Sa(i)),r=ge(n.examples)??e.examples,s=ge(n.nextSteps)??e.nextSteps,l=ge(n.verification_errors)??e.verificationErrors,c=e.code==="command_failed"&&n.code?js(o):void 0,d=Ee(n.recovery),m=d&&e.recovery?Ee({...e.recovery,...d}):d??e.recovery;return{...e,code:i,type:a,title:c??e.title,happened:o.length>0?o:e.happened,required:St(n.required,e.required),why:St(n.why,e.why),examples:r,nextSteps:s,verificationErrors:l,policyViolations:n.policy_violations,policyViolationCount:n.policy_violation_count,flag:Us(n,m)??e.flag,value:n.value??e.value,unmatchedSelectors:n.unmatched_selectors,itemId:n.item_id,transactionOperation:n.transaction_operation,tombstone:n.tombstone,availableDependencies:n.available_dependencies,recovery:m}}function qs(e,t,n){let o=t.match(/^Tracker is not initialized at (.+)\. (?:Run pm init first|Tracker root does not exist\. Run pm init first)\.$/);if(!o)return null;let i=o[1],a=Jo(process.cwd(),i);return ie(C(a?{code:"tracker_not_initialized",title:"Tracker exists at a custom path",happened:`pm did not find initialized metadata at ${i}, but found a tracker at ${a}.`,required:"Select the existing tracker root explicitly.",why:"Implicit discovery checks the default .agents/pm layout and ancestor root-layout trackers, while custom nested roots require an explicit path.",examples:[`pm --pm-path ${a} <command>`,`PM_PATH=${a} pm <command>`],nextSteps:[`Re-run with "--pm-path ${a}" or export PM_PATH=${a}.`]}:{code:"tracker_not_initialized",title:"Tracker is not initialized",happened:`pm data path does not contain initialized tracker metadata (${o[1]}).`,required:"Select an existing tracker with --pm-path/PM_PATH, or initialize the default .agents/pm storage.",why:"Most commands require settings in an explicitly selected root, an ancestor root-layout tracker, or the default .agents/pm directory.",examples:["pm init","pm init acme"],nextSteps:['Run "pm init", then rerun your original command.']}),e,n)}function Hs(e,t,n){let o=t.match(/^Item ([^ ]+) not found$/);if(!o)return null;let i=o[1],a=/^(undefined|null|<.*>|\[.*\]|{.*}|)$/.test(i),r=a?`The item ID "${i}" looks like a placeholder or unresolved variable. Ensure the ID argument is resolved before calling pm.`:`No item with id "${i}" exists in the active tracker scope.`;return ie(C({code:"item_not_found",title:"Item ID not found",flag:"id",value:i,happened:r,required:"Use an existing item ID from current tracker data.",why:"Mutation and read commands operate only on known IDs.",examples:["pm list --status open --limit 20",'pm search "<keyword>" --limit 10'],nextSteps:a?["Check that the variable holding the item ID is defined before passing it to pm.",'Use "pm list --status open --limit 20" to find valid IDs.']:["Confirm the active --path/PM_PATH scope, then retry with a valid id."]}),e,n)}function zs(e,t,n){return!t.includes("is assigned to")||!t.includes("Use --force to override")?null:ie(C({code:"ownership_conflict",title:"Ownership conflict",happened:t,required:"Run as the assigned owner, claim the item when appropriate, or use --force only for an approved override.",why:"Ownership checks prevent accidental concurrent mutations on claimed items and protect against conflicting writes.",examples:["pm claim pm-a1b2","pm update pm-a1b2 --status in_progress --force"],nextSteps:["Use --force for approved systematic metadata updates performed by leads or maintainers.","Use --force when correcting known stale metadata after coordinating ownership changes.",'For non-terminal reassignment, prefer "pm claim <ID>" before running other mutations.']}),e,n)}function Gs(e,t,n){return t.includes("is locked")?ie(C({code:"lock_conflict",title:"Lock conflict",happened:t,required:"Wait for lock release, or use --force where supported if lock is stale and safe to override.",why:"Locking protects item files from concurrent write races.",examples:["pm update pm-a1b2 --status in_progress --force"]}),e,n):null}function Ws(e,t,n){let o=t.match(/^Missing required option /),i=t.match(/^Missing required options /);if(!o&&!i)return null;let a=!!i,r=a?null:t.replace(/^Missing required option\s+/,"").trim(),s=r??"",l=r?`Pass ${r} with a valid value before running the command.`:"Provide the required option for this command invocation.";return ie(C({code:"missing_required_option",title:a?"Missing required options":`Missing required option ${s}`,happened:t,required:a?"Provide every required option for this command invocation.":l,why:"Required options define command intent and enforce deterministic write contracts.",examples:['pm create --title "Task title" --description "Task details" --type Task --create-mode progressive','pm create --title "Task title" --description "Task details" --type Task --status open --priority 1 --message "Create task" --dep "id=pm-epic01,kind=parent,created_at=now" --comment "created_at=now,text=Why this task exists." --note "created_at=now,text=Initial implementation note." --learning "created_at=now,text=Durable lesson placeholder." --file "path=src/example.ts,scope=project" --test "command=node scripts/run-tests.mjs test,scope=project,timeout_seconds=240" --doc "path=README.md,scope=project"'],nextSteps:['Run "pm <command> --help" to view required and recommended flags.',"For staged triage without placeholder linkage values, use --create-mode progressive."]}),e,n)}function Vs(e,t,n){return t.startsWith("No update flags provided")?ie(C({code:"no_update_fields",title:"No update fields supplied",happened:"The update command was called without any field-changing flags.",required:"Provide at least one field-changing flag such as --status, --priority, --title, --tags, --description, or --body. Use --message only to label a real mutation.",why:"pm update mutates existing item fields; no-op invocations are rejected to avoid ambiguous history.",examples:['pm update pm-a1b2 --status in_progress --message "Start implementation"','pm update pm-a1b2 --description "Clarified implementation scope" --message "Clarify task intent"','pm append pm-a1b2 --body "Detailed progress notes" --message "Append progress notes"'],nextSteps:["Choose the item field you intend to change, then pair that change with --message for history context.","Use pm comments, pm notes, pm learnings, or pm append when you only need to add narrative context."]}),e,n):null}function Bs(e,t,n){if(!t.startsWith("Invalid ")&&!t.includes(" must be ")&&!t.includes(" requires "))return null;let o=Ee(n?.recovery),i=Ms(o),a=i?`pm ${i} --help`:"pm <command> --help",r=Fs(t),s=Ee({...o,allowed_values:o?.allowed_values??r}),l=Ls(o,r),c=l?[l,a]:[a,"pm contracts --command <command> --flags-only --json"],d=r.length>0?[`Allowed values: ${r.join("|")}`,`Run "${a}" to confirm command-specific constraints.`]:["Check allowed values in command help, then rerun with corrected input."];return ie(C({code:"invalid_argument_value",title:"Invalid argument value",happened:t,required:"Use values that match documented command constraints.",why:"Validation protects data consistency and deterministic behavior across commands.",examples:c,nextSteps:d,recovery:s}),e,n)}function On(e,t){let n=Tt(e);return(qs(e,n,t)??Hs(e,n,t)??zs(e,n,t)??Gs(e,n,t)??Ws(e,n,t)??Vs(e,n,t)??Bs(e,n,t))||ie(C({code:"command_failed",title:"Command failed",happened:n,required:"Adjust command input or tracker state and retry.",why:"pm enforces explicit, deterministic contracts for data and command semantics.",examples:["pm --help","pm <command> --help"]}),e,t)}function Ks(e,t,n){return e==="create"&&t.startsWith("--type")?[`pm create --title "Example title" --description "Example description" --type ${n.split("|")[0]||"Task"} --status open --priority 1 --message "Create item" --create-mode progressive`]:e==="update"?['pm update pm-a1b2 --status in_progress --message "Start implementation"']:[`pm ${e??"<command>"} --help`]}function Js(e){let t=e.trim();return t.match(/--[A-Za-z0-9][A-Za-z0-9_-]*/)?.[0]??t}function Ys(e){if(!(!Array.isArray(e)||e.length===0))return x(e)}function Rn(e){if(!Array.isArray(e))return;let t=e.map(n=>n.trim()).filter(n=>n.length>0);return t.length>0?t:void 0}function U(e,t={}){let n=Rn(e?.providedOptionFlags),o=Array.isArray(e?.normalizedInvocationArgs)&&e?.normalizedInvocationArgs.length>0?e.normalizedInvocationArgs:void 0,i=typeof e?.attemptedCommand=="string"?e.attemptedCommand:Ys(o),a=typeof e?.suggestedRetryCommand=="string"?e.suggestedRetryCommand:void 0;return Ee({attempted_command:i,normalized_args:o,provided_fields:n,suggested_retry:a,suggested_retry_args:e?.suggestedRetryArgs,...t})}function Sn(e,t){return!t||e.includes(t)?e:[...e,t]}var Xs=new Set(["--add","--add-json","--remove"]),Zs=new Set(["command","cmd","path"]);function Qs(e){if(Array.isArray(e))for(let t of e){if(!t.startsWith("--"))continue;let n=t.indexOf("="),o=n>=0?t.slice(0,n):t;if(Xs.has(o))return o}}function el(e){if(!Array.isArray(e))return;let t=e.indexOf("test");if(t<0)return;let n=e[t+1];if(!(typeof n!="string"||n.startsWith("-")))for(let o=t+2;o<e.length;o+=1){let i=e[o];if(i!=="--add"&&i!=="--remove")continue;let a=e[o+1];if(typeof a!="string"||!Zs.has(a))return;let r=[];for(let c=o+2;c<e.length;c+=1){let d=e[c];if(d.startsWith("--")&&d.length>2)break;r.push(d)}if(r.length<2)return;let s=`${a}=${r.join(" ")}`,l=[...e.slice(0,o+1),s,...e.slice(o+2+r.length)];return x(l)}}function tl(e,t,n,o){let i=e.match(/required option '([^']+)' not specified/);if(!i)return null;let a=Js(i[1]),r=a.startsWith("--type"),s=o?.suggestedRetryCommand,l=Rn(o?.providedOptionFlags),c=[a],d=Ks(t,a,n),m=s?Sn(d,s):d,p=r?[`Allowed type values: ${n}`,`Run "pm ${t??"create"} --help --type <value>" for type-aware policy details.`]:[`Run "pm ${t??"<command>"} --help" for required option guidance.`],u=s?Sn(p,`Replay with preserved arguments: ${s}`):p,f=l&&l.length>0?Sn(u,`Already provided options: ${l.join(", ")}`):u;return C({code:"missing_required_option",title:`Missing required option ${a}`,happened:`Commander rejected the command because ${a} was not provided.`,required:`Pass ${a} with a valid value before running the command.`,why:r?"--type selects item contract and policy routing, including required/disabled option rules.":"Required flags define mandatory command intent and prevent ambiguous execution.",examples:m,nextSteps:f,recovery:U(o,{missing:c})})}function nl(e,t,n){let o=e.match(/missing required argument '([^']+)'/);if(!o)return null;let i=o[1];return C({code:"missing_required_argument",title:`Missing required argument ${i}`,happened:`Command invocation omitted positional argument ${i}.`,required:`Provide ${i} in the expected command position.`,why:"Positional arguments identify the target entity or action context for the command.",examples:[`pm ${t??"<command>"} --help`],recovery:U(n,{missing:[i]})})}function ol(e,t,n){return C({code:"unsupported_update_option",title:`Unsupported option ${e} for update`,happened:`pm update does not accept ${e} for linked artifact mutations.`,required:"Use dedicated linked-artifact commands instead of pm update for files/docs changes.",why:"pm update manages scalar item metadata, while linked files/docs are managed by pm files and pm docs.",examples:['pm files pm-a1b2 --add "path=src/cli/main.ts,scope=project,note=implementation surface"','pm docs pm-a1b2 --add "path=README.md,scope=project,note=user-facing contract"'],nextSteps:['Run "pm files --help" and "pm docs --help" for add/remove payload formats.'],recovery:U(t,{suggested_flags:n})})}var il={declared_elsewhere:"Use an option declared on this path, or move the declared option to one of its accepting command paths.",declared_on_path:"Use the option with the value and syntax declared by this command path.",declared_nowhere:"Use a declared option on this command path; this spelling exists nowhere in the command lexicon."};function al(e){let t=ge(e.unknownOptionOtherCommands)??[];return{otherCommands:t,optionScope:e.unknownOptionScope??(t.length>0?"declared_elsewhere":"declared_nowhere"),candidateTotal:e.unknownOptionOtherCommandsTotal??t.length}}function rl(e,t,n,o,i){let a=o.otherCommands.slice(0,3),r=o.candidateTotal-a.length,s=r>0?` and ${String(r)} more command path(s)`:"";return["Run command help to confirm the exact option contracts for this command path.",n.length?`Nearest supported options: ${n.join(", ")}`:void 0,a.length?`${e} is accepted by ${a.join(", ")}${s}. Inspect those command contracts only if you intended a different operation.`:void 0,o.optionScope==="declared_nowhere"?`${e} is not declared on any command path. Use a nearest supported option on ${t??"the attempted command"}, or inspect that command's help.`:void 0,i?`Replay with suggested correction: ${i}`:void 0].filter(l=>typeof l=="string")}function sl(e,t){if(["--dry-run","--check","--check-only","--plan","--preview"].includes(t.split("=",1)[0]))return{};if(e.suggestedRetryCommand!==void 0)return{retryCommand:e.suggestedRetryCommand};if(sa(t))return{};let n=e.normalizedInvocationArgs;if(n===void 0)return{};if(n.filter(a=>a===t||a.startsWith(`${t}=`)).length!==1)return{};let o=n.findIndex(a=>a===t||a.startsWith(`${t}=`));if(o<0||n.includes("--")||!n[o]?.includes("=")&&o!==n.length-1&&n[o+1]?.startsWith("-")!==!0)return{};let i=D(n.filter((a,r)=>r!==o));return{retryCommand:x(i),suggestedRetryArgs:i}}function ll(e,t,n){let o=e.match(/unknown option '([^']+)'/);if(!o)return null;let i=n??{},a=o[1],r=Rn(i.unknownOptionSuggestions)??[],{retryCommand:s,suggestedRetryArgs:l}=sl(i,a);if(t==="update"&&(a==="--file"||a==="--doc"))return ol(a,n,r);let c=al(i),d=rl(a,t,r,c,s);["--dry-run","--check","--check-only","--plan","--preview"].includes(a.split("=",1)[0])&&d.push("The requested preview is unavailable on this path. Inspect the item with a read-only command or use a command that declares this option; do not replay this mutation without preview intent.");let m=[s,t?`pm ${H(t)?.canonical??t} --help`:"pm --help --all"].filter(p=>typeof p=="string");return C({code:"unknown_option",title:`Unknown option ${a}`,happened:`Commander does not recognize option ${a} for this command path.`,required:il[c.optionScope],why:"Option contracts are command-specific and intentionally validated.",flag:a,value:a,examples:m,nextSteps:d,recovery:U(n,{suggested_flags:r.length>0?r:void 0,suggested_retry:s,suggested_retry_args:l,candidate_commands:c.otherCommands,candidate_commands_total:c.candidateTotal||void 0,candidate_commands_truncated:i.unknownOptionOtherCommandsTruncated,option_scope:c.optionScope})})}function cl(e,t,n,o,i){let a=`"${e}" is provided by the ${t.packageName} package. Install it with: ${t.installCommand}`,r=o.filter(s=>!s.endsWith(`: ${t.installCommand}`));return C({code:"unknown_command",title:`Unknown command ${e}`,happened:`pm does not expose command path "${e}" in current runtime configuration. It is shipped by the optional ${t.packageName} package.`,required:`Install the ${t.packageName} package, or use a valid command name or subcommand path.`,why:"Command registry includes core commands plus active extension command handlers; package-provided commands appear only after the package is installed.",examples:ka([t.installCommand,...n]),nextSteps:ka([a,...r]),recovery:U(i)})}function dl(e,t){let n=e.match(/unknown command '([^']+)'/);if(!n)return null;let o=n[1],i=ge(t?.unknownCommandExamples),a=ge(t?.unknownCommandNextSteps),r=As(o),s=i??["pm --help"],l=a??["Verify spelling and active extensions, then rerun."],c=new Set(t?.failedExtensions?.map(m=>m.name.trim().toLowerCase())),d=r?.packageName.replace(/^@unbrained\/pm-/,"").toLowerCase();return r&&(!d||!c.has(d))?cl(o,r,s,l,t):C({code:"unknown_command",title:`Unknown command ${o}`,happened:`pm does not expose command path "${o}" in current runtime configuration.`,required:"Use a valid command name or subcommand path.",why:"Command registry includes core commands plus active extension command handlers.",examples:s,nextSteps:l,recovery:U(t)})}function ml(e){let t=e?.unknownSubcommandPath?.trim(),n=e?.unknownSubcommandToken?.trim(),o=ge(e?.unknownSubcommandAllowedValues);if(!t||!n||!o)return null;let i=e?.suggestedRetryCommand;return C({code:"unknown_subcommand",title:`Unknown ${t} subcommand ${n}`,value:n,happened:`The positional token sequence "${n}" is not a declared ${t} subcommand.`,required:`Use one of: ${o.join(", ")}.`,why:"Subcommands are single positional tokens; multi-word action names use hyphens.",examples:[...i?[i]:[],`pm ${H(t)?.canonical??t} --help`],nextSteps:i?[`Retry with the declared hyphenated action: ${i}`]:["Choose one value from recovery.allowed_values."],recovery:U(e,{allowed_values:o,suggested_retry:i})})}function pl(e,t,n){if(!/too many arguments/i.test(e)||t!=="test")return null;let o=n?.normalizedInvocationArgs,i=Qs(o);if(!i)return null;let a=el(o);return C({code:"linked_test_value_not_quoted",title:`Linked-test ${i} value must be one argument`,happened:`Commander saw extra positional tokens after the item id \u2014 usually a ${i} value containing spaces (for example a command with " -- ") that the shell split into multiple tokens.`,required:`Quote the whole ${i} value as a single argument. Accepted forms: --add "command=npm test -- parser", --add command "npm test -- parser" (two-token form with the value quoted), or --add-json for complex commands.`,why:"The shell splits unquoted values before pm can see them, so pm cannot reassemble the intended command unambiguously.",examples:[...a?[a]:[],'pm test pm-a1b2 --add "command=npm test -- parser"','pm test pm-a1b2 --add command "npm test -- parser"',`pm test pm-a1b2 --add-json '{"command":"npm test -- parser"}'`],nextSteps:[...a?[`Replay with the value re-joined into one argument: ${a}`]:[],"Prefer --add-json for commands containing commas, equals signs, or quotes.",'Run "pm test --help" for linked-test entry contracts.'],recovery:U(n,a?{suggested_retry:a}:{})})}var ul=new Set(["comments","docs","files","learnings","notes","test"]);function fl(e,t,n){if(!/too many arguments/i.test(e)||!ul.has(t??""))return null;let o=n?.normalizedInvocationArgs??[],i=o.findIndex(c=>c===t),a=o[i+1],r=o[i+2],s=n?.verifiedCollectionItemId?.trim();if(a?.toLowerCase()!=="add"||!r||r.startsWith("-")||!s||s.toLowerCase()!==r.toLowerCase())return null;let l=`pm ${t} ${s} --add <value>`;return C({code:"collection_transposed_subcommand",title:`Transposed ${t} add syntax`,happened:`The positional token "add" occupied the item-id role and "${s}" occupied the next positional role. pm ${t} does not use an add subcommand.`,required:`Place the item id immediately after ${t}, then use --add for the value.`,why:"Collection mutations use object-first grammar: pm <collection> <item-id> --add <value>.",examples:[l,`pm ${t} --help`],recovery:U(n,{parsed_positionals:[{role:"transposed_subcommand",value:a},{role:"item_id",value:s}],suggested_retry:l})})}var gl=new Set(["--activity-limit","--assignee","--assignee-filter","--date","--depth","--fields","--format","--from","--limit","--parent","--path","--pm-path","--priority","--release","--section","--sprint","--stale-threshold","--tag","--to","--type"]),Ea=new Set(["context","ctx"]);function hl(e,t,n){if(!/too many arguments/i.test(e)||!Ea.has(t??""))return null;let o=n?.normalizedInvocationArgs??[],i=o.findIndex(c=>Ea.has(c)),a=i===-1?1:i+1,r=e.match(/got \d+:\s*(\S+)/i),s=r?r[1].replace(/\.$/,""):void 0;if(s===void 0){let c=!1;for(let d of o.slice(a)){if(c){c=!1;continue}let m=d.split("=")[0];if(gl.has(m)){c=!d.includes("=");continue}if(!d.startsWith("-")){s=d;break}}}if(!s)return null;let l=`pm get ${s}`;return C({code:"context_takes_no_item_argument",title:"pm context takes no item argument",happened:`pm context renders a workspace-level snapshot and received the positional argument "${s}".`,required:`Use ${l} for one item's full details, or pm context --parent ${s} to scope the snapshot to that item's subtree.`,why:"Item-level detail (pm get) and workspace-level context (pm context) are separate projections.",examples:[l,`pm context --parent ${s}`],recovery:U(n,{suggested_retry:l})})}function In(e,t,n,o){let i=Tt(e);return(tl(i,t,n,o)??nl(i,t,o)??ll(i,t,o)??dl(i,o)??ml(o)??fl(i,t,o)??pl(i,t,o)??hl(i,t,o))||C({code:"invalid_command_usage",title:"Invalid command usage",happened:i,required:"Use the command with valid arguments and options.",why:"Commander validates CLI contracts before execution.",examples:["pm --help",`pm ${t??"<command>"} --help`],recovery:U(o)})}function Oa(e,t){let n=On(e,t);return(t?.code==="tracker_root_missing"||t?.code==="tracker_not_initialized")&&n.title==="Tracker is not initialized"&&n.recovery?.suggested_retry_args?[`Error: ${n.title}`,`Run: ${x(n.recovery.suggested_retry_args)}`,"Use --json for full recovery details."].join(`
|
|
7
|
+
`):nn(Aa(n),n.required).output}function Ra(e,t){return Tn(On(e,t))}function Pn(e,t,n){return An(On(e,n),t)}function Ia(e,t,n,o){let i=In(e,t,n,o);return nn(Aa(i),i.required).output}function $n(e,t,n,o){return Tn(In(e,t,n,o))}function Ot(e,t,n,o,i){return An(In(e,t,n,i),o)}function Pa(e,t){let n=$a(e);return An(n,t)}function $a(e){let t=Tt(e);return Ns(t)?C({code:"module_import_failed",title:"Module import failed",happened:t,required:"Ensure the active checkout is built and any package or extension entry file exists before retrying.",why:"Node could not resolve an imported module. In pm this usually means an extension/package entrypoint, build artifact, or dependency is missing from the active runtime.",examples:["pnpm build","pm package manage --doctor --project","pm health --check-only --json"],nextSteps:["Rebuild the checkout or package that provides the missing module.","Run package doctor for installed extensions when the failure follows package installation or activation.","Rerun the original pm command after the runtime files are present."]}):C({code:"unknown_error",title:"Unhandled error",happened:t,required:"Inspect command input and runtime state, then retry.",why:"Unexpected runtime failures can occur from environment or extension-level issues.",examples:["pm --help","pm health --json"]})}function Da(e){return Tn($a(e))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="4647d40c-70a2-5ffe-a91f-d43e9c522114")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f3c73e79-571d-5a1b-94cd-db8c1b8ca7a4")}catch{}})();var We=Bo.join("|"),yl={calendar:"calendar",cal:"calendar",reindex:"search-advanced","search-advanced":"search-advanced",guide:"guide-shell",completion:"guide-shell",templates:"templates","test-runs":"linked-test-adapters",beads:"beads",todos:"todos"},_l={comments:{"--body":["--add"],"--text":["--add"],"--comment":["--add"]},notes:{"--body":["--add"],"--text":["--add"],"--note":["--add"]},learnings:{"--body":["--add"],"--text":["--add"],"--learning":["--add"]},update:{"--add-tag":["--add-tags"],"--remove-tag":["--remove-tags"],"--tag":["--tags"]},create:{"--add-tag":["--add-tags"],"--tag":["--tags"]}},Na=["add-field","add-status","add-type","apply-preset","list","list-fields","remap-status","remove-field","remove-status","remove-type","rename-field","rename-type","show","show-field","show-status"];function wl(e,t){let n=_l[e];if(!n)return[];let o=j(t);for(let[i,a]of Object.entries(n))if(j(i)===o)return a;return[]}function Dn(e,t,n){if(n.length===0)return e;if(t){let r=n.find(d=>d.declared_command_match===!0),{token_accounting:s,...l}=JSON.parse(e),c={...l,...r?{extension_command_failure:{code:"extension_command_activation_failed",extension:r.name,layer:r.layer,error:r.error,recovery_commands:r.recovery_commands??[]}}:{},failed_extensions:n};return JSON.stringify(s===void 0?c:ce(c,d=>`${JSON.stringify(d,null,2)}
|
|
8
8
|
`),null,2)}let o=n.map(r=>`- ${r.layer}:${r.name}: ${r.error}`).join(`
|
|
9
|
-
`),
|
|
9
|
+
`),i=n.find(r=>r.declared_command_match===!0);if(!i)return`${e}
|
|
10
10
|
Extension activation failures:
|
|
11
|
-
${o}`;let
|
|
12
|
-
`);return`Extension command unavailable: ${
|
|
13
|
-
${
|
|
11
|
+
${o}`;let a=(i.recovery_commands??[]).map(r=>`- ${r}`).join(`
|
|
12
|
+
`);return`Extension command unavailable: ${i.layer}:${i.name}
|
|
13
|
+
${i.error}${a.length>0?`
|
|
14
14
|
Recovery:
|
|
15
|
-
${
|
|
15
|
+
${a}`:""}
|
|
16
16
|
|
|
17
17
|
${e}
|
|
18
18
|
Extension activation failures:
|
|
19
|
-
${o}`}function
|
|
20
|
-
`||n==="\r"||n==="\f"||n==="\v")break;t+=n}return t}function
|
|
21
|
-
`):l,null,2)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e57ce782-5c73-5c74-a929-0971a990a355")}catch{}})();async function
|
|
19
|
+
${o}`}function Nn(e){return A(e).commandPathTokens[0]??k(e)??"<command>"}function ja(e,t){let n=new Set,o=[...e.commands];for(;o.length>0;){let i=o.shift();if(!i)continue;let a=N(E(i)),r=a.split(" ").some(s=>s.startsWith("_"));a.length>0&&!r&&n.add(a),o.push(...i.commands)}for(let i of t.keys()){let a=N(i),r=a.split(" ").some(s=>s.startsWith("_"));a.length>0&&!r&&n.add(a)}return[...n].sort((i,a)=>i.localeCompare(a))}function Ma(e,t){let n=e.trim().toLowerCase(),o=t.trim().toLowerCase();if(o.length===0)return Number.POSITIVE_INFINITY;let i=n.split(" ");if(n===o)return 0;if(i.includes(o))return 1;if(i.some(s=>s.startsWith(o)))return 2;if(n.includes(o))return 3;let a=o.length>=5?2:1,r=Number.POSITIVE_INFINITY;for(let s of i){let l=Qt(s,o,a);l!==null&&(r=Math.min(r,l))}return Number.isFinite(r)?4+r:Number.POSITIVE_INFINITY}function Fa(e){return j(e).slice(2).replace(/-/g,"")}function Mn(e){return x(e)}function vl(e){let t=H(e)?.canonical??Jt[e]??e,n=t.split(" ")[0]?.trim().toLowerCase();if(!n)return null;let o=yl[n];return o?{packageAlias:o,canonicalPath:t,installCommand:`pm package install ${o} --project`}:null}function La(e){let t=ta(e);for(let n of["@unbrained/","builtin-","pm-"])t.startsWith(n)&&(t=t.slice(n.length));return t}function bl(e,t){let n=La(e);if(n.length===0)return[];let o=[];for(let i of t.values()){let a=new Set,r=i.source;if(r)for(let s of[r.name,r.package]){let l=La(s??"");l.length>0&&a.add(l)}a.size!==0&&[...a].some(s=>s===n||s.includes(n)||n.includes(s))&&o.push(i.command)}return[...new Set(o)].sort((i,a)=>i.localeCompare(a))}function Ve(e,t){let n=new Set,o=t??ne(e);for(let i of o){i.flag.startsWith("--")&&n.add(j(i.flag));for(let a of i.aliases??[])a.startsWith("--")&&n.add(j(a))}return[...n].sort((i,a)=>i.localeCompare(a))}function Cl(e,t){if(!e.startsWith("--"))return[];let n=Fa(e);if(n.length===0)return[];let o=n.length>=8?2:1,i=[];for(let a of t){let r=Fa(a);if(r===n)continue;if(n.length>=3&&r.startsWith(n)){i.push({flag:a,rank:0,distance:r.length-n.length});continue}let s=Qt(n,r,o);s===null||s<=0||i.push({flag:a,rank:1,distance:s})}return i.sort((a,r)=>a.rank!==r.rank?a.rank-r.rank:a.distance!==r.distance?a.distance-r.distance:a.flag.localeCompare(r.flag)).map(a=>a.flag).slice(0,3)}var Rt,xl=new Set(["ctx","packages","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled","start-task","pause-task","close-task","help"]);function kl(){if(Rt)return Rt;let e=new Map;for(let t of Me)if(!xl.has(t))for(let n of Ve(t)){let o=e.get(n)??[];o.push(t),e.set(n,o)}return Rt=e,Rt}function El(e,t){if(!e.startsWith("--"))return[];let n=kl().get(j(e));if(!n)return[];let o=t?.trim().toLowerCase(),i=new Set(Ve(o));return[...new Set(n.filter(a=>a!==o).map(a=>({command:a,sharedFlagCount:Ve(a).filter(r=>i.has(r)).length})).sort((a,r)=>a.sharedFlagCount!==r.sharedFlagCount?r.sharedFlagCount-a.sharedFlagCount:a.command.localeCompare(r.command)).map(({command:a})=>H(a)?.canonical??a))]}function Sl(e,t,n){for(let o=0;o<e.length;o+=1){let i=e[o];if(!i.startsWith("--"))continue;let a=i.indexOf("="),r=a>=0?i.slice(0,a):i;if(j(r)!==j(t))continue;let s=[...e];return s[o]=a>=0?`${n}${i.slice(a)}`:n,s}}function Al(e){let t=new Set(e.commandPaths),n=a=>Math.min(Ma(a,e.normalizedUnknown),e.primaryToken!==e.normalizedUnknown?Ma(a,e.primaryToken):Number.POSITIVE_INFINITY),o=new Map,i=(a,r)=>{if(!Number.isFinite(r)||!t.has(a))return;let s=o.get(a);(s===void 0||r<s)&&o.set(a,r)};for(let a of e.commandPaths)i(a,n(a));for(let[a,r]of Object.entries(Jt))a!=="read"&&i(r,n(a));return[...o.entries()].sort(([a,r],[s,l])=>r!==l?r-l:a.localeCompare(s)).map(([a])=>a)}function Tl(e){let t=H(e.normalizedUnknown),n=ma(e.commandPaths,e.primaryToken),o=Al(e),i=bl(e.primaryToken,e.extensionDescriptors).filter(a=>e.commandPaths.includes(a));return yn([...t&&e.commandPaths.includes(t.canonical)?[t.canonical_argv.join(" ")]:[],...n,...o,...i],e.commandPaths,e.primaryToken).filter(a=>!e.normalizedUnknown.includes(" ")||a!==e.normalizedUnknown)}function Ol(e){return[...new Set(e.map(t=>t.split(" ")[0]).filter(t=>t.length>0))].sort((t,n)=>t.localeCompare(n))}function Rl(e,t){let n=e.map(o=>`pm ${o} --help`);return t?[...new Set([...n,"pm --help --all"])]:[...new Set(["pm --help --all",...n])]}function Il(e,t,n){let o=K([...t]),i=[];for(;o!==void 0;){if(i.push(t[o]),t[o]===e)return i.join(" ");if(!n.includes(i.join(" ")))return e;let a=K(t.slice(o+1));o=a===void 0?void 0:o+1+a}return e}function Pl(e,t){if(!e)return;let n=M([...t]);return[...n.path?["--pm-path",S(process.cwd(),n.path)]:[],...n.noExtensions?["--no-extensions"]:[],...e.split(" "),"--help"]}function Fn(e,t,n,o=[]){let i=e.match(/unknown command '([^']+)'/i);if(!i||typeof i[1]!="string")return;let a=ja(t,n),r=Il(i[1],o,a),s=N(r);if(s.length===0||a.length===0)return;let l=vl(s);if(l&&!a.includes(l.canonicalPath.split(" ")[0]))return{unknownCommandExamples:[l.installCommand,`pm ${l.canonicalPath} --help`,"pm --help --all"],unknownCommandNextSteps:[`"${s}" is provided by the "${l.packageAlias}" package. Install it with: ${l.installCommand}. Command after installation: pm ${l.canonicalPath}.`],suggestedRetryCommand:l.installCommand};let c=s.split(" ")[0],d=Tl({commandPaths:a,normalizedUnknown:s,primaryToken:c,extensionDescriptors:n}),m=Ol(a),p=da(s,a),u=Pl(p,o),f=[...new Set([...p?[p]:[],...d.length>0?d:yn(m,a)])].slice(0,3),h=Rl(f,d.length>0),w=d.length>0?`Did you mean: ${f.join(", ")}?`:null;return{...u?{suggestedRetryCommand:x(u),suggestedRetryArgs:u}:{},unknownCommandExamples:u?[x(u),...h.slice(1)]:h,unknownCommandNextSteps:[...w?[w]:[],'Run "pm --help --all" to list every command available in this runtime, including active extensions.',...w?["Use one of the suggested command paths above with --help to inspect valid flags and usage."]:[]]}}function $l(e){return Array.from(new Set(e))}function Dl(e){let t="";for(let n of e){if(n===" "||n===" "||n===`
|
|
20
|
+
`||n==="\r"||n==="\f"||n==="\v")break;t+=n}return t}function Nl(e){let t=e.length;for(;t>0;){let n=e[t-1];if(n!==","&&n!==":"&&n!==";")break;t-=1}return e.slice(0,t)}function Ml(e,t){let n=t.trim().toLowerCase();return e.commands.find(o=>o.name().trim().toLowerCase()===n?!0:(typeof o.aliases=="function"?o.aliases():[]).some(i=>i.trim().toLowerCase()===n))}function Se(e,t){if(t.length===0)return!0;let n=e;for(let[o,i]of t.entries()){let a=Ml(n,i);if(!a){let r=n.registeredArguments;return r.length>0&&(n.commands.length===0||r[0]?.required===!0)&&(r.at(-1)?.variadic===!0||t.length-o<=r.length)}n=a}return!0}async function Fl(e,t,n,o){try{let i=S(process.cwd(),e.path);if(!await V(B(i)))return{allowedTypes:We};let a=await P(i),r=e.noExtensions?void 0:se(),s=re(a,r),l;if(/too many arguments/i.test(t)&&["comments","docs","files","learnings","notes","test"].includes(o??"")){let c=n.findIndex(m=>m===o),d=n[c+2];if(n[c+1]?.toLowerCase()==="add"&&d!==void 0&&!d.startsWith("-"))try{l=(await ht(i,d,a.id_prefix,a.item_format,s.type_to_folder))?.id}catch{}}return{allowedTypes:s.types.length>0?s.types.join("|"):We,pmRoot:i,settings:a,typeToFolder:s.type_to_folder,verifiedCollectionItemId:l}}catch{return{allowedTypes:We}}}function Ll(e,t){let n=e.match(/unknown option '([^']+)'/i),o=n&&t?$l([...wl(t,n[1]),...Cl(n[1],Ve(t))]).filter(r=>la(n[1],r)):void 0,i=n?El(n[1],t):[],a=n!==null&&Ve(t).includes(j(n[1]));return{match:n,suggestions:o,otherCommands:i,scope:a?"declared_on_path":i.length>0?"declared_elsewhere":"declared_nowhere"}}function jl(e,t,n){if(!t||!n||n.length===0)return;let o=Sl(e,t[1],n[0]);return o?Mn(o):void 0}function Ul(e,t){let n=e.match(/required option '([^']+)' not specified/i),o=n?.[1]?Nl(Dl(n[1].trim())):void 0;if(!o?.startsWith("--"))return;let i=k(t);if(i)return ca(t,i,[o])}function ql(e,t){if(!/too many arguments/i.test(e))return;let n=K(t),o=q(t.slice(n));if(o?.alias!=="schema")return;let i=n+o.canonical_argv.length-1,a=t[i+1]?.trim().toLowerCase(),r=t[i+2]?.trim().toLowerCase();if(!a||!r)return;let s=`${a}-${r}`;if(!Na.includes(s))return;let l=[...t.slice(0,i+1),s,...t.slice(i+3)];return{unknownSubcommandPath:"schema",unknownSubcommandToken:`${a} ${r}`,unknownSubcommandAllowedValues:[...Na],suggestedRetryCommand:Mn(l)}}function Hl(e,t,n,o){let i=K(t),a=q(t.slice(i))?.alias??k(t);if(!/unknown option /i.test(e)||a===void 0)return a;let r=H(a)?.canonical??a;return Me.some(s=>s===a)||ja(n,o).includes(r)?a:void 0}async function Be(e,t,n,o={},i=process.argv.slice(2)){let a=(typeof e=="object"&&e!==null?e.message:void 0)??"Invalid command usage",r=He([...i]).argv,s=M(r),l=Hl(a,r,t,n),c=Mn(r),d=Y(r),m=await Fl(s,a,r,l),p=m.allowedTypes,u=Fn(a,t,n,r),f=Ll(a,l),h=ql(a,r),w=h?.suggestedRetryCommand??jl(r,f.match,f.suggestions)??Ul(a,r);return{message:a,commandName:l,allowedTypes:p,attemptedCommand:c,normalizedInvocationArgs:[...r],providedOptionFlags:d,unknownOptionSuggestions:f.suggestions,unknownOptionOtherCommands:f.otherCommands.length>0?f.otherCommands.slice(0,12):void 0,unknownOptionOtherCommandsTotal:f.otherCommands.length>0?f.otherCommands.length:void 0,unknownOptionOtherCommandsTruncated:f.otherCommands.length>12||void 0,unknownOptionScope:f.scope,suggestedRetryCommand:w,verifiedCollectionItemId:m.verifiedCollectionItemId,...h,...u,...o}}async function Ln(e,t,n,o={},i=process.argv.slice(2)){let a=await Be(e,t,n,o,i),{message:r,commandName:s,allowedTypes:l,...c}=a,d=Ia(r,s,l,c),m=await pi("help_format",{message:d,command:s,allowed_types:l});return m.handled&&typeof m.result=="string"?m.result:d}async function jn(e,t,n,o=!1,i={},a=process.argv.slice(2)){let r=await Be(e,t,n,i,a),s=Ot(r.message,r.commandName,r.allowedTypes,g.USAGE,r),l=o?At(s):s,c=M(r.normalizedInvocationArgs).tokenAccounting===!0;return JSON.stringify(c?ce(l,d=>`${JSON.stringify(d,null,2)}
|
|
21
|
+
`):l,null,2)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e57ce782-5c73-5c74-a929-0971a990a355")}catch{}})();async function Ua(e,t,n,o){if(n)return null;let i=e.some(r=>r==="--for"||r.startsWith("--for=")),a=k(e)==="contracts"&&e.includes("--full");return i||a?await o(t):null}import{Option as zl}from"commander";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c077f66e-bac4-58af-92cd-a19c30ada04d")}catch{}})();function v(e){return e.trim().toLowerCase().split(/\s+/).filter(t=>t.length>0).join(" ")}function Ha(e,t){let n=new Map;for(let o of e){let i=v(o.command);for(let a of t){if(a.layer!==o.layer||a.name!==o.name)continue;let r=v(a.command),s=r.split(" "),l=s.at(-1),c=s.slice(1).join(" "),d=c?`${s[0]}-${l} ${c}`:`${s[0]}-${l}`;if(l&&i===d){n.set(i,r);break}}}return n}function Un(e,t,n,o){if(!t||!n)return;let i,a=0;for(let[s,l]of e.entries()){if(l!==t)continue;let c=e.slice(s);for(let[d,m]of o.entries()){let p=d.split(" ");p.length>a&&p.every((u,f)=>c[f]===u)&&(i=m,a=p.length)}}let r=i?.flags.find(s=>s.long===n||s.short===n);if(r)return Gl(r).takesValue}function Ke(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function Ae(e){return typeof e=="boolean"?e:void 0}function Gl(e){let t=dt(e);return{takesValue:t.value_arity!=="none",valueName:t.value_name}}function Wl(e){let t=ee(e.long);if(!t||!t.startsWith("--")||t.length<3)return null;let n=qn(e);if(!n)return null;let o=Ke(e.description)??"Extension-provided option.",i=[];Ae(e.required)===!0&&i.push("required"),Ae(e.enabled)===!1&&i.push("disabled");let a=i.length>0?` [${i.join(", ")}]`:"";return`${n} ${o}${a}`}function za(e){let t=[...new Set(e.map(Wl).filter(n=>n!==null))].sort((n,o)=>n.localeCompare(o));return t.length===0?null:`
|
|
22
22
|
Extension-provided flags:
|
|
23
23
|
${t.join(`
|
|
24
|
-
`)}`}function
|
|
24
|
+
`)}`}function Ga(e){let t=new Map;for(let i of e){let a=v(i.target_command);if(a.length===0)continue;let r=t.get(a)??[];r.push(...i.flags),t.set(a,r)}let n=[...t.entries()].sort(([i],[a])=>i.localeCompare(a)),o=new Map;for(let[i,a]of n){let r=za(a);r&&o.set(i,r)}return o}function Wa(e,t){return typeof t!="string"||t.trim().length===0?e.replace(/\s+/g,"-"):t.trim().toLowerCase()}function qa(e){if(!Array.isArray(e))return[];let t=[],n=new Set;for(let o of e){if(typeof o!="string")continue;let i=o.trim();i.length===0||n.has(i)||(n.add(i),t.push(i))}return t}function Vl(e){return Array.isArray(e)?e.map(t=>{let n=typeof t.name=="string"?t.name.trim():"";if(n.length===0)return null;let o={name:n,required:t.required===!0,variadic:t.variadic===!0};return typeof t.description=="string"&&t.description.trim().length>0&&(o.description=t.description.trim()),o}).filter(t=>t!==null):[]}function Bl(e){let t=new Map;for(let n of e){let o=v(n.command);if(o.length===0)continue;let i=typeof n.description=="string"&&n.description.trim().length>0?n.description.trim():void 0,a=typeof n.intent=="string"&&n.intent.trim().length>0?n.intent.trim():void 0;t.set(o,{command:o,action:Wa(o,n.action),description:i,intent:a,examples:qa(n.examples),failure_hints:qa(n.failure_hints),arguments:Vl(n.arguments),flags:[],tier:n.tier??"standard",family:n.family??"extensions",source:{layer:n.layer,name:n.name,package:n.source_package}})}return t}function Kl(e){let t=new Map;for(let n of e){let o=v(n.target_command);if(o.length===0)continue;let i=t.get(o)??[];i.push(...n.flags),t.set(o,i)}return t}function Jl(e,t,n){let o=new Set;for(let i of e){let a=v(i);a.length>0&&o.add(a)}for(let i of t.keys())o.add(i);for(let i of n.keys())o.add(i);return o}function Yl(e,t,n){let o=n.get(e);return o?t.get(o):void 0}function Va(e,t,n,o=new Map){let i=Bl(t),a=Kl(n),r=Jl(e,i,a),s=new Map,l=[...r].sort((c,d)=>c.localeCompare(d));for(let c of l){let d=Yl(c,i,o)??i.get(c),m=a.get(c)??(d?a.get(d.command):void 0)??[];if(d){s.set(c,{...d,command:c,flags:m});continue}s.set(c,{command:c,action:Wa(c,void 0),examples:[],failure_hints:[],arguments:[],flags:m,tier:"standard",family:"extensions"})}return s}function Xl(e){let t=e.variadic?"...":"";return e.required?`<${e.name}${t}>`:`[${e.name}${t}]`}function Ba(e,t){for(let n of t.arguments)e.argument(Xl(n),n.description??"Extension argument.")}function Zl(e){if(Ae(e.visible)===!1)return null;let t=ee(e.long),n=Ke(e.short),o=n&&n.startsWith("-")&&!n.startsWith("--")?n:null,i=t&&t.startsWith("--")&&t.length>2?t:null,a=[o,i].filter(r=>r!==null);return a.length>0?a:null}function qn(e){let t=Zl(e);if(!t)return null;let{value_name:n,value_arity:o}=dt(e),i=n?o==="optional"?` [${n}]`:` <${n}>`:"";return`${t.join(", ")}${i}`}function Ql(e){return qn(e)}function Ka(e){let t=Ke(e.description)??"Extension-provided option.",n=[];Ae(e.required)===!0&&n.push("required"),Ae(e.enabled)===!1&&n.push("disabled");let o=n.length>0?` [${n.join(", ")}]`:"";return`${t}${o}`}function Ja(e,t){let n=ee(t.long),o=Ke(t.short);return e.options.some(i=>{let a=i;return n!==null&&a.long===n||o!==null&&a.short===o})}function Hn(e,t){for(let n of t){if(Ja(e,n))continue;let o=Ql(n);if(!o)continue;let i=Ka(n),a=new zl(o,i);if(a.negate=!1,n.list!==!0){e.addOption(a);continue}e.addOption(a.argParser((r,s=[])=>[...Array.isArray(s)?s:[s],r]))}}function zn(e,t){return za(t.filter(n=>!Ja(e,n)))}function ec(e){let t=qn(e);if(!t)return null;let n=ee(e.long),o=Ke(e.short),i=n&&n.startsWith("--")&&n.length>2?n:null,a=o&&o.startsWith("-")&&!o.startsWith("--")?o:null,r=dt(e),s=Ae(e.required)===!0;return{flags:t,long:i,short:a,description:Ka(e),takes_value:r.value_arity!=="none",value_required:r.value_arity==="required",value_name:r.value_name,variadic:!1,required:s,aliases:[],alias_for:null}}function Ya(e){if(!e)return[];let t=[],n=new Set;for(let o of e.flags){let i=ec(o);!i||n.has(i.flags)||(n.add(i.flags),t.push(i))}return t}function Xa(e,t){if(t.length===0)return e;let n=[...e],o=new Set(e.map(i=>i.flags));for(let i of t)o.has(i.flags)||(o.add(i.flags),n.push(i));return n}function Za(e){let t=[];if(e.intent&&t.push(`Intent: ${e.intent}`),e.action&&t.push(`Action contract: ${e.action}`),e.examples.length>0){t.push("Examples:");for(let n of e.examples)t.push(` - ${n}`)}if(e.failure_hints.length>0){t.push("Common failure hints:");for(let n of e.failure_hints)t.push(` - ${n}`)}return t.length===0?null:`
|
|
25
25
|
Extension command metadata:
|
|
26
26
|
${t.join(`
|
|
27
|
-
`)}`}function Vn(e){let t=e;if(typeof t.aliases=="function")return t.aliases().map(n=>n.trim().toLowerCase()).filter(n=>n.length>0);if(typeof t.alias=="function"){let n=t.alias();if(typeof n=="string"&&n.trim().length>0)return[n.trim().toLowerCase()]}return Array.isArray(t._aliases)?t._aliases.map(n=>n.trim().toLowerCase()).filter(n=>n.length>0):[]}function Je(e,t){let n=t.trim().toLowerCase();return e.commands.find(o=>o.name().trim().toLowerCase()===n?!0:Vn(o).includes(n))??null}function Z(e,t){let n=e;for(let o of t){let a=Je(n,o);if(!a)return null;n=a}return n}var Bn=new WeakSet;function er(e,t){if(t.length===0)return null;let n=e;for(let o=0;o<t.length;o+=1){let a=t[o];o>0&&R.some(s=>s.canonical===t.join(" "))&&n.enablePositionalOptions();let i=Je(n,a);if(i){n=i;continue}let r=n.command(a);Bn.add(r),o<t.length-1?(r.description("Extension-provided command group."),r.action(()=>{r.help()})):r.description("Extension-provided command path."),n=r}return n}function tc(e,t){let n=t.join(" "),o=R.find(r=>n===r.canonical||n.startsWith(`${r.canonical} `));if(o)return{core_path:o.canonical,extension_path:n};let a=e,i=[];for(let r of t){let s=Je(a,r);if(!s)return null;i.push(r);let l=s.commands.length>0||R.some(c=>c.canonical.startsWith(`${i.join(" ")} `));if(!Bn.has(s)&&(i.length===t.length||!l))return{core_path:i.join(" "),extension_path:t.join(" ")};a=s}return null}function nc(e,t,n,o,a=!1){let i=t.split(" ").filter(d=>d.length>0),r=tc(e,i),s=Z(e,i),l=R.some(d=>d.canonical===t&&d.alias===o?.action&&!e.commands.some(m=>m.name()===d.alias)&&(s===null||Bn.has(s)));if(!r||r.core_path===t&&s!==null&&!n.has(t)&&!a||l&&!n.has(t))return null;let c=o?.source?.package??o?.source?.name??"unknown-extension";return`extension_command_collision:${r.extension_path}:core_owner=pm-cli:${r.core_path}:extension_owner=${c}`}function tr(e,t,n,o,a){return[...new Set([...t,...n.keys()])].filter(i=>i.trim().length>0).sort((i,r)=>i.localeCompare(r)).filter(i=>{let r=nc(e,i,o,n.get(i),t.includes(i));return r?(a(r),!o.has(i)&&Z(e,i.split(" "))!==null):!0})}function nr(e,t,n){e.push(n),t(`[pm] warning: ${n}; core command preserved. Rename or namespace the extension command alias.`)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0e7ed11b-0194-53e5-8b2d-d7d91f295b8a")}catch{}})();var oc=new Set(["__proto__","prototype","constructor"]),or=Symbol("looseOptionOccurrences");function Ye(e){return e.trim().toLowerCase().replaceAll(/-([a-z0-9])/g,(t,n)=>n.toUpperCase())}function ac(e,t,n){let o=e[t];if(o===void 0){e[t]=n;return}if(Array.isArray(o)){o.push(n),e[t]=o;return}e[t]=[o,n]}function Kn(e,t){let n=e[t];if(!n.startsWith("-")||n==="-"||n==="--")return null;if(!n.startsWith("--")){let r=n.indexOf("=");if(r>=0)return{consumed:1,key:n.slice(1,r).trim(),value:n.slice(r+1)};let s=n.slice(1).trim(),l=e[t+1];return typeof l=="string"&&!l.startsWith("-")?{consumed:2,key:s,value:l}:{consumed:1,key:s,value:!0}}let o=n.indexOf("=");if(o>=0)return{consumed:1,key:n.slice(2,o).trim(),value:n.slice(o+1)};if(n.startsWith("--no-"))return{consumed:1,key:n.slice(5).trim(),value:!1};let a=n.slice(2).trim(),i=e[t+1];return typeof i=="string"&&!i.startsWith("-")?{consumed:2,key:a,value:i}:{consumed:1,key:a,value:!0}}function Pt(e){return oc.has(e)}function ar(e){let t=(typeof e.value_type=="string"?e.value_type:void 0)??(typeof e.type=="string"?e.type:void 0);return mt(t)}function Xe(e){let t=[],n=ee(e.long)??"",o=typeof e.short=="string"?e.short.trim():"";if(n.startsWith("--")){let a=Ye(n.slice(2));a.length>0&&!Pt(a)&&t.push(a)}if(o.startsWith("-")&&!o.startsWith("--")){let a=Ye(o.slice(1));a.length>0&&!Pt(a)&&t.push(a)}return[...new Set(t)]}function ir(e){let t=new Set;for(let n of e)for(let o of Xe(n))t.add(o);return t}function ic(e){let t=ee(e.long)??"";if(t.startsWith("--")){let n=Ye(t.slice(2));if(n.length>0&&!Pt(n))return n}return Xe(e)[0]??null}function rc(e){let t=typeof e.long=="string"?e.long.trim():"";if(t.startsWith("--")&&t.length>2)return t;let n=typeof e.short=="string"?e.short.trim():"";return n.startsWith("-")&&!n.startsWith("--")&&n.length>1?n:null}function Jn(e,t,n){if(t.length===0)return;let o=new Set,a=new Map,i=[],r=[];for(let s of t){let l=Xe(s),c=rc(s);c!==null&&r.push(c);for(let d of l)o.add(d),s.enabled===!1&&a.set(d,c);s.required===!0&&s.enabled!==!1&&l.length>0&&i.push({keys:l,label:c})}for(let s of Object.keys(e)){if(!o.has(s)){let c=r.length>0?` Expected one of: ${[...new Set(r)].join(", ")}.`:"";throw new b(`Unknown option '--${s}' for extension command '${n}'.${c}`,g.USAGE)}let l=a.get(s);if(l)throw new b(`Option '${l}' is disabled for extension command '${n}'.`,g.USAGE)}for(let s of i)if(!s.keys.some(l=>Object.hasOwn(e,l)))throw new b(`Missing required option '${s.label}' for extension command '${n}'.`,g.USAGE)}function sc(e){return typeof e=="string"||e==null?e:String(e)}function lc(e){if(typeof e=="number")return e;if(typeof e=="string"&&e.trim().length>0){let t=Number(e);return Number.isFinite(t)?t:e}return e}function cc(e){if(typeof e=="boolean")return e;if(typeof e=="string"){let t=e.trim().toLowerCase();if(t==="true"||t==="1")return!0;if(t==="false"||t==="0")return!1}return e}var dc={string:sc,number:lc,boolean:cc};function $t(e,t){return Array.isArray(e)?e.map(n=>$t(n,t)):dc[t](e)}function rr(e,t,n){let o=n?(Array.isArray(e)?e.flat(1/0):[e]).filter(a=>a!=null&&a!==""):ea(e);return t?o.map(a=>$t(a,t)):o}function mc(e,t,n,o){return n?rr(e,t,o):t?$t(e,t):e}function pc(e,t,n){let o=e[or];if(!o||o.length===0)return n;let a=new Set(t);return o.filter(i=>a.has(i.key)).map(i=>i.value)}function sr(e,t,n=e){if(t.length===0)return e;let o=Object.create(null);for(let[a,i]of Object.entries(e))o[a]=i;for(let a of t){let i=ic(a);if(!i)continue;let r=a.list===!0,s=Xe(a);for(let d of s)if(!(d===i||!Object.hasOwn(o,d))){if(Object.hasOwn(o,i)){if(!r){delete o[d];continue}let m=o[i],p=o[d];o[i]=[...Array.isArray(m)?m:[m],...Array.isArray(p)?p:[p]].filter(u=>u!=null),delete o[d];continue}o[i]=o[d],delete o[d]}let l=ar(a),c=a.repeatable===!0;if(!Object.hasOwn(o,i)){a.default!==void 0&&(o[i]=mc(a.default,l,r,c));continue}if(r){o[i]=rr(pc(n,s,o[i]),l,c);continue}l&&(o[i]=$t(o[i],l))}return o}function lr(e){let t=Object.create(null),n=[];Object.defineProperty(t,or,{value:n});let o=0;for(;o<e.length;){let a=Kn(e,o);if(!a){o+=1;continue}let i=Ye(a.key);if(i.length===0||Pt(i)){o+=a.consumed;continue}ac(t,i,a.value),n.push({...a,key:i}),o+=a.consumed}return t}function cr(e){let t=[],n=0;for(;n<e.length;){if(e[n]==="--"){t.push(...e.slice(n+1));break}let o=Kn(e,n);if(o){n+=Math.max(1,o.consumed);continue}t.push(e[n]),n+=1}return t}function Yn(e,t){if(t.length===0)return[...e];let n=new Set,o=new Set;for(let r of t){let s=ar(r);for(let l of Xe(r))n.add(l),s==="boolean"&&o.add(l)}if(n.size===0)return[...e];let a=[],i=0;for(;i<e.length;){if(e[i]==="--"){a.push(...e.slice(i+1));break}let r=Kn(e,i);if(r){let s=Ye(r.key);if(n.has(s)){let l=e[i],c=o.has(s)&&!l.includes("=")?1:r.consumed;i+=c;continue}}a.push(e[i]),i+=1}return a}import Oe from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="4a2291ff-7618-518c-8bff-e9aa0e2f8af2")}catch{}})();async function Xn(e,t={},n=[]){let o={readSettings:P,loadExtensions:Le,activateExtensions:je,resolveImplicitPmRoot:Qt,...t};try{let a=await o.readSettings(e),i=await o.loadExtensions({pmRoot:e,settings:a,cwd:process.cwd(),noExtensions:!1}),r=await o.activateExtensions(i);return[...i.failed,...r.failed].map(s=>{let l=(i.effective??[]).find(p=>p.layer===s.layer&&p.name===s.name),c=[...l?.contributions?.commands??[],...l?.contributions?.command_handlers??[],...l?.activation?.commands??[]].map(D).filter((p,u,f)=>p.length>0&&f.indexOf(p)===u).sort((p,u)=>p.localeCompare(u)),d=n.map(D),m=c.some(p=>d.some(u=>u===p||u.startsWith(`${p} `)));return{layer:s.layer,name:s.name,error:s.error,...c.length>0?{declared_commands:c}:{},...m?{declared_command_match:!0,recovery_commands:["pm package doctor --project --detail deep","pm package install <package-or-path> --project"]}:{}}})}catch(a){return[{layer:"runtime",name:"extension-loader",error:a instanceof Error?a.message:String(a)}]}}async function dr(e,t,n={},o=[]){if(e!=="unknown_command")return[];let a=await Xn(t,n,o),i={readSettings:P,loadExtensions:Le,activateExtensions:je,resolveImplicitPmRoot:Qt,...n};try{let r=i.resolveImplicitPmRoot(process.cwd());if(Oe.resolve(r)===Oe.resolve(t))return a;let[s,l]=await Promise.all([i.readSettings(t),i.readSettings(r)]),[c,d]=await Promise.all([i.loadExtensions({pmRoot:t,settings:s,cwd:process.cwd(),noExtensions:!1}),i.loadExtensions({pmRoot:r,settings:l,cwd:process.cwd(),noExtensions:!1})]),m=new Set(c.loaded.flatMap(u=>u.activation?.commands??[])),p=[...new Set(d.loaded.flatMap(u=>u.activation?.commands??[]))].filter(u=>!m.has(u)).sort((u,f)=>u.localeCompare(f));if(p.length===0)return a;a.push({layer:"runtime",name:"extension-root-relocation",error:`storage_root=${Oe.resolve(t)} extension_discovery_root=${c.roots.project}; cwd_storage_root=${Oe.resolve(r)} cwd_extension_discovery_root=${d.roots.project}; the selected --pm-path runtime is missing ${p.length} workspace command path(s): ${p.slice(0,8).join(", ")}${p.length>8?", ...":""}. --pm-path selects extension discovery as well as item storage; omit it, point --pm-path at ${Oe.resolve(r)}, or install the extension into the selected tracker with "pm --pm-path ${Oe.resolve(t)} install <package> --project".`})}catch{}return a}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3f896a8d-2c03-5f9c-9909-4684a187870d")}catch{}})();var mr={core:0,standard:1,full:2,internal:3};function pr(e,t,n=!0){let o=t.get(I(e));if(o)return o;if(!n)return;let a=[...t.entries()].filter(([s])=>s.startsWith(`${e} `)).map(([,s])=>s);if(a.length===0)return;let i=a.reduce((s,l)=>mr[l.tier]<mr[s]?l.tier:s,"internal"),r=new Set(a.map(({family:s})=>s));return{tier:i,family:r.size===1?a[0].family:"extensions"}}function ur(e,t){if(t.length===0)return e;let n=Z(e,t);if(n)return n;let o=t.join(" ");if(I(o)!==o||!Fe.some(a=>a===o)&&!Ia(o)&&!qe(o)&&!Te(e,t))return null;for(let a=t.length-1;a>0;a-=1){let i=Z(e,t.slice(0,a));if(i)return i}return t.length===1?e:null}function uc(e){let t=e.match(/[<[]([^>\]]+)[>\]]/);if(!t)return null;let n=t[1]?.trim();return n&&n.length>0?n:null}function fr(e){let t=e;if(typeof t.attributeName=="function"){let n=t.attributeName();return typeof n=="string"&&n.trim().length>0?n.trim():null}return typeof t.attributeName=="string"&&t.attributeName.trim().length>0?t.attributeName.trim():null}function fc(e){let t=new Map;for(let n of e){let o=n,a=fr(n);if(!a||typeof o.long!="string"||o.long.trim().length===0)continue;let i=t.get(a)??[];i.push(o.long.trim()),t.set(a,i)}for(let[n,o]of t.entries())t.set(n,[...new Set(o.map(a=>a.trim()).filter(a=>a.length>0))].sort((a,i)=>a.localeCompare(i)));return t}function gc(e){return x(e)}function hc(e){let t=e.options??[],n=fc(t);return t.map(o=>{let a=o,i=typeof a.flags=="string"?a.flags.trim():"",r=typeof a.description=="string"?a.description.trim():"",s=fr(o),l=(s?n.get(s)??[]:[]).filter(h=>h!==a.long).map(h=>h.trim()).filter(h=>h.length>0),c=r.match(/^Alias for ([^ ]+)/i),d=c&&c[1]?c[1].trim():null,m=a.mandatory===!0||r.includes("[required]")||r.toLowerCase().includes("required;"),p=i.includes("<"),u=p||i.includes("["),f={flags:i,long:typeof a.long=="string"?a.long:null,short:typeof a.short=="string"?a.short:null,description:r,takes_value:u,value_required:p,value_name:uc(i),variadic:a.variadic===!0,required:m,aliases:l,alias_for:d};return a.defaultValue!==void 0&&(f.default_value=a.defaultValue),f})}function yc(e){let t=new Map,n=[];for(let o of e){if(o.alias_for&&o.long){n.push(o);continue}o.long&&t.set(o.long,o)}for(let o of n){let a=o.alias_for,i=t.get(a);if(!i)continue;let r=o.long,s=new Set([...i.aliases??[],r]);i.aliases=[...s].sort((l,c)=>l.localeCompare(c))}return e.filter(o=>!o.alias_for||!o.long?!0:!t.has(o.alias_for))}function _c(e){let t=e;return(Array.isArray(t.registeredArguments)?t.registeredArguments:Array.isArray(t._args)?t._args:[]).map(n=>{let o=typeof n.name=="function"?n.name():typeof n.name=="string"?n.name:"argument",a=typeof n.description=="string"&&n.description.trim().length>0?n.description.trim():null;return{name:o.trim(),required:n.required===!0||a?.toLowerCase().startsWith("required;")===!0,variadic:n.variadic===!0,description:a}})}function wc(e,t=new Map,n=!1){let o=e.createHelp().visibleCommands(e);return(n?[...new Set([...o,...e.commands])]:o).filter(a=>a.name()!=="help"||e.parent===null).filter(a=>!n||(fe(a)??J(a.name()))!=="internal").map(a=>{let i=D(E(a)),r=i,s=fe(a),l=pr(i,t,s!==void 0),c=W.find(({alias:d})=>d===i);return{name:a.name().trim(),aliases:Vn(a),description:a.description().trim(),tier:l?.tier??s??J(r),family:l?.family??bt(r),...c?{alias_for:c.canonical,alias_lifecycle:c.lifecycle,...c.lifecycle==="deprecated"?{deprecated:!0}:{}}:{}}}).sort((a,i)=>a.name.localeCompare(i.name))}function vc(e,t,n){if(!n)return t;let o=n.examples??[],a=n.failure_hints??[];return{intent:n.intent??n.description??t.intent,examples:e==="detailed"?o.length>0?[...o]:[...t.examples]:o.length>0?[o[0]]:[...t.examples],tips:e==="detailed"?a.length>0?[...a]:[...t.tips]:[],detail_mode:e}}function bc(e,t,n,o,a){let i=e!==void 0&&Cn(e)===Ee,r=i?{intent:t,examples:[`pm ${e} --help`],tips:[],detail_mode:n}:bi(e,n),s=a?"positional_action":o?.intent||o?.description?"extension":i?t?"command_description":"unavailable":e?"help_bundle":"root_help_bundle";return{narrative:vc(n,r,o),intentSource:s}}function Cc(e,t){return e===void 0?null:t?.tier??J(e)}function xc(e,t){return e===void 0?null:t?.family??bt(e)}function kc(e,t,n){if(!(t!==e||!n))return W.map(o=>({alias:o.alias,canonical:o.canonical,canonical_argv:[...o.canonical_argv],available:ur(e,o.canonical.split(" "))!==null,lifecycle:o.lifecycle,hidden:o.hidden,deprecated:o.lifecycle==="deprecated"}))}function Ec(e,t,n,o,a=new Map,i=!1){if(!e){let s=_c(t),l=wc(t,a,i),c=new Set(l.map(({name:d})=>d));return{arguments:s,options:o,subcommands:[...l,..._t.filter(({parent:d,action:m})=>d===n&&!c.has(m)).map(({action:d,description:m})=>({name:d,aliases:[],description:m,tier:J(n.split(" ")[0]),family:bt(n.split(" ")[0])}))].sort((d,m)=>d.name.localeCompare(m.name)),usage:[n,s.reduce((d,m)=>m.required?d.replace(`[${m.name}${m.variadic?"...":""}]`,`<${m.name}${m.variadic?"...":""}>`):d,t.usage())].filter(d=>d.length>0).join(" ")}}let r=new Set(e.accepted_flags);return{arguments:e.slots.map(({name:s,required:l,variadic:c,value_kind:d,polymorphic:m})=>({name:s,required:l,variadic:c,description:m?`Polymorphic ${d} value; inspect the action contract before mutation.`:`${d.replaceAll("_"," ")} value.`})),options:o.filter(({long:s,aliases:l})=>s!==null&&r.has(s)||l.some(c=>r.has(c))),subcommands:[],usage:[e.command,...e.slots.map(({name:s,required:l,variadic:c})=>{let d=c?`${s}...`:s;return l?`<${d}>`:`[${d}]`})].join(" ")}}function Sc(e,t,n,o,a){let i=bn(n),r=oe(n),s=D(E(t)),l=D(o.join(" ")),c=l.length>s.length?l:s,d=qe(c),m=d?.command??s,p=m.length>0?m:void 0,u=p,f=p?a.get(I(p)):void 0,h=p?pr(p,a,fe(t)!==void 0):void 0,{narrative:w,intentSource:$}=bc(p,t.description().trim(),i,f,d!==void 0),z=yc(Zi(hc(t),Xi(f))),Q=Ec(d,t,m,z,a,r),G=kc(e,t,r);return{format:"pm_help_v1",detail_mode:i,root_command:e.name(),requested_path:o,resolved_path:m.length>0?m:e.name(),visibility_tier:Cc(u,h),capability_family:xc(u,h),description:d?.description??t.description(),usage:Q.usage,intent:d?.description??w.intent,intent_source:$,examples:d?[d.example]:w.examples,tips:d?[wt(d.accepted_flags)]:w.tips,arguments:Q.arguments,options:Q.options,subcommands:Q.subcommands,has_subcommands:Q.subcommands.length>0,...G===void 0?{}:{command_aliases:G}}}async function gr(e,t,n,o=t){let a=M(t);if(!a.json)return!1;let i=A(t);if(!i.requested)return!1;let r=ur(e,i.commandPathTokens);if(!r){if(!a.quiet){let s=`unknown command '${i.commandPathTokens.join(" ")}'`,l=Ln(s,e,n,t),c=Rt(s,"help",Ve,g.USAGE,{...l,attemptedCommand:gc(t),normalizedInvocationArgs:[...t],providedOptionFlags:Y(t)}),d=a.tokenAccounting?me(c,m=>`${JSON.stringify(m,null,2)}
|
|
28
|
-
`):c;
|
|
29
|
-
`)}return process.exitCode=g.USAGE,!0}if(!
|
|
27
|
+
`)}`}function Gn(e){let t=e;if(typeof t.aliases=="function")return t.aliases().map(n=>n.trim().toLowerCase()).filter(n=>n.length>0);if(typeof t.alias=="function"){let n=t.alias();if(typeof n=="string"&&n.trim().length>0)return[n.trim().toLowerCase()]}return Array.isArray(t._aliases)?t._aliases.map(n=>n.trim().toLowerCase()).filter(n=>n.length>0):[]}function Je(e,t){let n=t.trim().toLowerCase();return e.commands.find(o=>o.name().trim().toLowerCase()===n?!0:Gn(o).includes(n))??null}function Z(e,t){let n=e;for(let o of t){let i=Je(n,o);if(!i)return null;n=i}return n}var Wn=new WeakSet;function Qa(e,t){if(t.length===0)return null;let n=e;for(let o=0;o<t.length;o+=1){let i=t[o];o>0&&R.some(s=>s.canonical===t.join(" "))&&n.enablePositionalOptions();let a=Je(n,i);if(a){n=a;continue}let r=n.command(i);Wn.add(r),o<t.length-1?(r.description("Extension-provided command group."),r.action(()=>{r.help()})):r.description("Extension-provided command path."),n=r}return n}function tc(e,t){let n=t.join(" "),o=R.find(r=>n===r.canonical||n.startsWith(`${r.canonical} `));if(o)return{core_path:o.canonical,extension_path:n};let i=e,a=[];for(let r of t){let s=Je(i,r);if(!s)return null;a.push(r);let l=s.commands.length>0||R.some(c=>c.canonical.startsWith(`${a.join(" ")} `));if(!Wn.has(s)&&(a.length===t.length||!l))return{core_path:a.join(" "),extension_path:t.join(" ")};i=s}return null}function nc(e,t,n,o,i=!1){let a=t.split(" ").filter(d=>d.length>0),r=tc(e,a),s=Z(e,a),l=R.some(d=>d.canonical===t&&d.alias===o?.action&&!e.commands.some(m=>m.name()===d.alias)&&(s===null||Wn.has(s)));if(!r||r.core_path===t&&s!==null&&!n.has(t)&&!i||l&&!n.has(t))return null;let c=o?.source?.package??o?.source?.name??"unknown-extension";return`extension_command_collision:${r.extension_path}:core_owner=pm-cli:${r.core_path}:extension_owner=${c}`}function er(e,t,n,o,i){return[...new Set([...t,...n.keys()])].filter(a=>a.trim().length>0).sort((a,r)=>a.localeCompare(r)).filter(a=>{let r=nc(e,a,o,n.get(a),t.includes(a));return r?(i(r),!o.has(a)&&Z(e,a.split(" "))!==null):!0})}function tr(e,t,n){e.push(n),t(`[pm] warning: ${n}; core command preserved. Rename or namespace the extension command alias.`)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0e7ed11b-0194-53e5-8b2d-d7d91f295b8a")}catch{}})();var oc=new Set(["__proto__","prototype","constructor"]),nr=Symbol("looseOptionOccurrences");function Ye(e){return e.trim().toLowerCase().replaceAll(/-([a-z0-9])/g,(t,n)=>n.toUpperCase())}function ic(e,t,n){let o=e[t];if(o===void 0){e[t]=n;return}if(Array.isArray(o)){o.push(n),e[t]=o;return}e[t]=[o,n]}function Vn(e,t){let n=e[t];if(!n.startsWith("-")||n==="-"||n==="--")return null;if(!n.startsWith("--")){let r=n.indexOf("=");if(r>=0)return{consumed:1,key:n.slice(1,r).trim(),value:n.slice(r+1)};let s=n.slice(1).trim(),l=e[t+1];return typeof l=="string"&&!l.startsWith("-")?{consumed:2,key:s,value:l}:{consumed:1,key:s,value:!0}}let o=n.indexOf("=");if(o>=0)return{consumed:1,key:n.slice(2,o).trim(),value:n.slice(o+1)};if(n.startsWith("--no-"))return{consumed:1,key:n.slice(5).trim(),value:!1};let i=n.slice(2).trim(),a=e[t+1];return typeof a=="string"&&!a.startsWith("-")?{consumed:2,key:i,value:a}:{consumed:1,key:i,value:!0}}function It(e){return oc.has(e)}function or(e){let t=(typeof e.value_type=="string"?e.value_type:void 0)??(typeof e.type=="string"?e.type:void 0);return Zo(t)}function Xe(e){let t=[],n=ee(e.long)??"",o=typeof e.short=="string"?e.short.trim():"";if(n.startsWith("--")){let i=Ye(n.slice(2));i.length>0&&!It(i)&&t.push(i)}if(o.startsWith("-")&&!o.startsWith("--")){let i=Ye(o.slice(1));i.length>0&&!It(i)&&t.push(i)}return[...new Set(t)]}function ir(e){let t=new Set;for(let n of e)for(let o of Xe(n))t.add(o);return t}function ac(e){let t=ee(e.long)??"";if(t.startsWith("--")){let n=Ye(t.slice(2));if(n.length>0&&!It(n))return n}return Xe(e)[0]??null}function rc(e){let t=typeof e.long=="string"?e.long.trim():"";if(t.startsWith("--")&&t.length>2)return t;let n=typeof e.short=="string"?e.short.trim():"";return n.startsWith("-")&&!n.startsWith("--")&&n.length>1?n:null}function Bn(e,t,n){if(t.length===0)return;let o=new Set,i=new Map,a=[],r=[];for(let s of t){let l=Xe(s),c=rc(s);c!==null&&r.push(c);for(let d of l)o.add(d),s.enabled===!1&&i.set(d,c);s.required===!0&&s.enabled!==!1&&l.length>0&&a.push({keys:l,label:c})}for(let s of Object.keys(e)){if(!o.has(s)){let c=r.length>0?` Expected one of: ${[...new Set(r)].join(", ")}.`:"";throw new b(`Unknown option '--${s}' for extension command '${n}'.${c}`,g.USAGE)}let l=i.get(s);if(l)throw new b(`Option '${l}' is disabled for extension command '${n}'.`,g.USAGE)}for(let s of a)if(!s.keys.some(l=>Object.hasOwn(e,l)))throw new b(`Missing required option '${s.label}' for extension command '${n}'.`,g.USAGE)}function sc(e){return typeof e=="string"||e==null?e:String(e)}function lc(e){if(typeof e=="number")return e;if(typeof e=="string"&&e.trim().length>0){let t=Number(e);return Number.isFinite(t)?t:e}return e}function cc(e){if(typeof e=="boolean")return e;if(typeof e=="string"){let t=e.trim().toLowerCase();if(t==="true"||t==="1")return!0;if(t==="false"||t==="0")return!1}return e}var dc={string:sc,number:lc,boolean:cc};function Pt(e,t){return Array.isArray(e)?e.map(n=>Pt(n,t)):dc[t](e)}function ar(e,t,n){let o=n?(Array.isArray(e)?e.flat(1/0):[e]).filter(i=>i!=null&&i!==""):Qo(e);return t?o.map(i=>Pt(i,t)):o}function mc(e,t,n,o){return n?ar(e,t,o):t?Pt(e,t):e}function pc(e,t,n){let o=e[nr];if(!o||o.length===0)return n;let i=new Set(t);return o.filter(a=>i.has(a.key)).map(a=>a.value)}function rr(e,t,n=e){if(t.length===0)return e;let o=Object.create(null);for(let[i,a]of Object.entries(e))o[i]=a;for(let i of t){let a=ac(i);if(!a)continue;let r=i.list===!0,s=Xe(i);for(let d of s)if(!(d===a||!Object.hasOwn(o,d))){if(Object.hasOwn(o,a)){if(!r){delete o[d];continue}let m=o[a],p=o[d];o[a]=[...Array.isArray(m)?m:[m],...Array.isArray(p)?p:[p]].filter(u=>u!=null),delete o[d];continue}o[a]=o[d],delete o[d]}let l=or(i),c=i.repeatable===!0;if(!Object.hasOwn(o,a)){i.default!==void 0&&(o[a]=mc(i.default,l,r,c));continue}if(r){o[a]=ar(pc(n,s,o[a]),l,c);continue}l&&(o[a]=Pt(o[a],l))}return o}function sr(e){let t=Object.create(null),n=[];Object.defineProperty(t,nr,{value:n});let o=0;for(;o<e.length;){let i=Vn(e,o);if(!i){o+=1;continue}let a=Ye(i.key);if(a.length===0||It(a)){o+=i.consumed;continue}ic(t,a,i.value),n.push({...i,key:a}),o+=i.consumed}return t}function lr(e){let t=[],n=0;for(;n<e.length;){if(e[n]==="--"){t.push(...e.slice(n+1));break}let o=Vn(e,n);if(o){n+=Math.max(1,o.consumed);continue}t.push(e[n]),n+=1}return t}function Kn(e,t){if(t.length===0)return[...e];let n=new Set,o=new Set;for(let r of t){let s=or(r);for(let l of Xe(r))n.add(l),s==="boolean"&&o.add(l)}if(n.size===0)return[...e];let i=[],a=0;for(;a<e.length;){if(e[a]==="--"){i.push(...e.slice(a+1));break}let r=Vn(e,a);if(r){let s=Ye(r.key);if(n.has(s)){let l=e[a],c=o.has(s)&&!l.includes("=")?1:r.consumed;a+=c;continue}}i.push(e[a]),a+=1}return i}import Te from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="4a2291ff-7618-518c-8bff-e9aa0e2f8af2")}catch{}})();async function Jn(e,t={},n=[]){let o={readSettings:P,loadExtensions:Fe,activateExtensions:Le,resolveImplicitPmRoot:Zt,...t};try{let i=await o.readSettings(e),a=await o.loadExtensions({pmRoot:e,settings:i,cwd:process.cwd(),noExtensions:!1}),r=await o.activateExtensions(a);return[...a.failed,...r.failed].map(s=>{let l=(a.effective??[]).find(p=>p.layer===s.layer&&p.name===s.name),c=[...l?.contributions?.commands??[],...l?.contributions?.command_handlers??[],...l?.activation?.commands??[]].map(N).filter((p,u,f)=>p.length>0&&f.indexOf(p)===u).sort((p,u)=>p.localeCompare(u)),d=n.map(N),m=c.some(p=>d.some(u=>u===p||u.startsWith(`${p} `)));return{layer:s.layer,name:s.name,error:s.error,...c.length>0?{declared_commands:c}:{},...m?{declared_command_match:!0,recovery_commands:["pm package doctor --project --detail deep","pm package install <package-or-path> --project"]}:{}}})}catch(i){return[{layer:"runtime",name:"extension-loader",error:i instanceof Error?i.message:String(i)}]}}async function cr(e,t,n={},o=[]){if(e!=="unknown_command")return[];let i=await Jn(t,n,o),a={readSettings:P,loadExtensions:Fe,activateExtensions:Le,resolveImplicitPmRoot:Zt,...n};try{let r=a.resolveImplicitPmRoot(process.cwd());if(Te.resolve(r)===Te.resolve(t))return i;let[s,l]=await Promise.all([a.readSettings(t),a.readSettings(r)]),[c,d]=await Promise.all([a.loadExtensions({pmRoot:t,settings:s,cwd:process.cwd(),noExtensions:!1}),a.loadExtensions({pmRoot:r,settings:l,cwd:process.cwd(),noExtensions:!1})]),m=new Set(c.loaded.flatMap(u=>u.activation?.commands??[])),p=[...new Set(d.loaded.flatMap(u=>u.activation?.commands??[]))].filter(u=>!m.has(u)).sort((u,f)=>u.localeCompare(f));if(p.length===0)return i;i.push({layer:"runtime",name:"extension-root-relocation",error:`storage_root=${Te.resolve(t)} extension_discovery_root=${c.roots.project}; cwd_storage_root=${Te.resolve(r)} cwd_extension_discovery_root=${d.roots.project}; the selected --pm-path runtime is missing ${p.length} workspace command path(s): ${p.slice(0,8).join(", ")}${p.length>8?", ...":""}. --pm-path selects extension discovery as well as item storage; omit it, point --pm-path at ${Te.resolve(r)}, or install the extension into the selected tracker with "pm --pm-path ${Te.resolve(t)} install <package> --project".`})}catch{}return i}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3f896a8d-2c03-5f9c-9909-4684a187870d")}catch{}})();var dr={core:0,standard:1,full:2,internal:3};function mr(e,t,n=!0){let o=t.get(I(e));if(o)return o;if(!n)return;let i=[...t.entries()].filter(([s])=>s.startsWith(`${e} `)).map(([,s])=>s);if(i.length===0)return;let a=i.reduce((s,l)=>dr[l.tier]<dr[s]?l.tier:s,"internal"),r=new Set(i.map(({family:s})=>s));return{tier:a,family:r.size===1?i[0].family:"extensions"}}function pr(e,t){if(t.length===0)return e;let n=Z(e,t);if(n)return n;let o=t.join(" ");if(I(o)!==o||!Me.some(i=>i===o)&&!Ri(o)&&!Ue(o)&&!Se(e,t))return null;for(let i=t.length-1;i>0;i-=1){let a=Z(e,t.slice(0,i));if(a)return a}return t.length===1?e:null}function uc(e){let t=e.match(/[<[]([^>\]]+)[>\]]/);if(!t)return null;let n=t[1]?.trim();return n&&n.length>0?n:null}function ur(e){let t=e;if(typeof t.attributeName=="function"){let n=t.attributeName();return typeof n=="string"&&n.trim().length>0?n.trim():null}return typeof t.attributeName=="string"&&t.attributeName.trim().length>0?t.attributeName.trim():null}function fc(e){let t=new Map;for(let n of e){let o=n,i=ur(n);if(!i||typeof o.long!="string"||o.long.trim().length===0)continue;let a=t.get(i)??[];a.push(o.long.trim()),t.set(i,a)}for(let[n,o]of t.entries())t.set(n,[...new Set(o.map(i=>i.trim()).filter(i=>i.length>0))].sort((i,a)=>i.localeCompare(a)));return t}function gc(e){return x(e)}function hc(e){let t=e.options??[],n=fc(t);return t.map(o=>{let i=o,a=typeof i.flags=="string"?i.flags.trim():"",r=typeof i.description=="string"?i.description.trim():"",s=ur(o),l=(s?n.get(s)??[]:[]).filter(h=>h!==i.long).map(h=>h.trim()).filter(h=>h.length>0),c=r.match(/^Alias for ([^ ]+)/i),d=c&&c[1]?c[1].trim():null,m=i.mandatory===!0||r.includes("[required]")||r.toLowerCase().includes("required;"),p=a.includes("<"),u=p||a.includes("["),f={flags:a,long:typeof i.long=="string"?i.long:null,short:typeof i.short=="string"?i.short:null,description:r,takes_value:u,value_required:p,value_name:uc(a),variadic:i.variadic===!0,required:m,aliases:l,alias_for:d};return i.defaultValue!==void 0&&(f.default_value=i.defaultValue),f})}function yc(e){let t=new Map,n=[];for(let o of e){if(o.alias_for&&o.long){n.push(o);continue}o.long&&t.set(o.long,o)}for(let o of n){let i=o.alias_for,a=t.get(i);if(!a)continue;let r=o.long,s=new Set([...a.aliases??[],r]);a.aliases=[...s].sort((l,c)=>l.localeCompare(c))}return e.filter(o=>!o.alias_for||!o.long?!0:!t.has(o.alias_for))}function _c(e){let t=e;return(Array.isArray(t.registeredArguments)?t.registeredArguments:Array.isArray(t._args)?t._args:[]).map(n=>{let o=typeof n.name=="function"?n.name():typeof n.name=="string"?n.name:"argument",i=typeof n.description=="string"&&n.description.trim().length>0?n.description.trim():null;return{name:o.trim(),required:n.required===!0||i?.toLowerCase().startsWith("required;")===!0,variadic:n.variadic===!0,description:i}})}function wc(e,t=new Map,n=!1){let o=e.createHelp().visibleCommands(e);return(n?[...new Set([...o,...e.commands])]:o).filter(i=>i.name()!=="help"||e.parent===null).filter(i=>!n||(pe(i)??J(i.name()))!=="internal").map(i=>{let a=N(E(i)),r=a,s=pe(i),l=mr(a,t,s!==void 0),c=W.find(({alias:d})=>d===a);return{name:i.name().trim(),aliases:Gn(i),description:i.description().trim(),tier:l?.tier??s??J(r),family:l?.family??vt(r),...c?{alias_for:c.canonical,alias_lifecycle:c.lifecycle,...c.lifecycle==="deprecated"?{deprecated:!0}:{}}:{}}}).sort((i,a)=>i.name.localeCompare(a.name))}function vc(e,t,n){if(!n)return t;let o=n.examples??[],i=n.failure_hints??[];return{intent:n.intent??n.description??t.intent,examples:e==="detailed"?o.length>0?[...o]:[...t.examples]:o.length>0?[o[0]]:[...t.examples],tips:e==="detailed"?i.length>0?[...i]:[...t.tips]:[],detail_mode:e}}function bc(e,t,n,o,i){let a=e!==void 0&&bn(e)===xe,r=a?{intent:t,examples:[`pm ${e} --help`],tips:[],detail_mode:n}:va(e,n),s=i?"positional_action":o?.intent||o?.description?"extension":a?t?"command_description":"unavailable":e?"help_bundle":"root_help_bundle";return{narrative:vc(n,r,o),intentSource:s}}function Cc(e,t){return e===void 0?null:t?.tier??J(e)}function xc(e,t){return e===void 0?null:t?.family??vt(e)}function kc(e,t,n){if(!(t!==e||!n))return W.map(o=>({alias:o.alias,canonical:o.canonical,canonical_argv:[...o.canonical_argv],available:pr(e,o.canonical.split(" "))!==null,lifecycle:o.lifecycle,hidden:o.hidden,deprecated:o.lifecycle==="deprecated"}))}function Ec(e,t,n,o,i=new Map,a=!1){if(!e){let s=_c(t),l=wc(t,i,a),c=new Set(l.map(({name:d})=>d));return{arguments:s,options:o,subcommands:[...l,...yt.filter(({parent:d,action:m})=>d===n&&!c.has(m)).map(({action:d,description:m})=>({name:d,aliases:[],description:m,tier:J(n.split(" ")[0]),family:vt(n.split(" ")[0])}))].sort((d,m)=>d.name.localeCompare(m.name)),usage:[n,s.reduce((d,m)=>m.required?d.replace(`[${m.name}${m.variadic?"...":""}]`,`<${m.name}${m.variadic?"...":""}>`):d,t.usage())].filter(d=>d.length>0).join(" ")}}let r=new Set(e.accepted_flags);return{arguments:e.slots.map(({name:s,required:l,variadic:c,value_kind:d,polymorphic:m})=>({name:s,required:l,variadic:c,description:m?`Polymorphic ${d} value; inspect the action contract before mutation.`:`${d.replaceAll("_"," ")} value.`})),options:o.filter(({long:s,aliases:l})=>s!==null&&r.has(s)||l.some(c=>r.has(c))),subcommands:[],usage:[e.command,...e.slots.map(({name:s,required:l,variadic:c})=>{let d=c?`${s}...`:s;return l?`<${d}>`:`[${d}]`})].join(" ")}}function Sc(e,t,n,o,i){let a=vn(n),r=oe(n),s=N(E(t)),l=N(o.join(" ")),c=l.length>s.length?l:s,d=Ue(c),m=d?.command??s,p=m.length>0?m:void 0,u=p,f=p?i.get(I(p)):void 0,h=p?mr(p,i,pe(t)!==void 0):void 0,{narrative:w,intentSource:$}=bc(p,t.description().trim(),a,f,d!==void 0),z=yc(Xa(hc(t),Ya(f))),Q=Ec(d,t,m,z,i,r),G=kc(e,t,r);return{format:"pm_help_v1",detail_mode:a,root_command:e.name(),requested_path:o,resolved_path:m.length>0?m:e.name(),visibility_tier:Cc(u,h),capability_family:xc(u,h),description:d?.description??t.description(),usage:Q.usage,intent:d?.description??w.intent,intent_source:$,examples:d?[d.example]:w.examples,tips:d?[_t(d.accepted_flags)]:w.tips,arguments:Q.arguments,options:Q.options,subcommands:Q.subcommands,has_subcommands:Q.subcommands.length>0,...G===void 0?{}:{command_aliases:G}}}async function fr(e,t,n,o=t){let i=M(t);if(!i.json)return!1;let a=A(t);if(!a.requested)return!1;let r=pr(e,a.commandPathTokens);if(!r){if(!i.quiet){let s=`unknown command '${a.commandPathTokens.join(" ")}'`,l=Fn(s,e,n,t),c=Ot(s,"help",We,g.USAGE,{...l,attemptedCommand:gc(t),normalizedInvocationArgs:[...t],providedOptionFlags:Y(t)}),d=i.tokenAccounting?ce(c,m=>`${JSON.stringify(m,null,2)}
|
|
28
|
+
`):c;ve(`${JSON.stringify(d,null,2)}
|
|
29
|
+
`)}return process.exitCode=g.USAGE,!0}if(!i.quiet){let s=Sc(e,r,t,a.commandPathTokens,n),l=A(o).commandPathTokens;s.requested_path=l;let c=H(l.join(" "));c&&(s.resolved_path=c.canonical),r===e&&!oe(t)&&(s.omission_receipt={has_omissions:!0,omitted_field_group_count:1,omitted_field_groups:[{name:"command_aliases",restore_with:"--all"}]}),bi(`${JSON.stringify(s,null,2)}
|
|
30
30
|
`)}return process.exitCode=g.SUCCESS,!0}function Ac(e,t){let n=["","Type-aware option policies:"," pass --type <value> with --help to render required/disabled/hidden option policy details for that type.",` active type values: ${t.types.join("|")}`];return e==="create"&&n.push(" scheduling shortcut: use --schedule-preset lightweight for Reminder/Meeting/Event minimal create flows."),n.join(`
|
|
31
|
-
`)}function Tc(e,t){if(t.options.length===0){e.push(" type options: none");return}e.push(" type options:");for(let n of t.options){let o=n.required?" (required)":"",
|
|
32
|
-
`)}let
|
|
33
|
-
`)}function hr(e,t,n){let o=k(n);if(o!=="create"&&o!=="update")return;let a=Je(e,o);a&&a.addHelpText("after",Ic(o,t,n))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="714821f9-dd8f-5958-a751-29e8dfc06471")}catch{}})();function Pc(e,t){return Me(e.id)||`migration-${String(t+1).padStart(3,"0")}`}function $c(e){return Me(e.status)?.toLowerCase()??"pending"}function Nc(e){return e.mandatory===!0}function Dc(e,t){let n=e.layer.localeCompare(t.layer);if(n!==0)return n;let o=e.name.localeCompare(t.name);return o!==0?o:e.id.localeCompare(t.id)}function wr(e){let t=[];return e.forEach((n,o)=>{if(!Nc(n.definition))return;let a=$c(n.definition);a!=="applied"&&t.push({layer:n.layer,name:n.name,id:Pc(n.definition,o),status:a})}),t.sort(Dc),t}function yr(e){return Array.isArray(e)&&e.length>0}var Mc=new Set(["create","beads import","todos import"]),Fc=new Set(["restore","update","close","delete","append","claim","release"]),Lc=new Set(["comments","notes","learnings"]),jc=new Set(["files","docs","test"]),Uc=new Set(["activate","add","add-field","add-status","add-type","apply","compact","create","deactivate","delete","disable","edit","enable","import","infer","install","materialize","migrate","redact","remove","remove-field","remove-status","remove-type","remap-status","rename-field","rename-type","repair","run","save","set","unset","update","upgrade"]);function Zn(e,t){let n=t.force===!0;return Mc.has(e)?{isMutation:!0,forceCapable:!1,forceRequested:!1}:Fc.has(e)?{isMutation:!0,forceCapable:!0,forceRequested:n}:Lc.has(e)?{isMutation:typeof t.add=="string",forceCapable:!0,forceRequested:n}:jc.has(e)?{isMutation:yr(t.add)||yr(t.remove),forceCapable:!0,forceRequested:n}:{isMutation:!1,forceCapable:!1,forceRequested:!1}}function qc(e,t,n){if(Zn(e,n).isMutation)return!0;let o=e.trim().toLowerCase();return Va(o)?["close-many","close-task","copy","delete","discover","focus","pause-task","start-task","update-many"].includes(o)?!0:t.some(a=>Uc.has(a.trim().toLowerCase())):!1}function _r(e){return(e??"in_progress").trim().toLowerCase().replaceAll("-","_")}function Hc(e,t,n){let o=t[0]?.trim().toLowerCase()??"";if(e.trim().toLowerCase()!=="schema"||!["rename-type","rename-field","remap-status"].includes(o))return;let a=[];if(Me(t[1])||a.push("source"),Me(n.to)||a.push("--to"),a.length!==0)throw new b(`Schema migration requires ${a.join(", ")}.`,g.USAGE,{code:"schema_migration_input_required",required:a.join(","),why:"Schema migrations require a source and target. A workspace-bound stable migration id is derived automatically when --migration-id is omitted.",recovery:{recovery_mode:"compact",missing_required_fields:a,suggested_flags:a.filter(i=>i.startsWith("--")),suggested_retry:`pm schema ${o} <source> --to <target>`}})}async function zc(e,t,n,o,a){if(e.trim().toLowerCase()!=="update"||typeof n.status!="string"||_r(n.status)!==_r(a.schema.workflow.in_progress_status))return;let i=t[0];if(!i)return;let r=le(a,ce()),s=await yt(o,i,a.id_prefix,a.item_format,r.type_to_folder);if(!s)return;let l=await Ta(s,{schema:a.schema}),c=typeof n.assignee=="string"?n.assignee.trim():void 0;(c===void 0?l.document.metadata.assignee?.trim():!["","none","null","undefined"].includes(c.toLowerCase())&&c)||_(`warning:in_progress_item_unclaimed:${s.id}:claim_with=pm claim ${s.id}`)}async function Qn(e,t,n,o,a){if(!qc(e,t,n)||(Hc(e,t,n),!await V(B(a))))return;let i=await xe(a);o.json!==!0&&await zc(e,t,n,a,i.settings);let r=Wa({author:gt(o.author,i.settings.author_default),payload:{command:e,args:t,options:n},settings:i.settings.mutation_guard,force:o.force===!0||n.force===!0});for(let s of r.warnings)_(`warning:${s}`)}function vr(e,t,n){if(n.length===0)return;let o=Zn(e,t);if(!o.isMutation||o.forceCapable&&o.forceRequested)return;let a=n.map(r=>`extension_migration_blocking:${r.layer}:${r.name}:${r.id}:${r.status}`),i=o.forceCapable?"Re-run this command with --force to bypass.":"This command path does not support --force bypass.";throw new b(`Write command "${e}" blocked by unresolved mandatory extension migrations (${a.join(",")}). ${i}`,g.CONFLICT)}async function eo(e,t,n,o){if(!Zn(e,t).isMutation||!o.enforce_item_format_gate&&!o.run_preflight_item_format_sync||!await V(B(n)))return;let{settings:a,metadata:i,warnings:r}=await xe(n);for(let s of r)_(`warning:${s}`);if(o.enforce_item_format_gate&&!i.has_explicit_item_format&&(Sa(a),await Aa(n,a,"item_format:auto_select_default")),o.run_preflight_item_format_sync){let s=le(a,ce());await Ba(n,a.item_format,"item_format:pre_mutation_sync",s.type_to_folder,a.schema)}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c0826cb1-5181-51b3-9ad9-0cd7a3d2c4b3")}catch{}})();function to(e){let t=[];for(let n of e??[]){if(n.startsWith("-"))break;let o=v(n);o.length!==0&&t.push(o)}return t}function Ie(e){let t=v(e.commandPath??"");if(t.length===0)return[];let n=[t],o=t.split(" ").filter(a=>a.length>0);for(let a of to(e.commandArgs))o.push(...a.split(" ").filter(i=>i.length>0)),n.push(o.join(" "));return[...new Set(n.flatMap(a=>[a,I(a)]))]}function no(e,t){let n=v(e);if(n.length===0)return!1;let o=Ie(t);for(let a of o)if(a===n||a.startsWith(`${n} `))return!0;return t.allowCommandPrefixMatch===!0?o.some(a=>n.startsWith(`${a} `)):!1}function Dt(e){let t=e.activation?.commands;if(t)return t;let n=e.contributions;return n?[...T(n.commands),...T(n.command_handlers),...T(n.command_overrides),...T(n.flag_commands),...T(n.parser_overrides),...br(n.preflight_ownership),...br(n.renderer_ownership)]:[]}function T(e){return e??[]}function br(e){return T(e).flatMap(t=>t.commands)}function Ze(e){return new Set((e.capabilities??[]).map(t=>t.trim().toLowerCase()))}var Cr=new Set(["hooks","parser","preflight","renderers"]),xr=new Set(["commands","schema","services","importers"]),Gc=new Set(["reindex","search","search-advanced"]),Wc=new Set(["--template"]);function Re(e,t){for(let n of t)if(e.has(n))return!0;return!1}function oo(e){let t=v(e??"");if(t.length===0)return!1;let[n]=t.split(" ");return Gc.has(n??t)}function ao(e,t){for(let n of e.commandArgs??[]){if(!n.startsWith("--"))continue;let[o]=n.split("=",1);if(t.has(o))return!0}return!1}function Mt(e){return v(e.commandPath??"")==="create"&&ao(e,Wc)}function io(e){return e.some(t=>{let n=v(t);return n==="templates"||n.startsWith("templates ")})}function Nt(e,t){return e.some(n=>no(n,t))||Mt(t)&&io(e)}function ro(e){return[T(e.hooks).length,(e.preflight_overrides??0)-T(e.preflight_ownership).length,T(e.item_types).length,T(e.item_fields).length,T(e.relationship_kinds).length,T(e.service_overrides).length,T(e.assurance_providers).length,T(e.renderer_overrides).length-T(e.renderer_ownership).length].some(t=>t>0)}function so(e,t){let n=e.activation?.commands??[];if(n.length>0)return Nt(n,t);let o=Dt(e);if(Nt(o,t)||Ze(e).has("search")&&oo(t.commandPath))return!0;if(e.contributions)return ro(e.contributions)}function Ft(e,t){let n=so(e,t);if(n!==void 0)return n;let o=Ze(e);return!!(Re(o,Cr)||Re(o,xr))}function Qe(e,t){return e.effective.length===0?!1:et(t)!=="all"?e.effective.some(n=>Ft(n,t)):e.effective.some(n=>{let o=Ze(n);return Dt(n).length>0||Re(o,Cr)||Re(o,xr)||o.has("search")})}function et(e){if(v(e.commandPath??"").split(" ")[0]==="completion")return"all";let t=Ie(e).filter(o=>o.split(" ").every(a=>!a.startsWith("-"))).sort((o,a)=>a.length-o.length)[0]??v(e.commandPath??"");if(t.length===0)return"all";let n=Mt(e)?"--template":"";return`${e.allowCommandPrefixMatch===!0?"prefix":"exact"}:${t}:${n}`}function lo(e){return et(e)==="all"?void 0:t=>Ft(t,e)}function Pe(e){let t=A(e);if(t.requested&&t.commandPathTokens.length>0){let[a,...i]=t.commandPathTokens;return{commandPath:a,commandArgs:i,allowCommandPrefixMatch:!0}}let n=N(e),o=n.findIndex(a=>a.trim().length>0&&!a.startsWith("-"));return o<0?{}:{commandPath:n[o],commandArgs:n.slice(o+1),allowCommandPrefixMatch:t.requested}}function co(e){let t=e.args.map(String);if(v(E(e))==="create"){let n=e.optsWithGlobals();typeof n.template=="string"&&n.template.trim().length>0&&t.push("--template")}return t}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="873c381f-8e2f-52dd-8fc1-51b6b791ee1d")}catch{}})();var Lt=Symbol.for("pm.readOutputInvocationProvenance");function se(e,t){let n=Reflect.get(e,Lt);n!==void 0&&Reflect.set(t,Lt,n)}function mo(e,t,n){let o=ha(t,n);if(!o)return;let a=e;for(;a.parent;)a=a.parent;let i=a.rawArgs,r=new Set(Y(i.slice(2))),s=ga.find(d=>d.command===o),l=Object.values(s?.dimensions??{}).flatMap(d=>d.legacy_aliases.flatMap(m=>r.has(m.flag)?[m.flag]:[])),c=Reflect.get(n,Lt);Reflect.set(n,Lt,{canonical_include_modes:c?.canonical_include_modes??[],explicit_legacy_aliases:l,cli_invocation_observed:!0}),se(n,e)}function Vc(e){let t=e.optsWithGlobals(),n=E(e);if(I(n)===n)return t;let o=e.opts();for(let a=e.parent;a?.parent;a=a.parent)for(let i of a.options){let r=i.attributeName(),s=a.getOptionValueSource(r)==="cli";if(s&&!e.options.some(l=>l.long===i.long))throw new b(`Unknown option '${i.long}' for ${n}`,g.USAGE,{code:"unknown_option",flag:i.long,required:`Use options declared by pm ${n} --help.`});if(s&&e.getOptionValueSource(r)!=="cli"){let l=a.getOptionValue(r);e.setOptionValueWithSource(r,l,"cli")}r in o?t[r]=o[r]:delete t[r]}return t}function po(e,t,n,o){mo(e,t,o);let a=n.outputInclude;if(a===void 0)return;let{selectors:i,modes:r}=wa(t,a,o);if(t==="get"&&typeof o.fields=="string"&&e.setOptionValueWithSource("fields",o.fields,"cli"),r.length===0)return;se(o,e);let s=_a(t);for(let c of r){let d=s.get(c),m=o[d];e.setOptionValueWithSource(d,m,"cli")}let l=i.length>0?i.join(","):void 0;l===void 0?delete n.outputInclude:n.outputInclude=l;for(let c=e;c;c=c.parent)c.setOptionValueWithSource("outputInclude",l,"cli");xt(e,n)}function $e(e,t,n=[]){let o={...Vc(e)};se(e,o),delete o.json,delete o.quiet,delete o.path,delete o.pmPath,delete o.noExtensions,delete o.extensions,delete o.profile,delete o.pager,delete o.changedFields,delete o.fullChangedFields,delete o.idOnly,delete o.lean,delete o.tokenAccounting,delete o.outputInclude,delete o.outputLimit,delete o.outputBudget,delete o.outputFormat,delete o.outputSession;let a=lr(t);for(let[i,r]of Object.entries(a))o[i]===void 0&&(o[i]=r);if(n.length>0){let i=ir(n),r=ne(E(e)).map(c=>({long:c.flag,short:c.short,aliases:c.aliases})),s={...a};for(let c of i)o[c]!==void 0&&(s[c]=o[c]);Jn(s,[...r,...n],E(e));let l=sr(o,n,a);return se(o,l),l}return o}function jt(e,t){let n=v(t);return n.length===0?[]:e.flags.filter(o=>I(v(o.target_command))===I(n)).flatMap(o=>o.flags)}function tt(e,t,n){let o=jt(e,t),a=[t],i=[];for(let r of n){if(r.startsWith("-"))break;a.push(r);let s=jt(e,a.join(" "));s.length>0&&(i=s)}return i.length>0?i:o}function Ut(e){return e.arguments??[]}function kr(e){let t=Ut(e).map(n=>{let o=n.variadic?`${n.name}...`:n.name;return n.required?`<${o}>`:`[${o}]`}).join(" ");return`pm ${e.command}${t?` ${t}`:""}`}function uo(e,t){if(!e)return!1;let n=v(t);return e.importers.some(o=>v(`${o.importer} import`)===n)||e.exporters.some(o=>v(`${o.exporter} export`)===n)}function fo(e,t){let n=Ut(e),o=n.filter(s=>s.required).length,a=n.some(s=>s.variadic)?Number.POSITIVE_INFINITY:n.length,i=e.failure_hints??[],r=i.length>0?` ${i.join(" ")}`:"";if(t.length<o)throw new b(`Missing required argument for extension command '${e.command}'. Usage: ${kr(e)}${r}`,g.USAGE);if(t.length>a){let s=t.slice(a).join(" ");throw new b(`Too many arguments for extension command '${e.command}': ${s}. Usage: ${kr(e)}${r}`,g.USAGE)}}function Bc(e){return`--${e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}`}function Kc(e,t,n){if(n.length>0){Jn(t,n,e.command);return}let o=Object.keys(t).filter(a=>t[a]!==void 0).sort();if(o.length!==0)throw new b(`Unknown option '${o.map(Bc).join(", ")}' for extension command '${e.command}'. This command does not define extension flags.`,g.USAGE)}function go(e,t,n,o){e&&(fo(e,t),Kc(e,n,o))}import{Command as Er}from"commander";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0503f6e5-36d9-5afb-a17f-feef2241f984")}catch{}})();var Jc=new Set(["--version","-V"]);function nt(e){let t=N(e);return["package","packages","extension"].includes(t[0]??"")&&t[1]==="inventory"}function Sr(e){if(N(e)[0]!=="item"||!e.includes("--dry-run"))return;let t=new Er().configureOutput({writeErr:()=>{}}).exitOverride(),n=new Set;for(let a of He)for(let i of[a.flag,a.short,...a.aliases??[]]){if(i===void 0||n.has(i))continue;n.add(i);let r=a.value_name!==void 0||a.flag==="--pm-path";t.option(`${i}${r?" <value>":""}`)}try{t.parseOptions(e)}catch{}let o=t.opts();return{path:o.pmPath??o.path}}var Yc=new Set(["config","extension","init","install","package","packages","templates","upgrade"]),ho=new Set(["activity","aggregate","context","ctx","events","get","graph","history","list","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","search"]),Ar=new Set(["append","close","close-many","comments","delete","deps","discover","docs","files","history-repair","history-redact","history-compact","learnings","notes","plan","restore","update","update-many","create"]),Xc=new Set(["claim","close-task","contracts","duplicates","gc","health","pause-task","release","start-task","stats","test","test-all","test-runs","test-runs-worker","validate"]),Zc=new Set(["claim","close-task","pause-task","release","start-task","test"]),_e={setup:!0,listQuery:!0,mutation:!0,operation:!0},Qc=new Set(["create","update","update-many","list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled","search","calendar","context","templates"]);function ot(e){return e.some(t=>Jc.has(t))}function ed(e,t){if(!R.some(o=>o.canonical_argv[0]===t))return;let n=new Er().configureOutput({writeErr:()=>{}}).exitOverride();for(let o of Xa(t,ne(t))){let a=o.takes_value?o.value_required?" <value>":" [value]":"";for(let i of[o.flag,o.short,...o.aliases??[]])i!==void 0&&n.option(`${i}${a}`)}try{let o=n.parseOptions(e.slice(1));if(o.unknown.length>0)return _e;let a=q([t,...o.operands])?.alias;if(R.some(i=>i.alias===a))return{..._e,targetCommandName:a}}catch{return _e}}function yo(e){if(ot(e))return{setup:!1,listQuery:!1,mutation:!1,operation:!1};if(e.length===0||A(e).requested)return _e;let t=k(e);if(!t)return _e;let n=t.trim().toLowerCase(),o=N(e),a=q(o)?.alias;return R.some(i=>i.alias===a)?{..._e,targetCommandName:a}:ed(o,n==="ctx"?"context":n)||(Yc.has(n)?{setup:!0,listQuery:!1,mutation:!1,operation:!1,targetCommandName:n}:ho.has(n)?{setup:!1,listQuery:!0,mutation:!1,operation:!1,targetCommandName:n}:Ar.has(n)?{setup:!1,listQuery:!1,mutation:!0,operation:!1,targetCommandName:n}:Xc.has(n)?{setup:!1,listQuery:!1,mutation:!1,operation:!0,targetCommandName:n}:_e)}function _o(e){return e.length===0||A(e).requested||e.includes("--explain")&&k(e)===void 0}function wo(e,t){return nt(t)||ot(t)?!1:oe(t)||A(t).requested?!0:!!k(t)}function vo(e){if(ot(e))return!1;let t=k(e);return t?Qc.has(t):!1}function td(e){let t=String(e.rawFrom??""),n=t.indexOf("="),o=n>=0?t.slice(0,n):t,a=e.normalizedTokens.map(c=>{let d=c.indexOf("=");return d>=0?c.slice(0,d):c}).find(c=>c==="--literal"||c==="--regex"||c==="--replacement"),i=a?e.argv.map(c=>{let d=c.indexOf("=");return(d>=0?c.slice(0,d):c)===o?d>=0?`${a}${c.slice(d)}`:a:c}):e.argv,r=Ue(i),s=a&&n>=0?`${o}=[redacted]`:t,l=a&&e.normalizedDisplay.includes("=")?`${a}=[redacted]`:e.normalizedDisplay;return{argv:r,normalizedDisplay:l,sourceDisplay:s}}function bo(e){let t=e.commandName;if(!t)return;let n=e.trace.find(c=>c.reason==="flag_typo");if(!n)return;let o=Array.isArray(n.to)?n.to:[String(n.to??"")].filter(c=>c.length>0),a=o.length>0?o.join(" "):"the canonical flag",i=Ar.has(t)||Zc.has(t),r=i?"mutating_flag_typo_requires_retry":"flag_typo_requires_retry",s=i?"mutating option":"option",l=td({argv:e.argv,normalizedDisplay:a,normalizedTokens:o,rawFrom:n.from});throw new b(`Refusing to auto-correct ${s} ${l.sourceDisplay} to ${l.normalizedDisplay}. Retry with the canonical flag so the command is explicit.`,g.USAGE,{code:r,examples:[x(l.argv)],nextSteps:["Retry the command with the canonical flag shown in examples."],recovery:{normalized_args:l.argv,suggested_retry:x(l.argv)}})}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6d83c356-db56-5116-9fe7-e0c27973b36f")}catch{}})();var nd=new Set(["success","nonexistent_command","invalid_option","missing_required_option","missing_required_argument","invalid_usage","validation_failed","health_findings","validation_findings","conflict","runtime_failed","unknown_failed"]),od=new Set(["parse","preflight","execute","unknown"]),ad=new Set(["usage","validation","conflict","runtime","unknown"]);function we(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="string"){let a=o.trim();if(a.length>0)return a}}}function Co(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="boolean")return o}}function qt(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="number"&&Number.isFinite(o))return Math.max(0,Math.trunc(o))}}function xo(e){if(!e)return;let t=e.trim().toLowerCase();if(nd.has(t))return t}function ko(e){if(!e)return;let t=e.trim().toLowerCase();if(od.has(t))return t}function Eo(e){if(!e)return;let t=e.trim().toLowerCase();if(ad.has(t))return t}function So(e){let t=we(e,"error","message");if(t)return t;let n=e?.warnings;if(Array.isArray(n)){let i=n.find(r=>typeof r=="string"&&r.trim().length>0);if(typeof i=="string")return i.trim()}if(Co(e,"fail_on_skipped_triggered","failOnSkippedTriggered"))return"linked_test_fail_on_skipped_triggered";let o=qt(e,"failed");if(typeof o=="number"&&o>0)return`failed_runs:${o}`;let a=e?.run_results;if(Array.isArray(a)){let i=a.filter(r=>Xt(r)?.status==="failed").length;if(i>0)return`failed_runs:${i}`}}function Ao(e,t){if(!e)return t===g.USAGE?"invalid_command_usage":t===g.NOT_FOUND?"item_not_found":t===g.CONFLICT?"lock_conflict":t===g.DEPENDENCY_FAILED?"dependency_failed":"command_failed"}function To(){let e=Xt(de()),t=typeof process.exitCode=="number"&&Number.isFinite(process.exitCode)?Math.max(0,Math.trunc(process.exitCode)):void 0,n=qt(e,"exit_code","exitCode"),o=t??n??g.SUCCESS,a=ti(o),i=we(e,"error_code","errorCode")??Ao(a,o),r=Eo(we(e,"error_category","errorCategory"))??(a?void 0:lt(i)),s=a?void 0:So(e)??`command_exit_${o}`,l=xo(we(e,"command_resolution","commandResolution"))??vt({ok:a,errorCode:i,errorCategory:r}),c=ko(we(e,"resolution_stage","resolutionStage"))??"execute";return{ok:a,error:s,exit_code:o,error_code:i,error_category:r,command_resolution:l,resolution_stage:c}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="35d509e8-a50c-5f5b-b00e-810ebdc01e07")}catch{}})();var Oo="PM_CLI_PACKAGE_ROOT",Dr=Symbol("pm.deprecatedAliasInvocation"),Gt=new Map;for(let e of W){let t=e.alias.split(" ")[0],n=Gt.get(t)??[];n.push(e),Gt.set(t,n)}for(let e of Gt.values())e.sort((t,n)=>n.alias.split(" ").length-t.alias.split(" ").length);function id(){return Bo(import.meta.url,["../.."])}(typeof process.env[Oo]!="string"||process.env[Oo]?.trim().length===0)&&(process.env[Oo]=id());var Ne=null,F=null,Wt=null;function rd(e){Ne=e}function sd(e){O=e}var at=null,ve=null,O=new Map,Mo=250,ld=new Set([g.USAGE,g.NOT_FOUND,g.CONFLICT]),cd=new Set(["1","true","yes","on"]),dd=Ge(()=>import("./chunks/register-setup-HLSKKU4V.js")),md=Ge(()=>import("./chunks/register-list-query-GBLTOQQL.js")),pd=Ge(()=>import("./chunks/register-mutation-TNRHNK4N.js")),ud=Ge(()=>import("./chunks/register-operations-J3WXP3MA.js"));function zt(e){return x(e)}function Mr(e){let t=e.match(/--[a-zA-Z0-9][a-zA-Z0-9_-]*/g);if(!t||t.length===0)return;let n=[...new Set(t.map(o=>ue(o)??o))];return n.length>0?n:void 0}function fd(e,t,n){if(n?.suggested_retry||e.includes("failed in extension handler (")||!/\b(?:missing|required|requires)\b/i.test(e))return;let o=Y(t),a=new Set(o.map(d=>ue(d)??d)),i=Mr(e),r=t.find(d=>y.commands.some(m=>m.name()===d)),s=r?y.commands.find(d=>d.name()===r):void 0,l=new Set([...y.options,...s?.options??[]].flatMap(d=>d.flags.split(/[ ,|]+/).map(m=>ue(m)).filter(m=>m!==void 0))),c=i?.filter(d=>{let m=ue(d)??d;return a.has(m)?!1:l.has(m)||qn(t,r,m,O)!==void 0});return c&&c.length>0?c:void 0}function gd(e,t,n,o){if(o?.suggested_retry)return o.suggested_retry;let a=n?.[0],i=a?ue(a):void 0,r=e.find(p=>y.commands.some(u=>u.name()===p)),s=r?y.commands.find(p=>p.name()===r):void 0,l=i?s?.options.find(p=>p.flags.split(/[ ,|]+/).includes(i)):void 0,c=qn(e,r,i,O),d=i?l?.isBoolean()===!0||c===!1?[i]:[i,"<value>"]:[],m=i?zt([...e,...d]):t;return m===t?void 0:m}function hd(e){if(!e)return{};let t=["recovery_mode","missing_required_fields","suggested_flags","suggested_retry_args","allowed_values","candidate_commands","candidate_commands_total","candidate_commands_truncated","fallback_candidates","next_best_command"],n={};for(let o of t){let a=e[o];a!=null&&(n[o]=a)}return n}function yd(e){let t=e.existingRecovery;return{attempted_command:t?.attempted_command??e.attemptedCommand,normalized_args:t?.normalized_args??[...e.invocationArgv],provided_fields:t?.provided_fields??(e.providedFields.length>0?e.providedFields:void 0),missing:t?.missing??e.inferredMissing,...hd(t),...e.suggestedRetry?{suggested_retry:e.suggestedRetry}:{}}}function Fr(e,t,n){let o=Ue(t),a=N(o),i=K(a),[r,s]=i===void 0?[]:a.slice(i,i+2),l=o.includes("--explain"),c=fi(o,e?.code,e?.recovery),d=c&&(r==="history-redact"||r==="history"&&s==="redact")?{...c,...c.attempted_command?{attempted_command:zt(o)}:{},...c.normalized_args?{normalized_args:[...o]}:{},...c.suggested_retry?{suggested_retry:zt(o)}:{},...c.suggested_retry_args?{suggested_retry_args:[...o]}:{}}:c;if(d?.recovery_mode==="compact"&&!l)return{...e,recovery:d};let m=zt(o),p=Y(o),u=fd(n,o,d),f=gd(o,m,u,d),h=yd({invocationArgv:o,attemptedCommand:m,providedFields:p,inferredMissing:u,suggestedRetry:f,existingRecovery:d});return{...e,recovery:h}}async function rt(e){let t=F;F=null,await gi(t,e);let n=Ne;if(Ne=null,!n){ut();return}let o=[],a=ma();try{await hi({pmRoot:n.pmRoot,author:n.globalOptions.author,itemIds:e.ok?a?.map(i=>i.id)??[]:[],intent:n.commandName})}catch{o.push("context_usage_feedback_write_failed")}try{o.push(...await na(n.hooks,{command:n.commandName,args:n.commandArgs,options:{...n.commandOptions},global:{...n.globalOptions},pm_root:n.pmRoot,ok:e.ok,error:e.error,result:de(),affected:a}))}catch(i){o=[`afterCommand hooks failed: ${i instanceof Error?i.message:String(i)}`]}finally{ut()}!n.globalOptions.json&&o.length>0&&_(`[pm] warning: afterCommand hook_warnings=${L(o)}`),n.profileEnabled&&o.length>0&&_(`profile:extensions hook_warnings=${L(o)}`)}async function Lr(){await ja()}function jr(e){return cd.has((process.env[e]??"").trim().toLowerCase())}function Ur(e){return jr("PM_SENTRY_CAPTURE_EXPECTED_ERRORS")?!0:!ld.has(Math.trunc(e))}async function Vt(e){return Ur(e.exit_code)?(await Lr(),Ga(e),!0):!1}async function qr(e){let t=pe(e.error),n=Di(t);e.bootstrapGlobal.json?_(JSON.stringify($i(t,g.GENERIC_FAILURE),null,2)):_(t),process.exitCode=g.GENERIC_FAILURE;let o="runtime",a="runtime_failed";try{await Lr(),un(e.error);let i=await e.emitTelemetryCommandError({command:e.attemptedCommand,errorCode:n.code,errorMessage:n.detail,exitCode:g.GENERIC_FAILURE,options:{bootstrap_global_options:e.bootstrapGlobal},resolutionStage:"execute"});o=i.errorCategory,a=i.commandResolution,await Jt(!1,t,{error_code:n.code,error_category:o,exit_code:g.GENERIC_FAILURE,command_resolution:a,resolution_stage:"execute"})}catch(i){e.bootstrapGlobal.json||_(`Failed to report error: ${pe(i)}`)}try{await rt({ok:!1,error:t,exit_code:g.GENERIC_FAILURE,error_code:n.code,error_category:o,command_resolution:a,resolution_stage:"execute"})}catch(i){e.bootstrapGlobal.json||_(`Failed to run error hooks: ${pe(i)}`)}try{await ke()}catch(i){e.bootstrapGlobal.json||_(`Failed to flush error reporting: ${pe(i)}`)}}var _d={create:"create",update:"update","update-many":"update_many",list:"list","list-all":"list","list-draft":"list","list-open":"list","list-in-progress":"list","list-blocked":"list","list-closed":"list","list-canceled":"list",search:"search",calendar:"calendar",context:"context","templates save":"create"},Ro=new Map;function Io(e){return e==="number"?"number":e==="boolean"?"boolean":"string"}function Hr(e,t){return e.options.some(n=>n.long===t)}function zr(e,t){return e.options.some(n=>n.short===t)}function Po(e,t,n,o){let a=t.trim();if(!a)return;let i=n.length>0?n:`Runtime schema field (${t})`;if(a.startsWith("-")&&!a.startsWith("--")){if(zr(e,a))return;if(o){e.option(`${a} <value>`,`${i} (repeatable)`,hn);return}e.option(`${a} <value>`,i);return}let r=a.startsWith("--")?a:`--${a}`;if(!Hr(e,r)){if(o){e.option(`${r} <value>`,`${i} (repeatable)`,hn);return}e.option(`${r} <value>`,i)}}async function Gr(e,t){let n=_d[e];if(!n)return[];let o=`${t}:${n}`,a=Ro.get(o);if(a)return a;if(!await V(B(t)))return Ro.set(o,[]),[];let i=await P(t),r=(mn(i.schema).command_to_fields.get(n)??[]).flatMap(s=>[s.cli_flag,...s.cli_aliases].map(l=>({long:`--${l}`,type:Io(s.type),value_type:Io(s.type)})));return Ro.set(o,r),r}async function Wr(e,t){let n=M(t),o=S(process.cwd(),n.path);if(!await V(B(o)))return;let a=ve?.key===jo(o)?ve.snapshot:null,i=a===null?await P(o):a.settings,r=mn(i.schema),s=[{path:"create",command:"create"},{path:"update",command:"update"},{path:"update-many",command:"update_many"},{path:"list",command:"list"},{path:"list-all",command:"list"},{path:"list-draft",command:"list"},{path:"list-open",command:"list"},{path:"list-in-progress",command:"list"},{path:"list-blocked",command:"list"},{path:"list-closed",command:"list"},{path:"list-canceled",command:"list"},{path:"search",command:"search"},{path:"calendar",command:"calendar"},{path:"context",command:"context"},{path:"templates save",command:"create"}];for(let l of s){let c=Z(e,l.path.split(" "));if(c)for(let d of r.command_to_fields.get(l.command)??[]){let m=d.description??"";Po(c,d.cli_flag,m,d.repeatable);for(let p of d.cli_aliases)Po(c,p,`Alias for --${d.cli_flag}`,d.repeatable)}}}async function Fo(e,t,n,o,a){let i=k(n);if(!(i!=="create"&&i!=="update"))try{let r=a??await P(t),s=le(r,o);hr(e,s,n)}catch{}}function $o(){return{enforce_item_format_gate:!0,run_preflight_item_format_sync:!0,run_extension_migrations:!0,enforce_mandatory_migration_gate:!0}}function Vr(e,t="all"){return t==="all"?`pm-root:${e}`:`pm-root:${e}:activation:${t}`}function Lo(e){return e.some(t=>t==="--profile")}function jo(e){return`pm-root:${e}`}function No(e){for(let t of e)t.startsWith("settings_read_")&&_(`[pm] warning: ${t} \u2014 settings.json could not be loaded and pm fell back to defaults; run pm health for remediation.`)}function Br(e,t){e.profile&&(_(`profile:extensions loaded=${t.loadedCount} failed=${t.loadFailedCount} warnings=${t.loadWarnings.length} activation_failed=${t.activationFailedCount} hook_counts=before:${t.hooks.beforeCommand.length}|after:${t.hooks.afterCommand.length}|write:${t.hooks.onWrite.length}|read:${t.hooks.onRead.length}|index:${t.hooks.onIndex.length} command_overrides=${t.commands.overrides.length} command_handlers=${t.commands.handlers.length} parser_overrides=${t.parsers.overrides.length} preflight_overrides=${t.preflight.overrides.length} service_overrides=${t.services.overrides.length} renderer_overrides=${t.renderers.overrides.length}`),t.activationWarnings.length>0&&_(`profile:extensions activation_warnings=${L(t.activationWarnings)}`))}function Bt(e,t,n){if(!e)return;let o=v(n.commandPath??"")||"<none>";_(`profile:extensions activation=skipped command=${o} effective=${t.discovery.effective.length} warnings=${t.discovery.warnings.length} discovery_ms=${t.discoveryMs}`)}async function Kt(e,t=xe){let n=jo(e);if(ve?.key===n)return ve.snapshot;try{let o=Date.now(),{settings:a,warnings:i}=await t(e),r=await oa({pmRoot:e,settings:a,cwd:process.cwd(),noExtensions:!1}),s={pmRoot:e,settings:a,discovery:r,discoveryMs:Date.now()-o,settingsReadWarnings:[...i]};return ve={key:n,snapshot:s},s}catch{return ve={key:n,snapshot:null},null}}async function De(e,t,n=P){let o=t?et(t):"all",a=Vr(e,o);if(at?.key===a)return at.snapshot;try{let i=await n(e),r=await Le({pmRoot:e,settings:i,cwd:process.cwd(),noExtensions:!1,extensionFilter:t?lo(t):void 0}),s=await je({...r,loaded:r.loaded}),l=[...new Set(s.commands.handlers.map(u=>v(u.command)))].filter(u=>u.length>0).sort((u,f)=>u.localeCompare(f)),c=Wi(s.registrations.flags),d=zi(s.commands.handlers,s.registrations.commands),m=Bi(l,s.registrations.commands,s.registrations.flags,d),p={hooks:s.hooks,commands:s.commands,parsers:s.parsers,preflight:s.preflight,services:s.services,renderers:s.renderers,registrations:s.registrations,pmRoot:e,settings:i,commandHandlers:l,commandFlagHelp:c,commandDescriptors:m,commandAliases:d,loadWarnings:[...r.warnings],activationWarnings:[...s.warnings],loadedCount:r.loaded.length,loadFailedCount:r.failed.length,activationFailedCount:s.failed.length,contextIntentPackages:r.loaded.map(({name:u,module:f})=>({name:u,module:f}))};return at={key:a,snapshot:p},p}catch{return at={key:a,snapshot:null},null}}async function Kr(e){let t=We(e);if(t.noExtensions){let r=S(process.cwd(),t.path);return await V(B(r))&&No((await xe(r)).warnings),null}let n=S(process.cwd(),t.path),o=await Kt(n);if(!o)return null;No(o.settingsReadWarnings);let a={commandPath:E(e),commandArgs:co(e)};if(!Qe(o.discovery,a))return Bt(t.profile,o,a),null;let i=await De(n,a);return i?(Br(t,i),{hooks:i.hooks,commands:i.commands,parsers:i.parsers,preflight:i.preflight,services:i.services,renderers:i.renderers,registrations:i.registrations,pmRoot:n}):null}async function Uo(e){let t=await De(e);return t?new Map(t.commandDescriptors):O}async function wd(e,t){return!e.requested||t.noExtensions||Te(y,e.commandPathTokens)?O:Uo(S(process.cwd(),t.path))}async function Jr(e,t){return(await Ra({pmRoot:t,migrations:e,author:"pm-extension-migration"})).migrations.filter(n=>n.outcome==="failed").map(n=>`extension_migration_failed:${n.layer}:${n.extension}:${n.id}`)}function Yr(e,t,n){let o=typeof t.author=="string"&&t.author.trim()?t.author.trim():"pm-extension";return Oa(e,si.forActiveExtensionHost({pmRoot:e,author:o}),o,v(n))}async function Xr(e,t,n,o=[]){let a=E(e),i=Yn(e.args.map(String),o),r={...t},s={...n},l=S(process.cwd(),n.path),c=await ft({command:a,args:i,options:r,global:s,pm_root:l});n.profile&&c.warnings.length>0&&_(`profile:extensions parser_warnings=${L(c.warnings)}`),i=c.context.args,r=c.context.options,s=c.context.global,go(O.get(v(a)),i,r,o),be(void 0),pt({command:a,args:i,options:{...r},global:{...s},pm_root:l});let d=await nn({command:a,args:i,options:r,global:s,pm_root:l,sdk:Yr(l,s,a)});if(s.profile&&d.warnings.length>0&&_(`profile:extensions command_handler_warnings=${L(d.warnings)}`),!d.handled){if(d.warnings.length>0){let m=d.warnings[0],p=d.errorMessage?.trim(),u=p?` ${p}`:"";throw new b(`Command "${a}" failed in extension handler (${m}).${u}`,g.GENERIC_FAILURE,{code:d.errorCode??"command_failed",nextSteps:d.remediation?[d.remediation]:void 0})}throw new b(`Command "${a}" is provided by extensions and is not currently available.`,g.NOT_FOUND)}return d.exitCode!==void 0&&(process.exitCode=d.exitCode),be(d.result),d.result}var Tr=Symbol("pm.wrappedActionHandler");function vd(e,t){let n=e[e.length-1];return n instanceof Do?n:t}function Or(e,t,n){e&&n.length>0&&_(`profile:extensions ${t}=${L(n)}`)}function bd(e){let t=O.get(v(e.commandPath));if(!t||!uo(e.activeRegistrations,e.commandPath))return;let n=Ut(t).length===0?cr(e.commandArgs):Yn(e.commandArgs,e.extensionFlagDefinitions);fo(t,n)}function Cd(e,t,n){e.args=[...n],"_processArguments"in e&&typeof e._processArguments=="function"&&e._processArguments(),t.length>0&&Array.isArray(t[0])&&(t[0]=[...e.processedArgs])}function Zr(e){let t=n=>{let o=n;if(typeof o._actionHandler=="function"&&o[Tr]!==!0){let a=o._actionHandler;o._actionHandler=async function(...i){let r=vd(i,n),s=Date.now();gn(r);let l=We(r),c=I(E(r));if(["package inventory","packages inventory","extension inventory"].includes(c))return await a.apply(this,i);let d=S(process.cwd(),l.path),m=r.args.map(String),p=ce(),u=p?tt(p,c,m):[],f=await Gr(c,d),h=$e(r,m,[...u,...f]),w=await ft({command:c,args:m,options:h,global:l,pm_root:d});Or(l.profile,"parser_warnings",w.warnings),m=w.context.args,h=w.context.options,se(r,h),l=w.context.global,bd({activeRegistrations:p,commandPath:c,commandArgs:m,extensionFlagDefinitions:u}),l=await oi(l),xt(r,l),Cd(r,i,m),Ct(r,h),be(void 0),pt({command:c,args:m,options:{...h},global:{...l},pm_root:d});let $=await nn({command:c,args:m,options:h,global:l,pm_root:d,sdk:Yr(d,l,c)});if(Or(l.profile,"command_handler_warnings",$.warnings),$.handled){be($.result),an($.result,{...l,command:c,commandArgs:m,commandOptions:h,pmRoot:d}),l.profile&&_(`profile:command=${c} took_ms=${Date.now()-s}`);return}return await a.apply(this,i)},o[Tr]=!0}for(let a of n.commands)t(a)};t(e)}async function Ht(e){O=new Map,te({overrides:[]}),e&&await Fo(e.rootProgram,e.pmRoot,e.invocationArgv,Qo(),e.settings)}function xd(e,t,n,o){if(t?.flags&&t.flags.length>0){Gn(e,t.flags);let a=Wn(e,t.flags);a&&e.addHelpText("after",a)}else n&&e.addHelpText("after",n);o&&e.addHelpText("after",o)}function Qr(e,t,n){let o={core:0,standard:1,full:2,internal:3},a=(i,r)=>{let s=r.join(" "),l=[...n.entries()].filter(([d])=>d===s||d.startsWith(`${s} `)).map(([,d])=>d),c=l.length===0?"standard":l.reduce((d,m)=>o[m.tier]<o[d]?m.tier:d,"internal");Et(i,c);for(let d of i.commands)a(d,[...r,d.name()])};for(let i of e.commands)t.has(i.name())||a(i,[i.name()])}async function es(e,t){let n=M(t),o=S(process.cwd(),n.path);if(n.noExtensions){await Ht({rootProgram:e,pmRoot:o,invocationArgv:t});return}let a=await Kt(o),i=Pe(t);if(!a){await Ht();return}if(!Qe(a.discovery,i)){await Ht({rootProgram:e,pmRoot:o,invocationArgv:t,settings:a.settings}),Bt(Lo(t),a,i);return}let r=await De(o,i);if(!r){await Ht({rootProgram:e,pmRoot:o,invocationArgv:t,settings:a.settings});return}te(r.services),O=new Map(r.commandDescriptors),await Fo(e,o,t,r.registrations,r.settings);let s=tr(e,r.commandHandlers,r.commandDescriptors,r.commandAliases,d=>nr(r.activationWarnings,_,d)),l=new Set(e.commands.map(d=>d.name())),c=d=>{let m=d.split(" ").filter(z=>z.length>0),p=r.commandDescriptors.get(d),u=Z(e,m),f=r.commandFlagHelp.get(d),h=p?Qi(p):null;if(u){xd(u,p,f,h);return}let w=er(e,m);p?.description&&w.description(p.description);let $=f;p&&(Ki(w,p),p.flags.length>0&&(Gn(w,p.flags),$=Wn(w,p.flags)??void 0)),$&&w.addHelpText("after",$),h&&w.addHelpText("after",h),w.allowUnknownOption(!0).allowExcessArguments(!0).action(async(...z)=>{let Q=z[z.length-1],G=Q instanceof Do?Q:w,st=We(G),ps=Date.now(),zo=tt(r.registrations,d,G.args.map(String)),Go=$e(G,G.args.map(String),zo),Wo=await Xr(G,Go,st,zo);await ai(st,Wo),an(Wo,{...st,command:d,commandArgs:G.args.map(String),commandOptions:Go,pmRoot:o}),st.profile&&_(`profile:command=${d} took_ms=${Date.now()-ps}`)})};for(let d of s)c(d);Qr(e,l,r.commandDescriptors)}var it=Ko(import.meta.url,["../.."])??"0.0.0",y=rn(it);async function Rr(e){if(!F)return;let t=Reflect.get(e,Dr);typeof t=="string"&&await ri(t)}async function Ir(e,t,n){let o=E(e);return["item mutate","item complete"].includes(o)&&e.optsWithGlobals().dryRun===!0?t:n()}async function Pr(e,t,n){!F||!await pn(!0)||(Ua(e,t,n,{source_context:F.source_context,source_context_source:F.source_context_source}),qa(e),Wt=F)}async function Jt(e,t,n){let o=Wt;if(!o)return;Wt=null;let a=!1;try{let i=await P(o.global_pm_root);a=i.telemetry.enabled&&i.telemetry.installation_id===o.installation_id}catch{}await pn(a)?za(e,t,n):Ha()}async function kd(e){let t=await Kr(e);return tn(t?.registrations??null),t}function ts(e,t){t&&nt(t)||(e.hook("preAction",async(n,o)=>{Ne=null,F=null,Wt=null,ut(),gn(o);let a=o.optsWithGlobals(),i=We(o),r=I(E(o)),s=o.args.map(String),l=$e(o,s),c={...i},d=S(process.cwd(),i.path),m=await kd(o);if(ya(r,{...l,outputInclude:a.outputInclude,outputLimit:a.outputLimit,outputBudget:a.outputBudget,outputFormat:a.outputFormat,outputSession:a.outputSession,outputCursor:a.outputCursor}),po(o,r,c,l),await Ir(o,void 0,()=>Ka(r,c)),!m){Ne=aa({commandName:r,commandArgs:s,commandOptions:l,globalOptions:c,pmRoot:d}),F=await fn({command:r,pm_version:it,args:s,options:l,global:c,pm_root:d}),await Rr(e),await Pr(r,s,l),await eo(r,l,d,$o()),await Qn(r,s,l,c,d);return}ia(m.hooks),ra(m.commands),sa(m.parsers),la(m.preflight),te(m.services),ca(m.renderers),tn(m.registrations);let p=tt(m.registrations,r,s);l=$e(o,s,p),po(o,r,c,l);let u=await ft({command:r,args:s,options:l,global:c,pm_root:m.pmRoot});c.profile&&u.warnings.length>0&&_(`profile:extensions parser_warnings=${L(u.warnings)}`),s=u.context.args,l=u.context.options,se(o,l),c=u.context.global,Ct(o,l);let f=await pa({command:r,args:s,options:l,global:c,pm_root:m.pmRoot,decision:$o()});c.profile&&f.warnings.length>0&&_(`profile:extensions preflight_warnings=${L(f.warnings)}`),s=f.context.args,l=f.context.options,se(o,l),c=f.context.global,Ct(o,l);let h=f.decision;await eo(r,l,m.pmRoot,h),await Qn(r,s,l,c,m.pmRoot);let w=h.run_extension_migrations?await Ir(o,[],()=>Jr(m.registrations.migrations,m.pmRoot)):[];c.profile&&w.length>0&&_(`profile:extensions migration_warnings=${L(w)}`);let $=wr(m.registrations.migrations);Ne={hooks:m.hooks,commandName:r,commandArgs:s,commandOptions:{...l},globalOptions:{...c},pmRoot:m.pmRoot,profileEnabled:!!c.profile,migrationBlockers:$},be(void 0),pt({command:r,args:s,options:{...l},global:{...c},pm_root:m.pmRoot}),F=await fn({command:r,pm_version:it,args:s,options:l,global:c,pm_root:m.pmRoot}),await Rr(e),await Pr(r,s,l);let z=await ta(m.hooks,{command:r,args:s,options:{...l},global:{...c},pm_root:m.pmRoot});c.profile&&z.length>0&&_(`profile:extensions hook_warnings=${L(z)}`),h.enforce_mandatory_migration_gate&&vr(r,l,$)}),e.hook("postAction",async()=>{let n=To();await Jt(n.ok,n.error,{error_code:n.error_code,error_category:n.error_category,exit_code:n.exit_code,command_resolution:n.command_resolution,resolution_stage:n.resolution_stage}),await rt(n),await ke()}))}ts(y);var $r=Symbol("pmCliIdempotentTopLevelRegistration");function ns(e){let t=e;if(t[$r])return;t[$r]=!0;let n=e.command.bind(e);e.command=((o,...a)=>{let i=o.split(/\s+/u)[0];return e.commands.some(r=>r.name()===i||r.aliases().includes(i))?new Do(i):n(o,...a)})}async function Ed(e,t){if(ns(e),t.setup){let{registerSetupCommands:n}=await dd();n(e)}if(t.listQuery){let{registerListQueryCommands:n}=await md(),o=typeof t.targetCommandName=="string"&&ho.has(t.targetCommandName)?new Set([t.targetCommandName]):void 0;n(e,o?{commandFilter:o}:void 0)}if(t.mutation){let{registerMutationCommands:n}=await pd();n(e,{targetCommandName:t.targetCommandName})}if(t.operation){let{registerOperationCommands:n}=await ud();n(e)}}function Sd(e){return async t=>{let n=lt(t.errorCode),o=vt({ok:!1,errorCode:t.errorCode,errorCategory:n});return await Ya({command:t.command,args:e.invocationArgv,options:t.options,global:e.bootstrapGlobal,pm_version:it,pm_root:e.bootstrapPmRoot,error_code:t.errorCode,error_message:t.errorMessage,exit_code:t.exitCode,error_category:n,command_resolution:o,resolution_stage:t.resolutionStage}),{errorCategory:n,commandResolution:o}}}async function os(e){if(e.bootstrapGlobal.noExtensions||nt(e.invocationArgv))return;let t=Pe(e.invocationArgv),n=await Kt(e.bootstrapPmRoot);if(n&&Qe(n.discovery,t)){let o=await De(e.bootstrapPmRoot,t);as(o);return}n&&Bt(Lo(e.invocationArgv),n,t),te({overrides:[]})}function as(e){if(!e){te({overrides:[]});return}te(e.services)}async function qo(e){await Jt(!1,e.errorMessage,{error_code:e.classificationCode,error_category:e.errorCategory,exit_code:e.exitCode,command_resolution:e.commandResolution,resolution_stage:e.resolutionStage}),await rt({ok:!1,error:e.errorMessage,exit_code:e.exitCode,error_code:e.classificationCode,error_category:e.errorCategory,command_resolution:e.commandResolution,resolution_stage:e.resolutionStage})}async function is(){await Jt(!0,void 0,{exit_code:g.SUCCESS,command_resolution:"success",resolution_stage:"parse"}),await rt({ok:!0,exit_code:g.SUCCESS,command_resolution:"success",resolution_stage:"parse"}),process.exitCode=g.SUCCESS}async function rs(e,t){let n=typeof t=="number"&&Number.isFinite(t);if(!(e.error instanceof b)&&(cn(e.error)||!n))return!1;let o=pe(e.error),a=e.error instanceof b?e.error.exitCode:ln(t),i=e.error instanceof b?e.error.context:void 0,r=Fr(i,e.invocationArgv,o),s=Ii(o,r),l=e.bootstrapGlobal.lean?Tt($n(o,a,r)):$n(o,a,r),c=e.jsonErrors?JSON.stringify(e.bootstrapGlobal.tokenAccounting?me(l,u=>`${JSON.stringify(u,null,2)}
|
|
34
|
-
`):l,null,2):
|
|
35
|
-
`):_(c);let{errorCategory:d,commandResolution:m}=await e.emitTelemetryCommandError({command:e.attemptedCommand,errorCode:s.code,errorMessage:s.detail,exitCode:
|
|
36
|
-
`):_(h),u&&await
|
|
37
|
-
`):_(c),r&&await
|
|
31
|
+
`)}function Tc(e,t){if(t.options.length===0){e.push(" type options: none");return}e.push(" type options:");for(let n of t.options){let o=n.required?" (required)":"",i=n.aliases??[];e.push(` - ${n.key}${o}`),e.push(` values: ${n.values.length>0?n.values.join("|"):"any non-empty string"}`),e.push(` aliases: ${i.length>0?i.join("|"):"none"}`),n.description&&n.description.trim().length>0&&e.push(` description: ${n.description.trim()}`)}}function Oc(e,t){let n=e==="create"?new Set(["title","type"]):new Set,o=new Set(n);if(e==="create")for(let i of[...t.required_create_fields,...t.required_create_repeatables])o.add(i);return{progressive:n,strict:o}}function Rc(e,t,n,o){let i=new Set(n),a=o.filter(l=>!i.has(l)),r=l=>l.length>0?l.map(c=>Xt("create",c)).join(", "):"none";e.push(` required in strict mode: ${r(a)}`);let s=a.map(ia).filter(l=>l!==void 0);e.push(` explicit empty assertion: ${s.length>0?s.join(", "):"none"}`),["Reminder","Meeting","Event"].includes(t.name)&&(e.push(" schedule preset: --schedule-preset lightweight switches schedule artifacts to progressive required-option policy."),e.push(" strict parity remains available via --create-mode strict."))}function Ic(e,t,n){let o=Pi(n);if(!o)return Ac(e,t);let i=Ko(o,t);if(!i){let h=t.types.join("|");return["",`Type-aware option policies: type "${o}" is not in the active registry.`,` active type values: ${h}`].join(`
|
|
32
|
+
`)}let a=n.indexOf("--"),r=a<0?n:n.slice(0,a),s=r.findIndex(h=>h==="--create-mode"||h.startsWith("--create-mode=")),l=s<0?void 0:r[s]?.startsWith("--create-mode=")?r[s]?.slice(14):r[s+1],c=e==="create"&&l?.toLowerCase()==="strict",d=Oc(e,i),m=ct(i,e,d.progressive),p=ct(i,e,c?d.strict:d.progressive),u=h=>h.length>0?h.map(w=>Xt(e,w)).join(", "):"none",f=["",`Type-aware option policies for ${i.name}:`,` required: ${u(p.required)}`,` disabled: ${u(p.disabled)}`,` hidden: ${u(p.hidden)}`];if(e==="create"){let h=ct(i,e,d.strict);Rc(f,i,m.required,h.required)}return Tc(f,i),p.errors.length>0&&f.push(` config errors: ${p.errors.join("; ")}`),f.join(`
|
|
33
|
+
`)}function gr(e,t,n){let o=k(n);if(o!=="create"&&o!=="update")return;let i=Je(e,o);i&&i.addHelpText("after",Ic(o,t,n))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="714821f9-dd8f-5958-a751-29e8dfc06471")}catch{}})();function Pc(e,t){return Ne(e.id)||`migration-${String(t+1).padStart(3,"0")}`}function $c(e){return Ne(e.status)?.toLowerCase()??"pending"}function Dc(e){return e.mandatory===!0}function Nc(e,t){let n=e.layer.localeCompare(t.layer);if(n!==0)return n;let o=e.name.localeCompare(t.name);return o!==0?o:e.id.localeCompare(t.id)}function _r(e){let t=[];return e.forEach((n,o)=>{if(!Dc(n.definition))return;let i=$c(n.definition);i!=="applied"&&t.push({layer:n.layer,name:n.name,id:Pc(n.definition,o),status:i})}),t.sort(Nc),t}function hr(e){return Array.isArray(e)&&e.length>0}var Mc=new Set(["create","beads import","todos import"]),Fc=new Set(["restore","update","close","delete","append","claim","release"]),Lc=new Set(["comments","notes","learnings"]),jc=new Set(["files","docs","test"]),Uc=new Set(["activate","add","add-field","add-status","add-type","apply","compact","create","deactivate","delete","disable","edit","enable","import","infer","install","materialize","migrate","redact","remove","remove-field","remove-status","remove-type","remap-status","rename-field","rename-type","repair","run","save","set","unset","update","upgrade"]);function Yn(e,t){let n=t.force===!0;return Mc.has(e)?{isMutation:!0,forceCapable:!1,forceRequested:!1}:Fc.has(e)?{isMutation:!0,forceCapable:!0,forceRequested:n}:Lc.has(e)?{isMutation:typeof t.add=="string",forceCapable:!0,forceRequested:n}:jc.has(e)?{isMutation:hr(t.add)||hr(t.remove),forceCapable:!0,forceRequested:n}:{isMutation:!1,forceCapable:!1,forceRequested:!1}}function qc(e,t,n){if(Yn(e,n).isMutation)return!0;let o=e.trim().toLowerCase();return Wi(o)?["close-many","close-task","copy","delete","discover","focus","pause-task","start-task","update-many"].includes(o)?!0:t.some(i=>Uc.has(i.trim().toLowerCase())):!1}function yr(e){return(e??"in_progress").trim().toLowerCase().replaceAll("-","_")}function Hc(e,t,n){let o=t[0]?.trim().toLowerCase()??"";if(e.trim().toLowerCase()!=="schema"||!["rename-type","rename-field","remap-status"].includes(o))return;let i=[];if(Ne(t[1])||i.push("source"),Ne(n.to)||i.push("--to"),i.length!==0)throw new b(`Schema migration requires ${i.join(", ")}.`,g.USAGE,{code:"schema_migration_input_required",required:i.join(","),why:"Schema migrations require a source and target. A workspace-bound stable migration id is derived automatically when --migration-id is omitted.",recovery:{recovery_mode:"compact",missing_required_fields:i,suggested_flags:i.filter(a=>a.startsWith("--")),suggested_retry:`pm schema ${o} <source> --to <target>`}})}async function zc(e,t,n,o,i){if(e.trim().toLowerCase()!=="update"||typeof n.status!="string"||yr(n.status)!==yr(i.schema.workflow.in_progress_status))return;let a=t[0];if(!a)return;let r=re(i,se()),s=await ht(o,a,i.id_prefix,i.item_format,r.type_to_folder);if(!s)return;let l=await Ai(s,{schema:i.schema}),c=typeof n.assignee=="string"?n.assignee.trim():void 0;(c===void 0?l.document.metadata.assignee?.trim():!["","none","null","undefined"].includes(c.toLowerCase())&&c)||_(`warning:in_progress_item_unclaimed:${s.id}:claim_with=pm claim ${s.id}`)}async function Xn(e,t,n,o,i){if(!qc(e,t,n)||(Hc(e,t,n),!await V(B(i))))return;let a=await be(i);o.json!==!0&&await zc(e,t,n,i,a.settings);let r=Gi({author:ft(o.author,a.settings.author_default),payload:{command:e,args:t,options:n},settings:a.settings.mutation_guard,force:o.force===!0||n.force===!0});for(let s of r.warnings)_(`warning:${s}`)}function wr(e,t,n){if(n.length===0)return;let o=Yn(e,t);if(!o.isMutation||o.forceCapable&&o.forceRequested)return;let i=n.map(r=>`extension_migration_blocking:${r.layer}:${r.name}:${r.id}:${r.status}`),a=o.forceCapable?"Re-run this command with --force to bypass.":"This command path does not support --force bypass.";throw new b(`Write command "${e}" blocked by unresolved mandatory extension migrations (${i.join(",")}). ${a}`,g.CONFLICT)}async function Zn(e,t,n,o){if(!Yn(e,t).isMutation||!o.enforce_item_format_gate&&!o.run_preflight_item_format_sync||!await V(B(n)))return;let{settings:i,metadata:a,warnings:r}=await be(n);for(let s of r)_(`warning:${s}`);if(o.enforce_item_format_gate&&!a.has_explicit_item_format&&(Ei(i),await Si(n,i,"item_format:auto_select_default")),o.run_preflight_item_format_sync){let s=re(i,se());await Vi(n,i.item_format,"item_format:pre_mutation_sync",s.type_to_folder,i.schema)}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c0826cb1-5181-51b3-9ad9-0cd7a3d2c4b3")}catch{}})();function Qn(e){let t=[];for(let n of e??[]){if(n.startsWith("-"))break;let o=v(n);o.length!==0&&t.push(o)}return t}function Re(e){let t=v(e.commandPath??"");if(t.length===0)return[];let n=[t],o=t.split(" ").filter(i=>i.length>0);for(let i of Qn(e.commandArgs))o.push(...i.split(" ").filter(a=>a.length>0)),n.push(o.join(" "));return[...new Set(n.flatMap(i=>[i,I(i)]))]}function eo(e,t){let n=v(e);if(n.length===0)return!1;let o=Re(t);for(let i of o)if(i===n||i.startsWith(`${n} `))return!0;return t.allowCommandPrefixMatch===!0?o.some(i=>n.startsWith(`${i} `)):!1}function Dt(e){let t=e.activation?.commands;if(t)return t;let n=e.contributions;return n?[...T(n.commands),...T(n.command_handlers),...T(n.command_overrides),...T(n.flag_commands),...T(n.parser_overrides),...vr(n.preflight_ownership),...vr(n.renderer_ownership)]:[]}function T(e){return e??[]}function vr(e){return T(e).flatMap(t=>t.commands)}function Ze(e){return new Set((e.capabilities??[]).map(t=>t.trim().toLowerCase()))}var br=new Set(["hooks","parser","preflight","renderers"]),Cr=new Set(["commands","schema","services","importers"]),Gc=new Set(["reindex","search","search-advanced"]),Wc=new Set(["--template"]);function Oe(e,t){for(let n of t)if(e.has(n))return!0;return!1}function to(e){let t=v(e??"");if(t.length===0)return!1;let[n]=t.split(" ");return Gc.has(n??t)}function no(e,t){for(let n of e.commandArgs??[]){if(!n.startsWith("--"))continue;let[o]=n.split("=",1);if(t.has(o))return!0}return!1}function Nt(e){return v(e.commandPath??"")==="create"&&no(e,Wc)}function oo(e){return e.some(t=>{let n=v(t);return n==="templates"||n.startsWith("templates ")})}function $t(e,t){return e.some(n=>eo(n,t))||Nt(t)&&oo(e)}function io(e){return[T(e.hooks).length,(e.preflight_overrides??0)-T(e.preflight_ownership).length,T(e.item_types).length,T(e.item_fields).length,T(e.relationship_kinds).length,T(e.service_overrides).length,T(e.assurance_providers).length,T(e.renderer_overrides).length-T(e.renderer_ownership).length].some(t=>t>0)}function ao(e,t){let n=e.activation?.commands??[];if(n.length>0)return $t(n,t);let o=Dt(e);if($t(o,t)||Ze(e).has("search")&&to(t.commandPath))return!0;if(e.contributions)return io(e.contributions)}function Mt(e,t){let n=ao(e,t);if(n!==void 0)return n;let o=Ze(e);return!!(Oe(o,br)||Oe(o,Cr))}function Qe(e,t){return e.effective.length===0?!1:et(t)!=="all"?e.effective.some(n=>Mt(n,t)):e.effective.some(n=>{let o=Ze(n);return Dt(n).length>0||Oe(o,br)||Oe(o,Cr)||o.has("search")})}function et(e){if(v(e.commandPath??"").split(" ")[0]==="completion")return"all";let t=Re(e).filter(o=>o.split(" ").every(i=>!i.startsWith("-"))).sort((o,i)=>i.length-o.length)[0]??v(e.commandPath??"");if(t.length===0)return"all";let n=Nt(e)?"--template":"";return`${e.allowCommandPrefixMatch===!0?"prefix":"exact"}:${t}:${n}`}function ro(e){return et(e)==="all"?void 0:t=>Mt(t,e)}function Ie(e){let t=A(e);if(t.requested&&t.commandPathTokens.length>0){let[i,...a]=t.commandPathTokens;return{commandPath:i,commandArgs:a,allowCommandPrefixMatch:!0}}let n=D(e),o=n.findIndex(i=>i.trim().length>0&&!i.startsWith("-"));return o<0?{}:{commandPath:n[o],commandArgs:n.slice(o+1),allowCommandPrefixMatch:t.requested}}function so(e){let t=e.args.map(String);if(v(E(e))==="create"){let n=e.optsWithGlobals();typeof n.template=="string"&&n.template.trim().length>0&&t.push("--template")}return t}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="873c381f-8e2f-52dd-8fc1-51b6b791ee1d")}catch{}})();var Ft=Symbol.for("pm.readOutputInvocationProvenance");function ae(e,t){let n=Reflect.get(e,Ft);n!==void 0&&Reflect.set(t,Ft,n)}function lo(e,t,n){let o=gi(t,n);if(!o)return;let i=e;for(;i.parent;)i=i.parent;let a=i.rawArgs,r=new Set(Y(a.slice(2))),s=fi.find(d=>d.command===o),l=Object.values(s?.dimensions??{}).flatMap(d=>d.legacy_aliases.flatMap(m=>r.has(m.flag)?[m.flag]:[])),c=Reflect.get(n,Ft);Reflect.set(n,Ft,{canonical_include_modes:c?.canonical_include_modes??[],explicit_legacy_aliases:l,cli_invocation_observed:!0}),ae(n,e)}function Vc(e){let t=e.optsWithGlobals(),n=E(e);if(I(n)===n)return t;let o=e.opts();for(let i=e.parent;i?.parent;i=i.parent)for(let a of i.options){let r=a.attributeName(),s=i.getOptionValueSource(r)==="cli";if(s&&!e.options.some(l=>l.long===a.long))throw new b(`Unknown option '${a.long}' for ${n}`,g.USAGE,{code:"unknown_option",flag:a.long,required:`Use options declared by pm ${n} --help.`});if(s&&e.getOptionValueSource(r)!=="cli"){let l=i.getOptionValue(r);e.setOptionValueWithSource(r,l,"cli")}r in o?t[r]=o[r]:delete t[r]}return t}function co(e,t,n,o){lo(e,t,o);let i=n.outputInclude;if(i===void 0)return;let{selectors:a,modes:r}=_i(t,i,o);if(t==="get"&&typeof o.fields=="string"&&e.setOptionValueWithSource("fields",o.fields,"cli"),r.length===0)return;ae(o,e);let s=yi(t);for(let c of r){let d=s.get(c),m=o[d];e.setOptionValueWithSource(d,m,"cli")}let l=a.length>0?a.join(","):void 0;l===void 0?delete n.outputInclude:n.outputInclude=l;for(let c=e;c;c=c.parent)c.setOptionValueWithSource("outputInclude",l,"cli");Ct(e,n)}function Pe(e,t,n=[]){let o={...Vc(e)};ae(e,o),delete o.json,delete o.quiet,delete o.path,delete o.pmPath,delete o.noExtensions,delete o.extensions,delete o.profile,delete o.pager,delete o.changedFields,delete o.fullChangedFields,delete o.idOnly,delete o.lean,delete o.tokenAccounting,delete o.outputInclude,delete o.outputLimit,delete o.outputBudget,delete o.outputFormat,delete o.outputSession;let i=sr(t);for(let[a,r]of Object.entries(i))o[a]===void 0&&(o[a]=r);if(n.length>0){let a=ir(n),r=ne(E(e)).map(c=>({long:c.flag,short:c.short,aliases:c.aliases})),s={...i};for(let c of a)o[c]!==void 0&&(s[c]=o[c]);Bn(s,[...r,...n],E(e));let l=rr(o,n,i);return ae(o,l),l}return o}function Lt(e,t){let n=v(t);return n.length===0?[]:e.flags.filter(o=>I(v(o.target_command))===I(n)).flatMap(o=>o.flags)}function tt(e,t,n){let o=Lt(e,t),i=[t],a=[];for(let r of n){if(r.startsWith("-"))break;i.push(r);let s=Lt(e,i.join(" "));s.length>0&&(a=s)}return a.length>0?a:o}function jt(e){return e.arguments??[]}function xr(e){let t=jt(e).map(n=>{let o=n.variadic?`${n.name}...`:n.name;return n.required?`<${o}>`:`[${o}]`}).join(" ");return`pm ${e.command}${t?` ${t}`:""}`}function mo(e,t){if(!e)return!1;let n=v(t);return e.importers.some(o=>v(`${o.importer} import`)===n)||e.exporters.some(o=>v(`${o.exporter} export`)===n)}function po(e,t){let n=jt(e),o=n.filter(s=>s.required).length,i=n.some(s=>s.variadic)?Number.POSITIVE_INFINITY:n.length,a=e.failure_hints??[],r=a.length>0?` ${a.join(" ")}`:"";if(t.length<o)throw new b(`Missing required argument for extension command '${e.command}'. Usage: ${xr(e)}${r}`,g.USAGE);if(t.length>i){let s=t.slice(i).join(" ");throw new b(`Too many arguments for extension command '${e.command}': ${s}. Usage: ${xr(e)}${r}`,g.USAGE)}}function Bc(e){return`--${e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}`}function Kc(e,t,n){if(n.length>0){Bn(t,n,e.command);return}let o=Object.keys(t).filter(i=>t[i]!==void 0).sort();if(o.length!==0)throw new b(`Unknown option '${o.map(Bc).join(", ")}' for extension command '${e.command}'. This command does not define extension flags.`,g.USAGE)}function uo(e,t,n,o){e&&(po(e,t),Kc(e,n,o))}import{Command as kr}from"commander";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0503f6e5-36d9-5afb-a17f-feef2241f984")}catch{}})();var Jc=new Set(["--version","-V"]);function nt(e){let t=D(e);return["package","packages","extension"].includes(t[0]??"")&&t[1]==="inventory"}function Er(e){if(D(e)[0]!=="item"||!e.includes("--dry-run"))return;let t=new kr().configureOutput({writeErr:()=>{}}).exitOverride(),n=new Set;for(let i of qe)for(let a of[i.flag,i.short,...i.aliases??[]]){if(a===void 0||n.has(a))continue;n.add(a);let r=i.value_name!==void 0||i.flag==="--pm-path";t.option(`${a}${r?" <value>":""}`)}try{t.parseOptions(e)}catch{}let o=t.opts();return{path:o.pmPath??o.path}}var Yc=new Set(["config","extension","init","install","package","packages","templates","upgrade"]),fo=new Set(["activity","aggregate","context","ctx","events","get","graph","history","list","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","search"]),Sr=new Set(["append","close","close-many","comments","delete","deps","discover","docs","files","history-repair","history-redact","history-compact","learnings","notes","plan","restore","update","update-many","create"]),Xc=new Set(["claim","close-task","contracts","duplicates","gc","health","pause-task","release","start-task","stats","test","test-all","test-runs","test-runs-worker","validate"]),Zc=new Set(["claim","close-task","pause-task","release","start-task","test"]),he={setup:!0,listQuery:!0,mutation:!0,operation:!0},Qc=new Set(["create","update","update-many","list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled","search","calendar","context","templates"]);function ot(e){return e.some(t=>Jc.has(t))}function ed(e,t){if(!R.some(o=>o.canonical_argv[0]===t))return;let n=new kr().configureOutput({writeErr:()=>{}}).exitOverride();for(let o of Yi(t,ne(t))){let i=o.takes_value?o.value_required?" <value>":" [value]":"";for(let a of[o.flag,o.short,...o.aliases??[]])a!==void 0&&n.option(`${a}${i}`)}try{let o=n.parseOptions(e.slice(1));if(o.unknown.length>0)return he;let i=q([t,...o.operands])?.alias;if(R.some(a=>a.alias===i))return{...he,targetCommandName:i}}catch{return he}}function go(e){if(ot(e))return{setup:!1,listQuery:!1,mutation:!1,operation:!1};if(e.length===0||A(e).requested)return he;let t=k(e);if(!t)return he;let n=t.trim().toLowerCase(),o=D(e),i=q(o)?.alias;return R.some(a=>a.alias===i)?{...he,targetCommandName:i}:ed(o,n==="ctx"?"context":n)||(Yc.has(n)?{setup:!0,listQuery:!1,mutation:!1,operation:!1,targetCommandName:n}:fo.has(n)?{setup:!1,listQuery:!0,mutation:!1,operation:!1,targetCommandName:n}:Sr.has(n)?{setup:!1,listQuery:!1,mutation:!0,operation:!1,targetCommandName:n}:Xc.has(n)?{setup:!1,listQuery:!1,mutation:!1,operation:!0,targetCommandName:n}:he)}function ho(e){return e.length===0||A(e).requested||e.includes("--explain")&&k(e)===void 0}function yo(e,t){return nt(t)||ot(t)?!1:oe(t)||A(t).requested?!0:!!k(t)}function _o(e){if(ot(e))return!1;let t=k(e);return t?Qc.has(t):!1}function td(e){let t=String(e.rawFrom??""),n=t.indexOf("="),o=n>=0?t.slice(0,n):t,i=e.normalizedTokens.map(c=>{let d=c.indexOf("=");return d>=0?c.slice(0,d):c}).find(c=>c==="--literal"||c==="--regex"||c==="--replacement"),a=i?e.argv.map(c=>{let d=c.indexOf("=");return(d>=0?c.slice(0,d):c)===o?d>=0?`${i}${c.slice(d)}`:i:c}):e.argv,r=je(a),s=i&&n>=0?`${o}=[redacted]`:t,l=i&&e.normalizedDisplay.includes("=")?`${i}=[redacted]`:e.normalizedDisplay;return{argv:r,normalizedDisplay:l,sourceDisplay:s}}function wo(e){let t=e.commandName;if(!t)return;let n=e.trace.find(c=>c.reason==="flag_typo");if(!n)return;let o=Array.isArray(n.to)?n.to:[String(n.to??"")].filter(c=>c.length>0),i=o.length>0?o.join(" "):"the canonical flag",a=Sr.has(t)||Zc.has(t),r=a?"mutating_flag_typo_requires_retry":"flag_typo_requires_retry",s=a?"mutating option":"option",l=td({argv:e.argv,normalizedDisplay:i,normalizedTokens:o,rawFrom:n.from});throw new b(`Refusing to auto-correct ${s} ${l.sourceDisplay} to ${l.normalizedDisplay}. Retry with the canonical flag so the command is explicit.`,g.USAGE,{code:r,examples:[x(l.argv)],nextSteps:["Retry the command with the canonical flag shown in examples."],recovery:{normalized_args:l.argv,suggested_retry:x(l.argv)}})}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6d83c356-db56-5116-9fe7-e0c27973b36f")}catch{}})();var nd=new Set(["success","nonexistent_command","invalid_option","missing_required_option","missing_required_argument","invalid_usage","validation_failed","health_findings","validation_findings","conflict","runtime_failed","unknown_failed"]),od=new Set(["parse","preflight","execute","unknown"]),id=new Set(["usage","validation","conflict","runtime","unknown"]);function ye(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="string"){let i=o.trim();if(i.length>0)return i}}}function vo(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="boolean")return o}}function Ut(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="number"&&Number.isFinite(o))return Math.max(0,Math.trunc(o))}}function bo(e){if(!e)return;let t=e.trim().toLowerCase();if(nd.has(t))return t}function Co(e){if(!e)return;let t=e.trim().toLowerCase();if(od.has(t))return t}function xo(e){if(!e)return;let t=e.trim().toLowerCase();if(id.has(t))return t}function ko(e){let t=ye(e,"error","message");if(t)return t;let n=e?.warnings;if(Array.isArray(n)){let a=n.find(r=>typeof r=="string"&&r.trim().length>0);if(typeof a=="string")return a.trim()}if(vo(e,"fail_on_skipped_triggered","failOnSkippedTriggered"))return"linked_test_fail_on_skipped_triggered";let o=Ut(e,"failed");if(typeof o=="number"&&o>0)return`failed_runs:${o}`;let i=e?.run_results;if(Array.isArray(i)){let a=i.filter(r=>Yt(r)?.status==="failed").length;if(a>0)return`failed_runs:${a}`}}function Eo(e,t){if(!e)return t===g.USAGE?"invalid_command_usage":t===g.NOT_FOUND?"item_not_found":t===g.CONFLICT?"lock_conflict":t===g.DEPENDENCY_FAILED?"dependency_failed":"command_failed"}function So(){let e=Yt(le()),t=typeof process.exitCode=="number"&&Number.isFinite(process.exitCode)?Math.max(0,Math.trunc(process.exitCode)):void 0,n=Ut(e,"exit_code","exitCode"),o=t??n??g.SUCCESS,i=ea(o),a=ye(e,"error_code","errorCode")??Eo(i,o),r=xo(ye(e,"error_category","errorCategory"))??(i?void 0:lt(a)),s=i?void 0:ko(e)??`command_exit_${o}`,l=bo(ye(e,"command_resolution","commandResolution"))??wt({ok:i,errorCode:a,errorCategory:r}),c=Co(ye(e,"resolution_stage","resolutionStage"))??"execute";return{ok:i,error:s,exit_code:o,error_code:a,error_category:r,command_resolution:l,resolution_stage:c}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="35d509e8-a50c-5f5b-b00e-810ebdc01e07")}catch{}})();var Ao="PM_CLI_PACKAGE_ROOT",Dr=Symbol("pm.deprecatedAliasInvocation"),zt=new Map;for(let e of W){let t=e.alias.split(" ")[0],n=zt.get(t)??[];n.push(e),zt.set(t,n)}for(let e of zt.values())e.sort((t,n)=>n.alias.split(" ").length-t.alias.split(" ").length);function ad(){return Wo(import.meta.url,["../.."])}(typeof process.env[Ao]!="string"||process.env[Ao]?.trim().length===0)&&(process.env[Ao]=ad());var $e=null,F=null,Gt=null;function rd(e){$e=e}function sd(e){O=e}var it=null,_e=null,O=new Map,Do=250,ld=new Set([g.USAGE,g.NOT_FOUND,g.CONFLICT]),cd=new Set(["1","true","yes","on"]),dd=ze(()=>import("./chunks/register-setup-PSJTQBBO.js")),md=ze(()=>import("./chunks/register-list-query-FKKFQ66D.js")),pd=ze(()=>import("./chunks/register-mutation-EWMMVZJB.js")),ud=ze(()=>import("./chunks/register-operations-GEQ2H7PS.js"));function Ht(e){return x(e)}function Nr(e){let t=e.match(/--[a-zA-Z0-9][a-zA-Z0-9_-]*/g);if(!t||t.length===0)return;let n=[...new Set(t.map(o=>me(o)??o))];return n.length>0?n:void 0}function fd(e,t,n){if(n?.suggested_retry||e.includes("failed in extension handler (")||!/\b(?:missing|required|requires)\b/i.test(e))return;let o=Y(t),i=new Set(o.map(d=>me(d)??d)),a=Nr(e),r=t.find(d=>y.commands.some(m=>m.name()===d)),s=r?y.commands.find(d=>d.name()===r):void 0,l=new Set([...y.options,...s?.options??[]].flatMap(d=>d.flags.split(/[ ,|]+/).map(m=>me(m)).filter(m=>m!==void 0))),c=a?.filter(d=>{let m=me(d)??d;return i.has(m)?!1:l.has(m)||Un(t,r,m,O)!==void 0});return c&&c.length>0?c:void 0}function gd(e,t,n,o){if(o?.suggested_retry)return o.suggested_retry;let i=n?.[0],a=i?me(i):void 0,r=e.find(p=>y.commands.some(u=>u.name()===p)),s=r?y.commands.find(p=>p.name()===r):void 0,l=a?s?.options.find(p=>p.flags.split(/[ ,|]+/).includes(a)):void 0,c=Un(e,r,a,O),d=a?l?.isBoolean()===!0||c===!1?[a]:[a,"<value>"]:[],m=a?Ht([...e,...d]):t;return m===t?void 0:m}function hd(e){if(!e)return{};let t=["recovery_mode","missing_required_fields","suggested_flags","suggested_retry_args","allowed_values","candidate_commands","candidate_commands_total","candidate_commands_truncated","fallback_candidates","next_best_command"],n={};for(let o of t){let i=e[o];i!=null&&(n[o]=i)}return n}function yd(e){let t=e.existingRecovery;return{attempted_command:t?.attempted_command??e.attemptedCommand,normalized_args:t?.normalized_args??[...e.invocationArgv],provided_fields:t?.provided_fields??(e.providedFields.length>0?e.providedFields:void 0),missing:t?.missing??e.inferredMissing,...hd(t),...e.suggestedRetry?{suggested_retry:e.suggestedRetry}:{}}}function Mr(e,t,n){let o=je(t),i=D(o),a=K(i),[r,s]=a===void 0?[]:i.slice(a,a+2),l=o.includes("--explain"),c=ua(o,e?.code,e?.recovery),d=c&&(r==="history-redact"||r==="history"&&s==="redact")?{...c,...c.attempted_command?{attempted_command:Ht(o)}:{},...c.normalized_args?{normalized_args:[...o]}:{},...c.suggested_retry?{suggested_retry:Ht(o)}:{},...c.suggested_retry_args?{suggested_retry_args:[...o]}:{}}:c;if(d?.recovery_mode==="compact"&&!l)return{...e,recovery:d};let m=Ht(o),p=Y(o),u=fd(n,o,d),f=gd(o,m,u,d),h=yd({invocationArgv:o,attemptedCommand:m,providedFields:p,inferredMissing:u,suggestedRetry:f,existingRecovery:d});return{...e,recovery:h}}async function rt(e){let t=F;F=null,await fa(t,e);let n=$e;if($e=null,!n){pt();return}let o=[],i=di();try{await ga({pmRoot:n.pmRoot,author:n.globalOptions.author,itemIds:e.ok?i?.map(a=>a.id)??[]:[],intent:n.commandName})}catch{o.push("context_usage_feedback_write_failed")}try{o.push(...await ti(n.hooks,{command:n.commandName,args:n.commandArgs,options:{...n.commandOptions},global:{...n.globalOptions},pm_root:n.pmRoot,ok:e.ok,error:e.error,result:le(),affected:i}))}catch(a){o=[`afterCommand hooks failed: ${a instanceof Error?a.message:String(a)}`]}finally{pt()}!n.globalOptions.json&&o.length>0&&_(`[pm] warning: afterCommand hook_warnings=${L(o)}`),n.profileEnabled&&o.length>0&&_(`profile:extensions hook_warnings=${L(o)}`)}async function Fr(){await Li()}function Lr(e){return cd.has((process.env[e]??"").trim().toLowerCase())}function jr(e){return Lr("PM_SENTRY_CAPTURE_EXPECTED_ERRORS")?!0:!ld.has(Math.trunc(e))}async function Wt(e){return jr(e.exit_code)?(await Fr(),zi(e),!0):!1}async function Ur(e){let t=de(e.error),n=Da(t);e.bootstrapGlobal.json?_(JSON.stringify(Pa(t,g.GENERIC_FAILURE),null,2)):_(t),process.exitCode=g.GENERIC_FAILURE;let o="runtime",i="runtime_failed";try{await Fr(),pn(e.error);let a=await e.emitTelemetryCommandError({command:e.attemptedCommand,errorCode:n.code,errorMessage:n.detail,exitCode:g.GENERIC_FAILURE,options:{bootstrap_global_options:e.bootstrapGlobal},resolutionStage:"execute"});o=a.errorCategory,i=a.commandResolution,await Kt(!1,t,{error_code:n.code,error_category:o,exit_code:g.GENERIC_FAILURE,command_resolution:i,resolution_stage:"execute"})}catch(a){e.bootstrapGlobal.json||_(`Failed to report error: ${de(a)}`)}try{await rt({ok:!1,error:t,exit_code:g.GENERIC_FAILURE,error_code:n.code,error_category:o,command_resolution:i,resolution_stage:"execute"})}catch(a){e.bootstrapGlobal.json||_(`Failed to run error hooks: ${de(a)}`)}try{await Ce()}catch(a){e.bootstrapGlobal.json||_(`Failed to flush error reporting: ${de(a)}`)}}var _d={create:"create",update:"update","update-many":"update_many",list:"list","list-all":"list","list-draft":"list","list-open":"list","list-in-progress":"list","list-blocked":"list","list-closed":"list","list-canceled":"list",search:"search",calendar:"calendar",context:"context","templates save":"create"},To=new Map;function Oo(e){return e==="number"?"number":e==="boolean"?"boolean":"string"}function qr(e,t){return e.options.some(n=>n.long===t)}function Hr(e,t){return e.options.some(n=>n.short===t)}function Ro(e,t,n,o){let i=t.trim();if(!i)return;let a=n.length>0?n:`Runtime schema field (${t})`;if(i.startsWith("-")&&!i.startsWith("--")){if(Hr(e,i))return;if(o){e.option(`${i} <value>`,`${a} (repeatable)`,gn);return}e.option(`${i} <value>`,a);return}let r=i.startsWith("--")?i:`--${i}`;if(!qr(e,r)){if(o){e.option(`${r} <value>`,`${a} (repeatable)`,gn);return}e.option(`${r} <value>`,a)}}async function zr(e,t){let n=_d[e];if(!n)return[];let o=`${t}:${n}`,i=To.get(o);if(i)return i;if(!await V(B(t)))return To.set(o,[]),[];let a=await P(t),r=(dn(a.schema).command_to_fields.get(n)??[]).flatMap(s=>[s.cli_flag,...s.cli_aliases].map(l=>({long:`--${l}`,type:Oo(s.type),value_type:Oo(s.type)})));return To.set(o,r),r}async function Gr(e,t){let n=M(t),o=S(process.cwd(),n.path);if(!await V(B(o)))return;let i=_e?.key===Fo(o)?_e.snapshot:null,a=i===null?await P(o):i.settings,r=dn(a.schema),s=[{path:"create",command:"create"},{path:"update",command:"update"},{path:"update-many",command:"update_many"},{path:"list",command:"list"},{path:"list-all",command:"list"},{path:"list-draft",command:"list"},{path:"list-open",command:"list"},{path:"list-in-progress",command:"list"},{path:"list-blocked",command:"list"},{path:"list-closed",command:"list"},{path:"list-canceled",command:"list"},{path:"search",command:"search"},{path:"calendar",command:"calendar"},{path:"context",command:"context"},{path:"templates save",command:"create"}];for(let l of s){let c=Z(e,l.path.split(" "));if(c)for(let d of r.command_to_fields.get(l.command)??[]){let m=d.description??"";Ro(c,d.cli_flag,m,d.repeatable);for(let p of d.cli_aliases)Ro(c,p,`Alias for --${d.cli_flag}`,d.repeatable)}}}async function No(e,t,n,o,i){let a=k(n);if(!(a!=="create"&&a!=="update"))try{let r=i??await P(t),s=re(r,o);gr(e,s,n)}catch{}}function Io(){return{enforce_item_format_gate:!0,run_preflight_item_format_sync:!0,run_extension_migrations:!0,enforce_mandatory_migration_gate:!0}}function Wr(e,t="all"){return t==="all"?`pm-root:${e}`:`pm-root:${e}:activation:${t}`}function Mo(e){return e.some(t=>t==="--profile")}function Fo(e){return`pm-root:${e}`}function Po(e){for(let t of e)t.startsWith("settings_read_")&&_(`[pm] warning: ${t} \u2014 settings.json could not be loaded and pm fell back to defaults; run pm health for remediation.`)}function Vr(e,t){e.profile&&(_(`profile:extensions loaded=${t.loadedCount} failed=${t.loadFailedCount} warnings=${t.loadWarnings.length} activation_failed=${t.activationFailedCount} hook_counts=before:${t.hooks.beforeCommand.length}|after:${t.hooks.afterCommand.length}|write:${t.hooks.onWrite.length}|read:${t.hooks.onRead.length}|index:${t.hooks.onIndex.length} command_overrides=${t.commands.overrides.length} command_handlers=${t.commands.handlers.length} parser_overrides=${t.parsers.overrides.length} preflight_overrides=${t.preflight.overrides.length} service_overrides=${t.services.overrides.length} renderer_overrides=${t.renderers.overrides.length}`),t.activationWarnings.length>0&&_(`profile:extensions activation_warnings=${L(t.activationWarnings)}`))}function Vt(e,t,n){if(!e)return;let o=v(n.commandPath??"")||"<none>";_(`profile:extensions activation=skipped command=${o} effective=${t.discovery.effective.length} warnings=${t.discovery.warnings.length} discovery_ms=${t.discoveryMs}`)}async function Bt(e,t=be){let n=Fo(e);if(_e?.key===n)return _e.snapshot;try{let o=Date.now(),{settings:i,warnings:a}=await t(e),r=await ni({pmRoot:e,settings:i,cwd:process.cwd(),noExtensions:!1}),s={pmRoot:e,settings:i,discovery:r,discoveryMs:Date.now()-o,settingsReadWarnings:[...a]};return _e={key:n,snapshot:s},s}catch{return _e={key:n,snapshot:null},null}}async function De(e,t,n=P){let o=t?et(t):"all",i=Wr(e,o);if(it?.key===i)return it.snapshot;try{let a=await n(e),r=await Fe({pmRoot:e,settings:a,cwd:process.cwd(),noExtensions:!1,extensionFilter:t?ro(t):void 0}),s=await Le({...r,loaded:r.loaded}),l=[...new Set(s.commands.handlers.map(u=>v(u.command)))].filter(u=>u.length>0).sort((u,f)=>u.localeCompare(f)),c=Ga(s.registrations.flags),d=Ha(s.commands.handlers,s.registrations.commands),m=Va(l,s.registrations.commands,s.registrations.flags,d),p={hooks:s.hooks,commands:s.commands,parsers:s.parsers,preflight:s.preflight,services:s.services,renderers:s.renderers,registrations:s.registrations,pmRoot:e,settings:a,commandHandlers:l,commandFlagHelp:c,commandDescriptors:m,commandAliases:d,loadWarnings:[...r.warnings],activationWarnings:[...s.warnings],loadedCount:r.loaded.length,loadFailedCount:r.failed.length,activationFailedCount:s.failed.length,contextIntentPackages:r.loaded.map(({name:u,module:f})=>({name:u,module:f}))};return it={key:i,snapshot:p},p}catch{return it={key:i,snapshot:null},null}}async function Br(e){let t=Ge(e);if(t.noExtensions){let r=S(process.cwd(),t.path);return await V(B(r))&&Po((await be(r)).warnings),null}let n=S(process.cwd(),t.path),o=await Bt(n);if(!o)return null;Po(o.settingsReadWarnings);let i={commandPath:E(e),commandArgs:so(e)};if(!Qe(o.discovery,i))return Vt(t.profile,o,i),null;let a=await De(n,i);return a?(Vr(t,a),{hooks:a.hooks,commands:a.commands,parsers:a.parsers,preflight:a.preflight,services:a.services,renderers:a.renderers,registrations:a.registrations,pmRoot:n}):null}async function Lo(e){let t=await De(e);return t?new Map(t.commandDescriptors):O}async function wd(e,t){return!e.requested||t.noExtensions||Se(y,e.commandPathTokens)?O:Lo(S(process.cwd(),t.path))}async function Kr(e,t){return(await Oi({pmRoot:t,migrations:e,author:"pm-extension-migration"})).migrations.filter(n=>n.outcome==="failed").map(n=>`extension_migration_failed:${n.layer}:${n.extension}:${n.id}`)}function Jr(e,t,n){let o=typeof t.author=="string"&&t.author.trim()?t.author.trim():"pm-extension";return Ti(e,ra.forActiveExtensionHost({pmRoot:e,author:o}),o,v(n))}async function Yr(e,t,n,o=[]){let i=E(e),a=Kn(e.args.map(String),o),r={...t},s={...n},l=S(process.cwd(),n.path),c=await ut({command:i,args:a,options:r,global:s,pm_root:l});n.profile&&c.warnings.length>0&&_(`profile:extensions parser_warnings=${L(c.warnings)}`),a=c.context.args,r=c.context.options,s=c.context.global,uo(O.get(v(i)),a,r,o),we(void 0),mt({command:i,args:a,options:{...r},global:{...s},pm_root:l});let d=await tn({command:i,args:a,options:r,global:s,pm_root:l,sdk:Jr(l,s,i)});if(s.profile&&d.warnings.length>0&&_(`profile:extensions command_handler_warnings=${L(d.warnings)}`),!d.handled){if(d.warnings.length>0){let m=d.warnings[0],p=d.errorMessage?.trim(),u=p?` ${p}`:"";throw new b(`Command "${i}" failed in extension handler (${m}).${u}`,g.GENERIC_FAILURE,{code:d.errorCode??"command_failed",nextSteps:d.remediation?[d.remediation]:void 0})}throw new b(`Command "${i}" is provided by extensions and is not currently available.`,g.NOT_FOUND)}return d.exitCode!==void 0&&(process.exitCode=d.exitCode),we(d.result),d.result}var Ar=Symbol("pm.wrappedActionHandler");function vd(e,t){let n=e[e.length-1];return n instanceof $o?n:t}function Tr(e,t,n){e&&n.length>0&&_(`profile:extensions ${t}=${L(n)}`)}function bd(e){let t=O.get(v(e.commandPath));if(!t||!mo(e.activeRegistrations,e.commandPath))return;let n=jt(t).length===0?lr(e.commandArgs):Kn(e.commandArgs,e.extensionFlagDefinitions);po(t,n)}function Cd(e,t,n){e.args=[...n],"_processArguments"in e&&typeof e._processArguments=="function"&&e._processArguments(),t.length>0&&Array.isArray(t[0])&&(t[0]=[...e.processedArgs])}function Xr(e){let t=n=>{let o=n;if(typeof o._actionHandler=="function"&&o[Ar]!==!0){let i=o._actionHandler;o._actionHandler=async function(...a){let r=vd(a,n),s=Date.now();fn(r);let l=Ge(r),c=I(E(r));if(["package inventory","packages inventory","extension inventory"].includes(c))return await i.apply(this,a);let d=S(process.cwd(),l.path),m=r.args.map(String),p=se(),u=p?tt(p,c,m):[],f=await zr(c,d),h=Pe(r,m,[...u,...f]),w=await ut({command:c,args:m,options:h,global:l,pm_root:d});Tr(l.profile,"parser_warnings",w.warnings),m=w.context.args,h=w.context.options,ae(r,h),l=w.context.global,bd({activeRegistrations:p,commandPath:c,commandArgs:m,extensionFlagDefinitions:u}),l=await na(l),Ct(r,l),Cd(r,a,m),bt(r,h),we(void 0),mt({command:c,args:m,options:{...h},global:{...l},pm_root:d});let $=await tn({command:c,args:m,options:h,global:l,pm_root:d,sdk:Jr(d,l,c)});if(Tr(l.profile,"command_handler_warnings",$.warnings),$.handled){we($.result),on($.result,{...l,command:c,commandArgs:m,commandOptions:h,pmRoot:d}),l.profile&&_(`profile:command=${c} took_ms=${Date.now()-s}`);return}return await i.apply(this,a)},o[Ar]=!0}for(let i of n.commands)t(i)};t(e)}async function qt(e){O=new Map,te({overrides:[]}),e&&await No(e.rootProgram,e.pmRoot,e.invocationArgv,Xo(),e.settings)}function xd(e,t,n,o){if(t?.flags&&t.flags.length>0){Hn(e,t.flags);let i=zn(e,t.flags);i&&e.addHelpText("after",i)}else n&&e.addHelpText("after",n);o&&e.addHelpText("after",o)}function Zr(e,t,n){let o={core:0,standard:1,full:2,internal:3},i=(a,r)=>{let s=r.join(" "),l=[...n.entries()].filter(([d])=>d===s||d.startsWith(`${s} `)).map(([,d])=>d),c=l.length===0?"standard":l.reduce((d,m)=>o[m.tier]<o[d]?m.tier:d,"internal");kt(a,c);for(let d of a.commands)i(d,[...r,d.name()])};for(let a of e.commands)t.has(a.name())||i(a,[a.name()])}async function Qr(e,t){let n=M(t),o=S(process.cwd(),n.path);if(n.noExtensions){await qt({rootProgram:e,pmRoot:o,invocationArgv:t});return}let i=await Bt(o),a=Ie(t);if(!i){await qt();return}if(!Qe(i.discovery,a)){await qt({rootProgram:e,pmRoot:o,invocationArgv:t,settings:i.settings}),Vt(Mo(t),i,a);return}let r=await De(o,a);if(!r){await qt({rootProgram:e,pmRoot:o,invocationArgv:t,settings:i.settings});return}te(r.services),O=new Map(r.commandDescriptors),await No(e,o,t,r.registrations,r.settings);let s=er(e,r.commandHandlers,r.commandDescriptors,r.commandAliases,d=>tr(r.activationWarnings,_,d)),l=new Set(e.commands.map(d=>d.name())),c=d=>{let m=d.split(" ").filter(z=>z.length>0),p=r.commandDescriptors.get(d),u=Z(e,m),f=r.commandFlagHelp.get(d),h=p?Za(p):null;if(u){xd(u,p,f,h);return}let w=Qa(e,m);p?.description&&w.description(p.description);let $=f;p&&(Ba(w,p),p.flags.length>0&&(Hn(w,p.flags),$=zn(w,p.flags)??void 0)),$&&w.addHelpText("after",$),h&&w.addHelpText("after",h),w.allowUnknownOption(!0).allowExcessArguments(!0).action(async(...z)=>{let Q=z[z.length-1],G=Q instanceof $o?Q:w,st=Ge(G),ms=Date.now(),qo=tt(r.registrations,d,G.args.map(String)),Ho=Pe(G,G.args.map(String),qo),zo=await Yr(G,Ho,st,qo);await oa(st,zo),on(zo,{...st,command:d,commandArgs:G.args.map(String),commandOptions:Ho,pmRoot:o}),st.profile&&_(`profile:command=${d} took_ms=${Date.now()-ms}`)})};for(let d of s)c(d);Zr(e,l,r.commandDescriptors)}var at=Vo(import.meta.url,["../.."])??"0.0.0",y=an(at);async function Or(e){if(!F)return;let t=Reflect.get(e,Dr);typeof t=="string"&&await aa(t)}async function Rr(e,t,n){let o=E(e);return["item mutate","item complete"].includes(o)&&e.optsWithGlobals().dryRun===!0?t:n()}async function Ir(e,t,n){!F||!await mn(!0)||(ji(e,t,n,{source_context:F.source_context,source_context_source:F.source_context_source}),Ui(e),Gt=F)}async function Kt(e,t,n){let o=Gt;if(!o)return;Gt=null;let i=!1;try{let a=await P(o.global_pm_root);i=a.telemetry.enabled&&a.telemetry.installation_id===o.installation_id}catch{}await mn(i)?Hi(e,t,n):qi()}async function kd(e){let t=await Br(e);return en(t?.registrations??null),t}function es(e,t){t&&nt(t)||(e.hook("preAction",async(n,o)=>{$e=null,F=null,Gt=null,pt(),fn(o);let i=o.optsWithGlobals(),a=Ge(o),r=I(E(o)),s=o.args.map(String),l=Pe(o,s),c={...a},d=S(process.cwd(),a.path),m=await kd(o);if(hi(r,{...l,outputInclude:i.outputInclude,outputLimit:i.outputLimit,outputBudget:i.outputBudget,outputFormat:i.outputFormat,outputSession:i.outputSession,outputCursor:i.outputCursor}),co(o,r,c,l),await Rr(o,void 0,()=>Bi(r,c)),!m){$e=oi({commandName:r,commandArgs:s,commandOptions:l,globalOptions:c,pmRoot:d}),F=await un({command:r,pm_version:at,args:s,options:l,global:c,pm_root:d}),await Or(e),await Ir(r,s,l),await Zn(r,l,d,Io()),await Xn(r,s,l,c,d);return}ii(m.hooks),ai(m.commands),ri(m.parsers),si(m.preflight),te(m.services),li(m.renderers),en(m.registrations);let p=tt(m.registrations,r,s);l=Pe(o,s,p),co(o,r,c,l);let u=await ut({command:r,args:s,options:l,global:c,pm_root:m.pmRoot});c.profile&&u.warnings.length>0&&_(`profile:extensions parser_warnings=${L(u.warnings)}`),s=u.context.args,l=u.context.options,ae(o,l),c=u.context.global,bt(o,l);let f=await mi({command:r,args:s,options:l,global:c,pm_root:m.pmRoot,decision:Io()});c.profile&&f.warnings.length>0&&_(`profile:extensions preflight_warnings=${L(f.warnings)}`),s=f.context.args,l=f.context.options,ae(o,l),c=f.context.global,bt(o,l);let h=f.decision;await Zn(r,l,m.pmRoot,h),await Xn(r,s,l,c,m.pmRoot);let w=h.run_extension_migrations?await Rr(o,[],()=>Kr(m.registrations.migrations,m.pmRoot)):[];c.profile&&w.length>0&&_(`profile:extensions migration_warnings=${L(w)}`);let $=_r(m.registrations.migrations);$e={hooks:m.hooks,commandName:r,commandArgs:s,commandOptions:{...l},globalOptions:{...c},pmRoot:m.pmRoot,profileEnabled:!!c.profile,migrationBlockers:$},we(void 0),mt({command:r,args:s,options:{...l},global:{...c},pm_root:m.pmRoot}),F=await un({command:r,pm_version:at,args:s,options:l,global:c,pm_root:m.pmRoot}),await Or(e),await Ir(r,s,l);let z=await ei(m.hooks,{command:r,args:s,options:{...l},global:{...c},pm_root:m.pmRoot});c.profile&&z.length>0&&_(`profile:extensions hook_warnings=${L(z)}`),h.enforce_mandatory_migration_gate&&wr(r,l,$)}),e.hook("postAction",async()=>{let n=So();await Kt(n.ok,n.error,{error_code:n.error_code,error_category:n.error_category,exit_code:n.exit_code,command_resolution:n.command_resolution,resolution_stage:n.resolution_stage}),await rt(n),await Ce()}))}es(y);var Pr=Symbol("pmCliIdempotentTopLevelRegistration");function ts(e){let t=e;if(t[Pr])return;t[Pr]=!0;let n=e.command.bind(e);e.command=((o,...i)=>{let a=o.split(/\s+/u)[0];return e.commands.some(r=>r.name()===a||r.aliases().includes(a))?new $o(a):n(o,...i)})}async function Ed(e,t){if(ts(e),t.setup){let{registerSetupCommands:n}=await dd();n(e)}if(t.listQuery){let{registerListQueryCommands:n}=await md(),o=typeof t.targetCommandName=="string"&&fo.has(t.targetCommandName)?new Set([t.targetCommandName]):void 0;n(e,o?{commandFilter:o}:void 0)}if(t.mutation){let{registerMutationCommands:n}=await pd();n(e,{targetCommandName:t.targetCommandName})}if(t.operation){let{registerOperationCommands:n}=await ud();n(e)}}function Sd(e){return async t=>{let n=lt(t.errorCode),o=wt({ok:!1,errorCode:t.errorCode,errorCategory:n});return await Ji({command:t.command,args:e.invocationArgv,options:t.options,global:e.bootstrapGlobal,pm_version:at,pm_root:e.bootstrapPmRoot,error_code:t.errorCode,error_message:t.errorMessage,exit_code:t.exitCode,error_category:n,command_resolution:o,resolution_stage:t.resolutionStage}),{errorCategory:n,commandResolution:o}}}async function ns(e){if(e.bootstrapGlobal.noExtensions||nt(e.invocationArgv))return;let t=Ie(e.invocationArgv),n=await Bt(e.bootstrapPmRoot);if(n&&Qe(n.discovery,t)){let o=await De(e.bootstrapPmRoot,t);os(o);return}n&&Vt(Mo(e.invocationArgv),n,t),te({overrides:[]})}function os(e){if(!e){te({overrides:[]});return}te(e.services)}async function jo(e){await Kt(!1,e.errorMessage,{error_code:e.classificationCode,error_category:e.errorCategory,exit_code:e.exitCode,command_resolution:e.commandResolution,resolution_stage:e.resolutionStage}),await rt({ok:!1,error:e.errorMessage,exit_code:e.exitCode,error_code:e.classificationCode,error_category:e.errorCategory,command_resolution:e.commandResolution,resolution_stage:e.resolutionStage})}async function is(){await Kt(!0,void 0,{exit_code:g.SUCCESS,command_resolution:"success",resolution_stage:"parse"}),await rt({ok:!0,exit_code:g.SUCCESS,command_resolution:"success",resolution_stage:"parse"}),process.exitCode=g.SUCCESS}async function as(e,t){let n=typeof t=="number"&&Number.isFinite(t);if(!(e.error instanceof b)&&(ln(e.error)||!n))return!1;let o=de(e.error),i=e.error instanceof b?e.error.exitCode:sn(t),a=e.error instanceof b?e.error.context:void 0,r=Mr(a,e.invocationArgv,o),s=Ra(o,r),l=e.bootstrapGlobal.lean?At(Pn(o,i,r)):Pn(o,i,r),c=e.jsonErrors?JSON.stringify(e.bootstrapGlobal.tokenAccounting?ce(l,u=>`${JSON.stringify(u,null,2)}
|
|
34
|
+
`):l,null,2):Oa(o,r);e.jsonErrors?ve(`${c}
|
|
35
|
+
`):_(c);let{errorCategory:d,commandResolution:m}=await e.emitTelemetryCommandError({command:e.attemptedCommand,errorCode:s.code,errorMessage:s.detail,exitCode:i,options:{bootstrap_global_options:e.bootstrapGlobal},resolutionStage:"execute"}),p=await Wt({command:e.attemptedCommand,error_code:s.code,error_category:d,exit_code:i,error_message:s.detail,command_resolution:m,resolution_stage:"execute",source_context:F?.source_context});return await jo({errorMessage:o,exitCode:i,classificationCode:s.code,errorCategory:d,commandResolution:m,resolutionStage:"execute"}),p&&(pn(cn(e.error,o)),await Ce(Do)),process.exitCode=i,!0}async function rs(e,t){let n=A(e.invocationArgv).commandPathTokens.join(" ")||Nn(e.invocationArgv),o=I(n),i=`unknown command '${n}'`,a=S(process.cwd(),e.bootstrapGlobal.path),r=e.bootstrapGlobal.noExtensions?O:await Lo(a),s=Ie(e.invocationArgv),l=e.bootstrapGlobal.noExtensions?[]:await Jn(a,{},Re(s)),c=await Be({message:i},y,r,{failedExtensions:l},e.invocationArgv),d=$n(c.message,c.commandName,c.allowedTypes,{unknownCommandExamples:c.unknownCommandExamples,unknownCommandNextSteps:c.unknownCommandNextSteps,attemptedCommand:c.attemptedCommand,normalizedInvocationArgs:c.normalizedInvocationArgs,providedOptionFlags:c.providedOptionFlags,unknownOptionSuggestions:c.unknownOptionSuggestions,suggestedRetryCommand:c.suggestedRetryCommand,failedExtensions:l}),{errorCategory:m,commandResolution:p}=await e.emitTelemetryCommandError({command:o,errorCode:d.code,errorMessage:d.detail,exitCode:g.USAGE,options:{bootstrap_global_options:e.bootstrapGlobal,commander_code:t??"commander.helpDisplayed"},resolutionStage:"parse"}),u=await Wt({command:o,error_code:d.code,error_category:m,exit_code:g.USAGE,error_message:d.detail,command_resolution:p,resolution_stage:"parse"}),f=e.jsonErrors?await jn({message:i},y,r,e.bootstrapGlobal.lean===!0,{failedExtensions:l},e.invocationArgv):await Ln({message:i},y,r,{failedExtensions:l},e.invocationArgv),h=Dn(f,e.jsonErrors,l);await jo({errorMessage:i,exitCode:g.USAGE,classificationCode:d.code,errorCategory:m,commandResolution:p,resolutionStage:"parse"}),e.jsonErrors?ve(`${h}
|
|
36
|
+
`):_(h),u&&await Ce(Do),process.exitCode=g.USAGE}async function ss(e,t,n){if(!(t==="commander.helpDisplayed"||t==="commander.help"||t==="commander.helpCommand")&&!n.includes("(outputHelp)"))return!1;let o=A(e.invocationArgv);return o.requested&&!Se(y,o.commandPathTokens)?(await rs(e,t),!0):(await is(),!0)}async function ls(e,t){let n=await Be(e.error,y,O,{},e.invocationArgv),o=$n(n.message,n.commandName,n.allowedTypes,{unknownCommandExamples:n.unknownCommandExamples,unknownCommandNextSteps:n.unknownCommandNextSteps,attemptedCommand:n.attemptedCommand,normalizedInvocationArgs:n.normalizedInvocationArgs,providedOptionFlags:n.providedOptionFlags,unknownOptionSuggestions:n.unknownOptionSuggestions,suggestedRetryCommand:n.suggestedRetryCommand}),{errorCategory:i,commandResolution:a}=await e.emitTelemetryCommandError({command:e.attemptedCommand,errorCode:o.code,errorMessage:o.detail,exitCode:g.USAGE,options:{bootstrap_global_options:e.bootstrapGlobal,commander_code:t},resolutionStage:"parse"}),r=await Wt({command:e.attemptedCommand,error_code:o.code,error_category:i,exit_code:g.USAGE,error_message:o.detail,command_resolution:a,resolution_stage:"parse",source_context:F?.source_context}),s=e.jsonErrors?await jn(e.error,y,O,e.bootstrapGlobal.lean===!0,{},e.invocationArgv):await Ln(e.error,y,O,{},e.invocationArgv),l=await cr(o.code,e.bootstrapPmRoot,{},Re(Ie(e.invocationArgv))),c=Dn(s,e.jsonErrors,l);await jo({errorMessage:n.message,exitCode:g.USAGE,classificationCode:o.code,errorCategory:i,commandResolution:a,resolutionStage:"parse"}),e.jsonErrors?ve(`${c}
|
|
37
|
+
`):_(c),r&&await Ce(Do),process.exitCode=g.USAGE}function cs(e){if(typeof e!="object"||e===null||!("code"in e))return!1;let t=e.code;return typeof t=="string"&&(t==="commander.version"||t.startsWith("commander."))?!0:String(e.message??"").includes("(outputHelp)")}async function ds(e){let t=e.error.code,n=String(e.error.message??"");if(!await ss(e,t,n)){if(t==="commander.version"){await is();return}await ls(e,t)}}async function Uo(e){let t=M(e.invocationArgv),n=S(process.cwd(),t.path),o={error:e.error,invocationArgv:e.invocationArgv,bootstrapGlobal:t,jsonErrors:t.json,bootstrapPmRoot:n,attemptedCommand:k(e.invocationArgv)??"<unknown>",emitTelemetryCommandError:Sd({invocationArgv:e.invocationArgv,bootstrapGlobal:t,bootstrapPmRoot:n})};if(await ns({invocationArgv:e.invocationArgv,bootstrapGlobal:t,bootstrapPmRoot:n}),!await as(o,rn(e.error))){if(cs(e.error)){await ds(o);return}await Ur({error:e.error,attemptedCommand:o.attemptedCommand,bootstrapGlobal:t,emitTelemetryCommandError:o.emitTelemetryCommandError})}}function Ad(e,t,n){let o=n.requested?n.commandPathTokens:D(t),i=q(o);if(i&&!Z(e,[...i.canonical_argv]))throw new $r(g.USAGE,"commander.unknownCommand",`unknown command '${i.alias}'`)}function Td(e,t){let n=K(t);if(n===void 0)return;if(["pm","pm-cli"].includes(t[n]?.trim().toLowerCase())){let r=K(t.slice(n+1));if(r===void 0)return;n+=r+1}let o=zt.get(t[n]),i=t.slice(n).filter(r=>!["--global","--project","--local"].includes(r)),a=o?.find(r=>r.alias.split(" ").every((s,l)=>i[l]===s));a?.lifecycle==="deprecated"&&Reflect.set(e,Dr,a.alias)}function Od(e){return[process.argv[0],process.argv[1]??"pm",...e]}async function Rd(e,t){y=an(at),y.hook("preAction",(a,r)=>{t.configurationOnly=["item mutate","item complete"].includes(E(r))&&r.optsWithGlobals().dryRun===!0}),es(y,e),it=null,_e=null,O=new Map,ci();let n=[...e],o,i;try{let a=He(e);n=a.argv,Td(y,e);let r=Od(n),s=n.length===0,l=M(n);if(l.authorMissingValue)throw new b("--author requires a non-empty value.",g.USAGE,{code:"missing_required_argument",nextSteps:["Pass an explicit author identifier with --author <id>."]});o=Mi(l.author),wo(a),i=Ii(n);let c=go(n);await Ed(y,c),Cn(y,!0),yo(y,n)?await Qr(y,n):(O=new Map,te({overrides:[]})),_o(n)&&await Gr(y,n),Cn(y);let d=A(n);Ad(y,n,d),ho(n)&&ba(y,n),Xr(y);let m=await wd(d,l);if(await fr(y,n,m,e))return;if(d.requested&&!Se(y,d.commandPathTokens))throw new $r(g.USAGE,"commander.helpDisplayed","(outputHelp)");if(s||oe(n)&&k(n)===void 0){y.outputHelp();return}if(nt(n)){await y.parseAsync(r);return}let p=S(process.cwd(),l.path),u=await P(p),f=await Ua(n,p,l.noExtensions,De);await Ci({pmRoot:p,packages:f?.contextIntentPackages},()=>xi({env:{...process.env,PM_PATH:p},argv:r,cwd:process.cwd()},()=>ki(u.agent_identity.harness_signals,()=>y.parseAsync(r),{probesEnabled:u.agent_identity?.probes_enabled})))}catch(a){await Uo({error:a,invocationArgv:n})}finally{i?.(),o?.()}}async function nu(e=process.argv.slice(2)){let t=e;try{t=He(e).argv}catch{}let n=Er(t),o={configurationOnly:n!==void 0},i=()=>o.configurationOnly,a=async()=>{try{await Fi(process.env,()=>Rd(e,o))}catch(r){await Uo({error:r,invocationArgv:[...e]})}};if(n!==void 0){let r=S(process.cwd(),M(t).path),s=S(process.cwd(),n.path),l=Yo(process.cwd());await gt(r,()=>gt(s,()=>gt(l,a,i),i),i)}else await a()}var ou={activationCommandMatchesProbe:eo,applyDynamicExtensionRootHelpVisibility:Zr,bootstrapProfileEnabled:Mo,buildBootstrapActivationProbe:Ie,buildPostActionTelemetryOutcome:So,buildPmCliRecoveryContext:Mr,buildRuntimeExtensionDiscoverySnapshotCacheKey:Fo,buildRuntimeExtensionActivationScope:et,buildRuntimeExtensionSnapshotCacheKey:Wr,buildRuntimeExtensionFilterForProbe:ro,addRuntimeFieldOption:Ro,collectActivationCommandCandidates:Re,collectExtensionFlagDefinitionsForCommand:Lt,collectExtensionFlagDefinitionsForInvocation:tt,collectLeadingCommandArgs:Qn,collectParsedActivationCommandArgs:so,collectRuntimeFieldLooseFlagDefinitionsForCommand:zr,commandHasLongOption:qr,commandHasShortOption:Hr,commandPathNeedsSearchExtensions:to,commandPathNeedsTemplateExtensions:Nt,describeUnknownError:de,defaultPreflightDecision:Io,discoveryNeedsActivationForProbe:Qe,emitExtensionProfile:Vr,emitExtensionSkippedProfile:Vt,emitSettingsReadWarnings:Po,ensureIdempotentTopLevelCommandRegistration:ts,enforceExplicitRetryForFlagTypos:wo,envFlagEnabled:Lr,executeRegisteredRuntimeMigrations:Kr,extractCommandScopedOptions:Pe,extensionActivationCommands:Dt,extensionCapabilities:Ze,extensionNeedsActivationForProbe:Mt,extensionProvidesTemplatesRuntime:oo,hasAnyCapability:Oe,hasGlobalExtensionContributions:io,handleGenericRunPmCliError:Ur,handleRunPmCliCommanderError:ds,handleRunPmCliError:Uo,handleRunPmCliHelpDisplayError:ss,handleRunPmCliKnownError:as,handleRunPmCliCommanderUsageError:ls,handleUnknownHelpCommandError:rs,inferMissingFieldsFromErrorMessage:Nr,inferPostActionErrorCode:Eo,inferPostActionFailureMessage:ko,invocationRequestsVersion:ot,isCommanderError:ln,loadRuntimeExtensionCommandDescriptorsForRecovery:Lo,loadRuntimeExtensionDiscoverySnapshot:Bt,loadRuntimeExtensionSnapshot:De,maybeLoadRuntimeExtensions:Br,maybeAttachCreateUpdatePolicyHelpText:No,maybeLogHandledCliErrorToSentry:Wt,matchesStaticExtensionCommand:$t,normalizeTelemetryCommandResolution:bo,normalizeTelemetryErrorCategory:xo,normalizeTelemetryResolutionStage:Co,normalizeThrownExitCode:sn,probeUsesAnyFlag:no,prepareExtensionServicesForRunPmCliError:ns,readRecordBoolean:vo,readRecordNumber:Ut,readRecordString:ye,recordCliReadOutputInvocationProvenance:lo,registerDynamicExtensionCommandPaths:Qr,registerRuntimeSchemaFieldFlags:Gr,resolveCoreCommandRegistrationSelection:go,resolveStaticExtensionActivationDecision:ao,resolveUnknownHelpToken:Nn,readThrownExitCode:rn,runAndClearAfterCommandHooks:rt,runRequiredExtensionCommand:Yr,shouldAttachRichHelpTextForInvocation:ho,shouldLogHandledErrorToSentry:jr,shouldRegisterDynamicExtensionPaths:yo,shouldRegisterRuntimeSchemaFlags:_o,shouldHandleRunPmCliCommanderError:cs,setActiveExtensionHookContextForTest:rd,setActiveRuntimeExtensionCommandDescriptorsForTest:sd,setRecoveredExtensionServices:os,toLooseFieldDefinitionType:Oo,isImporterOrExporterCommandPath:mo,validateDynamicExtensionCommandInvocation:uo,wrapProgramActionsForExtensionHandlers:Xr,wrapThrownErrorForSentry:cn};export{ou as _testOnly,nu as runPmCli};
|
|
38
38
|
//# sourceMappingURL=main.js.map
|