@unbrained/pm-cli 2026.10.11 → 2026.10.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +45 -0
- package/dist/cli/after-command-context-usage.d.ts +8 -8
- package/dist/cli/bundle-integrity.d.ts +23 -23
- package/dist/cli/commander-usage.d.ts +31 -31
- package/dist/cli/commander-usage.js +3 -3
- package/dist/cli/error-guidance.d.ts +158 -161
- package/dist/cli/error-guidance.js +2 -2
- package/dist/cli/extension-command-help.d.ts +68 -68
- package/dist/cli/extension-command-options.d.ts +20 -20
- package/dist/cli/extension-recovery.d.ts +20 -20
- package/dist/cli/help-content.d.ts +16 -16
- package/dist/cli/help-content.js +2 -2
- package/dist/cli/help-json-payload.d.ts +40 -40
- package/dist/cli/help-json-payload.js +1 -1
- package/dist/cli/invocation-profile.d.ts +8 -8
- package/dist/cli/main.d.ts +166 -165
- package/dist/cli/main.js +4 -4
- package/dist/cli/migration-gates.d.ts +20 -20
- package/dist/cli/register-list-query.d.ts +4 -4
- package/dist/cli/register-mutation-options.d.ts +2 -2
- package/dist/cli/register-operations.d.ts +68 -63
- package/dist/cli/register-operations.js +1 -1
- package/dist/cli/register-setup.d.ts +1 -1
- package/dist/cli/register-structured-mutation.d.ts +3 -3
- package/dist/cli/register-structured-mutation.js +1 -1
- package/dist/cli/runtime/activation.d.ts +3 -3
- package/dist/cli/runtime/invocation-options.js +1 -1
- package/dist/cli/runtime/selection.d.ts +6 -6
- package/dist/cli/runtime-compatibility-boundary.d.ts +12 -12
- package/dist/cli-bundle/bundle-manifest.json +1 -1
- package/dist/cli-bundle/chunks/{chunk-K2UTE75T.js → chunk-AM2XOZKE.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-S445XEYT.js → chunk-APWPC4ZZ.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-DJDRHJBP.js +234 -0
- package/dist/cli-bundle/chunks/{chunk-RUT3CCAG.js → chunk-DUK5DHI6.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-HXHFKXLV.js +2 -0
- package/dist/cli-bundle/chunks/chunk-IFPJDJUM.js +20 -0
- package/dist/cli-bundle/chunks/{chunk-OBLO45UM.js → chunk-LBDWFWPK.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-ZWRLAOA4.js → chunk-N5EXRYCZ.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-PSNS537F.js +30 -0
- package/dist/cli-bundle/chunks/{chunk-2JYTSTQP.js → chunk-RL45OYTL.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-ESRACL6K.js → chunk-UBTYYZIE.js} +49 -49
- package/dist/cli-bundle/chunks/chunk-WYZGZV2M.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-SSY4OSJR.js → chunk-YH6H3UVE.js} +10 -10
- package/dist/cli-bundle/chunks/{register-list-query-T6BOR67M.js → register-list-query-BJ742QOR.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-6NXR7SAJ.js → register-mutation-GGGBRIH2.js} +3 -3
- package/dist/cli-bundle/chunks/register-operations-E6HXYHNM.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-MAYFPKBX.js → register-setup-4ZVTVEPY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-EIOQNLBQ.js → chunk-3LQEBXU5.js} +12 -12
- package/dist/cli-bundle/focused-chunks/{chunk-PLTTMQAW.js → chunk-6BTUISKV.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-73UNAJHD.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-WAOXID5J.js → chunk-DVK7VKZL.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-SIEGIPNT.js → chunk-F5J3ATMV.js} +16 -16
- package/dist/cli-bundle/focused-chunks/chunk-IIKFTJVC.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-IOTNG6CN.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-AU6VJGTY.js → chunk-KGFRQ34R.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-NNW5BS5L.js +3 -0
- package/dist/cli-bundle/focused-chunks/{chunk-KNJR2WUO.js → chunk-QMNAY25P.js} +62 -62
- package/dist/cli-bundle/focused-chunks/{chunk-W5AE7GKZ.js → chunk-R23T7GFZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-RAA7SVRA.js +8 -0
- package/dist/cli-bundle/focused-chunks/{chunk-52UJEHEV.js → chunk-RU6GCFN3.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-JGFSSR3G.js → chunk-S6ITXQ5T.js} +5 -5
- package/dist/cli-bundle/focused-chunks/{chunk-DMSADMEU.js → chunk-SOB7X4FJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-UPJA45K7.js +26 -0
- package/dist/cli-bundle/main.js +22 -22
- 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 +31 -31
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +51 -51
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +8 -8
- package/dist/cli.d.ts +4 -4
- package/dist/core/checkpoint/checkpoint-gc.d.ts +32 -32
- package/dist/core/checkpoint/mutation-checkpoint.d.ts +34 -34
- package/dist/core/config/nested-settings.d.ts +26 -26
- package/dist/core/config/positional-value.d.ts +16 -16
- package/dist/core/diagnostics/remediation.d.ts +6 -6
- package/dist/core/diagnostics/remediation.js +1 -1
- package/dist/core/extensions/activation-summary-markdown.d.ts +6 -6
- package/dist/core/extensions/activation-summary.d.ts +54 -54
- package/dist/core/extensions/activation-transaction.d.ts +7 -7
- package/dist/core/extensions/capability-usage.d.ts +26 -26
- package/dist/core/extensions/command-hook-context.d.ts +26 -26
- package/dist/core/extensions/contribution-inventory.d.ts +21 -21
- package/dist/core/extensions/extension-candidate.d.ts +14 -14
- package/dist/core/extensions/extension-capability-aliases.d.ts +2 -2
- package/dist/core/extensions/extension-policy.d.ts +80 -80
- package/dist/core/extensions/extension-types.d.ts +1294 -1285
- package/dist/core/extensions/extension-types.js +1 -1
- package/dist/core/extensions/flag-definition-validation.d.ts +4 -4
- package/dist/core/extensions/item-fields.d.ts +3 -2
- package/dist/core/extensions/item-fields.js +1 -1
- package/dist/core/extensions/loader.d.ts +36 -36
- package/dist/core/extensions/loader.js +1 -1
- package/dist/core/extensions/manifest-schema.d.ts +16 -16
- package/dist/core/extensions/module-graph-snapshot.d.ts +8 -8
- package/dist/core/extensions/read-output-contract.d.ts +5 -0
- package/dist/core/extensions/read-output-contract.js +2 -0
- package/dist/core/extensions/registration-values.d.ts +1 -1
- package/dist/core/extensions/reserved-host-flags.d.ts +6 -6
- package/dist/core/extensions/version-compat.d.ts +10 -10
- package/dist/core/fs/fs-utils.d.ts +1 -1
- package/dist/core/fs/host-environment-errors.d.ts +14 -14
- package/dist/core/governance/content-fields.d.ts +31 -31
- package/dist/core/governance/issue-codes.d.ts +27 -27
- package/dist/core/governance/metadata-coverage.d.ts +91 -91
- package/dist/core/history/drift-scan.d.ts +26 -26
- package/dist/core/history/event-classification.d.ts +1 -1
- package/dist/core/history/event-classification.js +1 -1
- package/dist/core/history/event-index.d.ts +41 -41
- package/dist/core/history/history-compact-bulk.d.ts +22 -22
- package/dist/core/history/history-diff.d.ts +22 -22
- package/dist/core/history/history-rewrite.d.ts +66 -66
- package/dist/core/history/history-storage-stats.d.ts +31 -31
- package/dist/core/history/history-stream-policy.d.ts +12 -12
- package/dist/core/history/history.d.ts +22 -22
- package/dist/core/history/identity.d.ts +6 -6
- package/dist/core/history/operation-contract.d.ts +9 -9
- package/dist/core/history/projection.d.ts +15 -15
- package/dist/core/history/read.d.ts +4 -4
- package/dist/core/history/replay.d.ts +51 -49
- package/dist/core/history/replay.js +1 -1
- package/dist/core/history/workspace-history.d.ts +101 -101
- package/dist/core/io/bulk-ids-input.d.ts +4 -4
- package/dist/core/item/actionability.d.ts +40 -40
- package/dist/core/item/id.d.ts +3 -3
- package/dist/core/item/item-format-version.d.ts +8 -8
- package/dist/core/item/item-format.d.ts +37 -35
- package/dist/core/item/item-format.js +2 -2
- package/dist/core/item/item-type-definition.d.ts +2 -2
- package/dist/core/item/parent-reference-policy.d.ts +1 -1
- package/dist/core/item/parse.d.ts +12 -12
- package/dist/core/item/sprint-release-format.d.ts +2 -2
- package/dist/core/item/status-filter.d.ts +4 -4
- package/dist/core/item/toon-decode.d.ts +9 -9
- package/dist/core/item/type-registry.d.ts +40 -40
- package/dist/core/lock/lock-gc.d.ts +50 -50
- package/dist/core/lock/lock.d.ts +37 -37
- package/dist/core/output/mutation-projection.d.ts +6 -6
- package/dist/core/output/output-control.d.ts +4 -4
- package/dist/core/output/output.d.ts +40 -40
- package/dist/core/output/query-summary.d.ts +5 -5
- package/dist/core/packages/manifest.d.ts +50 -50
- package/dist/core/policy/workflow-policy-schema.d.ts +306 -306
- package/dist/core/policy/workflow-policy-store.d.ts +7 -7
- package/dist/core/policy/workflow-policy.d.ts +81 -81
- package/dist/core/profile/profile-describe.d.ts +40 -40
- package/dist/core/profile/profile-lint.d.ts +20 -20
- package/dist/core/profile/profile-plan.d.ts +84 -84
- package/dist/core/profile/profile-presets.d.ts +52 -52
- package/dist/core/reproducibility/context.d.ts +6 -6
- package/dist/core/schema/fields-file.d.ts +54 -54
- package/dist/core/schema/item-types-file.d.ts +36 -36
- package/dist/core/schema/runtime-field-values.d.ts +2 -2
- package/dist/core/schema/runtime-schema.d.ts +86 -86
- package/dist/core/schema/status-defs-file.d.ts +36 -36
- package/dist/core/schema/type-inference.d.ts +14 -14
- package/dist/core/schema/type-workflows.d.ts +22 -22
- package/dist/core/search/background-refresh.d.ts +9 -9
- package/dist/core/search/bm25.d.ts +19 -19
- package/dist/core/search/cache.d.ts +35 -35
- package/dist/core/search/corpus.d.ts +12 -12
- package/dist/core/search/embedding-batches.d.ts +48 -48
- package/dist/core/search/eval.d.ts +49 -49
- package/dist/core/search/http-client.d.ts +38 -38
- package/dist/core/search/providers.d.ts +41 -41
- package/dist/core/search/relevance.d.ts +20 -20
- package/dist/core/search/semantic-defaults.d.ts +8 -8
- package/dist/core/search/staleness.d.ts +4 -4
- package/dist/core/search/vector-stores.d.ts +78 -78
- package/dist/core/search/vectorization-metadata.d.ts +6 -6
- package/dist/core/sentry/helpers.d.ts +15 -15
- package/dist/core/sentry/instrument.d.ts +40 -40
- package/dist/core/session/session-state.d.ts +32 -32
- package/dist/core/shared/agent-session-context.d.ts +14 -14
- package/dist/core/shared/author.d.ts +128 -128
- package/dist/core/shared/command-types.d.ts +40 -40
- package/dist/core/shared/conflict-markers.d.ts +6 -6
- package/dist/core/shared/constants.d.ts +13 -13
- package/dist/core/shared/errors.d.ts +194 -183
- package/dist/core/shared/errors.js +1 -1
- package/dist/core/shared/secret-rules.d.ts +97 -97
- package/dist/core/shared/serial-queue.d.ts +8 -8
- package/dist/core/shared/split-comma-list.d.ts +6 -6
- package/dist/core/shared/time.d.ts +23 -23
- package/dist/core/store/item-format-migration.d.ts +10 -10
- package/dist/core/store/item-metadata-cache.d.ts +38 -38
- package/dist/core/store/item-metadata-query-index.d.ts +79 -79
- package/dist/core/store/item-metadata-read-work.d.ts +6 -6
- package/dist/core/store/item-store.d.ts +110 -110
- package/dist/core/store/paths.d.ts +2 -2
- package/dist/core/store/settings-read-cache.d.ts +12 -12
- package/dist/core/store/settings-validator.d.ts +165 -165
- package/dist/core/store/settings.d.ts +59 -59
- package/dist/core/telemetry/observability.d.ts +17 -17
- package/dist/core/telemetry/policy.d.ts +3 -3
- package/dist/core/telemetry/runtime.d.ts +242 -242
- package/dist/core/telemetry/runtime.js +2 -2
- package/dist/core/test/background-runs.d.ts +186 -185
- package/dist/core/test/background-runs.js +2 -2
- package/dist/core/test/item-test-run-tracking.d.ts +6 -6
- package/dist/core/test/run-selectors.d.ts +18 -18
- package/dist/core/validate/fix-planning.d.ts +50 -50
- package/dist/core/validate/missing-by-type.d.ts +4 -4
- package/dist/core/validate/missing-link-owners.d.ts +30 -30
- package/dist/core/validate/stale-file-classification.d.ts +8 -8
- package/dist/mcp/http-server.d.ts +28 -28
- package/dist/mcp/legacy-adapter.d.ts +33 -33
- package/dist/mcp/runtime-capabilities.d.ts +16 -16
- package/dist/mcp/server.d.ts +50 -50
- package/dist/mcp/tool-definitions.d.ts +36 -36
- package/dist/sdk/agent/closed-domain-contracts.d.ts +18 -18
- package/dist/sdk/agent/command-recovery.d.ts +4 -0
- package/dist/sdk/agent/command-recovery.js +1 -1
- package/dist/sdk/agent/command-suggestions.d.ts +2 -0
- package/dist/sdk/agent/command-suggestions.js +1 -1
- package/dist/sdk/agent/identity-config.d.ts +32 -32
- package/dist/sdk/agent/item-addressing.d.ts +8 -8
- package/dist/sdk/agent/refusal-closure-census.d.ts +34 -34
- package/dist/sdk/agent/refusal-closure.d.ts +42 -42
- package/dist/sdk/agent/refusal-corpus-contracts.d.ts +46 -46
- package/dist/sdk/agent/refusal-reachability.d.ts +112 -112
- package/dist/sdk/agent/subcommand-recovery.d.ts +25 -25
- package/dist/sdk/agent/task-transcript-contracts.d.ts +30 -30
- package/dist/sdk/agent/tracker-preflight-contracts.d.ts +38 -38
- package/dist/sdk/agent-capability-contracts.d.ts +37 -37
- package/dist/sdk/annotations.d.ts +106 -106
- package/dist/sdk/author-attribution.d.ts +76 -76
- package/dist/sdk/authoring.d.ts +1 -1
- package/dist/sdk/authoring.js +1 -1
- package/dist/sdk/cli-bootstrap.d.ts +70 -70
- package/dist/sdk/cli-contracts/agent-output-contracts.d.ts +63 -63
- package/dist/sdk/cli-contracts/command-aliases.d.ts +14 -14
- package/dist/sdk/cli-contracts/command-exit-contracts.d.ts +70 -70
- package/dist/sdk/cli-contracts/commander-types.d.ts +17 -17
- package/dist/sdk/cli-contracts/completeness.d.ts +26 -26
- package/dist/sdk/cli-contracts/enum-contracts.d.ts +5 -5
- package/dist/sdk/cli-contracts/flag-contracts.d.ts +32 -32
- package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.d.ts +42 -42
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -1
- package/dist/sdk/cli-contracts/grammar-contracts.d.ts +84 -84
- package/dist/sdk/cli-contracts/grammar-contracts.js +1 -1
- package/dist/sdk/cli-contracts/registration-helpers.d.ts +37 -40
- package/dist/sdk/cli-contracts/registration-helpers.js +1 -1
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +290 -294
- package/dist/sdk/cli-contracts/runtime-contracts.js +1 -1
- package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +793 -793
- package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +391 -391
- package/dist/sdk/cli-contracts/tool-parameter-tables.d.ts +6 -6
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
- package/dist/sdk/cli-contracts/tool-schema.d.ts +55 -55
- package/dist/sdk/cli-contracts/tool-schema.js +1 -1
- package/dist/sdk/cli-contracts/typed-action-inputs.d.ts +24 -24
- package/dist/sdk/comments.d.ts +44 -44
- package/dist/sdk/compile-cache.d.ts +4 -4
- package/dist/sdk/completion/shared.d.ts +22 -22
- package/dist/sdk/compose.d.ts +156 -156
- package/dist/sdk/config.d.ts +123 -123
- package/dist/sdk/context/semantic-session-attribution.d.ts +14 -14
- package/dist/sdk/context/usage-ledger.d.ts +20 -20
- package/dist/sdk/context-intent-contracts.d.ts +50 -50
- package/dist/sdk/context-intent-contracts.js +1 -1
- package/dist/sdk/context-intent-runtime.d.ts +8 -8
- package/dist/sdk/context-packing.d.ts +78 -78
- package/dist/sdk/context-relevance.d.ts +189 -180
- package/dist/sdk/context-relevance.js +1 -1
- package/dist/sdk/context-signal-store.d.ts +84 -84
- package/dist/sdk/context-usage.d.ts +92 -92
- package/dist/sdk/core.d.ts +1 -0
- package/dist/sdk/core.js +1 -1
- package/dist/sdk/corpus-shape.d.ts +101 -101
- package/dist/sdk/define.d.ts +2 -2
- package/dist/sdk/dependencies.d.ts +116 -116
- package/dist/sdk/dependency-flag-validation.d.ts +14 -12
- package/dist/sdk/dependency-flag-validation.js +1 -1
- package/dist/sdk/dependency-provenance.d.ts +30 -30
- package/dist/sdk/docs.d.ts +32 -32
- package/dist/sdk/duplicates.d.ts +21 -21
- package/dist/sdk/environment/agent-environment.d.ts +196 -196
- package/dist/sdk/environment/project-runtime-compatibility.d.ts +56 -56
- package/dist/sdk/environment/source-context.d.ts +6 -6
- package/dist/sdk/error-code-catalog.d.ts +40 -40
- package/dist/sdk/errors.d.ts +29 -29
- package/dist/sdk/eval.d.ts +45 -45
- package/dist/sdk/extension/author-manifest.d.ts +14 -14
- package/dist/sdk/extension/bundled-catalog.d.ts +7 -7
- package/dist/sdk/extension/describe.d.ts +36 -36
- package/dist/sdk/extension/doctor.d.ts +29 -29
- package/dist/sdk/extension/install-plan.d.ts +55 -55
- package/dist/sdk/extension/install-receipts.d.ts +2 -2
- package/dist/sdk/extension/install-runtime.d.ts +8 -8
- package/dist/sdk/extension/install-snapshot.d.ts +14 -14
- package/dist/sdk/extension/install-sources.d.ts +96 -96
- package/dist/sdk/extension/managed-state.d.ts +66 -66
- package/dist/sdk/extension/migrations.d.ts +82 -82
- package/dist/sdk/extension/output-ownership.d.ts +24 -24
- package/dist/sdk/extension/runtime-summary.d.ts +5 -5
- package/dist/sdk/extension/scaffold.d.ts +12 -12
- package/dist/sdk/extension/shared.d.ts +15 -15
- package/dist/sdk/extension/source-resolution.d.ts +30 -30
- package/dist/sdk/extension/static-inventory.d.ts +42 -42
- package/dist/sdk/extension/update-check.d.ts +10 -10
- package/dist/sdk/extension.d.ts +320 -320
- package/dist/sdk/files.d.ts +157 -157
- package/dist/sdk/flag-invocation-contracts.d.ts +44 -44
- 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/governance/artifact-ledgers.d.ts +35 -35
- package/dist/sdk/governance/artifact-ledgers.js +1 -1
- package/dist/sdk/governance/assurance-action.d.ts +68 -68
- package/dist/sdk/governance/assurance-action.js +1 -1
- package/dist/sdk/governance/assurance-mutation-error.d.ts +36 -36
- package/dist/sdk/governance/assurance-presets.d.ts +24 -24
- package/dist/sdk/governance/assurance-runtime.d.ts +14 -14
- package/dist/sdk/governance/assurance.d.ts +353 -353
- package/dist/sdk/governance/boundary-fixtures.d.ts +60 -60
- package/dist/sdk/governance/closure-timestamps.d.ts +9 -9
- package/dist/sdk/governance/coverage-assurance.d.ts +10 -10
- package/dist/sdk/governance/defect-recurrence-coverage.d.ts +75 -75
- package/dist/sdk/governance/defect-recurrence-graph.d.ts +18 -18
- package/dist/sdk/governance/defect-recurrence.d.ts +186 -181
- package/dist/sdk/governance/defect-recurrence.js +1 -1
- package/dist/sdk/governance/extension-host-version.d.ts +16 -16
- package/dist/sdk/governance/gc.d.ts +48 -48
- package/dist/sdk/governance/health-merge-evidence.d.ts +5 -5
- package/dist/sdk/governance/health.d.ts +188 -188
- package/dist/sdk/governance/hierarchy-validation.d.ts +13 -13
- package/dist/sdk/governance/linked-file-report.d.ts +26 -26
- package/dist/sdk/governance/merge-receipt-history.d.ts +36 -36
- package/dist/sdk/governance/provenance-health.d.ts +64 -64
- package/dist/sdk/governance/reindex.d.ts +89 -89
- package/dist/sdk/governance/reliability.d.ts +56 -56
- package/dist/sdk/governance/stale-work.d.ts +22 -22
- package/dist/sdk/governance/status-role-diagnostics.d.ts +12 -12
- package/dist/sdk/governance/storage-integrity.d.ts +54 -54
- package/dist/sdk/governance/tracked-runtime-cache.d.ts +10 -10
- package/dist/sdk/governance/upgrade.d.ts +104 -104
- package/dist/sdk/governance/validate-history-drift.d.ts +2 -2
- package/dist/sdk/governance/validate-item-reader.d.ts +6 -6
- package/dist/sdk/governance/validate.d.ts +191 -191
- package/dist/sdk/governance/workflow-completeness.d.ts +15 -15
- package/dist/sdk/governance/workflow-policy.d.ts +28 -28
- package/dist/sdk/governance/workspace-position.d.ts +46 -46
- package/dist/sdk/graph/adapter.d.ts +66 -66
- package/dist/sdk/graph/analytics.d.ts +54 -54
- package/dist/sdk/graph/assembly.d.ts +80 -80
- package/dist/sdk/graph/cache.d.ts +29 -29
- package/dist/sdk/graph/cardinality-integrity.d.ts +13 -0
- package/dist/sdk/graph/cardinality-integrity.js +2 -0
- package/dist/sdk/graph/centrality.d.ts +34 -34
- package/dist/sdk/graph/conformance.d.ts +33 -33
- package/dist/sdk/graph/deadline-scheduling.d.ts +58 -58
- package/dist/sdk/graph/durable-cache.d.ts +26 -26
- package/dist/sdk/graph/governance.d.ts +165 -165
- package/dist/sdk/graph/hierarchy-integrity.d.ts +52 -52
- package/dist/sdk/graph/index.d.ts +1 -0
- package/dist/sdk/graph/index.js +1 -1
- package/dist/sdk/graph/lifecycle-coverage.d.ts +17 -17
- package/dist/sdk/graph/mutation-advisory.d.ts +11 -11
- package/dist/sdk/graph/query-contracts.d.ts +10 -10
- package/dist/sdk/graph/remediation.d.ts +25 -25
- package/dist/sdk/graph/run.d.ts +392 -392
- package/dist/sdk/graph/scheduling.d.ts +38 -38
- package/dist/sdk/graph/traversal.d.ts +14 -14
- package/dist/sdk/guide-topics.d.ts +32 -32
- package/dist/sdk/guide.d.ts +62 -62
- package/dist/sdk/history/attestation-command.d.ts +12 -12
- package/dist/sdk/history/attestation-contract.d.ts +78 -78
- package/dist/sdk/history/attestation-scan.d.ts +6 -6
- package/dist/sdk/history/maintenance.d.ts +46 -46
- package/dist/sdk/history/salvage.d.ts +18 -18
- package/dist/sdk/history/subject.d.ts +9 -9
- package/dist/sdk/history-analytics.d.ts +84 -84
- package/dist/sdk/history-compact.d.ts +103 -103
- package/dist/sdk/history-mcp.d.ts +8 -8
- package/dist/sdk/history-provenance.d.ts +59 -59
- package/dist/sdk/history-read.d.ts +36 -36
- package/dist/sdk/history-redact.d.ts +78 -78
- package/dist/sdk/history-repair.d.ts +158 -158
- package/dist/sdk/history-repair.js +1 -1
- package/dist/sdk/improvement-ledger.d.ts +102 -102
- package/dist/sdk/index.d.ts +2 -0
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/init-agent-guidance.d.ts +70 -70
- package/dist/sdk/init.d.ts +152 -152
- package/dist/sdk/item-children.d.ts +28 -28
- package/dist/sdk/item-schedule.d.ts +12 -12
- package/dist/sdk/item-transaction.d.ts +100 -100
- package/dist/sdk/learnings.d.ts +42 -42
- package/dist/sdk/lifecycle/append.d.ts +14 -14
- package/dist/sdk/lifecycle/claim.d.ts +60 -60
- package/dist/sdk/lifecycle/close-many.d.ts +94 -94
- package/dist/sdk/lifecycle/close.d.ts +27 -27
- package/dist/sdk/lifecycle/copy.d.ts +18 -18
- package/dist/sdk/lifecycle/core-field-recovery.d.ts +7 -0
- package/dist/sdk/lifecycle/core-field-recovery.js +2 -0
- package/dist/sdk/lifecycle/create.d.ts +82 -82
- package/dist/sdk/lifecycle/create.js +1 -1
- package/dist/sdk/lifecycle/delete.d.ts +28 -28
- package/dist/sdk/lifecycle/focus.d.ts +10 -10
- package/dist/sdk/lifecycle/hierarchy-mutation-lock.d.ts +10 -10
- package/dist/sdk/lifecycle/hierarchy-mutation-lock.js +1 -1
- package/dist/sdk/lifecycle/legacy-none-tokens.d.ts +54 -54
- package/dist/sdk/lifecycle/lifecycle-transitions.d.ts +4 -4
- package/dist/sdk/lifecycle/mcp-actions.d.ts +10 -10
- package/dist/sdk/lifecycle/mutation-command-options.d.ts +116 -116
- package/dist/sdk/lifecycle/mutation-facet-contracts.d.ts +6 -0
- package/dist/sdk/lifecycle/mutation-facet-contracts.js +2 -0
- package/dist/sdk/lifecycle/plan-mutation-receipt.d.ts +42 -42
- package/dist/sdk/lifecycle/plan.d.ts +217 -217
- package/dist/sdk/lifecycle/reopen.d.ts +29 -24
- package/dist/sdk/lifecycle/reopen.js +1 -1
- package/dist/sdk/lifecycle/repeatable-metadata-parsers.d.ts +3 -3
- package/dist/sdk/lifecycle/restore.d.ts +33 -33
- package/dist/sdk/lifecycle/shared-unset-fields.d.ts +19 -19
- package/dist/sdk/lifecycle/task-composition.d.ts +4 -4
- package/dist/sdk/lifecycle/update-many.d.ts +79 -79
- package/dist/sdk/lifecycle/update.d.ts +131 -132
- package/dist/sdk/lifecycle/update.js +2 -2
- package/dist/sdk/lifecycle-completion.d.ts +22 -22
- package/dist/sdk/lifecycle-policy.d.ts +52 -52
- package/dist/sdk/linked-artifacts.d.ts +69 -69
- package/dist/sdk/mcp/apps.d.ts +32 -32
- package/dist/sdk/mcp/authorization.d.ts +76 -76
- package/dist/sdk/mcp/discovery.d.ts +111 -111
- package/dist/sdk/mcp/interactions.d.ts +61 -61
- package/dist/sdk/mcp/protocol.d.ts +78 -78
- package/dist/sdk/mcp/skills.d.ts +88 -88
- package/dist/sdk/mcp/subscriptions.d.ts +39 -39
- package/dist/sdk/mcp/tasks.d.ts +75 -75
- package/dist/sdk/mcp/transport.d.ts +11 -11
- package/dist/sdk/merge/abandoned-receipts.d.ts +6 -6
- package/dist/sdk/merge/driver.d.ts +60 -60
- package/dist/sdk/merge/install.d.ts +64 -64
- package/dist/sdk/merge/receipt-file-boundary.d.ts +5 -5
- package/dist/sdk/merge/receipt-operation.d.ts +6 -6
- package/dist/sdk/merge/receipt-schema.d.ts +2 -2
- package/dist/sdk/merge/receipts.d.ts +156 -156
- package/dist/sdk/merge/reconcile.d.ts +36 -36
- package/dist/sdk/merge/reconcile.js +1 -1
- package/dist/sdk/merge/three-way.d.ts +77 -76
- package/dist/sdk/merge/three-way.js +1 -1
- package/dist/sdk/mutation-events.d.ts +84 -84
- package/dist/sdk/mutation-guard.d.ts +106 -106
- package/dist/sdk/notes.d.ts +52 -52
- package/dist/sdk/output/table-rows.d.ts +8 -8
- package/dist/sdk/output-contracts.d.ts +38 -38
- package/dist/sdk/output-projection.d.ts +142 -142
- package/dist/sdk/output-token-accounting.d.ts +27 -27
- package/dist/sdk/output.d.ts +28 -28
- package/dist/sdk/package-import-adapters.d.ts +54 -54
- package/dist/sdk/pagination.d.ts +29 -29
- package/dist/sdk/profile.d.ts +123 -123
- package/dist/sdk/provenance.d.ts +58 -58
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query/activity.d.ts +118 -118
- package/dist/sdk/query/aggregate.d.ts +140 -140
- package/dist/sdk/query/calendar.d.ts +144 -144
- package/dist/sdk/query/complete-list.d.ts +53 -53
- package/dist/sdk/query/context.d.ts +395 -395
- package/dist/sdk/query/duplicate-candidates.d.ts +1 -1
- package/dist/sdk/query/get.d.ts +77 -77
- package/dist/sdk/query/history.d.ts +72 -72
- package/dist/sdk/query/item-filter-options.d.ts +79 -79
- package/dist/sdk/query/list-filter-shared.d.ts +1 -1
- package/dist/sdk/query/list.d.ts +188 -188
- package/dist/sdk/query/multi-value-filters.d.ts +4 -4
- package/dist/sdk/query/next-ready-budget.d.ts +14 -14
- package/dist/sdk/query/next.d.ts +137 -137
- package/dist/sdk/query/projection-contracts.d.ts +8 -8
- package/dist/sdk/query/search/corpus.d.ts +8 -8
- package/dist/sdk/query/search/filters.d.ts +5 -5
- package/dist/sdk/query/search/input.d.ts +4 -4
- package/dist/sdk/query/search/response.d.ts +8 -8
- package/dist/sdk/query/search/semantic.d.ts +106 -106
- package/dist/sdk/query/search/types.d.ts +85 -85
- package/dist/sdk/query/search-contracts.d.ts +65 -65
- package/dist/sdk/query/search-pagination.d.ts +19 -19
- package/dist/sdk/query/search-rendering.d.ts +25 -25
- package/dist/sdk/query/search.d.ts +46 -46
- package/dist/sdk/read-output/continuation.d.ts +8 -8
- package/dist/sdk/read-output/continuation.js +1 -1
- package/dist/sdk/read-output/extension.d.ts +7 -0
- package/dist/sdk/read-output/extension.js +2 -0
- package/dist/sdk/read-output/options.d.ts +6 -4
- package/dist/sdk/read-output/options.js +1 -1
- package/dist/sdk/read-output/provenance.d.ts +8 -8
- package/dist/sdk/read-output-budget.d.ts +10 -10
- package/dist/sdk/read-output-contracts.d.ts +192 -186
- package/dist/sdk/read-output-contracts.js +1 -1
- package/dist/sdk/read-output-rows.d.ts +6 -6
- package/dist/sdk/read-output-session.d.ts +50 -50
- package/dist/sdk/relationship-analytics.d.ts +78 -78
- package/dist/sdk/relationship-context.d.ts +81 -81
- package/dist/sdk/relationship-history.d.ts +109 -109
- package/dist/sdk/relationship-kinds/contract.d.ts +34 -34
- package/dist/sdk/relationship-migration.d.ts +26 -26
- package/dist/sdk/relationships.d.ts +78 -78
- package/dist/sdk/reproducibility/process.d.ts +3 -3
- package/dist/sdk/runtime/context.d.ts +11 -11
- package/dist/sdk/runtime-action-aliases.d.ts +2 -2
- package/dist/sdk/runtime-extended-actions.d.ts +8 -8
- package/dist/sdk/runtime-input.d.ts +3 -3
- package/dist/sdk/runtime-public-contracts.d.ts +78 -78
- package/dist/sdk/runtime.d.ts +305 -305
- package/dist/sdk/runtime.js +1 -1
- package/dist/sdk/scheduling-shortcuts.d.ts +32 -32
- package/dist/sdk/schema-migration.d.ts +86 -86
- package/dist/sdk/schema.d.ts +355 -355
- package/dist/sdk/similarity-scoring.d.ts +10 -10
- package/dist/sdk/similarity.d.ts +113 -113
- package/dist/sdk/stats.d.ts +108 -108
- package/dist/sdk/structured-mutations.d.ts +16 -16
- package/dist/sdk/structured-mutations.js +1 -1
- package/dist/sdk/telemetry.d.ts +53 -53
- package/dist/sdk/templates.d.ts +39 -39
- package/dist/sdk/test/batch.d.ts +85 -85
- package/dist/sdk/test/batch.js +1 -1
- package/dist/sdk/test/command-args.d.ts +4 -0
- package/dist/sdk/test/command-args.js +2 -0
- package/dist/sdk/test/entry.d.ts +3 -0
- package/dist/sdk/test/entry.js +1 -1
- package/dist/sdk/test/execution-receipts.d.ts +3 -3
- package/dist/sdk/test/execution.d.ts +279 -268
- package/dist/sdk/test/execution.js +2 -2
- package/dist/sdk/test/json-path.d.ts +2 -2
- package/dist/sdk/test/linked-command-detection.d.ts +10 -10
- package/dist/sdk/test/measurements.d.ts +11 -11
- package/dist/sdk/test/parsers.d.ts +1 -1
- package/dist/sdk/test/parsers.js +1 -1
- package/dist/sdk/test/prerequisites.d.ts +6 -0
- package/dist/sdk/test/prerequisites.js +2 -0
- package/dist/sdk/test/runs.d.ts +52 -52
- package/dist/sdk/test/trust.d.ts +12 -12
- package/dist/sdk/test/trust.js +1 -1
- package/dist/sdk/test/update.d.ts +55 -0
- package/dist/sdk/test/update.js +2 -0
- package/dist/sdk/testing.d.ts +319 -319
- package/dist/sdk/traceability/source-traceability.d.ts +65 -65
- package/dist/sdk/workspace-contracts.d.ts +37 -37
- package/dist/sdk/workspace-memory.d.ts +60 -60
- package/dist/sdk/workspace-recipe.d.ts +9 -9
- package/dist/sdk/workspace-snapshot.d.ts +97 -97
- package/dist/sdk/workspace-transaction-gc.d.ts +32 -32
- package/dist/sdk/workspace-transaction.d.ts +47 -47
- package/dist/sdk/workspace.d.ts +6 -6
- package/dist/types.d.ts +978 -974
- package/dist/types.js +1 -1
- package/docs/BUILD_AND_RELEASE_ACCEPTANCE.md +5 -2
- package/docs/DEFECT_RECURRENCE.md +12 -0
- package/docs/EXTENSIONS.md +2 -2
- package/docs/LINKED_TEST_EDITS.md +79 -0
- package/docs/MERGE_SAFETY.md +27 -1
- package/docs/RECURRENCE_RECOVERY_CONTRACTS.md +17 -4
- package/docs/RELATIONSHIP_GRAPH.md +26 -0
- package/docs/RELEASING.md +25 -8
- package/docs/SDK.md +204 -637
- package/docs/SDK_CONSUMER_RECEIPTS.md +67 -0
- package/docs/SDK_EVIDENCE_TRACEABILITY.md +4 -0
- package/docs/TESTING.md +13 -0
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +2 -2
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +11 -3
- package/docs/performance/runner-qualification.md +36 -0
- package/marketplace.json +1 -1
- package/node_modules/@opentelemetry/core/build/esm/version.d.ts +1 -1
- package/node_modules/@opentelemetry/core/build/esm/version.js +1 -1
- package/node_modules/@opentelemetry/core/build/esnext/version.d.ts +1 -1
- package/node_modules/@opentelemetry/core/build/esnext/version.js +1 -1
- package/node_modules/@opentelemetry/core/build/src/version.d.ts +1 -1
- package/node_modules/@opentelemetry/core/build/src/version.js +1 -1
- package/node_modules/@opentelemetry/core/package.json +2 -2
- package/node_modules/@opentelemetry/resources/build/esm/version.d.ts +1 -1
- package/node_modules/@opentelemetry/resources/build/esm/version.js +1 -1
- package/node_modules/@opentelemetry/resources/build/esnext/version.d.ts +1 -1
- package/node_modules/@opentelemetry/resources/build/esnext/version.js +1 -1
- package/node_modules/@opentelemetry/resources/build/src/version.d.ts +1 -1
- package/node_modules/@opentelemetry/resources/build/src/version.js +1 -1
- package/node_modules/@opentelemetry/resources/package.json +3 -3
- package/node_modules/@opentelemetry/sdk-trace/build/esm/StackContextManager.d.ts +57 -0
- package/node_modules/@opentelemetry/sdk-trace/build/esm/StackContextManager.js +105 -0
- package/node_modules/@opentelemetry/sdk-trace/build/esm/index.d.ts +1 -0
- package/node_modules/@opentelemetry/sdk-trace/build/esm/index.js +1 -0
- package/node_modules/@opentelemetry/sdk-trace/build/esm/version.d.ts +1 -1
- package/node_modules/@opentelemetry/sdk-trace/build/esm/version.js +1 -1
- package/node_modules/@opentelemetry/sdk-trace/build/esnext/StackContextManager.d.ts +57 -0
- package/node_modules/@opentelemetry/sdk-trace/build/esnext/StackContextManager.js +105 -0
- package/node_modules/@opentelemetry/sdk-trace/build/esnext/index.d.ts +1 -0
- package/node_modules/@opentelemetry/sdk-trace/build/esnext/index.js +1 -0
- package/node_modules/@opentelemetry/sdk-trace/build/esnext/version.d.ts +1 -1
- package/node_modules/@opentelemetry/sdk-trace/build/esnext/version.js +1 -1
- package/node_modules/@opentelemetry/sdk-trace/build/src/StackContextManager.d.ts +57 -0
- package/node_modules/@opentelemetry/sdk-trace/build/src/StackContextManager.js +109 -0
- package/node_modules/@opentelemetry/sdk-trace/build/src/index.d.ts +1 -0
- package/node_modules/@opentelemetry/sdk-trace/build/src/index.js +3 -1
- package/node_modules/@opentelemetry/sdk-trace/build/src/version.d.ts +1 -1
- package/node_modules/@opentelemetry/sdk-trace/build/src/version.js +1 -1
- package/node_modules/@opentelemetry/sdk-trace/package.json +5 -5
- package/node_modules/@opentelemetry/sdk-trace-base/build/esm/version.d.ts +1 -1
- package/node_modules/@opentelemetry/sdk-trace-base/build/esm/version.js +1 -1
- package/node_modules/@opentelemetry/sdk-trace-base/build/esnext/version.d.ts +1 -1
- package/node_modules/@opentelemetry/sdk-trace-base/build/esnext/version.js +1 -1
- package/node_modules/@opentelemetry/sdk-trace-base/build/src/version.d.ts +1 -1
- package/node_modules/@opentelemetry/sdk-trace-base/build/src/version.js +1 -1
- package/node_modules/@opentelemetry/sdk-trace-base/package.json +7 -7
- package/node_modules/@sentry/core/build/cjs/browser.js +3 -0
- package/node_modules/@sentry/core/build/cjs/fetch.js +10 -9
- package/node_modules/@sentry/core/build/cjs/index.js +3 -0
- package/node_modules/@sentry/core/build/cjs/integrations/http/add-outgoing-request-breadcrumb.js +2 -1
- package/node_modules/@sentry/core/build/cjs/integrations/http/get-outgoing-span-data.js +3 -2
- package/node_modules/@sentry/core/build/cjs/integrations/http/server-subscription.js +7 -3
- package/node_modules/@sentry/core/build/cjs/integrations/requestdata.js +23 -9
- package/node_modules/@sentry/core/build/cjs/server.js +3 -0
- package/node_modules/@sentry/core/build/cjs/utils/data-collection/filterCollectedUrl.js +24 -0
- package/node_modules/@sentry/core/build/cjs/utils/data-collection/filterKeyValueData.js +17 -23
- package/node_modules/@sentry/core/build/cjs/utils/data-collection/filterQueryParams.js +8 -15
- package/node_modules/@sentry/core/build/cjs/utils/data-collection/filterUrlQuery.js +20 -0
- package/node_modules/@sentry/core/build/cjs/utils/url.js +4 -3
- package/node_modules/@sentry/core/build/cjs/utils/version.js +1 -1
- package/node_modules/@sentry/core/build/esm/browser.js +1 -0
- package/node_modules/@sentry/core/build/esm/fetch.js +10 -9
- package/node_modules/@sentry/core/build/esm/index.js +1 -0
- package/node_modules/@sentry/core/build/esm/integrations/http/add-outgoing-request-breadcrumb.js +2 -1
- package/node_modules/@sentry/core/build/esm/integrations/http/get-outgoing-span-data.js +3 -2
- package/node_modules/@sentry/core/build/esm/integrations/http/server-subscription.js +7 -3
- package/node_modules/@sentry/core/build/esm/integrations/requestdata.js +23 -9
- package/node_modules/@sentry/core/build/esm/package.json +1 -1
- package/node_modules/@sentry/core/build/esm/server.js +1 -0
- package/node_modules/@sentry/core/build/esm/utils/data-collection/filterCollectedUrl.js +21 -0
- package/node_modules/@sentry/core/build/esm/utils/data-collection/filterKeyValueData.js +18 -25
- package/node_modules/@sentry/core/build/esm/utils/data-collection/filterQueryParams.js +9 -16
- package/node_modules/@sentry/core/build/esm/utils/data-collection/filterUrlQuery.js +18 -0
- package/node_modules/@sentry/core/build/esm/utils/url.js +4 -3
- package/node_modules/@sentry/core/build/esm/utils/version.js +1 -1
- package/node_modules/@sentry/core/build/types/shared-exports.d.ts +1 -0
- package/node_modules/@sentry/core/build/types/utils/data-collection/filterCollectedUrl.d.ts +21 -0
- package/node_modules/@sentry/core/build/types/utils/data-collection/filterKeyValueData.d.ts +1 -0
- package/node_modules/@sentry/core/build/types/utils/data-collection/filterQueryParams.d.ts +2 -3
- package/node_modules/@sentry/core/build/types/utils/data-collection/filterUrlQuery.d.ts +13 -0
- package/node_modules/@sentry/core/build/types/utils/url.d.ts +4 -1
- package/node_modules/@sentry/core/build/types-ts3.8/shared-exports.d.ts +1 -0
- package/node_modules/@sentry/core/build/types-ts3.8/utils/data-collection/filterCollectedUrl.d.ts +21 -0
- package/node_modules/@sentry/core/build/types-ts3.8/utils/data-collection/filterKeyValueData.d.ts +1 -0
- package/node_modules/@sentry/core/build/types-ts3.8/utils/data-collection/filterQueryParams.d.ts +2 -3
- package/node_modules/@sentry/core/build/types-ts3.8/utils/data-collection/filterUrlQuery.d.ts +13 -0
- package/node_modules/@sentry/core/build/types-ts3.8/utils/url.d.ts +4 -1
- package/node_modules/@sentry/core/package.json +3 -2
- package/node_modules/@sentry/node/build/cjs/integrations/tracing/vercelai/instrumentation.js +3 -0
- package/node_modules/@sentry/node/build/esm/integrations/tracing/vercelai/instrumentation.js +3 -0
- package/node_modules/@sentry/node/build/esm/package.json +1 -1
- package/node_modules/@sentry/node/package.json +7 -6
- package/node_modules/@sentry/node-core/build/cjs/integrations/anr/index.js +1 -1
- package/node_modules/@sentry/node-core/build/cjs/integrations/http/httpServerSpansIntegration.js +6 -3
- package/node_modules/@sentry/node-core/build/cjs/integrations/local-variables/local-variables-async.js +1 -1
- package/node_modules/@sentry/node-core/build/cjs/integrations/node-fetch/undici-instrumentation.js +2 -2
- package/node_modules/@sentry/node-core/build/cjs/light/client.js +7 -0
- package/node_modules/@sentry/node-core/build/cjs/sdk/client.js +7 -0
- package/node_modules/@sentry/node-core/build/cjs/utils/outgoingFetchRequest.js +1 -1
- package/node_modules/@sentry/node-core/build/esm/integrations/anr/index.js +1 -1
- package/node_modules/@sentry/node-core/build/esm/integrations/anr/worker-script.js +2 -2
- package/node_modules/@sentry/node-core/build/esm/integrations/http/httpServerSpansIntegration.js +7 -4
- package/node_modules/@sentry/node-core/build/esm/integrations/local-variables/local-variables-async.js +1 -1
- package/node_modules/@sentry/node-core/build/esm/integrations/local-variables/worker-script.js +1 -1
- package/node_modules/@sentry/node-core/build/esm/integrations/node-fetch/undici-instrumentation.js +3 -3
- package/node_modules/@sentry/node-core/build/esm/light/client.js +8 -1
- package/node_modules/@sentry/node-core/build/esm/package.json +1 -1
- package/node_modules/@sentry/node-core/build/esm/sdk/client.js +8 -1
- package/node_modules/@sentry/node-core/build/esm/utils/outgoingFetchRequest.js +2 -2
- package/node_modules/@sentry/node-core/build/types/light/client.d.ts +1 -0
- package/node_modules/@sentry/node-core/build/types/sdk/client.d.ts +1 -0
- package/node_modules/@sentry/node-core/build/types-ts3.8/light/client.d.ts +1 -0
- package/node_modules/@sentry/node-core/build/types-ts3.8/sdk/client.d.ts +1 -0
- package/node_modules/@sentry/node-core/package.json +5 -4
- package/node_modules/@sentry/opentelemetry/build/cjs/{asyncContextStrategy-BJ5buq_A.js → asyncContextStrategy-BR-l9zjD.js} +8 -6
- package/node_modules/@sentry/opentelemetry/build/cjs/index.browser.js +1 -1
- package/node_modules/@sentry/opentelemetry/build/cjs/index.js +1 -1
- package/node_modules/@sentry/opentelemetry/build/esm/{asyncContextStrategy-Bx5F5tCX.js → asyncContextStrategy-BQfM_LMv.js} +9 -7
- package/node_modules/@sentry/opentelemetry/build/esm/index.browser.js +1 -1
- package/node_modules/@sentry/opentelemetry/build/esm/index.js +2 -2
- package/node_modules/@sentry/opentelemetry/build/esm/package.json +1 -1
- package/node_modules/@sentry/opentelemetry/package.json +4 -3
- package/node_modules/@sentry/server-utils/build/cjs/tracing-channel.js +1 -0
- package/node_modules/@sentry/server-utils/build/esm/package.json +1 -1
- package/node_modules/@sentry/server-utils/build/esm/tracing-channel.js +1 -0
- package/node_modules/@sentry/server-utils/build/types/tracing-channel.d.ts +3 -1
- package/node_modules/@sentry/server-utils/build/types-ts3.8/tracing-channel.d.ts +3 -1
- package/node_modules/@sentry/server-utils/package.json +4 -3
- package/node_modules/cjs-module-lexer/README.md +8 -3
- package/node_modules/cjs-module-lexer/dist/lexer.js +1 -1
- package/node_modules/cjs-module-lexer/dist/lexer.mjs +2 -2
- package/node_modules/cjs-module-lexer/lexer.js +48 -9
- package/node_modules/cjs-module-lexer/package.json +3 -2
- package/node_modules/es-module-lexer/dist/lexer.asm.js +2 -2
- package/node_modules/es-module-lexer/dist/lexer.cjs +1 -1
- package/node_modules/es-module-lexer/dist/lexer.js +2 -2
- package/node_modules/es-module-lexer/dist/lexer.minimal.asm.js +2 -2
- package/node_modules/es-module-lexer/dist/lexer.minimal.cjs +1 -1
- package/node_modules/es-module-lexer/dist/lexer.minimal.js +2 -2
- package/node_modules/es-module-lexer/package.json +1 -1
- package/node_modules/import-in-the-middle/CHANGELOG.md +7 -0
- package/node_modules/import-in-the-middle/lib/get-esm-exports.mjs +7 -0
- package/node_modules/import-in-the-middle/package.json +1 -1
- package/package.json +2 -2
- package/packages/pm-beads/extensions/beads/runtime.ts +2 -2
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/package.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +1 -1
- package/plugins/pm-codex/plugin.json +1 -1
- package/runtime-dependencies.json +1 -1
- package/scripts/finalize-build.mjs +37 -0
- package/dist/cli-bundle/chunks/chunk-BXSXT5Z6.js +0 -2
- package/dist/cli-bundle/chunks/chunk-KNW3RSLS.js +0 -30
- package/dist/cli-bundle/chunks/chunk-MEWBSWE3.js +0 -2
- package/dist/cli-bundle/chunks/chunk-RBPOO46D.js +0 -20
- package/dist/cli-bundle/chunks/chunk-YMLF6QT7.js +0 -234
- package/dist/cli-bundle/chunks/register-operations-PDOBQZUJ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-2CJWTLQG.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-B3YW6H2I.js +0 -26
- package/dist/cli-bundle/focused-chunks/chunk-GVGFUD52.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-MJQ253F3.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-PBCYGO7X.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-WOEZJUA2.js +0 -2
package/dist/core/item/id.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare function clampIdTokenLength(value: number | undefined): number;
|
|
|
22
22
|
* m*(m-1)/(2*(36^L-n)) below the tolerated per-sync collision probability.
|
|
23
23
|
*/
|
|
24
24
|
export declare function generateItemId(pmRoot: string, prefix: string, options?: {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
tokenLength?: number;
|
|
26
|
+
typeToFolder?: Readonly<Record<string, string>>;
|
|
27
|
+
probeExisting?: boolean;
|
|
28
28
|
}): Promise<string>;
|
|
@@ -57,17 +57,17 @@ export declare function classifyItemFormatVersion(version: number, current?: num
|
|
|
57
57
|
* is stored at, used as input to {@link scanItemFormatVersions}.
|
|
58
58
|
*/
|
|
59
59
|
export interface ItemFormatVersionScanEntry {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
/** Value that configures or reports ref for this contract. */
|
|
61
|
+
ref: string;
|
|
62
|
+
/** Value that configures or reports version for this contract. */
|
|
63
|
+
version: number;
|
|
64
64
|
}
|
|
65
65
|
/** Sorted references partitioned by how their stored format version compares to the runtime's current version. References at the current version are omitted from both lists. */
|
|
66
66
|
export interface ItemFormatVersionScanResult {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
/** Value that configures or reports outdated for this contract. */
|
|
68
|
+
outdated: string[];
|
|
69
|
+
/** Value that configures or reports ahead for this contract. */
|
|
70
|
+
ahead: string[];
|
|
71
71
|
}
|
|
72
72
|
/** Partition a set of items by format version into `outdated` (need migration) and `ahead` (written by a newer pm) reference lists, each sorted for stable diagnostics. Pushing all comparison branches into this pure, exhaustively tested helper lets `pm health` and `pm validate` emit findings by iterating the result lists, with no version-comparison branching of their own. */
|
|
73
73
|
export declare function scanItemFormatVersions(entries: readonly ItemFormatVersionScanEntry[], current?: number): ItemFormatVersionScanResult;
|
|
@@ -3,35 +3,37 @@ import type { ItemFormat } from "../../types/index.js";
|
|
|
3
3
|
import { type RuntimeFieldRegistry, type RuntimeStatusRegistry } from "../schema/runtime-schema.js";
|
|
4
4
|
declare function firstNonZeroComparison(comparisons: readonly number[]): number;
|
|
5
5
|
interface RuntimeSchemaValidationContext {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
statusRegistry?: RuntimeStatusRegistry;
|
|
7
|
+
fieldRegistry?: RuntimeFieldRegistry;
|
|
8
|
+
unknownFieldPolicy: "allow" | "warn" | "reject";
|
|
9
|
+
extensionFieldNames: ReadonlySet<string>;
|
|
10
|
+
onWarning?: (warning: string) => void;
|
|
11
11
|
}
|
|
12
12
|
/** Documents the item document format options payload exchanged by command, SDK, and package integrations. */
|
|
13
13
|
export interface ItemDocumentFormatOptions {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
/** Value that configures or reports format for this contract. */
|
|
15
|
+
format?: ItemFormat;
|
|
16
|
+
/** Value that configures or reports schema for this contract. */
|
|
17
|
+
schema?: RuntimeSchemaSettings;
|
|
18
|
+
/** Value that configures or reports extension field names for this contract. */
|
|
19
|
+
extensionFieldNames?: readonly string[];
|
|
20
|
+
/** Value that configures or reports on warning for this contract. */
|
|
21
|
+
onWarning?: (warning: string) => void;
|
|
22
|
+
/** Refuse ahead-of-runtime markers before metadata validation; raw inspection defaults to preserving them. */
|
|
23
|
+
requireSupportedFormat?: boolean;
|
|
24
24
|
}
|
|
25
25
|
declare function runtimeFieldRequiredForType(definition: RuntimeFieldRegistry["definitions"][number], typeName: string): boolean;
|
|
26
26
|
declare function buildKnownItemMetadataKeys(runtimeContext: RuntimeSchemaValidationContext): Set<string>;
|
|
27
27
|
declare function normalizeTestRunSummaries(values: ItemTestRunSummary[] | undefined): ItemTestRunSummary[] | undefined;
|
|
28
28
|
declare function sortTests(values: LinkedTest[] | undefined): LinkedTest[] | undefined;
|
|
29
|
+
/** Normalize one linked-test entry consistently for storage and metadata comparisons. */
|
|
30
|
+
export declare function normalizeLinkedTest(value: LinkedTest): LinkedTest;
|
|
29
31
|
declare function normalizePlanStepLinks(value: unknown): PlanStepLink[] | undefined;
|
|
30
32
|
declare function normalizePlanStepFiles(value: unknown): PlanStepFile[] | undefined;
|
|
31
33
|
declare function normalizePlanStepTests(value: unknown): {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
command?: string;
|
|
35
|
+
path?: string;
|
|
36
|
+
note?: string;
|
|
35
37
|
}[] | undefined;
|
|
36
38
|
declare function normalizePlanStepDocs(value: unknown): PlanStepDoc[] | undefined;
|
|
37
39
|
declare function normalizePlanSteps(value: unknown): PlanStep[] | undefined;
|
|
@@ -44,8 +46,8 @@ declare function normalizeBody(body: string): string;
|
|
|
44
46
|
export declare function normalizeItemMetadata(itemMetadata: ItemMetadata, options?: Pick<ItemDocumentFormatOptions, "schema" | "extensionFieldNames" | "onWarning">): ItemMetadata;
|
|
45
47
|
/** Implements split front matter for the public runtime surface of this module. */
|
|
46
48
|
export declare function splitFrontMatter(content: string): {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
frontMatter: string;
|
|
50
|
+
body: string;
|
|
49
51
|
};
|
|
50
52
|
/** Implements parse item document for the public runtime surface of this module. */
|
|
51
53
|
export declare function parseItemDocument(content: string, options?: ItemDocumentFormatOptions): ItemDocument;
|
|
@@ -55,20 +57,20 @@ export declare function serializeItemDocument(document: ItemDocument, options?:
|
|
|
55
57
|
export declare function canonicalDocument(document: ItemDocument, options?: Pick<ItemDocumentFormatOptions, "schema" | "extensionFieldNames" | "onWarning">): ItemDocument;
|
|
56
58
|
/** Public contract for test only item format, shared by SDK and presentation-layer consumers. */
|
|
57
59
|
export declare const _testOnlyItemFormat: {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
60
|
+
buildKnownItemMetadataKeys: typeof buildKnownItemMetadataKeys;
|
|
61
|
+
firstNonZeroComparison: typeof firstNonZeroComparison;
|
|
62
|
+
normalizeBody: typeof normalizeBody;
|
|
63
|
+
normalizePlanDecisions: typeof normalizePlanDecisions;
|
|
64
|
+
normalizePlanDiscoveries: typeof normalizePlanDiscoveries;
|
|
65
|
+
normalizePlanStepDocs: typeof normalizePlanStepDocs;
|
|
66
|
+
normalizePlanStepFiles: typeof normalizePlanStepFiles;
|
|
67
|
+
normalizePlanStepLinks: typeof normalizePlanStepLinks;
|
|
68
|
+
normalizePlanSteps: typeof normalizePlanSteps;
|
|
69
|
+
normalizePlanStepTests: typeof normalizePlanStepTests;
|
|
70
|
+
normalizePlanValidation: typeof normalizePlanValidation;
|
|
71
|
+
normalizeTestRunSummaries: typeof normalizeTestRunSummaries;
|
|
72
|
+
normalizeTypeOptions: typeof normalizeTypeOptions;
|
|
73
|
+
runtimeFieldRequiredForType: typeof runtimeFieldRequiredForType;
|
|
74
|
+
sortTests: typeof sortTests;
|
|
73
75
|
};
|
|
74
76
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
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]="e2f15e0b-06b0-5e02-a91e-2886f94ffc63")}catch{}})();import{encode as encodeToon}from"@toon-format/toon";import{isDeepStrictEqual}from"node:util";import{CONFIDENCE_TEXT_VALUES,ISSUE_SEVERITY_VALUES,PLAN_STEP_STATUS_VALUES,RECURRENCE_FREQUENCY_VALUES,RECURRENCE_WEEKDAY_VALUES,STATUS_VALUES,weekdayOrderIndex}from"../../types/index.js";import{coerceRuntimeFieldValue}from"../schema/runtime-field-values.js";import{resolveRuntimeFieldRegistry,resolveRuntimeStatusRegistry}from"../schema/runtime-schema.js";import{BASELINE_ITEM_FORMAT_VERSION,CURRENT_ITEM_FORMAT_VERSION,effectiveItemFormatVersion,normalizeItemFormatVersion}from"./item-format-version.js";import{normalizeStatusInput}from"./status.js";import{decodeToonItemContent}from"./toon-decode.js";import{EXIT_CODE,ITEM_METADATA_KEY_ORDER}from"../shared/constants.js";import{findFirstMergeConflictMarker}from"../shared/conflict-markers.js";import{PmCliError}from"../shared/errors.js";import{orderObject}from"../shared/serialization.js";import{compareTimestampStrings,isTimestampLiteral}from"../shared/time.js";import{coerceFiniteNumber}from"../shared/primitives.js";const LINKED_TEST_PM_CONTEXT_MODE_VALUES=new Set(["schema","tracker","auto","none"]),LINKED_TEST_WORKSPACE_CONTEXT_MODE_VALUES=new Set(["source","isolated","snapshot"]),LINKED_TEST_TRUST_REASON_VALUES=new Set(["legacy","local_mutation","local_source_ref","acknowledged","invalid_provenance","foreign_source_ref"]),ITEM_TEST_RUN_STATUS_VALUES=new Set(["passed","failed","stopped","canceled"]),PLAN_STEP_STATUS_SET=new Set(PLAN_STEP_STATUS_VALUES);function normalizePathValue(value){return value.replaceAll("\\","/")}function firstNonZeroComparison(comparisons){for(const comparison of comparisons)if(comparison!==0)return comparison;return 0}function deleteUndefinedFields(record){for(const[key,value]of Object.entries(record))value===void 0&&delete record[key]}const REQUIRED_STRING_FIELDS=["id","title","description","created_at","updated_at"],STATIC_ITEM_METADATA_FIELD_SET=new Set(ITEM_METADATA_KEY_ORDER);function resolveRuntimeSchemaValidationContext(options){if(options?.schema)return{statusRegistry:resolveRuntimeStatusRegistry(options.schema),fieldRegistry:resolveRuntimeFieldRegistry(options.schema),unknownFieldPolicy:options.schema.unknown_field_policy??"allow",extensionFieldNames:new Set(options.extensionFieldNames??[]),onWarning:options.onWarning}}function runtimeFieldRequiredForType(definition,typeName){return definition.required?definition.required_types.length===0?!0:definition.required_types.map(value=>value.toLowerCase()).includes(typeName.trim().toLowerCase()):!1}function validationError(message){const field=message.match(/^([a-z_][\w.]*)\s/u)?.[1];throw new PmCliError(`Invalid item metadata: ${message}`,EXIT_CODE.GENERIC_FAILURE,{code:"item_document_invalid",reason:message.includes("required")?"missing_required_field":"schema_validation_error",...field?{field}:{},required:"Provide an item document whose metadata satisfies the active runtime schema.",why:message})}function documentSyntaxError(format,message){throw new PmCliError(message,EXIT_CODE.GENERIC_FAILURE,{code:"item_document_invalid",reason:"syntax_error",format,required:`Provide a syntactically valid ${format==="toon"?"TOON":"JSON Markdown"} item document.`,why:"The document could not be decoded far enough to validate item metadata."})}function assertSupportedItemFormat(metadata,required){if(!required||typeof metadata!="object"||metadata===null)return;const formatVersion=effectiveItemFormatVersion(metadata);if(!(formatVersion<=CURRENT_ITEM_FORMAT_VERSION))throw new PmCliError(`Stored item uses format version ${formatVersion}; this runtime supports up to ${CURRENT_ITEM_FORMAT_VERSION}. Upgrade pm before reading or changing this item.`,EXIT_CODE.CONFLICT,{code:"item_format_version_unsupported",format_version:formatVersion,required:"Upgrade to a pm runtime supporting the stored item format.",nextSteps:["Preserve the original item and history; do not lower pm_format_version to bypass compatibility checks."]})}function buildKnownItemMetadataKeys(runtimeContext){const knownKeys=new Set(STATIC_ITEM_METADATA_FIELD_SET);for(const definition of runtimeContext.fieldRegistry?.definitions??[])knownKeys.add(definition.metadata_key);for(const fieldName of runtimeContext.extensionFieldNames)knownKeys.add(fieldName);return knownKeys}function assertItemMetadataCondition(condition,message){condition||validationError(message)}function requireItemMetadataRecord(value,message){return(typeof value!="object"||value===null||Array.isArray(value))&&validationError(message),value}function assertTimestampField(record,fieldName){const rawValue=record[fieldName];assertItemMetadataCondition(typeof rawValue=="string",`${fieldName} must be a string`),assertItemMetadataCondition(isTimestampLiteral(rawValue),`${fieldName} must be a valid ISO timestamp`)}function assertPositiveIntegerField(record,fieldName,messagePrefix){const value=record[fieldName];value!==void 0&&assertItemMetadataCondition(typeof value=="number"&&Number.isInteger(value)&&value>=1,`${messagePrefix} must be an integer >= 1`)}function assertOptionalTimestampString(record,fieldName,messagePrefix){const value=record[fieldName];value!==void 0&&(assertItemMetadataCondition(typeof value=="string",`${messagePrefix} must be a string`),assertItemMetadataCondition(isTimestampLiteral(value),`${messagePrefix} must be a valid ISO timestamp`))}function assertRecurrenceWeekdays(value){if(value!==void 0){assertItemMetadataCondition(Array.isArray(value),"event.recurrence.by_weekday must be an array");for(const weekday of value){assertItemMetadataCondition(typeof weekday=="string","event.recurrence.by_weekday entries must be strings");const normalizedWeekday=weekday.trim().toLowerCase();assertItemMetadataCondition(RECURRENCE_WEEKDAY_VALUES.includes(normalizedWeekday),`event.recurrence.by_weekday entries must be one of: ${RECURRENCE_WEEKDAY_VALUES.join(", ")}`)}}}function assertRecurrenceMonthDays(value){if(value!==void 0){assertItemMetadataCondition(Array.isArray(value),"event.recurrence.by_month_day must be an array");for(const day of value)assertItemMetadataCondition(typeof day=="number"&&Number.isInteger(day)&&day>=1&&day<=31,"event.recurrence.by_month_day entries must be integers 1..31")}}function assertRecurrenceExdates(value){if(value!==void 0){assertItemMetadataCondition(Array.isArray(value),"event.recurrence.exdates must be an array");for(const exdate of value)assertItemMetadataCondition(typeof exdate=="string","event.recurrence.exdates entries must be strings"),assertItemMetadataCondition(isTimestampLiteral(exdate),"event.recurrence.exdates entries must be valid ISO timestamps")}}function assertValidRecurrenceRule(recurrence){const recurrenceRecord=requireItemMetadataRecord(recurrence,"event.recurrence must be an object");assertItemMetadataCondition(typeof recurrenceRecord.freq=="string","event.recurrence.freq must be a string");const frequency=recurrenceRecord.freq.trim().toLowerCase();assertItemMetadataCondition(RECURRENCE_FREQUENCY_VALUES.includes(frequency),`event.recurrence.freq must be one of: ${RECURRENCE_FREQUENCY_VALUES.join(", ")}`),assertPositiveIntegerField(recurrenceRecord,"interval","event.recurrence.interval"),assertPositiveIntegerField(recurrenceRecord,"count","event.recurrence.count"),assertOptionalTimestampString(recurrenceRecord,"until","event.recurrence.until"),assertRecurrenceWeekdays(recurrenceRecord.by_weekday),assertRecurrenceMonthDays(recurrenceRecord.by_month_day),assertRecurrenceExdates(recurrenceRecord.exdates)}function assertRequiredItemMetadataFields(record){for(const fieldName of REQUIRED_STRING_FIELDS)assertItemMetadataCondition(typeof record[fieldName]=="string",`${fieldName} is required and must be a string`);const itemType=record.type;assertItemMetadataCondition(typeof itemType=="string"&&itemType.trim().length>0,"type must be a non-empty string");const formatVersion=record.pm_format_version;return formatVersion!==void 0&&assertItemMetadataCondition(typeof formatVersion=="number"&&Number.isInteger(formatVersion)&&formatVersion>=BASELINE_ITEM_FORMAT_VERSION,`pm_format_version must be an integer >= ${BASELINE_ITEM_FORMAT_VERSION}`),itemType}function assertStatusItemMetadataField(record,runtimeContext){const status=record.status;assertItemMetadataCondition(typeof status=="string"&&status.trim().length>0,"status must be a non-empty string");const statusRegistry=runtimeContext?.statusRegistry,normalizedStatus=normalizeStatusInput(status,statusRegistry),statusDomain=statusRegistry?statusRegistry.definitions.map(definition=>definition.id):[...STATUS_VALUES];assertItemMetadataCondition(normalizedStatus!==void 0,`status must be one of: ${statusDomain.join(", ")}`)}function assertPriorityAndTags(record){const priority=record.priority;assertItemMetadataCondition(typeof priority=="number"&&Number.isInteger(priority)&&[0,1,2,3,4].includes(priority),"priority must be an integer 0..4");const tags=record.tags;assertItemMetadataCondition(Array.isArray(tags),"tags must be an array");for(const tag of tags)assertItemMetadataCondition(typeof tag=="string","tags entries must be strings")}function assertConfidenceItemMetadataField(record){const confidence=record.confidence;if(confidence!==void 0){if(typeof confidence=="number"){assertItemMetadataCondition(Number.isInteger(confidence)&&confidence>=0&&confidence<=100,"confidence number value must be an integer 0..100");return}if(typeof confidence=="string"){const normalizedConfidence=confidence.trim().toLowerCase(),isKnownTextConfidence=normalizedConfidence==="med"||CONFIDENCE_TEXT_VALUES.includes(normalizedConfidence);assertItemMetadataCondition(isKnownTextConfidence,`confidence string value must be one of: ${[...CONFIDENCE_TEXT_VALUES,"med"].join(", ")}`);return}assertItemMetadataCondition(!1,"confidence must be a number or string")}}function assertSeverityItemMetadataField(record){const severity=record.severity;if(severity===void 0)return;typeof severity!="string"&&validationError("severity must be a string");const normalizedSeverity=severity.trim().toLowerCase(),isKnownSeverity=normalizedSeverity==="med"||ISSUE_SEVERITY_VALUES.includes(normalizedSeverity);assertItemMetadataCondition(isKnownSeverity,`severity value must be one of: ${[...ISSUE_SEVERITY_VALUES,"med"].join(", ")}`)}function assertRegressionItemMetadataField(record){record.regression!==void 0&&typeof record.regression!="boolean"&&validationError("regression must be a boolean")}function assertReminderEntries(record){const reminders=record.reminders;if(reminders!==void 0){assertItemMetadataCondition(Array.isArray(reminders),"reminders must be an array");for(const reminder of reminders){const reminderRecord=requireItemMetadataRecord(reminder,"reminders entries must be objects");assertItemMetadataCondition(typeof reminderRecord.at=="string","reminder.at must be a string"),assertItemMetadataCondition(isTimestampLiteral(reminderRecord.at),"reminder.at must be a valid ISO timestamp"),assertItemMetadataCondition(typeof reminderRecord.text=="string","reminder.text must be a string"),assertItemMetadataCondition(reminderRecord.text.trim().length>0,"reminder.text must not be empty")}}}function assertEventStringFields(eventRecord){for(const stringField of["title","description","location","timezone"])eventRecord[stringField]!==void 0&&(assertItemMetadataCondition(typeof eventRecord[stringField]=="string",`event.${stringField} must be a string`),assertItemMetadataCondition(eventRecord[stringField].trim().length>0,`event.${stringField} must not be empty`))}function assertEventRecurrence(eventRecord){eventRecord.recurrence!==void 0&&(assertValidRecurrenceRule(eventRecord.recurrence),eventRecord.recurrence.until!==void 0&&assertItemMetadataCondition(compareTimestampStrings(eventRecord.recurrence.until,eventRecord.start_at)>=0,"event.recurrence.until must be at or after event.start_at"))}function assertCalendarEventEntry(event){const eventRecord=requireItemMetadataRecord(event,"events entries must be objects");assertItemMetadataCondition(typeof eventRecord.start_at=="string","event.start_at must be a string"),assertItemMetadataCondition(isTimestampLiteral(eventRecord.start_at),"event.start_at must be a valid ISO timestamp"),eventRecord.end_at!==void 0&&(assertItemMetadataCondition(typeof eventRecord.end_at=="string","event.end_at must be a string"),assertItemMetadataCondition(isTimestampLiteral(eventRecord.end_at),"event.end_at must be a valid ISO timestamp"),assertItemMetadataCondition(compareTimestampStrings(eventRecord.end_at,eventRecord.start_at)>0,"event.end_at must be after event.start_at")),assertEventStringFields(eventRecord),eventRecord.all_day!==void 0&&assertItemMetadataCondition(typeof eventRecord.all_day=="boolean","event.all_day must be a boolean"),assertEventRecurrence(eventRecord)}function assertCalendarEvents(record){const events=record.events;if(events!==void 0){assertItemMetadataCondition(Array.isArray(events),"events must be an array");for(const event of events)assertCalendarEventEntry(event)}}function assertOptionalStringFields(record){for(const fieldName of["source_type","source_owner","design","external_ref"]){const value=record[fieldName];value!==void 0&&assertItemMetadataCondition(typeof value=="string",`${fieldName} must be a string`)}}function assertTypeOptionsField(record){const typeOptions=record.type_options;if(typeOptions===void 0)return;const typeOptionsRecord=requireItemMetadataRecord(typeOptions,"type_options must be an object");for(const[optionKey,optionValue]of Object.entries(typeOptionsRecord))assertItemMetadataCondition(optionKey.trim().length>0,"type_options keys must be non-empty"),assertItemMetadataCondition(typeof optionValue=="string","type_options values must be strings"),assertItemMetadataCondition(optionValue.trim().length>0,"type_options values must be non-empty strings")}function coerceRuntimeItemMetadataFields(record,itemType,runtimeContext){if(runtimeContext?.fieldRegistry)for(const definition of runtimeContext.fieldRegistry.definitions){const fieldValue=record[definition.metadata_key];if(fieldValue===void 0){runtimeFieldRequiredForType(definition,itemType)&&validationError(`missing required schema field: ${definition.metadata_key}`);continue}try{record[definition.metadata_key]=coerceRuntimeFieldValue(definition,fieldValue,`metadata field "${definition.metadata_key}"`,"metadata")}catch(error){validationError(String(error?.message).replace(/^Invalid\s+/u,""))}}}function assertRuntimeUnknownItemMetadataFields(record,runtimeContext){if(!runtimeContext||runtimeContext.unknownFieldPolicy==="allow")return;const knownKeys=buildKnownItemMetadataKeys(runtimeContext),unknownKeys=Object.keys(record).filter(key=>!knownKeys.has(key)).sort((left,right)=>left.localeCompare(right));unknownKeys.length!==0&&(runtimeContext.unknownFieldPolicy==="reject"?validationError(`unknown schema fields are not allowed: ${unknownKeys.join(", ")}`):runtimeContext.onWarning?.(`item_unknown_schema_fields:${unknownKeys.join(",")}`))}function assertValidItemMetadata(itemMetadata,runtimeContext){const record=requireItemMetadataRecord(itemMetadata,"item metadata must be an object"),itemType=assertRequiredItemMetadataFields(record);assertStatusItemMetadataField(record,runtimeContext),assertPriorityAndTags(record),assertConfidenceItemMetadataField(record),assertSeverityItemMetadataField(record),assertRegressionItemMetadataField(record),assertTimestampField(record,"created_at"),assertTimestampField(record,"updated_at"),record.deadline!==void 0&&assertTimestampField(record,"deadline"),assertReminderEntries(record),assertCalendarEvents(record),assertOptionalTimestampString(record,"closed_at","closed_at"),assertOptionalTimestampString(record,"completed_at","completed_at"),assertOptionalStringFields(record),assertTypeOptionsField(record),coerceRuntimeItemMetadataFields(record,itemType,runtimeContext),assertRuntimeUnknownItemMetadataFields(record,runtimeContext)}function sortDependencies(values){if(!(!values||values.length===0))return[...values].map(value=>({id:value.id.trim(),kind:value.kind,created_at:value.created_at,author:value.author?.trim()||void 0,source_kind:value.source_kind?.trim()||void 0,author_source:value.author_source})).sort((a,b)=>{const byCreated=compareTimestampStrings(a.created_at,b.created_at);if(byCreated!==0)return byCreated;const byId=a.id.localeCompare(b.id);if(byId!==0)return byId;const byKind=a.kind.localeCompare(b.kind);return byKind!==0?byKind:(a.source_kind??"").localeCompare(b.source_kind??"")})}function sortLogValues(values){if(!(!values||values.length===0))return[...values].sort((a,b)=>{const byCreated=compareTimestampStrings(a.created_at,b.created_at);if(byCreated!==0)return byCreated;const byText=a.text.localeCompare(b.text);return byText!==0?byText:a.author.localeCompare(b.author)})}function sortReminders(values){if(!values||values.length===0)return;const normalized=[...values].map(value=>({at:value.at,text:value.text.trim()})).filter(value=>value.text.length>0).sort((a,b)=>{const byAt=compareTimestampStrings(a.at,b.at);return byAt!==0?byAt:a.text.localeCompare(b.text)});return normalized.length===0?void 0:normalized}function normalizeRecurrenceRule(value){if(!value)return;const normalizedFrequency=value.freq.trim().toLowerCase();if(!RECURRENCE_FREQUENCY_VALUES.includes(normalizedFrequency))return;const byWeekday=Array.from(new Set((value.by_weekday??[]).map(weekday=>weekday.trim().toLowerCase()).filter(weekday=>RECURRENCE_WEEKDAY_VALUES.includes(weekday)))).sort((a,b)=>weekdayOrderIndex(a)-weekdayOrderIndex(b)),byMonthDay=Array.from(new Set((value.by_month_day??[]).filter(day=>Number.isInteger(day)&&day>=1&&day<=31).map(day=>day))).sort((a,b)=>a-b),exdates=Array.from(new Set((value.exdates??[]).map(timestamp=>timestamp.trim()).filter(timestamp=>isTimestampLiteral(timestamp)))).sort((a,b)=>compareTimestampStrings(a,b)),normalized={freq:normalizedFrequency,interval:value.interval!==void 0&&value.interval>1?value.interval:void 0,count:value.count,until:value.until?.trim()||void 0,by_weekday:byWeekday.length>0?byWeekday:void 0,by_month_day:byMonthDay.length>0?byMonthDay:void 0,exdates:exdates.length>0?exdates:void 0};for(const[key,fieldValue]of Object.entries(normalized))fieldValue===void 0&&delete normalized[key];return normalized}function sortEvents(values){return!Array.isArray(values)||values.length===0?void 0:[...values].map(normalizeCalendarEvent).sort(compareCalendarEvents)}function normalizeCalendarEvent(value){const event={start_at:value.start_at,end_at:value.end_at||void 0,title:value.title?.trim()||void 0,description:value.description?.trim()||void 0,location:value.location?.trim()||void 0,all_day:value.all_day,timezone:value.timezone?.trim()||void 0,recurrence:normalizeRecurrenceRule(value.recurrence)};return deleteUndefinedFields(event),event}function compareCalendarEvents(a,b){return firstNonZeroComparison([compareTimestampStrings(a.start_at,b.start_at),(a.end_at??"").localeCompare(b.end_at??""),(a.title??"").localeCompare(b.title??""),+!!a.all_day-+!!b.all_day,(a.timezone??"").localeCompare(b.timezone??""),(a.location??"").localeCompare(b.location??""),(a.description??"").localeCompare(b.description??""),JSON.stringify(a.recurrence??{}).localeCompare(JSON.stringify(b.recurrence??{}))])}function normalizeFiles(values){if(!(!values||values.length===0))return values.map(value=>({path:normalizePathValue(value.path),scope:value.scope,note:value.note?.trim()||void 0}))}function normalizeTestRunSummaries(values){if(!values||values.length===0)return;const normalized=values.map(normalizeTestRunSummary).filter(value=>value.run_id.length>0&&value.started_at.length>0&&value.finished_at.length>0&&value.recorded_at.length>0).sort((a,b)=>firstNonZeroComparison([compareTimestampStrings(a.recorded_at,b.recorded_at),a.run_id.localeCompare(b.run_id),a.kind.localeCompare(b.kind)]));return normalized.length>0?normalized:void 0}function normalizeNonNegativeInteger(value){return typeof value=="number"&&Number.isFinite(value)&&value>=0?Math.floor(value):void 0}function normalizePositiveInteger(value){return typeof value=="number"&&Number.isFinite(value)&&value>=1?Math.floor(value):void 0}function stringOrEmpty(value){return typeof value=="string"?value:""}function normalizeTestRunMeasurements(value){if(!Array.isArray(value))return;const normalized=value.filter(measurement=>measurement!==null&&typeof measurement=="object"&&typeof measurement.name=="string"&&measurement.name.trim().length>0&&typeof measurement.value=="number"&&Number.isFinite(measurement.value)&&typeof measurement.recorded_at=="string"&&measurement.recorded_at.trim().length>0).map(measurement=>({name:measurement.name.trim(),value:measurement.value,unit:typeof measurement.unit=="string"&&measurement.unit.trim()||void 0,threshold:typeof measurement.threshold=="number"&&Number.isFinite(measurement.threshold)?measurement.threshold:void 0,recorded_at:measurement.recorded_at.trim()})),deduplicated=[...new Map(normalized.map(measurement=>[measurement.name,measurement])).values()].sort((left,right)=>left.name.localeCompare(right.name)).slice(0,32);return deduplicated.length>0?deduplicated:void 0}function normalizeTestRunEnum(value,allowedValues){return typeof value=="string"&&allowedValues.has(value)?value:void 0}function normalizeTestRunExecutions(values){if(!Array.isArray(values))return;const executions=values.filter(execution=>execution&&typeof execution.command=="string"&&execution.command.trim().length>0).slice(0,32).map(execution=>({command:execution.command.trim(),requested_pm_context_mode:normalizeTestRunEnum(execution.requested_pm_context_mode,LINKED_TEST_PM_CONTEXT_MODE_VALUES),pm_context_mode:normalizeTestRunEnum(execution.pm_context_mode,LINKED_TEST_PM_CONTEXT_MODE_VALUES),workspace_context_mode:normalizeTestRunEnum(execution.workspace_context_mode,LINKED_TEST_WORKSPACE_CONTEXT_MODE_VALUES),trust_reason:normalizeTestRunEnum(execution.trust_reason,LINKED_TEST_TRUST_REASON_VALUES)}));return executions.length>0?executions:void 0}function normalizeTestRunSummary(value){const runId=typeof value.run_id=="string"?value.run_id.trim():"",kind=value.kind==="test"||value.kind==="test-all"?value.kind:"test",status=ITEM_TEST_RUN_STATUS_VALUES.has(value.status)?value.status:"failed",summary={run_id:runId,kind,status,started_at:stringOrEmpty(value.started_at),finished_at:stringOrEmpty(value.finished_at),recorded_at:stringOrEmpty(value.recorded_at),attempt:normalizePositiveInteger(value.attempt),resumed_from:value.resumed_from?.trim()||void 0,passed:normalizeNonNegativeInteger(value.passed)??0,failed:normalizeNonNegativeInteger(value.failed)??0,skipped:normalizeNonNegativeInteger(value.skipped)??0,items:normalizeNonNegativeInteger(value.items),linked_tests:normalizeNonNegativeInteger(value.linked_tests),fail_on_skipped_triggered:value.fail_on_skipped_triggered===!0?!0:void 0,measurements:normalizeTestRunMeasurements(value.measurements),executions:normalizeTestRunExecutions(value.executions)};return deleteUndefinedFields(summary),summary}function sortTests(values){if(!(!Array.isArray(values)||values.length===0))return values.map(normalizeLinkedTest)}function normalizeTrimmedStringList(value){if(!Array.isArray(value))return;const normalized=[...new Set(value.filter(entry=>typeof entry=="string").map(entry=>entry.trim()).filter(entry=>entry.length>0))].sort((a,b)=>a.localeCompare(b));return normalized.length>0?normalized:void 0}function isPlainObjectRecord(value){if(!value||typeof value!="object"||Array.isArray(value))return!1;const prototype=Object.getPrototypeOf(value);return prototype===Object.prototype||prototype===null}function isUnsafeObjectKey(key){return key==="__proto__"||key==="constructor"||key==="prototype"}function normalizeStringRecord(value){if(!isPlainObjectRecord(value))return;const entries=Object.entries(value).map(([key,recordValue])=>[key.trim(),String(recordValue).trim()]).filter(([key,recordValue])=>key.length>0&&!isUnsafeObjectKey(key)&&recordValue.length>0).sort(([left],[right])=>left.localeCompare(right));return entries.length>0?Object.fromEntries(entries):void 0}function normalizeNumericRecord(value){if(!isPlainObjectRecord(value))return;const entries=Object.entries(value).map(([key,recordValue])=>[key.trim(),Number(recordValue)]).filter(([key,recordValue])=>key.length>0&&!isUnsafeObjectKey(key)&&Number.isFinite(recordValue)).sort(([left],[right])=>left.localeCompare(right));return entries.length>0?Object.fromEntries(entries):void 0}function normalizeLinkedTestContextMode(value){const normalized=value?.trim().toLowerCase();if(!(!normalized||!LINKED_TEST_PM_CONTEXT_MODE_VALUES.has(normalized)))return normalized}function normalizeLinkedTestWorkspaceContextMode(value){const normalized=value?.trim().toLowerCase();if(!(!normalized||!LINKED_TEST_WORKSPACE_CONTEXT_MODE_VALUES.has(normalized)))return normalized}function normalizeLinkedTestProvenance(value,invalid){if(invalid===!0)return{provenance_invalid:!0};if(value===void 0)return{};if(!isPlainObjectRecord(value))return{provenance_invalid:!0};const author=trimStringOrUndefined(value.author),createdAt=trimStringOrUndefined(value.created_at),sourceKind=value.source_kind;return!author||!createdAt||!isTimestampLiteral(createdAt)||sourceKind!=="local_mutation"&&sourceKind!=="merge_union"?{provenance_invalid:!0}:{provenance:{author,created_at:createdAt,source_kind:sourceKind,source_ref:trimStringOrUndefined(value.source_ref)}}}function normalizeLinkedTest(value){const test={command:value.command?.trim()||void 0,path:value.path?normalizePathValue(value.path):void 0,scope:value.scope,timeout_seconds:typeof value.timeout_seconds=="number"&&Number.isFinite(value.timeout_seconds)&&value.timeout_seconds>0?value.timeout_seconds:void 0,pm_context_mode:normalizeLinkedTestContextMode(value.pm_context_mode),workspace_context_mode:normalizeLinkedTestWorkspaceContextMode(value.workspace_context_mode),...normalizeLinkedTestProvenance(value.provenance,value.provenance_invalid),env_set:normalizeStringRecord(value.env_set),env_clear:normalizeTrimmedStringList(value.env_clear),shared_host_safe:value.shared_host_safe===!0?!0:void 0,assert_stdout_contains:normalizeTrimmedStringList(value.assert_stdout_contains),assert_stdout_regex:normalizeTrimmedStringList(value.assert_stdout_regex),assert_stderr_contains:normalizeTrimmedStringList(value.assert_stderr_contains),assert_stderr_regex:normalizeTrimmedStringList(value.assert_stderr_regex),assert_stdout_min_lines:normalizeNonNegativeInteger(value.assert_stdout_min_lines),assert_json_field_equals:normalizeStringRecord(value.assert_json_field_equals),assert_json_field_gte:normalizeNumericRecord(value.assert_json_field_gte),note:value.note?.trim()||void 0};return deleteUndefinedFields(test),test}function sortDocs(values){if(!(!values||values.length===0))return[...values].map(value=>({path:normalizePathValue(value.path),scope:value.scope,note:value.note?.trim()||void 0})).sort((a,b)=>{const byScope=a.scope.localeCompare(b.scope);if(byScope!==0)return byScope;const byPath=a.path.localeCompare(b.path);return byPath!==0?byPath:(a.note??"").localeCompare(b.note??"")})}function trimStringOrUndefined(value){if(typeof value!="string")return;const trimmed=value.trim();return trimmed.length>0?trimmed:void 0}function normalizePlanStepLinks(value){if(!Array.isArray(value))return;const out=[];for(const entry of value){if(entry===null||typeof entry!="object")continue;const record=entry,id=trimStringOrUndefined(record.id),kind=trimStringOrUndefined(record.kind);if(!id||!kind)continue;const link={id,kind},note=trimStringOrUndefined(record.note);note&&(link.note=note),record.required_before_step===!0&&(link.required_before_step=!0),out.push(link)}return out.length>0?out:void 0}function normalizePlanStepFiles(value){if(!Array.isArray(value))return;const out=[];for(const entry of value){if(entry===null||typeof entry!="object")continue;const record=entry,path=trimStringOrUndefined(record.path);if(!path)continue;const file={path:normalizePathValue(path)};(record.scope==="project"||record.scope==="global")&&(file.scope=record.scope);const note=trimStringOrUndefined(record.note);note&&(file.note=note),out.push(file)}return out.length>0?out:void 0}function normalizePlanStepTests(value){if(!Array.isArray(value))return;const out=[];for(const entry of value){if(entry===null||typeof entry!="object")continue;const record=entry,command=trimStringOrUndefined(record.command),path=trimStringOrUndefined(record.path);if(!command&&!path)continue;const test={};command&&(test.command=command),path&&(test.path=normalizePathValue(path));const note=trimStringOrUndefined(record.note);note&&(test.note=note),out.push(test)}return out.length>0?out:void 0}function normalizePlanStepDocs(value){if(!Array.isArray(value))return;const out=[];for(const entry of value){if(entry===null||typeof entry!="object")continue;const record=entry,path=trimStringOrUndefined(record.path);if(!path)continue;const doc={path:normalizePathValue(path)};(record.scope==="project"||record.scope==="global")&&(doc.scope=record.scope);const note=trimStringOrUndefined(record.note);note&&(doc.note=note),out.push(doc)}return out.length>0?out:void 0}function normalizePlanStepEntry(entry){if(entry===null||typeof entry!="object")return;const record=entry,id=trimStringOrUndefined(record.id),title=trimStringOrUndefined(record.title),statusRaw=trimStringOrUndefined(record.status),status=statusRaw&&PLAN_STEP_STATUS_SET.has(statusRaw)?statusRaw:void 0,order=coerceFiniteNumber(record.order)??Number.NaN,created_at=typeof record.created_at=="string"?record.created_at:"",updated_at=typeof record.updated_at=="string"?record.updated_at:"";if(!id||!title||!status||!Number.isFinite(order)||!created_at||!updated_at)return;const step={id,order,title,status,created_at,updated_at};return applyPlanStepOptionalFields(step,record),step}function applyPlanStepOptionalFields(step,record){const stringFields=[["body","body"],["owner","owner"],["evidence","evidence"],["blocked_reason","blocked_reason"],["superseded_by","superseded_by"]];for(const[target,source]of stringFields){const value=trimStringOrUndefined(record[source]);value&&(step[target]=value)}const completedAt=typeof record.completed_at=="string"?record.completed_at:void 0;completedAt&&completedAt.length>0&&(step.completed_at=completedAt);const collectionFields=[["linked_items","linked_items",normalizePlanStepLinks],["files","files",normalizePlanStepFiles],["tests","tests",normalizePlanStepTests],["docs","docs",normalizePlanStepDocs]];for(const[target,source,normalize]of collectionFields){const value=normalize(record[source]);value&&(step[target]=value)}}function normalizePlanSteps(value){if(!Array.isArray(value))return;const out=value.flatMap(entry=>{const step=normalizePlanStepEntry(entry);return step?[step]:[]});return out.sort((left,right)=>left.order-right.order),out.length>0?out:void 0}function normalizePlanDecisions(value){if(!Array.isArray(value))return;const out=[];for(const entry of value){if(entry===null||typeof entry!="object")continue;const record=entry,ts=typeof record.ts=="string"?record.ts:"",author=typeof record.author=="string"?record.author:"",decision=trimStringOrUndefined(record.decision);if(!ts||!author||!decision)continue;const item={ts,author,decision},rationale=trimStringOrUndefined(record.rationale);rationale&&(item.rationale=rationale);const evidence=trimStringOrUndefined(record.evidence);evidence&&(item.evidence=evidence);const stepId=trimStringOrUndefined(record.step_id);stepId&&(item.step_id=stepId),out.push(item)}return out.length>0?out:void 0}function normalizePlanDiscoveries(value){if(!Array.isArray(value))return;const out=[];for(const entry of value){if(entry===null||typeof entry!="object")continue;const record=entry,ts=typeof record.ts=="string"?record.ts:"",author=typeof record.author=="string"?record.author:"",text=trimStringOrUndefined(record.text);if(!ts||!author||!text)continue;const item={ts,author,text},stepId=trimStringOrUndefined(record.step_id);stepId&&(item.step_id=stepId),out.push(item)}return out.length>0?out:void 0}function normalizePlanValidation(value){if(!Array.isArray(value))return;const out=[];for(const entry of value){if(entry===null||typeof entry!="object")continue;const record=entry,text=trimStringOrUndefined(record.text);if(!text)continue;const item={text},command=trimStringOrUndefined(record.command);command&&(item.command=command);const expected=trimStringOrUndefined(record.expected);expected&&(item.expected=expected),out.push(item)}return out.length>0?out:void 0}function normalizeTypeOptions(values){if(!values)return;const normalizedEntries=Object.entries(values).map(([key,value])=>[key.trim(),value.trim()]).filter(([key,value])=>key.length>0&&value.length>0).sort((left,right)=>left[0].localeCompare(right[0]));if(normalizedEntries.length!==0)return Object.fromEntries(normalizedEntries)}function normalizeBody(body){let start=0;for(;start<body.length&&body[start]===`
|
|
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]="fb315276-2021-54aa-a880-5b4eb508e8d6")}catch{}})();import{encode as encodeToon}from"@toon-format/toon";import{isDeepStrictEqual}from"node:util";import{CONFIDENCE_TEXT_VALUES,ISSUE_SEVERITY_VALUES,PLAN_STEP_STATUS_VALUES,RECURRENCE_FREQUENCY_VALUES,RECURRENCE_WEEKDAY_VALUES,STATUS_VALUES,weekdayOrderIndex}from"../../types/index.js";import{coerceRuntimeFieldValue}from"../schema/runtime-field-values.js";import{resolveRuntimeFieldRegistry,resolveRuntimeStatusRegistry}from"../schema/runtime-schema.js";import{BASELINE_ITEM_FORMAT_VERSION,CURRENT_ITEM_FORMAT_VERSION,effectiveItemFormatVersion,normalizeItemFormatVersion}from"./item-format-version.js";import{normalizeStatusInput}from"./status.js";import{decodeToonItemContent}from"./toon-decode.js";import{EXIT_CODE,ITEM_METADATA_KEY_ORDER}from"../shared/constants.js";import{findFirstMergeConflictMarker}from"../shared/conflict-markers.js";import{PmCliError}from"../shared/errors.js";import{orderObject}from"../shared/serialization.js";import{compareTimestampStrings,isTimestampLiteral}from"../shared/time.js";import{coerceFiniteNumber}from"../shared/primitives.js";const LINKED_TEST_PM_CONTEXT_MODE_VALUES=new Set(["schema","tracker","auto","none"]),LINKED_TEST_WORKSPACE_CONTEXT_MODE_VALUES=new Set(["source","isolated","snapshot"]),LINKED_TEST_TRUST_REASON_VALUES=new Set(["legacy","local_mutation","local_source_ref","acknowledged","invalid_provenance","foreign_source_ref"]),ITEM_TEST_RUN_STATUS_VALUES=new Set(["passed","failed","stopped","canceled"]),PLAN_STEP_STATUS_SET=new Set(PLAN_STEP_STATUS_VALUES);function normalizePathValue(value){return value.replaceAll("\\","/")}function firstNonZeroComparison(comparisons){for(const comparison of comparisons)if(comparison!==0)return comparison;return 0}function deleteUndefinedFields(record){for(const[key,value]of Object.entries(record))value===void 0&&delete record[key]}const REQUIRED_STRING_FIELDS=["id","title","description","created_at","updated_at"],STATIC_ITEM_METADATA_FIELD_SET=new Set(ITEM_METADATA_KEY_ORDER);function resolveRuntimeSchemaValidationContext(options){if(options?.schema)return{statusRegistry:resolveRuntimeStatusRegistry(options.schema),fieldRegistry:resolveRuntimeFieldRegistry(options.schema),unknownFieldPolicy:options.schema.unknown_field_policy??"allow",extensionFieldNames:new Set(options.extensionFieldNames??[]),onWarning:options.onWarning}}function runtimeFieldRequiredForType(definition,typeName){return definition.required?definition.required_types.length===0?!0:definition.required_types.map(value=>value.toLowerCase()).includes(typeName.trim().toLowerCase()):!1}function validationError(message){const field=message.match(/^([a-z_][\w.]*)\s/u)?.[1];throw new PmCliError(`Invalid item metadata: ${message}`,EXIT_CODE.GENERIC_FAILURE,{code:"item_document_invalid",reason:message.includes("required")?"missing_required_field":"schema_validation_error",...field?{field}:{},required:"Provide an item document whose metadata satisfies the active runtime schema.",why:message})}function documentSyntaxError(format,message){throw new PmCliError(message,EXIT_CODE.GENERIC_FAILURE,{code:"item_document_invalid",reason:"syntax_error",format,required:`Provide a syntactically valid ${format==="toon"?"TOON":"JSON Markdown"} item document.`,why:"The document could not be decoded far enough to validate item metadata."})}function assertSupportedItemFormat(metadata,required){if(!required||typeof metadata!="object"||metadata===null)return;const formatVersion=effectiveItemFormatVersion(metadata);if(!(formatVersion<=CURRENT_ITEM_FORMAT_VERSION))throw new PmCliError(`Stored item uses format version ${formatVersion}; this runtime supports up to ${CURRENT_ITEM_FORMAT_VERSION}. Upgrade pm before reading or changing this item.`,EXIT_CODE.CONFLICT,{code:"item_format_version_unsupported",format_version:formatVersion,required:"Upgrade to a pm runtime supporting the stored item format.",nextSteps:["Preserve the original item and history; do not lower pm_format_version to bypass compatibility checks."]})}function buildKnownItemMetadataKeys(runtimeContext){const knownKeys=new Set(STATIC_ITEM_METADATA_FIELD_SET);for(const definition of runtimeContext.fieldRegistry?.definitions??[])knownKeys.add(definition.metadata_key);for(const fieldName of runtimeContext.extensionFieldNames)knownKeys.add(fieldName);return knownKeys}function assertItemMetadataCondition(condition,message){condition||validationError(message)}function requireItemMetadataRecord(value,message){return(typeof value!="object"||value===null||Array.isArray(value))&&validationError(message),value}function assertTimestampField(record,fieldName){const rawValue=record[fieldName];assertItemMetadataCondition(typeof rawValue=="string",`${fieldName} must be a string`),assertItemMetadataCondition(isTimestampLiteral(rawValue),`${fieldName} must be a valid ISO timestamp`)}function assertPositiveIntegerField(record,fieldName,messagePrefix){const value=record[fieldName];value!==void 0&&assertItemMetadataCondition(typeof value=="number"&&Number.isInteger(value)&&value>=1,`${messagePrefix} must be an integer >= 1`)}function assertOptionalTimestampString(record,fieldName,messagePrefix){const value=record[fieldName];value!==void 0&&(assertItemMetadataCondition(typeof value=="string",`${messagePrefix} must be a string`),assertItemMetadataCondition(isTimestampLiteral(value),`${messagePrefix} must be a valid ISO timestamp`))}function assertRecurrenceWeekdays(value){if(value!==void 0){assertItemMetadataCondition(Array.isArray(value),"event.recurrence.by_weekday must be an array");for(const weekday of value){assertItemMetadataCondition(typeof weekday=="string","event.recurrence.by_weekday entries must be strings");const normalizedWeekday=weekday.trim().toLowerCase();assertItemMetadataCondition(RECURRENCE_WEEKDAY_VALUES.includes(normalizedWeekday),`event.recurrence.by_weekday entries must be one of: ${RECURRENCE_WEEKDAY_VALUES.join(", ")}`)}}}function assertRecurrenceMonthDays(value){if(value!==void 0){assertItemMetadataCondition(Array.isArray(value),"event.recurrence.by_month_day must be an array");for(const day of value)assertItemMetadataCondition(typeof day=="number"&&Number.isInteger(day)&&day>=1&&day<=31,"event.recurrence.by_month_day entries must be integers 1..31")}}function assertRecurrenceExdates(value){if(value!==void 0){assertItemMetadataCondition(Array.isArray(value),"event.recurrence.exdates must be an array");for(const exdate of value)assertItemMetadataCondition(typeof exdate=="string","event.recurrence.exdates entries must be strings"),assertItemMetadataCondition(isTimestampLiteral(exdate),"event.recurrence.exdates entries must be valid ISO timestamps")}}function assertValidRecurrenceRule(recurrence){const recurrenceRecord=requireItemMetadataRecord(recurrence,"event.recurrence must be an object");assertItemMetadataCondition(typeof recurrenceRecord.freq=="string","event.recurrence.freq must be a string");const frequency=recurrenceRecord.freq.trim().toLowerCase();assertItemMetadataCondition(RECURRENCE_FREQUENCY_VALUES.includes(frequency),`event.recurrence.freq must be one of: ${RECURRENCE_FREQUENCY_VALUES.join(", ")}`),assertPositiveIntegerField(recurrenceRecord,"interval","event.recurrence.interval"),assertPositiveIntegerField(recurrenceRecord,"count","event.recurrence.count"),assertOptionalTimestampString(recurrenceRecord,"until","event.recurrence.until"),assertRecurrenceWeekdays(recurrenceRecord.by_weekday),assertRecurrenceMonthDays(recurrenceRecord.by_month_day),assertRecurrenceExdates(recurrenceRecord.exdates)}function assertRequiredItemMetadataFields(record){for(const fieldName of REQUIRED_STRING_FIELDS)assertItemMetadataCondition(typeof record[fieldName]=="string",`${fieldName} is required and must be a string`);const itemType=record.type;assertItemMetadataCondition(typeof itemType=="string"&&itemType.trim().length>0,"type must be a non-empty string");const formatVersion=record.pm_format_version;return formatVersion!==void 0&&assertItemMetadataCondition(typeof formatVersion=="number"&&Number.isInteger(formatVersion)&&formatVersion>=BASELINE_ITEM_FORMAT_VERSION,`pm_format_version must be an integer >= ${BASELINE_ITEM_FORMAT_VERSION}`),itemType}function assertStatusItemMetadataField(record,runtimeContext){const status=record.status;assertItemMetadataCondition(typeof status=="string"&&status.trim().length>0,"status must be a non-empty string");const statusRegistry=runtimeContext?.statusRegistry,normalizedStatus=normalizeStatusInput(status,statusRegistry),statusDomain=statusRegistry?statusRegistry.definitions.map(definition=>definition.id):[...STATUS_VALUES];assertItemMetadataCondition(normalizedStatus!==void 0,`status must be one of: ${statusDomain.join(", ")}`)}function assertPriorityAndTags(record){const priority=record.priority;assertItemMetadataCondition(typeof priority=="number"&&Number.isInteger(priority)&&[0,1,2,3,4].includes(priority),"priority must be an integer 0..4");const tags=record.tags;assertItemMetadataCondition(Array.isArray(tags),"tags must be an array");for(const tag of tags)assertItemMetadataCondition(typeof tag=="string","tags entries must be strings")}function assertConfidenceItemMetadataField(record){const confidence=record.confidence;if(confidence!==void 0){if(typeof confidence=="number"){assertItemMetadataCondition(Number.isInteger(confidence)&&confidence>=0&&confidence<=100,"confidence number value must be an integer 0..100");return}if(typeof confidence=="string"){const normalizedConfidence=confidence.trim().toLowerCase(),isKnownTextConfidence=normalizedConfidence==="med"||CONFIDENCE_TEXT_VALUES.includes(normalizedConfidence);assertItemMetadataCondition(isKnownTextConfidence,`confidence string value must be one of: ${[...CONFIDENCE_TEXT_VALUES,"med"].join(", ")}`);return}assertItemMetadataCondition(!1,"confidence must be a number or string")}}function assertSeverityItemMetadataField(record){const severity=record.severity;if(severity===void 0)return;typeof severity!="string"&&validationError("severity must be a string");const normalizedSeverity=severity.trim().toLowerCase(),isKnownSeverity=normalizedSeverity==="med"||ISSUE_SEVERITY_VALUES.includes(normalizedSeverity);assertItemMetadataCondition(isKnownSeverity,`severity value must be one of: ${[...ISSUE_SEVERITY_VALUES,"med"].join(", ")}`)}function assertRegressionItemMetadataField(record){record.regression!==void 0&&typeof record.regression!="boolean"&&validationError("regression must be a boolean")}function assertReminderEntries(record){const reminders=record.reminders;if(reminders!==void 0){assertItemMetadataCondition(Array.isArray(reminders),"reminders must be an array");for(const reminder of reminders){const reminderRecord=requireItemMetadataRecord(reminder,"reminders entries must be objects");assertItemMetadataCondition(typeof reminderRecord.at=="string","reminder.at must be a string"),assertItemMetadataCondition(isTimestampLiteral(reminderRecord.at),"reminder.at must be a valid ISO timestamp"),assertItemMetadataCondition(typeof reminderRecord.text=="string","reminder.text must be a string"),assertItemMetadataCondition(reminderRecord.text.trim().length>0,"reminder.text must not be empty")}}}function assertEventStringFields(eventRecord){for(const stringField of["title","description","location","timezone"])eventRecord[stringField]!==void 0&&(assertItemMetadataCondition(typeof eventRecord[stringField]=="string",`event.${stringField} must be a string`),assertItemMetadataCondition(eventRecord[stringField].trim().length>0,`event.${stringField} must not be empty`))}function assertEventRecurrence(eventRecord){eventRecord.recurrence!==void 0&&(assertValidRecurrenceRule(eventRecord.recurrence),eventRecord.recurrence.until!==void 0&&assertItemMetadataCondition(compareTimestampStrings(eventRecord.recurrence.until,eventRecord.start_at)>=0,"event.recurrence.until must be at or after event.start_at"))}function assertCalendarEventEntry(event){const eventRecord=requireItemMetadataRecord(event,"events entries must be objects");assertItemMetadataCondition(typeof eventRecord.start_at=="string","event.start_at must be a string"),assertItemMetadataCondition(isTimestampLiteral(eventRecord.start_at),"event.start_at must be a valid ISO timestamp"),eventRecord.end_at!==void 0&&(assertItemMetadataCondition(typeof eventRecord.end_at=="string","event.end_at must be a string"),assertItemMetadataCondition(isTimestampLiteral(eventRecord.end_at),"event.end_at must be a valid ISO timestamp"),assertItemMetadataCondition(compareTimestampStrings(eventRecord.end_at,eventRecord.start_at)>0,"event.end_at must be after event.start_at")),assertEventStringFields(eventRecord),eventRecord.all_day!==void 0&&assertItemMetadataCondition(typeof eventRecord.all_day=="boolean","event.all_day must be a boolean"),assertEventRecurrence(eventRecord)}function assertCalendarEvents(record){const events=record.events;if(events!==void 0){assertItemMetadataCondition(Array.isArray(events),"events must be an array");for(const event of events)assertCalendarEventEntry(event)}}function assertOptionalStringFields(record){for(const fieldName of["source_type","source_owner","design","external_ref"]){const value=record[fieldName];value!==void 0&&assertItemMetadataCondition(typeof value=="string",`${fieldName} must be a string`)}}function assertTypeOptionsField(record){const typeOptions=record.type_options;if(typeOptions===void 0)return;const typeOptionsRecord=requireItemMetadataRecord(typeOptions,"type_options must be an object");for(const[optionKey,optionValue]of Object.entries(typeOptionsRecord))assertItemMetadataCondition(optionKey.trim().length>0,"type_options keys must be non-empty"),assertItemMetadataCondition(typeof optionValue=="string","type_options values must be strings"),assertItemMetadataCondition(optionValue.trim().length>0,"type_options values must be non-empty strings")}function coerceRuntimeItemMetadataFields(record,itemType,runtimeContext){if(runtimeContext?.fieldRegistry)for(const definition of runtimeContext.fieldRegistry.definitions){const fieldValue=record[definition.metadata_key];if(fieldValue===void 0){runtimeFieldRequiredForType(definition,itemType)&&validationError(`missing required schema field: ${definition.metadata_key}`);continue}try{record[definition.metadata_key]=coerceRuntimeFieldValue(definition,fieldValue,`metadata field "${definition.metadata_key}"`,"metadata")}catch(error){validationError(String(error?.message).replace(/^Invalid\s+/u,""))}}}function assertRuntimeUnknownItemMetadataFields(record,runtimeContext){if(!runtimeContext||runtimeContext.unknownFieldPolicy==="allow")return;const knownKeys=buildKnownItemMetadataKeys(runtimeContext),unknownKeys=Object.keys(record).filter(key=>!knownKeys.has(key)).sort((left,right)=>left.localeCompare(right));unknownKeys.length!==0&&(runtimeContext.unknownFieldPolicy==="reject"?validationError(`unknown schema fields are not allowed: ${unknownKeys.join(", ")}`):runtimeContext.onWarning?.(`item_unknown_schema_fields:${unknownKeys.join(",")}`))}function assertValidItemMetadata(itemMetadata,runtimeContext){const record=requireItemMetadataRecord(itemMetadata,"item metadata must be an object"),itemType=assertRequiredItemMetadataFields(record);assertStatusItemMetadataField(record,runtimeContext),assertPriorityAndTags(record),assertConfidenceItemMetadataField(record),assertSeverityItemMetadataField(record),assertRegressionItemMetadataField(record),assertTimestampField(record,"created_at"),assertTimestampField(record,"updated_at"),record.deadline!==void 0&&assertTimestampField(record,"deadline"),assertReminderEntries(record),assertCalendarEvents(record),assertOptionalTimestampString(record,"closed_at","closed_at"),assertOptionalTimestampString(record,"completed_at","completed_at"),assertOptionalStringFields(record),assertTypeOptionsField(record),coerceRuntimeItemMetadataFields(record,itemType,runtimeContext),assertRuntimeUnknownItemMetadataFields(record,runtimeContext)}function sortDependencies(values){if(!(!values||values.length===0))return[...values].map(value=>({id:value.id.trim(),kind:value.kind,created_at:value.created_at,author:value.author?.trim()||void 0,source_kind:value.source_kind?.trim()||void 0,author_source:value.author_source})).sort((a,b)=>{const byCreated=compareTimestampStrings(a.created_at,b.created_at);if(byCreated!==0)return byCreated;const byId=a.id.localeCompare(b.id);if(byId!==0)return byId;const byKind=a.kind.localeCompare(b.kind);return byKind!==0?byKind:(a.source_kind??"").localeCompare(b.source_kind??"")})}function sortLogValues(values){if(!(!values||values.length===0))return[...values].sort((a,b)=>{const byCreated=compareTimestampStrings(a.created_at,b.created_at);if(byCreated!==0)return byCreated;const byText=a.text.localeCompare(b.text);return byText!==0?byText:a.author.localeCompare(b.author)})}function sortReminders(values){if(!values||values.length===0)return;const normalized=[...values].map(value=>({at:value.at,text:value.text.trim()})).filter(value=>value.text.length>0).sort((a,b)=>{const byAt=compareTimestampStrings(a.at,b.at);return byAt!==0?byAt:a.text.localeCompare(b.text)});return normalized.length===0?void 0:normalized}function normalizeRecurrenceRule(value){if(!value)return;const normalizedFrequency=value.freq.trim().toLowerCase();if(!RECURRENCE_FREQUENCY_VALUES.includes(normalizedFrequency))return;const byWeekday=Array.from(new Set((value.by_weekday??[]).map(weekday=>weekday.trim().toLowerCase()).filter(weekday=>RECURRENCE_WEEKDAY_VALUES.includes(weekday)))).sort((a,b)=>weekdayOrderIndex(a)-weekdayOrderIndex(b)),byMonthDay=Array.from(new Set((value.by_month_day??[]).filter(day=>Number.isInteger(day)&&day>=1&&day<=31).map(day=>day))).sort((a,b)=>a-b),exdates=Array.from(new Set((value.exdates??[]).map(timestamp=>timestamp.trim()).filter(timestamp=>isTimestampLiteral(timestamp)))).sort((a,b)=>compareTimestampStrings(a,b)),normalized={freq:normalizedFrequency,interval:value.interval!==void 0&&value.interval>1?value.interval:void 0,count:value.count,until:value.until?.trim()||void 0,by_weekday:byWeekday.length>0?byWeekday:void 0,by_month_day:byMonthDay.length>0?byMonthDay:void 0,exdates:exdates.length>0?exdates:void 0};for(const[key,fieldValue]of Object.entries(normalized))fieldValue===void 0&&delete normalized[key];return normalized}function sortEvents(values){return!Array.isArray(values)||values.length===0?void 0:[...values].map(normalizeCalendarEvent).sort(compareCalendarEvents)}function normalizeCalendarEvent(value){const event={start_at:value.start_at,end_at:value.end_at||void 0,title:value.title?.trim()||void 0,description:value.description?.trim()||void 0,location:value.location?.trim()||void 0,all_day:value.all_day,timezone:value.timezone?.trim()||void 0,recurrence:normalizeRecurrenceRule(value.recurrence)};return deleteUndefinedFields(event),event}function compareCalendarEvents(a,b){return firstNonZeroComparison([compareTimestampStrings(a.start_at,b.start_at),(a.end_at??"").localeCompare(b.end_at??""),(a.title??"").localeCompare(b.title??""),+!!a.all_day-+!!b.all_day,(a.timezone??"").localeCompare(b.timezone??""),(a.location??"").localeCompare(b.location??""),(a.description??"").localeCompare(b.description??""),JSON.stringify(a.recurrence??{}).localeCompare(JSON.stringify(b.recurrence??{}))])}function normalizeFiles(values){if(!(!values||values.length===0))return values.map(value=>({path:normalizePathValue(value.path),scope:value.scope,note:value.note?.trim()||void 0}))}function normalizeTestRunSummaries(values){if(!values||values.length===0)return;const normalized=values.map(normalizeTestRunSummary).filter(value=>value.run_id.length>0&&value.started_at.length>0&&value.finished_at.length>0&&value.recorded_at.length>0).sort((a,b)=>firstNonZeroComparison([compareTimestampStrings(a.recorded_at,b.recorded_at),a.run_id.localeCompare(b.run_id),a.kind.localeCompare(b.kind)]));return normalized.length>0?normalized:void 0}function normalizeNonNegativeInteger(value){return typeof value=="number"&&Number.isFinite(value)&&value>=0?Math.floor(value):void 0}function normalizePositiveInteger(value){return typeof value=="number"&&Number.isFinite(value)&&value>=1?Math.floor(value):void 0}function stringOrEmpty(value){return typeof value=="string"?value:""}function normalizeTestRunMeasurements(value){if(!Array.isArray(value))return;const normalized=value.filter(measurement=>measurement!==null&&typeof measurement=="object"&&typeof measurement.name=="string"&&measurement.name.trim().length>0&&typeof measurement.value=="number"&&Number.isFinite(measurement.value)&&typeof measurement.recorded_at=="string"&&measurement.recorded_at.trim().length>0).map(measurement=>({name:measurement.name.trim(),value:measurement.value,unit:typeof measurement.unit=="string"&&measurement.unit.trim()||void 0,threshold:typeof measurement.threshold=="number"&&Number.isFinite(measurement.threshold)?measurement.threshold:void 0,recorded_at:measurement.recorded_at.trim()})),deduplicated=[...new Map(normalized.map(measurement=>[measurement.name,measurement])).values()].sort((left,right)=>left.name.localeCompare(right.name)).slice(0,32);return deduplicated.length>0?deduplicated:void 0}function normalizeTestRunEnum(value,allowedValues){return typeof value=="string"&&allowedValues.has(value)?value:void 0}function normalizeTestRunExecutions(values){if(!Array.isArray(values))return;const executions=values.filter(execution=>execution&&typeof execution.command=="string"&&execution.command.trim().length>0).slice(0,32).map(execution=>({command:execution.command.trim(),requested_pm_context_mode:normalizeTestRunEnum(execution.requested_pm_context_mode,LINKED_TEST_PM_CONTEXT_MODE_VALUES),pm_context_mode:normalizeTestRunEnum(execution.pm_context_mode,LINKED_TEST_PM_CONTEXT_MODE_VALUES),workspace_context_mode:normalizeTestRunEnum(execution.workspace_context_mode,LINKED_TEST_WORKSPACE_CONTEXT_MODE_VALUES),trust_reason:normalizeTestRunEnum(execution.trust_reason,LINKED_TEST_TRUST_REASON_VALUES)}));return executions.length>0?executions:void 0}function normalizeTestRunSummary(value){const runId=typeof value.run_id=="string"?value.run_id.trim():"",kind=value.kind==="test"||value.kind==="test-all"?value.kind:"test",status=ITEM_TEST_RUN_STATUS_VALUES.has(value.status)?value.status:"failed",summary={run_id:runId,kind,status,started_at:stringOrEmpty(value.started_at),finished_at:stringOrEmpty(value.finished_at),recorded_at:stringOrEmpty(value.recorded_at),attempt:normalizePositiveInteger(value.attempt),resumed_from:value.resumed_from?.trim()||void 0,passed:normalizeNonNegativeInteger(value.passed)??0,failed:normalizeNonNegativeInteger(value.failed)??0,skipped:normalizeNonNegativeInteger(value.skipped)??0,items:normalizeNonNegativeInteger(value.items),linked_tests:normalizeNonNegativeInteger(value.linked_tests),fail_on_skipped_triggered:value.fail_on_skipped_triggered===!0?!0:void 0,measurements:normalizeTestRunMeasurements(value.measurements),executions:normalizeTestRunExecutions(value.executions)};return deleteUndefinedFields(summary),summary}function sortTests(values){if(!(!Array.isArray(values)||values.length===0))return values.map(normalizeLinkedTest)}function normalizeTrimmedStringList(value){if(!Array.isArray(value))return;const normalized=[...new Set(value.filter(entry=>typeof entry=="string").map(entry=>entry.trim()).filter(entry=>entry.length>0))].sort((a,b)=>a.localeCompare(b));return normalized.length>0?normalized:void 0}function isPlainObjectRecord(value){if(!value||typeof value!="object"||Array.isArray(value))return!1;const prototype=Object.getPrototypeOf(value);return prototype===Object.prototype||prototype===null}function isUnsafeObjectKey(key){return key==="__proto__"||key==="constructor"||key==="prototype"}function normalizeStringRecord(value){if(!isPlainObjectRecord(value))return;const entries=Object.entries(value).map(([key,recordValue])=>[key.trim(),String(recordValue).trim()]).filter(([key,recordValue])=>key.length>0&&!isUnsafeObjectKey(key)&&recordValue.length>0).sort(([left],[right])=>left.localeCompare(right));return entries.length>0?Object.fromEntries(entries):void 0}function normalizeNumericRecord(value){if(!isPlainObjectRecord(value))return;const entries=Object.entries(value).map(([key,recordValue])=>[key.trim(),Number(recordValue)]).filter(([key,recordValue])=>key.length>0&&!isUnsafeObjectKey(key)&&Number.isFinite(recordValue)).sort(([left],[right])=>left.localeCompare(right));return entries.length>0?Object.fromEntries(entries):void 0}function normalizeLinkedTestContextMode(value){const normalized=value?.trim().toLowerCase();if(!(!normalized||!LINKED_TEST_PM_CONTEXT_MODE_VALUES.has(normalized)))return normalized}function normalizeLinkedTestWorkspaceContextMode(value){const normalized=value?.trim().toLowerCase();if(!(!normalized||!LINKED_TEST_WORKSPACE_CONTEXT_MODE_VALUES.has(normalized)))return normalized}function normalizeLinkedTestProvenance(value,invalid){if(invalid===!0)return{provenance_invalid:!0};if(value===void 0)return{};if(!isPlainObjectRecord(value))return{provenance_invalid:!0};const author=trimStringOrUndefined(value.author),createdAt=trimStringOrUndefined(value.created_at),sourceKind=value.source_kind;return!author||!createdAt||!isTimestampLiteral(createdAt)||sourceKind!=="local_mutation"&&sourceKind!=="merge_union"?{provenance_invalid:!0}:{provenance:{author,created_at:createdAt,source_kind:sourceKind,source_ref:trimStringOrUndefined(value.source_ref)}}}function normalizeLinkedTest(value){const test={command:value.command?.trim()||void 0,path:value.path?normalizePathValue(value.path):void 0,scope:value.scope,timeout_seconds:typeof value.timeout_seconds=="number"&&Number.isFinite(value.timeout_seconds)&&value.timeout_seconds>0?value.timeout_seconds:void 0,pm_context_mode:normalizeLinkedTestContextMode(value.pm_context_mode),workspace_context_mode:normalizeLinkedTestWorkspaceContextMode(value.workspace_context_mode),...normalizeLinkedTestProvenance(value.provenance,value.provenance_invalid),updated_by:trimStringOrUndefined(value.updated_by),updated_at:trimStringOrUndefined(value.updated_at),env_set:normalizeStringRecord(value.env_set),env_clear:normalizeTrimmedStringList(value.env_clear),shared_host_safe:value.shared_host_safe===!0?!0:void 0,assert_stdout_contains:normalizeTrimmedStringList(value.assert_stdout_contains),assert_stdout_regex:normalizeTrimmedStringList(value.assert_stdout_regex),assert_stderr_contains:normalizeTrimmedStringList(value.assert_stderr_contains),assert_stderr_regex:normalizeTrimmedStringList(value.assert_stderr_regex),assert_stdout_min_lines:normalizeNonNegativeInteger(value.assert_stdout_min_lines),assert_json_field_equals:normalizeStringRecord(value.assert_json_field_equals),assert_json_field_gte:normalizeNumericRecord(value.assert_json_field_gte),note:value.note?.trim()||void 0};return deleteUndefinedFields(test),test}function sortDocs(values){if(!(!values||values.length===0))return[...values].map(value=>({path:normalizePathValue(value.path),scope:value.scope,note:value.note?.trim()||void 0})).sort((a,b)=>{const byScope=a.scope.localeCompare(b.scope);if(byScope!==0)return byScope;const byPath=a.path.localeCompare(b.path);return byPath!==0?byPath:(a.note??"").localeCompare(b.note??"")})}function trimStringOrUndefined(value){if(typeof value!="string")return;const trimmed=value.trim();return trimmed.length>0?trimmed:void 0}function normalizePlanStepLinks(value){if(!Array.isArray(value))return;const out=[];for(const entry of value){if(entry===null||typeof entry!="object")continue;const record=entry,id=trimStringOrUndefined(record.id),kind=trimStringOrUndefined(record.kind);if(!id||!kind)continue;const link={id,kind},note=trimStringOrUndefined(record.note);note&&(link.note=note),record.required_before_step===!0&&(link.required_before_step=!0),out.push(link)}return out.length>0?out:void 0}function normalizePlanStepFiles(value){if(!Array.isArray(value))return;const out=[];for(const entry of value){if(entry===null||typeof entry!="object")continue;const record=entry,path=trimStringOrUndefined(record.path);if(!path)continue;const file={path:normalizePathValue(path)};(record.scope==="project"||record.scope==="global")&&(file.scope=record.scope);const note=trimStringOrUndefined(record.note);note&&(file.note=note),out.push(file)}return out.length>0?out:void 0}function normalizePlanStepTests(value){if(!Array.isArray(value))return;const out=[];for(const entry of value){if(entry===null||typeof entry!="object")continue;const record=entry,command=trimStringOrUndefined(record.command),path=trimStringOrUndefined(record.path);if(!command&&!path)continue;const test={};command&&(test.command=command),path&&(test.path=normalizePathValue(path));const note=trimStringOrUndefined(record.note);note&&(test.note=note),out.push(test)}return out.length>0?out:void 0}function normalizePlanStepDocs(value){if(!Array.isArray(value))return;const out=[];for(const entry of value){if(entry===null||typeof entry!="object")continue;const record=entry,path=trimStringOrUndefined(record.path);if(!path)continue;const doc={path:normalizePathValue(path)};(record.scope==="project"||record.scope==="global")&&(doc.scope=record.scope);const note=trimStringOrUndefined(record.note);note&&(doc.note=note),out.push(doc)}return out.length>0?out:void 0}function normalizePlanStepEntry(entry){if(entry===null||typeof entry!="object")return;const record=entry,id=trimStringOrUndefined(record.id),title=trimStringOrUndefined(record.title),statusRaw=trimStringOrUndefined(record.status),status=statusRaw&&PLAN_STEP_STATUS_SET.has(statusRaw)?statusRaw:void 0,order=coerceFiniteNumber(record.order)??Number.NaN,created_at=typeof record.created_at=="string"?record.created_at:"",updated_at=typeof record.updated_at=="string"?record.updated_at:"";if(!id||!title||!status||!Number.isFinite(order)||!created_at||!updated_at)return;const step={id,order,title,status,created_at,updated_at};return applyPlanStepOptionalFields(step,record),step}function applyPlanStepOptionalFields(step,record){const stringFields=[["body","body"],["owner","owner"],["evidence","evidence"],["blocked_reason","blocked_reason"],["superseded_by","superseded_by"]];for(const[target,source]of stringFields){const value=trimStringOrUndefined(record[source]);value&&(step[target]=value)}const completedAt=typeof record.completed_at=="string"?record.completed_at:void 0;completedAt&&completedAt.length>0&&(step.completed_at=completedAt);const collectionFields=[["linked_items","linked_items",normalizePlanStepLinks],["files","files",normalizePlanStepFiles],["tests","tests",normalizePlanStepTests],["docs","docs",normalizePlanStepDocs]];for(const[target,source,normalize]of collectionFields){const value=normalize(record[source]);value&&(step[target]=value)}}function normalizePlanSteps(value){if(!Array.isArray(value))return;const out=value.flatMap(entry=>{const step=normalizePlanStepEntry(entry);return step?[step]:[]});return out.sort((left,right)=>left.order-right.order),out.length>0?out:void 0}function normalizePlanDecisions(value){if(!Array.isArray(value))return;const out=[];for(const entry of value){if(entry===null||typeof entry!="object")continue;const record=entry,ts=typeof record.ts=="string"?record.ts:"",author=typeof record.author=="string"?record.author:"",decision=trimStringOrUndefined(record.decision);if(!ts||!author||!decision)continue;const item={ts,author,decision},rationale=trimStringOrUndefined(record.rationale);rationale&&(item.rationale=rationale);const evidence=trimStringOrUndefined(record.evidence);evidence&&(item.evidence=evidence);const stepId=trimStringOrUndefined(record.step_id);stepId&&(item.step_id=stepId),out.push(item)}return out.length>0?out:void 0}function normalizePlanDiscoveries(value){if(!Array.isArray(value))return;const out=[];for(const entry of value){if(entry===null||typeof entry!="object")continue;const record=entry,ts=typeof record.ts=="string"?record.ts:"",author=typeof record.author=="string"?record.author:"",text=trimStringOrUndefined(record.text);if(!ts||!author||!text)continue;const item={ts,author,text},stepId=trimStringOrUndefined(record.step_id);stepId&&(item.step_id=stepId),out.push(item)}return out.length>0?out:void 0}function normalizePlanValidation(value){if(!Array.isArray(value))return;const out=[];for(const entry of value){if(entry===null||typeof entry!="object")continue;const record=entry,text=trimStringOrUndefined(record.text);if(!text)continue;const item={text},command=trimStringOrUndefined(record.command);command&&(item.command=command);const expected=trimStringOrUndefined(record.expected);expected&&(item.expected=expected),out.push(item)}return out.length>0?out:void 0}function normalizeTypeOptions(values){if(!values)return;const normalizedEntries=Object.entries(values).map(([key,value])=>[key.trim(),value.trim()]).filter(([key,value])=>key.length>0&&value.length>0).sort((left,right)=>left[0].localeCompare(right[0]));if(normalizedEntries.length!==0)return Object.fromEntries(normalizedEntries)}function normalizeBody(body){let start=0;for(;start<body.length&&body[start]===`
|
|
2
2
|
`;)start+=1;return body.slice(start).trimEnd()}function normalizeConfidenceValue(value){if(value===void 0)return;if(typeof value=="number")return value;const normalized=value.trim().toLowerCase();if(normalized==="med")return"medium";if(CONFIDENCE_TEXT_VALUES.includes(normalized))return normalized}function normalizeSeverityValue(value){if(value===void 0)return;const normalized=value.trim().toLowerCase();if(normalized==="med")return"medium";if(ISSUE_SEVERITY_VALUES.includes(normalized))return normalized}function emptyStringToUndefined(value){return value||void 0}function copyExtensionItemMetadataFields(normalized,source){const targetRecord=normalized,sourceRecord=source;for(const[key,value]of Object.entries(sourceRecord))isUnsafeObjectKey(key)||Object.prototype.hasOwnProperty.call(targetRecord,key)||value===void 0||(targetRecord[key]=value)}function coerceNormalizedRuntimeFields(normalized,runtimeContext){if(!runtimeContext?.fieldRegistry)return;const record=normalized;for(const definition of runtimeContext.fieldRegistry.definitions){const currentValue=record[definition.metadata_key];currentValue!==void 0&&(record[definition.metadata_key]=coerceRuntimeFieldValue(definition,currentValue,`metadata field "${definition.metadata_key}"`,"metadata"))}}function assertNormalizedUnknownFields(normalized,runtimeContext){if(!runtimeContext||runtimeContext.unknownFieldPolicy==="allow")return;const knownKeys=buildKnownItemMetadataKeys(runtimeContext),unknownKeys=Object.keys(normalized).filter(key=>!knownKeys.has(key)).sort((left,right)=>left.localeCompare(right));unknownKeys.length>0&&runtimeContext.unknownFieldPolicy==="reject"&&validationError(`unknown schema fields are not allowed: ${unknownKeys.join(", ")}`),unknownKeys.length>0&&runtimeContext.onWarning?.(`item_unknown_schema_fields:${unknownKeys.join(",")}`)}function normalizeItemMetadata(itemMetadata,options={}){const runtimeContext=resolveRuntimeSchemaValidationContext(options),normalizedStatus=normalizeStatusInput(itemMetadata.status,runtimeContext?.statusRegistry)??itemMetadata.status,tags=Array.from(new Set((Array.isArray(itemMetadata.tags)?itemMetadata.tags:[]).filter(tag=>typeof tag=="string").map(tag=>tag.trim().toLowerCase()).filter(Boolean))).sort((a,b)=>a.localeCompare(b)),normalized={id:itemMetadata.id,title:itemMetadata.title,description:itemMetadata.description,type:itemMetadata.type,pm_format_version:normalizeItemFormatVersion(itemMetadata.pm_format_version),source_type:trimStringOrUndefined(itemMetadata.source_type),type_options:normalizeTypeOptions(itemMetadata.type_options),status:normalizedStatus,priority:itemMetadata.priority,tags,created_at:itemMetadata.created_at,updated_at:itemMetadata.updated_at,dependencies:sortDependencies(itemMetadata.dependencies),comments:sortLogValues(itemMetadata.comments),notes:sortLogValues(itemMetadata.notes),learnings:sortLogValues(itemMetadata.learnings),files:normalizeFiles(itemMetadata.files),tests:sortTests(itemMetadata.tests),test_runs:normalizeTestRunSummaries(itemMetadata.test_runs),docs:sortDocs(itemMetadata.docs),deadline:emptyStringToUndefined(itemMetadata.deadline),reminders:sortReminders(itemMetadata.reminders),events:sortEvents(itemMetadata.events),closed_at:emptyStringToUndefined(itemMetadata.closed_at),completed_at:emptyStringToUndefined(itemMetadata.completed_at),assignee:trimStringOrUndefined(itemMetadata.assignee),claim_principal:trimStringOrUndefined(itemMetadata.claim_principal),source_owner:trimStringOrUndefined(itemMetadata.source_owner),author:emptyStringToUndefined(itemMetadata.author),estimated_minutes:itemMetadata.estimated_minutes,acceptance_criteria:itemMetadata.acceptance_criteria??void 0,design:itemMetadata.design??void 0,external_ref:itemMetadata.external_ref??void 0,definition_of_ready:trimStringOrUndefined(itemMetadata.definition_of_ready),order:itemMetadata.order,goal:trimStringOrUndefined(itemMetadata.goal),objective:trimStringOrUndefined(itemMetadata.objective),value:trimStringOrUndefined(itemMetadata.value),impact:trimStringOrUndefined(itemMetadata.impact),outcome:trimStringOrUndefined(itemMetadata.outcome),why_now:trimStringOrUndefined(itemMetadata.why_now),parent:trimStringOrUndefined(itemMetadata.parent),reviewer:trimStringOrUndefined(itemMetadata.reviewer),risk:itemMetadata.risk??void 0,confidence:normalizeConfidenceValue(itemMetadata.confidence),sprint:trimStringOrUndefined(itemMetadata.sprint),release:trimStringOrUndefined(itemMetadata.release),blocked_by:trimStringOrUndefined(itemMetadata.blocked_by),blocked_reason:trimStringOrUndefined(itemMetadata.blocked_reason),unblock_note:trimStringOrUndefined(itemMetadata.unblock_note),reporter:trimStringOrUndefined(itemMetadata.reporter),severity:normalizeSeverityValue(itemMetadata.severity),environment:trimStringOrUndefined(itemMetadata.environment),repro_steps:trimStringOrUndefined(itemMetadata.repro_steps),resolution:trimStringOrUndefined(itemMetadata.resolution),expected_result:trimStringOrUndefined(itemMetadata.expected_result),actual_result:trimStringOrUndefined(itemMetadata.actual_result),affected_version:trimStringOrUndefined(itemMetadata.affected_version),fixed_version:trimStringOrUndefined(itemMetadata.fixed_version),component:trimStringOrUndefined(itemMetadata.component),regression:itemMetadata.regression,customer_impact:trimStringOrUndefined(itemMetadata.customer_impact),close_reason:emptyStringToUndefined(itemMetadata.close_reason),plan_mode:trimStringOrUndefined(itemMetadata.plan_mode),plan_scope:trimStringOrUndefined(itemMetadata.plan_scope),plan_harness:trimStringOrUndefined(itemMetadata.plan_harness),plan_resume_context:trimStringOrUndefined(itemMetadata.plan_resume_context),plan_steps:normalizePlanSteps(itemMetadata.plan_steps),plan_decisions:normalizePlanDecisions(itemMetadata.plan_decisions),plan_discoveries:normalizePlanDiscoveries(itemMetadata.plan_discoveries),plan_validation:normalizePlanValidation(itemMetadata.plan_validation)};return copyExtensionItemMetadataFields(normalized,itemMetadata),coerceNormalizedRuntimeFields(normalized,runtimeContext),assertNormalizedUnknownFields(normalized,runtimeContext),deleteUndefinedFields(normalized),normalized}function orderItemMetadata(itemMetadata){return orderObject(itemMetadata,ITEM_METADATA_KEY_ORDER)}function findJsonObjectEnd(content){let depth=0,inString=!1,escaped=!1;for(let i=0;i<content.length;i+=1){const char=content[i];if(inString){if(escaped){escaped=!1;continue}if(char==="\\"){escaped=!0;continue}char==='"'&&(inString=!1);continue}if(char==='"'){inString=!0;continue}if(char==="{"){depth+=1;continue}if(char==="}"&&(depth-=1,depth===0))return i}return-1}function splitFrontMatter(content){if(!content.startsWith("{"))return{frontMatter:"",body:content};const end=findJsonObjectEnd(content);if(end<0)return{frontMatter:"",body:content};const frontMatter=content.slice(0,end+1),body=content.slice(end+1).replace(/^\r?\n+/,"");return{frontMatter,body}}function stripLeadingYamlDocument(content){const normalizedContent=content.charCodeAt(0)===65279?content.slice(1):content,opener=normalizedContent.match(/^[ \t]*---[ \t]*(?:\r?\n|$)/);if(!opener)return{content:normalizedContent,stripped:!1};let cursor=opener[0].length;for(;cursor<normalizedContent.length;){const nextNewline=normalizedContent.indexOf(`
|
|
3
3
|
`,cursor),lineEnd=nextNewline===-1?normalizedContent.length:nextNewline,line=normalizedContent.slice(cursor,lineEnd).replace(/\r$/,""),afterLine=nextNewline===-1?lineEnd:lineEnd+1;if(line.trim()==="---")return{content:normalizedContent.slice(afterLine).replace(/^\s+/,""),stripped:!0};cursor=afterLine}return{content:normalizedContent,stripped:!1}}function normalizeParsedItemMetadata(itemMetadata,options){return normalizeItemMetadata(itemMetadata,{...options,onWarning:void 0})}function parseJsonMarkdownItemDocument(content,runtimeContext,options={}){const normalized=stripLeadingYamlDocument(content);normalized.stripped&&options.onWarning?.("json_markdown_leading_yaml_frontmatter_ignored");const{frontMatter,body}=splitFrontMatter(normalized.content);frontMatter||(content.trimStart().startsWith("{")&&documentSyntaxError("json_markdown","JSON front matter is not valid JSON"),documentSyntaxError("json_markdown","JSON Markdown item document is missing JSON front matter"));let parsed;try{parsed=JSON.parse(frontMatter)}catch{documentSyntaxError("json_markdown","JSON front matter is not valid JSON")}return assertSupportedItemFormat(parsed,options.requireSupportedFormat),assertValidItemMetadata(parsed,runtimeContext),{metadata:normalizeParsedItemMetadata(parsed,options),body:normalizeBody(body)}}function parseToonItemDocument(content,runtimeContext,options={}){let parsed;try{parsed=decodeToonItemContent(content).value}catch{documentSyntaxError("toon","TOON item document is not valid TOON")}assertItemMetadataCondition(typeof parsed=="object"&&parsed!==null&&!Array.isArray(parsed),"TOON item document must be an object");const record=parsed;if(assertSupportedItemFormat(Object.prototype.hasOwnProperty.call(record,"front_matter")?record.front_matter:record,options.requireSupportedFormat),!REQUIRED_STRING_FIELDS.some(fieldName=>Object.prototype.hasOwnProperty.call(record,fieldName))&&!Object.prototype.hasOwnProperty.call(record,"front_matter")&&documentSyntaxError("toon","TOON input does not have the shape of an item document"),Object.prototype.hasOwnProperty.call(record,"front_matter"))return assertValidItemMetadata(record.front_matter,runtimeContext),assertItemMetadataCondition(record.body===void 0||typeof record.body=="string","TOON item document body must be a string"),{metadata:normalizeParsedItemMetadata(record.front_matter,options),body:normalizeBody(typeof record.body=="string"?record.body:"")};const{body,...itemMetadataRecord}=record;return assertItemMetadataCondition(body===void 0||typeof body=="string","TOON item document body must be a string"),assertValidItemMetadata(itemMetadataRecord,runtimeContext),{metadata:normalizeParsedItemMetadata(itemMetadataRecord,options),body:normalizeBody(typeof body=="string"?body:"")}}function serializeJsonMarkdownItemDocument(document,options={}){const normalizedMetadata=normalizeItemMetadata(document.metadata,options),orderedMetadata=orderItemMetadata(normalizedMetadata),serializedMetadata=JSON.stringify(orderedMetadata,null,2),normalizedBody=normalizeBody(document.body??"");return normalizedBody?`${serializedMetadata}
|
|
4
4
|
|
|
5
5
|
${normalizedBody}
|
|
6
6
|
`:`${serializedMetadata}
|
|
7
7
|
`}function serializeToonItemDocument(document,options={}){const normalizedMetadata=normalizeItemMetadata(document.metadata,options),orderedMetadata=orderItemMetadata(normalizedMetadata),normalizedBody=normalizeBody(document.body??""),payload={...orderedMetadata,body:normalizedBody},encodablePayload=JSON.parse(JSON.stringify(payload)),serialized=encodeToon(encodablePayload);let decoded;try{decoded=decodeToonItemContent(serialized).value}catch(error){throw new PmCliError("Refusing to persist a TOON item document that the configured decoder cannot read back.",EXIT_CODE.GENERIC_FAILURE,{code:"item_document_roundtrip_failed",reason:"encode_decode_error",format:"toon",required:"Upgrade or repair the TOON codec before retrying the mutation; no item bytes were written.",why:error instanceof Error?error.message:String(error)})}if(!isDeepStrictEqual(decoded,encodablePayload)){const decodedRecord=typeof decoded=="object"&&decoded!==null&&!Array.isArray(decoded)?decoded:{},field=Object.keys(encodablePayload).find(key=>!isDeepStrictEqual(encodablePayload[key],decodedRecord[key]))??"document";throw new PmCliError(`Refusing to persist a lossy TOON item document; round-trip mismatch at field "${field}".`,EXIT_CODE.GENERIC_FAILURE,{code:"item_document_roundtrip_failed",reason:"encode_decode_mismatch",format:"toon",field,required:"Upgrade or repair the TOON codec before retrying the mutation; no item bytes were written.",why:"The encoded document decoded to a value different from the canonical item payload."})}return`${serialized}
|
|
8
|
-
`}function parseItemDocument(content,options={}){const conflictMarker=findFirstMergeConflictMarker(content);if(conflictMarker)throw new PmCliError(`Merge conflict markers detected in item document at line ${conflictMarker.line} (${conflictMarker.marker}). Resolve <<<<<<< ======= >>>>>>> markers and retry.`,EXIT_CODE.GENERIC_FAILURE,{code:"merge_conflict_markers_detected",reason:"merge_conflict",required:"Resolve merge-conflict markers in the item file before parsing or mutation commands.",why:"Partially merged documents can corrupt item metadata and history integrity.",examples:["git status","git add <resolved-file> && git commit"],nextSteps:["Resolve conflicts, save the file, then rerun the pm command."]});const format=options.format??"toon",runtimeContext=resolveRuntimeSchemaValidationContext(options);return format==="toon"?parseToonItemDocument(content,runtimeContext,options):parseJsonMarkdownItemDocument(content,runtimeContext,options)}function serializeItemDocument(document,options={}){return(options.format??"toon")==="toon"?serializeToonItemDocument(document,options):serializeJsonMarkdownItemDocument(document,options)}function canonicalDocument(document,options={}){return{metadata:normalizeItemMetadata(document.metadata,options),body:normalizeBody(document.body??"")}}const _testOnlyItemFormat={buildKnownItemMetadataKeys,firstNonZeroComparison,normalizeBody,normalizePlanDecisions,normalizePlanDiscoveries,normalizePlanStepDocs,normalizePlanStepFiles,normalizePlanStepLinks,normalizePlanSteps,normalizePlanStepTests,normalizePlanValidation,normalizeTestRunSummaries,normalizeTypeOptions,runtimeFieldRequiredForType,sortTests};export{_testOnlyItemFormat,canonicalDocument,normalizeItemMetadata,parseItemDocument,serializeItemDocument,splitFrontMatter};
|
|
8
|
+
`}function parseItemDocument(content,options={}){const conflictMarker=findFirstMergeConflictMarker(content);if(conflictMarker)throw new PmCliError(`Merge conflict markers detected in item document at line ${conflictMarker.line} (${conflictMarker.marker}). Resolve <<<<<<< ======= >>>>>>> markers and retry.`,EXIT_CODE.GENERIC_FAILURE,{code:"merge_conflict_markers_detected",reason:"merge_conflict",required:"Resolve merge-conflict markers in the item file before parsing or mutation commands.",why:"Partially merged documents can corrupt item metadata and history integrity.",examples:["git status","git add <resolved-file> && git commit"],nextSteps:["Resolve conflicts, save the file, then rerun the pm command."]});const format=options.format??"toon",runtimeContext=resolveRuntimeSchemaValidationContext(options);return format==="toon"?parseToonItemDocument(content,runtimeContext,options):parseJsonMarkdownItemDocument(content,runtimeContext,options)}function serializeItemDocument(document,options={}){return(options.format??"toon")==="toon"?serializeToonItemDocument(document,options):serializeJsonMarkdownItemDocument(document,options)}function canonicalDocument(document,options={}){return{metadata:normalizeItemMetadata(document.metadata,options),body:normalizeBody(document.body??"")}}const _testOnlyItemFormat={buildKnownItemMetadataKeys,firstNonZeroComparison,normalizeBody,normalizePlanDecisions,normalizePlanDiscoveries,normalizePlanStepDocs,normalizePlanStepFiles,normalizePlanStepLinks,normalizePlanSteps,normalizePlanStepTests,normalizePlanValidation,normalizeTestRunSummaries,normalizeTypeOptions,runtimeFieldRequiredForType,sortTests};export{_testOnlyItemFormat,canonicalDocument,normalizeItemMetadata,normalizeLinkedTest,parseItemDocument,serializeItemDocument,splitFrontMatter};
|
|
9
9
|
//# sourceMappingURL=item-format.js.map
|
|
@@ -35,8 +35,8 @@ export declare function normalizeItemTypeCommandOptionPolicy(policy: ItemTypeCom
|
|
|
35
35
|
export declare function normalizeItemTypeCommandOptionPolicies(policies: ItemTypeCommandOptionPolicy[] | undefined, resolvePolicyCommand: ResolvePolicyCommand): ItemTypeCommandOptionPolicy[];
|
|
36
36
|
/** Documents the normalize item type definition options payload exchanged by command, SDK, and package integrations. */
|
|
37
37
|
export interface NormalizeItemTypeDefinitionOptions {
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
/** How to resolve a raw policy `command` value (defaults to {@link keepPolicyCommand}). */
|
|
39
|
+
resolvePolicyCommand?: ResolvePolicyCommand;
|
|
40
40
|
}
|
|
41
41
|
/** Validate an execution role before a settings or extension definition enters scheduling. Unknown values fail instead of silently enabling dispatch. */
|
|
42
42
|
export declare function parseItemExecutionRole(value: unknown): ItemTypeDefinition["execution_role"];
|
|
@@ -12,7 +12,7 @@ export declare function normalizeParentReferenceValue(rawValue: unknown): string
|
|
|
12
12
|
export declare function isPlaceholderReferenceToken(value: string): boolean;
|
|
13
13
|
/** Implements validate missing parent reference for the public runtime surface of this module. */
|
|
14
14
|
export declare function validateMissingParentReference(parentId: string, policy: ParentReferencePolicy): {
|
|
15
|
-
|
|
15
|
+
warnings: string[];
|
|
16
16
|
};
|
|
17
17
|
/** Rejects the one-node hierarchy cycle where an item points at itself. */
|
|
18
18
|
export declare function assertParentReferenceIsNotSelf(itemId: string, parentId: string, prefix: string): void;
|
|
@@ -8,8 +8,8 @@ export declare function collectTagFlagValues(values: readonly string[] | undefin
|
|
|
8
8
|
export declare function splitAcceptanceCriteria(value: unknown): string[];
|
|
9
9
|
/** Apply additive/subtractive acceptance-criteria mutations to a base criteria list. Used by `pm update --add-ac/--remove-ac` so individual semicolon-free criteria can be edited without replacing the whole `acceptance_criteria` value (tag-API parity; disjoint additions merge cleanly across branches). Additions append in argv order and dedupe on exact trimmed text; removals match exact trimmed text and report unmatched selectors so a typo never becomes a silent no-op. */
|
|
10
10
|
export declare function applyAcceptanceCriteriaMutations(baseCriteria: readonly string[], add: readonly string[] | undefined, remove: readonly string[] | undefined): {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
criteria: string[];
|
|
12
|
+
unmatchedRemovals: string[];
|
|
13
13
|
};
|
|
14
14
|
/** Apply an additive tag mutation to a base tag list. Used by `pm create` and `pm update` so `--add-tags` extends `--tags` (or the existing tags) without replacing them. Output is sorted + deduped lowercase, matching `parseTags`. */
|
|
15
15
|
export declare function mergeAdditiveTags(baseTags: readonly string[], add: readonly string[] | undefined): string[];
|
|
@@ -56,10 +56,10 @@ export declare function assertNoAmbiguousBareCommaEntry(raw: string, optionName:
|
|
|
56
56
|
export declare function assertNoUnknownCsvKeys(kv: Record<string, string>, optionName: string, allowedKeys: readonly string[]): void;
|
|
57
57
|
/** Documents the stdin token resolver payload exchanged by command, SDK, and package integrations. */
|
|
58
58
|
export interface StdinTokenResolver {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
/** Value that configures or reports resolve value for this contract. */
|
|
60
|
+
resolveValue(value: string | undefined, optionName: string, resolveToken?: boolean): Promise<string | undefined>;
|
|
61
|
+
/** Value that configures or reports resolve list for this contract. */
|
|
62
|
+
resolveList(values: string[] | undefined, optionName: string, resolveToken?: boolean): Promise<string[] | undefined>;
|
|
63
63
|
}
|
|
64
64
|
/** Mark transport-decoded options whose dash values are data, not stdin tokens. */
|
|
65
65
|
export declare function preserveMutationStdinTokenLiterals<T extends object>(options: T): T;
|
|
@@ -75,9 +75,9 @@ export declare function shouldResolveMutationStdinTokens(options: object): boole
|
|
|
75
75
|
export declare function shouldResolveMutationStdinTokenField(options: object, field: PropertyKey): boolean;
|
|
76
76
|
/** Refuse competing stdin-token fields before any resolver starts reading. */
|
|
77
77
|
export declare function assertSingleStdinTokenConsumer(candidates: readonly {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
value: string | readonly string[] | undefined;
|
|
79
|
+
optionName: string;
|
|
80
|
+
resolveToken?: boolean;
|
|
81
81
|
}[]): void;
|
|
82
82
|
/** Resolve a typed mutation option bag only after its complete stdin plan is conflict-free. */
|
|
83
83
|
export declare function resolveMutationStdinTokenFields<T extends object>(options: T, scalarFields: readonly (readonly [keyof T & string, string])[], listFields: readonly (readonly [keyof T & string, string])[]): Promise<T>;
|
|
@@ -89,8 +89,8 @@ export declare function parseOptionalNumber(raw: string, optionName: string): nu
|
|
|
89
89
|
export declare function parseOptionalNonNegativeInteger(raw: string, optionName: string): number;
|
|
90
90
|
/** Public contract for test only, shared by SDK and presentation-layer consumers. */
|
|
91
91
|
export declare const _testOnly: {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
coerceJsonTagArray: typeof coerceJsonTagArray;
|
|
93
|
+
stripCodeFenceEnvelope: typeof stripCodeFenceEnvelope;
|
|
94
|
+
parseMarkdownKeyValueLines: typeof parseMarkdownKeyValueLines;
|
|
95
95
|
};
|
|
96
96
|
export {};
|
|
@@ -8,6 +8,6 @@ import type { SprintReleaseFormatPolicy } from "../../types/index.js";
|
|
|
8
8
|
export declare function normalizeSprintReleaseFormatPolicy(value: string | undefined): SprintReleaseFormatPolicy;
|
|
9
9
|
/** Implements validate sprint or release value for the public runtime surface of this module. */
|
|
10
10
|
export declare function validateSprintOrReleaseValue(field: "sprint" | "release", rawValue: string, policy: SprintReleaseFormatPolicy): {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
value: string;
|
|
12
|
+
warnings: string[];
|
|
13
13
|
};
|
|
@@ -13,10 +13,10 @@ export declare function isStatusAllFilterInput(raw: unknown): boolean;
|
|
|
13
13
|
export declare function resolveStatusFilterToken(token: string, registry: RuntimeStatusRegistry): ItemStatus | undefined;
|
|
14
14
|
/** Documents the parse status filter options payload exchanged by command, SDK, and package integrations. */
|
|
15
15
|
export interface ParseStatusFilterOptions {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
/** When true, an unrecognized token throws a USAGE error with a did-you-mean hint. When false (default), an unrecognized token is passed through verbatim so custom/unknown statuses still compare against item values by their raw string — preserving the long-standing lenient `pm list` behavior. */
|
|
17
|
+
strict?: boolean;
|
|
18
|
+
/** Flag label used in error messages (default: "--status"). */
|
|
19
|
+
flagLabel?: string;
|
|
20
20
|
}
|
|
21
21
|
/** Parse a comma-separated status filter into a de-duplicated list of concrete status ids. A standalone `all` sentinel intentionally resolves to no filter so duplicate-discovery loops can search every lifecycle bucket with the same `--status` flag shape. Shared by `pm list` (lenient) and `pm search` (strict, with a did-you-mean hint on typos) so both surfaces resolve the open/closed/canceled workflow-group aliases identically. */
|
|
22
22
|
export declare function parseStatusFilterCsv(raw: unknown, registry: RuntimeStatusRegistry, options?: ParseStatusFilterOptions): ItemStatus[] | undefined;
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
export declare const TOON_SCALAR_BRACKET_ESCAPE_UPSTREAM_PR: "https://github.com/toon-format/toon/pull/314";
|
|
3
3
|
/** Historical tracking for the scalar-bracket decoder defect fixed upstream in TOON 2.3.1. */
|
|
4
4
|
export declare const TOON_SCALAR_BRACKET_ESCAPE_TRACKING: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
readonly dependency: "@toon-format/toon";
|
|
6
|
+
readonly affected_versions: "<=2.3.0";
|
|
7
|
+
readonly resolved_version: "2.3.1";
|
|
8
|
+
readonly upstream_pr: "https://github.com/toon-format/toon/pull/314";
|
|
9
|
+
readonly workaround_status: "removed";
|
|
10
10
|
};
|
|
11
11
|
/** Documents the toon decode result payload exchanged by command, SDK, and package integrations. */
|
|
12
12
|
export interface ToonDecodeResult {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
/** The decoded TOON document. */
|
|
14
|
+
value: unknown;
|
|
15
|
+
/** Always false since TOON 2.3.1 fixed strict scalar-bracket decoding upstream. */
|
|
16
|
+
usedScalarBracketEscape: boolean;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Decode a TOON item document with the dependency's strict parser.
|
|
@@ -12,50 +12,50 @@ export type CommandOptionPolicyCommand = "create" | "update";
|
|
|
12
12
|
export declare const COMMON_MUTATION_COMMAND_OPTION_KEYS: readonly ["deadline", "estimatedMinutes", "acceptanceCriteria", "definitionOfReady", "order", "goal", "objective", "value", "impact", "outcome", "whyNow", "assignee", "parent", "reviewer", "risk", "confidence", "sprint", "release", "blockedBy", "blockedReason", "unblockNote", "reporter", "severity", "environment", "reproSteps", "resolution", "expectedResult", "actualResult", "affectedVersion", "fixedVersion", "component", "regression", "customerImpact"];
|
|
13
13
|
/** Documents the command option policy state payload exchanged by command, SDK, and package integrations. */
|
|
14
14
|
export interface CommandOptionPolicyState {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
/** Value that configures or reports required for this contract. */
|
|
16
|
+
required: string[];
|
|
17
|
+
/** Value that configures or reports hidden for this contract. */
|
|
18
|
+
hidden: string[];
|
|
19
|
+
/** Whether disabled applies to this operation. */
|
|
20
|
+
disabled: string[];
|
|
21
|
+
/** Value that configures or reports errors for this contract. */
|
|
22
|
+
errors: string[];
|
|
23
23
|
}
|
|
24
24
|
/** Documents the resolved item type definition payload exchanged by command, SDK, and package integrations. */
|
|
25
25
|
export interface ResolvedItemTypeDefinition {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
26
|
+
/** Value that configures or reports name for this contract. */
|
|
27
|
+
name: string;
|
|
28
|
+
/** Optional human description carried from the type definition. */
|
|
29
|
+
description?: string;
|
|
30
|
+
/** Value that configures or reports folder for this contract. */
|
|
31
|
+
folder: string;
|
|
32
|
+
/** Value that configures or reports aliases for this contract. */
|
|
33
|
+
aliases: string[];
|
|
34
|
+
/** Optional per-type status applied at create time when `--status` is omitted. */
|
|
35
|
+
default_status?: string;
|
|
36
|
+
/** Effective dispatch role; absent legacy definitions are resolved through the built-in defaults. */
|
|
37
|
+
execution_role?: ItemTypeDefinition["execution_role"];
|
|
38
|
+
/** Value that configures or reports required create fields for this contract. */
|
|
39
|
+
required_create_fields: string[];
|
|
40
|
+
/** Value that configures or reports required create repeatables for this contract. */
|
|
41
|
+
required_create_repeatables: string[];
|
|
42
|
+
/** Value that configures or reports options for this contract. */
|
|
43
|
+
options: ItemTypeOptionDefinition[];
|
|
44
|
+
/** Value that configures or reports command option policies for this contract. */
|
|
45
|
+
command_option_policies: ItemTypeCommandOptionPolicy[];
|
|
46
46
|
}
|
|
47
47
|
/** Documents the item type registry payload exchanged by command, SDK, and package integrations. */
|
|
48
48
|
export interface ItemTypeRegistry {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
49
|
+
/** Value that configures or reports types for this contract. */
|
|
50
|
+
types: string[];
|
|
51
|
+
/** Value that configures or reports folders for this contract. */
|
|
52
|
+
folders: string[];
|
|
53
|
+
/** Value that configures or reports type to folder for this contract. */
|
|
54
|
+
type_to_folder: Record<string, string>;
|
|
55
|
+
/** Schema type that determines the shape and validation rules for this value. */
|
|
56
|
+
by_type: Record<string, ResolvedItemTypeDefinition>;
|
|
57
|
+
/** Schema type that determines the shape and validation rules for this value. */
|
|
58
|
+
alias_to_type: Record<string, string>;
|
|
59
59
|
}
|
|
60
60
|
/** Implements canonicalize command option key for the public runtime surface of this module. */
|
|
61
61
|
export declare function canonicalizeCommandOptionKey(command: CommandOptionPolicyCommand, rawOption: string): string | undefined;
|
|
@@ -82,6 +82,6 @@ export declare function resolveTypeDefinition(typeName: string | undefined, regi
|
|
|
82
82
|
export declare function resolveCommandOptionPolicyState(typeDefinition: ResolvedItemTypeDefinition, command: CommandOptionPolicyCommand, baseRequiredOptions: Iterable<string>): CommandOptionPolicyState;
|
|
83
83
|
/** Implements validate type options for the public runtime surface of this module. */
|
|
84
84
|
export declare function validateTypeOptions(typeName: string, rawTypeOptions: Record<string, string> | undefined, registry: ItemTypeRegistry): {
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
normalized: Record<string, string> | undefined;
|
|
86
|
+
errors: string[];
|
|
87
87
|
};
|