@unbrained/pm-cli 2026.9.11 → 2026.9.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +42 -0
- package/dist/cli/command-namespaces.js +1 -1
- package/dist/cli/commander-usage.js +2 -2
- package/dist/cli/error-guidance.d.ts +10 -0
- package/dist/cli/error-guidance.js +1 -1
- package/dist/cli/main.js +2 -2
- package/dist/cli/option-values.d.ts +3 -0
- package/dist/cli/option-values.js +2 -0
- package/dist/cli/register-mutation.d.ts +5 -0
- package/dist/cli/register-mutation.js +2 -16
- package/dist/cli/schema/registration.d.ts +4 -0
- package/dist/cli/schema/registration.js +16 -0
- package/dist/cli-bundle/bundle-manifest.json +160 -152
- package/dist/cli-bundle/chunks/{chunk-TDKWJQD7.js → chunk-3DWX3CKN.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-6KHYW3FH.js +235 -0
- package/dist/cli-bundle/chunks/chunk-AKTBOX6U.js +2 -0
- package/dist/cli-bundle/chunks/chunk-GBK5MV6N.js +29 -0
- package/dist/cli-bundle/chunks/{chunk-JMQKJ7CJ.js → chunk-GQQR6JAL.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-QER6OSOP.js → chunk-KM4XVZR7.js} +53 -53
- package/dist/cli-bundle/chunks/{chunk-VFKBNGF6.js → chunk-LA44JECQ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-DAWH7TGV.js → chunk-XEZOGC3P.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-TFVKBJJ4.js → chunk-XM7RWQLM.js} +103 -103
- package/dist/cli-bundle/chunks/{chunk-RJQSCK74.js → chunk-YDSV4QIQ.js} +6 -6
- package/dist/cli-bundle/chunks/chunk-YQTJACN5.js +20 -0
- package/dist/cli-bundle/chunks/{chunk-BN5QVWNY.js → chunk-ZZI7IHMM.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-U6MY437C.js → register-list-query-WMJTBWNW.js} +2 -2
- package/dist/cli-bundle/chunks/register-mutation-EXGOXP3D.js +20 -0
- package/dist/cli-bundle/chunks/{register-operations-EHWIZW3X.js → register-operations-2H4CDRGU.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-BZYL3HBL.js → register-setup-NYBWGPOS.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-TWE3GPQM.js → chunk-7JR6M2JR.js} +17 -17
- package/dist/cli-bundle/focused-chunks/{chunk-GKUF7TM5.js → chunk-B6JAANOH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-UJCQXUD2.js → chunk-DSJYL4VP.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-VS6MR2HT.js → chunk-F66QJWI4.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-MOT32PR2.js → chunk-FBCLVOBE.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-HM6JS6Q3.js → chunk-FPNI4U2B.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-HFAW3FJQ.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-KP3N6PVZ.js +164 -0
- package/dist/cli-bundle/focused-chunks/chunk-LQ67C7ZO.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-TGMSSI3Z.js → chunk-OENAWWP4.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-7WISPJRZ.js → chunk-SDQCJF4H.js} +53 -53
- package/dist/cli-bundle/focused-chunks/chunk-TUHRUFID.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-6JF66HAG.js → chunk-V7PSTKHD.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-FJDEFA64.js → chunk-XCCM7P7V.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-YUXBHIUV.js +20 -0
- package/dist/cli-bundle/focused-chunks/{chunk-BEQAW7OT.js → chunk-ZAMG7HBB.js} +4 -4
- package/dist/cli-bundle/focused-chunks/chunk-ZF5PXK6A.js +2 -0
- package/dist/cli-bundle/main.js +20 -20
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +2 -2
- package/dist/cli-bundle/sdk-core.js +34 -34
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +42 -42
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +8 -8
- package/dist/core/history/history.js +1 -1
- package/dist/core/history/operation-contract.d.ts +30 -0
- package/dist/core/history/operation-contract.js +2 -0
- package/dist/core/history/tombstone.d.ts +3 -0
- package/dist/core/history/tombstone.js +2 -0
- package/dist/core/item/id.d.ts +8 -7
- package/dist/core/item/id.js +1 -1
- package/dist/core/output/mutation-projection.d.ts +1 -0
- package/dist/core/output/mutation-projection.js +1 -1
- package/dist/core/sentry/instrument.js +1 -1
- package/dist/core/shared/command-line.d.ts +10 -0
- package/dist/core/shared/command-line.js +2 -0
- package/dist/core/shared/errors.d.ts +13 -0
- package/dist/core/shared/errors.js +1 -1
- package/dist/core/store/item-store.d.ts +5 -1
- package/dist/core/store/item-store.js +1 -1
- package/dist/core/telemetry/consent.d.ts +1 -1
- package/dist/core/telemetry/consent.js +2 -2
- package/dist/core/telemetry/policy.d.ts +10 -0
- package/dist/core/telemetry/policy.js +2 -0
- package/dist/core/telemetry/runtime.d.ts +11 -9
- package/dist/core/telemetry/runtime.js +3 -3
- package/dist/sdk/agent/command-suggestions.js +1 -1
- package/dist/sdk/agent/item-addressing.js +1 -1
- package/dist/sdk/agent-capability-contracts.js +1 -1
- package/dist/sdk/cli-bootstrap.js +1 -1
- package/dist/sdk/cli-contracts/command-aliases.js +1 -1
- package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -1
- package/dist/sdk/cli-contracts/grammar-contracts.js +1 -1
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +3 -0
- package/dist/sdk/cli-contracts/runtime-contracts.js +1 -1
- package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
- package/dist/sdk/cli-contracts/tool-schema.js +1 -1
- package/dist/sdk/command-line.d.ts +1 -6
- package/dist/sdk/command-line.js +1 -1
- package/dist/sdk/comments.js +1 -1
- package/dist/sdk/completion.js +1 -1
- package/dist/sdk/contracts.d.ts +1 -0
- package/dist/sdk/contracts.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
- package/dist/sdk/governance/health.js +1 -1
- package/dist/sdk/governance/storage-integrity.js +1 -1
- package/dist/sdk/governance/workflow-completeness.js +1 -1
- package/dist/sdk/governance/workflow-policy.js +2 -2
- package/dist/sdk/index.d.ts +1 -0
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/learnings.js +1 -1
- package/dist/sdk/lifecycle/claim.d.ts +2 -0
- package/dist/sdk/lifecycle/claim.js +1 -1
- package/dist/sdk/lifecycle/mcp-actions.d.ts +4 -0
- package/dist/sdk/lifecycle/mcp-actions.js +1 -1
- package/dist/sdk/lifecycle/task-composition.d.ts +2 -0
- package/dist/sdk/lifecycle/task-composition.js +1 -1
- package/dist/sdk/merge/reconcile.js +1 -1
- package/dist/sdk/merge/three-way.js +2 -2
- package/dist/sdk/notes.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query/projection-contracts.d.ts +1 -1
- package/dist/sdk/query/projection-contracts.js +1 -1
- package/dist/sdk/runtime.js +1 -1
- package/dist/sdk/telemetry.d.ts +5 -0
- package/dist/sdk/telemetry.js +1 -1
- package/docs/AGENT_UX_CONTRACTS.md +8 -0
- package/docs/ARCHITECTURE.md +7 -0
- package/docs/CLI_GRAMMAR.md +31 -0
- package/docs/COMMAND_NAMESPACES.md +7 -4
- package/docs/CONFIGURATION.md +13 -2
- package/docs/HISTORY_OPERATIONS.md +46 -0
- package/docs/HISTORY_RECOVERY.md +27 -2
- package/docs/LIFECYCLE_COMMANDS.md +19 -2
- package/docs/MERGE_SAFETY.md +64 -3
- package/docs/WORKFLOW_POLICIES.md +47 -3
- package/docs/generated/AGENT_CAPABILITY_ROUTING.md +4 -4
- package/docs/generated/AGENT_COMMAND_SURFACE.md +10 -0
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +11 -1
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +8 -5
- package/marketplace.json +2 -2
- package/package.json +1 -1
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/README.md +22 -0
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/extensions/guide-shell/index.ts +13 -26
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/dist/cli-bundle/chunks/chunk-FBY6PEIR.js +0 -20
- package/dist/cli-bundle/chunks/chunk-IRUNFLLG.js +0 -2
- package/dist/cli-bundle/chunks/chunk-RJZFAXBW.js +0 -235
- package/dist/cli-bundle/chunks/chunk-SGAKQIGQ.js +0 -29
- package/dist/cli-bundle/chunks/register-mutation-HAPHD4S7.js +0 -20
- package/dist/cli-bundle/focused-chunks/chunk-3JVTLBCW.js +0 -20
- package/dist/cli-bundle/focused-chunks/chunk-DZ3ATEFS.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-M74YW332.js +0 -164
- package/dist/cli-bundle/focused-chunks/chunk-ONDKO4EL.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-YOPNRWSX.js +0 -2
package/dist/sdk/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="58c64257-c326-55a7-b5a9-dd07886e947c")}catch(e2){}})();import{PM_COMMAND_CAPABILITY_CONTRACTS,PM_COMMAND_VISIBILITY_CONTRACTS,PM_MCP_PROMPT_CONTRACTS,PM_MCP_RESOURCE_CONTRACTS,PM_MCP_TOOL_COMMAND_CONTRACTS,listPmCommandsForFamily,listPmCommandsForTier,listPmMcpToolsForProfile,renderPmCommandVisibilityMarkdown,resolvePmCommandCapabilityFamily,resolvePmCommandVisibilityTier}from"./agent-capability-contracts.js";export*from"./mcp/protocol.js";export*from"./mcp/interactions.js";export*from"./mcp/tasks.js";export*from"./mcp/subscriptions.js";export*from"./mcp/transport.js";export*from"./mcp/authorization.js";export*from"./mcp/apps.js";export*from"./mcp/skills.js";export*from"./cli-contracts/grammar-contracts.js";export*from"./agent-session-context.js";export*from"./environment/agent-environment.js";import{isErrnoError,limitAnnotationEntries,parseAnnotationTextInput,readAnnotationEntries,normalizeAnnotationTransportOptions,resolveAnnotationInput,resolveAnnotationIndex,runAnnotationCommand,wrapOwnershipConflict}from"./annotations.js";import{acknowledgeUnknownAuthorHistoryEvents,acknowledgeUnknownAuthorHistoryEventsFromTransport,inspectHistoryAuthorStream,parseUnknownAuthorHistoryEventCoordinates,planUnknownAuthorHistoryAcknowledgment,resolveUnknownAuthorAcknowledgmentSelector,scanHistoryAuthorAttribution}from"./author-attribution.js";import{BUILTIN_CORPUS_SHAPES,PM_CORPUS_SHAPE_SCHEMA,buildCorpusShapeItemPlan,createCorpusShapeMeasurement,defineCorpusShape,listBuiltinCorpusShapes,measureCorpusShapePlan,resolveBuiltinCorpusShape}from"./corpus-shape.js";export*from"./core-governance.js";import{createPmCliProgram}from"./cli-program.js";import{runSearchRefreshWorkerEntrypoint}from"./search-refresh-worker.js";import{PM_REPRODUCIBLE_PROCESS_ENV,createReproducibleProcessRunner,resolveReproducibleProcessEnvironment,runWithReproducibleProcessEnvironment}from"./reproducibility/process.js";import{PM_WORKSPACE_RECIPE_SCHEMA,defineWorkspaceRecipe,executeWorkspaceRecipe,runWithWorkspaceRecipe}from"./workspace-recipe.js";import{SNAPSHOT_SCHEMA,WORKSPACE_SNAPSHOT_ACTIONS,createWorkspaceSnapshot,deleteWorkspaceSnapshot,inspectWorkspaceSnapshot,listWorkspaceSnapshots,planWorkspaceSnapshotRestore,restoreWorkspaceSnapshot,restoreWorkspaceSnapshotWithRecovery}from"./workspace-snapshot.js";import{flushTelemetryQueue}from"./telemetry-flush.js";import{PM_HISTORY_COMMAND_ALIASES,PM_CONTEXT_OPS_COMMAND_ALIASES,PM_BULK_LIFECYCLE_COMMAND_ALIASES,PM_RELOCATED_COMMAND_ALIASES,PM_NAMESPACED_COMMAND_ALIASES,findPmNamespacedCommand,resolvePmCommandOperation,resolvePmHistoryOperation}from"./cli-contracts.js";import{EXECUTABLE_COMMAND_ALIASES,PM_COMMAND_ALIAS_CONTRACTS,renderPmCommandAliasMigrationHint,resolvePmCommandAlias,applyBootstrapPagerPolicy,coalesceRepeatedListFlags,listAliasPluralKeys,mergeLinkedTestTwoTokenEntries,normalizeBootstrapInvocation,normalizeLegacyExtensionActionSyntax,parseBootstrapCommandName,parseBootstrapGlobalOptions,parseBootstrapHelpRequest,parseBootstrapTypeValue,stripGlobalBootstrapTokens}from"./cli-bootstrap.js";import{quoteCommandArg,quoteWindowsCommandArg,renderPmCommand}from"./command-line.js";export*from"./agent/command-recovery.js";export*from"./agent/command-suggestions.js";export*from"./agent/item-addressing.js";export*from"./agent/create-option-policy.js";import{runGc}from"./governance/gc.js";import{PM_EXACT_COVERAGE_METRICS,findCoverageDeficits}from"./governance/coverage-assurance.js";import{_testOnlyHealthCommand,runHealth}from"./governance/health.js";import{_testOnlyValidateCommand,projectValidateCounts,runValidate}from"./governance/validate.js";import{runExtension}from"./extension.js";import{buildExtensionInstallPlan,planExtensionDirectoryCopy}from"./extension/install-plan.js";import{resolveExtensionInstallSourceIdentity}from"./extension/source-resolution.js";import{applyStoredExtensionMigrationState,readExtensionMigrationState,resolveExtensionMigrationStatePath,runExtensionMigrateAction,runExtensionMigrations}from"./extension/migrations.js";import{findInstalledNpmPackageCandidate}from"./extension/install-sources.js";import{buildExtensionDescribeResult,renderExtensionDescribeMarkdown}from"./extension/describe.js";import{runEvent,runMeet,runRemind}from"./scheduling-shortcuts.js";import{createExtensionCommandSdk}from"./extension-command-context.js";import{isRuntimeRecord}from"./runtime-input.js";import{resolveStartTaskInProgressStatus}from"./start-task-status.js";import{auditMergeAttributeFence,buildMergeAttributePatterns,findGitWorkspaceRoot,installMergeFence,refreshMergeAttributeFenceIfInstalled,resolveMergeInstallContext,resolveProjectMergeTypeFolders,runMergeInstall}from"./merge/install.js";import{deriveSchemaEvolutionMigrationId,formatSchemaEvolutionMigrationHuman,planSchemaEvolutionMigration,runSchemaEvolutionMigration}from"./schema-migration.js";import{runWithActiveExtensions}from"./runtime.js";import{applyInvocationAuthorOverride}from"./invocation-author.js";import{evaluateMutationGuard,getMutationActionContract,isMutationAction,listMutationActions,PM_MUTATION_ACTION_CONTRACTS,scanMutationSecrets}from"./mutation-guard.js";import{findSimilarItems,findDuplicateClusters,evaluateSimilarityGovernance,similarityAdvisoryWarnings,jaccardSimilarity,normalizeSimilarityText,prepareSimilarityText,scoreItemSimilarity,scorePreparedItemSimilarity,tokenizeSimilarityText}from"./similarity.js";import{inspectStaleInProgressItems,scanStaleInProgressItems}from"./governance/stale-work.js";import{describeItemOwnershipConflict}from"./ownership-source.js";import{discoverNearbyPmRoot}from"./tracker-root-discovery.js";import{assertInitializedTracker,assertReadableTrackerRoot,buildTrackerInitializationRecovery}from"./environment/tracker-preflight.js";import{_testOnly}from"./templates.js";import{runConfig,_testOnlyConfigCommand}from"./config.js";export*from"./agent/identity-config.js";import{INIT_AGENT_GUIDANCE_MODE_VALUES,runInitAgentGuidance,_testOnly as _testOnly2}from"./init-agent-guidance.js";import{runInit,summarizeInitResult,_testOnly as _testOnly3}from"./init.js";import{PROFILE_SUBCOMMANDS,formatProfileApplyHuman,formatProfileLintHuman,formatProfileListHuman,formatProfileShowHuman,runProfileApply,runProfileLint,runProfileList,runProfileShow}from"./profile.js";export*from"./extension-contracts.js";import{RESERVED_ITEM_FIELD_NAMES}from"../core/extensions/item-fields.js";import{PM_PACKAGE_CONVENTIONAL_RESOURCE_ROOTS,PM_PACKAGE_RESOURCE_KINDS,collectPackageExtensionDirectories,readPmPackageManifest}from"../core/packages/manifest.js";import{ACTIVITY_FLAG_CONTRACTS,ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS,AGGREGATE_FLAG_CONTRACTS,ASSURANCE_FLAG_CONTRACTS,APPEND_FLAG_CONTRACTS,CALENDAR_COMMANDER_STRING_OPTION_CONTRACTS,CALENDAR_FLAG_CONTRACTS,CLAIM_FLAG_CONTRACTS,CLOSE_ACTION_OPTION_KEYS,CLOSE_FLAG_CONTRACTS,CLOSE_MANY_FLAG_CONTRACTS,CLOSE_TASK_FLAG_CONTRACTS,COMMENTS_FLAG_CONTRACTS,COMPLETION_FLAG_CONTRACTS,CONFIG_FLAG_CONTRACTS,CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS,CONTEXT_FLAG_CONTRACTS,CONTRACTS_FLAG_CONTRACTS,COPY_FLAG_CONTRACTS,CREATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS,CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS,CREATE_COMMANDER_STRING_OPTION_CONTRACTS,CREATE_FLAG_CONTRACTS,DELETE_FLAG_CONTRACTS,DEPS_FLAG_CONTRACTS,DOCS_FLAG_CONTRACTS,EVAL_FLAG_CONTRACTS,EVENT_FLAG_CONTRACTS,EVENTS_FLAG_CONTRACTS,EXTENSION_ACTIVATE_FLAG_CONTRACTS,EXTENSION_ADOPT_ALL_FLAG_CONTRACTS,EXTENSION_ADOPT_FLAG_CONTRACTS,EXTENSION_CATALOG_FLAG_CONTRACTS,EXTENSION_DEACTIVATE_FLAG_CONTRACTS,EXTENSION_DESCRIBE_FLAG_CONTRACTS,EXTENSION_DOCTOR_FLAG_CONTRACTS,EXTENSION_EXPLORE_FLAG_CONTRACTS,EXTENSION_FLAG_CONTRACTS,EXTENSION_INIT_FLAG_CONTRACTS,EXTENSION_INSTALL_FLAG_CONTRACTS,EXTENSION_MANAGE_FLAG_CONTRACTS,EXTENSION_MIGRATE_FLAG_CONTRACTS,EXTENSION_RELOAD_FLAG_CONTRACTS,EXTENSION_SCOPE_FLAG_CONTRACTS,EXTENSION_UNINSTALL_FLAG_CONTRACTS,FILES_FLAG_CONTRACTS,FOCUS_FLAG_CONTRACTS,GC_FLAG_CONTRACTS,GET_FLAG_CONTRACTS,GRAPH_FLAG_CONTRACTS,GLOBAL_FLAG_CONTRACTS,GUIDE_FLAG_CONTRACTS,HEALTH_FLAG_CONTRACTS,HISTORY_COMPACT_FLAG_CONTRACTS,HISTORY_FLAG_CONTRACTS,HISTORY_REDACT_FLAG_CONTRACTS,HISTORY_REPAIR_FLAG_CONTRACTS,HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS,INIT_FLAG_CONTRACTS,INSTALL_FLAG_CONTRACTS,ITEM_MUTATE_FLAG_CONTRACTS,ITEM_COMPLETE_FLAG_CONTRACTS,ITEM_REOPEN_FLAG_CONTRACTS,LEARNINGS_FLAG_CONTRACTS,LIST_COMMANDER_STRING_OPTION_CONTRACTS,LIST_FILTER_FLAG_CONTRACTS,MEET_FLAG_CONTRACTS,MERGE_FLAG_CONTRACTS,NEXT_COMMANDER_STRING_OPTION_CONTRACTS,NEXT_FLAG_CONTRACTS,NOTES_FLAG_CONTRACTS,PACKAGE_FLAG_CONTRACTS,PACKAGE_INIT_FLAG_CONTRACTS,PAUSE_TASK_FLAG_CONTRACTS,PLAN_CREATE_METADATA_PARAMETER_KEYS,PLAN_FLAG_CONTRACTS,PM_COMMAND_OUTPUT_BUDGET_CONTRACTS,PM_DIAGNOSTIC_DEGRADATION_STEPS,PM_DIAGNOSTIC_OUTPUT_BUDGET_CONTRACTS,PM_DIAGNOSTIC_OUTPUT_CLASSES,PM_CLI_ONLY_TOOL_ACTION_WAIVERS,PM_CORE_COMMAND_NAMES,PM_EXTENSION_PACKAGE_ACTION_SUBCOMMANDS,PM_PACKAGE_ONLY_ACTION_SUBCOMMANDS,PM_ITEM_ACTION_SUBCOMMANDS,PM_DEPRECATED_TOOL_ACTIONS,PM_DISCOVERABLE_TOOL_ACTIONS,PM_EXTENSION_CAPABILITY_CONTRACTS,PM_EXTENSION_POLICY_MODE_CONTRACTS,PM_EXTENSION_POLICY_SURFACE_CONTRACTS,PM_EXTENSION_SANDBOX_PROFILE_CONTRACTS,PM_EXTENSION_SERVICE_NAME_CONTRACTS,PM_EXTENSION_TRUST_MODE_CONTRACTS,PM_PROVIDER_TOOL_PARAMETERS_SCHEMA,PM_PROVIDER_TOOL_PARAMETERS_SCHEMA_VERSION,PM_TOOL_ACTIONS,analyzePmToolActionParity,PM_TOOL_ACTION_PARAMETER_CONTRACTS,PM_TOOL_PARAMETERS_SCHEMA,PM_TOOL_PARAMETERS_SCHEMA_MAJOR,PM_TOOL_PARAMETERS_SCHEMA_VERSION,PM_OUTPUT_BUDGET_CLASSES,PM_OUTPUT_DEGRADATION_STEPS,PROFILE_FLAG_CONTRACTS,REINDEX_FLAG_CONTRACTS,RELEASE_FLAG_CONTRACTS,REMIND_FLAG_CONTRACTS,RESTORE_FLAG_CONTRACTS,SCHEMA_FLAG_CONTRACTS,SEARCH_COMMANDER_STRING_OPTION_CONTRACTS,SEARCH_FLAG_CONTRACTS,START_TASK_FLAG_CONTRACTS,STATS_FLAG_CONTRACTS,DUPLICATES_FLAG_CONTRACTS,SUBCOMMAND_GLOBAL_FLAG_CONTRACTS,TELEMETRY_FLAG_CONTRACTS,TEST_ALL_FLAG_CONTRACTS,TEST_FLAG_CONTRACTS,TEST_RUNS_FLAG_CONTRACTS,TOOL_ACTIVITY_OPTION_CONTRACTS,TOOL_AGGREGATE_OPTION_CONTRACTS,TOOL_BULK_MUTATION_FILTER_OPTION_CONTRACT_SOURCE,TOOL_CALENDAR_OPTION_CONTRACTS,TOOL_CLOSE_MANY_FILTER_OPTION_CONTRACTS,TOOL_CONTEXT_OPTION_CONTRACTS,TOOL_CREATE_OPTION_CONTRACTS,TOOL_CREATE_OPTION_CONTRACT_SOURCE,TOOL_DEPS_OPTION_CONTRACTS,TOOL_GRAPH_OPTION_CONTRACTS,TOOL_LIST_FILTER_OPTION_CONTRACTS,TOOL_SEARCH_FILTER_OPTION_CONTRACTS,TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACTS,TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACT_SOURCE,TOOL_UPDATE_MANY_FILTER_OPTION_CONTRACTS,TOOL_UPDATE_OPTION_CONTRACTS,TOOL_UPDATE_OPTION_CONTRACT_SOURCE,verifyToolOptionCliParity,UPDATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS,UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS,UPDATE_COMMANDER_STRING_OPTION_CONTRACTS,UPDATE_FLAG_CONTRACTS,UPDATE_MANY_FLAG_CONTRACTS,UPGRADE_FLAG_CONTRACTS,VALIDATE_FLAG_CONTRACTS,WORKSPACE_FLAG_CONTRACTS,buildPmActionToolInputSchema,PM_TOOL_RESERVED_CUSTOM_FIELD_PROPERTIES,compactFlagAliasContracts,createPmCommandOutputBudget,definePmCommandOutputBudget,estimatePmOutputTokens,inferPmOutputBudgetClass,projectPmDiagnosticOutput,projectPmDiagnosticText,analyzeSdkCliParameterCompleteness,isPmExtensionCapabilityContract,isPmExtensionPolicyModeContract,isPmExtensionPolicySurfaceContract,isPmExtensionServiceNameContract,isPmToolAction,hasSubcommandFlagContractsForCommand,readFirstStringFromCommanderOptions,readFirstValueFromCommanderOptions,readStringArrayFromCommanderOptions,resolvePmPositionalActionFlagContracts,resolveSubcommandFlagContractsForCommand,resolvePmCommandOutputBudget,resolvePmDiagnosticOutputBudget,resolvePmToolCustomFieldCollision,toCompletionFlagString,withFlagAliasMetadata}from"./cli-contracts.js";export*from"./compose.js";export*from"./governance/assurance.js";export*from"./governance/assurance-action.js";export*from"./governance/assurance-runtime.js";export*from"./governance/assurance-presets.js";export*from"./governance/boundary-fixtures.js";export*from"./governance/defect-recurrence.js";export*from"./governance/merge-receipt-history.js";export*from"./compile-cache.js";export*from"./environment/project-runtime-compatibility.js";export*from"./environment/source-context.js";export*from"./environment/host-environment-errors.js";export*from"./cli-contracts/command-exit-contracts.js";export*from"./context-relevance.js";export*from"./context/recency.js";export*from"./context-intent-contracts.js";export*from"./context-intent-runtime.js";export*from"./context-signal-store.js";export*from"./workspace-memory.js";export*from"./lifecycle-completion.js";export*from"./lifecycle-policy.js";export*from"./output-projection.js";export*from"./read-output-contracts.js";export*from"./read-output-rows.js";export*from"./read-output-session.js";export*from"./output-token-accounting.js";export*from"./context-packing.js";export*from"./context-usage.js";import{classifyHistoryEvent,HISTORY_EVENT_CLASSIFICATION_VERSION,MAINTENANCE_HISTORY_OPERATIONS,SUBSTANTIVE_HISTORY_OPERATIONS}from"../core/history/event-classification.js";export*from"./dependency-provenance.js";export*from"./duplicates.js";export*from"./lifecycle/reopen.js";export*from"./history-compact.js";export*from"./history-read.js";export*from"./history/maintenance.js";import{readHistorySnapshot}from"../core/history/read.js";export*from"./history-provenance.js";export*from"./mutation-events.js";export*from"./history-redact.js";import{_testOnly as _testOnly4}from"./history-redact.js";export*from"./history-repair.js";export*from"./item-children.js";export*from"./item-schedule.js";export*from"./merge/index.js";import{runDeps}from"./dependencies.js";export*from"./graph/index.js";import{runDocs}from"./docs.js";import{runFiles,runFilesDiscover,runFilesLookup}from"./files.js";import{applyPathMigrations,applyStandaloneNote,artifactKey,assertLinkedArtifactMutationIsUnambiguous,dedupeLinkedArtifacts,ensureScope,expandAddGlobEntries,normalizeLinkedPath,parseAddEntries,parseAddGlobEntries,parseMigrateEntries,parseRemoveEntries,renameArtifactsResultKey,runLinkedArtifacts,sortLinkedArtifacts,validateLinkedPaths}from"./linked-artifacts.js";export*from"./pagination.js";export*from"./query/item-filter-options.js";export*from"./query/parsers.js";export*from"./output.js";export*from"./output-contracts.js";export*from"./agent/task-transcript-contracts.js";export*from"./relationship-analytics.js";export*from"./relationship-context.js";export*from"./relationship-history.js";export*from"./relationship-migration.js";export*from"./workspace-transaction.js";export*from"./workspace-transaction-gc.js";export*from"./item-transaction.js";export*from"./item-metadata-index.js";export*from"./structured-mutations.js";export*from"./runtime-primitives.js";export*from"./error-runtime.js";export*from"./error-code-catalog.js";export*from"./generated-error-code-catalog.js";export*from"./agent/refusal-reachability.js";export*from"./agent/refusal-closure-census.js";export*from"./agent/refusal-closure.js";export*from"./agent/closed-domain-contracts.js";export*from"./agent/refusal-corpus-contracts.js";import{MERGE_SUBCOMMAND_VALUES}from"./cli-contracts.js";export*from"./agent/tracker-preflight-contracts.js";export*from"./agent/subcommand-recovery.js";export*from"./flag-invocation-contracts.js";export*from"./cli-contracts/flag-lexicon-contracts.js";export*from"./relationships.js";export*from"./actionability.js";import{runCreate}from"./lifecycle/create.js";import{runPlan}from"./lifecycle/plan.js";import{runAppend}from"./lifecycle/append.js";import{isAlreadyClaimedError,runClaim,runClaimNext,runRelease}from"./lifecycle/claim.js";import{runStartTask,runPauseTask,runCloseTask}from"./lifecycle/task-composition.js";import{runCloseMany}from"./lifecycle/close-many.js";import{runUpdateMany}from"./lifecycle/update-many.js";import{runComments}from"./comments.js";import{runNotes}from"./notes.js";import{runLearnings}from"./learnings.js";import{runUpgrade}from"./governance/upgrade.js";import{PLAN_SHOW_DEPTH_VALUES,PLAN_SUBCOMMANDS,PLAN_TEMPLATE_NAMES}from"./lifecycle/plan.js";export*from"./define.js";import{BASELINE_ITEM_FORMAT_VERSION,BUILTIN_ITEM_TYPE_VALUES,CONFIDENCE_TEXT_VALUES,CURRENT_ITEM_FORMAT_VERSION,DEPENDENCY_KIND_VALUES,EXIT_CODE,ISSUE_SEVERITY_VALUES,ITEM_TYPE_VALUES,PM_CLI_EXPECTED_ERROR_NAME,PmCliError,PmClient,RISK_VALUES,STATUS_VALUES,acquireLock,appendHistoryEntry,canonicalDocument,classifyItemFormatVersion,clearWorkspaceContractsCache,commitImportedItem,createHistoryEntry,createPmCliExpectedError,effectiveItemFormatVersion,emptyImportedDocument,ensureTrackerInitialized,generateItemId,getActiveExtensionRegistrations,getContracts,getHistoryPath,getItemPath,getSettingsPath,getWorkspaceContracts,isPmCliExpectedError,isTimestampLiteral,listAllItemMetadata,loadCreateTemplateOptions,locateItem,normalizeItemMetadata,normalizeItemFormatVersion,normalizeItemId,normalizeRawItemId,normalizeStatusInput,nowIso,parseTags,pathExists,readBooleanOption,readCsvListOption,readFileIfExists,readLocatedItem,readRequiredString,readSettings,readStringOption,removeFileIfExists,renderCalendarMarkdown,renderCalendarToon,renderGuideMarkdown,resolveCalendarOutputFormat,resolveGuideOutputFormat,resolveItemTypeRegistry,resolveImplicitPmRoot,resolvePmRoot,resolveRuntimeFieldRegistry,resolveRuntimeStatusRegistry,runAction,runActiveOnReadHooks,runActiveOnWriteHooks,runCalendar,runCompletion,runGuide,runList,runReindex,runSearch,runTemplatesList,runTemplatesSave,runTemplatesShow,runTestRunsList,runTestRunsLogs,runTestRunsResume,runTestRunsStatus,runTestRunsStop,scanItemFormatVersions,selectImportAuthor,serializeItemDocument,splitFrontMatter,toEstimatedMinutesValue,toImportBoolean,toImportConfidence,toImportInteger,toImportLinkedDocs,toImportLinkedFiles,toImportLinkedTests,toImportLogEntries,toImportNormalizedEnum,toImportNumberMap,toImportPriority,toImportStatus,toImportStringList,toImportStringMap,toImportTags,toNonEmptyImportString,writeFileAtomic,aggregate,append,claim,claimNext,close,reopen,closeTask,comments,config,context,copy,create,deleteItem,deps,docs,duplicates,extension,extensionActivate,extensionDeactivate,extensionList,files,filesDiscover,filesLookup,focus,gc,get,graph,health,historyCompact,historyCompactBulk,historyRedact,historyRepair,historyRepairAll,init,learnings,list,listAllComplete,next,notes,packageActivate,packageCatalog,packageDeactivate,packageDescribe,packageDoctor,packageInstall,packageLifecycle,packageList,packageManage,packageReload,packageUninstall,pauseTask,profile,profileApply,profileLint,profileList,profileShow,release,restore,schema,schemaAddField,schemaAddStatus,schemaAddType,schemaApplyPreset,schemaInferTypes,schemaList,schemaListFields,schemaRemapStatus,schemaRemoveField,schemaRemoveStatus,schemaRemoveType,schemaShow,schemaShowField,schemaShowStatus,schemaRenameField,schemaRenameType,search,startTask,stats,update,upgrade,validate}from"./runtime.js";import{extensionMigrate,packageMigrate}from"./package-migrations.js";import{CONTEXT_OUTPUT_VALUES,NEXT_OUTPUT_VALUES,PM_GITIGNORE_END,PM_GITIGNORE_START,analyzeSdkActionCoverage,ensurePmGitignore,getPmGitignoreBlock,closeItem,runAggregate,runClose,runCopy,runContext,runDelete,runFocus,runGet,runNext,runRestore,runUpdate}from"./runtime.js";import{runStats}from"./stats.js";import{readImprovementLedger,recordImprovementObservation}from"./improvement-ledger.js";import{evaluateProvenanceCoverage,projectFleetAttributionAnalytics,projectProvenanceCoverageAnalytics,readHistoryAnalyticsWindow,runFleetAttributionAnalytics,runProvenanceCoverageAnalytics}from"./history-analytics.js";import{DEFAULT_EVAL_QUERIES_RELATIVE_PATH,EVAL_QUERY_SET_CONTRACT,EVAL_QUERY_SET_EXAMPLE,EVAL_QUERY_SET_SCHEMA_ID,parseEvalQuerySet,runEval}from"./eval.js";import{runTelemetry,TELEMETRY_SUBCOMMANDS}from"./telemetry.js";import{classifyLinkedTestCommandSafety,classifyLinkedTestFailure,countFailureCategories,extractReferencedPmItemIdsFromCommand,resolveLinkedTestFailureExitCode,runLinkedTests,runTest,summarizeContextPreflight}from"./test/execution.js";import{TEST_RUN_MEASUREMENT_LIMIT,diffTestRunMeasurements,parseTestRunMeasurements,queryTestRunMeasurementsBelow}from"./test/measurements.js";import{runTestAll}from"./test/batch.js";import{LINKED_TEST_ENV_NAME_PATTERN,LINKED_TEST_PM_CONTEXT_MODE_VALUES,LINKED_TEST_WORKSPACE_CONTEXT_MODE_VALUES,LINKED_TEST_PROTECTED_ENV_KEYS,parseLinkedTestAssertionEqualsMap,parseLinkedTestAssertionGteMap,parseLinkedTestBoolean,parseLinkedTestContextMode,parseLinkedTestEnvClear,parseLinkedTestEnvSet,parseLinkedTestJsonEntries,parseLinkedTestMinLines,parseLinkedTestRegexList,parseLinkedTestStringList,parseLinkedTestWorkspaceContextMode}from"./test/parsers.js";import{acknowledgeLinkedTests,attachLinkedTestMutationProvenance,attachLinkedTestProvenance,linkedTestTrustFingerprint,resolveLinkedTestSourceRef,resolveLinkedTestSourceWorkspaceRoot,resolveLinkedTestTrust,resolveLinkedTestTrustBatch}from"./test/trust.js";import{runStartBackgroundRun,runTestRunsWorker}from"./test/runs.js";import{BUILTIN_PROFILES,listProfiles,normalizeProfileName,PROFILE_NAMES,resolveProfile}from"../core/profile/profile-presets.js";import{planProfileApplication}from"../core/profile/profile-plan.js";import{describeProfileComposition,describeProjectProfile}from"../core/profile/profile-describe.js";import{lintProjectProfile,PROFILE_LINT_CODES,PROFILE_LINT_DIMENSIONS}from"../core/profile/profile-lint.js";export*from"./authoring.js";export*from"./governance.js";export*from"./mcp/discovery.js";export*from"./query.js";export*from"./testing.js";export{ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS,ACTIVITY_FLAG_CONTRACTS,AGGREGATE_FLAG_CONTRACTS,APPEND_FLAG_CONTRACTS,ASSURANCE_FLAG_CONTRACTS,BASELINE_ITEM_FORMAT_VERSION,BUILTIN_CORPUS_SHAPES,BUILTIN_ITEM_TYPE_VALUES,BUILTIN_PROFILES,CALENDAR_COMMANDER_STRING_OPTION_CONTRACTS,CALENDAR_FLAG_CONTRACTS,CLAIM_FLAG_CONTRACTS,CLOSE_ACTION_OPTION_KEYS,CLOSE_FLAG_CONTRACTS,CLOSE_MANY_FLAG_CONTRACTS,CLOSE_TASK_FLAG_CONTRACTS,COMMENTS_FLAG_CONTRACTS,COMPLETION_FLAG_CONTRACTS,CONFIDENCE_TEXT_VALUES,CONFIG_FLAG_CONTRACTS,CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS,CONTEXT_FLAG_CONTRACTS,CONTEXT_OUTPUT_VALUES,CONTRACTS_FLAG_CONTRACTS,COPY_FLAG_CONTRACTS,CREATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS,CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS,CREATE_COMMANDER_STRING_OPTION_CONTRACTS,CREATE_FLAG_CONTRACTS,CURRENT_ITEM_FORMAT_VERSION,DEFAULT_EVAL_QUERIES_RELATIVE_PATH,DELETE_FLAG_CONTRACTS,DEPENDENCY_KIND_VALUES,DEPS_FLAG_CONTRACTS,DOCS_FLAG_CONTRACTS,DUPLICATES_FLAG_CONTRACTS,EVAL_FLAG_CONTRACTS,EVAL_QUERY_SET_CONTRACT,EVAL_QUERY_SET_EXAMPLE,EVAL_QUERY_SET_SCHEMA_ID,EVENTS_FLAG_CONTRACTS,EVENT_FLAG_CONTRACTS,EXECUTABLE_COMMAND_ALIASES,EXIT_CODE,EXTENSION_ACTIVATE_FLAG_CONTRACTS,EXTENSION_ADOPT_ALL_FLAG_CONTRACTS,EXTENSION_ADOPT_FLAG_CONTRACTS,EXTENSION_CATALOG_FLAG_CONTRACTS,EXTENSION_DEACTIVATE_FLAG_CONTRACTS,EXTENSION_DESCRIBE_FLAG_CONTRACTS,EXTENSION_DOCTOR_FLAG_CONTRACTS,EXTENSION_EXPLORE_FLAG_CONTRACTS,EXTENSION_FLAG_CONTRACTS,EXTENSION_INIT_FLAG_CONTRACTS,EXTENSION_INSTALL_FLAG_CONTRACTS,EXTENSION_MANAGE_FLAG_CONTRACTS,EXTENSION_MIGRATE_FLAG_CONTRACTS,EXTENSION_RELOAD_FLAG_CONTRACTS,EXTENSION_SCOPE_FLAG_CONTRACTS,EXTENSION_UNINSTALL_FLAG_CONTRACTS,FILES_FLAG_CONTRACTS,FOCUS_FLAG_CONTRACTS,GC_FLAG_CONTRACTS,GET_FLAG_CONTRACTS,GLOBAL_FLAG_CONTRACTS,GRAPH_FLAG_CONTRACTS,GUIDE_FLAG_CONTRACTS,HEALTH_FLAG_CONTRACTS,HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS,HISTORY_COMPACT_FLAG_CONTRACTS,HISTORY_EVENT_CLASSIFICATION_VERSION,HISTORY_FLAG_CONTRACTS,HISTORY_REDACT_FLAG_CONTRACTS,HISTORY_REPAIR_FLAG_CONTRACTS,INIT_AGENT_GUIDANCE_MODE_VALUES,INIT_FLAG_CONTRACTS,INSTALL_FLAG_CONTRACTS,ISSUE_SEVERITY_VALUES,ITEM_COMPLETE_FLAG_CONTRACTS,ITEM_MUTATE_FLAG_CONTRACTS,ITEM_REOPEN_FLAG_CONTRACTS,ITEM_TYPE_VALUES,LEARNINGS_FLAG_CONTRACTS,LINKED_TEST_ENV_NAME_PATTERN,LINKED_TEST_PM_CONTEXT_MODE_VALUES,LINKED_TEST_PROTECTED_ENV_KEYS,LINKED_TEST_WORKSPACE_CONTEXT_MODE_VALUES,LIST_COMMANDER_STRING_OPTION_CONTRACTS,LIST_FILTER_FLAG_CONTRACTS,MAINTENANCE_HISTORY_OPERATIONS,MEET_FLAG_CONTRACTS,MERGE_FLAG_CONTRACTS,MERGE_SUBCOMMAND_VALUES,NEXT_COMMANDER_STRING_OPTION_CONTRACTS,NEXT_FLAG_CONTRACTS,NEXT_OUTPUT_VALUES,NOTES_FLAG_CONTRACTS,PACKAGE_FLAG_CONTRACTS,PACKAGE_INIT_FLAG_CONTRACTS,PAUSE_TASK_FLAG_CONTRACTS,PLAN_CREATE_METADATA_PARAMETER_KEYS,PLAN_FLAG_CONTRACTS,PLAN_SHOW_DEPTH_VALUES,PLAN_SUBCOMMANDS,PLAN_TEMPLATE_NAMES,PM_BULK_LIFECYCLE_COMMAND_ALIASES,PM_CLI_EXPECTED_ERROR_NAME,PM_CLI_ONLY_TOOL_ACTION_WAIVERS,PM_COMMAND_ALIAS_CONTRACTS,PM_COMMAND_CAPABILITY_CONTRACTS,PM_COMMAND_OUTPUT_BUDGET_CONTRACTS,PM_COMMAND_VISIBILITY_CONTRACTS,PM_CONTEXT_OPS_COMMAND_ALIASES,PM_CORE_COMMAND_NAMES,PM_CORPUS_SHAPE_SCHEMA,PM_DEPRECATED_TOOL_ACTIONS,PM_DIAGNOSTIC_DEGRADATION_STEPS,PM_DIAGNOSTIC_OUTPUT_BUDGET_CONTRACTS,PM_DIAGNOSTIC_OUTPUT_CLASSES,PM_DISCOVERABLE_TOOL_ACTIONS,PM_EXACT_COVERAGE_METRICS,PM_EXTENSION_CAPABILITY_CONTRACTS,PM_EXTENSION_PACKAGE_ACTION_SUBCOMMANDS,PM_EXTENSION_POLICY_MODE_CONTRACTS,PM_EXTENSION_POLICY_SURFACE_CONTRACTS,PM_EXTENSION_SANDBOX_PROFILE_CONTRACTS,PM_EXTENSION_SERVICE_NAME_CONTRACTS,PM_EXTENSION_TRUST_MODE_CONTRACTS,PM_GITIGNORE_END,PM_GITIGNORE_START,PM_HISTORY_COMMAND_ALIASES,PM_ITEM_ACTION_SUBCOMMANDS,PM_MCP_PROMPT_CONTRACTS,PM_MCP_RESOURCE_CONTRACTS,PM_MCP_TOOL_COMMAND_CONTRACTS,PM_MUTATION_ACTION_CONTRACTS,PM_NAMESPACED_COMMAND_ALIASES,PM_OUTPUT_BUDGET_CLASSES,PM_OUTPUT_DEGRADATION_STEPS,PM_PACKAGE_CONVENTIONAL_RESOURCE_ROOTS,PM_PACKAGE_ONLY_ACTION_SUBCOMMANDS,PM_PACKAGE_RESOURCE_KINDS,PM_PROVIDER_TOOL_PARAMETERS_SCHEMA,PM_PROVIDER_TOOL_PARAMETERS_SCHEMA_VERSION,PM_RELOCATED_COMMAND_ALIASES,PM_REPRODUCIBLE_PROCESS_ENV,PM_TOOL_ACTIONS,PM_TOOL_ACTION_PARAMETER_CONTRACTS,PM_TOOL_PARAMETERS_SCHEMA,PM_TOOL_PARAMETERS_SCHEMA_MAJOR,PM_TOOL_PARAMETERS_SCHEMA_VERSION,PM_TOOL_RESERVED_CUSTOM_FIELD_PROPERTIES,PM_WORKSPACE_RECIPE_SCHEMA,PROFILE_FLAG_CONTRACTS,PROFILE_LINT_CODES,PROFILE_LINT_DIMENSIONS,PROFILE_NAMES,PROFILE_SUBCOMMANDS,PmCliError,PmClient,REINDEX_FLAG_CONTRACTS,RELEASE_FLAG_CONTRACTS,REMIND_FLAG_CONTRACTS,RESERVED_ITEM_FIELD_NAMES,RESTORE_FLAG_CONTRACTS,RISK_VALUES,SCHEMA_FLAG_CONTRACTS,SEARCH_COMMANDER_STRING_OPTION_CONTRACTS,SEARCH_FLAG_CONTRACTS,SNAPSHOT_SCHEMA,START_TASK_FLAG_CONTRACTS,STATS_FLAG_CONTRACTS,STATUS_VALUES,SUBCOMMAND_GLOBAL_FLAG_CONTRACTS,SUBSTANTIVE_HISTORY_OPERATIONS,TELEMETRY_FLAG_CONTRACTS,TELEMETRY_SUBCOMMANDS,TEST_ALL_FLAG_CONTRACTS,TEST_FLAG_CONTRACTS,TEST_RUNS_FLAG_CONTRACTS,TEST_RUN_MEASUREMENT_LIMIT,TOOL_ACTIVITY_OPTION_CONTRACTS,TOOL_AGGREGATE_OPTION_CONTRACTS,TOOL_BULK_MUTATION_FILTER_OPTION_CONTRACT_SOURCE,TOOL_CALENDAR_OPTION_CONTRACTS,TOOL_CLOSE_MANY_FILTER_OPTION_CONTRACTS,TOOL_CONTEXT_OPTION_CONTRACTS,TOOL_CREATE_OPTION_CONTRACTS,TOOL_CREATE_OPTION_CONTRACT_SOURCE,TOOL_DEPS_OPTION_CONTRACTS,TOOL_GRAPH_OPTION_CONTRACTS,TOOL_LIST_FILTER_OPTION_CONTRACTS,TOOL_SEARCH_FILTER_OPTION_CONTRACTS,TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACTS,TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACT_SOURCE,TOOL_UPDATE_MANY_FILTER_OPTION_CONTRACTS,TOOL_UPDATE_OPTION_CONTRACTS,TOOL_UPDATE_OPTION_CONTRACT_SOURCE,UPDATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS,UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS,UPDATE_COMMANDER_STRING_OPTION_CONTRACTS,UPDATE_FLAG_CONTRACTS,UPDATE_MANY_FLAG_CONTRACTS,UPGRADE_FLAG_CONTRACTS,VALIDATE_FLAG_CONTRACTS,WORKSPACE_FLAG_CONTRACTS,WORKSPACE_SNAPSHOT_ACTIONS,_testOnly4 as _testOnly,_testOnlyConfigCommand,_testOnlyHealthCommand,_testOnly3 as _testOnlyInit,_testOnly2 as _testOnlyInitAgentGuidance,_testOnly as _testOnlyTemplates,_testOnlyValidateCommand,acknowledgeLinkedTests,acknowledgeUnknownAuthorHistoryEvents,acknowledgeUnknownAuthorHistoryEventsFromTransport,acquireLock,aggregate,analyzePmToolActionParity,analyzeSdkActionCoverage,analyzeSdkCliParameterCompleteness,append,appendHistoryEntry,applyBootstrapPagerPolicy,applyInvocationAuthorOverride,applyPathMigrations,applyStandaloneNote,applyStoredExtensionMigrationState,artifactKey,assertInitializedTracker,assertLinkedArtifactMutationIsUnambiguous,assertReadableTrackerRoot,attachLinkedTestMutationProvenance,attachLinkedTestProvenance,auditMergeAttributeFence,buildCorpusShapeItemPlan,buildExtensionDescribeResult,buildExtensionInstallPlan,buildMergeAttributePatterns,buildPmActionToolInputSchema,buildTrackerInitializationRecovery,canonicalDocument,claim,claimNext,classifyHistoryEvent,classifyItemFormatVersion,classifyLinkedTestCommandSafety,classifyLinkedTestFailure,clearWorkspaceContractsCache,close,closeItem,closeTask,coalesceRepeatedListFlags,collectPackageExtensionDirectories,comments,commitImportedItem,compactFlagAliasContracts,config,context,copy,countFailureCategories,create,createCorpusShapeMeasurement,createExtensionCommandSdk,createHistoryEntry,createPmCliExpectedError,createPmCliProgram,createPmCommandOutputBudget,createReproducibleProcessRunner,createWorkspaceSnapshot,dedupeLinkedArtifacts,defineCorpusShape,definePmCommandOutputBudget,defineWorkspaceRecipe,deleteItem,deleteWorkspaceSnapshot,deps,deriveSchemaEvolutionMigrationId,describeItemOwnershipConflict,describeProfileComposition,describeProjectProfile,diffTestRunMeasurements,discoverNearbyPmRoot,docs,duplicates,effectiveItemFormatVersion,emptyImportedDocument,ensurePmGitignore,ensureScope,ensureTrackerInitialized,estimatePmOutputTokens,evaluateMutationGuard,evaluateProvenanceCoverage,evaluateSimilarityGovernance,executeWorkspaceRecipe,expandAddGlobEntries,extension,extensionActivate,extensionDeactivate,extensionList,extensionMigrate,extractReferencedPmItemIdsFromCommand,files,filesDiscover,filesLookup,findCoverageDeficits,findDuplicateClusters,findGitWorkspaceRoot,findInstalledNpmPackageCandidate,findPmNamespacedCommand,findSimilarItems,flushTelemetryQueue,focus,formatProfileApplyHuman,formatProfileLintHuman,formatProfileListHuman,formatProfileShowHuman,formatSchemaEvolutionMigrationHuman,gc,generateItemId,get,getActiveExtensionRegistrations,getContracts,getHistoryPath,getItemPath,getMutationActionContract,getPmGitignoreBlock,getSettingsPath,getWorkspaceContracts,graph,hasSubcommandFlagContractsForCommand,health,historyCompact,historyCompactBulk,historyRedact,historyRepair,historyRepairAll,inferPmOutputBudgetClass,init,inspectHistoryAuthorStream,inspectStaleInProgressItems,inspectWorkspaceSnapshot,installMergeFence,isAlreadyClaimedError,isErrnoError,isMutationAction,isPmCliExpectedError,isPmExtensionCapabilityContract,isPmExtensionPolicyModeContract,isPmExtensionPolicySurfaceContract,isPmExtensionServiceNameContract,isPmToolAction,isRuntimeRecord,isTimestampLiteral,jaccardSimilarity,learnings,limitAnnotationEntries,linkedTestTrustFingerprint,lintProjectProfile,list,listAliasPluralKeys,listAllComplete,listAllItemMetadata,listBuiltinCorpusShapes,listMutationActions,listPmCommandsForFamily,listPmCommandsForTier,listPmMcpToolsForProfile,listProfiles,listWorkspaceSnapshots,loadCreateTemplateOptions,locateItem,measureCorpusShapePlan,mergeLinkedTestTwoTokenEntries,next,normalizeAnnotationTransportOptions,normalizeBootstrapInvocation,normalizeItemFormatVersion,normalizeItemId,normalizeItemMetadata,normalizeLegacyExtensionActionSyntax,normalizeLinkedPath,normalizeProfileName,normalizeRawItemId,normalizeSimilarityText,normalizeStatusInput,notes,nowIso,packageActivate,packageCatalog,packageDeactivate,packageDescribe,packageDoctor,packageInstall,packageLifecycle,packageList,packageManage,packageMigrate,packageReload,packageUninstall,parseAddEntries,parseAddGlobEntries,parseAnnotationTextInput,parseBootstrapCommandName,parseBootstrapGlobalOptions,parseBootstrapHelpRequest,parseBootstrapTypeValue,parseEvalQuerySet,parseLinkedTestAssertionEqualsMap,parseLinkedTestAssertionGteMap,parseLinkedTestBoolean,parseLinkedTestContextMode,parseLinkedTestEnvClear,parseLinkedTestEnvSet,parseLinkedTestJsonEntries,parseLinkedTestMinLines,parseLinkedTestRegexList,parseLinkedTestStringList,parseLinkedTestWorkspaceContextMode,parseMigrateEntries,parseRemoveEntries,parseTags,parseTestRunMeasurements,parseUnknownAuthorHistoryEventCoordinates,pathExists,pauseTask,planExtensionDirectoryCopy,planProfileApplication,planSchemaEvolutionMigration,planUnknownAuthorHistoryAcknowledgment,planWorkspaceSnapshotRestore,prepareSimilarityText,profile,profileApply,profileLint,profileList,profileShow,projectFleetAttributionAnalytics,projectPmDiagnosticOutput,projectPmDiagnosticText,projectProvenanceCoverageAnalytics,projectValidateCounts,queryTestRunMeasurementsBelow,quoteCommandArg,quoteWindowsCommandArg,readAnnotationEntries,readBooleanOption,readCsvListOption,readExtensionMigrationState,readFileIfExists,readFirstStringFromCommanderOptions,readFirstValueFromCommanderOptions,readHistoryAnalyticsWindow,readHistorySnapshot,readImprovementLedger,readLocatedItem,readPmPackageManifest,readRequiredString,readSettings,readStringArrayFromCommanderOptions,readStringOption,recordImprovementObservation,refreshMergeAttributeFenceIfInstalled,release,removeFileIfExists,renameArtifactsResultKey,renderCalendarMarkdown,renderCalendarToon,renderExtensionDescribeMarkdown,renderGuideMarkdown,renderPmCommand,renderPmCommandAliasMigrationHint,renderPmCommandVisibilityMarkdown,reopen,resolveAnnotationIndex,resolveAnnotationInput,resolveBuiltinCorpusShape,resolveCalendarOutputFormat,resolveExtensionInstallSourceIdentity,resolveExtensionMigrationStatePath,resolveGuideOutputFormat,resolveImplicitPmRoot,resolveItemTypeRegistry,resolveLinkedTestFailureExitCode,resolveLinkedTestSourceRef,resolveLinkedTestSourceWorkspaceRoot,resolveLinkedTestTrust,resolveLinkedTestTrustBatch,resolveMergeInstallContext,resolvePmCommandAlias,resolvePmCommandCapabilityFamily,resolvePmCommandOperation,resolvePmCommandOutputBudget,resolvePmCommandVisibilityTier,resolvePmDiagnosticOutputBudget,resolvePmHistoryOperation,resolvePmPositionalActionFlagContracts,resolvePmRoot,resolvePmToolCustomFieldCollision,resolveProfile,resolveProjectMergeTypeFolders,resolveReproducibleProcessEnvironment,resolveRuntimeFieldRegistry,resolveRuntimeStatusRegistry,resolveStartTaskInProgressStatus,resolveSubcommandFlagContractsForCommand,resolveUnknownAuthorAcknowledgmentSelector,restore,restoreWorkspaceSnapshot,restoreWorkspaceSnapshotWithRecovery,runAction,runActiveOnReadHooks,runActiveOnWriteHooks,runAggregate,runAnnotationCommand,runAppend,runCalendar,runClaim,runClaimNext,runClose,runCloseMany,runCloseTask,runComments,runCompletion,runConfig,runContext,runCopy,runCreate,runDelete,runDeps,runDocs,runEval,runEvent,runExtension,runExtensionMigrateAction,runExtensionMigrations,runFiles,runFilesDiscover,runFilesLookup,runFleetAttributionAnalytics,runFocus,runGc,runGet,runGuide,runHealth,runInit,runInitAgentGuidance,runLearnings,runLinkedArtifacts,runLinkedTests,runList,runMeet,runMergeInstall,runNext,runNotes,runPauseTask,runPlan,runProfileApply,runProfileLint,runProfileList,runProfileShow,runProvenanceCoverageAnalytics,runReindex,runRelease,runRemind,runRestore,runSchemaEvolutionMigration,runSearch,runSearchRefreshWorkerEntrypoint,runStartBackgroundRun,runStartTask,runStats,runTelemetry,runTemplatesList,runTemplatesSave,runTemplatesShow,runTest,runTestAll,runTestRunsList,runTestRunsLogs,runTestRunsResume,runTestRunsStatus,runTestRunsStop,runTestRunsWorker,runUpdate,runUpdateMany,runUpgrade,runValidate,runWithActiveExtensions,runWithReproducibleProcessEnvironment,runWithWorkspaceRecipe,scanHistoryAuthorAttribution,scanItemFormatVersions,scanMutationSecrets,scanStaleInProgressItems,schema,schemaAddField,schemaAddStatus,schemaAddType,schemaApplyPreset,schemaInferTypes,schemaList,schemaListFields,schemaRemapStatus,schemaRemoveField,schemaRemoveStatus,schemaRemoveType,schemaRenameField,schemaRenameType,schemaShow,schemaShowField,schemaShowStatus,scoreItemSimilarity,scorePreparedItemSimilarity,search,selectImportAuthor,serializeItemDocument,similarityAdvisoryWarnings,sortLinkedArtifacts,splitFrontMatter,startTask,stats,stripGlobalBootstrapTokens,summarizeContextPreflight,summarizeInitResult,toCompletionFlagString,toEstimatedMinutesValue,toImportBoolean,toImportConfidence,toImportInteger,toImportLinkedDocs,toImportLinkedFiles,toImportLinkedTests,toImportLogEntries,toImportNormalizedEnum,toImportNumberMap,toImportPriority,toImportStatus,toImportStringList,toImportStringMap,toImportTags,toNonEmptyImportString,tokenizeSimilarityText,update,upgrade,validate,validateLinkedPaths,verifyToolOptionCliParity,withFlagAliasMetadata,wrapOwnershipConflict,writeFileAtomic};
|
|
1
|
+
!(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f5d5516b-01ec-51b3-a7a0-e611b4622581")}catch(e2){}})();import{PM_COMMAND_CAPABILITY_CONTRACTS,PM_COMMAND_VISIBILITY_CONTRACTS,PM_MCP_PROMPT_CONTRACTS,PM_MCP_RESOURCE_CONTRACTS,PM_MCP_TOOL_COMMAND_CONTRACTS,listPmCommandsForFamily,listPmCommandsForTier,listPmMcpToolsForProfile,renderPmCommandVisibilityMarkdown,resolvePmCommandCapabilityFamily,resolvePmCommandVisibilityTier}from"./agent-capability-contracts.js";export*from"./mcp/protocol.js";export*from"./mcp/interactions.js";export*from"./mcp/tasks.js";export*from"./mcp/subscriptions.js";export*from"./mcp/transport.js";export*from"./mcp/authorization.js";export*from"./mcp/apps.js";export*from"./mcp/skills.js";export*from"./cli-contracts/grammar-contracts.js";export*from"./agent-session-context.js";export*from"./environment/agent-environment.js";import{isErrnoError,limitAnnotationEntries,parseAnnotationTextInput,readAnnotationEntries,normalizeAnnotationTransportOptions,resolveAnnotationInput,resolveAnnotationIndex,runAnnotationCommand,wrapOwnershipConflict}from"./annotations.js";import{acknowledgeUnknownAuthorHistoryEvents,acknowledgeUnknownAuthorHistoryEventsFromTransport,inspectHistoryAuthorStream,parseUnknownAuthorHistoryEventCoordinates,planUnknownAuthorHistoryAcknowledgment,resolveUnknownAuthorAcknowledgmentSelector,scanHistoryAuthorAttribution}from"./author-attribution.js";import{BUILTIN_CORPUS_SHAPES,PM_CORPUS_SHAPE_SCHEMA,buildCorpusShapeItemPlan,createCorpusShapeMeasurement,defineCorpusShape,listBuiltinCorpusShapes,measureCorpusShapePlan,resolveBuiltinCorpusShape}from"./corpus-shape.js";export*from"./core-governance.js";import{createPmCliProgram}from"./cli-program.js";import{runSearchRefreshWorkerEntrypoint}from"./search-refresh-worker.js";import{PM_REPRODUCIBLE_PROCESS_ENV,createReproducibleProcessRunner,resolveReproducibleProcessEnvironment,runWithReproducibleProcessEnvironment}from"./reproducibility/process.js";import{PM_WORKSPACE_RECIPE_SCHEMA,defineWorkspaceRecipe,executeWorkspaceRecipe,runWithWorkspaceRecipe}from"./workspace-recipe.js";import{SNAPSHOT_SCHEMA,WORKSPACE_SNAPSHOT_ACTIONS,createWorkspaceSnapshot,deleteWorkspaceSnapshot,inspectWorkspaceSnapshot,listWorkspaceSnapshots,planWorkspaceSnapshotRestore,restoreWorkspaceSnapshot,restoreWorkspaceSnapshotWithRecovery}from"./workspace-snapshot.js";import{flushTelemetryQueue}from"./telemetry-flush.js";import{PM_HISTORY_COMMAND_ALIASES,PM_CONTEXT_OPS_COMMAND_ALIASES,PM_BULK_LIFECYCLE_COMMAND_ALIASES,PM_RELOCATED_COMMAND_ALIASES,PM_NAMESPACED_COMMAND_ALIASES,findPmNamespacedCommand,resolvePmCommandOperation,resolvePmHistoryOperation}from"./cli-contracts.js";import{EXECUTABLE_COMMAND_ALIASES,PM_COMMAND_ALIAS_CONTRACTS,renderPmCommandAliasMigrationHint,resolvePmCommandAlias,applyBootstrapPagerPolicy,coalesceRepeatedListFlags,listAliasPluralKeys,mergeLinkedTestTwoTokenEntries,normalizeBootstrapInvocation,normalizeLegacyExtensionActionSyntax,parseBootstrapCommandName,parseBootstrapGlobalOptions,parseBootstrapHelpRequest,parseBootstrapTypeValue,stripGlobalBootstrapTokens}from"./cli-bootstrap.js";import{quoteCommandArg,quoteWindowsCommandArg,renderPmCommand}from"./command-line.js";export*from"./agent/command-recovery.js";export*from"./agent/command-suggestions.js";export*from"./agent/item-addressing.js";export*from"./agent/create-option-policy.js";import{runGc}from"./governance/gc.js";import{PM_EXACT_COVERAGE_METRICS,findCoverageDeficits}from"./governance/coverage-assurance.js";import{_testOnlyHealthCommand,runHealth}from"./governance/health.js";import{_testOnlyValidateCommand,projectValidateCounts,runValidate}from"./governance/validate.js";import{runExtension}from"./extension.js";import{buildExtensionInstallPlan,planExtensionDirectoryCopy}from"./extension/install-plan.js";import{resolveExtensionInstallSourceIdentity}from"./extension/source-resolution.js";import{applyStoredExtensionMigrationState,readExtensionMigrationState,resolveExtensionMigrationStatePath,runExtensionMigrateAction,runExtensionMigrations}from"./extension/migrations.js";import{findInstalledNpmPackageCandidate}from"./extension/install-sources.js";import{buildExtensionDescribeResult,renderExtensionDescribeMarkdown}from"./extension/describe.js";import{runEvent,runMeet,runRemind}from"./scheduling-shortcuts.js";import{createExtensionCommandSdk}from"./extension-command-context.js";import{isRuntimeRecord}from"./runtime-input.js";import{resolveStartTaskInProgressStatus}from"./start-task-status.js";import{auditMergeAttributeFence,buildMergeAttributePatterns,findGitWorkspaceRoot,installMergeFence,refreshMergeAttributeFenceIfInstalled,resolveMergeInstallContext,resolveProjectMergeTypeFolders,runMergeInstall}from"./merge/install.js";import{deriveSchemaEvolutionMigrationId,formatSchemaEvolutionMigrationHuman,planSchemaEvolutionMigration,runSchemaEvolutionMigration}from"./schema-migration.js";import{runWithActiveExtensions}from"./runtime.js";import{applyInvocationAuthorOverride}from"./invocation-author.js";import{evaluateMutationGuard,getMutationActionContract,isMutationAction,listMutationActions,PM_MUTATION_ACTION_CONTRACTS,scanMutationSecrets}from"./mutation-guard.js";import{findSimilarItems,findDuplicateClusters,evaluateSimilarityGovernance,similarityAdvisoryWarnings,jaccardSimilarity,normalizeSimilarityText,prepareSimilarityText,scoreItemSimilarity,scorePreparedItemSimilarity,tokenizeSimilarityText}from"./similarity.js";import{inspectStaleInProgressItems,scanStaleInProgressItems}from"./governance/stale-work.js";import{describeItemOwnershipConflict}from"./ownership-source.js";import{discoverNearbyPmRoot}from"./tracker-root-discovery.js";import{assertInitializedTracker,assertReadableTrackerRoot,buildTrackerInitializationRecovery}from"./environment/tracker-preflight.js";import{_testOnly}from"./templates.js";import{runConfig,_testOnlyConfigCommand}from"./config.js";export*from"./agent/identity-config.js";import{INIT_AGENT_GUIDANCE_MODE_VALUES,runInitAgentGuidance,_testOnly as _testOnly2}from"./init-agent-guidance.js";import{runInit,summarizeInitResult,_testOnly as _testOnly3}from"./init.js";import{PROFILE_SUBCOMMANDS,formatProfileApplyHuman,formatProfileLintHuman,formatProfileListHuman,formatProfileShowHuman,runProfileApply,runProfileLint,runProfileList,runProfileShow}from"./profile.js";export*from"./extension-contracts.js";import{RESERVED_ITEM_FIELD_NAMES}from"../core/extensions/item-fields.js";import{PM_PACKAGE_CONVENTIONAL_RESOURCE_ROOTS,PM_PACKAGE_RESOURCE_KINDS,collectPackageExtensionDirectories,readPmPackageManifest}from"../core/packages/manifest.js";import{ACTIVITY_FLAG_CONTRACTS,ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS,AGGREGATE_FLAG_CONTRACTS,ASSURANCE_FLAG_CONTRACTS,APPEND_FLAG_CONTRACTS,CALENDAR_COMMANDER_STRING_OPTION_CONTRACTS,CALENDAR_FLAG_CONTRACTS,CLAIM_FLAG_CONTRACTS,CLOSE_ACTION_OPTION_KEYS,CLOSE_FLAG_CONTRACTS,CLOSE_MANY_FLAG_CONTRACTS,CLOSE_TASK_FLAG_CONTRACTS,COMMENTS_FLAG_CONTRACTS,COMPLETION_FLAG_CONTRACTS,CONFIG_FLAG_CONTRACTS,CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS,CONTEXT_FLAG_CONTRACTS,CONTRACTS_FLAG_CONTRACTS,COPY_FLAG_CONTRACTS,CREATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS,CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS,CREATE_COMMANDER_STRING_OPTION_CONTRACTS,CREATE_FLAG_CONTRACTS,DELETE_FLAG_CONTRACTS,DEPS_FLAG_CONTRACTS,DOCS_FLAG_CONTRACTS,EVAL_FLAG_CONTRACTS,EVENT_FLAG_CONTRACTS,EVENTS_FLAG_CONTRACTS,EXTENSION_ACTIVATE_FLAG_CONTRACTS,EXTENSION_ADOPT_ALL_FLAG_CONTRACTS,EXTENSION_ADOPT_FLAG_CONTRACTS,EXTENSION_CATALOG_FLAG_CONTRACTS,EXTENSION_DEACTIVATE_FLAG_CONTRACTS,EXTENSION_DESCRIBE_FLAG_CONTRACTS,EXTENSION_DOCTOR_FLAG_CONTRACTS,EXTENSION_EXPLORE_FLAG_CONTRACTS,EXTENSION_FLAG_CONTRACTS,EXTENSION_INIT_FLAG_CONTRACTS,EXTENSION_INSTALL_FLAG_CONTRACTS,EXTENSION_MANAGE_FLAG_CONTRACTS,EXTENSION_MIGRATE_FLAG_CONTRACTS,EXTENSION_RELOAD_FLAG_CONTRACTS,EXTENSION_SCOPE_FLAG_CONTRACTS,EXTENSION_UNINSTALL_FLAG_CONTRACTS,FILES_FLAG_CONTRACTS,FOCUS_FLAG_CONTRACTS,GC_FLAG_CONTRACTS,GET_FLAG_CONTRACTS,GRAPH_FLAG_CONTRACTS,GLOBAL_FLAG_CONTRACTS,GUIDE_FLAG_CONTRACTS,HEALTH_FLAG_CONTRACTS,HISTORY_COMPACT_FLAG_CONTRACTS,HISTORY_FLAG_CONTRACTS,HISTORY_REDACT_FLAG_CONTRACTS,HISTORY_REPAIR_FLAG_CONTRACTS,HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS,INIT_FLAG_CONTRACTS,INSTALL_FLAG_CONTRACTS,ITEM_MUTATE_FLAG_CONTRACTS,ITEM_COMPLETE_FLAG_CONTRACTS,ITEM_REOPEN_FLAG_CONTRACTS,LEARNINGS_FLAG_CONTRACTS,LIST_COMMANDER_STRING_OPTION_CONTRACTS,LIST_FILTER_FLAG_CONTRACTS,MEET_FLAG_CONTRACTS,MERGE_FLAG_CONTRACTS,NEXT_COMMANDER_STRING_OPTION_CONTRACTS,NEXT_FLAG_CONTRACTS,NOTES_FLAG_CONTRACTS,PACKAGE_FLAG_CONTRACTS,PACKAGE_INIT_FLAG_CONTRACTS,PAUSE_TASK_FLAG_CONTRACTS,PLAN_CREATE_METADATA_PARAMETER_KEYS,PLAN_FLAG_CONTRACTS,PM_COMMAND_OUTPUT_BUDGET_CONTRACTS,PM_DIAGNOSTIC_DEGRADATION_STEPS,PM_DIAGNOSTIC_OUTPUT_BUDGET_CONTRACTS,PM_DIAGNOSTIC_OUTPUT_CLASSES,PM_CLI_ONLY_TOOL_ACTION_WAIVERS,PM_CORE_COMMAND_NAMES,PM_EXTENSION_PACKAGE_ACTION_SUBCOMMANDS,PM_PACKAGE_ONLY_ACTION_SUBCOMMANDS,PM_ITEM_ACTION_SUBCOMMANDS,PM_DEPRECATED_TOOL_ACTIONS,PM_DISCOVERABLE_TOOL_ACTIONS,PM_EXTENSION_CAPABILITY_CONTRACTS,PM_EXTENSION_POLICY_MODE_CONTRACTS,PM_EXTENSION_POLICY_SURFACE_CONTRACTS,PM_EXTENSION_SANDBOX_PROFILE_CONTRACTS,PM_EXTENSION_SERVICE_NAME_CONTRACTS,PM_EXTENSION_TRUST_MODE_CONTRACTS,PM_PROVIDER_TOOL_PARAMETERS_SCHEMA,PM_PROVIDER_TOOL_PARAMETERS_SCHEMA_VERSION,PM_TOOL_ACTIONS,analyzePmToolActionParity,PM_TOOL_ACTION_PARAMETER_CONTRACTS,PM_TOOL_PARAMETERS_SCHEMA,PM_TOOL_PARAMETERS_SCHEMA_MAJOR,PM_TOOL_PARAMETERS_SCHEMA_VERSION,PM_OUTPUT_BUDGET_CLASSES,PM_OUTPUT_DEGRADATION_STEPS,PROFILE_FLAG_CONTRACTS,REINDEX_FLAG_CONTRACTS,RELEASE_FLAG_CONTRACTS,REMIND_FLAG_CONTRACTS,RESTORE_FLAG_CONTRACTS,SCHEMA_FLAG_CONTRACTS,SEARCH_COMMANDER_STRING_OPTION_CONTRACTS,SEARCH_FLAG_CONTRACTS,START_TASK_FLAG_CONTRACTS,STATS_FLAG_CONTRACTS,DUPLICATES_FLAG_CONTRACTS,SUBCOMMAND_GLOBAL_FLAG_CONTRACTS,TELEMETRY_FLAG_CONTRACTS,TEST_ALL_FLAG_CONTRACTS,TEST_FLAG_CONTRACTS,TEST_RUNS_FLAG_CONTRACTS,TOOL_ACTIVITY_OPTION_CONTRACTS,TOOL_AGGREGATE_OPTION_CONTRACTS,TOOL_BULK_MUTATION_FILTER_OPTION_CONTRACT_SOURCE,TOOL_CALENDAR_OPTION_CONTRACTS,TOOL_CLOSE_MANY_FILTER_OPTION_CONTRACTS,TOOL_CONTEXT_OPTION_CONTRACTS,TOOL_CREATE_OPTION_CONTRACTS,TOOL_CREATE_OPTION_CONTRACT_SOURCE,TOOL_DEPS_OPTION_CONTRACTS,TOOL_GRAPH_OPTION_CONTRACTS,TOOL_LIST_FILTER_OPTION_CONTRACTS,TOOL_SEARCH_FILTER_OPTION_CONTRACTS,TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACTS,TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACT_SOURCE,TOOL_UPDATE_MANY_FILTER_OPTION_CONTRACTS,TOOL_UPDATE_OPTION_CONTRACTS,TOOL_UPDATE_OPTION_CONTRACT_SOURCE,verifyToolOptionCliParity,UPDATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS,UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS,UPDATE_COMMANDER_STRING_OPTION_CONTRACTS,UPDATE_FLAG_CONTRACTS,UPDATE_MANY_FLAG_CONTRACTS,UPGRADE_FLAG_CONTRACTS,VALIDATE_FLAG_CONTRACTS,WORKSPACE_FLAG_CONTRACTS,buildPmActionToolInputSchema,PM_TOOL_RESERVED_CUSTOM_FIELD_PROPERTIES,compactFlagAliasContracts,createPmCommandOutputBudget,definePmCommandOutputBudget,estimatePmOutputTokens,inferPmOutputBudgetClass,projectPmDiagnosticOutput,projectPmDiagnosticText,analyzeSdkCliParameterCompleteness,isPmExtensionCapabilityContract,isPmExtensionPolicyModeContract,isPmExtensionPolicySurfaceContract,isPmExtensionServiceNameContract,isPmToolAction,hasSubcommandFlagContractsForCommand,readFirstStringFromCommanderOptions,readFirstValueFromCommanderOptions,readStringArrayFromCommanderOptions,resolvePmPositionalActionFlagContracts,resolveSubcommandFlagContractsForCommand,resolvePmCommandOutputBudget,resolvePmDiagnosticOutputBudget,resolvePmToolCustomFieldCollision,toCompletionFlagString,withFlagAliasMetadata}from"./cli-contracts.js";export*from"./compose.js";export*from"./governance/assurance.js";export*from"./governance/assurance-action.js";export*from"./governance/assurance-runtime.js";export*from"./governance/assurance-presets.js";export*from"./governance/boundary-fixtures.js";export*from"./governance/defect-recurrence.js";export*from"./governance/merge-receipt-history.js";export*from"./compile-cache.js";export*from"./environment/project-runtime-compatibility.js";export*from"./environment/source-context.js";export*from"./environment/host-environment-errors.js";export*from"./cli-contracts/command-exit-contracts.js";export*from"./context-relevance.js";export*from"./context/recency.js";export*from"./context-intent-contracts.js";export*from"./context-intent-runtime.js";export*from"./context-signal-store.js";export*from"./workspace-memory.js";export*from"./lifecycle-completion.js";export*from"./lifecycle-policy.js";export*from"./output-projection.js";export*from"./read-output-contracts.js";export*from"./read-output-rows.js";export*from"./read-output-session.js";export*from"./output-token-accounting.js";export*from"./context-packing.js";export*from"./context-usage.js";import{classifyHistoryEvent,HISTORY_EVENT_CLASSIFICATION_VERSION,MAINTENANCE_HISTORY_OPERATIONS,SUBSTANTIVE_HISTORY_OPERATIONS}from"../core/history/event-classification.js";export*from"./dependency-provenance.js";export*from"./duplicates.js";export*from"./lifecycle/reopen.js";export*from"./history-compact.js";export*from"./history-read.js";export*from"../core/history/operation-contract.js";export*from"./history/maintenance.js";import{readHistorySnapshot}from"../core/history/read.js";export*from"./history-provenance.js";export*from"./mutation-events.js";export*from"./history-redact.js";import{_testOnly as _testOnly4}from"./history-redact.js";export*from"./history-repair.js";export*from"./item-children.js";export*from"./item-schedule.js";export*from"./merge/index.js";import{runDeps}from"./dependencies.js";export*from"./graph/index.js";import{runDocs}from"./docs.js";import{runFiles,runFilesDiscover,runFilesLookup}from"./files.js";import{applyPathMigrations,applyStandaloneNote,artifactKey,assertLinkedArtifactMutationIsUnambiguous,dedupeLinkedArtifacts,ensureScope,expandAddGlobEntries,normalizeLinkedPath,parseAddEntries,parseAddGlobEntries,parseMigrateEntries,parseRemoveEntries,renameArtifactsResultKey,runLinkedArtifacts,sortLinkedArtifacts,validateLinkedPaths}from"./linked-artifacts.js";export*from"./pagination.js";export*from"./query/item-filter-options.js";export*from"./query/parsers.js";export*from"./output.js";export*from"./output-contracts.js";export*from"./agent/task-transcript-contracts.js";export*from"./relationship-analytics.js";export*from"./relationship-context.js";export*from"./relationship-history.js";export*from"./relationship-migration.js";export*from"./workspace-transaction.js";export*from"./workspace-transaction-gc.js";export*from"./item-transaction.js";export*from"./item-metadata-index.js";export*from"./structured-mutations.js";export*from"./runtime-primitives.js";export*from"./error-runtime.js";export*from"./error-code-catalog.js";export*from"./generated-error-code-catalog.js";export*from"./agent/refusal-reachability.js";export*from"./agent/refusal-closure-census.js";export*from"./agent/refusal-closure.js";export*from"./agent/closed-domain-contracts.js";export*from"./agent/refusal-corpus-contracts.js";import{MERGE_SUBCOMMAND_VALUES}from"./cli-contracts.js";export*from"./agent/tracker-preflight-contracts.js";export*from"./agent/subcommand-recovery.js";export*from"./flag-invocation-contracts.js";export*from"./cli-contracts/flag-lexicon-contracts.js";export*from"./relationships.js";export*from"./actionability.js";import{runCreate}from"./lifecycle/create.js";import{runPlan}from"./lifecycle/plan.js";import{runAppend}from"./lifecycle/append.js";import{isAlreadyClaimedError,runClaim,runClaimNext,runRelease}from"./lifecycle/claim.js";import{runStartTask,runPauseTask,runCloseTask}from"./lifecycle/task-composition.js";import{runCloseMany}from"./lifecycle/close-many.js";import{runUpdateMany}from"./lifecycle/update-many.js";import{runComments}from"./comments.js";import{runNotes}from"./notes.js";import{runLearnings}from"./learnings.js";import{runUpgrade}from"./governance/upgrade.js";import{PLAN_SHOW_DEPTH_VALUES,PLAN_SUBCOMMANDS,PLAN_TEMPLATE_NAMES}from"./lifecycle/plan.js";export*from"./define.js";import{BASELINE_ITEM_FORMAT_VERSION,BUILTIN_ITEM_TYPE_VALUES,CONFIDENCE_TEXT_VALUES,CURRENT_ITEM_FORMAT_VERSION,DEPENDENCY_KIND_VALUES,EXIT_CODE,ISSUE_SEVERITY_VALUES,ITEM_TYPE_VALUES,PM_CLI_EXPECTED_ERROR_NAME,PmCliError,PmClient,RISK_VALUES,STATUS_VALUES,acquireLock,appendHistoryEntry,canonicalDocument,classifyItemFormatVersion,clearWorkspaceContractsCache,commitImportedItem,createHistoryEntry,createPmCliExpectedError,effectiveItemFormatVersion,emptyImportedDocument,ensureTrackerInitialized,generateItemId,getActiveExtensionRegistrations,getContracts,getHistoryPath,getItemPath,getSettingsPath,getWorkspaceContracts,isPmCliExpectedError,isTimestampLiteral,listAllItemMetadata,loadCreateTemplateOptions,locateItem,normalizeItemMetadata,normalizeItemFormatVersion,normalizeItemId,normalizeRawItemId,normalizeStatusInput,nowIso,parseTags,pathExists,readBooleanOption,readCsvListOption,readFileIfExists,readLocatedItem,readRequiredString,readSettings,readStringOption,removeFileIfExists,renderCalendarMarkdown,renderCalendarToon,renderGuideMarkdown,resolveCalendarOutputFormat,resolveGuideOutputFormat,resolveItemTypeRegistry,resolveImplicitPmRoot,resolvePmRoot,resolveRuntimeFieldRegistry,resolveRuntimeStatusRegistry,runAction,runActiveOnReadHooks,runActiveOnWriteHooks,runCalendar,runCompletion,runGuide,runList,runReindex,runSearch,runTemplatesList,runTemplatesSave,runTemplatesShow,runTestRunsList,runTestRunsLogs,runTestRunsResume,runTestRunsStatus,runTestRunsStop,scanItemFormatVersions,selectImportAuthor,serializeItemDocument,splitFrontMatter,toEstimatedMinutesValue,toImportBoolean,toImportConfidence,toImportInteger,toImportLinkedDocs,toImportLinkedFiles,toImportLinkedTests,toImportLogEntries,toImportNormalizedEnum,toImportNumberMap,toImportPriority,toImportStatus,toImportStringList,toImportStringMap,toImportTags,toNonEmptyImportString,writeFileAtomic,aggregate,append,claim,claimNext,close,reopen,closeTask,comments,config,context,copy,create,deleteItem,deps,docs,duplicates,extension,extensionActivate,extensionDeactivate,extensionList,files,filesDiscover,filesLookup,focus,gc,get,graph,health,historyCompact,historyCompactBulk,historyRedact,historyRepair,historyRepairAll,init,learnings,list,listAllComplete,next,notes,packageActivate,packageCatalog,packageDeactivate,packageDescribe,packageDoctor,packageInstall,packageLifecycle,packageList,packageManage,packageReload,packageUninstall,pauseTask,profile,profileApply,profileLint,profileList,profileShow,release,restore,schema,schemaAddField,schemaAddStatus,schemaAddType,schemaApplyPreset,schemaInferTypes,schemaList,schemaListFields,schemaRemapStatus,schemaRemoveField,schemaRemoveStatus,schemaRemoveType,schemaShow,schemaShowField,schemaShowStatus,schemaRenameField,schemaRenameType,search,startTask,stats,update,upgrade,validate}from"./runtime.js";import{extensionMigrate,packageMigrate}from"./package-migrations.js";import{CONTEXT_OUTPUT_VALUES,NEXT_OUTPUT_VALUES,PM_GITIGNORE_END,PM_GITIGNORE_START,analyzeSdkActionCoverage,ensurePmGitignore,getPmGitignoreBlock,closeItem,runAggregate,runClose,runCopy,runContext,runDelete,runFocus,runGet,runNext,runRestore,runUpdate}from"./runtime.js";import{runStats}from"./stats.js";import{readImprovementLedger,recordImprovementObservation}from"./improvement-ledger.js";import{evaluateProvenanceCoverage,projectFleetAttributionAnalytics,projectProvenanceCoverageAnalytics,readHistoryAnalyticsWindow,runFleetAttributionAnalytics,runProvenanceCoverageAnalytics}from"./history-analytics.js";import{DEFAULT_EVAL_QUERIES_RELATIVE_PATH,EVAL_QUERY_SET_CONTRACT,EVAL_QUERY_SET_EXAMPLE,EVAL_QUERY_SET_SCHEMA_ID,parseEvalQuerySet,runEval}from"./eval.js";import{runTelemetry,TELEMETRY_SUBCOMMANDS}from"./telemetry.js";import{classifyLinkedTestCommandSafety,classifyLinkedTestFailure,countFailureCategories,extractReferencedPmItemIdsFromCommand,resolveLinkedTestFailureExitCode,runLinkedTests,runTest,summarizeContextPreflight}from"./test/execution.js";import{TEST_RUN_MEASUREMENT_LIMIT,diffTestRunMeasurements,parseTestRunMeasurements,queryTestRunMeasurementsBelow}from"./test/measurements.js";import{runTestAll}from"./test/batch.js";import{LINKED_TEST_ENV_NAME_PATTERN,LINKED_TEST_PM_CONTEXT_MODE_VALUES,LINKED_TEST_WORKSPACE_CONTEXT_MODE_VALUES,LINKED_TEST_PROTECTED_ENV_KEYS,parseLinkedTestAssertionEqualsMap,parseLinkedTestAssertionGteMap,parseLinkedTestBoolean,parseLinkedTestContextMode,parseLinkedTestEnvClear,parseLinkedTestEnvSet,parseLinkedTestJsonEntries,parseLinkedTestMinLines,parseLinkedTestRegexList,parseLinkedTestStringList,parseLinkedTestWorkspaceContextMode}from"./test/parsers.js";import{acknowledgeLinkedTests,attachLinkedTestMutationProvenance,attachLinkedTestProvenance,linkedTestTrustFingerprint,resolveLinkedTestSourceRef,resolveLinkedTestSourceWorkspaceRoot,resolveLinkedTestTrust,resolveLinkedTestTrustBatch}from"./test/trust.js";import{runStartBackgroundRun,runTestRunsWorker}from"./test/runs.js";import{BUILTIN_PROFILES,listProfiles,normalizeProfileName,PROFILE_NAMES,resolveProfile}from"../core/profile/profile-presets.js";import{planProfileApplication}from"../core/profile/profile-plan.js";import{describeProfileComposition,describeProjectProfile}from"../core/profile/profile-describe.js";import{lintProjectProfile,PROFILE_LINT_CODES,PROFILE_LINT_DIMENSIONS}from"../core/profile/profile-lint.js";export*from"./authoring.js";export*from"./governance.js";export*from"./mcp/discovery.js";export*from"./query.js";export*from"./testing.js";export{ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS,ACTIVITY_FLAG_CONTRACTS,AGGREGATE_FLAG_CONTRACTS,APPEND_FLAG_CONTRACTS,ASSURANCE_FLAG_CONTRACTS,BASELINE_ITEM_FORMAT_VERSION,BUILTIN_CORPUS_SHAPES,BUILTIN_ITEM_TYPE_VALUES,BUILTIN_PROFILES,CALENDAR_COMMANDER_STRING_OPTION_CONTRACTS,CALENDAR_FLAG_CONTRACTS,CLAIM_FLAG_CONTRACTS,CLOSE_ACTION_OPTION_KEYS,CLOSE_FLAG_CONTRACTS,CLOSE_MANY_FLAG_CONTRACTS,CLOSE_TASK_FLAG_CONTRACTS,COMMENTS_FLAG_CONTRACTS,COMPLETION_FLAG_CONTRACTS,CONFIDENCE_TEXT_VALUES,CONFIG_FLAG_CONTRACTS,CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS,CONTEXT_FLAG_CONTRACTS,CONTEXT_OUTPUT_VALUES,CONTRACTS_FLAG_CONTRACTS,COPY_FLAG_CONTRACTS,CREATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS,CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS,CREATE_COMMANDER_STRING_OPTION_CONTRACTS,CREATE_FLAG_CONTRACTS,CURRENT_ITEM_FORMAT_VERSION,DEFAULT_EVAL_QUERIES_RELATIVE_PATH,DELETE_FLAG_CONTRACTS,DEPENDENCY_KIND_VALUES,DEPS_FLAG_CONTRACTS,DOCS_FLAG_CONTRACTS,DUPLICATES_FLAG_CONTRACTS,EVAL_FLAG_CONTRACTS,EVAL_QUERY_SET_CONTRACT,EVAL_QUERY_SET_EXAMPLE,EVAL_QUERY_SET_SCHEMA_ID,EVENTS_FLAG_CONTRACTS,EVENT_FLAG_CONTRACTS,EXECUTABLE_COMMAND_ALIASES,EXIT_CODE,EXTENSION_ACTIVATE_FLAG_CONTRACTS,EXTENSION_ADOPT_ALL_FLAG_CONTRACTS,EXTENSION_ADOPT_FLAG_CONTRACTS,EXTENSION_CATALOG_FLAG_CONTRACTS,EXTENSION_DEACTIVATE_FLAG_CONTRACTS,EXTENSION_DESCRIBE_FLAG_CONTRACTS,EXTENSION_DOCTOR_FLAG_CONTRACTS,EXTENSION_EXPLORE_FLAG_CONTRACTS,EXTENSION_FLAG_CONTRACTS,EXTENSION_INIT_FLAG_CONTRACTS,EXTENSION_INSTALL_FLAG_CONTRACTS,EXTENSION_MANAGE_FLAG_CONTRACTS,EXTENSION_MIGRATE_FLAG_CONTRACTS,EXTENSION_RELOAD_FLAG_CONTRACTS,EXTENSION_SCOPE_FLAG_CONTRACTS,EXTENSION_UNINSTALL_FLAG_CONTRACTS,FILES_FLAG_CONTRACTS,FOCUS_FLAG_CONTRACTS,GC_FLAG_CONTRACTS,GET_FLAG_CONTRACTS,GLOBAL_FLAG_CONTRACTS,GRAPH_FLAG_CONTRACTS,GUIDE_FLAG_CONTRACTS,HEALTH_FLAG_CONTRACTS,HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS,HISTORY_COMPACT_FLAG_CONTRACTS,HISTORY_EVENT_CLASSIFICATION_VERSION,HISTORY_FLAG_CONTRACTS,HISTORY_REDACT_FLAG_CONTRACTS,HISTORY_REPAIR_FLAG_CONTRACTS,INIT_AGENT_GUIDANCE_MODE_VALUES,INIT_FLAG_CONTRACTS,INSTALL_FLAG_CONTRACTS,ISSUE_SEVERITY_VALUES,ITEM_COMPLETE_FLAG_CONTRACTS,ITEM_MUTATE_FLAG_CONTRACTS,ITEM_REOPEN_FLAG_CONTRACTS,ITEM_TYPE_VALUES,LEARNINGS_FLAG_CONTRACTS,LINKED_TEST_ENV_NAME_PATTERN,LINKED_TEST_PM_CONTEXT_MODE_VALUES,LINKED_TEST_PROTECTED_ENV_KEYS,LINKED_TEST_WORKSPACE_CONTEXT_MODE_VALUES,LIST_COMMANDER_STRING_OPTION_CONTRACTS,LIST_FILTER_FLAG_CONTRACTS,MAINTENANCE_HISTORY_OPERATIONS,MEET_FLAG_CONTRACTS,MERGE_FLAG_CONTRACTS,MERGE_SUBCOMMAND_VALUES,NEXT_COMMANDER_STRING_OPTION_CONTRACTS,NEXT_FLAG_CONTRACTS,NEXT_OUTPUT_VALUES,NOTES_FLAG_CONTRACTS,PACKAGE_FLAG_CONTRACTS,PACKAGE_INIT_FLAG_CONTRACTS,PAUSE_TASK_FLAG_CONTRACTS,PLAN_CREATE_METADATA_PARAMETER_KEYS,PLAN_FLAG_CONTRACTS,PLAN_SHOW_DEPTH_VALUES,PLAN_SUBCOMMANDS,PLAN_TEMPLATE_NAMES,PM_BULK_LIFECYCLE_COMMAND_ALIASES,PM_CLI_EXPECTED_ERROR_NAME,PM_CLI_ONLY_TOOL_ACTION_WAIVERS,PM_COMMAND_ALIAS_CONTRACTS,PM_COMMAND_CAPABILITY_CONTRACTS,PM_COMMAND_OUTPUT_BUDGET_CONTRACTS,PM_COMMAND_VISIBILITY_CONTRACTS,PM_CONTEXT_OPS_COMMAND_ALIASES,PM_CORE_COMMAND_NAMES,PM_CORPUS_SHAPE_SCHEMA,PM_DEPRECATED_TOOL_ACTIONS,PM_DIAGNOSTIC_DEGRADATION_STEPS,PM_DIAGNOSTIC_OUTPUT_BUDGET_CONTRACTS,PM_DIAGNOSTIC_OUTPUT_CLASSES,PM_DISCOVERABLE_TOOL_ACTIONS,PM_EXACT_COVERAGE_METRICS,PM_EXTENSION_CAPABILITY_CONTRACTS,PM_EXTENSION_PACKAGE_ACTION_SUBCOMMANDS,PM_EXTENSION_POLICY_MODE_CONTRACTS,PM_EXTENSION_POLICY_SURFACE_CONTRACTS,PM_EXTENSION_SANDBOX_PROFILE_CONTRACTS,PM_EXTENSION_SERVICE_NAME_CONTRACTS,PM_EXTENSION_TRUST_MODE_CONTRACTS,PM_GITIGNORE_END,PM_GITIGNORE_START,PM_HISTORY_COMMAND_ALIASES,PM_ITEM_ACTION_SUBCOMMANDS,PM_MCP_PROMPT_CONTRACTS,PM_MCP_RESOURCE_CONTRACTS,PM_MCP_TOOL_COMMAND_CONTRACTS,PM_MUTATION_ACTION_CONTRACTS,PM_NAMESPACED_COMMAND_ALIASES,PM_OUTPUT_BUDGET_CLASSES,PM_OUTPUT_DEGRADATION_STEPS,PM_PACKAGE_CONVENTIONAL_RESOURCE_ROOTS,PM_PACKAGE_ONLY_ACTION_SUBCOMMANDS,PM_PACKAGE_RESOURCE_KINDS,PM_PROVIDER_TOOL_PARAMETERS_SCHEMA,PM_PROVIDER_TOOL_PARAMETERS_SCHEMA_VERSION,PM_RELOCATED_COMMAND_ALIASES,PM_REPRODUCIBLE_PROCESS_ENV,PM_TOOL_ACTIONS,PM_TOOL_ACTION_PARAMETER_CONTRACTS,PM_TOOL_PARAMETERS_SCHEMA,PM_TOOL_PARAMETERS_SCHEMA_MAJOR,PM_TOOL_PARAMETERS_SCHEMA_VERSION,PM_TOOL_RESERVED_CUSTOM_FIELD_PROPERTIES,PM_WORKSPACE_RECIPE_SCHEMA,PROFILE_FLAG_CONTRACTS,PROFILE_LINT_CODES,PROFILE_LINT_DIMENSIONS,PROFILE_NAMES,PROFILE_SUBCOMMANDS,PmCliError,PmClient,REINDEX_FLAG_CONTRACTS,RELEASE_FLAG_CONTRACTS,REMIND_FLAG_CONTRACTS,RESERVED_ITEM_FIELD_NAMES,RESTORE_FLAG_CONTRACTS,RISK_VALUES,SCHEMA_FLAG_CONTRACTS,SEARCH_COMMANDER_STRING_OPTION_CONTRACTS,SEARCH_FLAG_CONTRACTS,SNAPSHOT_SCHEMA,START_TASK_FLAG_CONTRACTS,STATS_FLAG_CONTRACTS,STATUS_VALUES,SUBCOMMAND_GLOBAL_FLAG_CONTRACTS,SUBSTANTIVE_HISTORY_OPERATIONS,TELEMETRY_FLAG_CONTRACTS,TELEMETRY_SUBCOMMANDS,TEST_ALL_FLAG_CONTRACTS,TEST_FLAG_CONTRACTS,TEST_RUNS_FLAG_CONTRACTS,TEST_RUN_MEASUREMENT_LIMIT,TOOL_ACTIVITY_OPTION_CONTRACTS,TOOL_AGGREGATE_OPTION_CONTRACTS,TOOL_BULK_MUTATION_FILTER_OPTION_CONTRACT_SOURCE,TOOL_CALENDAR_OPTION_CONTRACTS,TOOL_CLOSE_MANY_FILTER_OPTION_CONTRACTS,TOOL_CONTEXT_OPTION_CONTRACTS,TOOL_CREATE_OPTION_CONTRACTS,TOOL_CREATE_OPTION_CONTRACT_SOURCE,TOOL_DEPS_OPTION_CONTRACTS,TOOL_GRAPH_OPTION_CONTRACTS,TOOL_LIST_FILTER_OPTION_CONTRACTS,TOOL_SEARCH_FILTER_OPTION_CONTRACTS,TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACTS,TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACT_SOURCE,TOOL_UPDATE_MANY_FILTER_OPTION_CONTRACTS,TOOL_UPDATE_OPTION_CONTRACTS,TOOL_UPDATE_OPTION_CONTRACT_SOURCE,UPDATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS,UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS,UPDATE_COMMANDER_STRING_OPTION_CONTRACTS,UPDATE_FLAG_CONTRACTS,UPDATE_MANY_FLAG_CONTRACTS,UPGRADE_FLAG_CONTRACTS,VALIDATE_FLAG_CONTRACTS,WORKSPACE_FLAG_CONTRACTS,WORKSPACE_SNAPSHOT_ACTIONS,_testOnly4 as _testOnly,_testOnlyConfigCommand,_testOnlyHealthCommand,_testOnly3 as _testOnlyInit,_testOnly2 as _testOnlyInitAgentGuidance,_testOnly as _testOnlyTemplates,_testOnlyValidateCommand,acknowledgeLinkedTests,acknowledgeUnknownAuthorHistoryEvents,acknowledgeUnknownAuthorHistoryEventsFromTransport,acquireLock,aggregate,analyzePmToolActionParity,analyzeSdkActionCoverage,analyzeSdkCliParameterCompleteness,append,appendHistoryEntry,applyBootstrapPagerPolicy,applyInvocationAuthorOverride,applyPathMigrations,applyStandaloneNote,applyStoredExtensionMigrationState,artifactKey,assertInitializedTracker,assertLinkedArtifactMutationIsUnambiguous,assertReadableTrackerRoot,attachLinkedTestMutationProvenance,attachLinkedTestProvenance,auditMergeAttributeFence,buildCorpusShapeItemPlan,buildExtensionDescribeResult,buildExtensionInstallPlan,buildMergeAttributePatterns,buildPmActionToolInputSchema,buildTrackerInitializationRecovery,canonicalDocument,claim,claimNext,classifyHistoryEvent,classifyItemFormatVersion,classifyLinkedTestCommandSafety,classifyLinkedTestFailure,clearWorkspaceContractsCache,close,closeItem,closeTask,coalesceRepeatedListFlags,collectPackageExtensionDirectories,comments,commitImportedItem,compactFlagAliasContracts,config,context,copy,countFailureCategories,create,createCorpusShapeMeasurement,createExtensionCommandSdk,createHistoryEntry,createPmCliExpectedError,createPmCliProgram,createPmCommandOutputBudget,createReproducibleProcessRunner,createWorkspaceSnapshot,dedupeLinkedArtifacts,defineCorpusShape,definePmCommandOutputBudget,defineWorkspaceRecipe,deleteItem,deleteWorkspaceSnapshot,deps,deriveSchemaEvolutionMigrationId,describeItemOwnershipConflict,describeProfileComposition,describeProjectProfile,diffTestRunMeasurements,discoverNearbyPmRoot,docs,duplicates,effectiveItemFormatVersion,emptyImportedDocument,ensurePmGitignore,ensureScope,ensureTrackerInitialized,estimatePmOutputTokens,evaluateMutationGuard,evaluateProvenanceCoverage,evaluateSimilarityGovernance,executeWorkspaceRecipe,expandAddGlobEntries,extension,extensionActivate,extensionDeactivate,extensionList,extensionMigrate,extractReferencedPmItemIdsFromCommand,files,filesDiscover,filesLookup,findCoverageDeficits,findDuplicateClusters,findGitWorkspaceRoot,findInstalledNpmPackageCandidate,findPmNamespacedCommand,findSimilarItems,flushTelemetryQueue,focus,formatProfileApplyHuman,formatProfileLintHuman,formatProfileListHuman,formatProfileShowHuman,formatSchemaEvolutionMigrationHuman,gc,generateItemId,get,getActiveExtensionRegistrations,getContracts,getHistoryPath,getItemPath,getMutationActionContract,getPmGitignoreBlock,getSettingsPath,getWorkspaceContracts,graph,hasSubcommandFlagContractsForCommand,health,historyCompact,historyCompactBulk,historyRedact,historyRepair,historyRepairAll,inferPmOutputBudgetClass,init,inspectHistoryAuthorStream,inspectStaleInProgressItems,inspectWorkspaceSnapshot,installMergeFence,isAlreadyClaimedError,isErrnoError,isMutationAction,isPmCliExpectedError,isPmExtensionCapabilityContract,isPmExtensionPolicyModeContract,isPmExtensionPolicySurfaceContract,isPmExtensionServiceNameContract,isPmToolAction,isRuntimeRecord,isTimestampLiteral,jaccardSimilarity,learnings,limitAnnotationEntries,linkedTestTrustFingerprint,lintProjectProfile,list,listAliasPluralKeys,listAllComplete,listAllItemMetadata,listBuiltinCorpusShapes,listMutationActions,listPmCommandsForFamily,listPmCommandsForTier,listPmMcpToolsForProfile,listProfiles,listWorkspaceSnapshots,loadCreateTemplateOptions,locateItem,measureCorpusShapePlan,mergeLinkedTestTwoTokenEntries,next,normalizeAnnotationTransportOptions,normalizeBootstrapInvocation,normalizeItemFormatVersion,normalizeItemId,normalizeItemMetadata,normalizeLegacyExtensionActionSyntax,normalizeLinkedPath,normalizeProfileName,normalizeRawItemId,normalizeSimilarityText,normalizeStatusInput,notes,nowIso,packageActivate,packageCatalog,packageDeactivate,packageDescribe,packageDoctor,packageInstall,packageLifecycle,packageList,packageManage,packageMigrate,packageReload,packageUninstall,parseAddEntries,parseAddGlobEntries,parseAnnotationTextInput,parseBootstrapCommandName,parseBootstrapGlobalOptions,parseBootstrapHelpRequest,parseBootstrapTypeValue,parseEvalQuerySet,parseLinkedTestAssertionEqualsMap,parseLinkedTestAssertionGteMap,parseLinkedTestBoolean,parseLinkedTestContextMode,parseLinkedTestEnvClear,parseLinkedTestEnvSet,parseLinkedTestJsonEntries,parseLinkedTestMinLines,parseLinkedTestRegexList,parseLinkedTestStringList,parseLinkedTestWorkspaceContextMode,parseMigrateEntries,parseRemoveEntries,parseTags,parseTestRunMeasurements,parseUnknownAuthorHistoryEventCoordinates,pathExists,pauseTask,planExtensionDirectoryCopy,planProfileApplication,planSchemaEvolutionMigration,planUnknownAuthorHistoryAcknowledgment,planWorkspaceSnapshotRestore,prepareSimilarityText,profile,profileApply,profileLint,profileList,profileShow,projectFleetAttributionAnalytics,projectPmDiagnosticOutput,projectPmDiagnosticText,projectProvenanceCoverageAnalytics,projectValidateCounts,queryTestRunMeasurementsBelow,quoteCommandArg,quoteWindowsCommandArg,readAnnotationEntries,readBooleanOption,readCsvListOption,readExtensionMigrationState,readFileIfExists,readFirstStringFromCommanderOptions,readFirstValueFromCommanderOptions,readHistoryAnalyticsWindow,readHistorySnapshot,readImprovementLedger,readLocatedItem,readPmPackageManifest,readRequiredString,readSettings,readStringArrayFromCommanderOptions,readStringOption,recordImprovementObservation,refreshMergeAttributeFenceIfInstalled,release,removeFileIfExists,renameArtifactsResultKey,renderCalendarMarkdown,renderCalendarToon,renderExtensionDescribeMarkdown,renderGuideMarkdown,renderPmCommand,renderPmCommandAliasMigrationHint,renderPmCommandVisibilityMarkdown,reopen,resolveAnnotationIndex,resolveAnnotationInput,resolveBuiltinCorpusShape,resolveCalendarOutputFormat,resolveExtensionInstallSourceIdentity,resolveExtensionMigrationStatePath,resolveGuideOutputFormat,resolveImplicitPmRoot,resolveItemTypeRegistry,resolveLinkedTestFailureExitCode,resolveLinkedTestSourceRef,resolveLinkedTestSourceWorkspaceRoot,resolveLinkedTestTrust,resolveLinkedTestTrustBatch,resolveMergeInstallContext,resolvePmCommandAlias,resolvePmCommandCapabilityFamily,resolvePmCommandOperation,resolvePmCommandOutputBudget,resolvePmCommandVisibilityTier,resolvePmDiagnosticOutputBudget,resolvePmHistoryOperation,resolvePmPositionalActionFlagContracts,resolvePmRoot,resolvePmToolCustomFieldCollision,resolveProfile,resolveProjectMergeTypeFolders,resolveReproducibleProcessEnvironment,resolveRuntimeFieldRegistry,resolveRuntimeStatusRegistry,resolveStartTaskInProgressStatus,resolveSubcommandFlagContractsForCommand,resolveUnknownAuthorAcknowledgmentSelector,restore,restoreWorkspaceSnapshot,restoreWorkspaceSnapshotWithRecovery,runAction,runActiveOnReadHooks,runActiveOnWriteHooks,runAggregate,runAnnotationCommand,runAppend,runCalendar,runClaim,runClaimNext,runClose,runCloseMany,runCloseTask,runComments,runCompletion,runConfig,runContext,runCopy,runCreate,runDelete,runDeps,runDocs,runEval,runEvent,runExtension,runExtensionMigrateAction,runExtensionMigrations,runFiles,runFilesDiscover,runFilesLookup,runFleetAttributionAnalytics,runFocus,runGc,runGet,runGuide,runHealth,runInit,runInitAgentGuidance,runLearnings,runLinkedArtifacts,runLinkedTests,runList,runMeet,runMergeInstall,runNext,runNotes,runPauseTask,runPlan,runProfileApply,runProfileLint,runProfileList,runProfileShow,runProvenanceCoverageAnalytics,runReindex,runRelease,runRemind,runRestore,runSchemaEvolutionMigration,runSearch,runSearchRefreshWorkerEntrypoint,runStartBackgroundRun,runStartTask,runStats,runTelemetry,runTemplatesList,runTemplatesSave,runTemplatesShow,runTest,runTestAll,runTestRunsList,runTestRunsLogs,runTestRunsResume,runTestRunsStatus,runTestRunsStop,runTestRunsWorker,runUpdate,runUpdateMany,runUpgrade,runValidate,runWithActiveExtensions,runWithReproducibleProcessEnvironment,runWithWorkspaceRecipe,scanHistoryAuthorAttribution,scanItemFormatVersions,scanMutationSecrets,scanStaleInProgressItems,schema,schemaAddField,schemaAddStatus,schemaAddType,schemaApplyPreset,schemaInferTypes,schemaList,schemaListFields,schemaRemapStatus,schemaRemoveField,schemaRemoveStatus,schemaRemoveType,schemaRenameField,schemaRenameType,schemaShow,schemaShowField,schemaShowStatus,scoreItemSimilarity,scorePreparedItemSimilarity,search,selectImportAuthor,serializeItemDocument,similarityAdvisoryWarnings,sortLinkedArtifacts,splitFrontMatter,startTask,stats,stripGlobalBootstrapTokens,summarizeContextPreflight,summarizeInitResult,toCompletionFlagString,toEstimatedMinutesValue,toImportBoolean,toImportConfidence,toImportInteger,toImportLinkedDocs,toImportLinkedFiles,toImportLinkedTests,toImportLogEntries,toImportNormalizedEnum,toImportNumberMap,toImportPriority,toImportStatus,toImportStringList,toImportStringMap,toImportTags,toNonEmptyImportString,tokenizeSimilarityText,update,upgrade,validate,validateLinkedPaths,verifyToolOptionCliParity,withFlagAliasMetadata,wrapOwnershipConflict,writeFileAtomic};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/sdk/learnings.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
1
|
+
!(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="039acb6e-090c-554f-9323-29e44496552d")}catch(e2){}})();import{parseAnnotationTextInput,resolveAnnotationInput,runAnnotationCommand}from"./annotations.js";async function runLearnings(id,options,global2){return runAnnotationCommand(id,options,global2,{input:await resolveAnnotationInput(options,"learning"),collectionKey:"learnings",op:"learning_add",editOp:"learning_edit",deleteOp:"learning_delete",parseText:raw=>parseAnnotationTextInput(raw),createEntry:entry=>entry,bypassOwnershipConflict:Boolean(options.edit===void 0&&options.delete===void 0&&options.ownershipAppendBypass),conflictGuidance:{required:"Strict ownership also protects annotations. Ask the current owner to run pm release <id>, then run pm claim <id>; use --force only for an explicitly approved override.",examples:["pm claim <id>"],nextSteps:["For an approved append without reassignment: pm package install governance-audit --project; then pm learnings --help lists the package-owned append bypass. Edit/delete still require ownership.","For a non-terminal handoff, the current owner runs pm release <id>; then you run pm claim <id> before retrying. Claim refuses work still held by another owner; --force requires an explicitly approved override."]}})}export{runLearnings};
|
|
2
2
|
//# sourceMappingURL=learnings.js.map
|
|
@@ -58,6 +58,8 @@ type ClaimRunner = (id: string, force: boolean, global: GlobalOptions, options:
|
|
|
58
58
|
export interface ReleaseResult {
|
|
59
59
|
/** Value that configures or reports item for this contract. */
|
|
60
60
|
item: Record<string, unknown>;
|
|
61
|
+
/** Ownership fields actually removed, or an empty list for an unclaimed item. */
|
|
62
|
+
changed_fields?: string[];
|
|
61
63
|
/** Value that configures or reports released by for this contract. */
|
|
62
64
|
released_by: string;
|
|
63
65
|
/** Value that configures or reports previous assignee for this contract. */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
1
|
+
!(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f2901314-4044-5a91-ad72-6b4bebde16c2")}catch(e2){}})();import{assertInitializedTracker}from"../environment/tracker-preflight.js";import{resolveRuntimeStatusRegistry,statusIsTerminal,EXIT_CODE,PmCliError,toItemRecord,mutateItem,resolvePmRoot,readSettings,resolveAuthor,resolveClaimPrincipal,normalizeStatusForRegistry}from"../runtime-primitives.js";import{wrapOwnershipConflict}from"../annotations.js";import{describeItemOwnershipConflict}from"../ownership-source.js";import{runNext}from"../query/next.js";import{recordClaimSemanticAttribution,recordReleaseSemanticAttribution}from"../context/semantic-session-attribution.js";const NO_AVAILABLE_NEXT_ITEM_CODE="no_available_next_item";function isAlreadyClaimedError(error){if(!(error instanceof Error)||error.name!=="PmCliError"){return false}const context=error.context;return typeof context==="object"&&context!==null&&"code"in context&&context.code==="already_claimed_by"}async function runClaim(id,force,global2,options={}){const pmRoot=resolvePmRoot(process.cwd(),global2.path);await assertInitializedTracker(pmRoot);const settings=await readSettings(pmRoot);const statusRegistry=resolveRuntimeStatusRegistry(settings.schema);const author=resolveAuthor(options.author,settings.author_default);const claimPrincipal=resolveClaimPrincipal(author);let previousAssignee=null;let skipped=false;const mutationWarnings=[];const result=await mutateItem({pmRoot,settings,id,op:"claim",author,message:options.message,force,skipNoop:true,async mutate(document){const currentAssignee=document.metadata.assignee;const currentAssigneeText=currentAssignee??"";const currentClaimPrincipal=document.metadata.claim_principal?.trim()||currentAssigneeText;previousAssignee=currentAssigneeText.trim().length>0?currentAssigneeText:null;if(statusIsTerminal(document.metadata.status,statusRegistry)&&!force){throw new PmCliError(`Cannot claim terminal item ${document.metadata.id} without --force`,EXIT_CODE.CONFLICT)}const heldByOther=previousAssignee!==null&¤tClaimPrincipal!==claimPrincipal;if(heldByOther){if(options.ifAvailable===true){skipped=true;mutationWarnings.push(`claim_skipped_held_by:${previousAssignee}`);return{changedFields:[]}}if(!force){const ownershipPhrase=await describeItemOwnershipConflict(pmRoot,document.metadata.id,currentAssigneeText);throw new PmCliError(`Item ${document.metadata.id} is already ${ownershipPhrase}. Use --force to take over, or --if-available to skip without failing.`,EXIT_CODE.CONFLICT,{code:"already_claimed_by",why:"Claim is an atomic test-and-set so parallel agents never proceed believing they own the same item.",nextSteps:["Run pm next to pick a different unclaimed item.","Re-run with --if-available to treat a held item as a no-op skip.","Re-run with --force only when taking over the item is coordinated."]})}mutationWarnings.push(`claim_takeover:${previousAssignee}->${author}`)}const ownership={assignee:author,claim_principal:claimPrincipal};const changedFields=["assignee","claim_principal"].filter(field=>document.metadata[field]!==ownership[field]);Object.assign(document.metadata,ownership);return{changedFields,warnings:mutationWarnings}}});if(!skipped){await recordClaimSemanticAttribution({pmRoot,settings,principal:claimPrincipal,itemId:result.item.id})}return{item:toItemRecord(result.item),changed_fields:result.changedFields,claimed_by:skipped&&previousAssignee!==null?previousAssignee:author,previous_assignee:previousAssignee,forced:force,...skipped?{skipped:true}:{},...mutationWarnings.length>0?{warnings:mutationWarnings}:{}}}async function runClaimNext(force,global2,options={},nextOptions={}){const maxAttempts=parseClaimNextAttempts(options.maxAttempts);const settings=await readSettings(resolvePmRoot(process.cwd(),global2.path));const claimOptions={...options,author:resolveAuthor(options.author,settings.author_default)};const next=await runNext({...nextOptions,callerAuthor:claimOptions.author,limit:String(maxAttempts)},global2);const recommendations=[next.recommended,...next.ready].filter(entry=>entry!==null).map(entry=>({...entry,reasons:"reasons"in entry?entry.reasons:["ranked ready candidate"]}));return claimNextFromRecommendations(recommendations.slice(0,maxAttempts),force,global2,claimOptions)}function parseClaimNextAttempts(raw){if(raw===void 0)return 10;const parsed=Number(raw);if(!Number.isSafeInteger(parsed)||parsed<1||parsed>100){throw new PmCliError("--max-attempts must be an integer from 1 to 100",EXIT_CODE.USAGE)}return parsed}async function claimNextFromRecommendations(recommendations,force,global2,options={},claimRunner=runClaim){let attempts=0;for(const recommendation of recommendations){attempts+=1;try{const claimed=await claimRunner(recommendation.id,force,global2,options);const result={...claimed,recommendation,attempts,available:true};if(!claimed.skipped)return result}catch(error){if(!isAlreadyClaimedError(error))throw error}}if(options.ifAvailable===true){return{available:false,item:null,claimed_by:resolveAuthor(options.author,""),previous_assignee:null,forced:force,skipped:true,recommendation:null,attempts,warnings:[NO_AVAILABLE_NEXT_ITEM_CODE]}}const noCandidatesMatched=attempts===0;throw new PmCliError(noCandidatesMatched?"No actionable items matched the selection filters":"No actionable item remained available to claim",noCandidatesMatched?EXIT_CODE.NOT_FOUND:EXIT_CODE.CONFLICT,{code:NO_AVAILABLE_NEXT_ITEM_CODE,why:noCandidatesMatched?"No ready items matched the specified filters or selection criteria.":"Every ranked candidate was claimed by another agent before this atomic selection completed.",nextSteps:[noCandidatesMatched?"Verify the filters or run pm next to inspect all ready work.":"Run pm claim --next again to refresh the ranked candidate set."]})}async function runRelease(id,force,global2,options={}){const pmRoot=resolvePmRoot(process.cwd(),global2.path);await assertInitializedTracker(pmRoot);const settings=await readSettings(pmRoot);const author=resolveAuthor(options.author,settings.author_default);const claimPrincipal=resolveClaimPrincipal(author);const ownershipReleaseBypass=options.ownershipReleaseBypass===true;let previousAssignee=null;let result;try{result=await mutateItem({pmRoot,settings,id,op:"release",author,message:options.message,force,bypassAssigneeConflict:ownershipReleaseBypass,mutate(document){previousAssignee=document.metadata.assignee??null;if(!previousAssignee&&!document.metadata.claim_principal){return{changedFields:[]}}delete document.metadata.assignee;delete document.metadata.claim_principal;return{changedFields:["assignee","claim_principal"]}}})}catch(error){wrapOwnershipConflict(error,{required:"For approved non-owner handoffs, prefer the ownership-release bypass before considering --force.",examples:['pm release pm-a1b2 --author "reviewer" --force'],nextSteps:["Use the package-provided ownership-release bypass for handoffs that only clear assignee metadata.","Use --force only when an explicit override is approved for broader ownership conflicts."]})}await recordReleaseSemanticAttribution({pmRoot,principal:claimPrincipal,itemId:result.item.id});const statusRegistry=resolveRuntimeStatusRegistry(settings.schema);const stillInProgress=normalizeStatusForRegistry(result.item.status,statusRegistry)===normalizeStatusForRegistry(statusRegistry.in_progress_status,statusRegistry);return{item:toItemRecord(result.item),released_by:author,changed_fields:result.changedFields,previous_assignee:previousAssignee,forced:force,...stillInProgress?{warnings:["released_unclaimed_in_progress"],suggestions:[`${result.item.id} remains ${result.item.status} and unclaimed. If work is paused, run pm release ${result.item.id} --pause to move it to ${statusRegistry.open_status}.`]}:{}}}export{NO_AVAILABLE_NEXT_ITEM_CODE,claimNextFromRecommendations,isAlreadyClaimedError,parseClaimNextAttempts,runClaim,runClaimNext,runRelease};
|
|
2
2
|
//# sourceMappingURL=claim.js.map
|
|
@@ -16,5 +16,9 @@ export interface LifecycleMutationActionContext {
|
|
|
16
16
|
export declare function runMcpClaimAction(context: LifecycleMutationActionContext): Promise<unknown>;
|
|
17
17
|
/** Dispatch close through the shared MCP mutation compaction contract. */
|
|
18
18
|
export declare function runMcpCloseAction(context: LifecycleMutationActionContext): Promise<unknown>;
|
|
19
|
+
/** Apply one shared transport projection to canonical and legacy lifecycle compositions. */
|
|
20
|
+
export declare function runMcpTaskCompositionAction(context: LifecycleMutationActionContext, action: "start_task" | "pause_task" | "close_task"): Promise<unknown>;
|
|
21
|
+
/** Release ownership with the same compact/full controls used by claiming and pausing. */
|
|
22
|
+
export declare function runMcpReleaseAction(context: LifecycleMutationActionContext): Promise<unknown>;
|
|
19
23
|
/** Dispatch recurrence through the shared MCP mutation compaction contract. */
|
|
20
24
|
export declare function runMcpReopenAction(context: LifecycleMutationActionContext): Promise<unknown>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
1
|
+
!(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="31407e14-880c-5637-a2d5-3569e575e729")}catch(e2){}})();import{projectMutationResult}from"../../core/output/mutation-projection.js";import{PmCliError}from"../../core/shared/errors.js";import{runClose}from"./close.js";import{runReopen}from"./reopen.js";import{runClaim,runClaimNext,runRelease}from"./claim.js";import{runStartTask,runPauseTask,runCloseTask}from"./task-composition.js";import{readRuntimeString,withMutationCompaction,mutationOptionsWithOverrides}from"../runtime-input.js";async function runMcpClaimAction(context){const{changedFields,idOnly,runnerOptions}=withMutationCompaction(context.args,context.options);const force=context.force===true||runnerOptions.force===true;const selectionOptions={...context.args,...runnerOptions};if(selectionOptions.start===true){return runMcpTaskCompositionAction(context,"start_task")}const result=context.args.next===true||runnerOptions.next===true?await runClaimNext(force,context.global,selectionOptions,selectionOptions):await runClaim(requireLifecycleItemId(context,runnerOptions),force,context.global,selectionOptions);return projectMutationResult(result,{changedFields,compactEnvelope:changedFields==="compact"&&!idOnly,idOnly})}function requireLifecycleItemId(context,options){const id=context.id??readRuntimeString(options,"id");if(!id){throw new PmCliError("Missing required argument: id",64)}return id}function readLifecycleReason(context,options){return readRuntimeString(context.args,"reason")??readRuntimeString(context.args,"text")??readRuntimeString(options,"reason")??readRuntimeString(options,"text")}async function runMcpCloseAction(context){const{changedFields,idOnly,runnerOptions}=withMutationCompaction(context.args,context.options);if(runnerOptions.releaseAssignment===true){return runMcpTaskCompositionAction(context,"close_task")}return projectMutationResult(await runClose(requireLifecycleItemId(context,runnerOptions),readLifecycleReason(context,runnerOptions),{...runnerOptions,force:context.force===true||runnerOptions.force===true},context.global),{changedFields,compactEnvelope:changedFields==="compact"&&!idOnly,idOnly})}async function runMcpTaskCompositionAction(context,action){const{changedFields,idOnly,runnerOptions}=withMutationCompaction(context.args,context.options);const id=requireLifecycleItemId(context,runnerOptions);const options=mutationOptionsWithOverrides(runnerOptions,{force:context.force===true||runnerOptions.force===true});const result=action==="start_task"?await runStartTask(id,options,context.global):action==="pause_task"?await runPauseTask(id,options,context.global):await runCloseTask(id,readLifecycleReason(context,runnerOptions),options,context.global);return projectMutationResult(result,{changedFields,idOnly,compactEnvelope:changedFields==="compact"&&!idOnly})}async function runMcpReleaseAction(context){if(context.options.pause===true)return runMcpTaskCompositionAction(context,"pause_task");const{changedFields,idOnly,runnerOptions}=withMutationCompaction(context.args,context.options);const result=await runRelease(requireLifecycleItemId(context,runnerOptions),context.force===true,context.global,runnerOptions);return projectMutationResult(result,{changedFields,idOnly,compactEnvelope:changedFields==="compact"&&!idOnly})}async function runMcpReopenAction(context){const{changedFields,idOnly,runnerOptions}=withMutationCompaction(context.args,context.options);return projectMutationResult(await runReopen(requireLifecycleItemId(context,runnerOptions),readLifecycleReason(context,runnerOptions)??"",{...runnerOptions,force:context.force===true||runnerOptions.force===true},context.global),{changedFields,compactEnvelope:changedFields==="compact"&&!idOnly,idOnly})}export{runMcpClaimAction,runMcpCloseAction,runMcpReleaseAction,runMcpReopenAction,runMcpTaskCompositionAction};
|
|
2
2
|
//# sourceMappingURL=mcp-actions.js.map
|
|
@@ -9,6 +9,8 @@ export interface TaskCompositionOptions extends ClaimMutationOptions {
|
|
|
9
9
|
/** Ranked selection cannot be combined with an explicit-item composition. */
|
|
10
10
|
next?: boolean;
|
|
11
11
|
}
|
|
12
|
+
/** Preserve a failed step's diagnostics while reporting the earlier durable mutation, without implying rollback. */
|
|
13
|
+
export declare function finishComposition<T>(id: string, completed: "claim" | "update" | "close", operation: () => Promise<T>): Promise<T>;
|
|
12
14
|
/** Claim explicit work and advance it through the workspace's configured workflow. */
|
|
13
15
|
export declare function runStartTask(id: string, options: TaskCompositionOptions, global: GlobalOptions): Promise<StartTaskResult>;
|
|
14
16
|
/** Return work to its configured open status, then release ownership. */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
1
|
+
!(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="7f0e8f0f-bef3-5d61-b851-7582a03430b6")}catch(e2){}})();import{PmCliError}from"../../core/shared/errors.js";import{EXIT_CODE}from"../../core/shared/constants.js";import{resolveRuntimeStatusRegistry}from"../../core/schema/runtime-schema.js";import{resolvePmRoot}from"../../core/store/paths.js";import{readSettings}from"../../core/store/settings.js";import{runClaim,runRelease}from"./claim.js";import{runClose}from"./close.js";import{runUpdate}from"./update.js";import{resolveStartTaskInProgressStatus}from"../start-task-status.js";import{mutationOptionsWithOverrides}from"../runtime-input.js";async function finishComposition(id,completed,operation){try{return await operation()}catch(error){const context=error instanceof PmCliError?error.context:{};const failure=new PmCliError(error instanceof Error?error.message:String(error),error instanceof PmCliError?error.exitCode:EXIT_CODE.GENERIC_FAILURE,{...context,item_id:id,why:`${completed} completed for ${id} before the following step failed. No rollback was performed.${context.why?` ${context.why}`:""}`,nextSteps:[`Inspect the persisted state with pm get ${id} and pm history ${id} before retrying the failed step.`,...context.nextSteps??[]]});failure.cause=error;throw failure}}async function runStartTask(id,options,global2){if(options.next===true||options.ifAvailable===true){throw new PmCliError("--start requires an explicit item id and cannot be combined with --next or --if-available",EXIT_CODE.USAGE)}const settings=await readSettings(resolvePmRoot(process.cwd(),global2.path));const status=resolveStartTaskInProgressStatus(resolveRuntimeStatusRegistry(settings.schema));const claim=await runClaim(id,options.force===true,global2,options);const update=await finishComposition(id,"claim",()=>runUpdate(id,mutationOptionsWithOverrides(options,{status},["assignee","start","next","ifAvailable","maxAttempts"]),global2));return{id,action:"start_task",claim,update}}async function runPauseTask(id,options,global2){const settings=await readSettings(resolvePmRoot(process.cwd(),global2.path));const status=resolveRuntimeStatusRegistry(settings.schema).open_status;const update=await runUpdate(id,mutationOptionsWithOverrides(options,{status},["assignee","pause"]),global2);const release=await finishComposition(id,"update",()=>runRelease(id,options.force===true,global2,options));return{id,action:"pause_task",update,release}}async function runCloseTask(id,reason,options,global2){const close=await runClose(id,reason,options,global2);const release=await finishComposition(id,"close",()=>runRelease(id,options.force===true,global2,options));return{id,action:"close_task",close,release}}export{finishComposition,runCloseTask,runPauseTask,runStartTask};
|
|
2
2
|
//# sourceMappingURL=task-composition.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="deef67cc-b902-5a4e-9c66-3839a1cdcc6f")}catch(e2){}})();import{settleAbandonedMergeReceipts}from"./abandoned-receipts.js";import{readFile}from"node:fs/promises";import path from"node:path";import{EXIT_CODE}from"../../core/shared/constants.js";import{PmCliError}from"../../core/shared/errors.js";import{compareTimestampStrings}from"../../core/shared/time.js";import{resolvePmRoot}from"../../core/store/paths.js";import{mapWithFixedConcurrency}from"../extension/concurrency.js";import{runHealth}from"../governance/health.js";import{DURABLE_MERGE_RECEIPT_INTRODUCED_AT,extractHistoryMergeReceiptReferences,isPreDurableDispositionEligibleReference}from"../governance/merge-receipt-history.js";import{runValidate}from"../governance/validate.js";import{runHistoryRepair,runHistoryRepairAll}from"../history-repair.js";import{findGitWorkspaceRoot}from"./install.js";import{inspectMergeReceiptEvidence,markMergeReceiptReconciled,summarizeMergeReceipt}from"./receipts.js";const RECEIPT_ONLY_REPAIR_CONCURRENCY=4;function missingReceiptCoordinates(health){const integrity=health.checks.find(check=>check.name==="integrity");const counts=integrity?.details.counts;const count=typeof counts==="object"&&counts!==null&&!Array.isArray(counts)&&typeof counts.missing_merge_receipt_history_references==="number"?counts.missing_merge_receipt_history_references:0;const details=integrity?.details.missing_merge_receipt_history_reference_details;const truncated=integrity?.details.missing_merge_receipt_history_reference_details_truncated===true;const coordinates=Array.isArray(details)?details.flatMap(detail=>{if(typeof detail!=="object"||detail===null||Array.isArray(detail)){return[]}const record=detail;return typeof record.item_id==="string"&&typeof record.history_line==="number"&&Number.isSafeInteger(record.history_line)&&typeof record.receipt_id==="string"?[{item_id:record.item_id,history_line:record.history_line,receipt_id:record.receipt_id}]:[]}):[];return{count,truncated,coordinates}}async function identifyLegacyDispositionCandidates(pmRoot,coordinates){const candidates=[];for(const coordinate of coordinates){let raw;try{raw=await readFile(path.join(pmRoot,"history",`${coordinate.item_id}.jsonl`),"utf8")}catch{continue}const line=raw.split(/\r?\n/)[coordinate.history_line-1];if(line===void 0||line.trim().length===0)continue;let parsed;try{parsed=JSON.parse(line)}catch{continue}const reference=extractHistoryMergeReceiptReferences(parsed,coordinate.item_id).find(entry=>entry.receiptId===coordinate.receipt_id);if(reference===void 0||!isPreDurableDispositionEligibleReference(reference)||reference.eventTimestamp===void 0||compareTimestampStrings(reference.eventTimestamp,DURABLE_MERGE_RECEIPT_INTRODUCED_AT)>=0){continue}candidates.push({...coordinate,original_event_ts:reference.eventTimestamp})}return candidates}async function recordLegacyReceiptDispositions(params){if(params.options.dryRun===true||params.options.force!==true||params.candidates.length===0){return 0}const byItem=new Map;for(const candidate of params.candidates){const itemCandidates=byItem.get(candidate.item_id)??[];itemCandidates.push(candidate);byItem.set(candidate.item_id,itemCandidates)}for(const[itemId,itemCandidates]of byItem){await runHistoryRepair(itemId,{author:params.options.author??params.global.author,message:params.options.message??"accept unrecoverable pre-durable merge receipt references",force:true,auditOperation:"merge_reconcile",forceAuditEntry:true,auditContext:{merge:{missing_receipt_dispositions:itemCandidates.map(candidate=>({receipt_id:candidate.receipt_id,original_history_line:candidate.history_line,original_event_ts:candidate.original_event_ts,reason:"legacy_clone_local_only"}))}}},params.global)}return params.candidates.length}async function runReceiptOnlyRepair(params){try{return{status:"fulfilled",value:await runHistoryRepair(params.id,{dryRun:params.dryRun,author:params.options.author??params.global.author,message:params.options.message??"record field-aware branch merge provenance",force:params.options.force,auditOperation:"merge_reconcile",auditContext:params.auditContext,forceAuditEntry:true,mergeReceiptProof:params.mergeReceiptProof},params.global)}}catch(reason){return{status:"rejected",reason}}}function appendReceiptOnlyResults(params){params.results.forEach((settled,index)=>{const id=params.receiptOnlyIds[index];if(settled.status==="fulfilled"){const outcome=settled.value.changed?"repaired":"skipped_clean";params.repair.streams.push({id,outcome,entries_rehashed:settled.value.history.entries_rehashed,entries_patch_repaired:settled.value.history.entries_patch_repaired,reconciled_with_item:settled.value.history.reconciled_with_item,...settled.value.merge_receipt_proof?{merge_receipt_proof:settled.value.merge_receipt_proof}:{},warnings:settled.value.warnings});params.repair.totals[outcome]+=1;return}params.repair.streams.push({id,outcome:"failed",error:settled.reason instanceof Error?settled.reason.message:String(settled.reason)});params.repair.totals.failed+=1})}async function settleProvenReceipts(params){if(params.dryRun||params.repair.totals.failed>0)return 0;const trustedReceiptIds=new Set(params.repair.streams.flatMap(stream=>stream.merge_receipt_proof?.trusted?stream.merge_receipt_proof.receipt_ids:[]));const receiptsToSettle=params.pendingReceipts.filter(receipt=>trustedReceiptIds.has(receipt.id));await Promise.all(receiptsToSettle.map(receipt=>markMergeReceiptReconciled(params.gitWorkspaceRoot??process.cwd(),receipt,{requireExisting:true})));return receiptsToSettle.length}async function runMergeReconcile(options,global2){const dryRun=options.dryRun===true;const pmRoot=resolvePmRoot(process.cwd(),global2.path);const preflightHealth=await runHealth(global2,{checkOnly:true,full:true,skipVectors:true,skipDrift:true});const missingBefore=missingReceiptCoordinates(preflightHealth);const legacyDispositionCandidates=await identifyLegacyDispositionCandidates(pmRoot,missingBefore.coordinates);const gitWorkspaceRoot=await findGitWorkspaceRoot(pmRoot);const receiptEvidence=await inspectMergeReceiptEvidence(gitWorkspaceRoot??process.cwd(),{includeLossless:true,pmRoot});if(receiptEvidence.invalid_evidence_count>0){throw new PmCliError(`Merge reconciliation refused ${receiptEvidence.invalid_evidence_count} invalid receipt evidence file(s).`,EXIT_CODE.CONFLICT,{code:"merge_receipt_evidence_invalid",required:"Every clone-local and durable receipt candidate must pass bounded-file, schema, and identity validation.",recovery:{suggested_retry:"pm health --check-only --full"}})}const recordedLegacyDispositionCount=await recordLegacyReceiptDispositions({candidates:legacyDispositionCandidates,options,global:global2});const pendingReceipts=receiptEvidence.receipts;const abandonedReceiptIds=await settleAbandonedMergeReceipts({cwd:gitWorkspaceRoot,receipts:pendingReceipts,dryRun,author:options.author,message:options.message,global:global2});const abandonedIds=new Set(abandonedReceiptIds);const receiptsByItem=new Map;for(const receipt of pendingReceipts.filter(entry=>!abandonedIds.has(entry.id))){const receipts=receiptsByItem.get(receipt.item_id)??[];receipts.push(receipt);receiptsByItem.set(receipt.item_id,receipts)}const auditContextById=Object.fromEntries([...receiptsByItem].map(([id,receipts])=>[id,{merge:{receipts:receipts.map(summarizeMergeReceipt)}}]));const mergeReceiptProofById=Object.fromEntries([...receiptsByItem].map(([id,receipts])=>[id,{gitWorkspaceRoot,receipts}]));const repair=await runHistoryRepairAll({dryRun,author:options.author??global2.author,message:options.message??"post-merge reconciliation of field-aware tracker history",force:options.force,auditOperation:"merge_reconcile",auditContextById,...pendingReceipts.length>0?{mergeReceiptProofById}:{}},global2);const representedIds=new Set(repair.streams.map(stream=>stream.id));const receiptOnlyIds=[...receiptsByItem.keys()].filter(id=>!representedIds.has(id));const receiptOnlyResults=await mapWithFixedConcurrency(receiptOnlyIds,RECEIPT_ONLY_REPAIR_CONCURRENCY,id=>runReceiptOnlyRepair({id,dryRun,options,global:global2,auditContext:auditContextById[id],mergeReceiptProof:mergeReceiptProofById[id]}));appendReceiptOnlyResults({receiptOnlyIds,results:receiptOnlyResults,repair});const reconciledReceiptCount=await settleProvenReceipts({dryRun,pendingReceipts,repair,gitWorkspaceRoot});const validation=await runValidate({checkHistoryDrift:true,checkStorageIntegrity:true},global2);const postflightHealth=recordedLegacyDispositionCount===0?preflightHealth:await runHealth(global2,{checkOnly:true,full:true,skipVectors:true,skipDrift:true});const missingAfter=missingReceiptCoordinates(postflightHealth);const mergeChecksGreen=validation.checks.every(check=>check.status==="ok");const receiptSettlementComplete=dryRun?pendingReceipts.length===0:reconciledReceiptCount+abandonedReceiptIds.length===pendingReceipts.length;const ok=[repair.totals.failed===0,mergeChecksGreen,receiptSettlementComplete,missingAfter.count===0,!missingAfter.truncated].every(Boolean);const boundedBatchGuidance=missingBefore.truncated||missingAfter.truncated?"Missing receipt coordinates exceed the bounded detail response; each reviewed --force pass can disposition only the reported eligible batch. Repeat dry-run and --force passes until receipts.missing_history_references_after=0 and pm merge reconcile returns ok=true.":void 0;const guidance=(dryRun?["Review repair.streams, then rerun pm merge reconcile without --dry-run to apply audited repairs.",boundedBatchGuidance,"No Git hook is installed automatically; invoke this command from an explicit post-merge hook only when your repository policy opts in."]:ok?["Reconciliation is complete; commit changed history streams with the merge result.","Rerun pm merge reconcile --dry-run after future tracker-data merges as a non-mutating integrity check."]:["Reconciliation remains incomplete; inspect repair failures and non-green validation checks before retrying.",boundedBatchGuidance,...legacyDispositionCandidates.length>0&&recordedLegacyDispositionCount===0?["Pre-durable clone-local-only receipt references are eligible for an audited disposition; rerun with --force after reviewing receipts.legacy_disposition_eligible."]:[],"Do not commit repaired history streams as reconciled until pm merge reconcile returns ok=true."]).filter(message=>message!==void 0);return{ok,dry_run:dryRun,repair,receipts:{pending_before:pendingReceipts.length,reconciled:reconciledReceiptCount,abandoned:abandonedReceiptIds.length,summaries:pendingReceipts.map(summarizeMergeReceipt),missing_history_references_before:missingBefore.count,legacy_disposition_eligible:legacyDispositionCandidates.length,legacy_disposition_recorded:recordedLegacyDispositionCount,missing_history_references_after:missingAfter.count},validation,guidance,generated_at:validation.generated_at}}export{runMergeReconcile};
|
|
1
|
+
!(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="017ec565-4b8d-5da3-badc-e9f4ca3ec433")}catch(e2){}})();import{settleAbandonedMergeReceipts}from"./abandoned-receipts.js";import{readFile}from"node:fs/promises";import path from"node:path";import{EXIT_CODE}from"../../core/shared/constants.js";import{PmCliError}from"../../core/shared/errors.js";import{compareTimestampStrings}from"../../core/shared/time.js";import{resolvePmRoot}from"../../core/store/paths.js";import{mapWithFixedConcurrency}from"../extension/concurrency.js";import{runHealth}from"../governance/health.js";import{DURABLE_MERGE_RECEIPT_INTRODUCED_AT,extractHistoryMergeReceiptReferences,isPreDurableDispositionEligibleReference}from"../governance/merge-receipt-history.js";import{runValidate}from"../governance/validate.js";import{runHistoryRepair,runHistoryRepairAll}from"../history-repair.js";import{findGitWorkspaceRoot}from"./install.js";import{inspectMergeReceiptEvidence,markMergeReceiptReconciled,summarizeMergeReceipt}from"./receipts.js";const RECEIPT_ONLY_REPAIR_CONCURRENCY=4;function missingReceiptCoordinates(health){const integrity=health.checks.find(check=>check.name==="integrity");const counts=integrity?.details.counts;const count=typeof counts==="object"&&counts!==null&&!Array.isArray(counts)&&typeof counts.missing_merge_receipt_history_references==="number"?counts.missing_merge_receipt_history_references:0;const details=integrity?.details.missing_merge_receipt_history_reference_details;const truncated=integrity?.details.missing_merge_receipt_history_reference_details_truncated===true;const coordinates=Array.isArray(details)?details.flatMap(detail=>{if(typeof detail!=="object"||detail===null||Array.isArray(detail)){return[]}const record=detail;return typeof record.item_id==="string"&&typeof record.history_line==="number"&&Number.isSafeInteger(record.history_line)&&typeof record.receipt_id==="string"?[{item_id:record.item_id,history_line:record.history_line,receipt_id:record.receipt_id}]:[]}):[];return{count,truncated,coordinates}}async function identifyLegacyDispositionCandidates(pmRoot,coordinates){const candidates=[];for(const coordinate of coordinates){let raw;try{raw=await readFile(path.join(pmRoot,"history",`${coordinate.item_id}.jsonl`),"utf8")}catch{continue}const line=raw.split(/\r?\n/)[coordinate.history_line-1];if(line===void 0||line.trim().length===0)continue;let parsed;try{parsed=JSON.parse(line)}catch{continue}const reference=extractHistoryMergeReceiptReferences(parsed,coordinate.item_id).find(entry=>entry.receiptId===coordinate.receipt_id);if(reference===void 0||!isPreDurableDispositionEligibleReference(reference)||reference.eventTimestamp===void 0||compareTimestampStrings(reference.eventTimestamp,DURABLE_MERGE_RECEIPT_INTRODUCED_AT)>=0){continue}candidates.push({...coordinate,original_event_ts:reference.eventTimestamp})}return candidates}async function recordLegacyReceiptDispositions(params){if(params.options.dryRun===true||params.options.force!==true||params.candidates.length===0){return 0}const byItem=new Map;for(const candidate of params.candidates){const itemCandidates=byItem.get(candidate.item_id)??[];itemCandidates.push(candidate);byItem.set(candidate.item_id,itemCandidates)}for(const[itemId,itemCandidates]of byItem){await runHistoryRepair(itemId,{author:params.options.author??params.global.author,message:params.options.message??"accept unrecoverable pre-durable merge receipt references",force:true,auditOperation:"merge_reconcile",forceAuditEntry:true,auditContext:{merge:{missing_receipt_dispositions:itemCandidates.map(candidate=>({receipt_id:candidate.receipt_id,original_history_line:candidate.history_line,original_event_ts:candidate.original_event_ts,reason:"legacy_clone_local_only"}))}}},params.global)}return params.candidates.length}async function runReceiptOnlyRepair(params){try{return{status:"fulfilled",value:await runHistoryRepair(params.id,{dryRun:params.dryRun,author:params.options.author??params.global.author,message:params.options.message??"record field-aware branch merge provenance",force:params.options.force,auditOperation:"merge_reconcile",auditContext:params.auditContext,forceAuditEntry:true,mergeReceiptProof:params.mergeReceiptProof},params.global)}}catch(reason){return{status:"rejected",reason}}}function appendReceiptOnlyResults(params){params.results.forEach((settled,index)=>{const id=params.receiptOnlyIds[index];if(settled.status==="fulfilled"){const outcome=settled.value.changed?"repaired":"skipped_clean";params.repair.streams.push({id,outcome,entries_rehashed:settled.value.history.entries_rehashed,entries_patch_repaired:settled.value.history.entries_patch_repaired,reconciled_with_item:settled.value.history.reconciled_with_item,...settled.value.merge_receipt_proof?{merge_receipt_proof:settled.value.merge_receipt_proof}:{},warnings:settled.value.warnings});params.repair.totals[outcome]+=1;return}params.repair.streams.push({id,outcome:"failed",error:settled.reason instanceof Error?settled.reason.message:String(settled.reason)});params.repair.totals.failed+=1})}async function settleProvenReceipts(params){if(params.dryRun||params.repair.totals.failed>0)return 0;const trustedReceiptIds=new Set(params.repair.streams.flatMap(stream=>stream.merge_receipt_proof?.trusted?stream.merge_receipt_proof.receipt_ids:[]));const receiptsToSettle=params.pendingReceipts.filter(receipt=>trustedReceiptIds.has(receipt.id));await Promise.all(receiptsToSettle.map(receipt=>markMergeReceiptReconciled(params.receiptWorkspaceRoot,receipt,{requireExisting:true})));return receiptsToSettle.length}async function runMergeReconcile(options,global2){const dryRun=options.dryRun===true;const pmRoot=resolvePmRoot(process.cwd(),global2.path);const preflightHealth=await runHealth(global2,{checkOnly:true,full:true,skipVectors:true,skipDrift:true});const missingBefore=missingReceiptCoordinates(preflightHealth);const legacyDispositionCandidates=await identifyLegacyDispositionCandidates(pmRoot,missingBefore.coordinates);const gitWorkspaceRoot=await findGitWorkspaceRoot(pmRoot);const receiptWorkspaceRoot=gitWorkspaceRoot??pmRoot;const receiptEvidence=await inspectMergeReceiptEvidence(receiptWorkspaceRoot,{includeLossless:true,pmRoot});if(receiptEvidence.invalid_evidence_count>0){throw new PmCliError(`Merge reconciliation refused ${receiptEvidence.invalid_evidence_count} invalid receipt evidence file(s).`,EXIT_CODE.CONFLICT,{code:"merge_receipt_evidence_invalid",required:"Every clone-local and durable receipt candidate must pass bounded-file, schema, and identity validation.",recovery:{suggested_retry:"pm health --check-only --full"}})}const recordedLegacyDispositionCount=await recordLegacyReceiptDispositions({candidates:legacyDispositionCandidates,options,global:global2});const pendingReceipts=receiptEvidence.receipts;const abandonedReceiptIds=await settleAbandonedMergeReceipts({cwd:gitWorkspaceRoot,receipts:pendingReceipts,dryRun,author:options.author,message:options.message,global:global2});const abandonedIds=new Set(abandonedReceiptIds);const receiptsByItem=new Map;for(const receipt of pendingReceipts.filter(entry=>!abandonedIds.has(entry.id))){const receipts=receiptsByItem.get(receipt.item_id)??[];receipts.push(receipt);receiptsByItem.set(receipt.item_id,receipts)}const auditContextById=Object.fromEntries([...receiptsByItem].map(([id,receipts])=>[id,{merge:{receipts:receipts.map(summarizeMergeReceipt)}}]));const mergeReceiptProofById=Object.fromEntries([...receiptsByItem].map(([id,receipts])=>[id,{gitWorkspaceRoot,receipts}]));const repair=await runHistoryRepairAll({dryRun,author:options.author??global2.author,message:options.message??"post-merge reconciliation of field-aware tracker history",force:options.force,auditOperation:"merge_reconcile",auditContextById,...pendingReceipts.length>0?{mergeReceiptProofById}:{}},global2);const representedIds=new Set(repair.streams.map(stream=>stream.id));const receiptOnlyIds=[...receiptsByItem.keys()].filter(id=>!representedIds.has(id));const receiptOnlyResults=await mapWithFixedConcurrency(receiptOnlyIds,RECEIPT_ONLY_REPAIR_CONCURRENCY,id=>runReceiptOnlyRepair({id,dryRun,options,global:global2,auditContext:auditContextById[id],mergeReceiptProof:mergeReceiptProofById[id]}));appendReceiptOnlyResults({receiptOnlyIds,results:receiptOnlyResults,repair});const reconciledReceiptCount=await settleProvenReceipts({dryRun,pendingReceipts,repair,receiptWorkspaceRoot});const validation=await runValidate({checkHistoryDrift:true,checkStorageIntegrity:true},global2);const postflightHealth=recordedLegacyDispositionCount===0?preflightHealth:await runHealth(global2,{checkOnly:true,full:true,skipVectors:true,skipDrift:true});const missingAfter=missingReceiptCoordinates(postflightHealth);const mergeChecksGreen=validation.checks.every(check=>check.status==="ok");const receiptSettlementComplete=dryRun?pendingReceipts.length===0:reconciledReceiptCount+abandonedReceiptIds.length===pendingReceipts.length;const ok=[repair.totals.failed===0,mergeChecksGreen,receiptSettlementComplete,missingAfter.count===0,!missingAfter.truncated].every(Boolean);const boundedBatchGuidance=missingBefore.truncated||missingAfter.truncated?"Missing receipt coordinates exceed the bounded detail response; each reviewed --force pass can disposition only the reported eligible batch. Repeat dry-run and --force passes until receipts.missing_history_references_after=0 and pm merge reconcile returns ok=true.":void 0;const guidance=(dryRun?["Review repair.streams, then rerun pm merge reconcile without --dry-run to apply audited repairs.",boundedBatchGuidance,"No Git hook is installed automatically; invoke this command from an explicit post-merge hook only when your repository policy opts in."]:ok?["Reconciliation is complete; commit changed history streams with the merge result.","Rerun pm merge reconcile --dry-run after future tracker-data merges as a non-mutating integrity check."]:["Reconciliation remains incomplete; inspect repair failures and non-green validation checks before retrying.",boundedBatchGuidance,...legacyDispositionCandidates.length>0&&recordedLegacyDispositionCount===0?["Pre-durable clone-local-only receipt references are eligible for an audited disposition; rerun with --force after reviewing receipts.legacy_disposition_eligible."]:[],"Do not commit repaired history streams as reconciled until pm merge reconcile returns ok=true."]).filter(message=>message!==void 0);return{ok,dry_run:dryRun,repair,receipts:{pending_before:pendingReceipts.length,reconciled:reconciledReceiptCount,abandoned:abandonedReceiptIds.length,summaries:pendingReceipts.map(summarizeMergeReceipt),missing_history_references_before:missingBefore.count,legacy_disposition_eligible:legacyDispositionCandidates.length,legacy_disposition_recorded:recordedLegacyDispositionCount,missing_history_references_after:missingAfter.count},validation,guidance,generated_at:validation.generated_at}}export{runMergeReconcile};
|
|
2
2
|
//# sourceMappingURL=reconcile.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
-
`}function renumberRelationshipEvents(events){return events.map((event,index)=>({...event,sequence:index+1}))}function mergeRelationshipEventStreams(baseRaw,oursRaw,theirsRaw){parseRelationshipJsonl(baseRaw,"base");const ours=parseRelationshipJsonl(oursRaw,"ours");const theirs=parseRelationshipJsonl(theirsRaw,"theirs");const limit=Math.min(ours.length,theirs.length);let shared=0;while(shared<limit&&ours[shared].eventId===theirs[shared].eventId){shared+=1}if(shared===ours.length&&shared===theirs.length){return{merged:relationshipEventsToRaw(ours),strategy:"identical",common_entries:shared,entries_from_ours:0,entries_from_theirs:0,entries_total:ours.length,reanchored:false}}if(shared===theirs.length){return{merged:relationshipEventsToRaw(ours),strategy:"fast_forward_ours",common_entries:shared,entries_from_ours:ours.length-shared,entries_from_theirs:0,entries_total:ours.length,reanchored:false}}if(shared===ours.length){return{merged:relationshipEventsToRaw(theirs),strategy:"fast_forward_theirs",common_entries:shared,entries_from_ours:0,entries_from_theirs:theirs.length-shared,entries_total:theirs.length,reanchored:false}}const oursSuffix=ours.slice(shared);const oursEventIds=new Set(oursSuffix.map(event=>event.eventId));const theirsSuffix=theirs.slice(shared).filter(event=>!oursEventIds.has(event.eventId));const mergedSuffix=[...oursSuffix,...theirsSuffix].sort((left,right)=>{if(left.timestamp!==void 0&&right.timestamp!==void 0){const byTs=compareTimestampStrings(left.timestamp,right.timestamp);if(byTs!==0){return byTs}}else if(left.timestamp===void 0&&right.timestamp!==void 0){return 1}else if(left.timestamp!==void 0){return-1}const leftFromOurs=oursEventIds.has(left.eventId);const rightFromOurs=oursEventIds.has(right.eventId);if(leftFromOurs!==rightFromOurs){return Number(rightFromOurs)-Number(leftFromOurs)}return 0});const merged=renumberRelationshipEvents([...ours.slice(0,shared),...mergedSuffix]);return{merged:relationshipEventsToRaw(merged),strategy:"union_reanchor",common_entries:shared,entries_from_ours:oursSuffix.length,entries_from_theirs:theirsSuffix.length,entries_total:merged.length,reanchored:true}}const ITEM_UNION_COLLECTION_FIELDS=["tags","dependencies","comments","notes","learnings","files","tests","test_runs","docs","reminders","events"];const ITEM_UNION_DELIMITED_FIELDS=["acceptance_criteria"];const ITEM_LATEST_TIMESTAMP_FIELDS=["updated_at"];function jsonEquals(left,right){if(left===void 0||right===void 0){return left===void 0&&right===void 0}return stableStringify(left)===stableStringify(right)}function unionCollection(base,ours,theirs){const toEntries=value=>Array.isArray(value)?value:[];const baseIds=new Set(toEntries(base).map(entry=>stableStringify(entry)));const oursEntries=toEntries(ours);const oursIds=new Set(oursEntries.map(entry=>stableStringify(entry)));const theirsEntries=toEntries(theirs);const theirsIds=new Set(theirsEntries.map(entry=>stableStringify(entry)));const merged=oursEntries.filter(entry=>{const identity=stableStringify(entry);return!baseIds.has(identity)||theirsIds.has(identity)});for(const entry of theirsEntries){const identity=stableStringify(entry);if(!oursIds.has(identity)&&!baseIds.has(identity)){merged.push(entry)}}return merged}function linkedTestDefinitionIdentity(value){if(typeof value!=="object"||value===null||Array.isArray(value)){return stableStringify(value)}const{provenance:_provenance,...definition}=value;return stableStringify(definition)}function markMergedLinkedTest(value){if(typeof value!=="object"||value===null||Array.isArray(value)){return value}const test=value;if(!test.provenance){return{...test,provenance:{source_kind:"merge_union"}}}return{...test,provenance:{...test.provenance,source_kind:"merge_union"}}}function unionLinkedTests(base,ours,theirs){const toEntries=value=>Array.isArray(value)?value:[];const baseIds=new Set(toEntries(base).map(linkedTestDefinitionIdentity));const oursEntries=toEntries(ours);const oursIds=new Set(oursEntries.map(linkedTestDefinitionIdentity));const theirsEntries=toEntries(theirs);const theirsIds=new Set(theirsEntries.map(linkedTestDefinitionIdentity));const merged=oursEntries.filter(entry=>{const identity=linkedTestDefinitionIdentity(entry);return!baseIds.has(identity)||theirsIds.has(identity)});for(const entry of theirsEntries){const identity=linkedTestDefinitionIdentity(entry);if(!oursIds.has(identity)&&!baseIds.has(identity)){merged.push(markMergedLinkedTest(entry))}}return merged}function latestTimestamp(ours,theirs){return compareTimestampStrings(String(ours),String(theirs))>=0?ours:theirs}function mergeScalarThreeWay(base,ours,theirs,preferred){if(jsonEquals(ours,theirs)){return{value:ours,from_theirs:false,conflict:false}}if(jsonEquals(base,ours)){return{value:theirs,from_theirs:true,conflict:false}}if(jsonEquals(base,theirs)){return{value:ours,from_theirs:false,conflict:false}}return{value:preferred==="theirs"?theirs:ours,from_theirs:preferred==="theirs",conflict:true}}function mergeItemScalarThreeWay(base,ours,theirs,preferred,conflictResolution,oursUpdatedAt,theirsUpdatedAt){const outcome=mergeScalarThreeWay(base,ours,theirs,preferred);if(!outcome.conflict){return{...outcome,conflict:false}}if(conflictResolution==="preferred_side"){return{...outcome,resolution_basis:"requested_preference",retained_side:outcome.from_theirs?"theirs":"ours"}}const timestampOrder=compareTimestampStrings(oursUpdatedAt,theirsUpdatedAt);if(conflictResolution==="latest_document_update"&×tampOrder!==0){const retainTheirs2=timestampOrder<0;return{value:retainTheirs2?theirs:ours,from_theirs:retainTheirs2,conflict:true,resolution_basis:"document_updated_at",retained_side:retainTheirs2?"theirs":"ours"}}const retainTheirs=stableStringify(encodeItemScalarDecisionValue(theirs)).localeCompare(stableStringify(encodeItemScalarDecisionValue(ours)))<0;return{value:retainTheirs?theirs:ours,from_theirs:retainTheirs,conflict:true,resolution_basis:"stable_value_tiebreak",retained_side:retainTheirs?"theirs":"ours"}}function toMetadataRecord(document){return{...document.metadata}}function parseItemMergeSide(raw,label,options){try{const document=canonicalDocument(parseItemDocument(raw,options),options);const reservedField=Object.entries(document.metadata).find(([,value])=>isItemScalarMissingValue(value))?.[0];if(reservedField!==void 0){throw new TypeError(`metadata field ${reservedField} uses the reserved missing-scalar evidence marker`)}return document}catch(error){throw new PmCliError(`Item merge input (${label}) is not a readable item document: ${String(error)}`,EXIT_CODE.GENERIC_FAILURE)}}function mergeItemUnionField(params){if(!params.unionFieldSet.has(params.field))return false;const union=params.field==="tests"?unionLinkedTests(params.baseValue,params.oursValue,params.theirsValue):params.field==="acceptance_criteria"?unionCollection(splitAcceptanceCriteria(params.baseValue),splitAcceptanceCriteria(params.oursValue),splitAcceptanceCriteria(params.theirsValue)).join("; "):unionCollection(params.baseValue,params.oursValue,params.theirsValue);params.accumulator.merged[params.field]=union;if(!jsonEquals(union,params.oursValue)){params.accumulator.unionFields.push(params.field)}return true}function mergeItemScalarField(params){const outcome=mergeItemScalarThreeWay(params.baseValue,params.oursValue,params.theirsValue,params.preferred,params.conflictResolution,params.oursUpdatedAt,params.theirsUpdatedAt);if(outcome.value!==void 0){params.accumulator.merged[params.field]=outcome.value}if(outcome.conflict){params.accumulator.conflictFields.push(params.field);params.accumulator.conflictDecisions.push({field:params.field,base:encodeItemScalarDecisionValue(params.baseValue),ours:encodeItemScalarDecisionValue(params.oursValue),theirs:encodeItemScalarDecisionValue(params.theirsValue),retained:encodeItemScalarDecisionValue(outcome.value),discarded:encodeItemScalarDecisionValue(outcome.from_theirs?params.oursValue:params.theirsValue),retained_side:outcome.retained_side,resolution_basis:outcome.resolution_basis})}else if(outcome.from_theirs){params.accumulator.fieldsFromTheirs.push(params.field)}}function mergeItemMetadataRecords(baseRecord,oursRecord,theirsRecord,preferred,conflictResolution,oursUpdatedAt,theirsUpdatedAt){const unionFieldSet=new Set([...ITEM_UNION_COLLECTION_FIELDS,...ITEM_UNION_DELIMITED_FIELDS]);const latestFieldSet=new Set(ITEM_LATEST_TIMESTAMP_FIELDS);const fieldNames=[...new Set([...Object.keys(oursRecord),...Object.keys(theirsRecord)])].sort((left,right)=>left.localeCompare(right));const accumulator={merged:{},conflictFields:[],fieldsFromTheirs:[],unionFields:[],conflictDecisions:[]};for(const field of fieldNames){const baseValue=baseRecord[field];const oursValue=oursRecord[field];const theirsValue=theirsRecord[field];if(mergeItemUnionField({field,baseValue,oursValue,theirsValue,unionFieldSet,accumulator})){continue}if(latestFieldSet.has(field)){accumulator.merged[field]=latestTimestamp(oursValue,theirsValue);continue}mergeItemScalarField({field,baseValue,oursValue,theirsValue,preferred,conflictResolution,oursUpdatedAt,theirsUpdatedAt,accumulator})}return accumulator}function mergeItemDocuments(baseRaw,oursRaw,theirsRaw,options={}){const preferred=options.preferred??"ours";const conflictResolution=options.conflictResolution??"preferred_side";const hasBase=baseRaw.trim().length>0;const ours=parseItemMergeSide(oursRaw,"ours",options);const theirs=parseItemMergeSide(theirsRaw,"theirs",options);const base=hasBase?parseItemMergeSide(baseRaw,"base",options):ours;const baseRecord=hasBase?toMetadataRecord(base):{};const oursRecord=toMetadataRecord(ours);const theirsRecord=toMetadataRecord(theirs);const{merged,conflictFields,fieldsFromTheirs,unionFields,conflictDecisions}=mergeItemMetadataRecords(baseRecord,oursRecord,theirsRecord,preferred,conflictResolution,ours.metadata.updated_at,theirs.metadata.updated_at);const bodyOutcome=mergeItemScalarThreeWay(hasBase?base.body:"",ours.body,theirs.body,preferred,conflictResolution,ours.metadata.updated_at,theirs.metadata.updated_at);if(bodyOutcome.conflict){conflictFields.push("body");conflictDecisions.push({field:"body",base:encodeItemScalarDecisionValue(hasBase?base.body:""),ours:encodeItemScalarDecisionValue(ours.body),theirs:encodeItemScalarDecisionValue(theirs.body),retained:encodeItemScalarDecisionValue(bodyOutcome.value),discarded:encodeItemScalarDecisionValue(bodyOutcome.from_theirs?ours.body:theirs.body),retained_side:bodyOutcome.retained_side,resolution_basis:bodyOutcome.resolution_basis})}else if(bodyOutcome.from_theirs){fieldsFromTheirs.push("body")}const mergedRaw=serializeItemDocument({metadata:merged,body:bodyOutcome.value},options);return{merged:mergedRaw,conflict_fields:conflictFields,fields_from_theirs:fieldsFromTheirs,union_fields:unionFields,conflict_decisions:conflictDecisions,requested_preference:preferred,requested_preference_applied:conflictResolution==="preferred_side",conflict_resolution:conflictResolution}}function isPlainObject(value){return typeof value==="object"&&value!==null&&!Array.isArray(value)}function parseJsonSide(raw,label){const conflictMarker=findFirstMergeConflictMarker(raw);if(conflictMarker){throw new PmCliError(`JSON merge input (${label}) contains unresolved conflict markers at line ${conflictMarker.line}.`,EXIT_CODE.GENERIC_FAILURE)}if(raw.trim().length===0){return void 0}try{return JSON.parse(raw)}catch{throw new PmCliError(`JSON merge input (${label}) is not valid JSON.`,EXIT_CODE.GENERIC_FAILURE)}}function mergeAdditiveJsonArrays(base,ours,theirs){if(!Array.isArray(base)||!Array.isArray(ours)||!Array.isArray(theirs)){return null}const countEntries=entries=>{const counts=new Map;for(const entry of entries){const identity=stableStringify(entry);counts.set(identity,(counts.get(identity)??0)+1)}return counts};const baseCounts=countEntries(base);const oursCounts=countEntries(ours);const theirsCounts=countEntries(theirs);for(const[identity,baseCount]of baseCounts){if((oursCounts.get(identity)??0)<baseCount||(theirsCounts.get(identity)??0)<baseCount){return null}}const unmatchedOursCounts=new Map(oursCounts);const additionsFromTheirs=[];for(const entry of theirs){const identity=stableStringify(entry);const unmatchedOursCount=unmatchedOursCounts.get(identity)??0;if(unmatchedOursCount>0){unmatchedOursCounts.set(identity,unmatchedOursCount-1)}else{additionsFromTheirs.push(entry)}}return{merged:[...ours,...additionsFromTheirs],acceptedTheirs:additionsFromTheirs.length>0}}function mergeJsonObjects(base,ours,theirs,preferred,pathPrefix,conflictPaths,pathsFromTheirs){if(!isPlainObject(ours)||!isPlainObject(theirs)){return null}const baseObject=isPlainObject(base)?base:{};const merged={};const keys=[...new Set([...Object.keys(ours),...Object.keys(theirs)])].sort((left,right)=>left.localeCompare(right));for(const key of keys){const childPath=pathPrefix.length>0?`${pathPrefix}.${key}`:key;const child=mergeJsonKey(baseObject,ours,theirs,key,preferred,childPath,conflictPaths,pathsFromTheirs);if(child!==void 0){merged[key]=child}}return merged}function mergeJsonValue(base,ours,theirs,preferred,pathPrefix,conflictPaths,pathsFromTheirs){if(jsonEquals(ours,theirs)){return ours}const additiveArrayMerge=mergeAdditiveJsonArrays(base,ours,theirs);if(additiveArrayMerge!==null){if(additiveArrayMerge.acceptedTheirs){pathsFromTheirs.push(pathPrefix)}return additiveArrayMerge.merged}const mergedObject=mergeJsonObjects(base,ours,theirs,preferred,pathPrefix,conflictPaths,pathsFromTheirs);if(mergedObject!==null){return mergedObject}const outcome=mergeScalarThreeWay(base,ours,theirs,preferred);if(outcome.conflict){conflictPaths.push(pathPrefix)}else if(outcome.from_theirs){pathsFromTheirs.push(pathPrefix)}return outcome.value}function mergeJsonKey(base,ours,theirs,key,preferred,childPath,conflictPaths,pathsFromTheirs){const inOurs=Object.prototype.hasOwnProperty.call(ours,key);const inTheirs=Object.prototype.hasOwnProperty.call(theirs,key);const inBase=Object.prototype.hasOwnProperty.call(base,key);if(inOurs&&inTheirs){return mergeJsonValue(base[key],ours[key],theirs[key],preferred,childPath,conflictPaths,pathsFromTheirs)}if(inOurs){if(inBase&&jsonEquals(base[key],ours[key])){pathsFromTheirs.push(childPath);return void 0}if(inBase){conflictPaths.push(childPath);return preferred==="theirs"?void 0:ours[key]}return ours[key]}if(inBase&&jsonEquals(base[key],theirs[key])){return void 0}if(inBase){conflictPaths.push(childPath);return preferred==="theirs"?theirs[key]:void 0}pathsFromTheirs.push(childPath);return theirs[key]}function mergeJsonDocuments(baseRaw,oursRaw,theirsRaw,options={}){const preferred=options.preferred??"ours";const base=parseJsonSide(baseRaw,"base");const ours=parseJsonSide(oursRaw,"ours");const theirs=parseJsonSide(theirsRaw,"theirs");const conflictPaths=[];const pathsFromTheirs=[];const merged=mergeJsonValue(base,ours,theirs,preferred,"",conflictPaths,pathsFromTheirs);return{merged:`${JSON.stringify(merged??null,null,2)}
|
|
1
|
+
!(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a917834c-52c2-54c6-af84-a57d4c4b3855")}catch(e2){}})();import{historyEntriesToRaw,reanchorHistoryEntries}from"../../core/history/replay.js";import{canonicalDocument,parseItemDocument,serializeItemDocument}from"../../core/item/item-format.js";import{splitAcceptanceCriteria}from"../../core/item/parse.js";import{EXIT_CODE}from"../../core/shared/constants.js";import{findFirstMergeConflictMarker}from"../../core/shared/conflict-markers.js";import{PmCliError}from"../../core/shared/errors.js";import{sha256Hex,stableStringify}from"../../core/shared/serialization.js";import{compareTimestampStrings}from"../../core/shared/time.js";const ITEM_SCALAR_MISSING_VALUE=Object.freeze({pm_item_scalar_missing:true});function isItemScalarMissingValue(value){return typeof value==="object"&&value!==null&&!Array.isArray(value)&&Object.keys(value).length===1&&value.pm_item_scalar_missing===true}function encodeItemScalarDecisionValue(value){return value===void 0?ITEM_SCALAR_MISSING_VALUE:value}function hashItemScalarDecisionValue(value){return sha256Hex(stableStringify(value===void 0?{pm_item_scalar_presence:"missing"}:{pm_item_scalar_presence:"present",value}))}function parseHistoryJsonl(raw,label){const conflictMarker=findFirstMergeConflictMarker(raw);if(conflictMarker){throw new PmCliError(`History merge input (${label}) contains unresolved conflict markers at line ${conflictMarker.line}. Merge drivers must receive clean per-side versions.`,EXIT_CODE.GENERIC_FAILURE)}const entries=[];for(const[index,rawLine]of raw.split(/\r?\n/).entries()){const line=rawLine.trim();if(!line){continue}try{const parsed=JSON.parse(line);if(typeof parsed!=="object"||parsed===null||Array.isArray(parsed)){throw new TypeError("history entry must be an object")}entries.push(parsed)}catch{throw new PmCliError(`History merge input (${label}) contains invalid JSON at line ${index+1}.`,EXIT_CODE.GENERIC_FAILURE)}}return entries}function historyEntryIdentity(entry){return stableStringify({ts:entry.ts,author:entry.author,op:entry.op,patch:entry.patch,message:entry.message??null})}function commonHistoryPrefixLength(ours,theirs){const limit=Math.min(ours.length,theirs.length);let shared=0;while(shared<limit&&historyEntryIdentity(ours[shared])===historyEntryIdentity(theirs[shared])){shared+=1}return shared}function mergeHistoryStreams(baseRaw,oursRaw,theirsRaw){const base=parseHistoryJsonl(baseRaw,"base");const ours=parseHistoryJsonl(oursRaw,"ours");const theirs=parseHistoryJsonl(theirsRaw,"theirs");const creates=[base,ours,theirs].map(entries=>entries.filter(entry=>entry.op==="create"));if(creates[0].length===0&&creates.slice(1).every(entries=>entries.length>0)||creates.some(entries=>entries.length>1)||new Set(creates.flat().map(historyEntryIdentity)).size>1){throw new PmCliError("Duplicate item identity: history contains independent or unproven create events. Preserve both branches and assign distinct item ids before merging.",EXIT_CODE.CONFLICT,{code:"item_identity_conflict"})}const shared=commonHistoryPrefixLength(ours,theirs);if(shared===ours.length&&shared===theirs.length){return{merged:historyEntriesToRaw(ours),strategy:"identical",common_entries:shared,entries_from_ours:0,entries_from_theirs:0,entries_total:ours.length,reanchored:false}}if(shared===theirs.length){return{merged:historyEntriesToRaw(ours),strategy:"fast_forward_ours",common_entries:shared,entries_from_ours:ours.length-shared,entries_from_theirs:0,entries_total:ours.length,reanchored:false}}if(shared===ours.length){return{merged:historyEntriesToRaw(theirs),strategy:"fast_forward_theirs",common_entries:shared,entries_from_ours:0,entries_from_theirs:theirs.length-shared,entries_total:theirs.length,reanchored:false}}const oursSuffix=ours.slice(shared);const seenIdentities=new Set(oursSuffix.map(historyEntryIdentity));const theirsSuffix=theirs.slice(shared).filter(entry=>!seenIdentities.has(historyEntryIdentity(entry)));const mergedSuffix=[...oursSuffix,...theirsSuffix].sort((left,right)=>{const byTs=compareTimestampStrings(left.ts,right.ts);if(byTs!==0){return byTs}const leftFromOurs=seenIdentities.has(historyEntryIdentity(left));const rightFromOurs=seenIdentities.has(historyEntryIdentity(right));if(leftFromOurs!==rightFromOurs){return Number(rightFromOurs)-Number(leftFromOurs)}return historyEntryIdentity(left).localeCompare(historyEntryIdentity(right))});const reanchored=reanchorHistoryEntries([...ours.slice(0,shared),...mergedSuffix],void 0,{continuousHashSurface:true});if(reanchored.skippedOps>0){throw new PmCliError(`History union cannot preserve ${reanchored.skippedOps} patch operation(s) after deterministic suffix ordering; leave the file unresolved for manual recovery.`,EXIT_CODE.GENERIC_FAILURE)}return{merged:historyEntriesToRaw(reanchored.entries),strategy:"union_reanchor",common_entries:shared,entries_from_ours:oursSuffix.length,entries_from_theirs:theirsSuffix.length,entries_total:reanchored.entries.length,reanchored:true}}function parseRelationshipJsonl(raw,label){const conflictMarker=findFirstMergeConflictMarker(raw);if(conflictMarker){throw new PmCliError(`Relationship merge input (${label}) contains unresolved conflict markers at line ${conflictMarker.line}. Merge drivers must receive clean per-side versions.`,EXIT_CODE.GENERIC_FAILURE)}const events=[];for(const[index,rawLine]of raw.split(/\r?\n/).entries()){const line=rawLine.trim();if(!line){continue}let parsed;try{parsed=JSON.parse(line)}catch{throw new PmCliError(`Relationship merge input (${label}) contains invalid JSON at line ${index+1}.`,EXIT_CODE.GENERIC_FAILURE)}if(typeof parsed!=="object"||parsed===null||Array.isArray(parsed)||typeof parsed.eventId!=="string"||typeof parsed.sequence!=="number"){throw new PmCliError(`Relationship merge input (${label}) line ${index+1} is not a relationship event (eventId + sequence required).`,EXIT_CODE.GENERIC_FAILURE)}events.push(parsed)}return events}function relationshipEventsToRaw(events){return events.length===0?"":`${events.map(event=>JSON.stringify(event)).join("\n")}
|
|
2
|
+
`}function renumberRelationshipEvents(events){return events.map((event,index)=>({...event,sequence:index+1}))}function mergeRelationshipEventStreams(baseRaw,oursRaw,theirsRaw){parseRelationshipJsonl(baseRaw,"base");const ours=parseRelationshipJsonl(oursRaw,"ours");const theirs=parseRelationshipJsonl(theirsRaw,"theirs");const limit=Math.min(ours.length,theirs.length);let shared=0;while(shared<limit&&ours[shared].eventId===theirs[shared].eventId){shared+=1}if(shared===ours.length&&shared===theirs.length){return{merged:relationshipEventsToRaw(ours),strategy:"identical",common_entries:shared,entries_from_ours:0,entries_from_theirs:0,entries_total:ours.length,reanchored:false}}if(shared===theirs.length){return{merged:relationshipEventsToRaw(ours),strategy:"fast_forward_ours",common_entries:shared,entries_from_ours:ours.length-shared,entries_from_theirs:0,entries_total:ours.length,reanchored:false}}if(shared===ours.length){return{merged:relationshipEventsToRaw(theirs),strategy:"fast_forward_theirs",common_entries:shared,entries_from_ours:0,entries_from_theirs:theirs.length-shared,entries_total:theirs.length,reanchored:false}}const oursSuffix=ours.slice(shared);const oursEventIds=new Set(oursSuffix.map(event=>event.eventId));const theirsSuffix=theirs.slice(shared).filter(event=>!oursEventIds.has(event.eventId));const mergedSuffix=[...oursSuffix,...theirsSuffix].sort((left,right)=>{if(left.timestamp!==void 0&&right.timestamp!==void 0){const byTs=compareTimestampStrings(left.timestamp,right.timestamp);if(byTs!==0){return byTs}}else if(left.timestamp===void 0&&right.timestamp!==void 0){return 1}else if(left.timestamp!==void 0){return-1}const leftFromOurs=oursEventIds.has(left.eventId);const rightFromOurs=oursEventIds.has(right.eventId);if(leftFromOurs!==rightFromOurs){return Number(rightFromOurs)-Number(leftFromOurs)}return 0});const merged=renumberRelationshipEvents([...ours.slice(0,shared),...mergedSuffix]);return{merged:relationshipEventsToRaw(merged),strategy:"union_reanchor",common_entries:shared,entries_from_ours:oursSuffix.length,entries_from_theirs:theirsSuffix.length,entries_total:merged.length,reanchored:true}}const ITEM_UNION_COLLECTION_FIELDS=["tags","dependencies","comments","notes","learnings","files","tests","test_runs","docs","reminders","events"];const ITEM_UNION_DELIMITED_FIELDS=["acceptance_criteria"];const ITEM_LATEST_TIMESTAMP_FIELDS=["updated_at"];function jsonEquals(left,right){if(left===void 0||right===void 0){return left===void 0&&right===void 0}return stableStringify(left)===stableStringify(right)}function unionCollection(base,ours,theirs){const toEntries=value=>Array.isArray(value)?value:[];const baseIds=new Set(toEntries(base).map(entry=>stableStringify(entry)));const oursEntries=toEntries(ours);const oursIds=new Set(oursEntries.map(entry=>stableStringify(entry)));const theirsEntries=toEntries(theirs);const theirsIds=new Set(theirsEntries.map(entry=>stableStringify(entry)));const merged=oursEntries.filter(entry=>{const identity=stableStringify(entry);return!baseIds.has(identity)||theirsIds.has(identity)});for(const entry of theirsEntries){const identity=stableStringify(entry);if(!oursIds.has(identity)&&!baseIds.has(identity)){merged.push(entry)}}return merged}function linkedTestDefinitionIdentity(value){if(typeof value!=="object"||value===null||Array.isArray(value)){return stableStringify(value)}const{provenance:_provenance,...definition}=value;return stableStringify(definition)}function markMergedLinkedTest(value){if(typeof value!=="object"||value===null||Array.isArray(value)){return value}const test=value;if(!test.provenance){return{...test,provenance:{source_kind:"merge_union"}}}return{...test,provenance:{...test.provenance,source_kind:"merge_union"}}}function unionLinkedTests(base,ours,theirs){const toEntries=value=>Array.isArray(value)?value:[];const baseIds=new Set(toEntries(base).map(linkedTestDefinitionIdentity));const oursEntries=toEntries(ours);const oursIds=new Set(oursEntries.map(linkedTestDefinitionIdentity));const theirsEntries=toEntries(theirs);const theirsIds=new Set(theirsEntries.map(linkedTestDefinitionIdentity));const merged=oursEntries.filter(entry=>{const identity=linkedTestDefinitionIdentity(entry);return!baseIds.has(identity)||theirsIds.has(identity)});for(const entry of theirsEntries){const identity=linkedTestDefinitionIdentity(entry);if(!oursIds.has(identity)&&!baseIds.has(identity)){merged.push(markMergedLinkedTest(entry))}}return merged}function latestTimestamp(ours,theirs){return compareTimestampStrings(String(ours),String(theirs))>=0?ours:theirs}function mergeScalarThreeWay(base,ours,theirs,preferred){if(jsonEquals(ours,theirs)){return{value:ours,from_theirs:false,conflict:false}}if(jsonEquals(base,ours)){return{value:theirs,from_theirs:true,conflict:false}}if(jsonEquals(base,theirs)){return{value:ours,from_theirs:false,conflict:false}}return{value:preferred==="theirs"?theirs:ours,from_theirs:preferred==="theirs",conflict:true}}function mergeItemScalarThreeWay(base,ours,theirs,preferred,conflictResolution,oursUpdatedAt,theirsUpdatedAt){const outcome=mergeScalarThreeWay(base,ours,theirs,preferred);if(!outcome.conflict){return{...outcome,conflict:false}}if(conflictResolution==="preferred_side"){return{...outcome,resolution_basis:"requested_preference",retained_side:outcome.from_theirs?"theirs":"ours"}}const timestampOrder=compareTimestampStrings(oursUpdatedAt,theirsUpdatedAt);if(conflictResolution==="latest_document_update"&×tampOrder!==0){const retainTheirs2=timestampOrder<0;return{value:retainTheirs2?theirs:ours,from_theirs:retainTheirs2,conflict:true,resolution_basis:"document_updated_at",retained_side:retainTheirs2?"theirs":"ours"}}const retainTheirs=stableStringify(encodeItemScalarDecisionValue(theirs)).localeCompare(stableStringify(encodeItemScalarDecisionValue(ours)))<0;return{value:retainTheirs?theirs:ours,from_theirs:retainTheirs,conflict:true,resolution_basis:"stable_value_tiebreak",retained_side:retainTheirs?"theirs":"ours"}}function toMetadataRecord(document){return{...document.metadata}}function parseItemMergeSide(raw,label,options){try{const document=canonicalDocument(parseItemDocument(raw,options),options);const reservedField=Object.entries(document.metadata).find(([,value])=>isItemScalarMissingValue(value))?.[0];if(reservedField!==void 0){throw new TypeError(`metadata field ${reservedField} uses the reserved missing-scalar evidence marker`)}return document}catch(error){throw new PmCliError(`Item merge input (${label}) is not a readable item document: ${String(error)}`,EXIT_CODE.GENERIC_FAILURE)}}function mergeItemUnionField(params){if(!params.unionFieldSet.has(params.field))return false;const union=params.field==="tests"?unionLinkedTests(params.baseValue,params.oursValue,params.theirsValue):params.field==="acceptance_criteria"?unionCollection(splitAcceptanceCriteria(params.baseValue),splitAcceptanceCriteria(params.oursValue),splitAcceptanceCriteria(params.theirsValue)).join("; "):unionCollection(params.baseValue,params.oursValue,params.theirsValue);params.accumulator.merged[params.field]=union;if(!jsonEquals(union,params.oursValue)){params.accumulator.unionFields.push(params.field)}return true}function mergeItemScalarField(params){const outcome=mergeItemScalarThreeWay(params.baseValue,params.oursValue,params.theirsValue,params.preferred,params.conflictResolution,params.oursUpdatedAt,params.theirsUpdatedAt);if(outcome.value!==void 0){params.accumulator.merged[params.field]=outcome.value}if(outcome.conflict){params.accumulator.conflictFields.push(params.field);params.accumulator.conflictDecisions.push({field:params.field,base:encodeItemScalarDecisionValue(params.baseValue),ours:encodeItemScalarDecisionValue(params.oursValue),theirs:encodeItemScalarDecisionValue(params.theirsValue),retained:encodeItemScalarDecisionValue(outcome.value),discarded:encodeItemScalarDecisionValue(outcome.from_theirs?params.oursValue:params.theirsValue),retained_side:outcome.retained_side,resolution_basis:outcome.resolution_basis})}else if(outcome.from_theirs){params.accumulator.fieldsFromTheirs.push(params.field)}}function mergeItemMetadataRecords(baseRecord,oursRecord,theirsRecord,preferred,conflictResolution,oursUpdatedAt,theirsUpdatedAt){const unionFieldSet=new Set([...ITEM_UNION_COLLECTION_FIELDS,...ITEM_UNION_DELIMITED_FIELDS]);const latestFieldSet=new Set(ITEM_LATEST_TIMESTAMP_FIELDS);const fieldNames=[...new Set([...Object.keys(oursRecord),...Object.keys(theirsRecord)])].sort((left,right)=>left.localeCompare(right));const accumulator={merged:{},conflictFields:[],fieldsFromTheirs:[],unionFields:[],conflictDecisions:[]};for(const field of fieldNames){const baseValue=baseRecord[field];const oursValue=oursRecord[field];const theirsValue=theirsRecord[field];if(mergeItemUnionField({field,baseValue,oursValue,theirsValue,unionFieldSet,accumulator})){continue}if(latestFieldSet.has(field)){accumulator.merged[field]=latestTimestamp(oursValue,theirsValue);continue}mergeItemScalarField({field,baseValue,oursValue,theirsValue,preferred,conflictResolution,oursUpdatedAt,theirsUpdatedAt,accumulator})}return accumulator}function mergeItemDocuments(baseRaw,oursRaw,theirsRaw,options={}){const preferred=options.preferred??"ours";const conflictResolution=options.conflictResolution??"preferred_side";const ours=parseItemMergeSide(oursRaw,"ours",options);const theirs=parseItemMergeSide(theirsRaw,"theirs",options);if(baseRaw.trim().length===0){throw new PmCliError("Duplicate item identity: add/add item documents have no common ancestor. Preserve both branches and assign distinct item ids before merging.",EXIT_CODE.CONFLICT,{code:"item_identity_conflict",item_id:ours.metadata.id})}const base=parseItemMergeSide(baseRaw,"base",options);if(base.metadata.id!==ours.metadata.id||base.metadata.id!==theirs.metadata.id){throw new PmCliError("Duplicate or mismatched item identity: all merge sides must address the common ancestor's item id.",EXIT_CODE.CONFLICT,{code:"item_identity_conflict",item_id:base.metadata.id})}const baseRecord=toMetadataRecord(base);const oursRecord=toMetadataRecord(ours);const theirsRecord=toMetadataRecord(theirs);const{merged,conflictFields,fieldsFromTheirs,unionFields,conflictDecisions}=mergeItemMetadataRecords(baseRecord,oursRecord,theirsRecord,preferred,conflictResolution,ours.metadata.updated_at,theirs.metadata.updated_at);const bodyOutcome=mergeItemScalarThreeWay(base.body,ours.body,theirs.body,preferred,conflictResolution,ours.metadata.updated_at,theirs.metadata.updated_at);if(bodyOutcome.conflict){conflictFields.push("body");conflictDecisions.push({field:"body",base:encodeItemScalarDecisionValue(base.body),ours:encodeItemScalarDecisionValue(ours.body),theirs:encodeItemScalarDecisionValue(theirs.body),retained:encodeItemScalarDecisionValue(bodyOutcome.value),discarded:encodeItemScalarDecisionValue(bodyOutcome.from_theirs?ours.body:theirs.body),retained_side:bodyOutcome.retained_side,resolution_basis:bodyOutcome.resolution_basis})}else if(bodyOutcome.from_theirs){fieldsFromTheirs.push("body")}const mergedRaw=serializeItemDocument({metadata:merged,body:bodyOutcome.value},options);return{merged:mergedRaw,conflict_fields:conflictFields,fields_from_theirs:fieldsFromTheirs,union_fields:unionFields,conflict_decisions:conflictDecisions,requested_preference:preferred,requested_preference_applied:conflictResolution==="preferred_side",conflict_resolution:conflictResolution}}function isPlainObject(value){return typeof value==="object"&&value!==null&&!Array.isArray(value)}function parseJsonSide(raw,label){const conflictMarker=findFirstMergeConflictMarker(raw);if(conflictMarker){throw new PmCliError(`JSON merge input (${label}) contains unresolved conflict markers at line ${conflictMarker.line}.`,EXIT_CODE.GENERIC_FAILURE)}if(raw.trim().length===0){return void 0}try{return JSON.parse(raw)}catch{throw new PmCliError(`JSON merge input (${label}) is not valid JSON.`,EXIT_CODE.GENERIC_FAILURE)}}function mergeAdditiveJsonArrays(base,ours,theirs){if(!Array.isArray(base)||!Array.isArray(ours)||!Array.isArray(theirs)){return null}const countEntries=entries=>{const counts=new Map;for(const entry of entries){const identity=stableStringify(entry);counts.set(identity,(counts.get(identity)??0)+1)}return counts};const baseCounts=countEntries(base);const oursCounts=countEntries(ours);const theirsCounts=countEntries(theirs);for(const[identity,baseCount]of baseCounts){if((oursCounts.get(identity)??0)<baseCount||(theirsCounts.get(identity)??0)<baseCount){return null}}const unmatchedOursCounts=new Map(oursCounts);const additionsFromTheirs=[];for(const entry of theirs){const identity=stableStringify(entry);const unmatchedOursCount=unmatchedOursCounts.get(identity)??0;if(unmatchedOursCount>0){unmatchedOursCounts.set(identity,unmatchedOursCount-1)}else{additionsFromTheirs.push(entry)}}return{merged:[...ours,...additionsFromTheirs],acceptedTheirs:additionsFromTheirs.length>0}}function mergeJsonObjects(base,ours,theirs,preferred,pathPrefix,conflictPaths,pathsFromTheirs){if(!isPlainObject(ours)||!isPlainObject(theirs)){return null}const baseObject=isPlainObject(base)?base:{};const merged={};const keys=[...new Set([...Object.keys(ours),...Object.keys(theirs)])].sort((left,right)=>left.localeCompare(right));for(const key of keys){const childPath=pathPrefix.length>0?`${pathPrefix}.${key}`:key;const child=mergeJsonKey(baseObject,ours,theirs,key,preferred,childPath,conflictPaths,pathsFromTheirs);if(child!==void 0){merged[key]=child}}return merged}function mergeJsonValue(base,ours,theirs,preferred,pathPrefix,conflictPaths,pathsFromTheirs){if(jsonEquals(ours,theirs)){return ours}const additiveArrayMerge=mergeAdditiveJsonArrays(base,ours,theirs);if(additiveArrayMerge!==null){if(additiveArrayMerge.acceptedTheirs){pathsFromTheirs.push(pathPrefix)}return additiveArrayMerge.merged}const mergedObject=mergeJsonObjects(base,ours,theirs,preferred,pathPrefix,conflictPaths,pathsFromTheirs);if(mergedObject!==null){return mergedObject}const outcome=mergeScalarThreeWay(base,ours,theirs,preferred);if(outcome.conflict){conflictPaths.push(pathPrefix)}else if(outcome.from_theirs){pathsFromTheirs.push(pathPrefix)}return outcome.value}function mergeJsonKey(base,ours,theirs,key,preferred,childPath,conflictPaths,pathsFromTheirs){const inOurs=Object.prototype.hasOwnProperty.call(ours,key);const inTheirs=Object.prototype.hasOwnProperty.call(theirs,key);const inBase=Object.prototype.hasOwnProperty.call(base,key);if(inOurs&&inTheirs){return mergeJsonValue(base[key],ours[key],theirs[key],preferred,childPath,conflictPaths,pathsFromTheirs)}if(inOurs){if(inBase&&jsonEquals(base[key],ours[key])){pathsFromTheirs.push(childPath);return void 0}if(inBase){conflictPaths.push(childPath);return preferred==="theirs"?void 0:ours[key]}return ours[key]}if(inBase&&jsonEquals(base[key],theirs[key])){return void 0}if(inBase){conflictPaths.push(childPath);return preferred==="theirs"?theirs[key]:void 0}pathsFromTheirs.push(childPath);return theirs[key]}function mergeJsonDocuments(baseRaw,oursRaw,theirsRaw,options={}){const preferred=options.preferred??"ours";const base=parseJsonSide(baseRaw,"base");const ours=parseJsonSide(oursRaw,"ours");const theirs=parseJsonSide(theirsRaw,"theirs");const conflictPaths=[];const pathsFromTheirs=[];const merged=mergeJsonValue(base,ours,theirs,preferred,"",conflictPaths,pathsFromTheirs);return{merged:`${JSON.stringify(merged??null,null,2)}
|
|
3
3
|
`,conflict_paths:conflictPaths,paths_from_theirs:pathsFromTheirs,preferred}}export{ITEM_LATEST_TIMESTAMP_FIELDS,ITEM_SCALAR_MISSING_VALUE,ITEM_UNION_COLLECTION_FIELDS,encodeItemScalarDecisionValue,hashItemScalarDecisionValue,isItemScalarMissingValue,mergeHistoryStreams,mergeItemDocuments,mergeJsonDocuments,mergeRelationshipEventStreams};
|
|
4
4
|
//# sourceMappingURL=three-way.js.map
|
package/dist/sdk/notes.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
1
|
+
!(function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4e85b9bc-3387-5fb8-ac8b-c8f115c82b60")}catch(e2){}})();import{EXIT_CODE,PmCliError,parseLimit,stableStringify}from"./runtime-primitives.js";import{limitAnnotationEntries,parseAnnotationTextInput,resolveAnnotationInput,runAnnotationCommand}from"./annotations.js";function parseStructuredEventPayload(raw){if(raw===void 0)return void 0;if(raw.trim().length===0){throw new PmCliError("--add-json must contain a JSON value",EXIT_CODE.USAGE,{code:"structured_event_json_empty"})}let parsed;try{parsed=JSON.parse(raw)}catch{throw new PmCliError("--add-json must be valid JSON",EXIT_CODE.USAGE,{code:"structured_event_json_invalid"})}return parsed}function structuredEventType(value){if(typeof value!=="object"||value===null||Array.isArray(value)){return void 0}const candidate=value.type;return typeof candidate==="string"&&candidate.trim().length>0?candidate.trim():void 0}function parseSinceTimestamp(value){if(value===void 0)return void 0;const timestamp=Date.parse(value);if(!Number.isFinite(timestamp)){throw new PmCliError("--since must be a valid ISO timestamp",EXIT_CODE.USAGE,{code:"structured_event_since_invalid"})}return timestamp}async function runNotes(id,options,global2){const structuredPayload=parseStructuredEventPayload(options.addJson);const conflictingStructuredInputs=[options.add!==void 0,options.stdin===true,options.file!==void 0,options.edit!==void 0,options.delete!==void 0].includes(true);if(structuredPayload!==void 0&&conflictingStructuredInputs){throw new PmCliError("--add-json cannot be combined with text, edit, delete, stdin, or file inputs",EXIT_CODE.USAGE,{code:"structured_event_input_conflict"})}const canonicalJson=structuredPayload===void 0?void 0:stableStringify(structuredPayload);const filteringEvents=[options.since,options.eventType].some(value=>value!==void 0);const sinceTimestamp=parseSinceTimestamp(options.since);const limit=parseLimit(options.limit);const result=await runAnnotationCommand(id,{...options,...filteringEvents?{limit:void 0}:{},includeMeta:[options.includeMeta===true,filteringEvents].includes(true)},global2,{input:await resolveAnnotationInput(canonicalJson===void 0?options:{add:canonicalJson},"note"),collectionKey:"notes",op:"note_add",editOp:"note_edit",deleteOp:"note_delete",parseText:raw=>parseAnnotationTextInput(raw),createEntry:entry=>structuredPayload===void 0?entry:{...entry,format:"json",data:structuredPayload,event_type:structuredEventType(structuredPayload)},bypassOwnershipConflict:Boolean([options.edit===void 0,options.delete===void 0,options.ownershipAppendBypass===true].every(Boolean)),conflictGuidance:{required:"Strict ownership also protects annotations. Ask the current owner to run pm release <id>, then run pm claim <id>; use --force only for an explicitly approved override.",examples:["pm claim <id>"],nextSteps:["For an approved append without reassignment: pm package install governance-audit --project; then pm notes --help lists the package-owned append bypass. Edit/delete still require ownership.","For a non-terminal handoff, the current owner runs pm release <id>; then you run pm claim <id> before retrying. Claim refuses work still held by another owner; --force requires an explicitly approved override."]}});const eventType=options.eventType?.trim();const matching=result.notes.filter(note=>{const isStructured=[note.format==="json",note.data!==void 0].every(Boolean);const matchesSince=[sinceTimestamp===void 0,Date.parse(note.created_at)>=(sinceTimestamp??Number.POSITIVE_INFINITY)].includes(true);const matchesType=[!eventType,note.event_type===eventType].includes(true);return[!filteringEvents,[isStructured,matchesSince,matchesType].every(Boolean)].includes(true)});const filtered=filteringEvents?limitAnnotationEntries(matching,limit):matching;const structuredEventCount=filtered.filter(note=>note.format==="json").length;return{...result,notes:filtered,count:filtered.length,...filteringEvents?{total_count:matching.length,returned_count:filtered.length,has_more:filtered.length<matching.length,...limit===void 0?{}:{limit},structured_event_count:structuredEventCount}:options.includeMeta===true?{structured_event_count:structuredEventCount}:{}}}export{runNotes};
|
|
2
2
|
//# sourceMappingURL=notes.js.map
|