@unbrained/pm-cli 2026.10.3 → 2026.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +28 -2
- 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.d.ts +1 -1
- package/dist/cli/commander-usage.js +7 -4
- 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 +3 -1
- package/dist/cli/extension-command-help.js +5 -3
- package/dist/cli/extension-command-options.js +1 -1
- package/dist/cli/extension-recovery.js +1 -1
- package/dist/cli/help-content.js +5 -2
- package/dist/cli/help-json-payload.js +6 -3
- 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/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 +1 -1
- package/dist/cli/register-mutation.js +2 -2
- 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/invocation-options.js +1 -1
- package/dist/cli/runtime/projection-retry.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.d.ts +1 -1
- package/dist/cli/runtime-compatibility-boundary.js +4 -4
- package/dist/cli/schema/registration.js +2 -2
- 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 +162 -162
- package/dist/cli-bundle/chunks/chunk-3CYOBJUK.js +3 -0
- package/dist/cli-bundle/chunks/chunk-5MNOWZPN.js +3 -0
- package/dist/cli-bundle/chunks/chunk-AJ7H6XUF.js +20 -0
- package/dist/cli-bundle/chunks/chunk-D332RXZ7.js +80 -0
- package/dist/cli-bundle/chunks/chunk-HRJ6G6ZG.js +31 -0
- package/dist/cli-bundle/chunks/chunk-KRVI56QE.js +6 -0
- package/dist/cli-bundle/chunks/chunk-N4YGSG6F.js +238 -0
- package/dist/cli-bundle/chunks/chunk-OOLYASYJ.js +2 -0
- package/dist/cli-bundle/chunks/chunk-R7CG2DB7.js +2 -0
- package/dist/cli-bundle/chunks/chunk-TGMONGWX.js +2 -0
- package/dist/cli-bundle/chunks/chunk-UZ7BIUCI.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-44UGMMQ6.js → chunk-VZ63DEVJ.js} +3 -3
- package/dist/cli-bundle/chunks/chunk-WFZ4UEOB.js +2 -0
- package/dist/cli-bundle/chunks/chunk-YVBRASXO.js +8 -0
- package/dist/cli-bundle/chunks/{chunk-5XKF5SQV.js → chunk-Z66DWDAU.js} +91 -91
- package/dist/cli-bundle/chunks/{register-list-query-DYCGUQEW.js → register-list-query-75QXHIFH.js} +11 -11
- package/dist/cli-bundle/chunks/register-mutation-YS54SCHG.js +20 -0
- package/dist/cli-bundle/chunks/register-operations-6KHZQSYJ.js +2 -0
- package/dist/cli-bundle/chunks/register-setup-RTATEN2M.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-3BIYG72P.js → chunk-2CVX3KR3.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-5C3IDDW7.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-DBD4W4QP.js → chunk-ABV67XCC.js} +3 -3
- package/dist/cli-bundle/focused-chunks/chunk-B5RSLVE6.js +3 -0
- package/dist/cli-bundle/focused-chunks/chunk-C224METM.js +20 -0
- package/dist/cli-bundle/focused-chunks/chunk-CLDPTMQY.js +6 -0
- package/dist/cli-bundle/focused-chunks/chunk-DDRN42PB.js +8 -0
- package/dist/cli-bundle/focused-chunks/{chunk-EJN7DY3B.js → chunk-DOVTUKJQ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-ECBOPEJE.js +75 -0
- package/dist/cli-bundle/focused-chunks/chunk-GITOYRUW.js +165 -0
- package/dist/cli-bundle/focused-chunks/chunk-GUIF3WVC.js +30 -0
- package/dist/cli-bundle/focused-chunks/chunk-LE4JUCRR.js +3 -0
- package/dist/cli-bundle/focused-chunks/{chunk-HFAW3FJQ.js → chunk-PSXFFQFT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-RHIH6XIW.js +12 -0
- package/dist/cli-bundle/focused-chunks/chunk-UDYRVBOZ.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-XV5RV4ZT.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-XRSCIYHR.js → chunk-YMU42COG.js} +2 -2
- package/dist/cli-bundle/main.js +28 -28
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +2 -2
- package/dist/cli-bundle/sdk-core.js +32 -32
- 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 +55 -55
- 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 +10 -10
- 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/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 -1
- 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.d.ts +8 -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/preflight-ownership.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/fs/atomic-create.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/digest.js +1 -1
- package/dist/core/history/drift-cache.js +3 -3
- package/dist/core/history/drift-scan.d.ts +4 -0
- 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 +8 -7
- 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 -1
- 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 -1
- package/dist/core/item/actionability.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 +6 -4
- package/dist/core/item/item-record.js +1 -1
- package/dist/core/item/item-type-definition.js +1 -1
- package/dist/core/item/parent-reference-policy.js +1 -1
- package/dist/core/item/parse.js +8 -2
- 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-gc.js +1 -1
- package/dist/core/lock/lock.js +3 -3
- package/dist/core/output/mutation-projection.js +1 -1
- package/dist/core/output/output-control.js +1 -1
- package/dist/core/output/output.js +22 -10
- package/dist/core/output/query-summary.js +1 -1
- package/dist/core/output/tabular.js +3 -1
- 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.js +1 -1
- package/dist/core/profile/profile-plan.js +1 -1
- package/dist/core/profile/profile-presets.js +25 -1
- 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/session/session-state.js +1 -1
- package/dist/core/shared/agent-session-context.js +1 -1
- package/dist/core/shared/author.js +5 -1
- package/dist/core/shared/command-line.js +1 -1
- package/dist/core/shared/command-types.js +1 -1
- package/dist/core/shared/conflict-markers.js +1 -1
- package/dist/core/shared/constants.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/primitives.js +1 -1
- package/dist/core/shared/secret-rules.js +1 -1
- 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 -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 +7 -7
- package/dist/core/store/item-metadata-read-work.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-validator.js +1 -1
- package/dist/core/store/settings.d.ts +11 -2
- package/dist/core/store/settings.js +3 -3
- package/dist/core/store/tracker-preflight.js +1 -1
- package/dist/core/telemetry/consent.js +2 -2
- 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 -5
- package/dist/core/test/background-runs.js +3 -3
- 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 +6 -4
- 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/refusal-closure-census.js +2 -1
- package/dist/sdk/agent/refusal-closure.js +1 -1
- package/dist/sdk/agent/refusal-corpus-contracts.js +1 -1
- package/dist/sdk/agent/refusal-reachability.js +3 -1
- package/dist/sdk/agent/subcommand-recovery.js +1 -1
- package/dist/sdk/agent/task-transcript-contracts.js +1 -1
- package/dist/sdk/agent/tracker-preflight-contracts.js +1 -1
- package/dist/sdk/agent-capability-contracts.js +3 -1
- 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/authoring.js +1 -1
- package/dist/sdk/cli-bootstrap.js +1 -1
- package/dist/sdk/cli-contracts/agent-output-contracts.js +5 -3
- 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 -1
- 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 +1 -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 -1
- package/dist/sdk/completion/fish.js +13 -7
- package/dist/sdk/completion/shared.js +1 -1
- package/dist/sdk/completion/zsh.js +14 -8
- package/dist/sdk/completion.js +1 -1
- package/dist/sdk/compose.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 -3
- 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/contracts.js +1 -1
- package/dist/sdk/core-governance.js +1 -1
- package/dist/sdk/core.js +1 -1
- package/dist/sdk/corpus-shape.js +1 -1
- package/dist/sdk/define.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/agent-environment.js +1 -1
- package/dist/sdk/environment/host-environment-errors.js +1 -1
- package/dist/sdk/environment/project-runtime-compatibility.js +2 -1
- 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/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 +4 -2
- 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/migrations.js +2 -2
- 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 -4
- 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 +1 -1
- 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/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 +1 -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/coverage-assurance.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 +1 -1
- package/dist/sdk/governance/extension-host-version.js +1 -1
- package/dist/sdk/governance/gc.js +1 -1
- package/dist/sdk/governance/health-merge-evidence.js +1 -1
- package/dist/sdk/governance/health.js +2 -1
- package/dist/sdk/governance/hierarchy-validation.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 -1
- package/dist/sdk/governance/reindex.js +5 -4
- 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-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 -1
- package/dist/sdk/governance.js +1 -1
- package/dist/sdk/graph/adapter.js +1 -1
- 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/centrality.js +1 -1
- package/dist/sdk/graph/conformance.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/index.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/graph.js +1 -1
- package/dist/sdk/guide-topics.js +1 -1
- package/dist/sdk/guide.js +8 -1
- package/dist/sdk/history/attestation-command.js +1 -1
- 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/salvage.js +3 -2
- package/dist/sdk/history/subject.js +1 -1
- package/dist/sdk/history-analytics.js +1 -1
- package/dist/sdk/history-compact.js +1 -1
- package/dist/sdk/history-mcp.js +1 -1
- package/dist/sdk/history-provenance.js +1 -1
- package/dist/sdk/history-read.js +1 -1
- package/dist/sdk/history-redact.js +1 -1
- package/dist/sdk/history-repair.js +1 -1
- package/dist/sdk/improvement-ledger-validation.js +1 -1
- package/dist/sdk/improvement-ledger.js +2 -2
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/init-agent-guidance.js +16 -2
- package/dist/sdk/init.js +16 -2
- 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 +4 -2
- package/dist/sdk/lifecycle/claim.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/create.js +1 -1
- package/dist/sdk/lifecycle/delete.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/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 +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/reopen.js +1 -1
- package/dist/sdk/lifecycle/repeatable-metadata-parsers.js +2 -1
- package/dist/sdk/lifecycle/restore.js +1 -1
- package/dist/sdk/lifecycle/shared-unset-fields.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 -1
- package/dist/sdk/lifecycle-completion.js +1 -1
- package/dist/sdk/lifecycle-policy.js +1 -1
- package/dist/sdk/linked-artifacts.js +2 -1
- package/dist/sdk/mcp/apps.js +1 -1
- package/dist/sdk/mcp/authorization.js +1 -1
- package/dist/sdk/mcp/discovery.js +1 -1
- package/dist/sdk/mcp/interactions.js +1 -1
- package/dist/sdk/mcp/protocol.js +1 -1
- package/dist/sdk/mcp/skills.js +3 -1
- 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 +1 -1
- package/dist/sdk/merge/index.js +1 -1
- package/dist/sdk/merge/install.js +4 -2
- 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/three-way.js +3 -2
- package/dist/sdk/merge/worktree-config.js +1 -1
- 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-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 -1
- 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 -1
- 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 -1
- package/dist/sdk/query/complete-list.js +1 -1
- package/dist/sdk/query/context.js +2 -1
- package/dist/sdk/query/duplicate-candidates.js +1 -1
- package/dist/sdk/query/get.d.ts +14 -2
- package/dist/sdk/query/get.js +1 -1
- package/dist/sdk/query/history.js +1 -1
- package/dist/sdk/query/item-filter-options.js +1 -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-ready-budget.js +1 -1
- package/dist/sdk/query/next.js +2 -1
- 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 -1
- 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 -2
- package/dist/sdk/query/search/types.js +1 -1
- package/dist/sdk/query/search-contracts.js +1 -1
- package/dist/sdk/query/search-pagination.d.ts +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/workspace-contracts.js +1 -1
- package/dist/sdk/query.js +1 -1
- package/dist/sdk/read-output/continuation.js +1 -1
- package/dist/sdk/read-output/options.js +1 -1
- package/dist/sdk/read-output/provenance.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 +7 -4
- package/dist/sdk/relationship-kinds/contract.js +1 -1
- package/dist/sdk/relationship-migration.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/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.js +1 -1
- package/dist/sdk/runtime-primitives.js +1 -1
- package/dist/sdk/runtime-public-contracts.js +1 -1
- package/dist/sdk/runtime-stats-options.js +1 -1
- package/dist/sdk/runtime.js +1 -1
- package/dist/sdk/scheduling-shortcuts.js +1 -1
- package/dist/sdk/schema-migration.js +4 -3
- package/dist/sdk/schema.js +7 -1
- 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 -3
- package/dist/sdk/templates.js +26 -2
- package/dist/sdk/test/batch.js +2 -2
- package/dist/sdk/test/entry.js +1 -1
- package/dist/sdk/test/execution.js +6 -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/runs.js +1 -1
- package/dist/sdk/test/trust.js +2 -2
- package/dist/sdk/test/workspace-snapshot.js +1 -1
- package/dist/sdk/testing.js +7 -4
- package/dist/sdk/traceability/runtime-files-lookup.js +1 -1
- package/dist/sdk/traceability/source-traceability.js +2 -1
- package/dist/sdk/tracker-root-discovery.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-recipe.js +1 -1
- package/dist/sdk/workspace-snapshot.js +5 -4
- package/dist/sdk/workspace-transaction-gc.js +1 -1
- package/dist/sdk/workspace-transaction.js +2 -2
- package/dist/sdk/workspace.js +3 -2
- package/dist/types/index.js +1 -1
- package/dist/types.js +1 -1
- package/docs/AGENT_EVIDENCE_CONSISTENCY.md +88 -0
- package/docs/DIAGNOSTIC_OUTPUT_CONTRACTS.md +25 -0
- package/docs/GET_READ_EVIDENCE.md +68 -0
- package/docs/OUTPUT_PROJECTION_CONTRACTS.md +23 -0
- package/docs/README.md +2 -0
- package/docs/SDK_AUDITED_MUTATIONS.md +35 -0
- package/docs/TESTING.md +8 -0
- package/docs/ecosystem-review-2026-09-28.json +2864 -3157
- package/marketplace.json +2 -2
- package/package.json +1 -1
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-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/extensions/vcs/index.ts +4 -2
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/package.json +2 -2
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +2 -2
- package/plugins/pm-codex/plugin.json +1 -1
- package/scripts/finalize-build.mjs +3 -2
- package/dist/cli-bundle/chunks/chunk-3AF2R3Y6.js +0 -6
- package/dist/cli-bundle/chunks/chunk-6ST3SCQ6.js +0 -2
- package/dist/cli-bundle/chunks/chunk-6Z4IV2MC.js +0 -8
- package/dist/cli-bundle/chunks/chunk-DEZPZOQ7.js +0 -2
- package/dist/cli-bundle/chunks/chunk-FW5LJXQY.js +0 -31
- package/dist/cli-bundle/chunks/chunk-H2DZW6I6.js +0 -3
- package/dist/cli-bundle/chunks/chunk-H7CXQBGQ.js +0 -2
- package/dist/cli-bundle/chunks/chunk-KP7NBQK3.js +0 -80
- package/dist/cli-bundle/chunks/chunk-MKXBCBAN.js +0 -20
- package/dist/cli-bundle/chunks/chunk-QPKQKSQU.js +0 -238
- package/dist/cli-bundle/chunks/chunk-SGFQQXFD.js +0 -2
- package/dist/cli-bundle/chunks/chunk-YCBGZF3T.js +0 -2
- package/dist/cli-bundle/chunks/chunk-YDWKGUQU.js +0 -3
- package/dist/cli-bundle/chunks/register-mutation-5PT3NW3A.js +0 -20
- package/dist/cli-bundle/chunks/register-operations-QDDQOAAV.js +0 -2
- package/dist/cli-bundle/chunks/register-setup-BBX67YMA.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-4FFPGNCJ.js +0 -6
- package/dist/cli-bundle/focused-chunks/chunk-73DA7ISY.js +0 -75
- package/dist/cli-bundle/focused-chunks/chunk-E754JDLY.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-FKK2HI3S.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-GMYUNHST.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-HIA2ZF64.js +0 -12
- package/dist/cli-bundle/focused-chunks/chunk-UTRSM3ZK.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-VVWYI2X7.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-WAJNX4RN.js +0 -20
- package/dist/cli-bundle/focused-chunks/chunk-WCY6HRZO.js +0 -30
- package/dist/cli-bundle/focused-chunks/chunk-YC32ZSLS.js +0 -165
- package/dist/cli-bundle/focused-chunks/chunk-ZIXFMIUL.js +0 -3
package/dist/sdk/learnings.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
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]="f7317758-33fb-52ee-a94b-1b97c4920773")}catch{}})();import{parseAnnotationTextInput,resolveAnnotationInput,runAnnotationCommand}from"./annotations.js";async function runLearnings(id,options,global2){return runAnnotationCommand(id,options,global2,{input:await resolveAnnotationInput(options,"learning"),collectionKey:"learnings",op:"learning_add",editOp:"learning_edit",deleteOp:"learning_delete",parseText:raw=>parseAnnotationTextInput(raw),createEntry:entry=>entry,bypassOwnershipConflict:!!(options.edit===void 0&&options.delete===void 0&&options.ownershipAppendBypass),conflictGuidance:{required:"Strict ownership also protects annotations. Ask the current owner to run pm release <id>, then run pm claim <id>; use --force only for an explicitly approved override.",examples:["pm claim <id>"],nextSteps:["For an approved append without reassignment: pm package install governance-audit --project; then pm learnings --help lists the package-owned append bypass. Edit/delete still require ownership.","For a non-terminal handoff, the current owner runs pm release <id>; then you run pm claim <id> before retrying. Claim refuses work still held by another owner; --force requires an explicitly approved override."]}})}export{runLearnings};
|
|
2
2
|
//# sourceMappingURL=learnings.js.map
|
|
@@ -1,3 +1,5 @@
|
|
|
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]="a5bdc2e7-1633-5bc8-97c7-8f6ecd253294")}catch{}})();import{assertInitializedTracker}from"../environment/tracker-preflight.js";import{EXIT_CODE,PmCliError,resolveAuthor,toItemRecord,createStdinTokenResolver,shouldResolveMutationStdinTokenField,mutateItem,resolvePmRoot,readSettings}from"../runtime-primitives.js";async function runAppend(id,options,global2){if(options.body===void 0)throw new PmCliError("Missing required --body text",EXIT_CODE.USAGE);const stdinResolver=createStdinTokenResolver(),pmRoot=resolvePmRoot(process.cwd(),global2.path);await assertInitializedTracker(pmRoot);const settings=await readSettings(pmRoot),author=resolveAuthor(options.author,settings.author_default),appended=(await stdinResolver.resolveValue(options.body,"--body",shouldResolveMutationStdinTokenField(options,"body"))).trim();if(appended.length===0)throw new PmCliError("--body text cannot be empty; append requires non-blank content and empty appends would only rewrite updated_at.",EXIT_CODE.USAGE,{code:"append_empty_body",required:"Provide non-empty body text positionally, via --body, or with - for stdin.",examples:['pm append pm-a1b2 --body "Progress note"',"pm append pm-a1b2 --body -"]});const result=await mutateItem({pmRoot,settings,id,op:"append",author,message:options.message,force:options.force,mutate(document){const spacer=document.body.trim().length>0?`
|
|
2
|
+
|
|
3
|
+
`:"";return document.body=`${document.body.trimEnd()}${spacer}${appended}
|
|
4
|
+
`,{changedFields:["body"]}}});return{item:toItemRecord(result.item),appended,changed_fields:result.changedFields}}export{runAppend};
|
|
3
5
|
//# sourceMappingURL=append.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
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]="ce03100c-3a4f-5ce4-a216-a3fabcfc655e")}catch{}})();import{assertInitializedTracker}from"../environment/tracker-preflight.js";import{resolveRuntimeStatusRegistry,statusIsTerminal,EXIT_CODE,PmCliError,toItemRecord,mutateItem,resolvePmRoot,readSettings,resolveAuthor,resolveClaimPrincipal,normalizeStatusForRegistry}from"../runtime-primitives.js";import{wrapOwnershipConflict}from"../annotations.js";import{describeItemOwnershipConflict}from"../ownership-source.js";import{runNext}from"../query/next.js";import{recordClaimSemanticAttribution,recordReleaseSemanticAttribution}from"../context/semantic-session-attribution.js";const NO_AVAILABLE_NEXT_ITEM_CODE="no_available_next_item";function isAlreadyClaimedError(error){if(!(error instanceof Error)||error.name!=="PmCliError")return!1;const context=error.context;return typeof context=="object"&&context!==null&&"code"in context&&context.code==="already_claimed_by"}async function runClaim(id,force,global2,options={}){const pmRoot=resolvePmRoot(process.cwd(),global2.path);await assertInitializedTracker(pmRoot);const settings=await readSettings(pmRoot),statusRegistry=resolveRuntimeStatusRegistry(settings.schema),author=resolveAuthor(options.author,settings.author_default),claimPrincipal=resolveClaimPrincipal(author);let previousAssignee=null,skipped=!1;const mutationWarnings=[],result=await mutateItem({pmRoot,settings,id,op:"claim",author,message:options.message,force,skipNoop:!0,async mutate(document){const currentAssigneeText=document.metadata.assignee??"",currentClaimPrincipal=document.metadata.claim_principal?.trim()||currentAssigneeText;if(previousAssignee=currentAssigneeText.trim().length>0?currentAssigneeText:null,statusIsTerminal(document.metadata.status,statusRegistry)&&!force)throw new PmCliError(`Cannot claim terminal item ${document.metadata.id} without --force`,EXIT_CODE.CONFLICT);if(previousAssignee!==null&¤tClaimPrincipal!==claimPrincipal){if(options.ifAvailable===!0)return skipped=!0,mutationWarnings.push(`claim_skipped_held_by:${previousAssignee}`),{changedFields:[]};if(!force){const ownershipPhrase=await describeItemOwnershipConflict(pmRoot,document.metadata.id,currentAssigneeText);throw new PmCliError(`Item ${document.metadata.id} is already ${ownershipPhrase}. Use --force to take over, or --if-available to skip without failing.`,EXIT_CODE.CONFLICT,{code:"already_claimed_by",why:"Claim is an atomic test-and-set so parallel agents never proceed believing they own the same item.",nextSteps:["Run pm next to pick a different unclaimed item.","Re-run with --if-available to treat a held item as a no-op skip.","Re-run with --force only when taking over the item is coordinated."]})}mutationWarnings.push(`claim_takeover:${previousAssignee}->${author}`)}const ownership={assignee:author,claim_principal:claimPrincipal},changedFields=["assignee","claim_principal"].filter(field=>document.metadata[field]!==ownership[field]);return Object.assign(document.metadata,ownership),{changedFields,warnings:mutationWarnings}}});return skipped||await recordClaimSemanticAttribution({pmRoot,settings,principal:claimPrincipal,itemId:result.item.id}),{item:toItemRecord(result.item),changed_fields:result.changedFields,claimed_by:skipped&&previousAssignee!==null?previousAssignee:author,previous_assignee:previousAssignee,forced:force,...skipped?{skipped:!0}:{},...mutationWarnings.length>0?{warnings:mutationWarnings}:{}}}async function runClaimNext(force,global2,options={},nextOptions={}){const maxAttempts=parseClaimNextAttempts(options.maxAttempts),settings=await readSettings(resolvePmRoot(process.cwd(),global2.path)),claimOptions={...options,author:resolveAuthor(options.author,settings.author_default)},next=await runNext({...nextOptions,callerAuthor:claimOptions.author,limit:String(maxAttempts)},global2),recommendations=[next.recommended,...next.ready].filter(entry=>entry!==null).map(entry=>({...entry,reasons:"reasons"in entry?entry.reasons:["ranked ready candidate"]}));return claimNextFromRecommendations(recommendations.slice(0,maxAttempts),force,global2,claimOptions)}function parseClaimNextAttempts(raw){if(raw===void 0)return 10;const parsed=Number(raw);if(!Number.isSafeInteger(parsed)||parsed<1||parsed>100)throw new PmCliError("--max-attempts must be an integer from 1 to 100",EXIT_CODE.USAGE);return parsed}async function claimNextFromRecommendations(recommendations,force,global2,options={},claimRunner=runClaim){let attempts=0;for(const recommendation of recommendations){attempts+=1;try{const claimed=await claimRunner(recommendation.id,force,global2,options),result={...claimed,recommendation,attempts,available:!0};if(!claimed.skipped)return result}catch(error){if(!isAlreadyClaimedError(error))throw error}}if(options.ifAvailable===!0)return{available:!1,item:null,claimed_by:resolveAuthor(options.author,""),previous_assignee:null,forced:force,skipped:!0,recommendation:null,attempts,warnings:[NO_AVAILABLE_NEXT_ITEM_CODE]};const noCandidatesMatched=attempts===0;throw new PmCliError(noCandidatesMatched?"No actionable items matched the selection filters":"No actionable item remained available to claim",noCandidatesMatched?EXIT_CODE.NOT_FOUND:EXIT_CODE.CONFLICT,{code:NO_AVAILABLE_NEXT_ITEM_CODE,why:noCandidatesMatched?"No ready items matched the specified filters or selection criteria.":"Every ranked candidate was claimed by another agent before this atomic selection completed.",nextSteps:[noCandidatesMatched?"Verify the filters or run pm next to inspect all ready work.":"Run pm claim --next again to refresh the ranked candidate set."]})}async function runRelease(id,force,global2,options={}){const pmRoot=resolvePmRoot(process.cwd(),global2.path);await assertInitializedTracker(pmRoot);const settings=await readSettings(pmRoot),author=resolveAuthor(options.author,settings.author_default),claimPrincipal=resolveClaimPrincipal(author),ownershipReleaseBypass=options.ownershipReleaseBypass===!0;let previousAssignee=null,result;try{result=await mutateItem({pmRoot,settings,id,op:"release",author,message:options.message,force,bypassAssigneeConflict:ownershipReleaseBypass,mutate(document){return previousAssignee=document.metadata.assignee??null,!previousAssignee&&!document.metadata.claim_principal?{changedFields:[]}:(delete document.metadata.assignee,delete document.metadata.claim_principal,{changedFields:["assignee","claim_principal"]})}})}catch(error){wrapOwnershipConflict(error,{required:"For approved non-owner handoffs, prefer the ownership-release bypass before considering --force.",examples:['pm release pm-a1b2 --author "reviewer" --force'],nextSteps:["Use the package-provided ownership-release bypass for handoffs that only clear assignee metadata.","Use --force only when an explicit override is approved for broader ownership conflicts."]})}await recordReleaseSemanticAttribution({pmRoot,principal:claimPrincipal,itemId:result.item.id});const statusRegistry=resolveRuntimeStatusRegistry(settings.schema),stillInProgress=normalizeStatusForRegistry(result.item.status,statusRegistry)===normalizeStatusForRegistry(statusRegistry.in_progress_status,statusRegistry);return{item:toItemRecord(result.item),released_by:author,changed_fields:result.changedFields,previous_assignee:previousAssignee,forced:force,...stillInProgress?{warnings:["released_unclaimed_in_progress"],suggestions:[`${result.item.id} remains ${result.item.status} and unclaimed. If work is paused, run pm release ${result.item.id} --pause to move it to ${statusRegistry.open_status}.`]}:{}}}export{NO_AVAILABLE_NEXT_ITEM_CODE,claimNextFromRecommendations,isAlreadyClaimedError,parseClaimNextAttempts,runClaim,runClaimNext,runRelease};
|
|
2
2
|
//# sourceMappingURL=claim.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="aec6f8e2-5fd0-53f3-8262-c6b49741ff96")}catch(e2){}})();import{assertInitializedTracker}from"../environment/tracker-preflight.js";import{createCheckpointId,loadMutationCheckpoint,restoreCheckpointItems,writeMutationCheckpoint,getActiveExtensionRegistrations,isTerminalStatus,resolveItemTypeRegistry,resolveRuntimeStatusRegistry,EXIT_CODE,PmCliError,toErrorMessage,resolveAuthor,nowIso,listAllItemMetadataLight,resolvePmRoot,readSettings}from"../runtime-primitives.js";import{runClose}from"./close.js";import{hasListFilters}from"../query/list-filter-shared.js";import{runList}from"../query/list.js";import{runRestore}from"./restore.js";import{derivePmBulkMutationEffect}from"../cli-contracts/command-exit-contracts.js";const CLOSE_MANY_CHECKPOINT_SCHEMA_VERSION=1;const CLOSE_MANY_CHECKPOINT_SUBDIR="close-many";const CLOSE_MANY_FILTER_GUIDANCE=["--filter-status","--filter-type","--filter-tag","--filter-priority","--filter-sprint","--filter-release","--filter-parent","--filter-assignee","--filter-updated-before","--ids"].join(", ");function hasCloseManyFilters(list,status){return hasListFilters(list,status,{includePagination:false})}function hasCloseManyRollbackConflicts(list,status){return hasListFilters(list,status)}function rejectBlankIdsFilter(list){if(list?.ids!=null&&String(list.ids).trim().length===0){throw new PmCliError("--ids requires at least one non-empty item ID",EXIT_CODE.USAGE)}}function activeListOptions(list){const active={};if(!list){return active}for(const[key,value]of Object.entries(list)){if(value==null||typeof value==="string"&&!value.split(",").some(entry=>entry.trim().length>0)){continue}active[key]=value}return active}function resolveReason(reason,required){const trimmed=String(reason??"").trim();if(trimmed.length>0){return trimmed}if(required){throw new PmCliError("pm close-many requires a shared close reason via --reason because governance.require_close_reason is enabled.",EXIT_CODE.USAGE,{code:"close_reason_required",required:"Provide a shared closing summary via --reason for the whole batch.",why:"governance.require_close_reason is enabled, so every close must record why the items are done.",examples:['pm close-many --filter-sprint S-12 --reason "Sprint S-12 acceptance criteria met"','pm close-many --ids pm-a,pm-b --reason "Superseded by redesign"'],nextSteps:["Re-run with --reason describing the shared outcome.","To stop requiring reasons, run: pm config set governance-require-close-reason --policy disabled"]})}return void 0}async function buildActiveChildrenByParent(pmRoot,settings){const statusRegistry=resolveRuntimeStatusRegistry(settings.schema);const typeRegistry=resolveItemTypeRegistry(settings,getActiveExtensionRegistrations());const items=await listAllItemMetadataLight(pmRoot,settings.item_format,typeRegistry.type_to_folder,void 0,settings.schema);const childrenByParent=new Map;const parentByChild=new Map;for(const item of items){if(typeof item.parent!=="string"||item.parent.length===0){continue}parentByChild.set(item.id,item.parent);if(isTerminalStatus(item.status,statusRegistry)){continue}const existing=childrenByParent.get(item.parent);if(existing){existing.push(item.id)}else{childrenByParent.set(item.parent,[item.id])}}for(const ids of childrenByParent.values()){ids.sort((left,right)=>left.localeCompare(right))}return{childrenByParent,parentByChild}}function hierarchyDepth(id,parentByChild,cache){const cached=cache?.get(id);if(cached!==void 0){return cached}let depth=0;let current=parentByChild.get(id);const path=[];const visited=new Set;let hasCycle=false;while(current!==void 0&&!visited.has(current)){const cachedCurrent=cache?.get(current);if(cachedCurrent!==void 0){depth+=cachedCurrent+1;break}visited.add(current);path.push(current);depth+=1;current=parentByChild.get(current)}if(current!==void 0&&visited.has(current)){hasCycle=true}if(!hasCycle){cache?.set(id,depth);for(const[index,ancestorId]of path.entries()){cache?.set(ancestorId,depth-index-1)}}return depth}async function runCloseManyRollback(params){const checkpoint=await loadMutationCheckpoint(params.pmRoot,CLOSE_MANY_CHECKPOINT_SUBDIR,params.rollbackId,CLOSE_MANY_CHECKPOINT_SCHEMA_VERSION);const restoreMessage=params.options.message??`Rollback close-many checkpoint ${checkpoint.id}`;const rollback=await restoreCheckpointItems(checkpoint.items,(id,targetUpdatedAt)=>runRestore(id,targetUpdatedAt,{author:params.options.author,message:restoreMessage,force:true},params.global));return{...derivePmBulkMutationEffect({applied:rollback.restored_ids.length,skipped:0,failed:rollback.failed_count,unmatched:0}),mode:"rollback",matched_count:checkpoint.items.length,dry_run:false,rollback_checkpoint_id:checkpoint.id,checkpoint:{id:checkpoint.id,created_at:checkpoint.created_at,path:checkpoint.path,rollback_command:`pm close-many --rollback ${checkpoint.id}`},restored_count:rollback.restored_ids.length,failed_count:rollback.failed_count,rows:rollback.rows,ids:rollback.restored_ids}}function planCloseManyRows(matched,childrenByParent,closePlannedIds,statusRegistry,force){return matched.map(item=>{const activeChildIds=(childrenByParent.get(item.id)??[]).filter(childId=>!closePlannedIds.has(childId));const willSkip=!canCloseManyItem(item,statusRegistry,force);return{id:item.id,title:typeof item.title==="string"?item.title:"",status:item.status,action:willSkip?"skip":"close",...willSkip?{skip_reason:"already_terminal"}:{},...activeChildIds.length>0?{active_child_ids:activeChildIds}:{}}})}async function writeCloseManyCheckpoint(params){const checkpointPath=await writeMutationCheckpoint(params.pmRoot,CLOSE_MANY_CHECKPOINT_SUBDIR,params.checkpointId,{schema_version:CLOSE_MANY_CHECKPOINT_SCHEMA_VERSION,id:params.checkpointId,created_at:params.nowValue,author:resolveAuthor(params.options.author,"unknown"),...params.reason!==void 0?{reason:params.reason}:{},filters:params.filters,items:params.checkpointItems});return{id:params.checkpointId,created_at:params.nowValue,path:checkpointPath,rollback_command:`pm close-many --rollback ${params.checkpointId}`}}async function applyCloseManyRows(params){const rows=[];const closedIds=[];for(const item of params.matched){if(!params.closableIds.has(item.id)){rows.push({id:item.id,status:"skipped",skip_reason:"already_terminal"});continue}try{const result=await runClose(item.id,params.reason,params.closeOptions,params.global);rows.push({id:item.id,status:"closed",changed_fields:result.changed_fields,...result.warnings&&result.warnings.length>0?{warnings:result.warnings}:{}});closedIds.push(item.id)}catch(error){rows.push({id:item.id,status:"failed",error:toErrorMessage(error)})}}return{rows,closedIds}}function resolveCloseManyRollbackId(options){return typeof options.rollback==="string"?options.rollback:void 0}function validateCloseManyRollbackOptions(options,rollbackId){if(rollbackId.trim().length===0){throw new PmCliError("--rollback requires a checkpoint id",EXIT_CODE.USAGE)}if(options.dryRun===true){throw new PmCliError("--dry-run cannot be combined with --rollback",EXIT_CODE.USAGE)}if(hasCloseManyRollbackConflicts(options.list,options.status)){throw new PmCliError("Rollback mode does not accept filter options",EXIT_CODE.USAGE)}}function assertCloseManyHasFilters(options){if(hasCloseManyFilters(options.list,options.status)){return}throw new PmCliError(`close-many requires at least one filter to scope the close (for example: ${CLOSE_MANY_FILTER_GUIDANCE}). Refusing to match every item.`,EXIT_CODE.USAGE)}function sortCloseManyMatchedItems(matched,parentByChild){const depthCache=new Map;return[...matched].sort((left,right)=>{const depthDelta=hierarchyDepth(right.id,parentByChild,depthCache)-hierarchyDepth(left.id,parentByChild,depthCache);return depthDelta!==0?depthDelta:left.id.localeCompare(right.id)})}function canCloseManyItem(item,statusRegistry,force){return force||!isTerminalStatus(item.status,statusRegistry)}function resolveCloseManyPlannedIds(matched,statusRegistry,force){return new Set(matched.filter(item=>canCloseManyItem(item,statusRegistry,force)).map(item=>item.id))}async function buildCloseManyPlanContext(params){assertCloseManyHasFilters(params.options);const statusRegistry=resolveRuntimeStatusRegistry(params.settings.schema);const reason=resolveReason(params.options.reason,params.settings.governance.require_close_reason);const force=params.options.force===true;const listed=await runList(params.options.status,activeListOptions(params.options.list),params.global);const{childrenByParent,parentByChild}=await buildActiveChildrenByParent(params.pmRoot,params.settings);const matched=sortCloseManyMatchedItems(listed.items,parentByChild);const requestedIds=[...new Set(String(params.options.list?.ids??"").split(",").map(entry=>entry.trim()).filter(entry=>entry.length>0))];const existenceItems=requestedIds.length===0?[]:(await runList(void 0,{ids:requestedIds.join(","),noTruncate:true,full:true},params.global)).items;const existingIds=new Set(existenceItems.map(item=>item.id));const closePlannedIds=resolveCloseManyPlannedIds(matched,statusRegistry,force);return{pmRoot:params.pmRoot,settings:params.settings,statusRegistry,reason,validateCloseMode:params.options.validateClose,force,listed,matched,unmatchedIds:requestedIds.length===0?void 0:requestedIds.filter(id=>!existingIds.has(id)),planRows:planCloseManyRows(matched,childrenByParent,closePlannedIds,statusRegistry,force)}}function buildCloseManyDryRunResult(context){return{outcome:"effect",exit_code:EXIT_CODE.SUCCESS,mode:"dry_run",matched_count:context.matched.length,dry_run:true,...context.reason!==void 0?{reason:context.reason}:{},filters:context.listed.filters,...context.validateCloseMode?{validate_close:context.validateCloseMode}:{},item_plans:context.planRows,ids:[],...context.unmatchedIds!==void 0?{unmatched_ids:context.unmatchedIds,unmatched_count:context.unmatchedIds.length}:{}}}async function resolveCloseManyCheckpointInfo(params){if(params.options.checkpoint===false||params.closableIds.size===0){return void 0}const checkpointItems=params.context.matched.filter(item=>params.closableIds.has(item.id)).map(item=>({id:item.id,target_updated_at:item.updated_at}));return writeCloseManyCheckpoint({pmRoot:params.context.pmRoot,checkpointId:params.checkpointId,nowValue:params.nowValue,options:params.options,reason:params.context.reason,filters:params.context.listed.filters,checkpointItems})}async function runCloseMany(options,global2){const pmRoot=resolvePmRoot(process.cwd(),global2.path);await assertInitializedTracker(pmRoot);const settings=await readSettings(pmRoot);const dryRun=options.dryRun===true;const rollbackId=resolveCloseManyRollbackId(options);rejectBlankIdsFilter(options.list);if(rollbackId!==void 0){validateCloseManyRollbackOptions(options,rollbackId);return runCloseManyRollback({pmRoot,rollbackId,options,global:global2})}const context=await buildCloseManyPlanContext({pmRoot,settings,options,global:global2});if(dryRun){return buildCloseManyDryRunResult(context)}const closableIds=new Set(context.planRows.filter(row=>row.action==="close").map(row=>row.id));const nowValue=nowIso();const checkpointId=createCheckpointId(CLOSE_MANY_CHECKPOINT_SUBDIR,nowValue);const checkpointInfo=await resolveCloseManyCheckpointInfo({context,options,closableIds,checkpointId,nowValue});const closeOptions={author:options.author,message:options.message??`close-many apply ${checkpointId}`,completedAt:options.completedAt,validateClose:context.validateCloseMode,force:context.force,resolution:options.resolution,expectedResult:options.expectedResult,actualResult:options.actualResult};const{rows,closedIds}=await applyCloseManyRows({matched:context.matched,closableIds,reason:context.reason,closeOptions,global:global2});const closedCount=rows.filter(row=>row.status==="closed").length;const skippedCount=rows.filter(row=>row.status==="skipped").length;const failedCount=rows.filter(row=>row.status==="failed").length;return{...derivePmBulkMutationEffect({applied:closedCount,skipped:skippedCount,failed:failedCount,unmatched:context.unmatchedIds?.length??0}),mode:"apply",matched_count:context.matched.length,dry_run:false,...context.reason!==void 0?{reason:context.reason}:{},filters:context.listed.filters,...context.validateCloseMode?{validate_close:context.validateCloseMode}:{},...checkpointInfo?{checkpoint:checkpointInfo}:{},closed_count:closedCount,skipped_count:skippedCount,failed_count:failedCount,rows,ids:closedIds,...context.unmatchedIds!==void 0?{unmatched_ids:context.unmatchedIds,unmatched_count:context.unmatchedIds.length}:{}}}const _testOnly={activeListOptions,buildActiveChildrenByParent,hasCloseManyFilters,hasCloseManyRollbackConflicts,hierarchyDepth,rejectBlankIdsFilter,resolveReason};export{_testOnly,runCloseMany};
|
|
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]="6edfa77d-9b76-540b-a365-a3fef0450c53")}catch{}})();import{assertInitializedTracker}from"../environment/tracker-preflight.js";import{createCheckpointId,loadMutationCheckpoint,restoreCheckpointItems,writeMutationCheckpoint,getActiveExtensionRegistrations,isTerminalStatus,resolveItemTypeRegistry,resolveRuntimeStatusRegistry,EXIT_CODE,PmCliError,toErrorMessage,resolveAuthor,nowIso,listAllItemMetadataLight,resolvePmRoot,readSettings}from"../runtime-primitives.js";import{runClose}from"./close.js";import{hasListFilters}from"../query/list-filter-shared.js";import{runList}from"../query/list.js";import{runRestore}from"./restore.js";import{derivePmBulkMutationEffect}from"../cli-contracts/command-exit-contracts.js";const CLOSE_MANY_CHECKPOINT_SCHEMA_VERSION=1,CLOSE_MANY_CHECKPOINT_SUBDIR="close-many",CLOSE_MANY_FILTER_GUIDANCE=["--filter-status","--filter-type","--filter-tag","--filter-priority","--filter-sprint","--filter-release","--filter-parent","--filter-assignee","--filter-updated-before","--ids"].join(", ");function hasCloseManyFilters(list,status){return hasListFilters(list,status,{includePagination:!1})}function hasCloseManyRollbackConflicts(list,status){return hasListFilters(list,status)}function rejectBlankIdsFilter(list){if(list?.ids!=null&&String(list.ids).trim().length===0)throw new PmCliError("--ids requires at least one non-empty item ID",EXIT_CODE.USAGE)}function activeListOptions(list){const active={};if(!list)return active;for(const[key,value]of Object.entries(list))value==null||typeof value=="string"&&!value.split(",").some(entry=>entry.trim().length>0)||(active[key]=value);return active}function resolveReason(reason,required){const trimmed=String(reason??"").trim();if(trimmed.length>0)return trimmed;if(required)throw new PmCliError("pm close-many requires a shared close reason via --reason because governance.require_close_reason is enabled.",EXIT_CODE.USAGE,{code:"close_reason_required",required:"Provide a shared closing summary via --reason for the whole batch.",why:"governance.require_close_reason is enabled, so every close must record why the items are done.",examples:['pm close-many --filter-sprint S-12 --reason "Sprint S-12 acceptance criteria met"','pm close-many --ids pm-a,pm-b --reason "Superseded by redesign"'],nextSteps:["Re-run with --reason describing the shared outcome.","To stop requiring reasons, run: pm config set governance-require-close-reason --policy disabled"]})}async function buildActiveChildrenByParent(pmRoot,settings){const statusRegistry=resolveRuntimeStatusRegistry(settings.schema),typeRegistry=resolveItemTypeRegistry(settings,getActiveExtensionRegistrations()),items=await listAllItemMetadataLight(pmRoot,settings.item_format,typeRegistry.type_to_folder,void 0,settings.schema),childrenByParent=new Map,parentByChild=new Map;for(const item of items){if(typeof item.parent!="string"||item.parent.length===0||(parentByChild.set(item.id,item.parent),isTerminalStatus(item.status,statusRegistry)))continue;const existing=childrenByParent.get(item.parent);existing?existing.push(item.id):childrenByParent.set(item.parent,[item.id])}for(const ids of childrenByParent.values())ids.sort((left,right)=>left.localeCompare(right));return{childrenByParent,parentByChild}}function hierarchyDepth(id,parentByChild,cache){const cached=cache?.get(id);if(cached!==void 0)return cached;let depth=0,current=parentByChild.get(id);const path=[],visited=new Set;let hasCycle=!1;for(;current!==void 0&&!visited.has(current);){const cachedCurrent=cache?.get(current);if(cachedCurrent!==void 0){depth+=cachedCurrent+1;break}visited.add(current),path.push(current),depth+=1,current=parentByChild.get(current)}if(current!==void 0&&visited.has(current)&&(hasCycle=!0),!hasCycle){cache?.set(id,depth);for(const[index,ancestorId]of path.entries())cache?.set(ancestorId,depth-index-1)}return depth}async function runCloseManyRollback(params){const checkpoint=await loadMutationCheckpoint(params.pmRoot,CLOSE_MANY_CHECKPOINT_SUBDIR,params.rollbackId,CLOSE_MANY_CHECKPOINT_SCHEMA_VERSION),restoreMessage=params.options.message??`Rollback close-many checkpoint ${checkpoint.id}`,rollback=await restoreCheckpointItems(checkpoint.items,(id,targetUpdatedAt)=>runRestore(id,targetUpdatedAt,{author:params.options.author,message:restoreMessage,force:!0},params.global));return{...derivePmBulkMutationEffect({applied:rollback.restored_ids.length,skipped:0,failed:rollback.failed_count,unmatched:0}),mode:"rollback",matched_count:checkpoint.items.length,dry_run:!1,rollback_checkpoint_id:checkpoint.id,checkpoint:{id:checkpoint.id,created_at:checkpoint.created_at,path:checkpoint.path,rollback_command:`pm close-many --rollback ${checkpoint.id}`},restored_count:rollback.restored_ids.length,failed_count:rollback.failed_count,rows:rollback.rows,ids:rollback.restored_ids}}function planCloseManyRows(matched,childrenByParent,closePlannedIds,statusRegistry,force){return matched.map(item=>{const activeChildIds=(childrenByParent.get(item.id)??[]).filter(childId=>!closePlannedIds.has(childId)),willSkip=!canCloseManyItem(item,statusRegistry,force);return{id:item.id,title:typeof item.title=="string"?item.title:"",status:item.status,action:willSkip?"skip":"close",...willSkip?{skip_reason:"already_terminal"}:{},...activeChildIds.length>0?{active_child_ids:activeChildIds}:{}}})}async function writeCloseManyCheckpoint(params){const checkpointPath=await writeMutationCheckpoint(params.pmRoot,CLOSE_MANY_CHECKPOINT_SUBDIR,params.checkpointId,{schema_version:CLOSE_MANY_CHECKPOINT_SCHEMA_VERSION,id:params.checkpointId,created_at:params.nowValue,author:resolveAuthor(params.options.author,"unknown"),...params.reason!==void 0?{reason:params.reason}:{},filters:params.filters,items:params.checkpointItems});return{id:params.checkpointId,created_at:params.nowValue,path:checkpointPath,rollback_command:`pm close-many --rollback ${params.checkpointId}`}}async function applyCloseManyRows(params){const rows=[],closedIds=[];for(const item of params.matched){if(!params.closableIds.has(item.id)){rows.push({id:item.id,status:"skipped",skip_reason:"already_terminal"});continue}try{const result=await runClose(item.id,params.reason,params.closeOptions,params.global);rows.push({id:item.id,status:"closed",changed_fields:result.changed_fields,...result.warnings&&result.warnings.length>0?{warnings:result.warnings}:{}}),closedIds.push(item.id)}catch(error){rows.push({id:item.id,status:"failed",error:toErrorMessage(error)})}}return{rows,closedIds}}function resolveCloseManyRollbackId(options){return typeof options.rollback=="string"?options.rollback:void 0}function validateCloseManyRollbackOptions(options,rollbackId){if(rollbackId.trim().length===0)throw new PmCliError("--rollback requires a checkpoint id",EXIT_CODE.USAGE);if(options.dryRun===!0)throw new PmCliError("--dry-run cannot be combined with --rollback",EXIT_CODE.USAGE);if(hasCloseManyRollbackConflicts(options.list,options.status))throw new PmCliError("Rollback mode does not accept filter options",EXIT_CODE.USAGE)}function assertCloseManyHasFilters(options){if(!hasCloseManyFilters(options.list,options.status))throw new PmCliError(`close-many requires at least one filter to scope the close (for example: ${CLOSE_MANY_FILTER_GUIDANCE}). Refusing to match every item.`,EXIT_CODE.USAGE)}function sortCloseManyMatchedItems(matched,parentByChild){const depthCache=new Map;return[...matched].sort((left,right)=>{const depthDelta=hierarchyDepth(right.id,parentByChild,depthCache)-hierarchyDepth(left.id,parentByChild,depthCache);return depthDelta!==0?depthDelta:left.id.localeCompare(right.id)})}function canCloseManyItem(item,statusRegistry,force){return force||!isTerminalStatus(item.status,statusRegistry)}function resolveCloseManyPlannedIds(matched,statusRegistry,force){return new Set(matched.filter(item=>canCloseManyItem(item,statusRegistry,force)).map(item=>item.id))}async function buildCloseManyPlanContext(params){assertCloseManyHasFilters(params.options);const statusRegistry=resolveRuntimeStatusRegistry(params.settings.schema),reason=resolveReason(params.options.reason,params.settings.governance.require_close_reason),force=params.options.force===!0,listed=await runList(params.options.status,activeListOptions(params.options.list),params.global),{childrenByParent,parentByChild}=await buildActiveChildrenByParent(params.pmRoot,params.settings),matched=sortCloseManyMatchedItems(listed.items,parentByChild),requestedIds=[...new Set(String(params.options.list?.ids??"").split(",").map(entry=>entry.trim()).filter(entry=>entry.length>0))],existenceItems=requestedIds.length===0?[]:(await runList(void 0,{ids:requestedIds.join(","),noTruncate:!0,full:!0},params.global)).items,existingIds=new Set(existenceItems.map(item=>item.id)),closePlannedIds=resolveCloseManyPlannedIds(matched,statusRegistry,force);return{pmRoot:params.pmRoot,settings:params.settings,statusRegistry,reason,validateCloseMode:params.options.validateClose,force,listed,matched,unmatchedIds:requestedIds.length===0?void 0:requestedIds.filter(id=>!existingIds.has(id)),planRows:planCloseManyRows(matched,childrenByParent,closePlannedIds,statusRegistry,force)}}function buildCloseManyDryRunResult(context){return{outcome:"effect",exit_code:EXIT_CODE.SUCCESS,mode:"dry_run",matched_count:context.matched.length,dry_run:!0,...context.reason!==void 0?{reason:context.reason}:{},filters:context.listed.filters,...context.validateCloseMode?{validate_close:context.validateCloseMode}:{},item_plans:context.planRows,ids:[],...context.unmatchedIds!==void 0?{unmatched_ids:context.unmatchedIds,unmatched_count:context.unmatchedIds.length}:{}}}async function resolveCloseManyCheckpointInfo(params){if(params.options.checkpoint===!1||params.closableIds.size===0)return;const checkpointItems=params.context.matched.filter(item=>params.closableIds.has(item.id)).map(item=>({id:item.id,target_updated_at:item.updated_at}));return writeCloseManyCheckpoint({pmRoot:params.context.pmRoot,checkpointId:params.checkpointId,nowValue:params.nowValue,options:params.options,reason:params.context.reason,filters:params.context.listed.filters,checkpointItems})}async function runCloseMany(options,global2){const pmRoot=resolvePmRoot(process.cwd(),global2.path);await assertInitializedTracker(pmRoot);const settings=await readSettings(pmRoot),dryRun=options.dryRun===!0,rollbackId=resolveCloseManyRollbackId(options);if(rejectBlankIdsFilter(options.list),rollbackId!==void 0)return validateCloseManyRollbackOptions(options,rollbackId),runCloseManyRollback({pmRoot,rollbackId,options,global:global2});const context=await buildCloseManyPlanContext({pmRoot,settings,options,global:global2});if(dryRun)return buildCloseManyDryRunResult(context);const closableIds=new Set(context.planRows.filter(row=>row.action==="close").map(row=>row.id)),nowValue=nowIso(),checkpointId=createCheckpointId(CLOSE_MANY_CHECKPOINT_SUBDIR,nowValue),checkpointInfo=await resolveCloseManyCheckpointInfo({context,options,closableIds,checkpointId,nowValue}),closeOptions={author:options.author,message:options.message??`close-many apply ${checkpointId}`,completedAt:options.completedAt,validateClose:context.validateCloseMode,force:context.force,resolution:options.resolution,expectedResult:options.expectedResult,actualResult:options.actualResult},{rows,closedIds}=await applyCloseManyRows({matched:context.matched,closableIds,reason:context.reason,closeOptions,global:global2}),closedCount=rows.filter(row=>row.status==="closed").length,skippedCount=rows.filter(row=>row.status==="skipped").length,failedCount=rows.filter(row=>row.status==="failed").length;return{...derivePmBulkMutationEffect({applied:closedCount,skipped:skippedCount,failed:failedCount,unmatched:context.unmatchedIds?.length??0}),mode:"apply",matched_count:context.matched.length,dry_run:!1,...context.reason!==void 0?{reason:context.reason}:{},filters:context.listed.filters,...context.validateCloseMode?{validate_close:context.validateCloseMode}:{},...checkpointInfo?{checkpoint:checkpointInfo}:{},closed_count:closedCount,skipped_count:skippedCount,failed_count:failedCount,rows,ids:closedIds,...context.unmatchedIds!==void 0?{unmatched_ids:context.unmatchedIds,unmatched_count:context.unmatchedIds.length}:{}}}const _testOnly={activeListOptions,buildActiveChildrenByParent,hasCloseManyFilters,hasCloseManyRollbackConflicts,hierarchyDepth,rejectBlankIdsFilter,resolveReason};export{_testOnly,runCloseMany};
|
|
2
2
|
//# sourceMappingURL=close-many.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="49e375b7-49a8-5b6f-89c8-be70d334b78f")}catch(e2){}})();import{assertInitializedTracker}from"../environment/tracker-preflight.js";import{toItemRecord,isTerminalStatus,resolveItemTypeRegistry,resolveRuntimeStatusRegistry,EXIT_CODE,PmCliError,buildItemNotFoundError,listAllItemMetadataLight,locateItem,mutateItem,readLocatedItem,resolvePmRoot,readSettings,resolveAuthor,resolveIsoOrRelative,shouldCompletePlanOnClose,getActiveExtensionRegistrations}from"../runtime-primitives.js";import{collectBlockedByIds,indexBlockedByIds}from"../actionability.js";import{applyTerminalOrderingPolicy,requireTerminalReason}from"../lifecycle-policy.js";import{nowIso}from"../../core/shared/time.js";import{renderPmCommand}from"../command-line.js";const CLOSE_VALIDATION_FIELDS=[{key:"resolution",label:"resolution (--resolution)"},{key:"expected_result",label:"expected_result (--expected-result)"},{key:"actual_result",label:"actual_result (--actual-result)"}];function parseValidateCloseMode(raw){if(raw===void 0){return void 0}const normalized=raw.trim().toLowerCase();if(normalized.length===0||normalized==="warn"){return"warn"}if(normalized==="off"||normalized==="none"||normalized==="disabled"){return"off"}if(normalized==="strict"){return"strict"}throw new PmCliError(`Invalid --validate-close mode "${raw}" (expected "off", "warn", or "strict")`,EXIT_CODE.USAGE)}function findMissingCloseValidationFields(itemMetadata){const missing=[];for(const field of CLOSE_VALIDATION_FIELDS){const rawValue=itemMetadata[field.key];if(typeof rawValue!=="string"||rawValue.trim().length===0){missing.push(field)}}return missing}function closeEvidenceRecovery(metadata,pmRoot,options={}){const missing=findMissingCloseValidationFields(metadata);if(missing.length===0)return void 0;const values={resolution:options.resolution,expected_result:options.expectedResult,actual_result:options.actualResult};const missingFlags=missing.map(field=>`--${field.key.replaceAll("_","-")}`);const args=["--pm-path",pmRoot,"update",metadata.id,...missing.flatMap((field,index)=>[missingFlags[index],values[field.key]?.trim()||"<value>"])];return{missing:missingFlags,suggested_retry:renderPmCommand(args),suggested_retry_args:args}}async function duplicateChainReferencesClosingItem(loadItemById,initialDuplicateOf,closingId){const visited=new Set;let current=initialDuplicateOf;while(typeof current==="string"&¤t.trim().length>0){const currentId=current.trim();if(currentId===closingId){return true}if(visited.has(currentId)){return false}visited.add(currentId);current=(await loadItemById(currentId))?.duplicate_of}return false}function shouldApplyDuplicateFallback(value){return typeof value!=="string"||value.trim().length===0}async function assertDuplicateTargetExists(pmRoot,settings,duplicateOf,closingId){const rawTarget=duplicateOf?.trim();if(!rawTarget){return void 0}if(rawTarget===closingId){throw new PmCliError("An item cannot be closed as a duplicate of itself.",EXIT_CODE.USAGE,{code:"duplicate_target_self",why:"--duplicate-of must identify the canonical item that should remain open or already represent the work."})}const typeRegistry=resolveItemTypeRegistry(settings,getActiveExtensionRegistrations());const itemCache=new Map;const loadItemById=async id=>{if(itemCache.has(id)){return itemCache.get(id)??null}const located=await locateItem(pmRoot,id,settings.id_prefix,settings.item_format,typeRegistry.type_to_folder);if(!located){itemCache.set(id,null);return null}const{document}=await readLocatedItem(located,{schema:settings.schema});itemCache.set(id,document.metadata);return document.metadata};const target=await loadItemById(rawTarget);if(!target){throw new PmCliError(`Duplicate target "${rawTarget}" was not found. Create or locate the canonical item first.`,EXIT_CODE.USAGE,{code:"duplicate_target_missing",why:"Duplicate closure should point at a real canonical pm item so future dedupe and changelog tooling can trace the relationship.",examples:[`pm close ${closingId} "Duplicate of ${rawTarget}" --duplicate-of ${rawTarget}`],nextSteps:["Run pm search/list to find the canonical item, then retry with --duplicate-of <id>."]})}if(await duplicateChainReferencesClosingItem(loadItemById,target.duplicate_of,closingId)){throw new PmCliError(`Circular duplicate reference detected. Target "${rawTarget}" points back to "${closingId}".`,EXIT_CODE.USAGE,{code:"duplicate_target_circular",why:"Circular duplicate relationships create loops for dedupe and status propagation tooling.",nextSteps:["Choose the existing canonical item, or clear the target duplicate_of metadata before closing this item as a duplicate."]})}if(typeof target.duplicate_of==="string"&&target.duplicate_of.trim().length>0){throw new PmCliError(`Duplicate target "${rawTarget}" is already marked as a duplicate of "${target.duplicate_of.trim()}".`,EXIT_CODE.USAGE,{code:"duplicate_target_is_duplicate",why:"Duplicate closure should point directly at the canonical item, not another duplicate.",examples:[`pm close ${closingId} "Duplicate of ${target.duplicate_of.trim()}" --duplicate-of ${target.duplicate_of.trim()}`],nextSteps:["Use the canonical item referenced by duplicate_of as the --duplicate-of target."]})}return target.id}function findActiveChildIds(items,parentId,statusRegistry){return items.filter(item=>item.parent===parentId&&!isTerminalStatus(item.status,statusRegistry)).map(item=>item.id).sort((left,right)=>left.localeCompare(right))}function findAutoUnblockCandidates(items,closedId,statusRegistry){const itemsById=new Map(items.map(item=>[item.id.trim().toLowerCase(),item]));const blockerIdsByItem=indexBlockedByIds(items);const normalizedClosedId=closedId.trim().toLowerCase();const blockedStatuses=statusRegistry.blocked_statuses;return items.filter(item=>blockedStatuses.has(item.status)).map(item=>({item,blockerIds:blockerIdsByItem.get(item.id.trim().toLowerCase())})).filter(({blockerIds})=>blockerIds.includes(normalizedClosedId)).filter(({blockerIds})=>blockerIds.every(blockerId=>{if(blockerId===normalizedClosedId){return true}const blocker=itemsById.get(blockerId);return blocker!==void 0&&isTerminalStatus(blocker.status,statusRegistry)})).map(({item,blockerIds})=>({id:item.id,blocker_ids:blockerIds})).sort((left,right)=>left.id.localeCompare(right.id))}async function autoUnblockResolvedDependents(pmRoot,settings,items,closedId,author,statusRegistry){const candidates=findAutoUnblockCandidates(items,closedId,statusRegistry);const warnings=[];for(const candidate of candidates){try{const unblocked=await mutateItem({pmRoot,settings,id:candidate.id,op:"update",author,message:`Auto-unblocked after blocker ${closedId} closed`,mutate(document){const dependencies=document.metadata.dependencies??[];const remainingDependencies=dependencies.filter(dependency=>{const dependencyId=dependency.id.trim().toLowerCase();return dependency.kind!=="blocked_by"||!candidate.blocker_ids.includes(dependencyId)});document.metadata.status=statusRegistry.open_status;delete document.metadata.blocked_by;delete document.metadata.blocked_reason;document.metadata.unblock_note=`Auto-unblocked after blocker ${closedId} closed; all blockers resolved (${candidate.blocker_ids.join(", ")}).`;if(remainingDependencies.length>0){document.metadata.dependencies=remainingDependencies}else{delete document.metadata.dependencies}const changedFields=["status","blocked_by","blocked_reason","unblock_note"];if(remainingDependencies.length!==dependencies.length){changedFields.push("dependencies")}return{changedFields}}});warnings.push(`auto_unblocked:${unblocked.item.id}:resolved_blockers=${candidate.blocker_ids.join(",")}`)}catch(error){const reason=error instanceof Error?error.message.replace(/\s+/g," ").trim():"unknown";warnings.push(`auto_unblock_failed:${candidate.id}:${reason}`)}}return warnings}function applyInlineCloseFields(metadata,options){const changedFields=[];const inlineCloseFields=[{option:options.resolution,key:"resolution"},{option:options.expectedResult,key:"expected_result"},{option:options.actualResult,key:"actual_result"}];for(const{option,key}of inlineCloseFields){if(typeof option!=="string"){continue}const trimmed=option.trim();if(trimmed.length===0){continue}metadata[key]=trimmed;changedFields.push(key)}return changedFields}function applyDuplicateCloseMetadata(metadata,duplicateOf){if(duplicateOf===void 0){return[]}metadata.duplicate_of=duplicateOf;const duplicateFallbackFields=[];const fallbackValues=[{key:"resolution",value:`Duplicate of ${duplicateOf}`},{key:"expected_result",value:`Canonical item ${duplicateOf} tracks the work.`},{key:"actual_result",value:`Closed as duplicate of ${duplicateOf}.`}];for(const{key,value}of fallbackValues){if(shouldApplyDuplicateFallback(metadata[key])){metadata[key]=value;duplicateFallbackFields.push(key)}}return duplicateFallbackFields}function collectCloseValidationWarnings(metadata,validateCloseMode,activeChildIds,pmRoot){const warnings=[];if(validateCloseMode!=="off"){const missingFields=findMissingCloseValidationFields(metadata);if(missingFields.length>0){const missingLabels=missingFields.map(field=>field.label);if(validateCloseMode==="strict"){const missingFlags=missingFields.map(field=>`--${field.key.replaceAll("_","-")}`);const updateTokens=["--pm-path",pmRoot,"update",metadata.id,...missingFlags.flatMap(flag=>[flag,"<value>"])];throw new PmCliError(`Cannot close item ${metadata.id}: missing ${missingLabels.join(", ")}. Populate fields or use --validate-close warn.`,EXIT_CODE.USAGE,{code:"close_validation_missing_fields",recovery:{missing:missingFlags,suggested_retry:renderPmCommand(updateTokens)},nextSteps:["Run the suggested pm update, then retry the original pm close invocation.","Use --validate-close warn only when governance permits an evidenced exception."]})}warnings.push(`close_validation_missing_fields:${metadata.id}:${missingLabels.join(",")}`)}if(activeChildIds.length>0){if(validateCloseMode==="strict"){throw new PmCliError(`Cannot close item ${metadata.id}: active child items remain open (${activeChildIds.join(", ")}). Close, cancel, or re-parent them first, or use --validate-close warn.`,EXIT_CODE.USAGE)}warnings.push(`close_validation_active_children:${metadata.id}:${activeChildIds.join(",")}`)}return warnings}if(activeChildIds.length>0){warnings.push(`closed_with_active_children:${metadata.id}:${activeChildIds.join(",")}`)}return warnings}function applyCloseReason(metadata,closeReason){if(closeReason!==void 0){metadata.close_reason=closeReason;return["close_reason"]}return[]}function clearCloseAssignee(metadata){if(metadata.assignee===void 0){return[]}delete metadata.assignee;return["assignee"]}function mutateCloseMetadata(metadata,context){if(isTerminalStatus(metadata.status,context.statusRegistry)&&!context.force){throw new PmCliError(`Item ${metadata.id} is already terminal; use pm update to append acceptance evidence, or --force only for an intentional repeat closure.`,EXIT_CODE.CONFLICT,{recovery:closeEvidenceRecovery(metadata,context.pmRoot,context.options)})}const inlineChangedFields=applyInlineCloseFields(metadata,context.options);const duplicateFallbackFields=applyDuplicateCloseMetadata(metadata,context.duplicateOf);const mutationWarnings=collectCloseValidationWarnings(metadata,context.validateCloseMode,context.activeChildIds,context.pmRoot);metadata.status=context.statusRegistry.close_status;metadata.closed_at=context.closedAt;const shouldWriteCompletedAt=context.options.completedAt!==void 0||metadata.completed_at===void 0;if(shouldWriteCompletedAt){metadata.completed_at=context.completedAt}const changedFields=["status","closed_at",...shouldWriteCompletedAt?["completed_at"]:[],...applyCloseReason(metadata,context.closeReason),...inlineChangedFields];if(shouldCompletePlanOnClose(metadata)){metadata.plan_mode="completed";changedFields.push("plan_mode")}if(context.duplicateOf!==void 0){changedFields.push("duplicate_of");for(const key of duplicateFallbackFields){if(!changedFields.includes(key)){changedFields.push(key)}}}changedFields.push(...clearCloseAssignee(metadata));const blockerCleanup=applyTerminalOrderingPolicy(metadata,context.lifecyclePolicy);changedFields.push(...blockerCleanup.changedFields);mutationWarnings.push(...blockerCleanup.warnings);return{changedFields,...mutationWarnings.length>0?{warnings:mutationWarnings}:{}}}const _testOnlyCloseCommand={blockedByIds:collectBlockedByIds};async function closeItem(id,closeReasonText,options,global2){const pmRoot=resolvePmRoot(process.cwd(),global2.path);await assertInitializedTracker(pmRoot);const settings=await readSettings(pmRoot);const statusRegistry=resolveRuntimeStatusRegistry(settings.schema);const author=resolveAuthor(options.author,settings.author_default);const typeToFolder=resolveItemTypeRegistry(settings,getActiveExtensionRegistrations()).type_to_folder;const located=await locateItem(pmRoot,id,settings.id_prefix,settings.item_format,typeToFolder);if(!located){throw await buildItemNotFoundError(pmRoot,id,settings.id_prefix,typeToFolder)}const duplicateOf=await assertDuplicateTargetExists(pmRoot,settings,options.duplicateOf,located.id);const lifecyclePolicy={requireCloseReason:options.lifecyclePolicy?.requireCloseReason??settings.governance.require_close_reason,orderingEdges:options.lifecyclePolicy?.orderingEdges??"preserve"};const closeReason=requireTerminalReason({explicit:closeReasonText,duplicateOf,resolution:options.resolution,message:options.message},lifecyclePolicy.requireCloseReason).closeReason;const validateCloseMode=parseValidateCloseMode(options.validateClose)??settings.governance.close_validation_default;const trackerItems=await listAllItemMetadataLight(pmRoot,settings.item_format,typeToFolder,void 0,settings.schema);const activeChildIds=findActiveChildIds(trackerItems,located.id,statusRegistry);const closedAt=nowIso();const completedAt=options.completedAt===void 0?closedAt:resolveIsoOrRelative(options.completedAt,new Date(closedAt),"completed-at");const result=await mutateItem({pmRoot,settings,id:located.id,op:"close",author,message:options.message,force:options.force,mutate(document){return mutateCloseMetadata(document.metadata,{pmRoot,statusRegistry,force:options.force,options,duplicateOf,validateCloseMode,activeChildIds,closeReason,closedAt,completedAt,lifecyclePolicy})}});const recovery=validateCloseMode==="warn"?closeEvidenceRecovery(result.item,pmRoot):void 0;return{item:toItemRecord(result.item),changed_fields:result.changedFields,...recovery?{recovery}:{},warnings:[...result.warnings,...await autoUnblockResolvedDependents(pmRoot,settings,trackerItems,located.id,author,statusRegistry)]}}function runClose(id,closeReasonText,options,global2){return closeItem(id,closeReasonText,options,global2)}export{_testOnlyCloseCommand,closeItem,runClose};
|
|
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]="ab15186d-b8bc-5740-bc16-d5af1eeeaa02")}catch{}})();import{assertInitializedTracker}from"../environment/tracker-preflight.js";import{toItemRecord,isTerminalStatus,resolveItemTypeRegistry,resolveRuntimeStatusRegistry,EXIT_CODE,PmCliError,buildItemNotFoundError,listAllItemMetadataLight,locateItem,mutateItem,readLocatedItem,resolvePmRoot,readSettings,resolveAuthor,resolveIsoOrRelative,shouldCompletePlanOnClose,getActiveExtensionRegistrations}from"../runtime-primitives.js";import{collectBlockedByIds,indexBlockedByIds}from"../actionability.js";import{applyTerminalOrderingPolicy,requireTerminalReason}from"../lifecycle-policy.js";import{nowIso}from"../../core/shared/time.js";import{renderPmCommand}from"../command-line.js";const CLOSE_VALIDATION_FIELDS=[{key:"resolution",label:"resolution (--resolution)"},{key:"expected_result",label:"expected_result (--expected-result)"},{key:"actual_result",label:"actual_result (--actual-result)"}];function parseValidateCloseMode(raw){if(raw===void 0)return;const normalized=raw.trim().toLowerCase();if(normalized.length===0||normalized==="warn")return"warn";if(normalized==="off"||normalized==="none"||normalized==="disabled")return"off";if(normalized==="strict")return"strict";throw new PmCliError(`Invalid --validate-close mode "${raw}" (expected "off", "warn", or "strict")`,EXIT_CODE.USAGE)}function findMissingCloseValidationFields(itemMetadata){const missing=[];for(const field of CLOSE_VALIDATION_FIELDS){const rawValue=itemMetadata[field.key];(typeof rawValue!="string"||rawValue.trim().length===0)&&missing.push(field)}return missing}function closeEvidenceRecovery(metadata,pmRoot,options={}){const missing=findMissingCloseValidationFields(metadata);if(missing.length===0)return;const values={resolution:options.resolution,expected_result:options.expectedResult,actual_result:options.actualResult},missingFlags=missing.map(field=>`--${field.key.replaceAll("_","-")}`),args=["--pm-path",pmRoot,"update",metadata.id,...missing.flatMap((field,index)=>[missingFlags[index],values[field.key]?.trim()||"<value>"])];return{missing:missingFlags,suggested_retry:renderPmCommand(args),suggested_retry_args:args}}async function duplicateChainReferencesClosingItem(loadItemById,initialDuplicateOf,closingId){const visited=new Set;let current=initialDuplicateOf;for(;typeof current=="string"&¤t.trim().length>0;){const currentId=current.trim();if(currentId===closingId)return!0;if(visited.has(currentId))return!1;visited.add(currentId),current=(await loadItemById(currentId))?.duplicate_of}return!1}function shouldApplyDuplicateFallback(value){return typeof value!="string"||value.trim().length===0}async function assertDuplicateTargetExists(pmRoot,settings,duplicateOf,closingId){const rawTarget=duplicateOf?.trim();if(!rawTarget)return;if(rawTarget===closingId)throw new PmCliError("An item cannot be closed as a duplicate of itself.",EXIT_CODE.USAGE,{code:"duplicate_target_self",why:"--duplicate-of must identify the canonical item that should remain open or already represent the work."});const typeRegistry=resolveItemTypeRegistry(settings,getActiveExtensionRegistrations()),itemCache=new Map,loadItemById=async id=>{if(itemCache.has(id))return itemCache.get(id)??null;const located=await locateItem(pmRoot,id,settings.id_prefix,settings.item_format,typeRegistry.type_to_folder);if(!located)return itemCache.set(id,null),null;const{document}=await readLocatedItem(located,{schema:settings.schema});return itemCache.set(id,document.metadata),document.metadata},target=await loadItemById(rawTarget);if(!target)throw new PmCliError(`Duplicate target "${rawTarget}" was not found. Create or locate the canonical item first.`,EXIT_CODE.USAGE,{code:"duplicate_target_missing",why:"Duplicate closure should point at a real canonical pm item so future dedupe and changelog tooling can trace the relationship.",examples:[`pm close ${closingId} "Duplicate of ${rawTarget}" --duplicate-of ${rawTarget}`],nextSteps:["Run pm search/list to find the canonical item, then retry with --duplicate-of <id>."]});if(await duplicateChainReferencesClosingItem(loadItemById,target.duplicate_of,closingId))throw new PmCliError(`Circular duplicate reference detected. Target "${rawTarget}" points back to "${closingId}".`,EXIT_CODE.USAGE,{code:"duplicate_target_circular",why:"Circular duplicate relationships create loops for dedupe and status propagation tooling.",nextSteps:["Choose the existing canonical item, or clear the target duplicate_of metadata before closing this item as a duplicate."]});if(typeof target.duplicate_of=="string"&&target.duplicate_of.trim().length>0)throw new PmCliError(`Duplicate target "${rawTarget}" is already marked as a duplicate of "${target.duplicate_of.trim()}".`,EXIT_CODE.USAGE,{code:"duplicate_target_is_duplicate",why:"Duplicate closure should point directly at the canonical item, not another duplicate.",examples:[`pm close ${closingId} "Duplicate of ${target.duplicate_of.trim()}" --duplicate-of ${target.duplicate_of.trim()}`],nextSteps:["Use the canonical item referenced by duplicate_of as the --duplicate-of target."]});return target.id}function findActiveChildIds(items,parentId,statusRegistry){return items.filter(item=>item.parent===parentId&&!isTerminalStatus(item.status,statusRegistry)).map(item=>item.id).sort((left,right)=>left.localeCompare(right))}function findAutoUnblockCandidates(items,closedId,statusRegistry){const itemsById=new Map(items.map(item=>[item.id.trim().toLowerCase(),item])),blockerIdsByItem=indexBlockedByIds(items),normalizedClosedId=closedId.trim().toLowerCase(),blockedStatuses=statusRegistry.blocked_statuses;return items.filter(item=>blockedStatuses.has(item.status)).map(item=>({item,blockerIds:blockerIdsByItem.get(item.id.trim().toLowerCase())})).filter(({blockerIds})=>blockerIds.includes(normalizedClosedId)).filter(({blockerIds})=>blockerIds.every(blockerId=>{if(blockerId===normalizedClosedId)return!0;const blocker=itemsById.get(blockerId);return blocker!==void 0&&isTerminalStatus(blocker.status,statusRegistry)})).map(({item,blockerIds})=>({id:item.id,blocker_ids:blockerIds})).sort((left,right)=>left.id.localeCompare(right.id))}async function autoUnblockResolvedDependents(pmRoot,settings,items,closedId,author,statusRegistry){const candidates=findAutoUnblockCandidates(items,closedId,statusRegistry),warnings=[];for(const candidate of candidates)try{const unblocked=await mutateItem({pmRoot,settings,id:candidate.id,op:"update",author,message:`Auto-unblocked after blocker ${closedId} closed`,mutate(document){const dependencies=document.metadata.dependencies??[],remainingDependencies=dependencies.filter(dependency=>{const dependencyId=dependency.id.trim().toLowerCase();return dependency.kind!=="blocked_by"||!candidate.blocker_ids.includes(dependencyId)});document.metadata.status=statusRegistry.open_status,delete document.metadata.blocked_by,delete document.metadata.blocked_reason,document.metadata.unblock_note=`Auto-unblocked after blocker ${closedId} closed; all blockers resolved (${candidate.blocker_ids.join(", ")}).`,remainingDependencies.length>0?document.metadata.dependencies=remainingDependencies:delete document.metadata.dependencies;const changedFields=["status","blocked_by","blocked_reason","unblock_note"];return remainingDependencies.length!==dependencies.length&&changedFields.push("dependencies"),{changedFields}}});warnings.push(`auto_unblocked:${unblocked.item.id}:resolved_blockers=${candidate.blocker_ids.join(",")}`)}catch(error){const reason=error instanceof Error?error.message.replace(/\s+/g," ").trim():"unknown";warnings.push(`auto_unblock_failed:${candidate.id}:${reason}`)}return warnings}function applyInlineCloseFields(metadata,options){const changedFields=[],inlineCloseFields=[{option:options.resolution,key:"resolution"},{option:options.expectedResult,key:"expected_result"},{option:options.actualResult,key:"actual_result"}];for(const{option,key}of inlineCloseFields){if(typeof option!="string")continue;const trimmed=option.trim();trimmed.length!==0&&(metadata[key]=trimmed,changedFields.push(key))}return changedFields}function applyDuplicateCloseMetadata(metadata,duplicateOf){if(duplicateOf===void 0)return[];metadata.duplicate_of=duplicateOf;const duplicateFallbackFields=[],fallbackValues=[{key:"resolution",value:`Duplicate of ${duplicateOf}`},{key:"expected_result",value:`Canonical item ${duplicateOf} tracks the work.`},{key:"actual_result",value:`Closed as duplicate of ${duplicateOf}.`}];for(const{key,value}of fallbackValues)shouldApplyDuplicateFallback(metadata[key])&&(metadata[key]=value,duplicateFallbackFields.push(key));return duplicateFallbackFields}function collectCloseValidationWarnings(metadata,validateCloseMode,activeChildIds,pmRoot){const warnings=[];if(validateCloseMode!=="off"){const missingFields=findMissingCloseValidationFields(metadata);if(missingFields.length>0){const missingLabels=missingFields.map(field=>field.label);if(validateCloseMode==="strict"){const missingFlags=missingFields.map(field=>`--${field.key.replaceAll("_","-")}`),updateTokens=["--pm-path",pmRoot,"update",metadata.id,...missingFlags.flatMap(flag=>[flag,"<value>"])];throw new PmCliError(`Cannot close item ${metadata.id}: missing ${missingLabels.join(", ")}. Populate fields or use --validate-close warn.`,EXIT_CODE.USAGE,{code:"close_validation_missing_fields",recovery:{missing:missingFlags,suggested_retry:renderPmCommand(updateTokens)},nextSteps:["Run the suggested pm update, then retry the original pm close invocation.","Use --validate-close warn only when governance permits an evidenced exception."]})}warnings.push(`close_validation_missing_fields:${metadata.id}:${missingLabels.join(",")}`)}if(activeChildIds.length>0){if(validateCloseMode==="strict")throw new PmCliError(`Cannot close item ${metadata.id}: active child items remain open (${activeChildIds.join(", ")}). Close, cancel, or re-parent them first, or use --validate-close warn.`,EXIT_CODE.USAGE);warnings.push(`close_validation_active_children:${metadata.id}:${activeChildIds.join(",")}`)}return warnings}return activeChildIds.length>0&&warnings.push(`closed_with_active_children:${metadata.id}:${activeChildIds.join(",")}`),warnings}function applyCloseReason(metadata,closeReason){return closeReason!==void 0?(metadata.close_reason=closeReason,["close_reason"]):[]}function clearCloseAssignee(metadata){return metadata.assignee===void 0?[]:(delete metadata.assignee,["assignee"])}function mutateCloseMetadata(metadata,context){if(isTerminalStatus(metadata.status,context.statusRegistry)&&!context.force)throw new PmCliError(`Item ${metadata.id} is already terminal; use pm update to append acceptance evidence, or --force only for an intentional repeat closure.`,EXIT_CODE.CONFLICT,{recovery:closeEvidenceRecovery(metadata,context.pmRoot,context.options)});const inlineChangedFields=applyInlineCloseFields(metadata,context.options),duplicateFallbackFields=applyDuplicateCloseMetadata(metadata,context.duplicateOf),mutationWarnings=collectCloseValidationWarnings(metadata,context.validateCloseMode,context.activeChildIds,context.pmRoot);metadata.status=context.statusRegistry.close_status,metadata.closed_at=context.closedAt;const shouldWriteCompletedAt=context.options.completedAt!==void 0||metadata.completed_at===void 0;shouldWriteCompletedAt&&(metadata.completed_at=context.completedAt);const changedFields=["status","closed_at",...shouldWriteCompletedAt?["completed_at"]:[],...applyCloseReason(metadata,context.closeReason),...inlineChangedFields];if(shouldCompletePlanOnClose(metadata)&&(metadata.plan_mode="completed",changedFields.push("plan_mode")),context.duplicateOf!==void 0){changedFields.push("duplicate_of");for(const key of duplicateFallbackFields)changedFields.includes(key)||changedFields.push(key)}changedFields.push(...clearCloseAssignee(metadata));const blockerCleanup=applyTerminalOrderingPolicy(metadata,context.lifecyclePolicy);return changedFields.push(...blockerCleanup.changedFields),mutationWarnings.push(...blockerCleanup.warnings),{changedFields,...mutationWarnings.length>0?{warnings:mutationWarnings}:{}}}const _testOnlyCloseCommand={blockedByIds:collectBlockedByIds};async function closeItem(id,closeReasonText,options,global2){const pmRoot=resolvePmRoot(process.cwd(),global2.path);await assertInitializedTracker(pmRoot);const settings=await readSettings(pmRoot),statusRegistry=resolveRuntimeStatusRegistry(settings.schema),author=resolveAuthor(options.author,settings.author_default),typeToFolder=resolveItemTypeRegistry(settings,getActiveExtensionRegistrations()).type_to_folder,located=await locateItem(pmRoot,id,settings.id_prefix,settings.item_format,typeToFolder);if(!located)throw await buildItemNotFoundError(pmRoot,id,settings.id_prefix,typeToFolder);const duplicateOf=await assertDuplicateTargetExists(pmRoot,settings,options.duplicateOf,located.id),lifecyclePolicy={requireCloseReason:options.lifecyclePolicy?.requireCloseReason??settings.governance.require_close_reason,orderingEdges:options.lifecyclePolicy?.orderingEdges??"preserve"},closeReason=requireTerminalReason({explicit:closeReasonText,duplicateOf,resolution:options.resolution,message:options.message},lifecyclePolicy.requireCloseReason).closeReason,validateCloseMode=parseValidateCloseMode(options.validateClose)??settings.governance.close_validation_default,trackerItems=await listAllItemMetadataLight(pmRoot,settings.item_format,typeToFolder,void 0,settings.schema),activeChildIds=findActiveChildIds(trackerItems,located.id,statusRegistry),closedAt=nowIso(),completedAt=options.completedAt===void 0?closedAt:resolveIsoOrRelative(options.completedAt,new Date(closedAt),"completed-at"),result=await mutateItem({pmRoot,settings,id:located.id,op:"close",author,message:options.message,force:options.force,mutate(document){return mutateCloseMetadata(document.metadata,{pmRoot,statusRegistry,force:options.force,options,duplicateOf,validateCloseMode,activeChildIds,closeReason,closedAt,completedAt,lifecyclePolicy})}}),recovery=validateCloseMode==="warn"?closeEvidenceRecovery(result.item,pmRoot):void 0;return{item:toItemRecord(result.item),changed_fields:result.changedFields,...recovery?{recovery}:{},warnings:[...result.warnings,...await autoUnblockResolvedDependents(pmRoot,settings,trackerItems,located.id,author,statusRegistry)]}}function runClose(id,closeReasonText,options,global2){return closeItem(id,closeReasonText,options,global2)}export{_testOnlyCloseCommand,closeItem,runClose};
|
|
2
2
|
//# sourceMappingURL=close.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
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]="902e9f78-a2c1-59bb-aaa2-763576d5c68b")}catch{}})();import{assertInitializedTracker}from"../environment/tracker-preflight.js";import{removeFileIfExists,writeFileAtomic,appendHistoryEntry,createHistoryEntry,generateItemId,canonicalDocument,serializeItemDocument,acquireLock,getActiveExtensionRegistrations,projectAfterCommandItemSnapshot,recordAfterCommandAffectedItem,runActiveOnWriteHooks,collectRegisteredItemFieldNames,resolveRuntimeStatusRegistry,EXIT_CODE,ITEM_METADATA_KEY_ORDER,nowIso,PmCliError,resolveItemTypeRegistry,buildItemNotFoundError,locateItem,readLocatedItem,getHistoryPath,getItemPath,resolvePmRoot,readSettings,resolveAuthor}from"../runtime-primitives.js";import{evaluateSimilarityGovernance,similarityAdvisoryWarnings}from"../similarity.js";import{acquireItemMetadataDerivedIndexLock,refreshItemMetadataDerivedIndex}from"../item-metadata-index.js";function buildChangedFields(itemMetadata,body){return[...new Set([...ITEM_METADATA_KEY_ORDER.filter(key=>itemMetadata[key]!==void 0),...Object.keys(itemMetadata).filter(key=>itemMetadata[key]!==void 0),...body.length>0?["body"]:[]])].sort((left,right)=>left.localeCompare(right))}function buildCopyMessage(sourceId,message){const suffix=`copied_from=${sourceId}`;if(!message)return suffix;const trimmed=message.trim();return trimmed.length>0?`${trimmed} | ${suffix}`:suffix}async function runCopy(sourceId,options,global2){const pmRoot=resolvePmRoot(process.cwd(),global2.path);await assertInitializedTracker(pmRoot);const settings=await readSettings(pmRoot),typeRegistry=resolveItemTypeRegistry(settings,getActiveExtensionRegistrations()),located=await locateItem(pmRoot,sourceId,settings.id_prefix,settings.item_format,typeRegistry.type_to_folder);if(!located)throw await buildItemNotFoundError(pmRoot,sourceId,settings.id_prefix,typeRegistry.type_to_folder);const sourceLoaded=await readLocatedItem(located,{schema:settings.schema}),sourceMetadata=sourceLoaded.document.metadata,copiedAt=nowIso(),author=resolveAuthor(options.author,settings.author_default),newId=await generateItemId(pmRoot,settings.id_prefix,{tokenLength:settings.ids.token_length,typeToFolder:typeRegistry.type_to_folder,probeExisting:!1}),statusRegistry=resolveRuntimeStatusRegistry(settings.schema),titleOverride=options.title?.trim();if(titleOverride!==void 0&&titleOverride.length===0)throw new PmCliError("Copy --title must not be empty",EXIT_CODE.USAGE);const copiedMetadata={...sourceMetadata,id:newId,title:titleOverride??sourceMetadata.title,status:statusRegistry.open_status,created_at:copiedAt,updated_at:copiedAt};delete copiedMetadata.closed_at,delete copiedMetadata.completed_at,delete copiedMetadata.close_reason,delete copiedMetadata.test_runs;const extensionFieldNames=collectRegisteredItemFieldNames(getActiveExtensionRegistrations()),copiedDocument=canonicalDocument({metadata:copiedMetadata,body:sourceLoaded.document.body},{schema:settings.schema,extensionFieldNames}),similarityAdvisory=await evaluateSimilarityGovernance({title:copiedDocument.metadata.title,description:copiedDocument.metadata.description,body:copiedDocument.body,excludeIds:[located.id]},{pmRoot,mode:settings.governance.duplicate_detection_mode==="strict"&&options.allowDuplicate!==!0?"off":settings.governance.duplicate_detection_mode,threshold:settings.governance.duplicate_detection_threshold,limit:settings.governance.duplicate_detection_limit,allowDuplicate:options.allowDuplicate}),changedFields=buildChangedFields(copiedDocument.metadata,copiedDocument.body),itemPath=getItemPath(pmRoot,copiedDocument.metadata.type,newId,settings.item_format,typeRegistry.type_to_folder),historyPath=getHistoryPath(pmRoot,newId),lockRelease=await acquireLock(pmRoot,newId,settings.locks.ttl_seconds,author,!1,settings.governance.force_required_for_stale_lock,settings.locks.wait_ms),beforeDocument={metadata:{},body:""};let hookWarnings,derivedIndexWarnings;try{const releaseDerivedIndexLock=await acquireItemMetadataDerivedIndexLock(pmRoot,author,{required:settings.governance.duplicate_detection_mode==="strict"&&options.allowDuplicate!==!0});try{settings.governance.duplicate_detection_mode==="strict"&&options.allowDuplicate!==!0&&await evaluateSimilarityGovernance({title:copiedDocument.metadata.title,description:copiedDocument.metadata.description,body:copiedDocument.body,excludeIds:[located.id]},{pmRoot,mode:"strict",threshold:settings.governance.duplicate_detection_threshold,limit:settings.governance.duplicate_detection_limit,allowDuplicate:!1});const collision=await locateItem(pmRoot,newId,settings.id_prefix,settings.item_format,typeRegistry.type_to_folder);if(collision)throw new PmCliError(`Cannot copy to ${newId}: an item with that id already exists at ${collision.itemPath}. Retry the copy to allocate a new id.`,EXIT_CODE.CONFLICT,{code:"item_id_collision",why:`Allocated id ${newId} already exists at ${collision.itemPath}.`,recovery:{suggested_retry:`pm copy ${located.id}`}});await writeFileAtomic(itemPath,serializeItemDocument(copiedDocument,{format:settings.item_format,schema:settings.schema,extensionFieldNames}));try{const historyEntry=createHistoryEntry({nowIso:copiedAt,author,op:"create",before:beforeDocument,after:copiedDocument,message:buildCopyMessage(located.id,options.message)});await appendHistoryEntry(historyPath,historyEntry)}catch(error){throw await removeFileIfExists(itemPath),error}derivedIndexWarnings=await refreshItemMetadataDerivedIndex({pmRoot,preferredFormat:settings.item_format,typeToFolder:typeRegistry.type_to_folder,schema:settings.schema,itemPath,document:copiedDocument})}finally{await releaseDerivedIndexLock()}hookWarnings=[...await runActiveOnWriteHooks({path:itemPath,scope:"project",op:"create",item_id:copiedDocument.metadata.id,item_type:copiedDocument.metadata.type,before:beforeDocument,after:copiedDocument,changed_fields:changedFields}),...await runActiveOnWriteHooks({path:historyPath,scope:"project",op:"create:history",item_id:copiedDocument.metadata.id,item_type:copiedDocument.metadata.type,before:beforeDocument,after:copiedDocument,changed_fields:changedFields})],recordAfterCommandAffectedItem({id:copiedDocument.metadata.id,op:"create",item_type:copiedDocument.metadata.type,status:copiedDocument.metadata.status,current:projectAfterCommandItemSnapshot(copiedDocument.metadata,changedFields),changed_fields:changedFields})}finally{await lockRelease()}return{source_id:located.id,item:structuredClone(copiedDocument.metadata),changed_fields:changedFields,warnings:[...similarityAdvisoryWarnings(similarityAdvisory),...derivedIndexWarnings,...hookWarnings],...similarityAdvisory===void 0?{}:{similarity_advisory:similarityAdvisory}}}export{runCopy};
|
|
2
2
|
//# sourceMappingURL=copy.js.map
|