@unbrained/pm-cli 2026.11.22 → 2026.11.23
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-2UQU7HRR.js +9 -0
- package/dist/cli-bundle/chunks/chunk-5DUP4AZA.js +2 -0
- package/dist/cli-bundle/chunks/chunk-5WZZ5XEN.js +3 -0
- package/dist/cli-bundle/chunks/chunk-6H36ZHMI.js +2 -0
- package/dist/cli-bundle/chunks/chunk-6MYJLOSG.js +2 -0
- package/dist/cli-bundle/chunks/chunk-AA52P34H.js +3 -0
- package/dist/cli-bundle/chunks/{chunk-B76TFRO2.js → chunk-AEOHUSUI.js} +101 -101
- package/dist/cli-bundle/chunks/chunk-BSRIVYTM.js +8 -0
- package/dist/cli-bundle/chunks/chunk-CFWLQFJM.js +71 -0
- package/dist/cli-bundle/chunks/chunk-D6PDUKUG.js +9 -0
- package/dist/cli-bundle/chunks/chunk-ENKXRSFZ.js +31 -0
- package/dist/cli-bundle/chunks/chunk-F2Z6XLZB.js +3 -0
- package/dist/cli-bundle/chunks/chunk-FJOEL75F.js +2 -0
- package/dist/cli-bundle/chunks/chunk-GDXCAC52.js +2 -0
- package/dist/cli-bundle/chunks/chunk-H7JEXRIN.js +6 -0
- package/dist/cli-bundle/chunks/chunk-J2PDAVBC.js +2 -0
- package/dist/cli-bundle/chunks/chunk-KE7HMBEW.js +2 -0
- package/dist/cli-bundle/chunks/chunk-KZHIBEJL.js +33 -0
- package/dist/cli-bundle/chunks/chunk-NGJ5ERBF.js +115 -0
- package/dist/cli-bundle/chunks/chunk-NQ54T7T2.js +2 -0
- package/dist/cli-bundle/chunks/chunk-O7JHS64G.js +3 -0
- package/dist/cli-bundle/chunks/chunk-OKEZF7HU.js +2 -0
- package/dist/cli-bundle/chunks/chunk-OKIKF4FD.js +2 -0
- package/dist/cli-bundle/chunks/chunk-OPJF254V.js +9 -0
- package/dist/cli-bundle/chunks/chunk-PZA7QECY.js +1 -0
- package/dist/cli-bundle/chunks/chunk-RWA5YZ5X.js +2 -0
- package/dist/cli-bundle/chunks/chunk-S32NGRQM.js +2 -0
- package/dist/cli-bundle/chunks/chunk-SLFRSZK6.js +1 -0
- package/dist/cli-bundle/chunks/chunk-TZY5MVJF.js +125 -0
- package/dist/cli-bundle/chunks/chunk-YYT3MIRF.js +3 -0
- package/dist/cli-bundle/chunks/chunk-ZPS4B6SI.js +8 -0
- package/dist/cli-bundle/chunks/context-budget-recovery-M5RFUEFG.js +2 -0
- package/dist/cli-bundle/chunks/indexed-receipt-blobs-BPYKN5Q7.js +4 -0
- package/dist/cli-bundle/chunks/{item-revision-4QBMZXKX.js → item-revision-FMD4KWBB.js} +2 -2
- package/dist/cli-bundle/chunks/item-transaction-SEHTH7N2.js +2 -0
- package/dist/cli-bundle/chunks/mutation-actor-SFGYIRPW.js +2 -0
- package/dist/cli-bundle/chunks/mutation-admission-57LBSKQI.js +2 -0
- package/dist/cli-bundle/chunks/{register-list-query-RR5KACJ3.js → register-list-query-L4IBU64P.js} +11 -11
- package/dist/cli-bundle/chunks/register-mutation-6NUOPHZ3.js +21 -0
- package/dist/cli-bundle/chunks/register-operations-JGYVORNN.js +2 -0
- package/dist/cli-bundle/chunks/register-setup-C44SIXEH.js +2 -0
- package/dist/cli-bundle/chunks/settlement-hook-6MR32OOC.js +7 -0
- package/dist/cli-bundle/chunks/stage-PQ7AB63N.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-6LKTEKHS.js +6 -0
- package/dist/cli-bundle/focused-chunks/chunk-6LPXMFLM.js +2 -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-BKPUUW5O.js +1 -0
- package/dist/cli-bundle/focused-chunks/chunk-BWOVFE5B.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-HMDQDRV2.js +8 -0
- package/dist/cli-bundle/focused-chunks/chunk-I66IKYKP.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-IIP6LZ5E.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-IR2J3NOT.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-IROZDIDX.js +3 -0
- package/dist/cli-bundle/focused-chunks/chunk-ITKDHSBR.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-K53OIT5J.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-LQYYPXUK.js +26 -0
- package/dist/cli-bundle/focused-chunks/chunk-NQTEE66P.js +13 -0
- package/dist/cli-bundle/focused-chunks/chunk-O7Z73ALG.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-OTMMOKPM.js +91 -0
- package/dist/cli-bundle/focused-chunks/chunk-OXOCZJC6.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-QLAHEDT6.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-QQIIMMFU.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-RIE3SJSE.js +9 -0
- package/dist/cli-bundle/focused-chunks/chunk-TD544C74.js +8 -0
- package/dist/cli-bundle/focused-chunks/chunk-UFTUNBMY.js +27 -0
- package/dist/cli-bundle/focused-chunks/chunk-X6CXWWNB.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-XRS3VNC6.js +44 -0
- package/dist/cli-bundle/focused-chunks/chunk-XYPEZGTR.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-Y2ESLKCF.js +8 -0
- package/dist/cli-bundle/focused-chunks/chunk-YSJKQLFR.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-Z2X7HH3C.js +102 -0
- package/dist/cli-bundle/focused-chunks/chunk-ZHWPCVQL.js +78 -0
- package/dist/cli-bundle/focused-chunks/context-budget-recovery-CSJV3TY3.js +2 -0
- package/dist/cli-bundle/focused-chunks/indexed-receipt-blobs-EGEJMG3G.js +4 -0
- package/dist/cli-bundle/focused-chunks/{item-revision-2O6MLPEX.js → item-revision-YDACCDVY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/item-transaction-UKEQCTKB.js +2 -0
- package/dist/cli-bundle/focused-chunks/mutation-actor-AS465LRX.js +2 -0
- package/dist/cli-bundle/focused-chunks/mutation-admission-E5UHJZFE.js +2 -0
- package/dist/cli-bundle/focused-chunks/settlement-hook-FMLGKG7J.js +7 -0
- package/dist/cli-bundle/focused-chunks/stage-36J7YLGI.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 +12 -12
- 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.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.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/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.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-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 +1 -1
- package/docs/SDK.md +74 -4
- 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-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/sdk/test/runs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{assertInitializedTracker as l}from"../environment/tracker-preflight.js";import w from"node:os";import{EXIT_CODE as c}from"../../core/shared/constants.js";import{PmCliError as d}from"../../core/shared/errors.js";import{readAuthorEnvironment as R}from"../../core/shared/author.js";import{getBackgroundTestRunStatus as g,listBackgroundTestRuns as h,readBackgroundTestRunLogs as T,resumeBackgroundTestRun as k,runBackgroundTestRunWorker as E,spawnBackgroundTestRunWorker as S,startBackgroundTestRun as B,stopBackgroundTestRun as _}from"../../core/test/background-runs.js";import{resolveGlobalPmRoot as x,resolvePmRoot as u}from"../../core/store/paths.js";import{readSettings as m}from"../../core/store/settings.js";import{parseLimit as f}from"../../core/shared/numeric-parsers.js";const y=["queued","running","passed","failed","stopped","canceled"],A=["stdout","stderr","both"];function L(t){if(t===void 0)return;const n=t.trim().toLowerCase();if(y.includes(n))return n;throw new d(`Invalid --status value "${t}"`,c.USAGE)}function U(t){if(t===void 0||t.trim().length===0)return"stderr";const n=t.trim().toLowerCase();if(A.includes(n))return n;throw new d(`Invalid --stream value "${t}"`,c.USAGE)}function I(){try{const t=w.userInfo().username.trim();if(t.length>0)return t}catch{}}function p(t,n){const e=[t,R(),n,process.env.USER,process.env.LOGNAME,process.env.USERNAME,I()];for(const r of e){if(typeof r!="string")continue;const s=r.trim();if(s.length>0)return s}return"unknown"}async function i(t){await l(t)}async function D(t,n){const e=u(process.cwd(),n.path),r=x(process.cwd());await i(e);const s=await m(e),a=p(t.author,s.author_default),o=await B({pmRoot:e,globalPmRoot:r,kind:t.kind,commandArgs:t.commandArgs,requestedBy:a,targetId:t.targetId,statusFilter:t.statusFilter});return o.started?{started:!0,run:await S({pmRoot:e,runId:o.run.id,noExtensions:t.noExtensions===!0})}:{started:!1,duplicate_of:o.duplicate_of,run:o.run}}async function F(t,n){const e=u(process.cwd(),n.path);await i(e);const r=L(t.status),s=f(t.limit,"limit"),a=await h(e,{status:r,limit:s});return{runs:a,count:a.length,filters:{status:r,limit:s}}}async function M(t,n){const e=u(process.cwd(),n.path);await i(e);const r=await g(e,t);return{run:r.run,health:r.health}}async function K(t,n,e){const r=u(process.cwd(),e.path);await i(r);const s=U(n.stream),a=f(n.tail,"tail"),o=await T(r,t,s,a);return{run:o.run,stream:o.stream,tail:o.tail,stdout:o.stdout,stderr:o.stderr}}async function V(t,n,e){const r=u(process.cwd(),e.path);await i(r);const s=await _(r,t,n.force===!0);return{run:s.run,signal_sent:s.signal_sent}}async function $(t,n,e){const r=u(process.cwd(),e.path);await i(r);const s=await m(r),a=p(n.author,s.author_default),o=await k(r,t,a,n.noExtensions===!0);return{resumed_from:t,run:o}}async function X(t,n){const e=u(process.cwd(),n.path);await i(e);const r=await E(e,t,n.noExtensions===!0);return{id:r.id,status:r.status,exit_code:r.exit_code}}export{D as runStartBackgroundRun,F as runTestRunsList,K as runTestRunsLogs,$ as runTestRunsResume,M as runTestRunsStatus,V as runTestRunsStop,X as runTestRunsWorker};
|
|
2
2
|
//# sourceMappingURL=runs.js.map
|
package/dist/sdk/test/trust.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
`),{acknowledged:
|
|
1
|
+
import{execFile as m}from"node:child_process";import{readFile as p}from"node:fs/promises";import u from"node:path";import{promisify as g}from"node:util";import{ensureDir as k,writeFileAtomic as T}from"../../core/fs/fs-utils.js";import{sha256Hex as v,stableStringify as w}from"../../core/shared/serialization.js";import{isTimestampLiteral as h}from"../../core/shared/time.js";import{getRuntimePath as y}from"../../core/store/paths.js";import{assertLinkedTestContext as L}from"./entry.js";const E=g(m),c=1,x="linked-test-trust.json";function s(e){return u.join(y(e),x)}function l(){return{version:c,acknowledged:{}}}async function d(e){try{const n=JSON.parse(await p(s(e),"utf8"));return n.version!==c||typeof n.acknowledged!="object"||n.acknowledged===null||Array.isArray(n.acknowledged)?l():{version:c,acknowledged:n.acknowledged}}catch{return l()}}async function F(e=process.cwd()){const n=process.env.GITHUB_HEAD_REF?.trim()||process.env.GITHUB_REF_NAME?.trim();if(n&&n!=="merge")return n;try{const{stdout:o}=await E("git",["symbolic-ref","--quiet","--short","HEAD"],{cwd:e,encoding:"utf8",windowsHide:!0,timeout:1e4}),r=o.trim();return r.length===0?void 0:r}catch{return}}function O(e=process.cwd()){return process.env.PM_SOURCE_WORKSPACE_ROOT?.trim()||e}function A(e){return e===null||typeof e!="object"?!1:typeof e.author=="string"&&e.author.trim().length>0&&typeof e.created_at=="string"&&h(e.created_at)&&(e.source_kind==="local_mutation"||e.source_kind==="merge_union")}function a(e,n){return{...e?{source_ref:e}:{},...n?{current_source_ref:n}:{}}}function D(e,n,o,r){return e?.map(t=>t.command&&!t.provenance?{...t,provenance:{author:n,created_at:o,source_kind:"local_mutation",...r?{source_ref:r}:{}}}:t)}async function G(e,n,o){if(!e||e.length===0)return e;for(const t of e)L(t);const r=O();return D(e,n,o,await F(r))}function f(e){return v(w({command:e.command??null,path:e.path??null,scope:e.scope,pm_context_mode:e.pm_context_mode??null,workspace_context_mode:e.workspace_context_mode??null,env_set:e.env_set??null,env_clear:e.env_clear??null,shared_host_safe:e.shared_host_safe??null,provenance:e.provenance??null,provenance_invalid:e.provenance_invalid??null}))}async function B(e,n,o){const r=await d(e);return _(n,o,r)}function _(e,n,o){const r=f(e),t=e.provenance?.source_ref;if(e.provenance===void 0&&e.provenance_invalid!==!0)return{fingerprint:r,trusted:!0,reason:"legacy"};const i=Object.hasOwn(o.acknowledged,r);return e.provenance_invalid===!0||!A(e.provenance)?i?{fingerprint:r,trusted:!0,reason:"acknowledged",...a(void 0,n)}:{fingerprint:r,trusted:!1,reason:"invalid_provenance",...a(void 0,n)}:e.provenance.source_kind==="local_mutation"&&t===void 0?{fingerprint:r,trusted:!0,reason:"local_mutation",...a(void 0,n)}:e.provenance.source_kind==="local_mutation"&&t!==void 0&&t===n?{fingerprint:r,trusted:!0,reason:"local_source_ref",source_ref:t,current_source_ref:n}:i?{fingerprint:r,trusted:!0,reason:"acknowledged",...a(t,n)}:{fingerprint:r,trusted:!1,reason:"foreign_source_ref",...a(t,n)}}async function C(e,n,o){const r=await d(e);return n.map(t=>_(t,o,r))}async function K(e,n,o){const r=await d(e),t=n.filter(i=>typeof i.command=="string"&&i.command.length>0).map(f);for(const i of t)r.acknowledged[i]={acknowledged_at:o};return await k(u.dirname(s(e))),await T(s(e),`${JSON.stringify(r,null,2)}
|
|
2
|
+
`),{acknowledged:t.length,fingerprints:t}}export{K as acknowledgeLinkedTests,G as attachLinkedTestMutationProvenance,D as attachLinkedTestProvenance,f as linkedTestTrustFingerprint,F as resolveLinkedTestSourceRef,O as resolveLinkedTestSourceWorkspaceRoot,B as resolveLinkedTestTrust,C as resolveLinkedTestTrustBatch};
|
|
3
3
|
//# sourceMappingURL=trust.js.map
|
package/dist/sdk/test/update.js
CHANGED
|
@@ -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]="f75d72fe-b7f5-576d-b6c1-1cd94e3288b3")}catch{}})();import{getActiveExtensionRegistrations}from"../../core/extensions/index.js";import{resolveItemTypeRegistry}from"../../core/item/type-registry.js";import{normalizeLinkedTest}from"../../core/item/item-format.js";import{parseOnlyIndexValue}from"../../core/test/run-selectors.js";import{resolveAuthor}from"../../core/shared/author.js";import{EXIT_CODE}from"../../core/shared/constants.js";import{PmCliError}from"../../core/shared/errors.js";import{stableValueEquals}from"../../core/shared/serialization.js";import{nowIso}from"../../core/shared/time.js";import{mutateItemWithHistoryContextResolver}from"../../core/store/item-store.js";import{resolvePmRoot}from"../../core/store/paths.js";import{readSettings}from"../../core/store/settings.js";import{assertInitializedTracker}from"../environment/tracker-preflight.js";import{renderPmCommand,resolvePmCommandScopeArgs}from"../command-line.js";import{assertLinkedTestContext,linkedTestsHaveSameIdentity,STRUCTURED_LINKED_TEST_KEYS}from"./entry.js";import{parseLinkedTestJsonEntries}from"./parsers.js";import{assertNoRecursiveTestAllCommand}from"./linked-command-detection.js";const COMMAND_IDENTITY_KEYS=["command","cmd"],EDITABLE_LINKED_TEST_KEYS=Object.freeze(STRUCTURED_LINKED_TEST_KEYS.filter(key=>!["command","cmd","timeout"].includes(key)));function parseLinkedTestUpdateOptions(options){if(options.update===void 0&&options.updateIndex===void 0&&options.setJson===void 0)return;if(options.update===void 0==(options.updateIndex===void 0)||options.setJson===void 0)throw new PmCliError("Use exactly one --update or --update-index with --set-json",EXIT_CODE.USAGE);let patch;try{patch=JSON.parse(options.setJson)}catch{throw new PmCliError("--set-json must contain a JSON object with explicit linked-test metadata fields",EXIT_CODE.USAGE)}if(options.updateIndex!==void 0)return{selector:{index:parseOnlyIndexValue(options.updateIndex,"--update-index")},patch};const value=options.update,prefix=/^(command|path)=/u.exec(value);return{selector:prefix?.[1]==="path"?{path:value.slice(prefix[0].length)}:{command:prefix?value.slice(prefix[0].length):value},patch}}function assertLinkedTestEditUsage(options){if([options.list,options.run,options.progress,options.timeout!==void 0,options.acknowledgeLinkedTests,options.metricBelow!==void 0,options.metricDiff!==void 0,(options.add?.length??0)>0,(options.addJson?.length??0)>0,(options.remove?.length??0)>0,(options.removeIndex?.length??0)>0].some(Boolean))throw new PmCliError("Edit linked-test metadata separately from listing, additions, removals, execution options, metric filters and trust acknowledgement",EXIT_CODE.USAGE)}function selectIndex(tests,selector){if(typeof selector!="object"||selector===null||Array.isArray(selector))throw new PmCliError("Select one linked test by index, command, or path",EXIT_CODE.USAGE);const keys=Object.keys(selector);if(keys.length!==1||!["index","command","path"].includes(keys[0]))throw new PmCliError("Select one linked test by index, command, or path",EXIT_CODE.USAGE);if("index"in selector){const index=parseOnlyIndexValue(selector.index,"--update-index");if(index<=tests.length)return index-1}else{const key="command"in selector?"command":"path",value="command"in selector?selector.command:selector.path;if(typeof value!="string"||value.trim().length===0)throw new PmCliError("Linked-test selector must be a non-empty command or path",EXIT_CODE.USAGE);const matches=tests.flatMap((test,index)=>test[key]===value?[index]:[]);if(matches.length===1)return matches[0];if(matches.length>1)throw new PmCliError(`Linked-test selector is ambiguous; matching indexes: ${matches.map(index=>index+1).join(", ")}`,EXIT_CODE.USAGE,{code:"linked_test_update_ambiguous",required:"List linked tests and select one current --update-index."})}throw new PmCliError("No linked test matched the update selector",EXIT_CODE.NOT_FOUND,{code:"linked_test_update_no_match",required:"List linked tests and select a current command, path, or --update-index."})}function assertEditablePatchFields(patch,allowEmpty){const keys=Object.keys(patch),unsupported=keys.filter(key=>!EDITABLE_LINKED_TEST_KEYS.includes(key));if(keys.length===0&&!allowEmpty||unsupported.length>0)throw new PmCliError("Patch explicit linked-test metadata fields; command, aliases and provenance cannot be edited",EXIT_CODE.USAGE,{code:"linked_test_patch_fields_unsupported",changed:!1,...unsupported.length>0?{field:unsupported[0]}:{},required:`Patch at least one editable field: ${EDITABLE_LINKED_TEST_KEYS.join(", ")}.`,recovery:{allowed_values:[...EDITABLE_LINKED_TEST_KEYS]},...unsupported.length>0?{nextSteps:[`Remove unsupported field(s) from --set-json: ${unsupported.join(", ")}.`]}:{}});if(patch.scope===null)throw new PmCliError("scope is required and cannot be cleared",EXIT_CODE.USAGE)}function buildReplacementEntry(test,patch,command){const entry={};for(const key of EDITABLE_LINKED_TEST_KEYS){const value=patch[key]!==void 0?patch[key]:test[key];value!=null&&(entry[key]=value)}return{command,...entry}}function commandImmutableContext(identityKey){return{field:identityKey,changed:!1,required:"Replace the entry instead: remove the selected linked test and add the new command in one pm test invocation, which records fresh provenance."}}function resolveRequestedCommand(record,identityKey,current){const spellings=COMMAND_IDENTITY_KEYS.filter(key=>Object.hasOwn(record,key)).map(key=>record[key]),requested=typeof record[identityKey]=="string"?record[identityKey].trim():"";if(spellings.length>1&&spellings.some(spelling=>typeof spelling!="string"||spelling.trim()!==requested))throw new PmCliError("--set-json sets command and cmd to different values; send one command",EXIT_CODE.USAGE,{code:"linked_test_command_immutable",...commandImmutableContext(identityKey),nextSteps:["Send the replacement command once, as command."]});if(requested.length===0||requested===current.command)throw new PmCliError(requested.length===0?`--set-json cannot set ${identityKey}: a linked test's command is its immutable identity`:`--set-json ${identityKey} repeats the selected entry's command; omit it to edit only metadata`,EXIT_CODE.USAGE,{code:"linked_test_command_immutable",...commandImmutableContext(identityKey),nextSteps:[`Patch only editable fields: ${EDITABLE_LINKED_TEST_KEYS.join(", ")}.`]});return assertNoRecursiveTestAllCommand(requested),requested}function admitReplacementEntry(params){const{id,tests,index,identityKey,otherFields,requested,global:global2}=params;assertEditablePatchFields(otherFields,!0);const entry=buildReplacementEntry(tests[index],otherFields,requested),candidate=parseLinkedTestJsonEntries(JSON.stringify(entry),"--add-json")[0];assertLinkedTestContext(candidate);const collision=tests.findIndex((test,position)=>position!==index&&linkedTestsHaveSameIdentity(test,candidate));if(collision>=0)throw new PmCliError(`--set-json cannot change ${identityKey}: linked test ${collision+1} already has the requested identity, so a replacement would merge into it`,EXIT_CODE.USAGE,{code:"linked_test_command_immutable",...commandImmutableContext(identityKey),nextSteps:[`Edit linked test ${collision+1} instead: ${renderPmCommand([...resolvePmCommandScopeArgs(global2),"test",id,"--update-index",String(collision+1),"--set-json","<editable fields>"])}`,`Or drop the selected entry: ${renderPmCommand([...resolvePmCommandScopeArgs(global2),"test",id,"--remove-index",String(index+1)])}`]});return entry}function replacementControlArgs(controls){return[...controls.author!==void 0?["--author",controls.author]:[],...controls.message!==void 0?["--message",controls.message]:[],...controls.force===!0?["--force"]:[]]}function assertCommandIdentityUnchanged(params){const{id,tests,index,patch,global:global2,controls}=params;if(typeof patch!="object"||patch===null||Array.isArray(patch))return;const record=patch,identityKey=COMMAND_IDENTITY_KEYS.find(key=>Object.hasOwn(record,key));if(identityKey===void 0)return;const current=tests[index],requested=resolveRequestedCommand(record,identityKey,current),otherFields=Object.fromEntries(Object.entries(record).filter(([key])=>!COMMAND_IDENTITY_KEYS.includes(key))),entry=admitReplacementEntry({id,tests,index,identityKey,otherFields,requested,global:global2}),removal=current.command!==void 0&&tests.filter(test=>test.command===current.command).length===1?["--remove",`command=${current.command}`]:["--remove-index",String(index+1)],retryArgs=[...resolvePmCommandScopeArgs(global2),"test",id,...removal,"--add-json",JSON.stringify(entry),...replacementControlArgs(controls)];throw new PmCliError(`--set-json cannot change ${identityKey}: a linked test's command is its immutable identity; replace the entry instead`,EXIT_CODE.USAGE,{code:"linked_test_command_immutable",...commandImmutableContext(identityKey),recovery:{suggested_retry:renderPmCommand(retryArgs),suggested_retry_args:retryArgs},nextSteps:["Run the suggested retry: it removes the selected entry and adds the new command in one history-recorded write. It selects the entry by its current command or list position, so list the linked tests again first if another writer may have changed them.",`SDK: runTest(${JSON.stringify(id)}, { ${removal[0]==="--remove"?"remove":"removeIndex"}: [...], addJson: [...] }, { path: <the same tracker root> }) with the same values.`]})}function applyPatch(test,patch){if(typeof patch!="object"||patch===null||Array.isArray(patch))throw new PmCliError("Linked-test metadata patch must be a JSON object",EXIT_CODE.USAGE);const keys=Object.keys(patch);assertEditablePatchFields(patch,!1);const metadata=Object.fromEntries(Object.entries(test).filter(([key])=>STRUCTURED_LINKED_TEST_KEYS.includes(key))),parsed=normalizeLinkedTest(parseLinkedTestJsonEntries(JSON.stringify({...metadata,command:test.command??"legacy-path-only",...Object.fromEntries(Object.entries(patch).map(([key,value])=>[key,value===null?void 0:value]))}),"--set-json")[0]);assertLinkedTestContext(parsed);const fields=keys.filter(key=>!stableValueEquals(test[key],parsed[key])),next={...test};for(const key of fields){const value=parsed[key];Object.assign(next,{[key]:value}),value===void 0&&delete next[key]}if(!next.command?.trim()&&!next.path?.trim())throw new PmCliError("Linked-test entry must retain a command or path",EXIT_CODE.USAGE);return{test:next,fields}}async function updateLinkedTest(id,options,global2={}){const pmRoot=resolvePmRoot(process.cwd(),global2.path);await assertInitializedTracker(pmRoot);const settings=await readSettings(pmRoot),author=resolveAuthor(options.author,settings.author_default),typeRegistry=resolveItemTypeRegistry(settings,getActiveExtensionRegistrations());let updatedIndex=0,updatedFields=[];const result=await mutateItemWithHistoryContextResolver({pmRoot,settings,id,author,op:"tests_update",message:options.message,force:options.force,skipNoop:!0,typeToFolder:typeRegistry.type_to_folder,resolveHistoryContext:()=>({linked_test_update:{index:updatedIndex,fields:updatedFields}}),mutate(document){const tests2=document.metadata.tests??[],index=selectIndex(tests2,options.selector);assertCommandIdentityUnchanged({id:document.metadata.id,tests:tests2,index,patch:options.patch,global:global2,controls:options});const patch=applyPatch(tests2[index],options.patch);return updatedIndex=index+1,updatedFields=patch.fields,patch.fields.length===0?{changedFields:[]}:(document.metadata.tests=tests2.map((test,position)=>position===index?{...patch.test,updated_by:author,updated_at:nowIso()}:test),{changedFields:["tests"]})}}),tests=result.item.tests;return{ok:!0,id:result.item.id,tests,count:tests.length,changed:result.changedFields.length>0,updated_index:updatedIndex,updated_fields:updatedFields}}export{EDITABLE_LINKED_TEST_KEYS,assertLinkedTestEditUsage,parseLinkedTestUpdateOptions,updateLinkedTest};
|
|
1
|
+
import{getActiveExtensionRegistrations as I}from"../../core/extensions/index.js";import{resolveItemTypeRegistry as T}from"../../core/item/type-registry.js";import{normalizeLinkedTest as U}from"../../core/item/item-format.js";import{parseOnlyIndexValue as b}from"../../core/test/run-selectors.js";import{resolveAuthor as L}from"../../core/shared/author.js";import{EXIT_CODE as o}from"../../core/shared/constants.js";import{PmCliError as m}from"../../core/shared/errors.js";import{stableValueEquals as N}from"../../core/shared/serialization.js";import{nowIso as G}from"../../core/shared/time.js";import{mutateItemWithHistoryContextResolver as R}from"../../core/store/item-store.js";import{resolvePmRoot as $}from"../../core/store/paths.js";import{readSettings as C}from"../../core/store/settings.js";import{assertInitializedTracker as J}from"../environment/tracker-preflight.js";import{renderPmCommand as k,resolvePmCommandScopeArgs as _}from"../command-line.js";import{assertLinkedTestContext as E,linkedTestsHaveSameIdentity as q,STRUCTURED_LINKED_TEST_KEYS as v}from"./entry.js";import{parseLinkedTestJsonEntries as j}from"./parsers.js";import{assertNoRecursiveTestAllCommand as D}from"./linked-command-detection.js";const S=["command","cmd"],w=Object.freeze(v.filter(e=>!["command","cmd","timeout"].includes(e)));function le(e){if(e.update===void 0&&e.updateIndex===void 0&&e.setJson===void 0)return;if(e.update===void 0==(e.updateIndex===void 0)||e.setJson===void 0)throw new m("Use exactly one --update or --update-index with --set-json",o.USAGE);let t;try{t=JSON.parse(e.setJson)}catch{throw new m("--set-json must contain a JSON object with explicit linked-test metadata fields",o.USAGE)}if(e.updateIndex!==void 0)return{selector:{index:b(e.updateIndex,"--update-index")},patch:t};const a=e.update,n=/^(command|path)=/u.exec(a);return{selector:n?.[1]==="path"?{path:a.slice(n[0].length)}:{command:n?a.slice(n[0].length):a},patch:t}}function ue(e){if([e.list,e.run,e.progress,e.timeout!==void 0,e.acknowledgeLinkedTests,e.metricBelow!==void 0,e.metricDiff!==void 0,(e.add?.length??0)>0,(e.addJson?.length??0)>0,(e.remove?.length??0)>0,(e.removeIndex?.length??0)>0].some(Boolean))throw new m("Edit linked-test metadata separately from listing, additions, removals, execution options, metric filters and trust acknowledgement",o.USAGE)}function F(e,t){if(typeof t!="object"||t===null||Array.isArray(t))throw new m("Select one linked test by index, command, or path",o.USAGE);const a=Object.keys(t);if(a.length!==1||!["index","command","path"].includes(a[0]))throw new m("Select one linked test by index, command, or path",o.USAGE);if("index"in t){const n=b(t.index,"--update-index");if(n<=e.length)return n-1}else{const n="command"in t?"command":"path",d="command"in t?t.command:t.path;if(typeof d!="string"||d.trim().length===0)throw new m("Linked-test selector must be a non-empty command or path",o.USAGE);const s=e.flatMap((c,i)=>c[n]===d?[i]:[]);if(s.length===1)return s[0];if(s.length>1)throw new m(`Linked-test selector is ambiguous; matching indexes: ${s.map(c=>c+1).join(", ")}`,o.USAGE,{code:"linked_test_update_ambiguous",required:"List linked tests and select one current --update-index."})}throw new m("No linked test matched the update selector",o.NOT_FOUND,{code:"linked_test_update_no_match",required:"List linked tests and select a current command, path, or --update-index."})}function A(e,t){const a=Object.keys(e),n=a.filter(d=>!w.includes(d));if(a.length===0&&!t||n.length>0)throw new m("Patch explicit linked-test metadata fields; command, aliases and provenance cannot be edited",o.USAGE,{code:"linked_test_patch_fields_unsupported",changed:!1,...n.length>0?{field:n[0]}:{},required:`Patch at least one editable field: ${w.join(", ")}.`,recovery:{allowed_values:[...w]},...n.length>0?{nextSteps:[`Remove unsupported field(s) from --set-json: ${n.join(", ")}.`]}:{}});if(e.scope===null)throw new m("scope is required and cannot be cleared",o.USAGE)}function P(e,t,a){const n={};for(const d of w){const s=t[d]!==void 0?t[d]:e[d];s!=null&&(n[d]=s)}return{command:a,...n}}function x(e){return{field:e,changed:!1,required:"Replace the entry instead: remove the selected linked test and add the new command in one pm test invocation, which records fresh provenance."}}function Y(e,t,a){const n=S.filter(s=>Object.hasOwn(e,s)).map(s=>e[s]),d=typeof e[t]=="string"?e[t].trim():"";if(n.length>1&&n.some(s=>typeof s!="string"||s.trim()!==d))throw new m("--set-json sets command and cmd to different values; send one command",o.USAGE,{code:"linked_test_command_immutable",...x(t),nextSteps:["Send the replacement command once, as command."]});if(d.length===0||d===a.command)throw new m(d.length===0?`--set-json cannot set ${t}: a linked test's command is its immutable identity`:`--set-json ${t} repeats the selected entry's command; omit it to edit only metadata`,o.USAGE,{code:"linked_test_command_immutable",...x(t),nextSteps:[`Patch only editable fields: ${w.join(", ")}.`]});return D(d),d}function z(e){const{id:t,tests:a,index:n,identityKey:d,otherFields:s,requested:c,global:i}=e;A(s,!0);const r=P(a[n],s,c),l=j(JSON.stringify(r),"--add-json")[0];E(l);const u=a.findIndex((h,f)=>f!==n&&q(h,l));if(u>=0)throw new m(`--set-json cannot change ${d}: linked test ${u+1} already has the requested identity, so a replacement would merge into it`,o.USAGE,{code:"linked_test_command_immutable",...x(d),nextSteps:[`Edit linked test ${u+1} instead: ${k([..._(i),"test",t,"--update-index",String(u+1),"--set-json","<editable fields>"])}`,`Or drop the selected entry: ${k([..._(i),"test",t,"--remove-index",String(n+1)])}`]});return r}function B(e){return[...e.author!==void 0?["--author",e.author]:[],...e.message!==void 0?["--message",e.message]:[],...e.force===!0?["--force"]:[]]}function H(e){const{id:t,tests:a,index:n,patch:d,global:s,controls:c}=e;if(typeof d!="object"||d===null||Array.isArray(d))return;const i=d,r=S.find(g=>Object.hasOwn(i,g));if(r===void 0)return;const l=a[n],u=Y(i,r,l),h=Object.fromEntries(Object.entries(i).filter(([g])=>!S.includes(g))),f=z({id:t,tests:a,index:n,identityKey:r,otherFields:h,requested:u,global:s}),p=l.command!==void 0&&a.filter(g=>g.command===l.command).length===1?["--remove",`command=${l.command}`]:["--remove-index",String(n+1)],y=[..._(s),"test",t,...p,"--add-json",JSON.stringify(f),...B(c)];throw new m(`--set-json cannot change ${r}: a linked test's command is its immutable identity; replace the entry instead`,o.USAGE,{code:"linked_test_command_immutable",...x(r),recovery:{suggested_retry:k(y),suggested_retry_args:y},nextSteps:["Run the suggested retry: it removes the selected entry and adds the new command in one history-recorded write. It selects the entry by its current command or list position, so list the linked tests again first if another writer may have changed them.",`SDK: runTest(${JSON.stringify(t)}, { ${p[0]==="--remove"?"remove":"removeIndex"}: [...], addJson: [...] }, { path: <the same tracker root> }) with the same values.`]})}function K(e,t){if(typeof t!="object"||t===null||Array.isArray(t))throw new m("Linked-test metadata patch must be a JSON object",o.USAGE);const a=Object.keys(t);A(t,!1);const n=Object.fromEntries(Object.entries(e).filter(([i])=>v.includes(i))),d=U(j(JSON.stringify({...n,command:e.command??"legacy-path-only",...Object.fromEntries(Object.entries(t).map(([i,r])=>[i,r===null?void 0:r]))}),"--set-json")[0]);E(d);const s=a.filter(i=>!N(e[i],d[i])),c={...e};for(const i of s){const r=d[i];Object.assign(c,{[i]:r}),r===void 0&&delete c[i]}if(!c.command?.trim()&&!c.path?.trim())throw new m("Linked-test entry must retain a command or path",o.USAGE);return{test:c,fields:s}}async function fe(e,t,a={}){const n=$(process.cwd(),a.path);await J(n);const d=await C(n),s=L(t.author,d.author_default),c=T(d,I());let i=0,r=[];const l=await R({pmRoot:n,settings:d,id:e,author:s,op:"tests_update",message:t.message,force:t.force,skipNoop:!0,typeToFolder:c.type_to_folder,resolveHistoryContext:()=>({linked_test_update:{index:i,fields:r}}),mutate(h){const f=h.metadata.tests??[],p=F(f,t.selector);H({id:h.metadata.id,tests:f,index:p,patch:t.patch,global:a,controls:t});const y=K(f[p],t.patch);return i=p+1,r=y.fields,y.fields.length===0?{changedFields:[]}:(h.metadata.tests=f.map((g,O)=>O===p?{...y.test,updated_by:s,updated_at:G()}:g),{changedFields:["tests"]})}}),u=l.item.tests;return{ok:!0,id:l.item.id,tests:u,count:u.length,changed:l.changedFields.length>0,updated_index:i,updated_fields:r}}export{w as EDITABLE_LINKED_TEST_KEYS,ue as assertLinkedTestEditUsage,le as parseLinkedTestUpdateOptions,fe as updateLinkedTest};
|
|
2
2
|
//# sourceMappingURL=update.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{cp as E,lstat as j,mkdir as b,readlink as D,realpath as v,stat as _,symlink as g}from"node:fs/promises";import{execFile as x}from"node:child_process";import e from"node:path";import{promisify as C}from"node:util";import{seedSnapshotReceiptIndex as L}from"./receipt-index-snapshot.js";import{isFileMissingError as k}from"../../core/fs/fs-utils.js";const A=new Set([".agents",".git",".nyc_output",".turbo","coverage"]),m=C(x);async function H(i,t){const r=await p(e.join(i,".git"));if(!r||r.isDirectory()&&!await p(e.join(i,".git/HEAD")))return!1;const a=Object.fromEntries(Object.entries(process.env).filter(([o])=>!o.toUpperCase().startsWith("GIT_")));await m("git",["clone","--no-local","--no-checkout","--template=","--origin=origin","--",i,t],{env:a,timeout:12e4,maxBuffer:1024*1024,windowsHide:!0}),await m("git",["-C",t,"remote","remove","origin"],{env:a,timeout:1e4,windowsHide:!0});try{await m("git",["-C",t,"rev-parse","--verify","--quiet","HEAD"],{env:a,timeout:1e4,windowsHide:!0})}catch(o){if(o.code===1)return!0;throw o}return await m("git",["-C",t,"read-tree","HEAD"],{env:a,timeout:1e4,windowsHide:!0}),!0}async function T(i,t,r,a){await H(i,t)&&r&&a!==!1&&await L(i,t,r)}function h(i){return i.split(e.sep).some(t=>A.has(t.toLowerCase()))}function w(i){return i===".."||i.startsWith(`..${e.sep}`)||e.isAbsolute(i)}async function p(i){try{return await _(i)}catch(t){if(!k(t))throw t;return}}async function y(i){const t=[];let r=i;for(;e.dirname(r)!==r;)try{return e.join(await v(r),...t)}catch(a){if(!k(a))throw a;t.unshift(e.basename(r)),r=e.dirname(r)}return e.join(await v(r),...t)}async function I(i,t,r){const a=e.relative(t,await y(i));if(!w(a))return a;const o=[];let c=i;for(;e.dirname(c)!==c;){const s=await y(c),d=r.find(([,n])=>n===s);if(d)return e.join(d[0],...o);o.unshift(e.basename(c)),c=e.dirname(c)}return a}async function U(i,t,r,a){const o=[],c=[],s=await v(i),d=await y(e.resolve(t));if(![e.relative(s,d),e.relative(d,s)].every(w))throw new Error("Snapshot destination must be disjoint from the source workspace; choose a temporary root outside the checkout.");await b(e.dirname(t),{recursive:!0}),await T(s,t,r,a),await E(s,t,{recursive:!0,force:!0,async filter(n){const u=e.relative(s,n);if(!u)return!0;if(h(u))return!1;if(e.basename(n).toLowerCase()==="node_modules"){if((await p(n))?.isDirectory()){const f=await y(n),l=e.relative(s,f);if(!w(e.relative(f,s))||!w(l)&&(h(l)||!l.split(e.sep).some(S=>S.toLowerCase()==="node_modules")))throw new Error(`Dependency symlink must target an included dependency directory or external installation: ${u}`);o.push([u,f])}return!1}return(await j(n)).isSymbolicLink()?(c.push([u,e.resolve(e.dirname(n),await D(n)),(await p(n))?.isDirectory()?"junction":"file"]),!1):!0}});for(const[n]of o)await g(e.resolve(s,n),e.join(t,n),"junction");for(const[n,u,f]of c){const l=await I(u,s,o);if(w(l)||h(l))throw new Error(`Source symlink must target included workspace source: ${n}`);await g(e.resolve(t,l),e.join(t,n),f)}}export{U as seedLinkedTestWorkspaceSnapshot};
|
|
2
2
|
//# sourceMappingURL=workspace-snapshot.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{parseSourceLineRange as i}from"./source-traceability.js";function a(e,r,l){let n;if(typeof e.lines=="string")n=i(e.lines);else if(e.lineRange!==void 0){if(e.lineRange===null||typeof e.lineRange!="object"||Array.isArray(e.lineRange))throw new RangeError("Source line range must be an object with numeric start and end values.");n=i(`${String(Reflect.get(e.lineRange,"start"))}:${String(Reflect.get(e.lineRange,"end"))}`)}return{paths:r,scope:e.scope==="project"||e.scope==="global"?e.scope:void 0,limit:l(e.limit,"files lookup limit"),offset:l(e.offset,"files lookup offset"),noTruncate:e.noTruncate===!0,strictRead:e.strictRead===!0,explain:e.explain===!0,lineRange:n,decisionDepth:l(e.decisionDepth,"files lookup decision depth")}}export{a as runtimeFilesLookupOptions};
|
|
2
2
|
//# sourceMappingURL=runtime-files-lookup.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
`)){const
|
|
1
|
+
import{execFile as _}from"node:child_process";import l from"node:path";import{assembleWorkspaceRelationshipGraph as v}from"../graph/assembly.js";function m(e,t){return new Promise((n,i)=>{_("git",[...t],{cwd:e,encoding:"utf8",maxBuffer:4*1024*1024},(s,o)=>{s?i(s):n(o)})})}function f(e){if(e&&(!Number.isSafeInteger(e.start)||!Number.isSafeInteger(e.end)||e.start<1||e.end<e.start))throw new RangeError("Source line range must be inclusive positive integers with end >= start.")}function M(e){const t=/^(\d+):(\d+)$/u.exec(e.trim()),n=t?{start:Number(t[1]),end:Number(t[2])}:void 0;if(f(n),!n)throw new RangeError("Source line range must use start:end.");return n}function h(e){const t=new Map;for(const n of e.split(`
|
|
2
|
+
`)){const i=/^([0-9a-f^]{40,64}) \d+ \d+(?: \d+)?$/u.exec(n)?.[1];i&&t.set(i,(t.get(i)??0)+1)}return t}function g(e){const t=e.split("\0"),n=new Map;for(let i=0;i+1<t.length;i+=2){const s=t[i]?.trim();if(!s)continue;const o=[...new Set(t[i+1]?.match(/\bpm-[a-z0-9][a-z0-9-]{2,63}\b/gu)??[])].sort((c,r)=>c.localeCompare(r));n.set(s,o)}return n}async function R(e){const t=l.relative(e.workspaceRoot,l.resolve(e.workspaceRoot,e.sourcePath)),n=await m(e.workspaceRoot,["blame","--line-porcelain","-L",`${e.lineRange.start},${e.lineRange.end}`,"--",t]),i=await m(e.workspaceRoot,["log","-n","256","--format=%H%x00%B%x00","--",t]);return{commitLines:h(n),commitItems:g(i),available:!0}}function k(e){const t=e.current.nodes.at(-1),n=e.current.kinds.length+1;let i;for(const s of e.graph.incidentEdges(t)){const o=s.source===t,c=o?s.target:s.source;if((e.visitedDepth.get(c)??Number.POSITIVE_INFINITY)<n)continue;e.visitedDepth.set(c,n);const r=e.graph.registry().require(s.kind),a={nodes:[...e.current.nodes,c],kinds:[...e.current.kinds,o?s.kind:r.inverse??s.kind]};e.details.get(c)?.type?.toLowerCase()==="decision"?(i=n,e.found.push(a)):e.queue.push(a)}return i}function x(e){const t=[{nodes:[e.itemId],kinds:[]}],n=new Map([[e.itemId,0]]),i=[];let s;for(;t.length>0;){const o=t.shift(),c=o.kinds.length;s!==void 0&&c>=s||c>=e.maxDepth||(s=k({current:o,graph:e.graph,details:e.details,visitedDepth:n,queue:t,found:i})??s)}return i.sort((o,c)=>o.nodes.join("\0").localeCompare(c.nodes.join("\0"))),i}function p(e,t,n){const i=v(t);if(!i.graph.hasNode(e))return{status:"not_found",nodes:[],kinds:[],alternative_decision_ids:[]};const s=x({itemId:e,maxDepth:n,graph:i.graph,details:new Map(i.details.map(r=>[r.id,r]))}),o=s[0];if(!o)return{status:"not_found",nodes:[],kinds:[],alternative_decision_ids:[]};const c=[...new Set(s.map(r=>r.nodes.at(-1)))];return{status:c.length===1?"found":"ambiguous",nodes:o.nodes,kinds:o.kinds,alternative_decision_ids:c.slice(1)}}async function I(e){if(!e.lineRange)return{commitLines:new Map,commitItems:new Map,available:!0};try{return await R({workspaceRoot:e.workspaceRoot,sourcePath:e.paths[0],lineRange:e.lineRange})}catch{return{commitLines:new Map,commitItems:new Map,available:!1}}}function L(e){const t=[];return e.hasLineRange&&!e.attributionAvailable&&t.push("git_attribution_unavailable"),e.hasLineRange&&e.contributionLines===0&&t.push("line_attribution_unmapped"),e.decisionStatus==="ambiguous"&&t.push("multiple_governing_decisions"),e.decisionStatus==="not_found"&&t.push("governing_decision_not_found"),t}function b(e){return[...e.commitLines.keys()].filter(t=>(e.commitItems.get(t)?.length??0)>0)}async function P(e){f(e.lineRange);const t=e.decisionDepth??8;if(!Number.isSafeInteger(t)||t<1||t>32)throw new RangeError("Decision path depth must be an integer from 1 to 32.");const n=await I(e),i=b(n),s=new Map;for(const o of e.candidates){const c=[...n.commitLines.entries()].filter(([u])=>n.commitItems.get(u)?.includes(o.item.id)),r=c.reduce((u,[,d])=>u+d,0),a=p(o.item.id,e.corpus,t),w=L({hasLineRange:e.lineRange!==void 0,attributionAvailable:n.available,contributionLines:r,decisionStatus:a.status});s.set(o.item.id,{score:r*100+o.files.length*10+Math.max(0,9-Math.floor((Date.now()-Date.parse(o.item.updated_at))/(720*60*60*1e3))),contribution_lines:r,evidence:[...o.files.map(u=>({kind:"linked_file",reference:u.path})),...c.map(([u,d])=>({kind:"git_commit",reference:u.slice(0,12),contribution_lines:d}))],rationale:{value:o.item.value?.trim()||null,why_now:o.item.why_now?.trim()||null,outcome:o.item.outcome?.trim()||null,objective:o.item.objective?.trim()||null},decision_path:a,ambiguities:w})}return{explanations:s,receipt:{line_range:e.lineRange??null,blamed_commit_count:n.commitLines.size,mapped_commit_count:i.length,unmapped_commit_count:n.commitLines.size-i.length,decision_depth:t}}}const N={mappedBlamedCommits:b,parseBlameCommits:h,parseCommitItemReferences:g,shortestDecisionPath:p};export{N as _testOnlySourceTraceability,P as explainSourceTraceability,M as parseSourceLineRange};
|
|
3
3
|
//# sourceMappingURL=source-traceability.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{discoverNearbyPmRoot as e}from"../core/store/paths.js";export{e as discoverNearbyPmRoot};
|
|
2
2
|
//# sourceMappingURL=tracker-root-discovery.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{getActiveExtensionRegistrations as E}from"../../core/extensions/index.js";import{collectRegisteredItemFieldNames as _}from"../../core/extensions/item-fields.js";import{canonicalDocument as l,parseItemDocument as $,serializeItemDocument as F}from"../../core/item/item-format.js";import{EXIT_CODE as O}from"../../core/shared/constants.js";import{PmCliError as b}from"../../core/shared/errors.js";import{stableStringify as m}from"../../core/shared/serialization.js";import{pruneResolvedDeferredFields as A}from"../../core/item/deferred-fields.js";import{mutateItem as I}from"../../core/store/item-store.js";import{readSettings as T}from"../../core/store/settings.js";const j=["id","updated_at","pm_format_version","type"],S="import";function p(e,t){if(typeof e!="string"||!/^[A-Za-z][A-Za-z0-9_]*$/u.test(e)||e in Object.prototype)throw new TypeError(`${t} names an invalid field ${JSON.stringify(e)}; use a front-matter field name of letters, digits and underscores`);if(j.includes(e))throw new TypeError(`${t} cannot change "${e}"; the item writer derives it, or an update row owns it`)}function u(e){return Array.isArray(e)?`array of ${e.length}`:typeof e}const z=["__proto__","constructor","prototype"];function y(e){return e!==null&&typeof e=="object"&&Object.getPrototypeOf(e)===Object.prototype}function h(e){return e===null||typeof e=="string"||typeof e=="boolean"?!0:typeof e=="number"?Number.isFinite(e):Array.isArray(e)?Array.from(e).every(h):y(e)?Object.entries(e).every(([t,o])=>!z.includes(t)&&h(o)):!1}function N(e,t){const{set:o,unset:d}=e;if(o!==void 0&&!y(o))throw new TypeError(`${t} set must be a plain object of front-matter fields`);if(d!==void 0&&!Array.isArray(d))throw new TypeError(`${t} unset must be an array of front-matter field names`);const i=Object.keys(o??{}),s=d??[];if(i.length+s.length===0)throw new TypeError(`${t} requires at least one field in set or unset`);for(const n of i)if(p(n,t),o[n]===null||!h(o[n]))throw new TypeError(`${t} set "${n}" must be a non-null JSON value (no undefined, non-finite number, sparse array, class instance, or __proto__/constructor/prototype key); remove a field with unset`);for(const n of s){if(p(n,t),n==="body"||n==="front_matter")throw new TypeError(`${t} cannot unset "${n}"; the item format reserves that name`);if(i.includes(n))throw new TypeError(`${t} both sets and unsets "${n}"`)}if(new Set(s).size!==s.length)throw new TypeError(`${t} unset repeats a field`)}async function J(e){N(e,`Finalization of ${e.id}`);const t=await T(e.pmRoot),o={schema:t.schema,extensionFieldNames:_(E())},d=await I({pmRoot:e.pmRoot,settings:t,id:e.id,op:S,author:e.author,message:e.message,force:e.force===!0,extensionFieldNames:o.extensionFieldNames,mutate:i=>{const s=structuredClone(i.metadata),n=i.metadata;for(const[r,c]of Object.entries(e.set??{}))n[r]=structuredClone(c);for(const r of e.unset??[])delete n[r];let a;try{A(i.metadata);const r=l(i,o),c=l($(F(r,o),o),o);if(m(c)!==m(r))throw new TypeError("the stored item reads back as a different document; a set field collides with a name the item format reserves");a=r.metadata;const f=Object.entries(e.set??{}).find(([w,g])=>u(a[w])!==u(g));if(f!==void 0)throw new TypeError(`set "${f[0]}" is not stored as declared (${u(f[1])} normalizes to ${a[f[0]]===void 0?"an absent field":u(a[f[0]])})`)}catch(r){throw new b(`Finalization of ${e.id} would not store a readable item with the declared fields: ${r.message}`,O.USAGE,{code:"finalization_invalid_document",item_id:e.id,required:"Declare set and unset fields that leave a valid item under the workspace schema, with each set value in the shape its field stores.",why:"A finalization writes front-matter fields exactly, so the patched document is read back through the item reader, and each declared value is checked against what would be stored, before anything is written.",nextSteps:[`Run pm get ${e.id} --json to compare the current fields with the finalization, then correct the patch and retry the transaction.`]})}return{changedFields:[...new Set([...Object.keys(s),...Object.keys(a)])].filter(r=>Object.hasOwn(s,r)!==Object.hasOwn(a,r)||m(s[r])!==m(a[r])).sort((r,c)=>r.localeCompare(c))}}});return{item:d.item,changedFields:d.changedFields}}export{S as FINALIZATION_HISTORY_OPERATION,j as FINALIZATION_RESERVED_FIELDS,J as applyItemFinalization,N as assertValidItemFinalization,h as isJournalValue};
|
|
2
2
|
//# sourceMappingURL=item-finalization.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
const i=50,e=new Map;function c(){e.clear()}function C(t,r){const s=e.get(t);if(s!==void 0)return s;if(e.size>=50){const o=e.keys().next().value;e.delete(o)}const n=r().catch(o=>{throw e.get(t)===n&&e.delete(t),o});return e.set(t,n),n}export{c as clearWorkspaceContractsCache,C as memoizeWorkspaceExtensionRegistrations};
|
|
2
2
|
//# sourceMappingURL=workspace-contracts-cache.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{runtimeFieldOptionTarget as t}from"../core/schema/runtime-schema.js";function m(a){return a.map(e=>({key:e.key,optionName:t(e),metadataKey:e.metadata_key,type:e.type,commands:[...e.commands],repeatable:e.repeatable,requiredOnCreate:e.required_on_create,...e.description?{description:e.description}:{}}))}function p(a){return a.map(e=>({command:e.command,action:e.action,arguments:e.arguments.map(r=>({name:r.name,required:r.required===!0,variadic:r.variadic===!0,description:r.description})),description:e.description,tier:e.tier??"standard",family:e.family??"extensions"}))}export{p as buildWorkspaceExtensionCommandContracts,m as buildWorkspaceFieldContracts};
|
|
2
2
|
//# sourceMappingURL=workspace-contracts.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
`)}catch{
|
|
1
|
+
import h from"node:path";import{createHash as y}from"node:crypto";import{isFileAbsentError as g,writeFileAtomic as k}from"../core/fs/fs-utils.js";import{normalizeStatusForRegistry as w}from"../core/item/status.js";import{stableStringify as M}from"../core/shared/serialization.js";import{readItemMetadataDerivedIndexState as b}from"../core/store/item-metadata-cache.js";import{resolveCompletionTimestamp as S}from"./lifecycle-completion.js";import C from"node:fs/promises";const f=1,R=1e4,_=12;function I(t){const e=new Date(t);return`${e.getUTCFullYear()}-Q${Math.floor(e.getUTCMonth()/3)+1}`}function x(t,e){const s=new Set;let n=t.parent;for(;n&&!s.has(n);){s.add(n);const r=e.get(n);if(!r)return;if(r.type.toLowerCase()==="epic")return r;n=r.parent}}function A(t){const e=[...t.items].sort((r,o)=>o.completion.timestamp.localeCompare(r.completion.timestamp)||r.item.id.localeCompare(o.item.id)),s=new Set;let n=0;for(const{item:r}of e){const o=r.resolution??r.close_reason;o?.trim()&&s.add(o.trim()),n+=(r.notes?.length??0)+(r.learnings?.length??0)}return{kind:t.kind,key:t.key,label:t.label,item_count:e.length,first_closed_at:e.at(-1).completion.timestamp,last_closed_at:e[0].completion.timestamp,representative_items:e.slice(0,5).map(({item:{id:r,title:o}})=>({id:r,title:o})),outcomes:[...s].sort().slice(0,5),knowledge_entries:n}}function W(t,e){if(!e.sourceCursor.trim())throw new TypeError("Workspace memory source cursor must be non-empty");if(!Number.isFinite(Date.parse(e.now)))throw new TypeError("Workspace memory clock must be a valid timestamp");const s=t.filter(o=>e.statusRegistry.terminal_done_statuses.has(w(o.status,e.statusRegistry))).map(o=>{const a=S(o);if(!a.resolved)throw new TypeError(`Completed item ${o.id} has no reporting timestamp`);return{item:o,completion:a}}),n=new Map(t.map(o=>[o.id,o])),r=new Map;for(const o of s){const{item:a,completion:i}=o,c=I(i.timestamp),u=`epoch:${c}`,p=r.get(u)??{kind:"epoch",key:c,label:c,items:[]};p.items.push(o),r.set(u,p);const l=x(a,n);if(l){const m=`epic:${l.id}`,d=r.get(m)??{kind:"epic",key:l.id,label:l.title,items:[]};d.items.push(o),r.set(m,d)}}return{format_version:f,source_cursor:e.sourceCursor,source_item_count:t.length,generated_at:e.now,completion_time_sources:s.reduce((o,{completion:a})=>(o[a.source]+=1,o),{completed_at:0,closed_at:0,updated_at:0}),rollups:[...r.values()].map(A).sort((o,a)=>a.last_closed_at.localeCompare(o.last_closed_at)||o.kind.localeCompare(a.kind)||o.key.localeCompare(a.key))}}function E(t){return typeof t=="object"&&t!==null&&"id"in t&&typeof t.id=="string"&&t.id.length>0&&"title"in t&&typeof t.title=="string"}function v(t){if(typeof t!="object"||t===null)return!1;const e=t,s=[e.key,e.label].every(r=>typeof r=="string"&&r.length>0),n=[e.first_closed_at,e.last_closed_at].every(r=>typeof r=="string"&&Number.isFinite(Date.parse(r)));return(e.kind==="epoch"||e.kind==="epic")&&s&&Number.isSafeInteger(e.item_count)&&e.item_count>0&&n&&Array.isArray(e.representative_items)&&e.representative_items.every(E)&&Array.isArray(e.outcomes)&&e.outcomes.every(r=>typeof r=="string")&&Number.isSafeInteger(e.knowledge_entries)&&e.knowledge_entries>=0}function F(t){if(typeof t!="object"||t===null||Array.isArray(t))return null;const e=t;return e.format_version!==f||typeof e.source_cursor!="string"||!e.source_cursor.trim()||!Number.isSafeInteger(e.source_item_count)||e.source_item_count<0||typeof e.generated_at!="string"||!Number.isFinite(Date.parse(e.generated_at))||!Array.isArray(e.rollups)?null:e.rollups.every(v)?e:null}function O(t){return`scan:${y("sha256").update(M(t.map(e=>[e.id,e.updated_at,e.status,e.parent]).sort(([e],[s])=>String(e).localeCompare(String(s))))).digest("hex")}`}async function N(t,e,s){return s!==void 0?s:(await b(e))?.source_cursor??O(t)}async function T(t){try{const e=F(JSON.parse(await C.readFile(t,"utf8")));return{snapshot:e,invalid:e===null}}catch(e){return{snapshot:null,invalid:!(typeof e=="object"&&e!==null&&"code"in e&&g(e))}}}async function z(t,e){const s=Math.max(1,Math.floor(e.minimumItems??R));if(t.length<s)return{snapshot:null,cache_status:"skipped",warnings:[]};const n=await N(t,e.pmRoot,e.sourceCursor),r=h.join(e.pmRoot,"runtime","workspace-memory.json"),o=[],a=await T(r),i=a.snapshot;if(a.invalid&&o.push("workspace_memory_invalid"),i?.source_cursor===n&&i.source_item_count===t.length)return{snapshot:i,cache_status:"fresh",warnings:o};i&&o.push("workspace_memory_stale");const c=W(t,{statusRegistry:e.statusRegistry,sourceCursor:n,now:e.now});try{await k(r,`${JSON.stringify(c)}
|
|
2
|
+
`)}catch{o.push("workspace_memory_write_failed")}return{snapshot:c,cache_status:"rebuilt",warnings:o}}function L(t,e,s=_){const n=Math.max(0,Math.floor(e));let r=0;const o=[];for(const a of t.rollups){if(o.length>=Math.max(0,Math.floor(s)))break;const i=Math.ceil(JSON.stringify(a).length/4);r+i>n||(o.push(a),r+=i)}return o}function q(t,e,s=_){if(t.snapshot===null)return;const n=L(t.snapshot,e,s);if(n.length!==0)return{cache_status:t.cache_status==="fresh"?"fresh":"rebuilt",source_cursor:t.snapshot.source_cursor,...t.snapshot.completion_time_sources?{completion_time_sources:{...t.snapshot.completion_time_sources}}:{},rollups:n}}function j(t,e,s=5){if(t===null)return[];const n=e.trim().toLowerCase().split(/\s+/u).filter(Boolean);return n.length===0?[]:t.rollups.map(r=>({rollup:r,score:n.filter(o=>[r.key,r.label,...r.outcomes,...r.representative_items.flatMap(a=>[a.id,a.title])].join(" ").toLowerCase().includes(o)).length})).filter(({score:r})=>r>0).sort((r,o)=>o.score-r.score||o.rollup.last_closed_at.localeCompare(r.rollup.last_closed_at)||r.rollup.key.localeCompare(o.rollup.key)).slice(0,Math.max(0,Math.floor(s))).map(({rollup:r})=>r)}function H(t,e,s=5){const n=j(t.snapshot,e,s);if(n.length!==0)return{cache_status:t.cache_status==="fresh"?"fresh":"rebuilt",matches:n}}export{R as DEFAULT_WORKSPACE_MEMORY_MINIMUM_ITEMS,W as buildWorkspaceMemorySnapshot,z as readWorkspaceMemory,j as searchWorkspaceMemory,H as searchWorkspaceMemoryReadResult,q as selectWorkspaceMemory,L as selectWorkspaceMemoryRollups};
|
|
3
3
|
//# sourceMappingURL=workspace-memory.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
`)}finally{await
|
|
3
|
-
`).filter(
|
|
4
|
-
`,"utf8"),await
|
|
5
|
-
`,"utf8"),await
|
|
1
|
+
import k from"node:crypto";import{cp as F,lstat as te,mkdir as d,readFile as y,readdir as x,rename as I,rm as W,writeFile as v}from"node:fs/promises";import a from"node:path";import{isFileMissingError as g,writeFileAtomic as re}from"../core/fs/fs-utils.js";import{appendWorkspaceAuditEvent as se}from"../core/history/workspace-history.js";import{acquireLockLease as ne,waitForStaleCleanupGate as ae}from"../core/lock/lock.js";import{getLockPath as O}from"../core/store/paths.js";import{EXIT_CODE as S}from"../core/shared/constants.js";import{PmCliError as j}from"../core/shared/errors.js";import{withHostEnvironmentBoundary as oe}from"./environment/host-environment-errors.js";const H="https://schema.unbrained.dev/pm/workspace-snapshot/v1",xe=["create","list","inspect","restore","delete"],D=a.join("runtime","workspace-snapshots"),ie=new Set(["checkpoints","locks","runtime","search","transactions"]),ce=/^[a-z0-9][a-z0-9._-]*$/,_="sdk-workspace-transaction",T={capacity:{code:"workspace_snapshot_storage_exhausted"},permission:{code:"workspace_snapshot_permission_denied"},resource:{code:"workspace_snapshot_resource_exhausted"}},$={renameEntry:I,removeEntry:async t=>{await W(t,{recursive:!0,force:!0})}};class R{lockPath;owner;intervalMs;timer;refresh;failure;constructor(e,r,s){this.lockPath=e,this.owner=r,this.intervalMs=Math.max(10,Math.floor(s*1e3/3))}start(){this.scheduleRenewal(),this.timer=setInterval(()=>{this.scheduleRenewal()},this.intervalMs),this.timer.unref()}async refreshNow(){this.scheduleRenewal(),await this.refresh,this.assertHealthy()}assertHealthy(){if(this.failure!==void 0)throw new Error("Workspace snapshot restore lost its writer lock",{cause:this.failure})}async stop(){this.timer!==void 0&&clearInterval(this.timer),await this.refresh,this.assertHealthy()}scheduleRenewal(){this.refresh!==void 0||this.failure!==void 0||(this.refresh=this.renew().catch(e=>{this.failure=e}).finally(()=>{this.refresh=void 0}))}async renew(){const e=await ae(this.lockPath,_);if(e===null)throw new Error("Workspace writer lock cleanup gate stayed held");try{const r=JSON.parse(await y(this.lockPath,"utf8"));if(typeof r!="object"||r===null||Array.isArray(r))throw new Error("Workspace writer lock has invalid structure");const s=r;if(s.id!==_||s.owner!==this.owner||s.pid!==process.pid)throw new Error("Workspace writer lock ownership changed");await re(this.lockPath,`${JSON.stringify({...s,created_at:new Date().toISOString()},null,2)}
|
|
2
|
+
`)}finally{await e()}}}const We={WorkspaceLockHeartbeat:R,withSnapshotFilesystemGuard:N};async function q(t,e=""){const r=await x(a.join(t,e),{withFileTypes:!0}),s=[];for(const n of r.sort((c,h)=>c.name.localeCompare(h.name))){if(e.length===0&&ie.has(n.name))continue;const c=a.posix.join(e.replaceAll(a.sep,"/"),n.name);if(n.isSymbolicLink())throw new Error(`Workspace snapshots reject symbolic links: ${c}`);if(n.isDirectory())s.push(...await q(t,c));else if(n.isFile())s.push(c);else throw new Error(`Workspace snapshots reject unsupported filesystem entries: ${c}`)}return s}async function G(t){const e=await q(t),r=k.createHash("sha256"),s=[];let n=0;for(const h of e){const i=await y(a.join(t,h));s.push(i),n+=i.byteLength,r.update(h),r.update("\0"),r.update(String(i.byteLength)),r.update("\0"),r.update(i)}const c=r.digest("hex");return{manifest:{schema:H,fingerprint:c,files:e,bytes:n},contents:s}}function J(t){return t===void 0||t.byteLength===0?0:t.toString("utf8").split(`
|
|
3
|
+
`).filter(e=>e.trim().length>0).length}async function he(t,e){const r=new Map;for(let s=0;s<e.length;s+=32){const n=e.slice(s,s+32),c=await Promise.all(n.map(async h=>[h,await y(a.join(t,h))]));for(const[h,i]of c)r.set(h,i)}return r}function A(t){if(!ce.test(t))throw new j("Snapshot names and fingerprints must use lowercase letters, digits, dots, underscores, or hyphens",S.USAGE,{code:"invalid_workspace_snapshot_target",required:"Provide a non-empty lowercase snapshot name or 64-character hexadecimal fingerprint.",why:"Snapshot targets are used as portable reference filenames and content identities.",examples:["pm workspace snapshot list --json","pm workspace snapshot inspect baseline --json"],nextSteps:["List available snapshots, then retry with a returned name or fingerprint."],recovery:{suggested_retry:"pm workspace snapshot list --json"}})}async function N(t,e){return oe(`workspace_snapshot_${t}`,e,{codes:{capacity:T.capacity.code,permission:T.permission.code,resource:T.resource.code},why:"Snapshot create and restore copy authoritative tracker state before activation, so the stage needs capacity and write access up front.",nextSteps:["Reclaim rebuildable tracker cache space with pm gc, then retry."],suggestedRetry:"pm gc --json"})}function m(t){return a.join(t,D)}function K(t){return new j(`Unknown workspace snapshot: ${t}`,S.NOT_FOUND,{code:"workspace_snapshot_not_found",required:"Use a snapshot name or fingerprint returned by snapshot list.",why:"The requested reference or immutable snapshot object does not exist.",examples:["pm workspace snapshot list --json"],nextSteps:["List available snapshots and retry with an exact target."],recovery:{suggested_retry:"pm workspace snapshot list --json"}})}async function z(t,e){try{return JSON.parse(await y(t,"utf8"))}catch(r){throw g(r)?K(e):r}}async function X(t,e,r){try{await W(t,{recursive:r})}catch(s){throw g(s)?K(e):s}}async function pe(t,e,r=$){try{return await r.renameEntry(t,e),!1}catch(s){if(!(s instanceof Error&&"code"in s&&(s.code==="EEXIST"||s.code==="ENOTEMPTY")))throw s;return await r.removeEntry(t),!0}}async function B(t,e,r,s,n){await s.renameEntry(e,r);try{await s.renameEntry(t,e),await n?.()}catch(c){throw await s.renameEntry(r,e),await s.removeEntry(t),c}await s.removeEntry(r)}async function Oe(t,e,r,s=$){await B(t,e,r,s)}async function fe(t,e){return A(e),/^[a-f0-9]{64}$/.test(e)?e:(await z(a.join(m(t),"refs",`${e}.json`),e)).fingerprint}async function le(t,e={}){if(e.name!==void 0&&(A(e.name),/^[a-f0-9]{64}$/.test(e.name)))throw new j("Snapshot names must not be 64-character lowercase hexadecimal fingerprints",S.USAGE,{code:"workspace_snapshot_name_reserved_fingerprint",required:"Choose a human-readable reference name that cannot be mistaken for a content fingerprint.",why:"Exact 64-character hexadecimal values address immutable objects.",examples:["pm workspace snapshot create baseline --json"],nextSteps:["Retry with a shorter descriptive snapshot name."]});const{manifest:r,contents:s}=await G(t),n=m(t),c=a.join(n,"objects",r.fingerprint);let h=!1;try{h=(await te(c)).isDirectory()}catch(i){if(!(i instanceof Error&&"code"in i&&g(i)))throw i}if(!h){const i=a.join(n,"objects",`.create-${process.pid}-${k.randomUUID()}`);await N("create_object",async()=>{await d(a.join(i,"files"),{recursive:!0});for(const[l,p]of r.files.entries()){const u=a.join(i,"files",p);await d(a.dirname(u),{recursive:!0}),await v(u,s[l])}await v(a.join(i,"manifest.json"),`${JSON.stringify(r,null,2)}
|
|
4
|
+
`,"utf8"),await d(a.dirname(c),{recursive:!0})}),h=await pe(i,c)}if(e.name!==void 0){const i={name:e.name,fingerprint:r.fingerprint},l=a.join(n,"refs");await d(l,{recursive:!0});const p=a.join(l,`.ref-${process.pid}-${k.randomUUID()}`);await v(p,`${JSON.stringify(i,null,2)}
|
|
5
|
+
`,"utf8"),await I(p,a.join(l,`${e.name}.json`))}return{manifest:r,...e.name===void 0?{}:{name:e.name},deduplicated:h}}async function P(t,e){const r=await fe(t,e),s=await z(a.join(m(t),"objects",r,"manifest.json"),e);if(s.schema!==H||s.fingerprint!==r)throw new j(`Snapshot manifest identity mismatch: ${e}`,S.CONFLICT,{code:"workspace_snapshot_manifest_mismatch",required:"Use an intact snapshot whose manifest fingerprint matches its object path.",why:"Content identity must be verified before snapshot data is trusted.",examples:["pm workspace snapshot list --json"],nextSteps:["Inspect or recreate the snapshot before restoring it."]});return s}async function ue(t){const e=m(t),r=await x(a.join(e,"objects")).catch(n=>{if(n instanceof Error&&"code"in n&&g(n))return[];throw n}),s=await x(a.join(e,"refs")).catch(n=>{if(n instanceof Error&&"code"in n&&g(n))return[];throw n});return{objects:await Promise.all(r.filter(n=>/^[a-f0-9]{64}$/.test(n)).sort().map(n=>P(t,n))),references:await Promise.all(s.filter(n=>n.endsWith(".json")).sort().map(async n=>JSON.parse(await y(a.join(e,"refs",n),"utf8"))))}}async function we(t,e){const r=await P(t,e),{manifest:s,contents:n}=await G(t),c=new Map(s.files.map((o,f)=>[o,n[f]])),h=await he(a.join(m(t),"objects",r.fingerprint,"files"),r.files),i=new Set(s.files),l=new Set(r.files),p=new Set([...i,...l]);for(const o of p){const f=c.get(o),w=h.get(o);f!==void 0&&w!==void 0&&f.equals(w)&&p.delete(o)}const u=s.files.filter(o=>o.startsWith("history/")&&o.endsWith(".jsonl")).map(o=>{const f=J(c.get(o)),w=J(h.get(o));return{path:o,current_entries:f,target_entries:w,removed_entries:Math.max(0,f-w)}}).filter(o=>o.removed_entries>0).sort((o,f)=>o.path.localeCompare(f.path));return{target_fingerprint:r.fingerprint,current_fingerprint:s.fingerprint,changed_file_count:p.size,removed_file_count:[...i].filter(o=>!l.has(o)).length,added_file_count:[...l].filter(o=>!i.has(o)).length,removed_item_count:[...i].filter(o=>o.endsWith(".toon")&&!l.has(o)).length,affected_history_stream_count:u.length,removed_history_entry_count:u.reduce((o,f)=>o+f.removed_entries,0),affected_history_streams:u,changes_authoritative_state:s.fingerprint!==r.fingerprint}}async function de(t,e,r={}){if(r.force!==!0)throw new j("Workspace snapshot restore requires explicit force confirmation; inspect the impact with planWorkspaceSnapshotRestore or pm workspace snapshot restore <target> --dry-run, then retry with force",S.USAGE,{code:"workspace_snapshot_force_required",required:"Preview the destructive impact, then explicitly confirm the restore.",why:"A restore replaces the complete authoritative tracker state.",examples:[`pm workspace snapshot restore ${e} --dry-run --json`,`pm workspace snapshot restore ${e} --force --json`],nextSteps:["Review the dry-run counts before retrying with --force."],recovery:{suggested_retry:`pm workspace snapshot restore ${e} --dry-run --json`}});const s=r.author?.trim()||"pm-sdk",n=r.lockTtlSeconds??60,c=r.lockWaitMs??5e3,h=await ne(t,_,n,s,!1,!1,c),i=h.release,l=new R(O(t,_),s,n);l.start(),await l.refreshNow();let p,u=!1,o=!1;try{const f=await we(t,e),w=await P(t,e),b=await le(t),E=w.fingerprint,C=m(t),Y=a.join(C,"objects",E,"files"),L=a.dirname(t),M=a.basename(t);p=a.join(L,`.${M}.restore-${k.randomUUID()}`);const Q=a.join(L,`.${M}.backup-${k.randomUUID()}`);await N("restore_stage",async()=>{await d(p,{recursive:!0}),await F(Y,p,{recursive:!0,force:!1}),await d(a.join(p,"runtime"),{recursive:!0}),await F(C,a.join(p,D),{recursive:!0,force:!1})});const V=await se({pmRoot:p,op:"workspace_snapshot_restore",author:s,message:r.message??`Restore workspace snapshot ${E}; recovery snapshot ${b.manifest.fingerprint}`,context:{target_fingerprint:E,pre_restore_fingerprint:b.manifest.fingerprint,changed_file_count:f.changed_file_count,removed_file_count:f.removed_file_count,removed_item_count:f.removed_item_count,affected_history_stream_count:f.affected_history_stream_count,removed_history_entry_count:f.removed_history_entry_count},lockTtlSeconds:n,lockWaitMs:c}),Z=a.relative(p,V.historyPath).replaceAll("\\","/");await l.stop(),o=!0;const U=O(p,_),ee=p;return await h.fence(async()=>{await d(a.dirname(U),{recursive:!0}),await v(U,await y(O(t,_)),{flag:"wx"}),u=!0,await B(ee,t,Q,$,async()=>{l.start(),o=!1,await l.refreshNow()})}),await l.stop(),o=!0,{manifest:w,plan:f,recovery_fingerprint:b.manifest.fingerprint,audit_history_path:Z,audit_operation:"workspace_snapshot_restore"}}catch(f){throw p!==void 0&&!u&&await Promise.allSettled([W(p,{recursive:!0,force:!0})]),f}finally{try{o||await l.stop()}catch{}finally{await i()}}}async function Te(t,e){return(await de(t,e,{force:!0,message:"Restore requested through the compatibility SDK signature"})).manifest}async function $e(t,e){A(e);const r=m(t);if(!/^[a-f0-9]{64}$/.test(e))return await X(a.join(r,"refs",`${e}.json`),e,!1),{deleted:"reference",target:e};const{references:s}=await ue(t);if(s.some(n=>n.fingerprint===e))throw new Error(`Snapshot object ${e} is still referenced`);return await X(a.join(r,"objects",e),e,!0),{deleted:"object",target:e}}export{H as SNAPSHOT_SCHEMA,xe as WORKSPACE_SNAPSHOT_ACTIONS,We as _testOnlyWorkspaceSnapshot,le as createWorkspaceSnapshot,$e as deleteWorkspaceSnapshot,P as inspectWorkspaceSnapshot,ue as listWorkspaceSnapshots,we as planWorkspaceSnapshotRestore,pe as publishWorkspaceSnapshotObject,Te as restoreWorkspaceSnapshot,de as restoreWorkspaceSnapshotWithRecovery,Oe as swapWorkspaceSnapshotRoot};
|
|
6
6
|
//# sourceMappingURL=workspace-snapshot.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{isFileMissingError as y}from"../core/fs/fs-utils.js";import f from"node:fs/promises";import h from"node:path";const w=1440*60*1e3,A=new Set(["committed","compensated"]);function M(n){let e;try{e=JSON.parse(n)}catch{return{status:null,updatedAt:null}}if(typeof e!="object"||e===null||Array.isArray(e))return{status:null,updatedAt:null};const r=e;return{status:r.abandonment!==void 0?"abandoned":typeof r.status=="string"?r.status:null,updatedAt:typeof r.updatedAt=="string"?r.updatedAt:null}}function g(n,e,r,t,i){const u=r===null?Number.NaN:Date.parse(r);if(e===null||!Number.isFinite(u))return{entry:{file:n,status:e,age_seconds:null,stale:!1,reason:"unparseable"},remove:!1};const s=t-u;return A.has(e)?s>i?{entry:{file:n,status:e,age_seconds:Math.floor(s/1e3),stale:!0},remove:!0}:{entry:{file:n,status:e,age_seconds:Math.floor(s/1e3),stale:!1,reason:"fresh"},remove:!1}:{entry:{file:n,status:e,age_seconds:Math.floor(s/1e3),stale:!1,reason:"active"},remove:!1}}async function k(n,e,r,t){const i=t.hooks?.onRead?await t.hooks.onRead(n):[],u=M(await f.readFile(n,"utf8")),s=g(e,u.status,u.updatedAt,t.nowMs,t.retentionMs);return s.entry.reason==="unparseable"&&i.push(`transaction_journal_unparseable:${r}`),s.remove&&!t.dryRun&&(await f.rm(n,{force:!0}),t.hooks?.onWrite&&i.push(...await t.hooks.onWrite(n))),{decision:s,warnings:i}}async function R(n,e){const{dryRun:r,hooks:t}=e,i=e.now??Date.now(),u=Math.max(0,e.retentionDays)*w,s=h.join(n,"transactions","sdk"),o={scanned:0,removed:[],retained:[],warnings:[],entries:[]};let p;try{p=(await f.readdir(s)).filter(a=>a.endsWith(".json")).sort((a,c)=>a.localeCompare(c))}catch(a){if(y(a))return o;throw a}for(const a of p){const c=h.join(s,a),l=`transactions/sdk/${a}`,m=await k(c,l,a,{dryRun:r,hooks:t,nowMs:i,retentionMs:u});o.warnings.push(...m.warnings),o.scanned+=1;const{decision:d}=m;if(!d.remove){o.retained.push(l),o.entries.push(d.entry);continue}o.removed.push(l),o.entries.push(d.entry)}return o}export{R as runWorkspaceTransactionGc};
|
|
2
2
|
//# sourceMappingURL=workspace-transaction-gc.js.map
|