@unbrained/pm-cli 2026.11.15 → 2026.11.16

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.
Files changed (181) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/cli/error-guidance.js +2 -2
  3. package/dist/cli/help-content.js +2 -2
  4. package/dist/cli/register-operations.js +1 -1
  5. package/dist/cli-bundle/bundle-manifest.json +1 -1
  6. package/dist/cli-bundle/chunks/{chunk-TESRFVGF.js → chunk-2D26HRXB.js} +2 -2
  7. package/dist/cli-bundle/chunks/{chunk-VWKLTHYQ.js → chunk-2WNORBVN.js} +36 -25
  8. package/dist/cli-bundle/chunks/{chunk-J6L3Q5J4.js → chunk-4I7YG3VZ.js} +2 -2
  9. package/dist/cli-bundle/chunks/{chunk-QZNDEZYI.js → chunk-4WIVCOA7.js} +2 -2
  10. package/dist/cli-bundle/chunks/chunk-A3WCP4TU.js +6 -0
  11. package/dist/cli-bundle/chunks/chunk-AB5S6TWE.js +124 -0
  12. package/dist/cli-bundle/chunks/{chunk-KLWGIEDC.js → chunk-BV7J3LRH.js} +3 -3
  13. package/dist/cli-bundle/chunks/{chunk-GCSKHCYK.js → chunk-DZWRNL6R.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-KSLPRST2.js → chunk-E4BQRZF2.js} +3 -3
  15. package/dist/cli-bundle/chunks/chunk-ERD2RYWM.js +31 -0
  16. package/dist/cli-bundle/chunks/chunk-F7P42FL5.js +9 -0
  17. package/dist/cli-bundle/chunks/{chunk-E4B2HWH7.js → chunk-FZ4XWWLO.js} +23 -23
  18. package/dist/cli-bundle/chunks/{chunk-7AODVNHX.js → chunk-I3T2FVUA.js} +2 -2
  19. package/dist/cli-bundle/chunks/{chunk-PMIGRSNZ.js → chunk-IGEBFNWE.js} +2 -2
  20. package/dist/cli-bundle/chunks/{chunk-YLPZE2TK.js → chunk-IYICNCK2.js} +2 -2
  21. package/dist/cli-bundle/chunks/chunk-J257NZRD.js +20 -0
  22. package/dist/cli-bundle/chunks/{chunk-Q6GBRK27.js → chunk-JD3XWF66.js} +2 -2
  23. package/dist/cli-bundle/chunks/{chunk-FSE624WQ.js → chunk-JLHD7OQ2.js} +2 -2
  24. package/dist/cli-bundle/chunks/{chunk-DBUBX4DL.js → chunk-KGOGLKL2.js} +2 -2
  25. package/dist/cli-bundle/chunks/{chunk-ZWUS65LN.js → chunk-LC4DJVXR.js} +2 -2
  26. package/dist/cli-bundle/chunks/{chunk-LC6DL446.js → chunk-NHNM3GIP.js} +2 -2
  27. package/dist/cli-bundle/chunks/{chunk-ZVDXGAYV.js → chunk-NYN5OR2T.js} +2 -2
  28. package/dist/cli-bundle/chunks/{chunk-6UTBX62V.js → chunk-OFZQEQ6X.js} +2 -2
  29. package/dist/cli-bundle/chunks/{chunk-GAFALSR2.js → chunk-QGL5IAP4.js} +3 -3
  30. package/dist/cli-bundle/chunks/{chunk-HMVZSXB4.js → chunk-R24NZ2TB.js} +2 -2
  31. package/dist/cli-bundle/chunks/{chunk-S5UXBECQ.js → chunk-VJLZHOTP.js} +2 -2
  32. package/dist/cli-bundle/chunks/{chunk-YJNY5MKP.js → chunk-VO2HSB5F.js} +2 -2
  33. package/dist/cli-bundle/chunks/{indexed-receipt-blobs-42Y2CSEQ.js → indexed-receipt-blobs-HNLN6UXH.js} +2 -2
  34. package/dist/cli-bundle/chunks/{item-revision-JCEDTAVX.js → item-revision-PSOL5I4H.js} +2 -2
  35. package/dist/cli-bundle/chunks/item-transaction-55QTCU2M.js +2 -0
  36. package/dist/cli-bundle/chunks/{mutation-actor-IQHBRFAJ.js → mutation-actor-BDBBH3ZS.js} +2 -2
  37. package/dist/cli-bundle/chunks/{mutation-admission-DF6BFGG6.js → mutation-admission-WUN7JYVJ.js} +2 -2
  38. package/dist/cli-bundle/chunks/{register-list-query-DNKPQB76.js → register-list-query-AESCVO6H.js} +2 -2
  39. package/dist/cli-bundle/chunks/{register-mutation-WVTDFLEF.js → register-mutation-SKCEP5QU.js} +2 -2
  40. package/dist/cli-bundle/chunks/register-operations-ZT4OYCF3.js +2 -0
  41. package/dist/cli-bundle/chunks/{register-setup-2RTG3LII.js → register-setup-JVWNS2TY.js} +2 -2
  42. package/dist/cli-bundle/chunks/{settlement-hook-W5ULPKIE.js → settlement-hook-MVVVUIVZ.js} +2 -2
  43. package/dist/cli-bundle/chunks/{stage-YFNK7U26.js → stage-RMU3JAWM.js} +2 -2
  44. package/dist/cli-bundle/focused-chunks/{chunk-YZUBG4W2.js → chunk-3WVMEA2A.js} +3 -3
  45. package/dist/cli-bundle/focused-chunks/{chunk-CZZKAGHE.js → chunk-5UVJOAUP.js} +6 -6
  46. package/dist/cli-bundle/focused-chunks/{chunk-EALGFJRP.js → chunk-5WQ3LNUK.js} +3 -3
  47. package/dist/cli-bundle/focused-chunks/chunk-6E4X7MQA.js +26 -0
  48. package/dist/cli-bundle/focused-chunks/{chunk-JE3MFEQZ.js → chunk-7SEPCQV2.js} +2 -2
  49. package/dist/cli-bundle/focused-chunks/{chunk-XQZKGTZV.js → chunk-7XHE335U.js} +2 -2
  50. package/dist/cli-bundle/focused-chunks/{chunk-52H6AELE.js → chunk-BEHIMEV2.js} +2 -2
  51. package/dist/cli-bundle/focused-chunks/{chunk-JXA77YIV.js → chunk-CZFZCSOX.js} +2 -2
  52. package/dist/cli-bundle/focused-chunks/{chunk-W2KIQ7RF.js → chunk-DFBHW7HP.js} +3 -3
  53. package/dist/cli-bundle/focused-chunks/{chunk-WGYR3X6O.js → chunk-DZMP3VYQ.js} +2 -2
  54. package/dist/cli-bundle/focused-chunks/chunk-HHMMIHZP.js +2 -0
  55. package/dist/cli-bundle/focused-chunks/{chunk-LSWUTTE6.js → chunk-HPC2M6JD.js} +2 -2
  56. package/dist/cli-bundle/focused-chunks/{chunk-2UQFFVQK.js → chunk-HR5FEUUL.js} +2 -2
  57. package/dist/cli-bundle/focused-chunks/{chunk-S6GTALM4.js → chunk-J7ESCE7M.js} +3 -3
  58. package/dist/cli-bundle/focused-chunks/chunk-KRNF3WTC.js +3 -0
  59. package/dist/cli-bundle/focused-chunks/{chunk-DXMQ32EH.js → chunk-KWZLY35A.js} +2 -2
  60. package/dist/cli-bundle/focused-chunks/{chunk-Z6HCQYSW.js → chunk-M4IA4LC6.js} +2 -2
  61. package/dist/cli-bundle/focused-chunks/{chunk-YTNUUEY6.js → chunk-NASE6JC2.js} +2 -2
  62. package/dist/cli-bundle/focused-chunks/chunk-ONM2R32I.js +65 -0
  63. package/dist/cli-bundle/focused-chunks/{chunk-QXOFSZR6.js → chunk-PDXSMSO5.js} +2 -2
  64. package/dist/cli-bundle/focused-chunks/{chunk-BSY6FZ3Y.js → chunk-PEL4SQXV.js} +2 -2
  65. package/dist/cli-bundle/focused-chunks/{chunk-DRBXOAGY.js → chunk-QJ647CQE.js} +2 -2
  66. package/dist/cli-bundle/focused-chunks/chunk-SFATIM77.js +12 -0
  67. package/dist/cli-bundle/focused-chunks/{chunk-7GCAZJT4.js → chunk-UBBTBNUY.js} +2 -2
  68. package/dist/cli-bundle/focused-chunks/{chunk-UPUIDGNJ.js → chunk-ZCN35TCK.js} +2 -2
  69. package/dist/cli-bundle/focused-chunks/chunk-ZSQ2FT22.js +44 -0
  70. package/dist/cli-bundle/focused-chunks/{indexed-receipt-blobs-LSBWMXKS.js → indexed-receipt-blobs-ADMQXF3N.js} +2 -2
  71. package/dist/cli-bundle/focused-chunks/{item-revision-YO7YGQYE.js → item-revision-GNKYO6GZ.js} +2 -2
  72. package/dist/cli-bundle/focused-chunks/{item-transaction-7A3Q4CAJ.js → item-transaction-AUUQHR5Z.js} +2 -2
  73. package/dist/cli-bundle/focused-chunks/{mutation-actor-UQHBNHOF.js → mutation-actor-OBRD7HFZ.js} +2 -2
  74. package/dist/cli-bundle/focused-chunks/{mutation-admission-G565NLPE.js → mutation-admission-6TX3EOJX.js} +2 -2
  75. package/dist/cli-bundle/focused-chunks/{settlement-hook-UXN76GMA.js → settlement-hook-5U2M75BY.js} +2 -2
  76. package/dist/cli-bundle/focused-chunks/{stage-F3YJGNRK.js → stage-LERF2YJU.js} +2 -2
  77. package/dist/cli-bundle/main.js +6 -6
  78. package/dist/cli-bundle/sdk-authoring.js +1 -1
  79. package/dist/cli-bundle/sdk-contracts.js +2 -2
  80. package/dist/cli-bundle/sdk-core.js +1 -1
  81. package/dist/cli-bundle/sdk-governance.js +1 -1
  82. package/dist/cli-bundle/sdk-graph.js +1 -1
  83. package/dist/cli-bundle/sdk-merge.js +57 -57
  84. package/dist/cli-bundle/sdk-query.js +1 -1
  85. package/dist/cli-bundle/sdk-runtime.js +1 -1
  86. package/dist/cli-bundle/sdk-testing.js +1 -1
  87. package/dist/cli-bundle/sdk.js +11 -11
  88. package/dist/core/diagnostics/remediation.js +1 -1
  89. package/dist/core/output/mutation-projection.js +1 -1
  90. package/dist/core/shared/errors.d.ts +22 -0
  91. package/dist/core/shared/errors.js +1 -1
  92. package/dist/core/store/item-store.d.ts +15 -4
  93. package/dist/core/store/item-store.js +1 -1
  94. package/dist/core/telemetry/policy.d.ts +21 -2
  95. package/dist/core/telemetry/policy.js +1 -1
  96. package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
  97. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -1
  98. package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
  99. package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
  100. package/dist/sdk/cli-contracts/tool-schema.js +1 -1
  101. package/dist/sdk/completion/bash.js +1 -1
  102. package/dist/sdk/completion/fish.js +2 -1
  103. package/dist/sdk/completion/zsh.js +12 -2
  104. package/dist/sdk/flag-invocation-contracts.js +1 -1
  105. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  106. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
  107. package/dist/sdk/governance/health.js +2 -2
  108. package/dist/sdk/governance/in-progress-work-health.d.ts +49 -0
  109. package/dist/sdk/governance/in-progress-work-health.js +2 -0
  110. package/dist/sdk/governance/stale-work.d.ts +143 -2
  111. package/dist/sdk/governance/stale-work.js +1 -1
  112. package/dist/sdk/governance.d.ts +1 -1
  113. package/dist/sdk/governance.js +1 -1
  114. package/dist/sdk/history-compact.js +1 -1
  115. package/dist/sdk/index.d.ts +1 -1
  116. package/dist/sdk/index.js +1 -1
  117. package/dist/sdk/lifecycle/claim.d.ts +46 -3
  118. package/dist/sdk/lifecycle/claim.js +1 -1
  119. package/dist/sdk/lifecycle/task-composition.js +1 -1
  120. package/dist/sdk/ownership-source.d.ts +32 -0
  121. package/dist/sdk/ownership-source.js +1 -1
  122. package/dist/sdk/public-surface.json +1 -1
  123. package/dist/sdk/query/context.d.ts +5 -1
  124. package/dist/sdk/query/context.js +2 -2
  125. package/dist/sdk/query/next.d.ts +19 -3
  126. package/dist/sdk/query/next.js +1 -1
  127. package/dist/sdk/runtime-input.js +1 -1
  128. package/dist/sdk/runtime-primitives.d.ts +1 -1
  129. package/dist/sdk/runtime-primitives.js +1 -1
  130. package/docs/AGENT_GUIDE.md +2 -0
  131. package/docs/COMMANDS.md +22 -0
  132. package/docs/CONFIGURATION.md +20 -7
  133. package/docs/LIFECYCLE_COMMANDS.md +8 -1
  134. package/docs/MUTATION_INTEGRITY.md +79 -1
  135. package/docs/SDK.md +28 -0
  136. package/docs/generated/FLAG_LEXICON_BUDGETS.md +2 -2
  137. package/marketplace.json +1 -1
  138. package/node_modules/commander/Readme.md +6 -32
  139. package/node_modules/commander/index.js +1 -1
  140. package/node_modules/commander/lib/command.js +22 -9
  141. package/node_modules/commander/lib/help.js +6 -2
  142. package/node_modules/commander/lib/option.js +1 -1
  143. package/node_modules/commander/package.json +2 -1
  144. package/node_modules/commander/typings/index.d.ts +6 -3
  145. package/node_modules/semver/classes/range.js +2 -2
  146. package/node_modules/semver/internal/constants.js +30 -0
  147. package/node_modules/semver/internal/trim-comparator-whitespace.js +438 -0
  148. package/node_modules/semver/package.json +1 -1
  149. package/package.json +3 -3
  150. package/packages/pm-beads/package.json +1 -1
  151. package/packages/pm-calendar/package.json +1 -1
  152. package/packages/pm-command-kit/package.json +1 -1
  153. package/packages/pm-digital-twin/package.json +1 -1
  154. package/packages/pm-governance-audit/package.json +1 -1
  155. package/packages/pm-guide-shell/package.json +1 -1
  156. package/packages/pm-kanban/package.json +1 -1
  157. package/packages/pm-lifecycle-hooks/package.json +1 -1
  158. package/packages/pm-linked-test-adapters/package.json +1 -1
  159. package/packages/pm-search-advanced/package.json +1 -1
  160. package/packages/pm-templates/package.json +1 -1
  161. package/packages/pm-todos/package.json +1 -1
  162. package/packages/pm-vcs/package.json +1 -1
  163. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  164. package/plugins/pm-claude/package.json +1 -1
  165. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  166. package/plugins/pm-codex/package.json +1 -1
  167. package/plugins/pm-codex/plugin.json +1 -1
  168. package/runtime-dependencies.json +1 -1
  169. package/dist/cli-bundle/chunks/chunk-ASGAELBQ.js +0 -9
  170. package/dist/cli-bundle/chunks/chunk-E74OMFBZ.js +0 -6
  171. package/dist/cli-bundle/chunks/chunk-FYOIH56R.js +0 -20
  172. package/dist/cli-bundle/chunks/chunk-IXV5UM4U.js +0 -31
  173. package/dist/cli-bundle/chunks/chunk-NAX554KY.js +0 -124
  174. package/dist/cli-bundle/chunks/item-transaction-BSMGKZ4S.js +0 -2
  175. package/dist/cli-bundle/chunks/register-operations-NR5MTT5T.js +0 -2
  176. package/dist/cli-bundle/focused-chunks/chunk-63FM3TIG.js +0 -26
  177. package/dist/cli-bundle/focused-chunks/chunk-FK2X6MJY.js +0 -44
  178. package/dist/cli-bundle/focused-chunks/chunk-JRRHN2PZ.js +0 -12
  179. package/dist/cli-bundle/focused-chunks/chunk-LQZ5F6LE.js +0 -3
  180. package/dist/cli-bundle/focused-chunks/chunk-RMCODWHZ.js +0 -65
  181. package/dist/cli-bundle/focused-chunks/chunk-WVYXR3YX.js +0 -2
