@unbrained/pm-cli 2026.5.18 → 2026.5.27

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 (369) hide show
  1. package/CHANGELOG.md +953 -472
  2. package/README.md +4 -11
  3. package/dist/cli/bootstrap-args.d.ts +18 -1
  4. package/dist/cli/bootstrap-args.js +143 -3
  5. package/dist/cli/bootstrap-args.js.map +1 -1
  6. package/dist/cli/commander-usage.js +147 -10
  7. package/dist/cli/commander-usage.js.map +1 -1
  8. package/dist/cli/commands/annotation-command.d.ts +49 -0
  9. package/dist/cli/commands/annotation-command.js +135 -0
  10. package/dist/cli/commands/annotation-command.js.map +1 -0
  11. package/dist/cli/commands/append.js +5 -8
  12. package/dist/cli/commands/append.js.map +1 -1
  13. package/dist/cli/commands/calendar.js +3 -6
  14. package/dist/cli/commands/calendar.js.map +1 -1
  15. package/dist/cli/commands/claim.js +15 -24
  16. package/dist/cli/commands/claim.js.map +1 -1
  17. package/dist/cli/commands/close.js +63 -10
  18. package/dist/cli/commands/close.js.map +1 -1
  19. package/dist/cli/commands/comments.d.ts +5 -0
  20. package/dist/cli/commands/comments.js +27 -117
  21. package/dist/cli/commands/comments.js.map +1 -1
  22. package/dist/cli/commands/completion.d.ts +2 -2
  23. package/dist/cli/commands/completion.js +203 -63
  24. package/dist/cli/commands/completion.js.map +1 -1
  25. package/dist/cli/commands/config.d.ts +1 -1
  26. package/dist/cli/commands/config.js +82 -4
  27. package/dist/cli/commands/config.js.map +1 -1
  28. package/dist/cli/commands/context.js +4 -10
  29. package/dist/cli/commands/context.js.map +1 -1
  30. package/dist/cli/commands/contracts.js +168 -36
  31. package/dist/cli/commands/contracts.js.map +1 -1
  32. package/dist/cli/commands/create.js +53 -313
  33. package/dist/cli/commands/create.js.map +1 -1
  34. package/dist/cli/commands/dedupe-audit.js +7 -4
  35. package/dist/cli/commands/dedupe-audit.js.map +1 -1
  36. package/dist/cli/commands/delete.d.ts +3 -0
  37. package/dist/cli/commands/delete.js +11 -9
  38. package/dist/cli/commands/delete.js.map +1 -1
  39. package/dist/cli/commands/docs.d.ts +2 -12
  40. package/dist/cli/commands/docs.js +8 -316
  41. package/dist/cli/commands/docs.js.map +1 -1
  42. package/dist/cli/commands/event-validation-messages.d.ts +3 -0
  43. package/dist/cli/commands/event-validation-messages.js +44 -0
  44. package/dist/cli/commands/event-validation-messages.js.map +1 -0
  45. package/dist/cli/commands/extension/bundled-catalog.d.ts +14 -0
  46. package/dist/cli/commands/extension/bundled-catalog.js +268 -0
  47. package/dist/cli/commands/extension/bundled-catalog.js.map +1 -0
  48. package/dist/cli/commands/extension/doctor.d.ts +31 -0
  49. package/dist/cli/commands/extension/doctor.js +345 -0
  50. package/dist/cli/commands/extension/doctor.js.map +1 -0
  51. package/dist/cli/commands/extension/install-sources.d.ts +37 -0
  52. package/dist/cli/commands/extension/install-sources.js +384 -0
  53. package/dist/cli/commands/extension/install-sources.js.map +1 -0
  54. package/dist/cli/commands/extension/managed-state.d.ts +48 -0
  55. package/dist/cli/commands/extension/managed-state.js +172 -0
  56. package/dist/cli/commands/extension/managed-state.js.map +1 -0
  57. package/dist/cli/commands/extension/scaffold.d.ts +14 -0
  58. package/dist/cli/commands/extension/scaffold.js +169 -0
  59. package/dist/cli/commands/extension/scaffold.js.map +1 -0
  60. package/dist/cli/commands/extension/shared.d.ts +14 -0
  61. package/dist/cli/commands/extension/shared.js +106 -0
  62. package/dist/cli/commands/extension/shared.js.map +1 -0
  63. package/dist/cli/commands/extension.d.ts +37 -68
  64. package/dist/cli/commands/extension.js +157 -1319
  65. package/dist/cli/commands/extension.js.map +1 -1
  66. package/dist/cli/commands/files.d.ts +1 -12
  67. package/dist/cli/commands/files.js +14 -318
  68. package/dist/cli/commands/files.js.map +1 -1
  69. package/dist/cli/commands/gc.js +17 -4
  70. package/dist/cli/commands/gc.js.map +1 -1
  71. package/dist/cli/commands/get.d.ts +3 -2
  72. package/dist/cli/commands/get.js +52 -9
  73. package/dist/cli/commands/get.js.map +1 -1
  74. package/dist/cli/commands/health.d.ts +10 -0
  75. package/dist/cli/commands/health.js +269 -76
  76. package/dist/cli/commands/health.js.map +1 -1
  77. package/dist/cli/commands/history-redact.d.ts +8 -0
  78. package/dist/cli/commands/history-redact.js +35 -113
  79. package/dist/cli/commands/history-redact.js.map +1 -1
  80. package/dist/cli/commands/history-repair.d.ts +33 -0
  81. package/dist/cli/commands/history-repair.js +172 -0
  82. package/dist/cli/commands/history-repair.js.map +1 -0
  83. package/dist/cli/commands/history.d.ts +4 -4
  84. package/dist/cli/commands/history.js +10 -88
  85. package/dist/cli/commands/history.js.map +1 -1
  86. package/dist/cli/commands/index.d.ts +3 -1
  87. package/dist/cli/commands/index.js +5 -3
  88. package/dist/cli/commands/index.js.map +1 -1
  89. package/dist/cli/commands/init.d.ts +28 -0
  90. package/dist/cli/commands/init.js +23 -2
  91. package/dist/cli/commands/init.js.map +1 -1
  92. package/dist/cli/commands/learnings.js +20 -119
  93. package/dist/cli/commands/learnings.js.map +1 -1
  94. package/dist/cli/commands/legacy-none-tokens.d.ts +3 -0
  95. package/dist/cli/commands/legacy-none-tokens.js +39 -0
  96. package/dist/cli/commands/legacy-none-tokens.js.map +1 -0
  97. package/dist/cli/commands/linked-artifacts.d.ts +96 -0
  98. package/dist/cli/commands/linked-artifacts.js +335 -0
  99. package/dist/cli/commands/linked-artifacts.js.map +1 -0
  100. package/dist/cli/commands/linked-test-entry.d.ts +3 -0
  101. package/dist/cli/commands/linked-test-entry.js +62 -0
  102. package/dist/cli/commands/linked-test-entry.js.map +1 -0
  103. package/dist/cli/commands/linked-test-parsers.d.ts +28 -0
  104. package/dist/cli/commands/linked-test-parsers.js +192 -0
  105. package/dist/cli/commands/linked-test-parsers.js.map +1 -0
  106. package/dist/cli/commands/list.js +49 -24
  107. package/dist/cli/commands/list.js.map +1 -1
  108. package/dist/cli/commands/normalize.js +4 -3
  109. package/dist/cli/commands/normalize.js.map +1 -1
  110. package/dist/cli/commands/notes.js +20 -119
  111. package/dist/cli/commands/notes.js.map +1 -1
  112. package/dist/cli/commands/plan.d.ts +3 -0
  113. package/dist/cli/commands/plan.js +184 -22
  114. package/dist/cli/commands/plan.js.map +1 -1
  115. package/dist/cli/commands/recurrence-parsers.d.ts +26 -0
  116. package/dist/cli/commands/recurrence-parsers.js +98 -0
  117. package/dist/cli/commands/recurrence-parsers.js.map +1 -0
  118. package/dist/cli/commands/restore.js +24 -56
  119. package/dist/cli/commands/restore.js.map +1 -1
  120. package/dist/cli/commands/schema.d.ts +31 -0
  121. package/dist/cli/commands/schema.js +98 -0
  122. package/dist/cli/commands/schema.js.map +1 -0
  123. package/dist/cli/commands/search.js +154 -42
  124. package/dist/cli/commands/search.js.map +1 -1
  125. package/dist/cli/commands/templates.d.ts +4 -0
  126. package/dist/cli/commands/templates.js +89 -17
  127. package/dist/cli/commands/templates.js.map +1 -1
  128. package/dist/cli/commands/test/linked-command-detection.d.ts +37 -0
  129. package/dist/cli/commands/test/linked-command-detection.js +200 -0
  130. package/dist/cli/commands/test/linked-command-detection.js.map +1 -0
  131. package/dist/cli/commands/test-all.js +4 -8
  132. package/dist/cli/commands/test-all.js.map +1 -1
  133. package/dist/cli/commands/test.d.ts +2 -2
  134. package/dist/cli/commands/test.js +12 -357
  135. package/dist/cli/commands/test.js.map +1 -1
  136. package/dist/cli/commands/update-many.js +6 -9
  137. package/dist/cli/commands/update-many.js.map +1 -1
  138. package/dist/cli/commands/update.js +167 -401
  139. package/dist/cli/commands/update.js.map +1 -1
  140. package/dist/cli/commands/validate.d.ts +3 -1
  141. package/dist/cli/commands/validate.js +23 -71
  142. package/dist/cli/commands/validate.js.map +1 -1
  143. package/dist/cli/error-guidance.d.ts +1 -0
  144. package/dist/cli/error-guidance.js +100 -6
  145. package/dist/cli/error-guidance.js.map +1 -1
  146. package/dist/cli/extension-command-help.d.ts +0 -1
  147. package/dist/cli/extension-command-help.js +2 -13
  148. package/dist/cli/extension-command-help.js.map +1 -1
  149. package/dist/cli/extension-command-options.d.ts +1 -0
  150. package/dist/cli/extension-command-options.js +106 -7
  151. package/dist/cli/extension-command-options.js.map +1 -1
  152. package/dist/cli/help-content.d.ts +0 -1
  153. package/dist/cli/help-content.js +13 -9
  154. package/dist/cli/help-content.js.map +1 -1
  155. package/dist/cli/help-json-payload.d.ts +1 -0
  156. package/dist/cli/help-json-payload.js +33 -3
  157. package/dist/cli/help-json-payload.js.map +1 -1
  158. package/dist/cli/main.d.ts +11 -0
  159. package/dist/cli/main.js +109 -55
  160. package/dist/cli/main.js.map +1 -1
  161. package/dist/cli/register-list-query.d.ts +5 -2
  162. package/dist/cli/register-list-query.js +254 -192
  163. package/dist/cli/register-list-query.js.map +1 -1
  164. package/dist/cli/register-mutation.d.ts +1 -1
  165. package/dist/cli/register-mutation.js +247 -64
  166. package/dist/cli/register-mutation.js.map +1 -1
  167. package/dist/cli/register-operations.js +17 -12
  168. package/dist/cli/register-operations.js.map +1 -1
  169. package/dist/cli/register-setup.js +33 -16
  170. package/dist/cli/register-setup.js.map +1 -1
  171. package/dist/cli/registration-helpers.d.ts +0 -2
  172. package/dist/cli/registration-helpers.js +14 -40
  173. package/dist/cli/registration-helpers.js.map +1 -1
  174. package/dist/cli.js +25 -4
  175. package/dist/cli.js.map +1 -1
  176. package/dist/core/config/positional-value.d.ts +44 -0
  177. package/dist/core/config/positional-value.js +109 -0
  178. package/dist/core/config/positional-value.js.map +1 -0
  179. package/dist/core/extensions/extension-capability-aliases.d.ts +14 -0
  180. package/dist/core/extensions/extension-capability-aliases.js +159 -0
  181. package/dist/core/extensions/extension-capability-aliases.js.map +1 -0
  182. package/dist/core/extensions/extension-hook-runtime.d.ts +13 -0
  183. package/dist/core/extensions/extension-hook-runtime.js +414 -0
  184. package/dist/core/extensions/extension-hook-runtime.js.map +1 -0
  185. package/dist/core/extensions/extension-policy.d.ts +69 -0
  186. package/dist/core/extensions/extension-policy.js +481 -0
  187. package/dist/core/extensions/extension-policy.js.map +1 -0
  188. package/dist/core/extensions/extension-registries.d.ts +8 -0
  189. package/dist/core/extensions/extension-registries.js +52 -0
  190. package/dist/core/extensions/extension-registries.js.map +1 -0
  191. package/dist/core/extensions/extension-runtime-helpers.d.ts +6 -0
  192. package/dist/core/extensions/extension-runtime-helpers.js +29 -0
  193. package/dist/core/extensions/extension-runtime-helpers.js.map +1 -0
  194. package/dist/core/extensions/extension-types.d.ts +13 -39
  195. package/dist/core/extensions/extension-types.js +34 -2
  196. package/dist/core/extensions/extension-types.js.map +1 -1
  197. package/dist/core/extensions/index.d.ts +7 -1
  198. package/dist/core/extensions/index.js +11 -14
  199. package/dist/core/extensions/index.js.map +1 -1
  200. package/dist/core/extensions/loader.d.ts +4 -22
  201. package/dist/core/extensions/loader.js +23 -1146
  202. package/dist/core/extensions/loader.js.map +1 -1
  203. package/dist/core/fs/path-utils.d.ts +1 -0
  204. package/dist/core/fs/path-utils.js +12 -0
  205. package/dist/core/fs/path-utils.js.map +1 -0
  206. package/dist/core/history/drift-scan.d.ts +22 -0
  207. package/dist/core/history/drift-scan.js +149 -0
  208. package/dist/core/history/drift-scan.js.map +1 -0
  209. package/dist/core/history/history-rewrite.d.ts +43 -0
  210. package/dist/core/history/history-rewrite.js +48 -0
  211. package/dist/core/history/history-rewrite.js.map +1 -0
  212. package/dist/core/history/history.js +5 -4
  213. package/dist/core/history/history.js.map +1 -1
  214. package/dist/core/history/replay.d.ts +82 -0
  215. package/dist/core/history/replay.js +250 -0
  216. package/dist/core/history/replay.js.map +1 -0
  217. package/dist/core/item/item-format.js +11 -8
  218. package/dist/core/item/item-format.js.map +1 -1
  219. package/dist/core/item/item-record.d.ts +19 -0
  220. package/dist/core/item/item-record.js +24 -0
  221. package/dist/core/item/item-record.js.map +1 -0
  222. package/dist/core/item/item-type-definition.d.ts +52 -0
  223. package/dist/core/item/item-type-definition.js +123 -0
  224. package/dist/core/item/item-type-definition.js.map +1 -0
  225. package/dist/core/item/parse.js +3 -2
  226. package/dist/core/item/parse.js.map +1 -1
  227. package/dist/core/item/priority.d.ts +23 -0
  228. package/dist/core/item/priority.js +55 -0
  229. package/dist/core/item/priority.js.map +1 -0
  230. package/dist/core/item/status.d.ts +14 -1
  231. package/dist/core/item/status.js +22 -2
  232. package/dist/core/item/status.js.map +1 -1
  233. package/dist/core/item/toon-decode.d.ts +19 -0
  234. package/dist/core/item/toon-decode.js +69 -0
  235. package/dist/core/item/toon-decode.js.map +1 -0
  236. package/dist/core/item/type-registry.js +13 -84
  237. package/dist/core/item/type-registry.js.map +1 -1
  238. package/dist/core/output/mutation-projection.d.ts +31 -0
  239. package/dist/core/output/mutation-projection.js +103 -0
  240. package/dist/core/output/mutation-projection.js.map +1 -0
  241. package/dist/core/output/output.d.ts +2 -0
  242. package/dist/core/output/output.js +5 -3
  243. package/dist/core/output/output.js.map +1 -1
  244. package/dist/core/packages/manifest.js +3 -9
  245. package/dist/core/packages/manifest.js.map +1 -1
  246. package/dist/core/schema/item-types-file.d.ts +85 -0
  247. package/dist/core/schema/item-types-file.js +243 -0
  248. package/dist/core/schema/item-types-file.js.map +1 -0
  249. package/dist/core/schema/runtime-schema.d.ts +2 -1
  250. package/dist/core/schema/runtime-schema.js +17 -45
  251. package/dist/core/schema/runtime-schema.js.map +1 -1
  252. package/dist/core/search/semantic-defaults.js +3 -3
  253. package/dist/core/search/semantic-defaults.js.map +1 -1
  254. package/dist/core/search/vector-stores.js +46 -9
  255. package/dist/core/search/vector-stores.js.map +1 -1
  256. package/dist/core/sentry/helpers.d.ts +1 -1
  257. package/dist/core/sentry/helpers.js +20 -3
  258. package/dist/core/sentry/helpers.js.map +1 -1
  259. package/dist/core/shared/author.d.ts +1 -0
  260. package/dist/core/shared/author.js +9 -0
  261. package/dist/core/shared/author.js.map +1 -0
  262. package/dist/core/shared/command-types.d.ts +1 -0
  263. package/dist/core/shared/command-types.js +2 -2
  264. package/dist/core/shared/command-types.js.map +1 -1
  265. package/dist/core/shared/constants.d.ts +10 -1
  266. package/dist/core/shared/constants.js +56 -58
  267. package/dist/core/shared/constants.js.map +1 -1
  268. package/dist/core/shared/lazy-module.d.ts +1 -0
  269. package/dist/core/shared/lazy-module.js +11 -0
  270. package/dist/core/shared/lazy-module.js.map +1 -0
  271. package/dist/core/shared/option-alias-visibility.d.ts +44 -0
  272. package/dist/core/shared/option-alias-visibility.js +76 -0
  273. package/dist/core/shared/option-alias-visibility.js.map +1 -0
  274. package/dist/core/shared/primitives.d.ts +23 -0
  275. package/dist/core/shared/primitives.js +39 -2
  276. package/dist/core/shared/primitives.js.map +1 -1
  277. package/dist/core/shared/text-normalization.d.ts +0 -1
  278. package/dist/core/shared/text-normalization.js +2 -5
  279. package/dist/core/shared/text-normalization.js.map +1 -1
  280. package/dist/core/store/front-matter-cache.d.ts +16 -2
  281. package/dist/core/store/front-matter-cache.js +99 -33
  282. package/dist/core/store/front-matter-cache.js.map +1 -1
  283. package/dist/core/store/item-store.d.ts +2 -0
  284. package/dist/core/store/item-store.js +76 -110
  285. package/dist/core/store/item-store.js.map +1 -1
  286. package/dist/core/store/settings-validator.d.ts +106 -0
  287. package/dist/core/store/settings-validator.js +279 -0
  288. package/dist/core/store/settings-validator.js.map +1 -0
  289. package/dist/core/store/settings.js +6 -343
  290. package/dist/core/store/settings.js.map +1 -1
  291. package/dist/core/telemetry/runtime.js +5 -3
  292. package/dist/core/telemetry/runtime.js.map +1 -1
  293. package/dist/mcp/server.js +138 -39
  294. package/dist/mcp/server.js.map +1 -1
  295. package/dist/sdk/cli-contracts/enum-contracts.d.ts +20 -0
  296. package/dist/sdk/cli-contracts/enum-contracts.js +156 -0
  297. package/dist/sdk/cli-contracts/enum-contracts.js.map +1 -0
  298. package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +14 -0
  299. package/dist/sdk/cli-contracts/tool-option-contracts.js +243 -0
  300. package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -0
  301. package/dist/sdk/cli-contracts/tool-parameter-tables.d.ts +11 -0
  302. package/dist/sdk/cli-contracts/tool-parameter-tables.js +901 -0
  303. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -0
  304. package/dist/sdk/cli-contracts.d.ts +18 -33
  305. package/dist/sdk/cli-contracts.js +96 -1238
  306. package/dist/sdk/cli-contracts.js.map +1 -1
  307. package/dist/sdk/package-import-adapters.d.ts +74 -0
  308. package/dist/sdk/package-import-adapters.js +186 -0
  309. package/dist/sdk/package-import-adapters.js.map +1 -0
  310. package/dist/sdk/package-runtime-options.d.ts +26 -0
  311. package/dist/sdk/package-runtime-options.js +71 -0
  312. package/dist/sdk/package-runtime-options.js.map +1 -0
  313. package/dist/sdk/runtime.d.ts +27 -1
  314. package/dist/sdk/runtime.js +48 -3
  315. package/dist/sdk/runtime.js.map +1 -1
  316. package/dist/types.d.ts +6 -0
  317. package/dist/types.js +10 -2
  318. package/dist/types.js.map +1 -1
  319. package/docs/AGENT_GUIDE.md +13 -11
  320. package/docs/ARCHITECTURE.md +1 -1
  321. package/docs/CLAUDE_CODE_PLUGIN.md +5 -28
  322. package/docs/CODEX_PLUGIN.md +5 -5
  323. package/docs/COMMANDS.md +58 -9
  324. package/docs/CONFIGURATION.md +16 -1
  325. package/docs/EXTENSIONS.md +4 -63
  326. package/docs/RELEASING.md +12 -8
  327. package/docs/SDK.md +11 -2
  328. package/marketplace.json +7 -3
  329. package/package.json +18 -14
  330. package/packages/pm-beads/extensions/beads/index.js +2 -49
  331. package/packages/pm-beads/extensions/beads/index.ts +2 -54
  332. package/packages/pm-beads/extensions/beads/runtime-loader.js +86 -0
  333. package/packages/pm-beads/extensions/beads/runtime-loader.ts +88 -0
  334. package/packages/pm-beads/extensions/beads/runtime.js +26 -115
  335. package/packages/pm-beads/extensions/beads/runtime.ts +33 -132
  336. package/packages/pm-calendar/README.md +3 -1
  337. package/packages/pm-calendar/extensions/calendar/index.js +66 -2
  338. package/packages/pm-calendar/extensions/calendar/index.ts +71 -2
  339. package/packages/pm-calendar/extensions/calendar/runtime.js +1 -0
  340. package/packages/pm-calendar/extensions/calendar/runtime.ts +1 -0
  341. package/packages/pm-governance-audit/extensions/governance-audit/runtime.js +14 -41
  342. package/packages/pm-governance-audit/extensions/governance-audit/runtime.ts +25 -41
  343. package/packages/pm-guide-shell/extensions/guide-shell/runtime.js +10 -50
  344. package/packages/pm-guide-shell/extensions/guide-shell/runtime.ts +17 -50
  345. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/runtime.js +8 -40
  346. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/runtime.ts +10 -40
  347. package/packages/pm-search-advanced/README.md +8 -0
  348. package/packages/pm-search-advanced/extensions/search-advanced/index.js +75 -1
  349. package/packages/pm-search-advanced/extensions/search-advanced/index.ts +74 -0
  350. package/packages/pm-search-advanced/extensions/search-advanced/runtime.js +58 -33
  351. package/packages/pm-search-advanced/extensions/search-advanced/runtime.ts +60 -33
  352. package/packages/pm-templates/extensions/templates/runtime.js +11 -202
  353. package/packages/pm-templates/extensions/templates/runtime.ts +38 -230
  354. package/packages/pm-todos/extensions/todos/index.js +3 -50
  355. package/packages/pm-todos/extensions/todos/index.ts +3 -55
  356. package/packages/pm-todos/extensions/todos/runtime-loader.js +86 -0
  357. package/packages/pm-todos/extensions/todos/runtime-loader.ts +88 -0
  358. package/packages/pm-todos/extensions/todos/runtime.js +24 -117
  359. package/packages/pm-todos/extensions/todos/runtime.ts +32 -129
  360. package/plugins/pm-claude/README.md +2 -2
  361. package/plugins/pm-claude/commands/pm-planner.md +1 -15
  362. package/plugins/pm-claude/scripts/pm-mcp-server.mjs +5 -2
  363. package/plugins/pm-claude/skills/pm-planner/SKILL.md +3 -21
  364. package/plugins/pm-codex/scripts/pm-mcp-server.mjs +15 -6
  365. package/plugins/pm-codex/skills/pm-native/SKILL.md +1 -13
  366. package/PRD.md +0 -1734
  367. package/dist/core/output/command-aware.d.ts +0 -1
  368. package/dist/core/output/command-aware.js +0 -397
  369. package/dist/core/output/command-aware.js.map +0 -1
