@unbrained/pm-cli 2026.11.22 → 2026.11.24
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/dist/cli/after-command-context-usage.js +1 -1
- package/dist/cli/argv-utils.js +1 -1
- package/dist/cli/bootstrap-args.js +1 -1
- package/dist/cli/bundle-integrity.js +2 -2
- package/dist/cli/command-namespaces.js +1 -1
- package/dist/cli/commander-usage.js +11 -11
- package/dist/cli/commands/annotations/comments.js +1 -1
- package/dist/cli/commands/annotations/docs.js +1 -1
- package/dist/cli/commands/annotations/files.js +1 -1
- package/dist/cli/commands/annotations/learnings.js +1 -1
- package/dist/cli/commands/annotations/notes.js +1 -1
- package/dist/cli/commands/extension/describe.js +1 -1
- package/dist/cli/commands/extension/extension.js +1 -1
- package/dist/cli/commands/extension/scaffold.js +1 -1
- package/dist/cli/commands/extension/shared.js +1 -1
- package/dist/cli/commands/governance/gc.js +1 -1
- package/dist/cli/commands/governance/health.js +1 -1
- package/dist/cli/commands/governance/telemetry.js +1 -1
- package/dist/cli/commands/governance/validate.js +1 -1
- package/dist/cli/commands/history/activity.js +1 -1
- package/dist/cli/commands/history/history-compact.js +1 -1
- package/dist/cli/commands/history/history-redact.js +1 -1
- package/dist/cli/commands/history/history-repair.js +1 -1
- package/dist/cli/commands/history/history.js +1 -1
- package/dist/cli/commands/history/restore.js +1 -1
- package/dist/cli/commands/lifecycle/append.js +1 -1
- package/dist/cli/commands/lifecycle/claim.js +1 -1
- package/dist/cli/commands/lifecycle/close-many.js +1 -1
- package/dist/cli/commands/lifecycle/close.js +1 -1
- package/dist/cli/commands/lifecycle/copy.js +1 -1
- package/dist/cli/commands/lifecycle/create.js +1 -1
- package/dist/cli/commands/lifecycle/delete.js +1 -1
- package/dist/cli/commands/lifecycle/focus.js +1 -1
- package/dist/cli/commands/lifecycle/plan.js +1 -1
- package/dist/cli/commands/lifecycle/update-many.js +1 -1
- package/dist/cli/commands/lifecycle/update.js +1 -1
- package/dist/cli/commands/query/aggregate.js +1 -1
- package/dist/cli/commands/query/context.js +1 -1
- package/dist/cli/commands/query/deps.js +1 -1
- package/dist/cli/commands/query/duplicates.js +1 -1
- package/dist/cli/commands/query/eval.js +1 -1
- package/dist/cli/commands/query/get.js +1 -1
- package/dist/cli/commands/query/graph.js +1 -1
- package/dist/cli/commands/query/list.js +1 -1
- package/dist/cli/commands/query/next.js +1 -1
- package/dist/cli/commands/query/search.js +1 -1
- package/dist/cli/commands/query/stats.js +1 -1
- package/dist/cli/commands/test/test-all.js +1 -1
- package/dist/cli/commands/test/test-runs.js +1 -1
- package/dist/cli/commands/test/test.js +1 -1
- package/dist/cli/commands/workspace/config.js +1 -1
- package/dist/cli/commands/workspace/contracts.js +1 -1
- package/dist/cli/commands/workspace/init.js +1 -1
- package/dist/cli/commands/workspace/merge.js +1 -1
- package/dist/cli/commands/workspace/profile.js +1 -1
- package/dist/cli/commands/workspace/schema.js +1 -1
- package/dist/cli/commands/workspace/upgrade.js +1 -1
- package/dist/cli/context-intent-invocation.js +1 -1
- package/dist/cli/description-stdin.js +1 -1
- package/dist/cli/error-guidance.js +5 -5
- package/dist/cli/expected-revisions.js +1 -1
- package/dist/cli/extension-command-help.js +6 -6
- package/dist/cli/extension-recovery.js +1 -1
- package/dist/cli/help-content.js +5 -5
- package/dist/cli/help-json-payload.js +7 -7
- package/dist/cli/invocation-profile.js +2 -2
- package/dist/cli/main.js +5 -5
- package/dist/cli/migration-gates.js +1 -1
- package/dist/cli/option-values.js +1 -1
- package/dist/cli/preflight-warnings.js +3 -3
- package/dist/cli/public.js +1 -1
- package/dist/cli/register-annotations.js +1 -1
- package/dist/cli/register-assurance.js +1 -1
- package/dist/cli/register-files-lookup.js +1 -1
- package/dist/cli/register-history-activity.js +1 -1
- package/dist/cli/register-history-author.js +1 -1
- package/dist/cli/register-history-maintenance.js +2 -2
- package/dist/cli/register-list-query.js +10 -10
- package/dist/cli/register-mutation-options.js +0 -1
- package/dist/cli/register-mutation.js +6 -6
- package/dist/cli/register-operations.js +1 -1
- package/dist/cli/register-setup.js +1 -1
- package/dist/cli/register-structured-mutation.js +1 -1
- package/dist/cli/registration-helpers.js +1 -1
- package/dist/cli/runtime/activation.js +1 -1
- package/dist/cli/runtime/annotation-option-retry.js +1 -1
- package/dist/cli/runtime/close-fields-retry.js +1 -1
- package/dist/cli/runtime/field-route-retry.js +1 -1
- package/dist/cli/runtime/invocation-options.js +1 -1
- package/dist/cli/runtime/invocation-rewrites.js +1 -1
- package/dist/cli/runtime/projection-retry.js +1 -1
- package/dist/cli/runtime/read-output-mutation-retry.js +1 -1
- package/dist/cli/runtime/refusal-credential-redaction.js +1 -1
- package/dist/cli/runtime/selection.js +1 -1
- package/dist/cli/runtime/telemetry-outcome.js +1 -1
- package/dist/cli/runtime-compatibility-boundary.js +4 -4
- package/dist/cli/schema/registration.js +15 -15
- package/dist/cli/schema-registration-helpers.js +1 -1
- package/dist/cli/search-refresh.js +1 -1
- package/dist/cli/stats-analytics-json.js +1 -1
- package/dist/cli/telemetry-flush.js +1 -1
- package/dist/cli-bundle/bundle-manifest.json +1 -1
- package/dist/cli-bundle/chunks/chunk-23K6DQQY.js +9 -0
- package/dist/cli-bundle/chunks/chunk-37UDIJ2K.js +3 -0
- package/dist/cli-bundle/chunks/chunk-5DUP4AZA.js +2 -0
- package/dist/cli-bundle/chunks/chunk-6H36ZHMI.js +2 -0
- package/dist/cli-bundle/chunks/chunk-7IROAPWI.js +3 -0
- package/dist/cli-bundle/chunks/chunk-7VRFEURZ.js +33 -0
- package/dist/cli-bundle/chunks/chunk-7X253M6Z.js +3 -0
- package/dist/cli-bundle/chunks/chunk-AA52P34H.js +3 -0
- package/dist/cli-bundle/chunks/chunk-AWB5KBJS.js +2 -0
- package/dist/cli-bundle/chunks/chunk-D6PDUKUG.js +9 -0
- package/dist/cli-bundle/chunks/chunk-DQDRA3SW.js +2 -0
- package/dist/cli-bundle/chunks/chunk-FXJYZBWV.js +113 -0
- package/dist/cli-bundle/chunks/chunk-HNKK2UG6.js +8 -0
- package/dist/cli-bundle/chunks/chunk-HZZLSBIJ.js +2 -0
- package/dist/cli-bundle/chunks/chunk-I2OJ5B4A.js +2 -0
- package/dist/cli-bundle/chunks/chunk-I3BFCKZR.js +2 -0
- package/dist/cli-bundle/chunks/chunk-MXUSC5RS.js +31 -0
- package/dist/cli-bundle/chunks/chunk-PLIUU37C.js +3 -0
- package/dist/cli-bundle/chunks/chunk-PQUBVRV5.js +2 -0
- package/dist/cli-bundle/chunks/chunk-PW7U7WCE.js +3 -0
- package/dist/cli-bundle/chunks/chunk-PZA7QECY.js +1 -0
- package/dist/cli-bundle/chunks/chunk-SLFRSZK6.js +1 -0
- package/dist/cli-bundle/chunks/chunk-SSALO4DB.js +2 -0
- package/dist/cli-bundle/chunks/chunk-STOOTHZZ.js +2 -0
- package/dist/cli-bundle/chunks/chunk-TKRY22SO.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-B76TFRO2.js → chunk-TVIJ2VCU.js} +93 -93
- package/dist/cli-bundle/chunks/chunk-VJSGUXGU.js +3 -0
- package/dist/cli-bundle/chunks/chunk-WWTPNIC2.js +6 -0
- package/dist/cli-bundle/chunks/chunk-XFADNMGD.js +2 -0
- package/dist/cli-bundle/chunks/chunk-YOPTAIBD.js +125 -0
- package/dist/cli-bundle/chunks/chunk-YW2HBHRO.js +70 -0
- package/dist/cli-bundle/chunks/chunk-YYT3MIRF.js +3 -0
- package/dist/cli-bundle/chunks/chunk-Z7MFVRDV.js +2 -0
- package/dist/cli-bundle/chunks/chunk-ZOX4SWRL.js +8 -0
- package/dist/cli-bundle/chunks/chunk-ZYCOM4MS.js +9 -0
- package/dist/cli-bundle/chunks/context-budget-recovery-M5RFUEFG.js +2 -0
- package/dist/cli-bundle/chunks/field-option-collisions-W66HSWMK.js +2 -0
- package/dist/cli-bundle/chunks/indexed-receipt-blobs-BPYKN5Q7.js +4 -0
- package/dist/cli-bundle/{focused-chunks/item-revision-2O6MLPEX.js → chunks/item-revision-D3LSBNIR.js} +2 -2
- package/dist/cli-bundle/chunks/item-transaction-M6NTBYH3.js +2 -0
- package/dist/cli-bundle/chunks/mutation-actor-OKL3CQVX.js +2 -0
- package/dist/cli-bundle/chunks/mutation-admission-EKPEOZMF.js +2 -0
- package/dist/cli-bundle/chunks/{register-list-query-RR5KACJ3.js → register-list-query-3LBV6CS2.js} +11 -11
- package/dist/cli-bundle/chunks/register-mutation-72AGTMNE.js +21 -0
- package/dist/cli-bundle/chunks/register-operations-XERFG2SH.js +2 -0
- package/dist/cli-bundle/chunks/register-setup-W22L34Z4.js +2 -0
- package/dist/cli-bundle/chunks/runtime-schema-JP2KBHBY.js +2 -0
- package/dist/cli-bundle/chunks/settlement-hook-6MR32OOC.js +7 -0
- package/dist/cli-bundle/chunks/stage-T2LKWN7C.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-24VRBNKE.js +26 -0
- package/dist/cli-bundle/focused-chunks/chunk-3ELVASVA.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-3GT4A3ZN.js +44 -0
- package/dist/cli-bundle/focused-chunks/chunk-3OCDKITJ.js +3 -0
- package/dist/cli-bundle/focused-chunks/chunk-3Z7MCUJM.js +3 -0
- package/dist/cli-bundle/focused-chunks/chunk-46MP7IZN.js +5 -0
- package/dist/cli-bundle/focused-chunks/chunk-5LDBS6MS.js +91 -0
- package/dist/cli-bundle/focused-chunks/chunk-A6VEMCRR.js +3 -0
- package/dist/cli-bundle/focused-chunks/chunk-AIDL2ZNT.js +3 -0
- package/dist/cli-bundle/focused-chunks/chunk-B6BNHKUW.js +78 -0
- package/dist/cli-bundle/focused-chunks/chunk-BKPUUW5O.js +1 -0
- package/dist/cli-bundle/focused-chunks/chunk-BWOVFE5B.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-C7WHWI7K.js +3 -0
- package/dist/cli-bundle/focused-chunks/chunk-EUQGZPGO.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-FDZPRJXJ.js +27 -0
- package/dist/cli-bundle/focused-chunks/chunk-GXP7Q4XM.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-HL47UQZJ.js +8 -0
- package/dist/cli-bundle/focused-chunks/chunk-IIP6LZ5E.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-K53OIT5J.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-LMFIAQ2V.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-LMU7DDOA.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-OZOCEB2Q.js +8 -0
- package/dist/cli-bundle/focused-chunks/chunk-Q2HY44LV.js +13 -0
- package/dist/cli-bundle/focused-chunks/chunk-REFMQY47.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-RIE3SJSE.js +9 -0
- package/dist/cli-bundle/focused-chunks/chunk-RIQUIHYU.js +3 -0
- package/dist/cli-bundle/focused-chunks/chunk-RLO2HCZT.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-SMMOZ3H3.js +100 -0
- package/dist/cli-bundle/focused-chunks/chunk-UVTUX54T.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-X6CXWWNB.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-XDBHD4CY.js +8 -0
- package/dist/cli-bundle/focused-chunks/chunk-YD66IRSL.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-Z7W2RQIB.js +2 -0
- package/dist/cli-bundle/focused-chunks/context-budget-recovery-CSJV3TY3.js +2 -0
- package/dist/cli-bundle/focused-chunks/field-option-collisions-UODPSV6W.js +2 -0
- package/dist/cli-bundle/focused-chunks/indexed-receipt-blobs-EGEJMG3G.js +4 -0
- package/dist/cli-bundle/focused-chunks/item-revision-QH7RNBX4.js +2 -0
- package/dist/cli-bundle/focused-chunks/item-transaction-ZO72OINF.js +2 -0
- package/dist/cli-bundle/focused-chunks/mutation-actor-PHVLKG4I.js +2 -0
- package/dist/cli-bundle/focused-chunks/mutation-admission-ZSG5OECH.js +2 -0
- package/dist/cli-bundle/focused-chunks/runtime-schema-6RQMIDTN.js +2 -0
- package/dist/cli-bundle/focused-chunks/settlement-hook-FMLGKG7J.js +7 -0
- package/dist/cli-bundle/focused-chunks/stage-AQMKRVX4.js +2 -0
- package/dist/cli-bundle/main.js +27 -27
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +5 -5
- package/dist/cli-bundle/sdk-core.js +1 -1
- 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 +66 -66
- 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 +13 -13
- package/dist/cli.js +1 -1
- package/dist/core/checkpoint/checkpoint-gc.js +1 -1
- package/dist/core/checkpoint/mutation-checkpoint.js +2 -2
- package/dist/core/checkpoint/mutation-context.js +1 -1
- package/dist/core/config/nested-settings.js +1 -1
- package/dist/core/config/positional-value.js +1 -1
- package/dist/core/diagnostics/remediation.js +1 -1
- package/dist/core/extensions/activation-summary-markdown.js +2 -2
- package/dist/core/extensions/activation-summary.js +1 -1
- package/dist/core/extensions/activation-transaction.js +1 -1
- package/dist/core/extensions/capability-usage.js +1 -1
- package/dist/core/extensions/command-hook-context.js +1 -1
- package/dist/core/extensions/command-metadata-contract.js +1 -1
- package/dist/core/extensions/command-visibility-tier.js +1 -1
- package/dist/core/extensions/contribution-inventory.js +1 -1
- package/dist/core/extensions/exporter-output-contract.js +1 -1
- package/dist/core/extensions/extension-candidate.js +1 -1
- package/dist/core/extensions/extension-capability-aliases.js +1 -1
- package/dist/core/extensions/extension-hook-runtime.js +1 -1
- package/dist/core/extensions/extension-policy.js +1 -1
- package/dist/core/extensions/extension-registries.js +1 -1
- package/dist/core/extensions/extension-runtime-helpers.js +1 -1
- package/dist/core/extensions/extension-types.js +1 -1
- package/dist/core/extensions/flag-definition-validation.js +1 -1
- package/dist/core/extensions/flag-value-types.js +1 -1
- package/dist/core/extensions/index.js +1 -1
- package/dist/core/extensions/item-field-types.js +1 -1
- package/dist/core/extensions/item-fields.js +1 -1
- package/dist/core/extensions/loader.js +1 -1
- package/dist/core/extensions/manifest-parser.js +1 -1
- package/dist/core/extensions/manifest-schema.js +1 -1
- package/dist/core/extensions/module-graph-snapshot.js +1 -1
- package/dist/core/extensions/mutation-actor-snapshot.js +1 -1
- package/dist/core/extensions/mutation-actor.js +1 -1
- package/dist/core/extensions/preflight-ownership.js +1 -1
- package/dist/core/extensions/read-output-contract.js +1 -1
- package/dist/core/extensions/registration-contracts.js +1 -1
- package/dist/core/extensions/registration-validation.js +1 -1
- package/dist/core/extensions/registration-values.js +1 -1
- package/dist/core/extensions/reserved-host-flags.js +1 -1
- package/dist/core/extensions/runtime-registrations.js +1 -1
- package/dist/core/extensions/service-ownership.js +1 -1
- package/dist/core/extensions/version-compat.js +1 -1
- package/dist/core/extensions/version-diagnostics.js +1 -1
- package/dist/core/fs/atomic-create.js +1 -1
- package/dist/core/fs/file-glob.js +1 -1
- package/dist/core/fs/fs-utils.js +2 -2
- package/dist/core/fs/host-environment-errors.js +1 -1
- package/dist/core/fs/index.js +1 -1
- package/dist/core/fs/path-utils.js +1 -1
- package/dist/core/governance/content-fields.js +1 -1
- package/dist/core/governance/issue-codes.js +1 -1
- package/dist/core/governance/metadata-coverage.js +1 -1
- package/dist/core/history/bridge.js +1 -1
- package/dist/core/history/digest.js +1 -1
- package/dist/core/history/drift-cache.js +3 -3
- package/dist/core/history/drift-scan.js +1 -1
- package/dist/core/history/event-classification.js +1 -1
- package/dist/core/history/event-index.js +11 -11
- package/dist/core/history/history-compact-bulk.js +1 -1
- package/dist/core/history/history-diff.js +1 -1
- package/dist/core/history/history-rewrite.js +1 -1
- package/dist/core/history/history-storage-stats.js +1 -1
- package/dist/core/history/history-stream-policy.js +1 -1
- package/dist/core/history/history.js +2 -2
- package/dist/core/history/identity.js +1 -1
- package/dist/core/history/index.js +1 -1
- package/dist/core/history/operation-contract.js +1 -1
- package/dist/core/history/projection.js +1 -1
- package/dist/core/history/read.js +1 -1
- package/dist/core/history/replay.js +2 -2
- package/dist/core/history/stream-summary.js +2 -2
- package/dist/core/history/tombstone.js +1 -1
- package/dist/core/history/version-address.js +1 -1
- package/dist/core/history/workspace-history.js +2 -2
- package/dist/core/io/body-file.js +1 -1
- package/dist/core/io/bulk-ids-input.js +2 -2
- package/dist/core/item/actionability.js +1 -1
- package/dist/core/item/deferred-fields.js +1 -1
- package/dist/core/item/dependency-reference.js +1 -1
- package/dist/core/item/id.js +1 -1
- package/dist/core/item/index.js +1 -1
- package/dist/core/item/item-format-version.js +1 -1
- package/dist/core/item/item-format.js +7 -7
- package/dist/core/item/item-record.js +1 -1
- package/dist/core/item/item-type-definition.js +1 -1
- package/dist/core/item/literal-mutation-input.js +1 -1
- package/dist/core/item/parent-reference-policy.js +1 -1
- package/dist/core/item/parse.js +8 -8
- package/dist/core/item/plan-lifecycle.js +1 -1
- package/dist/core/item/priority.js +1 -1
- package/dist/core/item/sprint-release-format.js +1 -1
- package/dist/core/item/status-filter.js +1 -1
- package/dist/core/item/status.js +1 -1
- package/dist/core/item/toon-decode.js +1 -1
- package/dist/core/item/type-registry.js +1 -1
- package/dist/core/item/type-synonyms.js +1 -1
- package/dist/core/lock/index.js +1 -1
- package/dist/core/lock/lock-confinement.js +1 -1
- package/dist/core/lock/lock-gc.js +1 -1
- package/dist/core/lock/lock-owner.js +1 -1
- package/dist/core/lock/lock.js +4 -4
- package/dist/core/output/linked-test-projection.js +5 -5
- package/dist/core/output/mutation-projection.js +1 -1
- package/dist/core/output/output-control.js +1 -1
- package/dist/core/output/output.js +19 -19
- package/dist/core/output/query-summary.js +1 -1
- package/dist/core/output/tabular.js +3 -3
- package/dist/core/packages/manifest.js +1 -1
- package/dist/core/packages/root.js +1 -1
- package/dist/core/policy/workflow-policy-schema.js +1 -1
- package/dist/core/policy/workflow-policy-store.js +1 -1
- package/dist/core/policy/workflow-policy.js +1 -1
- package/dist/core/profile/profile-describe.js +1 -1
- package/dist/core/profile/profile-lint.d.ts +1 -1
- package/dist/core/profile/profile-lint.js +1 -1
- package/dist/core/profile/profile-plan.js +1 -1
- package/dist/core/profile/profile-presets.js +4 -4
- package/dist/core/reproducibility/context.js +1 -1
- package/dist/core/schema/fields-file.js +2 -2
- package/dist/core/schema/item-types-file.js +2 -2
- package/dist/core/schema/runtime-field-filters.js +1 -1
- package/dist/core/schema/runtime-field-values.js +1 -1
- package/dist/core/schema/runtime-schema.d.ts +2 -0
- package/dist/core/schema/runtime-schema.js +2 -2
- package/dist/core/schema/status-defs-file.js +2 -2
- package/dist/core/schema/status-token.js +1 -1
- package/dist/core/schema/type-inference.js +1 -1
- package/dist/core/schema/type-presets.js +1 -1
- package/dist/core/schema/type-workflows.js +1 -1
- package/dist/core/search/background-refresh.js +2 -2
- package/dist/core/search/bm25.js +1 -1
- package/dist/core/search/cache.js +2 -2
- package/dist/core/search/corpus.js +1 -1
- package/dist/core/search/embedding-batches.js +1 -1
- package/dist/core/search/eval-thresholds.js +1 -1
- package/dist/core/search/eval.js +1 -1
- package/dist/core/search/http-client.js +1 -1
- package/dist/core/search/providers.js +1 -1
- package/dist/core/search/relevance.js +1 -1
- package/dist/core/search/semantic-defaults.js +1 -1
- package/dist/core/search/staleness.js +1 -1
- package/dist/core/search/vector-stores.js +2 -2
- package/dist/core/search/vectorization-metadata.js +1 -1
- package/dist/core/sentry/helpers.js +1 -1
- package/dist/core/sentry/instrument.js +1 -1
- package/dist/core/sentry/sensitive-assignments.js +1 -1
- package/dist/core/session/session-state.js +1 -1
- package/dist/core/shared/agent-session-context.js +1 -1
- package/dist/core/shared/author.js +5 -5
- package/dist/core/shared/command-line.js +1 -1
- package/dist/core/shared/command-types.js +0 -1
- package/dist/core/shared/conflict-markers.js +1 -1
- package/dist/core/shared/constants.js +1 -1
- package/dist/core/shared/error-details.js +1 -1
- package/dist/core/shared/errors.js +1 -1
- package/dist/core/shared/html-entity-decode.js +1 -1
- package/dist/core/shared/index.js +1 -1
- package/dist/core/shared/item-metadata-contract.js +1 -1
- package/dist/core/shared/lazy-module.js +1 -1
- package/dist/core/shared/levenshtein.js +1 -1
- package/dist/core/shared/memo.js +1 -1
- package/dist/core/shared/numeric-parsers.js +1 -1
- package/dist/core/shared/option-alias-visibility.js +1 -1
- package/dist/core/shared/output-unicode.js +1 -1
- package/dist/core/shared/primitives.js +1 -1
- package/dist/core/shared/process-tree.js +2 -2
- package/dist/core/shared/secret-rules.js +5 -5
- package/dist/core/shared/serial-queue.js +1 -1
- package/dist/core/shared/serialization.js +1 -1
- package/dist/core/shared/split-comma-list.js +1 -1
- package/dist/core/shared/text-normalization.js +1 -1
- package/dist/core/shared/time.js +2 -2
- package/dist/core/shared/url-credentials.js +1 -1
- package/dist/core/store/index.js +1 -1
- package/dist/core/store/item-format-migration.js +1 -1
- package/dist/core/store/item-metadata-cache.js +1 -1
- package/dist/core/store/item-metadata-query-index.js +11 -11
- package/dist/core/store/item-metadata-read-work.js +1 -1
- package/dist/core/store/item-mutation-precondition.js +1 -1
- package/dist/core/store/item-store.js +1 -1
- package/dist/core/store/paths.js +1 -1
- package/dist/core/store/settings-concurrency.js +1 -1
- package/dist/core/store/settings-read-cache.js +1 -1
- package/dist/core/store/settings-sections.js +2 -2
- package/dist/core/store/settings-validator.js +1 -1
- package/dist/core/store/settings.d.ts +3 -1
- package/dist/core/store/settings.js +6 -6
- package/dist/core/store/sqlite-runtime.js +1 -1
- package/dist/core/store/tracker-preflight.js +1 -1
- package/dist/core/store/transaction-coordinator-scope.js +1 -1
- package/dist/core/telemetry/consent.js +3 -3
- package/dist/core/telemetry/observability.js +1 -1
- package/dist/core/telemetry/policy.js +1 -1
- package/dist/core/telemetry/read-sampling.js +2 -2
- package/dist/core/telemetry/runtime.js +9 -9
- package/dist/core/test/background-runs.js +4 -4
- package/dist/core/test/item-test-run-tracking.js +1 -1
- package/dist/core/test/run-selectors.js +1 -1
- package/dist/core/validate/estimate-defaults.js +1 -1
- package/dist/core/validate/fix-planning.js +1 -1
- package/dist/core/validate/linked-artifact-reference.js +1 -1
- package/dist/core/validate/missing-by-type.js +1 -1
- package/dist/core/validate/missing-link-owners.js +1 -1
- package/dist/core/validate/stale-file-classification.js +1 -1
- package/dist/mcp/http-server.js +5 -5
- package/dist/mcp/legacy-adapter.js +1 -1
- package/dist/mcp/runtime-capabilities.js +1 -1
- package/dist/mcp/server.js +4 -4
- package/dist/mcp/tool-definitions.js +1 -1
- package/dist/sdk/actionability.js +1 -1
- package/dist/sdk/agent/closed-domain-contracts.js +1 -1
- package/dist/sdk/agent/command-recovery.js +1 -1
- package/dist/sdk/agent/command-suggestions.js +1 -1
- package/dist/sdk/agent/create-option-policy.js +1 -1
- package/dist/sdk/agent/identity-config.js +1 -1
- package/dist/sdk/agent/item-addressing.js +1 -1
- package/dist/sdk/agent/linked-resource-recovery.js +1 -1
- package/dist/sdk/agent/refusal-closure-census.js +2 -2
- package/dist/sdk/agent/refusal-corpus-contracts.js +1 -1
- package/dist/sdk/agent/subcommand-recovery.js +1 -1
- package/dist/sdk/agent-capability-contracts.js +3 -3
- package/dist/sdk/agent-session-context.js +1 -1
- package/dist/sdk/annotations.js +1 -1
- package/dist/sdk/author-attribution.js +1 -1
- package/dist/sdk/cli-bootstrap.js +1 -1
- package/dist/sdk/cli-contracts/agent-output-contracts.js +5 -5
- package/dist/sdk/cli-contracts/bootstrap-command-scanner.js +1 -1
- package/dist/sdk/cli-contracts/command-aliases.js +1 -1
- package/dist/sdk/cli-contracts/command-exit-contracts.js +1 -1
- package/dist/sdk/cli-contracts/commander-mutation-options.js +1 -1
- package/dist/sdk/cli-contracts/commander-types.js +1 -1
- package/dist/sdk/cli-contracts/completeness.js +1 -1
- package/dist/sdk/cli-contracts/enum-contracts.js +1 -1
- package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +2 -2
- package/dist/sdk/cli-contracts/grammar-contracts.js +1 -1
- package/dist/sdk/cli-contracts/registration-helpers.js +7 -7
- package/dist/sdk/cli-contracts/runtime-contracts.js +1 -1
- package/dist/sdk/cli-contracts/schemas/assurance-definition.js +1 -1
- package/dist/sdk/cli-contracts/string-lists.js +1 -1
- package/dist/sdk/cli-contracts/tool-option-contracts.js +1 -1
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
- package/dist/sdk/cli-contracts/tool-schema.js +1 -1
- package/dist/sdk/cli-contracts/typed-action-inputs.js +0 -1
- package/dist/sdk/cli-contracts.js +1 -1
- package/dist/sdk/cli-program.js +1 -1
- package/dist/sdk/command-line.js +1 -1
- package/dist/sdk/comments.js +1 -1
- package/dist/sdk/compile-cache.js +1 -1
- package/dist/sdk/completion/bash.js +2 -2
- package/dist/sdk/completion/fish.js +72 -72
- package/dist/sdk/completion/shared.js +1 -1
- package/dist/sdk/completion/zsh.js +75 -75
- package/dist/sdk/completion.js +1 -1
- package/dist/sdk/config.js +1 -1
- package/dist/sdk/context/recency.js +1 -1
- package/dist/sdk/context/semantic-session-attribution.js +1 -1
- package/dist/sdk/context/usage-egress.js +1 -1
- package/dist/sdk/context/usage-ledger.js +6 -6
- package/dist/sdk/context-intent-contracts.js +1 -1
- package/dist/sdk/context-intent-runtime.js +1 -1
- package/dist/sdk/context-packing.js +1 -1
- package/dist/sdk/context-relevance.js +1 -1
- package/dist/sdk/context-signal-store.js +2 -2
- package/dist/sdk/context-usage.js +1 -1
- package/dist/sdk/dependencies/context-budget-recovery.js +1 -1
- package/dist/sdk/dependencies.js +1 -1
- package/dist/sdk/dependency-flag-validation.js +1 -1
- package/dist/sdk/dependency-provenance.js +1 -1
- package/dist/sdk/docs.js +1 -1
- package/dist/sdk/duplicates.js +1 -1
- package/dist/sdk/environment/host-environment-errors.js +1 -1
- package/dist/sdk/environment/project-runtime-compatibility.js +2 -2
- package/dist/sdk/environment/source-context.js +1 -1
- package/dist/sdk/environment/tracker-preflight.js +1 -1
- package/dist/sdk/error-code-catalog.js +1 -1
- package/dist/sdk/error-runtime.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/eval.js +1 -1
- package/dist/sdk/extension/author-manifest.js +1 -1
- package/dist/sdk/extension/bundled-catalog.js +1 -1
- package/dist/sdk/extension/command-options.d.ts +26 -1
- package/dist/sdk/extension/command-options.js +1 -1
- package/dist/sdk/extension/concurrency.js +1 -1
- package/dist/sdk/extension/copy-scope.js +1 -1
- package/dist/sdk/extension/custom-field-collisions.js +1 -1
- package/dist/sdk/extension/describe.js +3 -3
- package/dist/sdk/extension/doctor.js +1 -1
- package/dist/sdk/extension/install-plan.js +1 -1
- package/dist/sdk/extension/install-receipts.js +1 -1
- package/dist/sdk/extension/install-runtime.js +3 -3
- package/dist/sdk/extension/install-snapshot.js +1 -1
- package/dist/sdk/extension/install-sources.js +5 -5
- package/dist/sdk/extension/managed-state.js +2 -2
- package/dist/sdk/extension/managed-update-status.js +1 -1
- package/dist/sdk/extension/migrations.js +2 -2
- package/dist/sdk/extension/native-command-options.js +1 -1
- package/dist/sdk/extension/output-ownership.js +1 -1
- package/dist/sdk/extension/runtime-summary.js +1 -1
- package/dist/sdk/extension/scaffold.js +11 -11
- package/dist/sdk/extension/shared.js +1 -1
- package/dist/sdk/extension/source-resolution.js +1 -1
- package/dist/sdk/extension/static-inventory.js +1 -1
- package/dist/sdk/extension/update-check.js +1 -1
- package/dist/sdk/extension-command-context.js +2 -2
- package/dist/sdk/extension-contracts.js +1 -1
- package/dist/sdk/extension.js +1 -1
- package/dist/sdk/files.js +1 -1
- package/dist/sdk/flag-invocation-contracts.js +1 -1
- package/dist/sdk/generated/error-code-catalog-rows.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
- package/dist/sdk/generated-error-code-catalog.js +1 -1
- package/dist/sdk/governance/assurance-action-contracts.js +0 -1
- package/dist/sdk/governance/assurance-action.js +1 -1
- package/dist/sdk/governance/assurance-limits.js +1 -1
- package/dist/sdk/governance/assurance-mutation-error.js +1 -1
- package/dist/sdk/governance/assurance-presets.js +1 -1
- package/dist/sdk/governance/assurance-runtime.js +1 -1
- package/dist/sdk/governance/assurance.js +4 -4
- package/dist/sdk/governance/boundary-fixtures.js +1 -1
- package/dist/sdk/governance/closure-timestamps.js +1 -1
- package/dist/sdk/governance/defect-recurrence-coverage.js +1 -1
- package/dist/sdk/governance/defect-recurrence-graph.js +1 -1
- package/dist/sdk/governance/defect-recurrence-signals.js +1 -1
- package/dist/sdk/governance/defect-recurrence.js +2 -2
- package/dist/sdk/governance/extension-host-version.js +1 -1
- package/dist/sdk/governance/gc.js +1 -1
- package/dist/sdk/governance/health/history-drift-remedies.js +1 -1
- package/dist/sdk/governance/health/projection.js +1 -1
- package/dist/sdk/governance/health-merge-evidence.js +1 -1
- package/dist/sdk/governance/health.js +2 -2
- package/dist/sdk/governance/hierarchy-validation.js +1 -1
- package/dist/sdk/governance/in-progress-work-health.js +1 -1
- package/dist/sdk/governance/lifecycle-dependency-cycles.js +1 -1
- package/dist/sdk/governance/linked-file-report.js +1 -1
- package/dist/sdk/governance/merge-receipt-history.js +1 -1
- package/dist/sdk/governance/provenance-health.js +4 -4
- package/dist/sdk/governance/reindex.js +5 -5
- package/dist/sdk/governance/stale-work.js +1 -1
- package/dist/sdk/governance/status-role-diagnostics.js +1 -1
- package/dist/sdk/governance/storage-integrity.js +1 -1
- package/dist/sdk/governance/tracked-runtime-cache.js +1 -1
- package/dist/sdk/governance/upgrade.js +2 -2
- package/dist/sdk/governance/validate-deferred-fields.js +1 -1
- package/dist/sdk/governance/validate-history-drift.js +1 -1
- package/dist/sdk/governance/validate-item-reader.js +1 -1
- package/dist/sdk/governance/validate-normalization.js +1 -1
- package/dist/sdk/governance/validate.js +1 -1
- package/dist/sdk/governance/workflow-completeness.js +1 -1
- package/dist/sdk/governance/workflow-policy.js +3 -3
- package/dist/sdk/governance/workspace-position.js +2 -2
- package/dist/sdk/graph/analytics.js +1 -1
- package/dist/sdk/graph/assembly.js +1 -1
- package/dist/sdk/graph/cache.js +1 -1
- package/dist/sdk/graph/cardinality-integrity.js +1 -1
- package/dist/sdk/graph/centrality.js +1 -1
- package/dist/sdk/graph/deadline-scheduling.js +1 -1
- package/dist/sdk/graph/durable-cache.js +1 -1
- package/dist/sdk/graph/governance-contracts.js +1 -1
- package/dist/sdk/graph/governance.js +1 -1
- package/dist/sdk/graph/hierarchy-integrity.js +1 -1
- package/dist/sdk/graph/lifecycle-coverage.js +1 -1
- package/dist/sdk/graph/mutation-advisory.js +1 -1
- package/dist/sdk/graph/query-contracts.js +1 -1
- package/dist/sdk/graph/remediation.js +1 -1
- package/dist/sdk/graph/run.js +1 -1
- package/dist/sdk/graph/scheduling.js +1 -1
- package/dist/sdk/graph/traversal.js +1 -1
- package/dist/sdk/graph/workspace-relationship-kind-registry.js +1 -1
- package/dist/sdk/guide-topics.js +1 -1
- package/dist/sdk/guide.js +7 -7
- package/dist/sdk/history/append-only-repair.js +4 -4
- package/dist/sdk/history/attestation-command.js +2 -2
- package/dist/sdk/history/attestation-contract.js +1 -1
- package/dist/sdk/history/attestation-scan.js +1 -1
- package/dist/sdk/history/attestation.js +1 -1
- package/dist/sdk/history/maintenance.js +1 -1
- package/dist/sdk/history/reanchor-refusal.js +1 -1
- package/dist/sdk/history/reseed.js +1 -1
- package/dist/sdk/history/salvage.js +5 -5
- package/dist/sdk/history/subject.js +1 -1
- package/dist/sdk/history-analytics.js +1 -1
- package/dist/sdk/history-compact.js +1 -1
- package/dist/sdk/history-mcp.js +1 -1
- package/dist/sdk/history-provenance.js +1 -1
- package/dist/sdk/history-read.js +1 -1
- package/dist/sdk/history-redact.js +1 -1
- package/dist/sdk/history-repair.js +1 -1
- package/dist/sdk/improvement-ledger-validation.js +1 -1
- package/dist/sdk/improvement-ledger.js +2 -2
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/init-agent-guidance.js +10 -10
- package/dist/sdk/init.js +14 -14
- package/dist/sdk/invocation-author.js +1 -1
- package/dist/sdk/item-children.js +1 -1
- package/dist/sdk/item-metadata-index.js +1 -1
- package/dist/sdk/item-schedule.js +1 -1
- package/dist/sdk/item-transaction.js +1 -1
- package/dist/sdk/learnings.js +1 -1
- package/dist/sdk/lifecycle/append.js +3 -3
- package/dist/sdk/lifecycle/checkpoint-rollback.js +1 -1
- package/dist/sdk/lifecycle/claim.js +1 -1
- package/dist/sdk/lifecycle/cli-input.js +1 -1
- package/dist/sdk/lifecycle/close-many.js +1 -1
- package/dist/sdk/lifecycle/close.js +1 -1
- package/dist/sdk/lifecycle/copy.js +1 -1
- package/dist/sdk/lifecycle/core-field-recovery.js +1 -1
- package/dist/sdk/lifecycle/core-item-fields.js +1 -1
- package/dist/sdk/lifecycle/create-deferrals.js +1 -1
- package/dist/sdk/lifecycle/create.js +1 -1
- package/dist/sdk/lifecycle/delete.js +1 -1
- package/dist/sdk/lifecycle/dependency-removal.js +1 -1
- package/dist/sdk/lifecycle/event-validation-messages.js +1 -1
- package/dist/sdk/lifecycle/focus.js +1 -1
- package/dist/sdk/lifecycle/hierarchy-mutation-lock.js +1 -1
- package/dist/sdk/lifecycle/item-revision.js +1 -1
- package/dist/sdk/lifecycle/legacy-none-tokens.js +1 -1
- package/dist/sdk/lifecycle/lifecycle-transitions.js +1 -1
- package/dist/sdk/lifecycle/mcp-actions.js +1 -1
- package/dist/sdk/lifecycle/metadata-normalizers.js +1 -1
- package/dist/sdk/lifecycle/mutation-command-options.js +0 -1
- package/dist/sdk/lifecycle/mutation-facet-contracts.js +1 -1
- package/dist/sdk/lifecycle/mutation-option-validation.js +1 -1
- package/dist/sdk/lifecycle/plan-mutation-receipt.js +1 -1
- package/dist/sdk/lifecycle/plan.js +1 -1
- package/dist/sdk/lifecycle/recurrence-parsers.js +1 -1
- package/dist/sdk/lifecycle/release-handoff.js +1 -1
- package/dist/sdk/lifecycle/reopen.js +1 -1
- package/dist/sdk/lifecycle/repeatable-metadata-parsers.js +2 -2
- package/dist/sdk/lifecycle/repeated-terminal-state.js +1 -1
- package/dist/sdk/lifecycle/restore.js +1 -1
- package/dist/sdk/lifecycle/shared-unset-fields.js +1 -1
- package/dist/sdk/lifecycle/start-blockers.js +1 -1
- package/dist/sdk/lifecycle/structured-mutation-plan.js +1 -1
- package/dist/sdk/lifecycle/task-composition.js +1 -1
- package/dist/sdk/lifecycle/update-many.js +1 -1
- package/dist/sdk/lifecycle/update.js +2 -2
- package/dist/sdk/lifecycle/workflow-transition.js +1 -1
- package/dist/sdk/lifecycle-completion.js +1 -1
- package/dist/sdk/lifecycle-policy.js +1 -1
- package/dist/sdk/linked-artifacts.js +2 -2
- package/dist/sdk/mcp/apps.js +5 -5
- package/dist/sdk/mcp/authorization.js +1 -1
- package/dist/sdk/mcp/discovery.js +1 -1
- package/dist/sdk/mcp/executable.js +4 -4
- package/dist/sdk/mcp/interactions.js +1 -1
- package/dist/sdk/mcp/protocol.js +1 -1
- package/dist/sdk/mcp/skills.js +3 -3
- package/dist/sdk/mcp/subscriptions.js +1 -1
- package/dist/sdk/mcp/tasks.js +2 -2
- package/dist/sdk/mcp/transport.js +1 -1
- package/dist/sdk/merge/abandoned-receipts.js +1 -1
- package/dist/sdk/merge/driver.js +7 -7
- package/dist/sdk/merge/history-scalar-rebase.js +1 -1
- package/dist/sdk/merge/ignored-artifacts.js +1 -1
- package/dist/sdk/merge/index.js +1 -1
- package/dist/sdk/merge/indexed-receipt-blobs.js +2 -2
- package/dist/sdk/merge/install.js +6 -6
- package/dist/sdk/merge/receipt-file-boundary.js +1 -1
- package/dist/sdk/merge/receipt-operation.js +1 -1
- package/dist/sdk/merge/receipt-schema.js +1 -1
- package/dist/sdk/merge/receipts.js +4 -4
- package/dist/sdk/merge/reconcile.js +1 -1
- package/dist/sdk/merge/settlement-hook.js +4 -4
- package/dist/sdk/merge/stage.js +1 -1
- package/dist/sdk/merge/three-way.js +9 -9
- package/dist/sdk/merge/worktree-config.js +2 -2
- package/dist/sdk/merge.js +1 -1
- package/dist/sdk/mutation-events.js +1 -1
- package/dist/sdk/mutation-guard.js +1 -1
- package/dist/sdk/notes.js +1 -1
- package/dist/sdk/output/fit-envelope.js +1 -1
- package/dist/sdk/output/list-envelope.js +1 -1
- package/dist/sdk/output/table-rows.js +1 -1
- package/dist/sdk/output-contracts.js +1 -1
- package/dist/sdk/output-projection.js +1 -1
- package/dist/sdk/output-token-accounting.js +1 -1
- package/dist/sdk/output.js +2 -2
- package/dist/sdk/ownership-source.js +1 -1
- package/dist/sdk/package-import-adapters.js +1 -1
- package/dist/sdk/package-migrations.js +1 -1
- package/dist/sdk/package-runtime-options.js +1 -1
- package/dist/sdk/pagination.js +1 -1
- package/dist/sdk/profile.js +5 -5
- package/dist/sdk/provenance.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query/activity.js +1 -1
- package/dist/sdk/query/aggregate.js +1 -1
- package/dist/sdk/query/calendar.js +4 -4
- package/dist/sdk/query/complete-list.js +1 -1
- package/dist/sdk/query/context.js +2 -2
- package/dist/sdk/query/declared-blockers.js +1 -1
- package/dist/sdk/query/duplicate-candidates.js +1 -1
- package/dist/sdk/query/get-facet-roots.js +1 -1
- package/dist/sdk/query/get.js +1 -1
- package/dist/sdk/query/history.js +1 -1
- package/dist/sdk/query/item-filter-options.js +0 -1
- package/dist/sdk/query/light-metadata.js +1 -1
- package/dist/sdk/query/list-filter-shared.js +1 -1
- package/dist/sdk/query/list.js +1 -1
- package/dist/sdk/query/multi-value-filters.js +1 -1
- package/dist/sdk/query/next-ranking-policy.js +1 -1
- package/dist/sdk/query/next-ready-budget.js +1 -1
- package/dist/sdk/query/next.js +2 -2
- package/dist/sdk/query/parsers.js +1 -1
- package/dist/sdk/query/projection-contracts.js +1 -1
- package/dist/sdk/query/search/corpus.js +2 -2
- package/dist/sdk/query/search/filters.js +1 -1
- package/dist/sdk/query/search/input.js +1 -1
- package/dist/sdk/query/search/lexical.js +1 -1
- package/dist/sdk/query/search/response.js +1 -1
- package/dist/sdk/query/search/semantic.js +3 -3
- package/dist/sdk/query/search/types.js +0 -1
- package/dist/sdk/query/search-contracts.js +1 -1
- package/dist/sdk/query/search-pagination.js +1 -1
- package/dist/sdk/query/search-rendering.js +1 -1
- package/dist/sdk/query/search.js +1 -1
- package/dist/sdk/query/window-pagination.js +1 -1
- package/dist/sdk/query/workspace-contracts.js +1 -1
- package/dist/sdk/read-output/continuation.js +1 -1
- package/dist/sdk/read-output/extension.js +1 -1
- package/dist/sdk/read-output/options.js +1 -1
- package/dist/sdk/read-output/positional-rows.js +1 -1
- package/dist/sdk/read-output/provenance.js +1 -1
- package/dist/sdk/read-output/session-result.js +0 -1
- package/dist/sdk/read-output/surfaces.js +1 -1
- package/dist/sdk/read-output/tail-retention.js +1 -1
- package/dist/sdk/read-output-budget.js +1 -1
- package/dist/sdk/read-output-contracts.d.ts +11 -0
- package/dist/sdk/read-output-contracts.js +1 -1
- package/dist/sdk/read-output-rows.js +1 -1
- package/dist/sdk/read-output-session.js +1 -1
- package/dist/sdk/relationship-analytics.js +1 -1
- package/dist/sdk/relationship-context.js +1 -1
- package/dist/sdk/relationship-history.js +6 -6
- package/dist/sdk/relationship-kinds/contract.js +1 -1
- package/dist/sdk/relationships.js +1 -1
- package/dist/sdk/reproducibility/process.js +1 -1
- package/dist/sdk/runtime/actions.js +1 -1
- package/dist/sdk/runtime/context.js +1 -1
- package/dist/sdk/runtime/mutation-admission.js +1 -1
- package/dist/sdk/runtime/mutation-value-validation.js +1 -1
- package/dist/sdk/runtime/schema-preview.js +1 -1
- package/dist/sdk/runtime/schema.js +1 -1
- package/dist/sdk/runtime-action-aliases.js +1 -1
- package/dist/sdk/runtime-extended-actions.js +1 -1
- package/dist/sdk/runtime-input.d.ts +2 -0
- package/dist/sdk/runtime-input.js +1 -1
- package/dist/sdk/runtime-primitives.js +1 -1
- package/dist/sdk/runtime-public-contracts.js +0 -1
- package/dist/sdk/runtime-stats-options.js +1 -1
- package/dist/sdk/runtime.d.ts +5 -3
- package/dist/sdk/runtime.js +1 -1
- package/dist/sdk/scheduling-shortcuts.js +1 -1
- package/dist/sdk/schema/field-flag-spelling.d.ts +22 -0
- package/dist/sdk/schema/field-flag-spelling.js +2 -0
- package/dist/sdk/schema/field-option-collisions.js +2 -0
- package/dist/sdk/schema-migration.js +4 -4
- package/dist/sdk/schema.js +7 -7
- package/dist/sdk/search-refresh-worker.js +1 -1
- package/dist/sdk/similarity-scoring.js +1 -1
- package/dist/sdk/similarity.js +1 -1
- package/dist/sdk/start-task-status.js +1 -1
- package/dist/sdk/stats.js +1 -1
- package/dist/sdk/structured-mutations.js +1 -1
- package/dist/sdk/telemetry-flush.js +1 -1
- package/dist/sdk/telemetry.js +4 -4
- package/dist/sdk/templates.js +3 -3
- package/dist/sdk/test/batch.js +2 -2
- package/dist/sdk/test/command-args.js +1 -1
- package/dist/sdk/test/command-resolution.js +2 -2
- package/dist/sdk/test/entry.js +2 -2
- package/dist/sdk/test/execution-receipts.js +2 -2
- package/dist/sdk/test/execution.js +5 -5
- package/dist/sdk/test/json-path.js +1 -1
- package/dist/sdk/test/linked-command-detection.js +1 -1
- package/dist/sdk/test/measurements.js +1 -1
- package/dist/sdk/test/parsers.js +1 -1
- package/dist/sdk/test/prerequisites.js +1 -1
- package/dist/sdk/test/receipt-index-snapshot.js +1 -1
- package/dist/sdk/test/run-phases.js +1 -1
- package/dist/sdk/test/runs.js +1 -1
- package/dist/sdk/test/trust.js +2 -2
- package/dist/sdk/test/update.js +1 -1
- package/dist/sdk/test/workspace-snapshot.js +1 -1
- package/dist/sdk/traceability/runtime-files-lookup.js +1 -1
- package/dist/sdk/traceability/source-traceability.js +2 -2
- package/dist/sdk/tracker-root-discovery.js +1 -1
- package/dist/sdk/transactions/item-finalization.js +1 -1
- package/dist/sdk/workspace-contracts-cache.js +1 -1
- package/dist/sdk/workspace-contracts.js +1 -1
- package/dist/sdk/workspace-memory.js +2 -2
- package/dist/sdk/workspace-snapshot.js +5 -5
- package/dist/sdk/workspace-transaction-gc.js +1 -1
- package/dist/sdk/workspace-transaction.js +2 -2
- package/dist/sdk/workspace.js +6 -6
- package/dist/types/index.js +1 -1
- package/dist/types.js +1 -1
- package/docs/COMMANDS.md +1 -1
- package/docs/EXTENSIONS.md +2 -2
- package/docs/READ_OUTPUT_CONTRACTS.md +2 -0
- package/docs/SDK.md +94 -5
- package/docs/SDK_AUDITED_MUTATIONS.md +11 -0
- package/marketplace.json +1 -1
- package/package.json +2 -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 +63 -24
- package/scripts/prepare-build-cache.mjs +28 -1
- package/dist/cli-bundle/chunks/chunk-3W47ZZ5T.js +0 -9
- package/dist/cli-bundle/chunks/chunk-4TB5D6HL.js +0 -125
- package/dist/cli-bundle/chunks/chunk-5ZMVLWE3.js +0 -2
- package/dist/cli-bundle/chunks/chunk-6BBDEIKC.js +0 -33
- package/dist/cli-bundle/chunks/chunk-AR4NP5HI.js +0 -3
- package/dist/cli-bundle/chunks/chunk-B4PPFOPY.js +0 -3
- package/dist/cli-bundle/chunks/chunk-CAR2L5NW.js +0 -8
- package/dist/cli-bundle/chunks/chunk-DEZPZOQ7.js +0 -2
- package/dist/cli-bundle/chunks/chunk-EIGUKEV6.js +0 -2
- package/dist/cli-bundle/chunks/chunk-GTPCAJMZ.js +0 -8
- package/dist/cli-bundle/chunks/chunk-GYP24M7W.js +0 -2
- package/dist/cli-bundle/chunks/chunk-HC2OPETM.js +0 -2
- package/dist/cli-bundle/chunks/chunk-HKUV74K3.js +0 -2
- package/dist/cli-bundle/chunks/chunk-HXHYDO2R.js +0 -115
- package/dist/cli-bundle/chunks/chunk-IB7UB5TE.js +0 -2
- package/dist/cli-bundle/chunks/chunk-J2LABXBL.js +0 -2
- package/dist/cli-bundle/chunks/chunk-J52BEBSS.js +0 -2
- package/dist/cli-bundle/chunks/chunk-KQIZ34SF.js +0 -3
- package/dist/cli-bundle/chunks/chunk-LQBWLNZJ.js +0 -3
- package/dist/cli-bundle/chunks/chunk-OJTMGDON.js +0 -31
- package/dist/cli-bundle/chunks/chunk-SPPHDVZE.js +0 -2
- package/dist/cli-bundle/chunks/chunk-TC6XLIYO.js +0 -2
- package/dist/cli-bundle/chunks/chunk-U7EL3AYA.js +0 -3
- package/dist/cli-bundle/chunks/chunk-VQFWW4EF.js +0 -6
- package/dist/cli-bundle/chunks/chunk-X6MIWTTT.js +0 -2
- package/dist/cli-bundle/chunks/chunk-XC5Q2ZV7.js +0 -2
- package/dist/cli-bundle/chunks/chunk-XFHPKXAE.js +0 -71
- package/dist/cli-bundle/chunks/chunk-YHVLVSEZ.js +0 -9
- package/dist/cli-bundle/chunks/chunk-YMUSRWV4.js +0 -9
- package/dist/cli-bundle/chunks/chunk-YR2KEBHP.js +0 -2
- package/dist/cli-bundle/chunks/context-budget-recovery-L2WP5S26.js +0 -2
- package/dist/cli-bundle/chunks/indexed-receipt-blobs-ITTXIN4K.js +0 -4
- package/dist/cli-bundle/chunks/item-revision-4QBMZXKX.js +0 -2
- package/dist/cli-bundle/chunks/item-transaction-QY3PUHEI.js +0 -2
- package/dist/cli-bundle/chunks/mutation-actor-FWLYWJ37.js +0 -2
- package/dist/cli-bundle/chunks/mutation-admission-7ZDCK3G2.js +0 -2
- package/dist/cli-bundle/chunks/register-mutation-57AJQWFV.js +0 -21
- package/dist/cli-bundle/chunks/register-operations-RKWST7CU.js +0 -2
- package/dist/cli-bundle/chunks/register-setup-CMI23PC5.js +0 -2
- package/dist/cli-bundle/chunks/settlement-hook-BXN5LEQD.js +0 -7
- package/dist/cli-bundle/chunks/stage-4KDVXC5Z.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-2ZD7275J.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-324AHXJO.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-3IRCYJI5.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-3V53UBHN.js +0 -9
- package/dist/cli-bundle/focused-chunks/chunk-3XSWH6QC.js +0 -91
- package/dist/cli-bundle/focused-chunks/chunk-4JZITIJB.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-4KTFKSS3.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-5C5TK3ET.js +0 -78
- package/dist/cli-bundle/focused-chunks/chunk-AKJYOZZP.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-BRZV7BFV.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-C3O6JJPO.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-CR7CGEB2.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-EGN2HFRU.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-GHQVM6K6.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-HDEKFSOK.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-I5LGPUWH.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-IWOXAUDU.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-ML3JHCC6.js +0 -6
- package/dist/cli-bundle/focused-chunks/chunk-OPGOOP25.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-RE7ZWT7D.js +0 -27
- package/dist/cli-bundle/focused-chunks/chunk-RKQNVYGF.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-RQ252B6V.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-SVOOGGAK.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-URGHTTT3.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-USPYKWQG.js +0 -13
- package/dist/cli-bundle/focused-chunks/chunk-UWS3FC4D.js +0 -102
- package/dist/cli-bundle/focused-chunks/chunk-UXQGFGAT.js +0 -44
- package/dist/cli-bundle/focused-chunks/chunk-WZWXGDYY.js +0 -26
- package/dist/cli-bundle/focused-chunks/chunk-YKSLZPLT.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZWJTY4ID.js +0 -2
- package/dist/cli-bundle/focused-chunks/context-budget-recovery-5MKOCGY5.js +0 -2
- package/dist/cli-bundle/focused-chunks/indexed-receipt-blobs-AF4U3F3D.js +0 -4
- package/dist/cli-bundle/focused-chunks/item-transaction-GLACUTPL.js +0 -2
- package/dist/cli-bundle/focused-chunks/mutation-actor-TCYDPUGG.js +0 -2
- package/dist/cli-bundle/focused-chunks/mutation-admission-LY73EJWM.js +0 -2
- package/dist/cli-bundle/focused-chunks/settlement-hook-ARYCZQY4.js +0 -7
- package/dist/cli-bundle/focused-chunks/stage-DQ7RQQ52.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{EXIT_CODE as r}from"../core/shared/constants.js";import{PmCliError as i}from"../core/shared/errors.js";class d extends i{constructor(e,t,o){super(e,r.GENERIC_FAILURE,t),this.name="ExtensionCommandError",Object.defineProperty(this,"cause",{value:o,configurable:!0,writable:!0})}}function f(n,e){const t=e.warnings[0]??"extension_command_handler_failed",o=e.errorMessage?.trim();return new d(`Command "${n}" failed in extension handler (${t}).${o?` ${o}`:""}`,{code:e.errorCode??"command_failed",nextSteps:e.remediation?[e.remediation]:void 0},e.cause)}function u(n){return n instanceof i||n instanceof Error?n.message:"Unknown failure"}function a(n){if(typeof n!="object"||n===null||!("exitCode"in n))return;const e=n.exitCode;return typeof e=="number"&&Number.isFinite(e)?e:void 0}function c(n){const e=Math.trunc(n);return e>r.SUCCESS?e:r.GENERIC_FAILURE}function E(n){return typeof n=="object"&&n!==null&&"code"in n&&typeof n.code=="string"&&n.code.startsWith("commander.")}function x(n,e){if(n instanceof Error)return n;const t=new Error(e),o=a(n);return o!==void 0&&(t.exitCode=c(o)),t}export{d as ExtensionCommandError,f as createExtensionCommandError,u as describeUnknownError,E as isCommanderError,c as normalizeThrownExitCode,a as readThrownExitCode,x as wrapThrownErrorForSentry};
|
|
2
2
|
//# sourceMappingURL=error-runtime.js.map
|
package/dist/sdk/errors.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{EXIT_CODE as i}from"../core/shared/constants.js";import{PmCliError as a}from"../core/shared/errors.js";import{admitPmCliErrorDetails as l}from"../core/shared/error-details.js";import{PM_CLI_ERROR_DETAILS_LIMITS as h,isPmCliErrorDetails as w,projectPmCliErrorContextDetails as T,projectPmCliErrorContextDetailsSlot as k,projectPmCliErrorDetails as O,snapshotPmCliErrorContext as S}from"../core/shared/error-details.js";function n(t){return typeof t=="number"&&Number.isSafeInteger(t)&&t>0}function C(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;const e=t;if(!n(e.requested_tokens)||e.basis!=="canonical_retry")return!1;switch(e.minimum_status){case"exact":return n(e.minimum_feasible_tokens)&&e.feasible_tokens===e.minimum_feasible_tokens&&e.reason===void 0;case"feasible_only":return e.minimum_feasible_tokens===null&&n(e.feasible_tokens)&&e.reason===void 0;case"unavailable":return e.minimum_feasible_tokens===null&&e.feasible_tokens===null&&["query_cost_limit","search_limit","output_constraints"].includes(e.reason);default:return!1}}const u="PmCliError";function b(t){if(!f(t)||t.code!=="item_already_exists"||t.exitCode!==i.CONFLICT)return!1;const e=t.context;return typeof e=="object"&&e!==null&&e.code==="item_already_exists"&&typeof e.id=="string"&&e.id.trim().length>0&&typeof e.path=="string"&&e.path.trim().length>0}function m(t){if(!Number.isFinite(t))throw new TypeError("createPmCliExpectedError options.exitCode must be a finite number");const e=Math.trunc(t);if(e<=i.SUCCESS)throw new TypeError("createPmCliExpectedError options.exitCode must be a positive exit code");return e}function c(t){if(t==null)return{};if(!Object.hasOwn(t,"details"))return t;const e=Object.getOwnPropertyDescriptor(t,"details");if(!("value"in e))throw o("unsupported_value","details");if(e.value===void 0)return t;const r=l(e.value);if(r.ok)return{...t,details:r.details};if(r.omission.reason==="byte_limit"){const{details:d,...s}=t;return{...s,details_omitted:r.omission}}throw o(r.omission.reason,r.omission.path)}function o(t,e){const r=new TypeError(`createPmCliExpectedError options.context.details must be plain JSON (${t})`);return Object.defineProperty(r,"path",{value:e,enumerable:!1}),r}function x(t,e={}){if(typeof t!="string"||t.trim().length===0)throw new TypeError("createPmCliExpectedError message must be a non-empty string");const r=new a(t,m(e.exitCode??i.USAGE),c(e.context));return"cause"in e&&Object.defineProperty(r,"cause",{value:e.cause,enumerable:!1,configurable:!0,writable:!0}),r}function f(t){try{if(!(t instanceof Error)||t.name!==u)return!1;const e=t;return typeof e.exitCode=="number"&&Number.isFinite(e.exitCode)&&typeof e.context=="object"&&e.context!==null&&!Array.isArray(e.context)}catch{return!1}}export{h as PM_CLI_ERROR_DETAILS_LIMITS,u as PM_CLI_EXPECTED_ERROR_NAME,x as createPmCliExpectedError,b as isItemAlreadyExistsError,w as isPmCliErrorDetails,f as isPmCliExpectedError,C as isPmTokenBudgetRecovery,T as projectPmCliErrorContextDetails,k as projectPmCliErrorContextDetailsSlot,O as projectPmCliErrorDetails,S as snapshotPmCliErrorContext};
|
|
2
2
|
//# sourceMappingURL=errors.js.map
|
package/dist/sdk/eval.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{evaluateMetricFloors as g}from"../core/search/eval-thresholds.js";import{assertInitializedTracker as h}from"./environment/tracker-preflight.js";import y from"node:fs/promises";import E from"node:path";import{aggregateEvalMetrics as A,DEFAULT_EVAL_K as w,EVAL_QUERY_SET_EXAMPLE as _,EVAL_QUERY_SET_SCHEMA_ID as R,evaluateRanking as T,parseEvalQuerySet as L}from"../core/search/eval.js";import{EXIT_CODE as c}from"../core/shared/constants.js";import{PmCliError as l}from"../core/shared/errors.js";import{coercePositiveInteger as U}from"../core/shared/primitives.js";import{resolvePmRoot as q}from"../core/store/paths.js";import{runSearch as M}from"./query/search.js";import{EVAL_QUERY_SET_CONTRACT as ee,EVAL_QUERY_SET_EXAMPLE as re,EVAL_QUERY_SET_SCHEMA_ID as te,parseEvalQuerySet as ne}from"../core/search/eval.js";const O=E.join("search","eval-queries.json"),d={schema:R,examples:[JSON.stringify(_)],nextSteps:["Create a git-tracked golden-query JSON file that follows the schema, then re-run pm eval."]},N=new Set(["keyword","semantic","hybrid"]),V=e=>{if(e===void 0)return"keyword";const r=e.trim().toLowerCase();if(!N.has(r))throw new l("Eval --mode must be one of keyword|semantic|hybrid",c.USAGE);return r},Q=e=>{if(e===void 0||e==="")return w;const r=U(e);if(r===null)throw new l("Eval --k must be a positive integer",c.USAGE);return r},k=e=>{if(e===void 0||e==="")return;const r=String(e).trim(),t=Number(r);if([r.length===0,!Number.isFinite(t),t<0,t>1].includes(!0))throw new l("Eval --fail-under must be a number in the range [0, 1]",c.USAGE);return t},a=e=>Math.round(e*1e4)/1e4,C=async e=>{try{return await y.readFile(e,"utf8")}catch{throw new l(`Eval query set not found at ${e}`,c.NOT_FOUND,{...d,examples:[`echo '${JSON.stringify(_)}' > ${e}`,"pm eval --queries ./my-eval.json"]})}},I=(e,r)=>{try{return JSON.parse(e)}catch(t){throw new l(`Eval query set at ${r} is not valid JSON: ${t instanceof Error?t.message:String(t)}`,c.USAGE,d)}},b=e=>{try{return L(e)}catch(r){throw new l(r instanceof Error?r.message:String(r),c.USAGE,d)}},D=async e=>b(I(await C(e),e)),F=async(e,r,t,s)=>{const n=e.mode??r,m=(await M(e.query,{mode:n,limit:String(t),fields:"id"},s)).items.map(i=>i.id).filter(i=>typeof i=="string"),o=T(m,new Set(e.relevant_ids),t);return{metrics:o,report:{query:e.query,...e.minimum===void 0?{}:{violations:g(o,e.minimum)},mode:n,relevant_total:o.relevant_total,retrieved_relevant:o.retrieved_relevant,ndcg:a(o.ndcg),mrr:a(o.mrr),precision:a(o.precision),recall:a(o.recall)}}},x=(e,r,t,s)=>{const n=A(t);return{k:e,query_count:r.length,aggregate:{ndcg:a(n.ndcg),mrr:a(n.mrr),precision:a(n.precision),recall:a(n.recall)},queries:r,...s!==void 0?{fail_under:s}:{},passed:(s===void 0||n.ndcg>=s)&&r.every(u=>(u.violations?.length??0)===0)}},B=async(e,r)=>{const t=q(process.cwd(),r.path);await h(t);const s=Q(e.k),n=V(e.mode),u=k(e.failUnder),m=e.queries?E.resolve(process.cwd(),e.queries):E.join(t,O),o=await D(m),i=[],f=[];for(const p of o.queries){const{report:v,metrics:S}=await F(p,n,s,r);f.push(S),i.push(v)}return x(s,i,f,u)};export{O as DEFAULT_EVAL_QUERIES_RELATIVE_PATH,ee as EVAL_QUERY_SET_CONTRACT,re as EVAL_QUERY_SET_EXAMPLE,te as EVAL_QUERY_SET_SCHEMA_ID,ne as parseEvalQuerySet,B as runEval};
|
|
2
2
|
//# sourceMappingURL=eval.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import m from"node:fs/promises";import p from"node:path";import{isFileAbsentError as c}from"../../core/fs/fs-utils.js";import{lintExtensionManifestSchema as _}from"../../core/extensions/manifest-schema.js";import{resolveWorkspaceRoot as f}from"../../core/store/paths.js";function u(e){return typeof e.name=="string"&&e.name.trim().length>0?e.name.trim():"workspace-manifest"}function g(e,t){return t.code==="manifest_unknown_key"?`extension_manifest_unknown_key:author:${e}:key=${t.path}${t.suggested_key?`:suggested=${t.suggested_key}`:""}`:`extension_manifest_no_version_bounds:author:${e}:suggested=pm_min_version`}async function d(e){const t=p.join(e,"manifest.json");let o;try{o=await m.readFile(t,"utf8")}catch(n){if(c(n))return{path:t,present:!1,parse_status:"absent",package_metadata_location:"package.json#pm",schema_findings:[],warnings:[],remediation:[]};throw n}let a;try{a=JSON.parse(o)}catch{return{path:t,present:!0,parse_status:"invalid_json",package_metadata_location:"package.json#pm",schema_findings:[],warnings:["extension_author_manifest_invalid_json:manifest.json"],remediation:["Repair manifest.json so it contains one valid JSON object, then rerun pm package doctor --project."]}}if(typeof a!="object"||a===null||Array.isArray(a))return{path:t,present:!0,parse_status:"invalid_shape",package_metadata_location:"package.json#pm",schema_findings:[],warnings:["extension_author_manifest_invalid_shape:manifest.json"],remediation:["Replace manifest.json with one JSON object, then rerun pm package doctor --project."]};const i=a,s=_(i),r=u(i);return{path:t,present:!0,parse_status:"valid",package_metadata_location:"package.json#pm",schema_findings:s.findings,warnings:s.findings.map(n=>g(r,n)),remediation:s.findings.map(n=>n.message)}}function v(e){return d(f(e))}export{d as inspectExtensionAuthorManifest,v as inspectExtensionAuthorManifestAtPmRoot};
|
|
2
2
|
//# sourceMappingURL=author-manifest.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import j from"node:fs/promises";import c from"node:path";import{collectPackageExtensionDirectories as S,PM_PACKAGE_RESOURCE_KINDS as A,readPmPackageManifest as _}from"../../core/packages/manifest.js";import{resolvePmPackageRootFromModule as B}from"../../core/packages/root.js";import{pathExists as u}from"../../core/fs/fs-utils.js";import{EXIT_CODE as P}from"../../core/shared/constants.js";import{PmCliError as h}from"../../core/shared/errors.js";import{splitCommaList as D}from"../../core/shared/split-comma-list.js";import{resolveExtensionRoots as G}from"../../core/extensions/loader.js";import{resolvePmRoot as M}from"../../core/store/paths.js";import{validateExtensionDirectory as O}from"./shared.js";import{readManagedExtensionState as T}from"./managed-state.js";const I="PM_CLI_PACKAGE_ROOT",C={beads:{package_directory:"pm-beads",legacy_extension_directory:"beads"},todos:{package_directory:"pm-todos",legacy_extension_directory:"todos"}},N=new Set(["*","all"]);function f(){const a=[],e=process.env[I];return typeof e=="string"&&e.trim().length>0&&a.push(c.resolve(e.trim())),a.push(B(import.meta.url,["../../.."])),[...new Set(a)]}async function K(a){const e=a.trim().toLowerCase(),o=await v(e);if(o)return o;const t=C[e];if(!t)return null;for(const r of f()){const i=c.join(r,".agents","pm","extensions",t.legacy_extension_directory);if(await u(c.join(i,"manifest.json")))return i}return null}function na(a){return N.has(a.trim().toLowerCase())}function U(a){return a.replace(/^pm-/i,"").trim().toLowerCase()}async function F(a,e){const o=await j.readdir(a,{withFileTypes:!0});for(const t of o){if(!t.isDirectory()||!t.name.startsWith("pm-"))continue;const r=c.join(a,t.name);if(!await u(c.join(r,"package.json")))continue;const i=await _(r),l=i.aliases&&i.aliases.length>0?i.aliases:[U(t.name)];for(const p of l){const s=p.trim().toLowerCase();s.length===0||e.has(s)||e.set(s,{alias:s,package_directory:t.name,package_root:r,package_name:i.package_name??null})}}}async function y(){const a=new Map;for(const e of f()){const o=c.join(e,"packages");await u(o)&&await F(o,a)}for(const[e,o]of Object.entries(C))if(!a.has(e))for(const t of f()){const r=c.join(t,"packages",o.package_directory);if(await u(c.join(r,"package.json"))){a.set(e,{alias:e,package_directory:o.package_directory,package_root:r,package_name:null});break}}return[...a.values()].sort((e,o)=>e.alias.localeCompare(o.alias))}async function sa(){return(await y()).map(a=>a.alias)}async function v(a){const e=a.trim().toLowerCase();return(await y()).find(t=>t.alias===e||t.package_directory.toLowerCase()===e||t.package_name?.toLowerCase()===e)?.package_root??null}async function ra(a){const e=await v(a);return e?(await _(e)).package_name??null:null}async function ia(a){const e=await K(a);if(!e)return null;try{const o=await S(e);return o.length!==1?null:(await O(o[0])).manifest.name}catch{return null}}function $(a){return{docs:a.catalog?.links?.docs??a.package_homepage,npm:a.catalog?.links?.npm??(a.package_name&&a.package_private!==!0?`https://www.npmjs.com/package/${encodeURIComponent(a.package_name)}`:void 0),repository:a.catalog?.links?.repository??a.package_repository_url,report:a.catalog?.links?.report??a.package_bugs_url}}function z(a,e,o,t,r,i){const l=t==="global"?"--global":"--project",p=Object.fromEntries(A.filter(s=>s!=="extensions").map(s=>[s,a.resources[s]??[]]).filter(([,s])=>Array.isArray(s)&&s.length>0));return{alias:e.alias,aliases:o,bundled:!0,available:!0,installed:o.some(s=>r.has(s))||i.has(c.resolve(e.package_root)),install_target:e.alias,install_command:`pm install ${e.alias} ${l}`,package_name:a.package_name,package_version:a.package_version,description:a.catalog?.summary??a.package_description,keywords:a.package_keywords??[],resources:a.resources,installable_resources:{extensions:a.resources.extensions??[]},metadata_only_resources:p,catalog:{display_name:a.catalog?.display_name,category:a.catalog?.category,tags:a.catalog?.tags??a.package_keywords??[],links:$(a),media:a.catalog?.media}}}async function ca(a,e,o={}){const t=G(M(process.cwd(),e.path),process.cwd()),r=a==="global"?t.global:t.project,i=await T(r),l=new Set(i.state.entries.filter(n=>n.scope===a).filter(n=>n.source.kind!=="builtin").map(n=>c.resolve(n.source.location))),p=new Set(i.state.entries.filter(n=>n.scope===a&&n.source.kind==="builtin").flatMap(n=>[n.source.name,n.source.input,n.source.location]).filter(n=>typeof n=="string"&&n.trim().length>0).map(n=>n.trim().toLowerCase())),s=[],m=new Map;for(const n of await y()){const g=c.resolve(n.package_root),d=m.get(g)??[];d.push(n),m.set(g,d)}for(const n of m.values()){const g=n[0],d=n.map(k=>k.alias).sort((k,L)=>k.localeCompare(L)),R=await _(g.package_root);s.push(z(R,g,d,a,p,l))}const w=x(o.fields),E=w?s.map(n=>b(n,w)):s;return{total:E.length,scope:a,installable_resource_kinds:["extensions"],metadata_only_resource_kinds:A.filter(n=>n!=="extensions"),packages:E}}const Y=new Set(["alias","aliases","bundled","available","installed","install_target","install_command","package_name","package_version","description","keywords","resources","installable_resources","metadata_only_resources","catalog","category","display_name"]);function x(a){if(a===void 0)return;const e=D(a);if(e.length===0)throw new h("Package catalog --fields requires a comma-separated list of field names",P.USAGE);const o=e.filter(t=>!Y.has(t));if(o.length>0)throw new h(`Unknown package catalog --fields value(s): ${o.join(", ")}`,P.USAGE,{examples:["pm package list --project --fields alias,installed,install_command","pm package catalog --project --fields alias,package_name,category"]});return e}function b(a,e){const o={};for(const t of e)t==="category"?o[t]=a.catalog?.category??null:t==="display_name"?o[t]=a.catalog?.display_name??null:o[t]=a[t]??null;return o}const la={parsePackageCatalogFields:x,projectPackageCatalogEntry:b};export{la as _testOnlyBundledCatalog,ca as buildBundledPackageCatalog,na as isBundledPackageInstallAllTarget,sa as listBundledPackageAliases,ia as resolveBundledAliasManifestName,K as resolveBundledExtensionAliasSource,ra as resolveBundledPackageNpmName,v as resolveBundledPackageRoot};
|
|
2
2
|
//# sourceMappingURL=bundled-catalog.js.map
|
|
@@ -23,6 +23,9 @@ repeatable?:boolean;
|
|
|
23
23
|
default?:unknown;
|
|
24
24
|
/** `strict` refuses malformed number/boolean tokens before dispatch; `coerce` (default) forwards them. */
|
|
25
25
|
value_validation?:string;}
|
|
26
|
+
type LooseOptionCoercionKind="string"|"number"|"boolean";
|
|
27
|
+
/** The value kind a declared flag coerces to (`bool` and other supported spellings included), or null when untyped. */
|
|
28
|
+
export declare function resolveLooseOptionCoercionKind(definition:LooseCommandFlagDefinition):LooseOptionCoercionKind|null;
|
|
26
29
|
/** Collect every option key the declared flags answer to: each long flag's camel-case key and each short letter. */
|
|
27
30
|
export declare function collectLooseCommandOptionKeysForDefinitions(definitions:ReadonlyArray<LooseCommandFlagDefinition>):Set<string>;
|
|
28
31
|
/**
|
|
@@ -127,4 +130,26 @@ stop?:{atSubcommand:(token:string)=> boolean;atFirstUnrecognized:boolean;};}
|
|
|
127
130
|
* Values compare after the declared coercion, so `--count 1 -c 1` is
|
|
128
131
|
* accepted; repeats of one spelling and list flags are not checked.
|
|
129
132
|
*/
|
|
130
|
-
export declare function refuseConflictingArgvOptionSpellings(scopes:readonly ArgvOptionScope[],definitions:ReadonlyArray<LooseCommandFlagDefinition>,commandPath:string):void;
|
|
133
|
+
export declare function refuseConflictingArgvOptionSpellings(scopes:readonly ArgvOptionScope[],definitions:ReadonlyArray<LooseCommandFlagDefinition>,commandPath:string):void;
|
|
134
|
+
/**
|
|
135
|
+
* Reorder the recorded occurrences of every declared repeatable boolean switch
|
|
136
|
+
* into argv order (pm-g2zzus). Commander registers such a switch without a
|
|
137
|
+
* value, so it accumulates each bare `--many` while `--many=false` and
|
|
138
|
+
* `--no-many` reach only the loose parser; the coercer used to keep the loose
|
|
139
|
+
* occurrences alone whenever any existed, dropping the bare ones. The scan
|
|
140
|
+
* that resolves spelling conflicts walks each scope's tokens with Commander's
|
|
141
|
+
* grammar and reports, in argv order, which occurrences Commander consumed and
|
|
142
|
+
* where a loose occurrence sits; a token another option consumed is never
|
|
143
|
+
* counted. Values stay with their reader: Commander's bare occurrences come
|
|
144
|
+
* from the scan, and every loose occurrence keeps the loose parser's own
|
|
145
|
+
* value, which reads the leftover tokens after Commander removed its own (so
|
|
146
|
+
* `--Many --source x false` keeps `false`) and folds spellings Commander did
|
|
147
|
+
* not register (`--Many=false` is `many`). Only the keys the coercer reads for
|
|
148
|
+
* a switch move, so another declaration's key (`--s` beside a switch aliased
|
|
149
|
+
* `-S`) keeps its occurrences. When the scan and the loose parser disagree on
|
|
150
|
+
* how many loose occurrences there are, every value is kept, loose ones first.
|
|
151
|
+
* A switch with no loose occurrence keeps Commander's accumulated value, which
|
|
152
|
+
* a preflight override may have rewritten. Returns `occurrenceSource`
|
|
153
|
+
* unchanged when Commander consumed no repeatable switch occurrence.
|
|
154
|
+
*/
|
|
155
|
+
export declare function orderArgvRepeatableSwitchOccurrences(occurrenceSource:Record<string,unknown>,scopes:readonly ArgvOptionScope[],definitions:ReadonlyArray<LooseCommandFlagDefinition>):Record<string,unknown>;export{};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ab4e2ed3-e7e8-5a7a-a13e-7b8dce750dc4")}catch{}})();import{isDeepStrictEqual}from"node:util";import{resolvePmCommandOperation}from"../cli-contracts/command-aliases.js";import{describeFlagScalarValueFailure,resolveExtensionFlagValueContract,resolveExtensionLongFlagName,EXIT_CODE,PmCliError,flattenFlagListValue,resolveFlagValueKind}from"../runtime-primitives.js";import{RESERVED_EXTENSION_HOST_FLAG_NAMES}from"../../core/extensions/reserved-host-flags.js";const UNSAFE_LOOSE_OPTION_KEYS=new Set(["__proto__","prototype","constructor"]),LOOSE_OPTION_OCCURRENCES=Symbol("looseOptionOccurrences");function toLooseOptionKey(rawKey){return rawKey.trim().toLowerCase().replaceAll(/-([a-z0-9])/g,(_match,group)=>group.toUpperCase())}function setLooseOptionValue(options,key,value){const existing=options[key];if(existing===void 0){options[key]=value;return}if(Array.isArray(existing)){existing.push(value),options[key]=existing;return}options[key]=[existing,value]}function parseLooseOptionToken(args,index){const token=args[index];if(!token.startsWith("-")||token==="-"||token==="--")return null;if(!token.startsWith("--")){const equalsIndex2=token.indexOf("=");if(equalsIndex2>=0)return{consumed:1,key:token.slice(1,equalsIndex2).trim(),value:token.slice(equalsIndex2+1),attached:!0};const key2=token.slice(1).trim(),next2=args[index+1];return typeof next2=="string"&&!next2.startsWith("-")?{consumed:2,key:key2,value:next2}:{consumed:1,key:key2,value:!0}}const equalsIndex=token.indexOf("=");if(equalsIndex>=0)return{consumed:1,key:token.slice(2,equalsIndex).trim(),value:token.slice(equalsIndex+1),attached:!0};if(token.startsWith("--no-"))return{consumed:1,key:token.slice(5).trim(),value:!1};const key=token.slice(2).trim(),next=args[index+1];return typeof next=="string"&&!next.startsWith("-")?{consumed:2,key,value:next}:{consumed:1,key,value:!0}}function isUnsafeLooseOptionKey(key){return UNSAFE_LOOSE_OPTION_KEYS.has(key)}function resolveLooseOptionCoercionKind(definition){const raw=(typeof definition.value_type=="string"?definition.value_type:void 0)??(typeof definition.type=="string"?definition.type:void 0);return resolveFlagValueKind(raw)}function collectLooseOptionKeys(definition){const keys=[],long=resolveExtensionLongFlagName(definition.long)??"",short=typeof definition.short=="string"?definition.short.trim():"";if(long.startsWith("--")){const normalized=toLooseOptionKey(long.slice(2));normalized.length>0&&!isUnsafeLooseOptionKey(normalized)&&keys.push(normalized)}if(short.startsWith("-")&&!short.startsWith("--")){const normalized=toLooseOptionKey(short.slice(1));normalized.length>0&&!isUnsafeLooseOptionKey(normalized)&&keys.push(normalized)}return[...new Set(keys)]}function collectLooseCommandOptionKeysForDefinitions(definitions){const keys=new Set;for(const definition of definitions)for(const key of collectLooseOptionKeys(definition))keys.add(key);return keys}function resolveCanonicalLooseOptionKey(definition){const long=resolveExtensionLongFlagName(definition.long)??"";if(long.startsWith("--")){const normalized=toLooseOptionKey(long.slice(2));if(normalized.length>0&&!isUnsafeLooseOptionKey(normalized))return normalized}return collectLooseOptionKeys(definition)[0]??null}function formatLooseOptionLabel(definition){const long=resolveExtensionLongFlagName(definition.long)??"";if(long.startsWith("--")&&long.length>2)return long;const short=typeof definition.short=="string"?definition.short.trim():"";return short.startsWith("-")&&!short.startsWith("--")&&short.length>1?short:null}function collectRefusalListingLabels(definitions,listing){return[...(listing.definitions??definitions).map(definition=>formatLooseOptionLabel(definition)).filter(label=>label!==null),...listing.inheritedFlags??[]]}function validateLooseCommandOptionsWithFlagDefinitions(options,definitions,commandPath,listing={}){if(definitions.length===0)return;const allowed=new Set,disabled=new Map,required=[],labels=collectRefusalListingLabels(definitions,listing);for(const definition of definitions){const keys=collectLooseOptionKeys(definition),normalizedLabel=formatLooseOptionLabel(definition);for(const key of keys)allowed.add(key),definition.enabled===!1&&disabled.set(key,normalizedLabel);definition.required===!0&&definition.enabled!==!1&&keys.length>0&&required.push({keys,label:normalizedLabel,definition})}for(const key of Object.keys(options)){allowed.has(key)||refuseUnknownExtensionOption(`--${key}`,`--${key}`,commandPath,labels);const disabledLabel=disabled.get(key);disabledLabel&&refuseDisabledExtensionOption(disabledLabel,commandPath)}for(const entry of required){const present=key=>Object.hasOwn(options,key)&&(entry.definition.list!==!0||hasLooseListEntries(entry.definition,options[key]));entry.keys.some(present)||refuseMissingRequiredExtensionOption(entry.definition,entry.keys[0],entry.label,commandPath)}}function refuseUnknownExtensionOption(supplied,flag,commandPath,labels){const expected=labels.length>0?` Expected one of: ${[...new Set(labels)].join(", ")}.`:"";throw new PmCliError(`Unknown option '${supplied}' for extension command '${commandPath}'.${expected}`,EXIT_CODE.USAGE,{code:"unknown_option",flag,required:`Use a flag the command accepts; run pm contracts --command ${commandPath} --flags-only --json to list them.`})}function refuseDisabledExtensionOption(label,commandPath){throw new PmCliError(`Option '${label}' is disabled for extension command '${commandPath}'.`,EXIT_CODE.USAGE,{code:"extension_option_disabled",flag:label,required:`Remove ${label}; the command declares it with enabled: false.`,why:"A disabled declaration keeps the flag in the contract while refusing every value for it.",examples:[`pm ${commandPath} --help`],nextSteps:[`Run pm contracts --command ${commandPath} --flags-only --json to list the flags this command accepts.`]})}function refuseMissingRequiredExtensionOption(definition,handlerKey,label,commandPath){const value=resolveExtensionFlagValueContract(definition),usage=value.value_arity==="none"?label:value.value_arity==="optional"?`${label} [${value.value_name}]`:`${label} <${value.value_name}>`;throw new PmCliError(`Missing required option '${label}' for extension command '${commandPath}'.`,EXIT_CODE.USAGE,{code:"missing_required_option",flag:label,field:handlerKey,required:`Pass ${usage}.`,why:"The command declares this flag as required, so pm refuses the invocation before the extension handler runs.",examples:[`pm ${commandPath} ${usage}`],nextSteps:[`Run pm contracts --command ${commandPath} --flags-only --json to read each flag's sdk_option key.`],recovery:{missing:[label]}})}function coerceLooseStringOptionValue(value){return typeof value=="string"||value==null?value:String(value)}function coerceLooseNumberOptionValue(value){if(typeof value=="number")return value;if(typeof value=="string"&&value.trim().length>0){const parsed=Number(value);return Number.isFinite(parsed)?parsed:value}return value}function coerceLooseBooleanOptionValue(value){if(typeof value=="boolean")return value;if(typeof value=="string"){const normalized=value.trim().toLowerCase();if(normalized==="true"||normalized==="1")return!0;if(normalized==="false"||normalized==="0")return!1}return value}const LOOSE_OPTION_VALUE_COERCERS={string:coerceLooseStringOptionValue,number:coerceLooseNumberOptionValue,boolean:coerceLooseBooleanOptionValue};function coerceLooseOptionValue(value,kind){return Array.isArray(value)?value.map(entry=>coerceLooseOptionValue(entry,kind)):LOOSE_OPTION_VALUE_COERCERS[kind](value)}function normalizeAccumulatedFlagValue(value,kind,preserveOccurrenceCommas){const entries=preserveOccurrenceCommas?(Array.isArray(value)?value.flat(1/0):[value]).filter(entry=>entry!=null&&entry!==""):flattenFlagListValue(value);return kind?entries.map(entry=>coerceLooseOptionValue(entry,kind)):entries}function hasLooseListEntries(definition,value){return normalizeAccumulatedFlagValue(value,null,definition.repeatable===!0).length>0}function applyFlagDefault(defaultValue,kind,isListFlag,preserveOccurrenceCommas){return isListFlag?normalizeAccumulatedFlagValue(defaultValue,kind,preserveOccurrenceCommas):kind?coerceLooseOptionValue(defaultValue,kind):defaultValue}function readOrderedLooseListValues(occurrenceSource,optionKeys,fallback){const matching=readLooseOccurrences(occurrenceSource,optionKeys);return matching.length===0?fallback:matching.map(occurrence=>occurrence.value)}function isBooleanSwitchDefinition(definition){return resolveExtensionFlagValueContract(definition).value_arity==="none"}function refuseStrictScalarValue(definition,kind,entry,expected,commandPath){const label=formatLooseOptionLabel(definition),scope=commandPath?` for extension command '${commandPath}'`:"",received=entry===!0?"no value":JSON.stringify(entry);throw new PmCliError(`Option '${label}'${scope} expects ${expected}; received ${received}.`,EXIT_CODE.USAGE,{code:"extension_flag_value_invalid",flag:label,required:`Pass ${label} ${kind==="number"?"<number>":"<true|false|1|0>"}.`,why:`The flag declares value_type ${kind} with value_validation strict, so a malformed token is refused before the extension handler runs.`,nextSteps:[`Re-run with a valid ${kind} value for ${label}.`,`Run pm ${commandPath??"<command>"} --help to review the declared flag contract.`]})}function isStrictTypedDefinition(definition,kind){return definition.value_validation==="strict"&&kind!=="string"}function readLooseOccurrences(occurrenceSource,optionKeys){const occurrences=occurrenceSource[LOOSE_OPTION_OCCURRENCES];if(!occurrences)return[];const acceptedKeys=new Set(optionKeys);return occurrences.filter(occurrence=>acceptedKeys.has(occurrence.key))}function refuseMalformedAttachedSwitchValues(definition,optionKeys,occurrenceSource,commandPath){if(isBooleanSwitchDefinition(definition))for(const occurrence of readLooseOccurrences(occurrenceSource,optionKeys)){if(occurrence.attached!==!0)continue;const values=definition.list===!0&&definition.repeatable!==!0?flattenFlagListValue(occurrence.value):[occurrence.value];for(const value of values){const failure=describeFlagScalarValueFailure(coerceLooseOptionValue(value,"boolean"),"boolean");failure!==null&&refuseStrictScalarValue(definition,"boolean",value,failure.expected,commandPath)}}}function refuseEmptyStrictListEntries(definition,kind,rawValue,preserveOccurrenceCommas,commandPath){const occurrences=Array.isArray(rawValue)?rawValue.flat(1/0):[rawValue],entries=preserveOccurrenceCommas?occurrences:occurrences.flatMap(entry=>typeof entry=="string"?entry.split(","):[entry]);for(const entry of entries)if(typeof entry=="string"&&entry.trim().length===0){const failure=describeFlagScalarValueFailure(entry,kind);refuseStrictScalarValue(definition,kind,entry,failure.expected,commandPath)}}function validateStrictScalarOptionValue(definition,value,kind,commandPath){if(!isStrictTypedDefinition(definition,kind))return value;const isSwitch=kind==="boolean"&&isBooleanSwitchDefinition(definition),normalizeEntry=entry=>{const failure=describeFlagScalarValueFailure(entry,kind);return failure===null?entry:isSwitch&&typeof entry=="string"?!0:refuseStrictScalarValue(definition,kind,entry,failure.expected,commandPath)};return Array.isArray(value)?value.map(normalizeEntry):normalizeEntry(value)}function mergeAliasOptionKeys(coerced,canonical,optionKeys,isListFlag){for(const key of optionKeys)if(!(key===canonical||!Object.hasOwn(coerced,key))){if(Object.hasOwn(coerced,canonical)){if(isListFlag){const canonicalValue=coerced[canonical],aliasValue=coerced[key];coerced[canonical]=[...Array.isArray(canonicalValue)?canonicalValue:[canonicalValue],...Array.isArray(aliasValue)?aliasValue:[aliasValue]].filter(value=>value!=null)}delete coerced[key];continue}coerced[canonical]=coerced[key],delete coerced[key]}}function coerceLooseCommandOptionsWithFlagDefinitions(options,definitions,occurrenceSource=options,commandPath){if(definitions.length===0)return options;const coerced=Object.create(null);for(const[key,value]of Object.entries(options))coerced[key]=value;const canonicalKeys=new Set(definitions.map(definition=>resolveCanonicalLooseOptionKey(definition)).filter(key=>key!==null));for(const definition of definitions){const canonical=resolveCanonicalLooseOptionKey(definition);if(canonical){const optionKeys=collectLooseOptionKeys(definition).filter(key=>key===canonical||!canonicalKeys.has(key));coerceDefinedLooseOption(coerced,definition,canonical,optionKeys,occurrenceSource,commandPath)}}return coerced}function coerceDefinedLooseOption(coerced,definition,canonical,optionKeys,occurrenceSource,commandPath){const isListFlag=definition.list===!0,kind=resolveLooseOptionCoercionKind(definition);kind&&!isListFlag&&refuseMalformedScalarAliasValues(coerced,definition,canonical,optionKeys,kind,commandPath),mergeAliasOptionKeys(coerced,canonical,optionKeys,isListFlag);const preserveOccurrenceCommas=definition.repeatable===!0;if(!Object.hasOwn(coerced,canonical)){definition.default!==void 0&&(coerced[canonical]=applyFlagDefault(definition.default,kind,isListFlag,preserveOccurrenceCommas));return}if(kind==="boolean"&&isStrictTypedDefinition(definition,kind)&&refuseMalformedAttachedSwitchValues(definition,optionKeys,occurrenceSource,commandPath),isListFlag){coerced[canonical]=coerceAccumulatedLooseOption(definition,optionKeys,occurrenceSource,coerced[canonical],kind,preserveOccurrenceCommas,commandPath);return}kind&&(coerced[canonical]=validateStrictScalarOptionValue(definition,coerceLooseOptionValue(coerced[canonical],kind),kind,commandPath))}function refuseMalformedScalarAliasValues(coerced,definition,canonical,optionKeys,kind,commandPath){for(const key of optionKeys)key!==canonical&&Object.hasOwn(coerced,key)&&validateStrictScalarOptionValue(definition,coerceLooseOptionValue(coerced[key],kind),kind,commandPath)}function coerceAccumulatedLooseOption(definition,optionKeys,occurrenceSource,current,kind,preserveOccurrenceCommas,commandPath){const ordered=readOrderedLooseListValues(occurrenceSource,optionKeys,current);kind&&isStrictTypedDefinition(definition,kind)&&refuseEmptyStrictListEntries(definition,kind,ordered,preserveOccurrenceCommas,commandPath);const normalized=normalizeAccumulatedFlagValue(ordered,kind,preserveOccurrenceCommas);return kind?validateStrictScalarOptionValue(definition,normalized,kind,commandPath):normalized}function parseLooseCommandOptions(args){const options=Object.create(null),occurrences=[];Object.defineProperty(options,LOOSE_OPTION_OCCURRENCES,{value:occurrences});let index=0;for(;index<args.length;){const parsed=parseLooseOptionToken(args,index);if(!parsed){index+=1;continue}const normalizedKey=toLooseOptionKey(parsed.key);if(normalizedKey.length===0||isUnsafeLooseOptionKey(normalizedKey)){index+=parsed.consumed;continue}setLooseOptionValue(options,normalizedKey,parsed.value),occurrences.push({...parsed,key:normalizedKey}),index+=parsed.consumed}return options}function collectLoosePositionalArgs(args){const positionals=[];let index=0;for(;index<args.length;){if(args[index]==="--"){positionals.push(...args.slice(index+1));break}const parsed=parseLooseOptionToken(args,index);if(parsed){index+=Math.max(1,parsed.consumed);continue}positionals.push(args[index]),index+=1}return positionals}function stripLooseCommandOptionTokens(args,definitions){if(definitions.length===0)return[...args];const knownKeys=new Set,booleanKeys=new Set;for(const definition of definitions){const valueKind=resolveLooseOptionCoercionKind(definition);for(const key of collectLooseOptionKeys(definition))knownKeys.add(key),valueKind==="boolean"&&booleanKeys.add(key)}if(knownKeys.size===0)return[...args];const stripped=[];let index=0;for(;index<args.length;){if(args[index]==="--"){stripped.push(...args.slice(index+1));break}const parsed=parseLooseOptionToken(args,index);if(parsed){const normalizedKey=toLooseOptionKey(parsed.key);if(knownKeys.has(normalizedKey)){const token=args[index],consumed=booleanKeys.has(normalizedKey)&&!token.includes("=")?1:parsed.consumed;index+=consumed;continue}}stripped.push(args[index]),index+=1}return stripped}function resolveExtensionFlagOptionKey(definition){return resolveCanonicalLooseOptionKey(definition)}function normalizeFlagTargetCommandPath(commandPath){return commandPath.trim().toLowerCase().split(/\s+/u).filter(part=>part.length>0).join(" ")}function collectExtensionFlagDefinitionsForCommand(registrations,commandPath){const normalizedCommandPath=normalizeFlagTargetCommandPath(commandPath);if(normalizedCommandPath.length===0)return[];const operation=resolvePmCommandOperation(normalizedCommandPath);return registrations.flags.filter(entry=>resolvePmCommandOperation(normalizeFlagTargetCommandPath(entry.target_command))===operation).flatMap(entry=>[...entry.flags])}function refuseConflictingOptionSpellings(definition,handlerKey,spellings,commandPath){const label=formatLooseOptionLabel(definition),[first,second]=spellings;throw new PmCliError(`Options '${first}' and '${second}' both set ${label} for extension command '${commandPath}' with different values.`,EXIT_CODE.USAGE,{code:"extension_option_spelling_conflict",required:`Pass ${label} once, under the handler key '${handlerKey}'.`,why:`'${first}' and '${second}' are spellings of the same declared flag, and pm refuses to choose between two different values.`,nextSteps:[`Remove '${first}' or '${second}' and pass one value as '${handlerKey}'.`,`Run pm contracts --command ${commandPath} --flags-only --json to read each flag's sdk_option key.`]})}function normalizeDirectExtensionCommandOptions(options,declaredDefinitions,commandPath,policy={}){if(declaredDefinitions.length===0)return options;const definitions=declaredDefinitions.map(definition=>definition.repeatable===!0&&definition.list!==!0?{...definition,list:!0}:definition),index=indexDeclaredOptionSpellings(definitions),folded=foldDirectOptionSpellings(options,index,commandPath),handlerKeys=new Set([...index.long.values()].map(({handlerKey})=>handlerKey)),declared=Object.create(null),passthrough=Object.create(null);for(const[key,value]of Object.entries(folded))handlerKeys.has(key)?declared[key]=value:value===void 0||policy.undeclaredKeys==="pass"||isDirectHostOptionKey(key)?passthrough[key]=value:refuseUnknownExtensionOption(key,toDashedOptionFlag(key),commandPath,collectRefusalListingLabels(definitions,{}));return refuseDirectDeclarationViolations(declared,definitions,commandPath),Object.assign(passthrough,coerceLooseCommandOptionsWithFlagDefinitions(declared,definitions,recordDirectOptionOccurrences(declared,index),commandPath))}function recordDirectOptionOccurrences(folded,index){const handlerKeys=new Set([...index.long.values()].map(({handlerKey})=>handlerKey)),occurrences=Object.entries(folded).filter(([key])=>handlerKeys.has(key)).flatMap(([key,value])=>(Array.isArray(value)?value.flat(1/0):[value]).map(entry=>({consumed:1,key,value:entry,attached:!0}))),occurrenceSource=Object.create(null);return Object.defineProperty(occurrenceSource,LOOSE_OPTION_OCCURRENCES,{value:occurrences}),occurrenceSource}function refuseDirectDeclarationViolations(declared,definitions,commandPath){for(const definition of definitions){const handlerKey=resolveCanonicalLooseOptionKey(definition);if(handlerKey===null)continue;const label=formatLooseOptionLabel(definition),value=declared[handlerKey],supplied=Object.hasOwn(declared,handlerKey);definition.enabled===!1&&supplied&&refuseDisabledExtensionOption(label,commandPath);const present=supplied&&(definition.list!==!0||hasLooseListEntries(definition,value));definition.required===!0&&definition.enabled!==!1&&!present&&refuseMissingRequiredExtensionOption(definition,handlerKey,label,commandPath),definition.list!==!0&&Array.isArray(value)&&refuseDirectArrayForSingleValueFlag(label,commandPath)}}function refuseDirectArrayForSingleValueFlag(label,commandPath){throw new PmCliError(`Option '${label}' for extension command '${commandPath}' takes one value; received an array.`,EXIT_CODE.USAGE,{code:"extension_flag_value_invalid",flag:label,required:`Pass one value for ${label}, or ask the package to declare it with list: true or repeatable: true.`,why:"The flag is not declared list or repeatable, so pm refuses an array before the extension handler runs instead of handing it a value of the wrong shape.",nextSteps:[`Run pm contracts --command ${commandPath} --flags-only --json to read each flag's value contract.`]})}const DIRECT_HOST_OPTION_KEYS=new Set([...[...RESERVED_EXTENSION_HOST_FLAG_NAMES].flatMap(flag=>{const body=flag.replace(/^--/u,"");return[body,...body.startsWith("no-")?[body.slice(3)]:[]].flatMap(spelling=>[toLooseOptionKey(spelling),spelling.replaceAll("-","_")])}),"force","subcommand","inputResponses","requestState"]);function isDirectHostOptionKey(key){return DIRECT_HOST_OPTION_KEYS.has(key)||DIRECT_HOST_OPTION_KEYS.has(toLooseOptionKey(key.replace(/^-{1,2}/u,"")))}function toDashedOptionFlag(key){return`--${key.replace(/^-+/u,"").replace(/([a-z0-9])([A-Z])/gu,"$1-$2").replaceAll("_","-").toLowerCase()}`}function indexDeclaredOptionSpellings(definitions){const index={long:new Map,short:new Map},claim=(map,spelling,entry)=>{spelling.length>0&&!map.has(spelling)&&map.set(spelling,entry)};for(const definition of definitions){const handlerKey=resolveCanonicalLooseOptionKey(definition);if(handlerKey===null)continue;const entry={handlerKey,definition};claim(index.long,handlerKey,entry);const short=typeof definition.short=="string"?definition.short.trim():"";short.startsWith("-")&&!short.startsWith("--")&&claim(index.short,short.slice(1),entry)}return index}function resolveDeclaredOptionSpelling(index,spelling){return index.long.get(spelling)??index.short.get(spelling.replace(/^-(?!-)/u,""))??index.long.get(toLooseOptionKey(spelling.replace(/^-{1,2}/u,"")))}function resolveNegatedBooleanSpelling(index,spelling,value,commandPath){const negated=/^(?:--)?no-(.+)$/u.exec(spelling)?.[1];if(negated===void 0||resolveDeclaredOptionSpelling(index,spelling)!==void 0)return{spelling,value};const declared=resolveDeclaredOptionSpelling(index,negated);return declared===void 0||resolveLooseOptionCoercionKind(declared.definition)!=="boolean"?{spelling,value}:(declared.definition.list===!0||declared.definition.repeatable===!0)&&Array.isArray(value)?{spelling:negated,value:value.flat(1/0).map(entry=>invertNegatedListEntry(spelling,declared.definition,entry,commandPath))}:declared.definition.list===!0&&value!==void 0?{spelling:negated,value:invertNegatedListEntry(spelling,declared.definition,value,commandPath)}:{spelling:negated,value:value===void 0?value:invertNegatedBooleanEntry(spelling,declared.definition,value,commandPath)}}function invertNegatedListEntry(spelling,definition,entry,commandPath){const invertToken=token=>token.trim().length===0?token:String(invertNegatedBooleanEntry(spelling,definition,token.trim(),commandPath));return entry==null?entry:typeof entry!="string"?invertNegatedBooleanEntry(spelling,definition,entry,commandPath):entry.trim().length===0?entry:definition.repeatable===!0||!entry.includes(",")?invertNegatedBooleanEntry(spelling,definition,entry,commandPath):entry.split(",").map(invertToken).join(",")}function invertNegatedBooleanEntry(spelling,definition,value,commandPath){const flag=coerceLooseBooleanOptionValue(value);return typeof flag=="boolean"?!flag:refuseNegatedBooleanValue(spelling,definition,value,commandPath)}function refuseNegatedBooleanValue(spelling,definition,value,commandPath){const label=formatLooseOptionLabel(definition);throw new PmCliError(`Option '${spelling}' for extension command '${commandPath}' negates ${label} and expects true, false, 1, or 0; received ${JSON.stringify(value)}.`,EXIT_CODE.USAGE,{code:"extension_flag_value_invalid",flag:label,required:`Pass ${label} as true or false, or '${spelling}' as true.`,why:`'${spelling}' is the negated spelling of the boolean ${label}, so only a boolean value can be inverted before the extension handler runs.`,nextSteps:[`Run pm contracts --command ${commandPath} --flags-only --json to read each flag's value contract.`]})}function foldDirectOptionSpellings(options,index,commandPath){const folded=Object.create(null),suppliedBy=new Map;for(const[rawSpelling,rawValue]of Object.entries(options)){const{spelling,value}=resolveNegatedBooleanSpelling(index,rawSpelling,rawValue,commandPath),declared=resolveDeclaredOptionSpelling(index,spelling);if(declared===void 0)folded[spelling]=value;else if(value!==void 0){const prior=suppliedBy.get(declared.handlerKey);prior===void 0?(suppliedBy.set(declared.handlerKey,spelling),folded[declared.handlerKey]=value):isDeepStrictEqual(deliverDirectOptionValue(declared.definition,declared.handlerKey,folded[declared.handlerKey],index,commandPath),deliverDirectOptionValue(declared.definition,declared.handlerKey,value,index,commandPath))||refuseConflictingOptionSpellings(declared.definition,declared.handlerKey,[prior,spelling],commandPath)}}return folded}function deliverDirectOptionValue(definition,handlerKey,value,index,commandPath){const single={[handlerKey]:value};return refuseDirectDeclarationViolations(single,[definition],commandPath),coerceLooseCommandOptionsWithFlagDefinitions(single,[definition],recordDirectOptionOccurrences(single,index),commandPath)[handlerKey]}function indexDeclaredArgvSpellings(definitions){const index=new Map;for(const definition of definitions){const handlerKey=resolveCanonicalLooseOptionKey(definition);if(handlerKey===null)continue;const entry={definition,handlerKey,kind:resolveLooseOptionCoercionKind(definition),arity:resolveExtensionFlagValueContract(definition).value_arity,scalar:definition.list!==!0},spellings=[resolveExtensionLongFlagName(definition.long),typeof definition.short=="string"?definition.short.trim():""];for(const spelling of spellings.filter(candidate=>candidate?.startsWith("-")===!0))index.has(spelling)||index.set(spelling,entry)}return index}function resolveArgvSpelling(scope,index,spelling){const registered=scope.optionOf(spelling),declared=index.get(spelling),settable=declared?.scalar===!0?declared:void 0;if(registered!==void 0){const base={arity:registered.arity,...registered.variadic===!0?{variadic:!0}:{}};if(settable?.handlerKey===registered.key)return{...base,declared:settable};const positive=declared===void 0&&spelling.startsWith("--no-")?index.get(`--${spelling.slice(5)}`):void 0;return positive?.scalar===!0&&positive.kind==="boolean"&&positive.handlerKey===registered.key?{...base,declared:positive,negates:!0}:base}if(!(!scope.includesLooseFlags||declared===void 0))return settable===void 0?{arity:declared.arity,loose:!0}:{arity:declared.arity,declared:settable,loose:!0}}function isArgvOptionToken(token){return token.length>1&&token.startsWith("-")}const NEGATIVE_NUMBER_ARGV_TOKEN=/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/u;function scanArgvScope(scope,resolve,record){const{tokens}=scope;let position=0,group,unrecognizedSeen=!1,variadic=!1;for(;position<tokens.length||group!==void 0;){const token=group??tokens[position++];if(token==="--")return;if(variadic&&group===void 0&&isArgvVariadicValue(scope,token))continue;const step=isArgvOptionToken(token)?scanArgvOptionToken(scope,token,tokens[position],resolve,record):{consumedByCommander:!1,consumed:0};if(position+=step.consumed,group=step.group,variadic=step.variadic===!0,!step.consumedByCommander){if(stopsArgvScope(scope.stop,token,unrecognizedSeen))return;unrecognizedSeen=!0}}}function isArgvVariadicValue(scope,token){return!isArgvOptionToken(token)||scope.negativeNumbersAreValues&&NEGATIVE_NUMBER_ARGV_TOKEN.test(token)}function stopsArgvScope(stop,token,unrecognizedSeen){return stop!==void 0&&(stop.atFirstUnrecognized||!unrecognizedSeen&&stop.atSubcommand(token))}function scanArgvOptionToken(scope,token,next,resolve,record){const loose=readLooseArgvOccurrence(token,next,resolve);if(loose!==void 0)return record(loose.spelling,loose.entry,loose.value),{consumedByCommander:!1,consumed:loose.consumed};const exact=resolve(token);if(exact!==void 0){const takesNext=exact.arity==="required"||exact.arity==="optional"&&next!==void 0&&(!isArgvOptionToken(next)||scope.negativeNumbersAreValues&&NEGATIVE_NUMBER_ARGV_TOKEN.test(next));return record(token,exact,exact.negates===!0?!1:takesNext?next:!0),{consumedByCommander:!0,consumed:takesNext?1:0,variadic:exact.variadic===!0}}return token[1]!=="-"?{consumed:0,...scanShortGroup(token,resolve,record)}:{consumedByCommander:scanLongToken(token,resolve,record,scope.includesLooseFlags?record:()=>{}),consumed:0}}function readLooseArgvOccurrence(token,next,resolve){const equals=token.indexOf("="),spelling=equals>1?token.slice(0,equals):token,entry=resolve(spelling);if(entry?.loose===!0)return equals>1?{spelling,entry,value:token.slice(equals+1),consumed:0}:next!==void 0&&!next.startsWith("-")?{spelling,entry,value:next,consumed:1}:{spelling,entry,value:!0,consumed:0};const negated=equals<0&&token.startsWith("--no-")?resolve(`--${token.slice(5)}`):void 0;return negated?.loose===!0&&negated.declared?.kind==="boolean"?{spelling:token,entry:negated,value:!1,consumed:0}:void 0}function scanShortGroup(token,resolve,record){const spelling=token.slice(0,2),entry=token.length>2?resolve(spelling):void 0;return entry===void 0||entry.loose===!0?{consumedByCommander:!1}:entry.arity!=="none"?(record(spelling,entry,token.slice(2)),{consumedByCommander:!0}):(record(spelling,entry,!0),{consumedByCommander:!0,group:`-${token.slice(2)}`})}function scanLongToken(token,resolve,record,recordUnparsed){const equals=token.indexOf("=");if(equals>2){const spelling=token.slice(0,equals),entry=resolve(spelling);return entry!==void 0&&entry.arity!=="none"?(record(spelling,entry,token.slice(equals+1)),!0):(entry?.declared?.kind==="boolean"&&recordUnparsed(spelling,entry,token.slice(equals+1)),!1)}const negated=token.startsWith("--no-")?resolve(`--${token.slice(5)}`):void 0;return negated?.declared?.kind==="boolean"&&recordUnparsed(token,negated,!1),!1}function refuseConflictingArgvOptionSpellings(scopes,definitions,commandPath){const index=indexDeclaredArgvSpellings(definitions),latest=new Map;for(const scope of scopes)scanArgvScope(scope,spelling=>resolveArgvSpelling(scope,index,spelling),(spelling,entry,value)=>{entry.declared!==void 0&&recordArgvSpellingValue(latest,entry.declared,spelling,value,commandPath)})}function recordArgvSpellingValue(latest,declared,spelling,value,commandPath){const{definition,handlerKey,kind}=declared,coerced=kind?coerceLooseOptionValue(value,kind):value,spellings=latest.get(handlerKey)??new Map,conflicting=[...spellings].find(([other,otherValue])=>other!==spelling&&!isDeepStrictEqual(otherValue,coerced));conflicting!==void 0&&refuseConflictingOptionSpellings(definition,handlerKey,[conflicting[0],spelling],commandPath),spellings.set(spelling,coerced),latest.set(handlerKey,spellings)}export{coerceLooseCommandOptionsWithFlagDefinitions,collectExtensionFlagDefinitionsForCommand,collectLooseCommandOptionKeysForDefinitions,collectLoosePositionalArgs,normalizeDirectExtensionCommandOptions,parseLooseCommandOptions,refuseConflictingArgvOptionSpellings,resolveExtensionFlagOptionKey,stripLooseCommandOptionTokens,validateLooseCommandOptionsWithFlagDefinitions};
|
|
1
|
+
import{isDeepStrictEqual as T}from"node:util";import{resolvePmCommandOperation as k}from"../cli-contracts/command-aliases.js";import{describeFlagScalarValueFailure as j,resolveExtensionFlagValueContract as F,resolveExtensionLongFlagName as L,EXIT_CODE as m,PmCliError as y,flattenFlagListValue as z,resolveFlagValueKind as fe}from"../runtime-primitives.js";import{RESERVED_EXTENSION_HOST_FLAG_NAMES as de}from"../../core/extensions/reserved-host-flags.js";const pe=new Set(["__proto__","prototype","constructor"]),x=Symbol("looseOptionOccurrences");function h(e){return e.trim().toLowerCase().replaceAll(/-([a-z0-9])/g,(t,o)=>o.toUpperCase())}function ge(e,n,t){const o=e[n];if(o===void 0){e[n]=t;return}if(Array.isArray(o)){o.push(t),e[n]=o;return}e[n]=[o,t]}function N(e,n){const t=e[n];if(!t.startsWith("-")||t==="-"||t==="--")return null;if(!t.startsWith("--")){const i=t.indexOf("=");if(i>=0)return{consumed:1,key:t.slice(1,i).trim(),value:t.slice(i+1),attached:!0};const a=t.slice(1).trim(),l=e[n+1];return typeof l=="string"&&!l.startsWith("-")?{consumed:2,key:a,value:l}:{consumed:1,key:a,value:!0}}const o=t.indexOf("=");if(o>=0)return{consumed:1,key:t.slice(2,o).trim(),value:t.slice(o+1),attached:!0};if(t.startsWith("--no-"))return{consumed:1,key:t.slice(5).trim(),value:!1};const r=t.slice(2).trim(),s=e[n+1];return typeof s=="string"&&!s.startsWith("-")?{consumed:2,key:r,value:s}:{consumed:1,key:r,value:!0}}function E(e){return pe.has(e)}function C(e){const n=(typeof e.value_type=="string"?e.value_type:void 0)??(typeof e.type=="string"?e.type:void 0);return fe(n)}function v(e){const n=[],t=L(e.long)??"",o=typeof e.short=="string"?e.short.trim():"";if(t.startsWith("--")){const r=h(t.slice(2));r.length>0&&!E(r)&&n.push(r)}if(o.startsWith("-")&&!o.startsWith("--")){const r=h(o.slice(1));r.length>0&&!E(r)&&n.push(r)}return[...new Set(n)]}function He(e){const n=new Set;for(const t of e)for(const o of v(t))n.add(o);return n}function O(e){const n=L(e.long)??"";if(n.startsWith("--")){const t=h(n.slice(2));if(t.length>0&&!E(t))return t}return v(e)[0]??null}function $(e){const n=L(e.long)??"";if(n.startsWith("--")&&n.length>2)return n;const t=typeof e.short=="string"?e.short.trim():"";return t.startsWith("-")&&!t.startsWith("--")&&t.length>1?t:null}function U(e,n){return[...(n.definitions??e).map(o=>$(o)).filter(o=>o!==null),...n.inheritedFlags??[]]}function Je(e,n,t,o={}){if(n.length===0)return;const r=new Set,s=new Map,i=[],a=U(n,o);for(const l of n){const u=v(l),c=$(l);for(const g of u)r.add(g),l.enabled===!1&&s.set(g,c);l.required===!0&&l.enabled!==!1&&u.length>0&&i.push({keys:u,label:c,definition:l})}for(const l of Object.keys(e)){r.has(l)||B(`--${l}`,`--${l}`,t,a);const u=s.get(l);u&&I(u,t)}for(const l of i){const u=c=>Object.hasOwn(e,c)&&(l.definition.list!==!0||J(l.definition,e[c]));l.keys.some(u)||G(l.definition,l.keys[0],l.label,t)}}function B(e,n,t,o){const r=o.length>0?` Expected one of: ${[...new Set(o)].join(", ")}.`:"";throw new y(`Unknown option '${e}' for extension command '${t}'.${r}`,m.USAGE,{code:"unknown_option",flag:n,required:`Use a flag the command accepts; run pm contracts --command ${t} --flags-only --json to list them.`})}function I(e,n){throw new y(`Option '${e}' is disabled for extension command '${n}'.`,m.USAGE,{code:"extension_option_disabled",flag:e,required:`Remove ${e}; the command declares it with enabled: false.`,why:"A disabled declaration keeps the flag in the contract while refusing every value for it.",examples:[`pm ${n} --help`],nextSteps:[`Run pm contracts --command ${n} --flags-only --json to list the flags this command accepts.`]})}function G(e,n,t,o){const r=F(e),s=r.value_arity==="none"?t:r.value_arity==="optional"?`${t} [${r.value_name}]`:`${t} <${r.value_name}>`;throw new y(`Missing required option '${t}' for extension command '${o}'.`,m.USAGE,{code:"missing_required_option",flag:t,field:n,required:`Pass ${s}.`,why:"The command declares this flag as required, so pm refuses the invocation before the extension handler runs.",examples:[`pm ${o} ${s}`],nextSteps:[`Run pm contracts --command ${o} --flags-only --json to read each flag's sdk_option key.`],recovery:{missing:[t]}})}function he(e){return typeof e=="string"||e==null?e:String(e)}function me(e){if(typeof e=="number")return e;if(typeof e=="string"&&e.trim().length>0){const n=Number(e);return Number.isFinite(n)?n:e}return e}function H(e){if(typeof e=="boolean")return e;if(typeof e=="string"){const n=e.trim().toLowerCase();if(n==="true"||n==="1")return!0;if(n==="false"||n==="0")return!1}return e}const ye={string:he,number:me,boolean:H};function b(e,n){return Array.isArray(e)?e.map(t=>b(t,n)):ye[n](e)}function V(e,n,t){const o=t?(Array.isArray(e)?e.flat(1/0):[e]).filter(r=>r!=null&&r!==""):z(e);return n?o.map(r=>b(r,n)):o}function J(e,n){return V(n,null,e.repeatable===!0).length>0}function Oe(e,n,t,o){return t?V(e,n,o):n?b(e,n):e}function be(e,n,t){const o=Y(e,n);return o.length===0?t:o.map(r=>r.value)}function X(e){return F(e).value_arity==="none"}function q(e,n,t,o,r){const s=$(e),i=r?` for extension command '${r}'`:"",a=t===!0?"no value":JSON.stringify(t);throw new y(`Option '${s}'${i} expects ${o}; received ${a}.`,m.USAGE,{code:"extension_flag_value_invalid",flag:s,required:`Pass ${s} ${n==="number"?"<number>":"<true|false|1|0>"}.`,why:`The flag declares value_type ${n} with value_validation strict, so a malformed token is refused before the extension handler runs.`,nextSteps:[`Re-run with a valid ${n} value for ${s}.`,`Run pm ${r??"<command>"} --help to review the declared flag contract.`]})}function D(e,n){return e.value_validation==="strict"&&n!=="string"}function Y(e,n){const t=e[x];if(!t)return[];const o=new Set(n);return t.filter(r=>o.has(r.key))}function we(e,n,t,o){if(X(e))for(const r of Y(t,n)){if(r.attached!==!0)continue;const s=e.list===!0&&e.repeatable!==!0?z(r.value):[r.value];for(const i of s){const a=j(b(i,"boolean"),"boolean");a!==null&&q(e,"boolean",i,a.expected,o)}}}function Se(e,n,t,o,r){const s=Array.isArray(t)?t.flat(1/0):[t],i=o?s:s.flatMap(a=>typeof a=="string"?a.split(","):[a]);for(const a of i)if(typeof a=="string"&&a.trim().length===0){const l=j(a,n);q(e,n,a,l.expected,r)}}function R(e,n,t,o){if(!D(e,t))return n;const r=t==="boolean"&&X(e),s=i=>{const a=j(i,t);return a===null?i:r&&typeof i=="string"?!0:q(e,t,i,a.expected,o)};return Array.isArray(n)?n.map(s):s(n)}function ve(e,n,t,o){for(const r of t)if(!(r===n||!Object.hasOwn(e,r))){if(Object.hasOwn(e,n)){if(o){const s=e[n],i=e[r];e[n]=[...Array.isArray(s)?s:[s],...Array.isArray(i)?i:[i]].filter(a=>a!=null)}delete e[r];continue}e[n]=e[r],delete e[r]}}function Z(e,n,t=e,o){if(n.length===0)return e;const r=Object.create(null);for(const[i,a]of Object.entries(e))r[i]=a;const s=new Set(n.map(i=>O(i)).filter(i=>i!==null));for(const i of n){const a=O(i);if(a){const l=v(i).filter(u=>u===a||!s.has(u));$e(r,i,a,l,t,o)}}return r}function $e(e,n,t,o,r,s){const i=n.list===!0,a=C(n);a&&!i&&xe(e,n,t,o,a,s),ve(e,t,o,i);const l=n.repeatable===!0;if(!Object.hasOwn(e,t)){n.default!==void 0&&(e[t]=Oe(n.default,a,i,l));return}if(a==="boolean"&&D(n,a)&&we(n,o,r,s),i){e[t]=Ae(n,o,r,e[t],a,l,s);return}a&&(e[t]=R(n,b(e[t],a),a,s))}function xe(e,n,t,o,r,s){for(const i of o)i!==t&&Object.hasOwn(e,i)&&R(n,b(e[i],r),r,s)}function Ae(e,n,t,o,r,s,i){const a=be(t,n,o);r&&D(e,r)&&Se(e,r,a,s,i);const l=V(a,r,s);return r?R(e,l,r,i):l}function Xe(e){const n=Object.create(null),t=[];Object.defineProperty(n,x,{value:t});let o=0;for(;o<e.length;){const r=N(e,o);if(!r){o+=1;continue}const s=h(r.key);if(s.length===0||E(s)){o+=r.consumed;continue}ge(n,s,r.value),t.push({...r,key:s}),o+=r.consumed}return n}function Ye(e){const n=[];let t=0;for(;t<e.length;){if(e[t]==="--"){n.push(...e.slice(t+1));break}const o=N(e,t);if(o){t+=Math.max(1,o.consumed);continue}n.push(e[t]),t+=1}return n}function Ze(e,n){if(n.length===0)return[...e];const t=new Set,o=new Set;for(const i of n){const a=C(i);for(const l of v(i))t.add(l),a==="boolean"&&o.add(l)}if(t.size===0)return[...e];const r=[];let s=0;for(;s<e.length;){if(e[s]==="--"){r.push(...e.slice(s+1));break}const i=N(e,s);if(i){const a=h(i.key);if(t.has(a)){const l=e[s],u=o.has(a)&&!l.includes("=")?1:i.consumed;s+=u;continue}}r.push(e[s]),s+=1}return r}function Qe(e){return O(e)}function Q(e){return e.trim().toLowerCase().split(/\s+/u).filter(n=>n.length>0).join(" ")}function Pe(e,n){const t=Q(n);if(t.length===0)return[];const o=k(t);return e.flags.filter(r=>k(Q(r.target_command))===o).flatMap(r=>[...r.flags])}function P(e,n,t,o){const r=$(e),[s,i]=t;throw new y(`Options '${s}' and '${i}' both set ${r} for extension command '${o}' with different values.`,m.USAGE,{code:"extension_option_spelling_conflict",required:`Pass ${r} once, under the handler key '${n}'.`,why:`'${s}' and '${i}' are spellings of the same declared flag, and pm refuses to choose between two different values.`,nextSteps:[`Remove '${s}' or '${i}' and pass one value as '${n}'.`,`Run pm contracts --command ${o} --flags-only --json to read each flag's sdk_option key.`]})}function en(e,n,t,o={}){if(n.length===0)return e;const r=n.map(c=>c.repeatable===!0&&c.list!==!0?{...c,list:!0}:c),s=Ce(r),i=Fe(e,s,t),a=new Set([...s.long.values()].map(({handlerKey:c})=>c)),l=Object.create(null),u=Object.create(null);for(const[c,g]of Object.entries(i))a.has(c)?l[c]=g:g===void 0||o.undeclaredKeys==="pass"||Le(c)?u[c]=g:B(c,Ee(c),t,U(r,{}));return ne(l,r,t),Object.assign(u,Z(l,r,ee(l,s),t))}function ee(e,n){const t=new Set([...n.long.values()].map(({handlerKey:s})=>s)),o=Object.entries(e).filter(([s])=>t.has(s)).flatMap(([s,i])=>(Array.isArray(i)?i.flat(1/0):[i]).map(a=>({consumed:1,key:s,value:a,attached:!0}))),r=Object.create(null);return Object.defineProperty(r,x,{value:o}),r}function ne(e,n,t){for(const o of n){const r=O(o);if(r===null)continue;const s=$(o),i=e[r],a=Object.hasOwn(e,r);o.enabled===!1&&a&&I(s,t);const l=a&&(o.list!==!0||J(o,i));o.required===!0&&o.enabled!==!1&&!l&&G(o,r,s,t),o.list!==!0&&Array.isArray(i)&&_e(s,t)}}function _e(e,n){throw new y(`Option '${e}' for extension command '${n}' takes one value; received an array.`,m.USAGE,{code:"extension_flag_value_invalid",flag:e,required:`Pass one value for ${e}, or ask the package to declare it with list: true or repeatable: true.`,why:"The flag is not declared list or repeatable, so pm refuses an array before the extension handler runs instead of handing it a value of the wrong shape.",nextSteps:[`Run pm contracts --command ${n} --flags-only --json to read each flag's value contract.`]})}const te=new Set([...[...de].flatMap(e=>{const n=e.replace(/^--/u,"");return[n,...n.startsWith("no-")?[n.slice(3)]:[]].flatMap(o=>[h(o),o.replaceAll("-","_")])}),"force","subcommand","inputResponses","requestState"]);function Le(e){return te.has(e)||te.has(h(e.replace(/^-{1,2}/u,"")))}function Ee(e){return`--${e.replace(/^-+/u,"").replace(/([a-z0-9])([A-Z])/gu,"$1-$2").replaceAll("_","-").toLowerCase()}`}function Ce(e){const n={long:new Map,short:new Map},t=(o,r,s)=>{r.length>0&&!o.has(r)&&o.set(r,s)};for(const o of e){const r=O(o);if(r===null)continue;const s={handlerKey:r,definition:o};t(n.long,r,s);const i=typeof o.short=="string"?o.short.trim():"";i.startsWith("-")&&!i.startsWith("--")&&t(n.short,i.slice(1),s)}return n}function W(e,n){return e.long.get(n)??e.short.get(n.replace(/^-(?!-)/u,""))??e.long.get(h(n.replace(/^-{1,2}/u,"")))}function Ke(e,n,t,o){const r=/^(?:--)?no-(.+)$/u.exec(n)?.[1];if(r===void 0||W(e,n)!==void 0)return{spelling:n,value:t};const s=W(e,r);return s===void 0||C(s.definition)!=="boolean"?{spelling:n,value:t}:(s.definition.list===!0||s.definition.repeatable===!0)&&Array.isArray(t)?{spelling:r,value:t.flat(1/0).map(i=>re(n,s.definition,i,o))}:s.definition.list===!0&&t!==void 0?{spelling:r,value:re(n,s.definition,t,o)}:{spelling:r,value:t===void 0?t:K(n,s.definition,t,o)}}function re(e,n,t,o){const r=s=>s.trim().length===0?s:String(K(e,n,s.trim(),o));return t==null?t:typeof t!="string"?K(e,n,t,o):t.trim().length===0?t:n.repeatable===!0||!t.includes(",")?K(e,n,t,o):t.split(",").map(r).join(",")}function K(e,n,t,o){const r=H(t);return typeof r=="boolean"?!r:je(e,n,t,o)}function je(e,n,t,o){const r=$(n);throw new y(`Option '${e}' for extension command '${o}' negates ${r} and expects true, false, 1, or 0; received ${JSON.stringify(t)}.`,m.USAGE,{code:"extension_flag_value_invalid",flag:r,required:`Pass ${r} as true or false, or '${e}' as true.`,why:`'${e}' is the negated spelling of the boolean ${r}, so only a boolean value can be inverted before the extension handler runs.`,nextSteps:[`Run pm contracts --command ${o} --flags-only --json to read each flag's value contract.`]})}function Fe(e,n,t){const o=Object.create(null),r=new Map;for(const[s,i]of Object.entries(e)){const{spelling:a,value:l}=Ke(n,s,i,t),u=W(n,a);if(u===void 0)o[a]=l;else if(l!==void 0){const c=r.get(u.handlerKey);c===void 0?(r.set(u.handlerKey,a),o[u.handlerKey]=l):T(oe(u.definition,u.handlerKey,o[u.handlerKey],n,t),oe(u.definition,u.handlerKey,l,n,t))||P(u.definition,u.handlerKey,[c,a],t)}}return o}function oe(e,n,t,o,r){const s={[n]:t};return ne(s,[e],r),Z(s,[e],ee(s,o),r)[n]}function se(e){const n=new Map;for(const t of e){const o=O(t);if(o===null)continue;const r={definition:t,handlerKey:o,kind:C(t),arity:F(t).value_arity,scalar:t.list!==!0},s=[L(t.long),typeof t.short=="string"?t.short.trim():""];for(const i of s.filter(a=>a?.startsWith("-")===!0))n.has(i)||n.set(i,r)}return n}function ie(e,n,t,o=ke){const r=e.optionOf(t),s=n.get(t),i=s!==void 0&&o(s)?s:void 0;if(r!==void 0){const a={arity:r.arity,...r.variadic===!0?{variadic:!0}:{}};if(i?.handlerKey===r.key)return{...a,declared:i};if(s!==void 0)return a;const l=Te(n,t,r,o);return l===void 0?a:{...a,declared:l,negates:!0}}if(!(!e.includesLooseFlags||s===void 0))return i===void 0?{arity:s.arity,loose:!0}:{arity:s.arity,declared:i,loose:!0}}function M(e){return e.length>1&&e.startsWith("-")}const ae=/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/u;function le(e,n,t){const{tokens:o}=e;let r=0,s,i=!1,a=!1;for(;r<o.length||s!==void 0;){const l=s??o[r++];if(l==="--")return;if(a&&s===void 0&&Ne(e,l))continue;const u=M(l)?qe(e,l,o[r],n,t):{consumedByCommander:!1,consumed:0};if(r+=u.consumed,s=u.group,a=u.variadic===!0,!u.consumedByCommander){if(Ve(e.stop,l,i))return;i=!0}}}function Ne(e,n){return!M(n)||e.negativeNumbersAreValues&&ae.test(n)}function Ve(e,n,t){return e!==void 0&&(e.atFirstUnrecognized||!t&&e.atSubcommand(n))}function qe(e,n,t,o,r){const s=De(n,t,o);if(s!==void 0)return r(s.spelling,s.entry,s.value,"loose"),{consumedByCommander:!1,consumed:s.consumed};const i=o(n);if(i!==void 0){const a=i.arity==="required"||i.arity==="optional"&&t!==void 0&&(!M(t)||e.negativeNumbersAreValues&&ae.test(t));return r(n,i,i.negates===!0?!1:a?t:!0,"commander"),{consumedByCommander:!0,consumed:a?1:0,variadic:i.variadic===!0}}return n[1]!=="-"?{consumed:0,...Re(n,o,r)}:{consumedByCommander:We(n,o,r,e.includesLooseFlags?r:()=>{}),consumed:0}}function De(e,n,t){const o=e.indexOf("="),r=o>1?e.slice(0,o):e,s=t(r);if(s?.loose===!0)return o>1?{spelling:r,entry:s,value:e.slice(o+1),consumed:0}:n!==void 0&&!n.startsWith("-")?{spelling:r,entry:s,value:n,consumed:1}:{spelling:r,entry:s,value:!0,consumed:0};const i=o<0&&e.startsWith("--no-")?t(`--${e.slice(5)}`):void 0;return i?.loose===!0&&i.declared?.kind==="boolean"?{spelling:e,entry:i,value:!1,consumed:0}:void 0}function Re(e,n,t){const o=e.slice(0,2),r=e.length>2?n(o):void 0;return r===void 0||r.loose===!0?{consumedByCommander:!1}:r.arity!=="none"?(t(o,r,e.slice(2),"commander"),{consumedByCommander:!0}):(t(o,r,!0,"commander"),{consumedByCommander:!0,group:`-${e.slice(2)}`})}function We(e,n,t,o){const r=e.indexOf("=");if(r>2){const i=e.slice(0,r),a=n(i);return a!==void 0&&a.arity!=="none"?(t(i,a,e.slice(r+1),"commander"),!0):(a?.declared?.kind==="boolean"&&o(i,a,e.slice(r+1),"loose"),!1)}const s=e.startsWith("--no-")?n(`--${e.slice(5)}`):void 0;return s?.declared?.kind==="boolean"&&o(e,s,!1,"loose"),!1}function nn(e,n,t){const o=se(n),r=new Map;for(const s of e)le(s,i=>ie(s,o,i),(i,a,l)=>{a.declared!==void 0&&Me(r,a.declared,i,l,t)})}function Me(e,n,t,o,r){const{definition:s,handlerKey:i,kind:a}=n,l=a?b(o,a):o,u=e.get(i)??new Map,c=[...u].find(([g,f])=>g!==t&&!T(f,l));c!==void 0&&P(s,i,[c[0],t],r),u.set(t,l),e.set(i,u)}function Te(e,n,t,o){const r=n.startsWith("--no-")?e.get(`--${n.slice(5)}`):void 0;return r!==void 0&&o(r)&&r.kind==="boolean"&&r.handlerKey===t.key?r:void 0}function ke(e){return e.scalar}function ue(e){return!e.scalar&&e.kind==="boolean"&&e.arity==="none"}function tn(e,n,t){const o=se(t),r=[...new Set(o.values())].filter(ue);if(r.length===0)return e;const s=new Set(t.map(f=>O(f)).filter(f=>f!==null)),i=f=>v(f.definition).filter(d=>d===f.handlerKey||!s.has(d)),a=new Map([...r].reverse().flatMap(f=>i(f).map(d=>[d,f]))),l=new Map;for(const f of n)le(f,d=>ie(f,o,d,ue)??ze(f,a,d),(d,w,S,A)=>{if(w.declared===void 0)return;const _=l.get(w.declared)??[];_.push(A==="commander"?{value:S}:null),l.set(w.declared,_)});const u=[...l].filter(([,f])=>f.some(d=>d!==null));if(u.length===0)return e;let c=e[x]??[];for(const[f,d]of u){const w=new Set(i(f)),S=c.filter(({key:p})=>w.has(p));if(S.length===0)continue;const A=p=>({consumed:0,key:f.handlerKey,value:p.value});let _=0;const ce=d.filter(p=>p===null).length===S.length?d.map(p=>p===null?S[_++]:A(p)):[...S,...d.filter(p=>p!==null).map(A)];c=[...c.filter(({key:p})=>!w.has(p)),...ce]}const g=Object.assign(Object.create(null),e);return Object.defineProperty(g,x,{value:c}),g}function ze(e,n,t){const o=!t.startsWith("--")&&e.optionOf(t.slice(0,2))!==void 0;if(!e.includesLooseFlags||o)return;const r=n.get(h(t.replace(/^-+/u,"")));return r===void 0?void 0:{arity:r.arity,declared:r,loose:!0}}export{Z as coerceLooseCommandOptionsWithFlagDefinitions,Pe as collectExtensionFlagDefinitionsForCommand,He as collectLooseCommandOptionKeysForDefinitions,Ye as collectLoosePositionalArgs,en as normalizeDirectExtensionCommandOptions,tn as orderArgvRepeatableSwitchOccurrences,Xe as parseLooseCommandOptions,nn as refuseConflictingArgvOptionSpellings,Qe as resolveExtensionFlagOptionKey,C as resolveLooseOptionCoercionKind,Ze as stripLooseCommandOptionTokens,Je as validateLooseCommandOptionsWithFlagDefinitions};
|
|
2
2
|
//# sourceMappingURL=command-options.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
const s=async(e,r,o)=>{if(!Number.isInteger(r)||r<1)throw new RangeError("concurrency must be a positive integer");const n=new Array(e.length);let t=0;const i=Array.from({length:Math.min(r,e.length)},async()=>{for(;t<e.length;){const a=t;t+=1,n[a]=await o(e[a])}});return await Promise.all(i),n};export{s as mapWithFixedConcurrency};
|
|
2
2
|
//# sourceMappingURL=concurrency.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import o from"node:path";import{isPathWithinDirectory as l}from"../../core/fs/path-utils.js";function m(e,i,t,f){const s=o.relative(e,t);if(s!==""&&!l(e,t)||t===i||l(i,t))return!1;const n=s.split(o.sep);return n.includes(".git")?!1:f?!n.some(r=>r===".agents"||r==="node_modules"||r.startsWith(".pm-extension-install-backup-")):!0}export{m as includesExtensionCopyPath};
|
|
2
2
|
//# sourceMappingURL=copy-scope.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{resolvePmToolCustomFieldCollision as s}from"../cli-contracts/tool-schema.js";const a=o=>[...o.registrations.item_fields.flatMap(e=>e.fields.map(l=>({layer:e.layer,extension:e.name,field:l.name}))),...o.registrations.profiles.flatMap(e=>e.profile.fields.map(l=>({layer:e.layer,extension:e.name,field:l.key??""})))].flatMap(e=>{const l=s(e.field);return l?[`extension_custom_field_mcp_input_collision:${e.layer}:${e.extension}:${l.field}:${l.property}:${l.owner}:use=${l.nested_path}`]:[]}).filter((e,l,i)=>i.indexOf(e)===l).sort((e,l)=>e.localeCompare(l));export{a as collectMcpCustomFieldCollisionDoctorWarnings};
|
|
2
2
|
//# sourceMappingURL=custom-field-collisions.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import{describeExtensionActivation as p}from"../../core/extensions/activation-summary.js";import{renderExtensionSurfaceMarkdown as f}from"../../core/extensions/activation-summary-markdown.js";import{normalizeExtensionNameForMatch as m}from"./shared.js";function u(e,s){return`${e}:${m(s)}`}function $(e,s){const c=[];for(const[a,o]of[["handler",e.commands.handlers],["override",e.commands.overrides]]){const i=new Map;for(const t of o){const r=i.get(t.command)??[];i.set(t.command,[...r,t])}for(const[t,r]of i){if(s!==null&&!r.some(n=>s.has(m(n.name))))continue;const d=r.at(-1);c.push({command:t,surface:a,policy:"last_activated_wins",collision:r.length>1,claimants:r.map(n=>({name:n.name,layer:n.layer,winner:n===d}))})}}return c.sort((a,o)=>a.command.localeCompare(o.command)||a.surface.localeCompare(o.surface))}function g(e,s,c){const a=new Set(c.failed.map(n=>u(n.layer,n.name))),o=[...s.loaded.map(n=>({name:n.name,layer:n.layer,version:n.version,activation_status:a.has(u(n.layer,n.name))?"failed":"ok",surfaces:p(c,{extensionName:n.name})})),...s.failed.map(n=>({name:n.name,layer:n.layer,version:"unknown",activation_status:"not_loaded",surfaces:p(c,{extensionName:n.name})}))].sort((n,l)=>n.name.localeCompare(l.name)||n.layer.localeCompare(l.layer)),i=typeof e=="string"?m(e):null,t=i===null?null:new Set(s.loaded.filter(n=>m(n.name)===i||typeof n.source_package=="string"&&m(n.source_package)===i||(n.source_aliases??[]).some(l=>m(l)===i)).map(n=>m(n.name)).concat(i)),r=t===null?o:o.filter(n=>t.has(m(n.name))),d=t===null?{}:{extensionNames:[...t]};return{target:typeof e=="string"?e.trim():null,total:r.length,extensions:r,union:p(c,d),command_ownership:$(c,t)}}const h={ok:"loaded",failed:"activation failed",not_loaded:"not loaded"};function y(e,s){const a=[`# ${`${s[0].toUpperCase()}${s.slice(1)}`} surface reference`,""];if(a.push(e.target===null?`Scope: all loaded ${s}s`:`Scope: \`${e.target}\``),a.push(`Described: ${e.total} ${s}${e.total===1?"":"s"}`,""),(e.command_ownership?.length??0)>0){a.push("## Command ownership","");for(const o of e.command_ownership){const i=o.claimants.find(r=>r.winner),t=o.claimants.map(r=>`${r.layer}:${r.name}`).join(", ");a.push(`- \`${o.command}\` (${o.surface}): ${i.layer}:${i.name}; policy=${o.policy}; collision=${String(o.collision)}; claimants=${t}`)}a.push("")}if(e.extensions.length===0)return a.push(`_No ${s}s are loaded._`,""),`${a.join(`
|
|
2
2
|
`).trimEnd()}
|
|
3
|
-
`;for(const
|
|
3
|
+
`;for(const o of e.extensions){const i=`${o.name} (${o.layer} v${o.version}, ${h[o.activation_status]})`;a.push(f(o.surfaces,{title:i,headingLevel:2}))}return e.extensions.length>1&&a.push(f(e.union,{title:`Union across all described ${s}s`,headingLevel:2})),`${a.join(`
|
|
4
4
|
`).trimEnd()}
|
|
5
|
-
`}export{buildExtensionDescribeResult,renderExtensionDescribeMarkdown};
|
|
5
|
+
`}export{g as buildExtensionDescribeResult,y as renderExtensionDescribeMarkdown};
|
|
6
6
|
//# sourceMappingURL=describe.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="573b0fd6-f003-55d8-8f49-c2a5e81cbc31")}catch{}})();import{reconcileExtensionCapabilityUsage}from"../../core/extensions/index.js";import{EXTENSION_CAPABILITY_CONTRACT,KNOWN_EXTENSION_CAPABILITIES,parseLegacyExtensionCapabilityAliasWarning,parseUnknownExtensionCapabilityWarning}from"../../core/extensions/loader.js";import{EXIT_CODE}from"../../core/shared/constants.js";import{PmCliError}from"../../core/shared/errors.js";import{normalizeExtensionNameForMatch}from"./shared.js";import{extensionVersionRemediation}from"../../core/extensions/version-diagnostics.js";function summarizeExtensionFailures(failures){return failures.map(({layer,name,error})=>({layer,name,error}))}function addRuntimePath(pathsByExtension,extensionName,pathValue){const normalizedName=normalizeExtensionNameForMatch(extensionName),normalizedPath=pathValue.trim();if(normalizedName.length===0||normalizedPath.length===0)return;const existing=pathsByExtension.get(normalizedName)??new Set;existing.add(normalizedPath),pathsByExtension.set(normalizedName,existing)}function collectRuntimeActivationPaths(activationResult){const commandPathsByExtension=new Map,actionPathsByExtension=new Map;for(const registration of activationResult.registrations.commands)addRuntimePath(commandPathsByExtension,registration.name,registration.command),addRuntimePath(actionPathsByExtension,registration.name,registration.action);for(const handler of activationResult.commands.handlers)addRuntimePath(commandPathsByExtension,handler.name,handler.command);for(const override of activationResult.commands.overrides)addRuntimePath(commandPathsByExtension,override.name,override.command);return{commandPathsByExtension,actionPathsByExtension}}function sortedRuntimePaths(values){if(!(!values||values.size===0))return[...values].sort((left,right)=>left.localeCompare(right))}function resolveDoctorActivationStatus(params){const{enabled,normalizedName,loadedNames,loadFailedNames,activationFailedNames}=params;return enabled?loadFailedNames.has(normalizedName)||activationFailedNames.has(normalizedName)?{runtime_active:!1,activation_status:"failed"}:loadedNames.has(normalizedName)?{runtime_active:!0,activation_status:"ok"}:{runtime_active:!1,activation_status:"not_loaded"}:{runtime_active:!1,activation_status:"not_loaded"}}function applyDoctorRuntimeActivationState(extensions,loadResult,activationResult){const loadedNames=new Set(loadResult.loaded.map(entry=>normalizeExtensionNameForMatch(entry.name))),loadFailedNames=new Set(loadResult.failed.map(entry=>normalizeExtensionNameForMatch(entry.name))),activationFailedNames=new Set(activationResult.failed.map(entry=>normalizeExtensionNameForMatch(entry.name))),{commandPathsByExtension,actionPathsByExtension}=collectRuntimeActivationPaths(activationResult);return extensions.map(entry=>{const normalizedName=normalizeExtensionNameForMatch(entry.name),commandPaths=sortedRuntimePaths(commandPathsByExtension.get(normalizedName)),actionPaths=sortedRuntimePaths(actionPathsByExtension.get(normalizedName)),runtimeMetadata={...commandPaths?{command_paths:commandPaths}:{},...actionPaths?{action_paths:actionPaths}:{}},activationStatus=resolveDoctorActivationStatus({enabled:entry.enabled,normalizedName,loadedNames,loadFailedNames,activationFailedNames});return{...entry,...activationStatus,...runtimeMetadata}})}function summarizePolicyWarnings(warnings){let warningCount=0,violationCount=0,blockedCount=0;for(const warning of warnings)if(warning.startsWith("extension_policy_")){if(warningCount+=1,warning.startsWith("extension_policy_violation_")){violationCount+=1;continue}warning.startsWith("extension_policy_blocked_")&&(blockedCount+=1)}return{warning_count:warningCount,violation_count:violationCount,blocked_count:blockedCount}}function lifecycleFlagCommand(options,action){return options.vocabulary==="package"?`pm package --${action}`:`pm extension --${action}`}const REGISTRATION_COLLISION_WARNING_CODES=new Set(["extension_command_handler_collision","extension_command_override_collision","extension_command_override_handler_overlap","extension_parser_override_collision","extension_preflight_override_collision","extension_renderer_collision","extension_service_override_collision"]);function isRegistrationCollisionWarning(warning){return REGISTRATION_COLLISION_WARNING_CODES.has(warningCode(warning))}function isExtensionLayer(value){return value==="project"||value==="global"}function parseRegistrationCollisionWarning(warning){const parts=warning.split(":"),code=parts[0];if(!code||!REGISTRATION_COLLISION_WARNING_CODES.has(code))return null;const winnerLayer=parts.at(-4),winnerName=parts.at(-3)?.trim(),displacedLayer=parts.at(-2),displacedName=parts.at(-1)?.trim();return!isExtensionLayer(winnerLayer)||!isExtensionLayer(displacedLayer)||!winnerName||!displacedName?null:{code,surface:parts.slice(1,-4).join(":")||"global",winner:{layer:winnerLayer,name:winnerName},displaced:{layer:displacedLayer,name:displacedName}}}function collectRegistrationCollisionExtensionNames(warnings){const names=new Set;for(const warning of warnings){const parsed=parseRegistrationCollisionWarning(warning);parsed&&(names.add(parsed.winner.name),names.add(parsed.displaced.name))}return[...names].sort((left,right)=>left.localeCompare(right))}function buildRegistrationCollisionRemediation(warnings,commands){const registrationCollisionWarnings=warnings.filter(isRegistrationCollisionWarning);if(registrationCollisionWarnings.length===0)return null;const collisionNames=collectRegistrationCollisionExtensionNames(registrationCollisionWarnings);return`Extension registration collisions or handler/override overlaps detected.${collisionNames.length>0?` Conflicting extensions: ${collisionNames.join(", ")}.`:""} Single-winner surfaces can hide earlier package behavior. Deactivate one conflicting package with ${commands.deactivate}, or scope registration surfaces in extensions.policy.extension_overrides, then rerun ${commands.doctor}.`}function buildRegistrationCollisionPlan(scope,warnings,extensions,options){const collisions=warnings.map(warning=>parseRegistrationCollisionWarning(warning)).filter(entry=>entry!==null).sort((left,right)=>`${left.code}:${left.surface}:${left.winner.name}:${left.displaced.name}`.localeCompare(`${right.code}:${right.surface}:${right.winner.name}:${right.displaced.name}`));if(collisions.length===0)return;const scopeFlag=scope==="global"?"--global":"--project",deactivatePrefix=lifecycleFlagCommand(options,"deactivate"),doctorCommand=`${lifecycleFlagCommand(options,"doctor")} ${scopeFlag} --detail deep --trace`,extensionByName=new Map(extensions.map(entry=>[normalizeExtensionNameForMatch(entry.name),entry])),affectedByName=new Map;for(const collision of collisions)for(const name of[collision.winner.name,collision.displaced.name]){const normalizedName=normalizeExtensionNameForMatch(name);affectedByName.set(normalizedName,(affectedByName.get(normalizedName)??0)+1)}const remediationCandidates=[...affectedByName.entries()].map(([normalizedName,affectedCollisions])=>{const extension=extensionByName.get(normalizedName),extensionName=extension?.name??normalizedName,commandPaths=extension?.command_paths??[],actionPaths=extension?.action_paths??[];return{action:"deactivate",extension:extensionName,command:`${deactivatePrefix} ${extensionName} ${scopeFlag}`,affected_collisions:affectedCollisions,feature_loss:{command_paths:[...commandPaths].sort((left,right)=>left.localeCompare(right)),action_paths:[...actionPaths].sort((left,right)=>left.localeCompare(right))}}}).sort((left,right)=>{const affectedDelta=right.affected_collisions-left.affected_collisions;if(affectedDelta!==0)return affectedDelta;const leftSurfaceCount=left.feature_loss.command_paths.length+left.feature_loss.action_paths.length,rightSurfaceCount=right.feature_loss.command_paths.length+right.feature_loss.action_paths.length;return leftSurfaceCount!==rightSurfaceCount?leftSurfaceCount-rightSurfaceCount:left.extension.localeCompare(right.extension)});return{status:"conflicts_detected",collision_count:collisions.length,extension_count:affectedByName.size,next_best_command:doctorCommand,collisions,remediation_candidates:remediationCandidates}}function classifyDoctorLoadFailureWarnings(loadFailures){const warnings=[];for(const failure of loadFailures){const normalizedError=failure.error.toLowerCase();(normalizedError.includes("cannot find package '@unbrained/pm-cli'")||normalizedError.includes('cannot find module "@unbrained/pm-cli"')||normalizedError.includes("cannot find module '@unbrained/pm-cli'"))&&warnings.push(`extension_load_failed_sdk_dependency_missing:${failure.name}`),(normalizedError.includes("cannot use import statement outside a module")||normalizedError.includes("to load an es module")||normalizedError.includes("must use import to load es module"))&&warnings.push(`extension_load_failed_module_mode_mismatch:${failure.name}`)}return[...new Set(warnings)].sort((left,right)=>left.localeCompare(right))}function classifyDoctorActivationFailureWarnings(activationFailures=[]){const failures=Array.isArray(activationFailures)?activationFailures:[],warnings=[];for(const failure of failures){if(!failure||typeof failure.name!="string")continue;const missingCapability=failure.trace?.missing_capability??failure.trace?.capability;typeof missingCapability=="string"&&missingCapability.trim().length>0&&warnings.push(`extension_capability_missing:${failure.name}:${missingCapability.trim().toLowerCase()}`)}return[...new Set(warnings)].sort((left,right)=>left.localeCompare(right))}function classifyUnusedCapabilityWarnings(loadResult,activationResult){const warnings=[];for(const entry of reconcileExtensionCapabilityUsage(loadResult.loaded,activationResult))for(const capability of entry.unused)warnings.push(`extension_capability_unused:${entry.layer}:${entry.name}:${capability}`);return[...new Set(warnings)].sort((left,right)=>left.localeCompare(right))}const TRIAGE_REMEDIATION_RULES=[{matches:warnings=>warnings.some(warning=>warning.startsWith("extension_manifest_")),build:ctx=>`Run ${lifecycleFlagCommand(ctx.options,"explore")} ${ctx.scopeFlag} to inspect discovered manifests and directories.`},{matches:warnings=>warnings.some(warning=>warning.startsWith("extension_capability_unknown:")),build:()=>`Unknown extension capabilities detected. Allowed capabilities: ${KNOWN_EXTENSION_CAPABILITIES.join(", ")}. Review extension_capability_unknown warning details for suggested replacements.`},{matches:warnings=>warnings.some(warning=>warning.startsWith("extension_capability_legacy_alias:")),build:()=>"Legacy extension capability aliases were auto-remapped to canonical capabilities. Update manifests to canonical names (migration/validation -> schema)."},{matches:warnings=>warnings.some(warning=>warning.startsWith("extension_capability_missing:")),build:ctx=>`Extension activation failed because code registered a surface missing from manifest capabilities. Run ${lifecycleFlagCommand(ctx.options,"doctor")} ${ctx.scopeFlag} --detail deep --trace and add the reported missing_capability to manifest.json before publishing.`},{matches:warnings=>warnings.some(warning=>warning.startsWith("extension_capability_unused:")),build:ctx=>`Extension manifests declare capabilities that are never registered against. Remove each reported unused capability from manifest.json to keep least privilege, or add the matching registration. Run ${lifecycleFlagCommand(ctx.options,"doctor")} ${ctx.scopeFlag} --detail deep --trace for per-extension registration counts.`},{matches:warnings=>warnings.some(warning=>warning.startsWith("extension_command_definition_legacy_handler_alias:")),build:()=>"Extension command definitions using legacy handler were auto-remapped. Update command definitions to use run: (context) => ... for forward compatibility."},{matches:warnings=>warnings.some(warning=>warning.startsWith("extension_output_service_override_global:")||warning.startsWith("extension_output_renderer_override_global:")),build:()=>"Global output service/renderer overrides are active. For output_format, return context.payload/null/undefined unless the extension owns the command. For renderers, return null for unrelated payloads so pm falls back to native rendering."},{matches:warnings=>warnings.some(warning=>warning.startsWith("extension_schema_narrow_activation:")),build:()=>"A package registers custom item types/fields (a GLOBAL schema contribution) but also declares narrow activation.commands, so it never activates for built-in commands like pm create <type> and the custom type silently fails to register. Remove activation.commands from manifest.json so pm activates the package for every command, or \u2014 if the schema is intentionally command-scoped \u2014 knowingly ignore this advisory."},{matches:warnings=>warnings.some(warning=>warning.startsWith("extension_load_failed_sdk_dependency_missing:")),build:ctx=>`Detected extension load failures caused by missing SDK dependency resolution. Ensure extension package dependencies include "@unbrained/pm-cli" and reinstall dependencies before running ${lifecycleFlagCommand(ctx.options,"doctor")} ${ctx.scopeFlag}.`},{matches:warnings=>warnings.some(warning=>warning.startsWith("extension_load_failed_module_mode_mismatch:")),build:ctx=>`Detected extension module-mode mismatches. For ESM-based extension entries/imports, set package.json "type": "module" or use an explicit .mjs entry and rerun ${lifecycleFlagCommand(ctx.options,"doctor")} ${ctx.scopeFlag}.`},{matches:warnings=>warnings.some(warning=>warning.startsWith("extension_pm_min_version_")||warning.startsWith("extension_pm_max_version_")),build:ctx=>`Extension pm version-bound warnings detected. Align each package manifest's pm_min_version/pm_max_version with the installed pm CLI version (see the warning's required/allowed=...:current=... details), or upgrade/downgrade the pm CLI to satisfy the declared bounds, then rerun ${lifecycleFlagCommand(ctx.options,"doctor")} ${ctx.scopeFlag}.`},{matches:(_warnings,ctx)=>ctx.updateCheckFailedTotal>0,build:ctx=>`Run ${lifecycleFlagCommand(ctx.options,"manage")} ${ctx.scopeFlag} after validating network and repository access.`},{matches:warnings=>warnings.some(warning=>warning.startsWith("extension_manager_state_")),build:ctx=>`Review and repair ${ctx.scope} managed extension state file if schema/read warnings persist.`},{matches:(_warnings,ctx)=>ctx.policyWarningCount>0,build:()=>"Extension governance policy warnings detected. Review settings.extensions.policy mode and allow/block lists to confirm intended capabilities and registration surfaces."}];function buildExtensionTriageRemediation(params){const{normalizedWarnings,options,scope,scopeFlag,updateCheckFailedTotal,policyWarningCount,unmanagedActionRequiredTotal,notCheckedTotal,skippedNonGithubTotal,updateAvailableTotal}=params,remediation=normalizedWarnings.map(extensionVersionRemediation).filter(guidance=>guidance!==void 0),ctx={options,scope,scopeFlag,updateCheckFailedTotal,policyWarningCount};if(normalizedWarnings.length>0){const registrationCollisionRemediation=buildRegistrationCollisionRemediation(normalizedWarnings,{deactivate:`${lifecycleFlagCommand(options,"deactivate")} <name> ${scopeFlag}`,doctor:`${lifecycleFlagCommand(options,"doctor")} ${scopeFlag} --detail deep --trace`});registrationCollisionRemediation&&remediation.push(registrationCollisionRemediation);for(const rule of TRIAGE_REMEDIATION_RULES)rule.matches(normalizedWarnings,ctx)&&remediation.push(rule.build(ctx))}return unmanagedActionRequiredTotal>0&&remediation.push(`Update-check coverage is partial because unmanaged extensions need adoption. Adopt existing installs via ${lifecycleFlagCommand(options,"manage")} ${scopeFlag} --fix-managed-state (or ${lifecycleFlagCommand(options,"adopt-all")} ${scopeFlag}, ${lifecycleFlagCommand(options,"adopt")} <name> ${scopeFlag}, or reinstall via ${lifecycleFlagCommand(options,"install")} ${scopeFlag} <source>).`),skippedNonGithubTotal>0&&remediation.push("Update-check coverage is partial: non-GitHub managed sources were not checked. Inspect their registry or source directly; zero detected updates does not mean these packages are current. Runtime activation health is independent."),notCheckedTotal>0&&remediation.push(`Update-check coverage is partial: some sources have no completed check. Run ${lifecycleFlagCommand(options,"manage")} ${scopeFlag} to request update checks.`),updateAvailableTotal>0&&remediation.push(`Update available managed extensions via ${lifecycleFlagCommand(options,"install")} ${scopeFlag} <source>.`),remediation.length===0&&remediation.push(`No immediate action required. Re-run ${lifecycleFlagCommand(options,"manage")} ${scopeFlag} after extension changes.`),remediation}function buildExtensionTriageSummary(scope,warnings,extensions,options={}){const normalizedWarnings=[...new Set(warnings)].sort((left,right)=>left.localeCompare(right)),managedTotal=extensions.filter(entry=>entry.managed).length,enabledTotal=extensions.filter(entry=>entry.enabled).length,activeTotal=extensions.filter(entry=>entry.active).length,updateAvailableTotal=extensions.filter(entry=>entry.update_check_status==="checked"&&entry.update_available===!0).length,unmanagedExtensions=extensions.filter(entry=>entry.managed===!1),unmanagedExpectedExtensions=unmanagedExtensions.filter(entry=>isExpectedUnmanagedExtension(entry)).map(entry=>entry.name).sort((left,right)=>left.localeCompare(right)),unmanagedActionRequiredExtensions=unmanagedExtensions.filter(entry=>!isExpectedUnmanagedExtension(entry)).map(entry=>entry.name).sort((left,right)=>left.localeCompare(right)),updateCheckStatusTotals={checked:0,skipped_unmanaged:0,skipped_non_github:0,failed:0,not_checked:0};for(const entry of extensions)updateCheckStatusTotals[entry.update_check_status]+=1;const updateCheckFailedTotal=updateCheckStatusTotals.failed,skippedNonGithubTotal=extensions.filter(entry=>entry.update_check_status==="skipped_non_github"&&entry.source?.kind!=="builtin").length,partialCoverageWarnings=Object.entries({skipped_unmanaged:unmanagedActionRequiredExtensions.length,skipped_non_github:skippedNonGithubTotal,failed:updateCheckFailedTotal,not_checked:updateCheckStatusTotals.not_checked}).filter(([,count])=>count>0).map(([status,count])=>`extension_update_health_partial_coverage:${status}:${count}`),updateHealthPartial=partialCoverageWarnings.length>0,updateHealthCoverage=updateHealthPartial?"partial":"full",effectiveWarnings=[...new Set([...normalizedWarnings,...partialCoverageWarnings])].sort((left,right)=>left.localeCompare(right)),warningCodes=[...new Set(effectiveWarnings.map(value=>warningCode(value)))].sort((left,right)=>left.localeCompare(right)),policyWarnings=summarizePolicyWarnings(effectiveWarnings),scopeFlag=scope==="global"?"--global":"--project",collisionPlan=buildRegistrationCollisionPlan(scope,normalizedWarnings,extensions,options),remediation=buildExtensionTriageRemediation({normalizedWarnings:effectiveWarnings,options,scope,scopeFlag,updateCheckFailedTotal,policyWarningCount:policyWarnings.warning_count,unmanagedActionRequiredTotal:unmanagedActionRequiredExtensions.length,notCheckedTotal:updateCheckStatusTotals.not_checked,skippedNonGithubTotal,updateAvailableTotal});return{status:effectiveWarnings.length===0?"ok":"warn",warning_count:effectiveWarnings.length,warning_codes:warningCodes,warnings:effectiveWarnings,policy_warning_count:policyWarnings.warning_count,policy_violation_count:policyWarnings.violation_count,policy_blocked_count:policyWarnings.blocked_count,total_extensions:extensions.length,managed_total:managedTotal,enabled_total:enabledTotal,active_total:activeTotal,update_available_total:updateAvailableTotal,update_health_coverage:updateHealthCoverage,update_health_partial:updateHealthPartial,unmanaged_loaded_extension_count:unmanagedExtensions.length,unmanaged_loaded_extensions:unmanagedExtensions.map(entry=>entry.name).sort((left,right)=>left.localeCompare(right)),unmanaged_expected_extension_count:unmanagedExpectedExtensions.length,unmanaged_expected_extensions:unmanagedExpectedExtensions,unmanaged_action_required_extension_count:unmanagedActionRequiredExtensions.length,unmanaged_action_required_extensions:unmanagedActionRequiredExtensions,update_check_status_totals:updateCheckStatusTotals,update_check_failed_total:updateCheckFailedTotal,top_warnings:effectiveWarnings.slice(0,8),remediation,...collisionPlan?{collision_plan:collisionPlan}:{}}}function parseDoctorDetailMode(raw){if(!raw||raw.trim().length===0)return"summary";const normalized=raw.trim().toLowerCase();if(normalized==="summary"||normalized==="deep")return normalized;throw new PmCliError(`Invalid --detail value "${raw}". Expected summary or deep.`,EXIT_CODE.USAGE)}function warningCode(value){const normalized=value.trim(),separator=normalized.indexOf(":");return separator===-1?normalized:normalized.slice(0,separator)}function collectUnknownCapabilityGuidance(warnings){const seen=new Set,guidance=[];for(const warning of warnings){const parsedDetails=(()=>{const unknownWarning=parseUnknownExtensionCapabilityWarning(warning);return unknownWarning?[unknownWarning]:parseLegacyExtensionCapabilityAliasWarning(warning)})();for(const parsed of parsedDetails){const key=`${parsed.layer}:${parsed.name}:${parsed.capability}`;seen.has(key)||(seen.add(key),guidance.push(parsed))}}return guidance}function buildCapabilityContractMetadata(){return{version:EXTENSION_CAPABILITY_CONTRACT.version,capabilities:[...EXTENSION_CAPABILITY_CONTRACT.capabilities],legacy_aliases:{...EXTENSION_CAPABILITY_CONTRACT.legacy_aliases}}}function isExpectedUnmanagedExtension(entry){const normalizedName=normalizeExtensionNameForMatch(entry.name),normalizedDirectory=normalizeExtensionNameForMatch(entry.directory);return normalizedName.startsWith("builtin-")?!0:normalizedDirectory==="beads"||normalizedDirectory==="todos"}function buildDoctorConsistencySummary(scope,installedExtensions,loadedExtensions,failedLoads,disabledByFlag){if(scope!=="project"||disabledByFlag)return{warnings:[],summary:{active_project_count:0,loaded_project_count:0,active_project_names:[],loaded_project_names:[],missing_active_project_names:[]}};const activeProjectNames=[...new Set(installedExtensions.filter(entry=>entry.active).map(entry=>normalizeExtensionNameForMatch(entry.name)))].sort((left,right)=>left.localeCompare(right)),loadedProjectNames=[...new Set(loadedExtensions.filter(entry=>entry.layer==="project").map(entry=>normalizeExtensionNameForMatch(entry.name)))].sort((left,right)=>left.localeCompare(right)),failedLoadNames=new Set(failedLoads.map(entry=>normalizeExtensionNameForMatch(entry.name))),missingActiveProjectNames=activeProjectNames.filter(name=>!loadedProjectNames.includes(name)&&!failedLoadNames.has(name)).sort((left,right)=>left.localeCompare(right));return{warnings:missingActiveProjectNames.length>0?[`extension_doctor_consistency_active_not_loaded:${missingActiveProjectNames.join(",")}`]:[],summary:{active_project_count:activeProjectNames.length,loaded_project_count:loadedProjectNames.length,active_project_names:activeProjectNames,loaded_project_names:loadedProjectNames,missing_active_project_names:missingActiveProjectNames}}}export{applyDoctorRuntimeActivationState,buildCapabilityContractMetadata,buildDoctorConsistencySummary,buildExtensionTriageSummary,buildRegistrationCollisionRemediation,classifyDoctorActivationFailureWarnings,classifyDoctorLoadFailureWarnings,classifyUnusedCapabilityWarnings,collectUnknownCapabilityGuidance,parseDoctorDetailMode,summarizeExtensionFailures};
|
|
1
|
+
import{reconcileExtensionCapabilityUsage as I}from"../../core/extensions/index.js";import{EXTENSION_CAPABILITY_CONTRACT as k,KNOWN_EXTENSION_CAPABILITIES as L,parseLegacyExtensionCapabilityAliasWarning as z,parseUnknownExtensionCapabilityWarning as D}from"../../core/extensions/loader.js";import{EXIT_CODE as U}from"../../core/shared/constants.js";import{PmCliError as O}from"../../core/shared/errors.js";import{normalizeExtensionNameForMatch as f}from"./shared.js";import{extensionVersionRemediation as G}from"../../core/extensions/version-diagnostics.js";function oe(e){return e.map(({layer:n,name:t,error:a})=>({layer:n,name:t,error:a}))}function $(e,n,t){const a=f(n),o=t.trim();if(a.length===0||o.length===0)return;const r=e.get(a)??new Set;r.add(o),e.set(a,r)}function M(e){const n=new Map,t=new Map;for(const a of e.registrations.commands)$(n,a.name,a.command),$(t,a.name,a.action);for(const a of e.commands.handlers)$(n,a.name,a.command);for(const a of e.commands.overrides)$(n,a.name,a.command);return{commandPathsByExtension:n,actionPathsByExtension:t}}function N(e){if(!(!e||e.size===0))return[...e].sort((n,t)=>n.localeCompare(t))}function q(e){const{enabled:n,normalizedName:t,loadedNames:a,loadFailedNames:o,activationFailedNames:r}=e;return n?o.has(t)||r.has(t)?{runtime_active:!1,activation_status:"failed"}:a.has(t)?{runtime_active:!0,activation_status:"ok"}:{runtime_active:!1,activation_status:"not_loaded"}:{runtime_active:!1,activation_status:"not_loaded"}}function ie(e,n,t){const a=new Set(n.loaded.map(d=>f(d.name))),o=new Set(n.failed.map(d=>f(d.name))),r=new Set(t.failed.map(d=>f(d.name))),{commandPathsByExtension:p,actionPathsByExtension:v}=M(t);return e.map(d=>{const _=f(d.name),c=N(p.get(_)),i=N(v.get(_)),l={...c?{command_paths:c}:{},...i?{action_paths:i}:{}},m=q({enabled:d.enabled,normalizedName:_,loadedNames:a,loadFailedNames:o,activationFailedNames:r});return{...d,...m,...l}})}function B(e){let n=0,t=0,a=0;for(const o of e)if(o.startsWith("extension_policy_")){if(n+=1,o.startsWith("extension_policy_violation_")){t+=1;continue}o.startsWith("extension_policy_blocked_")&&(a+=1)}return{warning_count:n,violation_count:t,blocked_count:a}}function u(e,n){return e.vocabulary==="package"?`pm package --${n}`:`pm extension --${n}`}const W=new Set(["extension_command_handler_collision","extension_command_override_collision","extension_command_override_handler_overlap","extension_parser_override_collision","extension_preflight_override_collision","extension_renderer_collision","extension_service_override_collision"]);function H(e){return W.has(T(e))}function S(e){return e==="project"||e==="global"}function R(e){const n=e.split(":"),t=n[0];if(!t||!W.has(t))return null;const a=n.at(-4),o=n.at(-3)?.trim(),r=n.at(-2),p=n.at(-1)?.trim();return!S(a)||!S(r)||!o||!p?null:{code:t,surface:n.slice(1,-4).join(":")||"global",winner:{layer:a,name:o},displaced:{layer:r,name:p}}}function X(e){const n=new Set;for(const t of e){const a=R(t);a&&(n.add(a.winner.name),n.add(a.displaced.name))}return[...n].sort((t,a)=>t.localeCompare(a))}function K(e,n){const t=e.filter(H);if(t.length===0)return null;const a=X(t);return`Extension registration collisions or handler/override overlaps detected.${a.length>0?` Conflicting extensions: ${a.join(", ")}.`:""} Single-winner surfaces can hide earlier package behavior. Deactivate one conflicting package with ${n.deactivate}, or scope registration surfaces in extensions.policy.extension_overrides, then rerun ${n.doctor}.`}function V(e,n,t,a){const o=n.map(i=>R(i)).filter(i=>i!==null).sort((i,l)=>`${i.code}:${i.surface}:${i.winner.name}:${i.displaced.name}`.localeCompare(`${l.code}:${l.surface}:${l.winner.name}:${l.displaced.name}`));if(o.length===0)return;const r=e==="global"?"--global":"--project",p=u(a,"deactivate"),v=`${u(a,"doctor")} ${r} --detail deep --trace`,d=new Map(t.map(i=>[f(i.name),i])),_=new Map;for(const i of o)for(const l of[i.winner.name,i.displaced.name]){const m=f(l);_.set(m,(_.get(m)??0)+1)}const c=[..._.entries()].map(([i,l])=>{const m=d.get(i),h=m?.name??i,x=m?.command_paths??[],w=m?.action_paths??[];return{action:"deactivate",extension:h,command:`${p} ${h} ${r}`,affected_collisions:l,feature_loss:{command_paths:[...x].sort((y,b)=>y.localeCompare(b)),action_paths:[...w].sort((y,b)=>y.localeCompare(b))}}}).sort((i,l)=>{const m=l.affected_collisions-i.affected_collisions;if(m!==0)return m;const h=i.feature_loss.command_paths.length+i.feature_loss.action_paths.length,x=l.feature_loss.command_paths.length+l.feature_loss.action_paths.length;return h!==x?h-x:i.extension.localeCompare(l.extension)});return{status:"conflicts_detected",collision_count:o.length,extension_count:_.size,next_best_command:v,collisions:o,remediation_candidates:c}}function se(e){const n=[];for(const t of e){const a=t.error.toLowerCase();(a.includes("cannot find package '@unbrained/pm-cli'")||a.includes('cannot find module "@unbrained/pm-cli"')||a.includes("cannot find module '@unbrained/pm-cli'"))&&n.push(`extension_load_failed_sdk_dependency_missing:${t.name}`),(a.includes("cannot use import statement outside a module")||a.includes("to load an es module")||a.includes("must use import to load es module"))&&n.push(`extension_load_failed_module_mode_mismatch:${t.name}`)}return[...new Set(n)].sort((t,a)=>t.localeCompare(a))}function re(e=[]){const n=Array.isArray(e)?e:[],t=[];for(const a of n){if(!a||typeof a.name!="string")continue;const o=a.trace?.missing_capability??a.trace?.capability;typeof o=="string"&&o.trim().length>0&&t.push(`extension_capability_missing:${a.name}:${o.trim().toLowerCase()}`)}return[...new Set(t)].sort((a,o)=>a.localeCompare(o))}function ce(e,n){const t=[];for(const a of I(e.loaded,n))for(const o of a.unused)t.push(`extension_capability_unused:${a.layer}:${a.name}:${o}`);return[...new Set(t)].sort((a,o)=>a.localeCompare(o))}const Y=[{matches:e=>e.some(n=>n.startsWith("extension_manifest_")),build:e=>`Run ${u(e.options,"explore")} ${e.scopeFlag} to inspect discovered manifests and directories.`},{matches:e=>e.some(n=>n.startsWith("extension_capability_unknown:")),build:()=>`Unknown extension capabilities detected. Allowed capabilities: ${L.join(", ")}. Review extension_capability_unknown warning details for suggested replacements.`},{matches:e=>e.some(n=>n.startsWith("extension_capability_legacy_alias:")),build:()=>"Legacy extension capability aliases were auto-remapped to canonical capabilities. Update manifests to canonical names (migration/validation -> schema)."},{matches:e=>e.some(n=>n.startsWith("extension_capability_missing:")),build:e=>`Extension activation failed because code registered a surface missing from manifest capabilities. Run ${u(e.options,"doctor")} ${e.scopeFlag} --detail deep --trace and add the reported missing_capability to manifest.json before publishing.`},{matches:e=>e.some(n=>n.startsWith("extension_capability_unused:")),build:e=>`Extension manifests declare capabilities that are never registered against. Remove each reported unused capability from manifest.json to keep least privilege, or add the matching registration. Run ${u(e.options,"doctor")} ${e.scopeFlag} --detail deep --trace for per-extension registration counts.`},{matches:e=>e.some(n=>n.startsWith("extension_command_definition_legacy_handler_alias:")),build:()=>"Extension command definitions using legacy handler were auto-remapped. Update command definitions to use run: (context) => ... for forward compatibility."},{matches:e=>e.some(n=>n.startsWith("extension_output_service_override_global:")||n.startsWith("extension_output_renderer_override_global:")),build:()=>"Global output service/renderer overrides are active. For output_format, return context.payload/null/undefined unless the extension owns the command. For renderers, return null for unrelated payloads so pm falls back to native rendering."},{matches:e=>e.some(n=>n.startsWith("extension_schema_narrow_activation:")),build:()=>"A package registers custom item types/fields (a GLOBAL schema contribution) but also declares narrow activation.commands, so it never activates for built-in commands like pm create <type> and the custom type silently fails to register. Remove activation.commands from manifest.json so pm activates the package for every command, or \u2014 if the schema is intentionally command-scoped \u2014 knowingly ignore this advisory."},{matches:e=>e.some(n=>n.startsWith("extension_load_failed_sdk_dependency_missing:")),build:e=>`Detected extension load failures caused by missing SDK dependency resolution. Ensure extension package dependencies include "@unbrained/pm-cli" and reinstall dependencies before running ${u(e.options,"doctor")} ${e.scopeFlag}.`},{matches:e=>e.some(n=>n.startsWith("extension_load_failed_module_mode_mismatch:")),build:e=>`Detected extension module-mode mismatches. For ESM-based extension entries/imports, set package.json "type": "module" or use an explicit .mjs entry and rerun ${u(e.options,"doctor")} ${e.scopeFlag}.`},{matches:e=>e.some(n=>n.startsWith("extension_pm_min_version_")||n.startsWith("extension_pm_max_version_")),build:e=>`Extension pm version-bound warnings detected. Align each package manifest's pm_min_version/pm_max_version with the installed pm CLI version (see the warning's required/allowed=...:current=... details), or upgrade/downgrade the pm CLI to satisfy the declared bounds, then rerun ${u(e.options,"doctor")} ${e.scopeFlag}.`},{matches:(e,n)=>n.updateCheckFailedTotal>0,build:e=>`Run ${u(e.options,"manage")} ${e.scopeFlag} after validating network and repository access.`},{matches:e=>e.some(n=>n.startsWith("extension_manager_state_")),build:e=>`Review and repair ${e.scope} managed extension state file if schema/read warnings persist.`},{matches:(e,n)=>n.policyWarningCount>0,build:()=>"Extension governance policy warnings detected. Review settings.extensions.policy mode and allow/block lists to confirm intended capabilities and registration surfaces."}];function J(e){const{normalizedWarnings:n,options:t,scope:a,scopeFlag:o,updateCheckFailedTotal:r,policyWarningCount:p,unmanagedActionRequiredTotal:v,notCheckedTotal:d,skippedNonGithubTotal:_,updateAvailableTotal:c}=e,i=n.map(G).filter(m=>m!==void 0),l={options:t,scope:a,scopeFlag:o,updateCheckFailedTotal:r,policyWarningCount:p};if(n.length>0){const m=K(n,{deactivate:`${u(t,"deactivate")} <name> ${o}`,doctor:`${u(t,"doctor")} ${o} --detail deep --trace`});m&&i.push(m);for(const h of Y)h.matches(n,l)&&i.push(h.build(l))}return v>0&&i.push(`Update-check coverage is partial because unmanaged extensions need adoption. Adopt existing installs via ${u(t,"manage")} ${o} --fix-managed-state (or ${u(t,"adopt-all")} ${o}, ${u(t,"adopt")} <name> ${o}, or reinstall via ${u(t,"install")} ${o} <source>).`),_>0&&i.push("Update-check coverage is partial: non-GitHub managed sources were not checked. Inspect their registry or source directly; zero detected updates does not mean these packages are current. Runtime activation health is independent."),d>0&&i.push(`Update-check coverage is partial: some sources have no completed check. Run ${u(t,"manage")} ${o} to request update checks.`),c>0&&i.push(`Update available managed extensions via ${u(t,"install")} ${o} <source>.`),i.length===0&&i.push(`No immediate action required. Re-run ${u(t,"manage")} ${o} after extension changes.`),i}function le(e,n,t,a={}){const o=[...new Set(n)].sort((s,g)=>s.localeCompare(g)),r=t.filter(s=>s.managed).length,p=t.filter(s=>s.enabled).length,v=t.filter(s=>s.active).length,d=t.filter(s=>s.update_check_status==="checked"&&s.update_available===!0).length,_=t.filter(s=>s.managed===!1),c=_.filter(s=>j(s)).map(s=>s.name).sort((s,g)=>s.localeCompare(g)),i=_.filter(s=>!j(s)).map(s=>s.name).sort((s,g)=>s.localeCompare(g)),l={checked:0,skipped_unmanaged:0,skipped_non_github:0,failed:0,not_checked:0};for(const s of t)l[s.update_check_status]+=1;const m=l.failed,h=t.filter(s=>s.update_check_status==="skipped_non_github"&&s.source?.kind!=="builtin").length,x=Object.entries({skipped_unmanaged:i.length,skipped_non_github:h,failed:m,not_checked:l.not_checked}).filter(([,s])=>s>0).map(([s,g])=>`extension_update_health_partial_coverage:${s}:${g}`),w=x.length>0,y=w?"partial":"full",b=[...new Set([...o,...x])].sort((s,g)=>s.localeCompare(g)),A=[...new Set(b.map(s=>T(s)))].sort((s,g)=>s.localeCompare(g)),C=B(b),F=e==="global"?"--global":"--project",E=V(e,o,t,a),P=J({normalizedWarnings:b,options:a,scope:e,scopeFlag:F,updateCheckFailedTotal:m,policyWarningCount:C.warning_count,unmanagedActionRequiredTotal:i.length,notCheckedTotal:l.not_checked,skippedNonGithubTotal:h,updateAvailableTotal:d});return{status:b.length===0?"ok":"warn",warning_count:b.length,warning_codes:A,warnings:b,policy_warning_count:C.warning_count,policy_violation_count:C.violation_count,policy_blocked_count:C.blocked_count,total_extensions:t.length,managed_total:r,enabled_total:p,active_total:v,update_available_total:d,update_health_coverage:y,update_health_partial:w,unmanaged_loaded_extension_count:_.length,unmanaged_loaded_extensions:_.map(s=>s.name).sort((s,g)=>s.localeCompare(g)),unmanaged_expected_extension_count:c.length,unmanaged_expected_extensions:c,unmanaged_action_required_extension_count:i.length,unmanaged_action_required_extensions:i,update_check_status_totals:l,update_check_failed_total:m,top_warnings:b.slice(0,8),remediation:P,...E?{collision_plan:E}:{}}}function de(e){if(!e||e.trim().length===0)return"summary";const n=e.trim().toLowerCase();if(n==="summary"||n==="deep")return n;throw new O(`Invalid --detail value "${e}". Expected summary or deep.`,U.USAGE)}function T(e){const n=e.trim(),t=n.indexOf(":");return t===-1?n:n.slice(0,t)}function me(e){const n=new Set,t=[];for(const a of e){const o=(()=>{const r=D(a);return r?[r]:z(a)})();for(const r of o){const p=`${r.layer}:${r.name}:${r.capability}`;n.has(p)||(n.add(p),t.push(r))}}return t}function ue(){return{version:k.version,capabilities:[...k.capabilities],legacy_aliases:{...k.legacy_aliases}}}function j(e){const n=f(e.name),t=f(e.directory);return n.startsWith("builtin-")?!0:t==="beads"||t==="todos"}function pe(e,n,t,a,o){if(e!=="project"||o)return{warnings:[],summary:{active_project_count:0,loaded_project_count:0,active_project_names:[],loaded_project_names:[],missing_active_project_names:[]}};const r=[...new Set(n.filter(c=>c.active).map(c=>f(c.name)))].sort((c,i)=>c.localeCompare(i)),p=[...new Set(t.filter(c=>c.layer==="project").map(c=>f(c.name)))].sort((c,i)=>c.localeCompare(i)),v=new Set(a.map(c=>f(c.name))),d=r.filter(c=>!p.includes(c)&&!v.has(c)).sort((c,i)=>c.localeCompare(i));return{warnings:d.length>0?[`extension_doctor_consistency_active_not_loaded:${d.join(",")}`]:[],summary:{active_project_count:r.length,loaded_project_count:p.length,active_project_names:r,loaded_project_names:p,missing_active_project_names:d}}}export{ie as applyDoctorRuntimeActivationState,ue as buildCapabilityContractMetadata,pe as buildDoctorConsistencySummary,le as buildExtensionTriageSummary,K as buildRegistrationCollisionRemediation,re as classifyDoctorActivationFailureWarnings,se as classifyDoctorLoadFailureWarnings,ce as classifyUnusedCapabilityWarnings,me as collectUnknownCapabilityGuidance,de as parseDoctorDetailMode,oe as summarizeExtensionFailures};
|
|
2
2
|
//# sourceMappingURL=doctor.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import p from"node:fs/promises";import l from"node:path";import{isPathWithinDirectory as y}from"../../core/fs/path-utils.js";import{PmCliError as f}from"../../core/shared/errors.js";import{EXIT_CODE as h}from"../../core/shared/constants.js";import{includesExtensionCopyPath as w}from"./copy-scope.js";import{resolveCanonicalExtensionInstallDestination as x}from"./install-runtime.js";import{pathExists as k}from"../../core/fs/fs-utils.js";import{areDirectoriesEquivalent as E}from"./install-sources.js";const b=new Set(["node_modules",".git","dist","build","coverage"]);async function L(o,a,e,r){const i=o.source.kind==="local"?await p.stat(o.source.absolute_path):void 0,s=o.source.kind==="local"?i.isDirectory()?"directory":"archive":o.source.kind,t=await v(o.directory,a,r),n={source_mode:s,...s==="archive"?{archive_bytes:i.size}:{},copy:t},c=o.source_root??o.directory;if(s==="directory"&&(!t.complete||t.development_entries>0||t.bytes>=16*1024*1024)&&await k(l.join(c,"package.json"))&&(n.packed_alternative={cwd:c,pack:{command:"npm",args:["pack","--ignore-scripts","--json"]},install:{command:"pm",args:["package","install","<archive-filename>",`--${e}`]},archive_argument:"pack_result[0].filename"}),s==="directory"&&!t.complete){const m=t.stop_reason==="entry_limit"?`${t.max_entries} entries`:`${t.max_depth} directory levels`;throw new f(`Local extension source scan stopped at ${m}; the directory snapshot is incomplete and installation was refused. ${n.packed_alternative?"Pack the package with npm pack --ignore-scripts --json, then install its archive.":"Install a smaller source directory or a packed archive."}`,h.USAGE,{code:"extension_install_incomplete_source_scan",reason:t.stop_reason,nextSteps:n.packed_alternative?[`Run npm pack --ignore-scripts --json from the package root, then pm package install <archive-filename> --${e}.`]:["Choose a smaller source directory or install a packed archive."]})}return n}async function v(o,a,e={}){const{maxEntries:r=1e4,maxDepth:i=64,signal:s}=e;if(![r,i].every(_=>Number.isSafeInteger(_)&&_>0))throw new f("maxEntries and maxDepth must be positive safe integers.",h.USAGE);s?.throwIfAborted();const t=await p.realpath(o),n=await x(a),c=await E(t,n);s?.throwIfAborted();const m=c?"in_place":y(t,n)?"nested_filtered_snapshot":"directory_snapshot",d={copy_scope:m,source_directory:t,destination_directory:n,files:0,bytes:0,directories:0,symlinks:0,other_entries:0,scanned_entries:0,excluded_entries:0,development_entries:0,complete:!0,stop_reason:"complete",max_entries:r,max_depth:i};return m==="in_place"||await u(t,0,d,s),d}async function u(o,a,e,r){r?.throwIfAborted();const i=await p.opendir(o);for await(const s of i){if(r?.throwIfAborted(),e.scanned_entries>=e.max_entries){e.complete=!1,e.stop_reason="entry_limit";return}e.scanned_entries+=1;const t=l.join(o,s.name);if(!w(e.source_directory,e.destination_directory,t,e.copy_scope==="nested_filtered_snapshot")){e.excluded_entries+=1;continue}if(l.relative(e.source_directory,t).split(l.sep).some(n=>b.has(n))&&(e.development_entries+=1),await g(t,a,e,r),!e.complete)return}}async function g(o,a,e,r){const i=await p.lstat(o);if(r?.throwIfAborted(),i.isDirectory()){if(e.directories+=1,a+1>=e.max_depth){e.complete=!1,e.stop_reason="depth_limit";return}await u(o,a+1,e,r)}else i.isFile()?(e.files+=1,e.bytes+=i.size):i.isSymbolicLink()?e.symlinks+=1:e.other_entries+=1}export{L as buildExtensionInstallPlan,v as planExtensionDirectoryCopy};
|
|
2
2
|
//# sourceMappingURL=install-plan.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
function o(n,i){const e=n.filter(a=>a.result.ok).length;return{installed_all:!i&&e===n.length,installed_count:i?0:e,...i?{dry_run:!0,planned_count:e}:{},failed_count:n.length-e,packages:n.map(({alias:a,result:s})=>{const t=s.details;return{alias:a,ok:s.ok,extension:t.extension,source:t.source,source_resolution:t.source_resolution,install_plan:t.install_plan,dry_run:t.dry_run,destination_path:t.destination_path,activated:t.activated,settings_changed:t.settings_changed,previous_state_preserved:t.previous_state_preserved,rollback:t.rollback,command_paths:t.command_paths,action_paths:t.action_paths,command_discovery:t.command_discovery,verification:t.verification,runtime_activation_status:t.runtime_activation_status,activation_diagnostics:t.activation_diagnostics,warnings:s.warnings}})}}export{o as buildBundledInstallReceipt};
|
|
2
2
|
//# sourceMappingURL=install-receipts.js.map
|