@@ -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]="6b1f17f6-0bde-5194-9b7d-ac71988e5886")}catch{}})();import{assertSchemaPreviewSupported}from"./runtime/schema-preview.js";import{resolveLinkedResourcePositionalRecovery}from"./agent/linked-resource-recovery.js";import{parseExtensionLongFlagToken,resolveExtensionLongFlagName}from"../core/extensions/flag-definition-validation.js";import{createCheckpointId,loadMutationCheckpoint,restoreCheckpointItems,writeMutationCheckpoint}from"../core/checkpoint/mutation-checkpoint.js";import{describeFlagScalarValueFailure,flattenFlagListValue,resolveExtensionFlagValueContract,resolveFlagValueKind}from"../core/extensions/flag-value-types.js";import{createUnknownSubcommandError}from"./agent/subcommand-recovery.js";import{activateExtensions,clearActiveExtensionHooks,consumeAfterCommandAffectedItems,createCoreCommandHookContext,createEmptyExtensionRegistrationRegistry,discoverExtensions,getActiveCommandResult,getActiveExtensionRegistrations,loadExtensions,projectAfterCommandItemSnapshot,recordAfterCommandAffectedItem,resetActiveExtensionRuntimeState,runActiveCommandHandler,runActiveBeforeMutationHooks,runActiveOnIndexHooks,runActiveOnReadHooks,runActiveOnWriteHooks,runActiveParserOverride,runActivePreflightOverride,runActiveServiceOverride,runAfterCommandHooks,runBeforeCommandHooks,setActiveCommandContext,setActiveCommandResult,setActiveExtensionCommands,setActiveExtensionHooks,setActiveExtensionParsers,setActiveExtensionPreflight,setActiveExtensionRegistrations,setActiveExtensionRenderers,setActiveExtensionServices}from"../core/extensions/index.js";import{applyRegisteredItemFieldDefaultsAndValidation,collectRegisteredItemFieldNames,parseRegisteredItemFieldAssignments}from"../core/extensions/item-fields.js";import{resolveExtensionRoots}from"../core/extensions/loader.js";import{defaultConfigScope}from"../core/config/positional-value.js";import{resolveRegisteredSearchProvider,resolveRegisteredVectorStoreAdapter}from"../core/extensions/runtime-registrations.js";import{isFileMissingError,pathExists,readFileIfExists,removeFileIfExists,writeFileAtomic}from"../core/fs/fs-utils.js";import{normalizeBulkIdsValue,parseBulkIdsText,resolveCliBulkIdsInput}from"../core/io/bulk-ids-input.js";import{computeHistoryDiff,patchPathToChangedField}from"../core/history/history-diff.js";import{enforceHistoryStreamPolicyForItem,enforceHistoryStreamPolicyForItems}from"../core/history/history-stream-policy.js";import{appendHistoryEntry,CURRENT_HISTORY_ITEM_HASH_VERSION,CURRENT_HISTORY_RECORD_HASH_VERSION,createHistoryEntry,hashDocument,hashDocumentForVersion,hashEmptyDocument,hashHistoryPatch,hashHistoryRecord,hashHistoryStream,resealHistoryRewrite,sealHistoryRecord,SUPPORTED_HISTORY_ITEM_HASH_VERSIONS,SUPPORTED_HISTORY_RECORD_HASH_VERSIONS,verifyHistoryRecordHash,verifyHistoryRewriteEvidence}from"../core/history/history.js";import{readHistoryEntries}from"../core/history/read.js";import{appendWorkspaceAuditEvent,appendWorkspaceHistoryChange,getWorkspaceHistoryPath,inspectWorkspaceHistoryState,mutateWorkspaceJsonWithHistory,reconcileWorkspaceJsonHistory,restoreWorkspaceJsonFromHistory,WORKSPACE_HISTORY_ID,writeWorkspaceJsonWithHistory}from"../core/history/workspace-history.js";import{normalizeReplayPatchOps,reanchorHistoryEntries,replayToCanonicalItemDocument,replayToItemDocument,toReplayDocument,verifyHistoryChain,verifyHistoryChainWithVersion}from"../core/history/replay.js";import{resolveBodyFileContent}from"../core/io/body-file.js";import{generateItemId,normalizeItemId,normalizeRawItemId}from"../core/item/id.js";import{canonicalDocument,normalizeItemMetadata,parseItemDocument,serializeItemDocument}from"../core/item/item-format.js";import{toItemRecord}from"../core/item/item-record.js";import{assertParentReferenceIsNotSelf,isPlaceholderReferenceToken,normalizeParentReferenceValue,validateMissingParentReference}from"../core/item/parent-reference-policy.js";import{applyAcceptanceCriteriaMutations,applyTagRemovals,assertNoUnknownCsvKeys,createStdinTokenResolver,looksLikeGenericKeyValueEntry,mergeAdditiveTags,parseCsvKv,parseOptionalNonNegativeInteger,parseOptionalNumber,parseTags,preserveMutationStdinTokenFields,preserveMutationStdinTokenLiterals,transferMutationStdinTokenPolicy,shouldResolveMutationStdinTokenField,shouldResolveMutationStdinTokens,splitAcceptanceCriteria}from"../core/item/parse.js";import{resolvePriority}from"../core/item/priority.js";import{withCliMutationInput,withLiteralMutationInput}from"./lifecycle/cli-input.js";import{validateSprintOrReleaseValue}from"../core/item/sprint-release-format.js";import{parseStatusFilterCsv}from"../core/item/status-filter.js";import{isTerminalStatus,normalizeStatusForRegistry,normalizeStatusInput}from"../core/item/status.js";import{COMMON_MUTATION_COMMAND_OPTION_KEYS,canonicalizeCommandOptionKey,commandOptionFlagLabel,resolveCommandOptionPolicyState,resolveItemTypeRegistry,resolveTypeDefinition,resolveTypeName,validateTypeOptions}from"../core/item/type-registry.js";import{resolveTypeSynonym}from"../core/item/type-synonyms.js";import{acquireLock,acquireLockLease}from"../core/lock/lock.js";import{printError,printResult,writeStderr,writeStdout}from"../core/output/output.js";import{renderRowsAsCsv,renderRowsAsTable}from"../core/output/tabular.js";import{parseLimit}from"../core/shared/numeric-parsers.js";import{resolveConfiguredPmPackageRoot,resolvePmCliVersion,resolvePmPackageRootFromModule}from"../core/packages/root.js";import{buildInvalidTypeError}from"../core/schema/item-types-file.js";import{collectRuntimeFilterValues,matchesRuntimeFilters}from"../core/schema/runtime-field-filters.js";import{collectRuntimeCreateFieldValues,collectRuntimeUpdateFieldValues}from"../core/schema/runtime-field-values.js";import{readRuntimeFieldOptionValue}from"../core/schema/runtime-field-values.js";import{normalizeStatusInputWithRegistry,resolveItemTypesFilePath,resolveRuntimeFieldRegistry,resolveRuntimeStatusRegistry,statusIsTerminal}from"../core/schema/runtime-schema.js";import{describeAllowedTransitions,evaluateTransition,resolveTypeWorkflows}from"../core/schema/type-workflows.js";import{REINDEX_LOCK_ID,shouldRunSearchRefreshInForeground}from"../core/search/background-refresh.js";import{readVectorizationStatusLedger,refreshSearchArtifactsForMutation,writeVectorizationStatusLedger}from"../core/search/cache.js";import{buildSearchCorpus,buildSemanticCorpusInput,resolveSearchCorpusFields,resolveSemanticCorpusCharacterLimit}from"../core/search/corpus.js";import{executeEmbeddingBatchesWithRetry}from"../core/search/embedding-batches.js";import{resolveEmbeddingProviders}from"../core/search/providers.js";import{resolveSettingsWithSemanticRuntimeDefaults}from"../core/search/semantic-defaults.js";import{executeVectorDelete,executeVectorReset,executeVectorUpsert,resolveVectorStores}from"../core/search/vector-stores.js";import{buildVectorizationEmbeddingIdentity,buildVectorizationEmbeddingMetadata,hasVectorizationEmbeddingIdentityChanged,hasVectorizationVectorDimensionChanged,inferConsistentVectorDimension}from"../core/search/vectorization-metadata.js";import{sentryCaptureCliError,sentryDiscardCommandSpan,sentryFinishCommandSpan,sentryFlush,sentryLogCliUsageError,sentrySetCommandContext,sentryStartCommandSpan}from"../core/sentry/helpers.js";import{ensureSentryInit,ensureSentryCommandTracing}from"../core/sentry/instrument.js";import{clearFocusedItem,getFocusedItem,setFocusedItem}from"../core/session/session-state.js";import{readAuthorEnvironment,diagnoseAgentIdentity,resolveAuthor,resolveClaimPrincipal,runWithHarnessDetectionSignals,runWithWorkspaceHarnessSignalDescriptors,BUILTIN_AGENT_PROVENANCE_ADAPTERS,listAgentProvenanceAdapters,normalizeAgentProvenanceAdapterValue,registerAgentProvenanceAdapters,writeAuthorEnvironment}from"../core/shared/author.js";import{agentSessionEnvironment,boundAgentEpisodeIdentity,runWithAgentSessionContext,resolveAgentSessionContextFromSignals}from"../core/shared/agent-session-context.js";import{evaluateMutationGuard,isMutationAction,listMutationActions,scanMutationSecrets}from"./mutation-guard.js";import{jaccardSimilarity,normalizeSimilarityText,scoreItemSimilarity,tokenizeSimilarityText}from"./similarity-scoring.js";import{inspectStaleInProgressItems,scanStaleInProgressItems}from"./governance/stale-work.js";import{CREATE_DIRECT_CLOSE_REASON_DEFAULT,EXIT_CODE,ITEM_METADATA_KEY_ORDER,SETTINGS_DEFAULTS,TYPE_TO_FOLDER,resolveTelemetryErrorCategory}from"../core/shared/constants.js";import{PmCliError}from"../core/shared/errors.js";import{decodeHtmlEntitiesInOptions}from"../core/shared/html-entity-decode.js";import{createLazyModule}from"../core/shared/lazy-module.js";import{levenshteinDistanceWithinLimit}from"../core/shared/levenshtein.js";import{isPureSnakeCaseAlias}from"../core/shared/option-alias-visibility.js";import{asRecordClone,asRecordOrNull,toErrorMessage,toNonEmptyStringOrUndefined}from"../core/shared/primitives.js";import{createSerialQueue}from"../core/shared/serial-queue.js";import{stableStringify,stableValueEquals}from"../core/shared/serialization.js";import{splitCommaList}from"../core/shared/split-comma-list.js";import{compareTimestampStrings,nowIso,resolveIsoOrRelative}from"../core/shared/time.js";import{migrateItemFilesToFormat}from"../core/store/item-format-migration.js";import{listAllDocumentCandidatesCached}from"../core/store/item-metadata-cache.js";import{buildItemNotFoundError,createMutationGuardSdk,deleteItem,listAllItemMetadata,listAllItemMetadataLight,locateItem,mutateItem,mutateItemWithHistoryContext,readLocatedItem}from"../core/store/item-store.js";import{isTerminalPlanMode,shouldCompletePlanOnClose}from"../core/item/plan-lifecycle.js";import{getHistoryPath,getItemPath,getSettingsPath,resolveGlobalPmRoot,resolveImplicitPmRoot,resolvePmRoot,resolveWorkspaceRoot}from"../core/store/paths.js";import{isSettingsReadFallback,persistSelectedItemFormat,readSettings,readSettingsWithMetadata,runWithConfigurationOnlySettings,writeSettings}from"../core/store/settings.js";import{readSettingsSection,settingsSectionRevision,writeSettingsSection}from"../core/store/settings-sections.js";import{maybeRunFirstUseTelemetryPrompt}from"../core/telemetry/consent.js";import{deriveTelemetryCommandResolution}from"../core/telemetry/observability.js";import{emitTelemetryErrorEvent,finishTelemetryCommand,startTelemetryCommand}from"../core/telemetry/runtime.js";import{resolveTelemetrySourceAttribution}from"../core/telemetry/policy.js";export{BUILTIN_AGENT_PROVENANCE_ADAPTERS,COMMON_MUTATION_COMMAND_OPTION_KEYS,CREATE_DIRECT_CLOSE_REASON_DEFAULT,CURRENT_HISTORY_ITEM_HASH_VERSION,CURRENT_HISTORY_RECORD_HASH_VERSION,EXIT_CODE,ITEM_METADATA_KEY_ORDER,PmCliError,REINDEX_LOCK_ID,SETTINGS_DEFAULTS,SUPPORTED_HISTORY_ITEM_HASH_VERSIONS,SUPPORTED_HISTORY_RECORD_HASH_VERSIONS,TYPE_TO_FOLDER,WORKSPACE_HISTORY_ID,acquireLock,acquireLockLease,activateExtensions,agentSessionEnvironment,appendHistoryEntry,appendWorkspaceAuditEvent,appendWorkspaceHistoryChange,applyAcceptanceCriteriaMutations,applyRegisteredItemFieldDefaultsAndValidation,applyTagRemovals,asRecordClone,asRecordOrNull,assertNoUnknownCsvKeys,assertParentReferenceIsNotSelf,assertSchemaPreviewSupported,boundAgentEpisodeIdentity,buildInvalidTypeError,buildItemNotFoundError,buildSearchCorpus,buildSemanticCorpusInput,buildVectorizationEmbeddingIdentity,buildVectorizationEmbeddingMetadata,canonicalDocument,canonicalizeCommandOptionKey,clearActiveExtensionHooks,clearFocusedItem,collectRegisteredItemFieldNames,collectRuntimeCreateFieldValues,collectRuntimeFilterValues,collectRuntimeUpdateFieldValues,commandOptionFlagLabel,compareTimestampStrings,computeHistoryDiff,consumeAfterCommandAffectedItems,createCheckpointId,createCoreCommandHookContext,createEmptyExtensionRegistrationRegistry,createHistoryEntry,createLazyModule,createMutationGuardSdk,createSerialQueue,createStdinTokenResolver,createUnknownSubcommandError,decodeHtmlEntitiesInOptions,defaultConfigScope,deleteItem,deriveTelemetryCommandResolution,describeAllowedTransitions,describeFlagScalarValueFailure,diagnoseAgentIdentity,discoverExtensions,emitTelemetryErrorEvent,enforceHistoryStreamPolicyForItem,enforceHistoryStreamPolicyForItems,ensureSentryCommandTracing,ensureSentryInit,evaluateMutationGuard,evaluateTransition,executeEmbeddingBatchesWithRetry,executeVectorDelete,executeVectorReset,executeVectorUpsert,finishTelemetryCommand,flattenFlagListValue,generateItemId,getActiveCommandResult,getActiveExtensionRegistrations,getFocusedItem,getHistoryPath,getItemPath,getSettingsPath,getWorkspaceHistoryPath,hasVectorizationEmbeddingIdentityChanged,hasVectorizationVectorDimensionChanged,hashDocument,hashDocumentForVersion,hashEmptyDocument,hashHistoryPatch,hashHistoryRecord,hashHistoryStream,inferConsistentVectorDimension,inspectStaleInProgressItems,inspectWorkspaceHistoryState,isFileMissingError,isMutationAction,isPlaceholderReferenceToken,isPureSnakeCaseAlias,isSettingsReadFallback,isTerminalPlanMode,isTerminalStatus,jaccardSimilarity,levenshteinDistanceWithinLimit,listAgentProvenanceAdapters,listAllDocumentCandidatesCached,listAllItemMetadata,listAllItemMetadataLight,listMutationActions,loadExtensions,loadMutationCheckpoint,locateItem,looksLikeGenericKeyValueEntry,matchesRuntimeFilters,maybeRunFirstUseTelemetryPrompt,mergeAdditiveTags,migrateItemFilesToFormat,mutateItem,mutateItemWithHistoryContext,mutateWorkspaceJsonWithHistory,normalizeAgentProvenanceAdapterValue,normalizeBulkIdsValue,normalizeItemId,normalizeItemMetadata,normalizeParentReferenceValue,normalizeRawItemId,normalizeReplayPatchOps,normalizeSimilarityText,normalizeStatusForRegistry,normalizeStatusInput,normalizeStatusInputWithRegistry,nowIso,parseBulkIdsText,parseCsvKv,parseExtensionLongFlagToken,parseItemDocument,parseLimit,parseOptionalNonNegativeInteger,parseOptionalNumber,parseRegisteredItemFieldAssignments,parseStatusFilterCsv,parseTags,patchPathToChangedField,pathExists,persistSelectedItemFormat,preserveMutationStdinTokenFields,preserveMutationStdinTokenLiterals,printError,printResult,projectAfterCommandItemSnapshot,readAuthorEnvironment,readFileIfExists,readHistoryEntries,readLocatedItem,readRuntimeFieldOptionValue,readSettings,readSettingsSection,readSettingsWithMetadata,readVectorizationStatusLedger,reanchorHistoryEntries,reconcileWorkspaceJsonHistory,recordAfterCommandAffectedItem,refreshSearchArtifactsForMutation,registerAgentProvenanceAdapters,removeFileIfExists,renderRowsAsCsv,renderRowsAsTable,replayToCanonicalItemDocument,replayToItemDocument,resealHistoryRewrite,resetActiveExtensionRuntimeState,resolveAgentSessionContextFromSignals,resolveAuthor,resolveBodyFileContent,resolveClaimPrincipal,resolveCliBulkIdsInput,resolveCommandOptionPolicyState,resolveConfiguredPmPackageRoot,resolveEmbeddingProviders,resolveExtensionFlagValueContract,resolveExtensionLongFlagName,resolveExtensionRoots,resolveFlagValueKind,resolveGlobalPmRoot,resolveImplicitPmRoot,resolveIsoOrRelative,resolveItemTypeRegistry,resolveItemTypesFilePath,resolveLinkedResourcePositionalRecovery,resolvePmCliVersion,resolvePmPackageRootFromModule,resolvePmRoot,resolvePriority,resolveRegisteredSearchProvider,resolveRegisteredVectorStoreAdapter,resolveRuntimeFieldRegistry,resolveRuntimeStatusRegistry,resolveSearchCorpusFields,resolveSemanticCorpusCharacterLimit,resolveSettingsWithSemanticRuntimeDefaults,resolveTelemetryErrorCategory,resolveTelemetrySourceAttribution,resolveTypeDefinition,resolveTypeName,resolveTypeSynonym,resolveTypeWorkflows,resolveVectorStores,resolveWorkspaceRoot,restoreCheckpointItems,restoreWorkspaceJsonFromHistory,runActiveBeforeMutationHooks,runActiveCommandHandler,runActiveOnIndexHooks,runActiveOnReadHooks,runActiveOnWriteHooks,runActiveParserOverride,runActivePreflightOverride,runActiveServiceOverride,runAfterCommandHooks,runBeforeCommandHooks,runWithAgentSessionContext,runWithConfigurationOnlySettings,runWithHarnessDetectionSignals,runWithWorkspaceHarnessSignalDescriptors,scanMutationSecrets,scanStaleInProgressItems,scoreItemSimilarity,sealHistoryRecord,sentryCaptureCliError,sentryDiscardCommandSpan,sentryFinishCommandSpan,sentryFlush,sentryLogCliUsageError,sentrySetCommandContext,sentryStartCommandSpan,serializeItemDocument,setActiveCommandContext,setActiveCommandResult,setActiveExtensionCommands,setActiveExtensionHooks,setActiveExtensionParsers,setActiveExtensionPreflight,setActiveExtensionRegistrations,setActiveExtensionRenderers,setActiveExtensionServices,setFocusedItem,settingsSectionRevision,shouldCompletePlanOnClose,shouldResolveMutationStdinTokenField,shouldResolveMutationStdinTokens,shouldRunSearchRefreshInForeground,splitAcceptanceCriteria,splitCommaList,stableStringify,stableValueEquals,startTelemetryCommand,statusIsTerminal,toErrorMessage,toItemRecord,toNonEmptyStringOrUndefined,toReplayDocument,tokenizeSimilarityText,transferMutationStdinTokenPolicy,validateMissingParentReference,validateSprintOrReleaseValue,validateTypeOptions,verifyHistoryChain,verifyHistoryChainWithVersion,verifyHistoryRecordHash,verifyHistoryRewriteEvidence,withCliMutationInput,withLiteralMutationInput,writeAuthorEnvironment,writeFileAtomic,writeMutationCheckpoint,writeSettings,writeSettingsSection,writeStderr,writeStdout,writeVectorizationStatusLedger,writeWorkspaceJsonWithHistory};
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]="52348de5-f05f-56d0-8e0e-bd7f25b8e6a6")}catch{}})();import{assertSchemaPreviewSupported}from"./runtime/schema-preview.js";import{resolveLinkedResourcePositionalRecovery}from"./agent/linked-resource-recovery.js";import{parseExtensionLongFlagToken,resolveExtensionLongFlagName}from"../core/extensions/flag-definition-validation.js";import{createCheckpointId,loadMutationCheckpoint,restoreCheckpointItems,writeMutationCheckpoint}from"../core/checkpoint/mutation-checkpoint.js";import{describeFlagScalarValueFailure,flattenFlagListValue,resolveExtensionFlagValueContract,resolveFlagValueKind}from"../core/extensions/flag-value-types.js";import{createUnknownSubcommandError}from"./agent/subcommand-recovery.js";import{activateExtensions,clearActiveExtensionHooks,consumeAfterCommandAffectedItems,createCoreCommandHookContext,createEmptyExtensionRegistrationRegistry,discoverExtensions,getActiveCommandResult,getActiveExtensionRegistrations,loadExtensions,projectAfterCommandItemSnapshot,recordAfterCommandAffectedItem,resetActiveExtensionRuntimeState,runActiveCommandHandler,runActiveBeforeMutationHooks,runActiveOnIndexHooks,runActiveOnReadHooks,runActiveOnWriteHooks,runActiveParserOverride,runActivePreflightOverride,runActiveServiceOverride,runAfterCommandHooks,runBeforeCommandHooks,setActiveCommandContext,setActiveCommandResult,setActiveExtensionCommands,setActiveExtensionHooks,setActiveExtensionParsers,setActiveExtensionPreflight,setActiveExtensionRegistrations,setActiveExtensionRenderers,setActiveExtensionServices}from"../core/extensions/index.js";import{applyRegisteredItemFieldDefaultsAndValidation,collectRegisteredItemFieldNames,parseRegisteredItemFieldAssignments}from"../core/extensions/item-fields.js";import{resolveExtensionRoots}from"../core/extensions/loader.js";import{defaultConfigScope}from"../core/config/positional-value.js";import{resolveRegisteredSearchProvider,resolveRegisteredVectorStoreAdapter}from"../core/extensions/runtime-registrations.js";import{isFileMissingError,pathExists,readFileIfExists,removeFileIfExists,writeFileAtomic}from"../core/fs/fs-utils.js";import{normalizeBulkIdsValue,parseBulkIdsText,resolveCliBulkIdsInput}from"../core/io/bulk-ids-input.js";import{computeHistoryDiff,patchPathToChangedField}from"../core/history/history-diff.js";import{enforceHistoryStreamPolicyForItem,enforceHistoryStreamPolicyForItems}from"../core/history/history-stream-policy.js";import{appendHistoryEntry,CURRENT_HISTORY_ITEM_HASH_VERSION,CURRENT_HISTORY_RECORD_HASH_VERSION,createHistoryEntry,hashDocument,hashDocumentForVersion,hashEmptyDocument,hashHistoryPatch,hashHistoryRecord,hashHistoryStream,resealHistoryRewrite,sealHistoryRecord,SUPPORTED_HISTORY_ITEM_HASH_VERSIONS,SUPPORTED_HISTORY_RECORD_HASH_VERSIONS,verifyHistoryRecordHash,verifyHistoryRewriteEvidence}from"../core/history/history.js";import{readHistoryEntries}from"../core/history/read.js";import{appendWorkspaceAuditEvent,appendWorkspaceHistoryChange,getWorkspaceHistoryPath,inspectWorkspaceHistoryState,mutateWorkspaceJsonWithHistory,reconcileWorkspaceJsonHistory,restoreWorkspaceJsonFromHistory,WORKSPACE_HISTORY_ID,writeWorkspaceJsonWithHistory}from"../core/history/workspace-history.js";import{normalizeReplayPatchOps,reanchorHistoryEntries,replayToCanonicalItemDocument,replayToItemDocument,toReplayDocument,verifyHistoryChain,verifyHistoryChainWithVersion}from"../core/history/replay.js";import{resolveBodyFileContent}from"../core/io/body-file.js";import{generateItemId,normalizeItemId,normalizeRawItemId}from"../core/item/id.js";import{canonicalDocument,normalizeItemMetadata,parseItemDocument,serializeItemDocument}from"../core/item/item-format.js";import{toItemRecord}from"../core/item/item-record.js";import{assertParentReferenceIsNotSelf,isPlaceholderReferenceToken,normalizeParentReferenceValue,validateMissingParentReference}from"../core/item/parent-reference-policy.js";import{applyAcceptanceCriteriaMutations,applyTagRemovals,assertNoUnknownCsvKeys,createStdinTokenResolver,looksLikeGenericKeyValueEntry,mergeAdditiveTags,parseCsvKv,parseOptionalNonNegativeInteger,parseOptionalNumber,parseTags,preserveMutationStdinTokenFields,preserveMutationStdinTokenLiterals,transferMutationStdinTokenPolicy,shouldResolveMutationStdinTokenField,shouldResolveMutationStdinTokens,splitAcceptanceCriteria}from"../core/item/parse.js";import{resolvePriority}from"../core/item/priority.js";import{withCliMutationInput,withLiteralMutationInput}from"./lifecycle/cli-input.js";import{validateSprintOrReleaseValue}from"../core/item/sprint-release-format.js";import{parseStatusFilterCsv}from"../core/item/status-filter.js";import{isTerminalStatus,normalizeStatusForRegistry,normalizeStatusInput}from"../core/item/status.js";import{COMMON_MUTATION_COMMAND_OPTION_KEYS,canonicalizeCommandOptionKey,commandOptionFlagLabel,resolveCommandOptionPolicyState,resolveItemTypeRegistry,resolveTypeDefinition,resolveTypeName,validateTypeOptions}from"../core/item/type-registry.js";import{resolveTypeSynonym}from"../core/item/type-synonyms.js";import{acquireLock,acquireLockLease}from"../core/lock/lock.js";import{printError,printResult,writeStderr,writeStdout}from"../core/output/output.js";import{renderRowsAsCsv,renderRowsAsTable}from"../core/output/tabular.js";import{parseLimit}from"../core/shared/numeric-parsers.js";import{resolveConfiguredPmPackageRoot,resolvePmCliVersion,resolvePmPackageRootFromModule}from"../core/packages/root.js";import{buildInvalidTypeError}from"../core/schema/item-types-file.js";import{collectRuntimeFilterValues,matchesRuntimeFilters}from"../core/schema/runtime-field-filters.js";import{collectRuntimeCreateFieldValues,collectRuntimeUpdateFieldValues}from"../core/schema/runtime-field-values.js";import{readRuntimeFieldOptionValue}from"../core/schema/runtime-field-values.js";import{normalizeStatusInputWithRegistry,resolveItemTypesFilePath,resolveRuntimeFieldRegistry,resolveRuntimeStatusRegistry,statusIsTerminal}from"../core/schema/runtime-schema.js";import{describeAllowedTransitions,evaluateTransition,resolveTypeWorkflows}from"../core/schema/type-workflows.js";import{REINDEX_LOCK_ID,shouldRunSearchRefreshInForeground}from"../core/search/background-refresh.js";import{readVectorizationStatusLedger,refreshSearchArtifactsForMutation,writeVectorizationStatusLedger}from"../core/search/cache.js";import{buildSearchCorpus,buildSemanticCorpusInput,resolveSearchCorpusFields,resolveSemanticCorpusCharacterLimit}from"../core/search/corpus.js";import{executeEmbeddingBatchesWithRetry}from"../core/search/embedding-batches.js";import{resolveEmbeddingProviders}from"../core/search/providers.js";import{resolveSettingsWithSemanticRuntimeDefaults}from"../core/search/semantic-defaults.js";import{executeVectorDelete,executeVectorReset,executeVectorUpsert,resolveVectorStores}from"../core/search/vector-stores.js";import{buildVectorizationEmbeddingIdentity,buildVectorizationEmbeddingMetadata,hasVectorizationEmbeddingIdentityChanged,hasVectorizationVectorDimensionChanged,inferConsistentVectorDimension}from"../core/search/vectorization-metadata.js";import{sentryCaptureCliError,sentryDiscardCommandSpan,sentryFinishCommandSpan,sentryFlush,sentryLogCliUsageError,sentrySetCommandContext,sentryStartCommandSpan}from"../core/sentry/helpers.js";import{ensureSentryInit,ensureSentryCommandTracing}from"../core/sentry/instrument.js";import{clearFocusedItem,getFocusedItem,setFocusedItem}from"../core/session/session-state.js";import{readAuthorEnvironment,diagnoseAgentIdentity,resolveAuthor,resolveClaimPrincipal,runWithHarnessDetectionSignals,runWithWorkspaceHarnessSignalDescriptors,BUILTIN_AGENT_PROVENANCE_ADAPTERS,listAgentProvenanceAdapters,normalizeAgentProvenanceAdapterValue,registerAgentProvenanceAdapters,writeAuthorEnvironment}from"../core/shared/author.js";import{agentSessionEnvironment,boundAgentEpisodeIdentity,runWithAgentSessionContext,resolveAgentSessionContextFromSignals}from"../core/shared/agent-session-context.js";import{evaluateMutationGuard,isMutationAction,listMutationActions,scanMutationSecrets}from"./mutation-guard.js";import{jaccardSimilarity,normalizeSimilarityText,scoreItemSimilarity,tokenizeSimilarityText}from"./similarity-scoring.js";import{inspectStaleInProgressItems,scanStaleInProgressItems}from"./governance/stale-work.js";import{CREATE_DIRECT_CLOSE_REASON_DEFAULT,EXIT_CODE,ITEM_METADATA_KEY_ORDER,SETTINGS_DEFAULTS,TYPE_TO_FOLDER,resolveTelemetryErrorCategory}from"../core/shared/constants.js";import{PmCliError}from"../core/shared/errors.js";import{decodeHtmlEntitiesInOptions}from"../core/shared/html-entity-decode.js";import{createLazyModule}from"../core/shared/lazy-module.js";import{levenshteinDistanceWithinLimit}from"../core/shared/levenshtein.js";import{isPureSnakeCaseAlias}from"../core/shared/option-alias-visibility.js";import{asRecordClone,asRecordOrNull,toErrorMessage,toNonEmptyStringOrUndefined}from"../core/shared/primitives.js";import{createSerialQueue}from"../core/shared/serial-queue.js";import{stableStringify,stableValueEquals}from"../core/shared/serialization.js";import{splitCommaList}from"../core/shared/split-comma-list.js";import{compareTimestampStrings,nowIso,resolveIsoOrRelative}from"../core/shared/time.js";import{migrateItemFilesToFormat}from"../core/store/item-format-migration.js";import{listAllDocumentCandidatesCached}from"../core/store/item-metadata-cache.js";import{buildItemNotFoundError,createMutationGuardSdk,deleteItem,listAllItemMetadata,listAllItemMetadataLight,locateItem,mutateItem,mutateItemWithHistoryContext,readLocatedItem}from"../core/store/item-store.js";import{isTerminalPlanMode,shouldCompletePlanOnClose}from"../core/item/plan-lifecycle.js";import{getHistoryPath,getItemPath,getSettingsPath,resolveGlobalPmRoot,resolveImplicitPmRoot,resolvePmRoot,resolveWorkspaceRoot}from"../core/store/paths.js";import{isSettingsReadFallback,persistSelectedItemFormat,readSettings,readSettingsWithMetadata,runWithConfigurationOnlySettings,writeSettings}from"../core/store/settings.js";import{readSettingsSection,settingsSectionRevision,writeSettingsSection}from"../core/store/settings-sections.js";import{maybeRunFirstUseTelemetryPrompt}from"../core/telemetry/consent.js";import{deriveTelemetryCommandResolution}from"../core/telemetry/observability.js";import{emitTelemetryErrorEvent,finishTelemetryCommand,startTelemetryCommand}from"../core/telemetry/runtime.js";import{resolveTelemetrySourceAttribution}from"../core/telemetry/policy.js";export{BUILTIN_AGENT_PROVENANCE_ADAPTERS,COMMON_MUTATION_COMMAND_OPTION_KEYS,CREATE_DIRECT_CLOSE_REASON_DEFAULT,CURRENT_HISTORY_ITEM_HASH_VERSION,CURRENT_HISTORY_RECORD_HASH_VERSION,EXIT_CODE,ITEM_METADATA_KEY_ORDER,PmCliError,REINDEX_LOCK_ID,SETTINGS_DEFAULTS,SUPPORTED_HISTORY_ITEM_HASH_VERSIONS,SUPPORTED_HISTORY_RECORD_HASH_VERSIONS,TYPE_TO_FOLDER,WORKSPACE_HISTORY_ID,acquireLock,acquireLockLease,activateExtensions,agentSessionEnvironment,appendHistoryEntry,appendWorkspaceAuditEvent,appendWorkspaceHistoryChange,applyAcceptanceCriteriaMutations,applyRegisteredItemFieldDefaultsAndValidation,applyTagRemovals,asRecordClone,asRecordOrNull,assertNoUnknownCsvKeys,assertParentReferenceIsNotSelf,assertSchemaPreviewSupported,boundAgentEpisodeIdentity,buildInvalidTypeError,buildItemNotFoundError,buildSearchCorpus,buildSemanticCorpusInput,buildVectorizationEmbeddingIdentity,buildVectorizationEmbeddingMetadata,canonicalDocument,canonicalizeCommandOptionKey,clearActiveExtensionHooks,clearFocusedItem,collectRegisteredItemFieldNames,collectRuntimeCreateFieldValues,collectRuntimeFilterValues,collectRuntimeUpdateFieldValues,commandOptionFlagLabel,compareTimestampStrings,computeHistoryDiff,consumeAfterCommandAffectedItems,createCheckpointId,createCoreCommandHookContext,createEmptyExtensionRegistrationRegistry,createHistoryEntry,createLazyModule,createMutationGuardSdk,createSerialQueue,createStdinTokenResolver,createUnknownSubcommandError,decodeHtmlEntitiesInOptions,defaultConfigScope,deleteItem,deriveTelemetryCommandResolution,describeAllowedTransitions,describeFlagScalarValueFailure,diagnoseAgentIdentity,discoverExtensions,emitTelemetryErrorEvent,enforceHistoryStreamPolicyForItem,enforceHistoryStreamPolicyForItems,ensureSentryCommandTracing,ensureSentryInit,evaluateMutationGuard,evaluateTransition,executeEmbeddingBatchesWithRetry,executeVectorDelete,executeVectorReset,executeVectorUpsert,finishTelemetryCommand,flattenFlagListValue,generateItemId,getActiveCommandResult,getActiveExtensionRegistrations,getFocusedItem,getHistoryPath,getItemPath,getSettingsPath,getWorkspaceHistoryPath,hasVectorizationEmbeddingIdentityChanged,hasVectorizationVectorDimensionChanged,hashDocument,hashDocumentForVersion,hashEmptyDocument,hashHistoryPatch,hashHistoryRecord,hashHistoryStream,inferConsistentVectorDimension,inspectStaleInProgressItems,inspectWorkspaceHistoryState,isFileMissingError,isMutationAction,isPlaceholderReferenceToken,isPureSnakeCaseAlias,isSettingsReadFallback,isTerminalPlanMode,isTerminalStatus,jaccardSimilarity,levenshteinDistanceWithinLimit,listAgentProvenanceAdapters,listAllDocumentCandidatesCached,listAllItemMetadata,listAllItemMetadataLight,listMutationActions,loadExtensions,loadMutationCheckpoint,locateItem,looksLikeGenericKeyValueEntry,matchesRuntimeFilters,maybeRunFirstUseTelemetryPrompt,mergeAdditiveTags,migrateItemFilesToFormat,mutateItem,mutateItemWithHistoryContext,mutateWorkspaceJsonWithHistory,normalizeAgentProvenanceAdapterValue,normalizeBulkIdsValue,normalizeItemId,normalizeItemMetadata,normalizeParentReferenceValue,normalizeRawItemId,normalizeReplayPatchOps,normalizeSimilarityText,normalizeStatusForRegistry,normalizeStatusInput,normalizeStatusInputWithRegistry,nowIso,parseBulkIdsText,parseCsvKv,parseExtensionLongFlagToken,parseItemDocument,parseLimit,parseOptionalNonNegativeInteger,parseOptionalNumber,parseRegisteredItemFieldAssignments,parseStatusFilterCsv,parseTags,patchPathToChangedField,pathExists,persistSelectedItemFormat,preserveMutationStdinTokenFields,preserveMutationStdinTokenLiterals,printError,printResult,projectAfterCommandItemSnapshot,readAuthorEnvironment,readFileIfExists,readHistoryEntries,readLocatedItem,readRuntimeFieldOptionValue,readSettings,readSettingsSection,readSettingsWithMetadata,readVectorizationStatusLedger,reanchorHistoryEntries,reconcileWorkspaceJsonHistory,recordAfterCommandAffectedItem,refreshSearchArtifactsForMutation,registerAgentProvenanceAdapters,removeFileIfExists,renderRowsAsCsv,renderRowsAsTable,replayToCanonicalItemDocument,replayToItemDocument,resealHistoryRewrite,resetActiveExtensionRuntimeState,resolveAgentSessionContextFromSignals,resolveAuthor,resolveBodyFileContent,resolveClaimPrincipal,resolveCliBulkIdsInput,resolveCommandOptionPolicyState,resolveConfiguredPmPackageRoot,resolveEmbeddingProviders,resolveExtensionFlagValueContract,resolveExtensionLongFlagName,resolveExtensionRoots,resolveFlagValueKind,resolveGlobalPmRoot,resolveImplicitPmRoot,resolveIsoOrRelative,resolveItemTypeRegistry,resolveItemTypesFilePath,resolveLinkedResourcePositionalRecovery,resolvePmCliVersion,resolvePmPackageRootFromModule,resolvePmRoot,resolvePriority,resolveRegisteredSearchProvider,resolveRegisteredVectorStoreAdapter,resolveRuntimeFieldRegistry,resolveRuntimeStatusRegistry,resolveSearchCorpusFields,resolveSemanticCorpusCharacterLimit,resolveSettingsWithSemanticRuntimeDefaults,resolveTelemetryErrorCategory,resolveTelemetrySourceAttribution,resolveTypeDefinition,resolveTypeName,resolveTypeSynonym,resolveTypeWorkflows,resolveVectorStores,resolveWorkspaceRoot,restoreCheckpointItems,restoreWorkspaceJsonFromHistory,runActiveBeforeMutationHooks,runActiveCommandHandler,runActiveOnIndexHooks,runActiveOnReadHooks,runActiveOnWriteHooks,runActiveParserOverride,runActivePreflightOverride,runActiveServiceOverride,runAfterCommandHooks,runBeforeCommandHooks,runWithAgentSessionContext,runWithConfigurationOnlySettings,runWithHarnessDetectionSignals,runWithWorkspaceHarnessSignalDescriptors,scanMutationSecrets,scanStaleInProgressItems,scoreItemSimilarity,sealHistoryRecord,sentryCaptureCliError,sentryDiscardCommandSpan,sentryFinishCommandSpan,sentryFlush,sentryLogCliUsageError,sentrySetCommandContext,sentryStartCommandSpan,serializeItemDocument,setActiveCommandContext,setActiveCommandResult,setActiveExtensionCommands,setActiveExtensionHooks,setActiveExtensionParsers,setActiveExtensionPreflight,setActiveExtensionRegistrations,setActiveExtensionRenderers,setActiveExtensionServices,setFocusedItem,settingsSectionRevision,shouldCompletePlanOnClose,shouldResolveMutationStdinTokenField,shouldResolveMutationStdinTokens,shouldRunSearchRefreshInForeground,splitAcceptanceCriteria,splitCommaList,stableStringify,stableValueEquals,startTelemetryCommand,statusIsTerminal,toErrorMessage,toItemRecord,toNonEmptyStringOrUndefined,toReplayDocument,tokenizeSimilarityText,transferMutationStdinTokenPolicy,validateMissingParentReference,validateSprintOrReleaseValue,validateTypeOptions,verifyHistoryChain,verifyHistoryChainWithVersion,verifyHistoryRecordHash,verifyHistoryRewriteEvidence,withCliMutationInput,withLiteralMutationInput,writeAuthorEnvironment,writeFileAtomic,writeMutationCheckpoint,writeSettings,writeSettingsSection,writeStderr,writeStdout,writeVectorizationStatusLedger,writeWorkspaceJsonWithHistory};
2
2
  //# sourceMappingURL=runtime-primitives.js.map
