@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
package/dist/core/item/parse.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
`))return!0;const
|
|
3
|
-
`)}function
|
|
4
|
-
`);return
|
|
5
|
-
`)}function
|
|
6
|
-
`)&&!
|
|
7
|
-
`).map(
|
|
8
|
-
${
|
|
1
|
+
import{PmCliError as u}from"../shared/errors.js";import{EXIT_CODE as l}from"../shared/constants.js";import{isCliMutationInput as U,preserveLiteralMutationInput as G,transferLiteralMutationInput as M}from"./literal-mutation-input.js";const f="-",k=/^[A-Za-z0-9_.-]+$/u,w=new Set(["actual_result","body","cmd","command","customer_impact","description","environment","expected_result","impact","location","message","note","outcome","repro_steps","resolution","text","title","unblock_note","value","why_now"]);function Z(e,t){if(e.startsWith("```")||e.includes(`
|
|
2
|
+
`))return!0;const n=t.map(r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|");return new RegExp(`^(?:[-*+]\\s+)?(?:${n})\\s*[:=]`,"i").test(e)}function K(e){const t=e.trim();if(t==="")return[];const r=(x(t)??t.split(",")).map(i=>i.trim()).filter(Boolean).map(i=>i.toLowerCase());return Array.from(new Set(r)).sort((i,o)=>i.localeCompare(o))}function $(e){if(!Array.isArray(e)||e.length===0)return[];const t=[];for(const n of e)if(typeof n=="string")for(const r of K(n))t.push(r);return Array.from(new Set(t)).sort((n,r)=>n.localeCompare(r))}function E(e){return Array.isArray(e)?e.filter(t=>typeof t=="string").map(t=>t.trim().toLowerCase()).filter(Boolean):[]}function Y(e){return typeof e!="string"?[]:e.split(";").map(t=>t.trim()).filter(Boolean)}function H(e,t,n){const r=e.map(s=>s.trim()).filter(Boolean);for(const s of t??[]){const a=s.trim();if(a.includes(";"))throw new u('Acceptance criteria added with --add-ac cannot contain ";" because semicolons delimit stored criteria',l.USAGE,{code:"acceptance_criteria_semicolon_forbidden",required:"Pass one semicolon-free criterion per --add-ac value",why:"A semicolon inside one criterion would be re-read as multiple criteria",nextSteps:["Split the text into repeated --add-ac values, or replace the semicolon with punctuation that is not the storage delimiter"]});a.length>0&&!r.includes(a)&&r.push(a)}const i=[];let o=r;for(const s of n??[]){const a=s.trim();if(a.length!==0){if(!o.includes(a)){i.push(a);continue}o=o.filter(c=>c!==a)}}return{criteria:o,unmatchedRemovals:i}}function J(e,t){const n=E(e);if(!t||t.length===0)return Array.from(new Set(n)).sort((i,o)=>i.localeCompare(o));const r=new Set(n);for(const i of $(t))r.add(i);return Array.from(r).sort((i,o)=>i.localeCompare(o))}function Q(e,t){const n=Array.from(new Set(E(e))).sort((i,o)=>i.localeCompare(o));if(!t||t.length===0)return n;const r=new Set($(t));return r.size===0?n:n.filter(i=>!r.has(i))}function x(e){if(!e.startsWith("["))return null;let t;try{t=JSON.parse(e)}catch{return null}return t.map(r=>typeof r=="string"||typeof r=="number"||typeof r=="boolean"?String(r):"").filter(r=>r.length>0)}function g(e){return e.replace(/\r\n/g,`
|
|
3
|
+
`)}function S(e){const t=g(e).trim();if(!t.startsWith("```"))return e;const n=t.split(`
|
|
4
|
+
`);return n.length<2||n.at(-1)?.trim()!=="```"?e:n.slice(1,-1).join(`
|
|
5
|
+
`)}function _(e){const t=[];let n="",r=0,i=!1;for(let o=0;o<e.length;o+=1){const s=e[o];if(s==="\\"&&e[o+1]===","){n+=",",o+=1;continue}if(s==="\\"&&e[o+1]!==void 0){n+=`${s}${e[o+1]}`,o+=1;continue}if(s==='"'){i=!i,n+=s;continue}if(s===","&&!i){t.push({text:n,raw:e.slice(r,o)}),n="",r=o+1;continue}n+=s}return n.trim()&&t.push({text:n,raw:e.slice(r)}),t}function R(e){return _(e).map(t=>t.text)}function X(e){return _(e.trim()).map(({text:t,raw:n})=>{const r=C(t),i=t.slice(0,Math.max(r,0)).trim();return k.test(i)?{text:t,raw:n,key:i,value:A(t.slice(r+1).trim())}:{text:t,raw:n}})}function A(e){const t=e.trim();if(t.startsWith('"')&&t.endsWith('"')){try{const n=JSON.parse(t);if(typeof n=="string")return n}catch{}return t.slice(1,-1).replace(/\\"/g,'"')}return e}function C(e){const t=e.indexOf("="),n=e.indexOf(":"),r=t>=0,i=n>=0;return r&&i?Math.min(t,n):r?t:i?n:-1}function z(e,t){if((t==="--add"||t==="--add-glob")&&(/[./\\]/.test(e)||/\.[a-z]{1,6}$/i.test(e.trim())))return"For file/doc paths use: path=<file-path>[,scope=project|global]. The scope field is optional and defaults to project (example: path=src/api.ts or path=README.md,scope=project). ";if(t!=="--event")return"";const n=e.toLowerCase(),r=n.includes("recur_")||n.includes("recurrence")?' Recurrence list values must stay in one field and use "|" delimiters (for example recur_by_weekday=mon|wed or recur_by_month_day=1|15).':"",i=n.includes("recur_byweekday")?" Use recur_by_weekday (with underscores) for weekday recurrence filters.":"";return`${r}${i}`}function b(e,t){const n=e.replaceAll(/\s+/g," ").trim(),r=n.length>160?`${n.slice(0,157)}...`:n,i=z(e,t);return`Invalid ${t} value "${r}". Expected key=value entries separated by commas. `+i+`Also accepts markdown-style key/value lines (for example "- path: README.md"). Use ${t} ${f} to read piped stdin input.`}function T(e,t,n,r){const i=Object.keys(e).find(o=>o.toLowerCase()===t.toLowerCase());if(i!==void 0)throw new u(`${r} sets key "${t}" more than once in one entry, so the later value would silently replace the earlier one.`,l.USAGE,{code:"structured_entry_key_repeated",flag:r,value:n,required:`Give each key once per ${r} entry. Repeat ${r} for another entry; if the repeated key belongs to prose, quote that value or pass it through its standalone flag.`,why:"A structured entry keeps one value per key, so accepting a repeat would store data the author did not intend without any refusal.",details:{repeated_key:t,first_key:i}})}function L(e,t){const n=S(e).trim();if(n.length===0||!n.includes(`
|
|
6
|
+
`)&&!n.startsWith("-")&&!n.startsWith("*")&&!n.startsWith("+"))return null;const r={};let i;const o=g(n).split(`
|
|
7
|
+
`).map(s=>s.trim()).filter(s=>s.length>0);for(const s of o){const a=s.match(/^(?:[-*+]\s+)?([a-zA-Z0-9_.-]+)\s*(=|:)\s*(.*)$/);if(a){const c=a[1].trim();T(r,c,e,t),r[c]=A(a[3].trim()),i=c;continue}if(i&&w.has(i.toLowerCase())){r[i]=`${r[i]}
|
|
8
|
+
${s}`;continue}return null}return r}function ee(e,t){const n=S(e).trim();if(!n)throw new u(`${t} cannot be empty`,l.USAGE);const r=L(n,t);if(r)return r;const i={};let o;const s=R(n);for(const a of s){const c=C(a),h=a.slice(0,Math.max(c,0)).trim();if(h!==""&&o!==void 0&&w.has(o.toLowerCase())&&!k.test(h)){i[o]=`${i[o]},${a}`;continue}if(c>=0){const p=a.slice(0,c).trim();if(!p)throw new u(b(e,t),l.USAGE);const y=A(a.slice(c+1).trim());T(i,p,e,t),i[p]=y,o=p;continue}if(o&&w.has(o.toLowerCase())){i[o]=`${i[o]},${a}`;continue}throw new u(b(e,t),l.USAGE)}return i}const P=/^[A-Za-z]:[\\/]/,V=/^(?:[-*+]\s+)?[A-Za-z_][A-Za-z0-9_.-]*\s*=/;function te(e){const t=e.trim();return P.test(t)?!1:V.test(t)}function ne(e,t,n,r){if(!(r||!e.includes(",")))throw new u(`${t} received an ambiguous comma-bearing bare ${n}. Repeat ${t} for multiple values, or quote or escape literal commas in a structured key=<value> entry.`,l.USAGE,{code:"bare_comma_entry_ambiguous",required:`Use one ${t} per bare ${n}, or quote or escape literal commas in a structured key=<value> entry.`})}function re(e,t,n){const r=new Set(n.map(o=>o.toLowerCase())),i=Object.keys(e).filter(o=>!r.has(o.toLowerCase()));if(i.length>0)throw new u(`${t} does not recognize key${i.length>1?"s":""} ${i.map(o=>`"${o}"`).join(", ")}. Allowed keys: ${n.join(", ")}.`,l.USAGE);for(const o of Object.keys(e)){const s=o.toLowerCase();if(s!==o){if(Object.hasOwn(e,s))throw new u(`${t} provides key "${o}" more than once after case normalization.`,l.USAGE);e[s]=e[o],delete e[o]}}}async function N(e){if(process.stdin.isTTY===!0)throw new u(`${e} value "${f}" requires piped stdin input. Pipe content into the command, or end manual stdin with Ctrl+D (Unix/macOS) or Ctrl+Z then Enter (Windows).`,l.USAGE);return process.stdin.setEncoding("utf8"),await new Promise((t,n)=>{let r="";process.stdin.on("data",i=>{r+=i}),process.stdin.on("end",()=>{t(g(r))}),process.stdin.on("error",i=>{n(i)})})}const m=Symbol("all-mutation-stdin-fields"),d=new WeakMap;function oe(e){return U(e)?e:G(I({...e}))}function I(e){return d.set(e,m),e}function ie(e,t){const n=d.get(e);return n===m||d.set(e,new Set([...n??[],...t])),e}function W(e,t){M(e,t);const n=d.get(e);return n===void 0||d.set(t,n===m?n:new Set(n)),t}function se(e,t){const n=d.get(e),r=d.get(t);return n===void 0||r===m?t:n===m?(d.set(t,n),t):(d.set(t,new Set([...r??[],...n])),t)}function ae(e){return d.get(e)!==m}function v(e,t){const n=d.get(e);return n!==m&&!n?.has(t)}function j(e){let t;for(const n of e){if(n.resolveToken===!1||n.value===void 0)continue;const i=(Array.isArray(n.value)?n.value:[n.value]).filter(o=>o.trim()===f).length;if(i>1)throw new u(`${n.optionName} accepts "${f}" stdin token at most once per command invocation`,l.USAGE);if(i!==0){if(t!==void 0&&t!==n.optionName)throw new u(`Only one option may use "${f}" stdin token per command invocation. Already used by ${t}.`,l.USAGE);t=n.optionName}}}async function ce(e,t,n){const r=e,i=[...t,...n];j(i.map(([a,c])=>({value:r[a],optionName:c,resolveToken:v(e,a)})));const o=q(),s={...r};for(const[a,c]of t)s[a]=await o.resolveValue(r[a],c,v(e,a));for(const[a,c]of n)s[a]=await o.resolveList(r[a],c,v(e,a));return I(W(e,s))}function q(){let e,t;const n=async o=>{if(t&&t!==o)throw new u(`Only one option may use "${f}" stdin token per command invocation. Already used by ${t}.`,l.USAGE);return t=o,e||(e=N(o)),await e};return{resolveValue:async(o,s,a=!0)=>{if(!a)return o;if(o!==void 0)return o.trim()!==f?o:await n(s)},resolveList:async(o,s,a=!0)=>{if(!a)return o;if(!o)return;const c=o.map((y,O)=>y.trim()===f?O:-1).filter(y=>y>=0);if(c.length===0)return o;if(c.length>1)throw new u(`${s} accepts "${f}" stdin token at most once per command invocation`,l.USAGE);const h=await n(s),p=[...o];return p[c[0]]=h,p}}}function ue(e,t){const n=Number(e);if(!Number.isFinite(n))throw new u(`Invalid ${t} value "${e}"`,l.USAGE);return n}function le(e,t){const n=e.trim(),r=Number(n);if(n===""||!Number.isInteger(r)||r<0)throw new u(`Invalid ${t} value "${e}". Expected a non-negative integer.`,l.USAGE);return r}const de={coerceJsonTagArray:x,stripCodeFenceEnvelope:S,parseMarkdownKeyValueLines:L};export{de as _testOnly,H as applyAcceptanceCriteriaMutations,Q as applyTagRemovals,ne as assertNoAmbiguousBareCommaEntry,re as assertNoUnknownCsvKeys,j as assertSingleStdinTokenConsumer,$ as collectTagFlagValues,q as createStdinTokenResolver,te as looksLikeGenericKeyValueEntry,Z as looksLikeStructuredKeyValueEntry,J as mergeAdditiveTags,se as overlayMutationStdinTokenPolicy,ee as parseCsvKv,le as parseOptionalNonNegativeInteger,ue as parseOptionalNumber,K as parseTags,ie as preserveMutationStdinTokenFields,I as preserveMutationStdinTokenLiterals,oe as preserveSdkMutationInput,ce as resolveMutationStdinTokenFields,v as shouldResolveMutationStdinTokenField,ae as shouldResolveMutationStdinTokens,Y as splitAcceptanceCriteria,X as splitStructuredEntrySegments,W as transferMutationStdinTokenPolicy};
|
|
9
9
|
//# sourceMappingURL=parse.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
const s=new Set(["completed","superseded"]);function o(e){return e!==void 0&&s.has(e)}function r(e){if(e.type.trim().toLowerCase()!=="plan")return!1;const t=e.plan_steps??[];return t.length>0&&t.every(n=>n.status==="completed")}export{s as TERMINAL_PLAN_MODES,o as isTerminalPlanMode,r as shouldCompletePlanOnClose};
|
|
2
2
|
//# sourceMappingURL=plan-lifecycle.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{PmCliError as m}from"../shared/errors.js";import{EXIT_CODE as l}from"../shared/constants.js";const r={critical:0,high:1,medium:2,low:3,minimal:4},n=Object.keys(r),s=`numbers 0..4 (0=critical, 1=high, 2=medium, 3=low, 4=minimal) or names (${n.join(", ")}), case-insensitive`;function t(e){return new m(`Invalid priority "${e}". Accepted values: ${s}.`,l.USAGE,{code:"invalid_argument_value",field:"priority",value:e,allowed:["0","1","2","3","4",...n]})}function p(e){if(typeof e=="number"){if(Number.isInteger(e)&&e>=0&&e<=4)return e;throw t(String(e))}if(typeof e!="string")throw t(String(e));const i=e.trim();if(i.length===0)throw t(e);const o=i.toLowerCase();if(Object.prototype.hasOwnProperty.call(r,o))return r[o];if(/^[0-4]$/.test(i))return Number(i);throw t(e)}export{s as PRIORITY_ACCEPTED_FORMS_HINT,r as PRIORITY_NAME_TO_VALUE,p as resolvePriority};
|
|
2
2
|
//# sourceMappingURL=priority.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{EXIT_CODE as n}from"../shared/constants.js";import{PmCliError as o}from"../shared/errors.js";import{emptyMutationOptionMessage as c}from"./literal-mutation-input.js";const l=/^[A-Za-z0-9][A-Za-z0-9._/-]*$/,m=64;function A(r){const e=r?.trim().toLowerCase().replaceAll("-","_");if(e==="warn"||e==="strict_error")return e;if(e==="strict")return"strict_error";throw new o("Config set sprint-release-format-policy requires --policy with one of: warn, strict_error (alias: strict)",n.USAGE)}function u(r,e,a,i="cli"){const t=e.trim();if(t.length===0)throw new o(c(i,r,`. Use --${r} none to unset.`),n.USAGE);if(t.length<=m&&l.test(t))return{value:t,warnings:[]};const s="Expected 1-64 characters matching [A-Za-z0-9][A-Za-z0-9._/-]* (no spaces).";if(a==="strict_error")throw new o(`Invalid ${i==="sdk"?r:`--${r}`} value "${t}". ${s}`,n.USAGE);return{value:t,warnings:[`validation_warning:${r}_format:${t}`]}}export{A as normalizeSprintReleaseFormatPolicy,u as validateSprintOrReleaseValue};
|
|
2
2
|
//# sourceMappingURL=sprint-release-format.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{EXIT_CODE as f}from"../shared/constants.js";import{PmCliError as d}from"../shared/errors.js";import{levenshteinDistanceWithinLimit as S}from"../shared/levenshtein.js";import{normalizeStatusInput as g}from"./status.js";const m={open:"open_status",closed:"close_status",canceled:"canceled_status",cancelled:"canceled_status"},p="all";function w(n){if(typeof n!="string")return!1;const t=n.split(",").map(e=>e.trim().toLowerCase()).filter(e=>e.length>0);return t.length===1&&t[0]===p}function h(n,t){const e=n.trim().toLowerCase();if(e.length===0)return;const s=m[e];return s?t[s]:g(n,t)}function C(n){const t=new Set(Object.keys(m));for(const e of n.definitions){t.add(e.id);for(const s of e.aliases)t.add(s)}return[...t]}function I(n,t){const e=n.trim().toLowerCase();let s,r=Number.POSITIVE_INFINITY;for(const i of C(t)){const l=S(e,i.toLowerCase(),2);l!==null&&l<r&&(s=i,r=l)}return s}function E(n,t,e){if(typeof n!="string")return;const s=e?.strict===!0,r=e?.flagLabel??"--status",i=n.split(",").map(o=>o.trim()).filter(o=>o.length>0);if(i.length===0)return;if(i.filter(o=>o.trim().toLowerCase()===p).length>0){if(i.length===1)return;throw new d(`Invalid ${r} value "all". Use it by itself, or omit ${r} to search every status.`,f.USAGE)}const a=[];for(const o of i){const u=h(o,t);if(u===void 0){if(s){const c=I(o,t);throw new d(`Invalid ${r} value "${o}". Use open|closed|canceled or a configured status id${c?`. Did you mean "${c}"?`:"."}`,f.USAGE)}a.push(o);continue}a.push(u)}return[...new Set(a)]}export{w as isStatusAllFilterInput,E as parseStatusFilterCsv,h as resolveStatusFilterToken};
|
|
2
2
|
//# sourceMappingURL=status-filter.js.map
|
package/dist/core/item/status.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{STATUS_VALUES as o}from"../../types/index.js";import{normalizeStatusInputWithRegistry as s}from"../schema/runtime-schema.js";const u={"in-progress":"in_progress",cancelled:"canceled"};function a(n,r){if(r){const i=s(n,r);if(i)return i}if(typeof n!="string")return;const t=n.trim().toLowerCase();if(!t)return;const e=u[t]??t;if(o.includes(e))return e}function c(n,r){return a(n,r)??n}function d(n,r){return r.terminal_statuses.has(c(n,r))}export{d as isTerminalStatus,c as normalizeStatusForRegistry,a as normalizeStatusInput};
|
|
2
2
|
//# sourceMappingURL=status.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{decode as e}from"@toon-format/toon";const t="https://github.com/toon-format/toon/pull/314",n={dependency:"@toon-format/toon",affected_versions:"<=2.3.0",resolved_version:"2.3.1",upstream_pr:t,workaround_status:"removed"};function s(o){return{value:e(o),usedScalarBracketEscape:!1}}export{n as TOON_SCALAR_BRACKET_ESCAPE_TRACKING,t as TOON_SCALAR_BRACKET_ESCAPE_UPSTREAM_PR,s as decodeToonItemContent};
|
|
2
2
|
//# sourceMappingURL=toon-decode.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]="f40ddc8e-1dd5-5f26-b2ba-fbbac30a1781")}catch{}})();import path from"node:path";import{TYPE_TO_FOLDER}from"../shared/constants.js";import{ITEM_TYPE_VALUES}from"../../types/index.js";import{normalizeItemTypeDefinition as normalizeSharedItemTypeDefinition,normalizeItemTypeStringList,strictPolicyCommand,parseItemExecutionRole}from"./item-type-definition.js";const BUILTIN_ITEM_EXECUTION_ROLES=Object.freeze({decision:"human",milestone:"gate"}),DEFAULT_REQUIRED_CREATE_FIELDS=["title","description","status","priority","tags","body","deadline","estimatedMinutes","acceptanceCriteria","author","message","assignee"],DEFAULT_REQUIRED_CREATE_REPEATABLES=["dep","comment","note","learning","file","test","doc"],COMMON_MUTATION_COMMAND_OPTION_KEYS=["deadline","estimatedMinutes","acceptanceCriteria","definitionOfReady","order","goal","objective","value","impact","outcome","whyNow","assignee","parent","reviewer","risk","confidence","sprint","release","blockedBy","blockedReason","unblockNote","reporter","severity","environment","reproSteps","resolution","expectedResult","actualResult","affectedVersion","fixedVersion","component","regression","customerImpact"],CREATE_COMMAND_OPTION_KEYS=["title","description","type","status","priority","tags","body",...COMMON_MUTATION_COMMAND_OPTION_KEYS,"author","message","dep","comment","note","learning","file","test","doc","reminder","event","typeOption","field"],UPDATE_COMMAND_OPTION_KEYS=["title","description","body","status","closeReason","priority","type","tags",...COMMON_MUTATION_COMMAND_OPTION_KEYS,"author","message","comment","note","learning","file","test","doc","reminder","event","typeOption","field","ownershipMetadataBypass","ownershipDependencyBypass","force"],SHARED_COMMAND_OPTION_ALIASES={"close-reason":"closeReason",close_reason:"closeReason","estimated-minutes":"estimatedMinutes",estimated_minutes:"estimatedMinutes",estimate:"estimatedMinutes","acceptance-criteria":"acceptanceCriteria",acceptance_criteria:"acceptanceCriteria",ac:"acceptanceCriteria","definition-of-ready":"definitionOfReady",definition_of_ready:"definitionOfReady",rank:"order","why-now":"whyNow",why_now:"whyNow","blocked-by":"blockedBy",blocked_by:"blockedBy","blocked-reason":"blockedReason",blocked_reason:"blockedReason","unblock-note":"unblockNote",unblock_note:"unblockNote","repro-steps":"reproSteps",repro_steps:"reproSteps","expected-result":"expectedResult",expected_result:"expectedResult","actual-result":"actualResult",actual_result:"actualResult","affected-version":"affectedVersion",affected_version:"affectedVersion","fixed-version":"fixedVersion",fixed_version:"fixedVersion","customer-impact":"customerImpact",customer_impact:"customerImpact","type-option":"typeOption",type_option:"typeOption",type_options:"typeOption"},CREATE_COMMAND_OPTION_ALIASES={...SHARED_COMMAND_OPTION_ALIASES},UPDATE_COMMAND_OPTION_ALIASES={...SHARED_COMMAND_OPTION_ALIASES},COMMON_MUTATION_COMMAND_OPTION_FLAG_LABEL_ENTRIES=[["deadline","--deadline"],["estimatedMinutes","--estimate/--estimated-minutes"],["acceptanceCriteria","--acceptance-criteria/--ac"],["definitionOfReady","--definition-of-ready"],["order","--order/--rank"],["goal","--goal"],["objective","--objective"],["value","--value"],["impact","--impact"],["outcome","--outcome"],["whyNow","--why-now"],["assignee","--assignee"],["parent","--parent"],["reviewer","--reviewer"],["risk","--risk"],["confidence","--confidence"],["sprint","--sprint"],["release","--release"],["blockedBy","--blocked-by"],["blockedReason","--blocked-reason"],["unblockNote","--unblock-note"],["reporter","--reporter"],["severity","--severity"],["environment","--environment"],["reproSteps","--repro-steps"],["resolution","--resolution"],["expectedResult","--expected-result"],["actualResult","--actual-result"],["affectedVersion","--affected-version"],["fixedVersion","--fixed-version"],["component","--component"],["regression","--regression"],["customerImpact","--customer-impact"]],LINKED_RESOURCE_COMMAND_OPTION_FLAG_LABEL_ENTRIES=[["comment","--comment"],["note","--note"],["learning","--learning"],["file","--file"],["test","--test"],["doc","--doc"],["reminder","--reminder"],["event","--event"],["typeOption","--type-option"]];function commandOptionLabelMap(entries){return Object.fromEntries(entries)}const CREATE_COMMAND_OPTION_FLAG_LABELS=commandOptionLabelMap([["title","--title"],["description","--description"],["type","--type"],["status","--status"],["priority","--priority"],["tags","--tags"],["body","--body"],...COMMON_MUTATION_COMMAND_OPTION_FLAG_LABEL_ENTRIES,["author","--author"],["message","--message"],["dep","--dep"],...LINKED_RESOURCE_COMMAND_OPTION_FLAG_LABEL_ENTRIES]),UPDATE_COMMAND_OPTION_FLAG_LABELS=commandOptionLabelMap([["title","--title"],["description","--description"],["body","--body"],["status","--status"],["closeReason","--close-reason"],["priority","--priority"],["type","--type"],["tags","--tags"],...COMMON_MUTATION_COMMAND_OPTION_FLAG_LABEL_ENTRIES,...LINKED_RESOURCE_COMMAND_OPTION_FLAG_LABEL_ENTRIES,["author","--author"],["message","--message"],["force","--force"]]);function normalizeCommandOptionToken(value){return value.trim().replace(/^--+/,"").toLowerCase()}function commandOptionKeys(command){return command==="create"?CREATE_COMMAND_OPTION_KEYS:UPDATE_COMMAND_OPTION_KEYS}function commandOptionAliases(command){return command==="create"?CREATE_COMMAND_OPTION_ALIASES:UPDATE_COMMAND_OPTION_ALIASES}function canonicalizeCommandOptionKey(command,rawOption){const normalizedToken=normalizeCommandOptionToken(rawOption);return normalizedToken.length===0?void 0:commandOptionAliases(command)[normalizedToken]||commandOptionKeys(command).find(candidate=>candidate.toLowerCase()===normalizedToken)}function commandOptionFlagLabel(command,optionKey){return(command==="create"?CREATE_COMMAND_OPTION_FLAG_LABELS:UPDATE_COMMAND_OPTION_FLAG_LABELS)[optionKey]??`--${optionKey.replace(/([A-Z])/g,"-$1").toLowerCase()}`}function toDefaultFolder(name){const normalized=toSlugToken(name);return normalized.length===0?"items":normalized.endsWith("s")?normalized:`${normalized}s`}function normalizeItemTypeFolder(folder){const trimmed=folder.trim(),trackerRelative=trimmed.replaceAll("\\","/").replace(/^\/+/,""),normalized=path.posix.normalize(trackerRelative);if(trimmed.includes("\0")||/^[A-Za-z]:/.test(normalized)||normalized==="."||normalized===".."||normalized.startsWith("../"))throw new Error(`Item type folder "${folder}" must stay inside the pm tracker root.`);return normalized}function toSlugToken(value){const trimmed=value.trim().toLowerCase();let slug="",pendingDash=!1;for(const character of trimmed){const code=character.charCodeAt(0),isAlpha=code>=97&&code<=122,isDigit=code>=48&&code<=57;if(isAlpha||isDigit){pendingDash&&slug.length>0&&(slug+="-"),slug+=character,pendingDash=!1;continue}slug.length>0&&(pendingDash=!0)}return slug}function normalizeTypeDefinition(definition){return normalizeSharedItemTypeDefinition(definition,{resolvePolicyCommand:strictPolicyCommand})}function readStringArray(record,key){const value=record[key];return Array.isArray(value)?value.filter(entry=>typeof entry=="string"):void 0}function coerceOptionDefinitionFromUnknown(raw){if(typeof raw!="object"||raw===null||Array.isArray(raw))return null;const optionRecord=raw;return typeof optionRecord.key!="string"?null:{key:optionRecord.key,values:readStringArray(optionRecord,"values")??[],required:optionRecord.required===void 0?void 0:!!optionRecord.required,aliases:readStringArray(optionRecord,"aliases"),description:typeof optionRecord.description=="string"?optionRecord.description:void 0}}function coerceCommandOptionPolicyFromUnknown(raw){if(typeof raw!="object"||raw===null||Array.isArray(raw))return null;const policyRecord=raw;if(typeof policyRecord.command!="string"||typeof policyRecord.option!="string")return null;const normalizedCommand=policyRecord.command.trim().toLowerCase();return normalizedCommand!=="create"&&normalizedCommand!=="update"?null:{command:normalizedCommand,option:policyRecord.option,required:policyRecord.required===void 0?void 0:!!policyRecord.required,visible:policyRecord.visible===void 0?void 0:!!policyRecord.visible,enabled:policyRecord.enabled===void 0?void 0:!!policyRecord.enabled}}function coerceOptionDefinitionsFromRecord(record){if(Array.isArray(record.options))return record.options.map(entry=>coerceOptionDefinitionFromUnknown(entry)).filter(entry=>entry!==null)}function coerceCommandOptionPoliciesFromRecord(record){if(Array.isArray(record.command_option_policies))return record.command_option_policies.map(entry=>coerceCommandOptionPolicyFromUnknown(entry)).filter(entry=>entry!==null)}function coerceTypeDefinitionFromUnknown(raw){if(typeof raw!="object"||raw===null||Array.isArray(raw))return null;const record=raw,name=typeof record.name=="string"?record.name:"";if(name.trim().length===0)return null;const folder=typeof record.folder=="string"?record.folder:void 0,description=typeof record.description=="string"?record.description:void 0,defaultStatus=typeof record.default_status=="string"?record.default_status:void 0;return{name,description,default_status:defaultStatus,execution_role:parseItemExecutionRole(record.execution_role),folder,aliases:readStringArray(record,"aliases"),required_create_fields:readStringArray(record,"required_create_fields"),required_create_repeatables:readStringArray(record,"required_create_repeatables"),options:coerceOptionDefinitionsFromRecord(record),command_option_policies:coerceCommandOptionPoliciesFromRecord(record)}}function resolveDefinitionRequiredCreateFields(normalizedDefinition,existing){return normalizedDefinition.required_create_fields?normalizeItemTypeStringList(normalizedDefinition.required_create_fields):existing?.required_create_fields??[]}function resolveDefinitionRequiredCreateRepeatables(normalizedDefinition,existing){return normalizedDefinition.required_create_repeatables?normalizeItemTypeStringList(normalizedDefinition.required_create_repeatables):existing?.required_create_repeatables??[]}function resolveDefinitionOptions(normalizedDefinition,existing){return normalizedDefinition.options?normalizedDefinition.options:existing?.options?[...existing.options]:[]}function resolveDefinitionCommandOptionPolicies(normalizedDefinition,existing){return normalizedDefinition.command_option_policies?normalizedDefinition.command_option_policies:existing?.command_option_policies?[...existing.command_option_policies]:[]}function buildResolvedTypeDefinition(normalizedDefinition,existing){const keepName=existing?.name??normalizedDefinition.name,description=normalizedDefinition.description??existing?.description,defaultStatus=normalizedDefinition.default_status??existing?.default_status,folder=normalizeItemTypeFolder(normalizedDefinition.folder??existing?.folder??toDefaultFolder(keepName)),resolvedDefinition={name:keepName,execution_role:normalizedDefinition.execution_role,folder,aliases:normalizeItemTypeStringList([...existing?.aliases??[],...normalizedDefinition.aliases??[]]),required_create_fields:resolveDefinitionRequiredCreateFields(normalizedDefinition,existing),required_create_repeatables:resolveDefinitionRequiredCreateRepeatables(normalizedDefinition,existing),options:resolveDefinitionOptions(normalizedDefinition,existing),command_option_policies:resolveDefinitionCommandOptionPolicies(normalizedDefinition,existing)};return description&&(resolvedDefinition.description=description),defaultStatus&&(resolvedDefinition.default_status=defaultStatus),resolvedDefinition}function applyTypeDefinitions(source,target){for(const rawDefinition of source){const normalizedDefinition=normalizeTypeDefinition(rawDefinition);if(!normalizedDefinition)continue;const lowerName=normalizedDefinition.name.toLowerCase(),existing=target.get(lowerName);target.set(lowerName,buildResolvedTypeDefinition({...normalizedDefinition,execution_role:normalizedDefinition.execution_role??existing?.execution_role},existing))}}function collectExtensionTypeDefinitions(registrations){if(!registrations)return[];const definitions=[];for(const registration of registrations.item_types??[]){const typeDefinitionsRaw=registration.types;if(Array.isArray(typeDefinitionsRaw))for(const rawDefinition of typeDefinitionsRaw){const normalized=coerceTypeDefinitionFromUnknown(rawDefinition);normalized&&definitions.push(normalized)}}return definitions}function resolveItemTypeRegistry(settings,extensionRegistrations=null){const byLowerName=new Map;for(const builtin of ITEM_TYPE_VALUES)byLowerName.set(builtin.toLowerCase(),{name:builtin,execution_role:BUILTIN_ITEM_EXECUTION_ROLES[builtin.toLowerCase()]??"agent",folder:TYPE_TO_FOLDER[builtin],aliases:[],required_create_fields:[...DEFAULT_REQUIRED_CREATE_FIELDS],required_create_repeatables:[...DEFAULT_REQUIRED_CREATE_REPEATABLES],options:[],command_option_policies:[]});applyTypeDefinitions(settings.item_types?.definitions??[],byLowerName),applyTypeDefinitions(collectExtensionTypeDefinitions(extensionRegistrations),byLowerName);const definitions=[...byLowerName.values()].sort((left,right)=>left.name.localeCompare(right.name)),byType={},aliasToType={},typeToFolder={};for(const definition of definitions){byType[definition.name]=definition,typeToFolder[definition.name]=definition.folder,aliasToType[definition.name.toLowerCase()]=definition.name;for(const alias of definition.aliases)aliasToType[alias.toLowerCase()]=definition.name}const folders=[...new Set(definitions.map(definition=>definition.folder))].sort((left,right)=>left.localeCompare(right));return{types:definitions.map(definition=>definition.name),folders,type_to_folder:typeToFolder,by_type:byType,alias_to_type:aliasToType}}function resolveTypeName(rawType,registry){if(rawType!==void 0)return registry.alias_to_type[rawType.trim().toLowerCase()]}function resolveTypeDefinition(typeName,registry){const resolvedName=resolveTypeName(typeName,registry);if(resolvedName)return registry.by_type[resolvedName]}function applyBaseRequiredCommandOptions(state,typeDefinition,command,baseRequiredOptions){for(const rawBase of baseRequiredOptions){const canonical=canonicalizeCommandOptionKey(command,rawBase);if(canonical){state.required.add(canonical);continue}state.errors.push(`Unsupported base required option "${rawBase}" for command "${command}" on type "${typeDefinition.name}"`)}}function applyBooleanPolicySet(target,option,enabled){if(enabled){target.add(option);return}target.delete(option)}function applyCommandOptionPolicy(state,typeDefinition,command,policy){const canonical=canonicalizeCommandOptionKey(command,policy.option);if(!canonical){state.errors.push(`Unsupported command_option_policies option "${policy.option}" for command "${command}" on type "${typeDefinition.name}"`);return}policy.required!==void 0&&applyBooleanPolicySet(state.required,canonical,policy.required),policy.visible!==void 0&&applyBooleanPolicySet(state.hidden,canonical,!policy.visible),policy.enabled!==void 0&&applyBooleanPolicySet(state.disabled,canonical,!policy.enabled)}function applyCommandOptionPolicies(state,typeDefinition,command){for(const policy of typeDefinition.command_option_policies)policy.command===command&&applyCommandOptionPolicy(state,typeDefinition,command,policy)}function appendRequiredDisabledPolicyErrors(state,typeDefinition,command){for(const option of state.required)state.disabled.has(option)&&state.errors.push(`Option "${option}" cannot be both required and disabled for command "${command}" on type "${typeDefinition.name}"`)}function resolveCommandOptionPolicyState(typeDefinition,command,baseRequiredOptions){const errors=[],required=new Set,hidden=new Set,disabled=new Set,state={required,hidden,disabled,errors};return applyBaseRequiredCommandOptions(state,typeDefinition,command,baseRequiredOptions),applyCommandOptionPolicies(state,typeDefinition,command),appendRequiredDisabledPolicyErrors(state,typeDefinition,command),{required:[...required],hidden:[...hidden].sort((left,right)=>left.localeCompare(right)),disabled:[...disabled].sort((left,right)=>left.localeCompare(right)),errors}}function buildTypeOptionAliasMap(typeDefinition){const optionByAlias=new Map;for(const option of typeDefinition.options){optionByAlias.set(option.key.toLowerCase(),option);for(const alias of option.aliases??[])optionByAlias.set(alias.toLowerCase(),option)}return optionByAlias}function resolveTypeOptionValue(optionDefinition,trimmedValue,errors){const allowedValues=optionDefinition.values;if(allowedValues.length===0)return trimmedValue;const canonical=new Map(allowedValues.map(value=>[value.toLowerCase(),value])).get(trimmedValue.toLowerCase());if(!canonical){errors.push(`Invalid value "${trimmedValue}" for type option "${optionDefinition.key}". Allowed: ${allowedValues.join(", ")}`);return}return canonical}function validateTypeOptions(typeName,rawTypeOptions,registry){const typeDefinition=resolveTypeDefinition(typeName,registry);if(!typeDefinition)return{normalized:void 0,errors:[`Unknown type "${typeName}"`]};const errors=[],optionByAlias=buildTypeOptionAliasMap(typeDefinition),normalized={};for(const[rawKey,rawValue]of Object.entries(rawTypeOptions??{})){const trimmedKey=rawKey.trim(),trimmedValue=rawValue.trim();if(trimmedKey.length===0){errors.push("type option keys must not be empty");continue}if(trimmedValue.length===0){errors.push(`type option "${trimmedKey}" must not be empty`);continue}const optionDefinition=optionByAlias.get(trimmedKey.toLowerCase());if(!optionDefinition){const allowed=typeDefinition.options.map(option=>option.key).join(", ");errors.push(typeDefinition.options.length>0?`Unknown type option "${trimmedKey}" for type "${typeDefinition.name}". Allowed: ${allowed}`:`Type "${typeDefinition.name}" does not define any configurable type options`);continue}const resolvedValue=resolveTypeOptionValue(optionDefinition,trimmedValue,errors);resolvedValue!==void 0&&(normalized[optionDefinition.key]=resolvedValue)}for(const option of typeDefinition.options)option.required&&!(option.key in normalized)&&errors.push(`Missing required type option "${option.key}" for type "${typeDefinition.name}"`);const sortedKeys=Object.keys(normalized).sort((left,right)=>left.localeCompare(right));return sortedKeys.length===0?{normalized:void 0,errors}:{normalized:Object.fromEntries(sortedKeys.map(key=>[key,normalized[key]])),errors}}export{BUILTIN_ITEM_EXECUTION_ROLES,COMMON_MUTATION_COMMAND_OPTION_KEYS,DEFAULT_REQUIRED_CREATE_FIELDS,DEFAULT_REQUIRED_CREATE_REPEATABLES,canonicalizeCommandOptionKey,commandOptionFlagLabel,normalizeItemTypeFolder,resolveCommandOptionPolicyState,resolveItemTypeRegistry,resolveTypeDefinition,resolveTypeName,toDefaultFolder,validateTypeOptions};
|
|
1
|
+
import w from"node:path";import{TYPE_TO_FOLDER as R}from"../shared/constants.js";import{ITEM_TYPE_VALUES as k}from"../../types/index.js";import{normalizeItemTypeDefinition as L,normalizeItemTypeStringList as f,strictPolicyCommand as M,parseItemExecutionRole as N}from"./item-type-definition.js";const I=Object.freeze({decision:"human",milestone:"gate"}),q=["title","description","status","priority","tags","body","deadline","estimatedMinutes","acceptanceCriteria","author","message","assignee"],S=["dep","comment","note","learning","file","test","doc"],b=["deadline","estimatedMinutes","acceptanceCriteria","definitionOfReady","order","goal","objective","value","impact","outcome","whyNow","assignee","parent","reviewer","risk","confidence","sprint","release","blockedBy","blockedReason","unblockNote","reporter","severity","environment","reproSteps","resolution","expectedResult","actualResult","affectedVersion","fixedVersion","component","regression","customerImpact"],D=["title","description","type","status","priority","tags","body",...b,"author","message","dep","comment","note","learning","file","test","doc","reminder","event","typeOption","field"],x=["title","description","body","status","closeReason","priority","type","tags",...b,"author","message","comment","note","learning","file","test","doc","reminder","event","typeOption","field","ownershipMetadataBypass","ownershipDependencyBypass","force"],O={"close-reason":"closeReason",close_reason:"closeReason","estimated-minutes":"estimatedMinutes",estimated_minutes:"estimatedMinutes",estimate:"estimatedMinutes","acceptance-criteria":"acceptanceCriteria",acceptance_criteria:"acceptanceCriteria",ac:"acceptanceCriteria","definition-of-ready":"definitionOfReady",definition_of_ready:"definitionOfReady",rank:"order","why-now":"whyNow",why_now:"whyNow","blocked-by":"blockedBy",blocked_by:"blockedBy","blocked-reason":"blockedReason",blocked_reason:"blockedReason","unblock-note":"unblockNote",unblock_note:"unblockNote","repro-steps":"reproSteps",repro_steps:"reproSteps","expected-result":"expectedResult",expected_result:"expectedResult","actual-result":"actualResult",actual_result:"actualResult","affected-version":"affectedVersion",affected_version:"affectedVersion","fixed-version":"fixedVersion",fixed_version:"fixedVersion","customer-impact":"customerImpact",customer_impact:"customerImpact","type-option":"typeOption",type_option:"typeOption",type_options:"typeOption"},P={...O},$={...O},A=[["deadline","--deadline"],["estimatedMinutes","--estimate/--estimated-minutes"],["acceptanceCriteria","--acceptance-criteria/--ac"],["definitionOfReady","--definition-of-ready"],["order","--order/--rank"],["goal","--goal"],["objective","--objective"],["value","--value"],["impact","--impact"],["outcome","--outcome"],["whyNow","--why-now"],["assignee","--assignee"],["parent","--parent"],["reviewer","--reviewer"],["risk","--risk"],["confidence","--confidence"],["sprint","--sprint"],["release","--release"],["blockedBy","--blocked-by"],["blockedReason","--blocked-reason"],["unblockNote","--unblock-note"],["reporter","--reporter"],["severity","--severity"],["environment","--environment"],["reproSteps","--repro-steps"],["resolution","--resolution"],["expectedResult","--expected-result"],["actualResult","--actual-result"],["affectedVersion","--affected-version"],["fixedVersion","--fixed-version"],["component","--component"],["regression","--regression"],["customerImpact","--customer-impact"]],C=[["comment","--comment"],["note","--note"],["learning","--learning"],["file","--file"],["test","--test"],["doc","--doc"],["reminder","--reminder"],["event","--event"],["typeOption","--type-option"]];function E(t){return Object.fromEntries(t)}const B=E([["title","--title"],["description","--description"],["type","--type"],["status","--status"],["priority","--priority"],["tags","--tags"],["body","--body"],...A,["author","--author"],["message","--message"],["dep","--dep"],...C]),U=E([["title","--title"],["description","--description"],["body","--body"],["status","--status"],["closeReason","--close-reason"],["priority","--priority"],["type","--type"],["tags","--tags"],...A,...C,["author","--author"],["message","--message"],["force","--force"]]);function F(t){return t.trim().replace(/^--+/,"").toLowerCase()}function j(t){return t==="create"?D:x}function V(t){return t==="create"?P:$}function T(t,e){const n=F(e);if(n.length===0)return;const o=V(t)[n];return o||j(t).find(r=>r.toLowerCase()===n)}function be(t,e){return(t==="create"?B:U)[e]??`--${e.replace(/([A-Z])/g,"-$1").toLowerCase()}`}function K(t){const e=Y(t);return e.length===0?"items":e.endsWith("s")?e:`${e}s`}function z(t){const e=t.trim(),o=e.replaceAll("\\","/").replace(/^\/+/,""),r=w.posix.normalize(o);if(e.includes("\0")||/^[A-Za-z]:/.test(r)||r==="."||r===".."||r.startsWith("../"))throw new Error(`Item type folder "${t}" must stay inside the pm tracker root.`);return r}function Y(t){const e=t.trim().toLowerCase();let n="",o=!1;for(const r of e){const s=r.charCodeAt(0),a=s>=97&&s<=122,d=s>=48&&s<=57;if(a||d){o&&n.length>0&&(n+="-"),n+=r,o=!1;continue}n.length>0&&(o=!0)}return n}function G(t){return L(t,{resolvePolicyCommand:M})}function l(t,e){const n=t[e];return Array.isArray(n)?n.filter(o=>typeof o=="string"):void 0}function Q(t){if(typeof t!="object"||t===null||Array.isArray(t))return null;const e=t;return typeof e.key!="string"?null:{key:e.key,values:l(e,"values")??[],required:e.required===void 0?void 0:!!e.required,aliases:l(e,"aliases"),description:typeof e.description=="string"?e.description:void 0}}function W(t){if(typeof t!="object"||t===null||Array.isArray(t))return null;const e=t;if(typeof e.command!="string"||typeof e.option!="string")return null;const n=e.command.trim().toLowerCase();return n!=="create"&&n!=="update"?null:{command:n,option:e.option,required:e.required===void 0?void 0:!!e.required,visible:e.visible===void 0?void 0:!!e.visible,enabled:e.enabled===void 0?void 0:!!e.enabled}}function Z(t){if(Array.isArray(t.options))return t.options.map(e=>Q(e)).filter(e=>e!==null)}function H(t){if(Array.isArray(t.command_option_policies))return t.command_option_policies.map(e=>W(e)).filter(e=>e!==null)}function X(t){if(typeof t!="object"||t===null||Array.isArray(t))return null;const e=t,n=typeof e.name=="string"?e.name:"";if(n.trim().length===0)return null;const o=typeof e.folder=="string"?e.folder:void 0,r=typeof e.description=="string"?e.description:void 0,s=typeof e.default_status=="string"?e.default_status:void 0;return{name:n,description:r,default_status:s,execution_role:N(e.execution_role),folder:o,aliases:l(e,"aliases"),required_create_fields:l(e,"required_create_fields"),required_create_repeatables:l(e,"required_create_repeatables"),options:Z(e),command_option_policies:H(e)}}function J(t,e){return t.required_create_fields?f(t.required_create_fields):e?.required_create_fields??[]}function ee(t,e){return t.required_create_repeatables?f(t.required_create_repeatables):e?.required_create_repeatables??[]}function te(t,e){return t.options?t.options:e?.options?[...e.options]:[]}function oe(t,e){return t.command_option_policies?t.command_option_policies:e?.command_option_policies?[...e.command_option_policies]:[]}function ne(t,e){const n=e?.name??t.name,o=t.description??e?.description,r=t.default_status??e?.default_status,s=z(t.folder??e?.folder??K(n)),a={name:n,execution_role:t.execution_role,folder:s,aliases:f([...e?.aliases??[],...t.aliases??[]]),required_create_fields:J(t,e),required_create_repeatables:ee(t,e),options:te(t,e),command_option_policies:oe(t,e)};return o&&(a.description=o),r&&(a.default_status=r),a}function v(t,e){for(const n of t){const o=G(n);if(!o)continue;const r=o.name.toLowerCase(),s=e.get(r);e.set(r,ne({...o,execution_role:o.execution_role??s?.execution_role},s))}}function re(t){if(!t)return[];const e=[];for(const n of t.item_types??[]){const o=n.types;if(Array.isArray(o))for(const r of o){const s=X(r);s&&e.push(s)}}return e}function Oe(t,e=null){const n=new Map;for(const i of k)n.set(i.toLowerCase(),{name:i,execution_role:I[i.toLowerCase()]??"agent",folder:R[i],aliases:[],required_create_fields:[...q],required_create_repeatables:[...S],options:[],command_option_policies:[]});v(t.item_types?.definitions??[],n),v(re(e),n);const o=[...n.values()].sort((i,c)=>i.name.localeCompare(c.name)),r={},s={},a={};for(const i of o){r[i.name]=i,a[i.name]=i.folder,s[i.name.toLowerCase()]=i.name;for(const c of i.aliases)s[c.toLowerCase()]=i.name}const d=[...new Set(o.map(i=>i.folder))].sort((i,c)=>i.localeCompare(c));return{types:o.map(i=>i.name),folders:d,type_to_folder:a,by_type:r,alias_to_type:s}}function ie(t,e){if(t!==void 0)return e.alias_to_type[t.trim().toLowerCase()]}function se(t,e){const n=ie(t,e);if(n)return e.by_type[n]}function ae(t,e,n,o){for(const r of o){const s=T(n,r);if(s){t.required.add(s);continue}t.errors.push(`Unsupported base required option "${r}" for command "${n}" on type "${e.name}"`)}}function m(t,e,n){if(n){t.add(e);return}t.delete(e)}function ce(t,e,n,o){const r=T(n,o.option);if(!r){t.errors.push(`Unsupported command_option_policies option "${o.option}" for command "${n}" on type "${e.name}"`);return}o.required!==void 0&&m(t.required,r,o.required),o.visible!==void 0&&m(t.hidden,r,!o.visible),o.enabled!==void 0&&m(t.disabled,r,!o.enabled)}function de(t,e,n){for(const o of e.command_option_policies)o.command===n&&ce(t,e,n,o)}function le(t,e,n){for(const o of t.required)t.disabled.has(o)&&t.errors.push(`Option "${o}" cannot be both required and disabled for command "${n}" on type "${e.name}"`)}function Ae(t,e,n){const o=[],r=new Set,s=new Set,a=new Set,d={required:r,hidden:s,disabled:a,errors:o};return ae(d,t,e,n),de(d,t,e),le(d,t,e),{required:[...r],hidden:[...s].sort((i,c)=>i.localeCompare(c)),disabled:[...a].sort((i,c)=>i.localeCompare(c)),errors:o}}function pe(t){const e=new Map;for(const n of t.options){e.set(n.key.toLowerCase(),n);for(const o of n.aliases??[])e.set(o.toLowerCase(),n)}return e}function ue(t,e,n){const o=t.values;if(o.length===0)return e;const s=new Map(o.map(a=>[a.toLowerCase(),a])).get(e.toLowerCase());if(!s){n.push(`Invalid value "${e}" for type option "${t.key}". Allowed: ${o.join(", ")}`);return}return s}function Ce(t,e,n){const o=se(t,n);if(!o)return{normalized:void 0,errors:[`Unknown type "${t}"`]};const r=[],s=pe(o),a={};for(const[i,c]of Object.entries(e??{})){const p=i.trim(),y=c.trim();if(p.length===0){r.push("type option keys must not be empty");continue}if(y.length===0){r.push(`type option "${p}" must not be empty`);continue}const u=s.get(p.toLowerCase());if(!u){const g=o.options.map(h=>h.key).join(", ");r.push(o.options.length>0?`Unknown type option "${p}" for type "${o.name}". Allowed: ${g}`:`Type "${o.name}" does not define any configurable type options`);continue}const _=ue(u,y,r);_!==void 0&&(a[u.key]=_)}for(const i of o.options)i.required&&!(i.key in a)&&r.push(`Missing required type option "${i.key}" for type "${o.name}"`);const d=Object.keys(a).sort((i,c)=>i.localeCompare(c));return d.length===0?{normalized:void 0,errors:r}:{normalized:Object.fromEntries(d.map(i=>[i,a[i]])),errors:r}}export{I as BUILTIN_ITEM_EXECUTION_ROLES,b as COMMON_MUTATION_COMMAND_OPTION_KEYS,q as DEFAULT_REQUIRED_CREATE_FIELDS,S as DEFAULT_REQUIRED_CREATE_REPEATABLES,T as canonicalizeCommandOptionKey,be as commandOptionFlagLabel,z as normalizeItemTypeFolder,Ae as resolveCommandOptionPolicyState,Oe as resolveItemTypeRegistry,se as resolveTypeDefinition,ie as resolveTypeName,K as toDefaultFolder,Ce as validateTypeOptions};
|
|
2
2
|
//# sourceMappingURL=type-registry.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
const t={bug:"Issue",bugfix:"Issue",defect:"Issue",incident:"Issue",enhancement:"Feature",story:"Feature",userstory:"Feature","user-story":"Feature","user story":"Feature",change:"Chore",ticket:"Task",todo:"Task"};function r(e){if(e!==void 0)return t[e.trim().toLowerCase()]}export{t as TYPE_SYNONYMS,r as resolveTypeSynonym};
|
|
2
2
|
//# sourceMappingURL=type-synonyms.js.map
|
package/dist/core/lock/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export*from"./lock.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import y from"node:fs/promises";import r from"node:path";import{isFileMissingError as p}from"../fs/fs-utils.js";import{EXIT_CODE as _}from"../shared/constants.js";import{PmCliError as v}from"../shared/errors.js";const x="lock_path_unsafe";function w(e,t){return r.relative(e,t).split(r.sep).join("/")}function R(e,t){return e==="lock_entry_symlink"?`Remove the symlinked lock entry ${t} (pm neither follows nor deletes it), then retry the same operation.`:e==="lock_directory_replaced"?`Restore ${t} as a real directory inside the tracker, then retry the same operation. The lock file created while it was replaced stays where the replacement pointed, because pm never deletes outside the tracker; remove it there if it is not wanted.`:"Replace the symlinked or replaced lock directory with a real directory inside the tracker (for example: remove the link, then let pm recreate locks/), then retry the same operation."}function d(e){const t=e.component??r.dirname(e.lockPath),o=w(e.pmRoot,t);return new v(`Refused to acquire lock ${e.id}: ${o} is not a real directory inside the tracker (${e.reason}). Locks are never created through a symlinked or replaced lock directory.`,_.CONFLICT,{code:"lock_path_unsafe",item_id:e.id,reason:e.reason,lock_component:o,required:R(e.reason,o)})}function u(e,t){return e.dev===t.dev&&e.ino===t.ino}async function b(e,t,o,n=!0){const i=r.resolve(e),c=r.dirname(r.resolve(t)),s=r.relative(i,c);if(s===".."||s.startsWith(`..${r.sep}`)||r.isAbsolute(s))throw d({pmRoot:i,lockPath:t,id:o,reason:"lock_path_outside_tracker",component:c});let l=i,f=null;for(const m of s===""?[]:s.split(r.sep)){l=r.join(l,m);let a;try{a=await y.lstat(l,{bigint:!0})}catch(k){if(n&&p(k))return null;throw k}if(a.isSymbolicLink())throw d({pmRoot:i,lockPath:t,id:o,reason:"lock_directory_symlink",component:l});if(!a.isDirectory())throw d({pmRoot:i,lockPath:t,id:o,reason:"lock_directory_not_directory",component:l});f={dev:a.dev,ino:a.ino}}if(f!==null)return f;const h=await y.stat(i,{bigint:!0});return{dev:h.dev,ino:h.ino}}async function $(e,t,o){let n;try{n=await y.lstat(t)}catch{return}if(n.isSymbolicLink())throw d({pmRoot:e,lockPath:t,id:o,reason:"lock_entry_symlink",component:t})}async function P(e){const t=await e.handle.stat({bigint:!0}),o={dev:t.dev,ino:t.ino};let n=!1;try{const i=await b(e.pmRoot,e.lockPath,e.id,!1);if(u(e.directory,i)){const c=await y.lstat(e.lockPath,{bigint:!0});n=!c.isSymbolicLink()&&u(o,c)}}catch{n=!1}if(!n)throw d({pmRoot:e.pmRoot,lockPath:e.lockPath,id:e.id,reason:"lock_directory_replaced"})}export{x as LOCK_PATH_UNSAFE_CODE,$ as assertLockEntryNotSymlink,d as buildLockPathUnsafeError,b as inspectConfinedLockDirectory,P as verifyConfinedLockCreation};
|
|
2
2
|
//# sourceMappingURL=lock-confinement.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{inspectConfinedLockDirectory as y}from"./lock-confinement.js";import{inspectLockOwner as m}from"./lock-owner.js";import{acquireStaleCleanupGate as g,recordDeadLockRecovery as v}from"./lock.js";import{isFileMissingError as u}from"../fs/fs-utils.js";import _ from"node:fs/promises";import p from"node:path";function h(n){let r;try{r=JSON.parse(n)}catch{return null}if(typeof r!="object"||r===null||Array.isArray(r))return null;const s=r,{id:t,owner:a,created_at:e,ttl_seconds:i}=s;return typeof t!="string"||typeof a!="string"||typeof e!="string"||typeof i!="number"||!Number.isFinite(i)?null:{id:t,owner:a,created_at:e,ttl_seconds:i,pid:s.pid,host_identity:s.host_identity,process_start_identity:s.process_start_identity}}function b(n,r,s){const t=h(r);if(t===null)return{detail:"unparseable_json",entry:{file:n,id:null,owner:null,created_at:null,ttl_seconds:null,age_seconds:null,stale:!1,reason:"unparseable"}};const a=Date.parse(t.created_at);if(!Number.isFinite(a))return{detail:"invalid_timestamp",entry:{file:n,id:t.id,owner:t.owner,created_at:t.created_at,ttl_seconds:t.ttl_seconds,age_seconds:null,stale:!1,reason:"unparseable"}};const e=s-a,i=Math.floor(e/1e3),o=e>t.ttl_seconds*1e3;return{detail:o?"expired":"active",entry:{file:n,id:t.id,owner:t.owner,created_at:t.created_at,ttl_seconds:t.ttl_seconds,age_seconds:i,stale:o,reason:o?"expired":"active"}}}async function k(n,r,s){const t=b(n,r,s);if(t.detail!=="active")return t;const a=h(r),e=await m(a);return e==="unknown"?t:{detail:e==="dead"?"owner_dead":"active",entry:{...t.entry,owner_state:e,pid:a.pid,...e==="dead"?{stale:!0,reason:"owner_dead"}:{}}}}async function L(n,r,s){const t=await g(n,"gc");if(t===null)return!1;try{let a;try{a=await _.readFile(n,"utf8")}catch(e){if(u(e))return!0;throw e}if(a!==r)return!1;s&&await v(n,r);try{await _.unlink(n)}catch(e){if(!u(e))throw e}return!0}finally{await t()}}function D(n,r,s){r==="owner_dead"&&(n.owner_dead_lock_samples??=[],n.owner_dead_lock_samples.length<20&&n.owner_dead_lock_samples.push(s)),r==="active"?n.active_lock_count+=1:r==="expired"||r==="owner_dead"?n.stale_lock_count+=1:n.unparseable_lock_count+=1}async function E(n,r){const s=r??Date.now(),t=p.join(n,"locks"),a={scanned:0,active_lock_count:0,stale_lock_count:0,unreadable_lock_count:0,unparseable_lock_count:0};let e;try{e=(await _.readdir(t)).filter(o=>o.endsWith(".lock")).sort()}catch(i){if(u(i))return a;throw i}for(const i of e){let o;try{o=await _.readFile(p.join(t,i),"utf8")}catch(f){if(u(f))continue;a.scanned+=1,a.unreadable_lock_count+=1;continue}a.scanned+=1;const{detail:c,entry:l}=await k(i,o,s);D(a,c,l)}return a}async function j(n,r,s,t,a,e,i){if(!r.dryRun){try{if(!await L(s,e,i.reason==="owner_dead")){n.warnings.push(`lock_changed_or_busy:${a}`),n.retained.push(t),n.entries.push(i);return}}catch{n.warnings.push(`lock_remove_failed:${a}`),n.retained.push(t),n.entries.push(i);return}if(r.hooks?.onWrite){const o=await r.hooks.onWrite(s);n.warnings.push(...o)}}n.removed.push(t),n.entries.push(i)}async function A(n,r){const{hooks:s}=r,t=r.now??Date.now(),a=p.join(n,"locks"),e={scanned:0,removed:[],retained:[],warnings:[],entries:[]};await y(n,p.join(a,"gc.lock"),"gc");let i;try{i=(await _.readdir(a)).filter(c=>c.endsWith(".lock")).sort()}catch(o){if(u(o))return e;throw o}for(const o of i){e.scanned+=1;const c=p.join(a,o),l=`locks/${o}`;if(s?.onRead){const w=await s.onRead(c);e.warnings.push(...w)}let f;try{f=await _.readFile(c,"utf8")}catch(w){if(u(w)){e.scanned-=1;continue}e.warnings.push(`lock_unreadable:${o}`),e.retained.push(l),e.entries.push({file:o,id:null,owner:null,created_at:null,ttl_seconds:null,age_seconds:null,stale:!1,reason:"unparseable"});continue}const d=await k(o,f,t);if(d.detail==="unparseable_json"){e.warnings.push(`lock_unparseable:${o}`),e.retained.push(l),e.entries.push(d.entry);continue}if(d.detail==="invalid_timestamp"){e.warnings.push(`lock_invalid_timestamp:${o}`),e.retained.push(l),e.entries.push(d.entry);continue}if(d.detail==="active"){e.retained.push(l),e.entries.push(d.entry);continue}await j(e,r,c,l,o,f,d.entry)}return e}export{b as classifyLockContent,A as runLockGc,E as scanLockHealth};
|
|
2
2
|
//# sourceMappingURL=lock-gc.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import o from"node:fs/promises";import{createHash as i}from"node:crypto";function u(t,r){return typeof t=="object"&&t!==null&&"code"in t&&t.code===r}function a(t){if(!Number.isSafeInteger(t)||t<=0)return!1;try{return process.kill(t,0),!0}catch(r){return!u(r,"ESRCH")}}function l(t){const r=t.lastIndexOf(")");if(r<0)return null;const e=t.slice(r+2).trim().split(/\s+/u)[19];return e!==void 0&&/^\d+$/u.test(e)?e:null}async function s(t){try{return l(await o.readFile(`/proc/${t}/stat`,"utf8"))}catch{return null}}async function f(t=process.pid){const r=await s(t);return{pid:t,...r===null?{}:{process_start_identity:r}}}async function y(t,r,e){if(!a(t.pid))return!1;const n=await s(t.pid);return t.process_start_identity!==void 0&&n!==null?n===t.process_start_identity:r<=e}async function c(){try{const[t,r]=await Promise.all([o.readFile("/proc/sys/kernel/random/boot_id","utf8"),o.readlink("/proc/self/ns/pid")]);return!/^[a-f0-9-]{36}\s*$/u.test(t)||!/^pid:\[\d+\]$/u.test(r)?null:i("sha256").update(`${t.trim()}:${r}`).digest("hex")}catch{return null}}async function _(){const[t,r]=await Promise.all([c(),s(process.pid)]);return t!==null&&r!==null?{host_identity:t,process_start_identity:r}:{}}async function m(t){if(!t||typeof t.pid!="number"||!Number.isSafeInteger(t.pid)||t.pid<=0||typeof t.host_identity!="string"||typeof t.process_start_identity!="string"||!/^\d+$/u.test(t.process_start_identity))return"unknown";const r=await c();if(r===null||r!==t.host_identity)return"unknown";try{process.kill(t.pid,0)}catch(n){return u(n,"ESRCH")?"dead":"unknown"}const e=await s(t.pid);return e===null?"unknown":e===t.process_start_identity?"alive":"dead"}export{_ as captureLockOwnerIdentity,f as captureProcessIdentity,m as inspectLockOwner,y as isProcessIdentityAlive,l as parseLinuxProcessStartIdentity,c as readLockHostIdentity,s as readProcessStartIdentity};
|
|
2
2
|
//# sourceMappingURL=lock-owner.js.map
|
package/dist/core/lock/lock.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
`,"utf8")}finally{await handle.close()}}catch(error){throw await unlinkLockWithHook(lockPath,"lock:release"),error}}finally{await releaseCleanupGate()}return await emitLockWriteHook(lockPath,"lock:create"),createdAt}async function unlinkLockWithHook(lockPath,op){try{return await fs.unlink(lockPath),await emitLockWriteHook(lockPath,op),!0}catch{return!1}}async function releaseOwnedLock(lockPath,id,owner,token){const startedAtMs=performance.now();let backoffMs=LOCK_WAIT_INITIAL_DELAY_MS;for(;;){const releaseCleanupGate=await acquireStaleCleanupGate(lockPath,id);if(releaseCleanupGate!==null){try{const current2=await readLockInfo(lockPath,!1);isOwnedLock(current2.info,id,owner,token)&&await unlinkLockWithHook(lockPath,"lock:release")}finally{await releaseCleanupGate()}return}const current=await readLockInfo(lockPath,!1);if(!isOwnedLock(current.info,id,owner,token))return;const elapsedMs=performance.now()-startedAtMs;if(elapsedMs>=LOCK_RELEASE_GATE_WAIT_MS)return;await sleepWithJitter(Math.min(backoffMs,LOCK_RELEASE_GATE_WAIT_MS-elapsedMs)),backoffMs=Math.min(backoffMs*2,LOCK_WAIT_MAX_DELAY_MS)}}function isOwnedLock(info,id,owner,token){return info?.id===id&&info.pid===process.pid&&info.owner===owner&&info.token===token}function isStaleLock(info,ttlSeconds){const createdAtMs=info?.created_at?Date.parse(info.created_at):Number.NaN;return(Number.isFinite(createdAtMs)?Date.now()-createdAtMs:Number.POSITIVE_INFINITY)>ttlSeconds*1e3}async function isConfirmedDeadLock(info){return info!==null&&Number.isFinite(Date.parse(info.created_at))&&await inspectLockOwner(info)==="dead"}async function isReclaimableLock(info,ttlSeconds){return isStaleLock(info,ttlSeconds)||await isConfirmedDeadLock(info)}async function hasUnexpiredLockOwner(pmRoot,id,ownerPrefix){const{info}=await readLockInfo(getLockPath(pmRoot,id),!1);return info!==null&&info.owner.startsWith(ownerPrefix)&&!await isReclaimableLock(info,info.ttl_seconds)}function lockOwnerSuffix(info){return info?.owner?` (owner ${info.owner})`:""}const LOCK_WAIT_INITIAL_DELAY_MS=25,LOCK_WAIT_MAX_DELAY_MS=200,LOCK_CONFLICT_RETRY_HINT_MS=250,LOCK_PROGRESS_MAX_WAIT_MS=12e4,MAX_STALE_LOCK_REMOVALS=3,STALE_CLEANUP_GATE_SUFFIX=".stale-cleanup",STALE_CLEANUP_GATE_OWNER_FILE="owner.json",STALE_CLEANUP_GATE_STALE_MS=1e4,LOCK_RELEASE_GATE_WAIT_MS=STALE_CLEANUP_GATE_STALE_MS+LOCK_WAIT_MAX_DELAY_MS;function parseNonNegativeIntegerWaitMs(value){if(typeof value=="string"){const trimmed=value.trim();if(!/^\d+$/.test(trimmed))return;const parsed=Number(trimmed);return Number.isSafeInteger(parsed)?parsed:void 0}if(typeof value=="number"&&Number.isFinite(value)&&value>=0)return Math.trunc(value)}function resolveLockWaitMs(waitMs){const envRaw=process.env.PM_LOCK_WAIT_MS,envParsed=parseNonNegativeIntegerWaitMs(envRaw);if(envParsed!==void 0)return envParsed;const callerParsed=parseNonNegativeIntegerWaitMs(waitMs);return callerParsed!==void 0?callerParsed:0}function cappedLockWaitMs(waitMs,maxWaitMs){return Math.min(resolveLockWaitMs(waitMs),maxWaitMs??1/0)}function sleepWithJitter(baseDelayMs){const jitteredMs=Math.max(1,Math.round(baseDelayMs*(.5+Math.random())));return new Promise(resolve=>setTimeout(resolve,jitteredMs))}async function buildLockConflictError(id,info,waitedMs,ownerHandoffs=0){waitedMs=Math.floor(waitedMs);const ownerState=await inspectLockOwner(info),handoffSuffix=ownerHandoffs>0?` across ${ownerHandoffs} owner handoff(s)`:"",waitedSuffix=waitedMs>0?` after waiting ${waitedMs}ms${handoffSuffix}`:"";return new PmCliError(`Item ${id} is locked${lockOwnerSuffix(info)} (owner process ${ownerState})${waitedSuffix}`,EXIT_CODE.CONFLICT,{code:"lock_conflict",item_id:id,reason:`lock_owner_${ownerState}`,required:"Wait for the owner to release the lock, then retry the same operation. Set PM_LOCK_WAIT_MS to a larger bounded millisecond budget when contention is expected. Inspect stale receipts with pm gc --scope locks --dry-run.",recovery:{retry_after_ms:LOCK_CONFLICT_RETRY_HINT_MS,...waitedMs>0?{waited_ms:waitedMs,owner_handoffs:ownerHandoffs}:{}}})}function createLockWaitTracker(waitBudgetMs,totalCeilingMs){const startedAtMs=performance.now();let stallStartedAtMs=startedAtMs,observedGeneration,ownerHandoffs=0;return{startedAtMs,observe(info){const nowMs=performance.now(),generation=lockGenerationKey(info);observedGeneration!==void 0&&generation!==observedGeneration&&(ownerHandoffs+=1,stallStartedAtMs=nowMs),observedGeneration=generation;const elapsedMs=nowMs-startedAtMs,stalledMs=nowMs-stallStartedAtMs;return{exhausted:waitBudgetMs===0||stalledMs>=waitBudgetMs||elapsedMs>=totalCeilingMs,elapsedMs,remainingMs:Math.min(waitBudgetMs-stalledMs,totalCeilingMs-elapsedMs),ownerHandoffs}}}}function resolveLockWaitCeilingMs(waitBudgetMs,maxWaitMs,waitPolicy){return waitPolicy!=="progress"||maxWaitMs!==void 0?waitBudgetMs:Math.max(waitBudgetMs,LOCK_PROGRESS_MAX_WAIT_MS)}function lockGenerationKey(info){return info===null?"released":info.token??`${info.pid}:${info.owner}:${info.created_at}`}function describeLease(lease){const expiresAtMs=Date.parse(lease.acquiredAt)+lease.ttlSeconds*1e3;return{owner:lease.owner,acquired_at:lease.acquiredAt,ttl_seconds:lease.ttlSeconds,expires_at:new Date(expiresAtMs).toISOString()}}function describeLockLoss(id,lease,current,reason){const leaseLabel=`the lease acquired at ${lease.acquiredAt} (ttl ${lease.ttlSeconds}s)`;if(reason==="fence_gate_unavailable")return{summary:`Lock for ${id} could not be verified before commit: ${leaseLabel} could not enter its commit fence because the stale-cleanup gate stayed held.`,required:"Retry the same operation; this writer's change was not committed. Inspect pm gc --scope locks --dry-run if the stale-cleanup gate stays held."};const holder=current===null?"the lock no longer exists":`it is now held by ${current.owner} since ${current.created_at}`;return{summary:`Lock for ${id} was lost before commit: ${leaseLabel} is no longer owned by this writer, and ${holder}.`,required:"Re-read the item and apply the mutation again; this writer's change was not committed and the newer value was kept. Keep mutation work shorter than locks.ttl_seconds, or raise locks.ttl_seconds for long-running callbacks."}}function buildLockLostError(id,lease,current,reason){const{summary,required}=describeLockLoss(id,lease,current,reason);return new PmCliError(`${summary} Nothing was written.`,EXIT_CODE.CONFLICT,{code:"lock_lost",item_id:id,reason,lease:describeLease(lease),current_owner:current===null?null:{owner:current.owner,pid:current.pid,created_at:current.created_at,ttl_seconds:current.ttl_seconds},required,recovery:{retry_after_ms:LOCK_CONFLICT_RETRY_HINT_MS}})}async function waitForStaleCleanupGate(lockPath,id){const startedAtMs=performance.now();let backoffMs=LOCK_WAIT_INITIAL_DELAY_MS;for(;;){const releaseCleanupGate=await acquireStaleCleanupGate(lockPath,id);if(releaseCleanupGate!==null)return releaseCleanupGate;const elapsedMs=performance.now()-startedAtMs;if(elapsedMs>=LOCK_RELEASE_GATE_WAIT_MS)return null;await sleepWithJitter(Math.min(backoffMs,LOCK_RELEASE_GATE_WAIT_MS-elapsedMs)),backoffMs=Math.min(backoffMs*2,LOCK_WAIT_MAX_DELAY_MS)}}async function fenceOwnedLock(lockPath,id,lease,commit){const releaseCleanupGate=await waitForStaleCleanupGate(lockPath,id);if(releaseCleanupGate===null){const current=await readLockInfo(lockPath,!1);throw buildLockLostError(id,lease,current.info,"fence_gate_unavailable")}try{const current=await readLockInfo(lockPath,!1);if(!isOwnedLock(current.info,id,lease.owner,lease.token))throw buildLockLostError(id,lease,current.info,current.info===null?"lease_released":"lease_taken_over");return await commit()}finally{await releaseCleanupGate()}}function resolveLockOverrideRelease(result){if(typeof result=="function")return result;if(typeof result=="object"&&result!==null&&"release"in result){const release=result.release;return typeof release=="function"?release:null}return null}async function staleLockCleanupStep(lockPath,relativeLockPath,gcRemovable){const lockRoot=path.dirname(path.dirname(lockPath)),manual=`Remove ${relativeLockPath} under ${path.relative(process.cwd(),lockRoot)||"."} once its owner is confirmed gone, then retry the same command.`;if(!gcRemovable)return`${manual} pm gc --scope locks keeps this lock: its metadata cannot be read or dated, or its own TTL has not run out.`;try{await fs.access(getSettingsPath(lockRoot))}catch{return manual}const cwd=process.cwd(),scope=path.resolve(resolvePmRoot(cwd))===path.resolve(lockRoot)?[]:["--pm-path",path.relative(cwd,lockRoot)||"."];return`Run ${renderPmCommand([...scope,"gc","--scope","locks"])} (add --dry-run to preview), then retry the same command.`}function isGcRemovableLock(lockInfo){return lockInfo.info!==null&&lockInfo.warnings.length===0&&Number.isFinite(Date.parse(lockInfo.info.created_at))&&isStaleLock(lockInfo.info,lockInfo.info.ttl_seconds)}async function throwIfStaleLockNeedsForce(id,lockPath,lockInfo,force,forceRequired){if(!force&&forceRequired){const warningSuffix=lockInfo.warnings.length>0?` (${lockInfo.warnings.join(",")})`:"",relativeLockPath=`locks/${path.basename(lockPath)}`;throw new PmCliError(`Lock ${id} is stale${warningSuffix}; remove the expired lease, or rerun with --force where this command accepts it`,EXIT_CODE.CONFLICT,{code:"stale_lock_requires_override",details:{lock_id:id,lock_path:relativeLockPath},why:`The lease in ${relativeLockPath} is past its TTL, and force_required_for_stale_lock keeps an expired lease until it is removed explicitly.`,required:"Remove the expired lease, then retry the same command.",nextSteps:[await staleLockCleanupStep(lockPath,relativeLockPath,isGcRemovableLock(lockInfo))]})}}function parseStaleCleanupGateOwner(raw){let parsed;try{parsed=JSON.parse(raw)}catch{return null}if(typeof parsed!="object"||parsed===null||Array.isArray(parsed))return null;const candidate=parsed,pid=candidate.pid,token=candidate.token,processStartIdentity=candidate.process_start_identity;return typeof pid!="number"||!Number.isInteger(pid)||pid<=0||typeof token!="string"||token.length===0||processStartIdentity!==void 0&&(typeof processStartIdentity!="string"||!/^\d+$/u.test(processStartIdentity))?null:{pid,token,host_identity:candidate.host_identity,...typeof processStartIdentity=="string"?{process_start_identity:processStartIdentity}:{}}}async function readStaleCleanupGateOwner(gatePath){try{return parseStaleCleanupGateOwner(await fs.readFile(path.join(gatePath,STALE_CLEANUP_GATE_OWNER_FILE),"utf8"))}catch(error){return isFileMissingError(error)?null:void 0}}async function removeStaleCleanupGateDirectory(gatePath){try{return await fs.rm(gatePath,{recursive:!0,force:!0}),!0}catch{return!1}}async function releaseStaleCleanupGate(gatePath,token){let owner=await readStaleCleanupGateOwner(gatePath);for(let attempt=0;owner===void 0&&attempt<3;attempt+=1)await sleepWithJitter(LOCK_WAIT_INITIAL_DELAY_MS),owner=await readStaleCleanupGateOwner(gatePath);!owner||owner.token!==token||await removeStaleCleanupGateDirectory(gatePath)}async function tryCreateStaleCleanupGate(gatePath){try{await fs.mkdir(gatePath)}catch(error){return isErrno(error,"EEXIST"),null}const owner={...await captureProcessIdentity(),host_identity:(await captureLockOwnerIdentity()).host_identity,token:randomUUID()};try{await fs.writeFile(path.join(gatePath,STALE_CLEANUP_GATE_OWNER_FILE),`${JSON.stringify(owner)}
|
|
3
|
-
`,"utf8")}catch{return await
|
|
4
|
-
`,{encoding:"utf8",flag:"wx",mode:384})}async function
|
|
1
|
+
import{isFileMissingError as S}from"../fs/fs-utils.js";import{constants as fe}from"node:fs";import l from"node:fs/promises";import c from"node:path";import{createHash as de,randomUUID as g}from"node:crypto";import{runActiveOnReadHooks as we,runActiveOnWriteHooks as me,runActiveServiceOverride as x}from"../extensions/index.js";import{EXIT_CODE as v}from"../shared/constants.js";import{PmCliError as L}from"../shared/errors.js";import{toErrorMessage as _e}from"../shared/primitives.js";import{getLockPath as K,getSettingsPath as pe,resolvePmRoot as ye}from"../store/paths.js";import{renderPmCommand as ke}from"../shared/command-line.js";import{nowIso as U}from"../shared/time.js";import{LOCK_PATH_UNSAFE_CODE as he,assertLockEntryNotSymlink as Le,inspectConfinedLockDirectory as P,verifyConfinedLockCreation as Ce}from"./lock-confinement.js";import{captureProcessIdentity as Se,captureLockOwnerIdentity as J,inspectLockOwner as R,isProcessIdentityAlive as ge,parseLinuxProcessStartIdentity as ve,readProcessStartIdentity as Ee}from"./lock-owner.js";import{captureProcessIdentity as dt,isProcessIdentityAlive as wt,readProcessStartIdentity as mt}from"./lock-owner.js";function X(e){let n;try{n=JSON.parse(e)}catch{return{info:null,warnings:["lock_info_invalid_json"]}}if(typeof n!="object"||n===null||Array.isArray(n))return{info:null,warnings:["lock_info_invalid_shape"]};const t=n,r=t.id,a=t.pid,o=t.owner,i=t.token,u=t.created_at,s=t.ttl_seconds;return typeof r!="string"||typeof a!="number"||!Number.isFinite(a)||typeof o!="string"||i!==void 0&&(typeof i!="string"||i.trim().length===0)||typeof u!="string"||typeof s!="number"||!Number.isFinite(s)?{info:null,warnings:["lock_info_invalid_shape"]}:{info:{id:r,pid:a,owner:o,...typeof i=="string"?{token:i}:{},created_at:u,ttl_seconds:s,host_identity:t.host_identity,process_start_identity:t.process_start_identity},warnings:[]}}async function y(e,n=!0){try{const t=await l.readFile(e,"utf8");return n&&await we({path:e,scope:"project"}),X(t)}catch(t){return S(t)?{info:null,warnings:[]}:{info:null,warnings:["lock_info_read_failed"]}}}function _(e,n){return typeof e=="object"&&e!==null&&"code"in e&&e.code===n}async function H(e,n,t=process.platform){if(_(e,"EEXIST"))return!0;if(!_(e,"EPERM")&&!_(e,"EACCES")&&!_(e,"EBUSY"))return!1;try{return await l.lstat(n),!0}catch(r){if(t!=="win32"||!S(r)&&!_(r,"EPERM")&&!_(r,"EACCES")&&!_(r,"EBUSY"))return!1}try{return await l.access(c.dirname(n),fe.W_OK),!0}catch{return!1}}async function Y(e,n){await me({path:e,scope:"project",op:n})}async function V(e,n,t,r=g()){return{...await J(),id:e,pid:process.pid,owner:n,token:r,created_at:U(),ttl_seconds:t}}async function Ie(e,n,t,r,a,o,i){const u=await P(e,n,t);i&&u===null&&await l.mkdir(c.dirname(n),{recursive:!0});const s=await C(n,t);if(s===null)throw await l.access(c.dirname(n)),Object.assign(new Error("Lock initialization is contended"),{code:"EEXIST"});let f;try{const d=await P(e,n,t,!1),w=await l.open(n,"wx");try{await Ce({pmRoot:e,lockPath:n,id:t,handle:w,directory:d})}catch(p){throw await w.close(),p}try{try{const p=await V(t,r,a,o);f=p.created_at,await w.writeFile(`${JSON.stringify(p,null,2)}
|
|
2
|
+
`,"utf8")}finally{await w.close()}}catch(p){throw await F(n,"lock:release"),p}}finally{await s()}return await Y(n,"lock:create"),f}async function F(e,n){try{return await l.unlink(e),await Y(e,n),!0}catch{return!1}}async function Ae(e,n,t,r){const a=performance.now();let o=I;for(;;){const i=await C(e,n);if(i!==null){try{const f=await y(e,!1);G(f.info,n,t,r)&&await F(e,"lock:release")}finally{await i()}return}const u=await y(e,!1);if(!G(u.info,n,t,r))return;const s=performance.now()-a;if(s>=M)return;await b(Math.min(o,M-s)),o=Math.min(o*2,A)}}function G(e,n,t,r){return e?.id===n&&e.pid===process.pid&&e.owner===t&&e.token===r}function E(e,n){const t=e?.created_at?Date.parse(e.created_at):Number.NaN;return(Number.isFinite(t)?Date.now()-t:Number.POSITIVE_INFINITY)>n*1e3}async function z(e){return e!==null&&Number.isFinite(Date.parse(e.created_at))&&await R(e)==="dead"}async function B(e,n){return E(e,n)||await z(e)}async function st(e,n,t){const{info:r}=await y(K(e,n),!1);return r!==null&&r.owner.startsWith(t)&&!await B(r,r.ttl_seconds)}function Q(e){return e?.owner?` (owner ${e.owner})`:""}const I=25,A=200,Z=250,Me=12e4,be=3,Oe=".stale-cleanup",ee="owner.json",te=1e4,M=te+A;function W(e){if(typeof e=="string"){const n=e.trim();if(!/^\d+$/.test(n))return;const t=Number(n);return Number.isSafeInteger(t)?t:void 0}if(typeof e=="number"&&Number.isFinite(e)&&e>=0)return Math.trunc(e)}function ne(e){const n=process.env.PM_LOCK_WAIT_MS,t=W(n);if(t!==void 0)return t;const r=W(e);return r!==void 0?r:0}function Ne(e,n){return Math.min(ne(e),n??1/0)}function b(e){const n=Math.max(1,Math.round(e*(.5+Math.random())));return new Promise(t=>setTimeout(t,n))}async function re(e,n,t,r=0){t=Math.floor(t);const a=await R(n),o=r>0?` across ${r} owner handoff(s)`:"",i=t>0?` after waiting ${t}ms${o}`:"";return new L(`Item ${e} is locked${Q(n)} (owner process ${a})${i}`,v.CONFLICT,{code:"lock_conflict",item_id:e,reason:`lock_owner_${a}`,required:"Wait for the owner to release the lock, then retry the same operation. Set PM_LOCK_WAIT_MS to a larger bounded millisecond budget when contention is expected. Inspect stale receipts with pm gc --scope locks --dry-run.",recovery:{retry_after_ms:Z,...t>0?{waited_ms:t,owner_handoffs:r}:{}}})}function $e(e,n){const t=performance.now();let r=t,a,o=0;return{startedAtMs:t,observe(i){const u=performance.now(),s=ae(i);a!==void 0&&s!==a&&(o+=1,r=u),a=s;const f=u-t,d=u-r;return{exhausted:e===0||d>=e||f>=n,elapsedMs:f,remainingMs:Math.min(e-d,n-f),ownerHandoffs:o}}}}function Te(e,n,t){return t!=="progress"||n!==void 0?e:Math.max(e,Me)}function ae(e){return e===null?"released":e.token??`${e.pid}:${e.owner}:${e.created_at}`}function xe(e){const n=Date.parse(e.acquiredAt)+e.ttlSeconds*1e3;return{owner:e.owner,acquired_at:e.acquiredAt,ttl_seconds:e.ttlSeconds,expires_at:new Date(n).toISOString()}}function Re(e,n,t,r){const a=`the lease acquired at ${n.acquiredAt} (ttl ${n.ttlSeconds}s)`;if(r==="fence_gate_unavailable")return{summary:`Lock for ${e} could not be verified before commit: ${a} could not enter its commit fence because the stale-cleanup gate stayed held.`,required:"Retry the same operation; this writer's change was not committed. Inspect pm gc --scope locks --dry-run if the stale-cleanup gate stays held."};const o=t===null?"the lock no longer exists":`it is now held by ${t.owner} since ${t.created_at}`;return{summary:`Lock for ${e} was lost before commit: ${a} is no longer owned by this writer, and ${o}.`,required:"Re-read the item and apply the mutation again; this writer's change was not committed and the newer value was kept. Keep mutation work shorter than locks.ttl_seconds, or raise locks.ttl_seconds for long-running callbacks."}}function oe(e,n,t,r){const{summary:a,required:o}=Re(e,n,t,r);return new L(`${a} Nothing was written.`,v.CONFLICT,{code:"lock_lost",item_id:e,reason:r,lease:xe(n),current_owner:t===null?null:{owner:t.owner,pid:t.pid,created_at:t.created_at,ttl_seconds:t.ttl_seconds},required:o,recovery:{retry_after_ms:Z}})}async function Fe(e,n){const t=performance.now();let r=I;for(;;){const a=await C(e,n);if(a!==null)return a;const o=performance.now()-t;if(o>=M)return null;await b(Math.min(r,M-o)),r=Math.min(r*2,A)}}async function Ge(e,n,t,r){const a=await Fe(e,n);if(a===null){const o=await y(e,!1);throw oe(n,t,o.info,"fence_gate_unavailable")}try{const o=await y(e,!1);if(!G(o.info,n,t.owner,t.token))throw oe(n,t,o.info,o.info===null?"lease_released":"lease_taken_over");return await r()}finally{await a()}}function We(e){if(typeof e=="function")return e;if(typeof e=="object"&&e!==null&&"release"in e){const n=e.release;return typeof n=="function"?n:null}return null}async function qe(e,n,t){const r=c.dirname(c.dirname(e)),a=`Remove ${n} under ${c.relative(process.cwd(),r)||"."} once its owner is confirmed gone, then retry the same command.`;if(!t)return`${a} pm gc --scope locks keeps this lock: its metadata cannot be read or dated, or its own TTL has not run out.`;try{await l.access(pe(r))}catch{return a}const o=process.cwd(),i=c.resolve(ye(o))===c.resolve(r)?[]:["--pm-path",c.relative(o,r)||"."];return`Run ${ke([...i,"gc","--scope","locks"])} (add --dry-run to preview), then retry the same command.`}function De(e){return e.info!==null&&e.warnings.length===0&&Number.isFinite(Date.parse(e.info.created_at))&&E(e.info,e.info.ttl_seconds)}async function je(e,n,t,r,a){if(!r&&a){const o=t.warnings.length>0?` (${t.warnings.join(",")})`:"",i=`locks/${c.basename(n)}`;throw new L(`Lock ${e} is stale${o}; remove the expired lease, or rerun with --force where this command accepts it`,v.CONFLICT,{code:"stale_lock_requires_override",details:{lock_id:e,lock_path:i},why:`The lease in ${i} is past its TTL, and force_required_for_stale_lock keeps an expired lease until it is removed explicitly.`,required:"Remove the expired lease, then retry the same command.",nextSteps:[await qe(n,i,De(t))]})}}function Ke(e){let n;try{n=JSON.parse(e)}catch{return null}if(typeof n!="object"||n===null||Array.isArray(n))return null;const t=n,r=t.pid,a=t.token,o=t.process_start_identity;return typeof r!="number"||!Number.isInteger(r)||r<=0||typeof a!="string"||a.length===0||o!==void 0&&(typeof o!="string"||!/^\d+$/u.test(o))?null:{pid:r,token:a,host_identity:t.host_identity,...typeof o=="string"?{process_start_identity:o}:{}}}async function O(e){try{return Ke(await l.readFile(c.join(e,ee),"utf8"))}catch(n){return S(n)?null:void 0}}async function q(e){try{return await l.rm(e,{recursive:!0,force:!0}),!0}catch{return!1}}async function ie(e,n){let t=await O(e);for(let r=0;t===void 0&&r<3;r+=1)await b(I),t=await O(e);!t||t.token!==n||await q(e)}async function se(e){try{await l.mkdir(e)}catch(t){return _(t,"EEXIST"),null}const n={...await Se(),host_identity:(await J()).host_identity,token:g()};try{await l.writeFile(c.join(e,ee),`${JSON.stringify(n)}
|
|
3
|
+
`,"utf8")}catch{return await q(e),null}return n}async function ce(e,n){const t=c.join(c.dirname(e),"recoveries"),r=de("sha256").update(n).digest("hex");try{return await l.mkdir(t,{recursive:!0}),(await O(e))?.token!==n?!1:(await l.rename(e,c.join(t,`gate-${r}`)),!0)}catch{return!1}}async function Ue(e){let n;try{const r=await l.stat(e);n=Date.now()-r.mtimeMs}catch(r){return S(r)}const t=await O(e);if(t===void 0)return!1;if(t!==null){if(await R(t)==="dead")return ce(e,t.token);if(t.host_identity!==void 0)return!1}return n<=te||t!==null&&await ge(t,n,Number.POSITIVE_INFINITY)?!1:t!==null?ce(e,t.token):q(e)}async function C(e,n){const t=`${e}${Oe}`,r=await se(t);if(r!==null)return async()=>ie(t,r.token);if(!await Ue(t))return null;const a=await se(t);return a===null?null:async()=>ie(t,a.token)}async function Pe(e,n){const t=c.join(c.dirname(e),"recoveries");await l.mkdir(t,{recursive:!0}),await l.writeFile(c.join(t,`${g()}.json`),`${JSON.stringify({event:"owner_dead_recovery_attempt",recorded_at:U(),lock:JSON.parse(n)})}
|
|
4
|
+
`,{encoding:"utf8",flag:"wx",mode:384})}async function le(e){const n=await C(e.lockPath,e.id);if(n===null)return{lockInfo:e.fallbackLockInfo,shouldRetryCreate:!1,staleRemovalCounted:!1};try{const t=await y(e.lockPath);if(t.info===null&&t.warnings.length===0)return{lockInfo:t,shouldRetryCreate:!0,staleRemovalCounted:!1};const r=await z(t.info);if(!E(t.info,e.ttlSeconds)&&!r)return{lockInfo:t,shouldRetryCreate:!1,staleRemovalCounted:!1};if(await je(e.id,e.lockPath,t,e.force||r,e.forceRequiredForStaleLock),e.staleRemovals>=be)throw await re(e.id,t.info,performance.now()-e.startedAtMs);return r&&await Pe(e.lockPath,JSON.stringify(t.info)),{lockInfo:t,shouldRetryCreate:await F(e.lockPath,"lock:stale_remove"),staleRemovalCounted:!0}}finally{await n()}}async function Je(e,n,t,r){if(e instanceof L&&e.code===he)throw e;if(!await H(e,t))throw new L(`Failed to acquire lock for ${r}: ${_e(e)}`,v.GENERIC_FAILURE);await Le(n,t,r)}const ct={parseLockInfo:X,readLockInfo:y,isErrno:_,isLockCreateContention:H,buildLockPayload:V,isStaleLock:E,lockOwnerSuffix:Q,resolveLockWaitMs:ne,lockGenerationKey:ae,parseLinuxProcessStartIdentity:ve,readProcessStartIdentity:Ee,acquireStaleCleanupGate:C,removeConfirmedStaleLock:le};async function lt(e,n,t,r,a=!1,o=!0,i,u={}){return(await Xe(e,n,t,r,a,o,i,u)).release}async function Xe(e,n,t,r,a=!1,o=!0,i,u={}){const s=W(u.maxWaitMs),f=await x("lock_acquire",{pm_root:e,id:n,ttl_seconds:t,owner:r,force:a,force_required_for_stale_lock:o,...s===void 0?{}:{max_wait_ms:s}});if(f.handled){const k=We(f.result);if(k)return{release:async()=>{await Promise.resolve(k()),await x("lock_release",{pm_root:e,id:n,owner:r})},fence:m=>m()}}const d=K(e,n),w=Ne(i,s),p=Te(w,s,u.waitPolicy),D=$e(w,p),ue=D.startedAtMs;let j=0,N=I;const $=g();for(;;)try{const k=await Ie(e,d,n,r,t,$,u.createParentDirectories!==!1),m={owner:r,token:$,acquiredAt:k,ttlSeconds:t};return{release:async()=>{await Ae(d,n,r,$),await x("lock_release",{pm_root:e,id:n,owner:r})},fence:h=>Ge(d,n,m,h)}}catch(k){await Je(k,e,d,n);let m=await y(d);if(await B(m.info,t)){const T=await le({lockPath:d,id:n,ttlSeconds:t,force:a,forceRequiredForStaleLock:o,staleRemovals:j,waitBudgetMs:w,startedAtMs:ue,fallbackLockInfo:m});if(m=T.lockInfo,T.staleRemovalCounted&&(j+=1),T.shouldRetryCreate)continue}const h=D.observe(m.info);if(h.exhausted)throw await re(n,m.info,w===0?0:h.elapsedMs,h.ownerHandoffs);await b(Math.min(N,h.remainingMs)),N=Math.min(N*2,A)}}export{ct as _testOnly,lt as acquireLock,Xe as acquireLockLease,C as acquireStaleCleanupGate,dt as captureProcessIdentity,st as hasUnexpiredLockOwner,wt as isProcessIdentityAlive,mt as readProcessStartIdentity,Pe as recordDeadLockRecovery,Fe as waitForStaleCleanupGate};
|
|
5
5
|
//# sourceMappingURL=lock.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
`).map(
|
|
3
|
-
`)).slice(-
|
|
4
|
-
`)&&
|
|
5
|
-
`:
|
|
1
|
+
import{stripVTControlCharacters as y}from"node:util";const g=6,T=480,S="--full-output",a=["stdout","stderr"];function u(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function O(t,e,s){if(t==="test"){const n=new Set;return h(p(e,s,n),n,"run_results")}return t==="test-all"?A(e,s):e}function A(t,e){if(!u(t)||!Array.isArray(t.results)||!t.results.every(u))return t;const s=new Set,n=t.results.map(o=>p(o,e,s)),r=x(n.filter(o=>Array.isArray(o.run_results)&&o.run_results.length>0)),i={...t,...r===void 0?{}:{execution_context:r},results:r===void 0?n:n.map(o=>{const{execution_context:d,...f}=o;return f})};return h(i,s,"results.run_results")}function p(t,e,s){if(!u(t)||!Array.isArray(t.run_results))return t;const n=t.run_results;if(!n.every(u))return t;const r=C(t,n),i=r&&!e.fullContext,o=r?n.map(c=>E(c,e,s)):n,d=x(o),f=d===void 0?o:o.map(c=>L(c,e,s)),{failure_categories:l,..._}=t;return{...e.lean&&i?_:t,...d===void 0?{}:{execution_context:d},run_results:f}}function E(t,e,s){const n=e.fullOutput?t:b(t,s);return e.fullContext?n:{...n,execution_context:R(n.execution_context)}}function L(t,e,s){const{execution_context:n,stdout:r,stderr:i,...o}=t;if(!e.lean||e.fullOutput||t.status!=="passed"||k(t))return{...o,stdout:r,stderr:i};const{stdout_omitted_bytes:d,stderr_omitted_bytes:f,...l}=o;for(const[_,c]of[["stdout",r],["stderr",i]])typeof c=="string"&&c.length>0&&s.add(_);return l}function x(t){const e=t.map(n=>n.execution_context).filter(n=>n!==void 0);if(e.length!==t.length||e.length===0)return;const s=JSON.stringify(e[0]);return e.every(n=>JSON.stringify(n)===s)?e[0]:void 0}function C(t,e){if(t.ok!==!0||e.length===0)return!1;const s=r=>r.status==="passed"&&u(r.execution_context)&&r.execution_context.mismatch_detected===!1;if(!e.every(s))return!1;const n=t.failure_categories;return!(u(n)&&Object.values(n).some(r=>r!==0))}function R(t){const e=u(t.trust)?t.trust:{};return{pm_context_mode:t.pm_context_mode,workspace_context_mode:t.workspace_context_mode,mismatch_detected:!1,...typeof e.trusted=="boolean"?{trusted:e.trusted}:{},...e.reason===void 0?{}:{trust_reason:e.reason},restore_with:"not retained; a run with --check-context reports the full context"}}function k(t){return m(t)||u(t.execution_context)&&t.execution_context.mismatch_detected===!0}function m(t){const e=t.execution_context;return u(e)?e.trusted===!1||u(e.trust)&&e.trust.trusted===!1:!1}function b(t,e){if(m(t))return t;let s=t;for(const n of a){const r=t[n];if(typeof r!="string")continue;const i=j(r);i!==r&&(e.add(n),s={...s,[n]:i,[`${n}_omitted_bytes`]:Buffer.byteLength(r,"utf8")-Buffer.byteLength(i,"utf8")})}return s}function j(t){if(t.trim().length===0)return t.length<=2?t:"";const e=y(t).split(`
|
|
2
|
+
`).map(r=>r.replace(/\r+$/u,"").split("\r").at(-1).trimEnd()).filter(r=>r.trim().length>0).slice(-g),n=Array.from(e.join(`
|
|
3
|
+
`)).slice(-T).join("");return t.endsWith(`
|
|
4
|
+
`)&&n.length>0?`${n}
|
|
5
|
+
`:n}function h(t,e,s){if(e.size===0||!u(t))return t;const n=u(t.omission_receipt)?t.omission_receipt:{},i=[...Array.isArray(n.omitted_field_groups)?n.omitted_field_groups:[],...a.filter(o=>e.has(o)).map(o=>({name:`${s}.${o}`,restore_with:S}))];return{...t,omission_receipt:{...n,has_omissions:!0,omitted_field_group_count:i.length,omitted_field_groups:i}}}export{S as LINKED_TEST_FULL_OUTPUT_FLAG,T as QUIET_LINKED_TEST_STREAM_TAIL_CHARS,g as QUIET_LINKED_TEST_STREAM_TAIL_LINES,O as projectLinkedTestReply,j as quietStreamTail};
|
|
6
6
|
//# sourceMappingURL=linked-test-projection.js.map
|