@@ -1,13 +1,13 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="877f600b-5e09-5d62-bf4e-7bf9f9e38289")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="43221c16-6351-5238-a4d1-d94619239fb2")}catch(e){}}();
3
3
  import fs from "node:fs/promises";
4
4
  import path from "node:path";
5
5
  import { resolveItemTypeRegistry } from "../../core/item/type-registry.js";
6
6
  import { pathExists, readFileIfExists } from "../../core/fs/fs-utils.js";
7
7
  import { activateExtensions, getActiveExtensionRegistrations, loadExtensions, runActiveOnReadHooks } from "../../core/extensions/index.js";
8
8
  import { EXTENSION_CAPABILITY_CONTRACT, KNOWN_EXTENSION_CAPABILITIES, parseLegacyExtensionCapabilityAliasWarning, parseUnknownExtensionCapabilityWarning, } from "../../core/extensions/loader.js";
9
- import { hashDocument } from "../../core/history/history.js";
10
9
  import { enforceHistoryStreamPolicyForItems } from "../../core/history/history-stream-policy.js";
10
+ import { scanHistoryDrift } from "../../core/history/drift-scan.js";
11
11
  import { readVectorizationStatusLedger, refreshSemanticEmbeddingsForMutatedItems, } from "../../core/search/cache.js";