@@ -194,6 +194,8 @@ Use the canonical [guide topic map](README.md#guide-topic-map) when local in-CLI
194
194
  - Claim before heavy edits.
195
195
  - `pm claim <id>` is an atomic test-and-set. A non-terminal item already held by a different principal refuses with `already_claimed_by` and names the holder in typed fields (`claimed_by`, `claim_source`, `claimed_at`); the same principal re-claiming is a no-op.
196
196
  - Pass `--if-available` to treat a held item as a skip (`skipped: true`, exit 0) instead of a failure, for example when several agents pull from one queue. The terminal check runs first, so a terminal item still refuses without `--force` even when `--if-available` is set.
197
+ - The refusal also carries `claim_activity`: the holder's `claim_age_hours`, `last_activity_at` (the newer of the item's `updated_at` and its latest substantive history entry: a restore writes an older `updated_at` and counts, a compaction baseline counts with the newest work it pruned, and maintenance such as the `history-compact` audit entry does not), `idle_hours`, and the `stale_policy` it was judged against (`mutation_guard.stale_in_progress_hours`, default 72, with `stale` and `eligible_at`). `pm next` reports `claimed_at`, `idle_hours` and `stale` on each `held_by_others` row.
198
+ - Pass `--takeover-stale` to take over a claim whose holder has recorded nothing for at least that threshold. An active or too-recent claim refuses with `stale_claim_takeover_refused`, writes nothing, and names when it becomes eligible. The decision is made under the item lock, which serializes it with the holder's mutations: a renewal recorded before the takeover takes the lock is seen and refuses the takeover, and one that arrives after it lands on the new holder's claim. A history stream that exists but cannot be read is never judged stale: the refusal is still `stale_claim_takeover_refused`, with `claim_activity.history_unreadable: true` as its evidence. The takeover anchors on the holder's own claim record, so it also refuses when that record is missing or was folded into a compaction baseline, or when a salvage, repair, redaction, merge reconcile or workspace restore after the claim discarded or rewrote records (`claim_activity.unproven_activity`). The holder can release such an item, or a coordinated `--force` can take it. A permitted takeover records `previous_holder`, `new_holder`, `last_activity_at`, `idle_hours`, `threshold_hours` and the policy in the claim history entry's `context.stale_claim_takeover`, and returns the same receipt as `takeover`. Combined with `--if-available`, an active claim is skipped instead of refused. It cannot be combined with `--force` or `--next`.
197
199
  - Use `--force` only for a coordinated takeover of another owner's claim; it is also required to claim terminal items, and to override stale locks when the `governance.force_required_for_stale_lock` policy is enabled (the `minimal` and custom governance presets can disable it). Never force a takeover without explicit approval.
