@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 +1 @@
1
- {"version":3,"file":"constants.js","sources":["core/shared/constants.ts"],"sourceRoot":"/","sourcesContent":["import type { BuiltinItemType, GovernancePreset, GovernanceSettings, ItemFrontMatter, PmSettings } from \"../../types/index.js\";\n\nexport const PM_DIRNAME = \".agents/pm\";\nexport const SETTINGS_FILENAME = \"settings.json\";\n\nexport const PM_CORE_REQUIRED_SUBDIRS = [\n \"\",\n \"epics\",\n \"features\",\n \"tasks\",\n \"chores\",\n \"issues\",\n \"schema\",\n \"history\",\n \"index\",\n \"search\",\n \"extensions\",\n \"locks\",\n] as const;\n\nexport const PM_OPTIONAL_TYPE_SUBDIRS = [\n \"decisions\",\n \"events\",\n \"reminders\",\n \"milestones\",\n \"meetings\",\n \"plans\",\n] as const;\n\nexport const PM_REQUIRED_SUBDIRS = [...PM_CORE_REQUIRED_SUBDIRS, ...PM_OPTIONAL_TYPE_SUBDIRS] as const;\n\nexport const TYPE_TO_FOLDER: Record<BuiltinItemType, string> = {\n Epic: \"epics\",\n Feature: \"features\",\n Task: \"tasks\",\n Chore: \"chores\",\n Issue: \"issues\",\n Decision: \"decisions\",\n Event: \"events\",\n Reminder: \"reminders\",\n Milestone: \"milestones\",\n Meeting: \"meetings\",\n Plan: \"plans\",\n};\n\nexport const FRONT_MATTER_KEY_ORDER: ReadonlyArray<string> = [\n \"id\",\n \"title\",\n \"description\",\n \"type\",\n \"source_type\",\n \"type_options\",\n \"status\",\n \"priority\",\n \"tags\",\n \"created_at\",\n \"updated_at\",\n \"deadline\",\n \"reminders\",\n \"events\",\n \"closed_at\",\n \"assignee\",\n \"source_owner\",\n \"author\",\n \"estimated_minutes\",\n \"acceptance_criteria\",\n \"design\",\n \"external_ref\",\n \"definition_of_ready\",\n \"order\",\n \"goal\",\n \"objective\",\n \"value\",\n \"impact\",\n \"outcome\",\n \"why_now\",\n \"parent\",\n \"reviewer\",\n \"risk\",\n \"confidence\",\n \"sprint\",\n \"release\",\n \"blocked_by\",\n \"blocked_reason\",\n \"unblock_note\",\n \"reporter\",\n \"severity\",\n \"environment\",\n \"repro_steps\",\n \"resolution\",\n \"expected_result\",\n \"actual_result\",\n \"affected_version\",\n \"fixed_version\",\n \"component\",\n \"regression\",\n \"customer_impact\",\n \"dependencies\",\n \"comments\",\n \"notes\",\n \"learnings\",\n \"files\",\n \"tests\",\n \"test_runs\",\n \"docs\",\n \"close_reason\",\n \"plan_mode\",\n \"plan_scope\",\n \"plan_harness\",\n \"plan_resume_context\",\n \"plan_validation\",\n \"plan_decisions\",\n \"plan_discoveries\",\n \"plan_steps\",\n];\n\ntype BuiltinGovernancePreset = Exclude<GovernancePreset, \"custom\">;\n\nexport const GOVERNANCE_PRESET_DEFAULTS: Record<BuiltinGovernancePreset, Omit<GovernanceSettings, \"preset\">> = {\n minimal: {\n ownership_enforcement: \"none\",\n create_mode_default: \"progressive\",\n close_validation_default: \"off\",\n parent_reference: \"warn\",\n metadata_profile: \"core\",\n force_required_for_stale_lock: false,\n },\n default: {\n ownership_enforcement: \"warn\",\n create_mode_default: \"progressive\",\n close_validation_default: \"warn\",\n parent_reference: \"warn\",\n metadata_profile: \"core\",\n force_required_for_stale_lock: true,\n },\n strict: {\n ownership_enforcement: \"strict\",\n create_mode_default: \"strict\",\n close_validation_default: \"strict\",\n parent_reference: \"strict_error\",\n metadata_profile: \"strict\",\n force_required_for_stale_lock: true,\n },\n};\n\nexport const DEFAULT_VALIDATE_STALE_BLOCKER_REASON_PATTERNS = [\n \"no active blocker\",\n \"ready for planned execution sequencing\",\n \"work completed\",\n \"work is closed\",\n] as const;\n\nexport const DEFAULT_VALIDATE_CLOSURE_LIKE_METADATA_FIELD_PATTERNS = {\n blocked_reason: [\"no active blocker because work is closed\", \"work is closed\"],\n resolution: [\"closed with implementation evidence\", \"closed with verification evidence\", \"work completed and recorded\", \"work is closed\"],\n actual_result: [\"closed and recorded\", \"work completed\", \"work completed and recorded\"],\n} as const;\n\nexport const SETTINGS_DEFAULTS: PmSettings = {\n version: 1,\n id_prefix: \"pm-\",\n author_default: \"\",\n item_format: \"toon\",\n locks: {\n ttl_seconds: 1800,\n },\n output: {\n default_format: \"toon\",\n },\n history: {\n missing_stream: \"auto_create\",\n },\n validation: {\n sprint_release_format: \"warn\",\n parent_reference: \"warn\",\n metadata_profile: \"core\",\n metadata_required_fields: [],\n lifecycle_stale_blocker_reason_patterns: [...DEFAULT_VALIDATE_STALE_BLOCKER_REASON_PATTERNS],\n lifecycle_closure_like_blocked_reason_patterns: [\n ...DEFAULT_VALIDATE_CLOSURE_LIKE_METADATA_FIELD_PATTERNS.blocked_reason,\n ],\n lifecycle_closure_like_resolution_patterns: [...DEFAULT_VALIDATE_CLOSURE_LIKE_METADATA_FIELD_PATTERNS.resolution],\n lifecycle_closure_like_actual_result_patterns: [\n ...DEFAULT_VALIDATE_CLOSURE_LIKE_METADATA_FIELD_PATTERNS.actual_result,\n ],\n },\n governance: {\n preset: \"minimal\",\n ...GOVERNANCE_PRESET_DEFAULTS.minimal,\n },\n workflow: {\n definition_of_done: [],\n },\n testing: {\n record_results_to_items: false,\n },\n telemetry: {\n enabled: true,\n first_run_prompt_completed: false,\n capture_level: \"redacted\",\n endpoint: \"https://pm-cli.unbrained.dev/v1/events\",\n installation_id: \"\",\n retention_days: 365,\n },\n agent_guidance: {\n prompt_completed: false,\n declined: false,\n declined_at: \"\",\n template_version: 1,\n last_checked_files: [],\n },\n item_types: {\n definitions: [],\n },\n schema: {\n version: 1,\n files: {\n types: \"schema/types.json\",\n statuses: \"schema/statuses.json\",\n fields: \"schema/fields.json\",\n workflows: \"schema/workflows.json\",\n },\n statuses: [\n {\n id: \"draft\",\n roles: [\"draft\"],\n },\n {\n id: \"open\",\n roles: [\"active\", \"default_open\"],\n },\n {\n id: \"in_progress\",\n aliases: [\"in-progress\"],\n roles: [\"active\"],\n },\n {\n id: \"blocked\",\n roles: [\"blocked\"],\n },\n {\n id: \"closed\",\n roles: [\"terminal\", \"terminal_done\", \"default_close\"],\n },\n {\n id: \"canceled\",\n aliases: [\"cancelled\"],\n roles: [\"terminal\", \"terminal_canceled\", \"default_cancel\"],\n },\n ],\n fields: [],\n workflow: {\n draft_status: \"draft\",\n open_status: \"open\",\n in_progress_status: \"in_progress\",\n blocked_status: \"blocked\",\n close_status: \"closed\",\n canceled_status: \"canceled\",\n },\n unknown_field_policy: \"allow\",\n },\n extensions: {\n enabled: [],\n disabled: [],\n policy: {\n mode: \"off\",\n trust_mode: \"off\",\n require_provenance: false,\n trusted_extensions: [],\n default_sandbox_profile: \"none\",\n allowed_extensions: [],\n blocked_extensions: [],\n allowed_capabilities: [],\n blocked_capabilities: [],\n allowed_surfaces: [],\n blocked_surfaces: [],\n allowed_commands: [],\n blocked_commands: [],\n allowed_actions: [],\n blocked_actions: [],\n allowed_services: [],\n blocked_services: [],\n extension_overrides: [],\n },\n },\n search: {\n score_threshold: 0,\n hybrid_semantic_weight: 0.7,\n max_results: 50,\n embedding_model: \"\",\n embedding_batch_size: 32,\n embedding_timeout_ms: 30_000,\n scanner_max_batch_retries: 3,\n provider: \"\",\n },\n providers: {\n openai: {\n base_url: \"\",\n api_key: \"\",\n model: \"\",\n },\n ollama: {\n base_url: \"\",\n model: \"\",\n },\n },\n context: {\n default_depth: \"brief\",\n activity_limit: 10,\n stale_threshold_days: 7,\n sections: {\n hierarchy: true,\n activity: true,\n progress: true,\n blockers: true,\n files: true,\n workload: true,\n staleness: true,\n tests: true,\n },\n },\n vector_store: {\n adapter: \"\",\n qdrant: {\n url: \"\",\n api_key: \"\",\n },\n lancedb: {\n path: \"\",\n },\n },\n};\n\nexport const EMPTY_CANONICAL_DOCUMENT = {\n metadata: {},\n body: \"\",\n};\n\nexport const EXIT_CODE = {\n SUCCESS: 0,\n GENERIC_FAILURE: 1,\n USAGE: 2,\n NOT_FOUND: 3,\n CONFLICT: 4,\n DEPENDENCY_FAILED: 5,\n} as const;\n\nexport type TelemetryErrorCategory = \"usage\" | \"validation\" | \"conflict\" | \"runtime\" | \"unknown\";\n\nexport const TELEMETRY_ERROR_CATEGORY_BY_CODE: Readonly<Record<string, TelemetryErrorCategory>> = Object.freeze({\n unknown_command: \"usage\",\n unknown_option: \"usage\",\n missing_required_option: \"usage\",\n missing_required_argument: \"usage\",\n invalid_command_usage: \"usage\",\n invalid_argument_value: \"validation\",\n health_findings: \"validation\",\n validation_findings: \"validation\",\n close_through_update: \"validation\",\n no_update_fields: \"validation\",\n unsupported_update_option: \"validation\",\n tracker_not_initialized: \"validation\",\n item_not_found: \"validation\",\n ownership_conflict: \"conflict\",\n lock_conflict: \"conflict\",\n terminal_state_conflict: \"conflict\",\n dependency_failed: \"runtime\",\n command_failed: \"runtime\",\n unknown_error: \"runtime\",\n});\n\nexport function resolveTelemetryErrorCategory(errorCode: string | undefined): TelemetryErrorCategory {\n const normalized = (errorCode ?? \"\").trim().toLowerCase();\n if (normalized.length === 0) {\n return \"unknown\";\n }\n const explicit = TELEMETRY_ERROR_CATEGORY_BY_CODE[normalized];\n if (typeof explicit === \"string\") {\n return explicit;\n }\n if (normalized.includes(\"conflict\") || normalized.includes(\"locked\")) {\n return \"conflict\";\n }\n if (normalized.startsWith(\"unknown_\") || normalized.startsWith(\"missing_required_\")) {\n return \"usage\";\n }\n if (normalized.startsWith(\"invalid_\") || normalized.endsWith(\"_not_found\") || normalized.includes(\"validation\")) {\n return \"validation\";\n }\n if (normalized.endsWith(\"_error\") || normalized.endsWith(\"_failed\")) {\n return \"runtime\";\n }\n return \"unknown\";\n}\n"],"names":[],"mappings":";;AAEA,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAAC;AACvC,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAAC;AAEjD,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,EAAE;IACF,OAAO;IACP,UAAU;IACV,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,OAAO;IACP,QAAQ;IACR,YAAY;IACZ,OAAO;CACC,CAAC;AAEX,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,WAAW;IACX,QAAQ;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,CAAC;IACjB,CAAC;IACD,IAAI,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QAChH,OAAO,YAAY,CAAC;IACtB,CAAC;IACD,IAAI,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QACpE,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","debugId":"eaae02cf-f02a-5928-abdb-9bcd9a7842bc"}
1
+ {"version":3,"file":"constants.js","sources":["core/shared/constants.ts"],"sourceRoot":"/","sourcesContent":["import type {\n BuiltinItemType,\n GovernancePreset,\n GovernanceSettings,\n ItemFrontMatter,\n PmSettings,\n RuntimeStatusDefinition,\n RuntimeWorkflowDefinition,\n} from \"../../types/index.js\";\nimport { createDefaultExtensionGovernancePolicy } from \"../extensions/extension-types.js\";\n\n/**\n * Canonical default lifecycle status model and workflow role mapping.\n *\n * Single source of truth: `SETTINGS_DEFAULTS.schema` references these, and\n * `src/core/schema/runtime-schema.ts` re-exports them as\n * `DEFAULT_RUNTIME_STATUS_DEFINITIONS` / `DEFAULT_RUNTIME_WORKFLOW`.\n */\nexport const DEFAULT_STATUS_DEFINITIONS: ReadonlyArray<RuntimeStatusDefinition> = Object.freeze([\n {\n id: \"draft\",\n roles: [\"draft\"],\n },\n {\n id: \"open\",\n roles: [\"active\", \"default_open\"],\n },\n {\n id: \"in_progress\",\n aliases: [\"in-progress\"],\n roles: [\"active\"],\n },\n {\n id: \"blocked\",\n roles: [\"blocked\"],\n },\n {\n id: \"closed\",\n roles: [\"terminal\", \"terminal_done\", \"default_close\"],\n },\n {\n id: \"canceled\",\n aliases: [\"cancelled\"],\n roles: [\"terminal\", \"terminal_canceled\", \"default_cancel\"],\n },\n]);\n\nexport const DEFAULT_WORKFLOW_DEFINITION: RuntimeWorkflowDefinition = Object.freeze({\n draft_status: \"draft\",\n open_status: \"open\",\n in_progress_status: \"in_progress\",\n blocked_status: \"blocked\",\n close_status: \"closed\",\n canceled_status: \"canceled\",\n});\n\nexport const PM_DIRNAME = \".agents/pm\";\nexport const SETTINGS_FILENAME = \"settings.json\";\n\nexport const PM_CORE_REQUIRED_SUBDIRS = [\n \"\",\n \"epics\",\n \"features\",\n \"tasks\",\n \"chores\",\n \"issues\",\n \"schema\",\n \"history\",\n \"index\",\n \"search\",\n \"extensions\",\n \"locks\",\n] as const;\n\nexport const PM_OPTIONAL_TYPE_SUBDIRS = [\n \"decisions\",\n \"events\",\n \"reminders\",\n \"milestones\",\n \"meetings\",\n \"plans\",\n] as const;\n\nexport const PM_REQUIRED_SUBDIRS = [...PM_CORE_REQUIRED_SUBDIRS, ...PM_OPTIONAL_TYPE_SUBDIRS] as const;\n\nexport const TYPE_TO_FOLDER: Record<BuiltinItemType, string> = {\n Epic: \"epics\",\n Feature: \"features\",\n Task: \"tasks\",\n Chore: \"chores\",\n Issue: \"issues\",\n Decision: \"decisions\",\n Event: \"events\",\n Reminder: \"reminders\",\n Milestone: \"milestones\",\n Meeting: \"meetings\",\n Plan: \"plans\",\n};\n\nexport const FRONT_MATTER_KEY_ORDER: ReadonlyArray<string> = [\n \"id\",\n \"title\",\n \"description\",\n \"type\",\n \"source_type\",\n \"type_options\",\n \"status\",\n \"priority\",\n \"tags\",\n \"created_at\",\n \"updated_at\",\n \"deadline\",\n \"reminders\",\n \"events\",\n \"closed_at\",\n \"assignee\",\n \"source_owner\",\n \"author\",\n \"estimated_minutes\",\n \"acceptance_criteria\",\n \"design\",\n \"external_ref\",\n \"definition_of_ready\",\n \"order\",\n \"goal\",\n \"objective\",\n \"value\",\n \"impact\",\n \"outcome\",\n \"why_now\",\n \"parent\",\n \"reviewer\",\n \"risk\",\n \"confidence\",\n \"sprint\",\n \"release\",\n \"blocked_by\",\n \"blocked_reason\",\n \"unblock_note\",\n \"reporter\",\n \"severity\",\n \"environment\",\n \"repro_steps\",\n \"resolution\",\n \"expected_result\",\n \"actual_result\",\n \"affected_version\",\n \"fixed_version\",\n \"component\",\n \"regression\",\n \"customer_impact\",\n \"dependencies\",\n \"comments\",\n \"notes\",\n \"learnings\",\n \"files\",\n \"tests\",\n \"test_runs\",\n \"docs\",\n \"close_reason\",\n \"plan_mode\",\n \"plan_scope\",\n \"plan_harness\",\n \"plan_resume_context\",\n \"plan_validation\",\n \"plan_decisions\",\n \"plan_discoveries\",\n \"plan_steps\",\n];\n\ntype BuiltinGovernancePreset = Exclude<GovernancePreset, \"custom\">;\n\nexport const GOVERNANCE_PRESET_DEFAULTS: Record<BuiltinGovernancePreset, Omit<GovernanceSettings, \"preset\">> = {\n minimal: {\n ownership_enforcement: \"none\",\n create_mode_default: \"progressive\",\n close_validation_default: \"off\",\n parent_reference: \"warn\",\n metadata_profile: \"core\",\n force_required_for_stale_lock: false,\n },\n default: {\n ownership_enforcement: \"warn\",\n create_mode_default: \"progressive\",\n close_validation_default: \"warn\",\n parent_reference: \"warn\",\n metadata_profile: \"core\",\n force_required_for_stale_lock: true,\n },\n strict: {\n ownership_enforcement: \"strict\",\n create_mode_default: \"strict\",\n close_validation_default: \"strict\",\n parent_reference: \"strict_error\",\n metadata_profile: \"strict\",\n force_required_for_stale_lock: true,\n },\n};\n\nexport const DEFAULT_VALIDATE_STALE_BLOCKER_REASON_PATTERNS = [\n \"no active blocker\",\n \"ready for planned execution sequencing\",\n \"work completed\",\n \"work is closed\",\n] as const;\n\nexport const DEFAULT_VALIDATE_CLOSURE_LIKE_METADATA_FIELD_PATTERNS = {\n blocked_reason: [\"no active blocker because work is closed\", \"work is closed\"],\n resolution: [\"closed with implementation evidence\", \"closed with verification evidence\", \"work completed and recorded\", \"work is closed\"],\n actual_result: [\"closed and recorded\", \"work completed\", \"work completed and recorded\"],\n} as const;\n\nfunction cloneOptionalArray<T>(values: readonly T[] | undefined): T[] | undefined {\n return values ? [...values] : undefined;\n}\n\nexport const SETTINGS_DEFAULTS: PmSettings = {\n version: 1,\n id_prefix: \"pm-\",\n author_default: \"\",\n item_format: \"toon\",\n locks: {\n ttl_seconds: 1800,\n },\n output: {\n default_format: \"toon\",\n },\n history: {\n missing_stream: \"auto_create\",\n },\n validation: {\n sprint_release_format: \"warn\",\n parent_reference: \"warn\",\n metadata_profile: \"core\",\n metadata_required_fields: [],\n lifecycle_stale_blocker_reason_patterns: [...DEFAULT_VALIDATE_STALE_BLOCKER_REASON_PATTERNS],\n lifecycle_closure_like_blocked_reason_patterns: [\n ...DEFAULT_VALIDATE_CLOSURE_LIKE_METADATA_FIELD_PATTERNS.blocked_reason,\n ],\n lifecycle_closure_like_resolution_patterns: [...DEFAULT_VALIDATE_CLOSURE_LIKE_METADATA_FIELD_PATTERNS.resolution],\n lifecycle_closure_like_actual_result_patterns: [\n ...DEFAULT_VALIDATE_CLOSURE_LIKE_METADATA_FIELD_PATTERNS.actual_result,\n ],\n },\n governance: {\n preset: \"minimal\",\n ...GOVERNANCE_PRESET_DEFAULTS.minimal,\n },\n workflow: {\n definition_of_done: [],\n },\n testing: {\n record_results_to_items: false,\n },\n telemetry: {\n enabled: true,\n first_run_prompt_completed: false,\n capture_level: \"redacted\",\n endpoint: \"https://pm-cli.unbrained.dev/v1/events\",\n installation_id: \"\",\n retention_days: 365,\n },\n agent_guidance: {\n prompt_completed: false,\n declined: false,\n declined_at: \"\",\n template_version: 1,\n last_checked_files: [],\n },\n item_types: {\n definitions: [],\n },\n schema: {\n version: 1,\n files: {\n types: \"schema/types.json\",\n statuses: \"schema/statuses.json\",\n fields: \"schema/fields.json\",\n workflows: \"schema/workflows.json\",\n },\n statuses: DEFAULT_STATUS_DEFINITIONS.map((definition) => ({\n ...definition,\n aliases: cloneOptionalArray(definition.aliases),\n roles: cloneOptionalArray(definition.roles),\n })),\n fields: [],\n workflow: { ...DEFAULT_WORKFLOW_DEFINITION },\n unknown_field_policy: \"allow\",\n },\n extensions: {\n enabled: [],\n disabled: [],\n policy: createDefaultExtensionGovernancePolicy(),\n },\n search: {\n score_threshold: 0,\n hybrid_semantic_weight: 0.7,\n max_results: 50,\n embedding_model: \"\",\n embedding_batch_size: 32,\n embedding_timeout_ms: 30_000,\n scanner_max_batch_retries: 3,\n provider: \"\",\n },\n providers: {\n openai: {\n base_url: \"\",\n api_key: \"\",\n model: \"\",\n },\n ollama: {\n base_url: \"\",\n model: \"\",\n },\n },\n context: {\n default_depth: \"brief\",\n activity_limit: 10,\n stale_threshold_days: 7,\n sections: {\n hierarchy: true,\n activity: true,\n progress: true,\n blockers: true,\n files: true,\n workload: true,\n staleness: true,\n tests: true,\n },\n },\n vector_store: {\n adapter: \"\",\n qdrant: {\n url: \"\",\n api_key: \"\",\n },\n lancedb: {\n path: \"\",\n },\n },\n};\n\nexport const EMPTY_CANONICAL_DOCUMENT = {\n metadata: {},\n body: \"\",\n};\n\nexport const EXIT_CODE = {\n SUCCESS: 0,\n GENERIC_FAILURE: 1,\n USAGE: 2,\n NOT_FOUND: 3,\n CONFLICT: 4,\n DEPENDENCY_FAILED: 5,\n} as const;\n\nexport type TelemetryErrorCategory = \"usage\" | \"validation\" | \"conflict\" | \"runtime\" | \"unknown\";\n\nexport const TELEMETRY_ERROR_CATEGORY_BY_CODE: Readonly<Record<string, TelemetryErrorCategory>> = Object.freeze({\n unknown_command: \"usage\",\n unknown_option: \"usage\",\n missing_required_option: \"usage\",\n missing_required_argument: \"usage\",\n invalid_command_usage: \"usage\",\n invalid_argument_value: \"validation\",\n health_findings: \"validation\",\n validation_findings: \"validation\",\n close_through_update: \"validation\",\n no_update_fields: \"validation\",\n unsupported_update_option: \"validation\",\n tracker_not_initialized: \"validation\",\n item_not_found: \"validation\",\n ownership_conflict: \"conflict\",\n lock_conflict: \"conflict\",\n terminal_state_conflict: \"conflict\",\n dependency_failed: \"runtime\",\n command_failed: \"runtime\",\n unknown_error: \"runtime\",\n});\n\nexport function resolveTelemetryErrorCategory(errorCode: string | undefined): TelemetryErrorCategory {\n const normalized = (errorCode ?? \"\").trim().toLowerCase();\n if (normalized.length === 0) {\n return \"unknown\";\n }\n const explicit = TELEMETRY_ERROR_CATEGORY_BY_CODE[normalized];\n if (typeof explicit === \"string\") {\n return explicit;\n }\n if (normalized.includes(\"conflict\") || normalized.includes(\"locked\")) {\n return \"conflict\";\n }\n if (normalized.startsWith(\"unknown_\") || normalized.startsWith(\"missing_required_\")) {\n return \"usage\";\n }\n if (normalized.startsWith(\"invalid_\") || normalized.endsWith(\"_not_found\") || normalized.includes(\"validation\")) {\n return \"validation\";\n }\n if (normalized.endsWith(\"_error\") || normalized.endsWith(\"_failed\")) {\n return \"runtime\";\n }\n return \"unknown\";\n}\n"],"names":[],"mappings":";;AASA,OAAO,EAAE,sCAAsC,EAAE,MAAM,kCAAkC,CAAC;AAE1F;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAA2C,MAAM,CAAC,MAAM,CAAC;IAC9F;QACE,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,CAAC,OAAO,CAAC;KACjB;IACD;QACE,EAAE,EAAE,MAAM;QACV,KAAK,EAAE,CAAC,QAAQ,EAAE,cAAc,CAAC;KAClC;IACD;QACE,EAAE,EAAE,aAAa;QACjB,OAAO,EAAE,CAAC,aAAa,CAAC;QACxB,KAAK,EAAE,CAAC,QAAQ,CAAC;KAClB;IACD;QACE,EAAE,EAAE,SAAS;QACb,KAAK,EAAE,CAAC,SAAS,CAAC;KACnB;IACD;QACE,EAAE,EAAE,QAAQ;QACZ,KAAK,EAAE,CAAC,UAAU,EAAE,eAAe,EAAE,eAAe,CAAC;KACtD;IACD;QACE,EAAE,EAAE,UAAU;QACd,OAAO,EAAE,CAAC,WAAW,CAAC;QACtB,KAAK,EAAE,CAAC,UAAU,EAAE,mBAAmB,EAAE,gBAAgB,CAAC;KAC3D;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,2BAA2B,GAA8B,MAAM,CAAC,M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SAAS,CAAC,EAAE,CAAC;QACpE,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","debugId":"7ad6d040-d32b-5ce2-adf9-3c5cc6cf13de"}
@@ -0,0 +1 @@
1
+ export declare function createLazyModule<T>(importer: () => Promise<T>): () => Promise<T>;
@@ -0,0 +1,11 @@
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]="8a197e16-769b-582e-833f-997a66d98407")}catch(e){}}();
3
+ export function createLazyModule(importer) {
4
+ let promise = null;
5
+ return () => {
6
+ promise ??= importer();
7
+ return promise;
8
+ };
9
+ }
10
+ //# sourceMappingURL=lazy-module.js.map
11
+ //# debugId=8a197e16-769b-582e-833f-997a66d98407
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lazy-module.js","sources":["core/shared/lazy-module.ts"],"sourceRoot":"/","sourcesContent":["export function createLazyModule<T>(importer: () => Promise<T>): () => Promise<T> {\n let promise: Promise<T> | null = null;\n return () => {\n promise ??= importer();\n return promise;\n };\n}\n"],"names":[],"mappings":";;AAAA,MAAM,UAAU,gBAAgB,CAAI,QAA0B;IAC5D,IAAI,OAAO,GAAsB,IAAI,CAAC;IACtC,OAAO,GAAG,EAAE;QACV,OAAO,KAAK,QAAQ,EAAE,CAAC;QACvB,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;AACJ,CAAC","debugId":"8a197e16-769b-582e-833f-997a66d98407"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Helpers for deciding whether a CLI option alias is a pure snake_case
3
+ * underscore-duplicate of an existing kebab-case flag.
4
+ *
5
+ * Mutation commands historically register every `--foo-bar` flag together with
6
+ * a `--foo_bar` alias so agents are never blocked by a snake/kebab mismatch.
7
+ * Those underscore duplicates roughly double the option list of every
8
+ * `--help` and waste agent context. We keep them functional as parse-time
9
+ * aliases but hide them from the rendered `--help` text.
10
+ *
11
+ * The rule is intentionally narrow: an alias is hidden ONLY when its long flag
12
+ * is exactly the underscore form of an existing kebab flag (for example
13
+ * `--create_mode` is the `-`→`_` form of `--create-mode`). Semantically-distinct
14
+ * aliases (for example `--fail-on-warn` for `--strict-exit`, `--local` for
15
+ * `--project`, `--ac` for `--acceptance-criteria`) are NOT snake duplicates and
16
+ * stay visible.
17
+ */
18
+ /**
19
+ * Extract every long flag (for example `--create-mode`) from a commander flag
20
+ * spec that may include short aliases and a value placeholder. A spec can list
21
+ * more than one long flag, for example `"--estimate, --estimated-minutes
22
+ * <value>"` → `["--estimate", "--estimated-minutes"]`.
23
+ */
24
+ export declare function extractLongFlags(flagSpec: string): string[];
25
+ /**
26
+ * Extract the first long flag from a commander flag spec, or null when none is
27
+ * present.
28
+ */
29
+ export declare function extractLongFlag(flagSpec: string): string | null;
30
+ /**
31
+ * Returns true when `aliasFlagSpec` differs from `canonicalFlagSpec` ONLY by
32
+ * substituting one or more interior hyphens with underscores — i.e. it is a
33
+ * pure snake_case underscore-duplicate of the canonical kebab flag.
34
+ *
35
+ * Examples that match (alias hidden):
36
+ * --create-mode <- --create_mode
37
+ * --filter-assignee-filter <- --filter-assignee_filter
38
+ *
39
+ * Examples that do NOT match (alias stays visible):
40
+ * --acceptance-criteria <- --ac (different identifier)
41
+ * --order <- --rank (different identifier)
42
+ * --strict-exit <- --fail-on-warn (semantically distinct)
43
+ */
44
+ export declare function isPureSnakeCaseAlias(canonicalFlagSpec: string, aliasFlagSpec: string): boolean;
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Helpers for deciding whether a CLI option alias is a pure snake_case
3
+ * underscore-duplicate of an existing kebab-case flag.
4
+ *
5
+ * Mutation commands historically register every `--foo-bar` flag together with
6
+ * a `--foo_bar` alias so agents are never blocked by a snake/kebab mismatch.
7
+ * Those underscore duplicates roughly double the option list of every
8
+ * `--help` and waste agent context. We keep them functional as parse-time
9
+ * aliases but hide them from the rendered `--help` text.
10
+ *
11
+ * The rule is intentionally narrow: an alias is hidden ONLY when its long flag
12
+ * is exactly the underscore form of an existing kebab flag (for example
13
+ * `--create_mode` is the `-`→`_` form of `--create-mode`). Semantically-distinct
14
+ * aliases (for example `--fail-on-warn` for `--strict-exit`, `--local` for
15
+ * `--project`, `--ac` for `--acceptance-criteria`) are NOT snake duplicates and
16
+ * stay visible.
17
+ */
18
+ /**
19
+ * Extract every long flag (for example `--create-mode`) from a commander flag
20
+ * spec that may include short aliases and a value placeholder. A spec can list
21
+ * more than one long flag, for example `"--estimate, --estimated-minutes
22
+ * <value>"` → `["--estimate", "--estimated-minutes"]`.
23
+ */
24
+
25
+ !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]="9682a7a8-88b3-512a-9c6b-d2dfbe6bc2fb")}catch(e){}}();
26
+ export function extractLongFlags(flagSpec) {
27
+ return flagSpec
28
+ .split(/[\s,|]+/)
29
+ .map((token) => token.trim())
30
+ .filter((token) => token.startsWith("--"));
31
+ }
32
+ /**
33
+ * Extract the first long flag from a commander flag spec, or null when none is
34
+ * present.
35
+ */
36
+ export function extractLongFlag(flagSpec) {
37
+ return extractLongFlags(flagSpec)[0] ?? null;
38
+ }
39
+ /**
40
+ * Returns true when `aliasFlagSpec` differs from `canonicalFlagSpec` ONLY by
41
+ * substituting one or more interior hyphens with underscores — i.e. it is a
42
+ * pure snake_case underscore-duplicate of the canonical kebab flag.
43
+ *
44
+ * Examples that match (alias hidden):
45
+ * --create-mode <- --create_mode
46
+ * --filter-assignee-filter <- --filter-assignee_filter
47
+ *
48
+ * Examples that do NOT match (alias stays visible):
49
+ * --acceptance-criteria <- --ac (different identifier)
50
+ * --order <- --rank (different identifier)
51
+ * --strict-exit <- --fail-on-warn (semantically distinct)
52
+ */
53
+ export function isPureSnakeCaseAlias(canonicalFlagSpec, aliasFlagSpec) {
54
+ const aliasLong = extractLongFlag(aliasFlagSpec);
55
+ if (aliasLong === null) {
56
+ return false;
57
+ }
58
+ const normalize = (long) => long.slice(2).replaceAll("-", "_");
59
+ // The canonical spec may declare multiple long flags (e.g.
60
+ // "--estimate, --estimated-minutes <value>"); the alias is hidden when it is
61
+ // the underscore form of ANY of them.
62
+ return extractLongFlags(canonicalFlagSpec).some((canonicalLong) => {
63
+ if (!canonicalLong.slice(2).includes("-")) {
64
+ // No interior hyphen to convert, so there is no kebab form to snake-duplicate.
65
+ return false;
66
+ }
67
+ if (aliasLong === canonicalLong) {
68
+ // Identical flags are not aliases of one another.
69
+ return false;
70
+ }
71
+ // Reachable from the canonical purely by hyphen→underscore substitution.
72
+ return normalize(aliasLong) === normalize(canonicalLong);
73
+ });
74
+ }
75
+ //# sourceMappingURL=option-alias-visibility.js.map
76
+ //# debugId=9682a7a8-88b3-512a-9c6b-d2dfbe6bc2fb
@@ -0,0 +1 @@
1
+ {"version":3,"file":"option-alias-visibility.js","sources":["core/shared/option-alias-visibility.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Helpers for deciding whether a CLI option alias is a pure snake_case\n * underscore-duplicate of an existing kebab-case flag.\n *\n * Mutation commands historically register every `--foo-bar` flag together with\n * a `--foo_bar` alias so agents are never blocked by a snake/kebab mismatch.\n * Those underscore duplicates roughly double the option list of every\n * `--help` and waste agent context. We keep them functional as parse-time\n * aliases but hide them from the rendered `--help` text.\n *\n * The rule is intentionally narrow: an alias is hidden ONLY when its long flag\n * is exactly the underscore form of an existing kebab flag (for example\n * `--create_mode` is the `-`→`_` form of `--create-mode`). Semantically-distinct\n * aliases (for example `--fail-on-warn` for `--strict-exit`, `--local` for\n * `--project`, `--ac` for `--acceptance-criteria`) are NOT snake duplicates and\n * stay visible.\n */\n\n/**\n * Extract every long flag (for example `--create-mode`) from a commander flag\n * spec that may include short aliases and a value placeholder. A spec can list\n * more than one long flag, for example `\"--estimate, --estimated-minutes\n * <value>\"` → `[\"--estimate\", \"--estimated-minutes\"]`.\n */\nexport function extractLongFlags(flagSpec: string): string[] {\n return flagSpec\n .split(/[\\s,|]+/)\n .map((token) => token.trim())\n .filter((token) => token.startsWith(\"--\"));\n}\n\n/**\n * Extract the first long flag from a commander flag spec, or null when none is\n * present.\n */\nexport function extractLongFlag(flagSpec: string): string | null {\n return extractLongFlags(flagSpec)[0] ?? null;\n}\n\n/**\n * Returns true when `aliasFlagSpec` differs from `canonicalFlagSpec` ONLY by\n * substituting one or more interior hyphens with underscores — i.e. it is a\n * pure snake_case underscore-duplicate of the canonical kebab flag.\n *\n * Examples that match (alias hidden):\n * --create-mode <- --create_mode\n * --filter-assignee-filter <- --filter-assignee_filter\n *\n * Examples that do NOT match (alias stays visible):\n * --acceptance-criteria <- --ac (different identifier)\n * --order <- --rank (different identifier)\n * --strict-exit <- --fail-on-warn (semantically distinct)\n */\nexport function isPureSnakeCaseAlias(canonicalFlagSpec: string, aliasFlagSpec: string): boolean {\n const aliasLong = extractLongFlag(aliasFlagSpec);\n if (aliasLong === null) {\n return false;\n }\n const normalize = (long: string): string => long.slice(2).replaceAll(\"-\", \"_\");\n // The canonical spec may declare multiple long flags (e.g.\n // \"--estimate, --estimated-minutes <value>\"); the alias is hidden when it is\n // the underscore form of ANY of them.\n return extractLongFlags(canonicalFlagSpec).some((canonicalLong) => {\n if (!canonicalLong.slice(2).includes(\"-\")) {\n // No interior hyphen to convert, so there is no kebab form to snake-duplicate.\n return false;\n }\n if (aliasLong === canonicalLong) {\n // Identical flags are not aliases of one another.\n return false;\n }\n // Reachable from the canonical purely by hyphen→underscore substitution.\n return normalize(aliasLong) === normalize(canonicalLong);\n });\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;GAKG;;;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAC/C,OAAO,QAAQ;SACZ,KAAK,CAAC,SAAS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,26 @@ export declare function toNonEmptyStringOrUndefined(value: unknown): string | un
11
11
  export declare function trimTrailingSlashes(value: string): string;
12
12
  export declare function isFiniteNumberArray(value: unknown): value is number[];
13
13
  export declare function toErrorMessage(error: unknown): string;
14
+ /**
15
+ * Narrow a value to a plain object, returning `null` for non-objects,
16
+ * `null`, and arrays. Returns the original reference (no clone).
17
+ *
18
+ * Matches the historical `asRecord` in src/cli/main.ts.
19
+ */
20
+ export declare function asRecordOrNull(value: unknown): Record<string, unknown> | null;
21
+ /**
22
+ * Narrow a value to a plain object, returning `null` only for non-objects and
23
+ * `null` while accepting arrays (arrays are objects). Returns the original
24
+ * reference (no clone).
25
+ *
26
+ * Matches the historical `asRecord` in src/core/extensions/loader.ts, which
27
+ * intentionally omits the array guard.
28
+ */
29
+ export declare function asRecordLoose(value: unknown): Record<string, unknown> | null;
30
+ /**
31
+ * Narrow a value to a plain object, returning an empty object for non-objects,
32
+ * `null`, and arrays. Returns a shallow clone of the source object.
33
+ *
34
+ * Matches the historical `asRecord` in src/mcp/server.ts.
35
+ */
36
+ export declare function asRecordClone(value: unknown): Record<string, unknown>;
@@ -7,7 +7,7 @@
7
7
  * several CLI command modules.
8
8
  */
9
9
 
10
- !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]="2da8cf4a-1ec7-5aa8-a813-07fcc0ede9da")}catch(e){}}();
10
+ !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]="f8eed493-93bf-5473-9c1a-90a791333b5e")}catch(e){}}();
11
11
  export function toNonEmptyString(value) {
12
12
  if (typeof value !== "string") {
13
13
  return null;
@@ -32,5 +32,42 @@ export function toErrorMessage(error) {
32
32
  }
33
33
  return String(error);
34
34
  }
35
+ /**
36
+ * Narrow a value to a plain object, returning `null` for non-objects,
37
+ * `null`, and arrays. Returns the original reference (no clone).
38
+ *
39
+ * Matches the historical `asRecord` in src/cli/main.ts.
40
+ */
41
+ export function asRecordOrNull(value) {
42
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
43
+ return null;
44
+ }
45
+ return value;
46
+ }
47
+ /**
48
+ * Narrow a value to a plain object, returning `null` only for non-objects and
49
+ * `null` while accepting arrays (arrays are objects). Returns the original
50
+ * reference (no clone).
51
+ *
52
+ * Matches the historical `asRecord` in src/core/extensions/loader.ts, which
53
+ * intentionally omits the array guard.
54
+ */
55
+ export function asRecordLoose(value) {
56
+ if (typeof value !== "object" || value === null) {
57
+ return null;
58
+ }
59
+ return value;
60
+ }
61
+ /**
62
+ * Narrow a value to a plain object, returning an empty object for non-objects,
63
+ * `null`, and arrays. Returns a shallow clone of the source object.
64
+ *
65
+ * Matches the historical `asRecord` in src/mcp/server.ts.
66
+ */
67
+ export function asRecordClone(value) {
68
+ return typeof value === "object" && value !== null && !Array.isArray(value)
69
+ ? { ...value }
70
+ : {};
71
+ }
35
72
  //# sourceMappingURL=primitives.js.map
