@unbrained/pm-cli 2026.10.31 → 2026.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/pm-user/references/ECOSYSTEM_PLANNING.md +1 -1
- package/.claude-plugin/marketplace.json +1 -1
- package/AGENTS.md +3 -3
- package/CHANGELOG.md +27 -0
- package/CONTRIBUTING.md +1 -1
- package/README.md +1 -1
- package/dist/cli/migration-gates.js +1 -1
- package/dist/cli/register-operations.d.ts +3 -3
- package/dist/cli/register-operations.js +1 -1
- package/dist/cli-bundle/bundle-manifest.json +1 -1
- package/dist/cli-bundle/chunks/{chunk-GMBDZID5.js → chunk-3A4NVHYS.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-VC7TA67O.js → chunk-3ZQQVJT2.js} +19 -19
- package/dist/cli-bundle/chunks/{chunk-XDDPSWIW.js → chunk-4HW253W2.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-4OELCF3O.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-6PSDQ7T7.js → chunk-533L6D2N.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-35Q2B2GJ.js → chunk-ABFFRQRO.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-BFZUJ5QP.js +115 -0
- package/dist/cli-bundle/chunks/{chunk-SBVX5CMV.js → chunk-D52QQ7LP.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-P3LNMWL2.js → chunk-DAZFCSDV.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-43R7UTWV.js → chunk-EN27ZQSV.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-MRUA2Z43.js → chunk-GK2CHAT3.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-BS2KXT24.js → chunk-HOGKWJU5.js} +42 -42
- package/dist/cli-bundle/chunks/{chunk-WX25MU4N.js → chunk-J3JM36EH.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-V6EWBTNH.js → chunk-JRXD7SIL.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-U7JXZMU5.js → chunk-K46GDAKX.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-PT7TS6E7.js → chunk-KJLGBLR3.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-2AHSPMKJ.js → chunk-NGRPD3ZO.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-OJR2YGXF.js +31 -0
- package/dist/cli-bundle/chunks/chunk-QHHFXNSQ.js +3 -0
- package/dist/cli-bundle/chunks/{chunk-TL3O5GZA.js → chunk-RGHLQGEX.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-24J6TNYE.js → chunk-VEOFWE32.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-ZNWDYDFF.js +129 -0
- package/dist/cli-bundle/chunks/{indexed-receipt-blobs-KGMJVFH2.js → indexed-receipt-blobs-IEJ2QOW3.js} +2 -2
- package/dist/cli-bundle/chunks/item-transaction-JHPBH6N7.js +2 -0
- package/dist/cli-bundle/chunks/{mutation-admission-I4RHIT3Q.js → mutation-admission-QUNQZCZ5.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-MVDL5EXG.js → register-list-query-NZTK3AXA.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-GAF7LXRB.js → register-mutation-2OFAMOVH.js} +2 -2
- package/dist/cli-bundle/chunks/register-operations-RFMM5KZ6.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-MZN6ONB3.js → register-setup-6B6Q7M5L.js} +2 -2
- package/dist/cli-bundle/chunks/{settlement-hook-YWSWFOZY.js → settlement-hook-UTCEZBFT.js} +2 -2
- package/dist/cli-bundle/chunks/{stage-2ZORTOF6.js → stage-VLI4OBVX.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-4QPGJO2G.js → chunk-3UD6F2KQ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-EA65HVBO.js → chunk-4NVPDZLX.js} +12 -12
- package/dist/cli-bundle/focused-chunks/{chunk-KKRIFBSL.js → chunk-4UUE3YXZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-NRBUMDLF.js → chunk-5UDDRPYR.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-SFQKCA5K.js → chunk-745IDMTD.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-QFMJGQGO.js → chunk-B6OOKKOX.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{chunk-5MCGYBOQ.js → chunk-EJJWOFP5.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-FUGYXUUL.js +80 -0
- package/dist/cli-bundle/focused-chunks/{chunk-6F6APBCX.js → chunk-HMXVTWIV.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{chunk-HSAEEWSI.js → chunk-I4Z2SCV5.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-JLN5CFYM.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-K4FMZB4Y.js +23 -0
- package/dist/cli-bundle/focused-chunks/{chunk-DFUTCKUF.js → chunk-MQVBWFJF.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-2J7T2UCH.js → chunk-NJFMG3IK.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-HPWT3RBG.js → chunk-PCCZ72C3.js} +54 -54
- package/dist/cli-bundle/focused-chunks/chunk-PF553UVP.js +44 -0
- package/dist/cli-bundle/focused-chunks/{chunk-MW77Q3AQ.js → chunk-Q23K6WLV.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-Y6UYRMVG.js → chunk-QNXXOFLQ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-JLXGRDTG.js → chunk-QVFE5LIX.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{chunk-KH5QJXY7.js → chunk-RUCG6UWN.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-JNKRUCVZ.js → chunk-SGWYNU7T.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-TGS5RXBY.js +26 -0
- package/dist/cli-bundle/focused-chunks/{chunk-PC3R5CJV.js → chunk-WD43E7RU.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-PFBQOZPK.js → chunk-YM4AMP7H.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{indexed-receipt-blobs-KHWT44EK.js → indexed-receipt-blobs-FT3KF6VJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{item-transaction-LU75EG7D.js → item-transaction-F4SN7TXJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{mutation-admission-KDJ7SCPA.js → mutation-admission-7R2FXJ5O.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{settlement-hook-SJV52ZTV.js → settlement-hook-KMIBD4F2.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{stage-R4KEBO37.js → stage-6B3O2GZ6.js} +2 -2
- package/dist/cli-bundle/main.js +24 -24
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +4 -4
- package/dist/cli-bundle/sdk-core.js +1 -1
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +57 -57
- 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 +9 -9
- package/dist/core/extensions/extension-types.d.ts +5 -0
- package/dist/core/extensions/extension-types.js +1 -1
- package/dist/core/item/parse.js +2 -2
- package/dist/core/lock/lock-confinement.d.ts +55 -0
- package/dist/core/lock/lock-confinement.js +2 -0
- package/dist/core/lock/lock-gc.js +1 -1
- package/dist/core/lock/lock.js +2 -2
- package/dist/core/output/mutation-projection.js +1 -1
- package/dist/core/output/output.js +2 -2
- package/dist/core/shared/errors.d.ts +6 -0
- package/dist/core/shared/errors.js +1 -1
- package/dist/core/store/settings-sections.d.ts +61 -0
- package/dist/core/store/settings-sections.js +3 -0
- package/dist/core/store/settings-validator.d.ts +4 -0
- package/dist/core/store/settings-validator.js +1 -1
- package/dist/core/store/settings.d.ts +29 -2
- package/dist/core/store/settings.js +4 -3
- package/dist/core/telemetry/consent.js +2 -2
- package/dist/core/telemetry/runtime.js +2 -2
- package/dist/core/test/background-runs.js +3 -3
- package/dist/sdk/cli-contracts/tool-schema.js +1 -1
- package/dist/sdk/config.js +1 -1
- package/dist/sdk/context-intent-contracts.d.ts +17 -0
- package/dist/sdk/context-intent-contracts.js +1 -1
- package/dist/sdk/core.d.ts +1 -1
- package/dist/sdk/core.js +1 -1
- package/dist/sdk/extension-command-context.js +2 -2
- package/dist/sdk/generated/error-code-catalog-rows.d.ts +39 -0
- package/dist/sdk/generated/error-code-catalog-rows.js +2 -0
- package/dist/sdk/generated/generated-error-code-catalog-part-1.d.ts +3 -3
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-2.d.ts +3 -3
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
- package/dist/sdk/generated-error-code-catalog.js +1 -1
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/init-agent-guidance.js +2 -2
- package/dist/sdk/lifecycle/claim.d.ts +27 -0
- package/dist/sdk/lifecycle/claim.js +1 -1
- package/dist/sdk/lifecycle/mcp-actions.d.ts +1 -1
- package/dist/sdk/lifecycle/mcp-actions.js +1 -1
- package/dist/sdk/lifecycle/task-composition.js +1 -1
- package/dist/sdk/mcp/discovery.js +1 -1
- package/dist/sdk/output/list-envelope.d.ts +8 -0
- package/dist/sdk/output/list-envelope.js +1 -1
- package/dist/sdk/output.d.ts +1 -1
- package/dist/sdk/output.js +2 -2
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query/context.js +2 -2
- package/dist/sdk/runtime/actions.js +1 -1
- package/dist/sdk/runtime-input.js +1 -1
- package/dist/sdk/runtime-primitives.d.ts +2 -1
- package/dist/sdk/runtime-primitives.js +1 -1
- package/dist/sdk/runtime-public-contracts.d.ts +2 -0
- package/dist/sdk/runtime.d.ts +2 -2
- package/dist/sdk/runtime.js +1 -1
- package/dist/sdk/start-task-status.d.ts +1 -1
- package/dist/sdk/start-task-status.js +1 -1
- package/docs/AGENT_EVIDENCE_CONSISTENCY.md +10 -0
- package/docs/AGENT_GUIDE.md +3 -3
- package/docs/COMMANDS.md +1 -0
- package/docs/COMMAND_NAMESPACES.md +1 -1
- package/docs/CONFIGURATION.md +9 -0
- package/docs/DEVELOPMENT_DEPENDENCY_SECURITY.md +9 -6
- package/docs/LIFECYCLE_COMMANDS.md +19 -4
- package/docs/RELEASING.md +22 -2
- package/docs/SDK.md +37 -2
- package/docs/SDK_ACTION_CONFORMANCE.md +21 -0
- package/docs/SDK_CONFIGURATION_SAFETY.md +55 -0
- package/docs/TESTING.md +2 -1
- package/docs/agent-task-token-baseline.json +1 -1
- package/docs/agent-task-transcripts.json +1 -1
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +12 -3
- package/marketplace.json +1 -1
- package/package.json +9 -3
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/package.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +1 -1
- package/plugins/pm-codex/plugin.json +1 -1
- package/runtime-dependencies.json +1 -1
- package/dist/cli-bundle/chunks/chunk-HSBTITO4.js +0 -3
- package/dist/cli-bundle/chunks/chunk-WNF6FOL7.js +0 -31
- package/dist/cli-bundle/chunks/chunk-WRXQAW7Q.js +0 -114
- package/dist/cli-bundle/chunks/chunk-YT5D5HNG.js +0 -2
- package/dist/cli-bundle/chunks/chunk-ZTJVOBDU.js +0 -128
- package/dist/cli-bundle/chunks/item-transaction-UWV6UNSV.js +0 -2
- package/dist/cli-bundle/chunks/register-operations-JLFRL36Q.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-57HPXGOQ.js +0 -79
- package/dist/cli-bundle/focused-chunks/chunk-AFVN2KCP.js +0 -44
- package/dist/cli-bundle/focused-chunks/chunk-GP2WU43K.js +0 -26
- package/dist/cli-bundle/focused-chunks/chunk-NOKG4RFN.js +0 -22
- package/dist/cli-bundle/focused-chunks/chunk-WHIE2C6Q.js +0 -2
package/dist/sdk/runtime.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ import { runHistoryAttest,type HistoryAttestCommandOptions } from "./history/att
|
|
|
26
26
|
import type { InitCommandOptions,InitResult } from "./init.js";
|
|
27
27
|
import type { LearningsCommandOptions,LearningsResult } from "./learnings.js";
|
|
28
28
|
import type { AppendCommandOptions,AppendResult } from "./lifecycle/append.js";
|
|
29
|
-
import type { ClaimNextResult,ClaimResult,ReleaseResult,ReleaseMutationOptions } from "./lifecycle/claim.js";
|
|
29
|
+
import type { ClaimNextResult,ClaimResult,ClaimStartReceipt,ReleaseResult,ReleaseMutationOptions } from "./lifecycle/claim.js";
|
|
30
30
|
import type { CloseResult } from "./lifecycle/close.js";
|
|
31
31
|
import { type CopyResult } from "./lifecycle/copy.js";
|
|
32
32
|
import { type CreateResult } from "./lifecycle/create.js";
|
|
@@ -66,7 +66,7 @@ export { clearWorkspaceContractsCache } from "./workspace-contracts-cache.js";
|
|
|
66
66
|
export * from "./governance/workflow-policy.js";
|
|
67
67
|
export type * from "./governance/assurance-action-contracts.js";
|
|
68
68
|
export { runCloseTask,runPauseTask,runStartTask,type TaskCompositionOptions } from "./lifecycle/task-composition.js";
|
|
69
|
-
export type { ClaimResult,CloseResult,CreateResult,ReleaseResult,ReleaseMutationOptions,UpdateResult };
|
|
69
|
+
export type { ClaimResult,ClaimStartReceipt,CloseResult,CreateResult,ReleaseResult,ReleaseMutationOptions,UpdateResult };
|
|
70
70
|
export { getActiveExtensionRegistrations,runActiveOnReadHooks,runActiveOnWriteHooks } from "../core/extensions/index.js";
|
|
71
71
|
export { pathExists,readFileIfExists,removeFileIfExists,writeFileAtomic } from "../core/fs/fs-utils.js";
|
|
72
72
|
export { appendHistoryEntry,createHistoryEntry } from "../core/history/history.js";
|
package/dist/sdk/runtime.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5ceccfe3-71e9-58f5-9185-af8e16867b9e")}catch{}})();import{AsyncLocalStorage}from"node:async_hooks";import{createExtensionCommandError}from"./error-runtime.js";import{capturePmCommandScope}from"./command-line.js";import{createEmptyExtensionCommandRegistry,createEmptyExtensionHookRegistry,createEmptyExtensionParserRegistry,createEmptyExtensionPreflightRegistry,createEmptyExtensionRegistrationRegistry,createEmptyExtensionRendererRegistry,createEmptyExtensionServiceRegistry}from"../core/extensions/extension-registries.js";import{activateExtensions,deactivateExtensions,loadExtensions,runActiveCommandHandler,runWithIsolatedExtensionRuntime,setActiveExtensionCommands,setActiveExtensionHooks,setActiveExtensionParsers,setActiveExtensionPreflight,setActiveExtensionRegistrations,setActiveExtensionRenderers,setActiveExtensionServices}from"../core/extensions/index.js";import{pathExists}from"../core/fs/fs-utils.js";import{EXIT_CODE}from"../core/shared/constants.js";import{PmCliError}from"../core/shared/errors.js";import{asRecordClone}from"../core/shared/primitives.js";import{HOISTED_ACTION_OPTION_KEYS}from"./runtime-input.js";import{assertMutationOptionBag}from"./runtime/mutation-value-validation.js";import{withCliMutationInput,withLiteralMutationInput}from"./lifecycle/cli-input.js";import{createAsyncReadWriteGate}from"../core/shared/serial-queue.js";import{getSettingsPath,resolvePmRoot}from"../core/store/paths.js";import{readSettings,runWithConfigurationOnlySettings}from"../core/store/settings.js";import{resolveAuthor}from"../core/shared/author.js";import{PM_TOOL_ACTIONS}from"./cli-contracts/enum-contracts.js";import{runContracts}from"./cli-contracts/runtime-contracts.js";import{attachReadOutputContracts}from"./context-intent-contracts.js";import{runWithDiscoveredContextIntentContracts}from"./context-intent-runtime.js";import{finalizeContextUsageEgress}from"./context/usage-egress.js";import{createExtensionCommandSdk}from"./extension-command-context.js";import{INIT_INVOCATION_CWD}from"./init.js";import{certifyCompleteListResult,createCompleteListOptions}from"./query/complete-list.js";import{listClientItemMetadataLight}from"./query/light-metadata.js";import{normalizeReadOutputIncludeModeOptions,validateReadOutputOptions}from"./read-output-contracts.js";import{SDK_ACTION_ALIASES}from"./runtime-action-aliases.js";import{closeManyOptionsFromFlat,extensionOptionsFromArgs,actionGlobalOptions as globalOptions,mutationListOptions,mutationOptionsWithOverrides,normalizeActionName,normalizeCommandPath,normalizeMcpOptionsArrays,normalizeMcpUpdateOptions,optionsWithAuthor,readRuntimeScalarString as readScalarString,readRuntimeScalarStringAllowBlank as readScalarStringAllowBlank,readRuntimeString as readString,readRuntimeStringArray as readStringArray,shouldInvalidateWorkspaceContractsCacheAfterAction,updateManyOptionsFromFlat,withAddNoteOption,withFilesDiscoveryOptions,withMutationCompaction}from"./runtime-input.js";import{SDK_ACTION_HANDLERS}from"./runtime/actions.js";import{getOwnHandler,readRequiredString}from"./runtime/context.js";import{clearWorkspaceContractsCache}from"./workspace-contracts-cache.js";import{PM_GITIGNORE_END,PM_GITIGNORE_START,ensurePmGitignore,getPmGitignoreBlock}from"./workspace.js";import{SEARCH_EXTENSION_FLAG_DEFINITIONS}from"./extension-contracts.js";export*from"./cli-contracts/agent-output-contracts.js";import{PmCompleteListValidationError,assertCompleteListResult,certifyCompleteListResult as certifyCompleteListResult2,createCompleteListOptions as createCompleteListOptions2,inspectCompleteListResult}from"./query/complete-list.js";import{getWorkspaceContracts}from"./query/workspace-contracts.js";import{clearWorkspaceContractsCache as clearWorkspaceContractsCache2}from"./workspace-contracts-cache.js";export*from"./governance/workflow-policy.js";import{runCloseTask,runPauseTask,runStartTask}from"./lifecycle/task-composition.js";import{getActiveExtensionRegistrations,runActiveOnReadHooks,runActiveOnWriteHooks}from"../core/extensions/index.js";import{pathExists as pathExists2,readFileIfExists,removeFileIfExists,writeFileAtomic}from"../core/fs/fs-utils.js";import{appendHistoryEntry,createHistoryEntry}from"../core/history/history.js";import{HISTORY_EVENT_CLASSIFICATION_VERSION,MAINTENANCE_HISTORY_OPERATIONS,SUBSTANTIVE_HISTORY_OPERATIONS,classifyHistoryEvent}from"../core/history/event-classification.js";import{generateItemId,normalizeItemId,normalizeRawItemId}from"../core/item/id.js";import{readBooleanOption,readCsvListOption,readStringOption}from"./package-runtime-options.js";import{PM_CLI_EXPECTED_ERROR_NAME,createPmCliExpectedError,isPmCliExpectedError}from"./errors.js";import{commitImportedItem,emptyImportedDocument,ensureTrackerInitialized,selectImportAuthor,toEstimatedMinutesValue,toImportBoolean,toImportConfidence,toImportInteger,toImportLinkedDocs,toImportLinkedFiles,toImportLinkedTests,toImportLogEntries,toImportNormalizedEnum,toImportNumberMap,toImportPriority,toImportStatus,toImportStringList,toImportStringMap,toImportTags,toNonEmptyImportString}from"./package-import-adapters.js";import{canonicalDocument,normalizeItemMetadata,serializeItemDocument,splitFrontMatter}from"../core/item/item-format.js";import{BASELINE_ITEM_FORMAT_VERSION,CURRENT_ITEM_FORMAT_VERSION,classifyItemFormatVersion,effectiveItemFormatVersion,normalizeItemFormatVersion,scanItemFormatVersions}from"../core/item/item-format-version.js";import{parseTags}from"../core/item/parse.js";import{isTerminalStatus,normalizeStatusInput}from"../core/item/status.js";import{resolveItemTypeRegistry}from"../core/item/type-registry.js";import{acquireLock,acquireLockLease}from"../core/lock/lock.js";import{resolveRuntimeFieldRegistry,resolveRuntimeStatusRegistry}from"../core/schema/runtime-schema.js";import{PmCliError as PmCliError2}from"../core/shared/errors.js";import{isTimestampLiteral,nowIso}from"../core/shared/time.js";import{jaccardSimilarity,normalizeSimilarityText,scoreItemSimilarity,tokenizeSimilarityText}from"./similarity-scoring.js";import{listAllItemMetadata,listAllItemMetadataLight,locateItem,readLocatedItem}from"../core/store/item-store.js";import{getHistoryPath,getItemPath,getSettingsPath as getSettingsPath2,resolveImplicitPmRoot,resolvePmRoot as resolvePmRoot2}from"../core/store/paths.js";import{readSettings as readSettings2}from"../core/store/settings.js";import{runAggregate}from"./query/aggregate.js";import{CONTEXT_OUTPUT_VALUES,runContext}from"./query/context.js";import{runGet}from"./query/get.js";import{runList}from"./query/list.js";import{closeItem,runClose}from"./lifecycle/close.js";import{runCopy}from"./lifecycle/copy.js";import{runDelete}from"./lifecycle/delete.js";import{runFocus}from"./lifecycle/focus.js";import{runRestore}from"./lifecycle/restore.js";import{DEFAULT_TERMINAL_TRANSITION_POLICY,applyTerminalOrderingPolicy,requireTerminalReason,resolveTerminalReason}from"./lifecycle-policy.js";import{runUpdate}from"./lifecycle/update.js";import{runReopen}from"./lifecycle/reopen.js";import{NEXT_OUTPUT_VALUES,runNext}from"./query/next.js";import{runSearch}from"./query/search.js";import{runStats}from"./stats.js";import{runDuplicates}from"./duplicates.js";import{renderCalendarMarkdown,renderCalendarToon,resolveCalendarOutputFormat,runCalendar}from"./query/calendar.js";import{renderGuideMarkdown,resolveGuideOutputFormat,runGuide}from"./guide.js";import{runCompletion}from"./completion.js";import{runReindex}from"./governance/reindex.js";import{loadCreateTemplateOptions,runTemplatesList,runTemplatesSave,runTemplatesShow}from"./templates.js";import{runTestRunsList,runTestRunsLogs,runTestRunsResume,runTestRunsStatus,runTestRunsStop}from"./test/runs.js";import{BUILTIN_ITEM_TYPE_VALUES,CONFIDENCE_TEXT_VALUES,DEPENDENCY_KIND_VALUES,ISSUE_SEVERITY_VALUES,ITEM_TYPE_VALUES,RISK_VALUES,STATUS_VALUES}from"../types/index.js";const ACTIVE_EXTENSION_HOST_CONTEXT=Symbol("pm.active-extension-host-context");function splitFullClientMutationOptions(options){return{fullChangedFields:!0,options}}class PmClient{defaults;constructor(options={}){this.defaults={...options.pmRoot===void 0?{}:{path:options.pmRoot},...options.cwd===void 0?{}:{cwd:options.cwd},...options.author===void 0?{}:{author:options.author},...options.noExtensions===void 0?{}:{noExtensions:options.noExtensions}}}static forActiveExtensionHost(options){const client=new PmClient({...options,noExtensions:!0});return client.defaults[ACTIVE_EXTENSION_HOST_CONTEXT]=!0,client}run(action,args={}){return runAction({...this.defaults,...args,action})}runTyped(action,args={}){return this.run(action,args)}async withItemTransactionContext(run,configurationOnly=!1){const pmRoot=resolvePmRoot(this.defaults.cwd??process.cwd(),this.defaults.path),execute=async()=>{const settings=await runWithConfigurationOnlySettings(pmRoot,()=>readSettings(pmRoot));return run({pmRoot,author:resolveAuthor(this.defaults.author,settings.author_default)})};if(this.defaults[ACTIVE_EXTENSION_HOST_CONTEXT]===!0||activeExtensionScope.getStore()===!0)return execute();const activate=()=>runWithActiveExtensions({...this.defaults,path:pmRoot},execute);return configurationOnly?runWithConfigurationOnlySettings(pmRoot,activate):activate()}previewItemMutations(options){return this.withItemTransactionContext(async identity=>(await import("./item-transaction.js")).previewItemMutations({...options,...identity}),!0)}commitItemMutations(options){return this.withItemTransactionContext(async identity=>(await import("./item-transaction.js")).commitItemMutations({...options,...identity}))}get itemTransactions(){const abandon=(transactionId,options)=>this.withItemTransactionContext(async identity=>(await import("./item-transaction.js")).abandonItemTransaction({...options,...identity,transactionId}));return{status:transactionId=>this.withItemTransactionContext(async identity=>(await import("./item-transaction.js")).readItemTransaction(identity.pmRoot,transactionId),!0),abandon,supersede:(transactionId,newId,options)=>abandon(transactionId,{...options,supersededBy:newId})}}context(options={}){return this.runTyped("context",{options})}listAllItemMetadataLight(){return listClientItemMetadataLight(this.defaults.path,this.defaults.cwd)}list(options={}){return this.runTyped("list",{options})}async listAllComplete(options={}){return certifyCompleteListResult(await this.list(createCompleteListOptions(options)))}search(query,options={}){return this.runTyped("search",{query,options})}get(id,options={}){return this.runTyped("get",{id,options})}next(options={}){return this.runTyped("next",{options})}aggregate(options={}){return this.runTyped("aggregate",{options})}stats(options={}){return this.runTyped("stats",{options})}duplicates(options={}){return this.runTyped("duplicates",{options})}comments(id,options={}){return this.runTyped("comments",{id,options})}notes(id,options={}){return this.runTyped("notes",{id,options})}learnings(id,options={}){return this.runTyped("learnings",{id,options})}files(id,options={}){return this.runTyped("files",{id,options})}filesDiscover(id,options={}){return this.runTyped("files-discover",{id,options})}filesLookup(options){return this.runTyped("files-lookup",{options})}docs(id,options={}){return this.runTyped("docs",{id,options})}deps(id,options={}){return this.runTyped("deps",{id,options})}graph(subcommand,ids={},options={}){return this.runTyped("graph",{subcommand,...ids,options})}async append(id,body,options={}){return assertMutationOptionBag(options,"append"),await this.runTyped("append",{id,...splitFullClientMutationOptions(mutationOptionsWithOverrides(options,{body}))})}init(prefix,options={}){return this.runTyped("init",{...prefix===void 0?{}:{prefix},options})}config(scope,configAction,key,value,options={}){return this.runTyped("config",{scope,configAction,...key===void 0?{}:{key},...value===void 0?{}:{value},options})}schema(subcommand,options={}){return this.runTyped("schema",{options:{...options,subcommand}})}workflowPolicy(action,name,options={}){return this.runTyped("schema",{name,options:{...options,subcommand:action}})}schemaList(){return this.runTyped("schema",{options:{subcommand:"list"}})}schemaShow(name){return this.runTyped("schema",{name,options:{subcommand:"show"}})}schemaAddType(name,options={}){return this.runTyped("schema",{name,options:{...options,subcommand:"add-type"}})}schemaRemoveType(name,options={}){return this.runTyped("schema",{name,options:{...options,subcommand:"remove-type"}})}schemaAddStatus(name,options={}){return this.runTyped("schema",{name,options:{...options,subcommand:"add-status"}})}schemaRemoveStatus(name,options={}){return this.runTyped("schema",{name,options:{...options,subcommand:"remove-status"}})}schemaAddField(name,options={}){const{type,...mutationOptions}=options;return this.runTyped("schema",{name,options:{...mutationOptions,fieldType:type,subcommand:"add-field"}})}schemaRemoveField(name,options={}){return this.runTyped("schema",{name,options:{...options,subcommand:"remove-field"}})}schemaListFields(){return this.runTyped("schema",{options:{subcommand:"list-fields"}})}schemaShowField(name){return this.runTyped("schema",{name,options:{subcommand:"show-field"}})}schemaApplyPreset(typePreset,options={}){return this.runTyped("schema",{typePreset,options:{...options,subcommand:"apply-preset"}})}schemaInferTypes(options={}){return this.runTyped("schema",{options:{...options,subcommand:"add-type",infer:!0}})}schemaRenameType(from,to,options){return this.runTyped("schema",{name:from,options:{...options,subcommand:"rename-type",to}})}schemaRenameField(from,to,options,type){return this.runTyped("schema",{name:from,options:{...options,subcommand:"rename-field",to,...type?{fieldTypeScope:type}:{}}})}schemaRemapStatus(from,to,options){return this.runTyped("schema",{name:from,options:{...options,subcommand:"remap-status",to}})}schemaShowStatus(name){return this.runTyped("schema",{name,options:{subcommand:"show-status"}})}profile(subcommand,options={}){return this.runTyped("profile",{options:{...options,subcommand}})}profileList(){return this.runTyped("profile",{options:{subcommand:"list"}})}profileShow(name){return this.runTyped("profile",{name,options:{subcommand:"show"}})}profileApply(name,options={}){return this.runTyped("profile",{name,options:{...options,subcommand:"apply"}})}profileLint(name){return this.runTyped("profile",{name,options:{subcommand:"lint"}})}validate(options={}){return this.runTyped("validate",{options})}health(options={}){return this.runTyped("health",{options})}gc(options={}){return this.runTyped("gc",{options})}assurance(input){return this.runTyped("assurance",{options:{...input,subcommand:input.action}})}historyRedact(id,options){return this.runTyped("history-redact",{id,options})}historyRepair(id,options={}){return this.runTyped("history-repair",{id,options})}historyRepairAll(options={}){return this.runTyped("history-repair",{options:{...options,all:!0}})}historyAttest(options={}){return this.runTyped("history-attest",{options})}historyCompact(id,options={}){return this.runTyped("history-compact",{id,options})}historyCompactBulk(options){return this.runTyped("history-compact",{options})}historyAuthorAcknowledge(options){return this.runTyped("history-author-acknowledge",{historyEvent:(options.events??[]).map(event=>`${event.item_id}:${String(event.line)}`),allActionable:options.all_actionable===!0,dryRun:options.dry_run===!0,planFingerprint:options.plan_fingerprint,limit:options.coordinate_limit,attributedAuthor:options.attributed_author,reviewer:options.reviewer,reason:options.reason})}plan(subcommand,id,options={},stepRef,reorderTo){return this.runTyped("plan",{fullChangedFields:!0,...id===void 0?{}:{id},...stepRef===void 0?{}:{stepRef},...reorderTo===void 0?{}:{reorderTo},options:mutationOptionsWithOverrides(options,{subcommand})})}planCreate(options){return this.plan("create",void 0,options)}planShow(id,options={}){return this.plan("show",id,options)}planAddStep(id,options){return this.plan("add-step",id,options)}planUpdateStep(id,stepRef,options){return this.plan("update-step",id,options,stepRef)}planCompleteStep(id,stepRef,options={}){return this.plan("complete-step",id,options,stepRef)}planBlockStep(id,stepRef,options){return this.plan("block-step",id,options,stepRef)}planReorderStep(id,stepRef,reorderTo,options={}){return this.plan("reorder-step",id,options,stepRef,reorderTo)}planRemoveStep(id,stepRef,options={}){return this.plan("remove-step",id,options,stepRef)}planLink(id,stepRef,options){return this.plan("link",id,options,stepRef)}planUnlink(id,stepRef,options){return this.plan("unlink",id,options,stepRef)}planDecision(id,options){return this.plan("decision",id,options)}planDiscovery(id,options){return this.plan("discovery",id,options)}planValidation(id,options){return this.plan("validation",id,options)}planResume(id,options){return this.plan("resume",id,options)}planApprove(id,options={}){return this.plan("approve",id,options)}planMaterialize(id,options){return this.plan("materialize",id,options)}create(options={}){return this.runTyped("create",splitFullClientMutationOptions(options))}update(id,options={}){return this.runTyped("update",{id,...splitFullClientMutationOptions(options)})}reopen(id,reason,options={}){return this.runTyped("item-reopen",{id,reason,fullChangedFields:!0,options})}close(id,reason,options={}){return this.runTyped("close",{id,reason,...splitFullClientMutationOptions(options)})}claim(id,options={}){return this.runTyped("claim",{id,...splitFullClientMutationOptions(options)})}claimNext(options={}){return this.runTyped("claim",{next:!0,...splitFullClientMutationOptions(options)})}release(id,options={}){return this.runTyped("release",{id,...splitFullClientMutationOptions(options)})}copy(id,options={}){return this.runTyped("copy",{id,...splitFullClientMutationOptions(options)})}delete(id,options={}){return this.runTyped("delete",{id,...splitFullClientMutationOptions(options)})}restore(id,target,options={}){return this.runTyped("restore",{fullChangedFields:!0,id,options:{...options,target}})}focus(id,options={}){return this.runTyped("focus",{...id===void 0?{}:{id},...splitFullClientMutationOptions(options)})}startTask(id,options={}){return this.runTyped("start-task",{id,...splitFullClientMutationOptions(options)})}pauseTask(id,options={}){return this.runTyped("pause-task",{id,...splitFullClientMutationOptions(options)})}closeTask(id,reason,options={}){return this.runTyped("close-task",{id,reason,...splitFullClientMutationOptions(options)})}extension(target,options={}){return this.runTyped("extension",{...target===void 0?{}:{target},options})}extensionList(options={}){return this.extension("list",options)}extensionActivate(target,options={}){return this.runTyped("extension-activate",{target,options})}extensionDeactivate(target,options={}){return this.runTyped("extension-deactivate",{target,options})}package(target,options={}){return this.runTyped("package",{...target===void 0?{}:{target},options:{...options,vocabulary:"package"}})}packageList(options={}){return this.package("list",options)}packageInstall(target,options={}){return this.runTyped("package-install",{target,options})}packageUninstall(target,options={}){return this.runTyped("package-uninstall",{target,options})}packageDoctor(options={}){return this.runTyped("package-doctor",{options})}packageManage(target,options={}){return this.runTyped("package-manage",{...target===void 0?{}:{target},options})}packageDescribe(target,options={}){return this.runTyped("package-describe",{...target===void 0?{}:{target},options})}packageReload(options={}){return this.runTyped("package-reload",{options})}packageCatalog(options={}){return this.runTyped("package-catalog",{options})}packageActivate(target,options={}){return this.runTyped("package-activate",{target,options})}packageDeactivate(target,options={}){return this.runTyped("package-deactivate",{target,options})}packageMigrate(options={}){return this.package(void 0,{...options,migrate:!0})}upgrade(target,options={}){return this.runTyped("upgrade",{...target===void 0?{}:{target},options})}}function context(options={},clientOptions={}){return new PmClient(clientOptions).context(options)}function list(options={},clientOptions={}){return new PmClient(clientOptions).list(options)}function listAllComplete(options={},clientOptions={}){return new PmClient(clientOptions).listAllComplete(options)}function search(query,options={},clientOptions={}){return new PmClient(clientOptions).search(query,options)}function get(id,options={},clientOptions={}){return new PmClient(clientOptions).get(id,options)}function next(options={},clientOptions={}){return new PmClient(clientOptions).next(options)}function aggregate(options={},clientOptions={}){return new PmClient(clientOptions).aggregate(options)}function stats(options={},clientOptions={}){return new PmClient(clientOptions).stats(options)}function duplicates(options={},clientOptions={}){return new PmClient(clientOptions).duplicates(options)}function comments(id,options={},clientOptions={}){return new PmClient(clientOptions).comments(id,options)}function notes(id,options={},clientOptions={}){return new PmClient(clientOptions).notes(id,options)}function learnings(id,options={},clientOptions={}){return new PmClient(clientOptions).learnings(id,options)}function files(id,options={},clientOptions={}){return new PmClient(clientOptions).files(id,options)}function filesDiscover(id,options={},clientOptions={}){return new PmClient(clientOptions).filesDiscover(id,options)}function filesLookup(options,clientOptions={}){return new PmClient(clientOptions).filesLookup(options)}function docs(id,options={},clientOptions={}){return new PmClient(clientOptions).docs(id,options)}function deps(id,options={},clientOptions={}){return new PmClient(clientOptions).deps(id,options)}function graph(subcommand,ids={},options={},clientOptions={}){return new PmClient(clientOptions).graph(subcommand,ids,options)}function append(id,body,options={},clientOptions={}){return new PmClient(clientOptions).append(id,body,options)}function init(prefix,options={},clientOptions={}){return new PmClient(clientOptions).init(prefix,options)}function config(scope,configAction,key,value,options={},clientOptions={}){return new PmClient(clientOptions).config(scope,configAction,key,value,options)}function schema(subcommand,options={},clientOptions={}){return new PmClient(clientOptions).schema(subcommand,options)}function schemaList(clientOptions={}){return new PmClient(clientOptions).schemaList()}function schemaShow(name,clientOptions={}){return new PmClient(clientOptions).schemaShow(name)}function schemaAddType(name,options={},clientOptions={}){return new PmClient(clientOptions).schemaAddType(name,options)}function schemaRemoveType(name,options={},clientOptions={}){return new PmClient(clientOptions).schemaRemoveType(name,options)}function schemaAddStatus(name,options={},clientOptions={}){return new PmClient(clientOptions).schemaAddStatus(name,options)}function schemaRemoveStatus(name,options={},clientOptions={}){return new PmClient(clientOptions).schemaRemoveStatus(name,options)}function schemaAddField(name,options={},clientOptions={}){return new PmClient(clientOptions).schemaAddField(name,options)}function schemaRemoveField(name,options={},clientOptions={}){return new PmClient(clientOptions).schemaRemoveField(name,options)}function schemaListFields(clientOptions={}){return new PmClient(clientOptions).schemaListFields()}function schemaShowField(name,clientOptions={}){return new PmClient(clientOptions).schemaShowField(name)}function schemaApplyPreset(typePreset,options={},clientOptions={}){return new PmClient(clientOptions).schemaApplyPreset(typePreset,options)}function schemaInferTypes(options={},clientOptions={}){return new PmClient(clientOptions).schemaInferTypes(options)}function schemaRenameType(from,to,options,clientOptions={}){return new PmClient(clientOptions).schemaRenameType(from,to,options)}function schemaRenameField(from,to,options,type,clientOptions={}){return new PmClient(clientOptions).schemaRenameField(from,to,options,type)}function schemaRemapStatus(from,to,options,clientOptions={}){return new PmClient(clientOptions).schemaRemapStatus(from,to,options)}function schemaShowStatus(name,clientOptions={}){return new PmClient(clientOptions).schemaShowStatus(name)}function profile(subcommand,options={},clientOptions={}){return new PmClient(clientOptions).profile(subcommand,options)}function profileList(clientOptions={}){return new PmClient(clientOptions).profileList()}function profileShow(name,clientOptions={}){return new PmClient(clientOptions).profileShow(name)}function profileApply(name,options={},clientOptions={}){return new PmClient(clientOptions).profileApply(name,options)}function profileLint(name,clientOptions={}){return new PmClient(clientOptions).profileLint(name)}function validate(options={},clientOptions={}){return new PmClient(clientOptions).validate(options)}function health(options={},clientOptions={}){return new PmClient(clientOptions).health(options)}function gc(options={},clientOptions={}){return new PmClient(clientOptions).gc(options)}function historyRedact(id,options,clientOptions={}){return new PmClient(clientOptions).historyRedact(id,options)}function historyRepair(id,options={},clientOptions={}){return new PmClient(clientOptions).historyRepair(id,options)}function historyRepairAll(options={},clientOptions={}){return new PmClient(clientOptions).historyRepairAll(options)}function historyCompact(id,options={},clientOptions={}){return new PmClient(clientOptions).historyCompact(id,options)}function historyCompactBulk(options,clientOptions={}){return new PmClient(clientOptions).historyCompactBulk(options)}function create(options={},clientOptions={}){return new PmClient(clientOptions).create(options)}function update(id,options={},clientOptions={}){return new PmClient(clientOptions).update(id,options)}function reopen(id,reason,options={},clientOptions={}){return new PmClient(clientOptions).reopen(id,reason,options)}function close(id,reason,options={},clientOptions={}){return new PmClient(clientOptions).close(id,reason,options)}function claim(id,options={},clientOptions={}){return new PmClient(clientOptions).claim(id,options)}function claimNext(options={},clientOptions={}){return new PmClient(clientOptions).claimNext(options)}function release(id,options={},clientOptions={}){return new PmClient(clientOptions).release(id,options)}function copy(id,options={},clientOptions={}){return new PmClient(clientOptions).copy(id,options)}function deleteItem(id,options={},clientOptions={}){return new PmClient(clientOptions).delete(id,options)}function restore(id,target,options={},clientOptions={}){return new PmClient(clientOptions).restore(id,target,options)}function focus(id,options={},clientOptions={}){return new PmClient(clientOptions).focus(id,options)}function startTask(id,options={},clientOptions={}){return new PmClient(clientOptions).startTask(id,options)}function pauseTask(id,options={},clientOptions={}){return new PmClient(clientOptions).pauseTask(id,options)}function closeTask(id,reason,options={},clientOptions={}){return new PmClient(clientOptions).closeTask(id,reason,options)}function extension(target,options={},clientOptions={}){return new PmClient(clientOptions).extension(target,options)}function extensionList(options={},clientOptions={}){return new PmClient(clientOptions).extensionList(options)}function extensionActivate(target,options={},clientOptions={}){return new PmClient(clientOptions).extensionActivate(target,options)}function extensionDeactivate(target,options={},clientOptions={}){return new PmClient(clientOptions).extensionDeactivate(target,options)}function packageLifecycle(target,options={},clientOptions={}){return new PmClient(clientOptions).package(target,options)}function packageList(options={},clientOptions={}){return new PmClient(clientOptions).packageList(options)}function packageInstall(target,options={},clientOptions={}){return new PmClient(clientOptions).packageInstall(target,options)}function packageUninstall(target,options={},clientOptions={}){return new PmClient(clientOptions).packageUninstall(target,options)}function packageDoctor(options={},clientOptions={}){return new PmClient(clientOptions).packageDoctor(options)}function packageManage(target,options={},clientOptions={}){return new PmClient(clientOptions).packageManage(target,options)}function packageDescribe(target,options={},clientOptions={}){return new PmClient(clientOptions).packageDescribe(target,options)}function packageReload(options={},clientOptions={}){return new PmClient(clientOptions).packageReload(options)}function packageCatalog(options={},clientOptions={}){return new PmClient(clientOptions).packageCatalog(options)}function packageActivate(target,options={},clientOptions={}){return new PmClient(clientOptions).packageActivate(target,options)}function packageDeactivate(target,options={},clientOptions={}){return new PmClient(clientOptions).packageDeactivate(target,options)}function upgrade(target,options={},clientOptions={}){return new PmClient(clientOptions).upgrade(target,options)}async function getContracts(pmRootOrOptions,options={}){const resolvedOptions=typeof pmRootOrOptions=="string"?{...options,pmRoot:pmRootOrOptions}:pmRootOrOptions??options,global2={json:!0,quiet:resolvedOptions.quiet??!0,noExtensions:resolvedOptions.noExtensions??!1,noPager:!0,profile:resolvedOptions.profile??!1,path:resolvedOptions.pmRoot};return runContracts(resolvedOptions,global2)}const extensionActivationGate=createAsyncReadWriteGate(),activeExtensionScope=new AsyncLocalStorage;function resetActiveExtensionRegistries(){setActiveExtensionHooks(createEmptyExtensionHookRegistry()),setActiveExtensionCommands(createEmptyExtensionCommandRegistry()),setActiveExtensionParsers(createEmptyExtensionParserRegistry()),setActiveExtensionPreflight(createEmptyExtensionPreflightRegistry()),setActiveExtensionServices(createEmptyExtensionServiceRegistry()),setActiveExtensionRenderers(createEmptyExtensionRendererRegistry()),setActiveExtensionRegistrations(createEmptyExtensionRegistrationRegistry())}async function withActiveExtensions(global2,explicitCwd,resolutionCwd,run){return runWithIsolatedExtensionRuntime(()=>explicitCwd===void 0?extensionActivationGate.read(()=>withActiveExtensionsExclusively(global2,resolutionCwd,run)):extensionActivationGate.write(()=>withCwd(explicitCwd,()=>withActiveExtensionsExclusively(global2,resolutionCwd,run))))}async function runWithActiveExtensions(options,run){const explicitCwd=options.cwd;if(activeExtensionScope.getStore()===!0&&explicitCwd===void 0&&options.noExtensions===!0){const pmRoot=resolvePmRoot(process.cwd(),options.path);return runWithIsolatedExtensionRuntime(()=>runWithDiscoveredContextIntentContracts({pmRoot},run))}const resolutionCwd=explicitCwd??process.cwd();return withActiveExtensions(globalOptions({path:options.path,noExtensions:options.noExtensions}),explicitCwd,resolutionCwd,()=>activeExtensionScope.run(!0,run))}async function withActiveExtensionsExclusively(global2,cwd,run){const pmRoot=resolvePmRoot(cwd,global2.path);if(global2.noExtensions)return resetActiveExtensionRegistries(),runWithDiscoveredContextIntentContracts({pmRoot},()=>run(null));if(!await pathExists(getSettingsPath(pmRoot)))return resetActiveExtensionRegistries(),run(null);let active=null,activated;try{const settings=await readSettings(pmRoot),loadResult=await loadExtensions({pmRoot,settings,cwd,noExtensions:!1}),activationResult=await activateExtensions({...loadResult,loaded:loadResult.loaded});activated={loadResult,activationResult},setActiveExtensionHooks(activationResult.hooks),setActiveExtensionCommands(activationResult.commands),setActiveExtensionParsers(activationResult.parsers),setActiveExtensionPreflight(activationResult.preflight),setActiveExtensionServices(activationResult.services),setActiveExtensionRenderers(activationResult.renderers),setActiveExtensionRegistrations(activationResult.registrations),active={registrations:activationResult.registrations,commands:activationResult.commands,pmRoot,packages:loadResult.loaded}}catch(error){resetActiveExtensionRegistries(),console.error("[pm-sdk] extension activation failed; continuing without active extensions:",error)}try{return await runWithDiscoveredContextIntentContracts({pmRoot,packages:active?.packages},()=>run(active))}finally{resetActiveExtensionRegistries(),activated&&await deactivateExtensions(activated.loadResult,activated.activationResult).catch(()=>{})}}function resolveActiveExtensionActionCommand(action,active){const normalizedAction=normalizeActionName(action);return active?.registrations.commands.find(entry=>normalizeActionName(entry.action)===normalizedAction)?.command??active?.commands.handlers.find(entry=>normalizeActionName(entry.command)===normalizedAction)?.command}async function dispatchActiveExtensionAction(action,args,options,global2,active){if(!active)throw new PmCliError(`Unsupported native pm action: ${action}`,EXIT_CODE.USAGE);const command=resolveActiveExtensionActionCommand(action,active);if(!command)throw new PmCliError(`Unsupported native pm action: ${action}`,EXIT_CODE.USAGE);const extensionAuthor=typeof options.author=="string"?options.author:global2.author,handlerResult=await runActiveCommandHandler({command:normalizeCommandPath(command),args:readStringArray(options.args??args.args),options:extensionOptionsFromArgs(args,options),global:{...global2,author:extensionAuthor},pm_root:active.pmRoot,sdk:createExtensionCommandSdk(active.pmRoot,PmClient.forActiveExtensionHost({pmRoot:active.pmRoot,author:extensionAuthor}),extensionAuthor,normalizeCommandPath(command))});if(!handlerResult.handled){if(Object.hasOwn(handlerResult,"cause"))throw createExtensionCommandError(command,handlerResult);const suffix=handlerResult.warnings.length>0?` (${handlerResult.warnings.join(", ")})`:"";throw new PmCliError(`Unsupported native pm action: ${action}${suffix}`,EXIT_CODE.USAGE)}return handlerResult.result}async function withCwd(cwd,run){const previous=process.cwd();process.chdir(cwd);try{return await run()}finally{process.chdir(previous)}}function resolveSdkActionInput(args){const rawAction=readRequiredString(args,"action"),normalizedAction=normalizeActionName(rawAction),alias=getOwnHandler(SDK_ACTION_ALIASES,normalizedAction),action=alias?.action??normalizedAction,resolvedArgs={...args,action};return alias?.options!==void 0&&(resolvedArgs.options={...alias.options,...asRecordClone(args.options)}),action==="package"&&(resolvedArgs.options={...asRecordClone(resolvedArgs.options),vocabulary:"package"}),{action,args:resolvedArgs}}async function runAction(args){const resolved=resolveSdkActionInput(args),global2=globalOptions(resolved.args);capturePmCommandScope(global2);const invalidateWorkspaceContractsCache=shouldInvalidateWorkspaceContractsCacheAfterAction(resolved.action),explicitCwd=readString(resolved.args,"cwd"),resolutionCwd=explicitCwd??process.cwd();resolved.action==="init"&&(global2[INIT_INVOCATION_CWD]=resolutionCwd),(resolved.action!=="init"||global2.path!==void 0||(process.env.PM_PATH?.trim().length??0)>0)&&(global2.path=resolvePmRoot(resolutionCwd,global2.path));try{return resolved.action==="history-attest"?await dispatchAction(resolved.action,resolved.args,global2,null):args[ACTIVE_EXTENSION_HOST_CONTEXT]===!0||activeExtensionScope.getStore()===!0?await dispatchAction(resolved.action,resolved.args,global2,null):await withActiveExtensions(global2,explicitCwd,resolutionCwd,activeExtensions=>dispatchAction(resolved.action,resolved.args,global2,activeExtensions))}finally{invalidateWorkspaceContractsCache&&clearWorkspaceContractsCache()}}function analyzeSdkActionCoverage(actions=PM_TOOL_ACTIONS){return actions.map(action=>{const normalized=normalizeActionName(action),alias=getOwnHandler(SDK_ACTION_ALIASES,normalized),resolvedAction=alias?.action??normalized,covered=getOwnHandler(SDK_ACTION_HANDLERS,resolvedAction)!==void 0;return{action,resolved_action:resolvedAction,covered,route:covered?alias?"alias":"native":"missing"}})}async function dispatchAction(action,args,global2,activeExtensions){const options=optionsWithAuthor(args,action);if(action==="create"||action==="update"){const{assertNativeMutationOptions}=await import("./runtime/mutation-admission.js");await assertNativeMutationOptions(action,args,options,global2.path,HOISTED_ACTION_OPTION_KEYS[action])}const handler=getOwnHandler(SDK_ACTION_HANDLERS,action),extensionCommand=handler?void 0:resolveActiveExtensionActionCommand(action,activeExtensions),readCommand=extensionCommand===void 0?action:`extension:${extensionCommand}`;validateReadOutputOptions(readCommand,options),normalizeReadOutputIncludeModeOptions(readCommand,options);const ctx={action,args,options,id:readString(args,"id"),force:args.force===!0||options.force===!0,global:global2,activeExtensions},result=handler?await handler(ctx):await dispatchActiveExtensionAction(action,args,options,global2,activeExtensions);if(action==="history-attest")return result;{const projected=attachReadOutputContracts(readCommand,options,result);return await finalizeContextUsageEgress(resolvePmRoot(process.cwd(),global2.path),projected),projected}}const actionRunnerTestHooks={closeManyOptionsFromFlat,extensionOptionsFromArgs,globalOptions,mutationListOptions,normalizeActionName,normalizeCommandPath,normalizeMcpUpdateOptions,normalizeMcpOptionsArrays,optionsWithAuthor,readRequiredString,readScalarString,readScalarStringAllowBlank,readStringArray,updateManyOptionsFromFlat,withAddNoteOption,withFilesDiscoveryOptions,withMutationCompaction};(process.env.NODE_ENV==="test"||process.env.VITEST!==void 0||process.env.VITEST_WORKER_ID!==void 0)&&(globalThis.__pmCliActionRunnerTestHooks=actionRunnerTestHooks);import{readRequiredString as readRequiredString2}from"./runtime/context.js";export{BASELINE_ITEM_FORMAT_VERSION,BUILTIN_ITEM_TYPE_VALUES,CONFIDENCE_TEXT_VALUES,CONTEXT_OUTPUT_VALUES,CURRENT_ITEM_FORMAT_VERSION,DEFAULT_TERMINAL_TRANSITION_POLICY,DEPENDENCY_KIND_VALUES,EXIT_CODE,HISTORY_EVENT_CLASSIFICATION_VERSION,ISSUE_SEVERITY_VALUES,ITEM_TYPE_VALUES,MAINTENANCE_HISTORY_OPERATIONS,NEXT_OUTPUT_VALUES,PM_CLI_EXPECTED_ERROR_NAME,PM_GITIGNORE_END,PM_GITIGNORE_START,PmCliError2 as PmCliError,PmClient,PmCompleteListValidationError,RISK_VALUES,SEARCH_EXTENSION_FLAG_DEFINITIONS,STATUS_VALUES,SUBSTANTIVE_HISTORY_OPERATIONS,acquireLock,acquireLockLease,aggregate,analyzeSdkActionCoverage,append,appendHistoryEntry,applyTerminalOrderingPolicy,assertCompleteListResult,canonicalDocument,certifyCompleteListResult2 as certifyCompleteListResult,claim,claimNext,classifyHistoryEvent,classifyItemFormatVersion,clearWorkspaceContractsCache2 as clearWorkspaceContractsCache,close,closeItem,closeTask,comments,commitImportedItem,config,context,copy,create,createCompleteListOptions2 as createCompleteListOptions,createHistoryEntry,createPmCliExpectedError,deleteItem,deps,docs,duplicates,effectiveItemFormatVersion,emptyImportedDocument,ensurePmGitignore,ensureTrackerInitialized,extension,extensionActivate,extensionDeactivate,extensionList,files,filesDiscover,filesLookup,focus,gc,generateItemId,get,getActiveExtensionRegistrations,getContracts,getHistoryPath,getItemPath,getPmGitignoreBlock,getSettingsPath2 as getSettingsPath,getWorkspaceContracts,graph,health,historyCompact,historyCompactBulk,historyRedact,historyRepair,historyRepairAll,init,inspectCompleteListResult,isPmCliExpectedError,isTerminalStatus,isTimestampLiteral,jaccardSimilarity,learnings,list,listAllComplete,listAllItemMetadata,listAllItemMetadataLight,loadCreateTemplateOptions,locateItem,next,normalizeItemFormatVersion,normalizeItemId,normalizeItemMetadata,normalizeRawItemId,normalizeSimilarityText,normalizeStatusInput,notes,nowIso,packageActivate,packageCatalog,packageDeactivate,packageDescribe,packageDoctor,packageInstall,packageLifecycle,packageList,packageManage,packageReload,packageUninstall,parseTags,pathExists2 as pathExists,pauseTask,profile,profileApply,profileLint,profileList,profileShow,readBooleanOption,readCsvListOption,readFileIfExists,readLocatedItem,readRequiredString2 as readRequiredString,readSettings2 as readSettings,readStringOption,release,removeFileIfExists,renderCalendarMarkdown,renderCalendarToon,renderGuideMarkdown,reopen,requireTerminalReason,resolveCalendarOutputFormat,resolveGuideOutputFormat,resolveImplicitPmRoot,resolveItemTypeRegistry,resolvePmRoot2 as resolvePmRoot,resolveRuntimeFieldRegistry,resolveRuntimeStatusRegistry,resolveTerminalReason,restore,runAction,runActiveOnReadHooks,runActiveOnWriteHooks,runAggregate,runCalendar,runClose,runCloseTask,runCompletion,runContext,runCopy,runDelete,runDuplicates,runFocus,runGet,runGuide,runList,runNext,runPauseTask,runReindex,runReopen,runRestore,runSearch,runStartTask,runStats,runTemplatesList,runTemplatesSave,runTemplatesShow,runTestRunsList,runTestRunsLogs,runTestRunsResume,runTestRunsStatus,runTestRunsStop,runUpdate,runWithActiveExtensions,scanItemFormatVersions,schema,schemaAddField,schemaAddStatus,schemaAddType,schemaApplyPreset,schemaInferTypes,schemaList,schemaListFields,schemaRemapStatus,schemaRemoveField,schemaRemoveStatus,schemaRemoveType,schemaRenameField,schemaRenameType,schemaShow,schemaShowField,schemaShowStatus,scoreItemSimilarity,search,selectImportAuthor,serializeItemDocument,splitFrontMatter,startTask,stats,toEstimatedMinutesValue,toImportBoolean,toImportConfidence,toImportInteger,toImportLinkedDocs,toImportLinkedFiles,toImportLinkedTests,toImportLogEntries,toImportNormalizedEnum,toImportNumberMap,toImportPriority,toImportStatus,toImportStringList,toImportStringMap,toImportTags,toNonEmptyImportString,tokenizeSimilarityText,update,upgrade,validate,withCliMutationInput,withLiteralMutationInput,writeFileAtomic};
|
|
1
|
+
(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="02187d6f-cc44-5e66-85be-b0c6ce2921d8")}catch{}})();import{AsyncLocalStorage}from"node:async_hooks";import{createExtensionCommandError}from"./error-runtime.js";import{capturePmCommandScope}from"./command-line.js";import{createEmptyExtensionCommandRegistry,createEmptyExtensionHookRegistry,createEmptyExtensionParserRegistry,createEmptyExtensionPreflightRegistry,createEmptyExtensionRegistrationRegistry,createEmptyExtensionRendererRegistry,createEmptyExtensionServiceRegistry}from"../core/extensions/extension-registries.js";import{activateExtensions,deactivateExtensions,loadExtensions,runActiveCommandHandler,runWithIsolatedExtensionRuntime,setActiveExtensionCommands,setActiveExtensionHooks,setActiveExtensionParsers,setActiveExtensionPreflight,setActiveExtensionRegistrations,setActiveExtensionRenderers,setActiveExtensionServices}from"../core/extensions/index.js";import{pathExists}from"../core/fs/fs-utils.js";import{EXIT_CODE}from"../core/shared/constants.js";import{PmCliError}from"../core/shared/errors.js";import{asRecordClone}from"../core/shared/primitives.js";import{HOISTED_ACTION_OPTION_KEYS}from"./runtime-input.js";import{assertMutationOptionBag}from"./runtime/mutation-value-validation.js";import{withCliMutationInput,withLiteralMutationInput}from"./lifecycle/cli-input.js";import{createAsyncReadWriteGate}from"../core/shared/serial-queue.js";import{getSettingsPath,resolvePmRoot}from"../core/store/paths.js";import{readSettings,runWithConfigurationOnlySettings}from"../core/store/settings.js";import{resolveAuthor}from"../core/shared/author.js";import{PM_TOOL_ACTIONS}from"./cli-contracts/enum-contracts.js";import{runContracts}from"./cli-contracts/runtime-contracts.js";import{attachReadOutputContracts}from"./context-intent-contracts.js";import{runWithDiscoveredContextIntentContracts}from"./context-intent-runtime.js";import{finalizeContextUsageEgress}from"./context/usage-egress.js";import{createExtensionCommandSdk}from"./extension-command-context.js";import{INIT_INVOCATION_CWD}from"./init.js";import{certifyCompleteListResult,createCompleteListOptions}from"./query/complete-list.js";import{listClientItemMetadataLight}from"./query/light-metadata.js";import{normalizeReadOutputIncludeModeOptions,validateReadOutputOptions}from"./read-output-contracts.js";import{SDK_ACTION_ALIASES}from"./runtime-action-aliases.js";import{closeManyOptionsFromFlat,extensionOptionsFromArgs,actionGlobalOptions as globalOptions,mutationListOptions,mutationOptionsWithOverrides,normalizeActionName,normalizeCommandPath,normalizeMcpOptionsArrays,normalizeMcpUpdateOptions,optionsWithAuthor,readRuntimeScalarString as readScalarString,readRuntimeScalarStringAllowBlank as readScalarStringAllowBlank,readRuntimeString as readString,readRuntimeStringArray as readStringArray,shouldInvalidateWorkspaceContractsCacheAfterAction,updateManyOptionsFromFlat,withAddNoteOption,withFilesDiscoveryOptions,withMutationCompaction}from"./runtime-input.js";import{SDK_ACTION_HANDLERS}from"./runtime/actions.js";import{getOwnHandler,readRequiredString}from"./runtime/context.js";import{clearWorkspaceContractsCache}from"./workspace-contracts-cache.js";import{PM_GITIGNORE_END,PM_GITIGNORE_START,ensurePmGitignore,getPmGitignoreBlock}from"./workspace.js";import{SEARCH_EXTENSION_FLAG_DEFINITIONS}from"./extension-contracts.js";export*from"./cli-contracts/agent-output-contracts.js";import{PmCompleteListValidationError,assertCompleteListResult,certifyCompleteListResult as certifyCompleteListResult2,createCompleteListOptions as createCompleteListOptions2,inspectCompleteListResult}from"./query/complete-list.js";import{getWorkspaceContracts}from"./query/workspace-contracts.js";import{clearWorkspaceContractsCache as clearWorkspaceContractsCache2}from"./workspace-contracts-cache.js";export*from"./governance/workflow-policy.js";import{runCloseTask,runPauseTask,runStartTask}from"./lifecycle/task-composition.js";import{getActiveExtensionRegistrations,runActiveOnReadHooks,runActiveOnWriteHooks}from"../core/extensions/index.js";import{pathExists as pathExists2,readFileIfExists,removeFileIfExists,writeFileAtomic}from"../core/fs/fs-utils.js";import{appendHistoryEntry,createHistoryEntry}from"../core/history/history.js";import{HISTORY_EVENT_CLASSIFICATION_VERSION,MAINTENANCE_HISTORY_OPERATIONS,SUBSTANTIVE_HISTORY_OPERATIONS,classifyHistoryEvent}from"../core/history/event-classification.js";import{generateItemId,normalizeItemId,normalizeRawItemId}from"../core/item/id.js";import{readBooleanOption,readCsvListOption,readStringOption}from"./package-runtime-options.js";import{PM_CLI_EXPECTED_ERROR_NAME,createPmCliExpectedError,isPmCliExpectedError}from"./errors.js";import{commitImportedItem,emptyImportedDocument,ensureTrackerInitialized,selectImportAuthor,toEstimatedMinutesValue,toImportBoolean,toImportConfidence,toImportInteger,toImportLinkedDocs,toImportLinkedFiles,toImportLinkedTests,toImportLogEntries,toImportNormalizedEnum,toImportNumberMap,toImportPriority,toImportStatus,toImportStringList,toImportStringMap,toImportTags,toNonEmptyImportString}from"./package-import-adapters.js";import{canonicalDocument,normalizeItemMetadata,serializeItemDocument,splitFrontMatter}from"../core/item/item-format.js";import{BASELINE_ITEM_FORMAT_VERSION,CURRENT_ITEM_FORMAT_VERSION,classifyItemFormatVersion,effectiveItemFormatVersion,normalizeItemFormatVersion,scanItemFormatVersions}from"../core/item/item-format-version.js";import{parseTags}from"../core/item/parse.js";import{isTerminalStatus,normalizeStatusInput}from"../core/item/status.js";import{resolveItemTypeRegistry}from"../core/item/type-registry.js";import{acquireLock,acquireLockLease}from"../core/lock/lock.js";import{resolveRuntimeFieldRegistry,resolveRuntimeStatusRegistry}from"../core/schema/runtime-schema.js";import{PmCliError as PmCliError2}from"../core/shared/errors.js";import{isTimestampLiteral,nowIso}from"../core/shared/time.js";import{jaccardSimilarity,normalizeSimilarityText,scoreItemSimilarity,tokenizeSimilarityText}from"./similarity-scoring.js";import{listAllItemMetadata,listAllItemMetadataLight,locateItem,readLocatedItem}from"../core/store/item-store.js";import{getHistoryPath,getItemPath,getSettingsPath as getSettingsPath2,resolveImplicitPmRoot,resolvePmRoot as resolvePmRoot2}from"../core/store/paths.js";import{readSettings as readSettings2}from"../core/store/settings.js";import{runAggregate}from"./query/aggregate.js";import{CONTEXT_OUTPUT_VALUES,runContext}from"./query/context.js";import{runGet}from"./query/get.js";import{runList}from"./query/list.js";import{closeItem,runClose}from"./lifecycle/close.js";import{runCopy}from"./lifecycle/copy.js";import{runDelete}from"./lifecycle/delete.js";import{runFocus}from"./lifecycle/focus.js";import{runRestore}from"./lifecycle/restore.js";import{DEFAULT_TERMINAL_TRANSITION_POLICY,applyTerminalOrderingPolicy,requireTerminalReason,resolveTerminalReason}from"./lifecycle-policy.js";import{runUpdate}from"./lifecycle/update.js";import{runReopen}from"./lifecycle/reopen.js";import{NEXT_OUTPUT_VALUES,runNext}from"./query/next.js";import{runSearch}from"./query/search.js";import{runStats}from"./stats.js";import{runDuplicates}from"./duplicates.js";import{renderCalendarMarkdown,renderCalendarToon,resolveCalendarOutputFormat,runCalendar}from"./query/calendar.js";import{renderGuideMarkdown,resolveGuideOutputFormat,runGuide}from"./guide.js";import{runCompletion}from"./completion.js";import{runReindex}from"./governance/reindex.js";import{loadCreateTemplateOptions,runTemplatesList,runTemplatesSave,runTemplatesShow}from"./templates.js";import{runTestRunsList,runTestRunsLogs,runTestRunsResume,runTestRunsStatus,runTestRunsStop}from"./test/runs.js";import{BUILTIN_ITEM_TYPE_VALUES,CONFIDENCE_TEXT_VALUES,DEPENDENCY_KIND_VALUES,ISSUE_SEVERITY_VALUES,ITEM_TYPE_VALUES,RISK_VALUES,STATUS_VALUES}from"../types/index.js";const ACTIVE_EXTENSION_HOST_CONTEXT=Symbol("pm.active-extension-host-context");function splitFullClientMutationOptions(options){return{fullChangedFields:!0,options}}class PmClient{defaults;constructor(options={}){this.defaults={...options.pmRoot===void 0?{}:{path:options.pmRoot},...options.cwd===void 0?{}:{cwd:options.cwd},...options.author===void 0?{}:{author:options.author},...options.noExtensions===void 0?{}:{noExtensions:options.noExtensions}}}static forActiveExtensionHost(options){const client=new PmClient({...options,noExtensions:!0});return client.defaults[ACTIVE_EXTENSION_HOST_CONTEXT]=!0,client}run(action,args={}){return runAction({...this.defaults,...args,action})}runTyped(action,args={}){return this.run(action,args)}async withItemTransactionContext(run,configurationOnly=!1){const pmRoot=resolvePmRoot(this.defaults.cwd??process.cwd(),this.defaults.path),execute=async()=>{const settings=await runWithConfigurationOnlySettings(pmRoot,()=>readSettings(pmRoot));return run({pmRoot,author:resolveAuthor(this.defaults.author,settings.author_default)})};if(this.defaults[ACTIVE_EXTENSION_HOST_CONTEXT]===!0||activeExtensionScope.getStore()===!0)return execute();const activate=()=>runWithActiveExtensions({...this.defaults,path:pmRoot},execute);return configurationOnly?runWithConfigurationOnlySettings(pmRoot,activate):activate()}previewItemMutations(options){return this.withItemTransactionContext(async identity=>(await import("./item-transaction.js")).previewItemMutations({...options,...identity}),!0)}commitItemMutations(options){return this.withItemTransactionContext(async identity=>(await import("./item-transaction.js")).commitItemMutations({...options,...identity}))}get itemTransactions(){const abandon=(transactionId,options)=>this.withItemTransactionContext(async identity=>(await import("./item-transaction.js")).abandonItemTransaction({...options,...identity,transactionId}));return{status:transactionId=>this.withItemTransactionContext(async identity=>(await import("./item-transaction.js")).readItemTransaction(identity.pmRoot,transactionId),!0),abandon,supersede:(transactionId,newId,options)=>abandon(transactionId,{...options,supersededBy:newId})}}context(options={}){return this.runTyped("context",{options})}listAllItemMetadataLight(){return listClientItemMetadataLight(this.defaults.path,this.defaults.cwd)}list(options={}){return this.runTyped("list",{options})}async listAllComplete(options={}){return certifyCompleteListResult(await this.list(createCompleteListOptions(options)))}search(query,options={}){return this.runTyped("search",{query,options})}get(id,options={}){return this.runTyped("get",{id,options})}next(options={}){return this.runTyped("next",{options})}aggregate(options={}){return this.runTyped("aggregate",{options})}stats(options={}){return this.runTyped("stats",{options})}duplicates(options={}){return this.runTyped("duplicates",{options})}comments(id,options={}){return this.runTyped("comments",{id,options})}notes(id,options={}){return this.runTyped("notes",{id,options})}learnings(id,options={}){return this.runTyped("learnings",{id,options})}files(id,options={}){return this.runTyped("files",{id,options})}filesDiscover(id,options={}){return this.runTyped("files-discover",{id,options})}filesLookup(options){return this.runTyped("files-lookup",{options})}docs(id,options={}){return this.runTyped("docs",{id,options})}deps(id,options={}){return this.runTyped("deps",{id,options})}graph(subcommand,ids={},options={}){return this.runTyped("graph",{subcommand,...ids,options})}async append(id,body,options={}){return assertMutationOptionBag(options,"append"),await this.runTyped("append",{id,...splitFullClientMutationOptions(mutationOptionsWithOverrides(options,{body}))})}init(prefix,options={}){return this.runTyped("init",{...prefix===void 0?{}:{prefix},options})}config(scope,configAction,key,value,options={}){return this.runTyped("config",{scope,configAction,...key===void 0?{}:{key},...value===void 0?{}:{value},options})}schema(subcommand,options={}){return this.runTyped("schema",{options:{...options,subcommand}})}workflowPolicy(action,name,options={}){return this.runTyped("schema",{name,options:{...options,subcommand:action}})}schemaList(){return this.runTyped("schema",{options:{subcommand:"list"}})}schemaShow(name){return this.runTyped("schema",{name,options:{subcommand:"show"}})}schemaAddType(name,options={}){return this.runTyped("schema",{name,options:{...options,subcommand:"add-type"}})}schemaRemoveType(name,options={}){return this.runTyped("schema",{name,options:{...options,subcommand:"remove-type"}})}schemaAddStatus(name,options={}){return this.runTyped("schema",{name,options:{...options,subcommand:"add-status"}})}schemaRemoveStatus(name,options={}){return this.runTyped("schema",{name,options:{...options,subcommand:"remove-status"}})}schemaAddField(name,options={}){const{type,...mutationOptions}=options;return this.runTyped("schema",{name,options:{...mutationOptions,fieldType:type,subcommand:"add-field"}})}schemaRemoveField(name,options={}){return this.runTyped("schema",{name,options:{...options,subcommand:"remove-field"}})}schemaListFields(){return this.runTyped("schema",{options:{subcommand:"list-fields"}})}schemaShowField(name){return this.runTyped("schema",{name,options:{subcommand:"show-field"}})}schemaApplyPreset(typePreset,options={}){return this.runTyped("schema",{typePreset,options:{...options,subcommand:"apply-preset"}})}schemaInferTypes(options={}){return this.runTyped("schema",{options:{...options,subcommand:"add-type",infer:!0}})}schemaRenameType(from,to,options){return this.runTyped("schema",{name:from,options:{...options,subcommand:"rename-type",to}})}schemaRenameField(from,to,options,type){return this.runTyped("schema",{name:from,options:{...options,subcommand:"rename-field",to,...type?{fieldTypeScope:type}:{}}})}schemaRemapStatus(from,to,options){return this.runTyped("schema",{name:from,options:{...options,subcommand:"remap-status",to}})}schemaShowStatus(name){return this.runTyped("schema",{name,options:{subcommand:"show-status"}})}profile(subcommand,options={}){return this.runTyped("profile",{options:{...options,subcommand}})}profileList(){return this.runTyped("profile",{options:{subcommand:"list"}})}profileShow(name){return this.runTyped("profile",{name,options:{subcommand:"show"}})}profileApply(name,options={}){return this.runTyped("profile",{name,options:{...options,subcommand:"apply"}})}profileLint(name){return this.runTyped("profile",{name,options:{subcommand:"lint"}})}validate(options={}){return this.runTyped("validate",{options})}health(options={}){return this.runTyped("health",{options})}gc(options={}){return this.runTyped("gc",{options})}assurance(input){return this.runTyped("assurance",{options:{...input,subcommand:input.action}})}historyRedact(id,options){return this.runTyped("history-redact",{id,options})}historyRepair(id,options={}){return this.runTyped("history-repair",{id,options})}historyRepairAll(options={}){return this.runTyped("history-repair",{options:{...options,all:!0}})}historyAttest(options={}){return this.runTyped("history-attest",{options})}historyCompact(id,options={}){return this.runTyped("history-compact",{id,options})}historyCompactBulk(options){return this.runTyped("history-compact",{options})}historyAuthorAcknowledge(options){return this.runTyped("history-author-acknowledge",{historyEvent:(options.events??[]).map(event=>`${event.item_id}:${String(event.line)}`),allActionable:options.all_actionable===!0,dryRun:options.dry_run===!0,planFingerprint:options.plan_fingerprint,limit:options.coordinate_limit,attributedAuthor:options.attributed_author,reviewer:options.reviewer,reason:options.reason})}plan(subcommand,id,options={},stepRef,reorderTo){return this.runTyped("plan",{fullChangedFields:!0,...id===void 0?{}:{id},...stepRef===void 0?{}:{stepRef},...reorderTo===void 0?{}:{reorderTo},options:mutationOptionsWithOverrides(options,{subcommand})})}planCreate(options){return this.plan("create",void 0,options)}planShow(id,options={}){return this.plan("show",id,options)}planAddStep(id,options){return this.plan("add-step",id,options)}planUpdateStep(id,stepRef,options){return this.plan("update-step",id,options,stepRef)}planCompleteStep(id,stepRef,options={}){return this.plan("complete-step",id,options,stepRef)}planBlockStep(id,stepRef,options){return this.plan("block-step",id,options,stepRef)}planReorderStep(id,stepRef,reorderTo,options={}){return this.plan("reorder-step",id,options,stepRef,reorderTo)}planRemoveStep(id,stepRef,options={}){return this.plan("remove-step",id,options,stepRef)}planLink(id,stepRef,options){return this.plan("link",id,options,stepRef)}planUnlink(id,stepRef,options){return this.plan("unlink",id,options,stepRef)}planDecision(id,options){return this.plan("decision",id,options)}planDiscovery(id,options){return this.plan("discovery",id,options)}planValidation(id,options){return this.plan("validation",id,options)}planResume(id,options){return this.plan("resume",id,options)}planApprove(id,options={}){return this.plan("approve",id,options)}planMaterialize(id,options){return this.plan("materialize",id,options)}create(options={}){return this.runTyped("create",splitFullClientMutationOptions(options))}update(id,options={}){return this.runTyped("update",{id,...splitFullClientMutationOptions(options)})}reopen(id,reason,options={}){return this.runTyped("item-reopen",{id,reason,fullChangedFields:!0,options})}close(id,reason,options={}){return this.runTyped("close",{id,reason,...splitFullClientMutationOptions(options)})}claim(id,options={}){return this.runTyped("claim",{id,...splitFullClientMutationOptions(options)})}claimNext(options={}){return this.runTyped("claim",{next:!0,...splitFullClientMutationOptions(options)})}release(id,options={}){return this.runTyped("release",{id,...splitFullClientMutationOptions(options)})}copy(id,options={}){return this.runTyped("copy",{id,...splitFullClientMutationOptions(options)})}delete(id,options={}){return this.runTyped("delete",{id,...splitFullClientMutationOptions(options)})}restore(id,target,options={}){return this.runTyped("restore",{fullChangedFields:!0,id,options:{...options,target}})}focus(id,options={}){return this.runTyped("focus",{...id===void 0?{}:{id},...splitFullClientMutationOptions(options)})}startTask(id,options={}){return this.runTyped("start-task",{id,...splitFullClientMutationOptions(options)})}pauseTask(id,options={}){return this.runTyped("pause-task",{id,...splitFullClientMutationOptions(options)})}closeTask(id,reason,options={}){return this.runTyped("close-task",{id,reason,...splitFullClientMutationOptions(options)})}extension(target,options={}){return this.runTyped("extension",{...target===void 0?{}:{target},options})}extensionList(options={}){return this.extension("list",options)}extensionActivate(target,options={}){return this.runTyped("extension-activate",{target,options})}extensionDeactivate(target,options={}){return this.runTyped("extension-deactivate",{target,options})}package(target,options={}){return this.runTyped("package",{...target===void 0?{}:{target},options:{...options,vocabulary:"package"}})}packageList(options={}){return this.package("list",options)}packageInstall(target,options={}){return this.runTyped("package-install",{target,options})}packageUninstall(target,options={}){return this.runTyped("package-uninstall",{target,options})}packageDoctor(options={}){return this.runTyped("package-doctor",{options})}packageManage(target,options={}){return this.runTyped("package-manage",{...target===void 0?{}:{target},options})}packageDescribe(target,options={}){return this.runTyped("package-describe",{...target===void 0?{}:{target},options})}packageReload(options={}){return this.runTyped("package-reload",{options})}packageCatalog(options={}){return this.runTyped("package-catalog",{options})}packageActivate(target,options={}){return this.runTyped("package-activate",{target,options})}packageDeactivate(target,options={}){return this.runTyped("package-deactivate",{target,options})}packageMigrate(options={}){return this.package(void 0,{...options,migrate:!0})}upgrade(target,options={}){return this.runTyped("upgrade",{...target===void 0?{}:{target},options})}}function context(options={},clientOptions={}){return new PmClient(clientOptions).context(options)}function list(options={},clientOptions={}){return new PmClient(clientOptions).list(options)}function listAllComplete(options={},clientOptions={}){return new PmClient(clientOptions).listAllComplete(options)}function search(query,options={},clientOptions={}){return new PmClient(clientOptions).search(query,options)}function get(id,options={},clientOptions={}){return new PmClient(clientOptions).get(id,options)}function next(options={},clientOptions={}){return new PmClient(clientOptions).next(options)}function aggregate(options={},clientOptions={}){return new PmClient(clientOptions).aggregate(options)}function stats(options={},clientOptions={}){return new PmClient(clientOptions).stats(options)}function duplicates(options={},clientOptions={}){return new PmClient(clientOptions).duplicates(options)}function comments(id,options={},clientOptions={}){return new PmClient(clientOptions).comments(id,options)}function notes(id,options={},clientOptions={}){return new PmClient(clientOptions).notes(id,options)}function learnings(id,options={},clientOptions={}){return new PmClient(clientOptions).learnings(id,options)}function files(id,options={},clientOptions={}){return new PmClient(clientOptions).files(id,options)}function filesDiscover(id,options={},clientOptions={}){return new PmClient(clientOptions).filesDiscover(id,options)}function filesLookup(options,clientOptions={}){return new PmClient(clientOptions).filesLookup(options)}function docs(id,options={},clientOptions={}){return new PmClient(clientOptions).docs(id,options)}function deps(id,options={},clientOptions={}){return new PmClient(clientOptions).deps(id,options)}function graph(subcommand,ids={},options={},clientOptions={}){return new PmClient(clientOptions).graph(subcommand,ids,options)}function append(id,body,options={},clientOptions={}){return new PmClient(clientOptions).append(id,body,options)}function init(prefix,options={},clientOptions={}){return new PmClient(clientOptions).init(prefix,options)}function config(scope,configAction,key,value,options={},clientOptions={}){return new PmClient(clientOptions).config(scope,configAction,key,value,options)}function schema(subcommand,options={},clientOptions={}){return new PmClient(clientOptions).schema(subcommand,options)}function schemaList(clientOptions={}){return new PmClient(clientOptions).schemaList()}function schemaShow(name,clientOptions={}){return new PmClient(clientOptions).schemaShow(name)}function schemaAddType(name,options={},clientOptions={}){return new PmClient(clientOptions).schemaAddType(name,options)}function schemaRemoveType(name,options={},clientOptions={}){return new PmClient(clientOptions).schemaRemoveType(name,options)}function schemaAddStatus(name,options={},clientOptions={}){return new PmClient(clientOptions).schemaAddStatus(name,options)}function schemaRemoveStatus(name,options={},clientOptions={}){return new PmClient(clientOptions).schemaRemoveStatus(name,options)}function schemaAddField(name,options={},clientOptions={}){return new PmClient(clientOptions).schemaAddField(name,options)}function schemaRemoveField(name,options={},clientOptions={}){return new PmClient(clientOptions).schemaRemoveField(name,options)}function schemaListFields(clientOptions={}){return new PmClient(clientOptions).schemaListFields()}function schemaShowField(name,clientOptions={}){return new PmClient(clientOptions).schemaShowField(name)}function schemaApplyPreset(typePreset,options={},clientOptions={}){return new PmClient(clientOptions).schemaApplyPreset(typePreset,options)}function schemaInferTypes(options={},clientOptions={}){return new PmClient(clientOptions).schemaInferTypes(options)}function schemaRenameType(from,to,options,clientOptions={}){return new PmClient(clientOptions).schemaRenameType(from,to,options)}function schemaRenameField(from,to,options,type,clientOptions={}){return new PmClient(clientOptions).schemaRenameField(from,to,options,type)}function schemaRemapStatus(from,to,options,clientOptions={}){return new PmClient(clientOptions).schemaRemapStatus(from,to,options)}function schemaShowStatus(name,clientOptions={}){return new PmClient(clientOptions).schemaShowStatus(name)}function profile(subcommand,options={},clientOptions={}){return new PmClient(clientOptions).profile(subcommand,options)}function profileList(clientOptions={}){return new PmClient(clientOptions).profileList()}function profileShow(name,clientOptions={}){return new PmClient(clientOptions).profileShow(name)}function profileApply(name,options={},clientOptions={}){return new PmClient(clientOptions).profileApply(name,options)}function profileLint(name,clientOptions={}){return new PmClient(clientOptions).profileLint(name)}function validate(options={},clientOptions={}){return new PmClient(clientOptions).validate(options)}function health(options={},clientOptions={}){return new PmClient(clientOptions).health(options)}function gc(options={},clientOptions={}){return new PmClient(clientOptions).gc(options)}function historyRedact(id,options,clientOptions={}){return new PmClient(clientOptions).historyRedact(id,options)}function historyRepair(id,options={},clientOptions={}){return new PmClient(clientOptions).historyRepair(id,options)}function historyRepairAll(options={},clientOptions={}){return new PmClient(clientOptions).historyRepairAll(options)}function historyCompact(id,options={},clientOptions={}){return new PmClient(clientOptions).historyCompact(id,options)}function historyCompactBulk(options,clientOptions={}){return new PmClient(clientOptions).historyCompactBulk(options)}function create(options={},clientOptions={}){return new PmClient(clientOptions).create(options)}function update(id,options={},clientOptions={}){return new PmClient(clientOptions).update(id,options)}function reopen(id,reason,options={},clientOptions={}){return new PmClient(clientOptions).reopen(id,reason,options)}function close(id,reason,options={},clientOptions={}){return new PmClient(clientOptions).close(id,reason,options)}function claim(id,options={},clientOptions={}){return new PmClient(clientOptions).claim(id,options)}function claimNext(options={},clientOptions={}){return new PmClient(clientOptions).claimNext(options)}function release(id,options={},clientOptions={}){return new PmClient(clientOptions).release(id,options)}function copy(id,options={},clientOptions={}){return new PmClient(clientOptions).copy(id,options)}function deleteItem(id,options={},clientOptions={}){return new PmClient(clientOptions).delete(id,options)}function restore(id,target,options={},clientOptions={}){return new PmClient(clientOptions).restore(id,target,options)}function focus(id,options={},clientOptions={}){return new PmClient(clientOptions).focus(id,options)}function startTask(id,options={},clientOptions={}){return new PmClient(clientOptions).startTask(id,options)}function pauseTask(id,options={},clientOptions={}){return new PmClient(clientOptions).pauseTask(id,options)}function closeTask(id,reason,options={},clientOptions={}){return new PmClient(clientOptions).closeTask(id,reason,options)}function extension(target,options={},clientOptions={}){return new PmClient(clientOptions).extension(target,options)}function extensionList(options={},clientOptions={}){return new PmClient(clientOptions).extensionList(options)}function extensionActivate(target,options={},clientOptions={}){return new PmClient(clientOptions).extensionActivate(target,options)}function extensionDeactivate(target,options={},clientOptions={}){return new PmClient(clientOptions).extensionDeactivate(target,options)}function packageLifecycle(target,options={},clientOptions={}){return new PmClient(clientOptions).package(target,options)}function packageList(options={},clientOptions={}){return new PmClient(clientOptions).packageList(options)}function packageInstall(target,options={},clientOptions={}){return new PmClient(clientOptions).packageInstall(target,options)}function packageUninstall(target,options={},clientOptions={}){return new PmClient(clientOptions).packageUninstall(target,options)}function packageDoctor(options={},clientOptions={}){return new PmClient(clientOptions).packageDoctor(options)}function packageManage(target,options={},clientOptions={}){return new PmClient(clientOptions).packageManage(target,options)}function packageDescribe(target,options={},clientOptions={}){return new PmClient(clientOptions).packageDescribe(target,options)}function packageReload(options={},clientOptions={}){return new PmClient(clientOptions).packageReload(options)}function packageCatalog(options={},clientOptions={}){return new PmClient(clientOptions).packageCatalog(options)}function packageActivate(target,options={},clientOptions={}){return new PmClient(clientOptions).packageActivate(target,options)}function packageDeactivate(target,options={},clientOptions={}){return new PmClient(clientOptions).packageDeactivate(target,options)}function upgrade(target,options={},clientOptions={}){return new PmClient(clientOptions).upgrade(target,options)}async function getContracts(pmRootOrOptions,options={}){const resolvedOptions=typeof pmRootOrOptions=="string"?{...options,pmRoot:pmRootOrOptions}:pmRootOrOptions??options,global2={json:!0,quiet:resolvedOptions.quiet??!0,noExtensions:resolvedOptions.noExtensions??!1,noPager:!0,profile:resolvedOptions.profile??!1,path:resolvedOptions.pmRoot};return runContracts(resolvedOptions,global2)}const extensionActivationGate=createAsyncReadWriteGate(),activeExtensionScope=new AsyncLocalStorage;function resetActiveExtensionRegistries(){setActiveExtensionHooks(createEmptyExtensionHookRegistry()),setActiveExtensionCommands(createEmptyExtensionCommandRegistry()),setActiveExtensionParsers(createEmptyExtensionParserRegistry()),setActiveExtensionPreflight(createEmptyExtensionPreflightRegistry()),setActiveExtensionServices(createEmptyExtensionServiceRegistry()),setActiveExtensionRenderers(createEmptyExtensionRendererRegistry()),setActiveExtensionRegistrations(createEmptyExtensionRegistrationRegistry())}async function withActiveExtensions(global2,explicitCwd,resolutionCwd,run){return runWithIsolatedExtensionRuntime(()=>explicitCwd===void 0?extensionActivationGate.read(()=>withActiveExtensionsExclusively(global2,resolutionCwd,run)):extensionActivationGate.write(()=>withCwd(explicitCwd,()=>withActiveExtensionsExclusively(global2,resolutionCwd,run))))}async function runWithActiveExtensions(options,run){const explicitCwd=options.cwd;if(activeExtensionScope.getStore()===!0&&explicitCwd===void 0&&options.noExtensions===!0){const pmRoot=resolvePmRoot(process.cwd(),options.path);return runWithIsolatedExtensionRuntime(()=>runWithDiscoveredContextIntentContracts({pmRoot},run))}const resolutionCwd=explicitCwd??process.cwd();return withActiveExtensions(globalOptions({path:options.path,noExtensions:options.noExtensions}),explicitCwd,resolutionCwd,()=>activeExtensionScope.run(!0,run))}async function withActiveExtensionsExclusively(global2,cwd,run){const pmRoot=resolvePmRoot(cwd,global2.path);if(global2.noExtensions)return resetActiveExtensionRegistries(),runWithDiscoveredContextIntentContracts({pmRoot},()=>run(null));if(!await pathExists(getSettingsPath(pmRoot)))return resetActiveExtensionRegistries(),run(null);let active=null,activated;try{const settings=await readSettings(pmRoot),loadResult=await loadExtensions({pmRoot,settings,cwd,noExtensions:!1}),activationResult=await activateExtensions({...loadResult,loaded:loadResult.loaded});activated={loadResult,activationResult},setActiveExtensionHooks(activationResult.hooks),setActiveExtensionCommands(activationResult.commands),setActiveExtensionParsers(activationResult.parsers),setActiveExtensionPreflight(activationResult.preflight),setActiveExtensionServices(activationResult.services),setActiveExtensionRenderers(activationResult.renderers),setActiveExtensionRegistrations(activationResult.registrations),active={registrations:activationResult.registrations,commands:activationResult.commands,pmRoot,packages:loadResult.loaded}}catch(error){resetActiveExtensionRegistries(),console.error("[pm-sdk] extension activation failed; continuing without active extensions:",error)}try{return await runWithDiscoveredContextIntentContracts({pmRoot,packages:active?.packages},()=>run(active))}finally{resetActiveExtensionRegistries(),activated&&await deactivateExtensions(activated.loadResult,activated.activationResult).catch(()=>{})}}function resolveActiveExtensionActionCommand(action,active){const normalizedAction=normalizeActionName(action);return active?.registrations.commands.find(entry=>normalizeActionName(entry.action)===normalizedAction)?.command??active?.commands.handlers.find(entry=>normalizeActionName(entry.command)===normalizedAction)?.command}async function dispatchActiveExtensionAction(action,args,options,global2,active){if(!active)throw new PmCliError(`Unsupported native pm action: ${action}`,EXIT_CODE.USAGE);const command=resolveActiveExtensionActionCommand(action,active);if(!command)throw new PmCliError(`Unsupported native pm action: ${action}`,EXIT_CODE.USAGE);const extensionAuthor=typeof options.author=="string"?options.author:global2.author,handlerResult=await runActiveCommandHandler({command:normalizeCommandPath(command),args:readStringArray(options.args??args.args),options:extensionOptionsFromArgs(args,options),global:{...global2,author:extensionAuthor},pm_root:active.pmRoot,sdk:createExtensionCommandSdk(active.pmRoot,PmClient.forActiveExtensionHost({pmRoot:active.pmRoot,author:extensionAuthor}),extensionAuthor,normalizeCommandPath(command))});if(!handlerResult.handled){if(Object.hasOwn(handlerResult,"cause"))throw createExtensionCommandError(command,handlerResult);const suffix=handlerResult.warnings.length>0?` (${handlerResult.warnings.join(", ")})`:"";throw new PmCliError(`Unsupported native pm action: ${action}${suffix}`,EXIT_CODE.USAGE)}return handlerResult.result}async function withCwd(cwd,run){const previous=process.cwd();process.chdir(cwd);try{return await run()}finally{process.chdir(previous)}}function resolveSdkActionInput(args){const rawAction=readRequiredString(args,"action"),normalizedAction=normalizeActionName(rawAction),alias=getOwnHandler(SDK_ACTION_ALIASES,normalizedAction),action=alias?.action??normalizedAction,resolvedArgs={...args,action};return alias?.options!==void 0&&(resolvedArgs.options={...alias.options,...asRecordClone(args.options)}),action==="package"&&(resolvedArgs.options={...asRecordClone(resolvedArgs.options),vocabulary:"package"}),{action,args:resolvedArgs}}async function runAction(args){const resolved=resolveSdkActionInput(args),global2=globalOptions(resolved.args);capturePmCommandScope(global2);const invalidateWorkspaceContractsCache=shouldInvalidateWorkspaceContractsCacheAfterAction(resolved.action),explicitCwd=readString(resolved.args,"cwd"),resolutionCwd=explicitCwd??process.cwd();resolved.action==="init"&&(global2[INIT_INVOCATION_CWD]=resolutionCwd),(resolved.action!=="init"||global2.path!==void 0||(process.env.PM_PATH?.trim().length??0)>0)&&(global2.path=resolvePmRoot(resolutionCwd,global2.path));try{return resolved.action==="history-attest"?await dispatchAction(resolved.action,resolved.args,global2,null):args[ACTIVE_EXTENSION_HOST_CONTEXT]===!0||activeExtensionScope.getStore()===!0?await dispatchAction(resolved.action,resolved.args,global2,null):await withActiveExtensions(global2,explicitCwd,resolutionCwd,activeExtensions=>dispatchAction(resolved.action,resolved.args,global2,activeExtensions))}finally{invalidateWorkspaceContractsCache&&clearWorkspaceContractsCache()}}function analyzeSdkActionCoverage(actions=PM_TOOL_ACTIONS){return actions.map(action=>{const normalized=normalizeActionName(action),alias=getOwnHandler(SDK_ACTION_ALIASES,normalized),resolvedAction=alias?.action??normalized,covered=getOwnHandler(SDK_ACTION_HANDLERS,resolvedAction)!==void 0;return{action,resolved_action:resolvedAction,covered,route:covered?alias?"alias":"native":"missing"}})}async function dispatchAction(action,args,global2,activeExtensions){const options=optionsWithAuthor(args,action);if(action==="create"||action==="update"){const{assertNativeMutationOptions}=await import("./runtime/mutation-admission.js");await assertNativeMutationOptions(action,args,options,global2.path,HOISTED_ACTION_OPTION_KEYS[action])}const handler=getOwnHandler(SDK_ACTION_HANDLERS,action),extensionCommand=handler?void 0:resolveActiveExtensionActionCommand(action,activeExtensions),readCommand=extensionCommand===void 0?action:`extension:${extensionCommand}`;validateReadOutputOptions(readCommand,options),normalizeReadOutputIncludeModeOptions(readCommand,options);const ctx={action,args,options,id:readString(args,"id"),force:args.force===!0||options.force===!0,global:global2,activeExtensions},result=handler?await handler(ctx):await dispatchActiveExtensionAction(action,args,options,global2,activeExtensions);if(action==="history-attest")return result;{const projected=attachReadOutputContracts(readCommand,options,result);return await finalizeContextUsageEgress(resolvePmRoot(process.cwd(),global2.path),projected),projected}}const actionRunnerTestHooks={closeManyOptionsFromFlat,extensionOptionsFromArgs,globalOptions,mutationListOptions,normalizeActionName,normalizeCommandPath,normalizeMcpUpdateOptions,normalizeMcpOptionsArrays,optionsWithAuthor,readRequiredString,readScalarString,readScalarStringAllowBlank,readStringArray,updateManyOptionsFromFlat,withAddNoteOption,withFilesDiscoveryOptions,withMutationCompaction};(process.env.NODE_ENV==="test"||process.env.VITEST!==void 0||process.env.VITEST_WORKER_ID!==void 0)&&(globalThis.__pmCliActionRunnerTestHooks=actionRunnerTestHooks);import{readRequiredString as readRequiredString2}from"./runtime/context.js";export{BASELINE_ITEM_FORMAT_VERSION,BUILTIN_ITEM_TYPE_VALUES,CONFIDENCE_TEXT_VALUES,CONTEXT_OUTPUT_VALUES,CURRENT_ITEM_FORMAT_VERSION,DEFAULT_TERMINAL_TRANSITION_POLICY,DEPENDENCY_KIND_VALUES,EXIT_CODE,HISTORY_EVENT_CLASSIFICATION_VERSION,ISSUE_SEVERITY_VALUES,ITEM_TYPE_VALUES,MAINTENANCE_HISTORY_OPERATIONS,NEXT_OUTPUT_VALUES,PM_CLI_EXPECTED_ERROR_NAME,PM_GITIGNORE_END,PM_GITIGNORE_START,PmCliError2 as PmCliError,PmClient,PmCompleteListValidationError,RISK_VALUES,SEARCH_EXTENSION_FLAG_DEFINITIONS,STATUS_VALUES,SUBSTANTIVE_HISTORY_OPERATIONS,acquireLock,acquireLockLease,aggregate,analyzeSdkActionCoverage,append,appendHistoryEntry,applyTerminalOrderingPolicy,assertCompleteListResult,canonicalDocument,certifyCompleteListResult2 as certifyCompleteListResult,claim,claimNext,classifyHistoryEvent,classifyItemFormatVersion,clearWorkspaceContractsCache2 as clearWorkspaceContractsCache,close,closeItem,closeTask,comments,commitImportedItem,config,context,copy,create,createCompleteListOptions2 as createCompleteListOptions,createHistoryEntry,createPmCliExpectedError,deleteItem,deps,docs,duplicates,effectiveItemFormatVersion,emptyImportedDocument,ensurePmGitignore,ensureTrackerInitialized,extension,extensionActivate,extensionDeactivate,extensionList,files,filesDiscover,filesLookup,focus,gc,generateItemId,get,getActiveExtensionRegistrations,getContracts,getHistoryPath,getItemPath,getPmGitignoreBlock,getSettingsPath2 as getSettingsPath,getWorkspaceContracts,graph,health,historyCompact,historyCompactBulk,historyRedact,historyRepair,historyRepairAll,init,inspectCompleteListResult,isPmCliExpectedError,isTerminalStatus,isTimestampLiteral,jaccardSimilarity,learnings,list,listAllComplete,listAllItemMetadata,listAllItemMetadataLight,loadCreateTemplateOptions,locateItem,next,normalizeItemFormatVersion,normalizeItemId,normalizeItemMetadata,normalizeRawItemId,normalizeSimilarityText,normalizeStatusInput,notes,nowIso,packageActivate,packageCatalog,packageDeactivate,packageDescribe,packageDoctor,packageInstall,packageLifecycle,packageList,packageManage,packageReload,packageUninstall,parseTags,pathExists2 as pathExists,pauseTask,profile,profileApply,profileLint,profileList,profileShow,readBooleanOption,readCsvListOption,readFileIfExists,readLocatedItem,readRequiredString2 as readRequiredString,readSettings2 as readSettings,readStringOption,release,removeFileIfExists,renderCalendarMarkdown,renderCalendarToon,renderGuideMarkdown,reopen,requireTerminalReason,resolveCalendarOutputFormat,resolveGuideOutputFormat,resolveImplicitPmRoot,resolveItemTypeRegistry,resolvePmRoot2 as resolvePmRoot,resolveRuntimeFieldRegistry,resolveRuntimeStatusRegistry,resolveTerminalReason,restore,runAction,runActiveOnReadHooks,runActiveOnWriteHooks,runAggregate,runCalendar,runClose,runCloseTask,runCompletion,runContext,runCopy,runDelete,runDuplicates,runFocus,runGet,runGuide,runList,runNext,runPauseTask,runReindex,runReopen,runRestore,runSearch,runStartTask,runStats,runTemplatesList,runTemplatesSave,runTemplatesShow,runTestRunsList,runTestRunsLogs,runTestRunsResume,runTestRunsStatus,runTestRunsStop,runUpdate,runWithActiveExtensions,scanItemFormatVersions,schema,schemaAddField,schemaAddStatus,schemaAddType,schemaApplyPreset,schemaInferTypes,schemaList,schemaListFields,schemaRemapStatus,schemaRemoveField,schemaRemoveStatus,schemaRemoveType,schemaRenameField,schemaRenameType,schemaShow,schemaShowField,schemaShowStatus,scoreItemSimilarity,search,selectImportAuthor,serializeItemDocument,splitFrontMatter,startTask,stats,toEstimatedMinutesValue,toImportBoolean,toImportConfidence,toImportInteger,toImportLinkedDocs,toImportLinkedFiles,toImportLinkedTests,toImportLogEntries,toImportNormalizedEnum,toImportNumberMap,toImportPriority,toImportStatus,toImportStringList,toImportStringMap,toImportTags,toNonEmptyImportString,tokenizeSimilarityText,update,upgrade,validate,withCliMutationInput,withLiteralMutationInput,writeFileAtomic};
|
|
2
2
|
//# sourceMappingURL=runtime.js.map
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* Resolves lifecycle alias status transitions shared by CLI registration and the SDK runtime.
|
|
5
5
|
*/
|
|
6
6
|
import { type RuntimeStatusRegistry } from "../core/schema/runtime-schema.js";
|
|
7
|
-
/** Resolve the status
|
|
7
|
+
/** Resolve the status a start moves an item to. A configured in-progress status distinct from the open status wins (for example `workflow.in_progress_status: "working"`); otherwise `in_progress` resolves through the registry's ids and aliases, and a workflow without one falls back to its open status instead of inventing a status it does not define. */
|
|
8
8
|
export declare function resolveStartTaskInProgressStatus(statusRegistry:RuntimeStatusRegistry):string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
1
|
+
(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f4c54507-c8b1-5f19-b58a-61186c79c8b0")}catch{}})();import{normalizeStatusInputWithRegistry}from"../core/schema/runtime-schema.js";function resolveStartTaskInProgressStatus(statusRegistry){return statusRegistry.in_progress_status!==statusRegistry.open_status&&statusRegistry.by_id.has(statusRegistry.in_progress_status)?statusRegistry.in_progress_status:normalizeStatusInputWithRegistry("in_progress",statusRegistry)??statusRegistry.open_status}export{resolveStartTaskInProgressStatus};
|
|
2
2
|
//# sourceMappingURL=start-task-status.js.map
|
|
@@ -29,6 +29,16 @@ The annotation SDK still supports its explicit `text:` and `text=` structured
|
|
|
29
29
|
input syntax. Files and standard input remain literal text sources. Other
|
|
30
30
|
commands retain their supported bare-key option normalization.
|
|
31
31
|
|
|
32
|
+
Inside a prose value such as `text=`, `note=` or `body=`, a comma followed by
|
|
33
|
+
another `=` or `:` opens a new key only when the token before it is
|
|
34
|
+
identifier-shaped (`[A-Za-z0-9_.-]+`). So `text=(a, b) c. Related: d` is
|
|
35
|
+
recorded as `(a, b) c. Related: d`
|
|
36
|
+
([pm-fr10t8](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-fr10t8.toon),
|
|
37
|
+
a repository-only tracker record excluded from npm). Quote the value
|
|
38
|
+
(`text="hello, world: big"`) to embed an identifier-shaped `key:` token. A seed
|
|
39
|
+
that carries an unsupported identifier-shaped key keeps its raw entry
|
|
40
|
+
losslessly.
|
|
41
|
+
|
|
32
42
|
## Consistent history validation
|
|
33
43
|
|
|
34
44
|
Validation first scans the captured corpus. An ordinary writer can advance an
|
package/docs/AGENT_GUIDE.md
CHANGED
|
@@ -7,7 +7,7 @@ This guide is optimized for coding agents that need to understand and mutate rep
|
|
|
7
7
|
Run this before heavy work. The first call is the canonical cold start. Then run the request-specific duplicate and ownership checks before item mutation:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
pm context --
|
|
10
|
+
pm context --for orient
|
|
11
11
|
pm search "<request keywords>" --limit 10
|
|
12
12
|
pm list --status open --limit 20
|
|
13
13
|
pm list --status in_progress --limit 20
|
|
@@ -33,7 +33,7 @@ Tracked documentation work: [pm-u9d0](../.agents/pm/epics/pm-u9d0.toon).
|
|
|
33
33
|
1. **Orient**
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
|
-
pm context --
|
|
36
|
+
pm context --for orient
|
|
37
37
|
pm search "<keywords>" --limit 10
|
|
38
38
|
pm list --status open --limit 20
|
|
39
39
|
pm list --status in_progress --limit 20
|
|
@@ -128,7 +128,7 @@ tests compare complete history bytes while the unrelated tracker's claims change
|
|
|
128
128
|
| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
129
129
|
| The single next action + why | `pm next` (concrete ready leaves first; completed-container closeout rows surface only when no leaf work is ready; `--ready-only` for the tightest output) |
|
|
130
130
|
| Next ready work in one epic | `pm next --parent <id>` |
|
|
131
|
-
| Canonical cold-start orientation | `pm context --
|
|
131
|
+
| Canonical cold-start orientation | `pm context --for orient` (1,055 estimated tokens on the fixed 101-item replay corpus) |
|
|
132
132
|
| Next work and agenda | `pm context --limit 10` |
|
|
133
133
|
| Comprehensive whole-tracker snapshot | `pm context --depth full` (every section, no per-section row cap) |
|
|
134
134
|
| Status of one epic/subtree | `pm context --parent <id> --depth deep` |
|
package/docs/COMMANDS.md
CHANGED
|
@@ -919,6 +919,7 @@ Lifecycle composition flags combine claim, status, and close operations:
|
|
|
919
919
|
|
|
920
920
|
```bash
|
|
921
921
|
pm claim <id> --start # claim + move to the configured in-progress status
|
|
922
|
+
pm claim --next --start # select the next available item, then claim and start it in one locked write
|
|
922
923
|
pm release <id> --pause # move to the configured open status + release claim
|
|
923
924
|
pm close <id> "<reason>" --release-assignment # close with evidence + release assignment
|
|
924
925
|
```
|
|
@@ -23,7 +23,7 @@ results, exit codes, and SDK behavior.
|
|
|
23
23
|
| `pm ops normalize` | `pm normalize` | Normalize through an active governance package |
|
|
24
24
|
| `pm history events` | `pm events` | Read or follow committed mutation events |
|
|
25
25
|
|
|
26
|
-
`pm context --
|
|
26
|
+
`pm context --for orient` still produces a context snapshot.
|
|
27
27
|
`pm history <id> --verify` still reads and verifies one item's history.
|
|
28
28
|
Namespace leaves do not change either default operation.
|
|
29
29
|
|
package/docs/CONFIGURATION.md
CHANGED
|
@@ -69,6 +69,15 @@ When `settings.json` cannot be loaded, `pm` falls back to built-in defaults and
|
|
|
69
69
|
|
|
70
70
|
If the existing project `settings.json` has invalid JSON, a configuration write refuses with `settings_write_invalid_existing_json`. It leaves the file and workspace history untouched. Repair the syntax in `.agents/pm/settings.json`, run `pm health`, then retry the configuration command. The read fallback to defaults does not authorize replacing malformed settings.
|
|
71
71
|
|
|
72
|
+
If the existing `settings.json` is valid JSON but fails schema validation (for example an unknown enum value), a configuration write never replaces the file with the defaults fallback ([pm-4zpq71](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-4zpq71.toon), a repository-only tracker record excluded from npm):
|
|
73
|
+
|
|
74
|
+
- **The write applies only its own change.** It changes the stored document, and every unrelated stored key is kept. `pm config project set context.next_ranking_policy weighted` repairs that field this way.
|
|
75
|
+
- **Every `pm config` setter repairs its own fields, even to the default value.** Each setter assigns the settings paths it writes, so a value that equals the default still replaces the invalid stored value. This applies to `pm config <scope> set <dotted.key>`, the policy and governance setters, `context` and `item_format`. A key that is serialized only when it differs from the default, such as `governance.require_close_reason`, is removed from the stored document. A cleared value, such as an empty `governance_create_default_type`, is removed the same way. A successful repair reports `changed: true`.
|
|
76
|
+
- **A write that would still be invalid refuses.** It refuses with `settings_write_invalid_existing_schema` and changes nothing. `context.field` names the first invalid setting as a dotted path, for example `context.next_ranking_policy`. A setter that keeps the default of a different invalid field refuses rather than reporting a silent `changed: false`.
|
|
77
|
+
- **`pm config set item_format` repairs settings before it migrates items.** Over an unreadable document it writes the settings first, so a document that would stay invalid refuses before any item file is touched. It then migrates items with the repaired document's own schema and type folders.
|
|
78
|
+
- **SDK writers follow the same rule.** This covers every writer that writes a settings object returned by `readSettings`. A snapshot cannot tell an assignment equal to the default from an untouched field, so an SDK repair to the default passes the path explicitly: `writeSettings(pmRoot, settings, op, { assignedPaths: ["context.next_ranking_policy"] })`. Without `assignedPaths` such a write refuses with the field named rather than claiming success. An empty, reserved (`__proto__`, `constructor`, `prototype`) or non-identifier path segment refuses with `settings_write_assigned_path_invalid`. A record key that itself contains a dot cannot be addressed; repair it in `settings.json`.
|
|
79
|
+
- **Automatic writes never act on a fallback.** The mutation preflight's `item_format` pin and its pre-mutation format migration are skipped while the document is unreadable. So are the telemetry installation identity and the first-run consent prompt. The command runs on the defaults with the warning. Package code can check `isSettingsReadFallback(settings)` from `@unbrained/pm-cli/sdk` before an unrequested write.
|
|
80
|
+
|
|
72
81
|
## Common Settings
|
|
73
82
|
|
|
74
83
|
| Setting | Purpose |
|
|
@@ -73,8 +73,10 @@ route.
|
|
|
73
73
|
|
|
74
74
|
The retained hosted OSV receipt identified both advisories while the registry
|
|
75
75
|
audit returned zero. Keep full-lock admission mandatory and verify the patched
|
|
76
|
-
graph against both feeds.
|
|
77
|
-
|
|
76
|
+
graph against both feeds. That patch kept Vitest 4 because CodSpeed 5.7.1 did not
|
|
77
|
+
accept Vitest 5. [pm-fokyhh](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-fokyhh.toon) (repository-only tracker record excluded from npm) later adopted
|
|
78
|
+
the Vitest 5.0.5 pair with CodSpeed 6.1.0; `@vitest/mocker` 5.0.3 and later carry
|
|
79
|
+
both fixes, and the Vite 7 override is unchanged. The
|
|
78
80
|
installed-handler regressions run in coverage and the required native Windows
|
|
79
81
|
cohort, whose aggregate refuses failed, canceled or skipped partitions. The
|
|
80
82
|
October 15 patch releases meet pnpm's one-day minimum age on October 21 without
|
|
@@ -156,14 +158,14 @@ inferred, which hid the real cause (a non-empty registry id list); read
|
|
|
156
158
|
`.cache/dependency-security/receipt.json` before treating that message as a
|
|
157
159
|
feed outage.
|
|
158
160
|
|
|
159
|
-
## CodSpeed
|
|
161
|
+
## CodSpeed 6.1.0 patch
|
|
160
162
|
|
|
161
163
|
CodSpeed's declared dependency previously resolved Axios 1.19.0, and both
|
|
162
164
|
`@codspeed/core` bundles embedded Axios 1.4.0. Updating the declared dependency
|
|
163
165
|
alone leaves those embedded implementations and their source-map contents
|
|
164
166
|
intact. The pnpm override selects Axios 1.20.0 or a newer compatible 1.x
|
|
165
167
|
release that satisfies the normal dependency cooldown. The exact-version
|
|
166
|
-
patch in [the patch file](../patches/@codspeed__core@
|
|
168
|
+
patch in [the patch file](../patches/@codspeed__core@6.1.0.patch) replaces the
|
|
167
169
|
embedded dependency section in both CJS and ESM entries with imports of the
|
|
168
170
|
declared `axios` and `form-data` packages. Each entry creates its own Axios
|
|
169
171
|
client and retains the cancellation constructor, preserving isolation from
|
|
@@ -174,8 +176,9 @@ immediately before `var __defProp$3 = Object.defineProperty`. Only `axios` and
|
|
|
174
176
|
`FormData$2` from that section are referenced by the retained code. The patch
|
|
175
177
|
preserves the preceding and following benchmark code, declarations, export
|
|
176
178
|
surface and native binaries. Each entry removes 19,201 embedded lines. Its map
|
|
177
|
-
retains 5,
|
|
178
|
-
inventory from 131 to 21.
|
|
179
|
+
retains 5,293 mappings, removes 39,536 obsolete mappings, and reduces its source
|
|
180
|
+
inventory from 131 to 21. The 6.1.0 port keeps the same boundary; upstream added
|
|
181
|
+
four Node-version warning exports, so the runtime suite pins 30 exports. Remaining generated positions are shifted by the
|
|
179
182
|
replacement's line delta; their original source, line, column and names are
|
|
180
183
|
preserved. Removed Axios, redirects, proxy and form-data sources are absent.
|
|
181
184
|
Both maps end with a newline; the integrity policy records the installed bytes.
|
|
@@ -33,9 +33,22 @@ stdin selection, dry runs, rollback behavior, and evidence flags. Put bulk flags
|
|
|
33
33
|
after `many`. Deletion recovery remains `pm history restore <id> <version>`.
|
|
34
34
|
|
|
35
35
|
Plain `claim`, `release`, `update`, and `close` keep their original semantics.
|
|
36
|
-
`claim --start`
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
`claim <id> --start` rejects `--if-available` before mutation. It claims
|
|
37
|
+
ownership, then moves the item to the configured in-progress status.
|
|
38
|
+
`claim --next --start` selects the next caller-available item with the same
|
|
39
|
+
filters, `--if-available` behavior, and race-loss walk as `claim --next`.
|
|
40
|
+
Ranking happens before any lock, so a candidate can change before it is
|
|
41
|
+
claimed. Each attempt re-reads the candidate under its item lock and then
|
|
42
|
+
claims it and moves it to the configured in-progress status in one locked
|
|
43
|
+
mutation and one `claim` history event. No other agent can therefore observe
|
|
44
|
+
the claimed item before it starts. Configured type workflows are enforced, a
|
|
45
|
+
terminal candidate is refused (`terminal_state_conflict`), and the receipt
|
|
46
|
+
carries `start: { from_status, to_status }`. A claim without an id or `--next`
|
|
47
|
+
is refused with `missing_required_argument`, and `claim <id> --next` with
|
|
48
|
+
`ambiguous_option_combination`; their next steps never tell the caller to pass
|
|
49
|
+
a flag that is already present. `claim <id> --start --next` (or
|
|
50
|
+
`--if-available`) is refused by the explicit-start composition with
|
|
51
|
+
`invalid_argument_value`, whose recovery names the flags to remove. `release --pause` moves work to the configured
|
|
39
52
|
open status, then releases ownership. `close --release-assignment` records the
|
|
40
53
|
close and its inline evidence, then releases ownership.
|
|
41
54
|
|
|
@@ -67,6 +80,7 @@ import { PmClient } from "@unbrained/pm-cli/sdk";
|
|
|
67
80
|
|
|
68
81
|
const pm = new PmClient({ pmRoot: "/project/.agents/pm" });
|
|
69
82
|
const started = await pm.claim("pm-example", { start: true });
|
|
83
|
+
const nextStarted = await pm.claimNext({ start: true }); // ranked selection, then one locked claim-and-start write
|
|
70
84
|
const paused = await pm.release("pm-example", { pause: true });
|
|
71
85
|
const closed = await pm.close("pm-example", "Acceptance verified", {
|
|
72
86
|
releaseAssignment: true,
|
|
@@ -84,7 +98,8 @@ Literal `true` options return typed `StartTaskResult`, `PauseTaskResult`, or
|
|
|
84
98
|
`runCloseTask` primitives expose the same SDK-owned compositions.
|
|
85
99
|
|
|
86
100
|
MCP actions remain `claim`, `release`, and `close`, using `start`, `pause`, and
|
|
87
|
-
`releaseAssignment`.
|
|
101
|
+
`releaseAssignment`. MCP `claim` with `next: true` and `start: true` uses the
|
|
102
|
+
same ranked selection and single locked claim-and-start write as `claim --next --start`. Action-specific discovery types claim's `start` as boolean;
|
|
88
103
|
scheduling actions retain string timestamps. For the broad provider tool schema,
|
|
89
104
|
pass the claim boolean through `options: { start: true }` because its shared flat
|
|
90
105
|
`start` property retains the scheduling string contract. Bulk action names remain
|
package/docs/RELEASING.md
CHANGED
|
@@ -317,8 +317,18 @@ installed-version verification. [pm-iceees](../.agents/pm/issues/pm-iceees.toon)
|
|
|
317
317
|
keeps selected optional-peer subtrees complete: npm deliberately skips peer edges
|
|
318
318
|
when gathering bundled files, so staged runtime manifests record the exact tested
|
|
319
319
|
peer bindings as ordinary or optional dependency entries. Package code, source
|
|
320
|
-
and installed manifests, peer declarations
|
|
321
|
-
|
|
320
|
+
and installed manifests, and peer declarations remain intact.
|
|
321
|
+
[pm-2csj4k](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-2csj4k.toon) (repository-only tracker record excluded from npm) adds one root entry per required
|
|
322
|
+
peer: Bun installs resolve a package's dependencies from the registry instead of
|
|
323
|
+
its `bundleDependencies`, so the published root manifest pins every non-optional
|
|
324
|
+
peer target that the ledger installs at the root to its tested version and
|
|
325
|
+
bundles it. A peer resolved only in a nested `node_modules` is not pinned,
|
|
326
|
+
because the root manifest may name only root-installed packages, which the
|
|
327
|
+
installed-runtime verifier enforces. Without the pin,
|
|
328
|
+
`@sentry/node`'s `@opentelemetry/api ^1.9.1` resolved to 1.10.0 and Bun warned
|
|
329
|
+
against the bundled OpenTelemetry packages' `<1.10.0` peer ranges. Optional-only
|
|
330
|
+
peers and direct dependencies are unchanged, and the packed smoke runs a verbose
|
|
331
|
+
`bun add` and fails on any peer-range warning. A real archive regression resolves the peer's descendant
|
|
322
332
|
from an extracted package and the installed-runtime verifier still refuses any
|
|
323
333
|
missing locked package. npm 12 ignores published shrinkwraps; shipping
|
|
324
334
|
a shrinkwrap alone therefore cannot enforce this contract. SDK consumers
|
|
@@ -467,6 +477,16 @@ contents, comments, JSDoc, symbols and module boundaries retain their original
|
|
|
467
477
|
tokens. Source declarations remain readable, and packed TypeScript consumers
|
|
468
478
|
verify the emitted surface before publication. Artifact ceilings remain unchanged.
|
|
469
479
|
|
|
480
|
+
The generated error-code catalog ships as compact rows
|
|
481
|
+
([pm-998juj](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/tasks/pm-998juj.toon), a repository-only tracker record excluded from npm).
|
|
482
|
+
`scripts/generate-error-code-catalog.mjs` omits every derivable field: the
|
|
483
|
+
meaning sentence, the class implied by the exit code, the shared recovery
|
|
484
|
+
guidance, provisional stability, every-command emitters, a self canonical code
|
|
485
|
+
and empty aliases. `expandPmErrorCodeCatalogRows` restores them at load time,
|
|
486
|
+
so `PM_ERROR_CODE_CATALOG` and every serialized projection stay byte-identical.
|
|
487
|
+
The catalog appears once in the tsc emit and once in each CLI bundle, and the
|
|
488
|
+
compact rows removed about 320 KB from the packed distribution.
|
|
489
|
+
|
|
470
490
|
5. Land the implementation through a reviewed pull request, then use hosted
|
|
471
491
|
preparation for publication.
|
|
472
492
|
|
package/docs/SDK.md
CHANGED
|
@@ -328,6 +328,32 @@ try {
|
|
|
328
328
|
}
|
|
329
329
|
```
|
|
330
330
|
|
|
331
|
+
Locks are confined to the tracker
|
|
332
|
+
([pm-gh1647](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1647.toon),
|
|
333
|
+
a repository-only tracker record excluded from npm). The built-in provider
|
|
334
|
+
never follows a symlink below the tracker root. If `locks/` or any other
|
|
335
|
+
component between the tracker root and the lock entry is a symlink or not a
|
|
336
|
+
directory, or the lock entry itself is a symlink, `acquireLock` and
|
|
337
|
+
`acquireLockLease` refuse with `lock_path_unsafe` (exit 4). A regular-file lock
|
|
338
|
+
entry is a peer's lock, not a refusal. The refusal carries `context.reason`
|
|
339
|
+
(`lock_directory_symlink`, `lock_directory_not_directory`,
|
|
340
|
+
`lock_entry_symlink` or `lock_path_outside_tracker`), the tracker-relative
|
|
341
|
+
`context.lock_component`, and `context.required` recovery text for that reason.
|
|
342
|
+
For these four reasons nothing is created outside the tracker and no cleanup
|
|
343
|
+
gate remains. After creating the lock file, the provider checks that the new
|
|
344
|
+
file is the confined entry in the directory it inspected. A directory swapped
|
|
345
|
+
during acquisition refuses with the same `lock_path_unsafe` code and the
|
|
346
|
+
fifth reason, `lock_directory_replaced`, with `context.lock_component` naming
|
|
347
|
+
the replaced tracker-relative directory, and the lease is never returned.
|
|
348
|
+
The lock file created through the swapped directory stays where the swap
|
|
349
|
+
pointed, which can be outside the tracker, and a cleanup gate
|
|
350
|
+
created before the swap can stay in the displaced directory. pm never deletes
|
|
351
|
+
outside the tracker: Node has no descriptor-relative unlink, so a path-based
|
|
352
|
+
delete could remove a same-name replacement. `pm gc --scope locks`
|
|
353
|
+
applies the same check and refuses to sweep through a symlinked `locks/`
|
|
354
|
+
directory. The tracker root itself may be a symlink: confinement is relative to
|
|
355
|
+
the root you pass.
|
|
356
|
+
|
|
331
357
|
See
|
|
332
358
|
[Configuration](CONFIGURATION.md#common-settings) for host identity, local
|
|
333
359
|
recovery audit receipts and `PM_LOCK_WAIT_MS` precedence. Extension lock
|
|
@@ -657,7 +683,8 @@ for policies, work ceilings and refusal contracts, tracked by
|
|
|
657
683
|
Session receipts now advertise `pm get <item-id> --depth brief`; the
|
|
658
684
|
`restore_reference_with` literal type changes accordingly. Hosts constructing
|
|
659
685
|
`ExtensionCommandSdk` implementations must supply `fitOutputEnvelope` from the
|
|
660
|
-
public SDK
|
|
686
|
+
public SDK, plus `readSettingsSection` and `writeSettingsSection` bound to the
|
|
687
|
+
invocation tracker; host-created command contexts already provide all three.
|
|
661
688
|
|
|
662
689
|
Tracked by [pm-5t33or](../.agents/pm/features/pm-5t33or.toon),
|
|
663
690
|
[pm-gmdzaa](../.agents/pm/issues/pm-gmdzaa.toon), and
|
|
@@ -2140,7 +2167,15 @@ Custom agent hosts can import `projectPmBriefListEnvelope` from
|
|
|
2140
2167
|
`@unbrained/pm-cli/sdk` to apply the same brief-list presentation without
|
|
2141
2168
|
mutating the original result. It retains unchecked source status and actionable
|
|
2142
2169
|
continuation, and leaves partial, custom, or inconsistent envelopes intact.
|
|
2143
|
-
|
|
2170
|
+
`projectPmBriefSearchEnvelope` does the same for search pages. It drops
|
|
2171
|
+
`truncated` when it repeats `has_more` and a `filters.limit` echo of
|
|
2172
|
+
`applied_limit`, and it replaces the single default `projection_metadata`
|
|
2173
|
+
omission receipt with `details: "--full"`. For flat default lists, the list
|
|
2174
|
+
projection replaces the default ascending sort's legacy `sort`/`order` echo with
|
|
2175
|
+
one `effective_keys` comparator line, so the effective default order stays
|
|
2176
|
+
visible. Tree-mode lists carry no `effective_keys`, because hierarchy traversal
|
|
2177
|
+
overrides flat ordering; there the default sort echo is simply omitted.
|
|
2178
|
+
The CLI applies these projections only to TOON; ordinary JSON and SDK query
|
|
2144
2179
|
results retain their complete contracts. The public `encodePmTableRows` and
|
|
2145
2180
|
`decodePmTableRows` primitives distinguish explicit null and empty cells from
|
|
2146
2181
|
missing keys. TOON rendering preserves those row facts before selecting the
|
|
@@ -90,6 +90,27 @@ ceiling. For row-oriented `list` and `search` intents, pm reports:
|
|
|
90
90
|
- `binding_constraint` as `token_budget` or `explicit_limit`;
|
|
91
91
|
- `limit_reason` with the selection rationale.
|
|
92
92
|
|
|
93
|
+
When the intent budget reduces an explicit `--limit`, as with
|
|
94
|
+
`pm context --for orient --limit 10` (the 3000-token orient budget carries 3
|
|
95
|
+
rows), the reduction is never silent. `context_intent.limit_override` records the
|
|
96
|
+
reduced `flag` (`"--limit"`), `requested`, `effective`, the
|
|
97
|
+
`token_budget_for_requested` that would carry the
|
|
98
|
+
request, and `restore_with`: the flag to add to (or replace in) the original
|
|
99
|
+
command, so every original positional, inline filter, and option is kept. Both
|
|
100
|
+
fields are omitted when no safe-integer budget can carry the request. `filters.requested_limit` sits beside the
|
|
101
|
+
effective `filters.limit`, and `warnings` carries
|
|
102
|
+
`limit_overridden_by_intent:--limit <requested>-><effective>`. The same applies
|
|
103
|
+
to `context`, `list`, and `search` intents.
|
|
104
|
+
|
|
105
|
+
MCP read tools (`pm_context`, `pm_get`, `pm_list`, `pm_next`, `pm_search`)
|
|
106
|
+
accept every optional parameter their action contract declares either flat or
|
|
107
|
+
under `options`. The runtime derives the flat-to-options mapping from
|
|
108
|
+
`PM_TOOL_ACTION_PARAMETER_CONTRACTS`, so a declared argument such as `for`,
|
|
109
|
+
`depth`, `limit`, or `tokenBudget` is never silently ignored; nested `options`
|
|
110
|
+
win when both are present. Positional operands stay top-level like `pm_get`'s
|
|
111
|
+
`id`: `pm_search` reads `query` (or its declared alias `keywords`) only from the
|
|
112
|
+
top-level arguments.
|
|
113
|
+
|
|
93
114
|
Default intent budgets retain the ordinary page cap. Explicit budgets may
|
|
94
115
|
derive larger pages; recursive compaction and resumable cursor safeguards still
|
|
95
116
|
enforce the final serialized token ceiling.
|