198
200
  - Release when pausing, handing off, or after close.
199
201
 
package/docs/COMMANDS.md CHANGED
@@ -171,6 +171,28 @@ pm next --parent pm-epic01 # scope readiness to one epic's subtree
171
171
  pm next --ready-only --limit 3 --json # tightest agent-loop projection
172
172
  ```
173
173
 
174
+ Each `held_by_others` row reports the holder's `claimed_at`, `idle_hours` and
175
+ `stale` (idle at least `mutation_guard.stale_in_progress_hours`), reading one
176
+ history stream per returned row only; the exact `last_activity_at` is in a
177
+ refused claim's `claim_activity`. A stale row can be taken with
178
+ `pm claim <id> --takeover-stale`; an active one is refused with
179
+ `stale_claim_takeover_refused` and nothing is written. Unattended in-progress
180
+ work is swept with the existing list grammar:
181
+
182
+ ```bash
183
+ pm list --status in_progress --assignee-filter unassigned # unowned
184
+ pm list --status in_progress --updated-before -72h # idle, owned or not
185
+ pm list --status in_progress --assignee-filter unassigned --updated-before -72h # stale
186
+ ```
187
+
188
+ `pm health` prints these sweeps (with the configured status id and threshold)
189
+ as the remedies of its `in_progress_unowned`, `in_progress_idle` and
190
+ `stale_in_progress_items` advisories, and `pm context` counts
191
+ `in_progress_unowned` and `in_progress_idle` next to `in_progress`. The sweeps
192
+ select by `updated_at`, so they are candidate lists: an item restored within
193
+ the window keeps an older `updated_at` but recent history, and only
194
+ `--takeover-stale` applies the full activity clock.
195
+
174
196
  `pm next` has two budgets with different scopes. `--token-budget <n>` bounds
175
197
  only the selection (`recommended` plus `ready`) and reports it under
176
198
  `truncation.ready_budget`; `filters.token_budget` echoes that request and is
@@ -104,7 +104,7 @@ If the existing `settings.json` is valid JSON but fails schema validation (for e
104
104
  | `author_default` | configured mutation author before automatic harness detection |
105
105
  | `mutation_guard.require_attributed_author` | reject mutations whose effective author remains `unknown` (default `false`) |
106
106
  | `mutation_guard.secret_guard` | credential-shaped content policy: `off`, `advise`, or `block` (default `advise`) |
107
- | `mutation_guard.stale_in_progress_hours` | age threshold for unclaimed in-progress work surfaced by `pm health` (integer >= 1, default `72`) |
107
+ | `mutation_guard.stale_in_progress_hours` | inactivity threshold for stale work: `pm health` advisories, `pm context` idle counts and `pm claim --takeover-stale` (integer >= 1, default `72`) |
108
108
  | `item_format` | item storage format (`toon` writes; legacy markdown is read/migrate only) |
109
109
  | `output.default_format` | default renderer, usually `toon` |
110
110
  | `locks.ttl_seconds` | stale lock threshold |
@@ -294,7 +294,7 @@ When enabled, these environment variables tune runtime behaviour. All boolean kn
294
294
  |---|---|---|
295
295
  | `PM_TELEMETRY_DISABLED` | boolean | Hard-disable all telemetry for this process, ignoring settings. |
296
296
  | `DO_NOT_TRACK` | boolean | Hard-disable event capture, identity creation, flush workers, endpoint probes, and Sentry, regardless of persisted preferences. |
297
- | `PM_TELEMETRY_SEND_TEST_EVENTS` | boolean | Explicitly allow inferred test events. Hard opt-outs still take precedence. |
297
+ | `PM_TELEMETRY_SEND_TEST_EVENTS` | boolean | Explicitly allow inferred test events, labelled `test`. Hard opt-outs still take precedence. |
298
298
  | `PM_TELEMETRY_READ_SAMPLE_RATE` | number greater than `0` and at most `1` | Override automatic successful-read sampling; `1`, empty, or invalid values retain every invocation. Omit for automatic frequency bounding. |
299
299
  | `PM_NO_TELEMETRY` | boolean | Alias for `PM_TELEMETRY_DISABLED` (honoured by the same checks). |
300
300
  | `PM_TELEMETRY_OTEL_DISABLED` | boolean | Disable only OTLP trace-span export; the event queue still flushes. |
@@ -351,17 +351,30 @@ Interaction rules:
351
351
 
352
352
  Test environments inferred from `VITEST`, `VITEST_WORKER_ID`, `NODE_TEST_CONTEXT`
353
353
  (native `node --test` children), or `NODE_ENV=test` suppress telemetry and Sentry
354
- before identity creation. A valid explicit `PM_TELEMETRY_SOURCE_CONTEXT`,
355
- including `test`, or `PM_TELEMETRY_SEND_TEST_EVENTS=1` permits intentional test
356
- delivery, so a test that only wants the label must also set
357
- `PM_TELEMETRY_DISABLED=1`. Point such tests at a local collector: set
354
+ before identity creation. `bun test` exports no runner-specific variable (there is
355
+ no `BUN_TEST`). It sets `NODE_ENV=test` unless `NODE_ENV` is already set, so Bun is
356
+ covered by the `NODE_ENV` signal. Only an explicit test opt-in permits intentional test
357
+ delivery: `PM_TELEMETRY_SOURCE_CONTEXT=test` or `PM_TELEMETRY_SEND_TEST_EVENTS=1`.
358
+ Either way the events are labelled `test`. A test that only wants the label must
359
+ also set `PM_TELEMETRY_DISABLED=1`.
360
+
361
+ Any other source context is ignored inside a test runner. That includes an
362
+ `automation`, `user` or `dogfood` value a harness or release script exported to
363
+ attribute its own tracker writes. The context labels whoever exported it, and
364
+ does not re-enable telemetry for the test children that inherit it (GH-1735). Point such tests at a local collector: set
358
365
  `PM_TELEMETRY_ENDPOINT` for events, `SENTRY_DSN` for errors, and
359
366
  `OTEL_EXPORTER_OTLP_*` for spans. Inferred tests use inline telemetry flushing even
360
367
  after an opt in, so CLI delivery settles before process exit and disposable-root
361
368
  cleanup. SDK telemetry completion also awaits inline delivery before returning.
362
369
  Neither setting overrides a hard opt-out. `pm telemetry status` exposes effective `enabled`, persisted
363
370
  `configured_enabled`, and `env_overrides` so an empty queue is distinguishable
364
- from disabled delivery.
371
+ from disabled delivery. `env_overrides.decided_by` names the environment input
372
+ that settled consent, or is null when settings decide. It can be a hard opt-out
373
+ (`env:DO_NOT_TRACK`, `env:PM_TELEMETRY_DISABLED`, `env:PM_NO_TELEMETRY`, or an
374
+ invalid `env:PM_TELEMETRY_ENDPOINT`), the test-runner signal that suppressed
375
+ delivery (`env:VITEST`, `env:VITEST_WORKER_ID`, `env:NODE_TEST_CONTEXT`,
376
+ `env:NODE_ENV`), or the test opt-in that allowed it
377
+ (`env:PM_TELEMETRY_SOURCE_CONTEXT`, `env:PM_TELEMETRY_SEND_TEST_EVENTS`).
365
378
 
366
379
  SDK consumers that previously used `TelemetryStatusSummary.enabled` to display the saved preference should read `configured_enabled` instead. Use `enabled` to determine whether this process permits delivery.
367
380
 
@@ -48,7 +48,14 @@ is refused with `missing_required_argument`, and `claim <id> --next` with
48
48
  `ambiguous_option_combination`; their next steps never tell the caller to pass
49
49
  a flag that is already present. `claim <id> --start --next` (or
50
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
51
+ `invalid_argument_value`, whose recovery names the flags to remove.
52
+ `claim <id> --start --takeover-stale` (and the `start-task` alias) takes over
53
+ an idle claim before starting it, under the same stale-work policy as plain
54
+ `claim --takeover-stale`. `--takeover-stale` with `--force` is refused with
55
+ `ambiguous_option_combination` on every form, as is plain
56
+ `claim --takeover-stale --next`. The start forms refuse `--next` before any
57
+ claim runs: `claim --start` with `invalid_argument_value`, and `start-task`,
58
+ which has no `--next`, with `unknown_option`. `release --pause` moves work to the configured
52
59
  open status, then releases ownership. `close --release-assignment` records the
53
60
  close and its inline evidence, then releases ownership.
54
61
 
@@ -36,7 +36,71 @@ Defaults preserve author compatibility while providing secret advice:
36
36
  |---|---|---|
37
37
  | `mutation_guard.require_attributed_author` | `false` | When enabled, reject an effective author of `unknown`. |
38
38
  | `mutation_guard.secret_guard` | `advise` | `off`, stderr/structured `advise`, or pre-write `block`. |
39
- | `mutation_guard.stale_in_progress_hours` | `72` | Age threshold for unclaimed active work in `pm health`. |
39
+ | `mutation_guard.stale_in_progress_hours` | `72` | Inactivity threshold for stale work: `pm health` advisories, `pm context` idle counts, and `pm claim --takeover-stale`. |
40
+
41
+ One activity clock serves every stale-work consumer: the newer of an item's
42
+ `updated_at` and its latest substantive history entry. Ordinary mutations
43
+ advance both; `pm restore` writes the historical document, with its older
44
+ `updated_at`, and appends a new entry, so the stream counts too. Maintenance
45
+ entries (`history-compact`, `history-repair`, `history-redact`) preserve the
46
+ record without working on the item and do not count. A compaction baseline
47
+ stands for its pruned prefix and records that prefix's newest substantive
48
+ time as `context.history_compaction.last_activity_at`, so repeated
49
+ compaction never renews an abandoned claim. A baseline written before that
50
+ field existed carries only its own timestamp, the last pruned entry's time,
51
+ which does not bound the pruned work because history keeps caller-supplied
52
+ timestamps without an ordering check. Advisory reads approximate its activity
53
+ with that timestamp.
54
+
55
+ A takeover trusts no summary or rewrite. It anchors on the holder's own claim
56
+ record: the newest original entry that set the current assignee, or a claim
57
+ that moved only `claim_principal` (another session of the same principal took
58
+ the item). Records
59
+ before it cannot be the holder's work, so a compacted, salvaged or legacy
60
+ prefix never matters. The takeover refuses (`claim_activity.unproven_activity`)
61
+ in these cases:
62
+
63
+ | Reason | Cause |
64
+ |---|---|
65
+ | `claim_record_unavailable` | No original record sets the holder: the history is silent, missing, or folded the claim into a compaction baseline. |
66
+ | `discarded_history_tail` | A `history-repair --salvage-tail` after the claim discarded a record whose time is unknown. |
67
+ | `rewritten_history` | A `history-repair`, `history-redact` or merge reconcile after the claim rewrote records, or `reanchor_evidence` on the claim or a later record shows a changed patch (a merge rebase leaves no audit entry). |
68
+ | `workspace_restored` | A workspace snapshot restore at or after the claim may have replaced the holder's later work. Also when a salvage, repair, redaction or merge reconcile of the workspace stream is dated at or after the claim, when a compacted workspace stream's baseline cannot bound its pruned records before the claim, or when the workspace stream cannot be read to rule a restore out. |
69
+
70
+ The holder can release such an item; a new claim starts a provable record.
71
+ Restore precedence uses wall-clock time and assumes the restoring host's clock
72
+ does not run behind the holder's. Ordering restores by a durable generation
73
+ instead is tracked as pm-8su89a. A restore that activates while a takeover is
74
+ between its reads and its commit is not yet fenced; that gap affects every
75
+ item writer and is tracked as pm-vgk0nj. Rewrite detection also trusts the
76
+ history merge driver to keep provenance: its dedup identity omits `context`,
77
+ `event_class` and `reanchor_evidence`, so two records that match on everything
78
+ else collapse into one. That is tracked as pm-0574of. A
79
+ stream any of whose records lacks a parseable timestamp, or holds a baseline
80
+ with a malformed receipt, is unreadable for a takeover, and `history-compact`
81
+ refuses to prune such a record (it would launder the damage into a judgeable
82
+ stream). A takeover refuses when
83
+ the stream exists but cannot be read (`claim_activity.history_unreadable`),
84
+ because recent work may hide behind it. A threshold too large for the Date range reports
85
+ `eligible_at: null` rather than failing. `pm health` reports three advisories
86
+ in the storage check, none of which fails the verdict:
87
+
88
+ | Warning | Population | Remedy printed by `pm health` |
89
+ |---|---|---|
90
+ | `in_progress_unowned:<n>` | in-progress items with no assignee (so no live claim) | `pm list --status <in_progress> --assignee-filter unassigned` |
91
+ | `in_progress_idle:<n>` | in-progress items idle past the threshold, owned or not | `pm list --status <in_progress> --updated-before -<hours>h` |
92
+ | `stale_in_progress_items:<n>` | both: unowned and idle | `pm list --status <in_progress> --assignee-filter unassigned --updated-before -<hours>h` |
93
+
94
+ The storage check's `details.in_progress_work` lists up to 25 ids per group
95
+ with each group's sweep, plus the per-item recoveries `pm claim <id>` (unowned
96
+ work), `pm claim <id> --takeover-stale` (another holder's idle claim) and
97
+ `pm update <id> --status <open>`. Sweeps and recoveries carry `--pm-path` when
98
+ the diagnosed tracker was selected explicitly or through `PM_PATH`. A sweep is a candidate list by metadata
99
+ time: it can include an item whose history is newer than its `updated_at`
100
+ (for example after a restore), which the advisory does not count;
101
+ `pm claim <id> --takeover-stale` re-judges each one under the item lock. `pm context` reports `in_progress_unowned`
102
+ and `in_progress_idle` next to `in_progress` in its summary when they are
103
+ non-zero, so unattended work is not read as active work.
40
104
 
41
105
  A blocking secret policy may be bypassed only by an explicit `--force` on a
42
106
  force-capable mutation. The warning records that an override occurred while
@@ -49,7 +113,9 @@ Package hosts can apply the exact runtime policy before dispatch:
49
113
  ```ts