12
12
  import { resolveEmbeddingProviders } from "../../core/search/providers.js";
13
13
  import { resolveSettingsWithSemanticRuntimeDefaults } from "../../core/search/semantic-defaults.js";
@@ -18,16 +18,25 @@ import { PmCliError } from "../../core/shared/errors.js";
18
18
  import { toNonEmptyStringOrUndefined } from "../../core/shared/primitives.js";
19
19
  import { nowIso } from "../../core/shared/time.js";
20
20
  import { parseItemDocument } from "../../core/item/item-format.js";
21
- import { listAllFrontMatterWithBody } from "../../core/store/item-store.js";
22
- import { getHistoryPath, getItemFormatFromPath, getSettingsPath, ITEM_FILE_EXTENSIONS, resolveGlobalPmRoot, resolvePmRoot, } from "../../core/store/paths.js";
21
+ import { listAllFrontMatter, listAllFrontMatterWithBody } from "../../core/store/item-store.js";
22
+ import { getItemFormatFromPath, getSettingsPath, ITEM_FILE_EXTENSIONS, resolveGlobalPmRoot, resolvePmRoot, } from "../../core/store/paths.js";
23
23
  import { readSettingsWithMetadata } from "../../core/store/settings.js";
24
24
  import { readManagedExtensionState } from "./extension.js";
