@unbrained/pm-cli 2026.9.7 → 2026.9.9
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/.agents/skills/pm-developer/SKILL.md +12 -4
- package/.agents/skills/pm-developer/references/MULTI_AGENT_MERGE.md +19 -10
- package/.agents/skills/pm-extensions/SKILL.md +6 -0
- package/.agents/skills/pm-sdk/SKILL.md +11 -2
- package/.agents/skills/pm-user/SKILL.md +7 -2
- package/.agents/skills/pm-user/references/ECOSYSTEM_PLANNING.md +95 -0
- package/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +231 -182
- package/dist/cli/after-command-context-usage.js +1 -48
- package/dist/cli/argv-utils.js +1 -40
- package/dist/cli/bootstrap-args.js +1 -9
- package/dist/cli/bundle-integrity.js +2 -110
- package/dist/cli/commander-usage.js +11 -771
- package/dist/cli/commands/activity.js +1 -9
- package/dist/cli/commands/aggregate.js +1 -5
- package/dist/cli/commands/append.js +1 -5
- package/dist/cli/commands/claim.js +1 -5
- package/dist/cli/commands/close-many.js +1 -5
- package/dist/cli/commands/close.js +1 -9
- package/dist/cli/commands/comments.js +1 -5
- package/dist/cli/commands/config.js +1 -9
- package/dist/cli/commands/context.js +1 -9
- package/dist/cli/commands/contracts.js +1 -5
- package/dist/cli/commands/copy.js +1 -9
- package/dist/cli/commands/create.js +1 -9
- package/dist/cli/commands/delete.js +1 -9
- package/dist/cli/commands/deps.js +1 -9
- package/dist/cli/commands/docs.js +1 -9
- package/dist/cli/commands/duplicates.js +1 -9
- package/dist/cli/commands/eval.js +1 -9
- package/dist/cli/commands/extension/describe.js +1 -5
- package/dist/cli/commands/extension/scaffold.js +1 -5
- package/dist/cli/commands/extension/shared.js +1 -5
- package/dist/cli/commands/extension.js +1 -9
- package/dist/cli/commands/files.js +1 -9
- package/dist/cli/commands/focus.js +1 -9
- package/dist/cli/commands/gc.js +1 -9
- package/dist/cli/commands/get.js +1 -9
- package/dist/cli/commands/graph.js +1 -10
- package/dist/cli/commands/health.js +1 -9
- package/dist/cli/commands/history-compact.js +1 -10
- package/dist/cli/commands/history-redact.js +1 -11
- package/dist/cli/commands/history-repair.js +1 -10
- package/dist/cli/commands/history.js +1 -5
- package/dist/cli/commands/index.js +1 -58
- package/dist/cli/commands/init-agent-guidance.js +1 -9
- package/dist/cli/commands/init.js +1 -9
- package/dist/cli/commands/learnings.js +1 -5
- package/dist/cli/commands/lifecycle-transitions.js +1 -5
- package/dist/cli/commands/list.js +1 -9
- package/dist/cli/commands/merge.js +1 -11
- package/dist/cli/commands/next.js +1 -9
- package/dist/cli/commands/notes.js +1 -5
- package/dist/cli/commands/plan.js +1 -9
- package/dist/cli/commands/profile.js +1 -9
- package/dist/cli/commands/restore.js +1 -9
- package/dist/cli/commands/scheduling-shortcuts.js +1 -9
- package/dist/cli/commands/schema.js +1 -10
- package/dist/cli/commands/search.js +1 -9
- package/dist/cli/commands/stats.js +1 -9
- package/dist/cli/commands/telemetry.js +1 -9
- package/dist/cli/commands/test-all.js +1 -9
- package/dist/cli/commands/test-runs.js +1 -9
- package/dist/cli/commands/test.js +1 -9
- package/dist/cli/commands/update-many.js +1 -5
- package/dist/cli/commands/update.js +1 -9
- package/dist/cli/commands/upgrade.js +1 -5
- package/dist/cli/commands/validate.js +1 -15
- package/dist/cli/context-intent-invocation.js +1 -20
- package/dist/cli/description-stdin.js +1 -17
- package/dist/cli/error-guidance.js +1 -1353
- package/dist/cli/extension-command-help.js +5 -636
- package/dist/cli/extension-command-options.js +1 -427
- package/dist/cli/extension-recovery.js +1 -126
- package/dist/cli/help-content.js +2 -1001
- package/dist/cli/help-json-payload.js +4 -570
- package/dist/cli/main.d.ts +4 -0
- package/dist/cli/main.js +5 -2573
- package/dist/cli/migration-gates.js +1 -289
- package/dist/cli/public.js +1 -20
- package/dist/cli/register-annotations.js +1 -270
- package/dist/cli/register-assurance.js +1 -62
- package/dist/cli/register-files-lookup.js +1 -56
- package/dist/cli/register-history-activity.d.ts +8 -0
- package/dist/cli/register-history-activity.js +2 -0
- package/dist/cli/register-history-author.js +1 -38
- package/dist/cli/register-history-maintenance.d.ts +9 -0
- package/dist/cli/register-history-maintenance.js +2 -0
- package/dist/cli/register-list-query.js +10 -943
- package/dist/cli/register-mutation-options.js +1 -9
- package/dist/cli/register-mutation.d.ts +0 -5
- package/dist/cli/register-mutation.js +19 -1893
- package/dist/cli/register-operations.js +1 -920
- package/dist/cli/register-setup.js +1 -716
- package/dist/cli/register-structured-mutation.js +1 -196
- package/dist/cli/registration-helpers.js +1 -5
- package/dist/cli/runtime-compatibility-boundary.js +4 -42
- package/dist/cli/schema-registration-helpers.js +1 -73
- package/dist/cli/search-refresh.js +1 -13
- package/dist/cli/stats-analytics-json.js +1 -68
- package/dist/cli/telemetry-flush.js +1 -10
- package/dist/cli-bundle/bundle-manifest.json +164 -156
- package/dist/cli-bundle/chunks/{chunk-NPN5I67J.js → chunk-3IPRM75M.js} +3 -3
- package/dist/cli-bundle/chunks/chunk-4VL5P22L.js +2 -0
- package/dist/cli-bundle/chunks/chunk-AAFBV3U3.js +29 -0
- package/dist/cli-bundle/chunks/chunk-D3YVILJJ.js +20 -0
- package/dist/cli-bundle/chunks/{chunk-WYRZZ5ZE.js → chunk-DEZPZOQ7.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-ECBLPN7B.js +3 -0
- package/dist/cli-bundle/chunks/chunk-J6ERHBV2.js +235 -0
- package/dist/cli-bundle/chunks/chunk-JUNJ5EKI.js +2 -0
- package/dist/cli-bundle/chunks/chunk-L5RCDKQ2.js +2 -0
- package/dist/cli-bundle/chunks/chunk-NSAPNEYH.js +2 -0
- package/dist/cli-bundle/chunks/chunk-OHNLSGGV.js +79 -0
- package/dist/cli-bundle/chunks/chunk-WQKMSFBV.js +5 -0
- package/dist/cli-bundle/chunks/{chunk-BAX2BYUW.js → chunk-XZ6T7YPP.js} +256 -150
- package/dist/cli-bundle/chunks/{chunk-JT6XF6GE.js → chunk-Z3XVXUVF.js} +4 -4
- package/dist/cli-bundle/chunks/register-list-query-UIHRCS6D.js +11 -0
- package/dist/cli-bundle/chunks/register-mutation-WHWMGRVX.js +20 -0
- package/dist/cli-bundle/chunks/register-operations-64YZYTC5.js +2 -0
- package/dist/cli-bundle/chunks/register-setup-PERI45EM.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-2W4XIYOB.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-2WSBXIGF.js +12 -0
- package/dist/cli-bundle/focused-chunks/chunk-5FHTCOHS.js +3 -0
- package/dist/cli-bundle/focused-chunks/chunk-7N6DOREF.js +26 -0
- package/dist/cli-bundle/focused-chunks/{chunk-3BZEOXLT.js → chunk-7PC4R5QB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-BUCJUZVG.js +6 -0
- package/dist/cli-bundle/focused-chunks/chunk-FE3BABLJ.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-IWITF53W.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-OQUGRHKV.js +10 -0
- package/dist/cli-bundle/focused-chunks/{chunk-M6PBRFSH.js → chunk-PNKIANFZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-LIJIA4TY.js → chunk-QQQ4SAUO.js} +3 -3
- package/dist/cli-bundle/focused-chunks/chunk-TTYXF5YD.js +177 -0
- package/dist/cli-bundle/focused-chunks/chunk-XNR3DM6J.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-XSS3APUF.js +9 -0
- package/dist/cli-bundle/focused-chunks/chunk-YCDQ2N23.js +8 -0
- package/dist/cli-bundle/focused-chunks/chunk-YJUXGS57.js +20 -0
- package/dist/cli-bundle/focused-chunks/chunk-ZTCE4UO6.js +58 -0
- package/dist/cli-bundle/main.js +20 -20
- 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 +37 -37
- 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 +42 -42
- 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 +11 -11
- package/dist/cli.js +1 -104
- package/dist/core/checkpoint/checkpoint-gc.js +1 -169
- package/dist/core/checkpoint/mutation-checkpoint.js +2 -133
- package/dist/core/config/nested-settings.js +1 -534
- package/dist/core/config/positional-value.js +1 -109
- package/dist/core/diagnostics/remediation.js +1 -506
- package/dist/core/extensions/activation-summary-markdown.js +2 -145
- package/dist/core/extensions/activation-summary.js +1 -92
- package/dist/core/extensions/activation-transaction.js +1 -46
- package/dist/core/extensions/capability-usage.js +1 -173
- package/dist/core/extensions/command-hook-context.js +1 -13
- package/dist/core/extensions/command-metadata-contract.js +1 -22
- package/dist/core/extensions/command-visibility-tier.js +1 -29
- package/dist/core/extensions/contribution-inventory.js +1 -173
- package/dist/core/extensions/exporter-output-contract.js +1 -66
- package/dist/core/extensions/extension-candidate.js +1 -18
- package/dist/core/extensions/extension-capability-aliases.js +1 -158
- package/dist/core/extensions/extension-hook-runtime.js +1 -699
- package/dist/core/extensions/extension-policy.js +1 -599
- package/dist/core/extensions/extension-registries.js +1 -62
- package/dist/core/extensions/extension-runtime-helpers.js +1 -33
- package/dist/core/extensions/extension-types.js +1 -102
- package/dist/core/extensions/flag-definition-validation.js +1 -52
- package/dist/core/extensions/flag-value-types.js +1 -64
- package/dist/core/extensions/index.js +1 -526
- package/dist/core/extensions/item-field-types.js +1 -39
- package/dist/core/extensions/item-fields.js +1 -261
- package/dist/core/extensions/loader.js +1 -2223
- package/dist/core/extensions/manifest-schema.js +1 -69
- package/dist/core/extensions/module-graph-snapshot.js +1 -33
- package/dist/core/extensions/preflight-ownership.js +1 -41
- package/dist/core/extensions/registration-validation.js +1 -82
- package/dist/core/extensions/registration-values.js +1 -209
- package/dist/core/extensions/reserved-host-flags.js +1 -36
- package/dist/core/extensions/runtime-registrations.js +1 -67
- package/dist/core/extensions/service-ownership.js +1 -19
- package/dist/core/extensions/version-compat.js +1 -216
- package/dist/core/fs/fs-utils.js +2 -158
- package/dist/core/fs/host-environment-errors.js +1 -141
- package/dist/core/fs/index.js +1 -9
- package/dist/core/fs/path-utils.js +1 -17
- package/dist/core/governance/content-fields.js +1 -160
- package/dist/core/governance/issue-codes.js +1 -151
- package/dist/core/governance/metadata-coverage.js +1 -358
- package/dist/core/history/drift-cache.js +3 -72
- package/dist/core/history/drift-scan.js +1 -342
- package/dist/core/history/event-classification.js +1 -109
- package/dist/core/history/event-index.js +8 -784
- package/dist/core/history/history-compact-bulk.js +1 -104
- package/dist/core/history/history-diff.js +1 -158
- package/dist/core/history/history-rewrite.d.ts +6 -1
- package/dist/core/history/history-rewrite.js +1 -107
- package/dist/core/history/history-storage-stats.js +1 -102
- package/dist/core/history/history-stream-policy.js +1 -62
- package/dist/core/history/history.js +2 -617
- package/dist/core/history/identity.js +1 -30
- package/dist/core/history/index.js +1 -9
- package/dist/core/history/projection.js +1 -196
- package/dist/core/history/read.d.ts +9 -0
- package/dist/core/history/read.js +1 -57
- package/dist/core/history/replay.js +2 -439
- package/dist/core/history/version-address.js +1 -32
- package/dist/core/history/workspace-history.js +2 -433
- package/dist/core/io/body-file.js +1 -62
- package/dist/core/io/bulk-ids-input.js +1 -112
- package/dist/core/item/actionability.js +1 -327
- package/dist/core/item/dependency-reference.js +1 -20
- package/dist/core/item/id.js +1 -112
- package/dist/core/item/index.js +1 -12
- package/dist/core/item/item-format-version.js +1 -78
- package/dist/core/item/item-format.js +5 -1473
- package/dist/core/item/item-record.js +1 -23
- package/dist/core/item/item-type-definition.js +1 -133
- package/dist/core/item/parent-reference-policy.js +1 -57
- package/dist/core/item/parse.js +2 -603
- package/dist/core/item/plan-lifecycle.js +1 -19
- package/dist/core/item/priority.js +1 -61
- package/dist/core/item/sprint-release-format.js +1 -38
- package/dist/core/item/status-filter.js +1 -115
- package/dist/core/item/status.js +1 -43
- package/dist/core/item/toon-decode.js +1 -29
- package/dist/core/item/type-registry.js +1 -715
- package/dist/core/item/type-synonyms.js +1 -38
- package/dist/core/lock/index.js +1 -9
- package/dist/core/lock/lock-gc.js +1 -240
- package/dist/core/lock/lock.js +3 -590
- package/dist/core/output/mutation-projection.js +1 -217
- package/dist/core/output/output-control.js +1 -25
- package/dist/core/output/output.js +11 -494
- package/dist/core/output/query-summary.js +1 -58
- package/dist/core/output/tabular.js +1 -77
- package/dist/core/packages/manifest.js +1 -244
- package/dist/core/packages/root.js +1 -84
- package/dist/core/policy/workflow-policy-schema.d.ts +312 -0
- package/dist/core/policy/workflow-policy-schema.js +2 -0
- package/dist/core/policy/workflow-policy-store.d.ts +24 -0
- package/dist/core/policy/workflow-policy-store.js +2 -0
- package/dist/core/policy/workflow-policy.d.ts +139 -0
- package/dist/core/policy/workflow-policy.js +2 -0
- package/dist/core/profile/profile-describe.js +1 -83
- package/dist/core/profile/profile-lint.js +1 -415
- package/dist/core/profile/profile-plan.js +0 -0
- package/dist/core/profile/profile-presets.js +1 -370
- package/dist/core/reproducibility/context.js +1 -82
- package/dist/core/schema/fields-file.js +2 -288
- package/dist/core/schema/item-types-file.js +2 -296
- package/dist/core/schema/runtime-field-filters.js +1 -49
- package/dist/core/schema/runtime-field-values.js +1 -313
- package/dist/core/schema/runtime-schema.js +2 -826
- package/dist/core/schema/status-defs-file.js +2 -227
- package/dist/core/schema/status-token.js +1 -31
- package/dist/core/schema/type-inference.js +1 -95
- package/dist/core/schema/type-presets.js +1 -87
- package/dist/core/schema/type-workflows.js +1 -104
- package/dist/core/search/background-refresh.js +2 -286
- package/dist/core/search/bm25.js +1 -146
- package/dist/core/search/cache.js +2 -534
- package/dist/core/search/corpus.js +1 -311
- package/dist/core/search/embedding-batches.js +1 -163
- package/dist/core/search/eval.js +1 -225
- package/dist/core/search/http-client.js +1 -75
- package/dist/core/search/providers.js +1 -242
- package/dist/core/search/relevance.js +1 -244
- package/dist/core/search/semantic-defaults.js +1 -199
- package/dist/core/search/staleness.js +1 -30
- package/dist/core/search/vector-stores.js +2 -664
- package/dist/core/search/vectorization-metadata.js +1 -81
- package/dist/core/sentry/helpers.js +1 -272
- package/dist/core/sentry/instrument.js +1 -387
- package/dist/core/session/session-state.js +1 -260
- package/dist/core/shared/agent-session-context.js +1 -133
- package/dist/core/shared/author.js +1 -1172
- package/dist/core/shared/command-types.js +1 -4
- package/dist/core/shared/conflict-markers.js +1 -31
- package/dist/core/shared/constants.js +1 -405
- package/dist/core/shared/errors.js +1 -20
- package/dist/core/shared/html-entity-decode.js +1 -131
- package/dist/core/shared/index.js +1 -12
- package/dist/core/shared/item-metadata-contract.js +1 -89
- package/dist/core/shared/lazy-module.js +1 -16
- package/dist/core/shared/levenshtein.js +1 -61
- package/dist/core/shared/memo.js +1 -19
- package/dist/core/shared/numeric-parsers.js +1 -20
- package/dist/core/shared/option-alias-visibility.js +1 -67
- package/dist/core/shared/primitives.js +1 -127
- package/dist/core/shared/serial-queue.js +1 -79
- package/dist/core/shared/serialization.js +1 -210
- package/dist/core/shared/split-comma-list.js +1 -30
- package/dist/core/shared/text-normalization.js +1 -38
- package/dist/core/shared/time.js +1 -306
- package/dist/core/store/index.js +1 -12
- package/dist/core/store/item-format-migration.js +1 -125
- package/dist/core/store/item-metadata-cache.js +1 -1116
- package/dist/core/store/item-metadata-query-index.js +9 -394
- package/dist/core/store/item-metadata-read-work.js +1 -43
- package/dist/core/store/item-store.js +1 -693
- package/dist/core/store/paths.d.ts +1 -1
- package/dist/core/store/paths.js +1 -214
- package/dist/core/store/settings-read-cache.js +1 -85
- package/dist/core/store/settings-validator.d.ts +1 -0
- package/dist/core/store/settings-validator.js +1 -421
- package/dist/core/store/settings.js +3 -1309
- package/dist/core/store/tracker-preflight.js +1 -141
- package/dist/core/telemetry/consent.js +5 -108
- package/dist/core/telemetry/observability.js +1 -246
- package/dist/core/telemetry/runtime.js +4 -1988
- package/dist/core/test/background-runs.js +4 -945
- package/dist/core/test/item-test-run-tracking.js +1 -63
- package/dist/core/test/run-selectors.js +1 -120
- package/dist/core/validate/estimate-defaults.js +1 -89
- package/dist/core/validate/fix-planning.js +1 -189
- package/dist/core/validate/linked-artifact-reference.js +1 -36
- package/dist/core/validate/missing-by-type.js +1 -34
- package/dist/core/validate/missing-link-owners.js +1 -95
- package/dist/core/validate/stale-file-classification.js +1 -82
- package/dist/mcp/http-server.js +5 -448
- package/dist/mcp/legacy-adapter.js +1 -77
- package/dist/mcp/runtime-capabilities.js +1 -200
- package/dist/mcp/server.js +4 -1233
- package/dist/mcp/tool-definitions.js +1 -804
- package/dist/sdk/actionability.js +1 -13
- package/dist/sdk/agent/closed-domain-contracts.js +1 -161
- package/dist/sdk/agent/command-recovery.js +1 -59
- package/dist/sdk/agent/command-suggestions.js +1 -66
- package/dist/sdk/agent/create-option-policy.js +1 -31
- package/dist/sdk/agent/identity-config.js +1 -106
- package/dist/sdk/agent/item-addressing.js +1 -207
- package/dist/sdk/agent/refusal-closure-census.js +1 -151
- package/dist/sdk/agent/refusal-closure.js +1 -133
- package/dist/sdk/agent/refusal-corpus-contracts.js +1 -193
- package/dist/sdk/agent/refusal-reachability.js +1 -593
- package/dist/sdk/agent/subcommand-recovery.js +1 -83
- package/dist/sdk/agent/task-transcript-contracts.js +1 -197
- package/dist/sdk/agent/tracker-preflight-contracts.js +1 -126
- package/dist/sdk/agent-capability-contracts.js +1 -428
- package/dist/sdk/agent-session-context.js +1 -9
- package/dist/sdk/annotations.js +1 -448
- package/dist/sdk/author-attribution.js +1 -468
- package/dist/sdk/authoring.js +1 -20
- package/dist/sdk/cli-bootstrap.js +1 -838
- package/dist/sdk/cli-contracts/agent-output-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts/agent-output-contracts.js +4 -476
- package/dist/sdk/cli-contracts/bootstrap-command-scanner.js +1 -79
- package/dist/sdk/cli-contracts/command-aliases.d.ts +4 -0
- package/dist/sdk/cli-contracts/command-aliases.js +1 -107
- package/dist/sdk/cli-contracts/command-exit-contracts.js +1 -151
- package/dist/sdk/cli-contracts/commander-mutation-options.js +1 -1081
- package/dist/sdk/cli-contracts/commander-types.js +1 -159
- package/dist/sdk/cli-contracts/completeness.js +1 -393
- package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts/enum-contracts.js +1 -222
- package/dist/sdk/cli-contracts/flag-contracts.js +1 -1947
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -347
- package/dist/sdk/cli-contracts/grammar-contracts.js +1 -986
- package/dist/sdk/cli-contracts/registration-helpers.js +7 -990
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +5 -0
- package/dist/sdk/cli-contracts/runtime-contracts.js +1 -2090
- package/dist/sdk/cli-contracts/schemas/assurance-definition.js +1 -324
- package/dist/sdk/cli-contracts/string-lists.js +1 -16
- package/dist/sdk/cli-contracts/tool-option-contracts.js +1 -461
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -2167
- package/dist/sdk/cli-contracts/tool-schema.d.ts +3 -1
- package/dist/sdk/cli-contracts/tool-schema.js +1 -1664
- package/dist/sdk/cli-contracts/typed-action-inputs.js +1 -4
- package/dist/sdk/cli-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts.js +1 -17
- package/dist/sdk/cli-program.js +1 -49
- package/dist/sdk/command-line.d.ts +2 -5
- package/dist/sdk/command-line.js +1 -78
- package/dist/sdk/comments.js +1 -133
- package/dist/sdk/compile-cache.js +1 -73
- package/dist/sdk/completion.js +174 -839
- package/dist/sdk/compose.js +1 -1090
- package/dist/sdk/config.js +1 -1204
- package/dist/sdk/context/recency.js +1 -33
- package/dist/sdk/context/semantic-session-attribution.js +1 -82
- package/dist/sdk/context/usage-egress.js +1 -29
- package/dist/sdk/context/usage-ledger.js +3 -185
- package/dist/sdk/context-intent-contracts.js +1 -709
- package/dist/sdk/context-intent-runtime.js +1 -115
- package/dist/sdk/context-packing.js +1 -218
- package/dist/sdk/context-relevance.js +1 -503
- package/dist/sdk/context-signal-store.js +2 -426
- package/dist/sdk/context-usage.js +1 -367
- package/dist/sdk/contracts.js +1 -23
- package/dist/sdk/core-governance.js +1 -14
- package/dist/sdk/core.js +1 -14
- package/dist/sdk/corpus-shape.js +1 -401
- package/dist/sdk/define.js +1 -220
- package/dist/sdk/dependencies.js +1 -718
- package/dist/sdk/dependency-flag-validation.js +1 -156
- package/dist/sdk/dependency-provenance.js +1 -135
- package/dist/sdk/docs.js +1 -14
- package/dist/sdk/duplicates.js +1 -40
- package/dist/sdk/environment/agent-environment.js +1 -466
- package/dist/sdk/environment/host-environment-errors.js +1 -8
- package/dist/sdk/environment/project-runtime-compatibility.js +1 -481
- package/dist/sdk/environment/source-context.js +1 -28
- package/dist/sdk/environment/tracker-preflight.js +1 -9
- package/dist/sdk/error-code-catalog.js +1 -153
- package/dist/sdk/error-runtime.js +1 -58
- package/dist/sdk/errors.js +1 -58
- package/dist/sdk/eval.js +1 -190
- package/dist/sdk/extension/author-manifest.js +1 -92
- package/dist/sdk/extension/bundled-catalog.js +1 -332
- package/dist/sdk/extension/concurrency.js +1 -25
- package/dist/sdk/extension/copy-scope.d.ts +2 -0
- package/dist/sdk/extension/copy-scope.js +2 -0
- package/dist/sdk/extension/custom-field-collisions.js +1 -30
- package/dist/sdk/extension/describe.js +3 -189
- package/dist/sdk/extension/doctor.js +1 -606
- package/dist/sdk/extension/install-plan.d.ts +69 -0
- package/dist/sdk/extension/install-plan.js +2 -0
- package/dist/sdk/extension/install-receipts.d.ts +7 -0
- package/dist/sdk/extension/install-receipts.js +2 -0
- package/dist/sdk/extension/install-runtime.js +3 -313
- package/dist/sdk/extension/install-snapshot.js +1 -66
- package/dist/sdk/extension/install-sources.js +5 -1057
- package/dist/sdk/extension/managed-state.js +2 -252
- package/dist/sdk/extension/migrations.js +2 -174
- package/dist/sdk/extension/output-ownership.js +1 -25
- package/dist/sdk/extension/runtime-summary.js +1 -18
- package/dist/sdk/extension/scaffold.js +4 -2308
- package/dist/sdk/extension/shared.js +1 -147
- package/dist/sdk/extension/source-resolution.js +1 -65
- package/dist/sdk/extension/update-check.js +1 -67
- package/dist/sdk/extension-command-context.js +1 -44
- package/dist/sdk/extension-contracts.js +1 -73
- package/dist/sdk/extension.d.ts +7 -2
- package/dist/sdk/extension.js +1 -2196
- package/dist/sdk/files.js +1 -535
- package/dist/sdk/flag-invocation-contracts.d.ts +0 -5
- package/dist/sdk/flag-invocation-contracts.js +1 -344
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -2224
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -2236
- package/dist/sdk/generated-error-code-catalog.js +1 -16
- package/dist/sdk/governance/assurance-action-contracts.js +1 -4
- package/dist/sdk/governance/assurance-action.js +1 -411
- package/dist/sdk/governance/assurance-limits.js +1 -10
- package/dist/sdk/governance/assurance-mutation-error.js +1 -81
- package/dist/sdk/governance/assurance-presets.js +1 -135
- package/dist/sdk/governance/assurance-runtime.js +1 -238
- package/dist/sdk/governance/assurance.js +4 -1182
- package/dist/sdk/governance/boundary-fixtures.js +1 -200
- package/dist/sdk/governance/coverage-assurance.js +1 -60
- package/dist/sdk/governance/defect-recurrence-coverage.js +1 -188
- package/dist/sdk/governance/defect-recurrence-graph.js +1 -120
- package/dist/sdk/governance/defect-recurrence-signals.js +1 -24
- package/dist/sdk/governance/defect-recurrence.js +1 -623
- package/dist/sdk/governance/extension-host-version.js +1 -115
- package/dist/sdk/governance/gc.js +1 -368
- package/dist/sdk/governance/health.js +1 -2367
- package/dist/sdk/governance/hierarchy-validation.js +1 -108
- package/dist/sdk/governance/linked-file-report.js +1 -71
- package/dist/sdk/governance/merge-receipt-history.js +1 -206
- package/dist/sdk/governance/provenance-health.js +1 -282
- package/dist/sdk/governance/reindex.js +4 -761
- package/dist/sdk/governance/stale-work.js +1 -82
- package/dist/sdk/governance/status-role-diagnostics.js +1 -35
- package/dist/sdk/governance/storage-integrity.js +1 -280
- package/dist/sdk/governance/tracked-runtime-cache.js +1 -106
- package/dist/sdk/governance/upgrade.js +2 -327
- package/dist/sdk/governance/validate-history-drift.js +1 -81
- package/dist/sdk/governance/validate-item-reader.js +1 -17
- package/dist/sdk/governance/validate-normalization.js +1 -36
- package/dist/sdk/governance/validate.d.ts +3 -1
- package/dist/sdk/governance/validate.js +1 -2261
- package/dist/sdk/governance/workflow-completeness.d.ts +32 -0
- package/dist/sdk/governance/workflow-completeness.js +2 -0
- package/dist/sdk/governance/workflow-policy.d.ts +47 -0
- package/dist/sdk/governance/workflow-policy.js +4 -0
- package/dist/sdk/governance/workspace-position.js +1 -163
- package/dist/sdk/governance.d.ts +2 -0
- package/dist/sdk/governance.js +1 -31
- package/dist/sdk/graph/adapter.js +1 -181
- package/dist/sdk/graph/analytics.js +1 -474
- package/dist/sdk/graph/assembly.js +1 -377
- package/dist/sdk/graph/cache.js +1 -160
- package/dist/sdk/graph/centrality.js +1 -258
- package/dist/sdk/graph/conformance.js +1 -130
- package/dist/sdk/graph/deadline-scheduling.d.ts +90 -0
- package/dist/sdk/graph/deadline-scheduling.js +2 -0
- package/dist/sdk/graph/durable-cache.d.ts +1 -1
- package/dist/sdk/graph/durable-cache.js +1 -361
- package/dist/sdk/graph/governance-contracts.js +1 -34
- package/dist/sdk/graph/governance.d.ts +13 -1
- package/dist/sdk/graph/governance.js +1 -735
- package/dist/sdk/graph/hierarchy-integrity.js +1 -310
- package/dist/sdk/graph/index.d.ts +3 -2
- package/dist/sdk/graph/index.js +1 -26
- package/dist/sdk/graph/lifecycle-coverage.d.ts +32 -0
- package/dist/sdk/graph/lifecycle-coverage.js +2 -0
- package/dist/sdk/graph/mutation-advisory.js +1 -176
- package/dist/sdk/graph/remediation.js +1 -197
- package/dist/sdk/graph/run.d.ts +15 -1
- package/dist/sdk/graph/run.js +1 -768
- package/dist/sdk/graph/scheduling.js +1 -124
- package/dist/sdk/graph/traversal.js +1 -284
- package/dist/sdk/graph/workspace-relationship-kind-registry.js +1 -27
- package/dist/sdk/graph.js +1 -15
- package/dist/sdk/guide-topics.js +1 -707
- package/dist/sdk/guide.js +1 -279
- package/dist/sdk/history/maintenance.d.ts +71 -0
- package/dist/sdk/history/maintenance.js +2 -0
- package/dist/sdk/history/salvage.js +2 -247
- package/dist/sdk/history/subject.d.ts +19 -0
- package/dist/sdk/history/subject.js +2 -0
- package/dist/sdk/history-analytics.js +1 -282
- package/dist/sdk/history-compact.js +1 -527
- package/dist/sdk/history-mcp.js +1 -68
- package/dist/sdk/history-provenance.js +1 -182
- package/dist/sdk/history-read.js +1 -96
- package/dist/sdk/history-redact.d.ts +1 -14
- package/dist/sdk/history-redact.js +1 -643
- package/dist/sdk/history-repair.d.ts +5 -0
- package/dist/sdk/history-repair.js +1 -657
- package/dist/sdk/improvement-ledger-validation.js +1 -62
- package/dist/sdk/improvement-ledger.js +2 -257
- package/dist/sdk/index.d.ts +4 -1
- package/dist/sdk/index.js +1 -183
- package/dist/sdk/init-agent-guidance.js +2 -496
- package/dist/sdk/init.js +2 -820
- package/dist/sdk/invocation-author.js +1 -39
- package/dist/sdk/item-children.js +1 -90
- package/dist/sdk/item-metadata-index.js +1 -15
- package/dist/sdk/item-schedule.js +1 -27
- package/dist/sdk/item-transaction.js +1 -396
- package/dist/sdk/learnings.js +1 -29
- package/dist/sdk/lifecycle/append.js +2 -53
- package/dist/sdk/lifecycle/claim.d.ts +2 -0
- package/dist/sdk/lifecycle/claim.js +1 -242
- package/dist/sdk/lifecycle/close-many.js +1 -438
- package/dist/sdk/lifecycle/close.js +1 -468
- package/dist/sdk/lifecycle/copy.js +1 -212
- package/dist/sdk/lifecycle/create.js +1 -1949
- package/dist/sdk/lifecycle/delete.js +1 -45
- package/dist/sdk/lifecycle/event-validation-messages.js +1 -91
- package/dist/sdk/lifecycle/focus.js +1 -91
- package/dist/sdk/lifecycle/hierarchy-mutation-lock.js +1 -24
- package/dist/sdk/lifecycle/legacy-none-tokens.js +1 -149
- package/dist/sdk/lifecycle/lifecycle-transitions.js +1 -40
- package/dist/sdk/lifecycle/mcp-actions.d.ts +2 -0
- package/dist/sdk/lifecycle/mcp-actions.js +1 -51
- package/dist/sdk/lifecycle/metadata-normalizers.js +1 -46
- package/dist/sdk/lifecycle/mutation-command-options.js +1 -9
- package/dist/sdk/lifecycle/plan.js +1 -1606
- package/dist/sdk/lifecycle/recurrence-parsers.d.ts +1 -1
- package/dist/sdk/lifecycle/recurrence-parsers.js +1 -147
- package/dist/sdk/lifecycle/reopen.js +1 -68
- package/dist/sdk/lifecycle/repeatable-metadata-parsers.js +1 -143
- package/dist/sdk/lifecycle/restore.d.ts +1 -0
- package/dist/sdk/lifecycle/restore.js +1 -330
- package/dist/sdk/lifecycle/shared-unset-fields.js +1 -295
- package/dist/sdk/lifecycle/update-many.js +1 -861
- package/dist/sdk/lifecycle/update.js +1 -2136
- package/dist/sdk/lifecycle-completion.js +1 -92
- package/dist/sdk/lifecycle-policy.js +1 -120
- package/dist/sdk/linked-artifacts.js +1 -530
- package/dist/sdk/mcp/apps.js +4 -133
- package/dist/sdk/mcp/authorization.js +1 -404
- package/dist/sdk/mcp/discovery.js +1 -494
- package/dist/sdk/mcp/interactions.js +1 -336
- package/dist/sdk/mcp/protocol.d.ts +7 -0
- package/dist/sdk/mcp/protocol.js +1 -184
- package/dist/sdk/mcp/skills.js +1 -389
- package/dist/sdk/mcp/subscriptions.js +1 -211
- package/dist/sdk/mcp/tasks.js +2 -430
- package/dist/sdk/mcp/transport.js +1 -260
- package/dist/sdk/merge/abandoned-receipts.js +1 -46
- package/dist/sdk/merge/driver.js +1 -212
- package/dist/sdk/merge/index.js +1 -16
- package/dist/sdk/merge/install.js +3 -561
- package/dist/sdk/merge/receipt-file-boundary.js +1 -46
- package/dist/sdk/merge/receipt-operation.js +1 -96
- package/dist/sdk/merge/receipt-schema.js +1 -397
- package/dist/sdk/merge/receipts.js +4 -525
- package/dist/sdk/merge/reconcile.js +1 -352
- package/dist/sdk/merge/three-way.js +3 -775
- package/dist/sdk/merge.js +1 -10
- package/dist/sdk/mutation-events.js +1 -292
- package/dist/sdk/mutation-guard.js +1 -216
- package/dist/sdk/notes.js +1 -139
- package/dist/sdk/output-contracts.js +1 -172
- package/dist/sdk/output-projection.js +1 -430
- package/dist/sdk/output-token-accounting.js +1 -140
- package/dist/sdk/output.js +1 -64
- package/dist/sdk/ownership-source.js +1 -21
- package/dist/sdk/package-import-adapters.js +1 -442
- package/dist/sdk/package-migrations.js +1 -20
- package/dist/sdk/package-runtime-options.js +1 -80
- package/dist/sdk/pagination.js +1 -162
- package/dist/sdk/profile.js +1 -454
- package/dist/sdk/provenance.js +1 -258
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query/activity.js +1 -401
- package/dist/sdk/query/aggregate.d.ts +16 -0
- package/dist/sdk/query/aggregate.js +1 -390
- package/dist/sdk/query/calendar.js +1 -964
- package/dist/sdk/query/complete-list.js +1 -215
- package/dist/sdk/query/context.js +1 -1702
- package/dist/sdk/query/duplicate-candidates.js +1 -70
- package/dist/sdk/query/get.js +1 -450
- package/dist/sdk/query/history.js +1 -186
- package/dist/sdk/query/item-filter-options.js +1 -9
- package/dist/sdk/query/light-metadata.js +1 -18
- package/dist/sdk/query/list-filter-shared.js +1 -81
- package/dist/sdk/query/list.js +1 -1304
- package/dist/sdk/query/multi-value-filters.js +1 -78
- package/dist/sdk/query/next.js +1 -513
- package/dist/sdk/query/parsers.js +1 -44
- package/dist/sdk/query/projection-contracts.js +1 -184
- package/dist/sdk/query/search-contracts.d.ts +27 -0
- package/dist/sdk/query/search-contracts.js +1 -230
- package/dist/sdk/query/search-pagination.js +1 -35
- package/dist/sdk/query/search-rendering.js +1 -105
- package/dist/sdk/query/search.d.ts +6 -4
- package/dist/sdk/query/search.js +2 -1987
- package/dist/sdk/query.js +1 -35
- package/dist/sdk/read-output/continuation.js +1 -194
- package/dist/sdk/read-output-budget.js +1 -135
- package/dist/sdk/read-output-contracts.d.ts +1 -1
- package/dist/sdk/read-output-contracts.js +1 -1225
- package/dist/sdk/read-output-rows.js +1 -186
- package/dist/sdk/read-output-session.js +1 -208
- package/dist/sdk/relationship-analytics.js +1 -410
- package/dist/sdk/relationship-context.js +1 -284
- package/dist/sdk/relationship-history.js +4 -519
- package/dist/sdk/relationship-kinds/contract.js +1 -22
- package/dist/sdk/relationship-migration.js +1 -77
- package/dist/sdk/relationships.js +1 -579
- package/dist/sdk/reproducibility/process.js +1 -87
- package/dist/sdk/runtime-action-aliases.js +1 -59
- package/dist/sdk/runtime-extended-actions.js +1 -177
- package/dist/sdk/runtime-input.js +1 -614
- package/dist/sdk/runtime-primitives.js +1 -84
- package/dist/sdk/runtime-public-contracts.d.ts +2 -1
- package/dist/sdk/runtime-public-contracts.js +1 -4
- package/dist/sdk/runtime-stats-options.js +1 -38
- package/dist/sdk/runtime.d.ts +4 -0
- package/dist/sdk/runtime.js +1 -1928
- package/dist/sdk/scheduling-shortcuts.js +1 -63
- package/dist/sdk/schema-migration.js +3 -856
- package/dist/sdk/schema.d.ts +2 -1
- package/dist/sdk/schema.js +1 -1376
- package/dist/sdk/search-refresh-worker.js +1 -18
- package/dist/sdk/similarity-scoring.js +1 -53
- package/dist/sdk/similarity.js +1 -326
- package/dist/sdk/start-task-status.js +1 -14
- package/dist/sdk/stats.js +1 -270
- package/dist/sdk/structured-mutations.js +1 -580
- package/dist/sdk/telemetry-flush.js +1 -13
- package/dist/sdk/telemetry.js +1 -405
- package/dist/sdk/templates.js +2 -292
- package/dist/sdk/test/batch.js +2 -509
- package/dist/sdk/test/entry.js +1 -70
- package/dist/sdk/test/execution.js +6 -2211
- package/dist/sdk/test/linked-command-detection.js +1 -546
- package/dist/sdk/test/measurements.js +1 -91
- package/dist/sdk/test/parsers.js +1 -545
- package/dist/sdk/test/runs.js +1 -193
- package/dist/sdk/test/trust.js +2 -206
- package/dist/sdk/testing.js +4 -1391
- package/dist/sdk/traceability/runtime-files-lookup.js +1 -32
- package/dist/sdk/traceability/source-traceability.js +1 -292
- package/dist/sdk/tracker-root-discovery.js +1 -9
- package/dist/sdk/workspace-contracts-cache.js +1 -28
- package/dist/sdk/workspace-contracts.js +1 -33
- package/dist/sdk/workspace-memory.js +2 -318
- package/dist/sdk/workspace-recipe.js +1 -71
- package/dist/sdk/workspace-snapshot.js +4 -613
- package/dist/sdk/workspace-transaction-gc.js +1 -149
- package/dist/sdk/workspace-transaction.js +2 -363
- package/dist/sdk/workspace.js +3 -127
- package/dist/types/index.js +1 -9
- package/dist/types.d.ts +4 -0
- package/dist/types.js +1 -245
- package/docs/AGENT_GUIDE.md +1 -1
- package/docs/COMMANDS.md +10 -0
- package/docs/CONFIGURATION.md +12 -1
- package/docs/CONTEXT_ALGORITHM_PORTFOLIO.md +167 -0
- package/docs/DIAGNOSTIC_OUTPUT_CONTRACTS.md +9 -3
- package/docs/EXTENSIONS.md +1 -0
- package/docs/HISTORY_MAINTENANCE.md +125 -0
- package/docs/MCP_2026_07_28_CONFORMANCE.md +20 -10
- package/docs/PACKAGE_EVIDENCE.md +92 -0
- package/docs/PLANNING_MEASUREMENTS.md +183 -0
- package/docs/README.md +4 -0
- package/docs/READ_OUTPUT_CONTRACTS.md +5 -0
- package/docs/SCRIPTING.md +21 -0
- package/docs/TESTING.md +33 -0
- package/docs/WORKFLOW_POLICIES.md +129 -0
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +7 -7
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +11 -5
- package/marketplace.json +2 -2
- package/package.json +5 -5
- 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-codex/.codex-plugin/plugin.json +1 -1
- package/scripts/finalize-build.mjs +45 -3
- package/dist/cli-bundle/chunks/chunk-AZDFJGH6.js +0 -9
- package/dist/cli-bundle/chunks/chunk-CKOL5U7J.js +0 -77
- package/dist/cli-bundle/chunks/chunk-JX4DH4WC.js +0 -3
- package/dist/cli-bundle/chunks/chunk-OF76PSDQ.js +0 -5
- package/dist/cli-bundle/chunks/chunk-QUWFABDM.js +0 -232
- package/dist/cli-bundle/chunks/chunk-QWRRFYK3.js +0 -2
- package/dist/cli-bundle/chunks/chunk-RWWBOWJ5.js +0 -2
- package/dist/cli-bundle/chunks/chunk-WGAOYSYH.js +0 -40
- package/dist/cli-bundle/chunks/chunk-WI2AYPA7.js +0 -2
- package/dist/cli-bundle/chunks/register-list-query-5JL52D33.js +0 -11
- package/dist/cli-bundle/chunks/register-mutation-ZPG7KMVP.js +0 -20
- package/dist/cli-bundle/chunks/register-operations-I5W3KMGB.js +0 -2
- package/dist/cli-bundle/chunks/register-setup-H4SVAVX7.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-AL5ON6K6.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-CHC2IDXA.js +0 -6
- package/dist/cli-bundle/focused-chunks/chunk-CK6QFAPZ.js +0 -20
- package/dist/cli-bundle/focused-chunks/chunk-EZR3GHFE.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-H2WJWK7L.js +0 -56
- package/dist/cli-bundle/focused-chunks/chunk-NTPY5GSO.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-P5O7MP5Y.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-PDMW2E36.js +0 -177
- package/dist/cli-bundle/focused-chunks/chunk-PEFABF7E.js +0 -26
- package/dist/cli-bundle/focused-chunks/chunk-QTVCLMSZ.js +0 -6
- package/dist/cli-bundle/focused-chunks/chunk-QTZRBUYA.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-SGQST3PQ.js +0 -12
- package/dist/cli-bundle/focused-chunks/chunk-UKHASMMP.js +0 -10
- package/dist/cli-bundle/focused-chunks/chunk-ZPEKQHOC.js +0 -2
|
@@ -1,311 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* @module sdk/graph/hierarchy-integrity
|
|
3
|
-
*
|
|
4
|
-
* Normalizes scalar and dependency-backed hierarchy evidence into one graph,
|
|
5
|
-
* reports structural defects, and rejects mutations that introduce new debt.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="924f7718-0527-5967-8ab0-53e8228bd665")}catch(e){}}();
|
|
9
|
-
import { EXIT_CODE } from "../../core/shared/constants.js";
|
|
10
|
-
import { PmCliError } from "../../core/shared/errors.js";
|
|
11
|
-
import { resolveWorkspaceRelationshipKindRegistry } from "./workspace-relationship-kind-registry.js";
|
|
12
|
-
function normalizeItemId(value) {
|
|
13
|
-
if (typeof value !== "string")
|
|
14
|
-
return undefined;
|
|
15
|
-
const normalized = value.trim().toLowerCase();
|
|
16
|
-
return normalized.length > 0 ? normalized : undefined;
|
|
17
|
-
}
|
|
18
|
-
function relationIdentity(relation) {
|
|
19
|
-
return [
|
|
20
|
-
relation.parent_id,
|
|
21
|
-
relation.child_id,
|
|
22
|
-
relation.source,
|
|
23
|
-
relation.kind,
|
|
24
|
-
relation.holder_id,
|
|
25
|
-
relation.target_id ?? "",
|
|
26
|
-
].join("\u0000");
|
|
27
|
-
}
|
|
28
|
-
function collectHierarchyFinishOrder(nodeIds, childrenByParent) {
|
|
29
|
-
const visited = new Set();
|
|
30
|
-
const finishOrder = [];
|
|
31
|
-
for (const root of [...nodeIds].sort()) {
|
|
32
|
-
if (visited.has(root))
|
|
33
|
-
continue;
|
|
34
|
-
visited.add(root);
|
|
35
|
-
const frames = [
|
|
36
|
-
{
|
|
37
|
-
nodeId: root,
|
|
38
|
-
children: [...(childrenByParent.get(root) ?? [])].sort(),
|
|
39
|
-
nextChild: 0,
|
|
40
|
-
},
|
|
41
|
-
];
|
|
42
|
-
while (frames.length > 0) {
|
|
43
|
-
const frame = frames.at(-1);
|
|
44
|
-
const childId = frame.children[frame.nextChild];
|
|
45
|
-
if (childId === undefined) {
|
|
46
|
-
finishOrder.push(frame.nodeId);
|
|
47
|
-
frames.pop();
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
frame.nextChild += 1;
|
|
51
|
-
if (!visited.has(childId)) {
|
|
52
|
-
visited.add(childId);
|
|
53
|
-
frames.push({
|
|
54
|
-
nodeId: childId,
|
|
55
|
-
children: [...(childrenByParent.get(childId) ?? [])].sort(),
|
|
56
|
-
nextChild: 0,
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return finishOrder;
|
|
63
|
-
}
|
|
64
|
-
function collectCyclicComponents(nodeIds, childrenByParent) {
|
|
65
|
-
const sortedNodeIds = [...nodeIds].sort();
|
|
66
|
-
const finishOrder = collectHierarchyFinishOrder(sortedNodeIds, childrenByParent);
|
|
67
|
-
const visited = new Set();
|
|
68
|
-
const parentsByChild = reverseHierarchyEdges(sortedNodeIds, childrenByParent);
|
|
69
|
-
const components = [];
|
|
70
|
-
for (const root of finishOrder.reverse()) {
|
|
71
|
-
if (visited.has(root))
|
|
72
|
-
continue;
|
|
73
|
-
const component = collectReverseComponent(root, parentsByChild, visited);
|
|
74
|
-
if (component.length > 1 ||
|
|
75
|
-
childrenByParent.get(component[0])?.has(component[0]))
|
|
76
|
-
components.push(component);
|
|
77
|
-
}
|
|
78
|
-
return components.sort((left, right) => left.join("\u0000").localeCompare(right.join("\u0000")));
|
|
79
|
-
}
|
|
80
|
-
function reverseHierarchyEdges(nodeIds, childrenByParent) {
|
|
81
|
-
const parentsByChild = new Map(nodeIds.map((nodeId) => [nodeId, new Set()]));
|
|
82
|
-
for (const [parentId, childIds] of childrenByParent) {
|
|
83
|
-
for (const childId of childIds)
|
|
84
|
-
parentsByChild.get(childId)?.add(parentId);
|
|
85
|
-
}
|
|
86
|
-
return parentsByChild;
|
|
87
|
-
}
|
|
88
|
-
function collectReverseComponent(root, parentsByChild, visited) {
|
|
89
|
-
const component = [];
|
|
90
|
-
const pending = [root];
|
|
91
|
-
visited.add(root);
|
|
92
|
-
while (pending.length > 0) {
|
|
93
|
-
const nodeId = pending.pop();
|
|
94
|
-
component.push(nodeId);
|
|
95
|
-
for (const parentId of [...parentsByChild.get(nodeId)].sort()) {
|
|
96
|
-
if (visited.has(parentId))
|
|
97
|
-
continue;
|
|
98
|
-
visited.add(parentId);
|
|
99
|
-
pending.push(parentId);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return component.sort();
|
|
103
|
-
}
|
|
104
|
-
function collectHierarchyItems(items) {
|
|
105
|
-
const itemById = new Map();
|
|
106
|
-
for (const item of items) {
|
|
107
|
-
const itemId = normalizeItemId(item?.id);
|
|
108
|
-
if (itemId && !itemById.has(itemId))
|
|
109
|
-
itemById.set(itemId, item);
|
|
110
|
-
}
|
|
111
|
-
return itemById;
|
|
112
|
-
}
|
|
113
|
-
function buildScalarHierarchyRelation(holderId, item, itemById) {
|
|
114
|
-
const parentId = normalizeItemId(item.parent);
|
|
115
|
-
if (!parentId || !itemById.has(parentId))
|
|
116
|
-
return undefined;
|
|
117
|
-
return {
|
|
118
|
-
parent_id: parentId,
|
|
119
|
-
child_id: holderId,
|
|
120
|
-
source: "scalar_parent",
|
|
121
|
-
kind: "parent",
|
|
122
|
-
holder_id: holderId,
|
|
123
|
-
child_cardinality: "one",
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
function buildDependencyHierarchyRelation(holderId, dependency, itemById, registry) {
|
|
127
|
-
const targetId = normalizeItemId(dependency?.id);
|
|
128
|
-
const definition = registry.resolve(dependency?.kind);
|
|
129
|
-
if (!targetId || !itemById.has(targetId) || !definition?.hierarchy)
|
|
130
|
-
return undefined;
|
|
131
|
-
const sourceIsParent = definition.hierarchyDirection === "source_parent";
|
|
132
|
-
return {
|
|
133
|
-
parent_id: sourceIsParent ? holderId : targetId,
|
|
134
|
-
child_id: sourceIsParent ? targetId : holderId,
|
|
135
|
-
source: "dependency",
|
|
136
|
-
kind: definition.kind,
|
|
137
|
-
holder_id: holderId,
|
|
138
|
-
target_id: targetId,
|
|
139
|
-
child_cardinality: sourceIsParent
|
|
140
|
-
? definition.incoming
|
|
141
|
-
: definition.outgoing,
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
function collectHierarchyRelationsFromItemMap(itemById, registry) {
|
|
145
|
-
const relationsByIdentity = new Map();
|
|
146
|
-
for (const [holderId, item] of itemById) {
|
|
147
|
-
const scalarRelation = buildScalarHierarchyRelation(holderId, item, itemById);
|
|
148
|
-
if (scalarRelation)
|
|
149
|
-
relationsByIdentity.set(relationIdentity(scalarRelation), scalarRelation);
|
|
150
|
-
for (const dependency of item.dependencies ?? []) {
|
|
151
|
-
const relation = buildDependencyHierarchyRelation(holderId, dependency, itemById, registry);
|
|
152
|
-
if (!relation)
|
|
153
|
-
continue;
|
|
154
|
-
relationsByIdentity.set(relationIdentity(relation), relation);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
return [...relationsByIdentity.values()].sort((left, right) => relationIdentity(left).localeCompare(relationIdentity(right)));
|
|
158
|
-
}
|
|
159
|
-
/** Collect normalized hierarchy evidence without running defect analysis. */
|
|
160
|
-
export function collectHierarchyRelations(items, registry = resolveWorkspaceRelationshipKindRegistry()) {
|
|
161
|
-
return collectHierarchyRelationsFromItemMap(collectHierarchyItems(items), registry);
|
|
162
|
-
}
|
|
163
|
-
function collectHierarchyCardinalityViolations(relations, parentsByChild, terminalIds) {
|
|
164
|
-
const oneCardinalityChildren = new Set(relations
|
|
165
|
-
.filter((relation) => relation.child_cardinality === "one")
|
|
166
|
-
.map((relation) => relation.child_id));
|
|
167
|
-
return [...parentsByChild]
|
|
168
|
-
.filter(([childId, parentIds]) => parentIds.length > 1 && oneCardinalityChildren.has(childId))
|
|
169
|
-
.map(([childId, parentIds]) => ({
|
|
170
|
-
child_id: childId,
|
|
171
|
-
parent_ids: [...parentIds],
|
|
172
|
-
legacy_terminal: terminalIds.has(childId) &&
|
|
173
|
-
parentIds.every((id) => terminalIds.has(id)),
|
|
174
|
-
}))
|
|
175
|
-
.sort((left, right) => left.child_id.localeCompare(right.child_id));
|
|
176
|
-
}
|
|
177
|
-
function collectHierarchyDivergences(itemById, relations, terminalIds) {
|
|
178
|
-
const dependencyParentsByChild = new Map();
|
|
179
|
-
for (const relation of relations) {
|
|
180
|
-
if (relation.source !== "dependency")
|
|
181
|
-
continue;
|
|
182
|
-
const parents = dependencyParentsByChild.get(relation.child_id) ?? new Set();
|
|
183
|
-
parents.add(relation.parent_id);
|
|
184
|
-
dependencyParentsByChild.set(relation.child_id, parents);
|
|
185
|
-
}
|
|
186
|
-
const divergences = [];
|
|
187
|
-
for (const [childId, item] of itemById) {
|
|
188
|
-
const scalarParentId = normalizeItemId(item.parent);
|
|
189
|
-
if (!scalarParentId || !itemById.has(scalarParentId))
|
|
190
|
-
continue;
|
|
191
|
-
const dependencyParentIds = [
|
|
192
|
-
...(dependencyParentsByChild.get(childId) ?? []),
|
|
193
|
-
]
|
|
194
|
-
.filter((parentId) => parentId !== scalarParentId)
|
|
195
|
-
.sort();
|
|
196
|
-
if (dependencyParentIds.length === 0)
|
|
197
|
-
continue;
|
|
198
|
-
divergences.push({
|
|
199
|
-
child_id: childId,
|
|
200
|
-
scalar_parent_id: scalarParentId,
|
|
201
|
-
dependency_parent_ids: dependencyParentIds,
|
|
202
|
-
legacy_terminal: terminalIds.has(childId) &&
|
|
203
|
-
terminalIds.has(scalarParentId) &&
|
|
204
|
-
dependencyParentIds.every((id) => terminalIds.has(id)),
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
return divergences.sort((left, right) => left.child_id.localeCompare(right.child_id));
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Analyze all runtime-recognized hierarchy spellings as canonical parent-child
|
|
211
|
-
* relations. Unknown, malformed, and dangling rows are ignored here because
|
|
212
|
-
* dedicated graph-integrity checks own those diagnostics.
|
|
213
|
-
*/
|
|
214
|
-
export function analyzeHierarchyIntegrity(items, isTerminal = (status) => status === "closed" || status === "canceled", registry = resolveWorkspaceRelationshipKindRegistry()) {
|
|
215
|
-
const itemById = collectHierarchyItems(items);
|
|
216
|
-
const relations = collectHierarchyRelationsFromItemMap(itemById, registry);
|
|
217
|
-
const indexes = indexHierarchyRelations(relations);
|
|
218
|
-
const terminalIds = new Set([...itemById]
|
|
219
|
-
.filter(([, item]) => isTerminal(item.status))
|
|
220
|
-
.map(([id]) => id));
|
|
221
|
-
const cycles = collectCyclicComponents([...itemById.keys()], new Map([...indexes.children_by_parent].map(([id, childIds]) => [
|
|
222
|
-
id,
|
|
223
|
-
new Set(childIds),
|
|
224
|
-
]))).map((itemIds) => ({
|
|
225
|
-
item_ids: itemIds,
|
|
226
|
-
legacy_terminal: itemIds.every((id) => terminalIds.has(id)),
|
|
227
|
-
}));
|
|
228
|
-
return {
|
|
229
|
-
relations,
|
|
230
|
-
cycles,
|
|
231
|
-
cardinality_violations: collectHierarchyCardinalityViolations(relations, indexes.parents_by_child, terminalIds),
|
|
232
|
-
divergences: collectHierarchyDivergences(itemById, relations, terminalIds),
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
/** Render exact hierarchy evidence without losing its storage orientation. */
|
|
236
|
-
export function formatHierarchyRelation(relation) {
|
|
237
|
-
if (relation.source === "scalar_parent")
|
|
238
|
-
return `${relation.parent_id} -> ${relation.child_id} (scalar parent on ${relation.holder_id})`;
|
|
239
|
-
return `${relation.parent_id} -> ${relation.child_id} (${relation.kind} dependency on ${relation.holder_id})`;
|
|
240
|
-
}
|
|
241
|
-
/** Index normalized hierarchy evidence for list, tree, and rollup consumers. */
|
|
242
|
-
export function indexHierarchyRelations(relations) {
|
|
243
|
-
const parentSets = new Map();
|
|
244
|
-
const childSets = new Map();
|
|
245
|
-
for (const relation of relations) {
|
|
246
|
-
const parents = parentSets.get(relation.child_id) ?? new Set();
|
|
247
|
-
parents.add(relation.parent_id);
|
|
248
|
-
parentSets.set(relation.child_id, parents);
|
|
249
|
-
const children = childSets.get(relation.parent_id) ?? new Set();
|
|
250
|
-
children.add(relation.child_id);
|
|
251
|
-
childSets.set(relation.parent_id, children);
|
|
252
|
-
}
|
|
253
|
-
return {
|
|
254
|
-
parents_by_child: new Map([...parentSets].map(([id, values]) => [id, [...values].sort()])),
|
|
255
|
-
children_by_parent: new Map([...childSets].map(([id, values]) => [id, [...values].sort()])),
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
/** Return whether every candidate identifier existed in the prior defect. */
|
|
259
|
-
function isIdentifierSubset(candidate, prior) {
|
|
260
|
-
const priorIds = new Set(prior);
|
|
261
|
-
return candidate.every((id) => priorIds.has(id));
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Reject a mutation only when it introduces a new hierarchy defect involving
|
|
265
|
-
* the changed item. Existing debt remains repairable without a global bypass.
|
|
266
|
-
*/
|
|
267
|
-
export function assertHierarchyMutationAllowed(beforeItems, afterItems, changedItemId, isTerminal, registry) {
|
|
268
|
-
const holderId = normalizeItemId(changedItemId);
|
|
269
|
-
if (!holderId)
|
|
270
|
-
return;
|
|
271
|
-
const before = analyzeHierarchyIntegrity(beforeItems, isTerminal, registry);
|
|
272
|
-
const after = analyzeHierarchyIntegrity(afterItems, isTerminal, registry);
|
|
273
|
-
const divergence = after.divergences.find((finding) => !before.divergences.some((prior) => prior.child_id === finding.child_id &&
|
|
274
|
-
prior.scalar_parent_id === finding.scalar_parent_id &&
|
|
275
|
-
isIdentifierSubset(finding.dependency_parent_ids, prior.dependency_parent_ids)));
|
|
276
|
-
if (divergence) {
|
|
277
|
-
const parentIds = [
|
|
278
|
-
divergence.scalar_parent_id,
|
|
279
|
-
...divergence.dependency_parent_ids,
|
|
280
|
-
].sort();
|
|
281
|
-
throw new PmCliError(`Hierarchy mutation would assign ${divergence.child_id} to multiple parents: ${parentIds.join(", ")}.`, EXIT_CODE.CONFLICT, {
|
|
282
|
-
code: "hierarchy_parent_divergence_created",
|
|
283
|
-
source_id: holderId,
|
|
284
|
-
target_id: divergence.child_id,
|
|
285
|
-
verification_errors: parentIds,
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
const cardinality = after.cardinality_violations.find((finding) => (finding.child_id === holderId ||
|
|
289
|
-
finding.parent_ids.includes(holderId)) &&
|
|
290
|
-
!before.cardinality_violations.some((prior) => prior.child_id === finding.child_id &&
|
|
291
|
-
isIdentifierSubset(finding.parent_ids, prior.parent_ids)));
|
|
292
|
-
if (cardinality) {
|
|
293
|
-
throw new PmCliError(`Hierarchy mutation would assign ${cardinality.child_id} to multiple parents: ${cardinality.parent_ids.join(", ")}.`, EXIT_CODE.CONFLICT, {
|
|
294
|
-
code: "hierarchy_cardinality_created",
|
|
295
|
-
source_id: holderId,
|
|
296
|
-
target_id: cardinality.child_id,
|
|
297
|
-
verification_errors: cardinality.parent_ids,
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
const cycle = after.cycles.find((finding) => finding.item_ids.includes(holderId) &&
|
|
301
|
-
!before.cycles.some((prior) => isIdentifierSubset(finding.item_ids, prior.item_ids)));
|
|
302
|
-
if (cycle) {
|
|
303
|
-
throw new PmCliError(`Hierarchy mutation would create a cycle: ${cycle.item_ids.join(" -> ")}.`, EXIT_CODE.CONFLICT, {
|
|
304
|
-
code: "hierarchy_cycle_created",
|
|
305
|
-
source_id: holderId,
|
|
306
|
-
verification_errors: cycle.item_ids,
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
}
|
|
1
|
+
!(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="83d1acab-79a1-5e9f-b6a4-97dade07d74a")}catch(e2){}})();import{EXIT_CODE}from"../../core/shared/constants.js";import{PmCliError}from"../../core/shared/errors.js";import{resolveWorkspaceRelationshipKindRegistry}from"./workspace-relationship-kind-registry.js";function normalizeItemId(value){if(typeof value!=="string")return void 0;const normalized=value.trim().toLowerCase();return normalized.length>0?normalized:void 0}function relationIdentity(relation){return[relation.parent_id,relation.child_id,relation.source,relation.kind,relation.holder_id,relation.target_id??""].join("\0")}function collectHierarchyFinishOrder(nodeIds,childrenByParent){const visited=new Set;const finishOrder=[];for(const root of[...nodeIds].sort()){if(visited.has(root))continue;visited.add(root);const frames=[{nodeId:root,children:[...childrenByParent.get(root)??[]].sort(),nextChild:0}];while(frames.length>0){const frame=frames.at(-1);const childId=frame.children[frame.nextChild];if(childId===void 0){finishOrder.push(frame.nodeId);frames.pop()}else{frame.nextChild+=1;if(!visited.has(childId)){visited.add(childId);frames.push({nodeId:childId,children:[...childrenByParent.get(childId)??[]].sort(),nextChild:0})}}}}return finishOrder}function collectCyclicComponents(nodeIds,childrenByParent){const sortedNodeIds=[...nodeIds].sort();const finishOrder=collectHierarchyFinishOrder(sortedNodeIds,childrenByParent);const visited=new Set;const parentsByChild=reverseHierarchyEdges(sortedNodeIds,childrenByParent);const components=[];for(const root of finishOrder.reverse()){if(visited.has(root))continue;const component=collectReverseComponent(root,parentsByChild,visited);if(component.length>1||childrenByParent.get(component[0])?.has(component[0]))components.push(component)}return components.sort((left,right)=>left.join("\0").localeCompare(right.join("\0")))}function reverseHierarchyEdges(nodeIds,childrenByParent){const parentsByChild=new Map(nodeIds.map(nodeId=>[nodeId,new Set]));for(const[parentId,childIds]of childrenByParent){for(const childId of childIds)parentsByChild.get(childId)?.add(parentId)}return parentsByChild}function collectReverseComponent(root,parentsByChild,visited){const component=[];const pending=[root];visited.add(root);while(pending.length>0){const nodeId=pending.pop();component.push(nodeId);for(const parentId of[...parentsByChild.get(nodeId)].sort()){if(visited.has(parentId))continue;visited.add(parentId);pending.push(parentId)}}return component.sort()}function collectHierarchyItems(items){const itemById=new Map;for(const item of items){const itemId=normalizeItemId(item?.id);if(itemId&&!itemById.has(itemId))itemById.set(itemId,item)}return itemById}function buildScalarHierarchyRelation(holderId,item,itemById){const parentId=normalizeItemId(item.parent);if(!parentId||!itemById.has(parentId))return void 0;return{parent_id:parentId,child_id:holderId,source:"scalar_parent",kind:"parent",holder_id:holderId,child_cardinality:"one"}}function buildDependencyHierarchyRelation(holderId,dependency,itemById,registry){const targetId=normalizeItemId(dependency?.id);const definition=registry.resolve(dependency?.kind);if(!targetId||!itemById.has(targetId)||!definition?.hierarchy)return void 0;const sourceIsParent=definition.hierarchyDirection==="source_parent";return{parent_id:sourceIsParent?holderId:targetId,child_id:sourceIsParent?targetId:holderId,source:"dependency",kind:definition.kind,holder_id:holderId,target_id:targetId,child_cardinality:sourceIsParent?definition.incoming:definition.outgoing}}function collectHierarchyRelationsFromItemMap(itemById,registry){const relationsByIdentity=new Map;for(const[holderId,item]of itemById){const scalarRelation=buildScalarHierarchyRelation(holderId,item,itemById);if(scalarRelation)relationsByIdentity.set(relationIdentity(scalarRelation),scalarRelation);for(const dependency of item.dependencies??[]){const relation=buildDependencyHierarchyRelation(holderId,dependency,itemById,registry);if(!relation)continue;relationsByIdentity.set(relationIdentity(relation),relation)}}return[...relationsByIdentity.values()].sort((left,right)=>relationIdentity(left).localeCompare(relationIdentity(right)))}function collectHierarchyRelations(items,registry=resolveWorkspaceRelationshipKindRegistry()){return collectHierarchyRelationsFromItemMap(collectHierarchyItems(items),registry)}function collectHierarchyCardinalityViolations(relations,parentsByChild,terminalIds){const oneCardinalityChildren=new Set(relations.filter(relation=>relation.child_cardinality==="one").map(relation=>relation.child_id));return[...parentsByChild].filter(([childId,parentIds])=>parentIds.length>1&&oneCardinalityChildren.has(childId)).map(([childId,parentIds])=>({child_id:childId,parent_ids:[...parentIds],legacy_terminal:terminalIds.has(childId)&&parentIds.every(id=>terminalIds.has(id))})).sort((left,right)=>left.child_id.localeCompare(right.child_id))}function collectHierarchyDivergences(itemById,relations,terminalIds){const dependencyParentsByChild=new Map;for(const relation of relations){if(relation.source!=="dependency")continue;const parents=dependencyParentsByChild.get(relation.child_id)??new Set;parents.add(relation.parent_id);dependencyParentsByChild.set(relation.child_id,parents)}const divergences=[];for(const[childId,item]of itemById){const scalarParentId=normalizeItemId(item.parent);if(!scalarParentId||!itemById.has(scalarParentId))continue;const dependencyParentIds=[...dependencyParentsByChild.get(childId)??[]].filter(parentId=>parentId!==scalarParentId).sort();if(dependencyParentIds.length===0)continue;divergences.push({child_id:childId,scalar_parent_id:scalarParentId,dependency_parent_ids:dependencyParentIds,legacy_terminal:terminalIds.has(childId)&&terminalIds.has(scalarParentId)&&dependencyParentIds.every(id=>terminalIds.has(id))})}return divergences.sort((left,right)=>left.child_id.localeCompare(right.child_id))}function analyzeHierarchyIntegrity(items,isTerminal=status=>status==="closed"||status==="canceled",registry=resolveWorkspaceRelationshipKindRegistry()){const itemById=collectHierarchyItems(items);const relations=collectHierarchyRelationsFromItemMap(itemById,registry);const indexes=indexHierarchyRelations(relations);const terminalIds=new Set([...itemById].filter(([,item])=>isTerminal(item.status)).map(([id])=>id));const cycles=collectCyclicComponents([...itemById.keys()],new Map([...indexes.children_by_parent].map(([id,childIds])=>[id,new Set(childIds)]))).map(itemIds=>({item_ids:itemIds,legacy_terminal:itemIds.every(id=>terminalIds.has(id))}));return{relations,cycles,cardinality_violations:collectHierarchyCardinalityViolations(relations,indexes.parents_by_child,terminalIds),divergences:collectHierarchyDivergences(itemById,relations,terminalIds)}}function formatHierarchyRelation(relation){if(relation.source==="scalar_parent")return`${relation.parent_id} -> ${relation.child_id} (scalar parent on ${relation.holder_id})`;return`${relation.parent_id} -> ${relation.child_id} (${relation.kind} dependency on ${relation.holder_id})`}function indexHierarchyRelations(relations){const parentSets=new Map;const childSets=new Map;for(const relation of relations){const parents=parentSets.get(relation.child_id)??new Set;parents.add(relation.parent_id);parentSets.set(relation.child_id,parents);const children=childSets.get(relation.parent_id)??new Set;children.add(relation.child_id);childSets.set(relation.parent_id,children)}return{parents_by_child:new Map([...parentSets].map(([id,values])=>[id,[...values].sort()])),children_by_parent:new Map([...childSets].map(([id,values])=>[id,[...values].sort()]))}}function isIdentifierSubset(candidate,prior){const priorIds=new Set(prior);return candidate.every(id=>priorIds.has(id))}function assertHierarchyMutationAllowed(beforeItems,afterItems,changedItemId,isTerminal,registry){const holderId=normalizeItemId(changedItemId);if(!holderId)return;const before=analyzeHierarchyIntegrity(beforeItems,isTerminal,registry);const after=analyzeHierarchyIntegrity(afterItems,isTerminal,registry);const divergence=after.divergences.find(finding=>!before.divergences.some(prior=>prior.child_id===finding.child_id&&prior.scalar_parent_id===finding.scalar_parent_id&&isIdentifierSubset(finding.dependency_parent_ids,prior.dependency_parent_ids)));if(divergence){const parentIds=[divergence.scalar_parent_id,...divergence.dependency_parent_ids].sort();throw new PmCliError(`Hierarchy mutation would assign ${divergence.child_id} to multiple parents: ${parentIds.join(", ")}.`,EXIT_CODE.CONFLICT,{code:"hierarchy_parent_divergence_created",source_id:holderId,target_id:divergence.child_id,verification_errors:parentIds})}const cardinality=after.cardinality_violations.find(finding=>(finding.child_id===holderId||finding.parent_ids.includes(holderId))&&!before.cardinality_violations.some(prior=>prior.child_id===finding.child_id&&isIdentifierSubset(finding.parent_ids,prior.parent_ids)));if(cardinality){throw new PmCliError(`Hierarchy mutation would assign ${cardinality.child_id} to multiple parents: ${cardinality.parent_ids.join(", ")}.`,EXIT_CODE.CONFLICT,{code:"hierarchy_cardinality_created",source_id:holderId,target_id:cardinality.child_id,verification_errors:cardinality.parent_ids})}const cycle=after.cycles.find(finding=>finding.item_ids.includes(holderId)&&!before.cycles.some(prior=>isIdentifierSubset(finding.item_ids,prior.item_ids)));if(cycle){throw new PmCliError(`Hierarchy mutation would create a cycle: ${cycle.item_ids.join(" -> ")}.`,EXIT_CODE.CONFLICT,{code:"hierarchy_cycle_created",source_id:holderId,verification_errors:cycle.item_ids})}}export{analyzeHierarchyIntegrity,assertHierarchyMutationAllowed,collectHierarchyRelations,formatHierarchyRelation,indexHierarchyRelations};
|
|
310
2
|
//# sourceMappingURL=hierarchy-integrity.js.map
|
|
311
|
-
//# debugId=924f7718-0527-5967-8ab0-53e8228bd665
|
|
@@ -12,12 +12,13 @@ export { computeRelationshipCentrality, findRelationshipCutStructure, type Graph
|
|
|
12
12
|
export { createRelationshipGraphSnapshot, federateRelationshipGraphSnapshots, loadRelationshipGraphAdapter, MemoryRelationshipGraphAdapter, parseRelationshipGraphSnapshot, RELATIONSHIP_GRAPH_SNAPSHOT_VERSION, syncRelationshipGraphAdapter, type LoadedRelationshipGraphSnapshot, type RelationshipGraphAdapter, type RelationshipGraphAdapterContext, type RelationshipGraphAdapterReplaceContext, type RelationshipGraphAdapterSyncResult, type RelationshipGraphSnapshot, } from "./adapter.js";
|
|
13
13
|
export { assertMemoryRelationshipGraphAdapterConformance, assertRelationshipGraphAdapterConformance, createRelationshipGraphScaleFixture, type RelationshipGraphAdapterConformanceCase, type RelationshipGraphAdapterConformanceReport, type RelationshipGraphScaleFixture, type RelationshipGraphScaleFixtureOptions, type RelationshipGraphScaleTopology, } from "./conformance.js";
|
|
14
14
|
export { analyzeRelationshipSchedule, type GraphScheduleOptions, type RelationshipScheduleAnalysis, type RelationshipScheduleRow, } from "./scheduling.js";
|
|
15
|
+
export { deriveRelationshipDeadlines, type DeadlineScheduleItem, type DeadlineScheduleOptions, type DeadlineScheduleRow, type DeadlineScheduleResidual, type DeadlineOvercommitment, type DeadlineScheduleResult, } from "./deadline-scheduling.js";
|
|
15
16
|
export { assembleWorkspaceRelationshipGraph, collectDanglingDependencyReferences, collectDuplicateDependencyRows, collectMissingDependencyTargetIds, collectOrderingStorageContradictions, normalizeDependencyGraphTarget, resolveWorkspaceRelationshipKindRegistry, type DanglingDependencyReference, type DanglingDependencyReferenceSummary, type DependencyReferenceHolder, type DependencyReferenceSource, type DuplicateDependencyRow, type OrderingStorageContradiction, type WorkspaceRelationshipAssembly, type WorkspaceRelationshipItem, type WorkspaceRelationshipNodeDetails, } from "./assembly.js";
|
|
16
|
-
export { auditWorkspaceRelationshipGraph, collectDuplicateRelationshipEdgeGroups, collectOrderingCycles, diffRelationshipAuditSnapshots, formatDuplicateEdgeGroup, formatOrderingStorageContradiction, type DuplicateRelationshipEdgeGroup, type RelationshipAuditDelta, type RelationshipAuditFinding, type RelationshipAuditFindingCode, type RelationshipAuditOptions, type RelationshipAuditReport, type RelationshipAuditSeverity, type RelationshipAuditSnapshot, type RelationshipCoverageProfile, type RelationshipCoverageTypeProfile, } from "./governance.js";
|
|
17
|
+
export { auditWorkspaceRelationshipGraph, collectDuplicateRelationshipEdgeGroups, collectOrderingCycles, diffRelationshipAuditSnapshots, formatDuplicateEdgeGroup, formatOrderingStorageContradiction, type DuplicateRelationshipEdgeGroup, type RelationshipAuditDelta, type RelationshipAuditFinding, type RelationshipAuditFindingCode, type RelationshipAuditOptions, type RelationshipAuditReport, type RelationshipAuditSeverity, type RelationshipAuditSnapshot, type RelationshipCoverageProfile, type RelationshipCoverageTypeProfile, type RelationshipPopulationCoverage, type RelationshipLifecycleCoverage, } from "./governance.js";
|
|
17
18
|
export { analyzeHierarchyIntegrity, assertHierarchyMutationAllowed, collectHierarchyRelations, formatHierarchyRelation, indexHierarchyRelations, type HierarchyCardinalityViolation, type HierarchyCycle, type HierarchyIntegrityAnalysis, type HierarchyIntegrityItem, type HierarchyParentDivergence, type HierarchyRelation, type HierarchyRelationIndexes, type HierarchyRelationSource, } from "./hierarchy-integrity.js";
|
|
18
19
|
export { clearDurableGraphCache, durableGraphCachePath, durableGraphCacheStatus, GRAPH_DURABLE_CACHE_MIN_ITEMS, GRAPH_DURABLE_CACHE_VERSION, graphAuditBaselinePath, loadGraphAuditBaseline, openDurableGraphCache, persistDurableGraphResult, saveGraphAuditBaseline, shouldPersistDurableGraphCache, type DurableGraphCacheEnvelope, type DurableGraphCacheStatus, type DurableGraphCacheView, } from "./durable-cache.js";
|
|
19
20
|
export { enumerateRelationshipPaths, hierarchyAncestors, hierarchyDescendants, orderingPredecessors, orderingSuccessors, type GraphPathOptions, type GraphTraversalOptions, type RelationshipPath, } from "./traversal.js";
|
|
20
21
|
export { computeWorkspaceGraphFingerprint, resetWorkspaceGraphCache, workspaceGraphCache, WorkspaceGraphCache, type GraphCacheMetadata, type WorkspaceGraphCacheLookup, } from "./cache.js";
|
|
21
22
|
export { planRelationshipRemediation, type RelationshipRemediationCode, type RelationshipRemediationConfidence, type RelationshipRemediationOperation, type RelationshipRemediationPlan, type RelationshipRemediationPlanOptions, type RelationshipRemediationStep, } from "./remediation.js";
|
|
22
23
|
export { collectNewOrderingCycleWarnings } from "./mutation-advisory.js";
|
|
23
|
-
export { GRAPH_SUBCOMMAND_VALUES, parseGraphSubcommand, runGraph, type GraphAnalyzeResult, type GraphArticulationResult, type GraphAuditResult, type GraphBridgeRow, type GraphCentralityResult, type GraphCentralityRow, type GraphCommandOptions, type GraphCommunitiesResult, type GraphCommunityRow, type GraphDominatorRow, type GraphDominatorsResult, type GraphExecutionSummary, type GraphImpactResult, type GraphImpactRow, type GraphHierarchySummary, type GraphIndexResult, type GraphKnowledgeSummary, type GraphPathRow, type GraphPathsResult, type GraphPlanResult, type GraphQueryCost, type GraphRedundancyResult, type GraphRedundancyRow, type GraphResult, type GraphScheduleRow, type GraphSlackResult, type GraphSubcommand, type GraphTraversalResult, } from "./run.js";
|
|
24
|
+
export { GRAPH_SUBCOMMAND_VALUES, parseGraphSubcommand, runGraph, type GraphAnalyzeResult, type GraphArticulationResult, type GraphAuditResult, type GraphAuditSummaryResult, type GraphBridgeRow, type GraphCentralityResult, type GraphCentralityRow, type GraphCommandOptions, type GraphCommunitiesResult, type GraphCommunityRow, type GraphDominatorRow, type GraphDominatorsResult, type GraphExecutionSummary, type GraphImpactResult, type GraphImpactRow, type GraphHierarchySummary, type GraphIndexResult, type GraphKnowledgeSummary, type GraphPathRow, type GraphPathsResult, type GraphPlanResult, type GraphQueryCost, type GraphRedundancyResult, type GraphRedundancyRow, type GraphResult, type GraphScheduleRow, type GraphSlackResult, type GraphSubcommand, type GraphTraversalResult, } from "./run.js";
|
package/dist/sdk/graph/index.js
CHANGED
|
@@ -1,27 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* @module sdk/graph
|
|
3
|
-
*
|
|
4
|
-
* Public workspace graph toolkit: one-pass relationship assembly with
|
|
5
|
-
* missing-reference governance, registry-semantics traversal (hierarchy,
|
|
6
|
-
* execution order, bounded path enumeration), and the policy-aware
|
|
7
|
-
* relationship audit. Everything here layers on the dependency-free kernel in
|
|
8
|
-
* `sdk/relationships` and is safe for CLI, MCP, extension, and non-PM callers.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="20842b89-cef6-542e-b069-76c22b340f1d")}catch(e){}}();
|
|
12
|
-
export { computeRelationshipDominators, detectRelationshipCommunities, findRedundantRelationshipEdges, forEachMatchedRelationshipEdge, } from "./analytics.js";
|
|
13
|
-
export { computeRelationshipCentrality, findRelationshipCutStructure, } from "./centrality.js";
|
|
14
|
-
export { createRelationshipGraphSnapshot, federateRelationshipGraphSnapshots, loadRelationshipGraphAdapter, MemoryRelationshipGraphAdapter, parseRelationshipGraphSnapshot, RELATIONSHIP_GRAPH_SNAPSHOT_VERSION, syncRelationshipGraphAdapter, } from "./adapter.js";
|
|
15
|
-
export { assertMemoryRelationshipGraphAdapterConformance, assertRelationshipGraphAdapterConformance, createRelationshipGraphScaleFixture, } from "./conformance.js";
|
|
16
|
-
export { analyzeRelationshipSchedule, } from "./scheduling.js";
|
|
17
|
-
export { assembleWorkspaceRelationshipGraph, collectDanglingDependencyReferences, collectDuplicateDependencyRows, collectMissingDependencyTargetIds, collectOrderingStorageContradictions, normalizeDependencyGraphTarget, resolveWorkspaceRelationshipKindRegistry, } from "./assembly.js";
|
|
18
|
-
export { auditWorkspaceRelationshipGraph, collectDuplicateRelationshipEdgeGroups, collectOrderingCycles, diffRelationshipAuditSnapshots, formatDuplicateEdgeGroup, formatOrderingStorageContradiction, } from "./governance.js";
|
|
19
|
-
export { analyzeHierarchyIntegrity, assertHierarchyMutationAllowed, collectHierarchyRelations, formatHierarchyRelation, indexHierarchyRelations, } from "./hierarchy-integrity.js";
|
|
20
|
-
export { clearDurableGraphCache, durableGraphCachePath, durableGraphCacheStatus, GRAPH_DURABLE_CACHE_MIN_ITEMS, GRAPH_DURABLE_CACHE_VERSION, graphAuditBaselinePath, loadGraphAuditBaseline, openDurableGraphCache, persistDurableGraphResult, saveGraphAuditBaseline, shouldPersistDurableGraphCache, } from "./durable-cache.js";
|
|
21
|
-
export { enumerateRelationshipPaths, hierarchyAncestors, hierarchyDescendants, orderingPredecessors, orderingSuccessors, } from "./traversal.js";
|
|
22
|
-
export { computeWorkspaceGraphFingerprint, resetWorkspaceGraphCache, workspaceGraphCache, WorkspaceGraphCache, } from "./cache.js";
|
|
23
|
-
export { planRelationshipRemediation, } from "./remediation.js";
|
|
24
|
-
export { collectNewOrderingCycleWarnings } from "./mutation-advisory.js";
|
|
25
|
-
export { GRAPH_SUBCOMMAND_VALUES, parseGraphSubcommand, runGraph, } from "./run.js";
|
|
1
|
+
!(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c59413c4-8955-5560-8bc6-f1dc9c8c5042")}catch(e2){}})();import{computeRelationshipDominators,detectRelationshipCommunities,findRedundantRelationshipEdges,forEachMatchedRelationshipEdge}from"./analytics.js";import{computeRelationshipCentrality,findRelationshipCutStructure}from"./centrality.js";import{createRelationshipGraphSnapshot,federateRelationshipGraphSnapshots,loadRelationshipGraphAdapter,MemoryRelationshipGraphAdapter,parseRelationshipGraphSnapshot,RELATIONSHIP_GRAPH_SNAPSHOT_VERSION,syncRelationshipGraphAdapter}from"./adapter.js";import{assertMemoryRelationshipGraphAdapterConformance,assertRelationshipGraphAdapterConformance,createRelationshipGraphScaleFixture}from"./conformance.js";import{analyzeRelationshipSchedule}from"./scheduling.js";import{deriveRelationshipDeadlines}from"./deadline-scheduling.js";import{assembleWorkspaceRelationshipGraph,collectDanglingDependencyReferences,collectDuplicateDependencyRows,collectMissingDependencyTargetIds,collectOrderingStorageContradictions,normalizeDependencyGraphTarget,resolveWorkspaceRelationshipKindRegistry}from"./assembly.js";import{auditWorkspaceRelationshipGraph,collectDuplicateRelationshipEdgeGroups,collectOrderingCycles,diffRelationshipAuditSnapshots,formatDuplicateEdgeGroup,formatOrderingStorageContradiction}from"./governance.js";import{analyzeHierarchyIntegrity,assertHierarchyMutationAllowed,collectHierarchyRelations,formatHierarchyRelation,indexHierarchyRelations}from"./hierarchy-integrity.js";import{clearDurableGraphCache,durableGraphCachePath,durableGraphCacheStatus,GRAPH_DURABLE_CACHE_MIN_ITEMS,GRAPH_DURABLE_CACHE_VERSION,graphAuditBaselinePath,loadGraphAuditBaseline,openDurableGraphCache,persistDurableGraphResult,saveGraphAuditBaseline,shouldPersistDurableGraphCache}from"./durable-cache.js";import{enumerateRelationshipPaths,hierarchyAncestors,hierarchyDescendants,orderingPredecessors,orderingSuccessors}from"./traversal.js";import{computeWorkspaceGraphFingerprint,resetWorkspaceGraphCache,workspaceGraphCache,WorkspaceGraphCache}from"./cache.js";import{planRelationshipRemediation}from"./remediation.js";import{collectNewOrderingCycleWarnings}from"./mutation-advisory.js";import{GRAPH_SUBCOMMAND_VALUES,parseGraphSubcommand,runGraph}from"./run.js";export{GRAPH_DURABLE_CACHE_MIN_ITEMS,GRAPH_DURABLE_CACHE_VERSION,GRAPH_SUBCOMMAND_VALUES,MemoryRelationshipGraphAdapter,RELATIONSHIP_GRAPH_SNAPSHOT_VERSION,WorkspaceGraphCache,analyzeHierarchyIntegrity,analyzeRelationshipSchedule,assembleWorkspaceRelationshipGraph,assertHierarchyMutationAllowed,assertMemoryRelationshipGraphAdapterConformance,assertRelationshipGraphAdapterConformance,auditWorkspaceRelationshipGraph,clearDurableGraphCache,collectDanglingDependencyReferences,collectDuplicateDependencyRows,collectDuplicateRelationshipEdgeGroups,collectHierarchyRelations,collectMissingDependencyTargetIds,collectNewOrderingCycleWarnings,collectOrderingCycles,collectOrderingStorageContradictions,computeRelationshipCentrality,computeRelationshipDominators,computeWorkspaceGraphFingerprint,createRelationshipGraphScaleFixture,createRelationshipGraphSnapshot,deriveRelationshipDeadlines,detectRelationshipCommunities,diffRelationshipAuditSnapshots,durableGraphCachePath,durableGraphCacheStatus,enumerateRelationshipPaths,federateRelationshipGraphSnapshots,findRedundantRelationshipEdges,findRelationshipCutStructure,forEachMatchedRelationshipEdge,formatDuplicateEdgeGroup,formatHierarchyRelation,formatOrderingStorageContradiction,graphAuditBaselinePath,hierarchyAncestors,hierarchyDescendants,indexHierarchyRelations,loadGraphAuditBaseline,loadRelationshipGraphAdapter,normalizeDependencyGraphTarget,openDurableGraphCache,orderingPredecessors,orderingSuccessors,parseGraphSubcommand,parseRelationshipGraphSnapshot,persistDurableGraphResult,planRelationshipRemediation,resetWorkspaceGraphCache,resolveWorkspaceRelationshipKindRegistry,runGraph,saveGraphAuditBaseline,shouldPersistDurableGraphCache,syncRelationshipGraphAdapter,workspaceGraphCache};
|
|
26
2
|
//# sourceMappingURL=index.js.map
|
|
27
|
-
//# debugId=20842b89-cef6-542e-b069-76c22b340f1d
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** @module sdk/graph/lifecycle-coverage Recorded-node connectivity censuses across lifecycle and schema-defined statuses. */
|
|
2
|
+
import type { WorkspaceRelationshipAssembly } from "./assembly.js";
|
|
3
|
+
/** Connectivity counts over an explicitly named recorded-node population. */
|
|
4
|
+
export interface RelationshipPopulationCoverage {
|
|
5
|
+
/** Recorded items in the population, including outcome anchors. */
|
|
6
|
+
nodes: number;
|
|
7
|
+
/** Items with no incident relationship. */
|
|
8
|
+
isolated: number;
|
|
9
|
+
/** Items with zero or one incident relationship. */
|
|
10
|
+
degree_leq_one: number;
|
|
11
|
+
/** Items with at least one incident provenance or verification edge. */
|
|
12
|
+
semantic_nodes: number;
|
|
13
|
+
/** Items without incident provenance or verification edges. */
|
|
14
|
+
without_semantic_edges: number;
|
|
15
|
+
/** Incident directed-edge degree distribution, keyed by exact degree. */
|
|
16
|
+
degree_histogram: Record<string, number>;
|
|
17
|
+
}
|
|
18
|
+
/** Named lifecycle slices and raw-status slices share the same counting convention. */
|
|
19
|
+
export interface RelationshipLifecycleCoverage {
|
|
20
|
+
/** Missing and external placeholders are excluded from every population. */
|
|
21
|
+
coverage_by_lifecycle: Record<"all" | "active" | "terminal", RelationshipPopulationCoverage>;
|
|
22
|
+
/** Raw schema statuses are retained, including custom terminal statuses. */
|
|
23
|
+
coverage_by_status: Record<string, RelationshipPopulationCoverage>;
|
|
24
|
+
}
|
|
25
|
+
/** Count each recorded item once per slice; edge incidence uses the assembled graph's deduplicated directed basis. */
|
|
26
|
+
export declare function profileRelationshipLifecycles(assembly: WorkspaceRelationshipAssembly, isTerminal: (status: string) => boolean, isSemantic: (kind: string) => boolean, signal?: AbortSignal): RelationshipLifecycleCoverage;
|
|
27
|
+
/** Accept legacy absence, but reject partial or malformed new lifecycle census fields. */
|
|
28
|
+
export declare function validLifecycleSnapshot(profile: Record<string, unknown>): boolean;
|
|
29
|
+
/** Compare measured lifecycle censuses; legacy baselines remain explicitly incomparable. */
|
|
30
|
+
export declare function diffLifecycleCoverage(before: Partial<RelationshipLifecycleCoverage>, after: Partial<RelationshipLifecycleCoverage>): Partial<RelationshipLifecycleCoverage> & {
|
|
31
|
+
lifecycle_comparable: boolean;
|
|
32
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="2bfc4e78-a376-5099-be50-38e339eac660")}catch(e2){}})();function emptyCoverage(){return{nodes:0,isolated:0,degree_leq_one:0,semantic_nodes:0,without_semantic_edges:0,degree_histogram:{}}}function profileRelationshipLifecycles(assembly,isTerminal,isSemantic,signal){const lifecycle={all:emptyCoverage(),active:emptyCoverage(),terminal:emptyCoverage()};const statuses=new Map;for(const detail of assembly.details){signal?.throwIfAborted();if(assembly.missingIdSet.has(detail.id.toLowerCase())||detail.status==="external")continue;const status=statuses.get(detail.status)??emptyCoverage();statuses.set(detail.status,status);const incident=assembly.graph.incidentEdges(detail.id);const semantic=incident.some(edge=>isSemantic(edge.kind));for(const bucket of[lifecycle.all,lifecycle[isTerminal(detail.status)?"terminal":"active"],status]){bucket.nodes+=1;bucket.isolated+=Number(incident.length===0);if(incident.length<=1)bucket.degree_leq_one+=1;if(semantic)bucket.semantic_nodes+=1;else bucket.without_semantic_edges+=1;const degree=String(incident.length);bucket.degree_histogram[degree]=(bucket.degree_histogram[degree]??0)+1}}return{coverage_by_lifecycle:lifecycle,coverage_by_status:Object.fromEntries([...statuses].sort(([left],[right])=>left.localeCompare(right)))}}function validPopulation(value){if(!isCoverageRecord(value))return false;const row=value;const fields=["nodes","isolated","degree_leq_one","semantic_nodes","without_semantic_edges"];if(!fields.every(field=>Number.isSafeInteger(row[field])&&Number(row[field])>=0))return false;if(!isCoverageRecord(row.degree_histogram))return false;const histogram=Object.entries(row.degree_histogram);return histogram.every(([key,count])=>/^(0|[1-9]\d*)$/.test(key)&&Number.isSafeInteger(count)&&Number(count)>=0)&&histogram.reduce((sum,[,count])=>sum+Number(count),0)===row.nodes&&Number(row.isolated)<=Number(row.degree_leq_one)&&Number(row.degree_leq_one)<=Number(row.nodes)&&Number(row.semantic_nodes)+Number(row.without_semantic_edges)===row.nodes}function isCoverageRecord(value){return typeof value==="object"&&value!==null&&!Array.isArray(value)}function validLifecycleSnapshot(profile){for(const field of["ordering_acyclic","active_ordering_acyclic"]){if(profile[field]!==void 0&&typeof profile[field]!=="boolean")return false}const lifecycle=profile.coverage_by_lifecycle;const statuses=profile.coverage_by_status;if(lifecycle===void 0&&statuses===void 0)return true;if(!isCoverageRecord(lifecycle)||!isCoverageRecord(statuses))return false;return["all","active","terminal"].every(key=>validPopulation(lifecycle[key]))&&Object.values(statuses).every(validPopulation)}function diffPopulations(before,after){return Object.fromEntries([...new Set([...Object.keys(before),...Object.keys(after)])].sort().map(key=>{const left=Object.hasOwn(before,key)?before[key]:emptyCoverage();const right=Object.hasOwn(after,key)?after[key]:emptyCoverage();const histogram=Object.fromEntries([...new Set([...Object.keys(left.degree_histogram),...Object.keys(right.degree_histogram)])].sort().map(degree=>[degree,(right.degree_histogram[degree]??0)-(left.degree_histogram[degree]??0)]));return[key,{nodes:right.nodes-left.nodes,isolated:right.isolated-left.isolated,degree_leq_one:right.degree_leq_one-left.degree_leq_one,semantic_nodes:right.semantic_nodes-left.semantic_nodes,without_semantic_edges:right.without_semantic_edges-left.without_semantic_edges,degree_histogram:histogram}]}))}function diffLifecycleCoverage(before,after){if(!before.coverage_by_lifecycle||!after.coverage_by_lifecycle||!before.coverage_by_status||!after.coverage_by_status)return{lifecycle_comparable:false};return{lifecycle_comparable:true,coverage_by_lifecycle:diffPopulations(before.coverage_by_lifecycle,after.coverage_by_lifecycle),coverage_by_status:diffPopulations(before.coverage_by_status,after.coverage_by_status)}}export{diffLifecycleCoverage,profileRelationshipLifecycles,validLifecycleSnapshot};
|
|
2
|
+
//# sourceMappingURL=lifecycle-coverage.js.map
|
|
@@ -1,177 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="94e8b95b-35fa-5fc7-843a-481497e09b54")}catch(e){}}();
|
|
3
|
-
import { collectOrderingStorageContradictions, normalizeDependencyGraphTarget, resolveWorkspaceRelationshipKindRegistry, } from "./assembly.js";
|
|
4
|
-
import { collectOrderingCycles, formatOrderingStorageContradiction, } from "./governance.js";
|
|
5
|
-
function cycleKey(component) {
|
|
6
|
-
return [...component].sort().join("\u0000");
|
|
7
|
-
}
|
|
8
|
-
/** Append one oriented ordering edge to both adjacency orientations. */
|
|
9
|
-
function addOrderingEdge(digraph, predecessor, successor) {
|
|
10
|
-
const forward = digraph.successors.get(predecessor);
|
|
11
|
-
if (forward)
|
|
12
|
-
forward.push(successor);
|
|
13
|
-
else
|
|
14
|
-
digraph.successors.set(predecessor, [successor]);
|
|
15
|
-
const backward = digraph.predecessors.get(successor);
|
|
16
|
-
if (backward)
|
|
17
|
-
backward.push(predecessor);
|
|
18
|
-
else
|
|
19
|
-
digraph.predecessors.set(successor, [predecessor]);
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Orient one candidate reference into the digraph when its kind is a
|
|
23
|
-
* registry-known order-bearing kind and its target resolves to a real item.
|
|
24
|
-
* Associative kinds, unknown kinds, retired sentinels, and references to
|
|
25
|
-
* absent items are skipped because none of them can create an
|
|
26
|
-
* execution-order cycle — a referenced-but-absent item has no stored
|
|
27
|
-
* out-edges.
|
|
28
|
-
*/
|
|
29
|
-
function orientOrderingEdge(digraph, registry, source, target, kind) {
|
|
30
|
-
const definition = registry.resolve(kind);
|
|
31
|
-
if (definition?.ordering !== true)
|
|
32
|
-
return;
|
|
33
|
-
const normalized = normalizeDependencyGraphTarget(target);
|
|
34
|
-
const canonicalTarget = normalized === undefined
|
|
35
|
-
? undefined
|
|
36
|
-
: digraph.canonicalIds.get(normalized.toLowerCase());
|
|
37
|
-
if (canonicalTarget === undefined)
|
|
38
|
-
return;
|
|
39
|
-
const sourceFirst = (definition.precedence ?? "source_before_target") ===
|
|
40
|
-
"source_before_target";
|
|
41
|
-
addOrderingEdge(digraph, sourceFirst ? source : canonicalTarget, sourceFirst ? canonicalTarget : source);
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Build the ordering-only digraph for one item snapshot without assembling a
|
|
45
|
-
* full relationship graph: one linear pass over the legacy scalar blocker and
|
|
46
|
-
* structured dependency rows of every item.
|
|
47
|
-
*/
|
|
48
|
-
function buildOrderingDigraph(items, registry) {
|
|
49
|
-
const digraph = {
|
|
50
|
-
successors: new Map(),
|
|
51
|
-
predecessors: new Map(),
|
|
52
|
-
canonicalIds: new Map(),
|
|
53
|
-
};
|
|
54
|
-
const safeItems = items.filter((item) => typeof item?.id === "string" && item.id.trim().length > 0);
|
|
55
|
-
for (const item of safeItems) {
|
|
56
|
-
const id = item.id.trim();
|
|
57
|
-
digraph.canonicalIds.set(id.toLowerCase(), id);
|
|
58
|
-
}
|
|
59
|
-
for (const item of safeItems) {
|
|
60
|
-
const id = item.id.trim();
|
|
61
|
-
orientOrderingEdge(digraph, registry, id, item.blocked_by, "blocked_by");
|
|
62
|
-
for (const dependency of item.dependencies ?? []) {
|
|
63
|
-
if (typeof dependency !== "object" || dependency === null)
|
|
64
|
-
continue;
|
|
65
|
-
orientOrderingEdge(digraph, registry, id, dependency.id, typeof dependency.kind === "string" ? dependency.kind : "related");
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
for (const adjacency of [digraph.successors, digraph.predecessors])
|
|
69
|
-
for (const neighbors of adjacency.values())
|
|
70
|
-
neighbors.sort();
|
|
71
|
-
return digraph;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Collect the changed item's weakly connected ordering component: every node
|
|
75
|
-
* reachable through ordering edges in either orientation. Cycle enumeration
|
|
76
|
-
* restricted to this member set is exact for cycles containing the changed
|
|
77
|
-
* item, because a strongly connected component is always contained in a
|
|
78
|
-
* weakly connected one.
|
|
79
|
-
*/
|
|
80
|
-
function collectWeakComponent(digraph, start) {
|
|
81
|
-
const members = new Set([start]);
|
|
82
|
-
const queue = [start];
|
|
83
|
-
while (queue.length > 0) {
|
|
84
|
-
const node = queue.pop();
|
|
85
|
-
for (const adjacency of [digraph.successors, digraph.predecessors]) {
|
|
86
|
-
for (const neighbor of adjacency.get(node) ?? []) {
|
|
87
|
-
if (members.has(neighbor))
|
|
88
|
-
continue;
|
|
89
|
-
members.add(neighbor);
|
|
90
|
-
queue.push(neighbor);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return members;
|
|
95
|
-
}
|
|
96
|
-
/** Restrict a successor adjacency to edges whose endpoints are both members. */
|
|
97
|
-
function induceSuccessors(digraph, members) {
|
|
98
|
-
const induced = new Map();
|
|
99
|
-
for (const member of members) {
|
|
100
|
-
const neighbors = (digraph.successors.get(member) ?? []).filter((node) => members.has(node));
|
|
101
|
-
if (neighbors.length > 0)
|
|
102
|
-
induced.set(member, neighbors);
|
|
103
|
-
}
|
|
104
|
-
return induced;
|
|
105
|
-
}
|
|
106
|
-
/** Enumerate component-scoped ordering cycles around one canonical item id. */
|
|
107
|
-
function collectScopedCycles(items, registry, changedItemId) {
|
|
108
|
-
const digraph = buildOrderingDigraph(items, registry);
|
|
109
|
-
const canonical = digraph.canonicalIds.get(changedItemId.trim().toLowerCase());
|
|
110
|
-
if (canonical === undefined)
|
|
111
|
-
return { cycles: [], successors: new Map(), canonical: changedItemId };
|
|
112
|
-
const successors = induceSuccessors(digraph, collectWeakComponent(digraph, canonical));
|
|
113
|
-
return {
|
|
114
|
-
cycles: collectOrderingCycles(successors).filter((component) => component.includes(canonical)),
|
|
115
|
-
successors,
|
|
116
|
-
canonical,
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
function findCyclePath(adjacency, component, changedItemId) {
|
|
120
|
-
const members = new Set(component);
|
|
121
|
-
const start = members.has(changedItemId) ? changedItemId : component[0];
|
|
122
|
-
if (adjacency.get(start)?.includes(start))
|
|
123
|
-
return [start, start];
|
|
124
|
-
for (const first of adjacency.get(start) ?? []) {
|
|
125
|
-
if (!members.has(first))
|
|
126
|
-
continue;
|
|
127
|
-
const path = findPathBackToStart(adjacency, members, start, first);
|
|
128
|
-
if (path)
|
|
129
|
-
return path;
|
|
130
|
-
}
|
|
131
|
-
return [...component, component[0]];
|
|
132
|
-
}
|
|
133
|
-
function findPathBackToStart(adjacency, members, start, first) {
|
|
134
|
-
const queue = [[first]];
|
|
135
|
-
const visited = new Set([start, first]);
|
|
136
|
-
while (queue.length > 0) {
|
|
137
|
-
const path = queue.shift();
|
|
138
|
-
const tail = path.at(-1);
|
|
139
|
-
for (const next of adjacency.get(tail) ?? []) {
|
|
140
|
-
if (next === start)
|
|
141
|
-
return [start, ...path, start];
|
|
142
|
-
if (!members.has(next) || visited.has(next))
|
|
143
|
-
continue;
|
|
144
|
-
visited.add(next);
|
|
145
|
-
queue.push([...path, next]);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
return undefined;
|
|
149
|
-
}
|
|
150
|
-
/** Return actionable warnings only for ordering cycles created by the later snapshot and containing the changed item. */
|
|
151
|
-
export function collectNewOrderingCycleWarnings(beforeItems, afterItems, changedItemId) {
|
|
152
|
-
const registry = resolveWorkspaceRelationshipKindRegistry();
|
|
153
|
-
const before = collectScopedCycles(beforeItems, registry, changedItemId);
|
|
154
|
-
const after = collectScopedCycles(afterItems, registry, changedItemId);
|
|
155
|
-
const beforeCycles = new Set(before.cycles.map(cycleKey));
|
|
156
|
-
const beforeContradictions = new Set(collectOrderingStorageContradictions(beforeItems, undefined, registry).map((row) => `${row.holder_id.toLowerCase()}\u0000${row.target_id.toLowerCase()}\u0000${row.dependency_kind}`));
|
|
157
|
-
const contradictionWarnings = collectOrderingStorageContradictions(afterItems, undefined, registry)
|
|
158
|
-
.filter((row) => row.holder_id.toLowerCase() === changedItemId.trim().toLowerCase() &&
|
|
159
|
-
!beforeContradictions.has(`${row.holder_id.toLowerCase()}\u0000${row.target_id.toLowerCase()}\u0000${row.dependency_kind}`))
|
|
160
|
-
.map((row) => `ordering_storage_contradiction_created:${formatOrderingStorageContradiction(row)}:remove_contradicting_dependency_row:run_pm_graph_audit`);
|
|
161
|
-
return [
|
|
162
|
-
...contradictionWarnings,
|
|
163
|
-
...after.cycles
|
|
164
|
-
.filter((component) => !beforeCycles.has(cycleKey(component)))
|
|
165
|
-
.map((component) => `ordering_cycle_created:${findCyclePath(after.successors, component, after.canonical).join(" -> ")}:items_will_not_be_ready:run_pm_graph_audit`),
|
|
166
|
-
];
|
|
167
|
-
}
|
|
168
|
-
/** White-box graph-path helpers for exhaustive SDK primitive verification. */
|
|
169
|
-
export const mutationAdvisoryTestOnly = {
|
|
170
|
-
buildOrderingDigraph,
|
|
171
|
-
collectWeakComponent,
|
|
172
|
-
induceSuccessors,
|
|
173
|
-
findCyclePath,
|
|
174
|
-
findPathBackToStart,
|
|
175
|
-
};
|
|
1
|
+
!(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="874a21db-ed3b-5b4f-a913-bf87103172e7")}catch(e2){}})();import{collectOrderingStorageContradictions,normalizeDependencyGraphTarget,resolveWorkspaceRelationshipKindRegistry}from"./assembly.js";import{collectOrderingCycles,formatOrderingStorageContradiction}from"./governance.js";function cycleKey(component){return[...component].sort().join("\0")}function addOrderingEdge(digraph,predecessor,successor){const forward=digraph.successors.get(predecessor);if(forward)forward.push(successor);else digraph.successors.set(predecessor,[successor]);const backward=digraph.predecessors.get(successor);if(backward)backward.push(predecessor);else digraph.predecessors.set(successor,[predecessor])}function orientOrderingEdge(digraph,registry,source,target,kind){const definition=registry.resolve(kind);if(definition?.ordering!==true)return;const normalized=normalizeDependencyGraphTarget(target);const canonicalTarget=normalized===void 0?void 0:digraph.canonicalIds.get(normalized.toLowerCase());if(canonicalTarget===void 0)return;const sourceFirst=(definition.precedence??"source_before_target")==="source_before_target";addOrderingEdge(digraph,sourceFirst?source:canonicalTarget,sourceFirst?canonicalTarget:source)}function buildOrderingDigraph(items,registry){const digraph={successors:new Map,predecessors:new Map,canonicalIds:new Map};const safeItems=items.filter(item=>typeof item?.id==="string"&&item.id.trim().length>0);for(const item of safeItems){const id=item.id.trim();digraph.canonicalIds.set(id.toLowerCase(),id)}for(const item of safeItems){const id=item.id.trim();orientOrderingEdge(digraph,registry,id,item.blocked_by,"blocked_by");for(const dependency of item.dependencies??[]){if(typeof dependency!=="object"||dependency===null)continue;orientOrderingEdge(digraph,registry,id,dependency.id,typeof dependency.kind==="string"?dependency.kind:"related")}}for(const adjacency of[digraph.successors,digraph.predecessors])for(const neighbors of adjacency.values())neighbors.sort();return digraph}function collectWeakComponent(digraph,start){const members=new Set([start]);const queue=[start];while(queue.length>0){const node=queue.pop();for(const adjacency of[digraph.successors,digraph.predecessors]){for(const neighbor of adjacency.get(node)??[]){if(members.has(neighbor))continue;members.add(neighbor);queue.push(neighbor)}}}return members}function induceSuccessors(digraph,members){const induced=new Map;for(const member of members){const neighbors=(digraph.successors.get(member)??[]).filter(node=>members.has(node));if(neighbors.length>0)induced.set(member,neighbors)}return induced}function collectScopedCycles(items,registry,changedItemId){const digraph=buildOrderingDigraph(items,registry);const canonical=digraph.canonicalIds.get(changedItemId.trim().toLowerCase());if(canonical===void 0)return{cycles:[],successors:new Map,canonical:changedItemId};const successors=induceSuccessors(digraph,collectWeakComponent(digraph,canonical));return{cycles:collectOrderingCycles(successors).filter(component=>component.includes(canonical)),successors,canonical}}function findCyclePath(adjacency,component,changedItemId){const members=new Set(component);const start=members.has(changedItemId)?changedItemId:component[0];if(adjacency.get(start)?.includes(start))return[start,start];for(const first of adjacency.get(start)??[]){if(!members.has(first))continue;const path=findPathBackToStart(adjacency,members,start,first);if(path)return path}return[...component,component[0]]}function findPathBackToStart(adjacency,members,start,first){const queue=[[first]];const visited=new Set([start,first]);while(queue.length>0){const path=queue.shift();const tail=path.at(-1);for(const next of adjacency.get(tail)??[]){if(next===start)return[start,...path,start];if(!members.has(next)||visited.has(next))continue;visited.add(next);queue.push([...path,next])}}return void 0}function collectNewOrderingCycleWarnings(beforeItems,afterItems,changedItemId){const registry=resolveWorkspaceRelationshipKindRegistry();const before=collectScopedCycles(beforeItems,registry,changedItemId);const after=collectScopedCycles(afterItems,registry,changedItemId);const beforeCycles=new Set(before.cycles.map(cycleKey));const beforeContradictions=new Set(collectOrderingStorageContradictions(beforeItems,void 0,registry).map(row=>`${row.holder_id.toLowerCase()}\0${row.target_id.toLowerCase()}\0${row.dependency_kind}`));const contradictionWarnings=collectOrderingStorageContradictions(afterItems,void 0,registry).filter(row=>row.holder_id.toLowerCase()===changedItemId.trim().toLowerCase()&&!beforeContradictions.has(`${row.holder_id.toLowerCase()}\0${row.target_id.toLowerCase()}\0${row.dependency_kind}`)).map(row=>`ordering_storage_contradiction_created:${formatOrderingStorageContradiction(row)}:remove_contradicting_dependency_row:run_pm_graph_audit`);return[...contradictionWarnings,...after.cycles.filter(component=>!beforeCycles.has(cycleKey(component))).map(component=>`ordering_cycle_created:${findCyclePath(after.successors,component,after.canonical).join(" -> ")}:items_will_not_be_ready:run_pm_graph_audit`)]}const mutationAdvisoryTestOnly={buildOrderingDigraph,collectWeakComponent,induceSuccessors,findCyclePath,findPathBackToStart};export{collectNewOrderingCycleWarnings,mutationAdvisoryTestOnly};
|
|
176
2
|
//# sourceMappingURL=mutation-advisory.js.map
|
|
177
|
-
//# debugId=94e8b95b-35fa-5fc7-843a-481497e09b54
|