36
- //# debugId=2da8cf4a-1ec7-5aa8-a813-07fcc0ede9da
73
+ //# debugId=f8eed493-93bf-5473-9c1a-90a791333b5e
@@ -1 +1 @@
1
- {"version":3,"file":"primitives.js","sources":["core/shared/primitives.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Common primitive utility functions shared across core modules.\n *\n * These reduce duplication of trivial helpers like string-presence checks,\n * error message extraction, and numeric array guards that were previously\n * duplicated in providers.ts, vector-stores.ts, lock.ts, cache.ts, and\n * several CLI command modules.\n */\n\nexport function toNonEmptyString(value: unknown): string | null {\n if (typeof value !== \"string\") {\n return null;\n }\n const normalized = value.trim();\n return normalized.length > 0 ? normalized : null;\n}\n\nexport function toNonEmptyStringOrUndefined(value: unknown): string | undefined {\n const result = toNonEmptyString(value);\n return result ?? undefined;\n}\n\nexport function trimTrailingSlashes(value: string): string {\n return value.replaceAll(/\\/+$/g, \"\");\n}\n\nexport function isFiniteNumberArray(value: unknown): value is number[] {\n return Array.isArray(value) && value.every((entry) => typeof entry === \"number\" && Number.isFinite(entry));\n}\n\nexport function toErrorMessage(error: unknown): string {\n if (error instanceof Error) {\n const message = error.message.trim();\n return message.length > 0 ? message : error.name;\n }\n return String(error);\n}\n"],"names":[],"mappings":"AAAA;;;;;;;GAOG;;;AAEH,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAChC,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,KAAc;IACxD,MAAM,MAAM,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACvC,OAAO,MAAM,IAAI,SAAS,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC/C,OAAO,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7G,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACrC,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;IACnD,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC","debugId":"2da8cf4a-1ec7-5aa8-a813-07fcc0ede9da"}
1
+ {"version":3,"file":"primitives.js","sources":["core/shared/primitives.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Common primitive utility functions shared across core modules.\n *\n * These reduce duplication of trivial helpers like string-presence checks,\n * error message extraction, and numeric array guards that were previously\n * duplicated in providers.ts, vector-stores.ts, lock.ts, cache.ts, and\n * several CLI command modules.\n */\n\nexport function toNonEmptyString(value: unknown): string | null {\n if (typeof value !== \"string\") {\n return null;\n }\n const normalized = value.trim();\n return normalized.length > 0 ? normalized : null;\n}\n\nexport function toNonEmptyStringOrUndefined(value: unknown): string | undefined {\n const result = toNonEmptyString(value);\n return result ?? undefined;\n}\n\nexport function trimTrailingSlashes(value: string): string {\n return value.replaceAll(/\\/+$/g, \"\");\n}\n\nexport function isFiniteNumberArray(value: unknown): value is number[] {\n return Array.isArray(value) && value.every((entry) => typeof entry === \"number\" && Number.isFinite(entry));\n}\n\nexport function toErrorMessage(error: unknown): string {\n if (error instanceof Error) {\n const message = error.message.trim();\n return message.length > 0 ? message : error.name;\n }\n return String(error);\n}\n\n/**\n * Narrow a value to a plain object, returning `null` for non-objects,\n * `null`, and arrays. Returns the original reference (no clone).\n *\n * Matches the historical `asRecord` in src/cli/main.ts.\n */\nexport function asRecordOrNull(value: unknown): Record<string, unknown> | null {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return null;\n }\n return value as Record<string, unknown>;\n}\n\n/**\n * Narrow a value to a plain object, returning `null` only for non-objects and\n * `null` while accepting arrays (arrays are objects). Returns the original\n * reference (no clone).\n *\n * Matches the historical `asRecord` in src/core/extensions/loader.ts, which\n * intentionally omits the array guard.\n */\nexport function asRecordLoose(value: unknown): Record<string, unknown> | null {\n if (typeof value !== \"object\" || value === null) {\n return null;\n }\n return value as Record<string, unknown>;\n}\n\n/**\n * Narrow a value to a plain object, returning an empty object for non-objects,\n * `null`, and arrays. Returns a shallow clone of the source object.\n *\n * Matches the historical `asRecord` in src/mcp/server.ts.\n */\nexport function asRecordClone(value: unknown): Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n ? ({ ...value } as Record<string, unknown>)\n : {};\n}\n"],"names":[],"mappings":"AAAA;;;;;;;GAOG;;;AAEH,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAChC,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,KAAc;IACxD,MAAM,MAAM,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACvC,OAAO,MAAM,IAAI,SAAS,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC/C,OAAO,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7G,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACrC,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;IACnD,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACxE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAgC,CAAC;AAC1C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAgC,CAAC;AAC1C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACzE,CAAC,CAAE,EAAE,GAAG,KAAK,EAA8B;QAC3C,CAAC,CAAC,EAAE,CAAC;AACT,CAAC","debugId":"f8eed493-93bf-5473-9c1a-90a791333b5e"}
@@ -1,4 +1,3 @@
1
1
  export declare function normalizeLowercaseWhitespace(value: string): string;