25
- import { verifyHistoryChain } from "./history.js";
26
25
  const STALE_VECTORIZATION_SUMMARY_LIMIT = 25;
26
+ const BRIEF_HEALTH_DETAIL_LIMIT = 8;
27
27
  const TELEMETRY_QUEUE_RELATIVE_PATH = path.join("runtime", "telemetry", "events.jsonl");
28
28
  const TELEMETRY_STATE_RELATIVE_PATH = path.join("runtime", "telemetry", "state.json");
29
29
  const TELEMETRY_ENDPOINT_PROBE_TIMEOUT_MS = 2_500;
30
30
  const TELEMETRY_QUEUE_HIGH_WATER_MARK = 500;
31
+ /**
32
+ * Advisory warnings are surfaced for visibility but never flip overall health to
33
+ * not-ok. Telemetry is opt-out, non-critical observability: a queued/unreachable
34
+ * telemetry endpoint or corrupt local telemetry state is not a project-health
35
+ * failure and must not block agents that gate on `pm health` `ok`.
36
+ */
37
+ function isAdvisoryHealthWarning(warning) {
38
+ return warning.startsWith("telemetry_");
39
+ }
31
40
  function warningCode(value) {
32
41
  const normalized = value.trim();
33
42
  const separator = normalized.indexOf(":");
@@ -550,6 +559,227 @@ function summarizeList(values, limit) {
550
559
  truncated: true,
551
560
  };
552
561
  }
