@unbrained/pm-cli 2026.11.21 → 2026.11.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/pm-developer/SKILL.md +1 -1
- package/.claude-plugin/marketplace.json +1 -1
- package/dist/cli/after-command-context-usage.js +1 -1
- package/dist/cli/argv-utils.js +1 -1
- package/dist/cli/bootstrap-args.js +1 -1
- package/dist/cli/bundle-integrity.js +2 -2
- package/dist/cli/command-namespaces.js +1 -1
- package/dist/cli/commander-usage.js +11 -11
- package/dist/cli/commands/annotations/comments.js +1 -1
- package/dist/cli/commands/annotations/docs.js +1 -1
- package/dist/cli/commands/annotations/files.js +1 -1
- package/dist/cli/commands/annotations/learnings.js +1 -1
- package/dist/cli/commands/annotations/notes.js +1 -1
- package/dist/cli/commands/extension/describe.js +1 -1
- package/dist/cli/commands/extension/extension.js +1 -1
- package/dist/cli/commands/extension/scaffold.js +1 -1
- package/dist/cli/commands/extension/shared.js +1 -1
- package/dist/cli/commands/governance/gc.js +1 -1
- package/dist/cli/commands/governance/health.js +1 -1
- package/dist/cli/commands/governance/telemetry.js +1 -1
- package/dist/cli/commands/governance/validate.js +1 -1
- package/dist/cli/commands/history/activity.js +1 -1
- package/dist/cli/commands/history/history-compact.js +1 -1
- package/dist/cli/commands/history/history-redact.js +1 -1
- package/dist/cli/commands/history/history-repair.js +1 -1
- package/dist/cli/commands/history/history.js +1 -1
- package/dist/cli/commands/history/restore.js +1 -1
- package/dist/cli/commands/lifecycle/append.js +1 -1
- package/dist/cli/commands/lifecycle/claim.js +1 -1
- package/dist/cli/commands/lifecycle/close-many.js +1 -1
- package/dist/cli/commands/lifecycle/close.js +1 -1
- package/dist/cli/commands/lifecycle/copy.js +1 -1
- package/dist/cli/commands/lifecycle/create.js +1 -1
- package/dist/cli/commands/lifecycle/delete.js +1 -1
- package/dist/cli/commands/lifecycle/focus.js +1 -1
- package/dist/cli/commands/lifecycle/plan.js +1 -1
- package/dist/cli/commands/lifecycle/update-many.js +1 -1
- package/dist/cli/commands/lifecycle/update.js +1 -1
- package/dist/cli/commands/query/aggregate.js +1 -1
- package/dist/cli/commands/query/context.js +1 -1
- package/dist/cli/commands/query/deps.js +1 -1
- package/dist/cli/commands/query/duplicates.js +1 -1
- package/dist/cli/commands/query/eval.js +1 -1
- package/dist/cli/commands/query/get.js +1 -1
- package/dist/cli/commands/query/graph.js +1 -1
- package/dist/cli/commands/query/list.js +1 -1
- package/dist/cli/commands/query/next.js +1 -1
- package/dist/cli/commands/query/search.js +1 -1
- package/dist/cli/commands/query/stats.js +1 -1
- package/dist/cli/commands/test/test-all.js +1 -1
- package/dist/cli/commands/test/test-runs.js +1 -1
- package/dist/cli/commands/test/test.js +1 -1
- package/dist/cli/commands/workspace/config.js +1 -1
- package/dist/cli/commands/workspace/contracts.js +1 -1
- package/dist/cli/commands/workspace/init.js +1 -1
- package/dist/cli/commands/workspace/merge.js +1 -1
- package/dist/cli/commands/workspace/profile.js +1 -1
- package/dist/cli/commands/workspace/schema.js +1 -1
- package/dist/cli/commands/workspace/upgrade.js +1 -1
- package/dist/cli/context-intent-invocation.js +1 -1
- package/dist/cli/description-stdin.js +1 -1
- package/dist/cli/error-guidance.js +5 -5
- package/dist/cli/expected-revisions.js +1 -1
- package/dist/cli/extension-command-help.js +6 -6
- package/dist/cli/extension-recovery.js +1 -1
- package/dist/cli/help-content.js +5 -5
- package/dist/cli/help-json-payload.js +7 -7
- package/dist/cli/invocation-profile.js +2 -2
- package/dist/cli/main.js +5 -5
- package/dist/cli/migration-gates.js +1 -1
- package/dist/cli/option-values.js +1 -1
- package/dist/cli/preflight-warnings.js +3 -3
- package/dist/cli/public.js +1 -1
- package/dist/cli/register-annotations.js +1 -1
- package/dist/cli/register-assurance.js +1 -1
- package/dist/cli/register-files-lookup.js +1 -1
- package/dist/cli/register-history-activity.js +1 -1
- package/dist/cli/register-history-author.js +1 -1
- package/dist/cli/register-history-maintenance.js +2 -2
- package/dist/cli/register-list-query.js +10 -10
- package/dist/cli/register-mutation-options.js +0 -1
- package/dist/cli/register-mutation.js +6 -6
- package/dist/cli/register-operations.js +1 -1
- package/dist/cli/register-setup.js +1 -1
- package/dist/cli/register-structured-mutation.js +1 -1
- package/dist/cli/registration-helpers.js +1 -1
- package/dist/cli/runtime/activation.js +1 -1
- package/dist/cli/runtime/annotation-option-retry.js +1 -1
- package/dist/cli/runtime/close-fields-retry.js +1 -1
- package/dist/cli/runtime/field-route-retry.js +1 -1
- package/dist/cli/runtime/invocation-options.js +1 -1
- package/dist/cli/runtime/invocation-rewrites.js +1 -1
- package/dist/cli/runtime/projection-retry.js +1 -1
- package/dist/cli/runtime/read-output-mutation-retry.js +1 -1
- package/dist/cli/runtime/refusal-credential-redaction.js +1 -1
- package/dist/cli/runtime/selection.js +1 -1
- package/dist/cli/runtime/telemetry-outcome.js +1 -1
- package/dist/cli/runtime-compatibility-boundary.js +4 -4
- package/dist/cli/schema/registration.js +15 -15
- package/dist/cli/schema-registration-helpers.js +1 -1
- package/dist/cli/search-refresh.js +1 -1
- package/dist/cli/stats-analytics-json.js +1 -1
- package/dist/cli/telemetry-flush.js +1 -1
- package/dist/cli-bundle/bundle-manifest.json +1 -1
- package/dist/cli-bundle/chunks/chunk-2UQU7HRR.js +9 -0
- package/dist/cli-bundle/chunks/chunk-5DUP4AZA.js +2 -0
- package/dist/cli-bundle/chunks/chunk-5WZZ5XEN.js +3 -0
- package/dist/cli-bundle/chunks/chunk-6H36ZHMI.js +2 -0
- package/dist/cli-bundle/chunks/chunk-6MYJLOSG.js +2 -0
- package/dist/cli-bundle/chunks/chunk-AA52P34H.js +3 -0
- package/dist/cli-bundle/chunks/chunk-AEOHUSUI.js +2289 -0
- package/dist/cli-bundle/chunks/chunk-BSRIVYTM.js +8 -0
- package/dist/cli-bundle/chunks/chunk-CFWLQFJM.js +71 -0
- package/dist/cli-bundle/chunks/chunk-D6PDUKUG.js +9 -0
- package/dist/cli-bundle/chunks/chunk-ENKXRSFZ.js +31 -0
- package/dist/cli-bundle/chunks/chunk-F2Z6XLZB.js +3 -0
- package/dist/cli-bundle/chunks/chunk-FJOEL75F.js +2 -0
- package/dist/cli-bundle/chunks/chunk-GDXCAC52.js +2 -0
- package/dist/cli-bundle/chunks/chunk-H7JEXRIN.js +6 -0
- package/dist/cli-bundle/chunks/chunk-J2PDAVBC.js +2 -0
- package/dist/cli-bundle/chunks/chunk-KE7HMBEW.js +2 -0
- package/dist/cli-bundle/chunks/chunk-KZHIBEJL.js +33 -0
- package/dist/cli-bundle/chunks/chunk-NGJ5ERBF.js +115 -0
- package/dist/cli-bundle/chunks/chunk-NQ54T7T2.js +2 -0
- package/dist/cli-bundle/chunks/chunk-O7JHS64G.js +3 -0
- package/dist/cli-bundle/chunks/chunk-OKEZF7HU.js +2 -0
- package/dist/cli-bundle/chunks/chunk-OKIKF4FD.js +2 -0
- package/dist/cli-bundle/chunks/chunk-OPJF254V.js +9 -0
- package/dist/cli-bundle/chunks/chunk-PZA7QECY.js +1 -0
- package/dist/cli-bundle/chunks/chunk-RWA5YZ5X.js +2 -0
- package/dist/cli-bundle/chunks/chunk-S32NGRQM.js +2 -0
- package/dist/cli-bundle/chunks/chunk-SLFRSZK6.js +1 -0
- package/dist/cli-bundle/chunks/chunk-TZY5MVJF.js +125 -0
- package/dist/cli-bundle/chunks/chunk-YYT3MIRF.js +3 -0
- package/dist/cli-bundle/chunks/chunk-ZPS4B6SI.js +8 -0
- package/dist/cli-bundle/chunks/context-budget-recovery-M5RFUEFG.js +2 -0
- package/dist/cli-bundle/chunks/indexed-receipt-blobs-BPYKN5Q7.js +4 -0
- package/dist/cli-bundle/chunks/{item-revision-R5SZPJZ5.js → item-revision-FMD4KWBB.js} +2 -2
- package/dist/cli-bundle/chunks/item-transaction-SEHTH7N2.js +2 -0
- package/dist/cli-bundle/chunks/mutation-actor-SFGYIRPW.js +2 -0
- package/dist/cli-bundle/chunks/mutation-admission-57LBSKQI.js +2 -0
- package/dist/cli-bundle/chunks/{register-list-query-SPGPS3OS.js → register-list-query-L4IBU64P.js} +11 -11
- package/dist/cli-bundle/chunks/register-mutation-6NUOPHZ3.js +21 -0
- package/dist/cli-bundle/chunks/register-operations-JGYVORNN.js +2 -0
- package/dist/cli-bundle/chunks/register-setup-C44SIXEH.js +2 -0
- package/dist/cli-bundle/chunks/settlement-hook-6MR32OOC.js +7 -0
- package/dist/cli-bundle/chunks/stage-PQ7AB63N.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-6LKTEKHS.js +6 -0
- package/dist/cli-bundle/focused-chunks/chunk-6LPXMFLM.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-A6VEMCRR.js +3 -0
- package/dist/cli-bundle/focused-chunks/chunk-AIDL2ZNT.js +3 -0
- package/dist/cli-bundle/focused-chunks/chunk-BKPUUW5O.js +1 -0
- package/dist/cli-bundle/focused-chunks/chunk-BWOVFE5B.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-HMDQDRV2.js +8 -0
- package/dist/cli-bundle/focused-chunks/chunk-I66IKYKP.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-IIP6LZ5E.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-IR2J3NOT.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-IROZDIDX.js +3 -0
- package/dist/cli-bundle/focused-chunks/chunk-ITKDHSBR.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-K53OIT5J.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-LQYYPXUK.js +26 -0
- package/dist/cli-bundle/focused-chunks/chunk-NQTEE66P.js +13 -0
- package/dist/cli-bundle/focused-chunks/chunk-O7Z73ALG.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-OTMMOKPM.js +91 -0
- package/dist/cli-bundle/focused-chunks/chunk-OXOCZJC6.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-QLAHEDT6.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-QQIIMMFU.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-RIE3SJSE.js +9 -0
- package/dist/cli-bundle/focused-chunks/chunk-TD544C74.js +8 -0
- package/dist/cli-bundle/focused-chunks/chunk-UFTUNBMY.js +27 -0
- package/dist/cli-bundle/focused-chunks/chunk-X6CXWWNB.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-XRS3VNC6.js +44 -0
- package/dist/cli-bundle/focused-chunks/chunk-XYPEZGTR.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-Y2ESLKCF.js +8 -0
- package/dist/cli-bundle/focused-chunks/chunk-YSJKQLFR.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-Z2X7HH3C.js +102 -0
- package/dist/cli-bundle/focused-chunks/chunk-ZHWPCVQL.js +78 -0
- package/dist/cli-bundle/focused-chunks/context-budget-recovery-CSJV3TY3.js +2 -0
- package/dist/cli-bundle/focused-chunks/indexed-receipt-blobs-EGEJMG3G.js +4 -0
- package/dist/cli-bundle/focused-chunks/{item-revision-3V3UIP5X.js → item-revision-YDACCDVY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/item-transaction-UKEQCTKB.js +2 -0
- package/dist/cli-bundle/focused-chunks/mutation-actor-AS465LRX.js +2 -0
- package/dist/cli-bundle/focused-chunks/mutation-admission-E5UHJZFE.js +2 -0
- package/dist/cli-bundle/focused-chunks/settlement-hook-FMLGKG7J.js +7 -0
- package/dist/cli-bundle/focused-chunks/stage-36J7YLGI.js +2 -0
- package/dist/cli-bundle/main.js +27 -27
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +5 -5
- package/dist/cli-bundle/sdk-core.js +1 -1
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +72 -60
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +13 -13
- package/dist/cli.js +1 -1
- package/dist/core/checkpoint/checkpoint-gc.js +1 -1
- package/dist/core/checkpoint/mutation-checkpoint.js +2 -2
- package/dist/core/checkpoint/mutation-context.js +1 -1
- package/dist/core/config/nested-settings.js +1 -1
- package/dist/core/config/positional-value.js +1 -1
- package/dist/core/diagnostics/remediation.js +1 -1
- package/dist/core/extensions/activation-summary-markdown.js +2 -2
- package/dist/core/extensions/activation-summary.js +1 -1
- package/dist/core/extensions/activation-transaction.js +1 -1
- package/dist/core/extensions/capability-usage.js +1 -1
- package/dist/core/extensions/command-hook-context.js +1 -1
- package/dist/core/extensions/command-metadata-contract.js +1 -1
- package/dist/core/extensions/command-visibility-tier.js +1 -1
- package/dist/core/extensions/contribution-inventory.js +1 -1
- package/dist/core/extensions/exporter-output-contract.js +1 -1
- package/dist/core/extensions/extension-candidate.js +1 -1
- package/dist/core/extensions/extension-capability-aliases.js +1 -1
- package/dist/core/extensions/extension-hook-runtime.js +1 -1
- package/dist/core/extensions/extension-policy.js +1 -1
- package/dist/core/extensions/extension-registries.js +1 -1
- package/dist/core/extensions/extension-runtime-helpers.js +1 -1
- package/dist/core/extensions/extension-types.js +1 -1
- package/dist/core/extensions/flag-definition-validation.js +1 -1
- package/dist/core/extensions/flag-value-types.js +1 -1
- package/dist/core/extensions/index.js +1 -1
- package/dist/core/extensions/item-field-types.js +1 -1
- package/dist/core/extensions/item-fields.js +1 -1
- package/dist/core/extensions/loader.js +1 -1
- package/dist/core/extensions/manifest-parser.js +1 -1
- package/dist/core/extensions/manifest-schema.js +1 -1
- package/dist/core/extensions/module-graph-snapshot.js +1 -1
- package/dist/core/extensions/mutation-actor-snapshot.js +1 -1
- package/dist/core/extensions/mutation-actor.js +1 -1
- package/dist/core/extensions/preflight-ownership.js +1 -1
- package/dist/core/extensions/read-output-contract.js +1 -1
- package/dist/core/extensions/registration-contracts.js +1 -1
- package/dist/core/extensions/registration-validation.js +1 -1
- package/dist/core/extensions/registration-values.js +1 -1
- package/dist/core/extensions/reserved-host-flags.js +1 -1
- package/dist/core/extensions/runtime-registrations.js +1 -1
- package/dist/core/extensions/service-ownership.js +1 -1
- package/dist/core/extensions/version-compat.js +1 -1
- package/dist/core/extensions/version-diagnostics.js +1 -1
- package/dist/core/fs/atomic-create.js +1 -1
- package/dist/core/fs/file-glob.js +1 -1
- package/dist/core/fs/fs-utils.js +2 -2
- package/dist/core/fs/host-environment-errors.js +1 -1
- package/dist/core/fs/index.js +1 -1
- package/dist/core/fs/path-utils.js +1 -1
- package/dist/core/governance/content-fields.js +1 -1
- package/dist/core/governance/issue-codes.js +1 -1
- package/dist/core/governance/metadata-coverage.js +1 -1
- package/dist/core/history/bridge.js +2 -0
- package/dist/core/history/digest.js +1 -1
- package/dist/core/history/drift-cache.js +3 -3
- package/dist/core/history/drift-scan.js +1 -1
- package/dist/core/history/event-classification.js +1 -1
- package/dist/core/history/event-index.js +11 -11
- package/dist/core/history/history-compact-bulk.js +1 -1
- package/dist/core/history/history-diff.js +1 -1
- package/dist/core/history/history-rewrite.js +1 -1
- package/dist/core/history/history-storage-stats.js +1 -1
- package/dist/core/history/history-stream-policy.js +1 -1
- package/dist/core/history/history.d.ts +12 -0
- package/dist/core/history/history.js +2 -2
- package/dist/core/history/identity.js +1 -1
- package/dist/core/history/index.js +1 -1
- package/dist/core/history/operation-contract.js +1 -1
- package/dist/core/history/projection.js +1 -1
- package/dist/core/history/read.d.ts +9 -0
- package/dist/core/history/read.js +1 -1
- package/dist/core/history/replay.d.ts +46 -5
- package/dist/core/history/replay.js +2 -2
- package/dist/core/history/stream-summary.js +2 -2
- package/dist/core/history/tombstone.js +1 -1
- package/dist/core/history/version-address.js +1 -1
- package/dist/core/history/workspace-history.js +2 -2
- package/dist/core/io/body-file.js +1 -1
- package/dist/core/io/bulk-ids-input.js +2 -2
- package/dist/core/item/actionability.js +1 -1
- package/dist/core/item/deferred-fields.js +1 -1
- package/dist/core/item/dependency-reference.js +1 -1
- package/dist/core/item/id.js +1 -1
- package/dist/core/item/index.js +1 -1
- package/dist/core/item/item-format-version.js +1 -1
- package/dist/core/item/item-format.js +7 -7
- package/dist/core/item/item-record.js +1 -1
- package/dist/core/item/item-type-definition.js +1 -1
- package/dist/core/item/literal-mutation-input.js +1 -1
- package/dist/core/item/parent-reference-policy.js +1 -1
- package/dist/core/item/parse.js +8 -8
- package/dist/core/item/plan-lifecycle.js +1 -1
- package/dist/core/item/priority.js +1 -1
- package/dist/core/item/sprint-release-format.js +1 -1
- package/dist/core/item/status-filter.js +1 -1
- package/dist/core/item/status.js +1 -1
- package/dist/core/item/toon-decode.js +1 -1
- package/dist/core/item/type-registry.js +1 -1
- package/dist/core/item/type-synonyms.js +1 -1
- package/dist/core/lock/index.js +1 -1
- package/dist/core/lock/lock-confinement.js +1 -1
- package/dist/core/lock/lock-gc.js +1 -1
- package/dist/core/lock/lock-owner.js +1 -1
- package/dist/core/lock/lock.js +4 -4
- package/dist/core/output/linked-test-projection.js +5 -5
- package/dist/core/output/mutation-projection.js +1 -1
- package/dist/core/output/output-control.js +1 -1
- package/dist/core/output/output.js +19 -19
- package/dist/core/output/query-summary.js +1 -1
- package/dist/core/output/tabular.js +3 -3
- package/dist/core/packages/manifest.js +1 -1
- package/dist/core/packages/root.js +1 -1
- package/dist/core/policy/workflow-policy-schema.js +1 -1
- package/dist/core/policy/workflow-policy-store.js +1 -1
- package/dist/core/policy/workflow-policy.js +1 -1
- package/dist/core/profile/profile-describe.js +1 -1
- package/dist/core/profile/profile-lint.d.ts +1 -1
- package/dist/core/profile/profile-lint.js +1 -1
- package/dist/core/profile/profile-plan.js +1 -1
- package/dist/core/profile/profile-presets.js +4 -4
- package/dist/core/reproducibility/context.js +1 -1
- package/dist/core/schema/fields-file.js +2 -2
- package/dist/core/schema/item-types-file.js +2 -2
- package/dist/core/schema/runtime-field-filters.js +1 -1
- package/dist/core/schema/runtime-field-values.js +1 -1
- package/dist/core/schema/runtime-schema.js +2 -2
- package/dist/core/schema/status-defs-file.js +2 -2
- package/dist/core/schema/status-token.js +1 -1
- package/dist/core/schema/type-inference.js +1 -1
- package/dist/core/schema/type-presets.js +1 -1
- package/dist/core/schema/type-workflows.js +1 -1
- package/dist/core/search/background-refresh.js +2 -2
- package/dist/core/search/bm25.js +1 -1
- package/dist/core/search/cache.js +2 -2
- package/dist/core/search/corpus.js +1 -1
- package/dist/core/search/embedding-batches.js +1 -1
- package/dist/core/search/eval-thresholds.js +1 -1
- package/dist/core/search/eval.js +1 -1
- package/dist/core/search/http-client.js +1 -1
- package/dist/core/search/providers.js +1 -1
- package/dist/core/search/relevance.js +1 -1
- package/dist/core/search/semantic-defaults.js +1 -1
- package/dist/core/search/staleness.js +1 -1
- package/dist/core/search/vector-stores.js +2 -2
- package/dist/core/search/vectorization-metadata.js +1 -1
- package/dist/core/sentry/helpers.js +1 -1
- package/dist/core/sentry/instrument.js +1 -1
- package/dist/core/sentry/sensitive-assignments.js +1 -1
- package/dist/core/session/session-state.js +1 -1
- package/dist/core/shared/agent-session-context.js +1 -1
- package/dist/core/shared/author.js +5 -5
- package/dist/core/shared/command-line.js +1 -1
- package/dist/core/shared/command-types.js +0 -1
- package/dist/core/shared/conflict-markers.js +1 -1
- package/dist/core/shared/constants.js +1 -1
- package/dist/core/shared/error-details.js +1 -1
- package/dist/core/shared/errors.js +1 -1
- package/dist/core/shared/html-entity-decode.js +1 -1
- package/dist/core/shared/index.js +1 -1
- package/dist/core/shared/item-metadata-contract.js +1 -1
- package/dist/core/shared/lazy-module.js +1 -1
- package/dist/core/shared/levenshtein.js +1 -1
- package/dist/core/shared/memo.js +1 -1
- package/dist/core/shared/numeric-parsers.js +1 -1
- package/dist/core/shared/option-alias-visibility.js +1 -1
- package/dist/core/shared/output-unicode.js +1 -1
- package/dist/core/shared/primitives.js +1 -1
- package/dist/core/shared/process-tree.js +2 -2
- package/dist/core/shared/secret-rules.js +5 -5
- package/dist/core/shared/serial-queue.js +1 -1
- package/dist/core/shared/serialization.js +1 -1
- package/dist/core/shared/split-comma-list.js +1 -1
- package/dist/core/shared/text-normalization.js +1 -1
- package/dist/core/shared/time.js +2 -2
- package/dist/core/shared/url-credentials.js +1 -1
- package/dist/core/store/index.js +1 -1
- package/dist/core/store/item-format-migration.js +1 -1
- package/dist/core/store/item-metadata-cache.js +1 -1
- package/dist/core/store/item-metadata-query-index.js +11 -11
- package/dist/core/store/item-metadata-read-work.js +1 -1
- package/dist/core/store/item-mutation-precondition.js +1 -1
- package/dist/core/store/item-store.js +1 -1
- package/dist/core/store/paths.js +1 -1
- package/dist/core/store/settings-concurrency.js +1 -1
- package/dist/core/store/settings-read-cache.js +1 -1
- package/dist/core/store/settings-sections.js +2 -2
- package/dist/core/store/settings-validator.js +1 -1
- package/dist/core/store/settings.d.ts +3 -1
- package/dist/core/store/settings.js +6 -6
- package/dist/core/store/sqlite-runtime.js +1 -1
- package/dist/core/store/tracker-preflight.js +1 -1
- package/dist/core/store/transaction-coordinator-scope.js +1 -1
- package/dist/core/telemetry/consent.js +3 -3
- package/dist/core/telemetry/observability.js +1 -1
- package/dist/core/telemetry/policy.js +1 -1
- package/dist/core/telemetry/read-sampling.js +2 -2
- package/dist/core/telemetry/runtime.js +9 -9
- package/dist/core/test/background-runs.js +4 -4
- package/dist/core/test/item-test-run-tracking.js +1 -1
- package/dist/core/test/run-selectors.js +1 -1
- package/dist/core/validate/estimate-defaults.js +1 -1
- package/dist/core/validate/fix-planning.js +1 -1
- package/dist/core/validate/linked-artifact-reference.js +1 -1
- package/dist/core/validate/missing-by-type.js +1 -1
- package/dist/core/validate/missing-link-owners.js +1 -1
- package/dist/core/validate/stale-file-classification.js +1 -1
- package/dist/mcp/http-server.js +5 -5
- package/dist/mcp/legacy-adapter.js +1 -1
- package/dist/mcp/runtime-capabilities.js +1 -1
- package/dist/mcp/server.js +4 -4
- package/dist/mcp/tool-definitions.js +1 -1
- package/dist/sdk/actionability.js +1 -1
- package/dist/sdk/agent/closed-domain-contracts.js +1 -1
- package/dist/sdk/agent/command-recovery.js +1 -1
- package/dist/sdk/agent/command-suggestions.js +1 -1
- package/dist/sdk/agent/create-option-policy.js +1 -1
- package/dist/sdk/agent/identity-config.js +1 -1
- package/dist/sdk/agent/item-addressing.js +1 -1
- package/dist/sdk/agent/linked-resource-recovery.js +1 -1
- package/dist/sdk/agent/refusal-closure-census.js +2 -2
- package/dist/sdk/agent/refusal-corpus-contracts.js +1 -1
- package/dist/sdk/agent/subcommand-recovery.js +1 -1
- package/dist/sdk/agent-capability-contracts.js +3 -3
- package/dist/sdk/agent-session-context.js +1 -1
- package/dist/sdk/annotations.js +1 -1
- package/dist/sdk/author-attribution.js +1 -1
- package/dist/sdk/cli-bootstrap.js +1 -1
- package/dist/sdk/cli-contracts/agent-output-contracts.js +5 -5
- package/dist/sdk/cli-contracts/bootstrap-command-scanner.js +1 -1
- package/dist/sdk/cli-contracts/command-aliases.js +1 -1
- package/dist/sdk/cli-contracts/command-exit-contracts.js +1 -1
- package/dist/sdk/cli-contracts/commander-mutation-options.js +1 -1
- package/dist/sdk/cli-contracts/commander-types.js +1 -1
- package/dist/sdk/cli-contracts/completeness.js +1 -1
- package/dist/sdk/cli-contracts/enum-contracts.js +1 -1
- package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +2 -2
- package/dist/sdk/cli-contracts/grammar-contracts.js +1 -1
- package/dist/sdk/cli-contracts/registration-helpers.js +7 -7
- package/dist/sdk/cli-contracts/runtime-contracts.js +1 -1
- package/dist/sdk/cli-contracts/schemas/assurance-definition.js +1 -1
- package/dist/sdk/cli-contracts/string-lists.js +1 -1
- package/dist/sdk/cli-contracts/tool-option-contracts.js +1 -1
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
- package/dist/sdk/cli-contracts/tool-schema.js +1 -1
- package/dist/sdk/cli-contracts/typed-action-inputs.d.ts +2 -2
- package/dist/sdk/cli-contracts/typed-action-inputs.js +0 -1
- package/dist/sdk/cli-contracts.js +1 -1
- package/dist/sdk/cli-program.js +1 -1
- package/dist/sdk/command-line.js +1 -1
- package/dist/sdk/comments.js +1 -1
- package/dist/sdk/compile-cache.js +1 -1
- package/dist/sdk/completion/bash.js +2 -2
- package/dist/sdk/completion/fish.js +74 -73
- package/dist/sdk/completion/shared.js +1 -1
- package/dist/sdk/completion/zsh.js +77 -76
- package/dist/sdk/completion.js +1 -1
- package/dist/sdk/config.js +1 -1
- package/dist/sdk/context/recency.js +1 -1
- package/dist/sdk/context/semantic-session-attribution.js +1 -1
- package/dist/sdk/context/usage-egress.js +1 -1
- package/dist/sdk/context/usage-ledger.js +6 -6
- package/dist/sdk/context-intent-contracts.js +1 -1
- package/dist/sdk/context-intent-runtime.js +1 -1
- package/dist/sdk/context-packing.js +1 -1
- package/dist/sdk/context-relevance.js +1 -1
- package/dist/sdk/context-signal-store.js +2 -2
- package/dist/sdk/context-usage.js +1 -1
- package/dist/sdk/dependencies/context-budget-recovery.js +1 -1
- package/dist/sdk/dependencies.js +1 -1
- package/dist/sdk/dependency-flag-validation.js +1 -1
- package/dist/sdk/dependency-provenance.js +1 -1
- package/dist/sdk/docs.js +1 -1
- package/dist/sdk/duplicates.js +1 -1
- package/dist/sdk/environment/host-environment-errors.js +1 -1
- package/dist/sdk/environment/project-runtime-compatibility.js +2 -2
- package/dist/sdk/environment/source-context.js +1 -1
- package/dist/sdk/environment/tracker-preflight.js +1 -1
- package/dist/sdk/error-code-catalog.js +1 -1
- package/dist/sdk/error-runtime.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/eval.js +1 -1
- package/dist/sdk/extension/author-manifest.js +1 -1
- package/dist/sdk/extension/bundled-catalog.js +1 -1
- package/dist/sdk/extension/command-options.js +1 -1
- package/dist/sdk/extension/concurrency.js +1 -1
- package/dist/sdk/extension/copy-scope.js +1 -1
- package/dist/sdk/extension/custom-field-collisions.js +1 -1
- package/dist/sdk/extension/describe.js +3 -3
- package/dist/sdk/extension/doctor.js +1 -1
- package/dist/sdk/extension/install-plan.js +1 -1
- package/dist/sdk/extension/install-receipts.js +1 -1
- package/dist/sdk/extension/install-runtime.js +3 -3
- package/dist/sdk/extension/install-snapshot.js +1 -1
- package/dist/sdk/extension/install-sources.js +5 -5
- package/dist/sdk/extension/managed-state.js +2 -2
- package/dist/sdk/extension/managed-update-status.js +1 -1
- package/dist/sdk/extension/migrations.js +2 -2
- package/dist/sdk/extension/native-command-options.js +1 -1
- package/dist/sdk/extension/output-ownership.js +1 -1
- package/dist/sdk/extension/runtime-summary.js +1 -1
- package/dist/sdk/extension/scaffold.js +11 -11
- package/dist/sdk/extension/shared.js +1 -1
- package/dist/sdk/extension/source-resolution.js +1 -1
- package/dist/sdk/extension/static-inventory.js +1 -1
- package/dist/sdk/extension/update-check.js +1 -1
- package/dist/sdk/extension-command-context.js +2 -2
- package/dist/sdk/extension-contracts.js +1 -1
- package/dist/sdk/extension.js +1 -1
- package/dist/sdk/files.js +1 -1
- package/dist/sdk/flag-invocation-contracts.js +1 -1
- package/dist/sdk/generated/error-code-catalog-rows.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
- package/dist/sdk/generated-error-code-catalog.js +1 -1
- package/dist/sdk/governance/assurance-action-contracts.js +0 -1
- package/dist/sdk/governance/assurance-action.js +1 -1
- package/dist/sdk/governance/assurance-limits.js +1 -1
- package/dist/sdk/governance/assurance-mutation-error.js +1 -1
- package/dist/sdk/governance/assurance-presets.js +1 -1
- package/dist/sdk/governance/assurance-runtime.js +1 -1
- package/dist/sdk/governance/assurance.js +4 -4
- package/dist/sdk/governance/boundary-fixtures.js +1 -1
- package/dist/sdk/governance/closure-timestamps.js +1 -1
- package/dist/sdk/governance/defect-recurrence-coverage.js +1 -1
- package/dist/sdk/governance/defect-recurrence-graph.js +1 -1
- package/dist/sdk/governance/defect-recurrence-signals.js +1 -1
- package/dist/sdk/governance/defect-recurrence.js +2 -2
- package/dist/sdk/governance/extension-host-version.js +1 -1
- package/dist/sdk/governance/gc.js +1 -1
- package/dist/sdk/governance/health/history-drift-remedies.js +2 -0
- package/dist/sdk/governance/health/projection.js +1 -1
- package/dist/sdk/governance/health-merge-evidence.js +1 -1
- package/dist/sdk/governance/health.js +2 -2
- package/dist/sdk/governance/hierarchy-validation.js +1 -1
- package/dist/sdk/governance/in-progress-work-health.js +1 -1
- package/dist/sdk/governance/lifecycle-dependency-cycles.js +1 -1
- package/dist/sdk/governance/linked-file-report.js +1 -1
- package/dist/sdk/governance/merge-receipt-history.js +1 -1
- package/dist/sdk/governance/provenance-health.js +4 -4
- package/dist/sdk/governance/reindex.js +5 -5
- package/dist/sdk/governance/stale-work.js +1 -1
- package/dist/sdk/governance/status-role-diagnostics.js +1 -1
- package/dist/sdk/governance/storage-integrity.js +1 -1
- package/dist/sdk/governance/tracked-runtime-cache.js +1 -1
- package/dist/sdk/governance/upgrade.js +2 -2
- package/dist/sdk/governance/validate-deferred-fields.js +1 -1
- package/dist/sdk/governance/validate-history-drift.js +1 -1
- package/dist/sdk/governance/validate-item-reader.js +1 -1
- package/dist/sdk/governance/validate-normalization.js +1 -1
- package/dist/sdk/governance/validate.js +1 -1
- package/dist/sdk/governance/workflow-completeness.js +1 -1
- package/dist/sdk/governance/workflow-policy.js +3 -3
- package/dist/sdk/governance/workspace-position.js +2 -2
- package/dist/sdk/graph/analytics.js +1 -1
- package/dist/sdk/graph/assembly.js +1 -1
- package/dist/sdk/graph/cache.js +1 -1
- package/dist/sdk/graph/cardinality-integrity.js +1 -1
- package/dist/sdk/graph/centrality.js +1 -1
- package/dist/sdk/graph/deadline-scheduling.js +1 -1
- package/dist/sdk/graph/durable-cache.js +1 -1
- package/dist/sdk/graph/governance-contracts.js +1 -1
- package/dist/sdk/graph/governance.js +1 -1
- package/dist/sdk/graph/hierarchy-integrity.js +1 -1
- package/dist/sdk/graph/lifecycle-coverage.js +1 -1
- package/dist/sdk/graph/mutation-advisory.js +1 -1
- package/dist/sdk/graph/query-contracts.js +1 -1
- package/dist/sdk/graph/remediation.js +1 -1
- package/dist/sdk/graph/run.js +1 -1
- package/dist/sdk/graph/scheduling.js +1 -1
- package/dist/sdk/graph/traversal.js +1 -1
- package/dist/sdk/graph/workspace-relationship-kind-registry.js +1 -1
- package/dist/sdk/guide-topics.js +1 -1
- package/dist/sdk/guide.js +7 -7
- package/dist/sdk/history/append-only-repair.d.ts +30 -0
- package/dist/sdk/history/append-only-repair.js +6 -0
- package/dist/sdk/history/attestation-command.js +2 -2
- package/dist/sdk/history/attestation-contract.js +1 -1
- package/dist/sdk/history/attestation-scan.js +1 -1
- package/dist/sdk/history/attestation.js +1 -1
- package/dist/sdk/history/maintenance.d.ts +8 -2
- package/dist/sdk/history/maintenance.js +1 -1
- package/dist/sdk/history/reanchor-refusal.js +2 -0
- package/dist/sdk/history/reseed.d.ts +15 -0
- package/dist/sdk/history/reseed.js +2 -0
- package/dist/sdk/history/salvage.d.ts +19 -8
- package/dist/sdk/history/salvage.js +5 -3
- package/dist/sdk/history/subject.js +1 -1
- package/dist/sdk/history-analytics.js +1 -1
- package/dist/sdk/history-compact.js +1 -1
- package/dist/sdk/history-mcp.js +1 -1
- package/dist/sdk/history-provenance.js +1 -1
- package/dist/sdk/history-read.js +1 -1
- package/dist/sdk/history-redact.js +1 -1
- package/dist/sdk/history-repair.d.ts +8 -2
- package/dist/sdk/history-repair.js +1 -1
- package/dist/sdk/improvement-ledger-validation.js +1 -1
- package/dist/sdk/improvement-ledger.js +2 -2
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/init-agent-guidance.js +10 -10
- package/dist/sdk/init.js +14 -14
- package/dist/sdk/invocation-author.js +1 -1
- package/dist/sdk/item-children.js +1 -1
- package/dist/sdk/item-metadata-index.js +1 -1
- package/dist/sdk/item-schedule.js +1 -1
- package/dist/sdk/item-transaction.d.ts +33 -1
- package/dist/sdk/item-transaction.js +1 -1
- package/dist/sdk/learnings.js +1 -1
- package/dist/sdk/lifecycle/append.js +3 -3
- package/dist/sdk/lifecycle/checkpoint-rollback.js +1 -1
- package/dist/sdk/lifecycle/claim.js +1 -1
- package/dist/sdk/lifecycle/cli-input.js +1 -1
- package/dist/sdk/lifecycle/close-many.js +1 -1
- package/dist/sdk/lifecycle/close.js +1 -1
- package/dist/sdk/lifecycle/copy.js +1 -1
- package/dist/sdk/lifecycle/core-field-recovery.js +1 -1
- package/dist/sdk/lifecycle/core-item-fields.js +1 -1
- package/dist/sdk/lifecycle/create-deferrals.js +1 -1
- package/dist/sdk/lifecycle/create.js +1 -1
- package/dist/sdk/lifecycle/delete.js +1 -1
- package/dist/sdk/lifecycle/dependency-removal.js +1 -1
- package/dist/sdk/lifecycle/event-validation-messages.js +1 -1
- package/dist/sdk/lifecycle/focus.js +1 -1
- package/dist/sdk/lifecycle/hierarchy-mutation-lock.js +1 -1
- package/dist/sdk/lifecycle/item-revision.js +1 -1
- package/dist/sdk/lifecycle/legacy-none-tokens.js +1 -1
- package/dist/sdk/lifecycle/lifecycle-transitions.js +1 -1
- package/dist/sdk/lifecycle/mcp-actions.js +1 -1
- package/dist/sdk/lifecycle/metadata-normalizers.js +1 -1
- package/dist/sdk/lifecycle/mutation-command-options.js +0 -1
- package/dist/sdk/lifecycle/mutation-facet-contracts.js +1 -1
- package/dist/sdk/lifecycle/mutation-option-validation.js +1 -1
- package/dist/sdk/lifecycle/plan-mutation-receipt.js +1 -1
- package/dist/sdk/lifecycle/plan.js +1 -1
- package/dist/sdk/lifecycle/recurrence-parsers.js +1 -1
- package/dist/sdk/lifecycle/release-handoff.js +1 -1
- package/dist/sdk/lifecycle/reopen.js +1 -1
- package/dist/sdk/lifecycle/repeatable-metadata-parsers.js +2 -2
- package/dist/sdk/lifecycle/repeated-terminal-state.js +1 -1
- package/dist/sdk/lifecycle/restore.js +1 -1
- package/dist/sdk/lifecycle/shared-unset-fields.js +1 -1
- package/dist/sdk/lifecycle/start-blockers.js +1 -1
- package/dist/sdk/lifecycle/structured-mutation-plan.js +1 -1
- package/dist/sdk/lifecycle/task-composition.js +1 -1
- package/dist/sdk/lifecycle/update-many.js +1 -1
- package/dist/sdk/lifecycle/update.js +2 -2
- package/dist/sdk/lifecycle/workflow-transition.js +1 -1
- package/dist/sdk/lifecycle-completion.js +1 -1
- package/dist/sdk/lifecycle-policy.js +1 -1
- package/dist/sdk/linked-artifacts.js +2 -2
- package/dist/sdk/mcp/apps.js +5 -5
- package/dist/sdk/mcp/authorization.js +1 -1
- package/dist/sdk/mcp/discovery.js +1 -1
- package/dist/sdk/mcp/executable.js +4 -4
- package/dist/sdk/mcp/interactions.js +1 -1
- package/dist/sdk/mcp/protocol.js +1 -1
- package/dist/sdk/mcp/skills.js +3 -3
- package/dist/sdk/mcp/subscriptions.js +1 -1
- package/dist/sdk/mcp/tasks.js +2 -2
- package/dist/sdk/mcp/transport.js +1 -1
- package/dist/sdk/merge/abandoned-receipts.js +1 -1
- package/dist/sdk/merge/driver.js +7 -7
- package/dist/sdk/merge/history-scalar-rebase.js +1 -1
- package/dist/sdk/merge/ignored-artifacts.js +1 -1
- package/dist/sdk/merge/index.js +1 -1
- package/dist/sdk/merge/indexed-receipt-blobs.js +2 -2
- package/dist/sdk/merge/install.js +6 -6
- package/dist/sdk/merge/receipt-file-boundary.js +1 -1
- package/dist/sdk/merge/receipt-operation.js +1 -1
- package/dist/sdk/merge/receipt-schema.js +1 -1
- package/dist/sdk/merge/receipts.js +4 -4
- package/dist/sdk/merge/reconcile.js +1 -1
- package/dist/sdk/merge/settlement-hook.js +4 -4
- package/dist/sdk/merge/stage.js +1 -1
- package/dist/sdk/merge/three-way.d.ts +22 -3
- package/dist/sdk/merge/three-way.js +9 -3
- package/dist/sdk/merge/worktree-config.js +2 -2
- package/dist/sdk/merge.js +1 -1
- package/dist/sdk/mutation-events.js +1 -1
- package/dist/sdk/mutation-guard.js +1 -1
- package/dist/sdk/notes.js +1 -1
- package/dist/sdk/output/fit-envelope.js +1 -1
- package/dist/sdk/output/list-envelope.js +1 -1
- package/dist/sdk/output/table-rows.js +1 -1
- package/dist/sdk/output-contracts.js +1 -1
- package/dist/sdk/output-projection.js +1 -1
- package/dist/sdk/output-token-accounting.js +1 -1
- package/dist/sdk/output.js +2 -2
- package/dist/sdk/ownership-source.js +1 -1
- package/dist/sdk/package-import-adapters.js +1 -1
- package/dist/sdk/package-migrations.js +1 -1
- package/dist/sdk/package-runtime-options.js +1 -1
- package/dist/sdk/pagination.js +1 -1
- package/dist/sdk/profile.js +5 -5
- package/dist/sdk/provenance.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query/activity.js +1 -1
- package/dist/sdk/query/aggregate.js +1 -1
- package/dist/sdk/query/calendar.js +4 -4
- package/dist/sdk/query/complete-list.js +1 -1
- package/dist/sdk/query/context.js +2 -2
- package/dist/sdk/query/declared-blockers.js +1 -1
- package/dist/sdk/query/duplicate-candidates.js +1 -1
- package/dist/sdk/query/get-facet-roots.js +1 -1
- package/dist/sdk/query/get.js +1 -1
- package/dist/sdk/query/history.js +1 -1
- package/dist/sdk/query/item-filter-options.js +0 -1
- package/dist/sdk/query/light-metadata.js +1 -1
- package/dist/sdk/query/list-filter-shared.js +1 -1
- package/dist/sdk/query/list.js +1 -1
- package/dist/sdk/query/multi-value-filters.js +1 -1
- package/dist/sdk/query/next-ranking-policy.js +1 -1
- package/dist/sdk/query/next-ready-budget.js +1 -1
- package/dist/sdk/query/next.js +2 -2
- package/dist/sdk/query/parsers.js +1 -1
- package/dist/sdk/query/projection-contracts.js +1 -1
- package/dist/sdk/query/search/corpus.js +2 -2
- package/dist/sdk/query/search/filters.js +1 -1
- package/dist/sdk/query/search/input.js +1 -1
- package/dist/sdk/query/search/lexical.js +1 -1
- package/dist/sdk/query/search/response.js +1 -1
- package/dist/sdk/query/search/semantic.js +3 -3
- package/dist/sdk/query/search/types.js +0 -1
- package/dist/sdk/query/search-contracts.js +1 -1
- package/dist/sdk/query/search-pagination.js +1 -1
- package/dist/sdk/query/search-rendering.js +1 -1
- package/dist/sdk/query/search.js +1 -1
- package/dist/sdk/query/window-pagination.js +1 -1
- package/dist/sdk/query/workspace-contracts.js +1 -1
- package/dist/sdk/read-output/continuation.js +1 -1
- package/dist/sdk/read-output/extension.js +1 -1
- package/dist/sdk/read-output/options.js +1 -1
- package/dist/sdk/read-output/positional-rows.js +1 -1
- package/dist/sdk/read-output/provenance.js +1 -1
- package/dist/sdk/read-output/session-result.js +0 -1
- package/dist/sdk/read-output/surfaces.js +1 -1
- package/dist/sdk/read-output/tail-retention.js +1 -1
- package/dist/sdk/read-output-budget.js +1 -1
- package/dist/sdk/read-output-contracts.js +1 -1
- package/dist/sdk/read-output-rows.js +1 -1
- package/dist/sdk/read-output-session.js +1 -1
- package/dist/sdk/relationship-analytics.js +1 -1
- package/dist/sdk/relationship-context.js +1 -1
- package/dist/sdk/relationship-history.js +6 -6
- package/dist/sdk/relationship-kinds/contract.js +1 -1
- package/dist/sdk/relationships.js +1 -1
- package/dist/sdk/reproducibility/process.js +1 -1
- package/dist/sdk/runtime/actions.js +1 -1
- package/dist/sdk/runtime/context.js +1 -1
- package/dist/sdk/runtime/mutation-admission.js +1 -1
- package/dist/sdk/runtime/mutation-value-validation.js +1 -1
- package/dist/sdk/runtime/schema-preview.js +1 -1
- package/dist/sdk/runtime/schema.js +1 -1
- package/dist/sdk/runtime-action-aliases.js +1 -1
- package/dist/sdk/runtime-extended-actions.js +1 -1
- package/dist/sdk/runtime-input.d.ts +8 -2
- package/dist/sdk/runtime-input.js +1 -1
- package/dist/sdk/runtime-primitives.d.ts +1 -1
- package/dist/sdk/runtime-primitives.js +1 -1
- package/dist/sdk/runtime-public-contracts.js +0 -1
- package/dist/sdk/runtime-stats-options.js +1 -1
- package/dist/sdk/runtime.d.ts +9 -0
- package/dist/sdk/runtime.js +1 -1
- package/dist/sdk/scheduling-shortcuts.js +1 -1
- package/dist/sdk/schema/field-option-collisions.js +2 -0
- package/dist/sdk/schema-migration.js +4 -4
- package/dist/sdk/schema.js +7 -7
- package/dist/sdk/search-refresh-worker.js +1 -1
- package/dist/sdk/similarity-scoring.js +1 -1
- package/dist/sdk/similarity.js +1 -1
- package/dist/sdk/start-task-status.js +1 -1
- package/dist/sdk/stats.js +1 -1
- package/dist/sdk/structured-mutations.d.ts +5 -5
- package/dist/sdk/structured-mutations.js +1 -1
- package/dist/sdk/telemetry-flush.js +1 -1
- package/dist/sdk/telemetry.js +4 -4
- package/dist/sdk/templates.js +3 -3
- package/dist/sdk/test/batch.js +2 -2
- package/dist/sdk/test/command-args.js +1 -1
- package/dist/sdk/test/command-resolution.js +2 -2
- package/dist/sdk/test/entry.js +2 -2
- package/dist/sdk/test/execution-receipts.js +2 -2
- package/dist/sdk/test/execution.js +5 -5
- package/dist/sdk/test/json-path.js +1 -1
- package/dist/sdk/test/linked-command-detection.js +1 -1
- package/dist/sdk/test/measurements.js +1 -1
- package/dist/sdk/test/parsers.js +1 -1
- package/dist/sdk/test/prerequisites.js +1 -1
- package/dist/sdk/test/receipt-index-snapshot.js +1 -1
- package/dist/sdk/test/run-phases.js +1 -1
- package/dist/sdk/test/runs.js +1 -1
- package/dist/sdk/test/trust.js +2 -2
- package/dist/sdk/test/update.js +1 -1
- package/dist/sdk/test/workspace-snapshot.js +1 -1
- package/dist/sdk/traceability/runtime-files-lookup.js +1 -1
- package/dist/sdk/traceability/source-traceability.js +2 -2
- package/dist/sdk/tracker-root-discovery.js +1 -1
- package/dist/sdk/transactions/item-finalization.js +2 -0
- package/dist/sdk/workspace-contracts-cache.js +1 -1
- package/dist/sdk/workspace-contracts.js +1 -1
- package/dist/sdk/workspace-memory.js +2 -2
- package/dist/sdk/workspace-snapshot.js +5 -5
- package/dist/sdk/workspace-transaction-gc.js +1 -1
- package/dist/sdk/workspace-transaction.js +2 -2
- package/dist/sdk/workspace.js +6 -6
- package/dist/types/index.js +1 -1
- package/dist/types.d.ts +20 -0
- package/dist/types.js +1 -1
- package/docs/AGENT_GUIDE.md +1 -1
- package/docs/AGENT_RUNTIME_PRIMITIVES.md +1 -1
- package/docs/COMMANDS.md +7 -3
- package/docs/EXTENSIONS.md +1 -1
- package/docs/HISTORY_RECOVERY.md +229 -5
- package/docs/README.md +2 -2
- package/docs/SDK.md +174 -5
- package/docs/SDK_CONTEXT_COORDINATION.md +3 -2
- package/marketplace.json +1 -1
- package/node_modules/tar/package.json +2 -3
- package/package.json +31 -2
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/package.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +1 -1
- package/plugins/pm-codex/plugin.json +1 -1
- package/runtime-dependencies.json +1 -1
- package/scripts/finalize-build.mjs +63 -24
- package/scripts/prepare-build-cache.mjs +28 -1
- package/dist/cli-bundle/chunks/chunk-2DXRTIC6.js +0 -21
- package/dist/cli-bundle/chunks/chunk-5647LU3A.js +0 -2287
- package/dist/cli-bundle/chunks/chunk-6QLEXRUG.js +0 -9
- package/dist/cli-bundle/chunks/chunk-AHQB7W2H.js +0 -3
- package/dist/cli-bundle/chunks/chunk-BKSVHOWI.js +0 -2
- package/dist/cli-bundle/chunks/chunk-CASX6SFI.js +0 -2
- package/dist/cli-bundle/chunks/chunk-CIKGG34F.js +0 -2
- package/dist/cli-bundle/chunks/chunk-D6ILFXZY.js +0 -2
- package/dist/cli-bundle/chunks/chunk-DEZPZOQ7.js +0 -2
- package/dist/cli-bundle/chunks/chunk-IB7UB5TE.js +0 -2
- package/dist/cli-bundle/chunks/chunk-IUIOTAF6.js +0 -9
- package/dist/cli-bundle/chunks/chunk-JVGRFU5H.js +0 -3
- package/dist/cli-bundle/chunks/chunk-KQIZ34SF.js +0 -3
- package/dist/cli-bundle/chunks/chunk-KVBIMFUG.js +0 -6
- package/dist/cli-bundle/chunks/chunk-LQBWLNZJ.js +0 -3
- package/dist/cli-bundle/chunks/chunk-NCFCBKIP.js +0 -2
- package/dist/cli-bundle/chunks/chunk-NT5AKFE5.js +0 -31
- package/dist/cli-bundle/chunks/chunk-PJXKA4QU.js +0 -125
- package/dist/cli-bundle/chunks/chunk-RMIRNYRG.js +0 -71
- package/dist/cli-bundle/chunks/chunk-RULHZRFN.js +0 -2
- package/dist/cli-bundle/chunks/chunk-S6HB3WL2.js +0 -2
- package/dist/cli-bundle/chunks/chunk-SA4BNP3Q.js +0 -2
- package/dist/cli-bundle/chunks/chunk-SPPHDVZE.js +0 -2
- package/dist/cli-bundle/chunks/chunk-SRVTCYAU.js +0 -2
- package/dist/cli-bundle/chunks/chunk-WELSVDPU.js +0 -2
- package/dist/cli-bundle/chunks/chunk-XHJ3H5PL.js +0 -3
- package/dist/cli-bundle/chunks/chunk-XWHJIRNV.js +0 -8
- package/dist/cli-bundle/chunks/chunk-YJEBK7HU.js +0 -8
- package/dist/cli-bundle/chunks/chunk-YKJKQ7DM.js +0 -115
- package/dist/cli-bundle/chunks/chunk-YMUSRWV4.js +0 -9
- package/dist/cli-bundle/chunks/chunk-YR2KEBHP.js +0 -2
- package/dist/cli-bundle/chunks/context-budget-recovery-L2WP5S26.js +0 -2
- package/dist/cli-bundle/chunks/indexed-receipt-blobs-ITTXIN4K.js +0 -4
- package/dist/cli-bundle/chunks/item-transaction-7DFCG73I.js +0 -2
- package/dist/cli-bundle/chunks/mutation-actor-3TG636XG.js +0 -2
- package/dist/cli-bundle/chunks/mutation-admission-LICSDNNO.js +0 -2
- package/dist/cli-bundle/chunks/register-mutation-WWVECKFQ.js +0 -21
- package/dist/cli-bundle/chunks/register-operations-L6HFJNWD.js +0 -2
- package/dist/cli-bundle/chunks/register-setup-K7UFG5TD.js +0 -2
- package/dist/cli-bundle/chunks/settlement-hook-BXN5LEQD.js +0 -7
- package/dist/cli-bundle/chunks/stage-57KH3KAC.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-3IRCYJI5.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-3V53UBHN.js +0 -9
- package/dist/cli-bundle/focused-chunks/chunk-532WZV65.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-7A4QWNZX.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-C3O6JJPO.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-CR7CGEB2.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-CU2BRAOX.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-CWWKRI5P.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-EGN2HFRU.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-GHQVM6K6.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-HGFNL5XI.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-I5LGPUWH.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-IQK5NPMG.js +0 -13
- package/dist/cli-bundle/focused-chunks/chunk-J63D6QST.js +0 -6
- package/dist/cli-bundle/focused-chunks/chunk-JMQJBZQ5.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-LNHUE4VV.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-MKM5NKD7.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-NP72ZDXE.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-OSLQD5VH.js +0 -102
- package/dist/cli-bundle/focused-chunks/chunk-QGKLRXP7.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-QSJW6NSQ.js +0 -66
- package/dist/cli-bundle/focused-chunks/chunk-RPE6IX26.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-SRDQSA6M.js +0 -91
- package/dist/cli-bundle/focused-chunks/chunk-SVOOGGAK.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-UOC6257J.js +0 -26
- package/dist/cli-bundle/focused-chunks/chunk-URJ2E6AS.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-WXMI4AV5.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-XCJSHNXK.js +0 -27
- package/dist/cli-bundle/focused-chunks/chunk-XQQSSKJI.js +0 -44
- package/dist/cli-bundle/focused-chunks/chunk-YOAYY3HE.js +0 -2
- package/dist/cli-bundle/focused-chunks/context-budget-recovery-5MKOCGY5.js +0 -2
- package/dist/cli-bundle/focused-chunks/indexed-receipt-blobs-AF4U3F3D.js +0 -4
- package/dist/cli-bundle/focused-chunks/item-transaction-HLBW7B3J.js +0 -2
- package/dist/cli-bundle/focused-chunks/mutation-actor-62HKR5IO.js +0 -2
- package/dist/cli-bundle/focused-chunks/mutation-admission-X4PF2SG3.js +0 -2
- package/dist/cli-bundle/focused-chunks/settlement-hook-ARYCZQY4.js +0 -7
- package/dist/cli-bundle/focused-chunks/stage-O7T7CXBB.js +0 -2
- package/dist/sdk/agent/refusal-closure.js +0 -2
- package/dist/sdk/agent/refusal-reachability.js +0 -4
- package/dist/sdk/agent/task-transcript-contracts.js +0 -2
- package/dist/sdk/agent/tracker-preflight-contracts.js +0 -2
- package/dist/sdk/authoring.js +0 -2
- package/dist/sdk/compose.js +0 -2
- package/dist/sdk/contracts.js +0 -2
- package/dist/sdk/core-governance.js +0 -2
- package/dist/sdk/core.js +0 -2
- package/dist/sdk/corpus-shape.js +0 -2
- package/dist/sdk/define.js +0 -2
- package/dist/sdk/environment/agent-environment.js +0 -2
- package/dist/sdk/governance/artifact-ledgers.js +0 -2
- package/dist/sdk/governance/coverage-assurance.js +0 -2
- package/dist/sdk/governance/reliability.js +0 -2
- package/dist/sdk/governance.js +0 -2
- package/dist/sdk/graph/adapter.js +0 -2
- package/dist/sdk/graph/conformance.js +0 -2
- package/dist/sdk/graph/index.js +0 -2
- package/dist/sdk/graph.js +0 -2
- package/dist/sdk/index.js +0 -2
- package/dist/sdk/query.js +0 -2
- package/dist/sdk/relationship-migration.js +0 -2
- package/dist/sdk/testing.js +0 -8
- package/dist/sdk/workspace-recipe.js +0 -2
- package/docs/AGENT_PROVENANCE_ADR.md +0 -206
- package/docs/DEFECT_RECURRENCE.md +0 -257
- package/docs/PERFORMANCE.md +0 -204
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import{TYPE_PRESET_DEFINITIONS as l}from"../schema/type-presets.js";const r=["agile","ops","research"],p={agile:{name:"agile",title:"Agile delivery",summary:"Story/Spike delivery with a review stage, story points, and acceptance ownership.",types:l.agile,statuses:[{id:"review",roles:["active"],aliases:["in-review"],description:"Work is implementation-complete and awaiting peer review."}],fields:[{key:"story_points",type:"number",commands:["create","update","list"],description:"Relative estimation size for a story or spike.",aliases:["points"]},{key:"acceptance_owner",type:"string",commands:["create","update","list"],description:"Stakeholder accountable for accepting the delivered story.",aliases:["acceptor"]}],workflows:[{type:"Story",allowed_transitions:[["open","in_progress"],["in_progress","review"],["review","in_progress"],["review","closed"],["in_progress","blocked"],["blocked","in_progress"]]}],config:[{key:"search_provider",value:"bm25",summary:"Offline BM25 lexical search works without an embedding service."},{key:"search_max_results",value:"20",summary:"Sprint-sized result cap for quick triage."}],templates:[{name:"story",options:{type:"Story",priority:"2",tags:"story",acceptanceCriteria:"Story delivers the stated user outcome with tests and docs updated.",body:`## As a
|
|
2
2
|
|
|
3
3
|
## I want
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
## Acceptance
|
|
8
8
|
- [ ]
|
|
9
|
-
`}}],packages:[{spec:"templates",reason:"Reusable create templates for recurring story shapes."},{spec:"calendar",reason:"Sprint and iteration scheduling views."},{spec:"search-advanced",reason:"Richer retrieval as the backlog grows."}]},ops:{name:"ops",title:"Operations",summary:"Incident/Runbook response with mitigation and monitoring stages, severity, and service fields.",types:
|
|
9
|
+
`}}],packages:[{spec:"templates",reason:"Reusable create templates for recurring story shapes."},{spec:"calendar",reason:"Sprint and iteration scheduling views."},{spec:"search-advanced",reason:"Richer retrieval as the backlog grows."}]},ops:{name:"ops",title:"Operations",summary:"Incident/Runbook response with mitigation and monitoring stages, severity, and service fields.",types:l.ops,statuses:[{id:"mitigating",roles:["active"],aliases:["mitigation"],description:"Active mitigation is underway to restore service."},{id:"monitoring",roles:["active"],aliases:["observing"],description:"Mitigation applied; monitoring for recurrence before closure."}],fields:[{key:"severity",type:"string",commands:["create","update","list"],description:"Incident severity classification (e.g. sev1, sev2, sev3).",aliases:["sev"]},{key:"service",type:"string",commands:["create","update","list"],description:"Primary affected service or component."}],workflows:[{type:"Incident",allowed_transitions:[["open","mitigating"],["mitigating","monitoring"],["monitoring","mitigating"],["monitoring","closed"],["mitigating","blocked"],["blocked","mitigating"]]}],config:[{key:"search_provider",value:"bm25",summary:"Offline BM25 lexical search for fast incident lookup."},{key:"search_max_results",value:"25",summary:"Wider result cap to surface related incidents and runbooks."}],templates:[{name:"incident",options:{type:"Incident",priority:"1",tags:"incident",acceptanceCriteria:"Service restored, root cause documented, and follow-ups filed.",body:`## Impact
|
|
10
10
|
|
|
11
11
|
## Timeline
|
|
12
12
|
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
## Mitigation
|
|
16
16
|
|
|
17
17
|
## Follow-ups
|
|
18
|
-
`}}],packages:[{spec:"lifecycle-hooks",reason:"Automate transitions and notifications on incident state changes."},{spec:"governance-audit",reason:"Audit incident metadata completeness and closure quality."},{spec:"calendar",reason:"On-call and follow-up scheduling."}]},research:{name:"research",title:"Research",summary:"Experiment/Hypothesis investigation with an analysis stage, hypothesis, and method fields.",types:
|
|
18
|
+
`}}],packages:[{spec:"lifecycle-hooks",reason:"Automate transitions and notifications on incident state changes."},{spec:"governance-audit",reason:"Audit incident metadata completeness and closure quality."},{spec:"calendar",reason:"On-call and follow-up scheduling."}]},research:{name:"research",title:"Research",summary:"Experiment/Hypothesis investigation with an analysis stage, hypothesis, and method fields.",types:l.research,statuses:[{id:"analyzing",roles:["active"],aliases:["analysis"],description:"Data collected; analysis and synthesis in progress."}],fields:[{key:"hypothesis",type:"string",commands:["create","update"],description:"The testable claim the experiment evaluates."},{key:"method",type:"string",commands:["create","update","list"],description:"Experimental method or protocol used to evaluate the hypothesis.",aliases:["protocol"]}],workflows:[{type:"Experiment",allowed_transitions:[["open","in_progress"],["in_progress","analyzing"],["analyzing","in_progress"],["analyzing","closed"],["in_progress","blocked"],["blocked","in_progress"]]}],config:[{key:"search_provider",value:"bm25",summary:"Offline BM25 lexical search across the research corpus."},{key:"search_max_results",value:"50",summary:"Broader recall cap for literature and prior-experiment discovery."}],templates:[{name:"experiment",options:{type:"Experiment",priority:"2",tags:"experiment",acceptanceCriteria:"Hypothesis is supported, rejected, or refined with recorded evidence.",body:`## Hypothesis
|
|
19
19
|
|
|
20
20
|
## Method
|
|
21
21
|
|
|
22
22
|
## Results
|
|
23
23
|
|
|
24
24
|
## Conclusion
|
|
25
|
-
`}}],packages:[{spec:"search-advanced",reason:"Semantic retrieval over experiments and findings."},{spec:"templates",reason:"Consistent experiment and hypothesis scaffolds."},{spec:"beads",reason:"Import structured prior work into the tracker."}]}};function
|
|
25
|
+
`}}],packages:[{spec:"search-advanced",reason:"Semantic retrieval over experiments and findings."},{spec:"templates",reason:"Consistent experiment and hypothesis scaffolds."},{spec:"beads",reason:"Import structured prior work into the tracker."}]}};function m(e){if(e===void 0)return;const t=a(e);if(t.length===0)throw new Error("Profile name must not be empty.");if(r.includes(t))return t;throw new Error(`Invalid profile "${e}". Allowed: ${r.join(", ")}.`)}function y(e){const t=m(e);if(t===void 0)throw new Error(`Profile name is required. Allowed: ${r.join(", ")}.`);return p[t]}function g(){return r.map(e=>p[e])}function a(e){return e.trim().toLowerCase().replaceAll("-","_")}function d(e){return e.map(t=>t.definition.name).join(", ")}function u(e=[]){const t=r.map(i=>({definition:p[i],source:"builtin"})),n=new Set(r.map(i=>a(i))),c=new Set(n),s=[];for(const i of e){const o=a(i.profile.name);if(n.has(o)){s.push(`Extension "${i.name}" profile "${i.profile.name}" uses a name reserved by a built-in archetype and was ignored.`);continue}if(c.has(o)){s.push(`Profile "${i.profile.name}" from extension "${i.name}" duplicates an already-registered profile and was ignored.`);continue}c.add(o),t.push({definition:i.profile,source:"extension",package:i.name})}return{profiles:t,warnings:s}}function h(e,t=[]){const{profiles:n,warnings:c}=u(t);if(typeof e!="string"||e.trim().length===0)throw new Error(`Profile name is required. Allowed: ${d(n)}.`);const s=a(e),i=n.find(o=>a(o.definition.name)===s);if(i===void 0)throw new Error(`Invalid profile "${e}". Allowed: ${d(n)}.`);return{resolved:i,warnings:c}}export{p as BUILTIN_PROFILES,r as PROFILE_NAMES,g as listProfiles,a as normalizeProfileLookupKey,m as normalizeProfileName,y as resolveProfile,u as resolveProfileCatalog,h as resolveProfileEntry};
|
|
26
26
|
//# sourceMappingURL=profile-presets.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import a from"node:crypto";import{AsyncLocalStorage as u}from"node:async_hooks";const n=new u,c=1024;function s(e){const t=Date.parse(e.clock);if(!Number.isFinite(t))throw new Error(`Invalid reproducible workspace clock: ${e.clock}`);if(!Number.isSafeInteger(e.tickMs)||e.tickMs<0)throw new Error("Reproducible workspace tickMs must be a non-negative integer");if(e.seed.trim().length===0)throw new Error("Reproducible workspace seed must not be empty");return{...e,clock:new Date(t).toISOString()}}function d(e){const r={...s(e),clockReads:0,tokenReads:0};return o=>n.run(r,o)}async function k(e,t){return d(e)(t)}function f(){const e=n.getStore();if(e===void 0)return;const t=new Date(Date.parse(e.clock)+e.clockReads*e.tickMs).toISOString();return e.clockReads+=1,t}function b(e){const t=n.getStore();if(t===void 0)return;if(!Number.isSafeInteger(e)||e<0||e>c)throw new Error(`Reproducible token length must be an integer between 0 and ${c}`);let r="";for(;r.length<e;){const o=a.createHash("sha256").update(`${t.seed}\0${t.tokenReads}`).digest();t.tokenReads+=1;for(const i of o)if(r+=(i%36).toString(36),r.length===e)break}return r}export{d as createReproducibleExecutionRunner,f as nextReproducibleTimestamp,b as nextReproducibleToken,k as runWithReproducibleExecution,s as validateReproducibleExecutionSettings};
|
|
2
2
|
//# sourceMappingURL=context.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
`}function
|
|
1
|
+
import{RUNTIME_FIELD_COMMAND_VALUES as m,RUNTIME_FIELD_TYPE_VALUES as y}from"../../types/index.js";import{ITEM_METADATA_KEY_ORDER as A}from"../shared/constants.js";import{normalizeStatusToken as l}from"./status-token.js";import{normalizeStatusToken as j}from"./status-token.js";const T=new Set(y),k=new Set(m),p=new Set([...A.filter(t=>t!=="severity"),"id","title","type","status","priority","tags","assignee","parent","description","body","created_at","updated_at","closed_at","completed_at","author","deadline","estimate","sprint","release","risk","confidence","reviewer","resolution","expected","actual"]),w=["create","update"];function h(t){if(typeof t!="string")return"";const e=t.trim().toLowerCase().replaceAll(/[\s_]+/g,"-");return e.startsWith("--")?e.slice(2):e}function g(t){return t.replaceAll("_","-")}function C(t,e){const i=new Set;for(const n of t){const r=h(n);r.length>0&&r!==e&&i.add(r)}return[...i].sort((n,r)=>n.localeCompare(r))}function S(t){const e=new Set;for(const i of t??[]){const n=i.trim();n.length>0&&e.add(n)}return[...e].sort((i,n)=>i.localeCompare(n))}function I(t){const e=new Set,i=[];for(const n of t??[]){const r=n.trim().toLowerCase();if(r.length!==0){if(!k.has(r))throw new Error(`Invalid field command "${n}". Allowed: ${m.join(", ")}.`);e.has(r)||(e.add(r),i.push(r))}}return t===void 0||i.length===0?[...w]:i}function N(t){const e=l(t.key);if(e.length===0)throw new Error("Field key must not be empty.");if(e.includes(","))throw new Error(`Field key "${e}" must not contain commas: commas separate field names in list flags such as --unset and --fields.`);if(p.has(e))throw new Error(`Cannot define custom field "${e}": custom schema field "${e}" collides with built-in item metadata "${e}". Rename the custom field with a project-specific prefix. Reserved fields: ${[...p].sort((a,E)=>a.localeCompare(E)).join(", ")}.`);const i=typeof t.type=="string"&&t.type.trim().length>0?t.type.trim().toLowerCase():"string";if(!T.has(i))throw new Error(`Invalid field type "${t.type}". Allowed: ${y.join(", ")}.`);const n=i,r=I(t.commands),o=h(t.cliFlag),s=o.length>0&&o!==g(e)?o:void 0,d=s??g(e),f=C(t.aliases??[],d),u=[d,...f].find(a=>a.includes(","));if(u!==void 0)throw new Error(`Field flag "${u}" must not contain commas.`);const c=t.description?.trim();return{key:e,type:n,commands:r,description:c&&c.length>0?c:void 0,cliFlag:s,cliAliases:f,required:t.required===!0,requiredOnCreate:t.requiredOnCreate===!0,allowUnset:t.allowUnset!==!1,requiredTypes:S(t.requiredTypes)}}function q(t){if(Array.isArray(t))return t;if(typeof t!="object"||t===null)return;const e=t;if(Array.isArray(e.fields))return e.fields;if(Array.isArray(e.definitions))return e.definitions}function D(t){const e=q(t);if(!e)return[];const i=[];for(const n of e){if(typeof n!="object"||n===null||Array.isArray(n))continue;const r=n;typeof r.key!="string"||r.key.trim().length===0||i.push(r)}return i}function O(t){if(t==null||t.trim().length===0)return{fields:[]};let e;try{e=JSON.parse(t)}catch{throw new Error("schema/fields.json contains invalid JSON.")}return{fields:D(e)}}function U(t){return`${JSON.stringify({fields:t.fields},null,2)}
|
|
2
|
+
`}function $(t,e){const i=t.fields.find(s=>l(s.key)===e.key),n=i!==void 0,r=t.fields.filter(s=>l(s.key)!==e.key),o={...i,key:e.key,type:e.type,commands:[...e.commands]};return _(o,"description",e.description),_(o,"cli_flag",e.cliFlag),e.cliAliases.length>0?o.cli_aliases=[...e.cliAliases]:delete o.cli_aliases,F(o,"required",e.required),F(o,"required_on_create",e.requiredOnCreate),e.allowUnset===!1?o.allow_unset=!1:delete o.allow_unset,e.requiredTypes.length>0?o.required_types=[...e.requiredTypes]:delete o.required_types,r.push(o),r.sort((s,d)=>l(s.key).localeCompare(l(d.key))),{file:{fields:r},definition:o,replaced:n}}function v(t,e){const i=l(e);if(i.length===0)throw new Error("Field key must not be empty.");const n=[],r=t.fields.filter(o=>l(o.key)===i?(n.push(o),!1):!0);return n.length===0?{file:{fields:r},removed:!1}:{file:{fields:r},removed:!0,definition:n[0]}}function _(t,e,i){const n=t;i!==void 0&&i.length>0?n[e]=i:delete n[e]}function F(t,e,i){const n=t;i?n[e]=!0:delete n[e]}export{p as BUILTIN_FIELD_KEYS,N as normalizeAddFieldInput,j as normalizeFieldKey,O as parseFieldsFile,v as removeField,U as serializeFieldsFile,$ as upsertField};
|
|
3
3
|
//# sourceMappingURL=fields-file.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
`}function
|
|
1
|
+
import{BUILTIN_ITEM_TYPE_VALUES as c}from"../../types/index.js";import{normalizeItemTypeFolder as m,toDefaultFolder as h}from"../item/type-registry.js";const A=new Map(c.map(e=>[e.toLowerCase(),e])),T=/^[A-Za-z][A-Za-z0-9_-]*$/;function u(e,t){if(!T.test(e))throw new Error(`${t} "${e}" is not a valid identifier. Use a single letter-led token of letters, digits, hyphen, or underscore with no spaces or punctuation (e.g. "Spike" or "code-review").`)}function d(e){return A.get(e.trim().toLowerCase())}function p(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function $(e){return e.replace(/[\\"`$]/g,t=>`\\${t}`)}function y(e){const t=new Map;for(const i of e){const n=i.trim();if(n.length===0)continue;const o=n.toLowerCase();t.has(o)||t.set(o,n)}return[...t.values()].sort((i,n)=>i.localeCompare(n))}function v(e){const t=(e.name??"").trim();if(t.length===0)throw new Error("Type name must not be empty.");u(t,"Type name");const i=d(t);if(i)throw new Error(`Cannot redefine built-in item type "${i}". Built-in types are reserved: ${c.join(", ")}.`);const n=e.description?.trim(),o=e.defaultStatus?.trim(),r=e.folder?.trim(),a=r&&r.length>0?m(r):void 0,s=y(e.aliases??[]);for(const f of s){u(f,"Alias");const l=d(f);if(l)throw new Error(`Alias "${f}" collides with built-in item type "${l}". Built-in types are reserved: ${c.join(", ")}.`)}return{name:t,description:n&&n.length>0?n:void 0,defaultStatus:o&&o.length>0?o:void 0,folder:a,aliases:s}}function b(e,t){const i=e.name.toLowerCase(),n=new Map;for(const r of t.definitions){if(typeof r.name!="string")continue;const a=r.name.trim();if(!(a.length===0||a.toLowerCase()===i)){n.set(a.toLowerCase(),a);for(const s of p(r.aliases))s.trim().length>0&&n.set(s.trim().toLowerCase(),a)}}const o=n.get(i);if(o)throw new Error(`Type name "${e.name}" collides with an alias of existing item type "${o}".`);for(const r of e.aliases){const a=n.get(r.toLowerCase());if(a)throw new Error(`Alias "${r}" already maps to existing item type "${a}".`)}}function w(e,t){return typeof t=="string"&&t.trim().length>0?m(t).toLowerCase():h(e).toLowerCase()}function N(e,t,i){const n=e.name.toLowerCase(),o=w(e.name,e.folder),r=s=>{throw new Error(`Item type "${e.name}" would store items in folder "${o}", which already belongs to existing item type "${s}". Pass a distinct --folder to keep their storage separate.`)};for(const s of t.definitions){if(typeof s.name!="string")continue;const f=s.name.trim();f.length===0||f.toLowerCase()===n||w(f,s.folder)===o&&r(f)}const a=i?.get(o);a!==void 0&&a.toLowerCase()!==n&&r(a)}function _(e){if(e==null||e.trim().length===0)return{definitions:[]};let t;try{t=JSON.parse(e)}catch{throw new Error("schema/types.json contains invalid JSON.")}return{definitions:x(t)}}function x(e){const t=L(e);if(!t)return[];const i=[];for(const n of t){if(typeof n!="object"||n===null||Array.isArray(n))continue;const o=n;typeof o.name!="string"||o.name.trim().length===0||i.push(o)}return i}function L(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;const t=e;if(Array.isArray(t.definitions))return t.definitions;if(typeof t.item_types=="object"&&t.item_types!==null){const i=t.item_types;if(Array.isArray(i.definitions))return i.definitions}}function j(e,t){const i=t.name.toLowerCase(),n=e.definitions.slice(),o=n.findIndex(f=>typeof f.name=="string"&&f.name.trim().toLowerCase()===i),r=o>=0?n[o]:void 0,a=y([...p(r?.aliases),...t.aliases]),s={...r,name:t.name};return t.folder!==void 0&&(s.folder=t.folder),a.length>0?s.aliases=a:s.aliases!==void 0&&delete s.aliases,g(s,"description",t.description),g(s,"default_status",t.defaultStatus),o>=0?n[o]=s:n.push(s),n.sort((f,l)=>f.name.localeCompare(l.name)),{file:{definitions:n},definition:s,replaced:o>=0,...r&&typeof r.name=="string"?{previousName:r.name}:{}}}function F(e,t){const i=(t??"").trim();if(i.length===0)throw new Error("Type name must not be empty.");const n=d(i);if(n)throw new Error(`Cannot remove built-in item type "${n}". Built-in types are reserved: ${c.join(", ")}.`);const o=i.toLowerCase(),r=e.definitions.slice(),a=r.findIndex(f=>typeof f.name=="string"&&f.name.trim().toLowerCase()===o);if(a<0)return{file:{definitions:r},removed:!1};const[s]=r.splice(a,1);return{file:{definitions:r},removed:!0,definition:s}}function g(e,t,i){const n=e;i!==void 0&&(n[t]=i)}function S(e){return`${JSON.stringify({definitions:e.definitions},null,2)}
|
|
2
|
+
`}function C(e,t){const i=e.trim().length>0?e.trim():e,n=t?.trim()||".agents/pm/schema/types.json";return`To register a custom type, run: pm schema add-type "${$(i)}" (writes ${n}).`}function M(e,t,i){return`Invalid type value "${e}". Allowed: ${t.join(", ")}. ${C(e,i)}`}export{b as assertAliasesAvailable,N as assertTypeFolderAvailable,M as buildInvalidTypeError,C as buildInvalidTypeHint,$ as escapeForDoubleQuotes,d as matchBuiltinTypeName,v as normalizeAddTypeInput,_ as parseItemTypesFile,F as removeItemType,S as serializeItemTypesFile,j as upsertItemType};
|
|
3
3
|
//# sourceMappingURL=item-types-file.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{coerceRuntimeFieldValue as l,readRuntimeFieldOptionValue as c}from"./runtime-field-values.js";import{stableValueEquals as f}from"../shared/serialization.js";function u(n,r){return f(n,r)}function p(n,r,o){const e={};for(const t of r.command_to_fields.get(o)??[]){const a=c(n,t);a!==void 0&&(e[t.metadata_key]=l(t,a))}return e}function y(n,r){for(const[o,e]of Object.entries(r)){const t=n[o];if(Array.isArray(e)){if(Array.isArray(t)){const a=t.map(i=>String(i));if(!e.map(i=>String(i)).every(i=>a.includes(i)))return!1;continue}if(!u(t,e[e.length-1]))return!1;continue}if(!u(t,e))return!1}return!0}export{p as collectRuntimeFilterValues,y as matchesRuntimeFilters};
|
|
2
2
|
//# sourceMappingURL=runtime-field-filters.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9b51a9f9-e57f-5998-837e-c6c442ca1c9b")}catch{}})();import{EXIT_CODE}from"../shared/constants.js";import{PmCliError}from"../shared/errors.js";import{stableStringify}from"../shared/serialization.js";import{isRfc3339DateTime}from"../shared/time.js";import{runtimeFieldOptionTarget}from"./runtime-schema.js";import{assertIdentityFieldsWithoutUrlCredentials}from"../shared/url-credentials.js";const MAX_VALUE_SCHEMA_DEPTH=16;function toCamelToken(value){const segments=value.trim().replaceAll(/[^A-Za-z0-9]+/g," ").split(/\s+/).filter(segment=>segment.length>0).map(segment=>segment.toLowerCase());if(segments.length===0)return value;const[first,...rest]=segments;return`${first}${rest.map(segment=>`${segment.slice(0,1).toUpperCase()}${segment.slice(1)}`).join("")}`}function runtimeFieldSdkOptionName(definition,registry,reservedOptions=new Set,command){if(hasStorageTwin(definition,registry,command))return;const taken=foreignRuntimeFieldOptionNames(definition,registry,reservedOptions,command),readOrder=resolveCandidateOptionKeys(definition);return[toCamelToken(definition.cli_flag),...readOrder].find(name=>!taken.has(name)&&isUnshadowedOptionKey(name,readOrder,taken))}function isUnshadowedOptionKey(key,readOrder,taken){for(const earlier of readOrder){if(earlier===key)break;if(taken.has(earlier))return!1}return!0}function hasStorageTwin(definition,registry,command){return registry.definitions.some(candidate=>candidate!==definition&&candidate.metadata_key===definition.metadata_key&&(command===void 0||candidate.commands.includes(command)))}function foreignRuntimeFieldOptionNames(definition,registry,reservedOptions,command){return new Set([...reservedOptions,...registry.definitions.filter(candidate=>candidate!==definition&&(command===void 0||candidate.commands.includes(command))).flatMap(candidate=>resolveCandidateOptionKeys(candidate))])}function isNegatingFlag(flag){return flag.replace(/^-+/u,"").startsWith("no-")}function runtimeFieldFlagToken(flag){return flag.startsWith("-")?flag:`--${flag}`}function runtimeFieldCliFlagRoute(definition,registry,reserved,command){if(hasStorageTwin(definition,registry,command))return;const taken=foreignRuntimeFieldOptionNames(definition,registry,reserved.options,command),readOrder=resolveCandidateOptionKeys(definition);return[definition.cli_flag,...definition.cli_aliases].find(flag=>{const key=commanderOptionAttribute(flag);return isNegatingFlag(flag)||reserved.flags.has(runtimeFieldFlagToken(flag))||taken.has(key)?!1:isUnshadowedOptionKey(key,readOrder,taken)})}function commanderOptionAttribute(flag){return flag.replace(/^-+/u,"").replace(/^no-/u,"").split("-").reduce((name,word)=>`${name}${word.charAt(0).toUpperCase()}${word.slice(1)}`)}function resolveCandidateOptionKeys(definition){return[...new Set([runtimeFieldOptionTarget(definition),toCamelToken(definition.key),toCamelToken(definition.cli_flag),...definition.cli_aliases.map(alias=>toCamelToken(alias)),...[definition.cli_flag,...definition.cli_aliases].filter(flag=>!isNegatingFlag(flag)).map(flag=>commanderOptionAttribute(flag))])]}function readRuntimeFieldOptionValue(options,definition){for(const candidateKey of resolveCandidateOptionKeys(definition)){if(!Object.hasOwn(options,candidateKey))continue;const value=options[candidateKey];if(value!==void 0)return value}}function normalizeStringArrayValue(value){return Array.isArray(value)?value.flatMap(entry=>normalizeStringArrayValue(entry)).map(entry=>entry.trim()).filter(entry=>entry.length>0):typeof value=="string"?value.split(/[,\n|]/).map(entry=>entry.trim()).filter(entry=>entry.length>0):value==null?[]:[String(value).trim()].filter(entry=>entry.length>0)}function parseBooleanValue(raw,label){if(typeof raw=="boolean")return raw;if(typeof raw=="number"){if(raw===1)return!0;if(raw===0)return!1}if(typeof raw=="string"){const normalized=raw.trim().toLowerCase();if(normalized==="true"||normalized==="1"||normalized==="yes")return!0;if(normalized==="false"||normalized==="0"||normalized==="no")return!1}throw new PmCliError(`${label} must be one of true|false|1|0|yes|no`,EXIT_CODE.USAGE)}function parseNumberValue(raw,label){if(typeof raw=="number"&&Number.isFinite(raw))return raw;const candidate=typeof raw=="string"?raw.trim():String(raw),parsed=Number(candidate);if(!Number.isFinite(parsed))throw new PmCliError(`${label} must be a number`,EXIT_CODE.USAGE);return parsed}function parseJsonContainerValue(raw,label,expectedType){const parsed=typeof raw=="string"?(()=>{try{return JSON.parse(raw)}catch{return}})():raw;if(expectedType==="array"&&Array.isArray(parsed)||expectedType==="object"&&typeof parsed=="object"&&parsed!==null&&!Array.isArray(parsed))return parsed;throw new PmCliError(`${label} must be valid JSON ${expectedType}`,EXIT_CODE.USAGE)}function valueMatchesSchemaType(value,type){return type===void 0?!0:type==="array"?Array.isArray(value):type==="object"?typeof value=="object"&&value!==null&&!Array.isArray(value):typeof value===type}function runtimeFieldPrimitiveSchemaError(value,schema,path){if(schema.const!==void 0&&stableStringify(value)!==stableStringify(schema.const))return`${path} must equal ${stableStringify(schema.const)}`;if(schema.enum!==void 0&&!schema.enum.some(candidate=>stableStringify(candidate)===stableStringify(value)))return`${path} must be one of ${schema.enum.map(entry=>stableStringify(entry)).join("|")}`;if(!valueMatchesSchemaType(value,schema.type))return`${path} must match configured type ${String(schema.type)}`;if(typeof value=="string"){if(schema.min_length!==void 0&&value.length<schema.min_length)return`${path} must contain at least ${schema.min_length} characters`;if(schema.format==="date-time"&&!isRfc3339DateTime(value))return`${path} must be an RFC 3339 date-time`}}function runtimeFieldArraySchemaError(value,schema,path,depth){if(Array.isArray(value)){if(schema.min_items!==void 0&&value.length<schema.min_items)return`${path} must contain at least ${schema.min_items} items`;if(schema.items)for(const[index,entry]of value.entries()){const error=runtimeFieldSchemaError(entry,schema.items,`${path}[${index}]`,depth+1);if(error)return error}}}function runtimeFieldObjectSchemaError(value,schema,path,depth){if(typeof value!="object"||value===null||Array.isArray(value))return;const record=value;for(const key of schema.required??[])if(!Object.hasOwn(record,key))return`${path}.${key} is required`;for(const[key,entry]of Object.entries(record)){const propertySchema=schema.properties?.[key];if(!propertySchema){if(schema.additional_properties===!1)return`${path}.${key} is not allowed`;continue}const error=runtimeFieldSchemaError(entry,propertySchema,`${path}.${key}`,depth+1);if(error)return error}}function runtimeFieldSchemaError(value,schema,path,depth=0){if(depth>MAX_VALUE_SCHEMA_DEPTH)return`${path} value schema exceeds maximum depth`;const directError=runtimeFieldPrimitiveSchemaError(value,schema,path);if(directError)return directError;const arrayError=runtimeFieldArraySchemaError(value,schema,path,depth);if(arrayError)return arrayError;const objectError=runtimeFieldObjectSchemaError(value,schema,path,depth);if(objectError)return objectError;if(!schema.one_of)return;let matches=0;for(const candidate of schema.one_of)if(runtimeFieldSchemaError(value,candidate,path,depth+1)===void 0&&(matches+=1,matches>1))break;return matches===1?void 0:`${path} must match exactly one configured schema variant`}function validateRuntimeFieldValue(definition,value,label){if(!definition.value_schema||value===void 0)return value;const error=runtimeFieldSchemaError(value,definition.value_schema,label);if(error)throw new PmCliError(error,EXIT_CODE.USAGE);return value}function coerceRuntimeContainerValue(definition,rawValue,label,inputKind){const raw=inputKind==="option"&&Array.isArray(rawValue)?rawValue[rawValue.length-1]:rawValue;if(raw!==void 0)return validateRuntimeFieldValue(definition,parseJsonContainerValue(raw,label,definition.type),label)}function coerceRuntimeFieldValue(definition,rawValue,labelOverride,inputKind="option"){const label=labelOverride??`--${definition.cli_flag}`;if(definition.type==="array"||definition.type==="object")return coerceRuntimeContainerValue(definition,rawValue,label,inputKind);if(definition.repeatable||definition.type==="string_array"){const values=normalizeStringArrayValue(rawValue);return definition.type==="number"?validateRuntimeFieldValue(definition,values.map(value=>parseNumberValue(value,label)),label):definition.type==="boolean"?validateRuntimeFieldValue(definition,values.map(value=>parseBooleanValue(value,label)),label):validateRuntimeFieldValue(definition,values,label)}const scalarRaw=Array.isArray(rawValue)?rawValue[rawValue.length-1]:rawValue;if(scalarRaw!==void 0)return definition.type==="number"?validateRuntimeFieldValue(definition,parseNumberValue(scalarRaw,label),label):definition.type==="boolean"?validateRuntimeFieldValue(definition,parseBooleanValue(scalarRaw,label),label):validateRuntimeFieldValue(definition,typeof scalarRaw=="string"?scalarRaw:String(scalarRaw),label)}function shouldRequireFieldOnCreate(definition,itemTypeName){return!definition.required&&!definition.required_on_create?!1:definition.required_types.length===0?!0:itemTypeName?definition.required_types.map(value=>value.toLowerCase()).includes(itemTypeName.trim().toLowerCase()):!1}function collectRuntimeCreateFieldValues(options,fieldRegistry,itemTypeName){const values={},missingRequiredFlags=[];for(const definition of fieldRegistry.command_to_fields.get("create")??[]){const rawValue=readRuntimeFieldOptionValue(options,definition);if(rawValue===void 0){shouldRequireFieldOnCreate(definition,itemTypeName)&&missingRequiredFlags.push(`--${definition.cli_flag}`);continue}values[definition.metadata_key]=coerceRuntimeFieldValue(definition,rawValue)}return{values,missing_required_flags:[...new Set(missingRequiredFlags)].sort((left,right)=>left.localeCompare(right))}}function collectRuntimeUpdateFieldValues(options,fieldRegistry,commands=["update"]){const values={},definitions=(commands??["update"]).flatMap(command=>fieldRegistry.command_to_fields.get(command)??[]),seen=new Set;for(const definition of definitions){const rawValue=readRuntimeFieldOptionValue(options,definition);rawValue!==void 0&&(seen.has(definition.metadata_key)||(seen.add(definition.metadata_key),values[definition.metadata_key]=coerceRuntimeFieldValue(definition,rawValue)))}return assertIdentityFieldsWithoutUrlCredentials(values),values}export{coerceRuntimeFieldValue,collectRuntimeCreateFieldValues,collectRuntimeUpdateFieldValues,commanderOptionAttribute,readRuntimeFieldOptionValue,resolveCandidateOptionKeys,runtimeFieldCliFlagRoute,runtimeFieldFlagToken,runtimeFieldSdkOptionName,shouldRequireFieldOnCreate};
|
|
1
|
+
import{EXIT_CODE as l}from"../shared/constants.js";import{PmCliError as d}from"../shared/errors.js";import{stableStringify as a}from"../shared/serialization.js";import{isRfc3339DateTime as E}from"../shared/time.js";import{runtimeFieldOptionTarget as h}from"./runtime-schema.js";import{assertIdentityFieldsWithoutUrlCredentials as j}from"../shared/url-credentials.js";const R=16;function m(e){const r=e.trim().replaceAll(/[^A-Za-z0-9]+/g," ").split(/\s+/).filter(i=>i.length>0).map(i=>i.toLowerCase());if(r.length===0)return e;const[t,...n]=r;return`${t}${n.map(i=>`${i.slice(0,1).toUpperCase()}${i.slice(1)}`).join("")}`}function P(e,r,t=new Set,n){if(_(e,r,n))return;const i=$(e,r,t,n),o=p(e);return[m(e.cli_flag),...o].find(s=>!i.has(s)&&g(s,o,i))}function g(e,r,t){for(const n of r){if(n===e)break;if(t.has(n))return!1}return!0}function _(e,r,t){return r.definitions.some(n=>n!==e&&n.metadata_key===e.metadata_key&&(t===void 0||n.commands.includes(t)))}function $(e,r,t,n){return new Set([...t,...r.definitions.filter(i=>i!==e&&(n===void 0||i.commands.includes(n))).flatMap(i=>p(i))])}function b(e){return e.replace(/^-+/u,"").startsWith("no-")}function x(e){return e.startsWith("-")?e:`--${e}`}function W(e,r,t,n){if(_(e,r,n))return;const i=$(e,r,t.options,n),o=p(e);return[e.cli_flag,...e.cli_aliases].find(u=>{const s=A(u);return b(u)||t.flags.has(x(u))||i.has(s)?!1:g(s,o,i)})}function A(e){return e.replace(/^-+/u,"").replace(/^no-/u,"").split("-").reduce((r,t)=>`${r}${t.charAt(0).toUpperCase()}${t.slice(1)}`)}function p(e){return[...new Set([h(e),m(e.key),m(e.cli_flag),...e.cli_aliases.map(r=>m(r)),...[e.cli_flag,...e.cli_aliases].filter(r=>!b(r)).map(r=>A(r))])]}function S(e,r){for(const t of p(r)){if(!Object.hasOwn(e,t))continue;const n=e[t];if(n!==void 0)return n}}function F(e){return Array.isArray(e)?e.flatMap(r=>F(r)).map(r=>r.trim()).filter(r=>r.length>0):typeof e=="string"?e.split(/[,\n|]/).map(r=>r.trim()).filter(r=>r.length>0):e==null?[]:[String(e).trim()].filter(r=>r.length>0)}function C(e,r){if(typeof e=="boolean")return e;if(typeof e=="number"){if(e===1)return!0;if(e===0)return!1}if(typeof e=="string"){const t=e.trim().toLowerCase();if(t==="true"||t==="1"||t==="yes")return!0;if(t==="false"||t==="0"||t==="no")return!1}throw new d(`${r} must be one of true|false|1|0|yes|no`,l.USAGE)}function O(e,r){if(typeof e=="number"&&Number.isFinite(e))return e;const t=typeof e=="string"?e.trim():String(e),n=Number(t);if(!Number.isFinite(n))throw new d(`${r} must be a number`,l.USAGE);return n}function q(e,r,t){const n=typeof e=="string"?(()=>{try{return JSON.parse(e)}catch{return}})():e;if(t==="array"&&Array.isArray(n)||t==="object"&&typeof n=="object"&&n!==null&&!Array.isArray(n))return n;throw new d(`${r} must be valid JSON ${t}`,l.USAGE)}function U(e,r){return r===void 0?!0:r==="array"?Array.isArray(e):r==="object"?typeof e=="object"&&e!==null&&!Array.isArray(e):typeof e===r}function N(e,r,t){if(r.const!==void 0&&a(e)!==a(r.const))return`${t} must equal ${a(r.const)}`;if(r.enum!==void 0&&!r.enum.some(n=>a(n)===a(e)))return`${t} must be one of ${r.enum.map(n=>a(n)).join("|")}`;if(!U(e,r.type))return`${t} must match configured type ${String(r.type)}`;if(typeof e=="string"){if(r.min_length!==void 0&&e.length<r.min_length)return`${t} must contain at least ${r.min_length} characters`;if(r.format==="date-time"&&!E(e))return`${t} must be an RFC 3339 date-time`}}function M(e,r,t,n){if(Array.isArray(e)){if(r.min_items!==void 0&&e.length<r.min_items)return`${t} must contain at least ${r.min_items} items`;if(r.items)for(const[i,o]of e.entries()){const u=y(o,r.items,`${t}[${i}]`,n+1);if(u)return u}}}function L(e,r,t,n){if(typeof e!="object"||e===null||Array.isArray(e))return;const i=e;for(const o of r.required??[])if(!Object.hasOwn(i,o))return`${t}.${o} is required`;for(const[o,u]of Object.entries(i)){const s=r.properties?.[o];if(!s){if(r.additional_properties===!1)return`${t}.${o} is not allowed`;continue}const c=y(u,s,`${t}.${o}`,n+1);if(c)return c}}function y(e,r,t,n=0){if(n>R)return`${t} value schema exceeds maximum depth`;const i=N(e,r,t);if(i)return i;const o=M(e,r,t,n);if(o)return o;const u=L(e,r,t,n);if(u)return u;if(!r.one_of)return;let s=0;for(const c of r.one_of)if(y(e,c,t,n+1)===void 0&&(s+=1,s>1))break;return s===1?void 0:`${t} must match exactly one configured schema variant`}function f(e,r,t){if(!e.value_schema||r===void 0)return r;const n=y(r,e.value_schema,t);if(n)throw new d(n,l.USAGE);return r}function T(e,r,t,n){const i=n==="option"&&Array.isArray(r)?r[r.length-1]:r;if(i!==void 0)return f(e,q(i,t,e.type),t)}function k(e,r,t,n="option"){const i=t??`--${e.cli_flag}`;if(e.type==="array"||e.type==="object")return T(e,r,i,n);if(e.repeatable||e.type==="string_array"){const u=F(r);return e.type==="number"?f(e,u.map(s=>O(s,i)),i):e.type==="boolean"?f(e,u.map(s=>C(s,i)),i):f(e,u,i)}const o=Array.isArray(r)?r[r.length-1]:r;if(o!==void 0)return e.type==="number"?f(e,O(o,i),i):e.type==="boolean"?f(e,C(o,i),i):f(e,typeof o=="string"?o:String(o),i)}function V(e,r){return!e.required&&!e.required_on_create?!1:e.required_types.length===0?!0:r?e.required_types.map(t=>t.toLowerCase()).includes(r.trim().toLowerCase()):!1}function H(e,r,t){const n={},i=[];for(const o of r.command_to_fields.get("create")??[]){const u=S(e,o);if(u===void 0){V(o,t)&&i.push(`--${o.cli_flag}`);continue}n[o.metadata_key]=k(o,u)}return{values:n,missing_required_flags:[...new Set(i)].sort((o,u)=>o.localeCompare(u))}}function I(e,r,t=["update"]){const n={},i=(t??["update"]).flatMap(u=>r.command_to_fields.get(u)??[]),o=new Set;for(const u of i){const s=S(e,u);s!==void 0&&(o.has(u.metadata_key)||(o.add(u.metadata_key),n[u.metadata_key]=k(u,s)))}return j(n),n}export{k as coerceRuntimeFieldValue,H as collectRuntimeCreateFieldValues,I as collectRuntimeUpdateFieldValues,A as commanderOptionAttribute,S as readRuntimeFieldOptionValue,p as resolveCandidateOptionKeys,W as runtimeFieldCliFlagRoute,x as runtimeFieldFlagToken,P as runtimeFieldSdkOptionName,V as shouldRequireFieldOnCreate};
|
|
2
2
|
//# sourceMappingURL=runtime-field-values.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6e07b1b6-1757-54dd-8833-9d3f984ccf79")}catch{}})();import path from"node:path";import{pathExists,readFileIfExists}from"../fs/fs-utils.js";import{createFileAtomic}from"../fs/atomic-create.js";import{DEFAULT_STATUS_DEFINITIONS,DEFAULT_WORKFLOW_DEFINITION}from"../shared/constants.js";import{RUNTIME_FIELD_COMMAND_VALUES,RUNTIME_FIELD_TYPE_VALUES,RUNTIME_STATUS_ROLE_VALUES,RUNTIME_UNKNOWN_FIELD_POLICY_VALUES,STATUS_VALUES}from"../../types/index.js";import{normalizeStatusToken}from"./status-token.js";const DEFAULT_RUNTIME_SCHEMA_FILE_PATHS=Object.freeze({types:"schema/types.json",statuses:"schema/statuses.json",fields:"schema/fields.json",workflows:"schema/workflows.json"}),DEFAULT_RUNTIME_WORKFLOW=DEFAULT_WORKFLOW_DEFINITION,DEFAULT_RUNTIME_STATUS_DEFINITIONS=DEFAULT_STATUS_DEFINITIONS,DEFAULT_RUNTIME_FIELD_COMMANDS=["create","update"],RUNTIME_STATUS_ROLE_SET=new Set(RUNTIME_STATUS_ROLE_VALUES),RUNTIME_FIELD_TYPE_SET=new Set(RUNTIME_FIELD_TYPE_VALUES),RUNTIME_FIELD_COMMAND_SET=new Set(RUNTIME_FIELD_COMMAND_VALUES),RUNTIME_UNKNOWN_FIELD_POLICY_SET=new Set(RUNTIME_UNKNOWN_FIELD_POLICY_VALUES),RUNTIME_FIELD_VALUE_TYPE_SET=new Set(["string","number","boolean","array","object"]),MAX_RUNTIME_FIELD_VALUE_SCHEMA_DEPTH=16;function isPlainObject(value){return typeof value=="object"&&value!==null&&!Array.isArray(value)}const RUNTIME_FIELD_VALUE_SCHEMA_SHAPE_VALIDATORS=[schema=>schema.type===void 0||typeof schema.type=="string"&&RUNTIME_FIELD_VALUE_TYPE_SET.has(schema.type),schema=>!Object.hasOwn(schema,"const")||isStructuredJsonValue(schema.const),schema=>schema.enum===void 0||Array.isArray(schema.enum)&&schema.enum.every(entry=>isStructuredJsonValue(entry)),schema=>schema.min_length===void 0||Number.isInteger(schema.min_length)&&schema.min_length>=0,schema=>schema.min_items===void 0||Number.isInteger(schema.min_items)&&schema.min_items>=0,schema=>schema.format===void 0||schema.format==="date-time",schema=>schema.required===void 0||Array.isArray(schema.required)&&schema.required.every(entry=>typeof entry=="string"&&entry.length>0),schema=>schema.additional_properties===void 0||typeof schema.additional_properties=="boolean",schema=>schema.properties===void 0||isPlainObject(schema.properties),schema=>schema.one_of===void 0||Array.isArray(schema.one_of)&&schema.one_of.length>0];function isStructuredJsonValue(value,ancestors=new Set){if(value===null||typeof value=="string"||typeof value=="boolean")return!0;if(typeof value=="number")return Number.isFinite(value);if(typeof value!="object"||ancestors.has(value))return!1;ancestors.add(value);const valid=Array.isArray(value)?value.every(entry=>isStructuredJsonValue(entry,ancestors)):Object.values(value).every(entry=>isStructuredJsonValue(entry,ancestors));return ancestors.delete(value),valid}function normalizeRuntimeFieldValueSchema(value,depth=0,ancestors=new Set){if(!isPlainObject(value)||depth>MAX_RUNTIME_FIELD_VALUE_SCHEMA_DEPTH||ancestors.has(value))return;ancestors.add(value);const schema=value,type=schema.type,enumValues=schema.enum,oneOf=schema.one_of,properties=schema.properties,items=schema.items,required=schema.required,minLength=schema.min_length,minItems=schema.min_items,format=schema.format,additionalProperties=schema.additional_properties;if(!RUNTIME_FIELD_VALUE_SCHEMA_SHAPE_VALIDATORS.every(check=>check(schema))){ancestors.delete(value);return}const normalizedProperties=properties===void 0?void 0:Object.fromEntries(Object.entries(properties).map(([key,entry])=>[key,normalizeRuntimeFieldValueSchema(entry,depth+1,ancestors)])),normalizedItems=items===void 0?void 0:normalizeRuntimeFieldValueSchema(items,depth+1,ancestors),normalizedOneOf=oneOf===void 0?void 0:oneOf.map(entry=>normalizeRuntimeFieldValueSchema(entry,depth+1,ancestors));if([...Object.values(normalizedProperties??{}),...items===void 0?[]:[normalizedItems],...normalizedOneOf??[]].some(entry=>entry===void 0)){ancestors.delete(value);return}return ancestors.delete(value),Object.fromEntries(Object.entries({type,const:Object.hasOwn(schema,"const")?schema.const:void 0,enum:enumValues,min_length:minLength,min_items:minItems,format,properties:normalizedProperties,required:required===void 0?void 0:[...new Set(required)],additional_properties:additionalProperties,items:normalizedItems,one_of:normalizedOneOf}).filter(([,entry])=>entry!==void 0))}function normalizeStringList(values){const candidates=Array.isArray(values)?values:[];return[...new Set(candidates.map(value=>typeof value=="string"?value.trim():"").filter(value=>value.length>0))].sort((left,right)=>left.localeCompare(right))}function normalizeStatusId(value){if(typeof value!="string"||value.length===0)return;const normalized=normalizeStatusToken(value);return normalized.length>0?normalized:void 0}function stripFlagPrefix(value){return value.startsWith("--")?value.slice(2):value}function normalizeCliToken(value){return typeof value=="string"?stripFlagPrefix(value.trim().toLowerCase().replaceAll(/[\s_]+/g,"-")):""}function keyToDefaultCliFlag(value){return value.replaceAll("_","-")}function toCamelCase(input){const segments=input.replaceAll(/[^A-Za-z0-9]+/g," ").trim().split(/\s+/).filter(segment=>segment.length>0).map(segment=>segment.toLowerCase());if(segments.length===0)return input;const[first,...rest]=segments;return`${first}${rest.map(segment=>`${segment.slice(0,1).toUpperCase()}${segment.slice(1)}`).join("")}`}function normalizeRuntimeStatusDefinition(definition,fallbackOrder){const id=normalizeStatusId(definition.id);if(!id)return null;const aliases=[...new Set(normalizeStringList(definition.aliases).map(normalizeStatusToken).filter(value=>value.length>0))].sort((left,right)=>left.localeCompare(right)),roles=normalizeStringList(definition.roles).filter(value=>RUNTIME_STATUS_ROLE_SET.has(value)),description=definition.description?.trim(),order=typeof definition.order=="number"&&Number.isFinite(definition.order)?definition.order:fallbackOrder;return{id,aliases,roles,description:description&&description.length>0?description:void 0,order}}function normalizeRuntimeWorkflow(workflow){return{draft_status:normalizeStatusId(workflow?.draft_status),open_status:normalizeStatusId(workflow?.open_status),in_progress_status:normalizeStatusId(workflow?.in_progress_status),blocked_status:normalizeStatusId(workflow?.blocked_status),close_status:normalizeStatusId(workflow?.close_status),canceled_status:normalizeStatusId(workflow?.canceled_status)}}function appendTypeWorkflowPair(record,pair){if(!Array.isArray(pair)||pair.length!==2)return;const from=normalizeStatusToken(pair[0]),to=normalizeStatusToken(pair[1]);from.length===0||to.length===0||record.pairs.some(candidate=>candidate[0]===from&&candidate[1]===to)||record.pairs.push([from,to])}function normalizedTypeWorkflowEntry(entry){const rawType=typeof entry?.type=="string"?entry.type.trim():"";if(rawType.length===0||!Array.isArray(entry?.allowed_transitions))return null;const record={type:rawType,pairs:[],denyAll:entry.allowed_transitions.length===0};for(const pair of entry.allowed_transitions)appendTypeWorkflowPair(record,pair);return{typeKey:rawType.toLowerCase(),record}}function normalizeTypeWorkflowDefinitions(workflows){if(!Array.isArray(workflows)||workflows.length===0)return;const byTypeKey=new Map;for(const entry of workflows){const normalized2=normalizedTypeWorkflowEntry(entry);if(normalized2===null)continue;const record=byTypeKey.get(normalized2.typeKey)??normalized2.record;record.denyAll||=normalized2.record.denyAll;for(const pair of normalized2.record.pairs)appendTypeWorkflowPair(record,pair);byTypeKey.set(normalized2.typeKey,record)}const normalized=[];for(const record of byTypeKey.values())(record.pairs.length>0||record.denyAll)&&normalized.push({type:record.type,allowed_transitions:record.pairs});return normalized.sort((left,right)=>left.type.localeCompare(right.type)),normalized.length>0?normalized:void 0}function normalizeRuntimeFieldDefinition(definition){const key=normalizeStatusToken(definition.key??"");if(!key)return null;const metadataKey=normalizeStatusToken(definition.metadata_key??definition.front_matter_key??key),cliFlag=normalizeCliToken(definition.cli_flag??keyToDefaultCliFlag(key));if(!cliFlag)return null;const cliAliases=normalizeStringList(definition.cli_aliases).map(value=>normalizeCliToken(value)).filter(value=>value.length>0&&value!==cliFlag),typeCandidate=typeof definition.type=="string"?definition.type.trim().toLowerCase():"string",type=RUNTIME_FIELD_TYPE_SET.has(typeCandidate)?typeCandidate:"string",commands=(()=>{const normalized=normalizeStringList(definition.commands).filter(value=>RUNTIME_FIELD_COMMAND_SET.has(value));return normalized.length>0?normalized:[...DEFAULT_RUNTIME_FIELD_COMMANDS]})(),description=definition.description?.trim(),requiredTypes=normalizeStringList(definition.required_types),valueSchema=definition.value_schema===void 0?void 0:normalizeRuntimeFieldValueSchema(definition.value_schema);return definition.value_schema!==void 0&&valueSchema===void 0?null:{key,metadata_key:metadataKey,cli_flag:cliFlag,cli_aliases:cliAliases,description:description&&description.length>0?description:void 0,type,commands,repeatable:[definition.repeatable===!0,type==="string_array"].includes(!0),required:definition.required===!0,required_on_create:definition.required_on_create===!0,required_types:requiredTypes,allow_unset:definition.allow_unset!==!1,value_schema:valueSchema}}function normalizeRuntimeStatusDefinitions(statusesSource){const dedupedById=new Map;for(const[index,definition]of statusesSource.entries()){const normalized=normalizeRuntimeStatusDefinition(definition,index);normalized&&dedupedById.set(normalized.id,normalized)}const values=sortRuntimeStatusDefinitions([...dedupedById.values()]);return values.length>0?values:sortRuntimeStatusDefinitions(DEFAULT_RUNTIME_STATUS_DEFINITIONS.map((definition,index)=>normalizeRuntimeStatusDefinition(definition,index)).filter(definition=>definition!==null))}function sortRuntimeStatusDefinitions(definitions){return definitions.sort((left,right)=>left.order===right.order?left.id.localeCompare(right.id):left.order-right.order)}function normalizeRuntimeFieldDefinitions(fieldsSource){const dedupedByKey=new Map;for(const definition of fieldsSource??[]){const normalized=normalizeRuntimeFieldDefinition(definition);normalized&&dedupedByKey.set(normalized.key,normalized)}return[...dedupedByKey.values()].sort((left,right)=>left.key.localeCompare(right.key))}function serializeRuntimeStatusDefinition(definition){return{id:definition.id,aliases:definition.aliases.length>0?[...definition.aliases]:void 0,roles:definition.roles.length>0?[...definition.roles]:void 0,description:definition.description,order:definition.order}}function serializeRuntimeFieldDefinition(definition){return{key:definition.key,metadata_key:definition.metadata_key!==definition.key?definition.metadata_key:void 0,cli_flag:definition.cli_flag!==keyToDefaultCliFlag(definition.key)?definition.cli_flag:void 0,cli_aliases:definition.cli_aliases.length>0?[...definition.cli_aliases]:void 0,description:definition.description,type:definition.type,commands:[...definition.commands],repeatable:definition.repeatable===!0?!0:void 0,required:definition.required===!0?!0:void 0,required_on_create:definition.required_on_create===!0?!0:void 0,required_types:definition.required_types.length>0?[...definition.required_types]:void 0,allow_unset:definition.allow_unset===!1?!1:void 0,value_schema:definition.value_schema}}function normalizeUnknownFieldPolicy(policy){const candidate=typeof policy=="string"?policy.trim().toLowerCase():"allow";return RUNTIME_UNKNOWN_FIELD_POLICY_SET.has(candidate)?candidate:"allow"}function normalizeRuntimeSchemaSettings(schema){const files={...DEFAULT_RUNTIME_SCHEMA_FILE_PATHS,...schema?.files},statusesSource=schema?.statuses&&schema.statuses.length>0?schema.statuses:DEFAULT_RUNTIME_STATUS_DEFINITIONS,normalizedStatuses=normalizeRuntimeStatusDefinitions(statusesSource),normalizedFields=normalizeRuntimeFieldDefinitions(schema?.fields);return{version:typeof schema?.version=="number"&&Number.isFinite(schema.version)?Math.floor(schema.version):1,files,statuses:normalizedStatuses.map(serializeRuntimeStatusDefinition),fields:normalizedFields.map(serializeRuntimeFieldDefinition),workflow:{...DEFAULT_RUNTIME_WORKFLOW,...normalizeRuntimeWorkflow(schema?.workflow)},type_workflows:normalizeTypeWorkflowDefinitions(schema?.type_workflows),unknown_field_policy:normalizeUnknownFieldPolicy(schema?.unknown_field_policy)}}function parseOptionalJson(raw,warningKey,warnings){try{return JSON.parse(raw)}catch{warnings.push(warningKey);return}}function readTypeDefinitionsFromSchemaFile(parsed){if(Array.isArray(parsed))return parsed;if(typeof parsed!="object"||parsed===null)return;const record=parsed;if(Array.isArray(record.definitions))return record.definitions;if(typeof record.item_types=="object"&&record.item_types!==null){const itemTypesRecord=record.item_types;if(Array.isArray(itemTypesRecord.definitions))return itemTypesRecord.definitions}}function readStatusesFromSchemaFile(parsed){if(Array.isArray(parsed))return parsed;if(typeof parsed!="object"||parsed===null)return;const record=parsed;if(Array.isArray(record.statuses))return record.statuses;if(Array.isArray(record.definitions))return record.definitions}function readFieldsFromSchemaFile(parsed){if(Array.isArray(parsed))return parsed;if(typeof parsed!="object"||parsed===null)return;const record=parsed;if(Array.isArray(record.fields))return record.fields;if(Array.isArray(record.definitions))return record.definitions}function readWorkflowFromSchemaFile(parsed){if(typeof parsed!="object"||parsed===null||Array.isArray(parsed))return;const record=parsed;return typeof record.workflow=="object"&&record.workflow!==null&&!Array.isArray(record.workflow)?record.workflow:typeof record.workflows=="object"&&record.workflows!==null&&!Array.isArray(record.workflows)?record.workflows:record}function readTypeWorkflowsFromSchemaFile(parsed){if(typeof parsed!="object"||parsed===null||Array.isArray(parsed))return;const record=parsed;if(Array.isArray(record.type_workflows))return record.type_workflows}function filePathForSchemaSection(pmRoot,configuredPath,fallbackPath){const normalized=configuredPath?.trim()||fallbackPath;return path.isAbsolute(normalized)?normalized:path.join(pmRoot,normalized)}function resolveItemTypesFilePath(pmRoot,schema){return filePathForSchemaSection(pmRoot,schema.files.types,DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.types)}async function ensureRuntimeSchemaFileScaffold(pmRoot,schema){const normalizedSchema=normalizeRuntimeSchemaSettings(schema),specs=[{path:filePathForSchemaSection(pmRoot,normalizedSchema.files.types,DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.types),seed:{definitions:[]}},{path:filePathForSchemaSection(pmRoot,normalizedSchema.files.statuses,DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.statuses),seed:{statuses:DEFAULT_RUNTIME_STATUS_DEFINITIONS}},{path:filePathForSchemaSection(pmRoot,normalizedSchema.files.fields,DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.fields),seed:{fields:[]}},{path:filePathForSchemaSection(pmRoot,normalizedSchema.files.workflows,DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.workflows),seed:{workflow:DEFAULT_RUNTIME_WORKFLOW}}],createdPaths=[];for(const spec of specs)await pathExists(spec.path)||await createFileAtomic(spec.path,`${JSON.stringify(spec.seed,null,2)}
|
|
2
|
-
`)&&
|
|
1
|
+
import U from"node:path";import{pathExists as W,readFileIfExists as v}from"../fs/fs-utils.js";import{createFileAtomic as K}from"../fs/atomic-create.js";import{DEFAULT_STATUS_DEFINITIONS as V,DEFAULT_WORKFLOW_DEFINITION as H}from"../shared/constants.js";import{RUNTIME_FIELD_COMMAND_VALUES as Y,RUNTIME_FIELD_TYPE_VALUES as $,RUNTIME_STATUS_ROLE_VALUES as J,RUNTIME_UNKNOWN_FIELD_POLICY_VALUES as B,STATUS_VALUES as X}from"../../types/index.js";import{normalizeStatusToken as k}from"./status-token.js";const m=Object.freeze({types:"schema/types.json",statuses:"schema/statuses.json",fields:"schema/fields.json",workflows:"schema/workflows.json"}),O=H,D=V,Z=["create","update"],G=new Set(J),Q=new Set($),ee=new Set(Y),te=new Set(B),ne=new Set(["string","number","boolean","array","object"]),re=16;function R(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const se=[e=>e.type===void 0||typeof e.type=="string"&&ne.has(e.type),e=>!Object.hasOwn(e,"const")||E(e.const),e=>e.enum===void 0||Array.isArray(e.enum)&&e.enum.every(t=>E(t)),e=>e.min_length===void 0||Number.isInteger(e.min_length)&&e.min_length>=0,e=>e.min_items===void 0||Number.isInteger(e.min_items)&&e.min_items>=0,e=>e.format===void 0||e.format==="date-time",e=>e.required===void 0||Array.isArray(e.required)&&e.required.every(t=>typeof t=="string"&&t.length>0),e=>e.additional_properties===void 0||typeof e.additional_properties=="boolean",e=>e.properties===void 0||R(e.properties),e=>e.one_of===void 0||Array.isArray(e.one_of)&&e.one_of.length>0];function E(e,t=new Set){if(e===null||typeof e=="string"||typeof e=="boolean")return!0;if(typeof e=="number")return Number.isFinite(e);if(typeof e!="object"||t.has(e))return!1;t.add(e);const n=Array.isArray(e)?e.every(r=>E(r,t)):Object.values(e).every(r=>E(r,t));return t.delete(e),n}function I(e,t=0,n=new Set){if(!R(e)||t>re||n.has(e))return;n.add(e);const r=e,s=r.type,o=r.enum,u=r.one_of,a=r.properties,i=r.items,d=r.required,c=r.min_length,l=r.min_items,p=r.format,w=r.additional_properties;if(!se.every(_=>_(r))){n.delete(e);return}const h=a===void 0?void 0:Object.fromEntries(Object.entries(a).map(([_,z])=>[_,I(z,t+1,n)])),A=i===void 0?void 0:I(i,t+1,n),g=u===void 0?void 0:u.map(_=>I(_,t+1,n));if([...Object.values(h??{}),...i===void 0?[]:[A],...g??[]].some(_=>_===void 0)){n.delete(e);return}return n.delete(e),Object.fromEntries(Object.entries({type:s,const:Object.hasOwn(r,"const")?r.const:void 0,enum:o,min_length:c,min_items:l,format:p,properties:h,required:d===void 0?void 0:[...new Set(d)],additional_properties:w,items:A,one_of:g}).filter(([,_])=>_!==void 0))}function T(e){const t=Array.isArray(e)?e:[];return[...new Set(t.map(n=>typeof n=="string"?n.trim():"").filter(n=>n.length>0))].sort((n,r)=>n.localeCompare(r))}function f(e){if(typeof e!="string"||e.length===0)return;const t=k(e);return t.length>0?t:void 0}function ie(e){return e.startsWith("--")?e.slice(2):e}function M(e){return typeof e=="string"?ie(e.trim().toLowerCase().replaceAll(/[\s_]+/g,"-")):""}function j(e){return e.replaceAll("_","-")}function oe(e){const t=e.replaceAll(/[^A-Za-z0-9]+/g," ").trim().split(/\s+/).filter(s=>s.length>0).map(s=>s.toLowerCase());if(t.length===0)return e;const[n,...r]=t;return`${n}${r.map(s=>`${s.slice(0,1).toUpperCase()}${s.slice(1)}`).join("")}`}function L(e,t){const n=f(e.id);if(!n)return null;const r=[...new Set(T(e.aliases).map(k).filter(a=>a.length>0))].sort((a,i)=>a.localeCompare(i)),s=T(e.roles).filter(a=>G.has(a)),o=e.description?.trim(),u=typeof e.order=="number"&&Number.isFinite(e.order)?e.order:t;return{id:n,aliases:r,roles:s,description:o&&o.length>0?o:void 0,order:u}}function ae(e){return{draft_status:f(e?.draft_status),open_status:f(e?.open_status),in_progress_status:f(e?.in_progress_status),blocked_status:f(e?.blocked_status),close_status:f(e?.close_status),canceled_status:f(e?.canceled_status)}}function C(e,t){if(!Array.isArray(t)||t.length!==2)return;const n=k(t[0]),r=k(t[1]);n.length===0||r.length===0||e.pairs.some(s=>s[0]===n&&s[1]===r)||e.pairs.push([n,r])}function le(e){const t=typeof e?.type=="string"?e.type.trim():"";if(t.length===0||!Array.isArray(e?.allowed_transitions))return null;const n={type:t,pairs:[],denyAll:e.allowed_transitions.length===0};for(const r of e.allowed_transitions)C(n,r);return{typeKey:t.toLowerCase(),record:n}}function ue(e){if(!Array.isArray(e)||e.length===0)return;const t=new Map;for(const r of e){const s=le(r);if(s===null)continue;const o=t.get(s.typeKey)??s.record;o.denyAll||=s.record.denyAll;for(const u of s.record.pairs)C(o,u);t.set(s.typeKey,o)}const n=[];for(const r of t.values())(r.pairs.length>0||r.denyAll)&&n.push({type:r.type,allowed_transitions:r.pairs});return n.sort((r,s)=>r.type.localeCompare(s.type)),n.length>0?n:void 0}function P(e){const t=k(e.key??"");if(!t)return null;const n=k(e.metadata_key??e.front_matter_key??t),r=M(e.cli_flag??j(t));if(!r)return null;const s=T(e.cli_aliases).map(l=>M(l)).filter(l=>l.length>0&&l!==r),o=typeof e.type=="string"?e.type.trim().toLowerCase():"string",u=Q.has(o)?o:"string",a=(()=>{const l=T(e.commands).filter(p=>ee.has(p));return l.length>0?l:[...Z]})(),i=e.description?.trim(),d=T(e.required_types),c=e.value_schema===void 0?void 0:I(e.value_schema);return e.value_schema!==void 0&&c===void 0?null:{key:t,metadata_key:n,cli_flag:r,cli_aliases:s,description:i&&i.length>0?i:void 0,type:u,commands:a,repeatable:[e.repeatable===!0,u==="string_array"].includes(!0),required:e.required===!0,required_on_create:e.required_on_create===!0,required_types:d,allow_unset:e.allow_unset!==!1,value_schema:c}}function de(e){const t=new Map;for(const[r,s]of e.entries()){const o=L(s,r);o&&t.set(o.id,o)}const n=q([...t.values()]);return n.length>0?n:q(D.map((r,s)=>L(r,s)).filter(r=>r!==null))}function q(e){return e.sort((t,n)=>t.order===n.order?t.id.localeCompare(n.id):t.order-n.order)}function ce(e){const t=new Map;for(const n of e??[]){const r=P(n);r&&t.set(r.key,r)}return[...t.values()].sort((n,r)=>n.key.localeCompare(r.key))}function fe(e){return{id:e.id,aliases:e.aliases.length>0?[...e.aliases]:void 0,roles:e.roles.length>0?[...e.roles]:void 0,description:e.description,order:e.order}}function _e(e){return{key:e.key,metadata_key:e.metadata_key!==e.key?e.metadata_key:void 0,cli_flag:e.cli_flag!==j(e.key)?e.cli_flag:void 0,cli_aliases:e.cli_aliases.length>0?[...e.cli_aliases]:void 0,description:e.description,type:e.type,commands:[...e.commands],repeatable:e.repeatable===!0?!0:void 0,required:e.required===!0?!0:void 0,required_on_create:e.required_on_create===!0?!0:void 0,required_types:e.required_types.length>0?[...e.required_types]:void 0,allow_unset:e.allow_unset===!1?!1:void 0,value_schema:e.value_schema}}function me(e){const t=typeof e=="string"?e.trim().toLowerCase():"allow";return te.has(t)?t:"allow"}function F(e){const t={...m,...e?.files},n=e?.statuses&&e.statuses.length>0?e.statuses:D,r=de(n),s=ce(e?.fields);return{version:typeof e?.version=="number"&&Number.isFinite(e.version)?Math.floor(e.version):1,files:t,statuses:r.map(fe),fields:s.map(_e),workflow:{...O,...ae(e?.workflow)},type_workflows:ue(e?.type_workflows),unknown_field_policy:me(e?.unknown_field_policy)}}function pe(e,t,n){try{return JSON.parse(e)}catch{n.push(t);return}}function ye(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;const t=e;if(Array.isArray(t.definitions))return t.definitions;if(typeof t.item_types=="object"&&t.item_types!==null){const n=t.item_types;if(Array.isArray(n.definitions))return n.definitions}}function we(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;const t=e;if(Array.isArray(t.statuses))return t.statuses;if(Array.isArray(t.definitions))return t.definitions}function Se(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;const t=e;if(Array.isArray(t.fields))return t.fields;if(Array.isArray(t.definitions))return t.definitions}function he(e){if(typeof e!="object"||e===null||Array.isArray(e))return;const t=e;return typeof t.workflow=="object"&&t.workflow!==null&&!Array.isArray(t.workflow)?t.workflow:typeof t.workflows=="object"&&t.workflows!==null&&!Array.isArray(t.workflows)?t.workflows:t}function Ae(e){if(typeof e!="object"||e===null||Array.isArray(e))return;const t=e;if(Array.isArray(t.type_workflows))return t.type_workflows}function y(e,t,n){const r=t?.trim()||n;return U.isAbsolute(r)?r:U.join(e,r)}function Le(e,t){return y(e,t.files.types,m.types)}async function Ne(e,t){const n=F(t),r=[{path:y(e,n.files.types,m.types),seed:{definitions:[]}},{path:y(e,n.files.statuses,m.statuses),seed:{statuses:D}},{path:y(e,n.files.fields,m.fields),seed:{fields:[]}},{path:y(e,n.files.workflows,m.workflows),seed:{workflow:O}}],s=[];for(const o of r)await W(o.path)||await K(o.path,`${JSON.stringify(o.seed,null,2)}
|
|
2
|
+
`)&&s.push(o.path);return{created_paths:s}}async function Ue(e,t){const n=F(t),r=[],s=y(e,n.files.types,m.types),o=y(e,n.files.statuses,m.statuses),u=y(e,n.files.fields,m.fields),a=y(e,n.files.workflows,m.workflows);let i,d,c,l,p;const w=async(z,x)=>{const N=await v(z);if(N!==null)return pe(N,x,r)},h=await w(s,"runtime_schema_types_invalid_json");h!==void 0&&(i=ye(h),i===void 0&&r.push("runtime_schema_types_invalid_shape"));const A=await w(o,"runtime_schema_statuses_invalid_json");A!==void 0&&(d=we(A),d===void 0&&r.push("runtime_schema_statuses_invalid_shape"));const g=await w(u,"runtime_schema_fields_invalid_json");g!==void 0&&(c=Se(g),c===void 0&&r.push("runtime_schema_fields_invalid_shape"));const S=await w(a,"runtime_schema_workflows_invalid_json");return S!==void 0&&(l=he(S),l===void 0&&r.push("runtime_schema_workflows_invalid_shape"),p=Ae(S)),{schema:F({...n,statuses:[...n.statuses,...d??[]],fields:[...n.fields,...c??[]],workflow:{...n.workflow,...l},type_workflows:[...n.type_workflows??[],...p??[]]}),type_definitions_from_file:i,warnings:r,created_paths:[]}}function b(e,t,n,r=!1){const o=n.map(a=>f(a)).filter(a=>typeof a=="string").find(a=>e.some(i=>i.id===a));if(r&&o!==void 0)return o;const u=e.find(a=>a.roles.includes(t));return u!==void 0?u.id:o??e[0]?.id}function ge(e){const t=new Map,n=new Map;for(const r of e){n.set(r.id,r),t.set(r.id,r.id),t.set(r.id.replaceAll("_","-"),r.id),t.set(r.id.replaceAll("_"," "),r.id);for(const s of r.aliases)t.set(s,r.id),t.set(s.replaceAll("_","-"),r.id),t.set(s.replaceAll("_"," "),r.id)}return{aliasToId:t,byId:n}}function ke(e){const t={activeStatuses:new Set,blockedStatuses:new Set,draftStatuses:new Set,terminalCanceledStatuses:new Set,terminalDoneStatuses:new Set,terminalStatuses:new Set};for(const n of e){const r=new Set(n.roles);(r.has("terminal")||r.has("terminal_done")||r.has("terminal_canceled"))&&t.terminalStatuses.add(n.id),r.has("terminal_done")&&t.terminalDoneStatuses.add(n.id),r.has("terminal_canceled")&&t.terminalCanceledStatuses.add(n.id),r.has("active")&&t.activeStatuses.add(n.id),r.has("blocked")&&t.blockedStatuses.add(n.id),r.has("draft")&&t.draftStatuses.add(n.id)}return t}function Oe(e){const t=F(e),n=t.statuses.map((S,_)=>L(S,_)).filter(S=>S!==null),{aliasToId:r,byId:s}=ge(n),{activeStatuses:o,blockedStatuses:u,draftStatuses:a,terminalCanceledStatuses:i,terminalDoneStatuses:d,terminalStatuses:c}=ke(n),l=t.workflow,p=f(l.open_status)??b(n,"default_open",["open","in_progress",X[0]]),w=f(l.in_progress_status)??b(n,"active",["in_progress","in-progress",p],!0),h=f(l.blocked_status)??b(n,"blocked",["blocked"]),A=f(l.close_status)??b(n,"default_close",["closed","done","complete"]),g=f(l.canceled_status)??b(n,"default_cancel",["canceled","cancelled"]);return{definitions:n,by_id:s,alias_to_id:r,terminal_statuses:c,terminal_done_statuses:d,terminal_canceled_statuses:i,active_statuses:o,blocked_statuses:u,draft_statuses:a,open_status:p,in_progress_status:w,blocked_status:h,close_status:A,canceled_status:g}}function Te(e,t){const n=k(e);if(n)return t.alias_to_id.get(n)}function Re(e){const t=F(e),n=new Map,r=t.fields.map(i=>P(i)).filter(i=>i!==null);for(const i of r)n.set(i.key,i);const s=[...n.values()].sort((i,d)=>i.key.localeCompare(d.key)),o=new Map,u=new Map,a=new Map;for(const i of s){o.set(i.key,i),u.set(i.cli_flag,i);for(const d of i.cli_aliases)u.set(d,i);for(const d of i.commands){const c=a.get(d)??[];c.push(i),a.set(d,c)}}for(const[i,d]of a.entries())d.sort((c,l)=>c.key.localeCompare(l.key)),a.set(i,d);return{definitions:s,by_key:o,by_cli_token:u,command_to_fields:a}}function Me(e){return oe(e.key)}function je(e,t){const n=Te(e,t);return n?t.terminal_statuses.has(n):!1}export{m as DEFAULT_RUNTIME_SCHEMA_FILE_PATHS,D as DEFAULT_RUNTIME_STATUS_DEFINITIONS,O as DEFAULT_RUNTIME_WORKFLOW,Ne as ensureRuntimeSchemaFileScaffold,y as filePathForSchemaSection,Ue as loadRuntimeSchemaFromOptionalFiles,F as normalizeRuntimeSchemaSettings,Te as normalizeStatusInputWithRegistry,Le as resolveItemTypesFilePath,Re as resolveRuntimeFieldRegistry,Oe as resolveRuntimeStatusRegistry,Me as runtimeFieldOptionTarget,je as statusIsTerminal};
|
|
3
3
|
//# sourceMappingURL=runtime-schema.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
`}function
|
|
1
|
+
import{RUNTIME_STATUS_ROLE_VALUES as u}from"../../types/index.js";import{DEFAULT_RUNTIME_STATUS_DEFINITIONS as c}from"./runtime-schema.js";import{normalizeStatusToken as d}from"./status-token.js";import{normalizeStatusToken as N}from"./status-token.js";const h=new Set(u),l=new Set(c.map(e=>d(e.id)).filter(e=>e.length>0));function S(e){const t=new Set;for(const s of e){const n=d(s);n.length>0&&t.add(n)}return[...t].sort((s,n)=>s.localeCompare(n))}function T(e){const t=d(e.id);if(t.length===0)throw new Error("Status id must not be empty.");if(l.has(t))throw new Error(`Cannot add-status the built-in status "${t}". Built-in statuses are reserved: ${[...l].join(", ")}.`);let s;if(e.roles!==void 0){s=[];const o=new Set;for(const a of e.roles){const f=typeof a=="string"?a.trim().toLowerCase():"";if(f.length!==0){if(!h.has(f))throw new Error(`Invalid status role "${a}". Allowed roles: ${u.join(", ")}.`);o.has(f)||(o.add(f),s.push(f))}}if(s.length===0)throw new Error(`Status role must include at least one lifecycle role. Allowed roles: ${u.join(", ")}.`)}const n=e.aliases===void 0?void 0:S(e.aliases).filter(o=>o!==t),i=e.description?.trim(),r=typeof e.order=="number"&&Number.isFinite(e.order)?Math.trunc(e.order):void 0;return{id:t,roles:s,aliases:n,description:i&&i.length>0?i:void 0,order:r}}function m(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;const t=e;if(Array.isArray(t.statuses))return t.statuses;if(Array.isArray(t.definitions))return t.definitions}function g(e){const t=m(e);if(!t)return[];const s=[];for(const n of t){if(typeof n!="object"||n===null||Array.isArray(n))continue;const i=n;typeof i.id!="string"||i.id.trim().length===0||s.push(i)}return s}function x(e){if(e==null||e.trim().length===0)return{statuses:[]};let t;try{t=JSON.parse(e)}catch{throw new Error("schema/statuses.json contains invalid JSON.")}return{statuses:g(t)}}function E(e){return`${JSON.stringify({statuses:e.statuses},null,2)}
|
|
2
|
+
`}function I(e,t,s){const n=e.statuses.slice(),i=n.findIndex(a=>d(a.id)===t.id),r=i>=0?n[i]:s,o={...r,id:t.id};return t.roles!==void 0&&(t.roles.length>0?o.roles=[...t.roles]:o.roles!==void 0&&delete o.roles),t.aliases!==void 0&&(t.aliases.length>0?o.aliases=[...t.aliases]:o.aliases!==void 0&&delete o.aliases),t.description!==void 0&&(o.description=t.description),t.order!==void 0&&(o.order=t.order),i>=0?n[i]=o:n.push(o),{file:{statuses:n},definition:o,replaced:r!==void 0}}function w(e,t){const s=d(t);if(s.length===0)throw new Error("Status id must not be empty.");if(l.has(s))throw new Error(`Cannot remove built-in status "${s}". Built-in statuses are reserved: ${[...l].join(", ")}.`);const n=e.statuses.slice(),i=n.findIndex(o=>d(o.id)===s);if(i<0)return{file:{statuses:n},removed:!1};const[r]=n.splice(i,1);return{file:{statuses:n},removed:!0,definition:r}}function v(e,t){const s=[e.id,...e.aliases??[]];for(const n of s){const i=d(n);if(i.length===0)continue;const r=t.get(i);if(r!==void 0&&r!==e.id)throw new Error(`Status token "${i}" already belongs to status "${r}". Choose a different id/alias to avoid shadowing it.`)}}export{l as BUILTIN_STATUS_IDS,v as assertStatusTokensAvailable,T as normalizeAddStatusInput,N as normalizeStatusToken,x as parseStatusDefsFile,w as removeStatusDef,E as serializeStatusDefsFile,I as upsertStatusDef};
|
|
3
3
|
//# sourceMappingURL=status-defs-file.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{evictOldestMemoEntries as r}from"../shared/memo.js";const i=2e3,t=new Map;function m(e){if(typeof e!="string")return"";const n=t.get(e);if(n!==void 0)return n;const o=e.trim().toLowerCase().replaceAll(/[\s-]+/g,"_");return t.size>=i&&r(t),t.set(e,o),o}export{m as normalizeStatusToken};
|
|
2
2
|
//# sourceMappingURL=status-token.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{matchBuiltinTypeName as m}from"./item-types-file.js";const f=/^([A-Za-z][A-Za-z0-9_-]*?)\s*[-:]\s+\S/;function p(i){const e=f.exec(i.trim());if(!e)return;const r=e[1];if(!(r.length<2)&&!/^[A-Za-z]\d+$/.test(r))return r.toLowerCase()}function l(i){return i.split(/[-_]+/).filter(e=>e.length>0).map(e=>`${e.slice(0,1).toUpperCase()}${e.slice(1).toLowerCase()}`).join("")}function d(i,e={}){const r=typeof e.minCount=="number"&&e.minCount>0?Math.trunc(e.minCount):10,s=typeof e.maxExamples=="number"&&e.maxExamples>0?Math.trunc(e.maxExamples):3,u=new Map;for(const n of i){const t=typeof n=="string"?n.trim():"";if(t.length===0)continue;const o=p(t);if(o===void 0)continue;const c=u.get(o)??{count:0,examples:[]};c.count+=1,c.examples.length<s&&c.examples.push(t),u.set(o,c)}const a=[];for(const[n,t]of u.entries()){if(t.count<r)continue;const o=l(n);a.push({name:o,prefix:n,count:t.count,examples:t.examples,shadows_builtin:m(o)!==void 0})}return a.sort((n,t)=>t.count-n.count||n.name.localeCompare(t.name)),a}export{p as extractTitlePrefix,d as inferTypesFromTitles,l as prefixToTypeName};
|
|
2
2
|
//# sourceMappingURL=type-inference.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{normalizeAddTypeInput as o}from"./item-types-file.js";const r=["agile","ops","research"],i={agile:[{name:"Story",description:"User-facing outcome or capability slice expressed from a stakeholder perspective.",defaultStatus:"open",folder:"stories",aliases:["user-story"]},{name:"Spike",description:"Time-boxed investigation used to reduce uncertainty before implementation.",defaultStatus:"open",folder:"spikes",aliases:["research-spike"]}],ops:[{name:"Incident",description:"Operational disruption, degradation, or support escalation with recovery tracking.",defaultStatus:"open",folder:"incidents",aliases:["outage"]},{name:"Runbook",description:"Repeatable operational procedure, diagnostic path, or response playbook.",defaultStatus:"open",folder:"runbooks",aliases:["playbook"]}],research:[{name:"Experiment",description:"Validated-learning activity with hypothesis, method, and outcome tracking.",defaultStatus:"open",folder:"experiments",aliases:["study"]},{name:"Hypothesis",description:"Testable claim or assumption that should be supported, rejected, or refined.",defaultStatus:"open",folder:"hypotheses",aliases:["assumption"]}]};function a(t){if(t===void 0)return;const e=t.trim().toLowerCase().replaceAll("-","_");if(e.length===0)throw new Error("Type preset name must not be empty.");if(e==="agile"||e==="ops"||e==="research")return e;throw new Error(`Invalid type preset "${t}". Allowed: ${r.join(", ")}.`)}function n(t){return i[t].map(e=>o(e))}export{i as TYPE_PRESET_DEFINITIONS,r as TYPE_PRESET_NAMES,a as normalizeTypePresetName,n as resolveTypePresetDefinitions};
|
|
2
2
|
//# sourceMappingURL=type-presets.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{normalizeStatusToken as y}from"./status-token.js";import{normalizeStatusToken as T}from"./status-token.js";function w(t){return typeof t=="string"?t.trim().toLowerCase():""}function i(t,s){const o=y(t);return o.length===0?"":s?.alias_to_id?.get(o)??o}function d(t){const s=Array.isArray(t?.type_workflows)?t.type_workflows:[],o=new Map;for(const e of s){const r=w(e?.type);if(r.length===0||!Array.isArray(e?.allowed_transitions))continue;const f=e.allowed_transitions,n=o.get(r)??{pairs:[],denyAll:!1};f.length===0&&(n.denyAll=!0);for(const l of f){if(!Array.isArray(l)||l.length!==2)continue;const a=y(l[0]),u=y(l[1]);a.length===0||u.length===0||n.pairs.some(c=>c[0]===a&&c[1]===u)||n.pairs.push([a,u])}o.set(r,n)}return[...o.entries()].filter(([,e])=>e.pairs.length>0||e.denyAll).map(([e,r])=>({type:e,allowed_transitions:r.pairs})).sort((e,r)=>e.type.localeCompare(r.type))}function m(t){const s=w(t.typeName),o=t.typeWorkflows.find(n=>n.type===s);if(!o)return{allowed:!0,hasRule:!1,allowedTransitions:[]};const e=i(t.fromStatus,t.statusRegistry),r=i(t.toStatus,t.statusRegistry);return e.length>0&&e===r?{allowed:!0,hasRule:!0,allowedTransitions:o.allowed_transitions}:{allowed:o.allowed_transitions.some(n=>{const l=i(n[0],t.statusRegistry),a=i(n[1],t.statusRegistry);return l===e&&a===r}),hasRule:!0,allowedTransitions:o.allowed_transitions}}function g(t){return t.length===0?"(no transitions allowed)":t.map(s=>`${s[0]} -> ${s[1]}`).join(", ")}export{g as describeAllowedTransitions,m as evaluateTransition,T as normalizeStatusToken,d as resolveTypeWorkflows};
|
|
2
2
|
//# sourceMappingURL=type-workflows.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
`)}async function
|
|
1
|
+
import{spawn as R}from"node:child_process";import{mkdirSync as w,rmSync as m,statSync as A}from"node:fs";import d from"node:path";import{pathExists as H,readFileIfExists as v,writeFileAtomic as T}from"../fs/fs-utils.js";import{acquireLock as C}from"../lock/lock.js";import{resolvePmPackageRootFromModule as D}from"../packages/root.js";import{readSettingsWithMetadata as L}from"../store/settings.js";import{toErrorMessage as y}from"../shared/primitives.js";import{resolveAuthor as x}from"../shared/author.js";import{resolveSettingsWithSemanticRuntimeDefaults as F}from"./semantic-defaults.js";const Q="reindex",G="search/pending-refresh.json",M="search/pending-refresh.gate.lock",b=3e4,U="PM_SEARCH_REFRESH_INLINE",p="PM_SEARCH_REFRESH_CHILD",W=3e4;function S(e){if(typeof e!="string")return!1;const r=e.trim().toLowerCase();return r==="1"||r==="true"||r==="yes"||r==="on"}function ie(){if(S(process.env[U])||S(process.env[p]))return!0;const e=(process.env.NODE_ENV??"").trim().toLowerCase();return typeof process.env.VITEST=="string"||typeof process.env.VITEST_WORKER_ID=="string"||e==="test"}function P(e){return d.join(e,G)}function I(e){return d.join(e,M)}function j(e){const r=I(e);try{if(Date.now()-A(r).mtimeMs<b)return!1;m(r,{recursive:!0,force:!0})}catch{}try{return w(d.dirname(r),{recursive:!0}),w(r),!0}catch{return!1}}function O(e){try{m(I(e),{recursive:!0,force:!0})}catch{}}async function k(e,r,n){for(let t=0;t<50;t+=1){if(j(e))try{return await r()}finally{O(e)}await V(20)}return n}function V(e){return new Promise(r=>{setTimeout(r,e)})}async function l(e){const r=await v(P(e));if(!r||r.trim().length===0)return[];try{const n=JSON.parse(r);return Array.isArray(n.ids)?n.ids.filter(t=>typeof t=="string"&&t.length>0):[]}catch{return[]}}async function N(e,r){await T(P(e),`${JSON.stringify({ids:r})}
|
|
2
|
+
`)}async function _(e,r){const n=r.filter(a=>typeof a=="string"&&a.trim().length>0);if(n.length===0)return;const t=async()=>{const a=await l(e),o=[...new Set([...a,...n])].sort((f,u)=>f.localeCompare(u));await N(e,o)};await k(e,async()=>(await t(),!0),!1)||await t()}async function q(e){return k(e,async()=>{const r=await l(e);return r.length>0&&await N(e,[]),r},[])}function $(){return d.join(D(import.meta.url,["../../.."]),"dist","cli","search-refresh.js")}function g(e){try{const r=R(process.execPath,[$()],{detached:!0,stdio:"ignore",env:{...process.env,PM_PATH:e,[p]:"1"}});r.on("error",()=>{}),r.unref()}catch{}}function B(e){setTimeout(()=>g(e),W)}async function ae(e,r){await _(e,r),g(e)}async function ce(e,r,n=B){const t=[],c=[];if(!await H(e))return{processed:c,rounds:0,warnings:t};let a;try{const s=await L(e),i=s.warnings.find(h=>h.startsWith("settings_read_"));if(i)return n(e),{processed:c,rounds:0,warnings:[`search_background_refresh_settings_read_failed:${i}`]};a=F(s.settings).settings}catch(s){return n(e),{processed:c,rounds:0,warnings:[`search_background_refresh_settings_read_failed:${y(s)}`]}}let o=null;try{o=await C(e,Q,a.locks.ttl_seconds,x(void 0,"pm-search-refresh"),!1,a.governance.force_required_for_stale_lock,a.locks.wait_ms)}catch{}if(!o)return{processed:c,rounds:0,warnings:t};let f=0,u=!1,E=!1;try{for(;;){const s=await q(e);if(s.length===0)break;f+=1;try{const i=await r(e,s);if(t.push(...i.warnings),i.warnings.some(h=>h.startsWith("search_semantic_refresh_skipped:settings_read_failed:"))){await _(e,s),u=!0,E=!0;break}c.push(...i.refreshed)}catch(i){t.push(`search_background_refresh_failed:${y(i)}`),await _(e,s),u=!0;break}}}finally{await o?.()}return E&&n(e),(u?[]:await l(e)).length>0&&g(e),{processed:[...new Set(c)].sort((s,i)=>s.localeCompare(i)),rounds:f,warnings:t}}export{Q as REINDEX_LOCK_ID,W as SEARCH_REFRESH_RETRY_DELAY_MS,q as drainPendingRefreshIds,_ as enqueuePendingRefreshIds,ce as runSemanticRefreshWorker,ae as scheduleBackgroundSemanticRefresh,ie as shouldRunSearchRefreshInForeground};
|
|
3
3
|
//# sourceMappingURL=background-refresh.js.map
|
package/dist/core/search/bm25.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{tokenizeAlphaNumeric as h}from"../shared/text-normalization.js";const p=1.2,d=.75;function b(t){return h(t)}function y(t){const n=new Map;for(const e of t)n.set(e,(n.get(e)??0)+1);return n}function k(t){const n=[],e=new Map;let r=0;for(const s of t){const o=b(s.text),c=y(o);r+=o.length;for(const i of c.keys())e.set(i,(e.get(i)??0)+1);n.push({id:s.id,termFrequencies:c,length:o.length})}const u=n.length;return{documents:n,documentFrequency:e,documentCount:u,averageDocumentLength:u>0?r/u:0}}function M(t,n){return Math.log(1+(t-n+.5)/(n+.5))}function q(t,n,e){const r=new Map;if(t.documentCount===0||t.averageDocumentLength===0)return r;const u=[...new Set(n.filter(o=>o.length>0))];if(u.length===0)return r;const s=new Map;for(const o of u){const c=t.documentFrequency.get(o);c!==void 0&&s.set(o,M(t.documentCount,c))}if(s.size===0)return r;for(const o of t.documents){let c=0;for(const[i,g]of s){const f=o.termFrequencies.get(i);if(f===void 0)continue;const l=1-e.b+e.b*o.length/t.averageDocumentLength,a=f+e.k1*l;c+=g*(f*(e.k1+1)/a)}c>0&&r.set(o.id,c)}return r}function m(t,n,e,r){return typeof t!="number"||!Number.isFinite(t)?n:Math.min(r,Math.max(e,t))}function B(t){const n=e=>typeof e=="string"?[e]:typeof e=="number"?[String(e)]:Array.isArray(e)?e.flatMap(n):typeof e=="object"&&e!==null?Object.values(e).flatMap(n):[];return n(Object.values(t)).join(" ")}function x(t){const n=t?.search?.bm25;return{k1:m(n?.k1,p,0,1e3),b:m(n?.b,d,0,1)}}export{d as DEFAULT_BM25_B,p as DEFAULT_BM25_K1,k as buildBm25Index,B as flattenSearchCorpusText,x as resolveBm25Params,q as scoreBm25Query,b as tokenizeBm25};
|
|
2
2
|
//# sourceMappingURL=bm25.js.map
|