50
114
  import {
51
115
  evaluateMutationGuard,
116
+ inspectInProgressWork,
52
117
  inspectStaleInProgressItems,
118
+ resolveRuntimeStatusRegistry,
53
119
  scanMutationSecrets,
54
120
  } from "@unbrained/pm-cli/sdk";
55
121
 
@@ -65,8 +131,20 @@ const stale = inspectStaleInProgressItems(items, {
65
131
  projectSettings.schema.workflow.in_progress_status ?? "in_progress",
66
132
  threshold_hours: projectSettings.mutation_guard.stale_in_progress_hours,
67
133
  });
134
+ // Unowned, idle and stale groups from one pass; scanInProgressWork(pmRoot, ...)
135
+ // also reads history, but only for items whose metadata already looks idle.
136
+ // The registry resolves stored status aliases, as the in-progress counters do.
137
+ const work = inspectInProgressWork(items, {
138
+ status_registry: resolveRuntimeStatusRegistry(projectSettings.schema),
139
+ threshold_hours: projectSettings.mutation_guard.stale_in_progress_hours,
140
+ });
68
141
  ```
69
142
 
143
+ `resolveItemOwnershipActivity(pmRoot, id, holder, { updated_at, threshold_hours })`
144
+ returns the same claim evidence a refused `pm claim` reports, and
145
+ `buildInProgressSweepCommands(status, hours)` returns the exact list sweeps
146
+ `pm health` prints.
147
+
70
148
  `evaluateMutationGuard` returns stable warning codes, redacted findings, and
71
149
  whether a blocking policy was explicitly overridden. `scanMutationSecrets` is
72
150
  available separately for package-specific preflight UIs. Cyclic inputs are
package/docs/SDK.md CHANGED
@@ -1270,6 +1270,34 @@ filters, and bound the race-loss candidate walk with `maxAttempts` (1 through
1270
1270
  100 inclusive), so custom SDK
1271
1271
  tools do not need to reproduce CLI concurrency policy.
1272
1272
 
1273
+ Stale work uses one activity clock and one threshold
1274
+ (`mutation_guard.stale_in_progress_hours`, exported as
1275
+ `STALE_WORK_THRESHOLD_SETTING`) everywhere. Advisory results (`pm health`,
1276
+ `pm context`, `inspectInProgressWork`/`scanInProgressWork`, `held_by_others`)
1277
+ can still call an item idle when the takeover would refuse it: advisory reads
1278
+ degrade an unreadable history stream to metadata activity, while the ownership
1279
+ evaluation fails closed (`claim_activity.history_unreadable`, never stale).
1280
+ The takeover anchors on the holder's own claim record. A readable stream that
1281
+ cannot prove the holder's idleness from that record onward also fails closed
1282
+ (`claim_activity.unproven_activity`, never stale). The reasons are
1283
+ `claim_record_unavailable`, `discarded_history_tail`, `rewritten_history` and
1284
+ `workspace_restored`. `unprovenClaimActivity()` returns the reason a stream
1285
+ gives, and `UNPROVEN_ACTIVITY_REASONS` lists all of them. Establish takeover eligibility only through `resolveItemOwnershipActivity()` or
1286
+ the locked `pm claim --takeover-stale` decision, never from an advisory row. Each `held_by_others` row is a
1287
+ `NextHeldRow` with `claimed_at`, `idle_hours` and `stale`.
1288
+ `runClaim(id, false, global, { takeoverStale: true })` takes over only an idle
1289
+ claim and returns a `StaleClaimTakeoverReceipt` as `takeover`; an active claim
1290
+ throws `STALE_CLAIM_TAKEOVER_REFUSED_CODE` (`stale_claim_takeover_refused`) with
1291
+ `context.claim_activity`. `evaluateClaimActivity()` returns that evidence
1292
+ directly; `resolveItemOwnershipActivity()` returns an `ItemOwnershipActivity`
1293
+ (holder, `source` and `since`) that carries it as `.activity`, so read
1294
+ `.activity.history_unreadable`, `.activity.unproven_activity` and
1295
+ `.activity.stale_policy` there. `inspectInProgressWork()`
1296
+ and `scanInProgressWork()` classify in-progress work into `unowned`, `idle` and
1297
+ `stale` groups (pass `status_registry` so stored status aliases resolve the way
1298
+ the `in_progress` counters resolve them), and `buildInProgressSweepCommands()` returns the exact list
1299
+ sweeps `pm health` prints.
1300
+
1273
1301
  Lifecycle convenience methods and the matching top-level functions (`create`,
1274
1302
  `update`, `reopen`, `close`, `claim`, `release`, `copy`, `deleteItem`, `restore`,
1275
1303
  `focus`, `startTask`, `pauseTask`, and `closeTask`) use the same mutation paths
@@ -67,9 +67,9 @@ This file is generated by `listPmFlagLexicon()`. Compatibility aliases do not co
67
67
  | `gc` | workspace | 23 | 23 |
68
68
  | `workspace` | workspace | 24 | 24 |
69
69
  | `contracts` | quality | 30 | 30 |
70
- | `claim` | lifecycle | 40 | 40 |
70
+ | `claim` | lifecycle | 41 | 41 |
71
71
  | `release` | lifecycle | 26 | 26 |
72
- | `start-task` | lifecycle | 24 | 24 |
72
+ | `start-task` | lifecycle | 25 | 25 |
73
73
  | `pause-task` | lifecycle | 24 | 24 |
74
74
  | `close-task` | lifecycle | 25 | 25 |
75
75
  | `meet` | automation | 34 | 34 |
package/marketplace.json CHANGED
@@ -1 +1 @@
1
- {"name":"pm","owner":{"name":"unbrained","url":"https://github.com/unbraind/pm-cli"},"description":"Official marketplace for pm CLI — native git-based project management for Claude Code and AI coding agents.","version":"2026.11.15","plugins":[{"name":"pm-claude","source":"./plugins/pm-claude","description":"Native pm CLI integration for Claude Code — 32 MCP tools, 14 workflow skills with slash invocations, 4 subagents, hybrid TUI task tracking, session context injection, and coordination subagents for git-based project management without leaving Claude Code.","version":"2026.11.15","author":{"name":"unbrained","url":"https://github.com/unbraind/pm-cli"},"homepage":"https://github.com/unbraind/pm-cli","repository":"https://github.com/unbraind/pm-cli","license":"MIT","keywords":["pm-cli","project-management","mcp","tasks","agents","workflows","git-native","task-tracker","ai"],"category":"productivity"}]}
1
+ {"name":"pm","owner":{"name":"unbrained","url":"https://github.com/unbraind/pm-cli"},"description":"Official marketplace for pm CLI — native git-based project management for Claude Code and AI coding agents.","version":"2026.11.16","plugins":[{"name":"pm-claude","source":"./plugins/pm-claude","description":"Native pm CLI integration for Claude Code — 32 MCP tools, 14 workflow skills with slash invocations, 4 subagents, hybrid TUI task tracking, session context injection, and coordination subagents for git-based project management without leaving Claude Code.","version":"2026.11.16","author":{"name":"unbrained","url":"https://github.com/unbraind/pm-cli"},"homepage":"https://github.com/unbraind/pm-cli","repository":"https://github.com/unbraind/pm-cli","license":"MIT","keywords":["pm-cli","project-management","mcp","tasks","agents","workflows","git-native","task-tracker","ai"],"category":"productivity"}]}
@@ -44,7 +44,6 @@ Read this in other languages: English | [简体中文](./Readme_zh-CN.md)
44
44
  - [Bits and pieces](#bits-and-pieces)
45
45
  - [.parse() and .parseAsync()](#parse-and-parseasync)
46
46
  - [Parsing Configuration](#parsing-configuration)
47
- - [Legacy options as properties](#legacy-options-as-properties)
48
47
  - [TypeScript](#typescript)
49
48
  - [createCommand()](#createcommand)
50
49
  - [Node options such as `--harmony`](#node-options-such-as---harmony)
@@ -54,7 +53,6 @@ Read this in other languages: English | [简体中文](./Readme_zh-CN.md)
54
53
  - [Override exit and output handling](#override-exit-and-output-handling)
55
54
  - [Additional documentation](#additional-documentation)
56
55
  - [Support](#support)
57
- - [Commander for enterprise](#commander-for-enterprise)
58
56
 
59
57
  For information about terms used in this document see: [terminology](./docs/terminology.md)
60
58
 
@@ -367,7 +365,8 @@ Example file: [options-variadic.js](./examples/options-variadic.js)
367
365
  ```js