2
2
  export declare function tokenizeAlphaNumeric(value: string): string[];
3
- export declare function uniqueTokens(value: string): string[];
4
3
  export declare function jaccardSimilarity(leftTokens: string[], rightTokens: string[]): number;
@@ -1,5 +1,5 @@
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]="519934fd-169a-536b-94a8-67607aac500c")}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]="1109b938-c421-5517-9671-2cebd7e10309")}catch(e){}}();
3
3
  export function normalizeLowercaseWhitespace(value) {
4
4
  return value
5
5
  .trim()
@@ -11,9 +11,6 @@ export function tokenizeAlphaNumeric(value) {
11
11
  .split(/[^a-z0-9]+/)
12
12
  .filter((token) => token.length > 0);
13
13
  }
14
- export function uniqueTokens(value) {
15
- return [...new Set(tokenizeAlphaNumeric(value))];
16
- }
17
14
  export function jaccardSimilarity(leftTokens, rightTokens) {
18
15
  if (leftTokens.length === 0 && rightTokens.length === 0) {
19
16
  return 1;
@@ -33,4 +30,4 @@ export function jaccardSimilarity(leftTokens, rightTokens) {
33
30
  return union === 0 ? 0 : intersection / union;
34
31
  }
35
32
  //# sourceMappingURL=text-normalization.js.map
36
- //# debugId=519934fd-169a-536b-94a8-67607aac500c
33
+ //# debugId=1109b938-c421-5517-9671-2cebd7e10309
@@ -1 +1 @@
1
- {"version":3,"file":"text-normalization.js","sources":["core/shared/text-normalization.ts"],"sourceRoot":"/","sourcesContent":["export function normalizeLowercaseWhitespace(value: string): string {\n return value\n .trim()\n .toLowerCase()\n .replace(/\\s+/g, \" \");\n}\n\nexport function tokenizeAlphaNumeric(value: string): string[] {\n return normalizeLowercaseWhitespace(value)\n .split(/[^a-z0-9]+/)\n .filter((token) => token.length > 0);\n}\n\nexport function uniqueTokens(value: string): string[] {\n return [...new Set(tokenizeAlphaNumeric(value))];\n}\n\nexport function jaccardSimilarity(leftTokens: string[], rightTokens: string[]): number {\n if (leftTokens.length === 0 && rightTokens.length === 0) {\n return 1;\n }\n if (leftTokens.length === 0 || rightTokens.length === 0) {\n return 0;\n }\n const leftSet = new Set(leftTokens);\n const rightSet = new Set(rightTokens);\n let intersection = 0;\n for (const token of leftSet) {\n if (rightSet.has(token)) {\n intersection += 1;\n }\n }\n const union = new Set([...leftSet, ...rightSet]).size;\n return union === 0 ? 0 : intersection / union;\n}\n"],"names":[],"mappings":";;AAAA,MAAM,UAAU,4BAA4B,CAAC,KAAa;IACxD,OAAO,KAAK;SACT,IAAI,EAAE;SACN,WAAW,EAAE;SACb,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAChD,OAAO,4BAA4B,CAAC,KAAK,CAAC;SACvC,KAAK,CAAC,YAAY,CAAC;SACnB,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,UAAoB,EAAE,WAAqB;IAC3E,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxD,OAAO,CAAC,CAAC;IACX,CAAC;IACD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxD,OAAO,CAAC,CAAC;IACX,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;IACpC,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC;IACtC,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAI,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YACxB,YAAY,IAAI,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;IACtD,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,GAAG,KAAK,CAAC;AAChD,CAAC","debugId":"519934fd-169a-536b-94a8-67607aac500c"}
1
+ {"version":3,"file":"text-normalization.js","sources":["core/shared/text-normalization.ts"],"sourceRoot":"/","sourcesContent":["export function normalizeLowercaseWhitespace(value: string): string {\n return value\n .trim()\n .toLowerCase()\n .replace(/\\s+/g, \" \");\n}\n\nexport function tokenizeAlphaNumeric(value: string): string[] {\n return normalizeLowercaseWhitespace(value)\n .split(/[^a-z0-9]+/)\n .filter((token) => token.length > 0);\n}\n\nexport function jaccardSimilarity(leftTokens: string[], rightTokens: string[]): number {\n if (leftTokens.length === 0 && rightTokens.length === 0) {\n return 1;\n }\n if (leftTokens.length === 0 || rightTokens.length === 0) {\n return 0;\n }\n const leftSet = new Set(leftTokens);\n const rightSet = new Set(rightTokens);\n let intersection = 0;\n for (const token of leftSet) {\n if (rightSet.has(token)) {\n intersection += 1;\n }\n }\n const union = new Set([...leftSet, ...rightSet]).size;\n return union === 0 ? 0 : intersection / union;\n}\n"],"names":[],"mappings":";;AAAA,MAAM,UAAU,4BAA4B,CAAC,KAAa;IACxD,OAAO,KAAK;SACT,IAAI,EAAE;SACN,WAAW,EAAE;SACb,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAChD,OAAO,4BAA4B,CAAC,KAAK,CAAC;SACvC,KAAK,CAAC,YAAY,CAAC;SACnB,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,UAAoB,EAAE,WAAqB;IAC3E,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxD,OAAO,CAAC,CAAC;IACX,CAAC;IACD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxD,OAAO,CAAC,CAAC;IACX,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;IACpC,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC;IACtC,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAI,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YACxB,YAAY,IAAI,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;IACtD,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,GAAG,KAAK,CAAC;AAChD,CAAC","debugId":"1109b938-c421-5517-9671-2cebd7e10309"}
@@ -5,9 +5,23 @@ export interface CachedDocumentCandidate {
5
5
  item_format: ItemFormat;
6
6
  item_path: string;
7
7
  }
8
+ export interface ListCacheOptions {
9
+ /**
10
+ * When false, item bodies are neither loaded from nor written to the separate
11
+ * body cache. Metadata-only callers (`pm list`, stats, deps, activity, …) skip
12
+ * the large body cache entirely; only body consumers (search/reindex) pay for it.
13
+ */
14
+ includeBody?: boolean;
15
+ }
8
16
  /**
9
17
  * List all item documents using a persistent on-disk metadata cache.
10
- * Only parses files whose mtime/size have changed since the last cached run.
18
+ *
19
+ * Metadata and bodies are stored in two separate cache files so the hot path
20
+ * (`pm list` and friends, which discard bodies) never loads or rewrites the much
21
+ * larger body payload. Each file is rewritten only when its contents actually
22
+ * change, and per-file onRead hooks are dispatched only when an extension
23
+ * registers one. Only files whose mtime/ctime/size changed since the last run are
24
+ * re-parsed.
11
25
  */
12
- export declare function listAllDocumentCandidatesCached(pmRoot: string, preferredFormat: ItemFormat | undefined, typeToFolder: Record<string, string>, warnings: string[] | undefined, schema: RuntimeSchemaSettings | undefined): Promise<CachedDocumentCandidate[]>;
26
+ export declare function listAllDocumentCandidatesCached(pmRoot: string, preferredFormat: ItemFormat | undefined, typeToFolder: Record<string, string>, warnings: string[] | undefined, schema: RuntimeSchemaSettings | undefined, options?: ListCacheOptions): Promise<CachedDocumentCandidate[]>;
13
27
  export declare function listAllDocumentsCached(pmRoot: string, preferredFormat: ItemFormat | undefined, typeToFolder: Record<string, string>, warnings: string[] | undefined, schema: RuntimeSchemaSettings | undefined): Promise<ItemDocument[]>;