562
+ function summarizeRecordList(value, limit) {
563
+ if (!Array.isArray(value)) {
564
+ return {
565
+ count: 0,
566
+ sample: [],
567
+ truncated: false,
568
+ };
569
+ }
570
+ return {
571
+ count: value.length,
572
+ sample: value.slice(0, limit),
573
+ truncated: value.length > limit,
574
+ };
575
+ }
576
+ function summarizeExtensionRecord(value) {
577
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
578
+ return {};
579
+ }
580
+ const record = value;
581
+ return {
582
+ layer: record.layer,
583
+ directory: record.directory,
584
+ name: record.name,
585
+ version: record.version,
586
+ enabled: record.enabled,
587
+ status: record.status,
588
+ has_activate: record.has_activate,
589
+ capabilities: record.capabilities,
590
+ };
591
+ }
592
+ function summarizeExtensionList(value, limit) {
593
+ const summary = summarizeRecordList(value, limit);
594
+ return {
595
+ ...summary,
596
+ sample: summary.sample.map((entry) => summarizeExtensionRecord(entry)),
597
+ };
598
+ }
599
+ function summarizeStringList(value, limit) {
600
+ if (!Array.isArray(value)) {
601
+ return {
602
+ count: 0,
603
+ sample: [],
604
+ truncated: false,
605
+ };
606
+ }
607
+ const strings = value.filter((entry) => typeof entry === "string");
608
+ return {
609
+ count: strings.length,
610
+ sample: strings.slice(0, limit),
611
+ truncated: strings.length > limit,
612
+ };
613
+ }
614
+ function summarizeHealthCheckDetails(check, limit) {
615
+ const details = check.details;
616
+ if (check.name === "settings") {
617
+ return {
618
+ version: details.version,
619
+ id_prefix: details.id_prefix,
620
+ locks_ttl_seconds: details.locks_ttl_seconds,
621
+ warnings: summarizeStringList(details.warnings, limit),
622
+ };
623
+ }
624
+ if (check.name === "directories") {
625
+ return {
626
+ required_count: Array.isArray(details.required) ? details.required.length : 0,
627
+ optional_count: Array.isArray(details.optional) ? details.optional.length : 0,
628
+ missing_required: summarizeStringList(details.missing_required, limit),
629
+ missing_optional: summarizeStringList(details.missing_optional, limit),
630
+ missing: summarizeStringList(details.missing, limit),
631
+ strict_directories: details.strict_directories,
632
+ };
633
+ }
634
+ if (check.name === "settings_values") {
635
+ return {
636
+ warnings: summarizeStringList(details.warnings, limit),
637
+ };
638
+ }
639
+ if (check.name === "telemetry") {
640
+ return {
641
+ enabled: details.enabled,
642
+ capture_level: details.capture_level,
643
+ endpoint: details.endpoint,
644
+ queue_exists: details.queue_exists,
645
+ queue_entries: details.queue_entries,
646
+ queue_draining: details.queue_draining,
647
+ queue_invalid_rows: details.queue_invalid_rows,
648
+ queue_rows_total: details.queue_rows_total,
649
+ last_successful_flush_at: details.last_successful_flush_at,
650
+ last_failed_flush_at: details.last_failed_flush_at,
651
+ endpoint_probe: details.endpoint_probe,
652
+ env_overrides: details.env_overrides,
653
+ };
654
+ }
655
+ if (check.name === "extensions") {
656
+ const activation = typeof details.activation === "object" && details.activation !== null ? details.activation : {};
657
+ return {
658
+ disabled_by_flag: details.disabled_by_flag,
659
+ discovered: summarizeExtensionList(details.discovered, limit),
660
+ effective: summarizeExtensionList(details.effective, limit),
661
+ loaded: summarizeExtensionList(details.loaded, limit),
662
+ failed: summarizeRecordList(details.failed, limit),
663
+ warnings: summarizeStringList(details.warnings, limit),
664
+ activation: {
665
+ failed: summarizeRecordList(activation.failed, limit),
666
+ warnings: summarizeStringList(activation.warnings, limit),
667
+ hook_counts: activation.hook_counts,
668
+ command_handler_count: activation.command_handler_count,
669
+ service_override_count: activation.service_override_count,
670
+ renderer_override_count: activation.renderer_override_count,
671
+ registration_counts: activation.registration_counts,
672
+ migration_status: typeof activation.migration_status === "object" && activation.migration_status !== null
673
+ ? {
674
+ applied_count: activation.migration_status.applied_count,
675
+ pending_count: activation.migration_status.pending_count,
676
+ failed_count: activation.migration_status.failed_count,
677
+ }
678
+ : null,
679
+ },
680
+ triage: details.triage,
681
+ capability_contract: details.capability_contract,
682
+ capability_guidance: summarizeRecordList(details.capability_guidance, limit),
683
+ };
684
+ }
685
+ if (check.name === "storage") {
686
+ return details;
687
+ }
688
+ if (check.name === "integrity") {
689
+ return {
690
+ checked_item_files: details.checked_item_files,
691
+ checked_history_streams: details.checked_history_streams,
692
+ counts: details.counts,
693
+ item_unreadable: summarizeStringList(details.item_unreadable, limit),
694
+ item_conflict_markers: summarizeRecordList(details.item_conflict_markers, limit),
695
+ item_parse_failures: summarizeStringList(details.item_parse_failures, limit),
696
+ history_unreadable: summarizeStringList(details.history_unreadable, limit),
697
+ history_conflict_markers: summarizeRecordList(details.history_conflict_markers, limit),
698
+ history_invalid_json: summarizeRecordList(details.history_invalid_json, limit),
699
+ skipped: details.skipped,
700
+ };
701
+ }
702
+ if (check.name === "history_drift") {
703
+ return {
704
+ checked_items: details.checked_items,
705
+ counts: details.counts,
706
+ drifted_items: summarizeStringList(details.drifted_items, limit),
707
+ missing_streams: summarizeStringList(details.missing_streams, limit),
708
+ unreadable_streams: summarizeStringList(details.unreadable_streams, limit),
709
+ hash_mismatches: summarizeStringList(details.hash_mismatches, limit),
710
+ chain_mismatches: summarizeStringList(details.chain_mismatches, limit),
711
+ skipped: details.skipped,
712
+ };
713
+ }
714
+ if (check.name === "vectorization") {
715
+ return {
716
+ semantic_runtime_available: details.semantic_runtime_available,
717
+ compatibility_mode_auto_defaults: details.compatibility_mode_auto_defaults,
718
+ auto_ollama_defaults_applied: details.auto_ollama_defaults_applied,
719
+ refresh_policy: details.refresh_policy,
720
+ provider_active: details.provider_active,
721
+ vector_store_active: details.vector_store_active,
722
+ items: details.items,
723
+ ledger_entries_before: details.ledger_entries_before,
724
+ stale_items_before_total: details.stale_items_before_total,
725
+ stale_items_before: summarizeStringList(details.stale_items_before, limit),
726
+ refresh_attempted: details.refresh_attempted,
727
+ refresh_skipped_reason: details.refresh_skipped_reason,
728
+ refresh_result: details.refresh_result,
729
+ ledger_entries_after: details.ledger_entries_after,
730
+ stale_items_after_total: details.stale_items_after_total,
731
+ stale_items_after: summarizeStringList(details.stale_items_after, limit),
732
+ skipped: details.skipped,
733
+ };
734
+ }
735
+ return details;
736
+ }
737
+ function applyBriefHealthProjection(result) {
738
+ const warningsSummary = summarizeStringList(result.warnings, BRIEF_HEALTH_DETAIL_LIMIT);
739
+ return {
740
+ ok: result.ok,
741
+ checks: result.checks.map((check) => ({
742
+ name: check.name,
743
+ status: check.status,
744
+ details: summarizeHealthCheckDetails(check, BRIEF_HEALTH_DETAIL_LIMIT),
745
+ })),
746
+ warnings: warningsSummary.sample,
747
+ projection: {
748
+ mode: "brief",
749
+ warning_count: warningsSummary.count,
750
+ warnings_truncated: warningsSummary.truncated,
751
+ detail_limit: BRIEF_HEALTH_DETAIL_LIMIT,
752
+ },
753
+ generated_at: result.generated_at,
754
+ };
755
+ }
756
+ function isSkippedHealthCheck(check) {
757
+ return check.details.skipped === true;
758
+ }
759
+ function applySummaryHealthProjection(result) {
760
+ const warningsSummary = summarizeStringList(result.warnings, BRIEF_HEALTH_DETAIL_LIMIT);
761
+ const omittedChecks = result.checks.filter(isSkippedHealthCheck).map((check) => check.name);
762
+ return {
763
+ ok: result.ok,
764
+ checks: result.checks
765
+ .filter((check) => !isSkippedHealthCheck(check))
766
+ .map((check) => ({
767
+ name: check.name,
768
+ status: check.status,
769
+ details: {},
770
+ })),
771
+ warning_count: warningsSummary.count,
772
+ warnings: warningsSummary.sample,
773
+ projection: {
774
+ mode: "summary",
775
+ warning_count: warningsSummary.count,
776
+ warnings_truncated: warningsSummary.truncated,
777
+ detail_limit: BRIEF_HEALTH_DETAIL_LIMIT,
778
+ omitted_checks: omittedChecks,
779
+ },
780
+ generated_at: result.generated_at,
781
+ };
782
+ }
553
783
  function selectStaleItemDetail(values, verboseStaleItems) {
554
784
  if (verboseStaleItems) {
555
785
  return {
@@ -732,7 +962,8 @@ async function buildTelemetryCheck(settings, options) {
732
962
  attempted: false,
733
963
  },
734
964
  env_overrides: {
735
- telemetry_disabled: telemetryEnvFlagEnabled("PM_TELEMETRY_DISABLED"),
965
+ telemetry_disabled: telemetryEnvFlagEnabled("PM_TELEMETRY_DISABLED") || telemetryEnvFlagEnabled("PM_NO_TELEMETRY"),
966
+ pm_no_telemetry: telemetryEnvFlagEnabled("PM_NO_TELEMETRY"),
736
967
  telemetry_otel_disabled: telemetryEnvFlagEnabled("PM_TELEMETRY_OTEL_DISABLED"),
737
968
  },
738
969
  },
@@ -741,61 +972,7 @@ async function buildTelemetryCheck(settings, options) {
741
972
  };
742
973
  }
743
974
  async function buildHistoryDriftCheck(pmRoot, items) {
744
- const missingStreams = [];
745
- const unreadableStreams = [];
746
- const hashMismatches = [];
747
- const chainMismatches = [];
748
- for (const item of items) {
749
- const historyPath = getHistoryPath(pmRoot, item.id);
750
- let latestAfterHash = null;
751
- try {
752
- const raw = await fs.readFile(historyPath, "utf8");
753
- if (raw.trim().length === 0) {
754
- missingStreams.push(item.id);
755
- continue;
756
- }
757
- const lines = raw.split(/\r?\n/);
758
- const entries = [];
759
- for (const line of lines) {
760
- const trimmed = line.trim();
761
- if (trimmed.length === 0) {
762
- continue;
763
- }
764
- const parsed = JSON.parse(trimmed);
765
- if (typeof parsed.after_hash !== "string" || parsed.after_hash.trim().length === 0) {
766
- throw new Error("missing after_hash");
767
- }
768
- entries.push(parsed);
769
- latestAfterHash = parsed.after_hash;
770
- }
771
- const chainVerification = verifyHistoryChain(entries);
772
- if (!chainVerification.ok) {
773
- chainMismatches.push(item.id);
774
- }
775
- }
776
- catch (error) {
777
- if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
778
- missingStreams.push(item.id);
779
- }
780
- else {
781
- unreadableStreams.push(item.id);
782
- }
783
- continue;
784
- }
785
- if (!latestAfterHash) {
786
- missingStreams.push(item.id);
787
- continue;
788
- }
789
- const { body, ...frontMatter } = item;
790
- const currentHash = hashDocument({
791
- metadata: frontMatter,
792
- body,
793
- });
794
- if (latestAfterHash !== currentHash) {
795
- hashMismatches.push(item.id);
796
- }
797
- }
798
- const driftedItems = [...new Set([...missingStreams, ...unreadableStreams, ...hashMismatches, ...chainMismatches])].sort((a, b) => a.localeCompare(b));
975
+ const { missingStreams, unreadableStreams, hashMismatches, chainMismatches, driftedItems } = await scanHistoryDrift(pmRoot, items);
799
976
  const warnings = [
800
977
  ...missingStreams.map((id) => `history_drift_missing_stream:${id}`),
801
978
  ...unreadableStreams.map((id) => `history_drift_unreadable_stream:${id}`),
@@ -973,28 +1150,35 @@ export async function runHealth(global, options = {}) {
973
1150
  checkTelemetry: options.checkTelemetry === true,
974
1151
  });
975
1152
  const extensionCheck = await buildExtensionCheck(pmRoot, settings, Boolean(global.noExtensions));
1153
+ const summaryMode = options.summary === true && options.full !== true;
1154
+ const fastProjectionCheckOnly = options.checkOnly === true && (options.brief === true || options.summary === true) && options.full !== true;
1155
+ const skipIntegrity = (options.skipIntegrity === true || fastProjectionCheckOnly) && options.full !== true;
1156
+ const skipDrift = (options.skipDrift === true || fastProjectionCheckOnly) && options.full !== true;
1157
+ const skipVectors = (options.skipVectors === true || fastProjectionCheckOnly) && options.full !== true;
976
1158
  const itemReadWarnings = [];
977
- const items = await listAllFrontMatterWithBody(pmRoot, settings.item_format, typeRegistry.type_to_folder, itemReadWarnings, settings.schema);
1159
+ const items = skipDrift && skipVectors
1160
+ ? await listAllFrontMatter(pmRoot, settings.item_format, typeRegistry.type_to_folder, itemReadWarnings, settings.schema)
1161
+ : await listAllFrontMatterWithBody(pmRoot, settings.item_format, typeRegistry.type_to_folder, itemReadWarnings, settings.schema);
1162
+ const itemsWithBody = items;
978
1163
  const normalizedItemReadWarnings = [...new Set(itemReadWarnings)];
979
- const historyPolicy = await enforceHistoryStreamPolicyForItems({
980
- pmRoot,
981
- settings,
982
- itemIds: items.map((item) => item.id),
983
- commandLabel: "health",
984
- });
1164
+ const historyPolicy = skipDrift
1165
+ ? { warnings: [] }
1166
+ : await enforceHistoryStreamPolicyForItems({
1167
+ pmRoot,
1168
+ settings,
1169
+ itemIds: items.map((item) => item.id),
1170
+ commandLabel: "health",
1171
+ });
985
1172
  const historySummary = await countHistoryStreams(pmRoot);
986
- const skipIntegrity = options.skipIntegrity === true && options.full !== true;
987
- const skipDrift = options.skipDrift === true && options.full !== true;
988
- const skipVectors = options.skipVectors === true && options.full !== true;
989
1173
  const integrityCheck = skipIntegrity
990
1174
  ? { check: { name: "integrity", status: "ok", details: { skipped: true } }, warnings: [] }
991
1175
  : await buildIntegrityCheck(pmRoot, typeRegistry.type_to_folder, settings.schema);
992
1176
  const historyDriftCheck = skipDrift
993
1177
  ? { check: { name: "history_drift", status: "ok", details: { skipped: true } }, warnings: [] }
994
- : await buildHistoryDriftCheck(pmRoot, items);
1178
+ : await buildHistoryDriftCheck(pmRoot, itemsWithBody);
995
1179
  const vectorizationCheck = skipVectors
996
1180
  ? { check: { name: "vectorization", status: "ok", details: { skipped: true } }, warnings: [] }
997
- : await buildVectorizationCheck(pmRoot, settings, items, refreshPolicy, options.verboseStaleItems === true);
1181
+ : await buildVectorizationCheck(pmRoot, settings, itemsWithBody, refreshPolicy, options.verboseStaleItems === true);
998
1182
  const checks = [
999
1183
  {
1000
1184
  name: "settings",
@@ -1055,12 +1239,21 @@ export async function runHealth(global, options = {}) {
1055
1239
  ...hookWarnings,
1056
1240
  ];
1057
1241
  const normalizedWarnings = [...new Set(warnings)];
1058
- return {
1059
- ok: normalizedWarnings.length === 0,
1242
+ // Telemetry is an opt-out, non-critical observability feature. Its operational
1243
+ // state (queue backlog, unreachable endpoint, corrupt local state) is advisory:
1244
+ // it must never flip overall project health to not-ok. Such warnings are still
1245
+ // surfaced in `warnings` and the telemetry check's own `warn` status.
1246
+ const blockingWarnings = normalizedWarnings.filter((warning) => !isAdvisoryHealthWarning(warning));
1247
+ const result = {
1248
+ ok: blockingWarnings.length === 0,
1060
1249
  checks,
1061
1250
  warnings: normalizedWarnings,
1062
1251
  generated_at: nowIso(),
1063
1252
  };
1253
+ if (summaryMode) {
1254
+ return applySummaryHealthProjection(result);
1255
+ }
1256
+ return options.brief === true ? applyBriefHealthProjection(result) : result;
1064
1257
  }
1065
1258
  //# sourceMappingURL=health.js.map
1066
- //# debugId=877f600b-5e09-5d62-bf4e-7bf9f9e38289
1259
+ //# debugId=43221c16-6351-5238-a4d1-d94619239fb2