368
366
  program
369
367
  .option('-n, --number <numbers...>', 'specify numbers')
370
- .option('-l, --letter [letters...]', 'specify letters');
368
+ .option('-l, --letter [letters...]', 'specify letters')
369
+ .argument('[operand]');
371
370
 
372
371
  program.parse();
373
372
 
@@ -380,10 +379,10 @@ $ collect -n 1 2 3 --letter a b c
380
379
  Options: { number: [ '1', '2', '3' ], letter: [ 'a', 'b', 'c' ] }
381
380
  Remaining arguments: []
382
381
  $ collect --letter=A -n80 operand
383
- Options: { number: [ '80' ], letter: [ 'A' ] }
382
+ Options: { letter: [ 'A' ], number: [ '80' ] }
384
383
  Remaining arguments: [ 'operand' ]
385
384
  $ collect --letter -n 1 -n 2 3 -- operand
386
- Options: { number: [ '1', '2', '3' ], letter: true }
385
+ Options: { letter: true, number: [ '1', '2', '3' ] }
387
386
  Remaining arguments: [ 'operand' ]
388
387
  ```
389
388
 
@@ -670,7 +669,7 @@ Example file: [action-this.js](./examples/action-this.js)
670
669
  program
671
670
  .command('serve')
672
671
  .argument('<script>')
673
- .option('-p, --port <number>', 'port number', 80)
672
+ .option('-p, --port <number>', 'port number', '80')
674
673
  .action(function() {
675
674
  console.error('Run script %s on port %s', this.args[0], this.opts().port);
676
675
  });
@@ -1016,25 +1015,6 @@ By default, the option processing shows an error for an unknown option. To have
1016
1015
  By default, the argument processing displays an error for more command-arguments than expected.
1017
1016
  To suppress the error for excess arguments, use `.allowExcessArguments()`.
1018
1017
 
1019
- ### Legacy options as properties
1020
-
1021
- Before Commander 7, the option values were stored as properties on the command.
1022
- This was convenient to code, but the downside was possible clashes with
1023
- existing properties of `Command`.
1024
-
1025
- You can revert to the old behaviour to run unmodified legacy code by using `.storeOptionsAsProperties()`.
1026
-
1027
- ```js
1028
- program
1029
- .storeOptionsAsProperties()
1030
- .option('-d, --debug')
1031
- .action((commandAndOptions) => {
1032
- if (commandAndOptions.debug) {
1033
- console.error(`Called ${commandAndOptions.name()}`);
1034
- }
1035
- });
1036
- ```
1037
-
1038
1018
  ### TypeScript
1039
1019
 
1040
1020
  **extra-typings:** There is an optional project to infer extra type information from the option and argument definitions.
@@ -1075,7 +1055,7 @@ You can enable `--harmony` option in two ways:
1075
1055
 
1076
1056
  An executable subcommand is launched as a separate child process.
1077
1057
 
1078
- If you are using the node inspector for [debugging](https://nodejs.org/en/docs/guides/debugging-getting-started/) executable subcommands using `node --inspect` et al.,
1058
+ If you are using the node inspector for [debugging](https://nodejs.org/en/learn/getting-started/debugging) executable subcommands using `node --inspect` et al.,
1079
1059
  the inspector port is incremented by 1 for the spawned subcommand.
1080
1060
 
1081
1061
  If you are using VSCode to debug executable subcommands you need to set the `"autoAttachChildProcesses": true` flag in your `launch.json` configuration.
@@ -1164,9 +1144,3 @@ The current version of Commander is fully supported on Long Term Support version
1164
1144
  Older major versions of Commander receive security updates for 12 months. For more see: [Release Policy](./docs/release-policy.md).
1165
1145
 
1166
1146
  The main forum for free and community support is the project [Issues](https://github.com/tj/commander.js/issues) on GitHub.
1167
-
1168
- ### Commander for enterprise
1169
-
1170
- Available as part of the Tidelift Subscription
1171
-
1172
- The maintainers of Commander and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-commander?utm_source=npm-commander&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
@@ -18,4 +18,4 @@ export const createArgument = (name, description) =>
18
18
 
19
19
  export { Command, Option, Argument, Help };
20
20
  export { CommanderError, InvalidArgumentError };
21
- export { InvalidArgumentError as InvalidOptionArgumentError }; // Deprecated
21
+ export { InvalidArgumentError as InvalidOptionArgumentError };
@@ -975,7 +975,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
975
975
  // global overwrites local, like optsWithGlobals
976
976
  let source;
977
977
  this._getCommandAndAncestors().forEach((cmd) => {
978
- if (cmd.getOptionValueSource(key) !== undefined) {
978
+ if (Object.hasOwn(cmd._optionValueSources, key)) {
979
979
  source = cmd.getOptionValueSource(key);
980
980
  }
981
981
  });
@@ -1768,7 +1768,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1768
1768
 
1769
1769
  const negativeNumberArg = (arg) => {
1770
1770
  // return false if not a negative number
1771
- if (!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg)) return false;
1771
+ if (!/^-(\d+|\d*\.\d+)([eE][+-]?\d+)?$/.test(arg)) return false;
1772
1772
  // negative number is ok unless digit used as an option in command hierarchy
1773
1773
  return !this._getCommandAndAncestors().some((cmd) =>
1774
1774
  cmd.options
@@ -2366,7 +2366,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2366
2366
  * (This does not override a group set directly on the subcommand using .helpGroup().)
2367
2367
  *
2368
2368
  * @example
2369
- * program.commandsGroup('Development Commands:);
2369
+ * program.commandsGroup('Development Commands:');
2370
2370
  * program.command('watch')...
2371
2371
  * program.command('lint')...
2372
2372
  * ...
@@ -2562,7 +2562,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2562
2562
  * Pass in false to disable the built-in help option.
2563
2563
  *
2564
2564
  * @example
2565
- * program.helpOption('-?, --help' 'show help'); // customise
2565
+ * program.helpOption('-?, --help', 'show help'); // customise
2566
2566
  * program.helpOption(false); // disable
2567
2567
  *
2568
2568
  * @param {(string | boolean)} flags
@@ -2720,7 +2720,12 @@ function incrementNodeInspectorPort(args) {
2720
2720
  // Testing for these options:
2721
2721
  // --inspect[=[host:]port]
2722
2722
  // --inspect-brk[=[host:]port]
2723
+ // --inspect-wait[=[host:]port]
2723
2724
  // --inspect-port=[host:]port
2725
+ //
2726
+ // Host can be an IP literal encapsulated within square brackets (e.g. [::1]),
2727
+ // an IPv4 address in dotted-decimal form (e.g. 192.168.0.1), or a registered name.
2728
+ // https://www.rfc-editor.org/rfc/rfc3986.html#section-3.2.2
2724
2729
  return args.map((arg) => {
2725
2730
  if (!arg.startsWith('--inspect')) {
2726
2731
  return arg;
@@ -2729,24 +2734,32 @@ function incrementNodeInspectorPort(args) {
2729
2734
  let debugHost = '127.0.0.1';
2730
2735
  let debugPort = '9229';
2731
2736
  let match;
2732
- if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {
2737
+ if ((match = arg.match(/^(--inspect(-brk|-wait)?)$/)) !== null) {
2733
2738
  // e.g. --inspect
2734
2739
  debugOption = match[1];
2735
2740
  } else if (
2736
- (match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null
2741
+ (match = arg.match(
2742
+ /^(--inspect(-brk|-port|-wait)?)=(\[[^\]]+\]|[^:]+)$/,
2743
+ )) !== null
2737
2744
  ) {
2745
+ // Matches a host or a port, but not both. No colon to separate them.
2738
2746
  debugOption = match[1];
2739
2747
  if (/^\d+$/.test(match[3])) {
2748
+ // Plain digits so a port number.
2740
2749
  // e.g. --inspect=1234
2741
2750
  debugPort = match[3];
2742
2751
  } else {
2743
- // e.g. --inspect=localhost
2752
+ // Assume a host.
2753
+ // e.g. --inspect=localhost, --inspect=[::1], --inspect=192.168.0.1
2744
2754
  debugHost = match[3];
2745
2755
  }
2746
2756
  } else if (
2747
- (match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null
2757
+ (match = arg.match(
2758
+ /^(--inspect(-brk|-port|-wait)?)=(\[[^\]]+\]|[^:]+):(\d+)$/,
2759
+ )) !== null
2748
2760
  ) {
2749
- // e.g. --inspect=localhost:1234
2761
+ // Matched host:port pattern.
2762
+ // e.g. --inspect=localhost:1234, --inspect=[::1]:1234, --inspect=192.168.0.1:1234
2750
2763
  debugOption = match[1];
2751
2764
  debugHost = match[3];
2752
2765
  debugPort = match[4];
@@ -89,11 +89,15 @@ export class Help {
89
89
  visibleOptions.push(helpOption); // no changes needed
90
90
  } else if (helpOption.long && !removeLong) {
91
91
  visibleOptions.push(
92
- cmd.createOption(helpOption.long, helpOption.description),
92
+ cmd
93
+ .createOption(helpOption.long, helpOption.description)
94
+ .helpGroup(helpOption.helpGroupHeading),
93
95
  );
94
96
  } else if (helpOption.short && !removeShort) {
95
97
  visibleOptions.push(
96
- cmd.createOption(helpOption.short, helpOption.description),
98
+ cmd
99
+ .createOption(helpOption.short, helpOption.description)
100
+ .helpGroup(helpOption.helpGroupHeading),
97
101
  );
98
102
  }
99
103
  }
@@ -15,7 +15,7 @@ export class Option {
15
15
  this.required = flags.includes('<'); // A value must be supplied when the option is specified.
16
16
  this.optional = flags.includes('['); // A value is optional when the option is specified.
17
17
  // variadic test ignores <value,...> et al which might be used to describe custom splitting of single argument
18
- this.variadic = /\w\.\.\.[>\]]$/.test(flags); // The option can take multiple values.
18
+ this.variadic = /\p{ID_Continue}\.\.\.[>\]]$/u.test(flags); // The option can take multiple values.
19
19
  this.mandatory = false; // The option must have a value after parsing, which usually means it must be specified on command line.
20
20
  const optionFlags = splitOptionFlags(flags);
21
21
  this.short = optionFlags.shortFlag; // May be a short flag, undefined, or even a long flag (if option has two long flags).
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commander",
3
- "version": "15.0.0",
3
+ "version": "15.1.0",
4
4
  "description": "the complete solution for node.js command-line programs",
5
5
  "keywords": [
6
6
  "commander",
@@ -50,6 +50,7 @@
50
50
  "@types/node": "^22.7.4",
51
51
  "eslint": "^10.0.2",
52
52
  "eslint-config-prettier": "^10.0.1",
53
+ "eslint-node-test": "^1.0.0",
53
54
  "globals": "^17.3.0",
54
55
  "prettier": "^3.2.5",
55
56
  "tsd": "^0.33.0",